rvlib-shipkit 2.31.0 → 2.33.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 (408) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +122 -76
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +20 -221
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +27 -25
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +97 -183
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +261 -87
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Capacity.ts +6 -2
  67. package/src/cli/cmd_Checks.ts +0 -14
  68. package/src/cli/cmd_Ci.ts +2 -1
  69. package/src/cli/cmd_Db.ts +3 -82
  70. package/src/cli/cmd_Home.ts +4 -32
  71. package/src/cli/cmd_Hq.ts +0 -17
  72. package/src/cli/cmd_Releases.ts +57 -4
  73. package/src/cli/cmd_Review.ts +333 -354
  74. package/src/cli/cmd_Shot.ts +26 -4
  75. package/src/cli/cmd_SocialDrafts.ts +6 -13
  76. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  77. package/src/cli/cmd_Time.ts +1 -1
  78. package/src/cli/cmd_Trailer.ts +1 -1
  79. package/src/cli/inbox-hook-run.ts +5 -23
  80. package/src/cli/registry-heads.ts +5 -55
  81. package/src/cli/registry.ts +1 -5
  82. package/src/cli/review-here.ts +1 -1
  83. package/src/cli.ts +15 -4
  84. package/src/collections/collection-types.ts +1 -1
  85. package/src/collections/review.ts +5 -4
  86. package/src/core/admission.ts +268 -0
  87. package/src/core/agent-allow-policy.ts +32 -2
  88. package/src/core/agent-env.ts +8 -0
  89. package/src/core/allow-rows.ts +74 -0
  90. package/src/core/check-file-names.ts +19 -106
  91. package/src/core/code-lines.ts +36 -21
  92. package/src/core/footprint.ts +17 -13
  93. package/src/core/identities-root.ts +1 -4
  94. package/src/core/layout.ts +1 -2
  95. package/src/core/machine-db.ts +33 -208
  96. package/src/core/machine-layout.ts +14 -127
  97. package/src/core/machine-read.ts +5 -2
  98. package/src/core/mask-source.ts +60 -0
  99. package/src/core/memory-watch.ts +17 -14
  100. package/src/core/motherhome.ts +8 -35
  101. package/src/core/one-way-in-policy.ts +0 -3
  102. package/src/core/peer-sk.ts +8 -0
  103. package/src/core/repo-walk.ts +0 -9
  104. package/src/core/retention.ts +1 -9
  105. package/src/core/retired-checks.ts +2 -0
  106. package/src/core/tmux-policy.ts +1 -1
  107. package/src/core/tree-watch.ts +2 -2
  108. package/src/core/when.ts +7 -45
  109. package/src/gate/admit-heavy.ts +150 -0
  110. package/src/gate/check-runner.ts +6 -0
  111. package/src/gate/discover-checks.ts +42 -32
  112. package/src/gate/gate-checks.ts +21 -131
  113. package/src/gate/head-gate.ts +1 -1
  114. package/src/gate/job-run.ts +2 -1
  115. package/src/gate/pre-commit-discovery.ts +22 -28
  116. package/src/gate/run-check.ts +3 -4
  117. package/src/gate/run-ci.ts +4 -0
  118. package/src/gate/run-fix.ts +5 -17
  119. package/src/gate/run-fixers.ts +6 -42
  120. package/src/home/app-sign.ts +2 -2
  121. package/src/home/backup-status.ts +52 -92
  122. package/src/home/backup-verdict.ts +2 -2
  123. package/src/home/daemon-jobs.ts +51 -95
  124. package/src/home/database-words.ts +1 -2
  125. package/src/home/databases.ts +9 -25
  126. package/src/home/home-launchd.ts +0 -6
  127. package/src/home/home-paths.ts +8 -4
  128. package/src/home/home-routes.ts +3 -10
  129. package/src/home/home-state.ts +2 -14
  130. package/src/home/inbox-shape.ts +14 -15
  131. package/src/home/inbox.ts +1 -1
  132. package/src/home/machine-repair.ts +102 -103
  133. package/src/home/resume.ts +1 -15
  134. package/src/home/run-daemon.ts +7 -12
  135. package/src/home/space-page.ts +3 -2
  136. package/src/home/supervise.ts +3 -7
  137. package/src/hooks/commit-msg-run.ts +61 -0
  138. package/src/hooks/commit-run.ts +16 -166
  139. package/src/hooks/gate-outcome.ts +108 -0
  140. package/src/hooks/git-hook.ts +9 -9
  141. package/src/hooks/hook-config.ts +8 -8
  142. package/src/hooks/leak-guard.ts +1 -1
  143. package/src/hooks/pre-commit-checks.ts +1 -1
  144. package/src/hooks/run-hooks.ts +2 -6
  145. package/src/hooks/shared-file.ts +3 -2
  146. package/src/hq/daemon-db.ts +8 -8
  147. package/src/hq/door.ts +3 -16
  148. package/src/hq/hq-db.ts +4 -3
  149. package/src/hq/hq-local.ts +1 -2
  150. package/src/hq/hq-store.ts +0 -15
  151. package/src/hq/item-direct.ts +8 -10
  152. package/src/hq/item-fill.ts +37 -0
  153. package/src/hq/kinds/item-gone.ts +7 -10
  154. package/src/hq/kinds/item-msg.ts +12 -18
  155. package/src/hq/kinds/item.ts +13 -19
  156. package/src/hq/kinds/report.ts +3 -4
  157. package/src/hq/owner-switch.ts +3 -3
  158. package/src/hq/report.ts +5 -9
  159. package/src/hq/switch.ts +2 -11
  160. package/src/hq/thread-sync.ts +5 -17
  161. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  162. package/src/http/owner-word.ts +1 -1
  163. package/src/identities/machine.ts +16 -0
  164. package/src/init-repo.ts +0 -1
  165. package/src/ledger/check-stats.ts +6 -5
  166. package/src/ledger/db.ts +2 -4
  167. package/src/ledger/record-kept.ts +117 -48
  168. package/src/ledger/run-log.ts +21 -2
  169. package/src/ledger/slow-tests.ts +96 -0
  170. package/src/ledger/store.ts +3 -86
  171. package/src/ledger/suite-log.ts +8 -2
  172. package/src/media-store/backup/facts.ts +3 -37
  173. package/src/media-store/backup/keys.ts +1 -8
  174. package/src/media-store/backup/manifest.ts +6 -67
  175. package/src/media-store/backup/restore.ts +4 -13
  176. package/src/media-store/backup/retention.ts +13 -1
  177. package/src/media-store/backup/run.ts +6 -267
  178. package/src/media-store/backup/snapshot.ts +2 -38
  179. package/src/media-store/backup/sources.ts +3 -113
  180. package/src/media-store/backup/target-send.ts +5 -29
  181. package/src/media-store/db.ts +8 -7
  182. package/src/media-store/forget-one.ts +1 -1
  183. package/src/media-store/forget.ts +1 -80
  184. package/src/orchestrator/guards.ts +0 -1
  185. package/src/orchestrator/presence.ts +2 -2
  186. package/src/orchestrator/routes.ts +1 -1
  187. package/src/orchestrator/started.ts +0 -9
  188. package/src/orchestrator/talk-key.ts +3 -4
  189. package/src/orchestrator/unheard.ts +1 -1
  190. package/src/plan/planner.ts +3 -2
  191. package/src/recordings/edit.ts +3 -3
  192. package/src/recordings/marks-draw.ts +17 -6
  193. package/src/recordings/marks.ts +120 -9
  194. package/src/reflections/reflections-queue.ts +3 -10
  195. package/src/release/notes.ts +1 -1
  196. package/src/release/public-clean.ts +66 -6
  197. package/src/release/run-bump.ts +11 -0
  198. package/src/release/run-release.ts +4 -0
  199. package/src/releases/from-thread.ts +3 -3
  200. package/src/releases/model.ts +186 -36
  201. package/src/releases/store.ts +13 -3
  202. package/src/releases/validate.ts +83 -0
  203. package/src/repo-config.ts +36 -64
  204. package/src/review/answer-kinds.ts +63 -4
  205. package/src/review/blocked-guard.ts +11 -0
  206. package/src/review/blocked-object.ts +298 -0
  207. package/src/review/cells.ts +144 -230
  208. package/src/review/close.ts +39 -1
  209. package/src/review/doc-save.ts +3 -2
  210. package/src/review/draft-item.ts +1 -1
  211. package/src/review/events.ts +3 -7
  212. package/src/review/expect.ts +23 -39
  213. package/src/review/format.ts +79 -46
  214. package/src/review/glyphs.ts +1 -0
  215. package/src/review/hand-over.ts +3 -3
  216. package/src/review/heard.ts +1 -1
  217. package/src/review/holds-sync.ts +2 -1
  218. package/src/review/inbox-hook.ts +2 -2
  219. package/src/review/inbox-read.ts +39 -33
  220. package/src/review/instruction-guards.ts +12 -0
  221. package/src/review/instructions.ts +0 -1
  222. package/src/review/item-db.ts +13 -43
  223. package/src/review/item-hq.ts +2 -2
  224. package/src/review/item-rows.ts +3 -14
  225. package/src/review/kind-catalog.ts +3 -1
  226. package/src/review/kinds.ts +18 -8
  227. package/src/review/live-view.ts +3 -0
  228. package/src/review/media-kind.ts +1 -1
  229. package/src/review/mentions.ts +1 -2
  230. package/src/review/model.ts +158 -114
  231. package/src/review/move.ts +149 -0
  232. package/src/review/need-threads.ts +3 -2
  233. package/src/review/object-card.ts +11 -0
  234. package/src/review/object-read.ts +6 -1
  235. package/src/review/one-block.ts +1 -1
  236. package/src/review/owner-read.ts +1 -1
  237. package/src/review/phone-push.ts +10 -9
  238. package/src/review/previews.ts +32 -4
  239. package/src/review/push.ts +2 -2
  240. package/src/review/recap.ts +129 -0
  241. package/src/review/referring.ts +6 -3
  242. package/src/review/reflection-object.ts +4 -3
  243. package/src/review/routes.ts +51 -47
  244. package/src/review/secret-route.ts +3 -2
  245. package/src/review/settle.ts +0 -6
  246. package/src/review/snooze.ts +5 -3
  247. package/src/review/speaker.ts +68 -0
  248. package/src/review/start-title.ts +19 -0
  249. package/src/review/store-parties.ts +28 -0
  250. package/src/review/store.ts +94 -59
  251. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  252. package/src/review/thread-md.ts +35 -14
  253. package/src/review/thread-state.ts +804 -0
  254. package/src/review/threads.ts +29 -347
  255. package/src/review/traces.ts +104 -7
  256. package/src/review/trailer-item.ts +1 -1
  257. package/src/review/unit.ts +7 -9
  258. package/src/review/verdict-items.ts +12 -10
  259. package/src/review/view-layout.ts +25 -1
  260. package/src/review/watch-feed.ts +1 -2
  261. package/src/review/working-guards.ts +2 -3
  262. package/src/rules/untrack-generated.ts +1 -15
  263. package/src/secrets/copy.ts +4 -4
  264. package/src/secrets/lapse.ts +2 -1
  265. package/src/serve/hub-app/advisor-app.tsx +4 -4
  266. package/src/serve/hub-app/advisor-face.tsx +9 -3
  267. package/src/serve/hub-app/advisor-host.ts +27 -27
  268. package/src/serve/hub-app/advisors-model.ts +17 -8
  269. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  270. package/src/serve/hub-app/advisors-st.ts +15 -14
  271. package/src/serve/hub-app/advisors-view.tsx +13 -11
  272. package/src/serve/hub-app/app-bridge.ts +23 -3
  273. package/src/serve/hub-app/asks-page.tsx +1 -1
  274. package/src/serve/hub-app/auto-text.tsx +71 -16
  275. package/src/serve/hub-app/check-view.tsx +0 -8
  276. package/src/serve/hub-app/controls.css +14 -3
  277. package/src/serve/hub-app/database-view.tsx +1 -2
  278. package/src/serve/hub-app/dock-st.ts +1 -1
  279. package/src/serve/hub-app/git-view.tsx +3 -1
  280. package/src/serve/hub-app/hub.css +12 -5
  281. package/src/serve/hub-app/icons.tsx +1 -1
  282. package/src/serve/hub-app/inbox-view.tsx +1 -2
  283. package/src/serve/hub-app/live-sources.ts +2 -2
  284. package/src/serve/hub-app/main-panel.tsx +2 -1
  285. package/src/serve/hub-app/panel-repo.ts +0 -9
  286. package/src/serve/hub-app/pic.tsx +29 -12
  287. package/src/serve/hub-app/polled.ts +16 -2
  288. package/src/serve/hub-app/recordings-st.ts +23 -2
  289. package/src/serve/hub-app/recordings-view.tsx +68 -10
  290. package/src/serve/hub-app/ref-pill.ts +1 -1
  291. package/src/serve/hub-app/repo-st.ts +1 -2
  292. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  293. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  294. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  295. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  296. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  297. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  298. package/src/serve/hub-app/review/kit.tsx +4 -11
  299. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  300. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  301. package/src/serve/hub-app/review/line-window.ts +4 -1
  302. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  303. package/src/serve/hub-app/review/live-view.tsx +57 -1
  304. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  305. package/src/serve/hub-app/review/question-views.tsx +191 -53
  306. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  307. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  308. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  309. package/src/serve/hub-app/review/review-host.ts +8 -4
  310. package/src/serve/hub-app/review/review-kit.ts +17 -11
  311. package/src/serve/hub-app/review/review-list.tsx +30 -35
  312. package/src/serve/hub-app/review/review-st.ts +32 -42
  313. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  314. package/src/serve/hub-app/review/review-views.tsx +127 -68
  315. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  316. package/src/serve/hub-app/review/start-st.ts +2 -5
  317. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  318. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  319. package/src/serve/hub-app/review/thread-st.ts +381 -202
  320. package/src/serve/hub-app/review/tone-bar.tsx +129 -0
  321. package/src/serve/hub-app/review/tones.ts +53 -0
  322. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  323. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  324. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  325. package/src/serve/hub-app/review.css +189 -106
  326. package/src/serve/hub-app/search-view.tsx +1 -1
  327. package/src/serve/hub-app/social/social-model.ts +0 -4
  328. package/src/serve/hub-app/source-acts.ts +2 -1
  329. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  330. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  331. package/src/serve/hub-app/thread-row.tsx +3 -4
  332. package/src/serve/hub-app/tree-build.ts +0 -4
  333. package/src/serve/hub-app/urls-view.tsx +2 -1
  334. package/src/serve/hub-app/view-layout.css +13 -3
  335. package/src/serve/hub-app/wikis-view.tsx +5 -2
  336. package/src/serve/hub-runtime.ts +7 -37
  337. package/src/serve/project-gutter-route.ts +6 -2
  338. package/src/serve/read-thread.ts +20 -2
  339. package/src/serve/read-worker.ts +9 -1
  340. package/src/serve/record-pages.ts +46 -0
  341. package/src/serve/serve-hub.ts +2 -2
  342. package/src/serve/terminal-host.ts +1 -1
  343. package/src/serve/terminal-route.ts +1 -3
  344. package/src/serve/tracked-watch.ts +1 -3
  345. package/src/setup-house.ts +2 -2
  346. package/src/shipkit-files.ts +1 -1
  347. package/src/shipkit.ts +1 -6
  348. package/src/shot/client.ts +2 -1
  349. package/src/shot/film-box.ts +0 -20
  350. package/src/shot/on-place.ts +141 -0
  351. package/src/social/drafts.ts +1 -1
  352. package/src/social/kinds.ts +6 -29
  353. package/src/social/load.ts +2 -2
  354. package/src/social/post-object.ts +3 -2
  355. package/src/social/release-stage.ts +1 -1
  356. package/src/social/stage.ts +2 -2
  357. package/src/stores/model.ts +4 -0
  358. package/src/stores/routes.ts +11 -3
  359. package/src/suite/judge-suites.ts +58 -0
  360. package/src/suite/red-alone.ts +54 -18
  361. package/src/suite/runner-shapes.ts +2 -2
  362. package/src/suite/suite-cli.ts +67 -14
  363. package/src/suite/test-units.ts +2 -1
  364. package/src/urls/fill.ts +1 -1
  365. package/src/urls/places.ts +1 -2
  366. package/src/vault/vault-config.ts +2 -2
  367. package/src/vault/vault-init.ts +1 -5
  368. package/src/wiki/graph-page.ts +14 -2
  369. package/src/advisors/copy-truth.ts +0 -49
  370. package/src/advisors/door-child.ts +0 -112
  371. package/src/advisors/door-serve.ts +0 -52
  372. package/src/advisors/door.ts +0 -118
  373. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  374. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  375. package/src/checks/SK048-one-local-file.check.ts +0 -36
  376. package/src/core/config-rewrite.ts +0 -111
  377. package/src/core/daemon-port.ts +0 -10
  378. package/src/core/legacy-shapes.ts +0 -263
  379. package/src/core/migrate-layout.ts +0 -638
  380. package/src/core/port-check-cli.ts +0 -52
  381. package/src/core/port-check-file.ts +0 -295
  382. package/src/core/port-check-files.ts +0 -31
  383. package/src/gate/discover-legacy-checks.ts +0 -26
  384. package/src/home/home-move.ts +0 -527
  385. package/src/home/machine-fold.ts +0 -810
  386. package/src/hq/item-shapes.ts +0 -54
  387. package/src/hq/kinds/items-read.ts +0 -4
  388. package/src/media-store/backup/daemon.ts +0 -220
  389. package/src/media-store/backup/kept.ts +0 -241
  390. package/src/media-store/backup/prune.ts +0 -359
  391. package/src/media-store/backup/secret.ts +0 -88
  392. package/src/media-store/backup/ssh-space.ts +0 -202
  393. package/src/media-store/backup/watch.ts +0 -117
  394. package/src/review/band.ts +0 -182
  395. package/src/review/folders.ts +0 -216
  396. package/src/review/hook-ask.ts +0 -58
  397. package/src/review/role.ts +0 -48
  398. package/src/review/thread-fold.ts +0 -64
  399. package/src/review/wait.ts +0 -91
  400. package/src/rules/rule.ts +0 -43
  401. package/src/serve/hook-thread.ts +0 -37
  402. package/src/serve/hook-work.ts +0 -92
  403. package/src/serve/hook-worker.ts +0 -57
  404. package/src/serve/hub-app/review/dock.tsx +0 -147
  405. package/src/serve/hub-app/review/faces.tsx +0 -18
  406. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  407. package/src/serve/hub-app/review/review-board.tsx +0 -48
  408. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,8 +1,9 @@
