rvlib-shipkit 2.25.0 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +2 -2
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +331 -0
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +1 -3
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/render.ts +130 -17
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +349 -23
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +370 -95
  15. package/src/agent-time/timeline.ts +140 -21
  16. package/src/agent-time/turns.ts +18 -8
  17. package/src/annex/offload.ts +17 -6
  18. package/src/annex/tidy.ts +70 -10
  19. package/src/asks/ask-after.ts +40 -0
  20. package/src/asks/asks-queue.ts +205 -47
  21. package/src/assets/kit-config.ts +7 -3
  22. package/src/assets/kits/identity-kit.ts +289 -10
  23. package/src/check.ts +3 -1
  24. package/src/checks/SK004-gitignore-policy.check.ts +12 -5
  25. package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
  26. package/src/checks/SK026-asks-autoclose.check.ts +5 -5
  27. package/src/checks/SK028-readme.check.ts +7 -66
  28. package/src/checks/SK030-cache-audit.check.ts +6 -1
  29. package/src/checks/SK031-trace-audit.check.ts +2 -0
  30. package/src/checks/SK033-global-contribution.check.ts +3 -1
  31. package/src/checks/SK035-public-clean.check.ts +2 -2
  32. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  33. package/src/checks/SK045-slow-hooks.check.ts +47 -0
  34. package/src/checks/SK046-hook-records.check.ts +76 -0
  35. package/src/checks/SK047-login-in-description.check.ts +36 -0
  36. package/src/checks/SK048-one-local-file.check.ts +36 -0
  37. package/src/cli/cmd_Asks.ts +71 -5
  38. package/src/cli/cmd_Backup.ts +5 -3
  39. package/src/cli/cmd_Capacity.ts +2 -2
  40. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  41. package/src/cli/cmd_Db.ts +253 -0
  42. package/src/cli/cmd_History.ts +212 -0
  43. package/src/cli/cmd_Home.ts +31 -3
  44. package/src/cli/cmd_Hq.ts +516 -0
  45. package/src/cli/cmd_Machines.ts +36 -0
  46. package/src/cli/cmd_Media.ts +38 -6
  47. package/src/cli/cmd_Mv.ts +1 -1
  48. package/src/cli/cmd_Reflect.ts +23 -2
  49. package/src/cli/cmd_Releases.ts +30 -0
  50. package/src/cli/cmd_Review.ts +569 -118
  51. package/src/cli/cmd_Secret.ts +62 -12
  52. package/src/cli/cmd_Social.ts +83 -1
  53. package/src/cli/cmd_Space.ts +324 -0
  54. package/src/cli/cmd_Time.ts +82 -5
  55. package/src/cli/cmd_Tmp.ts +28 -4
  56. package/src/cli/cmd_Trailer.ts +14 -10
  57. package/src/cli/cmd_Urls.ts +56 -0
  58. package/src/cli/cmd_Vault.ts +583 -0
  59. package/src/cli/family-help.ts +4 -2
  60. package/src/cli/family-pages.ts +1 -1
  61. package/src/cli/registry.ts +26 -4
  62. package/src/collections/actions.ts +63 -13
  63. package/src/collections/collection-types.ts +23 -1
  64. package/src/collections/providers.ts +117 -23
  65. package/src/collections/review.ts +4 -4
  66. package/src/commands/runner.ts +5 -1
  67. package/src/contracts/contract-manifests.ts +6 -5
  68. package/src/contracts/contract-types.ts +6 -4
  69. package/src/contracts/contracts-engine.ts +11 -0
  70. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  71. package/src/core/budget.ts +12 -17
  72. package/src/core/capacity.ts +27 -18
  73. package/src/core/check-runner.ts +7 -4
  74. package/src/core/history-files.ts +9 -5
  75. package/src/core/layout.ts +3 -0
  76. package/src/core/machine-busy.ts +127 -0
  77. package/src/core/machine-commit.ts +6 -1
  78. package/src/core/machine-db.ts +368 -20
  79. package/src/core/machine-layout.ts +137 -0
  80. package/src/core/machine-read.ts +81 -0
  81. package/src/core/migrate-layout.ts +1 -1
  82. package/src/core/one-way-in-policy.ts +64 -7
  83. package/src/core/polling-policy.ts +27 -0
  84. package/src/core/retention.ts +16 -2
  85. package/src/core/scope.ts +107 -14
  86. package/src/core/signal-name.ts +6 -0
  87. package/src/core/slots.ts +5 -4
  88. package/src/core/trace-audit.ts +6 -1
  89. package/src/core/transient.ts +6 -0
  90. package/src/drill/clean.ts +25 -1
  91. package/src/drill/run.ts +2 -2
  92. package/src/drill/seal.ts +27 -4
  93. package/src/home/activity-shape.ts +2 -0
  94. package/src/home/activity.ts +66 -3
  95. package/src/home/app-sign.ts +15 -4
  96. package/src/home/daemon-jobs.ts +149 -7
  97. package/src/home/database-projects.ts +111 -0
  98. package/src/home/database-words.ts +203 -0
  99. package/src/home/databases.ts +460 -0
  100. package/src/home/global-units.ts +6 -0
  101. package/src/home/gui-app/ShipkitGui.swift +122 -1
  102. package/src/home/gui-app.ts +6 -3
  103. package/src/home/home-move.ts +514 -0
  104. package/src/home/home-paths.ts +12 -3
  105. package/src/home/home-routes.ts +68 -0
  106. package/src/home/inbox-shape.ts +24 -14
  107. package/src/home/machine-fold.ts +820 -0
  108. package/src/home/machine-host.ts +20 -5
  109. package/src/home/machine-repair.ts +503 -0
  110. package/src/home/machine-stores.ts +66 -15
  111. package/src/home/machine-temp.ts +547 -86
  112. package/src/home/resume.ts +79 -0
  113. package/src/home/run-daemon.ts +25 -4
  114. package/src/home/run-pm.ts +18 -5
  115. package/src/home/serve-daemon.ts +18 -3
  116. package/src/home/serve-web.ts +175 -7
  117. package/src/home/space-job.ts +115 -0
  118. package/src/home/space-page.ts +257 -0
  119. package/src/home/space-route.ts +167 -0
  120. package/src/home/space-words.ts +103 -0
  121. package/src/home/time-page-shape.ts +202 -0
  122. package/src/home/time-page.ts +64 -0
  123. package/src/home/vault-page.ts +482 -0
  124. package/src/home/vault-words.ts +132 -0
  125. package/src/hooks/leak-guard.ts +40 -13
  126. package/src/hooks/one-way-in-guard.ts +17 -4
  127. package/src/hq/cards.ts +581 -0
  128. package/src/hq/door-route.ts +43 -0
  129. package/src/hq/door.ts +163 -0
  130. package/src/hq/files-send.ts +348 -0
  131. package/src/hq/forgotten-log.ts +35 -0
  132. package/src/hq/history-check.ts +255 -0
  133. package/src/hq/history-place.ts +146 -0
  134. package/src/hq/history-send.ts +487 -0
  135. package/src/hq/hq-db.ts +99 -0
  136. package/src/hq/hq-local.ts +469 -0
  137. package/src/hq/hq-routes.ts +196 -0
  138. package/src/hq/hq-store.ts +599 -0
  139. package/src/hq/kinds/ask.ts +147 -0
  140. package/src/hq/kinds/card-gone.ts +83 -0
  141. package/src/hq/kinds/card-msg.ts +66 -0
  142. package/src/hq/kinds/card.ts +99 -0
  143. package/src/hq/kinds/index.ts +21 -0
  144. package/src/hq/kinds/kind.ts +126 -0
  145. package/src/hq/kinds/media.ts +125 -0
  146. package/src/hq/kinds/prompt.ts +219 -0
  147. package/src/hq/kinds/reflection.ts +128 -0
  148. package/src/hq/kinds/report.ts +55 -0
  149. package/src/hq/kinds/time-day.ts +236 -0
  150. package/src/hq/ledger.ts +473 -0
  151. package/src/hq/machine-key.ts +44 -0
  152. package/src/hq/machine-notes.ts +131 -0
  153. package/src/hq/outbox.ts +372 -0
  154. package/src/hq/replica.ts +168 -0
  155. package/src/hq/repo-id.ts +4 -0
  156. package/src/hq/report-facts.ts +117 -0
  157. package/src/hq/report.ts +274 -0
  158. package/src/hq/switch.ts +151 -0
  159. package/src/hq/vault-grant.ts +92 -0
  160. package/src/identities/identities.ts +15 -3
  161. package/src/identities/steps.ts +31 -0
  162. package/src/ledger/db.ts +73 -26
  163. package/src/ledger/gate-checks.ts +29 -4
  164. package/src/ledger/git-key.ts +3 -3
  165. package/src/ledger/git-scan.ts +49 -7
  166. package/src/ledger/run-log.ts +11 -3
  167. package/src/ledger/store.ts +26 -4
  168. package/src/media-store/backup/daemon.ts +36 -17
  169. package/src/media-store/backup/kept.ts +241 -0
  170. package/src/media-store/backup/restore.ts +14 -4
  171. package/src/media-store/backup/run.ts +11 -11
  172. package/src/media-store/backup/secret.ts +6 -4
  173. package/src/media-store/backup/snapshot.ts +4 -2
  174. package/src/media-store/backup/sources.ts +68 -20
  175. package/src/media-store/copy/config.ts +77 -0
  176. package/src/media-store/copy/copy.ts +194 -0
  177. package/src/media-store/copy/lifecycle.ts +43 -0
  178. package/src/media-store/copy/night.ts +90 -0
  179. package/src/media-store/copy/proof.ts +151 -0
  180. package/src/media-store/copy/snapshot.ts +152 -0
  181. package/src/media-store/copy/store.ts +62 -0
  182. package/src/media-store/copy/stream.ts +176 -0
  183. package/src/media-store/daemon.ts +66 -16
  184. package/src/media-store/db.ts +22 -11
  185. package/src/media-store/forget.ts +23 -3
  186. package/src/media-store/hand.ts +4 -3
  187. package/src/media-store/hq-find.ts +75 -0
  188. package/src/media-store/hq-send.ts +277 -0
  189. package/src/media-store/kind.ts +2 -0
  190. package/src/media-store/purge.ts +18 -15
  191. package/src/media-store/put.ts +24 -8
  192. package/src/media-store/remote.ts +16 -7
  193. package/src/media-store/space-listing.ts +240 -0
  194. package/src/media-store/space.ts +40 -21
  195. package/src/media-store/sync.ts +5 -5
  196. package/src/media-store/tidy.ts +98 -0
  197. package/src/media-store/upload.ts +3 -3
  198. package/src/media-store/webp.ts +66 -0
  199. package/src/messages/model.ts +16 -7
  200. package/src/messages/routes.ts +14 -4
  201. package/src/messages/score.ts +2 -2
  202. package/src/messages/suggest.ts +96 -0
  203. package/src/pages/frame-client.ts +10 -0
  204. package/src/plan/planner.ts +28 -17
  205. package/src/recordings/media-kind.ts +1 -0
  206. package/src/recordings/model.ts +1 -1
  207. package/src/recordings/recorder-app/Capture.swift +9 -7
  208. package/src/reflect/hq-corpus.ts +56 -0
  209. package/src/reflect/prompt-corpus.ts +3 -1
  210. package/src/reflect/transcript.ts +146 -36
  211. package/src/release/machine-words.ts +67 -0
  212. package/src/release/public-clean.ts +8 -3
  213. package/src/releases/from-card.ts +1 -1
  214. package/src/releases/model.ts +18 -0
  215. package/src/releases/routes.ts +10 -5
  216. package/src/releases/store.ts +23 -2
  217. package/src/repo-config.ts +42 -2
  218. package/src/review/anim.ts +2 -2
  219. package/src/review/auto.ts +2 -2
  220. package/src/review/card-db.ts +244 -0
  221. package/src/review/card-rows.ts +266 -0
  222. package/src/review/cells.ts +76 -5
  223. package/src/review/draft-card.ts +41 -0
  224. package/src/review/draft-model.ts +78 -0
  225. package/src/review/format.ts +29 -10
  226. package/src/review/gone.ts +98 -0
  227. package/src/review/inbox-hook.ts +35 -0
  228. package/src/review/marks.ts +1 -1
  229. package/src/review/media-kind.ts +7 -5
  230. package/src/review/media-read.ts +9 -7
  231. package/src/review/media.ts +32 -5
  232. package/src/review/model.ts +214 -45
  233. package/src/review/move.ts +491 -0
  234. package/src/review/notes.ts +12 -20
  235. package/src/review/previews.ts +15 -19
  236. package/src/review/project.ts +1 -1
  237. package/src/review/rev.ts +8 -0
  238. package/src/review/role.ts +1 -1
  239. package/src/review/routes.ts +64 -13
  240. package/src/review/stage-card.ts +8 -4
  241. package/src/review/stage-routes.ts +1 -1
  242. package/src/review/store.ts +529 -83
  243. package/src/review/thread-fold.ts +51 -0
  244. package/src/review/threads.ts +147 -9
  245. package/src/review/trailer-auto-mock.ts +63 -0
  246. package/src/review/trailer-card.ts +4 -4
  247. package/src/review/trailer-desk.ts +41 -7
  248. package/src/review/trailer-media.ts +1 -0
  249. package/src/review/trailer-model.ts +8 -0
  250. package/src/review/trailer-notes.ts +1 -1
  251. package/src/review/trailer-routes.ts +9 -1
  252. package/src/review/unit.ts +6 -6
  253. package/src/review/watchers.ts +1 -1
  254. package/src/rules/untrack-generated.ts +92 -8
  255. package/src/secrets/held.ts +16 -0
  256. package/src/secrets/keychain.ts +113 -0
  257. package/src/secrets/list.ts +16 -6
  258. package/src/secrets/manager.ts +24 -10
  259. package/src/secrets/read.ts +257 -0
  260. package/src/secrets/who-reads.ts +49 -0
  261. package/src/serve/door-forward.ts +268 -0
  262. package/src/serve/door-names.ts +47 -0
  263. package/src/serve/embed.ts +1 -1
  264. package/src/serve/hub-app/activity-view.tsx +56 -32
  265. package/src/serve/hub-app/activity.css +7 -1
  266. package/src/serve/hub-app/asks-page.tsx +48 -0
  267. package/src/serve/hub-app/asks-st.ts +25 -0
  268. package/src/serve/hub-app/clock-svc.ts +1 -2
  269. package/src/serve/hub-app/col-card.tsx +64 -13
  270. package/src/serve/hub-app/col-list-page.tsx +122 -0
  271. package/src/serve/hub-app/col-list-st.ts +103 -0
  272. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  273. package/src/serve/hub-app/col-tables.ts +76 -8
  274. package/src/serve/hub-app/cols-svc.ts +70 -16
  275. package/src/serve/hub-app/database-st.ts +260 -0
  276. package/src/serve/hub-app/database-view.tsx +289 -0
  277. package/src/serve/hub-app/database.css +32 -0
  278. package/src/serve/hub-app/entry-bar.css +14 -0
  279. package/src/serve/hub-app/entry-bar.tsx +33 -0
  280. package/src/serve/hub-app/entry-pick.ts +31 -0
  281. package/src/serve/hub-app/floating.tsx +1 -0
  282. package/src/serve/hub-app/hash-route.ts +11 -1
  283. package/src/serve/hub-app/header-bar.tsx +14 -18
  284. package/src/serve/hub-app/home-st.ts +89 -9
  285. package/src/serve/hub-app/home-strip.css +5 -19
  286. package/src/serve/hub-app/home-strip.tsx +58 -92
  287. package/src/serve/hub-app/home.html +7 -0
  288. package/src/serve/hub-app/hub-app.tsx +31 -142
  289. package/src/serve/hub-app/hub-types.ts +3 -1
  290. package/src/serve/hub-app/hub.css +109 -23
  291. package/src/serve/hub-app/icons.tsx +18 -1
  292. package/src/serve/hub-app/identities-st.ts +56 -6
  293. package/src/serve/hub-app/identities-view.tsx +100 -58
  294. package/src/serve/hub-app/identities.css +17 -15
  295. package/src/serve/hub-app/identity-address.ts +5 -0
  296. package/src/serve/hub-app/inbox-st.ts +41 -24
  297. package/src/serve/hub-app/inbox-view.tsx +37 -41
  298. package/src/serve/hub-app/inbox.css +2 -5
  299. package/src/serve/hub-app/index.html +7 -0
  300. package/src/serve/hub-app/kept-cols.tsx +7 -0
  301. package/src/serve/hub-app/keys.ts +28 -15
  302. package/src/serve/hub-app/later.tsx +26 -0
  303. package/src/serve/hub-app/list-filter.tsx +14 -0
  304. package/src/serve/hub-app/list-walk.ts +72 -3
  305. package/src/serve/hub-app/machines-st.ts +251 -0
  306. package/src/serve/hub-app/machines-view.tsx +224 -0
  307. package/src/serve/hub-app/machines.css +76 -0
  308. package/src/serve/hub-app/md-copy.tsx +79 -0
  309. package/src/serve/hub-app/media-view.tsx +2 -0
  310. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  311. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  312. package/src/serve/hub-app/messages.css +14 -0
  313. package/src/serve/hub-app/page-keys.ts +175 -0
  314. package/src/serve/hub-app/pages-frames.tsx +11 -3
  315. package/src/serve/hub-app/palette-st.ts +58 -11
  316. package/src/serve/hub-app/palette-view.tsx +3 -1
  317. package/src/serve/hub-app/project-list.css +54 -8
  318. package/src/serve/hub-app/project-list.tsx +128 -59
  319. package/src/serve/hub-app/projects-svc.ts +78 -7
  320. package/src/serve/hub-app/reader-chips.tsx +13 -0
  321. package/src/serve/hub-app/readme-view.tsx +2 -3
  322. package/src/serve/hub-app/readme.css +27 -5
  323. package/src/serve/hub-app/reflections-page.tsx +42 -0
  324. package/src/serve/hub-app/reflections-st.ts +17 -0
  325. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  326. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  327. package/src/serve/hub-app/repo-sections.ts +9 -5
  328. package/src/serve/hub-app/repo-st.ts +35 -8
  329. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  330. package/src/serve/hub-app/review/kit.tsx +50 -7
  331. package/src/serve/hub-app/review/note-place.ts +1 -1
  332. package/src/serve/hub-app/review/review-board.tsx +2 -2
  333. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  334. package/src/serve/hub-app/review/review-kit.ts +27 -1
  335. package/src/serve/hub-app/review/review-list.tsx +68 -30
  336. package/src/serve/hub-app/review/review-page.tsx +7 -8
  337. package/src/serve/hub-app/review/review-st.ts +111 -24
  338. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  339. package/src/serve/hub-app/review/review-views.tsx +475 -144
  340. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  341. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  342. package/src/serve/hub-app/review/thread-st.ts +73 -26
  343. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  344. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  345. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  346. package/src/serve/hub-app/review.css +267 -61
  347. package/src/serve/hub-app/side-lists.ts +72 -0
  348. package/src/serve/hub-app/sidebar.tsx +6 -3
  349. package/src/serve/hub-app/site/site-part.tsx +2 -8
  350. package/src/serve/hub-app/site/site-st.ts +4 -4
  351. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  352. package/src/serve/hub-app/social/kit.tsx +30 -4
  353. package/src/serve/hub-app/social/post-card.tsx +139 -49
  354. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  355. package/src/serve/hub-app/social/social-model.ts +11 -0
  356. package/src/serve/hub-app/social/social-page.tsx +94 -35
  357. package/src/serve/hub-app/social/social-st.ts +120 -36
  358. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  359. package/src/serve/hub-app/social/stage-st.ts +1 -1
  360. package/src/serve/hub-app/social/step-layout.ts +1 -1
  361. package/src/serve/hub-app/social.css +3 -0
  362. package/src/serve/hub-app/space-st.ts +209 -0
  363. package/src/serve/hub-app/space-view.tsx +196 -0
  364. package/src/serve/hub-app/space.css +27 -0
  365. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  366. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  367. package/src/serve/hub-app/stores.css +6 -1
  368. package/src/serve/hub-app/theme-st.ts +22 -9
  369. package/src/serve/hub-app/time-charts.tsx +291 -0
  370. package/src/serve/hub-app/time-pages.tsx +749 -0
  371. package/src/serve/hub-app/time-st.ts +162 -0
  372. package/src/serve/hub-app/time-view.tsx +76 -0
  373. package/src/serve/hub-app/time.css +138 -0
  374. package/src/serve/hub-app/tree-build.ts +52 -42
  375. package/src/serve/hub-app/tree-row.tsx +4 -4
  376. package/src/serve/hub-app/tree-svc.ts +18 -9
  377. package/src/serve/hub-app/urls-svc.ts +154 -0
  378. package/src/serve/hub-app/urls-view.tsx +117 -0
  379. package/src/serve/hub-app/urls.css +30 -0
  380. package/src/serve/hub-app/vault-st.ts +127 -0
  381. package/src/serve/hub-app/vault-view.tsx +154 -0
  382. package/src/serve/hub-app/vault.css +38 -0
  383. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  384. package/src/serve/hub-app/waiting-svc.ts +29 -0
  385. package/src/serve/hub-app/wikis-view.tsx +2 -2
  386. package/src/serve/hub-runtime.ts +15 -2
  387. package/src/serve/project-gutter-route.ts +27 -14
  388. package/src/serve/project-gutter.ts +25 -12
  389. package/src/serve/same-origin.ts +10 -0
  390. package/src/serve/serve-hub.ts +13 -4
  391. package/src/shipkit-files.ts +16 -2
  392. package/src/shipkit.ts +1 -1
  393. package/src/shot/shooter.ts +616 -420
  394. package/src/shot/shot-ask.ts +246 -155
  395. package/src/site/desk.ts +2 -2
  396. package/src/smoke/run-smoke.ts +3 -2
  397. package/src/social/cover.ts +202 -0
  398. package/src/social/discord-layout.ts +37 -13
  399. package/src/social/drafts.ts +3 -0
  400. package/src/social/load.ts +23 -2
  401. package/src/social/media-kind.ts +2 -1
  402. package/src/social/publish/discord.ts +5 -2
  403. package/src/social/publish/secret.ts +2 -2
  404. package/src/social/release-stage.ts +28 -13
  405. package/src/social/routes.ts +26 -1
  406. package/src/social/stage.ts +1 -1
  407. package/src/social/stats.ts +12 -9
  408. package/src/social/strip.ts +4 -1
  409. package/src/social/thumbnail.ts +255 -0
  410. package/src/stores/collection.ts +15 -11
  411. package/src/stores/desk.ts +236 -42
  412. package/src/stores/model.ts +72 -6
  413. package/src/stores/routes.ts +37 -12
  414. package/src/stores/unit.ts +14 -8
  415. package/src/suite/judge-suites.ts +113 -16
  416. package/src/suite/select.ts +45 -3
  417. package/src/suite/suite-cli.ts +81 -34
  418. package/src/trailer/bed.ts +1 -1
  419. package/src/trailer/build.ts +134 -21
  420. package/src/trailer/ffmpeg.ts +7 -0
  421. package/src/trailer/fonts.ts +3 -2
  422. package/src/trailer/grammar.ts +201 -2
  423. package/src/trailer/graph.ts +42 -5
  424. package/src/trailer/look.ts +21 -0
  425. package/src/trailer/mock.ts +154 -0
  426. package/src/trailer/passage.ts +65 -26
  427. package/src/trailer/score/heard.ts +89 -0
  428. package/src/trailer/score/sound.ts +14 -8
  429. package/src/trailer/sound/run.ts +16 -6
  430. package/src/trailer/stitch.ts +26 -5
  431. package/src/trailer/titles.ts +82 -19
  432. package/src/trailer/versions.ts +1 -3
  433. package/src/trailer/vertical.ts +3 -1
  434. package/src/urls/frame.ts +195 -0
  435. package/src/urls/routes.ts +43 -0
  436. package/src/urls/rows.ts +171 -0
  437. package/src/urls/unit.ts +73 -0
  438. package/src/vault/house-keys.ts +42 -0
  439. package/src/vault/layout.ts +50 -0
  440. package/src/vault/policy.ts +165 -0
  441. package/src/vault/vault-audit.ts +276 -0
  442. package/src/vault/vault-client.ts +40 -0
  443. package/src/vault/vault-config.ts +159 -0
  444. package/src/vault/vault-destroy.ts +78 -0
  445. package/src/vault/vault-handover.ts +305 -0
  446. package/src/vault/vault-http.ts +352 -0
  447. package/src/vault/vault-import.ts +208 -0
  448. package/src/vault/vault-init.ts +328 -0
  449. package/src/vault/vault-minter.ts +271 -0
  450. package/src/vault/vault-restore.ts +333 -0
  451. package/src/vault/vault-serve.ts +342 -0
  452. package/src/vault/vault-snapshot.ts +281 -0
  453. package/src/veille/asks.ts +1 -1
  454. package/src/veille/desk.ts +2 -2
  455. package/src/wiki/run-wiki.ts +2 -1
  456. package/src/wiki/scan-md.ts +42 -2
