@blade-hq/agent-react 2612.0.0-beta.76 → 2612.0.0-beta.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +15 -1
  2. package/dist/SessionPluginConfigForm-7LJ5SUNY.js +9 -0
  3. package/dist/SessionPluginConfigForm-7LJ5SUNY.js.map +1 -0
  4. package/dist/chat/LiteMessageList.d.ts +4 -0
  5. package/dist/chat/TurnNavRail.d.ts +1 -4
  6. package/dist/chat/index.d.ts +2 -1
  7. package/dist/chat/turn-locate-channel.d.ts +53 -0
  8. package/dist/{chunk-XP6T6SHZ.js → chunk-66JXSDLB.js} +1186 -1038
  9. package/dist/chunk-66JXSDLB.js.map +1 -0
  10. package/dist/{chunk-XJ6ZA6LN.js → chunk-C3LBNHVM.js} +12 -10
  11. package/dist/{chunk-XJ6ZA6LN.js.map → chunk-C3LBNHVM.js.map} +1 -1
  12. package/dist/chunk-F4MWGSKX.js +1308 -0
  13. package/dist/chunk-F4MWGSKX.js.map +1 -0
  14. package/dist/{chunk-7MCGQH34.js → chunk-FBGCDXRK.js} +116 -114
  15. package/dist/chunk-FBGCDXRK.js.map +1 -0
  16. package/dist/{chunk-HCW7SI5Q.js → chunk-FDB3J5QF.js} +8 -6
  17. package/dist/{chunk-HCW7SI5Q.js.map → chunk-FDB3J5QF.js.map} +1 -1
  18. package/dist/{chunk-J72ZLILV.js → chunk-FH5HA3GW.js} +554 -455
  19. package/dist/chunk-FH5HA3GW.js.map +1 -0
  20. package/dist/chunk-KHJEIHMJ.js +973 -0
  21. package/dist/chunk-KHJEIHMJ.js.map +1 -0
  22. package/dist/{chunk-QIR73CES.js → chunk-MWILWSPG.js} +7396 -5684
  23. package/dist/chunk-MWILWSPG.js.map +1 -0
  24. package/dist/{chunk-WRIMPZPN.js → chunk-NRYLAO3X.js} +102 -155
  25. package/dist/chunk-NRYLAO3X.js.map +1 -0
  26. package/dist/{chunk-2DPLLZOU.js → chunk-SK43YNRX.js} +151 -1442
  27. package/dist/chunk-SK43YNRX.js.map +1 -0
  28. package/dist/components/AccountConnectorRules.d.ts +7 -0
  29. package/dist/components/BrowserConnectionDialog.d.ts +3 -2
  30. package/dist/components/ConfigConnection.d.ts +16 -0
  31. package/dist/components/ConnectorDetail.d.ts +46 -0
  32. package/dist/components/ConnectorRulesPanel.d.ts +10 -0
  33. package/dist/components/ConnectorRuntimeDiagnostics.d.ts +2 -2
  34. package/dist/components/DeviceConnection.d.ts +3 -1
  35. package/dist/components/FeishuPermissionStatus.d.ts +3 -1
  36. package/dist/components/ManagedConnection.d.ts +5 -2
  37. package/dist/components/PackEventNotice.d.ts +3 -0
  38. package/dist/components/SessionPluginConfigForm.d.ts +2 -1
  39. package/dist/connectors.d.ts +4 -0
  40. package/dist/connectors.js +10 -2
  41. package/dist/embed/entry.d.ts +4 -0
  42. package/dist/hooks/use-turn-navigation.d.ts +19 -0
  43. package/dist/index.d.ts +4 -0
  44. package/dist/index.js +16 -7
  45. package/dist/internal.d.ts +1 -1
  46. package/dist/internal.js +18 -9
  47. package/dist/internal.js.map +1 -1
  48. package/dist/questions.js +8 -6
  49. package/dist/questions.js.map +1 -1
  50. package/dist/rich-input.js +32 -13
  51. package/dist/rich-input.js.map +1 -1
  52. package/dist/style.full.css +1 -1
  53. package/dist/tool-details.js +5 -4
  54. package/dist/tool-details.js.map +1 -1
  55. package/package.json +2 -2
  56. package/public-api.md +46 -2
  57. package/dist/chunk-2DPLLZOU.js.map +0 -1
  58. package/dist/chunk-7MCGQH34.js.map +0 -1
  59. package/dist/chunk-J72ZLILV.js.map +0 -1
  60. package/dist/chunk-QIR73CES.js.map +0 -1
  61. package/dist/chunk-WRIMPZPN.js.map +0 -1
  62. package/dist/chunk-XP6T6SHZ.js.map +0 -1
@@ -9,26 +9,21 @@ import {
9
9
  useEffectEvent,
10
10
  useSessionPluginActivation,
11
11
  useSessionSkills
12
- } from "./chunk-2DPLLZOU.js";
12
+ } from "./chunk-F4MWGSKX.js";
13
13
  import {
14
14
  ImageLightbox,
15
15
  McpAppMessageContext,
16
16
  MessageImage,
17
17
  ToolUiCardView,
18
18
  getRenderer
19
- } from "./chunk-HCW7SI5Q.js";
19
+ } from "./chunk-FDB3J5QF.js";
20
20
  import {
21
21
  MarkdownContent
22
- } from "./chunk-XJ6ZA6LN.js";
22
+ } from "./chunk-C3LBNHVM.js";
23
23
  import {
24
24
  BladeProvider,
25
25
  ChatEnvironmentProvider,
26
26
  CurrentChatSessionProvider,
27
- Dialog,
28
- DialogClose,
29
- DialogContent,
30
- DialogDescription,
31
- DialogTitle,
32
27
  PlanUpdateBlock,
33
28
  SessionSourceProvider,
34
29
  cn,
@@ -61,7 +56,18 @@ import {
61
56
  useSessionSource,
62
57
  useSessionState,
63
58
  useSingleSessionSource
64
- } from "./chunk-WRIMPZPN.js";
59
+ } from "./chunk-NRYLAO3X.js";
60
+ import {
61
+ Collapsible,
62
+ CollapsibleContent,
63
+ CollapsibleTrigger,
64
+ Dialog,
65
+ DialogClose,
66
+ DialogContent,
67
+ DialogDescription,
68
+ DialogTitle,
69
+ useControllableState
70
+ } from "./chunk-MWILWSPG.js";
65
71
  import {
66
72
  Archive,
67
73
  ArrowRight,
@@ -115,10 +121,8 @@ import {
115
121
  TriangleAlert,
116
122
  Wrench,
117
123
  X,
118
- Zap,
119
- dist_exports2 as dist_exports,
120
- useControllableState
121
- } from "./chunk-QIR73CES.js";
124
+ Zap
125
+ } from "./chunk-KHJEIHMJ.js";
122
126
 
123
127
  // src/hooks/use-agent-session.ts
124
128
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
@@ -219,8 +223,8 @@ function useAgentSession(sessionId, options = {}) {
219
223
  }),
220
224
  [session]
221
225
  );
222
- const state = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
223
- return { session, state, error };
226
+ const state2 = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
227
+ return { session, state: state2, error };
224
228
  }
225
229
 
226
230
  // src/hooks/use-replay.ts
@@ -246,10 +250,10 @@ function useReplay(session) {
246
250
  return;
247
251
  }
248
252
  const pull = () => {
249
- const state = session.getState();
250
- setReplay(state.replay);
251
- setViewerRole(state.viewerRole);
252
- setSourceRunning(state.isStreaming || state.status === "running");
253
+ const state2 = session.getState();
254
+ setReplay(state2.replay);
255
+ setViewerRole(state2.viewerRole);
256
+ setSourceRunning(state2.isStreaming || state2.status === "running");
253
257
  };
254
258
  pull();
255
259
  return session.subscribe(pull);