1
1
  // the advisors' state on the Mac (wiki tools/shipkit/advisors.md): the people (profiles that grant nothing), the grants
2
- // (a thread's share, a project's access), the rights over layers, the images he confirmed for each person, the advice
3
- // and the threads they propose, waiting for him. What waits lives here alone, never in a thread store: no agent's inbox,
4
- // watch or hook reads this file. One json file under a lock, written beside and renamed; an older version moves up at
5
- // its first read, the old file kept beside as `owner.json.before-v<n>`; the bucket gets only what the sync pushes
2
+ // (a thread's share, a project's access), the rights over layers, the images the owner confirmed for each person, the
3
+ // advice and the threads they propose, waiting for the owner. What waits lives here alone, never in a thread store: no
4
+ // agent's inbox, watch or hook reads this file. One json file under a lock, written beside and renamed; an older
5
+ // version moves up at its first read, the old file kept beside as `owner.json.before-v<n>`; the users' port reads it at
6
+ // each request and writes it only where a person's act lands (advice.ts, users-store.ts markSpent)
6
7
  import { createHash } from 'node:crypto'
7
8
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from 'node:fs'
8
9
  import { join } from 'node:path'
@@ -30,19 +31,42 @@ export interface Advisor {
30
31
  lastInvited?: string
31
32
  /** the last try that did not go, kept until one goes */
32
33
  inviteFailed?: { at: string; why: string }
33
- /** their sign in at the door (advisors/login.ts), minted with their first live grant */
34
+ /** their sign in on the advisors page (advisors/login.ts), minted with their first live grant */
34
35
  login?: Login
36
+ /** the password resets they asked, the newest last, the last RESETS_KEPT: his hub's line on them */
37
+ resets?: ResetAsked[]
35
38
  }