@@ -32,27 +32,44 @@ export type Outcome = 'ok' | 'exit' | 'timeout' | 'blocked' | 'denied' | 'interr
32
32
  export type TranscriptEvent =
33
33
  /** a prompt the human typed; `queued` = typed while the agent worked */
34
34
  | { kind: 'prompt'; at: number; timestamp: string; uuid: string | null; sessionId: string | null; text: string; origin: PromptOrigin }
35
- /** a user-role turn nobody typed that wakes the agent: a task notification,
36
- * a sub-agent hand-back, a peer message, a script-driven prompt */
35
+ /** something he did that is no prompt: a slash command, an interrupt */
36
+ | { kind: 'act'; at: number }
37
+ /** a user-role turn nobody typed that wakes the agent: a task of its own
38
+ * that ended, a watch that delivered an event, a sub-agent hand-back, a
39
+ * script-driven prompt */
37
40
  | { kind: 'wake'; at: number }
41
+ /** a watch (Monitor) that ran out with no event to deliver: the harness
42
+ * tells the agent, which arms it again. Nothing of the agent's own ended */
43
+ | { kind: 'lapse'; at: number }
38
44
  /** a message relayed into the agent (the coordinator, the human, another
39
- * session "sent a message while you were working"): it can end a park of
40
- * hours after the agent handed back */
45
+ * session): it can end a park of hours after the agent handed back */
41
46
  | { kind: 'message'; at: number }
