@blade-hq/agent-react 2612.0.0-beta.92 → 2612.0.0-beta.94
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.
- package/dist/SessionPluginConfigForm-DWLJEYBY.js +9 -0
- package/dist/{chunk-R2WN24PN.js → chunk-4VBPNAAT.js} +3 -3
- package/dist/{chunk-74FML2TR.js → chunk-6Z7T6BOB.js} +13 -5
- package/dist/{chunk-74FML2TR.js.map → chunk-6Z7T6BOB.js.map} +1 -1
- package/dist/{chunk-Q2JZ5FBP.js → chunk-CJQINCIP.js} +3 -3
- package/dist/{chunk-ZRMO4P2Y.js → chunk-EE6BXK2Y.js} +355 -238
- package/dist/chunk-EE6BXK2Y.js.map +1 -0
- package/dist/{chunk-5ESAKOUV.js → chunk-FTBMG7TK.js} +2 -2
- package/dist/{chunk-DL7XZGQS.js → chunk-FXTAY3LE.js} +2 -2
- package/dist/{chunk-SEJUZPT5.js → chunk-IOKIQSWP.js} +6 -1
- package/dist/chunk-IOKIQSWP.js.map +1 -0
- package/dist/{chunk-R6TH36MS.js → chunk-JFMCB64M.js} +7 -7
- package/dist/{chunk-L75DNQ3N.js → chunk-RHUJ77ZZ.js} +5 -5
- package/dist/{chunk-UKJ2UI4S.js → chunk-S7VETPDT.js} +4 -4
- package/dist/components/ChatInput.d.ts +4 -2
- package/dist/components/ExecutionProcessContext.d.ts +2 -0
- package/dist/connectors.js +3 -3
- package/dist/index.js +9 -9
- package/dist/internal.js +10 -10
- package/dist/questions.js +4 -4
- package/dist/rich-input.js +7 -7
- package/dist/style.full.css +1 -1
- package/dist/tool-details.js +5 -5
- package/package.json +2 -2
- package/dist/SessionPluginConfigForm-Y657MKRX.js +0 -9
- package/dist/chunk-SEJUZPT5.js.map +0 -1
- package/dist/chunk-ZRMO4P2Y.js.map +0 -1
- /package/dist/{SessionPluginConfigForm-Y657MKRX.js.map → SessionPluginConfigForm-DWLJEYBY.js.map} +0 -0
- /package/dist/{chunk-R2WN24PN.js.map → chunk-4VBPNAAT.js.map} +0 -0
- /package/dist/{chunk-Q2JZ5FBP.js.map → chunk-CJQINCIP.js.map} +0 -0
- /package/dist/{chunk-5ESAKOUV.js.map → chunk-FTBMG7TK.js.map} +0 -0
- /package/dist/{chunk-DL7XZGQS.js.map → chunk-FXTAY3LE.js.map} +0 -0
- /package/dist/{chunk-R6TH36MS.js.map → chunk-JFMCB64M.js.map} +0 -0
- /package/dist/{chunk-L75DNQ3N.js.map → chunk-RHUJ77ZZ.js.map} +0 -0
- /package/dist/{chunk-UKJ2UI4S.js.map → chunk-S7VETPDT.js.map} +0 -0
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
useEffectEvent,
|
|
10
10
|
useSessionPluginActivation,
|
|
11
11
|
useSessionSkills
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S7VETPDT.js";
|
|
13
13
|
import {
|
|
14
14
|
ImageLightbox,
|
|
15
15
|
McpAppMessageContext,
|
|
16
16
|
MessageImage,
|
|
17
17
|
ToolUiCardView,
|
|
18
18
|
getRenderer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RHUJ77ZZ.js";
|
|
20
20
|
import {
|
|
21
21
|
MarkdownContent
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6Z7T6BOB.js";
|
|
23
23
|
import {
|
|
24
24
|
BladeProvider,
|
|
25
25
|
ChatEnvironmentProvider,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
useSessionSource,
|
|
57
57
|
useSessionState,
|
|
58
58
|
useSingleSessionSource
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-CJQINCIP.js";
|
|
60
60
|
import {
|
|
61
61
|
Collapsible,
|
|
62
62
|
CollapsibleContent,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
DialogDescription,
|
|
68
68
|
DialogTitle,
|
|
69
69
|
useControllableState
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-FXTAY3LE.js";
|
|
71
71
|
import {
|
|
72
72
|
Archive,
|
|
73
73
|
ArrowRight,
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
Check,
|
|
83
83
|
ChevronDown,
|
|
84
84
|
ChevronRight,
|
|
85
|
+
ChevronUp,
|
|
85
86
|
CircleAlert,
|
|
86
87
|
CircleCheck,
|
|
87
88
|
CirclePause,
|
|
@@ -108,6 +109,7 @@ import {
|
|
|
108
109
|
MessageSquareMore,
|
|
109
110
|
Music,
|
|
110
111
|
PanelRightOpen,
|
|
112
|
+
Paperclip,
|
|
111
113
|
Pencil,
|
|
112
114
|
PencilLine,
|
|
113
115
|
Play,
|
|
@@ -123,7 +125,7 @@ import {
|
|
|
123
125
|
Wrench,
|
|
124
126
|
X,
|
|
125
127
|
Zap
|
|
126
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-IOKIQSWP.js";
|
|
127
129
|
|
|
128
130
|
// src/hooks/use-agent-session.ts
|
|
129
131
|
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -362,7 +364,8 @@ function useReplay(session) {
|
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
// src/components/ReplayBar.tsx
|
|
365
|
-
import {
|
|
367
|
+
import { useState as useState3 } from "react";
|
|
368
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
366
369
|
var SPEED_OPTIONS = [1, 2, 5];
|
|
367
370
|
function ReplayBar({
|
|
368
371
|
isReplay,
|
|
@@ -372,55 +375,75 @@ function ReplayBar({
|
|
|
372
375
|
canControl = true,
|
|
373
376
|
className
|
|
374
377
|
}) {
|
|
378
|
+
const [expanded, setExpanded] = useState3(true);
|
|
375
379
|
if (!isReplay) return null;
|
|
376
380
|
return /* @__PURE__ */ jsxs(
|
|
377
381
|
"div",
|
|
378
382
|
{
|
|
379
383
|
part: "replay-bar",
|
|
380
384
|
className: cn(
|
|
381
|
-
"blade-chat-replay-bar flex flex-wrap items-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/40 px-3
|
|
385
|
+
"blade-chat-replay-bar flex flex-wrap items-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/40 px-3 text-[11px]",
|
|
386
|
+
expanded ? "py-2" : "py-0.5",
|
|
382
387
|
className
|
|
383
388
|
),
|
|
384
389
|
children: [
|
|
385
|
-
/* @__PURE__ */ jsxs(
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
"
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
390
|
+
expanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
391
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex shrink-0 items-center gap-1.5 font-medium text-[hsl(var(--foreground))]", children: [
|
|
392
|
+
/* @__PURE__ */ jsx(Play, { size: 12 }),
|
|
393
|
+
"\u56DE\u653E\u6A21\u5F0F"
|
|
394
|
+
] }),
|
|
395
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u91CD\u73B0\u4E4B\u524D\u7684\u5BF9\u8BDD" }),
|
|
396
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
397
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-0.5", children: SPEED_OPTIONS.map((option) => /* @__PURE__ */ jsxs(
|
|
398
|
+
"button",
|
|
399
|
+
{
|
|
400
|
+
type: "button",
|
|
401
|
+
onClick: () => onSpeedChange(option),
|
|
402
|
+
"aria-pressed": speed === option,
|
|
403
|
+
disabled: !canControl,
|
|
404
|
+
className: cn(
|
|
405
|
+
"h-5 rounded px-1.5 font-medium transition-colors",
|
|
406
|
+
speed === option ? "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]" : "text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
407
|
+
!canControl && "cursor-not-allowed opacity-50"
|
|
408
|
+
),
|
|
409
|
+
children: [
|
|
410
|
+
option,
|
|
411
|
+
"x"
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
option
|
|
415
|
+
)) }),
|
|
416
|
+
/* @__PURE__ */ jsx(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
type: "button",
|
|
420
|
+
onClick: onExit,
|
|
421
|
+
disabled: !canControl,
|
|
422
|
+
className: cn(
|
|
423
|
+
"h-6 rounded-md border border-[hsl(var(--border))] px-2 text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
424
|
+
!canControl && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
425
|
+
),
|
|
426
|
+
children: "\u9000\u51FA\u56DE\u653E"
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
] })
|
|
430
|
+
] }) : null,
|
|
431
|
+
/* @__PURE__ */ jsxs(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
type: "button",
|
|
435
|
+
"aria-expanded": expanded,
|
|
436
|
+
onClick: () => setExpanded((current) => !current),
|
|
437
|
+
className: cn(
|
|
438
|
+
"inline-flex h-6 shrink-0 items-center gap-1 rounded-md px-2 font-medium text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
439
|
+
!expanded && "ml-auto"
|
|
440
|
+
),
|
|
441
|
+
children: [
|
|
442
|
+
expanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 12, "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronDown, { size: 12, "aria-hidden": "true" }),
|
|
443
|
+
expanded ? "\u6536\u8D77\u56DE\u653E\u63A7\u5236" : "\u5C55\u5F00\u56DE\u653E\u63A7\u5236"
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
)
|
|
424
447
|
]
|
|
425
448
|
}
|
|
426
449
|
);
|
|
@@ -476,10 +499,10 @@ function ReplayMismatchPrompt({ mismatch, className }) {
|
|
|
476
499
|
|
|
477
500
|
// src/components/AgentChat.tsx
|
|
478
501
|
import { BladeApiError } from "@blade-hq/agent-client/internal";
|
|
479
|
-
import { useEffect as useEffect30, useMemo as useMemo17, useRef as useRef25, useState as
|
|
502
|
+
import { useEffect as useEffect30, useMemo as useMemo17, useRef as useRef25, useState as useState34 } from "react";
|
|
480
503
|
|
|
481
504
|
// src/chat/ChatPanel.tsx
|
|
482
|
-
import { useCallback as useCallback17, useEffect as useEffect28, useMemo as useMemo16, useRef as useRef24, useState as
|
|
505
|
+
import { useCallback as useCallback17, useEffect as useEffect28, useMemo as useMemo16, useRef as useRef24, useState as useState32 } from "react";
|
|
483
506
|
import {
|
|
484
507
|
chatErrorForDisplay as chatErrorForDisplay3,
|
|
485
508
|
latestPostChatFollowup
|
|
@@ -493,14 +516,14 @@ import {
|
|
|
493
516
|
queuePauseReasonLabel,
|
|
494
517
|
queuedMessageStatusLabel
|
|
495
518
|
} from "@blade-hq/agent-client/internal";
|
|
496
|
-
import { useContext, useLayoutEffect, useRef as useRef2, useState as
|
|
519
|
+
import { useContext, useLayoutEffect, useRef as useRef2, useState as useState4 } from "react";
|
|
497
520
|
|
|
498
521
|
// src/components/queue-panel-adjacency.ts
|
|
499
522
|
import { createContext } from "react";
|
|
500
523
|
var QueuePanelAdjacencyContext = createContext(null);
|
|
501
524
|
|
|
502
525
|
// src/components/SessionQueuePanel.tsx
|
|
503
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
526
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
504
527
|
var QUEUE_INSET_CLASS = "mx-3";
|
|
505
528
|
function isQueuePanelVisible(snapshot, notice, editing = false) {
|
|
506
529
|
return snapshot.items.length > 0 || snapshot.paused || Boolean(notice) || editing;
|
|
@@ -525,14 +548,14 @@ function SessionQueuePanel({
|
|
|
525
548
|
onVisibleChange,
|
|
526
549
|
mergesWithInputBelow: mergesWithInputBelowProp
|
|
527
550
|
}) {
|
|
528
|
-
const [collapsed, setCollapsed] =
|
|
529
|
-
const [editing, setEditing] =
|
|
530
|
-
const [draggingId, setDraggingId] =
|
|
531
|
-
const [dropAt, setDropAt] =
|
|
551
|
+
const [collapsed, setCollapsed] = useState4(false);
|
|
552
|
+
const [editing, setEditing] = useState4(null);
|
|
553
|
+
const [draggingId, setDraggingId] = useState4(null);
|
|
554
|
+
const [dropAt, setDropAt] = useState4(null);
|
|
532
555
|
const draggingRef = useRef2(null);
|
|
533
556
|
const dropRef = useRef2(null);
|
|
534
557
|
const requeuePending = useRef2(false);
|
|
535
|
-
const [requeueing, setRequeueing] =
|
|
558
|
+
const [requeueing, setRequeueing] = useState4(false);
|
|
536
559
|
const adjacency = useContext(QueuePanelAdjacencyContext);
|
|
537
560
|
const mergesWithInputBelow = mergesWithInputBelowProp ?? adjacency ?? true;
|
|
538
561
|
const items = snapshot.items;
|
|
@@ -590,7 +613,7 @@ function SessionQueuePanel({
|
|
|
590
613
|
"\u5F85\u6267\u884C \xB7 ",
|
|
591
614
|
items.length
|
|
592
615
|
] }),
|
|
593
|
-
snapshot.paused && /* @__PURE__ */ jsxs3(
|
|
616
|
+
snapshot.paused && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
594
617
|
/* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--destructive))]", children: [
|
|
595
618
|
/* @__PURE__ */ jsx3(CirclePause, { size: 12 }),
|
|
596
619
|
pauseLabel
|
|
@@ -752,7 +775,7 @@ function SessionQueuePanel({
|
|
|
752
775
|
}
|
|
753
776
|
)
|
|
754
777
|
] })
|
|
755
|
-
] }) : /* @__PURE__ */ jsxs3(
|
|
778
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
756
779
|
dropAt?.id === item.id ? /* @__PURE__ */ jsx3(
|
|
757
780
|
"span",
|
|
758
781
|
{
|
|
@@ -849,12 +872,12 @@ function SessionQueuePanel({
|
|
|
849
872
|
}
|
|
850
873
|
|
|
851
874
|
// src/chat/ConnectionBanner.tsx
|
|
852
|
-
import { useEffect as useEffect3, useRef as useRef3, useState as
|
|
875
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
853
876
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
854
877
|
var CONNECTION_NOTICE_DELAY_MS = 3e3;
|
|
855
878
|
var CONNECTION_ERROR_DELAY_MS = 15e3;
|
|
856
879
|
function useConnectionNoticePhase(connected) {
|
|
857
|
-
const [phase, setPhase] =
|
|
880
|
+
const [phase, setPhase] = useState5("hidden");
|
|
858
881
|
const connectedRef = useRef3(connected);
|
|
859
882
|
const timersRef = useRef3([]);
|
|
860
883
|
connectedRef.current = connected;
|
|
@@ -959,7 +982,7 @@ function useChatCustomization() {
|
|
|
959
982
|
}
|
|
960
983
|
|
|
961
984
|
// src/chat/CurrentPlanPanel.tsx
|
|
962
|
-
import { Fragment as
|
|
985
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
963
986
|
function PlanUpdatingNotice() {
|
|
964
987
|
return /* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
965
988
|
/* @__PURE__ */ jsx5(LoaderCircle, { size: 14, className: "shrink-0 animate-spin" }),
|
|
@@ -976,7 +999,7 @@ function CurrentPlanPanelContent({
|
|
|
976
999
|
const { current, updating } = getPlanUpdateDisplayState(messages);
|
|
977
1000
|
if (hideTodo) return null;
|
|
978
1001
|
if (!current && !updating) return null;
|
|
979
|
-
return /* @__PURE__ */ jsxs5(
|
|
1002
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
980
1003
|
updating ? /* @__PURE__ */ jsx5(PlanUpdatingNotice, {}) : null,
|
|
981
1004
|
current ? /* @__PURE__ */ jsx5(
|
|
982
1005
|
PlanUpdateBlock,
|
|
@@ -1013,7 +1036,7 @@ function CurrentPlanPanel({
|
|
|
1013
1036
|
);
|
|
1014
1037
|
const customPlan = parsedPlan ? renderPlan?.({ plan: parsedPlan, running: isStreaming, sessionId }) : null;
|
|
1015
1038
|
if (hideTodo || !hasPlanUpdate) return null;
|
|
1016
|
-
if (customPlan != null) return /* @__PURE__ */ jsx5(
|
|
1039
|
+
if (customPlan != null) return /* @__PURE__ */ jsx5(Fragment3, { children: customPlan });
|
|
1017
1040
|
return /* @__PURE__ */ jsx5("div", { part: "plan", className: cn("blade-chat-plan", className), children: /* @__PURE__ */ jsx5(
|
|
1018
1041
|
CurrentPlanPanelContent,
|
|
1019
1042
|
{
|
|
@@ -1027,7 +1050,7 @@ function CurrentPlanPanel({
|
|
|
1027
1050
|
}
|
|
1028
1051
|
|
|
1029
1052
|
// src/chat/chat-column-width.tsx
|
|
1030
|
-
import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef5, useState as
|
|
1053
|
+
import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef5, useState as useState6, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1031
1054
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1032
1055
|
var CHAT_COLUMN_WIDTH_STORAGE_KEY = "blade-ui:chat-column-width";
|
|
1033
1056
|
var DEFAULT_CHAT_COLUMN_WIDTH = 780;
|
|
@@ -1104,7 +1127,7 @@ function ChatColumnResizeRails({
|
|
|
1104
1127
|
onWidthChange,
|
|
1105
1128
|
onReset
|
|
1106
1129
|
}) {
|
|
1107
|
-
const [draggingSide, setDraggingSide] =
|
|
1130
|
+
const [draggingSide, setDraggingSide] = useState6(null);
|
|
1108
1131
|
const leftIndicatorRef = useRef5(null);
|
|
1109
1132
|
const rightIndicatorRef = useRef5(null);
|
|
1110
1133
|
const dragStateRef = useRef5(null);
|
|
@@ -1242,7 +1265,7 @@ function ChatColumnResizeRails({
|
|
|
1242
1265
|
] });
|
|
1243
1266
|
}
|
|
1244
1267
|
function useObservedContainerWidth(ref, enabled = true) {
|
|
1245
|
-
const [containerWidth, setContainerWidth] =
|
|
1268
|
+
const [containerWidth, setContainerWidth] = useState6(null);
|
|
1246
1269
|
useEffect5(() => {
|
|
1247
1270
|
if (!enabled) {
|
|
1248
1271
|
setContainerWidth(null);
|
|
@@ -1279,12 +1302,13 @@ function useFollowupInteraction() {
|
|
|
1279
1302
|
}
|
|
1280
1303
|
|
|
1281
1304
|
// src/chat/LightComposer.tsx
|
|
1282
|
-
import {
|
|
1305
|
+
import { buildMessageContent } from "@blade-hq/agent-client/internal";
|
|
1306
|
+
import { useEffect as useEffect6, useRef as useRef7, useState as useState8 } from "react";
|
|
1283
1307
|
import { normalizePluginRefs } from "@blade-hq/agent-client";
|
|
1284
1308
|
|
|
1285
1309
|
// src/components/ChatInput.tsx
|
|
1286
|
-
import { useRef as useRef6, useState as
|
|
1287
|
-
import { Fragment as
|
|
1310
|
+
import { useRef as useRef6, useState as useState7 } from "react";
|
|
1311
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1288
1312
|
function isImeCompositionKey(event) {
|
|
1289
1313
|
return event.isComposing || event.keyCode === 229;
|
|
1290
1314
|
}
|
|
@@ -1307,15 +1331,17 @@ function ChatInput({
|
|
|
1307
1331
|
toolbarClassName,
|
|
1308
1332
|
queueKey,
|
|
1309
1333
|
hasAttachments = false,
|
|
1334
|
+
attachmentsBlocked = false,
|
|
1335
|
+
attachmentPicker,
|
|
1310
1336
|
onKeyDown
|
|
1311
1337
|
}) {
|
|
1312
1338
|
const trimmed = value.trim();
|
|
1313
1339
|
const latestValue = useRef6(value);
|
|
1314
1340
|
latestValue.current = value;
|
|
1315
1341
|
const sending = useRef6(false);
|
|
1316
|
-
const [isSending2, setIsSending] =
|
|
1342
|
+
const [isSending2, setIsSending] = useState7(false);
|
|
1317
1343
|
void queueKey;
|
|
1318
|
-
const canSend = !isSending2 && (trimmed.length > 0 || hasAttachments) && (!isStreaming || queueWhileRunning && !hasAttachments && !isStopping);
|
|
1344
|
+
const canSend = !isSending2 && !attachmentsBlocked && (trimmed.length > 0 || hasAttachments) && (!isStreaming || queueWhileRunning && !hasAttachments && !isStopping);
|
|
1319
1345
|
const handleSend = async (queueWhenRunning = false) => {
|
|
1320
1346
|
if (!canSend || sending.current) return;
|
|
1321
1347
|
sending.current = true;
|
|
@@ -1387,7 +1413,8 @@ function ChatInput({
|
|
|
1387
1413
|
)
|
|
1388
1414
|
}
|
|
1389
1415
|
),
|
|
1390
|
-
|
|
1416
|
+
attachmentPicker,
|
|
1417
|
+
/* @__PURE__ */ jsx7("div", { part: "input-toolbar", className: cn("blade-chat-input-toolbar flex shrink-0 items-center gap-2", toolbarClassName), children: isStreaming ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1391
1418
|
queueWhileRunning ? /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void handleSend(), disabled: !canSend, "aria-label": "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F", title: "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] disabled:opacity-40", children: /* @__PURE__ */ jsx7(ArrowUp, { size: 15 }) }) : null,
|
|
1392
1419
|
/* @__PURE__ */ jsx7("button", { type: "button", onClick: onStop, disabled: isStopping, "aria-label": isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", title: isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--muted))] text-[hsl(var(--foreground))] transition-opacity hover:opacity-90 disabled:opacity-60", children: isStopping ? /* @__PURE__ */ jsx7(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx7(Square, { size: 12, fill: "currentColor" }) })
|
|
1393
1420
|
] }) : /* @__PURE__ */ jsx7(
|
|
@@ -1415,7 +1442,7 @@ function ChatInput({
|
|
|
1415
1442
|
}
|
|
1416
1443
|
|
|
1417
1444
|
// src/chat/LightComposer.tsx
|
|
1418
|
-
import { Fragment as
|
|
1445
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1419
1446
|
function LightComposer({
|
|
1420
1447
|
sessionId,
|
|
1421
1448
|
onSend,
|
|
@@ -1434,17 +1461,22 @@ function LightComposer({
|
|
|
1434
1461
|
}) {
|
|
1435
1462
|
const session = useSessionHandle(sessionId);
|
|
1436
1463
|
const client = useBladeClient();
|
|
1437
|
-
const [refs, setRefs] =
|
|
1438
|
-
const [items, setItems] =
|
|
1439
|
-
const [selectedIndex, setSelectedIndex] =
|
|
1464
|
+
const [refs, setRefs] = useState8([]);
|
|
1465
|
+
const [items, setItems] = useState8([]);
|
|
1466
|
+
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
1467
|
+
const [files, setFiles] = useState8([]);
|
|
1468
|
+
const fileInput = useRef7(null);
|
|
1469
|
+
const nextFileId = useRef7(0);
|
|
1470
|
+
const currentFiles = files.filter((file) => file.sessionId === sessionId);
|
|
1471
|
+
const attachmentsBlocked = currentFiles.some((file) => !file.path);
|
|
1440
1472
|
const restored = useRef7(null);
|
|
1441
|
-
const [value, setValue] =
|
|
1442
|
-
const [draftKey, setDraftKey] =
|
|
1473
|
+
const [value, setValue] = useState8(initialDraft ?? "");
|
|
1474
|
+
const [draftKey, setDraftKey] = useState8(initialDraftKey);
|
|
1443
1475
|
if (draftKey !== initialDraftKey) {
|
|
1444
1476
|
setDraftKey(initialDraftKey);
|
|
1445
1477
|
if (initialDraft) setValue(initialDraft);
|
|
1446
1478
|
}
|
|
1447
|
-
const [dismissed, setDismissed] =
|
|
1479
|
+
const [dismissed, setDismissed] = useState8(null);
|
|
1448
1480
|
const match = value.match(/(?:^|\s)@([^@\s]*)$/);
|
|
1449
1481
|
const query = match && value !== dismissed ? match[1] : null;
|
|
1450
1482
|
const candidates = items.filter((item) => item.kind === "plugin");
|
|
@@ -1499,7 +1531,39 @@ ${content}`);
|
|
|
1499
1531
|
offInsert();
|
|
1500
1532
|
};
|
|
1501
1533
|
}, [session]);
|
|
1502
|
-
|
|
1534
|
+
async function addFiles(selection) {
|
|
1535
|
+
if (!sessionId || selection.length === 0) return;
|
|
1536
|
+
const entries = selection.map((file) => ({ id: nextFileId.current++, sessionId, name: file.name }));
|
|
1537
|
+
setFiles((previous) => [...previous, ...entries]);
|
|
1538
|
+
const indices = new Map(entries.map((file, index) => [file.id, index]));
|
|
1539
|
+
try {
|
|
1540
|
+
const result = await client.sessions.uploadFiles(sessionId, ".", selection);
|
|
1541
|
+
const outcomes = new Map(result.results?.map((item) => [item.index, item]));
|
|
1542
|
+
setFiles((previous) => previous.map((file) => {
|
|
1543
|
+
const index = indices.get(file.id);
|
|
1544
|
+
if (index === void 0) return file;
|
|
1545
|
+
const outcome = outcomes.get(index);
|
|
1546
|
+
return outcome?.path ? { ...file, path: outcome.path } : { ...file, error: outcome?.error || "\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u9009\u62E9" };
|
|
1547
|
+
}));
|
|
1548
|
+
} catch {
|
|
1549
|
+
setFiles((previous) => previous.map((file) => indices.has(file.id) ? { ...file, error: "\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u9009\u62E9" } : file));
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
async function send(text, queueWhenRunning) {
|
|
1553
|
+
if (attachmentsBlocked) return false;
|
|
1554
|
+
const content = text || refs.map((ref) => `@${ref.label}`).join(" ");
|
|
1555
|
+
const message = currentFiles.length ? buildMessageContent(
|
|
1556
|
+
content,
|
|
1557
|
+
currentFiles.map((file) => ({ kind: "file", name: file.name, uploadedPath: file.path }))
|
|
1558
|
+
) : content;
|
|
1559
|
+
const accepted = await onSend(message, { queueWhenRunning, refs: pluginRefsForSend(refs, session?.getState().turns) });
|
|
1560
|
+
if (accepted && currentFiles.length) {
|
|
1561
|
+
const sent = new Set(currentFiles.map((file) => file.id));
|
|
1562
|
+
setFiles((previous) => previous.filter((file) => !sent.has(file.id)));
|
|
1563
|
+
}
|
|
1564
|
+
return accepted;
|
|
1565
|
+
}
|
|
1566
|
+
return /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1503
1567
|
planPanel ? /* @__PURE__ */ jsx8("div", { className: maxWidthClassName ? `mx-auto w-full ${maxWidthClassName}` : void 0, children: planPanel }) : null,
|
|
1504
1568
|
refs.length ? /* @__PURE__ */ jsx8("div", { "aria-label": "\u9009\u62E9\u7684\u63D2\u4EF6\u6761\u76EE", className: "flex flex-wrap gap-2 px-3 pt-2", children: refs.map((ref) => /* @__PURE__ */ jsxs8("span", { className: "rounded bg-[hsl(var(--muted))] px-2 py-1 text-xs", children: [
|
|
1505
1569
|
ref.label,
|
|
@@ -1510,13 +1574,54 @@ ${content}`);
|
|
|
1510
1574
|
item.label,
|
|
1511
1575
|
/* @__PURE__ */ jsx8("span", { className: "ml-auto text-xs text-[hsl(var(--muted-foreground))]", children: item.display_name })
|
|
1512
1576
|
] }, JSON.stringify([item.plugin, item.server, item.id])) : /* @__PURE__ */ jsx8("div", { className: "text-xs", children: item.message }, index)) }) : null,
|
|
1577
|
+
currentFiles.length > 0 && /* @__PURE__ */ jsx8("ul", { "aria-label": "\u5F85\u53D1\u9001\u9644\u4EF6", className: "flex flex-wrap gap-2 px-4 pb-2", children: currentFiles.map((file) => /* @__PURE__ */ jsxs8("li", { className: "flex min-w-0 items-center gap-2 rounded-md bg-[hsl(var(--muted))] px-2 py-1 text-xs", children: [
|
|
1578
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate", title: file.name, children: file.name }),
|
|
1579
|
+
file.error ? /* @__PURE__ */ jsx8("span", { role: "alert", children: file.error }) : !file.path ? /* @__PURE__ */ jsx8("output", { children: "\u4E0A\u4F20\u4E2D\u2026" }) : null,
|
|
1580
|
+
/* @__PURE__ */ jsx8(
|
|
1581
|
+
"button",
|
|
1582
|
+
{
|
|
1583
|
+
type: "button",
|
|
1584
|
+
"aria-label": `\u79FB\u9664\u9644\u4EF6 ${file.name}`,
|
|
1585
|
+
onClick: () => setFiles((previous) => previous.filter((item) => item.id !== file.id)),
|
|
1586
|
+
children: /* @__PURE__ */ jsx8(X, { size: 14, "aria-hidden": "true" })
|
|
1587
|
+
}
|
|
1588
|
+
)
|
|
1589
|
+
] }, file.id)) }),
|
|
1513
1590
|
/* @__PURE__ */ jsx8(
|
|
1514
1591
|
ChatInput,
|
|
1515
1592
|
{
|
|
1516
1593
|
value,
|
|
1517
1594
|
onValueChange: setValue,
|
|
1518
|
-
onSend:
|
|
1519
|
-
hasAttachments: refs.length > 0,
|
|
1595
|
+
onSend: send,
|
|
1596
|
+
hasAttachments: refs.length > 0 || currentFiles.length > 0,
|
|
1597
|
+
attachmentsBlocked,
|
|
1598
|
+
attachmentPicker: sessionId && /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1599
|
+
/* @__PURE__ */ jsx8(
|
|
1600
|
+
"input",
|
|
1601
|
+
{
|
|
1602
|
+
ref: fileInput,
|
|
1603
|
+
type: "file",
|
|
1604
|
+
multiple: true,
|
|
1605
|
+
hidden: true,
|
|
1606
|
+
onChange: (event) => {
|
|
1607
|
+
const selection = Array.from(event.currentTarget.files ?? []);
|
|
1608
|
+
event.currentTarget.value = "";
|
|
1609
|
+
void addFiles(selection);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
/* @__PURE__ */ jsx8(
|
|
1614
|
+
"button",
|
|
1615
|
+
{
|
|
1616
|
+
type: "button",
|
|
1617
|
+
"aria-label": "\u6DFB\u52A0\u9644\u4EF6",
|
|
1618
|
+
title: "\u6DFB\u52A0\u9644\u4EF6",
|
|
1619
|
+
onClick: () => fileInput.current?.click(),
|
|
1620
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md hover:bg-[hsl(var(--muted))]",
|
|
1621
|
+
children: /* @__PURE__ */ jsx8(Paperclip, { size: 16, "aria-hidden": "true" })
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
] }),
|
|
1520
1625
|
onKeyDown: (event) => {
|
|
1521
1626
|
if (query === null || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;
|
|
1522
1627
|
if (event.key === "Escape") {
|
|
@@ -1548,7 +1653,7 @@ ${content}`);
|
|
|
1548
1653
|
}
|
|
1549
1654
|
|
|
1550
1655
|
// src/chat/ChatLoadingIndicator.tsx
|
|
1551
|
-
import { useEffect as useEffect7, useState as
|
|
1656
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
1552
1657
|
|
|
1553
1658
|
// src/chat/ai-elements/shimmer.tsx
|
|
1554
1659
|
import { memo, useMemo as useMemo3 } from "react";
|
|
@@ -1624,9 +1729,9 @@ function ChatLoadingIndicator({
|
|
|
1624
1729
|
startedAtMs,
|
|
1625
1730
|
activeToolLabel
|
|
1626
1731
|
}) {
|
|
1627
|
-
const [mountTime] =
|
|
1732
|
+
const [mountTime] = useState9(() => Date.now());
|
|
1628
1733
|
const originMs = typeof startedAtMs === "number" && Number.isFinite(startedAtMs) && startedAtMs > 0 ? startedAtMs : mountTime;
|
|
1629
|
-
const [nowMs, setNowMs] =
|
|
1734
|
+
const [nowMs, setNowMs] = useState9(() => Date.now());
|
|
1630
1735
|
useEffect7(() => {
|
|
1631
1736
|
const elapsed = Math.max(0, nowMs - originMs);
|
|
1632
1737
|
if (elapsed >= MAX_LIVE_CLOCK_MS) return;
|
|
@@ -1668,7 +1773,7 @@ function ChatLoadingIndicator({
|
|
|
1668
1773
|
}
|
|
1669
1774
|
|
|
1670
1775
|
// src/chat/LiteMessageList.tsx
|
|
1671
|
-
import { useCallback as useCallback8, useEffect as useEffect18, useMemo as useMemo11, useRef as useRef14, useState as
|
|
1776
|
+
import { useCallback as useCallback8, useEffect as useEffect18, useMemo as useMemo11, useRef as useRef14, useState as useState22 } from "react";
|
|
1672
1777
|
import {
|
|
1673
1778
|
extractTextAttachments as extractTextAttachments2,
|
|
1674
1779
|
getTextContent as getTextContent3,
|
|
@@ -1763,9 +1868,13 @@ function PackEventNotice({ title }) {
|
|
|
1763
1868
|
// src/chat/LiteMessageList.tsx
|
|
1764
1869
|
import { packEventTitle } from "@blade-hq/agent-client/internal";
|
|
1765
1870
|
|
|
1871
|
+
// src/components/ExecutionProcessContext.ts
|
|
1872
|
+
import { createContext as createContext4 } from "react";
|
|
1873
|
+
var KeepToolStepsOpenContext = createContext4(false);
|
|
1874
|
+
|
|
1766
1875
|
// src/chat/AssistantTurnBlock.tsx
|
|
1767
1876
|
import { getServerTime } from "@blade-hq/agent-client/internal";
|
|
1768
|
-
import { memo as memo3, useCallback as useCallback5, useEffect as useEffect15, useMemo as useMemo10, useRef as useRef11, useState as
|
|
1877
|
+
import { memo as memo3, useCallback as useCallback5, useContext as useContext6, useEffect as useEffect15, useMemo as useMemo10, useRef as useRef11, useState as useState20 } from "react";
|
|
1769
1878
|
import { getFileParts as getFileParts2, getImageParts as getImageParts2, getTextContent as getTextContent2, normalizeMessageContent } from "@blade-hq/agent-client/internal";
|
|
1770
1879
|
|
|
1771
1880
|
// src/chat/lib/ui-meta.ts
|
|
@@ -1823,17 +1932,17 @@ import {
|
|
|
1823
1932
|
|
|
1824
1933
|
// src/chat/ai-elements/reasoning.tsx
|
|
1825
1934
|
import {
|
|
1826
|
-
createContext as
|
|
1935
|
+
createContext as createContext5,
|
|
1827
1936
|
memo as memo2,
|
|
1828
1937
|
useCallback as useCallback4,
|
|
1829
1938
|
useContext as useContext4,
|
|
1830
1939
|
useEffect as useEffect8,
|
|
1831
1940
|
useMemo as useMemo4,
|
|
1832
1941
|
useRef as useRef8,
|
|
1833
|
-
useState as
|
|
1942
|
+
useState as useState10
|
|
1834
1943
|
} from "react";
|
|
1835
|
-
import { Fragment as
|
|
1836
|
-
var ReasoningContext =
|
|
1944
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1945
|
+
var ReasoningContext = createContext5(null);
|
|
1837
1946
|
var useReasoning = () => {
|
|
1838
1947
|
const context = useContext4(ReasoningContext);
|
|
1839
1948
|
if (!context) {
|
|
@@ -1917,7 +2026,7 @@ var ReasoningTrigger = memo2(
|
|
|
1917
2026
|
className
|
|
1918
2027
|
),
|
|
1919
2028
|
...props,
|
|
1920
|
-
children: children ?? /* @__PURE__ */ jsxs12(
|
|
2029
|
+
children: children ?? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1921
2030
|
/* @__PURE__ */ jsx13(Brain, { className: "size-4" }),
|
|
1922
2031
|
/* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
1923
2032
|
isStreaming || duration === 0 ? /* @__PURE__ */ jsx13(Shimmer, { duration: 1, children: status }) : /* @__PURE__ */ jsx13("span", { children: status }),
|
|
@@ -1964,7 +2073,7 @@ function compactReasoningText(text) {
|
|
|
1964
2073
|
}
|
|
1965
2074
|
function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
1966
2075
|
const compactReasoning = compactReasoningText(reasoning);
|
|
1967
|
-
const [open, setOpen] =
|
|
2076
|
+
const [open, setOpen] = useState10(false);
|
|
1968
2077
|
return /* @__PURE__ */ jsxs12(
|
|
1969
2078
|
"span",
|
|
1970
2079
|
{
|
|
@@ -2017,13 +2126,13 @@ ReasoningTrigger.displayName = "ReasoningTrigger";
|
|
|
2017
2126
|
ReasoningContent.displayName = "ReasoningContent";
|
|
2018
2127
|
|
|
2019
2128
|
// src/chat/card/CardContext.tsx
|
|
2020
|
-
import { createContext as
|
|
2021
|
-
var CardContext =
|
|
2129
|
+
import { createContext as createContext6, useContext as useContext5 } from "react";
|
|
2130
|
+
var CardContext = createContext6({});
|
|
2022
2131
|
var useCardContext = () => useContext5(CardContext);
|
|
2023
2132
|
|
|
2024
2133
|
// src/chat/FileDeliveryCards.tsx
|
|
2025
|
-
import { useMemo as useMemo5, useState as
|
|
2026
|
-
import { Fragment as
|
|
2134
|
+
import { useMemo as useMemo5, useState as useState11 } from "react";
|
|
2135
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2027
2136
|
var AGENT_WORKSPACE_DIR_NAME = "\u667A\u80FD\u52A9\u624B\u5DE5\u4F5C\u7A7A\u95F4";
|
|
2028
2137
|
var EXT_LABELS = {
|
|
2029
2138
|
py: "PY",
|
|
@@ -2105,8 +2214,8 @@ function DeliveryCard({
|
|
|
2105
2214
|
}) {
|
|
2106
2215
|
const client = useOptionalBladeClient();
|
|
2107
2216
|
const host = useBladeHost();
|
|
2108
|
-
const [opening, setOpening] =
|
|
2109
|
-
const [downloading, setDownloading] =
|
|
2217
|
+
const [opening, setOpening] = useState11(false);
|
|
2218
|
+
const [downloading, setDownloading] = useState11(false);
|
|
2110
2219
|
const handleOpen = async () => {
|
|
2111
2220
|
if (opening) return;
|
|
2112
2221
|
if (!host.openWorkspaceFile) {
|
|
@@ -2154,7 +2263,7 @@ ${path}` : path,
|
|
|
2154
2263
|
/* @__PURE__ */ jsx14("span", { className: compact ? "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]" : "flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] bg-[hsl(var(--primary)/0.12)] font-mono text-[11px] font-bold text-[hsl(var(--primary))]", children: opening ? /* @__PURE__ */ jsx14(LoaderCircle, { size: compact ? 14 : 18, className: "animate-spin", "aria-hidden": "true" }) : isVideoFile(name) ? /* @__PURE__ */ jsx14(Film, { size: compact ? 14 : 18, "aria-hidden": "true" }) : compact ? /* @__PURE__ */ jsx14(FileGlyph, {}) : getExtLabel(name) }),
|
|
2155
2264
|
/* @__PURE__ */ jsxs13("span", { className: compact ? "min-w-0" : "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
2156
2265
|
/* @__PURE__ */ jsx14("span", { className: compact ? "block truncate text-xs font-medium leading-5" : "truncate text-[13px] font-semibold text-[hsl(var(--foreground))]", children: displayName || name }),
|
|
2157
|
-
!compact ? /* @__PURE__ */ jsx14("span", { className: "flex items-center gap-1.5 truncate text-xs text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx14("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs13(
|
|
2266
|
+
!compact ? /* @__PURE__ */ jsx14("span", { className: "flex items-center gap-1.5 truncate text-xs text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx14("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
2158
2267
|
/* @__PURE__ */ jsx14("span", { className: "truncate", children: path }),
|
|
2159
2268
|
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
2160
2269
|
/* @__PURE__ */ jsx14("span", { className: "shrink-0 text-[hsl(var(--primary))]", children: badgeText })
|
|
@@ -2245,10 +2354,10 @@ function FileDeliveryCards({
|
|
|
2245
2354
|
}
|
|
2246
2355
|
|
|
2247
2356
|
// src/chat/MessageActions.tsx
|
|
2248
|
-
import { useState as
|
|
2357
|
+
import { useState as useState12 } from "react";
|
|
2249
2358
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2250
2359
|
function MessageActions({ content, className }) {
|
|
2251
|
-
const [copied, setCopied] =
|
|
2360
|
+
const [copied, setCopied] = useState12(false);
|
|
2252
2361
|
const handleCopy = async () => {
|
|
2253
2362
|
const ok = await copyToClipboard(content);
|
|
2254
2363
|
if (ok) {
|
|
@@ -2274,7 +2383,7 @@ function MessageActions({ content, className }) {
|
|
|
2274
2383
|
}
|
|
2275
2384
|
|
|
2276
2385
|
// src/chat/MessageFileAttachmentList.tsx
|
|
2277
|
-
import { Fragment as
|
|
2386
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2278
2387
|
function getFileIcon(fileName) {
|
|
2279
2388
|
const lowerName = fileName.toLowerCase();
|
|
2280
2389
|
if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
|
|
@@ -2306,7 +2415,7 @@ function MessageFileAttachmentList({
|
|
|
2306
2415
|
return /* @__PURE__ */ jsx16("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file) => {
|
|
2307
2416
|
const Icon = getFileIcon(file.name);
|
|
2308
2417
|
const key = `${file.name}-${file.data.slice(0, 32)}`;
|
|
2309
|
-
const content = /* @__PURE__ */ jsxs15(
|
|
2418
|
+
const content = /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
2310
2419
|
/* @__PURE__ */ jsx16(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
2311
2420
|
/* @__PURE__ */ jsx16("span", { className: "max-w-32 truncate", children: file.name })
|
|
2312
2421
|
] });
|
|
@@ -2337,7 +2446,7 @@ function ToolUiCard({ card, sessionId }) {
|
|
|
2337
2446
|
}
|
|
2338
2447
|
|
|
2339
2448
|
// src/chat/ToolCallBlock.tsx
|
|
2340
|
-
import { useEffect as useEffect10, useMemo as useMemo7, useState as
|
|
2449
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useState as useState14 } from "react";
|
|
2341
2450
|
import {
|
|
2342
2451
|
isInternalStatusToolUiCard,
|
|
2343
2452
|
isWorkflowRunToolName
|
|
@@ -2345,7 +2454,7 @@ import {
|
|
|
2345
2454
|
|
|
2346
2455
|
// src/chat/AskUserQuestionBlock.tsx
|
|
2347
2456
|
import { formatAskUserAnswer } from "@blade-hq/agent-client";
|
|
2348
|
-
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef9, useState as
|
|
2457
|
+
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef9, useState as useState13 } from "react";
|
|
2349
2458
|
import { parseAskUserQuestion } from "@blade-hq/agent-client";
|
|
2350
2459
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2351
2460
|
var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
|
|
@@ -2382,11 +2491,11 @@ function AskUserQuestionBlock({
|
|
|
2382
2491
|
answerData,
|
|
2383
2492
|
onAnswer
|
|
2384
2493
|
}) {
|
|
2385
|
-
const [selections, setSelections] =
|
|
2386
|
-
const [customTexts, setCustomTexts] =
|
|
2387
|
-
const [usingCustom, setUsingCustom] =
|
|
2388
|
-
const [note, setNote] =
|
|
2389
|
-
const [submitted, setSubmitted] =
|
|
2494
|
+
const [selections, setSelections] = useState13(/* @__PURE__ */ new Map());
|
|
2495
|
+
const [customTexts, setCustomTexts] = useState13(/* @__PURE__ */ new Map());
|
|
2496
|
+
const [usingCustom, setUsingCustom] = useState13(/* @__PURE__ */ new Set());
|
|
2497
|
+
const [note, setNote] = useState13("");
|
|
2498
|
+
const [submitted, setSubmitted] = useState13(false);
|
|
2390
2499
|
useEffect9(() => {
|
|
2391
2500
|
if (sessionStatus === "failed" || sessionStatus === "interrupted") {
|
|
2392
2501
|
setSubmitted(false);
|
|
@@ -2747,7 +2856,7 @@ function parseAskUserQuestionError(toolResult) {
|
|
|
2747
2856
|
}
|
|
2748
2857
|
|
|
2749
2858
|
// src/chat/ToolCallBlock.tsx
|
|
2750
|
-
import { Fragment as
|
|
2859
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2751
2860
|
function getFilePreviewName(filePath) {
|
|
2752
2861
|
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
2753
2862
|
}
|
|
@@ -2854,7 +2963,7 @@ function ToolCallBlock({
|
|
|
2854
2963
|
}) {
|
|
2855
2964
|
const normalizedName = formatToolName(toolCall.name);
|
|
2856
2965
|
const shouldAutoExpandWhileStreaming = toolCall.status === "pending" && isLivePreviewTool(normalizedName);
|
|
2857
|
-
const [expanded, setExpanded] =
|
|
2966
|
+
const [expanded, setExpanded] = useState14(shouldAutoExpandWhileStreaming);
|
|
2858
2967
|
const currentSessionId = useCurrentChatSessionId();
|
|
2859
2968
|
const resolvedSessionId = providedSessionId ?? currentSessionId ?? void 0;
|
|
2860
2969
|
const storedAnswerData = useSessionState(resolvedSessionId, (s) => s.askAnswers[toolCall.id]);
|
|
@@ -2900,8 +3009,8 @@ function ToolCallBlock({
|
|
|
2900
3009
|
onAnswer: canAnswer ? resolvedOnAnswer : void 0
|
|
2901
3010
|
}) : null;
|
|
2902
3011
|
const customToolCall2 = customQuestion == null && !customization?.renderers?.askUserQuestion ? customization?.renderers?.toolCall?.(toolCall) : null;
|
|
2903
|
-
if (customQuestion != null) return /* @__PURE__ */ jsx19(
|
|
2904
|
-
if (customToolCall2 != null) return /* @__PURE__ */ jsx19(
|
|
3012
|
+
if (customQuestion != null) return /* @__PURE__ */ jsx19(Fragment9, { children: customQuestion });
|
|
3013
|
+
if (customToolCall2 != null) return /* @__PURE__ */ jsx19(Fragment9, { children: customToolCall2 });
|
|
2905
3014
|
if (toolCall.status === "error") return null;
|
|
2906
3015
|
if (askData) {
|
|
2907
3016
|
const questionBlock = /* @__PURE__ */ jsx19(
|
|
@@ -2939,7 +3048,7 @@ function ToolCallBlock({
|
|
|
2939
3048
|
] });
|
|
2940
3049
|
}
|
|
2941
3050
|
const customToolCall = customization?.renderers?.toolCall?.(toolCall);
|
|
2942
|
-
if (customToolCall != null) return /* @__PURE__ */ jsx19(
|
|
3051
|
+
if (customToolCall != null) return /* @__PURE__ */ jsx19(Fragment9, { children: customToolCall });
|
|
2943
3052
|
const tone = getToolTone(toolCall.status);
|
|
2944
3053
|
const displayName = getToolDisplayLabel(toolCall);
|
|
2945
3054
|
const Renderer = customization?.renderers?.tool?.[normalizedName] ?? getRenderer(normalizedName);
|
|
@@ -2998,12 +3107,12 @@ function ToolCallBlock({
|
|
|
2998
3107
|
}
|
|
2999
3108
|
)
|
|
3000
3109
|
] }),
|
|
3001
|
-
expanded && /* @__PURE__ */ jsx19("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx19(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs17(
|
|
3110
|
+
expanded && /* @__PURE__ */ jsx19("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx19(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
3002
3111
|
/* @__PURE__ */ jsx19("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
|
|
3003
3112
|
/* @__PURE__ */ jsx19("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
|
|
3004
3113
|
/* @__PURE__ */ jsx19("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
|
|
3005
3114
|
/* @__PURE__ */ jsx19("pre", { className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-[hsl(var(--muted))] p-2 font-mono text-[11px] text-[hsl(var(--foreground))]", children: formatArgs(toolCall.arguments) }),
|
|
3006
|
-
toolCall.result != null && /* @__PURE__ */ jsxs17(
|
|
3115
|
+
toolCall.result != null && /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
3007
3116
|
/* @__PURE__ */ jsx19("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
|
|
3008
3117
|
/* @__PURE__ */ jsx19(
|
|
3009
3118
|
"pre",
|
|
@@ -3049,19 +3158,19 @@ function buildAskUserPayload(argumentsJson) {
|
|
|
3049
3158
|
}
|
|
3050
3159
|
|
|
3051
3160
|
// src/chat/WorkflowRunBlock.tsx
|
|
3052
|
-
import { useMemo as useMemo9, useState as
|
|
3161
|
+
import { useMemo as useMemo9, useState as useState19 } from "react";
|
|
3053
3162
|
|
|
3054
3163
|
// src/chat/AgentLoopBlock.tsx
|
|
3055
|
-
import { useEffect as useEffect14, useMemo as useMemo8, useState as
|
|
3164
|
+
import { useEffect as useEffect14, useMemo as useMemo8, useState as useState18 } from "react";
|
|
3056
3165
|
import { collectInlineToolUiCards } from "@blade-hq/agent-client/internal";
|
|
3057
3166
|
|
|
3058
3167
|
// src/chat/ContextAttachmentPills.tsx
|
|
3059
|
-
import { useEffect as useEffect12, useRef as useRef10, useState as
|
|
3168
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
|
|
3060
3169
|
|
|
3061
3170
|
// src/chat/lib/use-async-value.ts
|
|
3062
|
-
import { useEffect as useEffect11, useState as
|
|
3171
|
+
import { useEffect as useEffect11, useState as useState15 } from "react";
|
|
3063
3172
|
function useAsyncValue(key, load2) {
|
|
3064
|
-
const [result, setResult] =
|
|
3173
|
+
const [result, setResult] = useState15(null);
|
|
3065
3174
|
useEffect11(() => {
|
|
3066
3175
|
if (key === null) return;
|
|
3067
3176
|
const controller = new AbortController();
|
|
@@ -3202,15 +3311,15 @@ function dispatchPreview(filename, url) {
|
|
|
3202
3311
|
}
|
|
3203
3312
|
|
|
3204
3313
|
// src/chat/ContextAttachmentPills.tsx
|
|
3205
|
-
import { Fragment as
|
|
3314
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3206
3315
|
function ContextAttachmentPills({ attachments }) {
|
|
3207
3316
|
const client = useOptionalBladeClient();
|
|
3208
3317
|
const download = useRef10(null);
|
|
3209
3318
|
useEffect12(() => () => download.current?.abort(), []);
|
|
3210
|
-
const [selectedId, setSelectedId] =
|
|
3211
|
-
const [preview, setPreview] =
|
|
3212
|
-
const [loading, setLoading] =
|
|
3213
|
-
const [unavailable, setUnavailable] =
|
|
3319
|
+
const [selectedId, setSelectedId] = useState16(null);
|
|
3320
|
+
const [preview, setPreview] = useState16(null);
|
|
3321
|
+
const [loading, setLoading] = useState16(null);
|
|
3322
|
+
const [unavailable, setUnavailable] = useState16(null);
|
|
3214
3323
|
useEffect12(() => () => {
|
|
3215
3324
|
if (preview) URL.revokeObjectURL(preview.url);
|
|
3216
3325
|
}, [preview]);
|
|
@@ -3240,7 +3349,7 @@ function ContextAttachmentPills({ attachments }) {
|
|
|
3240
3349
|
if (!controller.signal.aborted) setLoading(null);
|
|
3241
3350
|
}
|
|
3242
3351
|
};
|
|
3243
|
-
return /* @__PURE__ */ jsxs19(
|
|
3352
|
+
return /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
3244
3353
|
/* @__PURE__ */ jsx21("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u9644\u52A0\u8D44\u6599", children: visibleAttachments.map((item) => /* @__PURE__ */ jsx21("button", { type: "button", onClick: () => {
|
|
3245
3354
|
setSelectedId(selectedId === item.id ? null : item.id);
|
|
3246
3355
|
setUnavailable(null);
|
|
@@ -3265,7 +3374,7 @@ function ContextAttachmentPills({ attachments }) {
|
|
|
3265
3374
|
|
|
3266
3375
|
// src/chat/UserMessageBubble.tsx
|
|
3267
3376
|
import { chatErrorForDisplay } from "@blade-hq/agent-client";
|
|
3268
|
-
import { useEffect as useEffect13, useState as
|
|
3377
|
+
import { useEffect as useEffect13, useState as useState17 } from "react";
|
|
3269
3378
|
import { extractTextAttachments, getFileParts, getImageParts, getTextContent } from "@blade-hq/agent-client/internal";
|
|
3270
3379
|
|
|
3271
3380
|
// src/lib/whatif-prompt.ts
|
|
@@ -3339,7 +3448,7 @@ function MessageContextPills({ contexts }) {
|
|
|
3339
3448
|
}
|
|
3340
3449
|
|
|
3341
3450
|
// src/chat/TextAttachmentPills.tsx
|
|
3342
|
-
import { Fragment as
|
|
3451
|
+
import { Fragment as Fragment11, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3343
3452
|
function getFileIcon2(fileName) {
|
|
3344
3453
|
const lower2 = fileName.toLowerCase();
|
|
3345
3454
|
if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive;
|
|
@@ -3357,7 +3466,7 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
3357
3466
|
return /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index) => {
|
|
3358
3467
|
const Icon = getFileIcon2(att.name);
|
|
3359
3468
|
const key = `${att.uploadedPath ?? att.name}:${att.name}:${index}`;
|
|
3360
|
-
const content = /* @__PURE__ */ jsxs21(
|
|
3469
|
+
const content = /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
3361
3470
|
/* @__PURE__ */ jsx23(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
|
|
3362
3471
|
/* @__PURE__ */ jsx23("span", { className: "max-w-40 truncate", children: att.name })
|
|
3363
3472
|
] });
|
|
@@ -3496,8 +3605,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
3496
3605
|
alt: imageTextAttachmentMeta[i]?.name || "\u7528\u6237\u4E0A\u4F20\u7684\u56FE\u7247"
|
|
3497
3606
|
}))
|
|
3498
3607
|
];
|
|
3499
|
-
const [lightboxIndex, setLightboxIndex] =
|
|
3500
|
-
const [preview, setPreview] =
|
|
3608
|
+
const [lightboxIndex, setLightboxIndex] = useState17(null);
|
|
3609
|
+
const [preview, setPreview] = useState17(null);
|
|
3501
3610
|
const handleTextAttachmentPreview = (attachment) => {
|
|
3502
3611
|
if (!activeSessionId || !client) return;
|
|
3503
3612
|
const pathForUrl = attachment.uploadedPath ?? attachment.name;
|
|
@@ -3644,7 +3753,7 @@ function findLatestReasoningMessageIndex(messages) {
|
|
|
3644
3753
|
}
|
|
3645
3754
|
|
|
3646
3755
|
// src/chat/AgentLoopBlock.tsx
|
|
3647
|
-
import { Fragment as
|
|
3756
|
+
import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3648
3757
|
var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
|
|
3649
3758
|
function safeParseDescription(argsStr) {
|
|
3650
3759
|
try {
|
|
@@ -3704,7 +3813,7 @@ function AgentLoopBlock({
|
|
|
3704
3813
|
() => visibleLoopToolCalls.some((childToolCall) => childToolCall.status === "awaiting_answer" && !askAnswers?.[childToolCall.id]),
|
|
3705
3814
|
[visibleLoopToolCalls, askAnswers]
|
|
3706
3815
|
);
|
|
3707
|
-
const [expanded, setExpanded] =
|
|
3816
|
+
const [expanded, setExpanded] = useState18(defaultExpanded || hasAwaitingAnswer);
|
|
3708
3817
|
const completedToolLabels = useMemo8(
|
|
3709
3818
|
() => visibleLoopToolCalls.flatMap((childToolCall) => {
|
|
3710
3819
|
const isCompleted = childToolCall.status === "done" || childToolCall.status !== "pending" && childToolCall.status !== "awaiting_answer" && childToolCall.status !== "error" && childToolCall.status !== "cancelled";
|
|
@@ -3756,7 +3865,7 @@ function AgentLoopBlock({
|
|
|
3756
3865
|
cardStyles.borderClass
|
|
3757
3866
|
),
|
|
3758
3867
|
children: [
|
|
3759
|
-
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs24(
|
|
3868
|
+
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
3760
3869
|
/* @__PURE__ */ jsxs24(
|
|
3761
3870
|
"div",
|
|
3762
3871
|
{
|
|
@@ -3824,7 +3933,7 @@ function AgentLoopBlock({
|
|
|
3824
3933
|
/* @__PURE__ */ jsx26(LoaderCircle, { size: 12, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }),
|
|
3825
3934
|
/* @__PURE__ */ jsx26("span", { children: "\u6B63\u5728\u542F\u52A8..." })
|
|
3826
3935
|
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */ jsx26("div", { className: "flex flex-col gap-1 py-2", children: /* @__PURE__ */ jsx26("div", { className: "px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BF7\u5728\u4E0B\u65B9\u5B50\u667A\u80FD\u4F53\u5BF9\u8BDD\u4E2D\u5B8C\u6210\u786E\u8BA4" }) }) : null
|
|
3827
|
-
] }) : /* @__PURE__ */ jsxs24(
|
|
3936
|
+
] }) : /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
3828
3937
|
/* @__PURE__ */ jsxs24(
|
|
3829
3938
|
"div",
|
|
3830
3939
|
{
|
|
@@ -3877,7 +3986,7 @@ function AgentLoopBlock({
|
|
|
3877
3986
|
]
|
|
3878
3987
|
}
|
|
3879
3988
|
),
|
|
3880
|
-
!expanded ? /* @__PURE__ */ jsxs24(
|
|
3989
|
+
!expanded ? /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
3881
3990
|
/* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
|
|
3882
3991
|
(item) => item.kind === "file" ? /* @__PURE__ */ jsxs24(
|
|
3883
3992
|
"span",
|
|
@@ -4049,7 +4158,7 @@ function getLoopCardStyles(status) {
|
|
|
4049
4158
|
}
|
|
4050
4159
|
|
|
4051
4160
|
// src/chat/WorkflowRunBlock.tsx
|
|
4052
|
-
import { Fragment as
|
|
4161
|
+
import { Fragment as Fragment13, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4053
4162
|
var EMPTY_ENTRIES = [];
|
|
4054
4163
|
var NO_SKILLS = [];
|
|
4055
4164
|
function workflowTitle(name, argumentsJson, skills) {
|
|
@@ -4167,13 +4276,13 @@ function RefTokenText({ text, refs }) {
|
|
|
4167
4276
|
cursor = match.index + match[0].length;
|
|
4168
4277
|
}
|
|
4169
4278
|
if (cursor < text.length) parts.push(text.slice(cursor));
|
|
4170
|
-
return /* @__PURE__ */ jsx27(
|
|
4279
|
+
return /* @__PURE__ */ jsx27(Fragment13, { children: parts });
|
|
4171
4280
|
}
|
|
4172
4281
|
function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
4173
4282
|
const run = useSessionState(sessionId, (state2) => state2.workflowRuns[toolCall.id]);
|
|
4174
4283
|
const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
|
|
4175
4284
|
const sessionMessages = useSessionState(sessionId, (state2) => state2.messages);
|
|
4176
|
-
const [collapsed, setCollapsed] =
|
|
4285
|
+
const [collapsed, setCollapsed] = useState19(false);
|
|
4177
4286
|
const stepLoops = useMemo9(
|
|
4178
4287
|
() => Object.entries(agentLoops).filter(([, info]) => info.workflowRunId === toolCall.id).map(([loopName, info]) => ({ loopName, info })),
|
|
4179
4288
|
[agentLoops, toolCall.id]
|
|
@@ -4591,18 +4700,20 @@ function AssistantTurnBlockBase({
|
|
|
4591
4700
|
),
|
|
4592
4701
|
[assistantTurnMessages]
|
|
4593
4702
|
);
|
|
4594
|
-
const [displayMode, setDisplayMode] =
|
|
4703
|
+
const [displayMode, setDisplayMode] = useState20(
|
|
4595
4704
|
() => forceExpanded ? "detail" : (displayModeMemoryKey ? turnDisplayModeMemory.get(displayModeMemoryKey) : void 0) ?? defaultTurnDisplayMode({ forceExpanded, hasActionableToolCall, isStreaming })
|
|
4596
4705
|
);
|
|
4706
|
+
const [userSelectedMode, setUserSelectedMode] = useState20(false);
|
|
4707
|
+
const keepToolStepsOpen = useContext6(KeepToolStepsOpenContext);
|
|
4597
4708
|
const wasStreamingRef = useRef11(isStreaming);
|
|
4598
4709
|
useEffect15(() => {
|
|
4599
|
-
if (wasStreamingRef.current && !isStreaming && !forceExpanded && !(displayModeMemoryKey && turnDisplayModeMemory.has(displayModeMemoryKey))) {
|
|
4710
|
+
if (wasStreamingRef.current && !isStreaming && !forceExpanded && !userSelectedMode && !(displayModeMemoryKey && turnDisplayModeMemory.has(displayModeMemoryKey))) {
|
|
4600
4711
|
setDisplayMode(
|
|
4601
4712
|
defaultTurnDisplayMode({ forceExpanded, hasActionableToolCall, isStreaming })
|
|
4602
4713
|
);
|
|
4603
4714
|
}
|
|
4604
4715
|
wasStreamingRef.current = isStreaming;
|
|
4605
|
-
}, [displayModeMemoryKey, forceExpanded, hasActionableToolCall, isStreaming]);
|
|
4716
|
+
}, [displayModeMemoryKey, forceExpanded, hasActionableToolCall, isStreaming, userSelectedMode]);
|
|
4606
4717
|
const persistentAskUserQuestions = useMemo10(
|
|
4607
4718
|
() => getPersistentAskUserQuestions(assistantTurnMessages),
|
|
4608
4719
|
[assistantTurnMessages]
|
|
@@ -4650,7 +4761,11 @@ function AssistantTurnBlockBase({
|
|
|
4650
4761
|
) : [],
|
|
4651
4762
|
[finalMessage]
|
|
4652
4763
|
);
|
|
4653
|
-
const
|
|
4764
|
+
const useExpandedToolDefault = keepToolStepsOpen && !userSelectedMode && !(displayModeMemoryKey && turnDisplayModeMemory.has(displayModeMemoryKey)) && (detailToolCalls.length > 0 || workflowRunToolCalls.length > 0);
|
|
4765
|
+
const effectiveMode = resolveTurnDisplayMode({
|
|
4766
|
+
isStreaming,
|
|
4767
|
+
displayMode: useExpandedToolDefault ? "detail" : displayMode
|
|
4768
|
+
});
|
|
4654
4769
|
const compactOrderedToolIds = useMemo10(
|
|
4655
4770
|
() => new Set(
|
|
4656
4771
|
effectiveMode === "compact" && finalOrderedParts.length > 0 ? finalOrderedParts.flatMap((part) => part.type === "tools" ? part.toolCalls.map((tool) => tool.id) : []) : []
|
|
@@ -4671,7 +4786,7 @@ function AssistantTurnBlockBase({
|
|
|
4671
4786
|
messages,
|
|
4672
4787
|
isStreaming
|
|
4673
4788
|
});
|
|
4674
|
-
const [clock, setClock] =
|
|
4789
|
+
const [clock, setClock] = useState20(() => performance.now());
|
|
4675
4790
|
useEffect15(() => {
|
|
4676
4791
|
if (!isStreaming) return;
|
|
4677
4792
|
const timer = window.setInterval(() => setClock(performance.now()), 1e3);
|
|
@@ -4683,7 +4798,7 @@ function AssistantTurnBlockBase({
|
|
|
4683
4798
|
now: sessionId ? getServerTime(client, clock) : Date.now()
|
|
4684
4799
|
}) : executionDurationMs;
|
|
4685
4800
|
const observedMemoryRefs = useMemo10(() => collectMemoryRefs(messages), [messages]);
|
|
4686
|
-
const [cachedMemoryRefs, setCachedMemoryRefs] =
|
|
4801
|
+
const [cachedMemoryRefs, setCachedMemoryRefs] = useState20([]);
|
|
4687
4802
|
useEffect15(() => {
|
|
4688
4803
|
if (observedMemoryRefs.length > 0) setCachedMemoryRefs(observedMemoryRefs);
|
|
4689
4804
|
}, [observedMemoryRefs]);
|
|
@@ -4717,7 +4832,8 @@ function AssistantTurnBlockBase({
|
|
|
4717
4832
|
{
|
|
4718
4833
|
type: "button",
|
|
4719
4834
|
onClick: () => {
|
|
4720
|
-
|
|
4835
|
+
setUserSelectedMode(true);
|
|
4836
|
+
const nextMode = effectiveMode === "detail" ? "compact" : "detail";
|
|
4721
4837
|
setDisplayMode(nextMode);
|
|
4722
4838
|
if (displayModeMemoryKey) turnDisplayModeMemory.set(displayModeMemoryKey, nextMode);
|
|
4723
4839
|
},
|
|
@@ -5260,7 +5376,7 @@ function collectMemoryRefs(messages) {
|
|
|
5260
5376
|
}
|
|
5261
5377
|
function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
5262
5378
|
const refs = Array.isArray(rawRefs) ? rawRefs : [];
|
|
5263
|
-
const [expanded, setExpanded] =
|
|
5379
|
+
const [expanded, setExpanded] = useState20(false);
|
|
5264
5380
|
const memoriesHref = useChatEnvironment().memoriesHref;
|
|
5265
5381
|
const hasSkill = refs.some((r) => r.skill_name);
|
|
5266
5382
|
const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
@@ -5866,7 +5982,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
5866
5982
|
}
|
|
5867
5983
|
|
|
5868
5984
|
// src/chat/ResultFeedback.tsx
|
|
5869
|
-
import { useCallback as useCallback7, useEffect as useEffect17, useRef as useRef13, useState as
|
|
5985
|
+
import { useCallback as useCallback7, useEffect as useEffect17, useRef as useRef13, useState as useState21 } from "react";
|
|
5870
5986
|
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5871
5987
|
var REASONS = [
|
|
5872
5988
|
{ value: "not_solved", label: "\u6CA1\u89E3\u51B3\u95EE\u9898" },
|
|
@@ -5907,15 +6023,15 @@ function ResultFeedback({
|
|
|
5907
6023
|
onSaved
|
|
5908
6024
|
}) {
|
|
5909
6025
|
const client = useBladeClient();
|
|
5910
|
-
const [saved, setSaved] =
|
|
5911
|
-
const [selectedHelpful, setSelectedHelpful] =
|
|
6026
|
+
const [saved, setSaved] = useState21(savedFeedback ?? null);
|
|
6027
|
+
const [selectedHelpful, setSelectedHelpful] = useState21(
|
|
5912
6028
|
savedFeedback?.helpful ?? null
|
|
5913
6029
|
);
|
|
5914
|
-
const [selectedReason, setSelectedReason] =
|
|
6030
|
+
const [selectedReason, setSelectedReason] = useState21(
|
|
5915
6031
|
savedFeedback?.reason ?? null
|
|
5916
6032
|
);
|
|
5917
|
-
const [saving, setSaving] =
|
|
5918
|
-
const [saveError, setSaveError] =
|
|
6033
|
+
const [saving, setSaving] = useState21(false);
|
|
6034
|
+
const [saveError, setSaveError] = useState21(false);
|
|
5919
6035
|
const latestChoice = useRef13(null);
|
|
5920
6036
|
const eligible = followup.feedback_eligible === true;
|
|
5921
6037
|
const emit = useFollowupInteraction();
|
|
@@ -6442,7 +6558,7 @@ function LiteFollowup({
|
|
|
6442
6558
|
}) {
|
|
6443
6559
|
const client = useBladeClient();
|
|
6444
6560
|
const composer = useComposerBridge(sessionId);
|
|
6445
|
-
const [downloadingPath, setDownloadingPath] =
|
|
6561
|
+
const [downloadingPath, setDownloadingPath] = useState22(null);
|
|
6446
6562
|
const artifacts = followup.final_artifacts ?? [];
|
|
6447
6563
|
const downloadArtifact = async (target, label) => {
|
|
6448
6564
|
if (downloadingPath) return;
|
|
@@ -6531,11 +6647,11 @@ import {
|
|
|
6531
6647
|
useLayoutEffect as useLayoutEffect5,
|
|
6532
6648
|
useMemo as useMemo15,
|
|
6533
6649
|
useRef as useRef22,
|
|
6534
|
-
useState as
|
|
6650
|
+
useState as useState30
|
|
6535
6651
|
} from "react";
|
|
6536
6652
|
|
|
6537
6653
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
|
|
6538
|
-
import { useCallback as useCallback9, useMemo as useMemo12, useRef as useRef15, useState as
|
|
6654
|
+
import { useCallback as useCallback9, useMemo as useMemo12, useRef as useRef15, useState as useState23 } from "react";
|
|
6539
6655
|
var DEFAULT_SPRING_ANIMATION = {
|
|
6540
6656
|
/**
|
|
6541
6657
|
* A value from 0 to 1, on how much to damp the animation.
|
|
@@ -6572,9 +6688,9 @@ globalThis.document?.addEventListener("click", () => {
|
|
|
6572
6688
|
mouseDown = false;
|
|
6573
6689
|
});
|
|
6574
6690
|
var useStickToBottom = (options = {}) => {
|
|
6575
|
-
const [escapedFromLock, updateEscapedFromLock] =
|
|
6576
|
-
const [isAtBottom, updateIsAtBottom] =
|
|
6577
|
-
const [isNearBottom, setIsNearBottom] =
|
|
6691
|
+
const [escapedFromLock, updateEscapedFromLock] = useState23(false);
|
|
6692
|
+
const [isAtBottom, updateIsAtBottom] = useState23(options.initial !== false);
|
|
6693
|
+
const [isNearBottom, setIsNearBottom] = useState23(false);
|
|
6578
6694
|
const optionsRef = useRef15(null);
|
|
6579
6695
|
optionsRef.current = options;
|
|
6580
6696
|
const isSelecting = useCallback9(() => {
|
|
@@ -6879,8 +6995,8 @@ function mergeAnimations(...animations) {
|
|
|
6879
6995
|
|
|
6880
6996
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/StickToBottom.js
|
|
6881
6997
|
import * as React from "react";
|
|
6882
|
-
import { createContext as
|
|
6883
|
-
var StickToBottomContext =
|
|
6998
|
+
import { createContext as createContext7, useContext as useContext7, useEffect as useEffect19, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo as useMemo13, useRef as useRef16 } from "react";
|
|
6999
|
+
var StickToBottomContext = createContext7(null);
|
|
6884
7000
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect2 : useEffect19;
|
|
6885
7001
|
function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }) {
|
|
6886
7002
|
const customTargetScrollTop = useRef16(null);
|
|
@@ -6951,7 +7067,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
|
|
|
6951
7067
|
StickToBottom2.Content = Content;
|
|
6952
7068
|
})(StickToBottom || (StickToBottom = {}));
|
|
6953
7069
|
function useStickToBottomContext() {
|
|
6954
|
-
const context =
|
|
7070
|
+
const context = useContext7(StickToBottomContext);
|
|
6955
7071
|
if (!context) {
|
|
6956
7072
|
throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");
|
|
6957
7073
|
}
|
|
@@ -6967,7 +7083,7 @@ import {
|
|
|
6967
7083
|
isHiddenInternalMessage as isHiddenInternalMessage2,
|
|
6968
7084
|
normalizeMessageContent as normalizeMessageContent3
|
|
6969
7085
|
} from "@blade-hq/agent-client/internal";
|
|
6970
|
-
import { useCallback as useCallback11, useEffect as useEffect20, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as
|
|
7086
|
+
import { useCallback as useCallback11, useEffect as useEffect20, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as useState24 } from "react";
|
|
6971
7087
|
var HIGHLIGHT_MS = 1600;
|
|
6972
7088
|
var TURN_NAV_HIGHLIGHT_CLASS = "blade-turn-nav-flash";
|
|
6973
7089
|
var MAX_FRAMES_AFTER_LOCATE = 20;
|
|
@@ -7031,12 +7147,12 @@ function useTurnNavigation({
|
|
|
7031
7147
|
revealEntry,
|
|
7032
7148
|
beforeSeek
|
|
7033
7149
|
});
|
|
7034
|
-
const [index, setIndex] =
|
|
7035
|
-
const [loadingEntryId, setLoadingEntryId] =
|
|
7036
|
-
const [activeEntryId, setActiveEntryId] =
|
|
7037
|
-
const [failedEntryId, setFailedEntryId] =
|
|
7038
|
-
const [error, setError] =
|
|
7039
|
-
const [indexRefresh, setIndexRefresh] =
|
|
7150
|
+
const [index, setIndex] = useState24({ sessionId: null, items: [] });
|
|
7151
|
+
const [loadingEntryId, setLoadingEntryId] = useState24(null);
|
|
7152
|
+
const [activeEntryId, setActiveEntryId] = useState24(null);
|
|
7153
|
+
const [failedEntryId, setFailedEntryId] = useState24(null);
|
|
7154
|
+
const [error, setError] = useState24(null);
|
|
7155
|
+
const [indexRefresh, setIndexRefresh] = useState24(0);
|
|
7040
7156
|
const seekSeq = useRef17(0);
|
|
7041
7157
|
const indexSeq = useRef17(0);
|
|
7042
7158
|
const indexRef = useRef17({
|
|
@@ -7213,7 +7329,7 @@ function useTurnNavigation({
|
|
|
7213
7329
|
}
|
|
7214
7330
|
|
|
7215
7331
|
// src/hooks/use-typewriter-reveal.ts
|
|
7216
|
-
import { useCallback as useCallback12, useEffect as useEffect21, useRef as useRef18, useState as
|
|
7332
|
+
import { useCallback as useCallback12, useEffect as useEffect21, useRef as useRef18, useState as useState25 } from "react";
|
|
7217
7333
|
var REVEAL_INITIAL_CPS = 18;
|
|
7218
7334
|
var REVEAL_MIN_CPS = 6;
|
|
7219
7335
|
var REVEAL_MAX_CPS = 240;
|
|
@@ -7249,7 +7365,7 @@ function initialRevealState(targetText, isLive, resetKey) {
|
|
|
7249
7365
|
};
|
|
7250
7366
|
}
|
|
7251
7367
|
function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
7252
|
-
const [state2, setState2] =
|
|
7368
|
+
const [state2, setState2] = useState25(() => initialRevealState(targetText, isLive, resetKey));
|
|
7253
7369
|
const targetTextRef = useRef18(targetText);
|
|
7254
7370
|
targetTextRef.current = targetText;
|
|
7255
7371
|
const revealedLenRef = useRef18(state2.revealedLen);
|
|
@@ -7352,7 +7468,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
7352
7468
|
}
|
|
7353
7469
|
|
|
7354
7470
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
7355
|
-
import { useMemo as useMemo14, useState as
|
|
7471
|
+
import { useMemo as useMemo14, useState as useState26 } from "react";
|
|
7356
7472
|
|
|
7357
7473
|
// ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
7358
7474
|
function isNothing(subject) {
|
|
@@ -10315,7 +10431,7 @@ function extractRefs(content) {
|
|
|
10315
10431
|
}
|
|
10316
10432
|
|
|
10317
10433
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
10318
|
-
import { Fragment as
|
|
10434
|
+
import { Fragment as Fragment14, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
10319
10435
|
function PlanSummaryCard({
|
|
10320
10436
|
messages,
|
|
10321
10437
|
sessionStatus,
|
|
@@ -10346,7 +10462,7 @@ function PlanSummaryCard({
|
|
|
10346
10462
|
/* @__PURE__ */ jsx32("span", { children: "\u89C4\u5212\u6458\u8981" })
|
|
10347
10463
|
] }),
|
|
10348
10464
|
/* @__PURE__ */ jsx32("div", { className: "truncate text-base font-medium text-[hsl(var(--foreground))]", children: data.intent || "\u5F53\u524D\u89C4\u5212" }),
|
|
10349
|
-
/* @__PURE__ */ jsx32("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs30(
|
|
10465
|
+
/* @__PURE__ */ jsx32("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs30(Fragment14, { children: [
|
|
10350
10466
|
/* @__PURE__ */ jsx32("span", { className: "rounded-full bg-[hsl(var(--accent))] px-2.5 py-1 text-[hsl(var(--foreground))]", children: summaryState.label }),
|
|
10351
10467
|
/* @__PURE__ */ jsx32("span", { className: "font-mono tracking-[0.25em] text-[hsl(var(--muted-foreground))]", children: summaryState.dots })
|
|
10352
10468
|
] }) : /* @__PURE__ */ jsx32(
|
|
@@ -10394,8 +10510,8 @@ function PlanSummaryCard({
|
|
|
10394
10510
|
function PlanConfirmationPanel({
|
|
10395
10511
|
onConfirmPlan
|
|
10396
10512
|
}) {
|
|
10397
|
-
const [isEditing, setIsEditing] =
|
|
10398
|
-
const [revisionText, setRevisionText] =
|
|
10513
|
+
const [isEditing, setIsEditing] = useState26(false);
|
|
10514
|
+
const [revisionText, setRevisionText] = useState26("");
|
|
10399
10515
|
const submitRevision = () => {
|
|
10400
10516
|
const trimmed = revisionText.trim();
|
|
10401
10517
|
if (!trimmed) return;
|
|
@@ -10560,8 +10676,8 @@ function extractPlanMessagesForTurn(messages, turnLastMessage) {
|
|
|
10560
10676
|
import { useEffect as useEffect23, useRef as useRef20 } from "react";
|
|
10561
10677
|
|
|
10562
10678
|
// src/chat/FinalArtifactCards.tsx
|
|
10563
|
-
import { useEffect as useEffect22, useRef as useRef19, useState as
|
|
10564
|
-
import { Fragment as
|
|
10679
|
+
import { useEffect as useEffect22, useRef as useRef19, useState as useState27 } from "react";
|
|
10680
|
+
import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
10565
10681
|
function basename2(path) {
|
|
10566
10682
|
return path.split("/").filter(Boolean).pop() || path;
|
|
10567
10683
|
}
|
|
@@ -10582,7 +10698,7 @@ function LinkCard({
|
|
|
10582
10698
|
const bladeHost = useBladeHost();
|
|
10583
10699
|
const host = hostOf(url);
|
|
10584
10700
|
const local = isLoopbackUrl(url) && Boolean(bladeHost.openPreview);
|
|
10585
|
-
const content = /* @__PURE__ */ jsxs31(
|
|
10701
|
+
const content = /* @__PURE__ */ jsxs31(Fragment15, { children: [
|
|
10586
10702
|
/* @__PURE__ */ jsx33("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx33(Globe, { size: 15, "aria-hidden": "true" }) }),
|
|
10587
10703
|
/* @__PURE__ */ jsx33("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx33("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
|
|
10588
10704
|
/* @__PURE__ */ jsx33(
|
|
@@ -10631,7 +10747,7 @@ function FinalArtifactCards({
|
|
|
10631
10747
|
sessionId,
|
|
10632
10748
|
assistantEntryId
|
|
10633
10749
|
}) {
|
|
10634
|
-
const [expanded, setExpanded] =
|
|
10750
|
+
const [expanded, setExpanded] = useState27(false);
|
|
10635
10751
|
const hasMore = artifacts.length > 3;
|
|
10636
10752
|
const visibleArtifacts = expanded ? artifacts : artifacts.slice(0, 3);
|
|
10637
10753
|
const emit = useFollowupInteraction();
|
|
@@ -10858,7 +10974,7 @@ var RenderErrorBoundary = class extends Component {
|
|
|
10858
10974
|
};
|
|
10859
10975
|
|
|
10860
10976
|
// src/chat/TurnNavRail.tsx
|
|
10861
|
-
import { useCallback as useCallback13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect4, useRef as useRef21, useState as
|
|
10977
|
+
import { useCallback as useCallback13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect4, useRef as useRef21, useState as useState28 } from "react";
|
|
10862
10978
|
import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10863
10979
|
var PANEL_MAX_HEIGHT = 448;
|
|
10864
10980
|
var PANEL_MARGIN = 16;
|
|
@@ -10880,8 +10996,8 @@ function TurnNavRail({
|
|
|
10880
10996
|
error = null,
|
|
10881
10997
|
failedTurnId = null
|
|
10882
10998
|
}) {
|
|
10883
|
-
const [hoveredTurnId, setHoveredTurnId] =
|
|
10884
|
-
const [panelOpen, setPanelOpen] =
|
|
10999
|
+
const [hoveredTurnId, setHoveredTurnId] = useState28(null);
|
|
11000
|
+
const [panelOpen, setPanelOpen] = useState28(false);
|
|
10885
11001
|
const listRef = useRef21(null);
|
|
10886
11002
|
const markerRef = useRef21(null);
|
|
10887
11003
|
const edgeRatioRef = useRef21(0.5);
|
|
@@ -11104,7 +11220,7 @@ function TurnNavRail({
|
|
|
11104
11220
|
}
|
|
11105
11221
|
|
|
11106
11222
|
// src/chat/turn-locate-channel.ts
|
|
11107
|
-
import { useEffect as useEffect25, useState as
|
|
11223
|
+
import { useEffect as useEffect25, useState as useState29 } from "react";
|
|
11108
11224
|
var state = {};
|
|
11109
11225
|
var statusState = {};
|
|
11110
11226
|
var seqCounter = 0;
|
|
@@ -11187,7 +11303,7 @@ var turnLocateChannel = {
|
|
|
11187
11303
|
}
|
|
11188
11304
|
};
|
|
11189
11305
|
function useTurnLocateRequest(sessionId) {
|
|
11190
|
-
const [request, setRequest] =
|
|
11306
|
+
const [request, setRequest] = useState29(null);
|
|
11191
11307
|
useEffect25(() => {
|
|
11192
11308
|
if (!sessionId) {
|
|
11193
11309
|
setRequest(null);
|
|
@@ -11201,7 +11317,7 @@ function useTurnLocateRequest(sessionId) {
|
|
|
11201
11317
|
return request;
|
|
11202
11318
|
}
|
|
11203
11319
|
function useTurnLocateStatus(sessionId) {
|
|
11204
|
-
const [status, setStatus2] =
|
|
11320
|
+
const [status, setStatus2] = useState29(null);
|
|
11205
11321
|
useEffect25(() => {
|
|
11206
11322
|
if (!sessionId) {
|
|
11207
11323
|
setStatus2(null);
|
|
@@ -11278,7 +11394,7 @@ function calculateAnimatedScrollTop({
|
|
|
11278
11394
|
}
|
|
11279
11395
|
|
|
11280
11396
|
// src/chat/MessageList.tsx
|
|
11281
|
-
import { Fragment as
|
|
11397
|
+
import { Fragment as Fragment16, jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
11282
11398
|
function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
|
|
11283
11399
|
if (isStopping) return false;
|
|
11284
11400
|
const hasContent = message?.content != null && message.content.length > 0;
|
|
@@ -11520,9 +11636,9 @@ function MessageListBody({
|
|
|
11520
11636
|
const observedLatestUserStableIdRef = useRef22(
|
|
11521
11637
|
latestUserIsOptimistic ? null : latestUserStableId
|
|
11522
11638
|
);
|
|
11523
|
-
const [activeTurnId, setActiveTurnId] =
|
|
11524
|
-
const [virtualScrollMargin, setVirtualScrollMargin] =
|
|
11525
|
-
const [scrollContainerElement, setScrollContainerElement] =
|
|
11639
|
+
const [activeTurnId, setActiveTurnId] = useState30(lastTurnId);
|
|
11640
|
+
const [virtualScrollMargin, setVirtualScrollMargin] = useState30(0);
|
|
11641
|
+
const [scrollContainerElement, setScrollContainerElement] = useState30(null);
|
|
11526
11642
|
const loadingOlderRef = useRef22(false);
|
|
11527
11643
|
const virtualizationEnabled = Boolean(useChatEnvironment().useVirtualizer);
|
|
11528
11644
|
const stablePrefixEnd = useMemo15(
|
|
@@ -12654,7 +12770,7 @@ function MessageListContent({
|
|
|
12654
12770
|
/* @__PURE__ */ jsx37("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
12655
12771
|
]
|
|
12656
12772
|
}
|
|
12657
|
-
) : /* @__PURE__ */ jsxs35(
|
|
12773
|
+
) : /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
12658
12774
|
stablePrefixEnd > 0 ? /* @__PURE__ */ jsx37(
|
|
12659
12775
|
"div",
|
|
12660
12776
|
{
|
|
@@ -12734,14 +12850,14 @@ function MessageList(props) {
|
|
|
12734
12850
|
|
|
12735
12851
|
// src/chat/runtime/use-chat-actions.ts
|
|
12736
12852
|
import { captureClientInputTime } from "@blade-hq/agent-client/internal";
|
|
12737
|
-
import { useCallback as useCallback15, useEffect as useEffect27, useRef as useRef23, useState as
|
|
12853
|
+
import { useCallback as useCallback15, useEffect as useEffect27, useRef as useRef23, useState as useState31 } from "react";
|
|
12738
12854
|
function useChatActions(sessionId) {
|
|
12739
12855
|
const source = useSessionSource();
|
|
12740
12856
|
const session = useSessionHandle(sessionId);
|
|
12741
12857
|
const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
|
|
12742
|
-
const [isStopping, setIsStopping] =
|
|
12743
|
-
const [queueNotice, setQueueNotice] =
|
|
12744
|
-
const [pendingQueueItemId, setPendingQueueItemId] =
|
|
12858
|
+
const [isStopping, setIsStopping] = useState31(false);
|
|
12859
|
+
const [queueNotice, setQueueNotice] = useState31(null);
|
|
12860
|
+
const [pendingQueueItemId, setPendingQueueItemId] = useState31(null);
|
|
12745
12861
|
const previousSessionIdRef = useRef23(sessionId);
|
|
12746
12862
|
const send = useCallback15(
|
|
12747
12863
|
(msg, targetMode, askuserAnswer, options) => source.whenReady ? source.whenReady(sessionId, (ready) => sendToSession(ready, msg, targetMode, askuserAnswer, options)) : session ? sendToSession(session, msg, targetMode, askuserAnswer, options) : Promise.resolve(false),
|
|
@@ -12898,12 +13014,13 @@ function SessionReplayBar({
|
|
|
12898
13014
|
onSpeedChange: (next) => void setSpeed(next),
|
|
12899
13015
|
onExit: onExit ?? (() => void exitToAutonomous()),
|
|
12900
13016
|
className
|
|
12901
|
-
}
|
|
13017
|
+
},
|
|
13018
|
+
sessionId
|
|
12902
13019
|
);
|
|
12903
13020
|
}
|
|
12904
13021
|
|
|
12905
13022
|
// src/chat/ChatPanel.tsx
|
|
12906
|
-
import { Fragment as
|
|
13023
|
+
import { Fragment as Fragment17, jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
12907
13024
|
function nextQueuedOrder(items, itemId, delta) {
|
|
12908
13025
|
const pending = items.filter((item) => item.status === "pending");
|
|
12909
13026
|
const index = pending.findIndex((item) => item.id === itemId);
|
|
@@ -12987,12 +13104,12 @@ function ChatPanel({
|
|
|
12987
13104
|
deliverQueuedMessage,
|
|
12988
13105
|
resumeQueue
|
|
12989
13106
|
} = useChatActions(sessionId);
|
|
12990
|
-
const [isRevealing, setIsRevealing] =
|
|
13107
|
+
const [isRevealing, setIsRevealing] = useState32(false);
|
|
12991
13108
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
12992
13109
|
const detail = useChatSessionDetail(sessionId);
|
|
12993
13110
|
const { isReplay } = useSessionReplay(sessionId);
|
|
12994
13111
|
const isLoadingHistory = useIsSessionHistoryLoading(sessionId);
|
|
12995
|
-
const [queuePanelVisible, setQueuePanelVisible] =
|
|
13112
|
+
const [queuePanelVisible, setQueuePanelVisible] = useState32(false);
|
|
12996
13113
|
const loadOlder = useCallback17(
|
|
12997
13114
|
async (beforeCommit) => {
|
|
12998
13115
|
if (!agentSession) return false;
|
|
@@ -13002,7 +13119,7 @@ function ChatPanel({
|
|
|
13002
13119
|
},
|
|
13003
13120
|
[agentSession]
|
|
13004
13121
|
);
|
|
13005
|
-
const [paginationActivation, setPaginationActivation] =
|
|
13122
|
+
const [paginationActivation, setPaginationActivation] = useState32(() => ({
|
|
13006
13123
|
sessionId,
|
|
13007
13124
|
activated: Boolean(nextBefore)
|
|
13008
13125
|
}));
|
|
@@ -13023,7 +13140,7 @@ function ChatPanel({
|
|
|
13023
13140
|
const isViewer = (viewerRole ?? detail?.viewer_role) === "viewer";
|
|
13024
13141
|
const isCompacting = activeCompaction != null || compactionPending;
|
|
13025
13142
|
const postChatFollowup = useMemo16(() => latestPostChatFollowup(turns), [turns]);
|
|
13026
|
-
const [resultFeedback, setResultFeedback] =
|
|
13143
|
+
const [resultFeedback, setResultFeedback] = useState32([]);
|
|
13027
13144
|
useEffect28(() => {
|
|
13028
13145
|
setResultFeedback([]);
|
|
13029
13146
|
if (isViewer || !sessionId) return;
|
|
@@ -13280,7 +13397,7 @@ function ChatPanel({
|
|
|
13280
13397
|
className: cn("mx-auto w-full max-w-[var(--blade-chat-width,780px)] px-5 pb-3", classNames?.chatInputInner)
|
|
13281
13398
|
}
|
|
13282
13399
|
) : null,
|
|
13283
|
-
!isViewer && /* @__PURE__ */ jsxs36(
|
|
13400
|
+
!isViewer && /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
13284
13401
|
/* @__PURE__ */ jsx39(
|
|
13285
13402
|
SessionQueuePanel,
|
|
13286
13403
|
{
|
|
@@ -13311,13 +13428,13 @@ function ChatPanel({
|
|
|
13311
13428
|
}
|
|
13312
13429
|
|
|
13313
13430
|
// src/components/SessionPluginSelector.tsx
|
|
13314
|
-
import { useEffect as useEffect29, useState as
|
|
13431
|
+
import { useEffect as useEffect29, useState as useState33 } from "react";
|
|
13315
13432
|
import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
13316
13433
|
function SessionPluginSelector(props) {
|
|
13317
13434
|
return /* @__PURE__ */ jsx40(PluginSelectorState, { ...props }, props.sessionId);
|
|
13318
13435
|
}
|
|
13319
13436
|
function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
|
|
13320
|
-
const [open, setOpen] =
|
|
13437
|
+
const [open, setOpen] = useState33(false);
|
|
13321
13438
|
return /* @__PURE__ */ jsxs37("div", { className: `relative text-xs ${className ?? ""}`, children: [
|
|
13322
13439
|
/* @__PURE__ */ jsx40(
|
|
13323
13440
|
"button",
|
|
@@ -13374,13 +13491,13 @@ function PluginSelectorList({
|
|
|
13374
13491
|
}
|
|
13375
13492
|
|
|
13376
13493
|
// src/components/AgentChat.tsx
|
|
13377
|
-
import { Fragment as
|
|
13494
|
+
import { Fragment as Fragment18, jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
13378
13495
|
function isUnauthorizedError(error) {
|
|
13379
13496
|
return error instanceof BladeApiError && error.status === 401;
|
|
13380
13497
|
}
|
|
13381
13498
|
function LoginCard({ client, onLoggedIn }) {
|
|
13382
|
-
const [loggingIn, setLoggingIn] =
|
|
13383
|
-
const [loginError, setLoginError] =
|
|
13499
|
+
const [loggingIn, setLoggingIn] = useState34(false);
|
|
13500
|
+
const [loginError, setLoginError] = useState34(null);
|
|
13384
13501
|
const handleLogin = async () => {
|
|
13385
13502
|
setLoggingIn(true);
|
|
13386
13503
|
setLoginError(null);
|
|
@@ -13412,8 +13529,8 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
13412
13529
|
}
|
|
13413
13530
|
function AgentChat(props) {
|
|
13414
13531
|
const client = useBladeClient();
|
|
13415
|
-
const [attempt, setAttempt] =
|
|
13416
|
-
const [needLogin, setNeedLogin] =
|
|
13532
|
+
const [attempt, setAttempt] = useState34(0);
|
|
13533
|
+
const [needLogin, setNeedLogin] = useState34(() => !client.hasToken());
|
|
13417
13534
|
if (needLogin) {
|
|
13418
13535
|
return /* @__PURE__ */ jsx41(
|
|
13419
13536
|
"div",
|
|
@@ -13458,7 +13575,7 @@ function ChatSessionView({
|
|
|
13458
13575
|
onSessionCreated
|
|
13459
13576
|
});
|
|
13460
13577
|
const replay = useReplay(session);
|
|
13461
|
-
const [notice, setNotice] =
|
|
13578
|
+
const [notice, setNotice] = useState34(null);
|
|
13462
13579
|
const source = useSingleSessionSource(session, !session || state2 === null);
|
|
13463
13580
|
const resolvedSessionId = session?.sessionId;
|
|
13464
13581
|
const isViewer = state2?.viewerRole === "viewer";
|
|
@@ -13517,7 +13634,7 @@ function ChatSessionView({
|
|
|
13517
13634
|
onFollowupInteraction,
|
|
13518
13635
|
errorMessage: connectError ?? replay.error?.message ?? notice,
|
|
13519
13636
|
onExitReplay: () => void replay.exitToAutonomous(),
|
|
13520
|
-
banner: /* @__PURE__ */ jsxs38(
|
|
13637
|
+
banner: /* @__PURE__ */ jsxs38(Fragment18, { children: [
|
|
13521
13638
|
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx41(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
|
|
13522
13639
|
/* @__PURE__ */ jsx41(ReplayMismatchPrompt, { mismatch: replay.mismatch })
|
|
13523
13640
|
] })
|
|
@@ -13527,20 +13644,20 @@ function ChatSessionView({
|
|
|
13527
13644
|
|
|
13528
13645
|
// src/components/LlmChat.tsx
|
|
13529
13646
|
import { chatErrorForDisplay as chatErrorForDisplay4 } from "@blade-hq/agent-client/internal";
|
|
13530
|
-
import { useEffect as useEffect31, useMemo as useMemo19, useState as
|
|
13647
|
+
import { useEffect as useEffect31, useMemo as useMemo19, useState as useState37 } from "react";
|
|
13531
13648
|
|
|
13532
13649
|
// src/hooks/use-llm-chat.ts
|
|
13533
|
-
import { useCallback as useCallback18, useMemo as useMemo18, useRef as useRef26, useState as
|
|
13650
|
+
import { useCallback as useCallback18, useMemo as useMemo18, useRef as useRef26, useState as useState35 } from "react";
|
|
13534
13651
|
var DEFAULT_HISTORY_TURNS = 12;
|
|
13535
13652
|
var DEFAULT_MAX_TOOL_ROUNDS = 4;
|
|
13536
13653
|
var syntheticIdSeq = 0;
|
|
13537
13654
|
function useLlmChat(options) {
|
|
13538
|
-
const [history, setHistory] =
|
|
13539
|
-
const [streamingText, setStreamingText] =
|
|
13540
|
-
const [streamingCalls, setStreamingCalls] =
|
|
13541
|
-
const [failedToolIds, setFailedToolIds] =
|
|
13542
|
-
const [error, setError] =
|
|
13543
|
-
const [isStreaming, setIsStreaming] =
|
|
13655
|
+
const [history, setHistory] = useState35([]);
|
|
13656
|
+
const [streamingText, setStreamingText] = useState35(null);
|
|
13657
|
+
const [streamingCalls, setStreamingCalls] = useState35([]);
|
|
13658
|
+
const [failedToolIds, setFailedToolIds] = useState35([]);
|
|
13659
|
+
const [error, setError] = useState35(null);
|
|
13660
|
+
const [isStreaming, setIsStreaming] = useState35(false);
|
|
13544
13661
|
const abortRef = useRef26(null);
|
|
13545
13662
|
const activeStartedAtRef = useRef26(null);
|
|
13546
13663
|
const assistantTimingsRef = useRef26(/* @__PURE__ */ new WeakMap());
|
|
@@ -13886,7 +14003,7 @@ function toToolCallInfo(call, results, failedToolIds) {
|
|
|
13886
14003
|
}
|
|
13887
14004
|
|
|
13888
14005
|
// src/components/LlmAdvancedSettings.tsx
|
|
13889
|
-
import { useState as
|
|
14006
|
+
import { useState as useState36 } from "react";
|
|
13890
14007
|
import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
13891
14008
|
var FIELDS = [
|
|
13892
14009
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
@@ -13933,8 +14050,8 @@ function writeOverride(settings, baseURL, override) {
|
|
|
13933
14050
|
}
|
|
13934
14051
|
function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
13935
14052
|
const normalized = normalizeAdvanced(settings);
|
|
13936
|
-
const [open, setOpen] =
|
|
13937
|
-
const [draft, setDraft] =
|
|
14053
|
+
const [open, setOpen] = useState36(false);
|
|
14054
|
+
const [draft, setDraft] = useState36(override);
|
|
13938
14055
|
if (!normalized) return null;
|
|
13939
14056
|
const fields = FIELDS.filter((field) => normalized[field.id]);
|
|
13940
14057
|
const dirty = Object.keys(override).length > 0;
|
|
@@ -14017,12 +14134,12 @@ function LlmChat({
|
|
|
14017
14134
|
onOverrideChange,
|
|
14018
14135
|
...options
|
|
14019
14136
|
}) {
|
|
14020
|
-
const [override, setOverride] =
|
|
14137
|
+
const [override, setOverride] = useState37(() => readOverride(advanced, options.baseURL));
|
|
14021
14138
|
const effective = { ...options, ...override };
|
|
14022
14139
|
const { messages, isStreaming, error, send, stop, reset } = useLlmChat(effective);
|
|
14023
|
-
const [inputText, setInputText] =
|
|
14024
|
-
const [stopRequested, setStopRequested] =
|
|
14025
|
-
const [isRevealing, setIsRevealing] =
|
|
14140
|
+
const [inputText, setInputText] = useState37("");
|
|
14141
|
+
const [stopRequested, setStopRequested] = useState37(false);
|
|
14142
|
+
const [isRevealing, setIsRevealing] = useState37(false);
|
|
14026
14143
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
14027
14144
|
const handle = useMemo19(
|
|
14028
14145
|
() => ({
|
|
@@ -14134,7 +14251,7 @@ function ChatView(props) {
|
|
|
14134
14251
|
}
|
|
14135
14252
|
|
|
14136
14253
|
// src/components/TopicAssetSubmitDialog.tsx
|
|
14137
|
-
import { useRef as useRef27, useState as
|
|
14254
|
+
import { useRef as useRef27, useState as useState38 } from "react";
|
|
14138
14255
|
import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
14139
14256
|
function useTopicAssetSubmissionAccess(sessionId) {
|
|
14140
14257
|
const client = useBladeClient();
|
|
@@ -14151,12 +14268,12 @@ function useTopicAssetSubmissionAccess(sessionId) {
|
|
|
14151
14268
|
}
|
|
14152
14269
|
function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted }) {
|
|
14153
14270
|
const client = useBladeClient();
|
|
14154
|
-
const [folder, setFolder] =
|
|
14155
|
-
const [message, setMessage] =
|
|
14156
|
-
const [error, setError] =
|
|
14157
|
-
const [busy, setBusy] =
|
|
14271
|
+
const [folder, setFolder] = useState38("");
|
|
14272
|
+
const [message, setMessage] = useState38("");
|
|
14273
|
+
const [error, setError] = useState38(null);
|
|
14274
|
+
const [busy, setBusy] = useState38(false);
|
|
14158
14275
|
const submitting = useRef27(false);
|
|
14159
|
-
const [revision, setRevision] =
|
|
14276
|
+
const [revision, setRevision] = useState38(0);
|
|
14160
14277
|
const assets = useAsyncValue(`${sessionId}:${topicId}:${revision}`, async () => {
|
|
14161
14278
|
const [session, groups, result] = await Promise.all([
|
|
14162
14279
|
client.sessions.getSession(sessionId),
|
|
@@ -14227,10 +14344,10 @@ function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted
|
|
|
14227
14344
|
}
|
|
14228
14345
|
|
|
14229
14346
|
// src/hooks/use-capabilities.ts
|
|
14230
|
-
import { useEffect as useEffect32, useState as
|
|
14347
|
+
import { useEffect as useEffect32, useState as useState39 } from "react";
|
|
14231
14348
|
function useCapabilities(client) {
|
|
14232
14349
|
const token = client.token;
|
|
14233
|
-
const [state2, setState2] =
|
|
14350
|
+
const [state2, setState2] = useState39(null);
|
|
14234
14351
|
useEffect32(() => {
|
|
14235
14352
|
const controller = new AbortController();
|
|
14236
14353
|
let timer;
|
|
@@ -14427,4 +14544,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
14427
14544
|
js-yaml/dist/js-yaml.mjs:
|
|
14428
14545
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
14429
14546
|
*/
|
|
14430
|
-
//# sourceMappingURL=chunk-
|
|
14547
|
+
//# sourceMappingURL=chunk-EE6BXK2Y.js.map
|