rvlib-shipkit 2.27.0 → 2.28.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 (338) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/hooks.ts +10 -3
  4. package/src/agent-time/live.ts +11 -5
  5. package/src/agent-time/registry.ts +289 -0
  6. package/src/agent-time/store.ts +2 -2
  7. package/src/annex/born.ts +2 -2
  8. package/src/annex/offload.ts +12 -11
  9. package/src/asks/ask-after.ts +6 -2
  10. package/src/asks/ask-bar-fold.ts +57 -0
  11. package/src/asks/ask-migrate.ts +280 -0
  12. package/src/asks/ask-steps-fold.ts +166 -0
  13. package/src/asks/ask-store.ts +586 -0
  14. package/src/assets/kits/identity-kit.ts +106 -38
  15. package/src/assets/kits/poster-thumbnail.ts +282 -0
  16. package/src/checks/SK003-claude-md-shape.check.ts +92 -25
  17. package/src/checks/SK004-gitignore-policy.check.ts +8 -4
  18. package/src/checks/SK013-one-way-in-policy.check.ts +10 -0
  19. package/src/checks/SK026-asks-autoclose.check.ts +9 -23
  20. package/src/checks/SK038-speaks-as.check.ts +3 -3
  21. package/src/checks/SK042-post-kinds.check.ts +26 -24
  22. package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
  23. package/src/checks/SK050-retired-commands.check.ts +127 -0
  24. package/src/cli/cmd_Asks.ts +204 -53
  25. package/src/cli/cmd_Backup.ts +151 -8
  26. package/src/cli/cmd_Calls.ts +1 -0
  27. package/src/cli/cmd_Commands.ts +140 -34
  28. package/src/cli/cmd_Contracts.ts +1 -0
  29. package/src/cli/cmd_Keys.ts +1 -0
  30. package/src/cli/cmd_Lanes.ts +15 -4
  31. package/src/cli/cmd_Messages.ts +152 -1
  32. package/src/cli/cmd_Needs.ts +1 -0
  33. package/src/cli/cmd_Review.ts +931 -229
  34. package/src/cli/cmd_Secret.ts +255 -34
  35. package/src/cli/cmd_Social.ts +36 -33
  36. package/src/cli/cmd_SocialDrafts.ts +235 -0
  37. package/src/cli/cmd_Sound.ts +22 -1
  38. package/src/cli/cmd_Start.ts +3 -2
  39. package/src/cli/cmd_ThreadHolds.ts +34 -0
  40. package/src/cli/cmd_ThreadKinds.ts +146 -0
  41. package/src/cli/cmd_ThreadReflect.ts +83 -0
  42. package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
  43. package/src/cli/cmd_Vault.ts +1 -1
  44. package/src/cli/cmd_When.ts +1 -0
  45. package/src/cli/family-help.ts +2 -2
  46. package/src/cli/family-pages.ts +1 -1
  47. package/src/cli/kit/builtins.ts +1 -0
  48. package/src/cli/kit/verb.ts +6 -2
  49. package/src/cli/registry.ts +21 -2
  50. package/src/cli.ts +5 -2
  51. package/src/collections/actions.ts +25 -74
  52. package/src/collections/collection-types.ts +9 -5
  53. package/src/collections/md-body.ts +5 -3
  54. package/src/collections/pings.ts +13 -6
  55. package/src/collections/providers.ts +53 -61
  56. package/src/collections/reflections.ts +9 -4
  57. package/src/core/discover-checks.ts +18 -3
  58. package/src/core/git.ts +31 -0
  59. package/src/core/house-layout.ts +17 -0
  60. package/src/core/layout.ts +10 -5
  61. package/src/core/locked-write.ts +4 -1
  62. package/src/core/machine-db.ts +5 -3
  63. package/src/core/migrate-layout.ts +8 -10
  64. package/src/home/activity.ts +8 -15
  65. package/src/home/daemon-jobs.ts +13 -1
  66. package/src/home/home-paths.ts +6 -3
  67. package/src/home/home-routes.ts +8 -0
  68. package/src/home/inbox-shape.ts +233 -100
  69. package/src/home/inbox.ts +26 -71
  70. package/src/home/machine-fold.ts +10 -15
  71. package/src/home/machine-host.ts +19 -1
  72. package/src/home/other-macs.ts +2 -2
  73. package/src/home/serve-web.ts +6 -5
  74. package/src/home/space-page.ts +1 -1
  75. package/src/home/vault-page.ts +51 -17
  76. package/src/home/vault-words.ts +2 -2
  77. package/src/hooks/one-way-in-guard.ts +24 -2
  78. package/src/hq/files-send.ts +27 -28
  79. package/src/hq/hq-db.ts +4 -1
  80. package/src/hq/hq-local.ts +37 -4
  81. package/src/hq/hq-routes.ts +10 -2
  82. package/src/hq/hq-store.ts +6 -2
  83. package/src/hq/kinds/ask.ts +6 -6
  84. package/src/hq/outbox.ts +5 -3
  85. package/src/hq/replica.ts +1 -2
  86. package/src/hq/vault-route.ts +112 -0
  87. package/src/identities/collection.ts +2 -2
  88. package/src/identities/identities.ts +9 -8
  89. package/src/identities/machine-route.ts +8 -3
  90. package/src/ledger/db.ts +8 -1
  91. package/src/media-store/backup/daemon.ts +48 -8
  92. package/src/media-store/backup/keys.ts +1 -1
  93. package/src/media-store/backup/manifest.ts +20 -2
  94. package/src/media-store/backup/prune.ts +365 -0
  95. package/src/media-store/backup/retention.ts +122 -0
  96. package/src/media-store/backup/run.ts +14 -8
  97. package/src/media-store/backup/sources.ts +18 -17
  98. package/src/media-store/backup/thread-copy.ts +340 -0
  99. package/src/media-store/copy/config.ts +3 -4
  100. package/src/media-store/copy/store.ts +2 -2
  101. package/src/media-store/db.ts +2 -2
  102. package/src/media-store/forget.ts +118 -0
  103. package/src/media-store/purge.ts +3 -2
  104. package/src/media-store/space-listing.ts +20 -4
  105. package/src/media-store/space.ts +6 -5
  106. package/src/messages/guard.ts +49 -0
  107. package/src/messages/model.ts +1 -1
  108. package/src/messages/objects.ts +201 -0
  109. package/src/messages/routes.ts +2 -2
  110. package/src/messages/score.ts +1 -1
  111. package/src/messages/write.ts +285 -0
  112. package/src/pages/frame-client.ts +181 -4
  113. package/src/reflections/reflections-queue.ts +1 -1
  114. package/src/release/gate-checkout.ts +2 -1
  115. package/src/release/git-facts.ts +3 -2
  116. package/src/release/public-clean.ts +3 -2
  117. package/src/repo-config.ts +40 -18
  118. package/src/review/anim.ts +1 -1
  119. package/src/review/answer-kinds.ts +131 -0
  120. package/src/review/band.ts +53 -0
  121. package/src/review/branch-hold.ts +84 -0
  122. package/src/review/card-db.ts +16 -6
  123. package/src/review/card-rows.ts +4 -3
  124. package/src/review/cells.ts +297 -65
  125. package/src/review/close.ts +92 -0
  126. package/src/review/draft-card.ts +8 -16
  127. package/src/review/draft-model.ts +2 -2
  128. package/src/review/events.ts +171 -0
  129. package/src/review/format.ts +128 -14
  130. package/src/review/glyphs.ts +63 -0
  131. package/src/review/gone.ts +1 -1
  132. package/src/review/holds-sync.ts +62 -0
  133. package/src/review/holds.ts +85 -0
  134. package/src/review/house-kind-defs.ts +41 -0
  135. package/src/review/inbox-hook.ts +22 -9
  136. package/src/review/inbox-read.ts +201 -0
  137. package/src/review/instructions.ts +199 -0
  138. package/src/review/kind-apply.ts +61 -0
  139. package/src/review/kind-catalog.ts +96 -0
  140. package/src/review/kinds.ts +278 -0
  141. package/src/review/lane-ask.ts +109 -0
  142. package/src/review/model.ts +396 -86
  143. package/src/review/move.ts +3 -3
  144. package/src/review/need-address.ts +15 -0
  145. package/src/review/need-threads.ts +93 -0
  146. package/src/review/object-card.ts +48 -0
  147. package/src/review/object-read.ts +31 -0
  148. package/src/review/owner-verdict.ts +36 -0
  149. package/src/review/parties.ts +182 -0
  150. package/src/review/previews.ts +3 -1
  151. package/src/review/projections.ts +235 -0
  152. package/src/review/referring.ts +54 -0
  153. package/src/review/reflection-object.ts +195 -0
  154. package/src/review/routes.ts +137 -32
  155. package/src/review/secret-route.ts +80 -0
  156. package/src/review/snooze.ts +38 -0
  157. package/src/review/stage-card.ts +4 -4
  158. package/src/review/store.ts +366 -85
  159. package/src/review/supersede.ts +116 -0
  160. package/src/review/take-back.ts +52 -0
  161. package/src/review/thread-fold.ts +20 -7
  162. package/src/review/threads.ts +236 -39
  163. package/src/review/traces.ts +218 -0
  164. package/src/review/trailer-card.ts +2 -2
  165. package/src/review/unit.ts +71 -5
  166. package/src/review/verdict-items.ts +73 -0
  167. package/src/review/verdict-write.ts +15 -0
  168. package/src/review/wait.ts +85 -0
  169. package/src/review/watchers.ts +22 -9
  170. package/src/scaffold/files/claude-settings-local.json +2 -0
  171. package/src/secrets/archive-mark.ts +52 -0
  172. package/src/secrets/archive.ts +83 -0
  173. package/src/secrets/copy.ts +14 -14
  174. package/src/secrets/keychain-write.ts +48 -0
  175. package/src/secrets/keychain.ts +8 -5
  176. package/src/secrets/lapse-mark.ts +33 -0
  177. package/src/secrets/lapse.ts +60 -0
  178. package/src/secrets/list.ts +16 -22
  179. package/src/secrets/manager.ts +31 -16
  180. package/src/secrets/read.ts +161 -33
  181. package/src/secrets/tail.ts +31 -0
  182. package/src/serve/hub-app/asks-page.tsx +2 -1
  183. package/src/serve/hub-app/auto-text.tsx +14 -6
  184. package/src/serve/hub-app/benign-errors.ts +15 -1
  185. package/src/serve/hub-app/card-head.tsx +49 -0
  186. package/src/serve/hub-app/check-view.tsx +3 -2
  187. package/src/serve/hub-app/code-copy.ts +35 -0
  188. package/src/serve/hub-app/col-card.tsx +31 -40
  189. package/src/serve/hub-app/col-list-page.tsx +5 -2
  190. package/src/serve/hub-app/col-tables-view.tsx +7 -4
  191. package/src/serve/hub-app/col-tables.ts +5 -5
  192. package/src/serve/hub-app/cols-svc.ts +4 -79
  193. package/src/serve/hub-app/commands/commands-page.tsx +2 -1
  194. package/src/serve/hub-app/controls.css +83 -0
  195. package/src/serve/hub-app/frames-st.ts +17 -1
  196. package/src/serve/hub-app/git-view.tsx +3 -2
  197. package/src/serve/hub-app/home-st.ts +57 -6
  198. package/src/serve/hub-app/home-strip.css +1 -6
  199. package/src/serve/hub-app/home-strip.tsx +2 -1
  200. package/src/serve/hub-app/home.html +3 -0
  201. package/src/serve/hub-app/house-wiki-view.tsx +20 -0
  202. package/src/serve/hub-app/hub-app.tsx +48 -32
  203. package/src/serve/hub-app/hub-types.ts +2 -0
  204. package/src/serve/hub-app/hub.css +50 -61
  205. package/src/serve/hub-app/icons.tsx +14 -4
  206. package/src/serve/hub-app/identities-view.tsx +4 -3
  207. package/src/serve/hub-app/inbox-st.ts +203 -42
  208. package/src/serve/hub-app/inbox-view.tsx +189 -101
  209. package/src/serve/hub-app/inbox.css +47 -44
  210. package/src/serve/hub-app/index.html +3 -0
  211. package/src/serve/hub-app/instructions.css +30 -0
  212. package/src/serve/hub-app/keys.ts +5 -3
  213. package/src/serve/hub-app/machine-st.ts +2 -2
  214. package/src/serve/hub-app/machines-view.tsx +4 -11
  215. package/src/serve/hub-app/machines.css +0 -9
  216. package/src/serve/hub-app/markdown.css +51 -0
  217. package/src/serve/hub-app/md-copy.tsx +18 -40
  218. package/src/serve/hub-app/md.ts +25 -9
  219. package/src/serve/hub-app/media-view.tsx +2 -2
  220. package/src/serve/hub-app/messages/messages-page.tsx +2 -1
  221. package/src/serve/hub-app/messages/messages-st.ts +1 -1
  222. package/src/serve/hub-app/messages.css +0 -1
  223. package/src/serve/hub-app/objects.css +51 -0
  224. package/src/serve/hub-app/page-keys.ts +1 -1
  225. package/src/serve/hub-app/pages-frames.tsx +11 -1
  226. package/src/serve/hub-app/palette-st.ts +4 -4
  227. package/src/serve/hub-app/pane-boundary.tsx +72 -0
  228. package/src/serve/hub-app/pane-errors.ts +54 -0
  229. package/src/serve/hub-app/plan-view.tsx +3 -2
  230. package/src/serve/hub-app/planned-view.tsx +3 -3
  231. package/src/serve/hub-app/planned.css +0 -4
  232. package/src/serve/hub-app/processes-view.tsx +3 -2
  233. package/src/serve/hub-app/project-list.css +5 -13
  234. package/src/serve/hub-app/project-list.tsx +3 -6
  235. package/src/serve/hub-app/projects-svc.ts +6 -2
  236. package/src/serve/hub-app/readme.css +9 -15
  237. package/src/serve/hub-app/reflections-page.tsx +54 -1
  238. package/src/serve/hub-app/releases/releases-page.tsx +3 -2
  239. package/src/serve/hub-app/releases.css +0 -1
  240. package/src/serve/hub-app/review/code-colors.ts +30 -0
  241. package/src/serve/hub-app/review/diff-view.tsx +75 -0
  242. package/src/serve/hub-app/review/dock.tsx +104 -0
  243. package/src/serve/hub-app/review/draft-card.tsx +2 -2
  244. package/src/serve/hub-app/review/group-block.tsx +209 -0
  245. package/src/serve/hub-app/review/instructions-view.tsx +116 -0
  246. package/src/serve/hub-app/review/item-verdict.tsx +38 -0
  247. package/src/serve/hub-app/review/kind-states.tsx +193 -0
  248. package/src/serve/hub-app/review/kind-view.tsx +1 -37
  249. package/src/serve/hub-app/review/kit.tsx +57 -54
  250. package/src/serve/hub-app/review/lane-bar.tsx +64 -0
  251. package/src/serve/hub-app/review/object-card.tsx +62 -0
  252. package/src/serve/hub-app/review/object-panel.tsx +179 -0
  253. package/src/serve/hub-app/review/question-views.tsx +385 -0
  254. package/src/serve/hub-app/review/review-cells.tsx +86 -105
  255. package/src/serve/hub-app/review/review-list.tsx +104 -47
  256. package/src/serve/hub-app/review/review-page.tsx +5 -4
  257. package/src/serve/hub-app/review/review-st.ts +68 -28
  258. package/src/serve/hub-app/review/review-thread.tsx +171 -40
  259. package/src/serve/hub-app/review/review-views.tsx +35 -31
  260. package/src/serve/hub-app/review/thread-close.tsx +124 -0
  261. package/src/serve/hub-app/review/thread-control.tsx +4 -4
  262. package/src/serve/hub-app/review/thread-st.ts +222 -22
  263. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  264. package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
  265. package/src/serve/hub-app/review.css +216 -57
  266. package/src/serve/hub-app/section-head.tsx +51 -0
  267. package/src/serve/hub-app/social/calendar.tsx +5 -11
  268. package/src/serve/hub-app/social/comms-page.tsx +23 -10
  269. package/src/serve/hub-app/social/kit.tsx +8 -15
  270. package/src/serve/hub-app/social/next-release.tsx +3 -5
  271. package/src/serve/hub-app/social/post-card.tsx +3 -0
  272. package/src/serve/hub-app/social/post-page.tsx +80 -0
  273. package/src/serve/hub-app/social/problems.tsx +5 -9
  274. package/src/serve/hub-app/social/social-model.ts +13 -5
  275. package/src/serve/hub-app/social/social-page.tsx +1 -1
  276. package/src/serve/hub-app/social/social-st.ts +42 -5
  277. package/src/serve/hub-app/social.css +7 -17
  278. package/src/serve/hub-app/space.css +1 -1
  279. package/src/serve/hub-app/stores/stores-page.tsx +6 -2
  280. package/src/serve/hub-app/thread-row.tsx +101 -0
  281. package/src/serve/hub-app/time-ago.tsx +3 -2
  282. package/src/serve/hub-app/time-view.tsx +2 -1
  283. package/src/serve/hub-app/time.css +2 -5
  284. package/src/serve/hub-app/tree-row.tsx +1 -9
  285. package/src/serve/hub-app/vault-view.tsx +4 -4
  286. package/src/serve/hub-app/veille/veille-page.tsx +2 -11
  287. package/src/serve/hub-app/veille.css +0 -1
  288. package/src/serve/hub-app/waiting-svc.ts +4 -4
  289. package/src/serve/hub-app/when-view.tsx +6 -3
  290. package/src/serve/hub-app/wiki-st.ts +30 -4
  291. package/src/serve/hub-app/wikis-view.tsx +4 -3
  292. package/src/serve/hub-runtime.ts +20 -6
  293. package/src/serve/project-gutter-route.ts +16 -6
  294. package/src/serve/project-gutter.ts +6 -53
  295. package/src/serve/same-origin.ts +3 -0
  296. package/src/serve/secret-gate.ts +21 -0
  297. package/src/serve/serve-hub.ts +29 -20
  298. package/src/serve/tailnet-caller.ts +117 -0
  299. package/src/shipkit.ts +2 -2
  300. package/src/site/desk.ts +2 -2
  301. package/src/smoke/run-smoke.ts +3 -4
  302. package/src/social/brands.ts +4 -0
  303. package/src/social/card-drafts.ts +11 -19
  304. package/src/social/desk-index.ts +34 -13
  305. package/src/social/drafts.ts +4 -4
  306. package/src/social/import-drafts.ts +244 -0
  307. package/src/social/kind-pages.ts +3 -3
  308. package/src/social/kinds.ts +1 -1
  309. package/src/social/load.ts +89 -64
  310. package/src/social/media-kind.ts +68 -161
  311. package/src/social/media-of.ts +5 -4
  312. package/src/social/open.ts +3 -2
  313. package/src/social/post-object.ts +120 -0
  314. package/src/social/post-sources.ts +136 -0
  315. package/src/social/post-text.ts +103 -0
  316. package/src/social/posts.ts +378 -0
  317. package/src/social/presence.ts +7 -5
  318. package/src/social/publish/index.ts +17 -5
  319. package/src/social/publish/secret.ts +2 -2
  320. package/src/social/release-stage.ts +58 -57
  321. package/src/social/routes.ts +64 -24
  322. package/src/social/stage.ts +42 -57
  323. package/src/social/text.ts +4 -3
  324. package/src/social/thumbnail.ts +135 -43
  325. package/src/social/tracker.ts +1 -1
  326. package/src/social/writes.ts +12 -29
  327. package/src/stores/desk.ts +16 -11
  328. package/src/stores/unit.ts +2 -2
  329. package/src/trailer/sound/eleven.ts +33 -3
  330. package/src/urls/rows.ts +1 -1
  331. package/src/vault/vault-http.ts +11 -3
  332. package/src/vault/vault-import.ts +6 -1
  333. package/src/veille/identity.ts +2 -2
  334. package/src/wiki/graph-pages.ts +13 -1
  335. package/src/wiki/scan-md.ts +1 -1
  336. package/src/asks/asks-queue.ts +0 -424
  337. package/src/messages/suggest.ts +0 -96
  338. package/src/social/migrate.ts +0 -123
