@tutti-os/agent-gui 0.0.49 → 0.0.50

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 (56) hide show
  1. package/dist/agent-conversation/index.d.ts +5 -3
  2. package/dist/agent-conversation/index.js +6 -6
  3. package/dist/agent-message-center/index.d.ts +1 -1
  4. package/dist/agent-message-center/index.js +8 -8
  5. package/dist/{agentConversationVM-DSXrFL9v.d.ts → agentConversationVM-Qbz9GBwR.d.ts} +25 -0
  6. package/dist/{agentGuiNodeTypes-Bp1G8pOj.d.ts → agentGuiNodeTypes-wzOITHRW.d.ts} +1 -1
  7. package/dist/app/renderer/agentactivity.css +426 -4
  8. package/dist/{chunk-AKK7UOAS.js → chunk-5Y3PC7HP.js} +9 -4
  9. package/dist/chunk-5Y3PC7HP.js.map +1 -0
  10. package/dist/{chunk-U6JWW45G.js → chunk-66EQ6EQO.js} +1 -1
  11. package/dist/chunk-66EQ6EQO.js.map +1 -0
  12. package/dist/{chunk-Q3MOU4CD.js → chunk-ARCM7YB2.js} +2 -2
  13. package/dist/{chunk-5HJWT6YN.js → chunk-BQVYICR7.js} +5 -5
  14. package/dist/{chunk-TTDBLIQ3.js → chunk-DPG2J7N5.js} +2 -2
  15. package/dist/{chunk-A2EN24OI.js → chunk-FS26J46N.js} +5 -5
  16. package/dist/{chunk-FSRS2JFR.js → chunk-FYVVHRLZ.js} +2 -2
  17. package/dist/{chunk-AYEYXKLF.js → chunk-HDBKB5RA.js} +2 -2
  18. package/dist/{chunk-QGBIGRZA.js → chunk-OBFDA7RG.js} +14 -2
  19. package/dist/chunk-OBFDA7RG.js.map +1 -0
  20. package/dist/{chunk-XRJZCEOX.js → chunk-RPXRNKU5.js} +1764 -594
  21. package/dist/chunk-RPXRNKU5.js.map +1 -0
  22. package/dist/{chunk-6KQHNUR5.js → chunk-UUY5VEK4.js} +2 -2
  23. package/dist/{chunk-RJR2OZ6T.js → chunk-VKP5ZW5O.js} +5 -3
  24. package/dist/{chunk-RJR2OZ6T.js.map → chunk-VKP5ZW5O.js.map} +1 -1
  25. package/dist/{chunk-77UR4G7P.js → chunk-Y7ZVTWMZ.js} +2 -2
  26. package/dist/{chunk-K6SRLYC3.js → chunk-ZTSS2NU2.js} +17 -1
  27. package/dist/chunk-ZTSS2NU2.js.map +1 -0
  28. package/dist/context-mention-palette/index.js +7 -7
  29. package/dist/i18n/index.d.ts +16 -0
  30. package/dist/i18n/index.js +2 -2
  31. package/dist/index.d.ts +50 -3
  32. package/dist/index.js +519 -29
  33. package/dist/index.js.map +1 -1
  34. package/dist/plan-decision-ops.d.ts +1 -1
  35. package/dist/queued-prompt-runtime.d.ts +2 -2
  36. package/dist/workbench/contribution.d.ts +5 -1
  37. package/dist/workbench/contribution.js +4 -2
  38. package/dist/workbench/index.js +5 -5
  39. package/dist/workbench/launch.d.ts +4 -0
  40. package/dist/workbench/launch.js +1 -1
  41. package/dist/workbench/sessionTitle.js +3 -3
  42. package/dist/workspace-agent-generated-files.js +3 -3
  43. package/package.json +12 -12
  44. package/dist/chunk-AKK7UOAS.js.map +0 -1
  45. package/dist/chunk-K6SRLYC3.js.map +0 -1
  46. package/dist/chunk-QGBIGRZA.js.map +0 -1
  47. package/dist/chunk-U6JWW45G.js.map +0 -1
  48. package/dist/chunk-XRJZCEOX.js.map +0 -1
  49. /package/dist/{chunk-Q3MOU4CD.js.map → chunk-ARCM7YB2.js.map} +0 -0
  50. /package/dist/{chunk-5HJWT6YN.js.map → chunk-BQVYICR7.js.map} +0 -0
  51. /package/dist/{chunk-TTDBLIQ3.js.map → chunk-DPG2J7N5.js.map} +0 -0
  52. /package/dist/{chunk-A2EN24OI.js.map → chunk-FS26J46N.js.map} +0 -0
  53. /package/dist/{chunk-FSRS2JFR.js.map → chunk-FYVVHRLZ.js.map} +0 -0
  54. /package/dist/{chunk-AYEYXKLF.js.map → chunk-HDBKB5RA.js.map} +0 -0
  55. /package/dist/{chunk-6KQHNUR5.js.map → chunk-UUY5VEK4.js.map} +0 -0
  56. /package/dist/{chunk-77UR4G7P.js.map → chunk-Y7ZVTWMZ.js.map} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  resolveWorkspaceFileLinkAction,
14
14
  resolveWorkspaceFilePathCandidate,
15
15
  resolveWorkspaceLinkAction
16
- } from "./chunk-RJR2OZ6T.js";
16
+ } from "./chunk-VKP5ZW5O.js";
17
17
  import {
18
18
  AGENT_RICH_TEXT_CARET_ANCHOR,
19
19
  attrsToMentionItem,
@@ -21,7 +21,7 @@ import {
21
21
  formatAgentMentionMarkdown,
22
22
  mentionItemToAttrs,
23
23
  parseAgentMentionMarkdown
24
- } from "./chunk-6KQHNUR5.js";
24
+ } from "./chunk-UUY5VEK4.js";
25
25
  import {
26
26
  fileChangeCountFromChanges,
27
27
  fileChangeEntriesFromChanges,
@@ -31,14 +31,14 @@ import {
31
31
  import {
32
32
  getOptionalAgentActivityRuntime,
33
33
  useOptionalAgentHostApi
34
- } from "./chunk-U6JWW45G.js";
34
+ } from "./chunk-66EQ6EQO.js";
35
35
  import {
36
36
  workspaceAgentProviderLabel
37
37
  } from "./chunk-TYGL25EL.js";
38
38
  import {
39
39
  getActiveUiLanguage,
40
40
  translate
41
- } from "./chunk-77UR4G7P.js";
41
+ } from "./chunk-Y7ZVTWMZ.js";
42
42
 
43
43
  // shared/imageGenerationTool.ts