@@ -471,10 +475,10 @@ function ReplayMismatchPrompt({ mismatch, className }) {
471
475
 
472
476
  // src/components/AgentChat.tsx
473
477
  import { BladeApiError } from "@blade-hq/agent-client/internal";
474
- import { useEffect as useEffect27, useMemo as useMemo17, useRef as useRef23, useState as useState30 } from "react";
478
+ import { useEffect as useEffect28, useMemo as useMemo17, useRef as useRef23, useState as useState31 } from "react";
475
479
 
476
480
  // src/chat/ChatPanel.tsx
477
- import { useCallback as useCallback16, useEffect as useEffect25, useMemo as useMemo16, useState as useState28 } from "react";
481
+ import { useCallback as useCallback16, useEffect as useEffect26, useMemo as useMemo16, useState as useState29 } from "react";
478
482
  import {
479
483
  chatErrorForDisplay as chatErrorForDisplay3,
480
484
  latestPostChatFollowup
@@ -798,7 +802,7 @@ function SessionQueuePanel({
798
802
  {
799
803
  type: "button",
800
804
  "aria-label": `\u7ACB\u523B\u53D1\u9001\u7B2C ${position} \u6761`,
801
- title: deliverable ? "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F" : "\u5F53\u524D\u6CA1\u6709\u53EF\u63A5\u6536\u8865\u5145\u7684\u4EFB\u52A1",
805
+ title: item.next_turn_only ? "\u8FD9\u6761\u6D88\u606F\u4F1A\u5728\u4E0B\u4E00\u8F6E\u5355\u72EC\u5904\u7406" : deliverable ? "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F" : "\u5F53\u524D\u6CA1\u6709\u53EF\u63A5\u6536\u8865\u5145\u7684\u4EFB\u52A1",
802
806
  disabled: busy || !deliverable,
803
807
  onClick: () => onDeliver(item),
804
808
  className: LABEL_BUTTON,
@@ -985,8 +989,8 @@ function CurrentPlanPanel({
985
989
  sessionId,
986
990
  className
987
991
  }) {
988
- const messages = useSessionState(sessionId, (state) => state.messages);
989
- const isStreaming = useSessionState(sessionId, (state) => state.isStreaming);
992
+ const messages = useSessionState(sessionId, (state2) => state2.messages);
993
+ const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
990
994
  const hideTodo = useHideTodo();
991
995
  const revealRevision = usePlanRevealRevision(sessionId);
992
996
  const { current, updating } = useMemo2(() => getPlanUpdateDisplayState(messages), [messages]);
@@ -1408,6 +1412,18 @@ function BackgroundWakeNotice() {
1408
1412
  );
1409
1413
  }
1410
1414
 
1415
+ // src/components/PackEventNotice.tsx
1416
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1417
+ function PackEventNotice({ title }) {
1418
+ return /* @__PURE__ */ jsxs10("div", { "data-pack-event": true, className: "my-3 flex items-center gap-2 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
1419
+ /* @__PURE__ */ jsx10(BellRing, { size: 14, className: "shrink-0", "aria-hidden": "true" }),
1420
+ /* @__PURE__ */ jsx10("span", { children: title })
1421
+ ] });
1422
+ }
1423
+
1424
+ // src/chat/LiteMessageList.tsx
1425
+ import { packEventTitle } from "@blade-hq/agent-client/internal";
1426
+
1411
1427
  // src/chat/AssistantTurnBlock.tsx
1412
1428
  import { getServerTime } from "@blade-hq/agent-client/internal";
1413
1429
  import { memo as memo3, useCallback as useCallback4, useEffect as useEffect13, useMemo as useMemo10, useRef as useRef10, useState as useState17 } from "react";
@@ -1436,36 +1452,6 @@ import {
1436
1452
  isWorkflowRunToolName as isWorkflowRunToolName2
1437
1453
  } from "@blade-hq/agent-client/internal";
1438
1454
 
1439
- // ../ui/src/components/collapsible.tsx
1440
- import { jsx as jsx10 } from "react/jsx-runtime";
1441
- function Collapsible({
1442
- ...props
1443
- }) {
1444
- return /* @__PURE__ */ jsx10(dist_exports.Root, { "data-slot": "collapsible", ...props });
1445
- }
1446
- function CollapsibleTrigger({
1447
- ...props
1448
- }) {
1449
- return /* @__PURE__ */ jsx10(
1450
- dist_exports.CollapsibleTrigger,
1451
- {
1452
- "data-slot": "collapsible-trigger",
1453
- ...props
1454
- }
1455
- );
1456
- }
1457
- function CollapsibleContent({
1458
- ...props
1459
- }) {
1460
- return /* @__PURE__ */ jsx10(
1461
- dist_exports.CollapsibleContent,
1462
- {
1463
- "data-slot": "collapsible-content",
1464
- ...props
1465
- }
1466
- );
1467
- }
1468
-
1469
1455
  // src/chat/ai-elements/reasoning.tsx
1470
1456
  import {
1471
1457
  createContext as createContext4,
@@ -1510,7 +1496,7 @@ var ShimmerComponent = ({
1510
1496
  var Shimmer = memo(ShimmerComponent);
1511
1497
 
1512
1498
  // src/chat/ai-elements/reasoning.tsx
1513
- import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1499
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1514
1500
  var ReasoningContext = createContext4(null);
1515
1501
  var useReasoning = () => {
1516
1502
  const context = useContext4(ReasoningContext);
@@ -1595,11 +1581,11 @@ var ReasoningTrigger = memo2(
1595
1581
  className
1596
1582
  ),
1597
1583
  ...props,
1598
- children: children ?? /* @__PURE__ */ jsxs10(Fragment5, { children: [
1584
+ children: children ?? /* @__PURE__ */ jsxs11(Fragment5, { children: [
1599
1585
  /* @__PURE__ */ jsx12(Brain, { className: "size-4" }),
1600
- /* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center gap-1.5", children: [
1586
+ /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
1601
1587
  isStreaming || duration === 0 ? /* @__PURE__ */ jsx12(Shimmer, { duration: 1, children: status }) : /* @__PURE__ */ jsx12("span", { children: status }),
1602
- /* @__PURE__ */ jsxs10("span", { className: "whitespace-nowrap tabular-nums text-[hsl(var(--muted-foreground))]/70", children: [
1588
+ /* @__PURE__ */ jsxs11("span", { className: "whitespace-nowrap tabular-nums text-[hsl(var(--muted-foreground))]/70", children: [
1603
1589
  "\xB7 ",
1604
1590
  detail
1605
1591
  ] })
@@ -1643,7 +1629,7 @@ function compactReasoningText(text) {
1643
1629
  function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
1644
1630
  const compactReasoning = compactReasoningText(reasoning);
1645
1631
  const [open, setOpen] = useState7(false);
1646
- return /* @__PURE__ */ jsxs10(
1632
+ return /* @__PURE__ */ jsxs11(
1647
1633
  "span",
1648
1634
  {
1649
1635
  className: cn(
@@ -1665,13 +1651,13 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
1665
1651
  children: "\u601D\u8003\u8BE6\u60C5"
1666
1652
  }
1667
1653
  ),
1668
- /* @__PURE__ */ jsx12(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs10(
1654
+ /* @__PURE__ */ jsx12(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs11(
1669
1655
  DialogContent,
1670
1656
  {
1671
1657
  showCloseButton: false,
1672
1658
  className: "m-0 flex max-h-[min(520px,calc(100vh-48px))] w-[min(760px,calc(100vw-48px))] flex-col gap-0 overflow-hidden p-0 text-left text-[13px] leading-6",
1673
1659
  children: [
1674
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
1660
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
1675
1661
  /* @__PURE__ */ jsx12(DialogTitle, { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u601D\u8003\u8BE6\u60C5" }),
1676
1662
  /* @__PURE__ */ jsx12(
1677
1663
  DialogClose,
@@ -1700,7 +1686,7 @@ var CardContext = createContext5({});
1700
1686
 
1701
1687
  // src/chat/FileDeliveryCards.tsx
1702
1688
  import { useMemo as useMemo5, useState as useState8 } from "react";
1703
- import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1689
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1704
1690
  var AGENT_WORKSPACE_DIR_NAME = "\u667A\u80FD\u52A9\u624B\u5DE5\u4F5C\u7A7A\u95F4";
1705
1691
  var EXT_LABELS = {
1706
1692
  py: "Python",
@@ -1804,13 +1790,13 @@ function DeliveryCard({
1804
1790
  setDownloading(false);
1805
1791
  }
1806
1792
  };
1807
- return /* @__PURE__ */ jsxs11(
1793
+ return /* @__PURE__ */ jsxs12(
1808
1794
  "div",
1809
1795
  {
1810
1796
  "data-artifact-kind": isVideoFile(name) ? "video" : "file",
1811
1797
  className: compact ? "file-delivery-card group/delivery relative flex w-full max-w-full items-stretch self-start overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-sm transition-colors hover:bg-[hsl(var(--accent)/0.45)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]" : "file-delivery-card group/delivery relative flex w-[320px] max-w-full items-center self-start rounded-[14px] border border-[hsl(var(--border))] bg-[hsl(var(--card))] transition-colors duration-150 hover:border-[hsl(var(--primary)/0.3)] hover:bg-[hsl(var(--muted)/0.6)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]",
1812
1798
  children: [
1813
- /* @__PURE__ */ jsxs11(
1799
+ /* @__PURE__ */ jsxs12(
1814
1800
  "button",
1815
1801
  {
1816
1802
  type: "button",
@@ -1822,9 +1808,9 @@ function DeliveryCard({
1822
1808
  ${name}` : name,
1823
1809
  children: [
1824
1810
  /* @__PURE__ */ jsx13("span", { className: compact ? "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]" : "flex h-[42px] w-[42px] shrink-0 items-center justify-center rounded-[11px] bg-gradient-to-br from-[hsl(var(--primary))/0.1] to-[hsl(var(--primary))/0.2] text-[hsl(var(--primary))]", children: opening ? /* @__PURE__ */ jsx13(LoaderCircle, { size: compact ? 15 : 22, className: "animate-spin", "aria-hidden": "true" }) : isVideoFile(name) ? /* @__PURE__ */ jsx13(Film, { size: compact ? 15 : 22, "aria-hidden": "true" }) : /* @__PURE__ */ jsx13(FileGlyph, {}) }),
1825
- /* @__PURE__ */ jsxs11("span", { className: compact ? "min-w-0" : "flex min-w-0 flex-1 flex-col gap-0.5", children: [
1811
+ /* @__PURE__ */ jsxs12("span", { className: compact ? "min-w-0" : "flex min-w-0 flex-1 flex-col gap-0.5", children: [
1826
1812
  /* @__PURE__ */ jsx13("span", { className: compact ? "block truncate text-xs font-medium leading-5" : "truncate text-[15px] font-semibold text-[hsl(var(--foreground))]", children: displayName || name }),
1827
- !compact ? /* @__PURE__ */ jsx13("span", { className: "flex items-center gap-1.5 truncate text-[12.5px] text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx13("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
1813
+ !compact ? /* @__PURE__ */ jsx13("span", { className: "flex items-center gap-1.5 truncate text-[12.5px] text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx13("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
1828
1814
  /* @__PURE__ */ jsx13("span", { className: "font-mono", children: getExtLabel(name) }),
1829
1815
  /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", children: "\xB7" }),
1830
1816
  /* @__PURE__ */ jsx13("span", { className: "text-[hsl(var(--primary))]", children: "AI \u751F\u6210" })
@@ -1853,7 +1839,7 @@ ${name}` : name,
1853
1839
  );
1854
1840
  }
1855
1841
  function FileGlyph() {
1856
- return /* @__PURE__ */ jsxs11(
1842
+ return /* @__PURE__ */ jsxs12(
1857
1843
  "svg",
1858
1844
  {
1859
1845
  width: "21",
@@ -1885,7 +1871,7 @@ function FileDeliveryCards({
1885
1871
 
1886
1872
  // src/chat/MessageActions.tsx
1887
1873
  import { useState as useState9 } from "react";
1888
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
1874
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1889
1875
  function MessageActions({ content, className }) {
1890
1876
  const [copied, setCopied] = useState9(false);
1891
1877
  const handleCopy = async () => {
@@ -1895,7 +1881,7 @@ function MessageActions({ content, className }) {
1895
1881
  setTimeout(() => setCopied(false), 2e3);
1896
1882
  }
1897
1883
  };
1898
- return /* @__PURE__ */ jsx14("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs12(
1884
+ return /* @__PURE__ */ jsx14("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs13(
1899
1885
  "button",
1900
1886
  {
1901
1887
  type: "button",
@@ -1913,7 +1899,7 @@ function MessageActions({ content, className }) {
1913
1899
  }
1914
1900
 
1915
1901
  // src/chat/MessageFileAttachmentList.tsx
1916
- import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
1902
+ import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1917
1903
  function getFileIcon(fileName) {
1918
1904
  const lowerName = fileName.toLowerCase();
1919
1905
  if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
@@ -1945,7 +1931,7 @@ function MessageFileAttachmentList({
1945
1931
  return /* @__PURE__ */ jsx15("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file) => {
1946
1932
  const Icon = getFileIcon(file.name);
1947
1933
  const key = `${file.name}-${file.data.slice(0, 32)}`;
1948
- const content = /* @__PURE__ */ jsxs13(Fragment7, { children: [
1934
+ const content = /* @__PURE__ */ jsxs14(Fragment7, { children: [
1949
1935
  /* @__PURE__ */ jsx15(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
1950
1936
  /* @__PURE__ */ jsx15("span", { className: "max-w-32 truncate", children: file.name })
1951
1937
  ] });
@@ -1986,7 +1972,7 @@ import {
1986
1972
  import { formatAskUserAnswer } from "@blade-hq/agent-client";
1987
1973
  import { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
1988
1974
  import { parseAskUserQuestion } from "@blade-hq/agent-client";
1989
- import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
1975
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
1990
1976
  var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
1991
1977
  function resizeCustomTextarea(textarea) {
1992
1978
  textarea.style.height = "auto";
@@ -2126,7 +2112,7 @@ function AskUserQuestionBlock({
2126
2112
  setSubmitted(true);
2127
2113
  onAnswer(text, toolCallId, nextAnswerData);
2128
2114
  };
2129
- return /* @__PURE__ */ jsxs14(
2115
+ return /* @__PURE__ */ jsxs15(
2130
2116
  "div",
2131
2117
  {
2132
2118
  part: "ask-card",
@@ -2135,7 +2121,7 @@ function AskUserQuestionBlock({
2135
2121
  answered ? "max-w-2xl space-y-3 p-3 text-xs text-[hsl(var(--muted-foreground))] opacity-80" : "max-w-lg space-y-5 p-4 text-sm"
2136
2122
  ),
2137
2123
  children: [
2138
- data.source_loop?.description && /* @__PURE__ */ jsxs14("div", { className: "rounded-lg bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
2124
+ data.source_loop?.description && /* @__PURE__ */ jsxs15("div", { className: "rounded-lg bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
2139
2125
  "\u5B50\u667A\u80FD\u4F53\u300C",
2140
2126
  data.source_loop.description,
2141
2127
  "\u300D\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54"
@@ -2174,7 +2160,7 @@ function AskUserQuestionBlock({
2174
2160
  children: allAnswered ? "\u786E\u8BA4" : "\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u9009\u9879"
2175
2161
  }
2176
2162
  ),
2177
- submitted && !answered && /* @__PURE__ */ jsxs14(
2163
+ submitted && !answered && /* @__PURE__ */ jsxs15(
2178
2164
  "button",
2179
2165
  {
2180
2166
  type: "button",
@@ -2203,8 +2189,8 @@ function QuestionCard({
2203
2189
  }) {
2204
2190
  const multi = question.multiSelect ?? false;
2205
2191
  const customTextareaRef = useAutoResizeTextarea(customText);
2206
- return /* @__PURE__ */ jsxs14("div", { children: [
2207
- /* @__PURE__ */ jsxs14("div", { className: cn("flex items-start gap-2", answered ? "mb-2" : "mb-3"), children: [
2192
+ return /* @__PURE__ */ jsxs15("div", { children: [
2193
+ /* @__PURE__ */ jsxs15("div", { className: cn("flex items-start gap-2", answered ? "mb-2" : "mb-3"), children: [
2208
2194
  /* @__PURE__ */ jsx17(
2209
2195
  MessageSquareMore,
2210
2196
  {
@@ -2233,10 +2219,10 @@ function QuestionCard({
2233
2219
  }
2234
2220
  )
2235
2221
  ] }),
2236
- /* @__PURE__ */ jsxs14("div", { className: cn("flex flex-col pl-5", answered ? "gap-1" : "gap-1.5"), children: [
2222
+ /* @__PURE__ */ jsxs15("div", { className: cn("flex flex-col pl-5", answered ? "gap-1" : "gap-1.5"), children: [
2237
2223
  question.options.map((opt, optIdx) => {
2238
2224
  const isSel = selected.has(optIdx);
2239
- return /* @__PURE__ */ jsxs14(
2225
+ return /* @__PURE__ */ jsxs15(
2240
2226
  "button",
2241
2227
  {
2242
2228
  type: "button",
@@ -2268,7 +2254,7 @@ function QuestionCard({
2268
2254
  )
2269
2255
  }
2270
2256
  ),
2271
- /* @__PURE__ */ jsxs14("div", { className: "min-w-0", children: [
2257
+ /* @__PURE__ */ jsxs15("div", { className: "min-w-0", children: [
2272
2258
  /* @__PURE__ */ jsx17("div", { className: cn("font-medium", answered ? "text-xs" : "text-[13px]"), children: opt.label }),
2273
2259
  opt.description && /* @__PURE__ */ jsx17(
2274
2260
  "div",
@@ -2287,7 +2273,7 @@ function QuestionCard({
2287
2273
  opt.label
2288
2274
  );
2289
2275
  }),
2290
- answered && !isCustom ? null : /* @__PURE__ */ jsxs14(
2276
+ answered && !isCustom ? null : /* @__PURE__ */ jsxs15(
2291
2277
  "div",
2292
2278
  {
2293
2279
  className: cn(
@@ -2330,7 +2316,7 @@ function NoteField({
2330
2316
  const textareaRef = useAutoResizeTextarea(note);
2331
2317
  const readOnly = answered || submitted;
2332
2318
  if (answered && !note.trim()) return null;
2333
- return /* @__PURE__ */ jsxs14(
2319
+ return /* @__PURE__ */ jsxs15(
2334
2320
  "label",
2335
2321
  {
2336
2322
  className: cn(
@@ -2366,7 +2352,7 @@ function NoteField({
2366
2352
  }
2367
2353
 
2368
2354
  // src/chat/ToolCallBlock.tsx
2369
- import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
2355
+ import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2370
2356
  function getFilePreviewName(filePath) {
2371
2357
  return filePath.split(/[\\/]/).pop() ?? filePath;
2372
2358
  }
@@ -2429,7 +2415,7 @@ function ToolPreviewAction({
2429
2415
  return null;
2430
2416
  }
2431
2417
  const label = uiMeta.title ?? displayName;
2432
- return /* @__PURE__ */ jsxs15(
2418
+ return /* @__PURE__ */ jsxs16(
2433
2419
  "button",
2434
2420
  {
2435
2421
  type: "button",
@@ -2537,20 +2523,20 @@ function ToolCallBlock({
2537
2523
  if (!reasoning) {
2538
2524
  return questionBlock;
2539
2525
  }
2540
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
2526
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
2541
2527
  questionBlock,
2542
2528
  /* @__PURE__ */ jsx18("div", { className: "ml-4", children: /* @__PURE__ */ jsx18(ThinkingBadge, { reasoning, variant: "block" }) })
2543
2529
  ] });
2544
2530
  }
2545
2531
  if (toolCall.status === "pending") {
2546
- return /* @__PURE__ */ jsxs15("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 flex max-w-lg items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
2532
+ return /* @__PURE__ */ jsxs16("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 flex max-w-lg items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
2547
2533
  /* @__PURE__ */ jsx18(LoaderCircle, { size: 14, className: "animate-spin" }),
2548
2534
  /* @__PURE__ */ jsx18("span", { children: "\u6B63\u5728\u51C6\u5907\u95EE\u9898\u2026" })
2549
2535
  ] });
2550
2536
  }
2551
- return /* @__PURE__ */ jsxs15("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 max-w-lg rounded-xl border border-[hsl(var(--swf-warning)/0.35)] bg-[hsl(var(--swf-warning-soft))] p-4 text-sm text-[hsl(var(--foreground))]", children: [
2537
+ return /* @__PURE__ */ jsxs16("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 max-w-lg rounded-xl border border-[hsl(var(--swf-warning)/0.35)] bg-[hsl(var(--swf-warning-soft))] p-4 text-sm text-[hsl(var(--foreground))]", children: [
2552
2538
  /* @__PURE__ */ jsx18("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
2553
- /* @__PURE__ */ jsxs15("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: [
2539
+ /* @__PURE__ */ jsxs16("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: [
2554
2540
  "\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u6216\u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u63D0\u4F9B\u4EA4\u4E92\u7F16\u53F7",
2555
2541
  /* @__PURE__ */ jsx18("span", { className: "ml-1 font-mono", children: toolCall.id }),
2556
2542
  "\u3002"
@@ -2565,7 +2551,7 @@ function ToolCallBlock({
2565
2551
  const indentClass = level === 2 ? "ml-3" : "";
2566
2552
  const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */ jsx18(LoaderCircle, { size: 12, className: "animate-spin" }) : toolCall.status === "awaiting_answer" ? /* @__PURE__ */ jsx18(MessageSquareMore, { size: 12 }) : toolCall.status === "cancelled" || toolCall.status === "error" ? /* @__PURE__ */ jsx18(X, { size: 12 }) : /* @__PURE__ */ jsx18(Check, { size: 12 });
2567
2553
  const statusTextClass = tone === "failed" ? "text-[hsl(var(--swf-danger))]" : tone === "awaiting" ? "text-[hsl(var(--swf-warning))]" : tone === "running" ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--primary))]";
2568
- return /* @__PURE__ */ jsxs15(
2554
+ return /* @__PURE__ */ jsxs16(
2569
2555
  "div",
2570
2556
  {
2571
2557
  part: normalizedName === "Agent" ? "agent-loop" : "tool-row",
@@ -2576,8 +2562,8 @@ function ToolCallBlock({
2576
2562
  customization?.classNames?.toolCall
2577
2563
  ),
2578
2564
  children: [
2579
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 min-h-7 pr-3 leading-5", children: [
2580
- /* @__PURE__ */ jsxs15(
2565
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 min-h-7 pr-3 leading-5", children: [
2566
+ /* @__PURE__ */ jsxs16(
2581
2567
  "button",
2582
2568
  {
2583
2569
  type: "button",
@@ -2595,11 +2581,11 @@ function ToolCallBlock({
2595
2581
  )
2596
2582
  }
2597
2583
  ),
2598
- /* @__PURE__ */ jsxs15("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
2584
+ /* @__PURE__ */ jsxs16("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
2599
2585
  statusIcon,
2600
2586
  /* @__PURE__ */ jsx18("span", { children: getToolStatusLabel(toolCall.status) })
2601
2587
  ] }),
2602
- /* @__PURE__ */ jsxs15("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
2588
+ /* @__PURE__ */ jsxs16("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
2603
2589
  displayName,
2604
2590
  toolCall.status === "error" ? "\uFF08\u5F85\u91CD\u8BD5\uFF09" : ""
2605
2591
  ] })
@@ -2617,12 +2603,12 @@ function ToolCallBlock({
2617
2603
  }
2618
2604
  )
2619
2605
  ] }),
2620
- expanded && /* @__PURE__ */ jsx18("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx18(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs15(Fragment8, { children: [
2606
+ expanded && /* @__PURE__ */ jsx18("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx18(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs16(Fragment8, { children: [
2621
2607
  /* @__PURE__ */ jsx18("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
2622
2608
  /* @__PURE__ */ jsx18("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
2623
2609
  /* @__PURE__ */ jsx18("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
2624
2610
  /* @__PURE__ */ jsx18("pre", { className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-[hsl(var(--muted))] p-2 font-mono text-[11px] text-[hsl(var(--foreground))]", children: formatArgs(toolCall.arguments) }),
2625
- toolCall.result != null && /* @__PURE__ */ jsxs15(Fragment8, { children: [
2611
+ toolCall.result != null && /* @__PURE__ */ jsxs16(Fragment8, { children: [
2626
2612
  /* @__PURE__ */ jsx18("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
2627
2613
  /* @__PURE__ */ jsx18(
2628
2614
  "pre",
@@ -2701,7 +2687,7 @@ function useAsyncValue(key, load2) {
2701
2687
  }
2702
2688
 
2703
2689
  // src/chat/AttachmentPreviewDialog.tsx
2704
- import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
2690
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
2705
2691
  function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
2706
2692
  const enabled = open && url != null && (mode === "markdown" || mode === "text");
2707
2693
  const { data: content, error } = useAsyncValue(enabled ? `${mode}:${url}` : null, async (signal) => {
@@ -2717,15 +2703,15 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
2717
2703
  return res.text();
2718
2704
  });
2719
2705
  if (!open) return null;
2720
- return /* @__PURE__ */ jsx19(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs16(
2706
+ return /* @__PURE__ */ jsx19(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs17(
2721
2707
  DialogContent,
2722
2708
  {
2723
2709
  showCloseButton: false,
2724
2710
  className: "flex max-h-[90vh] w-full max-w-3xl flex-col gap-0 overflow-hidden p-0",
2725
2711
  children: [
2726
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
2712
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
2727
2713
  /* @__PURE__ */ jsx19(DialogTitle, { className: "truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: filename }),
2728
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
2714
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
2729
2715
  url && /* @__PURE__ */ jsx19(
2730
2716
  "a",
2731
2717
  {
@@ -2763,14 +2749,14 @@ function renderContent({
2763
2749
  return /* @__PURE__ */ jsx19("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6B64\u9644\u4EF6\u6682\u65E0\u53EF\u7528\u9884\u89C8\u5730\u5740\u3002" });
2764
2750
  }
2765
2751
  if (mode === "default") {
2766
- return /* @__PURE__ */ jsxs16("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
2752
+ return /* @__PURE__ */ jsxs17("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
2767
2753
  "\u6B64\u7C7B\u578B\u6682\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\u3002\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2",
2768
2754
  /* @__PURE__ */ jsx19("span", { className: "mx-1 font-medium text-[hsl(var(--foreground))]", children: "\u4E0B\u8F7D" }),
2769
2755
  "\u6309\u94AE\u67E5\u770B\u3002"
2770
2756
  ] });
2771
2757
  }
2772
2758
  if (error) {
2773
- return /* @__PURE__ */ jsxs16("p", { className: "text-[hsl(var(--destructive))]", children: [
2759
+ return /* @__PURE__ */ jsxs17("p", { className: "text-[hsl(var(--destructive))]", children: [
2774
2760
  "\u52A0\u8F7D\u5931\u8D25\uFF1A",
2775
2761
  String(error?.message ?? error)
2776
2762
  ] });
@@ -2821,7 +2807,7 @@ function dispatchPreview(filename, url) {
2821
2807
  }
2822
2808
 
2823
2809
  // src/chat/ContextAttachmentPills.tsx
2824
- import { Fragment as Fragment9, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
2810
+ import { Fragment as Fragment9, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
2825
2811
  function ContextAttachmentPills({ attachments }) {
2826
2812
  const client = useOptionalBladeClient();
2827
2813
  const download = useRef9(null);
@@ -2857,19 +2843,19 @@ function ContextAttachmentPills({ attachments }) {
2857
2843
  if (!controller.signal.aborted) setLoading(null);
2858
2844
  }
2859
2845
  };
2860
- return /* @__PURE__ */ jsxs17(Fragment9, { children: [
2846
+ return /* @__PURE__ */ jsxs18(Fragment9, { children: [
2861
2847
  /* @__PURE__ */ jsx20("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u9644\u52A0\u8D44\u6599", children: attachments.map((item) => /* @__PURE__ */ jsx20("button", { type: "button", onClick: () => {
2862
2848
  setSelected(selected?.id === item.id ? null : item);
2863
2849
  setUnavailable(null);
2864
2850
  }, "aria-expanded": selected?.id === item.id, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: item.label }, item.id)) }),
2865
- selected && /* @__PURE__ */ jsxs17("div", { className: "max-w-full rounded-xl border border-border bg-muted p-3 text-sm text-foreground", children: [
2851
+ selected && /* @__PURE__ */ jsxs18("div", { className: "max-w-full rounded-xl border border-border bg-muted p-3 text-sm text-foreground", children: [
2866
2852
  /* @__PURE__ */ jsx20("div", { className: "mb-2 font-medium", children: selected.label }),
2867
2853
  /* @__PURE__ */ jsx20("div", { className: "whitespace-pre-wrap break-words", children: selected.content }),
2868
- selected.files?.map((file, index) => /* @__PURE__ */ jsxs17("button", { type: "button", disabled: loading != null || !file.path || !file.session_id, onClick: () => void openFile(file), className: "mt-2 block max-w-full truncate text-left underline", children: [
2854
+ selected.files?.map((file, index) => /* @__PURE__ */ jsxs18("button", { type: "button", disabled: loading != null || !file.path || !file.session_id, onClick: () => void openFile(file), className: "mt-2 block max-w-full truncate text-left underline", children: [
2869
2855
  file.name,
2870
2856
  !file.path || !file.session_id ? " \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528" : loading === file.name ? " \xB7 \u8BFB\u53D6\u4E2D" : ""
2871
2857
  ] }, index)),
2872
- unavailable && /* @__PURE__ */ jsxs17("output", { className: "mt-2 block text-xs text-muted-foreground", children: [
2858
+ unavailable && /* @__PURE__ */ jsxs18("output", { className: "mt-2 block text-xs text-muted-foreground", children: [
2873
2859
  unavailable,
2874
2860
  " \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528"
2875
2861
  ] })
@@ -2938,10 +2924,10 @@ function parseWhatIfPrompt(text) {
2938
2924
  }
2939
2925
 
2940
2926
  // src/chat/MessageContextPills.tsx
2941
- import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
2927
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
2942
2928
  function MessageContextPills({ contexts }) {
2943
2929
  if (contexts.length === 0) return null;
2944
- return /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index) => /* @__PURE__ */ jsxs18(
2930
+ return /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index) => /* @__PURE__ */ jsxs19(
2945
2931
  "div",
2946
2932
  {
2947
2933
  className: "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--primary)/0.25)] bg-[hsl(var(--primary)/0.1)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary)/0.85)]",
@@ -2956,7 +2942,7 @@ function MessageContextPills({ contexts }) {
2956
2942
  }
2957
2943
 
2958
2944
  // src/chat/TextAttachmentPills.tsx
2959
- import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
2945
+ import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
2960
2946
  function getFileIcon2(fileName) {
2961
2947
  const lower2 = fileName.toLowerCase();
2962
2948
  if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive;
@@ -2974,7 +2960,7 @@ function TextAttachmentPills({ attachments, onPreview }) {
2974
2960
  return /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index) => {
2975
2961
  const Icon = getFileIcon2(att.name);
2976
2962
  const key = `${att.uploadedPath ?? att.name}:${att.name}:${index}`;
2977
- const content = /* @__PURE__ */ jsxs19(Fragment10, { children: [
2963
+ const content = /* @__PURE__ */ jsxs20(Fragment10, { children: [
2978
2964
  /* @__PURE__ */ jsx22(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
2979
2965
  /* @__PURE__ */ jsx22("span", { className: "max-w-40 truncate", children: att.name })
2980
2966
  ] });
@@ -2996,19 +2982,19 @@ function TextAttachmentPills({ attachments, onPreview }) {
2996
2982
  }
2997
2983
 
2998
2984
  // src/components/WhatIfUserBubble.tsx
2999
- import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
2985
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
3000
2986
  function WhatIfUserBubble({ parsed, onQuoteClick }) {
3001
2987
  const { fromStep, quotes, userText } = parsed;
3002
- return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-end gap-2", children: [
3003
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.5)] px-2.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
2988
+ return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-end gap-2", children: [
2989
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.5)] px-2.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
3004
2990
  /* @__PURE__ */ jsx23(RefreshCcw, { size: 10 }),
3005
2991
  /* @__PURE__ */ jsx23("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
3006
2992
  ] }),
3007
2993
  quotes.length > 0 && /* @__PURE__ */ jsx23("div", { className: "flex max-w-[min(72vw,42rem)] flex-col items-stretch gap-2", children: quotes.map((quote, index) => {
3008
2994
  const clickable = quote.stepNumber != null && !!onQuoteClick;
3009
2995
  const label = quote.stepNumber != null ? `\u6B65\u9AA4${quote.stepNumber} \xB7 ${quote.label}` : quote.label;
3010
- return /* @__PURE__ */ jsxs20("div", { className: "rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.8)] px-3 py-2 text-left", children: [
3011
- /* @__PURE__ */ jsxs20("button", { type: "button", disabled: !clickable, onClick: () => clickable && onQuoteClick(quote.stepNumber), className: "inline-flex max-w-full items-center gap-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] disabled:cursor-default", title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0, children: [
2996
+ return /* @__PURE__ */ jsxs21("div", { className: "rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.8)] px-3 py-2 text-left", children: [
2997
+ /* @__PURE__ */ jsxs21("button", { type: "button", disabled: !clickable, onClick: () => clickable && onQuoteClick(quote.stepNumber), className: "inline-flex max-w-full items-center gap-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] disabled:cursor-default", title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0, children: [
3012
2998
  /* @__PURE__ */ jsx23("span", { children: "\u21B3" }),
3013
2999
  /* @__PURE__ */ jsx23("span", { className: "truncate", children: label })
3014
3000
  ] }),
@@ -3020,7 +3006,7 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
3020
3006
  }
3021
3007
 
3022
3008
  // src/chat/UserMessageBubble.tsx
3023
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
3009
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
3024
3010
  function isUserMessage(message) {
3025
3011
  return message.role === "user";
3026
3012
  }
@@ -3071,13 +3057,13 @@ function UserMessageBubble({ message, className }) {
3071
3057
  } = extractTextAttachments(message.content);
3072
3058
  const trimmedClean = cleanText.trim();
3073
3059
  const pluginPills = message.refs?.length ? /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap justify-end gap-1.5", "aria-label": "\u6D88\u606F\u5F15\u7528", children: message.refs.map((ref) => /* @__PURE__ */ jsx24("span", { className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs", children: ref.provider === "skill" ? `\u6280\u80FD \xB7 ${ref.label}` : ref.label }, ref.provider === "skill" ? `skill:${ref.id}` : `${ref.plugin}:${ref.server}:${ref.id}`)) }) : null;
3074
- const topicAssetPills = message.topic_asset_refs?.length ? /* @__PURE__ */ jsx24("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u5F15\u7528\u7684\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7", children: message.topic_asset_refs.map((ref) => /* @__PURE__ */ jsxs21("span", { title: ref.path, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: [
3060
+ const topicAssetPills = message.topic_asset_refs?.length ? /* @__PURE__ */ jsx24("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u5F15\u7528\u7684\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7", children: message.topic_asset_refs.map((ref) => /* @__PURE__ */ jsxs22("span", { title: ref.path, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: [
3075
3061
  "\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7 \xB7 ",
3076
3062
  ref.path
3077
3063
  ] }, `${ref.topic_id}:${ref.path}`)) }) : null;
3078
3064
  const whatifParsed = trimmedClean && imageParts.length === 0 && fileParts.length === 0 && textAttachments.length === 0 ? parseWhatIfPrompt(cleanText) : null;
3079
3065
  if (whatifParsed && customBubble == null) {
3080
- return /* @__PURE__ */ jsx24("div", { part: "user-row", className: "blade-chat-user-row flex justify-end", children: /* @__PURE__ */ jsxs21("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-2", children: [
3066
+ return /* @__PURE__ */ jsx24("div", { part: "user-row", className: "blade-chat-user-row flex justify-end", children: /* @__PURE__ */ jsxs22("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-2", children: [
3081
3067
  pluginPills,
3082
3068
  topicAssetPills,
3083
3069
  /* @__PURE__ */ jsx24(ContextAttachmentPills, { attachments: message.context_attachments }),
@@ -3133,8 +3119,8 @@ function UserMessageBubble({ message, className }) {
3133
3119
  const mode = kind === "text" ? lower2.endsWith(".md") ? "markdown" : "text" : "default";
3134
3120
  setPreview({ filename: attachment.name, url, mode });
3135
3121
  };
3136
- return /* @__PURE__ */ jsx24("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */ jsxs21("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-3", children: [
3137
- (imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs21("div", { className: "grid gap-2", children: [
3122
+ return /* @__PURE__ */ jsx24("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */ jsxs22("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-3", children: [
3123
+ (imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs22("div", { className: "grid gap-2", children: [
3138
3124
  imageParts.map((part, idx) => /* @__PURE__ */ jsx24(
3139
3125
  "button",
3140
3126
  {
@@ -3246,7 +3232,7 @@ function ErrorMessageBlock({
3246
3232
  }) {
3247
3233
  const text = chatErrorForDisplay(getTextContent(message.content));
3248
3234
  const looksLikeModelUnavailable = /no source matches this model|404/i.test(text);
3249
- return /* @__PURE__ */ jsx24("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */ jsxs21("div", { className: "min-w-0 max-w-full whitespace-pre-wrap break-words border-l-[3px] border-[hsl(var(--border))] px-3 py-1 text-left text-sm leading-7 text-[hsl(var(--muted-foreground))] [overflow-wrap:anywhere]", children: [
3235
+ return /* @__PURE__ */ jsx24("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */ jsxs22("div", { className: "min-w-0 max-w-full whitespace-pre-wrap break-words border-l-[3px] border-[hsl(var(--border))] px-3 py-1 text-left text-sm leading-7 text-[hsl(var(--muted-foreground))] [overflow-wrap:anywhere]", children: [
3250
3236
  text,
3251
3237
  looksLikeModelUnavailable ? /* @__PURE__ */ jsx24("div", { className: "mt-1 opacity-80", children: "\u6A21\u578B\u53EF\u80FD\u672A\u542F\u52A8\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" }) : null
3252
3238
  ] }) });
@@ -3261,7 +3247,7 @@ function findLatestReasoningMessageIndex(messages) {
3261
3247
  }
3262
3248
 
3263
3249
  // src/chat/AgentLoopBlock.tsx
3264
- import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
3250
+ import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
3265
3251
  var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
3266
3252
  function safeParseDescription(argsStr) {
3267
3253
  try {
@@ -3294,9 +3280,9 @@ function AgentLoopBlock({
3294
3280
  defaultExpanded = false,
3295
3281
  renderDescription
3296
3282
  }) {
3297
- const agentLoops = useSessionState(sessionId, (state) => state.agentLoops);
3298
- const messages = useSessionState(sessionId, (state) => state.messages);
3299
- const askAnswers = useSessionState(sessionId, (state) => state.askAnswers);
3283
+ const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
3284
+ const messages = useSessionState(sessionId, (state2) => state2.messages);
3285
+ const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
3300
3286
  const loopEntry = useMemo8(() => {
3301
3287
  for (const [loopName, info] of Object.entries(agentLoops)) {
3302
3288
  if (info.toolCallId === toolCall.id) {
@@ -3364,7 +3350,7 @@ function AgentLoopBlock({
3364
3350
  const status = hasAwaitingAnswer || toolCall.status === "awaiting_answer" && visibleLoopToolCalls.length === 0 ? "awaiting_answer" : toolCall.status === "pending" || loopEntry?.info.status === "running" ? "running" : toolCall.status === "error" || loopEntry?.info.status === "error" ? "error" : toolCall.status === "cancelled" || loopEntry?.info.status === "cancelled" ? "cancelled" : "done";
3365
3351
  const latestReasoningIndex = status === "running" ? findLatestReasoningMessageIndex(childMessages) : -1;
3366
3352
  const cardStyles = getLoopCardStyles(status);
3367
- return /* @__PURE__ */ jsxs22(
3353
+ return /* @__PURE__ */ jsxs23(
3368
3354
  "div",
3369
3355
  {
3370
3356
  part: "agent-loop",
@@ -3373,8 +3359,8 @@ function AgentLoopBlock({
3373
3359
  cardStyles.borderClass
3374
3360
  ),
3375
3361
  children: [
3376
- status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs22(Fragment11, { children: [
3377
- /* @__PURE__ */ jsxs22(
3362
+ status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs23(Fragment11, { children: [
3363
+ /* @__PURE__ */ jsxs23(
3378
3364
  "div",
3379
3365
  {
3380
3366
  className: cn(
@@ -3389,9 +3375,9 @@ function AgentLoopBlock({
3389
3375
  onClick: toggleExpanded,
3390
3376
  "aria-expanded": expanded,
3391
3377
  className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
3392
- children: /* @__PURE__ */ jsxs22("span", { className: "min-w-0 flex items-center gap-2", children: [
3378
+ children: /* @__PURE__ */ jsxs23("span", { className: "min-w-0 flex items-center gap-2", children: [
3393
3379
  status === "awaiting_answer" ? /* @__PURE__ */ jsx25(MessageSquareMore, { size: 14, className: "shrink-0 text-[hsl(var(--swf-warning))] motion-safe:animate-pulse" }) : /* @__PURE__ */ jsx25(Bot, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
3394
- /* @__PURE__ */ jsxs22("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
3380
+ /* @__PURE__ */ jsxs23("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
3395
3381
  renderDescription ? renderDescription(description) : description,
3396
3382
  status === "awaiting_answer" ? " \u2014 \u7B49\u5F85\u56DE\u7B54" : ""
3397
3383
  ] })
@@ -3437,12 +3423,12 @@ function AgentLoopBlock({
3437
3423
  level: 2
3438
3424
  },
3439
3425
  childToolCall.id
3440
- )) : /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
3426
+ )) : /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
3441
3427
  /* @__PURE__ */ jsx25(LoaderCircle, { size: 12, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }),
3442
3428
  /* @__PURE__ */ jsx25("span", { children: "\u6B63\u5728\u542F\u52A8..." })
3443
3429
  ] }) }) : status === "awaiting_answer" ? /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-1 py-2", children: /* @__PURE__ */ jsx25("div", { className: "px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BF7\u5728\u4E0B\u65B9\u5B50\u667A\u80FD\u4F53\u5BF9\u8BDD\u4E2D\u5B8C\u6210\u786E\u8BA4" }) }) : null
3444
- ] }) : /* @__PURE__ */ jsxs22(Fragment11, { children: [
3445
- /* @__PURE__ */ jsxs22(
3430
+ ] }) : /* @__PURE__ */ jsxs23(Fragment11, { children: [
3431
+ /* @__PURE__ */ jsxs23(
3446
3432
  "div",
3447
3433
  {
3448
3434
  className: cn(
@@ -3457,7 +3443,7 @@ function AgentLoopBlock({
3457
3443
  onClick: toggleExpanded,
3458
3444
  "aria-expanded": expanded,
3459
3445
  className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
3460
- children: /* @__PURE__ */ jsxs22("span", { className: "min-w-0 flex items-center gap-2", children: [
3446
+ children: /* @__PURE__ */ jsxs23("span", { className: "min-w-0 flex items-center gap-2", children: [
3461
3447
  status === "error" ? /* @__PURE__ */ jsx25(X, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : status === "cancelled" ? /* @__PURE__ */ jsx25(Ban, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : /* @__PURE__ */ jsx25(Check, { size: 14, className: "shrink-0 text-[hsl(var(--swf-success))]" }),
3462
3448
  /* @__PURE__ */ jsx25("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: renderDescription ? renderDescription(description) : description })
3463
3449
  ] })
@@ -3494,9 +3480,9 @@ function AgentLoopBlock({
3494
3480
  ]
3495
3481
  }
3496
3482
  ),
3497
- !expanded ? /* @__PURE__ */ jsxs22(Fragment11, { children: [
3483
+ !expanded ? /* @__PURE__ */ jsxs23(Fragment11, { children: [
3498
3484
  /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
3499
- (item) => item.kind === "file" ? /* @__PURE__ */ jsxs22(
3485
+ (item) => item.kind === "file" ? /* @__PURE__ */ jsxs23(
3500
3486
  "span",
3501
3487
  {
3502
3488
  className: "inline-flex min-w-0 items-center gap-1 rounded-[6px] bg-[hsl(var(--muted))] px-2 py-0.5 text-xs font-medium text-[hsl(var(--secondary-foreground))]",
@@ -3519,10 +3505,10 @@ function AgentLoopBlock({
3519
3505
  inlineToolUiBlocks.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-2 px-4 pb-3", children: inlineToolUiBlocks.map((block) => /* @__PURE__ */ jsx25(ToolUiCard, { card: block.card, sessionId }, block.key)) }) : null
3520
3506
  ] }) : null
3521
3507
  ] }),
3522
- expanded && /* @__PURE__ */ jsxs22("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
3508
+ expanded && /* @__PURE__ */ jsxs23("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
3523
3509
  (() => {
3524
3510
  const taskPrompt = safeParsePrompt(toolCall.arguments);
3525
- return taskPrompt ? /* @__PURE__ */ jsxs22("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
3511
+ return taskPrompt ? /* @__PURE__ */ jsxs23("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
3526
3512
  /* @__PURE__ */ jsx25("summary", { className: "cursor-pointer px-3 py-1.5 text-[11px] font-medium text-[hsl(var(--muted-foreground))]", children: "\u4EFB\u52A1" }),
3527
3513
  /* @__PURE__ */ jsx25("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsx25("pre", { className: "whitespace-pre-wrap text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: taskPrompt }) })
3528
3514
  ] }) : null;
@@ -3552,7 +3538,7 @@ function AgentLoopBlock({
3552
3538
  },
3553
3539
  message.entry_id ?? `${message.timestamp ?? "error"}-${index}`
3554
3540
  ) : null
3555
- ) }) : status === "running" ? /* @__PURE__ */ jsxs22("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
3541
+ ) }) : status === "running" ? /* @__PURE__ */ jsxs23("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
3556
3542
  /* @__PURE__ */ jsx25(LoaderCircle, { size: 12, className: "mr-1.5 inline animate-spin" }),
3557
3543
  "\u6B63\u5728\u542F\u52A8..."
3558
3544
  ] }) : toolCall.result ? /* @__PURE__ */ jsx25("pre", { className: "max-h-[400px] overflow-auto px-3 py-2 whitespace-pre-wrap text-[11px] text-[hsl(var(--muted-foreground))]", children: typeof toolCall.result === "string" ? toolCall.result : JSON.stringify(toolCall.result, null, 2) }) : null
@@ -3579,8 +3565,8 @@ function ExpandedChildAssistantMessage({
3579
3565
  if (!text && !hasToolCalls && !(showReasoning && message.reasoning) && !message.blocks?.some((block) => block.type === "tool_ui")) {
3580
3566
  return null;
3581
3567
  }
3582
- return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-2", children: [
3583
- showReasoning && message.reasoning && /* @__PURE__ */ jsxs22(Reasoning, { isStreaming, children: [
3568
+ return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-2", children: [
3569
+ showReasoning && message.reasoning && /* @__PURE__ */ jsxs23(Reasoning, { isStreaming, children: [
3584
3570
  /* @__PURE__ */ jsx25(ReasoningTrigger, { wordCount: message.reasoning.length }),
3585
3571
  /* @__PURE__ */ jsx25(ReasoningContent, { children: message.reasoning })
3586
3572
  ] }),
@@ -3626,7 +3612,7 @@ function ChildText({
3626
3612
  sessionId,
3627
3613
  reasoning
3628
3614
  }) {
3629
- return /* @__PURE__ */ jsxs22("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
3615
+ return /* @__PURE__ */ jsxs23("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
3630
3616
  /* @__PURE__ */ jsx25(
3631
3617
  MarkdownContent,
3632
3618
  {
@@ -3666,7 +3652,7 @@ function getLoopCardStyles(status) {
3666
3652
  }
3667
3653
 
3668
3654
  // src/chat/WorkflowRunBlock.tsx
3669
- import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
3655
+ import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
3670
3656
  var EMPTY_ENTRIES = [];
3671
3657
  var NO_SKILLS = [];
3672
3658
  function workflowTitle(name, argumentsJson, skills) {
@@ -3768,7 +3754,7 @@ function RefTokenText({ text, refs }) {
3768
3754
  const id = match[1];
3769
3755
  const info = refs.get(id);
3770
3756
  parts.push(
3771
- /* @__PURE__ */ jsxs23(
3757
+ /* @__PURE__ */ jsxs24(
3772
3758
  "span",
3773
3759
  {
3774
3760
  title: info?.value ? info.value.slice(0, 300) : "\u5C1A\u65E0\u8F93\u51FA",
@@ -3787,9 +3773,9 @@ function RefTokenText({ text, refs }) {
3787
3773
  return /* @__PURE__ */ jsx26(Fragment12, { children: parts });
3788
3774
  }
3789
3775
  function WorkflowRunBlock({ toolCall, sessionId }) {
3790
- const run = useSessionState(sessionId, (state) => state.workflowRuns[toolCall.id]);
3791
- const agentLoops = useSessionState(sessionId, (state) => state.agentLoops);
3792
- const sessionMessages = useSessionState(sessionId, (state) => state.messages);
3776
+ const run = useSessionState(sessionId, (state2) => state2.workflowRuns[toolCall.id]);
3777
+ const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
3778
+ const sessionMessages = useSessionState(sessionId, (state2) => state2.messages);
3793
3779
  const [collapsed, setCollapsed] = useState16(false);
3794
3780
  const stepLoops = useMemo9(
3795
3781
  () => Object.entries(agentLoops).filter(([, info]) => info.workflowRunId === toolCall.id).map(([loopName, info]) => ({ loopName, info })),
@@ -3840,14 +3826,14 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3840
3826
  const status = run?.status ?? "running";
3841
3827
  const running = status === "running";
3842
3828
  const stepCount = groups.length || stepLoops.length;
3843
- const viewerRole = useSessionState(sessionId, (state) => state.viewerRole);
3829
+ const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
3844
3830
  const canListSkills = !sessionId.startsWith("share:") && viewerRole !== "viewer";
3845
3831
  const { data: sessionSkills = NO_SKILLS } = useSessionSkills(canListSkills ? sessionId : null);
3846
3832
  const title = workflowTitle(run?.name || "\u6280\u80FD", toolCall.arguments, sessionSkills);
3847
3833
  const statusSummary = running ? `\u8FDB\u884C\u4E2D \xB7 ${stepCount} \u6B65` : status === "error" ? `\u5931\u8D25 \xB7 ${stepCount} \u6B65` : status === "cancelled" ? `\u5DF2\u53D6\u6D88 \xB7 ${stepCount} \u6B65` : `\u5DF2\u5B8C\u6210 \xB7 ${stepCount} \u6B65`;
3848
3834
  const hasStepContent = groups.length > 0 || stepLoops.length > 0;
3849
- return /* @__PURE__ */ jsxs23("div", { className: "msg-animate overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]/50", children: [
3850
- /* @__PURE__ */ jsxs23(
3835
+ return /* @__PURE__ */ jsxs24("div", { className: "msg-animate overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]/50", children: [
3836
+ /* @__PURE__ */ jsxs24(
3851
3837
  "button",
3852
3838
  {
3853
3839
  type: "button",
@@ -3856,11 +3842,11 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3856
3842
  className: "flex w-full items-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--primary)/0.06)] px-4 py-2.5 text-left transition-colors hover:bg-[hsl(var(--primary)/0.1)] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
3857
3843
  children: [
3858
3844
  /* @__PURE__ */ jsx26(Zap, { size: 15, className: "shrink-0 text-violet-600" }),
3859
- /* @__PURE__ */ jsxs23("span", { className: "min-w-0 truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: [
3845
+ /* @__PURE__ */ jsxs24("span", { className: "min-w-0 truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: [
3860
3846
  "\u56FA\u5B9A\u6D41\u7A0B \xB7 ",
3861
3847
  title
3862
3848
  ] }),
3863
- /* @__PURE__ */ jsxs23("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
3849
+ /* @__PURE__ */ jsxs24("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
3864
3850
  running ? /* @__PURE__ */ jsx26(LoaderCircle, { size: 12, className: "animate-spin" }) : null,
3865
3851
  statusSummary
3866
3852
  ] }),
@@ -3877,13 +3863,13 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3877
3863
  ]
3878
3864
  }
3879
3865
  ),
3880
- !collapsed && /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-2 p-3", children: [
3866
+ !collapsed && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-2 p-3", children: [
3881
3867
  /* @__PURE__ */ jsx26(LogLines, { logs: meaningfulLogs(prelude) }),
3882
3868
  groups.map((group, index) => {
3883
3869
  const loop = groupLoops[index];
3884
3870
  const logs = meaningfulLogs(group.logs);
3885
3871
  if (loop) {
3886
- return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1", children: [
3872
+ return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
3887
3873
  /* @__PURE__ */ jsx26(
3888
3874
  AgentLoopBlock,
3889
3875
  {
@@ -3897,7 +3883,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3897
3883
  ] }, group.key);
3898
3884
  }
3899
3885
  const container = CONTAINER_LABEL[group.stepKind];
3900
- return /* @__PURE__ */ jsxs23(
3886
+ return /* @__PURE__ */ jsxs24(
3901
3887
  "div",
3902
3888
  {
3903
3889
  className: cn(
@@ -3905,7 +3891,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3905
3891
  container ? "border border-dashed border-violet-400/50 bg-violet-500/5" : "border border-[hsl(var(--border))] bg-[hsl(var(--card))]"
3906
3892
  ),
3907
3893
  children: [
3908
- /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1.5 text-sm text-[hsl(var(--foreground))]", children: [
3894
+ /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5 text-sm text-[hsl(var(--foreground))]", children: [
3909
3895
  /* @__PURE__ */ jsx26(StatusIcon, { status: stepStatus(group, status) }),
3910
3896
  container ? /* @__PURE__ */ jsx26("span", { className: "text-[11px] font-semibold text-violet-600", children: container }) : null,
3911
3897
  /* @__PURE__ */ jsx26("span", { className: "min-w-0 truncate", children: renderRefText(group.desc || group.stepId) })
@@ -3927,7 +3913,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
3927
3913
  step.loopName
3928
3914
  )),
3929
3915
  (!hasStepContent && output || status === "error" && output) && /* @__PURE__ */ jsx26("pre", { className: "max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-[hsl(var(--border))] px-3 py-2 font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: output }),
3930
- status === "done" && hasStepContent && finalOutput && /* @__PURE__ */ jsxs23("details", { className: "rounded-lg border border-[hsl(var(--border))] px-3 py-2", children: [
3916
+ status === "done" && hasStepContent && finalOutput && /* @__PURE__ */ jsxs24("details", { className: "rounded-lg border border-[hsl(var(--border))] px-3 py-2", children: [
3931
3917
  /* @__PURE__ */ jsx26("summary", { className: "cursor-pointer select-none text-xs text-[hsl(var(--muted-foreground))]", children: "\u6700\u7EC8\u8F93\u51FA" }),
3932
3918
  /* @__PURE__ */ jsx26("pre", { className: "mt-1.5 max-h-48 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: finalOutput })
3933
3919
  ] }),
@@ -3989,7 +3975,7 @@ function toolCallAnswered(toolCall, sessionStatus, answerData) {
3989
3975
  }
3990
3976
 
3991
3977
  // src/chat/AssistantTurnBlock.tsx
3992
- import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
3978
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
3993
3979
  var EMPTY_MESSAGES = [];
3994
3980
  var EMPTY_AGENT_LOOPS = {};
3995
3981
  var turnDisplayModeMemory = /* @__PURE__ */ new Map();
@@ -4185,11 +4171,11 @@ function AssistantTurnBlockBase({
4185
4171
  const displayModeMemoryKey = sessionId && firstEntryId ? `${sessionId}:${firstEntryId}` : null;
4186
4172
  const sessionMessages = useSessionState(
4187
4173
  sessionId,
4188
- (state) => hasAgentToolCall ? state.messages : EMPTY_MESSAGES
4174
+ (state2) => hasAgentToolCall ? state2.messages : EMPTY_MESSAGES
4189
4175
  );
4190
4176
  const agentLoops = useSessionState(
4191
4177
  sessionId,
4192
- (state) => hasAgentToolCall ? state.agentLoops : EMPTY_AGENT_LOOPS
4178
+ (state2) => hasAgentToolCall ? state2.agentLoops : EMPTY_AGENT_LOOPS
4193
4179
  );
4194
4180
  const turnMessages = useMemo10(
4195
4181
  () => hasAgentToolCall ? collectTurnMessages({ rootMessages: messages, sessionMessages, agentLoops }) : messages,
@@ -4304,7 +4290,7 @@ function AssistantTurnBlockBase({
4304
4290
  if (observedMemoryRefs.length > 0) setCachedMemoryRefs(observedMemoryRefs);
4305
4291
  }, [observedMemoryRefs]);
4306
4292
  const memoryRefs = observedMemoryRefs.length > 0 ? observedMemoryRefs : cachedMemoryRefs;
4307
- return /* @__PURE__ */ jsxs24(
4293
+ return /* @__PURE__ */ jsxs25(
4308
4294
  "div",
4309
4295
  {
4310
4296
  "aria-busy": isStreaming || void 0,
@@ -4318,7 +4304,7 @@ function AssistantTurnBlockBase({
4318
4304
  memoryRefs.length > 0 && /* @__PURE__ */ jsx27(MemoryRefsHint, { refs: memoryRefs }),
4319
4305
  hasInterruptedState && /* @__PURE__ */ jsx27("div", { className: "ml-4 w-fit rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--swf-warning))]", children: "\u5DF2\u4E2D\u65AD" }),
4320
4306
  hasFailedWithoutContent && /* @__PURE__ */ jsx27("div", { className: "ml-4 w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }),
4321
- hasExecutionProcess && /* @__PURE__ */ jsxs24("div", { className: "flex w-full items-start gap-2.5", children: [
4307
+ hasExecutionProcess && /* @__PURE__ */ jsxs25("div", { className: "flex w-full items-start gap-2.5", children: [
4322
4308
  /* @__PURE__ */ jsx27(
4323
4309
  "span",
4324
4310
  {
@@ -4327,8 +4313,8 @@ function AssistantTurnBlockBase({
4327
4313
  children: /* @__PURE__ */ jsx27(Bot, { size: 16 })
4328
4314
  }
4329
4315
  ),
4330
- /* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1 pt-0.5", children: [
4331
- /* @__PURE__ */ jsxs24(
4316
+ /* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1 pt-0.5", children: [
4317
+ /* @__PURE__ */ jsxs25(
4332
4318
  "button",
4333
4319
  {
4334
4320
  type: "button",
@@ -4370,7 +4356,7 @@ function AssistantTurnBlockBase({
4370
4356
  /* @__PURE__ */ jsx27("div", { className: "mt-3 h-px w-full bg-[hsl(var(--border)/0.75)]" })
4371
4357
  ] })
4372
4358
  ] }),
4373
- hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */ jsxs24("div", { className: "ml-10 flex flex-col gap-1", children: [
4359
+ hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */ jsxs25("div", { className: "ml-10 flex flex-col gap-1", children: [
4374
4360
  /* @__PURE__ */ jsx27(
4375
4361
  AssistantMessages,
4376
4362
  {
@@ -4600,12 +4586,12 @@ function AssistantMessages({
4600
4586
  );
4601
4587
  const hasToolCalls = toolCalls.length > 0;
4602
4588
  const orderedParts = getOrderedMessageParts(message, toolCalls);
4603
- return /* @__PURE__ */ jsxs24(
4589
+ return /* @__PURE__ */ jsxs25(
4604
4590
  "div",
4605
4591
  {
4606
4592
  className: "flex flex-col gap-1",
4607
4593
  children: [
4608
- showReasoning && /* @__PURE__ */ jsxs24(
4594
+ showReasoning && /* @__PURE__ */ jsxs25(
4609
4595
  Reasoning,
4610
4596
  {
4611
4597
  isStreaming: isReasoningStreamingLastMessage,
@@ -4714,7 +4700,7 @@ function CompactToolGroupBlock({
4714
4700
  level,
4715
4701
  customization
4716
4702
  }) {
4717
- return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
4703
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
4718
4704
  toolCalls.map((toolCall) => {
4719
4705
  if (isWorkflowRunToolName2(toolCall.name)) return null;
4720
4706
  const CustomToolCall = customization?.components?.ToolCall;
@@ -4775,7 +4761,7 @@ function AssistantMessageContent({
4775
4761
  if (!text && imageParts.length === 0 && fileParts.length === 0 && !reasoning && !failed) {
4776
4762
  return null;
4777
4763
  }
4778
- return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3", children: [
4764
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3", children: [
4779
4765
  failed ? /* @__PURE__ */ jsx27("div", { className: "w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }) : null,
4780
4766
  imageParts.length > 0 && /* @__PURE__ */ jsx27("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx27(
4781
4767
  MessageImage,
@@ -4824,7 +4810,7 @@ function AssistantText({
4824
4810
  () => ({ sessionId, messageId, sendMessage }),
4825
4811
  [sessionId, messageId, sendMessage]
4826
4812
  );
4827
- return /* @__PURE__ */ jsxs24(
4813
+ return /* @__PURE__ */ jsxs25(
4828
4814
  "div",
4829
4815
  {
4830
4816
  part: "assistant-text",
@@ -4859,13 +4845,13 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
4859
4845
  const memoriesHref = useChatEnvironment().memoriesHref;
4860
4846
  const hasSkill = refs.some((r) => r.skill_name);
4861
4847
  const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
4862
- return /* @__PURE__ */ jsxs24(
4848
+ return /* @__PURE__ */ jsxs25(
4863
4849
  "div",
4864
4850
  {
4865
4851
  part: "memory-refs",
4866
4852
  className: cn("blade-chat-memory-refs relative z-[1] ml-1 w-[calc(100%-0.25rem)] max-w-[680px] self-start", className),
4867
4853
  children: [
4868
- /* @__PURE__ */ jsxs24(
4854
+ /* @__PURE__ */ jsxs25(
4869
4855
  "button",
4870
4856
  {
4871
4857
  type: "button",
@@ -4873,7 +4859,7 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
4873
4859
  className: "inline-flex h-8 items-center gap-1.5 rounded-lg border border-[hsl(var(--primary)/0.22)] bg-[hsl(var(--primary)/0.07)] px-3 text-xs font-medium text-[hsl(var(--primary))] transition-colors hover:bg-[hsl(var(--primary)/0.12)]",
4874
4860
  children: [
4875
4861
  /* @__PURE__ */ jsx27(BookOpen, { size: 12 }),
4876
- /* @__PURE__ */ jsxs24("span", { children: [
4862
+ /* @__PURE__ */ jsxs25("span", { children: [
4877
4863
  label,
4878
4864
  "\uFF08",
4879
4865
  refs.length,
@@ -4889,8 +4875,8 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
4889
4875
  ]
4890
4876
  }
4891
4877
  ),
4892
- expanded && /* @__PURE__ */ jsxs24("div", { className: "mt-2 flex flex-col gap-2 rounded-xl border border-[hsl(var(--border)/0.8)] bg-[hsl(var(--muted)/0.28)] p-2.5", children: [
4893
- refs.map((ref) => /* @__PURE__ */ jsxs24(
4878
+ expanded && /* @__PURE__ */ jsxs25("div", { className: "mt-2 flex flex-col gap-2 rounded-xl border border-[hsl(var(--border)/0.8)] bg-[hsl(var(--muted)/0.28)] p-2.5", children: [
4879
+ refs.map((ref) => /* @__PURE__ */ jsxs25(
4894
4880
  "div",
4895
4881
  {
4896
4882
  className: "rounded-lg border border-[hsl(var(--border)/0.55)] bg-[hsl(var(--background)/0.72)] px-3 py-2.5",
@@ -4901,7 +4887,7 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
4901
4887
  },
4902
4888
  ref.id
4903
4889
  )),
4904
- memoriesHref ? /* @__PURE__ */ jsxs24(
4890
+ memoriesHref ? /* @__PURE__ */ jsxs25(
4905
4891
  "a",
4906
4892
  {
4907
4893
  href: memoriesHref,
@@ -5379,15 +5365,15 @@ import {
5379
5365
  getContextDisplayState,
5380
5366
  getContextGroupDisplayState
5381
5367
  } from "@blade-hq/agent-client/internal";
5382
- import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
5368
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
5383
5369
  function ContextCard({ context, className }) {
5384
5370
  const display = getContextDisplayState(context);
5385
- return /* @__PURE__ */ jsxs25(
5371
+ return /* @__PURE__ */ jsxs26(
5386
5372
  "details",
5387
5373
  {
5388
5374
  className: `blade-chat-context-card group/context-card overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
5389
5375
  children: [
5390
- /* @__PURE__ */ jsxs25("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
5376
+ /* @__PURE__ */ jsxs26("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
5391
5377
  /* @__PURE__ */ jsx28(
5392
5378
  Layers,
5393
5379
  {
@@ -5396,7 +5382,7 @@ function ContextCard({ context, className }) {
5396
5382
  "aria-hidden": "true"
5397
5383
  }
5398
5384
  ),
5399
- /* @__PURE__ */ jsxs25("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
5385
+ /* @__PURE__ */ jsxs26("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
5400
5386
  /* @__PURE__ */ jsx28("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
5401
5387
  /* @__PURE__ */ jsx28("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
5402
5388
  ] }),
@@ -5418,8 +5404,8 @@ function ContextGroupCard({ contexts, className }) {
5418
5404
  if (contexts.length === 0) return null;
5419
5405
  const single = contexts.length === 1 ? getContextDisplayState(contexts[0]) : null;
5420
5406
  const group = single ? null : getContextGroupDisplayState(contexts);
5421
- return /* @__PURE__ */ jsxs25("details", { className: `blade-chat-context-card group/context-group overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`, children: [
5422
- /* @__PURE__ */ jsxs25("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
5407
+ return /* @__PURE__ */ jsxs26("details", { className: `blade-chat-context-card group/context-group overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`, children: [
5408
+ /* @__PURE__ */ jsxs26("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
5423
5409
  /* @__PURE__ */ jsx28(
5424
5410
  Layers,
5425
5411
  {
@@ -5428,7 +5414,7 @@ function ContextGroupCard({ contexts, className }) {
5428
5414
  "aria-hidden": "true"
5429
5415
  }
5430
5416
  ),
5431
- /* @__PURE__ */ jsxs25("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
5417
+ /* @__PURE__ */ jsxs26("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
5432
5418
  /* @__PURE__ */ jsx28("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: single ? single.title : `${group?.title} \xB7 ${group?.count} \u9879` }),
5433
5419
  /* @__PURE__ */ jsx28("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: single ? single.summary : group?.summary })
5434
5420
  ] }),
@@ -5453,7 +5439,7 @@ function ContextGroupCard({ contexts, className }) {
5453
5439
 
5454
5440
  // src/chat/ResultFeedback.tsx
5455
5441
  import { useCallback as useCallback6, useEffect as useEffect15, useRef as useRef12, useState as useState18 } from "react";
5456
- import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
5442
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
5457
5443
  var REASONS = [
5458
5444
  { value: "not_solved", label: "\u6CA1\u89E3\u51B3\u95EE\u9898" },
5459
5445
  { value: "inaccurate", label: "\u5185\u5BB9\u4E0D\u51C6\u786E" },
@@ -5467,17 +5453,17 @@ function reasonLabel(reason) {
5467
5453
  }
5468
5454
  function HistoricalResultFeedback({ feedback }) {
5469
5455
  const label = reasonLabel(feedback.reason);
5470
- return /* @__PURE__ */ jsxs26(
5456
+ return /* @__PURE__ */ jsxs27(
5471
5457
  "section",
5472
5458
  {
5473
5459
  "aria-label": "\u5386\u53F2\u7ED3\u679C\u53CD\u9988",
5474
5460
  className: "w-fit max-w-full rounded-lg border border-[hsl(var(--border)/0.7)] bg-[hsl(var(--muted)/0.2)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
5475
5461
  children: [
5476
- /* @__PURE__ */ jsxs26("span", { children: [
5462
+ /* @__PURE__ */ jsxs27("span", { children: [
5477
5463
  "\u4F60\u5BF9\u6B64\u8F6E\u7ED3\u679C\u7684\u8BC4\u4EF7\uFF1A",
5478
5464
  feedback.helpful ? "\u6709\u5E2E\u52A9" : "\u6CA1\u5E2E\u52A9"
5479
5465
  ] }),
5480
- label ? /* @__PURE__ */ jsxs26("span", { children: [
5466
+ label ? /* @__PURE__ */ jsxs27("span", { children: [
5481
5467
  " \xB7 ",
5482
5468
  label
5483
5469
  ] }) : null
@@ -5552,14 +5538,14 @@ function ResultFeedback({
5552
5538
  [client, emit, followup.assistant_entry_id, onSaved, sessionId]
5553
5539
  );
5554
5540
  if (!visible) return null;
5555
- return /* @__PURE__ */ jsxs26(
5541
+ return /* @__PURE__ */ jsxs27(
5556
5542
  "section",
5557
5543
  {
5558
5544
  "aria-label": "\u7ED3\u679C\u53CD\u9988",
5559
5545
  className: "flex flex-col gap-2 border-t border-[hsl(var(--border)/0.7)] pt-3",
5560
5546
  children: [
5561
5547
  /* @__PURE__ */ jsx29("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u76EE\u524D\u7684\u6574\u4F53\u7ED3\u679C\u6709\u5E2E\u52A9\u5417\uFF1F" }),
5562
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap gap-1.5", children: [
5548
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap gap-1.5", children: [
5563
5549
  /* @__PURE__ */ jsx29(
5564
5550
  "button",
5565
5551
  {
@@ -5595,7 +5581,7 @@ function ResultFeedback({
5595
5581
  },
5596
5582
  reason.value
5597
5583
  )) }) : null,
5598
- saveError ? /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
5584
+ saveError ? /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
5599
5585
  /* @__PURE__ */ jsx29("span", { children: "\u53CD\u9988\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u91CD\u8BD5" }),
5600
5586
  /* @__PURE__ */ jsx29(
5601
5587
  "button",
@@ -5616,7 +5602,7 @@ function ResultFeedback({
5616
5602
  }
5617
5603
 
5618
5604
  // src/chat/LiteMessageList.tsx
5619
- import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
5605
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
5620
5606
  var LITE_LOADING_INDICATOR_HEIGHT = 38;
5621
5607
  function messageText(message) {
5622
5608
  return getTextContent3(normalizeMessageContent2(message.content)).trim();
@@ -5649,6 +5635,8 @@ function buildLiteRows({
5649
5635
  let turnMessages = [];
5650
5636
  const followupMatchesBlock = block.type === "assistant_turn" && followup != null && block.messages.some((message) => message.entry_id === followup.assistant_entry_id);
5651
5637
  if (block.type === "message") {
5638
+ const sourceTitle = packEventTitle(block.message);
5639
+ if (sourceTitle) rows.push({ type: "pack-event", key: `${block.key}:pack-event`, title: sourceTitle });
5652
5640
  if (isBackgroundWakeMessage2(block.message)) {
5653
5641
  rows.push({ type: "background-wakeup", key: block.message.render_id ?? block.key });
5654
5642
  continue;
@@ -5805,8 +5793,8 @@ function LiteMessageList({
5805
5793
  };
5806
5794
  }, [onLoadOlder, historyLoadRevision]);
5807
5795
  const showContexts = false;
5808
- const agentLoops = useSessionState(sessionId, (state) => state.agentLoops);
5809
- const askAnswers = useSessionState(sessionId, (state) => state.askAnswers);
5796
+ const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
5797
+ const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
5810
5798
  const rows = useMemo11(
5811
5799
  () => buildLiteRows({
5812
5800
  messages,
@@ -5850,7 +5838,7 @@ function LiteMessageList({
5850
5838
  });
5851
5839
  const totalSize = virtualizer.getTotalSize();
5852
5840
  const latestSignature = rows.map(
5853
- (row) => row.type === "text" ? `${row.key}:${row.text.length}` : row.type === "question" ? `${row.key}:${row.toolCall.status ?? ""}` : row.type === "tool-description" ? `${row.key}:${row.running ? 1 : 0}` : row.type === "context-group" ? `${row.key}:${row.contexts.length}:${row.contexts.at(-1)?.context_revision ?? ""}` : row.type === "context-divider" || row.type === "background-wakeup" ? row.key : row.type === "historical-feedback" ? `${row.key}:${row.feedback.updated_at}` : row.type === "memory-refs" ? `${row.key}:${row.refs.length}` : `${row.key}:${row.followup.suggestions.length}:${row.followup.final_artifacts?.length ?? 0}`
5841
+ (row) => row.type === "text" ? `${row.key}:${row.text.length}` : row.type === "question" ? `${row.key}:${row.toolCall.status ?? ""}` : row.type === "tool-description" ? `${row.key}:${row.running ? 1 : 0}` : row.type === "context-group" ? `${row.key}:${row.contexts.length}:${row.contexts.at(-1)?.context_revision ?? ""}` : row.type === "context-divider" || row.type === "background-wakeup" || row.type === "pack-event" ? row.key : row.type === "historical-feedback" ? `${row.key}:${row.feedback.updated_at}` : row.type === "memory-refs" ? `${row.key}:${row.refs.length}` : `${row.key}:${row.followup.suggestions.length}:${row.followup.final_artifacts?.length ?? 0}`
5854
5842
  ).join("|");
5855
5843
  const getScrollElement = useCallback7(() => scrollRef.current, []);
5856
5844
  const getTargetElement = useCallback7(() => {
@@ -5904,7 +5892,7 @@ function LiteMessageList({
5904
5892
  },
5905
5893
  []
5906
5894
  );
5907
- return /* @__PURE__ */ jsxs27(
5895
+ return /* @__PURE__ */ jsxs28(
5908
5896
  "div",
5909
5897
  {
5910
5898
  ref: scrollRef,
@@ -5918,7 +5906,7 @@ function LiteMessageList({
5918
5906
  },
5919
5907
  className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-6 sm:px-8",
5920
5908
  children: [
5921
- rows.length === 0 ? /* @__PURE__ */ jsx30("div", { className: "grid min-h-full place-items-center text-sm text-[hsl(var(--muted-foreground))]", children: isLoadingHistory ? "\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026" : "\u5F00\u59CB\u65B0\u7684\u5BF9\u8BDD\u5427" }) : /* @__PURE__ */ jsxs27(
5909
+ rows.length === 0 ? /* @__PURE__ */ jsx30("div", { className: "grid min-h-full place-items-center text-sm text-[hsl(var(--muted-foreground))]", children: isLoadingHistory ? "\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026" : "\u5F00\u59CB\u65B0\u7684\u5BF9\u8BDD\u5427" }) : /* @__PURE__ */ jsxs28(
5922
5910
  "div",
5923
5911
  {
5924
5912
  className: "relative mx-auto w-full max-w-3xl",
@@ -5937,7 +5925,7 @@ function LiteMessageList({
5937
5925
  "data-lite-row-key": row.key,
5938
5926
  className: "absolute left-0 top-0 w-full pb-5",
5939
5927
  style: { transform: `translateY(${virtualRow.start}px)` },
5940
- children: row.type === "text" ? /* @__PURE__ */ jsx30(PlainTextMessage, { row, sessionId }) : row.type === "background-wakeup" ? /* @__PURE__ */ jsx30(BackgroundWakeNotice, {}) : row.type === "memory-refs" ? /* @__PURE__ */ jsx30(MemoryRefsHint, { refs: row.refs }) : row.type === "question" ? /* @__PURE__ */ jsx30(
5928
+ children: row.type === "text" ? /* @__PURE__ */ jsx30(PlainTextMessage, { row, sessionId }) : row.type === "background-wakeup" ? /* @__PURE__ */ jsx30(BackgroundWakeNotice, {}) : row.type === "pack-event" ? /* @__PURE__ */ jsx30(PackEventNotice, { title: row.title }) : row.type === "memory-refs" ? /* @__PURE__ */ jsx30(MemoryRefsHint, { refs: row.refs }) : row.type === "question" ? /* @__PURE__ */ jsx30(
5941
5929
  ToolCallBlock,
5942
5930
  {
5943
5931
  toolCall: row.toolCall,
@@ -6006,7 +5994,7 @@ function PlainTextMessage({
6006
5994
  if (row.role === "user") {
6007
5995
  return /* @__PURE__ */ jsx30("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx30("div", { className: `max-w-[82%] rounded-[24px] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-base leading-[1.7] transition-colors duration-200 ${row.sending ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--user-msg-fg))]"}`, children: markdown }) });
6008
5996
  }
6009
- return /* @__PURE__ */ jsxs27(
5997
+ return /* @__PURE__ */ jsxs28(
6010
5998
  "div",
6011
5999
  {
6012
6000
  className: `break-words text-sm leading-6 ${row.role === "error" ? "text-[hsl(var(--destructive))]" : "text-[hsl(var(--foreground))]"}`,
@@ -6038,11 +6026,11 @@ function LiteFollowup({
6038
6026
  setDownloadingPath(null);
6039
6027
  }
6040
6028
  };
6041
- return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col items-start gap-3", children: [
6042
- artifacts.length > 0 ? /* @__PURE__ */ jsxs27("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
6029
+ return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col items-start gap-3", children: [
6030
+ artifacts.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
6043
6031
  /* @__PURE__ */ jsx30("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u672C\u8F6E\u6210\u679C" }),
6044
6032
  artifacts.map(
6045
- (artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsxs27(
6033
+ (artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsxs28(
6046
6034
  "a",
6047
6035
  {
6048
6036
  href: artifact.target,
@@ -6055,7 +6043,7 @@ function LiteFollowup({
6055
6043
  ]
6056
6044
  },
6057
6045
  `${artifact.kind}:${artifactIndex}`
6058
- ) : /* @__PURE__ */ jsxs27(
6046
+ ) : /* @__PURE__ */ jsxs28(
6059
6047
  "button",
6060
6048
  {
6061
6049
  type: "button",
@@ -6075,9 +6063,9 @@ function LiteFollowup({
6075
6063
  )
6076
6064
  )
6077
6065
  ] }) : null,
6078
- followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs27("div", { className: "flex max-w-full flex-col items-start gap-1.5", children: [
6066
+ followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "flex max-w-full flex-col items-start gap-1.5", children: [
6079
6067
  /* @__PURE__ */ jsx30("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
6080
- followup.suggestions.map((suggestion) => /* @__PURE__ */ jsxs27(
6068
+ followup.suggestions.map((suggestion) => /* @__PURE__ */ jsxs28(
6081
6069
  "button",
6082
6070
  {
6083
6071
  type: "button",
@@ -6111,11 +6099,11 @@ function LiteFollowup({
6111
6099
  import { isBackgroundWakeMessage as isBackgroundWakeMessage3 } from "@blade-hq/agent-client/internal";
6112
6100
  import {
6113
6101
  useCallback as useCallback13,
6114
- useEffect as useEffect23,
6102
+ useEffect as useEffect24,
6115
6103
  useLayoutEffect as useLayoutEffect5,
6116
6104
  useMemo as useMemo15,
6117
6105
  useRef as useRef21,
6118
- useState as useState26
6106
+ useState as useState27
6119
6107
  } from "react";
6120
6108
 
6121
6109
  // ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
@@ -6173,14 +6161,14 @@ var useStickToBottom = (options = {}) => {
6173
6161
  return range.commonAncestorContainer.contains(scrollRef.current) || scrollRef.current?.contains(range.commonAncestorContainer);
6174
6162
  }, []);
6175
6163
  const setIsAtBottom = useCallback8((isAtBottom2) => {
6176
- state.isAtBottom = isAtBottom2;
6164
+ state2.isAtBottom = isAtBottom2;
6177
6165
  updateIsAtBottom(isAtBottom2);
6178
6166
  }, []);
6179
6167
  const setEscapedFromLock = useCallback8((escapedFromLock2) => {
6180
- state.escapedFromLock = escapedFromLock2;
6168
+ state2.escapedFromLock = escapedFromLock2;
6181
6169
  updateEscapedFromLock(escapedFromLock2);
6182
6170
  }, []);
6183
- const state = useMemo12(() => {
6171
+ const state2 = useMemo12(() => {
6184
6172
  let lastCalculation;
6185
6173
  return {
6186
6174
  escapedFromLock,
@@ -6195,7 +6183,7 @@ var useStickToBottom = (options = {}) => {
6195
6183
  set scrollTop(scrollTop) {
6196
6184
  if (scrollRef.current) {
6197
6185
  scrollRef.current.scrollTop = scrollTop;
6198
- state.ignoreScrollToTop = scrollRef.current.scrollTop;
6186
+ state2.ignoreScrollToTop = scrollRef.current.scrollTop;
6199
6187
  }
6200
6188
  },
6201
6189
  get targetScrollTop() {
@@ -6244,7 +6232,7 @@ var useStickToBottom = (options = {}) => {
6244
6232
  const behavior = mergeAnimations(optionsRef.current, scrollOptions.animation);
6245
6233
  const { ignoreEscapes = false } = scrollOptions;
6246
6234
  let durationElapsed;
6247
- let startTarget = state.calculatedTargetScrollTop;
6235
+ let startTarget = state2.calculatedTargetScrollTop;
6248
6236
  if (scrollOptions.duration instanceof Promise) {
6249
6237
  scrollOptions.duration.finally(() => {
6250
6238
  durationElapsed = Date.now();
@@ -6254,16 +6242,16 @@ var useStickToBottom = (options = {}) => {
6254
6242
  }
6255
6243
  const next = async () => {
6256
6244
  const promise = new Promise(requestAnimationFrame).then(() => {
6257
- if (!state.isAtBottom) {
6258
- state.animation = void 0;
6245
+ if (!state2.isAtBottom) {
6246
+ state2.animation = void 0;
6259
6247
  return false;
6260
6248
  }
6261
- const { scrollTop } = state;
6249
+ const { scrollTop } = state2;
6262
6250
  const tick = performance.now();
6263
- const tickDelta = (tick - (state.lastTick ?? tick)) / SIXTY_FPS_INTERVAL_MS;
6264
- state.animation || (state.animation = { behavior, promise, ignoreEscapes });
6265
- if (state.animation.behavior === behavior) {
6266
- state.lastTick = tick;
6251
+ const tickDelta = (tick - (state2.lastTick ?? tick)) / SIXTY_FPS_INTERVAL_MS;
6252
+ state2.animation || (state2.animation = { behavior, promise, ignoreEscapes });
6253
+ if (state2.animation.behavior === behavior) {
6254
+ state2.lastTick = tick;
6267
6255
  }
6268
6256
  if (isSelecting()) {
6269
6257
  return next();
@@ -6271,53 +6259,53 @@ var useStickToBottom = (options = {}) => {
6271
6259
  if (waitElapsed > Date.now()) {
6272
6260
  return next();
6273
6261
  }
6274
- if (scrollTop < Math.min(startTarget, state.calculatedTargetScrollTop)) {
6275
- if (state.animation?.behavior === behavior) {
6262
+ if (scrollTop < Math.min(startTarget, state2.calculatedTargetScrollTop)) {
6263
+ if (state2.animation?.behavior === behavior) {
6276
6264
  if (behavior === "instant") {
6277
- state.scrollTop = state.calculatedTargetScrollTop;
6265
+ state2.scrollTop = state2.calculatedTargetScrollTop;
6278
6266
  return next();
6279
6267
  }
6280
- state.velocity = (behavior.damping * state.velocity + behavior.stiffness * state.scrollDifference) / behavior.mass;
6281
- state.accumulated += state.velocity * tickDelta;
6282
- state.scrollTop += state.accumulated;
6283
- if (state.scrollTop !== scrollTop) {
6284
- state.accumulated = 0;
6268
+ state2.velocity = (behavior.damping * state2.velocity + behavior.stiffness * state2.scrollDifference) / behavior.mass;
6269
+ state2.accumulated += state2.velocity * tickDelta;
6270
+ state2.scrollTop += state2.accumulated;
6271
+ if (state2.scrollTop !== scrollTop) {
6272
+ state2.accumulated = 0;
6285
6273
  }
6286
6274
  }
6287
6275
  return next();
6288
6276
  }
6289
6277
  if (durationElapsed > Date.now()) {
6290
- startTarget = state.calculatedTargetScrollTop;
6278
+ startTarget = state2.calculatedTargetScrollTop;
6291
6279
  return next();
6292
6280
  }
6293
- state.animation = void 0;
6294
- if (state.scrollTop < state.calculatedTargetScrollTop) {
6281
+ state2.animation = void 0;
6282
+ if (state2.scrollTop < state2.calculatedTargetScrollTop) {
6295
6283
  return scrollToBottom({
6296
6284
  animation: mergeAnimations(optionsRef.current, optionsRef.current.resize),
6297
6285
  ignoreEscapes,
6298
6286
  duration: Math.max(0, durationElapsed - Date.now()) || void 0
6299
6287
  });
6300
6288
  }
6301
- return state.isAtBottom;
6289
+ return state2.isAtBottom;
6302
6290
  });
6303
6291
  return promise.then((isAtBottom2) => {
6304
6292
  requestAnimationFrame(() => {
6305
- if (!state.animation) {
6306
- state.lastTick = void 0;
6307
- state.velocity = 0;
6293
+ if (!state2.animation) {
6294
+ state2.lastTick = void 0;
6295
+ state2.velocity = 0;
6308
6296
  }
6309
6297
  });
6310
6298
  return isAtBottom2;
6311
6299
  });
6312
6300
  };
6313
6301
  if (scrollOptions.wait !== true) {
6314
- state.animation = void 0;
6302
+ state2.animation = void 0;
6315
6303
  }
6316
- if (state.animation?.behavior === behavior) {
6317
- return state.animation.promise;
6304
+ if (state2.animation?.behavior === behavior) {
6305
+ return state2.animation.promise;
6318
6306
  }
6319
6307
  return next();
6320
- }, [setIsAtBottom, isSelecting, state]);
6308
+ }, [setIsAtBottom, isSelecting, state2]);
6321
6309
  const stopScroll = useCallback8(() => {
6322
6310
  setEscapedFromLock(true);
6323
6311
  setIsAtBottom(false);
@@ -6326,16 +6314,16 @@ var useStickToBottom = (options = {}) => {
6326
6314
  if (target !== scrollRef.current) {
6327
6315
  return;
6328
6316
  }
6329
- const { scrollTop, ignoreScrollToTop } = state;
6330
- let { lastScrollTop = scrollTop } = state;
6331
- state.lastScrollTop = scrollTop;
6332
- state.ignoreScrollToTop = void 0;
6317
+ const { scrollTop, ignoreScrollToTop } = state2;
6318
+ let { lastScrollTop = scrollTop } = state2;
6319
+ state2.lastScrollTop = scrollTop;
6320
+ state2.ignoreScrollToTop = void 0;
6333
6321
  if (ignoreScrollToTop && ignoreScrollToTop > scrollTop) {
6334
6322
  lastScrollTop = ignoreScrollToTop;
6335
6323
  }
6336
- setIsNearBottom(state.isNearBottom);
6324
+ setIsNearBottom(state2.isNearBottom);
6337
6325
  setTimeout(() => {
6338
- if (state.resizeDifference || scrollTop === ignoreScrollToTop) {
6326
+ if (state2.resizeDifference || scrollTop === ignoreScrollToTop) {
6339
6327
  return;
6340
6328
  }
6341
6329
  if (isSelecting()) {
@@ -6345,8 +6333,8 @@ var useStickToBottom = (options = {}) => {
6345
6333
  }
6346
6334
  const isScrollingDown = scrollTop > lastScrollTop;
6347
6335
  const isScrollingUp = scrollTop < lastScrollTop;
6348
- if (state.animation?.ignoreEscapes) {
6349
- state.scrollTop = lastScrollTop;
6336
+ if (state2.animation?.ignoreEscapes) {
6337
+ state2.scrollTop = lastScrollTop;
6350
6338
  return;
6351
6339
  }
6352
6340
  if (isScrollingUp) {
@@ -6356,11 +6344,11 @@ var useStickToBottom = (options = {}) => {
6356
6344
  if (isScrollingDown) {
6357
6345
  setEscapedFromLock(false);
6358
6346
  }
6359
- if (!state.escapedFromLock && state.isNearBottom) {
6347
+ if (!state2.escapedFromLock && state2.isNearBottom) {
6360
6348
  setIsAtBottom(true);
6361
6349
  }
6362
6350
  }, 1);
6363
- }, [setEscapedFromLock, setIsAtBottom, isSelecting, state]);
6351
+ }, [setEscapedFromLock, setIsAtBottom, isSelecting, state2]);
6364
6352
  const handleWheel = useCallback8(({ target, deltaY }) => {
6365
6353
  let element = target;
6366
6354
  while (!["scroll", "auto"].includes(getComputedStyle(element).overflow)) {
@@ -6369,11 +6357,11 @@ var useStickToBottom = (options = {}) => {
6369
6357
  }
6370
6358
  element = element.parentElement;
6371
6359
  }
6372
- if (element === scrollRef.current && deltaY < 0 && scrollRef.current.scrollHeight > scrollRef.current.clientHeight && !state.animation?.ignoreEscapes) {
6360
+ if (element === scrollRef.current && deltaY < 0 && scrollRef.current.scrollHeight > scrollRef.current.clientHeight && !state2.animation?.ignoreEscapes) {
6373
6361
  setEscapedFromLock(true);
6374
6362
  setIsAtBottom(false);
6375
6363
  }
6376
- }, [setEscapedFromLock, setIsAtBottom, state]);
6364
+ }, [setEscapedFromLock, setIsAtBottom, state2]);
6377
6365
  const scrollRef = useRefCallback((scroll) => {
6378
6366
  scrollRef.current?.removeEventListener("scroll", handleScroll);
6379
6367
  scrollRef.current?.removeEventListener("wheel", handleWheel);
@@ -6381,19 +6369,19 @@ var useStickToBottom = (options = {}) => {
6381
6369
  scroll?.addEventListener("wheel", handleWheel, { passive: true });
6382
6370
  }, []);
6383
6371
  const contentRef = useRefCallback((content) => {
6384
- state.resizeObserver?.disconnect();
6372
+ state2.resizeObserver?.disconnect();
6385
6373
  if (!content) {
6386
6374
  return;
6387
6375
  }
6388
6376
  let previousHeight;
6389
- state.resizeObserver = new ResizeObserver(([entry]) => {
6377
+ state2.resizeObserver = new ResizeObserver(([entry]) => {
6390
6378
  const { height } = entry.contentRect;
6391
6379
  const difference = height - (previousHeight ?? height);
6392
- state.resizeDifference = difference;
6393
- if (state.scrollTop > state.targetScrollTop) {
6394
- state.scrollTop = state.targetScrollTop;
6380
+ state2.resizeDifference = difference;
6381
+ if (state2.scrollTop > state2.targetScrollTop) {
6382
+ state2.scrollTop = state2.targetScrollTop;
6395
6383
  }
6396
- setIsNearBottom(state.isNearBottom);
6384
+ setIsNearBottom(state2.isNearBottom);
6397
6385
  if (difference >= 0) {
6398
6386
  const animation = mergeAnimations(optionsRef.current, previousHeight ? optionsRef.current.resize : optionsRef.current.initial);
6399
6387
  scrollToBottom({
@@ -6403,7 +6391,7 @@ var useStickToBottom = (options = {}) => {
6403
6391
  duration: animation === "instant" ? void 0 : RETAIN_ANIMATION_DURATION_MS
6404
6392
  });
6405
6393
  } else {
6406
- if (state.isNearBottom) {
6394
+ if (state2.isNearBottom) {
6407
6395
  setEscapedFromLock(false);
6408
6396
  setIsAtBottom(true);
6409
6397
  }
@@ -6411,13 +6399,13 @@ var useStickToBottom = (options = {}) => {
6411
6399
  previousHeight = height;
6412
6400
  requestAnimationFrame(() => {
6413
6401
  setTimeout(() => {
6414
- if (state.resizeDifference === difference) {
6415
- state.resizeDifference = 0;
6402
+ if (state2.resizeDifference === difference) {
6403
+ state2.resizeDifference = 0;
6416
6404
  }
6417
6405
  }, 1);
6418
6406
  });
6419
6407
  });
6420
- state.resizeObserver?.observe(content);
6408
+ state2.resizeObserver?.observe(content);
6421
6409
  }, []);
6422
6410
  return {
6423
6411
  contentRef,
@@ -6427,7 +6415,7 @@ var useStickToBottom = (options = {}) => {
6427
6415
  isAtBottom: isAtBottom || isNearBottom,
6428
6416
  isNearBottom,
6429
6417
  escapedFromLock,
6430
- state
6418
+ state: state2
6431
6419
  };
6432
6420
  };
6433
6421
  function useRefCallback(callback, deps) {
@@ -6480,7 +6468,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
6480
6468
  initial,
6481
6469
  targetScrollTop
6482
6470
  });
6483
- const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state } = instance ?? defaultInstance;
6471
+ const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state: state2 } = instance ?? defaultInstance;
6484
6472
  const context = useMemo13(() => ({
6485
6473
  scrollToBottom,
6486
6474
  stopScroll,
@@ -6488,7 +6476,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
6488
6476
  isAtBottom,
6489
6477
  escapedFromLock,
6490
6478
  contentRef,
6491
- state,
6479
+ state: state2,
6492
6480
  get targetScrollTop() {
6493
6481
  return customTargetScrollTop.current;
6494
6482
  },
@@ -6502,7 +6490,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
6502
6490
  scrollRef,
6503
6491
  stopScroll,
6504
6492
  escapedFromLock,
6505
- state
6493
+ state2
6506
6494
  ]);
6507
6495
  useImperativeHandle(contextRef, () => context, [context]);
6508
6496
  useIsomorphicLayoutEffect(() => {
@@ -6542,6 +6530,9 @@ function useStickToBottomContext() {
6542
6530
  return context;
6543
6531
  }
6544
6532
 
6533
+ // src/chat/MessageList.tsx
6534
+ import { packEventTitle as packEventTitle2 } from "@blade-hq/agent-client/internal";
6535
+
6545
6536
  // src/hooks/use-turn-navigation.ts
6546
6537
  import {
6547
6538
  getTextContent as getTextContent4,
@@ -6678,7 +6669,17 @@ function useTurnNavigation({
6678
6669
  setIndex({ sessionId, items: keep });
6679
6670
  load2().then((items) => {
6680
6671
  if (seq2 !== indexSeq.current) return;
6681
- const navItems = items.map((item) => ({ id: item.entryId, title: item.preview }));
6672
+ const navItems = items.map((item) => ({
6673
+ id: item.entryId,
6674
+ title: item.preview,
6675
+ recaption: item.recaption,
6676
+ artifacts: item.artifacts,
6677
+ entries: item.entries?.map((entry) => ({
6678
+ id: entry.entryId,
6679
+ title: entry.preview,
6680
+ answer: entry.answer
6681
+ }))
6682
+ }));
6682
6683
  indexRef.current = { sessionId, items: navItems };
6683
6684
  setIndex({ sessionId, items: navItems });
6684
6685
  }).catch(() => {
@@ -6820,10 +6821,10 @@ function initialRevealState(targetText, isLive, resetKey) {
6820
6821
  };
6821
6822
  }
6822
6823
  function useTypewriterReveal(targetText, isLive, resetKey) {
6823
- const [state, setState] = useState22(() => initialRevealState(targetText, isLive, resetKey));
6824
+ const [state2, setState2] = useState22(() => initialRevealState(targetText, isLive, resetKey));
6824
6825
  const targetTextRef = useRef17(targetText);
6825
6826
  targetTextRef.current = targetText;
6826
- const revealedLenRef = useRef17(state.revealedLen);
6827
+ const revealedLenRef = useRef17(state2.revealedLen);
6827
6828
  const priorTargetLenRef = useRef17(targetText.length);
6828
6829
  const emaCpsRef = useRef17(REVEAL_INITIAL_CPS);
6829
6830
  const lastTickTsRef = useRef17(null);
@@ -6837,9 +6838,9 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
6837
6838
  stopTicking();
6838
6839
  revealedLenRef.current = targetTextRef.current.length;
6839
6840
  priorTargetLenRef.current = targetTextRef.current.length;
6840
- setState((s) => ({ ...s, displayedText: targetTextRef.current, revealedLen: revealedLenRef.current, isRevealing: false }));
6841
+ setState2((s) => ({ ...s, displayedText: targetTextRef.current, revealedLen: revealedLenRef.current, isRevealing: false }));
6841
6842
  }, [stopTicking]);
6842
- if (state.resetKey !== resetKey) {
6843
+ if (state2.resetKey !== resetKey) {
6843
6844
  const next = initialRevealState(targetText, isLive, resetKey);
6844
6845
  revealedLenRef.current = next.revealedLen;
6845
6846
  priorTargetLenRef.current = targetText.length;
@@ -6847,18 +6848,18 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
6847
6848
  lastTickTsRef.current = null;
6848
6849
  lastArrivalTsRef.current = null;
6849
6850
  stopTicking();
6850
- setState(next);
6851
+ setState2(next);
6851
6852
  } else if (!isLive) {
6852
- if (state.revealedLen !== targetText.length || state.displayedText !== targetText) {
6853
+ if (state2.revealedLen !== targetText.length || state2.displayedText !== targetText) {
6853
6854
  revealedLenRef.current = targetText.length;
6854
6855
  priorTargetLenRef.current = targetText.length;
6855
6856
  stopTicking();
6856
- setState((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
6857
+ setState2((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
6857
6858
  }
6858
- } else if (state.revealedLen === 0 && targetText.length > 0) {
6859
+ } else if (state2.revealedLen === 0 && targetText.length > 0) {
6859
6860
  revealedLenRef.current = targetText.length;
6860
6861
  priorTargetLenRef.current = targetText.length;
6861
- setState((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
6862
+ setState2((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
6862
6863
  }
6863
6864
  const tickRef = useRef17(null);
6864
6865
  tickRef.current = (ts) => {
@@ -6886,7 +6887,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
6886
6887
  const advance = Math.max(1, paced, catchUp);
6887
6888
  revealedLenRef.current = Math.min(currentTargetLen, revealedLenRef.current + advance);
6888
6889
  const revealed = revealedLenRef.current >= currentTargetLen;
6889
- setState((s) => ({
6890
+ setState2((s) => ({
6890
6891
  ...s,
6891
6892
  displayedText: targetTextRef.current.slice(
6892
6893
  0,
@@ -6904,7 +6905,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
6904
6905
  if (revealedLenRef.current === 0) return;
6905
6906
  if (revealedLenRef.current >= targetText.length) return;
6906
6907
  if (cancelRef.current != null) return;
6907
- setState((s) => s.isRevealing ? s : { ...s, isRevealing: true });
6908
+ setState2((s) => s.isRevealing ? s : { ...s, isRevealing: true });
6908
6909
  cancelRef.current = scheduleAnimationFrame((ts) => tickRef.current?.(ts));
6909
6910
  }, [targetText, isLive]);
6910
6911
  useEffect19(() => {
@@ -6919,7 +6920,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
6919
6920
  return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
6920
6921
  }, [flushNow]);
6921
6922
  useEffect19(() => stopTicking, [stopTicking]);
6922
- return { displayedText: state.displayedText, isRevealing: state.isRevealing, flushNow };
6923
+ return { displayedText: state2.displayedText, isRevealing: state2.isRevealing, flushNow };
6923
6924
  }
6924
6925
 
6925
6926
  // src/chat/plan/PlanSummaryCard.tsx
@@ -7826,95 +7827,95 @@ function State$1(input, options) {
7826
7827
  this.firstTabInLine = -1;
7827
7828
  this.documents = [];
7828
7829
  }
7829
- function generateError(state, message) {
7830
+ function generateError(state2, message) {
7830
7831
  var mark = {
7831
- name: state.filename,
7832
- buffer: state.input.slice(0, -1),
7832
+ name: state2.filename,
7833
+ buffer: state2.input.slice(0, -1),
7833
7834
  // omit trailing \0
7834
- position: state.position,
7835
- line: state.line,
7836
- column: state.position - state.lineStart
7835
+ position: state2.position,
7836
+ line: state2.line,
7837
+ column: state2.position - state2.lineStart
7837
7838
  };
7838
7839
  mark.snippet = snippet(mark);
7839
7840
  return new exception(message, mark);
7840
7841
  }
7841
- function throwError(state, message) {
7842
- throw generateError(state, message);
7842
+ function throwError(state2, message) {
7843
+ throw generateError(state2, message);
7843
7844
  }
7844
- function throwWarning(state, message) {
7845
- if (state.onWarning) {
7846
- state.onWarning.call(null, generateError(state, message));
7845
+ function throwWarning(state2, message) {
7846
+ if (state2.onWarning) {
7847
+ state2.onWarning.call(null, generateError(state2, message));
7847
7848
  }
7848
7849
  }
7849
7850
  var directiveHandlers = {
7850
- YAML: function handleYamlDirective(state, name, args) {
7851
+ YAML: function handleYamlDirective(state2, name, args) {
7851
7852
  var match, major, minor;
7852
- if (state.version !== null) {
7853
- throwError(state, "duplication of %YAML directive");
7853
+ if (state2.version !== null) {
7854
+ throwError(state2, "duplication of %YAML directive");
7854
7855
  }
7855
7856
  if (args.length !== 1) {
7856
- throwError(state, "YAML directive accepts exactly one argument");
7857
+ throwError(state2, "YAML directive accepts exactly one argument");
7857
7858
  }
7858
7859
  match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
7859
7860
  if (match === null) {
7860
- throwError(state, "ill-formed argument of the YAML directive");
7861
+ throwError(state2, "ill-formed argument of the YAML directive");
7861
7862
  }
7862
7863
  major = parseInt(match[1], 10);
7863
7864
  minor = parseInt(match[2], 10);
7864
7865
  if (major !== 1) {
7865
- throwError(state, "unacceptable YAML version of the document");
7866
+ throwError(state2, "unacceptable YAML version of the document");
7866
7867
  }
7867
- state.version = args[0];
7868
- state.checkLineBreaks = minor < 2;
7868
+ state2.version = args[0];
7869
+ state2.checkLineBreaks = minor < 2;
7869
7870
  if (minor !== 1 && minor !== 2) {
7870
- throwWarning(state, "unsupported YAML version of the document");
7871
+ throwWarning(state2, "unsupported YAML version of the document");
7871
7872
  }
7872
7873
  },
7873
- TAG: function handleTagDirective(state, name, args) {
7874
+ TAG: function handleTagDirective(state2, name, args) {
7874
7875
  var handle, prefix;
7875
7876
  if (args.length !== 2) {
7876
- throwError(state, "TAG directive accepts exactly two arguments");
7877
+ throwError(state2, "TAG directive accepts exactly two arguments");
7877
7878
  }
7878
7879
  handle = args[0];
7879
7880
  prefix = args[1];
7880
7881
  if (!PATTERN_TAG_HANDLE.test(handle)) {
7881
- throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
7882
+ throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
7882
7883
  }
7883
- if (_hasOwnProperty$1.call(state.tagMap, handle)) {
7884
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
7884
+ if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
7885
+ throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
7885
7886
  }
7886
7887
  if (!PATTERN_TAG_URI.test(prefix)) {
7887
- throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
7888
+ throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
7888
7889
  }
7889
7890
  try {
7890
7891
  prefix = decodeURIComponent(prefix);
7891
7892
  } catch (err) {
7892
- throwError(state, "tag prefix is malformed: " + prefix);
7893
+ throwError(state2, "tag prefix is malformed: " + prefix);
7893
7894
  }
7894
- state.tagMap[handle] = prefix;
7895
+ state2.tagMap[handle] = prefix;
7895
7896
  }
7896
7897
  };
7897
- function captureSegment(state, start, end, checkJson) {
7898
+ function captureSegment(state2, start, end, checkJson) {
7898
7899
  var _position, _length, _character, _result;
7899
7900
  if (start < end) {
7900
- _result = state.input.slice(start, end);
7901
+ _result = state2.input.slice(start, end);
7901
7902
  if (checkJson) {
7902
7903
  for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
7903
7904
  _character = _result.charCodeAt(_position);
7904
7905
  if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
7905
- throwError(state, "expected valid JSON character");
7906
+ throwError(state2, "expected valid JSON character");
7906
7907
  }
7907
7908
  }
7908
7909
  } else if (PATTERN_NON_PRINTABLE.test(_result)) {
7909
- throwError(state, "the stream contains non-printable characters");
7910
+ throwError(state2, "the stream contains non-printable characters");
7910
7911
  }
7911
- state.result += _result;
7912
+ state2.result += _result;
7912
7913
  }
7913
7914
  }
7914
- function mergeMappings(state, destination, source, overridableKeys) {
7915
+ function mergeMappings(state2, destination, source, overridableKeys) {
7915
7916
  var sourceKeys, key, index, quantity;
7916
7917
  if (!common.isObject(source)) {
7917
- throwError(state, "cannot merge mappings; the provided source object is unacceptable");
7918
+ throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
7918
7919
  }
7919
7920
  sourceKeys = Object.keys(source);
7920
7921
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
@@ -7925,13 +7926,13 @@ function mergeMappings(state, destination, source, overridableKeys) {
7925
7926
  }
7926
7927
  }
7927
7928
  }
7928
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
7929
+ function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
7929
7930
  var index, quantity;
7930
7931
  if (Array.isArray(keyNode)) {
7931
7932
  keyNode = Array.prototype.slice.call(keyNode);
7932
7933
  for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
7933
7934
  if (Array.isArray(keyNode[index])) {
7934
- throwError(state, "nested arrays are not supported inside keys");
7935
+ throwError(state2, "nested arrays are not supported inside keys");
7935
7936
  }
7936
7937
  if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
7937
7938
  keyNode[index] = "[object Object]";
@@ -7948,246 +7949,246 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
7948
7949
  if (keyTag === "tag:yaml.org,2002:merge") {
7949
7950
  if (Array.isArray(valueNode)) {
7950
7951
  for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
7951
- mergeMappings(state, _result, valueNode[index], overridableKeys);
7952
+ mergeMappings(state2, _result, valueNode[index], overridableKeys);
7952
7953
  }
7953
7954
  } else {
7954
- mergeMappings(state, _result, valueNode, overridableKeys);
7955
+ mergeMappings(state2, _result, valueNode, overridableKeys);
7955
7956
  }
7956
7957
  } else {
7957
- if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
7958
- state.line = startLine || state.line;
7959
- state.lineStart = startLineStart || state.lineStart;
7960
- state.position = startPos || state.position;
7961
- throwError(state, "duplicated mapping key");
7958
+ if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
7959
+ state2.line = startLine || state2.line;
7960
+ state2.lineStart = startLineStart || state2.lineStart;
7961
+ state2.position = startPos || state2.position;
7962
+ throwError(state2, "duplicated mapping key");
7962
7963
  }
7963
7964
  setProperty(_result, keyNode, valueNode);
7964
7965
  delete overridableKeys[keyNode];
7965
7966
  }
7966
7967
  return _result;
7967
7968
  }
7968
- function readLineBreak(state) {
7969
+ function readLineBreak(state2) {
7969
7970
  var ch;
7970
- ch = state.input.charCodeAt(state.position);
7971
+ ch = state2.input.charCodeAt(state2.position);
7971
7972
  if (ch === 10) {
7972
- state.position++;
7973
+ state2.position++;
7973
7974
  } else if (ch === 13) {
7974
- state.position++;
7975
- if (state.input.charCodeAt(state.position) === 10) {
7976
- state.position++;
7975
+ state2.position++;
7976
+ if (state2.input.charCodeAt(state2.position) === 10) {
7977
+ state2.position++;
7977
7978
  }
7978
7979
  } else {
7979
- throwError(state, "a line break is expected");
7980
+ throwError(state2, "a line break is expected");
7980
7981
  }
7981
- state.line += 1;
7982
- state.lineStart = state.position;
7983
- state.firstTabInLine = -1;
7982
+ state2.line += 1;
7983
+ state2.lineStart = state2.position;
7984
+ state2.firstTabInLine = -1;
7984
7985
  }
7985
- function skipSeparationSpace(state, allowComments, checkIndent) {
7986
- var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
7986
+ function skipSeparationSpace(state2, allowComments, checkIndent) {
7987
+ var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position);
7987
7988
  while (ch !== 0) {
7988
7989
  while (is_WHITE_SPACE(ch)) {
7989
- if (ch === 9 && state.firstTabInLine === -1) {
7990
- state.firstTabInLine = state.position;
7990
+ if (ch === 9 && state2.firstTabInLine === -1) {
7991
+ state2.firstTabInLine = state2.position;
7991
7992
  }
7992
- ch = state.input.charCodeAt(++state.position);
7993
+ ch = state2.input.charCodeAt(++state2.position);
7993
7994
  }
7994
7995
  if (allowComments && ch === 35) {
7995
7996
  do {
7996
- ch = state.input.charCodeAt(++state.position);
7997
+ ch = state2.input.charCodeAt(++state2.position);
7997
7998
  } while (ch !== 10 && ch !== 13 && ch !== 0);
7998
7999
  }
7999
8000
  if (is_EOL(ch)) {
8000
- readLineBreak(state);
8001
- ch = state.input.charCodeAt(state.position);
8001
+ readLineBreak(state2);
8002
+ ch = state2.input.charCodeAt(state2.position);
8002
8003
  lineBreaks++;
8003
- state.lineIndent = 0;
8004
+ state2.lineIndent = 0;
8004
8005
  while (ch === 32) {
8005
- state.lineIndent++;
8006
- ch = state.input.charCodeAt(++state.position);
8006
+ state2.lineIndent++;
8007
+ ch = state2.input.charCodeAt(++state2.position);
8007
8008
  }
8008
8009
  } else {
8009
8010
  break;
8010
8011
  }
8011
8012
  }
8012
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
8013
- throwWarning(state, "deficient indentation");
8013
+ if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
8014
+ throwWarning(state2, "deficient indentation");
8014
8015
  }
8015
8016
  return lineBreaks;
8016
8017
  }
8017
- function testDocumentSeparator(state) {
8018
- var _position = state.position, ch;
8019
- ch = state.input.charCodeAt(_position);
8020
- if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
8018
+ function testDocumentSeparator(state2) {
8019
+ var _position = state2.position, ch;
8020
+ ch = state2.input.charCodeAt(_position);
8021
+ if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) {
8021
8022
  _position += 3;
8022
- ch = state.input.charCodeAt(_position);
8023
+ ch = state2.input.charCodeAt(_position);
8023
8024
  if (ch === 0 || is_WS_OR_EOL(ch)) {
8024
8025
  return true;
8025
8026
  }
8026
8027
  }
8027
8028
  return false;
8028
8029
  }
8029
- function writeFoldedLines(state, count) {
8030
+ function writeFoldedLines(state2, count) {
8030
8031
  if (count === 1) {
8031
- state.result += " ";
8032
+ state2.result += " ";
8032
8033
  } else if (count > 1) {
8033
- state.result += common.repeat("\n", count - 1);
8034
+ state2.result += common.repeat("\n", count - 1);
8034
8035
  }
8035
8036
  }
8036
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
8037
- var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
8038
- ch = state.input.charCodeAt(state.position);
8037
+ function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
8038
+ var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch;
8039
+ ch = state2.input.charCodeAt(state2.position);
8039
8040
  if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
8040
8041
  return false;
8041
8042
  }
8042
8043
  if (ch === 63 || ch === 45) {
8043
- following = state.input.charCodeAt(state.position + 1);
8044
+ following = state2.input.charCodeAt(state2.position + 1);
8044
8045
  if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
8045
8046
  return false;
8046
8047
  }
8047
8048
  }
8048
- state.kind = "scalar";
8049
- state.result = "";
8050
- captureStart = captureEnd = state.position;
8049
+ state2.kind = "scalar";
8050
+ state2.result = "";
8051
+ captureStart = captureEnd = state2.position;
8051
8052
  hasPendingContent = false;
8052
8053
  while (ch !== 0) {
8053
8054
  if (ch === 58) {
8054
- following = state.input.charCodeAt(state.position + 1);
8055
+ following = state2.input.charCodeAt(state2.position + 1);
8055
8056
  if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
8056
8057
  break;
8057
8058
  }
8058
8059
  } else if (ch === 35) {
8059
- preceding = state.input.charCodeAt(state.position - 1);
8060
+ preceding = state2.input.charCodeAt(state2.position - 1);
8060
8061
  if (is_WS_OR_EOL(preceding)) {
8061
8062
  break;
8062
8063
  }
8063
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
8064
+ } else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
8064
8065
  break;
8065
8066
  } else if (is_EOL(ch)) {
8066
- _line = state.line;
8067
- _lineStart = state.lineStart;
8068
- _lineIndent = state.lineIndent;
8069
- skipSeparationSpace(state, false, -1);
8070
- if (state.lineIndent >= nodeIndent) {
8067
+ _line = state2.line;
8068
+ _lineStart = state2.lineStart;
8069
+ _lineIndent = state2.lineIndent;
8070
+ skipSeparationSpace(state2, false, -1);
8071
+ if (state2.lineIndent >= nodeIndent) {
8071
8072
  hasPendingContent = true;
8072
- ch = state.input.charCodeAt(state.position);
8073
+ ch = state2.input.charCodeAt(state2.position);
8073
8074
  continue;
8074
8075
  } else {
8075
- state.position = captureEnd;
8076
- state.line = _line;
8077
- state.lineStart = _lineStart;
8078
- state.lineIndent = _lineIndent;
8076
+ state2.position = captureEnd;
8077
+ state2.line = _line;
8078
+ state2.lineStart = _lineStart;
8079
+ state2.lineIndent = _lineIndent;
8079
8080
  break;
8080
8081
  }
8081
8082
  }
8082
8083
  if (hasPendingContent) {
8083
- captureSegment(state, captureStart, captureEnd, false);
8084
- writeFoldedLines(state, state.line - _line);
8085
- captureStart = captureEnd = state.position;
8084
+ captureSegment(state2, captureStart, captureEnd, false);
8085
+ writeFoldedLines(state2, state2.line - _line);
8086
+ captureStart = captureEnd = state2.position;
8086
8087
  hasPendingContent = false;
8087
8088
  }
8088
8089
  if (!is_WHITE_SPACE(ch)) {
8089
- captureEnd = state.position + 1;
8090
+ captureEnd = state2.position + 1;
8090
8091
  }
8091
- ch = state.input.charCodeAt(++state.position);
8092
+ ch = state2.input.charCodeAt(++state2.position);
8092
8093
  }
8093
- captureSegment(state, captureStart, captureEnd, false);
8094
- if (state.result) {
8094
+ captureSegment(state2, captureStart, captureEnd, false);
8095
+ if (state2.result) {
8095
8096
  return true;
8096
8097
  }
8097
- state.kind = _kind;
8098
- state.result = _result;
8098
+ state2.kind = _kind;
8099
+ state2.result = _result;
8099
8100
  return false;
8100
8101
  }
8101
- function readSingleQuotedScalar(state, nodeIndent) {
8102
+ function readSingleQuotedScalar(state2, nodeIndent) {
8102
8103
  var ch, captureStart, captureEnd;
8103
- ch = state.input.charCodeAt(state.position);
8104
+ ch = state2.input.charCodeAt(state2.position);
8104
8105
  if (ch !== 39) {
8105
8106
  return false;
8106
8107
  }
8107
- state.kind = "scalar";
8108
- state.result = "";
8109
- state.position++;
8110
- captureStart = captureEnd = state.position;
8111
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8108
+ state2.kind = "scalar";
8109
+ state2.result = "";
8110
+ state2.position++;
8111
+ captureStart = captureEnd = state2.position;
8112
+ while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
8112
8113
  if (ch === 39) {
8113
- captureSegment(state, captureStart, state.position, true);
8114
- ch = state.input.charCodeAt(++state.position);
8114
+ captureSegment(state2, captureStart, state2.position, true);
8115
+ ch = state2.input.charCodeAt(++state2.position);
8115
8116
  if (ch === 39) {
8116
- captureStart = state.position;
8117
- state.position++;
8118
- captureEnd = state.position;
8117
+ captureStart = state2.position;
8118
+ state2.position++;
8119
+ captureEnd = state2.position;
8119
8120
  } else {
8120
8121
  return true;
8121
8122
  }
8122
8123
  } else if (is_EOL(ch)) {
8123
- captureSegment(state, captureStart, captureEnd, true);
8124
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8125
- captureStart = captureEnd = state.position;
8126
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8127
- throwError(state, "unexpected end of the document within a single quoted scalar");
8124
+ captureSegment(state2, captureStart, captureEnd, true);
8125
+ writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
8126
+ captureStart = captureEnd = state2.position;
8127
+ } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
8128
+ throwError(state2, "unexpected end of the document within a single quoted scalar");
8128
8129
  } else {
8129
- state.position++;
8130
- captureEnd = state.position;
8130
+ state2.position++;
8131
+ captureEnd = state2.position;
8131
8132
  }
8132
8133
  }
8133
- throwError(state, "unexpected end of the stream within a single quoted scalar");
8134
+ throwError(state2, "unexpected end of the stream within a single quoted scalar");
8134
8135
  }
8135
- function readDoubleQuotedScalar(state, nodeIndent) {
8136
+ function readDoubleQuotedScalar(state2, nodeIndent) {
8136
8137
  var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
8137
- ch = state.input.charCodeAt(state.position);
8138
+ ch = state2.input.charCodeAt(state2.position);
8138
8139
  if (ch !== 34) {
8139
8140
  return false;
8140
8141
  }
8141
- state.kind = "scalar";
8142
- state.result = "";
8143
- state.position++;
8144
- captureStart = captureEnd = state.position;
8145
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8142
+ state2.kind = "scalar";
8143
+ state2.result = "";
8144
+ state2.position++;
8145
+ captureStart = captureEnd = state2.position;
8146
+ while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
8146
8147
  if (ch === 34) {
8147
- captureSegment(state, captureStart, state.position, true);
8148
- state.position++;
8148
+ captureSegment(state2, captureStart, state2.position, true);
8149
+ state2.position++;
8149
8150
  return true;
8150
8151
  } else if (ch === 92) {
8151
- captureSegment(state, captureStart, state.position, true);
8152
- ch = state.input.charCodeAt(++state.position);
8152
+ captureSegment(state2, captureStart, state2.position, true);
8153
+ ch = state2.input.charCodeAt(++state2.position);
8153
8154
  if (is_EOL(ch)) {
8154
- skipSeparationSpace(state, false, nodeIndent);
8155
+ skipSeparationSpace(state2, false, nodeIndent);
8155
8156
  } else if (ch < 256 && simpleEscapeCheck[ch]) {
8156
- state.result += simpleEscapeMap[ch];
8157
- state.position++;
8157
+ state2.result += simpleEscapeMap[ch];
8158
+ state2.position++;
8158
8159
  } else if ((tmp = escapedHexLen(ch)) > 0) {
8159
8160
  hexLength = tmp;
8160
8161
  hexResult = 0;
8161
8162
  for (; hexLength > 0; hexLength--) {
8162
- ch = state.input.charCodeAt(++state.position);
8163
+ ch = state2.input.charCodeAt(++state2.position);
8163
8164
  if ((tmp = fromHexCode(ch)) >= 0) {
8164
8165
  hexResult = (hexResult << 4) + tmp;
8165
8166
  } else {
8166
- throwError(state, "expected hexadecimal character");
8167
+ throwError(state2, "expected hexadecimal character");
8167
8168
  }
8168
8169
  }
8169
- state.result += charFromCodepoint(hexResult);
8170
- state.position++;
8170
+ state2.result += charFromCodepoint(hexResult);
8171
+ state2.position++;
8171
8172
  } else {
8172
- throwError(state, "unknown escape sequence");
8173
+ throwError(state2, "unknown escape sequence");
8173
8174
  }
8174
- captureStart = captureEnd = state.position;
8175
+ captureStart = captureEnd = state2.position;
8175
8176
  } else if (is_EOL(ch)) {
8176
- captureSegment(state, captureStart, captureEnd, true);
8177
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8178
- captureStart = captureEnd = state.position;
8179
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8180
- throwError(state, "unexpected end of the document within a double quoted scalar");
8177
+ captureSegment(state2, captureStart, captureEnd, true);
8178
+ writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
8179
+ captureStart = captureEnd = state2.position;
8180
+ } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
8181
+ throwError(state2, "unexpected end of the document within a double quoted scalar");
8181
8182
  } else {
8182
- state.position++;
8183
- captureEnd = state.position;
8183
+ state2.position++;
8184
+ captureEnd = state2.position;
8184
8185
  }
8185
8186
  }
8186
- throwError(state, "unexpected end of the stream within a double quoted scalar");
8187
+ throwError(state2, "unexpected end of the stream within a double quoted scalar");
8187
8188
  }
8188
- function readFlowCollection(state, nodeIndent) {
8189
- var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
8190
- ch = state.input.charCodeAt(state.position);
8189
+ function readFlowCollection(state2, nodeIndent) {
8190
+ var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
8191
+ ch = state2.input.charCodeAt(state2.position);
8191
8192
  if (ch === 91) {
8192
8193
  terminator = 93;
8193
8194
  isMapping = false;
@@ -8199,71 +8200,71 @@ function readFlowCollection(state, nodeIndent) {
8199
8200
  } else {
8200
8201
  return false;
8201
8202
  }
8202
- if (state.anchor !== null) {
8203
- state.anchorMap[state.anchor] = _result;
8203
+ if (state2.anchor !== null) {
8204
+ state2.anchorMap[state2.anchor] = _result;
8204
8205
  }
8205
- ch = state.input.charCodeAt(++state.position);
8206
+ ch = state2.input.charCodeAt(++state2.position);
8206
8207
  while (ch !== 0) {
8207
- skipSeparationSpace(state, true, nodeIndent);
8208
- ch = state.input.charCodeAt(state.position);
8208
+ skipSeparationSpace(state2, true, nodeIndent);
8209
+ ch = state2.input.charCodeAt(state2.position);
8209
8210
  if (ch === terminator) {
8210
- state.position++;
8211
- state.tag = _tag;
8212
- state.anchor = _anchor;
8213
- state.kind = isMapping ? "mapping" : "sequence";
8214
- state.result = _result;
8211
+ state2.position++;
8212
+ state2.tag = _tag;
8213
+ state2.anchor = _anchor;
8214
+ state2.kind = isMapping ? "mapping" : "sequence";
8215
+ state2.result = _result;
8215
8216
  return true;
8216
8217
  } else if (!readNext) {
8217
- throwError(state, "missed comma between flow collection entries");
8218
+ throwError(state2, "missed comma between flow collection entries");
8218
8219
  } else if (ch === 44) {
8219
- throwError(state, "expected the node content, but found ','");
8220
+ throwError(state2, "expected the node content, but found ','");
8220
8221
  }
8221
8222
  keyTag = keyNode = valueNode = null;
8222
8223
  isPair = isExplicitPair = false;
8223
8224
  if (ch === 63) {
8224
- following = state.input.charCodeAt(state.position + 1);
8225
+ following = state2.input.charCodeAt(state2.position + 1);
8225
8226
  if (is_WS_OR_EOL(following)) {
8226
8227
  isPair = isExplicitPair = true;
8227
- state.position++;
8228
- skipSeparationSpace(state, true, nodeIndent);
8229
- }
8230
- }
8231
- _line = state.line;
8232
- _lineStart = state.lineStart;
8233
- _pos = state.position;
8234
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8235
- keyTag = state.tag;
8236
- keyNode = state.result;
8237
- skipSeparationSpace(state, true, nodeIndent);
8238
- ch = state.input.charCodeAt(state.position);
8239
- if ((isExplicitPair || state.line === _line) && ch === 58) {
8228
+ state2.position++;
8229
+ skipSeparationSpace(state2, true, nodeIndent);
8230
+ }
8231
+ }
8232
+ _line = state2.line;
8233
+ _lineStart = state2.lineStart;
8234
+ _pos = state2.position;
8235
+ composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
8236
+ keyTag = state2.tag;
8237
+ keyNode = state2.result;
8238
+ skipSeparationSpace(state2, true, nodeIndent);
8239
+ ch = state2.input.charCodeAt(state2.position);
8240
+ if ((isExplicitPair || state2.line === _line) && ch === 58) {
8240
8241
  isPair = true;
8241
- ch = state.input.charCodeAt(++state.position);
8242
- skipSeparationSpace(state, true, nodeIndent);
8243
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8244
- valueNode = state.result;
8242
+ ch = state2.input.charCodeAt(++state2.position);
8243
+ skipSeparationSpace(state2, true, nodeIndent);
8244
+ composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
8245
+ valueNode = state2.result;
8245
8246
  }
8246
8247
  if (isMapping) {
8247
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
8248
+ storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
8248
8249
  } else if (isPair) {
8249
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
8250
+ _result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
8250
8251
  } else {
8251
8252
  _result.push(keyNode);
8252
8253
  }
8253
- skipSeparationSpace(state, true, nodeIndent);
8254
- ch = state.input.charCodeAt(state.position);
8254
+ skipSeparationSpace(state2, true, nodeIndent);
8255
+ ch = state2.input.charCodeAt(state2.position);
8255
8256
  if (ch === 44) {
8256
8257
  readNext = true;
8257
- ch = state.input.charCodeAt(++state.position);
8258
+ ch = state2.input.charCodeAt(++state2.position);
8258
8259
  } else {
8259
8260
  readNext = false;
8260
8261
  }
8261
8262
  }
8262
- throwError(state, "unexpected end of the stream within a flow collection");
8263
+ throwError(state2, "unexpected end of the stream within a flow collection");
8263
8264
  }
8264
- function readBlockScalar(state, nodeIndent) {
8265
+ function readBlockScalar(state2, nodeIndent) {
8265
8266
  var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
8266
- ch = state.input.charCodeAt(state.position);
8267
+ ch = state2.input.charCodeAt(state2.position);
8267
8268
  if (ch === 124) {
8268
8269
  folding = false;
8269
8270
  } else if (ch === 62) {
@@ -8271,24 +8272,24 @@ function readBlockScalar(state, nodeIndent) {
8271
8272
  } else {
8272
8273
  return false;
8273
8274
  }
8274
- state.kind = "scalar";
8275
- state.result = "";
8275
+ state2.kind = "scalar";
8276
+ state2.result = "";
8276
8277
  while (ch !== 0) {
8277
- ch = state.input.charCodeAt(++state.position);
8278
+ ch = state2.input.charCodeAt(++state2.position);
8278
8279
  if (ch === 43 || ch === 45) {
8279
8280
  if (CHOMPING_CLIP === chomping) {
8280
8281
  chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
8281
8282
  } else {
8282
- throwError(state, "repeat of a chomping mode identifier");
8283
+ throwError(state2, "repeat of a chomping mode identifier");
8283
8284
  }
8284
8285
  } else if ((tmp = fromDecimalCode(ch)) >= 0) {
8285
8286
  if (tmp === 0) {
8286
- throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
8287
+ throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
8287
8288
  } else if (!detectedIndent) {
8288
8289
  textIndent = nodeIndent + tmp - 1;
8289
8290
  detectedIndent = true;
8290
8291
  } else {
8291
- throwError(state, "repeat of an indentation width identifier");
8292
+ throwError(state2, "repeat of an indentation width identifier");
8292
8293
  }
8293
8294
  } else {
8294
8295
  break;
@@ -8296,35 +8297,35 @@ function readBlockScalar(state, nodeIndent) {
8296
8297
  }
8297
8298
  if (is_WHITE_SPACE(ch)) {
8298
8299
  do {
8299
- ch = state.input.charCodeAt(++state.position);
8300
+ ch = state2.input.charCodeAt(++state2.position);
8300
8301
  } while (is_WHITE_SPACE(ch));
8301
8302
  if (ch === 35) {
8302
8303
  do {
8303
- ch = state.input.charCodeAt(++state.position);
8304
+ ch = state2.input.charCodeAt(++state2.position);
8304
8305
  } while (!is_EOL(ch) && ch !== 0);
8305
8306
  }
8306
8307
  }
8307
8308
  while (ch !== 0) {
8308
- readLineBreak(state);
8309
- state.lineIndent = 0;
8310
- ch = state.input.charCodeAt(state.position);
8311
- while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
8312
- state.lineIndent++;
8313
- ch = state.input.charCodeAt(++state.position);
8309
+ readLineBreak(state2);
8310
+ state2.lineIndent = 0;
8311
+ ch = state2.input.charCodeAt(state2.position);
8312
+ while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) {
8313
+ state2.lineIndent++;
8314
+ ch = state2.input.charCodeAt(++state2.position);
8314
8315
  }
8315
- if (!detectedIndent && state.lineIndent > textIndent) {
8316
- textIndent = state.lineIndent;
8316
+ if (!detectedIndent && state2.lineIndent > textIndent) {
8317
+ textIndent = state2.lineIndent;
8317
8318
  }
8318
8319
  if (is_EOL(ch)) {
8319
8320
  emptyLines++;
8320
8321
  continue;
8321
8322
  }
8322
- if (state.lineIndent < textIndent) {
8323
+ if (state2.lineIndent < textIndent) {
8323
8324
  if (chomping === CHOMPING_KEEP) {
8324
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8325
+ state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8325
8326
  } else if (chomping === CHOMPING_CLIP) {
8326
8327
  if (didReadContent) {
8327
- state.result += "\n";
8328
+ state2.result += "\n";
8328
8329
  }
8329
8330
  }
8330
8331
  break;
@@ -8332,97 +8333,97 @@ function readBlockScalar(state, nodeIndent) {
8332
8333
  if (folding) {
8333
8334
  if (is_WHITE_SPACE(ch)) {
8334
8335
  atMoreIndented = true;
8335
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8336
+ state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8336
8337
  } else if (atMoreIndented) {
8337
8338
  atMoreIndented = false;
8338
- state.result += common.repeat("\n", emptyLines + 1);
8339
+ state2.result += common.repeat("\n", emptyLines + 1);
8339
8340
  } else if (emptyLines === 0) {
8340
8341
  if (didReadContent) {
8341
- state.result += " ";
8342
+ state2.result += " ";
8342
8343
  }
8343
8344
  } else {
8344
- state.result += common.repeat("\n", emptyLines);
8345
+ state2.result += common.repeat("\n", emptyLines);
8345
8346
  }
8346
8347
  } else {
8347
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8348
+ state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
8348
8349
  }
8349
8350
  didReadContent = true;
8350
8351
  detectedIndent = true;
8351
8352
  emptyLines = 0;
8352
- captureStart = state.position;
8353
+ captureStart = state2.position;
8353
8354
  while (!is_EOL(ch) && ch !== 0) {
8354
- ch = state.input.charCodeAt(++state.position);
8355
+ ch = state2.input.charCodeAt(++state2.position);
8355
8356
  }
8356
- captureSegment(state, captureStart, state.position, false);
8357
+ captureSegment(state2, captureStart, state2.position, false);
8357
8358
  }
8358
8359
  return true;
8359
8360
  }
8360
- function readBlockSequence(state, nodeIndent) {
8361
- var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
8362
- if (state.firstTabInLine !== -1) return false;
8363
- if (state.anchor !== null) {
8364
- state.anchorMap[state.anchor] = _result;
8361
+ function readBlockSequence(state2, nodeIndent) {
8362
+ var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch;
8363
+ if (state2.firstTabInLine !== -1) return false;
8364
+ if (state2.anchor !== null) {
8365
+ state2.anchorMap[state2.anchor] = _result;
8365
8366
  }
8366
- ch = state.input.charCodeAt(state.position);
8367
+ ch = state2.input.charCodeAt(state2.position);
8367
8368
  while (ch !== 0) {
8368
- if (state.firstTabInLine !== -1) {
8369
- state.position = state.firstTabInLine;
8370
- throwError(state, "tab characters must not be used in indentation");
8369
+ if (state2.firstTabInLine !== -1) {
8370
+ state2.position = state2.firstTabInLine;
8371
+ throwError(state2, "tab characters must not be used in indentation");
8371
8372
  }
8372
8373
  if (ch !== 45) {
8373
8374
  break;
8374
8375
  }
8375
- following = state.input.charCodeAt(state.position + 1);
8376
+ following = state2.input.charCodeAt(state2.position + 1);
8376
8377
  if (!is_WS_OR_EOL(following)) {
8377
8378
  break;
8378
8379
  }
8379
8380
  detected = true;
8380
- state.position++;
8381
- if (skipSeparationSpace(state, true, -1)) {
8382
- if (state.lineIndent <= nodeIndent) {
8381
+ state2.position++;
8382
+ if (skipSeparationSpace(state2, true, -1)) {
8383
+ if (state2.lineIndent <= nodeIndent) {
8383
8384
  _result.push(null);
8384
- ch = state.input.charCodeAt(state.position);
8385
+ ch = state2.input.charCodeAt(state2.position);
8385
8386
  continue;
8386
8387
  }
8387
8388
  }
8388
- _line = state.line;
8389
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
8390
- _result.push(state.result);
8391
- skipSeparationSpace(state, true, -1);
8392
- ch = state.input.charCodeAt(state.position);
8393
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
8394
- throwError(state, "bad indentation of a sequence entry");
8395
- } else if (state.lineIndent < nodeIndent) {
8389
+ _line = state2.line;
8390
+ composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
8391
+ _result.push(state2.result);
8392
+ skipSeparationSpace(state2, true, -1);
8393
+ ch = state2.input.charCodeAt(state2.position);
8394
+ if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
8395
+ throwError(state2, "bad indentation of a sequence entry");
8396
+ } else if (state2.lineIndent < nodeIndent) {
8396
8397
  break;
8397
8398
  }
8398
8399
  }
8399
8400
  if (detected) {
8400
- state.tag = _tag;
8401
- state.anchor = _anchor;
8402
- state.kind = "sequence";
8403
- state.result = _result;
8401
+ state2.tag = _tag;
8402
+ state2.anchor = _anchor;
8403
+ state2.kind = "sequence";
8404
+ state2.result = _result;
8404
8405
  return true;
8405
8406
  }
8406
8407
  return false;
8407
8408
  }
8408
- function readBlockMapping(state, nodeIndent, flowIndent) {
8409
- var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
8410
- if (state.firstTabInLine !== -1) return false;
8411
- if (state.anchor !== null) {
8412
- state.anchorMap[state.anchor] = _result;
8409
+ function readBlockMapping(state2, nodeIndent, flowIndent) {
8410
+ var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor = state2.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
8411
+ if (state2.firstTabInLine !== -1) return false;
8412
+ if (state2.anchor !== null) {
8413
+ state2.anchorMap[state2.anchor] = _result;
8413
8414
  }
8414
- ch = state.input.charCodeAt(state.position);
8415
+ ch = state2.input.charCodeAt(state2.position);
8415
8416
  while (ch !== 0) {
8416
- if (!atExplicitKey && state.firstTabInLine !== -1) {
8417
- state.position = state.firstTabInLine;
8418
- throwError(state, "tab characters must not be used in indentation");
8417
+ if (!atExplicitKey && state2.firstTabInLine !== -1) {
8418
+ state2.position = state2.firstTabInLine;
8419
+ throwError(state2, "tab characters must not be used in indentation");
8419
8420
  }
8420
- following = state.input.charCodeAt(state.position + 1);
8421
- _line = state.line;
8421
+ following = state2.input.charCodeAt(state2.position + 1);
8422
+ _line = state2.line;
8422
8423
  if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
8423
8424
  if (ch === 63) {
8424
8425
  if (atExplicitKey) {
8425
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8426
+ storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8426
8427
  keyTag = keyNode = valueNode = null;
8427
8428
  }
8428
8429
  detected = true;
@@ -8432,229 +8433,229 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
8432
8433
  atExplicitKey = false;
8433
8434
  allowCompact = true;
8434
8435
  } else {
8435
- throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
8436
+ throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
8436
8437
  }
8437
- state.position += 1;
8438
+ state2.position += 1;
8438
8439
  ch = following;
8439
8440
  } else {
8440
- _keyLine = state.line;
8441
- _keyLineStart = state.lineStart;
8442
- _keyPos = state.position;
8443
- if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
8441
+ _keyLine = state2.line;
8442
+ _keyLineStart = state2.lineStart;
8443
+ _keyPos = state2.position;
8444
+ if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
8444
8445
  break;
8445
8446
  }
8446
- if (state.line === _line) {
8447
- ch = state.input.charCodeAt(state.position);
8447
+ if (state2.line === _line) {
8448
+ ch = state2.input.charCodeAt(state2.position);
8448
8449
  while (is_WHITE_SPACE(ch)) {
8449
- ch = state.input.charCodeAt(++state.position);
8450
+ ch = state2.input.charCodeAt(++state2.position);
8450
8451
  }
8451
8452
  if (ch === 58) {
8452
- ch = state.input.charCodeAt(++state.position);
8453
+ ch = state2.input.charCodeAt(++state2.position);
8453
8454
  if (!is_WS_OR_EOL(ch)) {
8454
- throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
8455
+ throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
8455
8456
  }
8456
8457
  if (atExplicitKey) {
8457
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8458
+ storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8458
8459
  keyTag = keyNode = valueNode = null;
8459
8460
  }
8460
8461
  detected = true;
8461
8462
  atExplicitKey = false;
8462
8463
  allowCompact = false;
8463
- keyTag = state.tag;
8464
- keyNode = state.result;
8464
+ keyTag = state2.tag;
8465
+ keyNode = state2.result;
8465
8466
  } else if (detected) {
8466
- throwError(state, "can not read an implicit mapping pair; a colon is missed");
8467
+ throwError(state2, "can not read an implicit mapping pair; a colon is missed");
8467
8468
  } else {
8468
- state.tag = _tag;
8469
- state.anchor = _anchor;
8469
+ state2.tag = _tag;
8470
+ state2.anchor = _anchor;
8470
8471
  return true;
8471
8472
  }
8472
8473
  } else if (detected) {
8473
- throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
8474
+ throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
8474
8475
  } else {
8475
- state.tag = _tag;
8476
- state.anchor = _anchor;
8476
+ state2.tag = _tag;
8477
+ state2.anchor = _anchor;
8477
8478
  return true;
8478
8479
  }
8479
8480
  }
8480
- if (state.line === _line || state.lineIndent > nodeIndent) {
8481
+ if (state2.line === _line || state2.lineIndent > nodeIndent) {
8481
8482
  if (atExplicitKey) {
8482
- _keyLine = state.line;
8483
- _keyLineStart = state.lineStart;
8484
- _keyPos = state.position;
8483
+ _keyLine = state2.line;
8484
+ _keyLineStart = state2.lineStart;
8485
+ _keyPos = state2.position;
8485
8486
  }
8486
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
8487
+ if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
8487
8488
  if (atExplicitKey) {
8488
- keyNode = state.result;
8489
+ keyNode = state2.result;
8489
8490
  } else {
8490
- valueNode = state.result;
8491
+ valueNode = state2.result;
8491
8492
  }
8492
8493
  }
8493
8494
  if (!atExplicitKey) {
8494
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
8495
+ storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
8495
8496
  keyTag = keyNode = valueNode = null;
8496
8497
  }
8497
- skipSeparationSpace(state, true, -1);
8498
- ch = state.input.charCodeAt(state.position);
8498
+ skipSeparationSpace(state2, true, -1);
8499
+ ch = state2.input.charCodeAt(state2.position);
8499
8500
  }
8500
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
8501
- throwError(state, "bad indentation of a mapping entry");
8502
- } else if (state.lineIndent < nodeIndent) {
8501
+ if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
8502
+ throwError(state2, "bad indentation of a mapping entry");
8503
+ } else if (state2.lineIndent < nodeIndent) {
8503
8504
  break;
8504
8505
  }
8505
8506
  }
8506
8507
  if (atExplicitKey) {
8507
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8508
+ storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
8508
8509
  }
8509
8510
  if (detected) {
8510
- state.tag = _tag;
8511
- state.anchor = _anchor;
8512
- state.kind = "mapping";
8513
- state.result = _result;
8511
+ state2.tag = _tag;
8512
+ state2.anchor = _anchor;
8513
+ state2.kind = "mapping";
8514
+ state2.result = _result;
8514
8515
  }
8515
8516
  return detected;
8516
8517
  }
8517
- function readTagProperty(state) {
8518
+ function readTagProperty(state2) {
8518
8519
  var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
8519
- ch = state.input.charCodeAt(state.position);
8520
+ ch = state2.input.charCodeAt(state2.position);
8520
8521
  if (ch !== 33) return false;
8521
- if (state.tag !== null) {
8522
- throwError(state, "duplication of a tag property");
8522
+ if (state2.tag !== null) {
8523
+ throwError(state2, "duplication of a tag property");
8523
8524
  }
8524
- ch = state.input.charCodeAt(++state.position);
8525
+ ch = state2.input.charCodeAt(++state2.position);
8525
8526
  if (ch === 60) {
8526
8527
  isVerbatim = true;
8527
- ch = state.input.charCodeAt(++state.position);
8528
+ ch = state2.input.charCodeAt(++state2.position);
8528
8529
  } else if (ch === 33) {
8529
8530
  isNamed = true;
8530
8531
  tagHandle = "!!";
8531
- ch = state.input.charCodeAt(++state.position);
8532
+ ch = state2.input.charCodeAt(++state2.position);
8532
8533
  } else {
8533
8534
  tagHandle = "!";
8534
8535
  }
8535
- _position = state.position;
8536
+ _position = state2.position;
8536
8537
  if (isVerbatim) {
8537
8538
  do {
8538
- ch = state.input.charCodeAt(++state.position);
8539
+ ch = state2.input.charCodeAt(++state2.position);
8539
8540
  } while (ch !== 0 && ch !== 62);
8540
- if (state.position < state.length) {
8541
- tagName = state.input.slice(_position, state.position);
8542
- ch = state.input.charCodeAt(++state.position);
8541
+ if (state2.position < state2.length) {
8542
+ tagName = state2.input.slice(_position, state2.position);
8543
+ ch = state2.input.charCodeAt(++state2.position);
8543
8544
  } else {
8544
- throwError(state, "unexpected end of the stream within a verbatim tag");
8545
+ throwError(state2, "unexpected end of the stream within a verbatim tag");
8545
8546
  }
8546
8547
  } else {
8547
8548
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8548
8549
  if (ch === 33) {
8549
8550
  if (!isNamed) {
8550
- tagHandle = state.input.slice(_position - 1, state.position + 1);
8551
+ tagHandle = state2.input.slice(_position - 1, state2.position + 1);
8551
8552
  if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
8552
- throwError(state, "named tag handle cannot contain such characters");
8553
+ throwError(state2, "named tag handle cannot contain such characters");
8553
8554
  }
8554
8555
  isNamed = true;
8555
- _position = state.position + 1;
8556
+ _position = state2.position + 1;
8556
8557
  } else {
8557
- throwError(state, "tag suffix cannot contain exclamation marks");
8558
+ throwError(state2, "tag suffix cannot contain exclamation marks");
8558
8559
  }
8559
8560
  }
8560
- ch = state.input.charCodeAt(++state.position);
8561
+ ch = state2.input.charCodeAt(++state2.position);
8561
8562
  }
8562
- tagName = state.input.slice(_position, state.position);
8563
+ tagName = state2.input.slice(_position, state2.position);
8563
8564
  if (PATTERN_FLOW_INDICATORS.test(tagName)) {
8564
- throwError(state, "tag suffix cannot contain flow indicator characters");
8565
+ throwError(state2, "tag suffix cannot contain flow indicator characters");
8565
8566
  }
8566
8567
  }
8567
8568
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
8568
- throwError(state, "tag name cannot contain such characters: " + tagName);
8569
+ throwError(state2, "tag name cannot contain such characters: " + tagName);
8569
8570
  }
8570
8571
  try {
8571
8572
  tagName = decodeURIComponent(tagName);
8572
8573
  } catch (err) {
8573
- throwError(state, "tag name is malformed: " + tagName);
8574
+ throwError(state2, "tag name is malformed: " + tagName);
8574
8575
  }
8575
8576
  if (isVerbatim) {
8576
- state.tag = tagName;
8577
- } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
8578
- state.tag = state.tagMap[tagHandle] + tagName;
8577
+ state2.tag = tagName;
8578
+ } else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
8579
+ state2.tag = state2.tagMap[tagHandle] + tagName;
8579
8580
  } else if (tagHandle === "!") {
8580
- state.tag = "!" + tagName;
8581
+ state2.tag = "!" + tagName;
8581
8582
  } else if (tagHandle === "!!") {
8582
- state.tag = "tag:yaml.org,2002:" + tagName;
8583
+ state2.tag = "tag:yaml.org,2002:" + tagName;
8583
8584
  } else {
8584
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
8585
+ throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
8585
8586
  }
8586
8587
  return true;
8587
8588
  }
8588
- function readAnchorProperty(state) {
8589
+ function readAnchorProperty(state2) {
8589
8590
  var _position, ch;
8590
- ch = state.input.charCodeAt(state.position);
8591
+ ch = state2.input.charCodeAt(state2.position);
8591
8592
  if (ch !== 38) return false;
8592
- if (state.anchor !== null) {
8593
- throwError(state, "duplication of an anchor property");
8593
+ if (state2.anchor !== null) {
8594
+ throwError(state2, "duplication of an anchor property");
8594
8595
  }
8595
- ch = state.input.charCodeAt(++state.position);
8596
- _position = state.position;
8596
+ ch = state2.input.charCodeAt(++state2.position);
8597
+ _position = state2.position;
8597
8598
  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
8598
- ch = state.input.charCodeAt(++state.position);
8599
+ ch = state2.input.charCodeAt(++state2.position);
8599
8600
  }
8600
- if (state.position === _position) {
8601
- throwError(state, "name of an anchor node must contain at least one character");
8601
+ if (state2.position === _position) {
8602
+ throwError(state2, "name of an anchor node must contain at least one character");
8602
8603
  }
8603
- state.anchor = state.input.slice(_position, state.position);
8604
+ state2.anchor = state2.input.slice(_position, state2.position);
8604
8605
  return true;
8605
8606
  }
8606
- function readAlias(state) {
8607
+ function readAlias(state2) {
8607
8608
  var _position, alias, ch;
8608
- ch = state.input.charCodeAt(state.position);
8609
+ ch = state2.input.charCodeAt(state2.position);
8609
8610
  if (ch !== 42) return false;
8610
- ch = state.input.charCodeAt(++state.position);
8611
- _position = state.position;
8611
+ ch = state2.input.charCodeAt(++state2.position);
8612
+ _position = state2.position;
8612
8613
  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
8613
- ch = state.input.charCodeAt(++state.position);
8614
+ ch = state2.input.charCodeAt(++state2.position);
8614
8615
  }
8615
- if (state.position === _position) {
8616
- throwError(state, "name of an alias node must contain at least one character");
8616
+ if (state2.position === _position) {
8617
+ throwError(state2, "name of an alias node must contain at least one character");
8617
8618
  }
8618
- alias = state.input.slice(_position, state.position);
8619
- if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
8620
- throwError(state, 'unidentified alias "' + alias + '"');
8619
+ alias = state2.input.slice(_position, state2.position);
8620
+ if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
8621
+ throwError(state2, 'unidentified alias "' + alias + '"');
8621
8622
  }
8622
- state.result = state.anchorMap[alias];
8623
- skipSeparationSpace(state, true, -1);
8623
+ state2.result = state2.anchorMap[alias];
8624
+ skipSeparationSpace(state2, true, -1);
8624
8625
  return true;
8625
8626
  }
8626
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
8627
+ function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
8627
8628
  var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
8628
- if (state.listener !== null) {
8629
- state.listener("open", state);
8629
+ if (state2.listener !== null) {
8630
+ state2.listener("open", state2);
8630
8631
  }
8631
- state.tag = null;
8632
- state.anchor = null;
8633
- state.kind = null;
8634
- state.result = null;
8632
+ state2.tag = null;
8633
+ state2.anchor = null;
8634
+ state2.kind = null;
8635
+ state2.result = null;
8635
8636
  allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
8636
8637
  if (allowToSeek) {
8637
- if (skipSeparationSpace(state, true, -1)) {
8638
+ if (skipSeparationSpace(state2, true, -1)) {
8638
8639
  atNewLine = true;
8639
- if (state.lineIndent > parentIndent) {
8640
+ if (state2.lineIndent > parentIndent) {
8640
8641
  indentStatus = 1;
8641
- } else if (state.lineIndent === parentIndent) {
8642
+ } else if (state2.lineIndent === parentIndent) {
8642
8643
  indentStatus = 0;
8643
- } else if (state.lineIndent < parentIndent) {
8644
+ } else if (state2.lineIndent < parentIndent) {
8644
8645
  indentStatus = -1;
8645
8646
  }
8646
8647
  }
8647
8648
  }
8648
8649
  if (indentStatus === 1) {
8649
- while (readTagProperty(state) || readAnchorProperty(state)) {
8650
- if (skipSeparationSpace(state, true, -1)) {
8650
+ while (readTagProperty(state2) || readAnchorProperty(state2)) {
8651
+ if (skipSeparationSpace(state2, true, -1)) {
8651
8652
  atNewLine = true;
8652
8653
  allowBlockCollections = allowBlockStyles;
8653
- if (state.lineIndent > parentIndent) {
8654
+ if (state2.lineIndent > parentIndent) {
8654
8655
  indentStatus = 1;
8655
- } else if (state.lineIndent === parentIndent) {
8656
+ } else if (state2.lineIndent === parentIndent) {
8656
8657
  indentStatus = 0;
8657
- } else if (state.lineIndent < parentIndent) {
8658
+ } else if (state2.lineIndent < parentIndent) {
8658
8659
  indentStatus = -1;
8659
8660
  }
8660
8661
  } else {
@@ -8671,153 +8672,153 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
8671
8672
  } else {
8672
8673
  flowIndent = parentIndent + 1;
8673
8674
  }
8674
- blockIndent = state.position - state.lineStart;
8675
+ blockIndent = state2.position - state2.lineStart;
8675
8676
  if (indentStatus === 1) {
8676
- if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
8677
+ if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
8677
8678
  hasContent = true;
8678
8679
  } else {
8679
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
8680
+ if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
8680
8681
  hasContent = true;
8681
- } else if (readAlias(state)) {
8682
+ } else if (readAlias(state2)) {
8682
8683
  hasContent = true;
8683
- if (state.tag !== null || state.anchor !== null) {
8684
- throwError(state, "alias node should not have any properties");
8684
+ if (state2.tag !== null || state2.anchor !== null) {
8685
+ throwError(state2, "alias node should not have any properties");
8685
8686
  }
8686
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
8687
+ } else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
8687
8688
  hasContent = true;
8688
- if (state.tag === null) {
8689
- state.tag = "?";
8689
+ if (state2.tag === null) {
8690
+ state2.tag = "?";
8690
8691
  }
8691
8692
  }
8692
- if (state.anchor !== null) {
8693
- state.anchorMap[state.anchor] = state.result;
8693
+ if (state2.anchor !== null) {
8694
+ state2.anchorMap[state2.anchor] = state2.result;
8694
8695
  }
8695
8696
  }
8696
8697
  } else if (indentStatus === 0) {
8697
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
8698
+ hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
8698
8699
  }
8699
8700
  }
8700
- if (state.tag === null) {
8701
- if (state.anchor !== null) {
8702
- state.anchorMap[state.anchor] = state.result;
8701
+ if (state2.tag === null) {
8702
+ if (state2.anchor !== null) {
8703
+ state2.anchorMap[state2.anchor] = state2.result;
8703
8704
  }
8704
- } else if (state.tag === "?") {
8705
- if (state.result !== null && state.kind !== "scalar") {
8706
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
8705
+ } else if (state2.tag === "?") {
8706
+ if (state2.result !== null && state2.kind !== "scalar") {
8707
+ throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
8707
8708
  }
8708
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
8709
- type2 = state.implicitTypes[typeIndex];
8710
- if (type2.resolve(state.result)) {
8711
- state.result = type2.construct(state.result);
8712
- state.tag = type2.tag;
8713
- if (state.anchor !== null) {
8714
- state.anchorMap[state.anchor] = state.result;
8709
+ for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
8710
+ type2 = state2.implicitTypes[typeIndex];
8711
+ if (type2.resolve(state2.result)) {
8712
+ state2.result = type2.construct(state2.result);
8713
+ state2.tag = type2.tag;
8714
+ if (state2.anchor !== null) {
8715
+ state2.anchorMap[state2.anchor] = state2.result;
8715
8716
  }
8716
8717
  break;
8717
8718
  }
8718
8719
  }
8719
- } else if (state.tag !== "!") {
8720
- if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
8721
- type2 = state.typeMap[state.kind || "fallback"][state.tag];
8720
+ } else if (state2.tag !== "!") {
8721
+ if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
8722
+ type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
8722
8723
  } else {
8723
8724
  type2 = null;
8724
- typeList = state.typeMap.multi[state.kind || "fallback"];
8725
+ typeList = state2.typeMap.multi[state2.kind || "fallback"];
8725
8726
  for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
8726
- if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
8727
+ if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
8727
8728
  type2 = typeList[typeIndex];
8728
8729
  break;
8729
8730
  }
8730
8731
  }
8731
8732
  }
8732
8733
  if (!type2) {
8733
- throwError(state, "unknown tag !<" + state.tag + ">");
8734
+ throwError(state2, "unknown tag !<" + state2.tag + ">");
8734
8735
  }
8735
- if (state.result !== null && type2.kind !== state.kind) {
8736
- throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
8736
+ if (state2.result !== null && type2.kind !== state2.kind) {
8737
+ throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
8737
8738
  }
8738
- if (!type2.resolve(state.result, state.tag)) {
8739
- throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
8739
+ if (!type2.resolve(state2.result, state2.tag)) {
8740
+ throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
8740
8741
  } else {
8741
- state.result = type2.construct(state.result, state.tag);
8742
- if (state.anchor !== null) {
8743
- state.anchorMap[state.anchor] = state.result;
8742
+ state2.result = type2.construct(state2.result, state2.tag);
8743
+ if (state2.anchor !== null) {
8744
+ state2.anchorMap[state2.anchor] = state2.result;
8744
8745
  }
8745
8746
  }
8746
8747
  }
8747
- if (state.listener !== null) {
8748
- state.listener("close", state);
8748
+ if (state2.listener !== null) {
8749
+ state2.listener("close", state2);
8749
8750
  }
8750
- return state.tag !== null || state.anchor !== null || hasContent;
8751
+ return state2.tag !== null || state2.anchor !== null || hasContent;
8751
8752
  }
8752
- function readDocument(state) {
8753
- var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
8754
- state.version = null;
8755
- state.checkLineBreaks = state.legacy;
8756
- state.tagMap = /* @__PURE__ */ Object.create(null);
8757
- state.anchorMap = /* @__PURE__ */ Object.create(null);
8758
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8759
- skipSeparationSpace(state, true, -1);
8760
- ch = state.input.charCodeAt(state.position);
8761
- if (state.lineIndent > 0 || ch !== 37) {
8753
+ function readDocument(state2) {
8754
+ var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
8755
+ state2.version = null;
8756
+ state2.checkLineBreaks = state2.legacy;
8757
+ state2.tagMap = /* @__PURE__ */ Object.create(null);
8758
+ state2.anchorMap = /* @__PURE__ */ Object.create(null);
8759
+ while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
8760
+ skipSeparationSpace(state2, true, -1);
8761
+ ch = state2.input.charCodeAt(state2.position);
8762
+ if (state2.lineIndent > 0 || ch !== 37) {
8762
8763
  break;
8763
8764
  }
8764
8765
  hasDirectives = true;
8765
- ch = state.input.charCodeAt(++state.position);
8766
- _position = state.position;
8766
+ ch = state2.input.charCodeAt(++state2.position);
8767
+ _position = state2.position;
8767
8768
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8768
- ch = state.input.charCodeAt(++state.position);
8769
+ ch = state2.input.charCodeAt(++state2.position);
8769
8770
  }
8770
- directiveName = state.input.slice(_position, state.position);
8771
+ directiveName = state2.input.slice(_position, state2.position);
8771
8772
  directiveArgs = [];
8772
8773
  if (directiveName.length < 1) {
8773
- throwError(state, "directive name must not be less than one character in length");
8774
+ throwError(state2, "directive name must not be less than one character in length");
8774
8775
  }
8775
8776
  while (ch !== 0) {
8776
8777
  while (is_WHITE_SPACE(ch)) {
8777
- ch = state.input.charCodeAt(++state.position);
8778
+ ch = state2.input.charCodeAt(++state2.position);
8778
8779
  }
8779
8780
  if (ch === 35) {
8780
8781
  do {
8781
- ch = state.input.charCodeAt(++state.position);
8782
+ ch = state2.input.charCodeAt(++state2.position);
8782
8783
  } while (ch !== 0 && !is_EOL(ch));
8783
8784
  break;
8784
8785
  }
8785
8786
  if (is_EOL(ch)) break;
8786
- _position = state.position;
8787
+ _position = state2.position;
8787
8788
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
8788
- ch = state.input.charCodeAt(++state.position);
8789
+ ch = state2.input.charCodeAt(++state2.position);
8789
8790
  }
8790
- directiveArgs.push(state.input.slice(_position, state.position));
8791
+ directiveArgs.push(state2.input.slice(_position, state2.position));
8791
8792
  }
8792
- if (ch !== 0) readLineBreak(state);
8793
+ if (ch !== 0) readLineBreak(state2);
8793
8794
  if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
8794
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
8795
+ directiveHandlers[directiveName](state2, directiveName, directiveArgs);
8795
8796
  } else {
8796
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
8797
+ throwWarning(state2, 'unknown document directive "' + directiveName + '"');
8797
8798
  }
8798
8799
  }
8799
- skipSeparationSpace(state, true, -1);
8800
- if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
8801
- state.position += 3;
8802
- skipSeparationSpace(state, true, -1);
8800
+ skipSeparationSpace(state2, true, -1);
8801
+ if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
8802
+ state2.position += 3;
8803
+ skipSeparationSpace(state2, true, -1);
8803
8804
  } else if (hasDirectives) {
8804
- throwError(state, "directives end mark is expected");
8805
+ throwError(state2, "directives end mark is expected");
8805
8806
  }
8806
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
8807
- skipSeparationSpace(state, true, -1);
8808
- if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
8809
- throwWarning(state, "non-ASCII line breaks are interpreted as content");
8807
+ composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
8808
+ skipSeparationSpace(state2, true, -1);
8809
+ if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
8810
+ throwWarning(state2, "non-ASCII line breaks are interpreted as content");
8810
8811
  }
8811
- state.documents.push(state.result);
8812
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
8813
- if (state.input.charCodeAt(state.position) === 46) {
8814
- state.position += 3;
8815
- skipSeparationSpace(state, true, -1);
8812
+ state2.documents.push(state2.result);
8813
+ if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
8814
+ if (state2.input.charCodeAt(state2.position) === 46) {
8815
+ state2.position += 3;
8816
+ skipSeparationSpace(state2, true, -1);
8816
8817
  }
8817
8818
  return;
8818
8819
  }
8819
- if (state.position < state.length - 1) {
8820
- throwError(state, "end of the stream or a document separator is expected");
8820
+ if (state2.position < state2.length - 1) {
8821
+ throwError(state2, "end of the stream or a document separator is expected");
8821
8822
  } else {
8822
8823
  return;
8823
8824
  }
@@ -8833,21 +8834,21 @@ function loadDocuments(input, options) {
8833
8834
  input = input.slice(1);
8834
8835
  }
8835
8836
  }
8836
- var state = new State$1(input, options);
8837
+ var state2 = new State$1(input, options);
8837
8838
  var nullpos = input.indexOf("\0");
8838
8839
  if (nullpos !== -1) {
8839
- state.position = nullpos;
8840
- throwError(state, "null byte is not allowed in input");
8840
+ state2.position = nullpos;
8841
+ throwError(state2, "null byte is not allowed in input");
8841
8842
  }
8842
- state.input += "\0";
8843
- while (state.input.charCodeAt(state.position) === 32) {
8844
- state.lineIndent += 1;
8845
- state.position += 1;
8843
+ state2.input += "\0";
8844
+ while (state2.input.charCodeAt(state2.position) === 32) {
8845
+ state2.lineIndent += 1;
8846
+ state2.position += 1;
8846
8847
  }
8847
- while (state.position < state.length - 1) {
8848
- readDocument(state);
8848
+ while (state2.position < state2.length - 1) {
8849
+ readDocument(state2);
8849
8850
  }
8850
- return state.documents;
8851
+ return state2.documents;
8851
8852
  }
8852
8853
  function loadAll$1(input, iterator, options) {
8853
8854
  if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
@@ -9015,13 +9016,13 @@ function indentString(string, spaces) {
9015
9016
  }
9016
9017
  return result;
9017
9018
  }
9018
- function generateNextLine(state, level) {
9019
- return "\n" + common.repeat(" ", state.indent * level);
9019
+ function generateNextLine(state2, level) {
9020
+ return "\n" + common.repeat(" ", state2.indent * level);
9020
9021
  }
9021
- function testImplicitResolving(state, str2) {
9022
+ function testImplicitResolving(state2, str2) {
9022
9023
  var index, length, type2;
9023
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
9024
- type2 = state.implicitTypes[index];
9024
+ for (index = 0, length = state2.implicitTypes.length; index < length; index += 1) {
9025
+ type2 = state2.implicitTypes[index];
9025
9026
  if (type2.resolve(str2)) {
9026
9027
  return true;
9027
9028
  }
@@ -9123,30 +9124,30 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
9123
9124
  }
9124
9125
  return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
9125
9126
  }
9126
- function writeScalar(state, string, level, iskey, inblock) {
9127
- state.dump = (function() {
9127
+ function writeScalar(state2, string, level, iskey, inblock) {
9128
+ state2.dump = (function() {
9128
9129
  if (string.length === 0) {
9129
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
9130
+ return state2.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
9130
9131
  }
9131
- if (!state.noCompatMode) {
9132
+ if (!state2.noCompatMode) {
9132
9133
  if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
9133
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
9134
+ return state2.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
9134
9135
  }
9135
9136
  }
9136
- var indent = state.indent * Math.max(1, level);
9137
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
9138
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
9137
+ var indent = state2.indent * Math.max(1, level);
9138
+ var lineWidth = state2.lineWidth === -1 ? -1 : Math.max(Math.min(state2.lineWidth, 40), state2.lineWidth - indent);
9139
+ var singleLineOnly = iskey || state2.flowLevel > -1 && level >= state2.flowLevel;
9139
9140
  function testAmbiguity(string2) {
9140
- return testImplicitResolving(state, string2);
9141
+ return testImplicitResolving(state2, string2);
9141
9142
  }
9142
9143
  switch (chooseScalarStyle(
9143
9144
  string,
9144
9145
  singleLineOnly,
9145
- state.indent,
9146
+ state2.indent,
9146
9147
  lineWidth,
9147
9148
  testAmbiguity,
9148
- state.quotingType,
9149
- state.forceQuotes && !iskey,
9149
+ state2.quotingType,
9150
+ state2.forceQuotes && !iskey,
9150
9151
  inblock
9151
9152
  )) {
9152
9153
  case STYLE_PLAIN:
@@ -9154,9 +9155,9 @@ function writeScalar(state, string, level, iskey, inblock) {
9154
9155
  case STYLE_SINGLE:
9155
9156
  return "'" + string.replace(/'/g, "''") + "'";
9156
9157
  case STYLE_LITERAL:
9157
- return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
9158
+ return "|" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(string, indent));
9158
9159
  case STYLE_FOLDED:
9159
- return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
9160
+ return ">" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
9160
9161
  case STYLE_DOUBLE:
9161
9162
  return '"' + escapeString(string) + '"';
9162
9163
  default:
@@ -9232,133 +9233,133 @@ function escapeString(string) {
9232
9233
  }
9233
9234
  return result;
9234
9235
  }
9235
- function writeFlowSequence(state, level, object) {
9236
- var _result = "", _tag = state.tag, index, length, value;
9236
+ function writeFlowSequence(state2, level, object) {
9237
+ var _result = "", _tag = state2.tag, index, length, value;
9237
9238
  for (index = 0, length = object.length; index < length; index += 1) {
9238
9239
  value = object[index];
9239
- if (state.replacer) {
9240
- value = state.replacer.call(object, String(index), value);
9240
+ if (state2.replacer) {
9241
+ value = state2.replacer.call(object, String(index), value);
9241
9242
  }
9242
- if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
9243
- if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
9244
- _result += state.dump;
9243
+ if (writeNode(state2, level, value, false, false) || typeof value === "undefined" && writeNode(state2, level, null, false, false)) {
9244
+ if (_result !== "") _result += "," + (!state2.condenseFlow ? " " : "");
9245
+ _result += state2.dump;
9245
9246
  }
9246
9247
  }
9247
- state.tag = _tag;
9248
- state.dump = "[" + _result + "]";
9248
+ state2.tag = _tag;
9249
+ state2.dump = "[" + _result + "]";
9249
9250
  }
9250
- function writeBlockSequence(state, level, object, compact) {
9251
- var _result = "", _tag = state.tag, index, length, value;
9251
+ function writeBlockSequence(state2, level, object, compact) {
9252
+ var _result = "", _tag = state2.tag, index, length, value;
9252
9253
  for (index = 0, length = object.length; index < length; index += 1) {
9253
9254
  value = object[index];
9254
- if (state.replacer) {
9255
- value = state.replacer.call(object, String(index), value);
9255
+ if (state2.replacer) {
9256
+ value = state2.replacer.call(object, String(index), value);
9256
9257
  }
9257
- if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
9258
+ if (writeNode(state2, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state2, level + 1, null, true, true, false, true)) {
9258
9259
  if (!compact || _result !== "") {
9259
- _result += generateNextLine(state, level);
9260
+ _result += generateNextLine(state2, level);
9260
9261
  }
9261
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9262
+ if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
9262
9263
  _result += "-";
9263
9264
  } else {
9264
9265
  _result += "- ";
9265
9266
  }
9266
- _result += state.dump;
9267
+ _result += state2.dump;
9267
9268
  }
9268
9269
  }
9269
- state.tag = _tag;
9270
- state.dump = _result || "[]";
9270
+ state2.tag = _tag;
9271
+ state2.dump = _result || "[]";
9271
9272
  }
9272
- function writeFlowMapping(state, level, object) {
9273
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
9273
+ function writeFlowMapping(state2, level, object) {
9274
+ var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
9274
9275
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
9275
9276
  pairBuffer = "";
9276
9277
  if (_result !== "") pairBuffer += ", ";
9277
- if (state.condenseFlow) pairBuffer += '"';
9278
+ if (state2.condenseFlow) pairBuffer += '"';
9278
9279
  objectKey = objectKeyList[index];
9279
9280
  objectValue = object[objectKey];
9280
- if (state.replacer) {
9281
- objectValue = state.replacer.call(object, objectKey, objectValue);
9281
+ if (state2.replacer) {
9282
+ objectValue = state2.replacer.call(object, objectKey, objectValue);
9282
9283
  }
9283
- if (!writeNode(state, level, objectKey, false, false)) {
9284
+ if (!writeNode(state2, level, objectKey, false, false)) {
9284
9285
  continue;
9285
9286
  }
9286
- if (state.dump.length > 1024) pairBuffer += "? ";
9287
- pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
9288
- if (!writeNode(state, level, objectValue, false, false)) {
9287
+ if (state2.dump.length > 1024) pairBuffer += "? ";
9288
+ pairBuffer += state2.dump + (state2.condenseFlow ? '"' : "") + ":" + (state2.condenseFlow ? "" : " ");
9289
+ if (!writeNode(state2, level, objectValue, false, false)) {
9289
9290
  continue;
9290
9291
  }
9291
- pairBuffer += state.dump;
9292
+ pairBuffer += state2.dump;
9292
9293
  _result += pairBuffer;
9293
9294
  }
9294
- state.tag = _tag;
9295
- state.dump = "{" + _result + "}";
9295
+ state2.tag = _tag;
9296
+ state2.dump = "{" + _result + "}";
9296
9297
  }
9297
- function writeBlockMapping(state, level, object, compact) {
9298
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
9299
- if (state.sortKeys === true) {
9298
+ function writeBlockMapping(state2, level, object, compact) {
9299
+ var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
9300
+ if (state2.sortKeys === true) {
9300
9301
  objectKeyList.sort();
9301
- } else if (typeof state.sortKeys === "function") {
9302
- objectKeyList.sort(state.sortKeys);
9303
- } else if (state.sortKeys) {
9302
+ } else if (typeof state2.sortKeys === "function") {
9303
+ objectKeyList.sort(state2.sortKeys);
9304
+ } else if (state2.sortKeys) {
9304
9305
  throw new exception("sortKeys must be a boolean or a function");
9305
9306
  }
9306
9307
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
9307
9308
  pairBuffer = "";
9308
9309
  if (!compact || _result !== "") {
9309
- pairBuffer += generateNextLine(state, level);
9310
+ pairBuffer += generateNextLine(state2, level);
9310
9311
  }
9311
9312
  objectKey = objectKeyList[index];
9312
9313
  objectValue = object[objectKey];
9313
- if (state.replacer) {
9314
- objectValue = state.replacer.call(object, objectKey, objectValue);
9314
+ if (state2.replacer) {
9315
+ objectValue = state2.replacer.call(object, objectKey, objectValue);
9315
9316
  }
9316
- if (!writeNode(state, level + 1, objectKey, true, true, true)) {
9317
+ if (!writeNode(state2, level + 1, objectKey, true, true, true)) {
9317
9318
  continue;
9318
9319
  }
9319
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
9320
+ explicitPair = state2.tag !== null && state2.tag !== "?" || state2.dump && state2.dump.length > 1024;
9320
9321
  if (explicitPair) {
9321
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9322
+ if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
9322
9323
  pairBuffer += "?";
9323
9324
  } else {
9324
9325
  pairBuffer += "? ";
9325
9326
  }
9326
9327
  }
9327
- pairBuffer += state.dump;
9328
+ pairBuffer += state2.dump;
9328
9329
  if (explicitPair) {
9329
- pairBuffer += generateNextLine(state, level);
9330
+ pairBuffer += generateNextLine(state2, level);
9330
9331
  }
9331
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
9332
+ if (!writeNode(state2, level + 1, objectValue, true, explicitPair)) {
9332
9333
  continue;
9333
9334
  }
9334
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
9335
+ if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
9335
9336
  pairBuffer += ":";
9336
9337
  } else {
9337
9338
  pairBuffer += ": ";
9338
9339
  }
9339
- pairBuffer += state.dump;
9340
+ pairBuffer += state2.dump;
9340
9341
  _result += pairBuffer;
9341
9342
  }
9342
- state.tag = _tag;
9343
- state.dump = _result || "{}";
9343
+ state2.tag = _tag;
9344
+ state2.dump = _result || "{}";
9344
9345
  }
9345
- function detectType(state, object, explicit) {
9346
+ function detectType(state2, object, explicit) {
9346
9347
  var _result, typeList, index, length, type2, style;
9347
- typeList = explicit ? state.explicitTypes : state.implicitTypes;
9348
+ typeList = explicit ? state2.explicitTypes : state2.implicitTypes;
9348
9349
  for (index = 0, length = typeList.length; index < length; index += 1) {
9349
9350
  type2 = typeList[index];
9350
9351
  if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
9351
9352
  if (explicit) {
9352
9353
  if (type2.multi && type2.representName) {
9353
- state.tag = type2.representName(object);
9354
+ state2.tag = type2.representName(object);
9354
9355
  } else {
9355
- state.tag = type2.tag;
9356
+ state2.tag = type2.tag;
9356
9357
  }
9357
9358
  } else {
9358
- state.tag = "?";
9359
+ state2.tag = "?";
9359
9360
  }
9360
9361
  if (type2.represent) {
9361
- style = state.styleMap[type2.tag] || type2.defaultStyle;
9362
+ style = state2.styleMap[type2.tag] || type2.defaultStyle;
9362
9363
  if (_toString.call(type2.represent) === "[object Function]") {
9363
9364
  _result = type2.represent(object, style);
9364
9365
  } else if (_hasOwnProperty.call(type2.represent, style)) {
@@ -9366,100 +9367,100 @@ function detectType(state, object, explicit) {
9366
9367
  } else {
9367
9368
  throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
9368
9369
  }
9369
- state.dump = _result;
9370
+ state2.dump = _result;
9370
9371
  }
9371
9372
  return true;
9372
9373
  }
9373
9374
  }
9374
9375
  return false;
9375
9376
  }
9376
- function writeNode(state, level, object, block, compact, iskey, isblockseq) {
9377
- state.tag = null;
9378
- state.dump = object;
9379
- if (!detectType(state, object, false)) {
9380
- detectType(state, object, true);
9377
+ function writeNode(state2, level, object, block, compact, iskey, isblockseq) {
9378
+ state2.tag = null;
9379
+ state2.dump = object;
9380
+ if (!detectType(state2, object, false)) {
9381
+ detectType(state2, object, true);
9381
9382
  }
9382
- var type2 = _toString.call(state.dump);
9383
+ var type2 = _toString.call(state2.dump);
9383
9384
  var inblock = block;
9384
9385
  var tagStr;
9385
9386
  if (block) {
9386
- block = state.flowLevel < 0 || state.flowLevel > level;
9387
+ block = state2.flowLevel < 0 || state2.flowLevel > level;
9387
9388
  }
9388
9389
  var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
9389
9390
  if (objectOrArray) {
9390
- duplicateIndex = state.duplicates.indexOf(object);
9391
+ duplicateIndex = state2.duplicates.indexOf(object);
9391
9392
  duplicate = duplicateIndex !== -1;
9392
9393
  }
9393
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
9394
+ if (state2.tag !== null && state2.tag !== "?" || duplicate || state2.indent !== 2 && level > 0) {
9394
9395
  compact = false;
9395
9396
  }
9396
- if (duplicate && state.usedDuplicates[duplicateIndex]) {
9397
- state.dump = "*ref_" + duplicateIndex;
9397
+ if (duplicate && state2.usedDuplicates[duplicateIndex]) {
9398
+ state2.dump = "*ref_" + duplicateIndex;
9398
9399
  } else {
9399
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
9400
- state.usedDuplicates[duplicateIndex] = true;
9400
+ if (objectOrArray && duplicate && !state2.usedDuplicates[duplicateIndex]) {
9401
+ state2.usedDuplicates[duplicateIndex] = true;
9401
9402
  }
9402
9403
  if (type2 === "[object Object]") {
9403
- if (block && Object.keys(state.dump).length !== 0) {
9404
- writeBlockMapping(state, level, state.dump, compact);
9404
+ if (block && Object.keys(state2.dump).length !== 0) {
9405
+ writeBlockMapping(state2, level, state2.dump, compact);
9405
9406
  if (duplicate) {
9406
- state.dump = "&ref_" + duplicateIndex + state.dump;
9407
+ state2.dump = "&ref_" + duplicateIndex + state2.dump;
9407
9408
  }
9408
9409
  } else {
9409
- writeFlowMapping(state, level, state.dump);
9410
+ writeFlowMapping(state2, level, state2.dump);
9410
9411
  if (duplicate) {
9411
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
9412
+ state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
9412
9413
  }
9413
9414
  }
9414
9415
  } else if (type2 === "[object Array]") {
9415
- if (block && state.dump.length !== 0) {
9416
- if (state.noArrayIndent && !isblockseq && level > 0) {
9417
- writeBlockSequence(state, level - 1, state.dump, compact);
9416
+ if (block && state2.dump.length !== 0) {
9417
+ if (state2.noArrayIndent && !isblockseq && level > 0) {
9418
+ writeBlockSequence(state2, level - 1, state2.dump, compact);
9418
9419
  } else {
9419
- writeBlockSequence(state, level, state.dump, compact);
9420
+ writeBlockSequence(state2, level, state2.dump, compact);
9420
9421
  }
9421
9422
  if (duplicate) {
9422
- state.dump = "&ref_" + duplicateIndex + state.dump;
9423
+ state2.dump = "&ref_" + duplicateIndex + state2.dump;
9423
9424
  }
9424
9425
  } else {
9425
- writeFlowSequence(state, level, state.dump);
9426
+ writeFlowSequence(state2, level, state2.dump);
9426
9427
  if (duplicate) {
9427
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
9428
+ state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
9428
9429
  }
9429
9430
  }
9430
9431
  } else if (type2 === "[object String]") {
9431
- if (state.tag !== "?") {
9432
- writeScalar(state, state.dump, level, iskey, inblock);
9432
+ if (state2.tag !== "?") {
9433
+ writeScalar(state2, state2.dump, level, iskey, inblock);
9433
9434
  }
9434
9435
  } else if (type2 === "[object Undefined]") {
9435
9436
  return false;
9436
9437
  } else {
9437
- if (state.skipInvalid) return false;
9438
+ if (state2.skipInvalid) return false;
9438
9439
  throw new exception("unacceptable kind of an object to dump " + type2);
9439
9440
  }
9440
- if (state.tag !== null && state.tag !== "?") {
9441
+ if (state2.tag !== null && state2.tag !== "?") {
9441
9442
  tagStr = encodeURI(
9442
- state.tag[0] === "!" ? state.tag.slice(1) : state.tag
9443
+ state2.tag[0] === "!" ? state2.tag.slice(1) : state2.tag
9443
9444
  ).replace(/!/g, "%21");
9444
- if (state.tag[0] === "!") {
9445
+ if (state2.tag[0] === "!") {
9445
9446
  tagStr = "!" + tagStr;
9446
9447
  } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
9447
9448
  tagStr = "!!" + tagStr.slice(18);
9448
9449
  } else {
9449
9450
  tagStr = "!<" + tagStr + ">";
9450
9451
  }
9451
- state.dump = tagStr + " " + state.dump;
9452
+ state2.dump = tagStr + " " + state2.dump;
9452
9453
  }
9453
9454
  }
9454
9455
  return true;
9455
9456
  }
9456
- function getDuplicateReferences(object, state) {
9457
+ function getDuplicateReferences(object, state2) {
9457
9458
  var objects = [], duplicatesIndexes = [], index, length;
9458
9459
  inspectNode(object, objects, duplicatesIndexes);
9459
9460
  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
9460
- state.duplicates.push(objects[duplicatesIndexes[index]]);
9461
+ state2.duplicates.push(objects[duplicatesIndexes[index]]);
9461
9462
  }
9462
- state.usedDuplicates = new Array(length);
9463
+ state2.usedDuplicates = new Array(length);
9463
9464
  }
9464
9465
  function inspectNode(object, objects, duplicatesIndexes) {
9465
9466
  var objectKeyList, index, length;
@@ -9486,13 +9487,13 @@ function inspectNode(object, objects, duplicatesIndexes) {
9486
9487
  }
9487
9488
  function dump$1(input, options) {
9488
9489
  options = options || {};
9489
- var state = new State(options);
9490
- if (!state.noRefs) getDuplicateReferences(input, state);
9490
+ var state2 = new State(options);
9491
+ if (!state2.noRefs) getDuplicateReferences(input, state2);
9491
9492
  var value = input;
9492
- if (state.replacer) {
9493
- value = state.replacer.call({ "": value }, "", value);
9493
+ if (state2.replacer) {
9494
+ value = state2.replacer.call({ "": value }, "", value);
9494
9495
  }
9495
- if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
9496
+ if (writeNode(state2, 0, value, true, true)) return state2.dump + "\n";
9496
9497
  return "";
9497
9498
  }
9498
9499
  var dump_1 = dump$1;
@@ -9883,7 +9884,7 @@ function extractRefs(content) {
9883
9884
  }
9884
9885
 
9885
9886
  // src/chat/plan/PlanSummaryCard.tsx
9886
- import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
9887
+ import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
9887
9888
  function PlanSummaryCard({
9888
9889
  messages,
9889
9890
  sessionStatus,
@@ -9898,8 +9899,8 @@ function PlanSummaryCard({
9898
9899
  const isWaitingForInput = sessionStatus === "waiting_for_input";
9899
9900
  const canConfirm = Boolean(onConfirmPlan) && isWaitingForInput && data.lastPauseTool === "ExitPlanMode";
9900
9901
  const openPlanPanel = openPlanPanelAction && sessionId ? () => openPlanPanelAction(sessionId) : void 0;
9901
- return /* @__PURE__ */ jsxs28("div", { className: "flex w-full flex-col gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.55)] p-4", children: [
9902
- /* @__PURE__ */ jsxs28(
9902
+ return /* @__PURE__ */ jsxs29("div", { className: "flex w-full flex-col gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.55)] p-4", children: [
9903
+ /* @__PURE__ */ jsxs29(
9903
9904
  "button",
9904
9905
  {
9905
9906
  type: "button",
@@ -9907,14 +9908,14 @@ function PlanSummaryCard({
9907
9908
  disabled: isHistorical || !openPlanPanel,
9908
9909
  className: "flex w-full flex-col gap-4 text-left transition-colors hover:text-[hsl(var(--foreground))]",
9909
9910
  children: [
9910
- /* @__PURE__ */ jsxs28("div", { className: "flex items-start justify-between gap-3", children: [
9911
- /* @__PURE__ */ jsxs28("div", { className: "min-w-0 space-y-2", children: [
9912
- /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
9911
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-start justify-between gap-3", children: [
9912
+ /* @__PURE__ */ jsxs29("div", { className: "min-w-0 space-y-2", children: [
9913
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
9913
9914
  /* @__PURE__ */ jsx31(Sparkles, { size: 12 }),
9914
9915
  /* @__PURE__ */ jsx31("span", { children: "\u89C4\u5212\u6458\u8981" })
9915
9916
  ] }),
9916
9917
  /* @__PURE__ */ jsx31("div", { className: "truncate text-base font-medium text-[hsl(var(--foreground))]", children: data.intent || "\u5F53\u524D\u89C4\u5212" }),
9917
- /* @__PURE__ */ jsx31("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs28(Fragment13, { children: [
9918
+ /* @__PURE__ */ jsx31("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs29(Fragment13, { children: [
9918
9919
  /* @__PURE__ */ jsx31("span", { className: "rounded-full bg-[hsl(var(--accent))] px-2.5 py-1 text-[hsl(var(--foreground))]", children: summaryState.label }),
9919
9920
  /* @__PURE__ */ jsx31("span", { className: "font-mono tracking-[0.25em] text-[hsl(var(--muted-foreground))]", children: summaryState.dots })
9920
9921
  ] }) : /* @__PURE__ */ jsx31(
@@ -9939,16 +9940,16 @@ function PlanSummaryCard({
9939
9940
  }
9940
9941
  )
9941
9942
  ] }),
9942
- summaryState.kind === "complete" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
9943
- /* @__PURE__ */ jsxs28("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
9943
+ summaryState.kind === "complete" && /* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
9944
+ /* @__PURE__ */ jsxs29("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
9944
9945
  data.selectedSkills.length,
9945
9946
  " \u4E2A\u6280\u80FD"
9946
9947
  ] }),
9947
- /* @__PURE__ */ jsxs28("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
9948
+ /* @__PURE__ */ jsxs29("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
9948
9949
  stepCount,
9949
9950
  " \u4E2A\u6B65\u9AA4"
9950
9951
  ] }),
9951
- !isHistorical && /* @__PURE__ */ jsxs28("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))]", children: [
9952
+ !isHistorical && /* @__PURE__ */ jsxs29("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))]", children: [
9952
9953
  /* @__PURE__ */ jsx31(CircleCheck, { size: 12 }),
9953
9954
  "\u53F3\u4FA7\u67E5\u770B\u8BE6\u60C5"
9954
9955
  ] })
@@ -9971,9 +9972,9 @@ function PlanConfirmationPanel({
9971
9972
  setRevisionText("");
9972
9973
  setIsEditing(false);
9973
9974
  };
9974
- return /* @__PURE__ */ jsxs28("div", { className: "space-y-3 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background)/0.45)] p-3", children: [
9975
- /* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap gap-2", children: [
9976
- /* @__PURE__ */ jsxs28(
9975
+ return /* @__PURE__ */ jsxs29("div", { className: "space-y-3 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background)/0.45)] p-3", children: [
9976
+ /* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap gap-2", children: [
9977
+ /* @__PURE__ */ jsxs29(
9977
9978
  "button",
9978
9979
  {
9979
9980
  type: "button",
@@ -9985,7 +9986,7 @@ function PlanConfirmationPanel({
9985
9986
  ]
9986
9987
  }
9987
9988
  ),
9988
- /* @__PURE__ */ jsxs28(
9989
+ /* @__PURE__ */ jsxs29(
9989
9990
  "button",
9990
9991
  {
9991
9992
  type: "button",
@@ -9998,7 +9999,7 @@ function PlanConfirmationPanel({
9998
9999
  }
9999
10000
  )
10000
10001
  ] }),
10001
- isEditing && /* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
10002
+ isEditing && /* @__PURE__ */ jsxs29("div", { className: "space-y-2", children: [
10002
10003
  /* @__PURE__ */ jsx31(
10003
10004
  "textarea",
10004
10005
  {
@@ -10129,7 +10130,7 @@ import { useEffect as useEffect21, useRef as useRef19 } from "react";
10129
10130
 
10130
10131
  // src/chat/FinalArtifactCards.tsx
10131
10132
  import { useEffect as useEffect20, useRef as useRef18, useState as useState24 } from "react";
10132
- import { Fragment as Fragment14, jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
10133
+ import { Fragment as Fragment14, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
10133
10134
  function basename2(path) {
10134
10135
  return path.split("/").filter(Boolean).pop() || path;
10135
10136
  }
@@ -10150,7 +10151,7 @@ function LinkCard({
10150
10151
  const bladeHost = useBladeHost();
10151
10152
  const host = hostOf(url);
10152
10153
  const local = isLoopbackUrl(url) && Boolean(bladeHost.openPreview);
10153
- const content = /* @__PURE__ */ jsxs29(Fragment14, { children: [
10154
+ const content = /* @__PURE__ */ jsxs30(Fragment14, { children: [
10154
10155
  /* @__PURE__ */ jsx32("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx32(Globe, { size: 15, "aria-hidden": "true" }) }),
10155
10156
  /* @__PURE__ */ jsx32("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx32("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
10156
10157
  /* @__PURE__ */ jsx32(
@@ -10222,7 +10223,7 @@ function FinalArtifactCards({
10222
10223
  const columnCount = Math.min(artifacts.length, 3);
10223
10224
  const gridWidth = columnCount * 180 + Math.max(0, columnCount - 1) * 6;
10224
10225
  if (artifacts.length === 0) return null;
10225
- return /* @__PURE__ */ jsxs29("div", { className: "flex max-w-full flex-col gap-1.5", children: [
10226
+ return /* @__PURE__ */ jsxs30("div", { className: "flex max-w-full flex-col gap-1.5", children: [
10226
10227
  /* @__PURE__ */ jsx32(
10227
10228
  "div",
10228
10229
  {
@@ -10258,7 +10259,7 @@ function FinalArtifactCards({
10258
10259
  )
10259
10260
  }
10260
10261
  ),
10261
- hasMore ? /* @__PURE__ */ jsxs29(
10262
+ hasMore ? /* @__PURE__ */ jsxs30(
10262
10263
  "button",
10263
10264
  {
10264
10265
  type: "button",
@@ -10282,7 +10283,7 @@ function FinalArtifactCards({
10282
10283
  }
10283
10284
 
10284
10285
  // src/chat/PostChatFollowupBlock.tsx
10285
- import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
10286
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
10286
10287
  function PostChatFollowupBlock({
10287
10288
  sessionId,
10288
10289
  followup,
@@ -10304,9 +10305,9 @@ function PostChatFollowupBlock({
10304
10305
  }, [assistantEntryId, emit, sessionId, suggestionCount]);
10305
10306
  if (!followup || !followup.recaption && followup.suggestions.length === 0 && artifacts.length === 0 && !followup.feedback_eligible)
10306
10307
  return null;
10307
- return /* @__PURE__ */ jsxs30("div", { part: "followup", className: "blade-chat-followup flex w-fit max-w-full flex-col gap-4 rounded-xl border border-[hsl(var(--border)/0.75)] bg-[hsl(var(--muted)/0.28)] px-3 py-3 sm:min-w-[340px] sm:max-w-[680px]", children: [
10308
- followup.recaption ? /* @__PURE__ */ jsxs30("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
10309
- /* @__PURE__ */ jsxs30("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
10308
+ return /* @__PURE__ */ jsxs31("div", { part: "followup", className: "blade-chat-followup flex w-fit max-w-full flex-col gap-4 rounded-xl border border-[hsl(var(--border)/0.75)] bg-[hsl(var(--muted)/0.28)] px-3 py-3 sm:min-w-[340px] sm:max-w-[680px]", children: [
10309
+ followup.recaption ? /* @__PURE__ */ jsxs31("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
10310
+ /* @__PURE__ */ jsxs31("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
10310
10311
  /* @__PURE__ */ jsx33(Sparkles, { size: 14, "aria-hidden": "true" }),
10311
10312
  "\u672C\u8F6E\u5C0F\u7ED3"
10312
10313
  ] }),
@@ -10328,9 +10329,9 @@ function PostChatFollowupBlock({
10328
10329
  assistantEntryId
10329
10330
  }
10330
10331
  ) }) : null,
10331
- followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs30("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
10332
+ followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs31("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
10332
10333
  /* @__PURE__ */ jsx33("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
10333
- /* @__PURE__ */ jsx33("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs30(
10334
+ /* @__PURE__ */ jsx33("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs31(
10334
10335
  "button",
10335
10336
  {
10336
10337
  type: "button",
@@ -10375,7 +10376,7 @@ function PostChatFollowupBlock({
10375
10376
 
10376
10377
  // src/chat/RenderErrorBoundary.tsx
10377
10378
  import { Component } from "react";
10378
- import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
10379
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
10379
10380
  function getFirstComponentName(componentStack) {
10380
10381
  const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
10381
10382
  return match?.[1] ?? null;
@@ -10408,14 +10409,14 @@ var RenderErrorBoundary = class extends Component {
10408
10409
  return children;
10409
10410
  }
10410
10411
  const componentName = getFirstComponentName(componentStack);
10411
- return /* @__PURE__ */ jsx34("div", { className: "blade-chat-render-error rounded-xl border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: /* @__PURE__ */ jsxs31("div", { className: "flex items-start gap-2", children: [
10412
+ return /* @__PURE__ */ jsx34("div", { className: "blade-chat-render-error rounded-xl border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: /* @__PURE__ */ jsxs32("div", { className: "flex items-start gap-2", children: [
10412
10413
  /* @__PURE__ */ jsx34(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--swf-warning))]" }),
10413
- /* @__PURE__ */ jsxs31("div", { className: "min-w-0 flex-1", children: [
10414
- /* @__PURE__ */ jsxs31("div", { className: "font-medium", children: [
10414
+ /* @__PURE__ */ jsxs32("div", { className: "min-w-0 flex-1", children: [
10415
+ /* @__PURE__ */ jsxs32("div", { className: "font-medium", children: [
10415
10416
  label,
10416
10417
  "\u6E32\u67D3\u5931\u8D25"
10417
10418
  ] }),
10418
- /* @__PURE__ */ jsxs31("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
10419
+ /* @__PURE__ */ jsxs32("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
10419
10420
  componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
10420
10421
  error.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
10421
10422
  ] }),
@@ -10427,7 +10428,7 @@ var RenderErrorBoundary = class extends Component {
10427
10428
 
10428
10429
  // src/chat/TurnNavRail.tsx
10429
10430
  import { useCallback as useCallback12, useEffect as useEffect22, useLayoutEffect as useLayoutEffect4, useRef as useRef20, useState as useState25 } from "react";
10430
- import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
10431
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
10431
10432
  var PANEL_MAX_HEIGHT = 448;
10432
10433
  var PANEL_MARGIN = 16;
10433
10434
  function clippingAncestor(element) {
@@ -10572,8 +10573,8 @@ function TurnNavRail({
10572
10573
  setPanelOpen(false);
10573
10574
  setHoveredTurnId(null);
10574
10575
  },
10575
- children: /* @__PURE__ */ jsxs32("div", { className: "flex flex-col items-end", children: [
10576
- /* @__PURE__ */ jsxs32(
10576
+ children: /* @__PURE__ */ jsxs33("div", { className: "flex flex-col items-end", children: [
10577
+ /* @__PURE__ */ jsxs33(
10577
10578
  "div",
10578
10579
  {
10579
10580
  ref: markerRef,
@@ -10621,7 +10622,7 @@ function TurnNavRail({
10621
10622
  ]
10622
10623
  }
10623
10624
  ),
10624
- error ? /* @__PURE__ */ jsxs32(
10625
+ error ? /* @__PURE__ */ jsxs33(
10625
10626
  "div",
10626
10627
  {
10627
10628
  role: "alert",
@@ -10671,6 +10672,104 @@ function TurnNavRail({
10671
10672
  );
10672
10673
  }
10673
10674
 
10675
+ // src/chat/turn-locate-channel.ts
10676
+ import { useEffect as useEffect23, useState as useState26 } from "react";
10677
+ var state = {};
10678
+ var statusState = {};
10679
+ var seqCounter = 0;
10680
+ var listeners = /* @__PURE__ */ new Set();
10681
+ function setState(update) {
10682
+ const next = update(state);
10683
+ if (next === state) return;
10684
+ state = next;
10685
+ for (const listener of [...listeners]) listener();
10686
+ }
10687
+ function setStatus(update) {
10688
+ const next = update(statusState);
10689
+ if (next === statusState) return;
10690
+ statusState = next;
10691
+ for (const listener of [...listeners]) listener();
10692
+ }
10693
+ var turnLocateChannel = {
10694
+ getState: () => state,
10695
+ getStatus: () => statusState,
10696
+ request(sessionId, entryId) {
10697
+ seqCounter += 1;
10698
+ const seq2 = seqCounter;
10699
+ setState((current) => ({ ...current, [sessionId]: { entryId, seq: seq2 } }));
10700
+ setStatus((current) => ({ ...current, [sessionId]: { seq: seq2, entryId, state: "pending" } }));
10701
+ },
10702
+ /** 执行侧回传进度;只有最新一次请求的结果会被接受。 */
10703
+ report(sessionId, seq2, state2) {
10704
+ setStatus((current) => {
10705
+ const entry = current[sessionId];
10706
+ if (!entry || entry.seq !== seq2) return current;
10707
+ return { ...current, [sessionId]: { ...entry, state: state2 } };
10708
+ });
10709
+ },
10710
+ /** 定位完成(成功):清掉进度,面板不再显示「正在定位」。 */
10711
+ clearStatus(sessionId, seq2) {
10712
+ setStatus((current) => {
10713
+ const entry = current[sessionId];
10714
+ if (!entry || entry.seq !== seq2) return current;
10715
+ const next = { ...current };
10716
+ delete next[sessionId];
10717
+ return next;
10718
+ });
10719
+ },
10720
+ subscribe(listener) {
10721
+ listeners.add(listener);
10722
+ return () => {
10723
+ listeners.delete(listener);
10724
+ };
10725
+ },
10726
+ /** 某条信令已被消费:同 seq 不再重复定位(避免重新挂载时又跳一次)。 */
10727
+ consume(sessionId, seq2) {
10728
+ setState((current) => {
10729
+ const request = current[sessionId];
10730
+ if (!request || request.seq !== seq2) return current;
10731
+ const next = { ...current };
10732
+ delete next[sessionId];
10733
+ return next;
10734
+ });
10735
+ },
10736
+ /** 只清进度、不动未消费的请求(列表卸载时用)。 */
10737
+ clearStatusForSession(sessionId) {
10738
+ setStatus((current) => {
10739
+ if (!(sessionId in current)) return current;
10740
+ const next = { ...current };
10741
+ delete next[sessionId];
10742
+ return next;
10743
+ });
10744
+ },
10745
+ clearSession(sessionId) {
10746
+ setState((current) => {
10747
+ if (!(sessionId in current)) return current;
10748
+ const next = { ...current };
10749
+ delete next[sessionId];
10750
+ return next;
10751
+ });
10752
+ },
10753
+ reset() {
10754
+ setState(() => ({}));
10755
+ setStatus(() => ({}));
10756
+ }
10757
+ };
10758
+ function useTurnLocateRequest(sessionId) {
10759
+ const [request, setRequest] = useState26(null);
10760
+ useEffect23(() => {
10761
+ if (!sessionId) {
10762
+ setRequest(null);
10763
+ return;
10764
+ }
10765
+ setRequest(turnLocateChannel.getState()[sessionId] ?? null);
10766
+ return turnLocateChannel.subscribe(() => {
10767
+ setRequest(turnLocateChannel.getState()[sessionId] ?? null);
10768
+ });
10769
+ }, [sessionId]);
10770
+ return request;
10771
+ }
10772
+
10674
10773
  // src/chat/scroll-anchor.ts
10675
10774
  var ENTRY_SCROLL_MARGIN_PX = 24;
10676
10775
  function calculateStickyAwareMargin(statusHeight = 0, statusBottomGap = 0) {
@@ -10726,7 +10825,7 @@ function calculateAnimatedScrollTop({
10726
10825
  }
10727
10826
 
10728
10827
  // src/chat/MessageList.tsx
10729
- import { Fragment as Fragment15, jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
10828
+ import { Fragment as Fragment15, jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
10730
10829
  function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
10731
10830
  if (isStopping) return false;
10732
10831
  const hasContent = message?.content != null && message.content.length > 0;
@@ -10815,9 +10914,9 @@ function MessageListBody({
10815
10914
  }) {
10816
10915
  const messages = Array.isArray(rawMessages) ? rawMessages : [];
10817
10916
  const session = useSessionHandle(sessionId);
10818
- const agentLoops = useSessionState(sessionId, (state) => state.agentLoops);
10819
- const askAnswers = useSessionState(sessionId, (state) => state.askAnswers);
10820
- const stateIsStreaming = useSessionState(sessionId, (state) => state.isStreaming);
10917
+ const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
10918
+ const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
10919
+ const stateIsStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
10821
10920
  const sessionIsStreaming = streamingOverride ?? stateIsStreaming;
10822
10921
  const isPreparing = sessionIsStreaming && isPreparingReply(messages);
10823
10922
  const agentLoopNameSet = useMemo15(() => new Set(Object.keys(agentLoops ?? {})), [agentLoops]);
@@ -10843,10 +10942,10 @@ function MessageListBody({
10843
10942
  isStopping
10844
10943
  );
10845
10944
  const isRevealingAny = contentReveal.isRevealing || reasoningReveal.isRevealing;
10846
- useEffect23(() => {
10945
+ useEffect24(() => {
10847
10946
  onRevealingChange?.(isRevealingAny);
10848
10947
  }, [isRevealingAny, onRevealingChange]);
10849
- useEffect23(() => {
10948
+ useEffect24(() => {
10850
10949
  if (isStopping) {
10851
10950
  contentReveal.flushNow();
10852
10951
  reasoningReveal.flushNow();
@@ -10962,9 +11061,9 @@ function MessageListBody({
10962
11061
  const observedLatestUserStableIdRef = useRef21(
10963
11062
  latestUserIsOptimistic ? null : latestUserStableId
10964
11063
  );
10965
- const [activeTurnId, setActiveTurnId] = useState26(lastTurnId);
10966
- const [virtualScrollMargin, setVirtualScrollMargin] = useState26(0);
10967
- const [scrollContainerElement, setScrollContainerElement] = useState26(null);
11064
+ const [activeTurnId, setActiveTurnId] = useState27(lastTurnId);
11065
+ const [virtualScrollMargin, setVirtualScrollMargin] = useState27(0);
11066
+ const [scrollContainerElement, setScrollContainerElement] = useState27(null);
10968
11067
  const loadingOlderRef = useRef21(false);
10969
11068
  const virtualizationEnabled = Boolean(useChatEnvironment().useVirtualizer);
10970
11069
  const stablePrefixEnd = useMemo15(
@@ -11026,6 +11125,51 @@ function MessageListBody({
11026
11125
  stickContextRef.current?.stopScroll();
11027
11126
  }
11028
11127
  });
11128
+ const outlineLocateRequest = useTurnLocateRequest(isSharedSession ? null : sessionId);
11129
+ const consumedLocateSeq = useRef21(0);
11130
+ const outlineLocateRef = useRef21(null);
11131
+ const navLoadingEntryIdRef = useRef21(navLoadingEntryId);
11132
+ navLoadingEntryIdRef.current = navLoadingEntryId;
11133
+ useEffect24(() => {
11134
+ if (!outlineLocateRequest) return;
11135
+ if (outlineLocateRequest.seq <= consumedLocateSeq.current) return;
11136
+ consumedLocateSeq.current = outlineLocateRequest.seq;
11137
+ const { seq: seq2 } = outlineLocateRequest;
11138
+ outlineLocateRef.current = { seq: seq2, entryId: outlineLocateRequest.entryId };
11139
+ selectNavEntry(outlineLocateRequest.entryId);
11140
+ turnLocateChannel.consume(sessionId, seq2);
11141
+ const frame = window.requestAnimationFrame(() => {
11142
+ if (outlineLocateRef.current?.seq !== seq2) return;
11143
+ if (navLoadingEntryIdRef.current !== null) return;
11144
+ turnLocateChannel.clearStatus(sessionId, seq2);
11145
+ outlineLocateRef.current = null;
11146
+ });
11147
+ return () => window.cancelAnimationFrame(frame);
11148
+ }, [outlineLocateRequest, selectNavEntry, sessionId]);
11149
+ useEffect24(() => {
11150
+ const pending = outlineLocateRef.current;
11151
+ if (!pending) return;
11152
+ if (navError) {
11153
+ turnLocateChannel.report(sessionId, pending.seq, "failed");
11154
+ outlineLocateRef.current = null;
11155
+ return;
11156
+ }
11157
+ const frame = window.requestAnimationFrame(() => {
11158
+ if (outlineLocateRef.current?.seq !== pending.seq) return;
11159
+ if (navLoadingEntryId !== null) return;
11160
+ turnLocateChannel.clearStatus(sessionId, pending.seq);
11161
+ outlineLocateRef.current = null;
11162
+ });
11163
+ return () => window.cancelAnimationFrame(frame);
11164
+ }, [navError, navLoadingEntryId, sessionId]);
11165
+ useEffect24(() => {
11166
+ return () => {
11167
+ const pending = outlineLocateRef.current;
11168
+ if (!pending) return;
11169
+ turnLocateChannel.clearStatus(sessionId, pending.seq);
11170
+ outlineLocateRef.current = null;
11171
+ };
11172
+ }, [sessionId]);
11029
11173
  const activeViewportEntryId = useMemo15(() => {
11030
11174
  if (!activeTurnId) return null;
11031
11175
  const blockIndex = turnIdToBlockIndex.get(activeTurnId);
@@ -11105,7 +11249,7 @@ function MessageListBody({
11105
11249
  measureActiveTurn();
11106
11250
  });
11107
11251
  });
11108
- useEffect23(() => {
11252
+ useEffect24(() => {
11109
11253
  void historyLoadRevision;
11110
11254
  scrollContainerRef.current = stickContextRef.current?.scrollRef.current ?? findScrollContainer(containerRef.current);
11111
11255
  const sc = scrollContainerRef.current;
@@ -11297,7 +11441,7 @@ function MessageListBody({
11297
11441
  previousStablePrefixEndRef.current = stablePrefixEnd;
11298
11442
  boundaryAnchorRef.current = captureBoundaryAnchor();
11299
11443
  }, [captureBoundaryAnchor, stablePrefixEnd]);
11300
- useEffect23(() => {
11444
+ useEffect24(() => {
11301
11445
  scheduleMeasure();
11302
11446
  }, [lastTurnId, layoutSignature]);
11303
11447
  const stopNewTurnScrollAnimation = useCallback13(() => {
@@ -11368,7 +11512,7 @@ function MessageListBody({
11368
11512
  placeLatestUserAtTop(anchorId);
11369
11513
  });
11370
11514
  });
11371
- useEffect23(() => {
11515
+ useEffect24(() => {
11372
11516
  const observer = new ResizeObserver((entries) => {
11373
11517
  for (const entry of entries) {
11374
11518
  const element = entry.target;
@@ -11504,14 +11648,14 @@ function MessageListBody({
11504
11648
  }
11505
11649
  }
11506
11650
  }, [stopNewTurnScrollAnimation]);
11507
- useEffect23(
11651
+ useEffect24(
11508
11652
  () => () => {
11509
11653
  cancelPendingNewTurnScroll();
11510
11654
  stopNewTurnScrollAnimation();
11511
11655
  },
11512
11656
  [cancelPendingNewTurnScroll, stopNewTurnScrollAnimation]
11513
11657
  );
11514
- useEffect23(() => {
11658
+ useEffect24(() => {
11515
11659
  const container = scrollContainerElement;
11516
11660
  if (!container) return;
11517
11661
  const handleScroll = () => {
@@ -11526,7 +11670,7 @@ function MessageListBody({
11526
11670
  container.addEventListener("scroll", handleScroll, { passive: true });
11527
11671
  return () => container.removeEventListener("scroll", handleScroll);
11528
11672
  }, [scrollContainerElement, releaseNewTurnPin]);
11529
- useEffect23(() => {
11673
+ useEffect24(() => {
11530
11674
  if (!effectiveNewUserMessageKey) {
11531
11675
  const acknowledgedSameTarget = newTurnPinActiveRef.current && latestUserStableId != null && observedLatestUserStableIdRef.current === latestUserStableId;
11532
11676
  observedLatestUserStableIdRef.current = latestUserStableId;
@@ -11562,7 +11706,7 @@ function MessageListBody({
11562
11706
  releaseNewTurnPin,
11563
11707
  sessionIsStreaming
11564
11708
  ]);
11565
- useEffect23(() => {
11709
+ useEffect24(() => {
11566
11710
  scheduleNewTurnSpacerUpdate();
11567
11711
  return () => {
11568
11712
  if (newTurnSpacerFrameRef.current != null) {
@@ -11571,11 +11715,11 @@ function MessageListBody({
11571
11715
  }
11572
11716
  };
11573
11717
  }, [layoutSignature]);
11574
- useEffect23(() => {
11718
+ useEffect24(() => {
11575
11719
  if (!newTurnPinActiveRef.current) return;
11576
11720
  scheduleNewTurnSpacerUpdate();
11577
11721
  }, [contentReveal.displayedText, reasoningReveal.displayedText]);
11578
- useEffect23(() => () => {
11722
+ useEffect24(() => () => {
11579
11723
  if (startScrollFrameRef.current != null) {
11580
11724
  window.cancelAnimationFrame(startScrollFrameRef.current);
11581
11725
  startScrollFrameRef.current = null;
@@ -11595,7 +11739,7 @@ function MessageListBody({
11595
11739
  appliedStartScrollKeyRef.current = null;
11596
11740
  appliedEntryScrollKeyRef.current = null;
11597
11741
  }, []);
11598
- useEffect23(() => {
11742
+ useEffect24(() => {
11599
11743
  if (!scrollToStartKey || !hasMessages) {
11600
11744
  if (startScrollFrameRef.current != null) window.cancelAnimationFrame(startScrollFrameRef.current);
11601
11745
  if (startScrollTimeoutRef.current != null) window.clearTimeout(startScrollTimeoutRef.current);
@@ -11667,7 +11811,7 @@ function MessageListBody({
11667
11811
  },
11668
11812
  [scrollEntryId]
11669
11813
  );
11670
- useEffect23(() => {
11814
+ useEffect24(() => {
11671
11815
  if (appliedEntryScrollKeyRef.current !== scrollEntryId) {
11672
11816
  if (entryScrollFrameRef.current != null) window.cancelAnimationFrame(entryScrollFrameRef.current);
11673
11817
  for (const timeoutId of entryScrollTimeoutRefs.current) window.clearTimeout(timeoutId);
@@ -11719,7 +11863,7 @@ function MessageListBody({
11719
11863
  stablePrefixEnd,
11720
11864
  virtualizer
11721
11865
  ]);
11722
- return /* @__PURE__ */ jsxs33(
11866
+ return /* @__PURE__ */ jsxs34(
11723
11867
  "div",
11724
11868
  {
11725
11869
  ref: containerRef,
@@ -11738,7 +11882,7 @@ function MessageListBody({
11738
11882
  failedTurnId: navFailedEntryId
11739
11883
  }
11740
11884
  ) : null,
11741
- /* @__PURE__ */ jsxs33(
11885
+ /* @__PURE__ */ jsxs34(
11742
11886
  StickToBottom,
11743
11887
  {
11744
11888
  contextRef: stickContextRef,
@@ -11747,7 +11891,7 @@ function MessageListBody({
11747
11891
  resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
11748
11892
  targetScrollTop: shouldAnchorEntry ? getAnchorTargetScrollTop : void 0,
11749
11893
  children: [
11750
- /* @__PURE__ */ jsxs33(
11894
+ /* @__PURE__ */ jsxs34(
11751
11895
  StickToBottom.Content,
11752
11896
  {
11753
11897
  part: "messages-scroll",
@@ -11860,37 +12004,41 @@ function MessageListContent({
11860
12004
  };
11861
12005
  const RenderBlockView = (block, globalBlockIndex) => {
11862
12006
  if (block.type === "message") {
11863
- return /* @__PURE__ */ jsx36(
12007
+ const sourceTitle = packEventTitle2(block.message);
12008
+ return /* @__PURE__ */ jsxs34(
11864
12009
  "div",
11865
12010
  {
11866
12011
  id: block.anchorId ?? void 0,
11867
12012
  "data-entry-id": block.message.entry_id,
11868
12013
  className: "msg-animate scroll-mt-6",
11869
- children: isBackgroundWakeMessage3(block.message) ? /* @__PURE__ */ jsx36(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx36(
11870
- customization.components.UserMessage,
11871
- {
11872
- message: block.message,
11873
- className: customization.classNames?.userMessage
11874
- }
11875
- ) : /* @__PURE__ */ jsx36(
11876
- UserMessageBubble,
11877
- {
11878
- message: block.message,
11879
- className: customization?.classNames?.userMessage
11880
- }
11881
- ) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx36(
11882
- customization.components.ErrorMessage,
11883
- {
11884
- message: block.message,
11885
- className: customization.classNames?.errorMessage
11886
- }
11887
- ) : /* @__PURE__ */ jsx36(
11888
- ErrorMessageBlock,
11889
- {
11890
- message: block.message,
11891
- className: customization?.classNames?.errorMessage
11892
- }
11893
- ) : null
12014
+ children: [
12015
+ sourceTitle && /* @__PURE__ */ jsx36(PackEventNotice, { title: sourceTitle }),
12016
+ isBackgroundWakeMessage3(block.message) ? /* @__PURE__ */ jsx36(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx36(
12017
+ customization.components.UserMessage,
12018
+ {
12019
+ message: block.message,
12020
+ className: customization.classNames?.userMessage
12021
+ }
12022
+ ) : /* @__PURE__ */ jsx36(
12023
+ UserMessageBubble,
12024
+ {
12025
+ message: block.message,
12026
+ className: customization?.classNames?.userMessage
12027
+ }
12028
+ ) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx36(
12029
+ customization.components.ErrorMessage,
12030
+ {
12031
+ message: block.message,
12032
+ className: customization.classNames?.errorMessage
12033
+ }
12034
+ ) : /* @__PURE__ */ jsx36(
12035
+ ErrorMessageBlock,
12036
+ {
12037
+ message: block.message,
12038
+ className: customization?.classNames?.errorMessage
12039
+ }
12040
+ ) : null
12041
+ ]
11894
12042
  }
11895
12043
  );
11896
12044
  }
@@ -11907,7 +12055,7 @@ function MessageListContent({
11907
12055
  const isHistoricalPlan = globalBlockIndex !== latestPlanCardBlockIndex;
11908
12056
  const blockFeedback = displayMessages.map((message) => message.entry_id && resultFeedbackByEntry.get(message.entry_id)).find((feedback) => feedback != null);
11909
12057
  const isActiveFollowup = block.anchorId === followupTurnId;
11910
- return /* @__PURE__ */ jsxs33(
12058
+ return /* @__PURE__ */ jsxs34(
11911
12059
  "div",
11912
12060
  {
11913
12061
  ref: getTurnElementRef(block.anchorId),
@@ -11999,7 +12147,7 @@ function MessageListContent({
11999
12147
  const renderMeasuredRow = (block, globalBlockIndex, virtualItem) => {
12000
12148
  const persistentId = getRenderBlockPersistentId(block);
12001
12149
  const isVirtual = virtualItem !== void 0;
12002
- return /* @__PURE__ */ jsxs33(
12150
+ return /* @__PURE__ */ jsxs34(
12003
12151
  "div",
12004
12152
  {
12005
12153
  ref: getMeasuredRowRef(block, globalBlockIndex, isVirtual),
@@ -12030,8 +12178,8 @@ function MessageListContent({
12030
12178
  {
12031
12179
  part: "messages-content",
12032
12180
  className: `blade-chat-messages-content mx-auto max-w-[748px] ${customization?.classNames?.messageListContent ?? ""}`,
12033
- children: /* @__PURE__ */ jsxs33("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
12034
- renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx36(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx36(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs33(
12181
+ children: /* @__PURE__ */ jsxs34("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
12182
+ renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx36(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx36(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs34(
12035
12183
  "div",
12036
12184
  {
12037
12185
  part: "empty",
@@ -12042,7 +12190,7 @@ function MessageListContent({
12042
12190
  /* @__PURE__ */ jsx36("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
12043
12191
  ]
12044
12192
  }
12045
- ) : /* @__PURE__ */ jsxs33(Fragment15, { children: [
12193
+ ) : /* @__PURE__ */ jsxs34(Fragment15, { children: [
12046
12194
  stablePrefixEnd > 0 ? /* @__PURE__ */ jsx36(
12047
12195
  "div",
12048
12196
  {
@@ -12066,14 +12214,14 @@ function MessageListContent({
12066
12214
  );
12067
12215
  }
12068
12216
  function HistoryLoadingPlaceholder() {
12069
- return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
12070
- /* @__PURE__ */ jsxs33("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
12217
+ return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
12218
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
12071
12219
  /* @__PURE__ */ jsx36("span", { className: "size-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }),
12072
12220
  /* @__PURE__ */ jsx36("span", { children: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD\u8BB0\u5F55\u2026" })
12073
12221
  ] }),
12074
- [0, 1].map((index) => /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-4", children: [
12222
+ [0, 1].map((index) => /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-4", children: [
12075
12223
  /* @__PURE__ */ jsx36("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx36("div", { className: "h-10 w-2/5 animate-pulse rounded-2xl bg-[hsl(var(--muted))]" }) }),
12076
- /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2.5", children: [
12224
+ /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-2.5", children: [
12077
12225
  /* @__PURE__ */ jsx36("div", { className: "h-4 w-1/3 animate-pulse rounded bg-[hsl(var(--muted))]" }),
12078
12226
  /* @__PURE__ */ jsx36("div", { className: "h-4 w-4/5 animate-pulse rounded bg-[hsl(var(--muted))]" }),
12079
12227
  /* @__PURE__ */ jsx36("div", { className: "h-4 w-3/5 animate-pulse rounded bg-[hsl(var(--muted))]" })
@@ -12084,7 +12232,7 @@ function HistoryLoadingPlaceholder() {
12084
12232
  function ScrollToBottomButton({ onBeforeScroll }) {
12085
12233
  const { isAtBottom, scrollToBottom } = useStickToBottomContext();
12086
12234
  if (isAtBottom) return null;
12087
- return /* @__PURE__ */ jsxs33(
12235
+ return /* @__PURE__ */ jsxs34(
12088
12236
  "button",
12089
12237
  {
12090
12238
  type: "button",
@@ -12104,9 +12252,9 @@ function ScrollToBottomButton({ onBeforeScroll }) {
12104
12252
  }
12105
12253
  function PlanningDivider({ kind }) {
12106
12254
  const isEnter = kind === "enter";
12107
- return /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 py-1", children: [
12255
+ return /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-3 py-1", children: [
12108
12256
  /* @__PURE__ */ jsx36("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
12109
- /* @__PURE__ */ jsxs33("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-3 py-1 text-[11px] text-[hsl(var(--swf-warning))]", children: [
12257
+ /* @__PURE__ */ jsxs34("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-3 py-1 text-[11px] text-[hsl(var(--swf-warning))]", children: [
12110
12258
  /* @__PURE__ */ jsx36(Lightbulb, { size: 12 }),
12111
12259
  /* @__PURE__ */ jsx36("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
12112
12260
  ] }),
@@ -12121,14 +12269,14 @@ function MessageList(props) {
12121
12269
  }
12122
12270
 
12123
12271
  // src/chat/runtime/use-chat-actions.ts
12124
- import { useCallback as useCallback14, useEffect as useEffect24, useRef as useRef22, useState as useState27 } from "react";
12272
+ import { useCallback as useCallback14, useEffect as useEffect25, useRef as useRef22, useState as useState28 } from "react";
12125
12273
  function useChatActions(sessionId) {
12126
12274
  const source = useSessionSource();
12127
12275
  const session = useSessionHandle(sessionId);
12128
- const isStreaming = useSessionState(sessionId, (state) => state.isStreaming);
12129
- const [isStopping, setIsStopping] = useState27(false);
12130
- const [queueNotice, setQueueNotice] = useState27(null);
12131
- const [pendingQueueItemId, setPendingQueueItemId] = useState27(null);
12276
+ const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
12277
+ const [isStopping, setIsStopping] = useState28(false);
12278
+ const [queueNotice, setQueueNotice] = useState28(null);
12279
+ const [pendingQueueItemId, setPendingQueueItemId] = useState28(null);
12132
12280
  const previousSessionIdRef = useRef22(sessionId);
12133
12281
  const send = useCallback14(
12134
12282
  (msg, targetMode, askuserAnswer, options) => source.whenReady ? source.whenReady(sessionId, (ready) => sendToSession(ready, msg, targetMode, askuserAnswer, options)) : session ? sendToSession(session, msg, targetMode, askuserAnswer, options) : Promise.resolve(false),
@@ -12193,7 +12341,7 @@ function useChatActions(sessionId) {
12193
12341
  setIsStopping(false);
12194
12342
  }
12195
12343
  }, [isStopping, session, sessionId, source]);
12196
- useEffect24(() => {
12344
+ useEffect25(() => {
12197
12345
  if (previousSessionIdRef.current !== sessionId) {
12198
12346
  previousSessionIdRef.current = sessionId;
12199
12347
  setIsStopping(false);
@@ -12224,8 +12372,8 @@ import { useCallback as useCallback15 } from "react";
12224
12372
  function useSessionReplay(sessionId) {
12225
12373
  const environment = useChatEnvironment();
12226
12374
  const session = useSessionHandle(sessionId);
12227
- const replay = useSessionState(sessionId, (state) => state.replay);
12228
- const viewerRole = useSessionState(sessionId, (state) => state.viewerRole);
12375
+ const replay = useSessionState(sessionId, (state2) => state2.replay);
12376
+ const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
12229
12377
  const isReplay = replay?.isReplay ?? false;
12230
12378
  const canControl = viewerRole !== "viewer";
12231
12379
  const setSpeed = useCallback15(
@@ -12279,7 +12427,7 @@ function SessionReplayBar({
12279
12427
  }
12280
12428
 
12281
12429
  // src/chat/ChatPanel.tsx
12282
- import { Fragment as Fragment16, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
12430
+ import { Fragment as Fragment16, jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
12283
12431
  function nextQueuedOrder(items, itemId, delta) {
12284
12432
  const pending = items.filter((item) => item.status === "pending");
12285
12433
  const index = pending.findIndex((item) => item.id === itemId);
@@ -12333,21 +12481,21 @@ function ChatPanel({
12333
12481
  const scopedEnvironment = useMemo16(() => ({ ...environment, renderMode }), [environment, renderMode]);
12334
12482
  const DeveloperMessageList = environment.DeveloperMessageList;
12335
12483
  const agentSession = useSessionHandle(sessionId);
12336
- const messages = useSessionState(sessionId, (state) => state.messages);
12337
- const isStreaming = useSessionState(sessionId, (state) => state.isStreaming);
12338
- const queue = useSessionState(sessionId, (state) => state.queue);
12339
- const turns = useSessionState(sessionId, (state) => state.turns);
12340
- const stateMode = useSessionState(sessionId, (state) => state.mode);
12341
- const connection = useSessionState(sessionId, (state) => state.connection);
12342
- const stateStatus = useSessionState(sessionId, (state) => state.status);
12343
- const viewerRole = useSessionState(sessionId, (state) => state.viewerRole);
12344
- const stateError = useSessionState(sessionId, (state) => state.errorMessage);
12345
- const nextBefore = useSessionState(sessionId, (state) => state.nextBefore);
12346
- const historyLoadingOlder = useSessionState(sessionId, (state) => state.loadingOlder);
12347
- const historyLoadRevision = useSessionState(sessionId, (state) => state.historyRevision);
12348
- const historyRewriteRevision = useSessionState(sessionId, (state) => state.timelineRevision);
12349
- const activeCompaction = useSessionState(sessionId, (state) => state.activeCompaction);
12350
- const compactionPending = useSessionState(sessionId, (state) => state.compactionPending);
12484
+ const messages = useSessionState(sessionId, (state2) => state2.messages);
12485
+ const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
12486
+ const queue = useSessionState(sessionId, (state2) => state2.queue);
12487
+ const turns = useSessionState(sessionId, (state2) => state2.turns);
12488
+ const stateMode = useSessionState(sessionId, (state2) => state2.mode);
12489
+ const connection = useSessionState(sessionId, (state2) => state2.connection);
12490
+ const stateStatus = useSessionState(sessionId, (state2) => state2.status);
12491
+ const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
12492
+ const stateError = useSessionState(sessionId, (state2) => state2.errorMessage);
12493
+ const nextBefore = useSessionState(sessionId, (state2) => state2.nextBefore);
12494
+ const historyLoadingOlder = useSessionState(sessionId, (state2) => state2.loadingOlder);
12495
+ const historyLoadRevision = useSessionState(sessionId, (state2) => state2.historyRevision);
12496
+ const historyRewriteRevision = useSessionState(sessionId, (state2) => state2.timelineRevision);
12497
+ const activeCompaction = useSessionState(sessionId, (state2) => state2.activeCompaction);
12498
+ const compactionPending = useSessionState(sessionId, (state2) => state2.compactionPending);
12351
12499
  const {
12352
12500
  isStopping,
12353
12501
  send,
@@ -12361,12 +12509,12 @@ function ChatPanel({
12361
12509
  deliverQueuedMessage,
12362
12510
  resumeQueue
12363
12511
  } = useChatActions(sessionId);
12364
- const [isRevealing, setIsRevealing] = useState28(false);
12512
+ const [isRevealing, setIsRevealing] = useState29(false);
12365
12513
  const isStreamingDisplay = isStreaming || isRevealing;
12366
12514
  const detail = useChatSessionDetail(sessionId);
12367
12515
  const { isReplay } = useSessionReplay(sessionId);
12368
12516
  const isLoadingHistory = useIsSessionHistoryLoading(sessionId);
12369
- const [queuePanelVisible, setQueuePanelVisible] = useState28(false);
12517
+ const [queuePanelVisible, setQueuePanelVisible] = useState29(false);
12370
12518
  const loadOlder = useCallback16(
12371
12519
  async (beforeCommit) => {
12372
12520
  if (!agentSession) return false;
@@ -12376,11 +12524,11 @@ function ChatPanel({
12376
12524
  },
12377
12525
  [agentSession]
12378
12526
  );
12379
- const [paginationActivation, setPaginationActivation] = useState28(() => ({
12527
+ const [paginationActivation, setPaginationActivation] = useState29(() => ({
12380
12528
  sessionId,
12381
12529
  activated: Boolean(nextBefore)
12382
12530
  }));
12383
- useEffect25(() => {
12531
+ useEffect26(() => {
12384
12532
  setPaginationActivation((current) => {
12385
12533
  if (current.sessionId !== sessionId) {
12386
12534
  return { sessionId, activated: Boolean(nextBefore) };
@@ -12397,8 +12545,8 @@ function ChatPanel({
12397
12545
  const isViewer = (viewerRole ?? detail?.viewer_role) === "viewer";
12398
12546
  const isCompacting = activeCompaction != null || compactionPending;
12399
12547
  const postChatFollowup = useMemo16(() => latestPostChatFollowup(turns), [turns]);
12400
- const [resultFeedback, setResultFeedback] = useState28([]);
12401
- useEffect25(() => {
12548
+ const [resultFeedback, setResultFeedback] = useState29([]);
12549
+ useEffect26(() => {
12402
12550
  setResultFeedback([]);
12403
12551
  if (isViewer || !sessionId) return;
12404
12552
  let cancelled = false;
@@ -12527,14 +12675,14 @@ function ChatPanel({
12527
12675
  initialDraftKey,
12528
12676
  lite
12529
12677
  };
12530
- return /* @__PURE__ */ jsx38(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx38(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx38(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx38(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx38(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */ jsxs34(
12678
+ return /* @__PURE__ */ jsx38(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx38(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx38(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx38(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx38(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */ jsxs35(
12531
12679
  "div",
12532
12680
  {
12533
12681
  "data-theme": theme,
12534
12682
  part: "root",
12535
12683
  className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
12536
12684
  children: [
12537
- isViewer && /* @__PURE__ */ jsxs34(
12685
+ isViewer && /* @__PURE__ */ jsxs35(
12538
12686
  "div",
12539
12687
  {
12540
12688
  className: cn(
@@ -12550,7 +12698,7 @@ function ChatPanel({
12550
12698
  !isViewer && /* @__PURE__ */ jsx38(ConnectionBanner, { connection }),
12551
12699
  banner,
12552
12700
  /* @__PURE__ */ jsx38(SessionReplayBar, { sessionId, onExit: onExitReplay }),
12553
- errorMessage && /* @__PURE__ */ jsxs34(
12701
+ errorMessage && /* @__PURE__ */ jsxs35(
12554
12702
  "div",
12555
12703
  {
12556
12704
  part: "error-bar",
@@ -12633,7 +12781,7 @@ function ChatPanel({
12633
12781
  className: cn("mx-auto w-full max-w-3xl px-5 pb-3", classNames?.chatInputInner)
12634
12782
  }
12635
12783
  ) : null,
12636
- !isViewer && /* @__PURE__ */ jsxs34(Fragment16, { children: [
12784
+ !isViewer && /* @__PURE__ */ jsxs35(Fragment16, { children: [
12637
12785
  /* @__PURE__ */ jsx38(
12638
12786
  SessionQueuePanel,
12639
12787
  {
@@ -12664,14 +12812,14 @@ function ChatPanel({
12664
12812
  }
12665
12813
 
12666
12814
  // src/components/SessionPluginSelector.tsx
12667
- import { useEffect as useEffect26, useState as useState29 } from "react";
12668
- import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
12815
+ import { useEffect as useEffect27, useState as useState30 } from "react";
12816
+ import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
12669
12817
  function SessionPluginSelector(props) {
12670
12818
  return /* @__PURE__ */ jsx39(PluginSelectorState, { ...props }, props.sessionId);
12671
12819
  }
12672
12820
  function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
12673
- const [open, setOpen] = useState29(false);
12674
- return /* @__PURE__ */ jsxs35("div", { className: `relative text-xs ${className ?? ""}`, children: [
12821
+ const [open, setOpen] = useState30(false);
12822
+ return /* @__PURE__ */ jsxs36("div", { className: `relative text-xs ${className ?? ""}`, children: [
12675
12823
  /* @__PURE__ */ jsx39(
12676
12824
  "button",
12677
12825
  {
@@ -12694,10 +12842,10 @@ function PluginSelectorList({
12694
12842
  }) {
12695
12843
  const controller = useSessionPluginActivation({ client, sessionId, onChange });
12696
12844
  const { reload } = controller;
12697
- useEffect26(() => {
12845
+ useEffect27(() => {
12698
12846
  reload();
12699
12847
  }, [reload]);
12700
- return /* @__PURE__ */ jsxs35(
12848
+ return /* @__PURE__ */ jsxs36(
12701
12849
  "div",
12702
12850
  {
12703
12851
  className: `absolute left-0 z-40 my-2 max-h-72 w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-3 text-[hsl(var(--popover-foreground))] shadow-lg ${side === "top" ? "bottom-full" : "top-full"}`,
@@ -12727,13 +12875,13 @@ function PluginSelectorList({
12727
12875
  }
12728
12876
 
12729
12877
  // src/components/AgentChat.tsx
12730
- import { Fragment as Fragment17, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
12878
+ import { Fragment as Fragment17, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
12731
12879
  function isUnauthorizedError(error) {
12732
12880
  return error instanceof BladeApiError && error.status === 401;
12733
12881
  }
12734
12882
  function LoginCard({ client, onLoggedIn }) {
12735
- const [loggingIn, setLoggingIn] = useState30(false);
12736
- const [loginError, setLoginError] = useState30(null);
12883
+ const [loggingIn, setLoggingIn] = useState31(false);
12884
+ const [loginError, setLoginError] = useState31(null);
12737
12885
  const handleLogin = async () => {
12738
12886
  setLoggingIn(true);
12739
12887
  setLoginError(null);
@@ -12746,7 +12894,7 @@ function LoginCard({ client, onLoggedIn }) {
12746
12894
  setLoggingIn(false);
12747
12895
  }
12748
12896
  };
12749
- return /* @__PURE__ */ jsx40("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs36("div", { className: "flex w-full max-w-sm flex-col items-center gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-6 py-8 text-center", children: [
12897
+ return /* @__PURE__ */ jsx40("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs37("div", { className: "flex w-full max-w-sm flex-col items-center gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-6 py-8 text-center", children: [
12750
12898
  /* @__PURE__ */ jsx40(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
12751
12899
  /* @__PURE__ */ jsx40("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
12752
12900
  /* @__PURE__ */ jsx40("div", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u767B\u5F55\u540E\u5373\u53EF\u4E0E\u667A\u80FD\u4F53\u5BF9\u8BDD\uFF0C\u4F60\u7684\u4F1A\u8BDD\u5185\u5BB9\u4EC5\u81EA\u5DF1\u53EF\u89C1\u3002" }),
@@ -12765,8 +12913,8 @@ function LoginCard({ client, onLoggedIn }) {
12765
12913
  }
12766
12914
  function AgentChat(props) {
12767
12915
  const client = useBladeClient();
12768
- const [attempt, setAttempt] = useState30(0);
12769
- const [needLogin, setNeedLogin] = useState30(() => !client.hasToken());
12916
+ const [attempt, setAttempt] = useState31(0);
12917
+ const [needLogin, setNeedLogin] = useState31(() => !client.hasToken());
12770
12918
  if (needLogin) {
12771
12919
  return /* @__PURE__ */ jsx40(
12772
12920
  "div",
@@ -12806,38 +12954,38 @@ function ChatSessionView({
12806
12954
  }) {
12807
12955
  const client = useBladeClient();
12808
12956
  const host = useBladeHost();
12809
- const { session, state, error } = useAgentSession(sessionId, {
12957
+ const { session, state: state2, error } = useAgentSession(sessionId, {
12810
12958
  createOptions,
12811
12959
  onSessionCreated
12812
12960
  });
12813
12961
  const replay = useReplay(session);
12814
- const [notice, setNotice] = useState30(null);
12815
- const source = useSingleSessionSource(session, !session || state === null);
12962
+ const [notice, setNotice] = useState31(null);
12963
+ const source = useSingleSessionSource(session, !session || state2 === null);
12816
12964
  const resolvedSessionId = session?.sessionId;
12817
- const isViewer = state?.viewerRole === "viewer";
12818
- const replaySpeed = state?.replay?.speed;
12819
- const replaying = state?.replay?.isReplay;
12820
- useEffect27(() => {
12965
+ const isViewer = state2?.viewerRole === "viewer";
12966
+ const replaySpeed = state2?.replay?.speed;
12967
+ const replaying = state2?.replay?.isReplay;
12968
+ useEffect28(() => {
12821
12969
  setNotice(null);
12822
12970
  }, [resolvedSessionId, replaySpeed, replaying]);
12823
12971
  const onSessionReadyRef = useRef23(onSessionReady);
12824
12972
  const readySessionRef = useRef23(null);
12825
12973
  const hasOnSessionReady = onSessionReady !== void 0;
12826
- useEffect27(() => {
12974
+ useEffect28(() => {
12827
12975
  onSessionReadyRef.current = onSessionReady;
12828
12976
  }, [onSessionReady]);
12829
- useEffect27(() => {
12977
+ useEffect28(() => {
12830
12978
  const handler = onSessionReadyRef.current;
12831
12979
  if (!session || !hasOnSessionReady || !handler || readySessionRef.current === session) return;
12832
12980
  readySessionRef.current = session;
12833
12981
  handler(session);
12834
12982
  }, [session, hasOnSessionReady]);
12835
- useEffect27(() => {
12983
+ useEffect28(() => {
12836
12984
  if (isUnauthorizedError(error)) {
12837
12985
  onUnauthorized();
12838
12986
  }
12839
12987
  }, [error, onUnauthorized]);
12840
- useEffect27(() => {
12988
+ useEffect28(() => {
12841
12989
  if (!session || !commands) return;
12842
12990
  const unsubscribes = Object.entries(commands).map(
12843
12991
  ([action, handler]) => session.onCommand(action, (payload) => handler(payload))
@@ -12870,7 +13018,7 @@ function ChatSessionView({
12870
13018
  onFollowupInteraction,
12871
13019
  errorMessage: connectError ?? replay.error?.message ?? notice,
12872
13020
  onExitReplay: () => void replay.exitToAutonomous(),
12873
- banner: /* @__PURE__ */ jsxs36(Fragment17, { children: [
13021
+ banner: /* @__PURE__ */ jsxs37(Fragment17, { children: [
12874
13022
  resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx40(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
12875
13023
  /* @__PURE__ */ jsx40(ReplayMismatchPrompt, { mismatch: replay.mismatch })
12876
13024
  ] })
@@ -12880,20 +13028,20 @@ function ChatSessionView({
12880
13028
 
12881
13029
  // src/components/LlmChat.tsx
12882
13030
  import { chatErrorForDisplay as chatErrorForDisplay4 } from "@blade-hq/agent-client/internal";
12883
- import { useEffect as useEffect28, useMemo as useMemo19, useState as useState33 } from "react";
13031
+ import { useEffect as useEffect29, useMemo as useMemo19, useState as useState34 } from "react";
12884
13032
 
12885
13033
  // src/hooks/use-llm-chat.ts
12886
- import { useCallback as useCallback17, useMemo as useMemo18, useRef as useRef24, useState as useState31 } from "react";
13034
+ import { useCallback as useCallback17, useMemo as useMemo18, useRef as useRef24, useState as useState32 } from "react";
12887
13035
  var DEFAULT_HISTORY_TURNS = 12;
12888
13036
  var DEFAULT_MAX_TOOL_ROUNDS = 4;
12889
13037
  var syntheticIdSeq = 0;
12890
13038
  function useLlmChat(options) {
12891
- const [history, setHistory] = useState31([]);
12892
- const [streamingText, setStreamingText] = useState31(null);
12893
- const [streamingCalls, setStreamingCalls] = useState31([]);
12894
- const [failedToolIds, setFailedToolIds] = useState31([]);
12895
- const [error, setError] = useState31(null);
12896
- const [isStreaming, setIsStreaming] = useState31(false);
13039
+ const [history, setHistory] = useState32([]);
13040
+ const [streamingText, setStreamingText] = useState32(null);
13041
+ const [streamingCalls, setStreamingCalls] = useState32([]);
13042
+ const [failedToolIds, setFailedToolIds] = useState32([]);
13043
+ const [error, setError] = useState32(null);
13044
+ const [isStreaming, setIsStreaming] = useState32(false);
12897
13045
  const abortRef = useRef24(null);
12898
13046
  const activeStartedAtRef = useRef24(null);
12899
13047
  const assistantTimingsRef = useRef24(/* @__PURE__ */ new WeakMap());
@@ -13239,8 +13387,8 @@ function toToolCallInfo(call, results, failedToolIds) {
13239
13387
  }
13240
13388
 
13241
13389
  // src/components/LlmAdvancedSettings.tsx
13242
- import { useState as useState32 } from "react";
13243
- import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
13390
+ import { useState as useState33 } from "react";
13391
+ import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
13244
13392
  var FIELDS = [
13245
13393
  { id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
13246
13394
  { id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
@@ -13286,13 +13434,13 @@ function writeOverride(settings, baseURL, override) {
13286
13434
  }
13287
13435
  function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
13288
13436
  const normalized = normalizeAdvanced(settings);
13289
- const [open, setOpen] = useState32(false);
13290
- const [draft, setDraft] = useState32(override);
13437
+ const [open, setOpen] = useState33(false);
13438
+ const [draft, setDraft] = useState33(override);
13291
13439
  if (!normalized) return null;
13292
13440
  const fields = FIELDS.filter((field) => normalized[field.id]);
13293
13441
  const dirty = Object.keys(override).length > 0;
13294
- return /* @__PURE__ */ jsxs37("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
13295
- /* @__PURE__ */ jsxs37(
13442
+ return /* @__PURE__ */ jsxs38("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
13443
+ /* @__PURE__ */ jsxs38(
13296
13444
  "button",
13297
13445
  {
13298
13446
  type: "button",
@@ -13308,8 +13456,8 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
13308
13456
  ]
13309
13457
  }
13310
13458
  ),
13311
- open && /* @__PURE__ */ jsxs37("div", { className: "mt-2 flex flex-col gap-2", children: [
13312
- fields.map((field) => /* @__PURE__ */ jsxs37("label", { className: "flex flex-col gap-1", children: [
13459
+ open && /* @__PURE__ */ jsxs38("div", { className: "mt-2 flex flex-col gap-2", children: [
13460
+ fields.map((field) => /* @__PURE__ */ jsxs38("label", { className: "flex flex-col gap-1", children: [
13313
13461
  /* @__PURE__ */ jsx41("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
13314
13462
  /* @__PURE__ */ jsx41(
13315
13463
  "input",
@@ -13323,7 +13471,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
13323
13471
  )
13324
13472
  ] }, field.id)),
13325
13473
  normalized.apiKey && /* @__PURE__ */ jsx41("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u5BC6\u94A5\u4F1A\u5B58\u5728\u8FD9\u53F0\u6D4F\u89C8\u5668\u91CC\u3002\u53EA\u5728\u4F60\u4FE1\u5F97\u8FC7\u8FD9\u53F0\u673A\u5668\u65F6\u586B\u3002" }),
13326
- /* @__PURE__ */ jsxs37("div", { className: "flex gap-2", children: [
13474
+ /* @__PURE__ */ jsxs38("div", { className: "flex gap-2", children: [
13327
13475
  /* @__PURE__ */ jsx41(
13328
13476
  "button",
13329
13477
  {
@@ -13358,7 +13506,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
13358
13506
  }
13359
13507
 
13360
13508
  // src/components/LlmChat.tsx
13361
- import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
13509
+ import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
13362
13510
  function LlmChat({
13363
13511
  classNames,
13364
13512
  renderers,
@@ -13370,12 +13518,12 @@ function LlmChat({
13370
13518
  onOverrideChange,
13371
13519
  ...options
13372
13520
  }) {
13373
- const [override, setOverride] = useState33(() => readOverride(advanced, options.baseURL));
13521
+ const [override, setOverride] = useState34(() => readOverride(advanced, options.baseURL));
13374
13522
  const effective = { ...options, ...override };
13375
13523
  const { messages, isStreaming, error, send, stop, reset } = useLlmChat(effective);
13376
- const [inputText, setInputText] = useState33("");
13377
- const [stopRequested, setStopRequested] = useState33(false);
13378
- const [isRevealing, setIsRevealing] = useState33(false);
13524
+ const [inputText, setInputText] = useState34("");
13525
+ const [stopRequested, setStopRequested] = useState34(false);
13526
+ const [isRevealing, setIsRevealing] = useState34(false);
13379
13527
  const isStreamingDisplay = isStreaming || isRevealing;
13380
13528
  const handle = useMemo19(
13381
13529
  () => ({
@@ -13386,18 +13534,18 @@ ${text}` : text),
13386
13534
  }),
13387
13535
  [send, reset]
13388
13536
  );
13389
- useEffect28(() => {
13537
+ useEffect29(() => {
13390
13538
  onReady?.(handle);
13391
13539
  }, [handle, onReady]);
13392
13540
  const customization = useMemo19(() => ({ classNames, renderers }), [classNames, renderers]);
13393
- return /* @__PURE__ */ jsx42(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs38(
13541
+ return /* @__PURE__ */ jsx42(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs39(
13394
13542
  "div",
13395
13543
  {
13396
13544
  "data-theme": theme,
13397
13545
  part: "root",
13398
13546
  className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
13399
13547
  children: [
13400
- error ? /* @__PURE__ */ jsxs38(
13548
+ error ? /* @__PURE__ */ jsxs39(
13401
13549
  "div",
13402
13550
  {
13403
13551
  part: "error-bar",
@@ -13487,8 +13635,8 @@ function ChatView(props) {
13487
13635
  }
13488
13636
 
13489
13637
  // src/components/TopicAssetSubmitDialog.tsx
13490
- import { useRef as useRef25, useState as useState34 } from "react";
13491
- import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
13638
+ import { useRef as useRef25, useState as useState35 } from "react";
13639
+ import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
13492
13640
  function useTopicAssetSubmissionAccess(sessionId) {
13493
13641
  const client = useBladeClient();
13494
13642
  return useAsyncValue(sessionId, async (signal) => {
@@ -13504,12 +13652,12 @@ function useTopicAssetSubmissionAccess(sessionId) {
13504
13652
  }
13505
13653
  function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted }) {
13506
13654
  const client = useBladeClient();
13507
- const [folder, setFolder] = useState34("");
13508
- const [message, setMessage] = useState34("");
13509
- const [error, setError] = useState34(null);
13510
- const [busy, setBusy] = useState34(false);
13655
+ const [folder, setFolder] = useState35("");
13656
+ const [message, setMessage] = useState35("");
13657
+ const [error, setError] = useState35(null);
13658
+ const [busy, setBusy] = useState35(false);
13511
13659
  const submitting = useRef25(false);
13512
- const [revision, setRevision] = useState34(0);
13660
+ const [revision, setRevision] = useState35(0);
13513
13661
  const assets = useAsyncValue(`${sessionId}:${topicId}:${revision}`, async () => {
13514
13662
  const [session, groups, result] = await Promise.all([
13515
13663
  client.sessions.getSession(sessionId),
@@ -13546,32 +13694,32 @@ function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted
13546
13694
  };
13547
13695
  return /* @__PURE__ */ jsx44(Dialog, { open: true, onOpenChange: (open) => {
13548
13696
  if (!open && !busy) onClose();
13549
- }, children: /* @__PURE__ */ jsxs39(DialogContent, { className: "max-w-md", children: [
13697
+ }, children: /* @__PURE__ */ jsxs40(DialogContent, { className: "max-w-md", children: [
13550
13698
  /* @__PURE__ */ jsx44(DialogTitle, { children: "\u63D0\u4EA4\u5230\u8D44\u4EA7" }),
13551
13699
  /* @__PURE__ */ jsx44(DialogDescription, { children: "\u5C06\u6587\u4EF6\u590D\u5236\u5230\u5DE5\u4F5C\u7A7A\u95F4\u4F9B\u6210\u5458\u4F7F\u7528\uFF0C\u5DE5\u4F5C\u533A\u539F\u6587\u4EF6\u4F1A\u4FDD\u7559\u3002\u540C\u540D\u8D44\u4EA7\u4F1A\u88AB\u66FF\u6362\u3002" }),
13552
- /* @__PURE__ */ jsxs39("form", { onSubmit: (event) => {
13700
+ /* @__PURE__ */ jsxs40("form", { onSubmit: (event) => {
13553
13701
  event.preventDefault();
13554
13702
  void submit();
13555
13703
  }, className: "flex flex-col gap-4", children: [
13556
13704
  /* @__PURE__ */ jsx44("p", { className: "break-all text-sm text-secondary-foreground", children: path }),
13557
- /* @__PURE__ */ jsxs39("label", { className: "flex flex-col gap-1 text-sm", children: [
13705
+ /* @__PURE__ */ jsxs40("label", { className: "flex flex-col gap-1 text-sm", children: [
13558
13706
  "\u76EE\u6807\u6587\u4EF6\u5939",
13559
- /* @__PURE__ */ jsxs39("select", { "aria-label": "\u76EE\u6807\u6587\u4EF6\u5939", value: folder, onChange: (event) => setFolder(event.target.value), disabled: busy || !assets.data, className: "rounded-md border border-border bg-background p-2", children: [
13707
+ /* @__PURE__ */ jsxs40("select", { "aria-label": "\u76EE\u6807\u6587\u4EF6\u5939", value: folder, onChange: (event) => setFolder(event.target.value), disabled: busy || !assets.data, className: "rounded-md border border-border bg-background p-2", children: [
13560
13708
  /* @__PURE__ */ jsx44("option", { value: "", children: "\u8D44\u4EA7\u6839\u76EE\u5F55" }),
13561
13709
  assets.data?.map((item) => /* @__PURE__ */ jsx44("option", { value: item, children: item }, item))
13562
13710
  ] })
13563
13711
  ] }),
13564
- /* @__PURE__ */ jsxs39("label", { className: "flex flex-col gap-1 text-sm", children: [
13712
+ /* @__PURE__ */ jsxs40("label", { className: "flex flex-col gap-1 text-sm", children: [
13565
13713
  "\u8BF4\u660E\uFF08\u53EF\u9009\uFF09",
13566
13714
  /* @__PURE__ */ jsx44("textarea", { "aria-label": "\u63D0\u4EA4\u8BF4\u660E", value: message, onChange: (event) => setMessage(event.target.value), maxLength: 1e3, disabled: busy, className: "min-h-20 rounded-md border border-border bg-background p-2" })
13567
13715
  ] }),
13568
- assets.error ? /* @__PURE__ */ jsxs39("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
13716
+ assets.error ? /* @__PURE__ */ jsxs40("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
13569
13717
  assets.error instanceof Error ? assets.error.message : "\u8D44\u4EA7\u52A0\u8F7D\u5931\u8D25",
13570
13718
  " ",
13571
13719
  /* @__PURE__ */ jsx44("button", { type: "button", onClick: () => setRevision((n) => n + 1), className: "underline", children: "\u91CD\u8BD5" })
13572
13720
  ] }) : !assets.data ? /* @__PURE__ */ jsx44("output", { className: "text-sm text-muted-foreground", children: "\u6B63\u5728\u52A0\u8F7D\u8D44\u4EA7\u2026" }) : null,
13573
13721
  error ? /* @__PURE__ */ jsx44("p", { role: "alert", className: "text-sm text-muted-foreground", children: error }) : null,
13574
- /* @__PURE__ */ jsxs39("div", { className: "flex justify-end gap-2", children: [
13722
+ /* @__PURE__ */ jsxs40("div", { className: "flex justify-end gap-2", children: [
13575
13723
  /* @__PURE__ */ jsx44("button", { type: "button", disabled: busy, onClick: onClose, className: "rounded-md border border-border px-3 py-2 text-sm", children: "\u53D6\u6D88" }),
13576
13724
  /* @__PURE__ */ jsx44("button", { type: "submit", disabled: busy || !assets.data, className: "rounded-md bg-primary px-3 py-2 text-sm text-primary-foreground disabled:opacity-50", children: busy ? "\u63D0\u4EA4\u4E2D\u2026" : "\u63D0\u4EA4" })
13577
13725
  ] })
@@ -13619,4 +13767,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
13619
13767
  js-yaml/dist/js-yaml.mjs:
13620
13768
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
13621
13769
  */
13622
- //# sourceMappingURL=chunk-XP6T6SHZ.js.map
13770
+ //# sourceMappingURL=chunk-66JXSDLB.js.map