@mechane-ai/elements 0.64.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +39 -27
  2. package/dist/ai.js +285 -203
  3. package/dist/{article-BopqPz1K.js → article-anMy8fA5.js} +6 -6
  4. package/dist/article.js +1 -1
  5. package/dist/catalog.json +137 -46
  6. package/dist/{categorical-values-8LA9KXhi.js → categorical-values-Bh7ZkEQn.js} +1 -1
  7. package/dist/charts/cartesian.js +1 -1
  8. package/dist/charts/comparison.js +1 -1
  9. package/dist/charts/distribution.js +1 -1
  10. package/dist/charts/figure.js +12 -12
  11. package/dist/charts/graph.js +1 -1
  12. package/dist/charts/hierarchy.js +1 -1
  13. package/dist/charts/image.js +1 -1
  14. package/dist/charts/matrix.js +1 -1
  15. package/dist/charts/plot.js +3 -3
  16. package/dist/charts/relationship.js +1 -1
  17. package/dist/charts/text.js +1 -1
  18. package/dist/charts/timeline.js +2 -2
  19. package/dist/charts/trend.js +1 -1
  20. package/dist/charts.js +2 -2
  21. package/dist/{code-block-BjQUIvvw.js → code-block-DbW_t9U4.js} +1 -1
  22. package/dist/collections.js +1 -1
  23. package/dist/{commands-BI9rWGpb.js → commands-C7Zrp-tG.js} +2 -2
  24. package/dist/content/code.js +1 -1
  25. package/dist/content/diff.js +3 -3
  26. package/dist/content/link.js +1 -1
  27. package/dist/content/markdown.js +1 -1
  28. package/dist/content/tree.js +2 -2
  29. package/dist/{content-link-C3RAJ2kP.js → content-link-BN4NPp0u.js} +1 -1
  30. package/dist/content.js +1 -1
  31. package/dist/{dates-D1v_jiva.js → dates-OTq-xU33.js} +2 -2
  32. package/dist/{dumbbell-plot-QGjFMk0X.js → dumbbell-plot-BQDGe0sQ.js} +3 -3
  33. package/dist/{embedding-map-D_RNxsCD.js → embedding-map-DmmknG7A.js} +6 -6
  34. package/dist/feedback.js +1 -1
  35. package/dist/{figure-frame-CF3298LZ.js → figure-frame-DlyNTDzh.js} +22 -21
  36. package/dist/forms/dates.js +1 -1
  37. package/dist/{forms-DlKhXUlc.js → forms-iAOjGRTO.js} +1 -1
  38. package/dist/forms.js +2 -2
  39. package/dist/{image-grid-BXsgVBnB.js → image-grid-CxEAQvTf.js} +3 -3
  40. package/dist/index.js +1 -1
  41. package/dist/kits/evaluation.js +13 -13
  42. package/dist/kits/interpretability.js +47 -43
  43. package/dist/kits/operations.js +80 -79
  44. package/dist/kits/research.js +364 -520
  45. package/dist/kits/training.js +108 -107
  46. package/dist/layout.js +1 -1
  47. package/dist/lesson.js +3 -3
  48. package/dist/{markdown-B92daSMP.js → markdown-Diffqqm7.js} +2 -2
  49. package/dist/mdx.js +6 -6
  50. package/dist/navigation/commands.js +1 -1
  51. package/dist/{navigation-D3vnWiVv.js → navigation-CTnYtVD8.js} +1 -1
  52. package/dist/navigation.js +4 -4
  53. package/dist/packages/ai/src/index.d.ts +2 -0
  54. package/dist/packages/ai/src/message-reactions.d.ts +51 -0
  55. package/dist/packages/ai/src/message.d.ts +3 -1
  56. package/dist/packages/collections/src/card-columns-model.d.ts +50 -0
  57. package/dist/packages/collections/src/card-columns.d.ts +30 -0
  58. package/dist/packages/collections/src/collection-page.d.ts +43 -0
  59. package/dist/packages/collections/src/column-card.d.ts +15 -0
  60. package/dist/packages/collections/src/data-table-layout.d.ts +2 -0
  61. package/dist/packages/collections/src/data-table-rows.d.ts +4 -3
  62. package/dist/packages/collections/src/data-table.d.ts +2 -2
  63. package/dist/packages/collections/src/index.d.ts +5 -0
  64. package/dist/packages/collections/src/table-query.d.ts +13 -4
  65. package/dist/packages/collections/src/use-collection-controls.d.ts +6 -0
  66. package/dist/packages/feedback/src/feedback.d.ts +0 -4
  67. package/dist/packages/feedback/src/index.d.ts +1 -1
  68. package/dist/packages/kits/src/research/index.d.ts +0 -2
  69. package/dist/packages/layout/src/app-shell.d.ts +3 -1
  70. package/dist/packages/layout/src/index.d.ts +4 -4
  71. package/dist/packages/layout/src/page-inset.d.ts +5 -0
  72. package/dist/packages/layout/src/page-layout.d.ts +4 -9
  73. package/dist/packages/layout/src/page-toolbar.d.ts +1 -2
  74. package/dist/packages/layout/src/reading-column.d.ts +4 -0
  75. package/dist/packages/layout/src/record-page.d.ts +4 -6
  76. package/dist/packages/layout/src/sidebar.d.ts +3 -1
  77. package/dist/packages/layout/src/workbench.d.ts +2 -6
  78. package/dist/packages/navigation/src/current-page-click.d.ts +3 -0
  79. package/dist/packages/navigation/src/index.d.ts +1 -0
  80. package/dist/{param-DfOYi9wL.js → param-CKr8EYxF.js} +1 -1
  81. package/dist/{pierre-diff-DP_TXXIt.js → pierre-diff-DXVIwW7o.js} +1 -1
  82. package/dist/{plot-layout-BfXmAi71.js → plot-layout-CVzSbcU7.js} +24 -23
  83. package/dist/{plot-surface-UQgDiTVe.js → plot-surface-CBhI1alw.js} +1 -1
  84. package/dist/{reference-lines-BRHB78Wb.js → reference-lines-C970JwWZ.js} +1 -1
  85. package/dist/{scene-DlVQupfw.js → scene-C3dCxckI.js} +6 -6
  86. package/dist/scene.js +1 -1
  87. package/dist/{slope-chart-CjXcvoRJ.js → slope-chart-DekEJxsy.js} +4 -4
  88. package/dist/{src-DojhQZKX.js → src-BCAelv4f.js} +376 -399
  89. package/dist/{src-BYmv3_AL.js → src-Bkov5TTa.js} +204 -191
  90. package/dist/{src-BdQGb362.js → src-BsqbWDxS.js} +4 -4
  91. package/dist/{src-DPcnDU5H.js → src-CIyuaSCi.js} +101 -107
  92. package/dist/src-Dc1t1ugL.js +2612 -0
  93. package/dist/{src-BYnmQkDq.js → src-DceyVyL0.js} +2 -2
  94. package/dist/{src-BI1xQE7D.js → src-Dlh99sPD.js} +46 -32
  95. package/dist/styles2.css +35 -41
  96. package/dist/{time-series-Dg3DZRGx.js → time-series-BSNnijxf.js} +8 -8
  97. package/dist/{timeline-C2IVroD3.js → timeline-CnxfYSIg.js} +4 -4
  98. package/dist/{token-heatmap-CZtIPU60.js → token-heatmap-CJaXo56P.js} +3 -3
  99. package/dist/{token-predictions-BJ5L-Lrm.js → token-predictions-Bi7aKPnh.js} +3 -3
  100. package/dist/{transport-D9e0H2we.js → transport-CXj0DV6o.js} +4 -4
  101. package/dist/{tree-diagram-DRAJiqjW.js → tree-diagram-BxOZsjr1.js} +4 -4
  102. package/dist/{treemap-BdELCV7E.js → treemap-B2yOAetT.js} +4 -4
  103. package/dist/{use-tween-COV8bEYL.js → use-tween-C1TWJwce.js} +1 -1
  104. package/dist/{violin-plot-DuxqWnuD.js → violin-plot-W2L_2JRo.js} +3 -3
  105. package/dist/{waterfall-D4ewGb4u.js → waterfall-Bt73N2Ng.js} +4 -4
  106. package/package.json +1 -1
  107. package/recipes/allocation-report.tsx +4 -4
  108. package/recipes/calendar-workspace.tsx +14 -10
  109. package/recipes/consequential-form.tsx +4 -4
  110. package/recipes/searchable-collection.tsx +66 -58
  111. package/recipes/sectioned-report.tsx +17 -18
  112. package/recipes/session-timeline.tsx +59 -0
  113. package/recipes/tabbed-workspace.tsx +7 -8
  114. package/recipes/workspace-files.tsx +94 -0
  115. package/recipes/workspace-report.tsx +130 -0
  116. package/skills/extend-elements/SKILL.md +21 -0
  117. package/skills/review-elements/SKILL.md +20 -13
  118. package/skills/upgrade-elements/SKILL.md +3 -1
  119. package/skills/upgrade-elements/references/releases.md +36 -0
  120. package/skills/use-elements/SKILL.md +13 -7
  121. package/skills/use-elements/references/collections.md +67 -14
  122. package/skills/use-elements/references/conversations.md +32 -0
  123. package/skills/use-elements/references/editorial-restraint.md +17 -34
  124. package/skills/use-elements/references/figures.md +6 -2
  125. package/skills/use-elements/references/reports.md +4 -1
  126. package/skills/use-elements/references/workspace.md +18 -14
  127. package/dist/packages/kits/src/research/collection-page.d.ts +0 -72
  128. package/dist/packages/layout/src/detail-page.d.ts +0 -9
  129. package/dist/packages/layout/src/page-content.d.ts +0 -5
  130. package/dist/src-P19zz_aO.js +0 -2235
