@blade-hq/agent-react 2612.0.0-beta.1 → 2612.0.0-beta.3
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.
|
@@ -5,6 +5,7 @@ import type { ResultFeedback } from "@blade-hq/agent-client/internal";
|
|
|
5
5
|
import type { AskUserAnswerData } from "./AskUserQuestionBlock";
|
|
6
6
|
import type { ChatViewCustomization } from "./customization";
|
|
7
7
|
export { shouldAppendPendingAssistantTurn } from "./message-list-blocks";
|
|
8
|
+
export declare function isReasoningRevealingForMessage(message: ChatMessage | undefined, isRevealing: boolean, isStopping?: boolean): boolean;
|
|
8
9
|
export interface MessageListProps {
|
|
9
10
|
sessionId: string;
|
|
10
11
|
messages: ChatMessage[];
|
|
@@ -37003,26 +37003,6 @@ function parseAskUserQuestion(toolResult) {
|
|
|
37003
37003
|
}
|
|
37004
37004
|
return null;
|
|
37005
37005
|
}
|
|
37006
|
-
function parseAskUserQuestionError(toolResult) {
|
|
37007
|
-
if (!toolResult) return null;
|
|
37008
|
-
try {
|
|
37009
|
-
const parsed = JSON.parse(toolResult);
|
|
37010
|
-
let detail = null;
|
|
37011
|
-
if (typeof parsed.error === "string") detail = parsed.error;
|
|
37012
|
-
if (parsed.error && typeof parsed.error === "object") {
|
|
37013
|
-
const message = parsed.error.message;
|
|
37014
|
-
if (typeof message === "string") detail = message;
|
|
37015
|
-
}
|
|
37016
|
-
if (!detail && typeof parsed.message === "string") detail = parsed.message;
|
|
37017
|
-
if (!detail) return null;
|
|
37018
|
-
return {
|
|
37019
|
-
message: parsed.error_code === "invalid_questions" ? "\u63D0\u95EE\u5185\u5BB9\u4E0D\u5B8C\u6574\uFF0C\u5F53\u524D\u6CA1\u6709\u7B49\u5F85\u4F60\u56DE\u7B54\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" : "\u8FD9\u6B21\u63D0\u95EE\u6CA1\u6709\u6210\u529F\uFF0C\u5F53\u524D\u6CA1\u6709\u7B49\u5F85\u4F60\u56DE\u7B54\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002",
|
|
37020
|
-
detail
|
|
37021
|
-
};
|
|
37022
|
-
} catch {
|
|
37023
|
-
return null;
|
|
37024
|
-
}
|
|
37025
|
-
}
|
|
37026
37006
|
function normalizeQuestionItem(value) {
|
|
37027
37007
|
if (!value || typeof value !== "object") return null;
|
|
37028
37008
|
const item = value;
|
|
@@ -38260,6 +38240,7 @@ function ToolCallBlock({
|
|
|
38260
38240
|
const customToolCall2 = customQuestion == null && !customization?.renderers?.askUserQuestion ? customization?.renderers?.toolCall?.(toolCall) : null;
|
|
38261
38241
|
if (customQuestion != null) return /* @__PURE__ */ jsx29(Fragment11, { children: customQuestion });
|
|
38262
38242
|
if (customToolCall2 != null) return /* @__PURE__ */ jsx29(Fragment11, { children: customToolCall2 });
|
|
38243
|
+
if (toolCall.status === "error") return null;
|
|
38263
38244
|
if (askData) {
|
|
38264
38245
|
const questionBlock = /* @__PURE__ */ jsx29(
|
|
38265
38246
|
AskUserQuestionBlock,
|
|
@@ -38280,19 +38261,6 @@ function ToolCallBlock({
|
|
|
38280
38261
|
/* @__PURE__ */ jsx29("div", { className: "ml-4", children: /* @__PURE__ */ jsx29(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
38281
38262
|
] });
|
|
38282
38263
|
}
|
|
38283
|
-
if (toolCall.status === "error") {
|
|
38284
|
-
const errorDetail = parseAskUserQuestionError(
|
|
38285
|
-
typeof toolCall.result === "string" ? toolCall.result : null
|
|
38286
|
-
);
|
|
38287
|
-
return /* @__PURE__ */ jsxs24("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 max-w-lg rounded-xl border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] p-4 text-sm text-[hsl(var(--foreground))]", children: [
|
|
38288
|
-
/* @__PURE__ */ jsx29("div", { className: "font-semibold", children: "\u8FD9\u6B21\u63D0\u95EE\u672A\u80FD\u751F\u6210" }),
|
|
38289
|
-
/* @__PURE__ */ jsx29("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: errorDetail?.message ?? "\u63D0\u95EE\u9009\u9879\u7684\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5F53\u524D\u6CA1\u6709\u7B49\u5F85\u4F60\u56DE\u7B54\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" }),
|
|
38290
|
-
errorDetail?.detail ? /* @__PURE__ */ jsxs24("details", { className: "mt-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
38291
|
-
/* @__PURE__ */ jsx29("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5177\u4F53\u539F\u56E0" }),
|
|
38292
|
-
/* @__PURE__ */ jsx29("div", { className: "mt-1 break-words font-mono", children: errorDetail.detail })
|
|
38293
|
-
] }) : null
|
|
38294
|
-
] });
|
|
38295
|
-
}
|
|
38296
38264
|
if (toolCall.status === "pending") {
|
|
38297
38265
|
return /* @__PURE__ */ jsxs24("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 flex max-w-lg items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
|
|
38298
38266
|
/* @__PURE__ */ jsx29(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
@@ -46537,6 +46505,11 @@ function calculateAnimatedScrollTop({
|
|
|
46537
46505
|
|
|
46538
46506
|
// src/chat/MessageList.tsx
|
|
46539
46507
|
import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
46508
|
+
function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
|
|
46509
|
+
if (isStopping) return false;
|
|
46510
|
+
const hasContent = message?.content != null && message.content.length > 0;
|
|
46511
|
+
return isRevealing || Boolean(message?.reasoning && !hasContent && !message.tool_calls?.length);
|
|
46512
|
+
}
|
|
46540
46513
|
function getMessageMeasureSignature(message) {
|
|
46541
46514
|
const contentSize = typeof message.content === "string" ? message.content.length : message.content.length;
|
|
46542
46515
|
return [
|
|
@@ -46641,6 +46614,11 @@ function MessageListBody({
|
|
|
46641
46614
|
const isRevealLive = latestAssistantMessage != null && !isReplay;
|
|
46642
46615
|
const contentReveal = useTypewriterReveal(revealContentText, isRevealLive, revealTargetKey);
|
|
46643
46616
|
const reasoningReveal = useTypewriterReveal(revealReasoningText, isRevealLive, revealTargetKey);
|
|
46617
|
+
const isReasoningRevealing = isReasoningRevealingForMessage(
|
|
46618
|
+
latestAssistantMessage,
|
|
46619
|
+
reasoningReveal.isRevealing,
|
|
46620
|
+
isStopping
|
|
46621
|
+
);
|
|
46644
46622
|
const isRevealingAny = contentReveal.isRevealing || reasoningReveal.isRevealing;
|
|
46645
46623
|
useEffect26(() => {
|
|
46646
46624
|
onRevealingChange?.(isRevealingAny);
|
|
@@ -47579,7 +47557,7 @@ function MessageListBody({
|
|
|
47579
47557
|
renderBlocks,
|
|
47580
47558
|
sessionId,
|
|
47581
47559
|
sessionStatus,
|
|
47582
|
-
isReasoningRevealing
|
|
47560
|
+
isReasoningRevealing,
|
|
47583
47561
|
revealTargetMessage: latestAssistantMessage,
|
|
47584
47562
|
revealedContentText: contentReveal.displayedText,
|
|
47585
47563
|
revealedReasoningText: reasoningReveal.displayedText,
|
|
@@ -49362,4 +49340,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
49362
49340
|
js-yaml/dist/js-yaml.mjs:
|
|
49363
49341
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
49364
49342
|
*/
|
|
49365
|
-
//# sourceMappingURL=chunk-
|
|
49343
|
+
//# sourceMappingURL=chunk-5J54S5BK.js.map
|