rvlib-shipkit 2.29.0 → 2.30.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 (512) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/package.json +2 -1
  3. package/src/advisors/app-graph.ts +1 -1
  4. package/src/advisors/expose.ts +5 -1
  5. package/src/advisors/r2.ts +7 -9
  6. package/src/advisors/routes.ts +29 -2
  7. package/src/advisors/scan.ts +11 -0
  8. package/src/agent-time/accounts-usage.ts +8 -0
  9. package/src/agent-time/claude-sessions.ts +32 -0
  10. package/src/agent-time/hooks.ts +1 -1
  11. package/src/agent-time/live.ts +5 -2
  12. package/src/agent-time/registry.ts +186 -89
  13. package/src/agent-time/store.ts +6 -4
  14. package/src/asks/ask-doc.ts +2 -2
  15. package/src/asks/ask-store.ts +22 -7
  16. package/src/check.ts +9 -1
  17. package/src/checks/SK001-package-json-shape.check.ts +1 -0
  18. package/src/checks/SK003-claude-md-shape.check.ts +1 -0
  19. package/src/checks/SK004-gitignore-policy.check.ts +12 -6
  20. package/src/checks/SK008-reviewer-agent.check.ts +4 -7
  21. package/src/checks/SK013-one-way-in-policy.check.ts +1 -0
  22. package/src/checks/SK017-vscode-hub-task.check.ts +1 -0
  23. package/src/checks/SK024-identity-colors.check.ts +1 -1
  24. package/src/checks/SK027-agent-wiki-links.check.ts +2 -1
  25. package/src/checks/SK033-global-contribution.check.ts +1 -0
  26. package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
  27. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -0
  28. package/src/checks/SK049-thread-answers-hook.check.ts +9 -5
  29. package/src/checks/SK050-retired-commands.check.ts +1 -0
  30. package/src/checks/SK051-no-formatter.check.ts +1 -0
  31. package/src/cli/channel-run.ts +17 -0
  32. package/src/cli/cmd_Advisors.ts +28 -7
  33. package/src/cli/cmd_Asks.ts +2 -2
  34. package/src/cli/cmd_Backup.ts +5 -1
  35. package/src/cli/cmd_CacheAudit.ts +1 -1
  36. package/src/cli/cmd_Channel.ts +43 -0
  37. package/src/cli/cmd_GlobalProcesses.ts +1 -0
  38. package/src/cli/cmd_Home.ts +12 -5
  39. package/src/cli/cmd_Hooks.ts +1 -1
  40. package/src/cli/cmd_Hq.ts +43 -0
  41. package/src/cli/cmd_Lanes.ts +15 -3
  42. package/src/cli/cmd_Media.ts +8 -3
  43. package/src/cli/cmd_Orchestrator.ts +253 -84
  44. package/src/cli/cmd_OrchestratorRole.ts +163 -0
  45. package/src/cli/cmd_Review.ts +142 -165
  46. package/src/cli/cmd_Secret.ts +44 -14
  47. package/src/cli/cmd_Shot.ts +2 -4
  48. package/src/cli/cmd_Sound.ts +1 -0
  49. package/src/cli/cmd_Urls.ts +3 -3
  50. package/src/cli/inbox-hook-run.ts +109 -0
  51. package/src/cli/registry.ts +6 -2
  52. package/src/cli/review-here.ts +136 -0
  53. package/src/cli.ts +45 -14
  54. package/src/collections/actions.ts +5 -4
  55. package/src/collections/checks.ts +5 -0
  56. package/src/collections/collection-types.ts +4 -3
  57. package/src/collections/pings.ts +4 -1
  58. package/src/collections/providers.ts +6 -4
  59. package/src/collections/tests.ts +7 -4
  60. package/src/core/app-icon-frame.ts +62 -0
  61. package/src/core/app-icon.ts +179 -17
  62. package/src/core/archived.ts +10 -7
  63. package/src/core/check-ctx.ts +38 -4
  64. package/src/core/check-pass.ts +7 -0
  65. package/src/core/foreign.ts +87 -0
  66. package/src/core/gui-color.ts +75 -0
  67. package/src/core/hub-theme.ts +1 -3
  68. package/src/core/layout.ts +3 -0
  69. package/src/core/machine-commit.ts +9 -1
  70. package/src/core/one-lib.ts +2 -1
  71. package/src/core/one-way-in-policy.ts +17 -12
  72. package/src/core/owner-word-policy.ts +123 -0
  73. package/src/core/panel-shades.ts +140 -0
  74. package/src/core/repo-gui-color.ts +16 -0
  75. package/src/core/role-policy.ts +17 -0
  76. package/src/core/scope.ts +6 -3
  77. package/src/core/tmux-policy.ts +264 -0
  78. package/src/core/unit-icon.ts +43 -0
  79. package/src/fleet/push-fleet.ts +2 -0
  80. package/src/fleet/scan-fleet.ts +3 -0
  81. package/src/gate/cache-audit.ts +7 -1
  82. package/src/gate/gate-checks.ts +14 -9
  83. package/src/gate/run-fix.ts +30 -5
  84. package/src/gate/run-fixers.ts +8 -3
  85. package/src/home/activity-shape.ts +2 -0
  86. package/src/home/activity.ts +2 -1
  87. package/src/home/daemon-guard.ts +20 -2
  88. package/src/home/daemon-jobs.ts +26 -18
  89. package/src/home/gui-app/ShipkitGui.swift +2012 -144
  90. package/src/home/gui-app/icon.svg +8 -0
  91. package/src/home/gui-app.ts +94 -30
  92. package/src/home/home-routes.ts +53 -9
  93. package/src/home/home-start.ts +27 -3
  94. package/src/home/inbox-shape.ts +7 -3
  95. package/src/home/log-follow.ts +117 -0
  96. package/src/home/machine-fold.ts +1 -1
  97. package/src/home/open-app.ts +9 -3
  98. package/src/home/page-build.ts +5 -1
  99. package/src/home/page-held.ts +1 -1
  100. package/src/home/pm-config.ts +0 -8
  101. package/src/home/pm.ts +62 -5
  102. package/src/home/process-apps.ts +70 -23
  103. package/src/home/process-rows.ts +16 -1
  104. package/src/home/push-sources.ts +18 -13
  105. package/src/home/resources.ts +16 -7
  106. package/src/home/run-daemon.ts +4 -1
  107. package/src/home/run-pm.ts +1 -1
  108. package/src/home/serve-daemon.ts +13 -4
  109. package/src/home/serve-web.ts +141 -17
  110. package/src/home/space-page.ts +3 -3
  111. package/src/home/space-route.ts +2 -2
  112. package/src/home/supervise.ts +2 -1
  113. package/src/home/vault-page.ts +2 -1
  114. package/src/home/web-places.ts +239 -0
  115. package/src/home/widgets.ts +16 -2
  116. package/src/hooks/commit-message.ts +11 -9
  117. package/src/hooks/one-way-in-guard.ts +145 -68
  118. package/src/hooks/run-hooks.ts +15 -5
  119. package/src/hooks/shared-file.ts +273 -83
  120. package/src/hooks/shell-writes.ts +620 -0
  121. package/src/hooks/write-log.ts +149 -0
  122. package/src/hq/door-route.ts +63 -7
  123. package/src/hq/door.ts +45 -12
  124. package/src/hq/history-send.ts +3 -1
  125. package/src/hq/hq-db.ts +10 -3
  126. package/src/hq/hq-local.ts +24 -5
  127. package/src/hq/hq-routes.ts +3 -1
  128. package/src/hq/hq-store.ts +9 -3
  129. package/src/hq/kinds/index.ts +2 -1
  130. package/src/hq/kinds/kind.ts +9 -4
  131. package/src/hq/kinds/presence-rule.ts +56 -0
  132. package/src/hq/kinds/presence.ts +210 -0
  133. package/src/hq/kinds/report.ts +8 -5
  134. package/src/hq/lead-order.ts +68 -0
  135. package/src/hq/outbox.ts +7 -0
  136. package/src/hq/replica.ts +5 -7
  137. package/src/hq/report-facts.ts +14 -7
  138. package/src/hq/report.ts +47 -2
  139. package/src/hq/switch.ts +1 -0
  140. package/src/hq/terminal-hop.ts +64 -0
  141. package/src/hq/thread-sync.ts +13 -6
  142. package/src/http/door-forward.ts +10 -12
  143. package/src/http/door-names.ts +9 -0
  144. package/src/http/hop-caller.ts +23 -0
  145. package/src/http/hop-names.ts +14 -0
  146. package/src/http/loopback-serve.ts +28 -6
  147. package/src/http/owner-word.ts +128 -0
  148. package/src/http/same-origin.ts +12 -0
  149. package/src/{serve → http}/secret-gate.ts +3 -3
  150. package/src/ledger/run-log.ts +25 -1
  151. package/src/media-store/backup/sources.ts +53 -6
  152. package/src/media-store/backup/thread-copy.ts +9 -5
  153. package/src/media-store/copy/config.ts +10 -9
  154. package/src/media-store/daemon.ts +5 -2
  155. package/src/media-store/put.ts +3 -0
  156. package/src/media-store/space.ts +14 -16
  157. package/src/media-store/upload.ts +4 -0
  158. package/src/messages/collection.ts +2 -2
  159. package/src/messages/model.ts +6 -1
  160. package/src/messages/routes.ts +3 -0
  161. package/src/orchestrator/brief.md +8 -6
  162. package/src/orchestrator/channel-declare.ts +58 -0
  163. package/src/orchestrator/channel.ts +226 -0
  164. package/src/orchestrator/guards.ts +12 -3
  165. package/src/orchestrator/host.ts +35 -0
  166. package/src/orchestrator/lead-shape.ts +86 -0
  167. package/src/orchestrator/now.ts +88 -0
  168. package/src/orchestrator/phone.ts +4 -1
  169. package/src/orchestrator/places-file.ts +38 -0
  170. package/src/orchestrator/places-look.ts +180 -0
  171. package/src/orchestrator/places-shape.ts +151 -0
  172. package/src/orchestrator/places.ts +50 -0
  173. package/src/orchestrator/presence-shape.ts +13 -2
  174. package/src/orchestrator/presence.ts +26 -15
  175. package/src/orchestrator/push.ts +5 -10
  176. package/src/orchestrator/role-shape.ts +270 -0
  177. package/src/orchestrator/role.ts +242 -0
  178. package/src/orchestrator/routes.ts +136 -31
  179. package/src/orchestrator/sessions-shape.ts +78 -0
  180. package/src/orchestrator/sessions.ts +86 -0
  181. package/src/orchestrator/share.ts +71 -0
  182. package/src/orchestrator/start-notice.ts +61 -0
  183. package/src/orchestrator/start.ts +137 -0
  184. package/src/orchestrator/started.ts +55 -0
  185. package/src/orchestrator/stuck.ts +196 -0
  186. package/src/orchestrator/unheard.ts +18 -7
  187. package/src/pages/frame-client.ts +44 -6
  188. package/src/problems/failure-words.ts +80 -0
  189. package/src/release/run-bump.ts +26 -5
  190. package/src/release/run-release.ts +34 -14
  191. package/src/repo-config.ts +37 -9
  192. package/src/review/aside-at.ts +19 -0
  193. package/src/review/band.ts +3 -3
  194. package/src/review/doc-save.ts +1 -1
  195. package/src/review/inbox-hook.ts +12 -4
  196. package/src/review/inbox-read.ts +20 -7
  197. package/src/review/instruction-guards.ts +137 -0
  198. package/src/review/instructions.ts +14 -2
  199. package/src/review/item-db.ts +52 -2
  200. package/src/review/mentions.ts +6 -4
  201. package/src/review/model.ts +3 -2
  202. package/src/review/parties.ts +88 -19
  203. package/src/review/push.ts +32 -15
  204. package/src/review/routes.ts +12 -4
  205. package/src/review/secret-route.ts +5 -5
  206. package/src/review/snooze.ts +1 -16
  207. package/src/review/store-parties.ts +4 -2
  208. package/src/review/take-back.ts +2 -1
  209. package/src/review/threads.ts +13 -2
  210. package/src/review/unit.ts +3 -2
  211. package/src/review/view-layout.ts +8 -1
  212. package/src/review/watchers.ts +25 -4
  213. package/src/secrets/key-pair.ts +14 -0
  214. package/src/secrets/lapse.ts +3 -3
  215. package/src/secrets/manager.ts +5 -1
  216. package/src/secrets/name-template.ts +83 -0
  217. package/src/secrets/name.ts +3 -0
  218. package/src/secrets/read.ts +10 -6
  219. package/src/secrets/secrets-view.ts +299 -0
  220. package/src/secrets/who-reads.ts +2 -1
  221. package/src/serve/frame-part.ts +49 -0
  222. package/src/serve/hub-app/accounts-line.tsx +33 -45
  223. package/src/serve/hub-app/activity-st.ts +6 -5
  224. package/src/serve/hub-app/activity-view.tsx +10 -9
  225. package/src/serve/hub-app/advice-box.tsx +6 -5
  226. package/src/serve/hub-app/advisor-app.tsx +2 -0
  227. package/src/serve/hub-app/advisor-face.tsx +3 -2
  228. package/src/serve/hub-app/advisor.html +1 -0
  229. package/src/serve/hub-app/advisors-view.tsx +52 -10
  230. package/src/serve/hub-app/advisors.css +4 -0
  231. package/src/serve/hub-app/app-bridge.ts +31 -5
  232. package/src/serve/hub-app/asked-page.ts +24 -0
  233. package/src/serve/hub-app/asks-page.tsx +10 -6
  234. package/src/serve/hub-app/auto-text.tsx +7 -5
  235. package/src/serve/hub-app/card-head.tsx +3 -2
  236. package/src/serve/hub-app/check-view.tsx +10 -9
  237. package/src/serve/hub-app/checks-svc.ts +96 -32
  238. package/src/serve/hub-app/clock-svc.ts +24 -8
  239. package/src/serve/hub-app/code-copy.ts +1 -1
  240. package/src/serve/hub-app/col-card.tsx +2 -1
  241. package/src/serve/hub-app/col-list-page.tsx +12 -6
  242. package/src/serve/hub-app/col-list-st.ts +12 -2
  243. package/src/serve/hub-app/col-tables-view.tsx +8 -44
  244. package/src/serve/hub-app/col-tables.ts +0 -14
  245. package/src/serve/hub-app/cols-svc.ts +6 -12
  246. package/src/serve/hub-app/columns.ts +94 -0
  247. package/src/serve/hub-app/comfy-view.tsx +8 -7
  248. package/src/serve/hub-app/commands/commands-page.tsx +4 -3
  249. package/src/serve/hub-app/commands/commands-st.ts +2 -2
  250. package/src/serve/hub-app/controls.css +69 -23
  251. package/src/serve/hub-app/cycle-button.tsx +2 -1
  252. package/src/serve/hub-app/database-st.ts +1 -1
  253. package/src/serve/hub-app/database-view.tsx +4 -2
  254. package/src/serve/hub-app/deaf.tsx +27 -0
  255. package/src/serve/hub-app/dock-st.ts +21 -16
  256. package/src/serve/hub-app/dock-view.tsx +19 -12
  257. package/src/serve/hub-app/empty-section.tsx +30 -0
  258. package/src/serve/hub-app/entry-bar.css +1 -1
  259. package/src/serve/hub-app/entry-bar.tsx +11 -6
  260. package/src/serve/hub-app/entry-list.css +32 -0
  261. package/src/serve/hub-app/entry-list.tsx +123 -0
  262. package/src/serve/hub-app/entry-pick.ts +1 -1
  263. package/src/serve/hub-app/entry-sections.ts +140 -0
  264. package/src/serve/hub-app/event-stream-reader.ts +56 -0
  265. package/src/serve/hub-app/floating.tsx +68 -14
  266. package/src/serve/hub-app/geometry-view.tsx +3 -2
  267. package/src/serve/hub-app/git-view.tsx +3 -2
  268. package/src/serve/hub-app/hash-route.ts +14 -2
  269. package/src/serve/hub-app/header-bar.tsx +53 -36
  270. package/src/serve/hub-app/home-st.ts +131 -14
  271. package/src/serve/hub-app/home-strip.css +24 -13
  272. package/src/serve/hub-app/home-strip.tsx +131 -66
  273. package/src/serve/hub-app/home.html +5 -0
  274. package/src/serve/hub-app/hub-app.tsx +94 -102
  275. package/src/serve/hub-app/hub.css +61 -94
  276. package/src/serve/hub-app/icons.tsx +16 -0
  277. package/src/serve/hub-app/identities-st.ts +19 -54
  278. package/src/serve/hub-app/identities-view.tsx +25 -24
  279. package/src/serve/hub-app/identity-address.ts +2 -2
  280. package/src/serve/hub-app/in-sight.ts +10 -0
  281. package/src/serve/hub-app/inbox-st.ts +20 -2
  282. package/src/serve/hub-app/inbox-view.tsx +16 -9
  283. package/src/serve/hub-app/inbox.css +1 -0
  284. package/src/serve/hub-app/index.html +5 -0
  285. package/src/serve/hub-app/insights-view.tsx +6 -5
  286. package/src/serve/hub-app/instructions.css +4 -1
  287. package/src/serve/hub-app/kept-cols.tsx +83 -20
  288. package/src/serve/hub-app/kept-width.tsx +76 -0
  289. package/src/serve/hub-app/keys.ts +116 -38
  290. package/src/serve/hub-app/layout-st.ts +109 -99
  291. package/src/serve/hub-app/lightbox-zoom.css +36 -0
  292. package/src/serve/hub-app/list-filter.tsx +15 -6
  293. package/src/serve/hub-app/list-head.tsx +29 -0
  294. package/src/serve/hub-app/list-row.ts +8 -0
  295. package/src/serve/hub-app/list-walk.ts +26 -105
  296. package/src/serve/hub-app/live-socket.ts +274 -0
  297. package/src/serve/hub-app/live-sources.ts +189 -0
  298. package/src/serve/hub-app/live-svc.ts +2 -2
  299. package/src/serve/hub-app/machine-st.ts +75 -14
  300. package/src/serve/hub-app/main-panel.css +211 -0
  301. package/src/serve/hub-app/main-panel.tsx +259 -0
  302. package/src/serve/hub-app/md.ts +4 -4
  303. package/src/serve/hub-app/media-svc.ts +5 -5
  304. package/src/serve/hub-app/media-view.tsx +13 -12
  305. package/src/serve/hub-app/messages/messages-page.tsx +8 -7
  306. package/src/serve/hub-app/messages/messages-st.ts +5 -2
  307. package/src/serve/hub-app/new-thread-st.ts +170 -0
  308. package/src/serve/hub-app/new-thread.tsx +133 -107
  309. package/src/serve/hub-app/orchestrator-line.tsx +115 -45
  310. package/src/serve/hub-app/orchestrator-places.tsx +86 -0
  311. package/src/serve/hub-app/orchestrator.css +57 -5
  312. package/src/serve/hub-app/page-keys.ts +107 -68
  313. package/src/serve/hub-app/page-reload.ts +46 -6
  314. package/src/serve/hub-app/pages-frames.tsx +40 -3
  315. package/src/serve/hub-app/pages-svc.ts +3 -1
  316. package/src/serve/hub-app/palette-st.ts +198 -43
  317. package/src/serve/hub-app/palette-view.tsx +32 -8
  318. package/src/serve/hub-app/panel-head-action.tsx +39 -0
  319. package/src/serve/hub-app/panel-head.tsx +70 -0
  320. package/src/serve/hub-app/panel-repo.ts +42 -0
  321. package/src/serve/hub-app/panel-source.ts +195 -0
  322. package/src/serve/hub-app/panel-tint.css +6 -0
  323. package/src/serve/hub-app/panel-tint.ts +23 -0
  324. package/src/serve/hub-app/panel-walk.ts +107 -0
  325. package/src/serve/hub-app/pill-row.tsx +2 -1
  326. package/src/serve/hub-app/place-path.ts +4 -0
  327. package/src/serve/hub-app/places-svc.ts +75 -0
  328. package/src/serve/hub-app/plan-view.tsx +3 -2
  329. package/src/serve/hub-app/polled.ts +11 -1
  330. package/src/serve/hub-app/presence-st.ts +66 -32
  331. package/src/serve/hub-app/processes-view.tsx +2 -2
  332. package/src/serve/hub-app/project-bar.tsx +116 -0
  333. package/src/serve/hub-app/project-list.css +20 -173
  334. package/src/serve/hub-app/project-list.tsx +30 -298
  335. package/src/serve/hub-app/projects-svc.ts +59 -32
  336. package/src/serve/hub-app/push-sign.tsx +2 -1
  337. package/src/serve/hub-app/push-svc.ts +86 -69
  338. package/src/serve/hub-app/quiet-st.ts +5 -3
  339. package/src/serve/hub-app/rail-groups.ts +144 -0
  340. package/src/serve/hub-app/reader-chips.tsx +2 -1
  341. package/src/serve/hub-app/recordings-st.ts +2 -1
  342. package/src/serve/hub-app/recordings-view.tsx +19 -47
  343. package/src/serve/hub-app/recordings.css +0 -2
  344. package/src/serve/hub-app/reflections-page.tsx +10 -6
  345. package/src/serve/hub-app/releases/releases-page.tsx +6 -5
  346. package/src/serve/hub-app/repo-sections.ts +127 -38
  347. package/src/serve/hub-app/repo-st.ts +57 -36
  348. package/src/serve/hub-app/review/advisor-bar.tsx +3 -2
  349. package/src/serve/hub-app/review/ask-proof.tsx +79 -0
  350. package/src/serve/hub-app/review/attach-view.tsx +11 -10
  351. package/src/serve/hub-app/review/box-view.ts +479 -0
  352. package/src/serve/hub-app/review/box-zoom.tsx +70 -0
  353. package/src/serve/hub-app/review/diff-view.tsx +3 -2
  354. package/src/serve/hub-app/review/doc-body.tsx +2 -1
  355. package/src/serve/hub-app/review/dock.tsx +3 -2
  356. package/src/serve/hub-app/review/draft-body.tsx +4 -3
  357. package/src/serve/hub-app/review/faces.tsx +0 -8
  358. package/src/serve/hub-app/review/group-block.tsx +8 -7
  359. package/src/serve/hub-app/review/heard-line.tsx +4 -3
  360. package/src/serve/hub-app/review/instructions-view.tsx +3 -2
  361. package/src/serve/hub-app/review/item-verdict.tsx +40 -40
  362. package/src/serve/hub-app/review/kind-states.tsx +5 -4
  363. package/src/serve/hub-app/review/kit.tsx +24 -4
  364. package/src/serve/hub-app/review/lane-bar.tsx +30 -28
  365. package/src/serve/hub-app/review/lightbox.tsx +6 -4
  366. package/src/serve/hub-app/review/live-bar.tsx +7 -6
  367. package/src/serve/hub-app/review/live-view.tsx +6 -5
  368. package/src/serve/hub-app/review/object-card.tsx +2 -1
  369. package/src/serve/hub-app/review/object-panel.tsx +11 -10
  370. package/src/serve/hub-app/review/pano-view.tsx +3 -2
  371. package/src/serve/hub-app/review/question-views.tsx +6 -5
  372. package/src/serve/hub-app/review/review-cells.tsx +21 -20
  373. package/src/serve/hub-app/review/review-host.ts +3 -0
  374. package/src/serve/hub-app/review/review-kit.ts +7 -5
  375. package/src/serve/hub-app/review/review-list.tsx +98 -52
  376. package/src/serve/hub-app/review/review-page.tsx +3 -3
  377. package/src/serve/hub-app/review/review-st.ts +70 -14
  378. package/src/serve/hub-app/review/review-thread.tsx +234 -138
  379. package/src/serve/hub-app/review/review-views.tsx +166 -191
  380. package/src/serve/hub-app/review/space3d.tsx +17 -9
  381. package/src/serve/hub-app/review/thread-close.tsx +24 -32
  382. package/src/serve/hub-app/review/thread-st.ts +39 -25
  383. package/src/serve/hub-app/review/trailer-body.tsx +5 -4
  384. package/src/serve/hub-app/review/trailer-page.tsx +18 -16
  385. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  386. package/src/serve/hub-app/review/trailer-timeline.tsx +10 -9
  387. package/src/serve/hub-app/review/trailer-voices.tsx +29 -28
  388. package/src/serve/hub-app/review.css +159 -42
  389. package/src/serve/hub-app/row-acts.tsx +126 -0
  390. package/src/serve/hub-app/row-face.tsx +29 -0
  391. package/src/serve/hub-app/running-rows.tsx +142 -0
  392. package/src/serve/hub-app/running-st.ts +110 -0
  393. package/src/serve/hub-app/search-view.tsx +3 -2
  394. package/src/serve/hub-app/secrets-page.tsx +290 -0
  395. package/src/serve/hub-app/secrets-st.ts +181 -0
  396. package/src/serve/hub-app/secrets.css +65 -0
  397. package/src/serve/hub-app/section-head.tsx +3 -2
  398. package/src/serve/hub-app/session-chips.tsx +55 -0
  399. package/src/serve/hub-app/shell.ts +56 -0
  400. package/src/serve/hub-app/site/site-part.tsx +6 -5
  401. package/src/serve/hub-app/site/site-st.ts +0 -6
  402. package/src/serve/hub-app/site.css +0 -1
  403. package/src/serve/hub-app/social/calendar.tsx +7 -6
  404. package/src/serve/hub-app/social/comms-page.tsx +29 -26
  405. package/src/serve/hub-app/social/group-editor.tsx +2 -1
  406. package/src/serve/hub-app/social/kit.tsx +12 -11
  407. package/src/serve/hub-app/social/next-release.tsx +3 -2
  408. package/src/serve/hub-app/social/post-card.tsx +21 -20
  409. package/src/serve/hub-app/social/post-page.tsx +2 -1
  410. package/src/serve/hub-app/social/problems.tsx +3 -2
  411. package/src/serve/hub-app/social/social-page.tsx +29 -27
  412. package/src/serve/hub-app/social/social-st.ts +4 -2
  413. package/src/serve/hub-app/social/stage-popup.tsx +11 -10
  414. package/src/serve/hub-app/social.css +7 -5
  415. package/src/serve/hub-app/source-acts.ts +79 -0
  416. package/src/serve/hub-app/source-page.tsx +17 -0
  417. package/src/serve/hub-app/space-view.tsx +5 -4
  418. package/src/serve/hub-app/stores/stores-page.tsx +21 -19
  419. package/src/serve/hub-app/stores/stores-st.ts +1 -1
  420. package/src/serve/hub-app/stores.css +1 -1
  421. package/src/serve/hub-app/terminal-history-st.ts +112 -0
  422. package/src/serve/hub-app/terminal-keys.ts +79 -0
  423. package/src/serve/hub-app/terminal-lib.ts +110 -0
  424. package/src/serve/hub-app/terminal-links.ts +55 -0
  425. package/src/serve/hub-app/terminal-list-st.ts +304 -0
  426. package/src/serve/hub-app/terminal-log-st.ts +242 -0
  427. package/src/serve/hub-app/terminal-out.ts +135 -0
  428. package/src/serve/hub-app/terminal-pages.tsx +115 -0
  429. package/src/serve/hub-app/terminal-panel.tsx +60 -9
  430. package/src/serve/hub-app/terminal-sources.tsx +335 -0
  431. package/src/serve/hub-app/terminal-st.ts +447 -167
  432. package/src/serve/hub-app/terminal-stream.ts +233 -0
  433. package/src/serve/hub-app/terminal-tab.tsx +64 -0
  434. package/src/serve/hub-app/terminal-widths.ts +30 -0
  435. package/src/serve/hub-app/terminal.css +50 -4
  436. package/src/serve/hub-app/test-view.tsx +5 -3
  437. package/src/serve/hub-app/tests-view.tsx +16 -15
  438. package/src/serve/hub-app/theme-st.ts +5 -0
  439. package/src/serve/hub-app/thread-row.tsx +39 -31
  440. package/src/serve/hub-app/time-ago.tsx +3 -2
  441. package/src/serve/hub-app/time-view.tsx +2 -1
  442. package/src/serve/hub-app/time.css +1 -1
  443. package/src/serve/hub-app/timeline-chart.tsx +5 -4
  444. package/src/serve/hub-app/timeline-view.tsx +10 -9
  445. package/src/serve/hub-app/tips.ts +247 -0
  446. package/src/serve/hub-app/tree-build.ts +40 -8
  447. package/src/serve/hub-app/tree-svc.ts +167 -134
  448. package/src/serve/hub-app/unit-icons.ts +26 -0
  449. package/src/serve/hub-app/url-address.ts +154 -0
  450. package/src/serve/hub-app/url-faces.ts +88 -0
  451. package/src/serve/hub-app/url-forms.tsx +183 -0
  452. package/src/serve/hub-app/urls-svc.ts +167 -5
  453. package/src/serve/hub-app/urls-view.tsx +56 -20
  454. package/src/serve/hub-app/urls.css +26 -0
  455. package/src/serve/hub-app/vault-view.tsx +5 -4
  456. package/src/serve/hub-app/veille/veille-page.tsx +34 -33
  457. package/src/serve/hub-app/veille/veille-st.ts +6 -3
  458. package/src/serve/hub-app/view-layout.css +3 -3
  459. package/src/serve/hub-app/when-view.tsx +5 -4
  460. package/src/serve/hub-app/wikis-view.tsx +6 -5
  461. package/src/serve/hub-app/words.tsx +9 -2
  462. package/src/serve/hub-runtime.ts +3 -2
  463. package/src/serve/orchestrator-host.ts +58 -0
  464. package/src/serve/page-live.ts +147 -0
  465. package/src/serve/project-gutter-route.ts +63 -2
  466. package/src/serve/read-worker.ts +7 -2
  467. package/src/serve/runs-stamp.ts +33 -0
  468. package/src/serve/secrets-read.ts +156 -0
  469. package/src/serve/serve-hub.ts +71 -22
  470. package/src/serve/terminal-claudes.ts +185 -0
  471. package/src/serve/terminal-guard.ts +10 -5
  472. package/src/serve/terminal-host.ts +517 -0
  473. package/src/serve/terminal-record.ts +104 -0
  474. package/src/serve/terminal-route.ts +466 -103
  475. package/src/serve/terminal-shells.ts +3 -0
  476. package/src/serve/terminal-watch.ts +102 -0
  477. package/src/shipkit-files.ts +9 -4
  478. package/src/shot/client.ts +4 -9
  479. package/src/shot/shooter.ts +2 -4
  480. package/src/shot/shot-ask.ts +2 -7
  481. package/src/shot/shot-theme.ts +6 -17
  482. package/src/social/routes.ts +2 -2
  483. package/src/social/writes.ts +3 -0
  484. package/src/suite/test-units.ts +6 -2
  485. package/src/trailer/sound/eleven.ts +1 -0
  486. package/src/urls/added.ts +111 -0
  487. package/src/urls/icons.ts +294 -0
  488. package/src/urls/places.ts +139 -0
  489. package/src/urls/routes.ts +17 -7
  490. package/src/urls/rows.ts +48 -15
  491. package/src/urls/unit.ts +57 -3
  492. package/src/urls/write-routes.ts +207 -0
  493. package/src/vault/vault-destroy.ts +2 -1
  494. package/src/vault/vault-import.ts +4 -11
  495. package/src/vault/vault-restore.ts +3 -2
  496. package/src/veille/chrome.ts +18 -3
  497. package/src/veille/identity.ts +6 -0
  498. package/src/view3d/cam.ts +30 -46
  499. package/src/view3d/lib.ts +20 -2
  500. package/src/view3d/viewer.ts +62 -88
  501. package/src/wiki/agent-paths.ts +2 -1
  502. package/src/orchestrator/deliver.ts +0 -81
  503. package/src/orchestrator/drill.ts +0 -129
  504. package/src/orchestrator/keeper.ts +0 -332
  505. package/src/orchestrator/pm.ts +0 -20
  506. package/src/orchestrator/state.ts +0 -92
  507. package/src/orchestrator/switch.ts +0 -86
  508. package/src/orchestrator/tmux.ts +0 -82
  509. package/src/serve/hub-app/rail-fly.tsx +0 -95
  510. package/src/serve/hub-app/side-lists.ts +0 -72
  511. package/src/serve/hub-app/sidebar.tsx +0 -62
  512. package/src/serve/hub-app/tree-row.tsx +0 -125
