rvlib-shipkit 2.26.0 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +6 -4
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +1 -3
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/render.ts +122 -21
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +314 -40
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +320 -99
  15. package/src/agent-time/timeline.ts +140 -21
  16. package/src/agent-time/turns.ts +18 -8
  17. package/src/annex/offload.ts +17 -6
  18. package/src/annex/tidy.ts +70 -10
  19. package/src/asks/ask-after.ts +40 -0
  20. package/src/asks/asks-queue.ts +205 -47
  21. package/src/assets/kit-config.ts +7 -3
  22. package/src/assets/kits/identity-kit.ts +289 -10
  23. package/src/check.ts +3 -1
  24. package/src/checks/SK004-gitignore-policy.check.ts +12 -5
  25. package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
  26. package/src/checks/SK026-asks-autoclose.check.ts +5 -5
  27. package/src/checks/SK028-readme.check.ts +7 -66
  28. package/src/checks/SK030-cache-audit.check.ts +6 -1
  29. package/src/checks/SK031-trace-audit.check.ts +2 -0
  30. package/src/checks/SK033-global-contribution.check.ts +3 -1
  31. package/src/checks/SK035-public-clean.check.ts +2 -2
  32. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  33. package/src/checks/SK047-login-in-description.check.ts +36 -0
  34. package/src/checks/SK048-one-local-file.check.ts +36 -0
  35. package/src/cli/cmd_Asks.ts +71 -5
  36. package/src/cli/cmd_Backup.ts +2 -2
  37. package/src/cli/cmd_Capacity.ts +2 -2
  38. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  39. package/src/cli/cmd_Db.ts +253 -0
  40. package/src/cli/cmd_History.ts +212 -0
  41. package/src/cli/cmd_Home.ts +31 -3
  42. package/src/cli/cmd_Hq.ts +516 -0
  43. package/src/cli/cmd_Machines.ts +36 -0
  44. package/src/cli/cmd_Media.ts +38 -6
  45. package/src/cli/cmd_Reflect.ts +23 -2
  46. package/src/cli/cmd_Review.ts +548 -116
  47. package/src/cli/cmd_Secret.ts +62 -12
  48. package/src/cli/cmd_Social.ts +83 -1
  49. package/src/cli/cmd_Space.ts +324 -0
  50. package/src/cli/cmd_Time.ts +76 -5
  51. package/src/cli/cmd_Tmp.ts +28 -4
  52. package/src/cli/cmd_Trailer.ts +14 -10
  53. package/src/cli/cmd_Urls.ts +56 -0
  54. package/src/cli/cmd_Vault.ts +583 -0
  55. package/src/cli/family-help.ts +4 -2
  56. package/src/cli/family-pages.ts +1 -1
  57. package/src/cli/registry.ts +24 -3
  58. package/src/collections/actions.ts +63 -13
  59. package/src/collections/collection-types.ts +23 -1
  60. package/src/collections/providers.ts +117 -23
  61. package/src/collections/review.ts +4 -4
  62. package/src/contracts/contract-manifests.ts +6 -5
  63. package/src/contracts/contract-types.ts +6 -4
  64. package/src/contracts/contracts-engine.ts +11 -0
  65. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  66. package/src/core/budget.ts +12 -17
  67. package/src/core/capacity.ts +27 -18
  68. package/src/core/check-runner.ts +7 -4
  69. package/src/core/layout.ts +3 -0
  70. package/src/core/machine-busy.ts +127 -0
  71. package/src/core/machine-commit.ts +6 -1
  72. package/src/core/machine-db.ts +368 -20
  73. package/src/core/machine-layout.ts +137 -0
  74. package/src/core/machine-read.ts +81 -0
  75. package/src/core/migrate-layout.ts +1 -1
  76. package/src/core/one-way-in-policy.ts +64 -7
  77. package/src/core/polling-policy.ts +27 -0
  78. package/src/core/retention.ts +16 -2
  79. package/src/core/scope.ts +107 -14
  80. package/src/core/slots.ts +5 -4
  81. package/src/drill/clean.ts +25 -1
  82. package/src/drill/run.ts +1 -1
  83. package/src/drill/seal.ts +27 -4
  84. package/src/home/activity-shape.ts +2 -0
  85. package/src/home/activity.ts +66 -3
  86. package/src/home/app-sign.ts +15 -4
  87. package/src/home/daemon-jobs.ts +149 -7
  88. package/src/home/database-projects.ts +111 -0
  89. package/src/home/database-words.ts +203 -0
  90. package/src/home/databases.ts +460 -0
  91. package/src/home/global-units.ts +6 -0
  92. package/src/home/gui-app/ShipkitGui.swift +122 -1
  93. package/src/home/gui-app.ts +6 -3
  94. package/src/home/home-move.ts +514 -0
  95. package/src/home/home-paths.ts +12 -3
  96. package/src/home/home-routes.ts +68 -0
  97. package/src/home/inbox-shape.ts +24 -14
  98. package/src/home/machine-fold.ts +820 -0
  99. package/src/home/machine-host.ts +20 -5
  100. package/src/home/machine-repair.ts +503 -0
  101. package/src/home/machine-stores.ts +66 -15
  102. package/src/home/machine-temp.ts +547 -86
  103. package/src/home/resume.ts +79 -0
  104. package/src/home/run-daemon.ts +25 -4
  105. package/src/home/run-pm.ts +18 -5
  106. package/src/home/serve-daemon.ts +18 -3
  107. package/src/home/serve-web.ts +175 -7
  108. package/src/home/space-job.ts +115 -0
  109. package/src/home/space-page.ts +257 -0
  110. package/src/home/space-route.ts +167 -0
  111. package/src/home/space-words.ts +103 -0
  112. package/src/home/time-page-shape.ts +202 -0
  113. package/src/home/time-page.ts +64 -0
  114. package/src/home/vault-page.ts +482 -0
  115. package/src/home/vault-words.ts +132 -0
  116. package/src/hooks/leak-guard.ts +40 -13
  117. package/src/hooks/one-way-in-guard.ts +17 -4
  118. package/src/hq/cards.ts +581 -0
  119. package/src/hq/door-route.ts +43 -0
  120. package/src/hq/door.ts +163 -0
  121. package/src/hq/files-send.ts +348 -0
  122. package/src/hq/forgotten-log.ts +35 -0
  123. package/src/hq/history-check.ts +255 -0
  124. package/src/hq/history-place.ts +146 -0
  125. package/src/hq/history-send.ts +487 -0
  126. package/src/hq/hq-db.ts +99 -0
  127. package/src/hq/hq-local.ts +469 -0
  128. package/src/hq/hq-routes.ts +196 -0
  129. package/src/hq/hq-store.ts +599 -0
  130. package/src/hq/kinds/ask.ts +147 -0
  131. package/src/hq/kinds/card-gone.ts +83 -0
  132. package/src/hq/kinds/card-msg.ts +66 -0
  133. package/src/hq/kinds/card.ts +99 -0
  134. package/src/hq/kinds/index.ts +21 -0
  135. package/src/hq/kinds/kind.ts +126 -0
  136. package/src/hq/kinds/media.ts +125 -0
  137. package/src/hq/kinds/prompt.ts +219 -0
  138. package/src/hq/kinds/reflection.ts +128 -0
  139. package/src/hq/kinds/report.ts +55 -0
  140. package/src/hq/kinds/time-day.ts +236 -0
  141. package/src/hq/ledger.ts +473 -0
  142. package/src/hq/machine-key.ts +44 -0
  143. package/src/hq/machine-notes.ts +131 -0
  144. package/src/hq/outbox.ts +372 -0
  145. package/src/hq/replica.ts +168 -0
  146. package/src/hq/repo-id.ts +4 -0
  147. package/src/hq/report-facts.ts +117 -0
  148. package/src/hq/report.ts +274 -0
  149. package/src/hq/switch.ts +151 -0
  150. package/src/hq/vault-grant.ts +92 -0
  151. package/src/identities/identities.ts +15 -3
  152. package/src/identities/steps.ts +31 -0
  153. package/src/ledger/db.ts +73 -26
  154. package/src/ledger/gate-checks.ts +6 -2
  155. package/src/ledger/run-log.ts +11 -3
  156. package/src/ledger/store.ts +26 -4
  157. package/src/media-store/backup/daemon.ts +25 -17
  158. package/src/media-store/backup/kept.ts +241 -0
  159. package/src/media-store/backup/restore.ts +14 -4
  160. package/src/media-store/backup/run.ts +11 -11
  161. package/src/media-store/backup/secret.ts +6 -4
  162. package/src/media-store/backup/snapshot.ts +4 -2
  163. package/src/media-store/backup/sources.ts +67 -16
  164. package/src/media-store/copy/config.ts +77 -0
  165. package/src/media-store/copy/copy.ts +194 -0
  166. package/src/media-store/copy/lifecycle.ts +43 -0
  167. package/src/media-store/copy/night.ts +90 -0
  168. package/src/media-store/copy/proof.ts +151 -0
  169. package/src/media-store/copy/snapshot.ts +152 -0
  170. package/src/media-store/copy/store.ts +62 -0
  171. package/src/media-store/copy/stream.ts +176 -0
  172. package/src/media-store/daemon.ts +66 -16
  173. package/src/media-store/db.ts +22 -11
  174. package/src/media-store/forget.ts +23 -3
  175. package/src/media-store/hand.ts +4 -3
  176. package/src/media-store/hq-find.ts +75 -0
  177. package/src/media-store/hq-send.ts +277 -0
  178. package/src/media-store/kind.ts +2 -0
  179. package/src/media-store/purge.ts +18 -15
  180. package/src/media-store/put.ts +24 -8
  181. package/src/media-store/remote.ts +16 -7
  182. package/src/media-store/space-listing.ts +240 -0
  183. package/src/media-store/space.ts +40 -21
  184. package/src/media-store/sync.ts +5 -5
  185. package/src/media-store/tidy.ts +98 -0
  186. package/src/media-store/upload.ts +3 -3
  187. package/src/media-store/webp.ts +66 -0
  188. package/src/messages/model.ts +16 -7
  189. package/src/messages/routes.ts +14 -4
  190. package/src/messages/score.ts +2 -2
  191. package/src/messages/suggest.ts +96 -0
  192. package/src/pages/frame-client.ts +10 -0
  193. package/src/plan/planner.ts +28 -17
  194. package/src/recordings/media-kind.ts +1 -0
  195. package/src/recordings/model.ts +1 -1
  196. package/src/recordings/recorder-app/Capture.swift +9 -7
  197. package/src/reflect/hq-corpus.ts +56 -0
  198. package/src/reflect/prompt-corpus.ts +3 -1
  199. package/src/reflect/transcript.ts +129 -37
  200. package/src/release/machine-words.ts +67 -0
  201. package/src/release/public-clean.ts +8 -3
  202. package/src/releases/from-card.ts +1 -1
  203. package/src/releases/routes.ts +10 -5
  204. package/src/releases/store.ts +10 -1
  205. package/src/repo-config.ts +32 -2
  206. package/src/review/anim.ts +2 -2
  207. package/src/review/auto.ts +2 -2
  208. package/src/review/card-db.ts +244 -0
  209. package/src/review/card-rows.ts +266 -0
  210. package/src/review/cells.ts +76 -5
  211. package/src/review/draft-card.ts +41 -0
  212. package/src/review/draft-model.ts +78 -0
  213. package/src/review/format.ts +29 -10
  214. package/src/review/gone.ts +98 -0
  215. package/src/review/inbox-hook.ts +4 -4
  216. package/src/review/marks.ts +1 -1
  217. package/src/review/media-kind.ts +7 -5
  218. package/src/review/media-read.ts +9 -7
  219. package/src/review/media.ts +32 -5
  220. package/src/review/model.ts +202 -39
  221. package/src/review/move.ts +491 -0
  222. package/src/review/notes.ts +12 -20
  223. package/src/review/previews.ts +15 -19
  224. package/src/review/project.ts +1 -1
  225. package/src/review/rev.ts +8 -0
  226. package/src/review/role.ts +1 -1
  227. package/src/review/routes.ts +64 -13
  228. package/src/review/stage-card.ts +8 -4
  229. package/src/review/stage-routes.ts +1 -1
  230. package/src/review/store.ts +529 -83
  231. package/src/review/thread-fold.ts +51 -0
  232. package/src/review/threads.ts +147 -9
  233. package/src/review/trailer-auto-mock.ts +63 -0
  234. package/src/review/trailer-card.ts +4 -4
  235. package/src/review/trailer-desk.ts +41 -7
  236. package/src/review/trailer-media.ts +1 -0
  237. package/src/review/trailer-model.ts +8 -0
  238. package/src/review/trailer-notes.ts +1 -1
  239. package/src/review/trailer-routes.ts +9 -1
  240. package/src/review/unit.ts +6 -6
  241. package/src/review/watchers.ts +1 -1
  242. package/src/rules/untrack-generated.ts +92 -8
  243. package/src/secrets/held.ts +16 -0
  244. package/src/secrets/keychain.ts +113 -0
  245. package/src/secrets/list.ts +16 -6
  246. package/src/secrets/manager.ts +24 -10
  247. package/src/secrets/read.ts +257 -0
  248. package/src/secrets/who-reads.ts +49 -0
  249. package/src/serve/door-forward.ts +268 -0
  250. package/src/serve/door-names.ts +47 -0
  251. package/src/serve/embed.ts +1 -1
  252. package/src/serve/hub-app/activity-view.tsx +56 -32
  253. package/src/serve/hub-app/activity.css +7 -1
  254. package/src/serve/hub-app/asks-page.tsx +48 -0
  255. package/src/serve/hub-app/asks-st.ts +25 -0
  256. package/src/serve/hub-app/clock-svc.ts +1 -2
  257. package/src/serve/hub-app/col-card.tsx +64 -13
  258. package/src/serve/hub-app/col-list-page.tsx +122 -0
  259. package/src/serve/hub-app/col-list-st.ts +103 -0
  260. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  261. package/src/serve/hub-app/col-tables.ts +76 -8
  262. package/src/serve/hub-app/cols-svc.ts +70 -16
  263. package/src/serve/hub-app/database-st.ts +260 -0
  264. package/src/serve/hub-app/database-view.tsx +289 -0
  265. package/src/serve/hub-app/database.css +32 -0
  266. package/src/serve/hub-app/entry-bar.css +14 -0
  267. package/src/serve/hub-app/entry-bar.tsx +33 -0
  268. package/src/serve/hub-app/entry-pick.ts +31 -0
  269. package/src/serve/hub-app/floating.tsx +1 -0
  270. package/src/serve/hub-app/hash-route.ts +11 -1
  271. package/src/serve/hub-app/header-bar.tsx +14 -18
  272. package/src/serve/hub-app/home-st.ts +89 -9
  273. package/src/serve/hub-app/home-strip.css +5 -19
  274. package/src/serve/hub-app/home-strip.tsx +58 -92
  275. package/src/serve/hub-app/home.html +7 -0
  276. package/src/serve/hub-app/hub-app.tsx +31 -142
  277. package/src/serve/hub-app/hub-types.ts +3 -1
  278. package/src/serve/hub-app/hub.css +109 -23
  279. package/src/serve/hub-app/icons.tsx +18 -1
  280. package/src/serve/hub-app/identities-st.ts +56 -6
  281. package/src/serve/hub-app/identities-view.tsx +100 -58
  282. package/src/serve/hub-app/identities.css +17 -15
  283. package/src/serve/hub-app/identity-address.ts +5 -0
  284. package/src/serve/hub-app/inbox-st.ts +41 -24
  285. package/src/serve/hub-app/inbox-view.tsx +37 -41
  286. package/src/serve/hub-app/inbox.css +2 -5
  287. package/src/serve/hub-app/index.html +7 -0
  288. package/src/serve/hub-app/kept-cols.tsx +7 -0
  289. package/src/serve/hub-app/keys.ts +28 -15
  290. package/src/serve/hub-app/later.tsx +26 -0
  291. package/src/serve/hub-app/list-filter.tsx +14 -0
  292. package/src/serve/hub-app/list-walk.ts +72 -3
  293. package/src/serve/hub-app/machines-st.ts +251 -0
  294. package/src/serve/hub-app/machines-view.tsx +224 -0
  295. package/src/serve/hub-app/machines.css +76 -0
  296. package/src/serve/hub-app/md-copy.tsx +79 -0
  297. package/src/serve/hub-app/media-view.tsx +2 -0
  298. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  299. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  300. package/src/serve/hub-app/messages.css +14 -0
  301. package/src/serve/hub-app/page-keys.ts +175 -0
  302. package/src/serve/hub-app/pages-frames.tsx +11 -3
  303. package/src/serve/hub-app/palette-st.ts +58 -11
  304. package/src/serve/hub-app/palette-view.tsx +3 -1
  305. package/src/serve/hub-app/project-list.css +54 -8
  306. package/src/serve/hub-app/project-list.tsx +128 -59
  307. package/src/serve/hub-app/projects-svc.ts +78 -7
  308. package/src/serve/hub-app/reader-chips.tsx +13 -0
  309. package/src/serve/hub-app/readme-view.tsx +2 -3
  310. package/src/serve/hub-app/readme.css +27 -5
  311. package/src/serve/hub-app/reflections-page.tsx +42 -0
  312. package/src/serve/hub-app/reflections-st.ts +17 -0
  313. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  314. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  315. package/src/serve/hub-app/repo-sections.ts +9 -5
  316. package/src/serve/hub-app/repo-st.ts +35 -8
  317. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  318. package/src/serve/hub-app/review/kit.tsx +50 -7
  319. package/src/serve/hub-app/review/note-place.ts +1 -1
  320. package/src/serve/hub-app/review/review-board.tsx +2 -2
  321. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  322. package/src/serve/hub-app/review/review-kit.ts +27 -1
  323. package/src/serve/hub-app/review/review-list.tsx +68 -30
  324. package/src/serve/hub-app/review/review-page.tsx +7 -8
  325. package/src/serve/hub-app/review/review-st.ts +111 -24
  326. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  327. package/src/serve/hub-app/review/review-views.tsx +475 -144
  328. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  329. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  330. package/src/serve/hub-app/review/thread-st.ts +73 -26
  331. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  332. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  333. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  334. package/src/serve/hub-app/review.css +267 -61
  335. package/src/serve/hub-app/side-lists.ts +72 -0
  336. package/src/serve/hub-app/sidebar.tsx +6 -3
  337. package/src/serve/hub-app/site/site-part.tsx +2 -8
  338. package/src/serve/hub-app/site/site-st.ts +4 -4
  339. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  340. package/src/serve/hub-app/social/kit.tsx +30 -4
  341. package/src/serve/hub-app/social/post-card.tsx +139 -49
  342. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  343. package/src/serve/hub-app/social/social-model.ts +11 -0
  344. package/src/serve/hub-app/social/social-page.tsx +94 -35
  345. package/src/serve/hub-app/social/social-st.ts +120 -36
  346. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  347. package/src/serve/hub-app/social/stage-st.ts +1 -1
  348. package/src/serve/hub-app/social/step-layout.ts +1 -1
  349. package/src/serve/hub-app/social.css +3 -0
  350. package/src/serve/hub-app/space-st.ts +209 -0
  351. package/src/serve/hub-app/space-view.tsx +196 -0
  352. package/src/serve/hub-app/space.css +27 -0
  353. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  354. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  355. package/src/serve/hub-app/stores.css +6 -1
  356. package/src/serve/hub-app/theme-st.ts +22 -9
  357. package/src/serve/hub-app/time-charts.tsx +291 -0
  358. package/src/serve/hub-app/time-pages.tsx +749 -0
  359. package/src/serve/hub-app/time-st.ts +162 -0
  360. package/src/serve/hub-app/time-view.tsx +76 -0
  361. package/src/serve/hub-app/time.css +138 -0
  362. package/src/serve/hub-app/tree-build.ts +52 -42
  363. package/src/serve/hub-app/tree-row.tsx +4 -4
  364. package/src/serve/hub-app/tree-svc.ts +18 -9
  365. package/src/serve/hub-app/urls-svc.ts +154 -0
  366. package/src/serve/hub-app/urls-view.tsx +117 -0
  367. package/src/serve/hub-app/urls.css +30 -0
  368. package/src/serve/hub-app/vault-st.ts +127 -0
  369. package/src/serve/hub-app/vault-view.tsx +154 -0
  370. package/src/serve/hub-app/vault.css +38 -0
  371. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  372. package/src/serve/hub-app/waiting-svc.ts +29 -0
  373. package/src/serve/hub-app/wikis-view.tsx +2 -2
  374. package/src/serve/hub-runtime.ts +15 -2
  375. package/src/serve/project-gutter-route.ts +27 -14
  376. package/src/serve/project-gutter.ts +25 -12
  377. package/src/serve/same-origin.ts +10 -0
  378. package/src/serve/serve-hub.ts +13 -4
  379. package/src/shipkit-files.ts +16 -2
  380. package/src/shipkit.ts +1 -1
  381. package/src/shot/shooter.ts +616 -420
  382. package/src/shot/shot-ask.ts +246 -155
  383. package/src/site/desk.ts +2 -2
  384. package/src/smoke/run-smoke.ts +3 -2
  385. package/src/social/cover.ts +202 -0
  386. package/src/social/discord-layout.ts +37 -13
  387. package/src/social/drafts.ts +3 -0
  388. package/src/social/load.ts +23 -2
  389. package/src/social/media-kind.ts +2 -1
  390. package/src/social/publish/discord.ts +5 -2
  391. package/src/social/publish/secret.ts +2 -2
  392. package/src/social/release-stage.ts +28 -13
  393. package/src/social/routes.ts +26 -1
  394. package/src/social/stage.ts +1 -1
  395. package/src/social/stats.ts +12 -9
  396. package/src/social/strip.ts +4 -1
  397. package/src/social/thumbnail.ts +255 -0
  398. package/src/stores/collection.ts +15 -11
  399. package/src/stores/desk.ts +236 -42
  400. package/src/stores/model.ts +72 -6
  401. package/src/stores/routes.ts +37 -12
  402. package/src/stores/unit.ts +14 -8
  403. package/src/suite/judge-suites.ts +41 -11
  404. package/src/suite/select.ts +45 -3
  405. package/src/suite/suite-cli.ts +16 -10
  406. package/src/trailer/bed.ts +1 -1
  407. package/src/trailer/build.ts +134 -21
  408. package/src/trailer/ffmpeg.ts +7 -0
  409. package/src/trailer/fonts.ts +3 -2
  410. package/src/trailer/grammar.ts +201 -2
  411. package/src/trailer/graph.ts +42 -5
  412. package/src/trailer/look.ts +21 -0
  413. package/src/trailer/mock.ts +154 -0
  414. package/src/trailer/passage.ts +65 -26
  415. package/src/trailer/score/heard.ts +89 -0
  416. package/src/trailer/score/sound.ts +14 -8
  417. package/src/trailer/sound/run.ts +16 -6
  418. package/src/trailer/stitch.ts +26 -5
  419. package/src/trailer/titles.ts +82 -19
  420. package/src/trailer/versions.ts +1 -3
  421. package/src/trailer/vertical.ts +3 -1
  422. package/src/urls/frame.ts +195 -0
  423. package/src/urls/routes.ts +43 -0
  424. package/src/urls/rows.ts +171 -0
  425. package/src/urls/unit.ts +73 -0
  426. package/src/vault/house-keys.ts +42 -0
  427. package/src/vault/layout.ts +50 -0
  428. package/src/vault/policy.ts +165 -0
  429. package/src/vault/vault-audit.ts +276 -0
  430. package/src/vault/vault-client.ts +40 -0
  431. package/src/vault/vault-config.ts +159 -0
  432. package/src/vault/vault-destroy.ts +78 -0
  433. package/src/vault/vault-handover.ts +305 -0
  434. package/src/vault/vault-http.ts +352 -0
  435. package/src/vault/vault-import.ts +208 -0
  436. package/src/vault/vault-init.ts +328 -0
  437. package/src/vault/vault-minter.ts +271 -0
  438. package/src/vault/vault-restore.ts +333 -0
  439. package/src/vault/vault-serve.ts +342 -0
  440. package/src/vault/vault-snapshot.ts +281 -0
  441. package/src/veille/asks.ts +1 -1
  442. package/src/veille/desk.ts +2 -2
