@blade-hq/agent-client 2610.0.1 → 2612.0.0-beta.1

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.
@@ -1,32 +0,0 @@
1
- import { type CommandHandler } from "./registry";
2
- /**
3
- * iframe 嵌入形态的宿主端协作对象:当你把 Blade 的聊天页面用 iframe 嵌进
4
- * 自己的系统时,用它与 iframe 里的智能体互通——API 与同页嵌入的
5
- * AgentSession 完全一致(onCommand / attach / insertText / send)。
6
- *
7
- * action 的来源与同页形态相同:技能作者在工具返回值 JSON 的 `_meta.bridge`
8
- * 字段里写 `{ action, payload }`,Blade 页面检测到自己处于 iframe 中时会把
9
- * 它 postMessage 给宿主页面(见 docs/specs/260417-embed-bridge)。
10
- */
11
- export interface EmbeddedChatOptions {
12
- /** 嵌入 Blade 页面的 iframe 元素。不传则监听来自任意子窗口的消息。 */
13
- iframe?: HTMLIFrameElement;
14
- /**
15
- * 允许接收消息的来源(Blade 页面的 origin,如 "https://blade.example.com")。
16
- * 必填:不校验来源会让任意第三方页面伪造智能体指令。
17
- */
18
- allowedOrigins: string[];
19
- }
20
- export interface EmbeddedChat {
21
- /** 监听智能体下发的指令(注册前到达的会缓冲补投)。返回取消函数。 */
22
- onCommand(action: string, handler: CommandHandler): () => void;
23
- /** 把业务数据作为附件放进 iframe 里的聊天输入框。 */
24
- attach(label: string, data: unknown): void;
25
- /** 往 iframe 里的聊天输入框追加文字。 */
26
- insertText(text: string): void;
27
- /** 直接代用户发送一条消息。 */
28
- send(text: string): void;
29
- /** 停止监听并释放资源。 */
30
- dispose(): void;
31
- }
32
- export declare function connectEmbedded(options: EmbeddedChatOptions): EmbeddedChat;