rvlib-shipkit 2.26.0 → 2.27.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 (442) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +6 -4
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +1 -3
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/render.ts +122 -21
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +314 -40
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +320 -99
  15. package/src/agent-time/timeline.ts +140 -21
  16. package/src/agent-time/turns.ts +18 -8
  17. package/src/annex/offload.ts +17 -6
  18. package/src/annex/tidy.ts +70 -10
  19. package/src/asks/ask-after.ts +40 -0
  20. package/src/asks/asks-queue.ts +205 -47
  21. package/src/assets/kit-config.ts +7 -3
  22. package/src/assets/kits/identity-kit.ts +289 -10
  23. package/src/check.ts +3 -1
  24. package/src/checks/SK004-gitignore-policy.check.ts +12 -5
  25. package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
  26. package/src/checks/SK026-asks-autoclose.check.ts +5 -5
  27. package/src/checks/SK028-readme.check.ts +7 -66
  28. package/src/checks/SK030-cache-audit.check.ts +6 -1
  29. package/src/checks/SK031-trace-audit.check.ts +2 -0
  30. package/src/checks/SK033-global-contribution.check.ts +3 -1
  31. package/src/checks/SK035-public-clean.check.ts +2 -2
  32. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  33. package/src/checks/SK047-login-in-description.check.ts +36 -0
  34. package/src/checks/SK048-one-local-file.check.ts +36 -0
  35. package/src/cli/cmd_Asks.ts +71 -5
  36. package/src/cli/cmd_Backup.ts +2 -2
  37. package/src/cli/cmd_Capacity.ts +2 -2
  38. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  39. package/src/cli/cmd_Db.ts +253 -0
  40. package/src/cli/cmd_History.ts +212 -0
  41. package/src/cli/cmd_Home.ts +31 -3
  42. package/src/cli/cmd_Hq.ts +516 -0
  43. package/src/cli/cmd_Machines.ts +36 -0
  44. package/src/cli/cmd_Media.ts +38 -6
  45. package/src/cli/cmd_Reflect.ts +23 -2
  46. package/src/cli/cmd_Review.ts +548 -116
  47. package/src/cli/cmd_Secret.ts +62 -12
  48. package/src/cli/cmd_Social.ts +83 -1
  49. package/src/cli/cmd_Space.ts +324 -0
  50. package/src/cli/cmd_Time.ts +76 -5
  51. package/src/cli/cmd_Tmp.ts +28 -4
  52. package/src/cli/cmd_Trailer.ts +14 -10
  53. package/src/cli/cmd_Urls.ts +56 -0
  54. package/src/cli/cmd_Vault.ts +583 -0
  55. package/src/cli/family-help.ts +4 -2
  56. package/src/cli/family-pages.ts +1 -1
  57. package/src/cli/registry.ts +24 -3
  58. package/src/collections/actions.ts +63 -13
  59. package/src/collections/collection-types.ts +23 -1
  60. package/src/collections/providers.ts +117 -23
  61. package/src/collections/review.ts +4 -4
  62. package/src/contracts/contract-manifests.ts +6 -5
  63. package/src/contracts/contract-types.ts +6 -4
  64. package/src/contracts/contracts-engine.ts +11 -0
  65. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  66. package/src/core/budget.ts +12 -17
  67. package/src/core/capacity.ts +27 -18
  68. package/src/core/check-runner.ts +7 -4
  69. package/src/core/layout.ts +3 -0
  70. package/src/core/machine-busy.ts +127 -0
  71. package/src/core/machine-commit.ts +6 -1
  72. package/src/core/machine-db.ts +368 -20
  73. package/src/core/machine-layout.ts +137 -0
  74. package/src/core/machine-read.ts +81 -0
  75. package/src/core/migrate-layout.ts +1 -1
  76. package/src/core/one-way-in-policy.ts +64 -7
  77. package/src/core/polling-policy.ts +27 -0
  78. package/src/core/retention.ts +16 -2
  79. package/src/core/scope.ts +107 -14
  80. package/src/core/slots.ts +5 -4
  81. package/src/drill/clean.ts +25 -1
  82. package/src/drill/run.ts +1 -1
  83. package/src/drill/seal.ts +27 -4
  84. package/src/home/activity-shape.ts +2 -0
  85. package/src/home/activity.ts +66 -3
  86. package/src/home/app-sign.ts +15 -4
  87. package/src/home/daemon-jobs.ts +149 -7
  88. package/src/home/database-projects.ts +111 -0
  89. package/src/home/database-words.ts +203 -0
  90. package/src/home/databases.ts +460 -0
  91. package/src/home/global-units.ts +6 -0
  92. package/src/home/gui-app/ShipkitGui.swift +122 -1
  93. package/src/home/gui-app.ts +6 -3
  94. package/src/home/home-move.ts +514 -0
  95. package/src/home/home-paths.ts +12 -3
  96. package/src/home/home-routes.ts +68 -0
  97. package/src/home/inbox-shape.ts +24 -14
  98. package/src/home/machine-fold.ts +820 -0
  99. package/src/home/machine-host.ts +20 -5
  100. package/src/home/machine-repair.ts +503 -0
  101. package/src/home/machine-stores.ts +66 -15
  102. package/src/home/machine-temp.ts +547 -86
  103. package/src/home/resume.ts +79 -0
  104. package/src/home/run-daemon.ts +25 -4
  105. package/src/home/run-pm.ts +18 -5
  106. package/src/home/serve-daemon.ts +18 -3
  107. package/src/home/serve-web.ts +175 -7
  108. package/src/home/space-job.ts +115 -0
  109. package/src/home/space-page.ts +257 -0
  110. package/src/home/space-route.ts +167 -0
  111. package/src/home/space-words.ts +103 -0
  112. package/src/home/time-page-shape.ts +202 -0
  113. package/src/home/time-page.ts +64 -0
  114. package/src/home/vault-page.ts +482 -0
  115. package/src/home/vault-words.ts +132 -0
  116. package/src/hooks/leak-guard.ts +40 -13
  117. package/src/hooks/one-way-in-guard.ts +17 -4
  118. package/src/hq/cards.ts +581 -0
  119. package/src/hq/door-route.ts +43 -0
  120. package/src/hq/door.ts +163 -0
  121. package/src/hq/files-send.ts +348 -0
  122. package/src/hq/forgotten-log.ts +35 -0
  123. package/src/hq/history-check.ts +255 -0
  124. package/src/hq/history-place.ts +146 -0
  125. package/src/hq/history-send.ts +487 -0
  126. package/src/hq/hq-db.ts +99 -0
  127. package/src/hq/hq-local.ts +469 -0
  128. package/src/hq/hq-routes.ts +196 -0
  129. package/src/hq/hq-store.ts +599 -0
  130. package/src/hq/kinds/ask.ts +147 -0
  131. package/src/hq/kinds/card-gone.ts +83 -0
  132. package/src/hq/kinds/card-msg.ts +66 -0
  133. package/src/hq/kinds/card.ts +99 -0
  134. package/src/hq/kinds/index.ts +21 -0
  135. package/src/hq/kinds/kind.ts +126 -0
  136. package/src/hq/kinds/media.ts +125 -0
  137. package/src/hq/kinds/prompt.ts +219 -0
  138. package/src/hq/kinds/reflection.ts +128 -0
  139. package/src/hq/kinds/report.ts +55 -0
  140. package/src/hq/kinds/time-day.ts +236 -0
  141. package/src/hq/ledger.ts +473 -0
  142. package/src/hq/machine-key.ts +44 -0
  143. package/src/hq/machine-notes.ts +131 -0
  144. package/src/hq/outbox.ts +372 -0
  145. package/src/hq/replica.ts +168 -0
  146. package/src/hq/repo-id.ts +4 -0
  147. package/src/hq/report-facts.ts +117 -0
  148. package/src/hq/report.ts +274 -0
  149. package/src/hq/switch.ts +151 -0
  150. package/src/hq/vault-grant.ts +92 -0
  151. package/src/identities/identities.ts +15 -3
  152. package/src/identities/steps.ts +31 -0
  153. package/src/ledger/db.ts +73 -26
  154. package/src/ledger/gate-checks.ts +6 -2
  155. package/src/ledger/run-log.ts +11 -3
  156. package/src/ledger/store.ts +26 -4
  157. package/src/media-store/backup/daemon.ts +25 -17
  158. package/src/media-store/backup/kept.ts +241 -0
  159. package/src/media-store/backup/restore.ts +14 -4
  160. package/src/media-store/backup/run.ts +11 -11
  161. package/src/media-store/backup/secret.ts +6 -4
  162. package/src/media-store/backup/snapshot.ts +4 -2
  163. package/src/media-store/backup/sources.ts +67 -16
  164. package/src/media-store/copy/config.ts +77 -0
  165. package/src/media-store/copy/copy.ts +194 -0
  166. package/src/media-store/copy/lifecycle.ts +43 -0
  167. package/src/media-store/copy/night.ts +90 -0
  168. package/src/media-store/copy/proof.ts +151 -0
  169. package/src/media-store/copy/snapshot.ts +152 -0
  170. package/src/media-store/copy/store.ts +62 -0
  171. package/src/media-store/copy/stream.ts +176 -0
  172. package/src/media-store/daemon.ts +66 -16
  173. package/src/media-store/db.ts +22 -11
  174. package/src/media-store/forget.ts +23 -3
  175. package/src/media-store/hand.ts +4 -3
  176. package/src/media-store/hq-find.ts +75 -0
  177. package/src/media-store/hq-send.ts +277 -0
  178. package/src/media-store/kind.ts +2 -0
  179. package/src/media-store/purge.ts +18 -15
  180. package/src/media-store/put.ts +24 -8
  181. package/src/media-store/remote.ts +16 -7
  182. package/src/media-store/space-listing.ts +240 -0
  183. package/src/media-store/space.ts +40 -21
  184. package/src/media-store/sync.ts +5 -5
  185. package/src/media-store/tidy.ts +98 -0
  186. package/src/media-store/upload.ts +3 -3
  187. package/src/media-store/webp.ts +66 -0
  188. package/src/messages/model.ts +16 -7
  189. package/src/messages/routes.ts +14 -4
  190. package/src/messages/score.ts +2 -2
  191. package/src/messages/suggest.ts +96 -0
  192. package/src/pages/frame-client.ts +10 -0
  193. package/src/plan/planner.ts +28 -17
  194. package/src/recordings/media-kind.ts +1 -0
  195. package/src/recordings/model.ts +1 -1
  196. package/src/recordings/recorder-app/Capture.swift +9 -7
  197. package/src/reflect/hq-corpus.ts +56 -0
  198. package/src/reflect/prompt-corpus.ts +3 -1
  199. package/src/reflect/transcript.ts +129 -37
  200. package/src/release/machine-words.ts +67 -0
  201. package/src/release/public-clean.ts +8 -3
  202. package/src/releases/from-card.ts +1 -1
  203. package/src/releases/routes.ts +10 -5
  204. package/src/releases/store.ts +10 -1
  205. package/src/repo-config.ts +32 -2
  206. package/src/review/anim.ts +2 -2
  207. package/src/review/auto.ts +2 -2
  208. package/src/review/card-db.ts +244 -0
  209. package/src/review/card-rows.ts +266 -0
  210. package/src/review/cells.ts +76 -5
  211. package/src/review/draft-card.ts +41 -0
  212. package/src/review/draft-model.ts +78 -0
  213. package/src/review/format.ts +29 -10
  214. package/src/review/gone.ts +98 -0
  215. package/src/review/inbox-hook.ts +4 -4
  216. package/src/review/marks.ts +1 -1
  217. package/src/review/media-kind.ts +7 -5
  218. package/src/review/media-read.ts +9 -7
  219. package/src/review/media.ts +32 -5
  220. package/src/review/model.ts +202 -39
  221. package/src/review/move.ts +491 -0
  222. package/src/review/notes.ts +12 -20
  223. package/src/review/previews.ts +15 -19
  224. package/src/review/project.ts +1 -1
  225. package/src/review/rev.ts +8 -0
  226. package/src/review/role.ts +1 -1
  227. package/src/review/routes.ts +64 -13
  228. package/src/review/stage-card.ts +8 -4
  229. package/src/review/stage-routes.ts +1 -1
  230. package/src/review/store.ts +529 -83
  231. package/src/review/thread-fold.ts +51 -0
  232. package/src/review/threads.ts +147 -9
  233. package/src/review/trailer-auto-mock.ts +63 -0
  234. package/src/review/trailer-card.ts +4 -4
  235. package/src/review/trailer-desk.ts +41 -7
  236. package/src/review/trailer-media.ts +1 -0
  237. package/src/review/trailer-model.ts +8 -0
  238. package/src/review/trailer-notes.ts +1 -1
  239. package/src/review/trailer-routes.ts +9 -1
  240. package/src/review/unit.ts +6 -6
  241. package/src/review/watchers.ts +1 -1
  242. package/src/rules/untrack-generated.ts +92 -8
  243. package/src/secrets/held.ts +16 -0
  244. package/src/secrets/keychain.ts +113 -0
  245. package/src/secrets/list.ts +16 -6
  246. package/src/secrets/manager.ts +24 -10
  247. package/src/secrets/read.ts +257 -0
  248. package/src/secrets/who-reads.ts +49 -0
  249. package/src/serve/door-forward.ts +268 -0
  250. package/src/serve/door-names.ts +47 -0
  251. package/src/serve/embed.ts +1 -1
  252. package/src/serve/hub-app/activity-view.tsx +56 -32
  253. package/src/serve/hub-app/activity.css +7 -1
  254. package/src/serve/hub-app/asks-page.tsx +48 -0
  255. package/src/serve/hub-app/asks-st.ts +25 -0
  256. package/src/serve/hub-app/clock-svc.ts +1 -2
  257. package/src/serve/hub-app/col-card.tsx +64 -13
  258. package/src/serve/hub-app/col-list-page.tsx +122 -0
  259. package/src/serve/hub-app/col-list-st.ts +103 -0
  260. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  261. package/src/serve/hub-app/col-tables.ts +76 -8
  262. package/src/serve/hub-app/cols-svc.ts +70 -16
  263. package/src/serve/hub-app/database-st.ts +260 -0
  264. package/src/serve/hub-app/database-view.tsx +289 -0
  265. package/src/serve/hub-app/database.css +32 -0
  266. package/src/serve/hub-app/entry-bar.css +14 -0
  267. package/src/serve/hub-app/entry-bar.tsx +33 -0
  268. package/src/serve/hub-app/entry-pick.ts +31 -0
  269. package/src/serve/hub-app/floating.tsx +1 -0
  270. package/src/serve/hub-app/hash-route.ts +11 -1
  271. package/src/serve/hub-app/header-bar.tsx +14 -18
  272. package/src/serve/hub-app/home-st.ts +89 -9
  273. package/src/serve/hub-app/home-strip.css +5 -19
  274. package/src/serve/hub-app/home-strip.tsx +58 -92
  275. package/src/serve/hub-app/home.html +7 -0
  276. package/src/serve/hub-app/hub-app.tsx +31 -142
  277. package/src/serve/hub-app/hub-types.ts +3 -1
  278. package/src/serve/hub-app/hub.css +109 -23
  279. package/src/serve/hub-app/icons.tsx +18 -1
  280. package/src/serve/hub-app/identities-st.ts +56 -6
  281. package/src/serve/hub-app/identities-view.tsx +100 -58
  282. package/src/serve/hub-app/identities.css +17 -15
  283. package/src/serve/hub-app/identity-address.ts +5 -0
  284. package/src/serve/hub-app/inbox-st.ts +41 -24
  285. package/src/serve/hub-app/inbox-view.tsx +37 -41
  286. package/src/serve/hub-app/inbox.css +2 -5
  287. package/src/serve/hub-app/index.html +7 -0
  288. package/src/serve/hub-app/kept-cols.tsx +7 -0
  289. package/src/serve/hub-app/keys.ts +28 -15
  290. package/src/serve/hub-app/later.tsx +26 -0
  291. package/src/serve/hub-app/list-filter.tsx +14 -0
  292. package/src/serve/hub-app/list-walk.ts +72 -3
  293. package/src/serve/hub-app/machines-st.ts +251 -0
  294. package/src/serve/hub-app/machines-view.tsx +224 -0
  295. package/src/serve/hub-app/machines.css +76 -0
  296. package/src/serve/hub-app/md-copy.tsx +79 -0
  297. package/src/serve/hub-app/media-view.tsx +2 -0
  298. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  299. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  300. package/src/serve/hub-app/messages.css +14 -0
  301. package/src/serve/hub-app/page-keys.ts +175 -0
  302. package/src/serve/hub-app/pages-frames.tsx +11 -3
  303. package/src/serve/hub-app/palette-st.ts +58 -11
  304. package/src/serve/hub-app/palette-view.tsx +3 -1
  305. package/src/serve/hub-app/project-list.css +54 -8
  306. package/src/serve/hub-app/project-list.tsx +128 -59
  307. package/src/serve/hub-app/projects-svc.ts +78 -7
  308. package/src/serve/hub-app/reader-chips.tsx +13 -0
  309. package/src/serve/hub-app/readme-view.tsx +2 -3
  310. package/src/serve/hub-app/readme.css +27 -5
  311. package/src/serve/hub-app/reflections-page.tsx +42 -0
  312. package/src/serve/hub-app/reflections-st.ts +17 -0
  313. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  314. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  315. package/src/serve/hub-app/repo-sections.ts +9 -5
  316. package/src/serve/hub-app/repo-st.ts +35 -8
  317. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  318. package/src/serve/hub-app/review/kit.tsx +50 -7
  319. package/src/serve/hub-app/review/note-place.ts +1 -1
  320. package/src/serve/hub-app/review/review-board.tsx +2 -2
  321. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  322. package/src/serve/hub-app/review/review-kit.ts +27 -1
  323. package/src/serve/hub-app/review/review-list.tsx +68 -30
  324. package/src/serve/hub-app/review/review-page.tsx +7 -8
  325. package/src/serve/hub-app/review/review-st.ts +111 -24
  326. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  327. package/src/serve/hub-app/review/review-views.tsx +475 -144
  328. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  329. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  330. package/src/serve/hub-app/review/thread-st.ts +73 -26
  331. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  332. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  333. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  334. package/src/serve/hub-app/review.css +267 -61
  335. package/src/serve/hub-app/side-lists.ts +72 -0
  336. package/src/serve/hub-app/sidebar.tsx +6 -3
  337. package/src/serve/hub-app/site/site-part.tsx +2 -8
  338. package/src/serve/hub-app/site/site-st.ts +4 -4
  339. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  340. package/src/serve/hub-app/social/kit.tsx +30 -4
  341. package/src/serve/hub-app/social/post-card.tsx +139 -49
  342. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  343. package/src/serve/hub-app/social/social-model.ts +11 -0
  344. package/src/serve/hub-app/social/social-page.tsx +94 -35
  345. package/src/serve/hub-app/social/social-st.ts +120 -36
  346. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  347. package/src/serve/hub-app/social/stage-st.ts +1 -1
  348. package/src/serve/hub-app/social/step-layout.ts +1 -1
  349. package/src/serve/hub-app/social.css +3 -0
  350. package/src/serve/hub-app/space-st.ts +209 -0
  351. package/src/serve/hub-app/space-view.tsx +196 -0
  352. package/src/serve/hub-app/space.css +27 -0
  353. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  354. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  355. package/src/serve/hub-app/stores.css +6 -1
  356. package/src/serve/hub-app/theme-st.ts +22 -9
  357. package/src/serve/hub-app/time-charts.tsx +291 -0
  358. package/src/serve/hub-app/time-pages.tsx +749 -0
  359. package/src/serve/hub-app/time-st.ts +162 -0
  360. package/src/serve/hub-app/time-view.tsx +76 -0
  361. package/src/serve/hub-app/time.css +138 -0
  362. package/src/serve/hub-app/tree-build.ts +52 -42
  363. package/src/serve/hub-app/tree-row.tsx +4 -4
  364. package/src/serve/hub-app/tree-svc.ts +18 -9
  365. package/src/serve/hub-app/urls-svc.ts +154 -0
  366. package/src/serve/hub-app/urls-view.tsx +117 -0
  367. package/src/serve/hub-app/urls.css +30 -0
  368. package/src/serve/hub-app/vault-st.ts +127 -0
  369. package/src/serve/hub-app/vault-view.tsx +154 -0
  370. package/src/serve/hub-app/vault.css +38 -0
  371. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  372. package/src/serve/hub-app/waiting-svc.ts +29 -0
  373. package/src/serve/hub-app/wikis-view.tsx +2 -2
  374. package/src/serve/hub-runtime.ts +15 -2
  375. package/src/serve/project-gutter-route.ts +27 -14
  376. package/src/serve/project-gutter.ts +25 -12
  377. package/src/serve/same-origin.ts +10 -0
  378. package/src/serve/serve-hub.ts +13 -4
  379. package/src/shipkit-files.ts +16 -2
  380. package/src/shipkit.ts +1 -1
  381. package/src/shot/shooter.ts +616 -420
  382. package/src/shot/shot-ask.ts +246 -155
  383. package/src/site/desk.ts +2 -2
  384. package/src/smoke/run-smoke.ts +3 -2
  385. package/src/social/cover.ts +202 -0
  386. package/src/social/discord-layout.ts +37 -13
  387. package/src/social/drafts.ts +3 -0
  388. package/src/social/load.ts +23 -2
  389. package/src/social/media-kind.ts +2 -1
  390. package/src/social/publish/discord.ts +5 -2
  391. package/src/social/publish/secret.ts +2 -2
  392. package/src/social/release-stage.ts +28 -13
  393. package/src/social/routes.ts +26 -1
  394. package/src/social/stage.ts +1 -1
  395. package/src/social/stats.ts +12 -9
  396. package/src/social/strip.ts +4 -1
  397. package/src/social/thumbnail.ts +255 -0
  398. package/src/stores/collection.ts +15 -11
  399. package/src/stores/desk.ts +236 -42
  400. package/src/stores/model.ts +72 -6
  401. package/src/stores/routes.ts +37 -12
  402. package/src/stores/unit.ts +14 -8
  403. package/src/suite/judge-suites.ts +41 -11
  404. package/src/suite/select.ts +45 -3
  405. package/src/suite/suite-cli.ts +16 -10
  406. package/src/trailer/bed.ts +1 -1
  407. package/src/trailer/build.ts +134 -21
  408. package/src/trailer/ffmpeg.ts +7 -0
  409. package/src/trailer/fonts.ts +3 -2
  410. package/src/trailer/grammar.ts +201 -2
  411. package/src/trailer/graph.ts +42 -5
  412. package/src/trailer/look.ts +21 -0
  413. package/src/trailer/mock.ts +154 -0
  414. package/src/trailer/passage.ts +65 -26
  415. package/src/trailer/score/heard.ts +89 -0
  416. package/src/trailer/score/sound.ts +14 -8
  417. package/src/trailer/sound/run.ts +16 -6
  418. package/src/trailer/stitch.ts +26 -5
  419. package/src/trailer/titles.ts +82 -19
  420. package/src/trailer/versions.ts +1 -3
  421. package/src/trailer/vertical.ts +3 -1
  422. package/src/urls/frame.ts +195 -0
  423. package/src/urls/routes.ts +43 -0
  424. package/src/urls/rows.ts +171 -0
  425. package/src/urls/unit.ts +73 -0
  426. package/src/vault/house-keys.ts +42 -0
  427. package/src/vault/layout.ts +50 -0
  428. package/src/vault/policy.ts +165 -0
  429. package/src/vault/vault-audit.ts +276 -0
  430. package/src/vault/vault-client.ts +40 -0
  431. package/src/vault/vault-config.ts +159 -0
  432. package/src/vault/vault-destroy.ts +78 -0
  433. package/src/vault/vault-handover.ts +305 -0
  434. package/src/vault/vault-http.ts +352 -0
  435. package/src/vault/vault-import.ts +208 -0
  436. package/src/vault/vault-init.ts +328 -0
  437. package/src/vault/vault-minter.ts +271 -0
  438. package/src/vault/vault-restore.ts +333 -0
  439. package/src/vault/vault-serve.ts +342 -0
  440. package/src/vault/vault-snapshot.ts +281 -0
  441. package/src/veille/asks.ts +1 -1
  442. package/src/veille/desk.ts +2 -2
