@flanksource/clicky-ui 0.3.82 → 0.3.84

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 (137) hide show
  1. package/dist/components/DateField.cjs.map +1 -1
  2. package/dist/components/DateField.d.ts +3 -2
  3. package/dist/components/DateField.d.ts.map +1 -1
  4. package/dist/components/DateField.js.map +1 -1
  5. package/dist/components/DatePicker.cjs +9 -61
  6. package/dist/components/DatePicker.cjs.map +1 -1
  7. package/dist/components/DatePicker.d.ts +5 -19
  8. package/dist/components/DatePicker.d.ts.map +1 -1
  9. package/dist/components/DatePicker.js +11 -63
  10. package/dist/components/DatePicker.js.map +1 -1
  11. package/dist/components/DateTimePicker.cjs +9 -78
  12. package/dist/components/DateTimePicker.cjs.map +1 -1
  13. package/dist/components/DateTimePicker.d.ts +5 -19
  14. package/dist/components/DateTimePicker.d.ts.map +1 -1
  15. package/dist/components/DateTimePicker.js +11 -80
  16. package/dist/components/DateTimePicker.js.map +1 -1
  17. package/dist/components/calendar-grid.cjs +83 -0
  18. package/dist/components/calendar-grid.cjs.map +1 -0
  19. package/dist/components/calendar-grid.d.ts +9 -0
  20. package/dist/components/calendar-grid.d.ts.map +1 -0
  21. package/dist/components/calendar-grid.js +83 -0
  22. package/dist/components/calendar-grid.js.map +1 -0
  23. package/dist/components/date-input-field.cjs +88 -0
  24. package/dist/components/date-input-field.cjs.map +1 -0
  25. package/dist/components/date-input-field.d.ts +37 -0
  26. package/dist/components/date-input-field.d.ts.map +1 -0
  27. package/dist/components/date-input-field.js +88 -0
  28. package/dist/components/date-input-field.js.map +1 -0
  29. package/dist/components/date-math.cjs +67 -0
  30. package/dist/components/date-math.cjs.map +1 -0
  31. package/dist/components/date-math.d.ts +33 -0
  32. package/dist/components/date-math.d.ts.map +1 -0
  33. package/dist/components/date-math.js +60 -0
  34. package/dist/components/date-math.js.map +1 -0
  35. package/dist/components/date-picker-menu.cjs +129 -0
  36. package/dist/components/date-picker-menu.cjs.map +1 -0
  37. package/dist/components/date-picker-menu.d.ts +18 -0
  38. package/dist/components/date-picker-menu.d.ts.map +1 -0
  39. package/dist/components/date-picker-menu.js +129 -0
  40. package/dist/components/date-picker-menu.js.map +1 -0
  41. package/dist/components/json-schema-form-date-math.cjs +15 -11
  42. package/dist/components/json-schema-form-date-math.cjs.map +1 -1
  43. package/dist/components/json-schema-form-date-math.d.ts +3 -0
  44. package/dist/components/json-schema-form-date-math.d.ts.map +1 -1
  45. package/dist/components/json-schema-form-date-math.js +15 -12
  46. package/dist/components/json-schema-form-date-math.js.map +1 -1
  47. package/dist/components.d.ts +1 -0
  48. package/dist/components.d.ts.map +1 -1
  49. package/dist/data/PromptDialog.cjs +19 -5
  50. package/dist/data/PromptDialog.cjs.map +1 -1
  51. package/dist/data/PromptDialog.d.ts +15 -1
  52. package/dist/data/PromptDialog.d.ts.map +1 -1
  53. package/dist/data/PromptDialog.js +19 -5
  54. package/dist/data/PromptDialog.js.map +1 -1
  55. package/dist/data/PromptIndicator.cjs +3 -2
  56. package/dist/data/PromptIndicator.cjs.map +1 -1
  57. package/dist/data/PromptIndicator.d.ts +4 -1
  58. package/dist/data/PromptIndicator.d.ts.map +1 -1
  59. package/dist/data/PromptIndicator.js +3 -2
  60. package/dist/data/PromptIndicator.js.map +1 -1
  61. package/dist/data/diagnostics/ErrorDetails.cjs +155 -110
  62. package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
  63. package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
  64. package/dist/data/diagnostics/ErrorDetails.js +155 -110
  65. package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
  66. package/dist/data/test-runner/TestDetailPanel.cjs +109 -46
  67. package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
  68. package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
  69. package/dist/data/test-runner/TestDetailPanel.js +110 -47
  70. package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
  71. package/dist/data/test-runner/TestTreeNode.cjs +84 -63
  72. package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
  73. package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
  74. package/dist/data/test-runner/TestTreeNode.js +84 -63
  75. package/dist/data/test-runner/TestTreeNode.js.map +1 -1
  76. package/dist/data/test-runner/adapter.cjs.map +1 -1
  77. package/dist/data/test-runner/adapter.d.ts +2 -2
  78. package/dist/data/test-runner/adapter.d.ts.map +1 -1
  79. package/dist/data/test-runner/adapter.js.map +1 -1
  80. package/dist/data/test-runner/copy.cjs +62 -10
  81. package/dist/data/test-runner/copy.cjs.map +1 -1
  82. package/dist/data/test-runner/copy.d.ts +52 -9
  83. package/dist/data/test-runner/copy.d.ts.map +1 -1
  84. package/dist/data/test-runner/copy.js +60 -11
  85. package/dist/data/test-runner/copy.js.map +1 -1
  86. package/dist/data/test-runner/index.d.ts +1 -1
  87. package/dist/data/test-runner/index.d.ts.map +1 -1
  88. package/dist/data/verification/StepFilesView.cjs +90 -0
  89. package/dist/data/verification/StepFilesView.cjs.map +1 -0
  90. package/dist/data/verification/StepFilesView.d.ts +9 -0
  91. package/dist/data/verification/StepFilesView.d.ts.map +1 -0
  92. package/dist/data/verification/StepFilesView.js +90 -0
  93. package/dist/data/verification/StepFilesView.js.map +1 -0
  94. package/dist/data/verification/adapterViews.cjs +129 -69
  95. package/dist/data/verification/adapterViews.cjs.map +1 -1
  96. package/dist/data/verification/adapterViews.d.ts +3 -1
  97. package/dist/data/verification/adapterViews.d.ts.map +1 -1
  98. package/dist/data/verification/adapterViews.js +130 -70
  99. package/dist/data/verification/adapterViews.js.map +1 -1
  100. package/dist/data/verification/adapters.cjs +9 -0
  101. package/dist/data/verification/adapters.cjs.map +1 -1
  102. package/dist/data/verification/adapters.d.ts +2 -0
  103. package/dist/data/verification/adapters.d.ts.map +1 -1
  104. package/dist/data/verification/adapters.js +11 -2
  105. package/dist/data/verification/adapters.js.map +1 -1
  106. package/dist/data/verification/index.d.ts +2 -1
  107. package/dist/data/verification/index.d.ts.map +1 -1
  108. package/dist/data/verification/stepKind.cjs +63 -7
  109. package/dist/data/verification/stepKind.cjs.map +1 -1
  110. package/dist/data/verification/stepKind.d.ts +55 -6
  111. package/dist/data/verification/stepKind.d.ts.map +1 -1
  112. package/dist/data/verification/stepKind.js +62 -8
  113. package/dist/data/verification/stepKind.js.map +1 -1
  114. package/dist/data/verification/stepKindViews.cjs +318 -106
  115. package/dist/data/verification/stepKindViews.cjs.map +1 -1
  116. package/dist/data/verification/stepKindViews.d.ts +17 -6
  117. package/dist/data/verification/stepKindViews.d.ts.map +1 -1
  118. package/dist/data/verification/stepKindViews.js +319 -108
  119. package/dist/data/verification/stepKindViews.js.map +1 -1
  120. package/dist/data/version-info.cjs +3 -3
  121. package/dist/data/version-info.js +3 -3
  122. package/dist/data.cjs +4 -0
  123. package/dist/data.d.ts +1 -1
  124. package/dist/data.d.ts.map +1 -1
  125. package/dist/data.js +3 -2
  126. package/dist/hooks/use-prompts.cjs +52 -30
  127. package/dist/hooks/use-prompts.cjs.map +1 -1
  128. package/dist/hooks/use-prompts.d.ts +6 -0
  129. package/dist/hooks/use-prompts.d.ts.map +1 -1
  130. package/dist/hooks/use-prompts.js +52 -30
  131. package/dist/hooks/use-prompts.js.map +1 -1
  132. package/dist/index.cjs +5 -1
  133. package/dist/index.js +4 -3
  134. package/dist/runtime/barrels.json +5874 -5867
  135. package/dist/runtime/importmap.json +2175 -2170
  136. package/dist/styles.css +1 -1
  137. package/package.json +1 -1