42
- | { kind: 'use'; at: number; id: string; name: string; detail: string }
47
+ /** `msg`: the id of the assistant message that carries it, the same for every call of one turn.
48
+ * `model`, `ctx`, `out`: the model of that message, the tokens it read (input, cache read and cache
49
+ * write) and the tokens it wrote; every entry of a message carries the message's whole usage */
50
+ | { kind: 'use'; at: number; id: string; name: string; detail: string; msg?: string; model?: string; ctx?: number; out?: number }
43
51
  /** `perm`: how the call was allowed; `user` = it waited for the human, so its time is his.
44
52
  * `bg`: the call returned while its command runs on in the background
45
53
  * (started so, or moved there at its timeout); its real end is a `bgend` */
46
- | { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm; bg: boolean }
54
+ | { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm; bg: boolean; /** what refused the call, in the harness's own words: only for a blocked or a denied one */ why?: string }
47
55
  /** a background run's task notification: the call `id` ended at `at`. One
48
56
  * run can be written two or three times (queued, then delivered): the
49
57
  * earliest is its end */
50
58
  | { kind: 'bgend'; at: number; id: string; outcome: Outcome; code: number | null }
51
- /** an assistant text block: the agent talking, which can end its turn */
59
+ /** an assistant text block: the agent talking, which can end its turn;
60
+ * also the output of a slash command, written when the command is done
61
+ * (a /compact: when its summary request returned) */
52
62
  | { kind: 'reply'; at: number }
