@1agh/maude 2.0.4 → 2.0.8

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 (272) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/closure.ts +156 -16
  3. package/apps/studio/access/filters.ts +39 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/actions/agents.ts +59 -0
  7. package/apps/studio/actions/ctx.ts +3 -0
  8. package/apps/studio/actions/defs/app.ts +12 -0
  9. package/apps/studio/actions/defs/sync.ts +13 -0
  10. package/apps/studio/actions/defs/view.ts +59 -3
  11. package/apps/studio/actions/keymap.gen.ts +35 -0
  12. package/apps/studio/actions/menu.ts +2 -0
  13. package/apps/studio/actions/types.ts +3 -1
  14. package/apps/studio/actions.manifest.json +148 -1
  15. package/apps/studio/actions.parity.json +31 -1
  16. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/ride.ts +2 -1
  20. package/apps/studio/annotations/ui/text-style.ts +1 -1
  21. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  22. package/apps/studio/annotations-layer.tsx +4 -15
  23. package/apps/studio/api.ts +425 -128
  24. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  25. package/apps/studio/artboard-ai-copies.tsx +4 -4
  26. package/apps/studio/artboard-freeze.ts +108 -0
  27. package/apps/studio/artboard-live-gate.tsx +636 -0
  28. package/apps/studio/artboard-live.ts +831 -0
  29. package/apps/studio/artboard-placeholder.ts +197 -0
  30. package/apps/studio/artboard-still-raster.ts +485 -0
  31. package/apps/studio/artboard-still-warmup.ts +221 -0
  32. package/apps/studio/artboard-still.ts +1188 -0
  33. package/apps/studio/artboard-webgl.ts +669 -0
  34. package/apps/studio/asset-placeholder.tsx +237 -132
  35. package/apps/studio/asset-upload-bars.tsx +4 -4
  36. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  37. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  38. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  39. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  40. package/apps/studio/bin/_ds-check.mjs +4 -1
  41. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  42. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  43. package/apps/studio/bin/_import-asset.mjs +2 -1
  44. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  45. package/apps/studio/bin/_perf-probe.mjs +2 -1
  46. package/apps/studio/bin/_perf-shared.mjs +12 -7
  47. package/apps/studio/bin/_pw-launch.mjs +26 -1
  48. package/apps/studio/bin/_studio-verb.mjs +24 -3
  49. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  50. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  51. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  52. package/apps/studio/bin/ds-check.sh +5 -1
  53. package/apps/studio/bin/perf.sh +30 -1
  54. package/apps/studio/bin/server-up.sh +7 -2
  55. package/apps/studio/bin/smoke.sh +19 -0
  56. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  57. package/apps/studio/canvas-build-sandbox.ts +69 -13
  58. package/apps/studio/canvas-camera.ts +90 -0
  59. package/apps/studio/canvas-comment-mount.tsx +9 -9
  60. package/apps/studio/canvas-lib.tsx +289 -44
  61. package/apps/studio/canvas-pages-view.tsx +465 -0
  62. package/apps/studio/canvas-pages.ts +305 -0
  63. package/apps/studio/canvas-rows.ts +62 -0
  64. package/apps/studio/canvas-shell.tsx +62 -16
  65. package/apps/studio/canvas-theme-icons.tsx +41 -0
  66. package/apps/studio/canvas-theme-pill.tsx +15 -6
  67. package/apps/studio/canvas-theme.ts +12 -11
  68. package/apps/studio/client/app.jsx +7 -0
  69. package/apps/studio/client/canvas-url.js +36 -1
  70. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  71. package/apps/studio/client/home/Shelves.jsx +4 -3
  72. package/apps/studio/client/home/home-accounts-model.js +121 -0
  73. package/apps/studio/client/home/home-api.js +6 -0
  74. package/apps/studio/client/home/home-app.jsx +141 -40
  75. package/apps/studio/client/home/home-model.js +172 -6
  76. package/apps/studio/client/home/home.css +169 -5
  77. package/apps/studio/client/home/shell-mode.js +8 -1
  78. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  79. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  80. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  81. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  82. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  83. package/apps/studio/client/hooks/use-project-data.jsx +13 -2
  84. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  85. package/apps/studio/client/index-loader.ts +41 -21
  86. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  87. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  88. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  89. package/apps/studio/client/panels/caps-cache.js +46 -0
  90. package/apps/studio/client/shell/viewport.jsx +66 -22
  91. package/apps/studio/client/tree/tree.jsx +17 -0
  92. package/apps/studio/client/v2/access/access-client.js +2 -0
  93. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  94. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  95. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  96. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  97. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  98. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  99. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  100. package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
  101. package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
  102. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  103. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  104. package/apps/studio/client/v2/code/code-bus.js +5 -0
  105. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  106. package/apps/studio/client/v2/code/code-consent.js +67 -0
  107. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  108. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  109. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  110. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  111. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  112. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  113. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  114. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  115. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  116. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  117. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  118. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  119. package/apps/studio/client/v2/history/git-model.js +3 -1
  120. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  121. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  122. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  123. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  124. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  125. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  126. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  127. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  128. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  129. package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
  130. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  131. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  132. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  133. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  134. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  135. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  136. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  137. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  138. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  139. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  140. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  141. package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
  142. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  143. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  144. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  145. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  146. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  147. package/apps/studio/client/v2/shell/use-account.js +8 -1
  148. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  149. package/apps/studio/collab/persistence.ts +9 -1
  150. package/apps/studio/collab/registry.ts +32 -0
  151. package/apps/studio/collab/room.ts +8 -0
  152. package/apps/studio/comments-overlay.tsx +12 -11
  153. package/apps/studio/config-reload-wire.ts +56 -0
  154. package/apps/studio/config.schema.json +6 -0
  155. package/apps/studio/context.ts +37 -1
  156. package/apps/studio/dist/client.bundle.js +1198 -1198
  157. package/apps/studio/dist/comment-mount.js +2 -2
  158. package/apps/studio/dist/styles.css +1 -1
  159. package/apps/studio/ds/board/board.css +6 -0
  160. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  161. package/apps/studio/ds/board/specimen.tsx +16 -2
  162. package/apps/studio/ds/board/template.ts +39 -19
  163. package/apps/studio/ds/canvas-cli.ts +58 -2
  164. package/apps/studio/ds/check.ts +26 -1
  165. package/apps/studio/ds/cli.ts +14 -4
  166. package/apps/studio/ds/component-list.ts +2 -1
  167. package/apps/studio/ds/convert.ts +34 -6
  168. package/apps/studio/ds/default.ts +6 -1
  169. package/apps/studio/ds/ds-resolver.ts +58 -8
  170. package/apps/studio/ds/ds-verb.ts +13 -0
  171. package/apps/studio/ds/engine.ts +3 -1
  172. package/apps/studio/ds/folder-systems.ts +199 -0
  173. package/apps/studio/ds/pairing-css.ts +2 -1
  174. package/apps/studio/ds/post-build.ts +38 -0
  175. package/apps/studio/ds/rename.ts +10 -3
  176. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  177. package/apps/studio/ds/upgrade-apply.ts +27 -5
  178. package/apps/studio/ds/upgrade-cli.ts +22 -2
  179. package/apps/studio/ds/upgrade-prove.ts +198 -15
  180. package/apps/studio/ds/upgrade-stage.ts +10 -3
  181. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  182. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  183. package/apps/studio/editing/align-bar.tsx +4 -4
  184. package/apps/studio/editing/anchor-report.ts +3 -2
  185. package/apps/studio/editing/artboard-handles.tsx +4 -4
  186. package/apps/studio/editing/corner-dots.tsx +4 -4
  187. package/apps/studio/editing/crop-mode.tsx +4 -4
  188. package/apps/studio/editing/drop-chip.tsx +4 -4
  189. package/apps/studio/editing/empty-report.ts +3 -2
  190. package/apps/studio/editing/focus-model.tsx +4 -4
  191. package/apps/studio/editing/gap-bands.tsx +3 -3
  192. package/apps/studio/editing/hold-rings.tsx +4 -4
  193. package/apps/studio/editing/lock-badge.tsx +3 -3
  194. package/apps/studio/editing/long-page.ts +23 -1
  195. package/apps/studio/editing/nudge.tsx +2 -2
  196. package/apps/studio/editing/page-activity.ts +4 -3
  197. package/apps/studio/editing/paste-bar.tsx +4 -4
  198. package/apps/studio/editing/pen/overlay.tsx +4 -3
  199. package/apps/studio/editing/place-freely.tsx +3 -3
  200. package/apps/studio/editing/reorder-slot.tsx +3 -3
  201. package/apps/studio/editing/selection.tsx +4 -4
  202. package/apps/studio/editing/size-ghost.tsx +4 -4
  203. package/apps/studio/editing/tab-order.tsx +4 -4
  204. package/apps/studio/editing/text-in-place.tsx +4 -4
  205. package/apps/studio/editing/undo-preview.tsx +3 -3
  206. package/apps/studio/equal-spacing-handles.tsx +3 -3
  207. package/apps/studio/frame-clock.ts +89 -0
  208. package/apps/studio/history/trash.ts +6 -0
  209. package/apps/studio/home/accounts.ts +87 -0
  210. package/apps/studio/home/index-reader.ts +24 -2
  211. package/apps/studio/home/routes.ts +19 -0
  212. package/apps/studio/http.ts +80 -34
  213. package/apps/studio/index/ds-usage.ts +4 -1
  214. package/apps/studio/index-cache.ts +272 -0
  215. package/apps/studio/inspect-overlay.tsx +4 -3
  216. package/apps/studio/inspect.ts +7 -2
  217. package/apps/studio/link-chip-overlay.tsx +4 -3
  218. package/apps/studio/measure-overlay.tsx +4 -3
  219. package/apps/studio/present/pointer-dot.tsx +3 -2
  220. package/apps/studio/present/present-media.ts +6 -2
  221. package/apps/studio/present/present-stage.tsx +3 -2
  222. package/apps/studio/preview/preview-camera.tsx +3 -2
  223. package/apps/studio/routes/ds-convert.ts +18 -0
  224. package/apps/studio/routes/sync.ts +176 -0
  225. package/apps/studio/routes/trash.ts +16 -1
  226. package/apps/studio/safe-zones-overlay.tsx +3 -2
  227. package/apps/studio/server.ts +8 -10
  228. package/apps/studio/skip-dirs.ts +103 -47
  229. package/apps/studio/studio-page-host.ts +70 -0
  230. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  231. package/apps/studio/sync/asset-push.ts +146 -23
  232. package/apps/studio/sync/asset-state.ts +3 -2
  233. package/apps/studio/sync/code-module-consent.ts +86 -0
  234. package/apps/studio/sync/file-ledger.ts +24 -0
  235. package/apps/studio/sync/file-membership.ts +28 -3
  236. package/apps/studio/sync/file-plane.ts +497 -61
  237. package/apps/studio/sync/file-pull.ts +304 -33
  238. package/apps/studio/sync/held-deletes.ts +230 -0
  239. package/apps/studio/sync/hub-link.ts +1 -2
  240. package/apps/studio/sync/hubs-config.ts +59 -2
  241. package/apps/studio/sync/index.ts +405 -163
  242. package/apps/studio/sync/journal-client.ts +94 -5
  243. package/apps/studio/sync/pending-deletes.ts +100 -0
  244. package/apps/studio/sync/projection.ts +77 -12
  245. package/apps/studio/sync/seed-progress.ts +104 -3
  246. package/apps/studio/sync/settings.ts +36 -1
  247. package/apps/studio/sync/status.ts +17 -1
  248. package/apps/studio/sync/writer-registry.ts +5 -0
  249. package/apps/studio/text-caret.ts +5 -3
  250. package/apps/studio/thumbs/service.ts +12 -2
  251. package/apps/studio/thumbs/validate.ts +7 -0
  252. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  253. package/apps/studio/ui-prefs-migrate.ts +4 -0
  254. package/apps/studio/use-annotation-resize.tsx +4 -3
  255. package/apps/studio/use-artboard-drag.tsx +3 -2
  256. package/apps/studio/use-element-resize.tsx +7 -6
  257. package/apps/studio/use-grid-track-handles.tsx +5 -4
  258. package/apps/studio/use-selection-set.tsx +64 -4
  259. package/apps/studio/use-spacing-handles.tsx +7 -6
  260. package/apps/studio/video-comp.tsx +75 -39
  261. package/apps/studio/video-play-overlay.tsx +4 -3
  262. package/apps/studio/whats-new.json +99 -0
  263. package/cli/commands/design.mjs +5 -2
  264. package/cli/commands/hub.mjs +10 -1
  265. package/cli/lib/bash-guard.mjs +27 -1
  266. package/cli/lib/design-help.gen.mjs +1 -1
  267. package/cli/lib/design-hook.mjs +20 -0
  268. package/cli/lib/design-link.mjs +42 -17
  269. package/cli/lib/hub-purge.mjs +183 -0
  270. package/cli/lib/studio-locate.mjs +35 -10
  271. package/package.json +8 -8
  272. package/plugins/design/templates/_shell.html +164 -1