@@ -1,8 +1,7 @@
1
1
  import { Button } from '@mechane-ai/elements';
2
- import { DataTable } from '@mechane-ai/elements/collections';
3
- import type { DataTableColumn, DataTableSort } from '@mechane-ai/elements/collections';
4
- import { Notice } from '@mechane-ai/elements/feedback';
5
- import { PageLayout } from '@mechane-ai/elements/layout';
2
+ import { CollectionPage } from '@mechane-ai/elements/collections';
3
+ import type { CollectionRead, DataTableColumn, DataTableSort } from '@mechane-ai/elements/collections';
4
+ import { EmptyState } from '@mechane-ai/elements/feedback';
6
5
 
7
6
  export type Worker = { readonly id: string; readonly name: string; readonly status: string };
8
7
 
@@ -33,74 +32,83 @@ const columns = [
33
32
  { id: 'status', label: 'Status', role: 'status', cell: (worker) => worker.status },
34
33
  ] satisfies ReadonlyArray<DataTableColumn<Worker>>;
35
34
 
35
+ function workerRead(result: WorkerRead, onRetry: () => void): CollectionRead<Worker> {
36
+ const retained = result.page === undefined ? {} : { rows: result.page.rows };
37
+
38
+ switch (result.status) {
39
+ case 'ready':
40
+ return { state: 'ready', rows: result.page.rows };
41
+ case 'pending':
42
+ return { state: 'pending', ...retained };
43
+ case 'failed':
44
+ return {
45
+ state: 'failed',
46
+ ...retained,
47
+ failure: (
48
+ <EmptyState role="alert" title="Could not load workers" action={<Button onClick={onRetry}>Retry</Button>} />
49
+ ),
50
+ };
51
+ }
52
+ }
53
+
36
54
  /**
37
- * Build a searchable, filterable server-paged table with record links. Keep query state in the route and retain the
38
- * previous page during refresh. The server authorizes, filters and sorts the collection before paging.
55
+ * Build a board feed, list, or server-paged collection with search and filters in its title and links to records. The
56
+ * route owns query state. The server authorizes, filters and sorts before paging.
39
57
  */