@@ -0,0 +1,147 @@
1
+ // the ONE connection a hub page holds to its server: a WebSocket at GET /api/live. On it the server says what a page
2
+ // never asks for: the lines of its terminals' parts (terminal-route.ts PageFrame) and the notices of the stores
3
+ // (review/push.ts); and the page says what he types into a terminal. Why a WebSocket: a browser gives a host six HTTP
4
+ // connections for ALL its tabs. A page held two long requests at rest (its terminals' stream, the push stream), so
5
+ // three hub tabs filled the six and no key, act or page read of any tab left the browser (measured: no answer in 8 s).
6
+ // A WebSocket is none of the six, and a browser allows hundreds a host.
7
+ // The one constraint a reader breaks first: a WebSocket is not bound by the same origin policy, so a page of any site
8
+ // can open one to localhost, and a program of this Mac too. What he types on it is a word as the owner, so the upgrade
9
+ // is taken from a page of the hub in a browser alone, by the gate on the owner's acts that every loopbackServe runs
10
+ // before its fetch (http/owner-word.ts PAGE_SOCKET): a server that mounts this socket is opened through
11
+ // loopbackServe, never beside it. What types into a terminal passes the terminal's own gate at the upgrade on top
12
+ import type { PageNotice } from '../home/page-build.ts'
13
+ import { PAGE_SOCKET } from '../http/owner-word.ts'
14
+ import { PUSH_CLOSED_RETRY_MS, type ThreadPush } from '../review/push.ts'
15
+ import { terminalRefusal } from './terminal-guard.ts'
16
+ import { type PageFrame, pageOpen, PAGES_MAX, type PageSend, pageTake } from './terminal-route.ts'
17
+
18
+ export const LIVE_PATH = '/api/live'
19
+ /** the socket's address as a page behind the web names it: the home's own, or under a repo's base (one repo's page
20
+ * alone in another tool's frame, `/r/<repo>/embed/`). Both are the daemon's one socket: its notices name their repo */
21
+ export const livePath = (path: string): boolean => PAGE_SOCKET.test(path)
22
+ /** the web's word to the daemon, on a socket it brings: why that socket may not reach a terminal. The web is the hop
23
+ * that sees the browser's peer and headers; a client's own tag can only take the terminal away from itself */
24
+ export const NO_TERMINAL_HEADER = 'x-shipkit-no-terminal'
25
+ /** a page's build as a frame of its socket: the server that builds the page says each build (page-build.ts) */
26
+ export const pageFrame = (n: PageNotice): string => JSON.stringify({ p: 'page', d: JSON.stringify(n) } satisfies LiveFrame)
27
+ /** a server with no store notices (a stand in) says the beat they would say (review/push.ts PUSH_BEAT_MS): a page
28
+ * finds a dead socket by its silence */
29
+ export const LIVE_BEAT_MS = 5_000
30
+
31
+ /** one frame of a page's socket: a frame of its terminals, or a notice of the stores by its event's name (`hello`,
32
+ * `beat`, `src`, `page`, `closed`; `message`: a store's own notice) with its data as json text */
33
+ export type LiveFrame = PageFrame | { p: string; d: string }
34
+
35
+ /** what a server keeps for one socket. `refusal`: why this socket may not reach a terminal (another machine, the
36
+ * tailnet), null when it may */
37
+ export type Live = { refusal: string | null; /** a hop's one repo (hq/terminal-hop.ts): its parts are of that repo alone, and it hears no store */ scope: string | null; /** a hop's judge, run again while it is open, and when it last said yes */ judge: (() => string | null) | null; judged: number; page: { id: string; end(): void } | null; off: (() => void) | null; beat: ReturnType<typeof setInterval> | null }
38
+
39
+ type Sock = { data: Live; send(text: string): number; close(code?: number, reason?: string): void }
40
+
41
+ export type LiveDeps = {
42
+ /** the store notices of this server, null where it has none (a stand in) */
43
+ push: () => Pick<ThreadPush, 'attach'> | null
44
+ /** the page this server builds itself (a hub of its own): its builds are said on the socket too. Behind the web,
45
+ * the web says them (serve-web.ts) */
46
+ page?: () => { readonly notice: PageNotice | null; on(fn: (n: PageNotice) => void): () => void } | null
47
+ /** a socket the web brought as a terminal hop of the hq Mac's page (hq/terminal-hop.ts hopOfSocket): why it may
48
+ * not reach a terminal and the repo it is bound to; null for any other socket. Absent: no hop is taken */
49
+ hop?: (req: Request) => { refusal: string | null; scope: string; judge: () => string | null } | null
50
+ /** how old a hop's last yes may be when a keystroke comes on it: HOP_RECHECK_MS (a test: 0, each keystroke) */
51
+ hopRecheckMs?: number
52
+ }
53
+
54
+ /** a keystroke on a hop is typed on a yes at most this old: the switch turned off or the key forgotten stops it within
55
+ * a second, and the beat closes the hop that types nothing */
56
+ export const HOP_RECHECK_MS = 1_000
57
+
58
+ /** the socket's two halves for a server: `upgrade` in its fetch for GET /api/live, `websocket` its handler */
59
+ export function liveSockets(d: LiveDeps) {
60
+ /** a frame that could not be said ends the socket: a page that missed a line of a terminal, or a notice, would
61
+ * show a screen that is not the terminal's and call it live. Closed, it opens another and reads everything again */
62
+ const say = (ws: Sock, f: LiveFrame): boolean => {
63
+ let sent = false
64
+ try {
65
+ // -1: the frame waits in the socket's buffer, which is no loss; 0: dropped, or the socket is gone
66
+ sent = ws.send(JSON.stringify(f)) !== 0
67
+ } catch { /* said below */ }
68
+ if (!sent) {
69
+ try { ws.close(1011, 'a frame could not be sent') } catch { /* closed already */ }
70
+ }
71
+ return sent
72
+ }
73
+ /** a hop still may type: its judge says yes, or said it less than `within` ms ago. On a no it closes, and every
74
+ * part of it ends with it */
75
+ const stillHop = (ws: Sock, within: number): boolean => {
76
+ const judge = ws.data.judge
77
+ if (judge == null) return true
78
+ const now = Date.now()
79
+ if (now - ws.data.judged < within) return true
80
+ const why = judge()
81
+ if (why == null) return (ws.data.judged = now, true)
82
+ // a no stays a no: its parts end now, before the socket's own close comes
83
+ ws.data.judge = () => why
84
+ ws.data.judged = Number.NEGATIVE_INFINITY
85
+ ws.data.page?.end()
86
+ try { ws.close(1008, why.slice(0, 120)) } catch { /* closed already */ }
87
+ return false
88
+ }
89
+ return {
90
+ /** the request upgraded: undefined once it is a socket, else the answer */
91
+ upgrade(req: Request, srv: { requestIP(r: Request): { address: string } | null; upgrade(r: Request, o: { data: Live }): boolean }): Response | undefined {
92
+ const hop = d.hop?.(req) ?? null
93
+ // a hop is a socket for a terminal or nothing: refused, it hears no store either
94
+ if (hop?.refusal != null) return new Response(`refused: ${hop.refusal}`, { status: 403, headers: { 'cache-control': 'no-store' } })
95
+ const refusal = hop != null ? null : (req.headers.get(NO_TERMINAL_HEADER) ?? terminalRefusal(req, srv.requestIP(req)?.address ?? null, 'the terminal', { socket: true }))
96
+ if (srv.upgrade(req, { data: { refusal, scope: hop?.scope ?? null, judge: hop?.judge ?? null, judged: Date.now(), page: null, off: null, beat: null } })) return undefined
97
+ return new Response('this address answers a WebSocket only', { status: 426, headers: { upgrade: 'websocket', 'cache-control': 'no-store' } })
98
+ },
99
+ websocket: {
100
+ open(ws: Sock): void {
101
+ // a socket that may not reach a terminal still hears the stores (his phone): it is given no id, so no
102
+ // part can be asked on it
103
+ if (ws.data.refusal == null) {
104
+ ws.data.page = pageOpen((f) => void say(ws, f), () => {
105
+ // said as the stores' cap says it (review/push.ts): the page waits before it opens another
106
+ say(ws, { p: 'closed', d: JSON.stringify({ why: `more than ${PAGES_MAX} pages hold a socket on this server: the oldest closed`, retryMs: PUSH_CLOSED_RETRY_MS }) })
107
+ ws.close(1000, 'too many pages')
108
+ }, ws.data.scope)
109
+ }
110
+ else say(ws, { t: 'hello', id: '' })
111
+ // a hop carries terminals and nothing else of this machine: its beat, never a notice of a store
112
+ if (ws.data.scope != null) {
113
+ ws.data.beat = setInterval(() => void (stillHop(ws, 0) && say(ws, { p: 'beat', d: '{}' })), LIVE_BEAT_MS)
114
+ return
115
+ }
116
+ const push = d.push()
117
+ if (push != null) ws.data.off = push.attach((event, data) => say(ws, { p: event ?? 'message', d: JSON.stringify(data) }), () => ws.close(1000, 'the server closed this stream'))
118
+ else ws.data.beat = setInterval(() => void say(ws, { p: 'beat', d: '{}' }), LIVE_BEAT_MS)
119
+ const page = d.page?.()
120
+ if (page == null) return
121
+ // after the hello: the page knows the socket is up before it hears the build
122
+ if (page.notice != null) ws.send(pageFrame(page.notice))
123
+ const offPush = ws.data.off
124
+ const offPage = page.on((n) => void ws.send(pageFrame(n)))
125
+ ws.data.off = () => (offPush?.(), offPage())
126
+ },
127
+ message(ws: Sock, m: string | Buffer): void {
128
+ const page = ws.data.page
129
+ if (page == null || typeof m !== 'string') return
130
+ if (!stillHop(ws, d.hopRecheckMs ?? HOP_RECHECK_MS)) return
131
+ let b: unknown
132
+ try {
133
+ b = JSON.parse(m)
134
+ } catch {
135
+ return
136
+ }
137
+ if (b != null && typeof b === 'object') pageTake(page.id, b as PageSend)
138
+ },
139
+ close(ws: Sock): void {
140
+ ws.data.page?.end()
141
+ ws.data.off?.()
142
+ if (ws.data.beat != null) clearInterval(ws.data.beat)
143
+ ws.data.page = ws.data.off = ws.data.beat = null
144
+ },
145
+ },
146
+ }
147
+ }
@@ -21,9 +21,11 @@ import {
21
21
  recordOf, recordStamp, RELEASE_TAGS, renderOrder, versionOf, vscodeStoragePath, type CheckState, type Gate, type LastRow, type WiredRepo,
22
22
  } from '../house/project-gutter.ts'
