rvlib-shipkit 2.25.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 (456) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +2 -2
  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 +331 -0
  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 +130 -17
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +349 -23
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +370 -95
  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/SK045-slow-hooks.check.ts +47 -0
  34. package/src/checks/SK046-hook-records.check.ts +76 -0
  35. package/src/checks/SK047-login-in-description.check.ts +36 -0
  36. package/src/checks/SK048-one-local-file.check.ts +36 -0
  37. package/src/cli/cmd_Asks.ts +71 -5
  38. package/src/cli/cmd_Backup.ts +5 -3
  39. package/src/cli/cmd_Capacity.ts +2 -2
  40. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  41. package/src/cli/cmd_Db.ts +253 -0
  42. package/src/cli/cmd_History.ts +212 -0
  43. package/src/cli/cmd_Home.ts +31 -3
  44. package/src/cli/cmd_Hq.ts +516 -0
  45. package/src/cli/cmd_Machines.ts +36 -0
  46. package/src/cli/cmd_Media.ts +38 -6
  47. package/src/cli/cmd_Mv.ts +1 -1
  48. package/src/cli/cmd_Reflect.ts +23 -2
  49. package/src/cli/cmd_Releases.ts +30 -0
  50. package/src/cli/cmd_Review.ts +569 -118
  51. package/src/cli/cmd_Secret.ts +62 -12
  52. package/src/cli/cmd_Social.ts +83 -1
  53. package/src/cli/cmd_Space.ts +324 -0
  54. package/src/cli/cmd_Time.ts +82 -5
  55. package/src/cli/cmd_Tmp.ts +28 -4
  56. package/src/cli/cmd_Trailer.ts +14 -10
  57. package/src/cli/cmd_Urls.ts +56 -0
  58. package/src/cli/cmd_Vault.ts +583 -0
  59. package/src/cli/family-help.ts +4 -2
  60. package/src/cli/family-pages.ts +1 -1
  61. package/src/cli/registry.ts +26 -4
  62. package/src/collections/actions.ts +63 -13
  63. package/src/collections/collection-types.ts +23 -1
  64. package/src/collections/providers.ts +117 -23
  65. package/src/collections/review.ts +4 -4
  66. package/src/commands/runner.ts +5 -1
  67. package/src/contracts/contract-manifests.ts +6 -5
  68. package/src/contracts/contract-types.ts +6 -4
  69. package/src/contracts/contracts-engine.ts +11 -0
  70. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  71. package/src/core/budget.ts +12 -17
  72. package/src/core/capacity.ts +27 -18
  73. package/src/core/check-runner.ts +7 -4
  74. package/src/core/history-files.ts +9 -5
  75. package/src/core/layout.ts +3 -0
  76. package/src/core/machine-busy.ts +127 -0
  77. package/src/core/machine-commit.ts +6 -1
  78. package/src/core/machine-db.ts +368 -20
  79. package/src/core/machine-layout.ts +137 -0
  80. package/src/core/machine-read.ts +81 -0
  81. package/src/core/migrate-layout.ts +1 -1
  82. package/src/core/one-way-in-policy.ts +64 -7
  83. package/src/core/polling-policy.ts +27 -0
  84. package/src/core/retention.ts +16 -2
  85. package/src/core/scope.ts +107 -14
  86. package/src/core/signal-name.ts +6 -0
  87. package/src/core/slots.ts +5 -4
  88. package/src/core/trace-audit.ts +6 -1
  89. package/src/core/transient.ts +6 -0
  90. package/src/drill/clean.ts +25 -1
  91. package/src/drill/run.ts +2 -2
  92. package/src/drill/seal.ts +27 -4
  93. package/src/home/activity-shape.ts +2 -0
  94. package/src/home/activity.ts +66 -3
  95. package/src/home/app-sign.ts +15 -4
  96. package/src/home/daemon-jobs.ts +149 -7
  97. package/src/home/database-projects.ts +111 -0
  98. package/src/home/database-words.ts +203 -0
  99. package/src/home/databases.ts +460 -0
  100. package/src/home/global-units.ts +6 -0
  101. package/src/home/gui-app/ShipkitGui.swift +122 -1
  102. package/src/home/gui-app.ts +6 -3
  103. package/src/home/home-move.ts +514 -0
  104. package/src/home/home-paths.ts +12 -3
  105. package/src/home/home-routes.ts +68 -0
  106. package/src/home/inbox-shape.ts +24 -14
  107. package/src/home/machine-fold.ts +820 -0
  108. package/src/home/machine-host.ts +20 -5
  109. package/src/home/machine-repair.ts +503 -0
  110. package/src/home/machine-stores.ts +66 -15
  111. package/src/home/machine-temp.ts +547 -86
  112. package/src/home/resume.ts +79 -0
  113. package/src/home/run-daemon.ts +25 -4
  114. package/src/home/run-pm.ts +18 -5
  115. package/src/home/serve-daemon.ts +18 -3
  116. package/src/home/serve-web.ts +175 -7
  117. package/src/home/space-job.ts +115 -0
  118. package/src/home/space-page.ts +257 -0
  119. package/src/home/space-route.ts +167 -0
  120. package/src/home/space-words.ts +103 -0
  121. package/src/home/time-page-shape.ts +202 -0
  122. package/src/home/time-page.ts +64 -0
  123. package/src/home/vault-page.ts +482 -0
  124. package/src/home/vault-words.ts +132 -0
  125. package/src/hooks/leak-guard.ts +40 -13
  126. package/src/hooks/one-way-in-guard.ts +17 -4
  127. package/src/hq/cards.ts +581 -0
  128. package/src/hq/door-route.ts +43 -0
  129. package/src/hq/door.ts +163 -0
  130. package/src/hq/files-send.ts +348 -0
  131. package/src/hq/forgotten-log.ts +35 -0
  132. package/src/hq/history-check.ts +255 -0
  133. package/src/hq/history-place.ts +146 -0
  134. package/src/hq/history-send.ts +487 -0
  135. package/src/hq/hq-db.ts +99 -0
  136. package/src/hq/hq-local.ts +469 -0
  137. package/src/hq/hq-routes.ts +196 -0
  138. package/src/hq/hq-store.ts +599 -0
  139. package/src/hq/kinds/ask.ts +147 -0
  140. package/src/hq/kinds/card-gone.ts +83 -0
  141. package/src/hq/kinds/card-msg.ts +66 -0
  142. package/src/hq/kinds/card.ts +99 -0
  143. package/src/hq/kinds/index.ts +21 -0
  144. package/src/hq/kinds/kind.ts +126 -0
  145. package/src/hq/kinds/media.ts +125 -0
  146. package/src/hq/kinds/prompt.ts +219 -0
  147. package/src/hq/kinds/reflection.ts +128 -0
  148. package/src/hq/kinds/report.ts +55 -0
  149. package/src/hq/kinds/time-day.ts +236 -0
  150. package/src/hq/ledger.ts +473 -0
  151. package/src/hq/machine-key.ts +44 -0
  152. package/src/hq/machine-notes.ts +131 -0
  153. package/src/hq/outbox.ts +372 -0
  154. package/src/hq/replica.ts +168 -0
  155. package/src/hq/repo-id.ts +4 -0
  156. package/src/hq/report-facts.ts +117 -0
  157. package/src/hq/report.ts +274 -0
  158. package/src/hq/switch.ts +151 -0
  159. package/src/hq/vault-grant.ts +92 -0
  160. package/src/identities/identities.ts +15 -3
  161. package/src/identities/steps.ts +31 -0
  162. package/src/ledger/db.ts +73 -26
  163. package/src/ledger/gate-checks.ts +29 -4
  164. package/src/ledger/git-key.ts +3 -3
  165. package/src/ledger/git-scan.ts +49 -7
  166. package/src/ledger/run-log.ts +11 -3
  167. package/src/ledger/store.ts +26 -4
  168. package/src/media-store/backup/daemon.ts +36 -17
  169. package/src/media-store/backup/kept.ts +241 -0
  170. package/src/media-store/backup/restore.ts +14 -4
  171. package/src/media-store/backup/run.ts +11 -11
  172. package/src/media-store/backup/secret.ts +6 -4
  173. package/src/media-store/backup/snapshot.ts +4 -2
  174. package/src/media-store/backup/sources.ts +68 -20
  175. package/src/media-store/copy/config.ts +77 -0
  176. package/src/media-store/copy/copy.ts +194 -0
  177. package/src/media-store/copy/lifecycle.ts +43 -0
  178. package/src/media-store/copy/night.ts +90 -0
  179. package/src/media-store/copy/proof.ts +151 -0
  180. package/src/media-store/copy/snapshot.ts +152 -0
  181. package/src/media-store/copy/store.ts +62 -0
  182. package/src/media-store/copy/stream.ts +176 -0
  183. package/src/media-store/daemon.ts +66 -16
  184. package/src/media-store/db.ts +22 -11
  185. package/src/media-store/forget.ts +23 -3
  186. package/src/media-store/hand.ts +4 -3
  187. package/src/media-store/hq-find.ts +75 -0
  188. package/src/media-store/hq-send.ts +277 -0
  189. package/src/media-store/kind.ts +2 -0
  190. package/src/media-store/purge.ts +18 -15
  191. package/src/media-store/put.ts +24 -8
  192. package/src/media-store/remote.ts +16 -7
  193. package/src/media-store/space-listing.ts +240 -0
  194. package/src/media-store/space.ts +40 -21
  195. package/src/media-store/sync.ts +5 -5
  196. package/src/media-store/tidy.ts +98 -0
  197. package/src/media-store/upload.ts +3 -3
  198. package/src/media-store/webp.ts +66 -0
  199. package/src/messages/model.ts +16 -7
  200. package/src/messages/routes.ts +14 -4
  201. package/src/messages/score.ts +2 -2
  202. package/src/messages/suggest.ts +96 -0
  203. package/src/pages/frame-client.ts +10 -0
  204. package/src/plan/planner.ts +28 -17
  205. package/src/recordings/media-kind.ts +1 -0
  206. package/src/recordings/model.ts +1 -1
  207. package/src/recordings/recorder-app/Capture.swift +9 -7
  208. package/src/reflect/hq-corpus.ts +56 -0
  209. package/src/reflect/prompt-corpus.ts +3 -1
  210. package/src/reflect/transcript.ts +146 -36
  211. package/src/release/machine-words.ts +67 -0
  212. package/src/release/public-clean.ts +8 -3
  213. package/src/releases/from-card.ts +1 -1
  214. package/src/releases/model.ts +18 -0
  215. package/src/releases/routes.ts +10 -5
  216. package/src/releases/store.ts +23 -2
  217. package/src/repo-config.ts +42 -2
  218. package/src/review/anim.ts +2 -2
  219. package/src/review/auto.ts +2 -2
  220. package/src/review/card-db.ts +244 -0
  221. package/src/review/card-rows.ts +266 -0
  222. package/src/review/cells.ts +76 -5
  223. package/src/review/draft-card.ts +41 -0
  224. package/src/review/draft-model.ts +78 -0
  225. package/src/review/format.ts +29 -10
  226. package/src/review/gone.ts +98 -0
  227. package/src/review/inbox-hook.ts +35 -0
  228. package/src/review/marks.ts +1 -1
  229. package/src/review/media-kind.ts +7 -5
  230. package/src/review/media-read.ts +9 -7
  231. package/src/review/media.ts +32 -5
  232. package/src/review/model.ts +214 -45
  233. package/src/review/move.ts +491 -0
  234. package/src/review/notes.ts +12 -20
  235. package/src/review/previews.ts +15 -19
  236. package/src/review/project.ts +1 -1
  237. package/src/review/rev.ts +8 -0
  238. package/src/review/role.ts +1 -1
  239. package/src/review/routes.ts +64 -13
  240. package/src/review/stage-card.ts +8 -4
  241. package/src/review/stage-routes.ts +1 -1
  242. package/src/review/store.ts +529 -83
  243. package/src/review/thread-fold.ts +51 -0
  244. package/src/review/threads.ts +147 -9
  245. package/src/review/trailer-auto-mock.ts +63 -0
  246. package/src/review/trailer-card.ts +4 -4
  247. package/src/review/trailer-desk.ts +41 -7
  248. package/src/review/trailer-media.ts +1 -0
  249. package/src/review/trailer-model.ts +8 -0
  250. package/src/review/trailer-notes.ts +1 -1
  251. package/src/review/trailer-routes.ts +9 -1
  252. package/src/review/unit.ts +6 -6
  253. package/src/review/watchers.ts +1 -1
  254. package/src/rules/untrack-generated.ts +92 -8
  255. package/src/secrets/held.ts +16 -0
  256. package/src/secrets/keychain.ts +113 -0
  257. package/src/secrets/list.ts +16 -6
  258. package/src/secrets/manager.ts +24 -10
  259. package/src/secrets/read.ts +257 -0
  260. package/src/secrets/who-reads.ts +49 -0
  261. package/src/serve/door-forward.ts +268 -0
  262. package/src/serve/door-names.ts +47 -0
  263. package/src/serve/embed.ts +1 -1
  264. package/src/serve/hub-app/activity-view.tsx +56 -32
  265. package/src/serve/hub-app/activity.css +7 -1
  266. package/src/serve/hub-app/asks-page.tsx +48 -0
  267. package/src/serve/hub-app/asks-st.ts +25 -0
  268. package/src/serve/hub-app/clock-svc.ts +1 -2
  269. package/src/serve/hub-app/col-card.tsx +64 -13
  270. package/src/serve/hub-app/col-list-page.tsx +122 -0
  271. package/src/serve/hub-app/col-list-st.ts +103 -0
  272. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  273. package/src/serve/hub-app/col-tables.ts +76 -8
  274. package/src/serve/hub-app/cols-svc.ts +70 -16
  275. package/src/serve/hub-app/database-st.ts +260 -0
  276. package/src/serve/hub-app/database-view.tsx +289 -0
  277. package/src/serve/hub-app/database.css +32 -0
  278. package/src/serve/hub-app/entry-bar.css +14 -0
  279. package/src/serve/hub-app/entry-bar.tsx +33 -0
  280. package/src/serve/hub-app/entry-pick.ts +31 -0
  281. package/src/serve/hub-app/floating.tsx +1 -0
  282. package/src/serve/hub-app/hash-route.ts +11 -1
  283. package/src/serve/hub-app/header-bar.tsx +14 -18
  284. package/src/serve/hub-app/home-st.ts +89 -9
  285. package/src/serve/hub-app/home-strip.css +5 -19
  286. package/src/serve/hub-app/home-strip.tsx +58 -92
  287. package/src/serve/hub-app/home.html +7 -0
  288. package/src/serve/hub-app/hub-app.tsx +31 -142
  289. package/src/serve/hub-app/hub-types.ts +3 -1
  290. package/src/serve/hub-app/hub.css +109 -23
  291. package/src/serve/hub-app/icons.tsx +18 -1
  292. package/src/serve/hub-app/identities-st.ts +56 -6
  293. package/src/serve/hub-app/identities-view.tsx +100 -58
  294. package/src/serve/hub-app/identities.css +17 -15
  295. package/src/serve/hub-app/identity-address.ts +5 -0
  296. package/src/serve/hub-app/inbox-st.ts +41 -24
  297. package/src/serve/hub-app/inbox-view.tsx +37 -41
  298. package/src/serve/hub-app/inbox.css +2 -5
  299. package/src/serve/hub-app/index.html +7 -0
  300. package/src/serve/hub-app/kept-cols.tsx +7 -0
  301. package/src/serve/hub-app/keys.ts +28 -15
  302. package/src/serve/hub-app/later.tsx +26 -0
  303. package/src/serve/hub-app/list-filter.tsx +14 -0
  304. package/src/serve/hub-app/list-walk.ts +72 -3
  305. package/src/serve/hub-app/machines-st.ts +251 -0
  306. package/src/serve/hub-app/machines-view.tsx +224 -0
  307. package/src/serve/hub-app/machines.css +76 -0
  308. package/src/serve/hub-app/md-copy.tsx +79 -0
  309. package/src/serve/hub-app/media-view.tsx +2 -0
  310. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  311. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  312. package/src/serve/hub-app/messages.css +14 -0
  313. package/src/serve/hub-app/page-keys.ts +175 -0
  314. package/src/serve/hub-app/pages-frames.tsx +11 -3
  315. package/src/serve/hub-app/palette-st.ts +58 -11
  316. package/src/serve/hub-app/palette-view.tsx +3 -1
  317. package/src/serve/hub-app/project-list.css +54 -8
  318. package/src/serve/hub-app/project-list.tsx +128 -59
  319. package/src/serve/hub-app/projects-svc.ts +78 -7
  320. package/src/serve/hub-app/reader-chips.tsx +13 -0
  321. package/src/serve/hub-app/readme-view.tsx +2 -3
  322. package/src/serve/hub-app/readme.css +27 -5
  323. package/src/serve/hub-app/reflections-page.tsx +42 -0
  324. package/src/serve/hub-app/reflections-st.ts +17 -0
  325. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  326. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  327. package/src/serve/hub-app/repo-sections.ts +9 -5
  328. package/src/serve/hub-app/repo-st.ts +35 -8
  329. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  330. package/src/serve/hub-app/review/kit.tsx +50 -7
  331. package/src/serve/hub-app/review/note-place.ts +1 -1
  332. package/src/serve/hub-app/review/review-board.tsx +2 -2
  333. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  334. package/src/serve/hub-app/review/review-kit.ts +27 -1
  335. package/src/serve/hub-app/review/review-list.tsx +68 -30
  336. package/src/serve/hub-app/review/review-page.tsx +7 -8
  337. package/src/serve/hub-app/review/review-st.ts +111 -24
  338. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  339. package/src/serve/hub-app/review/review-views.tsx +475 -144
  340. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  341. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  342. package/src/serve/hub-app/review/thread-st.ts +73 -26
  343. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  344. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  345. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  346. package/src/serve/hub-app/review.css +267 -61
  347. package/src/serve/hub-app/side-lists.ts +72 -0
  348. package/src/serve/hub-app/sidebar.tsx +6 -3
  349. package/src/serve/hub-app/site/site-part.tsx +2 -8
  350. package/src/serve/hub-app/site/site-st.ts +4 -4
  351. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  352. package/src/serve/hub-app/social/kit.tsx +30 -4
  353. package/src/serve/hub-app/social/post-card.tsx +139 -49
  354. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  355. package/src/serve/hub-app/social/social-model.ts +11 -0
  356. package/src/serve/hub-app/social/social-page.tsx +94 -35
  357. package/src/serve/hub-app/social/social-st.ts +120 -36
  358. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  359. package/src/serve/hub-app/social/stage-st.ts +1 -1
  360. package/src/serve/hub-app/social/step-layout.ts +1 -1
  361. package/src/serve/hub-app/social.css +3 -0
  362. package/src/serve/hub-app/space-st.ts +209 -0
  363. package/src/serve/hub-app/space-view.tsx +196 -0
  364. package/src/serve/hub-app/space.css +27 -0
  365. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  366. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  367. package/src/serve/hub-app/stores.css +6 -1
  368. package/src/serve/hub-app/theme-st.ts +22 -9
  369. package/src/serve/hub-app/time-charts.tsx +291 -0
  370. package/src/serve/hub-app/time-pages.tsx +749 -0
  371. package/src/serve/hub-app/time-st.ts +162 -0
  372. package/src/serve/hub-app/time-view.tsx +76 -0
  373. package/src/serve/hub-app/time.css +138 -0
  374. package/src/serve/hub-app/tree-build.ts +52 -42
  375. package/src/serve/hub-app/tree-row.tsx +4 -4
  376. package/src/serve/hub-app/tree-svc.ts +18 -9
  377. package/src/serve/hub-app/urls-svc.ts +154 -0
  378. package/src/serve/hub-app/urls-view.tsx +117 -0
  379. package/src/serve/hub-app/urls.css +30 -0
  380. package/src/serve/hub-app/vault-st.ts +127 -0
  381. package/src/serve/hub-app/vault-view.tsx +154 -0
  382. package/src/serve/hub-app/vault.css +38 -0
  383. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  384. package/src/serve/hub-app/waiting-svc.ts +29 -0
  385. package/src/serve/hub-app/wikis-view.tsx +2 -2
  386. package/src/serve/hub-runtime.ts +15 -2
  387. package/src/serve/project-gutter-route.ts +27 -14
  388. package/src/serve/project-gutter.ts +25 -12
  389. package/src/serve/same-origin.ts +10 -0
  390. package/src/serve/serve-hub.ts +13 -4
  391. package/src/shipkit-files.ts +16 -2
  392. package/src/shipkit.ts +1 -1
  393. package/src/shot/shooter.ts +616 -420
  394. package/src/shot/shot-ask.ts +246 -155
  395. package/src/site/desk.ts +2 -2
  396. package/src/smoke/run-smoke.ts +3 -2
  397. package/src/social/cover.ts +202 -0
  398. package/src/social/discord-layout.ts +37 -13
  399. package/src/social/drafts.ts +3 -0
  400. package/src/social/load.ts +23 -2
  401. package/src/social/media-kind.ts +2 -1
  402. package/src/social/publish/discord.ts +5 -2
  403. package/src/social/publish/secret.ts +2 -2
  404. package/src/social/release-stage.ts +28 -13
  405. package/src/social/routes.ts +26 -1
  406. package/src/social/stage.ts +1 -1
  407. package/src/social/stats.ts +12 -9
  408. package/src/social/strip.ts +4 -1
  409. package/src/social/thumbnail.ts +255 -0
  410. package/src/stores/collection.ts +15 -11
  411. package/src/stores/desk.ts +236 -42
  412. package/src/stores/model.ts +72 -6
  413. package/src/stores/routes.ts +37 -12
  414. package/src/stores/unit.ts +14 -8
  415. package/src/suite/judge-suites.ts +113 -16
  416. package/src/suite/select.ts +45 -3
  417. package/src/suite/suite-cli.ts +81 -34
  418. package/src/trailer/bed.ts +1 -1
  419. package/src/trailer/build.ts +134 -21
  420. package/src/trailer/ffmpeg.ts +7 -0
  421. package/src/trailer/fonts.ts +3 -2
  422. package/src/trailer/grammar.ts +201 -2
  423. package/src/trailer/graph.ts +42 -5
  424. package/src/trailer/look.ts +21 -0
  425. package/src/trailer/mock.ts +154 -0
  426. package/src/trailer/passage.ts +65 -26
  427. package/src/trailer/score/heard.ts +89 -0
  428. package/src/trailer/score/sound.ts +14 -8
  429. package/src/trailer/sound/run.ts +16 -6
  430. package/src/trailer/stitch.ts +26 -5
  431. package/src/trailer/titles.ts +82 -19
  432. package/src/trailer/versions.ts +1 -3
  433. package/src/trailer/vertical.ts +3 -1
  434. package/src/urls/frame.ts +195 -0
  435. package/src/urls/routes.ts +43 -0
  436. package/src/urls/rows.ts +171 -0
  437. package/src/urls/unit.ts +73 -0
  438. package/src/vault/house-keys.ts +42 -0
  439. package/src/vault/layout.ts +50 -0
  440. package/src/vault/policy.ts +165 -0
  441. package/src/vault/vault-audit.ts +276 -0
  442. package/src/vault/vault-client.ts +40 -0
  443. package/src/vault/vault-config.ts +159 -0
  444. package/src/vault/vault-destroy.ts +78 -0
  445. package/src/vault/vault-handover.ts +305 -0
  446. package/src/vault/vault-http.ts +352 -0
  447. package/src/vault/vault-import.ts +208 -0
  448. package/src/vault/vault-init.ts +328 -0
  449. package/src/vault/vault-minter.ts +271 -0
  450. package/src/vault/vault-restore.ts +333 -0
  451. package/src/vault/vault-serve.ts +342 -0
  452. package/src/vault/vault-snapshot.ts +281 -0
  453. package/src/veille/asks.ts +1 -1
  454. package/src/veille/desk.ts +2 -2
  455. package/src/wiki/run-wiki.ts +2 -1
  456. package/src/wiki/scan-md.ts +42 -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
 
