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
@@ -0,0 +1,154 @@
1
+ // `/vault`: the vault of this machine. A narrow bar of four entries on the left (a phone: one row of tabs on top), the
2
+ // entry picked alone on the right: passwords (every secret name with where it is held, who reads it and since when,
3
+ // filtered, the list's notes above it), about (where it lives, its keys and tokens), health (how it stands), backups
4
+ // (its copies). An entry holding a fact to look at shows a dot in that tone; a DANGER also stays on top whatever entry
5
+ // is open, with a link to the entry that holds it.
6
+ //
7
+ // The constraint a reader breaks first: every word comes from the answer, in the console's words (sk vault status),
8
+ // and the page only reads: no store, delete, seal or snapshot from here. Colour is state only
9
+ import { ReaderChips } from './reader-chips.tsx'
10
+ import { observer } from 'mobx-react-lite'
11
+ import type { MouseEvent, ReactNode } from 'react'
12
+ import { countWords, heldWords, writtenShort, writtenWords, type Fact, type SecretRow } from '../../home/vault-words.ts'
13
+ import { EntryBar, EntryCols } from './entry-bar.tsx'
14
+ import { hashFor } from './hash-route.ts'
15
+ import { plainClick, repoPage, type HomeSt } from './home-st.ts'
16
+ import { type Col, Hint, Table } from './time-charts.tsx'
17
+ import { entryMark, factsOf, VAULT_ENTRIES, type VaultEntry, type VaultSt } from './vault-st.ts'
18
+
19
+ const clock = (at: number): string => new Date(at).toTimeString().slice(0, 5)
20
+
21
+ const processHref = (repo: string, id: string): string => `${repoPage(repo)}#${hashFor({ t: 'processes', id })}`
22
+ /** an ask by its repo and number, its title on hover */
23
+ const askWords = (a: { repo: string; file: string }): string => `${a.repo} ask ${/^(\d+)-/.exec(a.file)?.[1] ?? a.file}`
24
+ const askHref = (repo: string, file: string): string => `${repoPage(repo)}#${hashFor({ t: 'item', col: 'asks', id: `ask:${file}` })}`
25
+
26
+ /** a link that moves the home in place on a plain click, the browser's own way otherwise */
27
+ const In = ({ href, go, children }: { href: string; go: () => void; children: string }) => (
28
+ <a className="vtlink" href={href} onClick={(e: MouseEvent) => { if (!plainClick(e)) return; e.preventDefault(); go() }}>{children}</a>
29
+ )
30
+
31
+ /** one fact, its dot in its tone, a DANGER said; the vault page and the Space page */
32
+ export const FactRow = observer(({ app, f, more }: { app: HomeSt; f: Fact; more?: ReactNode }) => (
33
+ <li className={`vtfact vt-${f.tone}`}>
34
+ <i className={`mcdot vtd-${f.tone}`} />
35
+ <span>
36
+ {f.tone === 'danger' ? <b>DANGER </b> : null}
37
+ {f.text}
38
+ {f.process == null ? null : <> · <In href={processHref(f.process.repo, f.process.id)} go={() => app.openProcess(f.process!.repo, f.process!.id)}>its process ↗</In></>}
39
+ {more}
40
+ </span>
41
+ </li>
42
+ ))
43
+
44
+ /** what each entry of the bar holds, said under its name on the right */
45
+ const ABOUT: Record<VaultEntry, string> = {
46
+ passwords: 'every secret name: where it is held, who reads it, since when',
47
+ about: 'where it lives on this Mac, what keeps it up, its keys and tokens',
48
+ health: 'how it stands now',
49
+ backups: 'its sealed snapshots, their proofs, the prune',
50
+ }
51
+
52
+ /** each DANGER of the page, on top whatever entry is open, with a link to the entry that holds it */
53
+ const Dangers = observer(({ app, st }: { app: HomeSt; st: VaultSt }) => {
54
+ const all = st.dangers
55
+ if (all.length === 0) return null
56
+ return (
57
+ <ul className="vtfacts vtfirst" aria-label="what is in danger">
58
+ {all.map(({ f, entry }) => <FactRow key={f.text} app={app} f={f} more={st.entry === entry ? null : <> · <In href={`/vault#${entry}`} go={() => st.open(entry)}>{`open ${entry}`}</In></>} />)}
59
+ </ul>
60
+ )
61
+ })
62
+
63
+ /** about, health or backups: its facts, one line each; its DANGERs are the lines on top */
64
+ const Facts = observer(({ app, st, e }: { app: HomeSt; st: VaultSt; e: VaultEntry }) => (
65
+ <section className="vtsecrets" aria-label={e}>
66
+ <div className="vthead"><b>{e}</b><span className="mcdim">{ABOUT[e]}</span></div>
67
+ <ul className="vtfacts">{factsOf(st.data!, e).filter((f) => f.tone !== 'danger').map((f) => <FactRow key={f.text} app={app} f={f} />)}</ul>
68
+ </section>
69
+ ))
70
+
71
+ const HEAD: Col[] = [
72
+ { label: 'name' },
73
+ { label: 'held', title: 'in the vault, only in this Mac\'s keychain (a read gets that copy, maybe stale), or missing' },
74
+ { label: 'written', title: 'how long ago its current version was written, the vault\'s own record; the day on hover' },
75
+ { label: 'who reads it', title: 'its registry row\'s scope: every repo, or the repos, identities and machines it names' },
76
+ { label: 'ask', title: 'the open ask that waits for its value' },
77
+ { label: 'for', title: 'what it is for, as its registry row says', more: true },
78
+ ]
79
+
80
+ const NameCell = ({ r }: { r: SecretRow }) => (
81
+ <span className="vtname">
82
+ <span className="mcsha">{r.name}</span>
83
+ {r.registered ? null : <Hint className="vttag" tip="no row in the registry (wiki services/secrets/registry.md): every repo reads it, and the vault files it where it was put">no row</Hint>}
84
+ {r.note == null ? null : <Hint className="vttag t-warn" tip={r.note}>note</Hint>}
85
+ </span>
86
+ )
87
+
88
+ const Secrets = observer(({ app, st }: { app: HomeSt; st: VaultSt }) => {
89
+ const d = st.data!
90
+ const f = st.filter
91
+ const sc = st.scopes
92
+ const notes = d.notes.filter((n) => n.tone !== 'danger')
93
+ const rows = st.rows.map((r) => {
94
+ const h = heldWords(r, d.here, d.at)
95
+ return {
96
+ key: r.name,
97
+ cells: [
98
+ <NameCell r={r} />,
99
+ <span className={`vth vt-${h.tone}`}>{h.text}</span>,
100
+ <span title={writtenWords(r, d.at)}>{writtenShort(r, d.at)}</span>,
101
+ r.chips == null || r.chips.length === 0 ? r.who : <ReaderChips who={{ long: r.who, chips: r.chips }} lead="who reads it" />,
102
+ r.ask == null ? '' : <Hint tip={r.ask.title}><In href={askHref(r.ask.repo, r.ask.file)} go={() => app.openItem(r.ask!.repo, 'asks', `ask:${r.ask!.file}`)}>{askWords(r.ask)}</In></Hint>,
103
+ r.for,
104
+ ],
105
+ }
106
+ })
107
+ return (
108
+ <section className="vtsecrets" aria-label="the secrets">
109
+ <div className="vthead"><b>the secrets</b><span className="mcdim">{countWords(d.secrets, d.here)}</span></div>
110
+ <div className="vtbar">
111
+ <input className="inquery" type="search" placeholder="filter: a name, a use, a reader…" aria-label="filter the names" value={f.text} onChange={(e) => st.set({ text: e.currentTarget.value })} />
112
+ <div className="seg" role="group" aria-label="which names">
113
+ <button type="button" aria-pressed={!f.missing} className={!f.missing ? 'on' : ''} onClick={() => st.set({ missing: false })}>every name</button>
114
+ <button type="button" aria-pressed={f.missing} className={f.missing ? 'on' : ''} onClick={() => st.set({ missing: true })}>missing</button>
115
+ </div>
116
+ <select className="tvpick" aria-label="one repo" value={f.repo} onChange={(e) => st.set({ repo: e.currentTarget.value })}>
117
+ <option value="">every repo</option>
118
+ {sc.repos.map((r) => <option key={r} value={r}>{r}</option>)}
119
+ </select>
120
+ <select className="tvpick" aria-label="one identity" value={f.identity} onChange={(e) => st.set({ identity: e.currentTarget.value })}>
121
+ <option value="">every identity</option>
122
+ {sc.identities.map((i) => <option key={i} value={i}>{i}</option>)}
123
+ </select>
124
+ {st.filtered ? <span className="mcdim">{rows.length} of {d.secrets.length}</span> : null}
125
+ </div>
126
+ {/* what makes the list say less than it would, said above it: the reason of a « not read », the record's age */}
127
+ {notes.length === 0 ? null : <ul className="vtfacts vtloud">{notes.map((n) => <FactRow key={n.text} app={app} f={n} />)}</ul>}
128
+ <div className="vttable"><Table head={HEAD} rows={rows} empty={st.filtered ? 'no name matches this filter' : 'no name is known on this machine'} /></div>
129
+ </section>
130
+ )
131
+ })
132
+
133
+ export const VaultView = observer(({ app }: { app: HomeSt }) => {
134
+ const st = app.vault
135
+ const d = st.data
136
+ const narrow = app.layout.narrow
137
+ return (
138
+ <div className="vaultpage">
139
+ <div className="actop vttop">
140
+ <button type="button" className="acpill" disabled={st.loading} onClick={() => void st.poll(true)}>
141
+ <Hint tip="read the vault again now · by itself it reads every 5 minutes, each call a line of its audit file" className={`acring${st.loading ? ' on' : ''}`}>↻</Hint>
142
+ </button>
143
+ <span className="acdim">{d == null ? (st.error !== '' ? '' : 'reading the vault…') : `${d.machine} · read at ${clock(d.at)} · a page to read, nothing is changed from here · in the console: sk vault status (--secrets for the names)`}</span>
144
+ </div>
145
+ {st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
146
+ {d == null ? null : (
147
+ <EntryCols narrow={narrow} bar={<EntryBar label="the vault's entries" entries={VAULT_ENTRIES} current={st.entry} open={(e) => st.open(e as VaultEntry)} mark={(e) => entryMark(factsOf(d, e as VaultEntry))} tabs={narrow} />}>
148
+ <Dangers app={app} st={st} />
149
+ {st.entry === 'passwords' ? <Secrets app={app} st={st} /> : <Facts app={app} st={st} e={st.entry} />}
150
+ </EntryCols>
151
+ )}
152
+ </div>
153
+ )
154
+ })
@@ -0,0 +1,38 @@
1
+ /* the vault page (vault-view.tsx): a bar of four entries (entry-bar.css), the entry picked alone beside it. One line facts with a dot for
2
+ their state; colour is state only: green held, orange to look at, red broken. */
3
+ .vaultpage{display:flex;flex-direction:column;flex:1;min-height:0;font-size:13px}
4
+ .vttop{padding:var(--s2) var(--s4);margin-bottom:0;border-bottom:1px solid var(--line)}
5
+
6
+ .vtfirst{margin:var(--s3) var(--s4) 0;padding:var(--s2) var(--s3);border:1px solid var(--red);border-radius:6px;background:color-mix(in srgb,var(--red) 8%,var(--panel))}
7
+ .vtfacts{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:var(--s1);font-size:12.5px}
8
+ .vtfact{display:flex;align-items:baseline;gap:var(--s2);line-height:1.4;overflow-wrap:anywhere}
9
+ .vtfact .mcdot{transform:translateY(-1px)}
10
+ .vtfact .vtd-ok{background:var(--ok)}
11
+ .vtfact .vtd-warn{background:var(--warn)}
12
+ .vtfact .vtd-danger{background:var(--red)}
13
+ .vtfact .vtd-dim{background:var(--line)}
14
+ .vt-dim{color:var(--dim)}
15
+ .vt-warn{color:var(--warn)}
16
+ .vt-danger{color:var(--red)}
17
+ .vt-danger b{font-weight:700}
18
+ .vtlink{color:var(--accent);text-decoration:none;white-space:nowrap}
19
+ .vtlink:hover{text-decoration:underline}
20
+
21
+ /* an entry: its name, what it holds, its lines; the names: their count, a bar of filters, then one row a name */
22
+ .vtsecrets{padding:var(--s3) var(--s4)}
23
+ .vthead{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 var(--s3);margin-bottom:var(--s2)}
24
+ .vthead b{font-size:15px;font-weight:650}
25
+ .vtbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s2) var(--s3);margin-bottom:var(--s2)}
26
+ .vtloud{margin-bottom:var(--s2)}
27
+ .vttable{overflow-x:auto}
28
+ .vttable .tvtable td{vertical-align:baseline}.vttable .stchips{margin-left:0}
29
+ /* what a name is for takes the width that is left and cuts with an ellipsis, so the table never passes its area */
30
+ .vttable .tvtable td.tvmore{width:100%;max-width:0}
31
+ .vtname{display:inline-flex;align-items:baseline;gap:var(--s2);white-space:nowrap}
32
+ .vttag{padding:0 var(--s2);border:1px solid var(--line);border-radius:999px;color:var(--dim);font-size:11px;line-height:16px}
33
+ .vth{white-space:nowrap}
34
+ .vth.vt-ok{color:var(--ok)}
35
+
36
+ /* a phone: the bar is a row of tabs on top (entry-bar.css), the entry under it */
37
+ .entnarrow .vtfirst{margin:var(--s3) var(--s3) 0}
38
+ .entnarrow .vtsecrets{padding:var(--s3)}
@@ -3,6 +3,7 @@
3
3
  // read again when its stamp moves (the log, a mark, a draft, an ask), every 2 s while the page shows