@@ -2,9 +2,11 @@
2
2
  // ds-many-linked; V2-1.6 §5.14).
3
3
  //
4
4
  // Mounted once inside DsReviewHost. It
5
- // - reads which systems are linked (`GET /_api/ds/state`) and asks the library whether it moved: on project open
6
- // and every 30 minutes (`POST /_api/ds/library {action:'check'}` — the server bounds it to one hub request per
7
- // system per 30 minutes anyway, and a failure stays quiet until the card is looked at),
5
+ // - reads which systems are linked (`GET /_api/ds/state`) and asks the library whether it moved: on project open,
6
+ // when the window is looked at again and when the shell wrote a system (client/v2/ds/ds-refresh.js — no clock;
7
+ // `POST /_api/ds/library {action:'check'}` — the server bounds it to one hub request per system per
8
+ // 30 minutes anyway). A hub that does not answer (5xx / no answer) is retried after 5 s doubling to 5 min; a
9
+ // refusal (no grant, denied) is an answer, not a failure, and stays quiet until the card is looked at,
8
10
  // - keeps the open linked system's card in a tiny store (library-store.js → the inspector's empty place),
9
11
  // - answers the registry actions through library-bus.js: `ds.library-link`, `ds.library-update`, `ds.library-unlink`,
10
12
  // - runs "Update from <system>? N changes" and then the existing DsReviewSheet, whose Update posts the ONE
