@agents24/chat-react 0.5.50 → 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/compatibility.json +5 -5
- package/dist/registry/agents24-chat.json +9 -9
- package/dist/scaffold/app.d.ts +1 -1
- package/dist/scaffold/index.cjs +1 -2
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.js +1 -2
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +0 -14
- package/dist/ui/agent-response-timeline.d.ts +2 -3
- package/dist/ui/index.cjs +8 -42
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +8 -42
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/scaffold/src/app.tsx +2 -3
package/dist/styles.css
CHANGED
|
@@ -361,20 +361,6 @@ button.a24-tool-trigger:focus-visible { outline: 2px solid var(--a24-focus); out
|
|
|
361
361
|
.a24-source-link,
|
|
362
362
|
.a24-citation { color: #075f9a; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .18em; }
|
|
363
363
|
.a24-output-attachment { background: var(--a24-surface); border: 1px solid var(--a24-border); border-radius: .5rem; display: inline-flex; font-size: .8rem; padding: .45rem .65rem; }
|
|
364
|
-
.a24-ui-blocks { border: 1px solid var(--a24-border); border-radius: .65rem; padding: .75rem; }
|
|
365
|
-
.a24-ui-blocks h3,
|
|
366
|
-
.a24-ui-blocks h4,
|
|
367
|
-
.a24-ui-blocks p { margin: 0; }
|
|
368
|
-
.a24-ui-blocks h3 { font-size: .9rem; margin-bottom: .65rem; }
|
|
369
|
-
.a24-ui-blocks__row { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
|
|
370
|
-
.a24-ui-block { background: var(--a24-surface); border-radius: .5rem; min-width: 0; padding: .65rem; }
|
|
371
|
-
.a24-ui-block h4 { color: var(--a24-muted); font-size: .72rem; font-weight: 600; }
|
|
372
|
-
.a24-ui-block p { font-size: 1rem; font-weight: 600; margin-top: .25rem; overflow-wrap: anywhere; }
|
|
373
|
-
.a24-ui-table-scroll { max-width: 100%; overflow-x: auto; }
|
|
374
|
-
.a24-ui-block table { border-collapse: collapse; font-size: .75rem; width: 100%; }
|
|
375
|
-
.a24-ui-block th,
|
|
376
|
-
.a24-ui-block td { border-bottom: 1px solid var(--a24-border); padding: .35rem; text-align: start; }
|
|
377
|
-
|
|
378
364
|
@media (max-width: 720px) {
|
|
379
365
|
.a24-composer__surface { box-shadow: var(--a24-composer-mobile-shadow); }
|
|
380
366
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HitlSubmissionOptions } from "@agents24/react";
|
|
2
2
|
import { type HitlSubmissionLabels } from "./hitl-submission-status";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import type { ChatHitlPart, ChatHitlResponse, ChatMessage, ChatNodeActivityPart, ChatPart, ChatToolPart
|
|
4
|
+
import type { ChatHitlPart, ChatHitlResponse, ChatMessage, ChatNodeActivityPart, ChatPart, ChatToolPart } from "../types";
|
|
5
5
|
import { type AgentChatStatusLabels } from "../activity";
|
|
6
6
|
import type { McpConnectRequiredStatus } from "./mcp-connect-required-card";
|
|
7
7
|
import { type MessageResponseProps } from "./message-response";
|
|
@@ -23,7 +23,6 @@ export type AgentResponseTimelineProps = {
|
|
|
23
23
|
onHitlAction?: (part: ChatHitlPart, response: ChatHitlResponse, options?: HitlSubmissionOptions) => void;
|
|
24
24
|
onNodeSelect?: (part: ChatNodeActivityPart) => void;
|
|
25
25
|
parts?: readonly ChatPart[];
|
|
26
|
-
renderUiBlocks?: (part: ChatUiBlocksPart) => React.ReactNode;
|
|
27
26
|
responseProps?: Omit<MessageResponseProps, "children" | "streaming" | "streamingId">;
|
|
28
27
|
statusLabels?: Partial<AgentChatStatusLabels>;
|
|
29
28
|
toolSlots?: AgentChatToolSlots;
|
|
@@ -56,4 +55,4 @@ export type AgentChatPartProps = {
|
|
|
56
55
|
toolSlots?: AgentChatToolSlots;
|
|
57
56
|
};
|
|
58
57
|
export declare function AgentChatPart({ activeToolId, getHitlActionState, hitlLabels, onHitlPaint, isLoading, isTextStreaming, message, onHitlAction, part, responseProps, toolSlots, }: AgentChatPartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
-
export declare function AgentResponseTimeline({ getHitlActionState, hitlLabels, onHitlPaint, isLoading, message, nodeActivityMode, onHitlAction, onNodeSelect, parts: displayParts,
|
|
58
|
+
export declare function AgentResponseTimeline({ getHitlActionState, hitlLabels, onHitlPaint, isLoading, message, nodeActivityMode, onHitlAction, onNodeSelect, parts: displayParts, responseProps, statusLabels, toolSlots: suppliedToolSlots, toolViewMode, toolLabelMode, }: AgentResponseTimelineProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/index.cjs
CHANGED
|
@@ -4001,7 +4001,7 @@ function agentChatToolLabel(part) {
|
|
|
4001
4001
|
}
|
|
4002
4002
|
function isAgentChatSubagent(part) {
|
|
4003
4003
|
const sourceKind = String(part.sourceKind || "").trim().toLowerCase();
|
|
4004
|
-
return sourceKind === "agent" || sourceKind === "agent_call" || Boolean(part.presentation.childRun);
|
|
4004
|
+
return sourceKind === "agent" || sourceKind === "agent_call" || sourceKind === "tool_plan" || Boolean(part.presentation.childRun);
|
|
4005
4005
|
}
|
|
4006
4006
|
function isAgentChatToolRunning(part) {
|
|
4007
4007
|
return part.state === "input-available" || part.state === "input-streaming";
|
|
@@ -4438,6 +4438,12 @@ function childLabel(child) {
|
|
|
4438
4438
|
function subagentLabel(part) {
|
|
4439
4439
|
const childRun = part.presentation.childRun;
|
|
4440
4440
|
const children = part.presentation.childTools || [];
|
|
4441
|
+
if (String(part.sourceKind) === "tool_plan") {
|
|
4442
|
+
const running = isAgentChatToolRunning(part);
|
|
4443
|
+
const output = part.output && typeof part.output === "object" ? part.output : null;
|
|
4444
|
+
const status2 = part.state === "output-error" ? "failed" : part.state === "cancelled" ? "cancelled" : running ? "running" : output?.status === "incomplete" ? "incomplete" : "completed";
|
|
4445
|
+
return { label: `Tool plan, ${status2}${children.length ? ` \xB7 ${children.length} tools` : ""}`, running };
|
|
4446
|
+
}
|
|
4441
4447
|
const name = optionalText(childRun?.agentName) || optionalText(part.displayName) || "agent";
|
|
4442
4448
|
const status = String(childRun?.status || (isAgentChatToolRunning(part) ? "running" : "completed")).toLowerCase();
|
|
4443
4449
|
const activeChild = children.find((child) => child.id === part.presentation.activeChildToolId) || [...children].reverse().find((child) => child.status === "running") || children[children.length - 1];
|
|
@@ -4618,12 +4624,6 @@ function AgentChatPart({
|
|
|
4618
4624
|
if (part.kind === "context-compression") {
|
|
4619
4625
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AgentChatContextCompressionRow, { part });
|
|
4620
4626
|
}
|
|
4621
|
-
if (part.kind === "ui-blocks") {
|
|
4622
|
-
if (part.state === "output-error") {
|
|
4623
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
|
|
4624
|
-
}
|
|
4625
|
-
return part.bundle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
|
|
4626
|
-
}
|
|
4627
4627
|
if (part.kind === "hitl") {
|
|
4628
4628
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4629
4629
|
HitlPartRow,
|
|
@@ -4660,35 +4660,6 @@ function safeExternalUrl(value) {
|
|
|
4660
4660
|
return null;
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
|
-
function SafeUiBlocks({ bundle }) {
|
|
4664
|
-
const rows = Array.isArray(bundle.rows) ? bundle.rows : [];
|
|
4665
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
|
|
4666
|
-
typeof bundle.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { children: bundle.title }) : null,
|
|
4667
|
-
rows.map((rawRow, rowIndex) => {
|
|
4668
|
-
const row = rawRow && typeof rawRow === "object" && !Array.isArray(rawRow) ? rawRow : {};
|
|
4669
|
-
const blocks = Array.isArray(row.blocks) ? row.blocks : [];
|
|
4670
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
|
|
4671
|
-
const block = rawBlock && typeof rawBlock === "object" && !Array.isArray(rawBlock) ? rawBlock : {};
|
|
4672
|
-
const title = typeof block.title === "string" ? block.title : "Result";
|
|
4673
|
-
const kind = String(block.kind || "note");
|
|
4674
|
-
if (kind === "table" && Array.isArray(block.columns) && Array.isArray(block.rows)) {
|
|
4675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "a24-ui-block", children: [
|
|
4676
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { children: title }),
|
|
4677
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("table", { children: [
|
|
4678
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("th", { children: String(column) }, index)) }) }),
|
|
4679
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { children: String(cell) }, cellIndex)) }, index)) })
|
|
4680
|
-
] }) })
|
|
4681
|
-
] }, String(block.id || blockIndex));
|
|
4682
|
-
}
|
|
4683
|
-
const value = block.value ?? block.text ?? "";
|
|
4684
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "a24-ui-block", children: [
|
|
4685
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { children: title }),
|
|
4686
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: String(value) })
|
|
4687
|
-
] }, String(block.id || blockIndex));
|
|
4688
|
-
}) }, `row-${rowIndex}`);
|
|
4689
|
-
})
|
|
4690
|
-
] });
|
|
4691
|
-
}
|
|
4692
4663
|
function completedWork(message, segments) {
|
|
4693
4664
|
const completedAt = Date.parse(message.responseCompletion?.completed_at ?? "");
|
|
4694
4665
|
if (!Number.isFinite(completedAt)) return;
|
|
@@ -4697,7 +4668,7 @@ function completedWork(message, segments) {
|
|
|
4697
4668
|
(segment) => segment.kind === "part" && segment.part.kind === "text"
|
|
4698
4669
|
)) return;
|
|
4699
4670
|
const count = lastWorkIndex + 1;
|
|
4700
|
-
if (segments.slice(0, count).some((segment) => segment.kind === "part" && ["hitl", "error", "
|
|
4671
|
+
if (segments.slice(0, count).some((segment) => segment.kind === "part" && ["hitl", "error", "attachment"].includes(segment.part.kind))) return;
|
|
4701
4672
|
const timestamps = [new Date(message.createdAt).getTime(), ...message.parts.map((part) => Date.parse(part.timestamp ?? ""))];
|
|
4702
4673
|
const startedAt = timestamps.reduce((earliest, value) => value > 0 && value < earliest ? value : earliest, completedAt);
|
|
4703
4674
|
const seconds = Math.floor((completedAt - startedAt) / 1e3);
|
|
@@ -4717,7 +4688,6 @@ function AgentResponseTimeline({
|
|
|
4717
4688
|
onHitlAction,
|
|
4718
4689
|
onNodeSelect,
|
|
4719
4690
|
parts: displayParts,
|
|
4720
|
-
renderUiBlocks,
|
|
4721
4691
|
responseProps,
|
|
4722
4692
|
statusLabels,
|
|
4723
4693
|
toolSlots: suppliedToolSlots,
|
|
@@ -4810,10 +4780,6 @@ function AgentResponseTimeline({
|
|
|
4810
4780
|
);
|
|
4811
4781
|
continue;
|
|
4812
4782
|
}
|
|
4813
|
-
if (part.kind === "ui-blocks" && renderUiBlocks) {
|
|
4814
|
-
rendered.push(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(React16.Fragment, { children: renderUiBlocks(part) }, part.id));
|
|
4815
|
-
continue;
|
|
4816
|
-
}
|
|
4817
4783
|
rendered.push(
|
|
4818
4784
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(React16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4819
4785
|
AgentChatPart,
|