@agents24/chat-react 0.5.49 → 0.5.51

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.js CHANGED
@@ -3640,7 +3640,7 @@ function agentChatToolLabel(part) {
3640
3640
  }
3641
3641
  function isAgentChatSubagent(part) {
3642
3642
  const sourceKind = String(part.sourceKind || "").trim().toLowerCase();
3643
- return sourceKind === "agent" || sourceKind === "agent_call" || Boolean(part.presentation.childRun);
3643
+ return sourceKind === "agent" || sourceKind === "agent_call" || sourceKind === "tool_plan" || Boolean(part.presentation.childRun);
3644
3644
  }
3645
3645
  function isAgentChatToolRunning(part) {
3646
3646
  return part.state === "input-available" || part.state === "input-streaming";
@@ -4077,6 +4077,12 @@ function childLabel(child) {
4077
4077
  function subagentLabel(part) {
4078
4078
  const childRun = part.presentation.childRun;
4079
4079
  const children = part.presentation.childTools || [];
4080
+ if (String(part.sourceKind) === "tool_plan") {
4081
+ const running = isAgentChatToolRunning(part);
4082
+ const output = part.output && typeof part.output === "object" ? part.output : null;
4083
+ const status2 = part.state === "output-error" ? "failed" : part.state === "cancelled" ? "cancelled" : running ? "running" : output?.status === "incomplete" ? "incomplete" : "completed";
4084
+ return { label: `Tool plan, ${status2}${children.length ? ` \xB7 ${children.length} tools` : ""}`, running };
4085
+ }
4080
4086
  const name = optionalText(childRun?.agentName) || optionalText(part.displayName) || "agent";
4081
4087
  const status = String(childRun?.status || (isAgentChatToolRunning(part) ? "running" : "completed")).toLowerCase();
4082
4088
  const activeChild = children.find((child) => child.id === part.presentation.activeChildToolId) || [...children].reverse().find((child) => child.status === "running") || children[children.length - 1];
@@ -4257,12 +4263,6 @@ function AgentChatPart({
4257
4263
  if (part.kind === "context-compression") {
4258
4264
  return /* @__PURE__ */ jsx17(AgentChatContextCompressionRow, { part });
4259
4265
  }
4260
- if (part.kind === "ui-blocks") {
4261
- if (part.state === "output-error") {
4262
- return /* @__PURE__ */ jsx17("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
4263
- }
4264
- return part.bundle ? /* @__PURE__ */ jsx17(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ jsx17("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ jsx17(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
4265
- }
4266
4266
  if (part.kind === "hitl") {
4267
4267
  return /* @__PURE__ */ jsx17(
4268
4268
  HitlPartRow,
@@ -4299,35 +4299,6 @@ function safeExternalUrl(value) {
4299
4299
  return null;
4300
4300
  }
4301
4301
  }
4302
- function SafeUiBlocks({ bundle }) {
4303
- const rows = Array.isArray(bundle.rows) ? bundle.rows : [];
4304
- return /* @__PURE__ */ jsxs13("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
4305
- typeof bundle.title === "string" ? /* @__PURE__ */ jsx17("h3", { children: bundle.title }) : null,
4306
- rows.map((rawRow, rowIndex) => {
4307
- const row = rawRow && typeof rawRow === "object" && !Array.isArray(rawRow) ? rawRow : {};
4308
- const blocks = Array.isArray(row.blocks) ? row.blocks : [];
4309
- return /* @__PURE__ */ jsx17("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
4310
- const block = rawBlock && typeof rawBlock === "object" && !Array.isArray(rawBlock) ? rawBlock : {};
4311
- const title = typeof block.title === "string" ? block.title : "Result";
4312
- const kind = String(block.kind || "note");
4313
- if (kind === "table" && Array.isArray(block.columns) && Array.isArray(block.rows)) {
4314
- return /* @__PURE__ */ jsxs13("div", { className: "a24-ui-block", children: [
4315
- /* @__PURE__ */ jsx17("h4", { children: title }),
4316
- /* @__PURE__ */ jsx17("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ jsxs13("table", { children: [
4317
- /* @__PURE__ */ jsx17("thead", { children: /* @__PURE__ */ jsx17("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ jsx17("th", { children: String(column) }, index)) }) }),
4318
- /* @__PURE__ */ jsx17("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ jsx17("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ jsx17("td", { children: String(cell) }, cellIndex)) }, index)) })
4319
- ] }) })
4320
- ] }, String(block.id || blockIndex));
4321
- }
4322
- const value = block.value ?? block.text ?? "";
4323
- return /* @__PURE__ */ jsxs13("div", { className: "a24-ui-block", children: [
4324
- /* @__PURE__ */ jsx17("h4", { children: title }),
4325
- /* @__PURE__ */ jsx17("p", { children: String(value) })
4326
- ] }, String(block.id || blockIndex));
4327
- }) }, `row-${rowIndex}`);
4328
- })
4329
- ] });
4330
- }
4331
4302
  function completedWork(message, segments) {
4332
4303
  const completedAt = Date.parse(message.responseCompletion?.completed_at ?? "");
4333
4304
  if (!Number.isFinite(completedAt)) return;
@@ -4336,7 +4307,7 @@ function completedWork(message, segments) {
4336
4307
  (segment) => segment.kind === "part" && segment.part.kind === "text"
4337
4308
  )) return;
4338
4309
  const count = lastWorkIndex + 1;
4339
- if (segments.slice(0, count).some((segment) => segment.kind === "part" && ["hitl", "error", "ui-blocks", "attachment"].includes(segment.part.kind))) return;
4310
+ if (segments.slice(0, count).some((segment) => segment.kind === "part" && ["hitl", "error", "attachment"].includes(segment.part.kind))) return;
4340
4311
  const timestamps = [new Date(message.createdAt).getTime(), ...message.parts.map((part) => Date.parse(part.timestamp ?? ""))];
4341
4312
  const startedAt = timestamps.reduce((earliest, value) => value > 0 && value < earliest ? value : earliest, completedAt);
4342
4313
  const seconds = Math.floor((completedAt - startedAt) / 1e3);
@@ -4356,7 +4327,6 @@ function AgentResponseTimeline({
4356
4327
  onHitlAction,
4357
4328
  onNodeSelect,
4358
4329
  parts: displayParts,
4359
- renderUiBlocks,
4360
4330
  responseProps,
4361
4331
  statusLabels,
4362
4332
  toolSlots: suppliedToolSlots,
@@ -4449,10 +4419,6 @@ function AgentResponseTimeline({
4449
4419
  );
4450
4420
  continue;
4451
4421
  }
4452
- if (part.kind === "ui-blocks" && renderUiBlocks) {
4453
- rendered.push(/* @__PURE__ */ jsx17(React16.Fragment, { children: renderUiBlocks(part) }, part.id));
4454
- continue;
4455
- }
4456
4422
  rendered.push(
4457
4423
  /* @__PURE__ */ jsx17(React16.Fragment, { children: /* @__PURE__ */ jsx17(
4458
4424
  AgentChatPart,