@@ -12,14 +12,16 @@
12
12
  // has been denied." and nothing else, so the agent goes looking for
13
13
  // another way in, which is the failure this whole file exists to prevent.
14
14
  // The deny is the floor and the hook is the messenger. When the hook cannot
15
- // run, enforcement degrades to terse rather than to nothing.
15
+ // run, enforcement degrades to terse rather than to nothing, except for a
16
+ // scoped runner: its bare row stops only the bare call, so the flag forms of
17
+ // a whole suite run (`bun test --parallel=5`) pass when the hook cannot run.
16
18
  //
17
19
  // Subprocesses are NOT intercepted (verified): shipkit spawning bun check or
18
20
  // `bun run test:raw` from inside a permitted `shipkit ci` is invisible to
19
21
  // these rules, which is exactly what makes the gate itself still work.
20
22
 
21
23
  export type RawRunner = {
22
- /** the command head as an agent types it — the deny rule is this + `*` */
24
+ /** the command head as an agent types it: the deny row is this + `*`, or this alone for a scoped runner (denyRow) */
23
25
  head: string
24
26
  /** the floor slot it answers, so ONE exemption governs the script name and
25
27
  * the shell command together: a repo that keeps `test` raw is not then
@@ -34,10 +36,14 @@ export type RawRunner = {
34
36
  * FILE filter (measured): bun's positional argument matches the test FILE
35
37
  * path, and a test NAME needs `-- -t "<name>"` forwarded through bun run */
36
38
  also?: string
39
+ /** a run that names a file or folder passes: only the whole suite is refused,
40
+ * and the deny row is the bare head, never the head and a star */
41
+ scoped?: true
37
42
  }