@@ -66,6 +66,9 @@ function DefaultDetailBody({ node }) {
66
66
  ]
67
67
  });
68
68
  }
69
+ function copyPayload(item) {
70
+ return typeof item.value === "string" ? item.value : { plain: item.value() };
71
+ }
69
72
  function copyMenuItem(item, copy) {
70
73
  const icon = item.icon ? { icon: item.icon } : {};
71
74
  if ("reason" in item) return {
@@ -78,7 +81,7 @@ function copyMenuItem(item, copy) {
78
81
  return {
79
82
  label: item.label,
80
83
  ...icon,
81
- onSelect: () => copy(item.value)
84
+ onSelect: () => copy(copyPayload(item))
82
85
  };
83
86
  }
84
87
  var COPY_LABEL = {
@@ -94,28 +97,47 @@ var COPY_ICON = {
94
97
  error: require_UiWarningCircle.UiWarningCircle
95
98
  };
96
99
  /**
97
- * "Copy details" split button: the primary action copies a Markdown brief of
98
- * the generic sections plus every matching adapter's `copy` sections; the menu
99
- * offers the node as JSON and the adapters' items, disabled with a reason when
100
- * they have nothing to copy. The label flips to "Copied" or "Copy failed".
100
+ * "Copy details" split button: the primary action copies a summarized Markdown
101
+ * brief of the generic sections plus every matching adapter's `copy` sections,
102
+ * each cut to a few lines with a pointer to the file on disk that has the rest;
103
+ * the menu offers the whole brief, the node as JSON and the adapters' items,
104
+ * disabled with a reason when they have nothing to copy. An adapter item marked
105
+ * `primary` (e.g. an AI prompt for a failing node) takes over the primary
106
+ * action and label, and the brief moves into the menu as "Copy details". The
107
+ * label flips to "Copied" or "Copy failed".
101
108
  */
102
109
  function CopyDetailsButton({ node }) {
103
110
  const runner = require_context.useTestRunner();
104
111
  const { state, copy } = require_clipboard.useCopyFlash();
105
112
  const sections = (0, react.useMemo)(() => runner.adapters.resolveCopy(node, runner), [node, runner]);
106
- const items = [{
107
- label: "Copy as JSON",
108
- icon: require_UiJson.UiJson,
109
- onSelect: () => copy(require_copy.buildNodeJson(node))
110
- }, ...sections.items.map((item) => copyMenuItem(item, copy))];
113
+ const primary = require_copy.primaryCopyItem(sections.items);
114
+ const copyBrief = () => copy(require_copy.buildNodeBrief(node, sections));
115
+ const items = [
116
+ ...primary ? [{
117
+ label: "Copy details",
118
+ icon: require_UiCopy.UiCopy,
119
+ onSelect: copyBrief
120
+ }] : [],
121
+ {
122
+ label: "Copy full details",
123
+ icon: require_UiCopy.UiCopy,
124
+ onSelect: () => copy(require_copy.buildNodeBrief(node, sections, { full: true }))
125
+ },
126
+ {
127
+ label: "Copy as JSON",
128
+ icon: require_UiJson.UiJson,
129
+ onSelect: () => copy(require_copy.buildNodeJson(node))
130
+ },
131
+ ...sections.items.filter((item) => item !== primary).map((item) => copyMenuItem(item, copy))
132
+ ];
111
133
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SplitButton.SplitButton, {
112
- label: COPY_LABEL[state],
113
- icon: COPY_ICON[state],
134
+ label: state === "idle" && primary ? primary.label : COPY_LABEL[state],
135
+ icon: state === "idle" && primary?.icon ? primary.icon : COPY_ICON[state],
114
136
  variant: "outline",
115
137
  size: "sm",
116
138
  align: "right",
117
139
  title: "More copy options",
118
- onClick: () => copy(require_copy.buildNodeBrief(node, sections)),
140
+ onClick: primary ? () => copy(copyPayload(primary)) : copyBrief,
119
141
  items
120
142
  });
121
143
  }
@@ -230,15 +252,8 @@ function DetailHeader(props) {
230
252
  */
231
253
  function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
232
254
  const runner = require_context.useTestRunner();
233
- const selected = runner.selected;
234
- const [attemptSelection, setAttemptSelection] = (0, react.useState)(null);
235
- const controlled = runner.activeTab !== void 0;
236
- const [internalTab, setInternalTab] = (0, react.useState)("detail");
237
- const activeTab = controlled ? runner.activeTab : internalTab;
238
- const setActiveTab = (id) => {
239
- if (controlled) runner.onTabChange?.(id);
240
- else setInternalTab(id);
241
- };
255
+ const { activeTab, setActiveTab } = useActiveDetailTab();
256
+ const { selected } = runner;
242
257
  if (!selected) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
243
258
  className: "flex h-full items-center justify-center text-sm text-muted-foreground",
244
259
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -249,35 +264,67 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
249
264
  }), "Select a test to view its details."]
250
265
  })
251
266
  });
267
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectedTestDetail, {
268
+ selected,
269
+ header,
270
+ tabVariant,
271
+ activeTab,
272
+ setActiveTab
273
+ });
274
+ }
275
+ function useActiveDetailTab() {
276
+ const runner = require_context.useTestRunner();
277
+ const [internalTab, setInternalTab] = (0, react.useState)("detail");
278
+ const controlled = runner.activeTab !== void 0;
279
+ const setActiveTab = (id) => {
280
+ if (controlled) runner.onTabChange?.(id);
281
+ else setInternalTab(id);
282
+ };
283
+ return {
284
+ activeTab: runner.activeTab ?? internalTab,
285
+ setActiveTab
286
+ };
287
+ }
288
+ function attemptLabel(a, total) {
289
+ const duration = a.durationMs !== void 0 ? ` · ${require_status.formatTestDuration(a.durationMs * 1e6)}` : "";
290
+ return `Attempt ${a.id}/${total} · ${a.status}${duration}`;
291
+ }
292
+ function useAttemptSelection(selected) {
293
+ const runner = require_context.useTestRunner();
294
+ const [attemptSelection, setAttemptSelection] = (0, react.useState)(null);
252
295
  const attempts = runner.adapters.resolveAttempts(selected, runner);
253
296
  const key = selected.task_id ?? selected.name;
254
297
  const attemptId = runner.activeAttempt ?? (attemptSelection?.key === key ? attemptSelection.id : void 0);
255
298
  const attempt = attempts.find((a) => a.id === attemptId) ?? attempts.at(-1);
256
- const node = attempts.length > 1 && attempt ? attempt.node : selected;
257
- const attemptChooser = attempts.length > 1 && attempt ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
299
+ const multiple = attempts.length > 1 && !!attempt;
300
+ const onChange = (id) => {
301
+ if (runner.onAttemptChange) runner.onAttemptChange(id);
302
+ else setAttemptSelection({
303
+ key,
304
+ id
305
+ });
306
+ };
307
+ const chooser = multiple && attempt ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
258
308
  className: "w-44 shrink-0",
259
309
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.Select, {
260
310
  "aria-label": "Attempt",
261
311
  value: String(attempt.id),
262
312
  className: "h-7 text-xs",
263
- onChange: (event) => {
264
- const id = Number(event.target.value);
265
- if (runner.onAttemptChange) runner.onAttemptChange(id);
266
- else setAttemptSelection({
267
- key,
268
- id
269
- });
270
- },
313
+ onChange: (event) => onChange(Number(event.target.value)),
271
314
  options: attempts.map((a) => ({
272
315
  value: String(a.id),
273
- label: `Attempt ${a.id}/${attempts.length} · ${a.status}${a.durationMs !== void 0 ? ` · ${require_status.formatTestDuration(a.durationMs * 1e6)}` : ""}`
316
+ label: attemptLabel(a, attempts.length)
274
317
  }))
275
318
  })
276
319
  }) : null;
