@tutti-os/agent-gui 0.0.48 → 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 (60) 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 +466 -85
  8. package/dist/{chunk-2RYZ4EBF.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-7W3VWU5R.js → chunk-ARCM7YB2.js} +2 -2
  13. package/dist/{chunk-RNIY43TA.js → chunk-BQVYICR7.js} +5 -5
  14. package/dist/{chunk-ZVKRNEOF.js → chunk-DPG2J7N5.js} +2 -2
  15. package/dist/{chunk-VGDPBC6W.js → chunk-FS26J46N.js} +5 -5
  16. package/dist/{chunk-OB43QOMC.js → chunk-FYVVHRLZ.js} +2 -2
  17. package/dist/{chunk-EUOGIKT7.js → chunk-HDBKB5RA.js} +2 -2
  18. package/dist/{chunk-R6GOICRO.js → chunk-OBFDA7RG.js} +69 -10
  19. package/dist/chunk-OBFDA7RG.js.map +1 -0
  20. package/dist/{chunk-LWMC2YA3.js → chunk-RPXRNKU5.js} +1793 -599
  21. package/dist/chunk-RPXRNKU5.js.map +1 -0
  22. package/dist/{chunk-SD56WDSC.js → chunk-TG3ZXLPM.js} +42 -1
  23. package/dist/chunk-TG3ZXLPM.js.map +1 -0
  24. package/dist/{chunk-OYQZRLJQ.js → chunk-UUY5VEK4.js} +2 -2
  25. package/dist/{chunk-6YN7HQL5.js → chunk-VKP5ZW5O.js} +5 -3
  26. package/dist/{chunk-6YN7HQL5.js.map → chunk-VKP5ZW5O.js.map} +1 -1
  27. package/dist/{chunk-N6HRVMIS.js → chunk-Y7ZVTWMZ.js} +2 -2
  28. package/dist/{chunk-NETHPCSA.js → chunk-ZTSS2NU2.js} +23 -1
  29. package/dist/chunk-ZTSS2NU2.js.map +1 -0
  30. package/dist/context-mention-palette/index.js +7 -7
  31. package/dist/i18n/index.d.ts +22 -0
  32. package/dist/i18n/index.js +2 -2
  33. package/dist/index.d.ts +50 -3
  34. package/dist/index.js +911 -818
  35. package/dist/index.js.map +1 -1
  36. package/dist/plan-decision-ops.d.ts +1 -1
  37. package/dist/queued-prompt-runtime.d.ts +3 -2
  38. package/dist/queued-prompt-runtime.js +1 -1
  39. package/dist/workbench/contribution.d.ts +5 -1
  40. package/dist/workbench/contribution.js +4 -2
  41. package/dist/workbench/index.js +5 -5
  42. package/dist/workbench/launch.d.ts +26 -1
  43. package/dist/workbench/launch.js +13 -3
  44. package/dist/workbench/sessionTitle.js +3 -3
  45. package/dist/workspace-agent-generated-files.js +3 -3
  46. package/package.json +12 -12
  47. package/dist/chunk-2RYZ4EBF.js.map +0 -1
  48. package/dist/chunk-LWMC2YA3.js.map +0 -1
  49. package/dist/chunk-NETHPCSA.js.map +0 -1
  50. package/dist/chunk-R6GOICRO.js.map +0 -1
  51. package/dist/chunk-SD56WDSC.js.map +0 -1
  52. package/dist/chunk-U6JWW45G.js.map +0 -1
  53. /package/dist/{chunk-7W3VWU5R.js.map → chunk-ARCM7YB2.js.map} +0 -0
  54. /package/dist/{chunk-RNIY43TA.js.map → chunk-BQVYICR7.js.map} +0 -0
  55. /package/dist/{chunk-ZVKRNEOF.js.map → chunk-DPG2J7N5.js.map} +0 -0
  56. /package/dist/{chunk-VGDPBC6W.js.map → chunk-FS26J46N.js.map} +0 -0
  57. /package/dist/{chunk-OB43QOMC.js.map → chunk-FYVVHRLZ.js.map} +0 -0
  58. /package/dist/{chunk-EUOGIKT7.js.map → chunk-HDBKB5RA.js.map} +0 -0
  59. /package/dist/{chunk-OYQZRLJQ.js.map → chunk-UUY5VEK4.js.map} +0 -0
  60. /package/dist/{chunk-N6HRVMIS.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-6YN7HQL5.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-OYQZRLJQ.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-N6HRVMIS.js";
41
+ } from "./chunk-Y7ZVTWMZ.js";
42
42
 
43
43
  // shared/imageGenerationTool.ts
