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
@@ -13,13 +13,9 @@ import {
13
13
  proposeOpen,
14
14
  type ProposeField,
15
15
  type UpdateState,
16
- isMarkItem,
17
16
  isReply,
18
- isStale,
19
17
  laneOf,
20
- moveOf,
21
18
  partyOf,
22
- reworkOf,
23
19
  stateOf,
24
20
  STATUS_LABEL,
25
21
  verdictLabel,
@@ -28,6 +24,7 @@ import {
28
24
  isGallery,
29
25
  isPair,
30
26
  verdictOf,
27
+ leftUnansweredOf,
31
28
  type Item,
32
29
  type ItemState,
33
30
  type Message,
@@ -45,28 +42,23 @@ import {
45
42
  type Verdict,
46
43
  parentAddress,
47
44
  isAskItem,
48
- handedOver,
49
45
  ownSave,
50
46
  type AskState,
51
- LAPSE_LATER,
52
- } from './model.ts'
53
- import { holdsOf, type Hold } from './holds.ts'
54
- import { firstTitleOf, nameOf, threadTitle, askStateOf, countedAsItsAsk, asideUntil, closedAt, addressesOfThread, ownAddressesOf, followedIds, holderOf, isActive, membersOf, openingOf, orderedThreads, sinceHeLeft, statusOf, turnOf, headWaits, nextVersionOf, type NextVersion, type Thread, type Turn } from './threads.ts'
55
- import { answersTo, askOpen, kindCellAsk, wordsAlone } from './answer-kinds.ts'
47
+ LAPSE_LATER } from './model.ts'
48
+ import { nameAt, threadTitle, addressesOfThread, ownAddressesOf, followedIds, membersOf, type Thread } from './threads.ts'
49
+ import { answersTo, askOpen, kindCellAsk, remarkOf, wordsAlone } from './answer-kinds.ts'
56
50
  import { currentInstructions, replacersOf, titleOf } from './supersede.ts'
57
51
  import { judgeOf, type MessageVerdict } from './verdict-items.ts'
58
- import { cursorOf, renameTrace, supersedeTrace, traceOf, traceWords, workingsOf, type Cursor, type Trace, type TraceCtx } from './traces.ts'
59
- import { laneAskOf, type LaneAsk } from './lane-ask.ts'
52
+ import { renameTrace, supersedeTrace, traceOf, traceWords, workingsOf, type Trace, type TraceCtx } from './traces.ts'
60
53
  import { heardOf, type Heard } from './heard.ts'
61
54
  import { mutedOf } from './phone-push.ts'
62
- import { validatedOf } from './band.ts'
63
55
  import { countsUnread, newToOwner, ownerCursorAt, type Fresh } from './owner-read.ts'
64
56
  import { settledSpots, versionActs } from './settle.ts'
65
- import { verbsOf, waitEntryOf, waitsMatch, type WaitsOn, waitsOfParam, type OwnerWait, type Wait } from './wait.ts'
66
57
  import { codesOf, threadCode, type Codes } from './thread-code.ts'
67
58
  import { refsIn } from './refs.ts'
68
59
  import { parseSearch, tagsOfItems } from './thread-query.ts'
69
- import type { BandFacts } from './band.ts'
60
+ import { openingOf } from './thread-events.ts'
61
+ import { closerOf, askStateOf, countedAsItsAsk, isMoot, orderedThreads, recapCut, sinceHeLeft, statusOf, threadState, type Turn, type BandFacts, type ThreadState, waitsMatch, waitsOfParam, type OwnerWait } from './thread-state.ts'
70
62
  export type CellKind = 'version' | 'verdict' | 'reply' | 'note' | 'event'
71
63
 
72
64
  interface CellOf<K extends CellKind> {
@@ -95,7 +87,7 @@ interface CellOf<K extends CellKind> {
95
87
  superseded?: { by: string; title: string; withdrawn?: true }
96
88
  /** an act with no words of its own (an event, his bare verdict): drawn as one trace line (review/traces.ts) */
97
89
  trace?: Trace
98
- /** his word that wakes an agent (review/wakes.ts): the first agent read of it, null while no agent read it */
90
+ /** his word that wakes an agent (review/thread-events.ts): the first agent read of it, null while no agent read it */
99
91
  heard?: Heard | null
100
92
  }
101
93
 
@@ -158,13 +150,14 @@ export interface ReplyCell extends CellOf<'reply'> {
158
150
  /** an agent's question: its options, its pick, and the owner's answer once given (the option, the words) */
159
151
  /** a question: `kind` absent on a choice; a checklist's and a confirm's lines with his ticks; a text's, a url's or a
160
152
  * file's value; a secret's name and when it was stored, never a value; `open` while it waits on him */
161
- ask?: { kind?: AnswerKind; options: string[]; pick?: number; views?: (number | null)[]; answered?: { option: number; text: string; at: string; /** a person's pick answered it: their id and name; both empty on their own copy, where it is theirs */ by?: { id: string; name: string } }; open?: boolean; /** the owner's own newest pick, whoever answered last */ ownerPick?: number; people?: PersonPick[]; lines?: { text: string; tick: boolean; at: string | null; pick?: number }[]; choices?: ({ options: string[]; pick?: number } | null)[]; value?: { text: string; at: string; opens?: number; view?: number }; secret?: { name: string; login?: boolean; stored?: string }; none?: string }
153
+ ask?: { kind?: AnswerKind; options: string[]; pick?: number; views?: (number | null)[]; answered?: { option: number; text: string; /** the owner's words with the pick (« pick with a remark »), '' or none for a plain pick */ remark?: string; at: string; /** a person's pick answered it: their id and name; both empty on their own copy, where it is theirs */ by?: { id: string; name: string } }; open?: boolean; /** the owner's own newest pick, whoever answered last */ ownerPick?: number; people?: PersonPick[]; lines?: { text: string; tick: boolean; at: string | null; pick?: number }[]; choices?: ({ options: string[]; pick?: number } | null)[]; value?: { text: string; at: string; opens?: number; view?: number }; secret?: { name: string; login?: boolean; stored?: string }; none?: string; /** the tone of his newest answer when it is not a plain pick (model.ts QUESTION_TONES) */ tone?: ReviewStatus; /** one row of a question with a row per thing (model.ts AskRow) */ row?: { group: string; i: number; n: number; label: string } }
162
154
  /** an agent's proposed change of an object: each field, drawn by its type, and whether he applied it (the value he
163
- * applied, the owner's edit or not); `open` while it waits on him; `page` the repo's page that draws it */
164
- propose?: { on: string; fields: (ProposeField & { applied?: { text: string; at: string } })[]; open: boolean; page?: string }
155
+ * applied, the owner's edit or not); `open` while it waits on the owner; `none` the owner's words alone sent from its own box
156
+ * (« send my words »); `page` the repo's page that draws it */
157
+ propose?: { on: string; fields: (ProposeField & { applied?: { text: string; at: string } })[]; open: boolean; none?: string; page?: string }
165
158
  /** the owner clicked one of the kind's actions */
166
159
  action?: { name: string }
167
- /** a request written before his close and never answered: it waits on nobody, it reads « closed, not answered » */
160
+ /** a request written before the close, whoever closed, and never answered: it waits on nobody, it reads « closed, not answered » */
168
161
  moot?: true
169
162
  /** his answer to a question or a proposal: the cell it answers */
170
163
  answers?: string
@@ -187,6 +180,10 @@ export interface ReplyCell extends CellOf<'reply'> {
187
180
  linked?: Linked[]
188
181
  /** an agent's words past the wall bound on purpose: why (review/reply-guards.ts), a quiet mark under them */
189
182
  long?: string
183
+ /** an agent's recap of the thread (review/recap.ts): its words are markdown, judged like a version */
184
+ recap?: true
185
+ /** his request for a recap */
186
+ recapAsk?: true
190
187
  }
191
188
 
192
189
  export interface Linked {
@@ -247,15 +244,11 @@ export interface ThreadView {
247
244
  topic?: string
248
245
  lane?: string
249
246
  origin: Origin
250
- status: ShownStatus
251
- state: ItemState
252
- move: Move
253
- /** the head waits for the owner's verdict */
254
- waits: boolean
255
- /** the next version an agent promised, while it stands: the head asks no verdict meanwhile */
256
- next?: NextVersion
257
- active: boolean
258
- rework: { lane: string; since: string; until: number } | null
247
+ /** the thread's state (review/thread-state.ts): its turn, what waits on the owner, what the agents owe, closed, its
248
+ * holder, working line, promise, set aside */
249
+ state: ThreadState
250
+ /** the head's own item state (its lifecycle), never the thread's */
251
+ headState: ItemState
259
252
  verdict: Verdict | null
260
253
  versions: number
261
254
  /** other heads whose chain shares this thread's older versions */
@@ -277,30 +270,16 @@ export interface ThreadView {
277
270
  * tools/shipkit/threads-asks.md, An ask's thread) */
278
271
  /** `lapses`: the secret a refresh ask renews, so the bar offers « later »; `parked`: his « later » closed it */
279
272
  ask?: { id: string; state: AskState; title: string; into?: { id: string; head: string | null }; lapses?: string; parked?: true }
280
- /** set aside until this time, his turn again then */
281
- aside?: string
282
273
  /** his bell is off: nothing of it pushes to his phone (review/phone-push.ts) */
283
274
  muted?: true
284
- /** who acts now on the thread */
285
- turn: Turn
286
- /** who holds it and where his newest word stands: the head draws them from the thread, never from a list row */
287
- holder?: { lane?: string; session?: string }
288
- cursor?: Cursor
289
- /** the agent of its newest `working` no act followed, `agent` a session's own, and when it said it: with the
290
- * parties and the time, its band (review/band.ts) */
291
- working?: string
292
- workingAt?: string
293
- /** his request for a lane while it stands (review/lane-ask.ts) */
294
- laneAsk?: LaneAsk
295
- /** when he closed it, null while open: a request written before reads « closed, not answered » */
296
- closedAt: string | null
297
- /** the objects attached to it that hold or held it open (review/holds.ts) */
298
- holds: Hold[]
275
+ /** the newest recap he accepted (review/thread-state.ts recapCut): its cell, its time, and the cells before it that fold
276
+ * into one line « N messages before the recap », one click opens them; what still waits or is owed is none of them */
277
+ recap?: { cell: string; at: string; before: string[] }
299
278
  cells: Cell[]
300
279
  }
301
280
 
302
281
  /** a thread another names by code, as its pill draws it: its code, its head to open, its title, what its band reads */
303
- export type RefThread = { code: string; head: string; title: string; tags?: string[] } & BandFacts
282
+ export type RefThread = { code: string; head: string; title: string; tags?: string[]; state: BandFacts }
304
283
 
305
284
  /** a message of another thread that names this one by code: when, where (the message's cell there), that thread */
306
285
  export type Backlink = { at: string; cell: string; from: RefThread }
@@ -336,13 +315,15 @@ const traceCell = (base: Omit<EventCell, 'kind' | 'summary' | 'trace'>, m: Messa
336
315
  function verdictBy(x: ReviewItem): string {
337
316
  const v = verdictOf(x)
338
317
  const m = v === null ? undefined : x.thread.find((y) => y.id === v.id)
339
- return m?.who === 'player' ? ` by ${m.advisor?.name ?? 'you'}` : ''
318
+ if (m?.who === 'player') return ` by ${m.advisor?.name ?? 'you'}`
319
+ const closer = v === null ? closerOf(x) : null
320
+ return closer !== null ? `: closed by ${closer}` : ''
340
321
  }
341
322
 
342
323
  /** the cells of one item's messages: an act with no words is a trace line (review/traces.ts), an owner's read mark no cell */
343
324
  function messageCells(x: ReviewItem, n: number, opening: Message | undefined, gone: Gone, linkOf: LinkOf, ctx: TraceCtx, readObject?: ObjectRead): Cell[] {
344
325
  const id = x.item.id
345
- const current = verdictOf(x)?.id
326
+ const current = leftUnansweredOf(x)?.id ?? verdictOf(x)?.id
346
327
  const read = { agent: readBy(x, 'agent'), owner: readBy(x, 'owner') }
347
328
  const other = (who: string): Party => (partyOf(who) === 'owner' ? 'agent' : 'owner')
348
329
  const updates = updatesOf(x)
@@ -351,8 +332,11 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined, go
351
332
  const out: Cell[] = []
352
333
  // a person's word written twice by one delivery (the same words, the same moment): drawn once
353
334
  const twice = new Set<string>()
335
+ // the messages that link an object: the owner's act on one reads on the linked object (`linked.decided`), never a cell
336
+ const linking = new Set<string>()
354
337
  for (const m of x.thread) {
355
338
  if (m === opening) continue
339
+ if (m.action !== undefined && m.re !== undefined && linking.has(m.re) && partyOf(m.who) === 'owner') continue
356
340
  if (m.who === 'player') {
357
341
  const k = `${m.advisor?.id ?? ''}|${m.at}|${m.re ?? ''}|${m.text ?? ''}`
358
342
  if (twice.has(k)) continue
@@ -367,13 +351,15 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined, go
367
351
  const base = { id: `${id}/${m.id}`, on: id, at: m.at, who: his.has(m.id) ? 'owner' : m.who, ...(m.session ? { session: m.session } : {}), ...(m.advisor !== undefined ? { advisor: m.advisor } : {}), party, open: false, ...(by ? { superseded: by } : {}), ...heardOf(x, m) }
368
352
  const replaced = supersedeTrace(m, ctx)
369
353
  if (replaced !== null) out.push(traceCell({ ...base, id: `${base.id}~replaces` }, m, replaced))
370
- if (trace !== null && m.verdict === undefined) {
354
+ // his tone on a question is his answer to it (store.ts answerAsk `tone`): drawn as an answer, never a verdict
355
+ const verdict = m.verdict !== undefined && !(m.re !== undefined && x.thread.some((y) => y.id === m.re && y.ask !== undefined))
356
+ if (trace !== null && !verdict) {
371
357
  out.push(traceCell(base, m, trace))
372
358
  continue
373
359
  }
374
360
  if (m.op === 'working') continue
375
361
  const wasRead = read[other(m.who)].has(m.id)
376
- if (m.verdict !== undefined) {
362
+ if (verdict && m.verdict !== undefined) {
377
363
  const picked = m.pick !== undefined ? ` · picked ${x.item.views[m.pick]?.label || `view ${m.pick + 1}`}` : ''
378
364
  const notes = m.rects && m.rects.length > 0 ? ` · ${m.rects.length} note${m.rects.length > 1 ? 's' : ''}` : ''
379
365
  out.push({
@@ -405,7 +391,7 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined, go
405
391
  const said = update ? `${UPDATE_WORDS[update.state]}: ` : re ? `on update ${re.k}: ` : ''
406
392
  // the newest answer: a person with a direct pick may change theirs
407
393
  const reply = x.thread.findLast((y) => y.re === m.id && y.answer !== undefined && partyOf(y.who) === 'owner')
408
- // the owner's words alone on a choice answer it as none of the options, his plain words after it too
394
+ // the owner's words alone in a choice's own box answer it as none of the options; a plain reply never does
409
395
  const words = reply === undefined && m.ask ? answersTo(x.thread, m).find(wordsAlone) : undefined
410
396
  const answers = m.ask ? x.thread.filter((y) => y.re === m.id && y.answer?.option !== undefined) : []
411
397
  const ownerPick = answers.findLast((y) => y.who === 'owner')?.answer?.option
@@ -419,14 +405,17 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined, go
419
405
  }
420
406
  }
421
407
  const picks = { ...(ownerPick !== undefined ? { ownerPick } : {}), ...(people.size > 0 ? { people: [...people.values()] } : {}) }
422
- const ask = m.ask ? (m.ask.kind === undefined || m.ask.kind === 'choice' ? { ...picks, options: m.ask.options, ...(m.ask.pick !== undefined ? { pick: m.ask.pick } : {}), ...(m.ask.views ? { views: m.ask.views } : {}), ...(reply?.answer?.option !== undefined ? { answered: { option: reply.answer.option, text: reply.text ?? '', at: reply.at, ...(reply.who === 'player' ? { by: reply.advisor ?? { id: '', name: '' } } : {}) } } : {}), open: askOpen(x.thread, m) && !by, ...(words !== undefined ? { none: words.text ?? '' } : {}) } : { ...kindCellAsk(x.thread, m), ...(by ? { open: false } : {}) }) : undefined
408
+ const ask = m.ask ? (m.ask.kind === undefined || m.ask.kind === 'choice' ? { ...picks, options: m.ask.options, ...(m.ask.pick !== undefined ? { pick: m.ask.pick } : {}), ...(m.ask.views ? { views: m.ask.views } : {}), ...(m.ask.row ? { row: m.ask.row } : {}), ...(reply?.answer?.option !== undefined ? { answered: { option: reply.answer.option, text: reply.text ?? '', remark: remarkOf(m.ask.options[reply.answer.option] ?? '', reply.text), at: reply.at, ...(reply.who === 'player' ? { by: reply.advisor ?? { id: '', name: '' } } : {}) } } : {}), open: askOpen(x.thread, m) && !by, ...(words !== undefined ? { none: words.text ?? '' } : {}), ...((reply ?? words)?.verdict !== undefined ? { tone: (reply ?? words)!.verdict! } : {}) } : { ...kindCellAsk(x.thread, m), ...(by ? { open: false } : {}) }) : undefined
423
409
  const applied = m.propose ? appliedFields(x.thread, m) : null
410
+ const alone = m.propose ? x.thread.find((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner') : undefined
424
411
  const propose = m.propose
425
- ? { on: m.propose.on, fields: proposeFields(m.propose).map((f) => ({ ...f, ...(applied?.has(f.key) ? { applied: applied.get(f.key)! } : {}) })), open: proposeOpen(x.thread, m) && !by, ...(m.propose.page ? { page: m.propose.page } : {}) }
412
+ ? { on: m.propose.on, fields: proposeFields(m.propose).map((f) => ({ ...f, ...(applied?.has(f.key) ? { applied: applied.get(f.key)! } : {}) })), open: proposeOpen(x.thread, m) && !by, ...(alone ? { none: alone.text ?? '' } : {}), ...(m.propose.page ? { page: m.propose.page } : {}) }
426
413
  : undefined
427
414
  const asked = m.answer && m.re ? `${id}/${m.re}` : undefined
415
+ const linked = linkedOf(x, m, linkOf, readObject)
416
+ if (linked.linked !== undefined) linking.add(m.id)
428
417
  const what = by ? (by.withdrawn ? `${by.title}: ` : `superseded by « ${by.title} »: `) : m.edit ? 'edited: ' : m.instructions ? 'new instructions: ' : m.action ? `action ${m.action.name}: ` : ask ? ('answered' in ask || ('open' in ask && !ask.open) ? 'answered: ' : 'asks: ') : propose ? (propose.open ? 'proposes: ' : 'applied: ') : asked ? 'answer: ' : ''
429
- out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(m.files ? { files: m.files } : {}), ...(op ? { op } : {}), read: wasRead, ...(update ? { update } : {}), ...(re ? { re } : {}), ...(ask ? { ask } : {}), ...(propose ? { propose } : {}), ...(asked ? { answers: asked } : {}), ...(m.about ? { about: m.about } : {}), ...(m.to ? { to: m.to.map((t) => t.name) } : {}), ...(m.action ? { action: { name: m.action.name } } : {}), ...(m.instructions ? { instructions: { title: m.instructions.title, check: m.instructions.ask.check ?? null } } : {}), ...(m.step ? { step: m.step } : {}), ...(m.long ? { long: m.long } : {}), ...(m.edit ? { edit: { of: m.edit.of === id ? id : `${x.thread.some((y) => y.id === m.edit!.of) ? `${id}/` : ''}${m.edit.of}`, diff: m.edit.diff } } : {}), ...linkedOf(x, m, linkOf, readObject), ...judgeOf(x.thread, m, by !== undefined), summary: `${what}${said}${firstLine(m.text)}` })
418
+ out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(m.files ? { files: m.files } : {}), ...(op ? { op } : {}), read: wasRead, ...(update ? { update } : {}), ...(re ? { re } : {}), ...(ask ? { ask } : {}), ...(propose ? { propose } : {}), ...(asked ? { answers: asked } : {}), ...(m.about ? { about: m.about } : {}), ...(m.to ? { to: m.to.map((t) => t.name) } : {}), ...(m.action ? { action: { name: m.action.name } } : {}), ...(m.instructions ? { instructions: { title: m.instructions.title, check: m.instructions.ask.check ?? null } } : {}), ...(m.step ? { step: m.step } : {}), ...(m.long ? { long: m.long } : {}), ...(m.recap ? { recap: true as const } : {}), ...(m.recapAsk ? { recapAsk: true as const } : {}), ...(m.edit ? { edit: { of: m.edit.of === id ? id : `${x.thread.some((y) => y.id === m.edit!.of) ? `${id}/` : ''}${m.edit.of}`, diff: m.edit.diff } } : {}), ...linked, ...judgeOf(x.thread, m, by !== undefined), summary: `${what}${said}${firstLine(m.text)}` })
430
419
  } else if (m.rects && m.rects.length > 0) {
431
420
  // rectangles with no words and no verdict: the owner's note on the item
432
421
  out.push({ ...base, kind: 'note', rects: m.rects, ...(m.image ? { image: m.image } : {}), read: wasRead, summary: `${m.rects.length} note${m.rects.length > 1 ? 's' : ''}` })
@@ -459,10 +448,24 @@ function raisedCell(x: ReviewItem): NoteCell {
459
448
  }
460
449
  }
461
450
 
451
+ /** a cell as the holder of the views its messages name (an option's picture, an update's file, a proposed sound): a
452
+ * version, or an item the owner raised, drawn as a version with no verdict (n 0, raised); null for a cell with no item */
453
+ export function viewHolderOf(c: Cell): VersionCell | null {
454
+ if (c.kind === 'version') return c
455
+ if (c.kind !== 'note' || c.item === undefined) return null
456
+ return { kind: 'version', id: c.id, on: c.on, at: c.at, who: c.who, party: c.party, open: c.open, summary: c.summary, n: 0, item: c.item, status: 'raised', label: '' }
457
+ }
458
+
459
+ /** a raised item's own picture, the one its note draws: its first image view that no message holds */
460
+ export const raisedStill = (item: Item): { name: string; size: { w: number; h: number } } | null => {
461
+ const v = item.views.find((x) => !isGallery(x) && x.message !== true)
462
+ return v && !isGallery(v) && 'image' in v.files ? { name: v.files.image, size: v.size } : null
463
+ }
464
+
462
465
  const rank: Record<CellKind, number> = { version: 0, note: 1, verdict: 2, reply: 3, event: 4 }
463
466
 
464
467
  /** what a linked object says now, read from where it lives (review/object-read.ts: a reflection's file); null when
465
- * nothing reads it here. The card draws from it whether or not a thread stands on the object */
468
+ * nothing reads it here. The linked object draws from it whether or not a thread stands on the object */
466
469
  export type ObjectRead = (address: string) => { title: string; md: string; standing: boolean; state?: 'open' | 'folded' | 'gone' } | null
467
470
 
468
471
  /** the thread an address of another thread links to has, by its own address; null for none, or the thread itself */
@@ -489,7 +492,7 @@ function linkedOf(x: ReviewItem, m: Message, linkOf: LinkOf, readObject?: Object
489
492
  const o = linkOf(address)
490
493
  const f = readObject?.(address) ?? null
491
494
  if (o === null && f === null) continue
492
- const closed = o !== null && stateOf(o.head, false).state === 'closed'
495
+ const closed = o !== null && threadState(o).closed !== null
493
496
  const act = x.thread.filter((y) => y.re === m.id && y.action !== undefined && partyOf(y.who) === 'owner').at(-1)
494
497
  // its file's words wherever they are (queue or harvested), else the words its own thread opened with
495
498
  const read = f !== null && f.md !== ''
@@ -503,12 +506,20 @@ function linkedOf(x: ReviewItem, m: Message, linkOf: LinkOf, readObject?: Object
503
506
  done,
504
507
  ...(done ? { folded: closed ? 'its own thread is done' : f?.state === 'folded' ? 'its triage closed it' : 'its file left the queue' } : {}),
505
508
  ...(md === '' && f?.state === 'gone' ? { lost: 'its file is in neither .shipkit/reflections/ nor the harvested reflections, and no thread kept its words' } : {}),
506
- ...(act ? { decided: { name: act.action!.name, text: act.text ?? '', at: act.at } } : {}),
509
+ ...(act ? { decided: { name: act.action!.name, text: actWords(act, address), at: act.at } } : {}),
507
510
  })
508
511
  }
509
512
  return out.length > 0 ? { linked: out } : {}
510
513
  }
511
514
 
515
+ /** the owner's own words on an act on a linked object: the address the message opens with (for the holder's watch line) and the
516
+ * bare action name are no words of his */
517
+ function actWords(m: Message, address: string): string {
518
+ const t = (m.text ?? '').trim()
519
+ const bare = t === address || t === m.action?.name ? '' : t.startsWith(`${address}: `) ? t.slice(address.length + 2) : t
520
+ return bare.trim()
521
+ }
522
+
512
523
  /** each superseded object's id (a message id, or the head's item id) → the cell of the one that supersedes it */
513
524
  type Gone = ReadonlyMap<string, { by: string; title: string; bar?: true; withdrawn?: true }>
514
525
 
@@ -585,7 +596,7 @@ export function cellsOf(t: Thread, items: readonly ReviewItem[], readObject?: Ob
585
596
  open: false,
586
597
  ...(gone.has(x.item.id) ? { superseded: gone.get(x.item.id)! } : {}),
587
598
  })
588
- const renamed = renameTrace(nameOf(chain.slice(0, i), firstTitleOf(t)), x)
599
+ const renamed = renameTrace(nameAt(t, x.item.created), x)
589
600
  if (renamed !== null) {
590
601
  const who = cells.find((c) => c.id === x.item.id)!.who
591
602
  cells.push({ kind: 'event', id: `${x.item.id}~renamed`, on: x.item.id, at: x.item.created, who, ...originSession(x.item.origin), party: 'agent', open: false, trace: renamed, summary: traceWords(who, renamed) })
@@ -615,10 +626,10 @@ export function cellsOf(t: Thread, items: readonly ReviewItem[], readObject?: Ob
615
626
  // a message dated at the newest version's own instant (an ask's steps, posted as its thread opens) is part of it
616
627
  c.open = c.superseded === undefined && (c === latest || c === answer || unreadIds.has(c.id) || (latest !== undefined && c.at >= latest.at))
617
628
  }
618
- const cut = closedAt(t)
619
- if (cut !== null)
629
+ const closed = threadState(t).closed
630
+ if (closed !== null)
620
631
  for (const c of cells) {
621
- if (c.kind !== 'reply' || c.party !== 'agent' || c.at > cut || !((c.ask !== undefined && (c.ask.open ?? c.ask.answered === undefined)) || c.propose?.open || c.judge?.open)) continue
632
+ if (c.kind !== 'reply' || c.party !== 'agent' || !isMoot({ closed }, c) || !((c.ask !== undefined && (c.ask.open ?? c.ask.answered === undefined)) || c.propose?.open || c.judge?.open)) continue
622
633
  if (c.ask) c.ask = { ...c.ask, open: false }
623
634
  if (c.propose) c.propose = { ...c.propose, open: false }
624
635
  if (c.judge) c.judge = { ...c.judge, open: false }
@@ -667,10 +678,11 @@ function askCellOf(t: Thread, threads: readonly Thread[]): NonNullable<ThreadVie
667
678
  export function threadView(t: Thread, items: readonly ReviewItem[], threads: readonly Thread[], asked: string, now = new Date(), readObject?: ObjectRead, codes: Codes = codesOf(items.map((x) => x.item.id))): ThreadView {
668
679
  const h = t.head
669
680
  const followed = followedIds(items)
670
- const state = stateOf(h, followed.has(h.item.id))
671
681
  const shared = new Set(t.versions.slice(1).map((x) => x.item.id))
672
682
  const forks = threads.filter((o) => o !== t && o.versions.slice(1).some((x) => shared.has(x.item.id))).map((o) => o.head.item.id)
673
683
  const lane = laneOf(h)
684
+ const state = threadState(t, now)
685
+ const cells = cellsOf(t, items, readObject)
674
686
  return {
675
687
  head: h.item.id,
676
688
  code: threadCode(codes, idsOf(t)),
@@ -682,18 +694,9 @@ export function threadView(t: Thread, items: readonly ReviewItem[], threads: rea
682
694
  subject: h.item.subject,
683
695
  ...(h.item.topic ? { topic: h.item.topic } : {}),
684
696
  ...(lane ? { lane } : {}),
685
- ...holderRow(t),
686
- ...cursorRow(t, now),
687
- ...workingRow(t, now),
688
- ...laneAskRow(t),
689
697
  origin: h.item.origin,
690
- status: statusOf(h, items),
691
698
  state,
692
- move: moveOf(state.state),
693
- waits: headWaits(t),
694
- ...nextRow(t),
695
- active: isActive(t, now),
696
- rework: reworkOf(h, followed.has(h.item.id), now),
699
+ headState: stateOf(h, followed.has(h.item.id)),
697
700
  verdict: verdictOf(h),
698
701
  versions: t.versions.length,
699
702
  forks,
@@ -704,13 +707,24 @@ export function threadView(t: Thread, items: readonly ReviewItem[], threads: rea
704
707
  coming: [],
705
708
  drafts: [],
706
709
  ...(isAskItem(t.head.item) ? { ask: askCellOf(t, threads) } : {}),
707
- ...(asideUntil(t, now) !== null ? { aside: asideUntil(t, now)! } : {}),
708
710
  ...(mutedOf(t) ? { muted: true as const } : {}),
709
- turn: turnOf(t, now),
710
- closedAt: closedAt(t),
711
- holds: holdsOf(membersOf(t)),
712
- cells: cellsOf(t, items, readObject),
711
+ ...recapFoldOf(t, cells, state),
712
+ cells,
713
+ }
714
+ }
715
+
716
+ /** the cells that fold before the newest recap he accepted: each one before it that the model's cut hides and that waits
717
+ * on nobody (review/thread-state.ts recapCut); none without an accepted recap */
718
+ function recapFoldOf(t: Thread, cells: readonly Cell[], s: ThreadState): Pick<ThreadView, 'recap'> {
719
+ const cut = recapCut(t, s)
720
+ if (cut === null) return {}
721
+ const hidden = (c: Cell): boolean => {
722
+ if (c.at >= cut.recap.at || waitsOnOwner(c)) return false
723
+ const id = c.id.split('~')[0]!
724
+ const slash = id.indexOf('/')
725
+ return slash < 0 ? cut.hidden(id, null) : cut.hidden(id.slice(0, slash), { id: id.slice(slash + 1), at: c.at })
713
726
  }
727
+ return { recap: { cell: `${cut.recap.on}/${cut.recap.id}`, at: cut.recap.at, before: cells.filter(hidden).map((c) => c.id) } }
714
728
  }
715
729
 
716
730
  // ── the paged list ──
@@ -735,8 +749,6 @@ export interface ThreadRow {
735
749
  rule?: string
736
750
  /** the agent session that sent the head: a watch kept to a session listens to it */
737
751
  session?: string
738
- status: ShownStatus
739
- move: Move
740
752
  versions: number
741
753
  views: number
742
754
  /** the file that stands for the head in a list: `/api/review/<head>/preview/tile/<thumb>` */
@@ -747,39 +759,12 @@ export interface ThreadRow {
747
759
  wip: boolean
748
760
  /** the head's newest agent update: its state and line; its picture is the row's thumb when it carries one */
749
761
  update?: { state: UpdateState; text: string; at: string }
750
- waits: boolean
751
- /** the next version an agent promised, while it stands */
752
- next?: NextVersion
753
- active: boolean
754
762
  /** an agent wrote after his cursor (review/owner-read.ts): a version or words new to him */
755
763
  unread: boolean
756
- rework: { lane: string; since: string; until: number } | null
757
764
  /** every item id of the thread, the versions oldest first then the raised items: an old version's link finds its row */
758
765
  ids: string[]
759
- /** who acts now: the owner, an agent, nobody */
760
- turn: Turn
761
- /** what it waits on from him (review/wait.ts): the inbox's verb, the list's « what I must do » */
762
- wait: Wait
763
- /** what waits on him first, the icon its row draws (review/wait.ts waitEntryOf) */
764
- waitsOn?: WaitsOn
765
- /** on the agents' move after his last word, what still waits on him: a quiet mark, never his turn (review/wait.ts waitEntryOf) */
766
- owed?: OwnerWait
767
- /** every verb its open objects ask, the badge's first: what the verbs filter and its counts read (review/wait.ts verbsOf) */
768
- verbs: OwnerWait[]
769
- /** set aside: when it comes back, and whether an agent wrote in it since */
770
- aside?: { until: string; moved: boolean }
771
- /** the agent that holds it: a live claim's worker, else its newest act; `handed` when that act is a hand-over */
772
- holder?: { lane?: string; session?: string; handed?: true }
773
- /** where his newest word stands: an agent on it, else read by one (review/traces.ts cursorOf) */
774
- cursor?: Cursor
775
- /** the agent of its newest `working` no act followed, `agent` a session's own, and when it said it: with the
776
- * parties and the time, its band (review/band.ts) */
777
- working?: string
778
- workingAt?: string
779
- /** his request for a lane while it stands (review/lane-ask.ts) */
780
- laneAsk?: LaneAsk
781
- /** everything validated, nothing owed (review/band.ts validatedOf): the list draws it a quiet green */
782
- validated?: true
766
+ /** the thread's state (review/thread-state.ts), the one the list's band, badge, verbs and filters read */
767
+ state: ThreadState
783
768
  /** the addresses it owns, then its links */
784
769
  addresses: string[]
785
770
  /** the advisors who can open it now, by id (advisors/owner-store.ts openersByAddress): his hub's list alone, never
@@ -851,7 +836,7 @@ export interface ThreadPage {
851
836
  subjects: string[]
852
837
  lanes: string[]
853
838
  broken: { id: string; error: string }[]
854
- /** what moved since the owner's last act in the store (threads.ts sinceHeLeft), null before his first */
839
+ /** what moved since the owner's last act in the store (thread-state.ts sinceHeLeft), null before his first */
855
840
  since: { at: string; moved: number; yours: number } | null
856
841
  }
857
842
 
@@ -860,7 +845,7 @@ const NO_WAITS: Readonly<Record<OwnerWait, number>> = { judge: 0, answer: 0, do:
860
845
 
861
846
  type RequiredKeys<T> = { [K in keyof T]-?: object extends Pick<T, K> ? never : K }[keyof T]
862
847
  /** every field a row always carries: a kept page with a row that lacks one was written by an older hub */
863
- const ROW_KEYS = Object.keys({ head: 1, code: 1, tags: 1, title: 1, created: 1, updated: 1, subject: 1, origin: 1, status: 1, move: 1, versions: 1, views: 1, thumb: 1, clip: 1, pair: 1, choice: 1, wip: 1, waits: 1, active: 1, unread: 1, rework: 1, ids: 1, turn: 1, wait: 1, verbs: 1, addresses: 1 } satisfies Record<RequiredKeys<ThreadRow>, 1>)
848
+ const ROW_KEYS = Object.keys({ head: 1, code: 1, tags: 1, title: 1, created: 1, updated: 1, subject: 1, origin: 1, versions: 1, views: 1, thumb: 1, clip: 1, pair: 1, choice: 1, wip: 1, unread: 1, ids: 1, state: 1, addresses: 1 } satisfies Record<RequiredKeys<ThreadRow>, 1>)
864
849
 
865
850
  /** a list page as the hub reads it, from the server or from the browser's kept copy of an older hub: the page fields
866
851
  * added since are filled (each verb at 0, no since); null when a row lacks a field rows always carry, and that page
@@ -902,40 +887,31 @@ export interface ThreadIndex {
902
887
  since: ThreadPage['since']
903
888
  }
904
889
 
905
- function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<string>, now: Date, code: string): ThreadRow {
890
+ function rowOf(t: Thread, now: Date, code: string): ThreadRow {
906
891
  const h = t.head
907
892
  // the views a message holds (an update's, a question's option, a proposed sound) are no view of the version
908
893
  const own = h.item.views.filter((v) => isGallery(v) || v.message !== true)
909
894
  const first = firstView({ ...h.item, views: own })
910
895
  const lane = laneOf(h)
911
896
  const members = membersOf(t)
912
- // a hand-over (review/hand-over.ts) is the machine passing the thread on, never a move he sees in his lists
913
- const updated = members.reduce((u, x) => {
914
- // a read mark moves nothing: opening a thread never lifts it in the list
915
- const m = x.thread.filter((y) => !handedOver(y) && y.op !== 'seen').at(-1)?.at ?? x.item.created
916
- return m > u ? m : u
917
- }, h.item.created)
897
+ const state = threadState(t, now)
918
898
  const newest = updatesOf(h).at(-1)
919
899
  const shows = newest?.update?.view !== undefined ? h.item.views[newest.update.view] : undefined
920
900
  const picture = h.item.views.find((v) => !isGallery(v) && v.message === true && v.audio === undefined)
921
901
  const thumbOf = shows ?? first ?? picture
922
- const turn = turnOf(t, now)
923
- const status = statusOf(h, items)
924
902
  return {
925
903
  head: h.item.id,
926
904
  code,
927
905
  tags: tagsOfItems(members),
928
906
  title: threadTitle(t),
929
907
  created: h.item.created,
930
- updated,
908
+ updated: state.updated,
931
909
  subject: h.item.subject.kind,
932
910
  ...(h.item.topic ? { topic: h.item.topic } : {}),
933
911
  ...(lane ? { lane } : {}),
934
912
  origin: h.item.origin.by,
935
913
  ...(h.item.origin.by === 'auto' ? { rule: h.item.origin.rule } : {}),
936
914
  ...(h.item.origin.by === 'agent' && h.item.origin.session ? { session: h.item.origin.session } : {}),
937
- status,
938
- move: moveOf(stateOf(h, followed.has(h.item.id)).state),
939
915
  versions: t.versions.length,
940
916
  views: own.length,
941
917
  thumb: thumbOf ? thumbFileOf(thumbOf) || null : null,
@@ -944,65 +920,13 @@ function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<st
944
920
  choice: h.item.choice === true,
945
921
  wip: inWork(h),
946
922
  ...(newest?.update ? { update: { state: newest.update.state, text: newest.text ?? '', at: newest.at } } : {}),
947
- waits: headWaits(t),
948
- ...nextRow(t),
949
- active: isActive(t, now),
950
923
  unread: newToOwner(members).length > 0,
951
- rework: reworkOf(h, followed.has(h.item.id), now),
952
924
  ids: idsOf(t),
953
- turn,
954
- ...(validatedOf({ turn, status, ...(isAskItem(h.item) ? { ask: askStateOf(t)?.state ?? 'open' } : {}) }) ? { validated: true as const } : {}),
955
- ...waitRow(t, now),
956
- ...asideRow(t, now),
957
- ...holderRow(t),
958
- ...cursorRow(t, now),
959
- ...workingRow(t, now),
960
- ...laneAskRow(t),
925
+ state,
961
926
  addresses: addressesOfThread(t),
962
927
  }
963
928
  }
964
929
 
965
- const waitRow = (t: Thread, now: Date): { wait: Wait; waitsOn?: WaitsOn; owed?: OwnerWait; verbs: OwnerWait[] } => {
966
- const w = waitEntryOf(t, now)
967
- const verbs = verbsOf(t, now)
968
- return { wait: w.wait, ...(w.on ? { waitsOn: w.on } : {}), ...(w.owed ? { owed: w.owed } : {}), verbs }
969
- }
970
-
971
- const workingRow = (t: Thread, now: Date): { working?: string; workingAt?: string } => {
972
- const last = workingsOf(t, now).last
973
- return last ? { working: last.who, workingAt: last.at } : {}
974
- }
975
-
976
- /** the next version an agent promised, while it stands (review/threads.ts nextVersionOf) */
977
- const nextRow = (t: Thread): { next?: NextVersion } => {
978
- const n = nextVersionOf(t)
979
- return n ? { next: n } : {}
980
- }
981
-
982
- const holderRow = (t: Thread): { holder?: { lane?: string; session?: string; handed?: true } } => {
983
- const h = holderOf(t)
984
- return h ? { holder: { ...(h.lane ? { lane: h.lane } : {}), ...(h.session ? { session: h.session } : {}), ...(h.from ? { handed: true as const } : {}) } } : {}
985
- }
986
-
987
- const laneAskRow = (t: Thread): { laneAsk?: LaneAsk } => {
988
- const a = laneAskOf(membersOf(t))
989
- return a ? { laneAsk: a } : {}
990
- }
991
-
992
- const cursorRow = (t: Thread, now: Date): { cursor?: Cursor } => {
993
- const c = cursorOf(t, now)
994
- return c ? { cursor: c } : {}
995
- }
996
-
997
- /** a row set aside: when it comes back, and whether an agent wrote in it after he set it aside */
998
- const asideRow = (t: Thread, now: Date): { aside?: { until: string; moved: boolean } } => {
999
- const until = asideUntil(t, now)
1000
- if (until === null) return {}
1001
- const msgs = membersOf(t).flatMap((x) => x.thread)
1002
- const set = msgs.filter((m) => m.snooze).map((m) => m.at).sort().at(-1) ?? ''
1003
- return { aside: { until, moved: msgs.some((m) => m.at > set && m.who !== 'owner' && m.op !== 'seen') || membersOf(t).some((x) => x.item.created > set) } }
1004
- }
1005
-
1006
930
  const TURN_RANK: Record<Turn, number> = { yours: 0, aside: 1, agents: 2, done: 3 }
1007
931
 
1008
932
  /** what a search reads of a thread: every item's title, words and id, and every message's words */
@@ -1019,12 +943,7 @@ export const refThreadOf = (row: ThreadRow): RefThread => ({
1019
943
  head: row.head,
1020
944
  title: row.title,
1021
945
  ...(row.tags.length > 0 ? { tags: row.tags } : {}),
1022
- turn: row.turn,
1023
- ...(row.holder ? { holder: row.holder } : {}),
1024
- ...(row.working ? { working: row.working } : {}),
1025
- ...(row.workingAt ? { workingAt: row.workingAt } : {}),
1026
- ...(row.laneAsk ? { laneAsk: row.laneAsk } : {}),
1027
- ...(row.next ? { next: row.next } : {}),
946
+ state: { turn: row.state.turn, holder: row.state.holder, working: row.state.working, laneAsk: row.state.laneAsk, next: row.state.next },
1028
947
  })
1029
948
 
1030
949
  /** by a thread's code, the messages of the other threads that name it: each thread's words read once */
@@ -1072,14 +991,13 @@ export function threadLinks(ix: ThreadIndex, t: Thread): Pick<ThreadView, 'refs'
1072
991
  * each, the newest activity first, the time the row shows), one row and one search text per thread. `ids`: every
1073
992
  * item id of the store, a broken one too, which the codes are given over (review/thread-code.ts) */
1074
993
  export function threadIndex(items: readonly ReviewItem[], now = new Date(), ids: Iterable<string> = items.map((x) => x.item.id)): ThreadIndex {
1075
- const followed = followedIds(items)
1076
994
  const codes = codesOf(ids)
1077
995
  const entries = orderedThreads(items)
1078
- .map((t) => ({ t, row: rowOf(t, items, followed, now, threadCode(codes, idsOf(t))), text: textOf(t) }))
996
+ .map((t) => ({ t, row: rowOf(t, now, threadCode(codes, idsOf(t))), text: textOf(t) }))
1079
997
  .map((e, i) => ({ e, i }))
1080
- .sort((a, b) => TURN_RANK[a.e.row.turn] - TURN_RANK[b.e.row.turn] || b.e.row.updated.localeCompare(a.e.row.updated) || a.i - b.i)
998
+ .sort((a, b) => TURN_RANK[a.e.row.state.turn] - TURN_RANK[b.e.row.state.turn] || b.e.row.updated.localeCompare(a.e.row.updated) || a.i - b.i)
1081
999
  .map(({ e }) => e)
1082
- const waiting = new Set(entries.filter((e) => e.row.turn === 'yours').map((e) => e.row.head))
1000
+ const waiting = new Set(entries.filter((e) => e.row.state.turn === 'yours').map((e) => e.row.head))
1083
1001
  const byItem = new Map<string, (typeof entries)[number]>()
1084
1002
  for (const e of entries) for (const id of e.row.ids) byItem.set(id, e)
1085
1003
  const byCode: ThreadIndex['byCode'] = (code) => {
@@ -1092,7 +1010,7 @@ export function threadIndex(items: readonly ReviewItem[], now = new Date(), ids:
1092
1010
  byCode,
1093
1011
  mentions: mentionsOf(entries, byCode),
1094
1012
  tags: knownTags(entries.map((e) => e.row)),
1095
- counts: { threads: entries.length, active: entries.filter((e) => e.row.active).length, waiting: waiting.size, unread: entries.filter((e) => e.row.unread && countsUnread(e.row.turn) && !countedAsItsAsk(e.t)).length },
1013
+ counts: { threads: entries.length, active: entries.filter((e) => e.row.state.active).length, waiting: waiting.size, unread: entries.filter((e) => e.row.unread && countsUnread(e.row.state.turn) && !countedAsItsAsk(e.t)).length },
1096
1014
  subjects: [...new Set(items.map((x) => x.item.subject.kind))].sort(),
1097
1015
  lanes: [...new Set(entries.flatMap((e) => (e.row.lane ? [e.row.lane] : [])))].sort(),
1098
1016
  waiting,
@@ -1108,6 +1026,9 @@ function keptAt(ix: ThreadIndex, rows: readonly ThreadRow[], kept: ThreadRow): n
1108
1026
  return i === -1 ? rows.length : i
1109
1027
  }
1110
1028
 
1029
+ /** whose move a turn is, as the « whoever moves next » filter names it: his (his turn or set aside), an agent's, nobody's */
1030
+ const whoseOf = (t: Turn): Move => (t === 'yours' || t === 'aside' ? 'owner' : t === 'agents' ? 'agents' : 'none')
1031
+
1111
1032
  /** one page of the index for a query; the open thread's row (`keep`) in it whatever the filters */
1112
1033
  export function pageOf(ix: ThreadIndex, q: ThreadQuery, broken: ThreadPage['broken'] = []): ThreadPage {
1113
1034
  // words, `t:<tag>` each a thread must carry, a thread's code (review/thread-query.ts)
@@ -1118,18 +1039,18 @@ export function pageOf(ix: ThreadIndex, q: ThreadQuery, broken: ThreadPage['brok
1118
1039
  ({ row, text }) =>
1119
1040
  !coded.includes(row) &&
1120
1041
  tags.every((t) => row.tags.includes(t)) &&
1121
- (q.handled || row.active) &&
1042
+ (q.handled || row.state.active) &&
1122
1043
  (q.subject === null || row.subject === q.subject) &&
1123
- (q.whose === null || row.move === q.whose) &&
1124
- (q.turn === null || row.turn === q.turn) &&
1125
- (q.status === null || row.status === q.status) &&
1044
+ (q.whose === null || whoseOf(row.state.turn) === q.whose) &&
1045
+ (q.turn === null || row.state.turn === q.turn) &&
1046
+ (q.status === null || row.state.status === q.status) &&
1126
1047
  (q.lane === null || row.lane === q.lane) &&
1127
1048
  words.every((w) => text.includes(w)),
1128
1049
  )
1129
1050
  // each verb's count under every other filter, so the « what I must do » toggles say what each one gives
1130
1051
  const byWait = { ...NO_WAITS }
1131
- for (const e of hits) for (const v of e.row.verbs) byWait[v] += 1
1132
- const shown = [...ix.entries.filter((e) => coded.includes(e.row)), ...hits.filter((e) => waitsMatch(q.wait, e.row.verbs))]
1052
+ for (const e of hits) for (const v of e.row.state.verbs) byWait[v] += 1
1053
+ const shown = [...ix.entries.filter((e) => coded.includes(e.row)), ...hits.filter((e) => waitsMatch(q.wait, e.row.state.verbs))]
1133
1054
  const rows = shown.slice(q.offset, q.offset + q.limit).map((e) => e.row)
1134
1055
  const keep = q.keep
1135
1056
  const kept = keep === null ? null : (ix.entries.find((e) => e.row.head === keep || e.row.ids.includes(keep))?.row ?? null)
@@ -1168,47 +1089,13 @@ export function threadsOfAddress(ix: ThreadIndex, threads: readonly Thread[], as
1168
1089
  const rows = new Map(ix.entries.map((e) => [e.row.head, e.row]))
1169
1090
  const as = (t: Thread, owns: boolean): ObjectThread | null => {
1170
1091
  const r = rows.get(t.head.item.id)
1171
- return r ? { head: r.head, title: r.title, turn: r.turn, status: r.status, owns, updated: r.updated } : null
1092
+ return r ? { head: r.head, title: r.title, turn: r.state.turn, status: r.state.status, owns, updated: r.updated } : null
1172
1093
  }
1173
1094
  const up: string[] = []
1174
1095
  for (let a: string | null = address; a !== null; a = parentAddress(a)) up.push(a)
1175
1096
  const owner = up.map((a) => threads.find((t) => ownAddressesOf(t).includes(a))).find((t) => t !== undefined) ?? null
1176
1097
  const naming = threads.filter((t) => addressesOfThread(t).some((a) => a === address || a.startsWith(`${address}/`)) || t === owner)
1177
1098
  const list = naming.flatMap((t) => as(t, t === owner) ?? []).sort((a, b) => b.updated.localeCompare(a.updated))
1178
- const open = ix.entries.filter((e) => e.row.turn !== 'done' && !list.some((l) => l.head === e.row.head)).slice(0, 30).flatMap((e) => as(e.t, false) ?? [])
1099
+ const open = ix.entries.filter((e) => e.row.state.turn !== 'done' && !list.some((l) => l.head === e.row.head)).slice(0, 30).flatMap((e) => as(e.t, false) ?? [])
1179
1100
  return { address: asked, threads: list, noteGoesTo: owner?.head.item.id ?? null, open }
1180
1101
  }
1181
-
1182
- // ── the dispatcher's board ──
1183
-
1184
- /** one raised item on the board: what he, a player or a rule raised, where it stands */
1185
- export interface BoardRow {
1186
- id: string
1187
- title: string
1188
- state: ItemState['state']
1189
- topic?: string
1190
- worker?: string
1191
- stale: boolean
1192
- /** who raised it, in a few words: `live#85`, `auto veille`, empty for him */
1193
- from: string
1194
- }
1195
-
1196
- /** every raised item that is not a mark, by state: the board's rows */
1197
- export function boardOf(items: readonly ReviewItem[], now = new Date()): BoardRow[] {
1198
- const followed = followedIds(items)
1199
- return items
1200
- .filter((x) => x.item.origin.by !== 'agent' && !isMarkItem(x))
1201
- .map((x) => {
1202
- const st = stateOf(x, followed.has(x.item.id))
1203
- const o = x.item.origin
1204
- return {
1205
- id: x.item.id,
1206
- title: x.item.title,
1207
- state: st.state,
1208
- ...(st.topic ? { topic: st.topic } : {}),
1209
- ...(st.worker ? { worker: st.worker } : {}),
1210
- stale: isStale(x, now),
1211
- from: o.by === 'player' ? `${o.server}#${o.serverId}` : o.by === 'auto' ? `auto ${o.rule}` : '',
1212
- }
1213
- })
1214
- }