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,10 +1,9 @@
1
1
  // the hub's advisors api on the daemon (wiki tools/shipkit/advisors.md, What he does): the page's state, a thread's
2
- // bar, each of his acts followed by one pass of the sync, and his preview: the advisor's own page drawn from the same
3
- // projection, every image shown, the held entries listed. The owner's routes: the hub's door is his
2
+ // bar, each of the owner's acts followed by one owner's pass, and the owner's preview: the advisor's own page drawn
3
+ // from the same projection, every image shown, the masked entries listed. The owner's routes, behind the hub's own gate
4
4
  import { randomBytes } from 'node:crypto'
5
- import { existsSync, readFileSync } from 'node:fs'
6
5
  import { readAll, storeDir } from '../review/store.ts'
7
- import { isClosedThread, membersOf, threadOfAddress, threadOfItem, threadsOf, type Thread } from '../review/threads.ts'
6
+ import { membersOf, threadOfAddress, threadOfItem, threadsOf, type Thread } from '../review/threads.ts'
8
7
  import { ownAddressOf } from '../review/model.ts'
9
8
  import { REFUSED_KINDS, addAdvisor, sendPhoto, confirmPending, deferredTo, endAccess, giveAccess, include, removeAdvisor, renew, revokeAdvisor, revokeAll, setOwner, setRights, share, shareFromHead, unshare } from './acts.ts'
10
9
  import { HOUSE_RIGHTS, rightsOf } from './rights.ts'
@@ -17,22 +16,25 @@ import { openAsks } from '../asks/ask-store.ts'
17
16
  import { acceptProposal, confirmWithFiles, declineProposal, foldedPending, overrideAdvice, staleWhy } from './advice.ts'
18
17
  import type { Bucket } from './edge/bucket.ts'
19
18
  import { KEYS } from './edge/types.ts'
20
- import { doorFacts, identityOfRoot, shownRun, type DoorFacts, type DoorLooks } from './door.ts'
19
+ import { reachFacts, shownRun, type ReachFacts, type ReachLooks } from './reach.ts'
20
+ import { identityOfRoot } from './speaks.ts'
21
21
  import { ensureLogin, renewLogin } from './login.ts'
22
22
  import { ownerNameOf, setOwnerName } from './owner-name.ts'
23
- import { copyApi } from './edge/api.ts'
24
23
  import { MemoryBucket } from './edge/bucket.ts'
25
24
  import { APP_CSP, appShell } from './edge/shell.ts'
26
25
  import { pageResponse } from './edge/status.ts'
27
26
  import { advisorBundle, type AppBundle } from './app.ts'
28
- import { advisorsPass, doorBucket, setupAsked } from './job.ts'
27
+ import { advisorsPass, setupAsked, usersBucket } from './job.ts'
29
28
  import { hereOf, type HereRow } from './here.ts'
30
29
  import { setupRunning } from './setup-run.ts'
31
30
  import type { TunnelStart } from './tunnel.ts'
32
- import { advisorsDir, doorDir, isLive, readState, withState, type Access, type OwnerState, type PendingFile, type Share } from './owner-store.ts'
31
+ import { advisorsDir, isLive, readState, withState, type Access, type OwnerState, type PendingFile, type Share } from './owner-store.ts'
33
32
  import type { HitKind } from './scan.ts'
34
33
  import { prepare, privateWords, sharpWebp } from './sync.ts'
34
+ import { liveAnswer, type Caller } from './users-router.ts'
35
+ import { usersDir } from './users-store.ts'
35
36
  import { photoBytes, pictureType, PHOTO_FILE_MAX, removePhoto, setPhoto } from './photos.ts'
37
+ import { threadState } from '../review/thread-state.ts'
36
38
 
