@nexface/chat 0.1.19 → 0.1.20-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,204 @@ 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
+ var RenderBoundary = class extends Component {
46567
+ state = { failed: false };
46568
+ static getDerivedStateFromError() {
46569
+ return { failed: true };
46570
+ }
46571
+ componentDidCatch(error) {
46572
+ this.props.report(error);
46573
+ }
46574
+ render() {
46575
+ return this.state.failed ? this.props.fallback : this.props.children;
46576
+ }
46577
+ };
46578
+ var ToolContent = memo8(function ToolContent2({
46579
+ presentation,
46580
+ context
46581
+ }) {
46582
+ return /* @__PURE__ */ jsx97(Fragment15, { children: presentation.render(context) });
46583
+ });
46584
+ function ToolPresentationUI({
46585
+ presentation: tool2,
46586
+ ...props
46587
+ }) {
46588
+ const registry = useToolPresentations();
46589
+ const chat = useChat();
46590
+ const presentation = registry?.controller?.get(props.toolName);
46591
+ const schema = presentation?.definition.inputSchema;
46592
+ const parsed = useMemo13(() => {
46593
+ if (!schema) return;
46594
+ try {
46595
+ const input = JSON.parse(props.argsText);
46596
+ if (!validateAgentToolInput(schema, input).length) return { input };
46597
+ } catch {
46598
+ }
46599
+ return;
46600
+ }, [schema, props.argsText]);
46601
+ const decoded = useMemo13(
46602
+ () => typeof props.result === "string" ? decodeToolResult(props.result, props.toolName) : void 0,
46603
+ [props.result, props.toolName]
46604
+ );
46605
+ const state = tool2?.type === "tool" ? tool2.toolState : void 0;
46606
+ const status = 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";
46607
+ const context = useMemo13(
46608
+ () => parsed ? {
46609
+ input: parsed.input,
46610
+ status,
46611
+ ...status === "success" ? { result: decoded ? decoded.value : props.result } : {}
46612
+ } : void 0,
46613
+ [parsed, status, decoded, props.result]
46614
+ );
46615
+ const fallback = /* @__PURE__ */ jsx97(ToolCall, { ...props, presentation: tool2 });
46616
+ if (!presentation || !context || decoded?.omitted || chat.interrupt?.toolName === props.toolName && tool2?.type === "tool" && tool2.result === void 0)
46617
+ return fallback;
46618
+ return /* @__PURE__ */ jsxs29(
46619
+ RenderBoundary,
46620
+ {
46621
+ fallback,
46622
+ report: (error) => registry?.report(error, chat.activeSessionId, props.toolCallId),
46623
+ children: [
46624
+ /* @__PURE__ */ jsx97("div", { className: cn("my-2 min-w-0 max-w-full"), "data-slot": "nexface-tool-content", children: /* @__PURE__ */ jsx97(ToolContent, { presentation, context }) }),
46625
+ props.showDetails ? fallback : null
46626
+ ]
46627
+ },
46628
+ props.toolCallId
46629
+ );
46630
+ }
46631
+
46632
+ // src/assistant-components.tsx
46633
+ import { Fragment as Fragment16, jsx as jsx98, jsxs as jsxs30 } from "react/jsx-runtime";
46412
46634
  function AttachmentTile({
46413
46635
  binding,
46414
46636
  savedPreview
46415
46637
  }) {
46416
46638
  const attachment = useAuiState((s) => s.attachment);
46417
46639
  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
46640
+ return /* @__PURE__ */ jsx98(AttachmentUI, { preview, children: /* @__PURE__ */ jsxs30("div", { className: cn("flex max-w-40 flex-col text-xs wrap-anywhere"), children: [
46641
+ /* @__PURE__ */ jsx98(AttachmentPrimitiveName, {}),
46642
+ binding && attachment.status.type === "requires-action" ? /* @__PURE__ */ jsx98("small", { className: cn("text-muted-foreground"), children: "\u5DF2\u5C31\u7EEA" }) : null,
46643
+ attachment.status.type === "running" ? /* @__PURE__ */ jsx98("small", { className: cn("text-muted-foreground"), children: "\u6B63\u5728\u5904\u7406\u2026" }) : null,
46644
+ attachment.status.type === "incomplete" ? /* @__PURE__ */ jsx98("small", { className: cn("text-destructive"), role: "alert", children: attachment.status.message ?? "Attachment processing failed" }) : null
46423
46645
  ] }) });
46424
46646
  }
