rvlib-shipkit 2.31.0 → 2.33.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 (408) hide show
  1. package/CHANGELOG.md +51 -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 +122 -76
  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 +20 -221
  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 +27 -25
  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 +97 -183
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +261 -87
  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_Capacity.ts +6 -2
  67. package/src/cli/cmd_Checks.ts +0 -14
  68. package/src/cli/cmd_Ci.ts +2 -1
  69. package/src/cli/cmd_Db.ts +3 -82
  70. package/src/cli/cmd_Home.ts +4 -32
  71. package/src/cli/cmd_Hq.ts +0 -17
  72. package/src/cli/cmd_Releases.ts +57 -4
  73. package/src/cli/cmd_Review.ts +333 -354
  74. package/src/cli/cmd_Shot.ts +26 -4
  75. package/src/cli/cmd_SocialDrafts.ts +6 -13
  76. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  77. package/src/cli/cmd_Time.ts +1 -1
  78. package/src/cli/cmd_Trailer.ts +1 -1
  79. package/src/cli/inbox-hook-run.ts +5 -23
  80. package/src/cli/registry-heads.ts +5 -55
  81. package/src/cli/registry.ts +1 -5
  82. package/src/cli/review-here.ts +1 -1
  83. package/src/cli.ts +15 -4
  84. package/src/collections/collection-types.ts +1 -1
  85. package/src/collections/review.ts +5 -4
  86. package/src/core/admission.ts +268 -0
  87. package/src/core/agent-allow-policy.ts +32 -2
  88. package/src/core/agent-env.ts +8 -0
  89. package/src/core/allow-rows.ts +74 -0
  90. package/src/core/check-file-names.ts +19 -106
  91. package/src/core/code-lines.ts +36 -21
  92. package/src/core/footprint.ts +17 -13
  93. package/src/core/identities-root.ts +1 -4
  94. package/src/core/layout.ts +1 -2
  95. package/src/core/machine-db.ts +33 -208
  96. package/src/core/machine-layout.ts +14 -127
  97. package/src/core/machine-read.ts +5 -2
  98. package/src/core/mask-source.ts +60 -0
  99. package/src/core/memory-watch.ts +17 -14
  100. package/src/core/motherhome.ts +8 -35
  101. package/src/core/one-way-in-policy.ts +0 -3
  102. package/src/core/peer-sk.ts +8 -0
  103. package/src/core/repo-walk.ts +0 -9
  104. package/src/core/retention.ts +1 -9
  105. package/src/core/retired-checks.ts +2 -0
  106. package/src/core/tmux-policy.ts +1 -1
  107. package/src/core/tree-watch.ts +2 -2
  108. package/src/core/when.ts +7 -45
  109. package/src/gate/admit-heavy.ts +150 -0
  110. package/src/gate/check-runner.ts +6 -0
  111. package/src/gate/discover-checks.ts +42 -32
  112. package/src/gate/gate-checks.ts +21 -131
  113. package/src/gate/head-gate.ts +1 -1
  114. package/src/gate/job-run.ts +2 -1
  115. package/src/gate/pre-commit-discovery.ts +22 -28
  116. package/src/gate/run-check.ts +3 -4
  117. package/src/gate/run-ci.ts +4 -0
  118. package/src/gate/run-fix.ts +5 -17
  119. package/src/gate/run-fixers.ts +6 -42
  120. package/src/home/app-sign.ts +2 -2
  121. package/src/home/backup-status.ts +52 -92
  122. package/src/home/backup-verdict.ts +2 -2
  123. package/src/home/daemon-jobs.ts +51 -95
  124. package/src/home/database-words.ts +1 -2
  125. package/src/home/databases.ts +9 -25
  126. package/src/home/home-launchd.ts +0 -6
  127. package/src/home/home-paths.ts +8 -4
  128. package/src/home/home-routes.ts +3 -10
  129. package/src/home/home-state.ts +2 -14
  130. package/src/home/inbox-shape.ts +14 -15
  131. package/src/home/inbox.ts +1 -1
  132. package/src/home/machine-repair.ts +102 -103
  133. package/src/home/resume.ts +1 -15
  134. package/src/home/run-daemon.ts +7 -12
  135. package/src/home/space-page.ts +3 -2
  136. package/src/home/supervise.ts +3 -7
  137. package/src/hooks/commit-msg-run.ts +61 -0
  138. package/src/hooks/commit-run.ts +16 -166
  139. package/src/hooks/gate-outcome.ts +108 -0
  140. package/src/hooks/git-hook.ts +9 -9
  141. package/src/hooks/hook-config.ts +8 -8
  142. package/src/hooks/leak-guard.ts +1 -1
  143. package/src/hooks/pre-commit-checks.ts +1 -1
  144. package/src/hooks/run-hooks.ts +2 -6
  145. package/src/hooks/shared-file.ts +3 -2
  146. package/src/hq/daemon-db.ts +8 -8
  147. package/src/hq/door.ts +3 -16
  148. package/src/hq/hq-db.ts +4 -3
  149. package/src/hq/hq-local.ts +1 -2
  150. package/src/hq/hq-store.ts +0 -15
  151. package/src/hq/item-direct.ts +8 -10
  152. package/src/hq/item-fill.ts +37 -0
  153. package/src/hq/kinds/item-gone.ts +7 -10
  154. package/src/hq/kinds/item-msg.ts +12 -18
  155. package/src/hq/kinds/item.ts +13 -19
  156. package/src/hq/kinds/report.ts +3 -4
  157. package/src/hq/owner-switch.ts +3 -3
  158. package/src/hq/report.ts +5 -9
  159. package/src/hq/switch.ts +2 -11
  160. package/src/hq/thread-sync.ts +5 -17
  161. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  162. package/src/http/owner-word.ts +1 -1
  163. package/src/identities/machine.ts +16 -0
  164. package/src/init-repo.ts +0 -1
  165. package/src/ledger/check-stats.ts +6 -5
  166. package/src/ledger/db.ts +2 -4
  167. package/src/ledger/record-kept.ts +117 -48
  168. package/src/ledger/run-log.ts +21 -2
  169. package/src/ledger/slow-tests.ts +96 -0
  170. package/src/ledger/store.ts +3 -86
  171. package/src/ledger/suite-log.ts +8 -2
  172. package/src/media-store/backup/facts.ts +3 -37
  173. package/src/media-store/backup/keys.ts +1 -8
  174. package/src/media-store/backup/manifest.ts +6 -67
  175. package/src/media-store/backup/restore.ts +4 -13
  176. package/src/media-store/backup/retention.ts +13 -1
  177. package/src/media-store/backup/run.ts +6 -267
  178. package/src/media-store/backup/snapshot.ts +2 -38
  179. package/src/media-store/backup/sources.ts +3 -113
  180. package/src/media-store/backup/target-send.ts +5 -29
  181. package/src/media-store/db.ts +8 -7
  182. package/src/media-store/forget-one.ts +1 -1
  183. package/src/media-store/forget.ts +1 -80
  184. package/src/orchestrator/guards.ts +0 -1
  185. package/src/orchestrator/presence.ts +2 -2
  186. package/src/orchestrator/routes.ts +1 -1
  187. package/src/orchestrator/started.ts +0 -9
  188. package/src/orchestrator/talk-key.ts +3 -4
  189. package/src/orchestrator/unheard.ts +1 -1
  190. package/src/plan/planner.ts +3 -2
  191. package/src/recordings/edit.ts +3 -3
  192. package/src/recordings/marks-draw.ts +17 -6
  193. package/src/recordings/marks.ts +120 -9
  194. package/src/reflections/reflections-queue.ts +3 -10
  195. package/src/release/notes.ts +1 -1
  196. package/src/release/public-clean.ts +66 -6
  197. package/src/release/run-bump.ts +11 -0
  198. package/src/release/run-release.ts +4 -0
  199. package/src/releases/from-thread.ts +3 -3
  200. package/src/releases/model.ts +186 -36
  201. package/src/releases/store.ts +13 -3
  202. package/src/releases/validate.ts +83 -0
  203. package/src/repo-config.ts +36 -64
  204. package/src/review/answer-kinds.ts +63 -4
  205. package/src/review/blocked-guard.ts +11 -0
  206. package/src/review/blocked-object.ts +298 -0
  207. package/src/review/cells.ts +144 -230
  208. package/src/review/close.ts +39 -1
  209. package/src/review/doc-save.ts +3 -2
  210. package/src/review/draft-item.ts +1 -1
  211. package/src/review/events.ts +3 -7
  212. package/src/review/expect.ts +23 -39
  213. package/src/review/format.ts +79 -46
  214. package/src/review/glyphs.ts +1 -0
  215. package/src/review/hand-over.ts +3 -3
  216. package/src/review/heard.ts +1 -1
  217. package/src/review/holds-sync.ts +2 -1
  218. package/src/review/inbox-hook.ts +2 -2
  219. package/src/review/inbox-read.ts +39 -33
  220. package/src/review/instruction-guards.ts +12 -0
  221. package/src/review/instructions.ts +0 -1
  222. package/src/review/item-db.ts +13 -43
  223. package/src/review/item-hq.ts +2 -2
  224. package/src/review/item-rows.ts +3 -14
  225. package/src/review/kind-catalog.ts +3 -1
  226. package/src/review/kinds.ts +18 -8
  227. package/src/review/live-view.ts +3 -0
  228. package/src/review/media-kind.ts +1 -1
  229. package/src/review/mentions.ts +1 -2
  230. package/src/review/model.ts +158 -114
  231. package/src/review/move.ts +149 -0
  232. package/src/review/need-threads.ts +3 -2
  233. package/src/review/object-card.ts +11 -0
  234. package/src/review/object-read.ts +6 -1
  235. package/src/review/one-block.ts +1 -1
  236. package/src/review/owner-read.ts +1 -1
  237. package/src/review/phone-push.ts +10 -9
  238. package/src/review/previews.ts +32 -4
  239. package/src/review/push.ts +2 -2
  240. package/src/review/recap.ts +129 -0
  241. package/src/review/referring.ts +6 -3
  242. package/src/review/reflection-object.ts +4 -3
  243. package/src/review/routes.ts +51 -47
  244. package/src/review/secret-route.ts +3 -2
  245. package/src/review/settle.ts +0 -6
  246. package/src/review/snooze.ts +5 -3
  247. package/src/review/speaker.ts +68 -0
  248. package/src/review/start-title.ts +19 -0
  249. package/src/review/store-parties.ts +28 -0
  250. package/src/review/store.ts +94 -59
  251. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  252. package/src/review/thread-md.ts +35 -14
  253. package/src/review/thread-state.ts +804 -0
  254. package/src/review/threads.ts +29 -347
  255. package/src/review/traces.ts +104 -7
  256. package/src/review/trailer-item.ts +1 -1
  257. package/src/review/unit.ts +7 -9
  258. package/src/review/verdict-items.ts +12 -10
  259. package/src/review/view-layout.ts +25 -1
  260. package/src/review/watch-feed.ts +1 -2
  261. package/src/review/working-guards.ts +2 -3
  262. package/src/rules/untrack-generated.ts +1 -15
  263. package/src/secrets/copy.ts +4 -4
  264. package/src/secrets/lapse.ts +2 -1
  265. package/src/serve/hub-app/advisor-app.tsx +4 -4
  266. package/src/serve/hub-app/advisor-face.tsx +9 -3
  267. package/src/serve/hub-app/advisor-host.ts +27 -27
  268. package/src/serve/hub-app/advisors-model.ts +17 -8
  269. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  270. package/src/serve/hub-app/advisors-st.ts +15 -14
  271. package/src/serve/hub-app/advisors-view.tsx +13 -11
  272. package/src/serve/hub-app/app-bridge.ts +23 -3
  273. package/src/serve/hub-app/asks-page.tsx +1 -1
  274. package/src/serve/hub-app/auto-text.tsx +71 -16
  275. package/src/serve/hub-app/check-view.tsx +0 -8
  276. package/src/serve/hub-app/controls.css +14 -3
  277. package/src/serve/hub-app/database-view.tsx +1 -2
  278. package/src/serve/hub-app/dock-st.ts +1 -1
  279. package/src/serve/hub-app/git-view.tsx +3 -1
  280. package/src/serve/hub-app/hub.css +12 -5
  281. package/src/serve/hub-app/icons.tsx +1 -1
  282. package/src/serve/hub-app/inbox-view.tsx +1 -2
  283. package/src/serve/hub-app/live-sources.ts +2 -2
  284. package/src/serve/hub-app/main-panel.tsx +2 -1
  285. package/src/serve/hub-app/panel-repo.ts +0 -9
  286. package/src/serve/hub-app/pic.tsx +29 -12
  287. package/src/serve/hub-app/polled.ts +16 -2
  288. package/src/serve/hub-app/recordings-st.ts +23 -2
  289. package/src/serve/hub-app/recordings-view.tsx +68 -10
  290. package/src/serve/hub-app/ref-pill.ts +1 -1
  291. package/src/serve/hub-app/repo-st.ts +1 -2
  292. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  293. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  294. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  295. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  296. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  297. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  298. package/src/serve/hub-app/review/kit.tsx +4 -11
  299. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  300. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  301. package/src/serve/hub-app/review/line-window.ts +4 -1
  302. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  303. package/src/serve/hub-app/review/live-view.tsx +57 -1
  304. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  305. package/src/serve/hub-app/review/question-views.tsx +191 -53
  306. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  307. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  308. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  309. package/src/serve/hub-app/review/review-host.ts +8 -4
  310. package/src/serve/hub-app/review/review-kit.ts +17 -11
  311. package/src/serve/hub-app/review/review-list.tsx +30 -35
  312. package/src/serve/hub-app/review/review-st.ts +32 -42
  313. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  314. package/src/serve/hub-app/review/review-views.tsx +127 -68
  315. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  316. package/src/serve/hub-app/review/start-st.ts +2 -5
  317. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  318. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  319. package/src/serve/hub-app/review/thread-st.ts +381 -202
  320. package/src/serve/hub-app/review/tone-bar.tsx +129 -0
  321. package/src/serve/hub-app/review/tones.ts +53 -0
  322. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  323. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  324. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  325. package/src/serve/hub-app/review.css +189 -106
  326. package/src/serve/hub-app/search-view.tsx +1 -1
  327. package/src/serve/hub-app/social/social-model.ts +0 -4
  328. package/src/serve/hub-app/source-acts.ts +2 -1
  329. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  330. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  331. package/src/serve/hub-app/thread-row.tsx +3 -4
  332. package/src/serve/hub-app/tree-build.ts +0 -4
  333. package/src/serve/hub-app/urls-view.tsx +2 -1
  334. package/src/serve/hub-app/view-layout.css +13 -3
  335. package/src/serve/hub-app/wikis-view.tsx +5 -2
  336. package/src/serve/hub-runtime.ts +7 -37
  337. package/src/serve/project-gutter-route.ts +6 -2
  338. package/src/serve/read-thread.ts +20 -2
  339. package/src/serve/read-worker.ts +9 -1
  340. package/src/serve/record-pages.ts +46 -0
  341. package/src/serve/serve-hub.ts +2 -2
  342. package/src/serve/terminal-host.ts +1 -1
  343. package/src/serve/terminal-route.ts +1 -3
  344. package/src/serve/tracked-watch.ts +1 -3
  345. package/src/setup-house.ts +2 -2
  346. package/src/shipkit-files.ts +1 -1
  347. package/src/shipkit.ts +1 -6
  348. package/src/shot/client.ts +2 -1
  349. package/src/shot/film-box.ts +0 -20
  350. package/src/shot/on-place.ts +141 -0
  351. package/src/social/drafts.ts +1 -1
  352. package/src/social/kinds.ts +6 -29
  353. package/src/social/load.ts +2 -2
  354. package/src/social/post-object.ts +3 -2
  355. package/src/social/release-stage.ts +1 -1
  356. package/src/social/stage.ts +2 -2
  357. package/src/stores/model.ts +4 -0
  358. package/src/stores/routes.ts +11 -3
  359. package/src/suite/judge-suites.ts +58 -0
  360. package/src/suite/red-alone.ts +54 -18
  361. package/src/suite/runner-shapes.ts +2 -2
  362. package/src/suite/suite-cli.ts +67 -14
  363. package/src/suite/test-units.ts +2 -1
  364. package/src/urls/fill.ts +1 -1
  365. package/src/urls/places.ts +1 -2
  366. package/src/vault/vault-config.ts +2 -2
  367. package/src/vault/vault-init.ts +1 -5
  368. package/src/wiki/graph-page.ts +14 -2
  369. package/src/advisors/copy-truth.ts +0 -49
  370. package/src/advisors/door-child.ts +0 -112
  371. package/src/advisors/door-serve.ts +0 -52
  372. package/src/advisors/door.ts +0 -118
  373. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  374. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  375. package/src/checks/SK048-one-local-file.check.ts +0 -36
  376. package/src/core/config-rewrite.ts +0 -111
  377. package/src/core/daemon-port.ts +0 -10
  378. package/src/core/legacy-shapes.ts +0 -263
  379. package/src/core/migrate-layout.ts +0 -638
  380. package/src/core/port-check-cli.ts +0 -52
  381. package/src/core/port-check-file.ts +0 -295
  382. package/src/core/port-check-files.ts +0 -31
  383. package/src/gate/discover-legacy-checks.ts +0 -26
  384. package/src/home/home-move.ts +0 -527
  385. package/src/home/machine-fold.ts +0 -810
  386. package/src/hq/item-shapes.ts +0 -54
  387. package/src/hq/kinds/items-read.ts +0 -4
  388. package/src/media-store/backup/daemon.ts +0 -220
  389. package/src/media-store/backup/kept.ts +0 -241
  390. package/src/media-store/backup/prune.ts +0 -359
  391. package/src/media-store/backup/secret.ts +0 -88
  392. package/src/media-store/backup/ssh-space.ts +0 -202
  393. package/src/media-store/backup/watch.ts +0 -117
  394. package/src/review/band.ts +0 -182
  395. package/src/review/folders.ts +0 -216
  396. package/src/review/hook-ask.ts +0 -58
  397. package/src/review/role.ts +0 -48
  398. package/src/review/thread-fold.ts +0 -64
  399. package/src/review/wait.ts +0 -91
  400. package/src/rules/rule.ts +0 -43
  401. package/src/serve/hook-thread.ts +0 -37
  402. package/src/serve/hook-work.ts +0 -92
  403. package/src/serve/hook-worker.ts +0 -57
  404. package/src/serve/hub-app/review/dock.tsx +0 -147
  405. package/src/serve/hub-app/review/faces.tsx +0 -18
  406. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  407. package/src/serve/hub-app/review/review-board.tsx +0 -48
  408. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,6 +1,8 @@
