@blade-hq/agent-react 2610.0.0-beta.50 → 2610.0.0-beta.52
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 +18 -1
- 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/ChatInput.d.ts +4 -3
- package/dist/components/ChatSurface.d.ts +5 -3
- package/dist/components/McpAppCard.d.ts +14 -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/SessionQueuePanel.d.ts +25 -0
- package/dist/components/ToolUiCardView.d.ts +9 -0
- package/dist/components/plugin-config-draft.d.ts +13 -0
- package/dist/components/plugin-config-schema.d.ts +6 -0
- package/dist/embed/entry.d.ts +17 -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/index.d.ts +11 -0
- package/dist/index.js +42642 -2196
- package/dist/index.js.map +1 -1
- package/dist/mermaid-3ZIDBTTL-BPVVWTVV.js +9 -0
- package/dist/mermaid-3ZIDBTTL-BPVVWTVV.js.map +1 -0
- package/dist/style.full.css +1 -1
- package/dist/webapi-W3IB5DO4.js +2481 -0
- package/dist/webapi-W3IB5DO4.js.map +1 -0
- package/package.json +2 -2
- package/public-api.md +431 -6
- package/dist/mermaid-3ZIDBTTL-N7YKJ3SM.js +0 -8
- /package/dist/{mermaid-3ZIDBTTL-N7YKJ3SM.js.map → chunk-G3PMV62Z.js.map} +0 -0
package/README.md
CHANGED
|
@@ -187,6 +187,8 @@ await replay.exitToAutonomous() // 退出回放,之后真的运
|
|
|
187
187
|
|
|
188
188
|
记忆引用提示可通过 `MemoryRefsHint` 展示,`collectMemoryRefs` 用于从一轮消息中聚合引用,保证宿主自定义消息布局与 SDK 默认界面保持一致。
|
|
189
189
|
|
|
190
|
+
MCP App 卡片(`tool_ui` block)在默认消息流里自动渲染,无需配置;自建消息布局时可用 `ToolUiCardView` 渲染单个卡片,并传入 `sessionId` 启用共享 AppBridge。卡片的实例、内容解析与终态(archived 留档不重放)判定来自 agent-client 的共享层(`collectInlineToolUiCards` / `resolveToolUiCardContent` 等)。preview 卡片不进消息流,由 `toolPreview` 事件推给宿主自建面板。
|
|
191
|
+
|
|
190
192
|
`onFollowupInteraction` 使用 `FollowupInteractionEvent`,覆盖下一步建议展示/采纳、成果展示/打开/下载以及结果评分。SDK 不内置分析服务;宿主回调抛错也不会中断用户点击或下载。
|
|
191
193
|
文件成果以文件名为文本的标准下载链接展示;Vue / 纯 HTML 使用的 `<blade-chat>` 与 `ChatView` 行为一致。
|
|
192
194
|
|
|
@@ -386,10 +388,25 @@ blade-chat { --primary: 262 83% 58%; height: 640px; }
|
|
|
386
388
|
|
|
387
389
|
为方便单包引入,本包 re-export 了 agent-client 的全部公开声明(`BladeClient`、`AgentSession`、`SessionState`、协议类型等),文档一律见 [agent-client 的 README](../agent-client/README.md)。完整签名见 [public-api.md](./public-api.md)。
|
|
388
390
|
|
|
389
|
-
本包自有声明:`BladeProvider`、`BladeProviderProps`、`useBladeClient`、`useAgentSession`、`UseAgentSessionOptions`、`UseAgentSessionResult`、`useMessagePin`、`UseMessagePinOptions`、`useReplay`、`UseReplayResult`、`ReplayMismatch`、`ReplayBar`、`ReplayBarProps`、`ReplayMismatchPrompt`、`ReplayMismatchPromptProps`、`ChatView`、`ChatViewProps`、`ChatViewClassNames`、`ChatViewRenderers`、`ChatViewSlots`、`FollowupInteractionEvent`、`ToolCallRenderer`、`CurrentPlanPanel`、`PlanUpdateBlock`、`PlanUpdateData`、`PlanUpdateDisplayState`、`PlanStepStatus`、`getPlanUpdateDisplayState`、`isPlanUpdateTool`、`parsePlanUpdate`、`pickCurrentPlanStep`、`PLAN_AUTO_COLLAPSE_MS`、`MarkdownContent`、`MarkdownContentProps`、`parseWhatIfPrompt`、`ParsedWhatIfPrompt`、`WhatIfQuote`、`WhatIfUserBubble`、`WhatIfUserBubbleProps`。
|
|
391
|
+
本包自有声明:`BladeProvider`、`BladeProviderProps`、`useBladeClient`、`useAgentSession`、`UseAgentSessionOptions`、`UseAgentSessionResult`、`useMessagePin`、`UseMessagePinOptions`、`useReplay`、`UseReplayResult`、`ReplayMismatch`、`ReplayBar`、`ReplayBarProps`、`ReplayMismatchPrompt`、`ReplayMismatchPromptProps`、`ChatView`、`ChatViewProps`、`ChatViewClassNames`、`ChatViewRenderers`、`ChatViewSlots`、`FollowupInteractionEvent`、`ToolCallRenderer`、`CurrentPlanPanel`、`PlanUpdateBlock`、`PlanUpdateData`、`PlanUpdateDisplayState`、`PlanStepStatus`、`getPlanUpdateDisplayState`、`isPlanUpdateTool`、`parsePlanUpdate`、`pickCurrentPlanStep`、`PLAN_AUTO_COLLAPSE_MS`、`MarkdownContent`、`MarkdownContentProps`、`parseWhatIfPrompt`、`ParsedWhatIfPrompt`、`WhatIfQuote`、`WhatIfUserBubble`、`WhatIfUserBubbleProps`、`SessionQueuePanel`、`SessionQueuePanelProps`。
|
|
392
|
+
|
|
393
|
+
## 会话消息队列
|
|
394
|
+
|
|
395
|
+
智能体会话的等待消息由服务端持久化,`ChatView` / `AgentChat` 已在输入框上方渲染队列区域(空队列不占位,条目数超过三条可折叠)。输入框不再有「直接插入 / 排队执行」开关:会话空闲时提交直接开始处理,运行中提交默认入队;暂停时在面板上显示原因和「继续执行」。面板数据来自 `useAgentSession` 状态里的 `queue`(`SessionQueueSnapshot`),可编辑/删除/立即补充的判定来自 agent-client 的 `canEditQueuedMessage` / `canCancelQueuedMessage` / `canDeliverQueuedMessage`,文案用 `queuedMessageStatusLabel` / `queuePauseReasonLabel`。
|
|
396
|
+
|
|
397
|
+
自建布局可直接使用 `<SessionQueuePanel>`,属性类型为 `SessionQueuePanelProps`:传 `snapshot`、`canDeliver`、可选的 `pendingItemId`(提交中的条目禁用操作)与 `notice`(冲突/失败说明),以及 `onResume` / `onCancel` / `onEdit` / `onMove` / `onReorder` / `onDeliver` 回调。上移/下移与拖动排序最终都提交当前 pending 条目的完整 id 顺序。冲突时队列由服务端快照刷新,`ChatView` 会把未保存的正文放回输入框,不会静默丢掉用户编辑的内容。
|
|
390
398
|
|
|
391
399
|
`PollingBackoff` 从 agent-client 重导出,供自定义只读轮询计算退避时间;它不发送或重放请求。用法见 [agent-client 轮询说明](../agent-client/README.md#只读轮询退避)。
|
|
392
400
|
|
|
393
401
|
### 会话插件
|
|
394
402
|
|
|
395
403
|
默认 `AgentChat` / 智能体模式 `ChatView` 自带会话插件选择器,展开时查询 BH,选择按当前会话保存。准备失败会保留勾选并提供重试。独立嵌入可使用 `<SessionPluginSelector client={client} sessionId={id} />`;`sessionPluginControls` 可覆盖默认控件。组件参数类型为 `SessionPluginSelectorProps`。
|
|
404
|
+
|
|
405
|
+
列表项用插件声明的业务名称与随包本地图标展示(`sessionPluginLabel(plugin)` 与 `<SessionPluginIcon client={client} sessionId={id} plugin={plugin} />`,两者都可单独复用,参数类型为 `SessionPluginLabelProps` / `SessionPluginIconProps`);没有声明或图标不可用时回退技术 ID 与通用占位。授权、缓存、调用一律仍用 `plugin.name`。
|
|
406
|
+
|
|
407
|
+
插件的账号、token 等配置由包内 JSON Schema 声明,选择器就地提供填写入口:首次激活缺配置的插件会直接弹出表单(`<SessionPluginConfigDialog client={client} sessionId={id} plugin={plugin} />`),已配置的插件在行内提供「配置」按钮。表单本体是 `<SessionPluginConfigForm>`,参数与提交类型为 `SessionPluginConfigFormProps` / `SessionPluginConfigDraft`,也可单独嵌入;`SessionPluginConfigDialogProps` 是对话框的参数类型。
|
|
408
|
+
|
|
409
|
+
表单只呈现它确定能呈现的 JSON Schema 构造(字符串/数值/布尔/null、对象与数组、枚举、`properties` 内的 `writeOnly`,以及用同一字段的 `const` 固定的 `oneOf` 分支);遇到无法安全呈现的写法直接说明原因,不降级成手写 JSON、不静默丢字段。`writeOnly` 字段永不回显:留空表示保持不变,输入表示修改,显式「清除」才会删除。
|
|
410
|
+
### MCP Apps
|
|
411
|
+
|
|
412
|
+
`McpAppCard` 使用官方 AppBridge 渲染归档卡片,内置 Web 消费同一组件。在 `BladeProvider` 下传入会话 ID 与来源 ID,也可直接提供 `BladeClient`。`McpAppMessage` 表示 App 提供的文本;`McpAppMessageContext` 将其交给当前对话的待发送区。用户可在 `ChatView` 查看、移除并确认发送。`update-model-context` 会把 App 提交的当前状态经 `sessions.updateMcpAppContext` 存为会话上下文:只落库、不追加聊天、不启动 agent turn,正在运行的一轮保持启动时版本,下一个新的运行才读取;冲突(409)时重读最新 revision 后重提同一份状态一次。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
__commonJS,
|
|
33
|
+
__export,
|
|
34
|
+
__toESM
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=chunk-G3PMV62Z.js.map
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __export = (target, all5) => {
|
|
11
|
-
for (var name2 in all5)
|
|
12
|
-
__defProp(target, name2, { get: all5[name2], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to2, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to2, key) && key !== except)
|
|
18
|
-
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to2;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__export,
|
|
4
|
+
__toESM
|
|
5
|
+
} from "./chunk-G3PMV62Z.js";
|
|
30
6
|
|
|
31
7
|
// ../../node_modules/.pnpm/inline-style-parser@0.2.7/node_modules/inline-style-parser/cjs/index.js
|
|
32
8
|
var require_cjs = __commonJS({
|
|
@@ -27409,7 +27385,7 @@ var Se2 = createContext({ code: "" });
|
|
|
27409
27385
|
var de2 = () => useContext(Se2);
|
|
27410
27386
|
var ot = ({ language: e }) => jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
|
|
27411
27387
|
var cn2 = /\n+$/;
|
|
27412
|
-
var dn2 = lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
27388
|
+
var dn2 = lazy(() => import("./highlighted-body-B3W2YXNL-IASCZDV2.js").then((e) => ({ default: e.HighlightedCodeBlockBody })));
|
|
27413
27389
|
var rt2 = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
27414
27390
|
let i = useMemo(() => e.replace(cn2, ""), [e]), c = useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
27415
27391
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
@@ -27756,7 +27732,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
27756
27732
|
}, []), jsxs("div", { className: "relative", ref: i, children: [jsx("button", { className: f2("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsx(Z3, { size: 14 }) }), s2 ? jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
|
|
27757
27733
|
};
|
|
27758
27734
|
var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsx(Ht, {}), jsx(Dt, {})] }) : null, jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsx("table", { className: f2("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
|
|
27759
|
-
var Jn = lazy(() => import("./mermaid-3ZIDBTTL-
|
|
27735
|
+
var Jn = lazy(() => import("./mermaid-3ZIDBTTL-BPVVWTVV.js").then((e) => ({ default: e.Mermaid })));
|
|
27760
27736
|
var Kn2 = /language-([^\s]+)/;
|
|
27761
27737
|
function ke2(e, t) {
|
|
27762
27738
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
@@ -28252,4 +28228,4 @@ export {
|
|
|
28252
28228
|
_r,
|
|
28253
28229
|
Nt
|
|
28254
28230
|
};
|
|
28255
|
-
//# sourceMappingURL=chunk-
|
|
28231
|
+
//# sourceMappingURL=chunk-MAAMCOAU.js.map
|