@blade-hq/agent-react 2612.0.0-beta.112 → 2612.0.0-beta.113

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 (28) hide show
  1. package/dist/{McpAppCard-PGME4ZPA.js → McpAppCard-NJEKKEEN.js} +2 -2
  2. package/dist/{McpAppFrame-YKQ7ZZX6.js → McpAppFrame-IQK5AOMD.js} +2 -2
  3. package/dist/chat/AssistantTurnBlock.d.ts +1 -1
  4. package/dist/chat/AttachmentPreviewDialog.d.ts +1 -6
  5. package/dist/chat/ChatLoadingIndicator.d.ts +2 -1
  6. package/dist/chat/chat-run.d.ts +4 -0
  7. package/dist/chat/message-list-blocks.d.ts +1 -0
  8. package/dist/{chunk-SWYLHUQM.js → chunk-4WFRH7FG.js} +27 -7
  9. package/dist/{chunk-SWYLHUQM.js.map → chunk-4WFRH7FG.js.map} +1 -1
  10. package/dist/{chunk-B27HARE3.js → chunk-5XLLPGSU.js} +78 -32
  11. package/dist/chunk-5XLLPGSU.js.map +1 -0
  12. package/dist/{chunk-7TYNY2AX.js → chunk-M6SNZHK3.js} +11 -8
  13. package/dist/{chunk-7TYNY2AX.js.map → chunk-M6SNZHK3.js.map} +1 -1
  14. package/dist/{chunk-AOM334QU.js → chunk-VYTLF6JE.js} +8 -9
  15. package/dist/chunk-VYTLF6JE.js.map +1 -0
  16. package/dist/{chunk-VON7UU2E.js → chunk-XLG3BTUA.js} +2 -2
  17. package/dist/components/McpAppFrame.d.ts +2 -0
  18. package/dist/components/use-session-plugin-activation.d.ts +3 -1
  19. package/dist/index.js +3 -3
  20. package/dist/internal.js +5 -5
  21. package/dist/rich-input.js +2 -2
  22. package/dist/tool-details.js +1 -1
  23. package/package.json +2 -2
  24. package/dist/chunk-AOM334QU.js.map +0 -1
  25. package/dist/chunk-B27HARE3.js.map +0 -1
  26. /package/dist/{McpAppCard-PGME4ZPA.js.map → McpAppCard-NJEKKEEN.js.map} +0 -0
  27. /package/dist/{McpAppFrame-YKQ7ZZX6.js.map → McpAppFrame-IQK5AOMD.js.map} +0 -0
  28. /package/dist/{chunk-VON7UU2E.js.map → chunk-XLG3BTUA.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  McpAppFrame
3
- } from "./chunk-SWYLHUQM.js";
3
+ } from "./chunk-4WFRH7FG.js";
4
4
  import {
5
5
  McpAppMessageContext
6
6
  } from "./chunk-GRUDJLWG.js";
@@ -168,4 +168,4 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
168
168
  export {
169
169
  McpAppCard
170
170
  };
171
- //# sourceMappingURL=McpAppCard-PGME4ZPA.js.map
171
+ //# sourceMappingURL=McpAppCard-NJEKKEEN.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  McpAppFrame
3
- } from "./chunk-SWYLHUQM.js";
3
+ } from "./chunk-4WFRH7FG.js";
4
4
  import "./chunk-3KJJIH5K.js";
5
5
  import "./chunk-PR4QN5HX.js";
6
6
  export {
7
7
  McpAppFrame
8
8
  };
9
- //# sourceMappingURL=McpAppFrame-YKQ7ZZX6.js.map
9
+ //# sourceMappingURL=McpAppFrame-IQK5AOMD.js.map
@@ -27,7 +27,7 @@ export declare function resolveTurnDisplayMode({ isStreaming: _isStreaming, disp
27
27
  isStreaming: boolean;
28
28
  displayMode: TurnDisplayMode;
29
29
  }): TurnDisplayMode;