44
44
  var KNOWN_IMAGE_GENERATION_TOOL_NAMES = /* @__PURE__ */ new Set([
@@ -1486,6 +1486,538 @@ function normalizeStatusToken(value) {
1486
1486
  return (value ?? "").trim().toLowerCase().replace(/[\s-]+/g, "_");
1487
1487
  }
1488
1488
 
1489
+ // shared/agentConversation/projection/subAgentTimelinePartition.ts
1490
+ function timelineItemOwnerThreadId(item) {
1491
+ const ownerThreadId = item.payload?.ownerThreadId;
1492
+ if (typeof ownerThreadId !== "string") {
1493
+ return null;
1494
+ }
1495
+ const trimmed = ownerThreadId.trim();
1496
+ return trimmed.length > 0 ? trimmed : null;
1497
+ }
1498
+ function partitionSubAgentTimelineItems(timelineItems) {
1499
+ const subAgentItemsByOwner = /* @__PURE__ */ new Map();
1500
+ let mainTimelineItems = null;
1501
+ for (let index = 0; index < timelineItems.length; index += 1) {
1502
+ const item = timelineItems[index];
1503
+ if (!item) {
1504
+ continue;
1505
+ }
1506
+ const ownerThreadId = timelineItemOwnerThreadId(item);
1507
+ if (!ownerThreadId) {
1508
+ mainTimelineItems?.push(item);
1509
+ continue;
1510
+ }
1511
+ if (!mainTimelineItems) {
1512
+ mainTimelineItems = timelineItems.slice(0, index);
1513
+ }
1514
+ const ownerItems = subAgentItemsByOwner.get(ownerThreadId) ?? [];
1515
+ ownerItems.push(item);
1516
+ subAgentItemsByOwner.set(ownerThreadId, ownerItems);
1517
+ }
1518
+ return {
1519
+ mainTimelineItems: mainTimelineItems ?? timelineItems,
1520
+ subAgentItemsByOwner
1521
+ };
1522
+ }
1523
+ function buildSubAgentLanesByCallId(partition) {
1524
+ const lanesByCallId = /* @__PURE__ */ new Map();
1525
+ const cards = collectCollabCards(partition.mainTimelineItems);
1526
+ if (cards.length === 0) {
1527
+ return lanesByCallId;
1528
+ }
1529
+ const lanedOwners = /* @__PURE__ */ new Set();
1530
+ for (const [ownerThreadId, items] of partition.subAgentItemsByOwner) {
1531
+ const sortedItems = [...items].sort(compareTimelineItemsAscending);
1532
+ const startedAtUnixMs = timelineItemTime(sortedItems[0]);
1533
+ const card = cards.find((candidate) => candidate.receiverThreadIds.has(ownerThreadId)) ?? cards.find((candidate) => candidate.outputStrings.has(ownerThreadId)) ?? matchCardByTimeAffinity(cards, startedAtUnixMs);
1534
+ if (!card) {
1535
+ continue;
1536
+ }
1537
+ lanedOwners.add(ownerThreadId);
1538
+ const lanes = lanesByCallId.get(card.callId) ?? [];
1539
+ lanes.push(subAgentLane(ownerThreadId, sortedItems, card));
1540
+ lanesByCallId.set(card.callId, lanes);
1541
+ }
1542
+ for (const card of cards) {
1543
+ if (!isSpawnAgentToken(card.agentName)) {
1544
+ continue;
1545
+ }
1546
+ for (const receiverThreadId of card.receiverThreadIds) {
1547
+ if (lanedOwners.has(receiverThreadId)) {
1548
+ continue;
1549
+ }
1550
+ lanedOwners.add(receiverThreadId);
1551
+ const lanes = lanesByCallId.get(card.callId) ?? [];
1552
+ lanes.push(subAgentLane(receiverThreadId, [], card));
1553
+ lanesByCallId.set(card.callId, lanes);
1554
+ }
1555
+ if (!lanesByCallId.has(card.callId)) {
1556
+ lanesByCallId.set(card.callId, [
1557
+ {
1558
+ ...subAgentLane(`spawn-pending:${card.callId}`, [], card),
1559
+ status: card.callStatus,
1560
+ // No child thread exists yet: codex caps concurrent sub-agents
1561
+ // (4/session by default) and queues further spawns.
1562
+ queued: card.callStatus === "running"
1563
+ }
1564
+ ]);
1565
+ }
1566
+ }
1567
+ for (const lanes of lanesByCallId.values()) {
1568
+ lanes.sort(
1569
+ (left, right) => (left.startedAtUnixMs ?? 0) - (right.startedAtUnixMs ?? 0) || left.ownerThreadId.localeCompare(right.ownerThreadId)
1570
+ );
1571
+ for (let index = 0; index < lanes.length; index += 1) {
1572
+ const lane = lanes[index];
1573
+ if (!lane) {
1574
+ continue;
1575
+ }
1576
+ lanes[index] = {
1577
+ ...lane,
1578
+ laneIndex: index + 1,
1579
+ laneCount: lanes.length
1580
+ };
1581
+ }
1582
+ }
1583
+ return lanesByCallId;
1584
+ }
1585
+ function attachSubAgentLanesToConversationVM(conversation, lanesByCallId) {
1586
+ if (!conversation || lanesByCallId.size === 0) {
1587
+ return conversation;
1588
+ }
1589
+ let changed = false;
1590
+ const rows = conversation.rows.map((row) => {
1591
+ if (row.kind !== "tool-group") {
1592
+ return row;
1593
+ }
1594
+ const nextRow = toolGroupRowWithSubAgents(row, lanesByCallId);
1595
+ if (nextRow !== row) {
1596
+ changed = true;
1597
+ }
1598
+ return nextRow;
1599
+ });
1600
+ return changed ? { ...conversation, rows } : conversation;
1601
+ }
1602
+ function toolGroupRowWithSubAgents(row, lanesByCallId) {
1603
+ let changed = false;
1604
+ const callsById = /* @__PURE__ */ new Map();
1605
+ const calls = row.calls.map((call) => {
1606
+ const lanes = call.task ? lanesByCallId.get(toolCallRawId(call.id)) : null;
1607
+ if (!lanes || lanes.length === 0 || !call.task) {
1608
+ return call;
1609
+ }
1610
+ changed = true;
1611
+ const nextCall = {
1612
+ ...call,
1613
+ task: { ...call.task, subAgents: lanes }
1614
+ };
1615
+ callsById.set(nextCall.id, nextCall);
1616
+ return nextCall;
1617
+ });
1618
+ if (!changed) {
1619
+ return row;
1620
+ }
1621
+ const entries = row.entries.map((entry) => {
1622
+ if (entry.kind !== "tool-call") {
1623
+ return entry;
1624
+ }
1625
+ const nextCall = callsById.get(entry.call.id);
1626
+ return nextCall ? { ...entry, call: nextCall } : entry;
1627
+ });
1628
+ return { ...row, calls, entries };
1629
+ }
1630
+ function toolCallRawId(id) {
1631
+ return id.startsWith("call:") ? id.slice("call:".length) : id;
1632
+ }
1633
+ var SUB_AGENT_ACTIVITY_LOG_CAP = 20;
1634
+ function subAgentLane(ownerThreadId, sortedItems, card) {
1635
+ const activity = subAgentActivityLog(sortedItems);
1636
+ const latest = activity.entries[activity.entries.length - 1] ?? null;
1637
+ const terminal = latestTerminalMarker(sortedItems);
1638
+ const lastItem = sortedItems[sortedItems.length - 1];
1639
+ const status = terminal?.status ?? card.childStatuses.get(ownerThreadId) ?? "running";
1640
+ const terminalAtUnixMs = terminal?.occurredAtUnixMs ?? null;
1641
+ return {
1642
+ ownerThreadId,
1643
+ status,
1644
+ // Identity precedence: the child thread's own name (subAgentName marker,
1645
+ // rare in practice) > a short name derived from the task's opening
1646
+ // self-address ("你是 X。…" / "You are X. …") > the view's localized
1647
+ // numbered fallback. Never the collab tool name.
1648
+ name: latestNameMarker(sortedItems) ?? deriveSubAgentNameFromTask(card.task),
1649
+ task: card.task,
1650
+ laneIndex: 1,
1651
+ laneCount: 1,
1652
+ latestActivity: latest?.text ?? null,
1653
+ latestActivityKind: latest?.kind ?? null,
1654
+ activityLog: activity.entries,
1655
+ activityOmittedCount: activity.omittedCount,
1656
+ failureDetail: terminal?.detail ?? null,
1657
+ startedAtUnixMs: timelineItemTime(sortedItems[0]) || card.startedAtUnixMs || null,
1658
+ latestActivityAtUnixMs: terminalAtUnixMs ?? (lastItem ? timelineItemTime(lastItem) : card.startedAtUnixMs) ?? null,
1659
+ terminalAtUnixMs
1660
+ };
1661
+ }
1662
+ var SUB_AGENT_DERIVED_NAME_MAX = 36;
1663
+ function deriveSubAgentNameFromTask(task) {
1664
+ if (!task) {
1665
+ return null;
1666
+ }
1667
+ const firstSentence = task.trim().split(/[。..!?!?,,\n]/, 1)[0]?.trim();
1668
+ if (!firstSentence) {
1669
+ return null;
1670
+ }
1671
+ const selfAddress = /^(你现在是|你現在是|你是|you are|act as)\s*/i;
1672
+ if (!selfAddress.test(firstSentence)) {
1673
+ return null;
1674
+ }
1675
+ const stripped = firstSentence.replace(selfAddress, "").replace(/\s+/g, " ").trim();
1676
+ if (stripped.length < 2 || stripped.length > SUB_AGENT_DERIVED_NAME_MAX) {
1677
+ return null;
1678
+ }
1679
+ if (/^(spawnagent|agent)$/i.test(stripped)) {
1680
+ return null;
1681
+ }
1682
+ return stripped;
1683
+ }
1684
+ function isSpawnAgentToken(agentName) {
1685
+ const token = normalizeToolToken3(agentName);
1686
+ return token === "spawnagent" || token === "spawn";
1687
+ }
1688
+ function latestNameMarker(sortedItems) {
1689
+ for (let index = sortedItems.length - 1; index >= 0; index -= 1) {
1690
+ const payload = sortedItems[index]?.payload;
1691
+ if (payload?.messageKind !== "subAgentName") {
1692
+ continue;
1693
+ }
1694
+ const name = stringValue2(payload.subAgentName);
1695
+ if (name) {
1696
+ return name;
1697
+ }
1698
+ }
1699
+ return null;
1700
+ }
1701
+ function isSubAgentMarkerItem(item) {
1702
+ const kind = item.payload?.messageKind;
1703
+ return kind === "subAgentLifecycle" || kind === "subAgentName";
1704
+ }
1705
+ function subAgentActivityLog(sortedItems) {
1706
+ const all = [];
1707
+ for (const item of sortedItems) {
1708
+ if (!item || isSubAgentMarkerItem(item)) {
1709
+ continue;
1710
+ }
1711
+ const entry = displayableActivityEntry(item);
1712
+ if (entry) {
1713
+ all.push(entry);
1714
+ }
1715
+ }
1716
+ const omittedCount = Math.max(0, all.length - SUB_AGENT_ACTIVITY_LOG_CAP);
1717
+ return { entries: all.slice(omittedCount), omittedCount };
1718
+ }
1719
+ function displayableActivityEntry(item) {
1720
+ const atUnixMs = timelineItemTime(item) || null;
1721
+ if (isWorkspaceAgentToolCallItem(item)) {
1722
+ const name = firstString2(item.name, stringValue2(item.payload?.name)) ?? null;
1723
+ return name ? { kind: "tool", text: name, atUnixMs } : null;
1724
+ }
1725
+ const text = snippet(timelineItemText(item));
1726
+ if (!text) {
1727
+ return null;
1728
+ }
1729
+ const itemType = item.itemType?.trim().toLowerCase() ?? "";
1730
+ const role = item.role?.trim().toLowerCase() ?? "";
1731
+ if (itemType === "message.assistant_thinking" || role === "assistant_thinking") {
1732
+ return { kind: "reasoning", text, atUnixMs };
1733
+ }
1734
+ return { kind: "message", text, atUnixMs };
1735
+ }
1736
+ function latestTerminalMarker(sortedItems) {
1737
+ for (let index = sortedItems.length - 1; index >= 0; index -= 1) {
1738
+ const item = sortedItems[index];
1739
+ const payload = item?.payload;
1740
+ if (!payload || payload.messageKind !== "subAgentLifecycle") {
1741
+ continue;
1742
+ }
1743
+ return {
1744
+ status: subAgentStatusFromLifecycle(payload.subAgentLifecycleStatus),
1745
+ detail: stringValue2(payload.detail) ?? null,
1746
+ occurredAtUnixMs: timelineItemTime(item) || null
1747
+ };
1748
+ }
1749
+ return null;
1750
+ }
1751
+ var SUB_AGENT_ACTIVITY_SNIPPET_LENGTH = 140;
1752
+ function snippet(text) {
1753
+ if (text.length <= SUB_AGENT_ACTIVITY_SNIPPET_LENGTH) {
1754
+ return text;
1755
+ }
1756
+ return `\u2026${text.slice(-SUB_AGENT_ACTIVITY_SNIPPET_LENGTH)}`;
1757
+ }
1758
+ function timelineItemText(item) {
1759
+ const text = stringValue2(item.payload?.text) ?? stringValue2(item.payload?.content) ?? stringValue2(item.content) ?? "";
1760
+ return text.replace(/\s+/g, " ").trim();
1761
+ }
1762
+ var COLLAB_CARD_TOOL_NAMES = /* @__PURE__ */ new Set([
1763
+ "task",
1764
+ "subagent",
1765
+ "delegatetask",
1766
+ "delegateagent",
1767
+ "agent"
1768
+ ]);
1769
+ function collectCollabCards(mainTimelineItems) {
1770
+ const cardsByCallId = /* @__PURE__ */ new Map();
1771
+ for (const item of mainTimelineItems) {
1772
+ if (!isWorkspaceAgentToolCallItem(item) || !isCollabCardItem(item)) {
1773
+ continue;
1774
+ }
1775
+ const callId = firstString2(item.callId, stringValue2(item.payload?.callId));
1776
+ if (!callId) {
1777
+ continue;
1778
+ }
1779
+ const time = timelineItemTime(item);
1780
+ const input = recordValue4(item.payload?.input);
1781
+ const output = recordValue4(item.payload?.output);
1782
+ const existing = cardsByCallId.get(callId);
1783
+ if (!existing) {
1784
+ cardsByCallId.set(callId, {
1785
+ callId,
1786
+ startedAtUnixMs: time,
1787
+ latestAtUnixMs: time,
1788
+ latestCallStatus: firstString2(
1789
+ item.status,
1790
+ stringValue2(item.payload?.status)
1791
+ ),
1792
+ receiverThreadIds: collectReceiverThreadIds(input),
1793
+ outputStrings: collectStringValues(output),
1794
+ childStatuses: collectChildStatuses(output)
1795
+ });
1796
+ continue;
1797
+ }
1798
+ existing.startedAtUnixMs = Math.min(existing.startedAtUnixMs, time);
1799
+ if (time >= existing.latestAtUnixMs) {
1800
+ existing.latestAtUnixMs = time;
1801
+ existing.latestCallStatus = firstString2(item.status, stringValue2(item.payload?.status)) ?? existing.latestCallStatus;
1802
+ }
1803
+ for (const value of collectReceiverThreadIds(input)) {
1804
+ existing.receiverThreadIds.add(value);
1805
+ }
1806
+ for (const value of collectStringValues(output)) {
1807
+ existing.outputStrings.add(value);
1808
+ }
1809
+ for (const [threadId, childStatus] of collectChildStatuses(output)) {
1810
+ existing.childStatuses.set(threadId, childStatus);
1811
+ }
1812
+ }
1813
+ return [...cardsByCallId.values()].map((card) => {
1814
+ const input = recordValue4(
1815
+ partitionCardInput(mainTimelineItems, card.callId)?.payload?.input
1816
+ );
1817
+ return {
1818
+ callId: card.callId,
1819
+ startedAtUnixMs: card.startedAtUnixMs,
1820
+ task: stringValue2(input?.task),
1821
+ agentName: stringValue2(input?.agentName),
1822
+ callStatus: subAgentStatusFromCallStatus(card.latestCallStatus),
1823
+ receiverThreadIds: card.receiverThreadIds,
1824
+ outputStrings: card.outputStrings,
1825
+ childStatuses: card.childStatuses
1826
+ };
1827
+ }).sort((left, right) => left.startedAtUnixMs - right.startedAtUnixMs);
1828
+ }
1829
+ function partitionCardInput(mainTimelineItems, callId) {
1830
+ for (const item of mainTimelineItems) {
1831
+ if (!isWorkspaceAgentToolCallItem(item) || !isCollabCardItem(item)) {
1832
+ continue;
1833
+ }
1834
+ if (firstString2(item.callId, stringValue2(item.payload?.callId)) === callId) {
1835
+ return item;
1836
+ }
1837
+ }
1838
+ return null;
1839
+ }
1840
+ function isCollabCardItem(item) {
1841
+ const toolName = normalizeToolToken3(resolveWorkspaceAgentToolName(item));
1842
+ return COLLAB_CARD_TOOL_NAMES.has(toolName);
1843
+ }
1844
+ function matchCardByTimeAffinity(cards, laneStartedAtUnixMs) {
1845
+ const startedBeforeLane = cards.filter(
1846
+ (card) => card.startedAtUnixMs <= laneStartedAtUnixMs
1847
+ );
1848
+ const candidates = startedBeforeLane.length > 0 ? startedBeforeLane : cards;
1849
+ const pool = candidates;
1850
+ if (pool.length === 0) {
1851
+ return null;
1852
+ }
1853
+ if (startedBeforeLane.length > 0) {
1854
+ return pool.reduce(
1855
+ (latest, card) => card.startedAtUnixMs >= latest.startedAtUnixMs ? card : latest
1856
+ );
1857
+ }
1858
+ return pool.reduce(
1859
+ (earliest, card) => card.startedAtUnixMs < earliest.startedAtUnixMs ? card : earliest
1860
+ );
1861
+ }
1862
+ function subAgentStatusFromCallStatus(status) {
1863
+ switch ((status ?? "").trim().toLowerCase()) {
1864
+ case "completed":
1865
+ case "done":
1866
+ case "success":
1867
+ case "succeeded":
1868
+ return "completed";
1869
+ case "failed":
1870
+ case "error":
1871
+ case "errored":
1872
+ return "failed";
1873
+ case "canceled":
1874
+ case "cancelled":
1875
+ return "canceled";
1876
+ default:
1877
+ return "running";
1878
+ }
1879
+ }
1880
+ function subAgentStatusFromLifecycle(status) {
1881
+ switch (typeof status === "string" ? status.trim().toLowerCase() : "") {
1882
+ case "completed":
1883
+ case "done":
1884
+ case "success":
1885
+ case "succeeded":
1886
+ return "completed";
1887
+ case "failed":
1888
+ case "error":
1889
+ case "errored":
1890
+ return "failed";
1891
+ case "canceled":
1892
+ case "cancelled":
1893
+ case "interrupted":
1894
+ case "stopped":
1895
+ return "canceled";
1896
+ default:
1897
+ return "running";
1898
+ }
1899
+ }
1900
+ function collectReceiverThreadIds(input) {
1901
+ const out = /* @__PURE__ */ new Set();
1902
+ if (input == null || typeof input !== "object" || Array.isArray(input)) {
1903
+ return out;
1904
+ }
1905
+ const raw = input.receiverThreadIds;
1906
+ if (!Array.isArray(raw)) {
1907
+ return out;
1908
+ }
1909
+ for (const entry of raw) {
1910
+ const id = stringValue2(entry);
1911
+ if (id) {
1912
+ out.add(id);
1913
+ }
1914
+ }
1915
+ return out;
1916
+ }
1917
+ function collectChildStatuses(value) {
1918
+ const out = /* @__PURE__ */ new Map();
1919
+ collectChildStatusesInto(value, out, 0);
1920
+ return out;
1921
+ }
1922
+ function collectChildStatusesInto(value, out, depth) {
1923
+ if (depth > 6 || value == null) {
1924
+ return;
1925
+ }
1926
+ if (Array.isArray(value)) {
1927
+ for (const entry of value) {
1928
+ collectChildStatusesInto(entry, out, depth + 1);
1929
+ }
1930
+ return;
1931
+ }
1932
+ if (typeof value !== "object") {
1933
+ return;
1934
+ }
1935
+ const record = value;
1936
+ const status = subAgentStatusFromLifecycle(
1937
+ record.status ?? record.state ?? record.lifecycleStatus
1938
+ );
1939
+ const id = firstString2(
1940
+ stringValue2(record.threadId),
1941
+ stringValue2(record.threadID),
1942
+ stringValue2(record.agentId),
1943
+ stringValue2(record.agent_id),
1944
+ stringValue2(record.id)
1945
+ );
1946
+ if (id && status !== "running") {
1947
+ out.set(id, status);
1948
+ }
1949
+ for (const [key, entry] of Object.entries(record)) {
1950
+ if (key === "agentsStates" || key === "statuses") {
1951
+ collectChildStatusesInto(entry, out, depth + 1);
1952
+ continue;
1953
+ }
1954
+ if (typeof entry === "object" && entry != null) {
1955
+ const nestedStatus = subAgentStatusFromLifecycle(
1956
+ entry.status ?? entry.state
1957
+ );
1958
+ if (nestedStatus !== "running" && key.trim()) {
1959
+ out.set(key, nestedStatus);
1960
+ }
1961
+ }
1962
+ collectChildStatusesInto(entry, out, depth + 1);
1963
+ }
1964
+ }
1965
+ function collectStringValues(value, depth = 0) {
1966
+ const out = /* @__PURE__ */ new Set();
1967
+ collectStringValuesInto(value, depth, out);
1968
+ return out;
1969
+ }
1970
+ function collectStringValuesInto(value, depth, out) {
1971
+ if (depth > 5 || value == null) {
1972
+ return;
1973
+ }
1974
+ if (typeof value === "string") {
1975
+ const trimmed = value.trim();
1976
+ if (trimmed) {
1977
+ out.add(trimmed);
1978
+ }
1979
+ return;
1980
+ }
1981
+ if (Array.isArray(value)) {
1982
+ for (const entry of value) {
1983
+ collectStringValuesInto(entry, depth + 1, out);
1984
+ }
1985
+ return;
1986
+ }
1987
+ if (typeof value === "object") {
1988
+ for (const [key, entry] of Object.entries(
1989
+ value
1990
+ )) {
1991
+ out.add(key);
1992
+ collectStringValuesInto(entry, depth + 1, out);
1993
+ }
1994
+ }
1995
+ }
1996
+ function timelineItemTime(item) {
1997
+ return item?.occurredAtUnixMs ?? item?.createdAtUnixMs ?? 0;
1998
+ }
1999
+ function compareTimelineItemsAscending(left, right) {
2000
+ return timelineItemTime(left) - timelineItemTime(right) || (left.seq ?? 0) - (right.seq ?? 0) || left.id - right.id;
2001
+ }
2002
+ function normalizeToolToken3(value) {
2003
+ return (value ?? "").replace(/[\s_-]+/g, "").trim().toLowerCase();
2004
+ }
2005
+ function stringValue2(value) {
2006
+ return typeof value === "string" && value.trim() ? value.trim() : null;
2007
+ }
2008
+ function recordValue4(value) {
2009
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
2010
+ }
2011
+ function firstString2(...values) {
2012
+ for (const value of values) {
2013
+ const resolved = stringValue2(value);
2014
+ if (resolved) {
2015
+ return resolved;
2016
+ }
2017
+ }
2018
+ return null;
2019
+ }
2020
+
1489
2021
  // shared/workspaceAgentTimelineCanonical.ts
1490
2022
  function buildCanonicalWorkspaceAgentDetailView({
1491
2023
  activity,
@@ -1498,9 +2030,12 @@ function buildCanonicalWorkspaceAgentDetailView({
1498
2030
  const seenThinkingMessages = /* @__PURE__ */ new Set();
1499
2031
  let activeSequenceTurnId = null;
1500
2032
  const sortedTimelineItems = [...timelineItems].sort(
1501
- compareTimelineItemsAscending
2033
+ compareTimelineItemsAscending2
1502
2034
  );
1503
2035
  for (const item of sortedTimelineItems) {
2036
+ if (timelineItemOwnerThreadId(item)) {
2037
+ continue;
2038
+ }
1504
2039
  const role = messageRole(item);
1505
2040
  const body = messageBody(item);
1506
2041
  const explicitTurnId = item.turnId?.trim();
@@ -1654,7 +2189,7 @@ function getTurn(turns, id) {
1654
2189
  turns.set(id, turn);
1655
2190
  return turn;
1656
2191
  }
1657
- function compareTimelineItemsAscending(left, right) {
2192
+ function compareTimelineItemsAscending2(left, right) {
1658
2193
  const leftSeq = left.seq ?? 0;
1659
2194
  const rightSeq = right.seq ?? 0;
1660
2195
  if (leftSeq > 0 && rightSeq > 0 && leftSeq !== rightSeq) {
@@ -2130,7 +2665,7 @@ function mergeSourceTimelineItems(previous, next) {
2130
2665
  for (const item of merged) {
2131
2666
  byKey.set(sourceTimelineItemKey(item), item);
2132
2667
  }
2133
- return [...byKey.values()].sort(compareTimelineItemsAscending);
2668
+ return [...byKey.values()].sort(compareTimelineItemsAscending2);
2134
2669
  }
2135
2670
  function sourceTimelineItemKey(item) {
2136
2671
  const eventId = item.eventId?.trim();
@@ -2285,7 +2820,7 @@ function projectAgentApprovalItem(call, input, output) {
2285
2820
  if (callType !== "approval" && toolName !== "approval") {
2286
2821
  return null;
2287
2822
  }
2288
- const requestId = stringValue2(input?.requestId) ?? stringValue2(call.payload?.requestId) ?? stringValue2(output?.requestId);
2823
+ const requestId = stringValue3(input?.requestId) ?? stringValue3(call.payload?.requestId) ?? stringValue3(output?.requestId);
2289
2824
  if (!requestId) {
2290
2825
  return null;
2291
2826
  }
@@ -2309,7 +2844,7 @@ function projectAgentApprovalItem(call, input, output) {
2309
2844
  callId: call.id.replace(/^call:/, ""),
2310
2845
  title: mcpTarget?.displayName ?? (call.summary.trim() || call.name),
2311
2846
  toolName: call.toolName,
2312
- status: stringValue2(call.payload?.status) ?? call.status,
2847
+ status: stringValue3(call.payload?.status) ?? call.status,
2313
2848
  input,
2314
2849
  options,
2315
2850
  output,
@@ -2319,17 +2854,17 @@ function projectAgentApprovalItem(call, input, output) {
2319
2854
  function normalizeApprovalOptions(values) {
2320
2855
  return values.flatMap((value) => {
2321
2856
  const option = objectValue(value);
2322
- const id = stringValue2(option?.optionId) ?? stringValue2(option?.id);
2857
+ const id = stringValue3(option?.optionId) ?? stringValue3(option?.id);
2323
2858
  if (!id) {
2324
2859
  return [];
2325
2860
  }
2326
- const label = stringValue2(option?.name) ?? stringValue2(option?.label) ?? stringValue2(option?.title) ?? stringValue2(option?.kind) ?? id;
2861
+ const label = stringValue3(option?.name) ?? stringValue3(option?.label) ?? stringValue3(option?.title) ?? stringValue3(option?.kind) ?? id;
2327
2862
  return [
2328
2863
  {
2329
2864
  id,
2330
2865
  label,
2331
- kind: stringValue2(option?.kind) ?? "",
2332
- ...stringValue2(option?.description) ? { description: stringValue2(option?.description) } : {}
2866
+ kind: stringValue3(option?.kind) ?? "",
2867
+ ...stringValue3(option?.description) ? { description: stringValue3(option?.description) } : {}
2333
2868
  }
2334
2869
  ];
2335
2870
  });
@@ -2337,7 +2872,7 @@ function normalizeApprovalOptions(values) {
2337
2872
  function normalizeToken(value) {
2338
2873
  return (value ?? "").trim().toLowerCase();
2339
2874
  }
2340
- function stringValue2(value) {
2875
+ function stringValue3(value) {
2341
2876
  return typeof value === "string" && value.trim() ? value.trim() : null;
2342
2877
  }
2343
2878
  function objectValue(value) {
@@ -2361,7 +2896,7 @@ function projectAgentAskUserQuestionItem(call, input, output) {
2361
2896
  kind: "ask-user",
2362
2897
  id: call.id,
2363
2898
  turnId: call.turnId ?? "turn:unknown",
2364
- requestId: stringValue3(input?.requestId) ?? stringValue3(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2899
+ requestId: stringValue4(input?.requestId) ?? stringValue4(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2365
2900
  title: call.name,
2366
2901
  status: call.status,
2367
2902
  questions: questions.map((question) => ({
@@ -2377,12 +2912,12 @@ function projectAgentPlanModeItem(call, input) {
2377
2912
  itemKind: "plan-mode",
2378
2913
  id: call.id,
2379
2914
  turnId: call.turnId ?? "turn:unknown",
2380
- requestId: stringValue3(input?.requestId) ?? stringValue3(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2915
+ requestId: stringValue4(input?.requestId) ?? stringValue4(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2381
2916
  kind: "exit",
2382
- title: stringValue3(objectValue2(input?.toolCall)?.title) ?? call.name,
2917
+ title: stringValue4(objectValue2(input?.toolCall)?.title) ?? call.name,
2383
2918
  status: call.status,
2384
- plan: stringValue3(input?.plan) ?? stringValue3(call.payload?.plan) ?? (call.summary.trim() || null),
2385
- filePath: stringValue3(input?.filePath) ?? stringValue3(call.payload?.filePath),
2919
+ plan: stringValue4(input?.plan) ?? stringValue4(call.payload?.plan) ?? (call.summary.trim() || null),
2920
+ filePath: stringValue4(input?.filePath) ?? stringValue4(call.payload?.filePath),
2386
2921
  options: extractExitPlanModeOptions(input),
2387
2922
  ...keepPlanningOption(extractExitPlanKeepPlanningOptionId(input)),
2388
2923
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
@@ -2397,8 +2932,8 @@ function projectAgentPlanModeItem(call, input) {
2397
2932
  kind: "enter",
2398
2933
  title: call.name,
2399
2934
  status: call.status,
2400
- plan: stringValue3(input?.content) ?? (call.summary.trim() || null),
2401
- filePath: stringValue3(input?.filePath),
2935
+ plan: stringValue4(input?.content) ?? (call.summary.trim() || null),
2936
+ filePath: stringValue4(input?.filePath),
2402
2937
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
2403
2938
  };
2404
2939
  }
@@ -2409,12 +2944,12 @@ function projectAgentPlanModeItem(call, input) {
2409
2944
  itemKind: "plan-mode",
2410
2945
  id: call.id,
2411
2946
  turnId: call.turnId ?? "turn:unknown",
2412
- requestId: stringValue3(input?.requestId) ?? stringValue3(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2947
+ requestId: stringValue4(input?.requestId) ?? stringValue4(call.payload?.requestId) ?? call.id.replace(/^call:/, ""),
2413
2948
  kind: "exit",
2414
2949
  title: call.name,
2415
2950
  status: call.status,
2416
- plan: stringValue3(input?.plan) ?? stringValue3(call.payload?.plan) ?? (call.summary.trim() || null),
2417
- filePath: stringValue3(input?.filePath) ?? stringValue3(call.payload?.filePath),
2951
+ plan: stringValue4(input?.plan) ?? stringValue4(call.payload?.plan) ?? (call.summary.trim() || null),
2952
+ filePath: stringValue4(input?.filePath) ?? stringValue4(call.payload?.filePath),
2418
2953
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
2419
2954
  };
2420
2955
  }
@@ -2439,7 +2974,7 @@ function keepPlanningOption(optionId) {
2439
2974
  function normalizeToolName2(value) {
2440
2975
  return (value ?? "").replace(/[_\s-]+/g, "").trim().toLowerCase();
2441
2976
  }
2442
- function stringValue3(value) {
2977
+ function stringValue4(value) {
2443
2978
  return typeof value === "string" && value.trim() ? value.trim() : null;
2444
2979
  }
2445
2980
  function objectValue2(value) {
@@ -2552,13 +3087,13 @@ function normalizeToolName3(value) {
2552
3087
  }
2553
3088
  function hasMcpMetadata(metadata) {
2554
3089
  return Boolean(
2555
- stringValue4(metadata?.server) ?? stringValue4(metadata?.serverName) ?? stringValue4(metadata?.mcpServer)
3090
+ stringValue5(metadata?.server) ?? stringValue5(metadata?.serverName) ?? stringValue5(metadata?.mcpServer)
2556
3091
  );
2557
3092
  }
2558
3093
  function normalizeCallType(value) {
2559
3094
  return (value ?? "").trim().toLowerCase();
2560
3095
  }
2561
- function stringValue4(value) {
3096
+ function stringValue5(value) {
2562
3097
  return typeof value === "string" && value.trim() ? value.trim() : null;
2563
3098
  }
2564
3099
 
@@ -2581,8 +3116,8 @@ function projectAgentTaskItem(call, input, output, metadata) {
2581
3116
  turnId: call.turnId ?? "turn:unknown",
2582
3117
  title: call.summary.trim() || call.name,
2583
3118
  status: call.status,
2584
- prompt: stringValue5(input?.prompt) ?? stringValue5(input?.description) ?? stringValue5(call.payload?.description) ?? stringValue5(claudeToolResponse?.prompt),
2585
- delegateSessionId: stringValue5(metadata?.childSessionID) ?? stringValue5(metadata?.child_session_id) ?? stringValue5(metadata?.subagentSessionID) ?? stringValue5(metadata?.subagent_session_id) ?? stringValue5(claudeToolResponse?.agentId),
3119
+ prompt: stringValue6(input?.prompt) ?? stringValue6(input?.description) ?? stringValue6(call.payload?.description) ?? stringValue6(claudeToolResponse?.prompt),
3120
+ delegateSessionId: stringValue6(metadata?.childSessionID) ?? stringValue6(metadata?.child_session_id) ?? stringValue6(metadata?.subagentSessionID) ?? stringValue6(metadata?.subagent_session_id) ?? stringValue6(claudeToolResponse?.agentId),
2586
3121
  steps,
2587
3122
  result: firstNonEmptyText(output),
2588
3123
  resultMarkdown: firstNonEmptyText(output),
@@ -2596,8 +3131,8 @@ function normalizeTaskSteps(values, turnId) {
2596
3131
  if (!step) {
2597
3132
  return [];
2598
3133
  }
2599
- const toolName = stringValue5(step.toolName) ?? stringValue5(step.tool_name) ?? stringValue5(step.name);
2600
- const callType = stringValue5(step.callType) ?? stringValue5(step.call_type);
3134
+ const toolName = stringValue6(step.toolName) ?? stringValue6(step.tool_name) ?? stringValue6(step.name);
3135
+ const callType = stringValue6(step.callType) ?? stringValue6(step.call_type);
2601
3136
  const inputPayload = objectValue3(step.toolInput) ?? objectValue3(step.tool_input);
2602
3137
  const outputPayload = objectValue3(step.toolResult) ?? objectValue3(step.tool_result);
2603
3138
  const errorPayload = objectValue3(step.toolError) ?? objectValue3(step.tool_error);
@@ -2607,11 +3142,11 @@ function normalizeTaskSteps(values, turnId) {
2607
3142
  const locations = arrayValue3(step.locations);
2608
3143
  return [
2609
3144
  {
2610
- id: stringValue5(step.toolUseId) ?? stringValue5(step.id) ?? `step-${index + 1}`,
3145
+ id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `step-${index + 1}`,
2611
3146
  turnId,
2612
3147
  name: toolName ? humanizeToolLabel(toolName) : `Step ${index + 1}`,
2613
3148
  toolName: toolName ?? null,
2614
- status: stringValue5(step.status) ?? stringValue5(objectValue3(step.toolResult)?.status) ?? stringValue5(objectValue3(step.tool_result)?.status),
3149
+ status: stringValue6(step.status) ?? stringValue6(objectValue3(step.toolResult)?.status) ?? stringValue6(objectValue3(step.tool_result)?.status),
2615
3150
  summary: firstNonEmptyText(outputPayload, inputPayload) ?? "",
2616
3151
  payload: {
2617
3152
  input: inputPayload,
@@ -2619,12 +3154,12 @@ function normalizeTaskSteps(values, turnId) {
2619
3154
  error: errorPayload
2620
3155
  },
2621
3156
  tool: projectAgentTaskStepTool({
2622
- id: stringValue5(step.toolUseId) ?? stringValue5(step.id) ?? `step-${index + 1}`,
3157
+ id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `step-${index + 1}`,
2623
3158
  turnId,
2624
3159
  toolName,
2625
- name: stringValue5(step.name),
3160
+ name: stringValue6(step.name),
2626
3161
  callType,
2627
- status: stringValue5(step.status) ?? stringValue5(outputPayload?.status),
3162
+ status: stringValue6(step.status) ?? stringValue6(outputPayload?.status),
2628
3163
  summary: firstNonEmptyText(outputPayload, inputPayload) ?? "",
2629
3164
  payload,
2630
3165
  metadata,
@@ -2706,7 +3241,7 @@ function projectAgentTaskStepTool(step) {
2706
3241
  function humanizeToolLabel(value) {
2707
3242
  return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/^\w/, (match) => match.toUpperCase());
2708
3243
  }
2709
- function stringValue5(value) {
3244
+ function stringValue6(value) {
2710
3245
  return typeof value === "string" && value.trim() ? value.trim() : null;
2711
3246
  }
2712
3247
  function numberValue(value) {
@@ -3468,8 +4003,8 @@ function filesFromCall(call, options) {
3468
4003
  return [];
3469
4004
  }
3470
4005
  return extractFileChanges({
3471
- id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `${call.id}:step:${index + 1}`,
3472
- toolName: stringValue6(step.toolName) ?? stringValue6(step.tool_name) ?? stringValue6(step.name) ?? null,
4006
+ id: stringValue7(step.toolUseId) ?? stringValue7(step.id) ?? `${call.id}:step:${index + 1}`,
4007
+ toolName: stringValue7(step.toolName) ?? stringValue7(step.tool_name) ?? stringValue7(step.name) ?? null,
3473
4008
  statusKind: nestedTaskStepStatusKind(step, call.statusKind ?? null),
3474
4009
  occurredAtUnixMs: numberValue2(step.occurredAtUnixMs) ?? numberValue2(step.occurred_at_unix_ms) ?? call.occurredAtUnixMs ?? null,
3475
4010
  payload: objectValue5(step.payload),
@@ -3506,7 +4041,7 @@ function patchBatchesFromCall(call, options) {
3506
4041
  return [];
3507
4042
  }
3508
4043
  return patchBatchFromPayload({
3509
- id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `${call.id}:step:${index + 1}`,
4044
+ id: stringValue7(step.toolUseId) ?? stringValue7(step.id) ?? `${call.id}:step:${index + 1}`,
3510
4045
  payload: objectValue5(step.payload),
3511
4046
  toolInput: objectValue5(step.toolInput) ?? objectValue5(step.tool_input),
3512
4047
  toolOutput: objectValue5(step.toolResult) ?? objectValue5(step.tool_result),
@@ -3535,11 +4070,11 @@ function patchBatchFromPayload(input) {
3535
4070
  return [
3536
4071
  {
3537
4072
  cwd: firstNonEmptyString(
3538
- stringValue6(input.payload?.cwd),
3539
- stringValue6(payloadInput?.cwd),
3540
- stringValue6(rawInput?.cwd),
3541
- stringValue6(payloadOutput?.cwd),
3542
- stringValue6(metadata?.cwd),
4073
+ stringValue7(input.payload?.cwd),
4074
+ stringValue7(payloadInput?.cwd),
4075
+ stringValue7(rawInput?.cwd),
4076
+ stringValue7(payloadOutput?.cwd),
4077
+ stringValue7(metadata?.cwd),
3543
4078
  input.options.defaultCwd ?? null
3544
4079
  ) ?? null,
3545
4080
  toolCallId: input.id,
@@ -3556,10 +4091,10 @@ function patchChangesFromChangeMap(changes) {
3556
4091
  }
3557
4092
  const normalizedType = normalizeChangeType(fileChangeTypeValue(change));
3558
4093
  const unifiedDiff = firstNonEmptyString(
3559
- stringValue6(change.unified_diff),
3560
- stringValue6(change.unifiedDiff),
3561
- stringValue6(change.diff),
3562
- stringValue6(change.patch)
4094
+ stringValue7(change.unified_diff),
4095
+ stringValue7(change.unifiedDiff),
4096
+ stringValue7(change.diff),
4097
+ stringValue7(change.patch)
3563
4098
  ) ?? null;
3564
4099
  let oldString = firstPresentString6(
3565
4100
  literalStringValue(change.old_string),
@@ -3635,10 +4170,10 @@ function extractFileChanges(input) {
3635
4170
  input.occurredAtUnixMs,
3636
4171
  arrayValue5(objectValue5(payload?.fileChanges)?.files),
3637
4172
  firstNonEmptyString(
3638
- stringValue6(input.input?.patch),
3639
- stringValue6(input.output?.patch),
3640
- stringValue6(payload?.patch),
3641
- stringValue6(metadata?.patch)
4173
+ stringValue7(input.input?.patch),
4174
+ stringValue7(input.output?.patch),
4175
+ stringValue7(payload?.patch),
4176
+ stringValue7(metadata?.patch)
3642
4177
  ),
3643
4178
  firstPresentString6(
3644
4179
  literalStringValue(input.output?.oldString),
@@ -3682,24 +4217,24 @@ function extractFileChanges(input) {
3682
4217
  if (filesFromContentDiff.length > 0) {
3683
4218
  return filesFromContentDiff;
3684
4219
  }
3685
- const summaryFallbackPath = input.input?.summaryPathFallback === true ? stringValue6(input.input?.path) : null;
3686
- const explicitInputPath = summaryFallbackPath ? null : stringValue6(input.input?.path);
4220
+ const summaryFallbackPath = input.input?.summaryPathFallback === true ? stringValue7(input.input?.path) : null;
4221
+ const explicitInputPath = summaryFallbackPath ? null : stringValue7(input.input?.path);
3687
4222
  const filePath = firstNonEmptyString(
3688
4223
  firstPathValue(payloadPaths),
3689
- stringValue6(input.input?.file_path),
3690
- stringValue6(input.input?.filePath),
4224
+ stringValue7(input.input?.file_path),
4225
+ stringValue7(input.input?.filePath),
3691
4226
  explicitInputPath,
3692
- stringValue6(input.input?.notebook_path),
3693
- stringValue6(input.output?.file_path),
3694
- stringValue6(input.output?.filePath),
3695
- stringValue6(input.output?.path),
3696
- stringValue6(input.output?.notebook_path),
4227
+ stringValue7(input.input?.notebook_path),
4228
+ stringValue7(input.output?.file_path),
4229
+ stringValue7(input.output?.filePath),
4230
+ stringValue7(input.output?.path),
4231
+ stringValue7(input.output?.notebook_path),
3697
4232
  firstLocationPath(inputLocations),
3698
4233
  firstLocationPath(payloadLocations)
3699
4234
  ) ?? extractAgentPatchPath(
3700
4235
  firstNonEmptyString(
3701
- stringValue6(input.input?.patch),
3702
- stringValue6(input.output?.patch)
4236
+ stringValue7(input.input?.patch),
4237
+ stringValue7(input.output?.patch)
3703
4238
  )
3704
4239
  ) ?? summaryFallbackPath;
3705
4240
  const normalizedFilePathValue = normalizedFilePath(filePath, input.options);
@@ -3707,11 +4242,11 @@ function extractFileChanges(input) {
3707
4242
  return [];
3708
4243
  }
3709
4244
  const patch = firstNonEmptyString(
3710
- stringValue6(input.input?.patch),
3711
- stringValue6(input.output?.patch),
3712
- stringValue6(payload?.patch),
3713
- stringValue6(metadata?.patch),
3714
- stringValue6(input.output?.content)
4245
+ stringValue7(input.input?.patch),
4246
+ stringValue7(input.output?.patch),
4247
+ stringValue7(payload?.patch),
4248
+ stringValue7(metadata?.patch),
4249
+ stringValue7(input.output?.content)
3715
4250
  ) ?? null;
3716
4251
  const oldString = firstPresentString6(
3717
4252
  literalStringValue(input.output?.oldString),
@@ -3734,10 +4269,10 @@ function extractFileChanges(input) {
3734
4269
  );
3735
4270
  const explicitChangeType = normalizeChangeType(
3736
4271
  firstNonEmptyString(
3737
- stringValue6(payload?.fileChangeKind),
3738
- stringValue6(metadata?.fileChangeKind),
3739
- stringValue6(input.input?.fileChangeKind),
3740
- stringValue6(input.output?.fileChangeKind)
4272
+ stringValue7(payload?.fileChangeKind),
4273
+ stringValue7(metadata?.fileChangeKind),
4274
+ stringValue7(input.input?.fileChangeKind),
4275
+ stringValue7(input.output?.fileChangeKind)
3741
4276
  )
3742
4277
  ) ?? null;
3743
4278
  const changeType = explicitChangeType ?? (normalizedToolName === "write" || normalizedToolName === "writefile" ? "created" : normalizedToolName === "notebookedit" ? "created" : inferAgentPatchChangeType(patch));
@@ -3777,16 +4312,16 @@ function isStructuredWriteTool(normalizedToolName, payload, metadata) {
3777
4312
  return false;
3778
4313
  }
3779
4314
  const activityKind = firstNonEmptyString(
3780
- stringValue6(payload?.activityKind),
3781
- stringValue6(metadata?.activityKind)
4315
+ stringValue7(payload?.activityKind),
4316
+ stringValue7(metadata?.activityKind)
3782
4317
  );
3783
4318
  if (activityKind === "write_file" || activityKind === "edit_file" || activityKind === "delete_file") {
3784
4319
  return true;
3785
4320
  }
3786
4321
  return normalizeChangeType(
3787
4322
  firstNonEmptyString(
3788
- stringValue6(payload?.fileChangeKind),
3789
- stringValue6(metadata?.fileChangeKind)
4323
+ stringValue7(payload?.fileChangeKind),
4324
+ stringValue7(metadata?.fileChangeKind)
3790
4325
  )
3791
4326
  ) !== null;
3792
4327
  }
@@ -3796,11 +4331,11 @@ function collectMetadataFiles(messageId, toolName, occurredAtUnixMs, files, patc
3796
4331
  }
3797
4332
  return files.flatMap((value, index) => {
3798
4333
  const file = objectValue5(value);
3799
- const path = normalizedFilePath(stringValue6(file?.path), options);
4334
+ const path = normalizedFilePath(stringValue7(file?.path), options);
3800
4335
  if (!path) {
3801
4336
  return [];
3802
4337
  }
3803
- const change = normalizeChangeType(stringValue6(file?.change));
4338
+ const change = normalizeChangeType(stringValue7(file?.change));
3804
4339
  return [
3805
4340
  buildFileChange({
3806
4341
  id: `${messageId}:${index + 1}`,
@@ -3825,10 +4360,10 @@ function collectChangeMapFiles(messageId, toolName, occurredAtUnixMs, changes, o
3825
4360
  }
3826
4361
  const normalizedType = normalizeChangeType(fileChangeTypeValue(change));
3827
4362
  const unifiedDiff = firstNonEmptyString(
3828
- stringValue6(change.unified_diff),
3829
- stringValue6(change.unifiedDiff),
3830
- stringValue6(change.diff),
3831
- stringValue6(change.patch)
4363
+ stringValue7(change.unified_diff),
4364
+ stringValue7(change.unifiedDiff),
4365
+ stringValue7(change.diff),
4366
+ stringValue7(change.patch)
3832
4367
  );
3833
4368
  let oldString = firstPresentString6(
3834
4369
  literalStringValue(change.old_string),
@@ -3887,11 +4422,11 @@ function collectContentDiffFiles(messageId, toolName, occurredAtUnixMs, contentI
3887
4422
  if (!item) {
3888
4423
  return [];
3889
4424
  }
3890
- const type = stringValue6(item.type);
4425
+ const type = stringValue7(item.type);
3891
4426
  if (type && type !== "diff") {
3892
4427
  return [];
3893
4428
  }
3894
- const path = normalizedFilePath(stringValue6(item.path), options);
4429
+ const path = normalizedFilePath(stringValue7(item.path), options);
3895
4430
  if (!path) {
3896
4431
  return [];
3897
4432
  }
@@ -3900,10 +4435,10 @@ function collectContentDiffFiles(messageId, toolName, occurredAtUnixMs, contentI
3900
4435
  relatedChange ? fileChangeTypeValue(relatedChange) : null
3901
4436
  );
3902
4437
  const unifiedDiff = firstNonEmptyString(
3903
- stringValue6(item.diff),
3904
- stringValue6(item.patch),
3905
- stringValue6(relatedChange?.unified_diff),
3906
- stringValue6(relatedChange?.unifiedDiff)
4438
+ stringValue7(item.diff),
4439
+ stringValue7(item.patch),
4440
+ stringValue7(relatedChange?.unified_diff),
4441
+ stringValue7(relatedChange?.unifiedDiff)
3907
4442
  );
3908
4443
  let oldString = firstPresentString6(
3909
4444
  literalStringValue(item.oldText),
@@ -4189,9 +4724,9 @@ function nestedTaskStepsFromPayload(payload, output) {
4189
4724
  }
4190
4725
  function nestedTaskStepStatusKind(step, fallback) {
4191
4726
  return firstNonEmptyString(
4192
- stringValue6(step.statusKind),
4193
- stringValue6(step.status),
4194
- stringValue6(step.toolStatus)
4727
+ stringValue7(step.statusKind),
4728
+ stringValue7(step.status),
4729
+ stringValue7(step.toolStatus)
4195
4730
  ) ?? fallback ?? null;
4196
4731
  }
4197
4732
  function firstLocationPath(value) {
@@ -4200,7 +4735,7 @@ function firstLocationPath(value) {
4200
4735
  }
4201
4736
  for (const item of value) {
4202
4737
  const record = objectValue5(item);
4203
- const path = stringValue6(record?.path);
4738
+ const path = stringValue7(record?.path);
4204
4739
  if (path) {
4205
4740
  return path;
4206
4741
  }
@@ -4212,14 +4747,14 @@ function firstPathValue(value) {
4212
4747
  return null;
4213
4748
  }
4214
4749
  for (const item of value) {
4215
- const path = stringValue6(item);
4750
+ const path = stringValue7(item);
4216
4751
  if (path) {
4217
4752
  return path;
4218
4753
  }
4219
4754
  }
4220
4755
  return null;
4221
4756
  }
4222
- function stringValue6(value) {
4757
+ function stringValue7(value) {
4223
4758
  return typeof value === "string" && value.trim() ? value.trim() : null;
4224
4759
  }
4225
4760
  function literalStringValue(value) {
@@ -4732,7 +5267,7 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
4732
5267
  if (!content) {
4733
5268
  return [];
4734
5269
  }
4735
- const displayPrompt = firstString2(
5270
+ const displayPrompt = firstString3(
4736
5271
  message.sourceTimelineItems?.map(
4737
5272
  (candidate) => typeof candidate.payload?.displayPrompt === "string" ? candidate.payload.displayPrompt : ""
4738
5273
  ) ?? []
@@ -4773,7 +5308,7 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
4773
5308
  }
4774
5309
  return [{ type: "text", text: displayPrompt }, ...blocks];
4775
5310
  }
4776
- function firstString2(values) {
5311
+ function firstString3(values) {
4777
5312
  for (const value of values) {
4778
5313
  const trimmed = value.trim();
4779
5314
  if (trimmed) {
@@ -4943,18 +5478,19 @@ function AgentTranscriptSkeleton({
4943
5478
 
4944
5479
  // shared/agentConversation/components/AgentTranscriptView.tsx
4945
5480
  import {
4946
- Fragment as Fragment6,
4947
- memo as memo3,
5481
+ Fragment as Fragment7,
5482
+ memo as memo4,
4948
5483
  useCallback as useCallback10,
5484
+ useEffect as useEffect11,
4949
5485
  useLayoutEffect as useLayoutEffect2,
4950
5486
  useMemo as useMemo6,
4951
5487
  useRef as useRef8,
4952
- useState as useState17
5488
+ useState as useState18
4953
5489
  } from "react";
4954
5490
  import { useVirtualizer } from "@tanstack/react-virtual";
4955
5491
 
4956
5492
  // shared/agentConversation/components/AgentTranscriptItemView.tsx
4957
- import { memo as memo2, useCallback as useCallback9 } from "react";
5493
+ import { memo as memo3, useCallback as useCallback9 } from "react";
4958
5494
 
4959
5495
  // shared/agentConversation/actions/agentConversationLinkActions.ts
4960
5496
  function resolveAgentConversationLinkAction({
@@ -5312,7 +5848,7 @@ import { useEffect } from "react";
5312
5848
  import { EditorContent, useEditor } from "@tiptap/react";
5313
5849
 
5314
5850
  // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
5315
- import { mergeAttributes, Node } from "@tiptap/core";
5851
+ import { mergeAttributes, Node as Node2 } from "@tiptap/core";
5316
5852
 
5317
5853
  // agent-gui/agentGuiNode/model/agentSkillOptions.ts
5318
5854
  function skillTriggerForPrefix(skill, prefix) {
@@ -5367,7 +5903,7 @@ function stripSkillTriggerPrefix(trigger) {
5367
5903
 
5368
5904
  // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
5369
5905
  function createAgentSkillTokenExtension(options = {}) {
5370
- return Node.create({
5906
+ return Node2.create({
5371
5907
  name: "agentSkillToken",
5372
5908
  group: "inline",
5373
5909
  inline: true,
@@ -5479,9 +6015,9 @@ function skillTokenDisplayLabel(attrs) {
5479
6015
  }
5480
6016
 
5481
6017
  // agent-gui/agentGuiNode/agentRichText/agentCapabilityTokenExtension.ts
5482
- import { mergeAttributes as mergeAttributes2, Node as Node2 } from "@tiptap/core";
6018
+ import { mergeAttributes as mergeAttributes2, Node as Node3 } from "@tiptap/core";
5483
6019
  function createAgentCapabilityTokenExtension(options = {}) {
5484
- return Node2.create({
6020
+ return Node3.create({
5485
6021
  name: "agentCapabilityToken",
5486
6022
  group: "inline",
5487
6023
  inline: true,
@@ -6987,7 +7523,7 @@ var MESSAGE_COPY_FEEDBACK_MS = 1400;
6987
7523
  var CONTEXT_COMPACTION_NOTICE_TITLE = "Context compacted.";
6988
7524
  var TRANSPORT_RETRY_PROGRESS_PATTERN = /\b(reconnect(?:ing)?(?:\s*(?:\.\.\.|…|[.。]+|:|-))?\s*\(?\d+\s*\/\s*\d+\)?)/i;
6989
7525
  var SYSTEM_NOTICE_WARNING_CLASS_NAME = "border-[color-mix(in_srgb,var(--state-warning)_14%,transparent)] bg-[color-mix(in_srgb,var(--background-fronted)_100%,var(--state-warning)_6%)]";
6990
- var SYSTEM_NOTICE_ERROR_CLASS_NAME = "border-[color-mix(in_srgb,var(--state-danger)_20%,transparent)] bg-[color-mix(in_srgb,var(--background-fronted)_100%,var(--state-danger)_8%)]";
7526
+ var SYSTEM_NOTICE_ERROR_CLASS_NAME = "border-[var(--on-danger-hover)] bg-[var(--on-danger)]";
6991
7527
  function AgentMessageBlock({
6992
7528
  workspaceRoot,
6993
7529
  basePath,
@@ -7220,44 +7756,37 @@ function AgentUserImageGrid({
7220
7756
  return /* @__PURE__ */ jsx12(
7221
7757
  "div",
7222
7758
  {
7223
- className: "grid justify-self-end gap-2",
7759
+ className: AgentGUIConversation_styles_default.userImageGrid,
7224
7760
  style: {
7225
7761
  gridTemplateColumns: `repeat(${columnCount}, ${thumbnailWidth})`
7226
7762
  },
7227
7763
  children: images.map((image) => {
7228
7764
  const src = loadedImages.get(image.id) ?? imageDataUrl(image);
7229
7765
  const loading = !src && loadingIds.has(image.id);
7230
- return /* @__PURE__ */ jsx12(
7766
+ return /* @__PURE__ */ jsx12("div", { className: AgentGUIConversation_styles_default.userImageThumbnail, children: src ? /* @__PURE__ */ jsx12(
7767
+ ZoomableImage,
7768
+ {
7769
+ src,
7770
+ alt: image.name?.trim() || "image",
7771
+ className: "block max-h-20 w-full rounded-[7px] object-contain",
7772
+ draggable: false,
7773
+ downloadName: image.name?.trim() || "image.png"
7774
+ }
7775
+ ) : loading ? /* @__PURE__ */ jsx12(
7231
7776
  "div",
7232
7777
  {
7233
- className: "max-h-20 min-w-0 overflow-hidden rounded-[6px]",
7234
- children: src ? /* @__PURE__ */ jsx12(
7235
- ZoomableImage,
7778
+ className: "flex h-20 w-full items-center justify-center bg-[color-mix(in_srgb,var(--text-primary)_6%,transparent)]",
7779
+ "data-testid": "agent-gui-message-image-loading",
7780
+ children: /* @__PURE__ */ jsx12(
7781
+ LoaderCircle,
7236
7782
  {
7237
- src,
7238
- alt: image.name?.trim() || "image",
7239
- className: "block max-h-20 w-full rounded-[6px] object-contain",
7240
- draggable: false,
7241
- downloadName: image.name?.trim() || "image.png"
7242
- }
7243
- ) : loading ? /* @__PURE__ */ jsx12(
7244
- "div",
7245
- {
7246
- className: "flex h-20 w-full items-center justify-center bg-[color-mix(in_srgb,var(--text-primary)_6%,transparent)]",
7247
- "data-testid": "agent-gui-message-image-loading",
7248
- children: /* @__PURE__ */ jsx12(
7249
- LoaderCircle,
7250
- {
7251
- "aria-hidden": "true",
7252
- className: "size-5 animate-spin text-[color-mix(in_srgb,var(--text-primary)_45%,transparent)]",
7253
- strokeWidth: 2
7254
- }
7255
- )
7783
+ "aria-hidden": "true",
7784
+ className: "size-5 animate-spin text-[color-mix(in_srgb,var(--text-primary)_45%,transparent)]",
7785
+ strokeWidth: 2
7256
7786
  }
7257
- ) : /* @__PURE__ */ jsx12("div", { className: "h-20 w-full animate-pulse bg-[color-mix(in_srgb,var(--text-primary)_8%,transparent)]" })
7258
- },
7259
- image.id
7260
- );
7787
+ )
7788
+ }
7789
+ ) : /* @__PURE__ */ jsx12("div", { className: "h-20 w-full animate-pulse bg-[color-mix(in_srgb,var(--text-primary)_8%,transparent)]" }) }, image.id);
7261
7790
  })
7262
7791
  }
7263
7792
  );
@@ -7388,8 +7917,8 @@ function AgentSystemNoticeMessage({
7388
7917
  }
7389
7918
  );
7390
7919
  }
7391
- const isStatusNotice = systemNoticeIsStatus(notice);
7392
- const noticeToneClassName = systemNoticeToneClassName(notice);
7920
+ const isStatusNotice = systemNoticeIsStatus(message);
7921
+ const noticeToneClassName = systemNoticeToneClassName(message);
7393
7922
  return /* @__PURE__ */ jsx12(
7394
7923
  "section",
7395
7924
  {
@@ -7402,8 +7931,9 @@ function AgentSystemNoticeMessage({
7402
7931
  }
7403
7932
  );
7404
7933
  }
7405
- function systemNoticeToneClassName(notice) {
7406
- if (notice?.severity === "error" || notice?.noticeKind === "transport_fallback") {
7934
+ function systemNoticeToneClassName(message) {
7935
+ const notice = message.systemNotice;
7936
+ if (notice?.severity === "error" || notice?.noticeKind === "transport_fallback" || isTransportFallbackNotice(message)) {
7407
7937
  return SYSTEM_NOTICE_ERROR_CLASS_NAME;
7408
7938
  }
7409
7939
  if (notice?.severity === "warning") {
@@ -7411,8 +7941,14 @@ function systemNoticeToneClassName(notice) {
7411
7941
  }
7412
7942
  return SYSTEM_NOTICE_WARNING_CLASS_NAME;
7413
7943
  }
7414
- function systemNoticeIsStatus(notice) {
7415
- return notice?.severity === "warning" || notice?.severity === "error" || notice?.noticeKind === "transport_fallback";
7944
+ function systemNoticeIsStatus(message) {
7945
+ const notice = message.systemNotice;
7946
+ return notice?.severity === "warning" || notice?.severity === "error" || notice?.noticeKind === "transport_fallback" || isTransportFallbackNotice(message);
7947
+ }
7948
+ function isTransportFallbackNotice(message) {
7949
+ const notice = message.systemNotice;
7950
+ const text = [notice?.title, notice?.detail, message.body].filter(Boolean).join("\n").toLowerCase();
7951
+ return text.includes("falling back from websockets") || text.includes("https transport");
7416
7952
  }
7417
7953
  function transportRetryNoticeText(message) {
7418
7954
  const notice = message.systemNotice;
@@ -7659,8 +8195,8 @@ function LoadingEllipsis2() {
7659
8195
  }
7660
8196
 
7661
8197
  // shared/agentConversation/components/AgentToolGroupRow.tsx
7662
- import { memo, useState as useState15 } from "react";
7663
- import { ChevronDown as ChevronDown6, ChevronRight as ChevronRight6 } from "lucide-react";
8198
+ import { memo as memo2, useState as useState16 } from "react";
8199
+ import { ChevronDown as ChevronDown7, ChevronRight as ChevronRight7 } from "lucide-react";
7664
8200
 
7665
8201
  // shared/agentConversation/components/AgentAskUserQuestionCard.tsx
7666
8202
  import { useState as useState12 } from "react";
@@ -8182,9 +8718,9 @@ function WriteLinedIcon(props) {
8182
8718
 
8183
8719
  // shared/agentConversation/components/tool-renderers/render-data/agentToolFileChangeRenderData.ts
8184
8720
  function getFileChangeRenderData(call) {
8185
- const payloadInput = recordValue4(call.payload?.input);
8186
- const payloadOutput = recordValue4(call.payload?.output);
8187
- const rawInput = recordValue4(call.input?.rawInput) ?? recordValue4(payloadInput?.rawInput);
8721
+ const payloadInput = recordValue5(call.payload?.input);
8722
+ const payloadOutput = recordValue5(call.payload?.output);
8723
+ const rawInput = recordValue5(call.input?.rawInput) ?? recordValue5(payloadInput?.rawInput);
8188
8724
  const inputLocations = arrayValue6(call.locations) ?? arrayValue6(call.input?.locations) ?? arrayValue6(payloadInput?.locations);
8189
8725
  const fromStructuredPatch = structuredPatchFiles(
8190
8726
  call.output?.structuredPatch ?? payloadOutput?.structuredPatch ?? call.payload?.structuredPatch
@@ -8218,44 +8754,44 @@ function getFileChangeRenderData(call) {
8218
8754
  if (fromContentDiff.length > 0) {
8219
8755
  return fromContentDiff;
8220
8756
  }
8221
- const inputPath = firstString3(
8222
- stringValue7(call.input?.file_path),
8223
- stringValue7(call.input?.filePath),
8224
- stringValue7(call.input?.path),
8225
- stringValue7(payloadInput?.file_path),
8226
- stringValue7(payloadInput?.filePath),
8227
- stringValue7(payloadInput?.path),
8757
+ const inputPath = firstString4(
8758
+ stringValue8(call.input?.file_path),
8759
+ stringValue8(call.input?.filePath),
8760
+ stringValue8(call.input?.path),
8761
+ stringValue8(payloadInput?.file_path),
8762
+ stringValue8(payloadInput?.filePath),
8763
+ stringValue8(payloadInput?.path),
8228
8764
  firstLocationPath2(inputLocations)
8229
8765
  );
8230
- const unifiedDiff = firstString3(
8231
- stringValue7(call.output?.patch),
8232
- stringValue7(payloadOutput?.patch),
8233
- stringValue7(call.output?.diff),
8234
- stringValue7(payloadOutput?.diff)
8766
+ const unifiedDiff = firstString4(
8767
+ stringValue8(call.output?.patch),
8768
+ stringValue8(payloadOutput?.patch),
8769
+ stringValue8(call.output?.diff),
8770
+ stringValue8(payloadOutput?.diff)
8235
8771
  );
8236
- const path = firstString3(
8772
+ const path = firstString4(
8237
8773
  inputPath,
8238
8774
  unifiedDiff ? extractAgentPatchPath(unifiedDiff) : null
8239
8775
  );
8240
8776
  if (!path) {
8241
8777
  return [];
8242
8778
  }
8243
- const content = firstString3(
8244
- stringValue7(call.input?.content),
8245
- stringValue7(payloadInput?.content),
8246
- stringValue7(rawInput?.content)
8779
+ const content = firstString4(
8780
+ stringValue8(call.input?.content),
8781
+ stringValue8(payloadInput?.content),
8782
+ stringValue8(rawInput?.content)
8247
8783
  );
8248
- const oldString = firstString3(
8249
- stringValue7(call.input?.old_string),
8250
- stringValue7(payloadInput?.old_string),
8251
- stringValue7(call.output?.oldString),
8252
- stringValue7(payloadOutput?.oldString)
8784
+ const oldString = firstString4(
8785
+ stringValue8(call.input?.old_string),
8786
+ stringValue8(payloadInput?.old_string),
8787
+ stringValue8(call.output?.oldString),
8788
+ stringValue8(payloadOutput?.oldString)
8253
8789
  );
8254
- const newString = firstString3(
8255
- stringValue7(call.input?.new_string),
8256
- stringValue7(payloadInput?.new_string),
8257
- stringValue7(call.output?.newString),
8258
- stringValue7(payloadOutput?.newString)
8790
+ const newString = firstString4(
8791
+ stringValue8(call.input?.new_string),
8792
+ stringValue8(payloadInput?.new_string),
8793
+ stringValue8(call.output?.newString),
8794
+ stringValue8(payloadOutput?.newString)
8259
8795
  );
8260
8796
  const changeType = inferFileChangeType(
8261
8797
  call.toolName,
@@ -8292,33 +8828,33 @@ function structuredPatchFiles(value) {
8292
8828
  return [];
8293
8829
  }
8294
8830
  return patches.flatMap((item) => {
8295
- const patch = recordValue4(item);
8296
- const path = firstString3(
8297
- stringValue7(patch?.filePath),
8298
- stringValue7(patch?.path)
8831
+ const patch = recordValue5(item);
8832
+ const path = firstString4(
8833
+ stringValue8(patch?.filePath),
8834
+ stringValue8(patch?.path)
8299
8835
  );
8300
- const diff = firstString3(
8301
- stringValue7(patch?.diff),
8302
- stringValue7(patch?.patch)
8836
+ const diff = firstString4(
8837
+ stringValue8(patch?.diff),
8838
+ stringValue8(patch?.patch)
8303
8839
  );
8304
8840
  if (!path) {
8305
8841
  return [];
8306
8842
  }
8307
- const oldString = firstString3(
8308
- stringValue7(patch?.oldString),
8309
- stringValue7(patch?.old_string)
8843
+ const oldString = firstString4(
8844
+ stringValue8(patch?.oldString),
8845
+ stringValue8(patch?.old_string)
8310
8846
  );
8311
- const newString = firstString3(
8312
- stringValue7(patch?.newString),
8313
- stringValue7(patch?.new_string)
8847
+ const newString = firstString4(
8848
+ stringValue8(patch?.newString),
8849
+ stringValue8(patch?.new_string)
8314
8850
  );
8315
- const content = firstString3(stringValue7(patch?.content), newString);
8851
+ const content = firstString4(stringValue8(patch?.content), newString);
8316
8852
  if (!diff && !oldString && !newString && !content) {
8317
8853
  return [];
8318
8854
  }
8319
8855
  const changeType = firstKnownChangeType(
8320
- normalizeChangeType2(stringValue7(patch?.kind)),
8321
- normalizeChangeType2(stringValue7(patch?.change)),
8856
+ normalizeChangeType2(stringValue8(patch?.kind)),
8857
+ normalizeChangeType2(stringValue8(patch?.change)),
8322
8858
  inferFileChangeType(null, diff, content, oldString, newString)
8323
8859
  );
8324
8860
  const stats = fileChangeStats(
@@ -8344,7 +8880,7 @@ function structuredPatchFiles(value) {
8344
8880
  });
8345
8881
  }
8346
8882
  function detailedDiffFiles(value) {
8347
- const diff = stringValue7(value);
8883
+ const diff = stringValue8(value);
8348
8884
  if (!diff) {
8349
8885
  return [];
8350
8886
  }
@@ -8369,30 +8905,30 @@ function detailedDiffFiles(value) {
8369
8905
  ];
8370
8906
  }
8371
8907
  function fileChangesFiles(value) {
8372
- const record = recordValue4(value);
8908
+ const record = recordValue5(value);
8373
8909
  const files = arrayValue6(record?.files);
8374
8910
  if (!files) {
8375
8911
  return [];
8376
8912
  }
8377
8913
  return files.flatMap((item) => {
8378
- const file = recordValue4(item);
8379
- const path = stringValue7(file?.path);
8914
+ const file = recordValue5(item);
8915
+ const path = stringValue8(file?.path);
8380
8916
  if (!path) {
8381
8917
  return [];
8382
8918
  }
8383
- const diff = firstString3(stringValue7(file?.diff), stringValue7(file?.patch));
8384
- const oldString = firstString3(
8385
- stringValue7(file?.oldString),
8386
- stringValue7(file?.old_string)
8919
+ const diff = firstString4(stringValue8(file?.diff), stringValue8(file?.patch));
8920
+ const oldString = firstString4(
8921
+ stringValue8(file?.oldString),
8922
+ stringValue8(file?.old_string)
8387
8923
  );
8388
- const newString = firstString3(
8389
- stringValue7(file?.newString),
8390
- stringValue7(file?.new_string)
8924
+ const newString = firstString4(
8925
+ stringValue8(file?.newString),
8926
+ stringValue8(file?.new_string)
8391
8927
  );
8392
- const content = firstString3(stringValue7(file?.content), newString);
8928
+ const content = firstString4(stringValue8(file?.content), newString);
8393
8929
  const changeType = firstKnownChangeType(
8394
- normalizeChangeType2(stringValue7(file?.change)),
8395
- normalizeChangeType2(stringValue7(file?.kind)),
8930
+ normalizeChangeType2(stringValue8(file?.change)),
8931
+ normalizeChangeType2(stringValue8(file?.kind)),
8396
8932
  inferFileChangeType(null, diff, content, oldString, newString)
8397
8933
  );
8398
8934
  const stats = fileChangeStats(
@@ -8424,21 +8960,21 @@ function changeMapFiles(value) {
8424
8960
  if (!normalizedPath) {
8425
8961
  return [];
8426
8962
  }
8427
- const unifiedDiff = firstString3(
8428
- stringValue7(change.unified_diff),
8429
- stringValue7(change.unifiedDiff),
8430
- stringValue7(change.diff),
8431
- stringValue7(change.patch)
8963
+ const unifiedDiff = firstString4(
8964
+ stringValue8(change.unified_diff),
8965
+ stringValue8(change.unifiedDiff),
8966
+ stringValue8(change.diff),
8967
+ stringValue8(change.patch)
8432
8968
  );
8433
- const explicitContent = stringValue7(change.content);
8969
+ const explicitContent = stringValue8(change.content);
8434
8970
  const normalizedType = normalizeChangeType2(fileChangeTypeValue(change));
8435
- let oldString = firstString3(
8436
- stringValue7(change.old_string),
8437
- stringValue7(change.oldString)
8971
+ let oldString = firstString4(
8972
+ stringValue8(change.old_string),
8973
+ stringValue8(change.oldString)
8438
8974
  );
8439
- let newString = firstString3(
8440
- stringValue7(change.new_string),
8441
- stringValue7(change.newString),
8975
+ let newString = firstString4(
8976
+ stringValue8(change.new_string),
8977
+ stringValue8(change.newString),
8442
8978
  explicitContent
8443
8979
  );
8444
8980
  if (normalizedType === "created" && oldString === null && newString !== null) {
@@ -8451,7 +8987,7 @@ function changeMapFiles(value) {
8451
8987
  if (normalizedType === "deleted" && newString === null && oldString !== null) {
8452
8988
  newString = "";
8453
8989
  }
8454
- const content = firstString3(
8990
+ const content = firstString4(
8455
8991
  normalizedType === "deleted" ? null : explicitContent,
8456
8992
  normalizedType === "created" ? newString : null
8457
8993
  );
@@ -8497,40 +9033,40 @@ function contentDiffFiles(value, changesValue, toolName) {
8497
9033
  ])
8498
9034
  );
8499
9035
  return items.flatMap((item) => {
8500
- const record = recordValue4(item);
9036
+ const record = recordValue5(item);
8501
9037
  if (!record) {
8502
9038
  return [];
8503
9039
  }
8504
- const type = stringValue7(record.type);
9040
+ const type = stringValue8(record.type);
8505
9041
  if (type && type !== "diff") {
8506
9042
  return [];
8507
9043
  }
8508
- const path = stringValue7(record.path);
9044
+ const path = stringValue8(record.path);
8509
9045
  if (!path) {
8510
9046
  return [];
8511
9047
  }
8512
9048
  const relatedChange = changesByPath.get(path) ?? null;
8513
- const unifiedDiff = firstString3(
8514
- stringValue7(record.diff),
8515
- stringValue7(record.patch),
8516
- stringValue7(relatedChange?.unified_diff),
8517
- stringValue7(relatedChange?.unifiedDiff)
9049
+ const unifiedDiff = firstString4(
9050
+ stringValue8(record.diff),
9051
+ stringValue8(record.patch),
9052
+ stringValue8(relatedChange?.unified_diff),
9053
+ stringValue8(relatedChange?.unifiedDiff)
8518
9054
  );
8519
9055
  const normalizedType = normalizeChangeType2(
8520
9056
  relatedChange ? fileChangeTypeValue(relatedChange) : null
8521
9057
  );
8522
- let oldString = firstString3(
8523
- stringValue7(record.oldText),
8524
- stringValue7(record.oldString),
8525
- stringValue7(relatedChange?.old_string),
8526
- stringValue7(relatedChange?.oldString)
9058
+ let oldString = firstString4(
9059
+ stringValue8(record.oldText),
9060
+ stringValue8(record.oldString),
9061
+ stringValue8(relatedChange?.old_string),
9062
+ stringValue8(relatedChange?.oldString)
8527
9063
  );
8528
- let newString = firstString3(
8529
- stringValue7(record.newText),
8530
- stringValue7(record.newString),
8531
- stringValue7(relatedChange?.new_string),
8532
- stringValue7(relatedChange?.newString),
8533
- stringValue7(relatedChange?.content)
9064
+ let newString = firstString4(
9065
+ stringValue8(record.newText),
9066
+ stringValue8(record.newString),
9067
+ stringValue8(relatedChange?.new_string),
9068
+ stringValue8(relatedChange?.newString),
9069
+ stringValue8(relatedChange?.content)
8534
9070
  );
8535
9071
  if (normalizedType === "created" && oldString === null && newString !== null) {
8536
9072
  oldString = "";
@@ -8542,9 +9078,9 @@ function contentDiffFiles(value, changesValue, toolName) {
8542
9078
  if (normalizedType === "deleted" && newString === null && oldString !== null) {
8543
9079
  newString = "";
8544
9080
  }
8545
- const explicitContent = firstString3(
8546
- stringValue7(record.content),
8547
- stringValue7(relatedChange?.content)
9081
+ const explicitContent = firstString4(
9082
+ stringValue8(record.content),
9083
+ stringValue8(relatedChange?.content)
8548
9084
  );
8549
9085
  const changeType = firstKnownChangeType(
8550
9086
  normalizedType,
@@ -8559,7 +9095,7 @@ function contentDiffFiles(value, changesValue, toolName) {
8559
9095
  if (changeType === "created" && oldString === null && newString !== null) {
8560
9096
  oldString = "";
8561
9097
  }
8562
- const content = firstString3(
9098
+ const content = firstString4(
8563
9099
  changeType === "deleted" ? null : explicitContent,
8564
9100
  changeType === "created" ? newString : null
8565
9101
  );
@@ -8739,7 +9275,7 @@ function languageForPath(path) {
8739
9275
  function normalizeToolName6(value) {
8740
9276
  return (value ?? "").trim().replace(/[_\s-]+/g, "").toLowerCase();
8741
9277
  }
8742
- function firstString3(...values) {
9278
+ function firstString4(...values) {
8743
9279
  for (const value of values) {
8744
9280
  if (typeof value === "string" && value.trim()) {
8745
9281
  return value.trim();
@@ -8747,7 +9283,7 @@ function firstString3(...values) {
8747
9283
  }
8748
9284
  return null;
8749
9285
  }
8750
- function recordValue4(value) {
9286
+ function recordValue5(value) {
8751
9287
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
8752
9288
  }
8753
9289
  function arrayValue6(value) {
@@ -8758,42 +9294,42 @@ function firstLocationPath2(value) {
8758
9294
  return null;
8759
9295
  }
8760
9296
  for (const item of value) {
8761
- const record = recordValue4(item);
8762
- const path = stringValue7(record?.path);
9297
+ const record = recordValue5(item);
9298
+ const path = stringValue8(record?.path);
8763
9299
  if (path) {
8764
9300
  return path;
8765
9301
  }
8766
9302
  }
8767
9303
  return null;
8768
9304
  }
8769
- function stringValue7(value) {
9305
+ function stringValue8(value) {
8770
9306
  return typeof value === "string" && value.trim() ? value.trim() : null;
8771
9307
  }
8772
9308
 
8773
9309
  // shared/agentConversation/components/tool-renderers/render-data/agentToolRenderData.ts
8774
9310
  function getCommandRenderData(call) {
8775
- const inputRawInput = recordValue5(call.input?.rawInput);
8776
- const payloadInput = recordValue5(call.payload?.input);
8777
- const payloadInputRawInput = recordValue5(payloadInput?.rawInput);
8778
- const outputRawOutput = recordValue5(call.output?.rawOutput);
8779
- const errorRawOutput = recordValue5(call.error?.rawOutput);
9311
+ const inputRawInput = recordValue6(call.input?.rawInput);
9312
+ const payloadInput = recordValue6(call.payload?.input);
9313
+ const payloadInputRawInput = recordValue6(payloadInput?.rawInput);
9314
+ const outputRawOutput = recordValue6(call.output?.rawOutput);
9315
+ const errorRawOutput = recordValue6(call.error?.rawOutput);
8780
9316
  return {
8781
- command: firstString4(
8782
- stringValue8(call.input?.command),
8783
- stringValue8(call.input?.cmd),
9317
+ command: firstString5(
9318
+ stringValue9(call.input?.command),
9319
+ stringValue9(call.input?.cmd),
8784
9320
  commandArrayToString(call.input?.command),
8785
- stringValue8(inputRawInput?.command),
8786
- stringValue8(inputRawInput?.cmd),
8787
- stringValue8(call.payload?.command),
8788
- stringValue8(payloadInput?.command),
8789
- stringValue8(payloadInputRawInput?.command),
8790
- stringValue8(payloadInputRawInput?.cmd)
9321
+ stringValue9(inputRawInput?.command),
9322
+ stringValue9(inputRawInput?.cmd),
9323
+ stringValue9(call.payload?.command),
9324
+ stringValue9(payloadInput?.command),
9325
+ stringValue9(payloadInputRawInput?.command),
9326
+ stringValue9(payloadInputRawInput?.cmd)
8791
9327
  ),
8792
- cwd: firstString4(
8793
- stringValue8(call.input?.cwd),
8794
- stringValue8(inputRawInput?.cwd),
8795
- stringValue8(payloadInput?.cwd),
8796
- stringValue8(payloadInputRawInput?.cwd)
9328
+ cwd: firstString5(
9329
+ stringValue9(call.input?.cwd),
9330
+ stringValue9(inputRawInput?.cwd),
9331
+ stringValue9(payloadInput?.cwd),
9332
+ stringValue9(payloadInputRawInput?.cwd)
8797
9333
  ),
8798
9334
  stdout: firstRawString(
8799
9335
  rawStringValue(call.output?.stdout),
@@ -8828,42 +9364,42 @@ function getCommandRenderData(call) {
8828
9364
  function getSearchRenderData(call) {
8829
9365
  const canonicalContent = contentText(call.content);
8830
9366
  const canonicalFiles = locationPaths(call.locations);
8831
- const output = firstString4(
9367
+ const output = firstString5(
8832
9368
  canonicalContent,
8833
9369
  contentText(call.output?.content),
8834
- stringValue8(call.output?.content),
8835
- stringValue8(call.output?.output),
8836
- stringValue8(call.output?.aggregated_output),
8837
- stringValue8(call.output?.formatted_output),
8838
- stringValue8(call.output?.stdout),
8839
- stringValue8(call.summary),
9370
+ stringValue9(call.output?.content),
9371
+ stringValue9(call.output?.output),
9372
+ stringValue9(call.output?.aggregated_output),
9373
+ stringValue9(call.output?.formatted_output),
9374
+ stringValue9(call.output?.stdout),
9375
+ stringValue9(call.summary),
8840
9376
  ""
8841
9377
  ) ?? "";
8842
9378
  const outputLines = output.split("\n").filter(Boolean);
8843
9379
  const mode = canonicalFiles.length > 0 && !output ? "list_files" : searchMode(call.output, output);
8844
9380
  const filenames = canonicalFiles.length > 0 ? canonicalFiles : stringArray(call.output?.filenames);
8845
9381
  return {
8846
- query: firstString4(
8847
- stringValue8(call.input?.pattern),
8848
- stringValue8(call.input?.query),
8849
- stringValue8(call.input?.search_query),
8850
- stringValue8(call.input?.searchQuery),
8851
- stringValue8(call.input?.glob)
9382
+ query: firstString5(
9383
+ stringValue9(call.input?.pattern),
9384
+ stringValue9(call.input?.query),
9385
+ stringValue9(call.input?.search_query),
9386
+ stringValue9(call.input?.searchQuery),
9387
+ stringValue9(call.input?.glob)
8852
9388
  ),
8853
- scope: firstString4(
8854
- stringValue8(call.input?.path),
8855
- stringValue8(call.input?.file_path),
8856
- stringValue8(call.input?.glob)
9389
+ scope: firstString5(
9390
+ stringValue9(call.input?.path),
9391
+ stringValue9(call.input?.file_path),
9392
+ stringValue9(call.input?.glob)
8857
9393
  ),
8858
9394
  mode,
8859
9395
  files: filenames.length > 0 ? filenames : mode === "list_files" ? outputLines : [],
8860
9396
  lines: outputLines,
8861
9397
  output,
8862
- error: firstString4(
8863
- stringValue8(call.error?.aggregated_output),
8864
- stringValue8(call.error?.stdout),
8865
- stringValue8(call.error?.formatted_output),
8866
- stringValue8(call.error?.message)
9398
+ error: firstString5(
9399
+ stringValue9(call.error?.aggregated_output),
9400
+ stringValue9(call.error?.stdout),
9401
+ stringValue9(call.error?.formatted_output),
9402
+ stringValue9(call.error?.message)
8867
9403
  ) ?? ""
8868
9404
  };
8869
9405
  }
@@ -8871,43 +9407,43 @@ function getWebSearchRenderData(call) {
8871
9407
  const queries = normalizedQueries(
8872
9408
  call.input?.search_query,
8873
9409
  call.input?.searchQuery,
8874
- recordValue5(call.input?.action)?.search_query,
8875
- recordValue5(call.input?.action)?.searchQuery
9410
+ recordValue6(call.input?.action)?.search_query,
9411
+ recordValue6(call.input?.action)?.searchQuery
8876
9412
  );
8877
9413
  return {
8878
- query: firstString4(
8879
- stringValue8(call.input?.query),
8880
- stringValue8(recordValue5(call.input?.action)?.query),
9414
+ query: firstString5(
9415
+ stringValue9(call.input?.query),
9416
+ stringValue9(recordValue6(call.input?.action)?.query),
8881
9417
  queries[0] ?? null
8882
9418
  ),
8883
9419
  queries,
8884
- url: firstString4(
8885
- stringValue8(call.input?.url),
8886
- stringValue8(recordValue5(call.input?.action)?.url)
9420
+ url: firstString5(
9421
+ stringValue9(call.input?.url),
9422
+ stringValue9(recordValue6(call.input?.action)?.url)
8887
9423
  ),
8888
- output: firstString4(
8889
- stringValue8(call.output?.stdout),
8890
- stringValue8(call.output?.output),
8891
- stringValue8(call.output?.content),
9424
+ output: firstString5(
9425
+ stringValue9(call.output?.stdout),
9426
+ stringValue9(call.output?.output),
9427
+ stringValue9(call.output?.content),
8892
9428
  contentText(call.output?.content)
8893
9429
  ) ?? "",
8894
- error: firstString4(
8895
- stringValue8(call.error?.message),
8896
- stringValue8(call.error?.stdout)
9430
+ error: firstString5(
9431
+ stringValue9(call.error?.message),
9432
+ stringValue9(call.error?.stdout)
8897
9433
  ) ?? ""
8898
9434
  };
8899
9435
  }
8900
9436
  function getWebFetchRenderData(call, maxContentLength = 3e3) {
8901
- const url = firstString4(
8902
- stringValue8(call.input?.url),
8903
- stringValue8(recordValue5(call.input?.action)?.url)
9437
+ const url = firstString5(
9438
+ stringValue9(call.input?.url),
9439
+ stringValue9(recordValue6(call.input?.action)?.url)
8904
9440
  );
8905
- const content = firstString4(
9441
+ const content = firstString5(
8906
9442
  contentText(call.content),
8907
9443
  contentText(call.output?.content),
8908
- stringValue8(call.output?.output),
8909
- stringValue8(call.output?.content),
8910
- stringValue8(call.output?.stdout)
9444
+ stringValue9(call.output?.output),
9445
+ stringValue9(call.output?.content),
9446
+ stringValue9(call.output?.stdout)
8911
9447
  );
8912
9448
  return {
8913
9449
  url,
@@ -8923,21 +9459,21 @@ function getTodoRenderData(call) {
8923
9459
  return [];
8924
9460
  }
8925
9461
  return todos.flatMap((todo) => {
8926
- const record = recordValue5(todo);
8927
- const content = firstString4(
8928
- stringValue8(record?.content),
8929
- stringValue8(record?.text)
9462
+ const record = recordValue6(todo);
9463
+ const content = firstString5(
9464
+ stringValue9(record?.content),
9465
+ stringValue9(record?.text)
8930
9466
  );
8931
9467
  if (!content) {
8932
9468
  return [];
8933
9469
  }
8934
- return [{ content, status: stringValue8(record?.status) }];
9470
+ return [{ content, status: stringValue9(record?.status) }];
8935
9471
  });
8936
9472
  }
8937
9473
  function getToolSearchRenderData(call) {
8938
- const query = stringValue8(call.input?.query);
8939
- const matches = arrayValue7(call.output?.matches)?.map(stringValue8).filter((value) => value !== null) ?? [];
8940
- const totalDeferredTools = numberValue3(call.output?.total_deferred_tools) ?? numberValue3(call.output?.totalDeferredTools) ?? numberValue3(recordValue5(call.payload?.output)?.total_deferred_tools);
9474
+ const query = stringValue9(call.input?.query);
9475
+ const matches = arrayValue7(call.output?.matches)?.map(stringValue9).filter((value) => value !== null) ?? [];
9476
+ const totalDeferredTools = numberValue3(call.output?.total_deferred_tools) ?? numberValue3(call.output?.totalDeferredTools) ?? numberValue3(recordValue6(call.payload?.output)?.total_deferred_tools);
8941
9477
  const mode = query?.startsWith("select:") ? "direct" : "search";
8942
9478
  const displayQuery = query?.startsWith("select:") ? query.slice("select:".length) : query?.startsWith("+") ? query.slice(1) : query;
8943
9479
  return {
@@ -8949,22 +9485,22 @@ function getToolSearchRenderData(call) {
8949
9485
  };
8950
9486
  }
8951
9487
  function getPlanModeRenderData(call) {
8952
- const enterText = call.rendererKind === "plan-enter" ? firstString4(
8953
- stringValue8(call.planMode?.plan),
8954
- stringValue8(call.output?.text),
8955
- stringValue8(call.input?.content),
9488
+ const enterText = call.rendererKind === "plan-enter" ? firstString5(
9489
+ stringValue9(call.planMode?.plan),
9490
+ stringValue9(call.output?.text),
9491
+ stringValue9(call.input?.content),
8956
9492
  nonEmpty(call.summary),
8957
9493
  "Exploring codebase and designing implementation approach."
8958
9494
  ) : null;
8959
- const filePath = firstString4(
8960
- stringValue8(call.input?.filePath),
8961
- stringValue8(call.input?.file_path)
9495
+ const filePath = firstString5(
9496
+ stringValue9(call.input?.filePath),
9497
+ stringValue9(call.input?.file_path)
8962
9498
  );
8963
9499
  return {
8964
9500
  enterText,
8965
- plan: call.rendererKind === "plan-enter" ? null : firstString4(
8966
- stringValue8(call.input?.plan),
8967
- stringValue8(call.payload?.plan),
9501
+ plan: call.rendererKind === "plan-enter" ? null : firstString5(
9502
+ stringValue9(call.input?.plan),
9503
+ stringValue9(call.payload?.plan),
8968
9504
  nonEmpty(call.summary)
8969
9505
  ),
8970
9506
  filePath,
@@ -8974,49 +9510,49 @@ function getPlanModeRenderData(call) {
8974
9510
  function getTaskRenderData(call) {
8975
9511
  const task = call.task;
8976
9512
  const steps = task?.steps ?? normalizeTaskStepsFromCall(call);
8977
- const outputRawOutput = recordValue5(call.output?.rawOutput);
8978
- const errorRawOutput = recordValue5(call.error?.rawOutput);
9513
+ const outputRawOutput = recordValue6(call.output?.rawOutput);
9514
+ const errorRawOutput = recordValue6(call.error?.rawOutput);
8979
9515
  return {
8980
9516
  title: task?.title ?? call.name,
8981
9517
  status: task?.status ?? null,
8982
9518
  durationText: typeof task?.durationMs === "number" && Number.isFinite(task.durationMs) ? formatDuration(task.durationMs) : null,
8983
9519
  latestStepSummary: task?.status === "running" ? steps.at(-1)?.summary ?? null : null,
8984
- prompt: firstString4(
8985
- stringValue8(task?.prompt),
8986
- stringValue8(call.input?.prompt),
8987
- stringValue8(call.input?.description),
8988
- stringValue8(call.payload?.description)
9520
+ prompt: firstString5(
9521
+ stringValue9(task?.prompt),
9522
+ stringValue9(call.input?.prompt),
9523
+ stringValue9(call.input?.description),
9524
+ stringValue9(call.payload?.description)
8989
9525
  ),
8990
- childSessionId: firstString4(
8991
- stringValue8(task?.delegateSessionId),
8992
- stringValue8(call.metadata?.childSessionID),
8993
- stringValue8(call.metadata?.child_session_id),
8994
- stringValue8(call.metadata?.subagentSessionID),
8995
- stringValue8(call.metadata?.subagent_session_id)
9526
+ childSessionId: firstString5(
9527
+ stringValue9(task?.delegateSessionId),
9528
+ stringValue9(call.metadata?.childSessionID),
9529
+ stringValue9(call.metadata?.child_session_id),
9530
+ stringValue9(call.metadata?.subagentSessionID),
9531
+ stringValue9(call.metadata?.subagent_session_id)
8996
9532
  ),
8997
9533
  steps,
8998
- resultMarkdown: firstString4(
8999
- stringValue8(task?.resultMarkdown),
9534
+ resultMarkdown: firstString5(
9535
+ stringValue9(task?.resultMarkdown),
9000
9536
  firstNonEmptyStructuredText(call.output, outputRawOutput)
9001
9537
  ),
9002
9538
  errorMarkdown: firstNonEmptyStructuredText(call.error, errorRawOutput)
9003
9539
  };
9004
9540
  }
9005
9541
  function getSkillRenderData(call) {
9006
- const inputRawInput = recordValue5(call.input?.rawInput);
9542
+ const inputRawInput = recordValue6(call.input?.rawInput);
9007
9543
  const outputRawOutput = call.output?.rawOutput;
9008
- const success = booleanValue(call.output?.success) ?? legacySkillSuccess(outputRawOutput) ?? booleanValue(recordValue5(outputRawOutput)?.success);
9544
+ const success = booleanValue(call.output?.success) ?? legacySkillSuccess(outputRawOutput) ?? booleanValue(recordValue6(outputRawOutput)?.success);
9009
9545
  return {
9010
- skill: firstString4(
9011
- stringValue8(call.input?.skill),
9012
- stringValue8(inputRawInput?.skill),
9013
- stringValue8(call.output?.commandName),
9014
- stringValue8(recordValue5(outputRawOutput)?.commandName),
9546
+ skill: firstString5(
9547
+ stringValue9(call.input?.skill),
9548
+ stringValue9(inputRawInput?.skill),
9549
+ stringValue9(call.output?.commandName),
9550
+ stringValue9(recordValue6(outputRawOutput)?.commandName),
9015
9551
  nonEmpty(call.summary)
9016
9552
  ),
9017
- args: firstString4(
9018
- stringValue8(call.input?.args),
9019
- stringValue8(inputRawInput?.args)
9553
+ args: firstString5(
9554
+ stringValue9(call.input?.args),
9555
+ stringValue9(inputRawInput?.args)
9020
9556
  ),
9021
9557
  success,
9022
9558
  statusText: success === null ? null : success ? "Skill loaded" : "Failed to load skill"
@@ -9029,7 +9565,7 @@ function getImageGenerationRenderData(call) {
9029
9565
  content: call.content,
9030
9566
  outputContent: call.output?.content,
9031
9567
  inputPrompt: call.input?.prompt,
9032
- payloadInputPrompt: recordValue5(call.payload?.input)?.prompt
9568
+ payloadInputPrompt: recordValue6(call.payload?.input)?.prompt
9033
9569
  });
9034
9570
  return {
9035
9571
  prompt: preview.prompt,
@@ -9061,31 +9597,31 @@ function getToolFallbackText(call) {
9061
9597
  function normalizeTaskStepsFromCall(call) {
9062
9598
  const steps = arrayValue7(call.metadata?.steps) ?? arrayValue7(call.output?.steps) ?? arrayValue7(call.payload?.steps) ?? [];
9063
9599
  return steps.flatMap((value, index) => {
9064
- const step = recordValue5(value);
9600
+ const step = recordValue6(value);
9065
9601
  if (!step) {
9066
9602
  return [];
9067
9603
  }
9068
- const toolName = stringValue8(step.toolName) ?? stringValue8(step.tool_name) ?? stringValue8(step.name) ?? null;
9604
+ const toolName = stringValue9(step.toolName) ?? stringValue9(step.tool_name) ?? stringValue9(step.name) ?? null;
9069
9605
  const name = toolName ? humanizeToolName2(toolName) : `Step ${index + 1}`;
9070
- const status = stringValue8(step.status) ?? stringValue8(recordValue5(step.toolResult)?.status) ?? stringValue8(recordValue5(step.tool_result)?.status) ?? null;
9606
+ const status = stringValue9(step.status) ?? stringValue9(recordValue6(step.toolResult)?.status) ?? stringValue9(recordValue6(step.tool_result)?.status) ?? null;
9071
9607
  const summary = firstNonEmptyStructuredText(
9072
- recordValue5(step.toolResult),
9073
- recordValue5(step.tool_result),
9074
- recordValue5(step.toolInput),
9075
- recordValue5(step.tool_input)
9608
+ recordValue6(step.toolResult),
9609
+ recordValue6(step.tool_result),
9610
+ recordValue6(step.toolInput),
9611
+ recordValue6(step.tool_input)
9076
9612
  ) ?? "";
9077
9613
  return [
9078
9614
  {
9079
- id: stringValue8(step.toolUseId) ?? stringValue8(step.id) ?? `step-${index + 1}`,
9615
+ id: stringValue9(step.toolUseId) ?? stringValue9(step.id) ?? `step-${index + 1}`,
9080
9616
  turnId: call.turnId,
9081
9617
  name,
9082
9618
  toolName,
9083
9619
  status,
9084
9620
  summary,
9085
9621
  payload: {
9086
- input: recordValue5(step.toolInput) ?? recordValue5(step.tool_input),
9087
- output: recordValue5(step.toolResult) ?? recordValue5(step.tool_result),
9088
- error: recordValue5(step.toolError) ?? recordValue5(step.tool_error)
9622
+ input: recordValue6(step.toolInput) ?? recordValue6(step.tool_input),
9623
+ output: recordValue6(step.toolResult) ?? recordValue6(step.tool_result),
9624
+ error: recordValue6(step.toolError) ?? recordValue6(step.tool_error)
9089
9625
  },
9090
9626
  tool: null,
9091
9627
  occurredAtUnixMs: null
@@ -9108,6 +9644,9 @@ function firstNonEmptyStructuredText(...values) {
9108
9644
  function booleanValue(value) {
9109
9645
  return typeof value === "boolean" ? value : null;
9110
9646
  }
9647
+ function formatAgentToolDurationMs(value) {
9648
+ return formatDuration(value);
9649
+ }
9111
9650
  function formatDuration(value) {
9112
9651
  if (value < 1e3) {
9113
9652
  return `${value}ms`;
@@ -9146,7 +9685,7 @@ function normalizeCommandStatus(value) {
9146
9685
  }
9147
9686
  }
9148
9687
  function searchMode(output, outputText) {
9149
- const mode = stringValue8(output?.mode);
9688
+ const mode = stringValue9(output?.mode);
9150
9689
  if (mode === "files_with_matches" || mode === "content" || mode === "count" || mode === "list_files") {
9151
9690
  return mode;
9152
9691
  }
@@ -9169,7 +9708,7 @@ function commandArrayToString(value) {
9169
9708
  return parts.length > 0 ? parts.join(" ") : null;
9170
9709
  }
9171
9710
  function durationToMs(value) {
9172
- const record = recordValue5(value);
9711
+ const record = recordValue6(value);
9173
9712
  if (!record) {
9174
9713
  return null;
9175
9714
  }
@@ -9186,15 +9725,15 @@ function contentText(value) {
9186
9725
  return null;
9187
9726
  }
9188
9727
  const text = items.flatMap((item) => {
9189
- const record = recordValue5(item);
9728
+ const record = recordValue6(item);
9190
9729
  if (!record) {
9191
9730
  return [];
9192
9731
  }
9193
9732
  return [
9194
- firstString4(
9195
- stringValue8(record.text),
9196
- stringValue8(record.content),
9197
- stringValue8(recordValue5(record.content)?.text)
9733
+ firstString5(
9734
+ stringValue9(record.text),
9735
+ stringValue9(record.content),
9736
+ stringValue9(recordValue6(record.content)?.text)
9198
9737
  )
9199
9738
  ].filter(Boolean);
9200
9739
  }).join("\n").trim();
@@ -9207,38 +9746,38 @@ function structuredText(value) {
9207
9746
  if (typeof value === "number" || typeof value === "boolean") {
9208
9747
  return String(value);
9209
9748
  }
9210
- const record = recordValue5(value);
9749
+ const record = recordValue6(value);
9211
9750
  if (!record) {
9212
9751
  return null;
9213
9752
  }
9214
- const preferred = firstString4(
9215
- stringValue8(record.plan),
9216
- stringValue8(record.text),
9217
- stringValue8(record.output),
9218
- stringValue8(record.content),
9753
+ const preferred = firstString5(
9754
+ stringValue9(record.plan),
9755
+ stringValue9(record.text),
9756
+ stringValue9(record.output),
9757
+ stringValue9(record.content),
9219
9758
  contentText(record.content),
9220
- stringValue8(record.summary),
9221
- stringValue8(record.result),
9222
- stringValue8(record.message),
9223
- stringValue8(record.aggregated_output),
9224
- stringValue8(record.formatted_output),
9225
- stringValue8(record.stdout),
9226
- stringValue8(record.stderr),
9227
- stringValue8(record.query),
9228
- stringValue8(record.path),
9229
- stringValue8(record.file),
9230
- stringValue8(record.filePath),
9231
- stringValue8(record.file_path),
9232
- stringValue8(record.url),
9233
- stringValue8(record.cmd),
9234
- stringValue8(record.command)
9759
+ stringValue9(record.summary),
9760
+ stringValue9(record.result),
9761
+ stringValue9(record.message),
9762
+ stringValue9(record.aggregated_output),
9763
+ stringValue9(record.formatted_output),
9764
+ stringValue9(record.stdout),
9765
+ stringValue9(record.stderr),
9766
+ stringValue9(record.query),
9767
+ stringValue9(record.path),
9768
+ stringValue9(record.file),
9769
+ stringValue9(record.filePath),
9770
+ stringValue9(record.file_path),
9771
+ stringValue9(record.url),
9772
+ stringValue9(record.cmd),
9773
+ stringValue9(record.command)
9235
9774
  );
9236
9775
  if (preferred) {
9237
9776
  return preferred;
9238
9777
  }
9239
9778
  return null;
9240
9779
  }
9241
- function firstString4(...values) {
9780
+ function firstString5(...values) {
9242
9781
  for (const value of values) {
9243
9782
  if (typeof value === "string" && value.trim()) {
9244
9783
  return value.trim();
@@ -9257,13 +9796,13 @@ function firstRawString(...values) {
9257
9796
  function nonEmpty(value) {
9258
9797
  return typeof value === "string" && value.trim() ? value.trim() : null;
9259
9798
  }
9260
- function recordValue5(value) {
9799
+ function recordValue6(value) {
9261
9800
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
9262
9801
  }
9263
9802
  function arrayValue7(value) {
9264
9803
  return Array.isArray(value) ? value : null;
9265
9804
  }
9266
- function stringValue8(value) {
9805
+ function stringValue9(value) {
9267
9806
  return typeof value === "string" && value.trim() ? value.trim() : null;
9268
9807
  }
9269
9808
  function rawStringValue(value) {
@@ -9303,15 +9842,15 @@ function locationPaths(value) {
9303
9842
  return [];
9304
9843
  }
9305
9844
  const paths = locations.flatMap((location) => {
9306
- const record = recordValue5(location);
9845
+ const record = recordValue6(location);
9307
9846
  if (!record) {
9308
9847
  return [];
9309
9848
  }
9310
9849
  return [
9311
- firstString4(
9312
- stringValue8(record.path),
9313
- stringValue8(record.filePath),
9314
- stringValue8(record.file_path)
9850
+ firstString5(
9851
+ stringValue9(record.path),
9852
+ stringValue9(record.filePath),
9853
+ stringValue9(record.file_path)
9315
9854
  )
9316
9855
  ].filter((path) => path !== null);
9317
9856
  });
@@ -10286,9 +10825,9 @@ function AgentReadContent({
10286
10825
  call
10287
10826
  }) {
10288
10827
  "use memo";
10289
- const path = stringValue9(call.input?.path) ?? stringValue9(call.input?.file_path) ?? stringValue9(call.input?.filePath) ?? stringValue9(call.input?.file) ?? null;
10828
+ const path = stringValue10(call.input?.path) ?? stringValue10(call.input?.file_path) ?? stringValue10(call.input?.filePath) ?? stringValue10(call.input?.file) ?? null;
10290
10829
  const file = objectValue6(call.output?.file);
10291
- const outputText = stringValue9(call.output?.text) ?? stringValue9(call.output?.output) ?? contentText2(call.output?.content) ?? stringValue9(call.output?.aggregated_output) ?? stringValue9(call.output?.formatted_output) ?? stringValue9(call.output?.stdout) ?? (!file ? call.summary.trim() || null : null);
10830
+ const outputText = stringValue10(call.output?.text) ?? stringValue10(call.output?.output) ?? contentText2(call.output?.content) ?? stringValue10(call.output?.aggregated_output) ?? stringValue10(call.output?.formatted_output) ?? stringValue10(call.output?.stdout) ?? (!file ? call.summary.trim() || null : null);
10292
10831
  const fileLineRange = fileRange(file);
10293
10832
  const fileTotalLines = numericValue(file?.totalLines);
10294
10833
  return /* @__PURE__ */ jsx26("div", { className: "workspace-agents-status-panel__detail-tool-body workspace-agents-status-panel__detail-tool-body--plain", children: outputText ? /* @__PURE__ */ jsx26(
@@ -10333,9 +10872,9 @@ function contentText2(value) {
10333
10872
  const record = item;
10334
10873
  const nestedContent = record.content && typeof record.content === "object" && !Array.isArray(record.content) ? record.content : null;
10335
10874
  return [
10336
- stringValue9(record.text),
10337
- stringValue9(record.content),
10338
- stringValue9(nestedContent?.text)
10875
+ stringValue10(record.text),
10876
+ stringValue10(record.content),
10877
+ stringValue10(nestedContent?.text)
10339
10878
  ].filter((entry) => Boolean(entry));
10340
10879
  }).join("\n").trim();
10341
10880
  return text || null;
@@ -10539,13 +11078,13 @@ function hasWebSearchContent(call) {
10539
11078
  function hasReadContent(call) {
10540
11079
  const file = objectValue6(call.output?.file);
10541
11080
  return Boolean(
10542
- stringValue9(call.output?.text) || stringValue9(call.output?.output) || readContentText(call.output?.content) || stringValue9(call.output?.aggregated_output) || stringValue9(call.output?.formatted_output) || stringValue9(call.output?.stdout) || !file && call.summary.trim() || stringValue9(call.input?.path) || stringValue9(call.input?.file_path) || stringValue9(call.input?.filePath) || stringValue9(call.input?.file) || fileRange(file) || numericValue2(file?.totalLines) !== null
11081
+ stringValue10(call.output?.text) || stringValue10(call.output?.output) || readContentText(call.output?.content) || stringValue10(call.output?.aggregated_output) || stringValue10(call.output?.formatted_output) || stringValue10(call.output?.stdout) || !file && call.summary.trim() || stringValue10(call.input?.path) || stringValue10(call.input?.file_path) || stringValue10(call.input?.filePath) || stringValue10(call.input?.file) || fileRange(file) || numericValue2(file?.totalLines) !== null
10543
11082
  );
10544
11083
  }
10545
11084
  function hasWriteContent(call) {
10546
11085
  const files = getFileChangeRenderData(call);
10547
11086
  return Boolean(
10548
- files.some((file) => file.content || file.unifiedDiff) || files.length === 0 && (call.summary.trim() || stringValue9(call.input?.path) || stringValue9(call.input?.file_path) || stringValue9(call.input?.filePath))
11087
+ files.some((file) => file.content || file.unifiedDiff) || files.length === 0 && (call.summary.trim() || stringValue10(call.input?.path) || stringValue10(call.input?.file_path) || stringValue10(call.input?.filePath))
10549
11088
  );
10550
11089
  }
10551
11090
  function hasEditContent(call) {
@@ -10553,7 +11092,7 @@ function hasEditContent(call) {
10553
11092
  return Boolean(
10554
11093
  files.some(
10555
11094
  (file) => file.unifiedDiff || file.oldString !== null && file.newString !== null || file.content
10556
- ) || files.length === 0 && (stringValue9(call.input?.path) || stringValue9(call.input?.file_path) || stringValue9(call.input?.filePath))
11095
+ ) || files.length === 0 && (stringValue10(call.input?.path) || stringValue10(call.input?.file_path) || stringValue10(call.input?.filePath))
10557
11096
  );
10558
11097
  }
10559
11098
  function readContentText(value) {
@@ -10567,9 +11106,9 @@ function readContentText(value) {
10567
11106
  const record = item;
10568
11107
  const nestedContent = record.content && typeof record.content === "object" && !Array.isArray(record.content) ? record.content : null;
10569
11108
  return [
10570
- stringValue9(record.text),
10571
- stringValue9(record.content),
10572
- stringValue9(nestedContent?.text)
11109
+ stringValue10(record.text),
11110
+ stringValue10(record.content),
11111
+ stringValue10(nestedContent?.text)
10573
11112
  ].filter((entry) => Boolean(entry));
10574
11113
  }).join("\n").trim();
10575
11114
  return text || null;
@@ -10583,7 +11122,7 @@ function objectValue6(value) {
10583
11122
  function arrayValue8(value) {
10584
11123
  return Array.isArray(value) ? value : null;
10585
11124
  }
10586
- function stringValue9(value) {
11125
+ function stringValue10(value) {
10587
11126
  return typeof value === "string" && value.trim() ? value.trim() : null;
10588
11127
  }
10589
11128
  function numericValue2(value) {
@@ -10691,7 +11230,7 @@ function AgentEditContent({
10691
11230
  "use memo";
10692
11231
  const files = getFileChangeRenderData(call);
10693
11232
  const [file] = files;
10694
- const path = file?.path ?? stringValue9(call.input?.path) ?? stringValue9(call.input?.file_path) ?? stringValue9(call.input?.filePath) ?? null;
11233
+ const path = file?.path ?? stringValue10(call.input?.path) ?? stringValue10(call.input?.file_path) ?? stringValue10(call.input?.filePath) ?? null;
10695
11234
  const patchFiles = files.filter((candidate) => candidate.unifiedDiff);
10696
11235
  const diffFiles = files.filter(
10697
11236
  (candidate) => !candidate.unifiedDiff && candidate.oldString !== null && candidate.newString !== null
@@ -10761,7 +11300,7 @@ function approvalPreviewCall(call) {
10761
11300
  return null;
10762
11301
  }
10763
11302
  const normalizedKind = normalizeToolKind(
10764
- stringValue9(toolCall.kind) ?? stringValue9(toolCall.title) ?? stringValue9(toolCall.toolName)
11303
+ stringValue10(toolCall.kind) ?? stringValue10(toolCall.title) ?? stringValue10(toolCall.toolName)
10765
11304
  );
10766
11305
  if (normalizedKind !== "edit" && normalizedKind !== "move") {
10767
11306
  return null;
@@ -10773,10 +11312,10 @@ function approvalPreviewCall(call) {
10773
11312
  kind: "tool-call",
10774
11313
  id: `${call.id}:approval-preview`,
10775
11314
  turnId: call.turnId,
10776
- name: stringValue9(toolCall.title) ?? call.name,
11315
+ name: stringValue10(toolCall.title) ?? call.name,
10777
11316
  toolName: "Edit",
10778
11317
  callType: "tool",
10779
- status: stringValue9(toolCall.status) ?? call.status,
11318
+ status: stringValue10(toolCall.status) ?? call.status,
10780
11319
  statusKind: call.statusKind,
10781
11320
  summary: "",
10782
11321
  compactSummary: null,
@@ -10935,7 +11474,7 @@ function AgentBashContent({
10935
11474
  }) {
10936
11475
  "use memo";
10937
11476
  const commandData = getCommandRenderData(call);
10938
- const fallbackErrorText = commandData.status === "failed" && !commandData.stdout && !commandData.stderr ? stringValue9(call.error?.message) : null;
11477
+ const fallbackErrorText = commandData.status === "failed" && !commandData.stdout && !commandData.stderr ? stringValue10(call.error?.message) : null;
10939
11478
  return /* @__PURE__ */ jsx32("div", { className: "workspace-agents-status-panel__detail-tool-body workspace-agents-status-panel__detail-tool-body--plain", children: /* @__PURE__ */ jsx32(
10940
11479
  AgentTerminalBlock,
10941
11480
  {
@@ -11063,8 +11602,8 @@ function normalizeMcpPayload(call) {
11063
11602
  toolName: call.toolName,
11064
11603
  name: call.name
11065
11604
  });
11066
- const server = target?.server ?? stringValue9(call.metadata?.server) ?? stringValue9(call.metadata?.serverName) ?? stringValue9(call.metadata?.mcpServer) ?? null;
11067
- const tool = target?.tool ?? stringValue9(call.metadata?.tool) ?? stringValue9(call.metadata?.toolName) ?? call.toolName;
11605
+ const server = target?.server ?? stringValue10(call.metadata?.server) ?? stringValue10(call.metadata?.serverName) ?? stringValue10(call.metadata?.mcpServer) ?? null;
11606
+ const tool = target?.tool ?? stringValue10(call.metadata?.tool) ?? stringValue10(call.metadata?.toolName) ?? call.toolName;
11068
11607
  const structured = firstStructuredValue(
11069
11608
  call.output?.structuredContent,
11070
11609
  parseJsonString(call.output?.content),
@@ -11074,19 +11613,19 @@ function normalizeMcpPayload(call) {
11074
11613
  return {
11075
11614
  server,
11076
11615
  tool,
11077
- inputSummary: firstString5(
11078
- stringValue9(call.input?.query),
11079
- stringValue9(call.input?.url),
11080
- stringValue9(call.input?.path),
11081
- stringValue9(call.input?.prompt),
11082
- stringValue9(call.input?.command)
11616
+ inputSummary: firstString6(
11617
+ stringValue10(call.input?.query),
11618
+ stringValue10(call.input?.url),
11619
+ stringValue10(call.input?.path),
11620
+ stringValue10(call.input?.prompt),
11621
+ stringValue10(call.input?.command)
11083
11622
  ),
11084
11623
  structured,
11085
- text: firstString5(
11624
+ text: firstString6(
11086
11625
  contentArrayText(call.output?.content),
11087
- stringValue9(call.output?.content),
11088
- stringValue9(call.output?.output),
11089
- stringValue9(call.output?.stdout)
11626
+ stringValue10(call.output?.content),
11627
+ stringValue10(call.output?.output),
11628
+ stringValue10(call.output?.stdout)
11090
11629
  )
11091
11630
  };
11092
11631
  }
@@ -11121,21 +11660,21 @@ function parsedItems(value) {
11121
11660
  return [];
11122
11661
  }
11123
11662
  function itemPrimaryText(item) {
11124
- return firstString5(
11125
- stringValue9(item.key),
11126
- stringValue9(item.title),
11127
- stringValue9(item.name),
11128
- stringValue9(item.path),
11129
- stringValue9(item.url),
11130
- stringValue9(item.id)
11663
+ return firstString6(
11664
+ stringValue10(item.key),
11665
+ stringValue10(item.title),
11666
+ stringValue10(item.name),
11667
+ stringValue10(item.path),
11668
+ stringValue10(item.url),
11669
+ stringValue10(item.id)
11131
11670
  );
11132
11671
  }
11133
11672
  function itemSecondaryText(item) {
11134
- return firstString5(
11135
- stringValue9(item.summary),
11136
- stringValue9(item.description),
11137
- stringValue9(item.status),
11138
- stringValue9(item.type)
11673
+ return firstString6(
11674
+ stringValue10(item.summary),
11675
+ stringValue10(item.description),
11676
+ stringValue10(item.status),
11677
+ stringValue10(item.type)
11139
11678
  );
11140
11679
  }
11141
11680
  function firstStructuredValue(...values) {
@@ -11170,16 +11709,16 @@ function contentArrayText(value) {
11170
11709
  return [];
11171
11710
  }
11172
11711
  return [
11173
- firstString5(
11174
- stringValue9(record.text),
11175
- stringValue9(record.content),
11176
- stringValue9(objectValue6(record.content)?.text)
11712
+ firstString6(
11713
+ stringValue10(record.text),
11714
+ stringValue10(record.content),
11715
+ stringValue10(objectValue6(record.content)?.text)
11177
11716
  )
11178
11717
  ].filter((candidate) => Boolean(candidate));
11179
11718
  }).join("\n").trim();
11180
11719
  return text || null;
11181
11720
  }
11182
- function firstString5(...values) {
11721
+ function firstString6(...values) {
11183
11722
  for (const value of values) {
11184
11723
  if (value) {
11185
11724
  return value;
@@ -11757,13 +12296,13 @@ function normalizeLinks(value, output) {
11757
12296
  const explicitLinks = arrayValue8(value)?.map(optionRecord).filter(
11758
12297
  (candidate) => candidate !== null
11759
12298
  ).flatMap((link) => {
11760
- const url = stringValue9(link.url);
12299
+ const url = stringValue10(link.url);
11761
12300
  if (!url) {
11762
12301
  return [];
11763
12302
  }
11764
12303
  return [
11765
12304
  {
11766
- title: stringValue9(link.title) ?? url,
12305
+ title: stringValue10(link.title) ?? url,
11767
12306
  url,
11768
12307
  domain: domainForUrl2(url)
11769
12308
  }
@@ -11784,13 +12323,13 @@ function normalizeLinks(value, output) {
11784
12323
  const parsed = JSON.parse(linksJson);
11785
12324
  return parsed.flatMap((entry) => {
11786
12325
  const link = optionRecord(entry);
11787
- const url = stringValue9(link?.url);
12326
+ const url = stringValue10(link?.url);
11788
12327
  if (!url) {
11789
12328
  return [];
11790
12329
  }
11791
12330
  return [
11792
12331
  {
11793
- title: stringValue9(link?.title) ?? url,
12332
+ title: stringValue10(link?.title) ?? url,
11794
12333
  url,
11795
12334
  domain: domainForUrl2(url)
11796
12335
  }
@@ -11837,7 +12376,7 @@ function AgentWriteContent({
11837
12376
  "use memo";
11838
12377
  const files = getFileChangeRenderData(call);
11839
12378
  const [file] = files;
11840
- const path = file?.path ?? stringValue9(call.input?.path) ?? stringValue9(call.input?.file_path) ?? stringValue9(call.input?.filePath) ?? null;
12379
+ const path = file?.path ?? stringValue10(call.input?.path) ?? stringValue10(call.input?.file_path) ?? stringValue10(call.input?.filePath) ?? null;
11841
12380
  const contentFiles = files.filter((candidate) => candidate.content);
11842
12381
  const contentPaths = new Set(contentFiles.map((candidate) => candidate.path));
11843
12382
  const patchFiles = files.filter(
@@ -12101,9 +12640,197 @@ function taskCallAriaLabel(call) {
12101
12640
  ].filter(Boolean).join(" ");
12102
12641
  }
12103
12642
 
12643
+ // shared/agentConversation/components/AgentSubAgentCards.tsx
12644
+ import { memo, useState as useState14 } from "react";
12645
+ import { AlertCircle as AlertCircle2, ChevronDown as ChevronDown6, ChevronRight as ChevronRight6 } from "lucide-react";
12646
+
12647
+ // app/renderer/components/icons/AgentLinedIcon.tsx
12648
+ import { jsx as jsx52 } from "react/jsx-runtime";
12649
+ function AgentLinedIcon(props) {
12650
+ "use memo";
12651
+ return /* @__PURE__ */ jsx52(
12652
+ "svg",
12653
+ {
12654
+ viewBox: "0 0 24 24",
12655
+ fill: "none",
12656
+ xmlns: "http://www.w3.org/2000/svg",
12657
+ ...props,
12658
+ children: /* @__PURE__ */ jsx52(
12659
+ "path",
12660
+ {
12661
+ d: "M12 3C12.5523 3 13 3.44772 13 4V7H18C19.6569 7 21 8.34315 21 10V13H22C22.5523 13 23 13.4477 23 14C23 14.5523 22.5523 15 22 15H21V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V15H2C1.44772 15 1 14.5523 1 14C1 13.4477 1.44772 13 2 13H3V10C3 8.34315 4.34315 7 6 7H11V5H8C7.44772 5 7 4.55228 7 4C7 3.44772 7.44772 3 8 3H12ZM6 9C5.44772 9 5 9.44772 5 10V18C5 18.5523 5.44772 19 6 19H18C18.5523 19 19 18.5523 19 18V10C19 9.44772 18.5523 9 18 9H6ZM9 12C9.55229 12 10 12.4477 10 13V15C10 15.5523 9.55229 16 9 16C8.44772 16 8 15.5523 8 15V13C8 12.4477 8.44772 12 9 12ZM15 12C15.5523 12 16 12.4477 16 13V15C16 15.5523 15.5523 16 15 16C14.4477 16 14 15.5523 14 15V13C14 12.4477 14.4477 12 15 12Z",
12662
+ fill: "currentColor"
12663
+ }
12664
+ )
12665
+ }
12666
+ );
12667
+ }
12668
+
12669
+ // shared/agentConversation/components/AgentSubAgentCards.tsx
12670
+ import { Fragment as Fragment5, jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
12671
+ function AgentSubAgentCards({
12672
+ call,
12673
+ onLinkClick
12674
+ }) {
12675
+ "use memo";
12676
+ const subAgents = call.task?.subAgents ?? [];
12677
+ if (subAgents.length === 0) {
12678
+ return null;
12679
+ }
12680
+ return /* @__PURE__ */ jsx53(Fragment5, { children: subAgents.map((subAgent) => /* @__PURE__ */ jsx53(
12681
+ AgentSubAgentCard,
12682
+ {
12683
+ subAgent,
12684
+ onLinkClick
12685
+ },
12686
+ subAgent.ownerThreadId
12687
+ )) });
12688
+ }
12689
+ var AgentSubAgentCard = memo(
12690
+ AgentSubAgentCardImpl,
12691
+ (prev, next) => prev.onLinkClick === next.onLinkClick && subAgentVMEquals(prev.subAgent, next.subAgent)
12692
+ );
12693
+ function subAgentVMEquals(left, right) {
12694
+ return left.ownerThreadId === right.ownerThreadId && left.status === right.status && left.name === right.name && left.task === right.task && left.laneIndex === right.laneIndex && left.laneCount === right.laneCount && left.latestActivity === right.latestActivity && left.failureDetail === right.failureDetail && left.queued === right.queued && left.startedAtUnixMs === right.startedAtUnixMs && left.latestActivityAtUnixMs === right.latestActivityAtUnixMs && left.terminalAtUnixMs === right.terminalAtUnixMs;
12695
+ }
12696
+ function AgentSubAgentCardImpl({
12697
+ subAgent,
12698
+ onLinkClick
12699
+ }) {
12700
+ "use memo";
12701
+ const [expanded, setExpanded] = useState14(subAgent.status === "running");
12702
+ return /* @__PURE__ */ jsxs40(
12703
+ "div",
12704
+ {
12705
+ className: "workspace-agents-status-panel__detail-tool-row workspace-agents-status-panel__detail-tool-row--subagent",
12706
+ "data-status": subAgent.status,
12707
+ children: [
12708
+ /* @__PURE__ */ jsx53(
12709
+ "button",
12710
+ {
12711
+ type: "button",
12712
+ className: "workspace-agents-status-panel__detail-tool-row-head workspace-agents-status-panel__detail-tool-row-head--button",
12713
+ "aria-expanded": expanded,
12714
+ "aria-label": subAgentAriaLabel(subAgent),
12715
+ onClick: () => setExpanded((value) => !value),
12716
+ children: /* @__PURE__ */ jsx53(SubAgentHeader, { subAgent, expanded })
12717
+ }
12718
+ ),
12719
+ /* @__PURE__ */ jsx53(CollapsibleReveal, { expanded, children: /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-subagent-reveal", children: /* @__PURE__ */ jsx53(SubAgentBody, { subAgent, onLinkClick }) }) })
12720
+ ]
12721
+ }
12722
+ );
12723
+ }
12724
+ function SubAgentHeader({
12725
+ subAgent,
12726
+ expanded
12727
+ }) {
12728
+ "use memo";
12729
+ const running = subAgent.status === "running";
12730
+ const statusLabel = subAgentStatusLabel(subAgent.status);
12731
+ const elapsedText = subAgentElapsedText(subAgent);
12732
+ const nameText = subAgentNameText(subAgent);
12733
+ return /* @__PURE__ */ jsxs40(
12734
+ "div",
12735
+ {
12736
+ "data-active": running ? "true" : void 0,
12737
+ className: [
12738
+ "workspace-agents-status-panel__detail-tool-row-header-content",
12739
+ running ? "tsh-inline-scanlight-group" : ""
12740
+ ].filter(Boolean).join(" "),
12741
+ children: [
12742
+ /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-row-icon tsh-inline-scanlight-icon", children: subAgent.status === "failed" ? /* @__PURE__ */ jsx53(AlertCircle2, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ jsx53(AgentLinedIcon, { width: 16, height: 16, "aria-hidden": "true" }) }),
12743
+ /* @__PURE__ */ jsxs40("div", { className: "workspace-agents-status-panel__detail-tool-row-text", children: [
12744
+ /* @__PURE__ */ jsx53("strong", { className: "workspace-agents-status-panel__detail-tool-row-title", children: translate("agentHost.agentTool.details.subAgentFallbackName") }),
12745
+ nameText ? /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-subagent-name", children: nameText }) : null,
12746
+ /* @__PURE__ */ jsxs40("span", { className: "workspace-agents-status-panel__detail-tool-status", children: [
12747
+ elapsedText ? `${elapsedText} \xB7 ` : "",
12748
+ statusLabel
12749
+ ] })
12750
+ ] }),
12751
+ expanded ? /* @__PURE__ */ jsx53(
12752
+ ChevronDown6,
12753
+ {
12754
+ size: 12,
12755
+ strokeWidth: 2.2,
12756
+ "aria-hidden": "true",
12757
+ className: "workspace-agents-status-panel__detail-tool-row-chevron"
12758
+ }
12759
+ ) : /* @__PURE__ */ jsx53(
12760
+ ChevronRight6,
12761
+ {
12762
+ size: 12,
12763
+ strokeWidth: 2.2,
12764
+ "aria-hidden": "true",
12765
+ className: "workspace-agents-status-panel__detail-tool-row-chevron"
12766
+ }
12767
+ )
12768
+ ]
12769
+ }
12770
+ );
12771
+ }
12772
+ function SubAgentBody({
12773
+ subAgent
12774
+ }) {
12775
+ "use memo";
12776
+ return /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-body workspace-agents-status-panel__detail-tool-body--plain", children: /* @__PURE__ */ jsxs40("div", { className: "workspace-agents-status-panel__detail-subagent-terminal", children: [
12777
+ subAgent.task ? /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-subagent-task-strip", children: subAgent.task }) : null,
12778
+ /* @__PURE__ */ jsx53(SubAgentProgress, { subAgent })
12779
+ ] }) });
12780
+ }
12781
+ function SubAgentProgress({
12782
+ subAgent
12783
+ }) {
12784
+ "use memo";
12785
+ const text = subAgent.failureDetail ?? subAgent.latestActivity ?? translate(
12786
+ subAgent.queued ? "agentHost.agentTool.details.subAgentQueued" : "agentHost.agentTool.details.subAgentStarting"
12787
+ );
12788
+ return /* @__PURE__ */ jsx53(
12789
+ "div",
12790
+ {
12791
+ className: `workspace-agents-status-panel__detail-subagent-activity workspace-agents-status-panel__detail-subagent-activity--in-terminal${subAgent.failureDetail ? " workspace-agents-status-panel__detail-subagent-activity--failure" : ""}`,
12792
+ children: text
12793
+ }
12794
+ );
12795
+ }
12796
+ function subAgentNameText(subAgent) {
12797
+ if (subAgent.name) {
12798
+ return subAgent.name;
12799
+ }
12800
+ return subAgent.laneCount > 1 ? `#${subAgent.laneIndex}` : null;
12801
+ }
12802
+ function subAgentAriaLabel(subAgent) {
12803
+ return [
12804
+ translate("agentHost.agentTool.details.subAgentFallbackName"),
12805
+ subAgentNameText(subAgent),
12806
+ subAgentStatusLabel(subAgent.status)
12807
+ ].filter(Boolean).join(" ");
12808
+ }
12809
+ function subAgentStatusLabel(status) {
12810
+ switch (status) {
12811
+ case "completed":
12812
+ return translate("agentHost.agentTool.statusCompleted");
12813
+ case "failed":
12814
+ return translate("agentHost.agentTool.statusFailed");
12815
+ case "canceled":
12816
+ return translate("agentHost.agentTool.statusCanceled");
12817
+ case "running":
12818
+ default:
12819
+ return translate("agentHost.agentTool.statusWorking");
12820
+ }
12821
+ }
12822
+ function subAgentElapsedText(subAgent) {
12823
+ const started = subAgent.startedAtUnixMs;
12824
+ const latest = subAgent.latestActivityAtUnixMs;
12825
+ if (typeof started !== "number" || typeof latest !== "number" || latest <= started) {
12826
+ return null;
12827
+ }
12828
+ return formatAgentToolDurationMs(latest - started);
12829
+ }
12830
+
12104
12831
  // shared/agentConversation/components/AgentToolCallCard.tsx
12105
- import { useState as useState14 } from "react";
12106
- import { jsx as jsx52, jsxs as jsxs40 } from "react/jsx-runtime";
12832
+ import { useState as useState15 } from "react";
12833
+ import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
12107
12834
  function AgentToolCallCard({
12108
12835
  call,
12109
12836
  onLinkClick,
@@ -12113,11 +12840,11 @@ function AgentToolCallCard({
12113
12840
  variantClassName
12114
12841
  }) {
12115
12842
  "use memo";
12116
- const [expanded, setExpanded] = useState14(defaultExpanded);
12843
+ const [expanded, setExpanded] = useState15(defaultExpanded);
12117
12844
  const hasDetail = hasAgentToolContent(call);
12118
12845
  const canCollapse = hasDetail && !nonCollapsible;
12119
12846
  const ariaLabel = toolCallAriaLabel(call);
12120
- return /* @__PURE__ */ jsxs40(
12847
+ return /* @__PURE__ */ jsxs41(
12121
12848
  "div",
12122
12849
  {
12123
12850
  className: [
@@ -12125,7 +12852,7 @@ function AgentToolCallCard({
12125
12852
  variantClassName ?? ""
12126
12853
  ].filter(Boolean).join(" "),
12127
12854
  children: [
12128
- canCollapse ? /* @__PURE__ */ jsx52(
12855
+ canCollapse ? /* @__PURE__ */ jsx54(
12129
12856
  "button",
12130
12857
  {
12131
12858
  type: "button",
@@ -12133,10 +12860,10 @@ function AgentToolCallCard({
12133
12860
  "aria-expanded": expanded,
12134
12861
  "aria-label": ariaLabel,
12135
12862
  onClick: () => setExpanded((value) => !value),
12136
- children: /* @__PURE__ */ jsx52(AgentToolCallHeader, { call, expanded, hasDetail: true })
12863
+ children: /* @__PURE__ */ jsx54(AgentToolCallHeader, { call, expanded, hasDetail: true })
12137
12864
  }
12138
- ) : /* @__PURE__ */ jsx52("div", { className: "workspace-agents-status-panel__detail-tool-row-head", children: /* @__PURE__ */ jsx52(AgentToolCallHeader, { call, expanded: false, hasDetail: false }) }),
12139
- hasDetail && nonCollapsible ? /* @__PURE__ */ jsx52(
12865
+ ) : /* @__PURE__ */ jsx54("div", { className: "workspace-agents-status-panel__detail-tool-row-head", children: /* @__PURE__ */ jsx54(AgentToolCallHeader, { call, expanded: false, hasDetail: false }) }),
12866
+ hasDetail && nonCollapsible ? /* @__PURE__ */ jsx54(
12140
12867
  AgentExpandedToolContent,
12141
12868
  {
12142
12869
  call,
@@ -12144,7 +12871,7 @@ function AgentToolCallCard({
12144
12871
  previewMode
12145
12872
  }
12146
12873
  ) : null,
12147
- hasDetail && !nonCollapsible ? /* @__PURE__ */ jsx52(CollapsibleReveal, { expanded, children: /* @__PURE__ */ jsx52(
12874
+ hasDetail && !nonCollapsible ? /* @__PURE__ */ jsx54(CollapsibleReveal, { expanded, children: /* @__PURE__ */ jsx54(
12148
12875
  AgentExpandedToolContent,
12149
12876
  {
12150
12877
  call,
@@ -12165,8 +12892,8 @@ function toolCallAriaLabel(call) {
12165
12892
  }
12166
12893
 
12167
12894
  // shared/agentConversation/components/AgentToolGroupRow.tsx
12168
- import { Fragment as Fragment5, jsx as jsx53, jsxs as jsxs41 } from "react/jsx-runtime";
12169
- var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12895
+ import { Fragment as Fragment6, jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
12896
+ var AgentToolGroupRow = memo2(function AgentToolGroupRow2({
12170
12897
  row,
12171
12898
  label,
12172
12899
  thinkingLabel,
@@ -12179,7 +12906,7 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12179
12906
  rawTimelineJsonLabel = ""
12180
12907
  }) {
12181
12908
  "use memo";
12182
- const [localExpanded, setLocalExpanded] = useState15(false);
12909
+ const [localExpanded, setLocalExpanded] = useState16(false);
12183
12910
  const hasDetail = hasGroupDetail(row);
12184
12911
  const isExpanded = hasDetail && (expanded ?? localExpanded);
12185
12912
  const setNextExpanded = (nextExpanded) => {
@@ -12201,13 +12928,13 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12201
12928
  rawTimelineJsonLabel
12202
12929
  );
12203
12930
  }
12204
- return /* @__PURE__ */ jsxs41(
12931
+ return /* @__PURE__ */ jsxs42(
12205
12932
  "div",
12206
12933
  {
12207
12934
  className: "workspace-agents-status-panel__detail-tool-section",
12208
12935
  "data-tool-group-expanded": isExpanded ? "true" : void 0,
12209
12936
  children: [
12210
- hasDetail ? /* @__PURE__ */ jsxs41(
12937
+ hasDetail ? /* @__PURE__ */ jsxs42(
12211
12938
  "button",
12212
12939
  {
12213
12940
  type: "button",
@@ -12216,17 +12943,17 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12216
12943
  "aria-label": groupLabel,
12217
12944
  onClick: () => setNextExpanded(!isExpanded),
12218
12945
  children: [
12219
- /* @__PURE__ */ jsx53(ToolGroupLabel, { label: groupLabel }),
12220
- isExpanded ? /* @__PURE__ */ jsx53(
12221
- ChevronDown6,
12946
+ /* @__PURE__ */ jsx55(ToolGroupLabel, { label: groupLabel }),
12947
+ isExpanded ? /* @__PURE__ */ jsx55(
12948
+ ChevronDown7,
12222
12949
  {
12223
12950
  size: 12,
12224
12951
  strokeWidth: 2.2,
12225
12952
  "aria-hidden": "true",
12226
12953
  className: "workspace-agents-status-panel__detail-tool-count-chevron"
12227
12954
  }
12228
- ) : /* @__PURE__ */ jsx53(
12229
- ChevronRight6,
12955
+ ) : /* @__PURE__ */ jsx55(
12956
+ ChevronRight7,
12230
12957
  {
12231
12958
  size: 12,
12232
12959
  strokeWidth: 2.2,
@@ -12236,13 +12963,13 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12236
12963
  )
12237
12964
  ]
12238
12965
  }
12239
- ) : /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-count", children: /* @__PURE__ */ jsx53(ToolGroupLabel, { label: groupLabel }) }),
12240
- hasDetail ? /* @__PURE__ */ jsx53(CollapsibleReveal, { expanded: isExpanded, children: /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-list", children: row.entries.map(
12241
- (entry) => entry.kind === "thinking" ? /* @__PURE__ */ jsx53(
12966
+ ) : /* @__PURE__ */ jsx55("div", { className: "workspace-agents-status-panel__detail-tool-count", children: /* @__PURE__ */ jsx55(ToolGroupLabel, { label: groupLabel }) }),
12967
+ hasDetail ? /* @__PURE__ */ jsx55(CollapsibleReveal, { expanded: isExpanded, children: /* @__PURE__ */ jsx55("div", { className: "workspace-agents-status-panel__detail-tool-list", children: row.entries.map(
12968
+ (entry) => entry.kind === "thinking" ? /* @__PURE__ */ jsx55(
12242
12969
  "div",
12243
12970
  {
12244
12971
  className: "workspace-agents-status-panel__detail-tool-list-item workspace-agents-status-panel__detail-tool-row",
12245
- children: /* @__PURE__ */ jsx53(
12972
+ children: /* @__PURE__ */ jsx55(
12246
12973
  AgentThinkingDisclosure,
12247
12974
  {
12248
12975
  thinking: entry.thinking,
@@ -12255,7 +12982,7 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12255
12982
  )
12256
12983
  },
12257
12984
  entry.thinking.id
12258
- ) : /* @__PURE__ */ jsx53(
12985
+ ) : /* @__PURE__ */ jsx55(
12259
12986
  "div",
12260
12987
  {
12261
12988
  className: "workspace-agents-status-panel__detail-tool-list-item",
@@ -12276,8 +13003,8 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12276
13003
  });
12277
13004
  function ToolGroupLabel({ label }) {
12278
13005
  "use memo";
12279
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
12280
- /* @__PURE__ */ jsx53(
13006
+ return /* @__PURE__ */ jsxs42(Fragment6, { children: [
13007
+ /* @__PURE__ */ jsx55(
12281
13008
  ToolActivityKindIcon,
12282
13009
  {
12283
13010
  kind: "update_todos",
@@ -12286,7 +13013,7 @@ function ToolGroupLabel({ label }) {
12286
13013
  className: "workspace-agents-status-panel__detail-tool-count-icon"
12287
13014
  }
12288
13015
  ),
12289
- /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-tool-count-label", children: renderToolCountLabel(label) })
13016
+ /* @__PURE__ */ jsx55("span", { className: "workspace-agents-status-panel__detail-tool-count-label", children: renderToolCountLabel(label) })
12290
13017
  ] });
12291
13018
  }
12292
13019
  function hasGroupDetail(row) {
@@ -12299,11 +13026,11 @@ function renderToolCountLabel(label) {
12299
13026
  const primary = statusMatch?.[1];
12300
13027
  const status = statusMatch?.[2];
12301
13028
  if (!primary || !status) {
12302
- return /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-tool-count-primary", children: label });
13029
+ return /* @__PURE__ */ jsx55("span", { className: "workspace-agents-status-panel__detail-tool-count-primary", children: label });
12303
13030
  }
12304
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
12305
- /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-tool-count-primary", children: primary }),
12306
- /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-tool-count-status", children: formatInlineStatusLabel3(status) })
13031
+ return /* @__PURE__ */ jsxs42(Fragment6, { children: [
13032
+ /* @__PURE__ */ jsx55("span", { className: "workspace-agents-status-panel__detail-tool-count-primary", children: primary }),
13033
+ /* @__PURE__ */ jsx55("span", { className: "workspace-agents-status-panel__detail-tool-count-status", children: formatInlineStatusLabel3(status) })
12307
13034
  ] });
12308
13035
  }
12309
13036
  function formatInlineStatusLabel3(label) {
@@ -12311,26 +13038,29 @@ function formatInlineStatusLabel3(label) {
12311
13038
  }
12312
13039
  function renderToolCard(call, onLinkClick, previewMode = false, showRawTimelineJson = false, rawTimelineJsonLabel = "") {
12313
13040
  const props = { call, onLinkClick, previewMode };
13041
+ if (call.task?.subAgents?.length) {
13042
+ return /* @__PURE__ */ jsx55(AgentSubAgentCards, { call, onLinkClick });
13043
+ }
12314
13044
  let card;
12315
13045
  switch (call.rendererKind) {
12316
13046
  case "plan-enter":
12317
- card = /* @__PURE__ */ jsx53(AgentEnterPlanModeCard, { ...props });
13047
+ card = /* @__PURE__ */ jsx55(AgentEnterPlanModeCard, { ...props });
12318
13048
  break;
12319
13049
  case "plan-exit":
12320
- card = /* @__PURE__ */ jsx53(AgentExitPlanModeCard, { ...props });
13050
+ card = /* @__PURE__ */ jsx55(AgentExitPlanModeCard, { ...props });
12321
13051
  break;
12322
13052
  case "ask-user":
12323
- card = /* @__PURE__ */ jsx53(AgentAskUserQuestionCard, { ...props });
13053
+ card = /* @__PURE__ */ jsx55(AgentAskUserQuestionCard, { ...props });
12324
13054
  break;
12325
13055
  case "task":
12326
- card = /* @__PURE__ */ jsx53(AgentTaskCallCard, { ...props });
13056
+ card = /* @__PURE__ */ jsx55(AgentTaskCallCard, { ...props });
12327
13057
  break;
12328
13058
  default:
12329
- card = /* @__PURE__ */ jsx53(AgentToolCallCard, { ...props });
13059
+ card = /* @__PURE__ */ jsx55(AgentToolCallCard, { ...props });
12330
13060
  }
12331
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
13061
+ return /* @__PURE__ */ jsxs42(Fragment6, { children: [
12332
13062
  card,
12333
- showRawTimelineJson && rawTimelineJsonLabel ? /* @__PURE__ */ jsx53(
13063
+ showRawTimelineJson && rawTimelineJsonLabel ? /* @__PURE__ */ jsx55(
12334
13064
  RawTimelineJsonDisclosure,
12335
13065
  {
12336
13066
  items: call.sourceTimelineItems,
@@ -12341,10 +13071,10 @@ function renderToolCard(call, onLinkClick, previewMode = false, showRawTimelineJ
12341
13071
  }
12342
13072
 
12343
13073
  // shared/agentConversation/components/AgentTurnSummaryRow.tsx
12344
- import { useEffect as useEffect10, useMemo as useMemo5, useState as useState16 } from "react";
13074
+ import { useEffect as useEffect10, useMemo as useMemo5, useState as useState17 } from "react";
12345
13075
  import {
12346
- ChevronDown as ChevronDown7,
12347
- ChevronRight as ChevronRight7,
13076
+ ChevronDown as ChevronDown8,
13077
+ ChevronRight as ChevronRight8,
12348
13078
  LoaderCircle as LoaderCircle2,
12349
13079
  Redo2,
12350
13080
  Undo2
@@ -12358,10 +13088,10 @@ import {
12358
13088
  } from "@tutti-os/ui-system";
12359
13089
 
12360
13090
  // app/renderer/components/icons/DirectLinedIcon.tsx
12361
- import { jsx as jsx54 } from "react/jsx-runtime";
13091
+ import { jsx as jsx56 } from "react/jsx-runtime";
12362
13092
  function DirectLinedIcon(props) {
12363
13093
  "use memo";
12364
- return /* @__PURE__ */ jsx54(
13094
+ return /* @__PURE__ */ jsx56(
12365
13095
  "svg",
12366
13096
  {
12367
13097
  xmlns: "http://www.w3.org/2000/svg",
@@ -12371,7 +13101,7 @@ function DirectLinedIcon(props) {
12371
13101
  "data-nexight-chrome-glyph": "fill",
12372
13102
  "data-tutti-chrome-glyph": "fill",
12373
13103
  ...props,
12374
- children: /* @__PURE__ */ jsx54(
13104
+ children: /* @__PURE__ */ jsx56(
12375
13105
  "path",
12376
13106
  {
12377
13107
  fill: "currentColor",
@@ -12572,20 +13302,20 @@ function isInsideOrEqualPatchPath(path, root) {
12572
13302
  }
12573
13303
 
12574
13304
  // shared/agentConversation/components/AgentTurnSummaryRow.tsx
12575
- import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
13305
+ import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
12576
13306
  function AgentTurnSummaryRow({
12577
13307
  row,
12578
13308
  workspaceRoot,
12579
13309
  onLinkAction
12580
13310
  }) {
12581
13311
  "use memo";
12582
- const [expandedFiles, setExpandedFiles] = useState16(
13312
+ const [expandedFiles, setExpandedFiles] = useState17(
12583
13313
  {}
12584
13314
  );
12585
- const [showAllFiles, setShowAllFiles] = useState16(false);
12586
- const [patchAction, setPatchAction] = useState16("undo");
12587
- const [patchPending, setPatchPending] = useState16(false);
12588
- const [patchSupportState, setPatchSupportState] = useState16(null);
13315
+ const [showAllFiles, setShowAllFiles] = useState17(false);
13316
+ const [patchAction, setPatchAction] = useState17("undo");
13317
+ const [patchPending, setPatchPending] = useState17(false);
13318
+ const [patchSupportState, setPatchSupportState] = useState17(null);
12589
13319
  const agentHostApi = useOptionalAgentHostApi();
12590
13320
  const aggregateStats = useMemo5(
12591
13321
  () => summarizeRowDiff(row.files),
@@ -12714,29 +13444,29 @@ function AgentTurnSummaryRow({
12714
13444
  }
12715
13445
  }
12716
13446
  };
12717
- return /* @__PURE__ */ jsx55("section", { className: "workspace-agents-status-panel__detail-turn-summary", children: /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card w-full overflow-hidden rounded-[8px] text-[var(--text-primary)]", children: [
12718
- /* @__PURE__ */ jsxs42("div", { className: "flex items-start gap-3 px-4 py-3", children: [
12719
- /* @__PURE__ */ jsx55("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 items-center gap-3", children: [
12720
- /* @__PURE__ */ jsx55("div", { className: "min-w-0 text-[15px] font-semibold leading-5 tracking-[0] text-[var(--text-primary)]", children: translate("agentHost.agentGui.turnSummaryFilesChanged", {
13447
+ return /* @__PURE__ */ jsx57("section", { className: "workspace-agents-status-panel__detail-turn-summary", children: /* @__PURE__ */ jsxs43("div", { className: "agent-turn-summary-card w-full overflow-hidden rounded-[8px] text-[var(--text-primary)]", children: [
13448
+ /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3 px-4 py-3", children: [
13449
+ /* @__PURE__ */ jsx57("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs43("div", { className: "flex min-w-0 items-center gap-3", children: [
13450
+ /* @__PURE__ */ jsx57("div", { className: "min-w-0 text-[15px] font-semibold leading-5 tracking-[0] text-[var(--text-primary)]", children: translate("agentHost.agentGui.turnSummaryFilesChanged", {
12721
13451
  count: row.fileCount
12722
13452
  }) }),
12723
- /* @__PURE__ */ jsxs42("div", { className: "inline-flex shrink-0 items-center gap-2.5 text-[11px] font-semibold", children: [
12724
- aggregateStats.added > 0 ? /* @__PURE__ */ jsxs42("span", { className: "workspace-agents-status-panel__detail-tool-diff-added", children: [
13453
+ /* @__PURE__ */ jsxs43("div", { className: "inline-flex shrink-0 items-center gap-2.5 text-[11px] font-semibold", children: [
13454
+ aggregateStats.added > 0 ? /* @__PURE__ */ jsxs43("span", { className: "workspace-agents-status-panel__detail-tool-diff-added", children: [
12725
13455
  "+",
12726
13456
  aggregateStats.added
12727
13457
  ] }) : null,
12728
- aggregateStats.removed > 0 ? /* @__PURE__ */ jsxs42("span", { className: "workspace-agents-status-panel__detail-tool-diff-removed", children: [
13458
+ aggregateStats.removed > 0 ? /* @__PURE__ */ jsxs43("span", { className: "workspace-agents-status-panel__detail-tool-diff-removed", children: [
12729
13459
  "-",
12730
13460
  aggregateStats.removed
12731
13461
  ] }) : null
12732
13462
  ] })
12733
13463
  ] }) }),
12734
- canRenderPatchButton ? /* @__PURE__ */ jsx55(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs42(Tooltip, { children: [
12735
- /* @__PURE__ */ jsx55(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx55(
13464
+ canRenderPatchButton ? /* @__PURE__ */ jsx57(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs43(Tooltip, { children: [
13465
+ /* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
12736
13466
  "span",
12737
13467
  {
12738
13468
  className: `inline-flex shrink-0 ${isPatchActionDisabled ? "cursor-not-allowed" : ""}`,
12739
- children: /* @__PURE__ */ jsxs42(
13469
+ children: /* @__PURE__ */ jsxs43(
12740
13470
  CanvasNodeGhostIconButton,
12741
13471
  {
12742
13472
  "aria-label": patchActionLabel,
@@ -12744,7 +13474,7 @@ function AgentTurnSummaryRow({
12744
13474
  disabled: isPatchActionDisabled,
12745
13475
  onClick: handlePatchAction,
12746
13476
  children: [
12747
- patchPending || isPatchSupportChecking ? /* @__PURE__ */ jsx55(
13477
+ patchPending || isPatchSupportChecking ? /* @__PURE__ */ jsx57(
12748
13478
  LoaderCircle2,
12749
13479
  {
12750
13480
  width: 14,
@@ -12752,7 +13482,7 @@ function AgentTurnSummaryRow({
12752
13482
  "aria-hidden": "true",
12753
13483
  className: "animate-spin text-[var(--text-secondary)]"
12754
13484
  }
12755
- ) : patchAction === "undo" ? /* @__PURE__ */ jsx55(
13485
+ ) : patchAction === "undo" ? /* @__PURE__ */ jsx57(
12756
13486
  Undo2,
12757
13487
  {
12758
13488
  width: 14,
@@ -12760,7 +13490,7 @@ function AgentTurnSummaryRow({
12760
13490
  "aria-hidden": "true",
12761
13491
  className: "text-[var(--text-secondary)]"
12762
13492
  }
12763
- ) : /* @__PURE__ */ jsx55(
13493
+ ) : /* @__PURE__ */ jsx57(
12764
13494
  Redo2,
12765
13495
  {
12766
13496
  width: 14,
@@ -12769,19 +13499,19 @@ function AgentTurnSummaryRow({
12769
13499
  className: "text-[var(--text-secondary)]"
12770
13500
  }
12771
13501
  ),
12772
- /* @__PURE__ */ jsx55("span", { children: patchActionLabel })
13502
+ /* @__PURE__ */ jsx57("span", { children: patchActionLabel })
12773
13503
  ]
12774
13504
  }
12775
13505
  )
12776
13506
  }
12777
13507
  ) }),
12778
- patchDisabledReason ? /* @__PURE__ */ jsx55(TooltipContent, { className: "max-w-[260px] whitespace-normal text-left", children: patchDisabledReason }) : null
13508
+ patchDisabledReason ? /* @__PURE__ */ jsx57(TooltipContent, { className: "max-w-[260px] whitespace-normal text-left", children: patchDisabledReason }) : null
12779
13509
  ] }) }) : null
12780
13510
  ] }),
12781
- /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card__list", children: [
13511
+ /* @__PURE__ */ jsxs43("div", { className: "agent-turn-summary-card__list", children: [
12782
13512
  visibleFiles.map((file) => {
12783
13513
  const key = `${file.path}:${file.messageId}`;
12784
- return /* @__PURE__ */ jsx55(
13514
+ return /* @__PURE__ */ jsx57(
12785
13515
  TurnSummaryFileCard,
12786
13516
  {
12787
13517
  file,
@@ -12796,9 +13526,9 @@ function AgentTurnSummaryRow({
12796
13526
  key
12797
13527
  );
12798
13528
  }),
12799
- hiddenFileCount > 0 ? /* @__PURE__ */ jsx55(CollapsibleReveal, { expanded: showAllFiles, preMountOnIdle: true, children: /* @__PURE__ */ jsx55("div", { className: "agent-turn-summary-card__overflow-list", children: hiddenFiles.map((file) => {
13529
+ hiddenFileCount > 0 ? /* @__PURE__ */ jsx57(CollapsibleReveal, { expanded: showAllFiles, preMountOnIdle: true, children: /* @__PURE__ */ jsx57("div", { className: "agent-turn-summary-card__overflow-list", children: hiddenFiles.map((file) => {
12800
13530
  const key = `${file.path}:${file.messageId}`;
12801
- return /* @__PURE__ */ jsx55(
13531
+ return /* @__PURE__ */ jsx57(
12802
13532
  TurnSummaryFileCard,
12803
13533
  {
12804
13534
  file,
@@ -12813,29 +13543,29 @@ function AgentTurnSummaryRow({
12813
13543
  key
12814
13544
  );
12815
13545
  }) }) }) : null,
12816
- hiddenFileCount > 0 && !showAllFiles ? /* @__PURE__ */ jsxs42(
13546
+ hiddenFileCount > 0 && !showAllFiles ? /* @__PURE__ */ jsxs43(
12817
13547
  "button",
12818
13548
  {
12819
13549
  type: "button",
12820
13550
  className: "agent-turn-summary-card__toggle-more flex w-full items-center gap-2 px-4 py-2.5 text-left text-[11px] font-semibold transition-colors",
12821
13551
  onClick: () => setShowAllFiles(true),
12822
13552
  children: [
12823
- /* @__PURE__ */ jsx55("span", { children: translate("agentHost.agentGui.turnSummaryShowMoreFiles", {
13553
+ /* @__PURE__ */ jsx57("span", { children: translate("agentHost.agentGui.turnSummaryShowMoreFiles", {
12824
13554
  count: hiddenFileCount
12825
13555
  }) }),
12826
- /* @__PURE__ */ jsx55(ChevronDown7, { size: 16, strokeWidth: 2.2, "aria-hidden": "true" })
13556
+ /* @__PURE__ */ jsx57(ChevronDown8, { size: 16, strokeWidth: 2.2, "aria-hidden": "true" })
12827
13557
  ]
12828
13558
  }
12829
- ) : hiddenFileCount > 0 ? /* @__PURE__ */ jsxs42(
13559
+ ) : hiddenFileCount > 0 ? /* @__PURE__ */ jsxs43(
12830
13560
  "button",
12831
13561
  {
12832
13562
  type: "button",
12833
13563
  className: "agent-turn-summary-card__toggle-more flex w-full items-center gap-2 px-4 py-2.5 text-left text-[11px] font-semibold transition-colors",
12834
13564
  onClick: () => setShowAllFiles(false),
12835
13565
  children: [
12836
- /* @__PURE__ */ jsx55("span", { children: translate("agentHost.agentGui.turnSummaryShowFewerFiles") }),
12837
- /* @__PURE__ */ jsx55(
12838
- ChevronRight7,
13566
+ /* @__PURE__ */ jsx57("span", { children: translate("agentHost.agentGui.turnSummaryShowFewerFiles") }),
13567
+ /* @__PURE__ */ jsx57(
13568
+ ChevronRight8,
12839
13569
  {
12840
13570
  size: 16,
12841
13571
  strokeWidth: 2.2,
@@ -12865,10 +13595,10 @@ function TurnSummaryFileCard({
12865
13595
  const canOpen = Boolean(action && onLinkAction);
12866
13596
  const stats = summarizeFileDiff(file);
12867
13597
  const preview = filePreview(file);
12868
- return /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card__file", children: [
12869
- /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card__file-row flex min-w-0 items-center gap-2.5 overflow-hidden px-4 py-2.5", children: [
12870
- /* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 flex-1 items-center gap-2.5", children: [
12871
- /* @__PURE__ */ jsxs42(
13598
+ return /* @__PURE__ */ jsxs43("div", { className: "agent-turn-summary-card__file", children: [
13599
+ /* @__PURE__ */ jsxs43("div", { className: "agent-turn-summary-card__file-row flex min-w-0 items-center gap-2.5 overflow-hidden px-4 py-2.5", children: [
13600
+ /* @__PURE__ */ jsxs43("div", { className: "flex min-w-0 flex-1 items-center gap-2.5", children: [
13601
+ /* @__PURE__ */ jsxs43(
12872
13602
  "button",
12873
13603
  {
12874
13604
  type: "button",
@@ -12876,22 +13606,22 @@ function TurnSummaryFileCard({
12876
13606
  "aria-expanded": expanded,
12877
13607
  onClick: onToggle,
12878
13608
  children: [
12879
- /* @__PURE__ */ jsx55("div", { className: "min-w-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsxs42(
13609
+ /* @__PURE__ */ jsx57("div", { className: "min-w-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsxs43(
12880
13610
  "span",
12881
13611
  {
12882
13612
  className: `agent-turn-summary-card__path flex min-w-0 max-w-full overflow-hidden whitespace-nowrap text-[13px] font-medium leading-5 text-[var(--text-secondary)] ${file.changeType === "deleted" ? "line-through" : ""}`,
12883
13613
  title: file.path,
12884
13614
  children: [
12885
- file.directory ? /* @__PURE__ */ jsxs42("span", { className: "agent-turn-summary-card__path-directory", children: [
13615
+ file.directory ? /* @__PURE__ */ jsxs43("span", { className: "agent-turn-summary-card__path-directory", children: [
12886
13616
  file.directory,
12887
13617
  "/"
12888
13618
  ] }) : null,
12889
- /* @__PURE__ */ jsx55("span", { className: "agent-turn-summary-card__path-file", children: file.fileName })
13619
+ /* @__PURE__ */ jsx57("span", { className: "agent-turn-summary-card__path-file", children: file.fileName })
12890
13620
  ]
12891
13621
  }
12892
13622
  ) }),
12893
- /* @__PURE__ */ jsx55("span", { className: "shrink-0 text-[var(--text-tertiary)] opacity-0 transition-opacity group-hover/file-toggle:opacity-100 group-focus-visible/file-toggle:opacity-100", children: /* @__PURE__ */ jsx55(
12894
- ChevronRight7,
13623
+ /* @__PURE__ */ jsx57("span", { className: "shrink-0 text-[var(--text-tertiary)] opacity-0 transition-opacity group-hover/file-toggle:opacity-100 group-focus-visible/file-toggle:opacity-100", children: /* @__PURE__ */ jsx57(
13624
+ ChevronRight8,
12895
13625
  {
12896
13626
  size: 14,
12897
13627
  strokeWidth: 2.2,
@@ -12902,18 +13632,18 @@ function TurnSummaryFileCard({
12902
13632
  ]
12903
13633
  }
12904
13634
  ),
12905
- /* @__PURE__ */ jsxs42("span", { className: "ml-auto inline-flex shrink-0 items-center gap-2 text-[11px] font-semibold", children: [
12906
- stats.added > 0 ? /* @__PURE__ */ jsxs42("span", { className: "workspace-agents-status-panel__detail-tool-diff-added", children: [
13635
+ /* @__PURE__ */ jsxs43("span", { className: "ml-auto inline-flex shrink-0 items-center gap-2 text-[11px] font-semibold", children: [
13636
+ stats.added > 0 ? /* @__PURE__ */ jsxs43("span", { className: "workspace-agents-status-panel__detail-tool-diff-added", children: [
12907
13637
  "+",
12908
13638
  stats.added
12909
13639
  ] }) : null,
12910
- stats.removed > 0 ? /* @__PURE__ */ jsxs42("span", { className: "workspace-agents-status-panel__detail-tool-diff-removed", children: [
13640
+ stats.removed > 0 ? /* @__PURE__ */ jsxs43("span", { className: "workspace-agents-status-panel__detail-tool-diff-removed", children: [
12911
13641
  "-",
12912
13642
  stats.removed
12913
13643
  ] }) : null
12914
13644
  ] })
12915
13645
  ] }),
12916
- canOpen ? /* @__PURE__ */ jsx55(
13646
+ canOpen ? /* @__PURE__ */ jsx57(
12917
13647
  CanvasNodeGhostIconButton,
12918
13648
  {
12919
13649
  "aria-label": translate(
@@ -12925,7 +13655,7 @@ function TurnSummaryFileCard({
12925
13655
  onClick: () => {
12926
13656
  onLinkAction?.(action);
12927
13657
  },
12928
- children: /* @__PURE__ */ jsx55(
13658
+ children: /* @__PURE__ */ jsx57(
12929
13659
  DirectLinedIcon,
12930
13660
  {
12931
13661
  width: 14,
@@ -12937,12 +13667,12 @@ function TurnSummaryFileCard({
12937
13667
  }
12938
13668
  ) : null
12939
13669
  ] }),
12940
- preview ? /* @__PURE__ */ jsx55(CollapsibleReveal, { expanded, preMountOnIdle: true, children: /* @__PURE__ */ jsx55("div", { className: "agent-turn-summary-card__preview rounded-none px-4 pb-3 pt-2", children: preview }) }) : null
13670
+ preview ? /* @__PURE__ */ jsx57(CollapsibleReveal, { expanded, preMountOnIdle: true, children: /* @__PURE__ */ jsx57("div", { className: "agent-turn-summary-card__preview rounded-none px-4 pb-3 pt-2", children: preview }) }) : null
12941
13671
  ] });
12942
13672
  }
12943
13673
  function filePreview(file) {
12944
13674
  if (file.changeType === "created" && file.content?.trim()) {
12945
- return /* @__PURE__ */ jsx55(
13675
+ return /* @__PURE__ */ jsx57(
12946
13676
  AgentCodeBlock,
12947
13677
  {
12948
13678
  path: file.path,
@@ -12954,7 +13684,7 @@ function filePreview(file) {
12954
13684
  );
12955
13685
  }
12956
13686
  if (file.unifiedDiff?.trim()) {
12957
- return /* @__PURE__ */ jsx55(
13687
+ return /* @__PURE__ */ jsx57(
12958
13688
  AgentUnifiedPatchViewer,
12959
13689
  {
12960
13690
  path: file.path,
@@ -12965,7 +13695,7 @@ function filePreview(file) {
12965
13695
  );
12966
13696
  }
12967
13697
  if (file.changeType === "created" && file.newString?.trim()) {
12968
- return /* @__PURE__ */ jsx55(
13698
+ return /* @__PURE__ */ jsx57(
12969
13699
  AgentCodeBlock,
12970
13700
  {
12971
13701
  path: file.path,
@@ -12977,7 +13707,7 @@ function filePreview(file) {
12977
13707
  );
12978
13708
  }
12979
13709
  if (file.oldString?.trim() || file.newString?.trim()) {
12980
- return /* @__PURE__ */ jsx55(
13710
+ return /* @__PURE__ */ jsx57(
12981
13711
  AgentMonacoDiffViewer,
12982
13712
  {
12983
13713
  path: file.path,
@@ -12989,7 +13719,7 @@ function filePreview(file) {
12989
13719
  );
12990
13720
  }
12991
13721
  if (file.content?.trim()) {
12992
- return /* @__PURE__ */ jsx55(
13722
+ return /* @__PURE__ */ jsx57(
12993
13723
  AgentCodeBlock,
12994
13724
  {
12995
13725
  path: file.path,
@@ -13081,8 +13811,8 @@ function summarizeFileDiff(file) {
13081
13811
  }
13082
13812
 
13083
13813
  // shared/agentConversation/components/AgentTranscriptItemView.tsx
13084
- import { jsx as jsx56 } from "react/jsx-runtime";
13085
- var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13814
+ import { jsx as jsx58 } from "react/jsx-runtime";
13815
+ var AgentTranscriptItemView = memo3(function AgentTranscriptItemView2({
13086
13816
  workspaceRoot,
13087
13817
  basePath,
13088
13818
  row,
@@ -13115,7 +13845,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13115
13845
  );
13116
13846
  switch (row.kind) {
13117
13847
  case "message":
13118
- return /* @__PURE__ */ jsx56(
13848
+ return /* @__PURE__ */ jsx58(
13119
13849
  AgentMessageBlock,
13120
13850
  {
13121
13851
  workspaceRoot,
@@ -13133,7 +13863,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13133
13863
  }
13134
13864
  );
13135
13865
  case "tool-group":
13136
- return /* @__PURE__ */ jsx56(
13866
+ return /* @__PURE__ */ jsx58(
13137
13867
  AgentToolGroupRow,
13138
13868
  {
13139
13869
  row,
@@ -13149,7 +13879,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13149
13879
  }
13150
13880
  );
13151
13881
  case "turn-summary":
13152
- return /* @__PURE__ */ jsx56(
13882
+ return /* @__PURE__ */ jsx58(
13153
13883
  AgentTurnSummaryRow,
13154
13884
  {
13155
13885
  row,
@@ -13160,7 +13890,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13160
13890
  }
13161
13891
  );
13162
13892
  case "processing":
13163
- return /* @__PURE__ */ jsx56(AgentProcessingRow, { row, label: labels.processing });
13893
+ return /* @__PURE__ */ jsx58(AgentProcessingRow, { row, label: labels.processing });
13164
13894
  }
13165
13895
  });
13166
13896
 
@@ -13281,13 +14011,14 @@ function looksLikeTableSeparator(line) {
13281
14011
  }
13282
14012
 
13283
14013
  // shared/agentConversation/components/AgentTranscriptView.tsx
13284
- import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
14014
+ import { Fragment as Fragment8, jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
13285
14015
  var AGENT_TRANSCRIPT_VIRTUALIZATION_OVERSCAN = 6;
13286
14016
  var AGENT_TRANSCRIPT_ESTIMATED_TURN_HEIGHT_PX = 280;
13287
14017
  var AGENT_TRANSCRIPT_TURN_GAP_PX = 12;
13288
14018
  var AGENT_TRANSCRIPT_FALLBACK_TURN_COUNT = 3;
14019
+ var AGENT_MESSAGE_LOCATOR_PANEL_FADE_MS = 160;
13289
14020
  function transcriptLabelsEqual(previous, next) {
13290
- return previous === next || previous.thinkingLabel === next.thinkingLabel && previous.processing === next.processing && previous.turnSummary === next.turnSummary && previous.rawTimelineJson === next.rawTimelineJson && previous.toolCallsLabel === next.toolCallsLabel;
14021
+ return previous === next || previous.thinkingLabel === next.thinkingLabel && previous.processing === next.processing && previous.turnSummary === next.turnSummary && previous.rawTimelineJson === next.rawTimelineJson && previous.userMessageLocator === next.userMessageLocator && previous.toolCallsLabel === next.toolCallsLabel;
13291
14022
  }
13292
14023
  function transcriptTurnIdentityEquals(previous, next) {
13293
14024
  return previous === next || previous.length === next.length && previous.every((turn, index) => turn.id === next[index]?.id);
@@ -13304,7 +14035,7 @@ function areAgentTranscriptViewPropsEqual(previous, next) {
13304
14035
  next.conversation
13305
14036
  ) && previous.onLinkAction === next.onLinkAction && previous.onAuthLogin === next.onAuthLogin && previous.availableSkills === next.availableSkills && previous.workspaceAppIcons === next.workspaceAppIcons && previous.previewMode === next.previewMode && previous.showRawTimelineJson === next.showRawTimelineJson && transcriptLabelsEqual(previous.labels, next.labels);
13306
14037
  }
13307
- var AgentTranscriptView = memo3(function AgentTranscriptView2({
14038
+ var AgentTranscriptView = memo4(function AgentTranscriptView2({
13308
14039
  conversation,
13309
14040
  onLinkAction,
13310
14041
  onAuthLogin,
@@ -13315,9 +14046,9 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13315
14046
  labels
13316
14047
  }) {
13317
14048
  "use memo";
13318
- const [expandedToolRows, setExpandedToolRows] = useState17({});
14049
+ const [expandedToolRows, setExpandedToolRows] = useState18({});
13319
14050
  const virtualizerHostRef = useRef8(null);
13320
- const [virtualScrollElement, setVirtualScrollElement] = useState17(null);
14051
+ const [virtualScrollElement, setVirtualScrollElement] = useState18(null);
13321
14052
  const rowKeys = useMemo6(
13322
14053
  () => conversation.rows.map(transcriptRowKey),
13323
14054
  [conversation.rows]
@@ -13326,6 +14057,18 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13326
14057
  () => buildAgentTranscriptTurnGroups(conversation.rows, rowKeys),
13327
14058
  [conversation.rows, rowKeys]
13328
14059
  );
14060
+ const turnGroupIndexByRowIndex = useMemo6(
14061
+ () => buildTurnGroupIndexByRowIndex(turnGroups),
14062
+ [turnGroups]
14063
+ );
14064
+ const userMessageLocatorItems = useMemo6(
14065
+ () => buildUserMessageLocatorItems(
14066
+ conversation.rows,
14067
+ rowKeys,
14068
+ turnGroupIndexByRowIndex
14069
+ ),
14070
+ [conversation.rows, rowKeys, turnGroupIndexByRowIndex]
14071
+ );
13329
14072
  const enteringRowKeys = useEnteringTranscriptRows(rowKeys);
13330
14073
  const handleToolGroupExpandedChange = useCallback10(
13331
14074
  (key, expanded) => {
@@ -13365,6 +14108,34 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13365
14108
  getScrollElement: () => virtualScrollElement,
13366
14109
  overscan: AGENT_TRANSCRIPT_VIRTUALIZATION_OVERSCAN
13367
14110
  });
14111
+ const handleLocateUserMessage = useCallback10(
14112
+ (item) => {
14113
+ const scrollParent = virtualizerHostRef.current?.parentElement ?? null;
14114
+ const scrollToRenderedRow = () => {
14115
+ const renderedRow = (scrollParent ?? document).querySelector(
14116
+ `[data-agent-transcript-row="${escapeCssString(item.rowKey)}"]`
14117
+ );
14118
+ if (!renderedRow) {
14119
+ return false;
14120
+ }
14121
+ renderedRow.scrollIntoView({
14122
+ block: "center",
14123
+ behavior: "smooth"
14124
+ });
14125
+ return true;
14126
+ };
14127
+ if (scrollToRenderedRow()) {
14128
+ return;
14129
+ }
14130
+ if (shouldVirtualize) {
14131
+ rowVirtualizer.scrollToIndex(item.turnGroupIndex, {
14132
+ align: "center"
14133
+ });
14134
+ window.setTimeout(scrollToRenderedRow, 0);
14135
+ }
14136
+ },
14137
+ [rowVirtualizer, shouldVirtualize]
14138
+ );
13368
14139
  useLayoutEffect2(() => {
13369
14140
  if (!shouldVirtualize) {
13370
14141
  setVirtualScrollElement(null);
@@ -13376,8 +14147,8 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13376
14147
  const rowKey = rowKeys[rowIndex] ?? transcriptRowKey(row);
13377
14148
  const showTurnDivider = dividerRowIndexes.has(rowIndex);
13378
14149
  const shouldAnimateEnter = row.kind !== "processing" && enteringRowKeys.has(rowKey);
13379
- return /* @__PURE__ */ jsxs43(Fragment6, { children: [
13380
- showTurnDivider ? /* @__PURE__ */ jsx57(
14150
+ return /* @__PURE__ */ jsxs44(Fragment7, { children: [
14151
+ showTurnDivider ? /* @__PURE__ */ jsx59(
13381
14152
  "div",
13382
14153
  {
13383
14154
  className: "h-px w-full flex-none bg-[var(--line-2,var(--tutti-line-2))]",
@@ -13385,14 +14156,15 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13385
14156
  "aria-hidden": "true"
13386
14157
  }
13387
14158
  ) : null,
13388
- /* @__PURE__ */ jsx57(
14159
+ /* @__PURE__ */ jsx59(
13389
14160
  "div",
13390
14161
  {
13391
14162
  className: "agent-gui-transcript-row",
13392
14163
  "data-agent-transcript-row": rowKey,
13393
14164
  "data-agent-transcript-row-kind": row.kind,
14165
+ "data-agent-transcript-row-index": rowIndex,
13394
14166
  "data-agent-transcript-row-enter": shouldAnimateEnter ? "true" : void 0,
13395
- children: /* @__PURE__ */ jsx57(
14167
+ children: /* @__PURE__ */ jsx59(
13396
14168
  AgentTranscriptItemView,
13397
14169
  {
13398
14170
  workspaceRoot,
@@ -13427,39 +14199,373 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13427
14199
  AGENT_TRANSCRIPT_FALLBACK_TURN_COUNT
13428
14200
  ) + fallbackIndex) * AGENT_TRANSCRIPT_ESTIMATED_TURN_HEIGHT_PX
13429
14201
  })) : rowVirtualizer.getVirtualItems();
13430
- return /* @__PURE__ */ jsx57(
13431
- "div",
14202
+ return /* @__PURE__ */ jsxs44(Fragment8, { children: [
14203
+ /* @__PURE__ */ jsx59(
14204
+ AgentMessageLocatorRail,
14205
+ {
14206
+ items: userMessageLocatorItems,
14207
+ label: labels.userMessageLocator,
14208
+ onLocate: handleLocateUserMessage
14209
+ }
14210
+ ),
14211
+ /* @__PURE__ */ jsx59(
14212
+ "div",
14213
+ {
14214
+ ref: virtualizerHostRef,
14215
+ className: "agent-gui-transcript-virtual",
14216
+ "data-agent-transcript-virtualized": "true",
14217
+ style: { height: `${rowVirtualizer.getTotalSize()}px` },
14218
+ children: virtualItems.map((virtualTurn) => {
14219
+ const group = turnGroups[virtualTurn.index];
14220
+ if (!group) {
14221
+ return null;
14222
+ }
14223
+ return /* @__PURE__ */ jsx59(
14224
+ "div",
14225
+ {
14226
+ ref: rowVirtualizer.measureElement,
14227
+ className: "agent-gui-transcript-virtual-item",
14228
+ "data-index": virtualTurn.index,
14229
+ "data-agent-transcript-virtual-turn": group.key,
14230
+ style: {
14231
+ paddingBottom: `${AGENT_TRANSCRIPT_TURN_GAP_PX}px`,
14232
+ transform: `translateY(${virtualTurn.start}px)`
14233
+ },
14234
+ children: group.rows.map(
14235
+ ({ row, rowIndex }) => renderRow(row, rowIndex)
14236
+ )
14237
+ },
14238
+ virtualTurn.key
14239
+ );
14240
+ })
14241
+ }
14242
+ )
14243
+ ] });
14244
+ }
14245
+ return /* @__PURE__ */ jsxs44(Fragment8, { children: [
14246
+ /* @__PURE__ */ jsx59(
14247
+ AgentMessageLocatorRail,
13432
14248
  {
13433
- ref: virtualizerHostRef,
13434
- className: "agent-gui-transcript-virtual",
13435
- "data-agent-transcript-virtualized": "true",
13436
- style: { height: `${rowVirtualizer.getTotalSize()}px` },
13437
- children: virtualItems.map((virtualTurn) => {
13438
- const group = turnGroups[virtualTurn.index];
13439
- if (!group) {
13440
- return null;
14249
+ items: userMessageLocatorItems,
14250
+ label: labels.userMessageLocator,
14251
+ onLocate: handleLocateUserMessage
14252
+ }
14253
+ ),
14254
+ conversation.rows.map(renderRow)
14255
+ ] });
14256
+ }, areAgentTranscriptViewPropsEqual);
14257
+ function AgentMessageLocatorRail({
14258
+ items,
14259
+ label,
14260
+ onLocate
14261
+ }) {
14262
+ const locatorRef = useRef8(null);
14263
+ const closePanelTimeoutRef = useRef8(null);
14264
+ const [isPanelOpen, setIsPanelOpen] = useState18(false);
14265
+ const [shouldRenderPanel, setShouldRenderPanel] = useState18(false);
14266
+ const [activeKey, setActiveKey] = useState18(null);
14267
+ const [selectedKey, setSelectedKey] = useState18(null);
14268
+ const previousAgentResponseByKeyRef = useRef8(null);
14269
+ const [unreadAgentResponseKeys, setUnreadAgentResponseKeys] = useState18(/* @__PURE__ */ new Set());
14270
+ const [visibleHeightPx, setVisibleHeightPx] = useState18(null);
14271
+ useEffect11(() => {
14272
+ if (isPanelOpen) {
14273
+ setShouldRenderPanel(true);
14274
+ return;
14275
+ }
14276
+ const timeout = window.setTimeout(
14277
+ () => setShouldRenderPanel(false),
14278
+ AGENT_MESSAGE_LOCATOR_PANEL_FADE_MS
14279
+ );
14280
+ return () => window.clearTimeout(timeout);
14281
+ }, [isPanelOpen]);
14282
+ useEffect11(
14283
+ () => () => {
14284
+ if (closePanelTimeoutRef.current !== null) {
14285
+ window.clearTimeout(closePanelTimeoutRef.current);
14286
+ }
14287
+ },
14288
+ []
14289
+ );
14290
+ useEffect11(() => {
14291
+ if (selectedKey && !items.some((item) => item.key === selectedKey)) {
14292
+ setSelectedKey(null);
14293
+ }
14294
+ }, [items, selectedKey]);
14295
+ useEffect11(() => {
14296
+ const previousAgentResponseByKey = previousAgentResponseByKeyRef.current;
14297
+ const currentKeys = new Set(items.map((item) => item.key));
14298
+ setUnreadAgentResponseKeys((currentUnreadKeys) => {
14299
+ let nextUnreadKeys = null;
14300
+ const ensureNextUnreadKeys = () => {
14301
+ if (!nextUnreadKeys) {
14302
+ nextUnreadKeys = new Set(currentUnreadKeys);
14303
+ }
14304
+ return nextUnreadKeys;
14305
+ };
14306
+ for (const key of currentUnreadKeys) {
14307
+ if (!currentKeys.has(key)) {
14308
+ ensureNextUnreadKeys().delete(key);
14309
+ }
14310
+ }
14311
+ if (previousAgentResponseByKey) {
14312
+ for (const item of items) {
14313
+ const hadAgentResponse = previousAgentResponseByKey.get(item.key) ?? false;
14314
+ if (item.hasAgentResponse && !hadAgentResponse && item.key !== selectedKey) {
14315
+ ensureNextUnreadKeys().add(item.key);
13441
14316
  }
13442
- return /* @__PURE__ */ jsx57(
13443
- "div",
13444
- {
13445
- ref: rowVirtualizer.measureElement,
13446
- className: "agent-gui-transcript-virtual-item",
13447
- "data-index": virtualTurn.index,
13448
- "data-agent-transcript-virtual-turn": group.key,
13449
- style: {
13450
- paddingBottom: `${AGENT_TRANSCRIPT_TURN_GAP_PX}px`,
13451
- transform: `translateY(${virtualTurn.start}px)`
13452
- },
13453
- children: group.rows.map(({ row, rowIndex }) => renderRow(row, rowIndex))
13454
- },
13455
- virtualTurn.key
13456
- );
13457
- })
14317
+ }
14318
+ }
14319
+ return nextUnreadKeys ?? currentUnreadKeys;
14320
+ });
14321
+ previousAgentResponseByKeyRef.current = new Map(
14322
+ items.map((item) => [item.key, item.hasAgentResponse])
14323
+ );
14324
+ }, [items, selectedKey]);
14325
+ useEffect11(() => {
14326
+ if (!selectedKey) {
14327
+ return;
14328
+ }
14329
+ setUnreadAgentResponseKeys((currentUnreadKeys) => {
14330
+ if (!currentUnreadKeys.has(selectedKey)) {
14331
+ return currentUnreadKeys;
14332
+ }
14333
+ const nextUnreadKeys = new Set(currentUnreadKeys);
14334
+ nextUnreadKeys.delete(selectedKey);
14335
+ return nextUnreadKeys;
14336
+ });
14337
+ }, [selectedKey]);
14338
+ useLayoutEffect2(() => {
14339
+ const locator = locatorRef.current;
14340
+ const scrollParent = locator ? findMessageLocatorScrollParent(locator) : null;
14341
+ if (!scrollParent) {
14342
+ return;
14343
+ }
14344
+ let animationFrame = null;
14345
+ const updateVisibleHeight = () => {
14346
+ animationFrame = null;
14347
+ const nextHeight = scrollParent.clientHeight;
14348
+ setVisibleHeightPx(
14349
+ (current) => current === nextHeight ? current : nextHeight
14350
+ );
14351
+ };
14352
+ const scheduleUpdate = () => {
14353
+ if (animationFrame !== null) {
14354
+ return;
14355
+ }
14356
+ animationFrame = window.requestAnimationFrame(updateVisibleHeight);
14357
+ };
14358
+ scheduleUpdate();
14359
+ const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleUpdate);
14360
+ resizeObserver?.observe(scrollParent);
14361
+ window.addEventListener("resize", scheduleUpdate);
14362
+ return () => {
14363
+ resizeObserver?.disconnect();
14364
+ window.removeEventListener("resize", scheduleUpdate);
14365
+ if (animationFrame !== null) {
14366
+ window.cancelAnimationFrame(animationFrame);
14367
+ }
14368
+ };
14369
+ }, [items.length]);
14370
+ useEffect11(() => {
14371
+ const locator = locatorRef.current;
14372
+ const scrollParent = locator ? findMessageLocatorScrollParent(locator) : null;
14373
+ if (!scrollParent) {
14374
+ return;
14375
+ }
14376
+ let animationFrame = null;
14377
+ const updateSelectedFromScroll = () => {
14378
+ animationFrame = null;
14379
+ const nextSelectedKey = selectMessageLocatorItemAtViewportCenter(
14380
+ scrollParent,
14381
+ items
14382
+ );
14383
+ if (nextSelectedKey) {
14384
+ setSelectedKey(nextSelectedKey);
14385
+ }
14386
+ };
14387
+ const scheduleUpdate = () => {
14388
+ if (animationFrame !== null) {
14389
+ return;
14390
+ }
14391
+ animationFrame = window.requestAnimationFrame(updateSelectedFromScroll);
14392
+ };
14393
+ scheduleUpdate();
14394
+ scrollParent.addEventListener("scroll", scheduleUpdate, { passive: true });
14395
+ return () => {
14396
+ scrollParent.removeEventListener("scroll", scheduleUpdate);
14397
+ if (animationFrame !== null) {
14398
+ window.cancelAnimationFrame(animationFrame);
14399
+ }
14400
+ };
14401
+ }, [items]);
14402
+ if (items.length < 2) {
14403
+ return null;
14404
+ }
14405
+ const railHeight = (items.length - 1) * 30 + 18;
14406
+ const activeOrSelectedKey = activeKey ?? selectedKey;
14407
+ const markItemRead = (itemKey) => {
14408
+ setUnreadAgentResponseKeys((currentUnreadKeys) => {
14409
+ if (!currentUnreadKeys.has(itemKey)) {
14410
+ return currentUnreadKeys;
13458
14411
  }
14412
+ const nextUnreadKeys = new Set(currentUnreadKeys);
14413
+ nextUnreadKeys.delete(itemKey);
14414
+ return nextUnreadKeys;
14415
+ });
14416
+ };
14417
+ const handleLocateItem = (item) => {
14418
+ setSelectedKey(item.key);
14419
+ setActiveKey(item.key);
14420
+ markItemRead(item.key);
14421
+ onLocate(item);
14422
+ };
14423
+ const openPanel = () => {
14424
+ if (closePanelTimeoutRef.current !== null) {
14425
+ window.clearTimeout(closePanelTimeoutRef.current);
14426
+ closePanelTimeoutRef.current = null;
14427
+ }
14428
+ setIsPanelOpen(true);
14429
+ };
14430
+ const closePanelSoon = () => {
14431
+ if (closePanelTimeoutRef.current !== null) {
14432
+ window.clearTimeout(closePanelTimeoutRef.current);
14433
+ }
14434
+ closePanelTimeoutRef.current = window.setTimeout(() => {
14435
+ closePanelTimeoutRef.current = null;
14436
+ setIsPanelOpen(false);
14437
+ setActiveKey(null);
14438
+ }, 120);
14439
+ };
14440
+ const closePanelNow = () => {
14441
+ if (closePanelTimeoutRef.current !== null) {
14442
+ window.clearTimeout(closePanelTimeoutRef.current);
14443
+ closePanelTimeoutRef.current = null;
14444
+ }
14445
+ setIsPanelOpen(false);
14446
+ setActiveKey(null);
14447
+ };
14448
+ const handleBlurCapture = (event) => {
14449
+ const nextTarget = event.relatedTarget;
14450
+ if (nextTarget instanceof Node && event.currentTarget.contains(nextTarget)) {
14451
+ return;
14452
+ }
14453
+ closePanelNow();
14454
+ };
14455
+ return /* @__PURE__ */ jsxs44(
14456
+ "nav",
14457
+ {
14458
+ ref: locatorRef,
14459
+ className: "agent-gui-message-locator",
14460
+ "aria-label": label ?? items[0]?.summary,
14461
+ "data-testid": "agent-message-locator",
14462
+ onBlurCapture: handleBlurCapture,
14463
+ onFocusCapture: openPanel,
14464
+ onMouseEnter: openPanel,
14465
+ onMouseLeave: closePanelSoon,
14466
+ style: {
14467
+ "--agent-message-locator-height": `${railHeight}px`,
14468
+ ...visibleHeightPx !== null ? {
14469
+ "--agent-message-locator-visible-height": `${visibleHeightPx}px`
14470
+ } : {}
14471
+ },
14472
+ children: [
14473
+ items.slice(0, -1).map((item, index) => /* @__PURE__ */ jsx59(
14474
+ "div",
14475
+ {
14476
+ className: "agent-gui-message-locator__track-segment",
14477
+ style: {
14478
+ "--agent-message-locator-segment-position": `${index * 30 + 18}px`
14479
+ },
14480
+ "aria-hidden": "true"
14481
+ },
14482
+ `segment:${item.key}`
14483
+ )),
14484
+ items.map((item, index) => /* @__PURE__ */ jsx59(
14485
+ "button",
14486
+ {
14487
+ type: "button",
14488
+ className: "agent-gui-message-locator__tick nodrag tsh-desktop-no-drag",
14489
+ style: {
14490
+ "--agent-message-locator-position": `${index * 30 + 9}px`
14491
+ },
14492
+ "aria-label": item.summary,
14493
+ title: item.summary,
14494
+ "data-selected": item.key === selectedKey ? "true" : void 0,
14495
+ "data-unread-agent-response": unreadAgentResponseKeys.has(item.key) ? "true" : void 0,
14496
+ onClick: () => handleLocateItem(item),
14497
+ onFocus: () => setActiveKey(item.key),
14498
+ onMouseEnter: () => setActiveKey(item.key),
14499
+ children: /* @__PURE__ */ jsx59("span", { className: "agent-gui-message-locator__dot", "aria-hidden": "true" })
14500
+ },
14501
+ item.key
14502
+ )),
14503
+ shouldRenderPanel ? /* @__PURE__ */ jsx59(
14504
+ "div",
14505
+ {
14506
+ className: "agent-gui-message-locator__panel",
14507
+ role: "tooltip",
14508
+ "data-open": isPanelOpen ? "true" : void 0,
14509
+ "data-testid": "agent-message-locator-panel",
14510
+ onMouseEnter: openPanel,
14511
+ onMouseLeave: closePanelSoon,
14512
+ children: items.map((item) => /* @__PURE__ */ jsx59(
14513
+ "button",
14514
+ {
14515
+ type: "button",
14516
+ className: "agent-gui-message-locator__panel-item nodrag tsh-desktop-no-drag",
14517
+ "data-active": item.key === activeOrSelectedKey ? "true" : void 0,
14518
+ onClick: () => handleLocateItem(item),
14519
+ onFocus: () => setActiveKey(item.key),
14520
+ onMouseEnter: () => setActiveKey(item.key),
14521
+ children: /* @__PURE__ */ jsx59("span", { className: "agent-gui-message-locator__panel-item-text", children: item.summary })
14522
+ },
14523
+ `panel:${item.key}`
14524
+ ))
14525
+ }
14526
+ ) : null
14527
+ ]
14528
+ }
14529
+ );
14530
+ }
14531
+ function findMessageLocatorScrollParent(locator) {
14532
+ const timeline = locator.closest(
14533
+ '[data-testid="agent-gui-timeline"]'
14534
+ );
14535
+ if (timeline) {
14536
+ return timeline;
14537
+ }
14538
+ let current = locator.parentElement;
14539
+ while (current) {
14540
+ const style = window.getComputedStyle(current);
14541
+ const overflowY = style.overflowY;
14542
+ if ((overflowY === "auto" || overflowY === "scroll") && current.scrollHeight > current.clientHeight) {
14543
+ return current;
14544
+ }
14545
+ current = current.parentElement;
14546
+ }
14547
+ return null;
14548
+ }
14549
+ function selectMessageLocatorItemAtViewportCenter(scrollParent, items) {
14550
+ const viewportRect = scrollParent.getBoundingClientRect();
14551
+ const viewportCenterY = viewportRect.top + viewportRect.height / 2;
14552
+ let nearest = null;
14553
+ for (const item of items) {
14554
+ const row = scrollParent.querySelector(
14555
+ `[data-agent-transcript-row="${escapeCssString(item.rowKey)}"]`
13459
14556
  );
14557
+ if (!row) {
14558
+ continue;
14559
+ }
14560
+ const rowRect = row.getBoundingClientRect();
14561
+ const rowCenterY = rowRect.top + rowRect.height / 2;
14562
+ const distance = Math.abs(rowCenterY - viewportCenterY);
14563
+ if (!nearest || distance < nearest.distance) {
14564
+ nearest = { key: item.key, distance };
14565
+ }
13460
14566
  }
13461
- return /* @__PURE__ */ jsx57(Fragment7, { children: conversation.rows.map(renderRow) });
13462
- }, areAgentTranscriptViewPropsEqual);
14567
+ return nearest?.key ?? null;
14568
+ }
13463
14569
  function useEnteringTranscriptRows(rowKeys) {
13464
14570
  const previousKeysRef = useRef8(null);
13465
14571
  const previousKeys = previousKeysRef.current;
@@ -13499,6 +14605,67 @@ function buildAgentTranscriptTurnGroups(rows, rowKeys) {
13499
14605
  });
13500
14606
  return groups;
13501
14607
  }
14608
+ function buildTurnGroupIndexByRowIndex(turnGroups) {
14609
+ const rowIndexToTurnGroupIndex = /* @__PURE__ */ new Map();
14610
+ turnGroups.forEach((group, groupIndex) => {
14611
+ group.rows.forEach(({ rowIndex }) => {
14612
+ rowIndexToTurnGroupIndex.set(rowIndex, groupIndex);
14613
+ });
14614
+ });
14615
+ return rowIndexToTurnGroupIndex;
14616
+ }
14617
+ function buildUserMessageLocatorItems(rows, rowKeys, turnGroupIndexByRowIndex) {
14618
+ const items = [];
14619
+ rows.forEach((row, rowIndex) => {
14620
+ if (row.kind !== "message" || row.speaker !== "user") {
14621
+ return;
14622
+ }
14623
+ const summary = summarizeUserMessageRow(row);
14624
+ if (!summary) {
14625
+ return;
14626
+ }
14627
+ const rowKey = rowKeys[rowIndex] ?? transcriptRowKey(row);
14628
+ items.push({
14629
+ hasAgentResponse: hasAgentResponseForTurn(rows, row, rowIndex),
14630
+ key: `user-message:${rowKey}`,
14631
+ rowKey,
14632
+ turnGroupIndex: turnGroupIndexByRowIndex.get(rowIndex) ?? rowIndex,
14633
+ rowIndex,
14634
+ summary
14635
+ });
14636
+ });
14637
+ return items;
14638
+ }
14639
+ function hasAgentResponseForTurn(rows, userRow, userRowIndex) {
14640
+ const turnId = userRow.turnId ?? null;
14641
+ for (let index = userRowIndex + 1; index < rows.length; index += 1) {
14642
+ const row = rows[index];
14643
+ if (!row || row.kind !== "message") {
14644
+ continue;
14645
+ }
14646
+ if (row.speaker === "user") {
14647
+ return false;
14648
+ }
14649
+ if (turnId && row.turnId !== turnId) {
14650
+ return false;
14651
+ }
14652
+ if (row.speaker === "assistant") {
14653
+ return true;
14654
+ }
14655
+ }
14656
+ return false;
14657
+ }
14658
+ function summarizeUserMessageRow(row) {
14659
+ return normalizeLocatorSummary(
14660
+ row.messages.map((message) => message.copyText ?? message.body).join(" ")
14661
+ );
14662
+ }
14663
+ function normalizeLocatorSummary(value) {
14664
+ return value.replace(/\s+/g, " ").trim();
14665
+ }
14666
+ function escapeCssString(value) {
14667
+ return value.replace(/["\\]/g, "\\$&");
14668
+ }
13502
14669
  function findTurnDividerRowIndexes(turnIndexById, rows) {
13503
14670
  const dividerRowIndexes = /* @__PURE__ */ new Set();
13504
14671
  const previousTurnIds = /* @__PURE__ */ new Set();
@@ -13518,9 +14685,9 @@ function findTurnDividerRowIndexes(turnIndexById, rows) {
13518
14685
  }
13519
14686
 
13520
14687
  // shared/agentConversation/components/AgentConversationFlow.tsx
13521
- import { memo as memo4 } from "react";
13522
- import { Fragment as Fragment8, jsx as jsx58 } from "react/jsx-runtime";
13523
- var AgentConversationFlow = memo4(function AgentConversationFlow2({
14688
+ import { memo as memo5 } from "react";
14689
+ import { Fragment as Fragment9, jsx as jsx60 } from "react/jsx-runtime";
14690
+ var AgentConversationFlow = memo5(function AgentConversationFlow2({
13524
14691
  conversation,
13525
14692
  isLoading,
13526
14693
  loadingLabel,
@@ -13536,12 +14703,12 @@ var AgentConversationFlow = memo4(function AgentConversationFlow2({
13536
14703
  }) {
13537
14704
  "use memo";
13538
14705
  if (isLoading) {
13539
- return /* @__PURE__ */ jsx58(AgentTranscriptSkeleton, { label: loadingLabel, testId: loadingTestId });
14706
+ return /* @__PURE__ */ jsx60(AgentTranscriptSkeleton, { label: loadingLabel, testId: loadingTestId });
13540
14707
  }
13541
14708
  if (!conversation || conversation.rows.length === 0) {
13542
- return /* @__PURE__ */ jsx58(Fragment8, { children: empty });
14709
+ return /* @__PURE__ */ jsx60(Fragment9, { children: empty });
13543
14710
  }
13544
- return /* @__PURE__ */ jsx58(
14711
+ return /* @__PURE__ */ jsx60(
13545
14712
  AgentTranscriptView,
13546
14713
  {
13547
14714
  conversation,
@@ -13588,6 +14755,9 @@ export {
13588
14755
  getAppErrorCode,
13589
14756
  toLocalShortDateTime,
13590
14757
  Button,
14758
+ partitionSubAgentTimelineItems,
14759
+ buildSubAgentLanesByCallId,
14760
+ attachSubAgentLanesToConversationVM,
13591
14761
  buildWorkspaceAgentSessionDetailViewModel,
13592
14762
  projectAgentConversationVM,
13593
14763
  reconcileProjectedAgentConversationVM,
@@ -13606,4 +14776,4 @@ export {
13606
14776
  AgentConversationFlow,
13607
14777
  useProjectedAgentConversation
13608
14778
  };
13609
- //# sourceMappingURL=chunk-XRJZCEOX.js.map
14779
+ //# sourceMappingURL=chunk-RPXRNKU5.js.map