rvlib-shipkit 2.31.0 → 2.32.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 (384) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +98 -73
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +26 -198
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +25 -23
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +92 -182
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +257 -85
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Checks.ts +0 -14
  67. package/src/cli/cmd_Db.ts +3 -82
  68. package/src/cli/cmd_Home.ts +4 -32
  69. package/src/cli/cmd_Hq.ts +0 -17
  70. package/src/cli/cmd_Releases.ts +57 -4
  71. package/src/cli/cmd_Review.ts +333 -354
  72. package/src/cli/cmd_SocialDrafts.ts +6 -13
  73. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  74. package/src/cli/cmd_Time.ts +1 -1
  75. package/src/cli/cmd_Trailer.ts +1 -1
  76. package/src/cli/inbox-hook-run.ts +5 -23
  77. package/src/cli/registry-heads.ts +5 -55
  78. package/src/cli/registry.ts +1 -5
  79. package/src/cli/review-here.ts +1 -1
  80. package/src/cli.ts +2 -2
  81. package/src/collections/collection-types.ts +1 -1
  82. package/src/collections/review.ts +5 -4
  83. package/src/core/agent-allow-policy.ts +32 -2
  84. package/src/core/agent-env.ts +8 -0
  85. package/src/core/allow-rows.ts +74 -0
  86. package/src/core/check-file-names.ts +19 -106
  87. package/src/core/footprint.ts +17 -13
  88. package/src/core/identities-root.ts +1 -4
  89. package/src/core/layout.ts +1 -2
  90. package/src/core/machine-db.ts +33 -208
  91. package/src/core/machine-layout.ts +14 -127
  92. package/src/core/mask-source.ts +60 -0
  93. package/src/core/memory-watch.ts +17 -14
  94. package/src/core/motherhome.ts +8 -35
  95. package/src/core/one-way-in-policy.ts +0 -3
  96. package/src/core/repo-walk.ts +0 -9
  97. package/src/core/retention.ts +1 -9
  98. package/src/core/retired-checks.ts +2 -0
  99. package/src/core/tmux-policy.ts +1 -1
  100. package/src/core/tree-watch.ts +2 -2
  101. package/src/core/when.ts +7 -45
  102. package/src/gate/discover-checks.ts +42 -32
  103. package/src/gate/gate-checks.ts +21 -131
  104. package/src/gate/pre-commit-discovery.ts +16 -25
  105. package/src/gate/run-check.ts +0 -4
  106. package/src/gate/run-fix.ts +5 -17
  107. package/src/gate/run-fixers.ts +6 -42
  108. package/src/home/app-sign.ts +2 -2
  109. package/src/home/backup-status.ts +52 -92
  110. package/src/home/backup-verdict.ts +2 -2
  111. package/src/home/daemon-jobs.ts +51 -95
  112. package/src/home/database-words.ts +1 -2
  113. package/src/home/databases.ts +9 -25
  114. package/src/home/home-launchd.ts +0 -6
  115. package/src/home/home-paths.ts +8 -4
  116. package/src/home/home-routes.ts +3 -10
  117. package/src/home/home-state.ts +2 -14
  118. package/src/home/inbox-shape.ts +14 -15
  119. package/src/home/inbox.ts +1 -1
  120. package/src/home/machine-repair.ts +102 -103
  121. package/src/home/resume.ts +1 -15
  122. package/src/home/run-daemon.ts +4 -11
  123. package/src/home/space-page.ts +3 -2
  124. package/src/home/supervise.ts +3 -7
  125. package/src/hooks/hook-config.ts +6 -7
  126. package/src/hooks/leak-guard.ts +1 -1
  127. package/src/hooks/run-hooks.ts +0 -5
  128. package/src/hq/daemon-db.ts +8 -8
  129. package/src/hq/door.ts +3 -16
  130. package/src/hq/hq-db.ts +4 -3
  131. package/src/hq/hq-local.ts +1 -2
  132. package/src/hq/hq-store.ts +0 -15
  133. package/src/hq/item-direct.ts +8 -10
  134. package/src/hq/item-fill.ts +37 -0
  135. package/src/hq/kinds/item-gone.ts +7 -10
  136. package/src/hq/kinds/item-msg.ts +12 -18
  137. package/src/hq/kinds/item.ts +13 -19
  138. package/src/hq/kinds/report.ts +3 -4
  139. package/src/hq/owner-switch.ts +3 -3
  140. package/src/hq/report.ts +5 -9
  141. package/src/hq/switch.ts +2 -11
  142. package/src/hq/thread-sync.ts +5 -17
  143. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  144. package/src/http/owner-word.ts +1 -1
  145. package/src/identities/machine.ts +16 -0
  146. package/src/init-repo.ts +0 -1
  147. package/src/ledger/check-stats.ts +6 -5
  148. package/src/ledger/db.ts +2 -4
  149. package/src/ledger/record-kept.ts +117 -48
  150. package/src/ledger/run-log.ts +21 -2
  151. package/src/ledger/slow-tests.ts +96 -0
  152. package/src/ledger/store.ts +3 -86
  153. package/src/ledger/suite-log.ts +8 -2
  154. package/src/media-store/backup/facts.ts +3 -37
  155. package/src/media-store/backup/keys.ts +1 -8
  156. package/src/media-store/backup/manifest.ts +6 -67
  157. package/src/media-store/backup/restore.ts +4 -13
  158. package/src/media-store/backup/retention.ts +13 -1
  159. package/src/media-store/backup/run.ts +6 -267
  160. package/src/media-store/backup/snapshot.ts +2 -38
  161. package/src/media-store/backup/sources.ts +3 -113
  162. package/src/media-store/backup/target-send.ts +5 -29
  163. package/src/media-store/db.ts +8 -7
  164. package/src/media-store/forget-one.ts +1 -1
  165. package/src/media-store/forget.ts +1 -80
  166. package/src/orchestrator/guards.ts +0 -1
  167. package/src/orchestrator/presence.ts +2 -2
  168. package/src/orchestrator/routes.ts +1 -1
  169. package/src/orchestrator/started.ts +0 -9
  170. package/src/orchestrator/talk-key.ts +3 -4
  171. package/src/orchestrator/unheard.ts +1 -1
  172. package/src/recordings/edit.ts +3 -3
  173. package/src/recordings/marks-draw.ts +17 -6
  174. package/src/recordings/marks.ts +120 -9
  175. package/src/reflections/reflections-queue.ts +3 -10
  176. package/src/release/notes.ts +1 -1
  177. package/src/release/public-clean.ts +66 -6
  178. package/src/release/run-bump.ts +11 -0
  179. package/src/release/run-release.ts +4 -0
  180. package/src/releases/from-thread.ts +3 -3
  181. package/src/releases/model.ts +186 -36
  182. package/src/releases/store.ts +13 -3
  183. package/src/releases/validate.ts +83 -0
  184. package/src/repo-config.ts +29 -64
  185. package/src/review/answer-kinds.ts +61 -4
  186. package/src/review/blocked-guard.ts +11 -0
  187. package/src/review/blocked-object.ts +298 -0
  188. package/src/review/cells.ts +116 -229
  189. package/src/review/close.ts +39 -1
  190. package/src/review/doc-save.ts +3 -2
  191. package/src/review/draft-item.ts +1 -1
  192. package/src/review/events.ts +3 -7
  193. package/src/review/expect.ts +23 -39
  194. package/src/review/format.ts +79 -46
  195. package/src/review/glyphs.ts +1 -0
  196. package/src/review/hand-over.ts +3 -3
  197. package/src/review/heard.ts +1 -1
  198. package/src/review/holds-sync.ts +2 -1
  199. package/src/review/inbox-hook.ts +2 -2
  200. package/src/review/inbox-read.ts +39 -33
  201. package/src/review/instruction-guards.ts +12 -0
  202. package/src/review/instructions.ts +0 -1
  203. package/src/review/item-db.ts +13 -43
  204. package/src/review/item-hq.ts +2 -2
  205. package/src/review/item-rows.ts +3 -14
  206. package/src/review/kind-catalog.ts +3 -1
  207. package/src/review/kinds.ts +18 -8
  208. package/src/review/live-view.ts +3 -0
  209. package/src/review/media-kind.ts +1 -1
  210. package/src/review/mentions.ts +1 -2
  211. package/src/review/model.ts +158 -114
  212. package/src/review/move.ts +149 -0
  213. package/src/review/need-threads.ts +3 -2
  214. package/src/review/object-card.ts +11 -0
  215. package/src/review/object-read.ts +6 -1
  216. package/src/review/one-block.ts +1 -1
  217. package/src/review/owner-read.ts +1 -1
  218. package/src/review/phone-push.ts +10 -9
  219. package/src/review/previews.ts +32 -4
  220. package/src/review/push.ts +2 -2
  221. package/src/review/recap.ts +129 -0
  222. package/src/review/referring.ts +6 -3
  223. package/src/review/reflection-object.ts +4 -3
  224. package/src/review/routes.ts +49 -19
  225. package/src/review/secret-route.ts +3 -2
  226. package/src/review/settle.ts +0 -6
  227. package/src/review/snooze.ts +5 -3
  228. package/src/review/speaker.ts +68 -0
  229. package/src/review/start-title.ts +19 -0
  230. package/src/review/store.ts +86 -59
  231. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  232. package/src/review/thread-md.ts +35 -14
  233. package/src/review/thread-state.ts +798 -0
  234. package/src/review/threads.ts +29 -347
  235. package/src/review/traces.ts +104 -7
  236. package/src/review/trailer-item.ts +1 -1
  237. package/src/review/unit.ts +7 -9
  238. package/src/review/verdict-items.ts +12 -10
  239. package/src/review/view-layout.ts +25 -1
  240. package/src/review/watch-feed.ts +1 -2
  241. package/src/review/working-guards.ts +2 -3
  242. package/src/rules/untrack-generated.ts +1 -15
  243. package/src/secrets/lapse.ts +2 -1
  244. package/src/serve/hub-app/advisor-app.tsx +4 -4
  245. package/src/serve/hub-app/advisor-face.tsx +9 -3
  246. package/src/serve/hub-app/advisor-host.ts +27 -27
  247. package/src/serve/hub-app/advisors-model.ts +17 -8
  248. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  249. package/src/serve/hub-app/advisors-st.ts +15 -14
  250. package/src/serve/hub-app/advisors-view.tsx +13 -11
  251. package/src/serve/hub-app/app-bridge.ts +23 -3
  252. package/src/serve/hub-app/asks-page.tsx +1 -1
  253. package/src/serve/hub-app/auto-text.tsx +71 -16
  254. package/src/serve/hub-app/check-view.tsx +0 -8
  255. package/src/serve/hub-app/controls.css +14 -3
  256. package/src/serve/hub-app/database-view.tsx +1 -2
  257. package/src/serve/hub-app/git-view.tsx +3 -1
  258. package/src/serve/hub-app/hub.css +12 -5
  259. package/src/serve/hub-app/icons.tsx +1 -1
  260. package/src/serve/hub-app/inbox-view.tsx +1 -2
  261. package/src/serve/hub-app/live-sources.ts +2 -2
  262. package/src/serve/hub-app/main-panel.tsx +2 -1
  263. package/src/serve/hub-app/panel-repo.ts +0 -9
  264. package/src/serve/hub-app/pic.tsx +29 -12
  265. package/src/serve/hub-app/polled.ts +16 -2
  266. package/src/serve/hub-app/recordings-st.ts +23 -2
  267. package/src/serve/hub-app/recordings-view.tsx +68 -10
  268. package/src/serve/hub-app/ref-pill.ts +1 -1
  269. package/src/serve/hub-app/repo-st.ts +1 -2
  270. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  271. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  272. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  273. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  274. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  275. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  276. package/src/serve/hub-app/review/kit.tsx +4 -11
  277. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  278. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  279. package/src/serve/hub-app/review/line-window.ts +4 -1
  280. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  281. package/src/serve/hub-app/review/live-view.tsx +57 -1
  282. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  283. package/src/serve/hub-app/review/question-views.tsx +181 -54
  284. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  285. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  286. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  287. package/src/serve/hub-app/review/review-host.ts +2 -2
  288. package/src/serve/hub-app/review/review-kit.ts +17 -11
  289. package/src/serve/hub-app/review/review-list.tsx +23 -31
  290. package/src/serve/hub-app/review/review-st.ts +30 -40
  291. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  292. package/src/serve/hub-app/review/review-views.tsx +124 -68
  293. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  294. package/src/serve/hub-app/review/start-st.ts +2 -5
  295. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  296. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  297. package/src/serve/hub-app/review/thread-st.ts +372 -201
  298. package/src/serve/hub-app/review/tone-bar.tsx +126 -0
  299. package/src/serve/hub-app/review/tones.ts +35 -0
  300. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  301. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  302. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  303. package/src/serve/hub-app/review.css +180 -106
  304. package/src/serve/hub-app/search-view.tsx +1 -1
  305. package/src/serve/hub-app/social/social-model.ts +0 -4
  306. package/src/serve/hub-app/source-acts.ts +2 -1
  307. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  308. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  309. package/src/serve/hub-app/thread-row.tsx +3 -4
  310. package/src/serve/hub-app/tree-build.ts +0 -4
  311. package/src/serve/hub-app/urls-view.tsx +2 -1
  312. package/src/serve/hub-app/view-layout.css +13 -3
  313. package/src/serve/hub-app/wikis-view.tsx +5 -2
  314. package/src/serve/hub-runtime.ts +7 -37
  315. package/src/serve/project-gutter-route.ts +6 -2
  316. package/src/serve/read-thread.ts +20 -2
  317. package/src/serve/read-worker.ts +9 -1
  318. package/src/serve/record-pages.ts +46 -0
  319. package/src/serve/serve-hub.ts +2 -2
  320. package/src/serve/terminal-host.ts +1 -1
  321. package/src/serve/terminal-route.ts +1 -3
  322. package/src/serve/tracked-watch.ts +1 -3
  323. package/src/setup-house.ts +2 -2
  324. package/src/shipkit-files.ts +1 -1
  325. package/src/shipkit.ts +1 -6
  326. package/src/shot/film-box.ts +0 -20
  327. package/src/social/drafts.ts +1 -1
  328. package/src/social/kinds.ts +6 -29
  329. package/src/social/load.ts +2 -2
  330. package/src/social/post-object.ts +3 -2
  331. package/src/social/release-stage.ts +1 -1
  332. package/src/social/stage.ts +2 -2
  333. package/src/stores/model.ts +4 -0
  334. package/src/stores/routes.ts +11 -3
  335. package/src/suite/judge-suites.ts +58 -0
  336. package/src/suite/red-alone.ts +54 -18
  337. package/src/suite/runner-shapes.ts +2 -2
  338. package/src/suite/suite-cli.ts +67 -14
  339. package/src/suite/test-units.ts +2 -1
  340. package/src/urls/fill.ts +1 -1
  341. package/src/urls/places.ts +1 -2
  342. package/src/vault/vault-config.ts +2 -2
  343. package/src/vault/vault-init.ts +1 -5
  344. package/src/wiki/graph-page.ts +14 -2
  345. package/src/advisors/copy-truth.ts +0 -49
  346. package/src/advisors/door-child.ts +0 -112
  347. package/src/advisors/door-serve.ts +0 -52
  348. package/src/advisors/door.ts +0 -118
  349. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  350. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  351. package/src/checks/SK048-one-local-file.check.ts +0 -36
  352. package/src/core/config-rewrite.ts +0 -111
  353. package/src/core/daemon-port.ts +0 -10
  354. package/src/core/legacy-shapes.ts +0 -263
  355. package/src/core/migrate-layout.ts +0 -638
  356. package/src/core/port-check-cli.ts +0 -52
  357. package/src/core/port-check-file.ts +0 -295
  358. package/src/core/port-check-files.ts +0 -31
  359. package/src/gate/discover-legacy-checks.ts +0 -26
  360. package/src/home/home-move.ts +0 -527
  361. package/src/home/machine-fold.ts +0 -810
  362. package/src/hq/item-shapes.ts +0 -54
  363. package/src/hq/kinds/items-read.ts +0 -4
  364. package/src/media-store/backup/daemon.ts +0 -220
  365. package/src/media-store/backup/kept.ts +0 -241
  366. package/src/media-store/backup/prune.ts +0 -359
  367. package/src/media-store/backup/secret.ts +0 -88
  368. package/src/media-store/backup/ssh-space.ts +0 -202
  369. package/src/media-store/backup/watch.ts +0 -117
  370. package/src/review/band.ts +0 -182
  371. package/src/review/folders.ts +0 -216
  372. package/src/review/hook-ask.ts +0 -58
  373. package/src/review/role.ts +0 -48
  374. package/src/review/thread-fold.ts +0 -64
  375. package/src/review/wait.ts +0 -91
  376. package/src/rules/rule.ts +0 -43
  377. package/src/serve/hook-thread.ts +0 -37
  378. package/src/serve/hook-work.ts +0 -92
  379. package/src/serve/hook-worker.ts +0 -57
  380. package/src/serve/hub-app/review/dock.tsx +0 -147
  381. package/src/serve/hub-app/review/faces.tsx +0 -18
  382. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  383. package/src/serve/hub-app/review/review-board.tsx +0 -48
  384. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,17 +1,16 @@