@@ -658,7 +755,8 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
658
755
  s = i.origin.by === 'agent' ? given : { ...keep, state: 'open' }
659
756
  break
660
757
  case 'blocked':
661
- s = { ...keep, state: 'blocked' }
758
+ // it keeps who blocked it: that worker takes it back or closes it once the owner answered elsewhere
759
+ s = { ...keep, state: 'blocked', worker: m.who }
662
760
  break
663
761
  case 'ready':
664
762
  if (s.state === 'draft') s = { ...keep, state: 'asks' }
@@ -702,12 +800,12 @@ const FROM: Record<Exclude<Op, 'seen'>, readonly State[]> = {
702
800
  answer: ['question'],
703
801
  reassign: ['open', 'claimed'],
704
802
  drop: ['new', 'question', 'open', 'blocked'],
705
- claim: ['open', 'claimed', 'closed'],
803
+ claim: ['open', 'claimed', 'closed', 'blocked'],
706
804
  release: ['claimed'],
707
805
  blocked: ['claimed'],
708
- fixed: ['open', 'claimed'],
806
+ fixed: ['open', 'claimed', 'blocked'],
709
807
  done: ['claimed'],
710
- wontfix: ['open', 'claimed'],
808
+ wontfix: ['open', 'claimed', 'blocked'],
711
809
  withdraw: ['draft', 'asks'],
712
810
  reopen: ['closed', 'claimed'],
713
811
  ready: ['draft'],
@@ -723,13 +821,14 @@ export function allowed(s: ItemState, op: Op, who: string, dispatcher: string |
723
821
  if (op === 'answer' && who !== 'owner') return 'only the owner answers a question'
724
822
  if (DISPATCHER_OPS.has(op)) {
725
823
  if (!routed) return 'this repo routes nothing: its review unit declares no dispatcher'
726
- 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>'
727
825
  if (who !== dispatcher) return `only the dispatcher (${dispatcher}) may ${op}`
728
826
  }
729
827
  if (!routed && s.state === 'new' && (op === 'claim' || op === 'fixed' || op === 'wontfix')) return op === 'claim' && who === 'owner' ? 'a worker claims, never the owner' : null
730
828
  if (op === 'claim' && (who === 'owner' || who === dispatcher)) return `a worker claims, never ${who === 'owner' ? 'the owner' : 'the dispatcher'}`
731
829
  if (WORKER_OPS.has(op) && who !== 'owner' && s.worker !== undefined && s.worker !== who) return `claimed by ${s.worker}, not by ${who}`
732
830
  if (op === 'claim' && s.state === 'claimed' && s.since !== undefined && s.worker !== who) return `already claimed by ${s.worker}: release it first (--as ${s.worker})`
831
+ if (op === 'claim' && s.state === 'blocked' && s.worker !== undefined && s.worker !== who) return `blocked by ${s.worker}, who takes it back (--as ${s.worker}); the dispatcher routes it to another`
733
832
  if (op === 'claim' && s.state === 'closed' && s.why !== 'rejected' && s.why !== 'approved-with-fix')
734
833
  return `claim needs open, or a card he answered « fix » or « no », it is closed (${s.why})`
735
834
  if (!FROM[op].includes(s.state)) {
@@ -768,7 +867,7 @@ export interface WatchFilter {
768
867
  lane: string | null
769
868
  }
770
869
 
771
- /** 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 */
772
871
  export interface Watcher extends WatchFilter {
773
872
  pid: number
774
873
  started: string
@@ -781,18 +880,22 @@ export const coversCard = (f: WatchFilter, x: ReviewItem): boolean =>
781
880
  /** who answers an agent's card, its reply or its seen: the worker of a live claim on it, else the lane that made it,
782
881
  * else (a card with no lane) the session that sent it. null when `me` is that one, else why not and the way out.
783
882
  * Another session hearing the verdict (a bare watch) is refused, so it never answers over the maker; a plain approval,
784
- * which owes nothing, anyone marks seen. An item he raised, a player's or an auto one: the claim rules decide */
785
- export function notAnswererOf(x: ReviewItem, me: { lane: string | null; session: string | null }, op: 'reply' | 'seen'): string | null {
883
+ * which owes nothing, anyone marks seen. So does anyone once the maker stopped listening: `heardBy` is the live
884
+ * watches of the store, and when none of a lane or of a session covers the card (the lane ended), whoever reads the
885
+ * answer marks it seen; a reply stays the maker's. An item he raised, a player's or an auto one: the claim rules decide */
886
+ export function notAnswererOf(x: ReviewItem, me: { lane: string | null; session: string | null }, op: 'reply' | 'seen', heardBy?: readonly WatchFilter[]): string | null {
786
887
  const o = x.item.origin
787
888
  if (o.by !== 'agent') return null
788
889
  const s = stateOf(x, false)
789
890
  if (op === 'seen' && s.state === 'closed' && s.why === 'approved') return null
891
+ // a bare watch hears every card and is nobody's own: only a watch of a lane or of a session says the maker listens
892
+ if (op === 'seen' && heardBy !== undefined && !heardBy.some((w) => (w.lane !== null || w.session !== null) && coversCard(w, x))) return null
790
893
  const id = x.item.id
791
894
  // the way out names claim only where claim takes it
792
895
  const noClaim = allowed(s, 'claim', me.lane ?? 'agent', null, false)
793
896
  const takeOver =
794
897
  noClaim === null
795
- ? `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>`
796
899
  : s.state === 'asks' || s.state === 'draft'
797
900
  ? 'no other lane takes it over before the verdict'
798
901
  : `no takeover: ${noClaim}`
@@ -822,7 +925,7 @@ export function listenWords(ws: readonly Watcher[]): string {
822
925
  * none does. A repo keeps one, the dispatcher's; every other session watches its own cards or its lane's */
823
926
  export function bareWatchTaken(live: readonly Watcher[], self: number): string | null {
824
927
  const other = live.find((w) => w.pid !== self && w.lane === null && w.session === null)
825
- 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
826
929
  }
827
930
 
828
931
  /** what `review add` says when no live watch of the card's own session or lane will read his answer, else null: an
@@ -832,7 +935,7 @@ export function unheardLine(item: Item, watchers: readonly Watcher[]): string |
832
935
  if (o.by !== 'agent') return null
833
936
  const own = o.session || o.lane ? watchers.filter((w) => (o.session && w.session === o.session) || (o.lane && w.lane === o.lane)) : watchers
834
937
  if (listenersOf([{ item, thread: [] }], own).length > 0) return null
835
- 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'
836
939
  return `no watch hears this card: run \`${watch}\` under a monitor now, so his answer reaches you as it lands`
837
940
  }
838
941
 
@@ -857,6 +960,8 @@ export function untakenOf(x: ReviewItem, superseded: boolean, watchers: readonly
857
960
  }
858
961
 
859
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))
860
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))$/
861
966
  /** a message's image as an item's media names it: `thread/<file>` */
862
967
  export const isThreadMedia = (n: string): boolean => n.startsWith('thread/') && MESSAGE_FILE_RE.test(n.slice('thread/'.length))
@@ -923,6 +1028,7 @@ function subjectProblems(s: unknown, spec: Spec): string[] {
923
1028
  if (kind?.problems) return kind.problems(s as Subject).map((p) => `subject: ${p}`)
924
1029
  if (s.kind === 'store' && !kind) return isStoreSubject(s as Subject) && s.store !== '' && s.asset !== '' ? [] : ['subject: a store thing has its store and asset']
925
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>']
926
1032
  if (s.kind !== 'frame') return []
927
1033
  const str = (k: string): boolean => typeof s[k] === 'string' && s[k] !== ''
928
1034
  const num = (k: string): boolean => typeof s[k] === 'number' && Number.isFinite(s[k])
@@ -950,11 +1056,23 @@ function originProblems(o: unknown): string[] {
950
1056
  return ['origin.by: agent, owner, player or auto']
951
1057
  }
952
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
+
953
1070
  function trailerCardProblems(t: unknown): string[] {
954
1071
  const side = (v: unknown): boolean => obj(v) && typeof v.cut === 'string' && v.cut !== '' && typeof v.render === 'number' && Number.isFinite(v.render)
955
1072
  if (!obj(t) || typeof t.trailer !== 'string' || t.trailer === '' || !side(t.after)) return ['trailer: { trailer, after: { cut, render }, before?, shots }']
956
1073
  const out: string[] = []
957
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')
958
1076
  if (!Array.isArray(t.shots) || !t.shots.every((s) => typeof s === 'string' && s !== '')) out.push('trailer.shots: a list of shot names')
959
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')
960
1078
  return out
@@ -969,13 +1087,17 @@ export function itemProblems(v: unknown): string[] {
969
1087
  out.push(...subjectProblems(v.subject, NO_SPEC), ...originProblems(v.origin))
970
1088
  if (v.topic !== undefined && typeof v.topic !== 'string') out.push('topic: a text')
971
1089
  const agent = obj(v.origin) && v.origin.by === 'agent'
972
- 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' : ''}`)
973
1093
  else
974
1094
  v.views.forEach((w: unknown, i: number) => {
975
1095
  if (i > 0 && (!obj(w) || typeof w.label !== 'string' || w.label.trim() === '')) out.push(`views[${i}].label: a text`)
976
1096
  if (obj(w) && w.gallery !== undefined) out.push(...galleryProblems(w, `views[${i}].`))
977
1097
  else out.push(...viewProblems(obj(w) ? w : {}, `views[${i}].`))
978
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>')
979
1101
  if (v.answers !== undefined && !(Array.isArray(v.answers) && v.answers.length > 0 && v.answers.every((a) => typeof a === 'string' && ID_RE.test(a))))
980
1102
  out.push('answers: a list of item ids')
981
1103
  for (const k of ['what', 'post', 'commit', 'supersedes', 'why', 'keeps']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
@@ -984,6 +1106,7 @@ export function itemProblems(v: unknown): string[] {
984
1106
  if (v.light !== undefined && v.light !== 'review') out.push('light: review, or absent')
985
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')
986
1108
  if (v.trailer !== undefined) out.push(...trailerCardProblems(v.trailer))
1109
+ if (v.draft !== undefined) out.push(...draftCardProblems(v.draft))
987
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')
988
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))
989
1112
  out.push('agentPick: the index of one of its views, on a choice card, or absent')
@@ -1016,6 +1139,24 @@ export function messageProblems(v: unknown, name: string): string[] {
1016
1139
  if (typeof v.text !== 'string') out.push('update: its line in text')
1017
1140
  }
1018
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
+ }
1019
1160
  if (v.op === undefined && v.verdict === undefined && v.rate === undefined && typeof v.text !== 'string' && !Array.isArray(v.rects))
1020
1161
  out.push('a message says something: text, rects, verdict, rate or op')
1021
1162
  return out
@@ -1154,7 +1295,7 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
1154
1295
  if (clip && typeof t === 'number') rect.t = t
1155
1296
  out.push(rect)
1156
1297
  }
1157
- const reactions = reactionsOf(body.reactions, views, errors, isChoice(item))
1298
+ const reactions = reactionsOf(body.reactions, views, errors, isChoice(item), isDraftCard(item))
1158
1299
  const pick = body.pick
1159
1300
  if (pick !== undefined) {
1160
1301
  if (!isChoice(item)) errors.push('pick: only on a choice card')
@@ -1176,8 +1317,9 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
1176
1317
  }
1177
1318
 
1178
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
1179
- * or tile; an empty one is dropped */
1180
- 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[] {
1181
1323
  if (v === undefined) return []
1182
1324
  if (!Array.isArray(v)) {
1183
1325
  errors.push('reactions: a list')
@@ -1187,6 +1329,11 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
1187
1329
  const seen = new Set<string>()
1188
1330
  const rowsPicked = new Set<string>()
1189
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
+ }
1190
1337
  const on = obj(r) && typeof r.view === 'number' && Number.isInteger(r.view) ? views[r.view] : undefined
1191
1338
  if (!obj(r) || !on) {
1192
1339
  errors.push(`reactions[${i}].view: the index of one of the card's views`)
@@ -1227,12 +1374,34 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
1227
1374
  return out
1228
1375
  }
1229
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
+
1230
1398
  /** what a reaction or a rectangle is on, as the CLI prints it: its view's letter and label, `[B from above]`,
1231
- * `[C trees / oak-v2]`, `[A]` */
1232
- 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)}]`
1233
1402
  const i = r.view ?? 0
1234
1403
  const v = views[i]
1235
1404
  const t = r.tile !== undefined && v && isGallery(v) ? v.gallery[r.tile] : undefined
1236
1405
  const tile = r.tile !== undefined && v && isGallery(v) ? ` / ${(t && tileName(t)) || `image ${r.tile + 1}`}` : ''
1237
- return `[${viewLetter(i)}${v?.label ? ` ${v.label}` : ''}${tile}]`
1406
+ return `[${viewNo(i)}${v?.label ? ` ${v.label}` : ''}${tile}]`
1238
1407
  }