30
- export declare function formatExecutionDuration(durationMs: number): string;
30
+ export { formatExecutionDuration } from "./chat-run";
31
31
  export declare function getExecutionDurationMs({ messages, isStreaming, now, }: {
32
32
  messages: ChatMessage[];
33
33
  isStreaming: boolean;
@@ -12,12 +12,7 @@ interface Props {
12
12
  open: boolean;
13
13
  onOpenChange: (open: boolean) => void;
14
14
  filename: string;
15
- /**
16
- * 由调用方用 `getAuthedUrl()` 构造的完整 URL(baseUrl + 路径 + ?token=…)。
17
- * 内部 fetch 直接用原串,**不**再走 `apiFetchText` —— 否则会二次拼 baseUrl,
18
- * 在独立前后端部署时会得到形如 `http://api.xxxhttp://api.xxx/…` 的非法 URL。
19
- * token 靠 query 字符串携带,因此也不需要再挂 Authorization header。
20
- */
15
+ /** 完整附件地址,已下载的上下文资料使用本地 blob URL。 */
21
16
  url: string | null;
22
17
  mode: "markdown" | "text" | "default";
23
18
  }
@@ -8,7 +8,8 @@ export declare function resolveLoadingStageLabel({ preparing, elapsedMs, activeT
8
8
  elapsedMs: number;
9
9
  activeToolLabel?: string | null;
10
10
  }): string;
11
- export declare function ChatLoadingIndicator({ preparing, startedAtMs, activeToolLabel, }: {
11
+ export declare function ChatLoadingIndicator({ preparing, startedAtMs, activeToolLabel, useRunClock, }: {
12
+ useRunClock?: boolean;
12
13
  preparing?: boolean;
13
14
  startedAtMs?: number | null;
14
15
  activeToolLabel?: string | null;
@@ -0,0 +1,4 @@
1
+ import type { ChatMessage, RunTiming } from "@blade-hq/agent-client/internal";
2
+ export declare function lastChatRun(messages: ChatMessage[]): RunTiming | undefined;
3
+ export declare function formatExecutionDuration(durationMs: number): string;
4
+ export declare function terminalChatLabel(run: RunTiming | undefined): string | null;
@@ -20,6 +20,7 @@ export type AssistantTurnRenderBlock = RenderBlockBase & {
20
20
  export type RenderBlock = (RenderBlockBase & {
21
21
  type: "message";
22
22
  message: ChatMessage;
23
+ unansweredLabel?: string;
23
24
  anchorId: string | null;
24
25
  }) | AssistantTurnRenderBlock | (RenderBlockBase & {
25
26
  type: "context_group";
@@ -25756,9 +25756,11 @@ function McpAppFrame(props) {
25756
25756
  useLayoutEffect(() => {
25757
25757
  const dialog = panel.current;
25758
25758
  if (!dialog) return;
25759
- dialog.close();
25760
- if (expanded) dialog.showModal();
25761
- else dialog.show();
25759
+ if (typeof dialog.close === "function") dialog.close();
25760
+ else dialog.removeAttribute("open");
25761
+ const show = expanded ? dialog.showModal : dialog.show;
25762
+ if (typeof show === "function") show.call(dialog);
25763
+ else dialog.setAttribute("open", "");
25762
25764
  }, [expanded]);
25763
25765
  useEffect(() => {
25764
25766
  setError(null);
@@ -25770,7 +25772,10 @@ function McpAppFrame(props) {
25770
25772
  let disposed = false;
25771
25773
  let bridge;
25772
25774
  const timer = window.setTimeout(() => {
25773
- if (!disposed && !bridge?.getAppCapabilities()) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
25775
+ if (!disposed && !bridge?.getAppCapabilities()) {
25776
+ setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
25777
+ callbacks.current.onLoadError?.();
25778
+ }
25774
25779
  }, 2e4);
25775
25780
  const start = async () => {
25776
25781
  if (!frame.current?.contentWindow) throw new Error("\u5E94\u7528\u4F1A\u8BDD\u4E0D\u53EF\u7528");
@@ -25810,6 +25815,8 @@ function McpAppFrame(props) {
25810
25815
  return { mode: next };
25811
25816
  };
25812
25817
  bridge.onsizechange = (params) => {
25818
+ if (disposed) return;
25819
+ callbacks.current.onLayout?.();
25813
25820
  if (callbacks.current.sizeChange) return callbacks.current.sizeChange(params);
25814
25821
  if (params.height && Number.isFinite(params.height)) setHeight(Math.max(120, Math.min(1200, params.height)));
25815
25822
  };
@@ -25825,7 +25832,10 @@ function McpAppFrame(props) {
25825
25832
  };
25826
25833
  void start().catch((error63) => {
25827
25834
  window.clearTimeout(timer);
25828
- if (!disposed) setError(error63 instanceof Error ? error63.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
25835
+ if (!disposed) {
25836
+ setError(error63 instanceof Error ? error63.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
25837
+ callbacks.current.onLoadError?.();
25838
+ }
25829
25839
  });
25830
25840
  return () => {
25831
25841
  disposed = true;
@@ -25843,6 +25853,7 @@ function McpAppFrame(props) {
25843
25853
  disposed = true;
25844
25854
  };
25845
25855
  }, [props.toolInput, ready]);
25856
+ const nativeDialog = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
25846
25857
  const toggle = () => {
25847
25858
  setExpanded(!expanded);
25848
25859
  bridgeRef.current?.setHostContext({ displayMode: expanded ? "inline" : "fullscreen" });
@@ -25851,6 +25862,15 @@ function McpAppFrame(props) {
25851
25862
  "dialog",
25852
25863
  {
25853
25864
  ref: panel,
25865
+ role: nativeDialog ? void 0 : "dialog",
25866
+ "aria-modal": expanded || void 0,
25867
+ onKeyDown: (event) => {
25868
+ if (!nativeDialog && expanded && event.key === "Escape") {
25869
+ event.preventDefault();
25870
+ setExpanded(false);
25871
+ bridgeRef.current?.setHostContext({ displayMode: "inline" });
25872
+ }
25873
+ },
25854
25874
  onCancel: () => {
25855
25875
  setExpanded(false);
25856
25876
  bridgeRef.current?.setHostContext({ displayMode: "inline" });
@@ -25875,7 +25895,7 @@ function McpAppFrame(props) {
25875
25895
  boxShadow: "-4px 0 20px #0002",
25876
25896
  display: "flex",
25877
25897
  flexDirection: "column"
25878
- } : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white" },
25898
+ } : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white", display: nativeDialog ? void 0 : "block" },
25879
25899
  children: [
25880
25900
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "8px 12px", color: "#27272a" }, children: [
25881
25901
  /* @__PURE__ */ jsx("span", { children: title }),
@@ -25910,4 +25930,4 @@ export {
25910
25930
  * MIT Licensed
25911
25931
  *)
25912
25932
  */
25913
- //# sourceMappingURL=chunk-SWYLHUQM.js.map
25933
+ //# sourceMappingURL=chunk-4WFRH7FG.js.map