@sentry/junior-dashboard 0.244.0 → 0.245.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ export function SegmentedTabsFixture() {
11
11
  <SegmentedTabs
12
12
  items={[
13
13
  { label: "Details", value: "details" },
14
- { label: "Memories", value: "memories" },
14
+ { count: 3, label: "Memories", value: "memories" },
15
15
  { label: "Usage", value: "usage" },
16
16
  ]}
17
17
  label="Conversation panels"
@@ -971,6 +971,10 @@ function advisorConversation(
971
971
  nowMs: number,
972
972
  conversationId: string,
973
973
  text: string,
974
+ metrics: Pick<
975
+ ConversationDetailReport,
976
+ "cumulativeDurationMs" | "cumulativeUsage"
977
+ >,
974
978
  ): MockConversation {
975
979
  const startedAt = iso(nowMs, -10 * 60_000);
976
980
  const conversation = detail(nowMs, {
@@ -979,7 +983,7 @@ function advisorConversation(
979
983
  startedAt,
980
984
  lastSeenAt: iso(Date.parse(startedAt), 18_000),
981
985
  lastProgressAt: iso(Date.parse(startedAt), 18_000),
982
- cumulativeDurationMs: 18_000,
986
+ ...metrics,
983
987
  events: [
984
988
  reportEvent(0, startedAt, {
985
989
  type: "message",
@@ -1399,11 +1403,28 @@ function mockConversations(nowMs: number): MockConversation[] {
1399
1403
  nowMs,
1400
1404
  DASHBOARD_QA_PLAN_ID,
1401
1405
  "Review the dashboard plan before editing.",
1406
+ {
1407
+ cumulativeDurationMs: 72_400,
1408
+ cumulativeUsage: {
1409
+ inputTokens: 38_400,
1410
+ outputTokens: 2_150,
1411
+ cachedInputTokens: 21_600,
1412
+ cost: { input: 0.094, output: 0.048, total: 0.142 },
1413
+ },
1414
+ },
1402
1415
  ),
1403
1416
  advisorConversation(
1404
1417
  nowMs,
1405
1418
  DASHBOARD_QA_REVIEW_ID,
1406
1419
  "Review the implementation after the first advisor pass.",
1420
+ {
1421
+ cumulativeDurationMs: 9_800,
1422
+ cumulativeUsage: {
1423
+ inputTokens: 6_200,
1424
+ outputTokens: 310,
1425
+ cost: { input: 0.015, output: 0.004, total: 0.019 },
1426
+ },
1427
+ },
1407
1428
  ),
1408
1429
  longConversation(nowMs),
1409
1430
  incidentConversation(nowMs),
@@ -1829,7 +1850,8 @@ export function readMockConversationPendingMessages(
1829
1850
  export function readMockConversationChildAgents(
1830
1851
  conversationId: string,
1831
1852
  ): ConversationChildAgentsReport | undefined {
1832
- const conversation = mockConversations(NOW_MS).find(
1853
+ const conversations = mockConversations(NOW_MS);
1854
+ const conversation = conversations.find(
1833
1855
  (candidate) => candidate.conversationId === conversationId,
1834
1856
  );
1835
1857
  if (!conversation) return undefined;
@@ -1837,9 +1859,20 @@ export function readMockConversationChildAgents(
1837
1859
  return { agents: [], conversationId };
1838
1860
  }
1839
1861
  const startedAtMs = NOW_MS - 5 * 60 * 60_000;
1862
+ // Match the API: each row has the usage of its own child Conversation.
1863
+ const childMetrics = (childConversationId: string) => {
1864
+ const child = conversations.find(
1865
+ (candidate) => candidate.conversationId === childConversationId,
1866
+ )!;
1867
+ return {
1868
+ cumulativeDurationMs: child.cumulativeDurationMs,
1869
+ cumulativeUsage: child.cumulativeUsage,
1870
+ };
1871
+ };
1840
1872
  return {
1841
1873
  agents: [
1842
1874
  {
1875
+ ...childMetrics(DASHBOARD_QA_REVIEW_ID),
1843
1876
  conversationId: DASHBOARD_QA_REVIEW_ID,
1844
1877
  error: "GitHub access is needed to read the pull request.",
1845
1878
  name: "reviewer",
@@ -1848,6 +1881,7 @@ export function readMockConversationChildAgents(
1848
1881
  updatedAt: iso(startedAtMs, 44_000),
1849
1882
  },
1850
1883
  {
1884
+ ...childMetrics(DASHBOARD_QA_PLAN_ID),
1851
1885
  conversationId: DASHBOARD_QA_PLAN_ID,
1852
1886
  status: "completed",
1853
1887
  task: "Review the dashboard plan before editing.",
@@ -1859,6 +1893,36 @@ export function readMockConversationChildAgents(
1859
1893
  };
1860
1894
  }
1861
1895
 
1896
+ /** Build the agent tree of a mock child Conversation, like the API. */
1897
+ function mockAgentTree(
1898
+ conversation: MockConversation,
1899
+ ): ConversationDetailReport["agentTree"] {
1900
+ if (!conversation.parentConversationId) return undefined;
1901
+ const conversations = mockConversations(NOW_MS);
1902
+ const chain = [conversation];
1903
+ let current = conversation;
1904
+ while (current.parentConversationId) {
1905
+ const parent = conversations.find(
1906
+ (candidate) => candidate.conversationId === current.parentConversationId,
1907
+ );
1908
+ if (!parent) break;
1909
+ chain.unshift(parent);
1910
+ current = parent;
1911
+ }
1912
+ return chain.map((item) => {
1913
+ if (!item.parentConversationId) {
1914
+ return { conversationId: item.conversationId, label: item.displayTitle };
1915
+ }
1916
+ const agent = readMockConversationChildAgents(
1917
+ item.parentConversationId,
1918
+ )?.agents.find((child) => child.conversationId === item.conversationId);
1919
+ return {
1920
+ conversationId: item.conversationId,
1921
+ label: agent?.title ?? agent?.name ?? "Subagent",
1922
+ };
1923
+ });
1924
+ }
1925
+
1862
1926
  /** Return one canonical-event visual-QA conversation detail fixture. */
1863
1927
  export function readMockConversationDetail(
1864
1928
  conversationId: string,
@@ -1869,9 +1933,11 @@ export function readMockConversationDetail(
1869
1933
  );
1870
1934
  if (!conversation) return undefined;
1871
1935
  const { parentConversationId, ...conversationDetail } = conversation;
1936
+ const agentTree = mockAgentTree(conversation);
1872
1937
  // Match the API: only readable root Conversations can be forked.
1873
1938
  const detail = {
1874
1939
  ...conversationDetail,
1940
+ ...(agentTree ? { agentTree } : undefined),
1875
1941
  canFork:
1876
1942
  !parentConversationId &&
1877
1943
  conversationDetail.eventHistory.status !== "redacted",