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
@@ -1,18 +1,53 @@
1
1
  // Persistent human<->agent queue for real-world actions and answers.
2
- // One md file per ask in <dir>/, git-tracked; <dir>/done/ archive. The agent
3
- // greps status; the human edits files (or just does the thing — check()
4
- // auto-closes asks whose `check:` probe passes).
2
+ // One md file per ask in <dir>/, git-tracked; <dir>/done/ and <dir>/declined/
3
+ // archives, a folder per closed status. The agent greps status; the human edits
4
+ // files (or just does the thing — check() auto-closes asks whose `check:` probe passes).
5
5
  //
6
6
  // Stdout contract (FROZEN — consumers parse the prefixes): `closed +
7
- // archived <file>` / `archived <file>` / `still <status> <file>` / `N closed`.
7
+ // archived <file>` / `archived <file>` / `reopened <file>` / `still <status> <file>` / `N closed`.
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from 'fs'
9
9
  import { atomicWrite, mutateLease, withMutateLease } from '../core/locked-write.ts'
10
10
  import { join } from 'path'
11
11
  import { SECRET_NAME } from '../secrets/name.ts'
12
+ import { allStoredSince, type HeldOf } from '../secrets/held.ts'
13
+ import { AFTER_FORMS, afterMs, afterWords } from './ask-after.ts'
14
+
15
+ /** `secrets`: the names a credential ask stores, from its `secret:` line (space or comma separated), [] for none.
16
+ * `stores`: every secret name it asks to store, those and the ones a store line of its body names.
17
+ * `logins`: the names of its `login:` line, secrets stored with an account (the email or user name) beside the value.
18
+ * `after`: the moment it waits for as written, `afterAt` that moment in epoch ms (ask-after.ts) */
19
+ export type Ask = { file: string; status: string; kind: string; created: string; closed: string | null; blocks: string; check: string | null; waits: AskWait[]; pinged: string | null; secrets: string[]; stores: string[]; logins: string[]; after: string | null; afterAt: number | null; title: string }
20
+ /** a warning an ask holds: the check that prints it and words of that one line. The activity page counts it as
21
+ * waiting on the owner, never as work for an agent */
22
+ export type AskWait = { check: string; says: string }
23
+
24
+ const ONE_WAIT = /^([^\s,"]+)\s+"([^"]*)"\s*(?:,\s*|$)/
25
+
26
+ /** `waits: SK002 "Steamworks appid", read-email "token refresh"`. The words are required and any other spelling
27
+ * throws, the file named: a hold with no words would cover every warning its check ever prints, agent work included */
28
+ export const parseWaits = (v: string | null, file: string): AskWait[] => {
29
+ const out: AskWait[] = []
30
+ let rest = (v ?? '').trim()
31
+ while (rest !== '') {
32
+ const m = ONE_WAIT.exec(rest)
33
+ if (m == null || m[2]!.trim() === '') throw new Error(`${file}: waits: '${v}' is not <check id> "<words of its line>"[, <check id> "<words>"]: the words are required`)
34
+ out.push({ check: m[1]!, says: m[2]!.trim() })
35
+ rest = rest.slice(m[0].length)
36
+ }
37
+ return out
38
+ }
39
+
40
+ /** `again`: an ask the owner declined, asked again on purpose; `why` then says what changed. `readers`: who will
41
+ * read each secret, in words (secrets/who-reads.ts), written into the file */
42
+ export type CreateOpts = { kind?: string; blocks?: string; check?: string; why?: string; secrets?: string[]; after?: string; again?: boolean; readers?: Record<string, string>; logins?: string[] }
12
43
 
13
- /** `secrets`: the names a credential ask stores, from its `secret:` line (space or comma separated), [] for none */
14
- export type Ask = { file: string; status: string; kind: string; created: string; closed: string | null; blocks: string; check: string | null; secrets: string[]; title: string }
15
- export type CreateOpts = { kind?: string; blocks?: string; check?: string; why?: string; secrets?: string[] }
44
+ /** how an ask closes: done, or declined by the owner. Each status names its archive folder under the queue */
45
+ export const CLOSED = ['done', 'declined'] as const
46
+ export type Closed = (typeof CLOSED)[number]
47
+ export const isClosed = (status: string): status is Closed => (CLOSED as readonly string[]).includes(status)
48
+
49
+ /** a store line in an ask's body: `<tool> secret set <name>`, as `sk secret set` and a secret manager of the same shape write it */
50
+ const STORE_LINE = /\bsecret set\s+([A-Za-z0-9][A-Za-z0-9._@/-]*)/g
16
51
 
17
52
  /** filename slug: kebab, truncated at a WORD boundary (never mid-word — a
18
53
  * `…-rvlib-` stub reads as broken). Falls back to a hard cut only when the
@@ -47,12 +82,21 @@ const withKeys = (md: string, keys: [string, string][]): string => {
47
82
  }
48
83
  return ['---', ...head, '---', ...f.body].join('\n')
49
84
  }
50
- const closedKeys = (): [string, string][] => [['status', 'done'], ['closed', new Date().toISOString().slice(0, 10)]]
85
+ const today = (): string => new Date().toISOString().slice(0, 10)
86
+ const closedKeys = (status: Closed = 'done'): [string, string][] => [['status', status], ['closed', today()]]
87
+
88
+ const parse = (dir: string, file: string): Ask => askOf(readFileSync(join(dir, file), 'utf8'), file)
51
89
 
52
- const parse = (dir: string, file: string): Ask => {
53
- const md = readFileSync(join(dir, file), 'utf8')
90
+ /** one ask file's keys and title, from its text: its front matter only, never its body. Throws on an `after:` that
91
+ * names no moment, the file named */
92
+ export const askOf = (md: string, file: string): Ask => {
54
93
  const head = frontMatter(md)
55
94
  const fm = (key: string): string | null => head.match(new RegExp(`^${key}:\\s*(.+)$`, 'm'))?.[1]?.trim() ?? null
95
+ const after = fm('after')
96
+ const afterAt = after == null ? null : afterMs(after)
97
+ if (after != null && afterAt == null) throw new Error(`${file}: after: '${after}' names no moment: write ${AFTER_FORMS}`)
98
+ const secrets = (fm('secret') ?? '').split(/[\s,]+/).filter((n) => n !== '')
99
+ const body = splitFront(md)?.body.join('\n') ?? md
56
100
  return {
57
101
  file,
58
102
  status: fm('status') ?? 'open',
@@ -61,7 +105,13 @@ const parse = (dir: string, file: string): Ask => {
61
105
  closed: fm('closed'),
62
106
  blocks: fm('blocks') ?? '-',
63
107
  check: fm('check'),
64
- secrets: (fm('secret') ?? '').split(/[\s,]+/).filter((n) => n !== ''),
108
+ waits: parseWaits(fm('waits'), file),
109
+ pinged: fm('pinged'),
110
+ secrets,
111
+ logins: (fm('login') ?? '').split(/[\s,]+/).filter((n) => n !== ''),
112
+ stores: [...new Set([...secrets, ...[...body.matchAll(STORE_LINE)].map((m) => m[1]!.replace(/[.]+$/, ''))])],
113
+ after,
114
+ afterAt,
65
115
  title: md.match(/^# (.+)$/m)?.[1] ?? file,
66
116
  }
67
117
  }
@@ -71,16 +121,44 @@ export function listAsks(dir: string): Ask[] {
71
121
  return readdirSync(dir).filter((f) => f.endsWith('.md')).sort().map((f) => parse(dir, f))
72
122
  }
73
123
 
124
+ /** an open ask whose `after:` moment is still ahead: out of the open count and the ping until then */
125
+ export const isLater = (a: Ask, now: number = Date.now()): boolean => !isClosed(a.status) && a.afterAt != null && now < a.afterAt
126
+
127
+ /** every ask neither done nor declined, the later ones included (isLater tells them apart) */
74
128
  export function openAsks(dir: string): Ask[] {
75
- return listAsks(dir).filter((a) => a.status !== 'done')
129
+ return listAsks(dir).filter((a) => !isClosed(a.status))
76
130
  }
77
131
 
78
- /** the <dir>/done archive, newest-first — READ-ONLY: never mints the dir
79
- * (numeric filename prefixes are creation order, so reverse-sort = newest) */
80
- export function doneAsks(dir: string): Ask[] {
81
- const done = join(dir, 'done')
82
- if (!existsSync(done)) return []
83
- return readdirSync(done).filter((f) => f.endsWith('.md')).sort().reverse().map((f) => parse(done, f))
132
+ /** an archived file that does not parse, by its path under the queue (`done/<file>`), and why */
133
+ export type Unparsed = (rel: string, why: string) => void
134
+
135
+ /** one closed status's archive, newest-first — READ-ONLY: never mints the dir
136
+ * (numeric filename prefixes are creation order, so reverse-sort = newest). A file that does not parse throws, or
137
+ * with `unparsed` is skipped and named to it: an archive never stops a reader of the others */
138
+ export function archivedAsks(dir: string, status: Closed, unparsed?: Unparsed): Ask[] {
139
+ const at = join(dir, status)
140
+ if (!existsSync(at)) return []
141
+ return readdirSync(at).filter((f) => f.endsWith('.md')).sort().reverse().flatMap((f) => {
142
+ if (unparsed == null) return [parse(at, f)]
143
+ try {
144
+ return [parse(at, f)]
145
+ } catch (e) {
146
+ unparsed(`${status}/${f}`, (e as Error).message)
147
+ return []
148
+ }
149
+ })
150
+ }
151
+ export const doneAsks = (dir: string, unparsed?: Unparsed): Ask[] => archivedAsks(dir, 'done', unparsed)
152
+ /** the asks filed under declined/, whatever their status says now */
153
+ export const declinedAsks = (dir: string, unparsed?: Unparsed): Ask[] => archivedAsks(dir, 'declined', unparsed)
154
+ const skip: Unparsed = () => {}
155
+
156
+ /** every ask the owner declined, by its path under the queue: marked in place or archived, its status still declined */
157
+ export function declinedNow(dir: string): { rel: string; ask: Ask }[] {
158
+ return [
159
+ ...listAsks(dir).filter((a) => a.status === 'declined').map((ask) => ({ rel: ask.file, ask })),
160
+ ...declinedAsks(dir, skip).filter((a) => a.status === 'declined').map((ask) => ({ rel: `declined/${ask.file}`, ask })),
161
+ ]
84
162
  }
85
163
 
86
164
  /** probe every open ask and archive the ones that now pass. Under the repo's
@@ -88,19 +166,59 @@ export function doneAsks(dir: string): Ask[] {
88
166
  * world), and then one of them renames a file the other already moved, which
89
167
  * is an uncaught ENOENT rather than a message. The loser waits and finds
90
168
  * nothing left to close, which is the correct answer. */
91
- export async function checkAsks(root: string, dir: string, print: (line: string) => void = console.log): Promise<{ closed: number }> {
92
- const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(root, dir, print))
169
+ export async function checkAsks(root: string, dir: string, print: (line: string) => void = console.log, o: CloseOpts = {}): Promise<{ closed: number }> {
170
+ const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(root, dir, print, o))
93
171
  if (leased.ok) return leased.value
94
172
  print(`WARN asks check skipped — ${leased.warn}`)
95
173
  return { closed: 0 }
96
174
  }
97
175
 
98
- function checkAsksBody(root: string, dir: string, print: (line: string) => void): { closed: number } {
176
+ /** `held`: the store's read of a credential ask's names (secrets/read.ts heldHere by default), a test passes its own */
177
+ export type CloseOpts = { held?: HeldOf }
178
+
179
+ /** the names of a credential ask, once every value was stored on or after the day it was made: it is closed (stamped
180
+ * done and archived), true. A value of no known day never closes it */
181
+ async function closeIfIn(root: string, dir: string, a: Ask, o: CloseOpts): Promise<boolean> {
182
+ if (a.kind !== 'credential' || a.secrets.length === 0) return false
183
+ const since = afterMs(a.created)
184
+ if (since == null) return false
185
+ const held = await (o.held ?? (async (names, cwd) => (await import('../secrets/read.ts')).heldHere({ names, cwd })))(a.secrets, root).catch(() => ({}))
186
+ if (!allStoredSince(held, a.secrets, since)) return false
187
+ closeAsk(dir, a)
188
+ return true
189
+ }
190
+
191
+ /** stamp an open ask done and move it under done/ */
192
+ function closeAsk(dir: string, a: Ask): void {
193
+ const done = join(dir, 'done')
194
+ mkdirSync(done, { recursive: true })
195
+ atomicWrite(join(dir, a.file), withKeys(readFileSync(join(dir, a.file), 'utf8'), closedKeys()))
196
+ renameSync(join(dir, a.file), join(done, a.file))
197
+ }
198
+
199
+ async function checkAsksBody(root: string, dir: string, print: (line: string) => void, o: CloseOpts): Promise<{ closed: number }> {
99
200
  const done = join(dir, 'done')
100
201
  mkdirSync(done, { recursive: true })
101
202
  let closed = 0
203
+ // an archived ask whose status was set back to open by hand goes back to the queue
204
+ for (const status of CLOSED)
205
+ for (const a of archivedAsks(dir, status, (rel, why) => print(`WARN ${rel} does not parse, skipped: ${why}`))) {
206
+ if (isClosed(a.status) || existsSync(join(dir, a.file))) continue
207
+ renameSync(join(dir, status, a.file), join(dir, a.file))
208
+ print(`reopened ${a.file} (its status is ${a.status})`)
209
+ }
102
210
  for (const a of listAsks(dir)) {
103
- if (a.status === 'done') { renameSync(join(dir, a.file), join(done, a.file)); print(`archived ${a.file} → done/`); continue }
211
+ if (isClosed(a.status)) {
212
+ mkdirSync(join(dir, a.status), { recursive: true })
213
+ renameSync(join(dir, a.file), join(dir, a.status, a.file))
214
+ print(`archived ${a.file} → ${a.status}/`)
215
+ continue
216
+ }
217
+ if (await closeIfIn(root, dir, a, o)) {
218
+ print(`closed + archived ${a.file} (every value is in)`)
219
+ closed++
220
+ continue
221
+ }
104
222
  if (a.check == null) { print(`still ${a.status.padEnd(8)} ${a.file} (manual — no probe)`); continue }
105
223
  if (probeAsk(root, dir, a, a.check).passed) {
106
224
  print(`closed + archived ${a.file}`)
@@ -123,20 +241,19 @@ function probeAsk(root: string, dir: string, a: Ask, check: string): { passed: t
123
241
  const tail = p.stderr.toString().trim().split('\n').at(-1) ?? ''
124
242
  return { passed: false, why: `exit ${p.exitCode}${tail !== '' ? `: ${tail}` : ''}` }
125
243
  }
126
- const done = join(dir, 'done')
127
- mkdirSync(done, { recursive: true })
128
- atomicWrite(join(dir, a.file), withKeys(readFileSync(join(dir, a.file), 'utf8'), closedKeys()))
129
- renameSync(join(dir, a.file), join(done, a.file))
244
+ closeAsk(dir, a)
130
245
  return { passed: true }
131
246
  }
132
247
 
133
- export type OneCheck = { check: 'none' } | { check: 'passed' } | { check: 'failed'; why: string }
248
+ /** `in`: a credential ask closed because every value it names was stored after it was made */
249
+ export type OneCheck = { check: 'none' } | { check: 'passed' } | { check: 'in' } | { check: 'failed'; why: string }
134
250
 
135
- /** `checkAsks` for one open ask: its probe alone, under the same lease */
136
- export async function checkAsk(root: string, dir: string, file: string): Promise<OneCheck> {
137
- const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print: () => {}, maxWaitMs: 45_000 }, (): OneCheck => {
251
+ /** `checkAsks` for one open ask: its values, then its probe alone, under the same lease */
252
+ export async function checkAsk(root: string, dir: string, file: string, o: CloseOpts = {}): Promise<OneCheck> {
253
+ const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print: () => {}, maxWaitMs: 45_000 }, async (): Promise<OneCheck> => {
138
254
  const a = openAsks(dir).find((x) => x.file === file)
139
255
  if (a == null) return { check: 'failed', why: `${file} is no longer an open ask` }
256
+ if (await closeIfIn(root, dir, a, o)) return { check: 'in' }
140
257
  if (a.check == null) return { check: 'none' }
141
258
  const r = probeAsk(root, dir, a, a.check)
142
259
  return r.passed ? { check: 'passed' } : { check: 'failed', why: r.why }
@@ -172,7 +289,7 @@ Reply with the number.
172
289
 
173
290
  // a credential ask: the human mints the value, then pastes it into the field
174
291
  // the hub draws under the ask, or into the store command's silent prompt
175
- const credentialBody = (names: string[]): string => `<!-- a credential: the steps that mint the value, then the store step as written. Values in the table, buttons in bold. -->
292
+ const credentialBody = (names: string[], readers: Record<string, string> = {}, logins: readonly string[] = []): string => `<!-- a credential: the steps that mint the value, then the store step as written. Values in the table, buttons in bold. -->
176
293
 
177
294
  ## 1. {{verb}} {{thing}}
178
295
 
@@ -183,9 +300,9 @@ Open **[{{page name}}]({{url, ids filled in}})**, then click **{{button}}**, and
183
300
  Paste it in the field below and click **store**. Or type ${names.length > 1 ? 'these lines' : 'this line'} in Claude Code and paste it at the silent prompt:
184
301
 
185
302
  \`\`\`
186
- ${names.map((n) => `! sk secret set ${n}`).join('\n')}
303
+ ${names.map((n) => `! sk secret set ${n}${logins.includes(n) ? ' {{the account you sign in with}}' : ''}`).join('\n')}
187
304
  \`\`\`
188
-
305
+ ${names.some((n) => readers[n] != null) ? `\nWho will read it once stored:\n\n${names.map((n) => `- \`${n}\`: ${readers[n] ?? 'not known'}`).join('\n')}\n` : ''}
189
306
  The check below then closes this ask.
190
307
  `
191
308
 
@@ -193,32 +310,40 @@ export function createAsk(dir: string, title: string, opts?: CreateOpts): string
193
310
  const secrets = opts?.secrets ?? []
194
311
  const bad = secrets.find((s) => !SECRET_NAME.test(s))
195
312
  if (bad != null) throw new Error(`refusing secret name '${bad}': letters, digits and . _ @ / - only, never a leading dash`)
313
+ const logins = opts?.logins ?? []
314
+ if (logins.some((l) => !secrets.includes(l))) throw new Error(`a login is one of the ask's secrets: ${logins.filter((l) => !secrets.includes(l)).join(', ')} is not`)
196
315
  if (secrets.length > 0 && (opts?.kind ?? 'credential') !== 'credential') throw new Error(`a secret is stored by a credential ask, not a ${opts?.kind} one`)
197
316
  opts = secrets.length > 0 ? { ...opts, kind: 'credential', check: opts?.check ?? secrets.map((s) => `sk secret get ${s} >/dev/null`).join(' && ') } : opts
317
+ const slug = slugify(title)
318
+ const why = opts?.why?.trim()
319
+ if (opts?.again === true && (why == null || why === '')) throw new Error('--again needs --why: what changed since the owner declined it')
320
+ const no = declinedLike(dir, slug, secrets)
321
+ if (opts?.again !== true && no != null)
322
+ throw new Error(`refusing: the owner declined ${no.why} in ${join(dir, no.rel)} on ${no.ask.closed ?? '?'}: an ask the owner declined stays declined. Ask again only when a fact changed after the owner's no: sk ask "${title}" --again --why "<the fact and its source>"`)
198
323
  mkdirSync(dir, { recursive: true })
199
- // max numeric prefix across BOTH live and archived asks — numbers are never reused
200
- const done = join(dir, 'done')
201
- const archived = existsSync(done) ? readdirSync(done).filter((f) => f.endsWith('.md')) : []
324
+ // max numeric prefix across the live and every archived ask — numbers are never reused
325
+ const archived = CLOSED.flatMap((s) => (existsSync(join(dir, s)) ? readdirSync(join(dir, s)).filter((f) => f.endsWith('.md')) : []))
202
326
  const n = Math.max(0, ...[...listAsks(dir).map((a) => a.file), ...archived].map((f) => parseInt(f, 10) || 0)) + 1
203
- const slug = slugify(title)
204
327
  const file = `${String(n).padStart(3, '0')}-${slug}.md`
205
328
  if (existsSync(join(dir, file))) throw new Error(`refusing to overwrite existing ${file}`)
206
329
  const check = opts?.check ?? null
207
330
  // Why is OPTIONAL — omit the line entirely rather than ship a literal
208
331
  // "TODO" that never gets filled (the ask itself is the record).
209
- const why = opts?.why?.trim()
210
- const whyBlock = why != null && why !== '' ? `**Why**: ${why}\n\n` : ''
332
+ const after = opts?.after
333
+ if (after != null && afterMs(after) == null) throw new Error(`refusing after: '${after}': write ${AFTER_FORMS}`)
334
+ const repeats = opts?.again === true && no != null ? `asked again after the owner declined ${no.rel} on ${no.ask.closed ?? '?'}: ` : ''
335
+ const whyBlock = why != null && why !== '' ? `**Why**: ${repeats}${why}\n\n` : ''
211
336
  const doneWhen = check != null ? `\`${check}\` exits 0` : 'status flipped to done'
212
337
  writeFileSync(join(dir, file), `---
213
338
  status: open
214
339
  kind: ${opts?.kind ?? 'action'}
215
- created: ${new Date().toISOString().slice(0, 10)}
216
- blocks: ${opts?.blocks ?? '-'}${check != null ? `\ncheck: ${check}` : ''}${secrets.length > 0 ? `\nsecret: ${secrets.join(' ')}` : ''}
340
+ created: ${new Date().toISOString().slice(0, 10)}${after != null ? `\nafter: ${after}` : ''}
341
+ blocks: ${opts?.blocks ?? '-'}${check != null ? `\ncheck: ${check}` : ''}${secrets.length > 0 ? `\nsecret: ${secrets.join(' ')}` : ''}${logins.length > 0 ? `\nlogin: ${logins.join(' ')}` : ''}
217
342
  ---
218
343
 
219
344
  # ${title}
220
345
 
221
- ${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? credentialBody(secrets) : STEPS_BODY}
346
+ ${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? credentialBody(secrets, opts?.readers, logins) : STEPS_BODY}
222
347
  **Answer**: _(fill in / check off, or just do it — the check probe auto-closes when it passes)_
223
348
 
224
349
  **Done when**: ${doneWhen}
@@ -226,6 +351,30 @@ ${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? cr
226
351
  return file
227
352
  }
228
353
 
354
+ /** the ask the owner declined that a new one repeats: the same slug, or a secret it stores; null when none. One he
355
+ * reopened by hand is no longer declined, wherever its file still sits */
356
+ function declinedLike(dir: string, slug: string, secrets: readonly string[]): { ask: Ask; rel: string; why: string } | null {
357
+ for (const { ask: a, rel } of declinedNow(dir)) {
358
+ if (a.file.replace(/^\d+-/, '').replace(/\.md$/, '') === slug) return { ask: a, rel, why: 'this ask' }
359
+ const name = secrets.find((s) => a.stores.includes(s))
360
+ if (name != null) return { ask: a, rel, why: `the ask for ${name}` }
361
+ }
362
+ return null
363
+ }
364
+
365
+ /** the owner's word that he will not do an open ask: `status: declined`, the day, his reason as a line, then the
366
+ * declined/ archive. Undone by setting its status back to open: the next archive pass moves it up */
367
+ export function declineAsk(dir: string, file: string, why?: string): void {
368
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*\.md$/.test(file)) throw new Error('bad path')
369
+ const p = join(dir, file)
370
+ if (!existsSync(p) || isClosed(askOf(readFileSync(p, 'utf8'), file).status)) throw new Error(`no open ask ${file}`)
371
+ const reason = why?.replace(/\s+/g, ' ').trim() ?? ''
372
+ const md = withKeys(readFileSync(p, 'utf8'), closedKeys('declined')).trimEnd()
373
+ atomicWrite(p, `${md}\n\n**Declined** by the owner on ${today()}${reason !== '' ? `: ${reason}` : ''}\n`)
374
+ mkdirSync(join(dir, 'declined'), { recursive: true })
375
+ renameSync(p, join(dir, 'declined', file))
376
+ }
377
+
229
378
  /** flip an ask to done and archive it (the hub's "done" verb) */
230
379
  export function archiveAsk(dir: string, file: string): void {
231
380
  const p = join(dir, file)
@@ -257,10 +406,19 @@ export function markPinged(dir: string, file: string): boolean {
257
406
  return true
258
407
  }
259
408
 
260
- export function renderAsksTable(dir: string, print: (line: string) => void = console.log, opts?: { emptyText?: string }): number {
261
- const open = openAsks(dir)
262
- if (open.length === 0) { print(opts?.emptyText ?? 'no open asks — all caught up 🎉'); return 0 }
263
- for (const a of open) print(`${a.status.padEnd(9)} ${a.kind.padEnd(7)} ${a.file.padEnd(44)} blocks: ${a.blocks}`)
264
- print(`\n${open.length} open — details: ${dir}/<file>`)
409
+ /** the open asks, then the later ones under `later` with their day; returns the open count, the later ones out of it */
410
+ export function renderAsksTable(dir: string, print: (line: string) => void = console.log, opts?: { emptyText?: string; now?: number }): number {
411
+ const all = openAsks(dir)
412
+ const now = opts?.now ?? Date.now()
413
+ const open = all.filter((a) => !isLater(a, now))
414
+ const later = all.filter((a) => isLater(a, now)).sort((a, b) => a.afterAt! - b.afterAt!)
415
+ const row = (a: Ask): string => `${a.status.padEnd(9)} ${a.kind.padEnd(7)} ${a.file.padEnd(44)} blocks: ${a.blocks}`
416
+ if (open.length === 0) print(opts?.emptyText ?? 'no open asks — all caught up 🎉')
417
+ for (const a of open) print(row(a))
418
+ if (later.length > 0) {
419
+ print('\nlater')
420
+ for (const a of later) print(`${row(a)} ${afterWords(a.after!)}`)
421
+ }
422
+ if (open.length > 0 || later.length > 0) print(`\n${open.length} open${later.length > 0 ? `, ${later.length} later` : ''} — details: ${dir}/<file>`)
265
423
  return open.length
266
424
  }
@@ -36,13 +36,17 @@ export type GeminiGen = { backend: 'gemini'; model?: 'flash' | 'pro' }
36
36
  export type GeneratorSpec = ComfyGen | CanvasGen | ManualGen | GeminiGen
37
37
  export const comfy = (p?: { workflow?: string; vars?: Record<string, unknown> }): ComfyGen => ({ backend: 'comfy', workflow: p?.workflow, vars: p?.vars })
38
38
  export const canvas = (draw: CanvasGen['draw']): CanvasGen => ({ backend: 'canvas', draw })
39
+ /** a picture file as a canvas kind (a png or a jpg the project already has: its app icon), fitted and centred in the
40
+ * target, never stretched. `image(new URL('./icon.png', import.meta.url))` resolves beside the kit file */
41
+ export const image = (file: URL | string): CanvasGen => fitted(file, 'image')
39
42
  /** a hand-drawn svg file as a canvas kind: vector, fitted and centred in the target, never stretched.
40
43
  * `svg(new URL('./icon.svg', import.meta.url))` resolves beside the kit file, never against the cwd */
41
- export const svg = (file: URL | string): CanvasGen => {
44
+ export const svg = (file: URL | string): CanvasGen => fitted(file, 'svg')
45
+ function fitted(file: URL | string, what: 'svg' | 'image'): CanvasGen {
42
46
  const path = file instanceof URL ? fileURLToPath(file) : file
43
- if (!isAbsolute(path)) throw new Error(`svg('${path}'): give an absolute path or new URL('./<file>.svg', import.meta.url)`)
47
+ if (!isAbsolute(path)) throw new Error(`${what}('${path}'): give an absolute path or new URL('./<file>', import.meta.url)`)
44
48
  return canvas(async (ctx) => {
45
- if (!existsSync(path)) throw new Error(`svg mark: ${path} not found`)
49
+ if (!existsSync(path)) throw new Error(`${what} mark: ${path} not found`)
46
50
  const { loadImage } = await import('@napi-rs/canvas')
47
51
  const c = ctx as SKRSContext2D
48
52
  const img = await loadImage(path)