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,500 @@
1
+ # Run that stopped short
2
+
3
+ The agent's run stopped before the end: one step failed, or the run reached a limit of steps, time or budget with work left.
4
+
5
+ For: an agent
6
+
7
+ ## Do
8
+
9
+ - Follow the rule 'An agent that stops short says what it finished and what is left'.
10
+ - Use this case when a run has steps that can be tried again. The case 'Agent at work' points here for a run that fails or stops at a limit.
11
+ - Keep the run's progress row from the case 'Agent at work', with its `StepList` still on screen when the run stops.
12
+ - Mark each step done, failed or cancelled, and the steps not started as waiting. `StepList` draws a mark and a word for each, so color is never the only sign.
13
+ - Say why in the `detail` of the step that stopped: 'Could not save planTable.tsx. Another change was saving it at the same time.'
14
+ - Say under the list what is done and whether anything changed: '2 of 4 steps are done. No files were changed after step 2.' Take it from the server's answer.
15
+ - Give that line `role="status"`, so a screen reader hears it once when the run stops.
16
+ - Move focus to the row's first Button when the run stops, since 'Stop' had focus and is gone.
17
+ - Offer 'Stop Here' and then 'Try Step Again' as the primary Button when one step failed and can run again.
18
+ - Run only the failed step and the ones after it on 'Try Step Again'. The steps that are done stay done.
19
+ - Offer 'Stop Here' and then 'Continue' as the primary Button when the person can lift the limit. Say what 'Continue' does: 'Continue lets this run go past the budget cap.'
20
+ - Offer 'Upgrade to Pro' in place of 'Continue' when the limit is the plan's, as the case 'Upgrade prompt' says, to a person who can upgrade.
21
+ - Say who can lift the limit when the person cannot, in the words of the case 'Composer at a limit': 'Ask a workspace admin to raise the budget cap.'
22
+ - Show how long the run waits for an answer: 'Waits 10 more minutes, then stops here.' Then mark the steps left cancelled and say so in the thread.
23
+ - Mark the steps that will not run cancelled after 'Stop Here', and say what was left undone.
24
+ - Move focus to 'Stop' when the run goes on, and to the message box when the row's Buttons go away.
25
+
26
+ ## Don't
27
+
28
+ - Do not start again from step one when a person asks to retry.
29
+ - Do not end with only 'Something went wrong', or report the stop only in a toast away from the row.
30
+ - Do not open an upgrade Modal in the thread when a run reaches a limit.
31
+ - Do not hide the steps that are done.
32
+ - Do not show 'Continue' to someone who cannot lift the limit.
33
+
34
+ ## Option: A step failed
35
+
36
+ Use when: One step failed and can be tried again.
37
+
38
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `Message`, `Paragraph`, `Stack`, `StepList`, `Tag`, `TimeStamp`, `UserImage`
39
+
40
+ ```tsx
41
+ 'use client';
42
+ import { useEffect, useRef, useState } from 'react';
43
+ import { Bot } from 'lucide-react';
44
+ import Message from 'oneslash-design-system/components/message';
45
+ import UserImage from 'oneslash-design-system/components/userImage';
46
+ import Tag from 'oneslash-design-system/components/tag';
47
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
48
+ import Heading from 'oneslash-design-system/components/heading';
49
+ import Paragraph from 'oneslash-design-system/components/paragraph';
50
+ import Button from 'oneslash-design-system/components/button';
51
+ import StepList, { type StepListStep } from 'oneslash-design-system/components/stepList';
52
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
53
+
54
+ type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
55
+
56
+ const agentName = 'Acme Agent';
57
+
58
+ const request = { from: 'Dana Lee', at: new Date('2026-11-16T14:30:00Z'), text: 'Can you add the Business plan to the pricing page and open a pull request?' };
59
+ const runStartedAt = new Date('2026-11-16T14:31:00Z');
60
+
61
+ const plan = [
62
+ 'Read the pricing page',
63
+ 'Add the Business plan to plans.json',
64
+ 'Update the plan table',
65
+ 'Open a pull request',
66
+ ];
67
+
68
+ // The step that fails the first time, and why. A real app takes both from the server's answer.
69
+ const failingStep = 2;
70
+ const failReason = 'Could not save planTable.tsx. Another change was saving it at the same time.';
71
+
72
+ const reply = 'The Business plan is on the pricing page, and the pull request is open for review.';
73
+
74
+ type Phase = 'running' | 'stopping' | 'failed' | 'stopped' | 'done';
75
+
76
+ function secondsLine(seconds: number) {
77
+ return `Working for ${seconds} ${seconds === 1 ? 'second' : 'seconds'}`;
78
+ }
79
+
80
+ // The agent's marks, as the rule 'An agent says what it is' says.
81
+ function agentMeta(at: Date) {
82
+ return (
83
+ <>
84
+ <Tag variant="contained" size="small" label="Agent" />
85
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
86
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
87
+ </>
88
+ );
89
+ }
90
+
91
+ // `live` is for tests only: the run starts at step 1 and fails at step 3, so focus can be seen to move when it stops.
92
+ export default function AgentRunFailureStepFailed({ live = false }: { live?: boolean } = {}) {
93
+ // Opens on a still of the failed run, so the picture in the docs does not move.
94
+ const [phase, setPhase] = useState<Phase>(live ? 'running' : 'failed');
95
+ const [current, setCurrent] = useState(live ? 0 : failingStep);
96
+ const [seconds, setSeconds] = useState(0);
97
+ const [startedAt, setStartedAt] = useState(runStartedAt);
98
+ const tick = useRef<ReturnType<typeof setInterval>>();
99
+ const step = useRef<ReturnType<typeof setTimeout>>();
100
+ const cancel = useRef<ReturnType<typeof setTimeout>>();
101
+ const firstButton = useRef<Focusable>(null);
102
+ const stopButton = useRef<Focusable>(null);
103
+ // Where focus goes after the next render, once the element it goes to is on screen.
104
+ const focusNext = useRef<() => void>();
105
+ // The failing step fails once. 'Try Step Again' then works.
106
+ const failed = useRef(!live);
107
+ // Whether the run ended on the failed step ('Stop Here') or was stopped while a step ran ('Stop').
108
+ const [endedOnFailure, setEndedOnFailure] = useState(false);
109
+
110
+ // On unmount it stops the run, its clock and the stop request.
111
+ useEffect(() => () => {
112
+ clearInterval(tick.current);
113
+ clearTimeout(step.current);
114
+ clearTimeout(cancel.current);
115
+ }, []);
116
+
117
+ useEffect(() => {
118
+ const move = focusNext.current;
119
+ focusNext.current = undefined;
120
+ move?.();
121
+ });
122
+
123
+ function stopTimers() {
124
+ clearInterval(tick.current);
125
+ clearTimeout(step.current);
126
+ }
127
+
128
+ // Stands in for the agent's run: one step every 1.5 seconds.
129
+ function advance(at: number) {
130
+ step.current = setTimeout(() => {
131
+ if (at === failingStep && !failed.current) {
132
+ failed.current = true;
133
+ stopTimers();
134
+ setPhase('failed');
135
+ // 'Stop' had focus and is gone, so focus goes to the row's first Button.
136
+ focusNext.current = () => firstButton.current?.focus();
137
+ return;
138
+ }
139
+ if (at === plan.length - 1) {
140
+ stopTimers();
141
+ setPhase('done');
142
+ return;
143
+ }
144
+ setCurrent(at + 1);
145
+ advance(at + 1);
146
+ }, 1500);
147
+ }
148
+
149
+ // Runs from `from` on. The steps before it are done and stay done.
150
+ function runFrom(from: number) {
151
+ stopTimers();
152
+ setPhase('running');
153
+ setCurrent(from);
154
+ setSeconds(0);
155
+ setStartedAt(new Date());
156
+ tick.current = setInterval(() => setSeconds((s) => s + 1), 1000);
157
+ advance(from);
158
+ }
159
+
160
+ useEffect(() => {
161
+ // Runs once, on mount.
162
+ if (live) runFrom(0);
163
+ }, []);
164
+
165
+ // Only the failed step and the ones after it run again. 'Stop' takes the place of the Buttons, so it gets focus.
166
+ function tryStepAgain() {
167
+ if (phase !== 'failed') return;
168
+ runFrom(current);
169
+ focusNext.current = () => stopButton.current?.focus();
170
+ }
171
+
172
+ // The run ends where it is. The Buttons go and nothing takes their place: a real app moves focus to the message box.
173
+ function stopHere() {
174
+ if (phase !== 'failed') return;
175
+ setEndedOnFailure(true);
176
+ setPhase('stopped');
177
+ }
178
+
179
+ // Stop asks the server to end the run. The row says it stopped only once the run has ended.
180
+ function stop() {
181
+ if (phase !== 'running') return;
182
+ clearTimeout(step.current);
183
+ setPhase('stopping');
184
+ // Stands in for the request to the server.
185
+ cancel.current = setTimeout(() => {
186
+ clearInterval(tick.current);
187
+ setPhase('stopped');
188
+ }, 1200);
189
+ }
190
+
191
+ // Done steps keep a check, the step that stopped says why, and the steps after it wait, or are cancelled once the run is over.
192
+ const steps: StepListStep[] = plan.map((label, i) => {
193
+ if (i < current) return { label, status: 'done' };
194
+ if (i === current) {
195
+ if (phase === 'failed') return { label, status: 'failed', detail: failReason };
196
+ if (phase === 'stopped') return { label, status: endedOnFailure ? 'failed' : 'cancelled' };
197
+ return { label, status: 'running' };
198
+ }
199
+ return { label, status: phase === 'stopped' ? 'cancelled' : 'waiting' };
200
+ });
201
+
202
+ // A real app takes the count, and what changed, from the server's answer.
203
+ const doneLine = `${current} of ${plan.length} steps are done.`;
204
+ const changedLine = current === 0 ? 'Nothing was changed.' : `No files were changed after step ${current}.`;
205
+ const leftLine = current === plan.length - 1 ? `Step ${plan.length} was not done.` : `Steps ${current + 1} to ${plan.length} were not done.`;
206
+ const statusLine =
207
+ phase === 'failed'
208
+ ? `${doneLine} ${changedLine}`
209
+ : phase === 'stopped'
210
+ ? `Stopped at step ${current + 1}. ${doneLine} ${changedLine} ${leftLine}`
211
+ : doneLine;
212
+
213
+ const working = phase === 'running' || phase === 'stopping';
214
+
215
+ return (
216
+ <Center width="page">
217
+ <Stack gap="large">
218
+ <Heading level={1} size="h5">Launch plan</Heading>
219
+ {/* A real app gives the list that holds the rows role="log". */}
220
+ <Stack gap="small">
221
+ <Message
222
+ aria-label={request.from}
223
+ avatar={<UserImage userHandle={request.from} decorative />}
224
+ name={request.from}
225
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
226
+ >
227
+ <Paragraph measure="none">{request.text}</Paragraph>
228
+ </Message>
229
+ <Message
230
+ aria-label={`${agentName}, agent`}
231
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
232
+ name={agentName}
233
+ meta={agentMeta(startedAt)}
234
+ footer={
235
+ working ? (
236
+ // The only Stop, on the row for the whole run. It shows loading while the run is stopping.
237
+ <Cluster>
238
+ <Button ref={stopButton} size="small" type="secondary" state="enabled" label="Stop" loading={phase === 'stopping'} onClickButton={stop} />
239
+ </Cluster>
240
+ ) : phase === 'failed' ? (
241
+ <Stack gap="small">
242
+ {/* The product sets the waiting time and counts it down. When it is up, the steps left are cancelled. */}
243
+ <Paragraph size="caption" tone="secondary" measure="none">Waits 10 more minutes, then stops here.</Paragraph>
244
+ <Cluster gap="small">
245
+ <Button ref={firstButton} size="small" type="tertiary" state="enabled" label="Stop Here" onClickButton={stopHere} />
246
+ <Button size="small" type="primary" state="enabled" label="Try Step Again" onClickButton={tryStepAgain} />
247
+ </Cluster>
248
+ </Stack>
249
+ ) : undefined
250
+ }
251
+ >
252
+ {phase === 'done' ? (
253
+ // The run is over: the row is the reply, and Stop is gone. A real app moves focus to the message box.
254
+ <Paragraph measure="none">{reply}</Paragraph>
255
+ ) : (
256
+ <Stack gap="medium">
257
+ {working && <Paragraph size="caption" tone="secondary" measure="none">{secondsLine(seconds)}</Paragraph>}
258
+ <StepList aria-label="Acme Agent's steps" steps={steps} />
259
+ {/* A polite live region, on the page before its text changes, so the stop is heard once. */}
260
+ <Paragraph role="status" measure="none">{statusLine}</Paragraph>
261
+ </Stack>
262
+ )}
263
+ </Message>
264
+ </Stack>
265
+ </Stack>
266
+ </Center>
267
+ );
268
+ }
269
+ ```
270
+
271
+ ## Option: A limit was reached
272
+
273
+ Use when: The run stopped at a limit of steps, time or budget with work left.
274
+
275
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Heading`, `Message`, `Paragraph`, `Stack`, `StepList`, `Tag`, `TimeStamp`, `UserImage`
276
+
277
+ ```tsx
278
+ 'use client';
279
+ import { useEffect, useRef, useState } from 'react';
280
+ import { Bot } from 'lucide-react';
281
+ import Message from 'oneslash-design-system/components/message';
282
+ import UserImage from 'oneslash-design-system/components/userImage';
283
+ import Tag from 'oneslash-design-system/components/tag';
284
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
285
+ import Heading from 'oneslash-design-system/components/heading';
286
+ import Paragraph from 'oneslash-design-system/components/paragraph';
287
+ import Button from 'oneslash-design-system/components/button';
288
+ import Alert from 'oneslash-design-system/components/alert';
289
+ import StepList, { type StepListStep } from 'oneslash-design-system/components/stepList';
290
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
291
+
292
+ type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
293
+
294
+ // A real app reads this from the person's role. Only an admin can let a run go past the budget cap.
295
+ const canLift = true;
296
+
297
+ const agentName = 'Acme Agent';
298
+
299
+ const request = { from: 'Dana Lee', at: new Date('2026-11-16T14:30:00Z'), text: 'Can you add French and German versions of the pricing page and open a pull request?' };
300
+ const runStartedAt = new Date('2026-11-16T14:31:00Z');
301
+
302
+ const plan = [
303
+ 'Read the pricing page',
304
+ 'Add the French page',
305
+ 'Add the German page',
306
+ 'Open a pull request',
307
+ ];
308
+
309
+ // Where the run stopped, and why. A real app takes both from the server's answer.
310
+ const limitStep = 2;
311
+ const limitReason = "Stopped here. The workspace reached its $200.00 budget cap for November.";
312
+
313
+ const reply = 'The French and German pages are ready, and the pull request is open for review.';
314
+
315
+ type Phase = 'limit' | 'running' | 'stopping' | 'stopped' | 'done';
316
+
317
+ function secondsLine(seconds: number) {
318
+ return `Working for ${seconds} ${seconds === 1 ? 'second' : 'seconds'}`;
319
+ }
320
+
321
+ // The agent's marks, as the rule 'An agent says what it is' says.
322
+ function agentMeta(at: Date) {
323
+ return (
324
+ <>
325
+ <Tag variant="contained" size="small" label="Agent" />
326
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
327
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
328
+ </>
329
+ );
330
+ }
331
+
332
+ export default function AgentRunFailureLimitReached() {
333
+ // Opens on a still of the run stopped at the budget cap, so the picture in the docs does not move.
334
+ const [phase, setPhase] = useState<Phase>('limit');
335
+ const [current, setCurrent] = useState(limitStep);
336
+ const [seconds, setSeconds] = useState(0);
337
+ const [startedAt, setStartedAt] = useState(runStartedAt);
338
+ // Whether the run ended at the limit ('Stop Here') or was stopped while a step ran ('Stop').
339
+ const [endedAtLimit, setEndedAtLimit] = useState(false);
340
+ const tick = useRef<ReturnType<typeof setInterval>>();
341
+ const step = useRef<ReturnType<typeof setTimeout>>();
342
+ const cancel = useRef<ReturnType<typeof setTimeout>>();
343
+ const stopButton = useRef<Focusable>(null);
344
+ // Where focus goes after the next render, once the element it goes to is on screen.
345
+ const focusNext = useRef<() => void>();
346
+
347
+ // On unmount it stops the run, its clock and the stop request.
348
+ useEffect(() => () => {
349
+ clearInterval(tick.current);
350
+ clearTimeout(step.current);
351
+ clearTimeout(cancel.current);
352
+ }, []);
353
+
354
+ useEffect(() => {
355
+ const move = focusNext.current;
356
+ focusNext.current = undefined;
357
+ move?.();
358
+ });
359
+
360
+ function stopTimers() {
361
+ clearInterval(tick.current);
362
+ clearTimeout(step.current);
363
+ }
364
+
365
+ // Stands in for the agent's run: one step every 1.5 seconds.
366
+ function advance(at: number) {
367
+ step.current = setTimeout(() => {
368
+ if (at === plan.length - 1) {
369
+ stopTimers();
370
+ setPhase('done');
371
+ return;
372
+ }
373
+ setCurrent(at + 1);
374
+ advance(at + 1);
375
+ }, 1500);
376
+ }
377
+
378
+ // The run goes on from the step that stopped. The steps that are done stay done.
379
+ // 'Stop' takes the place of the Buttons, so it gets focus.
380
+ function continueRun() {
381
+ if (phase !== 'limit' || !canLift) return;
382
+ setPhase('running');
383
+ setSeconds(0);
384
+ setStartedAt(new Date());
385
+ tick.current = setInterval(() => setSeconds((s) => s + 1), 1000);
386
+ advance(current);
387
+ focusNext.current = () => stopButton.current?.focus();
388
+ }
389
+
390
+ // The run ends where it is. The Buttons go and nothing takes their place: a real app moves focus to the message box.
391
+ function stopHere() {
392
+ if (phase !== 'limit') return;
393
+ setEndedAtLimit(true);
394
+ setPhase('stopped');
395
+ }
396
+
397
+ // Stop asks the server to end the run. The row says it stopped only once the run has ended.
398
+ function stop() {
399
+ if (phase !== 'running') return;
400
+ clearTimeout(step.current);
401
+ setPhase('stopping');
402
+ // Stands in for the request to the server.
403
+ cancel.current = setTimeout(() => {
404
+ clearInterval(tick.current);
405
+ setPhase('stopped');
406
+ }, 1200);
407
+ }
408
+
409
+ // Done steps keep a check, the step that stopped says why, and the steps after it wait, or are cancelled once the run is over.
410
+ const steps: StepListStep[] = plan.map((label, i) => {
411
+ if (i < current) return { label, status: 'done' };
412
+ if (i === current) {
413
+ if (phase === 'limit' || (phase === 'stopped' && endedAtLimit)) return { label, status: 'cancelled', detail: limitReason };
414
+ if (phase === 'stopped') return { label, status: 'cancelled' };
415
+ return { label, status: 'running' };
416
+ }
417
+ return { label, status: phase === 'stopped' ? 'cancelled' : 'waiting' };
418
+ });
419
+
420
+ // A real app takes the count, and what changed, from the server's answer.
421
+ const doneLine = `${current} of ${plan.length} steps are done.`;
422
+ const changedLine = current === limitStep ? 'Only the French page was added.' : `Nothing was changed after step ${current}.`;
423
+ const leftLine = current === plan.length - 1 ? `Step ${plan.length} was not done.` : `Steps ${current + 1} to ${plan.length} were not done.`;
424
+ const statusLine =
425
+ phase === 'limit'
426
+ ? `${doneLine} ${changedLine}`
427
+ : phase === 'stopped'
428
+ ? `Stopped at step ${current + 1}. ${doneLine} ${changedLine} ${leftLine}`
429
+ : doneLine;
430
+
431
+ const working = phase === 'running' || phase === 'stopping';
432
+
433
+ return (
434
+ <Center width="page">
435
+ <Stack gap="large">
436
+ <Heading level={1} size="h5">Launch plan</Heading>
437
+ {/* A real app gives the list that holds the rows role="log". */}
438
+ <Stack gap="small">
439
+ <Message
440
+ aria-label={request.from}
441
+ avatar={<UserImage userHandle={request.from} decorative />}
442
+ name={request.from}
443
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
444
+ >
445
+ <Paragraph measure="none">{request.text}</Paragraph>
446
+ </Message>
447
+ <Message
448
+ aria-label={`${agentName}, agent`}
449
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
450
+ name={agentName}
451
+ meta={agentMeta(startedAt)}
452
+ footer={
453
+ working ? (
454
+ // The only Stop, on the row for the whole run. It shows loading while the run is stopping.
455
+ <Cluster>
456
+ <Button ref={stopButton} size="small" type="secondary" state="enabled" label="Stop" loading={phase === 'stopping'} onClickButton={stop} />
457
+ </Cluster>
458
+ ) : phase === 'limit' ? (
459
+ // In the row, never an upgrade Modal over the thread.
460
+ <Stack gap="small">
461
+ {/* The product sets the waiting time and counts it down. When it is up, the steps left are cancelled. */}
462
+ <Paragraph size="caption" tone="secondary" measure="none">Waits 10 more minutes, then stops here.</Paragraph>
463
+ {canLift ? (
464
+ <Paragraph size="caption" tone="secondary" measure="none">Continue lets this run go past the budget cap. The cap stays $200.00 for everything else.</Paragraph>
465
+ ) : (
466
+ // This person cannot lift the limit, so it says who can, in the words of the case 'Composer at a limit'.
467
+ <Alert
468
+ type="warning"
469
+ variant="inline"
470
+ autoDismiss={false}
471
+ message="You've used all of this month's $200.00 budget cap."
472
+ secondMessage="It starts again on Dec 1. Ask a workspace admin to raise the budget cap so Acme Agent can finish."
473
+ />
474
+ )}
475
+ <Cluster gap="small">
476
+ <Button size="small" type="tertiary" state="enabled" label="Stop Here" onClickButton={stopHere} />
477
+ {canLift && <Button size="small" type="primary" state="enabled" label="Continue" onClickButton={continueRun} />}
478
+ </Cluster>
479
+ </Stack>
480
+ ) : undefined
481
+ }
482
+ >
483
+ {phase === 'done' ? (
484
+ // The run is over: the row is the reply, and Stop is gone. A real app moves focus to the message box.
485
+ <Paragraph measure="none">{reply}</Paragraph>
486
+ ) : (
487
+ <Stack gap="medium">
488
+ {working && <Paragraph size="caption" tone="secondary" measure="none">{secondsLine(seconds)}</Paragraph>}
489
+ <StepList aria-label="Acme Agent's steps" steps={steps} />
490
+ {/* A polite live region, on the page before its text changes, so the stop is heard once. */}
491
+ <Paragraph role="status" measure="none">{statusLine}</Paragraph>
492
+ </Stack>
493
+ )}
494
+ </Message>
495
+ </Stack>
496
+ </Stack>
497
+ </Center>
498
+ );
499
+ }
500
+ ```
@@ -2,6 +2,8 @@
2
2
 
3
3
  The agent posts in a thread where people also write, or replies to a person.
4
4
 
5
+ For: an agent
6
+
5
7
  ## Answer
6
8
 
7
9
  Every agent message has marks no person's message has. It shows an icon avatar instead of a photo, and the agent's own name. When the product knows which model wrote the reply, it shows the model name in small text next to the time. An agent the workspace connects from outside gets a plain bot icon, not the product's logo.
@@ -0,0 +1,27 @@
1
+ # An agent that stops short says what it finished and what is left
2
+
3
+ An agent is partway through a run of several steps when the run fails, is stopped, or hits a limit.
4
+
5
+ For: an agent
6
+
7
+ ## Answer
8
+
9
+ The agent says which steps are done, which one stopped and why, and which were not started. It offers the next move: try the step again, continue, or leave it. Work that was done stays done, and the agent says so. It also says whether anything was changed.
10
+
11
+ ## Why
12
+
13
+ A person who reads only 'Something went wrong' cannot tell what changed, so they redo work or undo work that was fine. Starting again from step one repeats changes that were already made.
14
+
15
+ ## Do
16
+
17
+ - Keep the step list on screen, with each step marked done, failed or cancelled, or not started.
18
+ - Say the reason in plain words: 'Stopped at step 3. The workspace reached its budget cap.'
19
+ - Say whether anything was changed, and what.
20
+ - Offer the next move: try the stopped step again, continue, or leave it.
21
+ - Retry from the step that stopped, and keep the steps that are done.
22
+
23
+ ## Don't
24
+
25
+ - Do not end with only 'Something went wrong'.
26
+ - Do not start again from step one when a person asks to retry.
27
+ - Do not hide finished steps.
@@ -2,6 +2,8 @@
2
2
 
3
3
  An admin sets which model the agent uses, how it picks one, what it should know about the team and how much it may spend.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A setting saves in place, or with one Save Button'. Keep the choices and the two groups of fields in their own `SettingsSection`s.
@@ -2,6 +2,8 @@
2
2
 
3
3
  The agent is working on a request and its reply is not ready yet.
4
4
 
5
+ For: an agent
6
+
5
7
  ## Answer
6
8
 
7
9
  While it works, the agent shows a live row in the thread, where its reply will appear: its name, the model, the seconds so far, the steps it has finished with a check mark, and the step it is on now in plain words, such as 'Reading file'. A Stop button stays on that row for the whole run. When the run is stopped, the agent posts a short note that it stopped.
@@ -2,6 +2,8 @@
2
2
 
3
3
  The agent answers from things it read: documents, files, chat, tasks, or a connected service such as a code host or a design tool.
4
4
 
5
+ For: an agent
6
+
5
7
  ## Answer
6
8
 
7
9
  Under the reply, the agent lists what it used. A small tag names the kinds of source, such as 'From Chat · Knowledge base', and one card per source shows its title, its kind and where it lives. Each card opens the source. A reply that used no sources shows no sources section. When the reply read only the messages already on screen above it, the Tag alone is enough.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person makes keys that let a script or a service use the product as them, and revokes keys they no longer use.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - List each key with its name, the start of the key in the mono face, when it was created and when it was last used. Say 'Never used' when it was not.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A person opens the product and moves between its places, such as Inbox, Tasks and Settings, from every page.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  The agent made a document for the person, such as a plan or a report.
4
4
 
5
+ For: an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Keep the reply to one sentence on what the agent made. Then put the card in the reply's `footer`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A page where a person asks the agent about their work across one or more workspaces, and reads the answers with their sources.
4
4
 
5
+ For: an app, an agent
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the cases 'Conversation starters', 'Scope picker', 'Reply sources' and 'Message composer'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Show the spinner from the first render, before anything else, as `LoadingScreen` in `Center` with `fill`.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A workspace pays for a plan. One page says what it pays for, what it has used, how it pays and what it has paid.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A visitor opens the blog to see what was written lately and to pick a post to read.
4
4
 
5
+ For: a marketing site
6
+
5
7
  ## Do
6
8
 
7
9
  - Use `PageHeader` with `level={1}`: the title 'Blog' is the one level 1 heading, with a `lede` of one sentence about what the blog is for.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A page on a site sits under other pages, and the person needs to see where it is and go back up.
4
4
 
5
+ For: a marketing site, an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Put `Breadcrumb` above the `PageHeader`, from the top level down to this page.
@@ -2,6 +2,8 @@
2
2
 
3
3
  A page shows how a total splits into parts, such as responses by model or comments by project.
4
4
 
5
+ For: an app
6
+
5
7
  ## Do
6
8
 
7
9
  - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
@@ -0,0 +1 @@
1
+ export default function BulkActionsList(): import("react").JSX.Element;