40
58
  export function SearchableCollection({ query, result, onQueryChange, onRetry, workerHref, onOpen }: CollectionProps) {
41
59
  const page = result.page;
42
- const isPending = result.status === 'pending';
43
60
  const isReady = result.status === 'ready';
44
- const hasResults = page !== undefined;
45
61
 
46
62
  return (
47
- <PageLayout title="Workers" showNavigation={false}>
48
- {isPending && <Notice>Loading workers…</Notice>}
49
- {result.status === 'failed' && (
50
- <Notice hasError>
51
- Could not load workers. <Button onClick={onRetry}>Retry</Button>
52
- </Notice>
53
- )}
54
- <DataTable
55
- caption="Workers"
56
- hideCaption
57
- columns={columns}
58
- rows={page?.rows ?? []}
59
- getRowId={(worker) => worker.id}
60
- resultStatus={result.status}
61
- query={{
62
- mode: 'controlled',
63
- search: {
64
- label: 'Find workers',
65
- value: query.text,
66
- onChange: (text) => onQueryChange({ ...query, text, page: 1 }),
63
+ <CollectionPage
64
+ title="Workers"
65
+ read={workerRead(result, onRetry)}
66
+ columns={columns}
67
+ getRowId={(worker) => worker.id}
68
+ query={{
69
+ mode: 'controlled',
70
+ search: {
71
+ label: 'Find workers',
72
+ value: query.text,
73
+ onChange: (text) => onQueryChange({ ...query, text, page: 1 }),
74
+ },
75
+ filters: [
76
+ {
77
+ id: 'status',
78
+ label: 'Status',
79
+ defaultValue: '',
80
+ value: query.status,
81
+ options: [
82
+ { value: '', label: 'All statuses' },
83
+ { value: 'Available', label: 'Available' },
84
+ { value: 'Busy', label: 'Busy' },
85
+ ],
86
+ onChange: (status) => onQueryChange({ ...query, status, page: 1 }),
67
87
  },
68
- filters: [
69
- {
70
- id: 'status',
71
- label: 'Status',
72
- defaultValue: '',
73
- value: query.status,
74
- options: [
75
- { value: '', label: 'All statuses' },
76
- { value: 'Available', label: 'Available' },
77
- { value: 'Busy', label: 'Busy' },
78
- ],
79
- onChange: (status) => onQueryChange({ ...query, status, page: 1 }),
80
- },
81
- ],
82
- }}
83
- sort={query.sort}
84
- onSortChange={(sort) => onQueryChange({ ...query, sort, page: 1 })}
85
- rowAction={{
86
- label: (worker) => `Open ${worker.name}`,
87
- href: workerHref,
88
- ...(onOpen !== undefined && { onActivate: onOpen }),
89
- }}
90
- pagination={{
91
- description: hasResults ? `Page ${page.number}` : '',
88
+ ],
89
+ }}
90
+ sort={query.sort}
91
+ onSortChange={(sort) => onQueryChange({ ...query, sort, page: 1 })}
92
+ rowAction={{
93
+ label: (worker) => `Open ${worker.name}`,
94
+ href: workerHref,
95
+ ...(onOpen !== undefined && { onActivate: onOpen }),
96
+ }}
97
+ {...(page !== undefined && {
98
+ pagination: {
99
+ description: `Page ${page.number}`,
92
100
  previous: {
93
101
  disabled: !isReady || query.page <= 1,
94
102
  onClick: () => onQueryChange({ ...query, page: query.page - 1 }),
95
103
  },
96
104
  next: {
97
- disabled: !isReady || page?.hasNext !== true,
105
+ disabled: !isReady || !page.hasNext,
98
106
  onClick: () => onQueryChange({ ...query, page: query.page + 1 }),
99
107
  },
100
- }}
101
- empty={isReady && 'No workers yet.'}
102
- filteredEmpty={isReady && 'No workers match your search or filters.'}
103
- />
104
- </PageLayout>
108
+ },
109
+ })}
110
+ empty="No workers yet."
111
+ filteredEmpty="No workers match your search or filters."
112
+ />
105
113
  );
106
114
  }
@@ -24,7 +24,7 @@ const columns = [
24
24
  */
25
25
  export function SectionedReport({ sections }: ReportProps) {
26
26
  return (
27
- <PageLayout title="Work overview" showNavigation={false}>
27
+ <PageLayout title="Work overview">
28
28
  {sections.map((section) => (
29
29
  <PageSection
30
30
  key={section.id}
@@ -35,23 +35,22 @@ export function SectionedReport({ sections }: ReportProps) {
35
35
  <Metric {...section.metric} variant="headline" />
36
36
  </MetricGrid>
37
37
  }
38
- breakdown={
39
- <DataTable
40
- caption={section.title}
41
- hideCaption
42
- rows={section.contributors}
43
- getRowId={(row) => row.id}
44
- columns={columns}
45
- query={{
46
- mode: 'local',
47
- search: (row) => row.name,
48
- filters: [{ id: 'team', label: 'Team', value: (row) => row.team }],
49
- }}
50
- empty="No contributing work items."
51
- filteredEmpty="No matching work items."
52
- />
53
- }
54
- />
38
+ >
39
+ <DataTable
40
+ caption={section.title}
41
+ hideCaption
42
+ rows={section.contributors}
43
+ getRowId={(row) => row.id}
44
+ columns={columns}
45
+ query={{
46
+ mode: 'local',
47
+ search: (row) => row.name,
48
+ filters: [{ id: 'team', label: 'Team', value: (row) => row.team }],
49
+ }}
50
+ empty="No contributing work items."
51
+ filteredEmpty="No matching work items."
52
+ />
53
+ </PageSection>
55
54
  ))}
56
55
  </PageLayout>
57
56
  );
@@ -0,0 +1,59 @@
1
+ import { Waterfall } from '@mechane-ai/elements/charts/timeline';
2
+ import type { WaterfallItem } from '@mechane-ai/elements/charts/timeline';
3
+ import { Details } from '@mechane-ai/elements/collections';
4
+ import { PageLayout, PageSection } from '@mechane-ai/elements/layout';
5
+ import { useId, useState } from 'react';
6
+
7
+ type SessionProps = {
8
+ readonly title: string;
9
+ readonly steps: ReadonlyArray<WaterfallItem>;
10
+ readonly durationMs: number;
11
+ };
12
+
13
+ const milliseconds = { style: 'unit', unit: 'millisecond', unitDisplay: 'short' } as const;
14
+
15
+ /**
16
+ * Inspect an agent session's measured activity on a waterfall timeline. Selecting a step by mouse or keyboard reveals
17
+ * its exact recorded result. A step with missing endpoints stays unavailable.
18
+ */
19
+ export function SessionTimeline({ title, steps, durationMs }: SessionProps) {
20
+ const detailsId = useId();
21
+ const [selectedId, select] = useState<string | null>(null);
22
+ const selected = steps.find((step) => step.id === selectedId);
23
+
24
+ return (
25
+ <PageLayout title={title}>
26
+ <PageSection title="Execution">
27
+ <Waterfall
28
+ title="Session timeline"
29
+ items={steps.map((step) => ({ ...step, controls: detailsId }))}
30
+ start={0}
31
+ end={durationMs}
32
+ locale="en-US"
33
+ rowLabel="Step"
34
+ summaryLabel="Duration"
35
+ emptyLabel="No recorded activity."
36
+ offsetFormat={milliseconds}
37
+ selected={selectedId}
38
+ onSelectedChange={select}
39
+ onClearSelection={() => select(null)}
40
+ />
41
+ </PageSection>
42
+ <div id={detailsId}>
43
+ {selected !== undefined && (
44
+ <PageSection
45
+ title={selected.label}
46
+ summary={
47
+ <Details
48
+ items={[
49
+ { label: 'Result', value: selected.detail },
50
+ { label: 'Duration', value: selected.summary },
51
+ ]}
52
+ />
53
+ }
54
+ />
55
+ )}
56
+ </div>
57
+ </PageLayout>
58
+ );
59
+ }
@@ -1,7 +1,7 @@
1
1
  import { Text } from '@mechane-ai/elements';
2
2
  import { useCollectionControls } from '@mechane-ai/elements/collections';
3
3
  import { EmptyState } from '@mechane-ai/elements/feedback';
4
- import { PageContent, PageLayout } from '@mechane-ai/elements/layout';
4
+ import { PageInset, PageLayout } from '@mechane-ai/elements/layout';
5
5
  import { ContentTabs } from '@mechane-ai/elements/navigation';
6
6
  import type { PageNavigationItem } from '@mechane-ai/elements/navigation';
7
7
  import { useState } from 'react';
@@ -37,7 +37,6 @@ export function TabbedWorkspace({ project, summary, owner, events, views, curren
37
37
  return (
38
38
  <PageLayout
39
39
  title={project}
40
- showNavigation={false}
41
40
  navigation={{
42
41
  label: 'Project views',
43
42
  selectedId: currentView,
@@ -54,30 +53,30 @@ export function TabbedWorkspace({ project, summary, owner, events, views, curren
54
53
  id: 'summary',
55
54
  label: 'Summary',
56
55
  content: (
57
- <PageContent>
56
+ <PageInset>
58
57
  <Text>{summary}</Text>
59
- </PageContent>
58
+ </PageInset>
60
59
  ),
61
60
  },
62
61
  {
63
62
  id: 'ownership',
64
63
  label: 'Ownership',
65
64
  content: (
66
- <PageContent>
65
+ <PageInset>
67
66
  <Text>{owner}</Text>
68
- </PageContent>
67
+ </PageInset>
69
68
  ),
70
69
  },
71
70
  ]}
72
71
  />
73
72
  )}
74
73
  {currentView === 'activity' && (
75
- <PageContent>
74
+ <PageInset>
76
75
  {matching.map((event) => (
77
76
  <Text key={event.id}>{event.description}</Text>
78
77
  ))}
79
78
  {matching.length === 0 && <EmptyState title="No matching activity" />}
80
- </PageContent>
79
+ </PageInset>
81
80
  )}
82
81
  </PageLayout>
83
82
  );
@@ -0,0 +1,94 @@
1
+ import { Button } from '@mechane-ai/elements';
2
+ import { DataTable, DataTablePlaceholder, Details } from '@mechane-ai/elements/collections';
3
+ import type { DataTableColumn } from '@mechane-ai/elements/collections';
4
+ import { AsyncRegion, EmptyState } from '@mechane-ai/elements/feedback';
5
+ import { PageLayout, PageSection, RecordPage } from '@mechane-ai/elements/layout';
6
+
7
+ export type WorkspaceFile = {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ readonly kind: string;
11
+ readonly size: string;
12
+ readonly uploader: string;
13
+ readonly modified: string;
14
+ readonly path: string;
15
+ };
16
+
17
+ export type FileRead =
18
+ | { readonly status: 'pending' }
19
+ | { readonly status: 'failed'; readonly retry: () => void }
20
+ | { readonly status: 'ready'; readonly files: ReadonlyArray<WorkspaceFile> };
21
+
22
+ type FilesProps = {
23
+ readonly read: FileRead;
24
+ readonly selectedFile?: WorkspaceFile;
25
+ readonly fileHref: (file: WorkspaceFile) => string;
26
+ readonly folderHref: string;
27
+ };
28
+
29
+ const columns = [
30
+ { id: 'name', label: 'Name', role: 'primary', cell: (file) => file.name },
31
+ { id: 'kind', label: 'Type', role: 'text', cell: (file) => file.kind },
32
+ { id: 'size', label: 'Size', role: 'number', cell: (file) => file.size },
33
+ { id: 'modified', label: 'Modified (UTC)', role: 'timestamp', cell: (file) => file.modified },
34
+ { id: 'uploader', label: 'Uploaded by', role: 'text', cell: (file) => file.uploader },
35
+ ] satisfies ReadonlyArray<DataTableColumn<WorkspaceFile>>;
36
+
37
+ /**
38
+ * Browse, search and filter workspace files, then inspect file properties. The full-width table shows an empty folder
39
+ * only after a successful read and offers retry on failure.
40
+ */
41
+ export function WorkspaceFiles({ read, fileHref, folderHref, selectedFile }: FilesProps) {
42
+ if (selectedFile !== undefined) {
43
+ return (
44
+ <RecordPage.Layout backLabel="Files" backHref={folderHref}>
45
+ <RecordPage.Body>
46
+ <RecordPage.Content>
47
+ <RecordPage.Header title={selectedFile.name} />
48
+ <Details
49
+ items={[
50
+ { label: 'Path', value: selectedFile.path },
51
+ { label: 'Type', value: selectedFile.kind },
52
+ { label: 'Size', value: selectedFile.size },
53
+ { label: 'Modified (UTC)', value: selectedFile.modified },
54
+ { label: 'Uploaded by', value: selectedFile.uploader },
55
+ ]}
56
+ />
57
+ </RecordPage.Content>
58
+ </RecordPage.Body>
59
+ </RecordPage.Layout>
60
+ );
61
+ }
62
+
63
+ const placeholder = <DataTablePlaceholder columns={columns} caption="Loading files" />;
64
+
65
+ return (
66
+ <PageLayout title="Files">
67
+ <PageSection title="Shared files">
68
+ {read.status === 'pending' ? (
69
+ <AsyncRegion state="pending" label="Loading files" placeholder={placeholder} />
70
+ ) : read.status === 'failed' ? (
71
+ <EmptyState title="Files unavailable" action={<Button onClick={read.retry}>Try again</Button>} />
72
+ ) : (
73
+ <AsyncRegion state="ready" label="Files" placeholder={placeholder}>
74
+ <DataTable
75
+ caption="Shared files"
76
+ hideCaption
77
+ rows={read.files}
78
+ columns={columns}
79
+ getRowId={(file) => file.id}
80
+ query={{
81
+ mode: 'local',
82
+ search: (file) => file.name,
83
+ filters: [{ id: 'kind', label: 'Type', value: (file) => file.kind }],
84
+ }}
85
+ empty="This folder is empty."
86
+ filteredEmpty="No files match these filters."
87
+ rowAction={{ href: fileHref, label: (file) => `Open ${file.name}` }}
88
+ />
89
+ </AsyncRegion>
90
+ )}
91
+ </PageSection>
92
+ </PageLayout>
93
+ );
94
+ }
@@ -0,0 +1,130 @@
1
+ import { SmallMultiples } from '@mechane-ai/elements/charts/cartesian';
2
+ import { DataTable, Details, Metric, MetricGrid } from '@mechane-ai/elements/collections';
3
+ import type { DataTableColumn } from '@mechane-ai/elements/collections';
4
+ import { PageLayout, PageSection, RecordPage } from '@mechane-ai/elements/layout';
5
+
6
+ export type ReportDay = {
7
+ readonly date: string;
8
+ readonly runs: number;
9
+ readonly failed: number;
10
+ readonly queueSeconds: number | null;
11
+ readonly executionSeconds: number | null;
12
+ };
13
+
14
+ type ReportProps = {
15
+ readonly days: ReadonlyArray<ReportDay>;
16
+ readonly selectedDay?: ReportDay;
17
+ readonly dayHref: (day: ReportDay) => string;
18
+ readonly reportHref: string;
19
+ };
20
+
21
+ function duration(value: number | null): string {
22
+ return value === null ? 'Not measured' : `${value} s`;
23
+ }
24
+
25
+ const columns = [
26
+ { id: 'date', label: 'Day (UTC)', role: 'primary', cell: (day) => day.date },
27
+ { id: 'runs', label: 'Runs', role: 'number', cell: (day) => day.runs },
28
+ { id: 'failed', label: 'Failed', role: 'number', cell: (day) => day.failed },
29
+ { id: 'queue', label: 'Median queue', role: 'number', cell: (day) => duration(day.queueSeconds) },
30
+ { id: 'execution', label: 'Median execution', role: 'number', cell: (day) => duration(day.executionSeconds) },
31
+ ] satisfies ReadonlyArray<DataTableColumn<ReportDay>>;
32
+
33
+ const measures = [
34
+ { id: 'queueSeconds', title: 'Time in queue', tone: 'series1' },
35
+ { id: 'executionSeconds', title: 'Execution time', tone: 'series2' },
36
+ ] as const;
37
+
38
+ const seconds = { style: 'unit', unit: 'second', maximumFractionDigits: 1 } as const;
39
+ const formatDate = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });
40
+
41
+ /**
42
+ * Build a workspace dashboard with linked charts, metrics and a drill-down table. The sidebar and workspace picker
43
+ * persist across destinations, and missing observations stay unknown.
44
+ */
45
+ export function WorkspaceReport({ days, selectedDay, dayHref, reportHref }: ReportProps) {
46
+ if (selectedDay !== undefined) {
47
+ return (
48
+ <RecordPage.Layout backLabel="Deployment timings" backHref={reportHref}>
49
+ <RecordPage.Body>
50
+ <RecordPage.Content>
51
+ <RecordPage.Header title={selectedDay.date} description="Deployment timings · UTC" />
52
+ <Details
53
+ items={[
54
+ { label: 'Completed runs', value: selectedDay.runs },
55
+ { label: 'Failed runs', value: selectedDay.failed },
56
+ { label: 'Median queue', value: duration(selectedDay.queueSeconds) },
57
+ { label: 'Median execution', value: duration(selectedDay.executionSeconds) },
58
+ ]}
59
+ />
60
+ </RecordPage.Content>
61
+ </RecordPage.Body>
62
+ </RecordPage.Layout>
63
+ );
64
+ }
65
+
66
+ const charts = measures.map(({ id, title, tone }) => ({
67
+ id,
68
+ title,
69
+ valueFormat: seconds,
70
+ series: [
71
+ {
72
+ id,
73
+ label: 'Median',
74
+ tone,
75
+ points: days.map((day) => ({ timestamp: Date.parse(`${day.date}T00:00:00Z`), value: day[id] })),
76
+ },
77
+ ],
78
+ }));
79
+
80
+ return (
81
+ <PageLayout title="Deployment timings">
82
+ <PageSection
83
+ title="Run history"
84
+ summary={
85
+ <MetricGrid layout="columns">
86
+ <Metric
87
+ label="Completed runs"
88
+ value={days.reduce((sum, day) => sum + day.runs, 0).toLocaleString('en-US')}
89
+ />
90
+ <Metric
91
+ label="Failed runs"
92
+ value={days.reduce((sum, day) => sum + day.failed, 0).toLocaleString('en-US')}
93
+ />
94
+ </MetricGrid>
95
+ }
96
+ >
97
+ <SmallMultiples
98
+ charts={charts}
99
+ timestampUnit="milliseconds"
100
+ timeFormat={(time) => formatDate.format(time)}
101
+ height="compact"
102
+ locale="en-US"
103
+ />
104
+ </PageSection>
105
+ <PageSection title="Daily timings">
106
+ <DataTable
107
+ rows={days}
108
+ columns={columns}
109
+ getRowId={(day) => day.date}
110
+ caption="Daily timings"
111
+ hideCaption
112
+ query={{
113
+ mode: 'local',
114
+ search: (day) => day.date,
115
+ filters: [
116
+ {
117
+ id: 'timing',
118
+ label: 'Timing samples',
119
+ value: (day) => (day.queueSeconds === null ? 'Missing' : 'Measured'),
120
+ },
121
+ ],
122
+ }}
123
+ empty="No deployments in this workspace."
124
+ filteredEmpty="No days match this search."
125
+ rowAction={{ href: dayHref, label: (day) => `Open timings for ${day.date}` }}
126
+ />
127
+ </PageSection>
128
+ </PageLayout>
129
+ );
130
+ }
@@ -16,6 +16,27 @@ is the guide for the pinned SDK. Use an existing UI SDK behavior where one fits.
16
16
  and agent actions. Use the family's StyleX tokens and density choices and export the supported API from its public
17
17
  entry.
18
18
 
19
+ ## Correct the default at its owner
20
+
21
+ For a recurrent consumer bug, start with the ordinary composition in the affected family story. Reproduce it with the
22
+ public props a new user would choose. Include the package recipe or shipped skill that recommended those props.
23
+
24
+ Aim for the global maximum. If we were implementing the current features and the requested change from scratch, which
25
+ component would own this decision? Choose the design with the clearest public API across callers. Replace the old API
26
+ when the better design calls for it. Backwards compatibility is a requirement only on explicit request. Update
27
+ maintained callers and remove the workaround together. Keep product-specific routing, data and permissions in their
28
+ owning application.
29
+
30
+ Use a named slot for a recurring role such as a workspace selector. Put the unusual appearance behind a call that reads
31
+ differently, such as `PageInset` or `ReadingColumn`. If modes require mutually exclusive inputs, express that constraint
32
+ in the type. A family of styling booleans or a warning in the README leaves the decision in every caller.
33
+
34
+ For a geometry regression, compare the bounds of the simplest shared composition with the consumer at desktop and phone
35
+ widths. For a navigation regression, hold the destination read and observe the first frame after activation. Identify
36
+ the boundary where the behavior first diverges. Exercise that boundary in the existing story or consumer check. Update
37
+ the contract and whichever recipe, application skill or review instruction taught the old pattern. Query the packaged
38
+ catalog with the original task and try its recommended call through the consumer's normal import boundary.
39
+
19
40
  ## A UI SDK component first
20
41
 
21
42
  Wrap the SDK component when one names the interaction, and add only the Elements styling and the supported props.
@@ -27,12 +27,16 @@ Put the pointer away and complete the page's main task.
27
27
 
28
28
  Hold a slow read, fail one, and return an empty result.
29
29
 
30
- - A slow first read shows a shape-matched skeleton. Check that its loading announcement is available to a screen reader
31
- and visually hidden. Dates, filters and other usable controls keep their positions when data arrives.
30
+ - Try an immediate result, then hold a slow first read and release it while the placeholder fades in. Only the slow read
31
+ needs a visible placeholder. Check for one delayed loading announcement, stable focus and a smooth reveal. The heading
32
+ and dividers retain their positions. Repeat a background reconnect with a row under the pointer.
32
33
  - A refresh keeps the last result, its focus and any draft on screen, with progress or the failure beside it.
33
- - A failed first read shows a `Notice` with Retry in place. A successful empty result shows an `EmptyState`.
34
- - Each failure has one presentation. Not a banner and a toast for the same error.
35
- - Navigate away mid-read. A late response must not replace the new selection's content.
34
+ - A failed first read shows an `EmptyState` with Retry in place. A successful empty result shows an `EmptyState`.
35
+ - A failed refresh keeps usable content in place. For a collection, open the header's failure control and reach the
36
+ recovery action. Check that the same failure is reported once.
37
+ - Hold a destination read or route module open. Activate its link, then try Back and Forward. On the first rendered
38
+ frame the old heading, rows and record actions have left the changing region, and the shell stays usable. Release
39
+ responses out of order and confirm only the current destination can appear. Repeat for a record selected by URL.
36
40
  - A pending save disables a second submit. A failed save keeps the draft.
37
41
 
38
42
  ## 3. Width and pointer
@@ -40,9 +44,13 @@ Hold a slow read, fail one, and return an empty result.
40
44
  Check 360 pixels wide, a tablet width and a wide desktop.
41
45
 
42
46
  - The page never scrolls sideways. A wide table or plot scrolls inside its own region.
43
- - Toolbar actions wrap below their title. Long labels wrap or truncate with the full value available elsewhere.
47
+ - Check the collection title and its collapsed search and filter controls together at each width. Long titles can wrap
48
+ while controls remain reachable. Explicitly opening a filter may reveal additional content.
44
49
  - With a coarse pointer, standalone controls give 44px targets and text fields use 16px text.
45
- - At a wide viewport, the right edges of a report header, its table and the pane line up.
50
+ - Compare the left and right bounds of a section heading, its table and the containing pane. All three span the same
51
+ width, including at phone width. Compare text positions inside cells separately.
52
+ - In the expanded sidebar and phone drawer, compare the workspace selector's outer edges with the surrounding navigation
53
+ row backgrounds. Collapse the sidebar and check the selector and its Tab stop disappear.
46
54
 
47
55
  ## 4. Theme and motion
48
56
 
@@ -121,15 +129,14 @@ and its readout.
121
129
 
122
130
  - **Zero floating clutter on hover.** Hovering table rows must not pop tooltips over adjacent rows, and hovering charts
123
131
  must use inline readouts that never obscure curves or clip at container edges.
124
- - **Aligned gutters.** Every section heading aligns vertically with its body content (`PageSection` insets `summary` and
125
- `children` automatically; `breakdown` and `CollectionPage` tables span full width edge-to-edge).
126
132
  - **Zero card bloat.** Metrics use flat `MetricGrid`, lists use full-width `CollectionPage` / `DataTable`, and
127
133
  documentation renders flat—not inside stacked bordered `Panel` cards.
128
- - **Zero instructional slop.** Remove chart `description` text that explains how to hover/click or repeats the
129
- title/legend/axes. Keep Overview focused on one glanceable metric strip and one primary visual.
134
+ - **Read the first screen.** Remove explanatory rows that repeat labels or narrate ordinary interaction. Check whether a
135
+ user can open a record, copy its address and return to their place. Identify the action that requires seeing two panes
136
+ at once before keeping a permanent inspector.
130
137
  - **Pinned shell & area-forking rail.** Scrolling `<main>` keeps the rail and sidebar fixed; rail icons fork top-level
131
- areas rather than duplicating sidebar links; theme/environment controls live behind `railFooter` Settings with zero
132
- `Sync` / `Refresh` clutter.
138
+ areas rather than duplicating sidebar links; theme/environment controls live behind `railFooter` Settings while
139
+ explicit refresh actions belong to the data they update.
133
140
 
134
141
  Not covered by this review: a real screen reader, a physical touch device and right-to-left text. Say so in the report
135
142
  unless you ran them.
@@ -30,7 +30,9 @@ is large.
30
30
  assumptions in tests, and CSS that targets Elements internals. After 0.47, also search for `MAX_` limit constants,
31
31
  `selection={` and `ChartSelection`, `@visx` imports your app relied on Elements to install, chart `height` numbers,
32
32
  and `format` function props or missing `locale` props passed through spread objects.
33
- 6. Review each changed page with the `review-elements` skill. Behavior changes show in the browser, not in types.
33
+ 6. Query the installed catalog using the task that prompted the upgrade. Exercise its recommended composition through
34
+ the app's regular import boundary. Remove local wrappers that duplicate a behavior the new package owns. Review the
35
+ rendered page using the version-matched `review-elements` skill.
34
36
 
35
37
  Do not pin an old behavior back with a wrapper or a patch. Move the call site to the new API, and report anything the
36
38
  new version cannot do.