rvlib-shipkit 2.29.0 → 2.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (512) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/package.json +2 -1
  3. package/src/advisors/app-graph.ts +1 -1
  4. package/src/advisors/expose.ts +5 -1
  5. package/src/advisors/r2.ts +7 -9
  6. package/src/advisors/routes.ts +29 -2
  7. package/src/advisors/scan.ts +11 -0
  8. package/src/agent-time/accounts-usage.ts +8 -0
  9. package/src/agent-time/claude-sessions.ts +32 -0
  10. package/src/agent-time/hooks.ts +1 -1
  11. package/src/agent-time/live.ts +5 -2
  12. package/src/agent-time/registry.ts +186 -89
  13. package/src/agent-time/store.ts +6 -4
  14. package/src/asks/ask-doc.ts +2 -2
  15. package/src/asks/ask-store.ts +22 -7
  16. package/src/check.ts +9 -1
  17. package/src/checks/SK001-package-json-shape.check.ts +1 -0
  18. package/src/checks/SK003-claude-md-shape.check.ts +1 -0
  19. package/src/checks/SK004-gitignore-policy.check.ts +12 -6
  20. package/src/checks/SK008-reviewer-agent.check.ts +4 -7
  21. package/src/checks/SK013-one-way-in-policy.check.ts +1 -0
  22. package/src/checks/SK017-vscode-hub-task.check.ts +1 -0
  23. package/src/checks/SK024-identity-colors.check.ts +1 -1
  24. package/src/checks/SK027-agent-wiki-links.check.ts +2 -1
  25. package/src/checks/SK033-global-contribution.check.ts +1 -0
  26. package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
  27. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -0
  28. package/src/checks/SK049-thread-answers-hook.check.ts +9 -5
  29. package/src/checks/SK050-retired-commands.check.ts +1 -0
  30. package/src/checks/SK051-no-formatter.check.ts +1 -0
  31. package/src/cli/channel-run.ts +17 -0
  32. package/src/cli/cmd_Advisors.ts +28 -7
  33. package/src/cli/cmd_Asks.ts +2 -2
  34. package/src/cli/cmd_Backup.ts +5 -1
  35. package/src/cli/cmd_CacheAudit.ts +1 -1
  36. package/src/cli/cmd_Channel.ts +43 -0
  37. package/src/cli/cmd_GlobalProcesses.ts +1 -0
  38. package/src/cli/cmd_Home.ts +12 -5
  39. package/src/cli/cmd_Hooks.ts +1 -1
  40. package/src/cli/cmd_Hq.ts +43 -0
  41. package/src/cli/cmd_Lanes.ts +15 -3
  42. package/src/cli/cmd_Media.ts +8 -3
  43. package/src/cli/cmd_Orchestrator.ts +253 -84
  44. package/src/cli/cmd_OrchestratorRole.ts +163 -0
  45. package/src/cli/cmd_Review.ts +142 -165
  46. package/src/cli/cmd_Secret.ts +44 -14
  47. package/src/cli/cmd_Shot.ts +2 -4
  48. package/src/cli/cmd_Sound.ts +1 -0
  49. package/src/cli/cmd_Urls.ts +3 -3
  50. package/src/cli/inbox-hook-run.ts +109 -0
  51. package/src/cli/registry.ts +6 -2
  52. package/src/cli/review-here.ts +136 -0
  53. package/src/cli.ts +45 -14
  54. package/src/collections/actions.ts +5 -4
  55. package/src/collections/checks.ts +5 -0
  56. package/src/collections/collection-types.ts +4 -3
  57. package/src/collections/pings.ts +4 -1
  58. package/src/collections/providers.ts +6 -4
  59. package/src/collections/tests.ts +7 -4
  60. package/src/core/app-icon-frame.ts +62 -0
  61. package/src/core/app-icon.ts +179 -17
  62. package/src/core/archived.ts +10 -7
  63. package/src/core/check-ctx.ts +38 -4
  64. package/src/core/check-pass.ts +7 -0
  65. package/src/core/foreign.ts +87 -0
  66. package/src/core/gui-color.ts +75 -0
  67. package/src/core/hub-theme.ts +1 -3
  68. package/src/core/layout.ts +3 -0
  69. package/src/core/machine-commit.ts +9 -1
  70. package/src/core/one-lib.ts +2 -1
  71. package/src/core/one-way-in-policy.ts +17 -12
  72. package/src/core/owner-word-policy.ts +123 -0
  73. package/src/core/panel-shades.ts +140 -0
  74. package/src/core/repo-gui-color.ts +16 -0
  75. package/src/core/role-policy.ts +17 -0
  76. package/src/core/scope.ts +6 -3
  77. package/src/core/tmux-policy.ts +264 -0
  78. package/src/core/unit-icon.ts +43 -0
  79. package/src/fleet/push-fleet.ts +2 -0
  80. package/src/fleet/scan-fleet.ts +3 -0
  81. package/src/gate/cache-audit.ts +7 -1
  82. package/src/gate/gate-checks.ts +14 -9
  83. package/src/gate/run-fix.ts +30 -5
  84. package/src/gate/run-fixers.ts +8 -3
  85. package/src/home/activity-shape.ts +2 -0
  86. package/src/home/activity.ts +2 -1
  87. package/src/home/daemon-guard.ts +20 -2
  88. package/src/home/daemon-jobs.ts +26 -18
  89. package/src/home/gui-app/ShipkitGui.swift +2012 -144
  90. package/src/home/gui-app/icon.svg +8 -0
  91. package/src/home/gui-app.ts +94 -30
  92. package/src/home/home-routes.ts +53 -9
  93. package/src/home/home-start.ts +27 -3
  94. package/src/home/inbox-shape.ts +7 -3
  95. package/src/home/log-follow.ts +117 -0
  96. package/src/home/machine-fold.ts +1 -1
  97. package/src/home/open-app.ts +9 -3
  98. package/src/home/page-build.ts +5 -1
  99. package/src/home/page-held.ts +1 -1
  100. package/src/home/pm-config.ts +0 -8
  101. package/src/home/pm.ts +62 -5
  102. package/src/home/process-apps.ts +70 -23
  103. package/src/home/process-rows.ts +16 -1
  104. package/src/home/push-sources.ts +18 -13
  105. package/src/home/resources.ts +16 -7
  106. package/src/home/run-daemon.ts +4 -1
  107. package/src/home/run-pm.ts +1 -1
  108. package/src/home/serve-daemon.ts +13 -4
  109. package/src/home/serve-web.ts +141 -17
  110. package/src/home/space-page.ts +3 -3
  111. package/src/home/space-route.ts +2 -2
  112. package/src/home/supervise.ts +2 -1
  113. package/src/home/vault-page.ts +2 -1
  114. package/src/home/web-places.ts +239 -0
  115. package/src/home/widgets.ts +16 -2
  116. package/src/hooks/commit-message.ts +11 -9
  117. package/src/hooks/one-way-in-guard.ts +145 -68
  118. package/src/hooks/run-hooks.ts +15 -5
  119. package/src/hooks/shared-file.ts +273 -83
  120. package/src/hooks/shell-writes.ts +620 -0
  121. package/src/hooks/write-log.ts +149 -0
  122. package/src/hq/door-route.ts +63 -7
  123. package/src/hq/door.ts +45 -12
  124. package/src/hq/history-send.ts +3 -1
  125. package/src/hq/hq-db.ts +10 -3
  126. package/src/hq/hq-local.ts +24 -5
  127. package/src/hq/hq-routes.ts +3 -1
  128. package/src/hq/hq-store.ts +9 -3
  129. package/src/hq/kinds/index.ts +2 -1
  130. package/src/hq/kinds/kind.ts +9 -4
  131. package/src/hq/kinds/presence-rule.ts +56 -0
  132. package/src/hq/kinds/presence.ts +210 -0
  133. package/src/hq/kinds/report.ts +8 -5
  134. package/src/hq/lead-order.ts +68 -0
  135. package/src/hq/outbox.ts +7 -0
  136. package/src/hq/replica.ts +5 -7
  137. package/src/hq/report-facts.ts +14 -7
  138. package/src/hq/report.ts +47 -2
  139. package/src/hq/switch.ts +1 -0
  140. package/src/hq/terminal-hop.ts +64 -0
  141. package/src/hq/thread-sync.ts +13 -6
  142. package/src/http/door-forward.ts +10 -12
  143. package/src/http/door-names.ts +9 -0
  144. package/src/http/hop-caller.ts +23 -0
  145. package/src/http/hop-names.ts +14 -0
  146. package/src/http/loopback-serve.ts +28 -6
  147. package/src/http/owner-word.ts +128 -0
  148. package/src/http/same-origin.ts +12 -0
  149. package/src/{serve → http}/secret-gate.ts +3 -3
  150. package/src/ledger/run-log.ts +25 -1
  151. package/src/media-store/backup/sources.ts +53 -6
  152. package/src/media-store/backup/thread-copy.ts +9 -5
  153. package/src/media-store/copy/config.ts +10 -9
  154. package/src/media-store/daemon.ts +5 -2
  155. package/src/media-store/put.ts +3 -0
  156. package/src/media-store/space.ts +14 -16
  157. package/src/media-store/upload.ts +4 -0
  158. package/src/messages/collection.ts +2 -2
  159. package/src/messages/model.ts +6 -1
  160. package/src/messages/routes.ts +3 -0
  161. package/src/orchestrator/brief.md +8 -6
  162. package/src/orchestrator/channel-declare.ts +58 -0
  163. package/src/orchestrator/channel.ts +226 -0
  164. package/src/orchestrator/guards.ts +12 -3
  165. package/src/orchestrator/host.ts +35 -0
  166. package/src/orchestrator/lead-shape.ts +86 -0
  167. package/src/orchestrator/now.ts +88 -0
  168. package/src/orchestrator/phone.ts +4 -1
  169. package/src/orchestrator/places-file.ts +38 -0
  170. package/src/orchestrator/places-look.ts +180 -0
  171. package/src/orchestrator/places-shape.ts +151 -0
  172. package/src/orchestrator/places.ts +50 -0
  173. package/src/orchestrator/presence-shape.ts +13 -2
  174. package/src/orchestrator/presence.ts +26 -15
  175. package/src/orchestrator/push.ts +5 -10
  176. package/src/orchestrator/role-shape.ts +270 -0
  177. package/src/orchestrator/role.ts +242 -0
  178. package/src/orchestrator/routes.ts +136 -31
  179. package/src/orchestrator/sessions-shape.ts +78 -0
  180. package/src/orchestrator/sessions.ts +86 -0
  181. package/src/orchestrator/share.ts +71 -0
  182. package/src/orchestrator/start-notice.ts +61 -0
  183. package/src/orchestrator/start.ts +137 -0
  184. package/src/orchestrator/started.ts +55 -0
  185. package/src/orchestrator/stuck.ts +196 -0
  186. package/src/orchestrator/unheard.ts +18 -7
  187. package/src/pages/frame-client.ts +44 -6
  188. package/src/problems/failure-words.ts +80 -0
  189. package/src/release/run-bump.ts +26 -5
  190. package/src/release/run-release.ts +34 -14
  191. package/src/repo-config.ts +37 -9
  192. package/src/review/aside-at.ts +19 -0
  193. package/src/review/band.ts +3 -3
  194. package/src/review/doc-save.ts +1 -1
  195. package/src/review/inbox-hook.ts +12 -4
  196. package/src/review/inbox-read.ts +20 -7
  197. package/src/review/instruction-guards.ts +137 -0
  198. package/src/review/instructions.ts +14 -2
  199. package/src/review/item-db.ts +52 -2
  200. package/src/review/mentions.ts +6 -4
  201. package/src/review/model.ts +3 -2
  202. package/src/review/parties.ts +88 -19
  203. package/src/review/push.ts +32 -15
  204. package/src/review/routes.ts +12 -4
  205. package/src/review/secret-route.ts +5 -5
  206. package/src/review/snooze.ts +1 -16
  207. package/src/review/store-parties.ts +4 -2
  208. package/src/review/take-back.ts +2 -1
  209. package/src/review/threads.ts +13 -2
  210. package/src/review/unit.ts +3 -2
  211. package/src/review/view-layout.ts +8 -1
  212. package/src/review/watchers.ts +25 -4
  213. package/src/secrets/key-pair.ts +14 -0
  214. package/src/secrets/lapse.ts +3 -3
  215. package/src/secrets/manager.ts +5 -1
  216. package/src/secrets/name-template.ts +83 -0
  217. package/src/secrets/name.ts +3 -0
  218. package/src/secrets/read.ts +10 -6
  219. package/src/secrets/secrets-view.ts +299 -0
  220. package/src/secrets/who-reads.ts +2 -1
  221. package/src/serve/frame-part.ts +49 -0
  222. package/src/serve/hub-app/accounts-line.tsx +33 -45
  223. package/src/serve/hub-app/activity-st.ts +6 -5
  224. package/src/serve/hub-app/activity-view.tsx +10 -9
  225. package/src/serve/hub-app/advice-box.tsx +6 -5
  226. package/src/serve/hub-app/advisor-app.tsx +2 -0
  227. package/src/serve/hub-app/advisor-face.tsx +3 -2
  228. package/src/serve/hub-app/advisor.html +1 -0
  229. package/src/serve/hub-app/advisors-view.tsx +52 -10
  230. package/src/serve/hub-app/advisors.css +4 -0
  231. package/src/serve/hub-app/app-bridge.ts +31 -5
  232. package/src/serve/hub-app/asked-page.ts +24 -0
  233. package/src/serve/hub-app/asks-page.tsx +10 -6
  234. package/src/serve/hub-app/auto-text.tsx +7 -5
  235. package/src/serve/hub-app/card-head.tsx +3 -2
  236. package/src/serve/hub-app/check-view.tsx +10 -9
  237. package/src/serve/hub-app/checks-svc.ts +96 -32
  238. package/src/serve/hub-app/clock-svc.ts +24 -8
  239. package/src/serve/hub-app/code-copy.ts +1 -1
  240. package/src/serve/hub-app/col-card.tsx +2 -1
  241. package/src/serve/hub-app/col-list-page.tsx +12 -6
  242. package/src/serve/hub-app/col-list-st.ts +12 -2
  243. package/src/serve/hub-app/col-tables-view.tsx +8 -44
  244. package/src/serve/hub-app/col-tables.ts +0 -14
  245. package/src/serve/hub-app/cols-svc.ts +6 -12
  246. package/src/serve/hub-app/columns.ts +94 -0
  247. package/src/serve/hub-app/comfy-view.tsx +8 -7
  248. package/src/serve/hub-app/commands/commands-page.tsx +4 -3
  249. package/src/serve/hub-app/commands/commands-st.ts +2 -2
  250. package/src/serve/hub-app/controls.css +69 -23
  251. package/src/serve/hub-app/cycle-button.tsx +2 -1
  252. package/src/serve/hub-app/database-st.ts +1 -1
  253. package/src/serve/hub-app/database-view.tsx +4 -2
  254. package/src/serve/hub-app/deaf.tsx +27 -0
  255. package/src/serve/hub-app/dock-st.ts +21 -16
  256. package/src/serve/hub-app/dock-view.tsx +19 -12
  257. package/src/serve/hub-app/empty-section.tsx +30 -0
  258. package/src/serve/hub-app/entry-bar.css +1 -1
  259. package/src/serve/hub-app/entry-bar.tsx +11 -6
  260. package/src/serve/hub-app/entry-list.css +32 -0
  261. package/src/serve/hub-app/entry-list.tsx +123 -0
  262. package/src/serve/hub-app/entry-pick.ts +1 -1
  263. package/src/serve/hub-app/entry-sections.ts +140 -0
  264. package/src/serve/hub-app/event-stream-reader.ts +56 -0
  265. package/src/serve/hub-app/floating.tsx +68 -14
  266. package/src/serve/hub-app/geometry-view.tsx +3 -2
  267. package/src/serve/hub-app/git-view.tsx +3 -2
  268. package/src/serve/hub-app/hash-route.ts +14 -2
  269. package/src/serve/hub-app/header-bar.tsx +53 -36
  270. package/src/serve/hub-app/home-st.ts +131 -14
  271. package/src/serve/hub-app/home-strip.css +24 -13
  272. package/src/serve/hub-app/home-strip.tsx +131 -66
  273. package/src/serve/hub-app/home.html +5 -0
  274. package/src/serve/hub-app/hub-app.tsx +94 -102
  275. package/src/serve/hub-app/hub.css +61 -94
  276. package/src/serve/hub-app/icons.tsx +16 -0
  277. package/src/serve/hub-app/identities-st.ts +19 -54
  278. package/src/serve/hub-app/identities-view.tsx +25 -24
  279. package/src/serve/hub-app/identity-address.ts +2 -2
  280. package/src/serve/hub-app/in-sight.ts +10 -0
  281. package/src/serve/hub-app/inbox-st.ts +20 -2
  282. package/src/serve/hub-app/inbox-view.tsx +16 -9
  283. package/src/serve/hub-app/inbox.css +1 -0
  284. package/src/serve/hub-app/index.html +5 -0
  285. package/src/serve/hub-app/insights-view.tsx +6 -5
  286. package/src/serve/hub-app/instructions.css +4 -1
  287. package/src/serve/hub-app/kept-cols.tsx +83 -20
  288. package/src/serve/hub-app/kept-width.tsx +76 -0
  289. package/src/serve/hub-app/keys.ts +116 -38
  290. package/src/serve/hub-app/layout-st.ts +109 -99
  291. package/src/serve/hub-app/lightbox-zoom.css +36 -0
  292. package/src/serve/hub-app/list-filter.tsx +15 -6
  293. package/src/serve/hub-app/list-head.tsx +29 -0
  294. package/src/serve/hub-app/list-row.ts +8 -0
  295. package/src/serve/hub-app/list-walk.ts +26 -105
  296. package/src/serve/hub-app/live-socket.ts +274 -0
  297. package/src/serve/hub-app/live-sources.ts +189 -0
  298. package/src/serve/hub-app/live-svc.ts +2 -2
  299. package/src/serve/hub-app/machine-st.ts +75 -14
  300. package/src/serve/hub-app/main-panel.css +211 -0
  301. package/src/serve/hub-app/main-panel.tsx +259 -0
  302. package/src/serve/hub-app/md.ts +4 -4
  303. package/src/serve/hub-app/media-svc.ts +5 -5
  304. package/src/serve/hub-app/media-view.tsx +13 -12
  305. package/src/serve/hub-app/messages/messages-page.tsx +8 -7
  306. package/src/serve/hub-app/messages/messages-st.ts +5 -2
  307. package/src/serve/hub-app/new-thread-st.ts +170 -0
  308. package/src/serve/hub-app/new-thread.tsx +133 -107
  309. package/src/serve/hub-app/orchestrator-line.tsx +115 -45
  310. package/src/serve/hub-app/orchestrator-places.tsx +86 -0
  311. package/src/serve/hub-app/orchestrator.css +57 -5
  312. package/src/serve/hub-app/page-keys.ts +107 -68
  313. package/src/serve/hub-app/page-reload.ts +46 -6
  314. package/src/serve/hub-app/pages-frames.tsx +40 -3
  315. package/src/serve/hub-app/pages-svc.ts +3 -1
  316. package/src/serve/hub-app/palette-st.ts +198 -43
  317. package/src/serve/hub-app/palette-view.tsx +32 -8
  318. package/src/serve/hub-app/panel-head-action.tsx +39 -0
  319. package/src/serve/hub-app/panel-head.tsx +70 -0
  320. package/src/serve/hub-app/panel-repo.ts +42 -0
  321. package/src/serve/hub-app/panel-source.ts +195 -0
  322. package/src/serve/hub-app/panel-tint.css +6 -0
  323. package/src/serve/hub-app/panel-tint.ts +23 -0
  324. package/src/serve/hub-app/panel-walk.ts +107 -0
  325. package/src/serve/hub-app/pill-row.tsx +2 -1
  326. package/src/serve/hub-app/place-path.ts +4 -0
  327. package/src/serve/hub-app/places-svc.ts +75 -0
  328. package/src/serve/hub-app/plan-view.tsx +3 -2
  329. package/src/serve/hub-app/polled.ts +11 -1
  330. package/src/serve/hub-app/presence-st.ts +66 -32
  331. package/src/serve/hub-app/processes-view.tsx +2 -2
  332. package/src/serve/hub-app/project-bar.tsx +116 -0
  333. package/src/serve/hub-app/project-list.css +20 -173
  334. package/src/serve/hub-app/project-list.tsx +30 -298
  335. package/src/serve/hub-app/projects-svc.ts +59 -32
  336. package/src/serve/hub-app/push-sign.tsx +2 -1
  337. package/src/serve/hub-app/push-svc.ts +86 -69
  338. package/src/serve/hub-app/quiet-st.ts +5 -3
  339. package/src/serve/hub-app/rail-groups.ts +144 -0
  340. package/src/serve/hub-app/reader-chips.tsx +2 -1
  341. package/src/serve/hub-app/recordings-st.ts +2 -1
  342. package/src/serve/hub-app/recordings-view.tsx +19 -47
  343. package/src/serve/hub-app/recordings.css +0 -2
  344. package/src/serve/hub-app/reflections-page.tsx +10 -6
  345. package/src/serve/hub-app/releases/releases-page.tsx +6 -5
  346. package/src/serve/hub-app/repo-sections.ts +127 -38
  347. package/src/serve/hub-app/repo-st.ts +57 -36
  348. package/src/serve/hub-app/review/advisor-bar.tsx +3 -2
  349. package/src/serve/hub-app/review/ask-proof.tsx +79 -0
  350. package/src/serve/hub-app/review/attach-view.tsx +11 -10
  351. package/src/serve/hub-app/review/box-view.ts +479 -0
  352. package/src/serve/hub-app/review/box-zoom.tsx +70 -0
  353. package/src/serve/hub-app/review/diff-view.tsx +3 -2
  354. package/src/serve/hub-app/review/doc-body.tsx +2 -1
  355. package/src/serve/hub-app/review/dock.tsx +3 -2
  356. package/src/serve/hub-app/review/draft-body.tsx +4 -3
  357. package/src/serve/hub-app/review/faces.tsx +0 -8
  358. package/src/serve/hub-app/review/group-block.tsx +8 -7
  359. package/src/serve/hub-app/review/heard-line.tsx +4 -3
  360. package/src/serve/hub-app/review/instructions-view.tsx +3 -2
  361. package/src/serve/hub-app/review/item-verdict.tsx +40 -40
  362. package/src/serve/hub-app/review/kind-states.tsx +5 -4
  363. package/src/serve/hub-app/review/kit.tsx +24 -4
  364. package/src/serve/hub-app/review/lane-bar.tsx +30 -28
  365. package/src/serve/hub-app/review/lightbox.tsx +6 -4
  366. package/src/serve/hub-app/review/live-bar.tsx +7 -6
  367. package/src/serve/hub-app/review/live-view.tsx +6 -5
  368. package/src/serve/hub-app/review/object-card.tsx +2 -1
  369. package/src/serve/hub-app/review/object-panel.tsx +11 -10
  370. package/src/serve/hub-app/review/pano-view.tsx +3 -2
  371. package/src/serve/hub-app/review/question-views.tsx +6 -5
  372. package/src/serve/hub-app/review/review-cells.tsx +21 -20
  373. package/src/serve/hub-app/review/review-host.ts +3 -0
  374. package/src/serve/hub-app/review/review-kit.ts +7 -5
  375. package/src/serve/hub-app/review/review-list.tsx +98 -52
  376. package/src/serve/hub-app/review/review-page.tsx +3 -3
  377. package/src/serve/hub-app/review/review-st.ts +70 -14
  378. package/src/serve/hub-app/review/review-thread.tsx +234 -138
  379. package/src/serve/hub-app/review/review-views.tsx +166 -191
  380. package/src/serve/hub-app/review/space3d.tsx +17 -9
  381. package/src/serve/hub-app/review/thread-close.tsx +24 -32
  382. package/src/serve/hub-app/review/thread-st.ts +39 -25
  383. package/src/serve/hub-app/review/trailer-body.tsx +5 -4
  384. package/src/serve/hub-app/review/trailer-page.tsx +18 -16
  385. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  386. package/src/serve/hub-app/review/trailer-timeline.tsx +10 -9
  387. package/src/serve/hub-app/review/trailer-voices.tsx +29 -28
  388. package/src/serve/hub-app/review.css +159 -42
  389. package/src/serve/hub-app/row-acts.tsx +126 -0
  390. package/src/serve/hub-app/row-face.tsx +29 -0
  391. package/src/serve/hub-app/running-rows.tsx +142 -0
  392. package/src/serve/hub-app/running-st.ts +110 -0
  393. package/src/serve/hub-app/search-view.tsx +3 -2
  394. package/src/serve/hub-app/secrets-page.tsx +290 -0
  395. package/src/serve/hub-app/secrets-st.ts +181 -0
  396. package/src/serve/hub-app/secrets.css +65 -0
  397. package/src/serve/hub-app/section-head.tsx +3 -2
  398. package/src/serve/hub-app/session-chips.tsx +55 -0
  399. package/src/serve/hub-app/shell.ts +56 -0
  400. package/src/serve/hub-app/site/site-part.tsx +6 -5
  401. package/src/serve/hub-app/site/site-st.ts +0 -6
  402. package/src/serve/hub-app/site.css +0 -1
  403. package/src/serve/hub-app/social/calendar.tsx +7 -6
  404. package/src/serve/hub-app/social/comms-page.tsx +29 -26
  405. package/src/serve/hub-app/social/group-editor.tsx +2 -1
  406. package/src/serve/hub-app/social/kit.tsx +12 -11
  407. package/src/serve/hub-app/social/next-release.tsx +3 -2
  408. package/src/serve/hub-app/social/post-card.tsx +21 -20
  409. package/src/serve/hub-app/social/post-page.tsx +2 -1
  410. package/src/serve/hub-app/social/problems.tsx +3 -2
  411. package/src/serve/hub-app/social/social-page.tsx +29 -27
  412. package/src/serve/hub-app/social/social-st.ts +4 -2
  413. package/src/serve/hub-app/social/stage-popup.tsx +11 -10
  414. package/src/serve/hub-app/social.css +7 -5
  415. package/src/serve/hub-app/source-acts.ts +79 -0
  416. package/src/serve/hub-app/source-page.tsx +17 -0
  417. package/src/serve/hub-app/space-view.tsx +5 -4
  418. package/src/serve/hub-app/stores/stores-page.tsx +21 -19
  419. package/src/serve/hub-app/stores/stores-st.ts +1 -1
  420. package/src/serve/hub-app/stores.css +1 -1
  421. package/src/serve/hub-app/terminal-history-st.ts +112 -0
  422. package/src/serve/hub-app/terminal-keys.ts +79 -0
  423. package/src/serve/hub-app/terminal-lib.ts +110 -0
  424. package/src/serve/hub-app/terminal-links.ts +55 -0
  425. package/src/serve/hub-app/terminal-list-st.ts +304 -0
  426. package/src/serve/hub-app/terminal-log-st.ts +242 -0
  427. package/src/serve/hub-app/terminal-out.ts +135 -0
  428. package/src/serve/hub-app/terminal-pages.tsx +115 -0
  429. package/src/serve/hub-app/terminal-panel.tsx +60 -9
  430. package/src/serve/hub-app/terminal-sources.tsx +335 -0
  431. package/src/serve/hub-app/terminal-st.ts +447 -167
  432. package/src/serve/hub-app/terminal-stream.ts +233 -0
  433. package/src/serve/hub-app/terminal-tab.tsx +64 -0
  434. package/src/serve/hub-app/terminal-widths.ts +30 -0
  435. package/src/serve/hub-app/terminal.css +50 -4
  436. package/src/serve/hub-app/test-view.tsx +5 -3
  437. package/src/serve/hub-app/tests-view.tsx +16 -15
  438. package/src/serve/hub-app/theme-st.ts +5 -0
  439. package/src/serve/hub-app/thread-row.tsx +39 -31
  440. package/src/serve/hub-app/time-ago.tsx +3 -2
  441. package/src/serve/hub-app/time-view.tsx +2 -1
  442. package/src/serve/hub-app/time.css +1 -1
  443. package/src/serve/hub-app/timeline-chart.tsx +5 -4
  444. package/src/serve/hub-app/timeline-view.tsx +10 -9
  445. package/src/serve/hub-app/tips.ts +247 -0
  446. package/src/serve/hub-app/tree-build.ts +40 -8
  447. package/src/serve/hub-app/tree-svc.ts +167 -134
  448. package/src/serve/hub-app/unit-icons.ts +26 -0
  449. package/src/serve/hub-app/url-address.ts +154 -0
  450. package/src/serve/hub-app/url-faces.ts +88 -0
  451. package/src/serve/hub-app/url-forms.tsx +183 -0
  452. package/src/serve/hub-app/urls-svc.ts +167 -5
  453. package/src/serve/hub-app/urls-view.tsx +56 -20
  454. package/src/serve/hub-app/urls.css +26 -0
  455. package/src/serve/hub-app/vault-view.tsx +5 -4
  456. package/src/serve/hub-app/veille/veille-page.tsx +34 -33
  457. package/src/serve/hub-app/veille/veille-st.ts +6 -3
  458. package/src/serve/hub-app/view-layout.css +3 -3
  459. package/src/serve/hub-app/when-view.tsx +5 -4
  460. package/src/serve/hub-app/wikis-view.tsx +6 -5
  461. package/src/serve/hub-app/words.tsx +9 -2
  462. package/src/serve/hub-runtime.ts +3 -2
  463. package/src/serve/orchestrator-host.ts +58 -0
  464. package/src/serve/page-live.ts +147 -0
  465. package/src/serve/project-gutter-route.ts +63 -2
  466. package/src/serve/read-worker.ts +7 -2
  467. package/src/serve/runs-stamp.ts +33 -0
  468. package/src/serve/secrets-read.ts +156 -0
  469. package/src/serve/serve-hub.ts +71 -22
  470. package/src/serve/terminal-claudes.ts +185 -0
  471. package/src/serve/terminal-guard.ts +10 -5
  472. package/src/serve/terminal-host.ts +517 -0
  473. package/src/serve/terminal-record.ts +104 -0
  474. package/src/serve/terminal-route.ts +466 -103
  475. package/src/serve/terminal-shells.ts +3 -0
  476. package/src/serve/terminal-watch.ts +102 -0
  477. package/src/shipkit-files.ts +9 -4
  478. package/src/shot/client.ts +4 -9
  479. package/src/shot/shooter.ts +2 -4
  480. package/src/shot/shot-ask.ts +2 -7
  481. package/src/shot/shot-theme.ts +6 -17
  482. package/src/social/routes.ts +2 -2
  483. package/src/social/writes.ts +3 -0
  484. package/src/suite/test-units.ts +6 -2
  485. package/src/trailer/sound/eleven.ts +1 -0
  486. package/src/urls/added.ts +111 -0
  487. package/src/urls/icons.ts +294 -0
  488. package/src/urls/places.ts +139 -0
  489. package/src/urls/routes.ts +17 -7
  490. package/src/urls/rows.ts +48 -15
  491. package/src/urls/unit.ts +57 -3
  492. package/src/urls/write-routes.ts +207 -0
  493. package/src/vault/vault-destroy.ts +2 -1
  494. package/src/vault/vault-import.ts +4 -11
  495. package/src/vault/vault-restore.ts +3 -2
  496. package/src/veille/chrome.ts +18 -3
  497. package/src/veille/identity.ts +6 -0
  498. package/src/view3d/cam.ts +30 -46
  499. package/src/view3d/lib.ts +20 -2
  500. package/src/view3d/viewer.ts +62 -88
  501. package/src/wiki/agent-paths.ts +2 -1
  502. package/src/orchestrator/deliver.ts +0 -81
  503. package/src/orchestrator/drill.ts +0 -129
  504. package/src/orchestrator/keeper.ts +0 -332
  505. package/src/orchestrator/pm.ts +0 -20
  506. package/src/orchestrator/state.ts +0 -92
  507. package/src/orchestrator/switch.ts +0 -86
  508. package/src/orchestrator/tmux.ts +0 -82
  509. package/src/serve/hub-app/rail-fly.tsx +0 -95
  510. package/src/serve/hub-app/side-lists.ts +0 -72
  511. package/src/serve/hub-app/sidebar.tsx +0 -62
  512. package/src/serve/hub-app/tree-row.tsx +0 -125