277
- const detailAdapter = runner.adapters.resolveDetail(node, runner);
278
- const actionAdapter = runner.adapters.resolveActions(selected, runner);
279
- const tabs = runner.adapters.resolveTabs(node, runner);
280
- if ((node.log || node.stdout || node.stderr) && !tabs.some((tab) => tab.id === "stdout")) tabs.unshift({
320
+ return {
321
+ node: multiple && attempt ? attempt.node : selected,
322
+ attemptChooser: chooser
323
+ };
324
+ }
325
+ function resolveDetailTabs(node, tabs) {
326
+ if (!!!(node.log || node.stdout || node.stderr) || tabs.some((tab) => tab.id === "stdout")) return tabs;
327
+ return [{
281
328
  id: "stdout",
282
329
  label: "Stdout",
283
330
  render: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -287,7 +334,14 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
287
334
  view: "full"
288
335
  })
289
336
  })
290
- });
337
+ }, ...tabs];
338
+ }
339
+ function SelectedTestDetail({ selected, header, tabVariant, activeTab, setActiveTab }) {
340
+ const runner = require_context.useTestRunner();
341
+ const { node, attemptChooser } = useAttemptSelection(selected);
342
+ const detailAdapter = runner.adapters.resolveDetail(node, runner);
343
+ const actionAdapter = runner.adapters.resolveActions(selected, runner);
344
+ const tabs = resolveDetailTabs(node, runner.adapters.resolveTabs(node, runner));
291
345
  const ownsScroll = runner.adapters.ownsScroll(node, runner);
292
346
  const body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_detailTabContext.DetailTabSelectProvider, {
293
347
  value: setActiveTab,
@@ -329,14 +383,12 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
329
383
  className: "flex h-full min-h-0 flex-col",
330
384
  children: [
331
385
  fullHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailHeader, { ...headerProps }),
332
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
333
- className: require_utils.cn("flex shrink-0 items-center gap-1 border-b border-border px-density-2", tabVariant === "underline" ? "items-stretch" : "py-density-1"),
334
- children: [allTabs.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TabButton.TabButton, {
335
- active: active.id === t.id,
336
- onClick: () => setActiveTab(t.id),
337
- label: t.label,
338
- variant: tabVariant
339
- }, t.id)), !fullHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailActions, { ...headerProps })]
386
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailTabStrip, {
387
+ tabs: allTabs,
388
+ activeId: active.id,
389
+ onSelect: setActiveTab,
390
+ variant: tabVariant,
391
+ trailing: fullHeader ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailActions, { ...headerProps })
340
392
  }),
341
393
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
342
394
  className: detailRegion,
@@ -345,6 +397,17 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
345
397
  ]
346
398
  });
347
399
  }
400
+ function DetailTabStrip({ tabs, activeId, onSelect, variant, trailing }) {
401
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
402
+ className: require_utils.cn("flex shrink-0 items-center gap-1 border-b border-border px-density-2", variant === "underline" ? "items-stretch" : "py-density-1"),
403
+ children: [tabs.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TabButton.TabButton, {
404
+ active: activeId === t.id,
405
+ onClick: () => onSelect(t.id),
406
+ label: t.label,
407
+ variant
408
+ }, t.id)), trailing]
409
+ });
410
+ }
348
411
  exports.TestDetailPanel = TestDetailPanel;
349
412
 