@@ -0,0 +1,115 @@
1
+ // one object's thread control (wiki tools/shipkit/threads-page.md, A thread on any object): the threads that name its
2
+ // address, the one his note goes to, the open threads he may attach it to. Every control a page draws is asked in ONE
3
+ // request once the page holds still (QUIET_MS after the last one mounts): a page of fifty objects costs one round trip,
4
+ // and stepping through pages with the keys costs none
5
+ import { makeAutoObservable, runInAction } from 'mobx'
6
+ import type { ObjectThread } from '../../../review/cells.ts'
7
+ import { postJson } from './review-kit.ts'
8
+
9
+ export interface ObjectThreads {
10
+ address: string
11
+ threads: ObjectThread[]
12
+ noteGoesTo: string | null
13
+ open: ObjectThread[]
14
+ }
15
+
16
+ /** what a control needs of its repo: its api's url, and the way to open a thread (the hub's, or the frame host's) */
17
+ export interface ControlHost {
18
+ url(path: string): string
19
+ openThread(id: string): void
20
+ }
21
+
22
+ /** the wait after the last control mounts before the one request: a step that draws from what the page holds asks nothing */
23
+ const QUIET_MS = 250
24
+
25
+ const asked = new Map<string, { host: ControlHost; addresses: Set<string>; waiters: ((all: Map<string, ObjectThreads>) => void)[]; timer: ReturnType<typeof setTimeout> | null }>()
26
+
27
+ /** the threads of many addresses of one repo, asked once the page holds still */
28
+ function batched(host: ControlHost, address: string): Promise<Map<string, ObjectThreads>> {
29
+ const key = host.url('/api/review/of')
30
+ const b = asked.get(key) ?? { host, addresses: new Set<string>(), waiters: [], timer: null }
31
+ asked.set(key, b)
32
+ b.addresses.add(address)
33
+ if (b.timer !== null) clearTimeout(b.timer)
34
+ b.timer = setTimeout(() => {
35
+ asked.delete(key)
36
+ const q = [...b.addresses].map((a) => `address=${encodeURIComponent(a)}`).join('&')
37
+ fetch(`${key}?${q}`)
38
+ .then((r) => (r.ok ? (r.json() as Promise<{ objects: ObjectThreads[] }>) : { objects: [] }))
39
+ .catch(() => ({ objects: [] }))
40
+ .then((r) => {
41
+ const all = new Map(r.objects.map((o) => [o.address, o]))
42
+ for (const w of b.waiters) w(all)
43
+ })
44
+ }, QUIET_MS)
45
+ return new Promise((res) => b.waiters.push(res))
46
+ }
47
+
48
+ export class ThreadControlSt {
49
+ data: ObjectThreads | null = null
50
+ text = ''
51
+ busy = false
52
+ error: string | null = null
53
+
54
+ constructor(
55
+ private readonly host: ControlHost,
56
+ readonly address: string,
57
+ readonly name: string,
58
+ ) {
59
+ makeAutoObservable(this, {}, { autoBind: true })
60
+ }
61
+
62
+ async load(): Promise<void> {
63
+ const all = await batched(this.host, this.address)
64
+ runInAction(() => (this.data = all.get(this.address) ?? { address: this.address, threads: [], noteGoesTo: null, open: [] }))
65
+ }
66
+
67
+ get count(): number {
68
+ return this.data?.threads.length ?? 0
69
+ }
70
+
71
+ /** a thread on it waits on him */
72
+ get yours(): boolean {
73
+ return this.data?.threads.some((t) => t.turn === 'yours') ?? false
74
+ }
75
+
76
+ setText(t: string): void {
77
+ this.text = t
78
+ }
79
+
80
+ open(id: string): void {
81
+ this.host.openThread(id)
82
+ }
83
+
84
+ /** the owner's words on the object: a note read in the thread its address has, else a thread of its own; then it opens */
85
+ async note(): Promise<void> {
86
+ const text = this.text.trim()
87
+ if (!text || this.busy) return
88
+ await this.act(async () => {
89
+ const r = (await postJson(this.host.url('/api/review/note'), { address: this.address, text, name: this.name })) as { id: string }
90
+ runInAction(() => (this.text = ''))
91
+ this.host.openThread(r.id)
92
+ })
93
+ }
94
+
95
+ /** the object becomes a link of an open thread */
96
+ async attach(head: string): Promise<void> {
97
+ await this.act(async () => {
98
+ await postJson(this.host.url(`/api/review/${head}/attach`), { address: this.address })
99
+ this.host.openThread(head)
100
+ })
101
+ }
102
+
103
+ private async act(fn: () => Promise<void>): Promise<void> {
104
+ this.busy = true
105
+ this.error = null
106
+ try {
107
+ await fn()
108
+ await this.load()
109
+ } catch (e) {
110
+ runInAction(() => (this.error = (e as Error).message))
111
+ } finally {
112
+ runInAction(() => (this.busy = false))
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,74 @@
1
+ // the thread control of any object the hub shows (wiki tools/shipkit/threads-page.md, A thread on any object): how many
2
+ // threads name it, and a menu to open one, start one with the owner's words, or attach it to an open thread
3
+ import { observer, useLocalObservable } from 'mobx-react-lite'
4
+ import { useEffect } from 'react'
5
+ import { Pop } from '../floating.tsx'
6
+ import type { RepoSt } from '../repo-st.ts'
7
+ import { ThreadControlSt, type ControlHost } from './thread-control-st.ts'
8
+
9
+ /** a repo's way to a thread: the hub's threads page, or the host's when the page sits in another tool's frame */
10
+ export const threadHost = (st: RepoSt): ControlHost => ({
11
+ url: (p) => st.url(p),
12
+ openThread: (id) => {
13
+ if (st.home.embedded && window.parent !== window) window.parent.postMessage({ shipkit: 'show', page: 'review', hash: `#page:review:${id}` }, location.origin)
14
+ else st.showReview(id)
15
+ },
16
+ })
17
+
18
+ const TURN: Record<string, string> = { yours: 'your turn', working: 'in work', done: 'done' }
19
+
20
+ export const ThreadControl = observer(({ st, address, name, host }: { st?: RepoSt; host?: ControlHost; address: string; name: string }) => {
21
+ const h = host ?? (st ? threadHost(st) : null)
22
+ const s = useLocalObservable(() => new ThreadControlSt(h as ControlHost, address, name))
23
+ useEffect(() => {
24
+ void s.load()
25
+ }, [s])
26
+ if (!h) return null
27
+ const label = s.count > 0 ? `💬 ${s.count}` : '💬'
28
+ return (
29
+ <Pop label={label} className={`ghost rv-tcbtn${s.yours ? ' yours' : ''}${s.count > 0 ? ' has' : ''}`} title={`threads on ${name} (${address})`} aria-label={`threads on ${name}`} popClass="fpop rv-tcpop">
30
+ {(close) => (
31
+ <div className="rv-tc" onClick={(e) => e.stopPropagation()}>
32
+ <div className="rv-tchead">
33
+ <b>{name}</b> <span className="rv-dim">{address}</span>
34
+ </div>
35
+ {s.data?.threads.map((t) => (
36
+ <button key={t.head} className="rv-tcrow" onClick={() => (close(), s.open(t.head))}>
37
+ <span className={`rv-badge turn-${t.turn}`}>{TURN[t.turn]}</span> {t.title}
38
+ {t.owns ? <span className="rv-dim"> · its thread</span> : null}
39
+ </button>
40
+ ))}
41
+ <textarea
42
+ className="rv-answerwords"
43
+ rows={2}
44
+ placeholder={s.data?.noteGoesTo ? 'a note: it goes into its thread, and the agent owes it' : 'a note: it starts a thread on it, and an agent owes it'}
45
+ value={s.text}
46
+ onChange={(e) => s.setText(e.target.value)}
47
+ onKeyDown={(e) => {
48
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
49
+ e.preventDefault()
50
+ void s.note().then(close)
51
+ }
52
+ }}
53
+ />
54
+ <div className="rv-askopts">
55
+ <button className="rv-askopt pick" disabled={!s.text.trim() || s.busy} onClick={() => void s.note().then(close)}>
56
+ {s.data?.noteGoesTo ? 'send to its thread' : 'start a thread'}
57
+ </button>
58
+ </div>
59
+ {s.data && s.data.open.length > 0 ? (
60
+ <details className="rv-tcattach">
61
+ <summary>attach it to an open thread</summary>
62
+ {s.data.open.map((t) => (
63
+ <button key={t.head} className="rv-tcrow" disabled={s.busy} onClick={() => void s.attach(t.head).then(close)}>
64
+ <span className={`rv-badge turn-${t.turn}`}>{TURN[t.turn]}</span> {t.title}
65
+ </button>
66
+ ))}
67
+ </details>
68
+ ) : null}
69
+ {s.error ? <div className="rv-err">{s.error}</div> : null}
70
+ </div>
71
+ )}
72
+ </Pop>
73
+ )
74
+ })
@@ -1,4 +1,4 @@
1
- // one open card of the review page read as a thread (wiki tools/shipkit/review.md, The review page): its cells from
1
+ // one open card of the review page read as a thread (wiki tools/shipkit/threads.md, The review page): its cells from
2
2
  // `GET /api/review/threads/<id>`, what he folded, the contents strip and where a click on it lands, his draft on the
3
3
  // newest version (rectangles, reactions, stars, the pick, his word), each clip's clock. Made when a card opens,
4
4
  // disposed when another one does. Only the newest version takes his marks: an older one shows what was said on it
@@ -86,7 +86,8 @@ export const cellDom = (id: string): string => `rvc-${id.replace(/[^A-Za-z0-9-]/
86
86
  export const viewDom = (id: string, view: number): string => `${cellDom(id)}-v${view}`
87
87
  export const viewKey = (id: string, view: number): string => `${id}#${view}`
88
88
 
89
- const sameSpot = (r: ReviewReaction, view: number, tile: number | undefined): boolean => r.view === view && r.tile === tile
89
+ /** a reaction is on that view, that tile of it, or that message of a draft card */
90
+ const sameSpot = (r: ReviewReaction, view: number, tile: number | undefined, post?: string): boolean => r.view === view && r.tile === tile && r.post === post
90
91
  const dayOf = (iso: string): string => new Date(iso).toLocaleDateString(undefined, { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' })
91
92
 
92
93
  /** a view's kind, as its badge says it */
@@ -113,6 +114,8 @@ export class ThreadSt {
113
114
  jump: string | null = null
114
115
  /** the column scrolled to the newest cell once, on the first load */
115
116
  landed = false
117
+ /** the view open in the lightbox over the thread (a preview clicked), to judge and draw on at its full size */
118
+ boxed: { cell: string; view: number } | null = null
116
119
  private drafts: Record<string, Draft> = {}
117
120
  /** the older version his answer goes to: a version landed while he wrote, or he chose to answer it. His first mark
118
121
  * on the newest version, or « answer v4 », brings his answer back to the newest */
@@ -285,18 +288,21 @@ export class ThreadSt {
285
288
  const to = this.data?.head
286
289
  if (from === null || !to) return
287
290
  const d = this.drafts[from] ?? EMPTY
288
- const views = (this.versionOf(to)?.item.views ?? []).length
291
+ const toItem = this.versionOf(to)?.item
292
+ const views = (toItem?.views ?? []).length
289
293
  const fits = (view: number | undefined): boolean => (view ?? 0) < views
294
+ // a word on a message of a draft follows to a newer draft card, which holds no view
295
+ const takes = (r: ReviewReaction): boolean => (r.post !== undefined ? toItem?.draft !== undefined : fits(r.view))
290
296
  const into = this.drafts[to] ?? EMPTY
291
297
  const moved: Draft = {
292
298
  comment: [into.comment, d.comment].filter((x) => x.trim() !== '').join('\n'),
293
299
  rects: [...into.rects, ...d.rects.filter((r) => fits(r.view))],
294
300
  ...(into.pick !== undefined ? { pick: into.pick } : {}),
295
301
  }
296
- const reactions = [...(into.reactions ?? []), ...(d.reactions ?? []).filter((r) => fits(r.view) && !(into.reactions ?? []).some((q) => sameSpot(q, r.view, r.tile)))]
302
+ const reactions = [...(into.reactions ?? []), ...(d.reactions ?? []).filter((r) => takes(r) && !(into.reactions ?? []).some((q) => sameSpot(q, r.view, r.tile, r.post)))]
297
303
  if (reactions.length > 0) moved.reactions = reactions
298
304
  const left: Draft = { comment: '', rects: d.rects.filter((r) => !fits(r.view)) }
299
- const leftReactions = (d.reactions ?? []).filter((r) => !fits(r.view))
305
+ const leftReactions = (d.reactions ?? []).filter((r) => !takes(r))
300
306
  if (leftReactions.length > 0) left.reactions = leftReactions
301
307
  this.put(to, moved)
302
308
  this.put(from, isDirty(left) ? left : null)
@@ -384,6 +390,15 @@ export class ThreadSt {
384
390
  this.jump = null
385
391
  }
386
392
 
393
+ openBox(cell: string, view: number): void {
394
+ this.boxed = { cell, view }
395
+ if (cell === this.target) this.setView(view)
396
+ }
397
+
398
+ closeBox(): void {
399
+ this.boxed = null
400
+ }
401
+
387
402
  /** where the column opens: the cell an old link names, else the first agent word he has not read, else the newest
388
403
  * version's top (the column stops at its end: a short tail shows whole), else the newest framed cell */
389
404
  get landing(): string | null {
@@ -487,14 +502,20 @@ export class ThreadSt {
487
502
  return this.verdictsOn(id).flatMap((v) => v.rects.flatMap((r, k) => ((r.view ?? 0) === view && r.side === side && r.tile === tile ? [{ r, n: k + 1 }] : [])))
488
503
  }
489
504
 
490
- /** the reaction a view shows: his draft's on the newest version, else the latest verdict's */
491
- reactionShown(c: VersionCell, view: number, tile?: number): ReviewReaction | null {
505
+ /** the reaction a view shows (a tile of it, a message of a draft card): his draft's on the newest version, else the
506
+ * latest verdict's */
507
+ reactionShown(c: VersionCell, view: number, tile?: number, post?: string): ReviewReaction | null {
492
508
  if (c.id === this.target && this.takesVerdict) {
493
- const own = this.reactionOf(view, tile)
509
+ const own = this.reactionOf(view, tile, post)
494
510
  if (own) return own
495
511
  }
496
- for (const v of this.verdictsOn(c.id).reverse()) {
497
- const r = v.reactions.find((q) => sameSpot(q, view, tile))
512
+ return this.reactionSent(c.id, view, tile, post)
513
+ }
514
+
515
+ /** the reaction his latest answer on a version gave that spot; null when none said a word on it */
516
+ reactionSent(id: string, view: number, tile?: number, post?: string): ReviewReaction | null {
517
+ for (const v of this.verdictsOn(id).reverse()) {
518
+ const r = v.reactions.find((q) => sameSpot(q, view, tile, post))
498
519
  if (r) return r
499
520
  }
500
521
  return null
@@ -589,7 +610,7 @@ export class ThreadSt {
589
610
  this.noteFocus = this.rect
590
611
  }
591
612
 
592
- // ── a trailer card's notes (wiki tools/shipkit/review.md, A trailer) ──
613
+ // ── a trailer card's notes (wiki tools/shipkit/threads.md, A trailer) ──
593
614
 
594
615
  /** a version's notes in the order of the cut: its verdicts' rectangles, then on the version his answer goes to his draft's */
595
616
  trailerNotes(id: string): LaneNote[] {
@@ -665,18 +686,18 @@ export class ThreadSt {
665
686
  if (this.noteSel?.startsWith('d:')) this.noteSel = null
666
687
  }
667
688
 
668
- reactionOf(view: number, tile?: number): ReviewReaction | null {
669
- return (this.draft.reactions ?? []).find((r) => sameSpot(r, view, tile)) ?? null
689
+ reactionOf(view: number, tile?: number, post?: string): ReviewReaction | null {
690
+ return (this.draft.reactions ?? []).find((r) => sameSpot(r, view, tile, post)) ?? null
670
691
  }
671
692
 
672
- /** a reaction's toggle: sets that status, or clears it when it is already the one */
673
- react(view: number, tile: number | undefined, status: ReviewStatus): void {
674
- const cur = this.reactionOf(view, tile)
675
- this.putReaction(view, tile, { ...cur, status: cur?.status === status ? undefined : status, comment: cur?.comment ?? '' })
693
+ /** a reaction's toggle: sets that status, or clears it when it is already the one; `post` a message of a draft card */
694
+ react(view: number, tile: number | undefined, status: ReviewStatus, post?: string): void {
695
+ const cur = this.reactionOf(view, tile, post)
696
+ this.putReaction(view, tile, { ...cur, status: cur?.status === status ? undefined : status, comment: cur?.comment ?? '' }, post)
676
697
  }
677
698
 
678
- setReactionComment(view: number, tile: number | undefined, comment: string): void {
679
- this.putReaction(view, tile, { ...this.reactionOf(view, tile), comment })
699
+ setReactionComment(view: number, tile: number | undefined, comment: string, post?: string): void {
700
+ this.putReaction(view, tile, { ...this.reactionOf(view, tile, post), comment }, post)
680
701
  }
681
702
 
682
703
  /** an option's or a gallery tile's stars; the same number again clears them */
@@ -689,18 +710,21 @@ export class ThreadSt {
689
710
  this.putReaction(view, tile, { comment: '' })
690
711
  }
691
712
 
692
- private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined; picked?: true | undefined }): void {
693
- const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {}), ...(r.picked ? { picked: true as const } : {}) }
713
+ private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined; picked?: true | undefined }, post?: string): void {
714
+ const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(post !== undefined ? { post } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {}), ...(r.picked ? { picked: true as const } : {}) }
694
715
  const empty = !r.status && r.comment === '' && !r.stars && !r.picked
695
716
  this.edit((d) => {
696
- const rest = (d.reactions ?? []).filter((q) => !sameSpot(q, view, tile))
717
+ const rest = (d.reactions ?? []).filter((q) => !sameSpot(q, view, tile, post))
697
718
  return { ...d, reactions: empty ? rest : [...rest, next] }
698
719
  })
699
720
  }
700
721
 
701
- /** the reactions that go with the verdict, in the card's order */
722
+ /** the reactions that go with the verdict, in the card's order; on a draft card the order of its messages */
702
723
  get outgoingReactions(): ReviewReaction[] {
703
- return [...(this.draft.reactions ?? [])].sort((a, b) => a.view - b.view || (a.tile ?? -1) - (b.tile ?? -1))
724
+ const posts = this.headItem?.draft?.posts.map((p) => p.key) ?? []
725
+ // a message the draft gained since the card comes last
726
+ const at = (r: ReviewReaction): number => (r.post === undefined ? -1 : (posts.indexOf(r.post) + posts.length + 1) % (posts.length + 1))
727
+ return [...(this.draft.reactions ?? [])].sort((a, b) => a.view - b.view || (a.tile ?? -1) - (b.tile ?? -1) || at(a) - at(b))
704
728
  }
705
729
 
706
730
  /** « pick »: that option is his answer, sent at once as an approval; his stars and words go with it. The option he
@@ -891,7 +915,7 @@ export class ThreadSt {
891
915
  if (held?.verdict === status && (d.pick === undefined || d.pick === held.pick)) return this.takeBack()
892
916
  await this.send(h.id, status, async () => {
893
917
  const pick = isChoice(h.item) && isApproved(status) && d.pick !== undefined ? { pick: d.pick } : {}
894
- await postJson(this.rv.url(`/api/review/${h.id}/feedback`), { status, comment: d.comment, rects: d.rects, reactions: d.reactions ?? [], ...pick })
918
+ await postJson(this.rv.url(`/api/review/${h.id}/feedback`), { status, comment: d.comment, rects: d.rects, reactions: this.outgoingReactions, ...pick })
895
919
  runInAction(() => this.settle(h.id, d))
896
920
  })
897
921
  }
@@ -904,7 +928,8 @@ export class ThreadSt {
904
928
  await this.send(h.id, null, () => postJson(this.rv.url(`/api/review/${h.id}/reopen`), {}))
905
929
  }
906
930
 
907
- /** one answer on its way: shown at once on the card and its row, the truth again once the store took it or refused */
931
+ /** one answer on its way: shown at once on the card and its row, the truth again once the store took it or refused.
932
+ * A verdict taken opens the next card that waits (ReviewSt.verdictTaken) */
908
933
  private async send(on: string, status: ReviewStatus | null, post: () => Promise<unknown>): Promise<void> {
909
934
  const head = this.data?.head ?? on
910
935
  this.busy = true
@@ -913,6 +938,7 @@ export class ThreadSt {
913
938
  this.rv.setAnswering(head, status ?? 'pending')
914
939
  try {
915
940
  await post()
941
+ if (status !== null) this.rv.verdictTaken(this)
916
942
  await this.rv.answered()
917
943
  } catch (e) {
918
944
  runInAction(() => (this.error = (e as Error).message))
@@ -973,6 +999,27 @@ export class ThreadSt {
973
999
  }
974
1000
  }
975
1001
 
1002
+ /** one click on a question's option, or « apply » on a proposed change (his edit the words box holds): his answer
1003
+ * goes to the item it sits on, naming it, and wakes the agent that holds the thread */
1004
+ async answer(c: { id: string; on: string }, a: { option?: number; apply?: true; edited?: boolean }): Promise<void> {
1005
+ if (this.busy) return
1006
+ const sent = this.hints[c.id] ?? ''
1007
+ const re = c.id.slice(c.on.length + 1)
1008
+ this.busy = true
1009
+ this.error = null
1010
+ try {
1011
+ await postJson(this.rv.url(`/api/review/${c.on}/answer`), { re, ...(a.option !== undefined ? { option: a.option } : {}), ...(a.apply ? { apply: true } : {}), ...(sent.trim() ? { text: sent.trim() } : {}) })
1012
+ runInAction(() => {
1013
+ if (this.hints[c.id] === sent) delete this.hints[c.id]
1014
+ })
1015
+ await this.rv.answered()
1016
+ } catch (e) {
1017
+ runInAction(() => (this.error = (e as Error).message))
1018
+ } finally {
1019
+ runInAction(() => (this.busy = false))
1020
+ }
1021
+ }
1022
+
976
1023
  /** the agent words he has not read, by cell id: the page sends them read once each shows on his screen */
977
1024
  get unreadCells(): string[] {
978
1025
  return this.cells.filter((c) => (c.kind === 'reply' || c.kind === 'note') && c.party === 'agent' && !c.read && c.id.includes('/')).map((c) => c.id)
@@ -1,4 +1,4 @@
1
- // a trailer card's body (wiki tools/shipkit/review.md, A trailer): the trailer entry's player on the renders the card
1
+ // a trailer card's body (wiki tools/shipkit/threads.md, A trailer): the trailer entry's player on the renders the card
2
2
  // pinned, its before and after on one toggle that keeps the shot, the shots the change touched; the owner's notes by
3
3
  // time: the timeline's lane, the rail of stills beside the player (under it when narrow), and on the frame only the
4
4
  // notes on it. A note is a card's own rectangle, drafted and sent with the verdict as on an image
@@ -2,9 +2,9 @@
2
2
  // its timeline and its shot cards in the middle, the notes on the right. A note marks a frame of the render on screen
3
3
  // and becomes an item of the review store. On a phone the three stacked
4
4
  import { observer } from 'mobx-react-lite'
5
- import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react'
5
+ import { useEffect, useRef, useState, type ReactNode } from 'react'
6
6
  import { Panel, Separator } from 'react-resizable-panels'
7
- import { KeptCols } from '../kept-cols.tsx'
7
+ import { KeptCols, LIST_COL } from '../kept-cols.tsx'
8
8
  import { AutoText } from '../auto-text.tsx'
9
9
  import { clock, cutsByRecent, shotAt, type CutInfo, type NoteMark, type TrailerNote } from '../../../review/trailer-model.ts'
10
10
  import { editorHref } from '../check-words.ts'
@@ -17,6 +17,8 @@ import { hueOf, secsOf, ShotCards, ShotSummary, TrailerTimeline } from './traile
17
17
  import { captionText, type PlacedNote, type TrailerSt } from './trailer-st.ts'
18
18
  import { Caret } from '../icons.tsx'
19
19
  import { VoiceOpen, VoicesButton, VoicesList } from './trailer-voices.tsx'
20
+ import { ThreadControl } from './thread-control.tsx'
21
+ import { cutAddress } from '../../../review/model.ts'
20
22
 
21
23
  export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
22
24
  const tr = app.trailer
@@ -36,7 +38,7 @@ export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
36
38
  )
37
39
  return (
38
40
  <KeptCols id="trailer" folds={{ left: 'trailer-cuts', right: 'trailer-notes' }} layout={app.home.layout}>
39
- <Panel id="trailer-cuts" defaultSize="15%" minSize={190} className="rv-pane" style={PANEL}>
41
+ <Panel id="trailer-cuts" {...LIST_COL} className="rv-pane" style={PANEL}>
40
42
  <div className="rv-scroll"><CutList tr={tr} /></div>
41
43
  </Panel>
42
44
  <Separator className="rsep" />
@@ -78,12 +80,7 @@ const CutList = observer(({ tr }: { tr: TrailerSt }) => (
78
80
  {!tr.desk && !tr.deskError ? <div className="rv-empty"><span className="spin" /> reading the cuts…</div> : null}
79
81
  {tr.desk && tr.trailers.length === 0 ? <div className="rv-empty">No trailer under trailer/: write trailer/&lt;name&gt;/main.trailer, then sk trailer.</div> : null}
80
82
  <div className="tr-cutrows">
81
- {cutsByRecent(tr.trailer?.cuts ?? []).map((c, i, all) => (
82
- <Fragment key={c.cut}>
83
- {c.version && !all[i - 1]?.version ? <div className="tr-cuthead" style={{ margin: '8px 0 2px', fontSize: 11, fontWeight: 700, color: 'var(--dim)' }}>Kept versions</div> : null}
84
- <CutRow tr={tr} c={c} />
85
- </Fragment>
86
- ))}
83
+ {cutsByRecent(tr.trailer?.cuts ?? []).map((c) => <CutRow key={c.cut} tr={tr} c={c} />)}
87
84
  </div>
88
85
  <Keys />
89
86
  </div>
@@ -100,10 +97,10 @@ const CutRow = observer(({ tr, c }: { tr: TrailerSt; c: CutInfo }) => {
100
97
  return (
101
98
  <button className={`tr-cutrow${on ? ' on' : ''}${v ? '' : ' unrendered'}`} disabled={!v} onClick={() => t && tr.pick(t.id, c.cut)}
102
99
  title={v ? `${clock(v.duration)} · ${shots} shot${shots > 1 ? 's' : ''} · ${age} · ${c.files.video}` : `${age}: sk trailer ${c.files.trailer ?? ''}`}>
103
- <span className="tr-cutname">{c.cut}</span>
100
+ <span className="tr-cutname">{c.making ?? c.cut}</span>
101
+ {c.version ? null : <span className="tr-work" title={`the version in work: ${c.files.trailer ?? `${c.cut}.trailer`}${c.edited && !c.rendering ? `. Its script changed since this render: sk trailer --mock ${c.files.trailer ?? ''} shows it in seconds` : ''}`}>in work</span>}
104
102
  {c.version ? <span className="tr-kept" style={{ color: 'var(--accent)', fontSize: 11 }} title="a kept version: versions/ holds its text and its render, it never changes">▣</span> : null}
105
103
  {c.rendering ? <span className="spin" title="a render is being written" /> : null}
106
- {c.edited && !c.rendering ? <span className="tr-edited" title="the .trailer changed since this render">✎</span> : null}
107
104
  {c.errors.length > 0 ? <span className="tr-cuterr" title={c.errors.join('\n')}>!</span> : null}
108
105
  <span className="sp" />
109
106
  {open > 0 ? <span className="tr-opencount" title={`${open} open note${open > 1 ? 's' : ''} on its shots`}>{open}</span> : null}
@@ -115,9 +112,10 @@ const CutRow = observer(({ tr, c }: { tr: TrailerSt; c: CutInfo }) => {
115
112
  const KEYS: [string, string][] = [
116
113
  ['Space', 'play, pause'],
117
114
  [', .', 'frame back, on'],
118
- ['← →', 'one second (Shift: five)'],
119
- ['↑ ↓', 'shot back, on'],
120
- ['⇧↑ ⇧↓', 'note back, on'],
115
+ ['← →', 'one second (⌥: five)'],
116
+ ['↑ ↓', 'the cut above, below'],
117
+ ['⌥↑ ⌥↓', 'shot back, on'],
118
+ ['⌥⇧↑ ⌥⇧↓', 'note back, on'],
121
119
  ['N', 'a note on this frame'],
122
120
  ['drag', 'a note with its rectangle'],
123
121
  ['click', 'a note on that frame'],
@@ -154,6 +152,15 @@ export const PlayerColumn = observer(({ tr, app, host, under }: { tr: TrailerSt;
154
152
  {!tr.card && !tr.newer && c.edited && !c.timelineFromRender ? (
155
153
  <div className="tr-banner warn">The .trailer changed since this render: the timeline comes from the file, its shots may be off until the next sk trailer.</div>
156
154
  ) : null}
155
+ {!tr.card && !tr.newer && c.ahead && !c.rendering ? (
156
+ <div className="tr-banner warn">This is the last render: {c.timeline?.shots.length ?? 0} shots, {clock(c.video?.duration ?? 0)}{c.video ? `, ${ago(c.video.mtime)} ago` : ''}. The .trailer has changed since: it now holds {c.ahead.shots} shots, {clock(c.ahead.total)}, not built yet. The next sk trailer builds it.</div>
157
+ ) : null}
158
+ {!tr.card && c.ahead && c.rendering ? (
159
+ <div className="tr-banner"><span><span className="spin" /> A new render is being built: {c.ahead.shots} shots, {clock(c.ahead.total)}. This is still the last one.</span></div>
160
+ ) : null}
161
+ {!tr.card && c.mock && !c.rendering ? (
162
+ <div className="tr-banner">A mock of the script as it stands: a dashed frame is a shot not filmed yet, and no voice line is spoken.</div>
163
+ ) : null}
157
164
  <Player tr={tr} host={host} />
158
165
  <Transport tr={tr} app={app} />
159
166
  {tr.voiceError ? <div className="rv-err">{tr.heard === 'takes' ? 'my voice' : tr.ownHere?.standin}: {tr.voiceError}</div> : null}
@@ -162,6 +169,7 @@ export const PlayerColumn = observer(({ tr, app, host, under }: { tr: TrailerSt;
162
169
  <TrailerTimeline st={tr} />
163
170
  {under}
164
171
  <ShotCards st={tr} />
172
+ <Script tr={tr} />
165
173
  <Montage tr={tr} />
166
174
  </div>
167
175
  )
@@ -249,11 +257,12 @@ const Transport = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
249
257
  const href = editorHref(app.root, file)
250
258
  return (
251
259
  <div className="tr-transport">
252
- {btn('⏮', 'shot back (↑)', () => tr.shotBy(-1))}
260
+ {tr.trailer && tr.cut ? <ThreadControl st={app} address={cutAddress(tr.trailer.id, tr.cut.cut)} name={`${tr.trailer.id} ${tr.cut.cut}`} /> : null}
261
+ {btn('⏮', 'shot back (⌥↑)', () => tr.shotBy(-1))}
253
262
  {btn('‹', 'frame back (,)', () => tr.step(-1))}
254
263
  {btn(c.paused ? '▶' : '❚❚', c.paused ? 'play (Space)' : 'pause (Space)', () => c.toggle(), true)}
255
264
  {btn('›', 'frame on (.)', () => tr.step(1))}
256
- {btn('⏭', 'shot on (↓)', () => tr.shotBy(1))}
265
+ {btn('⏭', 'shot on (⌥↓)', () => tr.shotBy(1))}
257
266
  <div className="tr-time">
258
267
  <div className="tr-timebig">{clock(tr.time)} <span className="tr-dim">/ {clock(tr.shown?.duration ?? 0)}</span></div>
259
268
  <div className="tr-dim tr-small">frame {tr.frame + 1} / {tr.frames} · {tr.fps} fps</div>
@@ -303,6 +312,18 @@ const NowLine = observer(({ tr }: { tr: TrailerSt }) => {
303
312
  )
304
313
  })
305
314
 
315
+ /** the text of the cut on screen (its .trailer, a kept version's as it was kept), folded until asked */
316
+ const Script = observer(({ tr }: { tr: TrailerSt }) => {
317
+ const s = tr.script
318
+ const c = tr.cut
319
+ return (
320
+ <div className="tr-montage">
321
+ <button className="ghost" onClick={() => void tr.toggleScript()} title={c?.files.trailer ?? undefined}><Caret open={tr.scriptOpen} /> script{c ? ` of ${c.making ?? c.cut}` : ''}</button>
322
+ {tr.scriptOpen ? (s == null ? <span className="spin" /> : s.text == null ? <div className="rv-dim">This cut has no .trailer file.</div> : <pre className="tr-script">{s.text}</pre>) : null}
323
+ </div>
324
+ )
325
+ })
326
+
306
327
  /** the cut's montage page (out/<name>.montage.md), folded until asked */
307
328
  const Montage = observer(({ tr }: { tr: TrailerSt }) => {
308
329
  const m = tr.montage
@@ -1,11 +1,12 @@
1
1
  // a repo's trailer page as state (wiki tools/trailer/index.md, Frame notes): a cut's render on a clip clock, its montage as a
2
2
  // timeline, the owner's notes on its frames. The render on screen is a kept version: a new render never swaps under
3
3
  // him, the page offers it. The desk is read while the page shows, every 3 s. The same state plays a trailer card's body
4
- // (wiki tools/shipkit/review.md, A trailer): its renders pinned, its before and after on one clock, the card's own
4
+ // (wiki tools/shipkit/threads.md, A trailer): its renders pinned, its before and after on one clock, the card's own
5
5
  // rectangles drawn on its frame (thread-st.ts clockOf)
6
6
  import { makeAutoObservable, observableRef, reaction, runInAction } from 'mobx'
7
7
  import type { Side, TrailerCard } from '../../../review/model.ts'
8
8
  import {
9
+ cutsByRecent,
9
10
  noteTime,
10
11
  shotAt,
11
12
  type CaptionSpan,
@@ -22,6 +23,7 @@ import {
22
23
  type TrailerNote,
23
24
  type VoicesDesk,
24
25
  } from '../../../review/trailer-model.ts'
26
+ import { sideOf, type SideList } from '../list-walk.ts'
25
27
  import { reach } from '../reach.ts'
26
28
  import type { RepoSt } from '../repo-st.ts'
27
29
  import { ClipSt } from './clip-st.ts'
@@ -118,6 +120,9 @@ export class TrailerSt {
118
120
  /** the montage page of the cut on screen, its markdown, once asked */
119
121
  montage: { key: string; md: string | null } | null = null
120
122
  montageOpen = false
123
+ /** the .trailer text of the cut on screen, once asked */
124
+ script: { key: string; text: string | null } | null = null
125
+ scriptOpen = false
121
126
  /** the voice side he picked; null: the brand's */
122
127
  voiceSide: VoiceSide | null = null
123
128
  /** the cut on screen's lines of his voice; null while unknown or when it has none */
@@ -136,7 +141,7 @@ export class TrailerSt {
136
141
  readonly voices: VoicesSt
137
142
 
138
143
  constructor(
139
- private readonly st: RepoSt,
144
+ readonly st: RepoSt,
140
145
  /** a trailer card's body: the card, what it plays, its notes as the lane's markers; null on the trailer page */
141
146
  readonly card: { id: string; spec: TrailerCard; lane: () => LaneMark[] } | null = null,
142
147
  ) {
@@ -518,6 +523,23 @@ export class TrailerSt {
518
523
  }
519
524
 
520
525
  /** the cut's montage page, read once per cut when he opens it */
526
+ /** the script of the cut on screen, read again when the cut or its file changed */
527
+ async toggleScript(): Promise<void> {
528
+ this.scriptOpen = !this.scriptOpen
529
+ const t = this.trailer
530
+ const c = this.cut
531
+ if (!this.scriptOpen || !t || !c) return
532
+ const key = `${t.id}/${c.cut}/${c.fileMtime}`
533
+ if (this.script?.key === key) return
534
+ try {
535
+ const res = await reach(this.st.url(`/api/trailer/script/${t.id}/${c.cut}`))
536
+ const text = res.ok ? await res.text() : null
537
+ runInAction(() => (this.script = { key, text }))
538
+ } catch (e) {
539
+ runInAction(() => (this.error = (e as Error).message))
540
+ }
541
+ }
542
+
521
543
  async toggleMontage(): Promise<void> {
522
544
  this.montageOpen = !this.montageOpen
523
545
  const s = this.shown
@@ -860,10 +882,22 @@ export class TrailerSt {
860
882
  }
861
883
  }
862
884
 
863
- /** the page's keys: Space plays or pauses, `,` and `.` a frame, ← → a second (Shift: five), ↑ ↓ a shot (Shift: a
885
+ /** the cuts as their keys walk them (list-walk.ts): the rendered ones, in the order the list draws them */
886
+ get cutSide(): SideList {
887
+ return sideOf({
888
+ ids: () => cutsByRecent(this.trailer?.cuts ?? []).filter((c) => c.video !== null).map((c) => c.cut),
889
+ current: () => this.cut?.cut ?? null,
890
+ open: (cut) => {
891
+ const t = this.trailer
892
+ if (t) this.pick(t.id, cut)
893
+ },
894
+ })
895
+ }
896
+
897
+ /** the page's keys: Space plays or pauses, `,` and `.` a frame, ← → a second (Shift: five), ⌥↑ ⌥↓ a shot (⌥⇧: a
864
898
  * note), N a note on this frame, M the sound, - and + the timeline's zoom, Home the start. Arrows and plain keys,
865
- * so an AZERTY keyboard reaches every one */
866
- key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'>): boolean {
899
+ * so an AZERTY keyboard reaches every one; ↑ ↓ are the cuts', ⇧↑ ⇧↓ the tree's (side-lists.ts) */
900
+ key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'> & { altKey?: boolean }): boolean {
867
901
  if (this.voices.on) return this.voices.key(e)
868
902
  const k = e.key.toLowerCase()
869
903
  if (e.key === ' ') {
@@ -872,8 +906,8 @@ export class TrailerSt {
872
906
  this.clock.toggle()
873
907
  } else if (e.key === ',') this.step(-1)
874
908
  else if (e.key === '.') this.step(1)
875
- else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') this.by((e.key === 'ArrowRight' ? 1 : -1) * (e.shiftKey ? 5 : 1))
876
- else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
909
+ else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') this.by((e.key === 'ArrowRight' ? 1 : -1) * (e.altKey === true ? 5 : 1))
910
+ else if ((e.key === 'ArrowUp' || e.key === 'ArrowDown') && e.altKey === true) {
877
911
  const d = e.key === 'ArrowDown' ? 1 : -1
878
912
  if (e.shiftKey) this.noteBy(d)
879
913
  else this.shotBy(d)