@blade-hq/agent-react 2610.0.3 → 2610.0.5

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 CHANGED
@@ -641,3 +641,9 @@ blade-chat::part(input-toolbar) { gap: 12px; }
641
641
  ```tsx
642
642
  <MessageImage src={imageUrl} alt="附件图片" width={width} height={height} />
643
643
  ```
644
+
645
+ ### 对话执行耗时
646
+
647
+ `getChatRun(messages)` 取最新一次根对话运行区间;`getChatRunDuration(messages, now)` 返回结束后的后端总耗时,或运行中从区间起点到校准服务器时间的毫秒数。这个区间包含工具、子任务和结束前的收尾,不重复累加并行任务。
648
+
649
+ `useLiveExecutionDuration` 在起点就绪后用单调时钟逐秒更新,停止时清理计时器。自建聊天界面可复用这组函数;模型和工具各自的性能样本仍分别保留。
@@ -29,6 +29,8 @@ export interface ConnectorPanelProps {
29
29
  renderExternalAccounts?: (query: string) => ReactNode;
30
30
  /** 宿主注入:底部操作区;不注入就不渲染这一块。 */
31
31
  renderFooterActions?: () => ReactNode;
32
+ /** Visible sections; presentation only, never disconnects existing activations. */
33
+ visibleSections?: readonly ("plugins" | "computers" | "accounts")[];
32
34
  className?: string;
33
35
  }
34
36
  /**
@@ -38,4 +40,4 @@ export interface ConnectorPanelProps {
38
40
  * 判定不各写一份。电脑与外部账号由宿主注入——那些入口需要宿主的路由与 CLI
39
41
  * 引导,SDK 不硬编码内部路径,也不替第三方决定跳到哪里。
40
42
  */
41
- export declare function ConnectorPanel({ client, sessionId, pendingPlugins, onPendingPluginsChange, pendingDisabledReason, onPluginsChanged, onSelectedChange, renderComputerSection, renderExternalAccounts, renderFooterActions, className, }: ConnectorPanelProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function ConnectorPanel({ client, sessionId, pendingPlugins, onPendingPluginsChange, pendingDisabledReason, onPluginsChanged, onSelectedChange, renderComputerSection, renderExternalAccounts, renderFooterActions, visibleSections, className, }: ConnectorPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { AppBridge } from "@modelcontextprotocol/ext-apps/app-bridge";
2
+ export interface McpAppFrameProps {
3
+ html?: string;
4
+ resourceMeta: Record<string, unknown>;
5
+ title?: string;
6
+ error?: string | null;
7
+ toolInput?: Parameters<AppBridge["sendToolInput"]>[0];
8
+ callTool?: AppBridge["oncalltool"];
9
+ sendMessage?: AppBridge["onmessage"];
10
+ updateModelContext?: AppBridge["onupdatemodelcontext"];
11
+ requestDisplayMode?: AppBridge["onrequestdisplaymode"];
12
+ sizeChange?: AppBridge["onsizechange"];
13
+ openLink?: AppBridge["onopenlink"];
14
+ onReady?: (bridge: AppBridge) => void;
15
+ }
16
+ /** Sandboxed MCP App surface shared by chat cards and file previews. */
17
+ export declare function McpAppFrame(props: McpAppFrameProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ChatMessage } from "@blade-hq/agent-client";
2
+ /** Keep a running turn on one clock even when server timing replaces local timing. */
3
+ export declare function useLiveExecutionDuration({ turnKey, isStreaming, initialDurationMs, isInitialDurationReady, }: {
4
+ turnKey: string;
5
+ isStreaming: boolean;
6
+ initialDurationMs: number;
7
+ isInitialDurationReady: boolean;
8
+ }): number;
9
+ /** The outer run already includes sequential/parallel tools and child agents. */
10
+ export declare function getChatRun(messages: ChatMessage[]): import("@blade-hq/agent-client").RunTiming | null;
11
+ export declare function getChatRunDuration(messages: ChatMessage[], now: number | null): number | null;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { useLiveExecutionDuration, getChatRunDuration, getChatRun } from "./hooks/use-live-execution-duration";
1
2
  export { BladeProvider, useBladeClient } from "./context";
2
3
  export type { BladeProviderProps } from "./context";
3
4
  export { useAgentSession } from "./hooks/use-agent-session";
@@ -77,3 +78,5 @@ export { SessionBranchPicker } from "./components/SessionBranchPicker";
77
78
  export type { SessionBranchPickerProps } from "./components/SessionBranchPicker";
78
79
  export { MessageImage, type MessageImageProps } from "./components/MessageImage";
79
80
  export { BackgroundWakeNotice } from "./components/BackgroundWakeNotice";
81
+ export { McpAppFrame } from "./components/McpAppFrame";
82
+ export type { McpAppFrameProps } from "./components/McpAppFrame";