rvlib-shipkit 2.26.0 → 2.28.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 (605) hide show
  1. package/CHANGELOG.md +36 -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 +16 -7
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +12 -8
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/registry.ts +289 -0
  11. package/src/agent-time/render.ts +122 -21
  12. package/src/agent-time/report-cache.ts +57 -0
  13. package/src/agent-time/report.ts +314 -40
  14. package/src/agent-time/shape.ts +50 -3
  15. package/src/agent-time/store.ts +322 -101
  16. package/src/agent-time/timeline.ts +140 -21
  17. package/src/agent-time/turns.ts +18 -8
  18. package/src/annex/born.ts +2 -2
  19. package/src/annex/offload.ts +29 -17
  20. package/src/annex/tidy.ts +70 -10
  21. package/src/asks/ask-after.ts +44 -0
  22. package/src/asks/ask-bar-fold.ts +57 -0
  23. package/src/asks/ask-migrate.ts +280 -0
  24. package/src/asks/ask-steps-fold.ts +166 -0
  25. package/src/asks/ask-store.ts +586 -0
  26. package/src/assets/kit-config.ts +7 -3
  27. package/src/assets/kits/identity-kit.ts +361 -14
  28. package/src/assets/kits/poster-thumbnail.ts +282 -0
  29. package/src/check.ts +3 -1
  30. package/src/checks/SK003-claude-md-shape.check.ts +92 -25
  31. package/src/checks/SK004-gitignore-policy.check.ts +20 -9
  32. package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
  33. package/src/checks/SK026-asks-autoclose.check.ts +9 -23
  34. package/src/checks/SK028-readme.check.ts +7 -66
  35. package/src/checks/SK030-cache-audit.check.ts +6 -1
  36. package/src/checks/SK031-trace-audit.check.ts +2 -0
  37. package/src/checks/SK033-global-contribution.check.ts +3 -1
  38. package/src/checks/SK035-public-clean.check.ts +2 -2
  39. package/src/checks/SK038-speaks-as.check.ts +3 -3
  40. package/src/checks/SK042-post-kinds.check.ts +26 -24
  41. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  42. package/src/checks/SK047-login-in-description.check.ts +36 -0
  43. package/src/checks/SK048-one-local-file.check.ts +36 -0
  44. package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
  45. package/src/checks/SK050-retired-commands.check.ts +127 -0
  46. package/src/cli/cmd_Asks.ts +244 -27
  47. package/src/cli/cmd_Backup.ts +153 -10
  48. package/src/cli/cmd_Calls.ts +1 -0
  49. package/src/cli/cmd_Capacity.ts +2 -2
  50. package/src/cli/cmd_Commands.ts +140 -34
  51. package/src/cli/cmd_Contracts.ts +1 -0
  52. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  53. package/src/cli/cmd_Db.ts +253 -0
  54. package/src/cli/cmd_History.ts +212 -0
  55. package/src/cli/cmd_Home.ts +31 -3
  56. package/src/cli/cmd_Hq.ts +516 -0
  57. package/src/cli/cmd_Keys.ts +1 -0
  58. package/src/cli/cmd_Lanes.ts +15 -4
  59. package/src/cli/cmd_Machines.ts +36 -0
  60. package/src/cli/cmd_Media.ts +38 -6
  61. package/src/cli/cmd_Messages.ts +152 -1
  62. package/src/cli/cmd_Needs.ts +1 -0
  63. package/src/cli/cmd_Reflect.ts +23 -2
  64. package/src/cli/cmd_Review.ts +1357 -223
  65. package/src/cli/cmd_Secret.ts +295 -24
  66. package/src/cli/cmd_Social.ts +113 -28
  67. package/src/cli/cmd_SocialDrafts.ts +235 -0
  68. package/src/cli/cmd_Sound.ts +22 -1
  69. package/src/cli/cmd_Space.ts +324 -0
  70. package/src/cli/cmd_Start.ts +3 -2
  71. package/src/cli/cmd_ThreadHolds.ts +34 -0
  72. package/src/cli/cmd_ThreadKinds.ts +146 -0
  73. package/src/cli/cmd_ThreadReflect.ts +83 -0
  74. package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
  75. package/src/cli/cmd_Time.ts +76 -5
  76. package/src/cli/cmd_Tmp.ts +28 -4
  77. package/src/cli/cmd_Trailer.ts +14 -10
  78. package/src/cli/cmd_Urls.ts +56 -0
  79. package/src/cli/cmd_Vault.ts +583 -0
  80. package/src/cli/cmd_When.ts +1 -0
  81. package/src/cli/family-help.ts +5 -3
  82. package/src/cli/family-pages.ts +1 -1
  83. package/src/cli/kit/builtins.ts +1 -0
  84. package/src/cli/kit/verb.ts +6 -2
  85. package/src/cli/registry.ts +44 -4
  86. package/src/cli.ts +5 -2
  87. package/src/collections/actions.ts +42 -41
  88. package/src/collections/collection-types.ts +30 -4
  89. package/src/collections/md-body.ts +5 -3
  90. package/src/collections/pings.ts +13 -6
  91. package/src/collections/providers.ts +147 -61
  92. package/src/collections/reflections.ts +9 -4
  93. package/src/collections/review.ts +4 -4
  94. package/src/contracts/contract-manifests.ts +6 -5
  95. package/src/contracts/contract-types.ts +6 -4
  96. package/src/contracts/contracts-engine.ts +11 -0
  97. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  98. package/src/core/budget.ts +12 -17
  99. package/src/core/capacity.ts +27 -18
  100. package/src/core/check-runner.ts +7 -4
  101. package/src/core/discover-checks.ts +18 -3
  102. package/src/core/git.ts +31 -0
  103. package/src/core/house-layout.ts +17 -0
  104. package/src/core/layout.ts +13 -5
  105. package/src/core/locked-write.ts +4 -1
  106. package/src/core/machine-busy.ts +127 -0
  107. package/src/core/machine-commit.ts +6 -1
  108. package/src/core/machine-db.ts +370 -20
  109. package/src/core/machine-layout.ts +137 -0
  110. package/src/core/machine-read.ts +81 -0
  111. package/src/core/migrate-layout.ts +9 -11
  112. package/src/core/one-way-in-policy.ts +64 -7
  113. package/src/core/polling-policy.ts +27 -0
  114. package/src/core/retention.ts +16 -2
  115. package/src/core/scope.ts +107 -14
  116. package/src/core/slots.ts +5 -4
  117. package/src/drill/clean.ts +25 -1
  118. package/src/drill/run.ts +1 -1
  119. package/src/drill/seal.ts +27 -4
  120. package/src/home/activity-shape.ts +2 -0
  121. package/src/home/activity.ts +59 -3
  122. package/src/home/app-sign.ts +15 -4
  123. package/src/home/daemon-jobs.ts +161 -7
  124. package/src/home/database-projects.ts +111 -0
  125. package/src/home/database-words.ts +203 -0
  126. package/src/home/databases.ts +460 -0
  127. package/src/home/global-units.ts +6 -0
  128. package/src/home/gui-app/ShipkitGui.swift +122 -1
  129. package/src/home/gui-app.ts +6 -3
  130. package/src/home/home-move.ts +514 -0
  131. package/src/home/home-paths.ts +18 -6
  132. package/src/home/home-routes.ts +76 -0
  133. package/src/home/inbox-shape.ts +234 -91
  134. package/src/home/inbox.ts +26 -71
  135. package/src/home/machine-fold.ts +815 -0
  136. package/src/home/machine-host.ts +38 -5
  137. package/src/home/machine-repair.ts +503 -0
  138. package/src/home/machine-stores.ts +66 -15
  139. package/src/home/machine-temp.ts +547 -86
  140. package/src/home/other-macs.ts +2 -2
  141. package/src/home/resume.ts +79 -0
  142. package/src/home/run-daemon.ts +25 -4
  143. package/src/home/run-pm.ts +18 -5
  144. package/src/home/serve-daemon.ts +18 -3
  145. package/src/home/serve-web.ts +179 -10
  146. package/src/home/space-job.ts +115 -0
  147. package/src/home/space-page.ts +257 -0
  148. package/src/home/space-route.ts +167 -0
  149. package/src/home/space-words.ts +103 -0
  150. package/src/home/time-page-shape.ts +202 -0
  151. package/src/home/time-page.ts +64 -0
  152. package/src/home/vault-page.ts +516 -0
  153. package/src/home/vault-words.ts +132 -0
  154. package/src/hooks/leak-guard.ts +40 -13
  155. package/src/hooks/one-way-in-guard.ts +41 -6
  156. package/src/hq/cards.ts +581 -0
  157. package/src/hq/door-route.ts +43 -0
  158. package/src/hq/door.ts +163 -0
  159. package/src/hq/files-send.ts +347 -0
  160. package/src/hq/forgotten-log.ts +35 -0
  161. package/src/hq/history-check.ts +255 -0
  162. package/src/hq/history-place.ts +146 -0
  163. package/src/hq/history-send.ts +487 -0
  164. package/src/hq/hq-db.ts +102 -0
  165. package/src/hq/hq-local.ts +502 -0
  166. package/src/hq/hq-routes.ts +204 -0
  167. package/src/hq/hq-store.ts +603 -0
  168. package/src/hq/kinds/ask.ts +147 -0
  169. package/src/hq/kinds/card-gone.ts +83 -0
  170. package/src/hq/kinds/card-msg.ts +66 -0
  171. package/src/hq/kinds/card.ts +99 -0
  172. package/src/hq/kinds/index.ts +21 -0
  173. package/src/hq/kinds/kind.ts +126 -0
  174. package/src/hq/kinds/media.ts +125 -0
  175. package/src/hq/kinds/prompt.ts +219 -0
  176. package/src/hq/kinds/reflection.ts +128 -0
  177. package/src/hq/kinds/report.ts +55 -0
  178. package/src/hq/kinds/time-day.ts +236 -0
  179. package/src/hq/ledger.ts +473 -0
  180. package/src/hq/machine-key.ts +44 -0
  181. package/src/hq/machine-notes.ts +131 -0
  182. package/src/hq/outbox.ts +374 -0
  183. package/src/hq/replica.ts +167 -0
  184. package/src/hq/repo-id.ts +4 -0
  185. package/src/hq/report-facts.ts +117 -0
  186. package/src/hq/report.ts +274 -0
  187. package/src/hq/switch.ts +151 -0
  188. package/src/hq/vault-grant.ts +92 -0
  189. package/src/hq/vault-route.ts +112 -0
  190. package/src/identities/collection.ts +2 -2
  191. package/src/identities/identities.ts +24 -11
  192. package/src/identities/machine-route.ts +8 -3
  193. package/src/identities/steps.ts +31 -0
  194. package/src/ledger/db.ts +81 -27
  195. package/src/ledger/gate-checks.ts +6 -2
  196. package/src/ledger/run-log.ts +11 -3
  197. package/src/ledger/store.ts +26 -4
  198. package/src/media-store/backup/daemon.ts +73 -25
  199. package/src/media-store/backup/kept.ts +241 -0
  200. package/src/media-store/backup/keys.ts +1 -1
  201. package/src/media-store/backup/manifest.ts +20 -2
  202. package/src/media-store/backup/prune.ts +365 -0
  203. package/src/media-store/backup/restore.ts +14 -4
  204. package/src/media-store/backup/retention.ts +122 -0
  205. package/src/media-store/backup/run.ts +25 -19
  206. package/src/media-store/backup/secret.ts +6 -4
  207. package/src/media-store/backup/snapshot.ts +4 -2
  208. package/src/media-store/backup/sources.ts +83 -31
  209. package/src/media-store/backup/thread-copy.ts +340 -0
  210. package/src/media-store/copy/config.ts +76 -0
  211. package/src/media-store/copy/copy.ts +194 -0
  212. package/src/media-store/copy/lifecycle.ts +43 -0
  213. package/src/media-store/copy/night.ts +90 -0
  214. package/src/media-store/copy/proof.ts +151 -0
  215. package/src/media-store/copy/snapshot.ts +152 -0
  216. package/src/media-store/copy/store.ts +62 -0
  217. package/src/media-store/copy/stream.ts +176 -0
  218. package/src/media-store/daemon.ts +66 -16
  219. package/src/media-store/db.ts +24 -13
  220. package/src/media-store/forget.ts +141 -3
  221. package/src/media-store/hand.ts +4 -3
  222. package/src/media-store/hq-find.ts +75 -0
  223. package/src/media-store/hq-send.ts +277 -0
  224. package/src/media-store/kind.ts +2 -0
  225. package/src/media-store/purge.ts +21 -17
  226. package/src/media-store/put.ts +24 -8
  227. package/src/media-store/remote.ts +16 -7
  228. package/src/media-store/space-listing.ts +256 -0
  229. package/src/media-store/space.ts +46 -26
  230. package/src/media-store/sync.ts +5 -5
  231. package/src/media-store/tidy.ts +98 -0
  232. package/src/media-store/upload.ts +3 -3
  233. package/src/media-store/webp.ts +66 -0
  234. package/src/messages/guard.ts +49 -0
  235. package/src/messages/model.ts +16 -7
  236. package/src/messages/objects.ts +201 -0
  237. package/src/messages/routes.ts +14 -4
  238. package/src/messages/score.ts +3 -3
  239. package/src/messages/write.ts +285 -0
  240. package/src/pages/frame-client.ts +191 -4
  241. package/src/plan/planner.ts +28 -17
  242. package/src/recordings/media-kind.ts +1 -0
  243. package/src/recordings/model.ts +1 -1
  244. package/src/recordings/recorder-app/Capture.swift +9 -7
  245. package/src/reflect/hq-corpus.ts +56 -0
  246. package/src/reflect/prompt-corpus.ts +3 -1
  247. package/src/reflect/transcript.ts +129 -37
  248. package/src/reflections/reflections-queue.ts +1 -1
  249. package/src/release/gate-checkout.ts +2 -1
  250. package/src/release/git-facts.ts +3 -2
  251. package/src/release/machine-words.ts +67 -0
  252. package/src/release/public-clean.ts +11 -5
  253. package/src/releases/from-card.ts +1 -1
  254. package/src/releases/routes.ts +10 -5
  255. package/src/releases/store.ts +10 -1
  256. package/src/repo-config.ts +71 -19
  257. package/src/review/anim.ts +3 -3
  258. package/src/review/answer-kinds.ts +131 -0
  259. package/src/review/auto.ts +2 -2
  260. package/src/review/band.ts +53 -0
  261. package/src/review/branch-hold.ts +84 -0
  262. package/src/review/card-db.ts +254 -0
  263. package/src/review/card-rows.ts +267 -0
  264. package/src/review/cells.ts +360 -57
  265. package/src/review/close.ts +92 -0
  266. package/src/review/draft-card.ts +33 -0
  267. package/src/review/draft-model.ts +78 -0
  268. package/src/review/events.ts +171 -0
  269. package/src/review/format.ts +152 -19
  270. package/src/review/glyphs.ts +63 -0
  271. package/src/review/gone.ts +98 -0
  272. package/src/review/holds-sync.ts +62 -0
  273. package/src/review/holds.ts +85 -0
  274. package/src/review/house-kind-defs.ts +41 -0
  275. package/src/review/inbox-hook.ts +23 -10
  276. package/src/review/inbox-read.ts +201 -0
  277. package/src/review/instructions.ts +199 -0
  278. package/src/review/kind-apply.ts +61 -0
  279. package/src/review/kind-catalog.ts +96 -0
  280. package/src/review/kinds.ts +278 -0
  281. package/src/review/lane-ask.ts +109 -0
  282. package/src/review/marks.ts +1 -1
  283. package/src/review/media-kind.ts +7 -5
  284. package/src/review/media-read.ts +9 -7
  285. package/src/review/media.ts +32 -5
  286. package/src/review/model.ts +582 -109
  287. package/src/review/move.ts +491 -0
  288. package/src/review/need-address.ts +15 -0
  289. package/src/review/need-threads.ts +93 -0
  290. package/src/review/notes.ts +12 -20
  291. package/src/review/object-card.ts +48 -0
  292. package/src/review/object-read.ts +31 -0
  293. package/src/review/owner-verdict.ts +36 -0
  294. package/src/review/parties.ts +182 -0
  295. package/src/review/previews.ts +18 -20
  296. package/src/review/project.ts +1 -1
  297. package/src/review/projections.ts +235 -0
  298. package/src/review/referring.ts +54 -0
  299. package/src/review/reflection-object.ts +195 -0
  300. package/src/review/rev.ts +8 -0
  301. package/src/review/role.ts +1 -1
  302. package/src/review/routes.ts +194 -38
  303. package/src/review/secret-route.ts +80 -0
  304. package/src/review/snooze.ts +38 -0
  305. package/src/review/stage-card.ts +12 -8
  306. package/src/review/stage-routes.ts +1 -1
  307. package/src/review/store.ts +851 -124
  308. package/src/review/supersede.ts +116 -0
  309. package/src/review/take-back.ts +52 -0
  310. package/src/review/thread-fold.ts +64 -0
  311. package/src/review/threads.ts +349 -14
  312. package/src/review/traces.ts +218 -0
  313. package/src/review/trailer-auto-mock.ts +63 -0
  314. package/src/review/trailer-card.ts +6 -6
  315. package/src/review/trailer-desk.ts +41 -7
  316. package/src/review/trailer-media.ts +1 -0
  317. package/src/review/trailer-model.ts +8 -0
  318. package/src/review/trailer-notes.ts +1 -1
  319. package/src/review/trailer-routes.ts +9 -1
  320. package/src/review/unit.ts +77 -11
  321. package/src/review/verdict-items.ts +73 -0
  322. package/src/review/verdict-write.ts +15 -0
  323. package/src/review/wait.ts +85 -0
  324. package/src/review/watchers.ts +23 -10
  325. package/src/rules/untrack-generated.ts +92 -8
  326. package/src/scaffold/files/claude-settings-local.json +2 -0
  327. package/src/secrets/archive-mark.ts +52 -0
  328. package/src/secrets/archive.ts +83 -0
  329. package/src/secrets/copy.ts +14 -14
  330. package/src/secrets/held.ts +16 -0
  331. package/src/secrets/keychain-write.ts +48 -0
  332. package/src/secrets/keychain.ts +116 -0
  333. package/src/secrets/lapse-mark.ts +33 -0
  334. package/src/secrets/lapse.ts +60 -0
  335. package/src/secrets/list.ts +21 -17
  336. package/src/secrets/manager.ts +55 -26
  337. package/src/secrets/read.ts +385 -0
  338. package/src/secrets/tail.ts +31 -0
  339. package/src/secrets/who-reads.ts +49 -0
  340. package/src/serve/door-forward.ts +268 -0
  341. package/src/serve/door-names.ts +47 -0
  342. package/src/serve/embed.ts +1 -1
  343. package/src/serve/hub-app/activity-view.tsx +56 -32
  344. package/src/serve/hub-app/activity.css +7 -1
  345. package/src/serve/hub-app/asks-page.tsx +49 -0
  346. package/src/serve/hub-app/asks-st.ts +25 -0
  347. package/src/serve/hub-app/auto-text.tsx +14 -6
  348. package/src/serve/hub-app/benign-errors.ts +15 -1
  349. package/src/serve/hub-app/card-head.tsx +49 -0
  350. package/src/serve/hub-app/check-view.tsx +3 -2
  351. package/src/serve/hub-app/clock-svc.ts +1 -2
  352. package/src/serve/hub-app/code-copy.ts +35 -0
  353. package/src/serve/hub-app/col-card.tsx +72 -30
  354. package/src/serve/hub-app/col-list-page.tsx +125 -0
  355. package/src/serve/hub-app/col-list-st.ts +103 -0
  356. package/src/serve/hub-app/col-tables-view.tsx +17 -45
  357. package/src/serve/hub-app/col-tables.ts +76 -8
  358. package/src/serve/hub-app/cols-svc.ts +18 -39
  359. package/src/serve/hub-app/commands/commands-page.tsx +2 -1
  360. package/src/serve/hub-app/controls.css +83 -0
  361. package/src/serve/hub-app/database-st.ts +260 -0
  362. package/src/serve/hub-app/database-view.tsx +289 -0
  363. package/src/serve/hub-app/database.css +32 -0
  364. package/src/serve/hub-app/entry-bar.css +14 -0
  365. package/src/serve/hub-app/entry-bar.tsx +33 -0
  366. package/src/serve/hub-app/entry-pick.ts +31 -0
  367. package/src/serve/hub-app/floating.tsx +1 -0
  368. package/src/serve/hub-app/frames-st.ts +17 -1
  369. package/src/serve/hub-app/git-view.tsx +3 -2
  370. package/src/serve/hub-app/hash-route.ts +11 -1
  371. package/src/serve/hub-app/header-bar.tsx +14 -18
  372. package/src/serve/hub-app/home-st.ts +142 -11
  373. package/src/serve/hub-app/home-strip.css +6 -25
  374. package/src/serve/hub-app/home-strip.tsx +60 -93
  375. package/src/serve/hub-app/home.html +10 -0
  376. package/src/serve/hub-app/house-wiki-view.tsx +20 -0
  377. package/src/serve/hub-app/hub-app.tsx +71 -166
  378. package/src/serve/hub-app/hub-types.ts +5 -1
  379. package/src/serve/hub-app/hub.css +146 -71
  380. package/src/serve/hub-app/icons.tsx +32 -5
  381. package/src/serve/hub-app/identities-st.ts +56 -6
  382. package/src/serve/hub-app/identities-view.tsx +104 -61
  383. package/src/serve/hub-app/identities.css +17 -15
  384. package/src/serve/hub-app/identity-address.ts +5 -0
  385. package/src/serve/hub-app/inbox-st.ts +227 -49
  386. package/src/serve/hub-app/inbox-view.tsx +204 -120
  387. package/src/serve/hub-app/inbox.css +47 -47
  388. package/src/serve/hub-app/index.html +10 -0
  389. package/src/serve/hub-app/instructions.css +30 -0
  390. package/src/serve/hub-app/kept-cols.tsx +7 -0
  391. package/src/serve/hub-app/keys.ts +32 -17
  392. package/src/serve/hub-app/later.tsx +26 -0
  393. package/src/serve/hub-app/list-filter.tsx +14 -0
  394. package/src/serve/hub-app/list-walk.ts +72 -3
  395. package/src/serve/hub-app/machine-st.ts +2 -2
  396. package/src/serve/hub-app/machines-st.ts +251 -0
  397. package/src/serve/hub-app/machines-view.tsx +217 -0
  398. package/src/serve/hub-app/machines.css +67 -0
  399. package/src/serve/hub-app/markdown.css +51 -0
  400. package/src/serve/hub-app/md-copy.tsx +57 -0
  401. package/src/serve/hub-app/md.ts +25 -9
  402. package/src/serve/hub-app/media-view.tsx +4 -2
  403. package/src/serve/hub-app/messages/messages-page.tsx +81 -8
  404. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  405. package/src/serve/hub-app/messages.css +14 -1
  406. package/src/serve/hub-app/objects.css +51 -0
  407. package/src/serve/hub-app/page-keys.ts +175 -0
  408. package/src/serve/hub-app/pages-frames.tsx +21 -3
  409. package/src/serve/hub-app/palette-st.ts +58 -11
  410. package/src/serve/hub-app/palette-view.tsx +3 -1
  411. package/src/serve/hub-app/pane-boundary.tsx +72 -0
  412. package/src/serve/hub-app/pane-errors.ts +54 -0
  413. package/src/serve/hub-app/plan-view.tsx +3 -2
  414. package/src/serve/hub-app/planned-view.tsx +3 -3
  415. package/src/serve/hub-app/planned.css +0 -4
  416. package/src/serve/hub-app/processes-view.tsx +3 -2
  417. package/src/serve/hub-app/project-list.css +46 -8
  418. package/src/serve/hub-app/project-list.tsx +125 -59
  419. package/src/serve/hub-app/projects-svc.ts +83 -8
  420. package/src/serve/hub-app/reader-chips.tsx +13 -0
  421. package/src/serve/hub-app/readme-view.tsx +2 -3
  422. package/src/serve/hub-app/readme.css +22 -6
  423. package/src/serve/hub-app/reflections-page.tsx +95 -0
  424. package/src/serve/hub-app/reflections-st.ts +17 -0
  425. package/src/serve/hub-app/releases/releases-page.tsx +28 -4
  426. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  427. package/src/serve/hub-app/releases.css +0 -1
  428. package/src/serve/hub-app/repo-sections.ts +9 -5
  429. package/src/serve/hub-app/repo-st.ts +35 -8
  430. package/src/serve/hub-app/review/code-colors.ts +30 -0
  431. package/src/serve/hub-app/review/diff-view.tsx +75 -0
  432. package/src/serve/hub-app/review/dock.tsx +104 -0
  433. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  434. package/src/serve/hub-app/review/group-block.tsx +209 -0
  435. package/src/serve/hub-app/review/instructions-view.tsx +116 -0
  436. package/src/serve/hub-app/review/item-verdict.tsx +38 -0
  437. package/src/serve/hub-app/review/kind-states.tsx +193 -0
  438. package/src/serve/hub-app/review/kind-view.tsx +1 -37
  439. package/src/serve/hub-app/review/kit.tsx +75 -29
  440. package/src/serve/hub-app/review/lane-bar.tsx +64 -0
  441. package/src/serve/hub-app/review/note-place.ts +1 -1
  442. package/src/serve/hub-app/review/object-card.tsx +62 -0
  443. package/src/serve/hub-app/review/object-panel.tsx +179 -0
  444. package/src/serve/hub-app/review/question-views.tsx +385 -0
  445. package/src/serve/hub-app/review/review-board.tsx +2 -2
  446. package/src/serve/hub-app/review/review-cells.tsx +148 -87
  447. package/src/serve/hub-app/review/review-kit.ts +27 -1
  448. package/src/serve/hub-app/review/review-list.tsx +160 -65
  449. package/src/serve/hub-app/review/review-page.tsx +12 -12
  450. package/src/serve/hub-app/review/review-st.ts +174 -47
  451. package/src/serve/hub-app/review/review-thread.tsx +214 -53
  452. package/src/serve/hub-app/review/review-views.tsx +494 -159
  453. package/src/serve/hub-app/review/thread-close.tsx +124 -0
  454. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  455. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  456. package/src/serve/hub-app/review/thread-st.ts +288 -41
  457. package/src/serve/hub-app/review/trailer-card.tsx +2 -2
  458. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  459. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  460. package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
  461. package/src/serve/hub-app/review.css +462 -97
  462. package/src/serve/hub-app/section-head.tsx +51 -0
  463. package/src/serve/hub-app/side-lists.ts +72 -0
  464. package/src/serve/hub-app/sidebar.tsx +6 -3
  465. package/src/serve/hub-app/site/site-part.tsx +2 -8
  466. package/src/serve/hub-app/site/site-st.ts +4 -4
  467. package/src/serve/hub-app/social/calendar.tsx +5 -11
  468. package/src/serve/hub-app/social/comms-page.tsx +43 -15
  469. package/src/serve/hub-app/social/kit.tsx +32 -13
  470. package/src/serve/hub-app/social/next-release.tsx +3 -5
  471. package/src/serve/hub-app/social/post-card.tsx +142 -49
  472. package/src/serve/hub-app/social/post-page.tsx +80 -0
  473. package/src/serve/hub-app/social/problems.tsx +5 -9
  474. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  475. package/src/serve/hub-app/social/social-model.ts +24 -5
  476. package/src/serve/hub-app/social/social-page.tsx +95 -36
  477. package/src/serve/hub-app/social/social-st.ts +162 -41
  478. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  479. package/src/serve/hub-app/social/stage-st.ts +1 -1
  480. package/src/serve/hub-app/social/step-layout.ts +1 -1
  481. package/src/serve/hub-app/social.css +10 -17
  482. package/src/serve/hub-app/space-st.ts +209 -0
  483. package/src/serve/hub-app/space-view.tsx +196 -0
  484. package/src/serve/hub-app/space.css +27 -0
  485. package/src/serve/hub-app/stores/stores-page.tsx +97 -25
  486. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  487. package/src/serve/hub-app/stores.css +6 -1
  488. package/src/serve/hub-app/theme-st.ts +22 -9
  489. package/src/serve/hub-app/thread-row.tsx +101 -0
  490. package/src/serve/hub-app/time-ago.tsx +3 -2
  491. package/src/serve/hub-app/time-charts.tsx +291 -0
  492. package/src/serve/hub-app/time-pages.tsx +749 -0
  493. package/src/serve/hub-app/time-st.ts +162 -0
  494. package/src/serve/hub-app/time-view.tsx +77 -0
  495. package/src/serve/hub-app/time.css +135 -0
  496. package/src/serve/hub-app/tree-build.ts +52 -42
  497. package/src/serve/hub-app/tree-row.tsx +3 -11
  498. package/src/serve/hub-app/tree-svc.ts +18 -9
  499. package/src/serve/hub-app/urls-svc.ts +154 -0
  500. package/src/serve/hub-app/urls-view.tsx +117 -0
  501. package/src/serve/hub-app/urls.css +30 -0
  502. package/src/serve/hub-app/vault-st.ts +127 -0
  503. package/src/serve/hub-app/vault-view.tsx +154 -0
  504. package/src/serve/hub-app/vault.css +38 -0
  505. package/src/serve/hub-app/veille/veille-page.tsx +2 -11
  506. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  507. package/src/serve/hub-app/veille.css +0 -1
  508. package/src/serve/hub-app/waiting-svc.ts +29 -0
  509. package/src/serve/hub-app/when-view.tsx +6 -3
  510. package/src/serve/hub-app/wiki-st.ts +30 -4
  511. package/src/serve/hub-app/wikis-view.tsx +6 -5
  512. package/src/serve/hub-runtime.ts +35 -8
  513. package/src/serve/project-gutter-route.ts +42 -19
  514. package/src/serve/project-gutter.ts +16 -50
  515. package/src/serve/same-origin.ts +13 -0
  516. package/src/serve/secret-gate.ts +21 -0
  517. package/src/serve/serve-hub.ts +38 -20
  518. package/src/serve/tailnet-caller.ts +117 -0
  519. package/src/shipkit-files.ts +16 -2
  520. package/src/shipkit.ts +3 -3
  521. package/src/shot/shooter.ts +616 -420
  522. package/src/shot/shot-ask.ts +246 -155
  523. package/src/site/desk.ts +4 -4
  524. package/src/smoke/run-smoke.ts +6 -6
  525. package/src/social/brands.ts +4 -0
  526. package/src/social/card-drafts.ts +11 -19
  527. package/src/social/cover.ts +202 -0
  528. package/src/social/desk-index.ts +34 -13
  529. package/src/social/discord-layout.ts +37 -13
  530. package/src/social/drafts.ts +7 -4
  531. package/src/social/import-drafts.ts +244 -0
  532. package/src/social/kind-pages.ts +3 -3
  533. package/src/social/kinds.ts +1 -1
  534. package/src/social/load.ts +111 -65
  535. package/src/social/media-kind.ts +68 -160
  536. package/src/social/media-of.ts +5 -4
  537. package/src/social/open.ts +3 -2
  538. package/src/social/post-object.ts +120 -0
  539. package/src/social/post-sources.ts +136 -0
  540. package/src/social/post-text.ts +103 -0
  541. package/src/social/posts.ts +378 -0
  542. package/src/social/presence.ts +7 -5
  543. package/src/social/publish/discord.ts +5 -2
  544. package/src/social/publish/index.ts +17 -5
  545. package/src/social/publish/secret.ts +4 -4
  546. package/src/social/release-stage.ts +79 -63
  547. package/src/social/routes.ts +89 -24
  548. package/src/social/stage.ts +43 -58
  549. package/src/social/stats.ts +12 -9
  550. package/src/social/strip.ts +4 -1
  551. package/src/social/text.ts +4 -3
  552. package/src/social/thumbnail.ts +347 -0
  553. package/src/social/tracker.ts +1 -1
  554. package/src/social/writes.ts +12 -29
  555. package/src/stores/collection.ts +15 -11
  556. package/src/stores/desk.ts +246 -47
  557. package/src/stores/model.ts +72 -6
  558. package/src/stores/routes.ts +37 -12
  559. package/src/stores/unit.ts +16 -10
  560. package/src/suite/judge-suites.ts +41 -11
  561. package/src/suite/select.ts +45 -3
  562. package/src/suite/suite-cli.ts +16 -10
  563. package/src/trailer/bed.ts +1 -1
  564. package/src/trailer/build.ts +134 -21
  565. package/src/trailer/ffmpeg.ts +7 -0
  566. package/src/trailer/fonts.ts +3 -2
  567. package/src/trailer/grammar.ts +201 -2
  568. package/src/trailer/graph.ts +42 -5
  569. package/src/trailer/look.ts +21 -0
  570. package/src/trailer/mock.ts +154 -0
  571. package/src/trailer/passage.ts +65 -26
  572. package/src/trailer/score/heard.ts +89 -0
  573. package/src/trailer/score/sound.ts +14 -8
  574. package/src/trailer/sound/eleven.ts +33 -3
  575. package/src/trailer/sound/run.ts +16 -6
  576. package/src/trailer/stitch.ts +26 -5
  577. package/src/trailer/titles.ts +82 -19
  578. package/src/trailer/versions.ts +1 -3
  579. package/src/trailer/vertical.ts +3 -1
  580. package/src/urls/frame.ts +195 -0
  581. package/src/urls/routes.ts +43 -0
  582. package/src/urls/rows.ts +171 -0
  583. package/src/urls/unit.ts +73 -0
  584. package/src/vault/house-keys.ts +42 -0
  585. package/src/vault/layout.ts +50 -0
  586. package/src/vault/policy.ts +165 -0
  587. package/src/vault/vault-audit.ts +276 -0
  588. package/src/vault/vault-client.ts +40 -0
  589. package/src/vault/vault-config.ts +159 -0
  590. package/src/vault/vault-destroy.ts +78 -0
  591. package/src/vault/vault-handover.ts +305 -0
  592. package/src/vault/vault-http.ts +360 -0
  593. package/src/vault/vault-import.ts +213 -0
  594. package/src/vault/vault-init.ts +328 -0
  595. package/src/vault/vault-minter.ts +271 -0
  596. package/src/vault/vault-restore.ts +333 -0
  597. package/src/vault/vault-serve.ts +342 -0
  598. package/src/vault/vault-snapshot.ts +281 -0
  599. package/src/veille/asks.ts +1 -1
  600. package/src/veille/desk.ts +2 -2
  601. package/src/veille/identity.ts +2 -2
  602. package/src/wiki/graph-pages.ts +13 -1
  603. package/src/wiki/scan-md.ts +1 -1
  604. package/src/asks/asks-queue.ts +0 -266
  605. package/src/social/migrate.ts +0 -123