1
1
  // what an agent asks of the owner in a thread, answered in one click (wiki tools/shipkit/threads.md, A question, A proposed
2
2
  // change): a question's options, each words or a media drawn as a view, and a proposed change, each field drawn by its
3
- // type and applied alone. The owner's words go with the click; words with no click answer « none of these »
3
+ // type and applied alone. A question answers in question words, never a verdict's (tones.ts questionTones): a click on an
4
+ // option picks it, its pencil picks it with the owner's remark; under the options one row, none of these in the owner's words,
5
+ // your call, no answer (tone-bar.tsx)
4
6
  import { observer } from 'mobx-react-lite'
5
7
  import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
6
8
  import type { PersonPick, ReplyCell } from '../../../review/cells.ts'
@@ -11,6 +13,8 @@ import { AutoText } from '../auto-text.tsx'
11
13
  import { renderMdInline } from '../md.ts'
12
14
  import { WordsInline } from '../words.tsx'
13
15
  import { keepFocus } from './kit.tsx'
16
+ import { ToneBar, ToneMark } from './tone-bar.tsx'
17
+ import { questionToneClass, questionTones, toneOfStatus, type Tone } from './tones.ts'
14
18
  import type { ReviewSt } from './review-st.ts'
15
19
  import { secretFacts } from './secret-facts.ts'
