rvlib-shipkit 2.30.0 → 2.32.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 (821) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +15 -0
  3. package/package.json +1 -1
  4. package/src/advisors/acts.ts +186 -94
  5. package/src/advisors/advice.ts +227 -96
  6. package/src/advisors/advisor-view.ts +141 -68
  7. package/src/advisors/app-graph.ts +8 -2
  8. package/src/advisors/app.ts +3 -11
  9. package/src/advisors/cf-api.ts +44 -0
  10. package/src/advisors/dir-bucket.ts +70 -0
  11. package/src/advisors/edge/api.ts +32 -197
  12. package/src/advisors/edge/bucket.ts +10 -1
  13. package/src/advisors/edge/handler.ts +36 -137
  14. package/src/advisors/edge/here.ts +63 -0
  15. package/src/advisors/edge/pages.ts +90 -0
  16. package/src/advisors/edge/shell.ts +11 -8
  17. package/src/advisors/edge/sign-in.ts +209 -0
  18. package/src/advisors/edge/status.ts +41 -6
  19. package/src/advisors/edge/types.ts +42 -58
  20. package/src/advisors/expose.ts +227 -121
  21. package/src/advisors/here.ts +66 -0
  22. package/src/advisors/invite-send.ts +220 -0
  23. package/src/advisors/invite.ts +72 -0
  24. package/src/advisors/job.ts +100 -14
  25. package/src/advisors/login.ts +91 -0
  26. package/src/advisors/owner-name.ts +37 -0
  27. package/src/advisors/owner-store.ts +295 -66
  28. package/src/advisors/photos.ts +12 -52
  29. package/src/advisors/project.ts +105 -59
  30. package/src/advisors/reach.ts +89 -0
  31. package/src/advisors/rights.ts +152 -0
  32. package/src/advisors/routes.ts +340 -127
  33. package/src/advisors/scan.ts +24 -2
  34. package/src/advisors/setup-run.ts +132 -0
  35. package/src/advisors/share-trace.ts +78 -0
  36. package/src/advisors/sign-in-probe.ts +89 -0
  37. package/src/advisors/speaks.ts +29 -0
  38. package/src/advisors/sync.ts +219 -194
  39. package/src/advisors/tunnel.ts +119 -0
  40. package/src/advisors/users-listen.ts +92 -0
  41. package/src/advisors/users-router.ts +358 -0
  42. package/src/advisors/users-store.ts +81 -0
  43. package/src/agent-time/accounts-usage-disk.ts +45 -3
  44. package/src/agent-time/blocked-scan.ts +181 -0
  45. package/src/agent-time/claude-sessions.ts +63 -3
  46. package/src/agent-time/registry.ts +142 -51
  47. package/src/agent-time/store.ts +204 -141
  48. package/src/annex/born.ts +2 -9
  49. package/src/asks/ask-bar-fold.ts +2 -1
  50. package/src/asks/ask-carry.ts +14 -7
  51. package/src/asks/ask-close.ts +2 -1
  52. package/src/asks/ask-doc.ts +2 -1
  53. package/src/asks/ask-edit.ts +49 -0
  54. package/src/asks/ask-migrate.ts +3 -2
  55. package/src/asks/ask-since.ts +74 -0
  56. package/src/asks/ask-steps-fold.ts +2 -1
  57. package/src/asks/ask-store.ts +74 -32
  58. package/src/asks/ask-words-fold.ts +2 -2
  59. package/src/check.ts +3 -43
  60. package/src/checks/SK001-package-json-shape.check.ts +16 -58
  61. package/src/checks/SK003-claude-md-shape.check.ts +78 -20
  62. package/src/checks/SK004-gitignore-policy.check.ts +31 -73
  63. package/src/checks/SK008-reviewer-agent.check.ts +1 -1
  64. package/src/checks/SK012-config-barrel-import.check.ts +1 -1
  65. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  66. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  67. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  68. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  69. package/src/checks/SK032-ignored-inputs.check.ts +9 -5
  70. package/src/checks/SK035-public-clean.check.ts +1 -1
  71. package/src/checks/SK036-draft-media-size.check.ts +4 -3
  72. package/src/checks/SK038-speaks-as.check.ts +6 -5
  73. package/src/checks/SK039-vscode-watch-generated.check.ts +5 -25
  74. package/src/checks/SK042-post-kinds.check.ts +5 -14
  75. package/src/checks/SK044-behind-upstream.check.ts +2 -1
  76. package/src/checks/SK052-url-old-words.check.ts +56 -0
  77. package/src/checks/SK053-tools.check.ts +46 -0
  78. package/src/checks/SK054-agent-allow-list.check.ts +73 -0
  79. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  80. package/src/cli/clip.ts +44 -0
  81. package/src/cli/cmd_Advisors.ts +278 -144
  82. package/src/cli/cmd_Annex.ts +1 -1
  83. package/src/cli/cmd_Asks.ts +126 -31
  84. package/src/cli/cmd_Assets.ts +1 -1
  85. package/src/cli/cmd_Backup.ts +25 -168
  86. package/src/cli/cmd_BackupTargets.ts +106 -0
  87. package/src/cli/cmd_Bump.ts +1 -1
  88. package/src/cli/cmd_CacheAudit.ts +1 -1
  89. package/src/cli/cmd_Calls.ts +1 -1
  90. package/src/cli/cmd_Capacity.ts +1 -1
  91. package/src/cli/cmd_Check.ts +2 -2
  92. package/src/cli/cmd_Checks.ts +2 -15
  93. package/src/cli/cmd_Ci.ts +1 -1
  94. package/src/cli/cmd_Commands.ts +1 -1
  95. package/src/cli/cmd_ConfigKeys.ts +1 -1
  96. package/src/cli/cmd_Contracts.ts +1 -1
  97. package/src/cli/cmd_CrossRepoActivity.ts +1 -6
  98. package/src/cli/cmd_Db.ts +33 -68
  99. package/src/cli/cmd_Drill.ts +1 -1
  100. package/src/cli/cmd_Drive.ts +259 -0
  101. package/src/cli/cmd_Fleet.ts +1 -1
  102. package/src/cli/cmd_FleetContext.ts +45 -0
  103. package/src/cli/cmd_FleetPush.ts +1 -1
  104. package/src/cli/cmd_FleetUpdate.ts +104 -0
  105. package/src/cli/cmd_GlobalContext.ts +1 -1
  106. package/src/cli/cmd_GlobalProcesses.ts +6 -4
  107. package/src/cli/cmd_History.ts +8 -27
  108. package/src/cli/cmd_Home.ts +8 -36
  109. package/src/cli/cmd_Hooks.ts +3 -12
  110. package/src/cli/cmd_Hq.ts +47 -90
  111. package/src/cli/cmd_Init.ts +1 -1
  112. package/src/cli/cmd_Insights.ts +1 -1
  113. package/src/cli/cmd_Keys.ts +1 -1
  114. package/src/cli/cmd_Lanes.ts +5 -4
  115. package/src/cli/cmd_Machines.ts +1 -1
  116. package/src/cli/cmd_Media.ts +6 -19
  117. package/src/cli/cmd_Messages.ts +1 -1
  118. package/src/cli/cmd_Mv.ts +1 -1
  119. package/src/cli/cmd_Needs.ts +1 -1
  120. package/src/cli/cmd_Orchestrator.ts +7 -16
  121. package/src/cli/cmd_OrchestratorRole.ts +10 -21
  122. package/src/cli/cmd_Overview.ts +1 -1
  123. package/src/cli/cmd_Pb.ts +1 -1
  124. package/src/cli/cmd_Planned.ts +1 -1
  125. package/src/cli/cmd_Rec.ts +1 -1
  126. package/src/cli/cmd_Reflect.ts +3 -3
  127. package/src/cli/cmd_Release.ts +1 -1
  128. package/src/cli/cmd_Releases.ts +58 -5
  129. package/src/cli/cmd_Review.ts +576 -483
  130. package/src/cli/cmd_Secret.ts +84 -2
  131. package/src/cli/cmd_Serve.ts +1 -1
  132. package/src/cli/cmd_Setup.ts +30 -0
  133. package/src/cli/cmd_Shot.ts +1 -1
  134. package/src/cli/cmd_Sign.ts +1 -1
  135. package/src/cli/cmd_Smoke.ts +1 -1
  136. package/src/cli/cmd_Social.ts +6 -3
  137. package/src/cli/cmd_SocialDrafts.ts +23 -16
  138. package/src/cli/cmd_Sound.ts +1 -1
  139. package/src/cli/cmd_Space.ts +4 -4
  140. package/src/cli/cmd_Start.ts +1 -1
  141. package/src/cli/cmd_Status.ts +1 -1
  142. package/src/cli/cmd_ThreadHolds.ts +1 -1
  143. package/src/cli/cmd_ThreadKinds.ts +1 -1
  144. package/src/cli/cmd_ThreadReflect.ts +3 -3
  145. package/src/cli/cmd_ThreadSyncNeeds.ts +7 -3
  146. package/src/cli/cmd_Time.ts +2 -2
  147. package/src/cli/cmd_Tmp.ts +1 -1
  148. package/src/cli/cmd_TraceAudit.ts +1 -1
  149. package/src/cli/cmd_Trailer.ts +2 -2
  150. package/src/cli/cmd_Tui.ts +1 -1
  151. package/src/cli/cmd_Urls.ts +61 -9
  152. package/src/cli/cmd_Vault.ts +1 -1
  153. package/src/cli/cmd_Veille.ts +1 -1
  154. package/src/cli/cmd_When.ts +1 -1
  155. package/src/cli/cmd_Wiki.ts +5 -2
  156. package/src/cli/cmd_Worktrees.ts +1 -1
  157. package/src/cli/family-pages.ts +1 -0
  158. package/src/cli/inbox-hook-run.ts +26 -18
  159. package/src/cli/line.ts +131 -0
  160. package/src/cli/registry-cli.ts +100 -0
  161. package/src/cli/registry-heads.ts +398 -0
  162. package/src/cli/registry.ts +381 -254
  163. package/src/cli/review-here.ts +5 -5
  164. package/src/cli.ts +47 -35
  165. package/src/collections/collection-types.ts +4 -1
  166. package/src/collections/providers.ts +6 -3
  167. package/src/collections/review.ts +6 -6
  168. package/src/context/context-line.ts +29 -0
  169. package/src/context/context-view.ts +34 -0
  170. package/src/context/project-context.ts +144 -0
  171. package/src/core/agent-allow-policy.ts +129 -0
  172. package/src/core/agent-env.ts +8 -0
  173. package/src/core/agent-spawn.ts +2 -0
  174. package/src/core/allow-rows.ts +74 -0
  175. package/src/core/capacity.ts +3 -2
  176. package/src/core/check-file-names.ts +19 -106
  177. package/src/core/es2022.ts +19 -0
  178. package/src/core/footprint.ts +39 -0
  179. package/src/core/git-bin.ts +18 -0
  180. package/src/core/git-root.ts +40 -4
  181. package/src/core/git.ts +22 -0
  182. package/src/core/hard-reset.ts +7 -1
  183. package/src/core/house-config-text.ts +47 -0
  184. package/src/core/house-layout.ts +4 -0
  185. package/src/core/identities-path.ts +67 -0
  186. package/src/core/identities-root.ts +23 -0
  187. package/src/core/instance.ts +1 -1
  188. package/src/core/jobs.ts +1 -4
  189. package/src/{scaffold → core}/jsonc-spans.ts +42 -0
  190. package/src/core/layout.ts +4 -2
  191. package/src/core/loop-watch.ts +28 -5
  192. package/src/core/machine-db.ts +34 -216
  193. package/src/core/machine-layout.ts +14 -127
  194. package/src/core/machine-name.ts +31 -0
  195. package/src/core/mask-source.ts +60 -0
  196. package/src/core/memory-watch.ts +62 -11
  197. package/src/core/motherhome.ts +8 -35
  198. package/src/core/on-loop.ts +10 -7
  199. package/src/core/one-way-in-policy.ts +0 -3
  200. package/src/core/pid-alive.ts +11 -0
  201. package/src/core/proc-path.ts +42 -0
  202. package/src/core/repo-walk.ts +0 -9
  203. package/src/core/retention.ts +3 -11
  204. package/src/core/retired-checks.ts +2 -0
  205. package/src/core/role-policy.ts +6 -7
  206. package/src/core/run-dirs.ts +2 -5
  207. package/src/core/runs.ts +5 -3
  208. package/src/core/scope.ts +44 -0
  209. package/src/core/scratch-objects.ts +1 -1
  210. package/src/core/slot-env.ts +4 -0
  211. package/src/core/slots.ts +2 -2
  212. package/src/core/spawn-timeout.ts +9 -3
  213. package/src/core/tmux-policy.ts +1 -1
  214. package/src/core/tools.ts +20 -0
  215. package/src/core/tree-watch.ts +304 -0
  216. package/src/core/when.ts +7 -45
  217. package/src/core/window-policy.ts +132 -0
  218. package/src/drives/context.ts +29 -0
  219. package/src/drives/drives-view.ts +121 -0
  220. package/src/drives/file.ts +89 -0
  221. package/src/drives/local-folder.ts +107 -0
  222. package/src/drives/login.ts +181 -0
  223. package/src/drives/named.ts +33 -0
  224. package/src/drives/rclone.ts +100 -0
  225. package/src/drives/reach.ts +73 -0
  226. package/src/drives/routes.ts +89 -0
  227. package/src/drives/shares.ts +292 -0
  228. package/src/fleet/context-fleet.ts +83 -0
  229. package/src/fleet/follow.ts +172 -0
  230. package/src/gate/builtin-checks-dir.ts +32 -0
  231. package/src/gate/discover-checks.ts +45 -58
  232. package/src/gate/gate-checks.ts +21 -131
  233. package/src/gate/pre-commit-discovery.ts +205 -24
  234. package/src/gate/run-check.ts +0 -4
  235. package/src/gate/run-fix.ts +5 -17
  236. package/src/gate/run-fixers.ts +13 -41
  237. package/src/home/advisors-tunnel-start.ts +9 -0
  238. package/src/home/app-sign.ts +2 -2
  239. package/src/home/autostart.ts +61 -17
  240. package/src/home/backup-status.ts +326 -0
  241. package/src/home/backup-verdict.ts +19 -0
  242. package/src/home/daemon-jobs.ts +206 -107
  243. package/src/home/database-words.ts +18 -2
  244. package/src/home/databases.ts +70 -39
  245. package/src/home/drives-deps.ts +54 -0
  246. package/src/home/follow-run.ts +146 -0
  247. package/src/home/global-context.ts +26 -22
  248. package/src/home/global-units.ts +3 -1
  249. package/src/home/gui-app/ShipkitGui.swift +1595 -17
  250. package/src/home/gui-app.ts +12 -16
  251. package/src/home/handoff.ts +5 -3
  252. package/src/home/handover.ts +2 -10
  253. package/src/home/home-launchd.ts +0 -6
  254. package/src/home/home-paths.ts +20 -7
  255. package/src/home/home-routes.ts +92 -29
  256. package/src/home/home-state.ts +2 -14
  257. package/src/home/inbox-shape.ts +15 -16
  258. package/src/home/inbox.ts +1 -1
  259. package/src/home/machine-host.ts +3 -17
  260. package/src/home/machine-repair.ts +102 -103
  261. package/src/home/machine-stores.ts +8 -7
  262. package/src/home/owner-switch-route.ts +33 -0
  263. package/src/home/page-build.ts +20 -4
  264. package/src/home/page-files.ts +79 -0
  265. package/src/home/pm-switch.ts +10 -0
  266. package/src/home/pm.ts +13 -1
  267. package/src/home/process-apps.ts +15 -3
  268. package/src/home/push-sources.ts +17 -5
  269. package/src/home/resume.ts +7 -19
  270. package/src/home/run-daemon.ts +63 -7
  271. package/src/home/run-pm.ts +3 -3
  272. package/src/home/secrets-context.ts +119 -0
  273. package/src/home/serve-web.ts +12 -7
  274. package/src/home/shipkit-mark.ts +26 -0
  275. package/src/home/space-page.ts +3 -2
  276. package/src/home/space-route.ts +3 -10
  277. package/src/home/supervise.ts +5 -16
  278. package/src/home/vault-page.ts +39 -18
  279. package/src/home/vault-reveal.ts +2 -1
  280. package/src/home/web-places.ts +5 -3
  281. package/src/hooks/commit-run.ts +420 -0
  282. package/src/hooks/git-hook.ts +49 -0
  283. package/src/hooks/held-calls.ts +104 -0
  284. package/src/hooks/hook-config.ts +103 -0
  285. package/src/hooks/hook-gates.ts +15 -9
  286. package/src/hooks/leak-guard.ts +16 -15
  287. package/src/hooks/one-way-in-guard.ts +12 -3
  288. package/src/hooks/pre-commit-checks.ts +64 -0
  289. package/src/hooks/root-identity.ts +15 -18
  290. package/src/hooks/run-hooks.ts +123 -301
  291. package/src/hooks/shared-file.ts +18 -15
  292. package/src/hooks/shell-writes.ts +6 -100
  293. package/src/hooks/staged.ts +245 -18
  294. package/src/hooks/write-log.ts +122 -28
  295. package/src/house/project-gutter.ts +32 -8
  296. package/src/hq/backup-targets.ts +74 -0
  297. package/src/hq/daemon-db.ts +177 -0
  298. package/src/hq/door-route.ts +5 -5
  299. package/src/hq/door.ts +16 -15
  300. package/src/hq/files-send.ts +23 -17
  301. package/src/hq/follow-fact.ts +66 -0
  302. package/src/hq/forgotten-log.ts +3 -1
  303. package/src/hq/history-check.ts +9 -0
  304. package/src/hq/history-send.ts +6 -22
  305. package/src/hq/holds-shape.ts +42 -0
  306. package/src/hq/hq-db.ts +17 -26
  307. package/src/hq/hq-holds.ts +181 -0
  308. package/src/hq/hq-local.ts +65 -47
  309. package/src/hq/hq-role.ts +150 -0
  310. package/src/hq/hq-routes.ts +15 -3
  311. package/src/hq/hq-store.ts +28 -10
  312. package/src/hq/item-direct.ts +55 -0
  313. package/src/hq/item-fill.ts +37 -0
  314. package/src/hq/kinds/index.ts +2 -1
  315. package/src/hq/kinds/item-gone.ts +18 -13
  316. package/src/hq/kinds/item-msg.ts +19 -10
  317. package/src/hq/kinds/item.ts +22 -19
  318. package/src/hq/kinds/kind.ts +9 -0
  319. package/src/hq/kinds/presence.ts +21 -3
  320. package/src/hq/kinds/prompt.ts +1 -0
  321. package/src/hq/kinds/reflection.ts +1 -0
  322. package/src/hq/kinds/report.ts +6 -2
  323. package/src/hq/kinds/thread-event.ts +105 -0
  324. package/src/hq/lead-order.ts +5 -5
  325. package/src/hq/machine-key.ts +10 -3
  326. package/src/hq/machine-notes.ts +3 -2
  327. package/src/hq/outbox.ts +2 -153
  328. package/src/hq/owner-switch.ts +61 -0
  329. package/src/hq/replica.ts +165 -18
  330. package/src/hq/report-facts.ts +26 -3
  331. package/src/hq/report.ts +26 -6
  332. package/src/hq/switch.ts +20 -60
  333. package/src/hq/terminal-hop.ts +1 -1
  334. package/src/hq/thread-events.ts +91 -0
  335. package/src/hq/thread-sync.ts +34 -65
  336. package/src/hq/threads-words.ts +21 -0
  337. package/src/http/door-forward.ts +3 -3
  338. package/src/http/hop-names.ts +3 -3
  339. package/src/http/owner-word.ts +7 -2
  340. package/src/identities/collection.ts +2 -3
  341. package/src/identities/identities.ts +43 -6
  342. package/src/identities/machine.ts +16 -0
  343. package/src/init-repo.ts +12 -1
  344. package/src/ledger/check-stats.ts +6 -5
  345. package/src/ledger/db.ts +18 -7
  346. package/src/ledger/git-scan.ts +23 -9
  347. package/src/ledger/live-runs.ts +1 -12
  348. package/src/ledger/record-kept.ts +139 -42
  349. package/src/ledger/run-log.ts +23 -3
  350. package/src/ledger/slow-tests.ts +96 -0
  351. package/src/ledger/store.ts +3 -86
  352. package/src/ledger/suite-log.ts +8 -2
  353. package/src/media-store/backup/facts.ts +29 -0
  354. package/src/media-store/backup/keys.ts +1 -8
  355. package/src/media-store/backup/manifest.ts +6 -67
  356. package/src/media-store/backup/restore.ts +11 -9
  357. package/src/media-store/backup/retention.ts +14 -2
  358. package/src/media-store/backup/run.ts +6 -267
  359. package/src/media-store/backup/snapshot.ts +2 -38
  360. package/src/media-store/backup/sources.ts +21 -213
  361. package/src/media-store/backup/ssh-target.ts +74 -0
  362. package/src/media-store/backup/target-send.ts +138 -0
  363. package/src/media-store/copy/config.ts +5 -4
  364. package/src/media-store/copy/copy.ts +11 -6
  365. package/src/media-store/copy/proof.ts +17 -10
  366. package/src/media-store/copy/snapshot.ts +29 -22
  367. package/src/media-store/copy/store.ts +2 -10
  368. package/src/media-store/copy/stream.ts +7 -2
  369. package/src/media-store/daemon.ts +8 -5
  370. package/src/media-store/db.ts +11 -5
  371. package/src/media-store/forget-one.ts +15 -4
  372. package/src/media-store/forget.ts +1 -80
  373. package/src/media-store/hq-find.ts +1 -3
  374. package/src/media-store/hq-send.ts +4 -5
  375. package/src/orchestrator/brief.md +1 -1
  376. package/src/orchestrator/guards.ts +0 -4
  377. package/src/orchestrator/lead-shape.ts +5 -4
  378. package/src/orchestrator/now.ts +1 -1
  379. package/src/orchestrator/places-look.ts +45 -17
  380. package/src/orchestrator/places-shape.ts +17 -2
  381. package/src/orchestrator/places.ts +1 -1
  382. package/src/orchestrator/presence.ts +17 -7
  383. package/src/orchestrator/role-shape.ts +12 -21
  384. package/src/orchestrator/role.ts +7 -58
  385. package/src/orchestrator/routes.ts +26 -17
  386. package/src/orchestrator/sessions-shape.ts +48 -3
  387. package/src/orchestrator/sessions.ts +5 -8
  388. package/src/orchestrator/start.ts +3 -10
  389. package/src/orchestrator/started.ts +1 -10
  390. package/src/orchestrator/talk-key.ts +20 -0
  391. package/src/orchestrator/unheard.ts +2 -2
  392. package/src/recordings/edit.ts +3 -3
  393. package/src/recordings/marks-draw.ts +17 -6
  394. package/src/recordings/marks.ts +120 -9
  395. package/src/recordings/recorder-app/Editor.swift +6 -0
  396. package/src/recordings/recorder-app/main.swift +3 -0
  397. package/src/reflections/reflection-close.ts +2 -1
  398. package/src/reflections/reflections-queue.ts +5 -9
  399. package/src/release/notes.ts +1 -1
  400. package/src/release/public-clean.ts +102 -17
  401. package/src/release/run-bump.ts +11 -0
  402. package/src/release/run-release.ts +4 -0
  403. package/src/releases/from-thread.ts +3 -3
  404. package/src/releases/model.ts +186 -36
  405. package/src/releases/store.ts +13 -3
  406. package/src/releases/validate.ts +83 -0
  407. package/src/repo-config.ts +45 -68
  408. package/src/review/answer-kinds.ts +71 -2
  409. package/src/review/blocked-guard.ts +11 -0
  410. package/src/review/blocked-object.ts +298 -0
  411. package/src/review/cell-copy.ts +27 -0
  412. package/src/review/cells.ts +317 -219
  413. package/src/review/close.ts +39 -1
  414. package/src/review/doc-save.ts +3 -2
  415. package/src/review/draft-item.ts +1 -1
  416. package/src/review/events.ts +27 -11
  417. package/src/review/expect.ts +112 -0
  418. package/src/review/file-tags.ts +9 -0
  419. package/src/review/format.ts +160 -39
  420. package/src/review/glyphs.ts +1 -0
  421. package/src/review/gone.ts +10 -86
  422. package/src/review/hand-over.ts +3 -3
  423. package/src/review/heard.ts +1 -1
  424. package/src/review/holds-sync.ts +2 -1
  425. package/src/review/inbox-hook.ts +8 -5
  426. package/src/review/inbox-read.ts +96 -22
  427. package/src/review/instruction-guards.ts +68 -1
  428. package/src/review/instructions.ts +25 -2
  429. package/src/review/item-db.ts +124 -70
  430. package/src/review/item-hq.ts +119 -0
  431. package/src/review/item-rows.ts +95 -62
  432. package/src/review/kind-catalog.ts +5 -1
  433. package/src/review/kinds.ts +25 -12
  434. package/src/review/live-post.ts +20 -6
  435. package/src/review/live-view.ts +21 -1
  436. package/src/review/media-away.ts +35 -0
  437. package/src/review/media-kind.ts +1 -1
  438. package/src/review/mentions.ts +4 -8
  439. package/src/review/model.ts +254 -98
  440. package/src/review/move.ts +131 -474
  441. package/src/review/need-threads.ts +3 -2
  442. package/src/review/notes.ts +4 -4
  443. package/src/review/object-card.ts +11 -0
  444. package/src/review/object-read.ts +32 -8
  445. package/src/review/one-block.ts +1 -1
  446. package/src/review/owner-read.ts +1 -1
  447. package/src/review/parties.ts +16 -0
  448. package/src/review/phone-push.ts +15 -13
  449. package/src/review/previews-job.ts +49 -0
  450. package/src/review/previews.ts +79 -29
  451. package/src/review/push.ts +26 -42
  452. package/src/review/recap.ts +129 -0
  453. package/src/review/referring.ts +6 -3
  454. package/src/review/reflection-object.ts +28 -14
  455. package/src/review/refs.ts +143 -0
  456. package/src/review/reply-guards.ts +71 -0
  457. package/src/review/routes.ts +133 -47
  458. package/src/review/search-index.ts +6 -10
  459. package/src/review/search-job.ts +4 -6
  460. package/src/review/search-ocr.ts +1 -1
  461. package/src/review/secret-route.ts +14 -9
  462. package/src/review/settle.ts +0 -6
  463. package/src/review/snooze.ts +5 -3
  464. package/src/review/speaker.ts +68 -0
  465. package/src/review/start-title.ts +19 -0
  466. package/src/review/store-index.ts +1 -1
  467. package/src/review/store.ts +256 -614
  468. package/src/review/supersede.ts +3 -3
  469. package/src/review/take-back.ts +1 -2
  470. package/src/review/thread-code.ts +101 -0
  471. package/src/review/{wakes.ts → thread-events.ts} +97 -8
  472. package/src/review/thread-md.ts +148 -0
  473. package/src/review/thread-query.ts +67 -0
  474. package/src/review/thread-state.ts +798 -0
  475. package/src/review/threads.ts +58 -301
  476. package/src/review/traces.ts +121 -12
  477. package/src/review/trailer-item.ts +1 -1
  478. package/src/review/unit.ts +7 -9
  479. package/src/review/verdict-items.ts +10 -8
  480. package/src/review/view-layout.ts +28 -1
  481. package/src/review/watch-feed.ts +1 -2
  482. package/src/review/watchers.ts +1 -10
  483. package/src/review/working-guards.ts +38 -0
  484. package/src/rules/untrack-generated.ts +1 -15
  485. package/src/scaffold/starter-house.ts +85 -0
  486. package/src/secrets/about-words.ts +33 -0
  487. package/src/secrets/archive.ts +2 -2
  488. package/src/secrets/audit-run.ts +53 -0
  489. package/src/secrets/audit.ts +407 -0
  490. package/src/secrets/changed-mark.ts +15 -0
  491. package/src/secrets/clip.ts +29 -0
  492. package/src/secrets/held.ts +4 -4
  493. package/src/secrets/lapse.ts +3 -2
  494. package/src/secrets/list.ts +9 -4
  495. package/src/secrets/read.ts +5 -1
  496. package/src/secrets/ref-state.ts +18 -0
  497. package/src/secrets/registry-rows.ts +18 -0
  498. package/src/secrets/secret-ref.ts +42 -0
  499. package/src/secrets/token-siblings.ts +60 -0
  500. package/src/secrets/who-reads.ts +25 -20
  501. package/src/serve/frame-part.ts +2 -1
  502. package/src/serve/hub-app/activity-view.tsx +6 -6
  503. package/src/serve/hub-app/admin-view.tsx +7 -6
  504. package/src/serve/hub-app/advisor-app.tsx +80 -17
  505. package/src/serve/hub-app/advisor-face.tsx +27 -7
  506. package/src/serve/hub-app/advisor-host.ts +113 -21
  507. package/src/serve/hub-app/advisors-model.ts +243 -0
  508. package/src/serve/hub-app/advisors-rights.tsx +66 -0
  509. package/src/serve/hub-app/advisors-st.ts +433 -36
  510. package/src/serve/hub-app/advisors-view.tsx +333 -234
  511. package/src/serve/hub-app/advisors.css +134 -21
  512. package/src/serve/hub-app/app-bridge.ts +116 -6
  513. package/src/serve/hub-app/ask-steps.tsx +6 -3
  514. package/src/serve/hub-app/asks-page.tsx +1 -1
  515. package/src/serve/hub-app/auto-text.tsx +114 -19
  516. package/src/serve/hub-app/backups-st.ts +55 -0
  517. package/src/serve/hub-app/backups-view.tsx +115 -0
  518. package/src/serve/hub-app/backups.css +33 -0
  519. package/src/serve/hub-app/card-head.tsx +1 -1
  520. package/src/serve/hub-app/check-view.tsx +7 -15
  521. package/src/serve/hub-app/col-card.tsx +4 -4
  522. package/src/serve/hub-app/col-list-page.tsx +2 -1
  523. package/src/serve/hub-app/col-tables.ts +5 -4
  524. package/src/serve/hub-app/comfy-view.tsx +1 -1
  525. package/src/serve/hub-app/commands/commands-page.tsx +2 -2
  526. package/src/serve/hub-app/controls.css +34 -2
  527. package/src/serve/hub-app/cycle-button.tsx +2 -2
  528. package/src/serve/hub-app/database-st.ts +40 -11
  529. package/src/serve/hub-app/database-view.tsx +67 -3
  530. package/src/serve/hub-app/database.css +3 -0
  531. package/src/serve/hub-app/dock-view.tsx +1 -1
  532. package/src/serve/hub-app/drives-page.tsx +309 -0
  533. package/src/serve/hub-app/drives-st.ts +486 -0
  534. package/src/serve/hub-app/drives.css +122 -0
  535. package/src/serve/hub-app/editor/doc-editor.tsx +4 -3
  536. package/src/serve/hub-app/empty-section.tsx +1 -1
  537. package/src/serve/hub-app/entry-list.tsx +1 -1
  538. package/src/serve/hub-app/floating.tsx +0 -1
  539. package/src/serve/hub-app/frame-refusal.ts +13 -0
  540. package/src/serve/hub-app/geometry-view.tsx +3 -3
  541. package/src/serve/hub-app/git-view.tsx +3 -1
  542. package/src/serve/hub-app/hash-route.ts +12 -5
  543. package/src/serve/hub-app/header-bar.tsx +2 -1
  544. package/src/serve/hub-app/home-pages.ts +40 -0
  545. package/src/serve/hub-app/home-st.ts +8 -1
  546. package/src/serve/hub-app/home-strip.tsx +22 -20
  547. package/src/serve/hub-app/home.html +2 -1
  548. package/src/serve/hub-app/hub-app.tsx +16 -3
  549. package/src/serve/hub-app/hub.css +84 -10
  550. package/src/serve/hub-app/icons.tsx +9 -1
  551. package/src/serve/hub-app/identities-view.tsx +5 -4
  552. package/src/serve/hub-app/inbox-view.tsx +11 -12
  553. package/src/serve/hub-app/index.html +2 -1
  554. package/src/serve/hub-app/insights-view.tsx +8 -8
  555. package/src/serve/hub-app/keys.ts +31 -11
  556. package/src/serve/hub-app/layout-st.ts +4 -1
  557. package/src/serve/hub-app/lightbox-zoom.css +29 -19
  558. package/src/serve/hub-app/list-filter.tsx +46 -5
  559. package/src/serve/hub-app/live-socket.ts +12 -6
  560. package/src/serve/hub-app/live-sources.ts +138 -67
  561. package/src/serve/hub-app/machine-groups.ts +87 -0
  562. package/src/serve/hub-app/machines-st.ts +100 -3
  563. package/src/serve/hub-app/machines-view.tsx +50 -3
  564. package/src/serve/hub-app/machines.css +22 -0
  565. package/src/serve/hub-app/main-panel.css +16 -10
  566. package/src/serve/hub-app/main-panel.tsx +8 -9
  567. package/src/serve/hub-app/markdown.css +12 -2
  568. package/src/serve/hub-app/md.ts +60 -18
  569. package/src/serve/hub-app/media-view.tsx +21 -12
  570. package/src/serve/hub-app/messages/messages-page.tsx +15 -6
  571. package/src/serve/hub-app/new-thread.tsx +6 -3
  572. package/src/serve/hub-app/orchestrator-line.tsx +1 -1
  573. package/src/serve/hub-app/orchestrator-places.tsx +28 -2
  574. package/src/serve/hub-app/orchestrator.css +5 -0
  575. package/src/serve/hub-app/page-keys.ts +4 -1
  576. package/src/serve/hub-app/pages-frames.tsx +2 -1
  577. package/src/serve/hub-app/palette-st.ts +285 -60
  578. package/src/serve/hub-app/palette-view.tsx +96 -18
  579. package/src/serve/hub-app/pane-boundary.tsx +3 -2
  580. package/src/serve/hub-app/panel-head.tsx +1 -1
  581. package/src/serve/hub-app/panel-repo.ts +0 -9
  582. package/src/serve/hub-app/panel-source.ts +16 -5
  583. package/src/serve/hub-app/panel-tint.ts +3 -18
  584. package/src/serve/hub-app/panel-walk.ts +1 -1
  585. package/src/serve/hub-app/pic.tsx +54 -0
  586. package/src/serve/hub-app/pick-kinds.ts +101 -0
  587. package/src/serve/hub-app/places-svc.ts +44 -10
  588. package/src/serve/hub-app/plan-view.tsx +2 -2
  589. package/src/serve/hub-app/planned-view.tsx +6 -5
  590. package/src/serve/hub-app/polled.ts +33 -8
  591. package/src/serve/hub-app/presence-st.ts +9 -1
  592. package/src/serve/hub-app/processes-view.tsx +16 -10
  593. package/src/serve/hub-app/project-bar.tsx +85 -29
  594. package/src/serve/hub-app/project-list.tsx +7 -19
  595. package/src/serve/hub-app/projects-svc.ts +50 -20
  596. package/src/serve/hub-app/rail-groups.ts +1 -0
  597. package/src/serve/hub-app/recordings-st.ts +23 -2
  598. package/src/serve/hub-app/recordings-view.tsx +94 -36
  599. package/src/serve/hub-app/ref-list-slot.ts +10 -0
  600. package/src/serve/hub-app/ref-pill.ts +58 -0
  601. package/src/serve/hub-app/reflections-page.tsx +3 -3
  602. package/src/serve/hub-app/releases/releases-page.tsx +6 -6
  603. package/src/serve/hub-app/repo-mark.tsx +29 -0
  604. package/src/serve/hub-app/repo-sections.ts +16 -9
  605. package/src/serve/hub-app/repo-st.ts +68 -16
  606. package/src/serve/hub-app/review/advisor-add.tsx +155 -0
  607. package/src/serve/hub-app/review/advisor-bar.tsx +92 -22
  608. package/src/serve/hub-app/review/advisor-invite.tsx +66 -0
  609. package/src/serve/hub-app/review/ask-proof.tsx +4 -3
  610. package/src/serve/hub-app/review/attach-view.tsx +7 -6
  611. package/src/serve/hub-app/review/box-view.ts +35 -18
  612. package/src/serve/hub-app/review/box-zoom.tsx +1 -1
  613. package/src/serve/hub-app/review/copy-button.tsx +29 -0
  614. package/src/serve/hub-app/review/diff-mode.ts +41 -0
  615. package/src/serve/hub-app/review/diff-view.tsx +92 -19
  616. package/src/serve/hub-app/review/doc-body.tsx +2 -2
  617. package/src/serve/hub-app/review/draft-body.tsx +4 -4
  618. package/src/serve/hub-app/review/group-block.tsx +8 -8
  619. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  620. package/src/serve/hub-app/review/instructions-view.tsx +4 -17
  621. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  622. package/src/serve/hub-app/review/kind-view.tsx +13 -19
  623. package/src/serve/hub-app/review/kit.tsx +19 -18
  624. package/src/serve/hub-app/review/lane-bar.tsx +4 -4
  625. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  626. package/src/serve/hub-app/review/line-window.ts +55 -9
  627. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  628. package/src/serve/hub-app/review/live-bar.tsx +5 -2
  629. package/src/serve/hub-app/review/live-view.tsx +67 -11
  630. package/src/serve/hub-app/review/mention-st.ts +9 -38
  631. package/src/serve/hub-app/review/object-panel.tsx +58 -21
  632. package/src/serve/hub-app/review/outbox-st.ts +200 -0
  633. package/src/serve/hub-app/review/pano-view.tsx +2 -2
  634. package/src/serve/hub-app/review/phone-top.tsx +2 -1
  635. package/src/serve/hub-app/review/question-views.tsx +321 -62
  636. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  637. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  638. package/src/serve/hub-app/review/review-cells.tsx +327 -112
  639. package/src/serve/hub-app/review/review-host.ts +11 -2
  640. package/src/serve/hub-app/review/review-kit.ts +38 -16
  641. package/src/serve/hub-app/review/review-list.tsx +63 -110
  642. package/src/serve/hub-app/review/review-page.tsx +6 -5
  643. package/src/serve/hub-app/review/review-st.ts +114 -70
  644. package/src/serve/hub-app/review/review-thread.tsx +378 -204
  645. package/src/serve/hub-app/review/review-views.tsx +205 -111
  646. package/src/serve/hub-app/review/secret-facts.ts +2 -1
  647. package/src/serve/hub-app/review/share-lines.tsx +40 -0
  648. package/src/serve/hub-app/review/start-st.ts +134 -0
  649. package/src/serve/hub-app/review/start-thread.tsx +104 -0
  650. package/src/serve/hub-app/review/superseded-runs.ts +24 -5
  651. package/src/serve/hub-app/review/thread-close.tsx +11 -8
  652. package/src/serve/hub-app/review/thread-control.tsx +5 -4
  653. package/src/serve/hub-app/review/thread-st.ts +591 -206
  654. package/src/serve/hub-app/review/thread-views.ts +3 -2
  655. package/src/serve/hub-app/review/tone-bar.tsx +126 -0
  656. package/src/serve/hub-app/review/tones.ts +35 -0
  657. package/src/serve/hub-app/review/trailer-body.tsx +8 -8
  658. package/src/serve/hub-app/review/trailer-page.tsx +33 -33
  659. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  660. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  661. package/src/serve/hub-app/review/trailer-voices.tsx +10 -10
  662. package/src/serve/hub-app/review/zoom-still.tsx +60 -0
  663. package/src/serve/hub-app/review.css +320 -123
  664. package/src/serve/hub-app/row-acts.tsx +2 -0
  665. package/src/serve/hub-app/row-face.tsx +0 -1
  666. package/src/serve/hub-app/run-page.tsx +236 -0
  667. package/src/serve/hub-app/running-rows.tsx +2 -2
  668. package/src/serve/hub-app/search-view.tsx +2 -2
  669. package/src/serve/hub-app/secret-cli.tsx +32 -0
  670. package/src/serve/hub-app/secret-readable.tsx +59 -0
  671. package/src/serve/hub-app/secret-refs.ts +173 -0
  672. package/src/serve/hub-app/secrets-page.tsx +2 -2
  673. package/src/serve/hub-app/section-head.tsx +3 -1
  674. package/src/serve/hub-app/seen-rows.ts +72 -0
  675. package/src/serve/hub-app/shared-faces.tsx +32 -0
  676. package/src/serve/hub-app/side-frame-view.tsx +115 -0
  677. package/src/serve/hub-app/side-frame.ts +120 -0
  678. package/src/serve/hub-app/site/site-part.tsx +7 -7
  679. package/src/serve/hub-app/social/calendar.tsx +1 -1
  680. package/src/serve/hub-app/social/comms-page.tsx +3 -3
  681. package/src/serve/hub-app/social/copy-forms.ts +31 -0
  682. package/src/serve/hub-app/social/kit.tsx +42 -23
  683. package/src/serve/hub-app/social/post-card.tsx +5 -5
  684. package/src/serve/hub-app/social/post-page.tsx +2 -2
  685. package/src/serve/hub-app/social/social-model.ts +0 -4
  686. package/src/serve/hub-app/social/social-page.tsx +31 -12
  687. package/src/serve/hub-app/social/social-st.ts +8 -2
  688. package/src/serve/hub-app/social/stage-popup.tsx +6 -6
  689. package/src/serve/hub-app/social.css +7 -1
  690. package/src/serve/hub-app/source-acts.ts +2 -1
  691. package/src/serve/hub-app/source-page.tsx +2 -0
  692. package/src/serve/hub-app/space-view.tsx +3 -3
  693. package/src/serve/hub-app/stores/stores-page.tsx +20 -19
  694. package/src/serve/hub-app/terminal-gone.tsx +41 -0
  695. package/src/serve/hub-app/terminal-history-st.ts +3 -0
  696. package/src/serve/hub-app/terminal-list-st.ts +27 -3
  697. package/src/serve/hub-app/terminal-pages.tsx +50 -10
  698. package/src/serve/hub-app/terminal-panel.tsx +3 -3
  699. package/src/serve/hub-app/terminal-picture.ts +78 -0
  700. package/src/serve/hub-app/terminal-sources.tsx +320 -49
  701. package/src/serve/hub-app/terminal-st.ts +57 -2
  702. package/src/serve/hub-app/terminal-tab.tsx +2 -1
  703. package/src/serve/hub-app/terminal.css +5 -0
  704. package/src/serve/hub-app/test-view.tsx +2 -2
  705. package/src/serve/hub-app/tests-view.tsx +3 -3
  706. package/src/serve/hub-app/thread-row.tsx +15 -6
  707. package/src/serve/hub-app/time-charts.tsx +3 -2
  708. package/src/serve/hub-app/time-pages.tsx +3 -2
  709. package/src/serve/hub-app/time-view.tsx +6 -5
  710. package/src/serve/hub-app/timeline-chart.tsx +1 -1
  711. package/src/serve/hub-app/timeline-view.tsx +12 -4
  712. package/src/serve/hub-app/tree-build.ts +3 -7
  713. package/src/serve/hub-app/url-faces.ts +3 -4
  714. package/src/serve/hub-app/url-forms.tsx +112 -20
  715. package/src/serve/hub-app/url-needs.ts +31 -0
  716. package/src/serve/hub-app/urls-svc.ts +163 -25
  717. package/src/serve/hub-app/urls-view.tsx +76 -75
  718. package/src/serve/hub-app/urls.css +62 -5
  719. package/src/serve/hub-app/vault-view.tsx +13 -13
  720. package/src/serve/hub-app/veille/veille-page.tsx +12 -11
  721. package/src/serve/hub-app/view-layout.css +13 -1
  722. package/src/serve/hub-app/when-view.tsx +2 -2
  723. package/src/serve/hub-app/wikis-view.tsx +6 -3
  724. package/src/serve/hub-app/word-refs.ts +12 -0
  725. package/src/serve/hub-app/words.tsx +25 -8
  726. package/src/serve/hub-runtime.ts +7 -37
  727. package/src/serve/picture-types.ts +10 -0
  728. package/src/serve/project-gutter-route.ts +24 -15
  729. package/src/serve/read-thread.ts +49 -12
  730. package/src/serve/read-worker.ts +16 -1
  731. package/src/serve/record-pages.ts +46 -0
  732. package/src/serve/secret-ref-routes.ts +71 -0
  733. package/src/serve/serve-hub.ts +28 -3
  734. package/src/serve/terminal-claudes.ts +44 -7
  735. package/src/serve/terminal-guard.ts +5 -1
  736. package/src/serve/terminal-host.ts +6 -2
  737. package/src/serve/terminal-paste.ts +49 -0
  738. package/src/serve/terminal-record.ts +8 -2
  739. package/src/serve/terminal-route.ts +19 -8
  740. package/src/serve/tracked-watch.ts +14 -14
  741. package/src/setup-house.ts +333 -0
  742. package/src/shipkit-files.ts +15 -4
  743. package/src/shipkit.ts +1 -6
  744. package/src/shot/film-box.ts +1 -29
  745. package/src/social/discord-layout.ts +1 -1
  746. package/src/social/drafts.ts +1 -1
  747. package/src/social/kind-pages.ts +11 -5
  748. package/src/social/kinds.ts +6 -29
  749. package/src/social/load.ts +2 -2
  750. package/src/social/media-limit.ts +18 -8
  751. package/src/social/media-of.ts +5 -5
  752. package/src/social/post-object.ts +3 -2
  753. package/src/social/publish/discord.ts +1 -1
  754. package/src/social/release-stage.ts +1 -1
  755. package/src/social/routes.ts +6 -3
  756. package/src/social/stage.ts +2 -2
  757. package/src/start-repo.ts +5 -0
  758. package/src/stores/model.ts +4 -0
  759. package/src/stores/routes.ts +11 -3
  760. package/src/suite/judge-suites.ts +67 -51
  761. package/src/suite/red-alone.ts +105 -0
  762. package/src/suite/runner-shapes.ts +2 -2
  763. package/src/suite/suite-cli.ts +88 -34
  764. package/src/suite/test-units.ts +2 -1
  765. package/src/trailer/titles.ts +2 -2
  766. package/src/urls/added.ts +34 -15
  767. package/src/urls/fill.ts +127 -0
  768. package/src/urls/frame.ts +39 -0
  769. package/src/urls/places.ts +18 -13
  770. package/src/urls/routes.ts +30 -10
  771. package/src/urls/rows.ts +98 -23
  772. package/src/urls/totp.ts +121 -0
  773. package/src/urls/unit.ts +95 -36
  774. package/src/urls/write-routes.ts +141 -25
  775. package/src/vault/vault-config.ts +2 -2
  776. package/src/vault/vault-import.ts +2 -9
  777. package/src/vault/vault-init.ts +1 -4
  778. package/src/vault/vault-restore.ts +1 -9
  779. package/src/veille/chrome.ts +8 -18
  780. package/src/veille/identity.ts +6 -5
  781. package/src/wiki/graph-page.ts +41 -39
  782. package/src/wiki/graph-positions.ts +13 -3
  783. package/src/wiki/graph-sim.ts +77 -0
  784. package/src/wiki/run-wiki.ts +12 -1
  785. package/src/advisors/door.ts +0 -59
  786. package/src/advisors/edge/certs.ts +0 -20
  787. package/src/advisors/edge/jwt.ts +0 -76
  788. package/src/advisors/edge/worker.ts +0 -52
  789. package/src/advisors/r2.ts +0 -46
  790. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  791. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  792. package/src/checks/SK048-one-local-file.check.ts +0 -36
  793. package/src/cli/channel-run.ts +0 -17
  794. package/src/cli/cmd_Channel.ts +0 -43
  795. package/src/core/config-rewrite.ts +0 -111
  796. package/src/core/legacy-shapes.ts +0 -263
  797. package/src/core/migrate-layout.ts +0 -638
  798. package/src/core/port-check-cli.ts +0 -52
  799. package/src/core/port-check-file.ts +0 -295
  800. package/src/core/port-check-files.ts +0 -31
  801. package/src/gate/discover-legacy-checks.ts +0 -26
  802. package/src/home/home-move.ts +0 -527
  803. package/src/home/machine-fold.ts +0 -818
  804. package/src/media-store/backup/daemon.ts +0 -205
  805. package/src/media-store/backup/kept.ts +0 -241
  806. package/src/media-store/backup/prune.ts +0 -362
  807. package/src/media-store/backup/secret.ts +0 -88
  808. package/src/media-store/backup/thread-copy.ts +0 -343
  809. package/src/media-store/backup/watch.ts +0 -110
  810. package/src/orchestrator/channel-declare.ts +0 -58
  811. package/src/orchestrator/channel.ts +0 -226
  812. package/src/review/band.ts +0 -145
  813. package/src/review/role.ts +0 -48
  814. package/src/review/thread-fold.ts +0 -64
  815. package/src/review/wait.ts +0 -91
  816. package/src/rules/rule.ts +0 -43
  817. package/src/serve/hub-app/panel-tint.css +0 -6
  818. package/src/serve/hub-app/review/dock.tsx +0 -119
  819. package/src/serve/hub-app/review/faces.tsx +0 -18
  820. package/src/serve/hub-app/review/item-verdict.tsx +0 -111
  821. package/src/serve/hub-app/review/review-board.tsx +0 -48