@@ -24,7 +26,6 @@ import {
24
26
  changeLines,
25
27
  dialogTitle,
26
28
  isWaiting,
27
- LIBRARY_CHECK_MS,
28
29
  LIBRARY_WORDS,
29
30
  linkedRows,
30
31
  refusalWords,
@@ -38,6 +39,7 @@ import {
38
39
  DsLibraryLink,
39
40
  DsLibraryUnlink,
40
41
  } from './library-card.jsx';
42
+ import { dsRefresh } from './ds-refresh.js';
41
43
  import { onDsLibraryRequest } from './library-bus.js';
42
44
  import { setLibrary, setLibraryActions } from './library-store.js';
43
45
  import { DsReviewSheet } from './review-sheet.jsx';
@@ -139,7 +141,7 @@ export async function linkLibrary(url, grant, fetchImpl = globalThis.fetch) {
139
141
 
140
142
  /**
141
143
  * @param {{ cfg: any, activePath: string | null, toast?: (m: string, ok?: boolean) => void, scope?: string,
142
- * fetchImpl?: typeof fetch, pollMs?: number, delayMs?: number, open?: (url: string) => any, canOpen?: (url: string) => boolean }} props
144
+ * fetchImpl?: typeof fetch, delayMs?: number, open?: (url: string) => any, canOpen?: (url: string) => boolean }} props
143
145
  */
144
146
  export function DsLibraryHost({
145
147
  cfg,
@@ -147,7 +149,6 @@ export function DsLibraryHost({
147
149
  toast,
148
150
  scope = '',
149
151
  fetchImpl,
150
- pollMs = LIBRARY_CHECK_MS,
151
152
  delayMs = OPEN_DELAY_MS,
152
153
  open = openExternal,
153
154
  canOpen = (url) => isDisplayableUrl(url),
@@ -172,48 +173,47 @@ export function DsLibraryHost({
172
173
  const openDs = ownSystemOf(activePath, cfg);
173
174
  const openRow = rows.find((r) => r.ds === openDs) ?? null;
174
175
 
175
- /** The state, then a check of each linked system, then the state again (a check can move `upstreamHead`). */
176
- const refresh = useCallback(async () => {
177
- const first = await loadLinked(f());
178
- setRows(first);
179
- for (const r of first) {
180
- const c = await checkLibrary(r.ds, f());
181
- if (c.ok) {
182
- setAccess((a) => ({ ...a, [r.ds]: 'yes' }));
183
- setErrors((e) => ({ ...e, [r.ds]: null }));
184
- setUsed((u) => ({ ...u, [r.ds]: c.usedBy }));
185
- } else if (c.noGrant || c.relink) {
186
- setAccess((a) => ({ ...a, [r.ds]: c.relink ? 'relink' : 'no' }));
187
- setErrors((e) => ({ ...e, [r.ds]: null }));
188
- } else if (c.code === 'ds-library-unreachable' || c.code === 'unreachable') {
189
- setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.offline }));
190
- } else if (c.code === 'ds-library-denied') {
191
- setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.denied }));
176
+ /** The state, then a check of each linked system, then the state again (a check can move `upstreamHead`).
177
+ * `fx`: the fetch ds-refresh tracks, so a hub that does not answer backs the next read off. */
178
+ const refresh = useCallback(
179
+ async (fx) => {
180
+ const fetchFn = typeof fx === 'function' ? fx : f();
181
+ const first = await loadLinked(fetchFn);
182
+ setRows(first);
183
+ for (const r of first) {
184
+ const c = await checkLibrary(r.ds, fetchFn);
185
+ if (c.ok) {
186
+ setAccess((a) => ({ ...a, [r.ds]: 'yes' }));
187
+ setErrors((e) => ({ ...e, [r.ds]: null }));
188
+ setUsed((u) => ({ ...u, [r.ds]: c.usedBy }));
189
+ } else if (c.noGrant || c.relink) {
190
+ setAccess((a) => ({ ...a, [r.ds]: c.relink ? 'relink' : 'no' }));
191
+ setErrors((e) => ({ ...e, [r.ds]: null }));
192
+ } else if (c.code === 'ds-library-unreachable' || c.code === 'unreachable') {
193
+ setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.offline }));
194
+ } else if (c.code === 'ds-library-denied') {
195
+ setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.denied }));
196
+ }
192
197
  }
193
- }
194
- setRows(await loadLinked(f()));
195
- }, [f]);
198
+ setRows(await loadLinked(fetchFn));
199
+ },
200
+ [f]
201
+ );
196
202
 