16
20
  import { ReadableLine } from '../secret-readable.tsx'
@@ -22,12 +26,19 @@ import { tip } from '../tips.ts'
22
26
 
23
27
  type Field = NonNullable<ReplyCell['propose']>['fields'][number]
24
28
 
25
- /** an option's or a field's media, a view of the item the message sits on, drawn read only */
26
- const MessageView = observer(({ rv, thread, c, i }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; i: number }) => {
27
- const version = thread.versionOf(c.on)
29
+ /** his answer in words alone as the question's row names it: none of these unless he named your call or no answer */
30
+ const questionAnswerTone = (tone: string | undefined): Tone => {
31
+ const row = questionTones('row', null)
32
+ return row.find((t) => t.status === tone) ?? row[0]!
33
+ }
34
+
35
+ /** an option's or a field's media, a view of the item the message sits on, drawn read only; an option's name is its
36
+ * button's, so its view draws no caption of its own (`named`) */
37
+ const MessageView = observer(({ rv, thread, c, i, named = true }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; i: number; named?: boolean }) => {
38
+ const version = thread.holderOf(c.on)
28
39
  const v = version?.item.views[i]
29
40
  if (!version || !v) return <div className="rv-dim">the media is gone from the store</div>
30
- return <ViewCell ver={{ rv, thread, cell: version, live: false, claim: false }} v={v} i={i} noted={false} />
41
+ return <ViewCell ver={{ rv, thread, cell: version, live: false }} v={v} i={i} noted={false} named={named} />
31
42
  })