4
4
  import { makeAutoObservable, runInAction } from 'mobx'
5
5
  import { COLUMNS, type FeedRow, type Platform, replyUrl, type VeilleFeed, type VeillePost } from '../../../veille/platforms.ts'
6
+ import { sideOf, stepSide, type SideList } from '../list-walk.ts'
6
7
  import { reach } from '../reach.ts'
7
8
  import type { RepoSt } from '../repo-st.ts'
8
9
  import { copyText, postJson } from '../review/review-kit.ts'
@@ -297,14 +298,15 @@ export class VeilleSt {
297
298
  this.sync()
298
299
  }
299
300
 
301
+ /** the list its keys walk (list-walk.ts): the picked post's column, else the first with a post; ← → step columns */
302
+ get side(): SideList {
303
+ const col = (): VeilleFeed['columns'][number] | undefined => this.columns.find((c) => this.shown(c).some((r) => r.key === this.picked)) ?? this.columns.find((c) => this.shown(c).length > 0)
304
+ return sideOf({ ids: () => { const c = col(); return c == null ? [] : this.shown(c).map((r) => r.key) }, current: () => this.picked, open: (key) => this.pick(key) })
305
+ }
306
+
300
307
  /** up and down in the picked post's column */
301
- move(delta: number): void {
302
- const col = this.columns.find((c) => this.shown(c).some((r) => r.key === this.picked)) ?? this.columns.find((c) => this.shown(c).length > 0)
303
- if (col == null) return
304
- const rows = this.shown(col)
305
- const i = rows.findIndex((r) => r.key === this.picked)
306
- const next = rows[i < 0 ? 0 : Math.max(0, Math.min(rows.length - 1, i + delta))]
307
- if (next) this.pick(next.key)
308
+ move(delta: -1 | 1): void {
309
+ stepSide(this.side, delta)
308
310
  }
309
311
 
310
312
  /** left and right: the best post of the next column that has one */
@@ -421,7 +423,7 @@ export class VeilleSt {
421
423
  setTimeout(() => runInAction(() => (this.toast = this.toast === text ? null : this.toast)), 2500)
422
424
  }
423
425
 
424
- /** the page's keys: j k or up and down, h l or left and right, p r t; the lightbox's arrows and Escape */
426
+ /** the page's keys: j k (↑ ↓ are the hub's, side-lists.ts), h l or left and right, p r t; the lightbox's arrows and Escape */
425
427
  key(e: Pick<KeyboardEvent, 'key'>): boolean {
426
428
  if (this.lightbox != null) {
427
429
  const n = this.post?.media.length ?? 0
@@ -430,8 +432,8 @@ export class VeilleSt {
430
432
  else return false
431
433
  return true
432
434
  }
433
- if (e.key === 'j' || e.key === 'ArrowDown') this.move(1)
434
- else if (e.key === 'k' || e.key === 'ArrowUp') this.move(-1)
435
+ if (e.key === 'j') this.move(1)
436
+ else if (e.key === 'k') this.move(-1)
435
437
  else if (e.key === 'l' || e.key === 'ArrowRight') this.stepColumn(1)
436
438
  else if (e.key === 'h' || e.key === 'ArrowLeft') this.stepColumn(-1)
437
439
  else if (e.key === 'p') void this.propose()
@@ -0,0 +1,29 @@
1
+ // everything that waits for the owner in every repo (asks, cards), for the picker: read when it opens, the three
2
+ // lists of the inbox whole, since a jump reaches an item the inbox page has folded away too. A node of the home
3
+ import { makeAutoObservable, runInAction } from 'mobx'
4
+ import type { InboxAnswer, InboxList, InboxRow } from '../../home/inbox-shape.ts'
5
+
6
+ const LISTS: InboxList[] = ['main', 'yellow', 'later']
7
+
8
+ export class HouseWaitingSvc {
9
+ rows: InboxRow[] = []
10
+
11
+ constructor() {
12
+ makeAutoObservable(this)
13
+ }
14
+
15
+ /** a list that does not answer keeps its last rows out: the picker shows what it could read */
16
+ async load(): Promise<void> {
17
+ const pages = await Promise.all(
18
+ LISTS.map(async (l) => {
19
+ try {
20
+ const r = await fetch(`/api/inbox?show=all&list=${l}&limit=500`)
21
+ return r.ok ? ((await r.json()) as InboxAnswer).rows : []
22
+ } catch {
23
+ return []
24
+ }
25
+ }),
26
+ )
27
+ runInAction(() => (this.rows = pages.flat()))
28
+ }
29
+ }
@@ -72,7 +72,7 @@ export const WikisView = observer(({ app, id }: { app: RepoSt; id: string }) =>
72
72
  const WikiBody = observer(({ app, w, href, title }: { app: RepoSt; w: WikiSt; href: string; title: string }) => {
73
73
  const el = useRef<HTMLDivElement | null>(null)
74
74
  const frame = useRef<HTMLIFrameElement | null>(null)
75
- const theme = app.home.theme.resolved
75
+ const theme = app.home.theme.scheme
76
76
  // the theme the graph first paints in rides its url; a later change is a message, never a reload
77
77
  const first = useRef(theme)
78
78
  useEffect(() => w.send({ type: 'wiki-graph:theme', theme }), [w, theme])
@@ -92,7 +92,7 @@ const WikiBody = observer(({ app, w, href, title }: { app: RepoSt; w: WikiSt; hr
92
92
  <iframe ref={(f) => { frame.current = f; w.setFrame(f?.contentWindow ?? null) }} src={`${app.url(href)}${sep}theme=${first.current}`} title={title}
93
93
  onLoad={() => {
94
94
  w.setFrame(frame.current?.contentWindow ?? null)
95
- w.send({ type: 'wiki-graph:theme', theme: app.home.theme.resolved })
95
+ w.send({ type: 'wiki-graph:theme', theme: app.home.theme.scheme })
96
96
  if (w.page != null) w.send({ type: 'wiki-graph:focus', id: w.page.id })
97
97
  }} />
98
98
  </div>
@@ -62,6 +62,17 @@ import type { projectGutter } from './project-gutter-route.ts'
62
62
  import { defaultHubPort } from './hub-port.ts'
63
63
  import { LAYOUT } from '../core/layout.ts'
64
64
  import { storeDir, storeStamp } from '../review/store.ts'
65
+ import { isStoreRefused } from '../core/machine-db.ts'
66
+
67
+ /** the review store's stamp, or a word that it is refused now (a walk of the daemon's file): read again at the next ask */
68
+ function storeStampOr(dir: string): string {
69
+ try {
70
+ return storeStamp(dir)
71
+ } catch (e) {
72
+ if (isStoreRefused(e)) return 'refused'
73
+ throw e
74
+ }
75
+ }
65
76
  import { machinePublicHost } from '../home/machine-host.ts'
66
77
  export { defaultHubPort }
67
78
 
@@ -360,7 +371,7 @@ export async function resolveHubDeps(root: string, boot: RepoConfig, io: ServeIo
360
371
  // the config, the run record and the review store (gitignored, its
361
372
  // own watch counts its writes): what the warm rows and the runs page
362
373
  // read besides the tracked files the watch sees
363
- stamp: () => `${configStamp(root)}|${record === '' ? '' : recordStamp(record)}|${storeStamp(storeDir(root))}`,
374
+ stamp: () => `${configStamp(root)}|${record === '' ? '' : recordStamp(record)}|${storeStampOr(storeDir(root))}`,
364
375
  runCli,
365
376
  // the run happens IN THIS PROCESS, so every check result reaches the
366
377
  // page as it finishes. A shelled run could only ever deliver one wall
@@ -540,7 +551,9 @@ export async function loadHub(root: string, io: ServeIo, o: LoadHubOpts): Promis
540
551
  live.push({ stop: () => watcher.close() }, { stop: () => o.plan.remove(name) }, { stop: () => { if (settle != null) clearTimeout(settle) } })
541
552
  // the answers a page waits on, computed now, one hub at a time
542
553
  // across the process, so a first visit reads them from memory
543
- warming = warming.then(() => loopWatch.spanned(`hub warm: ${name}`, () => handler.warm()))
554
+ // a warm that throws (a store refused while a walk of the daemon's file runs) is said, never the process's end:
555
+ // the page computes those answers when it asks
556
+ warming = warming.then(() => loopWatch.spanned(`hub warm: ${name}`, () => handler.warm())).catch((e: unknown) => io.printErr(`WARN the hub of ${name} did not warm: ${(e as Error).message}`))
544
557
  if (o.ownTimers) {
545
558
  // one tick now (the state file guarantees a restart never re-fires), then every minute
546
559
  void ping()
@@ -8,7 +8,7 @@
8
8
  // draws the app icon (core/app-icon.ts) for the admin page's preview, and POST
9
9
  // /api/projects/open opens a discovered repo in VS Code, POST
10
10
  // /api/projects/fork in Fork: a request names a repo, never a path. The rail ORDER is one text file for the whole machine
11
- // (ORDER_FILE), so every hub shows the same order and a hand edit is seen
11
+ // (orderFile), so every hub shows the same order and a hand edit is seen
12
12
  // within one poll; POST /api/projects/order writes it.
13
13
  import { loopWatch } from '../core/loop-watch.ts'
14
14
  import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'fs'
@@ -28,20 +28,26 @@ import { waitingCards } from '../collections/review.ts'
28
28
  import { voicesWaiting } from '../review/trailer-voices.ts'
29
29
  import { storeDir, warmStore } from '../review/store.ts'
30
30
  import { writeArchived } from '../core/archived.ts'
31
+ import { machinePath } from '../core/machine-layout.ts'
31
32
  import { identitiesDir, pictureVersion } from '../identities/identities.ts'
32
33
  import { identityCache, markFile, railOf, speakerIdOf, type RailIdentity } from '../identities/machine.ts'
33
34
  import { speaksAsOfText } from '../social/house.ts'
35
+ import { isStoreRefused } from '../core/machine-db.ts'
34
36
 
35
37
  export type { Gate }
36
38
 
37
39
  export const POLL_MS = 5_000
38
40
 
39
41
  /** a repo's waiting cards as its row carries them; a store that cannot be read waits on nobody, and its hub says why */
42
+ /** each repo's waiting cards as last read: a store refused a while (a walk of the daemon's file) keeps them */
43
+ const lastCards = new Map<string, ProjectRow['cards']>()
40
44
  function cardsOf(path: string): ProjectRow['cards'] {
41
45
  try {
42
- return waitingCards(path).threads.map((t) => ({ id: t.head.item.id, title: t.head.item.title }))
46
+ const cards = waitingCards(path).threads.map((t) => ({ id: t.head.item.id, title: t.head.item.title }))
47
+ lastCards.set(path, cards)
48
+ return cards
43
49
  } catch {
44
- return []
50
+ return lastCards.get(path) ?? []
45
51
  }
46
52
  }
47
53
  /** the app icon preview: sharp on a 2x screen at the admin page's 128px */
@@ -57,7 +63,8 @@ export const RELEASE_TTL_MS = 60_000
57
63
  * polls instead of spending half a second on the first one */
58
64
  export const RELEASE_ASKS_PER_POLL = 6
59
65
  /** the rail order, under the user's home: one repo name per line */
60
- export const ORDER_FILE = '.config/shipkit/projects-order.txt'
66
+ /** the rail order file, `~/.shipkit/projects-order.txt` (layout.ts machinePath) */
67
+ export const orderFile = (userHome: string = homedir()): string => machinePath('projects-order.txt', userHome)
61
68
 
62
69
  /** the last release tag, the commits since it and when it was cut (epoch
63
70
  * ms), `never` when no tag has a release shape, null when git cannot say */
@@ -130,7 +137,7 @@ export type GutterDeps = {
130
137
  fork?: (path: string) => void
131
138
  warn?: (line: string) => void
132
139
  now?: () => number
133
- /** where the rail order lives, default ~/ORDER_FILE */
140
+ /** where the rail order lives, default orderFile(home) */
134
141
  orderFile?: string
135
142
  /** the Claude Code `projects` folders, default the `projects` folder of every ~/.claude config root */
136
143
  transcriptRoots?: string[]
@@ -197,10 +204,10 @@ const readText = (file: string): string => {
197
204
  /** the house repos in the rail's order, archived ones left out: the rows of
198
205
  * the project list without the facts the list measures, for a caller that
199
206
  * needs only names and paths (`shipkit cross-repo-activity`) */
200
- export function railRepos(root: string, userHome: string = homedir(), orderFile: string = join(userHome, ORDER_FILE)): WiredRepo[] {
207
+ export function railRepos(root: string, userHome: string = homedir(), order: string = orderFile(userHome)): WiredRepo[] {
201
208
  const repos = houseRepos(root, userHome).repos
202
209
  const by = new Map(repos.map((r) => [r.name, r]))
203
- return mergeOrder(parseOrder(readText(orderFile)), repos.map((r) => r.name)).map((n) => by.get(n)!)
210
+ return mergeOrder(parseOrder(readText(order)), repos.map((r) => r.name)).map((n) => by.get(n)!)
204
211
  }
205
212
 
206
213
  export function projectGutter(d: GutterDeps) {
@@ -238,7 +245,7 @@ export function projectGutter(d: GutterDeps) {
238
245
  const checks = checkStateOf(hit.rows, d.declared?.(r.name) ?? null)
239
246
  return { gate: gateFrom(checks), checks }
240
247
  }
241
- const orderFile = d.orderFile ?? join(userHome, ORDER_FILE)
248
+ const orderAt = d.orderFile ?? orderFile(userHome)
242
249
  const transcriptRoots = (): string[] => {
243
250
  if (d.transcriptRoots != null) return d.transcriptRoots
244
251
  try {
@@ -358,7 +365,13 @@ export function projectGutter(d: GutterDeps) {
358
365
  const counts = cwds == null ? null : countSessions(cwds, repos.map((r) => r.path))
359
366
  const ids = await loopWatch.spanned('projects: ids', readIds)
360
367
  // each store read whole once, in steps, before the rows read its waiting cards
361
- await loopWatch.spanned('projects: review stores', async () => { for (const r of repos) await warmStore(storeDir(r.path)) })
368
+ // a store refused while a walk of the daemon's file runs is read at the next measure: never this answer's failure
369
+ await loopWatch.spanned('projects: review stores', async () => {
370
+ for (const r of repos)
371
+ await warmStore(storeDir(r.path)).catch((e: unknown) => {
372
+ if (!isStoreRefused(e)) throw e
373
+ })
374
+ })
362
375
  const voices = new Map<string, number>()
363
376
  await loopWatch.spanned('projects: voices', async () => {
364
377
  for (const r of repos) voices.set(r.path, Object.values(await voicesWaiting(r.path).catch(() => ({}))).reduce((a: number, b: number) => a + b, 0))
@@ -398,7 +411,7 @@ export function projectGutter(d: GutterDeps) {
398
411
  }
399
412
  }))
400
413
  const archived = archivedRepos.map((r) => ({ name: r.name, icon: iconUrl(r) }))
401
- return { projects: inOrder(projects, parseOrder(readText(orderFile))), archived, identities: ids.identities.map(railOf), ms: Math.round(performance.now() - t0), at: now() }
414
+ return { projects: inOrder(projects, parseOrder(readText(orderAt))), archived, identities: ids.identities.map(railOf), ms: Math.round(performance.now() - t0), at: now() }
402
415
  }
403
416
 
404
417
  /** the last answer while it is younger than POLL_MS, one measure otherwise,
@@ -421,10 +434,10 @@ export function projectGutter(d: GutterDeps) {
421
434
  * half of it */
422
435
  function saveOrder(names: string[]): string[] {
423
436
  const order = mergeOrder(names, repos.map((r) => r.name))
424
- mkdirSync(dirname(orderFile), { recursive: true })
425
- const tmp = `${orderFile}.tmp-${process.pid}`
437
+ mkdirSync(dirname(orderAt), { recursive: true })
438
+ const tmp = `${orderAt}.tmp-${process.pid}`
426
439
  writeFileSync(tmp, renderOrder(order))
427
- renameSync(tmp, orderFile)
440
+ renameSync(tmp, orderAt)
428
441
  if (last != null) last = { ...last, projects: inOrder(last.projects, order) }
429
442
  return order
430
443
  }
@@ -519,7 +532,7 @@ export function projectGutter(d: GutterDeps) {
519
532
  try {
520
533
  return Response.json({ order: saveOrder(b.names as string[]) })
521
534
  } catch (e) {
522
- return new Response(`the order could not be saved to ${orderFile}: ${(e as Error).message}`, { status: 500 })
535
+ return new Response(`the order could not be saved to ${orderAt}: ${(e as Error).message}`, { status: 500 })
523
536
  }
524
537
  }
525
538
  if (path === '/api/projects/fork' && req.method === 'POST') {
@@ -10,6 +10,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
10
10
  import { basename, dirname, join, resolve, sep } from 'path'
11
11
  import { fileURLToPath } from 'url'
12
12
  import { gitRoot, isLinkedWorktree } from '../core/git-root.ts'
13
+ import { askOf, isClosed, isLater } from '../asks/asks-queue.ts'
13
14
  import { DB_FILE } from '../ledger/db.ts'
14
15
  import { defaultHubPort } from './hub-port.ts'
15
16
  import { LAYOUT } from '../core/layout.ts'
@@ -210,12 +211,20 @@ export function liveUrlOf(configSrc: string): string | null {
210
211
  return u != null && /^https?:\/\//.test(u) ? u : null
211
212
  }
212
213
 
213
- /** an ask file is open until its frontmatter says `status: done` */
214
- export const isOpenAsk = (md: string): boolean => !/^status:\s*done\b/m.test(md)
214
+ /** an ask file is open until its frontmatter says `status: done` or `status: declined`, and counts once its `after:` day
215
+ * came (asks-queue.ts parses it); a file the parser refuses still counts, never hidden */
216
+ export const isOpenAsk = (md: string, now: number = Date.now()): boolean => {
217
+ try {
218
+ const a = askOf(md, '')
219
+ return !isClosed(a.status) && !isLater(a, now)
220
+ } catch {
221
+ return !/^status:\s*(done|declined)\b/m.test(md)
222
+ }
223
+ }
215
224
 
216
225
  /** the open asks in a queue folder: its top level md files, the done/
217
- * archive and every other folder left out. Read only: a missing folder is 0 */
218
- export const openAskCount = (dir: string): number => openAsks(dir).length
226
+ * and declined/ archives and every other folder left out. Read only: a missing folder is 0 */
227
+ export const openAskCount = (dir: string, now?: number): number => openAsks(dir, now).length
219
228
 
220
229
  /** an ask's title: its first heading, else its first line of prose, the
221
230
  * frontmatter skipped */
@@ -229,7 +238,7 @@ export function askTitle(md: string): string | null {
229
238
 
230
239
  /** the titles of the open asks in a queue folder, by file name order, the
231
240
  * file name when an ask has no text */
232
- export function openAsks(dir: string): string[] {
241
+ export function openAsks(dir: string, now: number = Date.now()): string[] {
233
242
  let files: string[]
234
243
  try {
235
244
  files = readdirSync(dir).filter((f) => f.endsWith('.md')).sort()
@@ -240,7 +249,7 @@ export function openAsks(dir: string): string[] {
240
249
  for (const f of files) {
241
250
  try {
242
251
  const md = readFileSync(join(dir, f), 'utf8')
243
- if (isOpenAsk(md)) out.push(askTitle(md) ?? f.replace(/\.md$/, ''))
252
+ if (isOpenAsk(md, now)) out.push(askTitle(md) ?? f.replace(/\.md$/, ''))
244
253
  } catch {
245
254
  // a folder named like an md file, or a file gone mid read
246
255
  }
@@ -303,19 +312,23 @@ export const dirtyCount = (porcelain: string): number => porcelain.split('\n').f
303
312
  export type LastRow = { id: string; status: string; at?: number }
304
313
 
305
314
  /** every check's last outcome in one colour: red when one failed, orange
306
- * when one only warned, green when all passed or skipped, with when each
307
- * red or warning was recorded. Only the ids the repo declares today count
315
+ * when one warned about work an agent can do, green otherwise, with when each
316
+ * red or warning was recorded. A warning that waits on the owner (`hands`:
317
+ * `held` says an ask holds it) is listed and never colours the repo; without
318
+ * `held` every warning is agent work. Only the ids the repo declares today count
308
319
  * (`declared`; null = not known, every row counts), so a renamed or deleted
309
320
  * check never holds a repo red. No row left = unknown */
310
- export type CheckState = { state: 'red' | 'orange' | 'green'; reds: string[]; warns: string[]; since: Record<string, number> } | null
311
- export function checkStateOf(rows: LastRow[], declared: ReadonlySet<string> | null = null): CheckState {
321
+ export type CheckState = { state: 'red' | 'orange' | 'green'; reds: string[]; warns: string[]; hands: string[]; since: Record<string, number> } | null
322
+ export function checkStateOf<R extends LastRow>(rows: R[], declared: ReadonlySet<string> | null = null, held: (r: R) => boolean = () => false): CheckState {
312
323
  const live = declared == null ? rows : rows.filter((r) => declared.has(r.id))
313
324
  if (live.length === 0) return null
314
325
  const reds = live.filter((r) => r.status === 'fail').map((r) => r.id).sort()
315
- const warns = live.filter((r) => r.status === 'warn').map((r) => r.id).sort()
326
+ const warned = live.filter((r) => r.status === 'warn')
327
+ const hands = warned.filter(held).map((r) => r.id).sort()
328
+ const warns = warned.filter((r) => !hands.includes(r.id)).map((r) => r.id).sort()
316
329
  const since: Record<string, number> = {}
317
330
  for (const r of live) if ((r.status === 'fail' || r.status === 'warn') && typeof r.at === 'number') since[r.id] = r.at
318
- return { state: reds.length > 0 ? 'red' : warns.length > 0 ? 'orange' : 'green', reds, warns, since }
331
+ return { state: reds.length > 0 ? 'red' : warns.length > 0 ? 'orange' : 'green', reds, warns, hands, since }
319
332
  }
320
333
 
321
334
  /** the last gate: green, or the checks whose last outcome failed, read off
@@ -11,6 +11,11 @@ export function hostName(host: string): string {
11
11
  /** a name only this machine resolves to itself */
12
12
  export const loopbackName = (n: string): boolean => n === 'localhost' || n.endsWith('.localhost') || n === '::1' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)
13
13
 
14
+ /** whether a request names this server by a loopback name. A server that listens on 127.0.0.1 behind the web is
15
+ * reached by no other name: another Host is a page of another site that points its name at this machine (dns
16
+ * rebinding), which is same origin with itself and passes `sameOrigin` */
17
+ export const loopbackHost = (req: Request): boolean => loopbackName(hostName(req.headers.get('host') ?? new URL(req.url).host))
18
+
14
19
  /** where a request came from: this machine, or another one over the tailnet (his phone) */
15
20
  export type Reach = 'local' | 'tailnet'
16
21
  /** the web's tag on what it forwards to the daemon, which never sees the browser's Host */
@@ -18,6 +23,11 @@ export const REACH_HEADER = 'x-shipkit-reach'
18
23
 
19
24
  export const reachOfHost = (host: string | null): Reach => (host != null && host !== '' && loopbackName(hostName(host)) ? 'local' : 'tailnet')
20
25
 
26
+ /** where a request to the web came from. The home is handed to the tailnet by `tailscale serve`, which passes the
27
+ * caller's Host as it is: a device there can name the web `localhost`. But it always writes x-forwarded-for with
28
+ * the caller's address, and a request of this machine carries none, so that header decides before the name */
29
+ export const reachOfCaller = (req: Request): Reach => (req.headers.has('x-forwarded-for') ? 'tailnet' : reachOfHost(req.headers.get('host') ?? new URL(req.url).host))
30
+
21
31
  /** the web's tag when it forwarded the request, else this server's own Host */
22
32
  export function reachOf(req: Request): Reach {
23
33
  const tag = req.headers.get(REACH_HEADER)
@@ -11,7 +11,8 @@ import { pageOf, searchWiki } from 'rvlib-shipkit/src/wiki/graph-pages.ts'
11
11
  import { graphRoutes } from 'rvlib-shipkit/src/wiki/serve-graph.ts'
12
12
  import type { StudioRoutes } from '../assets/server/studio-server.ts'
13
13
  import { comfyBoxUp, type ComfyBox, type ComfyPanelUp } from '../comfy/comfy-panel.ts'
14
- import { appendAskRemark, appendAssetNote, askDone, askProof, askSecret } from '../collections/actions.ts'
14
+ import { appendAskRemark, appendAssetNote, askDecline, askDone, askProof, askSecret } from '../collections/actions.ts'
15
+ import type { HeldOf } from '../secrets/held.ts'
15
16
  import { managerStore, type SecretStore } from '../secrets/manager.ts'
16
17
  import { brokenRow, projectResources, type Collection, type Instance, type NeedItem, type Resource } from '../collections/collection-types.ts'
17
18
  import type { CheckEvent } from '../core/run-check.ts'
@@ -46,6 +47,7 @@ import { noCli } from '../commands/registry.ts'
46
47
  import { socialRoutes } from '../social/routes.ts'
47
48
  import { embedRoute } from './embed.ts'
48
49
  import { pagesRoutes } from '../pages/routes.ts'
50
+ import { urlsRoutes } from '../urls/routes.ts'
49
51
 
50
52
  export { sameOrigin }
51
53
 
@@ -121,6 +123,8 @@ export type HubDeps = {
121
123
  /** where a value pasted under a credential ask goes; absent = the repo's
122
124
  * `credsCommand`, as `sk secret set` runs it */
123
125
  storeSecret?: SecretStore
126
+ /** the store's read of a credential ask's names (collections/providers.ts heldOfAsks), a test passes its own */
127
+ secretHeld?: HeldOf
124
128
  /** the comfy panel; null when the repo declares no workflow module, which
125
129
  * is also when the comfy section is absent from the page */
126
130
  comfy: ComfyDeps | null
@@ -298,9 +302,11 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
298
302
  try {
299
303
  if (path === '/api/act/ask-secret') {
300
304
  const value = typeof b.value === 'string' ? b.value : ''
301
- return Response.json(await askSecret({ root: d.root, asksDir: d.asksDir, file: b.file ?? '', name: b.name ?? '', value, store: d.storeSecret ?? managerStore(d.root) }))
305
+ const account = typeof b.account === 'string' ? b.account : undefined
306
+ return Response.json(await askSecret({ root: d.root, asksDir: d.asksDir, file: b.file ?? '', name: b.name ?? '', value, account, store: d.storeSecret ?? managerStore(d.root), held: d.secretHeld }))
302
307
  }
303
308
  if (path === '/api/act/ask-done') askDone(d.root, d.asksDir, b.file ?? '')
309
+ else if (path === '/api/act/ask-decline') askDecline(d.root, d.asksDir, b.file ?? '', typeof b.why === 'string' ? b.why : undefined)
304
310
  else if (path === '/api/act/ask-proof') askProof(d.root, d.asksDir, b.file ?? '', b.url ?? '')
305
311
  else if (path === '/api/act/remark') {
306
312
  // ONE remark verb, routed by collection: a remark
@@ -367,6 +373,9 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
367
373
  // the repo's own pages: their list, each one proxied from the repo's process (pages/routes.ts)
368
374
  const pages = await pagesRoutes(d.root, req, path, srv)
369
375
  if (pages != null) return pages
376
+ // every url of the repo, and the one field of a login a click copies (urls/routes.ts)
377
+ const urls = await urlsRoutes(d.root, req, path)
378
+ if (urls != null) return urls
370
379
  // the review or trailer page alone, for another tool's frame (embed.ts)
371
380
  const embed = await embedRoute(path)
372
381
  if (embed != null) return embed
@@ -385,8 +394,8 @@ export function hubHandler(d: HubDeps, o: { base?: string; projects?: Gutter } =
385
394
  // the project CLI run from the page (commands/routes.ts)
386
395
  const commands = await commandsRoutes(d.root, req, path)
387
396
  if (commands != null) return commands
388
- // the messages store, read whole (messages/routes.ts)
389
- const messages = messagesRoutes(d.root, req, path)
397
+ // the messages store read whole, and the owner's suggestions appended (messages/routes.ts)
398
+ const messages = await messagesRoutes(d.root, req, path)
390
399
  if (messages != null) return messages
391
400
  // the Communications and Social desks (social/routes.ts)
392
401
  const social = await socialRoutes(d.root, req, path)