@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/dist/index.d.cts CHANGED
@@ -277,6 +277,8 @@ interface ChildAgentCardProps {
277
277
  parentTaskPurpose?: string;
278
278
  /** 本轮次已收到 agent_end 的 agent_instance_id(与 notification_turns 对齐),有则优先据此显示「已完成」 */
279
279
  endedAgentInstanceIds?: Set<number>;
280
+ /** 本轮次全部消息,用于判断该 agent 是否有未完成的工具(子 agent 的 MCP 消息可能挂在别的 parent 下,不在此卡片的 children 里) */
281
+ allRoundMessages?: AggregatedMessage[];
280
282
  }
281
283
  interface PlanCardProps {
282
284
  plan: TaskPlan;
package/dist/index.d.ts CHANGED
@@ -277,6 +277,8 @@ interface ChildAgentCardProps {
277
277
  parentTaskPurpose?: string;
278
278
  /** 本轮次已收到 agent_end 的 agent_instance_id(与 notification_turns 对齐),有则优先据此显示「已完成」 */
279
279
  endedAgentInstanceIds?: Set<number>;
280
+ /** 本轮次全部消息,用于判断该 agent 是否有未完成的工具(子 agent 的 MCP 消息可能挂在别的 parent 下,不在此卡片的 children 里) */
281
+ allRoundMessages?: AggregatedMessage[];
280
282
  }
281
283
  interface PlanCardProps {
282
284
  plan: TaskPlan;
package/dist/index.js CHANGED
@@ -2258,7 +2258,8 @@ var ChildAgentCard = ({
2258
2258
  onArtifactClick,
2259
2259
  defaultExpanded = false,
2260
2260
  parentTaskPurpose,
2261
- endedAgentInstanceIds
2261
+ endedAgentInstanceIds,
2262
+ allRoundMessages
2262
2263
  }) => {
2263
2264
  const [isExpanded, setIsExpanded] = useState10(defaultExpanded);
2264
2265
  const contentRef = useRef5(null);
@@ -2267,9 +2268,13 @@ var ChildAgentCard = ({
2267
2268
  const hasActiveContent = allMessages.some(
2268
2269
  (m) => m.contentType === "text" && m.contentChunks.join("").trim()
2269
2270
  );
2270
- const hasInProgressTool = allMessages.some(
2271
- (m) => m.toolPhase === "generating" || m.toolPhase === "executing"
2272
- );
2271
+ const hasInProgressTool = useMemo4(() => {
2272
+ if (allMessages.some((m) => m.toolPhase === "generating" || m.toolPhase === "executing")) return true;
2273
+ if (allRoundMessages == null) return false;
2274
+ return allRoundMessages.some(
2275
+ (m) => m.agentInstanceId === message.agentInstanceId && (m.toolPhase === "generating" || m.toolPhase === "executing")
2276
+ );
2277
+ }, [allMessages, allRoundMessages, message.agentInstanceId]);
2273
2278
  const status = hasExplicitEnd ? "completed" : hasActiveContent && !hasInProgressTool ? "completed" : "running";
2274
2279
  useEffect3(() => {
2275
2280
  if (isExpanded && contentRef.current) {
@@ -2747,7 +2752,8 @@ var ChatWidget = ({
2747
2752
  onArtifactClick: handleArtifactClick,
2748
2753
  defaultExpanded: true,
2749
2754
  parentTaskPurpose: msg.taskPurpose,
2750
- endedAgentInstanceIds: round.endedAgentInstanceIds
2755
+ endedAgentInstanceIds: round.endedAgentInstanceIds,
2756
+ allRoundMessages: round.messages
2751
2757
  },
2752
2758
  `child-${childKey}-${agentInstanceId}`
2753
2759
  )