@blade-hq/agent-react 2612.0.0-beta.6 → 2612.0.0-beta.60

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.
Files changed (112) hide show
  1. package/README.md +30 -1
  2. package/dist/chat/AgentLoopBlock.d.ts +0 -2
  3. package/dist/chat/AskUserQuestionBlock.d.ts +3 -20
  4. package/dist/chat/AssistantTurnBlock.d.ts +1 -9
  5. package/dist/chat/AttachmentPreviewDialog.d.ts +0 -1
  6. package/dist/chat/ChatLoadingIndicator.d.ts +7 -0
  7. package/dist/chat/ContextAttachmentPills.d.ts +4 -0
  8. package/dist/chat/CurrentPlanPanel.d.ts +0 -3
  9. package/dist/chat/FileDeliveryCards.d.ts +0 -4
  10. package/dist/chat/FinalArtifactCards.d.ts +0 -1
  11. package/dist/chat/ImageLightbox.d.ts +1 -1
  12. package/dist/chat/LiteMessageList.d.ts +1 -3
  13. package/dist/chat/MessageFileAttachmentList.d.ts +0 -5
  14. package/dist/chat/QuestionnaireQuestionBlock.d.ts +11 -0
  15. package/dist/chat/SessionReplayBar.d.ts +0 -1
  16. package/dist/chat/TextAttachmentPills.d.ts +0 -3
  17. package/dist/chat/TurnNavRail.d.ts +0 -3
  18. package/dist/chat/WorkflowRunBlock.d.ts +21 -4
  19. package/dist/chat/ai-elements/shimmer.d.ts +0 -4
  20. package/dist/chat/customization.d.ts +1 -1
  21. package/dist/chat/index.d.ts +1 -4
  22. package/dist/chat/lib/citations.d.ts +2 -23
  23. package/dist/chat/markdown/ExternalAnchor.d.ts +2 -2
  24. package/dist/chat/markdown/MarkdownContent.d.ts +3 -0
  25. package/dist/chat/message-list-blocks.d.ts +0 -1
  26. package/dist/chat/runtime/actions.d.ts +2 -3
  27. package/dist/chat/runtime/background-task-dismissals.d.ts +0 -1
  28. package/dist/chat/runtime/composer-channels.d.ts +0 -3
  29. package/dist/chat/runtime/input-cache-reset.d.ts +0 -5
  30. package/dist/chat/runtime/input-services.d.ts +10 -6
  31. package/dist/chat/runtime/session-source.d.ts +0 -5
  32. package/dist/chat/runtime/use-chat-actions.d.ts +0 -4
  33. package/dist/{chat-OCLOVB3H.css → chat-IHPRU35X.css} +5 -18
  34. package/dist/chat.css +5 -18
  35. package/dist/chunk-2E6DQCXM.js +602 -0
  36. package/dist/chunk-2E6DQCXM.js.map +1 -0
  37. package/dist/chunk-ARX4JV5T.js +1988 -0
  38. package/dist/chunk-ARX4JV5T.js.map +1 -0
  39. package/dist/chunk-HBMFIJG2.js +13622 -0
  40. package/dist/chunk-HBMFIJG2.js.map +1 -0
  41. package/dist/chunk-HS5G33FO.js +6894 -0
  42. package/dist/chunk-HS5G33FO.js.map +1 -0
  43. package/dist/{chunk-UKQFSXGC.js → chunk-MAFNMG2O.js} +2419 -13726
  44. package/dist/chunk-MAFNMG2O.js.map +1 -0
  45. package/dist/{chunk-XJLFFRQP.js → chunk-UC7SY3G5.js} +3744 -25994
  46. package/dist/chunk-UC7SY3G5.js.map +1 -0
  47. package/dist/chunk-VSIUEXGV.js +4981 -0
  48. package/dist/chunk-VSIUEXGV.js.map +1 -0
  49. package/dist/chunk-XV6AO37F.js +9480 -0
  50. package/dist/chunk-XV6AO37F.js.map +1 -0
  51. package/dist/components/AccountConnectors.d.ts +13 -0
  52. package/dist/components/BrowserConnectionDialog.d.ts +7 -0
  53. package/dist/components/ChatInput.d.ts +1 -15
  54. package/dist/components/ConnectorAuthorizationProgress.d.ts +6 -0
  55. package/dist/components/ConnectorPanel.d.ts +3 -1
  56. package/dist/components/ConnectorRuntimeDiagnostics.d.ts +5 -0
  57. package/dist/components/DeviceConnection.d.ts +15 -0
  58. package/dist/components/FeishuCapabilitySelection.d.ts +14 -0
  59. package/dist/components/FeishuPermissionStatus.d.ts +5 -0
  60. package/dist/components/LlmAdvancedSettings.d.ts +0 -1
  61. package/dist/components/PlanUpdateBlock.d.ts +0 -1
  62. package/dist/components/SessionPluginConfigForm.d.ts +3 -1
  63. package/dist/components/plugin-connector.d.ts +1 -0
  64. package/dist/connectors.d.ts +1 -0
  65. package/dist/connectors.js +9 -0
  66. package/dist/connectors.js.map +1 -0
  67. package/dist/embed/blade-chat-element.d.ts +0 -8
  68. package/dist/embed/entry.d.ts +8 -19
  69. package/dist/hooks/use-message-pin.d.ts +1 -1
  70. package/dist/host.d.ts +0 -4
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.js +12 -3
  73. package/dist/internal.d.ts +4 -2
  74. package/dist/internal.js +45 -70
  75. package/dist/internal.js.map +1 -1
  76. package/dist/lib/message-shortcuts.d.ts +5 -0
  77. package/dist/questions.d.ts +7 -0
  78. package/dist/questions.js +909 -0
  79. package/dist/questions.js.map +1 -0
  80. package/dist/rich-input/ConnectButton.d.ts +7 -5
  81. package/dist/rich-input/FileCompletionMenu.d.ts +5 -11
  82. package/dist/rich-input/InputActionSubmenu.d.ts +10 -0
  83. package/dist/rich-input/SkillActionMenu.d.ts +10 -0
  84. package/dist/rich-input/SkillStatusBar.d.ts +0 -6
  85. package/dist/rich-input/extensions/skill-mention.d.ts +3 -20
  86. package/dist/rich-input/index.d.ts +3 -4
  87. package/dist/rich-input/lib/composer-content.d.ts +7 -22
  88. package/dist/rich-input/lib/plugin-suggestions.d.ts +5 -5
  89. package/dist/rich-input/lib/reference-candidates.d.ts +0 -4
  90. package/dist/rich-input/lib/skill-suggestions.d.ts +1 -1
  91. package/dist/rich-input/lib/user-home.d.ts +0 -17
  92. package/dist/rich-input/services.d.ts +2 -3
  93. package/dist/rich-input/voice/VoiceWaveform.d.ts +0 -3
  94. package/dist/rich-input.js +786 -1300
  95. package/dist/rich-input.js.map +1 -1
  96. package/dist/style.css +16 -55
  97. package/dist/style.full.css +23 -77
  98. package/dist/tool-details.d.ts +8 -0
  99. package/dist/tool-details.js +24 -0
  100. package/dist/tool-details.js.map +1 -0
  101. package/package.json +15 -3
  102. package/public-api.md +10 -5
  103. package/dist/chat/tool-renderers/KbSearchRenderer.d.ts +0 -2
  104. package/dist/chat/tool-renderers/kb-search-result.d.ts +0 -19
  105. package/dist/chunk-IRBOKMF5.js +0 -258
  106. package/dist/chunk-IRBOKMF5.js.map +0 -1
  107. package/dist/chunk-UKQFSXGC.js.map +0 -1
  108. package/dist/chunk-XJLFFRQP.js.map +0 -1
  109. package/dist/lib/agent-computer-command.d.ts +0 -32
  110. package/dist/rich-input/extensions/kb-mention.d.ts +0 -18
  111. package/dist/rich-input/extensions/workflow-mention.d.ts +0 -10
  112. package/dist/rich-input/lib/kb-suggestions.d.ts +0 -37
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 与浏览器插件用的聊天内部块、判定逻辑和连接器组件。
@@ -478,7 +482,7 @@ blade-chat::part(input-toolbar) { gap: 12px; }
478
482
 