36
39
 
40
+ export const RESETS_KEPT = 5
41
+
37
42
  /** a person's sign in: its generation (a new code is the next one, which ends the password and the sessions of the
38
- * last), the one time code the invite carries (the door holds its hash), until when it works, and whether the door
39
- * says it set a password */
43
+ * last), the one time code the invite carries (the sign in reads its hash), until when it works, and whether the users'
44
+ * port says it set a password */
40
45
  export interface Login {
41
46
  gen: number
42
47
  code: string
43
48
  codeUntil: string
44
49
  at: string
45
50
  used?: true
51
+ /** the next generation a reset the person asked parks here, its code for 30 minutes (login.ts parkReset): it
52
+ * becomes the login once its code signs in, so a stranger who asks one ends nothing */
53
+ reset?: Omit<Login, 'reset'>
54
+ }
55
+
56
+ /** a reset the person asked at the sign in: when, when its mail left (marked before it leaves, so one pass sends it),
57
+ * or why it did not go */
58
+ export interface ResetAsked {
59
+ at: string
60
+ sent?: string
61
+ why?: string
62
+ }
63
+
64
+ /** a reset whose mail waits: the newest ask, no mail tried yet, a code parked and live (a new one, or the one an earlier
65
+ * ask mailed, sent again) */
66
+ export const resetWaits = (a: Advisor, now: Date): boolean => {
67
+ const r = a.resets?.at(-1)
68
+ const p = a.login?.reset
69
+ return r !== undefined && p !== undefined && r.sent === undefined && r.why === undefined && Date.parse(p.codeUntil) > now.getTime()
46
70
  }
