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,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 512 512">
2
+ <g fill="none" stroke="#f4c04a" stroke-linecap="round">
3
+ <path stroke-width="30" d="M256 216L256 56M284.3 227.7L397.4 114.6M296 256L456 256M284.3 284.3L397.4 397.4M256 296L256 456M227.7 284.3L114.6 397.4M216 256L56 256M227.7 227.7L114.6 114.6"/>
4
+ <path stroke-width="46" d="M256 58L256 34M396 116L413 99M454 256L478 256M396 396L413 413M256 454L256 478M116 396L99 413M58 256L34 256M116 116L99 99"/>
5
+ <circle cx="256" cy="256" r="160" stroke-width="44"/>
6
+ </g>
7
+ <path fill="#f4c04a" fill-rule="evenodd" d="M192 256a64 64 0 1 0 128 0a64 64 0 1 0 -128 0ZM234 256a22 22 0 1 0 44 0a22 22 0 1 0 -44 0Z"/>
8
+ </svg>
@@ -1,23 +1,30 @@
1
1
  // the macOS apps shipkit opens web pages in: ONE source, ShipkitGui.swift,
2
2
  // built with swiftc into a bundle per page it serves. `shipkit gui` is that
3
- // app pointed at the home; each global process with a url gets its own, named
4
- // and iconed after it, in ~/Applications, where Spotlight and Launchpad find
5
- // it (home/process-apps.ts builds them all and removes the stale ones). The
6
- // bundle's Info.plist carries what differs (name, bundle id, start url), so a
3
+ // app pointed at the home; each house repo gets its own on its hub page (one
4
+ // window of tabs: the hub alone at launch, then each entry or url he opens), and
5
+ // each global process with a url its own, named and iconed after it, in
6
+ // ~/Applications, where Spotlight, Launchpad and cmd-tab find it
7
+ // (home/process-apps.ts builds them all and removes the stale ones). The
8
+ // bundle's Info.plist carries what differs (name, bundle id, start url, its
9
+ // mode: home, process or project, and a project's repo), so a
7
10
  // fix to the window (find, the inspector, zoom) lands in every app at its next
8
11
  // build. The binary is compiled once per source and copied into each bundle.
9
12
  // The icon is core/app-icon.ts: the repo's mark, its margin cut, on a plate in
10
- // the repo's colour. Rebuilt only when the source, the icon, the colours or the
11
- // start url changed (a stamp in the bundle). No compiler, or not macOS: the caller falls back.
13
+ // the repo's colour, or its initial where it has no mark, in the rim of the plate's hue (the home app: shipkit's own
14
+ // mark, gui-app/icon.svg). Rebuilt only when
15
+ // the source, the icon, its drawing, the colours or the start url changed (a stamp in the bundle). No compiler, or not macOS: the caller falls back.
12
16
  // The same build makes the menu bar recorder from its own source (recordings/recorder-app.ts).
13
17
  import { createHash } from 'crypto'
14
18
  import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'fs'
15
19
  import { dirname, join } from 'path'
16
- import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
17
- import { identityOfName, type Identity } from '../core/identity-color.ts'
20
+ import { appIconOf, appIconPngs, DEFAULT_FRAME, frameOfRoot, identityOfRoot, LETTER_SHARE, letterMark, letterOf, type IconFrame, type IconLook } from '../core/app-icon.ts'
21
+ import { ICON_DRAWING } from '../core/app-icon-frame.ts'
22
+ import { textOn } from '../core/gui-color.ts'
23
+ import { guiColorOf } from '../core/repo-gui-color.ts'
24
+ import type { Identity } from '../core/identity-color.ts'
18
25
  import { SIGN_NAME, signArgs } from './app-sign.ts'
19
- import { homeDir } from './home-paths.ts'
20
- import { appNameOf, appsDir, GUI_SOURCE as SOURCE, shipkitBundleOf, wrapperBundleId, wrapperPath, type AppOf } from './process-apps.ts'
26
+ import { homeDir, homeUrl, hubBase } from './home-paths.ts'
27
+ import { appNameOf, appsDir, GUI_SOURCE as SOURCE, projectBundleId, projectPath, shipkitBundleOf, wrapperBundleId, wrapperPath, type AppOf, type ProjectOf } from './process-apps.ts'
21
28
 
22
29
  export const BUNDLE_ID = 'dev.shipkit.gui'
23
30
  export const guiAppPath = (): string => join(appsDir(), 'Shipkit.app')