1
1
  // the open thread as one chat (wiki tools/shipkit/threads.md, The review page): a bar on top (the title, where it stands,
2
2
  // fold or unfold all, on a phone the contents), the cells in time order with the newest at the bottom, the contents strip beside
3
3
  // them (every version, view, verdict and reply: a click scrolls there and unfolds it), and his answer box pinned under
4
- // them: one word, sent with a verdict or as a reply, one line reminders of what still waits on his answer right above it (dock.tsx).
5
- // The column opens scrolled to the newest cell
4
+ // them: one word, sent with a verdict or as a reply, and nothing between the cells and the box; the arrows at the column's
5
+ // top count what waits above. The column opens scrolled to the newest cell
6
6
  import { observer } from 'mobx-react-lite'
7
7
  import { WordRefsCtx } from '../word-refs.ts'
8
8
  import { tagChoices, tagOf } from '../../../review/thread-query.ts'
9
- import { runInAction } from 'mobx'
9
+ import { compareStructural, computed, runInAction } from 'mobx'
10
10
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
11
11
  import { postJson } from './review-kit.ts'
12
12
  import { repoIdentity, useSideLinks } from '../side-frame-view.tsx'
13
- import { STATUS_LABEL, subjectLabel, viewName, viewTag } from '../../../review/model.ts'
14
- import { bandOf, type Band } from '../../../review/band.ts'
13
+ import { STATUS_LABEL, subjectLabel } from '../../../review/model.ts'
15
14
  import { asideAt } from '../../../review/aside-at.ts'