46425
46647
  function AssistantComposer({
@@ -46447,7 +46669,7 @@ function AssistantComposer({
46447
46669
  (error) => binding.setNotice(error instanceof Error ? error.message : String(error))
46448
46670
  );
46449
46671
  };
46450
- return /* @__PURE__ */ jsxs28(
46672
+ return /* @__PURE__ */ jsxs30(
46451
46673
  Composer,
46452
46674
  {
46453
46675
  onSubmit: (event) => {
@@ -46471,19 +46693,19 @@ function AssistantComposer({
46471
46693
  }
46472
46694
  }
46473
46695
  },
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(
46696
+ actions: /* @__PURE__ */ jsxs30(Fragment16, { children: [
46697
+ 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,
46698
+ voiceBusy ? /* @__PURE__ */ jsx98(
46477
46699
  TooltipIconButton,
46478
46700
  {
46479
46701
  tooltip: "\u53D6\u6D88\u5F55\u97F3",
46480
46702
  "aria-label": "\u53D6\u6D88\u8BED\u97F3\u8F93\u5165",
46481
46703
  className: cn("size-7 shrink-0"),
46482
46704
  onClick: binding.voice.cancel,
46483
- children: /* @__PURE__ */ jsx97(X, { className: cn("size-4") })
46705
+ children: /* @__PURE__ */ jsx98(X, { className: cn("size-4") })
46484
46706
  }
46485
- ) : options2 !== false ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
46486
- /* @__PURE__ */ jsx97(
46707
+ ) : options2 !== false ? /* @__PURE__ */ jsxs30(Fragment16, { children: [
46708
+ /* @__PURE__ */ jsx98(
46487
46709
  "input",
46488
46710
  {
46489
46711
  ref: input,
@@ -46498,7 +46720,7 @@ function AssistantComposer({
46498
46720
  }
46499
46721
  }
46500
46722
  ),
46501
- /* @__PURE__ */ jsx97(
46723
+ /* @__PURE__ */ jsx98(
46502
46724
  "button",
46503
46725
  {
46504
46726
  type: "button",
@@ -46508,21 +46730,21 @@ function AssistantComposer({
46508
46730
  "aria-label": "\u6DFB\u52A0\u9644\u4EF6",
46509
46731
  disabled: inputDisabled,
46510
46732
  onClick: () => input.current?.click(),
46511
- children: /* @__PURE__ */ jsx97(Plus, { className: cn("size-4") })
46733
+ children: /* @__PURE__ */ jsx98(Plus, { className: cn("size-4") })
46512
46734
  }
46513
46735
  )
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(
46736
+ ] }) : /* @__PURE__ */ jsx98("span", {}),
46737
+ voiceBusy ? /* @__PURE__ */ jsx98(ComposerVoice, { recording: binding.voice.status === "recording" }) : null,
46738
+ /* @__PURE__ */ jsxs30("div", { className: cn("flex shrink-0 items-center gap-1"), children: [
46739
+ /* @__PURE__ */ jsxs30(AuiIf, { condition: (state) => state.thread.capabilities.dictation, children: [
46740
+ /* @__PURE__ */ jsx98(AuiIf, { condition: (state) => state.composer.dictation == null, children: /* @__PURE__ */ jsx98(TooltipProvider2, { delayDuration: 0, children: /* @__PURE__ */ jsxs30(Tooltip2, { children: [
46741
+ /* @__PURE__ */ jsx98(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx98(
46520
46742
  "span",
46521
46743
  {
46522
46744
  className: cn("inline-flex"),
46523
46745
  tabIndex: voiceDisabledReason ? 0 : void 0,
46524
46746
  "aria-label": voiceDisabledReason,
46525
- children: /* @__PURE__ */ jsx97(ComposerPrimitiveDictate, { asChild: true, disabled: busy || sending, children: /* @__PURE__ */ jsx97(
46747
+ children: /* @__PURE__ */ jsx98(ComposerPrimitiveDictate, { asChild: true, disabled: busy || sending, children: /* @__PURE__ */ jsx98(
46526
46748
  Button,
46527
46749
  {
46528
46750
  variant: "ghost",
@@ -46530,19 +46752,19 @@ function AssistantComposer({
46530
46752
  "aria-label": "\u5F00\u59CB\u8BED\u97F3\u8F93\u5165",
46531
46753
  "aria-description": voiceDisabledReason,
46532
46754
  className: cn("size-7 p-1"),
46533
- children: /* @__PURE__ */ jsx97(Mic, { className: cn("size-4") })
46755
+ children: /* @__PURE__ */ jsx98(Mic, { className: cn("size-4") })
46534
46756
  }
46535
46757
  ) })
46536
46758
  }
46537
46759
  ) }),
46538
- /* @__PURE__ */ jsx97(TooltipContent3, { children: voiceDisabledReason ?? "\u8BED\u97F3\u8F93\u5165" })
46760
+ /* @__PURE__ */ jsx98(TooltipContent3, { children: voiceDisabledReason ?? "\u8BED\u97F3\u8F93\u5165" })
46539
46761
  ] }) }) }),
46540
- /* @__PURE__ */ jsx97(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx97(
46762
+ /* @__PURE__ */ jsx98(AuiIf, { condition: (state) => state.composer.dictation != null, children: /* @__PURE__ */ jsx98(
46541
46763
  ComposerPrimitiveStopDictation,
46542
46764
  {
46543
46765
  asChild: true,
46544
46766
  disabled: binding.voice.status !== "recording",
46545
- children: /* @__PURE__ */ jsx97(
46767
+ children: /* @__PURE__ */ jsx98(
46546
46768
  "button",
46547
46769
  {
46548
46770
  type: "button",
@@ -46551,13 +46773,13 @@ function AssistantComposer({
46551
46773
  className: cn(
46552
46774
  "text-destructive rounded-control grid size-7 place-items-center transition-colors disabled:opacity-50"
46553
46775
  ),
46554
- children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 animate-pulse fill-current") })
46776
+ children: /* @__PURE__ */ jsx98(Square, { className: cn("size-3 animate-pulse fill-current") })
46555
46777
  }
46556
46778
  )
46557
46779
  }
46558
46780
  ) })
46559
46781
  ] }),
46560
- showCancel ? /* @__PURE__ */ jsx97(
46782
+ showCancel ? /* @__PURE__ */ jsx98(
46561
46783
  "button",
46562
46784
  {
46563
46785
  type: "button",
@@ -46567,9 +46789,9 @@ function AssistantComposer({
46567
46789
  ),
46568
46790
  disabled: cancelling,
46569
46791
  onClick: cancel,
46570
- children: /* @__PURE__ */ jsx97(Square, { className: cn("size-3 fill-current") })
46792
+ children: /* @__PURE__ */ jsx98(Square, { className: cn("size-3 fill-current") })
46571
46793
  }
46572
- ) : /* @__PURE__ */ jsx97(ComposerPrimitiveSend, { asChild: true, disabled: inputDisabled, children: /* @__PURE__ */ jsx97(
46794
+ ) : /* @__PURE__ */ jsx98(ComposerPrimitiveSend, { asChild: true, disabled: inputDisabled, children: /* @__PURE__ */ jsx98(
46573
46795
  "button",
46574
46796
  {
46575
46797
  type: "button",
@@ -46581,13 +46803,13 @@ function AssistantComposer({
46581
46803
  className: cn(
46582
46804
  "bg-primary text-primary-foreground rounded-control grid size-7 place-items-center transition-opacity disabled:opacity-40"
46583
46805
  ),
46584
- children: /* @__PURE__ */ jsx97(ArrowUp, { className: cn("size-4") })
46806
+ children: /* @__PURE__ */ jsx98(ArrowUp, { className: cn("size-4") })
46585
46807
  }
46586
46808
  ) })
46587
46809
  ] })
46588
46810
  ] }),
46589
46811
  children: [
46590
- /* @__PURE__ */ jsx97(
46812
+ /* @__PURE__ */ jsx98(
46591
46813
  "div",
46592
46814
  {
46593
46815
  ref: (element2) => {
@@ -46596,10 +46818,10 @@ function AssistantComposer({
46596
46818
  className: cn(
46597
46819
  "aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden"
46598
46820
  ),
46599
- children: /* @__PURE__ */ jsx97(ComposerPrimitiveAttachments, { children: () => /* @__PURE__ */ jsx97(AttachmentTile, { binding }) })
46821
+ children: /* @__PURE__ */ jsx98(ComposerPrimitiveAttachments, { children: () => /* @__PURE__ */ jsx98(AttachmentTile, { binding }) })
46600
46822
  }
46601
46823
  ),
46602
- sending ? /* @__PURE__ */ jsx97("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null
46824
+ sending ? /* @__PURE__ */ jsx98("small", { role: "status", children: "\u6B63\u5728\u5904\u7406\u9644\u4EF6\u2026" }) : null
46603
46825
  ]
46604
46826
  }
46605
46827
  );
@@ -46618,8 +46840,8 @@ function ToolGroup({
46618
46840
  if (errorIds !== "[]") setOpen(true);
46619
46841
  }, [errorIds]);
46620
46842
  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(
46843
+ return /* @__PURE__ */ jsxs30(ToolGroupRoot, { variant: "ghost", className: cn("my-1"), open, onOpenChange: setOpen, children: [
46844
+ /* @__PURE__ */ jsx98(
46623
46845
  DisclosureTrigger,
46624
46846
  {
46625
46847
  live: running && !hasErrors,
@@ -46627,7 +46849,7 @@ function ToolGroup({
46627
46849
  detail: `${count3} tools`
46628
46850
  }
46629
46851
  ),
46630
- /* @__PURE__ */ jsx97(ToolGroupContent, { className: cn(disclosureContentClass), children })
46852
+ /* @__PURE__ */ jsx98(ToolGroupContent, { className: cn(disclosureContentClass), children })
46631
46853
  ] });
46632
46854
  }
46633
46855
  var GroupedParts = MessagePrimitiveGroupedParts;
@@ -46641,81 +46863,88 @@ function AssistantParts({
46641
46863
  showDetails,
46642
46864
  tools = []
46643
46865
  }) {
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;
46866
+ const registry = useToolPresentations2();
46867
+ return /* @__PURE__ */ jsx98(Fragment16, { children: /* @__PURE__ */ jsx98(
46868
+ GroupedParts,
46869
+ {
46870
+ groupBy: (part, context) => part.type === "tool-call" && registry?.controller?.get(part.toolName) ? [] : groupAssistantParts(part, context),
46871
+ children: ({ part, children }) => {
46872
+ switch (part.type) {
46873
+ case "group-chainOfThought":
46874
+ return /* @__PURE__ */ jsx98("div", { className: cn("mb-3"), children });
46875
+ case "group-tool":
46876
+ return part.indices.length === 1 ? /* @__PURE__ */ jsx98(Fragment16, { children }) : /* @__PURE__ */ jsx98(
46877
+ ToolGroup,
46878
+ {
46879
+ tools: tools.filter((_, index5) => part.indices.includes(index5)),
46880
+ running: part.status.type === "running",
46881
+ count: part.indices.length,
46882
+ children
46883
+ }
46884
+ );
46885
+ case "group-reasoning":
46886
+ return /* @__PURE__ */ jsxs30(
46887
+ ReasoningRoot3,
46888
+ {
46889
+ variant: "ghost",
46890
+ streaming: part.status.type === "running",
46891
+ className: cn("my-1"),
46892
+ children: [
46893
+ /* @__PURE__ */ jsx98(
46894
+ DisclosureTrigger,
46895
+ {
46896
+ live: part.status.type === "running",
46897
+ label: part.status.type === "running" ? "thinking" : "reasoning"
46898
+ }
46899
+ ),
46900
+ /* @__PURE__ */ jsx98(
46901
+ ReasoningContent,
46902
+ {
46903
+ "aria-busy": part.status.type === "running",
46904
+ className: cn(disclosureContentClass),
46905
+ children: /* @__PURE__ */ jsx98(ReasoningText, { className: cn("ps-0"), children })
46906
+ }
46907
+ )
46908
+ ]
46909
+ }
46910
+ );
46911
+ case "reasoning":
46912
+ return /* @__PURE__ */ jsx98(Reasoning, { ...part });
46913
+ case "group-source":
46914
+ case "source":
46915
+ return null;
46916
+ case "data":
46917
+ return part.dataRendererUI;
46918
+ case "text":
46919
+ return part.text === "" && part.status?.type === "running" ? /* @__PURE__ */ jsx98(TraceLine, { live: true, label: "thinking" }) : /* @__PURE__ */ jsx98(MarkdownText, {});
46920
+ case "tool-call":
46921
+ return part.toolUI ?? /* @__PURE__ */ jsx98(
46922
+ ToolPresentationUI,
46923
+ {
46924
+ ...part,
46925
+ showDetails,
46926
+ presentation: tools.find(
46927
+ (tool2) => tool2.type === "tool" && tool2.toolCallId === part.toolCallId
46928
+ )
46929
+ }
46930
+ );
46931
+ case "indicator":
46932
+ return /* @__PURE__ */ jsx98(TraceLine, { live: true, label: "thinking" });
46933
+ default:
46934
+ return null;
46935
+ }
46936
+ }
46708
46937
  }
46709
- } }) });
46938
+ ) });
46710
46939
  }
46711
46940
 
46712
46941
  // src/default-chat.tsx
46713
- import { useChat } from "./react.js";
46942
+ import { useChat as useChat2 } from "./react.js";
46714
46943
  import { sendErrorNotice } from "./errors.js";
46715
- import { Fragment as Fragment16, jsx as jsx98, jsxs as jsxs29 } from "react/jsx-runtime";
46944
+ import { Fragment as Fragment17, jsx as jsx99, jsxs as jsxs31 } from "react/jsx-runtime";
46716
46945
  var textOf = (message) => message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
46717
46946
  var Icon2 = forwardRef33(function Icon3({ label, children, className, ...props }, ref) {
46718
- return /* @__PURE__ */ jsx98(
46947
+ return /* @__PURE__ */ jsx99(
46719
46948
  "button",
46720
46949
  {
46721
46950
  ref,
@@ -46760,7 +46989,7 @@ function Resize({
46760
46989
  return () => observer.disconnect();
46761
46990
  }, [min2, max2]);
46762
46991
  const clamp2 = (value) => Math.max(min2, Math.min(max2, window.innerWidth - 32, value));
46763
- return /* @__PURE__ */ jsx98(
46992
+ return /* @__PURE__ */ jsx99(
46764
46993
  "div",
46765
46994
  {
46766
46995
  ref: handle2,
@@ -46805,6 +47034,7 @@ function Chat({
46805
47034
  avatar,
46806
47035
  welcomeMessage = "\u4ECA\u5929\u60F3\u8BA9\u6211\u5E2E\u4F60\u505A\u4EC0\u4E48\uFF1F",
46807
47036
  welcomeDescription,
47037
+ welcomeIcon,
46808
47038
  open = true,
46809
47039
  onOpenChange,
46810
47040
  placeholder = "\u63CF\u8FF0\u4F60\u7684\u4EFB\u52A1...",
@@ -46821,7 +47051,7 @@ function Chat({
46821
47051
  onFullscreenChange,
46822
47052
  onRunResult
46823
47053
  }) {
46824
- const chat = useChat();
47054
+ const chat = useChat2();
46825
47055
  const nextMessage = useNextMessage(chat, suggestNextMessage, open);
46826
47056
  const { activeSessionId: sessionId, messages, status, interrupt } = chat;
46827
47057
  const busy = status !== "idle" && status !== "error";
@@ -46874,7 +47104,7 @@ function Chat({
46874
47104
  }
46875
47105
  updateDialog(next);
46876
47106
  };
46877
- const byId = useMemo13(
47107
+ const byId = useMemo14(
46878
47108
  () => new Map(projectMessages(messages).map((message) => [message.id, message])),
46879
47109
  [messages]
46880
47110
  );
@@ -46925,7 +47155,7 @@ function Chat({
46925
47155
  throw error;
46926
47156
  }
46927
47157
  };
46928
- return /* @__PURE__ */ jsx98(Fragment16, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx98(
47158
+ return /* @__PURE__ */ jsx99(Fragment17, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx99(
46929
47159
  SessionRuntime,
46930
47160
  {
46931
47161
  id: session.id,
@@ -46937,7 +47167,7 @@ function Chat({
46937
47167
  open,
46938
47168
  onEdit: editThroughRuntime,
46939
47169
  children: (binding) => {
46940
- const history = sidebarOpen ? /* @__PURE__ */ jsxs29(
47170
+ const history = sidebarOpen ? /* @__PURE__ */ jsxs31(
46941
47171
  "nav",
46942
47172
  {
46943
47173
  ref: sidebarNav,
@@ -46963,7 +47193,7 @@ function Chat({
46963
47193
  style: sidebarLayout === "overlay" && sidebarWidth !== void 0 ? { width: sidebarWidth } : void 0,
46964
47194
  "aria-label": "\u4F1A\u8BDD\u5386\u53F2",
46965
47195
  children: [
46966
- sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
47196
+ sidebarLayout === "overlay" ? /* @__PURE__ */ jsx99(
46967
47197
  Resize,
46968
47198
  {
46969
47199
  label: "\u8C03\u6574\u4F1A\u8BDD\u5386\u53F2\u680F\u5BBD\u5EA6",
@@ -46974,33 +47204,33 @@ function Chat({
46974
47204
  max: 400
46975
47205
  }
46976
47206
  ) : null,
46977
- /* @__PURE__ */ jsxs29(
47207
+ /* @__PURE__ */ jsxs31(
46978
47208
  "div",
46979
47209
  {
46980
47210
  className: cn(
46981
47211
  "flex h-12 shrink-0 items-center gap-2 border-b border-foreground/10 px-4 md:px-5"
46982
47212
  ),
46983
47213
  children: [
46984
- sidebarLayout === "overlay" ? /* @__PURE__ */ jsx98(
47214
+ sidebarLayout === "overlay" ? /* @__PURE__ */ jsx99(
46985
47215
  Icon2,
46986
47216
  {
46987
47217
  label: "\u6536\u8D77\u4F1A\u8BDD\u5386\u53F2",
46988
47218
  "aria-expanded": sidebarOpen,
46989
47219
  className: cn("size-7 shrink-0"),
46990
47220
  onClick: () => setSidebar(false),
46991
- children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
47221
+ children: /* @__PURE__ */ jsx99(PanelLeft, { className: cn("size-4") })
46992
47222
  }
46993
47223
  ) : 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 }) })
47224
+ /* @__PURE__ */ jsxs31(Avatar3, { children: [
47225
+ avatar ? /* @__PURE__ */ jsx99(AvatarImage3, { src: avatar, alt: "" }) : null,
47226
+ /* @__PURE__ */ jsx99(AvatarFallback3, { children: /* @__PURE__ */ jsx99(Bot, { size: 20 }) })
46997
47227
  ] }),
46998
- /* @__PURE__ */ jsx98("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
47228
+ /* @__PURE__ */ jsx99("strong", { className: cn("min-w-0 flex-1 truncate text-[13px] font-medium"), children: title })
46999
47229
  ]
47000
47230
  }
47001
47231
  ),
47002
- /* @__PURE__ */ jsxs29("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
47003
- /* @__PURE__ */ jsx98(
47232
+ /* @__PURE__ */ jsxs31("div", { className: cn("flex min-h-0 flex-1 flex-col p-3"), children: [
47233
+ /* @__PURE__ */ jsx99(
47004
47234
  ThreadListNew,
47005
47235
  {
47006
47236
  disabled: sessionBusy || binding.sending,
@@ -47010,20 +47240,20 @@ function Chat({
47010
47240
  }
47011
47241
  }
47012
47242
  ),
47013
- /* @__PURE__ */ jsx98(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
47014
- /* @__PURE__ */ jsx98(
47243
+ /* @__PURE__ */ jsx99(ThreadListSearch, { value: threadSearch, onValueChange: setThreadSearch }),
47244
+ /* @__PURE__ */ jsx99(
47015
47245
  "small",
47016
47246
  {
47017
47247
  className: cn("text-muted-foreground mt-5 mb-1 px-2 text-xs font-medium"),
47018
47248
  children: "\u6700\u8FD1\u4F1A\u8BDD"
47019
47249
  }
47020
47250
  ),
47021
- /* @__PURE__ */ jsx98(ThreadListRoot, { children: /* @__PURE__ */ jsx98(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx98(
47251
+ /* @__PURE__ */ jsx99(ThreadListRoot, { children: /* @__PURE__ */ jsx99(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx99(
47022
47252
  ThreadListItem,
47023
47253
  {
47024
47254
  disabled: sessionBusy || binding.sending,
47025
- menu: (beginRename) => /* @__PURE__ */ jsxs29(Fragment16, { children: [
47026
- /* @__PURE__ */ jsx98(
47255
+ menu: (beginRename) => /* @__PURE__ */ jsxs31(Fragment17, { children: [
47256
+ /* @__PURE__ */ jsx99(
47027
47257
  DropdownMenuItem3,
47028
47258
  {
47029
47259
  disabled: sessionBusy || binding.sending,
@@ -47031,7 +47261,7 @@ function Chat({
47031
47261
  children: "\u91CD\u547D\u540D"
47032
47262
  }
47033
47263
  ),
47034
- /* @__PURE__ */ jsx98(
47264
+ /* @__PURE__ */ jsx99(
47035
47265
  DropdownMenuItem3,
47036
47266
  {
47037
47267
  variant: "destructive",
@@ -47045,7 +47275,7 @@ function Chat({
47045
47275
  children: "\u6E05\u7A7A\u6D88\u606F"
47046
47276
  }
47047
47277
  ),
47048
- /* @__PURE__ */ jsx98(
47278
+ /* @__PURE__ */ jsx99(
47049
47279
  DropdownMenuItem3,
47050
47280
  {
47051
47281
  variant: "destructive",
@@ -47064,7 +47294,7 @@ function Chat({
47064
47294
  ) : null }) }),
47065
47295
  threadSearch.trim() && !chat.sessions.some(
47066
47296
  (session2) => session2.title.toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase())
47067
- ) ? /* @__PURE__ */ jsx98(
47297
+ ) ? /* @__PURE__ */ jsx99(
47068
47298
  "div",
47069
47299
  {
47070
47300
  "data-slot": "aui_thread-list-empty",
@@ -47076,7 +47306,7 @@ function Chat({
47076
47306
  ]
47077
47307
  }
47078
47308
  ) : null;
47079
- return open ? /* @__PURE__ */ jsxs29(
47309
+ return open ? /* @__PURE__ */ jsxs31(
47080
47310
  ChatSurface,
47081
47311
  {
47082
47312
  className: `nexface-chat${className ? ` ${className}` : ""}`,
@@ -47092,7 +47322,7 @@ function Chat({
47092
47322
  ...fullscreen ? { border: 0, borderRadius: 0 } : {}
47093
47323
  },
47094
47324
  children: [
47095
- layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx98(
47325
+ layout === "docked" && !fullscreen ? /* @__PURE__ */ jsx99(
47096
47326
  Resize,
47097
47327
  {
47098
47328
  label: "\u8C03\u6574\u804A\u5929\u5BBD\u5EA6",
@@ -47105,7 +47335,7 @@ function Chat({
47105
47335
  }
47106
47336
  ) : null,
47107
47337
  sidebarLayout === "outside" ? history : null,
47108
- /* @__PURE__ */ jsxs29(
47338
+ /* @__PURE__ */ jsxs31(
47109
47339
  "section",
47110
47340
  {
47111
47341
  ref: panel,
@@ -47114,8 +47344,8 @@ function Chat({
47114
47344
  ),
47115
47345
  "aria-label": `${title} chat`,
47116
47346
  children: [
47117
- sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs29(Fragment16, { children: [
47118
- /* @__PURE__ */ jsx98(
47347
+ sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs31(Fragment17, { children: [
47348
+ /* @__PURE__ */ jsx99(
47119
47349
  "button",
47120
47350
  {
47121
47351
  type: "button",
@@ -47127,7 +47357,7 @@ function Chat({
47127
47357
  ),
47128
47358
  history
47129
47359
  ] }) : null,
47130
- /* @__PURE__ */ jsxs29(
47360
+ /* @__PURE__ */ jsxs31(
47131
47361
  "div",
47132
47362
  {
47133
47363
  ref: (element2) => {
@@ -47138,7 +47368,7 @@ function Chat({
47138
47368
  },
47139
47369
  className: cn("flex min-h-0 min-w-0 flex-1 flex-col"),
47140
47370
  children: [
47141
- /* @__PURE__ */ jsxs29(
47371
+ /* @__PURE__ */ jsxs31(
47142
47372
  "header",
47143
47373
  {
47144
47374
  "data-slot": "nexface_chat_header",
@@ -47146,12 +47376,12 @@ function Chat({
47146
47376
  "border-foreground/10 flex h-12 shrink-0 min-w-0 items-center gap-2 border-b px-4 md:px-5"
47147
47377
  ),
47148
47378
  children: [
47149
- /* @__PURE__ */ jsxs29(
47379
+ /* @__PURE__ */ jsxs31(
47150
47380
  "div",
47151
47381
  {
47152
47382
  className: cn("flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap"),
47153
47383
  children: [
47154
- sidebarEnabled && (sidebarLayout === "outside" || !sidebarOpen) ? /* @__PURE__ */ jsx98(
47384
+ sidebarEnabled && (sidebarLayout === "outside" || !sidebarOpen) ? /* @__PURE__ */ jsx99(
47155
47385
  Icon2,
47156
47386
  {
47157
47387
  ref: sidebarTrigger,
@@ -47159,17 +47389,17 @@ function Chat({
47159
47389
  "aria-expanded": sidebarOpen,
47160
47390
  className: cn("size-7 shrink-0"),
47161
47391
  onClick: () => setSidebar((value) => !value),
47162
- children: /* @__PURE__ */ jsx98(PanelLeft, { className: cn("size-4") })
47392
+ children: /* @__PURE__ */ jsx99(PanelLeft, { className: cn("size-4") })
47163
47393
  }
47164
47394
  ) : null,
47165
- /* @__PURE__ */ jsx98("strong", { className: cn("truncate text-[13px] font-medium"), children: activeTitle })
47395
+ /* @__PURE__ */ jsx99("strong", { className: cn("truncate text-[13px] font-medium"), children: activeTitle })
47166
47396
  ]
47167
47397
  }
47168
47398
  ),
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(
47399
+ /* @__PURE__ */ jsxs31("div", { className: cn("-me-1.5 ml-auto flex shrink-0 items-center gap-1.5"), children: [
47400
+ /* @__PURE__ */ jsxs31(DropdownMenu2, { modal: false, children: [
47401
+ /* @__PURE__ */ jsx99(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx99(Icon2, { label: "\u66F4\u591A\u4F1A\u8BDD\u64CD\u4F5C", children: /* @__PURE__ */ jsx99(Ellipsis, {}) }) }),
47402
+ /* @__PURE__ */ jsx99(DropdownMenuContent3, { align: "end", children: /* @__PURE__ */ jsx99(
47173
47403
  DropdownMenuItem3,
47174
47404
  {
47175
47405
  variant: "destructive",
@@ -47184,40 +47414,47 @@ function Chat({
47184
47414
  }
47185
47415
  ) })
47186
47416
  ] }),
47187
- /* @__PURE__ */ jsx98(
47417
+ /* @__PURE__ */ jsx99(
47188
47418
  Icon2,
47189
47419
  {
47190
47420
  label: "\u65B0\u5EFA\u804A\u5929\u4F1A\u8BDD",
47191
47421
  disabled: sessionBusy || binding.sending,
47192
47422
  onClick: () => safe(() => chat.createSession()),
47193
- children: /* @__PURE__ */ jsx98(Plus, {})
47423
+ children: /* @__PURE__ */ jsx99(Plus, {})
47194
47424
  }
47195
47425
  ),
47196
- /* @__PURE__ */ jsx98(
47426
+ /* @__PURE__ */ jsx99(
47197
47427
  Icon2,
47198
47428
  {
47199
47429
  ref: headerFocusButton,
47200
47430
  label: fullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F",
47201
47431
  onClick: () => changeFullscreen(!fullscreen),
47202
- children: fullscreen ? /* @__PURE__ */ jsx98(Minimize2, {}) : /* @__PURE__ */ jsx98(Maximize2, {})
47432
+ children: fullscreen ? /* @__PURE__ */ jsx99(Minimize2, {}) : /* @__PURE__ */ jsx99(Maximize2, {})
47203
47433
  }
47204
47434
  ),
47205
- onOpenChange ? /* @__PURE__ */ jsx98(Icon2, { label: "\u5173\u95ED Agent \u5BF9\u8BDD", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx98(X, {}) }) : null
47435
+ onOpenChange ? /* @__PURE__ */ jsx99(Icon2, { label: "\u5173\u95ED Agent \u5BF9\u8BDD", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx99(X, {}) }) : null
47206
47436
  ] })
47207
47437
  ]
47208
47438
  }
47209
47439
  ),
47210
- /* @__PURE__ */ jsx98(
47440
+ /* @__PURE__ */ jsx99(
47211
47441
  "div",
47212
47442
  {
47213
47443
  "data-slot": "nexface_chat_body",
47214
47444
  className: cn("relative flex min-h-0 flex-1"),
47215
- children: /* @__PURE__ */ jsx98(
47445
+ children: /* @__PURE__ */ jsx99(
47216
47446
  Thread,
47217
47447
  {
47218
47448
  empty: !messages.length,
47219
- welcome: /* @__PURE__ */ jsx98(Greeting, { title: welcomeMessage, description: welcomeDescription }),
47220
- suggestions: /* @__PURE__ */ jsx98(
47449
+ welcome: /* @__PURE__ */ jsx99(
47450
+ Greeting,
47451
+ {
47452
+ title: welcomeMessage,
47453
+ description: welcomeDescription,
47454
+ icon: welcomeIcon
47455
+ }
47456
+ ),
47457
+ suggestions: /* @__PURE__ */ jsx99(
47221
47458
  Suggestions2,
47222
47459
  {
47223
47460
  suggestions,
@@ -47225,21 +47462,21 @@ function Chat({
47225
47462
  onSend: (prompt) => void execute(prompt)
47226
47463
  }
47227
47464
  ),
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: [
47465
+ footer: /* @__PURE__ */ jsxs31(Fragment17, { children: [
47466
+ chat.storageWarning ? /* @__PURE__ */ jsx99("div", { role: "alert", className: cn("text-muted-foreground text-xs"), children: chat.storageWarning }) : null,
47467
+ notice ? /* @__PURE__ */ jsxs31("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: [
47231
47468
  notice,
47232
- /* @__PURE__ */ jsx98("button", { onClick: () => setNotice(""), children: "\xD7" })
47469
+ /* @__PURE__ */ jsx99("button", { onClick: () => setNotice(""), children: "\xD7" })
47233
47470
  ] }) : null,
47234
- binding.notice ? /* @__PURE__ */ jsxs29(
47471
+ binding.notice ? /* @__PURE__ */ jsxs31(
47235
47472
  ErrorPrimitiveRoot,
47236
47473
  {
47237
47474
  className: cn(
47238
47475
  "border-destructive/60 text-destructive flex items-start gap-3 border-l-2 pl-3 text-[13px] leading-relaxed"
47239
47476
  ),
47240
47477
  children: [
47241
- /* @__PURE__ */ jsx98("span", { className: cn("min-w-0 flex-1 break-words"), children: binding.notice }),
47242
- /* @__PURE__ */ jsx98(
47478
+ /* @__PURE__ */ jsx99("span", { className: cn("min-w-0 flex-1 break-words"), children: binding.notice }),
47479
+ /* @__PURE__ */ jsx99(
47243
47480
  Icon2,
47244
47481
  {
47245
47482
  label: "\u5173\u95ED\u63D0\u793A",
@@ -47247,14 +47484,14 @@ function Chat({
47247
47484
  "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
47485
  ),
47249
47486
  onClick: () => binding.setNotice(""),
47250
- children: /* @__PURE__ */ jsx98(X, {})
47487
+ children: /* @__PURE__ */ jsx99(X, {})
47251
47488
  }
47252
47489
  )
47253
47490
  ]
47254
47491
  }
47255
47492
  ) : null
47256
47493
  ] }),
47257
- composer: /* @__PURE__ */ jsx98(
47494
+ composer: /* @__PURE__ */ jsx99(
47258
47495
  AssistantComposer,
47259
47496
  {
47260
47497
  binding,
@@ -47268,7 +47505,7 @@ function Chat({
47268
47505
  ),
47269
47506
  renderMessage: ({ message: rendered }) => {
47270
47507
  const message = byId.get(rendered.id);
47271
- return message ? /* @__PURE__ */ jsx98(Fragment16, { children: editing?.id === message.id ? /* @__PURE__ */ jsx98(
47508
+ return message ? /* @__PURE__ */ jsx99(Fragment17, { children: editing?.id === message.id ? /* @__PURE__ */ jsx99(
47272
47509
  EditComposer,
47273
47510
  {
47274
47511
  onKeyDown: (event) => {
@@ -47289,16 +47526,16 @@ function Chat({
47289
47526
  type: "button",
47290
47527
  disabled: busy || binding.sending || binding.voice.status !== "idle" || !editing.text.trim() && !editing.files.length
47291
47528
  },
47292
- children: editing.files.map((file) => /* @__PURE__ */ jsxs29(
47529
+ children: editing.files.map((file) => /* @__PURE__ */ jsxs31(
47293
47530
  "div",
47294
47531
  {
47295
47532
  className: cn(
47296
47533
  "bg-muted flex min-w-0 items-center gap-2 rounded-md px-3 py-2 text-sm"
47297
47534
  ),
47298
47535
  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(
47536
+ /* @__PURE__ */ jsx99(Paperclip, { className: cn("size-4 shrink-0") }),
47537
+ /* @__PURE__ */ jsx99("span", { className: cn("min-w-0 flex-1 truncate"), children: file.name }),
47538
+ /* @__PURE__ */ jsx99(
47302
47539
  TooltipIconButton,
47303
47540
  {
47304
47541
  tooltip: "\u79FB\u9664\u9644\u4EF6",
@@ -47311,7 +47548,7 @@ function Chat({
47311
47548
  (item) => item.id !== file.id
47312
47549
  )
47313
47550
  }),
47314
- children: /* @__PURE__ */ jsx98(X, {})
47551
+ children: /* @__PURE__ */ jsx99(X, {})
47315
47552
  }
47316
47553
  )
47317
47554
  ]
@@ -47319,16 +47556,16 @@ function Chat({
47319
47556
  file.id
47320
47557
  ))
47321
47558
  }
47322
- ) : /* @__PURE__ */ jsx98(Fragment16, { children: message.role === "user" ? /* @__PURE__ */ jsx98(
47559
+ ) : /* @__PURE__ */ jsx99(Fragment17, { children: message.role === "user" ? /* @__PURE__ */ jsx99(
47323
47560
  UserMessage,
47324
47561
  {
47325
- attachments: /* @__PURE__ */ jsx98(
47562
+ attachments: /* @__PURE__ */ jsx99(
47326
47563
  "div",
47327
47564
  {
47328
47565
  className: cn(
47329
47566
  "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
47567
  ),
47331
- children: /* @__PURE__ */ jsx98(MessagePrimitiveAttachments, { children: ({ attachment }) => /* @__PURE__ */ jsx98(
47568
+ children: /* @__PURE__ */ jsx99(MessagePrimitiveAttachments, { children: ({ attachment }) => /* @__PURE__ */ jsx99(
47332
47569
  AttachmentTile,
47333
47570
  {
47334
47571
  savedPreview: message.attachments?.find(
@@ -47338,7 +47575,7 @@ function Chat({
47338
47575
  ) })
47339
47576
  }
47340
47577
  ),
47341
- actions: message.id === latestUser?.id ? /* @__PURE__ */ jsx98(ActionBarPrimitiveEdit, { asChild: true, children: /* @__PURE__ */ jsx98(
47578
+ actions: message.id === latestUser?.id ? /* @__PURE__ */ jsx99(ActionBarPrimitiveEdit, { asChild: true, children: /* @__PURE__ */ jsx99(
47342
47579
  "button",
47343
47580
  {
47344
47581
  type: "button",
@@ -47350,32 +47587,32 @@ function Chat({
47350
47587
  text: textOf(message),
47351
47588
  files: message.attachments ?? []
47352
47589
  }),
47353
- children: /* @__PURE__ */ jsx98(Pencil, { className: cn("size-4") })
47590
+ children: /* @__PURE__ */ jsx99(Pencil, { className: cn("size-4") })
47354
47591
  }
47355
47592
  ) }) : null,
47356
- children: /* @__PURE__ */ jsx98(MessagePrimitiveParts2, {})
47593
+ children: /* @__PURE__ */ jsx99(MessagePrimitiveParts2, {})
47357
47594
  }
47358
- ) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(
47595
+ ) : /* @__PURE__ */ jsx99(AssistantMessage, { children: /* @__PURE__ */ jsx99(
47359
47596
  AssistantParts,
47360
47597
  {
47361
47598
  showDetails: showToolDetails,
47362
47599
  tools: message.parts
47363
47600
  }
47364
- ) }) }) }) : /* @__PURE__ */ jsx98(AssistantMessage, { children: /* @__PURE__ */ jsx98(AssistantParts, { showDetails: showToolDetails }) });
47601
+ ) }) }) }) : /* @__PURE__ */ jsx99(AssistantMessage, { children: /* @__PURE__ */ jsx99(AssistantParts, { showDetails: showToolDetails }) });
47365
47602
  },
47366
- children: interrupt ? /* @__PURE__ */ jsxs29(
47603
+ children: interrupt ? /* @__PURE__ */ jsxs31(
47367
47604
  "section",
47368
47605
  {
47369
47606
  "aria-label": interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F`,
47370
47607
  className: cn("rounded-lg bg-muted p-4"),
47371
47608
  "data-mode": interrupt.mode,
47372
47609
  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" })
47610
+ /* @__PURE__ */ jsx99("strong", { children: interrupt.title ?? `\u786E\u8BA4\u6267\u884C ${interrupt.toolName}\uFF1F` }),
47611
+ interrupt.description ? /* @__PURE__ */ jsx99("p", { className: cn("mt-1 text-muted-foreground"), children: interrupt.description }) : null,
47612
+ interrupt.mode === "chat" ? /* @__PURE__ */ jsxs31("div", { className: cn("mt-3 flex gap-2"), children: [
47613
+ /* @__PURE__ */ jsx99(Button, { onClick: chat.confirmInterrupt, children: interrupt.confirmLabel ?? "\u786E\u8BA4" }),
47614
+ /* @__PURE__ */ jsx99(Button, { variant: "outline", onClick: chat.rejectInterrupt, children: interrupt.rejectLabel ?? "\u62D2\u7EDD" })
47615
+ ] }) : /* @__PURE__ */ jsx99("p", { className: cn("mt-1 text-muted-foreground"), children: "\u8BF7\u5728\u4E1A\u52A1\u9875\u9762\u5B8C\u6210\u786E\u8BA4\u3002" })
47379
47616
  ]
47380
47617
  }
47381
47618
  ) : null
@@ -47386,7 +47623,7 @@ function Chat({
47386
47623
  ]
47387
47624
  }
47388
47625
  ),
47389
- /* @__PURE__ */ jsx98(
47626
+ /* @__PURE__ */ jsx99(
47390
47627
  Dialog2,
47391
47628
  {
47392
47629
  open: Boolean(dialog),
@@ -47395,7 +47632,7 @@ function Chat({
47395
47632
  setDialog(void 0);
47396
47633
  }
47397
47634
  },
47398
- children: /* @__PURE__ */ jsxs29(
47635
+ children: /* @__PURE__ */ jsxs31(
47399
47636
  DialogContent3,
47400
47637
  {
47401
47638
  showCloseButton: false,
@@ -47409,10 +47646,10 @@ function Chat({
47409
47646
  });
47410
47647
  },
47411
47648
  children: [
47412
- /* @__PURE__ */ jsx98(DialogTitle3, { children: dialog?.title }),
47413
- /* @__PURE__ */ jsx98(DialogDescription3, { children: dialog?.description }),
47414
- /* @__PURE__ */ jsxs29(DialogFooter, { children: [
47415
- /* @__PURE__ */ jsx98(
47649
+ /* @__PURE__ */ jsx99(DialogTitle3, { children: dialog?.title }),
47650
+ /* @__PURE__ */ jsx99(DialogDescription3, { children: dialog?.description }),
47651
+ /* @__PURE__ */ jsxs31(DialogFooter, { children: [
47652
+ /* @__PURE__ */ jsx99(
47416
47653
  Button,
47417
47654
  {
47418
47655
  variant: "outline",
@@ -47423,7 +47660,7 @@ function Chat({
47423
47660
  children: "\u53D6\u6D88"
47424
47661
  }
47425
47662
  ),
47426
- /* @__PURE__ */ jsx98(
47663
+ /* @__PURE__ */ jsx99(
47427
47664
  Button,
47428
47665
  {
47429
47666
  variant: dialog?.dangerous ? "destructive" : "default",