32
43
 
33
44
  /** each person's pick on a choice question (their vote, or the answer their right « he picks for you » gave), with his
@@ -56,7 +67,7 @@ const PickLines = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Thre
56
67
  <span className="rv-pickstate">sending…</span>
57
68
  ) : local.state === 'failed' ? (
58
69
  <span className="rv-pickstate err">
59
- ✗ not sent: {local.why} <button className="ghost" {...tip('send this pick again')} onMouseDown={keepFocus} onClick={() => void thread.answer(c, { option: local.option })}>retry</button>
70
+ ✗ not sent: {local.why} <button className="ghost" {...tip('send this pick again')} onMouseDown={keepFocus} onClick={() => void thread.pickOption(c, local.option, local.remark)}>retry</button>
60
71
  </span>
61
72
  ) : null
62
73
  const picks = picksOf(rv, thread, c, ask)
@@ -114,10 +125,11 @@ const PickLines = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Thre
114
125
  )
115
126
  })
116
127
 
117
- /** an agent's question: one button per option, its media over it, its pick marked as a suggestion; one click answers,
118
- * the words box goes with it, and words alone say none of them. Answered, the owner's answer is the selected one: the
119
- * option clicked, or the owner's words alone as one more option at the row's end. A person's pick shows in the question's
120
- * lines (PickLines), never above the thread */
128
+ /** an agent's question, answered in question words (tones.ts questionTones): a click on an option picks it; its « pick
129
+ * with a remark » mark opens a box under it, the option and the owner's words sent together; the row under the options
130
+ * answers none of these in the owner's words, your call, or no answer. Its media over each option, the agent's pick marked as
131
+ * a suggestion. Answered, his answer is the one lit in its tone, his remark under its option. A person's pick shows in
132
+ * the question's lines (PickLines), never above the thread */
121
133
  export const AskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; ask: NonNullable<ReplyCell['ask']> }) => {
122
134
  if (ask.kind !== undefined && ask.kind !== 'choice') return <KindAskBody rv={rv} thread={thread} c={c} ask={ask} />
123
135
  const advisor = rv.host.role === 'advisor'
@@ -129,82 +141,177 @@ export const AskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread:
129
141
  const answered = his !== null
130
142
  const media = ask.views?.some((v) => v !== null) === true
131
143
  const words = (thread.hints[c.id] ?? '').trim() !== ''
132
- const local = thread.picking[c.id]
133
144
  // the option marked as the reader's: their click on its way, else their own pick (his, on his hub)
134
- const yours = local !== undefined && local.state !== 'failed' ? local.option : advisor ? own?.option : ask.ownerPick ?? (ask.answered?.by === undefined && his !== null && 'option' in his ? his.option : undefined)
145
+ const yours = thread.yours(c)
135
146
  const mine = (i: number): boolean => yours === i
136
- const button = (o: string, i: number) => (
147
+ const remark = thread.yourRemark(c)
148
+ const tone = (i: number): string => (mine(i) ? (remark !== '' ? ' picked remark' : ' picked') : '')
149
+ const live = done === undefined && !c.superseded
150
+ const remarking = live ? thread.remarking[c.id] : undefined
151
+ // the agent's pick and the reader's own: in the option's button, or on its foot row under a picture
152
+ const pills = (i: number) => (
153
+ <>
154
+ {ask.pick === i ? <span className="rv-mypick" {...tip("the agent's suggestion, never your answer")}>my pick</span> : null}
155
+ {mine(i) ? <span className="rv-yours" {...tip(remark !== '' ? 'your pick, with your remark under it' : 'your pick')}>✓ yours</span> : null}
156
+ </>
157
+ )
158
+ const button = (o: string, i: number, withPills = true) => (
137
159
  <button
138
160
  key={i}
139
- className={`rv-askopt${mine(i) ? ' picked' : ''}${ask.pick === i && !answered ? ' pick' : ''}`}
161
+ className={`rv-askopt${tone(i)}${ask.pick === i && !answered ? ' pick' : ''}`}
140
162
  // never disabled while a click is on its way: the next click waits its turn (thread-st.ts pickOption)
141
163
  disabled={done !== undefined}
142
164
  onMouseDown={keepFocus}
143
165
  onClick={() => void thread.answer(c, { option: i })}
144
- {...tip(done !== undefined ? null :`answer with this option, and your words with it if you wrote some${ask.pick === i ? "\nthe agent's own pick" : ''}`)}
166
+ {...tip(done !== undefined ? null : `pick this option${ask.pick === i ? "\nthe agent's own pick" : ''}`)}
145
167
  >
146
168
  <span className="rv-askn">{i + 1}</span>
147
169
  <span className="rv-askoptlabel mdi" dangerouslySetInnerHTML={{ __html: renderMdInline(o) }} />
148
- {ask.pick === i ? <span className="rv-mypick" {...tip("the agent's suggestion, never your answer")}>my pick</span> : null}
149
- {mine(i) ? <span className="rv-yours">✓ yours</span> : null}
170
+ {withPills ? pills(i) : null}
150
171
  </button>
151
172
  )
173
+ // the orange face beside an option: « pick it, with my words », the box under it
174
+ const remarkFace = (i: number) =>
175
+ live ? (
176
+ <button type="button" className={`rv-askremark${remarking === i ? ' open' : ''}`} aria-label={`pick ${i + 1} with a remark`} aria-expanded={remarking === i} data-check="pick-remark"
177
+ {...tip(`pick ${i + 1} with a remark: a box opens for your words, and the agent reads the option and your words together`)} onMouseDown={keepFocus}
178
+ onClick={() => thread.setRemarking(c.id, remarking === i ? null : i)}>
179
+ <span className="st-remark"><ToneMark t={toneOfStatus('approved-with-fix')!} /></span>
180
+ </button>
181
+ ) : null
182
+ const choice = (o: string, i: number) => (
183
+ <span key={i} className={`rv-askchoice${tone(i)}`}>
184
+ {button(o, i)}
185
+ {remarkFace(i)}
186
+ </span>
187
+ )
188
+ const remarkBox = remarking !== undefined && remarking < ask.options.length ? <RemarkBox thread={thread} c={c} i={remarking} /> : null
189
+ const remarkSaid = (i: number) => (mine(i) && remark !== '' ? <div className="rv-askremarksaid" {...tip('your remark with this pick')}>« {remark} »</div> : null)
190
+ // his answer in words alone, in the question's words: none of these (an older wrong direction too), your call, no answer
191
+ const given = questionAnswerTone(ask.tone)
152
192
  const said = his !== null && 'words' in his ? (
153
- <button key="words" className="rv-askopt picked words" disabled {...tip(`your answer, in your words: « ${his.words} »`)}>
154
- <span className="rv-askoptlabel">« {his.words} »</span>
193
+ <button key="words" className={`rv-askopt picked none words ${questionToneClass(given.status)}`} disabled {...tip(`your answer, ${given.word}: « ${his.words} »`)}>
194
+ <span className="rv-asknonelabel"><ToneMark t={given} /> {given.word}</span>
195
+ {his.words !== given.word && his.words !== toneOfStatus(given.status)?.word ? <span className="rv-askoptlabel">« {his.words} »</span> : null}
155
196
  <span className="rv-yours">✓ yours</span>
156
197
  </button>
157
198
  ) : null
199
+ // the question's row under the options (tone-bar.tsx): none of these in the owner's words, your call (the agent's
200
+ // pick), no answer; a pick is a click on its option. A step of an ask's instructions keeps its words
201
+ const bar = c.step === undefined && !c.superseded ? <ToneBar thread={thread} on={c.id} question={c} pick={ask.pick !== undefined ? (ask.options[ask.pick] ?? `option ${ask.pick + 1}`) : null} /> : null
202
+ // a step's escape hatch: « none of these », the owner's words instead of an option. Answered in words, it holds the
203
+ // words, selected
204
+ const none = said ?? (answered || c.superseded || bar !== null ? null : (
205
+ <div key="none" className="rv-asknone">
206
+ <span className="rv-asknonelabel st-rework"><ToneMark t={toneOfStatus('rework')!} /> none of these</span>
207
+ <div className="rv-answerrow">
208
+ <AnswerWords thread={thread} c={c} placeholder="say why, or what to try instead" />
209
+ {!done && words ? (
210
+ <button className="primary rv-send rv-answersend" disabled={thread.busy} {...tip('send these words as your answer: none of these options')} onMouseDown={keepFocus} onClick={() => void thread.noneOf(c)}>
211
+ send
212
+ </button>
213
+ ) : null}
214
+ </div>
215
+ </div>
216
+ ))
158
217
  return (
159
218
  <div className="rv-ask">
160
- {answered || c.superseded ? null : (
161
- // the words and their own send on one row: words alone answer it, words then an option go with that option
162
- <div className="rv-answerrow">
163
- <AnswerWords thread={thread} c={c} placeholder="your answer in words, or a word, then an option below" />
164
- {!done && words ? (
165
- <button className="primary rv-send rv-answersend" disabled={thread.busy} {...tip('send these words as your answer, with no option picked; to go with an option, click the option instead')} onMouseDown={keepFocus} onClick={() => void thread.noneOf(c)}>
166
- send
167
- </button>
168
- ) : null}
169
- </div>
170
- )}
171
219
  {media ? (
172
220
  <div className="rv-askmedia">
173
221
  {ask.options.map((o, i) => (
174
- <div key={i} className={`rv-askoption${mine(i) ? ' picked' : ''}${ask.pick === i && !answered ? ' pick' : ''}`}>
175
- {ask.views?.[i] != null ? <MessageView rv={rv} thread={thread} c={c} i={ask.views[i]!} /> : null}
176
- {button(o, i)}
222
+ <div key={i} className={`rv-askoption${tone(i)}${ask.pick === i && !answered ? ' pick' : ''}`}>
223
+ {/* a compact column: its picture (a click opens the lightbox on it, its side panel on this
224
+ option), its number and label, then « pick with a remark » and the pills on one row */}
225
+ {ask.views?.[i] != null ? <MessageView rv={rv} thread={thread} c={c} i={ask.views[i]!} named={false} /> : null}
226
+ {button(o, i, false)}
227
+ <div className="rv-askoptfoot">
228
+ {remarkFace(i)}
229
+ {pills(i)}
230
+ </div>
231
+ {remarking === i ? remarkBox : remarkSaid(i)}
177
232
  </div>
178
233
  ))}
234
+ {none ? <div className={`rv-askoption rv-askoptnone${said ? ' picked none' : ''}`}>{none}</div> : null}
179
235
  </div>
180
236
  ) : (
181
237
  <div className="rv-askopts">
182
- {ask.options.map(button)}
183
- {said}
238
+ {ask.options.map(choice)}
239
+ {remarkBox ?? (yours !== undefined ? remarkSaid(yours) : null)}
240
+ {none}
184
241
  </div>
185
242
  )}
186
- {media && said ? <div className="rv-askopts">{said}</div> : null}
243
+ {bar}
187
244
  <PickLines rv={rv} thread={thread} c={c} ask={ask} />
188
245
  </div>
189
246
  )
190
247
  })