47
71
 
48
72
  /** a profile photo: the hash of its 64 px webp (the bucket's key, the hub's cache key) and when it was set */
@@ -103,19 +127,20 @@ export interface Share {
103
127
  deferred: boolean
104
128
  include: Record<string, Include>
105
129
  revoked?: string
106
- /** what an older scan held back and the pictures it kept for his eyes: never written now, dropped at the next pass */
130
+ /** fields no pass writes: each pass drops them */
107
131
  held?: Held[]
108
132
  waiting?: ImageWait[]
109
133
  /** the entries the last pass sent with strings masked (a credential, a secret's name, a private word) */
110
134
  masked?: Masked[]
111
- /** the thread's versions as the last sync counted them, and how many of them the person sees */
135
+ /** the thread's versions as the last pass counted them, and how many of them the person sees */
112
136
  parts?: { versions: number; shown: number }
113
- /** the last push of this share to the bucket */
137
+ /** the last pass's word on this share: whether it reaches its person, else why */
114
138
  reach?: { ok: boolean; at: string; why?: string }
115
- /** the hash of the copy last pushed: an unchanged one is not written again */
139
+ /** the hash of the share's view and manifest at the last pass that prepared it: set once it reached its person
140
+ * (share-trace.ts) */
116
141
  pushed?: string
117
- /** where the person's reading stands, as the door wrote it: when, up to which time of the copy, and whether that
118
- * covers his newest word (his hub then reads « seen by <name> », as for an agent) */
142
+ /** where the person's reading stands, as the users' port wrote it and the pass pulled it: when, up to which time of
143
+ * the view, and whether that covers the owner's newest word (the owner's hub then reads « seen by <name> », as for an agent) */
119
144
  read?: ShareRead
120
145
  }
