rvlib-shipkit 2.26.0 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +6 -4
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +1 -3
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/render.ts +122 -21
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +314 -40
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +320 -99
  15. package/src/agent-time/timeline.ts +140 -21
  16. package/src/agent-time/turns.ts +18 -8
  17. package/src/annex/offload.ts +17 -6
  18. package/src/annex/tidy.ts +70 -10
  19. package/src/asks/ask-after.ts +40 -0
  20. package/src/asks/asks-queue.ts +205 -47
  21. package/src/assets/kit-config.ts +7 -3
  22. package/src/assets/kits/identity-kit.ts +289 -10
  23. package/src/check.ts +3 -1
  24. package/src/checks/SK004-gitignore-policy.check.ts +12 -5
  25. package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
  26. package/src/checks/SK026-asks-autoclose.check.ts +5 -5
  27. package/src/checks/SK028-readme.check.ts +7 -66
  28. package/src/checks/SK030-cache-audit.check.ts +6 -1
  29. package/src/checks/SK031-trace-audit.check.ts +2 -0
  30. package/src/checks/SK033-global-contribution.check.ts +3 -1
  31. package/src/checks/SK035-public-clean.check.ts +2 -2
  32. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  33. package/src/checks/SK047-login-in-description.check.ts +36 -0
  34. package/src/checks/SK048-one-local-file.check.ts +36 -0
  35. package/src/cli/cmd_Asks.ts +71 -5
  36. package/src/cli/cmd_Backup.ts +2 -2
  37. package/src/cli/cmd_Capacity.ts +2 -2
  38. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  39. package/src/cli/cmd_Db.ts +253 -0
  40. package/src/cli/cmd_History.ts +212 -0
  41. package/src/cli/cmd_Home.ts +31 -3
  42. package/src/cli/cmd_Hq.ts +516 -0
  43. package/src/cli/cmd_Machines.ts +36 -0
  44. package/src/cli/cmd_Media.ts +38 -6
  45. package/src/cli/cmd_Reflect.ts +23 -2
  46. package/src/cli/cmd_Review.ts +548 -116
  47. package/src/cli/cmd_Secret.ts +62 -12
  48. package/src/cli/cmd_Social.ts +83 -1
  49. package/src/cli/cmd_Space.ts +324 -0
  50. package/src/cli/cmd_Time.ts +76 -5
  51. package/src/cli/cmd_Tmp.ts +28 -4
  52. package/src/cli/cmd_Trailer.ts +14 -10
  53. package/src/cli/cmd_Urls.ts +56 -0
  54. package/src/cli/cmd_Vault.ts +583 -0
  55. package/src/cli/family-help.ts +4 -2
  56. package/src/cli/family-pages.ts +1 -1
  57. package/src/cli/registry.ts +24 -3
  58. package/src/collections/actions.ts +63 -13
  59. package/src/collections/collection-types.ts +23 -1
  60. package/src/collections/providers.ts +117 -23
  61. package/src/collections/review.ts +4 -4
  62. package/src/contracts/contract-manifests.ts +6 -5
  63. package/src/contracts/contract-types.ts +6 -4
  64. package/src/contracts/contracts-engine.ts +11 -0
  65. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  66. package/src/core/budget.ts +12 -17
  67. package/src/core/capacity.ts +27 -18
  68. package/src/core/check-runner.ts +7 -4
  69. package/src/core/layout.ts +3 -0
  70. package/src/core/machine-busy.ts +127 -0
  71. package/src/core/machine-commit.ts +6 -1
  72. package/src/core/machine-db.ts +368 -20
  73. package/src/core/machine-layout.ts +137 -0
  74. package/src/core/machine-read.ts +81 -0
  75. package/src/core/migrate-layout.ts +1 -1
  76. package/src/core/one-way-in-policy.ts +64 -7
  77. package/src/core/polling-policy.ts +27 -0
  78. package/src/core/retention.ts +16 -2
  79. package/src/core/scope.ts +107 -14
  80. package/src/core/slots.ts +5 -4
  81. package/src/drill/clean.ts +25 -1
  82. package/src/drill/run.ts +1 -1
  83. package/src/drill/seal.ts +27 -4
  84. package/src/home/activity-shape.ts +2 -0
  85. package/src/home/activity.ts +66 -3
  86. package/src/home/app-sign.ts +15 -4
  87. package/src/home/daemon-jobs.ts +149 -7
  88. package/src/home/database-projects.ts +111 -0
  89. package/src/home/database-words.ts +203 -0
  90. package/src/home/databases.ts +460 -0
  91. package/src/home/global-units.ts +6 -0
  92. package/src/home/gui-app/ShipkitGui.swift +122 -1
  93. package/src/home/gui-app.ts +6 -3
  94. package/src/home/home-move.ts +514 -0
  95. package/src/home/home-paths.ts +12 -3
  96. package/src/home/home-routes.ts +68 -0
  97. package/src/home/inbox-shape.ts +24 -14
  98. package/src/home/machine-fold.ts +820 -0
  99. package/src/home/machine-host.ts +20 -5
  100. package/src/home/machine-repair.ts +503 -0
  101. package/src/home/machine-stores.ts +66 -15
  102. package/src/home/machine-temp.ts +547 -86
  103. package/src/home/resume.ts +79 -0
  104. package/src/home/run-daemon.ts +25 -4
  105. package/src/home/run-pm.ts +18 -5
  106. package/src/home/serve-daemon.ts +18 -3
  107. package/src/home/serve-web.ts +175 -7
  108. package/src/home/space-job.ts +115 -0
  109. package/src/home/space-page.ts +257 -0
  110. package/src/home/space-route.ts +167 -0
  111. package/src/home/space-words.ts +103 -0
  112. package/src/home/time-page-shape.ts +202 -0
  113. package/src/home/time-page.ts +64 -0
  114. package/src/home/vault-page.ts +482 -0
  115. package/src/home/vault-words.ts +132 -0
  116. package/src/hooks/leak-guard.ts +40 -13
  117. package/src/hooks/one-way-in-guard.ts +17 -4
  118. package/src/hq/cards.ts +581 -0
  119. package/src/hq/door-route.ts +43 -0
  120. package/src/hq/door.ts +163 -0
  121. package/src/hq/files-send.ts +348 -0
  122. package/src/hq/forgotten-log.ts +35 -0
  123. package/src/hq/history-check.ts +255 -0
  124. package/src/hq/history-place.ts +146 -0
  125. package/src/hq/history-send.ts +487 -0
  126. package/src/hq/hq-db.ts +99 -0
  127. package/src/hq/hq-local.ts +469 -0
  128. package/src/hq/hq-routes.ts +196 -0
  129. package/src/hq/hq-store.ts +599 -0
  130. package/src/hq/kinds/ask.ts +147 -0
  131. package/src/hq/kinds/card-gone.ts +83 -0
  132. package/src/hq/kinds/card-msg.ts +66 -0
  133. package/src/hq/kinds/card.ts +99 -0
  134. package/src/hq/kinds/index.ts +21 -0
  135. package/src/hq/kinds/kind.ts +126 -0
  136. package/src/hq/kinds/media.ts +125 -0
  137. package/src/hq/kinds/prompt.ts +219 -0
  138. package/src/hq/kinds/reflection.ts +128 -0
  139. package/src/hq/kinds/report.ts +55 -0
  140. package/src/hq/kinds/time-day.ts +236 -0
  141. package/src/hq/ledger.ts +473 -0
  142. package/src/hq/machine-key.ts +44 -0
  143. package/src/hq/machine-notes.ts +131 -0
  144. package/src/hq/outbox.ts +372 -0
  145. package/src/hq/replica.ts +168 -0
  146. package/src/hq/repo-id.ts +4 -0
  147. package/src/hq/report-facts.ts +117 -0
  148. package/src/hq/report.ts +274 -0
  149. package/src/hq/switch.ts +151 -0
  150. package/src/hq/vault-grant.ts +92 -0
  151. package/src/identities/identities.ts +15 -3
  152. package/src/identities/steps.ts +31 -0
  153. package/src/ledger/db.ts +73 -26
  154. package/src/ledger/gate-checks.ts +6 -2
  155. package/src/ledger/run-log.ts +11 -3
  156. package/src/ledger/store.ts +26 -4
  157. package/src/media-store/backup/daemon.ts +25 -17
  158. package/src/media-store/backup/kept.ts +241 -0
  159. package/src/media-store/backup/restore.ts +14 -4
  160. package/src/media-store/backup/run.ts +11 -11
  161. package/src/media-store/backup/secret.ts +6 -4
  162. package/src/media-store/backup/snapshot.ts +4 -2
  163. package/src/media-store/backup/sources.ts +67 -16
  164. package/src/media-store/copy/config.ts +77 -0
  165. package/src/media-store/copy/copy.ts +194 -0
  166. package/src/media-store/copy/lifecycle.ts +43 -0
  167. package/src/media-store/copy/night.ts +90 -0
  168. package/src/media-store/copy/proof.ts +151 -0
  169. package/src/media-store/copy/snapshot.ts +152 -0
  170. package/src/media-store/copy/store.ts +62 -0
  171. package/src/media-store/copy/stream.ts +176 -0
  172. package/src/media-store/daemon.ts +66 -16
  173. package/src/media-store/db.ts +22 -11
  174. package/src/media-store/forget.ts +23 -3
  175. package/src/media-store/hand.ts +4 -3
  176. package/src/media-store/hq-find.ts +75 -0
  177. package/src/media-store/hq-send.ts +277 -0
  178. package/src/media-store/kind.ts +2 -0
  179. package/src/media-store/purge.ts +18 -15
  180. package/src/media-store/put.ts +24 -8
  181. package/src/media-store/remote.ts +16 -7
  182. package/src/media-store/space-listing.ts +240 -0
  183. package/src/media-store/space.ts +40 -21
  184. package/src/media-store/sync.ts +5 -5
  185. package/src/media-store/tidy.ts +98 -0
  186. package/src/media-store/upload.ts +3 -3
  187. package/src/media-store/webp.ts +66 -0
  188. package/src/messages/model.ts +16 -7
  189. package/src/messages/routes.ts +14 -4
  190. package/src/messages/score.ts +2 -2
  191. package/src/messages/suggest.ts +96 -0
  192. package/src/pages/frame-client.ts +10 -0
  193. package/src/plan/planner.ts +28 -17
  194. package/src/recordings/media-kind.ts +1 -0
  195. package/src/recordings/model.ts +1 -1
  196. package/src/recordings/recorder-app/Capture.swift +9 -7
  197. package/src/reflect/hq-corpus.ts +56 -0
  198. package/src/reflect/prompt-corpus.ts +3 -1
  199. package/src/reflect/transcript.ts +129 -37
  200. package/src/release/machine-words.ts +67 -0
  201. package/src/release/public-clean.ts +8 -3
  202. package/src/releases/from-card.ts +1 -1
  203. package/src/releases/routes.ts +10 -5
  204. package/src/releases/store.ts +10 -1
  205. package/src/repo-config.ts +32 -2
  206. package/src/review/anim.ts +2 -2
  207. package/src/review/auto.ts +2 -2
  208. package/src/review/card-db.ts +244 -0
  209. package/src/review/card-rows.ts +266 -0
  210. package/src/review/cells.ts +76 -5
  211. package/src/review/draft-card.ts +41 -0
  212. package/src/review/draft-model.ts +78 -0
  213. package/src/review/format.ts +29 -10
  214. package/src/review/gone.ts +98 -0
  215. package/src/review/inbox-hook.ts +4 -4
  216. package/src/review/marks.ts +1 -1
  217. package/src/review/media-kind.ts +7 -5
  218. package/src/review/media-read.ts +9 -7
  219. package/src/review/media.ts +32 -5
  220. package/src/review/model.ts +202 -39
  221. package/src/review/move.ts +491 -0
  222. package/src/review/notes.ts +12 -20
  223. package/src/review/previews.ts +15 -19
  224. package/src/review/project.ts +1 -1
  225. package/src/review/rev.ts +8 -0
  226. package/src/review/role.ts +1 -1
  227. package/src/review/routes.ts +64 -13
  228. package/src/review/stage-card.ts +8 -4
  229. package/src/review/stage-routes.ts +1 -1
  230. package/src/review/store.ts +529 -83
  231. package/src/review/thread-fold.ts +51 -0
  232. package/src/review/threads.ts +147 -9
  233. package/src/review/trailer-auto-mock.ts +63 -0
  234. package/src/review/trailer-card.ts +4 -4
  235. package/src/review/trailer-desk.ts +41 -7
  236. package/src/review/trailer-media.ts +1 -0
  237. package/src/review/trailer-model.ts +8 -0
  238. package/src/review/trailer-notes.ts +1 -1
  239. package/src/review/trailer-routes.ts +9 -1
  240. package/src/review/unit.ts +6 -6
  241. package/src/review/watchers.ts +1 -1
  242. package/src/rules/untrack-generated.ts +92 -8
  243. package/src/secrets/held.ts +16 -0
  244. package/src/secrets/keychain.ts +113 -0
  245. package/src/secrets/list.ts +16 -6
  246. package/src/secrets/manager.ts +24 -10
  247. package/src/secrets/read.ts +257 -0
  248. package/src/secrets/who-reads.ts +49 -0
  249. package/src/serve/door-forward.ts +268 -0
  250. package/src/serve/door-names.ts +47 -0
  251. package/src/serve/embed.ts +1 -1
  252. package/src/serve/hub-app/activity-view.tsx +56 -32
  253. package/src/serve/hub-app/activity.css +7 -1
  254. package/src/serve/hub-app/asks-page.tsx +48 -0
  255. package/src/serve/hub-app/asks-st.ts +25 -0
  256. package/src/serve/hub-app/clock-svc.ts +1 -2
  257. package/src/serve/hub-app/col-card.tsx +64 -13
  258. package/src/serve/hub-app/col-list-page.tsx +122 -0
  259. package/src/serve/hub-app/col-list-st.ts +103 -0
  260. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  261. package/src/serve/hub-app/col-tables.ts +76 -8
  262. package/src/serve/hub-app/cols-svc.ts +70 -16
  263. package/src/serve/hub-app/database-st.ts +260 -0
  264. package/src/serve/hub-app/database-view.tsx +289 -0
  265. package/src/serve/hub-app/database.css +32 -0
  266. package/src/serve/hub-app/entry-bar.css +14 -0
  267. package/src/serve/hub-app/entry-bar.tsx +33 -0
  268. package/src/serve/hub-app/entry-pick.ts +31 -0
  269. package/src/serve/hub-app/floating.tsx +1 -0
  270. package/src/serve/hub-app/hash-route.ts +11 -1
  271. package/src/serve/hub-app/header-bar.tsx +14 -18
  272. package/src/serve/hub-app/home-st.ts +89 -9
  273. package/src/serve/hub-app/home-strip.css +5 -19
  274. package/src/serve/hub-app/home-strip.tsx +58 -92
  275. package/src/serve/hub-app/home.html +7 -0
  276. package/src/serve/hub-app/hub-app.tsx +31 -142
  277. package/src/serve/hub-app/hub-types.ts +3 -1
  278. package/src/serve/hub-app/hub.css +109 -23
  279. package/src/serve/hub-app/icons.tsx +18 -1
  280. package/src/serve/hub-app/identities-st.ts +56 -6
  281. package/src/serve/hub-app/identities-view.tsx +100 -58
  282. package/src/serve/hub-app/identities.css +17 -15
  283. package/src/serve/hub-app/identity-address.ts +5 -0
  284. package/src/serve/hub-app/inbox-st.ts +41 -24
  285. package/src/serve/hub-app/inbox-view.tsx +37 -41
  286. package/src/serve/hub-app/inbox.css +2 -5
  287. package/src/serve/hub-app/index.html +7 -0
  288. package/src/serve/hub-app/kept-cols.tsx +7 -0
  289. package/src/serve/hub-app/keys.ts +28 -15
  290. package/src/serve/hub-app/later.tsx +26 -0
  291. package/src/serve/hub-app/list-filter.tsx +14 -0
  292. package/src/serve/hub-app/list-walk.ts +72 -3
  293. package/src/serve/hub-app/machines-st.ts +251 -0
  294. package/src/serve/hub-app/machines-view.tsx +224 -0
  295. package/src/serve/hub-app/machines.css +76 -0
  296. package/src/serve/hub-app/md-copy.tsx +79 -0
  297. package/src/serve/hub-app/media-view.tsx +2 -0
  298. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  299. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  300. package/src/serve/hub-app/messages.css +14 -0
  301. package/src/serve/hub-app/page-keys.ts +175 -0
  302. package/src/serve/hub-app/pages-frames.tsx +11 -3
  303. package/src/serve/hub-app/palette-st.ts +58 -11
  304. package/src/serve/hub-app/palette-view.tsx +3 -1
  305. package/src/serve/hub-app/project-list.css +54 -8
  306. package/src/serve/hub-app/project-list.tsx +128 -59
  307. package/src/serve/hub-app/projects-svc.ts +78 -7
  308. package/src/serve/hub-app/reader-chips.tsx +13 -0
  309. package/src/serve/hub-app/readme-view.tsx +2 -3
  310. package/src/serve/hub-app/readme.css +27 -5
  311. package/src/serve/hub-app/reflections-page.tsx +42 -0
  312. package/src/serve/hub-app/reflections-st.ts +17 -0
  313. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  314. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  315. package/src/serve/hub-app/repo-sections.ts +9 -5
  316. package/src/serve/hub-app/repo-st.ts +35 -8
  317. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  318. package/src/serve/hub-app/review/kit.tsx +50 -7
  319. package/src/serve/hub-app/review/note-place.ts +1 -1
  320. package/src/serve/hub-app/review/review-board.tsx +2 -2
  321. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  322. package/src/serve/hub-app/review/review-kit.ts +27 -1
  323. package/src/serve/hub-app/review/review-list.tsx +68 -30
  324. package/src/serve/hub-app/review/review-page.tsx +7 -8
  325. package/src/serve/hub-app/review/review-st.ts +111 -24
  326. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  327. package/src/serve/hub-app/review/review-views.tsx +475 -144
  328. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  329. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  330. package/src/serve/hub-app/review/thread-st.ts +73 -26
  331. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  332. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  333. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  334. package/src/serve/hub-app/review.css +267 -61
  335. package/src/serve/hub-app/side-lists.ts +72 -0
  336. package/src/serve/hub-app/sidebar.tsx +6 -3
  337. package/src/serve/hub-app/site/site-part.tsx +2 -8
  338. package/src/serve/hub-app/site/site-st.ts +4 -4
  339. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  340. package/src/serve/hub-app/social/kit.tsx +30 -4
  341. package/src/serve/hub-app/social/post-card.tsx +139 -49
  342. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  343. package/src/serve/hub-app/social/social-model.ts +11 -0
  344. package/src/serve/hub-app/social/social-page.tsx +94 -35
  345. package/src/serve/hub-app/social/social-st.ts +120 -36
  346. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  347. package/src/serve/hub-app/social/stage-st.ts +1 -1
  348. package/src/serve/hub-app/social/step-layout.ts +1 -1
  349. package/src/serve/hub-app/social.css +3 -0
  350. package/src/serve/hub-app/space-st.ts +209 -0
  351. package/src/serve/hub-app/space-view.tsx +196 -0
  352. package/src/serve/hub-app/space.css +27 -0
  353. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  354. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  355. package/src/serve/hub-app/stores.css +6 -1
  356. package/src/serve/hub-app/theme-st.ts +22 -9
  357. package/src/serve/hub-app/time-charts.tsx +291 -0
  358. package/src/serve/hub-app/time-pages.tsx +749 -0
  359. package/src/serve/hub-app/time-st.ts +162 -0
  360. package/src/serve/hub-app/time-view.tsx +76 -0
  361. package/src/serve/hub-app/time.css +138 -0
  362. package/src/serve/hub-app/tree-build.ts +52 -42
  363. package/src/serve/hub-app/tree-row.tsx +4 -4
  364. package/src/serve/hub-app/tree-svc.ts +18 -9
  365. package/src/serve/hub-app/urls-svc.ts +154 -0
  366. package/src/serve/hub-app/urls-view.tsx +117 -0
  367. package/src/serve/hub-app/urls.css +30 -0
  368. package/src/serve/hub-app/vault-st.ts +127 -0
  369. package/src/serve/hub-app/vault-view.tsx +154 -0
  370. package/src/serve/hub-app/vault.css +38 -0
  371. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  372. package/src/serve/hub-app/waiting-svc.ts +29 -0
  373. package/src/serve/hub-app/wikis-view.tsx +2 -2
  374. package/src/serve/hub-runtime.ts +15 -2
  375. package/src/serve/project-gutter-route.ts +27 -14
  376. package/src/serve/project-gutter.ts +25 -12
  377. package/src/serve/same-origin.ts +10 -0
  378. package/src/serve/serve-hub.ts +13 -4
  379. package/src/shipkit-files.ts +16 -2
  380. package/src/shipkit.ts +1 -1
  381. package/src/shot/shooter.ts +616 -420
  382. package/src/shot/shot-ask.ts +246 -155
  383. package/src/site/desk.ts +2 -2
  384. package/src/smoke/run-smoke.ts +3 -2
  385. package/src/social/cover.ts +202 -0
  386. package/src/social/discord-layout.ts +37 -13
  387. package/src/social/drafts.ts +3 -0
  388. package/src/social/load.ts +23 -2
  389. package/src/social/media-kind.ts +2 -1
  390. package/src/social/publish/discord.ts +5 -2
  391. package/src/social/publish/secret.ts +2 -2
  392. package/src/social/release-stage.ts +28 -13
  393. package/src/social/routes.ts +26 -1
  394. package/src/social/stage.ts +1 -1
  395. package/src/social/stats.ts +12 -9
  396. package/src/social/strip.ts +4 -1
  397. package/src/social/thumbnail.ts +255 -0
  398. package/src/stores/collection.ts +15 -11
  399. package/src/stores/desk.ts +236 -42
  400. package/src/stores/model.ts +72 -6
  401. package/src/stores/routes.ts +37 -12
  402. package/src/stores/unit.ts +14 -8
  403. package/src/suite/judge-suites.ts +41 -11
  404. package/src/suite/select.ts +45 -3
  405. package/src/suite/suite-cli.ts +16 -10
  406. package/src/trailer/bed.ts +1 -1
  407. package/src/trailer/build.ts +134 -21
  408. package/src/trailer/ffmpeg.ts +7 -0
  409. package/src/trailer/fonts.ts +3 -2
  410. package/src/trailer/grammar.ts +201 -2
  411. package/src/trailer/graph.ts +42 -5
  412. package/src/trailer/look.ts +21 -0
  413. package/src/trailer/mock.ts +154 -0
  414. package/src/trailer/passage.ts +65 -26
  415. package/src/trailer/score/heard.ts +89 -0
  416. package/src/trailer/score/sound.ts +14 -8
  417. package/src/trailer/sound/run.ts +16 -6
  418. package/src/trailer/stitch.ts +26 -5
  419. package/src/trailer/titles.ts +82 -19
  420. package/src/trailer/versions.ts +1 -3
  421. package/src/trailer/vertical.ts +3 -1
  422. package/src/urls/frame.ts +195 -0
  423. package/src/urls/routes.ts +43 -0
  424. package/src/urls/rows.ts +171 -0
  425. package/src/urls/unit.ts +73 -0
  426. package/src/vault/house-keys.ts +42 -0
  427. package/src/vault/layout.ts +50 -0
  428. package/src/vault/policy.ts +165 -0
  429. package/src/vault/vault-audit.ts +276 -0
  430. package/src/vault/vault-client.ts +40 -0
  431. package/src/vault/vault-config.ts +159 -0
  432. package/src/vault/vault-destroy.ts +78 -0
  433. package/src/vault/vault-handover.ts +305 -0
  434. package/src/vault/vault-http.ts +352 -0
  435. package/src/vault/vault-import.ts +208 -0
  436. package/src/vault/vault-init.ts +328 -0
  437. package/src/vault/vault-minter.ts +271 -0
  438. package/src/vault/vault-restore.ts +333 -0
  439. package/src/vault/vault-serve.ts +342 -0
  440. package/src/vault/vault-snapshot.ts +281 -0
  441. package/src/veille/asks.ts +1 -1
  442. package/src/veille/desk.ts +2 -2
