@tangle-network/ui 8.1.0 → 9.0.0

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.js CHANGED
@@ -137,22 +137,21 @@ import {
137
137
  MessageList,
138
138
  ThinkingIndicator,
139
139
  UserMessage
140
- } from "./chunk-QUAU6ZNC.js";
140
+ } from "./chunk-LHOGIUGY.js";
141
141
  import {
142
142
  useAutoScroll,
143
143
  useRunCollapseState,
144
144
  useRunGroups
145
145
  } from "./chunk-AZWDI2JG.js";
146
- import "./chunk-LQS34IGP.js";
146
+ import "./chunk-47XH56SV.js";
147
147
  import {
148
148
  ToolCallFeed,
149
149
  parseToolEvent
150
150
  } from "./chunk-IWQZXL6A.js";
151
151
  import {
152
- AssistantRunShell,
153
152
  InlineThinkingItem,
154
153
  RunGroup
155
- } from "./chunk-C3BIVG72.js";
154
+ } from "./chunk-2TRMNB6L.js";
156
155
  import {
157
156
  ExpandedToolDetail,
158
157
  InlineToolItem,
@@ -339,7 +338,6 @@ function RedactedDocument({
339
338
  export {
340
339
  AgentTimeline,
341
340
  ArtifactPane,
342
- AssistantRunShell,
343
341
  AuthHeader,
344
342
  Avatar,
345
343
  AvatarFallback,
package/dist/run.d.ts CHANGED
@@ -28,34 +28,6 @@ interface RunGroupProps {
28
28
  */
29
29
  declare const RunGroup: React.MemoExoticComponent<({ run, partMap, collapsed, onToggle, branding, renderToolDetail, headerActions, renderToolActions, }: RunGroupProps) => react_jsx_runtime.JSX.Element | null>;
30
30
 
31
- interface AssistantRunShellProps {
32
- /** Header label, e.g. the agent name or "Tools". */
33
- label: string;
34
- /** Terse stat line beside the label, e.g. "3 tools, 2s thinking". */
35
- summary?: string;
36
- /** One-line preview shown next to the label AND below the header when collapsed. */
37
- collapsedPreview?: string;
38
- /** Small trailing glyphs before the status pill (e.g. category badges). */
39
- badges?: ReactNode;
40
- /** Drives the status pill and header spinner. */
41
- isStreaming?: boolean;
42
- collapsed: boolean;
43
- onToggle: () => void;
44
- /** Actions rendered outside the collapse trigger, right of the header. */
45
- headerActions?: ReactNode;
46
- children: ReactNode;
47
- className?: string;
48
- }
49
- /**
50
- * The collapsible "assistant run" container shared by `RunGroup` (session-model
51
- * driven) and `AgentTimeline` (declarative item list). Owns the header
52
- * (label · summary · badges · status pill · chevron), the collapsed preview, and
53
- * the Radix collapse — so both transcripts fold agent activity the same way and
54
- * there is one implementation of a run, not two. It renders only chrome; callers
55
- * pass the run body (tool rows, reasoning, text) as `children`.
56
- */
57
- declare function AssistantRunShell({ label, summary, collapsedPreview, badges, isStreaming, collapsed, onToggle, headerActions, children, className, }: AssistantRunShellProps): react_jsx_runtime.JSX.Element;
58
-
59
31
  interface InlineToolItemProps {
60
32
  part: ToolPart;
61
33
  renderToolDetail?: CustomToolRenderer;
@@ -98,4 +70,4 @@ declare function LiveDuration({ startTime }: {
98
70
  startTime: number;
99
71
  }): react_jsx_runtime.JSX.Element;
100
72
 
101
- export { AssistantRunShell, type AssistantRunShellProps, ExpandedToolDetail, type ExpandedToolDetailProps, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, LiveDuration, RunGroup, type RunGroupProps };
73
+ export { ExpandedToolDetail, type ExpandedToolDetailProps, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, LiveDuration, RunGroup, type RunGroupProps };
package/dist/run.js CHANGED
@@ -1,13 +1,12 @@
1
- import "./chunk-LQS34IGP.js";
1
+ import "./chunk-47XH56SV.js";
2
2
  import {
3
3
  ToolCallFeed,
4
4
  parseToolEvent
5
5
  } from "./chunk-IWQZXL6A.js";
6
6
  import {
7
- AssistantRunShell,
8
7
  InlineThinkingItem,
9
8
  RunGroup
10
- } from "./chunk-C3BIVG72.js";
9
+ } from "./chunk-2TRMNB6L.js";
11
10
  import {
12
11
  ExpandedToolDetail,
13
12
  InlineToolItem,
@@ -23,7 +22,6 @@ import "./chunk-FJBTCTZM.js";
23
22
  import "./chunk-WUQDUBJG.js";
24
23
  import "./chunk-RQHJBTEU.js";
25
24
  export {
26
- AssistantRunShell,
27
25
  ExpandedToolDetail,
28
26
  InlineThinkingItem,
29
27
  InlineToolItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/ui",
3
- "version": "8.1.0",
3
+ "version": "9.0.0",
4
4
  "description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { type KeyboardEvent, type ReactNode, useState } from "react";
1
+ import { type KeyboardEvent, type ReactNode } from "react";
2
2
  import {
3
3
  AlertTriangle,
4
4
  CheckCircle2,
@@ -12,7 +12,6 @@ import { Markdown } from "../markdown/markdown";
12
12
  import { ThinkingIndicator } from "./thinking-indicator";
13
13
  import { type ToolCallData } from "../run/tool-call-feed";
14
14
  import { ToolCallGroup, ToolCallStep } from "../run/tool-call-step";
15
- import { AssistantRunShell } from "../run/assistant-run-shell";
16
15
 
17
16
  export type AgentTimelineTone = "default" | "info" | "success" | "warning" | "error";
18
17
 
@@ -79,71 +78,6 @@ export interface AgentTimelineProps {
79
78
  isThinking?: boolean;
80
79
  emptyState?: ReactNode;
81
80
  className?: string;
82
- /**
83
- * Fold consecutive tool / tool-group items into one collapsible run shell
84
- * (the same `AssistantRunShell` `RunGroup` uses), so a burst of tool activity
85
- * reads as a single toggleable step instead of a long ladder of rows.
86
- * Default true; pass false for the flat one-row-per-tool timeline.
87
- */
88
- collapsibleToolRuns?: boolean;
89
- /** Start collapsed tool runs open (true) or collapsed (false). Default open. */
90
- defaultToolRunsOpen?: boolean;
91
- }
92
-
93
- /** A run of consecutive tool / tool-group items folded into one shell. */
94
- interface ToolRunGroup {
95
- id: string;
96
- kind: "tool_run";
97
- items: (AgentTimelineToolItem | AgentTimelineToolGroupItem)[];
98
- }
99
-
100
- type TimelineNode = AgentTimelineItem | ToolRunGroup;
101
-
102
- function foldToolRuns(items: AgentTimelineItem[]): TimelineNode[] {
103
- const nodes: TimelineNode[] = [];
104
- let run: (AgentTimelineToolItem | AgentTimelineToolGroupItem)[] = [];
105
-
106
- const flush = () => {
107
- if (run.length === 0) return;
108
- // A single tool stays a plain row; two or more fold into a collapsible run.
109
- if (run.length === 1) {
110
- nodes.push(run[0]);
111
- } else {
112
- nodes.push({ id: `tool-run-${run[0].id}`, kind: "tool_run", items: run });
113
- }
114
- run = [];
115
- };
116
-
117
- for (const item of items) {
118
- if (item.kind === "tool" || item.kind === "tool_group") {
119
- run.push(item);
120
- } else {
121
- flush();
122
- nodes.push(item);
123
- }
124
- }
125
- flush();
126
- return nodes;
127
- }
128
-
129
- function countTools(group: ToolRunGroup): number {
130
- return group.items.reduce(
131
- (n, item) => n + (item.kind === "tool_group" ? item.calls.length : 1),
132
- 0,
133
- );
134
- }
135
-
136
- function ToolCallRow({ call }: { call: ToolCallData }) {
137
- return (
138
- <ToolCallStep
139
- type={call.type}
140
- label={call.label}
141
- status={call.status}
142
- detail={call.detail}
143
- output={call.output}
144
- duration={call.duration}
145
- />
146
- );
147
81
  }
148
82
 
149
83
  const TONE_STYLES: Record<AgentTimelineTone, { dot: string; card: string; text: string; icon: typeof Info }> = {
@@ -319,17 +253,7 @@ export function AgentTimeline({
319
253
  isThinking,
320
254
  emptyState,
321
255
  className,
322
- collapsibleToolRuns = true,
323
- defaultToolRunsOpen = true,
324
256
  }: AgentTimelineProps) {
325
- // Collapse state for folded tool runs, keyed by run id. Absent → default.
326
- const [collapsedRuns, setCollapsedRuns] = useState<Record<string, boolean>>({});
327
- const toggleRun = (id: string) =>
328
- setCollapsedRuns((prev) => ({
329
- ...prev,
330
- [id]: prev[id] === undefined ? defaultToolRunsOpen : !prev[id],
331
- }));
332
-
333
257
  if (items.length === 0 && !isThinking) {
334
258
  return emptyState ? (
335
259
  <div className={cn("flex h-full items-center justify-center p-4", className)}>
@@ -342,110 +266,92 @@ export function AgentTimeline({
342
266
  ? [...items, { id: "__thinking__", kind: "custom", content: <ThinkingIndicator /> }]
343
267
  : items;
344
268
 
345
- const nodes: TimelineNode[] = collapsibleToolRuns
346
- ? foldToolRuns(renderedItems)
347
- : renderedItems;
348
-
349
- // Non-user rows participate in the connector spine.
350
- const timelineNodes = nodes.filter(
351
- (node) => !(node.kind === "message" && node.role === "user"),
352
- );
269
+ // Determine which items participate in the timeline connector (non-user-message items)
270
+ // User messages are rendered outside the timeline grid
271
+ const timelineItems = renderedItems.filter((item) => !(item.kind === "message" && item.role === "user"));
353
272
 
354
273
  return (
355
274
  <div className={cn("mx-auto w-full max-w-5xl px-4 py-4", className)}>
356
- {nodes.map((node) => {
275
+ {renderedItems.map((item, index) => {
357
276
  // User messages: right-aligned bubble, no connector
358
- if (node.kind === "message" && node.role === "user") {
359
- return <UserMessage key={node.id} item={node} />;
277
+ if (item.kind === "message" && item.role === "user") {
278
+ return <UserMessage key={item.id} item={item} />;
360
279
  }
361
280
 
362
- const isLast = timelineNodes.indexOf(node) === timelineNodes.length - 1;
363
-
364
- if (node.kind === "tool_run") {
365
- const collapsed = collapsedRuns[node.id] ?? !defaultToolRunsOpen;
366
- const total = countTools(node);
367
- return (
368
- <AgentTimelineRow key={node.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
369
- <AssistantRunShell
370
- label="Tools"
371
- summary={`${total} ${total === 1 ? "tool" : "tools"}`}
372
- collapsed={collapsed}
373
- onToggle={() => toggleRun(node.id)}
374
- >
375
- <div className="space-y-px">
376
- {node.items.map((item) =>
377
- item.kind === "tool_group" ? (
378
- <ToolCallGroup key={item.id} title={item.title}>
379
- {item.calls.map((call) => (
380
- <ToolCallRow key={call.id} call={call} />
381
- ))}
382
- </ToolCallGroup>
383
- ) : (
384
- <ToolCallRow key={item.id} call={item.call} />
385
- ),
386
- )}
387
- </div>
388
- </AssistantRunShell>
389
- </AgentTimelineRow>
390
- );
391
- }
281
+ const timelineIndex = timelineItems.indexOf(item);
282
+ const isLast = timelineIndex === timelineItems.length - 1;
392
283
 
393
- if (node.kind === "message") {
284
+ if (item.kind === "message") {
394
285
  return (
395
- <AgentTimelineRow key={node.id} isLast={isLast} accentClassName="bg-[var(--brand-glow)]">
396
- <AssistantMessage item={node} />
286
+ <AgentTimelineRow key={item.id} isLast={isLast} accentClassName="bg-[var(--brand-glow)]">
287
+ <AssistantMessage item={item} />
397
288
  </AgentTimelineRow>
398
289
  );
399
290
  }
400
291
 
401
- if (node.kind === "tool") {
292
+ if (item.kind === "tool") {
402
293
  return (
403
- <AgentTimelineRow key={node.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
404
- <ToolCallRow call={node.call} />
294
+ <AgentTimelineRow key={item.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
295
+ <ToolCallStep
296
+ type={item.call.type}
297
+ label={item.call.label}
298
+ status={item.call.status}
299
+ detail={item.call.detail}
300
+ output={item.call.output}
301
+ duration={item.call.duration}
302
+ />
405
303
  </AgentTimelineRow>
406
304
  );
407
305
  }
408
306
 
409
- if (node.kind === "tool_group") {
307
+ if (item.kind === "tool_group") {
410
308
  return (
411
- <AgentTimelineRow key={node.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
412
- <ToolCallGroup title={node.title}>
413
- {node.calls.map((call) => (
414
- <ToolCallRow key={call.id} call={call} />
309
+ <AgentTimelineRow key={item.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
310
+ <ToolCallGroup title={item.title}>
311
+ {item.calls.map((call) => (
312
+ <ToolCallStep
313
+ key={call.id}
314
+ type={call.type}
315
+ label={call.label}
316
+ status={call.status}
317
+ detail={call.detail}
318
+ output={call.output}
319
+ duration={call.duration}
320
+ />
415
321
  ))}
416
322
  </ToolCallGroup>
417
323
  </AgentTimelineRow>
418
324
  );
419
325
  }
420
326
 
421
- if (node.kind === "status") {
327
+ if (item.kind === "status") {
422
328
  return (
423
329
  <AgentTimelineRow
424
- key={node.id}
330
+ key={item.id}
425
331
  isLast={isLast}
426
- accentClassName={TONE_STYLES[node.tone ?? "default"].dot}
332
+ accentClassName={TONE_STYLES[item.tone ?? "default"].dot}
427
333
  >
428
- <StatusCard item={node} />
334
+ <StatusCard item={item} />
429
335
  </AgentTimelineRow>
430
336
  );
431
337
  }
432
338
 
433
- if (node.kind === "artifact") {
339
+ if (item.kind === "artifact") {
434
340
  return (
435
341
  <AgentTimelineRow
436
- key={node.id}
342
+ key={item.id}
437
343
  isLast={isLast}
438
- accentClassName={TONE_STYLES[node.tone ?? "default"].dot}
344
+ accentClassName={TONE_STYLES[item.tone ?? "default"].dot}
439
345
  >
440
- <ArtifactCard item={node} />
346
+ <ArtifactCard item={item} />
441
347
  </AgentTimelineRow>
442
348
  );
443
349
  }
444
350
 
445
351
  // custom
446
352
  return (
447
- <AgentTimelineRow key={node.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
448
- {(node as AgentTimelineCustomItem).content}
353
+ <AgentTimelineRow key={item.id} isLast={isLast} accentClassName="bg-[var(--border-hover)]">
354
+ {(item as AgentTimelineCustomItem).content}
449
355
  </AgentTimelineRow>
450
356
  );
451
357
  })}
package/src/run/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { RunGroup, type RunGroupProps } from "./run-group";
2
- export { AssistantRunShell, type AssistantRunShellProps } from "./assistant-run-shell";
3
2
  export { InlineToolItem, type InlineToolItemProps } from "./inline-tool-item";
4
3
  export {
5
4
  InlineThinkingItem,