191
248
 
249
+ /** the box of « pick with a remark » under option `i`: the owner's words, then « pick i with this remark » (or ⌘↵) sends the
250
+ * option and the words as one answer; Escape closes it, its words kept until sent */
251
+ const RemarkBox = observer(({ thread, c, i }: { thread: ThreadSt; c: ReplyCell; i: number }) => {
252
+ const box = thread.remarkBox(c)
253
+ const words = (thread.hints[box] ?? '').trim()
254
+ const send = (): void => {
255
+ if (words !== '') void thread.pickOption(c, i, words)
256
+ }
257
+ return (
258
+ <div className="rv-askremarkbox">
259
+ <AutoText className="rv-answerwords" autoFocus placeholder={`your remark with ${i + 1}: what to change, what to keep`} aria-label={`your remark with option ${i + 1}`} value={thread.hints[box] ?? ''} onText={(t) => thread.setHint(box, t)}
260
+ onKeyDown={answerKeys(send, () => thread.setRemarking(c.id, null))} />
261
+ <button type="button" className="rv-askremarksend" data-check="pick-remark-send" disabled={words === ''} {...tip(`pick ${i + 1}, with these words: the agent reads both`, '⌘↵')} onMouseDown={keepFocus} onClick={send}>
262
+ pick {i + 1} with this remark
263
+ </button>
264
+ </div>
265
+ )
266
+ })
267
+
268
+ /** a question with a row per thing (`sk thread ask --row`), drawn from its first row as one question: « 3 of 8 answered », then a row
269
+ * per thing, its name over its options side by side and « none of these », the agent's pick marked; one click or words
270
+ * answer that row alone */
271
+ export const RowsBody = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) => {
272
+ const rows = thread.rowsOf(c)
273
+ const answered = (r: ReplyCell): boolean => r.ask?.answered !== undefined || r.ask?.none !== undefined
274
+ const done = rows.filter(answered).length
275
+ return (
276
+ <div className="rv-askrows">
277
+ <div className={`rv-checkcount${done === rows.length ? ' all' : ''}`}>{done === rows.length ? `✓ all ${rows.length} answered` : `${done} of ${rows.length} answered`}</div>
278
+ {rows.map((r) => (
279
+ <div key={r.id} className={`rv-askrow${answered(r) ? ' answered' : ''}`} id={`rv-row-${r.id.replace(/[^A-Za-z0-9-]/g, '_')}`}>
280
+ <div className="rv-askrowlabel mdi" dangerouslySetInnerHTML={{ __html: renderMdInline(r.ask!.row!.label) }} />
281
+ <AskBody rv={rv} thread={thread} c={r} ask={r.ask!} />
282
+ </div>
283
+ ))}
284
+ </div>
285
+ )
286
+ })
287
+
192
288
  type CellAsk = NonNullable<ReplyCell['ask']>
