@nexface/chat 0.1.21-alpha.0 → 0.1.21-alpha.2

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.
@@ -28876,13 +28876,69 @@ function DropdownMenuItem3({
28876
28876
  );
28877
28877
  }
28878
28878
 
28879
- // src/ui/thread-list.aui.tsx
28879
+ // src/ui/tooltip.tsx
28880
+ import * as React5 from "react";
28880
28881
  import { jsx as jsx68, jsxs as jsxs11 } from "react/jsx-runtime";
28882
+ function TooltipProvider2({
28883
+ delayDuration = 0,
28884
+ ...props
28885
+ }) {
28886
+ return /* @__PURE__ */ jsx68(
28887
+ dist_exports12.Provider,
28888
+ {
28889
+ "data-slot": "tooltip-provider",
28890
+ delayDuration,
28891
+ ...props
28892
+ }
28893
+ );
28894
+ }
28895
+ function Tooltip2({ ...props }) {
28896
+ return /* @__PURE__ */ jsx68(dist_exports12.Root, { "data-slot": "tooltip", ...props });
28897
+ }
28898
+ var TooltipTrigger3 = React5.forwardRef(function TooltipTrigger4({ ...props }, ref) {
28899
+ return /* @__PURE__ */ jsx68(dist_exports12.Trigger, { "data-slot": "tooltip-trigger", ref, ...props });
28900
+ });
28901
+ function TooltipContent3({
28902
+ className,
28903
+ sideOffset = 0,
28904
+ children,
28905
+ ...props
28906
+ }) {
28907
+ const container = usePortalContainer();
28908
+ if (!container) return null;
28909
+ return /* @__PURE__ */ jsx68(dist_exports12.Portal, { container, children: /* @__PURE__ */ jsxs11(
28910
+ dist_exports12.Content,
28911
+ {
28912
+ "data-slot": "tooltip-content",
28913
+ sideOffset,
28914
+ className: cn(
28915
+ "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
28916
+ className
28917
+ ),
28918
+ ...props,
28919
+ children: [
28920
+ /* @__PURE__ */ jsx68(PortalThemeSync, {}),
28921
+ children,
28922
+ /* @__PURE__ */ jsx68(
28923
+ dist_exports12.Arrow,
28924
+ {
28925
+ className: cn(
28926
+ "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"
28927
+ )
28928
+ }
28929
+ )
28930
+ ]
28931
+ }
28932
+ ) });
28933
+ }
28934
+
28935
+ // src/ui/thread-list.aui.tsx
28936
+ import { jsx as jsx69, jsxs as jsxs12 } from "react/jsx-runtime";
28881
28937
  function ThreadListRoot({
28882
28938
  className,
28883
28939
  ...props
28884
28940
  }) {
28885
- return /* @__PURE__ */ jsx68(
28941
+ return /* @__PURE__ */ jsx69(
28886
28942
  ThreadListPrimitiveRoot,
28887
28943
  {
28888
28944
  "data-slot": "aui_thread-list-root",
@@ -28892,7 +28948,7 @@ function ThreadListRoot({
28892
28948
  );
28893
28949
  }
28894
28950
  function ThreadListNew(props) {
28895
- return /* @__PURE__ */ jsx68(ThreadListPrimitiveNew, { asChild: true, children: /* @__PURE__ */ jsxs11(
28951
+ return /* @__PURE__ */ jsx69(ThreadListPrimitiveNew, { asChild: true, children: /* @__PURE__ */ jsxs12(
28896
28952
  "button",
28897
28953
  {
28898
28954
  type: "button",
@@ -28902,7 +28958,7 @@ function ThreadListNew(props) {
28902
28958
  ),
28903
28959
  ...props,
28904
28960
  children: [
28905
- /* @__PURE__ */ jsx68(Plus, { className: cn("size-4 shrink-0") }),
28961
+ /* @__PURE__ */ jsx69(Plus, { className: cn("size-4 shrink-0") }),
28906
28962
  "\u65B0\u5EFA\u4F1A\u8BDD"
28907
28963
  ]
28908
28964
  }
@@ -28912,8 +28968,8 @@ function ThreadListSearch({
28912
28968
  value,
28913
28969
  onValueChange
28914
28970
  }) {
28915
- return /* @__PURE__ */ jsxs11("div", { "data-slot": "aui_thread-list-search", className: cn("relative px-0.5 py-1"), children: [
28916
- /* @__PURE__ */ jsx68(
28971
+ return /* @__PURE__ */ jsxs12("div", { "data-slot": "aui_thread-list-search", className: cn("relative px-0.5 py-1"), children: [
28972
+ /* @__PURE__ */ jsx69(
28917
28973
  Search,
28918
28974
  {
28919
28975
  "data-slot": "aui_thread-list-search-icon",
@@ -28922,7 +28978,7 @@ function ThreadListSearch({
28922
28978
  )
28923
28979
  }
28924
28980
  ),
28925
- /* @__PURE__ */ jsx68(
28981
+ /* @__PURE__ */ jsx69(
28926
28982
  Input,
28927
28983
  {
28928
28984
  type: "search",
@@ -28937,7 +28993,8 @@ function ThreadListSearch({
28937
28993
  }
28938
28994
  function ThreadListItem({
28939
28995
  disabled,
28940
- menu
28996
+ menu,
28997
+ disabledReason
28941
28998
  }) {
28942
28999
  const isRunning = useAuiState((s) => s.threadListItem.isRunning);
28943
29000
  const title = useAuiState((s) => s.threadListItem.title);
@@ -28950,15 +29007,16 @@ function ThreadListItem({
28950
29007
  triggerRef.current?.focus();
28951
29008
  }
28952
29009
  }, [isRenaming]);
28953
- return /* @__PURE__ */ jsxs11(
29010
+ const item = /* @__PURE__ */ jsxs12(
28954
29011
  ThreadListItemPrimitiveRoot,
28955
29012
  {
28956
29013
  "data-slot": "aui_thread-list-item",
29014
+ "data-disabled": disabled || void 0,
28957
29015
  className: cn(
28958
- "group data-active:bg-foreground/[0.06] hover:bg-foreground/[0.04] has-data-[state=open]:bg-foreground/[0.04] rounded-control relative flex h-8 shrink-0 items-center transition-colors"
29016
+ "data-[disabled=true]:opacity-50 group data-active:bg-foreground/[0.06] hover:bg-foreground/[0.04] has-data-[state=open]:bg-foreground/[0.04] rounded-control relative flex h-8 shrink-0 items-center transition-colors"
28959
29017
  ),
28960
29018
  children: [
28961
- isRenaming ? /* @__PURE__ */ jsx68(
29019
+ isRenaming ? /* @__PURE__ */ jsx69(
28962
29020
  ThreadListItemRename,
28963
29021
  {
28964
29022
  onDone: (focus2) => {
@@ -28966,7 +29024,7 @@ function ThreadListItem({
28966
29024
  setIsRenaming(false);
28967
29025
  }
28968
29026
  }
28969
- ) : /* @__PURE__ */ jsxs11(
29027
+ ) : /* @__PURE__ */ jsxs12(
28970
29028
  ThreadListItemPrimitiveTrigger,
28971
29029
  {
28972
29030
  ref: triggerRef,
@@ -28976,19 +29034,19 @@ function ThreadListItem({
28976
29034
  "text-muted-foreground group-data-active:text-foreground hover:text-foreground flex h-full min-w-0 flex-1 items-center px-2 text-left text-[13px] transition-colors outline-none group-hover:pe-8 group-has-focus-visible:pe-8 group-has-data-[state=open]:pe-8 group-data-active:pe-8"
28977
29035
  ),
28978
29036
  children: [
28979
- isRunning && /* @__PURE__ */ jsx68(
29037
+ isRunning && /* @__PURE__ */ jsx69(
28980
29038
  LoaderCircle,
28981
29039
  {
28982
29040
  "aria-hidden": true,
28983
29041
  className: cn("text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin")
28984
29042
  }
28985
29043
  ),
28986
- /* @__PURE__ */ jsx68("span", { className: cn("min-w-0 flex-1 truncate"), children: /* @__PURE__ */ jsx68(ThreadListItemPrimitiveTitle, { fallback: "\u65B0\u4F1A\u8BDD" }) })
29044
+ /* @__PURE__ */ jsx69("span", { className: cn("min-w-0 flex-1 truncate"), children: /* @__PURE__ */ jsx69(ThreadListItemPrimitiveTitle, { fallback: "\u65B0\u4F1A\u8BDD" }) })
28987
29045
  ]
28988
29046
  }
28989
29047
  ),
28990
- /* @__PURE__ */ jsxs11(DropdownMenu2, { modal: false, children: [
28991
- /* @__PURE__ */ jsx68(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx68(
29048
+ /* @__PURE__ */ jsxs12(DropdownMenu2, { modal: false, children: [
29049
+ /* @__PURE__ */ jsx69(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx69(
28992
29050
  "button",
28993
29051
  {
28994
29052
  type: "button",
@@ -28996,14 +29054,29 @@ function ThreadListItem({
28996
29054
  className: cn(
28997
29055
  "text-muted-foreground hover:text-foreground absolute end-1 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-sm opacity-0 transition-colors group-hover:opacity-100 group-has-focus-visible:opacity-100 group-data-active:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
28998
29056
  ),
28999
- children: /* @__PURE__ */ jsx68(Ellipsis, { className: cn("size-3.5") })
29057
+ children: /* @__PURE__ */ jsx69(Ellipsis, { className: cn("size-3.5") })
29000
29058
  }
29001
29059
  ) }),
29002
- /* @__PURE__ */ jsx68(DropdownMenuContent3, { side: "right", align: "start", sideOffset: 6, children: menu(() => setIsRenaming(true)) })
29060
+ /* @__PURE__ */ jsx69(DropdownMenuContent3, { side: "right", align: "start", sideOffset: 6, children: menu(() => setIsRenaming(true)) })
29003
29061
  ] })
29004
29062
  ]
29005
29063
  }
29006
29064
  );
29065
+ if (!disabledReason) return item;
29066
+ return /* @__PURE__ */ jsx69(TooltipProvider2, { delayDuration: 300, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs12(Tooltip2, { children: [
29067
+ /* @__PURE__ */ jsx69(TooltipTrigger3, { asChild: true, children: item }),
29068
+ /* @__PURE__ */ jsx69(
29069
+ TooltipContent3,
29070
+ {
29071
+ side: "right",
29072
+ sideOffset: 8,
29073
+ className: cn(
29074
+ "max-w-[min(20rem,var(--radix-tooltip-content-available-width))] break-words"
29075
+ ),
29076
+ children: disabledReason
29077
+ }
29078
+ )
29079
+ ] }) });
29007
29080
  }
29008
29081
  function ThreadListItemRename({ onDone }) {
29009
29082
  const aui = useAui();
@@ -29030,7 +29103,7 @@ function ThreadListItemRename({ onDone }) {
29030
29103
  }
29031
29104
  );
29032
29105
  };
29033
- return /* @__PURE__ */ jsx68(
29106
+ return /* @__PURE__ */ jsx69(
29034
29107
  Input,
29035
29108
  {
29036
29109
  ref: inputRef,
@@ -29058,22 +29131,22 @@ function ThreadListItemRename({ onDone }) {
29058
29131
  }
29059
29132
 
29060
29133
  // src/ui/dialog.tsx
29061
- import * as React5 from "react";
29062
- import { jsx as jsx69, jsxs as jsxs12 } from "react/jsx-runtime";
29134
+ import * as React6 from "react";
29135
+ import { jsx as jsx70, jsxs as jsxs13 } from "react/jsx-runtime";
29063
29136
  function Dialog2({ ...props }) {
29064
- return /* @__PURE__ */ jsx69(dist_exports5.Root, { "data-slot": "dialog", ...props, modal: false });
29137
+ return /* @__PURE__ */ jsx70(dist_exports5.Root, { "data-slot": "dialog", ...props, modal: false });
29065
29138
  }
29066
- var DialogTrigger3 = React5.forwardRef(function DialogTrigger4({ ...props }, ref) {
29067
- return /* @__PURE__ */ jsx69(dist_exports5.Trigger, { "data-slot": "dialog-trigger", ref, ...props });
29139
+ var DialogTrigger3 = React6.forwardRef(function DialogTrigger4({ ...props }, ref) {
29140
+ return /* @__PURE__ */ jsx70(dist_exports5.Trigger, { "data-slot": "dialog-trigger", ref, ...props });
29068
29141
  });
29069
29142
  function DialogPortal2({ ...props }) {
29070
29143
  const container = useDialogContainer();
29071
29144
  if (!container) return null;
29072
- return /* @__PURE__ */ jsx69(dist_exports5.Portal, { container, "data-slot": "dialog-portal", ...props });
29145
+ return /* @__PURE__ */ jsx70(dist_exports5.Portal, { container, "data-slot": "dialog-portal", ...props });
29073
29146
  }
29074
29147
  function DialogBackgroundGuard() {
29075
29148
  const container = useDialogContainer();
29076
- React5.useLayoutEffect(() => {
29149
+ React6.useLayoutEffect(() => {
29077
29150
  const siblings = Array.from(container?.parentElement?.children ?? []).filter(
29078
29151
  (node2) => node2 instanceof HTMLElement && node2 !== container
29079
29152
  );
@@ -29096,8 +29169,8 @@ function DialogContent3({
29096
29169
  onEscapeKeyDown,
29097
29170
  ...props
29098
29171
  }) {
29099
- const content3 = React5.useRef(null);
29100
- return /* @__PURE__ */ jsx69(DialogPortal2, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs12(
29172
+ const content3 = React6.useRef(null);
29173
+ return /* @__PURE__ */ jsx70(DialogPortal2, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs13(
29101
29174
  dist_exports5.Content,
29102
29175
  {
29103
29176
  ref: content3,
@@ -29113,8 +29186,8 @@ function DialogContent3({
29113
29186
  },
29114
29187
  ...props,
29115
29188
  children: [
29116
- /* @__PURE__ */ jsx69(DialogBackgroundGuard, {}),
29117
- /* @__PURE__ */ jsxs12(
29189
+ /* @__PURE__ */ jsx70(DialogBackgroundGuard, {}),
29190
+ /* @__PURE__ */ jsxs13(
29118
29191
  "div",
29119
29192
  {
29120
29193
  className: cn(
@@ -29123,7 +29196,7 @@ function DialogContent3({
29123
29196
  ),
29124
29197
  children: [
29125
29198
  children,
29126
- showCloseButton && /* @__PURE__ */ jsxs12(
29199
+ showCloseButton && /* @__PURE__ */ jsxs13(
29127
29200
  dist_exports5.Close,
29128
29201
  {
29129
29202
  "data-slot": "dialog-close",
@@ -29131,8 +29204,8 @@ function DialogContent3({
29131
29204
  "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
29132
29205
  ),
29133
29206
  children: [
29134
- /* @__PURE__ */ jsx69(X, {}),
29135
- /* @__PURE__ */ jsx69("span", { className: cn("sr-only"), children: "Close" })
29207
+ /* @__PURE__ */ jsx70(X, {}),
29208
+ /* @__PURE__ */ jsx70("span", { className: cn("sr-only"), children: "Close" })
29136
29209
  ]
29137
29210
  }
29138
29211
  )
@@ -29149,7 +29222,7 @@ function DialogFooter({
29149
29222
  children,
29150
29223
  ...props
29151
29224
  }) {
29152
- return /* @__PURE__ */ jsxs12(
29225
+ return /* @__PURE__ */ jsxs13(
29153
29226
  "div",
29154
29227
  {
29155
29228
  "data-slot": "dialog-footer",
@@ -29157,13 +29230,13 @@ function DialogFooter({
29157
29230
  ...props,
29158
29231
  children: [
29159
29232
  children,
29160
- showCloseButton && /* @__PURE__ */ jsx69(dist_exports5.Close, { asChild: true, children: /* @__PURE__ */ jsx69(Button, { variant: "outline", children: "Close" }) })
29233
+ showCloseButton && /* @__PURE__ */ jsx70(dist_exports5.Close, { asChild: true, children: /* @__PURE__ */ jsx70(Button, { variant: "outline", children: "Close" }) })
29161
29234
  ]
29162
29235
  }
29163
29236
  );
29164
29237
  }
29165
29238
  function DialogTitle3({ className, ...props }) {
29166
- return /* @__PURE__ */ jsx69(
29239
+ return /* @__PURE__ */ jsx70(
29167
29240
  dist_exports5.Title,
29168
29241
  {
29169
29242
  "data-slot": "dialog-title",
@@ -29176,7 +29249,7 @@ function DialogDescription3({
29176
29249
  className,
29177
29250
  ...props
29178
29251
  }) {
29179
- return /* @__PURE__ */ jsx69(
29252
+ return /* @__PURE__ */ jsx70(
29180
29253
  dist_exports5.Description,
29181
29254
  {
29182
29255
  "data-slot": "dialog-description",
@@ -29187,7 +29260,7 @@ function DialogDescription3({
29187
29260
  }
29188
29261
 
29189
29262
  // src/ui/home-demo/thread.tsx
29190
- import { jsx as jsx70, jsxs as jsxs13 } from "react/jsx-runtime";
29263
+ import { jsx as jsx71, jsxs as jsxs14 } from "react/jsx-runtime";
29191
29264
  function Thread({
29192
29265
  empty: isEmpty,
29193
29266
  welcome,
@@ -29197,12 +29270,12 @@ function Thread({
29197
29270
  children,
29198
29271
  renderMessage
29199
29272
  }) {
29200
- return /* @__PURE__ */ jsx70(
29273
+ return /* @__PURE__ */ jsx71(
29201
29274
  ThreadPrimitiveRoot,
29202
29275
  {
29203
29276
  className: cn("flex h-full min-h-0 min-w-0 flex-1 flex-col"),
29204
29277
  style: { ["--nxf-thread-max-width"]: "42rem" },
29205
- children: /* @__PURE__ */ jsxs13(
29278
+ children: /* @__PURE__ */ jsxs14(
29206
29279
  ThreadPrimitiveViewport,
29207
29280
  {
29208
29281
  turnAnchor: "top",
@@ -29219,19 +29292,19 @@ function Thread({
29219
29292
  ),
29220
29293
  children: [
29221
29294
  isEmpty ? welcome : null,
29222
- /* @__PURE__ */ jsxs13(
29295
+ /* @__PURE__ */ jsxs14(
29223
29296
  "div",
29224
29297
  {
29225
29298
  className: cn(
29226
29299
  "mx-auto mb-12 flex w-full max-w-(--nxf-thread-max-width) flex-col gap-y-6 empty:hidden"
29227
29300
  ),
29228
29301
  children: [
29229
- /* @__PURE__ */ jsx70(ThreadPrimitiveMessages, { children: renderMessage }),
29302
+ /* @__PURE__ */ jsx71(ThreadPrimitiveMessages, { children: renderMessage }),
29230
29303
  children
29231
29304
  ]
29232
29305
  }
29233
29306
  ),
29234
- /* @__PURE__ */ jsxs13(
29307
+ /* @__PURE__ */ jsxs14(
29235
29308
  ThreadPrimitiveViewportFooter,
29236
29309
  {
29237
29310
  className: cn(
@@ -29257,29 +29330,29 @@ var typeSection = "font-display text-[1.5rem] leading-snug font-[550] tracking-[
29257
29330
  var typeDeck = "text-muted-foreground max-w-[40ch] text-[15px] leading-relaxed text-pretty";
29258
29331
 
29259
29332
  // src/ui/home-demo/greeting.tsx
29260
- import { jsx as jsx71, jsxs as jsxs14 } from "react/jsx-runtime";
29333
+ import { jsx as jsx72, jsxs as jsxs15 } from "react/jsx-runtime";
29261
29334
  function Greeting({
29262
29335
  title,
29263
29336
  description,
29264
29337
  icon
29265
29338
  }) {
29266
- return /* @__PURE__ */ jsxs14(
29339
+ return /* @__PURE__ */ jsxs15(
29267
29340
  "div",
29268
29341
  {
29269
29342
  className: cn(
29270
29343
  "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"
29271
29344
  ),
29272
29345
  children: [
29273
- icon != null ? /* @__PURE__ */ jsx71("div", { className: cn("mb-4 flex max-w-full justify-center [&_img]:max-w-full"), children: icon }) : null,
29274
- /* @__PURE__ */ jsx71("p", { className: cn(typeSection), children: title }),
29275
- description ? /* @__PURE__ */ jsx71("p", { className: cn(typeDeck), children: description }) : null
29346
+ icon != null ? /* @__PURE__ */ jsx72("div", { className: cn("mb-4 flex max-w-full justify-center [&_img]:max-w-full"), children: icon }) : null,
29347
+ /* @__PURE__ */ jsx72("p", { className: cn(typeSection), children: title }),
29348
+ description ? /* @__PURE__ */ jsx72("p", { className: cn(typeDeck), children: description }) : null
29276
29349
  ]
29277
29350
  }
29278
29351
  );
29279
29352
  }
29280
29353
 
29281
29354
  // src/ui/home-demo/suggestions.tsx
29282
- import { jsx as jsx72, jsxs as jsxs15 } from "react/jsx-runtime";
29355
+ import { jsx as jsx73, jsxs as jsxs16 } from "react/jsx-runtime";
29283
29356
  var suggestionChipClass = "bg-background text-suggestion hover:text-foreground font-suggestion inset-ring inset-ring-black/8 dark:inset-ring-foreground/8 hover:inset-ring-foreground/25 rounded-lg inline-flex min-h-[32px] min-w-0 max-w-full items-center gap-2 px-3 py-[5px] text-sm font-medium leading-[1.57143] transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
29284
29357
  function Suggestions2({
29285
29358
  suggestions,
@@ -29292,7 +29365,7 @@ function Suggestions2({
29292
29365
  // Typing hides the suggestions without unmounting them: the empty view is
29293
29366
  // centred, so collapsing a block this tall moves the composer out from
29294
29367
  // under the cursor. Disabled buttons also stay out of the tab order in React 18.
29295
- /* @__PURE__ */ jsx72(
29368
+ /* @__PURE__ */ jsx73(
29296
29369
  "div",
29297
29370
  {
29298
29371
  "aria-hidden": hidden,
@@ -29300,7 +29373,7 @@ function Suggestions2({
29300
29373
  "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",
29301
29374
  hidden && "opacity-0"
29302
29375
  ),
29303
- children: suggestions.map((suggestion) => /* @__PURE__ */ jsxs15(
29376
+ children: suggestions.map((suggestion) => /* @__PURE__ */ jsxs16(
29304
29377
  ThreadPrimitiveSuggestion,
29305
29378
  {
29306
29379
  prompt: suggestion.prompt,
@@ -29312,7 +29385,7 @@ function Suggestions2({
29312
29385
  },
29313
29386
  className: cn(suggestionChipClass),
29314
29387
  children: [
29315
- suggestion.icon != null ? /* @__PURE__ */ jsx72(
29388
+ suggestion.icon != null ? /* @__PURE__ */ jsx73(
29316
29389
  "span",
29317
29390
  {
29318
29391
  "aria-hidden": "true",
@@ -29322,7 +29395,7 @@ function Suggestions2({
29322
29395
  children: suggestion.icon
29323
29396
  }
29324
29397
  ) : null,
29325
- /* @__PURE__ */ jsx72("span", { className: cn("min-w-0 wrap-anywhere"), children: suggestion.label })
29398
+ /* @__PURE__ */ jsx73("span", { className: cn("min-w-0 wrap-anywhere"), children: suggestion.label })
29326
29399
  ]
29327
29400
  },
29328
29401
  suggestion.prompt
@@ -29383,22 +29456,22 @@ function useNextMessage(chat, suggest, open) {
29383
29456
  }
29384
29457
 
29385
29458
  // src/ui/home-demo/action-bar.tsx
29386
- import { jsx as jsx73, jsxs as jsxs16 } from "react/jsx-runtime";
29459
+ import { jsx as jsx74, jsxs as jsxs17 } from "react/jsx-runtime";
29387
29460
  function AssistantActionBar() {
29388
- return /* @__PURE__ */ jsx73(ActionBarPrimitiveRoot, { autohide: "never", className: cn("flex items-center gap-1.5"), children: /* @__PURE__ */ jsxs16(ActionBarPrimitiveCopy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [
29389
- /* @__PURE__ */ jsx73(AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx73(Check, { className: cn("size-4") }) }),
29390
- /* @__PURE__ */ jsx73(AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx73(Copy, { className: cn("size-4") }) })
29461
+ return /* @__PURE__ */ jsx74(ActionBarPrimitiveRoot, { autohide: "never", className: cn("flex items-center gap-1.5"), children: /* @__PURE__ */ jsxs17(ActionBarPrimitiveCopy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [
29462
+ /* @__PURE__ */ jsx74(AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx74(Check, { className: cn("size-4") }) }),
29463
+ /* @__PURE__ */ jsx74(AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx74(Copy, { className: cn("size-4") }) })
29391
29464
  ] }) });
29392
29465
  }
29393
29466
 
29394
29467
  // src/ui/home-demo/messages.tsx
29395
- import { jsx as jsx74, jsxs as jsxs17 } from "react/jsx-runtime";
29468
+ import { jsx as jsx75, jsxs as jsxs18 } from "react/jsx-runtime";
29396
29469
  function UserMessage({
29397
29470
  children,
29398
29471
  attachments,
29399
29472
  actions
29400
29473
  }) {
29401
- return /* @__PURE__ */ jsxs17(
29474
+ return /* @__PURE__ */ jsxs18(
29402
29475
  MessagePrimitiveRoot,
29403
29476
  {
29404
29477
  "data-role": "user",
@@ -29407,9 +29480,9 @@ function UserMessage({
29407
29480
  "animate-in fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end duration-150"
29408
29481
  ),
29409
29482
  children: [
29410
- /* @__PURE__ */ jsx74("div", { className: cn("w-full has-[.aui-attachment-root]:mb-2"), children: attachments }),
29411
- /* @__PURE__ */ jsxs17("div", { className: cn("relative max-w-[80%]"), children: [
29412
- /* @__PURE__ */ jsx74(
29483
+ /* @__PURE__ */ jsx75("div", { className: cn("w-full has-[.aui-attachment-root]:mb-2"), children: attachments }),
29484
+ /* @__PURE__ */ jsxs18("div", { className: cn("relative max-w-[80%]"), children: [
29485
+ /* @__PURE__ */ jsx75(
29413
29486
  "div",
29414
29487
  {
29415
29488
  className: cn(
@@ -29418,7 +29491,7 @@ function UserMessage({
29418
29491
  children
29419
29492
  }
29420
29493
  ),
29421
- /* @__PURE__ */ jsx74(
29494
+ /* @__PURE__ */ jsx75(
29422
29495
  ActionBarPrimitiveRoot,
29423
29496
  {
29424
29497
  hideWhenRunning: true,
@@ -29435,7 +29508,7 @@ function UserMessage({
29435
29508
  );
29436
29509
  }
29437
29510
  function AssistantMessage({ children }) {
29438
- return /* @__PURE__ */ jsxs17(
29511
+ return /* @__PURE__ */ jsxs18(
29439
29512
  MessagePrimitiveRoot,
29440
29513
  {
29441
29514
  "data-role": "assistant",
@@ -29444,18 +29517,18 @@ function AssistantMessage({ children }) {
29444
29517
  "animate-in fade-in slide-in-from-bottom-1 mx-auto w-full max-w-(--nxf-thread-max-width) duration-150"
29445
29518
  ),
29446
29519
  children: [
29447
- /* @__PURE__ */ jsxs17(
29520
+ /* @__PURE__ */ jsxs18(
29448
29521
  "div",
29449
29522
  {
29450
29523
  "data-slot": "aui_assistant-message-content",
29451
29524
  className: cn("text-[15px] leading-relaxed wrap-break-word"),
29452
29525
  children: [
29453
29526
  children,
29454
- /* @__PURE__ */ jsx74(MessageError, {})
29527
+ /* @__PURE__ */ jsx75(MessageError, {})
29455
29528
  ]
29456
29529
  }
29457
29530
  ),
29458
- /* @__PURE__ */ jsx74("div", { className: cn("mt-2 flex items-center gap-1.5 empty:hidden"), children: /* @__PURE__ */ jsx74(AssistantActionBar, {}) })
29531
+ /* @__PURE__ */ jsx75("div", { className: cn("mt-2 flex items-center gap-1.5 empty:hidden"), children: /* @__PURE__ */ jsx75(AssistantActionBar, {}) })
29459
29532
  ]
29460
29533
  }
29461
29534
  );
@@ -29465,26 +29538,26 @@ function MessageError() {
29465
29538
  (s) => s.message.status?.type === "incomplete" && s.message.status.reason === "cancelled"
29466
29539
  );
29467
29540
  if (cancelled)
29468
- return /* @__PURE__ */ jsx74("p", { role: "status", className: cn("mt-2 text-[13px] text-muted-foreground"), children: "Stopped" });
29469
- return /* @__PURE__ */ jsx74(MessagePrimitiveError, { children: /* @__PURE__ */ jsx74(
29541
+ return /* @__PURE__ */ jsx75("p", { role: "status", className: cn("mt-2 text-[13px] text-muted-foreground"), children: "Stopped" });
29542
+ return /* @__PURE__ */ jsx75(MessagePrimitiveError, { children: /* @__PURE__ */ jsx75(
29470
29543
  ErrorPrimitiveRoot,
29471
29544
  {
29472
29545
  role: "alert",
29473
29546
  className: cn("mt-2 border-l-2 pl-3 text-[13px] border-destructive/60 text-destructive"),
29474
- children: /* @__PURE__ */ jsx74(ErrorPrimitiveMessage, { className: cn("line-clamp-2") })
29547
+ children: /* @__PURE__ */ jsx75(ErrorPrimitiveMessage, { className: cn("line-clamp-2") })
29475
29548
  }
29476
29549
  ) });
29477
29550
  }
29478
29551
 
29479
29552
  // src/ui/home-demo/composer.tsx
29480
- import { jsx as jsx75, jsxs as jsxs18 } from "react/jsx-runtime";
29553
+ import { jsx as jsx76, jsxs as jsxs19 } from "react/jsx-runtime";
29481
29554
  function Composer({
29482
29555
  children,
29483
29556
  inputProps,
29484
29557
  actions,
29485
29558
  ...props
29486
29559
  }) {
29487
- return /* @__PURE__ */ jsx75(ComposerPrimitiveRoot, { className: cn("relative w-full"), ...props, children: /* @__PURE__ */ jsx75(
29560
+ return /* @__PURE__ */ jsx76(ComposerPrimitiveRoot, { className: cn("relative w-full"), ...props, children: /* @__PURE__ */ jsx76(
29488
29561
  ComposerPrimitiveAttachmentDropzone,
29489
29562
  {
29490
29563
  asChild: true,
@@ -29495,7 +29568,7 @@ function Composer({
29495
29568
  onDragOverCapture: (event) => {
29496
29569
  if (inputProps.disabled) event.preventDefault();
29497
29570
  },
29498
- children: /* @__PURE__ */ jsxs18(
29571
+ children: /* @__PURE__ */ jsxs19(
29499
29572
  "div",
29500
29573
  {
29501
29574
  "data-slot": "aui_composer-shell",
@@ -29503,8 +29576,8 @@ function Composer({
29503
29576
  "border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed"
29504
29577
  ),
29505
29578
  children: [
29506
- /* @__PURE__ */ jsx75("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children }),
29507
- /* @__PURE__ */ jsx75(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx75(
29579
+ /* @__PURE__ */ jsx76("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children }),
29580
+ /* @__PURE__ */ jsx76(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx76(
29508
29581
  "textarea",
29509
29582
  {
29510
29583
  "data-composer-input": true,
@@ -29514,7 +29587,7 @@ function Composer({
29514
29587
  )
29515
29588
  }
29516
29589
  ) }),
29517
- /* @__PURE__ */ jsx75("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })
29590
+ /* @__PURE__ */ jsx76("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })
29518
29591
  ]
29519
29592
  }
29520
29593
  )
@@ -29528,13 +29601,13 @@ function EditComposer({
29528
29601
  sendProps,
29529
29602
  ...props
29530
29603
  }) {
29531
- return /* @__PURE__ */ jsx75(
29604
+ return /* @__PURE__ */ jsx76(
29532
29605
  MessagePrimitiveRoot,
29533
29606
  {
29534
29607
  "data-role": "user",
29535
29608
  "data-slot": "aui_edit-composer-wrapper",
29536
29609
  className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"),
29537
- children: /* @__PURE__ */ jsxs18(
29610
+ children: /* @__PURE__ */ jsxs19(
29538
29611
  ComposerPrimitiveRoot,
29539
29612
  {
29540
29613
  className: cn(
@@ -29542,7 +29615,7 @@ function EditComposer({
29542
29615
  ),
29543
29616
  ...props,
29544
29617
  children: [
29545
- /* @__PURE__ */ jsx75(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx75(
29618
+ /* @__PURE__ */ jsx76(ComposerPrimitiveInput, { asChild: true, ...inputProps, children: /* @__PURE__ */ jsx76(
29546
29619
  "textarea",
29547
29620
  {
29548
29621
  autoFocus: true,
@@ -29553,8 +29626,8 @@ function EditComposer({
29553
29626
  }
29554
29627
  ) }),
29555
29628
  children,
29556
- /* @__PURE__ */ jsxs18("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [
29557
- /* @__PURE__ */ jsx75(ComposerPrimitiveCancel, { asChild: true, children: /* @__PURE__ */ jsx75(
29629
+ /* @__PURE__ */ jsxs19("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [
29630
+ /* @__PURE__ */ jsx76(ComposerPrimitiveCancel, { asChild: true, children: /* @__PURE__ */ jsx76(
29558
29631
  "button",
29559
29632
  {
29560
29633
  type: "button",
@@ -29565,7 +29638,7 @@ function EditComposer({
29565
29638
  children: "\u53D6\u6D88"
29566
29639
  }
29567
29640
  ) }),
29568
- /* @__PURE__ */ jsx75(ComposerPrimitiveSend, { asChild: true, children: /* @__PURE__ */ jsx75(
29641
+ /* @__PURE__ */ jsx76(ComposerPrimitiveSend, { asChild: true, children: /* @__PURE__ */ jsx76(
29569
29642
  "button",
29570
29643
  {
29571
29644
  type: "button",
@@ -29586,64 +29659,6 @@ function EditComposer({
29586
29659
 
29587
29660
  // src/ui/tooltip-icon-button.tsx
29588
29661
  import { forwardRef as forwardRef29 } from "react";
29589
-
29590
- // src/ui/tooltip.tsx
29591
- import * as React6 from "react";
29592
- import { jsx as jsx76, jsxs as jsxs19 } from "react/jsx-runtime";
29593
- function TooltipProvider2({
29594
- delayDuration = 0,
29595
- ...props
29596
- }) {
29597
- return /* @__PURE__ */ jsx76(
29598
- dist_exports12.Provider,
29599
- {
29600
- "data-slot": "tooltip-provider",
29601
- delayDuration,
29602
- ...props
29603
- }
29604
- );
29605
- }
29606
- function Tooltip2({ ...props }) {
29607
- return /* @__PURE__ */ jsx76(dist_exports12.Root, { "data-slot": "tooltip", ...props });
29608
- }
29609
- var TooltipTrigger3 = React6.forwardRef(function TooltipTrigger4({ ...props }, ref) {
29610
- return /* @__PURE__ */ jsx76(dist_exports12.Trigger, { "data-slot": "tooltip-trigger", ref, ...props });
29611
- });
29612
- function TooltipContent3({
29613
- className,
29614
- sideOffset = 0,
29615
- children,
29616
- ...props
29617
- }) {
29618
- const container = usePortalContainer();
29619
- if (!container) return null;
29620
- return /* @__PURE__ */ jsx76(dist_exports12.Portal, { container, children: /* @__PURE__ */ jsxs19(
29621
- dist_exports12.Content,
29622
- {
29623
- "data-slot": "tooltip-content",
29624
- sideOffset,
29625
- className: cn(
29626
- "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
29627
- className
29628
- ),
29629
- ...props,
29630
- children: [
29631
- /* @__PURE__ */ jsx76(PortalThemeSync, {}),
29632
- children,
29633
- /* @__PURE__ */ jsx76(
29634
- dist_exports12.Arrow,
29635
- {
29636
- className: cn(
29637
- "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"
29638
- )
29639
- }
29640
- )
29641
- ]
29642
- }
29643
- ) });
29644
- }
29645
-
29646
- // src/ui/tooltip-icon-button.tsx
29647
29662
  import { jsx as jsx77, jsxs as jsxs20 } from "react/jsx-runtime";
29648
29663
  var TooltipIconButton = forwardRef29(
29649
29664
  ({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
@@ -29913,7 +29928,7 @@ var AssistantAttachments = class {
29913
29928
  };
29914
29929
 
29915
29930
  // src/assistant-runtime.tsx
29916
- import { assertChatSendable } from "./react.js";
29931
+ import { assertChatSendable, sessionCommandResult } from "./react.js";
29917
29932
 
29918
29933
  // src/voice/use-voice.ts
29919
29934
  import { useLayoutEffect as useLayoutEffect11, useMemo as useMemo10, useRef as useRef29, useState as useState28 } from "react";
@@ -30218,10 +30233,20 @@ function SessionRuntime({
30218
30233
  })),
30219
30234
  onSwitchToNewThread: () => {
30220
30235
  latest.current.createSession();
30236
+ return sessionCommandResult(latest.current);
30237
+ },
30238
+ onSwitchToThread: (next) => {
30239
+ latest.current.switchSession(next);
30240
+ return sessionCommandResult(latest.current);
30241
+ },
30242
+ onRename: (target, title) => {
30243
+ latest.current.renameSession(target, title);
30244
+ return sessionCommandResult(latest.current);
30221
30245
  },
30222
- onSwitchToThread: (next) => latest.current.switchSession(next),
30223
- onRename: (target, title) => latest.current.renameSession(target, title),
30224
- onDelete: (target) => latest.current.deleteSession(target)
30246
+ onDelete: (target) => {
30247
+ latest.current.deleteSession(target);
30248
+ return sessionCommandResult(latest.current);
30249
+ }
30225
30250
  }
30226
30251
  }
30227
30252
  });
@@ -47028,7 +47053,16 @@ function AssistantParts({
47028
47053
  }
47029
47054
 
47030
47055
  // src/default-chat.tsx
47031
- import { canEditChatSession, isChatRecoveryUnavailable, useChat as useChat3 } from "./react.js";
47056
+ import {
47057
+ canEditChatSession,
47058
+ historyNotice,
47059
+ isChatHistoryReady,
47060
+ watchHistorySidebar,
47061
+ isSessionOccupied,
47062
+ isSessionOperationPending,
47063
+ isChatRecoveryUnavailable,
47064
+ useChat as useChat3
47065
+ } from "./react.js";
47032
47066
  import { sendErrorNotice } from "./errors.js";
47033
47067
  import { Fragment as Fragment18, jsx as jsx100, jsxs as jsxs32 } from "react/jsx-runtime";
47034
47068
  var textOf = (message) => message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("");
@@ -47143,7 +47177,7 @@ function Chat({
47143
47177
  const chat = useChat3();
47144
47178
  const nextMessage = useNextMessage(chat, suggestNextMessage, open);
47145
47179
  const { activeSessionId: sessionId, messages, status, interrupt } = chat;
47146
- const busy = status !== "idle" && status !== "error";
47180
+ const busy = isSessionOperationPending(chat) || status !== "idle" && status !== "error";
47147
47181
  const sessionBusy = busy && status !== "waiting";
47148
47182
  const [fullscreen, setFullscreen] = useState40(false);
47149
47183
  const changeFullscreen = (next) => {
@@ -47160,6 +47194,10 @@ function Chat({
47160
47194
  const sidebarEnabled = sessionSidebar !== false;
47161
47195
  const sidebarLayout = layout === "inline" && !fullscreen && typeof sessionSidebar === "object" && sessionSidebar.layout === "outside" ? "outside" : "overlay";
47162
47196
  const sidebarOpen = sidebarEnabled && sidebar;
47197
+ useEffect34(
47198
+ () => sidebarOpen ? watchHistorySidebar(chat) : void 0,
47199
+ [sidebarOpen, chat.sendMessage]
47200
+ );
47163
47201
  useEffect34(() => {
47164
47202
  if (!sidebarEnabled) setSidebar(false);
47165
47203
  }, [sidebarEnabled]);
@@ -47340,12 +47378,13 @@ function Chat({
47340
47378
  /* @__PURE__ */ jsx100(ThreadListRoot, { children: /* @__PURE__ */ jsx100(ThreadListPrimitiveItems, { children: ({ threadListItem: session2 }) => (session2.title ?? "\u65B0\u4F1A\u8BDD").toLocaleLowerCase().includes(threadSearch.trim().toLocaleLowerCase()) ? /* @__PURE__ */ jsx100(
47341
47379
  ThreadListItem,
47342
47380
  {
47343
- disabled: sessionBusy || binding.sending,
47381
+ disabled: sessionBusy || binding.sending || isSessionOccupied(chat, session2.id),
47382
+ disabledReason: isSessionOccupied(chat, session2.id) ? "This conversation is already open in another tab." : void 0,
47344
47383
  menu: (beginRename) => /* @__PURE__ */ jsxs32(Fragment18, { children: [
47345
47384
  /* @__PURE__ */ jsx100(
47346
47385
  DropdownMenuItem3,
47347
47386
  {
47348
- disabled: sessionBusy || binding.sending,
47387
+ disabled: sessionBusy || binding.sending || isSessionOccupied(chat, session2.id),
47349
47388
  onSelect: beginRename,
47350
47389
  children: "\u91CD\u547D\u540D"
47351
47390
  }
@@ -47354,7 +47393,7 @@ function Chat({
47354
47393
  DropdownMenuItem3,
47355
47394
  {
47356
47395
  variant: "destructive",
47357
- disabled: busy || binding.sending,
47396
+ disabled: busy || binding.sending || isSessionOccupied(chat, session2.id),
47358
47397
  onSelect: () => setDialog({
47359
47398
  title: "\u6E05\u7A7A\u6D88\u606F\uFF1F",
47360
47399
  description: "\u8BE5\u4F1A\u8BDD\u6D88\u606F\u5C06\u88AB\u6E05\u9664\uFF0C\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u56DE\u6EDA\u3002",
@@ -47368,7 +47407,7 @@ function Chat({
47368
47407
  DropdownMenuItem3,
47369
47408
  {
47370
47409
  variant: "destructive",
47371
- disabled: busy || binding.sending,
47410
+ disabled: busy || binding.sending || isSessionOccupied(chat, session2.id),
47372
47411
  onSelect: () => setDialog({
47373
47412
  title: "\u5220\u9664\u4F1A\u8BDD\uFF1F",
47374
47413
  description: "\u804A\u5929\u8BB0\u5F55\u5C06\u88AB\u5220\u9664\uFF0C\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002",
@@ -47432,6 +47471,7 @@ function Chat({
47432
47471
  "nexface-chat__panel relative flex h-full min-h-0 overflow-hidden rounded-[inherit]"
47433
47472
  ),
47434
47473
  "aria-label": `${title} chat`,
47474
+ "aria-busy": !isChatHistoryReady(chat) || isSessionOperationPending(chat),
47435
47475
  children: [
47436
47476
  sidebarOpen && sidebarLayout === "overlay" ? /* @__PURE__ */ jsxs32(Fragment18, { children: [
47437
47477
  /* @__PURE__ */ jsx100(
@@ -47552,6 +47592,7 @@ function Chat({
47552
47592
  }
47553
47593
  ),
47554
47594
  footer: /* @__PURE__ */ jsxs32(Fragment18, { children: [
47595
+ historyNotice(chat) ? /* @__PURE__ */ jsx100("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: historyNotice(chat) }) : null,
47555
47596
  notice ? /* @__PURE__ */ jsxs32("div", { role: "status", className: cn("text-muted-foreground text-xs"), children: [
47556
47597
  notice,
47557
47598
  /* @__PURE__ */ jsx100("button", { onClick: () => setNotice(""), children: "\xD7" })
@@ -47586,7 +47627,7 @@ function Chat({
47586
47627
  options: attachments,
47587
47628
  placeholder,
47588
47629
  suggestion: nextMessage,
47589
- busy: busy || Boolean(interrupt),
47630
+ busy: status !== "idle" && status !== "error" || Boolean(interrupt),
47590
47631
  cancelling: status === "cancelling",
47591
47632
  recoveryUnavailable: isChatRecoveryUnavailable(chat),
47592
47633
  cancel: chat.cancel