@@ -0,0 +1,516 @@
1
+ // sk hq: the owner's acts on the hq (wiki tools/shipkit/hq.md): open the one this machine carries to his other
2
+ // machines, hand a join code, end a node, set a switch of another machine; on the other machine, join it or leave it
3
+ import { Command, Option } from 'clipanion'
4
+ import { daemonUrl, hqPort } from '../home/home-paths.ts'
5
+ import { TAILSCALE, tailnetName } from '../home/machine-host.ts'
6
+ import { carriesHq, hqOpen, hqUrl, joinOtherHq, leaveOtherHq } from '../hq/hq-local.ts'
7
+ import { grantsProblem, type Grant } from '../hq/hq-store.ts'
8
+ import { drill, houseReplica, replicate } from '../hq/replica.ts'
9
+
10
+ const tailscale = (args: string[]): { ok: boolean; out: string } => {
11
+ for (const bin of TAILSCALE) {
12
+ try {
13
+ const p = Bun.spawnSync([bin, ...args], { stdout: 'pipe', stderr: 'pipe', timeout: 15_000 })
14
+ return { ok: p.exitCode === 0, out: `${p.stdout.toString()}${p.stderr.toString()}`.trim() }
15
+ } catch {
16
+ // a missing binary throws: the next one is tried
17
+ }
18
+ }
19
+ return { ok: false, out: 'no tailscale cli answers on this machine' }
20
+ }
21
+
22
+ /** the url another machine joins this hq at, null while it has no tailnet name */
23
+ const publicHq = (): string | null => {
24
+ const name = tailnetName()
25
+ return name == null ? null : `https://${name}:${hqPort()}`
26
+ }
27
+
28
+ const ask = async (path: string, body: unknown): Promise<Record<string, unknown>> => {
29
+ try {
30
+ const r = await fetch(`${daemonUrl()}${path}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })
31
+ return (await r.json()) as Record<string, unknown>
32
+ } catch (e) {
33
+ return { refused: `the daemon of this machine does not answer (${(e as Error).message}): sk pm starts it` }
34
+ }
35
+ }
36
+
37
+ export class HqOpenCommand extends Command {
38
+ static override paths = [['hq', 'open']]
39
+
40
+ static override usage = Command.Usage({
41
+ category: 'Home',
42
+ description: 'let the other machines of the tailnet reach the hq this machine carries, behind a token',
43
+ details: "The daemon opens the hq's port, a second local port that answers the hq's routes and nothing else, and tailscale hands that port to the tailnet (`tailscale serve`). Each route but the join wants a node's token. The daemon's own port, with every route of the home, is handed to nobody. `sk hq close` undoes both.",
44
+ examples: [['open this machine\'s hq to the tailnet', 'sk hq open']],
45
+ })
46
+
47
+ async execute(): Promise<number> {
48
+ if (!carriesHq()) {
49
+ this.context.stderr.write(`FAIL: this machine joined the hq at ${hqUrl()}: it carries none to open (sk hq leave comes back to its own)\n`)
50
+ return 1
51
+ }
52
+ const door = await ask('/api/home/hq/open', {})
53
+ if (door['open'] !== true) {
54
+ this.context.stderr.write(`FAIL: ${String(door['refused'] ?? 'the daemon did not open the door')}\n`)
55
+ return 1
56
+ }
57
+ const r = tailscale(['serve', '--bg', `--https=${hqPort()}`, `http://127.0.0.1:${hqPort()}`])
58
+ if (!r.ok) {
59
+ await ask('/api/home/hq/close', {})
60
+ this.context.stderr.write(`FAIL: tailscale serve refused, the door is closed again: ${r.out}\n`)
61
+ return 1
62
+ }
63
+ const url = publicHq()
64
+ this.context.stdout.write(`ok: the hq of this machine answers the tailnet${url == null ? '' : ` at ${url}`}\nnext: sk hq invite, then on the other machine the line it prints\n`)
65
+ return 0
66
+ }
67
+ }
68
+
69
+ export class HqCloseCommand extends Command {
70
+ static override paths = [['hq', 'close']]
71
+
72
+ static override usage = Command.Usage({ category: 'Home', description: 'close the hq of this machine to the tailnet: its tailscale serve removed, its door closed' })
73
+
74
+ async execute(): Promise<number> {
75
+ const r = tailscale(['serve', `--https=${hqPort()}`, 'off'])
76
+ await ask('/api/home/hq/close', {})
77
+ this.context.stdout.write(`ok: the hq of this machine answers loopback only${r.ok ? '' : ` (tailscale serve said: ${r.out})`}\n`)
78
+ return 0
79
+ }
80
+ }
81
+
82
+ /** what an invite grants: what its flags name, and everything only with --all or with no flag at all. A machine
83
+ * named alone is that machine's folder, never more */
84
+ export function inviteGrants(o: { all: boolean; repos: string[]; identities: string[]; machines: string[] }): Grant[] {
85
+ const named: Grant[] = [...o.repos.map((name): Grant => ({ kind: 'repo', name })), ...o.identities.map((name): Grant => ({ kind: 'identity', name })), ...o.machines.map((name): Grant => ({ kind: 'machine', name }))]
86
+ return o.all || named.length === 0 ? [{ kind: 'all' }, ...named] : named
87
+ }
88
+
89
+ export class HqInviteCommand extends Command {
90
+ static override paths = [['hq', 'invite']]
91
+
92
+ static override usage = Command.Usage({
93
+ category: 'Home',
94
+ description: 'a join code for one daemon of another machine, good once and for 10 minutes, with what it may see',
95
+ details: "With no flag the daemon may see everything. `--repo`, `--identity` and `--machine` (repeat them) name what it may see instead, and `--all` adds everything to them: the hq answers it and its vault token opens only inside that grant. A repo is named by its key, the host and path of its first remote (`sk hq invite` refuses a folder name). Run it on the machine that carries the hq. It prints the line to run on the other machine.",
96
+ examples: [
97
+ ['a daemon that sees everything, and its machine\'s own secrets', 'sk hq invite --all --machine forge'],
98
+ ['a daemon for two repos, the identity they speak as, and its machine', 'sk hq invite --repo git.example.org/studio/orchard --repo git.example.org/studio/garden --identity studio --machine forge'],
99
+ ],
100
+ })
101
+
102
+ all = Option.Boolean('--all', false, { description: 'everything, beside what the other flags name (the default with no flag at all)' })
103
+ repos = Option.Array('--repo', [], { description: 'a repo the daemon may see, by its key: host/path of its first remote (repeat)' })
104
+ identities = Option.Array('--identity', [], { description: 'an identity the daemon may see (repeat)' })
105
+ machines = Option.Array('--machine', [], { description: "a machine whose own folder of the vault the daemon may read and write, in lowercase (repeat)" })
106
+ on = Option.String('--on', { description: 'a machine the hq knows, by its name or id: the join adds a node to it (a second OS user of it); without it a join names a new machine' })
107
+
108
+ async execute(): Promise<number> {
109
+ const grants = inviteGrants({ all: this.all, repos: this.repos, identities: this.identities, machines: this.machines })
110
+ const problem = grantsProblem(grants)
111
+ if (problem != null) {
112
+ this.context.stderr.write(`FAIL: ${problem}\n`)
113
+ return 1
114
+ }
115
+ const r = await ask('/api/home/hq/invite', { grants, ...(this.on == null ? {} : { onMachine: this.on }) })
116
+ if (typeof r['code'] !== 'string') {
117
+ this.context.stderr.write(`FAIL: ${String(r['refused'] ?? 'the daemon gave no code')}\n`)
118
+ return 1
119
+ }
120
+ const url = hqOpen() ? publicHq() : null
121
+ const what = grants.map((g) => (g.kind === 'all' ? 'everything' : `${g.kind} ${g.name}`)).join(', ')
122
+ this.context.stdout.write(`ok: a join code for one daemon, good once, for 10 minutes. It may see: ${what}\n`)
123
+ this.context.stdout.write(url == null ? `the code: ${r['code']}\nWARN this hq does not answer the tailnet yet: sk hq open, then on the other machine sk hq join <url> ${r['code']}\n` : `on the other machine:\n sk hq join ${url} ${r['code']}\n`)
124
+ return 0
125
+ }
126
+ }
127
+
128
+ export class HqEndCommand extends Command {
129
+ static override paths = [['hq', 'end']]
130
+
131
+ static override usage = Command.Usage({ category: 'Home', description: 'end a node: its token is refused from now on (the ids: sk machines --json)' })
132
+
133
+ node = Option.String()
134
+
135
+ async execute(): Promise<number> {
136
+ const r = await ask('/api/home/hq/end', { node: this.node })
137
+ if (r['ended'] === true) {
138
+ const vault = String(r['vault'] ?? '')
139
+ this.context.stdout.write(`ok: node ${this.node} is ended: its token is refused\n${vault.startsWith('NOT') ? 'WARN' : 'ok:'} the vault: ${vault}\n`)
140
+ return vault.startsWith('NOT') ? 1 : 0
141
+ }
142
+ this.context.stderr.write(`FAIL: ${String(r['refused'] ?? `no live node ${this.node} (the ids: sk machines --json)`)}\n`)
143
+ return 1
144
+ }
145
+ }
146
+
147
+ export class HqForgetCommand extends Command {
148
+ static override paths = [['hq', 'forget']]
149
+
150
+ static override usage = Command.Usage({
151
+ category: 'Home',
152
+ description: "free a retired machine's name: its row and ended nodes go (a look unless --go)",
153
+ details: 'On the machine that carries the hq only. Refused for the machine that carries the hq and for a machine with a live node (sk hq end first). What its nodes sent stays: cards, prompts, media, reports.',
154
+ })
155
+
156
+ machine = Option.String()
157
+ go = Option.Boolean('--go', false, { description: 'forget it; without it, only say what would go and what stays' })
158
+
159
+ async execute(): Promise<number> {
160
+ const r = await ask('/api/home/hq/forget-machine', { machine: this.machine, go: this.go })
161
+ if (typeof r['refused'] === 'string') {
162
+ this.context.stderr.write(`FAIL: ${r['refused']}\n`)
163
+ return 1
164
+ }
165
+ const keeps = Object.entries((r['keeps'] ?? {}) as Record<string, number>).map(([k, n]) => `${n} ${k}`).join(', ')
166
+ const nodes = Number(r['nodes'])
167
+ const out = this.context.stdout
168
+ out.write(`${this.go ? 'ok: forgot' : 'would forget'} machine ${String(r['name'])} (${String(r['machine'])}): its row, its ${nodes} ended ${nodes === 1 ? 'node' : 'nodes'} with their grants, and its door name ${String(r['door'])}\n`)
169
+ out.write(`stays: what its nodes sent${keeps === '' ? '' : ` (${keeps})`}, cards, prompts and media included\n`)
170
+ if (!this.go) out.write('nothing changed: run it again with --go\n')
171
+ return 0
172
+ }
173
+ }
174
+
175
+ export class HqSwitchCommand extends Command {
176
+ static override paths = [['hq', 'switch']]
177
+
178
+ static override usage = Command.Usage({
179
+ category: 'Home',
180
+ description: "set a switch of another machine from the hq's machine: its daemon takes it at its next report",
181
+ details: "Only on the machine that carries the hq, and only a switch declared settable from afar (hq/switch.ts). A switch that sends the owner's data somewhere (hq-cards, hq-history, hq-reflections) or opens a door (hq-open) stays his word on its machine; one that deletes or moves files there (temp-auto, media-purge-auto, annex-auto) is turned off from afar, never on. The daemon there applies it through its own code at its next report (every 5 minutes) and says so in its log; `sk machines` shows the value asked until a report shows it.",
182
+ examples: [
183
+ ['stop the temp sweep of another machine', 'sk hq switch other-mac temp-auto off'],
184
+ ['every switch and whether it is settable from afar', 'sk hq switch --list'],
185
+ ],
186
+ })
187
+
188
+ list = Option.Boolean('--list', false, { description: 'every declared switch, what it does, settable from afar or not' })
189
+ machine = Option.String({ required: false })
190
+ name = Option.String({ required: false })
191
+ value = Option.String({ required: false })
192
+
193
+ async execute(): Promise<number> {
194
+ const { SWITCHES } = await import('../hq/switch.ts')
195
+ if (this.list) {
196
+ for (const s of SWITCHES) this.context.stdout.write(`${s.name.padEnd(18)} ${s.afar == null ? 'here only ' : s.deletes ? 'off from afar' : 'from afar '} ${s.what}\n`)
197
+ return 0
198
+ }
199
+ if (this.machine == null || this.name == null || (this.value !== 'on' && this.value !== 'off')) {
200
+ this.context.stderr.write('FAIL: sk hq switch <machine> <name> on|off (the switches: sk hq switch --list)\n')
201
+ return 1
202
+ }
203
+ if (!carriesHq()) {
204
+ this.context.stderr.write(`FAIL: this machine joined the hq at ${hqUrl()}: a switch is set on the machine that carries it\n`)
205
+ return 1
206
+ }
207
+ const r = await ask('/api/home/hq/switch', { machine: this.machine, name: this.name, on: this.value === 'on' })
208
+ if (Array.isArray(r['nodes'])) {
209
+ this.context.stdout.write(`ok: ${this.name} ${this.value} is asked of ${this.machine} (${r['nodes'].length} ${r['nodes'].length === 1 ? 'daemon' : 'daemons'}): taken at its next report, sk machines shows it\n`)
210
+ return 0
211
+ }
212
+ this.context.stderr.write(`FAIL: ${String(r['refused'] ?? 'the daemon gave no answer')}\n`)
213
+ return 1
214
+ }
215
+ }
216
+
217
+ export class HqReflectionsCommand extends Command {
218
+ static override paths = [['hq', 'reflections']]
219
+
220
+ static override usage = Command.Usage({
221
+ category: 'Home',
222
+ description: 'the open reflections of every machine, from the hq; --dry, --auto on|off for the switch',
223
+ details: "One row a reflection file and a machine, its text masked, for the repos this node reads. A machine sends them while its machine db switch hq-reflections is on, its default off: `--auto on|off` sets it, `--dry` says what a look of this machine would send (by repo: the files, those the hq has not taken, the secret shapes masked) and writes nothing. A file that left its folder (the triage's ack) is acked here, its text kept 90 days. --text prints each open one whole, for the triage to read.",
224
+ examples: [
225
+ ['the open ones', 'sk hq reflections'],
226
+ ['each open one whole', 'sk hq reflections --text'],
227
+ ['what this machine would send', 'sk hq reflections --dry'],
228
+ ['this machine sends its reflections from now on', 'sk hq reflections --auto on'],
229
+ ],
230
+ })
231
+
232
+ text = Option.Boolean('--text', false, { description: 'each open reflection whole, its text masked' })
233
+ acked = Option.Boolean('--acked', false, { description: 'the acked ones too' })
234
+ dry = Option.Boolean('--dry', false, { description: 'say what a look of this machine would send, change nothing' })
235
+ auto = Option.String('--auto', { description: "on: the report job sends this machine's reflections, their text masked; off: none go (the default)" })
236
+
237
+ async execute(): Promise<number> {
238
+ if (this.auto !== undefined) {
239
+ if (this.auto !== 'on' && this.auto !== 'off') {
240
+ this.context.stderr.write(`FAIL: --auto takes on or off, not ${this.auto}\n`)
241
+ return 1
242
+ }
243
+ const { setReflectionsOn } = await import('../hq/switch.ts')
244
+ if (!setReflectionsOn(this.auto === 'on')) {
245
+ this.context.stderr.write('FAIL: the machine db does not open: the switch is not set\n')
246
+ return 1
247
+ }
248
+ this.context.stdout.write(`ok: the switch hq-reflections is ${this.auto}${this.auto === 'on' ? ': the report job sends them at its next look' : ''}\n`)
249
+ return 0
250
+ }
251
+ if (this.dry) {
252
+ const { findRepoRoot } = await import('../ts/config.ts')
253
+ const { houseRepos } = await import('../serve/project-gutter.ts')
254
+ const { homedir } = await import('node:os')
255
+ const { heldRepos } = await import('../hq/cards.ts')
256
+ const { reflectionsOn } = await import('../hq/switch.ts')
257
+ const { reflectionsDry } = await import('../hq/files-send.ts')
258
+ const { openDaemonDb } = await import('../hq/outbox.ts')
259
+ const house = houseRepos(findRepoRoot(process.cwd()), homedir())
260
+ const { held } = await heldRepos(house.repos.map((r) => ({ name: r.name, path: r.path })))
261
+ const db = openDaemonDb()
262
+ try {
263
+ const lines = reflectionsDry({ db, repos: held })
264
+ this.context.stdout.write(`the switch hq-reflections is ${reflectionsOn() ? 'on' : 'off'}: a look would send this\n${lines.length === 0 ? 'no reflection in a house repo\n' : `${lines.join('\n')}\n`}`)
265
+ } finally {
266
+ db?.close()
267
+ }
268
+ return 0
269
+ }
270
+ const { hqReflections } = await import('../hq/files-send.ts')
271
+ const r = await hqReflections({ text: this.text })
272
+ if ('refused' in r) {
273
+ this.context.stderr.write(`FAIL: ${r.refused}\n`)
274
+ return 1
275
+ }
276
+ const shown = r.rows.filter((x) => this.acked || x.state === 'open')
277
+ const out: string[] = []
278
+ for (const x of shown) {
279
+ out.push(`${x.state.padEnd(5)} ${x.machine} ${x.repo} ${x.file} ${x.title}${x.cut > 0 ? ` (${x.cut} bytes cut)` : ''}${x.masked > 0 ? ` (${x.masked} masked)` : ''}`)
280
+ if (this.text && x.text != null) out.push('', x.text.trimEnd(), '', '---')
281
+ }
282
+ out.push(`${shown.length} ${this.acked ? '' : 'open '}reflections of ${new Set(shown.map((x) => x.machine)).size} machines (${r.rows.length - r.rows.filter((x) => x.state === 'open').length} acked)`)
283
+ this.context.stdout.write(`${out.join('\n')}\n`)
284
+ return 0
285
+ }
286
+ }
287
+
288
+ export class HqReflectionsForgetCommand extends Command {
289
+ static override paths = [['hq', 'reflections', 'forget']]
290
+
291
+ static override usage = Command.Usage({
292
+ category: 'Home',
293
+ description: "a reflection out of the hq for good, every machine's row of it: the hq refuses it from then on",
294
+ details: "On the machine that carries the hq. Its file on its machine is not touched. A reflection acked or deleted stays at the hq 90 days with its text; this takes it out at once.",
295
+ examples: [['forget one', 'sk hq reflections forget github.com/someone/orchard 20261118-a-note.md']],
296
+ })
297
+
298
+ repo = Option.String()
299
+ file = Option.String()
300
+
301
+ async execute(): Promise<number> {
302
+ const r = await ask('/api/home/hq/forget', { kind: 'reflection', name: `${this.repo} ${this.file}` })
303
+ if (r['held'] === true || r['held'] === false) {
304
+ this.context.stdout.write(`ok: ${this.file} of ${this.repo} is forgotten${r['held'] === true ? '' : ' (the hq held no row of it)'}: the hq refuses it from now on\n`)
305
+ return 0
306
+ }
307
+ this.context.stderr.write(`FAIL: ${String(r['refused'] ?? 'the daemon gave no answer')}\n`)
308
+ return 1
309
+ }
310
+ }
311
+
312
+ export class HqJoinCommand extends Command {
313
+ static override paths = [['hq', 'join']]
314
+
315
+ static override usage = Command.Usage({
316
+ category: 'Home',
317
+ description: "this machine's daemon joins the hq of another machine, with the code `sk hq invite` gave there",
318
+ details: "The daemon then reports to that hq, and the one it carries rests. Its token is kept in a file of the shipkit home that this OS user alone reads. `sk hq leave` comes back to the machine's own hq.",
319
+ examples: [['join, with the line the invite printed', 'sk hq join https://other-mac.example.ts.net:4795 <code>']],
320
+ })
321
+
322
+ url = Option.String()
323
+ code = Option.String()
324
+
325
+ async execute(): Promise<number> {
326
+ const r = await joinOtherHq(this.url, this.code)
327
+ if ('refused' in r) {
328
+ this.context.stderr.write(`FAIL: ${r.refused}\n`)
329
+ return 1
330
+ }
331
+ this.context.stdout.write(`ok: this daemon is node ${r.node} of the hq at ${this.url}: its next report goes there (now: sk daemon job "hq report")\n${r.vault.startsWith('no ') ? 'WARN' : 'ok:'} ${r.vault}\n`)
332
+ return 0
333
+ }
334
+ }
335
+
336
+ export class HqLeaveCommand extends Command {
337
+ static override paths = [['hq', 'leave']]
338
+
339
+ static override usage = Command.Usage({ category: 'Home', description: "this machine's daemon leaves the hq of another machine and carries its own again" })
340
+
341
+ async execute(): Promise<number> {
342
+ if (carriesHq()) {
343
+ this.context.stdout.write('ok: this daemon already carries its own hq\n')
344
+ return 0
345
+ }
346
+ const was = hqUrl()
347
+ leaveOtherHq()
348
+ this.context.stdout.write(`ok: left the hq at ${was}. The daemon joins the one it carries at its next start (sk pm restart daemon)\n`)
349
+ return 0
350
+ }
351
+ }
352
+
353
+ export class HqReplicateCommand extends Command {
354
+ static override paths = [['hq', 'replicate']]
355
+
356
+ static override usage = Command.Usage({
357
+ category: 'Home',
358
+ description: "send the hq's database to its bucket as it is written (Litestream): pm keeps it up",
359
+ details: "Reads the bucket from the house config (`serve.hqReplica`) and its key pair through the house's secret command, and hands the pair to Litestream in its environment. Runs until it is stopped. A machine whose daemon joined an hq elsewhere carries none to copy.",
360
+ })
361
+
362
+ async execute(): Promise<number> {
363
+ const err = (l: string): void => void this.context.stderr.write(`${l}\n`)
364
+ if (!carriesHq()) {
365
+ err(`FAIL: this machine joined the hq at ${hqUrl()}: it carries none to copy`)
366
+ return 1
367
+ }
368
+ const setup = await houseReplica()
369
+ if ('why' in setup) {
370
+ err(`FAIL: ${setup.why}`)
371
+ return 1
372
+ }
373
+ return replicate({ setup, printErr: err })
374
+ }
375
+ }
376
+
377
+ export class HqDrillCommand extends Command {
378
+ static override paths = [['hq', 'drill']]
379
+
380
+ static override usage = Command.Usage({
381
+ category: 'Home',
382
+ description: "prove the hq's second copy: restore it beside the live file and check it holds every row",
383
+ details: "Notes every row the live file holds, waits for one sync, restores the replica into a scratch folder, checks that the copy is sound and holds each of those rows, then removes it. The live file is only read. Exit 1 when the copy lacks a row or does not restore. The result is kept for the machine's check.",
384
+ examples: [['prove the replica now', 'sk hq drill']],
385
+ })
386
+
387
+ async execute(): Promise<number> {
388
+ const setup = await houseReplica()
389
+ if ('why' in setup) {
390
+ this.context.stderr.write(`FAIL: ${setup.why}\n`)
391
+ return 1
392
+ }
393
+ const d = await drill({ setup })
394
+ if (!d.ok) {
395
+ this.context.stderr.write(`FAIL: ${d.why} (${(d.ms / 1000).toFixed(1)} s)\n`)
396
+ return 1
397
+ }
398
+ this.context.stdout.write(`ok: the replica restored in ${(d.ms / 1000).toFixed(1)} s and holds all ${d.rows} rows of the live file (${Math.round(d.bytes / 1024)} kB)\n`)
399
+ return 0
400
+ }
401
+ }
402
+
403
+ export class HqCardsCommand extends Command {
404
+ static override paths = [['hq', 'cards']]
405
+
406
+ static override usage = Command.Usage({
407
+ category: 'Home',
408
+ description: "the cards job: --dry says what a look would send and write, --auto on|off sets its switch",
409
+ details: "The job `hq cards` carries the review folders of this machine to the hq and the hq's to them, while the machine db switch `hq-cards` is on, its default off. `--dry` reads the folders, the daemon's ledger and the feed, and prints what a look would send and write: it writes no file, no row and no cursor. The job itself runs in the daemon (`sk daemon job \"hq cards\"` runs one look now).",
410
+ examples: [['what the job would do now', 'sk hq cards --dry'], ['the daemon carries the cards from now on', 'sk hq cards --auto on']],
411
+ })
412
+
413
+ dry = Option.Boolean('--dry', false, { description: 'say what a look would do, change nothing' })
414
+ auto = Option.String('--auto', { description: 'on: the daemon carries the cards of this machine to the hq and back; off: nothing of it runs (the default)' })
415
+
416
+ async execute(): Promise<number> {
417
+ if (this.auto !== undefined) {
418
+ if (this.auto !== 'on' && this.auto !== 'off') {
419
+ this.context.stderr.write(`FAIL: --auto takes on or off, not ${this.auto}\n`)
420
+ return 1
421
+ }
422
+ const { setCardsOn } = await import('../hq/cards.ts')
423
+ if (!setCardsOn(this.auto === 'on')) {
424
+ this.context.stderr.write('FAIL: the machine db does not open: the switch is not set\n')
425
+ return 1
426
+ }
427
+ this.context.stdout.write(`ok: the switch hq-cards is ${this.auto}${this.auto === 'on' ? ': the daemon job hq cards carries them at its next look' : ''}\n`)
428
+ return 0
429
+ }
430
+ if (!this.dry) {
431
+ this.context.stderr.write('FAIL: sk hq cards --dry looks, sk hq cards --auto on|off sets the switch. The job runs in the daemon while it is on\n')
432
+ return 1
433
+ }
434
+ const { findRepoRoot } = await import('../ts/config.ts')
435
+ const { houseRepos } = await import('../serve/project-gutter.ts')
436
+ const { homedir } = await import('node:os')
437
+ const { cardsOn, hqCardsTick } = await import('../hq/cards.ts')
438
+ const house = houseRepos(findRepoRoot(process.cwd()), homedir())
439
+ this.context.stdout.write(`the switch hq-cards is ${cardsOn() ? 'on' : 'off'}: a look of the job would do this\n`)
440
+ return hqCardsTick({ repos: house.repos.map((r) => ({ name: r.name, path: r.path })), dry: true, print: (l) => this.context.stdout.write(`${l}\n`), printErr: (l) => this.context.stderr.write(`${l}\n`) })
441
+ }
442
+ }
443
+
444
+ /** on or off from the console, null with no word; a word of another kind is said and refused */
445
+ const onOff = (v: string | undefined, err: (l: string) => void): boolean | null | undefined => {
446
+ if (v === undefined) return null
447
+ if (v === 'on' || v === 'off') return v === 'on'
448
+ err(`FAIL: on or off, not ${v}\n`)
449
+ return undefined
450
+ }
451
+
452
+ export class HqProxyCommand extends Command {
453
+ static override paths = [['hq', 'proxy']]
454
+
455
+ static override usage = Command.Usage({
456
+ category: 'Home',
457
+ description: "the hq's home opens any machine's process at <process>.<machine>.localhost: on, off, or its state",
458
+ details: "On the machine that carries the hq only, its switch `hq-proxy` (off by default, never set from afar). On, the hq hands each node its door key at its next report, and `http://<process id>.<machine>.localhost:<home port>/` opens that process: on this machine directly, on another through that machine's own door (`sk hq door on` there). Only a url a live node with the grant all reported for that process, on its own loopback, is ever reached. It answers on this machine only: a phone on the tailnet does not reach it.",
459
+ examples: [['open the doors of the hq', 'sk hq proxy on'], ['where it stands', 'sk hq proxy']],
460
+ })
461
+
462
+ state = Option.String({ required: false })
463
+
464
+ async execute(): Promise<number> {
465
+ const want = onOff(this.state, (l) => this.context.stderr.write(l))
466
+ if (want === undefined) return 1
467
+ const { proxyOn, setProxyOn } = await import('../hq/door.ts')
468
+ if (want === null) {
469
+ this.context.stdout.write(`the switch hq-proxy is ${proxyOn() ? 'on' : 'off'}${carriesHq() ? '' : `: this machine carries no hq (it joined ${hqUrl()}), so it opens no door either way`}\n`)
470
+ return 0
471
+ }
472
+ if (want && !carriesHq()) {
473
+ this.context.stderr.write(`FAIL: this machine joined the hq at ${hqUrl()}: only the machine that carries the hq opens the doors\n`)
474
+ return 1
475
+ }
476
+ if (!setProxyOn(want)) {
477
+ this.context.stderr.write('FAIL: the machine db does not open: the switch is not set\n')
478
+ return 1
479
+ }
480
+ this.context.stdout.write(want ? 'ok: the switch hq-proxy is on: each node gets its door key at its next report (5 minutes at most); a process opens at http://<process>.<machine>.localhost:<home port>/, from the machines page\n' : 'ok: the switch hq-proxy is off: every door host answers 404, every door key is dead (the hq\'s secret is deleted), and the next on makes new ones\n')
481
+ return 0
482
+ }
483
+ }
484
+
485
+ export class HqDoorCommand extends Command {
486
+ static override paths = [['hq', 'door']]
487
+
488
+ static override usage = Command.Usage({
489
+ category: 'Home',
490
+ description: "this machine's door: its web opens its processes to the hq's home alone: on, off, or its state",
491
+ details: "Its switch `machine-door` (off by default, never set from afar). On, this machine's web answers `/door/<process id>/` with that global process's declared url, on this machine's loopback only, to a request that carries the door key the hq gave this machine and no other: no other machine, no phone, no device of the tailnet opens it. The hq's home reaches it at this machine's tailnet name, through `tailscale serve` of the home port.",
492
+ examples: [['open this machine to the hq\'s home', 'sk hq door on'], ['where it stands', 'sk hq door']],
493
+ })
494
+
495
+ state = Option.String({ required: false })
496
+
497
+ async execute(): Promise<number> {
498
+ const want = onOff(this.state, (l) => this.context.stderr.write(l))
499
+ if (want === undefined) return 1
500
+ const { doorOn, setDoorOn } = await import('../hq/door.ts')
501
+ const { existsSync } = await import('node:fs')
502
+ const { join } = await import('node:path')
503
+ const { homeDir } = await import('../home/home-paths.ts')
504
+ const keyed = existsSync(join(homeDir(), 'door-key'))
505
+ if (want === null) {
506
+ this.context.stdout.write(`the switch machine-door is ${doorOn() ? 'on' : 'off'}; ${keyed ? 'this machine keeps a door key from its hq' : 'no door key yet: the hq gives one while its proxy is on, at the next report'}\n`)
507
+ return 0
508
+ }
509
+ if (!setDoorOn(want)) {
510
+ this.context.stderr.write('FAIL: the machine db does not open: the switch is not set\n')
511
+ return 1
512
+ }
513
+ this.context.stdout.write(want ? `ok: the switch machine-door is on${keyed ? '' : ': no door key yet, the hq gives one while its proxy is on, at the next report'}\n` : 'ok: the switch machine-door is off: /door/ answers 404\n')
514
+ return 0
515
+ }
516
+ }
@@ -17,6 +17,7 @@ import { nearest } from '../core/nearest.ts'
17
17
 
18
18
  export class KeysCommand extends Command {
19
19
  static override paths = [['keys']]
20
+ static gloss = 'the cache key of each gate check'
20
21
 
21
22
  static override usage = Command.Usage({
22
23
  category: 'Health',
@@ -1,8 +1,11 @@
1
- // sk lanes: who is at work on the machine now, one row per live session and lane. Report only.
1
+ // sk lanes: who is at work on the machine now, one row per live session and lane, and who hears the owner's answers
2
+ // for each (agent-time/registry.ts, the one registry of parties). Report only.
2
3
  import { Command, Option } from 'clipanion'
3
4
  import { liveRow, liveTable, oneRowAnAgent } from '../agent-time/live.ts'
4
5
  import { listTranscripts } from '../agent-time/store.ts'
5
6
  import { capacityLines, LIVE_WINDOW_MS, readCapacity } from '../core/capacity.ts'
7
+ import { laneNameOf, readParties, readSessionRecords } from '../agent-time/registry.ts'
8
+ import { liveWatchers } from '../review/watchers.ts'
6
9
 
7
10
  export class LanesCommand extends Command {
8
11
  static override paths = [['lanes']]
@@ -11,7 +14,7 @@ export class LanesCommand extends Command {
11
14
  static override usage = Command.Usage({
12
15
  category: 'Health',
13
16
  description: 'who is at work on the machine now: each live session and lane, since when, its calls, what it does',
14
- details: 'one row per agent whose transcript moved in the last 3 minutes, every account and repo, read from the transcripts agents already write: no agent reports anything. A lane shows the description its orchestrator gave it and its model. `now` is its last entry: the tool call in flight, a model turn, or an ended turn, with how long ago. --all widens the window to an hour. The first line is the machine, the last what `sk capacity` says for this repo. Report only, exit 0 always.',
17
+ details: 'one row per agent whose transcript moved in the last 3 minutes, every account and repo, read from the transcripts agents already write: no agent reports anything. A lane shows the description its orchestrator gave it and its model, under its session. `now` is its last entry: the tool call in flight, a model turn, or an ended turn, with how long ago. After a name, who hears the owner\'s answers for it (wiki tools/shipkit/threads-how-it-fits.md, The rules): « hears: a watch » for a session or a lane whose sk thread watch lives, « process gone » for a session whose Claude Code process ended, its threads then heard by the repo\'s next session. --all widens the window to an hour. The first line is the machine, the last what `sk capacity` says for this repo. Report only, exit 0 always.',
15
18
  examples: [
16
19
  ['who works now', 'sk lanes'],
17
20
  ['the last hour, ended lanes included', 'sk lanes --all'],
@@ -28,8 +31,16 @@ export class LanesCommand extends Command {
28
31
  const rows = oneRowAnAgent(listTranscripts().filter((f) => now - f.mtime <= windowMs)).map((f) => liveRow(f))
29
32
  const { capacity, live, repo } = readCapacity(process.cwd(), null, now)
30
33
  const [machine = '', , verdict = ''] = capacityLines(capacity, live, repo)
31
- if (this.json) { this.context.stdout.write(`${JSON.stringify({ capacity, rows })}\n`); return 0 }
32
- this.context.stdout.write(`${[machine, '', ...liveTable(rows, now), '', `${repo}: ${verdict}`].join('\n')}\n`)
34
+ // who hears for each row: the registry of parties, the same one the threads' rules read
35
+ const parties = await readParties({ sessions: [...new Set(rows.map((r) => r.session))], watchers: readSessionRecords().flatMap((r) => r.stores).filter((d, i, all) => all.indexOf(d) === i).flatMap((d) => liveWatchers(d)) })
36
+ const tag = (r: (typeof rows)[number]): string => {
37
+ const s = parties.sessions.find((x) => x.id === r.session)
38
+ if (r.agent === '') return s?.watch ? ' · hears: a watch' : readSessionRecords().some((x) => x.session === r.session) && s?.live === false ? ' · process gone' : ''
39
+ const name = laneNameOf(r.name)
40
+ return name !== null && parties.lanes.some((l) => l.session === r.session && l.name === name && l.watch) ? ' · hears: a watch' : ''
41
+ }
42
+ if (this.json) { this.context.stdout.write(`${JSON.stringify({ capacity, rows, parties })}\n`); return 0 }
43
+ this.context.stdout.write(`${[machine, '', ...liveTable(rows, now, tag), '', `${repo}: ${verdict}`].join('\n')}\n`)
33
44
  return 0
34
45
  }
35
46
  }
@@ -0,0 +1,36 @@
1
+ // sk machines: every machine the hq knows, its daemons, what each last said, and what to look at. Report only.
2
+ import { Command, Option } from 'clipanion'
3
+ import { machinesPage } from '../hq/hq-local.ts'
4
+ import { machineLines } from '../hq/machine-notes.ts'
5
+
6
+ export class MachinesCommand extends Command {
7
+ static override paths = [['machines']]
8
+
9
+ static override usage = Command.Usage({
10
+ category: 'Health',
11
+ description: 'every machine that reports to the hq: on or silent, its shipkit, its free disk, its repos',
12
+ details: 'One block a machine, one row a daemon (a machine and an OS user), from the report each daemon sends every 5 minutes. Under them, what to look at: a daemon that went silent, a house checkout far behind, a disk that fills. A machine alone shows itself: its daemon carries its own hq.',
13
+ examples: [
14
+ ['every machine', 'sk machines'],
15
+ ['machine readable', 'sk machines --json'],
16
+ ],
17
+ })
18
+
19
+ json = Option.Boolean('--json', false, { description: 'the machines, their last reports and the notes as json' })
20
+
21
+ async execute(): Promise<number> {
22
+ const now = Date.now()
23
+ const r = await machinesPage(30, now)
24
+ if ('refused' in r) {
25
+ this.context.stderr.write(`FAIL: ${r.refused}\n`)
26
+ return 1
27
+ }
28
+ if (this.json) {
29
+ this.context.stdout.write(`${JSON.stringify(r)}\n`)
30
+ return 0
31
+ }
32
+ const notes = r.notes.length === 0 ? ['ok: nothing to look at'] : r.notes.map((n) => `WARN ${n.text}`)
33
+ this.context.stdout.write(`${[...machineLines(r.machines, r.you, now), '', ...notes].join('\n')}\n`)
34
+ return 0
35
+ }
36
+ }