@yumiai/chat-widget 0.1.1 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.2] - 2025-03-17
4
+
5
+ ### Fixed
6
+
7
+ - **子 Agent 卡片「已完成」误判(无 agent_end 时)**:子 agent 的 MCP 工具消息(如 write)可能挂在子 agent 自己的 call_batch 下而非 call_agent 下,导致卡片只收到部分 children、`hasInProgressTool` 漏判。现改为同时用整轮消息 `round.messages` 按同一 `agentInstanceId` 检查是否有进行中的工具,避免「顶上已完成、内部仍生成中」的不一致。
8
+
3
9
  ## [0.1.1] - 2025-03-17
4
10
 
5
11
  ### Fixed
package/dist/index.cjs CHANGED
@@ -2310,7 +2310,8 @@ var ChildAgentCard = ({
2310
2310
  onArtifactClick,
2311
2311
  defaultExpanded = false,
2312
2312
  parentTaskPurpose,
2313
- endedAgentInstanceIds
2313
+ endedAgentInstanceIds,
2314
+ allRoundMessages
2314
2315
  }) => {
2315
2316
  const [isExpanded, setIsExpanded] = (0, import_react20.useState)(defaultExpanded);
2316
2317
  const contentRef = (0, import_react20.useRef)(null);
@@ -2319,9 +2320,13 @@ var ChildAgentCard = ({
2319
2320
  const hasActiveContent = allMessages.some(
2320
2321
  (m) => m.contentType === "text" && m.contentChunks.join("").trim()
2321
2322
  );
2322
- const hasInProgressTool = allMessages.some(
2323
- (m) => m.toolPhase === "generating" || m.toolPhase === "executing"
2324
- );
2323
+ const hasInProgressTool = (0, import_react20.useMemo)(() => {
2324
+ if (allMessages.some((m) => m.toolPhase === "generating" || m.toolPhase === "executing")) return true;
2325
+ if (allRoundMessages == null) return false;
2326
+ return allRoundMessages.some(
2327
+ (m) => m.agentInstanceId === message.agentInstanceId && (m.toolPhase === "generating" || m.toolPhase === "executing")
2328
+ );
2329
+ }, [allMessages, allRoundMessages, message.agentInstanceId]);
2325
2330
  const status = hasExplicitEnd ? "completed" : hasActiveContent && !hasInProgressTool ? "completed" : "running";
2326
2331
  (0, import_react20.useEffect)(() => {
2327
2332
  if (isExpanded && contentRef.current) {
@@ -2799,7 +2804,8 @@ var ChatWidget = ({
2799
2804
  onArtifactClick: handleArtifactClick,
2800
2805
  defaultExpanded: true,
2801
2806
  parentTaskPurpose: msg.taskPurpose,
2802
- endedAgentInstanceIds: round.endedAgentInstanceIds
2807
+ endedAgentInstanceIds: round.endedAgentInstanceIds,
2808
+ allRoundMessages: round.messages
2803
2809
  },
2804
2810
  `child-${childKey}-${agentInstanceId}`
2805
2811
  )