@blade-hq/agent-react 2610.0.0-beta.5 → 2610.0.0-beta.51
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 +102 -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 +5 -1
- package/dist/components/ChatSurface.d.ts +13 -2
- package/dist/components/ConnectionBanner.d.ts +1 -1
- 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 +8 -1
- package/dist/components/PlanUpdateBlock.d.ts +31 -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 +19 -0
- package/dist/components/SessionPluginSelector.d.ts +10 -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/display-utils.d.ts +10 -0
- package/dist/components/plugin-config-schema.d.ts +51 -0
- package/dist/context.d.ts +1 -0
- package/dist/embed/entry.d.ts +37 -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/index.d.ts +27 -0
- package/dist/index.js +28906 -958
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-computer-command.d.ts +34 -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 +91 -1
- package/dist/style.full.css +92 -2
- package/dist/webapi-W3IB5DO4.js +2481 -0
- package/dist/webapi-W3IB5DO4.js.map +1 -0
- package/package.json +2 -2
- package/public-api.md +890 -10
- package/dist/mermaid-3ZIDBTTL-N7YKJ3SM.js +0 -8
- /package/dist/{mermaid-3ZIDBTTL-N7YKJ3SM.js.map → chunk-G3PMV62Z.js.map} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentSession, CreateSessionRequest } from "@blade-hq/agent-client";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
2
3
|
import { type ChatPresentationProps } from "./ChatSurface";
|
|
3
4
|
import type { FollowupInteractionEvent } from "./PostChatFollowupBlock";
|
|
4
5
|
export interface AgentChatProps extends ChatPresentationProps {
|
|
@@ -13,6 +14,8 @@ export interface AgentChatProps extends ChatPresentationProps {
|
|
|
13
14
|
onSessionReady?: (session: AgentSession) => void;
|
|
14
15
|
/** 智能体下发给宿主页面的指令处理器(action → handler)。 */
|
|
15
16
|
commands?: Record<string, (data: unknown) => void>;
|
|
17
|
+
/** 覆盖默认会话插件选择器。 */
|
|
18
|
+
sessionPluginControls?: (sessionId: string) => ReactNode;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* 智能体模式的聊天界面:连接(或新建)一个 Blade 会话,渲染消息流与输入框。
|
|
@@ -2,9 +2,6 @@ import type { ToolCallInfo } from "@blade-hq/agent-client";
|
|
|
2
2
|
interface Props {
|
|
3
3
|
toolCall: ToolCallInfo;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* 子智能体(fork Agent)状态块的 SDK 简化版:只展示描述、状态与最终结果,
|
|
7
|
-
* 不再嵌套渲染子循环的完整消息流(那是第一方界面的能力)。
|
|
8
|
-
*/
|
|
5
|
+
/** SDK 没有第一方子循环消息流,只保留轻量意图行和可展开的最终结果。 */
|
|
9
6
|
export declare function AgentLoopBlock({ toolCall }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
7
|
export {};
|
|
@@ -28,4 +28,13 @@ interface Props {
|
|
|
28
28
|
export declare function AskUserQuestionBlock({ data, answered, toolCallId, sessionStatus, answerData, onAnswer, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
/** 解析 AskUserQuestion 的工具结果/参数,容错 LLM 把 questions 输出为字符串的情况。 */
|
|
30
30
|
export declare function parseAskUserQuestion(toolResult: string | null | undefined): AskUserQuestionData | null;
|
|
31
|
+
export interface AskUserQuestionError {
|
|
32
|
+
message: string;
|
|
33
|
+
detail: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Keep this parser synchronized with apps/web/AskUserQuestionBlock.tsx.
|
|
37
|
+
* The built-in Web cannot import agent-react, and this is not a public SDK protocol API.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseAskUserQuestionError(toolResult: string | null | undefined): AskUserQuestionError | null;
|
|
31
40
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskUserAnswerData, ChatMessage } from "@blade-hq/agent-client";
|
|
1
|
+
import type { AskUserAnswerData, ChatMessage, MemoryRefInfo } from "@blade-hq/agent-client";
|
|
2
2
|
import { type ToolCallRenderer } from "./ToolCallBlock";
|
|
3
3
|
interface Props {
|
|
4
4
|
messages: ChatMessage[];
|
|
@@ -7,12 +7,26 @@ interface Props {
|
|
|
7
7
|
onAnswer?: (answer: string, toolCallId: string, answerData: AskUserAnswerData) => void;
|
|
8
8
|
sessionStatus?: string;
|
|
9
9
|
toolCallRenderer?: ToolCallRenderer;
|
|
10
|
+
/** Agent 模式把 update_plan 收口到输入框上方的任务面板;纯 LLM 同名工具照常展示。 */
|
|
11
|
+
hidePlanUpdateTools?: boolean;
|
|
10
12
|
/** 会话 id;传给 Markdown 渲染的统一上下文。 */
|
|
11
13
|
sessionId?: string;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export type TurnDisplayMode = "compact" | "detail";
|
|
16
|
+
export declare function resolveTurnDisplayMode({ isStreaming: _isStreaming, displayMode, }: {
|
|
17
|
+
isStreaming: boolean;
|
|
18
|
+
displayMode: TurnDisplayMode;
|
|
19
|
+
}): TurnDisplayMode;
|
|
20
|
+
export declare function formatExecutionDuration(durationMs: number): string;
|
|
21
|
+
export declare function getExecutionDurationMs({ messages, isStreaming, now, }: {
|
|
22
|
+
messages: ChatMessage[];
|
|
23
|
+
isStreaming: boolean;
|
|
24
|
+
now?: number;
|
|
25
|
+
}): number;
|
|
26
|
+
/** 一轮助手回复:执行过程默认折叠,最终正文始终显示在摘要下方。 */
|
|
27
|
+
export declare function AssistantTurnBlock({ messages, isStreaming, askAnswers, onAnswer, sessionStatus, toolCallRenderer, hidePlanUpdateTools, sessionId, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function collectMemoryRefs(messages: ChatMessage[]): MemoryRefInfo[];
|
|
29
|
+
export declare function MemoryRefsHint({ refs }: {
|
|
30
|
+
refs: MemoryRefInfo[];
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
32
|
export {};
|
|
@@ -3,16 +3,20 @@ interface Props {
|
|
|
3
3
|
value: string;
|
|
4
4
|
onValueChange: (value: string) => void;
|
|
5
5
|
onSend: (text: string) => boolean | Promise<boolean>;
|
|
6
|
+
/** Optional direct insertion path used while another response streams. */
|
|
7
|
+
onAppend?: (text: string) => void;
|
|
6
8
|
onStop: () => void;
|
|
7
9
|
isStreaming: boolean;
|
|
8
10
|
isStopping?: boolean;
|
|
9
11
|
placeholder?: string;
|
|
10
12
|
className?: string;
|
|
13
|
+
queueKey?: string;
|
|
14
|
+
hasAttachments?: boolean;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* 轻量聊天输入框:textarea(Enter 发送 / Shift+Enter 换行)+ 发送/停止按钮。
|
|
14
18
|
* 不含第一方版本的富文本编辑、@ 补全、技能菜单、语音输入与模型选择。
|
|
15
19
|
* 内容受控,session.attach() / insertText() 通过 ChatView 注入到这里。
|
|
16
20
|
*/
|
|
17
|
-
export declare function ChatInput({ value, onValueChange, onSend, onStop, isStreaming, isStopping, placeholder, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function ChatInput({ value, onValueChange, onSend, onAppend, onStop, isStreaming, isStopping, placeholder, className, queueKey, hasAttachments, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
22
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AskUserAnswerData, ChatMessage, ConnectionStatus, PostChatFollowup } from "@blade-hq/agent-client";
|
|
2
|
-
import type
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
3
|
import type { ToolCallRenderer } from "./ToolCallBlock";
|
|
4
4
|
import type { FollowupInteractionEvent } from "./PostChatFollowupBlock";
|
|
5
5
|
import type { ResultFeedback } from "@blade-hq/agent-client";
|
|
@@ -45,6 +45,7 @@ interface ChatSurfaceProps extends ChatPresentationProps {
|
|
|
45
45
|
onInputChange: (value: string) => void;
|
|
46
46
|
onSuggestion?: (value: string) => void;
|
|
47
47
|
onSend: (text: string) => Promise<boolean>;
|
|
48
|
+
onAppend?: (text: string) => void;
|
|
48
49
|
onStop: () => void;
|
|
49
50
|
sessionStatus?: string;
|
|
50
51
|
askAnswers?: Record<string, AskUserAnswerData>;
|
|
@@ -55,6 +56,16 @@ interface ChatSurfaceProps extends ChatPresentationProps {
|
|
|
55
56
|
onResultFeedbackSaved?: (feedback: ResultFeedback) => void;
|
|
56
57
|
/** 输入框上方的内部区域(纯 LLM 模式的高级设置用)。不传时不渲染任何节点。 */
|
|
57
58
|
beforeInput?: ReactNode;
|
|
59
|
+
/** 仅 Agent 模式启用 Blade 的 update_plan 面板。 */
|
|
60
|
+
showPlanUpdates?: boolean;
|
|
61
|
+
/** 仅实时成功的 update_plan 递增;历史 hydration 不得改变。 */
|
|
62
|
+
planRevealRevision?: number;
|
|
63
|
+
historyPaging?: {
|
|
64
|
+
hasOlder: boolean;
|
|
65
|
+
loading: boolean;
|
|
66
|
+
/** Resolves true only when the paging cursor advanced. */
|
|
67
|
+
loadOlder: (beforeCommit?: () => void) => Promise<boolean>;
|
|
68
|
+
};
|
|
58
69
|
/** 连接状态条下方的横幅(回放模式条用)。不传时不渲染任何节点。 */
|
|
59
70
|
banner?: ReactNode;
|
|
60
71
|
}
|
|
@@ -64,5 +75,5 @@ interface ChatSurfaceProps extends ChatPresentationProps {
|
|
|
64
75
|
* 这里的 DOM 结构受 tests/chat-view-compat.test.tsx 的快照保护——接入方拿
|
|
65
76
|
* .blade-chat-* 类名写了自己的样式,结构一动他们的页面就歪。
|
|
66
77
|
*/
|
|
67
|
-
export declare function ChatSurface({ theme, classNames, renderers, slots, placeholder, connection, errorMessage, messages, postChatFollowup, isStreaming, isStopping, inputText, onInputChange, onSuggestion, onSend, onStop, sessionStatus, askAnswers, onAnswer, sessionId, isViewer, resultFeedbackByEntry, onResultFeedbackSaved, onFollowupInteraction, beforeInput, banner, }: ChatSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare function ChatSurface({ theme, classNames, renderers, slots, placeholder, connection, errorMessage, messages, postChatFollowup, isStreaming, isStopping, inputText, onInputChange, onSuggestion, onSend, onAppend, onStop, sessionStatus, askAnswers, onAnswer, sessionId, isViewer, resultFeedbackByEntry, onResultFeedbackSaved, onFollowupInteraction, beforeInput, showPlanUpdates, planRevealRevision, historyPaging, banner, }: ChatSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
68
79
|
export {};
|
|
@@ -3,6 +3,6 @@ interface Props {
|
|
|
3
3
|
connection: ConnectionStatus;
|
|
4
4
|
className?: string;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
6
|
+
/** 连接状态提示条:短暂断线静默,超过容错时间后再逐级提示。 */
|
|
7
7
|
export declare function ConnectionBanner({ connection, className }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ContextProjectionData } from "@blade-hq/agent-client";
|
|
2
|
+
export interface ContextCardProps {
|
|
3
|
+
context: ContextProjectionData;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Business-facing Context summary. Native details keeps every card collapsed by default. */
|
|
7
|
+
export declare function ContextCard({ context, className }: ContextCardProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface ContextGroupCardProps {
|
|
9
|
+
contexts: readonly ContextProjectionData[];
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 一批上下文注入折叠成一行。会话首轮会一次注入十几个原子,一条一张卡片会把
|
|
14
|
+
* 真正的对话挤出屏幕。
|
|
15
|
+
*
|
|
16
|
+
* 单条和多条**共用同一个 details 外壳**,不在数量变化时切换组件:流式时第二条
|
|
17
|
+
* 到达会让这一行从单条变成多条,组件类型一换 React 就重挂 <details>,
|
|
18
|
+
* 用户刚展开的行会被收起来。同理,key 由调用方按组内第一条给,不能带数量。
|
|
19
|
+
*/
|
|
20
|
+
export declare function ContextGroupCard({ contexts, className }: ContextGroupCardProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BladeClient } from "@blade-hq/agent-client";
|
|
2
|
+
export interface McpAppMessage {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sourceId: string;
|
|
5
|
+
label: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const McpAppMessageContext: import("react").Context<((message: McpAppMessage) => void) | null>;
|
|
9
|
+
export declare function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: suppliedOnMessage }: {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
sourceId: string;
|
|
12
|
+
client?: BladeClient;
|
|
13
|
+
onMessage?: (message: McpAppMessage) => void;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +11,7 @@ interface Props {
|
|
|
11
11
|
askAnswers?: Record<string, AskUserAnswerData>;
|
|
12
12
|
onAnswer?: (answer: string, toolCallId: string, answerData: AskUserAnswerData) => void;
|
|
13
13
|
toolCallRenderer?: ToolCallRenderer;
|
|
14
|
+
hidePlanUpdateTools?: boolean;
|
|
14
15
|
emptyState?: ReactNode;
|
|
15
16
|
className?: string;
|
|
16
17
|
/** 会话 id;传给助手消息的统一上下文。 */
|
|
@@ -19,10 +20,16 @@ interface Props {
|
|
|
19
20
|
onFollowupInteraction?: (event: FollowupInteractionEvent) => void;
|
|
20
21
|
resultFeedbackByEntry?: ReadonlyMap<string, ResultFeedback>;
|
|
21
22
|
onResultFeedbackSaved?: (feedback: ResultFeedback) => void;
|
|
23
|
+
historyPaging?: {
|
|
24
|
+
hasOlder: boolean;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
/** Resolves true only when the paging cursor advanced. */
|
|
27
|
+
loadOlder: (beforeCommit?: () => void) => Promise<boolean>;
|
|
28
|
+
};
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* 消息列表:use-stick-to-bottom 自动滚动 + 按轮次分组渲染。
|
|
25
32
|
* 相比第一方版本去掉了轮次导航栏、吸顶状态条与规划摘要卡片。
|
|
26
33
|
*/
|
|
27
|
-
export declare function MessageList({ messages, postChatFollowup, onSuggestion, isStreaming, sessionStatus, askAnswers, onAnswer, toolCallRenderer, emptyState, className, sessionId, isViewer, onFollowupInteraction, resultFeedbackByEntry, onResultFeedbackSaved, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function MessageList({ messages, postChatFollowup, onSuggestion, isStreaming, sessionStatus, askAnswers, onAnswer, toolCallRenderer, hidePlanUpdateTools, emptyState, className, sessionId, isViewer, onFollowupInteraction, resultFeedbackByEntry, onResultFeedbackSaved, historyPaging, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
28
35
|
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChatMessage, ToolCallInfo } from "@blade-hq/agent-client";
|
|
2
|
+
export type PlanStepStatus = "pending" | "in_progress" | "completed";
|
|
3
|
+
export interface PlanUpdateData {
|
|
4
|
+
plan: Array<{
|
|
5
|
+
step: string;
|
|
6
|
+
status: PlanStepStatus;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export declare const PLAN_AUTO_COLLAPSE_MS = 5000;
|
|
10
|
+
export declare function isPlanUpdateTool(toolCall: Pick<ToolCallInfo, "name">): boolean;
|
|
11
|
+
export interface PlanUpdateDisplayState {
|
|
12
|
+
current: ToolCallInfo | null;
|
|
13
|
+
updating: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getPlanUpdateDisplayState(messages: ChatMessage[]): PlanUpdateDisplayState;
|
|
16
|
+
export declare function parsePlanUpdate(argumentsJson: string): PlanUpdateData | null;
|
|
17
|
+
export declare function pickCurrentPlanStep(plan: PlanUpdateData["plan"]): PlanUpdateData["plan"][number] | null;
|
|
18
|
+
export declare function PlanUpdateBlock({ toolCall, running, autoReveal, }: {
|
|
19
|
+
toolCall: ToolCallInfo;
|
|
20
|
+
running?: boolean;
|
|
21
|
+
/** 实时收到的新进度短暂展开;加载历史时保持默认收起。 */
|
|
22
|
+
autoReveal?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export declare function CurrentPlanPanel({ messages, running, revealRevision, sessionId, className, }: {
|
|
25
|
+
messages: ChatMessage[];
|
|
26
|
+
running?: boolean;
|
|
27
|
+
/** 仅实时成功的 update_plan 递增;历史 hydration 不得改变。 */
|
|
28
|
+
revealRevision?: number;
|
|
29
|
+
sessionId?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BladeClient } from "@blade-hq/agent-client";
|
|
2
|
+
export interface SessionMemoryToggleProps {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
/** 不在 BladeProvider 内使用时显式传入,与宿主现有 BladeClient 复用连接和鉴权。 */
|
|
6
|
+
client?: BladeClient;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
label?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
inputClassName?: string;
|
|
12
|
+
onSaved?: (sessionId: string, enabled: boolean) => void;
|
|
13
|
+
onError?: (error: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 当前会话记忆开关。同一 client + sessionId 的所有实例共享保存锁,避免多个聊天入口
|
|
17
|
+
* 或会话切换时发出乱序更新;服务端成功后才通过 onSaved 交还权威值。
|
|
18
|
+
*/
|
|
19
|
+
export declare function SessionMemoryToggle({ sessionId, enabled, client: clientProp, disabled, label, className, labelClassName, inputClassName, onSaved, onError, }: SessionMemoryToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BladeClient, SessionPlugin, SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
export interface SessionPluginConfigDialogProps {
|
|
3
|
+
client: BladeClient;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
plugin: Pick<SessionPlugin, "name" | "display_name" | "icon">;
|
|
6
|
+
/** Called after every successful save with the freshly published state. */
|
|
7
|
+
onSaved?: (state: SessionPluginConfigState) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function SessionPluginConfigDialog({ client, sessionId, plugin, ...props }: SessionPluginConfigDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SessionPluginConfigError, SessionPluginConfigSet, SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
export interface SessionPluginConfigDraft {
|
|
3
|
+
set: SessionPluginConfigSet[];
|
|
4
|
+
remove: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface SessionPluginConfigFormProps {
|
|
7
|
+
config: SessionPluginConfigState;
|
|
8
|
+
submitting: boolean;
|
|
9
|
+
errors: SessionPluginConfigError[];
|
|
10
|
+
failure: string | null;
|
|
11
|
+
onSubmit: (draft: SessionPluginConfigDraft) => void;
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function SessionPluginConfigForm({ config, submitting, errors, failure, onSubmit, onCancel, }: SessionPluginConfigFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BladeClient, SessionPlugin } from "@blade-hq/agent-client";
|
|
2
|
+
export interface SessionPluginIconProps {
|
|
3
|
+
client: BladeClient;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
plugin: Pick<SessionPlugin, "name" | "icon">;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SessionPluginLabelProps {
|
|
9
|
+
plugin: Pick<SessionPlugin, "name" | "display_name">;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Business name for a plugin, falling back to the technical ID.
|
|
13
|
+
*
|
|
14
|
+
* The ID stays authoritative for paths, authorization, caching and calls; this
|
|
15
|
+
* helper only decides what a user reads. Keep it shared — one place decides.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sessionPluginLabel(plugin: Pick<SessionPlugin, "name" | "display_name">): string;
|
|
18
|
+
/** Package-local plugin icon, with a stable generic placeholder. */
|
|
19
|
+
export declare function SessionPluginIcon({ client, sessionId, plugin, className }: SessionPluginIconProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BladeClient, SessionPluginActivation } from "@blade-hq/agent-client";
|
|
2
|
+
export interface SessionPluginSelectorProps {
|
|
3
|
+
client: BladeClient;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
side?: "top" | "bottom";
|
|
7
|
+
onChange?: (plugin: SessionPluginActivation) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Shared selector for AgentChat and the built-in Web; no external query provider required. */
|
|
10
|
+
export declare function SessionPluginSelector(props: SessionPluginSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,6 +8,7 @@ interface Props {
|
|
|
8
8
|
answered?: boolean;
|
|
9
9
|
answerData?: AskUserAnswerData;
|
|
10
10
|
sessionStatus?: string;
|
|
11
|
+
isActiveQuestion?: boolean;
|
|
11
12
|
renderer?: ToolCallRenderer;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -19,10 +20,11 @@ interface Props {
|
|
|
19
20
|
* 会同时把已经回答过的旧提问重新变成可作答(历史加载不会带回 answerData),
|
|
20
21
|
* 而且会盖住投影层的错误——这个 bug 就是这么藏住的。
|
|
21
22
|
*/
|
|
22
|
-
export declare function resolveAskQuestionState({ toolStatus, hasAnswerData, fallbackAnswered, }: {
|
|
23
|
+
export declare function resolveAskQuestionState({ toolStatus, hasAnswerData, fallbackAnswered, fallbackAwaiting, }: {
|
|
23
24
|
toolStatus: ToolCallInfo["status"];
|
|
24
25
|
hasAnswerData: boolean;
|
|
25
26
|
fallbackAnswered?: boolean;
|
|
27
|
+
fallbackAwaiting?: boolean;
|
|
26
28
|
}): {
|
|
27
29
|
awaitingAnswer: boolean;
|
|
28
30
|
answered: boolean;
|
|
@@ -31,5 +33,5 @@ export declare function resolveAskQuestionState({ toolStatus, hasAnswerData, fal
|
|
|
31
33
|
* 极简工具调用块:状态 + 展示名一行,点开后是参数/结果的 <pre> 折叠展示。
|
|
32
34
|
* AskUserQuestion 特殊处理为提问选项卡片。
|
|
33
35
|
*/
|
|
34
|
-
export declare function ToolCallBlock({ toolCall, onAnswer, answered, answerData, sessionStatus, renderer, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function ToolCallBlock({ toolCall, onAnswer, answered, answerData, sessionStatus, isActiveQuestion, renderer, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
35
37
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolUiCard } from "@blade-hq/agent-client";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Apps 使用 SDK/Web 共享的 AppBridge;恢复只消费留档,不重读资源。
|
|
4
|
+
* 普通资源卡片仍使用 agent-client 的共享内容判定。
|
|
5
|
+
*/
|
|
6
|
+
export declare function ToolUiCardView({ card, sessionId }: {
|
|
7
|
+
card: ToolUiCard;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -11,7 +11,7 @@ interface UserMessageProps {
|
|
|
11
11
|
message: UserChatMessage;
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/** 用户消息气泡:文本、canonical 引用消息与图片/文件附件。 */
|
|
15
15
|
export declare function UserMessageBubble({ message, className }: UserMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
/** 错误消息:居中红色提示条。 */
|
|
17
17
|
export declare function ErrorMessageBlock({ message, className, }: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParsedWhatIfPrompt } from "../lib/whatif-prompt";
|
|
2
|
+
export interface WhatIfUserBubbleProps {
|
|
3
|
+
parsed: ParsedWhatIfPrompt;
|
|
4
|
+
onQuoteClick?: (stepNumber: number) => void;
|
|
5
|
+
}
|
|
6
|
+
/** SDK 与内置 Web 共用的 canonical 引用消息渲染。 */
|
|
7
|
+
export declare function WhatIfUserBubble({ parsed, onQuoteClick }: WhatIfUserBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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,51 @@
|
|
|
1
|
+
import type { SessionPluginConfigState } from "@blade-hq/agent-client";
|
|
2
|
+
/**
|
|
3
|
+
* JSON Schema (Draft 2020-12) support surface for the shared plugin form.
|
|
4
|
+
*
|
|
5
|
+
* The platform validates with the full standard validator; the form only
|
|
6
|
+
* renders the constructs it can render honestly. Anything outside this list is
|
|
7
|
+
* reported with a located reason instead of being dropped or downgraded to a
|
|
8
|
+
* raw JSON editor — "不支持的呈现明确报错,不静默丢字段".
|
|
9
|
+
*/
|
|
10
|
+
export type JsonSchema = Record<string, unknown>;
|
|
11
|
+
export interface Discriminator {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
options: {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
export declare function pointerOf(parts: (string | number)[]): string;
|
|
20
|
+
export declare function pointerParts(pointer: string): string[];
|
|
21
|
+
/** Follow intra-document `$ref` chains. Package-relative refs are refused. */
|
|
22
|
+
export declare function resolveNode(root: JsonSchema, node: JsonSchema): JsonSchema | null;
|
|
23
|
+
export declare function nodeTypes(node: JsonSchema): string[];
|
|
24
|
+
export declare function isSecret(node: JsonSchema): boolean;
|
|
25
|
+
export declare function optionsOf(node: JsonSchema): {
|
|
26
|
+
value: unknown;
|
|
27
|
+
label: string;
|
|
28
|
+
}[] | null;
|
|
29
|
+
export declare function labelOf(node: JsonSchema, fallback: string): string;
|
|
30
|
+
export declare function hintOf(node: JsonSchema): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a branch keyword can be rendered, and why not when it cannot.
|
|
33
|
+
*
|
|
34
|
+
* `oneOf` is supported only in the shape a login form actually needs: every
|
|
35
|
+
* branch pins the same discriminator property with `const`. Anything else would
|
|
36
|
+
* mean guessing which fields to show.
|
|
37
|
+
*/
|
|
38
|
+
export declare function unsupportedReason(root: JsonSchema, node: JsonSchema, pointer?: string, ancestors?: Set<JsonSchema>): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The switch a form can render: a property every `oneOf` branch pins with
|
|
41
|
+
* `const`, declared with an `enum` (or `const`) in `properties`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function discriminatorOf(root: JsonSchema, node: JsonSchema): Discriminator | null;
|
|
44
|
+
/** Required pointers for the whole document, following the active branch. */
|
|
45
|
+
export declare function requiredPointers(root: JsonSchema, values: Record<string, unknown>): Set<string>;
|
|
46
|
+
/** Whether a subtree holds `writeOnly` anywhere inside it. */
|
|
47
|
+
export declare function containsSecret(root: JsonSchema, node: JsonSchema): boolean;
|
|
48
|
+
export declare function readAt(document: Record<string, unknown>, pointer: string): unknown;
|
|
49
|
+
/** The form's support verdict for a whole declaration. */
|
|
50
|
+
export declare function formSupport(schema: JsonSchema | null): string | null;
|
|
51
|
+
export declare function configIsEditable(state: SessionPluginConfigState): boolean;
|
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,18 +18,35 @@ 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;
|
|
33
|
+
reconcileOptimisticUserTurns: typeof agentClient.reconcileOptimisticUserTurns;
|
|
27
34
|
toReplaySnapshot: typeof agentClient.toReplaySnapshot;
|
|
28
35
|
connectEmbedded: typeof agentClient.connectEmbedded;
|
|
29
36
|
isCommandEnvelope: typeof agentClient.isCommandEnvelope;
|
|
30
37
|
isInboundEnvelope: typeof agentClient.isInboundEnvelope;
|
|
38
|
+
ComputersResource: typeof agentClient.ComputersResource;
|
|
39
|
+
canToggleComputer: typeof agentClient.canToggleComputer;
|
|
40
|
+
computerDaemonVersion: typeof agentClient.computerDaemonVersion;
|
|
41
|
+
computerOS: typeof agentClient.computerOS;
|
|
42
|
+
computerPlatformLabel: typeof agentClient.computerPlatformLabel;
|
|
43
|
+
computerState: typeof agentClient.computerState;
|
|
44
|
+
sortComputers: typeof agentClient.sortComputers;
|
|
31
45
|
ModelsResource: typeof agentClient.ModelsResource;
|
|
46
|
+
ChatProjectsResource: typeof agentClient.ChatProjectsResource;
|
|
47
|
+
hasChatRunEvent: typeof agentClient.hasChatRunEvent;
|
|
32
48
|
buildMessageContent: typeof agentClient.buildMessageContent;
|
|
49
|
+
chatErrorForDisplay: typeof agentClient.chatErrorForDisplay;
|
|
33
50
|
contentPreview: typeof agentClient.contentPreview;
|
|
34
51
|
extractTextAttachments: typeof agentClient.extractTextAttachments;
|
|
35
52
|
getFileParts: typeof agentClient.getFileParts;
|
|
@@ -39,7 +56,20 @@ declare const BladeAgent: {
|
|
|
39
56
|
isHiddenInternalMessage: typeof agentClient.isHiddenInternalMessage;
|
|
40
57
|
normalizeMessageContent: typeof agentClient.normalizeMessageContent;
|
|
41
58
|
transformSlashCommand: typeof agentClient.transformSlashCommand;
|
|
59
|
+
contextProjectionData: typeof agentClient.contextProjectionData;
|
|
60
|
+
getContextDisplayState: typeof agentClient.getContextDisplayState;
|
|
61
|
+
getContextGroupDisplayState: typeof agentClient.getContextGroupDisplayState;
|
|
62
|
+
groupAdjacentContextRuns: typeof agentClient.groupAdjacentContextRuns;
|
|
42
63
|
latestPostChatFollowup: typeof agentClient.latestPostChatFollowup;
|
|
64
|
+
buildToolUiCardKey: typeof agentClient.buildToolUiCardKey;
|
|
65
|
+
collectInlineToolUiCards: typeof agentClient.collectInlineToolUiCards;
|
|
66
|
+
collectPreviewToolUiCards: typeof agentClient.collectPreviewToolUiCards;
|
|
67
|
+
isAppDevToolUiCard: typeof agentClient.isAppDevToolUiCard;
|
|
68
|
+
isInternalStatusToolUiCard: typeof agentClient.isInternalStatusToolUiCard;
|
|
69
|
+
isToolUiCard: typeof agentClient.isToolUiCard;
|
|
70
|
+
resolveToolUiCardContent: typeof agentClient.resolveToolUiCardContent;
|
|
71
|
+
prependOlder: typeof agentClient.prependOlder;
|
|
72
|
+
replaceWindow: typeof agentClient.replaceWindow;
|
|
43
73
|
DEFAULT_REPLAY_SPEED: agentClient.ReplaySpeed;
|
|
44
74
|
SessionInfo: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
45
75
|
id: string;
|
|
@@ -70,7 +100,11 @@ declare const BladeAgent: {
|
|
|
70
100
|
disable_tools?: string[] | undefined;
|
|
71
101
|
runtime_type?: string | null | undefined;
|
|
72
102
|
daemon_id?: string | null | undefined;
|
|
103
|
+
agent_runtime_id?: string | null | undefined;
|
|
73
104
|
workspace_path?: string | null | undefined;
|
|
105
|
+
ba_version?: string | null | undefined;
|
|
106
|
+
sandbox_version?: string | null | undefined;
|
|
107
|
+
chat_project_id?: string | null | undefined;
|
|
74
108
|
match?: unknown;
|
|
75
109
|
}, {}>;
|
|
76
110
|
SessionStatus: import("arktype/internal/variants/string.ts").StringType<"completed" | "created" | "failed" | "interrupted" | "running" | "waiting_for_input", {}>;
|
|
@@ -86,7 +120,10 @@ declare const BladeAgent: {
|
|
|
86
120
|
}, {}>;
|
|
87
121
|
TaskStatus: import("arktype/internal/variants/string.ts").StringType<"done" | "failed" | "in_progress" | "pending" | "skipped", {}>;
|
|
88
122
|
acceptedPostChatFollowupCompletesLatestRun: typeof agentClient.acceptedPostChatFollowupCompletesLatestRun;
|
|
123
|
+
acknowledgeTurnEvents: typeof agentClient.acknowledgeTurnEvents;
|
|
89
124
|
ClientProjectionBuilder: typeof agentClient.ClientProjectionBuilder;
|
|
125
|
+
AuthBusyReconnect: typeof agentClient.AuthBusyReconnect;
|
|
126
|
+
authBusyRetryDelayMs: typeof agentClient.authBusyRetryDelayMs;
|
|
90
127
|
createSocket: typeof agentClient.createSocket;
|
|
91
128
|
getChat: typeof getChat;
|
|
92
129
|
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
|
+
};
|