@@ -125,6 +125,8 @@ export interface HookIn {
125
125
  watchedIn?: (dir: string) => boolean
126
126
  /** the session's live watches run as a lane (watchers.ts laneWatchesOf): the line asking for its own watch names them */
127
127
  laneWatches?: readonly string[]
128
+ /** the project's orchestrator role in one line, on a prompt (orchestrator/role.ts rolePromptLine) */
129
+ role?: string
128
130
  }
129
131
 
130
132
  /** the threads of store `s` that `me`, a session, hears while no watch of it runs there: those not done, and those
@@ -137,6 +139,17 @@ export function unwatchedOf(s: StoreRead, me: Me, p: Parties, watched: boolean,
137
139
  return { repo: s.repo, open: open.length, his: open.filter((t) => isOwnerWait(waitOf(t, now))).map((t) => ownAddressesOf(t, s.say.spec)[0] ?? t.head.item.id) }
138
140
  }
139
141
 
142
+ /** the threads of store `s` that hold a word of the owner nobody hears, as `me` reads them: unseen ones (`threads`),
143
+ * then those read with nothing done since (`read`), each with the address to take it by; `store`: `s` reading those
144
+ * words alone */
145
+ export function orphansOf(s: StoreRead, me: Me, p: Parties): { store: StoreRead; threads: { g: Selected['threads'][number]; address: string }[]; read: { t: Thread; address: string }[] } {
146
+ const byItem = threadByItem(threadsOf(s.items, s.say.spec))
147
+ const store: StoreRead = { ...s, say: { ...s.say, to: (x, m) => hookWord(me, x, m, byItem, p, s.repo) === 'nobody' } }
148
+ const sel = selectInbox(store, (x, by) => hookHears(me, x, by, p, s.repo) === 'nobody', { hook: true })
149
+ const addressOf = (t: Thread): string => ownAddressesOf(t, s.say.spec)[0] ?? t.head.item.id
150
+ return { store, threads: sel.threads.map((g) => ({ g, address: g.t ? addressOf(g.t) : (g.items[0]?.item.id ?? '') })), read: sel.read.map((t) => ({ t, address: addressOf(t) })) }
151
+ }
152
+
140
153
  /** the hook's json line, or null for none: what `me` hears in every store (a prompt's context; a stop refused while
141
154
  * one is unseen), and on a prompt what nobody hears in the repo it stands in, with the way to take it */
