@blade-hq/agent-react 2612.0.0-beta.86 → 2612.0.0-beta.88
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/README.md +1 -1
- package/dist/SessionPluginConfigForm-Y657MKRX.js +9 -0
- package/dist/chat/AssistantTurnBlock.d.ts +2 -1
- package/dist/chat/ChatLoadingIndicator.d.ts +9 -1
- package/dist/chat/ChatPanel.d.ts +3 -1
- package/dist/chat/FileDeliveryCards.d.ts +12 -6
- package/dist/chat/ai-elements/shimmer.d.ts +4 -0
- package/dist/chat/chat-column-width.d.ts +21 -0
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/runtime/actions.d.ts +5 -1
- package/dist/chat/runtime/environment.d.ts +2 -0
- package/dist/chat/runtime/use-chat-actions.d.ts +1 -1
- package/dist/chat.css +18 -0
- package/dist/{chunk-SK43YNRX.js → chunk-5ESAKOUV.js} +2 -2
- package/dist/{chunk-6RQGCCG7.js → chunk-5UGLGKFI.js} +205 -7
- package/dist/chunk-5UGLGKFI.js.map +1 -0
- package/dist/{chunk-LYDXKR3Q.js → chunk-7LVZQ4LS.js} +95 -70
- package/dist/chunk-7LVZQ4LS.js.map +1 -0
- package/dist/{chunk-MWILWSPG.js → chunk-GXHHSZSS.js} +2 -2
- package/dist/{chunk-C3LBNHVM.js → chunk-LOXIHCL2.js} +13 -7
- package/dist/{chunk-C3LBNHVM.js.map → chunk-LOXIHCL2.js.map} +1 -1
- package/dist/{chunk-FDB3J5QF.js → chunk-NADWKQYZ.js} +76 -11
- package/dist/{chunk-FDB3J5QF.js.map → chunk-NADWKQYZ.js.map} +1 -1
- package/dist/{chunk-FH5HA3GW.js → chunk-PWUFWSMN.js} +6 -6
- package/dist/chunk-PWUFWSMN.js.map +1 -0
- package/dist/{chunk-RGL2XUQR.js → chunk-QKI7OC5D.js} +1803 -1183
- package/dist/chunk-QKI7OC5D.js.map +1 -0
- package/dist/{chunk-KHJEIHMJ.js → chunk-SEJUZPT5.js} +37 -60
- package/dist/chunk-SEJUZPT5.js.map +1 -0
- package/dist/{chunk-NRYLAO3X.js → chunk-VTEKA5HD.js} +281 -102
- package/dist/{chunk-NRYLAO3X.js.map → chunk-VTEKA5HD.js.map} +1 -1
- package/dist/connectors.js +3 -3
- package/dist/index.js +9 -9
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +620 -46
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +4 -4
- package/dist/rich-input/ChatInput.d.ts +1 -1
- package/dist/rich-input/ModelSelector.d.ts +3 -1
- package/dist/rich-input/model/resolve-model.d.ts +1 -1
- package/dist/rich-input.js +1051 -1185
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +19 -1
- package/dist/tool-details.js +5 -5
- package/package.json +2 -2
- package/dist/SessionPluginConfigForm-7LJ5SUNY.js +0 -9
- package/dist/chat-IHPRU35X.css +0 -162
- package/dist/chunk-6RQGCCG7.js.map +0 -1
- package/dist/chunk-FH5HA3GW.js.map +0 -1
- package/dist/chunk-KHJEIHMJ.js.map +0 -1
- package/dist/chunk-LYDXKR3Q.js.map +0 -1
- package/dist/chunk-RGL2XUQR.js.map +0 -1
- /package/dist/{SessionPluginConfigForm-7LJ5SUNY.js.map → SessionPluginConfigForm-Y657MKRX.js.map} +0 -0
- /package/dist/{chunk-SK43YNRX.js.map → chunk-5ESAKOUV.js.map} +0 -0
- /package/dist/{chunk-MWILWSPG.js.map → chunk-GXHHSZSS.js.map} +0 -0
package/README.md
CHANGED
|
@@ -496,7 +496,7 @@ ChatView 和 `<blade-chat>` 的默认轻量输入支持 @ 搜索插件条目,
|
|
|
496
496
|
|
|
497
497
|
### 应用资料展示
|
|
498
498
|
|
|
499
|
-
共享聊天视图展示消息级 `context_attachments`:气泡只显示正文,资料标签可展开查看纯文本详情,`data` 中的内部 JSON 与 ID 不显示。`ChatSendOptions.contextAttachments` 可沿共享发送入口传入 SDK
|
|
499
|
+
共享聊天视图展示消息级 `context_attachments`:气泡只显示正文,资料标签可展开查看纯文本详情,`data` 中的内部 JSON 与 ID 不显示。`ChatSendOptions.contextAttachments` 可沿共享发送入口传入 SDK;可靠后台发送先持久保存原业务输入与 requestId,再调用同一 `AgentSession.send`,按 `receipt.status` 判断接收结果。文件读取使用当前 `BladeProvider` 的 `BladeClient` 和资料指定的会话权限,失效或没有来源的文件显示「文件不可用」。内置 Web、扩展和嵌入视图使用相同实现。
|
|
500
500
|
|
|
501
501
|
### 独立嵌入提问卡片(React 19+)
|
|
502
502
|
|
|
@@ -14,6 +14,7 @@ interface Props {
|
|
|
14
14
|
sessionStatus?: string;
|
|
15
15
|
level?: 1 | 2;
|
|
16
16
|
forceExpanded?: boolean;
|
|
17
|
+
excludeDeliveredPaths?: ReadonlySet<string>;
|
|
17
18
|
customization?: ChatViewCustomization;
|
|
18
19
|
}
|
|
19
20
|
export type TurnDisplayMode = "compact" | "detail";
|
|
@@ -32,7 +33,7 @@ export declare function getExecutionDurationMs({ messages, isStreaming, now, }:
|
|
|
32
33
|
isStreaming: boolean;
|
|
33
34
|
now?: number | null;
|
|
34
35
|
}): number;
|
|
35
|
-
declare function AssistantTurnBlockBase({ sessionId, messages: rawMessages, isStreaming, isReasoningRevealing, askAnswers, onAnswer, sessionStatus, level, forceExpanded, customization, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
declare function AssistantTurnBlockBase({ sessionId, messages: rawMessages, isStreaming, isReasoningRevealing, askAnswers, onAnswer, sessionStatus, level, forceExpanded, excludeDeliveredPaths, customization, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
36
37
|
export declare const AssistantTurnBlock: import("react").MemoExoticComponent<typeof AssistantTurnBlockBase>;
|
|
37
38
|
/** 一轮消息里引用到的记忆(按 id 去重,保持首次出现的顺序)。 */
|
|
38
39
|
export declare function collectMemoryRefs(messages: ChatMessage[]): MemoryRefInfo[];
|
|
@@ -2,6 +2,14 @@ export declare function isPreparingReply(messages: readonly {
|
|
|
2
2
|
role: string;
|
|
3
3
|
kind?: string;
|
|
4
4
|
}[]): boolean;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function formatLoadingElapsed(elapsedMs: number): string;
|
|
6
|
+
export declare function resolveLoadingStageLabel({ preparing, elapsedMs, activeToolLabel, }: {
|
|
7
|
+
preparing: boolean;
|
|
8
|
+
elapsedMs: number;
|
|
9
|
+
activeToolLabel?: string | null;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function ChatLoadingIndicator({ preparing, startedAtMs, activeToolLabel, }: {
|
|
6
12
|
preparing?: boolean;
|
|
13
|
+
startedAtMs?: number | null;
|
|
14
|
+
activeToolLabel?: string | null;
|
|
7
15
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/chat/ChatPanel.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export interface ChatPanelProps extends ChatViewCustomization {
|
|
|
49
49
|
initialDraft?: string;
|
|
50
50
|
initialDraftKey?: string;
|
|
51
51
|
renderMode?: ChatRenderMode;
|
|
52
|
+
/** 是否允许在全宽桌面容器中拖拽对话栏左右导轨调宽(侧栏/浮窗/外部嵌入默认关闭)。 */
|
|
53
|
+
resizableColumns?: boolean;
|
|
52
54
|
/**
|
|
53
55
|
* 开发者视图专用的输入框底部统计插槽。宿主(内置 Web 页面)注入;普通与精简视图不会调用它,
|
|
54
56
|
* 因此也不会发出统计请求。
|
|
@@ -59,4 +61,4 @@ export interface ChatPanelProps extends ChatViewCustomization {
|
|
|
59
61
|
* 聊天面板:消息流 + 队列 + 输入框。数据只来自 SessionSourceProvider 提供的会话实例与 props;
|
|
60
62
|
* 内置 Web、浏览器插件与 SDK 的 ChatView / `<blade-chat>` 渲染的都是它。
|
|
61
63
|
*/
|
|
62
|
-
export declare function ChatPanel({ sessionId, theme, mode: providedMode, onToggleMode, banner, header, footer, emptyState, errorMessage: externalError, onExitReplay, placeholder, onFollowupInteraction, renderAttachments, onBeforeSend, onCommand, canCreateBoardTask, canShareSession, onOpenSkills, inputLabel, onDoubleEscape, composerHint, composerBanner, scrollToStartKey, scrollToEntryKey, initialDraft, initialDraftKey, renderMode: requestedRenderMode, renderComposerStats, classNames, components, renderers, }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function ChatPanel({ sessionId, theme, mode: providedMode, onToggleMode, banner, header, footer, emptyState, errorMessage: externalError, onExitReplay, placeholder, onFollowupInteraction, renderAttachments, onBeforeSend, onCommand, canCreateBoardTask, canShareSession, onOpenSkills, inputLabel, onDoubleEscape, composerHint, composerBanner, scrollToStartKey, scrollToEntryKey, initialDraft, initialDraftKey, renderMode: requestedRenderMode, resizableColumns, renderComposerStats, classNames, components, renderers, }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import type { ToolCallInfo } from "@blade-hq/agent-client/internal";
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
export type DeliveredFileChangeKind = "created" | "modified";
|
|
3
|
+
export interface DeliveredFileEntry {
|
|
4
4
|
relPath: string;
|
|
5
5
|
name: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
changeKind: DeliveredFileChangeKind;
|
|
7
|
+
}
|
|
8
|
+
export declare function normalizeDeliveredRelPath(rawPath: string, sessionId: string): string | null;
|
|
9
|
+
/** 从该轮工具调用中提取智能体写入或修改的工作区文件(去重、按首次出现顺序)。 */
|
|
10
|
+
export declare function collectDeliveredFiles(toolCalls: ToolCallInfo[], sessionId: string, excludePaths?: ReadonlySet<string>): DeliveredFileEntry[];
|
|
11
|
+
export declare function DeliveryCard({ path, name, sessionId, description, displayName, changeKind, compact, onOpen, onDownloadStarted, onDownloadSucceeded, }: {
|
|
8
12
|
path: string;
|
|
9
13
|
name: string;
|
|
10
14
|
sessionId: string;
|
|
11
15
|
description?: string;
|
|
12
16
|
displayName?: string;
|
|
17
|
+
changeKind?: DeliveredFileChangeKind;
|
|
13
18
|
compact?: boolean;
|
|
14
19
|
onOpen?: () => void;
|
|
15
20
|
onDownloadStarted?: () => void;
|
|
16
21
|
onDownloadSucceeded?: () => void;
|
|
17
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
/**
|
|
19
|
-
export declare function FileDeliveryCards({ toolCalls, sessionId, }: {
|
|
23
|
+
/** 回合末交付与改动文件卡(参考 DeepSeek ui-deliverables):汇总展示本轮写入或更新的工作区文件。 */
|
|
24
|
+
export declare function FileDeliveryCards({ toolCalls, sessionId, excludePaths, }: {
|
|
20
25
|
toolCalls: ToolCallInfo[];
|
|
21
26
|
sessionId: string;
|
|
27
|
+
excludePaths?: ReadonlySet<string>;
|
|
22
28
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -6,6 +6,10 @@ export interface TextShimmerProps {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
spread?: number;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* 参考 DeepSeek Harness TextShimmer:15° 斜切流光扫掠(105deg),
|
|
11
|
+
* 直接使用语义 HSL 变量,确保浅色/深色主题与独立 SDK 宿主均清晰可见。
|
|
12
|
+
*/
|
|
9
13
|
declare const ShimmerComponent: ({ children, as: Component, className, duration, spread, }: TextShimmerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export declare const Shimmer: import("react").MemoExoticComponent<typeof ShimmerComponent>;
|
|
11
15
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
export declare const CHAT_COLUMN_WIDTH_STORAGE_KEY = "blade-ui:chat-column-width";
|
|
3
|
+
export declare const DEFAULT_CHAT_COLUMN_WIDTH = 780;
|
|
4
|
+
export declare const MIN_CHAT_COLUMN_WIDTH = 640;
|
|
5
|
+
export declare const MAX_CHAT_COLUMN_WIDTH = 1200;
|
|
6
|
+
export declare function clampChatColumnWidth(width: number, containerWidth?: number | null): number;
|
|
7
|
+
export declare function getChatColumnWidth(): number;
|
|
8
|
+
export declare function setChatColumnWidth(nextWidth: number, containerWidth?: number | null): number;
|
|
9
|
+
export declare function resetChatColumnWidth(): number;
|
|
10
|
+
export declare function useChatColumnWidth(enabled?: boolean): {
|
|
11
|
+
width: number;
|
|
12
|
+
setWidth: (next: number, containerWidth?: number | null) => number;
|
|
13
|
+
resetWidth: () => number;
|
|
14
|
+
};
|
|
15
|
+
export declare function ChatColumnResizeRails({ containerRef, effectiveWidth, onWidthChange, onReset, }: {
|
|
16
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
17
|
+
effectiveWidth: number;
|
|
18
|
+
onWidthChange: (nextWidth: number, containerWidth: number | null) => void;
|
|
19
|
+
onReset: () => void;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function useObservedContainerWidth(ref: RefObject<HTMLElement | null>, enabled?: boolean): number | null;
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export type { ChatPanelProps } from "./ChatPanel";
|
|
|
9
9
|
export { CompactionCard } from "./CompactionCard";
|
|
10
10
|
export { ConnectionBanner } from "./ConnectionBanner";
|
|
11
11
|
export { CurrentPlanPanelContent, CurrentPlanPanel } from "./CurrentPlanPanel";
|
|
12
|
-
export { collectDeliveredFiles, DeliveryCard, FileDeliveryCards } from "./FileDeliveryCards";
|
|
12
|
+
export { collectDeliveredFiles, normalizeDeliveredRelPath, DeliveryCard, FileDeliveryCards } from "./FileDeliveryCards";
|
|
13
|
+
export type { DeliveredFileChangeKind, DeliveredFileEntry } from "./FileDeliveryCards";
|
|
14
|
+
export { CHAT_COLUMN_WIDTH_STORAGE_KEY, DEFAULT_CHAT_COLUMN_WIDTH, MIN_CHAT_COLUMN_WIDTH, MAX_CHAT_COLUMN_WIDTH, clampChatColumnWidth, getChatColumnWidth, setChatColumnWidth, resetChatColumnWidth, useChatColumnWidth, useObservedContainerWidth, ChatColumnResizeRails, } from "./chat-column-width";
|
|
13
15
|
export { FinalArtifactCards } from "./FinalArtifactCards";
|
|
14
16
|
export { ImageLightbox } from "./ImageLightbox";
|
|
15
17
|
export { LightComposer } from "./LightComposer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentSession, type InputKind, type MessageContent, type SendOptions, type SessionState } from "@blade-hq/agent-client/internal";
|
|
2
2
|
/**
|
|
3
3
|
* 等待回答时直接在输入框里打字:把这段文字当作最近一个子回路 AskUserQuestion 的自由作答,
|
|
4
4
|
* 服务端据此恢复运行,而不是另起一轮。
|
|
@@ -18,6 +18,10 @@ export interface ChatSendExtras {
|
|
|
18
18
|
* 默认发送引导消息;显式为 true 时,等待当前运行结束后处理。
|
|
19
19
|
*/
|
|
20
20
|
queueWhenRunning?: boolean;
|
|
21
|
+
releaseNativeWait?: boolean;
|
|
22
|
+
inputKind?: InputKind;
|
|
23
|
+
receivedAt?: string;
|
|
24
|
+
timeZone?: string;
|
|
21
25
|
}
|
|
22
26
|
/** 向会话发送一条消息。返回服务端是否接受(或已改道进等待队列)。 */
|
|
23
27
|
export declare function sendToSession(session: AgentSession, message: MessageContent, mode?: string, askUserAnswer?: Record<string, unknown>, extras?: ChatSendExtras): Promise<boolean>;
|
|
@@ -63,6 +63,8 @@ export interface DeveloperMessageListProps {
|
|
|
63
63
|
export interface ChatEnvironment {
|
|
64
64
|
/** 当前渲染模式;不注入时是普通模式。 */
|
|
65
65
|
renderMode?: ChatRenderMode;
|
|
66
|
+
/** 是否在技能列表与 `/` 搜索中显示系统内置技能(与会话是否切到轨迹视图解耦)。 */
|
|
67
|
+
includeBuiltinSkills?: boolean;
|
|
66
68
|
/** 开发者视图;不注入时开发者模式按普通模式显示。 */
|
|
67
69
|
DeveloperMessageList?: ComponentType<DeveloperMessageListProps>;
|
|
68
70
|
/** 默认输入框(内置 Web 注入富输入);不注入时用轻输入。 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MessageContent } from "@blade-hq/agent-client/internal";
|
|
2
2
|
import { type ChatSendExtras } from "./actions";
|
|
3
3
|
export declare function useChatActions(sessionId: string): {
|
|
4
4
|
isStopping: boolean;
|
package/dist/chat.css
CHANGED
|
@@ -150,7 +150,25 @@
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
@keyframes blade-loading-breathe {
|
|
154
|
+
0%, 100% {
|
|
155
|
+
transform: scale(0.92);
|
|
156
|
+
opacity: 0.78;
|
|
157
|
+
}
|
|
158
|
+
50% {
|
|
159
|
+
transform: scale(1.08);
|
|
160
|
+
opacity: 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.blade-loading-pulse {
|
|
165
|
+
animation: blade-loading-breathe 1.6s ease-in-out infinite;
|
|
166
|
+
}
|
|
167
|
+
|
|
153
168
|
@media (prefers-reduced-motion: reduce) {
|
|
169
|
+
.blade-loading-pulse {
|
|
170
|
+
animation: none;
|
|
171
|
+
}
|
|
154
172
|
@keyframes blade-shimmer-sweep {
|
|
155
173
|
from {
|
|
156
174
|
background-position: 0% center;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Plus,
|
|
3
3
|
Trash2
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SEJUZPT5.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM
|
|
@@ -14518,4 +14518,4 @@ react-is/cjs/react-is.development.js:
|
|
|
14518
14518
|
* LICENSE file in the root directory of this source tree.
|
|
14519
14519
|
*)
|
|
14520
14520
|
*/
|
|
14521
|
-
//# sourceMappingURL=chunk-
|
|
14521
|
+
//# sourceMappingURL=chunk-5ESAKOUV.js.map
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
catalogToConnectorItems,
|
|
5
5
|
filterConnectorItems,
|
|
6
6
|
useSessionPluginActivation
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7LVZQ4LS.js";
|
|
8
8
|
import {
|
|
9
9
|
ConnectorConnection
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PWUFWSMN.js";
|
|
11
11
|
import {
|
|
12
12
|
AccountConnectorRules,
|
|
13
13
|
BrowserConnectionDialog
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VTEKA5HD.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigConnection,
|
|
17
17
|
Dialog,
|
|
18
18
|
DialogContent,
|
|
19
19
|
DialogTitle
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GXHHSZSS.js";
|
|
21
21
|
import {
|
|
22
22
|
Check,
|
|
23
23
|
LoaderCircle,
|
|
@@ -26,7 +26,198 @@ import {
|
|
|
26
26
|
RefreshCw,
|
|
27
27
|
Search,
|
|
28
28
|
Trash2
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SEJUZPT5.js";
|
|
30
|
+
|
|
31
|
+
// src/chat/runtime/composer-channels.ts
|
|
32
|
+
import { normalizeTopicAssetRefs } from "@blade-hq/agent-client";
|
|
33
|
+
import { useSyncExternalStore } from "react";
|
|
34
|
+
function buildSignalId() {
|
|
35
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
36
|
+
return crypto.randomUUID();
|
|
37
|
+
}
|
|
38
|
+
return `bridge-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
39
|
+
}
|
|
40
|
+
function withoutKey(record, key) {
|
|
41
|
+
if (!(key in record)) return record;
|
|
42
|
+
const next = { ...record };
|
|
43
|
+
delete next[key];
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
46
|
+
var state = {
|
|
47
|
+
topicAssetReferences: {},
|
|
48
|
+
pendingContexts: {},
|
|
49
|
+
draftAppends: {},
|
|
50
|
+
sendRequests: {},
|
|
51
|
+
modelDrafts: {},
|
|
52
|
+
rewindDrafts: {}
|
|
53
|
+
};
|
|
54
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
55
|
+
function setState(update) {
|
|
56
|
+
const next = update(state);
|
|
57
|
+
if (next === state) return;
|
|
58
|
+
state = next;
|
|
59
|
+
for (const listener of [...listeners]) listener();
|
|
60
|
+
}
|
|
61
|
+
function consume(key, sessionId) {
|
|
62
|
+
const signals = state[key][sessionId] ?? [];
|
|
63
|
+
if (signals.length === 0) return [];
|
|
64
|
+
setState((current) => ({ ...current, [key]: withoutKey(current[key], sessionId) }));
|
|
65
|
+
return signals;
|
|
66
|
+
}
|
|
67
|
+
var composerChannels = {
|
|
68
|
+
getState: () => state,
|
|
69
|
+
addTopicAssetReference(sessionId, ref) {
|
|
70
|
+
setState((current) => ({ ...current, topicAssetReferences: { ...current.topicAssetReferences, [sessionId]: normalizeTopicAssetRefs([...current.topicAssetReferences[sessionId] ?? [], ref]) } }));
|
|
71
|
+
},
|
|
72
|
+
consumeTopicAssetReferences: (sessionId) => consume("topicAssetReferences", sessionId),
|
|
73
|
+
subscribe(listener) {
|
|
74
|
+
listeners.add(listener);
|
|
75
|
+
return () => {
|
|
76
|
+
listeners.delete(listener);
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
addPendingContext(sessionId, context) {
|
|
80
|
+
setState((current) => ({
|
|
81
|
+
...current,
|
|
82
|
+
pendingContexts: {
|
|
83
|
+
...current.pendingContexts,
|
|
84
|
+
[sessionId]: [
|
|
85
|
+
...current.pendingContexts[sessionId] ?? [],
|
|
86
|
+
{ id: buildSignalId(), label: context.label, content: context.content, imageUrl: context.imageUrl }
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
},
|
|
91
|
+
removePendingContext(sessionId, contextId) {
|
|
92
|
+
setState((current) => {
|
|
93
|
+
const contexts = current.pendingContexts[sessionId];
|
|
94
|
+
if (!contexts?.length) return current;
|
|
95
|
+
const next = contexts.filter((context) => context.id !== contextId);
|
|
96
|
+
if (next.length === contexts.length) return current;
|
|
97
|
+
return {
|
|
98
|
+
...current,
|
|
99
|
+
pendingContexts: next.length > 0 ? { ...current.pendingContexts, [sessionId]: next } : withoutKey(current.pendingContexts, sessionId)
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
consumePendingContexts: (sessionId) => consume("pendingContexts", sessionId),
|
|
104
|
+
clearPendingContexts(sessionId) {
|
|
105
|
+
setState((current) => ({ ...current, pendingContexts: withoutKey(current.pendingContexts, sessionId) }));
|
|
106
|
+
},
|
|
107
|
+
addDraftAppend(sessionId, text, separate) {
|
|
108
|
+
setState((current) => ({
|
|
109
|
+
...current,
|
|
110
|
+
draftAppends: {
|
|
111
|
+
...current.draftAppends,
|
|
112
|
+
[sessionId]: [...current.draftAppends[sessionId] ?? [], { id: buildSignalId(), text, separate }]
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
},
|
|
116
|
+
consumeDraftAppends: (sessionId) => consume("draftAppends", sessionId),
|
|
117
|
+
clearDraftAppends(sessionId) {
|
|
118
|
+
setState((current) => ({ ...current, draftAppends: withoutKey(current.draftAppends, sessionId) }));
|
|
119
|
+
},
|
|
120
|
+
addSendRequest(sessionId) {
|
|
121
|
+
setState((current) => ({
|
|
122
|
+
...current,
|
|
123
|
+
sendRequests: {
|
|
124
|
+
...current.sendRequests,
|
|
125
|
+
[sessionId]: [...current.sendRequests[sessionId] ?? [], { id: buildSignalId() }]
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
},
|
|
129
|
+
consumeSendRequests: (sessionId) => consume("sendRequests", sessionId),
|
|
130
|
+
clearSendRequests(sessionId) {
|
|
131
|
+
setState((current) => ({ ...current, sendRequests: withoutKey(current.sendRequests, sessionId) }));
|
|
132
|
+
},
|
|
133
|
+
setModelDraft(sessionId, model) {
|
|
134
|
+
setState(
|
|
135
|
+
(current) => current.modelDrafts[sessionId] === model ? current : { ...current, modelDrafts: { ...current.modelDrafts, [sessionId]: model } }
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
clearModelDraft(sessionId) {
|
|
139
|
+
setState((current) => ({ ...current, modelDrafts: withoutKey(current.modelDrafts, sessionId) }));
|
|
140
|
+
},
|
|
141
|
+
setRewindDraft(sessionId, text) {
|
|
142
|
+
setState(
|
|
143
|
+
(current) => text === null ? { ...current, rewindDrafts: withoutKey(current.rewindDrafts, sessionId) } : { ...current, rewindDrafts: { ...current.rewindDrafts, [sessionId]: text } }
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
clearSession(sessionId) {
|
|
147
|
+
setState((current) => ({
|
|
148
|
+
...current,
|
|
149
|
+
topicAssetReferences: withoutKey(current.topicAssetReferences, sessionId),
|
|
150
|
+
pendingContexts: withoutKey(current.pendingContexts, sessionId),
|
|
151
|
+
draftAppends: withoutKey(current.draftAppends, sessionId),
|
|
152
|
+
sendRequests: withoutKey(current.sendRequests, sessionId)
|
|
153
|
+
}));
|
|
154
|
+
},
|
|
155
|
+
reset() {
|
|
156
|
+
setState(() => ({ topicAssetReferences: {}, pendingContexts: {}, draftAppends: {}, sendRequests: {}, modelDrafts: {}, rewindDrafts: {} }));
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
function useComposerChannels(selector) {
|
|
160
|
+
return useSyncExternalStore(
|
|
161
|
+
composerChannels.subscribe,
|
|
162
|
+
() => selector(state),
|
|
163
|
+
() => selector(state)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/chat/lib/skill-name.ts
|
|
168
|
+
function skillDisplayName(skill) {
|
|
169
|
+
const displayName = (skill.display_name ?? skill.displayName ?? "").trim();
|
|
170
|
+
if (displayName) {
|
|
171
|
+
return displayName;
|
|
172
|
+
}
|
|
173
|
+
return (skill.skill_id ?? skill.skillId ?? "").trim();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/chat/runtime/background-task-dismissals.ts
|
|
177
|
+
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
178
|
+
var state2 = {};
|
|
179
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
180
|
+
var NO_IDS = [];
|
|
181
|
+
function emit() {
|
|
182
|
+
for (const listener of [...listeners2]) listener();
|
|
183
|
+
}
|
|
184
|
+
var backgroundTaskDismissals = {
|
|
185
|
+
getState: () => state2,
|
|
186
|
+
subscribe(listener) {
|
|
187
|
+
listeners2.add(listener);
|
|
188
|
+
return () => {
|
|
189
|
+
listeners2.delete(listener);
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
dismiss(sessionId, taskId) {
|
|
193
|
+
const existing = state2[sessionId] ?? [];
|
|
194
|
+
if (existing.includes(taskId)) return;
|
|
195
|
+
state2 = { ...state2, [sessionId]: [...existing, taskId] };
|
|
196
|
+
emit();
|
|
197
|
+
},
|
|
198
|
+
reset() {
|
|
199
|
+
state2 = {};
|
|
200
|
+
emit();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function useDismissedBackgroundTasks(sessionId) {
|
|
204
|
+
return useSyncExternalStore2(
|
|
205
|
+
backgroundTaskDismissals.subscribe,
|
|
206
|
+
() => state2[sessionId] ?? NO_IDS,
|
|
207
|
+
() => state2[sessionId] ?? NO_IDS
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/chat/lib/skill-visibility.ts
|
|
212
|
+
function visibleSkills(skills, mode) {
|
|
213
|
+
return mode === "developer" ? skills : skills.filter((skill) => !skill.builtin);
|
|
214
|
+
}
|
|
215
|
+
function visibleSkillIds(ids, catalog, mode) {
|
|
216
|
+
if (mode === "developer") return [...ids];
|
|
217
|
+
if (!catalog) return [];
|
|
218
|
+
const builtins = new Set(catalog.filter((skill) => skill.builtin).map((skill) => skill.skill_id));
|
|
219
|
+
return ids.filter((id) => !builtins.has(id));
|
|
220
|
+
}
|
|
30
221
|
|
|
31
222
|
// src/components/connector-panel-types.ts
|
|
32
223
|
function selectionFromItem(item) {
|
|
@@ -52,7 +243,7 @@ import { isLocalConnectorName } from "@blade-hq/agent-client/internal";
|
|
|
52
243
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
53
244
|
import { Suspense, lazy } from "react";
|
|
54
245
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
55
|
-
var SessionPluginConfigForm = lazy(() => import("./SessionPluginConfigForm-
|
|
246
|
+
var SessionPluginConfigForm = lazy(() => import("./SessionPluginConfigForm-Y657MKRX.js").then((module) => ({ default: module.SessionPluginConfigForm })));
|
|
56
247
|
var actionBaseClass = "inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--background))] text-xs font-medium text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))] focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50";
|
|
57
248
|
var actionClass = `${actionBaseClass} px-3`;
|
|
58
249
|
var iconActionClass = `${actionBaseClass} w-8 p-0`;
|
|
@@ -597,6 +788,13 @@ function PluginTriggerStack({ client, sessionId, summary, className }) {
|
|
|
597
788
|
}
|
|
598
789
|
|
|
599
790
|
export {
|
|
791
|
+
composerChannels,
|
|
792
|
+
useComposerChannels,
|
|
793
|
+
skillDisplayName,
|
|
794
|
+
backgroundTaskDismissals,
|
|
795
|
+
useDismissedBackgroundTasks,
|
|
796
|
+
visibleSkills,
|
|
797
|
+
visibleSkillIds,
|
|
600
798
|
selectionFromItem,
|
|
601
799
|
TRIGGER_ICON_LIMIT,
|
|
602
800
|
triggerSummary,
|
|
@@ -604,4 +802,4 @@ export {
|
|
|
604
802
|
ConnectorPanel,
|
|
605
803
|
PluginTriggerStack
|
|
606
804
|
};
|
|
607
|
-
//# sourceMappingURL=chunk-
|
|
805
|
+
//# sourceMappingURL=chunk-5UGLGKFI.js.map
|