@@ -30,8 +37,20 @@ export type AppSpec = {
30
37
  /** the page a launch with no url opens; null opens the home */
31
38
  url: string | null
32
39
  icon: string | null
40
+ /** with no icon: the letter drawn on the plate instead of a mark */
41
+ letter?: string
42
+ /** what the window is (ShipkitMode): the home with its badge and notifications, a process's page, or one repo's
43
+ * hub with that repo's badge; none for an app of another source */
44
+ mode?: AppMode
45
+ /** a project app's repo (ShipkitRepo): the badge counts its threads */
46
+ repo?: string
47
+ /** the repo's window colour (ShipkitTint, its text ShipkitTintText): the title and tab bar wear it, as Peacock's
48
+ * VSCode window does; none: the system's chrome (the home app) */
49
+ tint?: string
33
50
  /** the repo's colours: the plate behind the icon's mark */
34
51
  identity: Identity
52
+ /** the icon's rim (core/app-icon-frame.ts), false for none (a mark with its own frame); absent: DEFAULT_FRAME */
53
+ frame?: IconFrame | false
35
54
  /** where the bundle lands */
36
55
  app: string
37
56
  version: string
@@ -45,14 +64,18 @@ export type AppSpec = {
45
64
  plist?: string
46
65
  }
47
66
 
67
+ export type AppMode = 'home' | 'process' | 'project'
68
+
48
69
  const xml = (s: string): string => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
49
70
 
50
71
  /** plain http to a host that is not local needs its own ATS exception; the
51
- * local network is allowed to every app. The home's window (no url of its own) frames names under localhost
72
+ * local network is allowed to every app. The home's window (no url of its own) and a project app frame names under localhost
52
73
  * (`<process>.<machine>.localhost`, `<url id>--<repo>.localhost`): local networking covers an address and a name
53
- * with no dot, never a dotted one, so those get the one exception that names localhost and what is under it */
54
- function atsOf(url: string | null): string {
55
- if (url == null) return `<dict><key>NSAllowsLocalNetworking</key><true/><key>NSExceptionDomains</key><dict><key>localhost</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>`
74
+ * with no dot, never a dotted one, so those get the one exception that names localhost and what is under it.
75
+ * A project app's tabs open any url of the repo, a plain http one of another machine among them (a dev server on
76
+ * the tailnet): its web views alone load any host, as a browser's do */
77
+ function atsOf(url: string | null, mode?: AppMode): string {
78
+ if (url == null || mode === 'project') return `<dict><key>NSAllowsLocalNetworking</key><true/>${mode === 'project' ? '<key>NSAllowsArbitraryLoadsInWebContent</key><true/>' : ''}<key>NSExceptionDomains</key><dict><key>localhost</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>`
56
79
  let u: URL | null = null
57
80
  try { u = new URL(url) } catch { /* not a url: the local network only */ }
58
81
  const host = u?.protocol === 'http:' ? u.hostname : null
@@ -75,10 +98,10 @@ export function infoPlist(o: Omit<AppSpec, 'app' | 'icon' | 'identity'>): string
75
98
  \t<key>CFBundlePackageType</key><string>APPL</string>
76
99
  \t<key>CFBundleShortVersionString</key><string>${xml(o.version)}</string>
77
100
  \t<key>CFBundleVersion</key><string>${xml(o.version)}</string>
78
- ${o.url == null ? '' : `\t<key>ShipkitStartURL</key><string>${xml(o.url)}</string>\n`}\t<key>LSMinimumSystemVersion</key><string>12.0</string>
101
+ ${o.url == null ? '' : `\t<key>ShipkitStartURL</key><string>${xml(o.url)}</string>\n`}${o.mode == null ? '' : `\t<key>ShipkitMode</key><string>${o.mode}</string>\n`}${o.repo == null ? '' : `\t<key>ShipkitRepo</key><string>${xml(o.repo)}</string>\n`}${o.tint == null ? '' : `\t<key>ShipkitTint</key><string>${xml(o.tint)}</string>\n\t<key>ShipkitTintText</key><string>${textOn(o.tint)}</string>\n`}\t<key>LSMinimumSystemVersion</key><string>12.0</string>
79
102
  \t<key>NSHighResolutionCapable</key><true/>
80
103
  \t<key>NSMicrophoneUsageDescription</key><string>${xml(o.micWhy ?? "A page you open here records your voice, a trailer's lines for one.")}</string>
81
- \t<key>NSAppTransportSecurity</key>${atsOf(o.url)}
104
+ \t<key>NSAppTransportSecurity</key>${atsOf(o.url, o.mode)}
82
105
  ${o.agent ? '\t<key>LSUIElement</key><true/>\n' : ''}${o.plist ?? ''}</dict>
83
106
  </plist>
84
107
  `
@@ -90,9 +113,6 @@ const runSync: Run = (cmd) => {
90
113
  return { code: p.exitCode ?? 1, err: p.stderr.toString().trim() }
91
114
  }
92
115
 
93
- /** bumped when the icon drawing changes, so every built app redraws its icon */
94
- const ICON_DRAWING = 'plate-1'
95
-
96
116
  /** the stamp a built bundle carries: what it was built from. The version is
97
117
  * left out, so a shipkit release rebuilds nothing */
98
118
  export function stampOf(source: string, icon: string | null, identity = ''): string {
@@ -101,10 +121,26 @@ export function stampOf(source: string, icon: string | null, identity = ''): str
101
121
  return h.digest('hex').slice(0, 16)
102
122
  }
103
123
 
124
+ /** an app's icon as its bundle carries it, one png per size: its mark on its plate, else its letter on its window
125
+ * colour, in its frame; null: no icon, the system's. `look` draws it otherwise (a preview of another version) */
126
+ export function specIconPngs(spec: Pick<AppSpec, 'icon' | 'letter' | 'tint' | 'identity' | 'frame'>, sizes: number[], look: IconLook = {}): Promise<Buffer[]> | null {
127
+ const frame = spec.frame ?? DEFAULT_FRAME
128
+ if (spec.icon != null) return appIconPngs(readFileSync(spec.icon), spec.identity, sizes, 'canvas', { frame, ...look })
129
+ if (spec.letter == null) return null
130
+ const plate = spec.tint == null ? spec.identity : { colorLight: spec.tint, colorDark: spec.tint }
131
+ return appIconPngs(letterMark(spec.letter, spec.tint == null ? undefined : textOn(spec.tint)), plate, sizes, 'canvas', { share: LETTER_SHARE, frame, ...look })
132
+ }
133
+
134
+ /** where the window's binary for this source text lives in `bins` */
135
+ export const guiBinPath = (text: string, bins: string, exe = 'shipkit-gui'): string => join(bins, `${exe}-${createHash('sha256').update(text).digest('hex').slice(0, 16)}`)
136
+
137
+ /** the text the window's binary is compiled from: several sources, one module, main.swift its entry */
138
+ export const guiSourceText = (source: string | readonly string[] = SOURCE): string => (typeof source === 'string' ? [source] : source).map((f) => readFileSync(f, 'utf8')).join('\n')
139
+
104
140
  /** the window's binary, compiled once per source text into `bins`: swiftc
105
141
  * takes about a minute, and every bundle runs the same binary */
106
142
  function compiledGui(source: string | readonly string[], text: string, run: Run, bins: string, exe = 'shipkit-gui'): string {
107
- const bin = join(bins, `${exe}-${createHash('sha256').update(text).digest('hex').slice(0, 16)}`)
143
+ const bin = guiBinPath(text, bins, exe)
108
144
  if (existsSync(bin)) return bin
109
145
  mkdirSync(bins, { recursive: true })
110
146
  const tmp = `${bin}.building-${process.pid}`
@@ -123,11 +159,11 @@ export async function ensureApp(spec: AppSpec, o: { run?: Run; source?: string |
123
159
  const { app, icon } = spec
124
160
  const run = o.run ?? runSync
125
161
  const source = o.source ?? SOURCE
126
- // several sources: one module, main.swift its entry; the stamp reads them all
127
- const text = (typeof source === 'string' ? [source] : source).map((f) => readFileSync(f, 'utf8')).join('\n')
162
+ // the stamp reads every source
163
+ const text = guiSourceText(source)
128
164
  // the machine's signing identity, when it has one, names the app across rebuilds (app-sign.ts): signed anew once it appears
129
165
  const sign = o.sign ?? signArgs()
130
- const stamp = stampOf(text, icon, JSON.stringify([spec.name, spec.bundleId, spec.url, spec.identity, ICON_DRAWING, ...(spec.url == null ? [atsOf(null)] : []), ...(spec.exe || spec.agent || spec.plist || spec.micWhy ? [spec.exe, spec.agent, spec.plist, spec.micWhy] : []), ...(sign[1] !== '-' ? [sign[1]] : [])]))
166
+ const stamp = stampOf(text, icon, JSON.stringify([spec.name, spec.bundleId, spec.url, spec.identity, ICON_DRAWING, spec.frame ?? null, spec.mode, spec.repo, spec.tint, icon == null ? spec.letter : null, ...(spec.url == null ? [atsOf(null)] : []), ...(spec.exe || spec.agent || spec.plist || spec.micWhy ? [spec.exe, spec.agent, spec.plist, spec.micWhy] : []), ...(sign[1] !== '-' ? [sign[1]] : [])]))
131
167
  const stampFile = join(app, 'Contents', 'Resources', 'stamp')
132
168
  if (existsSync(stampFile) && readFileSync(stampFile, 'utf8') === stamp) return { app, rebuilt: false }
133
169
  const bin = compiledGui(source, text, run, o.bins ?? join(homeDir(), 'gui-bin'), spec.exe)
@@ -141,12 +177,13 @@ export async function ensureApp(spec: AppSpec, o: { run?: Run; source?: string |
141
177
  const exe = join(tmp, 'Contents', 'MacOS', spec.exe ?? 'shipkit-gui')
142
178
  copyFileSync(bin, exe)
143
179
  chmodSync(exe, 0o755)
144
- if (icon != null) {
180
+ const letter = icon == null ? spec.letter : undefined
181
+ if (icon != null || letter != null) {
145
182
  const set = join(res, 'AppIcon.iconset')
146
183
  mkdirSync(set, { recursive: true })
147
184
  const files = [16, 32, 128, 256, 512].flatMap((n) => [[`icon_${n}x${n}.png`, n], [`icon_${n}x${n}@2x.png`, n * 2]] as const)
148
- const pngs = await appIconPngs(readFileSync(icon), spec.identity, files.map(([, px]) => px))
149
- .catch((e: Error) => fail(`could not draw the icon from ${icon}: ${e.message}`))
185
+ const pngs = await specIconPngs(spec, files.map(([, px]) => px))!
186
+ .catch((e: Error) => fail(`could not draw the icon from ${icon ?? `the letter ${letter}`}: ${e.message}`))
150
187
  files.forEach(([file], i) => writeFileSync(join(set, file), pngs[i]!))
151
188
  const r = run(['iconutil', '-c', 'icns', set, '-o', join(res, 'AppIcon.icns')])
152
189
  rmSync(set, { recursive: true, force: true })
@@ -177,11 +214,21 @@ export async function ensureApp(spec: AppSpec, o: { run?: Run; source?: string |
177
214
  return { app, rebuilt: true }
178
215
  }
179
216
 
180
- /** the shipkit app: the shared source on the home, the house repo's icon */
181
- export function ensureGuiApp(o: { root: string | null; version: string; app?: string; run?: Run }): Promise<{ app: string; rebuilt: boolean }> {
182
- return ensureApp({ name: 'shipkit', bundleId: BUNDLE_ID, url: null, icon: o.root == null ? null : appIconOf(o.root), identity: o.root == null ? identityOfName('shipkit') : identityOfRoot(o.root), app: o.app ?? guiAppPath(), version: o.version }, { run: o.run })
217
+ /** the shipkit app: the shared source on the home, shipkit's own icon */
218
+ export function ensureGuiApp(o: { version: string; app?: string; run?: Run }): Promise<{ app: string; rebuilt: boolean }> {
219
+ return ensureApp(guiSpec(o), { run: o.run })
183
220
  }
184
221
 
222
+ /** shipkit's own mark: a ship's wheel in brass, so the home app never wears the mark of the house repo's project app
223
+ * beside it in cmd-tab and the Dock */
224
+ export const GUI_ICON = join(import.meta.dir, 'gui-app', 'icon.svg')
225
+ /** the home app's plate: a deep navy, a hue no repo's app takes from its config */
226
+ export const GUI_IDENTITY: Identity = { colorLight: '#2c5a86', colorDark: '#16324f' }
227
+
228
+ /** the shipkit app's spec: its own mark and colours, whatever house it serves */
229
+ export const guiSpec = (o: { version: string; app?: string }): AppSpec =>
230
+ ({ name: 'shipkit', bundleId: BUNDLE_ID, url: null, mode: 'home', icon: GUI_ICON, identity: GUI_IDENTITY, app: o.app ?? guiAppPath(), version: o.version })
231
+
185
232
  /** what a global process gives its app. `app`: its declared app name, else the label */
186
233
  export type WrapperOf = AppOf
187
234
 
@@ -194,7 +241,24 @@ const RASTER = /\.(png|jpe?g|gif|webp)$/i
194
241
  export function wrapperSpec(d: WrapperOf, version: string, dir = appsDir()): AppSpec {
195
242
  if (d.url == null) throw new Error(`${d.id} declares no url: there is no page to open as an app`)
196
243
  const declared = d.icon != null && RASTER.test(d.icon) && existsSync(join(d.root, d.icon)) ? join(d.root, d.icon) : null
197
- return { name: appNameOf(d), bundleId: wrapperBundleId(d.id), url: d.url, icon: declared ?? appIconOf(d.root), identity: identityOfRoot(d.root), app: wrapperPath(d, dir), version }
244
+ return { name: appNameOf(d), bundleId: wrapperBundleId(d.id), url: d.url, mode: 'process', tint: guiColorOf(d.root).color, icon: declared ?? appIconOf(d.root), identity: identityOfRoot(d.root), frame: frameOfRoot(d.root), app: wrapperPath(d, dir), version }
245
+ }
246
+
247
+ /** the spec of a house repo's own app: named after the repo as the hub routes it, its own bundle id (cmd-tab and the
248
+ * Dock show each project apart), the repo's hub page in its project shell, its window colour, the repo's mark else
249
+ * its initial on that colour. Throws on a `guiColor` that is no colour */
250
+ export function projectSpec(r: ProjectOf, version: string, dir = appsDir(), hub = homeUrl()): AppSpec {
251
+ const icon = appIconOf(r.root)
252
+ const gui = guiColorOf(r.root, r.name)
253
+ if (gui.problem != null) throw new Error(gui.problem)
254
+ return { name: r.name, bundleId: projectBundleId(r.name), url: `${hub}${hubBase(r.name)}/?shell=project`, mode: 'project', repo: r.name, tint: gui.color, icon, ...(icon == null ? { letter: letterOf(r.name) } : {}), identity: identityOfRoot(r.root), frame: frameOfRoot(r.root), app: projectPath(r, dir), version }
255
+ }
256
+
257
+ /** builds a repo's app when it is missing or stale. Refuses to replace an app at its path that shipkit did not build */
258
+ export const ensureProjectApp = async (r: ProjectOf, o: { version: string; run?: Run; dir?: string; bins?: string; hub?: string }): Promise<{ app: string; rebuilt: boolean; bundleId: string }> => {
259
+ const spec = projectSpec(r, o.version, o.dir, o.hub)
260
+ if (existsSync(spec.app) && shipkitBundleOf(spec.app) == null) throw new Error(`${spec.app} is an app shipkit did not build: repo ${r.name} gets no app while it is there`)
261
+ return { ...(await ensureApp(spec, { run: o.run, bins: o.bins })), bundleId: spec.bundleId }
198
262
  }
199
263
 
200
264
  /** builds a process's app when it is missing or stale. Refuses to replace
@@ -27,8 +27,9 @@ import { pushFleet } from '../fleet/push-fleet.ts'
27
27
  import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
28
28
  import { inboxResponse } from './inbox.ts'
29
29
  import { ThreadPush, type PushSource } from '../review/push.ts'
30
- import { dirStamp, held, keepersStamp, transcriptPulse } from './push-sources.ts'
31
- import { PM_STAMP } from './pm.ts'
30
+ import { dirStamp, fileStamp, held, orchestratorsStamp, transcriptPulse } from './push-sources.ts'
31
+ import { PM_STAMP, ROLES } from './pm.ts'
32
+ import { childLog, pmLog, pmUrl } from './home-paths.ts'
32
33
  import { machineGet } from '../core/machine-db.ts'
33
34
  import { usageDir } from '../agent-time/accounts-usage-disk.ts'
34
35
  import { advisorsDir } from '../advisors/owner-store.ts'
@@ -145,6 +146,11 @@ export type PlannedAnswer = {
145
146
  held: string[]
146
147
  }
147
148
 
149
+ /** the projects' names by last activity, newest first, the never active last by name: what the `projects` source
150
+ * says of a lane's turn */
151
+ export const projectsOrder = (rows: readonly Pick<ProjectRow, 'name' | 'activity'>[]): string =>
152
+ [...rows].sort((x, y) => (y.activity ?? -Infinity) - (x.activity ?? -Infinity) || x.name.localeCompare(y.name)).map((p) => p.name).join(',')
153
+
148
154
  export function homeRoutes(d: HomeDeps) {
149
155
  let repos: WiredRepo[] = []
150
156
  let rows: ProjectRow[] = []
@@ -165,6 +171,7 @@ export function homeRoutes(d: HomeDeps) {
165
171
  const ownerFile = join(advisorsDir(), 'owner.json')
166
172
  // the advisors' sync rewrites its reach times (`at`) every pass: a clock, never a change
167
173
  const advisorsStamp = held(1_000, () => (existsSync(ownerFile) ? Bun.hash(JSON.stringify(JSON.parse(readFileSync(ownerFile, 'utf8')) as unknown, (k, v: unknown) => (k === 'at' ? undefined : v))).toString(36) : '-'))
174
+ const logsStamp = held(1_000, () => `${ROLES.map((r) => fileStamp(childLog(d.dir, r))).join('|')}|${fileStamp(pmLog(d.dir))}|${dirStamp(join(d.dir, 'resources'))}`)
168
175
  const homeSources: PushSource[] = [
169
176
  // what holds the plan: a settle that starts or ends is said, its countdown (the dock's hover) is not
170
177
  { src: 'runs', stamp: () => (d.plan?.held() ?? []).join('\n').replace(/\d+/g, '#') },
@@ -175,18 +182,28 @@ export function homeRoutes(d: HomeDeps) {
175
182
  // The page shows a role down only past 15 s (machine-st.ts QUIET_MS), so a read every 10 s at most is enough
176
183
  { src: 'pm', stamp: pmRow, gapMs: 10_000 },
177
184
  // a lane's turn moves the line of what it does: at most one read every 10 s
178
- { src: 'orchestrators', stamp: () => `${keepersStamp()}|${transcriptPulse.stamp()}|${advisorsStamp()}`, gapMs: 10_000 },
185
+ { src: 'orchestrators', stamp: () => `${orchestratorsStamp()}|${transcriptPulse.stamp()}|${advisorsStamp()}`, gapMs: 10_000 },
179
186
  { src: 'advisors', stamp: advisorsStamp },
187
+ // a meter renders every few seconds and each render differs: the overview reads them at most every 10 s
188
+ { src: 'widgets', stamp: () => d.widgets?.stamp() ?? '', gapMs: 10_000 },
189
+ // the logs whose tails pm's answer holds: a page reads pm for them only while it shows a tail
190
+ { src: 'logs', stamp: logsStamp, gapMs: 5_000 },
180
191
  ]
181
192
  /** the projects as last measured, by their content: a new one is said at once */
182
193
  let projectsSaid = ''
194
+ /** and their order by last activity, the one thing a page draws from a lane's turn */
195
+ let orderSaid = ''
183
196
 
184
197
  async function refresh(): Promise<void> {
185
198
  const a = await d.gutter.answer()
186
- // a lane's turn moves its repo's activity, an age on the rail: said to the half minute
187
- const said = Bun.hash(JSON.stringify(a.projects.map((p) => ({ ...p, activity: Math.floor((p.activity ?? 0) / 30_000) })))).toString(36)
199
+ const said = Bun.hash(JSON.stringify(a.projects.map((p) => ({ ...p, activity: null })))).toString(36)
200
+ // a lane's turn moves its repo's activity, which a page draws as the list's order (sorted by activity) and as an
201
+ // age in a hover: the order is said, at most every 30 s, and the age is as old as the page's last read
202
+ const order = projectsOrder(a.projects)
188
203
  if (projectsSaid !== '' && said !== projectsSaid) push.moved('projects')
204
+ else if (orderSaid !== '' && order !== orderSaid) push.moved('projects', undefined, 30_000)
189
205
  projectsSaid = said
206
+ orderSaid = order
190
207
  rows = a.projects
191
208
  repos = a.projects.filter((p) => d.only == null || d.only.has(p.name)).map((p) => ({ name: p.name, path: p.path, icon: null }))
192
209
  d.hubs.sync(repos)
@@ -289,10 +306,23 @@ export function homeRoutes(d: HomeDeps) {
289
306
  // the door to a machine's dev url, asked by the web alone (hq/door.ts): where a process of a machine is, on the
290
307
  // hq's machine, and this machine's own door
291
308
  if (path.startsWith('/api/home/door/') && req.method === 'GET') {
309
+ if (repos.length === 0) await refresh()
292
310
  const { doorRoute } = await import('../hq/door-route.ts')
293
- const r = await doorRoute(req, path, { peers: () => (d.otherMacs?.() ?? []).map((m) => new URL(m.url).hostname) })
311
+ const { ownUrlOf } = await import('../urls/places.ts')
312
+ const r = await doorRoute(req, path, {
313
+ peers: () => (d.otherMacs?.() ?? []).map((m) => new URL(m.url).hostname),
314
+ urls: ownUrlOf(repos),
315
+ repos: async () => repos.map((x) => ({ name: x.name, path: x.path })),
316
+ })
294
317
  if (r != null) return r
295
318
  }
319
+ // a repo's urls and processes on every other place of the hq, for this machine's own page (urls/places.ts)
320
+ if (path === '/api/home/places.json' && req.method === 'GET') {
321
+ if (repos.length === 0) await refresh()
322
+ const { placesRoute } = await import('../urls/places.ts')
323
+ const { homePort } = await import('./home-paths.ts')
324
+ return placesRoute(req, repos, homePort())
325
+ }
296
326
  // every database of the machine, for the database page: a stat and the header of each file, the counts the job
297
327
  // `db census` kept (home/databases.ts)
298
328
  if (path === '/api/home/databases' && req.method === 'GET') {
@@ -300,10 +330,24 @@ export function homeRoutes(d: HomeDeps) {
300
330
  const { databasesPage } = await import('./databases.ts')
301
331
  return Response.json(await databasesPage({ repos }), { headers: { 'cache-control': 'no-store' } })
302
332
  }
303
- // the orchestrators: who is live now, his click to turn one on, his new thread (orchestrator/routes.ts)
304
- if (path.startsWith('/api/home/orchestrators')) {
333
+ // the parts of a page's socket (serve/page-live.ts): every project's terminals and Claude sessions as one for a
334
+ // page that lists them all, and a process's log, which pm streams to this process for the page
335
+ // (terminal-route.ts: its own gate first). That read has no timeout: a fetch of this runtime cuts a stream that
336
+ // stays silent for 360 s, and a quiet log is silent
337
+ if (path.startsWith('/api/terminal/')) {
338
+ const { machineTerminal } = await import('../serve/terminal-route.ts')
339
+ const r = await machineTerminal(req, path, srv, async () => {
340
+ if (repos.length === 0) await refresh()
341
+ return repos.map((x) => ({ name: x.name, root: x.path }))
342
+ }, undefined, (id, lines, signal) => fetch(`${pmUrl()}/api/pm/log?id=${encodeURIComponent(id)}&lines=${lines}`, { signal, timeout: false }))
343
+ if (r != null) return r
344
+ }
345
+ // the orchestrators: who is live now, his click to start one, his new thread, and his quiet mode, which holds
346
+ // their pushes (orchestrator/routes.ts), on this Mac's own terminal server (serve/orchestrator-host.ts)
347
+ if (path.startsWith('/api/home/orchestrators') || path === '/api/home/quiet') {
305
348
  const { orchestratorRoutes } = await import('../orchestrator/routes.ts')
306
- const r = await orchestratorRoutes(d.root)(req, path)
349
+ const { machineOrchestratorHost } = await import('../serve/orchestrator-host.ts')
350
+ const r = await orchestratorRoutes(d.root, undefined, machineOrchestratorHost)(req, path)
307
351
  if (r != null) return r
308
352
  }
309
353
  // the threads he shares with advisors: the page, a thread's bar, his acts and his preview (advisors/routes.ts)
@@ -6,6 +6,7 @@ import { homedir } from 'os'
6
6
  import { join, resolve } from 'path'
7
7
  import { homeRepo, houseIndex } from '../house/project-gutter.ts'
8
8
  import type { WrapperOf } from './gui-app.ts'
9
+ import type { ProjectOf } from './process-apps.ts'
9
10
 
10
11
  // the app builder draws icons with canvas: loaded when a window opens, never
11
12
  // at the startup of every command that imports this module
@@ -90,13 +91,13 @@ export function windowCmd(url: string, o: { chrome?: string; platform?: string }
90
91
  }
91
92
 
92
93
  /** one more home window: the native app where it can be built (its own
93
- * dock icon, the house mark), else a Chrome app window. `warn` hears why the
94
+ * dock icon, shipkit's own mark), else a Chrome app window. `warn` hears why the
94
95
  * native one was not used */
95
- export async function openWindow(url: string, o: { root?: string | null; version?: string; warn?: (l: string) => void } = {}): Promise<string[]> {
96
+ export async function openWindow(url: string, o: { version?: string; warn?: (l: string) => void } = {}): Promise<string[]> {
96
97
  const { BUNDLE_ID, canBuildGui, ensureGuiApp, quitCmd } = await gui()
97
98
  if (canBuildGui()) {
98
99
  try {
99
- const { app, rebuilt } = await ensureGuiApp({ root: o.root ?? houseRoot(process.cwd()), version: o.version ?? '0' })
100
+ const { app, rebuilt } = await ensureGuiApp({ version: o.version ?? '0' })
100
101
  // a running copy is the old build: it quits, and the new one opens the window
101
102
  if (rebuilt) Bun.spawnSync(quitCmd(BUNDLE_ID), { stdout: 'ignore', stderr: 'ignore' })
102
103
  const cmd = ['open', '-a', app, url]
@@ -130,6 +131,29 @@ export async function openProcessApp(d: WrapperOf, o: { version: string; warn?:
130
131
  return chromeWindow(d.url)
131
132
  }
132
133
 
134
+ /** the command that brings a repo's own app forward: with no url a running copy shows the tab it was on; with its
135
+ * hub's url the app shows its hub tab (ShipkitGui.swift open: an address already open is shown, never loaded twice) */
136
+ export const projectAppCmd = (app: string, hubUrl: string | null): string[] => (hubUrl == null ? ['open', '-a', app] : ['open', '-a', app, hubUrl])
137
+
138
+ /** a house repo's own app: built in ~/Applications when missing or stale, then opened with no url, so a running copy
139
+ * comes to the front; `hub`: on its hub tab, where a page was asked of it (serve/project-gutter-route.ts). A rebuild
140
+ * never quits a running copy: it sees its bundle changed and offers to relaunch (ShipkitGui.swift). Where no app can
141
+ * be built, a Chrome app window on the repo's page */
142
+ export async function openProjectApp(r: ProjectOf, o: { version: string; hub?: boolean; warn?: (l: string) => void }): Promise<string[]> {
143
+ const { canBuildGui, ensureProjectApp, projectSpec } = await gui()
144
+ if (canBuildGui()) {
145
+ try {
146
+ const { app } = await ensureProjectApp(r, { version: o.version })
147
+ const cmd = projectAppCmd(app, o.hub === true ? projectSpec(r, o.version).url! : null)
148
+ Bun.spawnSync(cmd, { stdout: 'ignore', stderr: 'ignore' })
149
+ return cmd
150
+ } catch (e) {
151
+ o.warn?.(`WARN the app of repo ${r.name} could not be built, so this window is a Chrome one: ${(e as Error).message}`)
152
+ }
153
+ }
154
+ return chromeWindow(projectSpec(r, o.version).url!)
155
+ }
156
+
133
157
  function chromeWindow(url: string): string[] {
134
158
  mkdirSync(guiProfile(), { recursive: true })
135
159
  const cmd = windowCmd(url)
@@ -10,7 +10,7 @@ import { bandOf } from '../review/band.ts'
10
10
  import type { ThreadIndex, ThreadRow } from '../review/cells.ts'
11
11
  import { canonicalAddress } from '../review/model.ts'
12
12
  import { needAddress } from '../review/need-address.ts'
13
- import { hearingOf, NO_PARTIES, NOBODY_HEARS, type Parties } from '../review/parties.ts'
13
+ import { hearingOf, NO_PARTIES, type Parties } from '../review/parties.ts'
14
14
  import { askVerb, isOwnerWait, OWNER_WAITS, waitsMatch, type OwnerWait, type Wait, type WaitsOn } from '../review/wait.ts'
15
15
 
16
16
  export { OWNER_WAITS, type OwnerWait, type Wait } from '../review/wait.ts'
@@ -55,6 +55,8 @@ export interface InboxRow {
55
55
  unread?: true
56
56
  /** one more line: the lane and the versions, the need's sentence */
57
57
  sub?: string
58
+ /** his turn and no live party hears his answer there: who held it, as its chip says it; the row wears the deaf mark */
59
+ deaf?: string
58
60
  lane?: string
59
61
  /** epoch ms of its newest move, null when nothing dates it */
60
62
  at: number | null
@@ -125,8 +127,9 @@ const listOfRow = (r: ThreadRow, p: Parties): InboxList => {
125
127
  function threadRow(repo: string, r: ThreadRow, wait: Wait, verbs: OwnerWait[], p: Parties | null): InboxRow {
126
128
  const later = r.turn === 'aside' && r.aside != null ? `after ${r.aside.until.slice(0, 10)}` : null
127
129
  // his turn and no live party hears his answer: he knows to ping a session
128
- const deaf = p !== null && isOwnerWait(wait) && r.turn !== 'aside' && hearingOf(r.holder ? { ...r.holder, at: '' } : null, p, repo).light === 'nobody' ? NOBODY_HEARS : null
129
- const sub = [deaf, later, r.lane, r.versions > 1 ? `v${r.versions}` : null].filter((x): x is string => x != null && x !== '').join(' · ')
130
+ const hearing = p !== null && isOwnerWait(wait) && r.turn !== 'aside' ? hearingOf(r.holder ? { ...r.holder, at: '' } : null, p, repo) : null
131
+ const deaf = hearing?.light === 'nobody' ? hearing.chip : null
132
+ const sub = [later, r.lane, r.versions > 1 ? `v${r.versions}` : null].filter((x): x is string => x != null && x !== '').join(' · ')
130
133
  const at = Date.parse(r.updated)
131
134
  return {
132
135
  key: `${repo}/${r.head}`,
@@ -139,6 +142,7 @@ function threadRow(repo: string, r: ThreadRow, wait: Wait, verbs: OwnerWait[], p
139
142
  title: r.title,
140
143
  ...(r.unread ? { unread: true as const } : {}),
141
144
  ...(sub !== '' ? { sub } : {}),
145
+ ...(deaf !== null ? { deaf } : {}),
142
146
  ...(r.lane ? { lane: r.lane } : {}),
143
147
  at: Number.isFinite(at) ? at : null,
144
148
  thumb: r.thumb != null && IMAGE.test(r.thumb) ? `${hubOf(repo)}/api/review/${r.head}/preview/thumb/${r.thumb}` : null,
@@ -0,0 +1,117 @@
1
+ // a process's log followed as it grows, for one viewer (pm.ts, GET /api/pm/log): its last lines first, then each
2
+ // write as it lands, as the file's own bytes. One stream a viewer: it watches the file while that viewer reads, and
3
+ // stops the moment the viewer goes (a closed view, a hidden page closes its stream), so nothing is read for nobody.
4
+ // The one constraint a reader breaks first: a log is cut in place when it grows past its cap (supervise.ts capLog),
5
+ // so a size under the place read so far means « cut », never « nothing new »
6
+ import { closeSync, openSync, readSync, statSync, watch, type FSWatcher } from 'fs'
7
+ import { basename, dirname } from 'path'
8
+
9
+ /** the lines a viewer starts from, and the most of the file's end read to find them */
10
+ export const FOLLOW_LINES = 2_000
11
+ export const FOLLOW_LINES_MAX = 10_000
12
+ const TAIL_BYTES = 2 * 1024 * 1024
13
+ /** one read: a burst of output goes out in pieces of this size */
14
+ const PIECE = 256 * 1024
15
+ /** a look at the file with no event behind it: a log made after the viewer came, a write the watch did not say */
16
+ export const FOLLOW_LOOK_MS = 2_000
17
+ /** what a viewer reads where the log was cut: its last lines follow again, since what was written during the cut is
18
+ * among them and nothing says where it starts */
19
+ export const CUT_NOTE = '\n[the log grew past its cap and was cut: its last lines again]\n'
20
+
21
+ /** the logs followed now, by file: what a test and pm's own state read */
22
+ export const followed = new Map<string, number>()
23
+
24
+ const sizeOf = (file: string): number | null => {
25
+ try {
26
+ return statSync(file).size
27
+ } catch {
28
+ return null
29
+ }
30
+ }
31
+
32
+ /** the bytes of `file` from `from` to `to` */
33
+ function bytes(file: string, from: number, to: number): Uint8Array {
34
+ const fd = openSync(file, 'r')
35
+ try {
36
+ const buf = Buffer.alloc(to - from)
37
+ return buf.subarray(0, readSync(fd, buf, 0, to - from, from))
38
+ } finally {
39
+ closeSync(fd)
40
+ }
41
+ }
42
+
43
+ /** where the last `lines` lines of a file of `size` bytes start, a line's first byte */
44
+ export function tailStart(file: string, size: number, lines: number): number {
45
+ const from = Math.max(0, size - TAIL_BYTES)
46
+ const end = bytes(file, from, size)
47
+ // the last byte is the last line's own newline
48
+ let seen = 0
49
+ for (let i = end.length - 2; i >= 0; i--) if (end[i] === 10 && ++seen === lines) return from + i + 1
50
+ // fewer lines than asked: the whole file, or from the first whole line of the part read
51
+ if (from === 0) return 0
52
+ const first = end.indexOf(10)
53
+ return first < 0 ? size : from + first + 1
54
+ }
55
+
56
+ export function followLog(file: string, o: { lines?: number; lookMs?: number } = {}): ReadableStream<Uint8Array> {
57
+ let at = 0
58
+ let watcher: FSWatcher | null = null
59
+ let look: ReturnType<typeof setInterval> | null = null
60
+ let done = false
61
+ const lines = Math.min(o.lines ?? FOLLOW_LINES, FOLLOW_LINES_MAX)
62
+ const stop = (): void => {
63
+ if (done) return
64
+ done = true
65
+ watcher?.close()
66
+ if (look != null) clearInterval(look)
67
+ const n = (followed.get(file) ?? 1) - 1
68
+ if (n <= 0) followed.delete(file)
69
+ else followed.set(file, n)
70
+ }
71
+ return new ReadableStream<Uint8Array>({
72
+ start(ctl) {
73
+ followed.set(file, (followed.get(file) ?? 0) + 1)
74
+ const put = (b: Uint8Array): void => {
75
+ try {
76
+ if (b.length > 0) ctl.enqueue(b)
77
+ } catch {
78
+ stop()
79
+ }
80
+ }
81
+ const pump = (): void => {
82
+ if (done) return
83
+ const size = sizeOf(file)
84
+ if (size == null) return
85
+ if (size < at) {
86
+ put(new TextEncoder().encode(CUT_NOTE))
87
+ try {
88
+ at = size === 0 ? 0 : tailStart(file, size, lines)
89
+ } catch {
90
+ at = size
91
+ }
92
+ }
93
+ try {
94
+ for (; at < size && !done; at = Math.min(size, at + PIECE)) put(bytes(file, at, Math.min(size, at + PIECE)))
95
+ } catch { /* gone between the stat and the read: the next look has it */ }
96
+ }
97
+ const size = sizeOf(file)
98
+ if (size != null && size > 0) {
99
+ try {
100
+ at = tailStart(file, size, lines)
101
+ } catch { /* unreadable now: followed from its end */
102
+ at = size
103
+ }
104
+ }
105
+ pump()
106
+ // the folder is watched: a log that does not exist yet is made in it, and a write to the file says its name
107
+ try {
108
+ watcher = watch(dirname(file), (_e, name) => {
109
+ if (name == null || name === basename(file)) pump()
110
+ })
111
+ watcher.on('error', () => { /* the look below still reads */ })
112
+ } catch { /* no folder yet: the look below finds the log once it is made */ }
113
+ look = setInterval(pump, o.lookMs ?? FOLLOW_LOOK_MS)
114
+ },
115
+ cancel: stop,
116
+ })
117
+ }
@@ -424,7 +424,7 @@ export async function foldNotice(root: string): Promise<string | null> {
424
424
  const mb = folded.reduce((n, s) => n + s.copy!.bytes, 0) / 1e6
425
425
  const key = shortKey()
426
426
  // one line a paragraph or a bullet: the hub renders it as its thread's words
427
- const body = [foldWords().filter((l) => !l.startsWith('the automatic fold')).map((l) => `- ${l}`).join('\n'), `## 1. Look`, 'On the machine whose key is ' + key + ' (`sk db fold` prints it), run `sk time --since 1d` and `sk db`: the agent time index answers, the machine db has three parts.', '## 2. Delete the copies', 'Run `sk db fold --rm-copies` (it says what goes), then `sk db fold --rm-copies --go`. The way back (`sk db fold --back --go`) ends with them.'].join('\n\n')
427
+ const body = [foldWords().filter((l) => !l.startsWith('the automatic fold')).map((l) => `- ${l}`).join('\n'), `## 1. Look`, 'On the machine whose key is ' + key + ' (`sk db fold` prints it), run `sk time --since 1d` and `sk db`: the agent time index answers, the machine db has three parts.', '## 2. Delete the copies', '- Run `sk db fold --rm-copies`: it says what goes.\n- Run `sk db fold --rm-copies --go`.', 'The way back (`sk db fold --back --go`) ends with them.'].join('\n\n')
428
428
  // the machine's key in its title and its check: two machines share the house repo, and each closes only its own
429
429
  const ask = await createAsk(root, `the machine db of machine ${key} folded: delete its ${Math.round(mb)} MB of copies once sure`, {
430
430
  why: `${folded.map((s) => s.store).join(', ')} ${folded.length === 1 ? 'is' : 'are'} tables of the machine db now; the copies of their old files keep the way back`,
@@ -3,9 +3,11 @@
3
3
  //
4
4
  // bun open-app.ts <url> one more shipkit window on a url
5
5
  // bun open-app.ts --process <json> a global process's own app (WrapperOf)
6
+ // bun open-app.ts --project <json> a house repo's own app (ProjectOf: name, root; `hub`: on its hub tab)
6
7
  import { LIB_VERSION } from '../core/lib-version.ts'
7
8
  import type { WrapperOf } from './gui-app.ts'
8
- import { openProcessApp, openWindow } from './home-start.ts'
9
+ import { openProcessApp, openProjectApp, openWindow } from './home-start.ts'
10
+ import type { ProjectOf } from './process-apps.ts'
9
11
 
10
12
  if (import.meta.main) {
11
13
  const [first, second] = process.argv.slice(2)
@@ -15,11 +17,15 @@ if (import.meta.main) {
15
17
  const d = JSON.parse(second) as WrapperOf
16
18
  const cmd = await openProcessApp(d, { version: LIB_VERSION, warn })
17
19
  console.log(`shipkit: opened ${d.id} as its own app: ${cmd.join(' ')}`)
18
- } else if (first != null && first !== '--process') {
20
+ } else if (first === '--project' && second != null) {
21
+ const { hub, ...r } = JSON.parse(second) as ProjectOf & { hub?: boolean }
22
+ const cmd = await openProjectApp(r, { version: LIB_VERSION, hub: hub === true, warn })
23
+ console.log(`shipkit: opened repo ${r.name} as its own app: ${cmd.join(' ')}`)
24
+ } else if (first != null && first !== '--process' && first !== '--project') {
19
25
  const cmd = await openWindow(first, { version: LIB_VERSION, warn })
20
26
  console.log(`shipkit: opened ${first} as an app window: ${cmd.join(' ')}`)
21
27
  } else {
22
- console.error('usage: bun open-app.ts <url> | --process <json>')
28
+ console.error('usage: bun open-app.ts <url> | --process <json> | --project <json>')
23
29
  process.exit(2)
24
30
  }
25
31
  } catch (e) {
@@ -282,7 +282,11 @@ function mtime(f: string): number {
282
282
  }
283
283
 
284
284
  const enc = new TextEncoder()
285
- /** a push stream (review/push.ts) with the page's notices put between its events: one after its hello, one a build */
285
+ /** the event stream of the stores (review/push.ts, GET /api/threads/live) with the page's notices put between its
286
+ * events: one after its hello, one a build. A page reads its build on its socket (serve/page-live.ts); this is for
287
+ * a page whose code reads the event stream, loaded before the socket: the notice is the one thing that makes it
288
+ * reload itself onto the code that opens one. Without it such a page stays open on terminals that never answer.
289
+ * It stays while such a page can exist (a frozen tab, a phone asleep, a second Mac whose web takes this code later) */
286
290
  export function withPageNotices(up: ReadableStream<Uint8Array>, page: { readonly notice: PageNotice | null; on(fn: (n: PageNotice) => void): () => void }): ReadableStream<Uint8Array> {
287
291
  const dec = new TextDecoder()
288
292
  const reader = up.getReader()