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
@@ -6,8 +6,11 @@ const FFPROBE = Bun.which('ffprobe') ?? '/opt/homebrew/bin/ffprobe'
6
6
 
7
7
  export interface Probe {
8
8
  duration: number
9
- video: { width: number; height: number; fps: number } | null
9
+ /** `rate`: the frame rate as ffprobe gives it, `30/1`, exact where `fps` rounds */
10
+ video: { width: number; height: number; fps: number; rate: string } | null
10
11
  audio: boolean
12
+ /** bits a second of the first video and sound streams, 0 when the container does not say */
13
+ bitrates: { video: number; audio: number }
11
14
  }
12
15
 
13
16
  /** `30000/1001` → 29.97 */
@@ -18,16 +21,19 @@ const rate = (r: string | undefined): number => {
18
21
 
19
22
  /** one ffprobe of a media file; throws when ffprobe cannot read it or finds no length */
20
23
  export function probe(file: string): Probe {
21
- const r = Bun.spawnSync([FFPROBE, '-v', 'error', '-show_entries', 'stream=codec_type,width,height,r_frame_rate:format=duration', '-of', 'json', file], { stdout: 'pipe', stderr: 'pipe' })
24
+ const r = Bun.spawnSync([FFPROBE, '-v', 'error', '-show_entries', 'stream=codec_type,width,height,r_frame_rate,bit_rate:format=duration', '-of', 'json', file], { stdout: 'pipe', stderr: 'pipe' })
22
25
  if (r.exitCode !== 0) throw new Error(`ffprobe ${file}: ${r.stderr.toString().trim() || `exit ${r.exitCode}`}`)
23
- const j = JSON.parse(r.stdout.toString()) as { streams?: { codec_type?: string; width?: number; height?: number; r_frame_rate?: string }[]; format?: { duration?: string } }
26
+ const j = JSON.parse(r.stdout.toString()) as { streams?: { codec_type?: string; width?: number; height?: number; r_frame_rate?: string; bit_rate?: string }[]; format?: { duration?: string } }
24
27
  const duration = Number(j.format?.duration)
25
28
  if (!(duration > 0)) throw new Error(`ffprobe ${file}: no length`)
26
29
  const v = j.streams?.find((s) => s.codec_type === 'video')
30
+ const a = j.streams?.find((s) => s.codec_type === 'audio')
31
+ const bits = (b: string | undefined): number => (Number(b) > 0 ? Number(b) : 0)
27
32
  return {
28
33
  duration,
29
- video: v?.width && v.height ? { width: v.width, height: v.height, fps: rate(v.r_frame_rate) } : null,
30
- audio: j.streams?.some((s) => s.codec_type === 'audio') ?? false,
34
+ video: v?.width && v.height ? { width: v.width, height: v.height, fps: rate(v.r_frame_rate), rate: v.r_frame_rate ?? '30/1' } : null,
35
+ audio: a !== undefined,
36
+ bitrates: { video: bits(v?.bit_rate), audio: bits(a?.bit_rate) },
31
37
  }
32
38
  }
33
39
 
@@ -36,6 +42,27 @@ export async function stillAt(video: string, seconds: number, png: string): Prom
36
42
  await ffmpeg(['-ss', Math.max(0, seconds).toFixed(5), '-i', video, '-frames:v', '1', '-update', '1', '-f', 'image2', '-c:v', 'png', png])
37
43
  }
38
44
 
45
+ /** a picture whose brightest channel averages under this is black: a trailer's first frame fades in from black */
46
+ const BLACK = 12
47
+
48
+ export const isBlack = async (png: string): Promise<boolean> => {
49
+ const { default: sharp } = await import('sharp')
50
+ // read as bytes: libvips caches by file name, and the still is written again at the same path
51
+ const st = await sharp(await Bun.file(png).bytes()).stats()
52
+ return Math.max(...st.channels.slice(0, 3).map((c) => c.mean)) < BLACK
53
+ }
54
+
55
+ /** the first lit frame of a clip at or past `from`, a half second a step, as a png; its time, or null when every
56
+ * frame tried (ten seconds of them) is black */
57
+ export async function litStillAt(video: string, from: number, png: string): Promise<number | null> {
58
+ const { duration } = probe(video)
59
+ for (let i = 0, at = Math.min(from, duration / 2); i < 20 && at < duration; i++, at += 0.5) {
60
+ await stillAt(video, at, png)
61
+ if (!(await isBlack(png))) return Math.round(at * 10) / 10
62
+ }
63
+ return null
64
+ }
65
+
39
66
  /** an image's size in pixels */
