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,64 +0,0 @@
1
- // the fold of a store's threads that own one address into one (wiki tools/shipkit/threads-store.md, The one thread
2
- // guard): in the order of their newest versions, the oldest version of each later thread supersedes the newest version
3
- // of the one before. Only a missing link is written, through the head's one rewrite path, so a second run finds
4
- // nothing and every message stays where it was
5
- import { ownAddressOf, type ReviewItem, type Spec } from './model.ts'
6
- import { readAll, specOf, updateHead } from './store.ts'
7
- import { ownAddressesOf, threadsOf, type Thread } from './threads.ts'
8
-
9
- /** one link the fold writes: `id` supersedes `supersedes` (the newest of the thread before); `was`: the version it
10
- * superseded before, on a fork the one the two heads share, and the write holds only while it still does */
11
- export interface FoldLink {
12
- address: string
13
- id: string
14
- supersedes: string
15
- was?: string
16
- }
17
-
18
- const created = (t: Thread): string => t.head.item.created
19
-
20
- /** a trailer thread whose every version names exactly one shot: a refilm of that shot he judged alone, its own subject */
21
- const oneShot = (t: Thread): boolean => t.versions.every((v) => v.item.trailer !== undefined && v.item.trailer.shots.length === 1)
22
-
23
- /** the links that make each address one thread, pure: agents' threads only; a note joins at read time already. A
24
- * thread whose oldest version a link already names is left; two heads that share older versions (a fork) are folded:
25
- * the later head's first version of its own supersedes the other head in place of the version they share */
26
- export function foldPlan(items: readonly ReviewItem[], spec: Spec): FoldLink[] {
27
- const by = new Map<string, Thread[]>()
28
- for (const t of threadsOf(items, spec)) {
29
- if (t.head.item.origin.by !== 'agent' || oneShot(t)) continue
30
- const a = ownAddressOf(t.head.item, spec) ?? ownAddressesOf(t, spec)[0]
31
- if (a === undefined) continue
32
- by.set(a, [...(by.get(a) ?? []), t])
33
- }
34
- const out: FoldLink[] = []
35
- for (const [address, ts] of by) {
36
- if (ts.length < 2) continue
37
- const sorted = [...ts].sort((a, b) => created(a).localeCompare(created(b)) || a.head.item.id.localeCompare(b.head.item.id))
38
- for (let i = 1; i < sorted.length; i++) {
39
- const prev = sorted[i - 1]!
40
- const cur = sorted[i]!
41
- const shared = new Set(prev.versions.map((v) => v.item.id))
42
- const own = [...cur.versions].reverse().find((v) => !shared.has(v.item.id))
43
- if (own === undefined) continue
44
- const was = own.item.supersedes
45
- if (was !== undefined && shared.has(was)) {
46
- if (was !== prev.head.item.id) out.push({ address, id: own.item.id, supersedes: prev.head.item.id, was })
47
- continue
48
- }
49
- if (was === undefined) out.push({ address, id: own.item.id, supersedes: prev.head.item.id })
50
- }
51
- }
52
- return out
53
- }
54
-
55
- /** the plan of a store and, with `go`, each link written; the threads before and after */
56
- export function foldStore(dir: string, o: { go: boolean }): { links: FoldLink[]; before: number; after: number } {
57
- const spec = specOf(dir)
58
- const items = readAll(dir).items
59
- const links = foldPlan(items, spec)
60
- const before = threadsOf(items, spec).length
61
- if (!o.go) return { links, before, after: before - links.length }
62
- for (const l of links) updateHead(dir, l.id, (cur) => (cur.supersedes === l.was ? { ...cur, supersedes: l.supersedes } : cur))
63
- return { links, before, after: threadsOf(readAll(dir).items, spec).length }
64
- }
@@ -1,91 +0,0 @@
1
- // what a thread waits on from him (wiki tools/shipkit/threads-how-it-fits.md, The model): one verb of his turn, else
2
- // whose hands. Never a type of the thread: its open objects decide, in the dock's order. A row's badge reads the first
3
- // (`waitOf`); the filters and their counts read every verb its open objects ask (`verbsOf`, `waitsMatch`)
4
- import { kindOfAsk } from './answer-kinds.ts'
5
- import type { MessageType } from './glyphs.ts'
6
- import { isClosedAskState, moveOf, stateOf, type Message } from './model.ts'
7
- import { heldOpen, holdMoveOf } from './holds.ts'
8
- import { askFactsOf, askStateOf, headWaits, membersOf, openAsksOf, openItemVerdictsOf, turnOf, type Thread } from './threads.ts'
9
-
10
- export const WAITS = ['judge', 'answer', 'do', 'agents', 'done'] as const
11
- export type Wait = (typeof WAITS)[number]
12
- /** the verbs of his turn */
13
- export const OWNER_WAITS = ['judge', 'answer', 'do'] as const satisfies readonly Wait[]
14
- export type OwnerWait = (typeof OWNER_WAITS)[number]
15
- export const isOwnerWait = (w: string): w is OwnerWait => (OWNER_WAITS as readonly string[]).includes(w)
16
-
17
- /** a url's `waits=judge,answer` (the inbox's key): the owner's verbs it names, null when it names none */
18
- export function waitsOfParam(v: string | null): OwnerWait[] | null {
19
- const ws = OWNER_WAITS.filter((w) => (v ?? '').split(',').includes(w))
20
- return ws.length > 0 ? ws : null
21
- }
22
-
23
- const DO_ANSWERS: ReadonlySet<string> = new Set(['checklist', 'url', 'secret', 'file'])
24
- const DO_ASKS: ReadonlySet<string> = new Set(['action', 'purchase', 'credential'])
25
-
26
- /** an ask's own record: an action, a purchase or a credential is done, a decision or an answer is answered */
27
- export const askVerb = (kind: string): OwnerWait => (DO_ASKS.has(kind) ? 'do' : 'answer')
28
-
29
- /** the verb of one open request in the dock: a proposed change is judged, a question that takes a checklist, a url, a
30
- * secret or a file is done, any other question is answered */
31
- export const requestVerb = (m: Pick<Message, 'propose' | 'ask'>): OwnerWait => (m.propose !== undefined ? 'judge' : DO_ANSWERS.has(kindOfAsk(m as Message)) ? 'do' : 'answer')
32
-
33
- /** what a thread waits on from him first: the type of message, or the kind of the object, a row draws as its icon */
34
- export type WaitsOn = { type: MessageType } | { kind: string }
35
-
36
- /** every open object of his turn as its verb and what waits, in the dock's order: the ask's own record, each open
37
- * question, proposed change or message that asks the owner's verdict oldest first, the version that waits for the
38
- * owner's verdict, the owner's note an agent asked about, an object of his move that holds it open */
39
- function entriesOf(t: Thread): { wait: OwnerWait; on?: WaitsOn }[] {
40
- const out: { wait: OwnerWait; on?: WaitsOn }[] = []
41
- const head = t.head.item
42
- const ask = askStateOf(t)?.state
43
- const facts = askFactsOf(t)
44
- if (facts !== null && !isClosedAskState(ask)) out.push({ wait: askVerb(facts.kind), on: { kind: 'ask' } })
45
- for (const m of [...openAsksOf(t), ...openItemVerdictsOf(t)].sort((a, b) => a.at.localeCompare(b.at)))
46
- out.push(m.asksVerdict === true && m.ask === undefined && m.propose === undefined ? { wait: 'judge', on: verdictOn(m) } : { wait: requestVerb(m), on: { type: requestType(m) } })
47
- if (headWaits(t)) out.push({ wait: 'judge', on: { kind: head.on ? head.on.slice(0, head.on.indexOf(':')) : head.subject.kind } })
48
- const notes = [...(head.origin.by === 'agent' ? [] : [t.head]), ...t.answers.filter((x) => t.joined.has(x.item.id))]
49
- if (notes.some((x) => moveOf(stateOf(x, false).state) === 'owner')) out.push({ wait: 'answer', on: { type: 'note' } })
50
- const hold = heldOpen(membersOf(t)).find((h) => holdMoveOf(h) === 'owner')
51
- if (hold !== undefined) out.push({ wait: 'do', on: { kind: hold.address.slice(0, hold.address.indexOf(':')) } })
52
- return out
53
- }
54
-
55
- /** the one verb a thread's badge says, and what waits: while it is his turn or set aside, its first open object's
56
- * (entriesOf), `answer` on the rare turn of his no open object explains; `agents` or `done` once the turn is not his.
57
- * `owed`: on the agents' move after his last word (band.ts AFTER_MOVE), the verb of what still waits on him, a quiet
58
- * mark that never puts the thread back in his turn */
59
- export function waitEntryOf(t: Thread, now = new Date()): { wait: Wait; on?: WaitsOn; owed?: OwnerWait } {
60
- const turn = turnOf(t, now)
61
- if (turn === 'done') return { wait: turn }
62
- if (turn === 'agents') {
63
- const owed = entriesOf(t)[0]?.wait
64
- return owed !== undefined ? { wait: turn, owed } : { wait: turn }
65
- }
66
- return entriesOf(t)[0] ?? { wait: 'answer' }
67
- }
68
-
69
- /** every verb his open objects ask, the first one first: a filter lists the thread for any of them, never only for its
70
- * badge; none once the turn is not his */
71
- export function verbsOf(t: Thread, now = new Date()): OwnerWait[] {
72
- const turn = turnOf(t, now)
73
- if (turn === 'agents' || turn === 'done') return []
74
- const vs = [...new Set(entriesOf(t).map((e) => e.wait))]
75
- return vs.length > 0 ? vs : ['answer']
76
- }
77
-
78
- /** the one matcher of every verbs filter (the threads page, the inbox): none picked lists all, else a thread whose
79
- * verbs hold one picked */
80
- export const waitsMatch = (sel: readonly OwnerWait[] | null, verbs: readonly string[]): boolean => sel === null || verbs.some((v) => (sel as readonly string[]).includes(v))
81
-
82
- export const waitOf = (t: Thread, now = new Date()): Wait => waitEntryOf(t, now).wait
83
-
84
- /** an open request's type: a proposed change, a secret field, a checklist, any other question */
85
- const requestType = (m: Message): MessageType => (m.propose !== undefined ? 'change' : kindOfAsk(m) === 'secret' ? 'secret' : kindOfAsk(m) === 'checklist' ? 'checklist' : 'question')
86
-
87
- /** a message that asks the owner's verdict: the object it links when it links one (a reflection, a draft), else its words */
88
- const verdictOn = (m: Message): WaitsOn => {
89
- const a = m.about?.[0]
90
- return a !== undefined && a.includes(':') ? { kind: a.slice(0, a.indexOf(':')) } : { type: 'message' }
91
- }
package/src/rules/rule.ts DELETED
@@ -1,43 +0,0 @@
1
- // The LEGACY rule shape, kept for the compatibility window. A repo that
2
- // still registers invariants through `repo.config.ts rules: []` imports
3
- // `Rule` from here, and the engine reads each one as a check whose body is
4
- // `lint` (check.ts owns the shape now). Both die together, at the first
5
- // release after `shipkit fleet` shows no repo below 0.40.
6
- //
7
- // A new invariant is a `<name>.check.ts` file: `check({ blocking, run })`,
8
- // dropped anywhere in the repo, discovered with no config edit.
9
- import { repoOff } from '../core/when.ts'
10
- import { tagCheckLines, checkCacheExtra, type Rule, type RuleEnv } from '../check.ts'
11
-
12
- export type { FixResult, Rule, RuleEnv } from '../check.ts'
13
-
14
- /** the config part of a rule's cache identity, including where it runs */
15
- export function ruleCacheExtra(rule: Rule, env: RuleEnv): string | undefined {
16
- return checkCacheExtra(rule.cacheKey?.(env), repoOff(env.config, rule.id)?.reason ?? null)
17
- }
18
-
19
- /** tag every severity line with the rule id (check.ts owns the rendering) */
20
- export const tagRuleLines = tagCheckLines
21
-
22
- // ── the legacy id namespace ──────────────────────────────────────────────
23
- // A rule id is PREFIX plus exactly 3 digits, and `SK` is reserved for the
24
- // toolkit's own checks so a repo rule can never shadow one. A `*.check.ts`
25
- // file takes its id from its NAME and may use plain words, so this shape
26
- // binds the `rules: []` key only.
27
-
28
- export const RULE_ID_RE = /^[A-Z]{2,4}\d{3}$/
29
-
30
- /** validate the rules a repo registers. Throws on a malformed id, a
31
- * duplicate, a missing owner page, or one squatting the reserved SK
32
- * prefix, so a bad registration dies at config load and never mid gate. */
33
- export function validateRules(rules: readonly Rule[], o: { label: string; taken?: Iterable<string> } = { label: 'rules' }): void {
34
- const seen = new Set<string>(o.taken ?? [])
35
- for (const r of rules) {
36
- if (!RULE_ID_RE.test(r.id)) throw new Error(`${o.label}: bad id '${r.id}' — rules are PREFIX+3 digits (e.g. SK001, RV001)`)
37
- if (r.id.startsWith('SK'))
38
- throw new Error(`${o.label}: id '${r.id}' uses the reserved SK prefix — repo rules pick their own (e.g. RV${r.id.slice(-3)})`)
39
- if (seen.has(r.id)) throw new Error(`${o.label}: duplicate id ${r.id}`)
40
- if (r.owner === '') throw new Error(`${o.label}: ${r.id} has no owner page`)
41
- seen.add(r.id)
42
- }
43
- }
@@ -1,37 +0,0 @@
1
- // the daemon's hook thread: the inbox hook's work for each hook that asks (review/hook-ask.ts), in a worker of its own
2
- // (hook-worker.ts) that keeps warm what the work reads, while the loop only awaits a message. Its own worker, never
3
- // the read thread's: a hook waits on no repo's rows.
4
- // the one constraint a reader breaks first: a thread on older code than its tree answers « stale » and is stopped
5
- // here, so the next ask starts a new one on the code on disk; until then every hook runs in its own process
6
- import { HOOK_PATH, HOOK_WIRE, type HookAnswer, type HookAsk } from '../review/hook-ask.ts'
7
- import { WorkerThread } from './read-thread.ts'
8
-
9
- const ENTRY = new URL('./hook-worker.ts', import.meta.url).href
10
-
11
- export class HookThread extends WorkerThread<{ ask: HookAsk }> {
12
- constructor(entry = ENTRY) {
13
- super(entry, 'hook thread')
14
- }
15
-
16
- /** the hook's answer, or why the thread did not serve it */
17
- async answer(ask: HookAsk): Promise<HookAnswer> {
18
- const a = await this.ask<HookAnswer & { stale?: true }>({ ask }).catch((e: Error): HookAnswer => ({ served: false, why: e.message }))
19
- if (!a.served && 'stale' in a) {
20
- // the next hook finds a thread on the code on disk, warm
21
- this.stop()
22
- this.open()
23
- return { served: false, why: a.why }
24
- }
25
- return a
26
- }
27
- }
28
-
29
- /** the hook's one route, POST HOOK_PATH: null for any other path. A request of another wire is not served */
30
- export async function hookRoute(req: Request, path: string, thread: HookThread): Promise<Response | null> {
31
- if (path !== HOOK_PATH) return null
32
- if (req.method !== 'POST') return new Response('POST only', { status: 405 })
33
- const ask = (await req.json().catch(() => null)) as HookAsk | null
34
- if (ask?.v !== HOOK_WIRE || typeof ask.src !== 'string' || typeof ask.cwd !== 'string' || typeof ask.text !== 'string' || typeof ask.env !== 'object' || ask.env === null || typeof ask.until !== 'number')
35
- return Response.json({ served: false, why: `a hook of wire ${String(ask?.v)}, this daemon speaks ${HOOK_WIRE}` } satisfies HookAnswer)
36
- return Response.json(await thread.answer(ask), { headers: { 'Cache-Control': 'no-store' } })
37
- }
@@ -1,92 +0,0 @@
1
- // the work of the daemon's hook thread (hook-worker.ts is its entry): the inbox hook's work (cli/inbox-hook-run.ts
2
- // hookWork) for one hook that asks, under the asking hook's env and with what it prints taken as its own, or why it
3
- // is not this thread's to serve.
4
- // the one constraint a reader breaks first: an answer is this thread's code, so a hook is served only by a thread on
5
- // the hook's own tree whose loaded modules are the files on disk: one moved, and it answers « stale », and the daemon
6
- // starts a new thread on the code on disk
7
- import { statSync } from 'node:fs'
8
- import type { HookAnswer, HookAsk } from '../review/hook-ask.ts'
9
-
10
- /** who acts: the asking hook's own, set for its work alone */
11
- const ACTOR = (k: string): boolean => /^(CLAUDE_|SK_)/.test(k) || k === 'SHIPKIT_ORCHESTRATOR'
12
- /** the daemon's own mark, never a store */
13
- const OWN = new Set(['SHIPKIT_HOME_WORKER'])
14
-
15
- /** why the thread at `src`, started under `base`, does not serve the hook; null when it does. A hook whose env moves a
16
- * store or the home (any other SHIPKIT_ value, another HOME) reads stores the thread does not hold */
17
- export function hookRefusal(a: HookAsk, src: string, base: Record<string, string | undefined>, now = Date.now()): string | null {
18
- if (a.src !== src) return `the hook runs ${a.src}, the daemon ${src}`
19
- if ((a.env.HOME ?? '') !== (base.HOME ?? '')) return 'the hook runs under another HOME'
20
- for (const k of new Set([...Object.keys(a.env), ...Object.keys(base)])) {
21
- if (!k.startsWith('SHIPKIT_') || ACTOR(k) || OWN.has(k)) continue
22
- if (a.env[k] !== base[k]) return `the hook's env moves ${k}`
23
- }
24
- if (now > a.until) return 'the work could not start in time: the hook runs it itself'
25
- return null
26
- }
27
-
28
- const mtimeOf = (f: string): number => {
29
- try {
30
- return statSync(f).mtimeMs
31
- } catch {
32
- return -1
33
- }
34
- }
35
-
36
- /** the modules a thread loaded under `src`, each with its file's time once it loaded: `moved` names one whose file
37
- * changed since, the code the thread runs no longer the code on disk */
38
- export class LoadedModules {
39
- private at = new Map<string, number>()
40
- constructor(private readonly src: string, private readonly mtime: (f: string) => number = mtimeOf) {}
41
- note(files: Iterable<string>): void {
42
- for (const f of files) if (f.startsWith(`${this.src}/`) && !this.at.has(f)) this.at.set(f, this.mtime(f))
43
- }
44
- moved(): string | null {
45
- for (const [f, at] of this.at) if (this.mtime(f) !== at) return f.slice(this.src.length + 1)
46
- return null
47
- }
48
- }
49
-
50
- export type Work = (text: string, cwd: string, io: { out: (l: string) => void; err: (l: string) => void }) => Promise<number>
51
- type Write = typeof process.stdout.write
52
-
53
- /** one hook's work (`work`, hookWork in the thread) under its own actor env, every print of it taken: its console and
54
- * its process streams, put back after, as are the env values it moved */
55
- export async function workAs(a: HookAsk, work: Work): Promise<HookAnswer> {
56
- const env = process.env
57
- const was = new Map<string, string | undefined>()
58
- for (const k of Object.keys(env)) if (ACTOR(k)) was.set(k, env[k])
59
- for (const k of was.keys()) delete env[k]
60
- for (const [k, v] of Object.entries(a.env)) if (ACTOR(k)) {
61
- if (!was.has(k)) was.set(k, undefined)
62
- env[k] = v
63
- }
64
- let out = ''
65
- let err = ''
66
- const taken = { log: console.log, info: console.info, warn: console.warn, error: console.error, stdout: process.stdout.write, stderr: process.stderr.write }
67
- const line = (to: 'out' | 'err') => (...xs: unknown[]): void => {
68
- const text = `${xs.map((x) => (typeof x === 'string' ? x : Bun.inspect(x))).join(' ')}\n`
69
- if (to === 'out') out += text
70
- else err += text
71
- }
72
- const text = (c: string | Uint8Array): string => (typeof c === 'string' ? c : new TextDecoder().decode(c))
73
- console.log = console.info = line('out')
74
- console.warn = console.error = line('err')
75
- process.stdout.write = ((c: string | Uint8Array) => ((out += text(c)), true)) as Write
76
- process.stderr.write = ((c: string | Uint8Array) => ((err += text(c)), true)) as Write
77
- try {
78
- const code = await work(a.text, a.cwd, { out: (l) => void (out += `${l}\n`), err: (l) => void (err += `${l}\n`) })
79
- return { served: true, out, err, code }
80
- } catch (e) {
81
- // a throw is the hook's own to show: it runs the work itself
82
- return { served: false, why: `the work threw: ${(e as Error).message}` }
83
- } finally {
84
- Object.assign(console, { log: taken.log, info: taken.info, warn: taken.warn, error: taken.error })
85
- process.stdout.write = taken.stdout
86
- process.stderr.write = taken.stderr
87
- for (const [k, v] of was) {
88
- if (v === undefined) delete env[k]
89
- else env[k] = v
90
- }
91
- }
92
- }
@@ -1,57 +0,0 @@
1
- // the daemon's hook thread (hook-thread.ts): each hook's work (hook-work.ts), one at a time, since the env and the
2
- // prints are the thread's own while it works. What the work reads stays warm here between two hooks: the stores' rows
3
- // read since the last read, the units, the lanes' facts, the ended sessions' listings.
4
- import { dirname } from 'node:path'
5
- import { installOneLib } from '../core/one-lib.ts'
6
- import { keepTranscriptListing } from '../agent-time/store.ts'
7
- import type { HookAnswer, HookAsk } from '../review/hook-ask.ts'
8
- import { hookRefusal, LoadedModules, workAs } from './hook-work.ts'
9
-
10
- declare const self: Worker
11
-
12
- // a thread never inherits its process's resolver hook (read-worker.ts)
13
- installOneLib()
14
- // every hook reads the transcripts of the sessions its threads name: kept current here by a watch
15
- keepTranscriptListing()
16
-
17
- const SRC = dirname(import.meta.dir)
18
- /** the daemon's env when the thread started */
19
- const BASE: Record<string, string | undefined> = { ...process.env }
20
- const loaded = new LoadedModules(SRC)
21
-
22
- // the modules the work loads, loaded as the thread starts: a cold load is longer than a hook waits
23
- // (review/hook-ask.ts HOOK_WAIT_MS), so the first hook after a start would run itself
24
- const warm = Promise.all([
25
- import('../cli/inbox-hook-run.ts'),
26
- import('../cli/review-here.ts'),
27
- import('../review/inbox-hook.ts'),
28
- import('../review/inbox-read.ts'),
29
- import('../review/project.ts'),
30
- import('../review/hand-over.ts'),
31
- import('../review/watchers.ts'),
32
- import('../review/take-back.ts'),
33
- import('../agent-time/registry.ts'),
34
- import('../orchestrator/role.ts'),
35
- import('../orchestrator/places.ts'),
36
- ]).catch(() => [])
37
- .finally(() => loaded.note(Object.keys(require.cache)))
38
-
39
- async function answer(a: HookAsk): Promise<HookAnswer & { stale?: true }> {
40
- await warm
41
- const moved = loaded.moved()
42
- if (moved !== null) return { served: false, why: `${moved} moved since the hook thread loaded it`, stale: true }
43
- const no = hookRefusal(a, SRC, BASE)
44
- if (no !== null) return { served: false, why: no }
45
- try {
46
- const { hookWork } = await import('../cli/inbox-hook-run.ts')
47
- return await workAs(a, hookWork)
48
- } finally {
49
- loaded.note(Object.keys(require.cache))
50
- }
51
- }
52
-
53
- let queue: Promise<unknown> = Promise.resolve()
54
- self.onmessage = (e: MessageEvent<{ id: number; ask: HookAsk }>) => {
55
- const { id, ask } = e.data
56
- queue = queue.then(async () => self.postMessage({ id, answer: await answer(ask).catch((x: Error): HookAnswer => ({ served: false, why: x.message })) }))
57
- }
@@ -1,147 +0,0 @@
1
- // the timeline and the dock (wiki tools/shipkit/threads-page.md, The dock): every item lives whole in the timeline, its
2
- // words wrapped and its controls under them (a question's options with the agent's pick, an ask's instructions with
3
- // their boxes, a checklist, a field, a secret, a verdict's buttons). The dock above his reply box holds no content: ONE
4
- // line, the first thing that waits on him (its glyph, a short title, its age, « jump ↑ », a click that scrolls the
5
- // timeline to the item and lights it), « +N » when more wait, and the open ask's own acts at its end
6
- import { observer } from 'mobx-react-lite'
7
- import { useState, type ReactNode } from 'react'
8
- import type { ReplyCell } from '../../../review/cells.ts'
9
- import { actsLeft, versionActs } from '../../../review/settle.ts'
10
- import { CellGlyph } from './object-panel.tsx'
11
- import { Age, stampWords } from '../time-ago.tsx'
12
- import { keepFocus } from './kit.tsx'
13
- import { AskBody, ProposeBody } from './question-views.tsx'
14
- import { currentStep, InstructionsBody, stepLine } from './instructions-view.tsx'
15
- import { Cta } from './cta.tsx'
16
- import { renderMdInline } from '../md.ts'
17
- import { Words } from '../words.tsx'
18
- import type { ReviewSt } from './review-st.ts'
19
- import { answeredWords, dockDom, requestState, requestWord, type ThreadSt } from './thread-st.ts'
20
- import { tip } from '../tips.ts'
21
-
22
- const firstLine = (t: string): string => t.split('\n').find((l) => l.trim() !== '')?.trim() ?? ''
23
-
24
- /** where a checklist stands, on its reminder: « 2 of 5 » */
25
- const progressOf = (c: ReplyCell): string | null => {
26
- const lines = c.ask?.lines
27
- return c.ask?.kind === 'checklist' && lines ? `${lines.filter((l) => l.tick).length} of ${lines.length}` : null
28
- }
29
-
30
- /** the question or the change itself, as it answers */
31
- const RequestBody = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) =>
32
- 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,
33
- )
34
-
35
- /** `ask`: the open ask's own acts (its proof url, « done », « I will not do this »), drawn at the end of the line;
36
- * `titled` when nothing else waits, so the line names the ask itself. Keyed by its thread: « +N » opens per thread */
37
- export const Dock = observer(({ rv, thread, ask }: { rv: ReviewSt; thread: ThreadSt; ask?: ((titled: boolean) => ReactNode) | null }) => {
38
- const [more, setMore] = useState(false)
39
- const verdict = thread.verdictAbove
40
- // the owner's words came after the version: the agents move first (review/band.ts AFTER_MOVE), the verdict waits, quiet
41
- const later = thread.data?.turn === 'agents'
42
- const cls = later ? 'rv-dockverdict rv-docklater' : 'rv-dockverdict'
43
- const after = later ? ' · an agent answers your words first' : ''
44
- const lines = thread.openRequests.map((c) => (c.instructions && c.ask ? <StepsReminder key={c.id} rv={rv} thread={thread} c={c} /> : <Reminder key={c.id} rv={rv} thread={thread} c={c} />))
45
- if (verdict)
46
- lines.push(
47
- versionActs(verdict.item) !== null ? (
48
- // a version answered by its kind's acts: what is left for him in its words, never a verdict
49
- <Line key={verdict.id} id={dockDom(verdict.id)} cls={cls} go={() => thread.reveal(verdict.id)} kind={later ? 'when ready' : 'your turn'} title={`v${verdict.n}: ${actsLeft(verdict.item, verdict.settled)}${after}`} />
50
- ) : (
51
- <Line key={verdict.id} id={dockDom(verdict.id)} cls={cls} go={() => thread.reveal(verdict.id)} kind={later ? 'verdict, when ready' : 'your verdict'} title={`v${verdict.n} waits for your verdict${thread.waitingViews ? ` · ${thread.waitingViews.waiting} of ${thread.waitingViews.of} views` : ''}${after}`} />
52
- ),
53
- )
54
- const acts = ask?.(lines.length === 0) ?? null
55
- if (lines.length === 0 && acts === null) return <Expected thread={thread} />
56
- const [first, ...rest] = lines
57
- return (
58
- <section className="rv-dock" aria-label="what waits on your answer">
59
- <div className="rv-dockbox">
60
- {/* the others, opened by « +N »: over the line, so the line never moves away from his box */}
61
- {more && rest.length > 0 ? <div className="rv-dockentries">{rest}</div> : null}
62
- <div className="rv-dockline">
63
- {first}
64
- {rest.length > 0 ? (
65
- <button className="rv-dockmore ghost" aria-expanded={more} {...tip(more ? 'fold them again' : `${rest.length} more ${rest.length > 1 ? 'wait' : 'waits'} on you: show ${rest.length > 1 ? 'them' : 'it'}`)} onMouseDown={keepFocus} onClick={() => setMore(!more)}>
66
- {more ? 'fewer' : `+${rest.length} more`}
67
- </button>
68
- ) : null}
69
- {acts}
70
- </div>
71
- </div>
72
- </section>
73
- )
74
- })
75
-
76
- /** nothing waits on his answer: one quiet line of what is expected of him and why (review/expect.ts expectOf), never
77
- * an empty bar that leaves him guessing; a promise past its time in the warning colour */
78
- const Expected = observer(({ thread }: { thread: ThreadSt }) => {
79
- const e = thread.expect
80
- if (e === null) return null
81
- return (
82
- <section className={`rv-dock rv-dockquiet${e.late ? ' late' : ''}`} aria-label="what is expected of you">
83
- <div className="rv-dockbox">
84
- <div className="rv-dockline">
85
- <p className="rv-dockexpect" role="status">{e.words}</p>
86
- </div>
87
- </div>
88
- </section>
89
- )
90
- })
91
-
92
- /** one reminder: a click anywhere on it scrolls the timeline to its item and lights it; its jump right after its words */
93
- const Line = ({ id, go, glyph, kind, title, count, when, cls = '' }: { id: string; go: () => void; glyph?: ReactNode; kind: string; title: string; count?: string | null; when?: ReactNode; cls?: string }) => (
94
- <button id={id} className={`rv-dockentry rv-reminder ghost ${cls}`} {...tip(`${title}: jump to it`)} onMouseDown={keepFocus} onClick={go}>
95
- {glyph}
96
- <span className="rv-dockkind">{kind}</span>
97
- <b className="rv-dockq mdi" dangerouslySetInnerHTML={{ __html: renderMdInline(title) }} />
98
- {count ? <span className="rv-dockcount">{count}</span> : null}
99
- {when}
100
- <span className="rv-dockplace">jump ↑</span>
101
- </button>
102
- )
103
-
104
- const When = observer(({ rv, at }: { rv: ReviewSt; at: string }) => {
105
- const t = Date.parse(at)
106
- return <time className="rv-when" dateTime={at} {...tip(stampWords(t))}><Age clock={rv} at={t} /></time>
107
- })
108
-
109
- /** an open question, change or item that waits for a verdict: its first line, a reminder */
110
- const Reminder = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) => (
111
- <Line id={dockDom(c.id)} go={() => thread.reveal(c.id)} glyph={<CellGlyph rv={rv} c={c} />} kind={requestWord(c)} title={firstLine(c.text) || requestWord(c)} count={progressOf(c)} when={<When rv={rv} at={c.at} />} />
112
- ))
113
-
114
- /** an ask's instructions: « step 2 of 3: <title> », a click jumps to that step in the timeline */
115
- const StepsReminder = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) => {
116
- const line = stepLine(thread, c)
117
- const at = currentStep(thread, c)
118
- return <Line id={dockDom(c.id)} go={() => (at === null ? thread.reveal(c.id) : thread.revealStep(c.id, at))} glyph={<CellGlyph rv={rv} c={c} />} kind={line.n} title={line.title} when={<When rv={rv} at={c.at} />} cls="rv-docksteps" />
119
- })
120
-
121
- /** a question or a change at its place in the timeline, where he answers it: whole, its words wrapped and its controls
122
- * under them; an ask's instructions with a box on each step; once answered, his answer said over it. Superseded: read
123
- * only. Its words go read with the thread (review/owner-read.ts), never from its reminder in the dock */
124
- export const RequestCell = observer(({ rv, thread, c }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell }) => {
125
- if (c.instructions && c.ask) return <InstructionsBody rv={rv} thread={thread} c={c} live={!c.superseded} />
126
- const waiting = thread.waitsNow(c.id)
127
- return (
128
- <div className={`rv-requestcell ${requestState(c, waiting)}`}>
129
- {!c.superseded && !waiting ? (
130
- // asked before his close and never answered: it waits on nobody (review/threads.ts closedAt)
131
- <div className="rv-requestline">
132
- <span className="rv-requestanswer">{c.moot ? 'closed, not answered' : `answered: ${answeredWords(c)}`}</span>
133
- </div>
134
- ) : null}
135
- {c.text.trim() !== '' ? <Words text={c.text} className="rv-words" /> : null}
136
- {c.superseded ? (
137
- <fieldset disabled className="rv-readonly">
138
- <RequestBody rv={rv} thread={thread} c={c} />
139
- </fieldset>
140
- ) : (
141
- <Cta on={waiting}>
142
- <RequestBody rv={rv} thread={thread} c={c} />
143
- </Cta>
144
- )}
145
- </div>
146
- )
147
- })
@@ -1,18 +0,0 @@
1
- // the three verdicts as faces, drawn on the hub's 20 unit grid: ok smiles, fix is flat, reject frowns. The tone is the
2
- // verdict's (review.css .st-*: green, orange, red); outlined while open, filled once it is the one picked
3
- import type { ItemVerdict } from '../../../review/verdict-items.ts'
4
-
5
- const MOUTH: Record<ItemVerdict, string> = {
6
- approved: 'M6.4 11.6q3.6 3.6 7.2 0',
7
- 'approved-with-fix': 'M6.8 12.9h6.4',
8
- rejected: 'M6.4 14q3.6-3.6 7.2 0',
9
- }
10
-
11
- export const Face = ({ status, filled = false, size = 22 }: { status: ItemVerdict; filled?: boolean; size?: number }) => (
12
- <svg className={`rv-faceico${filled ? ' filled' : ''}`} viewBox="0 0 20 20" width={size} height={size} aria-hidden="true">
13
- <circle cx="10" cy="10" r="8.2" className="rv-faceround" />
14
- <circle cx="7.1" cy="8" r="1.15" className="rv-faceeye" />
15
- <circle cx="12.9" cy="8" r="1.15" className="rv-faceeye" />
16
- <path d={MOUTH[status]} className="rv-facemouth" />
17
- </svg>
18
- )