@cellarnode/ui 0.201.1 → 0.203.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.
Files changed (159) hide show
  1. package/dist/agent/composer.d.ts +6 -1
  2. package/dist/agent/composer.d.ts.map +1 -1
  3. package/dist/agent/composer.js +43 -9
  4. package/dist/agent/composer.js.map +1 -1
  5. package/dist/agent/conversation.d.ts +20 -2
  6. package/dist/agent/conversation.d.ts.map +1 -1
  7. package/dist/agent/conversation.js +39 -5
  8. package/dist/agent/conversation.js.map +1 -1
  9. package/dist/agent/copy.d.ts +7 -0
  10. package/dist/agent/copy.d.ts.map +1 -1
  11. package/dist/agent/copy.js +9 -0
  12. package/dist/agent/copy.js.map +1 -1
  13. package/dist/agent/fixtures.d.ts +34 -0
  14. package/dist/agent/fixtures.d.ts.map +1 -1
  15. package/dist/agent/fixtures.js +83 -0
  16. package/dist/agent/fixtures.js.map +1 -1
  17. package/dist/agent/index.d.ts +18 -1
  18. package/dist/agent/index.d.ts.map +1 -1
  19. package/dist/agent/index.js +18 -1
  20. package/dist/agent/index.js.map +1 -1
  21. package/dist/agent/markdown.d.ts +64 -0
  22. package/dist/agent/markdown.d.ts.map +1 -0
  23. package/dist/agent/markdown.js +338 -0
  24. package/dist/agent/markdown.js.map +1 -0
  25. package/dist/agent/masked-value.d.ts +1 -0
  26. package/dist/agent/masked-value.d.ts.map +1 -1
  27. package/dist/agent/masked-value.js +4 -1
  28. package/dist/agent/masked-value.js.map +1 -1
  29. package/dist/agent/message.d.ts +26 -6
  30. package/dist/agent/message.d.ts.map +1 -1
  31. package/dist/agent/message.js +47 -11
  32. package/dist/agent/message.js.map +1 -1
  33. package/dist/agent/panel-frame.js +1 -1
  34. package/dist/agent/panel-frame.js.map +1 -1
  35. package/dist/agent/role-cards/card-kit.d.ts +111 -0
  36. package/dist/agent/role-cards/card-kit.d.ts.map +1 -0
  37. package/dist/agent/role-cards/card-kit.js +68 -0
  38. package/dist/agent/role-cards/card-kit.js.map +1 -0
  39. package/dist/agent/role-cards/data-table-card.d.ts +80 -0
  40. package/dist/agent/role-cards/data-table-card.d.ts.map +1 -0
  41. package/dist/agent/role-cards/data-table-card.js +214 -0
  42. package/dist/agent/role-cards/data-table-card.js.map +1 -0
  43. package/dist/agent/role-cards/fixtures.d.ts +124 -0
  44. package/dist/agent/role-cards/fixtures.d.ts.map +1 -0
  45. package/dist/agent/role-cards/fixtures.js +401 -0
  46. package/dist/agent/role-cards/fixtures.js.map +1 -0
  47. package/dist/agent/role-cards/host-contract.d.ts +214 -0
  48. package/dist/agent/role-cards/host-contract.d.ts.map +1 -0
  49. package/dist/agent/role-cards/host-contract.js +348 -0
  50. package/dist/agent/role-cards/host-contract.js.map +1 -0
  51. package/dist/agent/role-cards/inspector-drawer.d.ts +42 -0
  52. package/dist/agent/role-cards/inspector-drawer.d.ts.map +1 -0
  53. package/dist/agent/role-cards/inspector-drawer.js +68 -0
  54. package/dist/agent/role-cards/inspector-drawer.js.map +1 -0
  55. package/dist/agent/role-cards/inspector-fixtures.d.ts +84 -0
  56. package/dist/agent/role-cards/inspector-fixtures.d.ts.map +1 -0
  57. package/dist/agent/role-cards/inspector-fixtures.js +162 -0
  58. package/dist/agent/role-cards/inspector-fixtures.js.map +1 -0
  59. package/dist/agent/role-cards/inspector-record.d.ts +109 -0
  60. package/dist/agent/role-cards/inspector-record.d.ts.map +1 -0
  61. package/dist/agent/role-cards/inspector-record.js +346 -0
  62. package/dist/agent/role-cards/inspector-record.js.map +1 -0
  63. package/dist/agent/role-cards/inspector-view.d.ts +137 -0
  64. package/dist/agent/role-cards/inspector-view.d.ts.map +1 -0
  65. package/dist/agent/role-cards/inspector-view.js +261 -0
  66. package/dist/agent/role-cards/inspector-view.js.map +1 -0
  67. package/dist/agent/role-cards/match-card.d.ts +21 -0
  68. package/dist/agent/role-cards/match-card.d.ts.map +1 -0
  69. package/dist/agent/role-cards/match-card.js +30 -0
  70. package/dist/agent/role-cards/match-card.js.map +1 -0
  71. package/dist/agent/role-cards/offer-card.d.ts +27 -0
  72. package/dist/agent/role-cards/offer-card.d.ts.map +1 -0
  73. package/dist/agent/role-cards/offer-card.js +68 -0
  74. package/dist/agent/role-cards/offer-card.js.map +1 -0
  75. package/dist/agent/role-cards/opportunity-card.d.ts +26 -0
  76. package/dist/agent/role-cards/opportunity-card.d.ts.map +1 -0
  77. package/dist/agent/role-cards/opportunity-card.js +50 -0
  78. package/dist/agent/role-cards/opportunity-card.js.map +1 -0
  79. package/dist/agent/role-cards/product-card.d.ts +32 -0
  80. package/dist/agent/role-cards/product-card.d.ts.map +1 -0
  81. package/dist/agent/role-cards/product-card.js +50 -0
  82. package/dist/agent/role-cards/product-card.js.map +1 -0
  83. package/dist/agent/role-cards/proposal-diff.d.ts +38 -0
  84. package/dist/agent/role-cards/proposal-diff.d.ts.map +1 -0
  85. package/dist/agent/role-cards/proposal-diff.js +74 -0
  86. package/dist/agent/role-cards/proposal-diff.js.map +1 -0
  87. package/dist/agent/role-cards/registry.d.ts +43 -0
  88. package/dist/agent/role-cards/registry.d.ts.map +1 -0
  89. package/dist/agent/role-cards/registry.js +46 -0
  90. package/dist/agent/role-cards/registry.js.map +1 -0
  91. package/dist/agent/role-cards/score-meter.d.ts +12 -0
  92. package/dist/agent/role-cards/score-meter.d.ts.map +1 -0
  93. package/dist/agent/role-cards/score-meter.js +17 -0
  94. package/dist/agent/role-cards/score-meter.js.map +1 -0
  95. package/dist/agent/role-cards/surface-links.d.ts +54 -0
  96. package/dist/agent/role-cards/surface-links.d.ts.map +1 -0
  97. package/dist/agent/role-cards/surface-links.js +149 -0
  98. package/dist/agent/role-cards/surface-links.js.map +1 -0
  99. package/dist/agent/role-cards/text-safety.d.ts +27 -0
  100. package/dist/agent/role-cards/text-safety.d.ts.map +1 -0
  101. package/dist/agent/role-cards/text-safety.js +77 -0
  102. package/dist/agent/role-cards/text-safety.js.map +1 -0
  103. package/dist/agent/schema.d.ts +10 -0
  104. package/dist/agent/schema.d.ts.map +1 -1
  105. package/dist/agent/schema.js +31 -3
  106. package/dist/agent/schema.js.map +1 -1
  107. package/dist/agent/states.d.ts +1 -0
  108. package/dist/agent/states.d.ts.map +1 -1
  109. package/dist/agent/states.js +1 -1
  110. package/dist/agent/states.js.map +1 -1
  111. package/dist/agent/thinking.d.ts +13 -4
  112. package/dist/agent/thinking.d.ts.map +1 -1
  113. package/dist/agent/thinking.js +15 -6
  114. package/dist/agent/thinking.js.map +1 -1
  115. package/dist/agent/thread-list.d.ts +45 -2
  116. package/dist/agent/thread-list.d.ts.map +1 -1
  117. package/dist/agent/thread-list.js +175 -8
  118. package/dist/agent/thread-list.js.map +1 -1
  119. package/dist/agent/thread-title.d.ts +46 -0
  120. package/dist/agent/thread-title.d.ts.map +1 -0
  121. package/dist/agent/thread-title.js +99 -0
  122. package/dist/agent/thread-title.js.map +1 -0
  123. package/dist/agent/tool-activity-model.d.ts +136 -0
  124. package/dist/agent/tool-activity-model.d.ts.map +1 -0
  125. package/dist/agent/tool-activity-model.js +288 -0
  126. package/dist/agent/tool-activity-model.js.map +1 -0
  127. package/dist/agent/tool-activity.d.ts +61 -0
  128. package/dist/agent/tool-activity.d.ts.map +1 -0
  129. package/dist/agent/tool-activity.js +199 -0
  130. package/dist/agent/tool-activity.js.map +1 -0
  131. package/dist/agent/tool-call-card.d.ts +11 -1
  132. package/dist/agent/tool-call-card.d.ts.map +1 -1
  133. package/dist/agent/tool-call-card.js +19 -4
  134. package/dist/agent/tool-call-card.js.map +1 -1
  135. package/dist/agent/ui.js +1 -1
  136. package/dist/agent/ui.js.map +1 -1
  137. package/dist/agent/use-motion.d.ts +15 -0
  138. package/dist/agent/use-motion.d.ts.map +1 -0
  139. package/dist/agent/use-motion.js +52 -0
  140. package/dist/agent/use-motion.js.map +1 -0
  141. package/dist/chat/use-stick-to-bottom.d.ts +5 -0
  142. package/dist/chat/use-stick-to-bottom.d.ts.map +1 -1
  143. package/dist/chat/use-stick-to-bottom.js +11 -1
  144. package/dist/chat/use-stick-to-bottom.js.map +1 -1
  145. package/dist/components/sheet.d.ts +3 -1
  146. package/dist/components/sheet.d.ts.map +1 -1
  147. package/dist/components/sheet.js +2 -2
  148. package/dist/components/sheet.js.map +1 -1
  149. package/dist/portfolio-import/import-job-panels.d.ts +6 -0
  150. package/dist/portfolio-import/import-job-panels.d.ts.map +1 -1
  151. package/dist/portfolio-import/import-job-panels.js +11 -4
  152. package/dist/portfolio-import/import-job-panels.js.map +1 -1
  153. package/dist/portfolio-import/job-error-copy.d.ts +62 -0
  154. package/dist/portfolio-import/job-error-copy.d.ts.map +1 -0
  155. package/dist/portfolio-import/job-error-copy.js +78 -0
  156. package/dist/portfolio-import/job-error-copy.js.map +1 -0
  157. package/dist/realtime/organisation-events/schemas.d.ts +2 -2
  158. package/package.json +4 -1
  159. package/src/theme/tokens.css +66 -0