16
15
  import { tip } from '../tips.ts'
17
16
  import { versionActs } from '../../../review/settle.ts'
@@ -20,14 +19,15 @@ import { AttachButton, AttachThumbs, PicturesBox, useFileBox } from './attach-vi
20
19
  import { StagePopup } from '../social/stage-popup.tsx'
21
20
  import { Caret, Icon, ICON } from '../icons.tsx'
22
21
  import { Empty, HeadBtn, HeadPop, HolderChip, keepFocus, Rework } from './kit.tsx'
22
+ import { glyphOf } from './tones.ts'
23
23
  import { CellFrame, CellWhole, cellWholeTitle, TraceLines, When } from './review-cells.tsx'
24
24
  import { Group, Panel, Separator, type Layout } from 'react-resizable-panels'
25
25
  import { clampWidth, loadWidth, saveWidth, THREAD_PANEL } from '../layout-st.ts'
26
- import { Dock } from './dock.tsx'
27
26
  import { PaneBoundary } from '../pane-boundary.tsx'
28
27
  import { CloseBar } from './thread-close.tsx'
29
28
  import { AskProof, keepProof, keptProof } from './ask-proof.tsx'
30
29
  import { LaneBar } from './lane-bar.tsx'
30
+ import { RecapBar } from './recap-bar.tsx'
31
31
  import { AdvisorBar } from './advisor-bar.tsx'
32
32
  import { actorName } from '../../../review/parties.ts'
33
33
  import { ViewBox } from './review-views.tsx'
@@ -40,6 +40,7 @@ import { cellDom, type Line, type ThreadSt, type ViewMark } from './thread-st.ts
40
40
  import { LineWindow, lineKey } from './line-window.ts'
41
41
  import { LAPSE_LATER } from '../../../review/model.ts'
42
42
  import { StartColumn } from './start-thread.tsx'
43
+ import { bandOf, reworkingOf, type Band } from '../../../review/thread-state.ts'
43
44
 
44
45
  /** `back`: where the phone's ◂ goes, the list when absent; null when the page around the column draws its own */
