oneslash-design-system 2.28.1 → 2.30.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 (248) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +31 -1
  3. package/dist/cases/about-page.md +2 -0
  4. package/dist/cases/accept-invite.md +2 -0
  5. package/dist/cases/account-menu.md +2 -0
  6. package/dist/cases/activity-timeline.md +2 -0
  7. package/dist/cases/admin-inbox.md +2 -0
  8. package/dist/cases/agent-asks-before-risky-action.md +3 -1
  9. package/dist/cases/agent-cancels-when-unanswered.md +2 -0
  10. package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
  11. package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
  12. package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
  13. package/dist/cases/agent-changes-review/per-change.jsx +203 -0
  14. package/dist/cases/agent-changes-review.md +585 -0
  15. package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
  16. package/dist/cases/agent-handoff/to-agent.jsx +53 -0
  17. package/dist/cases/agent-handoff/to-person.d.ts +1 -0
  18. package/dist/cases/agent-handoff/to-person.jsx +84 -0
  19. package/dist/cases/agent-handoff.md +231 -0
  20. package/dist/cases/agent-memory/list.d.ts +1 -0
  21. package/dist/cases/agent-memory/list.jsx +256 -0
  22. package/dist/cases/agent-memory.md +354 -0
  23. package/dist/cases/agent-options.md +2 -0
  24. package/dist/cases/agent-pending-reply/steps.jsx +70 -21
  25. package/dist/cases/agent-pending-reply.md +74 -27
  26. package/dist/cases/agent-permissions/levels.d.ts +3 -0
  27. package/dist/cases/agent-permissions/levels.jsx +51 -0
  28. package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
  29. package/dist/cases/agent-permissions/per-tool.jsx +180 -0
  30. package/dist/cases/agent-permissions.md +319 -0
  31. package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
  32. package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
  33. package/dist/cases/agent-plan-proposal.md +36 -21
  34. package/dist/cases/agent-question.md +2 -0
  35. package/dist/cases/agent-refuses-clearly.md +2 -0
  36. package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
  37. package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
  38. package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
  39. package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
  40. package/dist/cases/agent-run-failure.md +500 -0
  41. package/dist/cases/agent-says-what-it-is.md +2 -0
  42. package/dist/cases/agent-says-where-it-stopped.md +27 -0
  43. package/dist/cases/agent-settings.md +2 -0
  44. package/dist/cases/agent-shows-progress.md +2 -0
  45. package/dist/cases/agent-shows-sources.md +2 -0
  46. package/dist/cases/api-keys.md +2 -0
  47. package/dist/cases/app-shell.md +2 -0
  48. package/dist/cases/artifact-card.md +2 -0
  49. package/dist/cases/ask-page.md +2 -0
  50. package/dist/cases/auth-gate-loading.md +2 -0
  51. package/dist/cases/billing-page.md +2 -0
  52. package/dist/cases/blog-index.md +2 -0
  53. package/dist/cases/breadcrumb.md +2 -0
  54. package/dist/cases/breakdown-list.md +2 -0
  55. package/dist/cases/bulk-actions/list.d.ts +1 -0
  56. package/dist/cases/bulk-actions/list.jsx +206 -0
  57. package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
  58. package/dist/cases/bulk-actions/paged-table.jsx +243 -0
  59. package/dist/cases/bulk-actions.md +553 -0
  60. package/dist/cases/changelog.md +2 -0
  61. package/dist/cases/chart.md +2 -0
  62. package/dist/cases/check-your-email.md +2 -0
  63. package/dist/cases/code-sample.md +2 -0
  64. package/dist/cases/collapsible-search.md +2 -0
  65. package/dist/cases/comment-thread.md +2 -0
  66. package/dist/cases/comparison-page/table.d.ts +1 -0
  67. package/dist/cases/comparison-page/table.jsx +97 -0
  68. package/dist/cases/comparison-page.md +156 -0
  69. package/dist/cases/composer-limit.md +2 -0
  70. package/dist/cases/confirm-destructive-action.md +2 -0
  71. package/dist/cases/confirm-dialogs.md +2 -0
  72. package/dist/cases/connection-status/card.d.ts +1 -0
  73. package/dist/cases/connection-status/card.jsx +97 -0
  74. package/dist/cases/connection-status/row.d.ts +1 -0
  75. package/dist/cases/connection-status/row.jsx +120 -0
  76. package/dist/cases/connection-status.md +330 -0
  77. package/dist/cases/contact-page.md +2 -0
  78. package/dist/cases/conversation-starters.md +2 -0
  79. package/dist/cases/cookie-choice.md +2 -0
  80. package/dist/cases/create-modal.md +2 -0
  81. package/dist/cases/danger-zone.md +2 -0
  82. package/dist/cases/dashboard.md +2 -0
  83. package/dist/cases/data-table-page.md +2 -0
  84. package/dist/cases/date-field.md +2 -0
  85. package/dist/cases/device-login.md +2 -0
  86. package/dist/cases/docs-component-page.md +2 -0
  87. package/dist/cases/email-confirmed.md +2 -0
  88. package/dist/cases/empty-list.md +2 -0
  89. package/dist/cases/empty-lists.md +2 -0
  90. package/dist/cases/empty-not-set-up.md +2 -0
  91. package/dist/cases/empty-search.md +2 -0
  92. package/dist/cases/error-page.md +2 -0
  93. package/dist/cases/faq.md +2 -0
  94. package/dist/cases/feature-grid.md +2 -0
  95. package/dist/cases/feedback-form.md +2 -0
  96. package/dist/cases/file-upload.md +2 -0
  97. package/dist/cases/filter-menu.md +2 -0
  98. package/dist/cases/forgot-password.md +2 -0
  99. package/dist/cases/form-errors.md +2 -0
  100. package/dist/cases/image-viewer.md +2 -0
  101. package/dist/cases/import-checklist.md +2 -0
  102. package/dist/cases/inline-form-feedback.md +2 -0
  103. package/dist/cases/integrations-list/nested.jsx +1 -1
  104. package/dist/cases/integrations-list/rows.jsx +1 -1
  105. package/dist/cases/integrations-list.md +6 -4
  106. package/dist/cases/invite-member.md +2 -0
  107. package/dist/cases/invoice-list.md +2 -0
  108. package/dist/cases/landing-hero.md +2 -0
  109. package/dist/cases/leaderboard.md +2 -0
  110. package/dist/cases/legal-page.md +2 -0
  111. package/dist/cases/load-failure.md +2 -0
  112. package/dist/cases/log-out-confirm.md +2 -0
  113. package/dist/cases/login-page.md +2 -0
  114. package/dist/cases/long-form-page.md +2 -0
  115. package/dist/cases/master-detail.md +2 -0
  116. package/dist/cases/members-list.md +2 -0
  117. package/dist/cases/mention-list.md +2 -0
  118. package/dist/cases/message-actions.md +2 -0
  119. package/dist/cases/message-attachments.md +2 -0
  120. package/dist/cases/message-composer/with-tools.jsx +17 -7
  121. package/dist/cases/message-composer.md +28 -11
  122. package/dist/cases/message-edit.md +2 -0
  123. package/dist/cases/message-reactions.md +2 -0
  124. package/dist/cases/message-row.md +2 -0
  125. package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
  126. package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
  127. package/dist/cases/message-send-failure/retrying.d.ts +1 -0
  128. package/dist/cases/message-send-failure/retrying.jsx +116 -0
  129. package/dist/cases/message-send-failure.md +308 -0
  130. package/dist/cases/mobile-menu.md +2 -0
  131. package/dist/cases/newsletter-signup.md +2 -0
  132. package/dist/cases/no-access/page.d.ts +1 -0
  133. package/dist/cases/no-access/page.jsx +37 -0
  134. package/dist/cases/no-access/read-only.d.ts +1 -0
  135. package/dist/cases/no-access/read-only.jsx +33 -0
  136. package/dist/cases/no-access.md +147 -0
  137. package/dist/cases/not-found-page.md +2 -0
  138. package/dist/cases/notification-menu.md +2 -0
  139. package/dist/cases/number-format.md +2 -0
  140. package/dist/cases/oauth-consent.md +2 -0
  141. package/dist/cases/on-off-settings.md +2 -0
  142. package/dist/cases/on-this-page.md +2 -0
  143. package/dist/cases/onboarding.md +2 -0
  144. package/dist/cases/one-main-action.md +2 -0
  145. package/dist/cases/overflow-menu.md +2 -0
  146. package/dist/cases/page-end.md +2 -0
  147. package/dist/cases/page-header.md +2 -0
  148. package/dist/cases/paged-card.md +2 -0
  149. package/dist/cases/password-gate.md +2 -0
  150. package/dist/cases/payment-method.md +2 -0
  151. package/dist/cases/people-row.md +2 -0
  152. package/dist/cases/phone-navigation.md +2 -0
  153. package/dist/cases/plan-change-confirm.md +2 -0
  154. package/dist/cases/plan-comparison.md +3 -1
  155. package/dist/cases/plan-picker.md +4 -1
  156. package/dist/cases/plan-sign-off.md +2 -0
  157. package/dist/cases/pricing-section.md +5 -1
  158. package/dist/cases/product-cards.md +2 -0
  159. package/dist/cases/product-demo/scripted.d.ts +1 -0
  160. package/dist/cases/product-demo/scripted.jsx +99 -0
  161. package/dist/cases/product-demo/still.d.ts +1 -0
  162. package/dist/cases/product-demo/still.jsx +20 -0
  163. package/dist/cases/product-demo.md +226 -0
  164. package/dist/cases/profile-form.md +2 -0
  165. package/dist/cases/quick-switcher.md +2 -0
  166. package/dist/cases/range-switch.md +2 -0
  167. package/dist/cases/rename.md +2 -0
  168. package/dist/cases/reply-feedback.md +2 -0
  169. package/dist/cases/reply-sources.md +2 -0
  170. package/dist/cases/route-loading.md +2 -0
  171. package/dist/cases/scope-picker.md +2 -0
  172. package/dist/cases/section-index.md +2 -0
  173. package/dist/cases/session-expired/in-place.d.ts +1 -0
  174. package/dist/cases/session-expired/in-place.jsx +63 -0
  175. package/dist/cases/session-expired/redirect.d.ts +1 -0
  176. package/dist/cases/session-expired/redirect.jsx +62 -0
  177. package/dist/cases/session-expired.md +204 -0
  178. package/dist/cases/set-new-password.md +2 -0
  179. package/dist/cases/settings-page.md +2 -0
  180. package/dist/cases/settings-save.md +2 -0
  181. package/dist/cases/side-pane.md +2 -0
  182. package/dist/cases/sidebar-nav.md +2 -0
  183. package/dist/cases/sign-up-page.md +3 -0
  184. package/dist/cases/signup-from-site/plain.d.ts +1 -0
  185. package/dist/cases/signup-from-site/plain.jsx +125 -0
  186. package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
  187. package/dist/cases/signup-from-site/with-plan.jsx +151 -0
  188. package/dist/cases/signup-from-site.md +351 -0
  189. package/dist/cases/site-footer.md +2 -0
  190. package/dist/cases/site-header/links.d.ts +3 -1
  191. package/dist/cases/site-header/links.jsx +6 -2
  192. package/dist/cases/site-header.md +11 -3
  193. package/dist/cases/site-matches-app.md +32 -0
  194. package/dist/cases/site-search.md +2 -0
  195. package/dist/cases/slash-command-list.md +2 -0
  196. package/dist/cases/stat-row.md +2 -0
  197. package/dist/cases/status-label.md +3 -1
  198. package/dist/cases/success-feedback.md +2 -0
  199. package/dist/cases/tabbed-panels.md +2 -0
  200. package/dist/cases/tag-filter.md +2 -0
  201. package/dist/cases/task-header.md +2 -0
  202. package/dist/cases/theme-switcher.md +2 -0
  203. package/dist/cases/type-to-confirm.md +2 -0
  204. package/dist/cases/typing-and-status.md +2 -0
  205. package/dist/cases/unsaved-changes-guard.md +2 -0
  206. package/dist/cases/upgrade-prompt.md +2 -0
  207. package/dist/cases/usage-meters.md +2 -0
  208. package/dist/cases.json +1492 -39
  209. package/dist/components/checkBox.d.ts +7 -2
  210. package/dist/components/checkBox.jsx +39 -14
  211. package/dist/components/diff.d.ts +32 -0
  212. package/dist/components/diff.jsx +42 -0
  213. package/dist/components/segmentedControl.d.ts +3 -1
  214. package/dist/components/segmentedControl.jsx +8 -6
  215. package/dist/components/slidingIndicator.d.ts +5 -2
  216. package/dist/components/slidingIndicator.jsx +9 -3
  217. package/dist/components/tableContainer.d.ts +1 -1
  218. package/dist/components/tableContainer.jsx +2 -2
  219. package/dist/components/timeStamp.d.ts +3 -1
  220. package/dist/components/timeStamp.jsx +4 -2
  221. package/dist/components/useReducedMotion.d.ts +6 -0
  222. package/dist/components/useReducedMotion.js +19 -0
  223. package/dist/index.d.ts +2 -0
  224. package/dist/index.js +2 -0
  225. package/dist/internal/diff.d.ts +17 -0
  226. package/dist/internal/diff.js +44 -0
  227. package/dist/native-mapping.json +9 -2
  228. package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
  229. package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
  230. package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
  231. package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
  232. package/dist/stories/Cases.generated.stories.d.ts +24 -0
  233. package/dist/stories/Cases.generated.stories.jsx +48 -0
  234. package/dist/stories/Checkbox.stories.d.ts +3 -0
  235. package/dist/stories/Checkbox.stories.jsx +38 -0
  236. package/dist/stories/Diff.stories.d.ts +10 -0
  237. package/dist/stories/Diff.stories.jsx +45 -0
  238. package/dist/stories/SegmentedControl.stories.d.ts +1 -0
  239. package/dist/stories/SegmentedControl.stories.jsx +6 -0
  240. package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
  241. package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
  242. package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
  243. package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
  244. package/dist/stories/Table.stories.d.ts +1 -0
  245. package/dist/stories/Table.stories.jsx +25 -0
  246. package/dist/stories/TimeStamp.stories.d.ts +1 -0
  247. package/dist/stories/TimeStamp.stories.jsx +13 -0
  248. package/package.json +5 -1