350
413
  //# sourceMappingURL=TestDetailPanel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestDetailPanel.cjs","names":["useTestRunner","sum","TestFailureDetail","TestOutput","TestAttemptDetail","JsonView","UiCopy","UiHourglass","UiCheck","UiWarningCircle","useCopyFlash","useMemo","UiJson","buildNodeJson","SplitButton","buildNodeBrief","TestViewToggle","Button","Icon","UiRefresh","UiStop","outcomeFor","OutcomeIcon","UiClass","ToolIcon","toolKeyFor","_Fragment","UiClock","formatTestDuration","OpenInFilesLink","relPath","useState","Select","DetailTabSelectProvider","cn","TabButton"],"sources":["../../../src/data/test-runner/TestDetailPanel.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../../components/button\";\nimport { Select } from \"../../components/select\";\nimport { SplitButton } from \"../../components/SplitButton\";\nimport { useCopyFlash, type CopyFlashState } from \"../../components/clipboard\";\nimport type { DropdownMenuItem } from \"../../overlay/DropdownMenu\";\nimport { cn } from \"../../lib/utils\";\nimport { JsonView } from \"../JsonView\";\nimport { TabButton, type TabButtonVariant } from \"../TabButton\";\nimport { OpenInFilesLink } from \"../OpenInFilesLink\";\nimport { relPath } from \"../lint/paths\";\nimport {\n UiCheck,\n UiClass,\n UiClock,\n UiCopy,\n UiHourglass,\n UiJson,\n UiRefresh,\n UiStop,\n UiWarningCircle,\n} from \"../../icons\";\nimport type { Test } from \"./types\";\nimport { useTestRunner } from \"./context\";\nimport { DetailTabSelectProvider } from \"./detailTabContext\";\nimport { buildNodeBrief, buildNodeJson, type CopyItem } from \"./copy\";\nimport { formatTestDuration, outcomeFor, sum } from \"./status\";\nimport { toolKeyFor } from \"./marks\";\nimport { OutcomeIcon, ToolIcon } from \"./MarkIcons\";\nimport { TestFailureDetail, TestOutput } from \"./TestFailureDetail\";\nimport { TestAttemptDetail } from \"./TestAttemptDetail\";\nimport { TestViewToggle } from \"./TestViewToggle\";\n\n/** Built-in detail body — used when no adapter contributes `renderDetail`. */\nfunction DefaultDetailBody({ node }: { node: Test }) {\n const runner = useTestRunner();\n const attempt = node.attempts?.at(-1);\n const hasChildren = (node.children?.length ?? 0) > 0;\n const counts = hasChildren ? sum(node) : null;\n return (\n <div className=\"space-y-4 p-density-4\">\n {node.message && !node.failure_detail && (\n <p className=\"whitespace-pre-wrap break-words text-sm\">{node.message}</p>\n )}\n {node.failure_detail && <TestFailureDetail failure={node.failure_detail} />}\n <TestOutput node={node} />\n {attempt && (\n <TestAttemptDetail\n key={`${attempt.run_kind ?? \"\"}:${attempt.sequence}`}\n attempt={attempt}\n {...(runner.fetchProcessMetrics ? { fetchProcessMetrics: runner.fetchProcessMetrics } : {})}\n />\n )}\n {counts && counts.total > 0 && (\n <div className=\"flex flex-wrap gap-3 text-xs text-muted-foreground\">\n <span>{counts.total} total</span>\n {counts.passed > 0 && <span>{counts.passed} passed</span>}\n {counts.failed > 0 && <span>{counts.failed} failed</span>}\n {counts.skipped > 0 && <span>{counts.skipped} skipped</span>}\n </div>\n )}\n {node.detail != null && (\n <div className=\"space-y-1\">\n <div className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">Detail</div>\n <JsonView data={node.detail} />\n </div>\n )}\n </div>\n );\n}\n\nfunction copyMenuItem(item: CopyItem, copy: (text: string) => void): DropdownMenuItem {\n const icon = item.icon ? { icon: item.icon } : {};\n if (\"reason\" in item) {\n return { label: item.label, ...icon, disabled: true, title: item.reason, onSelect: () => {} };\n }\n return { label: item.label, ...icon, onSelect: () => copy(item.value) };\n}\n\nconst COPY_LABEL = {\n idle: \"Copy details\",\n pending: \"Copying…\",\n copied: \"Copied\",\n error: \"Copy failed\",\n} as const satisfies Record<CopyFlashState, string>;\nconst COPY_ICON = {\n idle: UiCopy,\n pending: UiHourglass,\n copied: UiCheck,\n error: UiWarningCircle,\n} as const satisfies Record<CopyFlashState, unknown>;\n\n/**\n * \"Copy details\" split button: the primary action copies a Markdown brief of\n * the generic sections plus every matching adapter's `copy` sections; the menu\n * offers the node as JSON and the adapters' items, disabled with a reason when\n * they have nothing to copy. The label flips to \"Copied\" or \"Copy failed\".\n */\nfunction CopyDetailsButton({ node }: { node: Test }) {\n const runner = useTestRunner();\n const { state, copy } = useCopyFlash();\n const sections = useMemo(() => runner.adapters.resolveCopy(node, runner), [node, runner]);\n const items: DropdownMenuItem[] = [\n { label: \"Copy as JSON\", icon: UiJson, onSelect: () => copy(buildNodeJson(node)) },\n ...sections.items.map((item) => copyMenuItem(item, copy)),\n ];\n return (\n <SplitButton\n label={COPY_LABEL[state]}\n icon={COPY_ICON[state]}\n variant=\"outline\"\n size=\"sm\"\n align=\"right\"\n title=\"More copy options\"\n onClick={() => copy(buildNodeBrief(node, sections))}\n items={items}\n />\n );\n}\n\ntype DetailHeaderProps = { node: Test; actionNode: Test; actions?: ReactNode; attemptChooser?: ReactNode };\n\n/** The attempt chooser, adapter actions, copy and rerun/stop controls for the shown node. */\nfunction DetailActions({ node, actionNode, actions, attemptChooser }: DetailHeaderProps) {\n const runner = useTestRunner();\n const canRerun = !!runner.onRerun && actionNode.framework !== \"task\";\n const canStop = !!runner.onStop && !!actionNode.can_stop && !!actionNode.task_id;\n return (\n <div className=\"ml-auto flex shrink-0 items-center gap-1\" data-detail-actions=\"\">\n {attemptChooser}\n {actions}\n {/* The list view carries the toggle in its toolbar, so its inline detail doesn't repeat it. */}\n {runner.view !== \"list\" && <TestViewToggle />}\n <CopyDetailsButton node={node} />\n {canRerun && (\n <Button\n size=\"sm\"\n disabled={runner.busy.rerun}\n onClick={() => runner.onRerun!(actionNode)}\n title=\"Rerun this test or subtree\"\n >\n <Icon icon={UiRefresh} className=\"mr-1 text-sm\" />\n {runner.busy.rerun ? \"Running...\" : \"Rerun\"}\n </Button>\n )}\n {canStop && (\n <Button\n size=\"sm\"\n variant=\"destructive\"\n disabled={runner.busy.stop}\n onClick={() => runner.onStop!(actionNode)}\n title=\"Stop this running task\"\n >\n <Icon icon={UiStop} className=\"mr-1 text-sm\" />\n {runner.busy.stop ? \"Stopping...\" : \"Stop\"}\n </Button>\n )}\n </div>\n );\n}\n\nfunction DetailHeader(props: DetailHeaderProps) {\n const { node } = props;\n const runner = useTestRunner();\n const outcome = outcomeFor(node);\n const location = node.file ? `${node.file}${node.line ? `:${node.line}` : \"\"}` : undefined;\n const frameworkBadge = runner.adapters.resolveFrameworkBadge(node, runner);\n return (\n <div\n className=\"flex min-w-0 items-center gap-2 border-b border-border px-density-4 py-density-2\"\n data-detail-header=\"\"\n >\n {outcome ? (\n <OutcomeIcon outcome={outcome} className=\"text-lg\" />\n ) : (\n <Icon icon={UiClass} className=\"shrink-0 text-lg text-muted-foreground\" />\n )}\n <h2 className=\"min-w-0 shrink truncate text-base font-semibold\" title={node.name}>\n {node.name}\n </h2>\n {node.framework && (\n <span\n className=\"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground\"\n data-framework-badge=\"\"\n >\n <ToolIcon tool={toolKeyFor(node)} className=\"text-sm\" />\n {node.framework}\n {frameworkBadge != null && (\n <>\n <span aria-hidden=\"true\">·</span>\n {frameworkBadge}\n </>\n )}\n </span>\n )}\n {node.duration ? (\n <span className=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground\">\n <Icon icon={UiClock} className=\"text-xs\" />\n {formatTestDuration(node.duration)}\n </span>\n ) : null}\n {location && (\n <span\n className=\"min-w-0 shrink-[100] truncate font-mono text-xs text-muted-foreground\"\n title={location}\n >\n {location}\n </span>\n )}\n {node.file && runner.onOpenFile && (\n <OpenInFilesLink\n className=\"shrink-0\"\n onOpenFile={runner.onOpenFile}\n target={{\n file: relPath(node.file, node.work_dir)!,\n ...(node.work_dir ? { workDir: node.work_dir } : {}),\n ...(node.line ? { line: node.line } : {}),\n }}\n />\n )}\n <DetailActions {...props} />\n </div>\n );\n}\n\n/**\n * The right pane. Resolves the node's adapter for body / tabs / header actions,\n * falling back to the built-in default body. Shows an empty state when nothing\n * is selected.\n *\n * `header=\"actions\"` drops the node's identity (outcome, name, tool, duration,\n * location) for hosts that already show it, e.g. an expandable card, and keeps\n * only the controls, in the tab row when there are tabs. `tabVariant` picks the\n * tab row style (filled `pill`, the default, or `underline`).\n */\nexport function TestDetailPanel({ header = \"full\", tabVariant = \"pill\" }: { header?: \"full\" | \"actions\"; tabVariant?: TabButtonVariant } = {}) {\n const runner = useTestRunner();\n const selected = runner.selected;\n const [attemptSelection, setAttemptSelection] = useState<{ key: string; id: number } | null>(null);\n // Tab state is controlled when the host supplies activeTab (e.g. to mirror it\n // into the URL); otherwise the panel owns it. The render below tolerates an\n // unknown id by falling back to the built-in \"detail\" tab.\n const controlled = runner.activeTab !== undefined;\n const [internalTab, setInternalTab] = useState<string>(\"detail\");\n const activeTab = controlled ? runner.activeTab! : internalTab;\n const setActiveTab = (id: string) => {\n if (controlled) runner.onTabChange?.(id);\n else setInternalTab(id);\n };\n\n if (!selected) {\n return (\n <div className=\"flex h-full items-center justify-center text-sm text-muted-foreground\">\n <div className=\"text-center\">\n <Icon icon={UiClass} className=\"mb-2 block text-4xl\" />\n Select a test to view its details.\n </div>\n </div>\n );\n }\n\n const attempts = runner.adapters.resolveAttempts(selected, runner);\n const key = selected.task_id ?? selected.name;\n const attemptId = runner.activeAttempt ?? (attemptSelection?.key === key ? attemptSelection.id : undefined);\n const attempt = attempts.find((a) => a.id === attemptId) ?? attempts.at(-1);\n const node = attempts.length > 1 && attempt ? attempt.node : selected;\n const attemptChooser = attempts.length > 1 && attempt ? (\n <div className=\"w-44 shrink-0\">\n <Select aria-label=\"Attempt\" value={String(attempt.id)} className=\"h-7 text-xs\" onChange={(event) => {\n const id = Number(event.target.value);\n if (runner.onAttemptChange) runner.onAttemptChange(id);\n else setAttemptSelection({ key, id });\n }} options={attempts.map((a) => ({ value: String(a.id), label: `Attempt ${a.id}/${attempts.length} · ${a.status}${a.durationMs !== undefined ? ` · ${formatTestDuration(a.durationMs * 1e6)}` : \"\"}` }))} />\n </div>\n ) : null;\n\n const detailAdapter = runner.adapters.resolveDetail(node, runner);\n const actionAdapter = runner.adapters.resolveActions(selected, runner);\n const tabs = runner.adapters.resolveTabs(node, runner);\n if ((node.log || node.stdout || node.stderr) && !tabs.some((tab) => tab.id === \"stdout\")) {\n tabs.unshift({\n id: \"stdout\",\n label: \"Stdout\",\n render: () => <div className=\"p-density-4\"><TestOutput node={node} view=\"full\" /></div>,\n });\n }\n const ownsScroll = runner.adapters.ownsScroll(node, runner);\n\n const body = (\n <DetailTabSelectProvider value={setActiveTab}>\n {detailAdapter?.renderDetail\n ? detailAdapter.renderDetail({ node, runner })\n : <DefaultDetailBody node={node} />}\n </DetailTabSelectProvider>\n );\n const actions = actionAdapter?.nodeActions?.({ node: selected, runner });\n\n // A size container, so log blocks can cap themselves at a share of the pane (cqh).\n const detailRegion = cn(\"min-h-0 flex-1 [container-type:size]\", !ownsScroll && \"overflow-y-auto\");\n\n const headerProps: DetailHeaderProps = { node, actionNode: selected, actions, attemptChooser };\n const fullHeader = header === \"full\";\n\n // No extra tabs → just the body under the header.\n if (tabs.length === 0) {\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {fullHeader ? (\n <DetailHeader {...headerProps} />\n ) : (\n <div className=\"flex shrink-0 border-b border-border px-density-2 py-density-1\">\n <DetailActions {...headerProps} />\n </div>\n )}\n <div className={detailRegion}>{body}</div>\n </div>\n );\n }\n\n const detailTab = { id: \"detail\", label: \"Detail\", render: () => body };\n const allTabs = [detailTab, ...tabs];\n const active = allTabs.find((t) => t.id === activeTab) ?? detailTab;\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {fullHeader && <DetailHeader {...headerProps} />}\n <div className={cn(\"flex shrink-0 items-center gap-1 border-b border-border px-density-2\", tabVariant === \"underline\" ? \"items-stretch\" : \"py-density-1\")}>\n {allTabs.map((t) => (\n <TabButton\n key={t.id}\n active={active.id === t.id}\n onClick={() => setActiveTab(t.id)}\n label={t.label}\n variant={tabVariant}\n />\n ))}\n {!fullHeader && <DetailActions {...headerProps} />}\n </div>\n <div className={detailRegion}>{active.render()}</div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,kBAAkB,EAAE,QAAwB;CACnD,M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UAAA;GACG,cAAc,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD,EAAc,GAAI,YAAc,CAAA;GAC/C,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAWA,cAAAA,GAAG,wEAAwE,eAAe,cAAc,kBAAkB,cAAc;IAAxJ,UAAA,CACG,QAAQ,KAAK,MACZ,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;KAEE,QAAQ,OAAO,OAAO,EAAE;KACxB,eAAe,aAAa,EAAE,EAAE;KAChC,OAAO,EAAE;KACT,SAAS;IACV,GALM,EAAE,EAKR,CACF,GACA,CAAC,cAAc,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAe,GAAI,YAAc,CAAA,CAC9C;;GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAW;IAAe,UAAA,OAAO,OAAO;GAAO,CAAA;EACjD;;AAET"}
