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
package/src/urls/unit.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  // a repo's urls on the hub (wiki tools/shipkit/urls.md): a `urls([...])` unit of any `<name>.shipkit.ts` holds the
2
2
  // urls no global process serves (prod, a box, a console), and a login is declared by where its value lives, never by
3
- // its value. Every unit file imports this module, so it stays light
3
+ // its value. Every unit file imports this module, and the hub's page reads its constants, so it stays light
4
+ import { LAYOUT } from '../core/layout.ts'
5
+
6
+ /** the file the hub writes the urls added from it into (added.ts): a row whose `file` is this is the hub's own */
7
+ export const ADDED_FILE = LAYOUT.urls
8
+
9
+ /** what a plain click on a url does: a native tab of the app, a popup of the identity's Chrome, the hub's frame */
10
+ export type UrlOpens = 'tab' | 'chrome' | 'frame'
11
+ export const URL_OPENS: readonly UrlOpens[] = ['tab', 'chrome', 'frame']
4
12
 
5
13
  /** a login of a url: a secret of the house manager (its account field when `account` is absent), or a gitignored
6
14
  * JSON file of the repo and the two keys to read in it */
@@ -8,13 +16,59 @@ export type LoginDef =
8
16
  | { label?: string; account?: string; secret: string }
9
17
  | { label?: string; file: string; account: string; password: string }
10
18
 
19
+ /** where a url lives, in the order the hub lists them: a machine of his (dev), the project as deployed (prod), a third
20
+ * party's site or console (ext). The one list of the envs: every check, form and group reads it */
21
+ export const URL_ENVS = ['dev', 'prod', 'ext'] as const
22
+ export type UrlEnv = (typeof URL_ENVS)[number]
23
+
24
+ /** what each env means, in the hub's tips */
25
+ export const URL_ENV_WORDS: Record<UrlEnv, string> = {
26
+ dev: 'a machine of yours: this Mac, the LAN, the tailnet',
27
+ prod: 'the project as it is deployed',
28
+ ext: "a third party's site or console: a dashboard, a repo host, a cloud account",
29
+ }
30
+
31
+ export const isUrlEnv = (v: unknown): v is UrlEnv => (URL_ENVS as readonly unknown[]).includes(v)
32
+
33
+ /** a loopback name, a LAN address (RFC 1918, link local, IPv6 unique local and link local) or a `.local` name: a
34
+ * machine of his */
35
+ export function nearHost(hostname: string): boolean {
36
+ const x = hostname.replace(/^\[|\]$/g, '').toLowerCase()
37
+ return x === 'localhost' || x.endsWith('.localhost') || x === '::1' || /^127\./.test(x) || x.endsWith('.local') || /^10\./.test(x) || /^192\.168\./.test(x)
38
+ || /^172\.(1[6-9]|2\d|3[01])\./.test(x) || /^169\.254\./.test(x) || /^f[cd][0-9a-f]{2}:/.test(x) || /^fe80:/.test(x)
39
+ }
40
+
41
+ /** a host's site, its last two labels: `app.shop.example` and `admin.shop.example` are one site */
42
+ const siteOf = (hostname: string): string => hostname.toLowerCase().split('.').slice(-2).join('.')
43
+
44
+ /** the env a url most likely is, `prods` the urls the repo already lists as prod: dev for a machine of his; prod for a
45
+ * site one of them is on, or when the repo lists no prod yet (its first public url is most often the product); ext
46
+ * for any other site (one beside a product the repo has is most often a third party's console). null: no url */
47
+ export function envOfUrl(url: string, prods: readonly string[]): UrlEnv | null {
48
+ let host: string
49
+ try {
50
+ host = new URL(url).hostname
51
+ } catch {
52
+ return null
53
+ }
54
+ if (nearHost(host)) return 'dev'
55
+ const sites = prods.flatMap((p) => {
56
+ try {
57
+ return [siteOf(new URL(p).hostname)]
58
+ } catch {
59
+ return []
60
+ }
61
+ })
62
+ return sites.length === 0 || sites.includes(siteOf(host)) ? 'prod' : 'ext'
63
+ }
64
+
11
65
  export interface UrlDef {
12
66
  /** the address part, `#page:urls:<id>`: kebab-case, unique in its repo */
13
67
  id: string
14
68
  /** the row's words (default the url's host). A « / » makes folders on the tree: `Kovera/demo` is the leaf
15
69
  * « demo » in the folder « Kovera », as deep as it has parts */
16
70
  label?: string
17
- env: 'dev' | 'prod'
71
+ env: UrlEnv
18
72
  url: string
19
73
  logins?: LoginDef[]
20
74
  }