37
39
  export interface AdvisorsDeps {
38
40
  house: string
@@ -41,26 +43,24 @@ export interface AdvisorsDeps {
41
43
  now?: () => Date
42
44
  /** the pass after an act; tests run it inline */
43
45
  pass?: () => Promise<unknown>
44
- /** what the door's line reads (door.ts doorLine); tests fix it */
45
- looks?: DoorLooks
46
- /** the advisors' bucket, where what they sent waits; tests pass one in memory */
46
+ /** what the advisors page's line reads (reach.ts reachLine); tests fix it */
47
+ looks?: ReachLooks
48
+ /** the users' port's folder, where what they sent waits; tests pass one in memory */
47
49
  bucket?: () => Promise<Bucket | null>
48
- /** the advisors' page his preview frames; tests pass a small one */
50
+ /** the advisors' page the owner's preview frames; tests pass a small one */
49
51
  app?: () => Promise<AppBundle>
50
52
  /** the invite's Brevo key, its presence, the send; tests pass a stand in fetch and key */
51
53
  mail?: InviteMailer
52
- /** cloudflared for the door's setup, from the surface that reaches pm (home/advisors-tunnel-start.ts) */
54
+ /** cloudflared for the advisors page's setup, from the surface that reaches pm (home/advisors-tunnel-start.ts) */
53
55
  tunnel?: TunnelStart
54
- /** his « set the door up now »; tests pass a stand in */
56
+ /** the owner's « set the advisors page up now »; tests pass a stand in */
55
57
  setup?: (tunnel: TunnelStart | undefined) => ReturnType<typeof setupAsked>
56
58
  }
57
59
 
58
- /** the door read at most every 30 s: a presence check of the vault is no read for a 15 s poll */
59
- const DOOR_MS = 30_000
60
+ /** the advisors page's reach read at most every 30 s: a presence check of the vault is no read for a 15 s poll */
61
+ const REACH_MS = 30_000
60
62
 
61
63
  const NO_STORE = { 'cache-control': 'no-store' }
62
- /** his preview's copy of a share is built again after this long */
63
- const PREVIEW_MS = 5_000
64
64
  /** how long a preview's ticket opens it: the frame is answered for a page of his hub that minted one, never for a share id */
65
65
  const TICKET_MS = 30 * 60_000
66
66
  const bad = (why: string, status = 400): Response => Response.json({ error: why }, { status, headers: NO_STORE })
@@ -87,11 +87,11 @@ export interface ShareRow {
87
87
  /** the thread's versions as the last pass counted them, and how many the person sees; null before the first */
88
88
  parts: { versions: number; shown: number } | null
89
89
  reach: NonNullable<Share['reach']> | null
90
- /** its thread is closed (settled, fixed, dropped, withdrawn: review/threads.ts isClosedThread); absent from a daemon
90
+ /** its thread is closed (settled, fixed, dropped, withdrawn: review/thread-state.ts ThreadState closed); absent from a daemon
91
91
  * older than the counts */
92
92
  closed?: boolean
93
- /** a live share behind a set up door: the door's address of the thread, and the invite in two lines for any
94
- * messenger, its code while unused (advisors/invite.ts), what his copy buttons put on the clipboard; null otherwise */
93
+ /** a live share on a set up advisors page: the page's address of the thread, and the invite in two lines for any
94
+ * messenger, its code while unused (advisors/invite.ts), what the owner's copy buttons put on the clipboard; null otherwise */
95
95
  copy?: { link: string; text: string } | null
96
96
  }
97
97
 
@@ -133,7 +133,7 @@ export interface KnownRow {
133
133
  }
134
134
 
135
135
  /** a person's invite: `due` when a share sends it (never sent, or over a week ago), `sent` when the last one went,
136
- * `failed` the last try that did not go, `text` its words for this thread (null with no door), for « copy invite » */
136
+ * `failed` the last try that did not go, `text` its words for this thread (null with no advisors page), for « copy invite » */
137
137
  export interface InviteRow {
138
138
  due: boolean
139
139
  sent: string | null
@@ -155,7 +155,7 @@ export interface ThreadPerson {
155
155
  share: string
156
156
  state: Share['state']
157
157
  expires: string
158
- /** their read cursor as the door last wrote it: when, and whether it covers his newest word */
158
+ /** their read cursor as the last pass pulled it: when, and whether it covers the owner's newest word */
159
159
  read: { at: string; seen: boolean } | null
160
160
  }
161
161
 
@@ -187,7 +187,7 @@ const photoOf = (s: OwnerState, advisor: string): string | null => s.advisors.fi
187
187
 
188
188
  const accessRow = (s: OwnerState, x: Access, now: Date): AccessRow => ({ id: x.id, advisor: x.advisor, name: s.advisors.find((a) => a.id === x.advisor)?.name ?? '?', repo: x.repo, expires: x.expires, live: isLive(x, now) })
189
189
 
190
- /** each share's thread by its store and address, read once per answer: a share's link names its copy's head, its row
190
+ /** each share's thread by its store and address, read once per answer: a share's link names its view's head, its row
191
191
  * says whether the thread is closed */
192
192
  type Heads = (x: Pick<Share, 'root' | 'address'>) => Thread | null
193
193
  function headsOf(): Heads {
@@ -209,7 +209,7 @@ function headsOf(): Heads {
209
209
  /** each project's identity, by repo name: his name for advisors per project (owner-name.ts) */
210
210
  type Speaks = ReadonlyMap<string, string | null>
211
211
 
212
- /** the invite of a live share behind a set up door: its link opens the person's copy on this thread */
212
+ /** the invite of a live share on a set up advisors page: its link opens the person's view on this thread */
213
213
  function copyOf(s: OwnerState, x: Share, now: Date, heads: Heads, words: readonly string[], speaks: Speaks): ShareRow['copy'] {
214
214
  if (s.host === null || !isLive(x, now)) return null
215
215
  const a = s.advisors.find((y) => y.id === x.advisor)
@@ -237,7 +237,7 @@ function shareRow(s: OwnerState, x: Share, now: Date, heads: Heads = headsOf(),
237
237
  masked: (x.masked ?? []).map((h) => ({ key: h.key, kinds: h.kinds, where: h.where, n: h.n ?? null, title: h.title ?? null })),
238
238
  parts: x.parts ?? null,
239
239
  reach: x.reach ?? null,
240
- closed: t !== null && isClosedThread(t),
240
+ closed: t !== null && (threadState(t).closed !== null),
241
241
  copy: copyOf(s, x, now, heads, words, speaks),
242
242
  }
243
243
  }
@@ -308,13 +308,13 @@ export function advisorsRoutes(d: AdvisorsDeps) {
308
308
  const dir = (): string => d.dir ?? advisorsDir()
309
309
  const now = (): Date => d.now?.() ?? new Date()
310
310
  const words = (): string[] => privateWords(d.house)
311
- let door: { at: number; host: string | null; facts: DoorFacts } | null = null
312
- const doorNow = async (host: string | null): Promise<DoorFacts> => {
311
+ let reach: { at: number; host: string | null; facts: ReachFacts } | null = null
312
+ const doorNow = async (host: string | null): Promise<ReachFacts> => {
313
313
  const t = Date.now()
314
- if (door !== null && door.host === host && t - door.at < DOOR_MS) return door.facts
314
+ if (reach !== null && reach.host === host && t - reach.at < REACH_MS) return reach.facts
315
315
  const houseRepo = d.repos.find((r) => r.path === d.house)?.name ?? null
316
- const facts = await doorFacts({ house: d.house, houseRepo, host, ...(d.looks !== undefined ? { looks: d.looks } : {}) })
317
- door = { at: t, host, facts }
316
+ const facts = await reachFacts({ house: d.house, houseRepo, host, ...(d.looks !== undefined ? { looks: d.looks } : {}) })
317
+ reach = { at: t, host, facts }
318
318
  return facts
319
319
  }
320
320
  /** a person's sign in, minted as his act makes a grant of theirs live: the copy buttons carry its code at once */
@@ -333,7 +333,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
333
333
  const x = s.shares.find((y) => y.id === id)
334
334
  if (x === undefined) throw new Error(`no share ${id}`)
335
335
  if (isLive(x, now())) {
336
- const p = await prepare(s, x, { words: words(), encode: sharpWebp, now: now(), preview: true })
336
+ const p = await prepare(s, x, { words: words(), now: now() })
337
337
  if (p !== null)
338
338
  withState(dir(), (st) => {
339
339
  const y = st.shares.find((z) => z.id === id)!
@@ -347,7 +347,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
347
347
  return shareRow(st, st.shares.find((y) => y.id === id)!, now(), headsOf(), words(), await speaksNow())
348
348
  }
349
349
  const mailer: InviteMailer = { ...houseMailer(d.house), ...d.mail }
350
- /** each project's identity: read once per process (door.ts identityOfRoot) */
350
+ /** each project's identity: read once per process (speaks.ts identityOfRoot) */
351
351
  const speaksNow = async (): Promise<Speaks> => new Map(await Promise.all(d.repos.map(async (r) => [r.name, await identityOfRoot(r.path)] as const)))
352
352
  /** the invite of a share he just made live, when one is due: a failure is its words, never a failed share */
353
353
  const inviteOnShare = (id: string, n: Date): Promise<InviteSent | null> =>
@@ -355,7 +355,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
355
355
  let mail: { at: number; facts: MailFacts } | null = null
356
356
  const mailNow = async (): Promise<MailFacts> => {
357
357
  const t = Date.now()
358
- if (mail !== null && t - mail.at < DOOR_MS) return mail.facts
358
+ if (mail !== null && t - mail.at < REACH_MS) return mail.facts
359
359
  const key = await (mailer.held ?? (async () => 'unknown' as const))().catch(() => 'unknown' as const)
360
360
  let ask: MailFacts['ask'] = null
361
361
  const houseRepo = d.repos.find((r) => r.path === d.house)?.name ?? null
@@ -401,31 +401,12 @@ export function advisorsRoutes(d: AdvisorsDeps) {
401
401
  if (confirmed.length === 0) throw new Error(failed.join('; '))
402
402
  return { confirmed, failed, invite }
403
403
  }
404
- /** his preview: the advisors' app itself, framed with no origin of its own, over the copy of one share as it would
405
- * leave, every picture drawn raw for his eyes; it takes no answer. Each copy is kept a few seconds: the app reads
406
- * several routes at its start */
407
- const previews = new Map<string, { at: number; bucket: Promise<{ bucket: MemoryBucket; owner: string } | null> }>()
408
- const previewCopy = (id: string): Promise<{ bucket: MemoryBucket; owner: string } | null> => {
409
- const held = previews.get(id)
410
- if (held !== undefined && Date.now() - held.at < PREVIEW_MS) return held.bucket
411
- const bucket = (async () => {
412
- const s = readState(dir())
413
- const x = s.shares.find((y) => y.id === id)
414
- if (x === undefined) return null
415
- const p = await prepare(s, x, { words: words(), encode: sharpWebp, now: now(), preview: true })
416
- if (p === null || p.copy === null || p.manifest === null) return null
417
- const b = new MemoryBucket()
418
- await b.put(KEYS.view(id), JSON.stringify(p.copy.view), 'application/json')
419
- await b.put(KEYS.row(id), JSON.stringify(p.copy.row), 'application/json')
420
- await b.put(KEYS.files(id), JSON.stringify(p.manifest), 'application/json')
421
- for (const f of p.all) if (p.manifest.images.includes(f.sha) && existsSync(f.path)) await b.put(KEYS.media(f.sha), new Uint8Array(readFileSync(f.path)))
422
- return { bucket: b, owner: p.owner }
423
- })()
424
- previews.set(id, { at: Date.now(), bucket })
425
- return bucket
426
- }
404
+ /** his « view as <name> »: the advisors' app itself, framed with no origin of its own, every read answered as that
405
+ * person's own on the users' port (users-router.ts liveAnswer: the same builders, whitelist and mask), on this one
406
+ * share; it takes no answer */
407
+ const asThem = (x: Share, email: string): Caller => ({ kind: 'user', email, login: '', shares: [x], places: [] })
427
408
  // the frame has no origin of its own, so any site's frame looks the same to the hub: the preview answers a ticket his
428
- // page minted by a same origin POST, never a share id (which the advisor reads in every id of their copy)
409
+ // page minted by a same origin POST, never a share id (which the advisor reads in every id of their view)
429
410
  const tickets = new Map<string, { share: string; until: number }>()
430
411
  const open = (x: Share | undefined, n: Date): x is Share => x !== undefined && (x.state === 'pending' || isLive(x, n))
431
412
  const mintTicket = (id: string, n: Date): { path: string } | null => {
@@ -468,14 +449,15 @@ export function advisorsRoutes(d: AdvisorsDeps) {
468
449
  if (file.sha !== f[1]) return bad('no such file of the page', 404)
469
450
  return new Response(file.bytes, { headers: { ...headers, 'content-type': f[2] === 'js' ? 'text/javascript; charset=utf-8' : 'text/css; charset=utf-8' } })
470
451
  }
471
- const copy = await previewCopy(id)
472
- if (copy === null) return bad('its thread or advisor is gone', 404)
473
- const a = readState(dir()).advisors.find((y) => y.id === x.advisor)
474
- const served = { email: a?.email ?? '', name: a?.name ?? '', expires: x.expires, project: x.repo, title: '' }
475
- return (await copyApi(req, sub, { bucket: copy.bucket, shares: [[id, served]], now: now().getTime(), writes: null, headers })) ?? bad('no such route', 404)
452
+ if (req.method !== 'GET' && req.method !== 'HEAD') return bad('the preview takes no answer: this is what the advisor sees', 403)
453
+ if (!sub.startsWith('/api/review/') || who === undefined) return bad('no such route', 404)
454
+ // no cursor of theirs, no session, no key: what they read, never what they did
455
+ const env = { bucket: new MemoryBucket(), host: null, dir: dir(), words, encode: sharpWebp, now: () => now().getTime(), ...(d.app ? { app: d.app } : {}) }
456
+ const r = await liveAnswer(new Request(new URL(sub + new URL(req.url).search, 'https://view-as.invalid'), { method: req.method }), asThem(x, who.email), env)
457
+ return new Response(r.body, { status: r.status, headers: { ...Object.fromEntries(r.headers), ...headers } })
476
458
  }
477
459
  const rootOf = (repo: string): string | null => d.repos.find((r) => r.name === repo)?.path ?? null
478
- const bucket = (): Promise<Bucket | null> => (d.bucket ?? (async () => doorBucket(dir())))()
460
+ const bucket = (): Promise<Bucket | null> => (d.bucket ?? (async () => usersBucket(dir())))()
479
461
 
480
462
  return async (req: Request, path: string): Promise<Response | null> => {
481
463
  if (!path.startsWith('/api/home/advisors')) return null
@@ -502,7 +484,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
502
484
  advice: adviceRows(s, () => true),
503
485
  proposals: proposalRows(s),
504
486
  repos: d.repos.map((r) => r.name),
505
- door: { ...facts, run: shownRun(s.setupRun, n) },
487
+ reach: { ...facts, run: shownRun(s.setupRun, n) },
506
488
  })
507
489
  }
508
490
  if (req.method === 'GET' && rest === '/thread') {
@@ -525,7 +507,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
525
507
  const host = facts.want ?? s.host
526
508
  const title = t?.head.item.title ?? ''
527
509
  const w = words()
528
- // this thread's head is known: the share's link names its copy's head without another read
510
+ // this thread's head is known: the share's link names its view's head without another read
529
511
  const heads: Heads = (x) => (t !== null && x.address === address ? t : null)
530
512
  // every person, his and the ones an agent prepared: a profile grants nothing, his pick shares
531
513
  const speaks = await speaksNow()
@@ -545,14 +527,14 @@ export function advisorsRoutes(d: AdvisorsDeps) {
545
527
  here,
546
528
  known,
547
529
  people,
548
- doorOpen: s.host !== null,
530
+ setUp: s.host !== null,
549
531
  // whether a share mails the invite by itself: the Brevo key's presence, and its ask while missing
550
532
  mail: await mailNow(),
551
533
  shares: s.shares.filter((x) => mine(x) && (x.state === 'pending' || isLive(x, n))).map((x) => shareRow(s, x, n, heads, w, speaks)),
552
534
  advice: adviceRows(s, mine),
553
535
  // the thread's shares as lines of its timeline, every share it ever had (advisors/share-trace.ts)
554
536
  trace: shareEvents(s, mine, 'you', n),
555
- door: { ...facts, run: shownRun(s.setupRun, n) },
537
+ reach: { ...facts, run: shownRun(s.setupRun, n) },
556
538
  deferredTo: t === null ? null : (deferredTo(s, { repo, address, thread: t }, n)?.name ?? null),
557
539
  })
558
540
  }
@@ -587,12 +569,12 @@ export function advisorsRoutes(d: AdvisorsDeps) {
587
569
  return ok(s.advisors.map((a) => ({ id: a.id, name: a.name, photo: photoOf(s, a.id) })))
588
570
  }
589
571
  if (req.method === 'GET' && rest === '/here') {
590
- // where each person is at the door: the thread on now, or when they were last on each (advisors/here.ts)
572
+ // where each person is on the advisors page: the thread on now, or when they were last on each (advisors/here.ts)
591
573
  const s = readState(dir())
592
574
  const n = now()
593
575
  const heads = headsOf()
594
576
  const out: (Omit<HereRow, 'root' | 'share'> & { head: string; title: string })[] = []
595
- for (const r of hereOf(s, doorDir(dir()), n)) {
577
+ for (const r of hereOf(s, usersDir(dir()), n)) {
596
578
  const t = heads(r)
597
579
  if (t !== null) out.push({ advisor: r.advisor, repo: r.repo, address: r.address, on: r.on, at: r.at, head: t.head.item.id, title: t.head.item.title })
598
580
  }
@@ -673,8 +655,7 @@ export function advisorsRoutes(d: AdvisorsDeps) {
673
655
  out = accessRow(readState(dir()), giveAccess(dir(), { advisor: str(b, 'advisor'), repo: str(b, 'repo'), root, ...(typeof b['days'] === 'number' ? { days: b['days'] } : {}) }, 'owner', n), n)
674
656
  } else if (acc !== null) out = endAccess(dir(), acc[1]!, n)
675
657
  else if (rest === '/share') {
676
- // from the thread's head: a known person, or a new one by `name` and `email`; `enable` of the old
677
- // picker is read and ignored, a share needs no other step
658
+ // from the thread's head: a known person, or a new one by `name` and `email`
678
659
  const repo = str(b, 'repo')
679
660
  const root = rootOf(repo)
680
661
  if (root === null) return bad(`no repo ${repo}`)
@@ -707,8 +688,8 @@ export function advisorsRoutes(d: AdvisorsDeps) {
707
688
  include(dir(), { share: id, key: str(b, 'key'), how }, 'owner')
708
689
  out = await refreshOne(id)
709
690
  }
710
- } else if (rest === '/door/setup') {
711
- // his « set the door up now »: one run at a time, its lines on the foot as they end, the minutes it
691
+ } else if (rest === '/setup') {
692
+ // the owner's « set the advisors page up now »: one run at a time, its lines on the foot as they end, the minutes it
712
693
  // takes never held by this answer
713
694
  if (setupRunning(readState(dir()), n)) return bad("the advisors page's setup runs now: its lines show at the foot", 409)
714
695
  const r = await (d.setup ?? ((t) => setupAsked(dir(), d.house, t)))(d.tunnel)
@@ -158,10 +158,6 @@ function merge(hits: Hit[]): Hit[] {
158
158
  return out
159
159
  }
160
160
 
161
- /** the kinds masked in place in what a person reads of a thread the owner shared: a credential in a known format, a
162
- * secret's name or ref, one of his private words. Every other kind goes as written: he shared the thread whole */
163
- export const MASK_KINDS: readonly HitKind[] = ['key', 'secret name', 'private word']
164
-
165
161
  /** a secret ref as a page writes it, `[[secret:<name>]]`: masked whole */
166
162
  const SECRET_REF_RE = /\[\[secret:[A-Za-z0-9][A-Za-z0-9._@/-]*\]\]/g
167
163
 
@@ -1,18 +1,18 @@
1
- // the door's setup, by itself once the owner stored the setup token, or on his « set the door up now » (wiki
2
- // tools/shipkit/advisors.md, The advisors page and its server): the daemon of the machine that carries the hq sees the « a secret landed »
3
- // mark (secrets/changed-mark.ts) move while the door is not on its tunnel, and runs the setup only when the setup
1
+ // the advisors page's setup, by itself once the owner stored the setup token, or on the owner's « set the advisors page
2
+ // up now » (wiki tools/shipkit/advisors.md, Who calls: the users' port): the daemon of the machine that carries
3
+ // the hq sees the « a secret landed » mark (secrets/changed-mark.ts) move while the page is not on its tunnel, and runs the setup only when the setup
4
4
  // token itself was written since the last look: another secret's write starts nothing. The run is the same
5
- // `exposeDoor` as `sk advisors expose`, then the check from outside, then each person with a live grant mailed their
5
+ // `exposeAdvisors` as `sk advisors expose`, then the check from outside, then each person with a live grant mailed their
6
6
  // code. Each line lands on the advisors page's foot as it ends, and the end in the ask's thread. The one constraint a
7
- // reader breaks first: a daemon an agent's shell started never reads the setup token; it says so where he looks
8
- import { AGENT_ENV } from '../vault/vault-init.ts'
9
- import { checkDoor, DoorError, exposeDoor, SETUP_SECRET, type Fetch, type SetupInput } from './expose.ts'
7
+ // reader breaks first: a daemon an agent's shell started never reads the setup token; it says so where the owner looks
8
+ import { AGENT_ENV } from '../core/agent-env.ts'
9
+ import { checkAdvisors, SetupError, exposeAdvisors, SETUP_SECRET, type Fetch, type SetupInput } from './expose.ts'
10
10
  import { granted, readState, withState, type OwnerState, type SetupRun } from './owner-store.ts'
11
11
  import { NO_TUNNEL_START, type TunnelStart } from './tunnel.ts'
12
12
 
13
13
  export type { SetupRun }
14
14
 
15
- /** whether a pass looks at the setup: the mark moved since the last look, and the door is not on its tunnel yet. Cheap:
15
+ /** whether a pass looks at the setup: the mark moved since the last look, and the page is not on its tunnel yet. Cheap:
16
16
  * the token's own write time is read only then */
17
17
  export function setupDue(s: Pick<OwnerState, 'tunnel' | 'setupRun'>, mark: number | null): boolean {
18
18
  return mark !== null && s.tunnel === undefined && (s.setupRun === undefined || s.setupRun.mark < mark || s.setupRun.kind === 'agent')
@@ -107,14 +107,14 @@ export async function setupOnToken(o: { dir: string; house: string; host: string
107
107
  const token = await read(SETUP_SECRET).catch(() => null)
108
108
  if (token === null) return end(`the setup token ${SETUP_SECRET} is not stored: store a fresh one in the ask that opens the advisors page`)
109
109
  try {
110
- await exposeDoor({ dir: o.dir, cwd: o.house, host: o.host, say }, { tunnel: d.tunnel ?? NO_TUNNEL_START, read, ...(d.store ? { store: d.store } : {}), ...(d.fetch ? { fetch: d.fetch } : {}), ...(d.wait ? { wait: d.wait } : {}), now })
110
+ await exposeAdvisors({ dir: o.dir, cwd: o.house, host: o.host, say }, { tunnel: d.tunnel ?? NO_TUNNEL_START, read, ...(d.store ? { store: d.store } : {}), ...(d.fetch ? { fetch: d.fetch } : {}), ...(d.wait ? { wait: d.wait } : {}), now })
111
111
  } catch (e) {
112
- return end(`${(e as Error).message}${e instanceof DoorError && e.kind === 'local' ? '' : '. Store a fresh setup token in the ask, or « set the advisors page up now » at the foot, to run it again'}`)
112
+ return end(`${(e as Error).message}${e instanceof SetupError && e.kind === 'local' ? '' : '. Store a fresh setup token in the ask, or « set the advisors page up now » at the foot, to run it again'}`)
113
113
  }
114
- const fails = await (d.check ?? ((h: string) => checkDoor(h)))(o.host).catch((e: Error) => [`the check did not run: ${e.message}`])
114
+ const fails = await (d.check ?? ((h: string) => checkAdvisors(h)))(o.host).catch((e: Error) => [`the check did not run: ${e.message}`])
115
115
  for (const f of fails) say(`WARN ${f}`)
116
116
  if (fails.length === 0) say(`checked from outside: the public pages open, the advisor routes want a session, nothing else answers`)
117
- // the people who read before the switch: each gets their code once, the old door's sign in being gone
117
+ // each person with a live grant gets their code once, to sign in on the page just set up
118
118
  const people = [...granted(readState(o.dir), now())]
119
119
  for (const p of people) {
120
120
  const said = await (d.mail ?? (async () => null))(p).catch((e: Error) => e.message)
@@ -127,6 +127,6 @@ export async function setupOnToken(o: { dir: string; house: string; host: string
127
127
  return end(fails.length === 0 ? null : `the name answers what it should not yet (${fails.length}): it may need a minute; the foot says when advisors reach this Mac`)
128
128
  }
129
129
 
130
- /** every failure of the check is this Mac failing to look the name up (a name pointed a minute ago): the door may stand,
131
- * the check only did not reach it from here */
130
+ /** every failure of the check is this Mac failing to look the name up (a name pointed a minute ago): the page may
131
+ * stand, the check only did not reach it from here */
132
132
  export const lookupOnly = (fails: readonly string[]): boolean => fails.length > 0 && fails.every((f) => /: unreachable \((getaddrinfo )?(ENOTFOUND|EAI_AGAIN)\b/.test(f))
@@ -1,4 +1,4 @@
1
- // a thread's shares as lines of its timeline (wiki tools/shipkit/advisors.md, The share's trace): shared with a person
1
+ // a thread's shares as lines of its timeline (wiki tools/shipkit/advisors.md, What he does, one click each): shared with a person
2
2
  // and for how long, an agent's ask and his confirm, each renew, the end by an unshare or at the expiry. Derived at read
3
3
  // time from the shares of the advisors' store, never copied into a thread store: the store is the one source, and no
4
4
  // agent's inbox, watch or hook reads this file's input (the cli's `sk thread show` prints the lines on demand).
@@ -23,7 +23,7 @@ export interface ShareEvent {
23
23
  who: string
24
24
  /** the line, its subject first: « you shared it with Ada, for 14 days » */
25
25
  words: string
26
- /** the share's newest line while it is live: the line its acts sit on (copy the invite, the door) */
26
+ /** the share's newest line while it is live: the line its acts sit on (copy the invite, the advisors page) */
27
27
  live?: true
28
28
  }
29
29
 
@@ -44,7 +44,7 @@ export function eventsOfShare(x: Share, name: string, you: string, now: Date): S
44
44
  else push({ at: x.created, act: 'shared', who: 'owner', words: `${you} shared it with ${name}${forDays(days(x.created))}` })
45
45
  if (x.confirmed !== undefined) push({ at: x.confirmed, act: 'confirmed', who: 'owner', words: `${you} confirmed the share with ${name}${forDays(days(x.confirmed))}` })
46
46
  for (const r of renewals) push({ at: r.at, act: 'renewed', who: 'owner', words: `${you} renewed the share with ${name}${forDays(daysOf(r.at, r.until))}` })
47
- // an agent's ask never confirmed and never pushed was never live: it ends as dropped, never at an expiry
47
+ // an agent's ask never confirmed and never prepared by a pass (`pushed`) was never live: it ends as dropped, never at an expiry
48
48
  const never = agent && x.state !== 'live' && x.confirmed === undefined && x.pushed === undefined
49
49
  if (!never && x.state !== 'pending' && Date.parse(x.expires) <= now.getTime() && (x.revoked === undefined || x.expires < x.revoked)) push({ at: x.expires, act: 'expired', who: 'machine', words: `the share with ${name} ended at its expiry` })
50
50
  else if (x.revoked !== undefined) push({ at: x.revoked, act: never ? 'dropped' : 'ended', who: 'owner', words: never ? `the share with ${name} was dropped: ${name} never got it` : `the share with ${name} ended: unshared` })
@@ -1,4 +1,4 @@
1
- // the door's sign in as a person's browser sends it (wiki tools/shipkit/advisors.md, The commands): a headless Chrome
1
+ // the advisors page's sign in as a person's browser sends it (wiki tools/shipkit/advisors.md, The commands): a headless Chrome
2
2
  // loads `https://<host>/in`, fills its form with a login nobody has and lets the form post itself, so the request
3
3
  // carries what a browser really puts on it (its Origin under the page's referrer policy), never headers typed by hand.
4
4
  // The one constraint a reader breaks first: ONE try a run, with an email no person has, so it counts against that email
@@ -13,11 +13,12 @@ const PROBE_PASSWORD = 'not-a-real-password-of-anyone'
13
13
 
14
14
  export type Probe = { ok: string } | { warn: string } | { fail: string }
15
15
 
16
- /** what the page after the post says: the door's own « does not match » is a pass; « Forbidden » is the door refusing
17
- * its own form; anything else is no sign in page */
16
+ /** what the page after the post says: the users' port's own « check your email and password » is a pass (« does not
17
+ * match » from a daemon that runs the words before them); « Forbidden » is the port refusing its own form; anything
18
+ * else is no sign in page */
18
19
  export function probeVerdict(title: string, words: string): Probe {
19
20
  const w = words.replace(/\s+/g, ' ').trim()
20
- if (/does not match/i.test(w)) return { ok: 'the sign in form posts as the advisors page expects: a login nobody has gets « does not match »' }
21
+ if (/check your email and password|does not match/i.test(w)) return { ok: 'the sign in form posts as the advisors page expects: a login nobody has gets « check your email and password »' }
21
22
  if (/too many tries/i.test(w)) return { warn: 'the form passed the origin check, but the advisors page counts too many tries from this address now: run it again in 10 minutes' }
22
23
  if (/forbidden/i.test(title) || /not sent from the sign in page/i.test(w)) return { fail: `the advisors page refuses its own sign in form as sent from elsewhere: nobody can sign in (« ${w.slice(0, 120)} »)` }
23
24
  return { fail: `after the form's post the page is not the sign in page: « ${title} » « ${w.slice(0, 120) || 'a blank page'} »` }
@@ -26,8 +27,8 @@ export function probeVerdict(title: string, words: string): Probe {
26
27
  export const chromeAt = (): string | null =>
27
28
  [process.env.CHROME, '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', join(homedir(), 'Applications', 'Google Chrome.app', 'Contents', 'MacOS', 'Google Chrome')].find((p): p is string => p !== undefined && p !== '' && existsSync(p)) ?? null
28
29
 
29
- /** one try of the sign in, through the live door, in a headless Chrome of its own; a WARN with no Chrome */
30
- /** `args`: Chrome flags of a browser check that runs this against a local door (its name mapped to a port) */
30
+ /** one try of the sign in, through the live advisors page, in a headless Chrome of its own; a WARN with no Chrome */
31
+ /** `args`: Chrome flags of a browser check that runs this against a local users' port (its name mapped to a port) */
31
32
  export async function probeSignIn(host: string, o: { chrome?: string | null; timeoutMs?: number; args?: readonly string[] } = {}): Promise<Probe> {
32
33
  const exe = o.chrome === undefined ? chromeAt() : o.chrome
33
34
  if (exe === null) return { warn: 'no Chrome on this machine: the sign in form was not tried in a real browser (set CHROME to its binary)' }
@@ -0,0 +1,29 @@
1
+ // who the owner speaks as, for the advisors page (wiki tools/shipkit/advisors.md, His name on the advisors page): the
2
+ // identity a repo speaks as, and the facts the public pages print. The one constraint a reader breaks first: the
3
+ // users' port imports it, so it reads repo configs and identity folders only, never a secret
4
+ import { loadIdentities, speakerOf } from '../identities/identities.ts'
5
+ import { loadRepoConfig } from '../repo-config.ts'
6
+ import { factsOf, type PageFacts } from './edge/pages.ts'
7
+
8
+ /** the identity the house's repo config speaks as: its id (the name advisors read when he set none) and its contact */
9
+ export async function housePageFacts(house: string | null): Promise<{ facts: PageFacts; id: string | null; warn?: string }> {
10
+ const speaker = house === null ? null : speakerOf((await loadRepoConfig(house)).speaksAs, await loadIdentities({ cwd: house }))
11
+ const facts = factsOf(speaker?.id, speaker?.rows.find((r) => r.field === 'email')?.value)
12
+ const id = speaker?.id ?? null
13
+ if (facts.contact !== null) return { facts, id }
14
+ return { facts, id, warn: `the privacy page names no contact: ${speaker === null ? 'no identity speaks for the house' : `the identity ${speaker.id} has no email row in its identity.md profile`}` }
15
+ }
16
+
17
+ const speaks = new Map<string, Promise<string | null>>()
18
+ /** the identity a repo speaks as (its config's `speaksAs`), read once per process: his name for advisors there
19
+ * (owner-name.ts) */
20
+ export function identityOfRoot(root: string): Promise<string | null> {
21
+ if (!speaks.has(root)) speaks.set(root, loadRepoConfig(root).then((c) => c.speaksAs ?? null, () => null))
22
+ return speaks.get(root)!
23
+ }
24
+
25
+ /** the name the advisors page opens at: the house config's `serve.advisorsHost`, null when it names none */
26
+ export async function houseHost(house: string): Promise<string | null> {
27
+ const h = await loadRepoConfig(house).then((c) => c.serve?.advisorsHost?.trim().toLowerCase() ?? '', () => '')
28
+ return h === '' ? null : h
29
+ }