1
+ {"version":3,"file":"TestDetailPanel.cjs","names":["useTestRunner","sum","TestFailureDetail","TestOutput","TestAttemptDetail","JsonView","UiCopy","UiHourglass","UiCheck","UiWarningCircle","useCopyFlash","useMemo","primaryCopyItem","buildNodeBrief","UiJson","buildNodeJson","SplitButton","TestViewToggle","Button","Icon","UiRefresh","UiStop","outcomeFor","OutcomeIcon","UiClass","ToolIcon","toolKeyFor","_Fragment","UiClock","formatTestDuration","OpenInFilesLink","relPath","useState","Select","DetailTabSelectProvider","cn","TabButton"],"sources":["../../../src/data/test-runner/TestDetailPanel.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../../components/button\";\nimport { Select } from \"../../components/select\";\nimport { SplitButton } from \"../../components/SplitButton\";\nimport { useCopyFlash, type CopyFlashPayload, type CopyFlashState } from \"../../components/clipboard\";\nimport type { DropdownMenuItem } from \"../../overlay/DropdownMenu\";\nimport { cn } from \"../../lib/utils\";\nimport { JsonView } from \"../JsonView\";\nimport { TabButton, type TabButtonVariant } from \"../TabButton\";\nimport { OpenInFilesLink } from \"../OpenInFilesLink\";\nimport { relPath } from \"../lint/paths\";\nimport {\n UiCheck,\n UiClass,\n UiClock,\n UiCopy,\n UiHourglass,\n UiJson,\n UiRefresh,\n UiStop,\n UiWarningCircle,\n} from \"../../icons\";\nimport type { Test } from \"./types\";\nimport { useTestRunner } from \"./context\";\nimport { DetailTabSelectProvider } from \"./detailTabContext\";\nimport { buildNodeBrief, buildNodeJson, primaryCopyItem, type CopyItem } from \"./copy\";\nimport { formatTestDuration, outcomeFor, sum } from \"./status\";\nimport { toolKeyFor } from \"./marks\";\nimport { OutcomeIcon, ToolIcon } from \"./MarkIcons\";\nimport { TestFailureDetail, TestOutput } from \"./TestFailureDetail\";\nimport { TestAttemptDetail } from \"./TestAttemptDetail\";\nimport { TestViewToggle } from \"./TestViewToggle\";\n\n/** Built-in detail body — used when no adapter contributes `renderDetail`. */\nfunction DefaultDetailBody({ node }: { node: Test }) {\n const runner = useTestRunner();\n const attempt = node.attempts?.at(-1);\n const hasChildren = (node.children?.length ?? 0) > 0;\n const counts = hasChildren ? sum(node) : null;\n return (\n <div className=\"space-y-4 p-density-4\">\n {node.message && !node.failure_detail && (\n <p className=\"whitespace-pre-wrap break-words text-sm\">{node.message}</p>\n )}\n {node.failure_detail && <TestFailureDetail failure={node.failure_detail} />}\n <TestOutput node={node} />\n {attempt && (\n <TestAttemptDetail\n key={`${attempt.run_kind ?? \"\"}:${attempt.sequence}`}\n attempt={attempt}\n {...(runner.fetchProcessMetrics ? { fetchProcessMetrics: runner.fetchProcessMetrics } : {})}\n />\n )}\n {counts && counts.total > 0 && (\n <div className=\"flex flex-wrap gap-3 text-xs text-muted-foreground\">\n <span>{counts.total} total</span>\n {counts.passed > 0 && <span>{counts.passed} passed</span>}\n {counts.failed > 0 && <span>{counts.failed} failed</span>}\n {counts.skipped > 0 && <span>{counts.skipped} skipped</span>}\n </div>\n )}\n {node.detail != null && (\n <div className=\"space-y-1\">\n <div className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">Detail</div>\n <JsonView data={node.detail} />\n </div>\n )}\n </div>\n );\n}\n\ntype CopyableItem = Extract<CopyItem, { value: unknown }>;\n\n// A loaded value goes through `{ plain }` so the clipboard write stays inside the click's user activation.\nfunction copyPayload(item: CopyableItem): CopyFlashPayload {\n return typeof item.value === \"string\" ? item.value : { plain: item.value() };\n}\n\nfunction copyMenuItem(item: CopyItem, copy: (payload: CopyFlashPayload) => void): DropdownMenuItem {\n const icon = item.icon ? { icon: item.icon } : {};\n if (\"reason\" in item) {\n return { label: item.label, ...icon, disabled: true, title: item.reason, onSelect: () => {} };\n }\n return { label: item.label, ...icon, onSelect: () => copy(copyPayload(item)) };\n}\n\nconst COPY_LABEL = {\n idle: \"Copy details\",\n pending: \"Copying…\",\n copied: \"Copied\",\n error: \"Copy failed\",\n} as const satisfies Record<CopyFlashState, string>;\nconst COPY_ICON = {\n idle: UiCopy,\n pending: UiHourglass,\n copied: UiCheck,\n error: UiWarningCircle,\n} as const satisfies Record<CopyFlashState, unknown>;\n\n/**\n * \"Copy details\" split button: the primary action copies a summarized Markdown\n * brief of the generic sections plus every matching adapter's `copy` sections,\n * each cut to a few lines with a pointer to the file on disk that has the rest;\n * the menu offers the whole brief, the node as JSON and the adapters' items,\n * disabled with a reason when they have nothing to copy. An adapter item marked\n * `primary` (e.g. an AI prompt for a failing node) takes over the primary\n * action and label, and the brief moves into the menu as \"Copy details\". The\n * label flips to \"Copied\" or \"Copy failed\".\n */\nfunction CopyDetailsButton({ node }: { node: Test }) {\n const runner = useTestRunner();\n const { state, copy } = useCopyFlash();\n const sections = useMemo(() => runner.adapters.resolveCopy(node, runner), [node, runner]);\n const primary = primaryCopyItem(sections.items);\n const copyBrief = () => copy(buildNodeBrief(node, sections));\n const items: DropdownMenuItem[] = [\n ...(primary ? [{ label: \"Copy details\", icon: UiCopy, onSelect: copyBrief }] : []),\n { label: \"Copy full details\", icon: UiCopy, onSelect: () => copy(buildNodeBrief(node, sections, { full: true })) },\n { label: \"Copy as JSON\", icon: UiJson, onSelect: () => copy(buildNodeJson(node)) },\n ...sections.items.filter((item) => item !== primary).map((item) => copyMenuItem(item, copy)),\n ];\n return (\n <SplitButton\n label={state === \"idle\" && primary ? primary.label : COPY_LABEL[state]}\n icon={state === \"idle\" && primary?.icon ? primary.icon : COPY_ICON[state]}\n variant=\"outline\"\n size=\"sm\"\n align=\"right\"\n title=\"More copy options\"\n onClick={primary ? () => copy(copyPayload(primary)) : copyBrief}\n items={items}\n />\n );\n}\n\ntype DetailHeaderProps = { node: Test; actionNode: Test; actions?: ReactNode; attemptChooser?: ReactNode };\n\n/** The attempt chooser, adapter actions, copy and rerun/stop controls for the shown node. */\nfunction DetailActions({ node, actionNode, actions, attemptChooser }: DetailHeaderProps) {\n const runner = useTestRunner();\n const canRerun = !!runner.onRerun && actionNode.framework !== \"task\";\n const canStop = !!runner.onStop && !!actionNode.can_stop && !!actionNode.task_id;\n return (\n <div className=\"ml-auto flex shrink-0 items-center gap-1\" data-detail-actions=\"\">\n {attemptChooser}\n {actions}\n {/* The list view carries the toggle in its toolbar, so its inline detail doesn't repeat it. */}\n {runner.view !== \"list\" && <TestViewToggle />}\n <CopyDetailsButton node={node} />\n {canRerun && (\n <Button\n size=\"sm\"\n disabled={runner.busy.rerun}\n onClick={() => runner.onRerun!(actionNode)}\n title=\"Rerun this test or subtree\"\n >\n <Icon icon={UiRefresh} className=\"mr-1 text-sm\" />\n {runner.busy.rerun ? \"Running...\" : \"Rerun\"}\n </Button>\n )}\n {canStop && (\n <Button\n size=\"sm\"\n variant=\"destructive\"\n disabled={runner.busy.stop}\n onClick={() => runner.onStop!(actionNode)}\n title=\"Stop this running task\"\n >\n <Icon icon={UiStop} className=\"mr-1 text-sm\" />\n {runner.busy.stop ? \"Stopping...\" : \"Stop\"}\n </Button>\n )}\n </div>\n );\n}\n\nfunction DetailHeader(props: DetailHeaderProps) {\n const { node } = props;\n const runner = useTestRunner();\n const outcome = outcomeFor(node);\n const location = node.file ? `${node.file}${node.line ? `:${node.line}` : \"\"}` : undefined;\n const frameworkBadge = runner.adapters.resolveFrameworkBadge(node, runner);\n return (\n <div\n className=\"flex min-w-0 items-center gap-2 border-b border-border px-density-4 py-density-2\"\n data-detail-header=\"\"\n >\n {outcome ? (\n <OutcomeIcon outcome={outcome} className=\"text-lg\" />\n ) : (\n <Icon icon={UiClass} className=\"shrink-0 text-lg text-muted-foreground\" />\n )}\n <h2 className=\"min-w-0 shrink truncate text-base font-semibold\" title={node.name}>\n {node.name}\n </h2>\n {node.framework && (\n <span\n className=\"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground\"\n data-framework-badge=\"\"\n >\n <ToolIcon tool={toolKeyFor(node)} className=\"text-sm\" />\n {node.framework}\n {frameworkBadge != null && (\n <>\n <span aria-hidden=\"true\">·</span>\n {frameworkBadge}\n </>\n )}\n </span>\n )}\n {node.duration ? (\n <span className=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground\">\n <Icon icon={UiClock} className=\"text-xs\" />\n {formatTestDuration(node.duration)}\n </span>\n ) : null}\n {location && (\n <span\n className=\"min-w-0 shrink-[100] truncate font-mono text-xs text-muted-foreground\"\n title={location}\n >\n {location}\n </span>\n )}\n {node.file && runner.onOpenFile && (\n <OpenInFilesLink\n className=\"shrink-0\"\n onOpenFile={runner.onOpenFile}\n target={{\n file: relPath(node.file, node.work_dir)!,\n ...(node.work_dir ? { workDir: node.work_dir } : {}),\n ...(node.line ? { line: node.line } : {}),\n }}\n />\n )}\n <DetailActions {...props} />\n </div>\n );\n}\n\n/**\n * The right pane. Resolves the node's adapter for body / tabs / header actions,\n * falling back to the built-in default body. Shows an empty state when nothing\n * is selected.\n *\n * `header=\"actions\"` drops the node's identity (outcome, name, tool, duration,\n * location) for hosts that already show it, e.g. an expandable card, and keeps\n * only the controls, in the tab row when there are tabs. `tabVariant` picks the\n * tab row style (filled `pill`, the default, or `underline`).\n */\nexport function TestDetailPanel({ header = \"full\", tabVariant = \"pill\" }: { header?: \"full\" | \"actions\"; tabVariant?: TabButtonVariant } = {}) {\n const runner = useTestRunner();\n const { activeTab, setActiveTab } = useActiveDetailTab();\n const { selected } = runner;\n if (!selected) {\n return (\n <div className=\"flex h-full items-center justify-center text-sm text-muted-foreground\">\n <div className=\"text-center\">\n <Icon icon={UiClass} className=\"mb-2 block text-4xl\" />\n Select a test to view its details.\n </div>\n </div>\n );\n }\n return <SelectedTestDetail selected={selected} header={header} tabVariant={tabVariant} activeTab={activeTab} setActiveTab={setActiveTab} />;\n}\n\n// Tab state is controlled when the host supplies activeTab (e.g. to mirror it\n// into the URL); otherwise the panel owns it. The render tolerates an\n// unknown id by falling back to the built-in \"detail\" tab.\nfunction useActiveDetailTab() {\n const runner = useTestRunner();\n const [internalTab, setInternalTab] = useState<string>(\"detail\");\n const controlled = runner.activeTab !== undefined;\n const setActiveTab = (id: string) => {\n if (controlled) runner.onTabChange?.(id);\n else setInternalTab(id);\n };\n return { activeTab: runner.activeTab ?? internalTab, setActiveTab };\n}\n\nfunction attemptLabel(a: { id: number; status: string; durationMs?: number | undefined }, total: number) {\n const duration = a.durationMs !== undefined ? ` · ${formatTestDuration(a.durationMs * 1e6)}` : \"\";\n return `Attempt ${a.id}/${total} · ${a.status}${duration}`;\n}\n\nfunction useAttemptSelection(selected: Test) {\n const runner = useTestRunner();\n const [attemptSelection, setAttemptSelection] = useState<{ key: string; id: number } | null>(null);\n const attempts = runner.adapters.resolveAttempts(selected, runner);\n const key = selected.task_id ?? selected.name;\n const attemptId = runner.activeAttempt ?? (attemptSelection?.key === key ? attemptSelection.id : undefined);\n const attempt = attempts.find((a) => a.id === attemptId) ?? attempts.at(-1);\n const multiple = attempts.length > 1 && !!attempt;\n const onChange = (id: number) => {\n if (runner.onAttemptChange) runner.onAttemptChange(id);\n else setAttemptSelection({ key, id });\n };\n const chooser = multiple && attempt ? (\n <div className=\"w-44 shrink-0\">\n <Select\n aria-label=\"Attempt\"\n value={String(attempt.id)}\n className=\"h-7 text-xs\"\n onChange={(event) => onChange(Number(event.target.value))}\n options={attempts.map((a) => ({ value: String(a.id), label: attemptLabel(a, attempts.length) }))}\n />\n </div>\n ) : null;\n return { node: multiple && attempt ? attempt.node : selected, attemptChooser: chooser };\n}\n\ntype DetailTab = { id: string; label: string; render: () => ReactNode };\n\nfunction resolveDetailTabs(node: Test, tabs: DetailTab[]): DetailTab[] {\n const hasOutput = !!(node.log || node.stdout || node.stderr);\n if (!hasOutput || tabs.some((tab) => tab.id === \"stdout\")) return tabs;\n const stdout: DetailTab = {\n id: \"stdout\",\n label: \"Stdout\",\n render: () => <div className=\"p-density-4\"><TestOutput node={node} view=\"full\" /></div>,\n };\n return [stdout, ...tabs];\n}\n\nfunction SelectedTestDetail({\n selected,\n header,\n tabVariant,\n activeTab,\n setActiveTab,\n}: {\n selected: Test;\n header: \"full\" | \"actions\";\n tabVariant: TabButtonVariant;\n activeTab: string;\n setActiveTab: (id: string) => void;\n}) {\n const runner = useTestRunner();\n const { node, attemptChooser } = useAttemptSelection(selected);\n const detailAdapter = runner.adapters.resolveDetail(node, runner);\n const actionAdapter = runner.adapters.resolveActions(selected, runner);\n const tabs = resolveDetailTabs(node, runner.adapters.resolveTabs(node, runner));\n const ownsScroll = runner.adapters.ownsScroll(node, runner);\n\n const body = (\n <DetailTabSelectProvider value={setActiveTab}>\n {detailAdapter?.renderDetail\n ? detailAdapter.renderDetail({ node, runner })\n : <DefaultDetailBody node={node} />}\n </DetailTabSelectProvider>\n );\n const actions = actionAdapter?.nodeActions?.({ node: selected, runner });\n\n // A size container, so log blocks can cap themselves at a share of the pane (cqh).\n const detailRegion = cn(\"min-h-0 flex-1 [container-type:size]\", !ownsScroll && \"overflow-y-auto\");\n\n const headerProps: DetailHeaderProps = { node, actionNode: selected, actions, attemptChooser };\n const fullHeader = header === \"full\";\n\n // No extra tabs → just the body under the header.\n if (tabs.length === 0) {\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {fullHeader ? (\n <DetailHeader {...headerProps} />\n ) : (\n <div className=\"flex shrink-0 border-b border-border px-density-2 py-density-1\">\n <DetailActions {...headerProps} />\n </div>\n )}\n <div className={detailRegion}>{body}</div>\n </div>\n );\n }\n\n const detailTab = { id: \"detail\", label: \"Detail\", render: () => body };\n const allTabs = [detailTab, ...tabs];\n const active = allTabs.find((t) => t.id === activeTab) ?? detailTab;\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {fullHeader && <DetailHeader {...headerProps} />}\n <DetailTabStrip\n tabs={allTabs}\n activeId={active.id}\n onSelect={setActiveTab}\n variant={tabVariant}\n trailing={fullHeader ? null : <DetailActions {...headerProps} />}\n />\n <div className={detailRegion}>{active.render()}</div>\n </div>\n );\n}\n\nfunction DetailTabStrip({\n tabs,\n activeId,\n onSelect,\n variant,\n trailing,\n}: {\n tabs: DetailTab[];\n activeId: string;\n onSelect: (id: string) => void;\n variant: TabButtonVariant;\n trailing: ReactNode;\n}) {\n return (\n <div className={cn(\"flex shrink-0 items-center gap-1 border-b border-border px-density-2\", variant === \"underline\" ? \"items-stretch\" : \"py-density-1\")}>\n {tabs.map((t) => (\n <TabButton key={t.id} active={activeId === t.id} onClick={() => onSelect(t.id)} label={t.label} variant={variant} />\n ))}\n {trailing}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,kBAAkB,EAAE,QAAwB;CACnD,MAAM,SAASA,gBAAAA,cAAc;CAC7B,MAAM,UAAU,KAAK,UAAU,GAAG,EAAE;CAEpC,MAAM,UADe,KAAK,UAAU,UAAU,KAAK,IACtBC,eAAAA,IAAI,IAAI,IAAI;CACzC,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACG,KAAK,WAAW,CAAC,KAAK,kBACrB,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IAA2C,UAAA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AAD;IAAK,WAAW;IAAe,UAAA,OAAO,OAAO;GAAO,CAAA;EACjD;;AAET;AAEA,SAAS,eAAe,EACtB,MACA,UACA,UACA,SACA,YAOC;CACD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAWA,cAAAA,GAAG,wEAAwE,YAAY,cAAc,kBAAkB,cAAc;EAArJ,UAAA,CACG,KAAK,KAAK,MACT,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;GAAsB,QAAQ,aAAa,EAAE;GAAI,eAAe,SAAS,EAAE,EAAE;GAAG,OAAO,EAAE;GAAgB;EAAU,GAAnG,EAAE,EAAiG,CACpH,GACA,QACE;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"TestDetailPanel.d.ts","sourceRoot":"","sources":["../../../src/data/test-runner/TestDetailPanel.tsx"],"names":[],"mappings":"AASA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAyNhE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAe,EAAE,UAAmB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAO,+BA0G5I"}
1
+ {"version":3,"file":"TestDetailPanel.d.ts","sourceRoot":"","sources":["../../../src/data/test-runner/TestDetailPanel.tsx"],"names":[],"mappings":"AASA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAwOhE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAe,EAAE,UAAmB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAO,+BAe5I"}
@@ -19,7 +19,7 @@ import { UiStop } from "../../icons/components/UiStop.js";
19
19
  import { UiWarningCircle } from "../../icons/components/UiWarningCircle.js";