479
483
  主题资产候选通过当前主题的资产列表获取,使用专用 `TopicAssetMention` 药丸;没有关联主题时不展示候选。首页与会话输入框复用候选查询、引用序列化和展示结构。
480
484
 
481
- `useReferenceCandidates(getScope, { kbs, topics, files })` 在富输入子入口提供固定三组候选的并发查询、短等待与迟到刷新;作用域为 client、鉴权身份、session、topic,菜单使用 query 返回数组绑定 observe,退出时 cancel。宿主继续提供原有数据适配,控制器不执行工具或改写发送协议。
485
+ `useReferenceCandidates(getScope, { plugins, topics, files })` 在富输入子入口提供固定三组候选的并发查询、短等待与迟到刷新;作用域为 client、鉴权身份、session、topic,菜单使用 query 返回数组绑定 observe,退出时 cancel。宿主继续提供原有数据适配,控制器不执行工具或改写发送协议。
482
486
 
483
487
  `queueTopicAssetReference(sessionId, { topic_id, path })`(`@blade-hq/agent-react/rich-input`)可在导航到当前用户的同主题会话前预填引用。发送只携带引用身份,元数据和权限由服务端重新判断;本轮续跑保留引用,下一条消息默认不继承。
484
488
 
@@ -489,3 +493,28 @@ 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
+ `DeviceConnection` 接收宿主的 `read`、`act`、`onChanged` 回调及可选 `onDisable`、`diagnostics`。宿主可用 `initialPage="manage"` 在首次挂载时直达管理页;尚未关联应用时仍进入连接入口,不会自动创建应用或授权。初始权限采用飞书平台默认模板及官方 CLI 推荐清单,不以机器人/本人身份或 SW 已实现能力筛选。权限状态按企业侧开通、本人授权分别展示,未知不等于拒绝;工作能力目录另外说明当前能执行的操作。
512
+
513
+ 首次关联应用后继续确认官方推荐的本人授权,允许两次扫码。企业审核要求以飞书页面为准;添加能力仍按当前操作核验和补充,核验失败保留连接与错误。统一授权流程按 `authorize` / `poll` 逐步展示当前飞书官方二维码,完成后显式 `finish`;PA 通过 `bindDelivery` 接入机器人消息,接入失败保留授权,可单独重试。完整分类选择在完成时替换启用集合,局部补权保留其他已选项;取消申请保留已有授权。增加能力时保留此助手原有停用状态,按钮显示“授权并保存”,暂停推送也不会被自动恢复。日志、历史步骤和原生错误编号放在连接帮助的高级排查内。
514
+
515
+ PA 等只需要授权界面的宿主可从 `@blade-hq/agent-react/connectors` 导入,避免加载整套聊天 UI。组件仅接收公开授权链接,二维码在本地生成。宿主须扫描组件源码(含 `FeishuCapabilitySelection.tsx`)的 Tailwind 样式,或使用 SDK 完整样式。认证身份变化时重建组件,避免沿用前一账号的视图。
516
+
517
+
518
+ ### 聊天中的飞书连接
519
+
520
+ `@blade-hq/agent-react/connectors` 的 `DeviceConnection` 可传 `autoAuthorize`:仅在用户主动打开聊天授权卡片时开始准备官方二维码,设置页默认仍手动发起。`authorizationCapabilities` 用于只补当前操作需要的能力;已有有效二维码会继续使用,不重复生成。生成二维码不代表用户授权或企业审核已通过。
@@ -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 type { AskUserAnswerData };
3
- interface OptionItem {
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;
@@ -0,0 +1,7 @@
1
+ export declare function isPreparingReply(messages: readonly {
2
+ role: string;
3
+ kind?: string;
4
+ }[]): boolean;
5
+ export declare function ChatLoadingIndicator({ preparing }: {
6
+ preparing?: boolean;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { ContextAttachment } from "@blade-hq/agent-client";
2
+ export declare function ContextAttachmentPills({ attachments }: {
3
+ attachments?: ContextAttachment[];
4
+ }): 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").ReactPortal | null;
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
- /** 本轮(含子智能体循环)真实检索到的引用证据,只有 assistant 文本行才有——
14
- * 跟 AssistantTurnBlock.tsx 的 turnToolCalls/citations 同一套算法,不然轻量
15
- * 模式下 kb_search 的 [n] 角标只能停在纯文本,点不开、也 hover 不出来源。 */
13
+ sending?: boolean;
16
14
  citations?: Record<number, CitationEntry>;
17
15
  };
18
16
  type MemoryRefsRow = {
@@ -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;
@@ -7,6 +7,5 @@
7
7
  export declare function SessionReplayBar({ sessionId, className, onExit, }: {
8
8
  sessionId: string;
9
9
  className?: string;
10
- /** 宿主自己接管了「输入对不上录制内容」的处理时传入:退出要先了结那次待定的决定。 */
11
10
  onExit?: () => void;
12
11
  }): 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;
@@ -6,11 +6,8 @@ interface TurnNavRailProps {
6
6
  items: TurnNavItem[];
7
7
  activeTurnId: string | null;
8
8
  onSelectTurn: (turnId: string) => void;
9
- /** 正在请求定位的目标;null / 不传表示没有在途定位(开发者列表不传)。 */
10
9
  loadingTurnId?: string | null;
11
- /** 定位失败提示。 */
12
10
  error?: string | null;
13
- /** 定位失败的那条发言;重试按钮就再点它一次。 */
14
11
  failedTurnId?: string | null;
15
12
  }
16
13
  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
- * 「工作流运行」块:一次 workflow:run 的执行呈现——每个步骤一张卡顺序铺开
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" | "kbIds" | "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 表示沿用会话已保存的模型。 */
@@ -85,16 +85,13 @@ export { ENTRY_SCROLL_MARGIN_PX, calculateStickyAwareMargin, normalizeScrollEntr
85
85
  export { BashRenderer } from "./tool-renderers/BashRenderer";
86
86
  export { FileEditRenderer } from "./tool-renderers/FileEditRenderer";
87
87
  export { FileReadRenderer } from "./tool-renderers/FileReadRenderer";
88
- export { KbSearchRenderer } from "./tool-renderers/KbSearchRenderer";
89
88
  export { SearchRenderer } from "./tool-renderers/SearchRenderer";
90
89
  export { SubmitResultRenderer } from "./tool-renderers/SubmitResultRenderer";
91
- export { parseKbSearchResult, formatKbSearchLabel } from "./tool-renderers/kb-search-result";
92
- export type { KbSearchHit, KbSearchResult } from "./tool-renderers/kb-search-result";
93
90
  export { getRenderer } from "./tool-renderers/registry";
94
91
  export { getResultText, getResultImages, parseJsonValue, isPlainObject, getStringValue, getNumberValue, getBooleanValue, extractErrorMessage, getFileName, getCodeLanguage, formatBytes, CodePreview } from "./tool-renderers/shared";
95
92
  export { shouldFollowWritePreview, scrollWritePreviewToLatest } from "./tool-renderers/write-preview-scroll";
96
93
  export { skillDisplayName } from "./lib/skill-name";
97
- export { type ConnectorComputerSectionProps, type InputConnection, type InputDataState, type InputKnowledgeBase, type InputModelCatalog, type InputModelOption, type InputModelPreferences, type InputSessionSkill, type InputSkillStats, type RichInputServices, parseModelReasoningLevels, RichInputServicesProvider, useRichInputServices, } from "./runtime/input-services";
94
+ 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";
98
95
  export { backgroundTaskDismissals, useDismissedBackgroundTasks } from "./runtime/background-task-dismissals";
99
96
  export { visibleSkillIds, visibleSkills } from "./lib/skill-visibility";
100
97
  export { resetInputCaches } from "./runtime/input-cache-reset";
@@ -1,34 +1,13 @@
1
1
  import type { ToolCallInfo } from "@blade-hq/agent-client/internal";
2
- /** 一条可点击引用的原文,来自保存的插件快照或旧知识库结果。 */
2
+ /** 一条可点击引用的原文,来自保存的插件快照。 */
3
3
  export interface CitationEntry {
4
4
  n: number;
5
- kbName: string;
6
5
  title: string;
7
- path: string;
8
- page: number | null;
9
- heading: string | null;
10
6
  text: string;
11
7
  previewUrl: string | null;
12
8
  snapshot?: boolean;
13
9
  toolCallId?: string;
14
10
  itemId?: string;
15
11
  }
16
- /**
17
- * 从一轮里的工具调用抽取可引用证据。规则:
18
- * - 插件证据只读可信投影 evidence 字段,并核对具体调用;普通结果文本不产生证据。
19
- * - 旧知识库仅认成功完成的 kb_search 调用,清理由 #3311 完成。
20
- * - 汇总本轮全部 kb_search 调用的命中,不只看最后一次。后端(见
21
- * `knowledge_base.py build_search_tool_output` 的 `start_index`、
22
- * `EngineSkillMixin.allocate_kb_citation_range`)保证本轮内多次 kb_search
23
- * 调用的编号连续递增、不重叠、不归零,所以回答里的每个 `[n]` 在这一轮里
24
- * 本该全局唯一,直接汇总即可,不用再靠"只用最后一次"去猜模型引用的是哪次。
25
- * - 但前端不信任协议 100% 不出错:万一后端真出现同一个编号在不同调用间指向
26
- * 不同证据的异常情况,这里依然按"冲突就剔除"处理——发现冲突直接从返回的
27
- * map 里删掉这个编号,而不是用后来者覆盖前者,避免一旦协议出岔子就退回到
28
- * "看起来能点、点开却是错的文档"这个原始 bug。正常情况下这段防御代码不会
29
- * 被触发。
30
- *
31
- * 返回的 map 只包含真的有证据支撑、且没有歧义的编号——`[n]` 是否可点全靠这个
32
- * map 里有没有对应的 key,不额外维护一个"允许列表",避免两处状态不同步。
33
- */
12
+ /** Collect saved plugin sources; conflicting numbers remain unclickable. */
34
13
  export declare function buildCitationsFromToolCalls(toolCalls: ToolCallInfo[] | null | undefined): Record<number, CitationEntry>;
@@ -1,6 +1,6 @@
1
- import type { ComponentPropsWithRef } from "react";
1
+ import { type ComponentPropsWithRef } from "react";
2
2
  type AnchorProps = ComponentPropsWithRef<"a">;
3
- /** 链接一律新窗口打开并断开 opener,SDK 不接管站内跳转。
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,14 +9,13 @@ export interface ChatSendExtras {
9
9
  model?: string;
10
10
  thinkingOverride?: boolean;
11
11
  reasoningLevel?: string;
12
- kbIds?: number[];
12
+ contextAttachments?: SendOptions["contextAttachments"];
13
13
  refs?: SendOptions["refs"];
14
14
  topicAssetRefs?: SendOptions["topicAssetRefs"];
15
15
  whatif?: SendOptions["whatif"];
16
16
  replayDecision?: SendOptions["replayDecision"];
17
17
  /**
18
- * 声明「会话在跑就把这条消息放进等待队列」。只有渲染了队列面板、能展示等待消息的宿主才该传:
19
- * 没有面板时排队等于消息凭空消失。
18
+ * 默认发送引导消息;显式为 true 时,等待当前运行结束后处理。
20
19
  */
21
20
  queueWhenRunning?: boolean;
22
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;
@@ -38,11 +38,6 @@ export interface InputModelPreferences {
38
38
  }
39
39
  /** 偏好里存的是 JSON 字符串(模型 id → 档位);坏数据当作没有。 */
40
40
  export declare function parseModelReasoningLevels(value: string | null | undefined): Record<string, string>;
41
- export interface InputKnowledgeBase {
42
- id: number;
43
- name: string;
44
- description?: string | null;
45
- }
46
41
  export interface InputSessionSkill {
47
42
  skill_id: string;
48
43
  display_name?: string | null;
@@ -69,6 +64,14 @@ export interface InputDataState<T> {
69
64
  error: unknown;
70
65
  }
71
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 {
72
75
  sessionId: string | null;
73
76
  query: string;
74
77
  pendingSelection?: string[];
@@ -80,7 +83,6 @@ export interface RichInputServices {
80
83
  useModelCatalog?: () => InputModelCatalog;
81
84
  useModelPreferences?: () => InputModelPreferences;
82
85
  /** 知识库清单(`@` 菜单打开时才调用)。 */
83
- useKnowledgeBaseLoader?: () => () => Promise<InputKnowledgeBase[]>;
84
86
  /** 语音是否可用(部署可以关掉);默认不可用,不显示麦克风。 */
85
87
  voiceEnabled?: boolean;
86
88
  /** 语音的 AudioWorklet 脚本地址。 */
@@ -98,6 +100,8 @@ export interface RichInputServices {
98
100
  };
99
101
  /** 连接器面板里的「电脑」分区;不提供时不显示。 */
100
102
  ConnectorComputerSection?: ComponentType<ConnectorComputerSectionProps>;
103
+ /** 连接器面板里的「手机」分区,渲染在「电脑」下面;不提供时不显示。 */
104
+ ConnectorPhoneSection?: ComponentType<ConnectorPhoneSectionProps>;
101
105
  /** 连接器面板里的「外部账号」分区;不提供时不显示。 */
102
106
  ConnectorAccountsSection?: ComponentType<{
103
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): {
@@ -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
- /* --- chat markdown density: 收紧块间距,避免松散 ---------------- */
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
- /* Message entrance animation */
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
- /* Running-state sweep, borrowed from deepseek-harness's ReasoningRow. */
114
+
128
115
  .status-sweep::after {
129
116
  content: "";
130
117
  position: absolute;
@@ -153,7 +140,7 @@
153
140
  }
154
141
  }
155
142
 
156
- /* 流式等待的扫光文字(ai-elements/shimmer.tsx) */
143
+
157
144
  @keyframes blade-shimmer-sweep {
158
145
  from {
159
146
  background-position: 100% center;