@@ -0,0 +1,251 @@
1
+ // the machines page's state: every machine the hq knows, as `GET /api/home/machines` answers it, read again while
2
+ // the page shows. The order of the machines and of their daemons, the drift of a repo between two of them and
3
+ // every word a row says are pure functions, so a test pins them rather than a screenshot.
4
+ //
5
+ // The constraint a reader breaks first: the words are `sk machines`'s (hq/machine-notes.ts). A fact the console
6
+ // prints is said here in its words, and the test holds the two together.
7
+ import { makeAutoObservable, observableRef, runInAction } from 'mobx'
8
+ import type { MachinesPage } from '../../hq/hq-local.ts'
9
+ import { ago, BEHIND_COMMITS, gb, laneWords, LOW_DISK_BYTES, newestVersion, processWords, SILENT_MS, switchSplits, switchWord, type MachineNote } from '../../hq/machine-notes.ts'
10
+ import type { MachineView } from '../../hq/hq-store.ts'
11
+ import type { GateFact, RepoFacts } from '../../hq/report.ts'
12
+ import { repoId } from '../../hq/repo-id.ts'
13
+ import type { HomeSt } from './home-st.ts'
14
+ import { ownTrouble, reach } from './reach.ts'
15
+ import { doorOrigin, loopbackOrigin } from '../door-names.ts'
16
+
17
+ /** a daemon reports every 5 minutes: a read every 15 s shows a report within the quarter minute it lands */
18
+ export const MACHINES_POLL_MS = 15_000
19
+ const OPEN_KEY = 'home:machines:open'
20
+
21
+ export type Machine = MachinesPage['machines'][number]
22
+ export type MNode = Machine['nodes'][number]
23
+ /** a daemon as the hq holds it, its disk line aside: what the words and the order read */
24
+ type Node = MachineView['nodes'][number]
25
+
26
+
27
+ /** on: it reported within three reports; silent: it did not; never: it joined and never reported; ended: it left */
28
+ export type NodeState = 'on' | 'silent' | 'never' | 'ended'
29
+
30
+ export function stateOf(n: Node, now: number): NodeState {
31
+ if (n.ended != null) return 'ended'
32
+ if (n.report == null) return 'never'
33
+ return now - n.report.at > SILENT_MS ? 'silent' : 'on'
34
+ }
35
+
36
+ /** the state as a word, and since when */
37
+ export function stateWords(n: Node, now: number): { word: string; since: string } {
38
+ const s = stateOf(n, now)
39
+ if (s === 'ended') return { word: 'ended', since: `${ago(now - (n.ended ?? now))} ago` }
40
+ if (s === 'never') return { word: 'joined', since: `${ago(now - n.joined)} ago, no report yet` }
41
+ const at = n.report?.at ?? now
42
+ return s === 'silent' ? { word: 'silent', since: `for ${ago(now - at)}` } : { word: 'on', since: `${ago(now - at)} ago` }
43
+ }
44
+
45
+ export const isMine = (m: MachineView, you: string): boolean => m.nodes.some((n) => n.id === you)
46
+ const live = (m: MachineView): boolean => m.nodes.some((n) => n.ended == null)
47
+
48
+ /** a machine with a daemon gone quiet first, then one a note names, then this machine, then the others by name; a
49
+ * machine whose daemons all ended last. Silence leads: a split of versions names every machine, silence one */
50
+ export function machineOrder<M extends MachineView>(machines: readonly M[], you: string, notes: readonly MachineNote[], now: number): M[] {
51
+ const named = new Set(notes.map((n) => n.node))
52
+ const quiet = (m: M): boolean => m.nodes.some((n) => ['silent', 'never'].includes(stateOf(n, now)))
53
+ const rank = (m: M): number => (!live(m) ? 4 : quiet(m) ? 0 : m.nodes.some((n) => named.has(n.id)) ? 1 : isMine(m, you) ? 2 : 3)
54
+ return [...machines].sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name))
55
+ }
56
+
57
+ /** a daemon a note names first, then the other live ones, the ended ones last; by OS user inside each */
58
+ export function nodeOrder<N extends Node>(nodes: readonly N[], notes: readonly MachineNote[]): N[] {
59
+ const named = new Set(notes.map((n) => n.node))
60
+ const rank = (n: N): number => (n.ended != null ? 2 : named.has(n.id) ? 0 : 1)
61
+ return [...nodes].sort((a, b) => rank(a) - rank(b) || a.osUser.localeCompare(b.osUser))
62
+ }
63
+
64
+ /** another daemon that holds the same repo at another head */
65
+ export type Drift = { machine: string; osUser: string; head: string }
66
+ export const driftKey = (node: string, repo: string): string => `${node}\0${repo}`
67
+
68
+ /** for each repo of each live daemon, the other live daemons that last reported it at another head. A silent
69
+ * daemon counts with its last report: a machine that fell behind is the drift to see */
70
+ export function driftOf(machines: readonly MachineView[]): Map<string, Drift[]> {
71
+ const held = machines.flatMap((m) => m.nodes.filter((n) => n.ended == null && n.report != null).map((n) => ({ m, n, repos: n.report?.body.repos ?? [] })))
72
+ const out = new Map<string, Drift[]>()
73
+ for (const a of held)
74
+ for (const r of a.repos) {
75
+ const other = held.filter((b) => b.n.id !== a.n.id).flatMap((b) => b.repos.filter((x) => repoId(x) === repoId(r) && x.head !== r.head).map((x) => ({ machine: b.m.name, osUser: b.n.osUser, head: x.head })))
76
+ if (other.length > 0) out.set(driftKey(a.n.id, r.name), other)
77
+ }
78
+ return out
79
+ }
80
+
81
+ /** the drift mark's words */
82
+ export const driftWords = (d: readonly Drift[]): string => `another head elsewhere: ${d.map((x) => `${x.machine} (${x.osUser}) has ${x.head}`).join(', ')}`
83
+
84
+ /** the notes in the order of the machines they name */
85
+ export function notesInOrder(notes: readonly MachineNote[], ordered: readonly MachineView[]): MachineNote[] {
86
+ const at = new Map(ordered.flatMap((m, i) => m.nodes.map((n) => [n.id, i] as const)))
87
+ return [...notes].sort((a, b) => (at.get(a.node) ?? ordered.length) - (at.get(b.node) ?? ordered.length))
88
+ }
89
+
90
+ /** one daemon's facts as its row says them, the console's words; `warn` marks what a note is about */
91
+ export type Fact = { text: string; warn: boolean }
92
+ export type NodeFacts = { version: Fact; house: Fact; behind: Fact | null; disk: Fact; repos: string; dirty: string; drifted: number }
93
+
94
+ export function nodeFacts(n: Node, newest: string | null, drift: ReadonlyMap<string, Drift[]>): NodeFacts | null {
95
+ const r = n.report?.body
96
+ if (r == null || n.ended != null) return null
97
+ const dirty = r.repos.filter((x) => x.dirty > 0).length
98
+ return {
99
+ version: { text: `shipkit ${r.version}`, warn: newest != null && r.version !== newest },
100
+ house: { text: r.house == null ? 'no house checkout' : `house ${r.house.head}`, warn: false },
101
+ behind: r.house == null || r.house.behind === 0 ? null : { text: `(${r.house.behind} behind)`, warn: r.house.behind > BEHIND_COMMITS },
102
+ disk: { text: `${gb(r.disk.free)} free of ${gb(r.disk.total)}`, warn: r.disk.free < LOW_DISK_BYTES },
103
+ repos: `${r.repos.length} repos`,
104
+ dirty: dirty > 0 ? `, ${dirty} dirty` : '',
105
+ drifted: r.repos.filter((x) => drift.has(driftKey(n.id, x.name))).length,
106
+ }
107
+ }
108
+
109
+ /** the rest of a daemon's last report, the console's words: its processes, its agents, its switches (one that another
110
+ * daemon holds at another value is `split`, with the others' values), the values asked of it not shown yet */
111
+ export type NodeRest = { processes: Fact | null; agents: string | null; switches: { text: string; split: string | null }[]; wanted: string[] }
112
+
113
+ export function nodeRest(n: Node, splits: ReturnType<typeof switchSplits>, now: number): NodeRest | null {
114
+ const r = n.report?.body
115
+ if (r == null || n.ended != null) return null
116
+ const p = processWords(r)
117
+ const switches = Object.entries(r.switches ?? {}).flatMap(([name, v]): NodeRest['switches'] => {
118
+ const other = splits.get(name)?.filter((x) => x.node !== n.id && JSON.stringify(x.value) !== JSON.stringify(v)) ?? []
119
+ if (other.length > 0) return [{ text: `${name} ${switchWord(v)}`, split: other.map((x) => `${x.machine} (${x.osUser}): ${switchWord(x.value)}`).join(', ') }]
120
+ return v === true || typeof v === 'number' ? [{ text: `${name} ${switchWord(v)}`, split: null }] : []
121
+ })
122
+ return {
123
+ processes: p == null ? null : { text: p, warn: (r.processes ?? []).some((x) => x.state === 'crashed') },
124
+ agents: laneWords(r, now),
125
+ switches,
126
+ wanted: (n.wanted ?? []).map((w) => `wants ${w.name} ${w.on ? 'on' : 'off'}, asked ${ago(now - w.at)} ago`),
127
+ }
128
+ }
129
+
130
+ /** a daemon's repos in name order */
131
+ export const reposOf = (n: Node): RepoFacts[] => [...(n.report?.body.repos ?? [])].sort((a, b) => a.name.localeCompare(b.name))
132
+
133
+ /** a repo's checks as its run record last saw them, in words: green, the red ones, the warnings; none never ran */
134
+ export function gateWords(g: GateFact | undefined, now: number): { text: string; tone: 'ok' | 'warn' | 'red' | 'dim'; tip: string } {
135
+ if (g == null) return { text: '·', tone: 'dim', tip: 'no gate ran here' }
136
+ const when = g.at == null ? '' : `, last check ${ago(now - g.at)} ago`
137
+ if (g.state === 'red') return { text: `${g.reds.length} red`, tone: 'red', tip: `red: ${g.reds.join(', ')}${g.warns > 0 ? `; ${g.warns} warn` : ''}${when}` }
138
+ if (g.state === 'orange') return { text: `${g.warns} warn`, tone: 'warn', tip: `${g.warns} ${g.warns === 1 ? 'check warns' : 'checks warn'}${when}` }
139
+ return { text: 'green', tone: 'ok', tip: `every check green${when}` }
140
+ }
141
+
142
+ /** a daemon's newest commits of every branch of its repos, newest first: the checked out branch has no name here */
143
+ export type ActivityLine = { key: string; age: string; repo: string; branch: string; sha: string; title: string }
144
+ export function activityLines(n: Node, now: number): ActivityLine[] | null {
145
+ const a = n.report?.body.activity
146
+ if (a == null || n.ended != null) return null
147
+ return a.map((x) => ({ key: `${x.repo}\0${x.sha}`, age: ago(now - x.at), repo: x.repo, branch: x.branch ?? '', sha: x.sha, title: x.title }))
148
+ }
149
+
150
+ /** a daemon's global processes by id: its state, the repo that declares it, the url it declares, and its address
151
+ * through the door while the hq's proxy is on and the url is on its machine's loopback (null otherwise) */
152
+ export type ProcessLine = { id: string; repo: string; state: string; up: boolean; since: string; url: string | null; door: string | null }
153
+ export function processLines(n: Node, now: number, o: { machine: string; door?: { port: number } } = { machine: '' }): ProcessLine[] {
154
+ const ps = n.ended == null ? (n.report?.body.processes ?? []) : []
155
+ return [...ps].sort((a, b) => a.id.localeCompare(b.id)).map((p) => {
156
+ const origin = p.url == null || o.door == null ? null : loopbackOrigin(p.url)
157
+ const door = origin == null || o.door == null ? null : `${doorOrigin(p.id, o.machine, o.door.port)}${p.url!.slice(origin.length) || '/'}`
158
+ return { id: p.id, repo: p.repo, state: p.state, up: p.state === 'up', since: p.since > 0 ? ago(now - p.since) : '', url: p.url ?? null, door }
159
+ })
160
+ }
161
+
162
+ /** the counts on top */
163
+ export function countWords(machines: readonly MachineView[]): string {
164
+ const m = machines.filter(live).length
165
+ const d = machines.reduce((k, x) => k + x.nodes.filter((n) => n.ended == null).length, 0)
166
+ return `${m} ${m === 1 ? 'machine' : 'machines'} · ${d} ${d === 1 ? 'daemon' : 'daemons'}`
167
+ }
168
+
169
+ function kept(): string[] {
170
+ try {
171
+ const v = JSON.parse(globalThis.localStorage?.getItem(OPEN_KEY) ?? '[]') as unknown
172
+ return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : []
173
+ } catch {
174
+ return []
175
+ }
176
+ }
177
+
178
+ export class MachinesSt {
179
+ data: MachinesPage | null = null
180
+ error = ''
181
+ /** the machines opened on their repos, by id, kept per viewer */
182
+ opened = new Set<string>(kept())
183
+ private timer: ReturnType<typeof setInterval> | null = null
184
+ private gen = 0
185
+
186
+ constructor(private st: HomeSt) {
187
+ makeAutoObservable<this, 'st' | 'timer' | 'gen'>(this, { st: false, timer: false, gen: false, data: observableRef })
188
+ }
189
+
190
+ /** the moment of the answer: every age on the page is counted from it */
191
+ get now(): number {
192
+ return this.data?.at ?? 0
193
+ }
194
+
195
+ get notes(): MachineNote[] {
196
+ return notesInOrder(this.data?.notes ?? [], this.machines)
197
+ }
198
+
199
+ get machines(): Machine[] {
200
+ return this.data == null ? [] : machineOrder(this.data.machines, this.data.you, this.data.notes, this.data.at)
201
+ }
202
+
203
+ get drift(): Map<string, Drift[]> {
204
+ return driftOf(this.data?.machines ?? [])
205
+ }
206
+
207
+ /** the open asks of every machine, once each, a repo after another */
208
+ get asks(): NonNullable<MachinesPage['asks']> {
209
+ return [...(this.data?.asks ?? [])].sort((a, b) => a.repo.localeCompare(b.repo) || (a.number ?? 0) - (b.number ?? 0))
210
+ }
211
+
212
+ get splits(): ReturnType<typeof switchSplits> {
213
+ return switchSplits(this.data?.machines ?? [])
214
+ }
215
+
216
+ get newest(): string | null {
217
+ return newestVersion(this.data?.machines ?? [])
218
+ }
219
+
220
+ toggle(id: string): void {
221
+ if (!this.opened.delete(id)) this.opened.add(id)
222
+ try { globalThis.localStorage?.setItem(OPEN_KEY, JSON.stringify([...this.opened])) } catch { /* private window: the pick lasts the tab */ }
223
+ }
224
+
225
+ async poll(): Promise<void> {
226
+ const id = this.gen
227
+ try {
228
+ const r = await reach('/api/home/machines', { signal: AbortSignal.timeout(8_000) })
229
+ // a refusal is json with a 503; anything else that is not ok has no words of its own
230
+ if (!r.ok && r.status !== 503) throw new Error(`the daemon answers ${r.status} ${r.statusText} to /api/home/machines`)
231
+ const j = (await r.json()) as MachinesPage | { refused: string }
232
+ if ('refused' in j) throw new Error(j.refused)
233
+ runInAction(() => { if (id === this.gen) { this.data = j; this.error = '' } })
234
+ } catch (e) {
235
+ runInAction(() => { if (id === this.gen) this.error = ownTrouble(e, this.st.machine) })
236
+ }
237
+ }
238
+
239
+ /** reads while the page shows */
240
+ start(): void {
241
+ if (this.timer != null) return
242
+ void this.poll()
243
+ this.timer = setInterval(() => void this.poll(), MACHINES_POLL_MS)
244
+ }
245
+
246
+ stop(): void {
247
+ if (this.timer != null) clearInterval(this.timer)
248
+ this.timer = null
249
+ this.gen++
250
+ }
251
+ }
@@ -0,0 +1,224 @@
1
+ // `/machines`: every machine that reports to the hq. On top, what to look at (the notes of `sk machines`, one line
2
+ // each, or one quiet line), then one block a machine with one row a daemon; a machine opens on its repos with their
3
+ // gates (a repo at another head than on another daemon marked), its commits of the last day, its processes.
4
+ //
5
+ // The constraint a reader breaks first: every word comes from the report, in the console's words (machines-st.ts),
6
+ // and colour is state only: green on, red silent, orange what a note is about.
7
+ import { observer } from 'mobx-react-lite'
8
+ import { gb } from '../../hq/machine-notes.ts'
9
+ import type { HomeSt } from './home-st.ts'
10
+ import { Caret } from './icons.tsx'
11
+ import { activityLines, countWords, driftKey, driftWords, gateWords, isMine, type Machine, type MachinesSt, type MNode, nodeFacts, nodeOrder, nodeRest, processLines, reposOf, stateOf, stateWords } from './machines-st.ts'
12
+ import { type Col, Hint, num, Spark, Table } from './time-charts.tsx'
13
+
14
+ const clock = (at: number): string => new Date(at).toTimeString().slice(0, 5)
15
+ const moment = (at: number): string => new Date(at).toLocaleString(undefined, { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' })
16
+
17
+ /** the free disk over the window: two points make a line, one is only the figure beside it */
18
+ const DiskLine = ({ n }: { n: MNode }) => {
19
+ const line = n.line
20
+ const first = line[0]
21
+ const last = line[line.length - 1]
22
+ if (first == null || last == null || line.length < 2) return null
23
+ const low = line.reduce((a, p) => (p.free < a.free ? p : a), first)
24
+ const tip = (
25
+ <>
26
+ <b>free disk, the last 30 days</b>
27
+ <div>{moment(first.at)}: {gb(first.free)}</div>
28
+ <div>the lowest, {moment(low.at)}: {gb(low.free)}</div>
29
+ <div>{moment(last.at)}: {gb(last.free)}</div>
30
+ </>
31
+ )
32
+ return <Spark points={line.map((p) => ({ at: p.at, v: p.free }))} label={`free disk from ${gb(first.free)} to ${gb(last.free)}`} tip={tip} />
33
+ }
34
+
35
+ const NodeRow = observer(({ st, n }: { st: MachinesSt; n: MNode }) => {
36
+ const s = stateOf(n, st.now)
37
+ const w = stateWords(n, st.now)
38
+ const f = nodeFacts(n, st.newest, st.drift)
39
+ const drifted = f == null || f.drifted === 0 ? null : reposOf(n).filter((r) => st.drift.has(driftKey(n.id, r.name))).map((r) => r.name)
40
+ return (
41
+ <div className={`mcnode mc-${s}`}>
42
+ <span className="mcwho"><i className={`mcdot mcd-${s}`} />{n.osUser}</span>
43
+ <span className="mcstate"><b>{w.word}</b> {w.since}</span>
44
+ {f == null ? null : (
45
+ <>
46
+ <span className={f.version.warn ? 't-warn' : ''}>{f.version.text}</span>
47
+ <span className="mchouse">{f.house.text}{f.behind == null ? null : <span className={f.behind.warn ? 't-warn' : 'mcdim'}> {f.behind.text}</span>}</span>
48
+ <span className="mcdisk"><span className={f.disk.warn ? 't-warn' : ''}>{f.disk.text}</span><DiskLine n={n} /></span>
49
+ <span className="mcrepos">
50
+ {f.repos}{f.dirty}
51
+ {drifted == null ? null : <Hint className="t-warn" tip={`at another head than on another daemon: ${drifted.join(', ')}`}>, {f.drifted} at another head</Hint>}
52
+ </span>
53
+ </>
54
+ )}
55
+ </div>
56
+ )
57
+ })
58
+
59
+ /** under a daemon's row: its processes, its agents as counts, its switches on or set, a split one marked */
60
+ const NodeRest = observer(({ st, n }: { st: MachinesSt; n: MNode }) => {
61
+ const r = nodeRest(n, st.splits, st.now)
62
+ if (r == null || (r.processes == null && r.agents == null && r.switches.length === 0 && r.wanted.length === 0)) return null
63
+ return (
64
+ <div className="mcrest">
65
+ <div>
66
+ {r.processes == null ? null : <span className={r.processes.warn ? 't-warn' : ''}>{r.processes.text}</span>}
67
+ {r.agents == null ? null : <span>{r.agents}</span>}
68
+ {r.switches.length === 0 ? null : (
69
+ <span>
70
+ switches:{' '}
71
+ {r.switches.map((s, i) => (
72
+ <span key={s.text}>
73
+ {i > 0 ? ', ' : ''}
74
+ {s.split == null ? s.text : <Hint className="t-warn" tip={`another value elsewhere: ${s.split}`}>{s.text} ≠</Hint>}
75
+ </span>
76
+ ))}
77
+ </span>
78
+ )}
79
+ {r.wanted.map((w) => <span key={w} className="t-warn">{w}</span>)}
80
+ </div>
81
+ </div>
82
+ )
83
+ })
84
+
85
+ const HEAD: Col[] = [
86
+ { label: 'repo' },
87
+ { label: 'branch' },
88
+ { label: 'head' },
89
+ { label: 'ahead', num: true, title: 'commits not on its upstream yet' },
90
+ { label: 'behind', num: true, title: 'commits of its upstream it does not hold, as last fetched' },
91
+ { label: 'dirty', num: true, title: 'paths changed and not committed' },
92
+ { label: 'gate', title: 'its checks as its run record last saw them' },
93
+ ]
94
+
95
+ const ACTIVITY_HEAD: Col[] = [{ label: 'when' }, { label: 'repo' }, { label: 'branch', title: 'empty: the branch its checkout is on' }, { label: 'commit' }, { label: 'title' }]
96
+ const PROCESS_HEAD: Col[] = [{ label: 'process' }, { label: 'repo', title: 'the house repo that declares it' }, { label: 'state' }, { label: 'url', title: 'the url it declares, on its own machine' }]
97
+
98
+ /** its newest commits on every branch over the last day: a lane's worktree branch shows what that lane commits */
99
+ const Activity = observer(({ st, n }: { st: MachinesSt; n: MNode }) => {
100
+ const lines = activityLines(n, st.now)
101
+ if (lines == null) return null
102
+ return (
103
+ <div className="mcsub">
104
+ <div className="mcsubhead">recent commits, the last day</div>
105
+ <Table head={ACTIVITY_HEAD} empty="no commit in the last day" rows={lines.map((a) => ({ key: a.key, cells: [a.age, a.repo, a.branch, <span className="mcsha">{a.sha}</span>, <span className="mctitle">{a.title}</span>] }))} />
106
+ </div>
107
+ )
108
+ })
109
+
110
+ /** a process opened through the door: on the hq's machine only, `*.localhost` names nothing on a phone */
111
+ const DoorLink = ({ href }: { href: string }) => (
112
+ <Hint tip="opens through the hq's home, on the machine that carries the hq">
113
+ <a className="mcdoor" href={href} target="_blank" rel="noopener">open ↗</a>
114
+ </Hint>
115
+ )
116
+
117
+ const Processes = observer(({ st, n, machine }: { st: MachinesSt; n: MNode; machine: string }) => {
118
+ const lines = processLines(n, st.now, { machine, ...(st.data?.door == null ? {} : { door: st.data.door }) })
119
+ if (lines.length === 0) return null
120
+ return (
121
+ <div className="mcsub">
122
+ <div className="mcsubhead">global processes</div>
123
+ <Table head={PROCESS_HEAD} empty="no global process" rows={lines.map((p) => ({ key: p.id, cells: [p.id, p.repo, <span className={p.up ? '' : p.state === 'crashed' ? 't-warn' : 'mcdim'}>{p.state}{p.since === '' ? '' : ` ${p.since}`}</span>, p.url == null ? <span className="mcdim">no url</span> : <span className="mcurl"><span className="mcsha">{p.url}</span>{p.door == null ? null : <DoorLink href={p.door} />}</span>] }))} />
124
+ </div>
125
+ )
126
+ })
127
+
128
+ const Repos = observer(({ st, n, many, machine }: { st: MachinesSt; n: MNode; many: boolean; machine: string }) => (
129
+ <div className="mcrepolist">
130
+ {many ? <div className="mcuser">{n.osUser}</div> : null}
131
+ <Table head={HEAD} empty="no house repo in its last report" rows={reposOf(n).map((r) => {
132
+ const d = st.drift.get(driftKey(n.id, r.name))
133
+ return {
134
+ key: r.name,
135
+ cells: [
136
+ r.name,
137
+ r.branch,
138
+ d == null ? <span className="mcsha">{r.head}</span> : <Hint className="mcsha t-warn" tip={driftWords(d)}>{r.head} ≠</Hint>,
139
+ num.n0(r.ahead),
140
+ num.n0(r.behind),
141
+ num.n0(r.dirty),
142
+ (() => {
143
+ const g = gateWords(r.gate, st.now)
144
+ return <Hint className={`mcgate mcg-${g.tone}`} tip={g.tip}>{g.text}</Hint>
145
+ })(),
146
+ ],
147
+ }
148
+ })} />
149
+ <Activity st={st} n={n} />
150
+ <Processes st={st} n={n} machine={machine} />
151
+ </div>
152
+ ))
153
+
154
+ const MachineBlock = observer(({ st, m }: { st: MachinesSt; m: Machine }) => {
155
+ const open = st.opened.has(m.id)
156
+ const nodes = nodeOrder(m.nodes, st.notes)
157
+ const held = nodes.filter((n) => n.ended == null && n.report != null)
158
+ const gone = nodes.every((n) => n.ended != null)
159
+ return (
160
+ <section className={`mcmachine${gone ? ' gone' : ''}`} aria-label={m.name}>
161
+ {held.length === 0 ? (
162
+ <div className="mchead"><b>{m.name}</b></div>
163
+ ) : (
164
+ <button type="button" className="mchead" aria-expanded={open} onClick={() => st.toggle(m.id)}>
165
+ <Caret open={open} />
166
+ <b>{m.name}</b>
167
+ {isMine(m, st.data?.you ?? '') ? <span className="mcmine">this machine</span> : null}
168
+ </button>
169
+ )}
170
+ {nodes.map((n) => (
171
+ <div key={n.id}>
172
+ <NodeRow st={st} n={n} />
173
+ <NodeRest st={st} n={n} />
174
+ </div>
175
+ ))}
176
+ {open ? held.map((n) => <Repos key={n.id} st={st} n={n} many={held.length > 1} machine={m.name} />) : null}
177
+ </section>
178
+ )
179
+ })
180
+
181
+ /** the open asks of every machine, once each: an ask two machines hold through git is one line */
182
+ const Asks = observer(({ st }: { st: MachinesSt }) => {
183
+ const asks = st.asks
184
+ if (st.data?.asks == null) return null
185
+ const short = (repo: string): string => repo.split('/').at(-1) ?? repo
186
+ return (
187
+ <section className="mcasks" aria-label="open asks, every machine">
188
+ <div className="mchead"><b>open asks, every machine</b><span className="mcdim">{asks.length === 0 ? 'none' : `${asks.length} · in the console: sk asks --all`}</span></div>
189
+ {asks.map((a) => (
190
+ <div key={`${a.repo} ${a.name}`} className="mcask">
191
+ <span className="mcdim">{short(a.repo)} {a.number ?? ''}</span>
192
+ <span>{a.title}</span>
193
+ <span className="mcdim">{a.kind}{a.blocks !== '-' ? ` · blocks ${a.blocks}` : ''}{a.pinged != null ? ' · pinged' : ''} · on {a.machines.join(', ')}</span>
194
+ </div>
195
+ ))}
196
+ </section>
197
+ )
198
+ })
199
+
200
+ export const MachinesView = observer(({ app }: { app: HomeSt }) => {
201
+ const st = app.machines
202
+ const d = st.data
203
+ return (
204
+ <div className="hall machines">
205
+ <div className="actop">
206
+ <span className="acdim">{d == null ? (st.error !== '' ? '' : 'reading the hq…') : `${countWords(d.machines)} · read at ${clock(d.at)} · in the console: sk machines`}</span>
207
+ </div>
208
+ {st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
209
+ {d == null ? null : (
210
+ <div className="mcpage">
211
+ <section className={`mclook${st.notes.length === 0 ? ' calm' : ''}`} aria-label="what to look at">
212
+ {st.notes.length === 0 ? <p className="mcquiet">nothing to look at</p> : (
213
+ <ul className="mcnotes">
214
+ {st.notes.map((n) => <li key={`${n.node}\0${n.text}`}><i className="mcdot mcd-warn" />{n.text}</li>)}
215
+ </ul>
216
+ )}
217
+ </section>
218
+ {st.machines.map((m) => <MachineBlock key={m.id} st={st} m={m} />)}
219
+ <Asks st={st} />
220
+ </div>
221
+ )}
222
+ </div>
223
+ )
224
+ })
@@ -0,0 +1,76 @@
1
+ /* the machines page (machines-view.tsx): what to look at on top, then one block a machine and one row a daemon.
2
+ On a wide page a row's facts sit in columns that line up from machine to machine; on a phone they wrap under
3
+ the daemon's name. Colour is state only: green on, red silent, orange what a note is about. */
4
+ .machines{font-size:13px;container-type:inline-size}
5
+ .mcpage{max-width:1120px}
6
+ .mcerr{margin-bottom:var(--s3)}
7
+ .mcdim{color:var(--dim)}
8
+
9
+ /* what to look at: a band that holds the notes; with none, one quiet line */
10
+ .mclook{margin:0 0 var(--s4);padding:var(--s3) var(--s4);border:1px solid var(--line);border-left:3px solid var(--warn);border-radius:6px;background:var(--panel)}
11
+ .mclook.calm{padding:0;border:0;background:none}
12
+ .mcnotes{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:var(--s2)}
13
+ .mcnotes li{display:flex;align-items:baseline;gap:var(--s2);font-size:14px;line-height:1.4;color:var(--ink)}
14
+ .mcquiet{margin:0;color:var(--dim)}
15
+
16
+ /* a machine */
17
+ .mcmachine{margin-top:var(--s3);border:1px solid var(--line);border-radius:6px;background:var(--panel);overflow:hidden}
18
+ .mchead{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:var(--s2);width:100%;padding:var(--s2) var(--s3);cursor:pointer}
19
+ div.mchead{cursor:default}
20
+ .mchead b{font-size:15px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
21
+ .mchead:hover b{color:var(--accent)}
22
+ div.mchead:hover b{color:inherit}
23
+ .mchead:focus-visible{outline:1px solid var(--accent);outline-offset:-1px}
24
+ .mchead .caret{flex:none;color:var(--dim)}
25
+ .mcmine{flex:none;padding:0 var(--s2);border:1px solid var(--line);border-radius:999px;color:var(--dim);font-size:11.5px;line-height:18px}
26
+ .mcmachine.gone{opacity:.6}
27
+
28
+ /* a daemon: one row, its facts in columns */
29
+ .mcnode{display:grid;grid-template-columns:90px 120px 100px 225px 205px minmax(0,1fr);align-items:center;column-gap:var(--s3);padding:var(--s1) var(--s3);border-top:1px solid var(--hi3);white-space:nowrap;font-variant-numeric:tabular-nums}
30
+ .mcnode > span{min-width:0;overflow:hidden;text-overflow:ellipsis}
31
+ .mcwho{display:flex;align-items:center;gap:var(--s2);font-weight:600}
32
+ .mcstate b{font-weight:600}
33
+ .mc-silent .mcstate,.mc-never .mcstate{color:var(--red)}
34
+ .mc-ended{color:var(--dim)}
35
+ .mc-ended .mcwho,.mc-ended .mcstate b{font-weight:400}
36
+ .mcdisk{display:flex;align-items:center;gap:var(--s2)}
37
+ .mcdisk .tvspark{width:56px}
38
+ .mcrepos{color:var(--dim)}
39
+ .mcasks{margin-top:var(--s4);border:1px solid var(--line);border-radius:6px;background:var(--panel)}
40
+ .mcasks .mchead{display:flex;flex-wrap:wrap;gap:0 var(--s3);align-items:baseline;cursor:default}
41
+ .mcasks .mchead b{white-space:normal}
42
+ .mcask{display:grid;grid-template-columns:140px minmax(0,1fr) auto;column-gap:var(--s3);padding:var(--s1) var(--s3);border-top:1px solid var(--hi3)}
43
+ .mcask > span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
44
+ @media (max-width:720px){.mcask{display:flex;flex-wrap:wrap;gap:0 var(--s3)}.mcask > span{white-space:normal}}
45
+ .mcrest{display:grid;grid-template-columns:90px minmax(0,1fr);column-gap:var(--s3);padding:0 var(--s3) var(--s1);color:var(--dim);font-size:.92em}
46
+ .mcrest::before{content:''}
47
+ .mcrest > div{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s4);min-width:0}
48
+ @media (max-width:720px){.mcrest{display:block}}
49
+ .mcdot{display:inline-block;flex:none;width:8px;height:8px;border-radius:50%;background:var(--dim)}
50
+ .mcd-on{background:var(--ok)}
51
+ .mcd-silent,.mcd-never{background:var(--red)}
52
+ .mcd-warn{background:var(--warn);transform:translateY(-1px)}
53
+
54
+ /* a narrow page: each daemon's facts wrap under its name */
55
+ @container (max-width:900px){
56
+ .mcnode{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s3);padding:var(--s2) var(--s3)}
57
+ .mcwho{flex-basis:100%}
58
+ .mcnode > span{overflow:visible}
59
+ }
60
+
61
+ /* a machine opened on its repos */
62
+ .mcrepolist{padding:var(--s2) var(--s3) var(--s3);border-top:1px solid var(--hi3)}
63
+ .mcuser{margin:0 0 var(--s1);font-weight:600}
64
+ .mcrepolist .tvtable{width:auto;min-width:min(100%,560px)}
65
+ .mcrepolist .tvtable td,.mcrepolist .tvtable th{padding-right:var(--s4)}
66
+ .mcsha{font:12px ui-monospace,SFMono-Regular,Menlo,monospace}
67
+ .mcsub{margin-top:var(--s3)}
68
+ .mcsubhead{margin:0 0 var(--s1);color:var(--dim);font-size:12px}
69
+ .mctitle{display:inline-block;max-width:52ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
70
+ .mcg-ok{color:var(--ok)}
71
+ .mcg-warn{color:var(--warn)}
72
+ .mcg-red{color:var(--red)}
73
+ .mcg-dim{color:var(--dim)}
74
+ .mcurl{display:inline-flex;gap:var(--s2);align-items:baseline}
75
+ .mcdoor{color:var(--accent);text-decoration:none;white-space:nowrap}
76
+ .mcdoor:hover{text-decoration:underline}
@@ -0,0 +1,79 @@
1
+ // markdown a human copies values out of (an ask): the readme's type scale, every inline code span a chip that a
2
+ // click copies whole, every code block a « copy » button at its corner. A copy says so in a toast at the foot of the
3
+ // page and tints what was copied, never with added text, so nothing moves. The html is md.ts renderMd's, so sanitized
4
+ import { memo, useCallback, useEffect, useRef, useState } from 'react'
5
+ import { createPortal } from 'react-dom'
6
+ import { renderMd } from './md.ts'
7
+
8
+ const FLASH_MS = 1600
9
+ const SHOWN_MAX = 60
10
+
11
+ /** the copy that just happened tints the element itself for a moment */
12
+ const flash = (el: Element): void => {
13
+ el.classList.add('copied')
14
+ setTimeout(() => el.classList.remove('copied'), FLASH_MS)
15
+ }
16
+
17
+ export function CopyMd({ md, className = '' }: { md: string; className?: string }) {
18
+ const [said, setSaid] = useState<{ text: string; n: number } | null>(null)
19
+ useEffect(() => {
20
+ if (said == null) return
21
+ const t = setTimeout(() => setSaid(null), FLASH_MS)
22
+ return () => clearTimeout(t)
23
+ }, [said])
24
+ const copy = useCallback((text: string, el: Element): void => {
25
+ void navigator.clipboard.writeText(text).then(
26
+ () => {
27
+ flash(el)
28
+ const lines = text.trim().split('\n')
29
+ const first = lines[0] ?? ''
30
+ setSaid({ text: `copied: ${first.length > SHOWN_MAX ? `${first.slice(0, SHOWN_MAX)}…` : first}${lines.length > 1 ? ` (+${lines.length - 1} lines)` : ''}`, n: Date.now() })
31
+ },
32
+ () => setSaid({ text: 'the browser refused the clipboard: select the text and copy it by hand', n: Date.now() }),
33
+ )
34
+ }, [])
35
+ return (
36
+ <>
37
+ <MdBox html={renderMd(md)} className={className} copy={copy} />
38
+ {said != null ? createPortal(<div key={said.n} className="rv-toast" role="status">{said.text}</div>, document.body) : null}
39
+ </>
40
+ )
41
+ }
42
+
43
+ /** the markdown itself, drawn again only when its html changes: a render rewrites the html and would drop the copy
44
+ * buttons and the tint of what was just copied */
45
+ const MdBox = memo(({ html, className, copy }: { html: string; className: string; copy: (text: string, el: Element) => void }) => {
46
+ const box = useRef<HTMLDivElement | null>(null)
47
+ // a code block takes its button after each render of the html: the sanitizer keeps no button in the markup
48
+ useEffect(() => {
49
+ for (const pre of box.current?.querySelectorAll('pre') ?? []) {
50
+ if (pre.querySelector(':scope > .mdcopy')) continue
51
+ const b = document.createElement('button')
52
+ b.type = 'button'
53
+ b.className = 'mdcopy ghost'
54
+ b.textContent = 'copy'
55
+ b.title = 'copy the whole block'
56
+ pre.prepend(b)
57
+ }
58
+ }, [html])
59
+ return (
60
+ <div
61
+ ref={box}
62
+ className={`md readme-body mdcopyable ${className}`}
63
+ dangerouslySetInnerHTML={{ __html: html }}
64
+ onClick={(e) => {
65
+ const t = e.target as Element
66
+ const btn = t.closest('.mdcopy')
67
+ const pre = btn?.parentElement
68
+ if (btn && pre) {
69
+ copy(pre.querySelector('code')?.textContent ?? '', pre)
70
+ return
71
+ }
72
+ const code = t.closest('code')
73
+ // a selection being made is never overwritten by a click's copy
74
+ if (!code || code.closest('pre') || String(globalThis.getSelection?.() ?? '') !== '') return
75
+ copy(code.textContent ?? '', code)
76
+ }}
77
+ />
78
+ )
79
+ })
@@ -11,6 +11,7 @@ import { isAud, type MediaSvc } from './media-svc.ts'
11
11
  import { GeometryLayer, Rectbar, measureBox, type Box } from './geometry-view.tsx'
12
12
  import type { CatRow, CustomPanelRef } from './hub-types.ts'
13
13
  import { Caret } from './icons.tsx'
14
+ import { ThreadControl } from './review/thread-control.tsx'
14
15
 
15
16
  const TEX = 1024
16
17
  const MIX_UNIT = 24
@@ -38,6 +39,7 @@ export const MediaTopbar = observer(({ app }: { app: RepoSt }) => {
38
39
  </div>}
39
40
  </div>
40
41
  <div className="toolbar">
42
+ {m.curId != null ? <ThreadControl st={app} address={`media:${m.curId}`} name={m.curId} /> : null}
41
43
  {!manual ? <button disabled={m.curId == null} onClick={() => void m.generate()}>Generate</button> : null}
42
44
  {!manual ? (
43
45
  <label className="xn" title="rolls per generate">×