20
20
  import { useTestRunner } from "./context.js";
21
21
  import { DetailTabSelectProvider } from "./detailTabContext.js";
22
- import { buildNodeBrief, buildNodeJson } from "./copy.js";
22
+ import { buildNodeBrief, buildNodeJson, primaryCopyItem } from "./copy.js";
23
23
  import { formatTestDuration, outcomeFor, sum } from "./status.js";
24
24
  import { toolKeyFor } from "./marks.js";
25
25
  import { OutcomeIcon, ToolIcon } from "./MarkIcons.js";
@@ -66,6 +66,9 @@ function DefaultDetailBody({ node }) {
66
66
  ]
67
67
  });
68
68
  }
69
+ function copyPayload(item) {
70
+ return typeof item.value === "string" ? item.value : { plain: item.value() };
71
+ }
69
72
  function copyMenuItem(item, copy) {
70
73
  const icon = item.icon ? { icon: item.icon } : {};
71
74
  if ("reason" in item) return {
@@ -78,7 +81,7 @@ function copyMenuItem(item, copy) {
78
81
  return {
79
82
  label: item.label,
80
83
  ...icon,
81
- onSelect: () => copy(item.value)
84
+ onSelect: () => copy(copyPayload(item))
82
85
  };
83
86
  }
84
87
  var COPY_LABEL = {
@@ -94,28 +97,47 @@ var COPY_ICON = {
94
97
  error: UiWarningCircle
95
98
  };
96
99
  /**
97
- * "Copy details" split button: the primary action copies a Markdown brief of
98
- * the generic sections plus every matching adapter's `copy` sections; the menu
99
- * offers the node as JSON and the adapters' items, disabled with a reason when
100
- * they have nothing to copy. The label flips to "Copied" or "Copy failed".
100
+ * "Copy details" split button: the primary action copies a summarized Markdown
101
+ * brief of the generic sections plus every matching adapter's `copy` sections,
102
+ * each cut to a few lines with a pointer to the file on disk that has the rest;
103
+ * the menu offers the whole brief, the node as JSON and the adapters' items,
104
+ * disabled with a reason when they have nothing to copy. An adapter item marked
105
+ * `primary` (e.g. an AI prompt for a failing node) takes over the primary
106
+ * action and label, and the brief moves into the menu as "Copy details". The
107
+ * label flips to "Copied" or "Copy failed".
101
108
  */
102
109
  function CopyDetailsButton({ node }) {
103
110
  const runner = useTestRunner();
104
111
  const { state, copy } = useCopyFlash();
105
112
  const sections = useMemo(() => runner.adapters.resolveCopy(node, runner), [node, runner]);
106
- const items = [{
107
- label: "Copy as JSON",
108
- icon: UiJson,
109
- onSelect: () => copy(buildNodeJson(node))
110
- }, ...sections.items.map((item) => copyMenuItem(item, copy))];
113
+ const primary = primaryCopyItem(sections.items);
114
+ const copyBrief = () => copy(buildNodeBrief(node, sections));
115
+ const items = [
116
+ ...primary ? [{
117
+ label: "Copy details",
118
+ icon: UiCopy,
119
+ onSelect: copyBrief
120
+ }] : [],
121
+ {
122
+ label: "Copy full details",
123
+ icon: UiCopy,
124
+ onSelect: () => copy(buildNodeBrief(node, sections, { full: true }))
125
+ },
126
+ {
127
+ label: "Copy as JSON",
128
+ icon: UiJson,
129
+ onSelect: () => copy(buildNodeJson(node))
130
+ },
131
+ ...sections.items.filter((item) => item !== primary).map((item) => copyMenuItem(item, copy))
132
+ ];
111
133
  return /* @__PURE__ */ jsx(SplitButton, {
112
- label: COPY_LABEL[state],
113
- icon: COPY_ICON[state],
134
+ label: state === "idle" && primary ? primary.label : COPY_LABEL[state],
135
+ icon: state === "idle" && primary?.icon ? primary.icon : COPY_ICON[state],
114
136
  variant: "outline",
115
137
  size: "sm",
116
138
  align: "right",
117
139
  title: "More copy options",
118
- onClick: () => copy(buildNodeBrief(node, sections)),
140
+ onClick: primary ? () => copy(copyPayload(primary)) : copyBrief,
119
141
  items
120
142
  });
121
143
  }
@@ -230,15 +252,8 @@ function DetailHeader(props) {
230
252
  */
231
253
  function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
232
254
  const runner = useTestRunner();
233
- const selected = runner.selected;
234
- const [attemptSelection, setAttemptSelection] = useState(null);
235
- const controlled = runner.activeTab !== void 0;
236
- const [internalTab, setInternalTab] = useState("detail");
237
- const activeTab = controlled ? runner.activeTab : internalTab;
238
- const setActiveTab = (id) => {
239
- if (controlled) runner.onTabChange?.(id);
240
- else setInternalTab(id);
241
- };
255
+ const { activeTab, setActiveTab } = useActiveDetailTab();
256
+ const { selected } = runner;
242
257
  if (!selected) return /* @__PURE__ */ jsx("div", {
243
258
  className: "flex h-full items-center justify-center text-sm text-muted-foreground",
244
259
  children: /* @__PURE__ */ jsxs("div", {
@@ -249,35 +264,67 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
249
264
  }), "Select a test to view its details."]
250
265
  })
251
266
  });
267
+ return /* @__PURE__ */ jsx(SelectedTestDetail, {
268
+ selected,
269
+ header,
270
+ tabVariant,
271
+ activeTab,
272
+ setActiveTab
273
+ });
274
+ }
275
+ function useActiveDetailTab() {
276
+ const runner = useTestRunner();
277
+ const [internalTab, setInternalTab] = useState("detail");
278
+ const controlled = runner.activeTab !== void 0;
279
+ const setActiveTab = (id) => {
280
+ if (controlled) runner.onTabChange?.(id);
281
+ else setInternalTab(id);
282
+ };
283
+ return {
284
+ activeTab: runner.activeTab ?? internalTab,
285
+ setActiveTab
286
+ };
287
+ }
288
+ function attemptLabel(a, total) {
289
+ const duration = a.durationMs !== void 0 ? ` · ${formatTestDuration(a.durationMs * 1e6)}` : "";
290
+ return `Attempt ${a.id}/${total} · ${a.status}${duration}`;
291
+ }
292
+ function useAttemptSelection(selected) {
293
+ const runner = useTestRunner();
294
+ const [attemptSelection, setAttemptSelection] = useState(null);
252
295
  const attempts = runner.adapters.resolveAttempts(selected, runner);
253
296
  const key = selected.task_id ?? selected.name;
254
297
  const attemptId = runner.activeAttempt ?? (attemptSelection?.key === key ? attemptSelection.id : void 0);
255
298
  const attempt = attempts.find((a) => a.id === attemptId) ?? attempts.at(-1);
256
- const node = attempts.length > 1 && attempt ? attempt.node : selected;
257
- const attemptChooser = attempts.length > 1 && attempt ? /* @__PURE__ */ jsx("div", {
299
+ const multiple = attempts.length > 1 && !!attempt;
300
+ const onChange = (id) => {
301
+ if (runner.onAttemptChange) runner.onAttemptChange(id);
302
+ else setAttemptSelection({
303
+ key,
304
+ id
305
+ });
306
+ };
307
+ const chooser = multiple && attempt ? /* @__PURE__ */ jsx("div", {
258
308
  className: "w-44 shrink-0",
259
309
  children: /* @__PURE__ */ jsx(Select, {
260
310
  "aria-label": "Attempt",
261
311
  value: String(attempt.id),
262
312
  className: "h-7 text-xs",
263
- onChange: (event) => {
264
- const id = Number(event.target.value);
265
- if (runner.onAttemptChange) runner.onAttemptChange(id);
266
- else setAttemptSelection({
267
- key,
268
- id
269
- });
270
- },
313
+ onChange: (event) => onChange(Number(event.target.value)),
271
314
  options: attempts.map((a) => ({
272
315
  value: String(a.id),
273
- label: `Attempt ${a.id}/${attempts.length} · ${a.status}${a.durationMs !== void 0 ? ` · ${formatTestDuration(a.durationMs * 1e6)}` : ""}`
316
+ label: attemptLabel(a, attempts.length)
274
317
  }))
275
318
  })
276
319
  }) : null;
277
- const detailAdapter = runner.adapters.resolveDetail(node, runner);
278
- const actionAdapter = runner.adapters.resolveActions(selected, runner);
279
- const tabs = runner.adapters.resolveTabs(node, runner);
280
- if ((node.log || node.stdout || node.stderr) && !tabs.some((tab) => tab.id === "stdout")) tabs.unshift({
320
+ return {
321
+ node: multiple && attempt ? attempt.node : selected,
322
+ attemptChooser: chooser
323
+ };
324
+ }
325
+ function resolveDetailTabs(node, tabs) {
326
+ if (!!!(node.log || node.stdout || node.stderr) || tabs.some((tab) => tab.id === "stdout")) return tabs;
327
+ return [{
281
328
  id: "stdout",
282
329
  label: "Stdout",
283
330
  render: () => /* @__PURE__ */ jsx("div", {
@@ -287,7 +334,14 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
287
334
  view: "full"
288
335
  })
289
336
  })
290
- });
337
+ }, ...tabs];
338
+ }
339
+ function SelectedTestDetail({ selected, header, tabVariant, activeTab, setActiveTab }) {
340
+ const runner = useTestRunner();
341
+ const { node, attemptChooser } = useAttemptSelection(selected);
342
+ const detailAdapter = runner.adapters.resolveDetail(node, runner);
343
+ const actionAdapter = runner.adapters.resolveActions(selected, runner);
344
+ const tabs = resolveDetailTabs(node, runner.adapters.resolveTabs(node, runner));
291
345
  const ownsScroll = runner.adapters.ownsScroll(node, runner);
292
346
  const body = /* @__PURE__ */ jsx(DetailTabSelectProvider, {
293
347
  value: setActiveTab,
@@ -329,14 +383,12 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
329
383
  className: "flex h-full min-h-0 flex-col",
330
384
  children: [
331
385
  fullHeader && /* @__PURE__ */ jsx(DetailHeader, { ...headerProps }),
332
- /* @__PURE__ */ jsxs("div", {
333
- className: cn("flex shrink-0 items-center gap-1 border-b border-border px-density-2", tabVariant === "underline" ? "items-stretch" : "py-density-1"),
334
- children: [allTabs.map((t) => /* @__PURE__ */ jsx(TabButton, {
335
- active: active.id === t.id,
336
- onClick: () => setActiveTab(t.id),
337
- label: t.label,
338
- variant: tabVariant
339
- }, t.id)), !fullHeader && /* @__PURE__ */ jsx(DetailActions, { ...headerProps })]
386
+ /* @__PURE__ */ jsx(DetailTabStrip, {
387
+ tabs: allTabs,
388
+ activeId: active.id,
389
+ onSelect: setActiveTab,
390
+ variant: tabVariant,
391
+ trailing: fullHeader ? null : /* @__PURE__ */ jsx(DetailActions, { ...headerProps })
340
392
  }),
341
393
  /* @__PURE__ */ jsx("div", {
342
394
  className: detailRegion,
@@ -345,6 +397,17 @@ function TestDetailPanel({ header = "full", tabVariant = "pill" } = {}) {
345
397
  ]
346
398
  });
347
399
  }
400
+ function DetailTabStrip({ tabs, activeId, onSelect, variant, trailing }) {
401
+ return /* @__PURE__ */ jsxs("div", {
402
+ className: cn("flex shrink-0 items-center gap-1 border-b border-border px-density-2", variant === "underline" ? "items-stretch" : "py-density-1"),
403
+ children: [tabs.map((t) => /* @__PURE__ */ jsx(TabButton, {
404
+ active: activeId === t.id,
405
+ onClick: () => onSelect(t.id),
406
+ label: t.label,
407
+ variant
408
+ }, t.id)), trailing]
409
+ });
410
+ }
348
411
  export { TestDetailPanel };
349
412
 
350
413
  //# sourceMappingURL=TestDetailPanel.js.map