38
43
 
39
44
  const BYPASS = 'bypasses shipkit, so nothing is cached and no other agent\'s run can be attached to'
40
45
  const TEST: Omit<RawRunner, 'head'> = { slot: 'test', why: BYPASS, use: 'shipkit ci --only test', also: '`bun run test:raw <test file>` to iterate on ONE suite while you fix a bug' }
46
+ const BUN_TEST: Omit<RawRunner, 'head'> = { slot: 'test', why: 'with no file or folder runs the whole suite outside the gate', use: 'shipkit ci --only test', also: '`bun test <file or folder>` to iterate (`bun run test:raw <file>` where `test:raw` carries flags a file needs)', scoped: true }
41
47
  // bun check is bun's own checker: tsc's errors on every core, so it runs bare
42
48
  // like `bun lint`. A package.json `check` script runs in its place (SK001 warns)
43
49
  const TYPECHECK: Omit<RawRunner, 'head'> = { slot: 'typecheck', why: 'is not the house type checker', use: 'bun check', also: '`shipkit ci --only typecheck` for the gate\'s verdict, cached. Where package.json has a `check` script, `bun check --no-script`' }
@@ -46,7 +52,7 @@ const TYPECHECK: Omit<RawRunner, 'head'> = { slot: 'typecheck', why: 'is not the
46
52
  // carrying. Kept tight on purpose: a deny an agent hits for no good reason
47
53
  // teaches it to route around the whole file.
48
54
  export const RAW_RUNNERS: readonly RawRunner[] = [
49
- { head: 'bun test', ...TEST },
55
+ { head: 'bun test', ...BUN_TEST },
50
56
  { head: 'bunx vitest', ...TEST },
51
57
  { head: 'npx vitest', ...TEST },
52
58
  { head: 'vitest', ...TEST },
@@ -64,10 +70,59 @@ export const RAW_RUNNERS: readonly RawRunner[] = [
64
70
 
65
71
  /** the `permissions.deny` entries, in the syntax Claude Code matches:
66
72
  * `Bash(<head>*)` is a prefix match, and a compound command is checked one
67
- * segment at a time, so `cd x && bun test` is caught too */
73
+ * segment at a time, so `cd x && bun test` is caught too. A scoped runner's
74
+ * row is its bare head: `bun test <file>` passes, the guard refuses the rest */
75
+ export const denyRow = (r: RawRunner): string => (r.scoped ? `Bash(${r.head})` : `Bash(${r.head}*)`)
76
+
68
77
  export const denyRules = (exemptSlots: Iterable<string> = []): string[] => {
69
78
  const off = new Set(exemptSlots)
70
- return [...RAW_RUNNERS.filter((r) => !off.has(r.slot)).map((r) => `Bash(${r.head}*)`), ...GIT_STASH_RULES]
79
+ return [...RAW_RUNNERS.filter((r) => !off.has(r.slot)).map(denyRow), ...GIT_STASH_RULES]
80
+ }
81
+
82
+ /** the rows a scoped runner's star used to render, which also refuse its scoped runs: SK013 removes them */
83
+ export const LEGACY_SCOPED_RULES: readonly string[] = RAW_RUNNERS.filter((r) => r.scoped).flatMap((r) => [`Bash(${r.head}*)`, `Bash(${r.head} *)`])
84
+
85
+ /** `bun test`'s flags that take the next word as their value, so that word names no file (bun 1.4: `--bail` takes `=N`) */
86
+ const VALUE_FLAGS = new Set(['-t', '--test-name-pattern', '--timeout', '--rerun-each', '--retry', '--preload', '--reporter', '--reporter-outfile', '--coverage-reporter', '--coverage-dir', '--env-file', '--seed', '--max-concurrency', '--shard'])
87
+
88
+ /** a word bun reads as a filter on test file paths (`./a.test.ts`, `tests/`, `agent-time`). `.` and `./` match every file */
89
+ const PATH_WORD = /^(?!\.\/?$)[^-]/
90
+
91
+ /** the words after a head, a quoted run kept as one word (`-t "a name"` is a flag and ONE value) */
92
+ function argsAfter(seg: string, head: string[]): string[] {
93
+ const w = quotedWords(seg)
94
+ const at = w.findIndex((x, i) => (x.split('/').pop() ?? x) === head[0] && head.slice(1).every((h, j) => w[i + 1 + j] === h))
95
+ return at < 0 ? [] : w.slice(at + head.length)
96
+ }
97
+
98
+ /** true when the words after a head narrow the run to a file or folder, or only ask for help */
99
+ function narrowsTheRun(rest: string[]): boolean {
100
+ for (let i = 0; i < rest.length; i++) {
101
+ const w = rest[i]!
102
+ if (w === '--help' || w === '-h') return true
103
+ if (/^[<>|&;]|^\d*>/.test(w)) return false
104
+ if (w.startsWith('-')) {
105
+ if (VALUE_FLAGS.has(w)) i++
106
+ continue
107
+ }
108
+ if (PATH_WORD.test(w)) return true
109
+ }
110
+ return false
111
+ }
112
+
113
+ /** a scoped run (`bun test ./a.test.ts`) in a repo whose settings still carry the old star row, which denies it with
114
+ * no reason: the guard says so and names the repair. Null when the row is gone or the run is not scoped */
115
+ export function staleScopedRefusal(settings: unknown, command: string): string | null {
116
+ const deny = (settings as { permissions?: { deny?: unknown } } | null)?.permissions?.deny
117
+ const stale = Array.isArray(deny) ? LEGACY_SCOPED_RULES.find((r) => deny.includes(r)) : undefined
118
+ if (stale == null) return null
119
+ for (const seg of shellSegments(command)) {
120
+ const words = programWords(seg)
121
+ const r = RAW_RUNNERS.find((x) => x.scoped && x.head.split(' ').every((h, i) => (i === 0 ? (words[0]?.split('/').pop() ?? '') : words[i]) === h))
122
+ if (r != null && narrowsTheRun(argsAfter(seg, r.head.split(' '))))
123
+ return `\`${seg.trim().slice(0, 80)}\` is a run of one file or folder, which is allowed, but this repo's .claude/settings.json still carries the old "${stale}" row, which denies it. Run \`sk ci --only SK013\` once: it replaces that row with "${denyRow(r)}", then run this again.`
124
+ }
125
+ return null
71
126
  }
72
127
 
73
128
  // `git stash` in a tree that other agents share takes every agent's
@@ -185,7 +240,7 @@ export function stashRefusal(segment: string): string {
185
240
  export function refusal(r: RawRunner, segment?: string): string {
186
241
  const alt = r.also == null ? '' : `, or ${r.also}`
187
242
  const which = segment == null || segment.trim() === '' || segment.trim() === r.head ? '' : ` (refused on \`${segment.trim().slice(0, 80)}\`)`
188
- return `\`${r.head}\`${which} ${r.why}. Use \`${r.use}\`${alt}. Lifting this for good: delete the "Bash(${r.head}*)" line from .claude/settings.json permissions.deny (tools/shipkit/one-way-in.md).`
243
+ return `\`${r.head}\`${which} ${r.why}. Use \`${r.use}\`${alt}. Lifting this for good: delete the "${denyRow(r)}" line from .claude/settings.json permissions.deny (tools/shipkit/one-way-in.md).`
189
244
  }
190
245
 
191
246
  /** shell wrappers that do not change what is being run */
@@ -341,7 +396,9 @@ export function rawRunnerHit(command: string, only?: ReadonlySet<string>): { run
341
396
  for (const r of heads) {
342
397
  const parts = r.head.split(' ')
343
398
  if (parts[0] !== program) continue
344
- if (parts.length === 1 || words[1] === parts[1]) return { runner: r, segment: seg }
399
+ if (parts.length !== 1 && words[1] !== parts[1]) continue
400
+ if (r.scoped && narrowsTheRun(argsAfter(seg, parts))) continue
401
+ return { runner: r, segment: seg }
345
402
  }
346
403
  }
347
404
  return null
@@ -0,0 +1,27 @@
1
+ // a wait loop on `pgrep -f <name>`, refused by the Bash guard (hooks/one-way-in-guard.ts). Loops that wait on the
2
+ // same name match each other's command line and never end (macOS pgrep skips only its own ancestors). Any other wait
3
+ // loop stays allowed: under run_in_background or the Monitor tool it is the harness's own way to wait, and the harness
4
+ // hands a Monitor command to a Bash hook as a plain Bash call, so a guard cannot tell the two apart.
5
+ // Missed on purpose, rare in the transcripts: a flag with a value before -f (`pgrep -u me -f x`), and the check in the
6
+ // body (`while true; do pgrep -f x || break; …`).
7
+ // meta/speed-up-agents/how-to-configure-agent-for-speed.md owns the measures.
8
+
9
+ /** the command with heredoc bodies dropped and quoted text blanked, but a `$(...)` inside double quotes kept: the
10
+ * shell runs it (`[ -n "$(pgrep -f x)" ]`) */
11
+ function codeOf(command: string): string {
12
+ const shell = command.split(/<<-?\s*['"]?\w+/)[0] ?? command
13
+ return shell.replace(/"(?:\\.|[^"\\])*"/g, (q) => (q.match(/\$\([^)]*\)/g) ?? []).join(' ') || "''").replace(/'[^']*'/g, "''")
14
+ }
15
+
16
+ // the keyword where a command starts, then a condition that calls pgrep with -f, up to its `do`
17
+ const PGREP_F_WAIT = /(?:^|[;&|(\n]|\b(?:then|do|else)\b)\s*(?:until|while)\s(?:(?![;\n]\s*do\b)[\s\S])*?\bpgrep\s+(?:-\w+\s+)*-\w*f/
18
+
19
+ /** the loop that waits on `pgrep -f`, or null */
20
+ export function pgrepWaitIn(command: string): string | null {
21
+ const m = PGREP_F_WAIT.exec(codeOf(command))
22
+ return m == null ? null : m[0].replace(/^[\s;&|(]+/, '')
23
+ }
24
+
25
+ export function pgrepWaitRefusal(loop: string): string {
26
+ return `\`${loop.replace(/\s+/g, ' ').slice(0, 80)}\` waits on \`pgrep -f\`: every other loop that waits on the same name carries it in its command line, so they match each other and never end. Wait on the pid instead, the one \`$!\` gave at launch: \`until ! kill -0 <pid> 2>/dev/null; do sleep 2; done\`. Never \`pgrep -x <script>\`: a script's process is named bun or node, so it finds nothing. Lifting this: remove the one-way-in-guard hook from .claude/settings.json.`
27
+ }
@@ -13,11 +13,12 @@ import { INFLIGHT_KEEP_MS, sweepSlots } from './attach.ts'
13
13
  import { RUN_DIR_KEEP_MS, RUN_DIR_MAX, runEntries, sweepRunDirs } from './check-runner.ts'
14
14
  import { gitRoot } from './git-root.ts'
15
15
  import { JOBS, JOBS_KEEP_MS, JOBS_MAX, sweepJobs } from './jobs.ts'
16
- import { CI_LOG_DIR } from './layout.ts'
16
+ import { CI_LOG_DIR, LAYOUT } from './layout.ts'
17
+ import { GONE, GONE_KEEP_MS, goneUse, sweepGone } from '../review/gone.ts'
17
18
  import { compactDb, dbPath, shipkitRoot } from '../ledger/db.ts'
18
19
  import { SCAN_INDEX_KEEP_MS, sweepScanIndexes } from '../ledger/git-scan.ts'
19
20
  import { KEEP_MS as RECORD_KEEP_MS, MAX_ROWS, recordUse, sweepRuns } from '../ledger/run-log.ts'
20
- import { answersDb, answersUse, importLegacyStore, KEEP_MS as ANSWERS_KEEP_MS, legacyStoreDir, MAX_ANSWERS, sweepAnswers } from '../ledger/store.ts'
21
+ import { answersDb, answersUse, importLegacyStore, KEEP_MS as ANSWERS_KEEP_MS, legacyStoreDir, MAX_ANSWERS, slimAnswers, sweepAnswers } from '../ledger/store.ts'
21
22
 
22
23
  export type Cap = {
23
24
  /** the oldest entry may be this old */
@@ -134,6 +135,8 @@ export function repoStores(root: string): Store[] {
134
135
  // file, which the deletes leave full of free pages
135
136
  sweep: (now) => {
136
137
  sweepRuns(dbPath(root), now)
138
+ // a record written before the cut at write holds the key parts on every answer
139
+ slimAnswers(dbPath(root))
137
140
  compactDb(dbPath(root))
138
141
  },
139
142
  },
@@ -167,6 +170,17 @@ export function repoStores(root: string): Store[] {
167
170
  },
168
171
  sweep: (now) => sweepJobs(root, now),
169
172
  },
173
+ {
174
+ // the cards a store set aside (a deletion carried to the hq): 30 days, then gone, whatever the switch
175
+ id: 'review gone',
176
+ where: join(root, LAYOUT.review, GONE),
177
+ cap: { maxAgeMs: GONE_KEEP_MS },
178
+ measure: () => {
179
+ const u = goneUse(join(root, LAYOUT.review))
180
+ return counted(u.count, u.oldest)
181
+ },
182
+ sweep: (now) => void sweepGone(join(root, LAYOUT.review), now),
183
+ },
170
184
  ]
171
185
  if (gitDir != null) {
172
186
  const dir = join(gitDir, 'shipkit')
package/src/core/scope.ts CHANGED
@@ -1,42 +1,135 @@
1
- // who a house resource is for: some repos, some identities, or every repo.
1
+ // who a house resource is for: some repos, some identities, some machines, or every repo.
2
2
  // One type and one reader, so a secret and anything scoped later answer alike.
3
- // The md form, one cell: `all`, or `repo:<name>` and `identity:<id>` joined by commas.
3
+ // The md form, one cell: `all`, or `repo:<name or key>`, `identity:<id>` and `machine:<name>` joined by commas.
4
+ // The vault makes its paths from these names (vault/layout.ts), so the grammar below is a boundary: no name may
5
+ // hold a glob, an empty part, a `.` or `..` part, or a capital
4
6
 
5
7
  /** absent or empty = every repo */
6
8
  export type Scope = {
7
- /** repo names, as `repo.config.ts` names them or as their folder is called */
9
+ /** a repo as `repo.config.ts` or its folder names it, or by its key: its first remote as host and path
10
+ * (`repoKeyOf`), the name the hq grants it by. The vault files a repo by its key only */
8
11
  repos?: string[]
9
12
  /** identity ids, as `speaksAs` names them */
10
13
  identities?: string[]
14
+ /** machine names, lowercase, as the hq names them: for what only those machines use (an ssh key) */
15
+ machines?: string[]
11
16
  }
12
17
 
13
- /** the repo asking: every name it answers to (its config name, its folder), and the identity it speaks as */
14
- export type Asker = { repos: string[]; identity: string | null }
18
+ /** the repo asking: every name it answers to (its config name, its folder), its key, the identity it speaks as,
19
+ * and the machine it runs on. A key or a machine left out opens no row scoped by one */
20
+ export type Asker = { repos: string[]; identity: string | null; key?: string | null; machine?: string | null }
21
+
22
+ /** one part of a name: starts with a letter or a digit, so never `.`, `..` or empty, and holds no glob */
23
+ export const NAME_PART = /^[a-z0-9][a-z0-9._-]*$/
24
+
25
+ /** a repo's key: two parts or more, joined by `/` */
26
+ export const isRepoKey = (repo: string): boolean => repo.includes('/')
27
+
28
+ /** a scope's name as the grammar wants it for its kind */
29
+ export function nameProblem(kind: 'repo' | 'identity' | 'machine', name: string): string | null {
30
+ const parts = kind === 'repo' ? name.split('/') : [name]
31
+ return parts.every((p) => NAME_PART.test(p)) ? null : `${kind}:${name} is no ${kind === 'repo' ? 'repo name or key (host/path)' : `${kind} name`}: each part is lowercase letters, digits, . _ or -, and starts with a letter or a digit`
32
+ }
33
+
34
+ /** the id a repo's config gives it, null with none. Throws on an id the grammar refuses: a config that names a bad
35
+ * id is fixed, never read as if it named none */
36
+ export function repoIdOf(config: { id?: string } | null | undefined): string | null {
37
+ const id = config?.id
38
+ if (id == null) return null
39
+ if (!NAME_PART.test(id)) throw new Error(`repo.config.ts id ${JSON.stringify(id)}: an id is lowercase letters, digits, . _ or -, and starts with a letter or a digit`)
40
+ return id
41
+ }
15
42
 
16
43
  const listed = (xs: string[] | undefined): boolean => (xs ?? []).length > 0
17
44
 
18
- export const scopesAll = (s: Scope | undefined): boolean => s == null || (!listed(s.repos) && !listed(s.identities))
45
+ export const scopesAll = (s: Scope | undefined): boolean => s == null || (!listed(s.repos) && !listed(s.identities) && !listed(s.machines))
19
46
 
20
- /** in scope when the scope is for all, names the repo, or names its identity */
47
+ /** in scope when the scope is for all, names the repo (a key matches its key only), its identity, or its machine */
21
48
  export function inScope(s: Scope | undefined, a: Asker): boolean {
22
49
  if (scopesAll(s)) return true
23
- return (s!.repos ?? []).some((r) => a.repos.includes(r)) || (a.identity != null && (s!.identities ?? []).includes(a.identity))
50
+ const repo = (r: string): boolean => (isRepoKey(r) ? a.key != null && a.key === r : a.repos.includes(r))
51
+ return (s!.repos ?? []).some(repo) || (a.identity != null && (s!.identities ?? []).includes(a.identity)) || (a.machine != null && (s!.machines ?? []).includes(a.machine))
24
52
  }
25
53
 
26
- /** the md cell as a scope; throws on a token that is neither `all`, `repo:` nor `identity:` */
54
+ const KEYS = { repo: 'repos', identity: 'identities', machine: 'machines' } as const
55
+
56
+ /** the md cell as a scope; throws on a token that is neither `all`, `repo:`, `identity:` nor `machine:` */
27
57
  export function parseScope(cell: string): Scope {
28
58
  const text = cell.replaceAll('`', '').trim()
29
59
  if (text === '' || text === 'all') return {}
30
60
  const s: Scope = {}
31
61
  for (const raw of text.split(',')) {
32
62
  const t = raw.trim()
33
- const m = /^(repo|identity):([a-z0-9][a-z0-9._-]*)$/.exec(t)
34
- if (m == null) throw new Error(`scope "${cell}": "${t}" is not repo:<name> or identity:<id> (or all)`)
35
- const key = m[1] === 'repo' ? 'repos' : 'identities'
36
- ;(s[key] ??= []).push(m[2]!)
63
+ const m = /^(repo|identity|machine):(.*)$/.exec(t)
64
+ if (m == null) throw new Error(`scope "${cell}": "${t}" is not repo:<name>, repo:<key>, identity:<id> or machine:<name> (or all)`)
65
+ const kind = m[1] as keyof typeof KEYS
66
+ const problem = nameProblem(kind, m[2]!)
67
+ if (problem != null) throw new Error(`scope "${cell}": ${problem}`)
68
+ ;(s[KEYS[kind]] ??= []).push(m[2]!)
37
69
  }
38
70
  return s
39
71
  }
40
72
 
41
73
  export const scopeText = (s: Scope | undefined): string =>
42
- scopesAll(s) ? 'all' : [...(s!.repos ?? []).map((r) => `repo:${r}`), ...(s!.identities ?? []).map((i) => `identity:${i}`)].join(', ')
74
+ scopesAll(s)
75
+ ? 'all'
76
+ : [...(s!.repos ?? []).map((r) => `repo:${r}`), ...(s!.identities ?? []).map((i) => `identity:${i}`), ...(s!.machines ?? []).map((m) => `machine:${m}`)].join(', ')
77
+
78
+ /** the house as a scope's words name it: each repo, its key when known, and the identity it speaks as; each
79
+ * identity's display name */
80
+ export type ScopeHouse = { repos: { name: string; key?: string | null; speaksAs: string | null }[]; identities: { id: string; name: string }[] }
81
+
82
+ /** who a scope lets read, in plain words: the repos with the identity each speaks as, the repos of an identity, the
83
+ * machines. The one wording of a scope for a reader; `scopeText` stays the md cell */
84
+ export function scopeWords(s: Scope | undefined, house: ScopeHouse): string {
85
+ if (scopesAll(s)) return 'every repo, every identity, every machine'
86
+ const idName = (id: string): string => house.identities.find((i) => i.id === id)?.name ?? `${id} (no such identity)`
87
+ const repoOf = (r: string) => house.repos.find((h) => (isRepoKey(r) ? h.key === r : h.name === r))
88
+ const repoWords = (r: string): string => {
89
+ const h = repoOf(r)
90
+ if (h == null) return `${r} (no repo of that name on this machine)`
91
+ return h.speaksAs == null ? `${h.name} (speaks as no identity)` : `${h.name} (speaks as ${idName(h.speaksAs)})`
92
+ }
93
+ const repos = s!.repos ?? []
94
+ const ids = s!.identities ?? []
95
+ const machines = s!.machines ?? []
96
+ const parts: string[] = []
97
+ if (repos.length > 0) {
98
+ const alone = ids.length === 0 && machines.length === 0
99
+ if (alone && repos.length === 1) parts.push(repoWords(repos[0]!).replace(/ \(/, ' only ('))
100
+ else parts.push(`${repos.map(repoWords).join(' and ')}${alone ? ' only' : ''}`)
101
+ }
102
+ for (const id of ids) {
103
+ const speak = house.repos.filter((h) => h.speaksAs === id).map((h) => h.name).sort()
104
+ parts.push(`the repos that speak as ${idName(id)}: ${speak.length > 0 ? speak.join(', ') : 'none on this machine'}`)
105
+ }
106
+ if (machines.length > 0) parts.push(`the repos on the machine${machines.length > 1 ? 's' : ''} ${machines.join(', ')}`)
107
+ return parts.join('; ')
108
+ }
109
+
110
+ /** one reader of a scope as a chip: `known` false for a repo this machine does not have (its label ends in `?`) */
111
+ export type ScopeChip = { label: string; kind: 'all' | 'repo' | 'identity' | 'machine' | 'more'; known: boolean }
112
+
113
+ /** the readers in order (repos, identities, machines), each in its short form, three at most: past three, the first
114
+ * two and `+n` */
115
+ function readers(s: Scope | undefined, house: ScopeHouse, idForm: (id: string, n: number) => string): ScopeChip[] {
116
+ if (scopesAll(s)) return [{ label: 'every repo', kind: 'all', known: true }]
117
+ const repoOf = (r: string) => house.repos.find((h) => (isRepoKey(r) ? h.key === r : h.name === r))
118
+ const all: ScopeChip[] = [
119
+ ...(s!.repos ?? []).map((r): ScopeChip => {
120
+ const h = repoOf(r)
121
+ return h == null ? { label: `${r}?`, kind: 'repo', known: false } : { label: h.name, kind: 'repo', known: true }
122
+ }),
123
+ ...(s!.identities ?? []).map((id): ScopeChip => ({ label: idForm(id, house.repos.filter((h) => h.speaksAs === id).length), kind: 'identity', known: true })),
124
+ ...(s!.machines ?? []).map((m): ScopeChip => ({ label: `on ${m}`, kind: 'machine', known: true })),
125
+ ]
126
+ return all.length <= 3 ? all : [...all.slice(0, 2), { label: `+${all.length - 2}`, kind: 'more', known: true }]
127
+ }
128
+
129
+ /** the chips the hub draws for a scope; `scopeWords` is their title */
130
+ export const scopeChips = (s: Scope | undefined, house: ScopeHouse): ScopeChip[] =>
131
+ readers(s, house, (id, n) => `${house.identities.find((i) => i.id === id)?.name ?? id} · ${n}`)
132
+
133
+ /** the console's cell for a scope: `shop`, `@studio (2 repos)`, `all`, `gone?, shop`, `shop, game, +3` */
134
+ export const scopeShort = (s: Scope | undefined, house: ScopeHouse): string =>
135
+ scopesAll(s) ? 'all' : readers(s, house, (id, n) => `@${id} (${n} repo${n === 1 ? '' : 's'})`).map((c) => c.label).join(', ')
package/src/core/slots.ts CHANGED
@@ -24,8 +24,8 @@ import { mkdirSync, readdirSync } from 'fs'
24
24
  import { homedir } from 'os'
25
25
  import { join } from 'path'
26
26
  import { leaseHolder, tryLease } from './locked-write.ts'
27
- import { machineLoad } from './budget.ts'
28
- import type { MachineLoad } from '../suite/judge-suites.ts'
27
+ import { machineWords, type MachineLoad } from './machine-busy.ts'
28
+ import { machineLoad } from './machine-read.ts'
29
29
  import { PARALLEL_ENV, parallelCap, parallelCapInfo } from './parallel.ts'
30
30
 
31
31
  /** where the slots live, for a test that must not touch the machine's pool */
@@ -92,12 +92,13 @@ export function machinePool(): SlotPool | null {
92
92
 
93
93
  /** how many of `size` slots a machine at this load admits: all of them up to
94
94
  * a load of one per core, then size × cores / load, never below half. At 12
95
- * on 8 cores a pool of 8 admits 5, from 16 it admits 4 */
95
+ * on 8 cores a pool of 8 admits 5, from 16 it admits 4. The run queue, not the
96
+ * cores in use: a long queue slows CPU work with idle cores (judge-suites.ts loadShare) */
96
97
  export const admittedSlots = (size: number, m: MachineLoad): number =>
97
98
  Math.max(Math.ceil(size / 2), Math.min(size, Math.floor((size * m.cores) / Math.max(m.cores, m.load1))))
98
99
 
99
100
  const admitWords = (size: number, admitted: number, m: MachineLoad): string =>
100
- `the pool admits ${admitted} of its ${size} slots at load ${m.load1.toFixed(1)} on ${m.cores} cores`
101
+ `the pool admits ${admitted} of its ${size} slots at ${machineWords(m)}`
101
102
 
102
103
  /** who holds which slot right now, dead holders left out. Every slot file in
103
104
  * the dir is read, so a slot taken under a larger size still shows. */
@@ -1,7 +1,8 @@
1
1
  // a drill run folder leaves for the trash, never for rm: the folder is checked to BE a drill copy first
2
2
  // (a git repo of its own with no remote, and either the sealed copy's record in .git (drill/seal.ts) or one
3
3
  // commit named « drill base »), so a wrong path is refused, and a moved folder can be put back. a move across disks fails loud, it never falls back to a delete.
4
- import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, renameSync } from 'fs'
4
+ // the one thing removed is each node_modules folder of the checked copy: an install, the bulk of its bytes, no work.
5
+ import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, renameSync, rmSync } from 'fs'
5
6
  import { homedir } from 'os'
6
7
  import { basename, dirname, join, resolve } from 'path'
7
8
  import { gitBin } from '../core/git-bin.ts'
@@ -58,8 +59,31 @@ export function cleanDrillCopy(dir: string, opts: { trash?: string; dry?: boolea
58
59
  let to = join(trash, `${basename(abs)}-${stamp}`)
59
60
  for (let i = 2; existsSync(to); i++) to = join(trash, `${basename(abs)}-${stamp}-${i}`)
60
61
  if (opts.dry !== true) {
62
+ dropInstalls(abs)
61
63
  mkdirSync(trash, { recursive: true })
62
64
  renameSync(abs, to)
63
65
  }
64
66
  return { dir: abs, to }
65
67
  }
68
+
69
+ /** the installed packages of a checked drill copy, removed before it moves: a sealed copy installs in the root
70
+ * and in each package (seven folders and about 730 MB of a 940 MB copy, measured), a drill makes eight copies or
71
+ * more, and nothing in the trash goes by itself. An install holds no work: the lockfile makes it again */
72
+ function dropInstalls(dir: string): void {
73
+ const look = (at: string, depth: number): void => {
74
+ let names: string[]
75
+ try {
76
+ names = readdirSync(at)
77
+ } catch {
78
+ return
79
+ }
80
+ for (const n of names) {
81
+ const p = join(at, n)
82
+ const st = lstatSync(p, { throwIfNoEntry: false })
83
+ if (st == null || st.isSymbolicLink() || !st.isDirectory() || n === '.git') continue
84
+ if (n === 'node_modules') rmSync(p, { recursive: true, force: true })
85
+ else if (depth < 3) look(p, depth + 1)
86
+ }
87
+ }
88
+ look(dir, 0)
89
+ }
package/src/drill/run.ts CHANGED
@@ -205,7 +205,7 @@ export function drillRun(lines: readonly string[], o: { transcript: string; root
205
205
  for (const e of eventsOf(entry)) {
206
206
  if (e.kind === 'use') {
207
207
  const shape = toolShape(e.name, e.detail)
208
- pending.set(e.id, { id: e.id, start: e.at, end: null, tool: e.name, shape, cmd: e.detail, outcome: null, code: null, approval: false, perm: '', read: isReadOnly({ tool: e.name, shape, cmd: e.detail }), bg: false, bgEnd: null })
208
+ pending.set(e.id, { id: e.id, start: e.at, end: null, tool: e.name, shape, cmd: e.detail, outcome: null, code: null, approval: false, perm: '', read: isReadOnly({ tool: e.name, shape, cmd: e.detail }), bg: false, bgEnd: null, limited: false, model: e.model ?? '', ctx: e.ctx ?? 0, out: e.out ?? 0 })
209
209
  } else if (e.kind === 'result') {
210
210
  const c = pending.get(e.id)
211
211
  if (c != null) Object.assign(c, { end: e.at, outcome: e.outcome, code: e.code, approval: e.perm === 'user', perm: e.perm, bg: e.bg })
package/src/drill/seal.ts CHANGED
@@ -119,7 +119,19 @@ export type SealOptions = {
119
119
 
120
120
  export type Sealed = { dir: string; meta: SealMeta; notes: string[] }
121
121
 
122
+ /** the sealed copy, or nothing: a seal that fails (an install the base cannot make, a path that is gone) removes
123
+ * the folders it made, since no record marks a half built copy as a drill copy and `sk drill clean` then refuses it */
122
124
  export function seal(o: SealOptions): Sealed {
125
+ const made: string[] = []
126
+ try {
127
+ return build(o, made)
128
+ } catch (e) {
129
+ for (const d of made) rmSync(d, { recursive: true, force: true })
130
+ throw e
131
+ }
132
+ }
133
+
134
+ function build(o: SealOptions, made: string[]): Sealed {
123
135
  const home = o.home ?? homedir()
124
136
  const repo = realpathSync(o.repo)
125
137
  const notes: string[] = []
@@ -129,6 +141,7 @@ export function seal(o: SealOptions): Sealed {
129
141
  const own = house != null && house === repo
130
142
  const setupPaths = own ? [...SETUP_PATHS, 'wiki'] : SETUP_PATHS
131
143
  const dir = realpathSync(mkdtempSync(join(o.tmp ?? tmpdir(), `${basename(repo)}-`)))
144
+ made.push(dir)
132
145
  unpack(repo, base, dir)
133
146
  if (setup !== base) {
134
147
  const present = setupPaths.filter((p) => gitOk(repo, ['cat-file', '-e', `${setup}:${p}`]))
@@ -157,6 +170,7 @@ export function seal(o: SealOptions): Sealed {
157
170
  } else if (house != null && o.wiki != null) {
158
171
  const sha = git(house, ['rev-parse', '--verify', `${o.wiki}^{commit}`])
159
172
  const w = realpathSync(mkdtempSync(join(o.tmp ?? tmpdir(), 'w-')))
173
+ made.push(w)
160
174
  unpack(house, sha, w, ['wiki'])
161
175
  rewrite([...mdFiles(dir), ...mdFiles(w)], join(house, 'wiki'), join(w, 'wiki'))
162
176
  wikiDirs.push(w)
@@ -215,10 +229,19 @@ export function seal(o: SealOptions): Sealed {
215
229
  })
216
230
 
217
231
  if (o.install) {
218
- if (existsSync(join(dir, 'bun.lock')) || existsSync(join(dir, 'bun.lockb'))) {
219
- const r = run(['bun', 'install', '--frozen-lockfile'], { cwd: dir })
220
- if (r.code !== 0) throw new Error(`bun install --frozen-lockfile in the copy: ${r.err.split('\n').slice(-5).join(' ')}`)
221
- } else if (existsSync(join(dir, 'package.json'))) notes.push('🔶 no bun lockfile at the base: deps not installed')
232
+ // every folder with a lockfile of its own, the root first: a package that is no workspace member installs
233
+ // alone, and without it the copy cannot run that package's code or tests
234
+ const locks = git(dir, ['ls-files', '--', 'bun.lock', 'bun.lockb', '**/bun.lock', '**/bun.lockb']).split('\n').filter((l) => l !== '')
235
+ const folders = [...new Set(locks.map((l) => dirname(l)))].sort((x, y) => x.split('/').length - y.split('/').length || x.localeCompare(y))
236
+ for (const folder of folders) {
237
+ const r = run(['bun', 'install', '--frozen-lockfile'], { cwd: join(dir, folder) })
238
+ if (r.code === 0) continue
239
+ const why = r.err.split('\n').slice(-5).join(' ')
240
+ // the root must install; a package whose own lockfile is stale at the base costs only that package
241
+ if (folder === '.') throw new Error(`bun install --frozen-lockfile in the copy: ${why}`)
242
+ notes.push(`🔶 ${folder}: deps not installed (${why.slice(0, 200)})`)
243
+ }
244
+ if (folders.length === 0 && existsSync(join(dir, 'package.json'))) notes.push('🔶 no bun lockfile at the base: deps not installed')
222
245
  }
223
246
  utimesSync(dir, stamp, stamp)
224
247
 
@@ -62,6 +62,8 @@ export type StatusCheck = {
62
62
  /** its title as the repo declares it, else its id */
63
63
  title: string
64
64
  status: 'fail' | 'warn'
65
+ /** a warning no agent can clear: an ask holds it, so it waits on the owner */
66
+ held?: true
65
67
  /** when that outcome was recorded, epoch ms */
66
68
  at: number | null
67
69
  /** the worst line it printed about the problem, '' when it printed none */
@@ -8,7 +8,11 @@
8
8
  // shared for ACTIVITY_TTL_MS per window, never served past it, so a page left
9
9
  // open costs about one pass a minute however many tabs show it, and a closed
10
10
  // one costs nothing.
11
+ import { existsSync } from 'fs'
12
+ import { join } from 'path'
13
+ import { declinedNow, isClosed, listAsks, type AskWait } from '../asks/asks-queue.ts'
11
14
  import { gitBin } from '../core/git-bin.ts'
15
+ import { LAYOUT } from '../core/layout.ts'
12
16
  import { readLastStatusReadonly } from '../ledger/run-log.ts'
13
17
  import { checkStateOf, recordOf } from '../serve/project-gutter.ts'
14
18
  import { lineText, type Line } from '../core/wire.ts'
@@ -119,13 +123,67 @@ export function findingsOf(lines: string, status: 'fail' | 'warn', id: string):
119
123
  /** the worst of them, '' when it printed none */
120
124
  export const findingOf = (lines: string, status: 'fail' | 'warn', id: string): string => findingsOf(lines, status, id)[0] ?? ''
121
125
 
126
+ /** the warnings the repo's asks hold, every ask not done: one that waits for a later day still waits on the owner.
127
+ * An ask folder that cannot be read (a `waits:` with no words throws) holds none: its warnings then read as agent
128
+ * work, which is the loud side */
129
+ export function waitsOf(repo: string): AskWait[] {
130
+ const dir = join(repo, LAYOUT.asks)
131
+ if (!existsSync(dir)) return []
132
+ try {
133
+ return listAsks(dir).filter((a) => !isClosed(a.status)).flatMap((a) => a.waits)
134
+ } catch {
135
+ return []
136
+ }
137
+ }
138
+
139
+ /** a warning the owner declined to clear: the words of its line, and the words a reader sees in its place */
140
+ export type DeclinedWait = AskWait & { words: string }
141
+
142
+ /** the warnings the asks the owner declined hold, archived or marked in place: they wait on nobody, and no agent asks
143
+ * for them again. A folder that cannot be read holds none, the loud side again */
144
+ export function declinedWaitsOf(repo: string): DeclinedWait[] {
145
+ const dir = join(repo, LAYOUT.asks)
146
+ if (!existsSync(dir)) return []
147
+ try {
148
+ return declinedNow(dir).flatMap(({ ask: a }) =>
149
+ a.waits.map((w) => ({ ...w, words: `the owner declined it on ${a.closed ?? '?'} (ask ${a.file}): it stays declined` })))
150
+ } catch {
151
+ return []
152
+ }
153
+ }
154
+
155
+ /** whether a warning check waits on the owner: an ask holds EVERY warning line it printed, each by its words. One
156
+ * line nobody holds, a slow run included, leaves the check with an agent */
157
+ export function heldByAsk(id: string, lines: string, waits: readonly AskWait[]): boolean {
158
+ const mine = waits.filter((w) => w.check === id)
159
+ if (mine.length === 0) return false
160
+ let parsed: Line[]
161
+ try {
162
+ parsed = JSON.parse(lines) as Line[]
163
+ } catch {
164
+ return false
165
+ }
166
+ const warned = Array.isArray(parsed) ? parsed.filter((l) => l.kind === 'warn').map((l) => lineText(l)) : []
167
+ return warned.length > 0 && warned.every((text) => mine.some((w) => text.includes(w.says)))
168
+ }
169
+
122
170
  /** a repo's checks as its run record last saw them, counted over what it
123
- * declares, and the failing and warning ones with what each said */
171
+ * declares, and the failing and warning ones with what each said: agent
172
+ * work first, then what waits on the owner */
124
173
  export function statusOf(repo: ActivityRepo, declared: Declared | null = null, titles: Titles | null = null): Pick<ActivityRow, 'status' | 'failing'> {
125
174
  const record = recordOf(repo.path)
126
175
  if (record == null) return { status: null, failing: [] }
127
176
  const rows = readLastStatusReadonly(record, { lines: true })
128
- const status = checkStateOf(rows, declared?.(repo.name) ?? null)
177
+ const waits = waitsOf(repo.path)
178
+ const declined = declinedWaitsOf(repo.path)
179
+ // a warning every line of which an ask the owner declined holds (and no open one) waits on nobody: out of the
180
+ // colour and out of his hands, listed with the words that say so
181
+ const held = checkStateOf(rows, declared?.(repo.name) ?? null, (r) => heldByAsk(r.id, r.lines, [...waits, ...declined]))
182
+ const isDeclined = (id: string): boolean => {
183
+ const r = rows.find((x) => x.id === id)
184
+ return r != null && !heldByAsk(id, r.lines, waits) && heldByAsk(id, r.lines, declined)
185
+ }
186
+ const status = held == null ? held : { ...held, hands: held.hands.filter((id) => !isDeclined(id)) }
129
187
  if (status == null) return { status, failing: [] }
130
188
  const byId = new Map(rows.map((r) => [r.id, r]))
131
189
  const named = titles?.(repo.name) ?? null
@@ -134,7 +192,12 @@ export function statusOf(repo: ActivityRepo, declared: Declared | null = null, t
134
192
  const lines = r == null ? [] : findingsOf(r.lines, st, id)
135
193
  return { id, title: named?.get(id) ?? id, status: st, at: status.since[id] ?? null, line: lines[0] ?? '', lines }
136
194
  }
137
- return { status, failing: [...status.reds.map((id) => one(id, 'fail')), ...status.warns.map((id) => one(id, 'warn'))] }
195
+ const said = (c: StatusCheck): StatusCheck => {
196
+ const w = declined.find((d) => d.check === c.id && c.lines.some((l) => l.includes(d.says)))
197
+ return w == null ? c : { ...c, line: w.words, lines: [w.words, ...c.lines] }
198
+ }
199
+ const gone = held!.hands.filter(isDeclined)
200
+ return { status, failing: [...status.reds.map((id) => said(one(id, 'fail'))), ...status.warns.map((id) => one(id, 'warn')), ...gone.map((id) => said(one(id, 'warn'))), ...status.hands.map((id) => ({ ...one(id, 'warn'), held: true as const }))] }
138
201
  }
139
202
 
140
203
  /** one repo, from `since` (epoch ms) to now */
@@ -3,7 +3,7 @@
3
3
  // an identity's certificate names the app across rebuilds. Made once by `sk sign-setup`: a self signed code signing
4
4
  // certificate in a keychain of its own, its random password kept in the login keychain (never in a file), trusted
5
5
  // for code signing by the owner's one password prompt. Absent or not trusted: the apps stay ad hoc, said once
6
- import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
6
+ import { existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
7
7
  import { tmpdir } from 'node:os'
8
8
  import { join } from 'node:path'
9
9
  import { homeDir } from './home-paths.ts'
@@ -23,11 +23,22 @@ const password = (r: Run = run): string | null => {
23
23
  return p.code === 0 ? p.out.trim() : null
24
24
  }
25
25
 
26
- /** the signing keychain in the user's search list: codesign finds an identity only there, `--keychain` or not */
27
- function listed(kc: string, r: Run): void {
26
+ const realOf = (p: string): string => {
27
+ try {
28
+ return realpathSync(p)
29
+ } catch {
30
+ return p
31
+ }
32
+ }
33
+
34
+ /** the signing keychain in the user's search list, once, at its path now: codesign finds an identity only there,
35
+ * `--keychain` or not. An entry that names the same file by another path (the machine's old root, a link to the new
36
+ * one since sk home move) gives way to it */
37
+ export function listed(kc: string, r: Run): void {
28
38
  const now = r(['security', 'list-keychains', '-d', 'user']).out.split('\n').map((l) => l.trim().replace(/^"|"$/g, '')).filter((l) => l !== '')
29
39
  if (now.includes(kc)) return
30
- r(['security', 'list-keychains', '-d', 'user', '-s', ...now, kc])
40
+ const same = realOf(kc)
41
+ r(['security', 'list-keychains', '-d', 'user', '-s', ...now.filter((k) => realOf(k) !== same), kc])
31
42
  }
32
43
 
33
44
  /** the identity's SHA-1 when it is there and trusted for code signing, its keychain unlocked; null otherwise */