@@ -0,0 +1,585 @@
1
+ # Review of an agent's changes
2
+
3
+ The agent has changed files or other work and a person reviews the changes before they are applied.
4
+
5
+ For: an agent
6
+
7
+ ## Do
8
+
9
+ - Follow the rule 'An agent asks before a risky action': nothing is applied until the person presses the apply Button.
10
+ - Show the changes themselves, each file in a `Diff`, not a summary of them. `Diff` marks each line with a `+` or `-` and hidden text, so color is never the only sign.
11
+ - Put each file in an `Accordion` item titled with its path, with the first one open, when the changes belong together. Say the count in `secondTitle`: '13 added, 3 removed'.
12
+ - Say the size of the whole change above the files: '3 files, 24 lines added, 6 removed'. Count it from the lines, not by hand.
13
+ - Order the Buttons 'Cancel', 'Request Changes', then 'Apply Changes' as the primary Button, under the files.
14
+ - Mark the card 'Cancelled' on 'Cancel', and add one line under it: 'Cancelled. Nothing was changed.'
15
+ - Show the waiting time above the Buttons while the card is open: 'Waits 10 more minutes, then cancels.'
16
+ - Open a `Textarea` labelled 'What should change?' on 'Request Changes', with 'Discard' and 'Send', as the case 'Plan proposal' does.
17
+ - Give each change its own `SettingsSection`, titled with the file or the thing it changes, when each change stands alone. Put its `Diff` and its Buttons in it.
18
+ - Give each change 'Accept' as a small secondary Button and 'Reject' as a small tertiary one. Name the change in each `aria-label`: 'Accept the change to data/plans.json'.
19
+ - Show an 'Accepted' or 'Rejected' `Tag` on a decided change, with an 'Undo' tertiary Button in place of its Buttons.
20
+ - Move focus after 'Accept' or 'Reject' to the next change that is not decided, on its first Button. When none is left, move it to the apply Button.
21
+ - Move focus to 'Reject All' when none is left and none was accepted, and to the change's 'Accept' after 'Undo'.
22
+ - Count the accepted changes in the apply Button's label: 'Apply 2 Changes'. With none accepted it is disabled, and a line under the changes says why: 'Accept at least one change to apply it.'
23
+ - Say how many changes are not decided yet, and that applying leaves them out.
24
+ - Make the pressed Button `loading` and keep its label. Disable the others while the request runs.
25
+ - Mark the card with an 'Applied', 'Rejected' or 'Cancelled' `Tag` once it is done, remove its Buttons and say in one line what was applied.
26
+
27
+ ## Don't
28
+
29
+ - Do not apply a change on 'Accept'. Applying is one step at the end.
30
+ - Do not show added and removed lines by color alone.
31
+ - Do not replace the changes with a list of file names.
32
+ - Do not change the apply Button's label while it is loading, such as to 'Applying...'.
33
+ - Do not let a second press on a decided card apply or reject it again.
34
+
35
+ ## Option: All at once
36
+
37
+ Use when: The changes belong together, such as one fix across files.
38
+
39
+ Uses: `Accordion`, `Button`, `Center`, `Cluster`, `Diff`, `Heading`, `Message`, `Paragraph`, `Stack`, `Surface`, `Tag`, `Textarea`, `TimeStamp`, `UserImage`, `diffLines`
40
+
41
+ ```tsx
42
+ 'use client';
43
+ import { useEffect, useRef, useState } from 'react';
44
+ import { Bot } from 'lucide-react';
45
+ import Message from 'oneslash-design-system/components/message';
46
+ import UserImage from 'oneslash-design-system/components/userImage';
47
+ import Tag from 'oneslash-design-system/components/tag';
48
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
49
+ import Heading from 'oneslash-design-system/components/heading';
50
+ import Paragraph from 'oneslash-design-system/components/paragraph';
51
+ import Button from 'oneslash-design-system/components/button';
52
+ import Surface from 'oneslash-design-system/components/surface';
53
+ import Accordion from 'oneslash-design-system/components/accordion';
54
+ import Diff, { diffLines } from 'oneslash-design-system/components/diff';
55
+ import Textarea from 'oneslash-design-system/components/textarea';
56
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
57
+
58
+ type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
59
+
60
+ const agentName = 'Acme Agent';
61
+
62
+ const request = { from: 'Dana Lee', at: new Date('2026-11-16T14:30:00Z'), text: 'Can you add the Business plan to the pricing page?' };
63
+ const proposedAt = new Date('2026-11-16T14:34:00Z');
64
+
65
+ // One change across three files: each file before and after. A real app gets the lines from the server.
66
+ const files = [
67
+ {
68
+ id: 'plans',
69
+ path: 'data/plans.json',
70
+ before: [
71
+ '[',
72
+ ' { "id": "free", "price": "$0.00" },',
73
+ ' { "id": "pro", "price": "$8.00" }',
74
+ ']',
75
+ ],
76
+ after: [
77
+ '[',
78
+ ' { "id": "free", "price": "$0.00" },',
79
+ ' { "id": "pro", "price": "$8.00" },',
80
+ ' { "id": "business", "price": "$16.00" }',
81
+ ']',
82
+ ],
83
+ },
84
+ {
85
+ id: 'plan-table',
86
+ path: 'ui/planTable.tsx',
87
+ before: [
88
+ 'const columns = [',
89
+ " { id: 'free', title: 'Free' },",
90
+ " { id: 'pro', title: 'Pro' },",
91
+ '];',
92
+ '',
93
+ 'const rows = [',
94
+ " { feature: 'Members', free: '3', pro: '20' },",
95
+ " { feature: 'Agent replies', free: '50', pro: '500' },",
96
+ " { feature: 'Support', free: 'Email', pro: 'Email' },",
97
+ '];',
98
+ ],
99
+ after: [
100
+ 'const columns = [',
101
+ " { id: 'free', title: 'Free' },",
102
+ " { id: 'pro', title: 'Pro' },",
103
+ " { id: 'business', title: 'Business' },",
104
+ '];',
105
+ '',
106
+ 'const rows = [',
107
+ ' {',
108
+ " feature: 'Members',",
109
+ " free: '3', pro: '20', business: 'Any',",
110
+ ' },',
111
+ ' {',
112
+ " feature: 'Agent replies',",
113
+ " free: '50', pro: '500', business: '2,000',",
114
+ ' },',
115
+ ' {',
116
+ " feature: 'Support',",
117
+ " free: 'Email', pro: 'Email', business: 'Chat',",
118
+ ' },',
119
+ '];',
120
+ ],
121
+ },
122
+ {
123
+ id: 'pricing',
124
+ path: 'pages/pricing.tsx',
125
+ before: [
126
+ "import PlanTable from '../ui/planTable';",
127
+ '',
128
+ 'export default function Pricing() {',
129
+ ' return (',
130
+ ' <Page title="Pricing">',
131
+ ' <PlanTable />',
132
+ ' </Page>',
133
+ ' );',
134
+ '}',
135
+ ],
136
+ after: [
137
+ "import PlanTable from '../ui/planTable';",
138
+ "import ContactSales from '../ui/contactSales';",
139
+ "import Faq from '../ui/faq';",
140
+ '',
141
+ 'export default function Pricing() {',
142
+ ' return (',
143
+ ' <Page title="Plans and pricing">',
144
+ ' <PlanTable highlight="business" />',
145
+ ' <ContactSales',
146
+ ' plan="business"',
147
+ ' title="Business for larger teams"',
148
+ ' />',
149
+ ' <Faq />',
150
+ ' </Page>',
151
+ ' );',
152
+ '}',
153
+ ],
154
+ },
155
+ ].map((f) => {
156
+ const lines = diffLines(f.before.join('\n'), f.after.join('\n'));
157
+ return {
158
+ id: f.id,
159
+ path: f.path,
160
+ lines,
161
+ added: lines.filter((l) => l.kind === 'added').length,
162
+ removed: lines.filter((l) => l.kind === 'removed').length,
163
+ };
164
+ });
165
+
166
+ // Counted from the lines, so the summary always matches the files.
167
+ const added = files.reduce((n, f) => n + f.added, 0);
168
+ const removed = files.reduce((n, f) => n + f.removed, 0);
169
+ const summary = `${files.length} files, ${added} lines added, ${removed} removed`;
170
+
171
+ type Status = 'open' | 'requesting' | 'redoing' | 'applied' | 'cancelled';
172
+
173
+ // The agent's marks, as the rule 'An agent says what it is' says.
174
+ function agentMeta(at: Date) {
175
+ return (
176
+ <>
177
+ <Tag variant="contained" size="small" label="Agent" />
178
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
179
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
180
+ </>
181
+ );
182
+ }
183
+
184
+ export default function AgentChangesReviewAllAtOnce() {
185
+ const [status, setStatus] = useState<Status>('open');
186
+ const [pending, setPending] = useState<'apply' | 'cancel' | 'send' | null>(null);
187
+ const [draft, setDraft] = useState('');
188
+ const timer = useRef<ReturnType<typeof setTimeout>>();
189
+ const requestButton = useRef<Focusable>(null);
190
+ // Where focus goes after the next render, once the element it goes to is on screen.
191
+ const focusNext = useRef<() => void>();
192
+
193
+ // Stops the request if the example goes away before it ends.
194
+ useEffect(() => () => clearTimeout(timer.current), []);
195
+
196
+ useEffect(() => {
197
+ const move = focusNext.current;
198
+ focusNext.current = undefined;
199
+ move?.();
200
+ });
201
+
202
+ // Decided once: the Buttons go away, so a second press cannot apply or cancel it again.
203
+ // Nothing takes their place: a real app moves focus to the message box.
204
+ function decide(action: 'apply' | 'cancel') {
205
+ if (pending || status !== 'open') return;
206
+ setPending(action);
207
+ // Stands in for the request to the server.
208
+ timer.current = setTimeout(() => {
209
+ setPending(null);
210
+ setStatus(action === 'apply' ? 'applied' : 'cancelled');
211
+ }, 1200);
212
+ }
213
+
214
+ function startRequest() {
215
+ if (pending) return;
216
+ setDraft('');
217
+ setStatus('requesting');
218
+ }
219
+
220
+ // 'Discard' leaves the field and keeps the changes open for review.
221
+ function discard() {
222
+ setStatus('open');
223
+ focusNext.current = () => requestButton.current?.focus();
224
+ }
225
+
226
+ const empty = draft.trim() === '';
227
+
228
+ // 'Send' tells the agent what should change. The Buttons go, and the agent redoes the changes.
229
+ // Nothing takes their place: a real app moves focus to the message box.
230
+ function send() {
231
+ if (pending || empty) return;
232
+ setPending('send');
233
+ // Stands in for the request to the server.
234
+ timer.current = setTimeout(() => {
235
+ setPending(null);
236
+ setStatus('redoing');
237
+ }, 1200);
238
+ }
239
+
240
+ return (
241
+ <Center width="page">
242
+ <Stack gap="large">
243
+ <Heading level={1} size="h5">Launch plan</Heading>
244
+ {/* A real app gives the list that holds the rows role="log". */}
245
+ <Stack gap="small">
246
+ <Message
247
+ aria-label={request.from}
248
+ avatar={<UserImage userHandle={request.from} decorative />}
249
+ name={request.from}
250
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
251
+ >
252
+ <Paragraph measure="none">{request.text}</Paragraph>
253
+ </Message>
254
+ <Message
255
+ aria-label={`${agentName}, agent`}
256
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
257
+ name={agentName}
258
+ meta={agentMeta(proposedAt)}
259
+ >
260
+ <Surface padding="small">
261
+ <Stack gap="medium">
262
+ {/* A real app announces the decided Tag in a polite live region. */}
263
+ <Cluster gap="small">
264
+ <Heading level={2} size="subtitle1">Changes ready</Heading>
265
+ {status === 'applied' && <Tag variant="contained" size="small" color="success" label="Applied" />}
266
+ {status === 'cancelled' && <Tag variant="contained" size="small" label="Cancelled" />}
267
+ </Cluster>
268
+ <Paragraph measure="none">These changes add the Business plan at $16.00 per member per month to the pricing page. They belong together, so they apply together.</Paragraph>
269
+ <Paragraph size="body2" tone="secondary" measure="none">{summary}</Paragraph>
270
+ {/* The changes themselves, one file per item, the first one open. */}
271
+ <Accordion
272
+ id="agent-changes-review-all-at-once-files"
273
+ headingLevel={3}
274
+ defaultOpen={[files[0].id]}
275
+ items={files.map((f) => ({
276
+ id: f.id,
277
+ title: f.path,
278
+ secondTitle: `${f.added} added, ${f.removed} removed`,
279
+ content: <Diff id={`agent-changes-review-all-at-once-${f.id}`} label={`Changes to ${f.path}`} lines={f.lines} maxRows={16} wrap />,
280
+ }))}
281
+ />
282
+ {status === 'requesting' && (
283
+ <Textarea
284
+ id="agent-changes-review-all-at-once-request"
285
+ label="What should change?"
286
+ value={draft}
287
+ onChange={(e) => setDraft(e.target.value)}
288
+ onSubmit={send}
289
+ autoFocus
290
+ disabled={pending === 'send'}
291
+ />
292
+ )}
293
+ {status === 'redoing' && (
294
+ <Paragraph measure="none">Acme Agent is redoing the changes. It posts a new card when they are ready.</Paragraph>
295
+ )}
296
+ {/* The product sets the waiting time and counts it down. When it is up, nothing is applied. */}
297
+ {(status === 'open' || status === 'requesting') && (
298
+ <Paragraph size="caption" tone="secondary" measure="none">Waits 10 more minutes, then cancels.</Paragraph>
299
+ )}
300
+ {status === 'open' && (
301
+ <Cluster gap="small">
302
+ <Button size="small" type="tertiary" state={pending === 'apply' ? 'disabled' : 'enabled'} label="Cancel" loading={pending === 'cancel'} onClickButton={() => decide('cancel')} />
303
+ <Button ref={requestButton} size="small" type="secondary" state={pending ? 'disabled' : 'enabled'} label="Request Changes" onClickButton={startRequest} />
304
+ {/* The product writes this label, never the agent. */}
305
+ <Button size="small" type="primary" state={pending === 'cancel' ? 'disabled' : 'enabled'} label="Apply Changes" loading={pending === 'apply'} onClickButton={() => decide('apply')} />
306
+ </Cluster>
307
+ )}
308
+ {status === 'requesting' && (
309
+ <Cluster gap="small">
310
+ <Button size="small" type="tertiary" state={pending === 'send' ? 'disabled' : 'enabled'} label="Discard" onClickButton={discard} />
311
+ <Button size="small" type="primary" state={empty ? 'disabled' : 'enabled'} label="Send" loading={pending === 'send'} onClickButton={send} />
312
+ </Cluster>
313
+ )}
314
+ </Stack>
315
+ </Surface>
316
+ </Message>
317
+ {status === 'applied' && (
318
+ // One line in the thread on what was applied, under the card.
319
+ <Message compact aria-label={`${agentName}, agent`}>
320
+ <Paragraph measure="none">Applied the changes to {files.length} files.</Paragraph>
321
+ </Message>
322
+ )}
323
+ {status === 'cancelled' && (
324
+ // One line in the thread on what was not done, under the card.
325
+ <Message compact aria-label={`${agentName}, agent`}>
326
+ <Paragraph measure="none">Cancelled. Nothing was changed.</Paragraph>
327
+ </Message>
328
+ )}
329
+ </Stack>
330
+ </Stack>
331
+ </Center>
332
+ );
333
+ }
334
+ ```
335
+
336
+ ## Option: Change by change
337
+
338
+ Use when: Each change stands alone and a person may want only some.
339
+
340
+ Uses: `Button`, `Center`, `Cluster`, `Diff`, `Heading`, `Message`, `Paragraph`, `SettingsSection`, `Stack`, `Surface`, `Tag`, `TimeStamp`, `UserImage`, `diffLines`
341
+
342
+ ```tsx
343
+ 'use client';
344
+ import { useEffect, useRef, useState } from 'react';
345
+ import { Bot } from 'lucide-react';
346
+ import Message from 'oneslash-design-system/components/message';
347
+ import UserImage from 'oneslash-design-system/components/userImage';
348
+ import Tag from 'oneslash-design-system/components/tag';
349
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
350
+ import Heading from 'oneslash-design-system/components/heading';
351
+ import Paragraph from 'oneslash-design-system/components/paragraph';
352
+ import Button from 'oneslash-design-system/components/button';
353
+ import Surface from 'oneslash-design-system/components/surface';
354
+ import SettingsSection from 'oneslash-design-system/components/settingsSection';
355
+ import Diff, { diffLines } from 'oneslash-design-system/components/diff';
356
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
357
+
358
+ type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
359
+ type Decision = 'accepted' | 'rejected';
360
+
361
+ const agentName = 'Acme Agent';
362
+
363
+ const request = { from: 'Dana Lee', at: new Date('2026-11-16T14:30:00Z'), text: 'Can you check the pricing page for mistakes?' };
364
+ const proposedAt = new Date('2026-11-16T14:33:00Z');
365
+
366
+ // Three changes that each stand alone. A real app gets the lines from the server.
367
+ const changes = [
368
+ {
369
+ id: 'heading',
370
+ path: 'pages/pricing.tsx',
371
+ what: "Fixes the spelling of 'Business' in a heading.",
372
+ before: ['<Section>', ' <h2>Busines plan</h2>', ' <PlanTable />', '</Section>'],
373
+ after: ['<Section>', ' <h2>Business plan</h2>', ' <PlanTable />', '</Section>'],
374
+ },
375
+ {
376
+ id: 'price',
377
+ path: 'data/plans.json',
378
+ what: 'Shows the Pro price with cents.',
379
+ before: [' { "id": "free", "price": "$0.00" },', ' { "id": "pro", "price": "$8" }'],
380
+ after: [' { "id": "free", "price": "$0.00" },', ' { "id": "pro", "price": "$8.00" }'],
381
+ },
382
+ {
383
+ id: 'terms',
384
+ path: 'components/footer.tsx',
385
+ what: 'Points the Terms link at its new address.',
386
+ before: ['<Link href="/terms-of-service">', ' Terms', '</Link>'],
387
+ after: ['<Link href="/legal/terms">', ' Terms', '</Link>'],
388
+ },
389
+ ].map((c) => ({ id: c.id, path: c.path, what: c.what, lines: diffLines(c.before.join('\n'), c.after.join('\n')) }));
390
+
391
+ type Status = 'open' | 'applied' | 'rejected';
392
+
393
+ function changesWord(n: number) {
394
+ return n === 1 ? 'Change' : 'Changes';
395
+ }
396
+
397
+ // The agent's marks, as the rule 'An agent says what it is' says.
398
+ function agentMeta(at: Date) {
399
+ return (
400
+ <>
401
+ <Tag variant="contained" size="small" label="Agent" />
402
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
403
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
404
+ </>
405
+ );
406
+ }
407
+
408
+ export default function AgentChangesReviewPerChange() {
409
+ const [decisions, setDecisions] = useState<Record<string, Decision>>({});
410
+ const [status, setStatus] = useState<Status>('open');
411
+ const [pending, setPending] = useState<'apply' | 'reject' | null>(null);
412
+ const timer = useRef<ReturnType<typeof setTimeout>>();
413
+ // Each change's 'Accept' by change id, so focus can move to the next change that is not decided.
414
+ const acceptButtons = useRef<Record<string, Focusable>>({});
415
+ const applyButton = useRef<Focusable>(null);
416
+ const rejectAllButton = useRef<Focusable>(null);
417
+ // Where focus goes after the next render, once the element it goes to is on screen.
418
+ const focusNext = useRef<() => void>();
419
+
420
+ // Stops the request if the example goes away before it ends.
421
+ useEffect(() => () => clearTimeout(timer.current), []);
422
+
423
+ useEffect(() => {
424
+ const move = focusNext.current;
425
+ focusNext.current = undefined;
426
+ move?.();
427
+ });
428
+
429
+ const accepted = changes.filter((c) => decisions[c.id] === 'accepted').length;
430
+ const undecided = changes.filter((c) => !decisions[c.id]).length;
431
+
432
+ // Deciding only marks the change. Nothing is applied until 'Apply'.
433
+ // The Buttons that had focus are gone, so focus goes to the next change that is not decided, after this one first.
434
+ // When every change is decided it goes to 'Apply', or to 'Reject All' when none was accepted, since 'Apply' is then disabled.
435
+ function decide(id: string, decision: Decision) {
436
+ if (pending || status !== 'open') return;
437
+ const next = { ...decisions, [id]: decision };
438
+ setDecisions(next);
439
+ const at = changes.findIndex((c) => c.id === id);
440
+ const order = [...changes.slice(at + 1), ...changes.slice(0, at)];
441
+ const nextOpen = order.find((c) => !next[c.id]);
442
+ const anyAccepted = changes.some((c) => next[c.id] === 'accepted');
443
+ focusNext.current = () =>
444
+ (nextOpen ? acceptButtons.current[nextOpen.id] : anyAccepted ? applyButton.current : rejectAllButton.current)?.focus();
445
+ }
446
+
447
+ // 'Undo' goes away with the Tag, so focus goes to the change's 'Accept'.
448
+ function undo(id: string) {
449
+ if (pending || status !== 'open') return;
450
+ setDecisions((current) => {
451
+ const next = { ...current };
452
+ delete next[id];
453
+ return next;
454
+ });
455
+ focusNext.current = () => acceptButtons.current[id]?.focus();
456
+ }
457
+
458
+ // Done once: the Buttons go away, so a second press cannot apply or reject again.
459
+ // Nothing takes their place: a real app moves focus to the message box.
460
+ function finish(action: 'apply' | 'reject') {
461
+ if (pending || status !== 'open') return;
462
+ if (action === 'apply' && accepted === 0) return;
463
+ setPending(action);
464
+ // Stands in for the request to the server.
465
+ timer.current = setTimeout(() => {
466
+ setPending(null);
467
+ if (action === 'reject') {
468
+ setDecisions(Object.fromEntries(changes.map((c) => [c.id, 'rejected' as Decision])));
469
+ setStatus('rejected');
470
+ return;
471
+ }
472
+ setStatus('applied');
473
+ }, 1200);
474
+ }
475
+
476
+ const reason =
477
+ accepted === 0
478
+ ? 'Accept at least one change to apply it.'
479
+ : undecided > 0
480
+ ? `${undecided} ${undecided === 1 ? 'change is' : 'changes are'} not decided. Applying leaves ${undecided === 1 ? 'it' : 'them'} out.`
481
+ : `${accepted} of ${changes.length} changes will be applied.`;
482
+
483
+ const left = changes.length - accepted;
484
+ const doneLine =
485
+ status === 'applied'
486
+ ? `Applied ${accepted} ${changesWord(accepted).toLowerCase()}. ${left} ${left === 1 ? 'change was' : 'changes were'} not applied.`
487
+ : 'Rejected every change. Nothing was changed.';
488
+
489
+ return (
490
+ <Center width="page">
491
+ <Stack gap="large">
492
+ <Heading level={1} size="h5">Launch plan</Heading>
493
+ {/* A real app gives the list that holds the rows role="log". */}
494
+ <Stack gap="small">
495
+ <Message
496
+ aria-label={request.from}
497
+ avatar={<UserImage userHandle={request.from} decorative />}
498
+ name={request.from}
499
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
500
+ >
501
+ <Paragraph measure="none">{request.text}</Paragraph>
502
+ </Message>
503
+ <Message
504
+ aria-label={`${agentName}, agent`}
505
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
506
+ name={agentName}
507
+ meta={agentMeta(proposedAt)}
508
+ >
509
+ <Surface padding="small">
510
+ <Stack gap="large">
511
+ <Stack gap="small">
512
+ {/* A real app announces the decided Tag in a polite live region. */}
513
+ <Cluster gap="small">
514
+ <Heading level={2} size="h6">Fixes ready</Heading>
515
+ {status === 'applied' && <Tag variant="contained" size="small" color="success" label="Applied" />}
516
+ {status === 'rejected' && <Tag variant="contained" size="small" label="Rejected" />}
517
+ </Cluster>
518
+ <Paragraph measure="none">I found three mistakes on the pricing page. Each fix stands alone, so pick the ones you want. Nothing changes until you apply.</Paragraph>
519
+ </Stack>
520
+ {changes.map((c) => {
521
+ const decision = decisions[c.id];
522
+ return (
523
+ <SettingsSection key={c.id} level={3} title={c.path} description={c.what}>
524
+ <Diff id={`agent-changes-review-per-change-${c.id}`} label={`Changes to ${c.path}`} lines={c.lines} wrap />
525
+ {decision ? (
526
+ // The Tag says the decision in words, so color is never the only sign.
527
+ <Cluster gap="small">
528
+ <Tag variant="contained" size="small" color={decision === 'accepted' ? 'success' : 'default'} label={decision === 'accepted' ? 'Accepted' : 'Rejected'} />
529
+ {status === 'open' && (
530
+ <Button size="small" type="tertiary" state={pending ? 'disabled' : 'enabled'} label="Undo" aria-label={`Undo the decision on ${c.path}`} onClickButton={() => undo(c.id)} />
531
+ )}
532
+ </Cluster>
533
+ ) : (
534
+ <Cluster gap="small">
535
+ <Button
536
+ ref={(el) => { acceptButtons.current[c.id] = el; }}
537
+ size="small"
538
+ type="secondary"
539
+ state={pending ? 'disabled' : 'enabled'}
540
+ label="Accept"
541
+ aria-label={`Accept the change to ${c.path}`}
542
+ onClickButton={() => decide(c.id, 'accepted')}
543
+ />
544
+ <Button size="small" type="tertiary" state={pending ? 'disabled' : 'enabled'} label="Reject" aria-label={`Reject the change to ${c.path}`} onClickButton={() => decide(c.id, 'rejected')} />
545
+ </Cluster>
546
+ )}
547
+ </SettingsSection>
548
+ );
549
+ })}
550
+ {status === 'open' && (
551
+ <Stack gap="small">
552
+ {/* The product sets the waiting time and counts it down. When it is up, nothing is applied. */}
553
+ <Paragraph size="caption" tone="secondary" measure="none">Waits 10 more minutes, then cancels.</Paragraph>
554
+ <Paragraph id="agent-changes-review-per-change-reason" size="body2" tone="secondary" measure="none">{reason}</Paragraph>
555
+ <Cluster gap="small">
556
+ <Button ref={rejectAllButton} size="small" type="tertiary" state={pending === 'apply' ? 'disabled' : 'enabled'} label="Reject All" loading={pending === 'reject'} onClickButton={() => finish('reject')} />
557
+ {/* The count is always the accepted count. With none accepted it is disabled, and the line above says why. */}
558
+ <Button
559
+ ref={applyButton}
560
+ size="small"
561
+ type="primary"
562
+ state={accepted === 0 || pending === 'reject' ? 'disabled' : 'enabled'}
563
+ label={`Apply ${accepted} ${changesWord(accepted)}`}
564
+ aria-describedby="agent-changes-review-per-change-reason"
565
+ loading={pending === 'apply'}
566
+ onClickButton={() => finish('apply')}
567
+ />
568
+ </Cluster>
569
+ </Stack>
570
+ )}
571
+ </Stack>
572
+ </Surface>
573
+ </Message>
574
+ {status !== 'open' && (
575
+ // One line in the thread on what was applied, under the card.
576
+ <Message compact aria-label={`${agentName}, agent`}>
577
+ <Paragraph measure="none">{doneLine}</Paragraph>
578
+ </Message>
579
+ )}
580
+ </Stack>
581
+ </Stack>
582
+ </Center>
583
+ );
584
+ }
585
+ ```
@@ -0,0 +1 @@
1
+ export default function AgentHandoffToAgent(): import("react").JSX.Element;
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ import { Bot, GitPullRequest } from 'lucide-react';
3
+ import Message from '../../components/message';
4
+ import UserImage from '../../components/userImage';
5
+ import Tag from '../../components/tag';
6
+ import TimeStamp from '../../components/timeStamp';
7
+ import Heading from '../../components/heading';
8
+ import Paragraph from '../../components/paragraph';
9
+ import SourceCard from '../../components/sourceCard';
10
+ import { Center, Stack } from '../../components/layout';
11
+ var agentName = 'Acme Agent';
12
+ var reviewerName = 'Acme Reviewer';
13
+ var request = { from: 'Dana Lee', at: new Date('2026-11-16T14:30:00Z'), text: 'Can you fix the broken Terms link in the footer?' };
14
+ var fixedAt = new Date('2026-11-16T14:36:00Z');
15
+ var reviewAt = new Date('2026-11-16T14:37:00Z');
16
+ // Each agent's marks, as the rule 'An agent says what it is' says.
17
+ function agentMeta(at) {
18
+ return (<>
19
+ <Tag variant="contained" size="small" label="Agent"/>
20
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time"/>
21
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
22
+ </>);
23
+ }
24
+ export default function AgentHandoffToAgent() {
25
+ return (<Center width="page">
26
+ <Stack gap="large">
27
+ <Heading level={1} size="h5">Launch plan</Heading>
28
+ {/* A real app gives the list that holds the rows role="log". */}
29
+ <Stack gap="small">
30
+ <Message aria-label={request.from} avatar={<UserImage userHandle={request.from} decorative/>} name={request.from} meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time"/>}>
31
+ <Paragraph measure="none">{request.text}</Paragraph>
32
+ </Message>
33
+ <Message aria-label={"".concat(agentName, ", agent")} avatar={<UserImage userHandle={agentName} icon={Bot} decorative/>} name={agentName} meta={agentMeta(fixedAt)}>
34
+ <Stack gap="medium">
35
+ <Paragraph measure="none">I fixed the Terms link in the footer and opened a pull request.</Paragraph>
36
+ <SourceCard icon={GitPullRequest} title="Fix the Terms link" meta="Pull request · Waiting for review" href="/pulls/1187"/>
37
+ </Stack>
38
+ </Message>
39
+ {/* One line, with its reason, so the hand-off is never silent. */}
40
+ <Message compact aria-label={"".concat(agentName, ", agent")}>
41
+ <Paragraph size="body2" tone="secondary" measure="none">Handed off to {reviewerName}. It checks every change before it merges.</Paragraph>
42
+ </Message>
43
+ <Message aria-label={"".concat(reviewerName, ", agent")} avatar={<UserImage userHandle={reviewerName} icon={Bot} decorative/>} name={reviewerName} meta={agentMeta(reviewAt)}>
44
+ <Stack gap="medium">
45
+ {/* Its first message says what it is and what it will do. */}
46
+ <Paragraph measure="none">I am {reviewerName}, the agent that checks changes before they merge. I am reviewing the fix to the Terms link now, and I will post what I find here.</Paragraph>
47
+ <Paragraph size="caption" tone="secondary" measure="none">If the review needs a decision and nobody answers by 5:00 PM, I cancel the review and say so here. Nothing merges.</Paragraph>
48
+ </Stack>
49
+ </Message>
50
+ </Stack>
51
+ </Stack>
52
+ </Center>);
53
+ }
@@ -0,0 +1 @@
1
+ export default function AgentHandoffToPerson(): import("react").JSX.Element;