45
46
  export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() => void) | null }) => {
@@ -64,8 +65,6 @@ export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() =
64
65
  // the panel signs in as the identity the owner's repo speaks as; none at the advisors' door
65
66
  useSideLinks(el, rv, useCallback(() => (rv.host.owner == null ? null : repoIdentity(rv.host.owner)), [rv]))
66
67
  const thread = rv.thread
67
- const ask = thread?.data?.ask
68
- const askActs = thread && ask?.state === 'open' && rv.can('answer') ? (titled: boolean) => <AskBar key={ask.id} rv={rv} thread={thread} ask={ask} titled={titled} /> : null
69
68
  return (
70
69
  <div ref={el} className={`rv-thread${rv.slim ? ' slim' : ''}${rv.terse ? ' terse' : ''}`}>
71
70
  {rv.newThread?.shown ? (
@@ -78,7 +77,6 @@ export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() =
78
77
  <WordRefsCtx.Provider value={thread.wordRefs}>
79
78
  <TopBar rv={rv} thread={thread} back={back} />
80
79
  <ThreadBody rv={rv} thread={thread} />
81
- <PaneBoundary pane="thread dock" at={thread.id}><Dock key={thread.id} rv={rv} thread={thread} ask={askActs} /></PaneBoundary>
82
80
  <Composer rv={rv} thread={thread} />
83
81
  <ViewBox rv={rv} thread={thread} />
84
82
  <PicturesBox box={thread.pictures} />
@@ -193,7 +191,7 @@ const ThreadBody = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt })
193
191
  })
194
192
 