53
- /** the text block that ends the turn (stop_reason end_turn): the agent
54
- * stopped, and what follows is a wait until something wakes it */
63
+ /** the text block that ends the turn (stop_reason end_turn), or the API
64
+ * refusing the request (a limit, a login): the agent stopped, and what
65
+ * follows is a wait until something wakes it */
55
66
  | { kind: 'end'; at: number }
67
+ /** a hook run the harness timed. A hook on a tool call or a prompt is
68
+ * written only when it printed something, so a silent one leaves none;
69
+ * the hooks of a turn's end are all written, silent or not. `tool` is ''
70
+ * on an event of no tool (a prompt, a turn end); `id` is the call it ran
71
+ * on, or the hook's own id */
72
+ | { kind: 'hook'; at: number; id: string; event: string; tool: string; command: string; ms: number; code: number | null; error: boolean }
56
73
 
57
74
  // wrappers the harness injects as user-role entries: none of them are typed
58
75
  const NOISE_PREFIXES = [
@@ -82,6 +99,14 @@ type Block = { type?: unknown; text?: unknown; id?: unknown; name?: unknown; inp
82
99
 
83
100
  export type RawEntry = {
84
101
  type?: unknown
102
+ /** system entries only: `local_command` is a slash command he ran,
103
+ * `stop_hook_summary` the hooks of a turn's end with the time of each */
104
+ subtype?: unknown
105
+ hookInfos?: unknown
106
+ hookErrors?: unknown
107
+ toolUseID?: unknown
108
+ /** an assistant entry the harness wrote in place of an answer the API refused */
109
+ isApiErrorMessage?: unknown
85
110
  entrypoint?: unknown
86
111
  uuid?: unknown
87
112
  timestamp?: unknown
@@ -95,7 +120,7 @@ export type RawEntry = {
95
120
  * a plain turn in a main session, a meta turn in a sub-agent */
96
121
  origin?: { kind?: unknown }
97
122
  /** attachment entries: a notification delivered mid-turn is a `queued_command` */
98
- attachment?: { type?: unknown; prompt?: unknown }
123
+ attachment?: { type?: unknown; prompt?: unknown; hookName?: unknown; hookEvent?: unknown; command?: unknown; durationMs?: unknown; exitCode?: unknown; toolUseID?: unknown }
99
124
  /** queue-operation entries only */
100
125
  operation?: unknown
101
126
  content?: unknown
@@ -107,20 +132,23 @@ export type RawEntry = {
107
132
 
108
133
  const stripReminders = (text: string): string => text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '').trim()
109
134
 
110
- /** the user text of a user entry, reminders stripped, a slash command's typed
111
- * args rescued; null when it carries no text at all (a pure tool_result turn).
112
- * Content is a string for a plain prompt, an array of blocks when the message
113
- * carried pastes or attachments (the text blocks in there are still his). */
114
- function userText(entry: RawEntry): string | null {
135
+ /** the text of a user entry as the harness wrote it, reminders stripped; null
136
+ * when it carries no text at all (a pure tool_result turn). Content is a
137
+ * string for a plain prompt, an array of blocks when the message carried
138
+ * pastes or attachments (the text blocks in there are still his). */
139
+ function writtenText(entry: RawEntry): string | null {
115
140
  const content = entry.message?.content
116
- let text: string
117
- if (typeof content === 'string') text = content
118
- else if (Array.isArray(content)) {
119
- const parts = (content as Block[]).filter((b) => b?.type === 'text' && typeof b?.text === 'string').map((b) => b.text as string)
120
- if (parts.length === 0) return null
121
- text = parts.join('\n')
122
- } else return null
123
- text = stripReminders(text)
141
+ if (typeof content === 'string') return stripReminders(content)
142
+ if (!Array.isArray(content)) return null
143
+ const parts = (content as Block[]).filter((b) => b?.type === 'text' && typeof b?.text === 'string').map((b) => b.text as string)
144
+ return parts.length === 0 ? null : stripReminders(parts.join('\n'))
145
+ }
146
+
147
+ /** the user text of a user entry: its written text, a slash command's typed
148
+ * args rescued */
149
+ function userText(entry: RawEntry): string | null {
150
+ let text = writtenText(entry)
151
+ if (text == null) return null
124
152
  // a slash-command entry is a harness WRAPPER around typed text:
125
153
  // <command-name>/cmd</command-name><command-args>THE TEXT</command-args>.
126
154
  // Dropping the whole entry throws away real instructions and repro pastes.
@@ -177,6 +205,8 @@ export function outcomeOf(r: { isError: boolean; text: string; extra: unknown })
177
205
  }
178
206
 
179
207
  const DETAIL_MAX = 400
208
+ /** enough of a refusal to name who refused and why */
209
+ const WHY_MAX = 600
180
210
  const clip = (s: string): string => (s.length > DETAIL_MAX ? s.slice(0, DETAIL_MAX) : s)
181
211
 
182
212
  /** a long command keeps its head and its tail: what runs after a heredoc
@@ -212,6 +242,18 @@ export function parseEntry(line: string): RawEntry | null {
212
242
 
213
243
  export type Usage = { messageId: string; input: number; output: number; cacheRead: number; cacheWrite: number; model: string }
214
244
 
245
+ /** the model and the size of the turn an assistant entry belongs to: what it read and what it wrote, in tokens;
246
+ * nothing for an entry that says neither */
247
+ function turnOf(entry: RawEntry): { model?: string; ctx?: number; out?: number } {
248
+ const m = entry.message
249
+ const u = m?.usage
250
+ const n = (v: unknown): number => (typeof v === 'number' ? v : 0)
251
+ return {
252
+ ...(typeof m?.model === 'string' ? { model: m.model } : {}),
253
+ ...(u == null ? {} : { ctx: n(u.input_tokens) + n(u.cache_read_input_tokens) + n(u.cache_creation_input_tokens), out: n(u.output_tokens) }),
254
+ }
255
+ }
256
+
215
257
  /** the token usage an assistant entry carries. The harness writes one entry per
216
258
  * content block, each with the same message id and usage, so a reader counts
217
259
  * each message id once */
@@ -240,7 +282,7 @@ const resultText = (content: unknown): string => {
240
282
  // the entry types that carry nothing a reader wants and make most of the
241
283
  // bytes (api-request alone is about 80 percent of a long session): a line
242
284
  // that starts with one of these is skipped before JSON.parse
243
- const KEPT_TYPE_PREFIXES = ['{"type":"user"', '{"type":"assistant"', '{"type":"queue-operation"']
285
+ const KEPT_TYPE_PREFIXES = ['{"type":"user"', '{"type":"assistant"', '{"type":"queue-operation"', '{"type":"attachment"']
244
286
 
245
287
  /** every event one transcript line holds; [] for anything else, a truncated
246
288
  * tail line of a live session included */
@@ -263,17 +305,26 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
263
305
  }
264
306
  if (Number.isNaN(at) && entry.type !== 'user') return []
265
307
  // a notification that arrives while the agent works is attached to its next turn
266
- if (entry.type === 'attachment') return entry.attachment?.type === 'queued_command' && typeof entry.attachment.prompt === 'string' ? bgEndsOf(entry.attachment.prompt, at) : []
308
+ if (entry.type === 'attachment') {
309
+ const a = entry.attachment
310
+ if (a?.type === 'hook_success' || a?.type === 'hook_non_blocking_error') return hookOf(a, at)
311
+ return a?.type === 'queued_command' && typeof a.prompt === 'string' ? bgEndsOf(a.prompt, at) : []
312
+ }
267
313
  if (entry.type === 'assistant') {
268
314
  const blocks = Array.isArray(entry.message?.content) ? (entry.message.content as Block[]) : []
269
315
  const out: TranscriptEvent[] = []
270
- const ends = entry.message?.stop_reason === 'end_turn'
316
+ const ends = entry.message?.stop_reason === 'end_turn' || entry.isApiErrorMessage === true
271
317
  for (const b of blocks) {
272
- if (b?.type === 'tool_use' && typeof b.id === 'string' && typeof b.name === 'string') out.push({ kind: 'use', at, id: b.id, name: b.name, detail: detailOf(b.name, b.input) })
318
+ if (b?.type === 'tool_use' && typeof b.id === 'string' && typeof b.name === 'string') out.push({ kind: 'use', at, id: b.id, name: b.name, detail: detailOf(b.name, b.input), ...(typeof entry.message?.id === 'string' ? { msg: entry.message.id } : {}), ...turnOf(entry) })
273
319
  else if (b?.type === 'text') out.push({ kind: ends ? 'end' : 'reply', at })
274
320
  }
275
321
  return out
276
322
  }
323
+ if (entry.type === 'system') {
324
+ if (entry.subtype === 'stop_hook_summary') return stopHooksOf(entry, at)
325
+ const kind = entry.subtype === 'local_command' && typeof entry.content === 'string' ? commandOf(entry.content.trim()) : null
326
+ return kind == null ? [] : [{ kind, at }]
327
+ }
277
328
  if (entry.type !== 'user') return []
278
329
  const out: TranscriptEvent[] = []
279
330
  const content = entry.message?.content
@@ -283,27 +334,86 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
283
334
  const bg = typeof extra.backgroundTaskId === 'string'
284
335
  for (const b of content as Block[]) {
285
336
  if (b?.type !== 'tool_result' || typeof b.tool_use_id !== 'string' || Number.isNaN(at)) continue
286
- const o = outcomeOf({ isError: b.is_error === true, text: resultText(b.content), extra })
287
- out.push({ kind: 'result', at, id: b.tool_use_id, ...o, perm, bg })
337
+ const text = resultText(b.content)
338
+ const o = outcomeOf({ isError: b.is_error === true, text, extra })
339
+ const refused = o.outcome === 'blocked' || o.outcome === 'denied'
340
+ out.push({ kind: 'result', at, id: b.tool_use_id, ...o, perm, bg, ...(refused ? { why: text.replace(/\s+/g, ' ').slice(0, WHY_MAX) } : {}) })
288
341
  }
289
342
  }
290
343
  const typed = typedPromptOf(entry)
291
344
  if (typed != null) out.push(prompt(typed, 'typed'))
292
345
  if (out.length > 0 || Number.isNaN(at)) return out
293
- const text = userText(entry)
294
- if (entry.isMeta === true && RELAYED.test(text ?? '')) out.push({ kind: 'message', at })
295
- // a peer message (a sub-agent hand-back, another session's message) and a
296
- // sub-agent's task notification are written isMeta, yet they wake the agent
297
- else if ((entry.isMeta !== true || entry.turnOrigin === 'peer' || entry.origin?.kind === 'task-notification') && entry.isCompactSummary !== true) {
298
- if (text != null && text !== '') out.push({ kind: 'wake', at })
346
+ const text = writtenText(entry)
347
+ if (text == null) return out
348
+ const kind = untypedOf(entry, text)
349
+ if (kind != null) out.push({ kind, at })
350
+ out.push(...bgEndsOf(text, at))
351
+ return out
352
+ }
353
+
354
+ /** the wrappers of what he does at the keyboard that is no prompt: a slash
355
+ * command (its output is apart: written when the command is done) and an interrupt */
356
+ const HIS_ACT = ['<command-name>', '<command-message>', '[Request interrupted']
357
+ const COMMAND_OUT = '<local-command-stdout>'
358
+
359
+ const commandOf = (text: string): 'act' | 'reply' | null => (text.startsWith(COMMAND_OUT) ? 'reply' : HIS_ACT.some((p) => text.startsWith(p)) ? 'act' : null)
360
+
361
+ /** what a user-role entry nobody typed is to the agent's time: his act, a
362
+ * relayed message, a wake, or nothing */
363
+ function untypedOf(entry: RawEntry, text: string): 'act' | 'reply' | 'message' | 'wake' | 'lapse' | null {
364
+ if (entry.isMeta === true && RELAYED.test(text)) return 'message'
365
+ if (entry.isCompactSummary === true || text === '') return null
366
+ if (entry.isMeta !== true) {
367
+ const his = commandOf(text)
368
+ if (his != null) return his
299
369
  }
300
- if (text != null) out.push(...bgEndsOf(text, at))
370
+ // a peer message (a sub-agent hand-back, another session's message) and a
371
+ // sub-agent's task notification are written isMeta, yet they reach the agent
372
+ if (entry.isMeta === true && entry.turnOrigin !== 'peer' && entry.origin?.kind !== 'task-notification') return null
373
+ if (text.includes('<task-notification>')) return noticeOf(text)
374
+ // another session wrote: no task of this one ended
375
+ return text.includes('<cross-session-message') ? 'message' : 'wake'
376
+ }
377
+
378
+ /** a timed hook record: its event, the tool from `PostToolUse:Edit`, its
379
+ * command as the settings name it, its duration */
380
+ function hookOf(a: NonNullable<RawEntry['attachment']>, at: number): TranscriptEvent[] {
381
+ if (typeof a.durationMs !== 'number' || typeof a.hookEvent !== 'string' || typeof a.command !== 'string') return []
382
+ const name = typeof a.hookName === 'string' ? a.hookName : ''
383
+ const tool = name.startsWith(`${a.hookEvent}:`) ? name.slice(a.hookEvent.length + 1) : ''
384
+ const id = typeof a.toolUseID === 'string' ? a.toolUseID : ''
385
+ return [{ kind: 'hook', at, id, event: a.hookEvent, tool, command: a.command, ms: a.durationMs, code: typeof a.exitCode === 'number' ? a.exitCode : null, error: a.type === 'hook_non_blocking_error' }]
386
+ }
387
+
388
+ /** the hooks of a turn's end, each a timed run: the summary names every one
389
+ * that ran, with its time, whether it printed or not. An error the summary
390
+ * reports is not tied to one hook, so it marks each run of that turn end */
391
+ function stopHooksOf(entry: RawEntry, at: number): TranscriptEvent[] {
392
+ const infos = Array.isArray(entry.hookInfos) ? (entry.hookInfos as { command?: unknown; durationMs?: unknown }[]) : []
393
+ const base = typeof entry.toolUseID === 'string' && entry.toolUseID !== '' ? entry.toolUseID : String(at)
394
+ const error = Array.isArray(entry.hookErrors) && entry.hookErrors.length > 0
395
+ const event = entry.isSidechain === true ? 'SubagentStop' : 'Stop'
396
+ const out: TranscriptEvent[] = []
397
+ infos.forEach((h, i) => {
398
+ if (typeof h?.command !== 'string' || typeof h.durationMs !== 'number') return
399
+ out.push({ kind: 'hook', at, id: i === 0 ? base : `${base}#${i}`, event, tool: '', command: h.command, ms: h.durationMs, code: null, error })
400
+ })
301
401
  return out
302
402
  }
303
403
 
304
404
  const NOTICE = /<task-notification>([\s\S]*?)<\/task-notification>/g
305
405
  const tagOf = (body: string, name: string): string | null => new RegExp(`<${name}>([^<]*)</${name}>`).exec(body)?.[1]?.trim() ?? null
306
406
 
407
+ /** what a notification text is to a stopped agent. A `stopped` notice counts
408
+ * for nothing: runs the harness lost at a session's end, written when he
409
+ * opens the session again, so his act and no task ending. A watch that ran
410
+ * out in silence is a `lapse`. Anything else wakes it */
411
+ function noticeOf(text: string): 'wake' | 'lapse' | null {
412
+ const notices = [...text.matchAll(NOTICE)].map((m) => m[1] ?? '').filter((body) => tagOf(body, 'status') !== 'stopped')
413
+ if (notices.length === 0) return text.includes('</task-notification>') ? null : 'wake'
414
+ return notices.every((body) => body.includes('<event>[Monitor expired after')) ? 'lapse' : 'wake'
415
+ }
416
+
307
417
  /** the background runs a notification text says ended: each one that names
308
418
  * its call and a final status. `stopped` is a run the harness lost track of
309
419
  * (its session ended first): no end is known, so none is given */
@@ -0,0 +1,67 @@
1
+ // the words that name the owner's machines, for what a unit publishes (release/public-clean.ts): the name this
2
+ // machine keeps, the tailnet's label, the dns label and addresses of each node of that tailnet, each ip address
3
+ // ~/.ssh/config reaches a host by. Read from the machine that runs the scan, so a machine is covered the day it
4
+ // joins, and this file names none
5
+ import { readFileSync } from 'fs'
6
+ import { homedir } from 'os'
7
+ import { join } from 'path'
8
+ import { machineName, readTailscaleStatus, type TailnetStatus } from '../home/machine-host.ts'
9
+ import type { HouseWord } from './public-clean.ts'
10
+
11
+ /** `off`: no machine is read (the test preload, so a suite never scans with the real ones) */
12
+ export const MACHINE_WORDS_ENV = 'SHIPKIT_MACHINE_WORDS'
13
+
14
+ const MIN = 4
15
+ const IP = /^(\d{1,3}(\.\d{1,3}){3}|[0-9a-f]*:[0-9a-f:]+)$/i
16
+ const label = (dns: string | undefined): string | undefined => dns?.split('.')[0]
17
+ /** a name that is a plain word (`ubuntu`, `server`, `localhost`) names no machine: one needs a digit or a dash */
18
+ const named = (name: string | null | undefined): string | null => (name != null && /[\d-]/.test(name) ? name : null)
19
+
20
+ /** the whole list, with no machine in it. A node counts by its dns label, never by its OS host name, which is often a
21
+ * product name (`MacBook Pro`); a node of another tailnet (a shared one, a vpn exit) is not the owner's. A host of
22
+ * the ssh config counts by its ip only: an alias or a dns name there is as often a public host (`github.com`) */
23
+ export function machineWords(o: { name: string | null; tailnet: TailnetStatus | null; sshConfig: string }): HouseWord[] {
24
+ const out: HouseWord[] = []
25
+ const add = (word: string | null | undefined, what: string): void => {
26
+ const w = (word ?? '').trim()
27
+ if (w.length >= MIN && !out.some((x) => x.word.toLowerCase() === w.toLowerCase())) out.push({ word: w, what })
28
+ }
29
+ add(named(o.name), 'a machine name')
30
+ const suffix = o.tailnet?.MagicDNSSuffix?.replace(/\.$/, '').toLowerCase()
31
+ add(label(suffix), 'a tailnet name')
32
+ for (const node of [o.tailnet?.Self, ...Object.values(o.tailnet?.Peer ?? {})]) {
33
+ const dns = node?.DNSName?.replace(/\.$/, '').toLowerCase()
34
+ if (dns == null || suffix == null || !dns.endsWith(`.${suffix}`)) continue
35
+ add(named(label(dns)), 'a machine name')
36
+ for (const ip of node?.TailscaleIPs ?? []) add(ip, 'a machine address')
37
+ }
38
+ for (const m of o.sshConfig.matchAll(/^[ \t]*hostname[ \t=]+"?([^\s"]+)/gim)) if (IP.test(m[1]!)) add(m[1], 'a machine address')
39
+ return out
40
+ }
41
+
42
+ const KEEP_MS = 60_000
43
+ let kept: { at: number; home: string; value: { words: HouseWord[]; notes: string[] } } | undefined
44
+
45
+ /** this machine's words, read once a minute a process: the cache key and each unit's scan ask in one run */
46
+ export function readMachineWords(home = homedir(), now = Date.now()): { words: HouseWord[]; notes: string[] } {
47
+ if (process.env[MACHINE_WORDS_ENV] === 'off') return { words: [], notes: [`${MACHINE_WORDS_ENV}=off: no machine is scanned`] }
48
+ if (kept != null && kept.home === home && now - kept.at < KEEP_MS) return kept.value
49
+ const tailnet = readTailscaleStatus()
50
+ let name: string | null = null
51
+ try {
52
+ name = machineName()
53
+ } catch {
54
+ // a host name with no letter or digit names nothing
55
+ }
56
+ let sshConfig = ''
57
+ try {
58
+ sshConfig = readFileSync(join(home, '.ssh', 'config'), 'utf8')
59
+ } catch {
60
+ // no ssh config: no address from it
61
+ }
62
+ const words = machineWords({ name, tailnet, sshConfig })
63
+ const notes = tailnet == null ? ['no tailscale answers on this machine: no tailnet machine is scanned'] : words.some((w) => w.what === 'a tailnet name') ? [] : ['tailscale answers with no tailnet name: no tailnet machine is scanned']
64
+ const value = { words, notes }
65
+ kept = { at: now, home, value }
66
+ return value
67
+ }
@@ -1,6 +1,7 @@
1
1
  // what an npm unit publishes names nothing of the house (wiki tools/shipkit/units.md): the file list is npm's own
2
- // pack list, the words come from the data (house repos, identities, the keyword file), so a new repo or identity is
3
- // covered the day it exists. A hit reports file:line and the masked word, never the word
2
+ // pack list, the words come from the data (house repos, identities, the owner's machines, the keyword file), so a
3
+ // new repo, identity or machine is covered the day it exists. A hit reports file:line and the masked word, never
4
+ // the word
4
5
  import { createHash } from 'crypto'
5
6
  import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
6
7
  import { homedir } from 'os'
@@ -14,6 +15,7 @@ import { fileStamp } from '../core/file-stamp.ts'
14
15
  import { gitRoot } from '../core/git-root.ts'
15
16
  import { houseIndex, houseRepos } from '../serve/project-gutter.ts'
16
17
  import type { RepoConfig } from '../repo-config.ts'
18
+ import { readMachineWords } from './machine-words.ts'
17
19
 
18
20
  /** a word the tarball may not carry, and what it is (never the word itself) */
19
21
  export type HouseWord = { word: string; what: string }
@@ -248,10 +250,12 @@ export async function publicClean(root: string, config: RepoConfig, unit: { dir:
248
250
  else for (const i of ids.identities) for (const f of [i.file, ...i.accounts.map((a) => a.file)]) read(f)
249
251
  const allow = publicAllow(config, read)
250
252
  notes.push(...allow.notes)
253
+ const machines = readMachineWords()
254
+ notes.push(...machines.notes)
251
255
  const scanned = scanPublic({
252
256
  rel,
253
257
  files,
254
- words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids))],
258
+ words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids)), ...machines.words],
255
259
  keywordText: withBuiltinRows(kwFiles.map((f) => read(f) ?? '')),