121
146
 
@@ -149,7 +174,7 @@ export interface Advice {
149
174
  option?: number
150
175
  qhash?: string
151
176
  text?: string
152
- /** the inbox entry it came in (`<ms>-<random>`): its files wait under it */
177
+ /** the entry it came in (`<ms>-<random>`): its files wait under it */
153
178
  entry?: string
154
179
  files?: PendingFile[]
155
180
  state: AdviceState
@@ -167,7 +192,7 @@ export interface Proposal {
167
192
  advisor: string
168
193
  repo: string
169
194
  root: string
170
- /** the door's id it came by (startPlacesOf), and its inbox entry: its files wait under `upload/p/<propose>/<entry>/` */
195
+ /** the start place's id it came by (startPlacesOf), and its entry: its files wait under `upload/p/<propose>/<entry>/` */
171
196
  propose: string
172
197
  entry: string
173
198
  at: string
@@ -187,7 +212,7 @@ export interface OwnerState {
187
212
  v: typeof STATE_VERSION
188
213
  /** the id of the identity the house speaks as, kept by the pass: the name advisors read when he set none */
189
214
  owner: string
190
- /** the door's host once it exists (`advisors.<domain>`) */
215
+ /** the advisors page's host once it is set up (`advisors.<domain>`) */
191
216
  host: string | null
192
217
  /** the people: profiles, his and the ones an agent prepared */
193
218
  advisors: Advisor[]
@@ -215,7 +240,7 @@ export interface SetupRun {
215
240
  /** the last mark a pass looked at: the setup token written after it starts a run; an agent's refusal leaves it.
216
241
  * Absent from a run older than the rule: its `mark` stands for it */
217
242
  seen?: number
218
- /** his « set the door up now » on the advisors page started it */
243
+ /** the owner's « set the advisors page up now » on the advisors page started it */
219
244
  asked?: true
220
245
  at: string
221
246
  state: 'running' | 'done' | 'failed'
@@ -237,8 +262,6 @@ export interface OwnerNames {
237
262
  export const EMPTY: OwnerState = { v: STATE_VERSION, owner: 'the owner', host: null, advisors: [], shares: [], access: [], rights: [], advice: [], proposals: [], images: {} }
238
263
 
239
264
  /** the folder of the advisors' state: SHIPKIT_ADVISORS_DIR, else the machine's `~/.shipkit/advisors` */
240
- /** the door's folder: what its server reads, beside the advisors' state */
241
- export const doorDir = (dir = advisorsDir()): string => join(dir, 'door')
242
265
  export const advisorsDir = (): string => process.env.SHIPKIT_ADVISORS_DIR?.trim() || machinePath('advisors')
243
266
 
244
267
  const fileOf = (dir: string): string => join(dir, 'owner.json')
@@ -372,7 +395,7 @@ export interface StartPlace {
372
395
  }
373
396
 
374
397
  /** where each person may start a thread: `startThreads` resolves per person and project, on a project they have, that
375
- * is a live access there, else a live share there. An access's door is its id; a share's is derived from the oldest
398
+ * is a live access there, else a live share there. An access's place is its id; a share's is derived from the oldest
376
399
  * live one, so it holds while that share does and ends with the last */
377
400
  export function startPlacesOf(s: OwnerState, now: Date): StartPlace[] {
378
401
  const out = new Map<string, StartPlace>()
@@ -387,8 +410,9 @@ export function startPlacesOf(s: OwnerState, now: Date): StartPlace[] {
387
410
  return [...out.values()]
388
411
  }
389
412
 
390
- /** the shares the door lets in now: live (his share, or an agent's he confirmed, not ended, not expired) and of a person
391
- * who still has a profile. The sync serves these alone (advisors/sync.ts), so the door's route opens exactly these */
413
+ /** the shares the users' port lets in now: live (the owner's share, or an agent's the owner confirmed, not ended, not
414
+ * expired) and of a person who still has a profile. The port serves these alone (users-router.ts callerOf), so its
415
+ * routes open exactly these */
392
416
  export const servedShares = (s: OwnerState, now: Date): Share[] => s.shares.filter((x) => isLive(x, now) && s.advisors.some((a) => a.id === x.advisor))
393
417
 
394
418
  /** who can open one thread now, by person id: the people of its served shares */
@@ -1,6 +1,6 @@
1
- // a person's profile photo (wiki tools/shipkit/advisors.md, A face for each person): one square picture re-encoded to two webps, 256 px for the hub and 64 px for the small faces and the
2
- // door, kept in `photos/` beside owner.json, never in git. Setting one grants nothing: it reaches the advisor's own page
3
- // alone, through the bucket sync (sync.ts), and the owner's hub
1
+ // a person's profile photo (wiki tools/shipkit/advisors.md, A face for each advisor): one square picture re-encoded to two webps, 256 px for the hub and 64 px for the small faces and the
2
+ // advisors page, kept in `photos/` beside owner.json, never in git. Setting one grants nothing: it reaches the advisor's
3
+ // own page alone, through the users' port (users-router.ts, `/api/advisor/photo`), and the owner's hub
4
4
  // the one constraint a reader breaks first: every byte that becomes a photo passes `squareWebps` (a picture by its first
5
5
  // bytes, its pixels capped, its metadata dropped); a url is https, an image type and a size cap before a byte is kept
6
6
  import { createHash } from 'node:crypto'
@@ -1,10 +1,10 @@
1
1
  // what an advisor sees of a thread (wiki tools/shipkit/advisors.md, What the advisor sees): a projection to the hub's own
2
- // items by a WHITELIST of fields, every part of a thread he shared going out, a credential, a secret's name and his
3
- // private words masked in place. Pure: the sync names each picture and runs the hub's builders on the result
4
- // (advisor-view.ts)
5
- // the one constraint a reader breaks first: a field of the store reaches the copy only when this file names it
2
+ // items by a WHITELIST of fields, every part of a thread the owner shared going out, a credential, a secret's name and
3
+ // the owner's private words masked in place. Pure: sync.ts prepare names each picture and runs the hub's builders on
4
+ // the result (advisor-view.ts)
5
+ // the one constraint a reader breaks first: a field of the store reaches the view only when this file names it
6
6
  import { createHash } from 'node:crypto'
7
- import { isGallery, partyOf, type Item, type Message, type ReviewItem, type ReviewView } from '../review/model.ts'
7
+ import { isGallery, partyOf, STATUSES, type Item, type Message, type ReviewItem, type ReviewView } from '../review/model.ts'
8
8
  import { membersOf, threadTitle, type Thread } from '../review/threads.ts'
9
9
  import { mask, maskHits, type HitKind, type ScanContext } from './scan.ts'
10
10
 
@@ -35,7 +35,7 @@ export interface Masked {
35
35
  title?: string
36
36
  }
37
37
 
38
- /** an entry an older scan held back, as a share may still carry it: never written again, dropped at the next pass */
38
+ /** an entry of the stale `held` field a share may carry: no pass writes it, each pass drops it */
39
39
  export interface Held {
40
40
  key: string
41
41
  hash: string
@@ -46,7 +46,7 @@ export interface Held {
46
46
 
47
47
  const PICTURE = /\.(png|jpe?g|webp)$/i
48
48
 
49
- const VERDICTS = new Set(['approved', 'approved-with-fix', 'rejected', 'archived'])
49
+ const VERDICTS = new Set<string>(STATUSES)
50
50
 
51
51
  /** a message's files of a view: an image, or a pair; a clip, a sound and a gallery's other kinds never leave */
52
52
  function viewFiles(v: ReviewView): string[] {
@@ -89,16 +89,16 @@ function passes(m: Message): boolean {
89
89
 
90
90
  // ── the projection as the hub's own items: the advisor's page draws them with the hub's builders and components ──
91
91
 
92
- /** a store id as the share's copy names it: the share's id, then a hash of the store's id. The advisor never reads a
93
- * store id, and the door finds the share of any id by its prefix */
92
+ /** a store id as the share's view names it: the share's id, then a hash of the store's id. The advisor never reads a
93
+ * store id, and the users' port finds the share of any id by its prefix */
94
94
  export const opaqueItem = (share: string, id: string): string => `${share}.${createHash('sha256').update(`${share}|${id}`).digest('hex').slice(0, 12)}`
95
95
  export const opaqueMessage = (share: string, id: string): string => `m${createHash('sha256').update(`${share}|m|${id}`).digest('hex').slice(0, 12)}`
96
- /** the one address every item of the copy is on: its notes join its versions as they do in the store */
96
+ /** the one address every item of the view is on: its notes join its versions as they do in the store */
97
97
  export const sharedAddress = (share: string): string => `shared:${share}`
98
98
 
99
99
  export interface ItemsInput extends Pick<ProjectInput, 'thread' | 'answers' | 'scan' | 'include'> {
100
100
  share: string
101
- /** the advisor the copy is for: the owner's words that name them read « asks you » there, shown even when the other answers are not */
101
+ /** the advisor the view is for: the owner's words that name them read « asks you » there, shown even when the other answers are not */
102
102
  advisor?: string
103
103
  /** a picture of the thread as the advisor gets it: its served name, null when it does not leave (his eyes first, a
104
104
  * file gone, a clip or a sound) */
@@ -107,21 +107,21 @@ export interface ItemsInput extends Pick<ProjectInput, 'thread' | 'answers' | 's
107
107
 
108
108
  export interface ProjectedItems {
109
109
  items: ReviewItem[]
110
- /** the head of the thread, as the copy names it */
110
+ /** the head of the thread, as the view names it */
111
111
  head: string
112
112
  /** the entries that went out with strings masked */
113
113
  masked: Masked[]
114
- /** each id of the copy and the store's id it stands for: an advice names the copy's */
114
+ /** each id of the view and the store's id it stands for: an advice names the view's */
115
115
  ids: Map<string, string>
116
- /** the thread's title as the copy may say it: its kept head's, else its own when the scan passes it, else neutral;
117
- * never the title of an older version that happened to pass */
116
+ /** the thread's name as the owner's hub says it (review/threads.ts threadTitle), its hits masked: one name on both
117
+ * sides, never a version's own caption */
118
118
  title: string
119
- /** each version of the copy by its id and the thread's own number of it: v3 reads « v3 » whatever the copy holds before it */
119
+ /** each version of the view by its id and the thread's own number of it: v3 reads « v3 » whatever the view holds before it */
120
120
  numbers: Map<string, number>
121
- /** the thread's versions, and how many of them the copy shows */
121
+ /** the thread's versions, and how many of them the view shows */
122
122
  versions: number
123
123
  shown: number
124
- /** whether the thread's newest version is in the copy: when not, the copy's head is an older one */
124
+ /** whether the thread's newest version is in the view: when not, the view's head is an older one */
125
125
  headKept: boolean
126
126
  }
127
127
 
@@ -163,7 +163,7 @@ export function projectItems(input: ItemsInput): ProjectedItems {
163
163
  const numbers = new Map<string, number>()
164
164
  const kept = new Set<string>()
165
165
  const items: ReviewItem[] = []
166
- /** the nearest version this one follows that the copy keeps */
166
+ /** the nearest version this one follows that the view keeps */
167
167
  const keptAncestor = (id: string | undefined): string | undefined => {
168
168
  for (let at = id; at !== undefined; at = byId.get(at)?.item.supersedes) if (kept.has(at)) return opaqueItem(share, at)
169
169
  return undefined
@@ -217,7 +217,7 @@ export function projectItems(input: ItemsInput): ProjectedItems {
217
217
  const headKept = kept.has(headId)
218
218
  const head = headKept ? opaqueItem(share, headId) : (items.at(-1)?.item.id ?? opaqueItem(share, headId))
219
219
  const own = threadTitle(input.thread)
220
- const title = headKept ? (items.find((x) => x.item.id === head)?.item.title ?? own) : mask(own, maskHits(own, input.scan))
220
+ const title = mask(own, maskHits(own, input.scan))
221
221
  const shown = input.thread.versions.filter((x) => kept.has(x.item.id)).length
222
222
  return { items, head, masked, ids, title, numbers, versions: input.thread.versions.length, shown, headKept }
223
223
  }
@@ -239,7 +239,7 @@ function projectItemMessages(x: ReviewItem, input: ItemsInput, masked: Masked[],
239
239
  left.add(m.id)
240
240
  out.push(built)
241
241
  }
242
- // the person's own words in the store: their copy draws them from their advice (sync.ts), and a read of them is theirs
242
+ // the person's own words in the store: their view draws them from their advice (sync.ts), and a read of them is theirs
243
243
  const own = new Set(x.thread.filter((m) => m.who === 'player' && input.advisor !== undefined && m.advisor?.id === input.advisor).map((m) => m.id))
244
244
  for (const m of x.thread) {
245
245
  const act = agentAct(m, input, left, own, (id) => (own.has(id) ? opaqueMessage(share, id) : mid(id)), masked, of)
@@ -247,8 +247,8 @@ function projectItemMessages(x: ReviewItem, input: ItemsInput, masked: Masked[],
247
247
  if (act !== null) push(m, act)
248
248
  continue
249
249
  }
250
- // a player's report is a stranger's words: never under his name at the door, and never shared on
251
- // their own pick is the question's answer, their own verdict the version's: it leaves, so their copy draws it
250
+ // a player's report is a stranger's words: never under the owner's name on the advisors page, and never shared on
251
+ // their own pick is the question's answer, their own verdict the version's: it leaves, so their view draws it
252
252
  const ownPick = own.has(m.id) && m.answer !== undefined
253
253
  const ownVerdict = own.has(m.id) && m.verdict !== undefined && VERDICTS.has(m.verdict)
254
254
  if (!passes(m) || (m.who === 'player' && !ownPick && !ownVerdict)) continue
@@ -259,6 +259,7 @@ function projectItemMessages(x: ReviewItem, input: ItemsInput, masked: Masked[],
259
259
  if (labels === undefined || replaced.has(m.id)) continue
260
260
  const fields: Record<string, string | undefined> = { text: m.text ?? '' }
261
261
  labels.forEach((l, i) => (fields[`o${i}`] = l))
262
+ if (m.ask.row !== undefined) fields.row = m.ask.row.label
262
263
  push(m, gate(m.id, fields, (f): Message => ({
263
264
  ...base,
264
265
  ...(m.op !== undefined ? { op: m.op } : {}),
@@ -267,6 +268,7 @@ function projectItemMessages(x: ReviewItem, input: ItemsInput, masked: Masked[],
267
268
  options: labels.map((_, i) => f[`o${i}`] ?? ''),
268
269
  ...(m.ask!.pick !== undefined ? { pick: m.ask!.pick } : {}),
269
270
  ...(m.ask!.views !== undefined ? { views: m.ask!.views.map((v) => (v === null ? null : (viewMap.get(v) ?? null))) } : {}),
271
+ ...(m.ask!.row !== undefined ? { row: { ...m.ask!.row, label: f.row ?? '' } } : {}),
270
272
  },
271
273
  ...(m.asksVerdict === true ? { asksVerdict: true as const } : {}),
272
274
  }), { input, masked, where: 'message', of }))
@@ -332,7 +334,7 @@ function projectItemMessages(x: ReviewItem, input: ItemsInput, masked: Masked[],
332
334
 
333
335
  /** an agent's act the hub draws as a trace line between the words (review/traces.ts): a read of words that left or of
334
336
  * the person's own, its « on it » line masked like any agent word, a take with nothing of its own. `undefined`: not
335
- * such an act; `null`: one that leaves nothing (no other answers shown, a read of nothing the copy holds) */
337
+ * such an act; `null`: one that leaves nothing (no other answers shown, a read of nothing the view holds) */
336
338
  function agentAct(m: Message, input: ItemsInput, left: ReadonlySet<string>, own: ReadonlySet<string>, idOf: (id: string) => string, masked: Masked[], of: { n?: number; title: string }): Message | null | undefined {
337
339
  if (partyOf(m.who) !== 'agent' || (m.op !== 'seen' && m.op !== 'working' && m.op !== 'take')) return undefined
338
340
  if (!input.answers) return null
@@ -343,7 +345,7 @@ function agentAct(m: Message, input: ItemsInput, left: ReadonlySet<string>, own:
343
345
  return read.length === 0 ? null : { ...base, op: 'seen', of: read.map(idOf) }
344
346
  }
345
347
 
346
- /** every picture of the thread the copy may name, where it is: each view's image, pair or gallery tile, each message's
348
+ /** every picture of the thread the view may name, where it is: each view's image, pair or gallery tile, each message's
347
349
  * picture; clips and sounds never */
348
350
  export function picturesOf(thread: Thread): { itemId: string; name: string; of: 'view' | 'message' }[] {
349
351
  const out: { itemId: string; name: string; of: 'view' | 'message' }[] = []
@@ -0,0 +1,89 @@
1
+ // the reach of the advisors page as the owner's hub reads it (wiki tools/shipkit/advisors.md, Who calls: the
2
+ // users' port): its name, the name the house config gives it, and in one line whether advisors reach this Mac now (set up,
3
+ // this Mac carries the hq, the tunnel's token stored, the users' port answers). Never a value of a secret: its presence only
4
+ import { hostname } from 'node:os'
5
+ import { heldHere } from '../secrets/read.ts'
6
+ import { ownAddressOf } from '../review/model.ts'
7
+ import { readAll, storeDir } from '../review/store.ts'
8
+ import { threadsOf } from '../review/threads.ts'
9
+ import { houseHost } from './speaks.ts'
10
+ import { usersPort } from './users-store.ts'
11
+ import type { SetupRun } from './owner-store.ts'
12
+
13
+ // sk-disable-next-line RV045 -- the tunnel's runner reads the house's own tunnel token by this name
14
+ export const TUNNEL_TOKEN = 'rv/cloudflare/advisors-tunnel'
15
+
16
+ export interface ReachFacts {
17
+ /** the advisors page's name once the owner's setup ran, null before */
18
+ host: string | null
19
+ /** the name it opens at: the house config's `serve.advisorsHost`, else the one set up */
20
+ want: string | null
21
+ /** advisors reach this Mac now */
22
+ ok: boolean
23
+ /** the reach in one line: « advisors reach <mac> at <host> », or what is wrong */
24
+ words: string
25
+ /** the ask that opens the advisors page, its thread in the house */
26
+ ask: { repo: string; head: string; address: string } | null
27
+ /** what his terminal runs to set it up */
28
+ command: string | null
29
+ /** the setup the daemon runs by itself once his token landed (setup-run.ts): while it runs, after it failed, or for
30
+ * an hour after it ended */
31
+ run?: SetupRun | null
32
+ }
33
+
34
+ const RUN_SHOWN_MS = 3_600_000
35
+ /** the setup run the foot shows, null once it ended well over an hour ago */
36
+ export const shownRun = (r: SetupRun | undefined, now: Date): SetupRun | null =>
37
+ r === undefined || (r.state === 'done' && now.getTime() - Date.parse(r.ended ?? r.at) > RUN_SHOWN_MS) || (r.state === 'done' && r.lines.length === 0) ? null : r
38
+
39
+ /** the ask's address: `ask:<n>-open-the-advisors-door` */
40
+ export const SETUP_ASK = /^ask:\d+-open-the-advisors-door$/
41
+
42
+ const HOST_RE = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/
43
+
44
+ export const exposeCommand = (host: string): string | null => (HOST_RE.test(host) ? `sk advisors expose --host ${host}` : null)
45
+
46
+ /** what the line reads; each the real one by default, a test passes its own */
47
+ export interface ReachLooks {
48
+ carries?: () => boolean
49
+ tunnel?: () => Promise<'stored' | 'missing' | 'unknown'>
50
+ serves?: (host: string) => Promise<boolean>
51
+ }
52
+
53
+ /** the users' port answers its own name on this Mac */
54
+ async function serves(host: string): Promise<boolean> {
55
+ try {
56
+ const r = await fetch(`http://127.0.0.1:${usersPort()}/health`, { headers: { host }, signal: AbortSignal.timeout(500) })
57
+ return r.ok
58
+ } catch {
59
+ return false
60
+ }
61
+ }
62
+
63
+ /** the reach in one line, worst first */
64
+ export async function reachLine(host: string | null, house: string, l: ReachLooks = {}): Promise<{ ok: boolean; words: string }> {
65
+ // the page names the ask, never a command: the ask's steps hold the one run in his terminal
66
+ if (host === null) return { ok: false, words: 'not set up yet: the ask that opens the advisors page' }
67
+ const carries = l.carries ?? (await import('../hq/hq-role.ts')).carriesHq
68
+ if (!carries()) return { ok: false, words: `the advisors page runs on the Mac that carries the hq, not this one` }
69
+ const tunnel = await (l.tunnel ?? (async () => (await heldHere({ names: [TUNNEL_TOKEN], cwd: house }))[TUNNEL_TOKEN]?.held ?? 'unknown'))().catch(() => 'unknown' as const)
70
+ if (tunnel === 'missing') return { ok: false, words: "the tunnel's token is not stored: the ask that opens the advisors page" }
71
+ if (!(await (l.serves ?? serves)(host))) return { ok: false, words: "the advisors page's server does not answer on this Mac: the daemon starts it" }
72
+ return { ok: true, words: `advisors reach ${hostname().replace(/\.local$/, '')} at ${host}` }
73
+ }
74
+
75
+ export async function reachFacts(o: { house: string; houseRepo: string | null; host: string | null; looks?: ReachLooks }): Promise<ReachFacts> {
76
+ // the house config's name, else the name set up, or none
77
+ const want = (await houseHost(o.house)) ?? o.host
78
+ let ask: ReachFacts['ask'] = null
79
+ try {
80
+ for (const t of threadsOf(readAll(storeDir(o.house)).items)) {
81
+ const address = ownAddressOf(t.head.item)
82
+ if (address !== null && SETUP_ASK.test(address)) ask = { repo: o.houseRepo ?? '', head: t.head.item.id, address }
83
+ }
84
+ } catch {
85
+ // the house store does not read now: no link, the words still say what is missing
86
+ }
87
+ const command = want === null ? null : exposeCommand(want)
88
+ return { host: o.host, want, ...(await reachLine(o.host, o.house, o.looks)), ask, command }
89
+ }
@@ -1,4 +1,4 @@
1
- // what a person may do, resolved over layers (wiki tools/shipkit/advisors.md, Rights): the house's defaults, then his
1
+ // what a person may do, resolved over layers (wiki tools/shipkit/advisors.md, The model: people, grants, rights): the house's defaults, then his
2
2
  // default for a project, his default for the person, the person on a project, the person on one thread; the most
3
3
  // specific layer that sets a right wins. Only the owner writes a layer (acts.ts setRights)
4
4
  // the one constraint a reader breaks first: an unset right falls through to the layer below, never to « allowed »; the