@@ -0,0 +1,288 @@
1
+ import { isMasked } from "./schema.js";
2
+ /**
3
+ * @internal Pure helpers behind the tool-activity trail: tool and card names in words, the result of a call without the
4
+ * model-facing envelope, and which calls a domain card shows. Host- and role-agnostic: nothing here knows an admin route or a
5
+ * producer tool. The defaults are English; every table is overridable (`AgentToolNaming`).
6
+ */
7
+ /** The role prefixes the MCP tools carry (`admin_get_mcp_overview`, `producer_get_offer_workspace`). Stripped from a name. */
8
+ export const DEFAULT_TOOL_PREFIXES = [
9
+ "admin",
10
+ "producer",
11
+ "importer",
12
+ "distributor",
13
+ "elabel",
14
+ ];
15
+ export const DEFAULT_ACRONYMS = {
16
+ ai: "AI",
17
+ api: "API",
18
+ csv: "CSV",
19
+ id: "ID",
20
+ ids: "IDs",
21
+ ip: "IP",
22
+ json: "JSON",
23
+ mcp: "MCP",
24
+ otp: "OTP",
25
+ pdf: "PDF",
26
+ qr: "QR",
27
+ sso: "SSO",
28
+ ui: "UI",
29
+ url: "URL",
30
+ urls: "URLs",
31
+ vat: "VAT",
32
+ };
33
+ export const DEFAULT_TOOL_VERBS = {
34
+ get: { done: "Checked", active: "Checking", failed: "Couldn't check" },
35
+ find: { done: "Searched", active: "Searching", failed: "Couldn't search" },
36
+ search: { done: "Searched", active: "Searching", failed: "Couldn't search" },
37
+ list: { done: "Listed", active: "Listing", failed: "Couldn't list" },
38
+ read: { done: "Read", active: "Reading", failed: "Couldn't read" },
39
+ check: { done: "Checked", active: "Checking", failed: "Couldn't check" },
40
+ create: { done: "Created", active: "Creating", failed: "Couldn't create" },
41
+ update: { done: "Updated", active: "Updating", failed: "Couldn't update" },
42
+ delete: { done: "Deleted", active: "Deleting", failed: "Couldn't delete" },
43
+ start: { done: "Started", active: "Starting", failed: "Couldn't start" },
44
+ send: { done: "Sent", active: "Sending", failed: "Couldn't send" },
45
+ run: { done: "Ran", active: "Running", failed: "Couldn't run" },
46
+ };
47
+ const lowerWords = (words, acronyms) => words.map((w) => acronyms[w.toLowerCase()] ?? w.toLowerCase());
48
+ /** The words as a sentence: acronyms kept in capitals, the first word capitalised unless it is an acronym already. */
49
+ const sentence = (words, acronyms) => {
50
+ const out = lowerWords(words, acronyms);
51
+ const first = out[0];
52
+ if (first && first === first.toLowerCase())
53
+ out[0] = first.charAt(0).toUpperCase() + first.slice(1);
54
+ return out.join(" ");
55
+ };
56
+ /** A name that is an identifier (snake_case or camelCase with no spaces), not a sentence the host already wrote. */
57
+ export const looksLikeIdentifier = (name) => /^[A-Za-z][A-Za-z0-9]*(?:[_-][A-Za-z0-9]+)+$/.test(name) ||
58
+ /^[a-z]+(?:[A-Z][a-z0-9]+)+$/.test(name);
59
+ const hostLabel = (label, tense) => {
60
+ if (label === undefined)
61
+ return undefined;
62
+ if (typeof label === "string")
63
+ return label;
64
+ return label[tense] ?? label.done ?? label.active ?? label.failed;
65
+ };
66
+ /** Builds the namer a component uses: the host's wording first, then the (overridable) English defaults. */
67
+ export function createToolNamer(naming = {}) {
68
+ const { toolLabels, formatToolLabel, cardLabels, toolWording } = naming;
69
+ const acronyms = toolWording?.acronyms
70
+ ? { ...DEFAULT_ACRONYMS, ...toolWording.acronyms }
71
+ : DEFAULT_ACRONYMS;
72
+ const verbs = toolWording?.verbs
73
+ ? { ...DEFAULT_TOOL_VERBS, ...toolWording.verbs }
74
+ : DEFAULT_TOOL_VERBS;
75
+ const prefixes = toolWording?.prefixes ?? DEFAULT_TOOL_PREFIXES;
76
+ return {
77
+ tool(name, tense) {
78
+ const asked = formatToolLabel?.(name, tense);
79
+ if (asked)
80
+ return asked;
81
+ const fromHost = hostLabel(toolLabels?.[name], tense);
82
+ if (fromHost)
83
+ return fromHost;
84
+ if (!looksLikeIdentifier(name))
85
+ return name;
86
+ let words = name
87
+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
88
+ .split(/[_-]+/)
89
+ .filter(Boolean);
90
+ const head = words[0]?.toLowerCase();
91
+ if (words.length > 1 && head && prefixes.includes(head))
92
+ words = words.slice(1);
93
+ const verb = words.length > 1 ? verbs[words[0].toLowerCase()] : undefined;
94
+ if (verb)
95
+ return `${verb[tense]} ${lowerWords(words.slice(1), acronyms).join(" ")}`;
96
+ return sentence(words, acronyms);
97
+ },
98
+ card(cardType) {
99
+ const fromHost = cardLabels?.[cardType];
100
+ if (fromHost)
101
+ return fromHost;
102
+ const words = cardType
103
+ .replace(/Card$/, "")
104
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
105
+ .split(/[\s_-]+/)
106
+ .filter(Boolean);
107
+ return words.length === 0 ? cardType : sentence(words, acronyms);
108
+ },
109
+ };
110
+ }
111
+ const defaultNamer = createToolNamer();
112
+ /**
113
+ * `admin_get_mcp_overview` becomes "Checked MCP overview" (done) or "Checking MCP overview" (active);
114
+ * `producer_get_offer_workspace` becomes "Checked offer workspace"; `admin_platform_stats` becomes "Platform stats".
115
+ * A host label for the exact name wins.
116
+ */
117
+ export function humanizeToolName(name, options = {}) {
118
+ const { tense = "done", ...naming } = options;
119
+ const namer = naming.toolLabels || naming.formatToolLabel || naming.toolWording || naming.cardLabels
120
+ ? createToolNamer(naming)
121
+ : defaultNamer;
122
+ return namer.tool(name, tense);
123
+ }
124
+ /** `McpUsageCard` becomes "MCP usage", `OfferCard` becomes "Offer", `DataTable` becomes "Data table". */
125
+ export function humanizeCardType(cardType, naming = {}) {
126
+ return createToolNamer(naming).card(cardType);
127
+ }
128
+ /** A preview never holds more than this many characters, however large the result. */
129
+ export const MAX_PREVIEW_CHARS = 20_000;
130
+ const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
131
+ /** The wrapper the tool layer puts around a result for the model: `{ untrusted: true, source, data }`. Only that exact flag. */
132
+ export function isResultEnvelope(v) {
133
+ return isRecord(v) && v.untrusted === true && ("source" in v || "data" in v);
134
+ }
135
+ /** The result with the envelope's own keys dropped: its `data` when there is one, else the other keys. */
136
+ export function unwrapResultEnvelope(v) {
137
+ if (!isResultEnvelope(v))
138
+ return v;
139
+ if ("data" in v)
140
+ return v.data;
141
+ const { untrusted: _u, source: _s, ...rest } = v;
142
+ return rest;
143
+ }
144
+ // A flattened, shortened result (`{"untrusted":true,"source":"x","data":{"calls":0,"err…`) cannot be parsed, but its prefix is
145
+ // known. Drop the prefix so the text a reader sees starts at the data.
146
+ const ENVELOPE_PREFIX = /^\s*\{\s*"untrusted"\s*:\s*true\s*,\s*"source"\s*:\s*"(?:[^"\\]|\\.)*"\s*,\s*"data"\s*:\s*/;
147
+ const lineCount = (text) => (text === "" ? 0 : text.split("\n").length);
148
+ const clip = (text) => {
149
+ if (text.length <= MAX_PREVIEW_CHARS)
150
+ return text;
151
+ // Never end on half of a surrogate pair (an emoji cut in two prints as a replacement character).
152
+ const last = text.charCodeAt(MAX_PREVIEW_CHARS - 1);
153
+ const end = last >= 0xd800 && last <= 0xdbff ? MAX_PREVIEW_CHARS - 1 : MAX_PREVIEW_CHARS;
154
+ return `${text.slice(0, end)}…`;
155
+ };
156
+ const mapMasked = (v) => {
157
+ if (isMasked(v))
158
+ return v.display;
159
+ if (Array.isArray(v))
160
+ return v.map(mapMasked);
161
+ if (isRecord(v))
162
+ return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, mapMasked(x)]));
163
+ return v;
164
+ };
165
+ function printJson(value) {
166
+ const text = clip(JSON.stringify(mapMasked(value), null, 2) ?? "");
167
+ return { kind: "json", text, lines: lineCount(text) };
168
+ }
169
+ function printText(text) {
170
+ const clipped = clip(text);
171
+ return { kind: "text", text: clipped, lines: lineCount(clipped) };
172
+ }
173
+ /**
174
+ * What a call's result looks like to a person: the envelope's `data` (the envelope's `untrusted` and `source` keys are never
175
+ * shown), pretty-printed, masked cells as their masked text, at most {@link MAX_PREVIEW_CHARS} characters. A string is parsed
176
+ * as JSON when it is JSON; a string that is not (plain text, or JSON shortened by the host) keeps the text, minus a
177
+ * recognisable envelope prefix. The envelope is only unwrapped when it says `untrusted: true`: a result that merely has a
178
+ * `source` or `data` key is the host's own data and is shown whole.
179
+ *
180
+ * `result` is shown as given: the host redacts it the way it redacts `args` (masked cells are marked, never raw).
181
+ */
182
+ export function formatToolResult(raw) {
183
+ if (raw === undefined || raw === null || raw === "")
184
+ return undefined;
185
+ if (typeof raw === "string") {
186
+ const trimmed = raw.trim();
187
+ try {
188
+ const parsed = JSON.parse(trimmed);
189
+ if (typeof parsed === "object" && parsed !== null)
190
+ return printJson(unwrapResultEnvelope(parsed));
191
+ }
192
+ catch {
193
+ /* not JSON, or shortened JSON: fall through to text */
194
+ }
195
+ const stripped = trimmed.replace(ENVELOPE_PREFIX, "");
196
+ if (stripped !== trimmed) {
197
+ try {
198
+ const inner = JSON.parse(stripped.replace(/\}\s*$/, ""));
199
+ return printJson(inner);
200
+ }
201
+ catch {
202
+ /* shortened data: show it as text */
203
+ }
204
+ }
205
+ return printText(stripped);
206
+ }
207
+ return printJson(unwrapResultEnvelope(raw));
208
+ }
209
+ /** What a call returned for the preview: the full `result` when the host sent one, else its (usually shortened) summary. */
210
+ export const resultOf = (call) => call.result ?? call.resultSummary;
211
+ /** Whether there is anything to preview. Cheap: no parsing or printing, so it can run on every render. */
212
+ export function hasResult(call) {
213
+ const r = resultOf(call);
214
+ if (r === undefined || r === null)
215
+ return false;
216
+ return typeof r === "string" ? r.trim() !== "" : true;
217
+ }
218
+ export const stepId = (s) => (s.kind === "tool" ? s.call.id : s.id);
219
+ /** A step the agent is still working on. */
220
+ export const stepInFlight = (s) => s.kind === "thought"
221
+ ? s.running
222
+ : s.call.status === "pending" || s.call.status === "running" || s.call.status === "retrying";
223
+ /**
224
+ * Folds a message's parts for display: every run of consecutive `toolCall` and `thinking` parts becomes one activity trail;
225
+ * everything else (text, approvals, cards) stays a part in its place. An approval is never folded into a trail.
226
+ *
227
+ * A call is "shown below" only when a later, rendered `card` part names it (`forCallId`), or, when no card names a call,
228
+ * when the host's `covers` says so. There is no default: guessing which card shows which call marks the wrong steps.
229
+ */
230
+ export function planMessageParts(parts, options = {}) {
231
+ const { covers, streaming = false, renderedCards } = options;
232
+ const namer = createToolNamer(options);
233
+ const rendered = (index) => renderedCards === undefined || renderedCards.has(index);
234
+ const linked = new Map();
235
+ parts.forEach((p, i) => {
236
+ if (p.type === "card" && p.forCallId && rendered(i))
237
+ linked.set(p.forCallId, namer.card(p.cardType));
238
+ });
239
+ const explicit = linked.size > 0;
240
+ const coverOf = (call, from) => {
241
+ if (call.status !== "succeeded")
242
+ return undefined;
243
+ if (explicit)
244
+ return linked.get(call.id);
245
+ if (!covers)
246
+ return undefined;
247
+ for (let j = from + 1; j < parts.length; j++) {
248
+ const later = parts[j];
249
+ if (later?.type !== "card" || !rendered(j))
250
+ continue;
251
+ if (covers(call, { cardType: later.cardType, data: later.data }))
252
+ return namer.card(later.cardType);
253
+ }
254
+ return undefined;
255
+ };
256
+ const items = [];
257
+ const push = (step, index) => {
258
+ const prev = items[items.length - 1];
259
+ if (prev?.kind === "activity")
260
+ prev.steps.push(step);
261
+ else
262
+ items.push({
263
+ kind: "activity",
264
+ key: `activity:${stepId(step)}`,
265
+ steps: [step],
266
+ startIndex: index,
267
+ });
268
+ };
269
+ parts.forEach((part, index) => {
270
+ if (part.type === "toolCall") {
271
+ const cardTitle = coverOf(part.call, index);
272
+ push({ kind: "tool", call: part.call, shownBelow: cardTitle !== undefined, cardTitle }, index);
273
+ }
274
+ else if (part.type === "thinking") {
275
+ push({
276
+ kind: "thought",
277
+ id: `thought:${index}`,
278
+ summary: part.summary,
279
+ running: streaming && index === parts.length - 1,
280
+ }, index);
281
+ }
282
+ else {
283
+ items.push({ kind: "part", part, index });
284
+ }
285
+ });
286
+ return items;
287
+ }
288
+ //# sourceMappingURL=tool-activity-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-activity-model.js","sourceRoot":"","sources":["../../src/agent/tool-activity-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6C,MAAM,UAAU,CAAC;AAE/E;;;;GAIG;AAEH,8HAA8H;AAC9H,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,OAAO;IACP,UAAU;IACV,UAAU;IACV,aAAa;IACb,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAqC;IAChE,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACX,CAAC;AAMF,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACtE,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAA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ity-model.js";
2
+ export interface AgentToolActivityCopy {
3
+ pending: string;
4
+ running: string;
5
+ succeeded: string;
6
+ failed: string;
7
+ retrying: string;
8
+ /** A step the user stopped (only that; anything else unfinished is `failed`): its status word, read by assistive tech. */
9
+ cancelled: string;
10
+ /** The line under a stopped step. It says what happened, never "failed": nothing went wrong. */
11
+ cancelledDetail: string;
12
+ /** Accessible name of the list of steps. */
13
+ list: string;
14
+ /** A finished thought, and one in progress. */
15
+ thought: string;
16
+ thinking: string;
17
+ /** Appended to the name of a step in progress ("Checking MCP overview…"). */
18
+ inProgress: string;
19
+ /** Read before a card's name on the step the card shows. */
20
+ shownBelow: string;
21
+ /** Between a step's name and its status, and between "shown below" and the card's name, for assistive tech. */
22
+ srStatusSeparator: string;
23
+ srCardSeparator: string;
24
+ arguments: string;
25
+ showResult: string;
26
+ hideResult: string;
27
+ /** `{count}` is the number of lines "show all" reveals. */
28
+ showAll: string;
29
+ showLess: string;
30
+ retry: string;
31
+ /** `{seconds}` a finished step took. */
32
+ took: string;
33
+ /** The one line a long, finished trail folds into; `{count}` steps. */
34
+ steps: string;
35
+ /** The same line when some of the steps were stopped; `{count}` steps, `{stopped}` of them stopped. */
36
+ stepsStopped: string;
37
+ }
38
+ export interface AgentToolActivityProps extends AgentToolNaming {
39
+ steps: readonly AgentActivityStep[];
40
+ /** A failed step's Retry. Without it a failed step shows its error and no button. */
41
+ onRetry?: (callId: string) => void;
42
+ /** Start with every step (and a folded trail) open. */
43
+ defaultOpen?: boolean;
44
+ /** BCP 47 tag for the numbers shown ("Took 0,6s"). Default: plain "0.6". A malformed tag falls back to the default. */
45
+ locale?: string;
46
+ copy?: Partial<AgentToolActivityCopy>;
47
+ className?: string;
48
+ }
49
+ /**
50
+ * @internal The agent's work in a turn as a quiet vertical trail: one muted line per step ("Thought ›", "Checked MCP overview",
51
+ * "Searched organizations"), a small status icon each, in place of a card per tool call. The step in progress has a spinner
52
+ * (static under `prefers-reduced-motion`) and the in-progress suffix; the icon of a step that finishes pops in. A step opens to
53
+ * its arguments and a formatted, shortened result preview (the model-facing `untrusted`/`source` envelope is never shown). A step
54
+ * a domain card shows carries that card's name as a chip and keeps its preview behind a toggle. A failed step's error and Retry
55
+ * are always visible. A trail of more than four steps folds into one line ONLY if it was already finished when it appeared (a
56
+ * history trail): a trail that was live is never folded under the reader, and neither is one they have opened. A folded history
57
+ * trail that a live or failed step joins opens, and its fold line (it says the trail is done) is hidden until the trail settles.
58
+ * Approvals are never part of the trail.
59
+ */
60
+ export declare function AgentToolActivity({ steps, toolLabels, formatToolLabel, cardLabels, toolWording, onRetry, defaultOpen, locale, copy, className, }: AgentToolActivityProps): import("react/jsx-runtime").JSX.Element;
61
+ //# sourceMappingURL=tool-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-activity.d.ts","sourceRoot":"","sources":["../../src/agent/tool-activity.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAIrB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,0HAA0H;IAC1H,SAAS,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,eAAe,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,+GAA+G;IAC/G,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,YAAY,EAAE,MAAM,CAAC;CACtB;AA6XD,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,qFAAqF;IACrF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uHAAuH;IACvH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAmB,EACnB,MAAM,EACN,IAAI,EACJ,SAAS,GACV,EAAE,sBAAsB,2CAyGxB"}
@@ -0,0 +1,199 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { ArrowDown, Check, ChevronRight, CircleDashed, CircleStop, Lightbulb, LoaderCircle, RotateCw, TriangleAlert, } from "lucide-react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { fmt, useCopy } from "./copy.js";
6
+ import { MaskedValue } from "./masked-value.js";
7
+ import { createToolNamer, formatToolResult, hasResult, resultOf, stepId, stepInFlight, } from "./tool-activity-model.js";
8
+ import { agentButton, focusRing, toneChip } from "./ui.js";
9
+ import { useChanged } from "./use-motion.js";
10
+ const DEFAULT_COPY = {
11
+ pending: "Queued",
12
+ running: "Running",
13
+ succeeded: "Done",
14
+ failed: "Failed",
15
+ retrying: "Retrying",
16
+ cancelled: "Stopped",
17
+ cancelledDetail: "Stopped before it finished",
18
+ list: "Steps",
19
+ thought: "Thought",
20
+ thinking: "Thinking",
21
+ inProgress: "…",
22
+ shownBelow: "Shown below",
23
+ srStatusSeparator: ", ",
24
+ srCardSeparator: ": ",
25
+ arguments: "Arguments",
26
+ showResult: "Show result",
27
+ hideResult: "Hide result",
28
+ showAll: "Show all {count} lines",
29
+ showLess: "Show less",
30
+ retry: "Retry",
31
+ took: "Took {seconds}s",
32
+ steps: "{count} steps",
33
+ stepsStopped: "{count} steps, {stopped} stopped",
34
+ };
35
+ const STATUS = {
36
+ pending: { icon: CircleDashed, tone: "text-muted-foreground" },
37
+ running: { icon: LoaderCircle, spin: true, tone: "text-muted-foreground" },
38
+ succeeded: { icon: Check, tone: "text-muted-foreground" },
39
+ failed: { icon: TriangleAlert, tone: "text-[var(--tone-danger-fg)]" },
40
+ retrying: { icon: RotateCw, spin: true, tone: "text-muted-foreground" },
41
+ // Stopped is not an error: the same quiet tone as every other step, with its own mark.
42
+ cancelled: { icon: CircleStop, tone: "text-muted-foreground" },
43
+ };
44
+ /** A status this version does not know (a newer host): quiet, not a crash. */
45
+ const NEUTRAL_STATUS = { icon: CircleDashed, tone: "text-muted-foreground" };
46
+ /** Past this many steps, a trail that was already finished when it appeared folds into one line. */
47
+ const FOLD_AFTER = 4;
48
+ const PREVIEW_LINES = 20;
49
+ /** Even "show all" stops here: a result of thousands of lines is not something to put in a chat bubble. */
50
+ const MAX_LINES = 400;
51
+ /**
52
+ * Small, quiet status mark. The mark that appears when a step finishes pops in on a WRAPPER, never on the icon itself: a
53
+ * spinning icon must keep its own animation, and two animations on one element would replace each other.
54
+ */
55
+ function StatusIcon({ status, kind, changed, }) {
56
+ const s = STATUS[status] ?? NEUTRAL_STATUS;
57
+ const Icon = kind === "thought" && status === "succeeded" ? Lightbulb : s.icon;
58
+ return (_jsx("span", { className: cn("inline-flex shrink-0", changed && "agent-pop"), children: _jsx(Icon, { "aria-hidden": true, className: cn("size-3.5", s.tone, s.spin && "animate-spin motion-reduce:animate-none") }) }, status));
59
+ }
60
+ function ResultPreview({ call, collapsed, c, }) {
61
+ const raw = resultOf(call);
62
+ const view = useMemo(() => formatToolResult(raw), [raw]);
63
+ const [shown, setShown] = useState(!collapsed);
64
+ const [all, setAll] = useState(false);
65
+ const id = useId();
66
+ if (!view)
67
+ return null;
68
+ const lines = view.text.split("\n");
69
+ const revealed = Math.min(lines.length, MAX_LINES);
70
+ const clipped = !all && lines.length > PREVIEW_LINES;
71
+ const text = all
72
+ ? lines.length > MAX_LINES
73
+ ? `${lines.slice(0, MAX_LINES).join("\n")}\n…`
74
+ : view.text
75
+ : clipped
76
+ ? `${lines.slice(0, PREVIEW_LINES).join("\n")}\n…`
77
+ : view.text;
78
+ return (_jsxs("div", { className: "flex flex-col items-start gap-1.5", children: [collapsed && (_jsxs("button", { type: "button", "aria-expanded": shown, "aria-controls": id, onClick: () => setShown((v) => !v), className: cn("inline-flex min-h-6 items-center gap-1 rounded-md text-xs/4 text-muted-foreground hover:text-foreground pointer-coarse:min-h-11", focusRing), children: [_jsx(ChevronRight, { "aria-hidden": true, className: cn("size-3.5 transition-transform duration-[var(--duration-micro)] motion-reduce:transition-none", shown && "rotate-90") }), shown ? c.hideResult : c.showResult] })), shown && (_jsxs("div", { id: id, className: "flex w-full min-w-0 flex-col items-start gap-1.5", children: [_jsx("pre", { tabIndex: 0, "data-kind": view.kind, className: cn("max-h-80 w-full overflow-auto rounded-lg bg-muted p-2.5 font-mono text-xs/5 break-words whitespace-pre-wrap text-foreground", focusRing), children: text }), lines.length > PREVIEW_LINES && (_jsx("button", { type: "button", onClick: () => setAll((v) => !v), className: cn("inline-flex min-h-6 items-center rounded-md text-xs/4 text-muted-foreground underline underline-offset-4 hover:text-foreground pointer-coarse:min-h-11", focusRing), children: all ? c.showLess : fmt(c.showAll, { count: revealed }) }))] }))] }));
79
+ }
80
+ function ToolDetails({ step, c, locale, }) {
81
+ const { call } = step;
82
+ const args = Object.entries(call.args ?? {});
83
+ return (_jsxs("div", { className: "agent-fade-in flex flex-col gap-1.5 pt-1 pb-1", children: [call.durationMs !== undefined && (_jsx("p", { className: "text-muted-foreground tabular-nums", children: fmt(c.took, { seconds: seconds(call.durationMs, locale) }) })), args.length > 0 && (_jsx("dl", { "aria-label": c.arguments, className: "grid grid-cols-[minmax(0,7rem)_1fr] gap-x-3 gap-y-1 rounded-lg bg-muted p-2.5", children: args.map(([k, v]) => (_jsxs("div", { className: "contents", children: [_jsx("dt", { className: "truncate font-mono text-muted-foreground", children: k }), _jsx("dd", { className: "min-w-0 font-mono break-words text-foreground", children: _jsx(MaskedValue, { value: v }) })] }, k))) })), call.status === "succeeded" && (_jsx(ResultPreview, { call: call, collapsed: step.shownBelow, c: c }))] }));
84
+ }
85
+ const plainSeconds = (s) => s.toFixed(1);
86
+ /** One formatter per locale tag for the life of the page (building an `Intl.NumberFormat` is not cheap); a bad tag is remembered too. */
87
+ const SECONDS_FORMATTERS = new Map();
88
+ function secondsFormatter(locale) {
89
+ const known = SECONDS_FORMATTERS.get(locale);
90
+ if (known)
91
+ return known;
92
+ let made;
93
+ try {
94
+ const format = new Intl.NumberFormat(locale, {
95
+ minimumFractionDigits: 1,
96
+ maximumFractionDigits: 1,
97
+ useGrouping: false,
98
+ });
99
+ made = (n) => format.format(n);
100
+ }
101
+ catch {
102
+ made = plainSeconds; // a malformed tag ("en_US") is the host's bug, not a reason to fail a render
103
+ }
104
+ SECONDS_FORMATTERS.set(locale, made);
105
+ return made;
106
+ }
107
+ /** Seconds with one decimal: "0.6" as JavaScript spells it, or in the host's locale ("0,6") when it gives one. */
108
+ const seconds = (ms, locale) => (locale === undefined ? plainSeconds : secondsFormatter(locale))(ms / 1000);
109
+ /** Cheap: looks at the keys and whether a result exists, never parses or prints it (this runs on every render). */
110
+ const hasToolDetails = (s) => Object.keys(s.call.args ?? {}).length > 0 ||
111
+ s.call.durationMs !== undefined ||
112
+ (s.call.status === "succeeded" && hasResult(s.call));
113
+ function StepRow({ step, namer, defaultOpen, onRetry, locale, c, }) {
114
+ const [open, setOpen] = useState(defaultOpen);
115
+ const panelId = useId();
116
+ const inFlight = stepInFlight(step);
117
+ const status = step.kind === "thought" ? (step.running ? "running" : "succeeded") : step.call.status;
118
+ const failedCall = step.kind === "tool" && step.call.status === "failed" ? step.call : undefined;
119
+ const stopped = step.kind === "tool" && step.call.status === "cancelled";
120
+ // A status this version does not know says neither done nor failed: the active tense, and no status word.
121
+ const unknown = !(status in STATUS);
122
+ // A stopped step names the work it was doing ("Checking organization"), without the in-progress suffix: it neither finished
123
+ // ("Checked") nor failed ("Couldn't check").
124
+ const tense = failedCall
125
+ ? "failed"
126
+ : inFlight || stopped || unknown
127
+ ? "active"
128
+ : "done";
129
+ const label = step.kind === "thought"
130
+ ? step.running
131
+ ? c.thinking
132
+ : c.thought
133
+ : namer.tool(step.call.name, tense);
134
+ const expandable = step.kind === "thought" ? step.summary.trim() !== "" : hasToolDetails(step);
135
+ const title = step.kind === "tool" ? step.call.name : undefined;
136
+ const swapped = useChanged(tense);
137
+ const statusChanged = useChanged(status);
138
+ const text = (_jsxs("span", { title: title, className: cn("min-w-0 truncate", swapped && "agent-swap-in", failedCall && "text-[var(--tone-danger-fg)]"), children: [label, inFlight ? c.inProgress : ""] }, tense));
139
+ const chip = step.kind === "tool" && step.shownBelow ? (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-xs/4", toneChip.neutral), children: [_jsx(ArrowDown, { "aria-hidden": true, className: "size-3" }), _jsxs("span", { className: "sr-only", children: [c.shownBelow, c.srCardSeparator] }), step.cardTitle || c.shownBelow] })) : null;
140
+ // A stopped step's detail line already says "Stopped before it finished": the status word would be read twice.
141
+ const statusSr = stopped || unknown ? null : (_jsxs("span", { className: "sr-only", children: [c.srStatusSeparator, c[status]] }));
142
+ const rowClass = "inline-flex min-h-6 max-w-full items-center gap-2 text-left text-xs/5 text-muted-foreground";
143
+ return (_jsxs("li", { "data-status": status, "data-kind": step.kind, className: "flex flex-col", children: [expandable ? (_jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen((v) => !v), className: cn(rowClass, "-ml-1 self-start rounded-md px-1 transition-colors duration-[var(--duration-micro)] hover:text-foreground motion-reduce:transition-none pointer-coarse:min-h-11", focusRing), children: [_jsx(StatusIcon, { status: status, kind: step.kind, changed: statusChanged }), text, chip, statusSr, _jsx(ChevronRight, { "aria-hidden": true, className: cn("size-3.5 shrink-0 transition-transform duration-[var(--duration-micro)] motion-reduce:transition-none", open && "rotate-90") })] })) : (_jsxs("div", { className: cn(rowClass, "self-start"), children: [_jsx(StatusIcon, { status: status, kind: step.kind, changed: statusChanged }), text, chip, statusSr] })), stopped && (_jsx("p", { className: "mt-0.5 pl-5.5 text-xs/5 break-words text-muted-foreground", children: c.cancelledDetail })), failedCall && (_jsxs("div", { className: "mt-0.5 flex items-start justify-between gap-2 pl-5.5", children: [_jsx("p", { className: "min-w-0 text-xs/5 break-words text-[var(--tone-danger-fg)]", children: failedCall.error }), onRetry && (_jsx("button", { type: "button", className: agentButton.quiet, onClick: () => onRetry(failedCall.id), children: c.retry }))] })), expandable && open && (_jsx("div", { id: panelId, className: "pl-5.5 text-xs/5", children: step.kind === "thought" ? (_jsx("p", { className: "agent-fade-in py-1 whitespace-pre-wrap text-muted-foreground", children: step.summary })) : (_jsx(ToolDetails, { step: step, c: c, locale: locale })) }))] }));
144
+ }
145
+ /**
146
+ * @internal The agent's work in a turn as a quiet vertical trail: one muted line per step ("Thought ›", "Checked MCP overview",
147
+ * "Searched organizations"), a small status icon each, in place of a card per tool call. The step in progress has a spinner
148
+ * (static under `prefers-reduced-motion`) and the in-progress suffix; the icon of a step that finishes pops in. A step opens to
149
+ * its arguments and a formatted, shortened result preview (the model-facing `untrusted`/`source` envelope is never shown). A step
150
+ * a domain card shows carries that card's name as a chip and keeps its preview behind a toggle. A failed step's error and Retry
151
+ * are always visible. A trail of more than four steps folds into one line ONLY if it was already finished when it appeared (a
152
+ * history trail): a trail that was live is never folded under the reader, and neither is one they have opened. A folded history
153
+ * trail that a live or failed step joins opens, and its fold line (it says the trail is done) is hidden until the trail settles.
154
+ * Approvals are never part of the trail.
155
+ */
156
+ export function AgentToolActivity({ steps, toolLabels, formatToolLabel, cardLabels, toolWording, onRetry, defaultOpen = false, locale, copy, className, }) {
157
+ const c = useCopy(DEFAULT_COPY, copy);
158
+ const namer = useMemo(() => createToolNamer({ toolLabels, formatToolLabel, cardLabels, toolWording }), [toolLabels, formatToolLabel, cardLabels, toolWording]);
159
+ const working = steps.some(stepInFlight);
160
+ const failed = steps.some((s) => s.kind === "tool" && s.call.status === "failed");
161
+ // Stopped steps are counted apart from failed ones: they never hold a trail open and the summary says "stopped", not "failed".
162
+ const stopped = steps.filter((s) => s.kind === "tool" && s.call.status === "cancelled").length;
163
+ // Decided once, when the trail appears: a trail that is already finished and long is history and folds; one that was
164
+ // live (or has a failure, whose error and Retry stay visible) never does.
165
+ const [foldable] = useState(() => !working && !failed && steps.length > FOLD_AFTER);
166
+ const [folded, setFolded] = useState(() => foldable && !defaultOpen);
167
+ // A history trail that was folded when it mounted opens for good when a live step joins it (a reload mid-stream), or one
168
+ // that has failed (it can join already failed, without ever having been in flight): its error and Retry must be visible.
169
+ if ((working || failed) && folded)
170
+ setFolded(false);
171
+ // The fold line says the trail is done ("N steps"). While a step runs or has failed the list is held open, so a line that
172
+ // claimed otherwise (and a toggle that cannot toggle) would be wrong: it is hidden until the trail settles.
173
+ const showFold = foldable && !working && !failed;
174
+ const listId = useId();
175
+ // The fold line leaves when a step goes live or fails. A keyboard user who is on it would be dropped on <body> and start over
176
+ // from the top of the page, so focus moves to the list of steps it belonged to. The line is still in the document when its
177
+ // ref is detached (the only moment that tells whether it has focus), the list may not be yet (a folded trail opens in the
178
+ // same commit), so the move happens in the layout effect below.
179
+ const listRef = useRef(null);
180
+ const foldLeftWithFocusRef = useRef(false);
181
+ const foldRef = useCallback((button) => {
182
+ if (!button)
183
+ return;
184
+ return () => {
185
+ foldLeftWithFocusRef.current = document.activeElement === button;
186
+ };
187
+ }, []);
188
+ useLayoutEffect(() => {
189
+ if (!foldLeftWithFocusRef.current)
190
+ return;
191
+ foldLeftWithFocusRef.current = false;
192
+ listRef.current?.focus({ preventScroll: true });
193
+ });
194
+ const list = (_jsx("ul", { ref: listRef, id: listId, "aria-label": c.list, tabIndex: -1, className: cn("flex flex-col gap-0.5 rounded-md", focusRing), children: steps.map((s) => (_jsx(StepRow, { step: s, namer: namer, defaultOpen: defaultOpen, onRetry: onRetry, locale: locale, c: c }, stepId(s)))) }));
195
+ return (_jsxs("div", { "data-status": working ? "running" : failed ? "failed" : stopped > 0 ? "cancelled" : "succeeded", className: cn("flex flex-col gap-0.5", className), children: [showFold && (_jsxs("button", { ref: foldRef, type: "button", "aria-expanded": !folded, "aria-controls": listId, onClick: () => setFolded((v) => !v), className: cn("-ml-1 inline-flex min-h-6 items-center gap-2 self-start rounded-md px-1 text-xs/5 text-muted-foreground transition-colors duration-[var(--duration-micro)] hover:text-foreground motion-reduce:transition-none pointer-coarse:min-h-11", focusRing), children: [stopped > 0 ? (_jsx(CircleStop, { "aria-hidden": true, className: "size-3.5" })) : (_jsx(Check, { "aria-hidden": true, className: "size-3.5" })), _jsx("span", { className: "tabular-nums", children: stopped > 0
196
+ ? fmt(c.stepsStopped, { count: steps.length, stopped })
197
+ : fmt(c.steps, { count: steps.length }) }), _jsx(ChevronRight, { "aria-hidden": true, className: cn("size-3.5 transition-transform duration-[var(--duration-micro)] motion-reduce:transition-none", !folded && "rotate-90") })] })), (!foldable || !folded) && (_jsx("div", { className: foldable ? "agent-fade-in pl-1" : undefined, children: list }))] }));
198
+ }
199
+ //# sourceMappingURL=tool-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-activity.js","sourceRoot":"","sources":["../../src/agent/tool-activity.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,EACL,SAAS,EACT,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,aAAa,GAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,GAMb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsC1C,MAAM,YAAY,GAA0B;IAC1C,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,SAAS;IACpB,eAAe,EAAE,4BAA4B;IAC7C,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,GAAG;IACf,UAAU,EAAE,aAAa;IACzB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,wBAAwB;IACjC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