@@ -4,6 +4,7 @@
4
4
  // disposed when another one does. Only the newest version takes his marks: an older one shows what was said on it
5
5
  import { makeAutoObservable, observableRef, runInAction } from 'mobx'
6
6
  import type { Cell, EventCell, NoteCell, ReplyCell, ThreadView, VerdictCell, VersionCell } from '../../../review/cells.ts'
7
+ import type { Trace } from '../../../review/traces.ts'
7
8
  import {
8
9
  asOptions,
9
10
  isApproved,
@@ -21,14 +22,19 @@ import {
21
22
  type ReviewView,
22
23
  type Side,
23
24
  type TrailerCard,
25
+ isOpening,
24
26
  } from '../../../review/model.ts'
25
27
  import { ClipSt } from './clip-st.ts'
26
28
  import { etagLoader, postJson } from './review-kit.ts'
27
29
  import type { ReviewSt } from './review-st.ts'
28
30
  import { TrailerSt } from './trailer-st.ts'
29
31
  import { laneNotes, notesNow, sortedDraft, type LaneNote } from '../../../review/trailer-notes.ts'
32
+ import type { ItemVerdict } from '../../../review/verdict-items.ts'
30
33
  import type { LaneMark } from '../../../review/trailer-model.ts'
31
34
 
35
+
36
+ /** what the object panel shows: the object a message links (its cell, its address), or a loose picture */
37
+ export type PanelObject = { cell: string; address: string } | { src: string; title: string }
32
38
  export interface Draft {
33
39
  rects: Rect[]
34
40
  comment: string
@@ -48,8 +54,11 @@ export type Framed = VersionCell | VerdictCell | ReplyCell | NoteCell
48
54
  export const TILE_FILTERS = ['all', 'unrated', 'low', 'fix'] as const
49
55
  export type TileFilter = (typeof TILE_FILTERS)[number]
50
56
 
51
- /** one line of the thread as drawn: a day's divider, a run of state changes, or a framed cell */
52
- export type Line = { kind: 'day'; day: string } | { kind: 'events'; cells: EventCell[] } | { kind: 'cell'; cell: Framed }
57
+ /** a cell drawn as one trace line (review/traces.ts): an event, a verdict with no words */
58
+ export type Traced = (EventCell | VerdictCell) & { trace: Trace }
59
+
60
+ /** one line of the thread as drawn: a day's divider, a run of traces, or a framed cell */
61
+ export type Line = { kind: 'day'; day: string } | { kind: 'events'; cells: Traced[] } | { kind: 'cell'; cell: Framed }
53
62
 
54
63
  /** one item of the contents strip: a cell, or one view of a version, and the key a click unfolds */
55
64
  export interface Entry {
@@ -83,8 +92,44 @@ export interface SaidNote {
83
92
 
84
93
  /** the dom id of a cell and of a view of a version: a message id carries a slash */
85
94
  export const cellDom = (id: string): string => `rvc-${id.replace(/[^A-Za-z0-9-]/g, '_')}`
95
+ /** a step of an ask's instructions in the timeline, where the dock's reminder jumps */
96
+ export const stepDom = (cell: string, step: number): string => `${cellDom(cell)}-s${step}`
86
97
  export const viewDom = (id: string, view: number): string => `${cellDom(id)}-v${view}`
87
98
  export const viewKey = (id: string, view: number): string => `${id}#${view}`
99
+ export const dockDom = (id: string): string => `rvd-${id.replace(/[^A-Za-z0-9-]/g, '_')}`
100
+
101
+ /** an agent's question or proposed change that still waits on his answer */
102
+ const waitsOnHim = (c: ReplyCell): boolean => (c.propose ? c.propose.open : c.ask ? (c.ask.open ?? c.ask.answered === undefined) : c.judge?.open === true)
103
+
104
+ const ASK_WORD: Record<NonNullable<NonNullable<ReplyCell['ask']>['kind']>, string> = { choice: 'question', checklist: 'checklist', confirm: 'a step to do', text: 'question', url: 'a link', secret: 'a secret', file: 'a file' }
105
+
106
+ /** what kind of request a cell makes, in a word */
107
+ export const requestWord = (c: ReplyCell): string => (c.propose ? 'proposed change' : c.ask === undefined && c.judge ? 'your verdict' : c.instructions ? 'steps' : ASK_WORD[c.ask?.kind ?? 'choice'])
108
+
109
+ /** his answer on a question or a change, in one line; a secret says where it is stored, never a byte of it */
110
+ export function answeredWords(c: ReplyCell): string {
111
+ const p = c.propose
112
+ if (p) {
113
+ const n = p.fields.filter((f) => f.applied).length
114
+ return n === 0 ? 'with words' : n === p.fields.length ? (n === 1 ? `applied ${p.fields[0]!.key}` : `applied all ${n}`) : `applied ${n} of ${p.fields.length}, then words`
115
+ }
116
+ const a = c.ask
117
+ if (!a) return ''
118
+ if (a.answered) {
119
+ // the answer's text is the option's label, then the owner's words after « : » when there are some
120
+ const label = a.options[a.answered.option] ?? `option ${a.answered.option + 1}`
121
+ const t = a.answered.text
122
+ const words = t === label ? '' : t.startsWith(`${label}: `) ? t.slice(label.length + 2) : t
123
+ return `${label}${words ? ` · « ${words} »` : ''}`
124
+ }
125
+ if (a.none !== undefined) return `none of these · « ${a.none} »`
126
+ if (a.kind === 'secret') return a.secret?.stored ? `stored as ${a.secret.name}` : 'not given'
127
+ if (a.kind === 'checklist') return `all ${a.lines?.length ?? 0} ${c.instructions ? 'steps ' : ''}done`
128
+ if (a.kind === 'confirm') return 'done'
129
+ if (a.kind === 'url' && a.value) return `${a.value.text}${a.value.opens ? '' : ' · did not open from this Mac'}`
130
+ if (a.value) return a.kind === 'file' ? `his file, view ${(a.value.view ?? 0) + 1}` : a.value.text
131
+ return 'yes'
132
+ }
88
133
 
89
134
  /** a reaction is on that view, that tile of it, or that message of a draft card */
90
135
  const sameSpot = (r: ReviewReaction, view: number, tile: number | undefined, post?: string): boolean => r.view === view && r.tile === tile && r.post === post
@@ -115,7 +160,8 @@ export class ThreadSt {
115
160
  /** the column scrolled to the newest cell once, on the first load */
116
161
  landed = false
117
162
  /** the view open in the lightbox over the thread (a preview clicked), to judge and draw on at its full size */
118
- boxed: { cell: string; view: number } | null = null
163
+ /** the view the lightbox shows; on a gallery, the one tile it shows large */
164
+ boxed: { cell: string; view: number; tile?: number } | null = null
119
165
  private drafts: Record<string, Draft> = {}
120
166
  /** the older version his answer goes to: a version landed while he wrote, or he chose to answer it. His first mark
121
167
  * on the newest version, or « answer v4 », brings his answer back to the newest */
@@ -130,7 +176,6 @@ export class ThreadSt {
130
176
  /** the rectangle whose note box takes the focus once it shows */
131
177
  noteFocus: number | null = null
132
178
  /** the gallery tile shown large, `<item>#<view>/<tile>` */
133
- bigTile: string | null = null
134
179
  /** the tile each gallery view opens in tabs mode, by view; absent = its first shown tile */
135
180
  galleryTab: Record<number, number> = {}
136
181
  /** the gallery tile under the pointer of the newest version: 1 to 5 score it */
@@ -149,6 +194,8 @@ export class ThreadSt {
149
194
  openRows: Record<string, boolean> = {}
150
195
  /** his hint being typed on an agent's update, by the update's cell id */
151
196
  hints: Record<string, string> = {}
197
+ /** the message whose « fix » opened its own words box, null when none is open */
198
+ fixing: string | null = null
152
199
  busy = false
153
200
  /** the verdict he just gave (null: the one he took back): shown the moment he clicks, while the store takes it */
154
201
  sending: { on: string; status: ReviewStatus | null } | null = null
@@ -204,7 +251,9 @@ export class ThreadSt {
204
251
  receive(v: ThreadView): void {
205
252
  if (v === this.data) return
206
253
  const before = this.data
207
- if (before) for (const c of before.cells) if (c.kind !== 'event' && this.folds[c.id] === undefined && this.defaultOpen(c, before) !== this.defaultOpen(c, v)) this.folds = { ...this.folds, [c.id]: this.defaultOpen(c, before) }
254
+ // a cell a newer object just superseded folds even under the owner's eyes: that is the point of superseding it
255
+ const gone = new Set(v.cells.flatMap((c) => (c.superseded ? [c.id] : [])))
256
+ if (before) for (const c of before.cells) if (c.kind !== 'event' && !gone.has(c.id) && this.folds[c.id] === undefined && this.defaultOpen(c, before) !== this.defaultOpen(c, v)) this.folds = { ...this.folds, [c.id]: this.defaultOpen(c, before) }
208
257
  if (before && before.head !== v.head && this.draftOn === null && isDirty(this.drafts[before.head]) && v.members.includes(before.head)) this.draftOn = before.head
209
258
  this.data = v
210
259
  // an address's view on a link to an old version is that version's view, never the newest's
@@ -224,6 +273,7 @@ export class ThreadSt {
224
273
  }
225
274
 
226
275
  private defaultOpen(c: Cell, v: ThreadView): boolean {
276
+ if (c.superseded) return false
227
277
  return c.open || c.id === v.asked
228
278
  }
229
279
 
@@ -318,7 +368,8 @@ export class ThreadSt {
318
368
  /** the newest version takes a verdict and his marks: an agent's card that is no draft */
319
369
  get takesVerdict(): boolean {
320
370
  const h = this.head
321
- return h?.kind === 'version' && !h.item.wip
371
+ // a thread opened with words holds nothing to judge: its questions and changes take his answer in their cells
372
+ return h?.kind === 'version' && !h.item.wip && (!isOpening(h.item) || h.item.asksVerdict === true)
322
373
  }
323
374
 
324
375
  /** the version cell an item id names */
@@ -337,14 +388,79 @@ export class ThreadSt {
337
388
  day = d
338
389
  }
339
390
  const last = out.at(-1)
340
- if (c.kind === 'event') {
341
- if (last?.kind === 'events') last.cells.push(c)
342
- else out.push({ kind: 'events', cells: [c] })
391
+ if (c.kind === 'event' || (c.kind === 'verdict' && c.trace !== undefined)) {
392
+ const t = c as Traced
393
+ if (last?.kind === 'events') last.cells.push(t)
394
+ else out.push({ kind: 'events', cells: [t] })
343
395
  } else out.push({ kind: 'cell', cell: c })
344
396
  }
345
397
  return out
346
398
  }
347
399
 
400
+ // ── the dock: what waits on his answer, above his reply box (wiki tools/shipkit/threads-page.md, The dock) ──
401
+
402
+ /** each question and proposed change of an agent that still waits on him, oldest first; a closed thread or ask asks
403
+ * nothing: the server closes a request asked before his close (review/cells.ts, moot) */
404
+ get openRequests(): ReplyCell[] {
405
+ if (this.data?.ask && this.data.ask.state !== 'open') return []
406
+ // a field inside a step waits as its step does: the instructions' one reminder covers it
407
+ return this.cells.filter((c): c is ReplyCell => c.kind === 'reply' && c.party === 'agent' && c.step === undefined && waitsOnHim(c))
408
+ }
409
+
410
+ /** when he closed the thread, null while it is open: the server's `closedAt` (review/threads.ts), the one function
411
+ * every list reads. A request asked before it closes with it, one asked after it still waits */
412
+ get closedAt(): string | null {
413
+ return this.data?.closedAt ?? null
414
+ }
415
+
416
+ /** the request still waits on him: its cell draws its controls live, the dock reminds of it */
417
+ waitsNow(id: string): boolean {
418
+ return this.openRequests.some((c) => c.id === id)
419
+ }
420
+
421
+ /** the version that waits for the owner's verdict: its verdicts sit under it in the timeline (item-verdict.tsx), the
422
+ * dock holds one line that reminds of it */
423
+ get verdictAbove(): VersionCell | null {
424
+ const h = this.head
425
+ if (h?.kind !== 'version' || !this.takesVerdict || this.chosenOn(h.id) !== undefined || this.data?.state.state === 'closed') return null
426
+ return h
427
+ }
428
+
429
+ /** the owner's verdict on a message that asks it; its own words box's words go with it, else the reply box's. A fix
430
+ * needs words: with none, « fix » opens the item's own words box, as a question has one */
431
+ async judge(c: ReplyCell, status: ItemVerdict): Promise<void> {
432
+ if (this.busy) return
433
+ const own = (this.hints[c.id] ?? '').trim()
434
+ const text = own !== '' ? own : this.draft.comment.trim()
435
+ if (status === 'approved-with-fix' && text === '') {
436
+ this.fixing = c.id
437
+ return
438
+ }
439
+ this.busy = true
440
+ this.error = null
441
+ try {
442
+ await postJson(this.rv.url(`/api/review/${c.on}/item-verdict`), { re: c.id.slice(c.on.length + 1), status, ...(text !== '' ? { text } : {}) })
443
+ runInAction(() => {
444
+ if (own !== '') delete this.hints[c.id]
445
+ else if (text !== '') this.setComment('')
446
+ this.fixing = null
447
+ })
448
+ await this.refresh()
449
+ await this.rv.answered()
450
+ } catch (e) {
451
+ runInAction(() => (this.error = (e as Error).message))
452
+ } finally {
453
+ runInAction(() => (this.busy = false))
454
+ }
455
+ }
456
+
457
+ /** V, F, R: the newest open item that asks the owner's verdict, a message or the version; the version when none waits */
458
+ judgeKey(status: ItemVerdict): Promise<void> {
459
+ const c = [...this.openRequests].reverse().find((x) => x.judge?.open === true)
460
+ const v = this.verdictAbove
461
+ return c !== undefined && (v === null || c.at >= v.at) ? this.judge(c, status) : this.submit(status)
462
+ }
463
+
348
464
  // ── folding ──
349
465
 
350
466
  isOpen(c: Cell): boolean {
@@ -386,15 +502,38 @@ export class ThreadSt {
386
502
  if (view !== undefined && cell === this.target) this.setView(view)
387
503
  }
388
504
 
505
+ /** the dock's reminder of an ask's instructions: the column scrolls to that step and lights it */
506
+ revealStep(cell: string, step: number): void {
507
+ this.folds = { ...this.folds, [cell]: true }
508
+ this.jump = stepDom(cell, step)
509
+ }
510
+
389
511
  jumped(): void {
390
512
  this.jump = null
391
513
  }
392
514
 
393
- openBox(cell: string, view: number): void {
394
- this.boxed = { cell, view }
515
+ openBox(cell: string, view: number, tile?: number): void {
516
+ this.boxed = { cell, view, ...(tile !== undefined ? { tile } : {}) }
395
517
  if (cell === this.target) this.setView(view)
396
518
  }
397
519
 
520
+ /** the object open in the panel on the right of the thread (object-panel.tsx): an object a message links, read live
521
+ * from its cell, or a loose picture (a reply's, a note's still) */
522
+ panel: PanelObject | null = null
523
+
524
+ openPanel(p: PanelObject): void {
525
+ this.boxed = null
526
+ this.panel = p
527
+ }
528
+
529
+ closePanel(): void {
530
+ this.panel = null
531
+ }
532
+
533
+ openPicture(src: string, title: string): void {
534
+ this.openPanel({ src, title })
535
+ }
536
+
398
537
  closeBox(): void {
399
538
  this.boxed = null
400
539
  }
@@ -450,7 +589,8 @@ export class ThreadSt {
450
589
  const choice = isChoice(h.item)
451
590
  // an older update's picture is history: only the newest one waits for his answer
452
591
  const ups = this.updateViewsOf(h.id)
453
- const past = new Set(ups.slice(0, -1))
592
+ // an older update's picture, a question's option and a proposed sound are answered in their own cells
593
+ const past = new Set([...ups.slice(0, -1), ...[...this.messageViewsOf(h.id)].filter((i) => !ups.includes(i))])
454
594
  return h.item.views.flatMap((v, i) => (past.has(i) ? [] : [{ v, i }])).map(({ v, i }) => {
455
595
  const own = this.reactionOf(i)
456
596
  const given = sent?.reactions.find((r) => r.view === i && r.tile === undefined)
@@ -469,6 +609,18 @@ export class ThreadSt {
469
609
  return this.cells.flatMap((c) => (c.kind === 'reply' && c.on === on && c.update?.view !== undefined ? [c.update.view] : []))
470
610
  }
471
611
 
612
+ /** every view of an item a message holds: an update's media, a question's options, a proposed sound; each draws in
613
+ * its message's cell, never among the version's views */
614
+ messageViewsOf(on: string): Set<number> {
615
+ return new Set(
616
+ this.cells.flatMap((c) =>
617
+ c.kind === 'reply' && c.on === on && c.party === 'agent'
618
+ ? [...(c.update?.view !== undefined ? [c.update.view] : []), ...(c.ask?.views ?? []).flatMap((v) => (v === null ? [] : [v])), ...(c.propose?.fields ?? []).flatMap((f) => (f.view === undefined ? [] : [f.view]))]
619
+ : [],
620
+ ),
621
+ )
622
+ }
623
+
472
624
  /** the views of that version still waiting for his answer, of all its views: « 3 of 5 views waiting for you » */
473
625
  get waitingViews(): { waiting: number; of: number } | null {
474
626
  const marks = this.viewMarks
@@ -799,11 +951,6 @@ export class ThreadSt {
799
951
  this.galleryTab = { ...this.galleryTab, [view]: tile }
800
952
  }
801
953
 
802
- toggleTile(id: string, view: number, tile: number): void {
803
- const k = `${viewKey(id, view)}/${tile}`
804
- this.bigTile = this.bigTile === k ? null : k
805
- }
806
-
807
954
  /** a version as thin option rows: a choice, or views that each play alone, unless he asked them full */
808
955
  rows(item: Item): boolean {
809
956
  return asOptions(item) && this.full[item.id] !== true
@@ -907,7 +1054,7 @@ export class ThreadSt {
907
1054
  return
908
1055
  }
909
1056
  if (h.item.wip) {
910
- this.error = 'a draft card: the verdict comes once its agent makes it ready; a word goes in a reply'
1057
+ this.error = 'a draft version: the verdict comes once its agent makes it ready; a word goes in a reply'
911
1058
  return
912
1059
  }
913
1060
  const d = this.draft
@@ -999,16 +1146,50 @@ export class ThreadSt {
999
1146
  }
1000
1147
  }
1001
1148
 
1002
- /** one click on a question's option, or « apply » on a proposed change (his edit the words box holds): his answer
1003
- * goes to the item it sits on, naming it, and wakes the agent that holds the thread */
1004
- async answer(c: { id: string; on: string }, a: { option?: number; apply?: true; edited?: boolean }): Promise<void> {
1149
+ /** one click on a question's option, or « apply » on one field of a proposed change (the owner's edit of its value in the
1150
+ * field's box, `<cell>#<key>`): the owner's answer goes to the item it sits on, naming it, the owner's words the cell's box, and wakes
1151
+ * the agent that holds the thread */
1152
+ async answer(c: { id: string; on: string }, a: { option?: number; apply?: true; field?: string; tick?: boolean; value?: string }): Promise<void> {
1005
1153
  if (this.busy) return
1154
+ await this.answering(c, [a])
1155
+ }
1156
+
1157
+ /** « apply all »: one answer a field not applied yet, each with its value as he left it */
1158
+ async applyAll(c: { id: string; on: string }, fields: readonly string[]): Promise<void> {
1159
+ if (this.busy || fields.length === 0) return
1160
+ await this.answering(c, fields.map((field) => ({ apply: true as const, field })))
1161
+ }
1162
+
1163
+ /** the owner's words on a question with no option clicked: none of them, and why; on a proposed change, a word on it */
1164
+ async noneOf(c: { id: string; on: string }): Promise<void> {
1165
+ await this.sendHint(c)
1166
+ }
1167
+
1168
+ /** the key of the box that holds the owner's edit of one field's value */
1169
+ fieldBox = (c: { id: string }, key: string): string => `${c.id}#${key}`
1170
+
1171
+ private async answering(c: { id: string; on: string }, all: readonly { option?: number; apply?: true; field?: string; tick?: boolean; value?: string }[]): Promise<void> {
1006
1172
  const sent = this.hints[c.id] ?? ''
1007
1173
  const re = c.id.slice(c.on.length + 1)
1008
1174
  this.busy = true
1009
1175
  this.error = null
1010
1176
  try {
1011
- await postJson(this.rv.url(`/api/review/${c.on}/answer`), { re, ...(a.option !== undefined ? { option: a.option } : {}), ...(a.apply ? { apply: true } : {}), ...(sent.trim() ? { text: sent.trim() } : {}) })
1177
+ for (const a of all) {
1178
+ const box = a.field !== undefined ? this.fieldBox(c, a.field) : null
1179
+ const value = a.value?.trim() ?? (box !== null ? (this.hints[box] ?? '').trim() : '')
1180
+ await postJson(this.rv.url(`/api/review/${c.on}/answer`), {
1181
+ re,
1182
+ ...(a.option !== undefined ? { option: a.option } : {}),
1183
+ ...(a.tick !== undefined ? { tick: a.tick } : {}),
1184
+ ...(a.apply ? { apply: true } : {}),
1185
+ ...(a.field !== undefined && a.field !== '' ? { field: a.field } : {}),
1186
+ ...(value !== '' ? { value } : {}),
1187
+ ...(sent.trim() ? { text: sent.trim() } : {}),
1188
+ })
1189
+ runInAction(() => {
1190
+ if (box !== null) delete this.hints[box]
1191
+ })
1192
+ }
1012
1193
  runInAction(() => {
1013
1194
  if (this.hints[c.id] === sent) delete this.hints[c.id]
1014
1195
  })
@@ -1020,6 +1201,25 @@ export class ThreadSt {
1020
1201
  }
1021
1202
  }
1022
1203
 
1204
+ /** the ticks on their way, by `<cell id>#<line>`: the box shows his click at once, and a tick never waits on another */
1205
+ ticking: Record<string, boolean> = {}
1206
+
1207
+ /** his tick on one line of a checklist or one step of an ask's instructions (with his pick on a choice step), sent
1208
+ * at once, apart from any other answer on its way */
1209
+ async tick(c: { id: string; on: string }, line: number, tick: boolean, pick?: number): Promise<void> {
1210
+ const key = `${c.id}#${line}`
1211
+ if (this.ticking[key] !== undefined) return
1212
+ this.ticking[key] = tick
1213
+ try {
1214
+ await postJson(this.rv.url(`/api/review/${c.on}/answer`), { re: c.id.slice(c.on.length + 1), option: line, tick, ...(pick !== undefined ? { pick } : {}) })
1215
+ await this.rv.answered()
1216
+ } catch (e) {
1217
+ runInAction(() => (this.error = (e as Error).message))
1218
+ } finally {
1219
+ runInAction(() => delete this.ticking[key])
1220
+ }
1221
+ }
1222
+
1023
1223
  /** the agent words he has not read, by cell id: the page sends them read once each shows on his screen */
1024
1224
  get unreadCells(): string[] {
1025
1225
  return this.cells.filter((c) => (c.kind === 'reply' || c.kind === 'note') && c.party === 'agent' && !c.read && c.id.includes('/')).map((c) => c.id)
@@ -89,7 +89,7 @@ const CardBar = observer(({ ver, tr, spec }: { ver: Ver; tr: TrailerSt; spec: Tr
89
89
  <span className="sp" />
90
90
  <span className="tr-dim tr-small">{ver.live || ver.claim ? `Space · , . a frame · drag on the frame: a note${spec.before ? ' · B before, after' : ''}` : 'an older version: its own render and the notes sent on it'}</span>
91
91
  {ver.rv.phone.on ? null : (
92
- <button className={ver.rv.wide ? 'on' : ''} title="the card takes the page, its notes beside the player (W)" onMouseDown={keepFocus} onClick={() => ver.rv.toggleWide()}>
92
+ <button className={ver.rv.wide ? 'on' : ''} title="the version takes the page, its notes beside the player (W)" onMouseDown={keepFocus} onClick={() => ver.rv.toggleWide()}>
93
93
  {ver.rv.wide ? 'narrow' : 'wide'} (W)
94
94
  </button>
95
95
  )}
@@ -157,14 +157,14 @@ export const ShotSummary = observer(({ st }: { st: TrailerSt }) => {
157
157
  const { counts: c, total, cards } = ss.summary
158
158
  const cut = st.cut?.cut
159
159
  return (
160
- <div className="tr-summary" title="each shot's state: a coloured bar under it on the timeline, a line on its card; a lane writes it with sk trailer plan">
160
+ <div className="tr-summary" title="each shot's state: a coloured bar under it on the timeline, a line on its version; a lane writes it with sk trailer plan">
161
161
  <span className="ss-ready"><span className="tr-sdot" /><b>{c.ready} of {total}</b> shots ready</span>
162
162
  <span className="ss-queued"><span className="tr-sdot" />{c.queued} queued</span>
163
163
  <span className="ss-filming"><span className="tr-sdot" />{c.filming} filming</span>
164
164
  {c.unfilmed > 0 ? <span className="ss-unfilmed"><span className="tr-sdot" />{c.unfilmed} not filmed</span> : null}
165
165
  <span className="ss-waiting">
166
166
  <span className="tr-sdot" />cards waiting: {cards.length === 0 ? 'none' : cards.map((x) => (
167
- <button key={x.card} type="button" className="tr-cardlink" title={`open card ${x.card}: the new take of ${x.shots.join(', ')}`} onClick={() => st.openCard(x.card)}>{x.card} ({x.shots.join(', ')})</button>
167
+ <button key={x.card} type="button" className="tr-cardlink" title={`open version ${x.card}: the new take of ${x.shots.join(', ')}`} onClick={() => st.openCard(x.card)}>{x.card} ({x.shots.join(', ')})</button>
168
168
  ))}
169
169
  </span>
170
170
  {ss.plan !== cut ? <span className="tr-dim tr-small">the plan of {ss.plan}, the cut this version keeps</span> : null}