197
- // project open, then every 30 min while the window is looked at
198
- // biome-ignore lint/correctness/useExhaustiveDependencies: `refresh` reads the live ref; the poll rate is the trigger
203
+ // project open (after the first paint), then when the window is looked at again or the shell wrote a system —
204
+ // no clock. A refusal (no grant 409, denied 403) is the library's answer; only a 5xx is a failure to back off.
205
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `refresh` reads the live ref; the first read is the trigger
199
206
  useEffect(() => {
200
- let dead = false;
201
- const go = () => {
202
- if (dead) return;
203
- if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
204
- // a project with no converted system has no linked library: nothing to read, nothing to ask
205
- if (!Object.values(live.current.cfg?.dsConverted ?? {}).some((v) => v === true)) return;
206
- refresh();
207
- };
208
- // "on project open" waits for the first paint: the shell's own reads go first
209
- const first = setTimeout(go, delayMs);
210
- const timer = setInterval(go, pollMs);
211
- return () => {
212
- dead = true;
213
- clearTimeout(first);
214
- clearInterval(timer);
215
- };
216
- }, [pollMs, delayMs]);
207
+ const r = dsRefresh(
208
+ async (fx) => {
209
+ // a project with no converted system has no linked library: nothing to read, nothing to ask
210
+ if (!Object.values(live.current.cfg?.dsConverted ?? {}).some((v) => v === true)) return;
211
+ await refresh(fx);
212
+ },
213
+ { fetchImpl: f, firstMs: delayMs, failed: (res) => res.status >= 500 }
214
+ );
215
+ return () => r.stop();
216
+ }, [delayMs]);
217
217
 
218
218
  // the open linked system: how many updates wait (one read of the review per moved head; never for a Mac without a grant)
219
219
  const openHead = openRow?.library?.upstreamHead ?? null;
@@ -7,7 +7,7 @@
7
7
  // folder, the Design system canvas with `ds-dir-*` and seven outlines), then the brief goes to AI through the
8
8
  // composer with origin `ds-make` (the person's gesture: every composer gate applies), and the new canvas opens;
9
9
  // 3 while the open canvas is the Design system canvas of a system that is being made, reads `GET make-state`
10
- // every few seconds and tells the canvas which sections wait, are being drawn or are done
10
+ // when it opens, when the canvas has drawn again and after a write (ds-refresh.js, 2.0.5) and tells the canvas which sections wait, are being drawn or are done
11
11
  // (the dgn message `ds-make-states` — to the canvas origin, never `*`);
12
12
  // 4 the ready card (13 · ds-make-done): "<name> system is ready." with one button that publishes the first
13
13
  // revision and makes it the project's style (`POST … {action:'done'}`, then switch-bus `finishedMaking` so the
@@ -30,15 +30,12 @@ import {
30
30
  systemLabelFor,
31
31
  systemNameFor,
32
32
  } from './make-model.js';
33
- import { pacedInterval } from '../../../editing/page-activity.ts';
34
- import { shellActivity } from '../shell/shell-activity.js';
33
+ import { dsRefresh } from './ds-refresh.js';
35
34
  import { DsMakeSheet } from './make-sheet.jsx';
36
35
  import { finishMaking, makeSystem, readMakeState, uploadLogo } from './make-write.js';
37
36
  import { finishedMaking } from './switch-bus.js';
38
37
  import { ownSystemOf } from './truth-model.js';
39
38
 
40
- export const MAKE_POLL_MS = 2500;
41
-
42
39
  /** How many canvases the project has that a system could learn from (a system's own folder is not one). */
43
40
  export function canvasCount(cfg) {
44
41
  const root = (cfg?.designRel || '.design').replace(/^\/+|\/+$/g, '');
@@ -86,9 +83,9 @@ export function MakeReadyBanner({ label, complete, missing, busy = false, note =
86
83
 
87
84
  /**
88
85
  * @param {{ cfg: any, activePath: string | null, toast?: (m: string) => void, frameFor?: () => (HTMLIFrameElement | null),
89
- * fetchImpl?: typeof fetch, pollMs?: number, openSystem?: (ds: string) => void }} props
86
+ * fetchImpl?: typeof fetch, openSystem?: (ds: string) => void }} props
90
87
  */
91
- export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, pollMs, openSystem }) {
88
+ export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, openSystem }) {
92
89
  const [sheet, setSheet] = useState(null); // { project }
93
90
  const [state, setState] = useState(null);
94
91
  const [finishing, setFinishing] = useState(false);
@@ -172,9 +169,8 @@ export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, pollMs
172
169
  }
