@blade-hq/agent-react 2612.0.0-beta.8 → 2612.0.0-beta.80
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 +47 -0
- package/dist/SessionPluginConfigForm-7LJ5SUNY.js +9 -0
- package/dist/SessionPluginConfigForm-7LJ5SUNY.js.map +1 -0
- package/dist/chat/AgentLoopBlock.d.ts +0 -2
- package/dist/chat/AskUserQuestionBlock.d.ts +3 -20
- package/dist/chat/AssistantTurnBlock.d.ts +1 -9
- package/dist/chat/AttachmentPreviewDialog.d.ts +0 -1
- package/dist/chat/ChatLoadingIndicator.d.ts +7 -0
- package/dist/chat/ContextAttachmentPills.d.ts +4 -0
- package/dist/chat/CurrentPlanPanel.d.ts +0 -3
- package/dist/chat/FileDeliveryCards.d.ts +0 -4
- package/dist/chat/FinalArtifactCards.d.ts +0 -1
- package/dist/chat/ImageLightbox.d.ts +1 -1
- package/dist/chat/LiteMessageList.d.ts +5 -3
- package/dist/chat/MessageFileAttachmentList.d.ts +0 -5
- package/dist/chat/QuestionnaireQuestionBlock.d.ts +11 -0
- package/dist/chat/SessionReplayBar.d.ts +0 -1
- package/dist/chat/TextAttachmentPills.d.ts +0 -3
- package/dist/chat/TurnNavRail.d.ts +1 -7
- package/dist/chat/WorkflowRunBlock.d.ts +21 -4
- package/dist/chat/ai-elements/shimmer.d.ts +0 -4
- package/dist/chat/customization.d.ts +1 -1
- package/dist/chat/index.d.ts +3 -2
- package/dist/chat/markdown/ExternalAnchor.d.ts +2 -2
- package/dist/chat/markdown/MarkdownContent.d.ts +3 -0
- package/dist/chat/message-list-blocks.d.ts +0 -1
- package/dist/chat/runtime/actions.d.ts +2 -2
- package/dist/chat/runtime/background-task-dismissals.d.ts +0 -1
- package/dist/chat/runtime/composer-channels.d.ts +0 -3
- package/dist/chat/runtime/input-cache-reset.d.ts +0 -5
- package/dist/chat/runtime/input-services.d.ts +10 -0
- package/dist/chat/runtime/session-source.d.ts +0 -5
- package/dist/chat/runtime/use-chat-actions.d.ts +0 -4
- package/dist/chat/turn-locate-channel.d.ts +53 -0
- package/dist/{chat-OCLOVB3H.css → chat-IHPRU35X.css} +5 -18
- package/dist/chat.css +5 -18
- package/dist/chunk-66JXSDLB.js +13770 -0
- package/dist/chunk-66JXSDLB.js.map +1 -0
- package/dist/chunk-C3LBNHVM.js +9482 -0
- package/dist/chunk-C3LBNHVM.js.map +1 -0
- package/dist/chunk-F4MWGSKX.js +1308 -0
- package/dist/chunk-F4MWGSKX.js.map +1 -0
- package/dist/chunk-FBGCDXRK.js +607 -0
- package/dist/chunk-FBGCDXRK.js.map +1 -0
- package/dist/{chunk-67GHJQK5.js → chunk-FDB3J5QF.js} +3889 -26106
- package/dist/chunk-FDB3J5QF.js.map +1 -0
- package/dist/chunk-FH5HA3GW.js +2416 -0
- package/dist/chunk-FH5HA3GW.js.map +1 -0
- package/dist/chunk-KHJEIHMJ.js +973 -0
- package/dist/chunk-KHJEIHMJ.js.map +1 -0
- package/dist/chunk-MWILWSPG.js +9629 -0
- package/dist/chunk-MWILWSPG.js.map +1 -0
- package/dist/chunk-NRYLAO3X.js +3978 -0
- package/dist/chunk-NRYLAO3X.js.map +1 -0
- package/dist/{chunk-MERN5XEM.js → chunk-SK43YNRX.js} +4181 -16594
- package/dist/chunk-SK43YNRX.js.map +1 -0
- package/dist/components/AccountConnectorRules.d.ts +7 -0
- package/dist/components/AccountConnectors.d.ts +13 -0
- package/dist/components/BrowserConnectionDialog.d.ts +8 -0
- package/dist/components/ChatInput.d.ts +1 -15
- package/dist/components/ConfigConnection.d.ts +16 -0
- package/dist/components/ConnectorAuthorizationProgress.d.ts +6 -0
- package/dist/components/ConnectorConnection.d.ts +4 -0
- package/dist/components/ConnectorDetail.d.ts +46 -0
- package/dist/components/ConnectorPanel.d.ts +3 -1
- package/dist/components/ConnectorRulesPanel.d.ts +10 -0
- package/dist/components/ConnectorRuntimeDiagnostics.d.ts +5 -0
- package/dist/components/DeviceConnection.d.ts +17 -0
- package/dist/components/FeishuCapabilitySelection.d.ts +14 -0
- package/dist/components/FeishuPermissionStatus.d.ts +7 -0
- package/dist/components/LlmAdvancedSettings.d.ts +0 -1
- package/dist/components/ManagedConnection.d.ts +12 -0
- package/dist/components/McpAppFrame.d.ts +17 -0
- package/dist/components/PackEventNotice.d.ts +3 -0
- package/dist/components/PlanUpdateBlock.d.ts +0 -1
- package/dist/components/SessionPluginConfigForm.d.ts +4 -1
- package/dist/components/SessionPluginIcon.d.ts +1 -0
- package/dist/components/plugin-connector.d.ts +1 -0
- package/dist/connectors.d.ts +6 -0
- package/dist/connectors.js +19 -0
- package/dist/connectors.js.map +1 -0
- package/dist/embed/blade-chat-element.d.ts +0 -8
- package/dist/embed/entry.d.ts +13 -19
- package/dist/hooks/use-message-pin.d.ts +1 -1
- package/dist/hooks/use-turn-navigation.d.ts +19 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -3
- package/dist/internal.d.ts +7 -3
- package/dist/internal.js +59 -71
- package/dist/internal.js.map +1 -1
- package/dist/lib/message-shortcuts.d.ts +5 -0
- package/dist/questions.d.ts +7 -0
- package/dist/questions.js +910 -0
- package/dist/questions.js.map +1 -0
- package/dist/rich-input/ConnectButton.d.ts +7 -5
- package/dist/rich-input/FileCompletionMenu.d.ts +1 -2
- package/dist/rich-input/InputActionSubmenu.d.ts +10 -0
- package/dist/rich-input/SkillActionMenu.d.ts +10 -0
- package/dist/rich-input/SkillStatusBar.d.ts +0 -6
- package/dist/rich-input/extensions/skill-mention.d.ts +3 -20
- package/dist/rich-input/index.d.ts +3 -2
- package/dist/rich-input/lib/composer-content.d.ts +5 -1
- package/dist/rich-input/lib/plugin-suggestions.d.ts +5 -5
- package/dist/rich-input/lib/reference-candidates.d.ts +0 -1
- package/dist/rich-input/lib/skill-suggestions.d.ts +1 -1
- package/dist/rich-input/lib/user-home.d.ts +0 -17
- package/dist/rich-input/services.d.ts +1 -1
- package/dist/rich-input/voice/VoiceWaveform.d.ts +0 -3
- package/dist/rich-input.js +793 -1068
- package/dist/rich-input.js.map +1 -1
- package/dist/style.css +16 -55
- package/dist/style.full.css +23 -77
- package/dist/tool-details.d.ts +8 -0
- package/dist/tool-details.js +25 -0
- package/dist/tool-details.js.map +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/LICENSE +216 -0
- package/node_modules/@modelcontextprotocol/ext-apps/README.md +284 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/docs/patterns.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.d.ts +1348 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-with-deps.js +82 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.d.ts +1214 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/constants.d.ts +65 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.d.ts +47 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.d.ts +1047 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.json +6170 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.test.d.ts +41 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/interop-v1.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.d.ts +66 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.d.ts +126 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.d.ts +37 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/react-with-deps.js +82 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.d.ts +115 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.d.ts +54 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.d.ts +44 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.d.ts +113 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.d.ts +381 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/spec.types.d.ts +698 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/standard-schema.d.ts +23 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.d.ts +184 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/types.d.ts +33 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/wire-compat.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/package.json +144 -0
- package/node_modules/@standard-schema/spec/LICENSE +21 -0
- package/node_modules/@standard-schema/spec/README.md +198 -0
- package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
- package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.js +0 -0
- package/node_modules/@standard-schema/spec/package.json +52 -0
- package/package.json +19 -3
- package/public-api.md +60 -4
- package/dist/chunk-67GHJQK5.js.map +0 -1
- package/dist/chunk-DPDXGYGM.js +0 -258
- package/dist/chunk-DPDXGYGM.js.map +0 -1
- package/dist/chunk-MERN5XEM.js.map +0 -1
- package/dist/lib/agent-computer-command.d.ts +0 -32
- package/dist/rich-input/extensions/workflow-mention.d.ts +0 -10
package/README.md
CHANGED
|
@@ -460,6 +460,10 @@ blade-chat::part(input-toolbar) { gap: 12px; }
|
|
|
460
460
|
|
|
461
461
|
不需要本包——用后端托管的单文件产物 `<script src=".../sdk/blade-agent.js">` + `<blade-chat>` 自定义元素,行为与 `ChatView` 一致。Vue 项目用 `@blade-hq/agent-vue` 的 `<BladeChat>` 组件;区块定制用挂载式渲染器(`<blade-chat>` 元素的 `renderers` 属性),详见 agent-client README「`<blade-chat>` 的挂载式渲染器」。
|
|
462
462
|
|
|
463
|
+
## 独立工具详情
|
|
464
|
+
|
|
465
|
+
自行维护消息时间线的应用可按需使用公开入口 `@blade-hq/agent-react/tool-details`,无需依赖 `/internal` 或挂载完整聊天视图。入口导出 `getRenderer(name)`、`formatToolName`、`getToolDisplayLabel`、`parsePlanUpdate`、`ToolUiCardView`、`isToolUiCard`,以及 `ToolRendererProps`、`ToolUiCard` 类型。`getRenderer` 对内置工具返回共享组件,未注册的名称返回 `null`,宿主可组合自己的通用展示。工具组件接收公开的 `ToolCallInfo`,主题及 Tailwind 编译方式与聊天视图相同;涉及会话资源的工具卡片仍需 `BladeProvider` 与对应会话权限。
|
|
466
|
+
|
|
463
467
|
## 第一方内部入口
|
|
464
468
|
|
|
465
469
|
- `@blade-hq/agent-react/internal`:内置 Web 与浏览器插件用的聊天内部块、判定逻辑和连接器组件。
|
|
@@ -489,3 +493,46 @@ blade-chat::part(input-toolbar) { gap: 12px; }
|
|
|
489
493
|
### 选择插件条目
|
|
490
494
|
|
|
491
495
|
ChatView 和 `<blade-chat>` 的默认轻量输入支持 @ 搜索插件条目,候选显示中文插件名和图标。选中条目在输入框上方显示,可点 × 移除;发送后保留选择,刷新后恢复最近用户消息的选择。富输入使用同样的候选接口与 PluginRef 身份。自动读取失败时模型会收到明确失败说明。
|
|
496
|
+
|
|
497
|
+
### 应用资料展示
|
|
498
|
+
|
|
499
|
+
共享聊天视图展示消息级 `context_attachments`:气泡只显示正文,资料标签可展开查看纯文本详情,`data` 中的内部 JSON 与 ID 不显示。`ChatSendOptions.contextAttachments` 可沿共享发送入口传入 SDK;可靠后台发送使用 `AgentSession.prepareSend` / `sendPrepared`。文件读取使用当前 `BladeProvider` 的 `BladeClient` 和资料指定的会话权限,失效或没有来源的文件显示「文件不可用」。内置 Web、扩展和嵌入视图使用相同实现。
|
|
500
|
+
|
|
501
|
+
### 独立嵌入提问卡片(React 19+)
|
|
502
|
+
|
|
503
|
+
自行管理消息时间线的宿主可从 `@blade-hq/agent-react/questions` 按需导入 `QuestionnaireQuestionBlock`(也导出为 `AskUserQuestionBlock`),无需加载整个 `ChatView`。该入口基于官方 shadcn Questionnaire,遵循 `@shadcn/react` 的 React 19+ 要求;原有 `ChatView` 入口及其问答渲染器保留 React 18 支持。
|
|
504
|
+
|
|
505
|
+
入口同时导出 `AskUserQuestionData` 和 `AskUserAnswerData` 类型。通过 `data`、`answered`、`answerData` 和 `sessionStatus` 提供问题及状态;`onAnswer(text, toolCallId, answerData)` 交给宿主,使用 `session.send(text, { askUserAnswer: { tool_call_id: toolCallId, ...answerData } })` 将原生结构化回答送回原始会话,不能送入普通文本队列。
|
|
506
|
+
|
|
507
|
+
Questionnaire 负责必答校验、原生单选/多选、自填和前后分页,不提供跳过问题的业务行为。宿主负责传输、提交失败反馈、刷新已保存的回答及主题样式;提交失败时以 `sessionStatus="failed"` 恢复当前选择供重试。问题类型及文本格式化函数与 BA 原生协议共用。
|
|
508
|
+
|
|
509
|
+
## 飞书授权接入
|
|
510
|
+
|
|
511
|
+
`ConnectorConnection` 通过 `type="device"` 或 `type="managed"` 选择连接方式,并接收对应连接组件的宿主回调。
|
|
512
|
+
|
|
513
|
+
`DeviceConnection` 接收宿主的 `read`、`act`、`onChanged` 回调及可选 `onDisable`、`diagnostics`。未传 `detail` 的授权界面可用 `initialPage="manage"` 在首次挂载时直达管理页;尚未关联应用时仍进入连接入口,不会自动创建应用或授权。初始权限采用飞书平台默认模板及官方 CLI 推荐清单,不以机器人/本人身份或 SW 已实现能力筛选。权限状态按企业侧开通、本人授权分别展示,未知不等于拒绝;工作能力目录另外说明当前能执行的操作。
|
|
514
|
+
|
|
515
|
+
首次关联应用后继续确认官方推荐的本人授权,允许两次扫码。企业审核要求以飞书页面为准;添加能力仍按当前操作核验和补充,核验失败保留连接与错误。统一授权流程按 `authorize` / `poll` 逐步展示当前飞书官方二维码,完成后显式 `finish`;PA 通过 `bindDelivery` 接入机器人消息,接入失败保留授权,可单独重试。完整分类选择在完成时替换启用集合,局部补权保留其他已选项;取消申请保留已有授权。增加能力时保留此助手原有停用状态,按钮显示“授权并保存”,暂停推送也不会被自动恢复。日志、历史步骤和原生错误编号放在连接帮助的高级排查内。
|
|
516
|
+
|
|
517
|
+
PA 等只需要授权界面的宿主可从 `@blade-hq/agent-react/connectors` 导入,避免加载整套聊天 UI。组件仅接收公开授权链接,二维码在本地生成。宿主须扫描组件源码(含 `FeishuCapabilitySelection.tsx`)的 Tailwind 样式,或使用 SDK 完整样式。认证身份变化时重建组件,避免沿用前一账号的视图。
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
### 聊天中的飞书连接
|
|
521
|
+
|
|
522
|
+
`@blade-hq/agent-react/connectors` 的 `DeviceConnection` 可传 `autoAuthorize`:仅在用户主动打开聊天授权卡片时开始准备官方二维码,设置页默认仍手动发起。`authorizationCapabilities` 用于只补当前操作需要的能力;已有有效二维码会继续使用,不重复生成。生成二维码不代表用户授权或企业审核已通过。
|
|
523
|
+
|
|
524
|
+
首次连接默认只申请机器人能力;需要本人能力时按操作补充授权。已有连接的选择和授权不受影响。
|
|
525
|
+
|
|
526
|
+
### 连接器管理详情
|
|
527
|
+
|
|
528
|
+
`ConnectorConnection` 的 `detail` 传入名称、图标和 `rules` 内容,使用共享的紧凑头部、更多操作、权限/诊断二级页与确认框。只在 PA 等拥有对应能力的宿主传入 `bindDelivery`、`detail.preferences`、`detail.onOpenPush`;不提供的能力不会生成空标签。停用只改变本地启用意图,移除才会清除托管凭据并停止收推,两者分别确认。
|
|
529
|
+
|
|
530
|
+
普通 schema / 网页登录连接使用 `ConfigConnection`,宿主提供表单或登录内容、连接状态及已鉴权的动作回调。`ConnectorDetail` 可组合其他连接方式;动作可通过 `description` 提供菜单中的影响说明;动作类型为 `ConnectorDetailAction`,宿主插槽类型为 `ConnectorDetailOptions`,签名见 [公开 API](public-api.md)。切换连接器或认证身份时按身份重建组件,授权轮询只由连接组件持有。
|
|
531
|
+
|
|
532
|
+
源码集成时扫描新增的 `ConnectorDetail.tsx` / `ConfigConnection.tsx`、使用的 UI composites;Shadow DOM 宿主沿用 `OverlayRootProvider`。生产集成保留浏览器与 schema 表单的按需加载,不为使用详情而加载整套聊天 UI。
|
|
533
|
+
|
|
534
|
+
### ConnectorRulesPanel
|
|
535
|
+
|
|
536
|
+
从 `@blade-hq/agent-react/connectors` 导入 `ConnectorRulesPanel`,传入稳定的 `read` 和 `update` 回调(调用 `client.connectors.rules/updateRules`)。组件展示分组、分类、三档设置与恢复默认;保存成功才替换当前值,失败保留原设置。宿主通过 `className` 与继承主题接入已有样式;`onCountChange` 返回可设置规则组数。详情中的 `compact` 隐藏重复标题,并默认显示第一个业务分类;仍可选择全部及恢复所有分类的默认设置。
|
|
537
|
+
|
|
538
|
+
连接器宿主可通过 `ConnectorDetailOptions.name` 提供连接器名。飞书待开通权限提醒按连接器名、连接身份与权限集合摘要记忆展开状态;缺失权限归零时清理该连接器的旧记录;直接组合 `ConnectorDetail` 时可用 `noticeStorageKey` 指定本地记忆键。localStorage 不可用时保留内存内交互。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -5,9 +5,7 @@ interface Props {
|
|
|
5
5
|
sessionId: string;
|
|
6
6
|
reasoning?: string;
|
|
7
7
|
hideAskUserQuestions?: boolean;
|
|
8
|
-
/** 初始展开(工作流步骤卡默认摊开,老 #1841 体验);等待回答仍强制展开。 */
|
|
9
8
|
defaultExpanded?: boolean;
|
|
10
|
-
/** 自定义卡头描述渲染(工作流用它把 {{ref}} 画成引用胶囊)。 */
|
|
11
9
|
renderDescription?: (description: string) => ReactNode;
|
|
12
10
|
}
|
|
13
11
|
export declare function AgentLoopBlock({ toolCall, sessionId, reasoning, hideAskUserQuestions, defaultExpanded, renderDescription, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import type { AskUserAnswerData } from "@blade-hq/agent-client";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
label: string;
|
|
5
|
-
description: string;
|
|
6
|
-
}
|
|
7
|
-
interface QuestionItem {
|
|
8
|
-
question: string;
|
|
9
|
-
options: OptionItem[];
|
|
10
|
-
multiSelect?: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface SourceLoopInfo {
|
|
13
|
-
loop_name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
}
|
|
16
|
-
export interface AskUserQuestionData {
|
|
17
|
-
questions: QuestionItem[];
|
|
18
|
-
source_loop?: SourceLoopInfo | null;
|
|
19
|
-
}
|
|
1
|
+
import type { AskUserAnswerData, AskUserQuestionData } from "@blade-hq/agent-client";
|
|
2
|
+
export { parseAskUserQuestion } from "@blade-hq/agent-client";
|
|
3
|
+
export type { AskUserAnswerData, AskUserQuestionData };
|
|
20
4
|
interface Props {
|
|
21
5
|
data: AskUserQuestionData;
|
|
22
6
|
answered: boolean;
|
|
@@ -26,7 +10,6 @@ interface Props {
|
|
|
26
10
|
onAnswer?: (answer: string, toolCallId: string, answerData: AskUserAnswerData) => void;
|
|
27
11
|
}
|
|
28
12
|
export declare function AskUserQuestionBlock({ data, answered, toolCallId, sessionStatus, answerData, onAnswer, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
export declare function parseAskUserQuestion(toolResult: string | null | undefined): AskUserQuestionData | null;
|
|
30
13
|
export interface AskUserQuestionError {
|
|
31
14
|
message: string;
|
|
32
15
|
detail: string | null;
|
|
@@ -7,14 +7,6 @@ interface Props {
|
|
|
7
7
|
sessionId: string;
|
|
8
8
|
messages: ChatMessage[];
|
|
9
9
|
isStreaming?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* 打字机式显示节流下,"正文还没播完"跟"思考过程本身有没有说完"是两条
|
|
12
|
-
* 独立时间线——正文通常比思考过程晚播完很久。"正在思考"/"已思考" 这个
|
|
13
|
-
* 标签只该看思考过程自己有没有播完,不能被 isStreaming(含正文节流)
|
|
14
|
-
* 拖着一起等正文播完才翻,否则会出现"正文都在吐字好几秒了,还显示正在
|
|
15
|
-
* 思考"这种跟视觉进度对不上的观感。不传时按旧行为处理(等价于思考过程
|
|
16
|
-
* 跟 isStreaming 同步)。
|
|
17
|
-
*/
|
|
18
10
|
isReasoningRevealing?: boolean;
|
|
19
11
|
isLastTurn?: boolean;
|
|
20
12
|
askAnswers?: Record<string, AskUserAnswerData>;
|
|
@@ -38,7 +30,7 @@ export declare function formatExecutionDuration(durationMs: number): string;
|
|
|
38
30
|
export declare function getExecutionDurationMs({ messages, isStreaming, now, }: {
|
|
39
31
|
messages: ChatMessage[];
|
|
40
32
|
isStreaming: boolean;
|
|
41
|
-
now?: number;
|
|
33
|
+
now?: number | null;
|
|
42
34
|
}): number;
|
|
43
35
|
declare function AssistantTurnBlockBase({ sessionId, messages: rawMessages, isStreaming, isReasoningRevealing, askAnswers, onAnswer, sessionStatus, level, forceExpanded, customization, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
44
36
|
export declare const AssistantTurnBlock: import("react").MemoExoticComponent<typeof AssistantTurnBlockBase>;
|
|
@@ -19,7 +19,6 @@ interface Props {
|
|
|
19
19
|
* token 靠 query 字符串携带,因此也不需要再挂 Authorization header。
|
|
20
20
|
*/
|
|
21
21
|
url: string | null;
|
|
22
|
-
/** text-like 视为"可文本预览";其他只显示下载按钮。 */
|
|
23
22
|
mode: "markdown" | "text" | "default";
|
|
24
23
|
}
|
|
25
24
|
export declare function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { ChatMessage } from "@blade-hq/agent-client/internal";
|
|
2
2
|
export declare function CurrentPlanPanelContent({ messages, running, autoReveal, sessionId, hideTodo, }: {
|
|
3
3
|
messages: ChatMessage[];
|
|
4
|
-
/** 会话是否还在执行;停止或加载历史时进度里的步骤不再转圈。 */
|
|
5
4
|
running?: boolean;
|
|
6
|
-
/** 仅当前这次消息变更来自实时成功的 update_plan 时为 true。 */
|
|
7
5
|
autoReveal?: boolean;
|
|
8
|
-
/** Key the plan block by session so switching sessions resets its local UI state. */
|
|
9
6
|
sessionId?: string;
|
|
10
7
|
hideTodo?: boolean;
|
|
11
8
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -5,15 +5,11 @@ export declare function collectDeliveredFiles(toolCalls: ToolCallInfo[], session
|
|
|
5
5
|
name: string;
|
|
6
6
|
}>;
|
|
7
7
|
export declare function DeliveryCard({ path, name, sessionId, description, displayName, compact, onOpen, onDownloadStarted, onDownloadSucceeded, }: {
|
|
8
|
-
/** 文件路径:工作目录下的相对路径,或容器内的绝对路径。 */
|
|
9
8
|
path: string;
|
|
10
9
|
name: string;
|
|
11
10
|
sessionId: string;
|
|
12
|
-
/** 副标题;不传时按扩展名显示「Markdown · AI 生成」这类默认说明。 */
|
|
13
11
|
description?: string;
|
|
14
|
-
/** 卡片可读名称;下载文件名仍使用 name。 */
|
|
15
12
|
displayName?: string;
|
|
16
|
-
/** 会话总结使用正文 MEDIA 卡片的紧凑样式。 */
|
|
17
13
|
compact?: boolean;
|
|
18
14
|
onOpen?: () => void;
|
|
19
15
|
onDownloadStarted?: () => void;
|
|
@@ -3,6 +3,5 @@ import type { FinalArtifact } from "@blade-hq/agent-client/internal";
|
|
|
3
3
|
export declare function FinalArtifactCards({ artifacts, sessionId, assistantEntryId, }: {
|
|
4
4
|
artifacts: FinalArtifact[];
|
|
5
5
|
sessionId: string;
|
|
6
|
-
/** 所属回复;交互事件(`onFollowupInteraction`)用它指明是哪一轮的成果。 */
|
|
7
6
|
assistantEntryId: string;
|
|
8
7
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -7,5 +7,5 @@ interface ImageLightboxProps {
|
|
|
7
7
|
}[];
|
|
8
8
|
initialIndex?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare function ImageLightbox({ open, onOpenChange, images, initialIndex }: ImageLightboxProps): import("react").
|
|
10
|
+
export declare function ImageLightbox({ open, onOpenChange, images, initialIndex }: ImageLightboxProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
11
|
export {};
|
|
@@ -10,9 +10,7 @@ type TextRow = {
|
|
|
10
10
|
text: string;
|
|
11
11
|
entryIds: string[];
|
|
12
12
|
failed?: boolean;
|
|
13
|
-
|
|
14
|
-
* 跟 AssistantTurnBlock.tsx 的 turnToolCalls/citations 同一套算法,不然轻量
|
|
15
|
-
* 模式下 插件引用的 [n] 角标只能停在纯文本,点不开、也 hover 不出来源。 */
|
|
13
|
+
sending?: boolean;
|
|
16
14
|
citations?: Record<number, CitationEntry>;
|
|
17
15
|
};
|
|
18
16
|
type MemoryRefsRow = {
|
|
@@ -54,6 +52,10 @@ type ContextDividerRow = {
|
|
|
54
52
|
type LiteRow = {
|
|
55
53
|
type: "background-wakeup";
|
|
56
54
|
key: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: "pack-event";
|
|
57
|
+
key: string;
|
|
58
|
+
title: string;
|
|
57
59
|
} | TextRow | MemoryRefsRow | FollowupRow | HistoricalFeedbackRow | QuestionRow | ToolDescriptionRow | ContextGroupRow | ContextDividerRow;
|
|
58
60
|
export declare function buildLiteRows({ messages, followup, sessionMessages, agentLoops, resultFeedbackByEntry, showContexts, }: {
|
|
59
61
|
messages: ChatMessage[];
|
|
@@ -2,11 +2,6 @@ import type { FileContentPart } from "@blade-hq/agent-client/internal";
|
|
|
2
2
|
interface MessageFileAttachmentListProps {
|
|
3
3
|
files: FileContentPart[];
|
|
4
4
|
className?: string;
|
|
5
|
-
/**
|
|
6
|
-
* R6:点击 pill 时的预览回调。不传时 pill 保持纯展示(向后兼容,Home /
|
|
7
|
-
* ChatDev 等复用点零改动)。调用方自己决定 URL 来源 + 渲染什么(lightbox /
|
|
8
|
-
* FilePreviewDialog / 下载等)。
|
|
9
|
-
*/
|
|
10
5
|
onPreview?: (file: FileContentPart) => void;
|
|
11
6
|
}
|
|
12
7
|
export declare function MessageFileAttachmentList({ files, className, onPreview, }: MessageFileAttachmentListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AskUserAnswerData, AskUserQuestionData } from "@blade-hq/agent-client";
|
|
2
|
+
export type { AskUserAnswerData, AskUserQuestionData };
|
|
3
|
+
interface Props {
|
|
4
|
+
data: AskUserQuestionData;
|
|
5
|
+
answered: boolean;
|
|
6
|
+
toolCallId: string;
|
|
7
|
+
sessionStatus: string;
|
|
8
|
+
answerData?: AskUserAnswerData | undefined;
|
|
9
|
+
onAnswer?: (answer: string, toolCallId: string, answerData: AskUserAnswerData) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function QuestionnaireQuestionBlock({ data, answered, toolCallId, sessionStatus, answerData, onAnswer }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { ParsedTextAttachment } from "@blade-hq/agent-client/internal";
|
|
2
2
|
interface TextAttachmentPillsProps {
|
|
3
3
|
attachments: ParsedTextAttachment[];
|
|
4
|
-
/**
|
|
5
|
-
* R6:点击 pill 时的预览回调。不传时保持纯展示(向后兼容)。
|
|
6
|
-
*/
|
|
7
4
|
onPreview?: (attachment: ParsedTextAttachment) => void;
|
|
8
5
|
}
|
|
9
6
|
export declare function TextAttachmentPills({ attachments, onPreview }: TextAttachmentPillsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
}
|
|
1
|
+
import type { TurnNavItem } from "../hooks/use-turn-navigation";
|
|
5
2
|
interface TurnNavRailProps {
|
|
6
3
|
items: TurnNavItem[];
|
|
7
4
|
activeTurnId: string | null;
|
|
8
5
|
onSelectTurn: (turnId: string) => void;
|
|
9
|
-
/** 正在请求定位的目标;null / 不传表示没有在途定位(开发者列表不传)。 */
|
|
10
6
|
loadingTurnId?: string | null;
|
|
11
|
-
/** 定位失败提示。 */
|
|
12
7
|
error?: string | null;
|
|
13
|
-
/** 定位失败的那条发言;重试按钮就再点它一次。 */
|
|
14
8
|
failedTurnId?: string | null;
|
|
15
9
|
}
|
|
16
10
|
export declare function TurnNavRail({ items, activeTurnId, onSelectTurn, loadingTurnId, error, failedTurnId, }: TurnNavRailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
import type { WorkflowRunEntry } from "@blade-hq/agent-client";
|
|
1
2
|
import type { ToolCallInfo } from "@blade-hq/agent-client/internal";
|
|
3
|
+
import type { InputSessionSkill } from "./runtime/input-services";
|
|
2
4
|
interface Props {
|
|
3
|
-
/** 触发这次运行的 workflow:run 工具调用。 */
|
|
4
5
|
toolCall: ToolCallInfo;
|
|
5
6
|
sessionId: string;
|
|
6
7
|
}
|
|
8
|
+
/** 标题里的技能 id 换成会话技能列表里的中文名;查不到(未加载/已卸载)就保留 id。 */
|
|
9
|
+
export declare function workflowTitle(name: string, argumentsJson: string, skills: readonly Pick<InputSessionSkill, "skill_id" | "display_name">[]): string;
|
|
10
|
+
type StepGroup = {
|
|
11
|
+
key: string;
|
|
12
|
+
desc: string;
|
|
13
|
+
stepId: string;
|
|
14
|
+
stepKind: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
logs: string[];
|
|
17
|
+
};
|
|
18
|
+
/** 事件流 → 步骤分组:每个 step 事件开一张卡。log 行带所属步骤 id 时归到那一步
|
|
19
|
+
* (并行分支的输出不按宣告顺序到达,按位置归会挂错卡);旧记录没有 id 才归到上一步。 */
|
|
20
|
+
export declare function groupWorkflowEntries(entries: readonly WorkflowRunEntry[]): {
|
|
21
|
+
prelude: string[];
|
|
22
|
+
groups: StepGroup[];
|
|
23
|
+
};
|
|
7
24
|
/**
|
|
8
|
-
*
|
|
9
|
-
* (agent 步骤=完整子智能体卡,命令/条件步骤=描述+输出的小卡),头部可整体折叠。
|
|
10
|
-
*
|
|
25
|
+
* 「固定流程」块:一次 workflow:run(跑某个技能的 flows/*.yaml)的执行呈现——每个步骤
|
|
26
|
+
* 一张卡顺序铺开(agent 步骤=完整子智能体卡,命令/条件步骤=描述+输出的小卡),头部可整体折叠。
|
|
27
|
+
* 渲染在触发它的回合的「执行过程」折叠区里,和普通技能的工具调用同一个位置。
|
|
11
28
|
*/
|
|
12
29
|
export declare function WorkflowRunBlock({ toolCall, sessionId }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
30
|
export {};
|
|
@@ -6,10 +6,6 @@ export interface TextShimmerProps {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
spread?: number;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* 流式等待时的扫光文字。动画是纯 CSS(`blade-shimmer-sweep`,定义在 chat.css),
|
|
11
|
-
* 不引入动画库。
|
|
12
|
-
*/
|
|
13
9
|
declare const ShimmerComponent: ({ children, as: Component, className, duration, spread, }: TextShimmerProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
10
|
export declare const Shimmer: import("react").MemoExoticComponent<typeof ShimmerComponent>;
|
|
15
11
|
export {};
|
|
@@ -30,7 +30,7 @@ export type ChatViewClassNames = Partial<{
|
|
|
30
30
|
skillStatusBarInner: string;
|
|
31
31
|
}>;
|
|
32
32
|
/** 输入框提交时的附加项(模型、推理档位、知识库等由富输入给出)。 */
|
|
33
|
-
export interface ChatSendOptions extends Pick<ChatSendExtras, "thinkingOverride" | "reasoningLevel" | "refs" | "topicAssetRefs" | "queueWhenRunning"> {
|
|
33
|
+
export interface ChatSendOptions extends Pick<ChatSendExtras, "thinkingOverride" | "reasoningLevel" | "refs" | "contextAttachments" | "topicAssetRefs" | "queueWhenRunning"> {
|
|
34
34
|
/** 附件实际上传到的会话(首页新建会话时由输入框给出)。 */
|
|
35
35
|
targetSessionId?: string;
|
|
36
36
|
/** 本条消息用的模型;null 表示沿用会话已保存的模型。 */
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export { TextAttachmentPills } from "./TextAttachmentPills";
|
|
|
27
27
|
export { getFilePreviewName, ToolFilePreviewAction, ToolPreviewAction, resolveAskQuestionState, ToolCallBlock } from "./ToolCallBlock";
|
|
28
28
|
export { ToolUiCard } from "./ToolUiCard";
|
|
29
29
|
export { TurnNavRail } from "./TurnNavRail";
|
|
30
|
-
export
|
|
30
|
+
export { turnLocateChannel, useTurnLocateRequest, useTurnLocateStatus } from "./turn-locate-channel";
|
|
31
|
+
export type { TurnLocateRequest, TurnLocateStatus } from "./turn-locate-channel";
|
|
31
32
|
export { isUserMessage, isErrorMessage, USER_MESSAGE_MARKDOWN_CLASS, UserMessageBubble, ErrorMessageBlock } from "./UserMessageBubble";
|
|
32
33
|
export type { UserChatMessage, ErrorChatMessage } from "./UserMessageBubble";
|
|
33
34
|
export { WorkflowRunBlock } from "./WorkflowRunBlock";
|
|
@@ -91,7 +92,7 @@ export { getRenderer } from "./tool-renderers/registry";
|
|
|
91
92
|
export { getResultText, getResultImages, parseJsonValue, isPlainObject, getStringValue, getNumberValue, getBooleanValue, extractErrorMessage, getFileName, getCodeLanguage, formatBytes, CodePreview } from "./tool-renderers/shared";
|
|
92
93
|
export { shouldFollowWritePreview, scrollWritePreviewToLatest } from "./tool-renderers/write-preview-scroll";
|
|
93
94
|
export { skillDisplayName } from "./lib/skill-name";
|
|
94
|
-
export { type ConnectorComputerSectionProps, type InputConnection, type InputDataState, type InputModelCatalog, type InputModelOption, type InputModelPreferences, type InputSessionSkill, type InputSkillStats, type RichInputServices, parseModelReasoningLevels, RichInputServicesProvider, useRichInputServices, } from "./runtime/input-services";
|
|
95
|
+
export { type ConnectorComputerSectionProps, type ConnectorPhoneSectionProps, type InputConnection, type InputDataState, type InputModelCatalog, type InputModelOption, type InputModelPreferences, type InputSessionSkill, type InputSkillStats, type RichInputServices, parseModelReasoningLevels, RichInputServicesProvider, useRichInputServices, } from "./runtime/input-services";
|
|
95
96
|
export { backgroundTaskDismissals, useDismissedBackgroundTasks } from "./runtime/background-task-dismissals";
|
|
96
97
|
export { visibleSkillIds, visibleSkills } from "./lib/skill-visibility";
|
|
97
98
|
export { resetInputCaches } from "./runtime/input-cache-reset";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
2
2
|
type AnchorProps = ComponentPropsWithRef<"a">;
|
|
3
|
-
/**
|
|
3
|
+
/** 连接器登录入口使用浮层,其余链接新窗口打开并断开 opener。
|
|
4
4
|
* 页内锚点(脚注引用/回链这类 `href="#fn-note"`)不能套"新窗口打开"这套
|
|
5
5
|
* 逻辑——新开一个标签页访问 `#片段` 只是把整篇文档重新打开一次,不是
|
|
6
6
|
* 滚动到页内位置,会破坏脚注的跳转体验。只有真正的外部链接才需要新窗口
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type MarkdownRendererProps } from "../../components/markdown";
|
|
2
2
|
import { normalizeAdjacentUrlFormatting } from "./text";
|
|
3
|
+
import { type ComponentPropsWithRef } from "react";
|
|
3
4
|
import type { CitationEntry } from "../lib/citations";
|
|
4
5
|
export { normalizeAdjacentUrlFormatting };
|
|
6
|
+
type PreProps = ComponentPropsWithRef<"pre">;
|
|
5
7
|
export declare function resolveCollapsedContent({ dataKeyAttribute, dataRawAttribute, children, }: {
|
|
6
8
|
dataKeyAttribute?: string;
|
|
7
9
|
dataRawAttribute?: string;
|
|
8
10
|
children?: unknown;
|
|
9
11
|
}): string;
|
|
12
|
+
export declare function CodeBlockPre({ children, ...props }: PreProps): import("react/jsx-runtime").JSX.Element;
|
|
10
13
|
export declare function collapseInlineToolCalls(children: string): string;
|
|
11
14
|
/** `[n]` 形式的引用角标,只有在 `citations` 里能查到 n 对应的证据时才替换成可交互标签
|
|
12
15
|
* `<blade-citation-ref data-n="n">`;查不到就原样留作纯文本——不给用户一个点了却没有
|
|
@@ -78,7 +78,6 @@ export declare function selectActiveTurnAtViewportPosition({ visibleTurns, conta
|
|
|
78
78
|
containerBottom: number;
|
|
79
79
|
fallbackTurnId: string | null;
|
|
80
80
|
currentTurnId?: string | null;
|
|
81
|
-
/** 滚动容器已到底。 */
|
|
82
81
|
atBottom?: boolean;
|
|
83
82
|
}): string | null;
|
|
84
83
|
/** 测试双通道最终渲染计划时忽略仅影响布局的 wrapper。 */
|
|
@@ -9,13 +9,13 @@ export interface ChatSendExtras {
|
|
|
9
9
|
model?: string;
|
|
10
10
|
thinkingOverride?: boolean;
|
|
11
11
|
reasoningLevel?: string;
|
|
12
|
+
contextAttachments?: SendOptions["contextAttachments"];
|
|
12
13
|
refs?: SendOptions["refs"];
|
|
13
14
|
topicAssetRefs?: SendOptions["topicAssetRefs"];
|
|
14
15
|
whatif?: SendOptions["whatif"];
|
|
15
16
|
replayDecision?: SendOptions["replayDecision"];
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
* 没有面板时排队等于消息凭空消失。
|
|
18
|
+
* 默认发送引导消息;显式为 true 时,等待当前运行结束后处理。
|
|
19
19
|
*/
|
|
20
20
|
queueWhenRunning?: boolean;
|
|
21
21
|
}
|
|
@@ -3,7 +3,6 @@ export declare const backgroundTaskDismissals: {
|
|
|
3
3
|
getState: () => Dismissed;
|
|
4
4
|
subscribe(listener: () => void): () => void;
|
|
5
5
|
dismiss(sessionId: string, taskId: string): void;
|
|
6
|
-
/** 换身份:清空。 */
|
|
7
6
|
reset(): void;
|
|
8
7
|
};
|
|
9
8
|
export declare function useDismissedBackgroundTasks(sessionId: string): string[];
|
|
@@ -38,11 +38,8 @@ export declare const composerChannels: {
|
|
|
38
38
|
clearSendRequests(sessionId: string): void;
|
|
39
39
|
setModelDraft(sessionId: string, model: string): void;
|
|
40
40
|
clearModelDraft(sessionId: string): void;
|
|
41
|
-
/** 回退到某一步后,把那一步的用户原话放回输入框(null 清除)。 */
|
|
42
41
|
setRewindDraft(sessionId: string, text: string | null): void;
|
|
43
|
-
/** 会话被关闭 / 删除:清掉它还没被取走的信号。 */
|
|
44
42
|
clearSession(sessionId: string): void;
|
|
45
|
-
/** 换身份:清空全部通道。 */
|
|
46
43
|
reset(): void;
|
|
47
44
|
};
|
|
48
45
|
export type ComposerChannels = typeof composerChannels;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 换身份(登出、换账号、换后端)时清掉富输入按 client 缓存的数据(技能菜单、模型目录等),
|
|
3
|
-
* 新身份不会看到上一个身份的清单。富输入的缓存在这里登记清理函数;宿主在身份变化时调用
|
|
4
|
-
* `resetInputCaches`。放在 internal 入口,宿主调用它不必引入富输入。
|
|
5
|
-
*/
|
|
6
1
|
import type { BladeClient } from "@blade-hq/agent-client";
|
|
7
2
|
export declare function onInputCachesReset(client: BladeClient, reset: () => void): () => void;
|
|
8
3
|
export declare function resetInputCaches(client: BladeClient): void;
|
|
@@ -64,6 +64,14 @@ export interface InputDataState<T> {
|
|
|
64
64
|
error: unknown;
|
|
65
65
|
}
|
|
66
66
|
export interface ConnectorComputerSectionProps {
|
|
67
|
+
sessionId: string | null;
|
|
68
|
+
query: string;
|
|
69
|
+
excludedSelection?: string[];
|
|
70
|
+
onExcludedSelectionChange?: (ids: string[]) => void;
|
|
71
|
+
/** 收起连接器面板(打开设置之类的动作前调用)。 */
|
|
72
|
+
closePanel: () => void;
|
|
73
|
+
}
|
|
74
|
+
export interface ConnectorPhoneSectionProps {
|
|
67
75
|
sessionId: string | null;
|
|
68
76
|
query: string;
|
|
69
77
|
pendingSelection?: string[];
|
|
@@ -92,6 +100,8 @@ export interface RichInputServices {
|
|
|
92
100
|
};
|
|
93
101
|
/** 连接器面板里的「电脑」分区;不提供时不显示。 */
|
|
94
102
|
ConnectorComputerSection?: ComponentType<ConnectorComputerSectionProps>;
|
|
103
|
+
/** 连接器面板里的「手机」分区,渲染在「电脑」下面;不提供时不显示。 */
|
|
104
|
+
ConnectorPhoneSection?: ComponentType<ConnectorPhoneSectionProps>;
|
|
95
105
|
/** 连接器面板里的「外部账号」分区;不提供时不显示。 */
|
|
96
106
|
ConnectorAccountsSection?: ComponentType<{
|
|
97
107
|
query: string;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 聊天组件读会话状态的来源。组件只认 `AgentSession`,不关心实例由谁持有:
|
|
3
|
-
* 内置 Web 用自己的会话登记表(含静态会话、保留区),SDK 的 ChatView / `<blade-chat>` / 插件
|
|
4
|
-
* 用 `useAgentSession` 持有的那一个实例(`createSingleSessionSource`)。
|
|
5
|
-
*/
|
|
6
1
|
import { type AgentSession, type SessionState } from "@blade-hq/agent-client/internal";
|
|
7
2
|
import { type ReactNode } from "react";
|
|
8
3
|
export interface SessionSource {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 聊天面板的动作与交互态:发送(等待回答时自动当作作答)、停止(带「停止中」)、等待消息队列命令
|
|
3
|
-
* (冲突提示与进行中的条目)。全部直接作用在会话实例上。
|
|
4
|
-
*/
|
|
5
1
|
import type { MessageContent } from "@blade-hq/agent-client/internal";
|
|
6
2
|
import { type ChatSendExtras } from "./actions";
|
|
7
3
|
export declare function useChatActions(sessionId: string): {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 跨组件「定位到某条发言」的请求通道。
|
|
3
|
+
*
|
|
4
|
+
* 消息列表(MessageList)与右侧脉络面板不在同一棵组件树里,而定位到窗口外
|
|
5
|
+
* 的历史发言需要 MessageList 内部的虚拟列表状态(isEntryLoaded / revealEntry /
|
|
6
|
+
* 滚动容器),脉络面板拿不到这些。这里用一个模块级 store 把「点击脉络里的
|
|
7
|
+
* 某条发言」变成一条带序号的信令,MessageList 监听后在它自己的
|
|
8
|
+
* useTurnNavigation.selectEntry 里执行完整定位(跨页加载 + 滚动 + 高亮)。
|
|
9
|
+
*
|
|
10
|
+
* 与 composer-channels 同一模式:module singleton + 订阅回调,
|
|
11
|
+
* 不依赖任何宿主 store,SDK 内可复用。
|
|
12
|
+
*/
|
|
13
|
+
export interface TurnLocateRequest {
|
|
14
|
+
entryId: string;
|
|
15
|
+
/** 单调递增,避免「同一条发言点两次」或「晚到的旧信号」被误判成新请求。 */
|
|
16
|
+
seq: number;
|
|
17
|
+
}
|
|
18
|
+
/** 执行侧回传的进度:面板据此显示「正在定位」/失败提示。 */
|
|
19
|
+
export interface TurnLocateStatus {
|
|
20
|
+
seq: number;
|
|
21
|
+
entryId: string;
|
|
22
|
+
state: "pending" | "failed";
|
|
23
|
+
}
|
|
24
|
+
export declare const turnLocateChannel: {
|
|
25
|
+
getState: () => Record<string, TurnLocateRequest>;
|
|
26
|
+
getStatus: () => Record<string, TurnLocateStatus>;
|
|
27
|
+
request(sessionId: string, entryId: string): void;
|
|
28
|
+
/** 执行侧回传进度;只有最新一次请求的结果会被接受。 */
|
|
29
|
+
report(sessionId: string, seq: number, state: TurnLocateStatus["state"]): void;
|
|
30
|
+
/** 定位完成(成功):清掉进度,面板不再显示「正在定位」。 */
|
|
31
|
+
clearStatus(sessionId: string, seq: number): void;
|
|
32
|
+
subscribe(listener: () => void): () => void;
|
|
33
|
+
/** 某条信令已被消费:同 seq 不再重复定位(避免重新挂载时又跳一次)。 */
|
|
34
|
+
consume(sessionId: string, seq: number): void;
|
|
35
|
+
/** 只清进度、不动未消费的请求(列表卸载时用)。 */
|
|
36
|
+
clearStatusForSession(sessionId: string): void;
|
|
37
|
+
clearSession(sessionId: string): void;
|
|
38
|
+
reset(): void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 订阅某个会话的定位请求。
|
|
42
|
+
*
|
|
43
|
+
* 用「命令式订阅 + useState」而不是 useSyncExternalStore:每条信令都是一次
|
|
44
|
+
* **一次性事件**(点一下就执行一次),store 里不留状态,消费完立即清空。
|
|
45
|
+
* useSyncExternalStore 要的是「可重复读取的快照」,在这种事件通道上反而容易
|
|
46
|
+
* 因为快照被清空/重读而漏掉那一次更新。
|
|
47
|
+
*/
|
|
48
|
+
export declare function useTurnLocateRequest(sessionId: string | null | undefined): TurnLocateRequest | null;
|
|
49
|
+
/**
|
|
50
|
+
* 订阅某个会话最近一次定位的进度。面板用它显示「正在定位」和失败提示——
|
|
51
|
+
* 定位实际由消息列表执行,面板自己的 useTurnNavigation 拿不到这份状态。
|
|
52
|
+
*/
|
|
53
|
+
export declare function useTurnLocateStatus(sessionId: string | null | undefined): TurnLocateStatus | null;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* 聊天组件共用的非 Tailwind 规则(Markdown 排版、入场动画、扫光)。内置 Web 与插件经 agent/style.css
|
|
3
|
-
* 引入这一份;<blade-chat> 与 npm 样式由 scripts/gen-embed-styles.mjs 放进 blade-chat-overrides 层。
|
|
4
|
-
* 只写聊天组件自己用到的规则,页面级补丁不放这里。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
[data-theme="light"] .prose-invert {
|
|
8
2
|
--tw-prose-body: hsl(var(--foreground));
|
|
9
3
|
--tw-prose-headings: hsl(var(--foreground));
|
|
@@ -25,9 +19,7 @@
|
|
|
25
19
|
color: hsl(var(--primary));
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
/* typography 插件默认 p/li/heading 外边距偏大(1.25em/0.5em),聊天里读起来太松。
|
|
30
|
-
plain 选择器特异性高于插件的 :where(),可直接覆盖。 */
|
|
22
|
+
|
|
31
23
|
.chat-prose p {
|
|
32
24
|
margin-top: 0.5em;
|
|
33
25
|
margin-bottom: 0.5em;
|
|
@@ -85,12 +77,7 @@
|
|
|
85
77
|
margin-bottom: 1.2em;
|
|
86
78
|
}
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
* 渲染、只用透明度标出"待确认"——内容和标签结构全程不变,闭合符到达后
|
|
90
|
-
* 这条规则自然不再匹配,恢复完全不透明,DOM 节点没有被替换过。这个属性
|
|
91
|
-
* 只由 MarkdownRenderer 引擎自己产出,不区分调用方用的是哪套 prose 外壳
|
|
92
|
-
* (`.chat-prose`/`.prose`/`.lite-chat-markdown`/无外壳),不按外壳类名
|
|
93
|
-
* 逐个补,直接全局生效。 */
|
|
80
|
+
|
|
94
81
|
[data-markdown-pending="true"] {
|
|
95
82
|
opacity: 0.6;
|
|
96
83
|
}
|
|
@@ -108,7 +95,7 @@
|
|
|
108
95
|
overflow-x: auto;
|
|
109
96
|
}
|
|
110
97
|
|
|
111
|
-
|
|
98
|
+
|
|
112
99
|
@keyframes msg-in {
|
|
113
100
|
from {
|
|
114
101
|
opacity: 0;
|
|
@@ -124,7 +111,7 @@
|
|
|
124
111
|
animation: msg-in 0.15s ease-out forwards;
|
|
125
112
|
}
|
|
126
113
|
|
|
127
|
-
|
|
114
|
+
|
|
128
115
|
.status-sweep::after {
|
|
129
116
|
content: "";
|
|
130
117
|
position: absolute;
|
|
@@ -153,7 +140,7 @@
|
|
|
153
140
|
}
|
|
154
141
|
}
|
|
155
142
|
|
|
156
|
-
|
|
143
|
+
|
|
157
144
|
@keyframes blade-shimmer-sweep {
|
|
158
145
|
from {
|
|
159
146
|
background-position: 100% center;
|