40
67
  export async function sizeOf(file: string): Promise<{ w: number; h: number }> {
41
68
  const { default: sharp } = await import('sharp')
@@ -1,9 +1,10 @@
1
- // the one feedback store's model (wiki tools/shipkit/review.md): every record the owner, a player or an agent raises
1
+ // the one feedback store's model (wiki tools/shipkit/threads.md): every record the owner, a player or an agent raises
2
2
  // is an ITEM, a head (`item.json`: a typed subject, who raised it, the views) and an append only thread of messages
3
3
  // (verdicts, replies, ratings, state changes, read marks). The state is derived from the thread, never stored, so the
4
4
  // hub and every CLI write at once with no lost update. Pure and browser safe: the store, the routes and the hub page
5
5
  // share it. The on disk shape is the one a project's own review store writes, verbatim, so either store opens in the other.
6
6
  import type { MediaFact } from '../media-store/fact.ts'
7
+ import { versionOf } from '../trailer/versions.ts'
7
8
 
8
9
  /** WHAT is judged: `shot` (a plain image or clip), `screen`, `frame` (a frame of a trailer cut), or a kind a repo names
9
10
  * for itself (a game's place, creature, song...), read as is */
@@ -74,7 +75,7 @@ export interface Spec {
74
75
  }
75
76
 
76
77
  /** the kinds every repo has, whatever its unit declares */
77
- export const BUILTIN_KINDS: Record<string, SpecKind> = { shot: { label: 'images' }, screen: { label: 'screens' }, frame: { label: 'trailer frames' }, trailer: { label: 'trailers', icon: '🎬' }, store: { label: 'store pages', icon: '🏪' }, post: { label: 'post requests', icon: '📣' } }
78
+ export const BUILTIN_KINDS: Record<string, SpecKind> = { shot: { label: 'images' }, screen: { label: 'screens' }, frame: { label: 'trailer frames' }, trailer: { label: 'trailers', icon: '🎬' }, draft: { label: 'post drafts', icon: '📝' }, store: { label: 'store pages', icon: '🏪' }, post: { label: 'post requests', icon: '📣' }, object: { label: 'objects', icon: '🔗' } }
78
79
 
79
80
  export const NO_SPEC: Spec = { kinds: {}, topics: {}, dispatcher: false }
80
81
 
@@ -94,7 +95,37 @@ export type Origin =
94
95
  /** what names one subject exactly, null when it names nothing (a plain shot, a screen): two items of different keys
95
96
  * are never one subject. A kind the unit declares names it by its own `key`, or names nothing without one; a kind no
96
97
  * unit declares by its first of species, key, slug, id */
98
+ /** an object's address (wiki tools/shipkit/threads-store.md, Addresses): one thread per address, for its whole life */
99
+ export const ADDRESS_RE = /^[a-z][a-z0-9-]*:[^\n]+$/
100
+
101
+ /** a trailer's cut as an address: a kept version names the cut it was kept from, so every version is one thread. A
102
+ * card names its cut itself; a name alone (an older card, a frame note) is read as a kept version when it reads as one */
103
+ export const cutAddress = (trailer: string, cut: string, of?: string): string => `trailer:${trailer}/${of ?? versionOf(cut)?.cut ?? cut}`
104
+
105
+ /** the address that is an item's own: the one its agent named, else its subject's (a trailer card or a frame note: the
106
+ * cut); null when it names none (a plain shot). One thread per own address */
107
+ export function ownAddressOf(i: Item, spec: Spec = NO_SPEC): string | null {
108
+ if (i.on !== undefined) return i.on
109
+ if (i.trailer) return cutAddress(i.trailer.trailer, i.trailer.after.cut, i.trailer.cut)
110
+ if (isFrame(i.subject)) return cutAddress(i.subject.trailer, i.subject.cut)
111
+ return subjectKey(i.subject, spec)
112
+ }
113
+
114
+ /** the address above this one, null at the top: `draft:<slug>` above `draft:<slug>/discord` */
115
+ export function parentAddress(a: string): string | null {
116
+ const at = a.lastIndexOf('/')
117
+ return at > a.indexOf(':') ? a.slice(0, at) : null
118
+ }
119
+
120
+ /** every address one item names: its own, then the objects it is about */
121
+ export function addressesOf(i: Item, spec: Spec = NO_SPEC): string[] {
122
+ const own = ownAddressOf(i, spec)
123
+ return [...new Set([...(own !== null ? [own] : []), ...(i.about ?? [])])]
124
+ }
125
+
97
126
  export function subjectKey(s: Subject, spec: Spec = NO_SPEC): string | null {
127
+ // any object the hub shows, by its address: his note from its thread control
128
+ if (s.kind === 'object') return typeof s.address === 'string' && ADDRESS_RE.test(s.address) ? s.address : null
98
129
  if (isFrame(s)) return `frame:${s.trailer}/${s.cut}/${s.shot}`
99
130
  const kind = spec.kinds[s.kind]
100
131
  if (!kind && isStoreSubject(s)) return `store:${s.store}/${s.asset}`
@@ -219,6 +250,10 @@ export interface Item {
219
250
  supersedes?: string
220
251
  /** the raised items (a report, his note) this card answers: one thread per bug */
221
252
  answers?: string[]
253
+ /** its subject's address when the agent names it (`sk thread post <address>`, `--on`): one thread per address */
254
+ on?: string
255
+ /** other objects it is about, each `<kind>:<key>`: links that find it, never its thread's address */
256
+ about?: string[]
222
257
  /** what this new version keeps of the approved look it follows */
223
258
  keeps?: string
224
259
  /** why this card passed --new next to an active card */
@@ -232,6 +267,8 @@ export interface Item {
232
267
  agentPick?: number
233
268
  /** a trailer card: its body plays this cut in the trailer entry's player, never a compiled clip */
234
269
  trailer?: TrailerCard
270
+ /** a draft card: its body shows this post draft read live, a block a message, never a picture of it */
271
+ draft?: DraftCard
235
272
  /** each media file the views name, by its name: what the Space keeps it under once the disk lets it go */
236
273
  media?: Record<string, MediaFact>
237
274
  }
@@ -242,10 +279,12 @@ export interface TrailerSide {
242
279
  render: number
243
280
  }
244
281
 
245
- /** what a trailer card plays (wiki tools/shipkit/review.md, A trailer): a cut of `trailer/<trailer>/`, the render it is
282
+ /** what a trailer card plays (wiki tools/shipkit/threads.md, A trailer): a cut of `trailer/<trailer>/`, the render it is
246
283
  * compared with, the shots the change touched by name */
247
284
  export interface TrailerCard {
248
285
  trailer: string
286
+ /** the cut it is a version of: `main` for a kept `v15`; absent on a card made before it was written */
287
+ cut?: string
249
288
  after: TrailerSide
250
289
  before?: TrailerSide
251
290
  shots: string[]
@@ -255,6 +294,28 @@ export interface TrailerCard {
255
294
 
256
295
  export const isTrailerCard = (i: Item): i is Item & { trailer: TrailerCard } => i.trailer !== undefined
257
296
 
297
+ /** one message of a post draft as a draft card pinned it: its key in the draft (`x`, `reddit/comfyui`), its name as he
298
+ * reads it (« Reddit · comfyui »), the hash of what the draft says of it */
299
+ export interface DraftCardPost {
300
+ key: string
301
+ name: string
302
+ hash: string
303
+ }
304
+
305
+ /** what a draft card shows (wiki tools/shipkit/threads.md, A post draft): the draft `.shipkit/social/drafts/<slug>/`, read
306
+ * live. The hashes are the draft as it was sent: `hash` its head and angle, each message its own, so the card says what
307
+ * moved since. No view: the card holds no picture */
308
+ export interface DraftCard {
309
+ slug: string
310
+ hash: string
311
+ posts: DraftCardPost[]
312
+ }
313
+
314
+ export const isDraftCard = (i: Item): i is Item & { draft: DraftCard } => i.draft !== undefined
315
+
316
+ /** a message's key in its draft: `<account>`, or `<account>/<name>` for one of several there */
317
+ export const POST_KEY = /^[a-z0-9-]+(?:\/[a-z0-9-]+)?$/
318
+
258
319
  /** a choice card: he picks one of its views */
259
320
  export const isChoice = (i: Item): boolean => i.choice === true
260
321
 
@@ -280,39 +341,42 @@ export function pasteBlock(i: Item, state: string, w: CardWhere): string {
280
341
  return [
281
342
  `review card "${i.title}" (${state}), id ${i.id}`,
282
343
  `repo: ${w.root}`,
283
- `see it whole: cd ${w.root} && sk review show ${i.id}`,
344
+ `see it whole: cd ${w.root} && sk thread show ${i.id}`,
284
345
  `open: ${w.open}`,
285
346
  ...(w.phone ? [`phone: ${w.phone}`] : []),
286
347
  ].join('\n')
287
348
  }
288
349
 
289
- /** a view's letter in its version: A for the first, Z for the 26th, then AA, AB… A digit after a version's digit reads
290
- * like a version, so a view is never numbered */
291
- export function viewLetter(i: number): string {
292
- let n = i + 1
293
- let s = ''
294
- while (n > 0) {
295
- const r = (n - 1) % 26
296
- s = String.fromCharCode(65 + r) + s
297
- n = Math.floor((n - 1) / 26)
298
- }
299
- return s
350
+ /** a view's number in its version: 1 for the first. Never a letter: a card's own views are often named A, B, C, and
351
+ * a letter assigned beside them would not match */
352
+ export const viewNo = (i: number): string => String(i + 1)
353
+
354
+ /** the index a typed view reference names: its number (`2`), or the letter it had before (`B`, AA the 27th) so a letter
355
+ * typed then still finds it; -1 for anything else */
356
+ export function viewRef(ref: string): number {
357
+ const r = ref.trim().toUpperCase()
358
+ if (/^\d+$/.test(r)) return Number(r) - 1
359
+ if (!/^[A-Z]+$/.test(r)) return -1
360
+ let n = 0
361
+ for (const c of r) n = n * 26 + (c.charCodeAt(0) - 64)
362
+ return n - 1
300
363
  }
301
364
 
302
- /** a view as the page and the CLI tag it: its version's number and its letter, `3.B` */
303
- export const viewTag = (n: number, i: number): string => `${n}.${viewLetter(i)}`
365
+ /** a view as the page and the CLI tag it: its version's number and its own, `3.2` */
366
+ export const viewTag = (n: number, i: number): string => `${n}.${viewNo(i)}`
304
367
 
305
- /** a view's name as the page and the CLI show it: its label, or « view B » */
306
- export const viewName = (v: ReviewView | undefined, i: number): string => v?.label || `view ${viewLetter(i)}`
368
+ /** a view's name as the page and the CLI show it: its label, or « view 2 » */
369
+ export const viewName = (v: ReviewView | undefined, i: number): string => v?.label || `view ${viewNo(i)}`
307
370
 
308
- /** a view named by its label, else by its letter (`B`); throws naming every view when none matches */
371
+ /** a view named by its label, else by its number (`2`), else by the letter it had before (`B`); throws naming every view
372
+ * when none matches */
309
373
  export function viewIndexOf(views: readonly { label: string }[], ref: string): number {
310
374
  const r = ref.trim()
311
375
  const byLabel = views.findIndex((v) => v.label === r)
312
376
  if (r !== '' && byLabel >= 0) return byLabel
313
- const byLetter = views.findIndex((_, i) => viewLetter(i) === r.toUpperCase())
314
- if (r !== '' && byLetter >= 0) return byLetter
315
- throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${viewLetter(i)}${v.label ? ` "${v.label}"` : ''}`).join(', ')}`)
377
+ const n = viewRef(r)
378
+ if (n >= 0 && n < views.length) return n
379
+ throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${viewNo(i)}${v.label ? ` "${v.label}"` : ''}`).join(', ')}`)
316
380
  }
317
381
 
318
382
  /** every media file a card's views name: images, pairs, clips and their posters, sounds and their waveforms, tiles */
@@ -368,10 +432,13 @@ export type ReviewStatus = (typeof STATUSES)[number]
368
432
 
369
433
  export const isApproved = (s: ReviewStatus): boolean => s === 'approved' || s === 'approved-with-fix'
370
434
 
371
- /** the owner's reaction to one view, or to one tile of a gallery view; one per view or tile */
435
+ /** the owner's reaction to one view, to one tile of a gallery view, or to one message of a draft card; one per view,
436
+ * tile or message */
372
437
  export interface ReviewReaction {
373
438
  view: number
374
439
  tile?: number
440
+ /** on a draft card: the message of the draft it answers, by its key (`x`, `reddit/comfyui`) */
441
+ post?: string
375
442
  status?: ReviewStatus
376
443
  comment: string
377
444
  /** his score of the view, 1 to STARS */
@@ -424,6 +491,32 @@ export interface Message {
424
491
  update?: MessageUpdate
425
492
  /** his word on one message of the thread (a hint on an update): its id */
426
493
  re?: string
494
+ /** the Claude Code session of the agent that wrote it: the thread's holder */
495
+ session?: string
496
+ /** the objects it attaches to its thread, each `<kind>:<key>` */
497
+ about?: string[]
498
+ /** a question to the owner: its words in `text`, its options, the option the agent picks */
499
+ ask?: MessageAsk
500
+ /** a change the agent proposes on an object's text: its words in `text` */
501
+ propose?: MessagePropose
502
+ /** his answer to the question or the proposal `re` names: the option he clicked, or « apply » (an edit his `text`) */
503
+ answer?: MessageAnswer
504
+ }
505
+
506
+ export interface MessageAsk {
507
+ options: string[]
508
+ pick?: number
509
+ }
510
+
511
+ export interface MessagePropose {
512
+ on: string
513
+ before?: string
514
+ after: string
515
+ }
516
+
517
+ export interface MessageAnswer {
518
+ option?: number
519
+ apply?: true
427
520
  }
428
521
 
429
522
  /** what the store reads of one folder, what the list sends */
@@ -453,10 +546,14 @@ export const AGENT_RE = /^[A-Za-z][A-Za-z0-9-]{0,23}$/
453
546
  const two = (n: number): string => String(n).padStart(2, '0')
454
547
  const stampOf = (at: Date): string => `${at.getFullYear()}${two(at.getMonth() + 1)}${two(at.getDate())}-${two(at.getHours())}${two(at.getMinutes())}${two(at.getSeconds())}`
455
548
 
456
- /** `YYYYMMDD-HHMMSS-mmm-<owner|player|agent>`, local time: the names sort in time */
549
+ /** the part of a message id this process gives: two machines, or two processes, never make one id in one millisecond */
550
+ const PROCESS_PART = Array.from({ length: 4 }, () => 'abcdefghijklmnopqrstuvwxyz0123456789'[Math.floor(Math.random() * 36)]).join('')
551
+
552
+ /** `YYYYMMDD-HHMMSS-mmm-<owner|player|agent>-<process part>`, local time: the names sort in time. An id of before,
553
+ * with no process part, still reads */
457
554
  export function messageIdOf(at: Date, who: string): string {
458
555
  const role = who === 'owner' || who === 'player' ? who : 'agent'
459
- return `${stampOf(at)}-${String(at.getMilliseconds()).padStart(3, '0')}-${role}`
556
+ return `${stampOf(at)}-${String(at.getMilliseconds()).padStart(3, '0')}-${role}-${PROCESS_PART}`
460
557
  }
461
558
 
462
559
  /** a message's text as sent, trimmed; an error is the reason it is refused */
@@ -575,7 +672,7 @@ export const STATUS_LABEL: Record<ShownStatus, string> = {
575
672
  rated: 'rated',
576
673
  }
577
674
 
578
- /** the lifecycle (wiki tools/shipkit/review.md, The lifecycle) */
675
+ /** the lifecycle (wiki tools/shipkit/threads.md, The lifecycle) */
579
676
  export type State = 'draft' | 'new' | 'question' | 'open' | 'claimed' | 'blocked' | 'asks' | 'closed'
580
677
  type ClosedWhy = ReviewStatus | 'fixed' | 'wontfix' | 'dropped' | 'superseded' | 'withdrawn' | 'rated'
581
678
 
@@ -724,7 +821,7 @@ export function allowed(s: ItemState, op: Op, who: string, dispatcher: string |
724
821
  if (op === 'answer' && who !== 'owner') return 'only the owner answers a question'
725
822
  if (DISPATCHER_OPS.has(op)) {
726
823
  if (!routed) return 'this repo routes nothing: its review unit declares no dispatcher'
727
- if (dispatcher === null) return 'nobody holds the dispatcher role: sk review dispatcher --as <name>'
824
+ if (dispatcher === null) return 'nobody holds the dispatcher role: sk thread dispatcher --as <name>'
728
825
  if (who !== dispatcher) return `only the dispatcher (${dispatcher}) may ${op}`
729
826
  }
730
827
  if (!routed && s.state === 'new' && (op === 'claim' || op === 'fixed' || op === 'wontfix')) return op === 'claim' && who === 'owner' ? 'a worker claims, never the owner' : null
@@ -770,7 +867,7 @@ export interface WatchFilter {
770
867
  lane: string | null
771
868
  }
772
869
 
773
- /** a live `sk review watch`: its process, its filter, when it started */
870
+ /** a live `sk thread watch`: its process, its filter, when it started */
774
871
  export interface Watcher extends WatchFilter {
775
872
  pid: number
776
873
  started: string
@@ -798,7 +895,7 @@ export function notAnswererOf(x: ReviewItem, me: { lane: string | null; session:
798
895
  const noClaim = allowed(s, 'claim', me.lane ?? 'agent', null, false)
799
896
  const takeOver =
800
897
  noClaim === null
801
- ? `another lane takes it over with sk review claim ${id} --as <lane>`
898
+ ? `another lane takes it over with sk thread claim ${id} --as <lane>`
802
899
  : s.state === 'asks' || s.state === 'draft'
803
900
  ? 'no other lane takes it over before the verdict'
804
901
  : `no takeover: ${noClaim}`
@@ -828,7 +925,7 @@ export function listenWords(ws: readonly Watcher[]): string {
828
925
  * none does. A repo keeps one, the dispatcher's; every other session watches its own cards or its lane's */
829
926
  export function bareWatchTaken(live: readonly Watcher[], self: number): string | null {
830
927
  const other = live.find((w) => w.pid !== self && w.lane === null && w.session === null)
831
- return other ? `a watch of every card already runs (pid ${other.pid}): a repo keeps one, the dispatcher's. Yours: sk review watch --mine, or --lane <id>` : null
928
+ return other ? `a watch of every card already runs (pid ${other.pid}): a repo keeps one, the dispatcher's. Yours: sk thread watch --mine, or --lane <id>` : null
832
929
  }
833
930
 
834
931
  /** what `review add` says when no live watch of the card's own session or lane will read his answer, else null: an
@@ -838,7 +935,7 @@ export function unheardLine(item: Item, watchers: readonly Watcher[]): string |
838
935
  if (o.by !== 'agent') return null
839
936
  const own = o.session || o.lane ? watchers.filter((w) => (o.session && w.session === o.session) || (o.lane && w.lane === o.lane)) : watchers
840
937
  if (listenersOf([{ item, thread: [] }], own).length > 0) return null
841
- const watch = o.session ? 'sk review watch --mine' : o.lane ? `sk review watch --lane ${o.lane}` : 'sk review watch'
938
+ const watch = o.session ? 'sk thread watch --mine' : o.lane ? `sk thread watch --lane ${o.lane}` : 'sk thread watch'
842
939
  return `no watch hears this card: run \`${watch}\` under a monitor now, so his answer reaches you as it lands`
843
940
  }
844
941
 
@@ -863,6 +960,8 @@ export function untakenOf(x: ReviewItem, superseded: boolean, watchers: readonly
863
960
  }
864
961
 
865
962
  export const ID_RE = /^\d{8}-\d{6}-[a-z0-9-]+$/
963
+
964
+ const addressList = (v: unknown): boolean => Array.isArray(v) && v.length > 0 && v.every((a) => typeof a === 'string' && ADDRESS_RE.test(a))
866
965
  export const FILE_RE = /^((v\d+-)?((image|before|after|poster|wave|before-wave)\.(png|jpe?g|webp)|(video|before|after)\.(webm|mp4)|(audio|before|after)\.(wav|mp3|flac|ogg|opus|m4a))|v\d+-g\d+(-before)?\.(png|jpe?g|webp))$/
867
966
  /** a message's image as an item's media names it: `thread/<file>` */
868
967
  export const isThreadMedia = (n: string): boolean => n.startsWith('thread/') && MESSAGE_FILE_RE.test(n.slice('thread/'.length))
@@ -929,6 +1028,7 @@ function subjectProblems(s: unknown, spec: Spec): string[] {
929
1028
  if (kind?.problems) return kind.problems(s as Subject).map((p) => `subject: ${p}`)
930
1029
  if (s.kind === 'store' && !kind) return isStoreSubject(s as Subject) && s.store !== '' && s.asset !== '' ? [] : ['subject: a store thing has its store and asset']
931
1030
  if (s.kind === 'post' && !kind) return isPostSubject(s as Subject) ? [] : ['subject: a post request names its card']
1031
+ if (s.kind === 'object') return typeof s.address === 'string' && ADDRESS_RE.test(s.address) ? [] : ['subject: an object names its address <kind>:<key>']
932
1032
  if (s.kind !== 'frame') return []
933
1033
  const str = (k: string): boolean => typeof s[k] === 'string' && s[k] !== ''
934
1034
  const num = (k: string): boolean => typeof s[k] === 'number' && Number.isFinite(s[k])
@@ -956,11 +1056,23 @@ function originProblems(o: unknown): string[] {
956
1056
  return ['origin.by: agent, owner, player or auto']
957
1057
  }
958
1058
 
1059
+ function draftCardProblems(d: unknown): string[] {
1060
+ const text = (v: unknown): boolean => typeof v === 'string' && v !== ''
1061
+ if (!obj(d) || !text(d.slug) || !text(d.hash) || !Array.isArray(d.posts)) return ['draft: { slug, hash, posts: [{ key, name, hash }] }']
1062
+ const out: string[] = []
1063
+ d.posts.forEach((p: unknown, k: number) => {
1064
+ if (!obj(p) || typeof p.key !== 'string' || !POST_KEY.test(p.key) || !text(p.name) || !text(p.hash)) out.push(`draft.posts[${k}]: { key: <account>[/<name>], name, hash }`)
1065
+ })
1066
+ if (d.posts.length === 0) out.push('draft.posts: one message or more')
1067
+ return out
1068
+ }
1069
+
959
1070
  function trailerCardProblems(t: unknown): string[] {
960
1071
  const side = (v: unknown): boolean => obj(v) && typeof v.cut === 'string' && v.cut !== '' && typeof v.render === 'number' && Number.isFinite(v.render)
961
1072
  if (!obj(t) || typeof t.trailer !== 'string' || t.trailer === '' || !side(t.after)) return ['trailer: { trailer, after: { cut, render }, before?, shots }']
962
1073
  const out: string[] = []
963
1074
  if (t.before !== undefined && !side(t.before)) out.push('trailer.before: { cut, render }, or absent')
1075
+ if (t.cut !== undefined && !(typeof t.cut === 'string' && t.cut !== '')) out.push('trailer.cut: the cut it is a version of, or absent')
964
1076
  if (!Array.isArray(t.shots) || !t.shots.every((s) => typeof s === 'string' && s !== '')) out.push('trailer.shots: a list of shot names')
965
1077
  if (t.size !== undefined && !(Array.isArray(t.size) && t.size.length === 2 && t.size.every((n) => Number.isInteger(n) && (n as number) > 0))) out.push('trailer.size: [width, height] in pixels, or absent')
966
1078
  return out
@@ -975,13 +1087,17 @@ export function itemProblems(v: unknown): string[] {
975
1087
  out.push(...subjectProblems(v.subject, NO_SPEC), ...originProblems(v.origin))
976
1088
  if (v.topic !== undefined && typeof v.topic !== 'string') out.push('topic: a text')
977
1089
  const agent = obj(v.origin) && v.origin.by === 'agent'
978
- if (!Array.isArray(v.views) || (agent && v.views.length === 0)) out.push(`views: a list${agent ? ' of one view or more' : ''}`)
1090
+ // a draft card holds no picture: its body is the draft, read live
1091
+ const needsView = agent && v.draft === undefined
1092
+ if (!Array.isArray(v.views) || (needsView && v.views.length === 0)) out.push(`views: a list${needsView ? ' of one view or more' : ''}`)
979
1093
  else
980
1094
  v.views.forEach((w: unknown, i: number) => {
981
1095
  if (i > 0 && (!obj(w) || typeof w.label !== 'string' || w.label.trim() === '')) out.push(`views[${i}].label: a text`)
982
1096
  if (obj(w) && w.gallery !== undefined) out.push(...galleryProblems(w, `views[${i}].`))
983
1097
  else out.push(...viewProblems(obj(w) ? w : {}, `views[${i}].`))
984
1098
  })
1099
+ if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
1100
+ if (v.on !== undefined && !(typeof v.on === 'string' && ADDRESS_RE.test(v.on))) out.push('on: an address <kind>:<key>')
985
1101
  if (v.answers !== undefined && !(Array.isArray(v.answers) && v.answers.length > 0 && v.answers.every((a) => typeof a === 'string' && ID_RE.test(a))))
986
1102
  out.push('answers: a list of item ids')
987
1103
  for (const k of ['what', 'post', 'commit', 'supersedes', 'why', 'keeps']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
@@ -990,6 +1106,7 @@ export function itemProblems(v: unknown): string[] {
990
1106
  if (v.light !== undefined && v.light !== 'review') out.push('light: review, or absent')
991
1107
  if (v.wip !== undefined && !(obj(v.wip) && typeof v.wip.live === 'string' && v.wip.live !== '' && Number.isInteger(v.wip.frame))) out.push('wip: { live, frame }, or absent')
992
1108
  if (v.trailer !== undefined) out.push(...trailerCardProblems(v.trailer))
1109
+ if (v.draft !== undefined) out.push(...draftCardProblems(v.draft))
993
1110
  if (v.choice !== undefined && !(v.choice === true && Array.isArray(v.views) && v.views.length >= 2)) out.push('choice: true on a card of two views or more, or absent')
994
1111
  if (v.agentPick !== undefined && !(v.choice === true && Number.isInteger(v.agentPick) && Array.isArray(v.views) && (v.agentPick as number) >= 0 && (v.agentPick as number) < v.views.length))
995
1112
  out.push('agentPick: the index of one of its views, on a choice card, or absent')
@@ -1022,6 +1139,24 @@ export function messageProblems(v: unknown, name: string): string[] {
1022
1139
  if (typeof v.text !== 'string') out.push('update: its line in text')
1023
1140
  }
1024
1141
  if (v.re !== undefined && !(typeof v.re === 'string' && MESSAGE_RE.test(v.re))) out.push('re: the id of a message of the thread')
1142
+ if (v.session !== undefined && typeof v.session !== 'string') out.push('session: a text')
1143
+ if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
1144
+ if (v.ask !== undefined) {
1145
+ const a = v.ask
1146
+ if (!obj(a) || !Array.isArray(a.options) || a.options.length < 2 || !a.options.every((o) => typeof o === 'string' && o.trim() !== '') || (a.pick !== undefined && !(Number.isInteger(a.pick) && (a.pick as number) >= 0 && (a.pick as number) < a.options.length)))
1147
+ out.push('ask: { options: two texts or more, pick?: an option index }')
1148
+ if (typeof v.text !== 'string') out.push('ask: its question in text')
1149
+ }
1150
+ if (v.propose !== undefined) {
1151
+ const p = v.propose
1152
+ if (!obj(p) || typeof p.on !== 'string' || !ADDRESS_RE.test(p.on) || typeof p.after !== 'string' || (p.before !== undefined && typeof p.before !== 'string')) out.push('propose: { on: an address, before?, after }')
1153
+ if (typeof v.text !== 'string') out.push('propose: its words in text')
1154
+ }
1155
+ if (v.answer !== undefined) {
1156
+ const a = v.answer
1157
+ if (!obj(a) || (a.option === undefined && a.apply !== true) || (a.option !== undefined && !(Number.isInteger(a.option) && (a.option as number) >= 0)) || (a.apply !== undefined && a.apply !== true)) out.push('answer: { option } or { apply: true }')
1158
+ if (typeof v.re !== 'string') out.push('answer: the question or proposal it answers in re')
1159
+ }
1025
1160
  if (v.op === undefined && v.verdict === undefined && v.rate === undefined && typeof v.text !== 'string' && !Array.isArray(v.rects))
1026
1161
  out.push('a message says something: text, rects, verdict, rate or op')
1027
1162
  return out
@@ -1160,7 +1295,7 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
1160
1295
  if (clip && typeof t === 'number') rect.t = t
1161
1296
  out.push(rect)
1162
1297
  }
1163
- const reactions = reactionsOf(body.reactions, views, errors, isChoice(item))
1298
+ const reactions = reactionsOf(body.reactions, views, errors, isChoice(item), isDraftCard(item))
1164
1299
  const pick = body.pick
1165
1300
  if (pick !== undefined) {
1166
1301
  if (!isChoice(item)) errors.push('pick: only on a choice card')
@@ -1182,8 +1317,9 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
1182
1317
  }
1183
1318
 
1184
1319
  /** the reactions the page sends, checked against the card's views: each on a view, a tile only on a gallery, one per view
1185
- * or tile; an empty one is dropped */
1186
- function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[], choice: boolean): ReviewReaction[] {
1320
+ * or tile; on a draft card each on a message of the draft, by its key (one the draft gained since the card is taken
1321
+ * too: the card shows the draft live); an empty one is dropped */
1322
+ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[], choice: boolean, draft: boolean): ReviewReaction[] {
1187
1323
  if (v === undefined) return []
1188
1324
  if (!Array.isArray(v)) {
1189
1325
  errors.push('reactions: a list')
@@ -1193,6 +1329,11 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
1193
1329
  const seen = new Set<string>()
1194
1330
  const rowsPicked = new Set<string>()
1195
1331
  for (const [i, r] of v.entries()) {
1332
+ if (obj(r) && (draft || r.post !== undefined)) {
1333
+ const q = postReaction(r, i, draft, seen, errors)
1334
+ if (q) out.push(q)
1335
+ continue
1336
+ }
1196
1337
  const on = obj(r) && typeof r.view === 'number' && Number.isInteger(r.view) ? views[r.view] : undefined
1197
1338
  if (!obj(r) || !on) {
1198
1339
  errors.push(`reactions[${i}].view: the index of one of the card's views`)
@@ -1233,12 +1374,34 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
1233
1374
  return out
1234
1375
  }
1235
1376
 
1377
+ /** a reaction to one message of a draft card, checked: its key, OK, fix or no, his word; null with its errors pushed, or
1378
+ * when it says nothing */
1379
+ function postReaction(r: Record<string, unknown>, i: number, draft: boolean, seen: Set<string>, errors: string[]): ReviewReaction | null {
1380
+ const bad: string[] = []
1381
+ if (!draft) bad.push(`reactions[${i}].post: only on a draft card`)
1382
+ else if (typeof r.post !== 'string' || !POST_KEY.test(r.post)) bad.push(`reactions[${i}].post: the key of one message of the draft, <account> or <account>/<name>`)
1383
+ if (r.status !== undefined && !STATUSES.includes(r.status as ReviewStatus)) bad.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
1384
+ if (r.comment !== undefined && typeof r.comment !== 'string') bad.push(`reactions[${i}].comment: a text`)
1385
+ for (const k of ['tile', 'stars', 'picked']) if (r[k] !== undefined) bad.push(`reactions[${i}].${k}: none on a message of a draft`)
1386
+ const key = `post/${String(r.post)}`
1387
+ if (seen.has(key)) bad.push(`reactions[${i}]: a second reaction on the same message`)
1388
+ seen.add(key)
1389
+ errors.push(...bad)
1390
+ const comment = typeof r.comment === 'string' ? r.comment.trim() : ''
1391
+ if (bad.length > 0 || (r.status === undefined && comment === '')) return null
1392
+ return { view: 0, post: r.post as string, ...(r.status !== undefined ? { status: r.status as ReviewStatus } : {}), comment }
1393
+ }
1394
+
1395
+ /** a draft card's message as the page and the CLI name it: the name the card pinned, else its key (one the draft gained since) */
1396
+ export const postLabel = (draft: DraftCard | undefined, key: string): string => draft?.posts.find((p) => p.key === key)?.name ?? key
1397
+
1236
1398
  /** what a reaction or a rectangle is on, as the CLI prints it: its view's letter and label, `[B from above]`,
1237
- * `[C trees / oak-v2]`, `[A]` */
1238
- export function placeText(r: { view?: number | undefined; tile?: number | undefined }, views: readonly ReviewView[]): string {
1399
+ * `[C trees / oak-v2]`, `[A]`; on a draft card the message's name, `[Reddit · comfyui]` */
1400
+ export function placeText(r: { view?: number | undefined; tile?: number | undefined; post?: string | undefined }, views: readonly ReviewView[], draft?: DraftCard): string {
1401
+ if (r.post !== undefined) return `[${postLabel(draft, r.post)}]`
1239
1402
  const i = r.view ?? 0
1240
1403
  const v = views[i]
1241
1404
  const t = r.tile !== undefined && v && isGallery(v) ? v.gallery[r.tile] : undefined
1242
1405
  const tile = r.tile !== undefined && v && isGallery(v) ? ` / ${(t && tileName(t)) || `image ${r.tile + 1}`}` : ''
1243
- return `[${viewLetter(i)}${v?.label ? ` ${v.label}` : ''}${tile}]`
1406
+ return `[${viewNo(i)}${v?.label ? ` ${v.label}` : ''}${tile}]`
1244
1407
  }