256
260
  allowedWords: allowedWords(pkg),
257
261
  allow: allow.entries,
@@ -312,6 +316,7 @@ export function publicCleanKey(root: string, units: { dir: string }[]): string {
312
316
  const parts: string[] = []
313
317
  for (const u of units) treeStamp(u.dir, parts)
314
318
  parts.push(houseRepoWords(root).map((w) => w.word).join(','))
319
+ parts.push(readMachineWords().words.map((w) => w.word).join(','))
315
320
  const ids = houseIdentitiesDir(root)
316
321
  if (ids != null) treeStamp(ids, parts)
317
322
  for (const f of [join(root, KEYWORD_FILE), globalKeywordFile(), globalAllowFile()]) if (f != null) parts.push(fileStamp(f))
@@ -1,4 +1,4 @@
1
- // a change written from a review card (wiki tools/shipkit/review.md, A change for the release): the card carries its
1
+ // a change written from a review card (wiki tools/shipkit/threads.md, A change for the release): the card carries its
2
2
  // public line (`--changelog "<category>: <line>"`), and the owner's approval adds it to next.md with the card's media
3
3
  // (a pair of images as its after and its before, two stills, never a video; a clip as it is, else its image), kept
4
4
  // private in the Space. The card named is the thread's first version, so a later version approved again replaces its
@@ -274,6 +274,24 @@ export const withoutCard = (r: Release, card: string): Release => ({
274
274
 
275
275
  export const changesOf = (r: Release): Change[] => r.categories.flatMap((c) => c.changes)
276
276
 
277
+ /** the changes a word names: by its card (the whole id, or the moment it starts with), else by its title, whole
278
+ * before a part of it */
279
+ export function changesNamed(r: Release, ref: string): Change[] {
280
+ const all = changesOf(r)
281
+ const w = ref.trim().toLowerCase()
282
+ if (w === '') return []
283
+ const byCard = all.filter((c) => c.card != null && (c.card.toLowerCase() === w || c.card.toLowerCase().startsWith(`${w}-`)))
284
+ if (byCard.length > 0) return byCard
285
+ const whole = all.filter((c) => c.title.toLowerCase() === w)
286
+ return whole.length > 0 ? whole : all.filter((c) => c.title.toLowerCase().includes(w))
287
+ }
288
+
289
+ /** the release without that one change; a category left empty goes with it */
290
+ export const withoutChange = (r: Release, change: Change): Release => ({
291
+ ...r,
292
+ categories: r.categories.map((c) => ({ ...c, changes: c.changes.filter((x) => x !== change) })).filter((c) => c.changes.length > 0),
293
+ })
294
+
277
295
  /** a change's key on a page: its card, else its title */
278
296
  export const changeKey = (ch: Pick<Change, 'card' | 'title'>): string => `${ch.card ?? ''}${ch.title}`
279
297
 
@@ -1,6 +1,6 @@
1
- // the releases page's routes (wiki tools/shipkit/units.md, The release files): every release file read fresh, and a
2
- // private picture shown from its scratch copy, else through a signed link of the Space. Read only: the files are
3
- // written by an approval, `sk releases add` or a hand
1
+ // the releases page's routes (wiki tools/shipkit/units.md, The release files): every release file read fresh with the
2
+ // post draft each version staged, and a private picture shown from its scratch copy, else through a signed link of
3
+ // the Space. Read only: the files are written by an approval, `sk releases add` or a hand
4
4
  import { existsSync } from 'node:fs'
5
5
  import { extname, join } from 'node:path'
6
6
  import { shaOfKey } from '../media-store/content.ts'
@@ -9,10 +9,12 @@ import { PICTURE_ROUTE, type Release } from './model.ts'
9
9
  import { picturesDir, shownUrl } from './pictures.ts'
10
10
  import { readReleases } from './store.ts'
11
11
 
12
- /** what the page reads: every release, next first, and each file that does not parse */
12
+ /** what the page reads: every release, next first, each file that does not parse, and the post draft each released
13
+ * version staged, its slug by version */
13
14
  export interface ReleasesView {
14
15
  releases: Release[]
15
16
  errors: string[]
17
+ drafts: Record<string, string>
16
18
  }
17
19
 
18
20
  /** the releases routes of the repo at `root`; null for any other path */
@@ -20,7 +22,10 @@ export async function releasesRoutes(root: string, req: Request, path: string):
20
22
  if (path !== '/api/releases' && !path.startsWith('/api/releases/')) return null
21
23
  if (req.method !== 'GET') return bad(`releases: no route ${req.method} ${path}`, 404)
22
24
  try {
23
- if (path === '/api/releases') return Response.json(readReleases(root) satisfies ReleasesView, { headers: NO_STORE })
25
+ if (path === '/api/releases') {
26
+ const { releaseDrafts } = await import('../social/release-stage.ts')
27
+ return Response.json({ ...readReleases(root), drafts: releaseDrafts(root) } satisfies ReleasesView, { headers: NO_STORE })
28
+ }
24
29
  if (path.startsWith(PICTURE_ROUTE)) {
25
30
  const key = decodeURIComponent(path.slice(PICTURE_ROUTE.length))
26
31
  const sha = shaOfKey(key)
@@ -1,10 +1,10 @@
1
1
  // the release files on the disk (wiki tools/shipkit/units.md, The release files): `.shipkit/releases/next.md` and one
2
2
  // `<version>.md` a released version, read, written, and a change added to next. Pictures: pictures.ts
3
3
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs'
4
- import { join } from 'node:path'
4
+ import { basename, join } from 'node:path'
5
5
  import { atomicWrite } from '../core/locked-write.ts'
6
6
  import { LAYOUT } from '../core/layout.ts'
7
- import { byVersion, emptyRelease, fileOf, NEXT, parseRelease, renderRelease, upsertChange, withoutCard, type Change, type Release } from './model.ts'
7
+ import { byVersion, emptyRelease, fileOf, NEXT, parseRelease, renderRelease, upsertChange, withoutCard, type Change, type Release, changesNamed, changesOf, withoutChange } from './model.ts'
8
8
 
9
9
  const FILE = /^(next|\d+\.\d+\.\d+)\.md$/
10
10
 
@@ -20,6 +20,15 @@ export async function undeclaredReleases(root: string): Promise<string | null> {
20
20
  export const hasReleases = (root: string): boolean => existsSync(releasesDir(root))
21
21
  export const releaseFile = (root: string, version: string): string => join(releasesDir(root), fileOf(version))
22
22
 
23
+ /** the version whose release file a `<unit>@<version>` names (a staged draft's `release:`): only the root unit keeps
24
+ * release files, named `root` by a bump and by the repo's folder by `sk social release`; null for another unit, or
25
+ * when the folder holds no file of that version */
26
+ export function releaseVersionOf(root: string, ref: string | null | undefined): string | null {
27
+ const m = ref ? /^([^@]+)@(\d+\.\d+\.\d+)$/.exec(ref) : null
28
+ if (!m || (m[1] !== 'root' && m[1] !== basename(root))) return null
29
+ return existsSync(releaseFile(root, m[2]!)) ? m[2]! : null
30
+ }
31
+
23
32
  /** the versions the folder holds a file for, next first, then newest first */
24
33
  export function releaseVersions(root: string): string[] {
25
34
  const dir = releasesDir(root)
@@ -37,6 +46,18 @@ export function dropCardChange(root: string, card: string): string | null {
37
46
  return writeRelease(root, withoutCard(r, card))
38
47
  }
39
48
 
49
+ /** next without the one change `ref` names (its card id, or its title), written. Refused when it names none or
50
+ * several: a change is taken out by a name that is its own */
51
+ export function dropChange(root: string, ref: string): { file: string; title: string } {
52
+ const r = readRelease(root, NEXT)
53
+ if (r == null) throw new Error(`${LAYOUT.releases}/${fileOf(NEXT)} does not exist: there is no change to take out`)
54
+ const hits = changesNamed(r, ref)
55
+ const titles = (list: readonly { title: string }[]): string => list.map((c) => `« ${c.title} »`).join(', ')
56
+ if (hits.length === 0) throw new Error(`no change of ${fileOf(NEXT)} has « ${ref} » as its card or in its title; it holds ${titles(changesOf(r)) || 'none'}`)
57
+ if (hits.length > 1) throw new Error(`« ${ref} » names ${hits.length} changes (${titles(hits)}): give the card id or the whole title`)
58
+ return { file: writeRelease(root, withoutChange(r, hits[0]!)), title: hits[0]!.title }
59
+ }
60
+
40
61
  /** one release file, parsed; null when there is none */
41
62
  export function readRelease(root: string, version: string): Release | null {
42
63
  const f = releaseFile(root, version)
@@ -8,7 +8,7 @@
8
8
  // a slot that can't fill emits a visible reason, and one turned off with
9
9
  // `off: { x: '<why>' }` prints a skipped-by-config line, never silence.
10
10
  // The `contracts` task is always present when any contract applies.
11
- import type { Scope } from './core/scope.ts'
11
+ import { repoIdOf, type Scope } from './core/scope.ts'
12
12
  import { existsSync, readFileSync } from 'fs'
13
13
  import { isAbsolute, join, normalize } from 'path'
14
14
  import { ROUTED_SCRIPTS } from './core/canonical-scripts.ts'
@@ -78,6 +78,12 @@ export type ServeConfig = {
78
78
  * media store (review cards, trailer cuts...), read only in the house
79
79
  * config; its key pair read through `credsReadCommand` */
80
80
  mediaSpace?: import('./media-store/space.ts').MediaSpace
81
+ /** only in the house config: the bucket that holds the second copy of the hq's database, sent by Litestream
82
+ * (wiki tools/shipkit/hq.md). A bucket of its own, with versioning off */
83
+ hqReplica?: import('./hq/replica.ts').HqReplica
84
+ /** only in the house config: a bucket at another provider that holds a copy of every object of `mediaSpace` and
85
+ * the hq's nightly snapshot, copied by stream and proven each night (`sk space copy`) */
86
+ spaceCopy?: import('./media-store/copy/config.ts').SpaceCopy
81
87
  /** folders on external drives for the machine's heavy files, never a db,
82
88
  * in order, read only in the house config: the purge moves media there,
83
89
  * `sk annex offload` moves scratch there behind a symlink. Present only
@@ -113,6 +119,10 @@ export type RepoConfig = {
113
119
  * title, the motherhome row, the default hub port hash. The pre-commit
114
120
  * root-identity gate compares it to the package.json name. */
115
121
  name: string
122
+ /** the repo's permanent id: the same on every machine, whatever its folder, its remote or its printed name is
123
+ * called. What a secret's scope names the repo by (`repo:<id>`, wiki services/secrets). Lowercase letters,
124
+ * digits, `.`, `_` or `-`, starting with a letter or a digit. Absent: the name */
125
+ id?: string
116
126
  /** venue ids this repo ships on — selects which contracts are REQUIRED */
117
127
  venues?: string[]
118
128
  /** retired with the v2 social contract: read by nothing; delete the line (`sk social migrate` moves the posts) */
@@ -238,6 +248,12 @@ export type RepoConfig = {
238
248
  * for its kind (core/budget.ts). An id no check carries fails the run,
239
249
  * the same as an `off` entry. */
240
250
  budgets?: Record<string, number>
251
+ /** AGENT HOOKS THE GATE CANNOT TIME, each one's command exactly as
252
+ * `.claude/settings.json` writes it → why it answers at once. SK045 runs
253
+ * a hook on every tool call only when it takes a Bash call, so a hook on
254
+ * a save fails the gate unless it is named here; SK046 then warns on the
255
+ * runs the harness recorded. `defineRepo` throws on a blank reason */
256
+ instantHooks?: Record<string, string>
241
257
  /** RETIRED, read as `off` while SK029 ports it there: rule id → the reason
242
258
  * this repo breaks that invariant on purpose. An exempted rule does not
243
259
  * lint and prints a skip line carrying the reason. `defineRepo` throws on
@@ -250,6 +266,18 @@ export type RepoConfig = {
250
266
  * The button in the repo header and the page's unarchive toggle it, and
251
267
  * only this key moves (core/archived.ts) */
252
268
  archived?: boolean
269
+ /** only in the house config: what of the owner's history the daemon never sends to the hq (wiki
270
+ * tools/shipkit/hq.md) */
271
+ history?: {
272
+ /** names whose prompts and day rows never leave their machine, over every other rule: a folder of that name,
273
+ * whatever its case, and every form made from it (`<name>-…`, `<name>--…`, `<name>.…`, a subfolder), under
274
+ * any parent */
275
+ skip?: string[]
276
+ /** folders sent beside the house repos and their worktrees, which go by themselves: a name under the home dev
277
+ * folder, a path, or a folder as Claude Code names it (`-…`). Every folder neither names stays on its
278
+ * machine; `sk history send --dry` lists them */
279
+ also?: string[]
280
+ }
253
281
  /** declared github visibility INTENT (absent = 'private'): public means
254
282
  * strangers read the tracked tree. What each check does with it:
255
283
  * wiki/tools/shipkit/built-in-checks.md */
@@ -336,6 +364,10 @@ export type RepoConfig = {
336
364
  start?: {
337
365
  /** repo names `sk start` never touches: no CLAUDE.md include, no git, no scaffold, no push (a day-job checkout) */
338
366
  skip?: string[]
367
+ /** folders sent beside the house repos and their worktrees, which go by themselves: a name under the home dev
368
+ * folder, a path, or a folder as Claude Code names it (`-…`). Every folder neither names stays on its
369
+ * machine; `sk history send --dry` lists them */
370
+ also?: string[]
339
371
  }
340
372
  /** the headless browsers that shoot or record for this repo at once, on any machine (an sk shot ask, a take, a
341
373
  * look sheet's tabs, the trailer's films, sk smoke): each holds a slot of the repo's pool for its whole life,
@@ -384,10 +416,11 @@ export type RepoConfig = {
384
416
  logDir?: string
385
417
  }
386
418
 
387
- const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'speaksAs', 'backup', 'annex','docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'recorder', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
419
+ const KNOWN_KEYS = new Set(['name', 'id', 'venues', 'social', 'speaksAs', 'backup', 'annex','docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'instantHooks', 'ruleExempt', 'visibility', 'archived', 'history', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'recorder', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
388
420
 
389
421
  export function defineRepo(c: RepoConfig): RepoConfig {
390
422
  if (typeof c.name !== 'string' || c.name === '') throw new Error('defineRepo: name is required')
423
+ repoIdOf(c)
391
424
  for (const v of c.venues ?? []) if (!/^[a-z0-9-]+$/.test(v)) throw new Error(`defineRepo: venue '${v}' must be kebab-case`)
392
425
  if (c.speaksAs != null && !/^[a-z0-9][a-z0-9-]*$/.test(c.speaksAs)) throw new Error(`defineRepo: speaksAs '${String(c.speaksAs)}' must be an identity id, kebab-case (sk identities)`)
393
426
  if (c.visibility != null && c.visibility !== 'private' && c.visibility !== 'public')
@@ -395,6 +428,9 @@ export function defineRepo(c: RepoConfig): RepoConfig {
395
428
  // a half-declared reviewer would lint a path like `.claude/agents/.md`
396
429
  if (c.reviewer != null && (!/^[a-z0-9][a-z0-9-]*$/.test(c.reviewer.name ?? '') || (c.reviewer.brief ?? '') === ''))
397
430
  throw new Error(`defineRepo: reviewer needs { name: kebab-case, brief: path to the standing brief }`)
431
+ const names = (v: unknown): boolean => v == null || (Array.isArray(v) && v.every((x) => typeof x === 'string' && x !== ''))
432
+ if (c.history != null && (typeof c.history !== 'object' || !names(c.history.skip) || !names(c.history.also)))
433
+ throw new Error('defineRepo: history is { skip: [folder names], also: [folders] }')
398
434
  if (c.serve != null && 'processes' in c.serve)
399
435
  throw new Error(`defineRepo: serve.processes was removed; declare each process in a <name>.shipkit.ts file as \`export default globalProcess({...})\``)
400
436
  if (c.ignoredInputs != null && (typeof c.ignoredInputs !== 'object' || Array.isArray(c.ignoredInputs)))
@@ -479,6 +515,10 @@ export function defineRepo(c: RepoConfig): RepoConfig {
479
515
  if (RULE_ID_RE.test(id) && !builtinCheckIds().includes(id) && !(c.rules ?? []).some((r) => r.id === id))
480
516
  throw new Error(`defineRepo: off.${id} names no rule, the ids are in \`shipkit checks\``)
481
517
  }
518
+ for (const [command, reason] of Object.entries(c.instantHooks ?? {})) {
519
+ if (command.trim() === '') throw new Error(`defineRepo: instantHooks has an entry with no command`)
520
+ if (typeof reason !== 'string' || reason.trim() === '') throw new Error(`defineRepo: instantHooks entry \`${command}\` needs a reason: why it answers at once`)
521
+ }
482
522
  // the retired `when`: only its `off:<why>` word still means something
483
523
  for (const [id, raw] of Object.entries(c.when ?? {})) {
484
524
  const w = parseWhen(raw)
@@ -1,5 +1,5 @@
1
- // a card's before and after as a looping animation to send (wiki tools/shipkit/review.md, Verbs on the store): the one
2
- // function behind the hub's « animation » and `sk review anim`. One cycle is drawn by ffmpeg's own filters (no per pixel
1
+ // a card's before and after as a looping animation to send (wiki tools/shipkit/threads.md, Verbs on the store): the one
2
+ // function behind the hub's « animation » and `sk thread anim`. One cycle is drawn by ffmpeg's own filters (no per pixel
3
3
  // expression: a card renders in a few seconds), an mp4 then repeats it with no second encode
4
4
  import { createCanvas, GlobalFonts } from '@napi-rs/canvas'
5
5
  import { existsSync, mkdirSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'