23
23
  import { readLastStatusReadonly } from '../ledger/run-log.ts'
24
+ import { fileURLToPath } from 'url'
25
+ import { guiColorOf } from '../core/repo-gui-color.ts'
24
26
  import { identityOfText, identityProblem, type Identity } from '../core/identity-color.ts'
25
27
  import { writeIdentity } from '../core/identity.ts'
26
- import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
28
+ import { appIconOf, appIconPngs, frameOfRoot, identityOfRoot } from '../core/app-icon.ts'
27
29
  import { waitingThreads } from '../collections/review.ts'
28
30
  import { voicesWaiting } from '../review/trailer-voices.ts'
29
31
  import { storeDir, warmStore } from '../review/store.ts'
@@ -112,6 +114,9 @@ export type ProjectRow = {
112
114
  identity: Identity | null
113
115
  /** the identity it speaks as (wiki tools/shipkit/social.md): its `speaksAs`, else the default; null when none holds it */
114
116
  speaksAs: string | null
117
+ /** its window colour, #rrggbb (core/repo-gui-color.ts guiColorOf: its `guiColor`, else Peacock's, else its name's): its
118
+ * app's chrome and its rail tile */
119
+ guiColor: string
115
120
  /** its app icon cropped to the plate (core/app-icon.ts), what the folded rail draws; null with no mark */
116
121
  appIcon: string | null
117
122
  /** epoch ms of the newest of: the last commit, the last shipkit run, the
@@ -146,6 +151,10 @@ export type GutterDeps = {
146
151
  open?: (path: string) => void
147
152
  /** opens a folder in Fork, the git client; throws with the reason it could not */
148
153
  fork?: (path: string) => void
154
+ /** opens a repo's own macOS app, built first when missing, `hub` on its hub tab; rejects with the reason it could not */
155
+ openApp?: (r: { name: string; path: string }, hub: boolean) => Promise<void>
156
+ /** a page was asked of that repo's own app: said to the open pages, so its window takes it at once */
157
+ asked?: (repo: string) => void
149
158
  warn?: (line: string) => void
150
159
  now?: () => number
151
160
  /** where the rail order lives, default orderFile(home) */
@@ -166,6 +175,25 @@ const runCmd: Run = async (cmd, cwd) => {
166
175
  return { code: await p.exited, out }
167
176
  }
168
177
 
178
+ /** a repo's own app (home/open-app.ts --project), in its own short process so this one never loads the app build.
179
+ * `hub`: the app shows its hub tab, where the page asked of it is drawn */
180
+ export async function openAsApp(r: { name: string; path: string }, hub = false): Promise<void> {
181
+ const script = fileURLToPath(new URL('../home/open-app.ts', import.meta.url))
182
+ const p = Bun.spawn([process.execPath, script, '--project', JSON.stringify({ name: r.name, root: r.path, ...(hub ? { hub } : {}) })], { stdout: 'ignore', stderr: 'pipe' })
183
+ if ((await p.exited) !== 0) throw new Error((await new Response(p.stderr).text()).trim() || `the app of ${r.name} did not open`)
184
+ }
185
+
186
+ /** a page asked of a repo's own app waits this long for a window of it: an app built first takes about a minute */
187
+ export const ASKED_PAGE_MS = 120_000
188
+
189
+ /** `page` as an address of that repo's own hub (`/r/<repo>/`, its search, its hash), or null: never another site,
190
+ * another repo or a page of the home */
191
+ export function ownPage(repo: string, page: unknown): string | null {
192
+ if (typeof page !== 'string' || !page.startsWith('/') || page.startsWith('//') || page.includes('\\')) return null
193
+ const u = new URL(page, 'http://hub.invalid')
194
+ return u.origin === 'http://hub.invalid' && u.pathname === `/r/${encodeURIComponent(repo)}/` ? `${u.pathname}${u.search}${u.hash}` : null
195
+ }
196
+
169
197
  export function openInCode(path: string): void {
170
198
  const code = Bun.which('code')
171
199
  if (code != null) {
@@ -246,6 +274,8 @@ export function projectGutter(d: GutterDeps) {
246
274
  let folders: { mtime: number; list: string[] } | null = null
247
275
  const releases = new Map<string, { stamp: string | null; at: number; release: Release; commitAt: number | null; dirty: number | null }>()
248
276
  const records = new Map<string, { stamp: string; rows: LastRow[] }>()
277
+ /** the page a jump asked a repo's own app to show, until that app's window takes it */
278
+ const asked = new Map<string, { page: string; at: number }>()
249
279
  /** a repo's last gate and check colour, its record opened only when it
250
280
  * moved, counted over the checks it declares today */
251
281
  const gateOfRepo = (r: WiredRepo): { gate: Gate; checks: CheckState } => {
@@ -427,6 +457,7 @@ export function projectGutter(d: GutterDeps) {
427
457
  live: liveUrlOf(config),
428
458
  identity,
429
459
  speaksAs: speakerIdOf(speaksAsOfText(config), ids),
460
+ guiColor: guiColorOf(r.path, r.name).color,
430
461
  appIcon,
431
462
  activity: lastActivity(facts[i]!.commitAt, lastRunAt(r.path), transcripts.get(r.path)),
432
463
  commit: facts[i]!.commitAt,
@@ -511,7 +542,8 @@ export function projectGutter(d: GutterDeps) {
511
542
  }
512
543
  return new Response(new Uint8Array(await png), { headers: { 'content-type': 'image/png', 'cache-control': 'max-age=86400' } })
513
544
  }
514
- const [png] = await appIconPngs(await readFile(icon), id, [PREVIEW_PX])
545
+ // the rim the repo's app wears, none for a mark with its own frame
546
+ const [png] = await appIconPngs(await readFile(icon), id, [PREVIEW_PX], 'canvas', { frame: frameOfRoot(r.path) })
515
547
  return new Response(new Uint8Array(png!), { headers: { 'content-type': 'image/png', 'cache-control': 'max-age=60' } })
516
548
  } catch (e) {
517
549
  return new Response(`could not draw the icon from ${icon}: ${(e as Error).message}`, { status: 422 })
@@ -572,6 +604,35 @@ export function projectGutter(d: GutterDeps) {
572
604
  }
573
605
  return Response.json({ ok: true })
574
606
  }
607
+ // a repo's own app: built when missing, a running one brought to the front (the home's row, a jump in a project
608
+ // app). `page`: the page of that repo to show there, kept until its window takes it (asked-page below)
609
+ if (path === '/api/projects/open-app' && req.method === 'POST') {
610
+ if (repos.length === 0) await answer()
611
+ const b = (await req.json().catch(() => ({}))) as { name?: string; page?: unknown }
612
+ const r = find(b.name ?? '')
613
+ if (r == null) return new Response(`not a wired repo: ${b.name ?? ''}`, { status: 404 })
614
+ if (b.page != null) {
615
+ const page = ownPage(r.name, b.page)
616
+ if (page == null) return new Response(`not a page of ${r.name}: ${String(b.page)}`, { status: 400 })
617
+ asked.set(r.name, { page, at: now() })
618
+ // a window already open goes there now, while its app comes forward
619
+ d.asked?.(r.name)
620
+ }
621
+ try {
622
+ await (d.openApp ?? openAsApp)(r, b.page != null)
623
+ } catch (e) {
624
+ asked.delete(r.name)
625
+ return new Response((e as Error).message, { status: 400 })
626
+ }
627
+ return Response.json({ ok: true })
628
+ }
629
+ // a project's window takes the page asked of it, once: the first window that asks goes there
630
+ if (path === '/api/projects/asked-page' && req.method === 'POST') {
631
+ const b = (await req.json().catch(() => ({}))) as { name?: string }
632
+ const a = asked.get(b.name ?? '')
633
+ asked.delete(b.name ?? '')
634
+ return Response.json({ page: a != null && now() - a.at <= ASKED_PAGE_MS ? a.page : null })
635
+ }
575
636
  if (path === '/api/projects/open' && req.method === 'POST') {
576
637
  if (repos.length === 0) await answer()
577
638
  const b = (await req.json().catch(() => ({}))) as { name?: string }
@@ -7,11 +7,16 @@ import { loadKit, type ResolvedKit } from '../assets/kit-config.ts'
7
7
  import { scanComfyWorkflows } from '../comfy/comfy-panel.ts'
8
8
  import { loadRepoConfig, type RepoConfig } from '../repo-config.ts'
9
9
  import { computeRows, configStamp, graphMounts, hubCollections } from './hub-collections.ts'
10
- import { storeParties } from '../review/store-parties.ts'
10
+ import { hubParties } from '../orchestrator/places.ts'
11
+ import { installOneLib } from '../core/one-lib.ts'
11
12
  import type { ReadAsk, ReadReply } from './read-thread.ts'
12
13
 
13
14
  declare const self: Worker
14
15
 
16
+ // a thread never inherits its process's resolver hook: without its own, a repo config here resolves the lib through
17
+ // the repo's node_modules, and a repo with no install fails to load
18
+ installOneLib()
19
+
15
20
  type Repo = { stamp: string; c: RepoConfig; kit: ResolvedKit | null; comfy: boolean }
16
21
  const repos = new Map<string, Repo>()
17
22
 
@@ -40,7 +45,7 @@ async function repoAt(root: string, reset: boolean): Promise<Repo> {
40
45
 
41
46
  async function answer(a: ReadAsk): Promise<ReadReply> {
42
47
  try {
43
- if (a.kind === 'parties') return { id: a.id, answer: await storeParties(a.dir) }
48
+ if (a.kind === 'parties') return { id: a.id, answer: await hubParties(a.dir) }
44
49
  const r = await repoAt(a.root, a.reset)
45
50
  return { id: a.id, answer: await computeRows(hubCollections(a.root, r.c, r.kit, graphMounts(a.root, r.c), r.comfy)) }
46
51
  } catch (e) {
@@ -0,0 +1,33 @@
1
+ // what a hub says of its runs on the push stream (review/push.ts, the `runs` source): every open page reads
2
+ // house-runs.json when it moves, so it moves on what a page draws anew, a run or a check that starts or ends.
3
+ // the one constraint a reader breaks first: the record's file is no such stamp. A run in flight writes its heartbeat
4
+ // every few seconds and a test run a row a file, so the file moves about once a second while a gate runs
5
+ import { recordStamp } from '../house/project-gutter.ts'
6
+ import { readTransitionsReadonly } from '../ledger/run-log.ts'
7
+
8
+ /** while the stamp holds a run in flight, how often its writer is looked at with no move of the file to say so */
9
+ export const RUN_ALIVE_MS = 2_000
10
+
11
+ /** the `runs` stamp of the record at `path`, '' when the repo keeps none. The record is opened only when its file
12
+ * moved, and a record busy at that moment is read at the next tick. A run in flight whose process is killed writes
13
+ * nothing more, so while one flies the record is also read every RUN_ALIVE_MS: the stamp then says it is gone, and
14
+ * no page has to ask on a timer */
15
+ export function runsPushStamp(path: string, o: { now?: () => number; alive?: (pid: number) => boolean } = {}): () => string {
16
+ let file = ''
17
+ let said = ''
18
+ let readAt = 0
19
+ const clock = o.now ?? Date.now
20
+ const flying = (): boolean => /(^|\|)[^|#]*:r:/.test(said.split('#')[0] ?? '')
21
+ return () => {
22
+ if (path === '') return ''
23
+ const now = recordStamp(path)
24
+ const t = clock()
25
+ if (now === file && !(flying() && t - readAt >= RUN_ALIVE_MS)) return said
26
+ const moved = readTransitionsReadonly(path, t, o.alive)
27
+ if (moved === null) return said
28
+ file = now
29
+ said = moved
30
+ readAt = t
31
+ return said
32
+ }
33
+ }
@@ -0,0 +1,156 @@
1
+ // the secrets page's read (the hub's secrets entry): every name the house's registry, the repo's own config and the
2
+ // store know, joined into one view (secrets/secrets-view.ts), and the two routes that answer it:
3
+ // GET /api/secrets.json the view; `?fresh=1` reads the store again past what the daemon keeps
4
+ // GET /api/secrets/one?name=<name> one name's tail and account, read at the click
5
+ // The constraint a reader breaks first: a value is read in this process for its tail alone (secrets/tail.ts maskOf)
6
+ // and never leaves it: no value in an answer, a log or an error, and the tail only past the gate a secret field
7
+ // passes (secret-gate.ts)
8
+ import type { CheckVerdict } from '../collections/providers.ts'
9
+ import { missingFrom, probeOf } from '../collections/providers.ts'
10
+ import type { ScopeHouse } from '../core/scope.ts'
11
+ import { heldOf, type SecretRow as StoreRow } from '../home/vault-words.ts'
12
+ import type { TailnetWho } from '../http/tailnet-caller.ts'
13
+ import { lapsedNameOf } from '../secrets/lapse-mark.ts'
14
+ import type { Cred } from '../secrets/list.ts'
15
+ import { SECRET_NAME } from '../secrets/name.ts'
16
+ import { isTemplate, rowOfName } from '../secrets/name-template.ts'
17
+ import type { Read } from '../secrets/read.ts'
18
+ import type { SecretDetail, SecretRow, SecretState, SecretsView } from '../secrets/secrets-view.ts'
19
+ import { maskOf, maskText } from '../secrets/tail.ts'
20
+ import { secretRefusal } from '../http/secret-gate.ts'
21
+
22
+ /** what the store said of its names (home/vault-page.ts): null when it could not be read at all */
23
+ export type StoreRead = { rows: StoreRow[]; here: boolean; notes: string[] } | null
24
+
25
+ export type ViewInputs = {
26
+ at: number
27
+ repo: string
28
+ house: boolean
29
+ identity: string | null
30
+ machine: string | null
31
+ scopes: ScopeHouse
32
+ /** the house's registry rows, the archived ones included */
33
+ registry: readonly Cred[]
34
+ /** the rows the repo shown declares itself: each wins over a registry row of its name, and is its own by default */
35
+ own: readonly Cred[]
36
+ store: StoreRead
37
+ /** the last runs of the repo's checks: what proves a secret, and what found one missing */
38
+ verdicts: CheckVerdict[]
39
+ setCommand: string
40
+ }
41
+
42
+ const lists = (c: Cred | undefined): SecretRow['scope'] => ({ repos: c?.for?.repos ?? [], identities: c?.for?.identities ?? [], machines: c?.for?.machines ?? [] })
43
+
44
+ /** the view of one repo, from what was read: pure, so a test feeds it made up rows */
45
+ export function secretsViewOf(i: ViewInputs): SecretsView {
46
+ const rows = new Map<string, Cred>()
47
+ for (const c of i.registry) rows.set(c.name, c)
48
+ if (!i.house) for (const c of i.own) rows.set(c.name, { ...c, for: c.for ?? { repos: [i.repo] } })
49
+ const stored = new Map((i.store?.rows ?? []).map((r) => [r.name, r]))
50
+ const byId = new Map(i.verdicts.map((v) => [v.checkId, v]))
51
+ const proved = missingFrom(i.verdicts)
52
+ const names = [...new Set([...rows.keys(), ...stored.keys()])].filter((n) => !isTemplate(n)).sort()
53
+ const out = names.map((name): SecretRow => {
54
+ const c = rows.get(name) ?? rowOfName([...rows.values()], name)
55
+ const s = stored.get(name)
56
+ const held = s == null || i.store == null ? 'unknown' : heldOf(s, i.store.here)
57
+ const state: SecretState = c?.archived != null ? 'archived' : proved.has(name) ? 'missing' : held === 'vault' || held === 'keychain' ? 'present' : held === 'missing' || held === 'absent' ? 'missing' : 'unread'
58
+ const v = c?.probedBy == null ? null : byId.get(c.probedBy)
59
+ // a check of another repo proves nothing here: said as it is, never as a warning of this repo
60
+ const p = c?.probedBy == null ? null : v == null ? { probe: 'unmeasured' as const, words: `its check ${c.probedBy} does not run in ${i.repo}` } : probeOf(name, c.probedBy, byId, i.at)
61
+ const note = state === 'archived' ? null
62
+ : proved.has(name) ? proved.get(name)!.text
63
+ : held === 'absent' ? 'not in the vault; a copy may sit in this Mac\'s keychain, which the page does not read (sk vault compare)'
64
+ : held === 'unknown' ? (s == null ? 'the store was not read for it' : 'the store was not read')
65
+ : (s?.note ?? null)
66
+ return {
67
+ name,
68
+ service: c?.service ?? s?.for ?? '',
69
+ scope: c != null ? lists(c) : (s?.scope ?? lists(undefined)),
70
+ registered: c != null,
71
+ state,
72
+ level: c == null ? null : (c.level ?? 'used'),
73
+ place: state !== 'present' ? null : held === 'vault' ? 'vault' : 'keychain',
74
+ written: s?.written ?? null,
75
+ version: s?.version ?? null,
76
+ archived: c?.archived ?? null,
77
+ probe: p == null || p.probe === 'none' ? null : { check: c!.probedBy!, verdict: lapsedNameOf(p.words) === name ? 'lapsed' : p.probe, words: p.words },
78
+ refresh: c?.lapses?.refresh ?? null,
79
+ mintUrl: c?.mintUrl ?? null,
80
+ ask: s?.ask ?? null,
81
+ note,
82
+ }
83
+ })
84
+ return { at: i.at, repo: i.repo, house: i.house, identity: i.identity, machine: i.machine, repos: i.scopes.repos, identities: i.scopes.identities, rows: out, notes: i.store == null ? ['the store could not be read on this machine: sk vault status says why'] : i.store.notes, setCommand: i.setCommand }
85
+ }
86
+
87
+ /** the page's two reads: a hub of a test passes its own */
88
+ export type SecretsReads = {
89
+ view: (fresh: boolean) => Promise<SecretsView>
90
+ /** one read of a name for the repo shown, as `sk secret tail` makes it; `account` the same of its account */
91
+ read: (name: string, field: 'get' | 'account') => Promise<Read>
92
+ }
93
+
94
+ /** the reads of this machine for the repo at `root`; `verdicts` the last runs of its checks */
95
+ export function secretsReadsHere(root: string, verdicts: () => Promise<CheckVerdict[]>): SecretsReads {
96
+ return {
97
+ view: async (fresh) => {
98
+ const [{ secretsWhere, managerTemplate }, { scopeHouse }, { houseRootOf }, { vaultDeps, vaultPage }] = await Promise.all([
99
+ import('../secrets/manager.ts'),
100
+ import('../secrets/who-reads.ts'),
101
+ import('../home/home-start.ts'),
102
+ import('../home/vault-page.ts'),
103
+ ])
104
+ const w = await secretsWhere(root)
105
+ const houseRoot = houseRootOf(root)
106
+ const registry = w.house?.creds ?? []
107
+ const keys = registry.some((r) => (r.for?.repos ?? []).some((x) => x.includes('/')))
108
+ const [scopes, store, vs] = await Promise.all([
109
+ scopeHouse(root, { keys }).catch((): ScopeHouse => ({ repos: [], identities: [] })),
110
+ vaultDeps(houseRoot, { fresh, seal: 'skip' }).then(vaultPage).then((p): StoreRead => ({ rows: p.secrets, here: p.here, notes: p.notes.filter((n) => n.tone === 'warn' || n.tone === 'danger').map((n) => n.text) }), () => null),
111
+ verdicts().catch(() => []),
112
+ ])
113
+ const house = w.own != null && w.house === w.own
114
+ return secretsViewOf({ at: Date.now(), repo: w.repos[0]!, house, identity: w.identity, machine: w.machine ?? null, scopes, registry, own: w.own?.creds ?? [], store, verdicts: vs, setCommand: managerTemplate(w, 'credsCommand') ?? 'sk secret set {name}' })
115
+ },
116
+ read: async (name, field) => (await import('../secrets/read.ts')).readSecretHere({ name, field, cwd: root, say: () => {} }),
117
+ }
118
+ }
119
+
120
+ /** one read's words with no value in them: a refusal keeps its reason, a miss says it is not held */
121
+ const whyNot = (r: Read): string => ('refused' in r ? r.refused.replace(/^REFUSED\s+/, '') : 'missing' in r ? ('locked' in r && r.locked === true ? 'this Mac\'s keychain is locked to this session' : 'no value is held on this machine') : '')
122
+
123
+ /** one name's tail and account: the value is read here and only its mask leaves */
124
+ export async function secretDetail(reads: SecretsReads, name: string): Promise<SecretDetail> {
125
+ const [r, a] = await Promise.all([reads.read(name, 'get'), reads.read(name, 'account').catch((): Read => ({ missing: '' }))])
126
+ const account = 'value' in a && a.value !== '' ? a.value : null
127
+ if (!('value' in r)) return { name, tail: null, account, from: null, why: whyNot(r) }
128
+ return { name, tail: maskText(maskOf(r.value)), account, from: r.from, why: null }
129
+ }
130
+
131
+ const NO_STORE = { 'cache-control': 'no-store' }
132
+
133
+ /** the secrets routes of one repo's hub; null for any other path */
134
+ export async function secretsRoutes(req: Request, path: string, reads: SecretsReads, o: { who?: TailnetWho } = {}): Promise<Response | null> {
135
+ if (req.method !== 'GET') return null
136
+ if (path === '/api/secrets.json') {
137
+ try {
138
+ return Response.json(await reads.view(new URL(req.url).searchParams.get('fresh') === '1'), { headers: NO_STORE })
139
+ } catch {
140
+ // our own words, never the error's: it may quote what it read
141
+ return Response.json({ error: 'the secrets of this repo could not be read: sk secret list says why' }, { status: 503, headers: NO_STORE })
142
+ }
143
+ }
144
+ if (path === '/api/secrets/one') {
145
+ const name = new URL(req.url).searchParams.get('name') ?? ''
146
+ if (!SECRET_NAME.test(name)) return Response.json({ error: 'one secret is named: ?name=<secret name>' }, { status: 400, headers: NO_STORE })
147
+ const refused = await secretRefusal(req, o)
148
+ if (refused != null) return Response.json({ name, tail: null, account: null, from: null, why: refused } satisfies SecretDetail, { headers: NO_STORE })
149
+ try {
150
+ return Response.json(await secretDetail(reads, name), { headers: NO_STORE })
151
+ } catch {
152
+ return Response.json({ name, tail: null, account: null, from: null, why: 'it could not be read: sk secret tail says why' } satisfies SecretDetail, { headers: NO_STORE })
153
+ }
154
+ }
155
+ return null
156
+ }