@agents24/chat-react 0.5.40 → 0.5.42

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/ui/index.cjs CHANGED
@@ -107,6 +107,7 @@ __export(ui_exports, {
107
107
  contextStatusMetrics: () => contextStatusMetrics,
108
108
  createAgentChatComposerFile: () => createAgentChatComposerFile,
109
109
  defaultHitlSubmissionLabels: () => defaultHitlSubmissionLabels,
110
+ getAgentChatActivity: () => getAgentChatActivity,
110
111
  hitlActionLabel: () => hitlActionLabel,
111
112
  hitlTitle: () => hitlTitle,
112
113
  isAgentChatSubagent: () => isAgentChatSubagent,
@@ -1578,6 +1579,19 @@ function AgentChatComposer({
1578
1579
  ] });
1579
1580
  }
1580
1581
 
1582
+ // src/activity.ts
1583
+ function getAgentChatActivity(message, parts = message.parts, isLoading = false) {
1584
+ if (message.role !== "assistant" || message.isFinal || message.responseCompletion || parts.some((part) => part.kind === "hitl" && part.status === "pending")) return null;
1585
+ const status = message.activity?.status;
1586
+ if (status === "waiting") return message.activity?.capacityWait ? "capacity" : "waiting";
1587
+ if (status === "interrupted" || status === "cancelling") return status;
1588
+ if (!isLoading && status !== "running") return null;
1589
+ if (parts.some((part) => part.kind === "tool" && ["input-streaming", "input-available"].includes(part.state) || part.kind === "model-turn" && part.turnKind === "agent" && part.status === "running" || part.kind === "node-activity" && part.defaultChatVisible && part.status === "running" || part.kind === "context-compression" && part.status === "started" || part.kind === "reasoning" && Boolean(part.text || part.label) || part.kind === "ui-blocks" && ["input-streaming", "input-available"].includes(part.state))) return null;
1590
+ const tail = parts[parts.length - 1];
1591
+ if (tail?.kind === "text" && tail.text.trim() || !parts.length && message.content.trim()) return null;
1592
+ return "thinking";
1593
+ }
1594
+
1581
1595
  // src/ui/agent-chat-queue.tsx
1582
1596
  var React7 = __toESM(require("react"), 1);
1583
1597
  var import_lucide_react3 = require("lucide-react");
@@ -3323,7 +3337,7 @@ function AgentChatActivityRow({
3323
3337
  }) {
3324
3338
  const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3325
3339
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
3326
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { label }) })
3340
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { label }, label) })
3327
3341
  ] });
3328
3342
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
3329
3343
  }
@@ -3829,7 +3843,7 @@ function AgentResponseTimeline({
3829
3843
  toolViewMode = "closed"
3830
3844
  }) {
3831
3845
  isLoading = isLoading && !message.responseCompletion;
3832
- const parts = (displayParts || message.parts || []).filter((part) => (part.kind !== "tool" || !isInternalAskUserTool(part)) && (part.kind !== "hitl" || part.hitlKind === "user_input" || part.status === "pending" || getHitlActionState?.(part)?.status === "accepted") && (part.kind !== "model-turn" || part.turnKind === "agent") && (part.kind !== "node-activity" || nodeActivityMode === "all" || nodeActivityMode === "default" && part.defaultChatVisible));
3846
+ const parts = (displayParts || message.parts || []).filter((part) => (part.kind !== "tool" || !isInternalAskUserTool(part)) && (part.kind !== "hitl" || part.hitlKind === "user_input" || part.status === "pending" || getHitlActionState?.(part)?.status === "accepted") && (part.kind !== "model-turn" || part.turnKind === "agent" && !message.isFinal && !message.responseCompletion && (!message.activity || message.activity.status === "running")) && (part.kind !== "node-activity" || nodeActivityMode === "all" || nodeActivityMode === "default" && part.defaultChatVisible));
3833
3847
  const toolParts = parts.filter((part) => part.kind === "tool");
3834
3848
  const activeToolId = latestRunningAgentChatToolId(toolParts);
3835
3849
  const activeTextPartId = getActiveStreamingTextPartId(
@@ -3895,8 +3909,23 @@ function AgentResponseTimeline({
3895
3909
  if (rendered.length === 0 && message.content) {
3896
3910
  rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3897
3911
  }
3898
- if (rendered.length === 0 && isLoading) {
3899
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3912
+ const activity = getAgentChatActivity(message, parts, isLoading);
3913
+ if (activity) {
3914
+ const labels = {
3915
+ thinking: "Thinking",
3916
+ capacity: "Waiting for provider capacity",
3917
+ waiting: "Waiting for external work",
3918
+ interrupted: "Waiting to resume",
3919
+ cancelling: "Cancelling"
3920
+ };
3921
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3922
+ AgentChatActivityRow,
3923
+ {
3924
+ renderActivityIcon: toolSlots?.renderActivityIcon,
3925
+ label: labels[activity]
3926
+ },
3927
+ `${message.id}-active-activity`
3928
+ ));
3900
3929
  }
3901
3930
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "space-y-3", children: rendered });
3902
3931
  }
@@ -4384,6 +4413,7 @@ function McpConnectRequiredCard({
4384
4413
  contextStatusMetrics,
4385
4414
  createAgentChatComposerFile,
4386
4415
  defaultHitlSubmissionLabels,
4416
+ getAgentChatActivity,
4387
4417
  hitlActionLabel,
4388
4418
  hitlTitle,
4389
4419
  isAgentChatSubagent,