173
170
  let off = false;
174
171
  let was = false;
175
- const look = async () => {
176
- if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
177
- const s = await readMakeState(ds, f());
172
+ const look = async (fetchImpl) => {
173
+ const s = await readMakeState(ds, fetchImpl);
178
174
  if (off || !s) return;
179
175
  setState(s);
180
176
  const sections = sectionsToPost(s);
@@ -190,14 +186,16 @@ export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, pollMs
190
186
  /* the frame went away */
191
187
  }
192
188
  };
193
- look();
194
- // 2.0.4: at pace while the window is used, slower while it is only looked at, not at all while hidden
195
- const stopPoll = pacedInterval(look, pollMs ?? MAKE_POLL_MS, shellActivity());
189
+ // 2.0.5: once, then on a write, a redraw of the canvas or a return to the window — never on a clock
190
+ const reads = dsRefresh(look, {
191
+ fetchImpl: f,
192
+ frameFor: () => live.current.frameFor?.() ?? null,
193
+ });
196
194
  return () => {
197
195
  off = true;
198
- stopPoll();
196
+ reads.stop();
199
197
  };
200
- }, [ds, pollMs]);
198
+ }, [ds]);
201
199
 
202
200
  // 4 — "Use as <name>'s style"
203
201
  const label =
@@ -1,7 +1,7 @@
1
1
  // client/v2/ds/off-system-host.jsx — S10.17: the shell's side of the off-system question (13 · ds-edge-suggest).
2
2
  //
3
- // While a canvas that follows a design system is open and the window is looked at, it asks the server for the
4
- // hand-picked colours on the lines changed since the last commit (`GET /_api/ds/off-system`, the S1 rule of S10 Q12)
3
+ // When a canvas that follows a design system opens, has drawn again, or the system was written (ds-refresh.js,
4
+ // 2.0.5 — never on a clock), it asks the server for the hand-picked colours on the lines changed since the last commit (`GET /_api/ds/off-system`, the S1 rule of S10 Q12)
5
5
  // and draws the first one the person has not put away as ONE quiet question. "Use <closest>" is an edit on the element
6
6
  // that carries the colour (`ds.use-nearest`, one ⌘Z); "Add it to the system" is a waiting new colour (`ds.add-colour`);
7
7
  // "Not now" puts the question away until the canvas is opened again. Mounted once, inside the DS review host.
@@ -12,12 +12,10 @@ import { useCallback, useEffect, useRef, useState } from 'react';
12
12
  import { canvasDsSystem } from '../../canvas-url.js';
13
13
  import { EDGE_WORDS, findingKey, nextFinding } from './edge-model.js';
14
14
  import { addColourNow, fetchOffSystem, applyNearestNow } from './edge-write.js';
15
- import { pacedInterval } from '../../../editing/page-activity.ts';
16
- import { shellActivity } from '../shell/shell-activity.js';
15
+ import { dsRefresh } from './ds-refresh.js';
17
16
  import { OffSystemQuestion } from './off-system.jsx';
18
17
  import { openCanvasRel } from './switch-host.jsx';
19
18
 
20
- export const OFF_SYSTEM_POLL_MS = 8000;
21
19
  /** the first look comes a moment after the canvas opens: the question is a courtesy, never in the way */
22
20
  export const OFF_SYSTEM_FIRST_MS = 2500;
23
21
 