44
44
  var KNOWN_IMAGE_GENERATION_TOOL_NAMES = /* @__PURE__ */ new Set([
@@ -464,7 +464,9 @@ var TOOL_NAME_TRANSLATION_KEYS = {
464
464
  todowrite: "agentHost.agentTool.labels.updateTodos",
465
465
  task: "agentHost.agentTool.labels.delegateAgent",
466
466
  currenttask: "agentHost.agentTool.labels.currentIssue",
467
- agent: "agentHost.agentTool.labels.delegateAgent"
467
+ agent: "agentHost.agentTool.labels.delegateAgent",
468
+ closeagent: "agentHost.agentTool.labels.closeAgent",
469
+ wait: "agentHost.agentTool.labels.waitAgent"
468
470
  };
469
471
  function legacyKindToToolName(kind) {
470
472
  switch (kind) {
@@ -1484,6 +1486,538 @@ function normalizeStatusToken(value) {
1484
1486
  return (value ?? "").trim().toLowerCase().replace(/[\s-]+/g, "_");
1485
1487
  }
1486
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
+
1487
2021
  // shared/workspaceAgentTimelineCanonical.ts
1488
2022
  function buildCanonicalWorkspaceAgentDetailView({
1489
2023
  activity,
@@ -1496,9 +2030,12 @@ function buildCanonicalWorkspaceAgentDetailView({
1496
2030
  const seenThinkingMessages = /* @__PURE__ */ new Set();
1497
2031
  let activeSequenceTurnId = null;
1498
2032
  const sortedTimelineItems = [...timelineItems].sort(
1499
- compareTimelineItemsAscending
2033
+ compareTimelineItemsAscending2
1500
2034
  );
1501
2035
  for (const item of sortedTimelineItems) {
2036
+ if (timelineItemOwnerThreadId(item)) {
2037
+ continue;
2038
+ }
1502
2039
  const role = messageRole(item);
1503
2040
  const body = messageBody(item);
1504
2041
  const explicitTurnId = item.turnId?.trim();
@@ -1652,7 +2189,7 @@ function getTurn(turns, id) {
1652
2189
  turns.set(id, turn);
1653
2190
  return turn;
1654
2191
  }
1655
- function compareTimelineItemsAscending(left, right) {
2192
+ function compareTimelineItemsAscending2(left, right) {
1656
2193
  const leftSeq = left.seq ?? 0;
1657
2194
  const rightSeq = right.seq ?? 0;
1658
2195
  if (leftSeq > 0 && rightSeq > 0 && leftSeq !== rightSeq) {
@@ -2128,7 +2665,7 @@ function mergeSourceTimelineItems(previous, next) {
2128
2665
  for (const item of merged) {
2129
2666
  byKey.set(sourceTimelineItemKey(item), item);
2130
2667
  }
2131
- return [...byKey.values()].sort(compareTimelineItemsAscending);
2668
+ return [...byKey.values()].sort(compareTimelineItemsAscending2);
2132
2669
  }
2133
2670
  function sourceTimelineItemKey(item) {
2134
2671
  const eventId = item.eventId?.trim();
@@ -2283,7 +2820,7 @@ function projectAgentApprovalItem(call, input, output) {
2283
2820
  if (callType !== "approval" && toolName !== "approval") {
2284
2821
  return null;
2285
2822
  }
2286
- 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);
2287
2824
  if (!requestId) {
2288
2825
  return null;
2289
2826
  }
@@ -2307,7 +2844,7 @@ function projectAgentApprovalItem(call, input, output) {
2307
2844
  callId: call.id.replace(/^call:/, ""),
2308
2845
  title: mcpTarget?.displayName ?? (call.summary.trim() || call.name),
2309
2846
  toolName: call.toolName,
2310
- status: stringValue2(call.payload?.status) ?? call.status,
2847
+ status: stringValue3(call.payload?.status) ?? call.status,
2311
2848
  input,
2312
2849
  options,
2313
2850
  output,
@@ -2317,17 +2854,17 @@ function projectAgentApprovalItem(call, input, output) {
2317
2854
  function normalizeApprovalOptions(values) {
2318
2855
  return values.flatMap((value) => {
2319
2856
  const option = objectValue(value);
2320
- const id = stringValue2(option?.optionId) ?? stringValue2(option?.id);
2857
+ const id = stringValue3(option?.optionId) ?? stringValue3(option?.id);
2321
2858
  if (!id) {
2322
2859
  return [];
2323
2860
  }
2324
- 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;
2325
2862
  return [
2326
2863
  {
2327
2864
  id,
2328
2865
  label,
2329
- kind: stringValue2(option?.kind) ?? "",
2330
- ...stringValue2(option?.description) ? { description: stringValue2(option?.description) } : {}
2866
+ kind: stringValue3(option?.kind) ?? "",
2867
+ ...stringValue3(option?.description) ? { description: stringValue3(option?.description) } : {}
2331
2868
  }
2332
2869
  ];
2333
2870
  });
@@ -2335,7 +2872,7 @@ function normalizeApprovalOptions(values) {
2335
2872
  function normalizeToken(value) {
2336
2873
  return (value ?? "").trim().toLowerCase();
2337
2874
  }
2338
- function stringValue2(value) {
2875
+ function stringValue3(value) {
2339
2876
  return typeof value === "string" && value.trim() ? value.trim() : null;
2340
2877
  }
2341
2878
  function objectValue(value) {
@@ -2359,7 +2896,7 @@ function projectAgentAskUserQuestionItem(call, input, output) {
2359
2896
  kind: "ask-user",
2360
2897
  id: call.id,
2361
2898
  turnId: call.turnId ?? "turn:unknown",
2362
- 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:/, ""),
2363
2900
  title: call.name,
2364
2901
  status: call.status,
2365
2902
  questions: questions.map((question) => ({
@@ -2375,12 +2912,12 @@ function projectAgentPlanModeItem(call, input) {
2375
2912
  itemKind: "plan-mode",
2376
2913
  id: call.id,
2377
2914
  turnId: call.turnId ?? "turn:unknown",
2378
- 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:/, ""),
2379
2916
  kind: "exit",
2380
- title: stringValue3(objectValue2(input?.toolCall)?.title) ?? call.name,
2917
+ title: stringValue4(objectValue2(input?.toolCall)?.title) ?? call.name,
2381
2918
  status: call.status,
2382
- plan: stringValue3(input?.plan) ?? stringValue3(call.payload?.plan) ?? (call.summary.trim() || null),
2383
- 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),
2384
2921
  options: extractExitPlanModeOptions(input),
2385
2922
  ...keepPlanningOption(extractExitPlanKeepPlanningOptionId(input)),
2386
2923
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
@@ -2395,8 +2932,8 @@ function projectAgentPlanModeItem(call, input) {
2395
2932
  kind: "enter",
2396
2933
  title: call.name,
2397
2934
  status: call.status,
2398
- plan: stringValue3(input?.content) ?? (call.summary.trim() || null),
2399
- filePath: stringValue3(input?.filePath),
2935
+ plan: stringValue4(input?.content) ?? (call.summary.trim() || null),
2936
+ filePath: stringValue4(input?.filePath),
2400
2937
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
2401
2938
  };
2402
2939
  }
@@ -2407,12 +2944,12 @@ function projectAgentPlanModeItem(call, input) {
2407
2944
  itemKind: "plan-mode",
2408
2945
  id: call.id,
2409
2946
  turnId: call.turnId ?? "turn:unknown",
2410
- 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:/, ""),
2411
2948
  kind: "exit",
2412
2949
  title: call.name,
2413
2950
  status: call.status,
2414
- plan: stringValue3(input?.plan) ?? stringValue3(call.payload?.plan) ?? (call.summary.trim() || null),
2415
- 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),
2416
2953
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
2417
2954
  };
2418
2955
  }
@@ -2437,7 +2974,7 @@ function keepPlanningOption(optionId) {
2437
2974
  function normalizeToolName2(value) {
2438
2975
  return (value ?? "").replace(/[_\s-]+/g, "").trim().toLowerCase();
2439
2976
  }
2440
- function stringValue3(value) {
2977
+ function stringValue4(value) {
2441
2978
  return typeof value === "string" && value.trim() ? value.trim() : null;
2442
2979
  }
2443
2980
  function objectValue2(value) {
@@ -2550,13 +3087,13 @@ function normalizeToolName3(value) {
2550
3087
  }
2551
3088
  function hasMcpMetadata(metadata) {
2552
3089
  return Boolean(
2553
- stringValue4(metadata?.server) ?? stringValue4(metadata?.serverName) ?? stringValue4(metadata?.mcpServer)
3090
+ stringValue5(metadata?.server) ?? stringValue5(metadata?.serverName) ?? stringValue5(metadata?.mcpServer)
2554
3091
  );
2555
3092
  }
2556
3093
  function normalizeCallType(value) {
2557
3094
  return (value ?? "").trim().toLowerCase();
2558
3095
  }
2559
- function stringValue4(value) {
3096
+ function stringValue5(value) {
2560
3097
  return typeof value === "string" && value.trim() ? value.trim() : null;
2561
3098
  }
2562
3099
 
@@ -2579,11 +3116,11 @@ function projectAgentTaskItem(call, input, output, metadata) {
2579
3116
  turnId: call.turnId ?? "turn:unknown",
2580
3117
  title: call.summary.trim() || call.name,
2581
3118
  status: call.status,
2582
- prompt: stringValue5(input?.prompt) ?? stringValue5(input?.description) ?? stringValue5(call.payload?.description) ?? stringValue5(claudeToolResponse?.prompt),
2583
- 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),
2584
3121
  steps,
2585
- result: firstNonEmptyText(output, call.summary),
2586
- resultMarkdown: firstNonEmptyText(output, call.summary),
3122
+ result: firstNonEmptyText(output),
3123
+ resultMarkdown: firstNonEmptyText(output),
2587
3124
  durationMs: numberValue(metadata?.durationMs) ?? numberValue(output?.durationMs) ?? numberValue(claudeToolResponse?.totalDurationMs),
2588
3125
  occurredAtUnixMs: call.occurredAtUnixMs ?? null
2589
3126
  };
@@ -2594,8 +3131,8 @@ function normalizeTaskSteps(values, turnId) {
2594
3131
  if (!step) {
2595
3132
  return [];
2596
3133
  }
2597
- const toolName = stringValue5(step.toolName) ?? stringValue5(step.tool_name) ?? stringValue5(step.name);
2598
- 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);
2599
3136
  const inputPayload = objectValue3(step.toolInput) ?? objectValue3(step.tool_input);
2600
3137
  const outputPayload = objectValue3(step.toolResult) ?? objectValue3(step.tool_result);
2601
3138
  const errorPayload = objectValue3(step.toolError) ?? objectValue3(step.tool_error);
@@ -2605,11 +3142,11 @@ function normalizeTaskSteps(values, turnId) {
2605
3142
  const locations = arrayValue3(step.locations);
2606
3143
  return [
2607
3144
  {
2608
- id: stringValue5(step.toolUseId) ?? stringValue5(step.id) ?? `step-${index + 1}`,
3145
+ id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `step-${index + 1}`,
2609
3146
  turnId,
2610
3147
  name: toolName ? humanizeToolLabel(toolName) : `Step ${index + 1}`,
2611
3148
  toolName: toolName ?? null,
2612
- 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),
2613
3150
  summary: firstNonEmptyText(outputPayload, inputPayload) ?? "",
2614
3151
  payload: {
2615
3152
  input: inputPayload,
@@ -2617,12 +3154,12 @@ function normalizeTaskSteps(values, turnId) {
2617
3154
  error: errorPayload
2618
3155
  },
2619
3156
  tool: projectAgentTaskStepTool({
2620
- id: stringValue5(step.toolUseId) ?? stringValue5(step.id) ?? `step-${index + 1}`,
3157
+ id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `step-${index + 1}`,
2621
3158
  turnId,
2622
3159
  toolName,
2623
- name: stringValue5(step.name),
3160
+ name: stringValue6(step.name),
2624
3161
  callType,
2625
- status: stringValue5(step.status) ?? stringValue5(outputPayload?.status),
3162
+ status: stringValue6(step.status) ?? stringValue6(outputPayload?.status),
2626
3163
  summary: firstNonEmptyText(outputPayload, inputPayload) ?? "",
2627
3164
  payload,
2628
3165
  metadata,
@@ -2704,7 +3241,7 @@ function projectAgentTaskStepTool(step) {
2704
3241
  function humanizeToolLabel(value) {
2705
3242
  return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/^\w/, (match) => match.toUpperCase());
2706
3243
  }
2707
- function stringValue5(value) {
3244
+ function stringValue6(value) {
2708
3245
  return typeof value === "string" && value.trim() ? value.trim() : null;
2709
3246
  }
2710
3247
  function numberValue(value) {
@@ -3466,8 +4003,8 @@ function filesFromCall(call, options) {
3466
4003
  return [];
3467
4004
  }
3468
4005
  return extractFileChanges({
3469
- id: stringValue6(step.toolUseId) ?? stringValue6(step.id) ?? `${call.id}:step:${index + 1}`,
3470
- 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,
3471
4008
  statusKind: nestedTaskStepStatusKind(step, call.statusKind ?? null),
3472
4009
  occurredAtUnixMs: numberValue2(step.occurredAtUnixMs) ?? numberValue2(step.occurred_at_unix_ms) ?? call.occurredAtUnixMs ?? null,
3473
4010
  payload: objectValue5(step.payload),
@@ -3504,7 +4041,7 @@ function patchBatchesFromCall(call, options) {
3504
4041
  return [];
3505
4042
  }
3506
4043
  return patchBatchFromPayload({
3507
- 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}`,
3508
4045
  payload: objectValue5(step.payload),
3509
4046
  toolInput: objectValue5(step.toolInput) ?? objectValue5(step.tool_input),
3510
4047
  toolOutput: objectValue5(step.toolResult) ?? objectValue5(step.tool_result),
@@ -3533,11 +4070,11 @@ function patchBatchFromPayload(input) {
3533
4070
  return [
3534
4071
  {
3535
4072
  cwd: firstNonEmptyString(
3536
- stringValue6(input.payload?.cwd),
3537
- stringValue6(payloadInput?.cwd),
3538
- stringValue6(rawInput?.cwd),
3539
- stringValue6(payloadOutput?.cwd),
3540
- stringValue6(metadata?.cwd),
4073
+ stringValue7(input.payload?.cwd),
4074
+ stringValue7(payloadInput?.cwd),
4075
+ stringValue7(rawInput?.cwd),
4076
+ stringValue7(payloadOutput?.cwd),
4077
+ stringValue7(metadata?.cwd),
3541
4078
  input.options.defaultCwd ?? null
3542
4079
  ) ?? null,
3543
4080
  toolCallId: input.id,
@@ -3554,10 +4091,10 @@ function patchChangesFromChangeMap(changes) {
3554
4091
  }
3555
4092
  const normalizedType = normalizeChangeType(fileChangeTypeValue(change));
3556
4093
  const unifiedDiff = firstNonEmptyString(
3557
- stringValue6(change.unified_diff),
3558
- stringValue6(change.unifiedDiff),
3559
- stringValue6(change.diff),
3560
- stringValue6(change.patch)
4094
+ stringValue7(change.unified_diff),
4095
+ stringValue7(change.unifiedDiff),
4096
+ stringValue7(change.diff),
4097
+ stringValue7(change.patch)
3561
4098
  ) ?? null;
3562
4099
  let oldString = firstPresentString6(
3563
4100
  literalStringValue(change.old_string),
@@ -3633,10 +4170,10 @@ function extractFileChanges(input) {
3633
4170
  input.occurredAtUnixMs,
3634
4171
  arrayValue5(objectValue5(payload?.fileChanges)?.files),
3635
4172
  firstNonEmptyString(
3636
- stringValue6(input.input?.patch),
3637
- stringValue6(input.output?.patch),
3638
- stringValue6(payload?.patch),
3639
- stringValue6(metadata?.patch)
4173
+ stringValue7(input.input?.patch),
4174
+ stringValue7(input.output?.patch),
4175
+ stringValue7(payload?.patch),
4176
+ stringValue7(metadata?.patch)
3640
4177
  ),
3641
4178
  firstPresentString6(
3642
4179
  literalStringValue(input.output?.oldString),
@@ -3680,24 +4217,24 @@ function extractFileChanges(input) {
3680
4217
  if (filesFromContentDiff.length > 0) {
3681
4218
  return filesFromContentDiff;
3682
4219
  }
3683
- const summaryFallbackPath = input.input?.summaryPathFallback === true ? stringValue6(input.input?.path) : null;
3684
- 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);
3685
4222
  const filePath = firstNonEmptyString(
3686
4223
  firstPathValue(payloadPaths),
3687
- stringValue6(input.input?.file_path),
3688
- stringValue6(input.input?.filePath),
4224
+ stringValue7(input.input?.file_path),
4225
+ stringValue7(input.input?.filePath),
3689
4226
  explicitInputPath,
3690
- stringValue6(input.input?.notebook_path),
3691
- stringValue6(input.output?.file_path),
3692
- stringValue6(input.output?.filePath),
3693
- stringValue6(input.output?.path),
3694
- 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),
3695
4232
  firstLocationPath(inputLocations),
3696
4233
  firstLocationPath(payloadLocations)
3697
4234
  ) ?? extractAgentPatchPath(
3698
4235
  firstNonEmptyString(
3699
- stringValue6(input.input?.patch),
3700
- stringValue6(input.output?.patch)
4236
+ stringValue7(input.input?.patch),
4237
+ stringValue7(input.output?.patch)
3701
4238
  )
3702
4239
  ) ?? summaryFallbackPath;
3703
4240
  const normalizedFilePathValue = normalizedFilePath(filePath, input.options);
@@ -3705,11 +4242,11 @@ function extractFileChanges(input) {
3705
4242
  return [];
3706
4243
  }
3707
4244
  const patch = firstNonEmptyString(
3708
- stringValue6(input.input?.patch),
3709
- stringValue6(input.output?.patch),
3710
- stringValue6(payload?.patch),
3711
- stringValue6(metadata?.patch),
3712
- 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)
3713
4250
  ) ?? null;
3714
4251
  const oldString = firstPresentString6(
3715
4252
  literalStringValue(input.output?.oldString),
@@ -3732,10 +4269,10 @@ function extractFileChanges(input) {
3732
4269
  );
3733
4270
  const explicitChangeType = normalizeChangeType(
3734
4271
  firstNonEmptyString(
3735
- stringValue6(payload?.fileChangeKind),
3736
- stringValue6(metadata?.fileChangeKind),
3737
- stringValue6(input.input?.fileChangeKind),
3738
- stringValue6(input.output?.fileChangeKind)
4272
+ stringValue7(payload?.fileChangeKind),
4273
+ stringValue7(metadata?.fileChangeKind),
4274
+ stringValue7(input.input?.fileChangeKind),
4275
+ stringValue7(input.output?.fileChangeKind)
3739
4276
  )
3740
4277
  ) ?? null;
3741
4278
  const changeType = explicitChangeType ?? (normalizedToolName === "write" || normalizedToolName === "writefile" ? "created" : normalizedToolName === "notebookedit" ? "created" : inferAgentPatchChangeType(patch));
@@ -3775,16 +4312,16 @@ function isStructuredWriteTool(normalizedToolName, payload, metadata) {
3775
4312
  return false;
3776
4313
  }
3777
4314
  const activityKind = firstNonEmptyString(
3778
- stringValue6(payload?.activityKind),
3779
- stringValue6(metadata?.activityKind)
4315
+ stringValue7(payload?.activityKind),
4316
+ stringValue7(metadata?.activityKind)
3780
4317
  );
3781
4318
  if (activityKind === "write_file" || activityKind === "edit_file" || activityKind === "delete_file") {
3782
4319
  return true;
3783
4320
  }
3784
4321
  return normalizeChangeType(
3785
4322
  firstNonEmptyString(
3786
- stringValue6(payload?.fileChangeKind),
3787
- stringValue6(metadata?.fileChangeKind)
4323
+ stringValue7(payload?.fileChangeKind),
4324
+ stringValue7(metadata?.fileChangeKind)
3788
4325
  )
3789
4326
  ) !== null;
3790
4327
  }
@@ -3794,11 +4331,11 @@ function collectMetadataFiles(messageId, toolName, occurredAtUnixMs, files, patc
3794
4331
  }
3795
4332
  return files.flatMap((value, index) => {
3796
4333
  const file = objectValue5(value);
3797
- const path = normalizedFilePath(stringValue6(file?.path), options);
4334
+ const path = normalizedFilePath(stringValue7(file?.path), options);
3798
4335
  if (!path) {
3799
4336
  return [];
3800
4337
  }
3801
- const change = normalizeChangeType(stringValue6(file?.change));
4338
+ const change = normalizeChangeType(stringValue7(file?.change));
3802
4339
  return [
3803
4340
  buildFileChange({
3804
4341
  id: `${messageId}:${index + 1}`,
@@ -3823,10 +4360,10 @@ function collectChangeMapFiles(messageId, toolName, occurredAtUnixMs, changes, o
3823
4360
  }
3824
4361
  const normalizedType = normalizeChangeType(fileChangeTypeValue(change));
3825
4362
  const unifiedDiff = firstNonEmptyString(
3826
- stringValue6(change.unified_diff),
3827
- stringValue6(change.unifiedDiff),
3828
- stringValue6(change.diff),
3829
- stringValue6(change.patch)
4363
+ stringValue7(change.unified_diff),
4364
+ stringValue7(change.unifiedDiff),
4365
+ stringValue7(change.diff),
4366
+ stringValue7(change.patch)
3830
4367
  );
3831
4368
  let oldString = firstPresentString6(
3832
4369
  literalStringValue(change.old_string),
@@ -3885,11 +4422,11 @@ function collectContentDiffFiles(messageId, toolName, occurredAtUnixMs, contentI
3885
4422
  if (!item) {
3886
4423
  return [];
3887
4424
  }
3888
- const type = stringValue6(item.type);
4425
+ const type = stringValue7(item.type);
3889
4426
  if (type && type !== "diff") {
3890
4427
  return [];
3891
4428
  }
3892
- const path = normalizedFilePath(stringValue6(item.path), options);
4429
+ const path = normalizedFilePath(stringValue7(item.path), options);
3893
4430
  if (!path) {
3894
4431
  return [];
3895
4432
  }
@@ -3898,10 +4435,10 @@ function collectContentDiffFiles(messageId, toolName, occurredAtUnixMs, contentI
3898
4435
  relatedChange ? fileChangeTypeValue(relatedChange) : null
3899
4436
  );
3900
4437
  const unifiedDiff = firstNonEmptyString(
3901
- stringValue6(item.diff),
3902
- stringValue6(item.patch),
3903
- stringValue6(relatedChange?.unified_diff),
3904
- stringValue6(relatedChange?.unifiedDiff)
4438
+ stringValue7(item.diff),
4439
+ stringValue7(item.patch),
4440
+ stringValue7(relatedChange?.unified_diff),
4441
+ stringValue7(relatedChange?.unifiedDiff)
3905
4442
  );
3906
4443
  let oldString = firstPresentString6(
3907
4444
  literalStringValue(item.oldText),
@@ -4187,9 +4724,9 @@ function nestedTaskStepsFromPayload(payload, output) {
4187
4724
  }
4188
4725
  function nestedTaskStepStatusKind(step, fallback) {
4189
4726
  return firstNonEmptyString(
4190
- stringValue6(step.statusKind),
4191
- stringValue6(step.status),
4192
- stringValue6(step.toolStatus)
4727
+ stringValue7(step.statusKind),
4728
+ stringValue7(step.status),
4729
+ stringValue7(step.toolStatus)
4193
4730
  ) ?? fallback ?? null;
4194
4731
  }
4195
4732
  function firstLocationPath(value) {
@@ -4198,7 +4735,7 @@ function firstLocationPath(value) {
4198
4735
  }
4199
4736
  for (const item of value) {
4200
4737
  const record = objectValue5(item);
4201
- const path = stringValue6(record?.path);
4738
+ const path = stringValue7(record?.path);
4202
4739
  if (path) {
4203
4740
  return path;
4204
4741
  }
@@ -4210,14 +4747,14 @@ function firstPathValue(value) {
4210
4747
  return null;
4211
4748
  }
4212
4749
  for (const item of value) {
4213
- const path = stringValue6(item);
4750
+ const path = stringValue7(item);
4214
4751
  if (path) {
4215
4752
  return path;
4216
4753
  }
4217
4754
  }
4218
4755
  return null;
4219
4756
  }
4220
- function stringValue6(value) {
4757
+ function stringValue7(value) {
4221
4758
  return typeof value === "string" && value.trim() ? value.trim() : null;
4222
4759
  }
4223
4760
  function literalStringValue(value) {
@@ -4730,7 +5267,7 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
4730
5267
  if (!content) {
4731
5268
  return [];
4732
5269
  }
4733
- const displayPrompt = firstString2(
5270
+ const displayPrompt = firstString3(
4734
5271
  message.sourceTimelineItems?.map(
4735
5272
  (candidate) => typeof candidate.payload?.displayPrompt === "string" ? candidate.payload.displayPrompt : ""
4736
5273
  ) ?? []
@@ -4771,7 +5308,7 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
4771
5308
  }
4772
5309
  return [{ type: "text", text: displayPrompt }, ...blocks];
4773
5310
  }
4774
- function firstString2(values) {
5311
+ function firstString3(values) {
4775
5312
  for (const value of values) {
4776
5313
  const trimmed = value.trim();
4777
5314
  if (trimmed) {
@@ -4941,18 +5478,19 @@ function AgentTranscriptSkeleton({
4941
5478
 
4942
5479
  // shared/agentConversation/components/AgentTranscriptView.tsx
4943
5480
  import {
4944
- Fragment as Fragment6,
4945
- memo as memo3,
5481
+ Fragment as Fragment7,
5482
+ memo as memo4,
4946
5483
  useCallback as useCallback10,
5484
+ useEffect as useEffect11,
4947
5485
  useLayoutEffect as useLayoutEffect2,
4948
5486
  useMemo as useMemo6,
4949
5487
  useRef as useRef8,
4950
- useState as useState17
5488
+ useState as useState18
4951
5489
  } from "react";
4952
5490
  import { useVirtualizer } from "@tanstack/react-virtual";
4953
5491
 
4954
5492
  // shared/agentConversation/components/AgentTranscriptItemView.tsx
4955
- import { memo as memo2, useCallback as useCallback9 } from "react";
5493
+ import { memo as memo3, useCallback as useCallback9 } from "react";
4956
5494
 
4957
5495
  // shared/agentConversation/actions/agentConversationLinkActions.ts
4958
5496
  function resolveAgentConversationLinkAction({
@@ -5310,7 +5848,7 @@ import { useEffect } from "react";
5310
5848
  import { EditorContent, useEditor } from "@tiptap/react";
5311
5849
 
5312
5850
  // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
5313
- import { mergeAttributes, Node } from "@tiptap/core";
5851
+ import { mergeAttributes, Node as Node2 } from "@tiptap/core";
5314
5852
 
5315
5853
  // agent-gui/agentGuiNode/model/agentSkillOptions.ts
5316
5854
  function skillTriggerForPrefix(skill, prefix) {
@@ -5365,7 +5903,7 @@ function stripSkillTriggerPrefix(trigger) {
5365
5903
 
5366
5904
  // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
5367
5905
  function createAgentSkillTokenExtension(options = {}) {
5368
- return Node.create({
5906
+ return Node2.create({
5369
5907
  name: "agentSkillToken",
5370
5908
  group: "inline",
5371
5909
  inline: true,
@@ -5477,9 +6015,9 @@ function skillTokenDisplayLabel(attrs) {
5477
6015
  }
5478
6016
 
5479
6017
  // agent-gui/agentGuiNode/agentRichText/agentCapabilityTokenExtension.ts
5480
- import { mergeAttributes as mergeAttributes2, Node as Node2 } from "@tiptap/core";
6018
+ import { mergeAttributes as mergeAttributes2, Node as Node3 } from "@tiptap/core";
5481
6019
  function createAgentCapabilityTokenExtension(options = {}) {
5482
- return Node2.create({
6020
+ return Node3.create({
5483
6021
  name: "agentCapabilityToken",
5484
6022
  group: "inline",
5485
6023
  inline: true,
@@ -6985,7 +7523,7 @@ var MESSAGE_COPY_FEEDBACK_MS = 1400;
6985
7523
  var CONTEXT_COMPACTION_NOTICE_TITLE = "Context compacted.";
6986
7524
  var TRANSPORT_RETRY_PROGRESS_PATTERN = /\b(reconnect(?:ing)?(?:\s*(?:\.\.\.|…|[.。]+|:|-))?\s*\(?\d+\s*\/\s*\d+\)?)/i;
6987
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%)]";
6988
- 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)]";
6989
7527
  function AgentMessageBlock({
6990
7528
  workspaceRoot,
6991
7529
  basePath,
@@ -7218,44 +7756,37 @@ function AgentUserImageGrid({
7218
7756
  return /* @__PURE__ */ jsx12(
7219
7757
  "div",
7220
7758
  {
7221
- className: "grid justify-self-end gap-2",
7759
+ className: AgentGUIConversation_styles_default.userImageGrid,
7222
7760
  style: {
7223
7761
  gridTemplateColumns: `repeat(${columnCount}, ${thumbnailWidth})`
7224
7762
  },
7225
7763
  children: images.map((image) => {
7226
7764
  const src = loadedImages.get(image.id) ?? imageDataUrl(image);
7227
7765
  const loading = !src && loadingIds.has(image.id);
7228
- 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(
7229
7776
  "div",
7230
7777
  {
7231
- className: "max-h-20 min-w-0 overflow-hidden rounded-[6px]",
7232
- children: src ? /* @__PURE__ */ jsx12(
7233
- 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,
7234
7782
  {
7235
- src,
7236
- alt: image.name?.trim() || "image",
7237
- className: "block max-h-20 w-full rounded-[6px] object-contain",
7238
- draggable: false,
7239
- downloadName: image.name?.trim() || "image.png"
7240
- }
7241
- ) : loading ? /* @__PURE__ */ jsx12(
7242
- "div",
7243
- {
7244
- className: "flex h-20 w-full items-center justify-center bg-[color-mix(in_srgb,var(--text-primary)_6%,transparent)]",
7245
- "data-testid": "agent-gui-message-image-loading",
7246
- children: /* @__PURE__ */ jsx12(
7247
- LoaderCircle,
7248
- {
7249
- "aria-hidden": "true",
7250
- className: "size-5 animate-spin text-[color-mix(in_srgb,var(--text-primary)_45%,transparent)]",
7251
- strokeWidth: 2
7252
- }
7253
- )
7783
+ "aria-hidden": "true",
7784
+ className: "size-5 animate-spin text-[color-mix(in_srgb,var(--text-primary)_45%,transparent)]",
7785
+ strokeWidth: 2
7254
7786
  }
7255
- ) : /* @__PURE__ */ jsx12("div", { className: "h-20 w-full animate-pulse bg-[color-mix(in_srgb,var(--text-primary)_8%,transparent)]" })
7256
- },
7257
- image.id
7258
- );
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);
7259
7790
  })
7260
7791
  }
7261
7792
  );
@@ -7386,8 +7917,8 @@ function AgentSystemNoticeMessage({
7386
7917
  }
7387
7918
  );
7388
7919
  }
7389
- const isStatusNotice = systemNoticeIsStatus(notice);
7390
- const noticeToneClassName = systemNoticeToneClassName(notice);
7920
+ const isStatusNotice = systemNoticeIsStatus(message);
7921
+ const noticeToneClassName = systemNoticeToneClassName(message);
7391
7922
  return /* @__PURE__ */ jsx12(
7392
7923
  "section",
7393
7924
  {
@@ -7400,8 +7931,9 @@ function AgentSystemNoticeMessage({
7400
7931
  }
7401
7932
  );
7402
7933
  }
7403
- function systemNoticeToneClassName(notice) {
7404
- 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)) {
7405
7937
  return SYSTEM_NOTICE_ERROR_CLASS_NAME;
7406
7938
  }
7407
7939
  if (notice?.severity === "warning") {
@@ -7409,8 +7941,14 @@ function systemNoticeToneClassName(notice) {
7409
7941
  }
7410
7942
  return SYSTEM_NOTICE_WARNING_CLASS_NAME;
7411
7943
  }
7412
- function systemNoticeIsStatus(notice) {
7413
- 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");
7414
7952
  }
7415
7953
  function transportRetryNoticeText(message) {
7416
7954
  const notice = message.systemNotice;
@@ -7657,8 +8195,8 @@ function LoadingEllipsis2() {
7657
8195
  }
7658
8196
 
7659
8197
  // shared/agentConversation/components/AgentToolGroupRow.tsx
7660
- import { memo, useState as useState15 } from "react";
7661
- 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";
7662
8200
 
7663
8201
  // shared/agentConversation/components/AgentAskUserQuestionCard.tsx
7664
8202
  import { useState as useState12 } from "react";
@@ -8180,9 +8718,9 @@ function WriteLinedIcon(props) {
8180
8718
 
8181
8719
  // shared/agentConversation/components/tool-renderers/render-data/agentToolFileChangeRenderData.ts
8182
8720
  function getFileChangeRenderData(call) {
8183
- const payloadInput = recordValue4(call.payload?.input);
8184
- const payloadOutput = recordValue4(call.payload?.output);
8185
- 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);
8186
8724
  const inputLocations = arrayValue6(call.locations) ?? arrayValue6(call.input?.locations) ?? arrayValue6(payloadInput?.locations);
8187
8725
  const fromStructuredPatch = structuredPatchFiles(
8188
8726
  call.output?.structuredPatch ?? payloadOutput?.structuredPatch ?? call.payload?.structuredPatch
@@ -8216,44 +8754,44 @@ function getFileChangeRenderData(call) {
8216
8754
  if (fromContentDiff.length > 0) {
8217
8755
  return fromContentDiff;
8218
8756
  }
8219
- const inputPath = firstString3(
8220
- stringValue7(call.input?.file_path),
8221
- stringValue7(call.input?.filePath),
8222
- stringValue7(call.input?.path),
8223
- stringValue7(payloadInput?.file_path),
8224
- stringValue7(payloadInput?.filePath),
8225
- 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),
8226
8764
  firstLocationPath2(inputLocations)
8227
8765
  );
8228
- const unifiedDiff = firstString3(
8229
- stringValue7(call.output?.patch),
8230
- stringValue7(payloadOutput?.patch),
8231
- stringValue7(call.output?.diff),
8232
- 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)
8233
8771
  );
8234
- const path = firstString3(
8772
+ const path = firstString4(
8235
8773
  inputPath,
8236
8774
  unifiedDiff ? extractAgentPatchPath(unifiedDiff) : null
8237
8775
  );
8238
8776
  if (!path) {
8239
8777
  return [];
8240
8778
  }
8241
- const content = firstString3(
8242
- stringValue7(call.input?.content),
8243
- stringValue7(payloadInput?.content),
8244
- stringValue7(rawInput?.content)
8779
+ const content = firstString4(
8780
+ stringValue8(call.input?.content),
8781
+ stringValue8(payloadInput?.content),
8782
+ stringValue8(rawInput?.content)
8245
8783
  );
8246
- const oldString = firstString3(
8247
- stringValue7(call.input?.old_string),
8248
- stringValue7(payloadInput?.old_string),
8249
- stringValue7(call.output?.oldString),
8250
- 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)
8251
8789
  );
8252
- const newString = firstString3(
8253
- stringValue7(call.input?.new_string),
8254
- stringValue7(payloadInput?.new_string),
8255
- stringValue7(call.output?.newString),
8256
- 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)
8257
8795
  );
8258
8796
  const changeType = inferFileChangeType(
8259
8797
  call.toolName,
@@ -8290,33 +8828,33 @@ function structuredPatchFiles(value) {
8290
8828
  return [];
8291
8829
  }
8292
8830
  return patches.flatMap((item) => {
8293
- const patch = recordValue4(item);
8294
- const path = firstString3(
8295
- stringValue7(patch?.filePath),
8296
- stringValue7(patch?.path)
8831
+ const patch = recordValue5(item);
8832
+ const path = firstString4(
8833
+ stringValue8(patch?.filePath),
8834
+ stringValue8(patch?.path)
8297
8835
  );
8298
- const diff = firstString3(
8299
- stringValue7(patch?.diff),
8300
- stringValue7(patch?.patch)
8836
+ const diff = firstString4(
8837
+ stringValue8(patch?.diff),
8838
+ stringValue8(patch?.patch)
8301
8839
  );
8302
8840
  if (!path) {
8303
8841
  return [];
8304
8842
  }
8305
- const oldString = firstString3(
8306
- stringValue7(patch?.oldString),
8307
- stringValue7(patch?.old_string)
8843
+ const oldString = firstString4(
8844
+ stringValue8(patch?.oldString),
8845
+ stringValue8(patch?.old_string)
8308
8846
  );
8309
- const newString = firstString3(
8310
- stringValue7(patch?.newString),
8311
- stringValue7(patch?.new_string)
8847
+ const newString = firstString4(
8848
+ stringValue8(patch?.newString),
8849
+ stringValue8(patch?.new_string)
8312
8850
  );
8313
- const content = firstString3(stringValue7(patch?.content), newString);
8851
+ const content = firstString4(stringValue8(patch?.content), newString);
8314
8852
  if (!diff && !oldString && !newString && !content) {
8315
8853
  return [];
8316
8854
  }
8317
8855
  const changeType = firstKnownChangeType(
8318
- normalizeChangeType2(stringValue7(patch?.kind)),
8319
- normalizeChangeType2(stringValue7(patch?.change)),
8856
+ normalizeChangeType2(stringValue8(patch?.kind)),
8857
+ normalizeChangeType2(stringValue8(patch?.change)),
8320
8858
  inferFileChangeType(null, diff, content, oldString, newString)
8321
8859
  );
8322
8860
  const stats = fileChangeStats(
@@ -8342,7 +8880,7 @@ function structuredPatchFiles(value) {
8342
8880
  });
8343
8881
  }
8344
8882
  function detailedDiffFiles(value) {
8345
- const diff = stringValue7(value);
8883
+ const diff = stringValue8(value);
8346
8884
  if (!diff) {
8347
8885
  return [];
8348
8886
  }
@@ -8367,30 +8905,30 @@ function detailedDiffFiles(value) {
8367
8905
  ];
8368
8906
  }
8369
8907
  function fileChangesFiles(value) {
8370
- const record = recordValue4(value);
8908
+ const record = recordValue5(value);
8371
8909
  const files = arrayValue6(record?.files);
8372
8910
  if (!files) {
8373
8911
  return [];
8374
8912
  }
8375
8913
  return files.flatMap((item) => {
8376
- const file = recordValue4(item);
8377
- const path = stringValue7(file?.path);
8914
+ const file = recordValue5(item);
8915
+ const path = stringValue8(file?.path);
8378
8916
  if (!path) {
8379
8917
  return [];
8380
8918
  }
8381
- const diff = firstString3(stringValue7(file?.diff), stringValue7(file?.patch));
8382
- const oldString = firstString3(
8383
- stringValue7(file?.oldString),
8384
- 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)
8385
8923
  );
8386
- const newString = firstString3(
8387
- stringValue7(file?.newString),
8388
- stringValue7(file?.new_string)
8924
+ const newString = firstString4(
8925
+ stringValue8(file?.newString),
8926
+ stringValue8(file?.new_string)
8389
8927
  );
8390
- const content = firstString3(stringValue7(file?.content), newString);
8928
+ const content = firstString4(stringValue8(file?.content), newString);
8391
8929
  const changeType = firstKnownChangeType(
8392
- normalizeChangeType2(stringValue7(file?.change)),
8393
- normalizeChangeType2(stringValue7(file?.kind)),
8930
+ normalizeChangeType2(stringValue8(file?.change)),
8931
+ normalizeChangeType2(stringValue8(file?.kind)),
8394
8932
  inferFileChangeType(null, diff, content, oldString, newString)
8395
8933
  );
8396
8934
  const stats = fileChangeStats(
@@ -8422,21 +8960,21 @@ function changeMapFiles(value) {
8422
8960
  if (!normalizedPath) {
8423
8961
  return [];
8424
8962
  }
8425
- const unifiedDiff = firstString3(
8426
- stringValue7(change.unified_diff),
8427
- stringValue7(change.unifiedDiff),
8428
- stringValue7(change.diff),
8429
- stringValue7(change.patch)
8963
+ const unifiedDiff = firstString4(
8964
+ stringValue8(change.unified_diff),
8965
+ stringValue8(change.unifiedDiff),
8966
+ stringValue8(change.diff),
8967
+ stringValue8(change.patch)
8430
8968
  );
8431
- const explicitContent = stringValue7(change.content);
8969
+ const explicitContent = stringValue8(change.content);
8432
8970
  const normalizedType = normalizeChangeType2(fileChangeTypeValue(change));
8433
- let oldString = firstString3(
8434
- stringValue7(change.old_string),
8435
- stringValue7(change.oldString)
8971
+ let oldString = firstString4(
8972
+ stringValue8(change.old_string),
8973
+ stringValue8(change.oldString)
8436
8974
  );
8437
- let newString = firstString3(
8438
- stringValue7(change.new_string),
8439
- stringValue7(change.newString),
8975
+ let newString = firstString4(
8976
+ stringValue8(change.new_string),
8977
+ stringValue8(change.newString),
8440
8978
  explicitContent
8441
8979
  );
8442
8980
  if (normalizedType === "created" && oldString === null && newString !== null) {
@@ -8449,7 +8987,7 @@ function changeMapFiles(value) {
8449
8987
  if (normalizedType === "deleted" && newString === null && oldString !== null) {
8450
8988
  newString = "";
8451
8989
  }
8452
- const content = firstString3(
8990
+ const content = firstString4(
8453
8991
  normalizedType === "deleted" ? null : explicitContent,
8454
8992
  normalizedType === "created" ? newString : null
8455
8993
  );
@@ -8495,40 +9033,40 @@ function contentDiffFiles(value, changesValue, toolName) {
8495
9033
  ])
8496
9034
  );
8497
9035
  return items.flatMap((item) => {
8498
- const record = recordValue4(item);
9036
+ const record = recordValue5(item);
8499
9037
  if (!record) {
8500
9038
  return [];
8501
9039
  }
8502
- const type = stringValue7(record.type);
9040
+ const type = stringValue8(record.type);
8503
9041
  if (type && type !== "diff") {
8504
9042
  return [];
8505
9043
  }
8506
- const path = stringValue7(record.path);
9044
+ const path = stringValue8(record.path);
8507
9045
  if (!path) {
8508
9046
  return [];
8509
9047
  }
8510
9048
  const relatedChange = changesByPath.get(path) ?? null;
8511
- const unifiedDiff = firstString3(
8512
- stringValue7(record.diff),
8513
- stringValue7(record.patch),
8514
- stringValue7(relatedChange?.unified_diff),
8515
- stringValue7(relatedChange?.unifiedDiff)
9049
+ const unifiedDiff = firstString4(
9050
+ stringValue8(record.diff),
9051
+ stringValue8(record.patch),
9052
+ stringValue8(relatedChange?.unified_diff),
9053
+ stringValue8(relatedChange?.unifiedDiff)
8516
9054
  );
8517
9055
  const normalizedType = normalizeChangeType2(
8518
9056
  relatedChange ? fileChangeTypeValue(relatedChange) : null
8519
9057
  );
8520
- let oldString = firstString3(
8521
- stringValue7(record.oldText),
8522
- stringValue7(record.oldString),
8523
- stringValue7(relatedChange?.old_string),
8524
- stringValue7(relatedChange?.oldString)
9058
+ let oldString = firstString4(
9059
+ stringValue8(record.oldText),
9060
+ stringValue8(record.oldString),
9061
+ stringValue8(relatedChange?.old_string),
9062
+ stringValue8(relatedChange?.oldString)
8525
9063
  );
8526
- let newString = firstString3(
8527
- stringValue7(record.newText),
8528
- stringValue7(record.newString),
8529
- stringValue7(relatedChange?.new_string),
8530
- stringValue7(relatedChange?.newString),
8531
- 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)
8532
9070
  );
8533
9071
  if (normalizedType === "created" && oldString === null && newString !== null) {
8534
9072
  oldString = "";
@@ -8540,9 +9078,9 @@ function contentDiffFiles(value, changesValue, toolName) {
8540
9078
  if (normalizedType === "deleted" && newString === null && oldString !== null) {
8541
9079
  newString = "";
8542
9080
  }
8543
- const explicitContent = firstString3(
8544
- stringValue7(record.content),
8545
- stringValue7(relatedChange?.content)
9081
+ const explicitContent = firstString4(
9082
+ stringValue8(record.content),
9083
+ stringValue8(relatedChange?.content)
8546
9084
  );
8547
9085
  const changeType = firstKnownChangeType(
8548
9086
  normalizedType,
@@ -8557,7 +9095,7 @@ function contentDiffFiles(value, changesValue, toolName) {
8557
9095
  if (changeType === "created" && oldString === null && newString !== null) {
8558
9096
  oldString = "";
8559
9097
  }
8560
- const content = firstString3(
9098
+ const content = firstString4(
8561
9099
  changeType === "deleted" ? null : explicitContent,
8562
9100
  changeType === "created" ? newString : null
8563
9101
  );
@@ -8737,7 +9275,7 @@ function languageForPath(path) {
8737
9275
  function normalizeToolName6(value) {
8738
9276
  return (value ?? "").trim().replace(/[_\s-]+/g, "").toLowerCase();
8739
9277
  }
8740
- function firstString3(...values) {
9278
+ function firstString4(...values) {
8741
9279
  for (const value of values) {
8742
9280
  if (typeof value === "string" && value.trim()) {
8743
9281
  return value.trim();
@@ -8745,7 +9283,7 @@ function firstString3(...values) {
8745
9283
  }
8746
9284
  return null;
8747
9285
  }
8748
- function recordValue4(value) {
9286
+ function recordValue5(value) {
8749
9287
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
8750
9288
  }
8751
9289
  function arrayValue6(value) {
@@ -8756,42 +9294,42 @@ function firstLocationPath2(value) {
8756
9294
  return null;
8757
9295
  }
8758
9296
  for (const item of value) {
8759
- const record = recordValue4(item);
8760
- const path = stringValue7(record?.path);
9297
+ const record = recordValue5(item);
9298
+ const path = stringValue8(record?.path);
8761
9299
  if (path) {
8762
9300
  return path;
8763
9301
  }
8764
9302
  }
8765
9303
  return null;
8766
9304
  }
8767
- function stringValue7(value) {
9305
+ function stringValue8(value) {
8768
9306
  return typeof value === "string" && value.trim() ? value.trim() : null;
8769
9307
  }
8770
9308
 
8771
9309
  // shared/agentConversation/components/tool-renderers/render-data/agentToolRenderData.ts
8772
9310
  function getCommandRenderData(call) {
8773
- const inputRawInput = recordValue5(call.input?.rawInput);
8774
- const payloadInput = recordValue5(call.payload?.input);
8775
- const payloadInputRawInput = recordValue5(payloadInput?.rawInput);
8776
- const outputRawOutput = recordValue5(call.output?.rawOutput);
8777
- 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);
8778
9316
  return {
8779
- command: firstString4(
8780
- stringValue8(call.input?.command),
8781
- stringValue8(call.input?.cmd),
9317
+ command: firstString5(
9318
+ stringValue9(call.input?.command),
9319
+ stringValue9(call.input?.cmd),
8782
9320
  commandArrayToString(call.input?.command),
8783
- stringValue8(inputRawInput?.command),
8784
- stringValue8(inputRawInput?.cmd),
8785
- stringValue8(call.payload?.command),
8786
- stringValue8(payloadInput?.command),
8787
- stringValue8(payloadInputRawInput?.command),
8788
- 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)
8789
9327
  ),
8790
- cwd: firstString4(
8791
- stringValue8(call.input?.cwd),
8792
- stringValue8(inputRawInput?.cwd),
8793
- stringValue8(payloadInput?.cwd),
8794
- stringValue8(payloadInputRawInput?.cwd)
9328
+ cwd: firstString5(
9329
+ stringValue9(call.input?.cwd),
9330
+ stringValue9(inputRawInput?.cwd),
9331
+ stringValue9(payloadInput?.cwd),
9332
+ stringValue9(payloadInputRawInput?.cwd)
8795
9333
  ),
8796
9334
  stdout: firstRawString(
8797
9335
  rawStringValue(call.output?.stdout),
@@ -8826,42 +9364,42 @@ function getCommandRenderData(call) {
8826
9364
  function getSearchRenderData(call) {
8827
9365
  const canonicalContent = contentText(call.content);
8828
9366
  const canonicalFiles = locationPaths(call.locations);
8829
- const output = firstString4(
9367
+ const output = firstString5(
8830
9368
  canonicalContent,
8831
9369
  contentText(call.output?.content),
8832
- stringValue8(call.output?.content),
8833
- stringValue8(call.output?.output),
8834
- stringValue8(call.output?.aggregated_output),
8835
- stringValue8(call.output?.formatted_output),
8836
- stringValue8(call.output?.stdout),
8837
- 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),
8838
9376
  ""
8839
9377
  ) ?? "";
8840
9378
  const outputLines = output.split("\n").filter(Boolean);
8841
9379
  const mode = canonicalFiles.length > 0 && !output ? "list_files" : searchMode(call.output, output);
8842
9380
  const filenames = canonicalFiles.length > 0 ? canonicalFiles : stringArray(call.output?.filenames);
8843
9381
  return {
8844
- query: firstString4(
8845
- stringValue8(call.input?.pattern),
8846
- stringValue8(call.input?.query),
8847
- stringValue8(call.input?.search_query),
8848
- stringValue8(call.input?.searchQuery),
8849
- 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)
8850
9388
  ),
8851
- scope: firstString4(
8852
- stringValue8(call.input?.path),
8853
- stringValue8(call.input?.file_path),
8854
- stringValue8(call.input?.glob)
9389
+ scope: firstString5(
9390
+ stringValue9(call.input?.path),
9391
+ stringValue9(call.input?.file_path),
9392
+ stringValue9(call.input?.glob)
8855
9393
  ),
8856
9394
  mode,
8857
9395
  files: filenames.length > 0 ? filenames : mode === "list_files" ? outputLines : [],
8858
9396
  lines: outputLines,
8859
9397
  output,
8860
- error: firstString4(
8861
- stringValue8(call.error?.aggregated_output),
8862
- stringValue8(call.error?.stdout),
8863
- stringValue8(call.error?.formatted_output),
8864
- 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)
8865
9403
  ) ?? ""
8866
9404
  };
8867
9405
  }
@@ -8869,43 +9407,43 @@ function getWebSearchRenderData(call) {
8869
9407
  const queries = normalizedQueries(
8870
9408
  call.input?.search_query,
8871
9409
  call.input?.searchQuery,
8872
- recordValue5(call.input?.action)?.search_query,
8873
- recordValue5(call.input?.action)?.searchQuery
9410
+ recordValue6(call.input?.action)?.search_query,
9411
+ recordValue6(call.input?.action)?.searchQuery
8874
9412
  );
8875
9413
  return {
8876
- query: firstString4(
8877
- stringValue8(call.input?.query),
8878
- stringValue8(recordValue5(call.input?.action)?.query),
9414
+ query: firstString5(
9415
+ stringValue9(call.input?.query),
9416
+ stringValue9(recordValue6(call.input?.action)?.query),
8879
9417
  queries[0] ?? null
8880
9418
  ),
8881
9419
  queries,
8882
- url: firstString4(
8883
- stringValue8(call.input?.url),
8884
- stringValue8(recordValue5(call.input?.action)?.url)
9420
+ url: firstString5(
9421
+ stringValue9(call.input?.url),
9422
+ stringValue9(recordValue6(call.input?.action)?.url)
8885
9423
  ),
8886
- output: firstString4(
8887
- stringValue8(call.output?.stdout),
8888
- stringValue8(call.output?.output),
8889
- stringValue8(call.output?.content),
9424
+ output: firstString5(
9425
+ stringValue9(call.output?.stdout),
9426
+ stringValue9(call.output?.output),
9427
+ stringValue9(call.output?.content),
8890
9428
  contentText(call.output?.content)
8891
9429
  ) ?? "",
8892
- error: firstString4(
8893
- stringValue8(call.error?.message),
8894
- stringValue8(call.error?.stdout)
9430
+ error: firstString5(
9431
+ stringValue9(call.error?.message),
9432
+ stringValue9(call.error?.stdout)
8895
9433
  ) ?? ""
8896
9434
  };
8897
9435
  }
8898
9436
  function getWebFetchRenderData(call, maxContentLength = 3e3) {
8899
- const url = firstString4(
8900
- stringValue8(call.input?.url),
8901
- stringValue8(recordValue5(call.input?.action)?.url)
9437
+ const url = firstString5(
9438
+ stringValue9(call.input?.url),
9439
+ stringValue9(recordValue6(call.input?.action)?.url)
8902
9440
  );
8903
- const content = firstString4(
9441
+ const content = firstString5(
8904
9442
  contentText(call.content),
8905
9443
  contentText(call.output?.content),
8906
- stringValue8(call.output?.output),
8907
- stringValue8(call.output?.content),
8908
- stringValue8(call.output?.stdout)
9444
+ stringValue9(call.output?.output),
9445
+ stringValue9(call.output?.content),
9446
+ stringValue9(call.output?.stdout)
8909
9447
  );
8910
9448
  return {
8911
9449
  url,
@@ -8921,21 +9459,21 @@ function getTodoRenderData(call) {
8921
9459
  return [];
8922
9460
  }
8923
9461
  return todos.flatMap((todo) => {
8924
- const record = recordValue5(todo);
8925
- const content = firstString4(
8926
- stringValue8(record?.content),
8927
- stringValue8(record?.text)
9462
+ const record = recordValue6(todo);
9463
+ const content = firstString5(
9464
+ stringValue9(record?.content),
9465
+ stringValue9(record?.text)
8928
9466
  );
8929
9467
  if (!content) {
8930
9468
  return [];
8931
9469
  }
8932
- return [{ content, status: stringValue8(record?.status) }];
9470
+ return [{ content, status: stringValue9(record?.status) }];
8933
9471
  });
8934
9472
  }
8935
9473
  function getToolSearchRenderData(call) {
8936
- const query = stringValue8(call.input?.query);
8937
- const matches = arrayValue7(call.output?.matches)?.map(stringValue8).filter((value) => value !== null) ?? [];
8938
- 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);
8939
9477
  const mode = query?.startsWith("select:") ? "direct" : "search";
8940
9478
  const displayQuery = query?.startsWith("select:") ? query.slice("select:".length) : query?.startsWith("+") ? query.slice(1) : query;
8941
9479
  return {
@@ -8947,22 +9485,22 @@ function getToolSearchRenderData(call) {
8947
9485
  };
8948
9486
  }
8949
9487
  function getPlanModeRenderData(call) {
8950
- const enterText = call.rendererKind === "plan-enter" ? firstString4(
8951
- stringValue8(call.planMode?.plan),
8952
- stringValue8(call.output?.text),
8953
- 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),
8954
9492
  nonEmpty(call.summary),
8955
9493
  "Exploring codebase and designing implementation approach."
8956
9494
  ) : null;
8957
- const filePath = firstString4(
8958
- stringValue8(call.input?.filePath),
8959
- stringValue8(call.input?.file_path)
9495
+ const filePath = firstString5(
9496
+ stringValue9(call.input?.filePath),
9497
+ stringValue9(call.input?.file_path)
8960
9498
  );
8961
9499
  return {
8962
9500
  enterText,
8963
- plan: call.rendererKind === "plan-enter" ? null : firstString4(
8964
- stringValue8(call.input?.plan),
8965
- stringValue8(call.payload?.plan),
9501
+ plan: call.rendererKind === "plan-enter" ? null : firstString5(
9502
+ stringValue9(call.input?.plan),
9503
+ stringValue9(call.payload?.plan),
8966
9504
  nonEmpty(call.summary)
8967
9505
  ),
8968
9506
  filePath,
@@ -8972,47 +9510,49 @@ function getPlanModeRenderData(call) {
8972
9510
  function getTaskRenderData(call) {
8973
9511
  const task = call.task;
8974
9512
  const steps = task?.steps ?? normalizeTaskStepsFromCall(call);
9513
+ const outputRawOutput = recordValue6(call.output?.rawOutput);
9514
+ const errorRawOutput = recordValue6(call.error?.rawOutput);
8975
9515
  return {
8976
9516
  title: task?.title ?? call.name,
8977
9517
  status: task?.status ?? null,
8978
9518
  durationText: typeof task?.durationMs === "number" && Number.isFinite(task.durationMs) ? formatDuration(task.durationMs) : null,
8979
9519
  latestStepSummary: task?.status === "running" ? steps.at(-1)?.summary ?? null : null,
8980
- prompt: firstString4(
8981
- stringValue8(task?.prompt),
8982
- stringValue8(call.input?.prompt),
8983
- stringValue8(call.input?.description),
8984
- 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)
8985
9525
  ),
8986
- childSessionId: firstString4(
8987
- stringValue8(task?.delegateSessionId),
8988
- stringValue8(call.metadata?.childSessionID),
8989
- stringValue8(call.metadata?.child_session_id),
8990
- stringValue8(call.metadata?.subagentSessionID),
8991
- 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)
8992
9532
  ),
8993
9533
  steps,
8994
- resultMarkdown: firstString4(
8995
- stringValue8(task?.resultMarkdown),
8996
- firstNonEmptyStructuredText(call.output, call.error),
8997
- nonEmpty(call.summary)
8998
- )
9534
+ resultMarkdown: firstString5(
9535
+ stringValue9(task?.resultMarkdown),
9536
+ firstNonEmptyStructuredText(call.output, outputRawOutput)
9537
+ ),
9538
+ errorMarkdown: firstNonEmptyStructuredText(call.error, errorRawOutput)
8999
9539
  };
9000
9540
  }
9001
9541
  function getSkillRenderData(call) {
9002
- const inputRawInput = recordValue5(call.input?.rawInput);
9542
+ const inputRawInput = recordValue6(call.input?.rawInput);
9003
9543
  const outputRawOutput = call.output?.rawOutput;
9004
- 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);
9005
9545
  return {
9006
- skill: firstString4(
9007
- stringValue8(call.input?.skill),
9008
- stringValue8(inputRawInput?.skill),
9009
- stringValue8(call.output?.commandName),
9010
- 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),
9011
9551
  nonEmpty(call.summary)
9012
9552
  ),
9013
- args: firstString4(
9014
- stringValue8(call.input?.args),
9015
- stringValue8(inputRawInput?.args)
9553
+ args: firstString5(
9554
+ stringValue9(call.input?.args),
9555
+ stringValue9(inputRawInput?.args)
9016
9556
  ),
9017
9557
  success,
9018
9558
  statusText: success === null ? null : success ? "Skill loaded" : "Failed to load skill"
@@ -9025,7 +9565,7 @@ function getImageGenerationRenderData(call) {
9025
9565
  content: call.content,
9026
9566
  outputContent: call.output?.content,
9027
9567
  inputPrompt: call.input?.prompt,
9028
- payloadInputPrompt: recordValue5(call.payload?.input)?.prompt
9568
+ payloadInputPrompt: recordValue6(call.payload?.input)?.prompt
9029
9569
  });
9030
9570
  return {
9031
9571
  prompt: preview.prompt,
@@ -9057,31 +9597,31 @@ function getToolFallbackText(call) {
9057
9597
  function normalizeTaskStepsFromCall(call) {
9058
9598
  const steps = arrayValue7(call.metadata?.steps) ?? arrayValue7(call.output?.steps) ?? arrayValue7(call.payload?.steps) ?? [];
9059
9599
  return steps.flatMap((value, index) => {
9060
- const step = recordValue5(value);
9600
+ const step = recordValue6(value);
9061
9601
  if (!step) {
9062
9602
  return [];
9063
9603
  }
9064
- 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;
9065
9605
  const name = toolName ? humanizeToolName2(toolName) : `Step ${index + 1}`;
9066
- 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;
9067
9607
  const summary = firstNonEmptyStructuredText(
9068
- recordValue5(step.toolResult),
9069
- recordValue5(step.tool_result),
9070
- recordValue5(step.toolInput),
9071
- recordValue5(step.tool_input)
9608
+ recordValue6(step.toolResult),
9609
+ recordValue6(step.tool_result),
9610
+ recordValue6(step.toolInput),
9611
+ recordValue6(step.tool_input)
9072
9612
  ) ?? "";
9073
9613
  return [
9074
9614
  {
9075
- id: stringValue8(step.toolUseId) ?? stringValue8(step.id) ?? `step-${index + 1}`,
9615
+ id: stringValue9(step.toolUseId) ?? stringValue9(step.id) ?? `step-${index + 1}`,
9076
9616
  turnId: call.turnId,
9077
9617
  name,
9078
9618
  toolName,
9079
9619
  status,
9080
9620
  summary,
9081
9621
  payload: {
9082
- input: recordValue5(step.toolInput) ?? recordValue5(step.tool_input),
9083
- output: recordValue5(step.toolResult) ?? recordValue5(step.tool_result),
9084
- 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)
9085
9625
  },
9086
9626
  tool: null,
9087
9627
  occurredAtUnixMs: null
@@ -9104,6 +9644,9 @@ function firstNonEmptyStructuredText(...values) {
9104
9644
  function booleanValue(value) {
9105
9645
  return typeof value === "boolean" ? value : null;
9106
9646
  }
9647
+ function formatAgentToolDurationMs(value) {
9648
+ return formatDuration(value);
9649
+ }
9107
9650
  function formatDuration(value) {
9108
9651
  if (value < 1e3) {
9109
9652
  return `${value}ms`;
@@ -9142,7 +9685,7 @@ function normalizeCommandStatus(value) {
9142
9685
  }
9143
9686
  }
9144
9687
  function searchMode(output, outputText) {
9145
- const mode = stringValue8(output?.mode);
9688
+ const mode = stringValue9(output?.mode);
9146
9689
  if (mode === "files_with_matches" || mode === "content" || mode === "count" || mode === "list_files") {
9147
9690
  return mode;
9148
9691
  }
@@ -9165,7 +9708,7 @@ function commandArrayToString(value) {
9165
9708
  return parts.length > 0 ? parts.join(" ") : null;
9166
9709
  }
9167
9710
  function durationToMs(value) {
9168
- const record = recordValue5(value);
9711
+ const record = recordValue6(value);
9169
9712
  if (!record) {
9170
9713
  return null;
9171
9714
  }
@@ -9182,15 +9725,15 @@ function contentText(value) {
9182
9725
  return null;
9183
9726
  }
9184
9727
  const text = items.flatMap((item) => {
9185
- const record = recordValue5(item);
9728
+ const record = recordValue6(item);
9186
9729
  if (!record) {
9187
9730
  return [];
9188
9731
  }
9189
9732
  return [
9190
- firstString4(
9191
- stringValue8(record.text),
9192
- stringValue8(record.content),
9193
- stringValue8(recordValue5(record.content)?.text)
9733
+ firstString5(
9734
+ stringValue9(record.text),
9735
+ stringValue9(record.content),
9736
+ stringValue9(recordValue6(record.content)?.text)
9194
9737
  )
9195
9738
  ].filter(Boolean);
9196
9739
  }).join("\n").trim();
@@ -9203,38 +9746,38 @@ function structuredText(value) {
9203
9746
  if (typeof value === "number" || typeof value === "boolean") {
9204
9747
  return String(value);
9205
9748
  }
9206
- const record = recordValue5(value);
9749
+ const record = recordValue6(value);
9207
9750
  if (!record) {
9208
9751
  return null;
9209
9752
  }
9210
- const preferred = firstString4(
9211
- stringValue8(record.plan),
9212
- stringValue8(record.text),
9213
- stringValue8(record.output),
9214
- stringValue8(record.content),
9753
+ const preferred = firstString5(
9754
+ stringValue9(record.plan),
9755
+ stringValue9(record.text),
9756
+ stringValue9(record.output),
9757
+ stringValue9(record.content),
9215
9758
  contentText(record.content),
9216
- stringValue8(record.summary),
9217
- stringValue8(record.result),
9218
- stringValue8(record.message),
9219
- stringValue8(record.aggregated_output),
9220
- stringValue8(record.formatted_output),
9221
- stringValue8(record.stdout),
9222
- stringValue8(record.stderr),
9223
- stringValue8(record.query),
9224
- stringValue8(record.path),
9225
- stringValue8(record.file),
9226
- stringValue8(record.filePath),
9227
- stringValue8(record.file_path),
9228
- stringValue8(record.url),
9229
- stringValue8(record.cmd),
9230
- 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)
9231
9774
  );
9232
9775
  if (preferred) {
9233
9776
  return preferred;
9234
9777
  }
9235
9778
  return null;
9236
9779
  }
9237
- function firstString4(...values) {
9780
+ function firstString5(...values) {
9238
9781
  for (const value of values) {
9239
9782
  if (typeof value === "string" && value.trim()) {
9240
9783
  return value.trim();
@@ -9253,13 +9796,13 @@ function firstRawString(...values) {
9253
9796
  function nonEmpty(value) {
9254
9797
  return typeof value === "string" && value.trim() ? value.trim() : null;
9255
9798
  }
9256
- function recordValue5(value) {
9799
+ function recordValue6(value) {
9257
9800
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
9258
9801
  }
9259
9802
  function arrayValue7(value) {
9260
9803
  return Array.isArray(value) ? value : null;
9261
9804
  }
9262
- function stringValue8(value) {
9805
+ function stringValue9(value) {
9263
9806
  return typeof value === "string" && value.trim() ? value.trim() : null;
9264
9807
  }
9265
9808
  function rawStringValue(value) {
@@ -9299,15 +9842,15 @@ function locationPaths(value) {
9299
9842
  return [];
9300
9843
  }
9301
9844
  const paths = locations.flatMap((location) => {
9302
- const record = recordValue5(location);
9845
+ const record = recordValue6(location);
9303
9846
  if (!record) {
9304
9847
  return [];
9305
9848
  }
9306
9849
  return [
9307
- firstString4(
9308
- stringValue8(record.path),
9309
- stringValue8(record.filePath),
9310
- stringValue8(record.file_path)
9850
+ firstString5(
9851
+ stringValue9(record.path),
9852
+ stringValue9(record.filePath),
9853
+ stringValue9(record.file_path)
9311
9854
  )
9312
9855
  ].filter((path) => path !== null);
9313
9856
  });
@@ -9325,6 +9868,7 @@ function AgentToolCallHeader({
9325
9868
  "use memo";
9326
9869
  const diffStats = diffStatsForCall(call);
9327
9870
  const isActive = call.statusKind === "working" || call.statusKind === "waiting";
9871
+ const isFailed = call.statusKind === "failed" || isFailedStatus(call.status);
9328
9872
  return /* @__PURE__ */ jsxs12(
9329
9873
  "div",
9330
9874
  {
@@ -9334,7 +9878,7 @@ function AgentToolCallHeader({
9334
9878
  isActive ? "tsh-inline-scanlight-group" : ""
9335
9879
  ].filter(Boolean).join(" "),
9336
9880
  children: [
9337
- /* @__PURE__ */ jsx19("div", { className: "workspace-agents-status-panel__detail-tool-row-icon tsh-inline-scanlight-icon", children: call.statusKind === "failed" ? /* @__PURE__ */ jsx19(
9881
+ /* @__PURE__ */ jsx19("div", { className: "workspace-agents-status-panel__detail-tool-row-icon tsh-inline-scanlight-icon", children: isFailed ? /* @__PURE__ */ jsx19(
9338
9882
  AlertCircle,
9339
9883
  {
9340
9884
  size: TOOL_ROW_ICON_SIZE,
@@ -9475,6 +10019,10 @@ function AgentToolCallHeader({
9475
10019
  function formatInlineStatusLabel2(label) {
9476
10020
  return /^[A-Z][a-z]+$/.test(label) ? label.toLowerCase() : label;
9477
10021
  }
10022
+ function isFailedStatus(value) {
10023
+ const normalized = (value ?? "").trim().toLowerCase();
10024
+ return normalized === "failed" || normalized === "error";
10025
+ }
9478
10026
  function formatInlineTitleLabel(label) {
9479
10027
  const trimmed = label.trim();
9480
10028
  if (!/[a-z]/.test(trimmed) || !/[A-Z]/.test(trimmed.slice(1))) {
@@ -10277,9 +10825,9 @@ function AgentReadContent({
10277
10825
  call
10278
10826
  }) {
10279
10827
  "use memo";
10280
- 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;
10281
10829
  const file = objectValue6(call.output?.file);
10282
- 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);
10283
10831
  const fileLineRange = fileRange(file);
10284
10832
  const fileTotalLines = numericValue(file?.totalLines);
10285
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(
@@ -10324,9 +10872,9 @@ function contentText2(value) {
10324
10872
  const record = item;
10325
10873
  const nestedContent = record.content && typeof record.content === "object" && !Array.isArray(record.content) ? record.content : null;
10326
10874
  return [
10327
- stringValue9(record.text),
10328
- stringValue9(record.content),
10329
- stringValue9(nestedContent?.text)
10875
+ stringValue10(record.text),
10876
+ stringValue10(record.content),
10877
+ stringValue10(nestedContent?.text)
10330
10878
  ].filter((entry) => Boolean(entry));
10331
10879
  }).join("\n").trim();
10332
10880
  return text || null;
@@ -10530,13 +11078,13 @@ function hasWebSearchContent(call) {
10530
11078
  function hasReadContent(call) {
10531
11079
  const file = objectValue6(call.output?.file);
10532
11080
  return Boolean(
10533
- 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
10534
11082
  );
10535
11083
  }
10536
11084
  function hasWriteContent(call) {
10537
11085
  const files = getFileChangeRenderData(call);
10538
11086
  return Boolean(
10539
- 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))
10540
11088
  );
10541
11089
  }
10542
11090
  function hasEditContent(call) {
@@ -10544,7 +11092,7 @@ function hasEditContent(call) {
10544
11092
  return Boolean(
10545
11093
  files.some(
10546
11094
  (file) => file.unifiedDiff || file.oldString !== null && file.newString !== null || file.content
10547
- ) || 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))
10548
11096
  );
10549
11097
  }
10550
11098
  function readContentText(value) {
@@ -10558,9 +11106,9 @@ function readContentText(value) {
10558
11106
  const record = item;
10559
11107
  const nestedContent = record.content && typeof record.content === "object" && !Array.isArray(record.content) ? record.content : null;
10560
11108
  return [
10561
- stringValue9(record.text),
10562
- stringValue9(record.content),
10563
- stringValue9(nestedContent?.text)
11109
+ stringValue10(record.text),
11110
+ stringValue10(record.content),
11111
+ stringValue10(nestedContent?.text)
10564
11112
  ].filter((entry) => Boolean(entry));
10565
11113
  }).join("\n").trim();
10566
11114
  return text || null;
@@ -10574,7 +11122,7 @@ function objectValue6(value) {
10574
11122
  function arrayValue8(value) {
10575
11123
  return Array.isArray(value) ? value : null;
10576
11124
  }
10577
- function stringValue9(value) {
11125
+ function stringValue10(value) {
10578
11126
  return typeof value === "string" && value.trim() ? value.trim() : null;
10579
11127
  }
10580
11128
  function numericValue2(value) {
@@ -10682,7 +11230,7 @@ function AgentEditContent({
10682
11230
  "use memo";
10683
11231
  const files = getFileChangeRenderData(call);
10684
11232
  const [file] = files;
10685
- 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;
10686
11234
  const patchFiles = files.filter((candidate) => candidate.unifiedDiff);
10687
11235
  const diffFiles = files.filter(
10688
11236
  (candidate) => !candidate.unifiedDiff && candidate.oldString !== null && candidate.newString !== null
@@ -10752,7 +11300,7 @@ function approvalPreviewCall(call) {
10752
11300
  return null;
10753
11301
  }
10754
11302
  const normalizedKind = normalizeToolKind(
10755
- stringValue9(toolCall.kind) ?? stringValue9(toolCall.title) ?? stringValue9(toolCall.toolName)
11303
+ stringValue10(toolCall.kind) ?? stringValue10(toolCall.title) ?? stringValue10(toolCall.toolName)
10756
11304
  );
10757
11305
  if (normalizedKind !== "edit" && normalizedKind !== "move") {
10758
11306
  return null;
@@ -10764,10 +11312,10 @@ function approvalPreviewCall(call) {
10764
11312
  kind: "tool-call",
10765
11313
  id: `${call.id}:approval-preview`,
10766
11314
  turnId: call.turnId,
10767
- name: stringValue9(toolCall.title) ?? call.name,
11315
+ name: stringValue10(toolCall.title) ?? call.name,
10768
11316
  toolName: "Edit",
10769
11317
  callType: "tool",
10770
- status: stringValue9(toolCall.status) ?? call.status,
11318
+ status: stringValue10(toolCall.status) ?? call.status,
10771
11319
  statusKind: call.statusKind,
10772
11320
  summary: "",
10773
11321
  compactSummary: null,
@@ -10926,7 +11474,7 @@ function AgentBashContent({
10926
11474
  }) {
10927
11475
  "use memo";
10928
11476
  const commandData = getCommandRenderData(call);
10929
- 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;
10930
11478
  return /* @__PURE__ */ jsx32("div", { className: "workspace-agents-status-panel__detail-tool-body workspace-agents-status-panel__detail-tool-body--plain", children: /* @__PURE__ */ jsx32(
10931
11479
  AgentTerminalBlock,
10932
11480
  {
@@ -11054,8 +11602,8 @@ function normalizeMcpPayload(call) {
11054
11602
  toolName: call.toolName,
11055
11603
  name: call.name
11056
11604
  });
11057
- const server = target?.server ?? stringValue9(call.metadata?.server) ?? stringValue9(call.metadata?.serverName) ?? stringValue9(call.metadata?.mcpServer) ?? null;
11058
- 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;
11059
11607
  const structured = firstStructuredValue(
11060
11608
  call.output?.structuredContent,
11061
11609
  parseJsonString(call.output?.content),
@@ -11065,19 +11613,19 @@ function normalizeMcpPayload(call) {
11065
11613
  return {
11066
11614
  server,
11067
11615
  tool,
11068
- inputSummary: firstString5(
11069
- stringValue9(call.input?.query),
11070
- stringValue9(call.input?.url),
11071
- stringValue9(call.input?.path),
11072
- stringValue9(call.input?.prompt),
11073
- 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)
11074
11622
  ),
11075
11623
  structured,
11076
- text: firstString5(
11624
+ text: firstString6(
11077
11625
  contentArrayText(call.output?.content),
11078
- stringValue9(call.output?.content),
11079
- stringValue9(call.output?.output),
11080
- stringValue9(call.output?.stdout)
11626
+ stringValue10(call.output?.content),
11627
+ stringValue10(call.output?.output),
11628
+ stringValue10(call.output?.stdout)
11081
11629
  )
11082
11630
  };
11083
11631
  }
@@ -11112,21 +11660,21 @@ function parsedItems(value) {
11112
11660
  return [];
11113
11661
  }
11114
11662
  function itemPrimaryText(item) {
11115
- return firstString5(
11116
- stringValue9(item.key),
11117
- stringValue9(item.title),
11118
- stringValue9(item.name),
11119
- stringValue9(item.path),
11120
- stringValue9(item.url),
11121
- 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)
11122
11670
  );
11123
11671
  }
11124
11672
  function itemSecondaryText(item) {
11125
- return firstString5(
11126
- stringValue9(item.summary),
11127
- stringValue9(item.description),
11128
- stringValue9(item.status),
11129
- stringValue9(item.type)
11673
+ return firstString6(
11674
+ stringValue10(item.summary),
11675
+ stringValue10(item.description),
11676
+ stringValue10(item.status),
11677
+ stringValue10(item.type)
11130
11678
  );
11131
11679
  }
11132
11680
  function firstStructuredValue(...values) {
@@ -11161,16 +11709,16 @@ function contentArrayText(value) {
11161
11709
  return [];
11162
11710
  }
11163
11711
  return [
11164
- firstString5(
11165
- stringValue9(record.text),
11166
- stringValue9(record.content),
11167
- stringValue9(objectValue6(record.content)?.text)
11712
+ firstString6(
11713
+ stringValue10(record.text),
11714
+ stringValue10(record.content),
11715
+ stringValue10(objectValue6(record.content)?.text)
11168
11716
  )
11169
11717
  ].filter((candidate) => Boolean(candidate));
11170
11718
  }).join("\n").trim();
11171
11719
  return text || null;
11172
11720
  }
11173
- function firstString5(...values) {
11721
+ function firstString6(...values) {
11174
11722
  for (const value of values) {
11175
11723
  if (value) {
11176
11724
  return value;
@@ -11474,6 +12022,7 @@ function AgentTaskContent({
11474
12022
  }) {
11475
12023
  "use memo";
11476
12024
  const task = getTaskRenderData(call);
12025
+ const failureMarkdown = task.errorMarkdown ?? (isFailedTaskStatus(call.statusKind, task.status, call.status) ? translate("agentHost.agentTool.details.missingFailureDetails") : null);
11477
12026
  return /* @__PURE__ */ jsxs30("div", { className: "workspace-agents-status-panel__detail-tool-body", children: [
11478
12027
  /* @__PURE__ */ jsxs30("div", { className: "workspace-agents-status-panel__detail-tool-answer", children: [
11479
12028
  /* @__PURE__ */ jsx41("strong", { children: task.title }),
@@ -11503,9 +12052,23 @@ function AgentTaskContent({
11503
12052
  onLinkClick,
11504
12053
  collapsible: true
11505
12054
  }
12055
+ ) }) : null,
12056
+ failureMarkdown ? /* @__PURE__ */ jsx41(ToolSection, { title: translate("agentHost.agentTool.details.error"), children: /* @__PURE__ */ jsx41(
12057
+ ToolMarkdownBlock,
12058
+ {
12059
+ content: failureMarkdown,
12060
+ onLinkClick,
12061
+ collapsible: true
12062
+ }
11506
12063
  ) }) : null
11507
12064
  ] });
11508
12065
  }
12066
+ function isFailedTaskStatus(...values) {
12067
+ return values.some((value) => {
12068
+ const normalized = (value ?? "").trim().toLowerCase();
12069
+ return normalized === "failed" || normalized === "error";
12070
+ });
12071
+ }
11509
12072
 
11510
12073
  // shared/agentConversation/components/tool-renderers/AgentTodoWriteContent.tsx
11511
12074
  import { CheckCircle2, Circle } from "lucide-react";
@@ -11733,13 +12296,13 @@ function normalizeLinks(value, output) {
11733
12296
  const explicitLinks = arrayValue8(value)?.map(optionRecord).filter(
11734
12297
  (candidate) => candidate !== null
11735
12298
  ).flatMap((link) => {
11736
- const url = stringValue9(link.url);
12299
+ const url = stringValue10(link.url);
11737
12300
  if (!url) {
11738
12301
  return [];
11739
12302
  }
11740
12303
  return [
11741
12304
  {
11742
- title: stringValue9(link.title) ?? url,
12305
+ title: stringValue10(link.title) ?? url,
11743
12306
  url,
11744
12307
  domain: domainForUrl2(url)
11745
12308
  }
@@ -11760,13 +12323,13 @@ function normalizeLinks(value, output) {
11760
12323
  const parsed = JSON.parse(linksJson);
11761
12324
  return parsed.flatMap((entry) => {
11762
12325
  const link = optionRecord(entry);
11763
- const url = stringValue9(link?.url);
12326
+ const url = stringValue10(link?.url);
11764
12327
  if (!url) {
11765
12328
  return [];
11766
12329
  }
11767
12330
  return [
11768
12331
  {
11769
- title: stringValue9(link?.title) ?? url,
12332
+ title: stringValue10(link?.title) ?? url,
11770
12333
  url,
11771
12334
  domain: domainForUrl2(url)
11772
12335
  }
@@ -11813,7 +12376,7 @@ function AgentWriteContent({
11813
12376
  "use memo";
11814
12377
  const files = getFileChangeRenderData(call);
11815
12378
  const [file] = files;
11816
- 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;
11817
12380
  const contentFiles = files.filter((candidate) => candidate.content);
11818
12381
  const contentPaths = new Set(contentFiles.map((candidate) => candidate.path));
11819
12382
  const patchFiles = files.filter(
@@ -12077,9 +12640,197 @@ function taskCallAriaLabel(call) {
12077
12640
  ].filter(Boolean).join(" ");
12078
12641
  }
12079
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
+
12080
12831
  // shared/agentConversation/components/AgentToolCallCard.tsx
12081
- import { useState as useState14 } from "react";
12082
- 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";
12083
12834
  function AgentToolCallCard({
12084
12835
  call,
12085
12836
  onLinkClick,
@@ -12089,11 +12840,11 @@ function AgentToolCallCard({
12089
12840
  variantClassName
12090
12841
  }) {
12091
12842
  "use memo";
12092
- const [expanded, setExpanded] = useState14(defaultExpanded);
12843
+ const [expanded, setExpanded] = useState15(defaultExpanded);
12093
12844
  const hasDetail = hasAgentToolContent(call);
12094
12845
  const canCollapse = hasDetail && !nonCollapsible;
12095
12846
  const ariaLabel = toolCallAriaLabel(call);
12096
- return /* @__PURE__ */ jsxs40(
12847
+ return /* @__PURE__ */ jsxs41(
12097
12848
  "div",
12098
12849
  {
12099
12850
  className: [
@@ -12101,7 +12852,7 @@ function AgentToolCallCard({
12101
12852
  variantClassName ?? ""
12102
12853
  ].filter(Boolean).join(" "),
12103
12854
  children: [
12104
- canCollapse ? /* @__PURE__ */ jsx52(
12855
+ canCollapse ? /* @__PURE__ */ jsx54(
12105
12856
  "button",
12106
12857
  {
12107
12858
  type: "button",
@@ -12109,10 +12860,10 @@ function AgentToolCallCard({
12109
12860
  "aria-expanded": expanded,
12110
12861
  "aria-label": ariaLabel,
12111
12862
  onClick: () => setExpanded((value) => !value),
12112
- children: /* @__PURE__ */ jsx52(AgentToolCallHeader, { call, expanded, hasDetail: true })
12863
+ children: /* @__PURE__ */ jsx54(AgentToolCallHeader, { call, expanded, hasDetail: true })
12113
12864
  }
12114
- ) : /* @__PURE__ */ jsx52("div", { className: "workspace-agents-status-panel__detail-tool-row-head", children: /* @__PURE__ */ jsx52(AgentToolCallHeader, { call, expanded: false, hasDetail: false }) }),
12115
- 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(
12116
12867
  AgentExpandedToolContent,
12117
12868
  {
12118
12869
  call,
@@ -12120,7 +12871,7 @@ function AgentToolCallCard({
12120
12871
  previewMode
12121
12872
  }
12122
12873
  ) : null,
12123
- hasDetail && !nonCollapsible ? /* @__PURE__ */ jsx52(CollapsibleReveal, { expanded, children: /* @__PURE__ */ jsx52(
12874
+ hasDetail && !nonCollapsible ? /* @__PURE__ */ jsx54(CollapsibleReveal, { expanded, children: /* @__PURE__ */ jsx54(
12124
12875
  AgentExpandedToolContent,
12125
12876
  {
12126
12877
  call,
@@ -12141,8 +12892,8 @@ function toolCallAriaLabel(call) {
12141
12892
  }
12142
12893
 
12143
12894
  // shared/agentConversation/components/AgentToolGroupRow.tsx
12144
- import { Fragment as Fragment5, jsx as jsx53, jsxs as jsxs41 } from "react/jsx-runtime";
12145
- 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({
12146
12897
  row,
12147
12898
  label,
12148
12899
  thinkingLabel,
@@ -12155,7 +12906,7 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12155
12906
  rawTimelineJsonLabel = ""
12156
12907
  }) {
12157
12908
  "use memo";
12158
- const [localExpanded, setLocalExpanded] = useState15(false);
12909
+ const [localExpanded, setLocalExpanded] = useState16(false);
12159
12910
  const hasDetail = hasGroupDetail(row);
12160
12911
  const isExpanded = hasDetail && (expanded ?? localExpanded);
12161
12912
  const setNextExpanded = (nextExpanded) => {
@@ -12177,13 +12928,13 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12177
12928
  rawTimelineJsonLabel
12178
12929
  );
12179
12930
  }
12180
- return /* @__PURE__ */ jsxs41(
12931
+ return /* @__PURE__ */ jsxs42(
12181
12932
  "div",
12182
12933
  {
12183
12934
  className: "workspace-agents-status-panel__detail-tool-section",
12184
12935
  "data-tool-group-expanded": isExpanded ? "true" : void 0,
12185
12936
  children: [
12186
- hasDetail ? /* @__PURE__ */ jsxs41(
12937
+ hasDetail ? /* @__PURE__ */ jsxs42(
12187
12938
  "button",
12188
12939
  {
12189
12940
  type: "button",
@@ -12192,17 +12943,17 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12192
12943
  "aria-label": groupLabel,
12193
12944
  onClick: () => setNextExpanded(!isExpanded),
12194
12945
  children: [
12195
- /* @__PURE__ */ jsx53(ToolGroupLabel, { label: groupLabel }),
12196
- isExpanded ? /* @__PURE__ */ jsx53(
12197
- ChevronDown6,
12946
+ /* @__PURE__ */ jsx55(ToolGroupLabel, { label: groupLabel }),
12947
+ isExpanded ? /* @__PURE__ */ jsx55(
12948
+ ChevronDown7,
12198
12949
  {
12199
12950
  size: 12,
12200
12951
  strokeWidth: 2.2,
12201
12952
  "aria-hidden": "true",
12202
12953
  className: "workspace-agents-status-panel__detail-tool-count-chevron"
12203
12954
  }
12204
- ) : /* @__PURE__ */ jsx53(
12205
- ChevronRight6,
12955
+ ) : /* @__PURE__ */ jsx55(
12956
+ ChevronRight7,
12206
12957
  {
12207
12958
  size: 12,
12208
12959
  strokeWidth: 2.2,
@@ -12212,13 +12963,13 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12212
12963
  )
12213
12964
  ]
12214
12965
  }
12215
- ) : /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-count", children: /* @__PURE__ */ jsx53(ToolGroupLabel, { label: groupLabel }) }),
12216
- hasDetail ? /* @__PURE__ */ jsx53(CollapsibleReveal, { expanded: isExpanded, children: /* @__PURE__ */ jsx53("div", { className: "workspace-agents-status-panel__detail-tool-list", children: row.entries.map(
12217
- (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(
12218
12969
  "div",
12219
12970
  {
12220
12971
  className: "workspace-agents-status-panel__detail-tool-list-item workspace-agents-status-panel__detail-tool-row",
12221
- children: /* @__PURE__ */ jsx53(
12972
+ children: /* @__PURE__ */ jsx55(
12222
12973
  AgentThinkingDisclosure,
12223
12974
  {
12224
12975
  thinking: entry.thinking,
@@ -12231,7 +12982,7 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12231
12982
  )
12232
12983
  },
12233
12984
  entry.thinking.id
12234
- ) : /* @__PURE__ */ jsx53(
12985
+ ) : /* @__PURE__ */ jsx55(
12235
12986
  "div",
12236
12987
  {
12237
12988
  className: "workspace-agents-status-panel__detail-tool-list-item",
@@ -12252,8 +13003,8 @@ var AgentToolGroupRow = memo(function AgentToolGroupRow2({
12252
13003
  });
12253
13004
  function ToolGroupLabel({ label }) {
12254
13005
  "use memo";
12255
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
12256
- /* @__PURE__ */ jsx53(
13006
+ return /* @__PURE__ */ jsxs42(Fragment6, { children: [
13007
+ /* @__PURE__ */ jsx55(
12257
13008
  ToolActivityKindIcon,
12258
13009
  {
12259
13010
  kind: "update_todos",
@@ -12262,7 +13013,7 @@ function ToolGroupLabel({ label }) {
12262
13013
  className: "workspace-agents-status-panel__detail-tool-count-icon"
12263
13014
  }
12264
13015
  ),
12265
- /* @__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) })
12266
13017
  ] });
12267
13018
  }
12268
13019
  function hasGroupDetail(row) {
@@ -12275,11 +13026,11 @@ function renderToolCountLabel(label) {
12275
13026
  const primary = statusMatch?.[1];
12276
13027
  const status = statusMatch?.[2];
12277
13028
  if (!primary || !status) {
12278
- 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 });
12279
13030
  }
12280
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
12281
- /* @__PURE__ */ jsx53("span", { className: "workspace-agents-status-panel__detail-tool-count-primary", children: primary }),
12282
- /* @__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) })
12283
13034
  ] });
12284
13035
  }
12285
13036
  function formatInlineStatusLabel3(label) {
@@ -12287,26 +13038,29 @@ function formatInlineStatusLabel3(label) {
12287
13038
  }
12288
13039
  function renderToolCard(call, onLinkClick, previewMode = false, showRawTimelineJson = false, rawTimelineJsonLabel = "") {
12289
13040
  const props = { call, onLinkClick, previewMode };
13041
+ if (call.task?.subAgents?.length) {
13042
+ return /* @__PURE__ */ jsx55(AgentSubAgentCards, { call, onLinkClick });
13043
+ }
12290
13044
  let card;
12291
13045
  switch (call.rendererKind) {
12292
13046
  case "plan-enter":
12293
- card = /* @__PURE__ */ jsx53(AgentEnterPlanModeCard, { ...props });
13047
+ card = /* @__PURE__ */ jsx55(AgentEnterPlanModeCard, { ...props });
12294
13048
  break;
12295
13049
  case "plan-exit":
12296
- card = /* @__PURE__ */ jsx53(AgentExitPlanModeCard, { ...props });
13050
+ card = /* @__PURE__ */ jsx55(AgentExitPlanModeCard, { ...props });
12297
13051
  break;
12298
13052
  case "ask-user":
12299
- card = /* @__PURE__ */ jsx53(AgentAskUserQuestionCard, { ...props });
13053
+ card = /* @__PURE__ */ jsx55(AgentAskUserQuestionCard, { ...props });
12300
13054
  break;
12301
13055
  case "task":
12302
- card = /* @__PURE__ */ jsx53(AgentTaskCallCard, { ...props });
13056
+ card = /* @__PURE__ */ jsx55(AgentTaskCallCard, { ...props });
12303
13057
  break;
12304
13058
  default:
12305
- card = /* @__PURE__ */ jsx53(AgentToolCallCard, { ...props });
13059
+ card = /* @__PURE__ */ jsx55(AgentToolCallCard, { ...props });
12306
13060
  }
12307
- return /* @__PURE__ */ jsxs41(Fragment5, { children: [
13061
+ return /* @__PURE__ */ jsxs42(Fragment6, { children: [
12308
13062
  card,
12309
- showRawTimelineJson && rawTimelineJsonLabel ? /* @__PURE__ */ jsx53(
13063
+ showRawTimelineJson && rawTimelineJsonLabel ? /* @__PURE__ */ jsx55(
12310
13064
  RawTimelineJsonDisclosure,
12311
13065
  {
12312
13066
  items: call.sourceTimelineItems,
@@ -12317,10 +13071,10 @@ function renderToolCard(call, onLinkClick, previewMode = false, showRawTimelineJ
12317
13071
  }
12318
13072
 
12319
13073
  // shared/agentConversation/components/AgentTurnSummaryRow.tsx
12320
- 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";
12321
13075
  import {
12322
- ChevronDown as ChevronDown7,
12323
- ChevronRight as ChevronRight7,
13076
+ ChevronDown as ChevronDown8,
13077
+ ChevronRight as ChevronRight8,
12324
13078
  LoaderCircle as LoaderCircle2,
12325
13079
  Redo2,
12326
13080
  Undo2
@@ -12334,10 +13088,10 @@ import {
12334
13088
  } from "@tutti-os/ui-system";
12335
13089
 
12336
13090
  // app/renderer/components/icons/DirectLinedIcon.tsx
12337
- import { jsx as jsx54 } from "react/jsx-runtime";
13091
+ import { jsx as jsx56 } from "react/jsx-runtime";
12338
13092
  function DirectLinedIcon(props) {
12339
13093
  "use memo";
12340
- return /* @__PURE__ */ jsx54(
13094
+ return /* @__PURE__ */ jsx56(
12341
13095
  "svg",
12342
13096
  {
12343
13097
  xmlns: "http://www.w3.org/2000/svg",
@@ -12347,7 +13101,7 @@ function DirectLinedIcon(props) {
12347
13101
  "data-nexight-chrome-glyph": "fill",
12348
13102
  "data-tutti-chrome-glyph": "fill",
12349
13103
  ...props,
12350
- children: /* @__PURE__ */ jsx54(
13104
+ children: /* @__PURE__ */ jsx56(
12351
13105
  "path",
12352
13106
  {
12353
13107
  fill: "currentColor",
@@ -12548,20 +13302,20 @@ function isInsideOrEqualPatchPath(path, root) {
12548
13302
  }
12549
13303
 
12550
13304
  // shared/agentConversation/components/AgentTurnSummaryRow.tsx
12551
- import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
13305
+ import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
12552
13306
  function AgentTurnSummaryRow({
12553
13307
  row,
12554
13308
  workspaceRoot,
12555
13309
  onLinkAction
12556
13310
  }) {
12557
13311
  "use memo";
12558
- const [expandedFiles, setExpandedFiles] = useState16(
13312
+ const [expandedFiles, setExpandedFiles] = useState17(
12559
13313
  {}
12560
13314
  );
12561
- const [showAllFiles, setShowAllFiles] = useState16(false);
12562
- const [patchAction, setPatchAction] = useState16("undo");
12563
- const [patchPending, setPatchPending] = useState16(false);
12564
- 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);
12565
13319
  const agentHostApi = useOptionalAgentHostApi();
12566
13320
  const aggregateStats = useMemo5(
12567
13321
  () => summarizeRowDiff(row.files),
@@ -12690,29 +13444,29 @@ function AgentTurnSummaryRow({
12690
13444
  }
12691
13445
  }
12692
13446
  };
12693
- 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: [
12694
- /* @__PURE__ */ jsxs42("div", { className: "flex items-start gap-3 px-4 py-3", children: [
12695
- /* @__PURE__ */ jsx55("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 items-center gap-3", children: [
12696
- /* @__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", {
12697
13451
  count: row.fileCount
12698
13452
  }) }),
12699
- /* @__PURE__ */ jsxs42("div", { className: "inline-flex shrink-0 items-center gap-2.5 text-[11px] font-semibold", children: [
12700
- 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: [
12701
13455
  "+",
12702
13456
  aggregateStats.added
12703
13457
  ] }) : null,
12704
- 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: [
12705
13459
  "-",
12706
13460
  aggregateStats.removed
12707
13461
  ] }) : null
12708
13462
  ] })
12709
13463
  ] }) }),
12710
- canRenderPatchButton ? /* @__PURE__ */ jsx55(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs42(Tooltip, { children: [
12711
- /* @__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(
12712
13466
  "span",
12713
13467
  {
12714
13468
  className: `inline-flex shrink-0 ${isPatchActionDisabled ? "cursor-not-allowed" : ""}`,
12715
- children: /* @__PURE__ */ jsxs42(
13469
+ children: /* @__PURE__ */ jsxs43(
12716
13470
  CanvasNodeGhostIconButton,
12717
13471
  {
12718
13472
  "aria-label": patchActionLabel,
@@ -12720,7 +13474,7 @@ function AgentTurnSummaryRow({
12720
13474
  disabled: isPatchActionDisabled,
12721
13475
  onClick: handlePatchAction,
12722
13476
  children: [
12723
- patchPending || isPatchSupportChecking ? /* @__PURE__ */ jsx55(
13477
+ patchPending || isPatchSupportChecking ? /* @__PURE__ */ jsx57(
12724
13478
  LoaderCircle2,
12725
13479
  {
12726
13480
  width: 14,
@@ -12728,7 +13482,7 @@ function AgentTurnSummaryRow({
12728
13482
  "aria-hidden": "true",
12729
13483
  className: "animate-spin text-[var(--text-secondary)]"
12730
13484
  }
12731
- ) : patchAction === "undo" ? /* @__PURE__ */ jsx55(
13485
+ ) : patchAction === "undo" ? /* @__PURE__ */ jsx57(
12732
13486
  Undo2,
12733
13487
  {
12734
13488
  width: 14,
@@ -12736,7 +13490,7 @@ function AgentTurnSummaryRow({
12736
13490
  "aria-hidden": "true",
12737
13491
  className: "text-[var(--text-secondary)]"
12738
13492
  }
12739
- ) : /* @__PURE__ */ jsx55(
13493
+ ) : /* @__PURE__ */ jsx57(
12740
13494
  Redo2,
12741
13495
  {
12742
13496
  width: 14,
@@ -12745,19 +13499,19 @@ function AgentTurnSummaryRow({
12745
13499
  className: "text-[var(--text-secondary)]"
12746
13500
  }
12747
13501
  ),
12748
- /* @__PURE__ */ jsx55("span", { children: patchActionLabel })
13502
+ /* @__PURE__ */ jsx57("span", { children: patchActionLabel })
12749
13503
  ]
12750
13504
  }
12751
13505
  )
12752
13506
  }
12753
13507
  ) }),
12754
- 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
12755
13509
  ] }) }) : null
12756
13510
  ] }),
12757
- /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card__list", children: [
13511
+ /* @__PURE__ */ jsxs43("div", { className: "agent-turn-summary-card__list", children: [
12758
13512
  visibleFiles.map((file) => {
12759
13513
  const key = `${file.path}:${file.messageId}`;
12760
- return /* @__PURE__ */ jsx55(
13514
+ return /* @__PURE__ */ jsx57(
12761
13515
  TurnSummaryFileCard,
12762
13516
  {
12763
13517
  file,
@@ -12772,9 +13526,9 @@ function AgentTurnSummaryRow({
12772
13526
  key
12773
13527
  );
12774
13528
  }),
12775
- 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) => {
12776
13530
  const key = `${file.path}:${file.messageId}`;
12777
- return /* @__PURE__ */ jsx55(
13531
+ return /* @__PURE__ */ jsx57(
12778
13532
  TurnSummaryFileCard,
12779
13533
  {
12780
13534
  file,
@@ -12789,29 +13543,29 @@ function AgentTurnSummaryRow({
12789
13543
  key
12790
13544
  );
12791
13545
  }) }) }) : null,
12792
- hiddenFileCount > 0 && !showAllFiles ? /* @__PURE__ */ jsxs42(
13546
+ hiddenFileCount > 0 && !showAllFiles ? /* @__PURE__ */ jsxs43(
12793
13547
  "button",
12794
13548
  {
12795
13549
  type: "button",
12796
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",
12797
13551
  onClick: () => setShowAllFiles(true),
12798
13552
  children: [
12799
- /* @__PURE__ */ jsx55("span", { children: translate("agentHost.agentGui.turnSummaryShowMoreFiles", {
13553
+ /* @__PURE__ */ jsx57("span", { children: translate("agentHost.agentGui.turnSummaryShowMoreFiles", {
12800
13554
  count: hiddenFileCount
12801
13555
  }) }),
12802
- /* @__PURE__ */ jsx55(ChevronDown7, { size: 16, strokeWidth: 2.2, "aria-hidden": "true" })
13556
+ /* @__PURE__ */ jsx57(ChevronDown8, { size: 16, strokeWidth: 2.2, "aria-hidden": "true" })
12803
13557
  ]
12804
13558
  }
12805
- ) : hiddenFileCount > 0 ? /* @__PURE__ */ jsxs42(
13559
+ ) : hiddenFileCount > 0 ? /* @__PURE__ */ jsxs43(
12806
13560
  "button",
12807
13561
  {
12808
13562
  type: "button",
12809
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",
12810
13564
  onClick: () => setShowAllFiles(false),
12811
13565
  children: [
12812
- /* @__PURE__ */ jsx55("span", { children: translate("agentHost.agentGui.turnSummaryShowFewerFiles") }),
12813
- /* @__PURE__ */ jsx55(
12814
- ChevronRight7,
13566
+ /* @__PURE__ */ jsx57("span", { children: translate("agentHost.agentGui.turnSummaryShowFewerFiles") }),
13567
+ /* @__PURE__ */ jsx57(
13568
+ ChevronRight8,
12815
13569
  {
12816
13570
  size: 16,
12817
13571
  strokeWidth: 2.2,
@@ -12841,10 +13595,10 @@ function TurnSummaryFileCard({
12841
13595
  const canOpen = Boolean(action && onLinkAction);
12842
13596
  const stats = summarizeFileDiff(file);
12843
13597
  const preview = filePreview(file);
12844
- return /* @__PURE__ */ jsxs42("div", { className: "agent-turn-summary-card__file", children: [
12845
- /* @__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: [
12846
- /* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 flex-1 items-center gap-2.5", children: [
12847
- /* @__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(
12848
13602
  "button",
12849
13603
  {
12850
13604
  type: "button",
@@ -12852,22 +13606,22 @@ function TurnSummaryFileCard({
12852
13606
  "aria-expanded": expanded,
12853
13607
  onClick: onToggle,
12854
13608
  children: [
12855
- /* @__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(
12856
13610
  "span",
12857
13611
  {
12858
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" : ""}`,
12859
13613
  title: file.path,
12860
13614
  children: [
12861
- 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: [
12862
13616
  file.directory,
12863
13617
  "/"
12864
13618
  ] }) : null,
12865
- /* @__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 })
12866
13620
  ]
12867
13621
  }
12868
13622
  ) }),
12869
- /* @__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(
12870
- 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,
12871
13625
  {
12872
13626
  size: 14,
12873
13627
  strokeWidth: 2.2,
@@ -12878,18 +13632,18 @@ function TurnSummaryFileCard({
12878
13632
  ]
12879
13633
  }
12880
13634
  ),
12881
- /* @__PURE__ */ jsxs42("span", { className: "ml-auto inline-flex shrink-0 items-center gap-2 text-[11px] font-semibold", children: [
12882
- 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: [
12883
13637
  "+",
12884
13638
  stats.added
12885
13639
  ] }) : null,
12886
- 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: [
12887
13641
  "-",
12888
13642
  stats.removed
12889
13643
  ] }) : null
12890
13644
  ] })
12891
13645
  ] }),
12892
- canOpen ? /* @__PURE__ */ jsx55(
13646
+ canOpen ? /* @__PURE__ */ jsx57(
12893
13647
  CanvasNodeGhostIconButton,
12894
13648
  {
12895
13649
  "aria-label": translate(
@@ -12901,7 +13655,7 @@ function TurnSummaryFileCard({
12901
13655
  onClick: () => {
12902
13656
  onLinkAction?.(action);
12903
13657
  },
12904
- children: /* @__PURE__ */ jsx55(
13658
+ children: /* @__PURE__ */ jsx57(
12905
13659
  DirectLinedIcon,
12906
13660
  {
12907
13661
  width: 14,
@@ -12913,12 +13667,12 @@ function TurnSummaryFileCard({
12913
13667
  }
12914
13668
  ) : null
12915
13669
  ] }),
12916
- 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
12917
13671
  ] });
12918
13672
  }
12919
13673
  function filePreview(file) {
12920
13674
  if (file.changeType === "created" && file.content?.trim()) {
12921
- return /* @__PURE__ */ jsx55(
13675
+ return /* @__PURE__ */ jsx57(
12922
13676
  AgentCodeBlock,
12923
13677
  {
12924
13678
  path: file.path,
@@ -12930,7 +13684,7 @@ function filePreview(file) {
12930
13684
  );
12931
13685
  }
12932
13686
  if (file.unifiedDiff?.trim()) {
12933
- return /* @__PURE__ */ jsx55(
13687
+ return /* @__PURE__ */ jsx57(
12934
13688
  AgentUnifiedPatchViewer,
12935
13689
  {
12936
13690
  path: file.path,
@@ -12941,7 +13695,7 @@ function filePreview(file) {
12941
13695
  );
12942
13696
  }
12943
13697
  if (file.changeType === "created" && file.newString?.trim()) {
12944
- return /* @__PURE__ */ jsx55(
13698
+ return /* @__PURE__ */ jsx57(
12945
13699
  AgentCodeBlock,
12946
13700
  {
12947
13701
  path: file.path,
@@ -12953,7 +13707,7 @@ function filePreview(file) {
12953
13707
  );
12954
13708
  }
12955
13709
  if (file.oldString?.trim() || file.newString?.trim()) {
12956
- return /* @__PURE__ */ jsx55(
13710
+ return /* @__PURE__ */ jsx57(
12957
13711
  AgentMonacoDiffViewer,
12958
13712
  {
12959
13713
  path: file.path,
@@ -12965,7 +13719,7 @@ function filePreview(file) {
12965
13719
  );
12966
13720
  }
12967
13721
  if (file.content?.trim()) {
12968
- return /* @__PURE__ */ jsx55(
13722
+ return /* @__PURE__ */ jsx57(
12969
13723
  AgentCodeBlock,
12970
13724
  {
12971
13725
  path: file.path,
@@ -13057,8 +13811,8 @@ function summarizeFileDiff(file) {
13057
13811
  }
13058
13812
 
13059
13813
  // shared/agentConversation/components/AgentTranscriptItemView.tsx
13060
- import { jsx as jsx56 } from "react/jsx-runtime";
13061
- var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13814
+ import { jsx as jsx58 } from "react/jsx-runtime";
13815
+ var AgentTranscriptItemView = memo3(function AgentTranscriptItemView2({
13062
13816
  workspaceRoot,
13063
13817
  basePath,
13064
13818
  row,
@@ -13091,7 +13845,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13091
13845
  );
13092
13846
  switch (row.kind) {
13093
13847
  case "message":
13094
- return /* @__PURE__ */ jsx56(
13848
+ return /* @__PURE__ */ jsx58(
13095
13849
  AgentMessageBlock,
13096
13850
  {
13097
13851
  workspaceRoot,
@@ -13109,7 +13863,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13109
13863
  }
13110
13864
  );
13111
13865
  case "tool-group":
13112
- return /* @__PURE__ */ jsx56(
13866
+ return /* @__PURE__ */ jsx58(
13113
13867
  AgentToolGroupRow,
13114
13868
  {
13115
13869
  row,
@@ -13125,7 +13879,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13125
13879
  }
13126
13880
  );
13127
13881
  case "turn-summary":
13128
- return /* @__PURE__ */ jsx56(
13882
+ return /* @__PURE__ */ jsx58(
13129
13883
  AgentTurnSummaryRow,
13130
13884
  {
13131
13885
  row,
@@ -13136,7 +13890,7 @@ var AgentTranscriptItemView = memo2(function AgentTranscriptItemView2({
13136
13890
  }
13137
13891
  );
13138
13892
  case "processing":
13139
- return /* @__PURE__ */ jsx56(AgentProcessingRow, { row, label: labels.processing });
13893
+ return /* @__PURE__ */ jsx58(AgentProcessingRow, { row, label: labels.processing });
13140
13894
  }
13141
13895
  });
13142
13896
 
@@ -13257,13 +14011,14 @@ function looksLikeTableSeparator(line) {
13257
14011
  }
13258
14012
 
13259
14013
  // shared/agentConversation/components/AgentTranscriptView.tsx
13260
- 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";
13261
14015
  var AGENT_TRANSCRIPT_VIRTUALIZATION_OVERSCAN = 6;
13262
14016
  var AGENT_TRANSCRIPT_ESTIMATED_TURN_HEIGHT_PX = 280;
13263
14017
  var AGENT_TRANSCRIPT_TURN_GAP_PX = 12;
13264
14018
  var AGENT_TRANSCRIPT_FALLBACK_TURN_COUNT = 3;
14019
+ var AGENT_MESSAGE_LOCATOR_PANEL_FADE_MS = 160;
13265
14020
  function transcriptLabelsEqual(previous, next) {
13266
- 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;
13267
14022
  }
13268
14023
  function transcriptTurnIdentityEquals(previous, next) {
13269
14024
  return previous === next || previous.length === next.length && previous.every((turn, index) => turn.id === next[index]?.id);
@@ -13280,7 +14035,7 @@ function areAgentTranscriptViewPropsEqual(previous, next) {
13280
14035
  next.conversation
13281
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);
13282
14037
  }
13283
- var AgentTranscriptView = memo3(function AgentTranscriptView2({
14038
+ var AgentTranscriptView = memo4(function AgentTranscriptView2({
13284
14039
  conversation,
13285
14040
  onLinkAction,
13286
14041
  onAuthLogin,
@@ -13291,9 +14046,9 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13291
14046
  labels
13292
14047
  }) {
13293
14048
  "use memo";
13294
- const [expandedToolRows, setExpandedToolRows] = useState17({});
14049
+ const [expandedToolRows, setExpandedToolRows] = useState18({});
13295
14050
  const virtualizerHostRef = useRef8(null);
13296
- const [virtualScrollElement, setVirtualScrollElement] = useState17(null);
14051
+ const [virtualScrollElement, setVirtualScrollElement] = useState18(null);
13297
14052
  const rowKeys = useMemo6(
13298
14053
  () => conversation.rows.map(transcriptRowKey),
13299
14054
  [conversation.rows]
@@ -13302,6 +14057,18 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13302
14057
  () => buildAgentTranscriptTurnGroups(conversation.rows, rowKeys),
13303
14058
  [conversation.rows, rowKeys]
13304
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
+ );
13305
14072
  const enteringRowKeys = useEnteringTranscriptRows(rowKeys);
13306
14073
  const handleToolGroupExpandedChange = useCallback10(
13307
14074
  (key, expanded) => {
@@ -13341,6 +14108,34 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13341
14108
  getScrollElement: () => virtualScrollElement,
13342
14109
  overscan: AGENT_TRANSCRIPT_VIRTUALIZATION_OVERSCAN
13343
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
+ );
13344
14139
  useLayoutEffect2(() => {
13345
14140
  if (!shouldVirtualize) {
13346
14141
  setVirtualScrollElement(null);
@@ -13352,8 +14147,8 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13352
14147
  const rowKey = rowKeys[rowIndex] ?? transcriptRowKey(row);
13353
14148
  const showTurnDivider = dividerRowIndexes.has(rowIndex);
13354
14149
  const shouldAnimateEnter = row.kind !== "processing" && enteringRowKeys.has(rowKey);
13355
- return /* @__PURE__ */ jsxs43(Fragment6, { children: [
13356
- showTurnDivider ? /* @__PURE__ */ jsx57(
14150
+ return /* @__PURE__ */ jsxs44(Fragment7, { children: [
14151
+ showTurnDivider ? /* @__PURE__ */ jsx59(
13357
14152
  "div",
13358
14153
  {
13359
14154
  className: "h-px w-full flex-none bg-[var(--line-2,var(--tutti-line-2))]",
@@ -13361,14 +14156,15 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13361
14156
  "aria-hidden": "true"
13362
14157
  }
13363
14158
  ) : null,
13364
- /* @__PURE__ */ jsx57(
14159
+ /* @__PURE__ */ jsx59(
13365
14160
  "div",
13366
14161
  {
13367
14162
  className: "agent-gui-transcript-row",
13368
14163
  "data-agent-transcript-row": rowKey,
13369
14164
  "data-agent-transcript-row-kind": row.kind,
14165
+ "data-agent-transcript-row-index": rowIndex,
13370
14166
  "data-agent-transcript-row-enter": shouldAnimateEnter ? "true" : void 0,
13371
- children: /* @__PURE__ */ jsx57(
14167
+ children: /* @__PURE__ */ jsx59(
13372
14168
  AgentTranscriptItemView,
13373
14169
  {
13374
14170
  workspaceRoot,
@@ -13403,39 +14199,373 @@ var AgentTranscriptView = memo3(function AgentTranscriptView2({
13403
14199
  AGENT_TRANSCRIPT_FALLBACK_TURN_COUNT
13404
14200
  ) + fallbackIndex) * AGENT_TRANSCRIPT_ESTIMATED_TURN_HEIGHT_PX
13405
14201
  })) : rowVirtualizer.getVirtualItems();
13406
- return /* @__PURE__ */ jsx57(
13407
- "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,
13408
14248
  {
13409
- ref: virtualizerHostRef,
13410
- className: "agent-gui-transcript-virtual",
13411
- "data-agent-transcript-virtualized": "true",
13412
- style: { height: `${rowVirtualizer.getTotalSize()}px` },
13413
- children: virtualItems.map((virtualTurn) => {
13414
- const group = turnGroups[virtualTurn.index];
13415
- if (!group) {
13416
- 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);
13417
14316
  }
13418
- return /* @__PURE__ */ jsx57(
13419
- "div",
13420
- {
13421
- ref: rowVirtualizer.measureElement,
13422
- className: "agent-gui-transcript-virtual-item",
13423
- "data-index": virtualTurn.index,
13424
- "data-agent-transcript-virtual-turn": group.key,
13425
- style: {
13426
- paddingBottom: `${AGENT_TRANSCRIPT_TURN_GAP_PX}px`,
13427
- transform: `translateY(${virtualTurn.start}px)`
13428
- },
13429
- children: group.rows.map(({ row, rowIndex }) => renderRow(row, rowIndex))
13430
- },
13431
- virtualTurn.key
13432
- );
13433
- })
14317
+ }
13434
14318
  }
14319
+ return nextUnreadKeys ?? currentUnreadKeys;
14320
+ });
14321
+ previousAgentResponseByKeyRef.current = new Map(
14322
+ items.map((item) => [item.key, item.hasAgentResponse])
13435
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;
13436
14404
  }
13437
- return /* @__PURE__ */ jsx57(Fragment7, { children: conversation.rows.map(renderRow) });
13438
- }, areAgentTranscriptViewPropsEqual);
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;
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)}"]`
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
+ }
14566
+ }
14567
+ return nearest?.key ?? null;
14568
+ }
13439
14569
  function useEnteringTranscriptRows(rowKeys) {
13440
14570
  const previousKeysRef = useRef8(null);
13441
14571
  const previousKeys = previousKeysRef.current;
@@ -13475,6 +14605,67 @@ function buildAgentTranscriptTurnGroups(rows, rowKeys) {
13475
14605
  });
13476
14606
  return groups;
13477
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
+ }
13478
14669
  function findTurnDividerRowIndexes(turnIndexById, rows) {
13479
14670
  const dividerRowIndexes = /* @__PURE__ */ new Set();
13480
14671
  const previousTurnIds = /* @__PURE__ */ new Set();
@@ -13494,9 +14685,9 @@ function findTurnDividerRowIndexes(turnIndexById, rows) {
13494
14685
  }
13495
14686
 
13496
14687
  // shared/agentConversation/components/AgentConversationFlow.tsx
13497
- import { memo as memo4 } from "react";
13498
- import { Fragment as Fragment8, jsx as jsx58 } from "react/jsx-runtime";
13499
- 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({
13500
14691
  conversation,
13501
14692
  isLoading,
13502
14693
  loadingLabel,
@@ -13512,12 +14703,12 @@ var AgentConversationFlow = memo4(function AgentConversationFlow2({
13512
14703
  }) {
13513
14704
  "use memo";
13514
14705
  if (isLoading) {
13515
- return /* @__PURE__ */ jsx58(AgentTranscriptSkeleton, { label: loadingLabel, testId: loadingTestId });
14706
+ return /* @__PURE__ */ jsx60(AgentTranscriptSkeleton, { label: loadingLabel, testId: loadingTestId });
13516
14707
  }
13517
14708
  if (!conversation || conversation.rows.length === 0) {
13518
- return /* @__PURE__ */ jsx58(Fragment8, { children: empty });
14709
+ return /* @__PURE__ */ jsx60(Fragment9, { children: empty });
13519
14710
  }
13520
- return /* @__PURE__ */ jsx58(
14711
+ return /* @__PURE__ */ jsx60(
13521
14712
  AgentTranscriptView,
13522
14713
  {
13523
14714
  conversation,
@@ -13564,6 +14755,9 @@ export {
13564
14755
  getAppErrorCode,
13565
14756
  toLocalShortDateTime,
13566
14757
  Button,
14758
+ partitionSubAgentTimelineItems,
14759
+ buildSubAgentLanesByCallId,
14760
+ attachSubAgentLanesToConversationVM,
13567
14761
  buildWorkspaceAgentSessionDetailViewModel,
13568
14762
  projectAgentConversationVM,
13569
14763
  reconcileProjectedAgentConversationVM,
@@ -13582,4 +14776,4 @@ export {
13582
14776
  AgentConversationFlow,
13583
14777
  useProjectedAgentConversation
13584
14778
  };
13585
- //# sourceMappingURL=chunk-LWMC2YA3.js.map
14779
+ //# sourceMappingURL=chunk-RPXRNKU5.js.map