142
155
  export function hookReply(o: HookIn): string | null {
@@ -171,25 +184,25 @@ export function hookReply(o: HookIn): string | null {
171
184
  owed.push(...heard.owed.map((t) => (s.here ? t.head.item.id : `${t.head.item.id} (in ${s.repo})`)))
172
185
  plain.push(...heard.plain.map((x) => x.item.id))
173
186
  if (anyone || !s.here || o.input.hook_event_name === 'Stop') continue
174
- const nobodyS = reach('nobody')
175
- const orphan = selectInbox(nobodyS, (x, byItem) => hookHears(o.me, x, byItem, o.parties, s.repo) === 'nobody', { hook: true })
176
- for (const g of orphan.threads) {
187
+ const orphan = orphansOf(s, o.me, o.parties)
188
+ for (const { g, address } of orphan.threads) {
177
189
  if (nobody.length >= NOBODY_SHOWN) {
178
190
  nobodyMore++
179
191
  continue
180
192
  }
181
- const address = g.t ? (ownAddressesOf(g.t, s.say.spec)[0] ?? g.t.head.item.id) : (g.items[0]?.item.id ?? '')
182
- nobody.push(`${selectedText(nobodyS, g)}\n take it: ${bin} thread take ${address}\n`)
193
+ nobody.push(`${selectedText(orphan.store, g)}\n take it: ${bin} thread take ${address}\n`)
183
194
  }
184
- for (const t of orphan.read) if (nobody.length < NOBODY_SHOWN) nobody.push(`${readLine(s, t, bin)}\n take it: ${bin} thread take ${ownAddressesOf(t, s.say.spec)[0] ?? t.head.item.id}\n`)
195
+ for (const { t, address } of orphan.read) if (nobody.length < NOBODY_SHOWN) nobody.push(`${readLine(s, t, bin)}\n take it: ${bin} thread take ${address}\n`)
185
196
  }
186
197
  if (plain.length > 0) mine.push(`${plain.length} plain approval(s), nothing to do: ${bin} thread seen ${plain.join(' ')}`)
187
198
  const nobodyText = [...nobody, ...(nobodyMore > 0 ? [`${nobodyMore} more: ${bin} thread inbox lists them`] : [])].join('\n').trim()
188
199
  const watchedIn = o.watchedIn ?? (() => o.parties.sessions.some((s) => s.id === o.me.session && s.watch))
189
200
  const unwatched = anyone ? [] : o.stores.flatMap((s) => unwatchedOf(s, o.me, o.parties, watchedIn(s.dir)) ?? [])
190
- return hookAnswer(o.input, mine.join('\n').trim(), owed, bin, nobodyText, lanes.join('\n').trim(), { ...(o.handed ? { handed: o.handed } : {}), unwatched, ...(o.laneWatches ? { laneWatches: o.laneWatches } : {}) })
201
+ return hookAnswer(o.input, mine.join('\n').trim(), owed, bin, nobodyText, lanes.join('\n').trim(), { ...(o.handed ? { handed: o.handed } : {}), unwatched, ...(o.laneWatches ? { laneWatches: o.laneWatches } : {}), ...(o.role ? { role: o.role } : {}) })
191
202
  }
192
203
 
204
+ // the events his answers reach a session on: a posting verb warns when one lacks. SessionStart, which only tells a
205
+ // new session who hears the project, is SK049's alone
193
206
  const EVENTS = ['UserPromptSubmit', 'Stop', 'SubagentStop'] as const
194
207
  type Settings = { hooks?: Record<string, unknown> } & Record<string, unknown>
195
208
 
@@ -0,0 +1,137 @@
1
+ // what a step of an ask never asks of the owner (wiki tools/shipkit/threads-instructions.md, How to write a step): two
2
+ // values joined by hand into one field, and several acts run together in one sentence or one bullet. Each reads the
3
+ // words alone, so it sees shapes, never intent: tests/instruction-guards.test.ts holds what each catches and lets pass.
4
+ // Pure and browser safe
5
+
6
+ type Field = { kind: 'secret' | 'url' | 'text'; hint: string }
7
+
8
+ const JOIN_WORDS = /\b(?:joined|glued|concatenated)\s+(?:by|with|using)\b[^.,;]*|\bseparated\s+(?:by|with)\s+(?:a|an|one)\b[^.,;]*|\bwith\s+a\s+(?:colon|comma|semicolon|pipe|slash)\b|\b(?:colon|comma|space)[ -]separated\b/i
9
+
10
+ const CAPS = '[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*'
11
+ /** `KEY:SECRET`, `ACCESS_KEY_ID:SECRET_ACCESS_KEY`, `A,B`: two placeholders around one character */
12
+ const CAPS_PAIR = new RegExp(`(?<![A-Za-z0-9_/.-])${CAPS}(?:\\s*[:;|+]\\s*|,)${CAPS}(?![A-Za-z0-9_/-])`)
13
+ /** `ACCESS_KEY_ID SECRET_ACCESS_KEY`: two placeholders and a space, as the whole of a hint or of a code span */
14
+ const CAPS_SPACED = new RegExp(`^(?=\\S*_|\\S+ \\S*_)${CAPS} ${CAPS}$`)
15
+ /** `<id>:<secret>`, `<id> <secret>` */
16
+ const ANGLE_PAIR = /<[^<>\n]+>\s*[:,;|+]?\s*<[^<>\n]+>/
17
+ /** `user:password`, `key:secret`, `id:secret` */
18
+ const WORD_PAIR = /\b(?:user(?:name)?|login|e-?mail|id|key|(?:access|client)[ _-]?(?:key[ _-]?)?id|access[ _-]?key|key[ _-]?id)[:|+](?:pass(?:word)?|secret(?:[ _-]?(?:access[ _-]?)?key)?|token)\b/i
19
+ /** a secret's hint that names two values: « the access key id, then its secret », « the id and the secret » */
20
+ const TWO_NAMED = /\b(?:key|id|login|user(?:name)?|e-?mail)\b[^.]*?(?:\bthen\b|\bfollowed by\b|\band\b|\bplus\b|&)[^.]*?\b(?:secret|password|passphrase)\b/i
21
+
22
+ /** the joined words name an account and its password: one login field (```secret <name> login) whose words name the
23
+ * password alone, never two secrets */
24
+ export const namesALogin = (joined: string): boolean => /\b(?:user(?:name)?|login|e-?mail|account)\b/i.test(joined) && /\bpass(?:word|phrase)?\b/i.test(joined)
25
+
26
+ const codeSpans =(md: string): string[] => [...md.matchAll(/`([^`\n]+)`/g)].map((m) => m[1]!)
27
+
28
+ /** the placeholder of two values in `text`, null when it holds none */
29
+ function placeholderPair(text: string): string | null {
30
+ const t = text.trim()
31
+ return CAPS_PAIR.exec(t)?.[0] ?? CAPS_SPACED.exec(t)?.[0] ?? ANGLE_PAIR.exec(t)?.[0] ?? WORD_PAIR.exec(t)?.[0] ?? null
32
+ }
33
+
34
+ /** the words of a secret question that ask for two values as one, null when they ask for one: the hint of a field,
35
+ * the words of `sk thread ask --secret` */
36
+ export function joinedSecretAsk(words: string): string | null {
37
+ const bare = words.replace(/https?:\/\/\S+/g, ' ')
38
+ return JOIN_WORDS.exec(bare)?.[0].trim() ?? placeholderPair(bare.replace(/`/g, ' ')) ?? TWO_NAMED.exec(bare)?.[0].trim() ?? null
39
+ }
40
+
41
+ /** the words by which a step asks for two values joined into one field, null when it does not. `prose`: the step's
42
+ * markdown outside its fields */
43
+ export function joinedValueIn(prose: string, fields: readonly Field[]): string | null {
44
+ for (const f of fields) {
45
+ const hit = f.kind === 'secret' ? joinedSecretAsk(f.hint) : (JOIN_WORDS.exec(f.hint)?.[0].trim() ?? null)
46
+ if (hit !== null) return hit
47
+ }
48
+ if (!fields.some((f) => f.kind === 'secret')) return null
49
+ const bare = unitsOf(prose, true).join('\n').replace(/https?:\/\/\S+/g, ' ')
50
+ const said = JOIN_WORDS.exec(bare.replace(/`[^`\n]*`/g, ' '))?.[0].trim()
51
+ if (said !== undefined) return said
52
+ for (const code of codeSpans(bare)) {
53
+ const pair = placeholderPair(code)
54
+ if (pair !== null) return pair
55
+ }
56
+ return null
57
+ }
58
+
59
+ /** verbs that open an act whatever follows */
60
+ const STRONG = new Set(
61
+ 'open click tap press select choose pick paste enter create add enable disable delete remove install download upload visit publish generate confirm save replace fill scroll go tick untick uncheck submit rename reload refresh restart authorize approve accept drag hover expand follow'.split(' '),
62
+ )
63
+ /** verbs that are also nouns or adjectives (« name », « close », « set »): an act only before what an act names */
64
+ const WEAK = new Set('name set check copy type close keep leave link note find start stop change move hold search scan store log sign switch turn plug unplug give make put run wait write send edit allow grant connect verify repeat skip'.split(' '))
65
+ const AFTER_WEAK = /^(?:(?:the|a|an|your|its|it|this|that|these|those|each|every|all|both|any|on|in|into|up|down|off|out|back|again)\b|\*\*|‹)/i
66
+ const LABEL = /^\*\*(?:note|why|warning|tip|important|careful|optional)\b/i
67
+
68
+ /** a clause that opens an act: an imperative verb first, or a bold label (a button named with no verb) */
69
+ function isAct(clause: string): boolean {
70
+ const c = clause.replace(/^(?:(?:and|then|next|finally|there|now)\b[\s,]*)+/i, '').trim()
71
+ if (c.startsWith('**')) return !LABEL.test(c)
72
+ const m = /^([A-Za-z]+)\s+(\S.*)$/.exec(c)
73
+ if (!m) return false
74
+ const verb = m[1]!.toLowerCase()
75
+ return STRONG.has(verb) || (WEAK.has(verb) && AFTER_WEAK.test(m[2]!))
76
+ }
77
+
78
+ /** a unit's words with what may hold a comma or a period of its own set aside: a link's target, a url, code, an
79
+ * aside in parentheses, a quote, and the inside of a bold label */
80
+ function flat(unit: string): string {
81
+ let t = unit.replace(/\]\([^)\n]*\)/g, ']').replace(/https?:\/\/[^\s,;]*[^\s,;.:!?]/g, '‹url›').replace(/`[^`\n]*`/g, '‹code›')
82
+ for (let i = 0; i < 2; i++) t = t.replace(/\([^()]*\)/g, ' ')
83
+ t = t.replace(/«[^»]*»|“[^”]*”/g, '‹quote›')
84
+ return t.replace(/\*\*[^*\n]+\*\*/g, (b) => b.replace(/[,;:.!?]/g, ' '))
85
+ }
86
+
87
+ /** the acts one unit of prose holds, each by its opening words */
88
+ function actsOf(unit: string): string[] {
89
+ return flat(unit)
90
+ .split(/[,;:]\s|[.!?]\s+|\s+then\s+/)
91
+ .map((c) => c.trim())
92
+ .filter(isAct)
93
+ .map((c) => c.replace(/\*\*/g, '').replace(/‹\w+›/g, '…').split(/\s+/).slice(0, 4).join(' '))
94
+ }
95
+
96
+ const ITEM = /^\s*(?:[-*+]|\d+[.)])\s+/
97
+
98
+ /** a step's prose as units: a paragraph, or one item of a list with the lines that continue it. Code blocks, headings
99
+ * and quotes are no prose; a table's row is a unit only with `rows` (its cells are values, never acts) */
100
+ function unitsOf(prose: string, rows = false): string[] {
101
+ const units: string[] = []
102
+ let buf: string[] = []
103
+ let fence: string | null = null
104
+ const flush = (): void => {
105
+ if (buf.length > 0) units.push(buf.map((l) => l.trim()).join(' '))
106
+ buf = []
107
+ }
108
+ for (const line of prose.split('\n')) {
109
+ const f = /^\s*(`{3,}|~{3,})/.exec(line)
110
+ if (f && (fence === null || line.trim().startsWith(fence))) {
111
+ flush()
112
+ fence = fence === null ? f[1]! : null
113
+ continue
114
+ }
115
+ if (fence !== null) continue
116
+ if (line.trim() === '' || /^\s*(?:#{1,6}\s|>)/.test(line)) flush()
117
+ else if (/^\s*\|/.test(line)) {
118
+ flush()
119
+ if (rows) units.push(line)
120
+ } else if (ITEM.test(line)) {
121
+ flush()
122
+ buf.push(line.replace(ITEM, ''))
123
+ } else buf.push(line)
124
+ }
125
+ flush()
126
+ return units
127
+ }
128
+
129
+ /** the first run of acts in a step's prose: two acts or more in one paragraph or one bullet, each by its opening
130
+ * words; null when every act has its own bullet or its own paragraph */
131
+ export function actRunIn(prose: string): string[] | null {
132
+ for (const u of unitsOf(prose)) {
133
+ const acts = actsOf(u)
134
+ if (acts.length >= 2) return acts
135
+ }
136
+ return null
137
+ }
@@ -1,6 +1,7 @@
1
1
  // an ask's instructions read as steps (wiki tools/shipkit/threads-instructions.md): the why above the first `##`, a step
2
2
  // each `##` heading with its body up to the next one, a choice step's options; the one reading for `sk ask`, the store,
3
3
  // the migration and the hub. A `##` inside a fenced block is code, never a step. Pure and browser safe
4
+ import { actRunIn, joinedValueIn, namesALogin } from './instruction-guards.ts'
4
5
 
5
6
  /** a numbered option of a choice step: `1. **<name>**: <words>`, its name in bold first */
6
7
  const OPTION_RE = /^\s{0,3}\d+[.)]\s+(\*\*(.+?)\*\*.*)$/
@@ -217,8 +218,9 @@ export function pasteStores(md: string): PasteStore[] {
217
218
 
218
219
  const PAGE = 'wiki tools/shipkit/threads-instructions.md'
219
220
 
220
- /** why `sk ask` refuses these instructions, null when it takes them */
221
- export function instructionsRefusal(md: string): string | null {
221
+ /** why `sk ask` refuses these instructions, null when it takes them. `own`: the owner's own save of them, where only
222
+ * their shape is checked: how he writes a step is his */
223
+ export function instructionsRefusal(md: string, o: { own?: boolean } = {}): string | null {
222
224
  // a copy block may hold `${{ secrets.X }}` (a workflow): only the words outside one are a scaffold's leftovers
223
225
  if (linesOf(md).some((l) => !l.fenced && l.line.includes('{{'))) return `a {{placeholder}} is left in it: fill it first (${PAGE})`
224
226
  for (const s of parseInstructions(md).steps) {
@@ -237,5 +239,15 @@ export function instructionsRefusal(md: string): string | null {
237
239
  if (!fenced && /^\s*\*\*Answer\*\*\s*:/i.test(line)) return `an **Answer** line asks him to type in words: a value he gives is a field in its step (\`\`\`text, \`\`\`url, \`\`\`secret <name>), his « done » the ask bar (${PAGE}, How to write a step)`
238
240
  if (!fenced && /^\s*\*\*Done when\*\*/i.test(line)) return `a **Done when** line is the agent's check, never the owner's reading: give it as --check '<command>' (${PAGE}, How to write a step)`
239
241
  }
242
+ if (o.own === true) return null
243
+ for (const s of parseInstructions(md).steps) {
244
+ const prose = s.segments.flatMap((g) => (g.kind === 'md' ? [g.md] : [])).join('\n\n')
245
+ const joined = joinedValueIn(prose, s.fields)
246
+ if (joined !== null && namesALogin(joined))
247
+ return `the step « ${s.title} » asks him for two values as one (« ${joined} »): a user and its password is one login field, \`\`\`secret <name> login, and the hub draws the account beside the password, so its words name the password alone (« the password of the account ») (${PAGE}, A field inside a step)`
248
+ if (joined !== null) return `the step « ${s.title} » asks him for two values as one (« ${joined} »): one value he copies is one field, so give each value its own field, a secret each its own \`\`\`secret <name> block (${PAGE}, A field inside a step)`
249
+ const run = actRunIn(prose)
250
+ if (run !== null) return `the step « ${s.title} » runs ${run.length} acts together (${run.map((a) => `« ${a} »`).join(', ')}): each act of a step is a bullet, a \`- \` line each, never a run of clauses (${PAGE}, How to write a step)`
251
+ }
240
252
  return null
241
253
  }
@@ -7,8 +7,9 @@
7
7
  // (the ledger's, as the feed lands) goes through that connection (withItemsDb), never this module's own, which would
8
8
  // wait on it until its busy timeout
9
9
  import type { Database } from 'bun:sqlite'
10
- import { cpSync, lstatSync, mkdirSync, realpathSync, renameSync, rmSync } from 'node:fs'
11
- import { dirname, join, resolve } from 'node:path'
10
+ import { cpSync, existsSync, lstatSync, mkdirSync, realpathSync, renameSync, rmSync } from 'node:fs'
11
+ import { tmpdir } from 'node:os'
12
+ import { basename, dirname, join, resolve } from 'node:path'
12
13
  import { LAYOUT } from '../core/layout.ts'
13
14
 
14
15
  // the stored names keep `card` (wiki tools/shipkit/threads.md, The words): renaming a table or a column moves the live
@@ -177,6 +178,27 @@ export function gitCommonDir(root: string): string | null {
177
178
  }
178
179
  }
179
180
 
181
+ const tempRoots = (): string[] => {
182
+ const t = tmpdir()
183
+ return [...new Set([t, realOf(t), '/tmp', '/private/tmp', '/var/folders', '/private/var/folders'].map((s) => s.replace(/\/+$/, '')))]
184
+ }
185
+
186
+ /** a place the machine empties or a lane throws away: the OS temp dir, /tmp (a session's scratchpad), a repo's
187
+ * `.shipkit/tmp` */
188
+ export function throwawayPath(p: string, tmp: readonly string[] = tempRoots()): boolean {
189
+ return p.includes('/.shipkit/tmp/') || tmp.some((t) => p === t || p.startsWith(`${t}/`))
190
+ }
191
+
192
+ /** why the threads of `root` must not be filed in the db at `db`: a scratch folder that is no checkout of a real repo
193
+ * (no git root of its own, so git walked up to the repo around it, or no remote) opened the machine's real store,
194
+ * where its items show in the owner's hub. A checkout of a real repo in a scratch place keeps its repo's threads */
195
+ export function scratchStoreRefusal(o: { root: string; gitRoot: boolean; key: string; db: string }, tmp: readonly string[] = tempRoots()): string | null {
196
+ if (!throwawayPath(`${o.root}/`, tmp)) return null
197
+ if (o.db === '' || o.db === ':memory:' || throwawayPath(o.db, tmp)) return null
198
+ if (o.gitRoot && !o.key.startsWith('path:')) return null
199
+ return `the threads of ${o.root} refused: a scratch folder that is no checkout of a real repo opened the machine's real store (${o.db}), where its items would show in the owner's hub. Give the process a temp home first: SHIPKIT_HOME_DIR=$(mktemp -d)`
200
+ }
201
+
180
202
  /** the repo id of each store folder, made once a process */
181
203
  const ids = new Map<string, string>()
182
204
 
@@ -197,6 +219,8 @@ export function repoIdOf(dir: string): string {
197
219
  const { repoKeySync } = require('../hq/report.ts') as typeof import('../hq/report.ts')
198
220
  // a repo with no remote is named by its checkout's real path, a folder that is no repo by its own
199
221
  const named = first ?? repoKeySync(root) ?? `path:${common == null ? realOf(root) : dirname(common)}`
222
+ const refused = scratchStoreRefusal({ root: realOf(root), gitRoot: common != null, key: named, db: db.filename })
223
+ if (refused != null) throw new Error(refused)
200
224
  db.transaction(() => {
201
225
  db.query('insert or ignore into review_repos (dir, repo) values (?, ?)').run(key, named)
202
226
  if (byRepo != null) db.query('insert or ignore into review_repos (dir, repo) values (?, ?)').run(byRepo, named)
@@ -206,6 +230,32 @@ export function repoIdOf(dir: string): string {
206
230
  return id
207
231
  }
208
232
 
233
+ /** the one folder that names a store, whatever checkout reached it: with the items as rows, a store in a linked
234
+ * worktree is its main checkout's (one git common dir, one repo id, the same rows), so a session's record, a house
235
+ * watch and the hook count it once and the daemon's hub serves it; with the files, each checkout's folder is its own
236
+ * store. A checkout's is its real path; its own path when it is no repo's, its main checkout is no shipkit repo, or
237
+ * the database does not read */
238
+ export function canonicalStore(dir: string): string {
239
+ const key = resolve(dir)
240
+ const tail = `/${LAYOUT.review}`
241
+ if (!key.endsWith(tail)) return key
242
+ try {
243
+ const { threadsInDb } = require('../hq/switch.ts') as typeof import('../hq/switch.ts')
244
+ if (!threadsInDb()) return key
245
+ const root = key.slice(0, -tail.length)
246
+ const common = gitCommonDir(root)
247
+ if (common == null || basename(common) !== '.git') return key
248
+ const main = dirname(common)
249
+ const home = join(main, LAYOUT.review)
250
+ // the checkout itself by its real path, so a link to it and its worktrees name the same folder
251
+ if (main === realOf(root)) return home
252
+ if (!existsSync(join(main, 'repo.config.ts'))) return key
253
+ return repoIdOf(home) === repoIdOf(key) ? home : key
254
+ } catch {
255
+ return key
256
+ }
257
+ }
258
+
209
259
  /** where a store keeps the items it set aside: in the files, and in the media spool for their media */
210
260
  export const GONE = '.gone'
211
261
 
@@ -1,4 +1,4 @@
1
- // the owner's words that name a party with `@` (wiki tools/shipkit/threads-how-it-fits.md, Mentions): `@L68`, `@orchestrator`,
1
+ // the owner's words that name a party with `@` (wiki tools/shipkit/threads-how-it-fits.md, Mentions): `@L68`, `@default` (`@orchestrator`, its old name),
2
2
  // `@<advisor>`. The hub's reply box offers the parties a word can name, refuses a name none of them has as he types, and
3
3
  // the route resolves the names again before it writes. Pure and browser safe: the reply box imports it
4
4
  // the one constraint a reader breaks first: a name resolves to a party when he sends, never later. The message keeps
@@ -53,7 +53,7 @@ export function mentionCandidates(i: { members: readonly ReviewItem[]; parties:
53
53
  return `${held}${l.live ? (l.watch ? 'live, its watch hears' : 'live, no watch: its session hears') : 'ended: its session hears'}${l.what ? ` · ${l.what}` : ''}`
54
54
  }
55
55
  const addLane = (name: string, session: string | undefined): void => {
56
- if (has(name) || name === 'orchestrator') return
56
+ if (has(name) || name === 'default' || name === 'orchestrator') return
57
57
  out.push({ name, kind: 'lane', to: { name, lane: name, ...(session !== undefined ? { session } : {}) }, what: laneWords(name, session) })
58
58
  }
59
59
  // the thread's own parties, newest act first
@@ -65,7 +65,7 @@ export function mentionCandidates(i: { members: readonly ReviewItem[]; parties:
65
65
  const here = new Set(i.parties.sessions.filter((s) => s.repo === i.repo).map((s) => s.id))
66
66
  for (const l of [...i.parties.lanes].filter((l) => l.live && here.has(l.session)).sort((a, b) => Number(b.watch) - Number(a.watch) || a.name.localeCompare(b.name))) addLane(l.name, l.session)
67
67
  const o = orchestratorFor(i.parties, i.repo)
68
- if (o !== null) out.push({ name: 'orchestrator', kind: 'orchestrator', to: { name: 'orchestrator', session: o.id }, what: o.repo === i.repo ? `${i.repo} orchestrator` : `the house orchestrator (${o.repo}): ${i.repo} has none` })
68
+ if (o !== null) out.push({ name: 'default', kind: 'orchestrator', to: { name: 'default', session: o.id }, what: `${i.repo}'s default session: it hears what nobody holds` })
69
69
  for (const a of i.advisors ?? []) {
70
70
  const name = advisorToken(a.name)
71
71
  if (has(name)) continue
@@ -79,7 +79,9 @@ export function resolveMentions(text: string, candidates: readonly MentionCandid
79
79
  const to: Mention[] = []
80
80
  const bad: string[] = []
81
81
  for (const name of mentionedNames(text)) {
82
- const c = candidates.find((x) => x.name.toLowerCase() === name.toLowerCase())
82
+ // `@orchestrator`, the old name of `@default`, still names it
83
+ const want = name.toLowerCase() === 'orchestrator' ? 'default' : name.toLowerCase()
84
+ const c = candidates.find((x) => x.name.toLowerCase() === want)
83
85
  if (c === undefined) bad.push(`@${name}: nobody by that name here`)
84
86
  else if (c.refused !== undefined) bad.push(c.refused)
85
87
  else to.push(c.to)
@@ -140,6 +140,7 @@ export interface Spec {
140
140
  export { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
141
141
  import { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
142
142
  import { settlingOf } from './settle.ts'
143
+ import { IN_BACKGROUND, WATCH } from './inbox-hook.ts'
143
144
 
144
145
  export const NO_SPEC: Spec = { kinds: {}, topics: {}, dispatcher: false }
145
146
 
@@ -1486,8 +1487,8 @@ export function unheardLine(item: Item, watchers: readonly Watcher[]): string |
1486
1487
  if (o.by !== 'agent') return null
1487
1488
  const own = o.session || o.lane ? watchers.filter((w) => (o.session && w.session === o.session) || (o.lane && w.lane === o.lane)) : watchers
1488
1489
  if (own.some((w) => coversItem(w, { item, thread: [] }))) return null
1489
- const watch = o.session ? 'sk thread watch --mine' : o.lane ? `sk thread watch --lane ${o.lane}` : 'sk thread watch'
1490
- return `no watch hears this thread: run \`${watch}\` under a monitor now, so his answer reaches you as it lands`
1490
+ const watch = o.session ? WATCH('sk') : o.lane ? `sk thread watch --lane ${o.lane} --once` : 'sk thread watch --once'
1491
+ return `no watch hears this thread: run \`${watch}\` now ${IN_BACKGROUND}, so his answer reaches you as it lands`
1491
1492
  }
1492
1493
 
1493
1494
  /** an item's own session has this long after its last message to claim it before a watch calls it untaken */
@@ -32,9 +32,13 @@ export interface SessionParty {
32
32
  gone?: true
33
33
  /** epoch ms of its transcript's last line: the newest of two live sessions is the one at work */
34
34
  active?: number
35
- /** the project's orchestrator: the session pm keeps for its repo (orchestrator/keeper.ts); `house`: it also hears
36
- * every repo with no live orchestrator of its own */
37
- orchestrator?: 'own' | 'house'
35
+ /** the project's orchestrator: the session that runs a live watch of every thread of its repo
36
+ * (agent-time/registry.ts readParties) */
37
+ orchestrator?: 'own'
38
+ /** an orchestrator's claim (ISO): of two that hear one repo, the first claimed answers (orchestratorFor) */
39
+ since?: string
40
+ /** the node of another place whose daemon said it lives (orchestrator/places-shape.ts); absent: this place */
41
+ place?: string
38
42
  }
39
43
 
40
44
  /** a lane: a sub agent its session started, by the name its acts carry (SK_AGENT) */
@@ -53,10 +57,30 @@ export interface LaneParty {
53
57
  export interface Parties {
54
58
  sessions: readonly SessionParty[]
55
59
  lanes: readonly LaneParty[]
60
+ /** each repo's lead place by its node, as the hq settled it (orchestrator/lead-shape.ts), null while no place
61
+ * leads; absent with the hq not reached: each place then leads by its own facts */
62
+ leads?: Readonly<Record<string, string | null>>
63
+ /** this place's node, and each place's name by its node: the words name a place once a project has two */
64
+ here?: string
65
+ placeNames?: Readonly<Record<string, string>>
56
66
  }
57
67
 
58
68
  export const NO_PARTIES: Parties = { sessions: [], lanes: [] }
59
69
 
70
+ /** this place's parties with each party the project's other places say live (orchestrator/places-shape.ts
71
+ * partiesOfRows): a fact of here wins, and a session here knows nothing of (not live, never recorded) is the other
72
+ * place's */
73
+ export function withOtherPlaces(here: Parties, there: Parties): Parties {
74
+ const lead = { ...(there.leads !== undefined ? { leads: there.leads } : {}), ...(there.here !== undefined ? { here: there.here } : {}), ...(there.placeNames !== undefined ? { placeNames: there.placeNames } : {}) }
75
+ if (there.sessions.length === 0 && there.lanes.length === 0) return { ...here, ...lead }
76
+ const theirs = new Map(there.sessions.map((s) => [s.id, s]))
77
+ const sessions = here.sessions.map((s) => (!s.live && s.gone === undefined ? (theirs.get(s.id) ?? s) : s))
78
+ const known = new Set(sessions.map((s) => s.id))
79
+ const lanes = new Set(here.lanes.filter((l) => l.live).map((l) => `${l.session}\0${l.name}`))
80
+ const extra = there.lanes.filter((l) => !lanes.has(`${l.session}\0${l.name}`))
81
+ return { sessions: [...sessions, ...there.sessions.filter((s) => !known.has(s.id))], lanes: [...here.lanes.filter((l) => l.live || !extra.some((x) => x.name === l.name && x.session === l.session)), ...extra], ...lead }
82
+ }
83
+
60
84
  /** who asks: the lane it acts as (SK_AGENT, --as), and its session */
61
85
  export interface Me {
62
86
  lane: string | null
@@ -104,12 +128,23 @@ export const sameParty = (a: Party | null, b: Party | null): boolean =>
104
128
 
105
129
  /** a session in words: `<repo> main`, with its short id when two live sessions share the repo */
106
130
  export function sessionLabel(id: string | null | undefined, p: Parties): string {
131
+ const s = id ? p.sessions.find((x) => x.id === id) : undefined
132
+ if (s?.orchestrator !== undefined) {
133
+ const place = placeNameOf(s, p)
134
+ return `${sessionName(id, p)}${place ? ` on ${place}` : ''}`
135
+ }
136
+ if (!id || !s) return sessionName(id, p)
137
+ const twin = p.sessions.some((x) => x.id !== id && x.repo === s.repo && x.live && x.orchestrator === undefined)
138
+ return `${s.repo} main${twin ? ` ${id.slice(0, 4)}` : ''}`
139
+ }
140
+
141
+ /** a session's short name for a list row: « <repo> main », never the hash that tells two live twins apart (its
142
+ * tooltip carries sessionLabel) */
143
+ export function sessionName(id: string | null | undefined, p: Parties): string {
107
144
  if (!id) return 'a session'
108
145
  const s = p.sessions.find((x) => x.id === id)
109
146
  if (!s) return `session ${id.slice(0, 8)}`
110
- if (s.orchestrator !== undefined) return `${s.repo} orchestrator`
111
- const twin = p.sessions.some((x) => x.id !== id && x.repo === s.repo && x.live && x.orchestrator === undefined)
112
- return `${s.repo} main${twin ? ` ${id.slice(0, 4)}` : ''}`
147
+ return s.orchestrator !== undefined ? `${s.repo} default` : `${s.repo} main`
113
148
  }
114
149
 
115
150
  /** who wrote a message, in words: « you » for him, a lane by its name, a session's own act (`agent`, no lane) by its
@@ -132,23 +167,49 @@ export interface Hearing {
132
167
 
133
168
  const nobodyWords = (repo: string): string => `nobody hears now: the next session in ${repo} sees it first`
134
169
 
135
- /** the live orchestrator that hears `repo`: its own, else the house's, which hears every repo with none */
170
+ const orchestratorsOf = (p: Parties, repo: string): SessionParty[] => p.sessions.filter((s) => s.live && s.orchestrator !== undefined && s.repo === repo)
171
+
172
+ /** the lead place the hq settled for `repo` (orchestrator/lead-shape.ts): its node, null while no place leads,
173
+ * undefined with the hq not reached */
174
+ export const leadPlaceOf = (p: Parties, repo: string): string | null | undefined => p.leads?.[repo]
175
+
176
+ /** the live orchestrator that hears `repo`: its own, no project answers for another. On several places, the one of the
177
+ * lead place the hq settled (the owner's order, then the first claim, sticky), and none while the lead's place does not hear:
178
+ * his word waits for it. With no lead said, the first that claimed, then by id, so every place names the same one */
136
179
  export function orchestratorFor(p: Parties, repo: string): SessionParty | null {
137
- const live = p.sessions.filter((s) => s.live && s.orchestrator !== undefined)
138
- return live.find((s) => s.repo === repo) ?? live.find((s) => s.orchestrator === 'house') ?? null
180
+ const all = orchestratorsOf(p, repo)
181
+ const lead = leadPlaceOf(p, repo)
182
+ if (lead != null) return all.find((s) => (s.place ?? p.here) === lead) ?? null
183
+ return all.length < 2 ? (all[0] ?? null) : (all.sort((a, b) => (a.since ?? '').localeCompare(b.since ?? '') || a.id.localeCompare(b.id))[0] ?? null)
184
+ }
185
+
186
+ /** the name of the place a session runs on, once the parties know two places; '' otherwise */
187
+ export function placeNameOf(s: Pick<SessionParty, 'place'>, p: Parties): string {
188
+ const names = p.placeNames
189
+ if (names === undefined || Object.keys(names).length < 2) return ''
190
+ return names[s.place ?? p.here ?? ''] ?? ''
191
+ }
192
+
193
+ /** a session every place reads the same way: one another place's presence names (its `place`), or one this place's
194
+ * own presence names: live, and an orchestrator, a watch of its own or a live lane watch of it. Any other (ended,
195
+ * live with no watch, unknown) is read by each place as one of its own, so it never routes a word */
196
+ const placedAlike = (s: SessionParty, p: Parties): boolean => s.place !== undefined || (s.live && (s.orchestrator !== undefined || s.watch || p.lanes.some((l) => l.session === s.id && l.live && l.watch)))
197
+
198
+ /** the orchestrator that hears what the holder `h` does not: the one of the holder's own place while one hears there
199
+ * and every place reads that holder alike, else the lead (orchestratorFor) */
200
+ export function answererOf(h: { session?: string | null } | null, p: Parties, repo: string): SessionParty | null {
201
+ const at = h?.session == null ? undefined : p.sessions.find((s) => s.id === h.session)
202
+ return (at === undefined || !placedAlike(at, p) ? undefined : orchestratorsOf(p, repo).find((s) => s.place === at.place)) ?? orchestratorFor(p, repo)
139
203
  }
140
204
 
141
205
  /** the last rung of rule 3: what no holder hears, the repo's orchestrator does */
142
- function orNobody(chip: string, p: Parties, repo: string): Hearing {
143
- const o = repo === '' ? null : orchestratorFor(p, repo)
206
+ function orNobody(chip: string, p: Parties, repo: string, h: { session?: string | null } | null = null): Hearing {
207
+ const o = repo === '' ? null : answererOf(h, p, repo)
144
208
  if (o === null) return { light: 'nobody', by: null, chip, words: nobodyWords(repo) }
145
209
  const label = sessionLabel(o.id, p)
146
210
  return { light: 'parent', by: { kind: 'session', session: o.id }, chip, words: `${label} hears you` }
147
211
  }
148
212
 
149
- /** his list's word on a thread of his turn that no live party hears: he knows to ping a session when he answers */
150
- export const NOBODY_HEARS = 'nobody hears this'
151
-
152
213
  /** rule 3, hears: the holder when it lives and listens (a lane by its watch, a session by its watch or its prompt hook),
153
214
  * else its parent session while that lives (rule 2, a lane's threads pass to its session), else nobody: the repo's
154
215
  * next session sees it first */
@@ -158,13 +219,13 @@ export function hearingOf(h: Holder | null, p: Parties, repo: string): Hearing {
158
219
  const session = holder.session === null ? undefined : p.sessions.find((s) => s.id === holder.session)
159
220
  const label = sessionLabel(holder.session, p)
160
221
  if (holder.kind === 'session') {
161
- return session?.live ? { light: 'hears', by: holder, chip: label, words: `${label} hears you` } : orNobody(label, p, repo)
222
+ return session?.live ? { light: 'hears', by: holder, chip: label, words: `${label} hears you` } : orNobody(label, p, repo, holder)
162
223
  }
163
224
  const lane = laneIn(p, holder.lane, holder.session)
164
225
  const chip = `${holder.lane} · from ${label}`
165
226
  if (lane?.live && lane.watch) return { light: 'hears', by: holder, chip, words: `${holder.lane} hears you` }
166
227
  if (session?.live) return { light: 'parent', by: { kind: 'session', session: session.id }, chip, words: `${holder.lane} ${lane?.live ? 'has no watch' : 'ended'}, ${label} hears you` }
167
- return orNobody(chip, p, repo)
228
+ return orNobody(chip, p, repo, holder)
168
229
  }
169
230
 
170
231
  /** a lane that holds a thread and ended while its session lives: the session hears for it, and may resume it */
@@ -224,16 +285,24 @@ export const resumeLine = (r: Resumable, address: string, bin = 'sk'): string =>
224
285
  /** the party `me` hears what `hearing` says: the one that hears it now */
225
286
  export const heardBy = (me: Me, hearing: Hearing, p: Parties): boolean => sameParty(partyOf(me, p), hearing.by)
226
287
 
288
+ /** the holder is gone: the registry knows its session ended (and, for a lane, the lane with it). A party the registry
289
+ * does not know is never read as gone */
290
+ export function holderGone(holder: Party, p: Parties): boolean {
291
+ const ended = p.sessions.some((s) => s.id === holder.session && !s.live)
292
+ if (holder.kind === 'session') return ended
293
+ return ended && p.lanes.some((l) => l.name === holder.lane && sameSession(l.session, holder.session) && !l.live)
294
+ }
295
+
227
296
  /** rule 4, may mark seen: the holder, or an ancestor of it (the session of a lane that holds it); a thread nobody
228
- * holds, anyone. Writing is never refused: a word in a thread makes its writer the holder */
297
+ * holds, or whose holder is gone, anyone: else a word on it no agent may read is replayed to every session forever.
298
+ * Writing is never refused: a word in a thread makes its writer the holder */
229
299
  export function maySee(me: Me, h: Holder | null, p: Parties): boolean {
230
300
  const holder = h === null ? null : partyOf(h, p)
231
301
  if (holder === null) return true
232
302
  const m = partyOf(me, p)
233
303
  if (m === null) return false
234
304
  if (sameParty(m, holder)) return true
235
- // an orchestrator reads every word it was given, on a thread it does not hold too
236
- if (m.kind === 'session' && p.sessions.some((s) => s.id === m.session && s.live && s.orchestrator !== undefined)) return true
305
+ if (holderGone(holder, p)) return true
237
306
  return holder.kind === 'lane' && m.kind === 'session' && m.session === holder.session
238
307
  }
239
308