@blade-hq/agent-kit 1.0.28 → 1.0.29
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/{chunk-BGNKHPCD.js → chunk-N2OE5MVV.js} +43 -15
- package/dist/chunk-N2OE5MVV.js.map +1 -0
- package/dist/{chunk-OGHUIKCY.js → chunk-YXHPJGXR.js} +25 -11
- package/dist/chunk-YXHPJGXR.js.map +1 -0
- package/dist/client/types/rest.d.ts +57 -0
- package/dist/react/components/chat/AskUserQuestionBlock.d.ts +1 -1
- package/dist/react/components/chat/ChatInput.d.ts +10 -4
- package/dist/react/components/chat/index.d.ts +1 -1
- package/dist/react/components/chat/index.js +2 -2
- package/dist/react/components/plan/index.js +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/dist/react/schemas/session.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-BGNKHPCD.js.map +0 -1
- package/dist/chunk-OGHUIKCY.js.map +0 -1
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getCodeLanguageFromFilename,
|
|
14
14
|
parseAskUserQuestion,
|
|
15
15
|
useHighlightedCodeHtml
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YXHPJGXR.js";
|
|
17
17
|
import {
|
|
18
18
|
resolveSessionFilePreviewTarget
|
|
19
19
|
} from "./chunk-PYYDXV2A.js";
|
|
@@ -2852,6 +2852,7 @@ function ChatInput({
|
|
|
2852
2852
|
onCommand,
|
|
2853
2853
|
canShareSession = false,
|
|
2854
2854
|
slotAboveTextarea,
|
|
2855
|
+
slotBeforeSend,
|
|
2855
2856
|
externalDraft,
|
|
2856
2857
|
externalAttachments,
|
|
2857
2858
|
maxWidthClassName = "max-w-3xl",
|
|
@@ -3309,6 +3310,7 @@ function ChatInput({
|
|
|
3309
3310
|
setRewindDraft(activeSessionId, null);
|
|
3310
3311
|
}, [activeSessionId, editor, rewindDraft, setRewindDraft]);
|
|
3311
3312
|
const submittingRef = useRef5(false);
|
|
3313
|
+
const [isSubmitting, setIsSubmitting] = useState8(false);
|
|
3312
3314
|
useEffect7(() => {
|
|
3313
3315
|
let changed = false;
|
|
3314
3316
|
const nextLocalIds = /* @__PURE__ */ new Set();
|
|
@@ -3433,6 +3435,7 @@ function ChatInput({
|
|
|
3433
3435
|
return;
|
|
3434
3436
|
}
|
|
3435
3437
|
submittingRef.current = true;
|
|
3438
|
+
setIsSubmitting(true);
|
|
3436
3439
|
try {
|
|
3437
3440
|
const json = editor?.getJSON();
|
|
3438
3441
|
const rawText = serializeEditorContent(json);
|
|
@@ -3445,9 +3448,15 @@ function ChatInput({
|
|
|
3445
3448
|
let uploadTargetSessionId;
|
|
3446
3449
|
if (pendingFiles.length > 0) {
|
|
3447
3450
|
let uploadSessionId = activeSessionId;
|
|
3451
|
+
let pendingFilesHandled = false;
|
|
3448
3452
|
if (!uploadSessionId && ensureSession) {
|
|
3449
3453
|
try {
|
|
3450
|
-
|
|
3454
|
+
const ensured = await ensureSession(text || "\u65B0\u4F1A\u8BDD", {
|
|
3455
|
+
model: selectedModel || null,
|
|
3456
|
+
thinkingOverride: thinkingAvailable && (sessionThinking != null || thinkingPreference != null) ? thinkingEnabled : void 0
|
|
3457
|
+
});
|
|
3458
|
+
uploadSessionId = typeof ensured === "string" ? ensured : ensured.sessionId;
|
|
3459
|
+
pendingFilesHandled = typeof ensured === "object" && ensured.pendingFilesHandled === true;
|
|
3451
3460
|
} catch {
|
|
3452
3461
|
setComposerAttachments(
|
|
3453
3462
|
(prev) => prev.map(
|
|
@@ -3459,7 +3468,12 @@ function ChatInput({
|
|
|
3459
3468
|
}
|
|
3460
3469
|
if (uploadSessionId) {
|
|
3461
3470
|
uploadTargetSessionId = uploadSessionId;
|
|
3462
|
-
if (
|
|
3471
|
+
if (pendingFilesHandled) {
|
|
3472
|
+
updatedAttachments = composerAttachments.map(
|
|
3473
|
+
(attachment) => pendingFiles.some((pending) => pending.id === attachment.id) ? { ...attachment, status: "uploaded", uploadedPath: attachment.name } : attachment
|
|
3474
|
+
);
|
|
3475
|
+
setComposerAttachments(updatedAttachments);
|
|
3476
|
+
} else if (pendingFiles.length > 0) {
|
|
3463
3477
|
setComposerAttachments(
|
|
3464
3478
|
(prev) => prev.map(
|
|
3465
3479
|
(a) => a.kind === "file" && a.status === "pending" ? { ...a, status: "uploading", uploadProgress: 0 } : a
|
|
@@ -3533,17 +3547,23 @@ function ChatInput({
|
|
|
3533
3547
|
if (activeSessionId && activePendingContexts.length > 0) {
|
|
3534
3548
|
consumePendingContexts(activeSessionId);
|
|
3535
3549
|
}
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3550
|
+
try {
|
|
3551
|
+
await onSend(nextPayload, {
|
|
3552
|
+
targetSessionId: uploadTargetSessionId,
|
|
3553
|
+
model: selectedModel || null,
|
|
3554
|
+
thinkingOverride: thinkingAvailable && (sessionThinking != null || thinkingPreference != null) ? thinkingEnabled : void 0
|
|
3555
|
+
});
|
|
3556
|
+
} catch (error) {
|
|
3557
|
+
toast.error(error instanceof Error ? error.message : "\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
|
|
3558
|
+
return;
|
|
3559
|
+
}
|
|
3541
3560
|
if (text.trim()) {
|
|
3542
3561
|
inputHistory.addEntry(text);
|
|
3543
3562
|
}
|
|
3544
3563
|
resetComposer();
|
|
3545
3564
|
} finally {
|
|
3546
3565
|
submittingRef.current = false;
|
|
3566
|
+
setIsSubmitting(false);
|
|
3547
3567
|
}
|
|
3548
3568
|
};
|
|
3549
3569
|
const removeAttachment = (id) => {
|
|
@@ -3569,7 +3589,7 @@ function ChatInput({
|
|
|
3569
3589
|
(attachment) => attachment.status === "uploading"
|
|
3570
3590
|
);
|
|
3571
3591
|
const hasValidAttachments = composerAttachments.some((attachment) => attachment.status !== "failed");
|
|
3572
|
-
const isSendDisabled = connectionStatus !== "connected" || isModelLoading || !hasAvailableModel || hasUploadingFiles || !input.trim() && !hasValidAttachments && !hasRenderedAttachments && !hasPendingContexts;
|
|
3592
|
+
const isSendDisabled = connectionStatus !== "connected" || isModelLoading || !hasAvailableModel || isSubmitting || hasUploadingFiles || !input.trim() && !hasValidAttachments && !hasRenderedAttachments && !hasPendingContexts;
|
|
3573
3593
|
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
3574
3594
|
/* @__PURE__ */ jsx10("div", { className: `bg-[hsl(var(--background))] px-5 py-3 ${className ?? ""}`, children: /* @__PURE__ */ jsxs9("div", { className: `mx-auto ${maxWidthClassName} ${innerClassName ?? ""}`, children: [
|
|
3575
3595
|
activeSessionId ? /* @__PURE__ */ jsx10(BackgroundTasksPill, { sessionId: activeSessionId }) : null,
|
|
@@ -3937,6 +3957,7 @@ function ChatInput({
|
|
|
3937
3957
|
children: !asrEnabled ? /* @__PURE__ */ jsx10(MicOff, { size: 13 }) : isRecording ? /* @__PURE__ */ jsx10(VoiceWaveform, { level: voiceLevel, size: 18 }) : /* @__PURE__ */ jsx10(Mic, { size: 13 })
|
|
3938
3958
|
}
|
|
3939
3959
|
),
|
|
3960
|
+
slotBeforeSend,
|
|
3940
3961
|
isStreaming ? /* @__PURE__ */ jsx10(
|
|
3941
3962
|
"button",
|
|
3942
3963
|
{
|
|
@@ -3956,7 +3977,7 @@ function ChatInput({
|
|
|
3956
3977
|
"aria-label": "\u53D1\u9001\u6D88\u606F",
|
|
3957
3978
|
title: isModelLoading ? "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u914D\u7F6E" : !hasAvailableModel ? "\u6CA1\u6709\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u670D\u52A1\u914D\u7F6E" : "\u53D1\u9001\u6D88\u606F",
|
|
3958
3979
|
className: "flex h-7 w-7 items-center justify-center rounded-lg bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] transition-opacity hover:opacity-80 disabled:opacity-25",
|
|
3959
|
-
children: /* @__PURE__ */ jsx10(Send, { size: 13 })
|
|
3980
|
+
children: isSubmitting ? /* @__PURE__ */ jsx10(Loader22, { size: 13, className: "animate-spin" }) : /* @__PURE__ */ jsx10(Send, { size: 13 })
|
|
3960
3981
|
}
|
|
3961
3982
|
)
|
|
3962
3983
|
] })
|
|
@@ -6005,7 +6026,7 @@ function ToolCallBlock({
|
|
|
6005
6026
|
}, [shouldAutoExpandWhileStreaming]);
|
|
6006
6027
|
const resolvedSessionStatus = sessionStatus ?? sessions.find((session) => session.id === resolvedSessionId)?.status;
|
|
6007
6028
|
const resolvedAnswerData = answerData ?? storedAnswerData;
|
|
6008
|
-
const resolvedAnswered = answered ?? (!!resolvedAnswerData && resolvedSessionStatus !== "waiting_for_input");
|
|
6029
|
+
const resolvedAnswered = toolCall.status === "awaiting_answer" ? false : answered ?? (!!resolvedAnswerData && resolvedSessionStatus !== "waiting_for_input");
|
|
6009
6030
|
const resolvedOnAnswer = onAnswer ?? answerCallback;
|
|
6010
6031
|
const uiMeta = useMemo13(() => {
|
|
6011
6032
|
const block = turnBlocks?.find(
|
|
@@ -6015,9 +6036,8 @@ function ToolCallBlock({
|
|
|
6015
6036
|
}, [toolCall.id, turnBlocks]);
|
|
6016
6037
|
if (normalizedName === "AskUserQuestion") {
|
|
6017
6038
|
const askData = parseAskUserQuestion(typeof toolCall.result === "string" ? toolCall.result : null) ?? parseAskUserQuestion(buildAskUserPayload(toolCall.arguments));
|
|
6018
|
-
const canAnswer = toolCall.status === "awaiting_answer" &&
|
|
6019
|
-
|
|
6020
|
-
if (askData && shouldRenderQuestion) {
|
|
6039
|
+
const canAnswer = toolCall.status === "awaiting_answer" && resolvedSessionStatus === "waiting_for_input" && Boolean(resolvedOnAnswer);
|
|
6040
|
+
if (askData) {
|
|
6021
6041
|
const questionBlock = /* @__PURE__ */ jsx22(
|
|
6022
6042
|
AskUserQuestionBlock,
|
|
6023
6043
|
{
|
|
@@ -6037,6 +6057,14 @@ function ToolCallBlock({
|
|
|
6037
6057
|
/* @__PURE__ */ jsx22("div", { className: "ml-4", children: /* @__PURE__ */ jsx22(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
6038
6058
|
] });
|
|
6039
6059
|
}
|
|
6060
|
+
return /* @__PURE__ */ jsxs18("div", { className: "ml-4 max-w-lg rounded-xl border border-amber-500/35 bg-amber-500/10 p-4 text-sm text-[hsl(var(--foreground))]", children: [
|
|
6061
|
+
/* @__PURE__ */ jsx22("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
|
|
6062
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: [
|
|
6063
|
+
"\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u6216\u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u63D0\u4F9B\u4EA4\u4E92\u7F16\u53F7",
|
|
6064
|
+
/* @__PURE__ */ jsx22("span", { className: "ml-1 font-mono", children: toolCall.id }),
|
|
6065
|
+
"\u3002"
|
|
6066
|
+
] })
|
|
6067
|
+
] });
|
|
6040
6068
|
}
|
|
6041
6069
|
const filePath = extractToolFilePath(toolCall);
|
|
6042
6070
|
const tone = getToolTone(toolCall.status);
|
|
@@ -9051,4 +9079,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
9051
9079
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
9052
9080
|
*--------------------------------------------------------------------------------------------*)
|
|
9053
9081
|
*/
|
|
9054
|
-
//# sourceMappingURL=chunk-
|
|
9082
|
+
//# sourceMappingURL=chunk-N2OE5MVV.js.map
|