193
289
 
194
290
  /** a question of another answer kind (wiki tools/shipkit/threads-asks.md, Answer kinds): a checklist's boxes, a confirm's
195
291
  * « done », a text's or a url's field, a secret's place; the owner's words alone answer it as none, or ride on a checklist */
196
292
  const KindAskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
197
293
  const words = (thread.hints[c.id] ?? '').trim() !== ''
294
+ // answered with the owner's words alone: they stand where its control stood, in green, never over the question
295
+ const inWords = ask.none !== undefined && ask.kind !== 'checklist' && !ask.open
296
+ // a confirm, a text or a url: its own control, then the question's row (your call on a text or a url, no answer), kept once answered
297
+ // so the question keeps its layout, as a choice keeps its row
298
+ const row = thread.questionCell(c.id) !== undefined && !c.superseded ? <ToneBar thread={thread} on={c.id} question={c} pick={null} /> : null
299
+ const toned = inWords && ask.tone !== undefined ? questionAnswerTone(ask.tone) : null
198
300
  return (
199
301
  <div className={`rv-ask rv-ask-${ask.kind}`}>
200
302
  {ask.kind === 'checklist' ? <Checklist thread={thread} c={c} ask={ask} /> : null}
201
- {ask.kind === 'confirm' ? <Confirm thread={thread} c={c} ask={ask} /> : null}
202
- {ask.kind === 'text' || ask.kind === 'url' ? <ValueField thread={thread} c={c} ask={ask} /> : null}
303
+ {ask.kind === 'confirm' && !inWords ? <Confirm thread={thread} c={c} ask={ask} /> : null}
304
+ {(ask.kind === 'text' || ask.kind === 'url') && !inWords ? <ValueField thread={thread} c={c} ask={ask} /> : null}
203
305
  {ask.kind === 'secret' ? <SecretPlace rv={rv} thread={thread} c={c} ask={ask} /> : null}
204
- {ask.kind === 'file' ? <div className="rv-dim">{ask.value ? `his file: view ${(ask.value.view ?? 0) + 1}` : 'a file he drops: not built in the hub yet'}</div> : null}
205
- {/* answered, the cell's head says the owner's words */}
206
- {ask.none !== undefined && thread.waitsNow(c.id) ? <div className="rv-dim">answered in words: « {ask.none} »</div> : null}
207
- {(ask.open || ask.kind === 'checklist') && ask.kind !== 'secret' && !c.superseded ? (
306
+ {ask.kind === 'file' && !inWords ? <div className="rv-dim">{ask.value ? `his file: view ${(ask.value.view ?? 0) + 1}` : 'a file he drops: not built in the hub yet'}</div> : null}
307
+ {inWords && toned !== null ? null : inWords ? (
308
+ <div className="rv-askfield rv-askvalue given">
309
+ <AutoText className="rv-answerwords rv-askgiven" readOnly value={ask.none ?? ''} onText={() => undefined} />
310
+ <button className="rv-askopt pick picked" disabled {...tip('your answer, in your words')}>✓ in your words</button>
311
+ </div>
312
+ ) : null}
313
+ {/* a text question's field already takes words: a second box would ask the same thing */}
314
+ {(ask.open || ask.kind === 'checklist') && ask.kind !== 'secret' && ask.kind !== 'text' && !c.superseded ? (
208
315
  <div className="rv-askwords">
209
316
  <AnswerWords thread={thread} c={c} placeholder={ask.kind === 'checklist' ? 'a word on these steps (optional)' : 'or answer with words alone'} />
210
317
  {words ? (
@@ -214,6 +321,7 @@ const KindAskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Th
214
321
  ) : null}
215
322
  </div>
216
323
  ) : null}
324
+ {row}
217
325
  </div>
218
326
  )
219
327
  })
