@blade-hq/agent-react 2610.0.0-beta.7 → 2610.0.0-beta.70
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 +148 -3
- package/dist/chunk-G3PMV62Z.js +36 -0
- package/dist/{chunk-ZXXLY4RM.js → chunk-MAAMCOAU.js} +8 -32
- package/dist/{chunk-ZXXLY4RM.js.map → chunk-MAAMCOAU.js.map} +1 -1
- package/dist/components/AgentChat.d.ts +3 -0
- package/dist/components/AgentLoopBlock.d.ts +1 -4
- package/dist/components/AskUserQuestionBlock.d.ts +9 -0
- package/dist/components/AssistantTurnBlock.d.ts +20 -6
- package/dist/components/ChatInput.d.ts +15 -1
- package/dist/components/ChatSurface.d.ts +29 -2
- package/dist/components/ConnectorPanel.d.ts +41 -0
- package/dist/components/ContextCard.d.ts +20 -0
- package/dist/components/MarkdownContent.d.ts +2 -0
- package/dist/components/McpAppCard.d.ts +14 -0
- package/dist/components/MessageList.d.ts +26 -1
- package/dist/components/PlanUpdateBlock.d.ts +31 -0
- package/dist/components/PluginConnectorList.d.ts +47 -0
- package/dist/components/PluginTriggerStack.d.ts +22 -0
- package/dist/components/SessionMemoryToggle.d.ts +19 -0
- package/dist/components/SessionPluginConfigDialog.d.ts +10 -0
- package/dist/components/SessionPluginConfigForm.d.ts +14 -0
- package/dist/components/SessionPluginIcon.d.ts +30 -0
- package/dist/components/SessionPluginSelector.d.ts +10 -0
- package/dist/components/SessionQueuePanel.d.ts +74 -0
- package/dist/components/ToolCallBlock.d.ts +4 -2
- package/dist/components/ToolUiCardView.d.ts +9 -0
- package/dist/components/UserMessageBubble.d.ts +1 -1
- package/dist/components/WhatIfUserBubble.d.ts +7 -0
- package/dist/components/connector-panel-types.d.ts +37 -0
- package/dist/components/display-utils.d.ts +10 -0
- package/dist/components/plugin-config-draft.d.ts +13 -0
- package/dist/components/plugin-config-schema.d.ts +6 -0
- package/dist/components/plugin-connector.d.ts +40 -0
- package/dist/components/queue-panel-adjacency.d.ts +1 -0
- package/dist/components/use-session-plugin-activation.d.ts +40 -0
- package/dist/context.d.ts +1 -0
- package/dist/embed/entry.d.ts +46 -0
- package/dist/{highlighted-body-B3W2YXNL-YD7FAP6V.js → highlighted-body-B3W2YXNL-IASCZDV2.js} +3 -2
- package/dist/{highlighted-body-B3W2YXNL-YD7FAP6V.js.map → highlighted-body-B3W2YXNL-IASCZDV2.js.map} +1 -1
- package/dist/hooks/use-agent-session.d.ts +5 -0
- package/dist/hooks/use-message-pin.d.ts +28 -0
- package/dist/hooks/use-typewriter-reveal.d.ts +32 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +44786 -1663
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-computer-command.d.ts +34 -0
- package/dist/lib/random-id.d.ts +10 -0
- package/dist/lib/utils.d.ts +3 -1
- package/dist/lib/whatif-prompt.d.ts +18 -0
- package/dist/mermaid-3ZIDBTTL-BPVVWTVV.js +9 -0
- package/dist/mermaid-3ZIDBTTL-BPVVWTVV.js.map +1 -0
- package/dist/style.css +97 -5
- package/dist/style.full.css +98 -6
- package/dist/webapi-W3IB5DO4.js +2481 -0
- package/dist/webapi-W3IB5DO4.js.map +1 -0
- package/package.json +2 -2
- package/public-api.md +1287 -31
- package/dist/mermaid-3ZIDBTTL-N7YKJ3SM.js +0 -8
- /package/dist/{mermaid-3ZIDBTTL-N7YKJ3SM.js.map → chunk-G3PMV62Z.js.map} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PluginConnectorItem } from "./plugin-connector";
|
|
2
|
+
/**
|
|
3
|
+
* 首页选中的一个待选插件。
|
|
4
|
+
*
|
|
5
|
+
* 带上展示名和图标是为了两件事:后续的配置弹窗与失败提示能一直用业务名(只传技术
|
|
6
|
+
* ID 的话,用户在面板里看到「示例登录」、在弹窗标题里看到 `demo-login`,等于要他认
|
|
7
|
+
* 两遍),以及不用打开面板就能在触发器上看到自己选了什么。
|
|
8
|
+
*
|
|
9
|
+
* 技术 ID 仍是路径、授权、缓存与调用的权威。
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginConnectorSelection {
|
|
12
|
+
name: string;
|
|
13
|
+
displayName: string | null;
|
|
14
|
+
icon: string | null;
|
|
15
|
+
iconSource: PluginConnectorItem["iconSource"];
|
|
16
|
+
}
|
|
17
|
+
/** 面板一行 → 待选条目。 */
|
|
18
|
+
export declare function selectionFromItem(item: PluginConnectorItem): PluginConnectorSelection;
|
|
19
|
+
/** 触发器上最多直接显示几个插件头像,其余折成数量。 */
|
|
20
|
+
export declare const TRIGGER_ICON_LIMIT = 3;
|
|
21
|
+
/** 触发器上的头像堆叠内容:前三个 + 折起来的数量。 */
|
|
22
|
+
export interface TriggerSummary {
|
|
23
|
+
/** 前 TRIGGER_ICON_LIMIT 个选中项,**不管有没有图标 token**。 */
|
|
24
|
+
visible: Array<Pick<PluginConnectorSelection, "name" | "displayName" | "icon" | "iconSource">>;
|
|
25
|
+
/** 超出 TRIGGER_ICON_LIMIT 的数量;0 表示不显示 `+N`。 */
|
|
26
|
+
overflow: number;
|
|
27
|
+
/** 已选/已启用的总数,用于无障碍标签与提示。 */
|
|
28
|
+
total: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 把一份插件列表折成触发器上的头像堆叠。
|
|
32
|
+
*
|
|
33
|
+
* 前三项都占位,**不管有没有图标 token**:没有图标的用显示名首字起头的圆形占位,
|
|
34
|
+
* 「选了哪个」照样看得见。早先的实现把无图标的项从图标位里剔掉、还把它们算进
|
|
35
|
+
* `overflow`,于是选中一个没有图标的插件时触发器毫无变化——选择在入口上不可见。
|
|
36
|
+
*/
|
|
37
|
+
export declare function triggerSummary(items: Array<Pick<PluginConnectorSelection, "name" | "displayName" | "icon" | "iconSource">>): TriggerSummary;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { ToolCallInfo } from "@blade-hq/agent-client";
|
|
2
2
|
export type ToolTone = "emerald" | "blue" | "amber" | "red";
|
|
3
|
+
/**
|
|
4
|
+
* 技能入口文件的所在目录就是技能名(`.agent/skills/<技能名>/SKILL.md`)。
|
|
5
|
+
* 只显示 "SKILL.md" 用户看不出读的是哪个技能。
|
|
6
|
+
*
|
|
7
|
+
* 改这里必须同步 apps/web/src/agent/components/chat/display-utils.ts 的同名函数。
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSkillNameFromFilePath(filePath: string | null | undefined): string | null;
|
|
3
10
|
/** 归一化工具名:去掉命名空间前缀并映射到别名表(如 "fork:Agent" → "Agent")。 */
|
|
4
11
|
export declare function formatToolName(name: string): string;
|
|
12
|
+
export declare function extractToolFilePath(toolCall: ToolCallInfo): string | null;
|
|
13
|
+
/** 从文件类工具参数中提取全部可定位的文件路径(按出现顺序去重)。 */
|
|
14
|
+
export declare function extractToolFilePaths(toolCall: ToolCallInfo): string[];
|
|
5
15
|
/**
|
|
6
16
|
* 返回工具调用的中文展示标签:优先取参数里的 description,
|
|
7
17
|
* 其次取后端下发的 display_name / 系统工具中文名。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SessionPluginConfigSet, SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
export type ConfigPath = (string | number)[];
|
|
3
|
+
export type ConfigValues = Record<string, unknown>;
|
|
4
|
+
export declare function createConfigDraft(config: SessionPluginConfigState): {
|
|
5
|
+
values: ConfigValues;
|
|
6
|
+
retained: Map<string, string>;
|
|
7
|
+
};
|
|
8
|
+
/** Array edits address the original indices because the API applies sets before removals. */
|
|
9
|
+
export declare function originalConfigPath(path: ConfigPath, removed: Set<string>): ConfigPath;
|
|
10
|
+
export declare function configDraftOperations(initial: ConfigValues, values: ConfigValues, retained: Map<string, string>, removed: Set<string>): {
|
|
11
|
+
set: SessionPluginConfigSet[];
|
|
12
|
+
remove: string[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
export type JsonSchema = Record<string, unknown>;
|
|
3
|
+
export declare function pointerOf(parts: (string | number)[]): string;
|
|
4
|
+
export declare function pointerParts(pointer: string): string[];
|
|
5
|
+
export declare function formSupport(schema: JsonSchema | null): string | null;
|
|
6
|
+
export declare function configIsEditable(state: SessionPluginConfigState): boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PluginCatalogEntry, SessionPlugin, SessionPluginConfigSummary } from "@blade-hq/agent-client";
|
|
2
|
+
/**
|
|
3
|
+
* 连接器面板里的一行插件。
|
|
4
|
+
*
|
|
5
|
+
* 展示字段(名称、图标)和启用状态分开表达:目录接口在没有会话时也能给出名称与
|
|
6
|
+
* 图标,而「这次会话是否启用」只有会话接口知道。首页候选行恒为 `active: false`,
|
|
7
|
+
* 因为它只是待选,不代表已经激活。
|
|
8
|
+
*/
|
|
9
|
+
export interface PluginConnectorItem {
|
|
10
|
+
name: string;
|
|
11
|
+
display_name: string | null;
|
|
12
|
+
/** 图标 token;null 时显示统一占位,不隐藏整行。 */
|
|
13
|
+
icon: string | null;
|
|
14
|
+
/** 图标从哪个接口取:账号级目录,还是会话内已准备的包。 */
|
|
15
|
+
iconSource: "account" | "session";
|
|
16
|
+
installed: boolean | null;
|
|
17
|
+
/** 会话里已提交的选择;首页候选恒为 false。 */
|
|
18
|
+
active: boolean;
|
|
19
|
+
status: string;
|
|
20
|
+
reason?: string | null;
|
|
21
|
+
config?: SessionPluginConfigSummary;
|
|
22
|
+
projected: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** 首页候选:只有账号级目录,没有会话状态。 */
|
|
25
|
+
export declare function catalogToConnectorItems(catalog: PluginCatalogEntry[]): PluginConnectorItem[];
|
|
26
|
+
/**
|
|
27
|
+
* 会话列表叠加账号目录。
|
|
28
|
+
*
|
|
29
|
+
* 目录可用时展示字段以目录为准(包可能还没准备,会话列表拿不到名称和图标),
|
|
30
|
+
* 目录不可用时退回会话行自己的字段,这样已选插件仍然可以取消。
|
|
31
|
+
*/
|
|
32
|
+
export declare function mergeConnectorItems(sessionPlugins: SessionPlugin[], catalog: PluginCatalogEntry[] | null): PluginConnectorItem[];
|
|
33
|
+
/**
|
|
34
|
+
* 一行的配置说明文案;权威状态来自配置接口。
|
|
35
|
+
*
|
|
36
|
+
* `unchecked` 刻意没有文案:列表没有读过用户的 Home,说任何话都是噪音,
|
|
37
|
+
* 入口是开关本身。
|
|
38
|
+
*/
|
|
39
|
+
/** 按名称和显示名做本地过滤;空查询返回全部。 */
|
|
40
|
+
export declare function filterConnectorItems(items: PluginConnectorItem[], query: string): PluginConnectorItem[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const QueuePanelAdjacencyContext: import("react").Context<boolean | null>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BladeClient, SessionPluginActivation, SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
import type { ConfiguringPlugin } from "./PluginConnectorList";
|
|
3
|
+
import { type PluginConnectorItem } from "./plugin-connector";
|
|
4
|
+
export interface UseSessionPluginActivationResult {
|
|
5
|
+
items: PluginConnectorItem[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
/** 插件列表本身读不到(Hub 不可用等),已有选择仍然可取消。 */
|
|
8
|
+
listError: boolean;
|
|
9
|
+
/** 某次启用/停用/准备失败了。 */
|
|
10
|
+
mutationError: boolean;
|
|
11
|
+
/** 正在为哪些插件提交意图;对应的开关在转圈,但仍然可点(点是取消)。 */
|
|
12
|
+
inFlight: Record<string, true>;
|
|
13
|
+
busy: boolean;
|
|
14
|
+
configuring: ConfiguringPlugin | null;
|
|
15
|
+
reload: () => void;
|
|
16
|
+
toggle: (item: PluginConnectorItem, next: boolean) => void;
|
|
17
|
+
retry: (item: PluginConnectorItem) => void;
|
|
18
|
+
editConfig: (item: PluginConnectorItem) => void;
|
|
19
|
+
onConfigSaved: (state: SessionPluginConfigState) => void;
|
|
20
|
+
onConfigClose: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 会话内插件启用的唯一实现。
|
|
24
|
+
*
|
|
25
|
+
* 顺序是「先准备配置,再提交 activation」:缺配置时开关不落到已启用、立刻弹表单,
|
|
26
|
+
* 保存成功才提交;取消、校验失败、配置读取失败都不提交。绝不先持久化 active=true
|
|
27
|
+
* 再靠补偿关掉——那样用户下次刷新会看到一个从没被成功打开的插件。
|
|
28
|
+
*
|
|
29
|
+
* 停用仍然直接提交:在服务端它只是取消一条数据库选择,不准备包、不连 MCP。但如果
|
|
30
|
+
* 这次「启用」只是还在准备、压根没提交过 activation,取消就只是放弃本地意图。
|
|
31
|
+
*
|
|
32
|
+
* 所有异步响应都按 (lifetime, mutation) 校验:迟到的准备或激活结果不会把已经取消 /
|
|
33
|
+
* 已经切走会话的插件重新打开;反过来,旧响应发现服务端落库顺序与用户最新意图不同时,
|
|
34
|
+
* 会重新提交最新意图。
|
|
35
|
+
*/
|
|
36
|
+
export declare function useSessionPluginActivation({ client, sessionId, onChange, }: {
|
|
37
|
+
client: BladeClient;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
onChange?: (plugin: SessionPluginActivation) => void;
|
|
40
|
+
}): UseSessionPluginActivationResult;
|
package/dist/context.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export interface BladeProviderProps {
|
|
|
11
11
|
export declare function BladeProvider({ client, children }: BladeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
/** 读取当前 BladeProvider 提供的 client。不在 Provider 内使用时抛错。 */
|
|
13
13
|
export declare function useBladeClient(): BladeClient;
|
|
14
|
+
export declare function useOptionalBladeClient(): BladeClient | null;
|
package/dist/embed/entry.d.ts
CHANGED
|
@@ -18,19 +18,45 @@ declare function getChat(element: Element | null): Promise<AgentSession>;
|
|
|
18
18
|
declare const BladeAgent: {
|
|
19
19
|
BladeClient: typeof agentClient.BladeClient;
|
|
20
20
|
BladeApiError: typeof agentClient.BladeApiError;
|
|
21
|
+
PollingBackoff: typeof agentClient.PollingBackoff;
|
|
22
|
+
EMPTY_PLATFORM_ENDPOINTS: agentClient.PlatformEndpoints;
|
|
23
|
+
loadPlatformEndpoints: typeof agentClient.loadPlatformEndpoints;
|
|
24
|
+
resolveServiceUrl: typeof agentClient.resolveServiceUrl;
|
|
21
25
|
SDK_NAME: "agent-client";
|
|
22
26
|
SDK_VERSION: string;
|
|
23
27
|
AgentSession: typeof AgentSession;
|
|
24
28
|
SessionHub: typeof agentClient.SessionHub;
|
|
29
|
+
isMcpAppData: typeof agentClient.isMcpAppData;
|
|
25
30
|
SessionSetupError: typeof agentClient.SessionSetupError;
|
|
26
31
|
createInitialSessionState: typeof agentClient.createInitialSessionState;
|
|
32
|
+
reconcileHistoricalUserTurns: typeof agentClient.reconcileHistoricalUserTurns;
|
|
27
33
|
reconcileOptimisticUserTurns: typeof agentClient.reconcileOptimisticUserTurns;
|
|
28
34
|
toReplaySnapshot: typeof agentClient.toReplaySnapshot;
|
|
35
|
+
EMPTY_SESSION_QUEUE: agentClient.SessionQueueSnapshot;
|
|
36
|
+
canCancelQueuedMessage: typeof agentClient.canCancelQueuedMessage;
|
|
37
|
+
canDeliverQueuedMessage: typeof agentClient.canDeliverQueuedMessage;
|
|
38
|
+
canEditQueuedMessage: typeof agentClient.canEditQueuedMessage;
|
|
39
|
+
isSessionQueueSnapshot: typeof agentClient.isSessionQueueSnapshot;
|
|
40
|
+
parseQueueAck: typeof agentClient.parseQueueAck;
|
|
41
|
+
queuePauseReasonLabel: typeof agentClient.queuePauseReasonLabel;
|
|
42
|
+
queuedMessageStatusLabel: typeof agentClient.queuedMessageStatusLabel;
|
|
43
|
+
shouldApplySnapshot: typeof agentClient.shouldApplySnapshot;
|
|
29
44
|
connectEmbedded: typeof agentClient.connectEmbedded;
|
|
30
45
|
isCommandEnvelope: typeof agentClient.isCommandEnvelope;
|
|
31
46
|
isInboundEnvelope: typeof agentClient.isInboundEnvelope;
|
|
47
|
+
ComputersResource: typeof agentClient.ComputersResource;
|
|
48
|
+
canToggleComputer: typeof agentClient.canToggleComputer;
|
|
49
|
+
computerDaemonVersion: typeof agentClient.computerDaemonVersion;
|
|
50
|
+
computerOS: typeof agentClient.computerOS;
|
|
51
|
+
computerPlatformLabel: typeof agentClient.computerPlatformLabel;
|
|
52
|
+
computerState: typeof agentClient.computerState;
|
|
53
|
+
sortComputers: typeof agentClient.sortComputers;
|
|
32
54
|
ModelsResource: typeof agentClient.ModelsResource;
|
|
55
|
+
ChatGroupsResource: typeof agentClient.ChatGroupsResource;
|
|
56
|
+
PluginsResource: typeof agentClient.PluginsResource;
|
|
57
|
+
hasChatRunEvent: typeof agentClient.hasChatRunEvent;
|
|
33
58
|
buildMessageContent: typeof agentClient.buildMessageContent;
|
|
59
|
+
chatErrorForDisplay: typeof agentClient.chatErrorForDisplay;
|
|
34
60
|
contentPreview: typeof agentClient.contentPreview;
|
|
35
61
|
extractTextAttachments: typeof agentClient.extractTextAttachments;
|
|
36
62
|
getFileParts: typeof agentClient.getFileParts;
|
|
@@ -40,7 +66,20 @@ declare const BladeAgent: {
|
|
|
40
66
|
isHiddenInternalMessage: typeof agentClient.isHiddenInternalMessage;
|
|
41
67
|
normalizeMessageContent: typeof agentClient.normalizeMessageContent;
|
|
42
68
|
transformSlashCommand: typeof agentClient.transformSlashCommand;
|
|
69
|
+
contextProjectionData: typeof agentClient.contextProjectionData;
|
|
70
|
+
getContextDisplayState: typeof agentClient.getContextDisplayState;
|
|
71
|
+
getContextGroupDisplayState: typeof agentClient.getContextGroupDisplayState;
|
|
72
|
+
groupAdjacentContextRuns: typeof agentClient.groupAdjacentContextRuns;
|
|
43
73
|
latestPostChatFollowup: typeof agentClient.latestPostChatFollowup;
|
|
74
|
+
buildToolUiCardKey: typeof agentClient.buildToolUiCardKey;
|
|
75
|
+
collectInlineToolUiCards: typeof agentClient.collectInlineToolUiCards;
|
|
76
|
+
collectPreviewToolUiCards: typeof agentClient.collectPreviewToolUiCards;
|
|
77
|
+
isAppDevToolUiCard: typeof agentClient.isAppDevToolUiCard;
|
|
78
|
+
isInternalStatusToolUiCard: typeof agentClient.isInternalStatusToolUiCard;
|
|
79
|
+
isToolUiCard: typeof agentClient.isToolUiCard;
|
|
80
|
+
resolveToolUiCardContent: typeof agentClient.resolveToolUiCardContent;
|
|
81
|
+
prependOlder: typeof agentClient.prependOlder;
|
|
82
|
+
replaceWindow: typeof agentClient.replaceWindow;
|
|
44
83
|
DEFAULT_REPLAY_SPEED: agentClient.ReplaySpeed;
|
|
45
84
|
SessionInfo: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
46
85
|
id: string;
|
|
@@ -71,7 +110,11 @@ declare const BladeAgent: {
|
|
|
71
110
|
disable_tools?: string[] | undefined;
|
|
72
111
|
runtime_type?: string | null | undefined;
|
|
73
112
|
daemon_id?: string | null | undefined;
|
|
113
|
+
agent_runtime_id?: string | null | undefined;
|
|
74
114
|
workspace_path?: string | null | undefined;
|
|
115
|
+
ba_version?: string | null | undefined;
|
|
116
|
+
sandbox_version?: string | null | undefined;
|
|
117
|
+
chat_group_id?: string | null | undefined;
|
|
75
118
|
match?: unknown;
|
|
76
119
|
}, {}>;
|
|
77
120
|
SessionStatus: import("arktype/internal/variants/string.ts").StringType<"completed" | "created" | "failed" | "interrupted" | "running" | "waiting_for_input", {}>;
|
|
@@ -87,7 +130,10 @@ declare const BladeAgent: {
|
|
|
87
130
|
}, {}>;
|
|
88
131
|
TaskStatus: import("arktype/internal/variants/string.ts").StringType<"done" | "failed" | "in_progress" | "pending" | "skipped", {}>;
|
|
89
132
|
acceptedPostChatFollowupCompletesLatestRun: typeof agentClient.acceptedPostChatFollowupCompletesLatestRun;
|
|
133
|
+
acknowledgeTurnEvents: typeof agentClient.acknowledgeTurnEvents;
|
|
90
134
|
ClientProjectionBuilder: typeof agentClient.ClientProjectionBuilder;
|
|
135
|
+
AuthBusyReconnect: typeof agentClient.AuthBusyReconnect;
|
|
136
|
+
authBusyRetryDelayMs: typeof agentClient.authBusyRetryDelayMs;
|
|
91
137
|
createSocket: typeof agentClient.createSocket;
|
|
92
138
|
getChat: typeof getChat;
|
|
93
139
|
BladeChatElement: typeof BladeChatElement;
|
package/dist/{highlighted-body-B3W2YXNL-YD7FAP6V.js → highlighted-body-B3W2YXNL-IASCZDV2.js}
RENAMED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
Ks,
|
|
4
4
|
Qe,
|
|
5
5
|
R
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MAAMCOAU.js";
|
|
7
|
+
import "./chunk-G3PMV62Z.js";
|
|
7
8
|
|
|
8
9
|
// ../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js
|
|
9
10
|
import { useContext, useState, useEffect } from "react";
|
|
@@ -24,4 +25,4 @@ var L = ({ code: s, language: t, raw: e, className: n, ...d$1 }) => {
|
|
|
24
25
|
export {
|
|
25
26
|
L as HighlightedCodeBlockBody
|
|
26
27
|
};
|
|
27
|
-
//# sourceMappingURL=highlighted-body-B3W2YXNL-
|
|
28
|
+
//# sourceMappingURL=highlighted-body-B3W2YXNL-IASCZDV2.js.map
|
package/dist/{highlighted-body-B3W2YXNL-YD7FAP6V.js.map → highlighted-body-B3W2YXNL-IASCZDV2.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js"],"sourcesContent":["\"use client\";\nimport {k,d,c}from'./chunk-RLXIAIE6.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var L=({code:s,language:t,raw:e,className:n,...d$1})=>{let{shikiTheme:l}=useContext(k),o=d(),[m,i]=useState(e);return useEffect(()=>{if(!o){i(e);return}let g=o.highlight({code:s,language:t,themes:l},p=>{i(p);});g&&i(g);},[s,t,l,o,e]),jsx(c,{className:n,language:t,result:m,...d$1})};export{L as HighlightedCodeBlockBody};"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/streamdown@2.3.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js"],"sourcesContent":["\"use client\";\nimport {k,d,c}from'./chunk-RLXIAIE6.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var L=({code:s,language:t,raw:e,className:n,...d$1})=>{let{shikiTheme:l}=useContext(k),o=d(),[m,i]=useState(e);return useEffect(()=>{if(!o){i(e);return}let g=o.highlight({code:s,language:t,themes:l},p=>{i(p);});g&&i(g);},[s,t,l,o,e]),jsx(c,{className:n,language:t,result:m,...d$1})};export{L as HighlightedCodeBlockBody};"],"mappings":";;;;;;;;;AACwC,SAAQ,YAAW,UAAS,iBAAc;AAAQ,SAAQ,WAAQ;AAAoB,IAAI,IAAE,CAAC,EAAC,MAAK,GAAE,UAAS,GAAE,KAAI,GAAE,WAAU,GAAE,GAAG,IAAG,MAAI;AAAC,MAAG,EAAC,YAAW,EAAC,IAAE,WAAW,CAAC,GAAE,IAAE,GAAE,GAAE,CAAC,GAAE,CAAC,IAAE,SAAS,CAAC;AAAE,SAAO,UAAU,MAAI;AAAC,QAAG,CAAC,GAAE;AAAC,QAAE,CAAC;AAAE;AAAA,IAAM;AAAC,QAAI,IAAE,EAAE,UAAU,EAAC,MAAK,GAAE,UAAS,GAAE,QAAO,EAAC,GAAE,OAAG;AAAC,QAAE,CAAC;AAAA,IAAE,CAAC;AAAE,SAAG,EAAE,CAAC;AAAA,EAAE,GAAE,CAAC,GAAE,GAAE,GAAE,GAAE,CAAC,CAAC,GAAE,IAAI,IAAE,EAAC,WAAU,GAAE,UAAS,GAAE,QAAO,GAAE,GAAG,IAAG,CAAC;AAAC;","names":[]}
|
|
@@ -4,6 +4,11 @@ export interface UseAgentSessionOptions {
|
|
|
4
4
|
createOptions?: CreateSessionRequest;
|
|
5
5
|
/** 自动创建出的 sessionId 通过此回调交还调用方持有(重挂载复用的依据)。 */
|
|
6
6
|
onSessionCreated?: (sessionId: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 会话进入实时事件路由后、历史加载与房间订阅开始前同步执行。
|
|
9
|
+
* 返回的清理函数会在切换会话或卸载时执行。
|
|
10
|
+
*/
|
|
11
|
+
onSessionConnected?: (session: AgentSession) => () => void;
|
|
7
12
|
}
|
|
8
13
|
export interface UseAgentSessionResult {
|
|
9
14
|
/** 连接/创建完成前为 null。 */
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface UseMessagePinOptions {
|
|
2
|
+
targetKey: string | null;
|
|
3
|
+
pinTarget: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* 省略时按旧行为处理(视为一直流式中,只靠 targetKey 变化释放)——
|
|
6
|
+
* useMessagePin 是导出的公开 hook,加这个字段前如果直接改成必填,
|
|
7
|
+
* 所有已经在调用这个 hook 的外部使用方都会编译不过。
|
|
8
|
+
*/
|
|
9
|
+
isStreaming?: boolean;
|
|
10
|
+
layoutKey?: string;
|
|
11
|
+
getScrollElement: () => HTMLElement | null;
|
|
12
|
+
getContentElement?: () => HTMLElement | null;
|
|
13
|
+
getTargetElement: () => HTMLElement | null;
|
|
14
|
+
getTargetScrollTop?: (scroll: HTMLElement) => number | null;
|
|
15
|
+
getSpacerHeight: () => number;
|
|
16
|
+
setSpacerHeight: (height: number) => void;
|
|
17
|
+
stopAutoScroll: () => void;
|
|
18
|
+
scrollToBottom: () => void;
|
|
19
|
+
margin?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 用户发言顶置的共享状态机。SDK 和内置轻量列表只提供 DOM/虚拟列表适配器,
|
|
23
|
+
* 触发、调度、resize、手动接管和跟随交还的决策只在这里维护。
|
|
24
|
+
*/
|
|
25
|
+
export declare function useMessagePin({ targetKey, pinTarget, isStreaming, layoutKey, getScrollElement, getContentElement, getTargetElement, getTargetScrollTop, getSpacerHeight, setSpacerHeight, stopAutoScroll, scrollToBottom, margin, }: UseMessagePinOptions): {
|
|
26
|
+
release: () => void;
|
|
27
|
+
isActive: () => boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface UseTypewriterRevealResult {
|
|
2
|
+
/** 当前应该渲染的文字——被截断到"已显示长度",不是目标全文。 */
|
|
3
|
+
displayedText: string;
|
|
4
|
+
/** 缓冲池是否还没追平目标全文;跟 isStreaming 做 || 判断输入框状态用。 */
|
|
5
|
+
isRevealing: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 立即把 displayedText 设成当前目标全文、取消播放循环——用户主动点了
|
|
8
|
+
* 停止,或者这一路因为中断/出错结束时调用。到达的内容不能丢,只是不再
|
|
9
|
+
* 需要"看起来在打字"这个动画效果。
|
|
10
|
+
*/
|
|
11
|
+
flushNow: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 打字机式显示节流:服务端到达速率天然不均匀(一次推 5 个字、一次推 20
|
|
15
|
+
* 个字),直接原样渲染会显得忽快忽慢。按估算到达速度、留一个很小的固定
|
|
16
|
+
* 滞后量匀速播放 targetText。
|
|
17
|
+
*
|
|
18
|
+
* 纯渲染层的本地播放状态,不触碰 AgentSession/chat-store 的任何内部状态——
|
|
19
|
+
* 调用方从各自现有的、没有改动过的数据里取 targetText,这里只负责"这一帧
|
|
20
|
+
* 该显示到第几个字"。
|
|
21
|
+
*
|
|
22
|
+
* @param targetText 当前已到达的完整(未截断)文本。
|
|
23
|
+
* @param isLive 是否是真正的实时直播(不是历史加载 / rewind / replay)——
|
|
24
|
+
* 非直播场景永远整段直接显示,这是"流式与历史必须产生相同结果"这条硬
|
|
25
|
+
* 规则唯一允许的例外,只在真正的实时直播里生效。
|
|
26
|
+
* @param resetKey 标识"这是哪一段正在增长的内容"(比如 turn_id 或者
|
|
27
|
+
* `${turnId}:${blockIndex}`)——变化时说明换了一段全新的内容(比如上一个
|
|
28
|
+
* block 已经交付完、轮到下一个 block 在长,或者切到了新的一轮),播放
|
|
29
|
+
* 状态要重新从头开始,不能带着上一段的进度继续,否则会出现"从上一段的
|
|
30
|
+
* 长度往下掉"这种回退闪烁。
|
|
31
|
+
*/
|
|
32
|
+
export declare function useTypewriterReveal(targetText: string, isLive: boolean, resetKey: string | null): UseTypewriterRevealResult;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,19 +5,62 @@ export type { UseAgentSessionOptions, UseAgentSessionResult } from "./hooks/use-
|
|
|
5
5
|
export { useReplay } from "./hooks/use-replay";
|
|
6
6
|
export type { ReplayMismatch, UseReplayResult } from "./hooks/use-replay";
|
|
7
7
|
export { useLlmChat } from "./hooks/use-llm-chat";
|
|
8
|
+
export { useMessagePin } from "./hooks/use-message-pin";
|
|
9
|
+
export type { UseMessagePinOptions } from "./hooks/use-message-pin";
|
|
10
|
+
export { useTypewriterReveal } from "./hooks/use-typewriter-reveal";
|
|
11
|
+
export type { UseTypewriterRevealResult } from "./hooks/use-typewriter-reveal";
|
|
8
12
|
export type { ChatCompletionTool, LlmChatOptions, LlmToolCall, UseLlmChatResult, } from "./hooks/use-llm-chat";
|
|
9
13
|
export { ChatView } from "./components/ChatView";
|
|
10
14
|
export type { ChatViewClassNames, ChatViewProps, ChatViewRenderers, ChatViewSlots, FollowupInteractionEvent, } from "./components/ChatView";
|
|
15
|
+
export { ConnectorPanel } from "./components/ConnectorPanel";
|
|
16
|
+
export type { ConnectorPanelProps } from "./components/ConnectorPanel";
|
|
17
|
+
export { PluginConnectorList } from "./components/PluginConnectorList";
|
|
18
|
+
export type { ConfiguringPlugin, PluginConnectorListProps } from "./components/PluginConnectorList";
|
|
19
|
+
export { useSessionPluginActivation } from "./components/use-session-plugin-activation";
|
|
20
|
+
export type { UseSessionPluginActivationResult } from "./components/use-session-plugin-activation";
|
|
21
|
+
export { catalogToConnectorItems, filterConnectorItems, mergeConnectorItems, } from "./components/plugin-connector";
|
|
22
|
+
export type { PluginConnectorItem } from "./components/plugin-connector";
|
|
23
|
+
export { selectionFromItem, triggerSummary, TRIGGER_ICON_LIMIT } from "./components/connector-panel-types";
|
|
24
|
+
export type { PluginConnectorSelection, TriggerSummary, } from "./components/connector-panel-types";
|
|
25
|
+
export { SessionPluginSelector } from "./components/SessionPluginSelector";
|
|
26
|
+
export type { SessionPluginSelectorProps } from "./components/SessionPluginSelector";
|
|
27
|
+
export { SessionPluginIcon, sessionPluginLabel } from "./components/SessionPluginIcon";
|
|
28
|
+
export type { SessionPluginIconProps, SessionPluginLabelProps } from "./components/SessionPluginIcon";
|
|
29
|
+
export { PluginTriggerStack } from "./components/PluginTriggerStack";
|
|
30
|
+
export type { PluginTriggerStackProps } from "./components/PluginTriggerStack";
|
|
31
|
+
export { SessionPluginConfigDialog } from "./components/SessionPluginConfigDialog";
|
|
32
|
+
export type { SessionPluginConfigDialogProps } from "./components/SessionPluginConfigDialog";
|
|
33
|
+
export { SessionPluginConfigForm } from "./components/SessionPluginConfigForm";
|
|
34
|
+
export type { SessionPluginConfigDraft, SessionPluginConfigFormProps, } from "./components/SessionPluginConfigForm";
|
|
11
35
|
export { AgentChat } from "./components/AgentChat";
|
|
12
36
|
export type { AgentChatProps } from "./components/AgentChat";
|
|
13
37
|
export { LlmChat } from "./components/LlmChat";
|
|
14
38
|
export type { LlmChatHandle, LlmChatProps } from "./components/LlmChat";
|
|
15
39
|
export type { LlmAdvancedSettings, LlmOverride } from "./components/LlmAdvancedSettings";
|
|
16
40
|
export { MarkdownContent } from "./components/MarkdownContent";
|
|
41
|
+
export { normalizeAdjacentUrlFormatting } from "./components/MarkdownContent";
|
|
17
42
|
export type { MarkdownContentProps } from "./components/MarkdownContent";
|
|
43
|
+
export { WhatIfUserBubble } from "./components/WhatIfUserBubble";
|
|
44
|
+
export type { WhatIfUserBubbleProps } from "./components/WhatIfUserBubble";
|
|
45
|
+
export { parseWhatIfPrompt } from "./lib/whatif-prompt";
|
|
46
|
+
export type { ParsedWhatIfPrompt, WhatIfQuote } from "./lib/whatif-prompt";
|
|
18
47
|
export { ReplayBar } from "./components/ReplayBar";
|
|
19
48
|
export type { ReplayBarProps } from "./components/ReplayBar";
|
|
20
49
|
export { ReplayMismatchPrompt } from "./components/ReplayMismatchPrompt";
|
|
21
50
|
export type { ReplayMismatchPromptProps } from "./components/ReplayMismatchPrompt";
|
|
22
51
|
export type { ToolCallRenderer } from "./components/ToolCallBlock";
|
|
52
|
+
export { CurrentPlanPanel, getPlanUpdateDisplayState, isPlanUpdateTool, PLAN_AUTO_COLLAPSE_MS, parsePlanUpdate, pickCurrentPlanStep, PlanUpdateBlock, } from "./components/PlanUpdateBlock";
|
|
53
|
+
export type { PlanStepStatus, PlanUpdateData, PlanUpdateDisplayState, } from "./components/PlanUpdateBlock";
|
|
54
|
+
export { ContextCard, ContextGroupCard } from "./components/ContextCard";
|
|
55
|
+
export type { ContextCardProps, ContextGroupCardProps } from "./components/ContextCard";
|
|
56
|
+
export { collectMemoryRefs, MemoryRefsHint } from "./components/AssistantTurnBlock";
|
|
57
|
+
export { ToolUiCardView } from "./components/ToolUiCardView";
|
|
58
|
+
export { McpAppCard } from "./components/McpAppCard";
|
|
59
|
+
export type { McpAppMessage } from "./components/McpAppCard";
|
|
60
|
+
export { SessionMemoryToggle } from "./components/SessionMemoryToggle";
|
|
61
|
+
export type { SessionMemoryToggleProps } from "./components/SessionMemoryToggle";
|
|
62
|
+
export { SessionQueuePanel, isQueuePanelVisible } from "./components/SessionQueuePanel";
|
|
63
|
+
export type { SessionQueuePanelProps } from "./components/SessionQueuePanel";
|
|
64
|
+
export { isAgentComputerCommand, isAgentComputerToolCall, classifyAgentComputerLaunchOutcome, } from "./lib/agent-computer-command";
|
|
65
|
+
export type { AgentComputerLaunchOutcome } from "./lib/agent-computer-command";
|
|
23
66
|
export * from "@blade-hq/agent-client";
|