195
193
  /** on a phone the page keeps to what the keyboard leaves: the visual viewport's height and offset as two css vars the
196
- * phone pane reads, so the dock and the reply box stay above the keyboard where the browser only pans the page */
194
+ * phone pane reads, so the reply box stays above the keyboard where the browser only pans the page */
197
195
  function useKeyboardRoom(on: boolean): void {
198
196
  useEffect(() => {
199
197
  const vv = typeof window === 'undefined' ? undefined : window.visualViewport
@@ -250,9 +248,68 @@ const StageBar = observer(({ rv, thread, menu }: { rv: ReviewSt; thread: ThreadS
250
248
  )
251
249
  })
252
250
 
251
+ /** a thread that came from another repo says so at its head, quietly: « moved here from <repo> » */
252
+ const MovedLine = observer(({ thread }: { thread: ThreadSt }) => {
253
+ const t = thread.cells.findLast((c) => 'trace' in c && c.trace?.act === 'move')
254
+ const from = t && 'trace' in t ? /from (\S+) to /.exec(t.trace?.did ?? '')?.[1] : undefined
255
+ return from === undefined ? null : <span className="trm" data-check="moved-here" {...tip(t && 'summary' in t ? t.summary : '')}>moved here from {from}</span>
256
+ })
257
+
258
+ /** « move to project… »: the thread moves whole to another house repo (review/move.ts), then opens there; nothing
259
+ * drawn with no other repo, or for a role that may not move it */
260
+ const MoveBar = observer(({ thread }: { thread: ThreadSt }) => {
261
+ useEffect(() => void thread.readMoveTargets(), [thread])
262
+ const repos = thread.moveTargets
263
+ if (repos === null || repos.length === 0) return null
264
+ return (
265
+ <HeadPop className="rv-quiet" check="move" popClass="rv-headmenu" says="move to project…" more="a thread raised in the wrong project moves whole: every message, answer and file, the old link opens it there" label={<Icon d={ICON.repo} />}>
266
+ {(close) => (
267
+ <>
268
+ {repos.map((r) => (
269
+ <button key={r} type="button" className="rv-menuitem" data-check="move-to" data-repo={r} {...tip(`this thread moves to ${r}, whole`)} onClick={() => { close(); void thread.moveTo(r) }}>move to {r}</button>
270
+ ))}
271
+ </>
272
+ )}
273
+ </HeadPop>
274
+ )
275
+ })
276
+
253
277
  /** a title past this many letters may be cut at its second line: its hover says it whole */
254
278
  const CUT_TITLE = 70
255
279
 
280
+ /** the thread's name; the owner renames it in place: a double click edits it, Enter saves (`…/rename`, review/close.ts
281
+ * renameThread, its trace line in the thread), Escape or a blur with no change keeps it. An ask's thread is named by
282
+ * its instructions: `head` null */
283
+ const ThreadTitle = ({ rv, thread, title, head }: { rv: ReviewSt; thread: ThreadSt; title: string; head: string | null }) => {
284
+ const [draft, setDraft] = useState<string | null>(null)
285
+ const [err, setErr] = useState<string | null>(null)
286
+ const may = head !== null && rv.can('rename')
287
+ const save = async (words: string): Promise<void> => {
288
+ setDraft(null)
289
+ if (head === null || words.trim() === '' || words.trim() === title.trim()) return
290
+ try {
291
+ await postJson(rv.url(`/api/review/${head}/rename`), { title: words })
292
+ setErr(null)
293
+ await thread.refresh()
294
+ void rv.answered()
295
+ } catch (e) {
296
+ setErr((e as Error).message)
297
+ }
298
+ }
299
+ if (draft !== null)
300
+ return (
301
+ <input className="rv-title rv-titlefield" data-check="rename-title" autoFocus type="text" value={draft} maxLength={120} aria-label="the thread's name"
302
+ onChange={(e) => setDraft(e.currentTarget.value)} onBlur={() => void save(draft)}
303
+ onKeyDown={(e) => { if (e.key === 'Enter') void save(draft); else if (e.key === 'Escape') setDraft(null) }} />
304
+ )
305
+ return (
306
+ <>
307
+ <h2 className="rv-title" data-check="thread-title" {...tip(may ? `${title.length > CUT_TITLE ? `${title}. ` : ''}double click to rename it` : title.length > CUT_TITLE ? title : undefined)} onDoubleClick={may ? () => setDraft(title) : undefined}>{title}</h2>
308
+ {err ? <span className="err">✗ {err}</span> : null}
309
+ </>
310
+ )
311
+ }
312
+
256
313
  /** where the thread stands, in the words of the list's bands, on its band's mark */
257
314
  /** where the thread stands, in the reader's words (ReviewSt.bandWord: at the advisors' door the owner's turn waits for the owner) */
258
315
  const StateWord = ({ rv, band, says }: { rv: ReviewSt; band: Band; says?: string }) => (
@@ -267,12 +324,12 @@ const StateWord = ({ rv, band, says }: { rv: ReviewSt; band: Band; says?: string
267
324
  const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt; back?: (() => void) | null }) => {
268
325
  const v = thread.shown
269
326
  const row = rv.openRow
270
- const band = v ? bandOf(v, rv.parties, rv.bandNow) : null
327
+ const band = v ? bandOf(v.state, rv.parties, rv.bandNow) : null
271
328
  // a terse column tucks the rare tools away; a phone has no pointer to name an icon, and keeps its row
272
329
  const tucked = rv.terse && !rv.phone.on
273
- const closedWords = v != null && v.state.state === 'closed' && !v.ask && rv.can('close')
274
- const asideWords = v?.aside != null && rv.can('snooze')
275
- const yours = v != null && (v.turn === 'yours' || v.aside != null) && rv.can('snooze')
330
+ const closedWords = v != null && v.state.closed != null && !v.ask && rv.can('close')
331
+ const asideWords = v?.state.aside?.until != null && rv.can('snooze')
332
+ const yours = v != null && (v.state.turn === 'yours' || v.state.aside?.until != null) && rv.can('snooze')
276
333
  const folds = (menu?: { done: () => void }): ReactNode => menu ? (
277
334
  <>
278
335
  <button type="button" className="rv-menuitem" {...tip('close every cell of this thread to its head line')} onClick={() => { menu.done(); thread.foldAll(false) }}><Icon d={ICON.foldAll} /> fold every cell</button>
@@ -289,32 +346,32 @@ const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt;
289
346
  <div className="rv-topin">
290
347
  <div className="rv-topline">
291
348
  {rv.phone.on && back !== null ? <button className="ghost rv-back" {...tip('back to the list of threads')} aria-label="back" onClick={() => (back != null ? back() : rv.phone.show('list'))}>◂</button> : null}
292
- <h2 className="rv-title" {...tip(v && v.title.length > CUT_TITLE ? v.title : undefined)}>{v?.title ?? row?.title ?? thread.id}</h2>
349
+ <ThreadTitle rv={rv} thread={thread} title={v?.title ?? row?.title ?? thread.id} head={v && !v.ask ? v.head : null} />
293
350
  {v?.code ? <ThreadCode rv={rv} code={v.code} /> : null}
294
351
  {rv.can('copy') ? (
295
352
  <HeadBtn className="rv-copyid rv-quiet" says="copy this thread for an agent" k="C" more="a paste for a fresh agent session: its title, its repo, sk thread show, its link" onClick={() => void rv.copyThread()}><Icon d={ICON.copy} /></HeadBtn>
296
353
  ) : null}
297
354
  </div>
298
355
  {rv.phone.on && v ? <Minimap thread={thread} /> : null}
299
- {/* a closed ask's record sits in the head; while it is open, its bar tops the dock, the one control the dock keeps */}
300
- {v?.ask && v.ask.state !== 'open' && rv.can('answer') ? <AskBar rv={rv} thread={thread} ask={v.ask} /> : null}
356
+ {/* the ask's bar sits in the head: its acts on the whole ask while it is open, how it closed after */}
357
+ {v?.ask && rv.can('answer') ? <AskBar key={v.ask.id} rv={rv} thread={thread} ask={v.ask} /> : null}
301
358
  {v && band !== null ? (
302
359
  <div className="rv-meta">
303
360
  <span className="rv-state" data-band={band}>
304
361
  {/* a closed thread and one set aside say where they stand in their own bar, once */}
305
- {closedWords || asideWords ? null : <StateWord rv={rv} band={band} says={`${STATUS_LABEL[v.status].toLowerCase()} · ${subjectLabel(v.subject.kind, rv.spec ?? undefined)}`} />}
306
- {yours ? <AsideBar rv={rv} thread={thread} id={v.head} aside={v.aside ?? null} /> : null}
362
+ {closedWords || asideWords ? null : <StateWord rv={rv} band={band} says={`${STATUS_LABEL[v.state.status].toLowerCase()} · ${subjectLabel(v.subject.kind, rv.spec ?? undefined)}`} />}
363
+ {yours ? <AsideBar rv={rv} thread={thread} id={v.head} aside={v.state.aside?.until ?? null} /> : null}
307
364
  {rv.can('close') ? <CloseBar rv={rv} thread={thread} /> : null}
308
365
  </span>
309
366
  <TagBar rv={rv} thread={thread} tags={v.tags} plus={!tucked} />
310
367
  {/* who hears him and what moved, in muted words: each one something he acts on */}
311
368
  <span className="trmeta rv-headmeta">
312
369
  {rv.phone.on ? null : <Waiting thread={thread} />}
313
- {v.holder ? <span className="trm trholder"><HolderChip rv={rv} holder={v.holder} plain /></span> : null}
314
- {rv.cursorsOf(v.head, v.cursor).map((c) => {
370
+ {v.state.holder ? <span className="trm trholder"><HolderChip rv={rv} holder={v.state.holder} plain /></span> : null}
371
+ {rv.cursorsOf(v.head, v.state.cursor ?? undefined).map((c) => {
315
372
  const who = actorName(c.who, c.session, rv.parties)
316
373
  // the holder named beside it read his word: its name is not said twice
317
- const holder = v.holder != null && (v.holder.lane != null ? c.who === v.holder.lane : c.session !== undefined && c.session === v.holder.session)
374
+ const holder = v.state.holder != null && (v.state.holder.lane != null ? c.who === v.state.holder.lane : c.session !== undefined && c.session === v.state.holder.session)
318
375
  return (
319
376
  <span key={c.who} className="trm trcursor" data-cursor={c.working !== undefined ? 'working' : 'seen'} {...tip(c.working ?? `${who} read your newest word`)}>
320
377
  {c.working !== undefined ? `${who} is on it: ${c.working}` : holder ? 'seen' : `seen by ${who}`} · <When rv={rv} at={c.at} />
@@ -322,6 +379,7 @@ const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt;
322
379
  )
323
380
  })}
324
381
  {v.origin.by === 'auto' ? <span className="trm">auto: {v.origin.rule}</span> : null}
382
+ <MovedLine thread={thread} />
325
383
  {v.versions > 1 ? <span className="trm"><Versions thread={thread} /></span> : null}
326
384
  </span>
327
385
  {v.forks.length > 0 ? (
@@ -332,14 +390,16 @@ const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt;
332
390
  ))}
333
391
  </span>
334
392
  ) : null}
335
- <Rework r={v.rework} />
393
+ <Rework r={reworkingOf(v.state)} />
336
394
  <span className="sp" />
337
395
  <span className="rv-tools">
338
396
  <span className="rv-toolgroup">
339
397
  {rv.can('mute') ? <BellButton thread={thread} muted={v.muted === true} /> : null}
340
- {rv.can('lane') && (!tucked || v.laneAsk) ? <LaneBar rv={rv} thread={thread} /> : null}
341
- {rv.host.owner !== null && rv.can('share') ? <AdvisorBar home={rv.host.owner.home} repo={rv.host.name} head={v.head} mine={v.turn === 'yours' || v.aside !== undefined} title={v.title} /> : null}
398
+ {rv.can('lane') && (!tucked || v.state.laneAsk) ? <LaneBar rv={rv} thread={thread} /> : null}
399
+ {rv.can('recap') && (!tucked || v.state.recap?.asked || v.state.recap?.waits) ? <RecapBar rv={rv} thread={thread} /> : null}
400
+ {rv.host.owner !== null && rv.can('share') ? <AdvisorBar home={rv.host.owner.home} repo={rv.host.name} head={v.head} mine={v.state.turn === 'yours' || v.state.aside?.until !== undefined} title={v.title} /> : null}
342
401
  {rv.can('stage') && !tucked ? <StageBar rv={rv} thread={thread} /> : null}
402
+ <MoveBar thread={thread} />
343
403
  </span>
344
404
  <span className="rv-toolgroup">
345
405
  <HeadBtn className={`rv-quiet${rv.wide ? ' on' : ''}`} aria-pressed={rv.wide} says={rv.wide ? 'back to the threads' : 'wide'} k="W" more={rv.wide ? undefined : 'the list folds away, the thread takes the page'} onClick={() => rv.toggleWide()}><Icon d={ICON.wide} /></HeadBtn>
@@ -351,7 +411,8 @@ const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt;
351
411
  <HeadPop className="rv-quiet" check="head-more" popClass="rv-headmenu" says="more" more="a lane, a post, a tag, fold or unfold every cell" label="⋯">
352
412
  {(close) => (
353
413
  <>
354
- {rv.can('lane') && !v.laneAsk ? <LaneBar rv={rv} thread={thread} menu={{ done: close }} /> : null}
414
+ {rv.can('lane') && !v.state.laneAsk ? <LaneBar rv={rv} thread={thread} menu={{ done: close }} /> : null}
415
+ {rv.can('recap') && !v.state.recap?.asked && !v.state.recap?.waits ? <RecapBar rv={rv} thread={thread} menu={{ done: close }} /> : null}
355
416
  {rv.can('stage') ? <StageBar rv={rv} thread={thread} menu={{ done: close }} /> : null}
356
417
  {/* the field opens after the popover gave the focus back to « more », else its blur shuts it at once */}
357
418
  {rv.can('tag') ? <button type="button" className="rv-menuitem" data-check="tag-add-more" {...tip(TAG_ADD_SAYS)} onClick={() => { close(); setTimeout(() => thread.typeTag(''), 0) }}>+ add a tag</button> : null}
@@ -372,9 +433,8 @@ const TopBar = observer(({ rv, thread, back }: { rv: ReviewSt; thread: ThreadSt;
372
433
 
373
434
  /** an ask's thread: the ask's state, and the owner's two words on the whole ask, the Asks page's own verbs; « done »
374
435
  * with a proof link saved on 🔗 (ask-proof.tsx) sends it with the close (`ask-proof`). A question or a remark is a
375
- * reply in the thread, which its holder hears. Keyed by its ask: the link of one ask never shows on another. In the
376
- * dock's line: `titled` names the ask when nothing else waits, else its acts follow the step or question, under « ask » */
377
- const AskBar = observer(({ rv, thread, ask, titled = true }: { rv: ReviewSt; thread: ThreadSt; ask: NonNullable<ThreadView['ask']>; titled?: boolean }) => {
436
+ * reply in the thread, which its holder hears. Keyed by its ask: the link of one ask never shows on another */
437
+ const AskBar = observer(({ rv, thread, ask }: { rv: ReviewSt; thread: ThreadSt; ask: NonNullable<ThreadView['ask']> }) => {
378
438
  const [busy, setBusy] = useState(false)
379
439
  const [err, setErr] = useState<string | null>(null)
380
440
  const [proof, setProof] = useState(() => keptProof(ask.id))
@@ -402,12 +462,8 @@ const AskBar = observer(({ rv, thread, ask, titled = true }: { rv: ReviewSt; thr
402
462
  if (ask.state !== 'open') return <ClosedAskBar rv={rv} ask={ask} />
403
463
  // one line that never changes size: the ask, 🔗 whose popover holds the proof link, « done ✓ », « I will not do this »
404
464
  return (
405
- <div className={`rv-askbar${titled ? ' titled' : ''}`}>
406
- {titled ? (
407
- <span className="rv-asktitle" {...tip(`ask ${ask.id}: ${ask.title}`)}><span className="rv-dockkind">ask</span><b className="rv-dockq">{ask.title}</b></span>
408
- ) : (
409
- <span className="rv-askword" {...tip(`ask ${ask.id}: ${ask.title}. Its acts, on the whole ask`)}>ask</span>
410
- )}
465
+ <div className="rv-askbar">
466
+ <span className="rv-askword" {...tip(`ask ${ask.id}: ${ask.title}. Its acts, on the whole ask`)}>ask</span>
411
467
  <AskProof url={proof} set={saveProof} />
412
468
  <button className="rv-askopt pick" disabled={busy} onMouseDown={keepFocus} onClick={() => void act('ask-done')} {...tip(`the whole ask is done${proof ? ', your link its proof' : ''}: it closes here and on the Asks page`)}>done ✓</button>
413
469
  {ask.lapses !== undefined ? <button className="ghost" disabled={busy} onMouseDown={keepFocus} onClick={() => void act('ask-later')} {...tip(`set it aside: it waits on nobody, and comes back only when a project needs ${ask.lapses} for work that waits on it`)}>later</button> : null}
@@ -512,6 +568,12 @@ const CONTENTS_OVERSCAN = 20
512
568
  /** this close to the end, he reads the end: a new line scrolls into view */
513
569
  const END_SLACK_PX = 48
514
570
 
571
+ /** where the column stands from its end, read off its scroll: at its end within the slack, and by how much */
572
+ const readEnd = (box: HTMLElement, win: LineWindow): void => {
573
+ win.fromEnd = Math.max(0, box.scrollHeight - box.clientHeight - box.scrollTop)
574
+ win.atEnd = win.fromEnd <= END_SLACK_PX
575
+ }
576
+
515
577
  /** each open thread's window, kept while the thread lives: the columns drawn again (« wide » folds the list, KeptCols
516
578
  * keys its group by the fold) keep where he reads, never back at the top with its end undrawn */
517
579
  const windows = new WeakMap<ThreadSt, LineWindow>()
@@ -544,11 +606,16 @@ const Cells = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
544
606
  raf = 0
545
607
  win.widen()
546
608
  win.scrolled(box.scrollTop, box.clientHeight)
547
- win.atEnd = box.scrollTop + box.clientHeight >= box.scrollHeight - END_SLACK_PX
609
+ readEnd(box, win)
548
610
  })
549
611
  }
550
612
  box.addEventListener('scroll', onScroll, { passive: true })
613
+ // a column that changes size (the window, a panel) says again whether its end shows: no scroll event comes with
614
+ // it, and a thread that fit whole would follow the end it no longer shows
615
+ const resized = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(onScroll)
616
+ resized?.observe(box)
551
617
  return () => {
618
+ resized?.disconnect()
552
619
  box.removeEventListener('scroll', onScroll)
553
620
  cancelAnimationFrame(raf)
554
621
  cancelAnimationFrame(w.raf)
@@ -564,7 +631,8 @@ const Cells = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
564
631
  box.scrollTop = end || !target ? box.scrollHeight : Math.min(target.offsetTop - 8, box.scrollHeight - box.clientHeight)
565
632
  win.scrolled(box.scrollTop, box.clientHeight)
566
633
  // landed on a target with the end in view (a thread that fits): at its end too, since no scroll will say so
567
- win.atEnd = end || !target || box.scrollTop + box.clientHeight >= box.scrollHeight - END_SLACK_PX
634
+ readEnd(box, win)
635
+ if (end || !target) (win.atEnd = true), (win.fromEnd = 0)
568
636
  thread.land()
569
637
  // the click's frame drew the lines in view alone; the ones past each edge come once it painted
570
638
  const w = widening.current
@@ -577,6 +645,7 @@ const Cells = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
577
645
  if (!box || !thread.landed || !win.atEnd) return
578
646
  box.scrollTop = box.scrollHeight
579
647
  win.scrolled(box.scrollTop, box.clientHeight)
648
+ win.fromEnd = 0
580
649
  }, [count, thread, win])
581
650
  // he opens the thread, the tab visible: his cursor goes to its end at once (review/owner-read.ts); a thread the list
582
651
  // opened by itself goes read by sight only, so a visit to the list never reads his newest thread whole
@@ -628,20 +697,30 @@ const Cells = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
628
697
  useEffect(() => {
629
698
  const box = el.current
630
699
  if (!jump || !box) return
631
- // its line drawn first: the window stands around it, the next frame finds it
700
+ // its line drawn first: the window stands around it, a next frame finds it (a few, on a busy machine)
632
701
  if (box.querySelector(`#${jump}`) === null) win.bring(jump)
633
- const raf = requestAnimationFrame(() => {
702
+ let raf = 0
703
+ let tries = 0
704
+ const go = (): void => {
634
705
  const at = box.querySelector<HTMLElement>(`#${jump}`)
706
+ if (!at && ++tries < 30) {
707
+ raf = requestAnimationFrame(go)
708
+ return
709
+ }
635
710
  if (at) {
636
- at.scrollIntoView({ behavior: 'smooth', block: 'start' })
637
- // the dock's reminder jumped here: the place lights for one beat, a class of the page alone
711
+ // a jump leaves the end on purpose: a line measured after it must not pin the column back there; the
712
+ // move is instant, since a smooth one is cancelled by the first line above that measures itself
713
+ win.atEnd = false
714
+ at.scrollIntoView({ block: 'start' })
715
+ // a jump landed here: the place lights for one beat, a class of the page alone
638
716
  at.classList.remove('lit')
639
717
  void at.offsetWidth
640
718
  at.classList.add('lit')
641
719
  setTimeout(() => at.classList.remove('lit'), 1400)
642
720
  }
643
721
  thread.jumped()
644
- })
722
+ }
723
+ raf = requestAnimationFrame(go)
645
724
  return () => cancelAnimationFrame(raf)
646
725
  }, [jump, thread, win])
647
726
  return (
@@ -654,14 +733,18 @@ const Cells = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
654
733
  )
655
734
  })
656
735
 
657
- /** pinned at the column's top, what waits on his answer above the viewport (the dock's own list, ThreadSt.waiting):
658
- * « ↑ 3 wait for your answer », a click goes to the nearest one; nothing when none is above. Below the viewport the
659
- * dock under the column names each one */
736
+ /** pinned at the column's top, what waits on his answer above the viewport (ThreadSt.waiting): « ↑ 3 wait for your
737
+ * answer », a click goes to the nearest one; nothing when none is above. The one place that counts what waits: nothing
738
+ * sits between the cells and the reply box */
660
739
  const WaitsAbove = observer(({ thread, win }: { thread: ThreadSt; win: LineWindow }) => {
661
740
  const ids = thread.waiting
662
- const doms = ids.map(cellDom)
663
- const above = win.outside(doms).above
741
+ const key = ids.join(' ')
742
+ // the scroll moves each frame: read through a computed that changes only when the list above does, so a scroll
743
+ // draws nothing here, and nothing at all reads the scroll when nothing waits
744
+ const aboveOf = useMemo(() => computed(() => win.outside(key === '' ? [] : key.split(' ').map(cellDom)).above, { equals: compareStructural }), [win, key])
745
+ const above = ids.length === 0 ? [] : aboveOf.get()
664
746
  if (above.length === 0) return null
747
+ const doms = ids.map(cellDom)
665
748
  const nearest = ids[doms.indexOf(above[0]!)]!
666
749
  return (
667
750
  <div className="rv-waitsup">
@@ -691,8 +774,9 @@ const WindowedLines = observer(({ rv, thread, win, box }: { rv: ReviewSt; thread
691
774
  }
692
775
  const shift = sizes.reduce((n, [key, h]) => n + win.shiftOf(key, h), 0)
693
776
  const b = box.current
694
- // at its end the column follows the end: a shift there is read off a clamped scroll, and moves it off
695
- if (b && win.atEnd) b.scrollTop = b.scrollHeight
777
+ // at its end the column follows the end, as far above it as he stood: a shift there is read off a
778
+ // clamped scroll, and moves it off
779
+ if (b && win.atEnd) b.scrollTop = b.scrollHeight - b.clientHeight - win.fromEnd
696
780
  else if (shift !== 0 && b) b.scrollTop += shift
697
781
  requestAnimationFrame(() => runInAction(() => { for (const [key, h] of sizes) win.measured(key, h) }))
698
782
  }),
@@ -770,7 +854,7 @@ const SupersededRun = observer(({ rv, thread, run }: { rv: ReviewSt; thread: Thr
770
854
  const inside = run.lines.flatMap((l) => (l.kind === 'cell' && unread.has(l.cell.id) ? [l.cell.id] : []))
771
855
  return (
772
856
  <div className={`rv-run${open ? ' open' : ''}`} data-run={run.key}>
773
- <button className="rv-runline ghost" aria-expanded={open} {...tip(open ? 'shut them again' : 'show them, read only: a newer one supersedes each')} data-unread={open || inside.length === 0 ? undefined : inside.join(' ')} onMouseDown={keepFocus} onClick={() => thread.toggleRun(run.key)}>
857
+ <button className={`rv-runline ghost${run.recap ? ' rv-recapfold' : ''}`} aria-expanded={open} {...tip(open ? 'shut them again' : run.recap ? 'show them: the recap you accepted covers them, nothing was deleted' : 'show them, read only: a newer one supersedes each')} data-unread={open || inside.length === 0 ? undefined : inside.join(' ')} onMouseDown={keepFocus} onClick={() => thread.toggleRun(run.key)}>
774
858
  {run.words} <Caret open={open} />
775
859
  </button>
776
860
  {open ? <div className="rv-runbody"><Lines rv={rv} thread={thread} lines={run.lines} /></div> : null}
@@ -852,7 +936,7 @@ const Waiting = observer(({ thread }: { thread: ThreadSt }) => {
852
936
  )
853
937
  })
854
938
 
855
- const ANSWER_GLYPH: Record<ViewMark['answer'], string> = { none: '', approved: '✓', 'approved-with-fix': '⚒', rejected: '✕', archived: '▤', scored: '★', picked: '✓', sent: '' }
939
+ const answerGlyph = (a: ViewMark['answer']): string => (a === 'none' || a === 'sent' ? '' : a === 'scored' ? '★' : a === 'picked' ? '✓' : glyphOf(a))
856
940
 
857
941
  /** the minimap: every version as a pill, the one his answer goes to ringed, under it one mark per view coloured by his
858
942
  * answer (none yet, OK, fix, no), each answer and reply as a dot; a click shows it. One row under the thread's title on a
@@ -873,7 +957,7 @@ export const Minimap = observer(({ thread }: { thread: ThreadSt }) => {
873
957
  {marks.map((m) => (
874
958
  <button key={m.view} className={`rv-minimark a-${m.answer}${m.noted ? ' noted' : ''}`} {...tip(`${m.tag}: ${m.answer === 'none' ? 'waiting for you' : m.answer}${m.noted ? ', a draft note on it' : ''}`)}
875
959
  onMouseDown={keepFocus} onClick={() => thread.reveal(e.cell, m.view)}>
876
- {m.tag.split('.')[1]}{ANSWER_GLYPH[m.answer] ? <small>{ANSWER_GLYPH[m.answer]}</small> : null}
960
+ {m.tag.split('.')[1]}{answerGlyph(m.answer) ? <small>{answerGlyph(m.answer)}</small> : null}
877
961
  </button>
878
962
  ))}
879
963
  </span>
@@ -886,7 +970,7 @@ export const Minimap = observer(({ thread }: { thread: ThreadSt }) => {
886
970
 
887
971
  /** where his word goes, as the reply box's placeholder: short, one line in a column of any width (`hint`), and whole
888
972
  * on the field's hover (`says`); ⌘⏎ is said beside the send button. A comment of its own, never part of a verdict (a
889
- * verdict's note is written beside its face, item-verdict.tsx) */
973
+ * verdict's note is written in its tone's box, tone-bar.tsx) */
890
974
  const replyHint = (thread: ThreadSt, phone: boolean): { hint: string; says: string } => {
891
975
  const sent = phone ? '' : ' (⌘Enter)'
892
976
  const on = thread.replyOn
@@ -897,8 +981,7 @@ const replyHint = (thread: ThreadSt, phone: boolean): { hint: string; says: stri
897
981
  return { hint: 'a comment', says: `a comment: its own message, never part of a verdict${sent}` }
898
982
  }
899
983
 
900
- /** his answer, pinned under the cells: what goes with a verdict (his rectangles, reactions, pick, each a click away), then
901
- * ONE answer box as wide as the cells: where the words go and the files, the text box, and ONE row under it inside the box:
984
+ /** his answer, pinned under the cells: ONE answer box as wide as the cells: where the words go and the files, the text box, and ONE row under it inside the box:
902
985
  * the paper clip, who hears him, ⌘⏎ and « Reply ». One layout at every width; the comment is always a message of its own.
903
986
  * A person's page names nobody who hears (their words go to the owner): the clip, the box and « Reply » are one row */
904
987
  const Composer = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
@@ -923,13 +1006,6 @@ const Composer = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) =
923
1006
  const sendable = (on !== null || words || at.any) && named?.refused == null
924
1007
  // `@` lists the parties his word can name first, then every resource of the thread's repo (palette-st.ts, `refs`)
925
1008
  const refs = thread.refBox(named != null)
926
- const d = thread.marks
927
- const h = thread.head
928
- const n = h?.kind === 'version' ? h.n : null
929
- const views = thread.headItem?.views ?? []
930
- const reactions = thread.shownReactions
931
- const newest = thread.newest
932
- const parked = thread.parked === null ? null : thread.versionOf(thread.parked)
933
1009
  const hint = replyHint(thread, rv.phone.on)
934
1010
  // who hears the words is the owner's second row; a person's words go to the owner alone: one row
935
1011
  const one = rv.host.role !== 'owner'
@@ -944,28 +1020,6 @@ const Composer = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) =
944
1020
  )
945
1021
  return (
946
1022
  <div className="rv-composer" {...files.zone}>
947
- {thread.draftOn !== null && newest?.kind === 'version' && n !== null ? (
948
- <div className="rv-moved" role="status">
949
- <span>your answer goes to v{n}, your draft is there; v{newest.n} is newer and takes your marks too</span>
950
- <button className="primary" {...tip(`your words and your marks go to v${newest.n}\na mark on a view v${newest.n} does not have stays on v${n}`)} onClick={() => thread.moveDraft()}>move it to v{newest.n}</button>
951
- <button {...tip(`answer v${newest.n} instead: your draft stays on v${n}, unsent`)} onClick={() => thread.answerNewest()}>answer v{newest.n}</button>
952
- </div>
953
- ) : parked !== null && newest?.kind === 'version' ? (
954
- <div className="rv-moved" role="status">
955
- <span>an unsent draft waits on v{parked.n}</span>
956
- <button className="primary" {...tip(`the draft's words and marks go to v${newest.n}\na mark on a view v${newest.n} does not have stays on v${parked.n}`)} onClick={() => thread.moveDraft()}>move it to v{newest.n}</button>
957
- <button {...tip(`your answer goes to v${parked.n} again, with the draft that waits there`)} onClick={() => thread.answerParked()}>answer v{parked.n} with it</button>
958
- <button className="ghost" {...tip(`delete the unsent draft on v${parked.n}: its words and its notes\nnothing brings it back`)} onClick={() => thread.dropParked()}>drop it</button>
959
- </div>
960
- ) : null}
961
- {/* what goes with his answer, a click away: a pick, draft notes, reactions; nothing while he only types */}
962
- {(d.pick !== undefined && n !== null) || d.rects.length > 0 || reactions.length > 0 ? (
963
- <div className="rv-goes">
964
- {d.pick !== undefined && n !== null ? <button className="rv-chip re-approved" {...tip('show the view you picked: your answer sends the pick')} onClick={() => thread.reveal(h?.id ?? v.head, d.pick)}>✓ picked {viewTag(n, d.pick)} {viewName(views[d.pick], d.pick)}</button> : null}
965
- {d.rects.length > 0 ? <button className="rv-chip rect" {...tip('your draft notes: the verdict sends them')} onClick={() => thread.reveal(h?.id ?? v.head, d.rects[0]?.view ?? 0)}>⬚ {d.rects.length} draft note{d.rects.length > 1 ? 's' : ''}, sent with your verdict</button> : null}
966
- {reactions.length > 0 ? <button className="rv-chip" {...tip('show your first reaction on this version: your answer sends them all')} onClick={() => thread.reveal(h?.id ?? v.head, reactions[0]?.view)}>{reactions.length} reaction{reactions.length > 1 ? 's' : ''}</button> : null}
967
- </div>
968
- ) : null}
969
1023
  {thread.error ? <span className="err">✗ {thread.error}</span> : null}
970
1024
  {named?.refused ? <span className="err rv-mentionerr" role="alert">✗ {named.refused}</span> : null}
971
1025
  <div className={`rv-compose${one ? ' one' : ''}`}>
@@ -988,7 +1042,7 @@ const Composer = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) =
988
1042
  <div className="rv-replybar">
989
1043
  {attach}
990
1044
  {/* who reads it: the holder's light and name, cut with an ellipsis where the row is short */}
991
- {rv.openRow?.holder == null ? <span className="rv-replyto" /> : <span className="trmeta rv-replyto"><span className="rv-replytoword">to</span><span className="trm trholder"><HolderChip rv={rv} holder={rv.openRow.holder} hears /></span></span>}
1045
+ {rv.openRow?.state.holder == null ? <span className="rv-replyto" /> : <span className="trmeta rv-replyto"><span className="rv-replytoword">to</span><span className="trm trholder"><HolderChip rv={rv} holder={rv.openRow.state.holder} hears /></span></span>}
992
1046
  {send}
993
1047
  </div>
994
1048
  )}