@@ -253,26 +361,38 @@ const Confirm = observer(({ thread, c, ask }: { thread: ThreadSt; c: ReplyCell;
253
361
  const ValueField = observer(({ thread, c, ask }: { thread: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
254
362
  const box = thread.fieldBox(c, 'value')
255
363
  const value = thread.hints[box] ?? ''
256
- if (ask.value && !ask.open)
364
+ const local = thread.giving[c.id]
365
+ // given, his value stands in the field's own frame, green, the button's place « ✓ given »: the question never moves.
366
+ // At his click it stands so already, the store's write behind it; a url's line says what the hub's try of it answered
367
+ const given = ask.value && !ask.open ? { text: ask.value.text, tip: `your answer, given ${new Date(ask.value.at).toLocaleString()}`, opens: ask.value.opens ? `opens (${ask.value.opens})` : 'did not open from this Mac' } : local?.state === 'sending' ? { text: local.value, tip: 'your answer, on its way', opens: 'trying it from this Mac…' } : null
368
+ if (given)
257
369
  return (
258
- <div className="rv-askvalue">
259
- <span className="rv-badge">✓ given</span> {ask.kind === 'url' ? <a href={ask.value.text} target="_blank" rel="noreferrer noopener">{ask.value.text}</a> : <span className="rv-valuetext">{ask.value.text}</span>}
260
- {ask.kind === 'url' ? <span className="rv-dim">{ask.value.opens ? ` opens (${ask.value.opens})` : ' did not open from this Mac'}</span> : null}
370
+ <div className="rv-askfield rv-askvalue given">
371
+ {ask.kind === 'url' ? (
372
+ <a className="rv-askgiven url" href={given.text} target="_blank" rel="noreferrer noopener">{given.text}</a>
373
+ ) : (
374
+ <AutoText className="rv-answerwords rv-askgiven" readOnly value={given.text} onText={() => undefined} />
375
+ )}
376
+ <button className="rv-askopt pick picked" disabled {...tip(given.tip)}>✓ given</button>
377
+ {ask.kind === 'url' ? <span className="rv-dim rv-askopens">{given.opens}</span> : null}
261
378
  </div>
262
379
  )
263
- const send = (): void => void thread.answer(c, { value })
380
+ const send = (): void => void thread.give(c, value)
264
381
  const bad = ask.kind === 'url' && value.trim() !== '' && !/^https?:\/\/\S+$/.test(value.trim())
382
+ const ready = value.trim() !== '' && !bad
383
+ const keys = answerKeys(() => ready && send())
265
384
  return (
266
385
  <div className="rv-askfield">
267
386
  {ask.kind === 'url' ? (
268
- <input type="url" value={value} placeholder="https://…" spellCheck={false} onChange={(e) => thread.setHint(box, e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter' && !bad) send() }} />
387
+ <input type="url" value={value} placeholder="https://…" spellCheck={false} onChange={(e) => thread.setHint(box, e.target.value)} onKeyDown={(e) => (e.key === 'Enter' && !e.metaKey && !e.ctrlKey ? ready && send() : keys(e))} />
269
388
  ) : (
270
- <AutoText className="rv-answerwords" value={value} placeholder="your answer" onText={(t) => thread.setHint(box, t)} />
389
+ <AutoText className="rv-answerwords" value={value} placeholder="your answer" onText={(t) => thread.setHint(box, t)} onKeyDown={keys} />
271
390
  )}
272
- <button className="rv-askopt pick" disabled={thread.busy || value.trim() === '' || bad} {...tip(ask.kind === 'url' ? 'answer with this link: the hub opens it once to check that it loads' : 'answer with these words', ask.kind === 'url' ? '⏎' : null)} onMouseDown={keepFocus} onClick={send}>
391
+ <button className="rv-askopt pick" disabled={!ready} {...tip(ask.kind === 'url' ? 'answer with this link: the hub opens it once to check that it loads' : 'answer with these words', ask.kind === 'url' ? '⏎' : '⌘↵')} onMouseDown={keepFocus} onClick={send}>
273
392
  send
274
393
  </button>
275
394
  {bad ? <div className="rv-dim">a link starts with https:// or http://</div> : null}
395
+ {local?.state === 'failed' ? <div className="rv-pickstate err">✗ not sent: {local.why}</div> : null}
276
396
  </div>
277
397
  )
278
398
  })
@@ -466,7 +586,7 @@ export const ProposeBody = observer(({ rv, thread, c, p }: { rv: ReviewSt; threa
466
586
  <>
467
587
  <FieldDiff rv={rv} thread={thread} c={c} f={one} />
468
588
  {p.open && !one.applied && apply ? <FieldEdit thread={thread} c={c} f={one} /> : null}
469
- <div className="rv-askopts">{p.open || one.applied ? (apply ? <ApplyButton thread={thread} c={c} f={one} /> : null) : <span className="rv-badge">answered in words</span>}</div>
589
+ <div className="rv-askopts">{p.open || one.applied ? (apply ? <ApplyButton thread={thread} c={c} f={one} /> : null) : p.none !== undefined ? <span className="rv-badge" {...tip(p.none)}>answered in words</span> : null}</div>
470
590
  </>
471
591
  ) : (
472
592
  <div className="rv-fieldtable">
@@ -514,7 +634,25 @@ const DiffPage = ({ rv, c, page, on }: { rv: ReviewSt; c: ReplyCell; page: strin
514
634
  return <iframe ref={ref} className="rv-diffpage" title={`${page}: the change`} src={`${rv.url(`/page/${page}/`)}?${keys}`} />
515
635
  }
516
636
 
517
- /** the words that go with an answer: the hint box of the cell, kept per cell until sent */
637
+ /** the one key of every answer field of a question, as in the reply box: ⌘↵ (Ctrl+↵) sends what the field holds;
638
+ * Escape runs `close` where the field closes */
639
+ export const answerKeys =
640
+ (send: () => void, close?: () => void) =>
641
+ (e: React.KeyboardEvent): void => {
642
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && !e.nativeEvent.isComposing) {
643
+ e.preventDefault()
644
+ e.stopPropagation()
645
+ send()
646
+ } else if (e.key === 'Escape' && close) {
647
+ e.preventDefault()
648
+ close()
649
+ }
650
+ }
651
+
652
+ /** the words that go with an answer: the hint box of the cell, kept per cell until sent; ⌘↵ sends them alone */
518
653
  export const AnswerWords = observer(({ thread, c, placeholder }: { thread: ThreadSt; c: ReplyCell; placeholder: string }) => (
519
- <AutoText className="rv-answerwords" placeholder={placeholder} value={thread.hints[c.id] ?? ''} onText={(t) => thread.setHint(c.id, t)} />
654
+ <AutoText className="rv-answerwords" placeholder={placeholder} value={thread.hints[c.id] ?? ''} onText={(t) => thread.setHint(c.id, t)}
655
+ onKeyDown={answerKeys(() => {
656
+ if ((thread.hints[c.id] ?? '').trim() !== '' && !thread.busy) void thread.noneOf(c)
657
+ })} />
520
658
  ))
@@ -0,0 +1,40 @@
1
+ // « recap » on a thread's head (wiki tools/shipkit/threads.md, A recap): the owner's request, posted in the thread for the
2
+ // agent that holds it, never a recap written here. While it stands, or while a recap waits on the owner's verdict, it says so
3
+ import { observer } from 'mobx-react-lite'
4
+ import { useState } from 'react'
5
+ import { HeadBtn } from './kit.tsx'
6
+ import { postJson } from './review-kit.ts'
7
+ import type { ReviewSt } from './review-st.ts'
8
+ import { tip } from '../tips.ts'
9
+ import type { ThreadSt } from './thread-st.ts'
10
+
11
+ /** `menu`: drawn as a row of the head's « more » popover, `done` closes it */
12
+ export const RecapBar = observer(({ rv, thread, menu }: { rv: ReviewSt; thread: ThreadSt; menu?: { done: () => void } }) => {
13
+ const v = thread.data
14
+ const [busy, setBusy] = useState(false)
15
+ const [err, setErr] = useState<string | null>(null)
16
+ if (!v) return null
17
+ const r = v.state.recap
18
+ if (r?.waits) return <span className="rv-recapbar on" role="status" {...tip('the recap waits on your verdict, in the thread: accepted, the thread reads from it on')}>▤ recap to judge</span>
19
+ if (r?.asked) return <span className="rv-recapbar on" role="status" {...tip('your request waits for the agent that holds the thread')}>▤ recap asked</span>
20
+ const ask = async (): Promise<void> => {
21
+ setBusy(true)
22
+ setErr(null)
23
+ try {
24
+ await postJson(rv.url(`/api/review/${v.head}/recap`), {})
25
+ await thread.refresh()
26
+ void rv.answered()
27
+ } catch (e) {
28
+ setErr((e as Error).message)
29
+ } finally {
30
+ setBusy(false)
31
+ }
32
+ }
33
+ if (menu) return <button type="button" className="rv-menuitem" disabled={busy} {...tip('ask the agent that holds it for a recap you judge: once you accept it, the thread reads from it on')} onClick={() => { menu.done(); void ask() }}>▤ ask for a recap</button>
34
+ return (
35
+ <span className="rv-recapbar">
36
+ <HeadBtn className="rv-quiet" disabled={busy} says="recap" more="ask the agent that holds it for a recap you judge: once you accept it, the thread reads from it on, the history one click away" onClick={() => void ask()}>▤<span className="rv-btnw"> recap</span></HeadBtn>
37
+ {err ? <span className="err">✗ {err}</span> : null}
38
+ </span>
39
+ )
40
+ })
@@ -0,0 +1,48 @@
1
+ // a question, a proposed change or an ask's instructions at its place in the timeline (wiki tools/shipkit/threads-page.md,
2
+ // The timeline): the item whole, its words wrapped and its controls under them (a question's options with the agent's
3
+ // pick, an ask's instructions with their boxes, a checklist, a field, a secret). Nothing sits between the timeline and his
4
+ // reply box: the arrows at the column's top count what waits above
5
+ import { observer } from 'mobx-react-lite'
6
+ import type { ReplyCell } from '../../../review/cells.ts'
7
+ import { AskBody, ProposeBody, RowsBody } from './question-views.tsx'
8
+ import { InstructionsBody } from './instructions-view.tsx'
9
+ import { Cta } from './cta.tsx'
10
+ import { Words } from '../words.tsx'
11
+ import type { ReviewSt } from './review-st.ts'
12
+ import { requestState, type ThreadSt } from './thread-st.ts'
13
+
14
+ /** the question or the change itself, as it answers */
15
+ const RequestBody = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) =>
16
+ c.ask?.row ? <RowsBody rv={rv} thread={thread} c={c} /> : c.ask ? <AskBody rv={rv} thread={thread} c={c} ask={c.ask} /> : c.propose ? <ProposeBody rv={rv} thread={thread} c={c} p={c.propose} /> : null,
17
+ )
18
+
19
+ /** a question or a change at its place in the timeline, where he answers it: whole, its words wrapped and its controls
20
+ * under them; an ask's instructions with a box on each step; once answered, his answer in its control. Superseded: read
21
+ * only. Its words go read with the thread (review/owner-read.ts) */
22
+ export const RequestCell = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) => {
23
+ if (c.instructions && c.ask) return <InstructionsBody rv={rv} thread={thread} c={c} live={!c.superseded} />
24
+ // a question with a row per thing waits by its first row while any row does (ThreadSt.openRequests)
25
+ const waiting = thread.waitsNow(c.id)
26
+ // answered, it keeps its layout: the owner's answer draws in place, in its control (the option lit, « ✓ given », the owner's words),
27
+ // never moved or said again over the question; the green edge says answered, the trace line under it records it
28
+ return (
29
+ <div className={`rv-requestcell ${requestState(c, waiting)}`}>
30
+ {/* asked before the close and never answered: it waits on nobody (review/thread-state.ts mootAt) */}
31
+ {!c.superseded && !waiting && c.moot ? (
32
+ <div className="rv-requestline">
33
+ <span className="rv-requestanswer">closed, not answered</span>
34
+ </div>
35
+ ) : null}
36
+ {c.text.trim() !== '' ? <Words text={c.text} className="rv-words" /> : null}
37
+ {c.superseded ? (
38
+ <fieldset disabled className="rv-readonly">
39
+ <RequestBody rv={rv} thread={thread} c={c} />
40
+ </fieldset>
41
+ ) : (
42
+ <Cta on={waiting}>
43
+ <RequestBody rv={rv} thread={thread} c={c} />
44
+ </Cta>
45
+ )}
46
+ </div>
47
+ )
48
+ })