@blade-hq/agent-react 2612.0.0-beta.20 → 2612.0.0-beta.22

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.
@@ -19,7 +19,6 @@ import {
19
19
  CircleCheck,
20
20
  CirclePause,
21
21
  CircleSlash,
22
- CircleX,
23
22
  Copy,
24
23
  CurrentChatSessionProvider,
25
24
  Dialog,
@@ -113,7 +112,7 @@ import {
113
112
  useSessionSource,
114
113
  useSessionState,
115
114
  useSingleSessionSource
116
- } from "./chunk-C4FUFBG4.js";
115
+ } from "./chunk-PPREDKQ2.js";
117
116
  import {
118
117
  __export
119
118
  } from "./chunk-PR4QN5HX.js";
@@ -469,10 +468,10 @@ function ReplayMismatchPrompt({ mismatch, className }) {
469
468
 
470
469
  // src/components/AgentChat.tsx
471
470
  import { BladeApiError as BladeApiError2 } from "@blade-hq/agent-client/internal";
472
- import { useEffect as useEffect31, useMemo as useMemo18, useRef as useRef29, useState as useState37 } from "react";
471
+ import { useEffect as useEffect31, useMemo as useMemo18, useRef as useRef29, useState as useState36 } from "react";
473
472
 
474
473
  // src/chat/ChatPanel.tsx
475
- import { useCallback as useCallback17, useEffect as useEffect29, useMemo as useMemo17, useState as useState35 } from "react";
474
+ import { useCallback as useCallback17, useEffect as useEffect29, useMemo as useMemo17, useState as useState34 } from "react";
476
475
  import {
477
476
  chatErrorForDisplay as chatErrorForDisplay3,
478
477
  latestPostChatFollowup
@@ -26543,6 +26542,9 @@ function BackgroundWakeNotice() {
26543
26542
  );
26544
26543
  }
26545
26544
 
26545
+ // src/chat/AssistantTurnBlock.tsx
26546
+ import { getServerTime } from "@blade-hq/agent-client/internal";
26547
+
26546
26548
  // src/components/MessageImage.tsx
26547
26549
  import { forwardRef, useEffect as useEffect7, useImperativeHandle, useRef as useRef8, useState as useState8 } from "react";
26548
26550
  import { jsx as jsx11 } from "react/jsx-runtime";
@@ -39903,7 +39905,7 @@ function formatExecutionDuration(durationMs) {
39903
39905
  function getExecutionDurationMs({
39904
39906
  messages,
39905
39907
  isStreaming,
39906
- now = Date.now()
39908
+ now = null
39907
39909
  }) {
39908
39910
  const knownDuration = messages.reduce(
39909
39911
  (total, message) => {
@@ -39917,7 +39919,7 @@ function getExecutionDurationMs({
39917
39919
  },
39918
39920
  0
39919
39921
  );
39920
- if (!isStreaming) return knownDuration;
39922
+ if (!isStreaming || now === null) return knownDuration;
39921
39923
  const startedAt = messages.map((message) => message.timestamp ? Date.parse(message.timestamp) : Number.NaN).filter((value) => Number.isFinite(value)).sort((a, b2) => a - b2)[0];
39922
39924
  if (startedAt === void 0) return knownDuration;
39923
39925
  return Math.max(knownDuration, now - startedAt);
@@ -40171,19 +40173,25 @@ function AssistantTurnBlockBase({
40171
40173
  (message) => message.status === "failed" && !hasRenderableMessageContent(message)
40172
40174
  );
40173
40175
  const hasExecutionProcess = detailToolCalls.length > 0 || workflowRunToolCalls.length > 0 || persistentAskUserQuestions.length > 0 || messages.some((message) => Boolean(message.reasoning)) || resourceBlocks.length > 0;
40176
+ const client = useOptionalBladeClient();
40174
40177
  const executionDurationMs = getExecutionDurationMs({
40175
40178
  // 根消息的 duration 已覆盖等待子智能体的墙钟时间,不能再累计 turnMessages
40176
40179
  // 里收集到的子循环,否则嵌套和并行 Agent 都会重复计时。
40177
40180
  messages,
40178
40181
  isStreaming
40179
40182
  });
40180
- const [clock, setClock] = useState23(() => Date.now());
40183
+ const [clock, setClock] = useState23(() => performance.now());
40181
40184
  useEffect17(() => {
40182
40185
  if (!isStreaming) return;
40183
- const timer = window.setInterval(() => setClock(Date.now()), 1e3);
40186
+ const timer = window.setInterval(() => setClock(performance.now()), 1e3);
40184
40187
  return () => window.clearInterval(timer);
40185
40188
  }, [isStreaming]);
40186
- const liveExecutionDurationMs = isStreaming ? getExecutionDurationMs({ messages, isStreaming, now: clock }) : executionDurationMs;
40189
+ const liveExecutionDurationMs = isStreaming ? getExecutionDurationMs({
40190
+ messages,
40191
+ isStreaming,
40192
+ // Direct LLM mode has no Blade session and generates its own local timestamps.
40193
+ now: sessionId ? getServerTime(client, clock) : Date.now()
40194
+ }) : executionDurationMs;
40187
40195
  const observedMemoryRefs = useMemo11(() => collectMemoryRefs(messages), [messages]);
40188
40196
  const [cachedMemoryRefs, setCachedMemoryRefs] = useState23([]);
40189
40197
  useEffect17(() => {
@@ -42010,7 +42018,7 @@ import {
42010
42018
  useLayoutEffect as useLayoutEffect7,
42011
42019
  useMemo as useMemo16,
42012
42020
  useRef as useRef27,
42013
- useState as useState33
42021
+ useState as useState32
42014
42022
  } from "react";
42015
42023
 
42016
42024
  // ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
@@ -46019,160 +46027,12 @@ function extractPlanMessagesForTurn(messages, turnLastMessage) {
46019
46027
  return extractLatestPlanMessages(messages.slice(enterIndex, endIndex));
46020
46028
  }
46021
46029
 
46022
- // src/chat/CompactionCard.tsx
46023
- import { useState as useState30 } from "react";
46024
- import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
46025
- var PERCENT_FORMATTER = new Intl.NumberFormat("zh-CN", {
46026
- style: "percent",
46027
- maximumFractionDigits: 0
46028
- });
46029
- function formatTokens(value) {
46030
- if (typeof value !== "number" || !Number.isFinite(value)) {
46031
- return "0";
46032
- }
46033
- const k = value / 1e3;
46034
- if (k < 1) {
46035
- return `${Math.round(value)}`;
46036
- }
46037
- return k < 10 ? `${k.toFixed(1)}k` : `${Math.round(k)}k`;
46038
- }
46039
- function formatSavedRatio(value) {
46040
- if (typeof value !== "number" || !Number.isFinite(value)) {
46041
- return "0%";
46042
- }
46043
- return PERCENT_FORMATTER.format(Math.max(0, Math.min(1, value)));
46044
- }
46045
- function shortId(compactionId) {
46046
- if (!compactionId) {
46047
- return "------";
46048
- }
46049
- return compactionId.slice(0, 6);
46050
- }
46051
- function getArchivedToolLabel(item) {
46052
- return item.tool_name?.trim() || "\u5DE5\u5177\u8C03\u7528";
46053
- }
46054
- function getArchivePath(item, files) {
46055
- if (item.archive_path) {
46056
- return item.archive_path;
46057
- }
46058
- return files.find((file2) => file2.tool_name === item.tool_name)?.relative_path ?? null;
46059
- }
46060
- function isGenericArchiveSummary(summary) {
46061
- return /^已归档\s*\d+\s*个大型工具结果。?$/.test(summary?.trim() ?? "");
46062
- }
46063
- function CompactionCard({
46064
- sessionId,
46065
- compaction,
46066
- status
46067
- }) {
46068
- const session = useSessionHandle(sessionId);
46069
- const activeCompaction = useSessionState(sessionId, (state) => state.activeCompaction);
46070
- const source = compaction ? {
46071
- ...compaction,
46072
- status: status ?? "completed"
46073
- } : activeCompaction;
46074
- const [expanded, setExpanded] = useState30(false);
46075
- if (!source || !source.compaction_id) {
46076
- return null;
46077
- }
46078
- const canCancel = source.status === "streaming";
46079
- const archivedFiles = source.archived_files ?? [];
46080
- const archivedToolCalls = source.archived_tool_calls ?? [];
46081
- const archivedCount = source.archived_count ?? archivedToolCalls.length ?? archivedFiles.length;
46082
- const hasSummary = typeof source.summary_full === "string" && source.summary_full.trim().length > 0 && !isGenericArchiveSummary(source.summary_full);
46083
- const hasFailureReason = source.status === "failed" && Boolean(source.failure_reason);
46084
- const canExpand = source.status === "completed" && (hasSummary || archivedToolCalls.length > 0) || hasFailureReason;
46085
- return /* @__PURE__ */ jsxs38("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
46086
- /* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between gap-2", children: [
46087
- /* @__PURE__ */ jsxs38(
46088
- "button",
46089
- {
46090
- type: "button",
46091
- onClick: () => canExpand && setExpanded((prev) => !prev),
46092
- className: cn(
46093
- "inline-flex min-w-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-[hsl(var(--muted-foreground))]/65 transition-colors hover:bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]",
46094
- !canExpand && "cursor-default hover:bg-transparent hover:text-[hsl(var(--muted-foreground))]/65"
46095
- ),
46096
- "aria-expanded": expanded,
46097
- children: [
46098
- canExpand ? expanded ? /* @__PURE__ */ jsx44(ChevronDown, { size: 12, className: "shrink-0" }) : /* @__PURE__ */ jsx44(ChevronRight, { size: 12, className: "shrink-0" }) : null,
46099
- /* @__PURE__ */ jsx44("span", { children: source.status === "streaming" ? /* @__PURE__ */ jsxs38("span", { className: "inline-flex items-center gap-1", children: [
46100
- /* @__PURE__ */ jsx44(LoaderCircle, { size: 12, className: "animate-spin" }),
46101
- "\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587"
46102
- ] }) : source.status === "failed" ? /* @__PURE__ */ jsxs38("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--swf-danger))]", children: [
46103
- /* @__PURE__ */ jsx44(CircleX, { size: 12 }),
46104
- "\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25"
46105
- ] }) : source.status === "interrupted" ? /* @__PURE__ */ jsxs38("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--swf-warning))]", children: [
46106
- /* @__PURE__ */ jsx44(Square, { size: 12 }),
46107
- "\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88"
46108
- ] }) : "\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29" })
46109
- ]
46110
- }
46111
- ),
46112
- canCancel ? /* @__PURE__ */ jsx44(
46113
- "button",
46114
- {
46115
- type: "button",
46116
- onClick: () => void session?.stop(),
46117
- className: "shrink-0 rounded-md border border-current/15 px-2 py-0.5 text-[11px] transition-opacity hover:opacity-80",
46118
- children: "\u53D6\u6D88\u6574\u7406"
46119
- }
46120
- ) : null
46121
- ] }),
46122
- expanded ? /* @__PURE__ */ jsxs38("div", { className: "mt-1 max-w-3xl rounded-lg border border-[hsl(var(--border))]/70 bg-[hsl(var(--card))]/80 px-3 py-2 text-[11px] leading-relaxed", children: [
46123
- /* @__PURE__ */ jsxs38("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[hsl(var(--muted-foreground))]", children: [
46124
- /* @__PURE__ */ jsxs38("span", { children: [
46125
- "#",
46126
- shortId(source.compaction_id)
46127
- ] }),
46128
- /* @__PURE__ */ jsxs38("span", { children: [
46129
- "\u8282\u7701 ",
46130
- formatSavedRatio(source.saved_ratio),
46131
- "\uFF08",
46132
- formatTokens(source.tokens_before),
46133
- " \u2192",
46134
- " ",
46135
- formatTokens(source.tokens_after),
46136
- " token\uFF09"
46137
- ] }),
46138
- /* @__PURE__ */ jsxs38("span", { children: [
46139
- "\u5F52\u6863 ",
46140
- archivedCount,
46141
- " \u4E2A\u5DE5\u5177\u7ED3\u679C"
46142
- ] })
46143
- ] }),
46144
- archivedToolCalls.length > 0 ? /* @__PURE__ */ jsx44("div", { className: "mt-2 space-y-1.5", children: archivedToolCalls.map((item, index2) => {
46145
- const archivePath = getArchivePath(item, archivedFiles);
46146
- return /* @__PURE__ */ jsxs38(
46147
- "div",
46148
- {
46149
- className: "rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/35 px-2 py-1.5",
46150
- children: [
46151
- /* @__PURE__ */ jsxs38("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[hsl(var(--foreground))]", children: [
46152
- /* @__PURE__ */ jsx44("span", { className: "font-medium", children: getArchivedToolLabel(item) }),
46153
- item.tool_call_id ? /* @__PURE__ */ jsx44("span", { className: "font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.tool_call_id }) : null
46154
- ] }),
46155
- archivePath ? /* @__PURE__ */ jsx44("div", { className: "mt-0.5 break-all font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: archivePath }) : null
46156
- ]
46157
- },
46158
- item.tool_call_id || item.entry_id || `${item.tool_name}-${index2}`
46159
- );
46160
- }) }) : null,
46161
- hasSummary ? /* @__PURE__ */ jsx44("pre", { className: "mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/25 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: source.summary_full }) : null,
46162
- source.status === "failed" && source.failure_reason ? /* @__PURE__ */ jsxs38("div", { className: "mt-2 text-[hsl(var(--swf-danger))]", children: [
46163
- "\u5931\u8D25\u539F\u56E0\uFF1A",
46164
- source.failure_reason
46165
- ] }) : null
46166
- ] }) : null
46167
- ] });
46168
- }
46169
-
46170
46030
  // src/chat/PostChatFollowupBlock.tsx
46171
46031
  import { useEffect as useEffect25, useRef as useRef25 } from "react";
46172
46032
 
46173
46033
  // src/chat/FinalArtifactCards.tsx
46174
- import { useEffect as useEffect24, useRef as useRef24, useState as useState31 } from "react";
46175
- import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
46034
+ import { useEffect as useEffect24, useRef as useRef24, useState as useState30 } from "react";
46035
+ import { Fragment as Fragment17, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
46176
46036
  function basename2(path2) {
46177
46037
  return path2.split("/").filter(Boolean).pop() || path2;
46178
46038
  }
@@ -46193,10 +46053,10 @@ function LinkCard({
46193
46053
  const bladeHost = useBladeHost();
46194
46054
  const host = hostOf(url2);
46195
46055
  const local = isLoopbackUrl(url2) && Boolean(bladeHost.openPreview);
46196
- const content3 = /* @__PURE__ */ jsxs39(Fragment17, { children: [
46197
- /* @__PURE__ */ jsx45("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx45(Globe, { size: 15, "aria-hidden": "true" }) }),
46198
- /* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx45("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
46199
- /* @__PURE__ */ jsx45(
46056
+ const content3 = /* @__PURE__ */ jsxs38(Fragment17, { children: [
46057
+ /* @__PURE__ */ jsx44("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx44(Globe, { size: 15, "aria-hidden": "true" }) }),
46058
+ /* @__PURE__ */ jsx44("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx44("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
46059
+ /* @__PURE__ */ jsx44(
46200
46060
  ArrowUpRight,
46201
46061
  {
46202
46062
  size: 13,
@@ -46206,7 +46066,7 @@ function LinkCard({
46206
46066
  )
46207
46067
  ] });
46208
46068
  if (local) {
46209
- return /* @__PURE__ */ jsx45(
46069
+ return /* @__PURE__ */ jsx44(
46210
46070
  "button",
46211
46071
  {
46212
46072
  type: "button",
@@ -46222,7 +46082,7 @@ ${url2}`,
46222
46082
  }
46223
46083
  );
46224
46084
  }
46225
- return /* @__PURE__ */ jsx45(
46085
+ return /* @__PURE__ */ jsx44(
46226
46086
  "a",
46227
46087
  {
46228
46088
  href: url2,
@@ -46242,7 +46102,7 @@ function FinalArtifactCards({
46242
46102
  sessionId,
46243
46103
  assistantEntryId
46244
46104
  }) {
46245
- const [expanded, setExpanded] = useState31(false);
46105
+ const [expanded, setExpanded] = useState30(false);
46246
46106
  const hasMore = artifacts.length > 3;
46247
46107
  const visibleArtifacts = expanded ? artifacts : artifacts.slice(0, 3);
46248
46108
  const emit = useFollowupInteraction();
@@ -46265,8 +46125,8 @@ function FinalArtifactCards({
46265
46125
  const columnCount = Math.min(artifacts.length, 3);
46266
46126
  const gridWidth = columnCount * 180 + Math.max(0, columnCount - 1) * 6;
46267
46127
  if (artifacts.length === 0) return null;
46268
- return /* @__PURE__ */ jsxs39("div", { className: "flex max-w-full flex-col gap-1.5", children: [
46269
- /* @__PURE__ */ jsx45(
46128
+ return /* @__PURE__ */ jsxs38("div", { className: "flex max-w-full flex-col gap-1.5", children: [
46129
+ /* @__PURE__ */ jsx44(
46270
46130
  "div",
46271
46131
  {
46272
46132
  style: {
@@ -46275,7 +46135,7 @@ function FinalArtifactCards({
46275
46135
  },
46276
46136
  className: expanded && hasMore ? "grid max-h-[144px] max-w-full gap-1.5 overflow-y-auto pr-1" : "grid max-w-full gap-1.5",
46277
46137
  children: visibleArtifacts.map(
46278
- (artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsx45(
46138
+ (artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsx44(
46279
46139
  LinkCard,
46280
46140
  {
46281
46141
  url: artifact.target,
@@ -46284,7 +46144,7 @@ function FinalArtifactCards({
46284
46144
  onOpen: () => reportOpened(artifactIndex, "link")
46285
46145
  },
46286
46146
  `${artifact.kind}:${artifactIndex}`
46287
- ) : /* @__PURE__ */ jsx45(
46147
+ ) : /* @__PURE__ */ jsx44(
46288
46148
  DeliveryCard,
46289
46149
  {
46290
46150
  path: artifact.target,
@@ -46301,7 +46161,7 @@ function FinalArtifactCards({
46301
46161
  )
46302
46162
  }
46303
46163
  ),
46304
- hasMore ? /* @__PURE__ */ jsxs39(
46164
+ hasMore ? /* @__PURE__ */ jsxs38(
46305
46165
  "button",
46306
46166
  {
46307
46167
  type: "button",
@@ -46309,8 +46169,8 @@ function FinalArtifactCards({
46309
46169
  className: "flex w-fit items-center gap-0.5 text-[11px] leading-4 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
46310
46170
  "aria-expanded": expanded,
46311
46171
  children: [
46312
- /* @__PURE__ */ jsx45("span", { children: expanded ? "\u6536\u8D77" : `\u5C55\u5F00 ${artifacts.length - 3} \u4E2A` }),
46313
- /* @__PURE__ */ jsx45(
46172
+ /* @__PURE__ */ jsx44("span", { children: expanded ? "\u6536\u8D77" : `\u5C55\u5F00 ${artifacts.length - 3} \u4E2A` }),
46173
+ /* @__PURE__ */ jsx44(
46314
46174
  ChevronDown,
46315
46175
  {
46316
46176
  size: 13,
@@ -46325,7 +46185,7 @@ function FinalArtifactCards({
46325
46185
  }
46326
46186
 
46327
46187
  // src/chat/PostChatFollowupBlock.tsx
46328
- import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
46188
+ import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
46329
46189
  function PostChatFollowupBlock({
46330
46190
  sessionId,
46331
46191
  followup,
@@ -46347,14 +46207,14 @@ function PostChatFollowupBlock({
46347
46207
  }, [assistantEntryId, emit, sessionId, suggestionCount]);
46348
46208
  if (!followup || !followup.recaption && followup.suggestions.length === 0 && artifacts.length === 0 && !followup.feedback_eligible)
46349
46209
  return null;
46350
- return /* @__PURE__ */ jsxs40("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: [
46351
- followup.recaption ? /* @__PURE__ */ jsxs40("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
46352
- /* @__PURE__ */ jsxs40("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
46353
- /* @__PURE__ */ jsx46(Sparkles, { size: 14, "aria-hidden": "true" }),
46210
+ return /* @__PURE__ */ jsxs39("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: [
46211
+ followup.recaption ? /* @__PURE__ */ jsxs39("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
46212
+ /* @__PURE__ */ jsxs39("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
46213
+ /* @__PURE__ */ jsx45(Sparkles, { size: 14, "aria-hidden": "true" }),
46354
46214
  "\u672C\u8F6E\u5C0F\u7ED3"
46355
46215
  ] }),
46356
- /* @__PURE__ */ jsx46("p", { className: "text-[13px] leading-5 text-[hsl(var(--foreground)/0.9)]", children: followup.recaption }),
46357
- artifacts.length > 0 ? /* @__PURE__ */ jsx46(
46216
+ /* @__PURE__ */ jsx45("p", { className: "text-[13px] leading-5 text-[hsl(var(--foreground)/0.9)]", children: followup.recaption }),
46217
+ artifacts.length > 0 ? /* @__PURE__ */ jsx45(
46358
46218
  FinalArtifactCards,
46359
46219
  {
46360
46220
  artifacts,
@@ -46363,7 +46223,7 @@ function PostChatFollowupBlock({
46363
46223
  }
46364
46224
  ) : null
46365
46225
  ] }) : null,
46366
- !followup.recaption && artifacts.length > 0 ? /* @__PURE__ */ jsx46("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", children: /* @__PURE__ */ jsx46(
46226
+ !followup.recaption && artifacts.length > 0 ? /* @__PURE__ */ jsx45("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", children: /* @__PURE__ */ jsx45(
46367
46227
  FinalArtifactCards,
46368
46228
  {
46369
46229
  artifacts,
@@ -46371,9 +46231,9 @@ function PostChatFollowupBlock({
46371
46231
  assistantEntryId
46372
46232
  }
46373
46233
  ) }) : null,
46374
- followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs40("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
46375
- /* @__PURE__ */ jsx46("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
46376
- /* @__PURE__ */ jsx46("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs40(
46234
+ followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs39("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
46235
+ /* @__PURE__ */ jsx45("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
46236
+ /* @__PURE__ */ jsx45("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs39(
46377
46237
  "button",
46378
46238
  {
46379
46239
  type: "button",
@@ -46388,8 +46248,8 @@ function PostChatFollowupBlock({
46388
46248
  part: "followup-action",
46389
46249
  className: "blade-chat-followup-action group flex w-full items-center gap-2.5 rounded-[14px] bg-[hsl(var(--muted)/0.62)] px-3.5 py-2 text-left text-[13px] font-normal leading-5 text-[hsl(var(--foreground)/0.92)] transition-colors hover:bg-[hsl(var(--muted)/0.88)] disabled:cursor-default disabled:opacity-60",
46390
46250
  children: [
46391
- /* @__PURE__ */ jsx46("span", { className: "min-w-0", children: suggestion }),
46392
- /* @__PURE__ */ jsx46(
46251
+ /* @__PURE__ */ jsx45("span", { className: "min-w-0", children: suggestion }),
46252
+ /* @__PURE__ */ jsx45(
46393
46253
  ArrowRight,
46394
46254
  {
46395
46255
  size: 14,
@@ -46403,7 +46263,7 @@ function PostChatFollowupBlock({
46403
46263
  suggestion
46404
46264
  )) })
46405
46265
  ] }) : null,
46406
- /* @__PURE__ */ jsx46(
46266
+ /* @__PURE__ */ jsx45(
46407
46267
  ResultFeedback,
46408
46268
  {
46409
46269
  sessionId,
@@ -46418,7 +46278,7 @@ function PostChatFollowupBlock({
46418
46278
 
46419
46279
  // src/chat/RenderErrorBoundary.tsx
46420
46280
  import { Component } from "react";
46421
- import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
46281
+ import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
46422
46282
  function getFirstComponentName(componentStack) {
46423
46283
  const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
46424
46284
  return match?.[1] ?? null;
@@ -46451,26 +46311,26 @@ var RenderErrorBoundary = class extends Component {
46451
46311
  return children;
46452
46312
  }
46453
46313
  const componentName = getFirstComponentName(componentStack);
46454
- return /* @__PURE__ */ jsx47("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__ */ jsxs41("div", { className: "flex items-start gap-2", children: [
46455
- /* @__PURE__ */ jsx47(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--swf-warning))]" }),
46456
- /* @__PURE__ */ jsxs41("div", { className: "min-w-0 flex-1", children: [
46457
- /* @__PURE__ */ jsxs41("div", { className: "font-medium", children: [
46314
+ return /* @__PURE__ */ jsx46("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__ */ jsxs40("div", { className: "flex items-start gap-2", children: [
46315
+ /* @__PURE__ */ jsx46(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--swf-warning))]" }),
46316
+ /* @__PURE__ */ jsxs40("div", { className: "min-w-0 flex-1", children: [
46317
+ /* @__PURE__ */ jsxs40("div", { className: "font-medium", children: [
46458
46318
  label,
46459
46319
  "\u6E32\u67D3\u5931\u8D25"
46460
46320
  ] }),
46461
- /* @__PURE__ */ jsxs41("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
46321
+ /* @__PURE__ */ jsxs40("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
46462
46322
  componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
46463
46323
  error61.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
46464
46324
  ] }),
46465
- details ? /* @__PURE__ */ jsx47("div", { className: "mt-1 truncate text-xs text-[hsl(var(--muted-foreground))]", children: details }) : null
46325
+ details ? /* @__PURE__ */ jsx46("div", { className: "mt-1 truncate text-xs text-[hsl(var(--muted-foreground))]", children: details }) : null
46466
46326
  ] })
46467
46327
  ] }) });
46468
46328
  }
46469
46329
  };
46470
46330
 
46471
46331
  // src/chat/TurnNavRail.tsx
46472
- import { useCallback as useCallback13, useEffect as useEffect26, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState32 } from "react";
46473
- import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
46332
+ import { useCallback as useCallback13, useEffect as useEffect26, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState31 } from "react";
46333
+ import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
46474
46334
  var PANEL_MAX_HEIGHT = 448;
46475
46335
  var PANEL_MARGIN = 16;
46476
46336
  function clippingAncestor(element2) {
@@ -46491,8 +46351,8 @@ function TurnNavRail({
46491
46351
  error: error61 = null,
46492
46352
  failedTurnId = null
46493
46353
  }) {
46494
- const [hoveredTurnId, setHoveredTurnId] = useState32(null);
46495
- const [panelOpen, setPanelOpen] = useState32(false);
46354
+ const [hoveredTurnId, setHoveredTurnId] = useState31(null);
46355
+ const [panelOpen, setPanelOpen] = useState31(false);
46496
46356
  const listRef = useRef26(null);
46497
46357
  const markerRef = useRef26(null);
46498
46358
  const edgeRatioRef = useRef26(0.5);
@@ -46600,7 +46460,7 @@ function TurnNavRail({
46600
46460
  if (items.length < 2) {
46601
46461
  return null;
46602
46462
  }
46603
- return /* @__PURE__ */ jsx48(
46463
+ return /* @__PURE__ */ jsx47(
46604
46464
  "nav",
46605
46465
  {
46606
46466
  "aria-label": "\u56DE\u5408\u5BFC\u822A",
@@ -46615,8 +46475,8 @@ function TurnNavRail({
46615
46475
  setPanelOpen(false);
46616
46476
  setHoveredTurnId(null);
46617
46477
  },
46618
- children: /* @__PURE__ */ jsxs42("div", { className: "flex flex-col items-end", children: [
46619
- /* @__PURE__ */ jsxs42(
46478
+ children: /* @__PURE__ */ jsxs41("div", { className: "flex flex-col items-end", children: [
46479
+ /* @__PURE__ */ jsxs41(
46620
46480
  "div",
46621
46481
  {
46622
46482
  ref: markerRef,
@@ -46631,10 +46491,10 @@ function TurnNavRail({
46631
46491
  maskImage: "linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"
46632
46492
  },
46633
46493
  children: [
46634
- /* @__PURE__ */ jsx48("span", { "aria-hidden": true, className: "mt-auto shrink-0" }),
46494
+ /* @__PURE__ */ jsx47("span", { "aria-hidden": true, className: "mt-auto shrink-0" }),
46635
46495
  items.map((item, index2) => {
46636
46496
  const isActive = item.id === activeTurnId;
46637
- return /* @__PURE__ */ jsx48(
46497
+ return /* @__PURE__ */ jsx47(
46638
46498
  "button",
46639
46499
  {
46640
46500
  type: "button",
@@ -46644,7 +46504,7 @@ function TurnNavRail({
46644
46504
  "aria-current": isActive ? "true" : void 0,
46645
46505
  "aria-label": item.title || `\u7B2C ${index2 + 1} \u8F6E`,
46646
46506
  className: "flex h-3.5 shrink-0 items-center",
46647
- children: /* @__PURE__ */ jsx48(
46507
+ children: /* @__PURE__ */ jsx47(
46648
46508
  "span",
46649
46509
  {
46650
46510
  className: cn(
@@ -46660,18 +46520,18 @@ function TurnNavRail({
46660
46520
  item.id
46661
46521
  );
46662
46522
  }),
46663
- /* @__PURE__ */ jsx48("span", { "aria-hidden": true, className: "mb-auto shrink-0" })
46523
+ /* @__PURE__ */ jsx47("span", { "aria-hidden": true, className: "mb-auto shrink-0" })
46664
46524
  ]
46665
46525
  }
46666
46526
  ),
46667
- error61 ? /* @__PURE__ */ jsxs42(
46527
+ error61 ? /* @__PURE__ */ jsxs41(
46668
46528
  "div",
46669
46529
  {
46670
46530
  role: "alert",
46671
46531
  className: "absolute right-full top-1/2 mr-2 flex -translate-y-1/2 items-center gap-2 whitespace-nowrap rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)]",
46672
46532
  children: [
46673
- /* @__PURE__ */ jsx48("span", { children: error61 }),
46674
- failedTurnId ? /* @__PURE__ */ jsx48(
46533
+ /* @__PURE__ */ jsx47("span", { children: error61 }),
46534
+ failedTurnId ? /* @__PURE__ */ jsx47(
46675
46535
  "button",
46676
46536
  {
46677
46537
  type: "button",
@@ -46682,12 +46542,12 @@ function TurnNavRail({
46682
46542
  ) : null
46683
46543
  ]
46684
46544
  }
46685
- ) : loadingTurnId ? /* @__PURE__ */ jsx48("output", { className: "absolute right-full top-1/2 mr-2 -translate-y-1/2 whitespace-nowrap rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)]", children: "\u6B63\u5728\u5B9A\u4F4D\u5230\u8FD9\u6761\u53D1\u8A00\u2026" }) : null,
46545
+ ) : loadingTurnId ? /* @__PURE__ */ jsx47("output", { className: "absolute right-full top-1/2 mr-2 -translate-y-1/2 whitespace-nowrap rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)]", children: "\u6B63\u5728\u5B9A\u4F4D\u5230\u8FD9\u6761\u53D1\u8A00\u2026" }) : null,
46686
46546
  panelOpen ? (
46687
46547
  // pr-2 让刻度与列表之间的空隙也算悬停区域,鼠标横穿时面板不会关闭。
46688
46548
  // 与刻度轨同心:顶对齐会让接近上限高度的面板整条往下长,聊天区是 overflow: hidden,
46689
46549
  // 视口矮一点下面的条目就被裁掉、滚也滚不到。高度同时受视口约束。
46690
- /* @__PURE__ */ jsx48("div", { className: "absolute right-full top-1/2 -translate-y-1/2 pr-2", children: /* @__PURE__ */ jsx48(
46550
+ /* @__PURE__ */ jsx47("div", { className: "absolute right-full top-1/2 -translate-y-1/2 pr-2", children: /* @__PURE__ */ jsx47(
46691
46551
  "div",
46692
46552
  {
46693
46553
  ref: listRef,
@@ -46695,7 +46555,7 @@ function TurnNavRail({
46695
46555
  children: items.map((item, index2) => {
46696
46556
  const isActive = item.id === activeTurnId;
46697
46557
  const isHovered = item.id === hoveredTurnId;
46698
- return /* @__PURE__ */ jsx48(
46558
+ return /* @__PURE__ */ jsx47(
46699
46559
  "button",
46700
46560
  {
46701
46561
  type: "button",
@@ -46774,7 +46634,7 @@ function calculateAnimatedScrollTop({
46774
46634
  }
46775
46635
 
46776
46636
  // src/chat/MessageList.tsx
46777
- import { Fragment as Fragment18, jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
46637
+ import { Fragment as Fragment18, jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
46778
46638
  function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
46779
46639
  if (isStopping) return false;
46780
46640
  const hasContent = message?.content != null && message.content.length > 0;
@@ -46902,7 +46762,7 @@ function MessageListBody({
46902
46762
  }, [isStopping]);
46903
46763
  const renderBlocks = useMemo16(() => {
46904
46764
  const blocks = buildMessageListBlocks({
46905
- messages,
46765
+ messages: messages.filter((message) => message.kind !== "compaction"),
46906
46766
  agentLoopNames: agentLoopNameSet,
46907
46767
  // 服务端可能已经说完了(sessionIsStreaming 变 false),但打字机节流
46908
46768
  // 还没把最后这点内容追平——block.isStreaming 驱动一大批"完成态"展示
@@ -47014,9 +46874,9 @@ function MessageListBody({
47014
46874
  const observedLatestUserStableIdRef = useRef27(
47015
46875
  latestUserIsOptimistic ? null : latestUserStableId
47016
46876
  );
47017
- const [activeTurnId, setActiveTurnId] = useState33(lastTurnId);
47018
- const [virtualScrollMargin, setVirtualScrollMargin] = useState33(0);
47019
- const [scrollContainerElement, setScrollContainerElement] = useState33(null);
46877
+ const [activeTurnId, setActiveTurnId] = useState32(lastTurnId);
46878
+ const [virtualScrollMargin, setVirtualScrollMargin] = useState32(0);
46879
+ const [scrollContainerElement, setScrollContainerElement] = useState32(null);
47020
46880
  const loadingOlderRef = useRef27(false);
47021
46881
  const virtualizationEnabled = Boolean(useChatEnvironment().useVirtualizer);
47022
46882
  const stablePrefixEnd = useMemo16(
@@ -47778,15 +47638,15 @@ function MessageListBody({
47778
47638
  stablePrefixEnd,
47779
47639
  virtualizer
47780
47640
  ]);
47781
- return /* @__PURE__ */ jsxs43(
47641
+ return /* @__PURE__ */ jsxs42(
47782
47642
  "div",
47783
47643
  {
47784
47644
  ref: containerRef,
47785
47645
  part: "messages",
47786
47646
  className: `blade-chat-messages relative min-h-0 flex-1 ${customization?.classNames?.messageListRoot ?? ""}`,
47787
47647
  children: [
47788
- !isPreparing && (sessionIsStreaming || isRevealingAny) ? /* @__PURE__ */ jsx49("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
47789
- turnNavItems.length > 1 ? /* @__PURE__ */ jsx49(
47648
+ !isPreparing && (sessionIsStreaming || isRevealingAny) ? /* @__PURE__ */ jsx48("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
47649
+ turnNavItems.length > 1 ? /* @__PURE__ */ jsx48(
47790
47650
  TurnNavRail,
47791
47651
  {
47792
47652
  items: turnNavItems,
@@ -47797,7 +47657,7 @@ function MessageListBody({
47797
47657
  failedTurnId: navFailedEntryId
47798
47658
  }
47799
47659
  ) : null,
47800
- /* @__PURE__ */ jsxs43(
47660
+ /* @__PURE__ */ jsxs42(
47801
47661
  StickToBottom,
47802
47662
  {
47803
47663
  contextRef: stickContextRef,
@@ -47806,7 +47666,7 @@ function MessageListBody({
47806
47666
  resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
47807
47667
  targetScrollTop: shouldAnchorEntry ? getAnchorTargetScrollTop : void 0,
47808
47668
  children: [
47809
- /* @__PURE__ */ jsxs43(
47669
+ /* @__PURE__ */ jsxs42(
47810
47670
  StickToBottom.Content,
47811
47671
  {
47812
47672
  part: "messages-scroll",
@@ -47815,7 +47675,7 @@ function MessageListBody({
47815
47675
  customization?.classNames?.messageListViewport
47816
47676
  ),
47817
47677
  children: [
47818
- /* @__PURE__ */ jsx49(
47678
+ /* @__PURE__ */ jsx48(
47819
47679
  MessageListContent,
47820
47680
  {
47821
47681
  askAnswers,
@@ -47850,12 +47710,12 @@ function MessageListBody({
47850
47710
  emptyState
47851
47711
  }
47852
47712
  ),
47853
- isPreparing ? /* @__PURE__ */ jsx49("div", { className: "mx-auto mt-3 max-w-[748px] px-4", children: /* @__PURE__ */ jsx49(ChatLoadingIndicator, { preparing: true }) }) : null,
47854
- /* @__PURE__ */ jsx49("div", { ref: newTurnSpacerRef, "aria-hidden": "true", className: "pointer-events-none w-full" })
47713
+ isPreparing ? /* @__PURE__ */ jsx48("div", { className: "mx-auto mt-3 max-w-[748px] px-4", children: /* @__PURE__ */ jsx48(ChatLoadingIndicator, { preparing: true }) }) : null,
47714
+ /* @__PURE__ */ jsx48("div", { ref: newTurnSpacerRef, "aria-hidden": "true", className: "pointer-events-none w-full" })
47855
47715
  ]
47856
47716
  }
47857
47717
  ),
47858
- /* @__PURE__ */ jsx49(ScrollToBottomButton, { onBeforeScroll: releaseNewTurnPin })
47718
+ /* @__PURE__ */ jsx48(ScrollToBottomButton, { onBeforeScroll: releaseNewTurnPin })
47859
47719
  ]
47860
47720
  },
47861
47721
  scrollEntryId ?? "latest"
@@ -47919,31 +47779,31 @@ function MessageListContent({
47919
47779
  };
47920
47780
  const RenderBlockView = (block, globalBlockIndex) => {
47921
47781
  if (block.type === "message") {
47922
- return /* @__PURE__ */ jsx49(
47782
+ return /* @__PURE__ */ jsx48(
47923
47783
  "div",
47924
47784
  {
47925
47785
  id: block.anchorId ?? void 0,
47926
47786
  "data-entry-id": block.message.entry_id,
47927
47787
  className: "msg-animate scroll-mt-6",
47928
- children: isBackgroundWakeMessage3(block.message) ? /* @__PURE__ */ jsx49(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx49(
47788
+ children: isBackgroundWakeMessage3(block.message) ? /* @__PURE__ */ jsx48(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx48(
47929
47789
  customization.components.UserMessage,
47930
47790
  {
47931
47791
  message: block.message,
47932
47792
  className: customization.classNames?.userMessage
47933
47793
  }
47934
- ) : /* @__PURE__ */ jsx49(
47794
+ ) : /* @__PURE__ */ jsx48(
47935
47795
  UserMessageBubble,
47936
47796
  {
47937
47797
  message: block.message,
47938
47798
  className: customization?.classNames?.userMessage
47939
47799
  }
47940
- ) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx49(
47800
+ ) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx48(
47941
47801
  customization.components.ErrorMessage,
47942
47802
  {
47943
47803
  message: block.message,
47944
47804
  className: customization.classNames?.errorMessage
47945
47805
  }
47946
- ) : /* @__PURE__ */ jsx49(
47806
+ ) : /* @__PURE__ */ jsx48(
47947
47807
  ErrorMessageBlock,
47948
47808
  {
47949
47809
  message: block.message,
@@ -47966,7 +47826,7 @@ function MessageListContent({
47966
47826
  const isHistoricalPlan = globalBlockIndex !== latestPlanCardBlockIndex;
47967
47827
  const blockFeedback = displayMessages.map((message) => message.entry_id && resultFeedbackByEntry.get(message.entry_id)).find((feedback) => feedback != null);
47968
47828
  const isActiveFollowup = block.anchorId === followupTurnId;
47969
- return /* @__PURE__ */ jsxs43(
47829
+ return /* @__PURE__ */ jsxs42(
47970
47830
  "div",
47971
47831
  {
47972
47832
  ref: getTurnElementRef(block.anchorId),
@@ -47975,13 +47835,13 @@ function MessageListContent({
47975
47835
  "data-entry-id": block.messages[0]?.entry_id,
47976
47836
  className: "msg-animate flex scroll-mt-6 flex-col gap-4",
47977
47837
  children: [
47978
- /* @__PURE__ */ jsx49(
47838
+ /* @__PURE__ */ jsx48(
47979
47839
  RenderErrorBoundary,
47980
47840
  {
47981
47841
  label: "\u52A9\u624B\u6D88\u606F",
47982
47842
  details: block.key,
47983
47843
  resetKey: getMessagesResetSignature(displayMessages),
47984
- children: customization?.components?.AssistantTurn ? /* @__PURE__ */ jsx49(
47844
+ children: customization?.components?.AssistantTurn ? /* @__PURE__ */ jsx48(
47985
47845
  customization.components.AssistantTurn,
47986
47846
  {
47987
47847
  turnKey: block.key,
@@ -47995,7 +47855,7 @@ function MessageListContent({
47995
47855
  sessionStatus,
47996
47856
  customization
47997
47857
  }
47998
- ) : /* @__PURE__ */ jsx49(
47858
+ ) : /* @__PURE__ */ jsx48(
47999
47859
  AssistantTurnBlock,
48000
47860
  {
48001
47861
  turnKey: block.key,
@@ -48012,13 +47872,13 @@ function MessageListContent({
48012
47872
  )
48013
47873
  }
48014
47874
  ),
48015
- showPlanCard ? /* @__PURE__ */ jsx49(
47875
+ showPlanCard ? /* @__PURE__ */ jsx48(
48016
47876
  RenderErrorBoundary,
48017
47877
  {
48018
47878
  label: "\u89C4\u5212\u6458\u8981",
48019
47879
  details: block.key,
48020
47880
  resetKey: `${sessionStatus ?? ""}:${layoutSignature}`,
48021
- children: /* @__PURE__ */ jsx49(
47881
+ children: /* @__PURE__ */ jsx48(
48022
47882
  PlanSummaryCard,
48023
47883
  {
48024
47884
  messages: extractPlanMessagesForTurn(messages, block.messages.at(-1)),
@@ -48030,8 +47890,8 @@ function MessageListContent({
48030
47890
  )
48031
47891
  }
48032
47892
  ) : null,
48033
- blockFeedback && !isActiveFollowup ? /* @__PURE__ */ jsx49(HistoricalResultFeedback, { feedback: blockFeedback }) : null,
48034
- isActiveFollowup ? /* @__PURE__ */ jsx49(
47893
+ blockFeedback && !isActiveFollowup ? /* @__PURE__ */ jsx48(HistoricalResultFeedback, { feedback: blockFeedback }) : null,
47894
+ isActiveFollowup ? /* @__PURE__ */ jsx48(
48035
47895
  PostChatFollowupBlock,
48036
47896
  {
48037
47897
  sessionId,
@@ -48045,29 +47905,20 @@ function MessageListContent({
48045
47905
  }
48046
47906
  );
48047
47907
  }
48048
- if (block.type === "compaction") {
48049
- return /* @__PURE__ */ jsx49("div", { className: "msg-animate", children: /* @__PURE__ */ jsx49(
48050
- CompactionCard,
48051
- {
48052
- sessionId,
48053
- compaction: block.message.compaction,
48054
- status: block.message.status
48055
- }
48056
- ) });
48057
- }
47908
+ if (block.type === "compaction") return null;
48058
47909
  if (block.type === "context_group") {
48059
47910
  const contexts = block.messages.map((message) => message.context).filter((context) => Boolean(context));
48060
- return contexts.length > 0 ? /* @__PURE__ */ jsx49("div", { className: "msg-animate", "data-entry-id": block.messages[0].entry_id, children: /* @__PURE__ */ jsx49(ContextGroupCard, { contexts }) }) : null;
47911
+ return contexts.length > 0 ? /* @__PURE__ */ jsx48("div", { className: "msg-animate", "data-entry-id": block.messages[0].entry_id, children: /* @__PURE__ */ jsx48(ContextGroupCard, { contexts }) }) : null;
48061
47912
  }
48062
47913
  if (block.type === "context_divider") {
48063
- return /* @__PURE__ */ jsx49(ContextDivider, {});
47914
+ return /* @__PURE__ */ jsx48(ContextDivider, {});
48064
47915
  }
48065
- return /* @__PURE__ */ jsx49(PlanningDivider, { kind: block.kind });
47916
+ return /* @__PURE__ */ jsx48(PlanningDivider, { kind: block.kind });
48066
47917
  };
48067
47918
  const renderMeasuredRow = (block, globalBlockIndex, virtualItem) => {
48068
47919
  const persistentId = getRenderBlockPersistentId(block);
48069
47920
  const isVirtual = virtualItem !== void 0;
48070
- return /* @__PURE__ */ jsxs43(
47921
+ return /* @__PURE__ */ jsxs42(
48071
47922
  "div",
48072
47923
  {
48073
47924
  ref: getMeasuredRowRef(block, globalBlockIndex, isVirtual),
@@ -48087,31 +47938,31 @@ function MessageListContent({
48087
47938
  },
48088
47939
  children: [
48089
47940
  RenderBlockView(block, globalBlockIndex),
48090
- isVirtual && globalBlockIndex < stablePrefixEnd - 1 ? /* @__PURE__ */ jsx49("div", { "aria-hidden": "true", className: "h-0 shrink-0" }) : null
47941
+ isVirtual && globalBlockIndex < stablePrefixEnd - 1 ? /* @__PURE__ */ jsx48("div", { "aria-hidden": "true", className: "h-0 shrink-0" }) : null
48091
47942
  ]
48092
47943
  },
48093
47944
  block.key
48094
47945
  );
48095
47946
  };
48096
- return /* @__PURE__ */ jsx49(
47947
+ return /* @__PURE__ */ jsx48(
48097
47948
  "div",
48098
47949
  {
48099
47950
  part: "messages-content",
48100
47951
  className: `blade-chat-messages-content mx-auto max-w-[748px] ${customization?.classNames?.messageListContent ?? ""}`,
48101
- children: /* @__PURE__ */ jsxs43("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
48102
- renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx49(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx49(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs43(
47952
+ children: /* @__PURE__ */ jsxs42("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
47953
+ renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx48(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx48(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs42(
48103
47954
  "div",
48104
47955
  {
48105
47956
  part: "empty",
48106
47957
  className: `blade-chat-empty flex flex-col items-center justify-center gap-3 py-24 text-[hsl(var(--muted-foreground))] ${customization?.classNames?.emptyState ?? ""}`,
48107
47958
  children: [
48108
- /* @__PURE__ */ jsx49(MessageSquare, { size: 40, strokeWidth: 1.5 }),
48109
- /* @__PURE__ */ jsx49("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
48110
- /* @__PURE__ */ jsx49("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
47959
+ /* @__PURE__ */ jsx48(MessageSquare, { size: 40, strokeWidth: 1.5 }),
47960
+ /* @__PURE__ */ jsx48("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
47961
+ /* @__PURE__ */ jsx48("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
48111
47962
  ]
48112
47963
  }
48113
- ) : /* @__PURE__ */ jsxs43(Fragment18, { children: [
48114
- stablePrefixEnd > 0 ? /* @__PURE__ */ jsx49(
47964
+ ) : /* @__PURE__ */ jsxs42(Fragment18, { children: [
47965
+ stablePrefixEnd > 0 ? /* @__PURE__ */ jsx48(
48115
47966
  "div",
48116
47967
  {
48117
47968
  ref: virtualPrefixRef,
@@ -48128,23 +47979,23 @@ function MessageListContent({
48128
47979
  (block, residentIndex) => renderMeasuredRow(block, stablePrefixEnd + residentIndex)
48129
47980
  )
48130
47981
  ] }),
48131
- sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */ jsx49("div", { className: "flex", children: /* @__PURE__ */ jsx49("div", { className: "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" }) }) : null
47982
+ sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */ jsx48("div", { className: "flex", children: /* @__PURE__ */ jsx48("div", { className: "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" }) }) : null
48132
47983
  ] })
48133
47984
  }
48134
47985
  );
48135
47986
  }
48136
47987
  function HistoryLoadingPlaceholder() {
48137
- return /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
48138
- /* @__PURE__ */ jsxs43("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
48139
- /* @__PURE__ */ jsx49("span", { className: "size-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }),
48140
- /* @__PURE__ */ jsx49("span", { children: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD\u8BB0\u5F55\u2026" })
47988
+ return /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
47989
+ /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
47990
+ /* @__PURE__ */ jsx48("span", { className: "size-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }),
47991
+ /* @__PURE__ */ jsx48("span", { children: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD\u8BB0\u5F55\u2026" })
48141
47992
  ] }),
48142
- [0, 1].map((index2) => /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-4", children: [
48143
- /* @__PURE__ */ jsx49("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx49("div", { className: "h-10 w-2/5 animate-pulse rounded-2xl bg-[hsl(var(--muted))]" }) }),
48144
- /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-2.5", children: [
48145
- /* @__PURE__ */ jsx49("div", { className: "h-4 w-1/3 animate-pulse rounded bg-[hsl(var(--muted))]" }),
48146
- /* @__PURE__ */ jsx49("div", { className: "h-4 w-4/5 animate-pulse rounded bg-[hsl(var(--muted))]" }),
48147
- /* @__PURE__ */ jsx49("div", { className: "h-4 w-3/5 animate-pulse rounded bg-[hsl(var(--muted))]" })
47993
+ [0, 1].map((index2) => /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-4", children: [
47994
+ /* @__PURE__ */ jsx48("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx48("div", { className: "h-10 w-2/5 animate-pulse rounded-2xl bg-[hsl(var(--muted))]" }) }),
47995
+ /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-2.5", children: [
47996
+ /* @__PURE__ */ jsx48("div", { className: "h-4 w-1/3 animate-pulse rounded bg-[hsl(var(--muted))]" }),
47997
+ /* @__PURE__ */ jsx48("div", { className: "h-4 w-4/5 animate-pulse rounded bg-[hsl(var(--muted))]" }),
47998
+ /* @__PURE__ */ jsx48("div", { className: "h-4 w-3/5 animate-pulse rounded bg-[hsl(var(--muted))]" })
48148
47999
  ] })
48149
48000
  ] }, index2))
48150
48001
  ] });
@@ -48152,7 +48003,7 @@ function HistoryLoadingPlaceholder() {
48152
48003
  function ScrollToBottomButton({ onBeforeScroll }) {
48153
48004
  const { isAtBottom, scrollToBottom } = useStickToBottomContext();
48154
48005
  if (isAtBottom) return null;
48155
- return /* @__PURE__ */ jsxs43(
48006
+ return /* @__PURE__ */ jsxs42(
48156
48007
  "button",
48157
48008
  {
48158
48009
  type: "button",
@@ -48164,39 +48015,39 @@ function ScrollToBottomButton({ onBeforeScroll }) {
48164
48015
  part: "scroll-bottom",
48165
48016
  className: "blade-chat-scroll-bottom absolute bottom-4 right-4 flex items-center gap-1 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-1.5 text-xs text-[hsl(var(--muted-foreground))] shadow-[var(--swf-shadow-overlay)] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
48166
48017
  children: [
48167
- /* @__PURE__ */ jsx49(ChevronDown, { size: 14 }),
48168
- /* @__PURE__ */ jsx49("span", { className: "blade-chat-scroll-bottom-label", children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
48018
+ /* @__PURE__ */ jsx48(ChevronDown, { size: 14 }),
48019
+ /* @__PURE__ */ jsx48("span", { className: "blade-chat-scroll-bottom-label", children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
48169
48020
  ]
48170
48021
  }
48171
48022
  );
48172
48023
  }
48173
48024
  function PlanningDivider({ kind }) {
48174
48025
  const isEnter = kind === "enter";
48175
- return /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3 py-1", children: [
48176
- /* @__PURE__ */ jsx49("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
48177
- /* @__PURE__ */ jsxs43("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: [
48178
- /* @__PURE__ */ jsx49(Lightbulb, { size: 12 }),
48179
- /* @__PURE__ */ jsx49("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
48026
+ return /* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-3 py-1", children: [
48027
+ /* @__PURE__ */ jsx48("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
48028
+ /* @__PURE__ */ jsxs42("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: [
48029
+ /* @__PURE__ */ jsx48(Lightbulb, { size: 12 }),
48030
+ /* @__PURE__ */ jsx48("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
48180
48031
  ] }),
48181
- /* @__PURE__ */ jsx49("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
48032
+ /* @__PURE__ */ jsx48("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
48182
48033
  ] });
48183
48034
  }
48184
48035
  function ContextDivider() {
48185
- return /* @__PURE__ */ jsx49("div", { "aria-hidden": "true", className: "h-px w-full bg-[hsl(var(--border)/0.55)]" });
48036
+ return /* @__PURE__ */ jsx48("div", { "aria-hidden": "true", className: "h-px w-full bg-[hsl(var(--border)/0.55)]" });
48186
48037
  }
48187
48038
  function MessageList(props) {
48188
- return /* @__PURE__ */ jsx49(CurrentChatSessionProvider, { sessionId: props.sessionId || null, children: /* @__PURE__ */ jsx49(MessageListBody, { ...props }) });
48039
+ return /* @__PURE__ */ jsx48(CurrentChatSessionProvider, { sessionId: props.sessionId || null, children: /* @__PURE__ */ jsx48(MessageListBody, { ...props }) });
48189
48040
  }
48190
48041
 
48191
48042
  // src/chat/runtime/use-chat-actions.ts
48192
- import { useCallback as useCallback15, useEffect as useEffect28, useRef as useRef28, useState as useState34 } from "react";
48043
+ import { useCallback as useCallback15, useEffect as useEffect28, useRef as useRef28, useState as useState33 } from "react";
48193
48044
  function useChatActions(sessionId) {
48194
48045
  const source = useSessionSource();
48195
48046
  const session = useSessionHandle(sessionId);
48196
48047
  const isStreaming = useSessionState(sessionId, (state) => state.isStreaming);
48197
- const [isStopping, setIsStopping] = useState34(false);
48198
- const [queueNotice, setQueueNotice] = useState34(null);
48199
- const [pendingQueueItemId, setPendingQueueItemId] = useState34(null);
48048
+ const [isStopping, setIsStopping] = useState33(false);
48049
+ const [queueNotice, setQueueNotice] = useState33(null);
48050
+ const [pendingQueueItemId, setPendingQueueItemId] = useState33(null);
48200
48051
  const previousSessionIdRef = useRef28(sessionId);
48201
48052
  const send = useCallback15(
48202
48053
  (msg, targetMode, askuserAnswer, options) => (
@@ -48329,14 +48180,14 @@ function useSessionReplay(sessionId) {
48329
48180
  }
48330
48181
 
48331
48182
  // src/chat/SessionReplayBar.tsx
48332
- import { jsx as jsx50 } from "react/jsx-runtime";
48183
+ import { jsx as jsx49 } from "react/jsx-runtime";
48333
48184
  function SessionReplayBar({
48334
48185
  sessionId,
48335
48186
  className,
48336
48187
  onExit
48337
48188
  }) {
48338
48189
  const { isReplay, canControl, speed, setSpeed, exitToAutonomous } = useSessionReplay(sessionId);
48339
- return /* @__PURE__ */ jsx50(
48190
+ return /* @__PURE__ */ jsx49(
48340
48191
  ReplayBar,
48341
48192
  {
48342
48193
  isReplay,
@@ -48350,7 +48201,7 @@ function SessionReplayBar({
48350
48201
  }
48351
48202
 
48352
48203
  // src/chat/ChatPanel.tsx
48353
- import { Fragment as Fragment19, jsx as jsx51, jsxs as jsxs44 } from "react/jsx-runtime";
48204
+ import { Fragment as Fragment19, jsx as jsx50, jsxs as jsxs43 } from "react/jsx-runtime";
48354
48205
  function nextQueuedOrder(items, itemId, delta) {
48355
48206
  const pending = items.filter((item) => item.status === "pending");
48356
48207
  const index2 = pending.findIndex((item) => item.id === itemId);
@@ -48401,6 +48252,7 @@ function ChatPanel({
48401
48252
  const renderMode = requested === "lite" && !environment.useVirtualizer ? "normal" : requested === "developer" && !environment.DeveloperMessageList ? "normal" : requested;
48402
48253
  const lite = renderMode === "lite";
48403
48254
  const developer = renderMode === "developer";
48255
+ const scopedEnvironment = useMemo17(() => ({ ...environment, renderMode }), [environment, renderMode]);
48404
48256
  const DeveloperMessageList = environment.DeveloperMessageList;
48405
48257
  const agentSession = useSessionHandle(sessionId);
48406
48258
  const messages = useSessionState(sessionId, (state) => state.messages);
@@ -48431,12 +48283,12 @@ function ChatPanel({
48431
48283
  deliverQueuedMessage,
48432
48284
  resumeQueue
48433
48285
  } = useChatActions(sessionId);
48434
- const [isRevealing, setIsRevealing] = useState35(false);
48286
+ const [isRevealing, setIsRevealing] = useState34(false);
48435
48287
  const isStreamingDisplay = isStreaming || isRevealing;
48436
48288
  const detail = useChatSessionDetail(sessionId);
48437
48289
  const { isReplay } = useSessionReplay(sessionId);
48438
48290
  const isLoadingHistory = useIsSessionHistoryLoading(sessionId);
48439
- const [queuePanelVisible, setQueuePanelVisible] = useState35(false);
48291
+ const [queuePanelVisible, setQueuePanelVisible] = useState34(false);
48440
48292
  const loadOlder = useCallback17(
48441
48293
  async (beforeCommit) => {
48442
48294
  if (!agentSession) return false;
@@ -48446,7 +48298,7 @@ function ChatPanel({
48446
48298
  },
48447
48299
  [agentSession]
48448
48300
  );
48449
- const [paginationActivation, setPaginationActivation] = useState35(() => ({
48301
+ const [paginationActivation, setPaginationActivation] = useState34(() => ({
48450
48302
  sessionId,
48451
48303
  activated: Boolean(nextBefore)
48452
48304
  }));
@@ -48467,7 +48319,7 @@ function ChatPanel({
48467
48319
  const isViewer = (viewerRole ?? detail?.viewer_role) === "viewer";
48468
48320
  const isCompacting = activeCompaction != null || compactionPending;
48469
48321
  const postChatFollowup = useMemo17(() => latestPostChatFollowup(turns), [turns]);
48470
- const [resultFeedback, setResultFeedback] = useState35([]);
48322
+ const [resultFeedback, setResultFeedback] = useState34([]);
48471
48323
  useEffect29(() => {
48472
48324
  setResultFeedback([]);
48473
48325
  if (isViewer || !sessionId) return;
@@ -48568,7 +48420,7 @@ function ChatPanel({
48568
48420
  sessionId,
48569
48421
  onSend: sendNewUserMessage,
48570
48422
  onStop: stop,
48571
- isStreaming: isStreamingDisplay,
48423
+ isStreaming: isStreamingDisplay || !developer && isCompacting,
48572
48424
  queueWhileRunning: true,
48573
48425
  isCompacting,
48574
48426
  isStopping,
@@ -48579,7 +48431,7 @@ function ChatPanel({
48579
48431
  onCommand,
48580
48432
  canCreateBoardTask,
48581
48433
  canShareSession,
48582
- planPanel: !lite ? /* @__PURE__ */ jsx51(CurrentPlanPanel, { sessionId, className: "border-b border-[hsl(var(--border))] px-4" }) : null,
48434
+ planPanel: !lite ? /* @__PURE__ */ jsx50(CurrentPlanPanel, { sessionId, className: "border-b border-[hsl(var(--border))] px-4" }) : null,
48583
48435
  maxWidthClassName: cn("max-w-3xl", classNames?.chatInputInner),
48584
48436
  // 队列面板此刻占位时,输入框上两角改直角,跟它拼成一条完整轮廓。
48585
48437
  // 用面板自己上报的状态,不在宿主侧复算。
@@ -48604,14 +48456,14 @@ function ChatPanel({
48604
48456
  initialDraftKey,
48605
48457
  lite
48606
48458
  };
48607
- return /* @__PURE__ */ jsx51(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx51(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx51(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx51(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */ jsxs44(
48459
+ return /* @__PURE__ */ jsx50(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx50(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx50(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx50(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx50(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */ jsxs43(
48608
48460
  "div",
48609
48461
  {
48610
48462
  "data-theme": theme,
48611
48463
  part: "root",
48612
48464
  className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
48613
48465
  children: [
48614
- isViewer && /* @__PURE__ */ jsxs44(
48466
+ isViewer && /* @__PURE__ */ jsxs43(
48615
48467
  "div",
48616
48468
  {
48617
48469
  className: cn(
@@ -48619,27 +48471,27 @@ function ChatPanel({
48619
48471
  classNames?.viewerBanner
48620
48472
  ),
48621
48473
  children: [
48622
- /* @__PURE__ */ jsx51(Eye, { size: 14 }),
48474
+ /* @__PURE__ */ jsx50(Eye, { size: 14 }),
48623
48475
  "\u4F60\u6B63\u5728\u67E5\u770B\u5206\u4EAB\u7684\u4F1A\u8BDD\uFF08\u53EA\u8BFB\uFF09"
48624
48476
  ]
48625
48477
  }
48626
48478
  ),
48627
- !isViewer && /* @__PURE__ */ jsx51(ConnectionBanner, { connection }),
48479
+ !isViewer && /* @__PURE__ */ jsx50(ConnectionBanner, { connection }),
48628
48480
  banner,
48629
- /* @__PURE__ */ jsx51(SessionReplayBar, { sessionId, onExit: onExitReplay }),
48630
- errorMessage && /* @__PURE__ */ jsxs44(
48481
+ /* @__PURE__ */ jsx50(SessionReplayBar, { sessionId, onExit: onExitReplay }),
48482
+ errorMessage && /* @__PURE__ */ jsxs43(
48631
48483
  "div",
48632
48484
  {
48633
48485
  part: "error-bar",
48634
48486
  className: "blade-chat-error-bar flex items-start gap-2 border-b border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-4 py-3 text-sm text-[hsl(var(--swf-danger))]",
48635
48487
  children: [
48636
- /* @__PURE__ */ jsx51(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
48637
- /* @__PURE__ */ jsx51("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay3(errorMessage, developer) })
48488
+ /* @__PURE__ */ jsx50(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
48489
+ /* @__PURE__ */ jsx50("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay3(errorMessage, developer) })
48638
48490
  ]
48639
48491
  }
48640
48492
  ),
48641
48493
  header,
48642
- developer && DeveloperMessageList ? /* @__PURE__ */ jsx51(
48494
+ developer && DeveloperMessageList ? /* @__PURE__ */ jsx50(
48643
48495
  DeveloperMessageList,
48644
48496
  {
48645
48497
  sessionId,
@@ -48660,7 +48512,7 @@ function ChatPanel({
48660
48512
  isReplay
48661
48513
  },
48662
48514
  sessionId
48663
- ) : lite ? /* @__PURE__ */ jsx51(
48515
+ ) : lite ? /* @__PURE__ */ jsx50(
48664
48516
  LiteMessageList,
48665
48517
  {
48666
48518
  sessionId,
@@ -48677,7 +48529,7 @@ function ChatPanel({
48677
48529
  onAnswer: isViewer ? void 0 : answerQuestion
48678
48530
  },
48679
48531
  sessionId
48680
- ) : /* @__PURE__ */ jsx51(
48532
+ ) : /* @__PURE__ */ jsx50(
48681
48533
  MessageList,
48682
48534
  {
48683
48535
  sessionId,
@@ -48703,15 +48555,15 @@ function ChatPanel({
48703
48555
  },
48704
48556
  sessionId
48705
48557
  ),
48706
- isViewer && !lite ? /* @__PURE__ */ jsx51(
48558
+ isViewer && !lite ? /* @__PURE__ */ jsx50(
48707
48559
  CurrentPlanPanel,
48708
48560
  {
48709
48561
  sessionId,
48710
48562
  className: cn("mx-auto w-full max-w-3xl px-5 pb-3", classNames?.chatInputInner)
48711
48563
  }
48712
48564
  ) : null,
48713
- !isViewer && /* @__PURE__ */ jsxs44(Fragment19, { children: [
48714
- /* @__PURE__ */ jsx51(
48565
+ !isViewer && /* @__PURE__ */ jsxs43(Fragment19, { children: [
48566
+ /* @__PURE__ */ jsx50(
48715
48567
  SessionQueuePanel,
48716
48568
  {
48717
48569
  snapshot: queue,
@@ -48732,24 +48584,24 @@ function ChatPanel({
48732
48584
  },
48733
48585
  sessionId
48734
48586
  ),
48735
- /* @__PURE__ */ jsx51(Composer, { ...composerProps })
48587
+ /* @__PURE__ */ jsx50(Composer, { ...composerProps })
48736
48588
  ] }),
48737
48589
  footer
48738
48590
  ]
48739
48591
  }
48740
- ) }) }) }) });
48592
+ ) }) }) }) }) });
48741
48593
  }
48742
48594
 
48743
48595
  // src/components/SessionPluginSelector.tsx
48744
- import { useEffect as useEffect30, useState as useState36 } from "react";
48745
- import { jsx as jsx52, jsxs as jsxs45 } from "react/jsx-runtime";
48596
+ import { useEffect as useEffect30, useState as useState35 } from "react";
48597
+ import { jsx as jsx51, jsxs as jsxs44 } from "react/jsx-runtime";
48746
48598
  function SessionPluginSelector(props) {
48747
- return /* @__PURE__ */ jsx52(PluginSelectorState, { ...props }, props.sessionId);
48599
+ return /* @__PURE__ */ jsx51(PluginSelectorState, { ...props }, props.sessionId);
48748
48600
  }
48749
48601
  function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
48750
- const [open2, setOpen] = useState36(false);
48751
- return /* @__PURE__ */ jsxs45("div", { className: `relative text-xs ${className ?? ""}`, children: [
48752
- /* @__PURE__ */ jsx52(
48602
+ const [open2, setOpen] = useState35(false);
48603
+ return /* @__PURE__ */ jsxs44("div", { className: `relative text-xs ${className ?? ""}`, children: [
48604
+ /* @__PURE__ */ jsx51(
48753
48605
  "button",
48754
48606
  {
48755
48607
  type: "button",
@@ -48760,7 +48612,7 @@ function PluginSelectorState({ client, sessionId, className, side = "bottom", on
48760
48612
  children: "\u4F1A\u8BDD\u63D2\u4EF6"
48761
48613
  }
48762
48614
  ),
48763
- open2 ? /* @__PURE__ */ jsx52(PluginSelectorList, { client, sessionId, side, onChange }) : null
48615
+ open2 ? /* @__PURE__ */ jsx51(PluginSelectorList, { client, sessionId, side, onChange }) : null
48764
48616
  ] });
48765
48617
  }
48766
48618
  function PluginSelectorList({
@@ -48774,13 +48626,13 @@ function PluginSelectorList({
48774
48626
  useEffect30(() => {
48775
48627
  reload();
48776
48628
  }, [reload]);
48777
- return /* @__PURE__ */ jsxs45(
48629
+ return /* @__PURE__ */ jsxs44(
48778
48630
  "div",
48779
48631
  {
48780
48632
  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"}`,
48781
48633
  children: [
48782
- controller.listError ? /* @__PURE__ */ jsx52("button", { type: "button", onClick: reload, children: "\u63D2\u4EF6\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u70B9\u51FB\u91CD\u8BD5" }) : null,
48783
- /* @__PURE__ */ jsx52(
48634
+ controller.listError ? /* @__PURE__ */ jsx51("button", { type: "button", onClick: reload, children: "\u63D2\u4EF6\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u70B9\u51FB\u91CD\u8BD5" }) : null,
48635
+ /* @__PURE__ */ jsx51(
48784
48636
  PluginConnectorList,
48785
48637
  {
48786
48638
  client,
@@ -48804,13 +48656,13 @@ function PluginSelectorList({
48804
48656
  }
48805
48657
 
48806
48658
  // src/components/AgentChat.tsx
48807
- import { Fragment as Fragment20, jsx as jsx53, jsxs as jsxs46 } from "react/jsx-runtime";
48659
+ import { Fragment as Fragment20, jsx as jsx52, jsxs as jsxs45 } from "react/jsx-runtime";
48808
48660
  function isUnauthorizedError(error61) {
48809
48661
  return error61 instanceof BladeApiError2 && error61.status === 401;
48810
48662
  }
48811
48663
  function LoginCard({ client, onLoggedIn }) {
48812
- const [loggingIn, setLoggingIn] = useState37(false);
48813
- const [loginError, setLoginError] = useState37(null);
48664
+ const [loggingIn, setLoggingIn] = useState36(false);
48665
+ const [loginError, setLoginError] = useState36(null);
48814
48666
  const handleLogin = async () => {
48815
48667
  setLoggingIn(true);
48816
48668
  setLoginError(null);
@@ -48823,11 +48675,11 @@ function LoginCard({ client, onLoggedIn }) {
48823
48675
  setLoggingIn(false);
48824
48676
  }
48825
48677
  };
48826
- return /* @__PURE__ */ jsx53("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs46("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: [
48827
- /* @__PURE__ */ jsx53(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
48828
- /* @__PURE__ */ jsx53("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
48829
- /* @__PURE__ */ jsx53("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" }),
48830
- /* @__PURE__ */ jsx53(
48678
+ return /* @__PURE__ */ jsx52("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs45("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: [
48679
+ /* @__PURE__ */ jsx52(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
48680
+ /* @__PURE__ */ jsx52("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
48681
+ /* @__PURE__ */ jsx52("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" }),
48682
+ /* @__PURE__ */ jsx52(
48831
48683
  "button",
48832
48684
  {
48833
48685
  type: "button",
@@ -48837,21 +48689,21 @@ function LoginCard({ client, onLoggedIn }) {
48837
48689
  children: loggingIn ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"
48838
48690
  }
48839
48691
  ),
48840
- loginError && /* @__PURE__ */ jsx53("div", { className: "text-xs text-[hsl(var(--destructive))]", children: loginError })
48692
+ loginError && /* @__PURE__ */ jsx52("div", { className: "text-xs text-[hsl(var(--destructive))]", children: loginError })
48841
48693
  ] }) });
48842
48694
  }
48843
48695
  function AgentChat(props) {
48844
48696
  const client = useBladeClient();
48845
- const [attempt, setAttempt] = useState37(0);
48846
- const [needLogin, setNeedLogin] = useState37(() => !client.hasToken());
48697
+ const [attempt, setAttempt] = useState36(0);
48698
+ const [needLogin, setNeedLogin] = useState36(() => !client.hasToken());
48847
48699
  if (needLogin) {
48848
- return /* @__PURE__ */ jsx53(
48700
+ return /* @__PURE__ */ jsx52(
48849
48701
  "div",
48850
48702
  {
48851
48703
  "data-theme": props.theme,
48852
48704
  part: "root",
48853
48705
  className: cn("blade-chat flex min-h-0 flex-1 flex-col", props.classNames?.root),
48854
- children: /* @__PURE__ */ jsx53(
48706
+ children: /* @__PURE__ */ jsx52(
48855
48707
  LoginCard,
48856
48708
  {
48857
48709
  client,
@@ -48864,7 +48716,7 @@ function AgentChat(props) {
48864
48716
  }
48865
48717
  );
48866
48718
  }
48867
- return /* @__PURE__ */ jsx53(ChatSessionView, { ...props, onUnauthorized: () => setNeedLogin(true) }, attempt);
48719
+ return /* @__PURE__ */ jsx52(ChatSessionView, { ...props, onUnauthorized: () => setNeedLogin(true) }, attempt);
48868
48720
  }
48869
48721
  function ChatSessionView({
48870
48722
  sessionId,
@@ -48888,7 +48740,7 @@ function ChatSessionView({
48888
48740
  onSessionCreated
48889
48741
  });
48890
48742
  const replay = useReplay(session);
48891
- const [notice, setNotice] = useState37(null);
48743
+ const [notice, setNotice] = useState36(null);
48892
48744
  const source = useSingleSessionSource(session, !session || state === null);
48893
48745
  const resolvedSessionId = session?.sessionId;
48894
48746
  const isViewer = state?.viewerRole === "viewer";
@@ -48933,7 +48785,7 @@ function ChatSessionView({
48933
48785
  );
48934
48786
  const connectError = error61 && !isUnauthorizedError(error61) ? error61.message || "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5" : null;
48935
48787
  const sessionClient = resolvedSessionId && createOptions?.anonymous && !client.options.anonymousSessionId ? client.forAnonymousSession(resolvedSessionId) : client;
48936
- return /* @__PURE__ */ jsx53(BladeProvider, { client: sessionClient, host, children: /* @__PURE__ */ jsx53(SessionSourceProvider, { source, children: /* @__PURE__ */ jsx53(ChatEnvironmentProvider, { value: environment, children: /* @__PURE__ */ jsx53(
48788
+ return /* @__PURE__ */ jsx52(BladeProvider, { client: sessionClient, host, children: /* @__PURE__ */ jsx52(SessionSourceProvider, { source, children: /* @__PURE__ */ jsx52(ChatEnvironmentProvider, { value: environment, children: /* @__PURE__ */ jsx52(
48937
48789
  ChatPanel,
48938
48790
  {
48939
48791
  sessionId: resolvedSessionId ?? "",
@@ -48947,9 +48799,9 @@ function ChatSessionView({
48947
48799
  onFollowupInteraction,
48948
48800
  errorMessage: connectError ?? replay.error?.message ?? notice,
48949
48801
  onExitReplay: () => void replay.exitToAutonomous(),
48950
- banner: /* @__PURE__ */ jsxs46(Fragment20, { children: [
48951
- resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx53(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
48952
- /* @__PURE__ */ jsx53(ReplayMismatchPrompt, { mismatch: replay.mismatch })
48802
+ banner: /* @__PURE__ */ jsxs45(Fragment20, { children: [
48803
+ resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx52(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
48804
+ /* @__PURE__ */ jsx52(ReplayMismatchPrompt, { mismatch: replay.mismatch })
48953
48805
  ] })
48954
48806
  }
48955
48807
  ) }) }) });
@@ -48957,20 +48809,20 @@ function ChatSessionView({
48957
48809
 
48958
48810
  // src/components/LlmChat.tsx
48959
48811
  import { chatErrorForDisplay as chatErrorForDisplay4 } from "@blade-hq/agent-client/internal";
48960
- import { useEffect as useEffect32, useMemo as useMemo20, useState as useState40 } from "react";
48812
+ import { useEffect as useEffect32, useMemo as useMemo20, useState as useState39 } from "react";
48961
48813
 
48962
48814
  // src/hooks/use-llm-chat.ts
48963
- import { useCallback as useCallback18, useMemo as useMemo19, useRef as useRef30, useState as useState38 } from "react";
48815
+ import { useCallback as useCallback18, useMemo as useMemo19, useRef as useRef30, useState as useState37 } from "react";
48964
48816
  var DEFAULT_HISTORY_TURNS = 12;
48965
48817
  var DEFAULT_MAX_TOOL_ROUNDS = 4;
48966
48818
  var syntheticIdSeq = 0;
48967
48819
  function useLlmChat(options) {
48968
- const [history, setHistory] = useState38([]);
48969
- const [streamingText, setStreamingText] = useState38(null);
48970
- const [streamingCalls, setStreamingCalls] = useState38([]);
48971
- const [failedToolIds, setFailedToolIds] = useState38([]);
48972
- const [error61, setError] = useState38(null);
48973
- const [isStreaming, setIsStreaming] = useState38(false);
48820
+ const [history, setHistory] = useState37([]);
48821
+ const [streamingText, setStreamingText] = useState37(null);
48822
+ const [streamingCalls, setStreamingCalls] = useState37([]);
48823
+ const [failedToolIds, setFailedToolIds] = useState37([]);
48824
+ const [error61, setError] = useState37(null);
48825
+ const [isStreaming, setIsStreaming] = useState37(false);
48974
48826
  const abortRef = useRef30(null);
48975
48827
  const activeStartedAtRef = useRef30(null);
48976
48828
  const assistantTimingsRef = useRef30(/* @__PURE__ */ new WeakMap());
@@ -49316,8 +49168,8 @@ function toToolCallInfo(call, results, failedToolIds) {
49316
49168
  }
49317
49169
 
49318
49170
  // src/components/LlmAdvancedSettings.tsx
49319
- import { useState as useState39 } from "react";
49320
- import { jsx as jsx54, jsxs as jsxs47 } from "react/jsx-runtime";
49171
+ import { useState as useState38 } from "react";
49172
+ import { jsx as jsx53, jsxs as jsxs46 } from "react/jsx-runtime";
49321
49173
  var FIELDS = [
49322
49174
  { id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
49323
49175
  { id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
@@ -49363,13 +49215,13 @@ function writeOverride(settings, baseURL, override) {
49363
49215
  }
49364
49216
  function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
49365
49217
  const normalized = normalizeAdvanced(settings);
49366
- const [open2, setOpen] = useState39(false);
49367
- const [draft, setDraft] = useState39(override);
49218
+ const [open2, setOpen] = useState38(false);
49219
+ const [draft, setDraft] = useState38(override);
49368
49220
  if (!normalized) return null;
49369
49221
  const fields = FIELDS.filter((field) => normalized[field.id]);
49370
49222
  const dirty = Object.keys(override).length > 0;
49371
- return /* @__PURE__ */ jsxs47("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
49372
- /* @__PURE__ */ jsxs47(
49223
+ return /* @__PURE__ */ jsxs46("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
49224
+ /* @__PURE__ */ jsxs46(
49373
49225
  "button",
49374
49226
  {
49375
49227
  type: "button",
@@ -49379,16 +49231,16 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
49379
49231
  },
49380
49232
  className: "flex items-center gap-1.5 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
49381
49233
  children: [
49382
- /* @__PURE__ */ jsx54(Settings2, { size: 13 }),
49234
+ /* @__PURE__ */ jsx53(Settings2, { size: 13 }),
49383
49235
  "\u9AD8\u7EA7\u8BBE\u7F6E",
49384
- dirty && /* @__PURE__ */ jsx54("span", { className: "text-[hsl(var(--primary))]", children: "\uFF08\u5DF2\u81EA\u5B9A\u4E49\uFF09" })
49236
+ dirty && /* @__PURE__ */ jsx53("span", { className: "text-[hsl(var(--primary))]", children: "\uFF08\u5DF2\u81EA\u5B9A\u4E49\uFF09" })
49385
49237
  ]
49386
49238
  }
49387
49239
  ),
49388
- open2 && /* @__PURE__ */ jsxs47("div", { className: "mt-2 flex flex-col gap-2", children: [
49389
- fields.map((field) => /* @__PURE__ */ jsxs47("label", { className: "flex flex-col gap-1", children: [
49390
- /* @__PURE__ */ jsx54("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
49391
- /* @__PURE__ */ jsx54(
49240
+ open2 && /* @__PURE__ */ jsxs46("div", { className: "mt-2 flex flex-col gap-2", children: [
49241
+ fields.map((field) => /* @__PURE__ */ jsxs46("label", { className: "flex flex-col gap-1", children: [
49242
+ /* @__PURE__ */ jsx53("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
49243
+ /* @__PURE__ */ jsx53(
49392
49244
  "input",
49393
49245
  {
49394
49246
  type: field.secret ? "password" : "text",
@@ -49399,9 +49251,9 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
49399
49251
  }
49400
49252
  )
49401
49253
  ] }, field.id)),
49402
- normalized.apiKey && /* @__PURE__ */ jsx54("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" }),
49403
- /* @__PURE__ */ jsxs47("div", { className: "flex gap-2", children: [
49404
- /* @__PURE__ */ jsx54(
49254
+ normalized.apiKey && /* @__PURE__ */ jsx53("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" }),
49255
+ /* @__PURE__ */ jsxs46("div", { className: "flex gap-2", children: [
49256
+ /* @__PURE__ */ jsx53(
49405
49257
  "button",
49406
49258
  {
49407
49259
  type: "button",
@@ -49416,7 +49268,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
49416
49268
  children: "\u4FDD\u5B58"
49417
49269
  }
49418
49270
  ),
49419
- /* @__PURE__ */ jsx54(
49271
+ /* @__PURE__ */ jsx53(
49420
49272
  "button",
49421
49273
  {
49422
49274
  type: "button",
@@ -49435,7 +49287,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
49435
49287
  }
49436
49288
 
49437
49289
  // src/components/LlmChat.tsx
49438
- import { jsx as jsx55, jsxs as jsxs48 } from "react/jsx-runtime";
49290
+ import { jsx as jsx54, jsxs as jsxs47 } from "react/jsx-runtime";
49439
49291
  function LlmChat({
49440
49292
  classNames,
49441
49293
  renderers,
@@ -49447,12 +49299,12 @@ function LlmChat({
49447
49299
  onOverrideChange,
49448
49300
  ...options
49449
49301
  }) {
49450
- const [override, setOverride] = useState40(() => readOverride(advanced, options.baseURL));
49302
+ const [override, setOverride] = useState39(() => readOverride(advanced, options.baseURL));
49451
49303
  const effective = { ...options, ...override };
49452
49304
  const { messages, isStreaming, error: error61, send, stop, reset } = useLlmChat(effective);
49453
- const [inputText, setInputText] = useState40("");
49454
- const [stopRequested, setStopRequested] = useState40(false);
49455
- const [isRevealing, setIsRevealing] = useState40(false);
49305
+ const [inputText, setInputText] = useState39("");
49306
+ const [stopRequested, setStopRequested] = useState39(false);
49307
+ const [isRevealing, setIsRevealing] = useState39(false);
49456
49308
  const isStreamingDisplay = isStreaming || isRevealing;
49457
49309
  const handle = useMemo20(
49458
49310
  () => ({
@@ -49467,26 +49319,26 @@ ${text4}` : text4),
49467
49319
  onReady?.(handle);
49468
49320
  }, [handle, onReady]);
49469
49321
  const customization = useMemo20(() => ({ classNames, renderers }), [classNames, renderers]);
49470
- return /* @__PURE__ */ jsx55(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs48(
49322
+ return /* @__PURE__ */ jsx54(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs47(
49471
49323
  "div",
49472
49324
  {
49473
49325
  "data-theme": theme,
49474
49326
  part: "root",
49475
49327
  className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
49476
49328
  children: [
49477
- error61 ? /* @__PURE__ */ jsxs48(
49329
+ error61 ? /* @__PURE__ */ jsxs47(
49478
49330
  "div",
49479
49331
  {
49480
49332
  part: "error-bar",
49481
49333
  className: "blade-chat-error-bar flex items-start gap-2 border-b border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-4 py-3 text-sm text-[hsl(var(--swf-danger))]",
49482
49334
  children: [
49483
- /* @__PURE__ */ jsx55(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
49484
- /* @__PURE__ */ jsx55("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay4(error61) })
49335
+ /* @__PURE__ */ jsx54(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
49336
+ /* @__PURE__ */ jsx54("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay4(error61) })
49485
49337
  ]
49486
49338
  }
49487
49339
  ) : null,
49488
49340
  slots?.header,
49489
- /* @__PURE__ */ jsx55(
49341
+ /* @__PURE__ */ jsx54(
49490
49342
  MessageList,
49491
49343
  {
49492
49344
  sessionId: "",
@@ -49498,7 +49350,7 @@ ${text4}` : text4),
49498
49350
  onRevealingChange: setIsRevealing
49499
49351
  }
49500
49352
  ),
49501
- advanced ? /* @__PURE__ */ jsx55(
49353
+ advanced ? /* @__PURE__ */ jsx54(
49502
49354
  LlmAdvancedSettingsBar,
49503
49355
  {
49504
49356
  settings: advanced,
@@ -49511,7 +49363,7 @@ ${text4}` : text4),
49511
49363
  }
49512
49364
  }
49513
49365
  ) : null,
49514
- /* @__PURE__ */ jsx55(
49366
+ /* @__PURE__ */ jsx54(
49515
49367
  ChatInput,
49516
49368
  {
49517
49369
  value: inputText,
@@ -49540,14 +49392,14 @@ ${text4}` : text4),
49540
49392
  }
49541
49393
 
49542
49394
  // src/components/ChatView.tsx
49543
- import { jsx as jsx56 } from "react/jsx-runtime";
49395
+ import { jsx as jsx55 } from "react/jsx-runtime";
49544
49396
  function ChatView(props) {
49545
49397
  const { mode, llm, onLlmReady, ...rest } = props;
49546
49398
  if (mode === "llm") {
49547
49399
  if (!llm) {
49548
49400
  throw new Error('ChatView: mode="llm" \u9700\u8981\u540C\u65F6\u4F20 llm={{ baseURL, model }}');
49549
49401
  }
49550
- return /* @__PURE__ */ jsx56(
49402
+ return /* @__PURE__ */ jsx55(
49551
49403
  LlmChat,
49552
49404
  {
49553
49405
  ...llm,
@@ -49560,12 +49412,12 @@ function ChatView(props) {
49560
49412
  }
49561
49413
  );
49562
49414
  }
49563
- return /* @__PURE__ */ jsx56(AgentChat, { ...rest });
49415
+ return /* @__PURE__ */ jsx55(AgentChat, { ...rest });
49564
49416
  }
49565
49417
 
49566
49418
  // src/components/TopicAssetSubmitDialog.tsx
49567
- import { useRef as useRef31, useState as useState41 } from "react";
49568
- import { jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
49419
+ import { useRef as useRef31, useState as useState40 } from "react";
49420
+ import { jsx as jsx56, jsxs as jsxs48 } from "react/jsx-runtime";
49569
49421
  function useTopicAssetSubmissionAccess(sessionId) {
49570
49422
  const client = useBladeClient();
49571
49423
  return useAsyncValue(sessionId, async (signal) => {
@@ -49581,12 +49433,12 @@ function useTopicAssetSubmissionAccess(sessionId) {
49581
49433
  }
49582
49434
  function TopicAssetSubmitDialog({ sessionId, topicId, path: path2, onClose, onSubmitted }) {
49583
49435
  const client = useBladeClient();
49584
- const [folder, setFolder] = useState41("");
49585
- const [message, setMessage] = useState41("");
49586
- const [error61, setError] = useState41(null);
49587
- const [busy, setBusy] = useState41(false);
49436
+ const [folder, setFolder] = useState40("");
49437
+ const [message, setMessage] = useState40("");
49438
+ const [error61, setError] = useState40(null);
49439
+ const [busy, setBusy] = useState40(false);
49588
49440
  const submitting = useRef31(false);
49589
- const [revision, setRevision] = useState41(0);
49441
+ const [revision, setRevision] = useState40(0);
49590
49442
  const assets = useAsyncValue(`${sessionId}:${topicId}:${revision}`, async () => {
49591
49443
  const [session, groups, result] = await Promise.all([
49592
49444
  client.sessions.getSession(sessionId),
@@ -49621,36 +49473,36 @@ function TopicAssetSubmitDialog({ sessionId, topicId, path: path2, onClose, onSu
49621
49473
  setBusy(false);
49622
49474
  }
49623
49475
  };
49624
- return /* @__PURE__ */ jsx57(Dialog, { open: true, onOpenChange: (open2) => {
49476
+ return /* @__PURE__ */ jsx56(Dialog, { open: true, onOpenChange: (open2) => {
49625
49477
  if (!open2 && !busy) onClose();
49626
- }, children: /* @__PURE__ */ jsxs49(DialogContent, { className: "max-w-md", children: [
49627
- /* @__PURE__ */ jsx57(DialogTitle, { children: "\u63D0\u4EA4\u5230\u8D44\u4EA7" }),
49628
- /* @__PURE__ */ jsx57(DialogDescription, { children: "\u5C06\u6587\u4EF6\u590D\u5236\u5230\u4E3B\u9898\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" }),
49629
- /* @__PURE__ */ jsxs49("form", { onSubmit: (event) => {
49478
+ }, children: /* @__PURE__ */ jsxs48(DialogContent, { className: "max-w-md", children: [
49479
+ /* @__PURE__ */ jsx56(DialogTitle, { children: "\u63D0\u4EA4\u5230\u8D44\u4EA7" }),
49480
+ /* @__PURE__ */ jsx56(DialogDescription, { children: "\u5C06\u6587\u4EF6\u590D\u5236\u5230\u4E3B\u9898\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" }),
49481
+ /* @__PURE__ */ jsxs48("form", { onSubmit: (event) => {
49630
49482
  event.preventDefault();
49631
49483
  void submit();
49632
49484
  }, className: "flex flex-col gap-4", children: [
49633
- /* @__PURE__ */ jsx57("p", { className: "break-all text-sm text-secondary-foreground", children: path2 }),
49634
- /* @__PURE__ */ jsxs49("label", { className: "flex flex-col gap-1 text-sm", children: [
49485
+ /* @__PURE__ */ jsx56("p", { className: "break-all text-sm text-secondary-foreground", children: path2 }),
49486
+ /* @__PURE__ */ jsxs48("label", { className: "flex flex-col gap-1 text-sm", children: [
49635
49487
  "\u76EE\u6807\u6587\u4EF6\u5939",
49636
- /* @__PURE__ */ jsxs49("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: [
49637
- /* @__PURE__ */ jsx57("option", { value: "", children: "\u8D44\u4EA7\u6839\u76EE\u5F55" }),
49638
- assets.data?.map((item) => /* @__PURE__ */ jsx57("option", { value: item, children: item }, item))
49488
+ /* @__PURE__ */ jsxs48("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: [
49489
+ /* @__PURE__ */ jsx56("option", { value: "", children: "\u8D44\u4EA7\u6839\u76EE\u5F55" }),
49490
+ assets.data?.map((item) => /* @__PURE__ */ jsx56("option", { value: item, children: item }, item))
49639
49491
  ] })
49640
49492
  ] }),
49641
- /* @__PURE__ */ jsxs49("label", { className: "flex flex-col gap-1 text-sm", children: [
49493
+ /* @__PURE__ */ jsxs48("label", { className: "flex flex-col gap-1 text-sm", children: [
49642
49494
  "\u8BF4\u660E\uFF08\u53EF\u9009\uFF09",
49643
- /* @__PURE__ */ jsx57("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" })
49495
+ /* @__PURE__ */ jsx56("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" })
49644
49496
  ] }),
49645
- assets.error ? /* @__PURE__ */ jsxs49("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
49497
+ assets.error ? /* @__PURE__ */ jsxs48("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
49646
49498
  assets.error instanceof Error ? assets.error.message : "\u8D44\u4EA7\u52A0\u8F7D\u5931\u8D25",
49647
49499
  " ",
49648
- /* @__PURE__ */ jsx57("button", { type: "button", onClick: () => setRevision((n2) => n2 + 1), className: "underline", children: "\u91CD\u8BD5" })
49649
- ] }) : !assets.data ? /* @__PURE__ */ jsx57("output", { className: "text-sm text-muted-foreground", children: "\u6B63\u5728\u52A0\u8F7D\u8D44\u4EA7\u2026" }) : null,
49650
- error61 ? /* @__PURE__ */ jsx57("p", { role: "alert", className: "text-sm text-muted-foreground", children: error61 }) : null,
49651
- /* @__PURE__ */ jsxs49("div", { className: "flex justify-end gap-2", children: [
49652
- /* @__PURE__ */ jsx57("button", { type: "button", disabled: busy, onClick: onClose, className: "rounded-md border border-border px-3 py-2 text-sm", children: "\u53D6\u6D88" }),
49653
- /* @__PURE__ */ jsx57("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" })
49500
+ /* @__PURE__ */ jsx56("button", { type: "button", onClick: () => setRevision((n2) => n2 + 1), className: "underline", children: "\u91CD\u8BD5" })
49501
+ ] }) : !assets.data ? /* @__PURE__ */ jsx56("output", { className: "text-sm text-muted-foreground", children: "\u6B63\u5728\u52A0\u8F7D\u8D44\u4EA7\u2026" }) : null,
49502
+ error61 ? /* @__PURE__ */ jsx56("p", { role: "alert", className: "text-sm text-muted-foreground", children: error61 }) : null,
49503
+ /* @__PURE__ */ jsxs48("div", { className: "flex justify-end gap-2", children: [
49504
+ /* @__PURE__ */ jsx56("button", { type: "button", disabled: busy, onClick: onClose, className: "rounded-md border border-border px-3 py-2 text-sm", children: "\u53D6\u6D88" }),
49505
+ /* @__PURE__ */ jsx56("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" })
49654
49506
  ] })
49655
49507
  ] })
49656
49508
  ] }) });
@@ -49710,4 +49562,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
49710
49562
  js-yaml/dist/js-yaml.mjs:
49711
49563
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
49712
49564
  */
49713
- //# sourceMappingURL=chunk-KSVVYASW.js.map
49565
+ //# sourceMappingURL=chunk-GSKRNKEI.js.map