@@ -1,7 +1,7 @@
1
- // sk thread: an agent shows the owner something as a version in its thread and reads his answer; a dispatcher routes
2
- // what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki tools/shipkit/threads.md).
1
+ // sk thread: an agent shows the owner something as a version in its thread and reads his answer; what he, a player or
2
+ // a rule raised, a worker claims and closes (review/store.ts, wiki tools/shipkit/threads.md).
3
3
  // Every module loads inside execute: the cli registers this file on every `sk` call
4
- import { Command, Option } from 'clipanion'
4
+ import { Command, Option } from './clip.ts'
5
5
  import type { AnswerKind } from '../review/model.ts'
6
6
  import { holdsThread, laneOfCaller, maySee } from '../review/parties.ts'
7
7
  import { realGit } from '../core/git.ts'
@@ -17,9 +17,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
17
17
  const out = (l: string): void => void context.stdout.write(`${l}\n`)
18
18
  const err = (l: string): void => void context.stderr.write(`${l}\n`)
19
19
  try {
20
- // the older name still works: it says the new one where a person reads it, never in a hook's or a script's output
21
20
  const argv = process.argv.slice(2)
22
- if (argv[0] === 'review' && !argv.includes('--hook') && !argv.includes('--json')) err(`sk review is now sk thread: sk thread ${argv.slice(1).map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')}`)
23
21
  const root = await reviewRoot(process.cwd())
24
22
  if (root == null) throw new Error(noRepo(process.cwd()))
25
23
  // a repo where an agent writes in a thread needs a next session that hears it; the gate's repair wires the hook
@@ -41,7 +39,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
41
39
  const isHelp = (a: string): boolean => a === '--help' || a === '-h'
42
40
 
43
41
  /** the verbs that write an agent's act in a thread */
44
- const WRITING_VERBS = new Set(['post', 'add', 'add-view', 'ask', 'propose', 'reply', 'update', 'take', 'assign', 'working', 'fixed', 'done', 'attach', 'ready'])
42
+ const WRITING_VERBS = new Set(['post', 'add-view', 'ask', 'propose', 'reply', 'update', 'take', 'assign', 'working', 'fixed', 'done', 'attach', 'ready'])
45
43
 
46
44
  /** the agent that acts (review/parties.ts laneOfCaller); `need` refuses an unnamed one */
47
45
  function actor(as: string | undefined, need: boolean, verb: string): string {
@@ -55,6 +53,18 @@ function actor(as: string | undefined, need: boolean, verb: string): string {
55
53
  /** an item id, a player report's ref (`live#3`), or an address (`trailer:comfy-ts/main`, the newest version of the
56
54
  * thread that owns it, or the one above it) to its item id */
57
55
  async function idOf(dir: string, ref: string, one?: { verb: string; objects?: boolean }): Promise<string> {
56
+ try {
57
+ return await idHere(dir, ref, one)
58
+ } catch (e) {
59
+ // a thread moved to another repo: its old address and ids say where it is now, never « no thread »
60
+ const { movedLine, movedOf } = await import('../review/move.ts')
61
+ const m = movedOf(dir, ref)
62
+ if (m !== null) throw new Error(movedLine(ref, m))
63
+ throw e
64
+ }
65
+ }
66
+
67
+ async function idHere(dir: string, ref: string, one?: { verb: string; objects?: boolean }): Promise<string> {
58
68
  const { itemOfRef, readAll, specOf } = await import('../review/store.ts')
59
69
  const { addressOrThrow, ID_RE } = await import('../review/model.ts')
60
70
  const { THREAD_ID_RE, threadIdOf, threadOfAddress, threadsOf, threadsOfId } = await import('../review/threads.ts')
@@ -83,11 +93,30 @@ async function idOf(dir: string, ref: string, one?: { verb: string; objects?: bo
83
93
 
84
94
  /** an address an agent starts a thread on or links: its kind word must be one a kind declares (the repo's or the
85
95
  * house's, `sk thread kinds`), so one subject never becomes two threads under two words */
86
- async function declaredOrThrow(h: Here, a: string): Promise<void> {
96
+ async function declaredOrThrow(h: Here, a: string): Promise<string> {
87
97
  const { readAll } = await import('../review/store.ts')
88
- const { addressRefusal } = await import('../review/threads.ts')
89
- const why = addressRefusal(a, readAll(h.dir).items, h.say.spec)
98
+ const { addressRefusal, ownAddressesOf, threadOfAddress } = await import('../review/threads.ts')
99
+ const items = readAll(h.dir).items
100
+ // only `sk ask` opens an ask's thread: an ask address no thread owns (a wrong number, a typo) never starts one
101
+ if (a.startsWith('ask:')) {
102
+ const t = threadOfAddress(a, items, h.say.spec)
103
+ if (t === null) throw new Error(await noAsk(h, a))
104
+ // `ask:21` is written as the address its thread owns, so a version never starts a second thread
105
+ return ownAddressesOf(t, h.say.spec).find((x) => x.startsWith('ask:')) ?? a
106
+ }
107
+ const why = addressRefusal(a, items, h.say.spec)
90
108
  if (why !== null) throw new Error(why)
109
+ return a
110
+ }
111
+
112
+ /** why an ask address names no ask, with the open asks nearest its number */
113
+ async function noAsk(h: Here, a: string): Promise<string> {
114
+ const { openAsks } = await import('../asks/ask-store.ts')
115
+ const { dirname } = await import('node:path')
116
+ const n = parseInt(a.slice('ask:'.length), 10)
117
+ const open = openAsks(dirname(dirname(h.dir)))
118
+ const near = [...open].sort((x, y) => (Number.isNaN(n) ? 0 : Math.abs(parseInt(x.id, 10) - n) - Math.abs(parseInt(y.id, 10) - n))).slice(0, 5)
119
+ return `no ask ${a.slice('ask:'.length)}: only sk ask opens an ask's thread, so nothing is written. ${near.length > 0 ? `The open asks nearest it: ${near.map((x) => `ask:${parseInt(x.id, 10)} « ${x.title} »`).join(', ')}` : 'No ask is open here'} (sk asks lists them)`
91
120
  }
92
121
 
93
122
  /** the item an act on `ref` goes on: an id's, or the newest version of the thread its address has; an address no
@@ -119,7 +148,8 @@ async function replyTarget(h: Here, ref: string, id: string): Promise<string> {
119
148
  const { ID_RE } = await import('../review/model.ts')
120
149
  if (ID_RE.test(ref) || !ref.includes(':') || /^\w+#\d+$/.test(ref)) return id
121
150
  const { readAll } = await import('../review/store.ts')
122
- const { replyTargetOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
151
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
152
+ const { replyTargetOf } = await import('../review/thread-state.ts')
123
153
  const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
124
154
  return t ? replyTargetOf(t) : id
125
155
  }
@@ -182,11 +212,41 @@ export function takeViews(args: readonly string[]): { views: ViewInput[]; rest:
182
212
  return { views, rest }
183
213
  }
184
214
 
185
- const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --pano <360.png> | --splat <a.ply> [--image <poster.png>] | --mesh <a.glb> [--image <poster.png>] | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
215
+ const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --live [<label>] <url> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --pano <360.png> | --splat <a.ply> [--image <poster.png>] | --mesh <a.glb> [--image <poster.png>] | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
186
216
  const MEDIA_FILE = /\.(png|jpe?g|webp|gif|mp4|webm|mov|wav|mp3|flac|ogg|opus|m4a)$/i
187
217
 
188
218
  /** one `--option` of a question: words, a media file, `<label>=<file>` or `<label>=<before>,<after>` (a gallery tile's
189
219
  * form); the part after the last `=` is media only when each of its files is one */
220
+ /** the rows of `sk thread ask --row`, read in the order typed: each --row opens a thing, the --option and --pick after
221
+ * it are that row's. `args`: the words after `ask` */
222
+ export function askRowsOf(args: readonly string[]): { label: string; options: string[]; pick?: number }[] {
223
+ const rows: { label: string; options: string[]; pick?: number }[] = []
224
+ for (let i = 0; i < args.length; i++) {
225
+ const a = args[i]!
226
+ const eq = /^(--row|--option|--pick)=(.*)$/s.exec(a)
227
+ const flag = eq?.[1] ?? a
228
+ if (flag !== '--row' && flag !== '--option' && flag !== '--pick') continue
229
+ const value = eq !== null ? eq[2]! : args[++i]
230
+ if (value === undefined) throw new Error(`${flag}: a value after it`)
231
+ if (flag === '--row') {
232
+ if (value.trim() === '') throw new Error('--row: the thing this row picks for, in words')
233
+ rows.push({ label: value.trim(), options: [] })
234
+ continue
235
+ }
236
+ const row = rows.at(-1)
237
+ if (row === undefined) throw new Error(`${flag} before the first --row: with --row, each row's --option and --pick follow it`)
238
+ if (flag === '--option') row.options.push(value)
239
+ else {
240
+ if (row.pick !== undefined) throw new Error(`--row ${row.label}: one --pick a row`)
241
+ const n = Number(value)
242
+ if (!(Number.isInteger(n) && n >= 1)) throw new Error(`--pick ${value}: an option's number from 1`)
243
+ row.pick = n - 1
244
+ }
245
+ }
246
+ for (const r of rows) if (r.options.length < 2) throw new Error(`--row ${r.label}: two --option or more after it`)
247
+ return rows
248
+ }
249
+
190
250
  export function askOption(a: string): { label: string; files?: string[] } {
191
251
  const eq = a.lastIndexOf('=')
192
252
  const tail = eq >= 0 ? a.slice(eq + 1).split(',').map((f) => f.trim()) : [a.trim()]
@@ -221,6 +281,16 @@ async function withPoster(view: ViewInput): Promise<{ view: ViewInput; drop: ()
221
281
  }
222
282
  }
223
283
 
284
+ /** add-view's args with `--live [<label>] <url>` taken out (review/live-post.ts takeLives): the id, the page alone in
285
+ * the view, its label the live one's, else --label, else « live page » */
286
+ export function addViewLive(rest: readonly string[], lives: readonly { label: string; url: string }[]): { id: string; view: ViewInput; repoFlags: Record<string, string[]> } {
287
+ const l = rest.indexOf('--label')
288
+ const label = lives[0]?.label || (l >= 0 ? rest[l + 1] : undefined) || 'live page'
289
+ const words = l < 0 ? [...rest] : rest.filter((_, i) => i !== l && i !== l + 1)
290
+ if (lives.length !== 1 || words.length !== 1 || words[0]!.startsWith('--')) throw new Error(`--live: one page a view, alone; add-view <id> --live [<label>] <url>`)
291
+ return { id: words[0]!, view: { label }, repoFlags: {} }
292
+ }
293
+
224
294
  /** add-view's args: the positional form, or the view flags of add; a flag is never a label, `own` are the repo unit's flags */
225
295
  export async function addViewArgs(args: readonly string[], own: readonly string[]): Promise<{ id: string; view: ViewInput; repoFlags: Record<string, string[]> }> {
226
296
  const one: Record<string, string> = {}
@@ -305,7 +375,8 @@ function flagsOf(args: readonly string[], values: readonly string[], repeat: rea
305
375
  }
306
376
 
307
377
  const ADD_FLAGS = `flags:
308
- --title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same)
378
+ --title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same); the first version's names the thread, a next version's is its own caption (left out: the one before it)
379
+ --rename a next version's --title renames the thread too, on purpose: a trace line in the thread says so
309
380
  --what "<what>" what he sees now, one or two short lines: never the mechanics (why no before, an internal rename, how a count is computed)
310
381
  --post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
311
382
  --changelog "<category>: <line>" its change in the release being filled: on his approval it lands in .shipkit/releases/next.md with the version's after picture (the repo's guard reads it)
@@ -321,11 +392,9 @@ const ADD_FLAGS = `flags:
321
392
  --mesh <a.glb> a mesh he walks through, in the lightbox only; --image <poster.png> its still in the thread, else one shot now
322
393
  --before <a.png> --after <b.png> a before and after: two images, two clips of one size, or two sounds
323
394
  on an object of a kind: its states (a json file, or a git ref its kind reads, . the working tree); a kind whose page draws it gets a still of that page shot now, or --image <a.png> as that still; a state that names its "views" gets one still a view, --image <view>=<a.png> for one (repeat it)
324
- --live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url, never the hub's own
395
+ --live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url; a page of the hub itself: its shot and a link, never a frame
325
396
  --label "<label>" the first view's label
326
397
  --view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
327
- --choice the older form of a question: posts sk thread ask with each --view an option, and prints that form
328
- --pick <n> with --choice: the option you suggest, by its number from 1 (a letter or a label works too); the « my pick » pill
329
398
  --gallery "<label>" <a.png> … a grid he rates tile by tile (stars, OK, fix or no, a word), alone or beside other views; a tile is "[<row>/]<label>=[<before>,]<after>": a redraw carries its before, a row holds one asset's variants
330
399
  --trailer <cut.trailer> a trailer cut, played in the thread by the trailer entry's player, never a compiled clip; his notes land on its shots
331
400
  --version v<n> with --trailer: a kept version of that cut, else the cut's own render
@@ -337,7 +406,7 @@ const ADD_FLAGS = `flags:
337
406
  --commit <sha> the commit it shows
338
407
  --lane <id> the lane that made it; else SK_AGENT
339
408
  --wip "<what is still wrong>" a version sent in work: « in progress », no verdict asked; each step after: sk thread update <id> <broken|better|fixed> "<line>" <file>
340
- --on <address> the version's own address (page:review/lightbox, trailer:<name>/<cut>): it goes into the thread that owns it, one thread per address; a trailer or a draft names its own
409
+ --on <address> the version's own address (page:threads/lightbox, trailer:<name>/<cut>): it goes into the thread that owns it, one thread per address; a trailer or a draft names its own
341
410
  --about <address> another object it is about, a link that finds it (repeat it); never its thread
342
411
  --answers <id | live#3> the item it answers (a note he raised, a player's report), one thread (repeat it)
343
412
  --keeps "<what stays>" on a new version of an approved look: what of it stays
@@ -369,7 +438,7 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
369
438
  return null
370
439
  }
371
440
  const clash = ['image', 'video', 'audio', 'after', 'live'].filter((k) => o[k] !== undefined)
372
- if (clash.length > 0 || others) throw new Error(`--trailer: the version plays the cut; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery, --choice or --wip'} beside it`)
441
+ if (clash.length > 0 || others) throw new Error(`--trailer: the version plays the cut; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery or --wip'} beside it`)
373
442
  const { mkdtempSync, rmSync } = await import('node:fs')
374
443
  const { tmpdir } = await import('node:os')
375
444
  const { join } = await import('node:path')
@@ -393,18 +462,18 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
393
462
  export async function draftOfFlags(o: Record<string, string>, others: boolean, cwd: string = process.cwd()): Promise<import('../review/model.ts').ItemDraft | null> {
394
463
  if (o.draft === undefined) return null
395
464
  const clash = ['image', 'video', 'audio', 'before', 'after', 'label', 'live', 'trailer'].filter((k) => o[k] !== undefined)
396
- if (clash.length > 0 || others) throw new Error(`--draft: the version shows the draft itself; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery or --choice'} beside it`)
465
+ if (clash.length > 0 || others) throw new Error(`--draft: the version shows the draft itself; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view or --gallery'} beside it`)
397
466
  const [{ findRepoRoot }, { openDesk }, { draftItemOf }] = await Promise.all([import('../ts/config.ts'), import('../social/open.ts'), import('../review/draft-item.ts')])
398
467
  return draftItemOf((await openDesk(findRepoRoot(cwd))).desk, o.draft, cwd).item
399
468
  }
400
469
 
401
470
  /** --md <file | -> or --html <file | ->: the version's subject is that document, its text read now (`-` stdin); null
402
471
  * without either. Words, numbers and tables go this way, never as a picture of text */
403
- export async function docOfFlags(o: Record<string, string>, beside: { trailer: unknown; draft: unknown; states: unknown; choice: boolean; wip: boolean }, stdin: () => Promise<string> = () => new Response(Bun.stdin.stream()).text()): Promise<import('../review/model.ts').ItemDoc | null> {
472
+ export async function docOfFlags(o: Record<string, string>, beside: { trailer: unknown; draft: unknown; states: unknown; wip: boolean }, stdin: () => Promise<string> = () => new Response(Bun.stdin.stream()).text()): Promise<import('../review/model.ts').ItemDoc | null> {
404
473
  if (o.md !== undefined && o.html !== undefined) throw new Error('--md and --html: one document a version; markdown first, --html when markdown is not enough')
405
474
  const kind = o.md !== undefined ? 'md' : o.html !== undefined ? 'html' : null
406
475
  if (kind === null) return null
407
- const other = beside.trailer ? '--trailer' : beside.draft ? '--draft' : beside.states ? "an object's --before and --after states" : beside.choice ? '--choice' : beside.wip ? '--wip --live' : null
476
+ const other = beside.trailer ? '--trailer' : beside.draft ? '--draft' : beside.states ? "an object's --before and --after states" : beside.wip ? '--wip --live' : null
408
477
  if (other !== null) throw new Error(`--${kind}: a document is the version's subject, never with ${other}`)
409
478
  const path = o[kind]!
410
479
  const ext = kind === 'md' ? /\.(md|markdown|txt)$/i : /\.html?$/i
@@ -425,20 +494,19 @@ export async function docOfFlags(o: Record<string, string>, beside: { trailer: u
425
494
  }
426
495
 
427
496
  export class ReviewAddCommand extends Command {
428
- static override paths = [['thread', 'post'], ['review', 'add']]
497
+ static override paths = [['thread', 'post']]
429
498
  static essential = {}
430
499
  /** the flags its proxy reads, as its help lists them: what a doc may name (RV019) */
431
500
  static proxyFlags = [...new Set(ADD_FLAGS.match(/--[a-z][a-z0-9-]*/g) ?? [])]
432
501
  static override usage = Command.Usage({
433
502
  category: 'Review',
434
503
  description: "a version in the thread of its subject, by its address; it starts the thread; no media: words",
435
- details: `${DETAILS}\n\nsk thread post [<address> | <id>] <flags>. The address is the version's own (screen:<screen>, asset:<asset>, page:<page>, a kind of the repo's unit); --trailer and --draft name theirs, so it may be left out. An id names its thread. With no media, --title and --what are words: they start the thread, or are a reply in it. sk thread add is its older name.\n\n${ADD_FLAGS}`,
504
+ details: `${DETAILS}\n\nsk thread post [<address> | <id>] <flags>. The address is the version's own (screen:<screen>, asset:<asset>, page:<page>, a kind of the repo's unit); --trailer and --draft name theirs, so it may be left out. An id names its thread. With no media, --title and --what are words: they start the thread, or are a reply in it.\n\n${ADD_FLAGS}`,
436
505
  examples: [
437
506
  ['one image', 'sk thread post screen:menu --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
438
507
  ['a report with a table: markdown, never a picture of text', 'sk thread post page:hub/speed --title "the hub, before and after" --what "every click under 50 ms" --md report.md'],
439
508
  ['a before and after', 'sk thread post asset:lamps --title "lamps lit" --what "..." --before a.png --after b.png'],
440
- ['the next version: the same address, the tool links it', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
441
- ['a pick among three voices, yours on the second', 'sk thread post asset:narrator --choice --pick 2 --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
509
+ ['the next version: the same address, the tool links it, the thread keeps its name', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
442
510
  ['a 360° panorama he looks around in', 'sk thread post screen:hall --title "the hall in 360" --what "..." --pano hall-360.png'],
443
511
  ['a Gaussian splat he orbits, its poster shot now', 'sk thread post asset:hall --title "the hall as a splat" --what "..." --splat hall.ply'],
444
512
  ['icons he rates one by one', 'sk thread post asset:buff-icons --title "buff icons" --what "..." --gallery "icons" vitality=a.png haste=b.png greed=c.png'],
@@ -456,7 +524,6 @@ export class ReviewAddCommand extends Command {
456
524
  }
457
525
  return run(this.context, async (h) => {
458
526
  const { addItem, postUpdate, agentName } = await import('../review/store.ts')
459
- if (this.path[1] === 'add') h.err('sk thread add is now sk thread post [<address>]: the same flags')
460
527
  // `--wip "<what is still wrong>"`: a version sent in work, its first update still broken; a bare --wip goes with --live
461
528
  const w = this.args.indexOf('--wip')
462
529
  const wipLine = w >= 0 && this.args[w + 1] !== undefined && !this.args[w + 1]!.startsWith('--') ? this.args[w + 1] : undefined
@@ -467,17 +534,18 @@ export class ReviewAddCommand extends Command {
467
534
  const kindName = rest[rest.indexOf('--subject') + 1]
468
535
  const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
469
536
  const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
470
- const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'choice', 'keep', 'verdict'])
537
+ const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'keep', 'verdict', 'rename'])
471
538
  const o = f.one
539
+ // --what is one or two short lines: a wall goes as a document, --md, and needs no escape
540
+ const wall = o.what !== undefined ? (await import('../review/reply-guards.ts')).wallInWords(o.what, '--what', f.positionals[0] ?? '<address>', false) : null
541
+ if (wall !== null) throw new Error(wall)
472
542
  // --image repeats only as the stills of a kind's page, one a view (<view>=<a.png>)
473
543
  const images = f.many.image ?? []
474
544
  if (images.length === 1) o.image = images[0]!
475
- if (images.length > 1 && f.on.has('choice')) throw new Error('--choice: one --image, the first option; the others are --view')
476
545
  // the first word names the thread: an address (the version's own), or an id (its thread)
477
546
  const { addressOrThrow, canonicalAddress, ID_RE } = await import('../review/model.ts')
478
547
  const first = f.positionals[0]
479
- // post names its thread first; add's lone word is a title, unless it reads as an address
480
- const named = first !== undefined && (ID_RE.test(first) || canonicalAddress(first) !== null || (this.path[1] === 'post' && !MEDIA_FILE.test(first)))
548
+ const named = first !== undefined && (ID_RE.test(first) || canonicalAddress(first) !== null || !MEDIA_FILE.test(first))
481
549
  const target = named ? f.positionals.shift() : undefined
482
550
  if (target !== undefined && ID_RE.test(target)) {
483
551
  const { readAll } = await import('../review/store.ts')
@@ -495,25 +563,23 @@ export class ReviewAddCommand extends Command {
495
563
  if (o.on !== undefined && addressOrThrow(o.on) !== a) throw new Error(`${a} and --on ${o.on}: one address a version`)
496
564
  o.on = a
497
565
  }
498
- if (o.on !== undefined) await declaredOrThrow(h, addressOrThrow(o.on))
566
+ if (o.on !== undefined) o.on = await declaredOrThrow(h, addressOrThrow(o.on))
499
567
  for (const a of f.many.about ?? []) await declaredOrThrow(h, addressOrThrow(a))
500
568
  // a lone word is the title, as `sk ask <title>` takes it; a media file never is
501
569
  const [lone, ...more] = f.positionals
502
570
  if (lone !== undefined && more.length === 0 && o.title === undefined && !MEDIA_FILE.test(lone)) o.title = lone
503
571
  else if (lone !== undefined) throw new Error(`unexpected ${f.positionals.map(quoted).join(' ')}: the title is --title "<title>", the subject --image <a.png> (sk thread post --help)`)
504
- if (f.on.has('choice') && f.on.has('verdict')) throw new Error("--choice --verdict: a choice is a question, its pick is the owner's answer; post it without --verdict")
505
- if (lives.length > 0 && (f.on.has('choice') || o.trailer !== undefined || o.draft !== undefined || o.live !== undefined))
506
- throw new Error(`--live <url>: a view of a running page; never with ${f.on.has('choice') ? '--choice (ask, then post)' : o.trailer !== undefined ? '--trailer' : o.draft !== undefined ? '--draft' : '--wip --live <name>'}`)
507
- if (f.on.has('choice')) return choiceAsQuestion(h, o, views, f.many)
572
+ if (lives.length > 0 && (o.trailer !== undefined || o.draft !== undefined || o.live !== undefined))
573
+ throw new Error(`--live <url>: a view of a running page; never with ${o.trailer !== undefined ? '--trailer' : o.draft !== undefined ? '--draft' : '--wip --live <name>'}`)
508
574
  const states = await statesOfFlags(h, o, views.length > 0)
509
575
  if (images.length > 1 && !states) throw new Error('--image: one picture a version; it repeats as <view>=<a.png> only beside --after on a kind whose page draws views')
510
576
  // a version a kind's page draws shows its stills: the picture given wins over a shot of the page
511
577
  const still = states ? await stillOfFlags(h, o, states, images) : null
512
- const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
578
+ const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip'))
513
579
  // a draft's own address with no media draws the draft itself, as --draft does: never a version of words
514
580
  const ownDraft = o.on !== undefined ? /^draft:([^/]+)$/.exec(o.on) : null
515
581
  if (ownDraft && o.draft === undefined && views.length === 0 && [o.image, o.video, o.audio, o.pano, o.before, o.after, o.live, o.trailer].every((v) => v === undefined)) o.draft = ownDraft[1]!
516
- const draft = await draftOfFlags(o, views.length > 0 || f.on.has('choice'))
582
+ const draft = await draftOfFlags(o, views.length > 0)
517
583
  const repoFlags = Object.fromEntries(own.flatMap((k) => (f.many[k] ? [[k, f.many[k]]] : [])))
518
584
  const parsed = kind?.parse ? kind.parse(Object.fromEntries(Object.keys(kind.flags ?? {}).map((k) => [k, f.many[k] ?? []]))) : null
519
585
  if (wipLine !== undefined && o.live !== undefined) throw new Error('--wip "<line>" sends a version in work; --wip --live <name> a draft on a live shot: one of the two')
@@ -555,7 +621,7 @@ export class ReviewAddCommand extends Command {
555
621
  if (problems.length > 0) throw new Error(`--changelog: the repo's guard refuses it: ${problems.join('; ')}`)
556
622
  }
557
623
  const topic = o.topic ?? parsed?.topic
558
- const doc = await docOfFlags(o, { trailer, draft, states, choice: f.on.has('choice'), wip: o.live !== undefined })
624
+ const doc = await docOfFlags(o, { trailer, draft, states, wip: o.live !== undefined })
559
625
  let input: import('../review/store.ts').AddInput = {
560
626
  title: o.title ?? '',
561
627
  what: o.what ?? '',
@@ -585,12 +651,12 @@ export class ReviewAddCommand extends Command {
585
651
  ...(o.on ? { on: o.on } : {}),
586
652
  ...((f.many.about ?? []).length > 0 ? { about: f.many.about } : {}),
587
653
  ...(f.on.has('new') ? { fresh: true } : {}),
588
- ...(f.on.has('choice') ? { choice: true } : {}),
589
654
  ...(f.on.has('keep') ? { keep: true } : {}),
590
- ...(o.pick !== undefined ? { agentPick: o.pick } : {}),
655
+ ...(f.on.has('rename') ? { rename: true as const } : {}),
591
656
  ...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
592
657
  }
593
658
  const media = [o.image, o.video, o.audio, o.pano, o.splat, o.mesh, o.before, o.after, o.live, o.trailer, o.draft].some((v) => v !== undefined) || views.length > 0 || lives.length > 0 || states !== null || doc !== null
659
+ if (!media && input.on !== undefined && input.rename) throw new Error('--rename: a version renames its thread; words with no media are a reply in it and never rename it: post the version with its media, or leave --rename out')
594
660
  if (!media && input.on !== undefined) return postWords(h, input.on, input.title, input.what, input.lane, f.on.has('verdict'))
595
661
  // a version asks the owner's verdict always: the field says it, the flag changes nothing else
596
662
  if (f.on.has('verdict')) input = { ...input, asksVerdict: true }
@@ -616,6 +682,12 @@ export class ReviewAddCommand extends Command {
616
682
  })
617
683
  if (still) await keepStill(h, item, still)
618
684
  h.out(item.id)
685
+ if (item.rename !== true) {
686
+ const { readAll, captionLine } = await import('../review/store.ts')
687
+ const { membersOf, threadOfItem, threadsOf, threadTitle } = await import('../review/threads.ts')
688
+ const t = threadOfItem(item.id, threadsOf(readAll(h.dir).items, h.say.spec))
689
+ if (t !== null && membersOf(t).length > 1 && threadTitle(t).trim() !== item.title) h.err(captionLine(threadTitle(t).trim(), item.title))
690
+ }
619
691
  // on stderr: a script reads the id alone on stdout
620
692
  await saidIntoThread(h, item, o.supersedes !== undefined)
621
693
  if (wipLine !== undefined) {
@@ -651,11 +723,14 @@ export class ReviewAddCommand extends Command {
651
723
  }
652
724
  if (item.draft) h.out(`draft version: ${item.draft.slug}, ${item.draft.posts.length} place${item.draft.posts.length > 1 ? 's' : ''}: ${item.draft.posts.map((p) => p.name).join(', ')}`)
653
725
  if (item.origin.by === 'agent' && !item.origin.lane) h.err(`posted ${item.id} with no lane: on the next post pass --lane <id> (or SK_AGENT), so the hub colours it; never post this one again`)
654
- if (item.choice && item.agentPick === undefined) h.err(`a choice with no pick of yours: every question carries one, sk thread pick ${item.id} <view> (or --pick on post)`)
655
726
  const { unheardLine } = await import('../review/model.ts')
656
727
  const { liveWatchers } = await import('../review/watchers.ts')
657
728
  const unheard = unheardLine(item, liveWatchers(h.dir))
658
729
  if (unheard) h.err(unheard)
730
+ // last: the page he could open from the thread, when its kind runs one
731
+ const { liveHint } = await import('../review/live-post.ts')
732
+ const hint = liveHint(address, h.say.spec, { id: item.id, media, live: lives.length > 0 || o.live !== undefined })
733
+ if (hint) h.err(hint)
659
734
  return 0
660
735
  })
661
736
  }
@@ -758,35 +833,11 @@ async function keepStill(h: Here, item: import('../review/model.ts').Item, still
758
833
  }
759
834
  }
760
835
 
761
- /** `post --choice`, the older form of a question with media options: each view an option (its note after its label),
762
- * the title and what its words, posted as the question into the address's thread; it prints the `ask` form */
763
- async function choiceAsQuestion(h: Here, o: Record<string, string>, views: readonly ViewInput[], many: Record<string, string[]>): Promise<number> {
764
- const versionOnly = ['changelog', 'rating', 'post', 'keeps', 'supersedes', 'trailer', 'draft', 'live', 'why'].filter((k) => o[k] !== undefined)
765
- if (many.answers?.length) versionOnly.push('answers')
766
- if (versionOnly.length > 0) throw new Error(`--choice is a question now, and a question takes no ${versionOnly.map((k) => `--${k}`).join(', ')}: ask, then post the version once he picked`)
767
- if (views.some((v) => v.gallery)) throw new Error('--choice: a gallery is no option; a set he rates one by one stays a gallery version, a row per asset')
768
- if (o.on === undefined) throw new Error(NO_ADDRESS)
769
- const first = o.image ?? o.video ?? o.audio
770
- const all: ViewInput[] = [...(first !== undefined ? [{ label: o.label ?? 'option 1', image: first }] : o.before !== undefined && o.after !== undefined ? [{ label: o.label ?? 'option 1', before: o.before, after: o.after }] : []), ...views]
771
- const options = all.map((v) => ({ label: v.note?.trim() ? `${v.label}: ${v.note.trim()}` : v.label, files: v.before !== undefined && v.after !== undefined ? [v.before, v.after] : [v.image ?? v.video ?? v.audio ?? ''] }))
772
- const { viewIndexOf } = await import('../review/model.ts')
773
- const pick = o.pick === undefined ? undefined : /^\d+$/.test(o.pick) ? Number(o.pick) - 1 : viewIndexOf(all, o.pick)
774
- const text = [o.title, o.what].filter((x) => x?.trim()).join('\n') || 'which one ?'
775
- const form = `sk thread ask ${o.on} ${quoted(text.split('\n')[0]!)} ${options.map((x) => `--option ${quoted(`${x.label}=${x.files.join(',')}`)}`).join(' ')}${pick !== undefined ? ` --pick ${pick + 1}` : ''}`
776
- h.err(`post --choice is now a question: ${form}`)
777
- if (pick === undefined) h.err('no --pick: the house rule wants your pick on every question')
778
- const { postAsk } = await import('../review/store.ts')
779
- const as = o.lane
780
- const id = await idOrOpen(h, o.on, o.title ?? text, as)
781
- const m = await postAsk(h.dir, id, { who: actor(as, false, 'ask'), text, options, ...(pick !== undefined ? { pick } : {}) })
782
- h.out(`${id} asked: ${m.ask?.options.map((x, i) => `${i + 1} ${x}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
783
- return 0
784
- }
785
-
786
836
  async function saidIntoThread(h: Here, item: import('../review/model.ts').Item, typed: boolean): Promise<void> {
787
837
  const { readAll } = await import('../review/store.ts')
788
838
  const { ownAddressOf, verdictOf } = await import('../review/model.ts')
789
- const { openNotesOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
839
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
840
+ const { openNotesOf } = await import('../review/thread-state.ts')
790
841
  const items = readAll(h.dir).items
791
842
  const t = threadOfItem(item.id, threadsOf(items, h.say.spec))
792
843
  const own = ownAddressOf(item, h.say.spec)
@@ -820,8 +871,27 @@ async function postWords(h: Here, address: string, title: string, what: string,
820
871
  }
821
872
 
822
873
  /** an agent's words in a thread, its image beside them; `verdict`: they wait for the owner's verdict (review/verdict-items.ts) */
823
- async function wordsIn(dir: string, id: string, who: string, text: string, verdict: boolean, image?: string): Promise<import('../review/model.ts').Message> {
874
+ /** an agent's words to the owner pass the wall guard, `long` the reason they may not; a hint when many lines carry no marker
875
+ * (review/reply-guards.ts) */
876
+ async function guardWords(h: { err: (s: string) => void }, text: string, verb: string, address: string, long: string | undefined): Promise<void> {
877
+ const { unmarkedHint, wallInWords } = await import('../review/reply-guards.ts')
878
+ if (long !== undefined && long.trim() === '') throw new Error('--long "<why>": the reason it is long, shown in the thread')
879
+ const wall = long === undefined ? wallInWords(text, verb, address) : null
880
+ if (wall !== null) throw new Error(wall)
881
+ const hint = unmarkedHint(text)
882
+ if (hint !== null) h.err(hint)
883
+ }
884
+
885
+ const LONG_FLAG = 'past the wall bound on purpose: why, a quiet mark under the words in the thread; a long text is a document (sk thread post <address> --md <file>)'
886
+
887
+ async function wordsIn(dir: string, id: string, who: string, text: string, verdict: boolean, image?: string, long?: string): Promise<import('../review/model.ts').Message> {
824
888
  const { addMessage, appendMessage, readItem } = await import('../review/store.ts')
889
+ if (long !== undefined) {
890
+ const { textOf } = await import('../review/model.ts')
891
+ const t = textOf(text)
892
+ if ('error' in t) throw new Error(t.error)
893
+ return appendMessage(dir, id, { who, text: t.text, long: long.trim(), ...(verdict ? { asksVerdict: true as const } : {}) }, image !== undefined ? { image } : {})
894
+ }
825
895
  if (!verdict) return addMessage(dir, id, who, text, image)
826
896
  const { textOf } = await import('../review/model.ts')
827
897
  if (!readItem(dir, id)) throw new Error(`no item ${id}`)
@@ -830,12 +900,32 @@ async function wordsIn(dir: string, id: string, who: string, text: string, verdi
830
900
  return appendMessage(dir, id, { who, text: t.text, asksVerdict: true }, image !== undefined ? { image } : {})
831
901
  }
832
902
 
903
+ /** what an agent asked in the thread of item `id` that still waits on the owner after its reply `mine`: a plain reply of his
904
+ * answers nothing, so each line left is one his control answers or its agent takes back; never left open under a reply
905
+ * that says nothing more is needed */
906
+ async function stillOpenLines(dir: string, id: string, mine: string): Promise<string[]> {
907
+ const { readAll } = await import('../review/store.ts')
908
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
909
+ const { openAsksOf, openItemVerdictsOf } = await import('../review/thread-state.ts')
910
+ const t = threadOfItem(id, threadsOf(readAll(dir).items))
911
+ if (t === null) return []
912
+ const open = [...openAsksOf(t), ...openItemVerdictsOf(t)].filter((m) => m.id !== mine)
913
+ if (open.length === 0) return []
914
+ const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
915
+ return [
916
+ ` ${open.length} still wait${open.length > 1 ? '' : 's'} on the owner in this thread: the owner's click answers ${open.length > 1 ? 'each' : 'it'}; when the owner's plain words settled it, sk thread withdraw <id> --chat "<the owner's words>"; when it asks nothing more, sk thread withdraw <id> --why "<why>"`,
917
+ ...open.map((m) => ` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`),
918
+ ]
919
+ }
920
+
833
921
  /** `--verdict` on a posting verb: it waits for the owner's verdict (wiki tools/shipkit/threads-how-it-fits.md, The model) */
834
922
  const VERDICT_FLAG = "it waits for the owner's verdict (approve, fix, reject on it in the hub, « judge » in the inbox): a thing made that the owner approves before it ships or lands; a choice of what to do is a question, a visible change a version, never on a progress line"
835
923
 
836
924
  export class ReviewAddViewCommand extends Command {
837
- static override paths = [['review', 'add-view']]
925
+ static override paths = [['thread', 'add-view']]
838
926
  static essential = {}
927
+ /** the flags its proxy reads, as its usage lists them: what a doc may name (RV019) */
928
+ static proxyFlags = [...new Set(ADD_VIEW_USAGE.match(/--[a-z][a-z0-9-]*/g) ?? [])]
839
929
  static override usage = Command.Usage({
840
930
  category: 'Review',
841
931
  description: 'another angle on a version he has not answered yet: an image, a pair, a clip or a gallery',
@@ -844,6 +934,7 @@ export class ReviewAddViewCommand extends Command {
844
934
  ['a view from above', 'sk thread add-view <id> "from above" top.png'],
845
935
  ['a before and after', 'sk thread add-view <id> --label "on a phone" --before a.png --after b.png'],
846
936
  ['a 360° panorama', 'sk thread add-view <id> --label "inside" --pano hall-360.png'],
937
+ ['the running page, framed', 'sk thread add-view <id> --live http://localhost:5173/settings'],
847
938
  ],
848
939
  })
849
940
  args = Option.Proxy()
@@ -855,9 +946,13 @@ export class ReviewAddViewCommand extends Command {
855
946
  return run(this.context, async (h) => {
856
947
  const { addViewAlso } = await import('../review/store.ts')
857
948
  const keep = this.args.includes('--keep')
858
- const a = await addViewArgs(this.args.filter((x) => x !== '--keep'), Object.keys(h.unit?.flags ?? {}))
949
+ const { liveViews, takeLives } = await import('../review/live-post.ts')
950
+ const { lives, rest } = takeLives(this.args.filter((x) => x !== '--keep'))
951
+ const a = lives.length > 0 ? addViewLive(rest, lives) : await addViewArgs(rest, Object.keys(h.unit?.flags ?? {}))
859
952
  const id = await idOf(h.dir, a.id)
860
- const posted = await withPoster(a.view)
953
+ // a live page asked and shot now, as post does: its shot is the view, its page beside it
954
+ const shot = lives.length > 0 ? await liveViews(lives) : null
955
+ const posted = shot ? { view: { ...shot.views[0]!, label: a.view.label }, drop: shot.drop } : await withPoster(a.view)
861
956
  const v = posted.view
862
957
  const extra = h.unit?.addView ? await h.unit.addView(v, a.repoFlags) : {}
863
958
  const { item, added } = await addViewAlso(h.dir, id, v, { ...extra, ...(keep ? { keep: true } : {}) }).finally(posted.drop)
@@ -873,7 +968,7 @@ export class ReviewAddViewCommand extends Command {
873
968
  }
874
969
 
875
970
  export class ReviewLsCommand extends Command {
876
- static override paths = [['review'], ['review', 'ls']]
971
+ static override paths = [['thread'], ['thread', 'ls']]
877
972
  static override usage = Command.Usage({
878
973
  category: 'Review',
879
974
  description: "the active threads: status, thread id, title, address; `sk thread <verb>` runs a unit's verb",
@@ -895,7 +990,7 @@ export class ReviewLsCommand extends Command {
895
990
  const v = verbs[verb]
896
991
  if (!v) {
897
992
  const { typoOf } = await import('./family-help.ts')
898
- const own = this.cli.definitions().map((d) => d.path.split(' ')).filter((w) => w[1] === 'review' && w.length === 3).map((w) => w[2]!)
993
+ const own = this.cli.definitions().map((d) => d.path.split(' ')).filter((w) => w[1] === 'thread' && w.length === 3).map((w) => w[2]!)
899
994
  const close = typoOf(verb, [...own, ...Object.keys(verbs)], 2)
900
995
  throw new Error(`no verb « ${verb} »: ${close.length > 0 ? `did you mean ${close.map((c) => `sk thread ${c}`).join(', ')} ? ` : ''}sk thread --help lists sk's own; the repo's unit declares ${Object.keys(verbs).join(', ') || 'none'}`)
901
996
  }
@@ -912,16 +1007,21 @@ export class ReviewLsCommand extends Command {
912
1007
  this.context,
913
1008
  async (h) => {
914
1009
  const { readAll } = await import('../review/store.ts')
915
- const { isActive, orderedThreads, statusOf } = await import('../review/threads.ts')
1010
+ const { orderedThreads, threadState } = await import('../review/thread-state.ts')
916
1011
  const all = readAll(h.dir)
917
1012
  for (const b of all.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
918
- const threads = orderedThreads(all.items).filter((t) => every || isActive(t))
1013
+ const now = new Date()
1014
+ const threads = orderedThreads(all.items)
1015
+ .map((t) => ({ t, s: threadState(t, now) }))
1016
+ .filter((x) => every || x.s.active)
919
1017
  if (threads.length === 0) h.out(every ? 'review: the store is empty' : 'review: nothing active (--all shows every thread)')
920
1018
  const { ownAddressesOf, threadIdOf, threadTitle } = await import('../review/threads.ts')
921
1019
  // the thread's own id, never an item's: the items' ids are `sk thread show <thread>`'s
922
- for (const t of threads) {
1020
+ // whose move first (his with what he does, the agents', aside, done), then the head's status
1021
+ for (const { t, s } of threads) {
923
1022
  const at = ownAddressesOf(t)[0]
924
- h.out(`${statusOf(t.head, all.items).padEnd(17)} ${threadIdOf(t)} ${threadTitle(t)}${t.versions.length > 1 ? ` (v${t.versions.length})` : ''}${at ? ` ${at}` : ''}`)
1023
+ const move = s.turn === 'yours' || s.turn === 'aside' ? `${s.turn} ${s.wait}` : s.turn
1024
+ h.out(`${move.padEnd(13)} ${s.status.padEnd(17)} ${threadIdOf(t)} ${threadTitle(t)}${t.versions.length > 1 ? ` (v${t.versions.length})` : ''}${at ? ` ${at}` : ''}`)
925
1025
  }
926
1026
  return all.broken.length > 0 ? 1 : 0
927
1027
  },
@@ -931,16 +1031,18 @@ export class ReviewLsCommand extends Command {
931
1031
  }
932
1032
 
933
1033
  export class ReviewShowCommand extends Command {
934
- static override paths = [['review', 'show']]
1034
+ static override paths = [['thread', 'show']]
935
1035
  static essential = { args: '<address | id>' }
936
1036
  static override usage = Command.Usage({
937
1037
  category: 'Review',
938
1038
  description: 'one item and its thread: the verdict, rectangles, reactions, the whole conversation',
939
- details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same).`,
940
- examples: [['hand a thread to another session', 'sk thread show <id> --paste']],
1039
+ details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3); an ask by its number too (ask:21). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same). --md prints the whole thread as markdown, oldest first, each object whole (an ask's instructions as their source, the text sk ask edit writes), a superseded one in one line.`,
1040
+ examples: [['hand a thread to another session', 'sk thread show <id> --paste'], ['ask 21 as markdown, its instructions as their source', 'sk thread show ask:21 --md']],
941
1041
  })
942
1042
  id = Option.String({ name: 'address | id' })
943
1043
  paste = Option.Boolean('--paste', false, { description: 'the block another agent session acts on: title, repo, this command, the links' })
1044
+ md = Option.Boolean('--md', false, { description: 'the whole thread as markdown: its facts, then every item and message oldest first, each object whole, a superseded one in one line' })
1045
+ all = Option.Boolean('--all', false, { description: 'every message, past a recap he accepted too: a thread with one reads from it, what still waits or is owed before it kept' })
944
1046
 
945
1047
  async execute(): Promise<number> {
946
1048
  return run(this.context, async (h) => {
@@ -955,17 +1057,44 @@ export class ReviewShowCommand extends Command {
955
1057
  const { dirname } = await import('node:path')
956
1058
  const { pasteHosts, threadUrl } = await import('../review/paste.ts')
957
1059
  const { pasteBlock, STATUS_LABEL } = await import('../review/model.ts')
958
- const { statusOf } = await import('../review/threads.ts')
1060
+ const { statusOf } = await import('../review/thread-state.ts')
959
1061
  const w = await pasteHosts(dirname(dirname(h.dir)))
960
1062
  h.out(pasteBlock(x.item, STATUS_LABEL[statusOf(x, all.items)], { root: w.root, open: threadUrl(w.open, x.item.id), phone: w.phone ? threadUrl(w.phone, x.item.id) : null }))
961
1063
  return 0
962
1064
  }
963
1065
  const t = threadOfItem(x.item.id, threadsOf(all.items))
1066
+ // who the thread is shared with, read from the advisors' store at their times (advisors/share-trace.ts)
1067
+ const { dirname } = await import('node:path')
1068
+ const { ownAddressOf } = await import('../review/model.ts')
1069
+ const { shareLine, threadShareEvents } = await import('../advisors/share-trace.ts')
1070
+ const address = t === null ? null : ownAddressOf(t.head.item, h.say.spec)
1071
+ const shared = address === null ? [] : await threadShareEvents({ root: dirname(dirname(h.dir)), address })
1072
+ // the drive shares the owner's words name, each with its words and the command that lists it (drives/named.ts)
1073
+ const { membersOf } = await import('../review/threads.ts')
1074
+ const { sharesNamed } = await import('../drives/named.ts')
1075
+ const texts = (t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => (m.text === undefined ? [] : [m.text])))
1076
+ if (this.md) {
1077
+ if (t === null) throw new Error(`${this.id} reads in no thread`)
1078
+ const { threadMarkdown } = await import('../review/thread-md.ts')
1079
+ const { withThreadLook } = await import('../review/refs.ts')
1080
+ const md = withThreadLook(h.say.look, () => threadMarkdown(t, mediaDir(h.dir), h.say.spec, shared.map((e) => ({ at: e.at, md: `- ${shareLine(e)}` })), { all: this.all })).replace(/\n$/, '')
1081
+ h.out(md)
1082
+ const named = sharesNamed(dirname(dirname(h.dir)), texts, true)
1083
+ if (named !== null) h.out(`\n${named}`)
1084
+ // a long read: the agent may offer him a recap, never write one unasked (review/recap.ts)
1085
+ const { offerLine, offersRecap } = await import('../review/recap.ts')
1086
+ const { threadState } = await import('../review/thread-state.ts')
1087
+ const bytes = Buffer.byteLength(md)
1088
+ if (!this.all && offersRecap(bytes, threadState(t).recap)) h.err(`review: ${offerLine(bytes, address ?? x.item.id)}`)
1089
+ return 0
1090
+ }
964
1091
  // the paths it prints are on the disk: a message's image or file the purge let go comes back first
965
1092
  const { ensureLocal } = await import('../review/media-read.ts')
966
- const { membersOf } = await import('../review/threads.ts')
967
1093
  await Promise.all((t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => [...(m.image ? [m.image] : []), ...(m.files ?? []).map((g) => g.file)].map((n) => ensureLocal(h.dir, y.item.id, `thread/${n}`).catch((e: Error) => h.err(`review: WARN thread/${n}: ${e.message}`))))))
968
- h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, h.say) : detail(x, mediaDir(h.dir), true, false, h.say))
1094
+ h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, { ...h.say, all: this.all }) : detail(x, mediaDir(h.dir), true, false, h.say))
1095
+ if (shared.length > 0) h.out([' shared with people outside (the advisors):', ...shared.map((e) => ` ${shareLine(e)}`)].join('\n'))
1096
+ const named = sharesNamed(dirname(dirname(h.dir)), texts)
1097
+ if (named !== null) h.out(named)
969
1098
  return 0
970
1099
  })
971
1100
  }
@@ -982,7 +1111,7 @@ async function sessionOf(mine: boolean, session: string | undefined): Promise<st
982
1111
  }
983
1112
 
984
1113
  export class ReviewInboxCommand extends Command {
985
- static override paths = [['review', 'inbox']]
1114
+ static override paths = [['thread', 'inbox']]
986
1115
  static essential = {}
987
1116
  static override usage = Command.Usage({
988
1117
  category: 'Review',
@@ -1007,7 +1136,8 @@ export class ReviewInboxCommand extends Command {
1007
1136
  // as a hook: the same run as the hook's own boot (cli.ts)
1008
1137
  if (input != null) return (await import('./inbox-hook-run.ts')).inboxHook(h, input)
1009
1138
  const { selectInbox, selectedText } = await import('../review/inbox-read.ts')
1010
- const { followedIds, hears, listenersOf, sinceHeLeft, threadByItem, threadsOf } = await import('../review/threads.ts')
1139
+ const { followedIds, hears, listenersOf, threadByItem, threadsOf } = await import('../review/threads.ts')
1140
+ const { sinceHeLeft } = await import('../review/thread-state.ts')
1011
1141
  const { untakenLine } = await import('../review/format.ts')
1012
1142
  const { liveWatchers } = await import('../review/watchers.ts')
1013
1143
  await pull(h)
@@ -1027,20 +1157,31 @@ export class ReviewInboxCommand extends Command {
1027
1157
  const mine = { ...here, say: { ...here.say, to: (x: import('../review/model.ts').ReviewItem, m: import('../review/model.ts').Message) => wordReaches({ session, lane }, x, m, named, parties) } }
1028
1158
  const sel = selectInbox(mine, (x, byItem) => hears({ session, lane }, x, byItem, parties), { all: this.all, subject: this.subject })
1029
1159
  if (sel.threads.length === 0 && sel.news.length === 0) h.out('review: no unseen feedback or reply')
1030
- for (const g of sel.threads) h.out(`${selectedText(mine, g)}\n`)
1031
- const { ownAddressOf, verdictOf } = await import('../review/model.ts')
1160
+ const { oncePerBurst } = await import('../review/speaker.ts')
1161
+ const noted = oncePerBurst()
1162
+ for (const g of sel.threads) h.out(noted(`${selectedText(mine, g)}\n`))
1163
+ const { STATUS_LABEL, TONE_ASKS, verdictOf } = await import('../review/model.ts')
1164
+ // each tone says what it owes (model.ts TONE_ASKS), then the way out of any of them
1032
1165
  const owedLine = (t: (typeof sel.owed)[number]): string => {
1033
1166
  const x = t.head
1034
- const fix = verdictOf(x)?.status === 'approved-with-fix'
1035
- const close = fix ? `sk thread fixed ${x.item.id} "<what changed>"` : `its next version, sk thread post ${ownAddressOf(x.item, h.say.spec) ?? x.item.id} …`
1036
- return ` ${x.item.id} ${fix ? 'ok with a fix' : 'rejected'} "${x.item.title}": ${close}, or sk thread wontfix ${x.item.id} --note "<why>"`
1167
+ const v = verdictOf(x)?.status ?? 'rework'
1168
+ return ` ${x.item.id} ${STATUS_LABEL[v]} "${x.item.title}": ${TONE_ASKS[v].replace('<id>', x.item.id)}; or sk thread wontfix ${x.item.id} --note "<why>"`
1037
1169
  }
1038
1170
  if (sel.owed.length > 0) h.out(`owed, read and not done:\n${sel.owed.map(owedLine).join('\n')}\n`)
1171
+ // the threads this process's session or lane holds whose move is the agents' (review/inbox-read.ts heldOwedLines)
1172
+ const { sessionId } = await import('../review/store.ts')
1173
+ const holder = { session: session ?? sessionId(), lane: lane ?? callerLane(undefined) }
1174
+ if (holder.session !== null || holder.lane !== null) {
1175
+ const { heldOwedLines } = await import('../review/inbox-read.ts')
1176
+ const shown = new Set([...sel.threads.flatMap((g) => (g.t ? [g.t.head.item.id] : [])), ...sel.owed.map((t) => t.head.item.id)])
1177
+ const held = heldOwedLines(here, holder, parties ?? (await partiesFor([here], holder.session)), shown)
1178
+ if (held.length > 0) h.out(`yours to close, nobody at work on them:\n${held.join('\n')}\n`)
1179
+ }
1039
1180
  const watchers = liveWatchers(h.dir)
1040
1181
  const byItem = threadByItem(threadsOf(here.items, h.say.spec))
1041
1182
  const followed = followedIds(here.items)
1042
1183
  const untaken = here.items.flatMap((x) => {
1043
- const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, new Date(), h.say.spec.dispatcher)
1184
+ const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, new Date())
1044
1185
  return why === null ? [] : [untakenLine(x, why, null)]
1045
1186
  })
1046
1187
  if (untaken.length > 0) h.out(`not taken:\n${untaken.join('\n')}\n`)
@@ -1072,6 +1213,19 @@ async function seenRefused(dir: string, id: string, as: string | undefined): Pro
1072
1213
  return { refused: seenRefusal(x, t, me, parties), ...(only !== undefined ? { only } : {}) }
1073
1214
  }
1074
1215
 
1216
+ /** what is expected of the owner on the thread of item `id` now (review/expect.ts expectOf, the band the hub's lists
1217
+ * read too): an agent's words never contradict it */
1218
+ async function headLine(dir: string, id: string): Promise<string | null> {
1219
+ const { readAll } = await import('../review/store.ts')
1220
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
1221
+ const { expectOf } = await import('../review/expect.ts')
1222
+ const { threadState } = await import('../review/thread-state.ts')
1223
+ const t = threadOfItem(id, threadsOf(readAll(dir).items))
1224
+ if (t === null) return null
1225
+ const { parties } = await callerParties(dir, t, undefined)
1226
+ return `expected of the owner now: « ${expectOf(threadState(t), parties).words} »: your words never say otherwise`
1227
+ }
1228
+
1075
1229
  /** the caller and the parties its thread's holder names */
1076
1230
  async function callerParties(dir: string, t: import('../review/threads.ts').Thread | null, as: string | undefined): Promise<{ me: import('../review/parties.ts').Me; parties: import('../review/parties.ts').Parties }> {
1077
1231
  const { sessionId } = await import('../review/store.ts')
@@ -1127,7 +1281,7 @@ export async function mayHoldItem(dir: string, id: string, as?: string): Promise
1127
1281
  }
1128
1282
 
1129
1283
  export class ReviewSeenCommand extends Command {
1130
- static override paths = [['review', 'seen']]
1284
+ static override paths = [['thread', 'seen']]
1131
1285
  static essential = { args: '<address | ids>' }
1132
1286
  static override usage = Command.Usage({ category: 'Review', description: 'mark his new words read as you read them: by id, or a whole thread by its address', details: DETAILS })
1133
1287
  ids = Option.Rest({ required: 1, name: 'address | id' })
@@ -1158,11 +1312,19 @@ export class ReviewSeenCommand extends Command {
1158
1312
  const refused = scopes.map((s) => s.refused).filter((w) => w !== null)
1159
1313
  if (refused.length > 0) throw new Error(`nothing marked: ${refused.join('; ')}`)
1160
1314
  let bad = 0
1315
+ const { readItem } = await import('../review/store.ts')
1316
+ const { wordText } = await import('../review/format.ts')
1161
1317
  for (const [i, [ref, id]] of ids.entries()) {
1162
- if (markSeen(h.dir, id, new Date(), scopes[i]!.only)) h.out(`${ref}: seen`)
1163
- else {
1318
+ const at = new Date()
1319
+ if (markSeen(h.dir, id, at, scopes[i]!.only)) {
1320
+ // each word the mark names, so a thread marked by its address is read, never skipped
1321
+ const x = readItem(h.dir, id)
1322
+ const mark = x?.thread.find((m) => m.op === 'seen' && m.at === at.toISOString() && m.who !== 'owner')
1323
+ const words = (mark?.of ?? []).flatMap((w) => x?.thread.find((m) => m.id === w) ?? [])
1324
+ h.out(`${ref}: seen${words.length > 0 ? `, ${words.length} word${words.length > 1 ? 's' : ''}` : ''}`)
1325
+ for (const m of words) h.out(` ${wordText(m)}`)
1326
+ } else {
1164
1327
  // say which: an item that does not exist, none of the owner's words on it is the caller's, or none unseen
1165
- const { readItem } = await import('../review/store.ts')
1166
1328
  const why = readItem(h.dir, id) === null ? 'no such item' : scopes[i]!.only?.length === 0 ? `none of the owner's words on it is yours to mark: its holder marks them, or take it first (sk thread take ${ref})` : 'nothing of the owner unseen on it'
1167
1329
  h.err(`FAIL: review: ${ref}: ${why}`)
1168
1330
  bad++
@@ -1182,12 +1344,16 @@ export class ThreadWorkingCommand extends Command {
1182
1344
  static override usage = Command.Usage({
1183
1345
  category: 'Review',
1184
1346
  description: 'say you are on his new words in a thread, one line of what you do now; your next act there ends it',
1185
- details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for 2 h. A read with no act after it keeps his word owed: a turn's end holds on it. Never written for you: no watch, beat or hook says it (wiki tools/shipkit/threads-how-it-fits.md, Read and on it).`,
1186
- examples: [['on it', 'SK_AGENT=L29 sk thread working page:backup "backing up the key in OpenBao"']],
1347
+ details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for 30 min: past it the thread reads « waiting for an agent », its row « said working <age> ago, nothing since », and a longer piece of work says working again. A read with no act after it keeps his word owed: a turn's end holds on it. A working line answers nothing: one that only acknowledges his answer to a question or a pick (« noted », « ok », « I collect your picks ») is refused, and sk thread reply answers it. Never written for you: no watch, beat or hook says it (wiki tools/shipkit/threads-how-it-fits.md, Read and on it).`,
1348
+ examples: [
1349
+ ['on it', 'SK_AGENT=L29 sk thread working page:backup "backing up the key in OpenBao"'],
1350
+ ['the next version promised: v1 asks no verdict meanwhile, late past the time', 'SK_AGENT=L29 sk thread working page:plans/x "v2: the plan with your picks" --next 2026-11-30'],
1351
+ ],
1187
1352
  })
1188
1353
  ref = Option.String({ name: 'address | id' })
1189
1354
  line = Option.String()
1190
1355
  as = Option.String('--as', { description: 'the lane on it (else SK_AGENT)' })
1356
+ next = Option.String('--next', { description: 'you promise the next version by then: a span (90m, 4h, 3d) or a time (2026-11-30, 2026-11-30T18:00); the version before it asks no verdict meanwhile, and past that time the thread says the promise is late, naming you' })
1191
1357
 
1192
1358
  async execute(): Promise<number> {
1193
1359
  return run(this.context, async (h) => {
@@ -1198,9 +1364,164 @@ export class ThreadWorkingCommand extends Command {
1198
1364
  const { threadOfItem, threadsOf } = await import('../review/threads.ts')
1199
1365
  const id = await idOf(h.dir, this.ref)
1200
1366
  const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
1367
+ if (t !== null) {
1368
+ const no = (await import('../review/working-guards.ts')).workingRefusal(t, line, this.ref)
1369
+ if (no !== null) throw new Error(no)
1370
+ }
1201
1371
  const who = callerLane(this.as) ?? 'agent'
1202
- appendMessage(h.dir, t?.head.item.id ?? id, { who, op: 'working', note: line })
1203
- h.out(`${this.ref}: ${who} is on it: ${line} (your next act in this thread ends it)`)
1372
+ const until = this.next === undefined ? null : (await import('../review/expect.ts')).promiseUntil(this.next)
1373
+ if (until !== null && 'error' in until) throw new Error(until.error)
1374
+ appendMessage(h.dir, t?.head.item.id ?? id, { who, op: 'working', note: line, ...(until !== null ? { next: { until: until.until } } : {}) })
1375
+ h.out(until !== null ? `${this.ref}: ${who} promises the next version by ${until.until}: ${line} (your next version ends it; past that time the thread says it is late)` : `${this.ref}: ${who} is on it: ${line} (your next act in this thread ends it)`)
1376
+ const said = await headLine(h.dir, t?.head.item.id ?? id)
1377
+ if (said !== null) h.out(said)
1378
+ return 0
1379
+ })
1380
+ }
1381
+ }
1382
+
1383
+ export class ThreadTagCommand extends Command {
1384
+ static override paths = [['thread', 'tag']]
1385
+ static override usage = Command.Usage({
1386
+ category: 'Review',
1387
+ description: "a thread's tags: lowercase words that sort and find threads; with no tag, the tags it has",
1388
+ details: `${DETAILS}\n\nA tag is a lowercase word of letters, digits and dashes (ux, login-flow). +<tag> or a bare <tag> adds it, -<tag> takes it away; the thread's tags print after. The owner sets them from the thread's head in the hub; the list's search and ⌘P find them with t:<tag> (wiki tools/shipkit/threads-store.md, Tags). A tag change is a write of the thread's oldest item's head, carried to every machine like any other.`,
1389
+ examples: [['tag a thread', 'sk thread tag k7m2 +ux +login'], ['take one away', 'sk thread tag screen:orders/list -old'], ['its tags', 'sk thread tag k7m2']],
1390
+ })
1391
+ ref = Option.String({ name: 'address | id | code' })
1392
+ edits = Option.Rest({ name: 'tags' })
1393
+
1394
+ async execute(): Promise<number> {
1395
+ return run(this.context, async (h) => {
1396
+ const { tagEdits } = await import('../review/thread-query.ts')
1397
+ const { readAll, setThreadTags } = await import('../review/store.ts')
1398
+ const { threadOfItem, threadsOf, membersOf } = await import('../review/threads.ts')
1399
+ const { tagsOfItems } = await import('../review/thread-query.ts')
1400
+ const id = await idOf(h.dir, this.ref)
1401
+ const e = tagEdits(this.edits)
1402
+ const tags = e.add.length + e.remove.length === 0 ? tagsOfItems(membersOf(threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))!)) : setThreadTags(h.dir, id, e)
1403
+ h.out(`${this.ref}: ${tags.length === 0 ? 'no tag' : tags.map((t) => `t:${t}`).join(' ')}`)
1404
+ return 0
1405
+ })
1406
+ }
1407
+ }
1408
+
1409
+ export class ThreadRenameCommand extends Command {
1410
+ static override paths = [['thread', 'rename']]
1411
+ static essential = { args: '<address | id> "<title>"' }
1412
+ static override usage = Command.Usage({
1413
+ category: 'Review',
1414
+ description: 'rename a thread on purpose, when asked in it too: a trace line says who renamed it from what to what',
1415
+ details: `${DETAILS}\n\nA thread's name is its first title (the opening words, else its first version's) until a rename on purpose: this verb, a version posted with --rename, or the owner's double click on the title at the thread's head. Never a second thread for the same conversation. The thread shows « <who> renamed the thread: « old » → « new » ». An ask's thread is named by its instructions (sk ask edit).`,
1416
+ examples: [['asked « rename the thread to something meaningful »', 'SK_AGENT=L4 sk thread rename talk:20261128-a-new-thread-233927 "Avoirs normalisés : le plan"']],
1417
+ })
1418
+ ref = Option.String({ name: 'address | id' })
1419
+ title = Option.String({ name: 'title' })
1420
+ as = Option.String('--as', { description: 'who renames it (else SK_AGENT)' })
1421
+
1422
+ async execute(): Promise<number> {
1423
+ return run(this.context, async (h) => {
1424
+ const { renameThread } = await import('../review/close.ts')
1425
+ const id = await idOf(h.dir, this.ref)
1426
+ const r = renameThread(h.dir, id, callerLane(this.as) ?? 'agent', this.title)
1427
+ h.out(r.from === r.to ? `${this.ref}: named « ${r.to} » already, nothing to rename` : `${this.ref}: renamed « ${r.from} » → « ${r.to} »`)
1428
+ return 0
1429
+ })
1430
+ }
1431
+ }
1432
+
1433
+ export class ThreadSuggestMoveCommand extends Command {
1434
+ static override paths = [['thread', 'suggest-move']]
1435
+ static essential = { args: '<address | id> <repo> "<why>"' }
1436
+ static override usage = Command.Usage({
1437
+ category: 'Review',
1438
+ description: 'a thread raised in the wrong project: ask the owner to move it, his one click moves it whole',
1439
+ details: `${DETAILS}\n\nPosts one question in the thread, « This is about <repo>: move it there? », its options « move to <repo> » (your pick) and « keep it here ». His click on « move to <repo> » moves the thread whole into that repo's threads: every item, message, answer and file, ids and times kept, a trace line on both sides, its old address and ids pointing to the new place. Its holder lets go there, and that repo's default session hears it. A thread whose subject is another house repo's: this is the answer from here; a reply or a reflection never replaces it. Only he moves a thread. An ask's or a blocked command's thread stays in its repo. The same question typed with sk thread ask and those two options acts the same.`,
1440
+ examples: [['his note about the toolkit, raised in a game repo', `SK_AGENT=L4 sk thread suggest-move talk:20261129-traces-should-be-dimmed toolkit "the hub's code lives in the toolkit repo"`]],
1441
+ })
1442
+ ref = Option.String({ name: 'address | id' })
1443
+ repo = Option.String({ name: 'repo' })
1444
+ why = Option.String({ name: 'why', required: false })
1445
+ as = Option.String('--as', { description: 'who asks (else SK_AGENT)' })
1446
+
1447
+ async execute(): Promise<number> {
1448
+ return run(this.context, async (h) => {
1449
+ const { houseRootOf, suggestMoveQuestion } = await import('../review/move.ts')
1450
+ const { postAsk } = await import('../review/store.ts')
1451
+ const { rootOfStore } = await import('../review/close.ts')
1452
+ const { repoNameOf } = await import('../agent-time/registry.ts')
1453
+ const root = rootOfStore(h.dir)
1454
+ if (this.repo === repoNameOf(root)) throw new Error(`the thread is in ${this.repo} already`)
1455
+ if (houseRootOf(root, this.repo) === null) throw new Error(`${this.repo}: no house repo of that name (sk global-context lists them)`)
1456
+ const id = await idOf(h.dir, this.ref)
1457
+ const on = (await import('../review/store.ts')).readItem(h.dir, id)?.item.on ?? ''
1458
+ if (/^(ask|blocked):/.test(on)) throw new Error(`${on}: an ask's or a blocked command's thread stays in the repo whose record it is, so it never moves`)
1459
+ const m = await postAsk(h.dir, id, { who: actor(this.as, false, 'ask'), ...suggestMoveQuestion(this.repo, this.why ?? '') })
1460
+ h.out(`${id} asked: « move to ${this.repo} » (your pick) · « keep it here »; his click on the first moves the thread (${m.id})`)
1461
+ return 0
1462
+ })
1463
+ }
1464
+ }
1465
+
1466
+ export class ThreadCloseCommand extends Command {
1467
+ static override paths = [['thread', 'close']]
1468
+ static essential = { args: '<address | id> "<why, one line>"' }
1469
+ static override usage = Command.Usage({
1470
+ category: 'Review',
1471
+ description: 'close a conversation you finished, nothing in it left to judge; « reopen » in the hub undoes it',
1472
+ details: `${DETAILS}\n\nWords saying a thread is done leave it in the owner's turn: this closes it. Its status becomes done (« closed · done » at its head, « reopen » beside it), each version of words that waited on a verdict reads « no verdict needed: closed by <who> », and the thread shows « <who> closed the thread: <why> ». Refused, each named with its id, while something in it waits on the owner: a question, a change, words asking a verdict, a version with media to judge (a picture, a clip, a sound), an object that holds it open on the owner (a branch to merge); and on an ask's thread (sk asks done).`,
1473
+ examples: [['the work asked is live, nothing waits on the owner', 'SK_AGENT=L4 sk thread close talk:20261128-point-complet "everything this point asked is live"']],
1474
+ })
1475
+ ref = Option.String({ name: 'address | id' })
1476
+ why = Option.String({ name: 'why' })
1477
+ as = Option.String('--as', { description: 'who closes it (else SK_AGENT)' })
1478
+
1479
+ async execute(): Promise<number> {
1480
+ return run(this.context, async (h) => {
1481
+ const { agentClose } = await import('../review/close.ts')
1482
+ const id = await idOf(h.dir, this.ref)
1483
+ const r = agentClose(h.dir, id, callerLane(this.as) ?? 'agent', this.why)
1484
+ h.out(`${this.ref}: closed as done${r.versions.length > 0 ? `, ${r.versions.length} older version${r.versions.length > 1 ? 's' : ''} need no verdict` : ''}; his « reopen » brings it back`)
1485
+ return 0
1486
+ })
1487
+ }
1488
+ }
1489
+
1490
+ export class ThreadRecapCommand extends Command {
1491
+ static override paths = [['thread', 'recap']]
1492
+ static essential = { args: '<address | id> --body <file | -> | --offer' }
1493
+ static override usage = Command.Usage({
1494
+ category: 'Review',
1495
+ description: 'a recap of a long thread he asked for, which he judges; accepted, every reader starts at it',
1496
+ details: `${DETAILS}\n\nThe recap's markdown holds four sections in this order, each one at least a line: ## Decided (what was settled, the owner's words quoted where they set a rule), ## Live now (what stands now), ## Open (each line « - <who>: <what> », who owes it: owner or a lane; or « - none »), ## Links (each line names the id of a version or a message of this thread in backticks; or « - none »). The verb refuses a body missing a section, an open line that names nobody, a link to no id of the thread. It asks the owner's verdict like a version (ok, ok with a fix, rework…); a recap still waiting on that verdict is superseded by the new one. Once the owner accepts it (ok, or ok with a fix), sk thread show (and --md), the inbox and its hook read from it on; what still waits on the owner or is owed before it stays listed; --all on show reads every message. Nothing is deleted. Write one only when the owner asks (« recap » in the hub, or a yes to --offer); --offer asks in one click, once, for a thread whose show --md passes about 15 KB, and a « not now » stands. Page: wiki tools/shipkit/threads.md, A recap`,
1497
+ examples: [
1498
+ ['the recap the owner asked for', 'SK_AGENT=L4 sk thread recap talk:20261129-romcom-words --body recap.md'],
1499
+ ['offer one on a long thread', 'sk thread recap talk:20261129-romcom-words --offer'],
1500
+ ],
1501
+ })
1502
+ ref = Option.String({ name: 'address | id' })
1503
+ body = Option.String('--body', { description: 'the recap as markdown: a file, or - for stdin' })
1504
+ offer = Option.Boolean('--offer', false, { description: 'ask the owner « recap this thread? » in one click, your pick yes; never a recap the owner did not ask for' })
1505
+ as = Option.String('--as', { description: 'who writes it (else SK_AGENT)' })
1506
+
1507
+ async execute(): Promise<number> {
1508
+ return run(this.context, async (h) => {
1509
+ if (this.offer === (this.body !== undefined)) throw new Error('one of --body <file | -> (the recap the owner asked for) or --offer (ask the owner first)')
1510
+ const { agentName, postAsk, postRecap } = await import('../review/store.ts')
1511
+ const id = await idOf(h.dir, this.ref)
1512
+ const who = callerLane(this.as) ?? agentName()
1513
+ if (this.offer) {
1514
+ const { RECAP_OFFER_WORDS } = await import('../review/recap.ts')
1515
+ const q = await postAsk(h.dir, id, { who, text: RECAP_OFFER_WORDS, options: ['yes, recap it', 'not now'], pick: 0 })
1516
+ h.out(`${this.ref}: ${q.id} asks the owner for a recap; the owner's yes is the request: then sk thread recap ${this.ref} --body <file>`)
1517
+ return 0
1518
+ }
1519
+ const { readFileSync } = await import('node:fs')
1520
+ const text = this.body === '-' ? await new Response(Bun.stdin.stream()).text() : readFileSync(this.body!, 'utf8')
1521
+ const m = postRecap(h.dir, id, { who, text })
1522
+ h.out(`${this.ref}: the recap ${m.id} waits on the owner's verdict${m.replaces ? `, superseding ${m.replaces}` : ''}; accepted, every reader starts at it`)
1523
+ const said = await headLine(h.dir, id)
1524
+ if (said !== null) h.out(said)
1204
1525
  return 0
1205
1526
  })
1206
1527
  }
@@ -1247,7 +1568,7 @@ export class ThreadTakeCommand extends Command {
1247
1568
  const wasText = was === null ? 'nobody held it' : `it was held by ${was.lane ?? sessionLabel(was.session, parties)}`
1248
1569
  h.out(`${this.ref}: yours now (${hearing?.chip ?? lane ?? 'this session'}), ${wasText}; ${hearing?.words ?? ''}`)
1249
1570
  const { IN_BACKGROUND, WATCH } = await import('../review/inbox-hook.ts')
1250
- if (hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
1571
+ if (!lane && hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
1251
1572
  return 0
1252
1573
  })
1253
1574
  }
@@ -1286,7 +1607,7 @@ export class ThreadAssignCommand extends Command {
1286
1607
  }
1287
1608
 
1288
1609
  export class ReviewReplyCommand extends Command {
1289
- static override paths = [['review', 'reply']]
1610
+ static override paths = [['thread', 'reply']]
1290
1611
  static essential = { args: '<address | id> <text>' }
1291
1612
  static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: `${DETAILS}\n\nBy address, the words answer his newest open note in the thread (the one sk thread fixed closes), else its newest version; by id, that item.` })
1292
1613
  id = Option.String({ name: 'address | id' })
@@ -1296,9 +1617,13 @@ export class ReviewReplyCommand extends Command {
1296
1617
  urgent = Option.Boolean('--urgent', false, { description: 'brings back a thread he set aside, at once: only under the bar of a ping (an incident, a hard block, a deadline before it comes back)' })
1297
1618
  replaces = Option.String('--replaces', { description: 'the id of your earlier words (or question, or change) these supersede: it folds to one line « superseded by … » and leaves the dock, its answers kept' })
1298
1619
  verdict = Option.Boolean('--verdict', false, { description: VERDICT_FLAG })
1620
+ long = Option.String('--long', { description: LONG_FLAG })
1299
1621
 
1300
1622
  async execute(): Promise<number> {
1301
1623
  return run(this.context, async (h) => {
1624
+ const asked = (await import('../review/reply-guards.ts')).questionInReply(this.text, this.id)
1625
+ if (asked !== null) throw new Error(asked)
1626
+ await guardWords(h, this.text, 'reply', this.id, this.long)
1302
1627
  const { agentName, appendMessage } = await import('../review/store.ts')
1303
1628
  if (this.replaces !== undefined) {
1304
1629
  if (this.image !== undefined) throw new Error('--replaces with --image: post the image as its own reply')
@@ -1306,25 +1631,32 @@ export class ReviewReplyCommand extends Command {
1306
1631
  const r = await replacing(h.dir, this.id, this.replaces, this.as)
1307
1632
  const t = textOf(this.text)
1308
1633
  if ('error' in t) throw new Error(t.error)
1309
- const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}) })
1634
+ const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}), ...(this.long !== undefined ? { long: this.long.trim() } : {}) })
1310
1635
  h.out(`${r.id}: ${m.id} supersedes ${r.replaces}`)
1311
1636
  return 0
1312
1637
  }
1313
1638
  const id = await replyTarget(h, this.id, await idOrOpen(h, this.id, this.text, this.as))
1314
- const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image)
1639
+ const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image, this.long)
1315
1640
  if (this.urgent) await urgentOn(h.dir, id, callerLane(this.as) ?? agentName())
1316
1641
  h.out(`${id}: ${m.id}`)
1642
+ // steps written as a reply sit under the old ones, which still stand: they belong in the instructions
1643
+ const ask = /^ask:(\d+)-/.exec((await import('../review/store.ts')).readAll(h.dir).items.find((x) => x.item.id === id)?.item.on ?? '')?.[1]
1644
+ const stepsLike = /^\s*##\s/m.test(this.text) || (this.text.match(/(?:^|\s)\d+[.)]\s+\S/g)?.length ?? 0) >= 2 || (this.text.match(/^\s*[-*]\s+\S/gm)?.length ?? 0) >= 2
1645
+ if (ask !== undefined && stepsLike) h.err(`review: steps belong in the ask's instructions, where he ticks them: sk ask edit ${Number(ask)}, then --save (this reply stays under the old steps)`)
1646
+ for (const l of await stillOpenLines(h.dir, id, m.id)) h.out(l)
1647
+ const said = await headLine(h.dir, id)
1648
+ if (said !== null) h.out(said)
1317
1649
  return 0
1318
1650
  })
1319
1651
  }
1320
1652
  }
1321
1653
 
1322
1654
  export class ReviewUpdateCommand extends Command {
1323
- static override paths = [['review', 'update']]
1655
+ static override paths = [['thread', 'update']]
1324
1656
  static essential = { args: '<address | id> [state] <text>' }
1325
1657
  static override usage = Command.Usage({
1326
1658
  category: 'Review',
1327
- description: "where a thread's work stands, no answer needed: broken, better, fixed or a plain line; a file",
1659
+ description: "where a thread's work stands: broken, better, a line; fixed asks the owner's verdict again",
1328
1660
  details: `${DETAILS}\n\nsk thread update <id> <broken|better|fixed> "<one line>" [<file> | <before> <after>]: the file (an image, a clip or a sound, as it is: no special file) becomes the version's next view, the line and the state go on its thread in time order. Two files make that view a before and after pair, as add --before --after does: two images of one size, two clips of one size and length, or two sounds, never one of each; the owner picks how he compares them (side by side, wipe, fade). broken or better holds the version « in progress » (not waiting on the owner's verdict, still new in the list), fixed asks the owner's verdict again on the same thread, even after an answer. The owner's hint on an update reaches watch and inbox as a reply « on update <k> ». Posted on the thread's newest version.`,
1329
1661
  examples: [
1330
1662
  ['still broken, the take as it is', 'SK_AGENT=L2 sk thread update <id> broken "her arm still crosses her leg at 2 s" take.mp4'],
@@ -1346,9 +1678,12 @@ export class ReviewUpdateCommand extends Command {
1346
1678
  as = Option.String('--as', { description: 'the lane that posts (else SK_AGENT)' })
1347
1679
  keep = Option.Boolean('--keep', false, { description: 'its pictures as given: a png lands as a lossless webp otherwise, its pixels checked exact, and the version keeps only the webp' })
1348
1680
  verdict = Option.Boolean('--verdict', false, { description: `on a plain line only: ${VERDICT_FLAG}` })
1681
+ long = Option.String('--long', { description: `on a plain line only: ${LONG_FLAG}` })
1349
1682
 
1350
1683
  async execute(): Promise<number> {
1351
1684
  return run(this.context, async (h) => {
1685
+ if (this.long !== undefined && this.text !== undefined) throw new Error(`update ${this.state} --long: an update's line is one line; a long text goes as a document (sk thread post ${this.id} --md <file>)`)
1686
+ await guardWords(h, this.text ?? this.state, 'update', this.id, this.long)
1352
1687
  const { postUpdate, agentName, readAll } = await import('../review/store.ts')
1353
1688
  const { threadsOf } = await import('../review/threads.ts')
1354
1689
  const { threadOfId } = await import('../review/cells.ts')
@@ -1360,19 +1695,21 @@ export class ReviewUpdateCommand extends Command {
1360
1695
  if ((UPDATE_STATES as readonly string[]).includes(this.state)) throw new Error(`update <address | id> ${this.state} "<one line>": the line is missing`)
1361
1696
  const at = await idOrOpen(h, this.id, this.state, this.as)
1362
1697
  const on = threadOfId(at, threadsOf(readAll(h.dir).items))?.head.item.id ?? at
1363
- const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict)
1698
+ const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict, undefined, this.long)
1364
1699
  h.out(`${on}: ${m.id}, a line, no state`)
1700
+ const said = await headLine(h.dir, on)
1701
+ if (said !== null) h.out(said)
1365
1702
  return 0
1366
1703
  }
1367
1704
  const asked = await idOrOpen(h, this.id, this.text, this.as)
1368
1705
  // an update goes where he reads: the thread's newest version
1369
1706
  const id = threadOfId(asked, threadsOf(readAll(h.dir).items))?.head.item.id ?? asked
1370
1707
  const r = await postUpdate(h.dir, id, { who: callerLane(this.as) ?? agentName(), state: this.state, text: this.text, files: this.files, ...(this.keep ? { keep: true } : {}) })
1371
- const { viewNo, stateOf } = await import('../review/model.ts')
1372
- const { readItem } = await import('../review/store.ts')
1373
- const x = readItem(h.dir, id)
1374
- const now = x && stateOf(x, false).state === 'asks' ? "waits for the owner's verdict" : x && stateOf(x, false).state === 'draft' ? 'in progress, no verdict asked' : 'in work'
1375
- h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}; the version ${now}`)
1708
+ const { viewNo } = await import('../review/model.ts')
1709
+ // where the thread stands is the head line's to say, from its state
1710
+ h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}`)
1711
+ const said = await headLine(h.dir, id)
1712
+ if (said !== null) h.out(said)
1376
1713
  if (r.view !== null) for (const line of await (await import('../review/previews.ts')).playCopies(h.dir, r.item, r.view)) h.err(line)
1377
1714
  const { unheardLine } = await import('../review/model.ts')
1378
1715
  const { liveWatchers } = await import('../review/watchers.ts')
@@ -1384,11 +1721,11 @@ export class ReviewUpdateCommand extends Command {
1384
1721
  }
1385
1722
 
1386
1723
  export class ReviewWithdrawCommand extends Command {
1387
- static override paths = [['review', 'withdraw']]
1724
+ static override paths = [['thread', 'withdraw']]
1388
1725
  static override usage = Command.Usage({
1389
1726
  category: 'Review',
1390
1727
  description: 'take back what an agent posted, with the reason: a version by its id, or one message by its id',
1391
- details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner answered it in chat; the words are the reason, quoted, so it never stays open in the hub.`,
1728
+ details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner's words settled it outside its own control, in chat or in a plain reply of the thread; the words are the reason, quoted, so it never stays open in the hub. A plain reply of the owner's never answers a question, a change or words asking the owner's verdict by itself: the agent that acts on the owner's words closes what they settled with --chat.`,
1392
1729
  examples: [
1393
1730
  ['a version taken back', 'sk thread withdraw 20261120-101500-the-logo --why "a newer one follows"'],
1394
1731
  ['he answered the question in chat', 'sk thread withdraw 20261120-223154-747-agent-vg49 --chat "B only, keep both kill matrices"'],
@@ -1396,7 +1733,7 @@ export class ReviewWithdrawCommand extends Command {
1396
1733
  })
1397
1734
  ids = Option.Rest({ required: 1 })
1398
1735
  why = Option.String('--why,--note', { required: false, description: 'why it goes (--note says the same, as on fixed, wontfix, blocked and drop)' })
1399
- chat = Option.String('--chat', { required: false, description: 'the owner answered it in chat: the words become the reason, quoted' })
1736
+ chat = Option.String('--chat', { required: false, description: 'the owner settled it in his own words, in chat or in a plain reply of the thread: the words become the reason, quoted' })
1400
1737
 
1401
1738
  async execute(): Promise<number> {
1402
1739
  return run(this.context, async (h) => {
@@ -1423,7 +1760,7 @@ export class ReviewWithdrawCommand extends Command {
1423
1760
  }
1424
1761
 
1425
1762
  export class ReviewReopenCommand extends Command {
1426
- static override paths = [['review', 'reopen']]
1763
+ static override paths = [['thread', 'reopen']]
1427
1764
  static override usage = Command.Usage({ category: 'Review', description: 'an answered version waits for his answer again; the old verdict stays in the thread', details: DETAILS })
1428
1765
  ids = Option.Rest({ required: 1 })
1429
1766
 
@@ -1444,48 +1781,23 @@ export class ReviewReopenCommand extends Command {
1444
1781
  }
1445
1782
  }
1446
1783
 
1447
- export class ReviewPickCommand extends Command {
1448
- static override paths = [['review', 'pick']]
1449
- /** for an older choice version: a question's pick is fixed when it is asked */
1450
- static older = true
1451
- static override usage = Command.Usage({
1452
- category: 'Review',
1453
- description: "the option you suggest on a choice he has not answered: the hub's « my pick » pill on it",
1454
- details: `${DETAILS}\n\nsk thread pick <id> <view>: the view by its letter (B) or its label; one pick a version, a new one replaces it; for an older choice version (a question's pick is fixed at ask).`,
1455
- examples: [['suggest the second option', 'sk thread pick <id> B'], ['by its label', 'sk thread pick <id> "Zen Garden"']],
1456
- })
1457
- id = Option.String({ required: true })
1458
- view = Option.String({ required: true })
1459
-
1460
- async execute(): Promise<number> {
1461
- return run(this.context, async (h) => {
1462
- const { setAgentPick } = await import('../review/store.ts')
1463
- const { viewNo, viewName } = await import('../review/model.ts')
1464
- const id = await idOf(h.dir, this.id)
1465
- const item = setAgentPick(h.dir, id, this.view)
1466
- const n = item.agentPick ?? 0
1467
- h.out(`${id}: my pick ${viewNo(n)} "${viewName(item.views[n], n)}"`)
1468
- return 0
1469
- })
1470
- }
1471
- }
1472
-
1473
- type ActOp = 'fixed' | 'wontfix' | 'claim' | 'release' | 'blocked' | 'done' | 'dispatch' | 'ask' | 'drop' | 'reassign'
1784
+ type VerbOp = 'wontfix' | 'claim' | 'release' | 'done' | 'ask'
1474
1785
 
1475
- /** one state change: by a worker on its claim, or by the dispatcher on what it routes; the item, then the new state */
1476
- function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'optional'; text?: string; topic?: 'required' | 'optional'; named: boolean; examples: [string, string][] }) {
1786
+ /** a question, or one state change by a worker on its claim; the item, then the new state */
1787
+ function actCommand(op: VerbOp, description: string, o: { note?: 'required' | 'optional'; text?: string; named: boolean; examples: [string, string][] }) {
1477
1788
  return class extends Command {
1478
- static override paths = [['review', op]]
1789
+ static override paths = [['thread', op]]
1479
1790
  static essential = op === 'ask' ? { args: '<address | id> "<question>" --option … --pick <n>' } : undefined
1480
1791
  static gloss = op === 'done' ? 'the old name of fixed' : undefined
1481
1792
  static older = op === 'done' ? true : undefined
1482
1793
  static override usage = Command.Usage({ category: 'Review', description, details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3). ${o.named ? 'Who acts: --as <name>, else SK_AGENT.' : 'Who acts: --as, else SK_AGENT, else agent.'}`, examples: o.examples })
1483
1794
  id = Option.String({ name: 'address | id' })
1484
- words = o.text !== undefined || o.topic !== undefined ? Option.String({ required: false, name: o.text ?? 'topic' }) : undefined
1795
+ words = o.text !== undefined ? Option.String({ required: false, name: o.text }) : undefined
1485
1796
  note = o.note === 'required' ? Option.String('--note', { required: true, description: 'what was done, why not, or what is needed' }) : Option.String('--note', { description: 'what was done, or the reason' })
1486
1797
  commit = Option.String('--commit', { description: 'the commit that holds the fix' })
1487
1798
  as = Option.String('--as', { description: 'who acts (else SK_AGENT)' })
1488
- options = op === 'ask' ? Option.Array('--option', { description: 'a question he answers in one click: each option (two or more), words, a file (a picture, a clip, a sound: its name the label), "<label>=<file>" or "<label>=<before>,<after>"; any agent asks this way, the dispatcher asks without' }) : undefined
1799
+ rows = op === 'ask' ? Option.Array('--row', { description: 'one pick per thing in one question: each --row "<thing>" opens a row, the --option and --pick after it are its own; he clicks one option a row (eight words, each with its shape candidates: one question, eight rows)' }) : undefined
1800
+ options = op === 'ask' ? Option.Array('--option', { description: 'a question he answers in one click: each option (two or more), words, a file (a picture, a clip, a sound: its name the label), "<label>=<file>" or "<label>=<before>,<after>"' }) : undefined
1489
1801
  pick = op === 'ask' ? Option.String('--pick', { description: 'with --option: the option you pick, by its number from 1 (the house rule: a pick on every question)' }) : undefined
1490
1802
  checklist = op === 'ask' ? Option.Array('--checklist', { description: 'a checklist he ticks, line by line, over days: each line a step, words on one line (markdown: bold, a link, code)' }) : undefined
1491
1803
  confirm = op === 'ask' ? Option.Boolean('--confirm', false, { description: 'one step he does in the real world: he answers « done »' }) : undefined
@@ -1495,22 +1807,23 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1495
1807
  after = op === 'ask' ? Option.String('--after', { description: 'set the thread aside until then (2h, tomorrow, next-week, YYYY-MM-DD[THH:MM]): your question waits for that day; only when you post it' }) : undefined
1496
1808
  urgent = op === 'ask' ? Option.Boolean('--urgent', false, { description: 'brings back a thread he set aside, at once: only under the bar of a ping (an incident, a hard block, a deadline before it comes back)' }) : undefined
1497
1809
  login = op === 'ask' ? Option.Boolean('--login', false, { description: 'with --secret: a login, its account (the email or user name) typed and stored beside it' }) : undefined
1498
- replaces = op === 'ask' ? Option.String('--replaces', { description: 'the id of your earlier question (or words) this one supersedes: it folds to one line « superseded by … » and leaves the dock, his answers on it kept' }) : undefined
1499
- keep = op === 'ask' ? Option.Boolean('--keep', false, { description: 'keep his older open questions of the same kind on this thread open beside this one; by default this one supersedes them' }) : undefined
1810
+ replaces = op === 'ask' ? Option.String('--replaces', { description: 'the id of your earlier question (or words) this one supersedes: it folds to one line « superseded by … » and leaves the dock, his answers on it kept; `all`: every older open question of its kind on the thread. Without it, a new question is asked beside the open ones' }) : undefined
1811
+ keep = op === 'ask' ? Option.Boolean('--keep', false, { description: 'does nothing: a new question never supersedes another unless --replaces names it' }) : undefined
1500
1812
  verdict = op === 'ask' ? Option.Boolean('--verdict', false, { description: "refused: a question waits for the owner's answer already, his answer is its verdict" }) : undefined
1501
1813
 
1502
- /** the thread item the question goes on and what it supersedes: never a new thread when it supersedes. Named
1503
- * none, it supersedes the older open questions of its kind on the thread (review/supersede.ts olderQuestions):
1504
- * the newest by `replaces`, each other withdrawn by `withdrawOlder` once this one has its id; `--keep` none */
1505
- async target(h: Here, q: { kind: AnswerKind; secret?: string }): Promise<{ id: string; replaces?: string; others: string[] }> {
1506
- if (this.replaces !== undefined) return { ...(await replacing(h.dir, this.id, this.replaces, this.as)), others: [] }
1814
+ /** the thread item the question goes on and what it supersedes: never a new thread when it supersedes. It
1815
+ * supersedes only what `--replaces` names: an id, or `all`, the older open questions of its kind on the thread
1816
+ * (review/supersede.ts olderQuestions), the newest by `replaces`, each other withdrawn by `withdrawOlder` once
1817
+ * this one has its id. Named none, it is asked beside them, `beside` counting them */
1818
+ async target(h: Here, q: { kind: AnswerKind; secret?: string }): Promise<{ id: string; replaces?: string; others: string[]; beside?: number }> {
1819
+ if (this.replaces !== undefined && this.replaces !== 'all') return { ...(await replacing(h.dir, this.id, this.replaces, this.as)), others: [] }
1507
1820
  const id = await idOrOpen(h, this.id, this.words ?? '', this.as)
1508
- if (this.keep) return { id, others: [] }
1509
1821
  const { readAll } = await import('../review/store.ts')
1510
1822
  const { membersOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
1511
1823
  const { olderQuestions } = await import('../review/supersede.ts')
1512
1824
  const t = threadOfItem(id, threadsOf(readAll(h.dir).items))
1513
1825
  const older = t === null ? [] : olderQuestions(membersOf(t), q)
1826
+ if (this.replaces !== 'all') return { id, others: [], ...(older.length > 0 ? { beside: older.length } : {}) }
1514
1827
  if (older.length === 0) return { id, others: [] }
1515
1828
  if (!(await mayHold(h.dir, t!, this.as))) {
1516
1829
  h.err(` ${older.length} older open question${older.length > 1 ? 's' : ''} of this kind stay open (${older.map((m) => m.id).join(', ')}): another agent holds the thread; sk thread take <address>, then --replaces <id>`)
@@ -1520,8 +1833,9 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1520
1833
  }
1521
1834
 
1522
1835
  /** the older questions `target` named beside the one it superseded: each withdrawn, « replaced by » the new one */
1523
- async withdrawOlder(h: Here, t: { replaces?: string; others: string[] }, by: string): Promise<void> {
1524
- if (t.replaces !== undefined && this.replaces === undefined) h.out(` supersedes ${t.replaces}${t.others.length > 0 ? ` and ${t.others.join(', ')}` : ''}: older open question${t.others.length > 0 ? 's' : ''} of this kind (--keep keeps them)`)
1836
+ async withdrawOlder(h: Here, t: { replaces?: string; others: string[]; beside?: number }, by: string): Promise<void> {
1837
+ if (t.beside !== undefined) h.out(` asked beside ${t.beside} open question${t.beside > 1 ? 's' : ''} of this kind, ${t.beside > 1 ? 'all' : 'it'} still open: --replaces <id> supersedes one, --replaces all every one`)
1838
+ if (t.replaces !== undefined && this.replaces === 'all') h.out(` supersedes ${t.replaces}${t.others.length > 0 ? ` and ${t.others.join(', ')}` : ''}: older open question${t.others.length > 0 ? 's' : ''} of this kind (--replaces all)`)
1525
1839
  const { withdrawObject } = await import('../review/store.ts')
1526
1840
  for (const re of t.others) {
1527
1841
  const r = withdrawObject(h.dir, re, `replaced by ${by}`)
@@ -1540,7 +1854,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1540
1854
  h.out(` set aside until ${until.toLocaleString()}: out of his turn until then`)
1541
1855
  }
1542
1856
 
1543
- /** the answer kind the flags name, null for none (a choice through --option, or the dispatcher's question) */
1857
+ /** the answer kind the flags name, null for none (a choice through --option or --row) */
1544
1858
  kindFlags(): { kind: AnswerKind; label: string } | null {
1545
1859
  const named = [
1546
1860
  ...((this.checklist?.length ?? 0) > 0 ? [{ kind: 'checklist' as const, label: '--checklist' }] : []),
@@ -1564,6 +1878,10 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1564
1878
  const { postAsk } = await import('../review/store.ts')
1565
1879
  const { askStateText } = await import('../review/answer-kinds.ts')
1566
1880
  if (!this.words?.trim()) throw new Error(`ask <address | id> "<what you ask>" ${k.label}`)
1881
+ if (k.kind === 'text') {
1882
+ const letters = (await import('../review/instruction-guards.ts')).lettersAsText(this.words)
1883
+ if (letters !== null) h.err(`« ${letters} »: a typed answer stands in for picks; one question with a row per thing shows each option with its picture, one click a row: --row "<thing>" --option "<label>=<file>" … --pick <n> (wiki tools/shipkit/threads-essentials.md, Which object for which need)`)
1884
+ }
1567
1885
  if (k.kind === 'secret') {
1568
1886
  const joined = (await import('../review/instruction-guards.ts')).joinedSecretAsk(this.words)
1569
1887
  if (joined !== null) throw new Error(`« ${joined} » asks him for two values as one: one field a value, so ask twice, a --secret each with its own name (wiki tools/shipkit/threads-instructions.md, A field inside a step)`)
@@ -1581,6 +1899,32 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1581
1899
  if (k.kind === 'secret') h.out(` his answer reads « stored as ${m.ask?.secret?.name} »; then: sk secret get ${m.ask?.secret?.name}`)
1582
1900
  return 0
1583
1901
  }
1902
+ if (op === 'ask' && (this.rows?.length ?? 0) > 0) {
1903
+ const { postAsk } = await import('../review/store.ts')
1904
+ if (!this.words?.trim()) throw new Error('ask <address | id> "<question>" --row "<thing>" --option "<a>" --option "<b>" --pick <n> --row …')
1905
+ // the rows are read in the order typed, as propose reads its fields (process.argv after `ask`)
1906
+ const raw = process.argv.slice(2)
1907
+ const from = raw.indexOf('ask')
1908
+ if (from < 0) throw new Error('--row: the rows are read in the order typed, from the command line')
1909
+ const rows = askRowsOf(raw.slice(from + 1))
1910
+ if (rows.length !== this.rows!.length) throw new Error(`--row: ${this.rows!.length} rows typed, ${rows.length} read`)
1911
+ const at = await this.target(h, { kind: 'choice' })
1912
+ const { id, replaces } = at
1913
+ const unpicked = rows.filter((r) => r.pick === undefined).map((r) => r.label)
1914
+ if (unpicked.length > 0) h.err(`no --pick on ${unpicked.join(', ')}: the house rule wants your pick on every row`)
1915
+ const group = crypto.randomUUID().slice(0, 12)
1916
+ const who = actor(this.as, false, op)
1917
+ const posted = []
1918
+ for (const [i, r] of rows.entries()) {
1919
+ const m = await postAsk(h.dir, id, { who, text: this.words, options: r.options.map(askOption), ...(r.pick !== undefined ? { pick: r.pick } : {}), row: { group, i, n: rows.length, label: r.label }, ...(i === 0 && replaces ? { replaces } : {}) })
1920
+ posted.push(m)
1921
+ }
1922
+ h.out(`${id} asked ${rows.length} rows, one pick each:`)
1923
+ for (const m of posted) h.out(` ${m.ask!.row!.label}: ${m.ask!.options.map((o, i) => `${i + 1} ${o}${m.ask?.views?.[i] != null ? ' [media]' : ''}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
1924
+ await this.withdrawOlder(h, at, posted[0]!.id)
1925
+ await this.later(h, id)
1926
+ return 0
1927
+ }
1584
1928
  if (op === 'ask' && this.options !== undefined) {
1585
1929
  const { postAsk } = await import('../review/store.ts')
1586
1930
  if (!this.words?.trim()) throw new Error('ask <address | id> "<question>" --option "<a>" --option "<b>" --pick <n>')
@@ -1588,17 +1932,18 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1588
1932
  const { id, replaces } = at
1589
1933
  const pick = this.pick === undefined ? undefined : Number(this.pick) - 1
1590
1934
  if (pick === undefined) h.err('no --pick: the house rule wants your pick on every question')
1591
- const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, options: this.options.map(askOption), ...(pick !== undefined ? { pick } : {}), ...(replaces ? { replaces } : {}) })
1935
+ const move = (await import('../review/move.ts')).moveOfOptions(this.options)
1936
+ const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, options: this.options.map(askOption), ...(pick !== undefined ? { pick } : {}), ...(replaces ? { replaces } : {}), ...(move !== null ? { move } : {}) })
1592
1937
  h.out(`${id} asked: ${m.ask?.options.map((o, i) => `${i + 1} ${o}${m.ask?.views?.[i] != null ? ' [media]' : ''}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
1593
1938
  await this.withdrawOlder(h, at, m.id)
1594
1939
  await this.later(h, id)
1595
1940
  return 0
1596
1941
  }
1942
+ if (op === 'ask') throw new Error('ask <address | id> "<question>" with its answer kind: --option "<a>" --option "<b>" --pick <n>, --row, --checklist, --confirm, --text, --url or --secret <name>')
1597
1943
  const { stateOf } = await import('../review/model.ts')
1598
1944
  const { detail } = await import('../review/format.ts')
1599
- if (this.words !== undefined && o.text === undefined && o.topic === undefined) throw new Error(`unexpected ${this.words}`)
1945
+ if (this.words !== undefined && o.text === undefined) throw new Error(`unexpected ${this.words}`)
1600
1946
  if (o.text && !this.words?.trim()) throw new Error(`${op} <id> "<${o.text}>"`)
1601
- if (o.topic === 'required' && !this.words) throw new Error(`${op} <id> <topic> (sk thread topics)`)
1602
1947
  const id = await idOf(h.dir, this.id)
1603
1948
  const who = actor(this.as, o.named, op)
1604
1949
  if (op === 'wontfix') {
@@ -1629,13 +1974,11 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1629
1974
  if (st?.state === 'asks' || st?.state === 'draft')
1630
1975
  throw new Error(`${id}: done closes a version the owner answered « fix »; this one ${st.state === 'asks' ? "waits on the owner's verdict" : 'is in progress'}: sk thread withdraw ${id} --why "<why>" takes it back`)
1631
1976
  }
1632
- const holds = op === 'done' || op === 'wontfix' || op === 'release' || op === 'blocked' || op === 'fixed' ? await callerHolds(h.dir, id, this.as) : false
1977
+ const holds = op === 'done' || op === 'wontfix' || op === 'release' ? await callerHolds(h.dir, id, this.as) : false
1633
1978
  act(h.dir, id, op, who, {
1634
1979
  holds,
1635
1980
  ...(this.note ? { note: this.note } : {}),
1636
- ...(op === 'ask' && this.words ? { text: this.words } : {}),
1637
1981
  ...(op === 'done' && this.words ? { note: this.words } : {}),
1638
- ...(o.topic && this.words ? { topic: this.words } : {}),
1639
1982
  ...(this.commit ? { commit: this.commit } : {}),
1640
1983
  })
1641
1984
  const x = readItem(h.dir, id)
@@ -1651,12 +1994,11 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1651
1994
  export const ReviewWontfixCommand = actCommand('wontfix', 'close an item he raised as not done, with the reason', { note: 'required', named: false, examples: [['not done', 'sk thread wontfix <id> --note "the room is gone"']] })
1652
1995
  export const ReviewClaimCommand = actCommand('claim', 'take an item to work on it: the hub shows the thread in work by your lane', { named: true, examples: [['take it', 'sk thread claim <id> --as L12']] })
1653
1996
  export const ReviewReleaseCommand = actCommand('release', 'give back an item you claimed', { note: 'optional', named: true, examples: [['give it back', 'sk thread release <id> --as L12']] })
1654
- export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two doors?" --as L12']] })
1655
1997
  export const ReviewDoneCommand = actCommand('done', 'the older name of sk thread fixed on a version he answered « ok with a fix »', { text: 'what changed', named: false, examples: [['the fix made', 'sk thread fixed <id> "the sign moved one tile up"']] })
1656
1998
 
1657
- /** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/threads.ts fixedPlan) */
1999
+ /** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/thread-state.ts fixedPlan) */
1658
2000
  export class ReviewFixedCommand extends Command {
1659
- static override paths = [['review', 'fixed']]
2001
+ static override paths = [['thread', 'fixed']]
1660
2002
  static essential = { args: '<address | id> [what was done]' }
1661
2003
  static override usage = Command.Usage({
1662
2004
  category: 'Review',
@@ -1677,7 +2019,8 @@ export class ReviewFixedCommand extends Command {
1677
2019
  return run(this.context, async (h) => {
1678
2020
  const { act, postUpdate, readAll } = await import('../review/store.ts')
1679
2021
  const { stateOf } = await import('../review/model.ts')
1680
- const { fixedPlan, threadOfItem, threadsOf } = await import('../review/threads.ts')
2022
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
2023
+ const { fixedPlan } = await import('../review/thread-state.ts')
1681
2024
  const id = await idOf(h.dir, this.id)
1682
2025
  const items = readAll(h.dir).items
1683
2026
  const x = items.find((y) => y.item.id === id)
@@ -1694,46 +2037,31 @@ export class ReviewFixedCommand extends Command {
1694
2037
  h.out(`${plan.id}: ${r.tag}; ${isOpening(r.item) ? 'its work is done, nothing waits on the owner' : "the owner's verdict is asked again"}`)
1695
2038
  return 0
1696
2039
  }
2040
+ const { openAsksOf, openItemVerdictsOf } = await import('../review/thread-state.ts')
2041
+ const asked = (u: typeof t): (typeof x.thread)[number][] => [...openAsksOf(u), ...openItemVerdictsOf(u)]
2042
+ const before = asked(t)
1697
2043
  const holds = await callerHolds(h.dir, plan.id, this.as)
1698
2044
  act(h.dir, plan.id, plan.op, who, { ...(said ? { note: said } : {}), ...(this.commit ? { commit: this.commit } : {}), holds })
1699
- const after = readAll(h.dir).items.find((y) => y.item.id === plan.id)
2045
+ const now = readAll(h.dir).items
2046
+ const after = now.find((y) => y.item.id === plan.id)
1700
2047
  const st = after ? stateOf(after, false) : null
1701
2048
  h.out(`${plan.id} ${plan.op === 'done' ? 'closed, « ok with a fix » done' : 'fixed'}: ${st ? `${st.state}${st.why ? ` (${st.why})` : ''}` : 'gone'}`)
2049
+ // a close moots what was asked before it (review/thread-state.ts mootAt): never in silence
2050
+ const still = new Set(asked(threadOfItem(id, threadsOf(now, h.say.spec)) ?? t).map((m) => m.id))
2051
+ const moot = before.filter((m) => !still.has(m.id))
2052
+ if (moot.length > 0) {
2053
+ const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
2054
+ h.out(` the close moots ${moot.length} asked of him, closed not answered; if he still owes one, ask it again (sk thread ask):`)
2055
+ for (const m of moot) h.out(` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`)
2056
+ }
1702
2057
  return 0
1703
2058
  })
1704
2059
  }
1705
2060
  }
1706
- export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as dispatcher']] })
1707
- export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as dispatcher']] })
1708
- export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as dispatcher']] })
1709
- export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as dispatcher']] })
1710
-
1711
- export class ReviewDispatcherCommand extends Command {
1712
- static override paths = [['review', 'dispatcher']]
1713
- static override usage = Command.Usage({
1714
- category: 'Review',
1715
- description: 'take the dispatcher role: one session at a time routes what is raised',
1716
- details: `${DETAILS}\n\nRefused while another holder acted in the last 30 minutes, unless --take. Only in a repo whose review unit declares a dispatcher.`,
1717
- examples: [['take the role', 'sk thread dispatcher --as dispatcher']],
1718
- })
1719
- as = Option.String('--as', { description: 'who takes it (else SK_AGENT)' })
1720
- take = Option.Boolean('--take', false, { description: 'take it from an active holder' })
1721
-
1722
- async execute(): Promise<number> {
1723
- return run(this.context, async (h) => {
1724
- if (!h.say.spec.dispatcher) throw new Error('this repo routes nothing: its review unit declares no dispatcher (dispatcher: true)')
1725
- const { takeRole } = await import('../review/role.ts')
1726
- const name = actor(this.as, true, 'dispatcher')
1727
- const r = takeRole(h.dir, name, this.take)
1728
- if (!r.ok) throw new Error(r.why)
1729
- h.out(`${name} holds the dispatcher role${r.was && r.was.name !== name ? ` (taken from ${r.was.name})` : ''}`)
1730
- return 0
1731
- })
1732
- }
1733
- }
2061
+ export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ['one pick per thing, a row each, your pick on each row', 'sk thread ask screen:frames/sort "which shape for each word ?" --row "Arrivée" --option "A=arrivee-a.png" --option "B=arrivee-b.png" --pick 1 --row "Adieu" --option "A=adieu-a.png" --option "B=adieu-b.png" --pick 2']] })
1734
2062
 
1735
2063
  export class ReviewNextCommand extends Command {
1736
- static override paths = [['review', 'next']]
2064
+ static override paths = [['thread', 'next']]
1737
2065
  static override usage = Command.Usage({
1738
2066
  category: 'Review',
1739
2067
  description: 'claim the oldest open item of a topic, or raised to a lane, and show it with the pages to read first',
@@ -1767,7 +2095,7 @@ export class ReviewNextCommand extends Command {
1767
2095
  }
1768
2096
 
1769
2097
  export class ReviewTopicsCommand extends Command {
1770
- static override paths = [['review', 'topics']]
2098
+ static override paths = [['thread', 'topics']]
1771
2099
  static override usage = Command.Usage({ category: 'Review', description: 'the topics a raised item is routed to, and the pages a worker reads first', details: DETAILS })
1772
2100
 
1773
2101
  async execute(): Promise<number> {
@@ -1781,10 +2109,10 @@ export class ReviewTopicsCommand extends Command {
1781
2109
  }
1782
2110
 
1783
2111
  export class ReviewBoardCommand extends Command {
1784
- static override paths = [['review', 'board']]
2112
+ static override paths = [['thread', 'board']]
1785
2113
  static override usage = Command.Usage({
1786
2114
  category: 'Review',
1787
- description: 'every open raised item by state, topic and worker, stale claims marked; who is the dispatcher',
2115
+ description: 'every open raised item by state, topic and worker, stale claims marked',
1788
2116
  details: DETAILS,
1789
2117
  examples: [['what is open', 'sk thread board'], ['one topic, closed ones too', 'sk thread board --topic lieux --all']],
1790
2118
  })
@@ -1794,17 +2122,12 @@ export class ReviewBoardCommand extends Command {
1794
2122
  async execute(): Promise<number> {
1795
2123
  return run(this.context, async (h) => {
1796
2124
  const { readAll } = await import('../review/store.ts')
1797
- const { roleOf } = await import('../review/role.ts')
1798
2125
  const { isMarkItem, isStale, stateOf } = await import('../review/model.ts')
1799
2126
  const { followedIds } = await import('../review/threads.ts')
1800
2127
  if (this.topic && Object.keys(h.say.spec.topics).length > 0 && !h.say.spec.topics[this.topic]) throw new Error(`--topic: one of ${Object.keys(h.say.spec.topics).join(', ')}`)
1801
2128
  await pull(h)
1802
2129
  const all = readAll(h.dir)
1803
2130
  for (const b of all.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
1804
- if (h.say.spec.dispatcher) {
1805
- const role = roleOf(h.dir)
1806
- h.out(role ? `dispatcher: ${role.name} (since ${role.since.slice(0, 16)})` : 'dispatcher: nobody (sk thread dispatcher --as <name>)')
1807
- }
1808
2131
  const now = new Date()
1809
2132
  const followed = followedIds(all.items)
1810
2133
  const rows = all.items
@@ -1824,7 +2147,7 @@ export class ReviewBoardCommand extends Command {
1824
2147
  }
1825
2148
 
1826
2149
  export class ReviewReadyCommand extends Command {
1827
- static override paths = [['review', 'ready']]
2150
+ static override paths = [['thread', 'ready']]
1828
2151
  static override usage = Command.Usage({ category: 'Review', description: 'a draft version becomes one he answers: its last frame, or the image given, stays', details: DETAILS })
1829
2152
  id = Option.String()
1830
2153
  image = Option.String('--image', { description: 'the image that stays' })
@@ -1843,7 +2166,7 @@ export class ReviewReadyCommand extends Command {
1843
2166
  }
1844
2167
 
1845
2168
  export class ReviewDeleteCommand extends Command {
1846
- static override paths = [['review', 'delete']]
2169
+ static override paths = [['thread', 'delete']]
1847
2170
  static override usage = Command.Usage({
1848
2171
  category: 'Review',
1849
2172
  description: "a player's test report removed at its source and here, or an item the owner raised removed here",
@@ -1875,7 +2198,7 @@ export class ReviewDeleteCommand extends Command {
1875
2198
  }
1876
2199
 
1877
2200
  export class ReviewMarksCommand extends Command {
1878
- static override paths = [['review', 'marks']]
2201
+ static override paths = [['thread', 'marks']]
1879
2202
  static override usage = Command.Usage({
1880
2203
  category: 'Review',
1881
2204
  description: "the owner's marks kept in the store: per subject its latest stars, mark and note",
@@ -1908,7 +2231,7 @@ export class ReviewMarksCommand extends Command {
1908
2231
  }
1909
2232
 
1910
2233
  export class ReviewAnimCommand extends Command {
1911
- static override paths = [['review', 'anim']]
2234
+ static override paths = [['thread', 'anim']]
1912
2235
  static override usage = Command.Usage({
1913
2236
  category: 'Review',
1914
2237
  description: "a version's before and after as a looping animation to send: a cut, a fade or a wipe, mp4 or gif",
@@ -1953,7 +2276,7 @@ export class ReviewAnimCommand extends Command {
1953
2276
  }
1954
2277
 
1955
2278
  export class ReviewStageCommand extends Command {
1956
- static override paths = [['review', 'stage']]
2279
+ static override paths = [['thread', 'stage']]
1957
2280
  static override usage = Command.Usage({
1958
2281
  category: 'Review',
1959
2282
  description: "one media of a version staged as a post: a draft group of the repo's social store, never posted",
@@ -2026,7 +2349,7 @@ export class ReviewStageCommand extends Command {
2026
2349
  }
2027
2350
 
2028
2351
  export class ReviewAutoCommand extends Command {
2029
- static override paths = [['review', 'auto']]
2352
+ static override paths = [['thread', 'auto']]
2030
2353
  static override usage = Command.Usage({
2031
2354
  category: 'Review',
2032
2355
  description: "the repo's auto rules: period, last run and answer, last item, next run; `auto run <id>` runs one",
@@ -2077,7 +2400,7 @@ export class ReviewAutoCommand extends Command {
2077
2400
  }
2078
2401
 
2079
2402
  export class ReviewWatchCommand extends Command {
2080
- static override paths = [['review', 'watch']]
2403
+ static override paths = [['thread', 'watch']]
2081
2404
  static essential = {}
2082
2405
  static override usage = Command.Usage({
2083
2406
  category: 'Review',
@@ -2094,7 +2417,6 @@ export class ReviewWatchCommand extends Command {
2094
2417
  lane = Option.String('--lane', { description: "only that lane's items" })
2095
2418
  house = Option.Boolean('--house', false, { description: 'with --mine or --session: every repo where the session holds threads, one joined later too, each line headed [<repo>]' })
2096
2419
  once = Option.Boolean('--once', false, { description: 'print the first burst of new lines, then exit 0: the form for a background Bash, never capped at 30 minutes; a line it printed is never printed again by the next one' })
2097
- json = Option.Boolean('--json', false, { description: 'each line as one JSON object: text, kind, repo, item, message, who, address (what a shipkit channel reads)' })
2098
2420
 
2099
2421
  async execute(): Promise<number> {
2100
2422
  return run(this.context, async (h) => {
@@ -2118,7 +2440,7 @@ export class ReviewWatchCommand extends Command {
2118
2440
  await restartWatchOnModelMove(h)
2119
2441
  // the one stream for every store this watch hears, its own lines untagged
2120
2442
  await watchFeed(h.err)
2121
- const f = { session, lane, by, house: this.house, json: this.json, once: this.once }
2443
+ const f = { session, lane, by, house: this.house, once: this.once }
2122
2444
  if (!this.house || session === null) {
2123
2445
  await hearStore(h, f)
2124
2446
  return new Promise<number>(() => {})
@@ -2134,7 +2456,7 @@ export class ReviewWatchCommand extends Command {
2134
2456
  const hear = async (x: Here): Promise<string> => {
2135
2457
  heard.add(canonicalStore(x.dir))
2136
2458
  const repo = repoNameOf(dirname(dirname(x.dir)))
2137
- const tagged = (print: (l: string) => void) => (l: string) => print(this.json && l.startsWith('{') ? JSON.stringify({ ...(JSON.parse(l) as object), repo }) : l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
2459
+ const tagged = (print: (l: string) => void) => (l: string) => print(l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
2138
2460
  await hearStore({ ...x, out: tagged(h.out), err: tagged(h.err) }, f)
2139
2461
  return repo
2140
2462
  }
@@ -2220,15 +2542,14 @@ async function restartWatchOnModelMove(h: Here): Promise<void> {
2220
2542
  }
2221
2543
 
2222
2544
  /** one store heard by a watch of filter `f`, until the process ends: registered beside it, its lines printed through `h` */
2223
- async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; json?: boolean; once?: boolean }): Promise<void> {
2545
+ async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; once?: boolean }): Promise<void> {
2224
2546
  const { session, lane, by } = f
2225
2547
  // --once: what an earlier run of this party printed is never printed again, and the process exits 0 once a burst
2226
2548
  // of new lines settled (400 ms), so a background Bash hears it with no 30 minute cap and no loop of turns
2227
2549
  const once = f.once === true ? await onceMemory(h.dir, session, lane) : null
2228
2550
  let settle: ReturnType<typeof setTimeout> | null = null
2229
- // one line out: its text, or under --json the object a shipkit channel reads (orchestrator/channel.ts)
2230
- const say = (text: string, m: { kind: string; item?: string; message?: string; who?: string; address?: string }): void => {
2231
- h.out(f.json === true ? JSON.stringify({ text, ...m }) : text)
2551
+ const say = (text: string): void => {
2552
+ h.out(text)
2232
2553
  if (once === null) return
2233
2554
  if (settle) clearTimeout(settle)
2234
2555
  // every store of a --house watch saves what it printed, then the process exits
@@ -2237,15 +2558,14 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2237
2558
  process.exit(0)
2238
2559
  }, 400)
2239
2560
  }
2240
- const { existsSync, mkdirSync, watch } = await import('node:fs')
2241
- const { mediaDir, readAll, scanStamp } = await import('../review/store.ts')
2561
+ const { mediaDir, readAll, storeStamp } = await import('../review/store.ts')
2242
2562
  const { modelWatch } = await import('../review/model-moved.ts')
2243
- const { threadsInDb } = await import('../hq/switch.ts')
2244
2563
  const { coversItem, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
2245
2564
  const { followedIds, unseen } = await import('../review/threads.ts')
2246
2565
  const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
2566
+ const { withThreadLook } = await import('../review/refs.ts')
2247
2567
  const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
2248
- const { hears, holderOf, listenersOf, ownAddressesOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
2568
+ const { hears, holderOf, listenersOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
2249
2569
  let byItem = new Map<string, import('../review/threads.ts').Thread>()
2250
2570
  // who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
2251
2571
  const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
@@ -2272,20 +2592,12 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2272
2592
  h.err(`review watch: exits, its lane ${lane} ended: its threads pass to its session`)
2273
2593
  process.exit(0)
2274
2594
  }
2275
- // one ear a session: its shipkit channel, once proven, hears for it, so a plain watch of it leaves
2276
- if (lane === null && session !== null && process.env.SHIPKIT_CHANNEL_EAR !== '1') {
2277
- const { channelHears } = await import('../orchestrator/role.ts')
2278
- if (channelHears(session)) {
2279
- h.err(`review watch: exits, this session's shipkit channel hears for it: nothing to arm again`)
2280
- process.exit(0)
2281
- }
2282
- }
2283
2595
  }
2284
2596
  await known().catch(() => {})
2285
2597
  setInterval(() => void known().catch(() => {}), 30_000)
2286
2598
  const shown = new Set<string>(once?.printed ?? [])
2287
2599
  if (once !== null) onceSaves.push(() => once.save(shown))
2288
- // a store refused for a while (a fold or a way back of the daemon file walks): one line, and the next poll
2600
+ // a store refused for a while (a repair of the daemon file): one line, and the next poll
2289
2601
  // reads again; never a watch that dies and hears nothing more
2290
2602
  let refused: string | null = null
2291
2603
  const safely = (fn: () => void): void => {
@@ -2300,8 +2612,11 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2300
2612
  }
2301
2613
  }
2302
2614
  const tick = (): void => safely(read)
2615
+ const { oncePerBurst } = await import('../review/speaker.ts')
2303
2616
  const read = (): void => {
2304
2617
  const all = readAll(h.dir)
2618
+ // one read is one burst: an advisor's note once in it (review/speaker.ts)
2619
+ const noted = oncePerBurst()
2305
2620
  // the model moved under this watch: it runs again, and its broken lines are the old model's
2306
2621
  if (all.broken.length > 0 && modelWatch.readFailed()) return
2307
2622
  byItem = threadByItem(threadsOf(all.items, h.say.spec))
@@ -2315,24 +2630,22 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2315
2630
  for (const l of laneAsksFor({ repo: repoNameOf(dirname(dirname(h.dir))), root: dirname(dirname(h.dir)), dir: h.dir, here: true, ...all, say: h.say }, { session, lane: null }, parties ?? { sessions: [], lanes: [] })) {
2316
2631
  if (shown.has(l)) continue
2317
2632
  shown.add(l)
2318
- say(l, { kind: 'lane_ask' })
2633
+ say(l)
2319
2634
  }
2320
2635
  }
2321
2636
  for (const x of unseen(all.items, to).filter(mine)) {
2322
- const fresh = watchLines(x, all.items, mediaDir(h.dir), to).filter((l) => !shown.has(l.key))
2323
- const t0 = byItem.get(x.item.id)
2324
- const address = (t0 ? ownAddressesOf(t0, h.say.spec)[0] : undefined) ?? x.item.id
2637
+ const fresh = withThreadLook(h.say.look, () => watchLines(x, all.items, mediaDir(h.dir), to)).filter((l) => !shown.has(l.key))
2638
+ const t = byItem.get(x.item.id)
2639
+ // each line after its item's id names its thread's code, the one an agent types back
2640
+ const code = t && h.say.code ? ` #${h.say.code(t)}` : ''
2325
2641
  for (const l of fresh) {
2326
2642
  shown.add(l.key)
2327
- const message = l.key.split('#')[1]
2328
- const who = message === undefined ? 'owner' : (x.thread.find((m) => m.id === message)?.who ?? 'owner')
2329
- say(l.text, { kind: 'word', item: x.item.id, ...(message ? { message } : {}), who, address })
2643
+ say(noted(code === '' || !l.text.startsWith(`${x.item.id} `) ? l.text : `${x.item.id}${code}${l.text.slice(x.item.id.length)}`))
2330
2644
  }
2331
2645
  // a session's watch, his message on its ended lane's thread: the way back to that lane
2332
- const t = byItem.get(x.item.id)
2333
2646
  const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
2334
2647
  if (r) {
2335
- say(` ${r.line}`, { kind: 'resume', item: x.item.id })
2648
+ say(` ${r.line}`)
2336
2649
  noteHanded(r.lane, r.session, r.thread)
2337
2650
  }
2338
2651
  }
@@ -2349,7 +2662,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2349
2662
  for (const l of shareOf({ items: all.items, spec: h.say.spec, parties: placed, watchers: others, media: mediaDir(h.dir), since: r.holder.since, me: { session, repo } })) {
2350
2663
  if (shown.has(l.key)) continue
2351
2664
  shown.add(l.key)
2352
- say(shareText(l), { kind: 'share', item: l.item, ...(l.message ? { message: l.message } : {}), who: l.player ? 'player' : 'owner', address: l.address })
2665
+ say(noted(shareText(l)))
2353
2666
  }
2354
2667
  }
2355
2668
  }
@@ -2357,7 +2670,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2357
2670
  const l = raisedLine(x)
2358
2671
  if (l === null || shown.has(l.key)) continue
2359
2672
  shown.add(l.key)
2360
- say(l.text, { kind: 'raised', item: x.item.id, who: x.item.origin.by })
2673
+ say(l.text)
2361
2674
  }
2362
2675
  // an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
2363
2676
  const now = new Date()
@@ -2365,65 +2678,43 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2365
2678
  const watchers = liveWatchers(h.dir)
2366
2679
  for (const x of all.items) {
2367
2680
  if (lane !== null && laneOf(x) !== lane) continue
2368
- const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now, h.say.spec.dispatcher)
2681
+ const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now)
2369
2682
  if (why === null) continue
2370
2683
  const round = Math.floor((now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)) / UNTAKEN_AGAIN_MS)
2371
2684
  const key = `untaken ${x.item.id} ${why} ${round}`
2372
2685
  if (shown.has(key)) continue
2373
2686
  shown.add(key)
2374
- say(untakenLine(x, why, lane), { kind: 'untaken', item: x.item.id })
2687
+ say(untakenLine(x, why, lane))
2375
2688
  }
2376
2689
  }
2377
2690
  tick()
2378
2691
  // the grace and the reminder pass with time alone: one read a minute
2379
2692
  setInterval(tick, 60_000)
2380
- // the store the switch names, read again at each poll (a process reads the switch at most once a second), so a
2381
- // watch follows a move while it runs. The rows: their stamp is a query of a few µs, asked every 50 ms, read at
2382
- // once. The files: a watch of the folder asks again (debounced), and a stat stamp every 5 s catches a missed event
2693
+ // the rows' stamp is a query of a few µs, asked every 50 ms, read at once; one tick for a burst of moves
2383
2694
  let soon: ReturnType<typeof setTimeout> | null = null
2384
2695
  const again = (): void => {
2385
2696
  if (soon) clearTimeout(soon)
2386
2697
  soon = setTimeout(() => {
2387
2698
  soon = null
2388
2699
  tick()
2389
- }, threadsInDb() ? 0 : 150)
2700
+ }, 0)
2390
2701
  }
2391
2702
  // the store's own poll, for a watch the daemon's stream does not feed: no home, a store it serves no hub for, a
2392
2703
  // daemon that does not answer (review/watch-feed.ts)
2393
- let polling = false
2394
- let folderWatched = false
2395
- const watchFolder = (): void => {
2396
- if (folderWatched) return
2397
- folderWatched = true
2398
- if (!existsSync(h.dir)) mkdirSync(h.dir, { recursive: true })
2399
- watch(h.dir, { recursive: true }, () => {
2400
- if (polling && !threadsInDb()) again()
2401
- })
2402
- }
2403
2704
  let stamp = ''
2404
- let scanned = Date.now()
2405
2705
  let loop: ReturnType<typeof setInterval> | null = null
2406
2706
  const poll = (on: boolean): void => {
2407
- polling = on
2408
2707
  if (!on) {
2409
2708
  if (loop) clearInterval(loop)
2410
2709
  loop = null
2411
2710
  return
2412
2711
  }
2413
2712
  if (loop) return
2414
- if (!threadsInDb()) watchFolder()
2415
2713
  stamp = ''
2416
2714
  loop = setInterval(() => {
2417
- const rows = threadsInDb()
2418
- // the files' stamp walks every item: once every 5 s, never at the rows' pace
2419
- if (!rows) {
2420
- watchFolder()
2421
- if (Date.now() - scanned < 5000) return
2422
- }
2423
- scanned = Date.now()
2424
2715
  // a refused stamp, or one read again after a refusal: the read says it, once
2425
2716
  try {
2426
- const now = scanStamp(h.dir)
2717
+ const now = storeStamp(h.dir)
2427
2718
  if (now !== stamp || refused !== null) again()
2428
2719
  stamp = now
2429
2720
  } catch {
@@ -2466,149 +2757,6 @@ async function watchFeed(say: (l: string) => void): Promise<import('../review/wa
2466
2757
  return (feedHeld = new WatchFeed(daemonUrl(), { say }))
2467
2758
  }
2468
2759
 
2469
- /** the review folders of this machine's house, its archived repos included: what a move carries */
2470
- async function houseStores(): Promise<string[]> {
2471
- const { findRepoRoot } = await import('../ts/config.ts')
2472
- const { houseRepos } = await import('../house/project-gutter.ts')
2473
- const { homedir } = await import('node:os')
2474
- const { storeDir } = await import('../review/store.ts')
2475
- const house = houseRepos(findRepoRoot(process.cwd()), homedir())
2476
- if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it moves`)
2477
- const { existsSync } = await import('node:fs')
2478
- const repos = [...house.repos, ...house.archived].map((r) => r.path)
2479
- // a lane's worktree holds the items it sent there: they join their repo's rows
2480
- const trees = repos.flatMap((r) => {
2481
- return realGit.runSync(r, ['worktree', 'list', '--porcelain']).out.split('\n').flatMap((l) => (l.startsWith('worktree ') && l.slice(9) !== r ? [l.slice(9)] : []))
2482
- })
2483
- return [...repos, ...trees.filter((t) => existsSync(storeDir(t)))].map((r) => storeDir(r))
2484
- }
2485
-
2486
- export class ReviewMoveCommand extends Command {
2487
- static override paths = [['review', 'move']]
2488
- static override usage = Command.Usage({
2489
- category: 'Review',
2490
- description: "this machine's threads into the daemon's database, or back into files",
2491
- details:
2492
- "The machine db switch cards-in-db picks where every thread of this machine is read and written: its repo's files (`.shipkit/review/<id>/`, off, the default), or the rows of the daemon's database (on). `--go` imports every version file of every house repo the rows lack (by id and rev), proves each is in the rows, turns the switch on, then reads the files once more after a second for a writer that had not seen it. With the switch hq-cards on, it first asks the hq: the hq and the files must hold the same cards, else nothing moves. The files stay where they are, untouched: the way back. `--back` is a look of the way back, `--back --go` first fetches from the Space any media file the spool let go (or refuses, naming how many it would lack), then writes every version of the rows into the files (the versions made since included), turns the switch off, and writes them out again after a second. During a move's lag (7 s) a reader in another process can miss a version a writer made on the side the move left; the second pass carries it, and none stays missed. Both keep the later of two heads and every message by its id, so a move stopped half way runs again. A version's media files stay in its folder. `--tidy` (a look, `--tidy --go` acts) removes a version's files from its repo only while the switch is on and once its rows hold all of them, the hq holds them (hq-cards on) and the Space each of its media files; a version whose rows differ stays, named; after it, `--back --go` writes the files again from the rows. It moves every house repo of the home it runs in, worktrees resolved to their checkout: a test names a scratch HOME. Page: wiki tools/shipkit/threads-store.md",
2493
- examples: [['what the tidy would remove', 'sk thread move --tidy'], ['what a move would do', 'sk thread move'], ['move this machine', 'sk thread move --go'], ['what the way back would do', 'sk thread move --back'], ['go back to the files', 'sk thread move --back --go']],
2494
- })
2495
- go = Option.Boolean('--go', false, { description: 'do it: the move, or with --back the way back' })
2496
- back = Option.Boolean('--back', false, { description: 'the way back: the rows into the files, the switch off' })
2497
- tidy = Option.Boolean('--tidy', false, { description: 'remove the thread files the rows, the hq and the Space all hold' })
2498
-
2499
- async execute(): Promise<number> {
2500
- const out = (l: string): void => void this.context.stdout.write(`${l}\n`)
2501
- const err = (l: string): void => void this.context.stderr.write(`${l}\n`)
2502
- try {
2503
- if (this.tidy && this.back) throw new Error('--tidy or --back, not both')
2504
- const stores = await houseStores()
2505
- const { moveBack, moveGo, tidyFiles } = await import('../review/move.ts')
2506
- const dry = !this.go
2507
- // one move or look of the threads job at a time: the job would send what the move is writing
2508
- const { threadsLeaseHolder, tryThreadsLease } = await import('../hq/thread-sync.ts')
2509
- const lease = dry ? null : tryThreadsLease('review move')
2510
- if (!dry && lease == null) throw new Error(`a look of the hq threads job or another move runs (pid ${threadsLeaseHolder()?.pid ?? '?'}): run it again once it ended`)
2511
- try {
2512
- const r = this.tidy ? await tidyFiles(stores, { dry, proof: await tidyProof(stores) }) : this.back ? await moveBack(stores, { dry }) : await moveGo(stores, { dry, hqDiff: hqDiffOf(stores) })
2513
- for (const l of r.lines) (l.startsWith('WARN') ? err : out)(l)
2514
- const { threadsInDb } = await import('../hq/switch.ts')
2515
- const { BACK_FIRST } = await import('../review/move.ts')
2516
- if (threadsInDb()) out(BACK_FIRST)
2517
- if (dry) out(`a look: nothing ${this.tidy ? 'removed' : 'moved'}. sk thread move ${this.tidy ? '--tidy --go removes' : this.back ? '--back --go moves' : '--go moves'}`)
2518
- return r.ok ? 0 : 1
2519
- } finally {
2520
- lease?.release()
2521
- }
2522
- } catch (e) {
2523
- err(`FAIL: review move: ${e instanceof Error ? e.message : String(e)}`)
2524
- return 1
2525
- }
2526
- }
2527
- }
2528
-
2529
- /** what the tidy proves outside the store: the names of each repo's rows the hq lacks or holds at another rev (the
2530
- * check hq-cards, the hq asked once), and the Space's word on each file */
2531
- async function tidyProof(stores: readonly string[]): Promise<import('../review/move.ts').TidyProof> {
2532
- const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
2533
- const { confirmedUp } = await import('../media-store/remote.ts')
2534
- const up = (key: string, size: number): Promise<boolean> => confirmedUp(key, size)
2535
- if (!threadsOn()) return { hqLacks: async () => ({ refused: 'the switch hq-cards is off: no hq holds them' }), up }
2536
- const { myHq } = await import('../hq/hq-local.ts')
2537
- const hq = myHq()
2538
- if ('refused' in hq) return { hqLacks: async () => ({ refused: `the hq is not reached (${hq.refused})` }), up }
2539
- const { dirname } = await import('node:path')
2540
- const { held, left } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
2541
- const diff = await threadsDiff(hq, held)
2542
- if ('refused' in diff) return { hqLacks: async () => ({ refused: `the hq refused the check: ${diff.refused}` }), up }
2543
- const { repoIdOf } = await import('../review/item-db.ts')
2544
- const byRepo = new Map(diff.map((d) => [d.repo, new Set([...d.onlyHere, ...d.differ])]))
2545
- return {
2546
- hqLacks: async (dir) => {
2547
- const set = byRepo.get(repoIdOf(dir))
2548
- if (set != null) return set
2549
- return { refused: left.some((l) => dir.startsWith(l)) ? 'a repo with no remote: the hq carries none of its threads' : 'the hq holds no threads of this repo' }
2550
- },
2551
- up,
2552
- }
2553
- }
2554
-
2555
- /** with the switch hq-cards on, what the hq and this machine's files do not hold alike, a line each: the move's
2556
- * proof that nothing it leaves behind is missing elsewhere. Null with the switch off */
2557
- function hqDiffOf(stores: readonly string[]): () => Promise<string[] | null> {
2558
- return async () => {
2559
- const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
2560
- if (!threadsOn()) return null
2561
- const { myHq } = await import('../hq/hq-local.ts')
2562
- const hq = myHq()
2563
- if ('refused' in hq) return [`the hq is not reached (${hq.refused}): the check hq-cards cannot prove both sides equal`]
2564
- const { dirname } = await import('node:path')
2565
- const { held } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
2566
- const diff = await threadsDiff(hq, held)
2567
- if ('refused' in diff) return [`the hq refused the check: ${diff.refused}`]
2568
- return diff.flatMap((d) => (d.onlyHere.length + d.onlyHq.length + d.differ.length === 0 ? [] : [`${d.repo}: ${d.onlyHere.length} only here, ${d.onlyHq.length} only in the hq, ${d.differ.length} at two revs (${[...d.onlyHere, ...d.onlyHq, ...d.differ].slice(0, 3).join(', ')})`]))
2569
- }
2570
- }
2571
-
2572
- export class ReviewExportCommand extends Command {
2573
- static override paths = [['review', 'export']]
2574
- static override usage = Command.Usage({
2575
- category: 'Review',
2576
- description: 'threads of this repo written as their files, one folder an item, into a folder',
2577
- details: `${DETAILS}\n\nWith the switch cards-in-db on, an item is rows of the daemon's database; export writes it as the folder the files backend keeps (\`<to>/<id>/item.json\`, \`thread/<message>.json\`, and each media file this machine still holds; a file the disk let go is named, its key in the head's media). Nothing in the store changes.`,
2578
- examples: [['one item', 'sk thread export 20261118-210000-the-gate --to /tmp/threads'], ['every item of the repo', 'sk thread export --all --to /tmp/threads']],
2579
- })
2580
- all = Option.Boolean('--all', false, { description: 'every item of the repo' })
2581
- to = Option.String('--to', { required: true, description: 'the folder the items are written into' })
2582
- ids = Option.Rest()
2583
-
2584
- async execute(): Promise<number> {
2585
- return run(this.context, async (h) => {
2586
- const { threadsInDb } = await import('../hq/switch.ts')
2587
- const { resolve } = await import('node:path')
2588
- if (this.all === this.ids.length > 0) throw new Error('give item ids or --all')
2589
- const to = resolve(this.to)
2590
- if (to === resolve(h.dir)) throw new Error(`--to ${this.to}: the store itself; sk thread move --back --go writes the rows into the store`)
2591
- const ids = this.all ? undefined : await Promise.all(this.ids.map((r) => idOf(h.dir, r)))
2592
- let r: import('../review/move.ts').Moved
2593
- if (threadsInDb()) r = (await import('../review/move.ts')).exportRows(h.dir, { to, ...(ids ? { ids } : {}) })
2594
- else {
2595
- // the files are the store: a copy of each folder is the export
2596
- const { cpSync, existsSync } = await import('node:fs')
2597
- const { itemIds } = await import('../review/store.ts')
2598
- const { join } = await import('node:path')
2599
- const want = ids ?? itemIds(h.dir)
2600
- for (const id of want) if (!existsSync(join(to, id))) cpSync(join(h.dir, id), join(to, id), { recursive: true })
2601
- r = { dir: h.dir, items: want.length, heads: want.length, msgs: 0, gone: 0, same: 0, files: 0, kept: [], broken: [], read: [] }
2602
- }
2603
- h.out(`review: ${r.items} items written into ${to} (${r.heads} heads, ${r.msgs} messages${r.media ? `, ${r.media.copied} media files` : ''})`)
2604
- for (const k of r.kept) h.out(` kept: ${k}`)
2605
- for (const b of r.broken) h.err(` does not read: ${b}`)
2606
- if (r.media && r.media.missing.length > 0) h.out(` ${r.media.missing.length} media files this machine no longer holds (the Space has them by their key in the head): ${r.media.missing.slice(0, 5).join(', ')}`)
2607
- return r.broken.length > 0 ? 1 : 0
2608
- })
2609
- }
2610
- }
2611
-
2612
2760
  /** what `propose` was typed with: its positionals, the thread it goes in, who acts, and its fields in the order typed:
2613
2761
  * `--field <key>` opens a field, the value flags after it are that field's; with no `--field`, one field */
2614
2762
  export function proposeArgs(args: readonly string[], read: (file: string) => string): { positionals: string[]; into?: string; as?: string; replaces?: string; fields: import('../review/store.ts').ProposeInput[] } {
@@ -2756,63 +2904,17 @@ export class ThreadAttachCommand extends Command {
2756
2904
  }
2757
2905
  }
2758
2906
 
2759
- export class ReviewMigrateCommand extends Command {
2760
- static override paths = [
2761
- ['thread', 'migrate'],
2762
- ['review', 'migrate'],
2763
- ]
2764
- static override usage = Command.Usage({
2765
- category: 'Review',
2766
- description: "fold the threads that own one address into one; dry run, --go after a backup",
2767
- details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go first runs sk backup (the machine db, where the daemon's rows are, goes to the Space as a snapshot) and stops when it fails, then writes each link through the head's one rewrite path. Only a missing link is written: a second run finds nothing. His notes read in their thread already: none is written. With hq-cards on, each changed head goes to the hq like any changed head. Page: wiki tools/shipkit/threads-store.md, The one thread guard`,
2768
- examples: [['what it would fold here', 'sk thread migrate'], ['every house store', 'sk thread migrate --all'], ['fold them', 'sk thread migrate --all --go']],
2769
- })
2770
- go = Option.Boolean('--go', false, { description: 'write the links, after a backup' })
2771
- all = Option.Boolean('--all', false, { description: 'every house store of this machine, not only this repo' })
2907
+ /** `review …`, the retired name of `thread`: one refusal that names the new line, never the verb run */
2908
+ export class ReviewRetiredCommand extends Command {
2909
+ static override paths = [['review']]
2910
+ static override usage = undefined
2911
+ words = Option.Proxy()
2772
2912
 
2773
2913
  async execute(): Promise<number> {
2774
- return run(this.context, async (h) => {
2775
- const { dirname } = await import('node:path')
2776
- const { openReview } = await import('../review/project.ts')
2777
- const { foldStore } = await import('../review/thread-fold.ts')
2778
- const { repoIdOf } = await import('../review/item-db.ts')
2779
- const { threadsInDb } = await import('../hq/switch.ts')
2780
- const { existsSync } = await import('node:fs')
2781
- const dirs = this.all ? await houseStores() : [h.dir]
2782
- const seen = new Set<string>()
2783
- const stores = dirs.filter((d) => {
2784
- const key = threadsInDb() ? repoIdOf(d) : d
2785
- if (seen.has(key)) return false
2786
- seen.add(key)
2787
- return threadsInDb() || existsSync(d)
2788
- })
2789
- const plans = []
2790
- for (const d of stores) {
2791
- await openReview(dirname(dirname(d)))
2792
- plans.push({ d, ...foldStore(d, { go: false }) })
2793
- }
2794
- const todo = plans.filter((p) => p.links.length > 0)
2795
- for (const p of plans) h.out(`${p.d}: ${p.links.length} links, ${p.before} threads to ${p.after}`)
2796
- for (const p of todo) for (const l of p.links) h.out(` ${l.address}: ${l.id} supersedes ${l.supersedes}`)
2797
- if (todo.length === 0) {
2798
- h.out('ok: every address is one thread, nothing to fold')
2799
- return 0
2800
- }
2801
- if (!this.go) {
2802
- h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'} backs up, then folds`)
2803
- return 0
2804
- }
2805
- h.out('backup first: sk backup')
2806
- const b = Bun.spawnSync(['sk', 'backup'], { stdout: 'pipe', stderr: 'pipe' })
2807
- const said = `${b.stdout?.toString() ?? ''}${b.stderr?.toString() ?? ''}`.trim()
2808
- for (const l of said.split('\n').slice(-3)) h.out(` ${l}`)
2809
- if (b.exitCode !== 0) throw new Error('sk backup failed: nothing folded, the stores are as they were')
2810
- for (const p of todo) {
2811
- const r = foldStore(p.d, { go: true })
2812
- h.out(`${p.d}: ${r.links.length} links written, ${r.before} threads to ${r.after}`)
2813
- }
2814
- return 0
2815
- })
2914
+ const line = this.words.map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')
2915
+ // sk-disable-next-line SK050 -- the refusal names the retired command
2916
+ this.context.stderr.write(`FAIL: sk review is now sk thread: sk thread ${line}`.trimEnd() + '\n')
2917
+ return 1
2816
2918
  }
2817
2919
  }
2818
2920
 
@@ -2827,18 +2929,12 @@ export const REVIEW_COMMANDS = [
2827
2929
  ReviewUpdateCommand,
2828
2930
  ReviewWithdrawCommand,
2829
2931
  ReviewReopenCommand,
2830
- ReviewPickCommand,
2831
2932
  ReviewFixedCommand,
2832
2933
  ReviewWontfixCommand,
2833
2934
  ReviewClaimCommand,
2834
2935
  ReviewReleaseCommand,
2835
- ReviewBlockedCommand,
2836
2936
  ReviewDoneCommand,
2837
- ReviewDispatcherCommand,
2838
- ReviewDispatchCommand,
2839
2937
  ReviewAskCommand,
2840
- ReviewDropCommand,
2841
- ReviewReassignCommand,
2842
2938
  ReviewNextCommand,
2843
2939
  ReviewTopicsCommand,
2844
2940
  ReviewBoardCommand,
@@ -2849,18 +2945,15 @@ export const REVIEW_COMMANDS = [
2849
2945
  ReviewStageCommand,
2850
2946
  ReviewAutoCommand,
2851
2947
  ReviewWatchCommand,
2852
- ReviewMoveCommand,
2853
- ReviewExportCommand,
2854
- ReviewMigrateCommand,
2855
2948
  ThreadProposeCommand,
2856
2949
  ThreadAttachCommand,
2857
2950
  ThreadTakeCommand,
2951
+ ThreadRenameCommand,
2952
+ ThreadSuggestMoveCommand,
2953
+ ThreadCloseCommand,
2954
+ ThreadRecapCommand,
2955
+ ThreadTagCommand,
2858
2956
  ThreadAssignCommand,
2859
2957
  ThreadWorkingCommand,
2958
+ ReviewRetiredCommand,
2860
2959
  ]
2861
-
2862
- // every verb is `sk thread <verb>`, and `sk review <verb>` its older name (run() says the new form on stderr)
2863
- for (const C of REVIEW_COMMANDS) {
2864
- const paths = (C.paths ?? []).flatMap((p) => (p[0] === 'review' ? [['thread', ...p.slice(1)], p] : [p]))
2865
- C.paths = paths.filter((p, i) => paths.findIndex((q) => q.join(' ') === p.join(' ')) === i)
2866
- }