@@ -55,7 +109,7 @@ export const labelParts = (label: string): string[] => label.split('/').map((p)
55
109
  export function urlProblem(d: UrlDef): string | null {
56
110
  const at = `url '${String(d?.id)}'`
57
111
  if (!KEBAB.test(d?.id ?? '')) return `${at}: id must be kebab-case`
58
- if (d.env !== 'dev' && d.env !== 'prod') return `${at}: env is 'dev' or 'prod'`
112
+ if (!isUrlEnv(d.env)) return `${at}: env is ${URL_ENVS.map((e) => `'${e}'`).join(', ')}`
59
113
  if (typeof d.url !== 'string' || !/^https?:\/\//.test(d.url)) return `${at}: url must be an http url`
60
114
  if (d.label !== undefined && !text(d.label)) return `${at}: label is a text`
61
115
  if (d.label !== undefined && labelParts(d.label).some((p) => p === '')) return `${at}: label '${d.label}' has a « / » that makes folders: no empty part`
@@ -0,0 +1,207 @@
1
+ // the hub's writes on a repo's urls (wiki tools/shipkit/urls.md, Add a url and its login): a url added, edited or
2
+ // removed, how it opens, a login typed into the vault, a url opened in the identity's Chrome. Each is a word as the
3
+ // owner (http/owner-word.ts, `/api/urls`), so a program's request never reaches here. The one constraint a reader
4
+ // breaks first: a login's password is read once from the body after the secret gate, goes to the store alone, and is
5
+ // in no answer, file, log or thrown line; urls.json holds its vault name, and the account rides in the vault
6
+ import { accountProblem, storeValue } from '../collections/actions.ts'
7
+ import { managerStore, secretsWhere, type SecretStore } from '../secrets/manager.ts'
8
+ import { secretRefusal } from '../http/secret-gate.ts'
9
+ import type { TailnetWho } from '../http/tailnet-caller.ts'
10
+ import { NO_STORE } from '../review/http.ts'
11
+ import { ADDED_FILE, freeId, loginNameOf, loginNameProblem, readAdded, repoPartOf, slugOf, URL_OPENS, writeAdded, type AddedUrls, type UrlOpens } from './added.ts'
12
+ import { loadUrls, type UrlEntry } from './rows.ts'
13
+ import { envOfUrl, labelParts, urlProblem, type UrlDef } from './unit.ts'
14
+
15
+ /** what the writes reach outside the repo: the vault, the identity's Chrome. A test passes fakes */
16
+ export type UrlWriteDeps = {
17
+ /** where a typed password goes; absent: the house store, as `sk secret set` makes it */
18
+ store?: SecretStore
19
+ /** a name's current vault version soft deleted (undone with undelete): 'removed', or why it was not */
20
+ forget?: (name: string) => Promise<'removed' | string>
21
+ /** why this Mac takes no write of a secret (it reads the vault of another Mac), null when it does */
22
+ writeRefusal?: () => Promise<string | null>
23
+ /** the identity this repo speaks as, with its Chrome profile's email */
24
+ identity?: () => Promise<{ id: string; name: string; email: string } | null>
25
+ /** a page opened as a popup of the profile signed in with `email` */
26
+ open?: (url: string, email: string) => Promise<void>
27
+ who?: TailnetWho
28
+ }
29
+
30
+ /** the longest password the form takes; a longer one, or one of several lines, goes through sk secret set */
31
+ const VALUE_MAX = 16_384
32
+
33
+ const ok = (b: object): Response => Response.json(b, { headers: NO_STORE })
34
+ /** a refusal: its one line as plain text, as the copy route answers one */
35
+ const bad = (why: string, status: number): Response => new Response(why, { status, headers: NO_STORE })
36
+ const text = (v: unknown): string => (typeof v === 'string' ? v.trim() : '')
37
+
38
+ async function body(req: Request): Promise<Record<string, unknown> | null> {
39
+ try {
40
+ const b = (await req.json()) as unknown
41
+ return b != null && typeof b === 'object' && !Array.isArray(b) ? (b as Record<string, unknown>) : null
42
+ } catch {
43
+ return null
44
+ }
45
+ }
46
+
47
+
48
+ const defaultIdentity = async (root: string): Promise<{ id: string; name: string; email: string } | null> => {
49
+ const [{ speakerOfRepo, identitiesRoot }, w] = await Promise.all([import('../veille/identity.ts'), secretsWhere(root).catch(() => null)])
50
+ return speakerOfRepo(w?.own?.speaksAs ?? null, identitiesRoot(root))
51
+ }
52
+
53
+ const defaultForget = (root: string) => async (name: string): Promise<'removed' | string> => {
54
+ const { removeSecretHere } = await import('../secrets/read.ts')
55
+ const r = await removeSecretHere({ name, cwd: root })
56
+ if (r == null) return 'this Mac runs no vault: its keychain copy stays (sk secret rm --keychain on his yes)'
57
+ return 'refused' in r ? r.refused : 'removed'
58
+ }
59
+
60
+ const defaultWriteRefusal = async (): Promise<string | null> => (await import('../secrets/read.ts')).masterOnly()
61
+
62
+ const defaultOpen = async (url: string, email: string): Promise<void> => (await import('../veille/chrome.ts')).openPage(url, email, 'popup')
63
+
64
+ /** a url's fields from a body, its id kept: why it cannot be listed, or the def. `prods`: the repo's prod urls, for
65
+ * the env of a body that names none */
66
+ function urlDef(b: Record<string, unknown>, id: string, prods: readonly string[], was?: UrlDef): UrlDef | string {
67
+ const url = text(b.url) || was?.url || ''
68
+ const label = b.label === undefined ? was?.label : text(b.label) || undefined
69
+ const env = b.env === undefined ? (was?.env ?? envOfUrl(url, prods) ?? 'prod') : b.env
70
+ const d = { id, url, env, ...(label != null ? { label } : {}) } as UrlDef
71
+ return urlProblem(d) ?? d
72
+ }
73
+
74
+ /** the routes, null for a path that is none of them */
75
+ export async function urlWriteRoutes(root: string, req: Request, path: string, deps: UrlWriteDeps = {}): Promise<Response | null> {
76
+ const at = /^\/api\/urls\/(add|edit|remove|opens|login|login\/remove|open)$/.exec(path)?.[1]
77
+ if (at == null) return null
78
+ if (req.method !== 'POST') return bad(`POST ${path}`, 405)
79
+ const b = await body(req)
80
+ if (b == null) return bad('the body is a json object', 400)
81
+ const commit = (a: AddedUrls, what: string): void => writeAdded(root, a, `urls: ${what}`)
82
+ let all: UrlEntry[]
83
+ let added: AddedUrls
84
+ let repo: string | null
85
+ try {
86
+ repo = repoPartOf((await secretsWhere(root)).own)
87
+ ;[all, added] = [await loadUrls(root), readAdded(root, repo)]
88
+ } catch (e) {
89
+ return bad(`the urls do not load: ${(e as Error).message}`, 409)
90
+ }
91
+ const id = text(b.id)
92
+ // a name is forgotten only when it is this url's own login name, checked again past the file's own check
93
+ const forgetOwn = async (name: string): Promise<{ removed: boolean; why?: string }> => {
94
+ const bad = loginNameProblem(name, repo, id)
95
+ if (bad != null) return { removed: false, why: `${bad}: left in the vault` }
96
+ return (deps.forget ?? defaultForget(root))(name).then((r) => (r === 'removed' ? { removed: true } : { removed: false, why: r }), (e: Error) => ({ removed: false, why: e.message }))
97
+ }
98
+ const own = (): UrlDef | null => added.urls.find((u) => u.id === id) ?? null
99
+ const prods = all.filter((u) => u.env === 'prod').map((u) => u.url)
100
+ const known = all.find((u) => u.id === id) ?? null
101
+
102
+ if (at === 'add') {
103
+ const url = text(b.url)
104
+ let host = ''
105
+ try { host = new URL(url).hostname } catch { /* urlProblem says it */ }
106
+ const base = slugOf(text(b.label) ? labelParts(text(b.label)).at(-1)! : host, 'url')
107
+ const d = urlDef(b, freeId(base, new Set(all.map((u) => u.id))), prods)
108
+ if (typeof d === 'string') return bad(d, 400)
109
+ commit({ ...added, urls: [...added.urls, d] }, `${d.id} added from the hub`)
110
+ return ok({ id: d.id })
111
+ }
112
+
113
+ if (known == null) return bad(`no url ${id || '(no id)'} in this repo`, 404)
114
+
115
+ if (at === 'edit' || at === 'remove') {
116
+ const was = own()
117
+ if (was == null) return bad(`${id} is declared in ${known.file}: change it there, the hub edits only the urls of ${ADDED_FILE}`, 409)
118
+ if (at === 'edit') {
119
+ const d = urlDef(b, id, prods, was)
120
+ if (typeof d === 'string') return bad(d, 400)
121
+ commit({ ...added, urls: added.urls.map((u) => (u.id === id ? d : u)) }, `${id} edited from the hub`)
122
+ return ok({ id })
123
+ }
124
+ const names = (added.logins[id] ?? []).flatMap((l) => ('secret' in l ? [l.secret] : []))
125
+ const { [id]: _l, ...logins } = added.logins
126
+ const { [id]: _o, ...opens } = added.opens
127
+ commit({ urls: added.urls.filter((u) => u.id !== id), logins, opens }, `${id} removed from the hub`)
128
+ const vault = await Promise.all(names.map(async (name) => ({ name, ...(await forgetOwn(name)) })))
129
+ return ok({ removed: id, logins: vault })
130
+ }
131
+
132
+ if (at === 'opens') {
133
+ const how = b.opens
134
+ if (how !== null && !URL_OPENS.includes(how as UrlOpens)) return bad('opens is tab, chrome, frame, or null for the default', 400)
135
+ const { [id]: _o, ...rest } = added.opens
136
+ commit({ ...added, opens: how === null ? rest : { ...rest, [id]: how as UrlOpens } }, `${id} opens ${how ?? 'as the page says'}`)
137
+ return ok({ id, opens: how })
138
+ }
139
+
140
+ if (at === 'login/remove') {
141
+ const label = text(b.label)
142
+ const mine = added.logins[id] ?? []
143
+ const gone = mine.find((l) => l.label === label)
144
+ if (gone == null) return bad(`${id} has no login « ${label} » added in the hub`, 404)
145
+ const left = mine.filter((l) => l !== gone)
146
+ const { [id]: _l, ...rest } = added.logins
147
+ commit({ ...added, logins: left.length > 0 ? { ...rest, [id]: left } : rest }, `a login of ${id} removed from the hub`)
148
+ return ok({ removed: label, vault: 'secret' in gone ? await forgetOwn(gone.secret) : { removed: true } })
149
+ }
150
+
151
+ if (at === 'login') {
152
+ // the gate before a value is read: the hub of this Mac or his phone over the tailnet, never another site
153
+ const why = await secretRefusal(req, deps.who ? { who: deps.who } : {})
154
+ if (why != null) return bad(why, 403)
155
+ const label = text(b.label) || 'login'
156
+ const replace = b.replace === true
157
+ const password = typeof b.password === 'string' ? b.password.replace(/[\r\n]+$/, '') : ''
158
+ const account = text(b.account)
159
+ const mine = added.logins[id] ?? []
160
+ const was = mine.find((l) => l.label === label)
161
+ if (replace && was == null) return bad(`${id} has no login « ${label} » added in the hub to replace`, 404)
162
+ if (!replace && known.logins.some((l) => l.label === label)) return bad(`${id} has a login « ${label} » already: replace its password, or name this one otherwise`, 409)
163
+ if (password.trim() === '') return bad('an empty password is not stored', 400)
164
+ if (password.length > VALUE_MAX) return bad(`a password longer than ${VALUE_MAX} characters: store it with sk secret set in a terminal`, 400)
165
+ if (/[\r\n]/.test(password)) return bad('a password of several lines: store it with sk secret set in a terminal', 400)
166
+ if (account === '') return bad('the account too (the email or user name you sign in with), nothing stored', 400)
167
+ const problem = accountProblem(account)
168
+ if (problem != null) return bad(`the account ${problem}, nothing stored`, 400)
169
+ const elsewhere = await (deps.writeRefusal ?? defaultWriteRefusal)()
170
+ if (elsewhere != null) return bad(`${elsewhere}: nothing stored`, 409)
171
+ if (repo == null) return bad(`repo.config.ts names no id: add id: '<the repo's kebab name>' to it, then type the login again`, 409)
172
+ const name = was != null && 'secret' in was ? was.secret : loginNameOf(repo, id, label)
173
+ // replace writes the name the file holds: never one that is not this url's own
174
+ const foreign = loginNameProblem(name, repo, id)
175
+ if (foreign != null) return bad(`${foreign}: nothing stored`, 409)
176
+ if (!replace && mine.some((l) => 'secret' in l && l.secret === name)) return bad(`${name} is the login of another name already: name this one otherwise`, 409)
177
+ try {
178
+ await storeValue({ root, name, value: password, account, store: deps.store ?? managerStore(root), exact: true })
179
+ } catch (e) {
180
+ // storeValue throws a fixed line that holds no value
181
+ return bad((e as Error).message, 502)
182
+ }
183
+ if (was == null) commit({ ...added, logins: { ...added.logins, [id]: [...mine, { label, secret: name }] } }, `a login of ${id} added from the hub`)
184
+ return ok({ stored: name })
185
+ }
186
+
187
+ // open: the declared url's origin and the place he is on, in a popup of the identity's Chrome profile
188
+ const atRaw = typeof b.at === 'string' ? b.at : ''
189
+ let target: URL
190
+ try {
191
+ const origin = new URL(known.url).origin
192
+ if (atRaw !== '' && (!atRaw.startsWith('/') || atRaw.startsWith('//') || atRaw.includes('\\'))) throw new Error('at')
193
+ target = atRaw === '' ? new URL(known.url) : new URL(atRaw, origin)
194
+ if (target.origin !== origin) throw new Error('at')
195
+ } catch {
196
+ return bad(`at is a path of ${known.url} (its path, query and fragment), never another site`, 400)
197
+ }
198
+ const who = await (deps.identity ?? (() => defaultIdentity(root)))()
199
+ if (who == null) return bad('this repo speaks as no identity: name one with speaksAs in repo.config.ts', 409)
200
+ if (who.email === '') return bad(`${who.name} has no email: its Chrome profile is the one signed in with it (its identity.md, ## Profile)`, 409)
201
+ try {
202
+ await (deps.open ?? defaultOpen)(target.href, who.email)
203
+ } catch (e) {
204
+ return bad((e as Error).message, 409)
205
+ }
206
+ return ok({ opened: target.href, identity: who.name })
207
+ }
@@ -6,6 +6,7 @@
6
6
  import { existsSync, readFileSync, rmSync } from 'fs'
7
7
  import { join } from 'path'
8
8
  import { KV_MOUNT } from './layout.ts'
9
+ import { lastWords } from '../problems/failure-words.ts'
9
10
  import { markerFile, vaultUrl, type VaultPlace } from './vault-config.ts'
10
11
  import { VaultApi, waitHealth } from './vault-http.ts'
11
12
  import { killRecorded, notePids, recordedGone } from './vault-restore.ts'
@@ -47,7 +48,7 @@ export async function destroyInVault(d: { place: VaultPlace; path: string; sealK
47
48
  const url = vaultUrl(d.place)
48
49
  const held: { root: VaultApi | null } = { root: null }
49
50
  const act = async (): Promise<number> => {
50
- if ((await waitHealth(url, (h) => h?.code === 200, { ms: 60_000 }))?.code !== 200) return fail(`the vault did not open: see ${join(work, 'bao.log')}`)
51
+ if ((await waitHealth(url, (h) => h?.code === 200, { ms: 60_000 }))?.code !== 200) return fail(`the vault did not open: its bao said ${lastWords(join(work, 'bao.log')) ?? 'nothing'}`)
51
52
  notePids(work, bao)
52
53
  const token = await new VaultApi(url).rootAfterRestore(d.recoveryKey.trim(), 30_000).catch((e: Error) => e)
53
54
  if (token instanceof Error) return fail(`a root token from that recovery key: ${token.message}`)
@@ -5,7 +5,8 @@
5
5
  // holds differently is never overwritten, and a read back that differs stops the import and removes nothing
6
6
  import { closeSync, openSync, readFileSync, rmSync, writeSync } from 'fs'
7
7
  import { join } from 'path'
8
- import { NAME_PART, scopeText, type Scope } from '../core/scope.ts'
8
+ import { scopeText, type Scope } from '../core/scope.ts'
9
+ import { rowOfName } from '../secrets/name-template.ts'
9
10
  import type { Keychain } from '../secrets/keychain.ts'
10
11
  import { KV_MOUNT, scopeRefs } from './layout.ts'
11
12
  import { SLOTS, type VaultGrant } from './policy.ts'
@@ -18,22 +19,14 @@ export type RegistryRow = { name: string; for?: Scope; archived?: { at: string }
18
19
  /** where one name of this machine's keychain goes: its path, or why it has none */
19
20
  export type Placed = { name: string; scope: string; path?: string; why?: string }
20
21
 
21
- /** a template row (`rv/realm/<word>/thing`) as the names it stands for: each `<word>` one part of a name */
22
- const templateOf = (name: string): RegExp | null =>
23
- name.includes('<') ? new RegExp(`^${name.split(/<[a-z-]+>/).map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join(NAME_PART.source.slice(1, -1))}$`) : null
24
-
25
22
  /** each registry name this machine's keychain holds, and each `rv/` name it holds with no row, placed. A template row
26
23
  * places every name it stands for. A row of several scopes is refused: the node template carries no exact line,
27
24
  * and bao refuses a slot value of two parts (vault/policy.ts) */
28
25
  export async function placeNames(o: { rows: RegistryRow[]; held: string[]; keyOf: (id: string) => Promise<string | null> }): Promise<Placed[]> {
29
26
  const out: Placed[] = []
30
- const exact = new Map(o.rows.filter((r) => templateOf(r.name) == null).map((r) => [r.name, r]))
31
- const templates = o.rows.flatMap((r) => {
32
- const t = templateOf(r.name)
33
- return t == null ? [] : [{ t, row: r }]
34
- })
35
27
  for (const name of o.held) {
36
- const row = exact.get(name) ?? templates.find((x) => x.t.test(name))?.row
28
+ // a row with a part places every name it stands for, a template's scope bound from the name (secrets/name-template.ts)
29
+ const row = rowOfName(o.rows, name, { unbound: true })
37
30
  if (row == null) {
38
31
  out.push({ name, scope: '', why: 'no row in the registry: not imported' })
39
32
  continue
@@ -9,6 +9,7 @@ import { basename, dirname, join } from 'path'
9
9
  import { homeDir } from '../home/home-paths.ts'
10
10
  import { auditLog, dataDir, isSealKey, markerFile, minterTokenFile, refuseRealVault, SEAL_KEY_ID, vaultHcl, vaultPlace, vaultUrl, type MarkerData, type VaultPlace } from './vault-config.ts'
11
11
  import { KV_MOUNT } from './layout.ts'
12
+ import { lastWords } from '../problems/failure-words.ts'
12
13
  import { VaultApi, vaultHealth, waitHealth } from './vault-http.ts'
13
14
  import { setupMinter } from './vault-init.ts'
14
15
  import { baoVersion, boundPort, portHolders, startBao, type Bao, type SealStore } from './vault-serve.ts'
@@ -232,14 +233,14 @@ export async function restoreVault(d: RestoreDeps): Promise<number> {
232
233
  bao = startWork(work, d)
233
234
  state = await awaitActive(url, work, 60_000)
234
235
  }
235
- if (!('active' in state)) return fail(`the restored vault did not turn active in 60 s: see ${join(work.dir, 'restore-bao.log')}`)
236
+ if (!('active' in state)) return fail(`the restored vault did not turn active in 60 s: its bao said ${lastWords(join(work.dir, 'restore-bao.log')) ?? 'nothing'}`)
236
237
  const got = await new VaultApi(url).rootAfterRestore(d.recoveryKey.trim()).catch((e: Error) => e)
237
238
  if (got instanceof Error) return fail(`a root token from that recovery key: ${got.message}`)
238
239
  const root = new VaultApi(url, got)
239
240
  await d.step?.('root')
240
241
  const audits = await root.auditFiles()
241
242
  const absolute = Object.entries(audits).filter(([, f]) => f.startsWith('/'))
242
- if (absolute.length > 0) return fail(`the restored vault still holds an audit device on an absolute path (${absolute.map(([k]) => k).join(', ')}): see ${join(work.dir, 'restore-bao.log')}`)
243
+ if (absolute.length > 0) return fail(`the restored vault still holds an audit device on an absolute path (${absolute.map(([k]) => k).join(', ')})`)
243
244
  const minterToken = await setupMinter(root)
244
245
  writeFileSync(join(work.dir, 'minter-token'), `${minterToken}\n`, { mode: 0o600 })
245
246
  const names = (await new VaultApi(url, minterToken).versions(KV_MOUNT)).size
@@ -73,12 +73,27 @@ export function chromeProfile(email: string): string {
73
73
  return hit[0]
74
74
  }
75
75
 
76
- /** one page in a new tab of the Chrome profile signed in with `email`, its window left where it is */
77
- export async function openTab(url: string, email: string): Promise<void> {
78
- const open = Bun.spawn([CHROME, `--profile-directory=${chromeProfile(email)}`, url], { stdout: 'ignore', stderr: 'pipe' })
76
+ /** how a page opens in the profile: a new tab of its window, or a popup (Chrome's app window: the page alone, no tab
77
+ * strip, sized like a page) */
78
+ export type ChromeOpen = 'tab' | 'popup'
79
+
80
+ /** a popup's size in points: a page's, never the screen's */
81
+ export const POPUP_SIZE = { w: 1280, h: 900 } as const
82
+
83
+ /** the one argv a page opens with: the binary itself, so a running Chrome takes it in its own process */
84
+ export const openArgv = (url: string, profile: string, as: ChromeOpen): string[] =>
85
+ [CHROME, `--profile-directory=${profile}`, ...(as === 'popup' ? [`--app=${url}`, `--window-size=${POPUP_SIZE.w},${POPUP_SIZE.h}`] : [url])]
86
+
87
+ /** one page in the Chrome profile signed in with `email`: a new tab of its window, or a popup. Nothing of the window
88
+ * is read back */
89
+ export async function openPage(url: string, email: string, as: ChromeOpen): Promise<void> {
90
+ const open = Bun.spawn(openArgv(url, chromeProfile(email), as), { stdout: 'ignore', stderr: 'pipe' })
79
91
  if ((await open.exited) !== 0) throw new Error(`open Chrome: ${(await new Response(open.stderr).text()).trim()}`)
80
92
  }
81
93
 
94
+ /** one page in a new tab of the Chrome profile signed in with `email`, its window left where it is */
95
+ export const openTab = (url: string, email: string): Promise<void> => openPage(url, email, 'tab')
96
+
82
97
  /** the pages tiled in the Chrome profile signed in with `email`, then the media selected in a Finder window below them;
83
98
  * `media` an absolute file or null */
84
99
  export async function openAll(urls: readonly string[], media: string | null, email: string): Promise<void> {
@@ -55,6 +55,12 @@ export const identities = (root = identitiesRoot()): VeilleIdentity[] => identit
55
55
 
56
56
  export const identityOf = (id: string, root = identitiesRoot()): VeilleIdentity | null => identities(root).find((x) => x.id === id) ?? null
57
57
 
58
+ /** the identity a repo speaks as (its `speaksAs`, else the default one), Veille or none: where its pages open */
59
+ export function speakerOfRepo(speaksAs: string | null, root = identitiesRoot()): VeilleIdentity | null {
60
+ const own = speakerOf(speaksAs ?? undefined, identitiesOf(root))
61
+ return own == null ? null : veilleOfIdentity(own)
62
+ }
63
+
58
64
  export const hasVeille = (x: VeilleIdentity): boolean => existsSync(x.watchFile)
59
65
 
60
66
  /** the identity a Chrome profile is signed in as, by its email; null when none is */
package/src/view3d/cam.ts CHANGED
@@ -1,19 +1,16 @@
1
- // the eye of a 3D view (view3d/viewer.ts) as numbers: where it looks, its zoom, where it stands, how far ahead its orbit
2
- // center is, and how a drag, a wheel and a key move it in each kind of space, and whose the wheel is. Pure: no three, no DOM, so a page, the
3
- // hub and a test share the one rule, and the `cam` frame key is its text
4
- // pano: the eye at the center turns and zooms; mesh: it walks level and looks around; splat: it orbits the point ahead
1
+ // the eye of a 3D view (view3d/viewer.ts) as numbers: where it looks, its zoom, where it stands, and how a drag, a key
2
+ // and the wheel move it, and whose the wheel is. Pure: no three, no DOM, so a page, the hub and a test share the one
3
+ // rule, and the `cam` frame key is its text. A drag only turns the eye, ↑ ↓ carry it along the way it faces, the wheel
4
+ // zooms in place; a panorama only turns and zooms
5
5
 
6
- /** what the eye is in: a panorama around it, a mesh it walks, a splat it orbits */
6
+ /** what the eye is in: a panorama around it, a mesh or a splat it moves through */
7
7
  export type Space = 'pano' | 'mesh' | 'splat'
8
8
 
9
9
  /** the eye: where it looks (yaw, pitch in radians, three's YXZ order), its zoom (the fov divided by it), where it stands
10
- * (x, y, z) and how far ahead its orbit's center is (dist, 0 = the space's own: a splat's median depth) */
11
- export type Cam = { yaw: number; pitch: number; zoom: number; x: number; y: number; z: number; dist: number }
12
- export const CAM0: Cam = { yaw: 0, pitch: 0, zoom: 1, x: 0, y: 0, z: 0, dist: 0 }
13
- const CAM_KEYS = ['yaw', 'pitch', 'zoom', 'x', 'y', 'z', 'dist'] as const
14
-
15
- /** a move of the drag or the wheel: `turn` looks or orbits, `pan` moves the eye and the point ahead together */
16
- export type Gesture = 'turn' | 'pan'
10
+ * (x, y, z) */
11
+ export type Cam = { yaw: number; pitch: number; zoom: number; x: number; y: number; z: number }
12
+ export const CAM0: Cam = { yaw: 0, pitch: 0, zoom: 1, x: 0, y: 0, z: 0 }
13
+ const CAM_KEYS = ['yaw', 'pitch', 'zoom', 'x', 'y', 'z'] as const
17
14
 
18
15
  /** where the view is placed, the frame keys' `mode`: a compact `thumb` in a column that scrolls, or the `lightbox`
19
16
  * (a page that fills the window is one) */
@@ -26,7 +23,7 @@ export const wheelIsView = (mode: ViewMode, w: { ctrl: boolean; engaged: boolean
26
23
  const clamp = (v: number, lo: number, hi: number): number => Math.max(lo, Math.min(hi, v))
27
24
  const r3 = (v: number): string => String(Math.round(v * 1000) / 1000)
28
25
 
29
- /** the `cam` key: `yaw,pitch,zoom,x,y,z,dist`, three decimals; empty at rest */
26
+ /** the `cam` key: `yaw,pitch,zoom,x,y,z`, three decimals; empty at rest (a seventh number of an older key is ignored) */
30
27
  export const camText = (c: Cam): string => (CAM_KEYS.some((k) => c[k] !== CAM0[k]) ? CAM_KEYS.map((k) => r3(c[k])).join(',') : '')
31
28
 
32
29
  /** a `cam` key read back: every number it holds, the rest at rest; a value that is no number stays at rest */
@@ -49,53 +46,40 @@ export function axes(c: Pick<Cam, 'yaw' | 'pitch'>): { fwd: [number, number, num
49
46
  return { fwd: [-sy * cp, sp, -cy * cp], right: [cy, 0, -sy], up: [sy * sp, cp, cy * sp] }
50
47
  }
51
48
 
49
+ /** a splat's scale (how far ↑ carries the eye in a second): the median distance of its splats from the eye's start,
50
+ * never their signed z, which a 360° splat spreads round the eye to a median near 0 */
51
+ export function splatDepth(centers: readonly (readonly [number, number, number])[], from: readonly [number, number, number] = [0, 0, 0]): number {
52
+ const ds = centers.map(([x, y, z]) => Math.hypot(x - from[0], y - from[1], z - from[2])).sort((a, b) => a - b)
53
+ const median = ds[ds.length >> 1] ?? 0
54
+ return median > 0 ? median : 6
55
+ }
56
+
52
57
  /** the eye that stands at `at` and looks along `dir` (a unit vector), the inverse of `axes`: a glb camera as a start */
53
58
  export function camAt(at: readonly [number, number, number], dir: readonly [number, number, number]): Cam {
54
59
  return { ...CAM0, x: at[0], y: at[1], z: at[2], yaw: Math.atan2(-dir[0], -dir[2]), pitch: Math.asin(Math.max(-1, Math.min(1, dir[1]))) }
55
60
  }
56
61
 
57
- /** the space the eye is in and its scale: a splat's median depth (its orbit's center by default), else a meter */
62
+ /** the space the eye is in and its scale: a splat's median depth, else a meter */
58
63
  export interface Where {
59
64
  space: Space
60
65
  depth: number
61
66
  }
62
67
 
63
- /** how far ahead the eye's orbit center is: its own dist, else a splat's depth, else 2 m */
64
- export const distOf = (c: Cam, w: Where): number => (c.dist > 0 ? c.dist : w.space === 'splat' ? w.depth : 2)
65
-
66
- /** a drag of dx, dy pixels over a stage h pixels high, at a vertical fov of fovDeg. `turn`: the pano and the mesh look
67
- * around the eye, the splat orbits around the point ahead. `pan`: the eye and that point move together */
68
- export function drag(c: Cam, w: Where, g: Gesture, dx: number, dy: number, h: number, fovDeg: number): Cam {
68
+ /** a drag of dx, dy pixels over a stage h pixels high, at a vertical fov of fovDeg: the eye turns where it stands, in
69
+ * every space, and nothing else moves (the content follows the pointer) */
70
+ export function look(c: Cam, dx: number, dy: number, h: number, fovDeg: number): Cam {
69
71
  const k = (fovDeg * Math.PI) / 180 / Math.max(1, h)
70
- if (w.space === 'pano' || (g === 'turn' && w.space === 'mesh')) return { ...c, yaw: c.yaw + dx * k, pitch: clamp(c.pitch + dy * k, -1.5, 1.5) }
71
- const d = distOf(c, w)
72
- if (g === 'turn') {
73
- const before = axes(c).fwd
74
- const t = [c.x + before[0] * d, c.y + before[1] * d, c.z + before[2] * d] as const
75
- const turned = { ...c, yaw: c.yaw - dx * k, pitch: clamp(c.pitch - dy * k, -1.5, 1.5) }
76
- const f = axes(turned).fwd
77
- return { ...turned, x: t[0] - f[0] * d, y: t[1] - f[1] * d, z: t[2] - f[2] * d }
78
- }
79
- // the point ahead follows the pointer
80
- const s = (2 * d * Math.tan((fovDeg * Math.PI) / 360)) / Math.max(1, h)
81
- const a = axes(c)
82
- return { ...c, x: c.x + (-dx * a.right[0] + dy * a.up[0]) * s, y: c.y + (-dx * a.right[1] + dy * a.up[1]) * s, z: c.z + (-dx * a.right[2] + dy * a.up[2]) * s }
72
+ return { ...c, yaw: c.yaw + dx * k, pitch: clamp(c.pitch + dy * k, -1.5, 1.5) }
83
73
  }
84
74
 
85
- /** forward (back with a negative step) in the space's scale; the pano zooms instead, a splat's orbit center stays put */
86
- export function dolly(c: Cam, w: Where, step: number): Cam {
87
- if (w.space === 'pano') return { ...c, zoom: clamp(c.zoom * Math.exp(step), 0.6, 4) }
75
+ /** a step along the exact way the eye faces, its pitch included (back with a negative step), in the space's scale:
76
+ * meters in a mesh, the splat's depth in a splat; the pano never moves */
77
+ export function forward(c: Cam, w: Where, step: number): Cam {
78
+ if (w.space === 'pano') return c
88
79
  const m = step * (w.space === 'splat' ? w.depth : 1)
89
80
  const f = axes(c).fwd
90
- const moved = { ...c, x: c.x + f[0] * m, y: c.y + f[1] * m, z: c.z + f[2] * m }
91
- return w.space === 'splat' ? { ...moved, dist: Math.max(0.05 * w.depth, distOf(c, w) - m) } : moved
81
+ return { ...c, x: c.x + f[0] * m, y: c.y + f[1] * m, z: c.z + f[2] * m }
92
82
  }
93
83
 
94
- /** a step of the eye along where it looks, to its right and up, in the space's scale: the mesh walks level, the splat
95
- * flies, the pano never moves */
96
- export function move(c: Cam, w: Where, forward: number, right: number, up: number): Cam {
97
- if (w.space === 'pano') return c
98
- const a = axes(w.space === 'mesh' ? { yaw: c.yaw, pitch: 0 } : c)
99
- const s = w.space === 'splat' ? w.depth : 1
100
- return { ...c, x: c.x + (a.fwd[0] * forward + a.right[0] * right) * s, y: c.y + (a.fwd[1] * forward + up) * s, z: c.z + (a.fwd[2] * forward + a.right[2] * right) * s }
101
- }
84
+ /** the zoom times `by`, the eye where it stands: the wheel's only move */
85
+ export const zoomed = (c: Cam, by: number): Cam => ({ ...c, zoom: clamp(c.zoom * by, 0.6, 4) })
package/src/view3d/lib.ts CHANGED
@@ -1,14 +1,32 @@
1
1
  // the 3D viewer (view3d/viewer.ts) as one browser module, three and Spark inside it: what the hub serves at
2
- // /api/review-lib/view3d.mjs for the thread lightbox, built once a process (about 40 ms, 3 MB), and the poster of a
2
+ // /api/review-lib/view3d.mjs for the thread lightbox, built again whenever a file of view3d/ changed (about 40 ms, 3 MB;
3
+ // a fix lands on the next reload, never only after a restart of the daemon that serves it), and the poster of a
3
4
  // splat or a mesh posted with no --image: the viewer drawn alone at rest on a page of its own (`mode=thumb`), shot
4
5
  // through the warm browser `sk shot` uses
6
+ import { readdirSync, statSync } from 'node:fs'
5
7
  import { extname, join } from 'node:path'
6
8
  import { loopbackServe } from '../http/loopback-serve.ts'
7
9
 
8
10
  let built: Promise<{ text: string; tag: string }> | null = null
11
+ let builtFrom = ''
9
12
 
10
- /** the viewer as one ES module and its tag, built on the first ask */
13
+ /** what the sources of `dir` are now: each .ts file's name, size and change time; a few stats, no read */
14
+ export function sourceStamp(dir: string): string {
15
+ return readdirSync(dir)
16
+ .filter((f) => f.endsWith('.ts'))
17
+ .sort()
18
+ .map((f) => {
19
+ const s = statSync(join(dir, f))
20
+ return `${f}:${s.size}:${s.mtimeMs}`
21
+ })
22
+ .join('|')
23
+ }
24
+
25
+ /** the viewer as one ES module and its tag, built on the first ask and again once a source of view3d/ changed */
11
26
  export function view3dLib(): Promise<{ text: string; tag: string }> {
27
+ const stamp = sourceStamp(import.meta.dir)
28
+ if (stamp !== builtFrom) built = null
29
+ builtFrom = stamp
12
30
  built ??= (async () => {
13
31
  const r = await Bun.build({ entrypoints: [join(import.meta.dir, 'viewer.ts')], target: 'browser', format: 'esm', minify: true })
14
32
  const out = r.outputs[0]