@@ -32,7 +30,7 @@ export function DsOffSystemHost({
32
30
  activePath,
33
31
  toast,
34
32
  fetchImpl,
35
- pollMs = OFF_SYSTEM_POLL_MS,
33
+ frameFor,
36
34
  firstMs = OFF_SYSTEM_FIRST_MS,
37
35
  }) {
38
36
  const rel = openCanvasRel(activePath, cfg);
@@ -42,37 +40,38 @@ export function DsOffSystemHost({
42
40
  const [answer, setAnswer] = useState(null);
43
41
  const [, bump] = useState(0);
44
42
  const dismissed = useRef(new Set());
45
- const live = useRef({ toast, fetchImpl });
46
- live.current = { toast, fetchImpl };
43
+ const live = useRef({ toast, fetchImpl, frameFor });
44
+ live.current = { toast, fetchImpl, frameFor };
47
45
  const f = () => live.current.fetchImpl ?? globalThis.fetch;
48
46
  const refreshRef = useRef(null);
49
47
 
50
- // biome-ignore lint/correctness/useExhaustiveDependencies: the canvas and the poll rate are the triggers
48
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the canvas and the first delay are the triggers
51
49
  useEffect(() => {
52
50
  dismissed.current = new Set();
53
51
  setAnswer(null);
54
52
  if (!canvas) return undefined;
55
53
  let dead = false;
56
54
  let seq = 0;
57
- const refresh = async () => {
58
- if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
55
+ const read = async (fetchImpl) => {
59
56
  const n = ++seq;
60
- const got = await fetchOffSystem({ canvas }, f());
57
+ const got = await fetchOffSystem({ canvas }, fetchImpl);
61
58
  if (dead || n !== seq) return;
62
59
  // a refusal or an unreachable studio says nothing: the question is a courtesy, never an error
63
60
  setAnswer(got.ok ? got.answer : null);
64
61
  };
65
- refreshRef.current = refresh;
66
- const first = setTimeout(refresh, firstMs);
67
- // 2.0.4: at pace while the window is used, slower while it is only looked at, not at all while hidden
68
- const stopPoll = pacedInterval(refresh, pollMs, shellActivity());
62
+ // 2.0.5: a moment after the canvas opens, then on a redraw, a write or a return to the window
63
+ const reads = dsRefresh(read, {
64
+ fetchImpl: f,
65
+ firstMs,
66
+ frameFor: () => live.current.frameFor?.() ?? null,
67
+ });
68
+ refreshRef.current = reads.now;
69
69
  return () => {
70
70
  dead = true;
71
- clearTimeout(first);
72
- stopPoll();
71
+ reads.stop();
73
72
  refreshRef.current = null;
74
73
  };
75
- }, [canvas, pollMs, firstMs]);
74
+ }, [canvas, firstMs]);
76
75
 
77
76
  const finding = nextFinding(answer?.findings, dismissed.current);
78
77
  const putAway = useCallback((fd) => {
@@ -342,7 +342,13 @@ export function DsReviewHost({
342
342
  <DsSwitchHost cfg={cfg} activePath={activePath} toast={toast} fetchImpl={fetchImpl} />
343
343
  {/* S10.15b — "Bring <system> up to the schema?": the amber dot, the row's menu and the switch's level-11 refusal */}
344
344
  <DsUpgradeHost cfg={cfg} toast={toast} fetchImpl={fetchImpl} />
345
- <DsOffSystemHost cfg={cfg} activePath={activePath} toast={toast} fetchImpl={fetchImpl} />
345
+ <DsOffSystemHost
346
+ cfg={cfg}
347
+ activePath={activePath}
348
+ toast={toast}
349
+ frameFor={frameFor}
350
+ fetchImpl={fetchImpl}
351
+ />
346
352
  {/* S10.16b — "Make a design system": the three-input sheet, the filling sections, the ready card */}
347
353
  <DsMakeHost
348
354
  cfg={cfg}
@@ -12,19 +12,20 @@
12
12
  //
13
13
  // Every write is the server's to refuse (Can edit on the whole project, rule 12): a refusal comes back as a code
14
14
  // and becomes the person's words. The system comes from the canvas the person has open, never from a message.
15
- // The studio does not push `ds:outside` to the page yet, so the state is read again every few seconds while the
16
- // canvas is on screen (the server only offers a review after its 5 s quiet window, so a faster read gains nothing).
15
+ // The studio does not push `ds:outside` to the page yet, so this is the ONE design-system read on a clock
16
+ // (ds-refresh.js, 2.0.5): once a minute while the window is looked at and the canvas has drawn, plus on a write,
17
+ // a redraw and a return to the window. A file edited outside Maude has no other event.
17
18
 
18
19
  import { useEffect, useRef } from 'react';
19
- import { pacedInterval } from '../../../editing/page-activity.ts';
20
- import { shellActivity } from '../shell/shell-activity.js';
21
20
  import { contrastLine } from './contrast.js';
22
21
  import { fetchBoard } from './token-write.js';
22
+ import { DS_STATE_CHANGED } from './door-write.js';
23
+ import { DS_SLOW_POLL_MS, dsRefresh } from './ds-refresh.js';
23
24
  import { getTruth, setTruth, setTruthActions } from './truth-store.js';
24
25
  import { headValueName, ownSystemOf, refusalWords, TRUTH_WORDS, truthOf } from './truth-model.js';
25
26
  import { bodyOf } from './update-available.jsx';
26
27
 
27
- export const TRUTH_POLL_MS = 6000;
28
+ export const TRUTH_POLL_MS = DS_SLOW_POLL_MS;
28
29
  const JSON_HEADERS = { 'content-type': 'application/json' };
29
30
 
30
31
  async function call(fetchImpl, method, url, body) {
@@ -152,6 +153,7 @@ export function DsTruthHost({
152
153
  }
153
154
  let dead = false;
154
155
  let seq = 0;
156
+ let refresh = async () => {};
155
157
 
156
158
  const tell = (marks) => {
157
159
  const frame = live.current.frameFor?.() ?? null;
@@ -160,10 +162,9 @@ export function DsTruthHost({
160
162
  postDsMarks(frame, marks, origin);
161
163
  };
162
164
 
163
- const refresh = async () => {
164
- if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
165
+ const read = async (fetchImpl) => {
165
166
  const n = ++seq;
166
- const got = await loadTruth(ds, f());
167
+ const got = await loadTruth(ds, fetchImpl);
167
168
  if (dead || n !== seq) return;
168
169
  setTruth(got ? { ...got, busy: false, note: null } : null);
169
170
  tell(got ? got.truth.marks : { outside: [], conflicts: [] });
@@ -176,6 +177,8 @@ export function DsTruthHost({
176
177
  if (dead) return;
177
178
  if (r.ok) {
178
179
  say(done());
180
+ // the other hosts (the system's files, the make state) read again too
181
+ window.dispatchEvent(new Event(DS_STATE_CHANGED));
179
182
  await refresh();
180
183
  } else {
181
184
  setTruth((t) => (t ? { ...t, busy: false, note: r.message } : t));
@@ -213,13 +216,9 @@ export function DsTruthHost({
213
216
  ),
214
217
  });
215
218
 
216
- refresh();
217
- // 2.0.4: at pace while the window is used, slower while it is only looked at, not at all while hidden
218
- const stopPoll = pacedInterval(refresh, pollMs, shellActivity());
219
- const onVisible = () => {
220
- if (document.visibilityState === 'visible') refresh();
221
- };
222
- document.addEventListener('visibilitychange', onVisible);
219
+ // 2.0.5: once, then on a write, a redraw or a return to the window; one slow clock for outside edits
220
+ const reads = dsRefresh(read, { fetchImpl: f, slowMs: pollMs });
221
+ refresh = reads.now;
223
222
  // a canvas that reloaded forgot its marks: when it says it has loaded, tell it again
224
223
  const onLoaded = (e) => {
225
224
  const frame = live.current.frameFor?.() ?? null;
@@ -230,8 +229,7 @@ export function DsTruthHost({
230
229
  window.addEventListener('message', onLoaded);
231
230
  return () => {
232
231
  dead = true;
233
- stopPoll();
234
- document.removeEventListener('visibilitychange', onVisible);
232
+ reads.stop();
235
233
  window.removeEventListener('message', onLoaded);
236
234
  setTruthActions(null);
237
235
  setTruth(null);
@@ -13,6 +13,7 @@
13
13
  import { useCallback, useEffect, useRef, useState } from 'react';
14
14
  import { getPaletteEnv } from '../search/search-env.js';
15
15
  import { canvasesIn } from './switch-host.jsx';
16
+ import { dsRefresh } from './ds-refresh.js';
16
17
  import { onDsUpgradeRequest } from './upgrade-bus.js';
17
18
  import {
18
19
  appliedWords,
@@ -24,8 +25,15 @@ import {
24
25
  import { DsUpgradeSheet } from './upgrade-sheet.jsx';
25
26
 
26
27
  const JSON_HEADERS = { 'content-type': 'application/json' };
27
- /** How often the sheet asks again while the AI or the check is working. */
28
- export const POLL_MS = 1500;
28
+ /**
29
+ * 2.0.5 (#205): the sheet asks again when something it shows may have moved — the window is looked at, the shell
30
+ * wrote a system, the AI run registry moved (`maude:ai-runs`), an action landed (`maude:project-action`) — and
31
+ * after a failed read (5 s doubling to 5 min). The ONE clock left is `TICK_MS`, only while the AI or the check is
32
+ * working with the sheet open: a proof's progress ("2 of 6 canvases checked") has no push. A settled sheet reads
33
+ * on events only.
34
+ */
35
+ export const TICK_MS = 5000;
36
+ export const UPGRADE_EVENTS = ['maude:ai-runs', 'maude:project-action'];
29
37
  /** A request the AI was sent off with is remembered this long, so closing and reopening does not ask twice. */
30
38
  const ASKED_MS = 30 * 60 * 1000;
31
39
  const askedAt = new Map();
@@ -80,9 +88,9 @@ export async function cancelUpgrade(ds, stage, fetchImpl = globalThis.fetch) {
80
88
  }
81
89
 
82
90
  /**
83
- * @param {{ cfg: any, toast?: (m: string) => void, fetchImpl?: typeof fetch, pollMs?: number }} props
91
+ * @param {{ cfg: any, toast?: (m: string) => void, fetchImpl?: typeof fetch, tickMs?: number }} props
84
92
  */
85
- export function DsUpgradeHost({ cfg, toast, fetchImpl, pollMs = POLL_MS }) {
93
+ export function DsUpgradeHost({ cfg, toast, fetchImpl, tickMs = TICK_MS }) {
86
94
  const [sheet, setSheet] = useState(null);
87
95
  const live = useRef({ cfg, toast, fetchImpl, sheet: null });
88
96
  live.current = { cfg, toast, fetchImpl, sheet };
@@ -111,10 +119,10 @@ export function DsUpgradeHost({ cfg, toast, fetchImpl, pollMs = POLL_MS }) {
111
119
  );
112
120
 
113
121
  // biome-ignore lint/correctness/useExhaustiveDependencies: `f` reads the live ref
114
- const refresh = useCallback(async () => {
122
+ const refresh = useCallback(async (fx) => {
115
123
  const s = live.current.sheet;
116
124
  if (!s) return;
117
- const r = await loadUpgradeStatus(s.ds, s.label, f());
125
+ const r = await loadUpgradeStatus(s.ds, s.label, typeof fx === 'function' ? fx : f());
118
126
  // the sheet may have been closed (or reopened on another system) while the answer was on its way
119
127
  if (r.ok && live.current.sheet?.ds === s.ds)
120
128
  setSheet((cur) => (cur && cur.ds === s.ds ? { ...cur, status: r.status } : cur));
@@ -133,13 +141,21 @@ export function DsUpgradeHost({ cfg, toast, fetchImpl, pollMs = POLL_MS }) {
133
141
  })
134
142
  : null;
135
143
 
136
- // while the AI or the check works, ask again; a settled sheet (ask, review, converted) does not poll
144
+ // while the AI or the check works the sheet follows events, with one slow tick for the proof's progress; a
145
+ // settled sheet (ask, review, converted) hears nothing between events
137
146
  const busyView = view?.kind === 'working' || view?.kind === 'proving';
147
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `f` reads the live ref
138
148
  useEffect(() => {
139
149
  if (!busyView) return undefined;
140
- const t = setInterval(refresh, pollMs);
141
- return () => clearInterval(t);
142
- }, [busyView, refresh, pollMs]);
150
+ const r = dsRefresh((fx) => refresh(fx), {
151
+ fetchImpl: () => live.current.fetchImpl ?? globalThis.fetch,
152
+ events: UPGRADE_EVENTS,
153
+ slowMs: tickMs,
154
+ skipFirst: true,
155
+ paused: () => false,
156
+ });
157
+ return () => r.stop();
158
+ }, [busyView, refresh, tickMs]);
143
159
 
144
160
  const close = useCallback(() => setSheet(null), []);
145
161
 
@@ -52,7 +52,13 @@ export function useBranchActions({
52
52
  const [downloading, setDownloading] = useState(false);
53
53
  const [folding, setFolding] = useState('');
54
54
  const [busy, setBusy] = useState(false);
55
- const [err, setErr] = useState('');
55
+ const [err, setErrText] = useState('');
56
+ // 2.0.5 W4 — the error asks for a GitHub sign-in (a 401 / authRequired): the sheet draws the button
57
+ const [errAuth, setErrAuth] = useState(false);
58
+ const setErr = useCallback((text, auth = false) => {
59
+ setErrText(text);
60
+ setErrAuth(!!text && auth);
61
+ }, []);
56
62
  const [refreshing, setRefreshing] = useState(false);
57
63
  const [fetchedAt, setFetchedAt] = useState(0);
58
64
  const [chatGuard, setChatGuard] = useState(null); // { count, verb, action }
@@ -136,10 +142,10 @@ export function useBranchActions({
136
142
  await reloadBranches();
137
143
  } else if (r.timedOut || r.json?.timedOut) {
138
144
  setErr(W.errFetchTimeout);
145
+ } else if (r.status === 401 || r.json?.authRequired) {
146
+ setErr(W.errFetchAuth, true);
139
147
  } else {
140
- setErr(
141
- r.status === 401 || r.json?.authRequired ? W.errFetchAuth : r.json?.error || W.errFetch
142
- );
148
+ setErr(r.json?.error || W.errFetch);
143
149
  }
144
150
  setRefreshing(false);
145
151
  }
@@ -168,11 +174,8 @@ export function useBranchActions({
168
174
  reload(); // added directly (no remote)
169
175
  return;
170
176
  }
171
- setErr(
172
- r.status === 401
173
- ? `Sign in with GitHub to add “${branch}” to ${shared}.`
174
- : j?.error || W.errAdd
175
- );
177
+ if (r.status === 401) setErr(`Sign in with GitHub to add “${branch}” to ${shared}.`, true);
178
+ else setErr(j?.error || W.errAdd);
176
179
  setFolding('');
177
180
  }
178
181
 
@@ -196,6 +199,7 @@ export function useBranchActions({
196
199
  folding,
197
200
  busy,
198
201
  err,
202
+ errAuth,
199
203
  setErr,
200
204
  refreshing,
201
205
  fetchedAt,
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
26
26
  import { useOnline } from '../empty/use-empty-canvas.js';
27
- import { MENU_ACTION_EVENT } from '../shell/menu-runner.js';
27
+ import { MENU_ACTION_EVENT, menuRunner } from '../shell/menu-runner.js';
28
28
  import { useBranchActions } from './branch-actions.js';
29
29
  import { COMPARE_PICTURES_WORDS as CW } from './compare-words.js';
30
30
  import { loadBranches, loadSourceAt } from './git-io.js';
@@ -51,6 +51,7 @@ import {
51
51
  BranchDialog,
52
52
  ChangedList,
53
53
  CopyButton,
54
+ GitHubSignInButton,
54
55
  GitRow,
55
56
  GitSub,
56
57
  GuardDialog,
@@ -138,6 +139,8 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
138
139
  const cloudHistory = git.historySource === 'cloud';
139
140
  const [branches, setBranches] = useState([]);
140
141
  const [banner, setBanner] = useState(null);
142
+ // 2.0.5 W4 — every "Sign in with GitHub to …" line starts the one sign-in (`account.github-signin`)
143
+ const signInGitHub = useCallback(() => menuRunner.run('account.github-signin'), []);
141
144
  const [busy, setBusy] = useState(null);
142
145
  const [dialog, setDialog] = useState(null); // 'save' | 'branch' | 'add'
143
146
  const [resumeDismissed, setResumeDismissed] = useState(false);
@@ -263,6 +266,7 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
263
266
  busy={busy}
264
267
  onGetLatest={getLatest}
265
268
  onDismiss={() => setBanner(null)}
269
+ onSignIn={signInGitHub}
266
270
  />
267
271
 
268
272
  {surface.mode === 'cloud' || surface.mode === 'cloud-saving' ? versions : null}
@@ -334,6 +338,9 @@ function GitBody({ canvas, version, versionRow, role, canView, git, fetchImpl })
334
338
  {actions.err}
335
339
  </p>
336
340
  ) : null}
341
+ {actions.err && actions.errAuth && !dialog ? (
342
+ <GitHubSignInButton onSignIn={signInGitHub} />
343
+ ) : null}
337
344
 
338
345
  {versionRow ? (
339
346
  <>
@@ -496,7 +496,9 @@ export function versionRows(entries, nowMs = Date.now()) {
496
496
  */
497
497
  export function outcomeBanner(kind, res, ok) {
498
498
  if (res?.ok) return ok ?? null;
499
- if (res?.authRequired) return { variant: 'info', text: res.error || GIT_WORDS.signIn };
499
+ // 2.0.5 W4 — the sign-in line carries its button (`account.github-signin`), never only words
500
+ if (res?.authRequired)
501
+ return { variant: 'info', text: res.error || GIT_WORDS.signIn, signIn: true };
500
502
  if (res?.conflict)
501
503
  return kind === 'getLatest'
502
504
  ? {
@@ -91,8 +91,22 @@ function TriCheck({ state, onChange, ariaLabel }) {
91
91
  );
92
92
  }
93
93
 
94
+ /** 2.0.5 W4 — "Sign in with GitHub to …" is a button: the registry's `account.github-signin`. */
95
+ export function GitHubSignInButton({ onSignIn }) {
96
+ return (
97
+ <button
98
+ type="button"
99
+ className="btn btn--sm"
100
+ data-testid="git-signin-github"
101
+ onClick={() => onSignIn()}
102
+ >
103
+ Sign in with GitHub…
104
+ </button>
105
+ );
106
+ }
107
+
94
108
  /** A banner under the fold's head: a result, a warning, or an offer (Get latest after a publish conflict). */
95
- export function Banner({ banner, busy, onGetLatest, onDismiss }) {
109
+ export function Banner({ banner, busy, onGetLatest, onDismiss, onSignIn }) {
96
110
  if (!banner) return null;
97
111
  return (
98
112
  <div
@@ -114,6 +128,7 @@ export function Banner({ banner, busy, onGetLatest, onDismiss }) {
114
128
  {W.getLatest}
115
129
  </button>
116
130
  ) : null}
131
+ {banner.signIn && onSignIn ? <GitHubSignInButton onSignIn={onSignIn} /> : null}
117
132
  </span>
118
133
  <button type="button" className="vh-git-x" aria-label={W.dismiss} onClick={onDismiss}>
119
134
  <StIcon name="x" size={12} />