rvlib-shipkit 2.12.0 → 2.13.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 (290) hide show
  1. package/CHANGELOG.md +48 -13
  2. package/README.md +1 -1
  3. package/package.json +4 -2
  4. package/src/agent-time/store.ts +2 -2
  5. package/src/check.ts +1 -1
  6. package/src/checks/SK001-package-json-shape.check.ts +4 -0
  7. package/src/checks/SK003-claude-md-shape.check.ts +1 -1
  8. package/src/checks/SK004-gitignore-policy.check.ts +27 -2
  9. package/src/checks/SK005-rvlib-versions.check.ts +1 -1
  10. package/src/checks/SK008-reviewer-agent.check.ts +2 -2
  11. package/src/checks/SK012-config-barrel-import.check.ts +1 -1
  12. package/src/checks/SK015-nested-repo.check.ts +1 -1
  13. package/src/checks/SK035-public-clean.check.ts +46 -0
  14. package/src/checks/SK036-draft-media-size.check.ts +28 -0
  15. package/src/cli/cmd_Backup.ts +152 -0
  16. package/src/cli/cmd_Ci.ts +8 -11
  17. package/src/cli/cmd_Drill.ts +145 -0
  18. package/src/cli/cmd_Home.ts +50 -3
  19. package/src/cli/cmd_Media.ts +7 -5
  20. package/src/cli/cmd_Review.ts +4 -2
  21. package/src/cli/cmd_Shot.ts +5 -2
  22. package/src/cli/cmd_Smoke.ts +4 -1
  23. package/src/cli/cmd_Social.ts +226 -0
  24. package/src/cli/cmd_Start.ts +1 -1
  25. package/src/cli/cmd_Time.ts +1 -1
  26. package/src/cli/cmd_Trailer.ts +5 -2
  27. package/src/cli/cmd_Veille.ts +173 -0
  28. package/src/cli/family-pages.ts +3 -0
  29. package/src/cli/registry.ts +13 -2
  30. package/src/cli.ts +5 -2
  31. package/src/collections/actions.ts +1 -49
  32. package/src/collections/checks.ts +2 -1
  33. package/src/collections/collection-types.ts +11 -2
  34. package/src/collections/providers.ts +4 -4
  35. package/src/collections/review.ts +2 -1
  36. package/src/collections/tests.ts +19 -8
  37. package/src/contracts/apply-contracts.ts +1 -3
  38. package/src/contracts/contract-manifests.ts +2 -3
  39. package/src/contracts/contract-types.ts +0 -1
  40. package/src/contracts/contracts-engine.ts +0 -3
  41. package/src/core/app-icon.ts +9 -3
  42. package/src/core/bun-builtins.ts +2 -2
  43. package/src/core/discover-checks.ts +37 -5
  44. package/src/core/fix-scope.ts +4 -2
  45. package/src/core/floor-resolve.ts +68 -48
  46. package/src/core/floor.ts +9 -0
  47. package/src/core/git-root.ts +24 -0
  48. package/src/core/last-good.ts +3 -1
  49. package/src/core/layout.ts +8 -0
  50. package/src/core/log-stamp.ts +36 -0
  51. package/src/core/loop-watch.ts +93 -0
  52. package/src/core/machine-link.ts +134 -0
  53. package/src/core/memory-watch.ts +41 -0
  54. package/src/core/one-way-in-policy.ts +27 -19
  55. package/src/core/run-ci.ts +6 -8
  56. package/src/core/run-fixers.ts +9 -9
  57. package/src/core/slots.ts +21 -0
  58. package/src/core/tree-rev.ts +60 -0
  59. package/src/core/unit-files.ts +42 -0
  60. package/src/drill/render.ts +140 -0
  61. package/src/drill/run.ts +269 -0
  62. package/src/fleet/scan-fleet.ts +6 -5
  63. package/src/home/daemon-jobs.ts +201 -0
  64. package/src/home/global-context.ts +34 -1
  65. package/src/home/home-routes.ts +22 -15
  66. package/src/home/hubs.ts +10 -3
  67. package/src/home/inbox-shape.ts +53 -4
  68. package/src/home/inbox.ts +16 -1
  69. package/src/home/lib-watch.ts +10 -3
  70. package/src/home/machine-stores.ts +15 -29
  71. package/src/home/run-daemon.ts +15 -18
  72. package/src/home/run-pm.ts +2 -0
  73. package/src/home/serve-daemon.ts +4 -3
  74. package/src/home/serve-web.ts +104 -1
  75. package/src/hooks/commit-message.ts +28 -19
  76. package/src/hooks/leak-guard.ts +10 -3
  77. package/src/hooks/run-hooks.ts +2 -6
  78. package/src/identities/identities.ts +334 -0
  79. package/src/identities/machine-route.ts +126 -0
  80. package/src/identities/machine.ts +62 -0
  81. package/src/init-repo.ts +1 -1
  82. package/src/ledger/check-stats.ts +10 -9
  83. package/src/ledger/gate-checks.ts +32 -1
  84. package/src/ledger/record-kept.ts +112 -0
  85. package/src/ledger/repo-view.ts +10 -0
  86. package/src/ledger/run-log.ts +17 -12
  87. package/src/ledger/run-timeline.ts +8 -4
  88. package/src/ledger/store.ts +7 -0
  89. package/src/ledger/suite-log.ts +17 -13
  90. package/src/media-kinds.ts +2 -1
  91. package/src/media-store/backup/daemon.ts +73 -0
  92. package/src/media-store/backup/keys.ts +25 -0
  93. package/src/media-store/backup/manifest.ts +193 -0
  94. package/src/media-store/backup/restore.ts +192 -0
  95. package/src/media-store/backup/run.ts +278 -0
  96. package/src/media-store/backup/secret.ts +86 -0
  97. package/src/media-store/backup/snapshot.ts +64 -0
  98. package/src/media-store/backup/sources.ts +199 -0
  99. package/src/media-store/daemon.ts +56 -70
  100. package/src/media-store/put.ts +4 -2
  101. package/src/media-store/space.ts +23 -4
  102. package/src/pages/forward.ts +35 -0
  103. package/src/pages/frame-client.ts +118 -0
  104. package/src/pages/routes.ts +29 -0
  105. package/src/pages/unit.ts +92 -0
  106. package/src/plan/planner.ts +12 -0
  107. package/src/plan/repo-source.ts +19 -5
  108. package/src/reflect/transcript.ts +35 -10
  109. package/src/release/public-clean.ts +301 -0
  110. package/src/release/published-here.ts +22 -0
  111. package/src/release/run-bump.ts +2 -1
  112. package/src/release/run-release.ts +4 -1
  113. package/src/repo-config.ts +53 -2
  114. package/src/review/http.ts +16 -2
  115. package/src/review/model.ts +15 -4
  116. package/src/review/notes.ts +77 -0
  117. package/src/review/project.ts +6 -38
  118. package/src/review/routes.ts +4 -12
  119. package/src/review/store.ts +41 -1
  120. package/src/review/trailer-media.ts +7 -4
  121. package/src/review/trailer-shots.ts +21 -4
  122. package/src/review/unit.ts +1 -1
  123. package/src/scaffold/files/agent-handoff.md +3 -0
  124. package/src/scaffold/files/agent-index.md +4 -12
  125. package/src/scaffold/project-scaffold.ts +5 -4
  126. package/src/serve/embed.ts +1 -1
  127. package/src/serve/hub-app/col-card.tsx +3 -17
  128. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  129. package/src/serve/hub-app/cols-svc.ts +0 -13
  130. package/src/serve/hub-app/dock-st.ts +4 -2
  131. package/src/serve/hub-app/dock-view.tsx +2 -0
  132. package/src/serve/hub-app/frames-st.ts +35 -0
  133. package/src/serve/hub-app/hash-route.ts +64 -1
  134. package/src/serve/hub-app/home-st.ts +31 -7
  135. package/src/serve/hub-app/home-strip.css +9 -1
  136. package/src/serve/hub-app/home-strip.tsx +7 -6
  137. package/src/serve/hub-app/home.html +5 -0
  138. package/src/serve/hub-app/hub-app.tsx +49 -5
  139. package/src/serve/hub-app/hub.css +29 -11
  140. package/src/serve/hub-app/icons.tsx +16 -1
  141. package/src/serve/hub-app/identities-st.ts +210 -0
  142. package/src/serve/hub-app/identities-view.tsx +352 -0
  143. package/src/serve/hub-app/identities.css +48 -0
  144. package/src/serve/hub-app/identity-address.ts +52 -0
  145. package/src/serve/hub-app/inbox-st.ts +59 -6
  146. package/src/serve/hub-app/inbox-view.tsx +48 -6
  147. package/src/serve/hub-app/inbox.css +12 -1
  148. package/src/serve/hub-app/index.html +3 -0
  149. package/src/serve/hub-app/keys.ts +10 -2
  150. package/src/serve/hub-app/list-walk.ts +89 -0
  151. package/src/serve/hub-app/machine-st.ts +12 -0
  152. package/src/serve/hub-app/media-view.tsx +2 -1
  153. package/src/serve/hub-app/pages-frames.tsx +134 -0
  154. package/src/serve/hub-app/pages-svc.ts +111 -0
  155. package/src/serve/hub-app/palette-st.ts +18 -3
  156. package/src/serve/hub-app/palette-view.tsx +9 -2
  157. package/src/serve/hub-app/planned-view.tsx +2 -1
  158. package/src/serve/hub-app/project-list.css +18 -14
  159. package/src/serve/hub-app/project-list.tsx +88 -49
  160. package/src/serve/hub-app/projects-svc.ts +33 -3
  161. package/src/serve/hub-app/repo-sections.ts +19 -2
  162. package/src/serve/hub-app/repo-st.ts +75 -19
  163. package/src/serve/hub-app/review/review-cells.tsx +3 -3
  164. package/src/serve/hub-app/review/review-kit.ts +30 -7
  165. package/src/serve/hub-app/review/review-page.tsx +1 -1
  166. package/src/serve/hub-app/review/review-st.ts +19 -8
  167. package/src/serve/hub-app/review/review-thread.tsx +11 -9
  168. package/src/serve/hub-app/review/review-views.tsx +84 -19
  169. package/src/serve/hub-app/review/thread-st.ts +1 -10
  170. package/src/serve/hub-app/review/trailer-page.tsx +2 -1
  171. package/src/serve/hub-app/review.css +17 -8
  172. package/src/serve/hub-app/site/site-part.tsx +173 -0
  173. package/src/serve/hub-app/site/site-st.ts +157 -0
  174. package/src/serve/hub-app/site.css +35 -0
  175. package/src/serve/hub-app/social/calendar.tsx +182 -0
  176. package/src/serve/hub-app/social/comms-page.tsx +306 -0
  177. package/src/serve/hub-app/social/kit.tsx +244 -0
  178. package/src/serve/hub-app/social/post-card.tsx +456 -0
  179. package/src/serve/hub-app/social/problems.tsx +60 -0
  180. package/src/serve/hub-app/social/social-model.ts +154 -0
  181. package/src/serve/hub-app/social/social-page.tsx +674 -0
  182. package/src/serve/hub-app/social/social-st.ts +986 -0
  183. package/src/serve/hub-app/social.css +289 -0
  184. package/src/serve/hub-app/stores/stores-page.tsx +311 -0
  185. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  186. package/src/serve/hub-app/stores.css +54 -0
  187. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  188. package/src/serve/hub-app/timeline-view.tsx +3 -2
  189. package/src/serve/hub-app/tree-build.ts +6 -0
  190. package/src/serve/hub-app/tree-row.tsx +27 -4
  191. package/src/serve/hub-app/tree-svc.ts +18 -49
  192. package/src/serve/hub-app/veille/veille-page.tsx +514 -0
  193. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  194. package/src/serve/hub-app/veille.css +84 -0
  195. package/src/serve/hub-runtime.ts +14 -9
  196. package/src/serve/project-gutter-route.ts +44 -12
  197. package/src/serve/run-lanes.ts +7 -4
  198. package/src/serve/same-origin.ts +1 -1
  199. package/src/serve/serve-hub.ts +20 -12
  200. package/src/serve/tracked-watch.ts +24 -3
  201. package/src/serve/warm-cell.ts +5 -1
  202. package/src/shipkit-files.ts +15 -4
  203. package/src/shipkit.ts +0 -1
  204. package/src/shot/box.ts +162 -0
  205. package/src/shot/browser-slot.ts +62 -0
  206. package/src/shot/client.ts +43 -7
  207. package/src/shot/clip-encoder.ts +93 -12
  208. package/src/shot/film-box.ts +188 -0
  209. package/src/shot/shooter.ts +50 -15
  210. package/src/shot/shot-ask.ts +10 -2
  211. package/src/shot/stepped-clip.ts +5 -4
  212. package/src/site/desk.ts +242 -0
  213. package/src/site/routes.ts +66 -0
  214. package/src/site/unit.ts +62 -0
  215. package/src/social/brands.ts +22 -0
  216. package/src/social/compose.ts +97 -0
  217. package/src/social/desk-index.ts +123 -0
  218. package/src/social/desk-wire.ts +64 -0
  219. package/src/social/drafts.ts +183 -0
  220. package/src/social/house.ts +24 -0
  221. package/src/social/load.ts +319 -0
  222. package/src/social/md.ts +70 -0
  223. package/src/social/media-facts.ts +53 -0
  224. package/src/social/media-kind.ts +189 -0
  225. package/src/social/media-limit.ts +42 -0
  226. package/src/social/media-of.ts +30 -0
  227. package/src/social/migrate.ts +123 -0
  228. package/src/social/open.ts +17 -0
  229. package/src/social/post-url.ts +158 -0
  230. package/src/social/presence.ts +332 -0
  231. package/src/social/public-read.ts +53 -0
  232. package/src/social/publish/bluesky.ts +168 -0
  233. package/src/social/publish/discord.ts +76 -0
  234. package/src/social/publish/index.ts +24 -0
  235. package/src/social/publish/secret.ts +13 -0
  236. package/src/social/push.ts +31 -0
  237. package/src/social/richtext.ts +37 -0
  238. package/src/social/routes.ts +180 -0
  239. package/src/social/stats.ts +134 -0
  240. package/src/social/text.ts +267 -0
  241. package/src/social/tracker-route.ts +39 -0
  242. package/src/social/tracker.ts +255 -0
  243. package/src/social/unit.ts +53 -0
  244. package/src/social/writes.ts +130 -0
  245. package/src/start-repo.ts +14 -9
  246. package/src/stores/collection.ts +27 -0
  247. package/src/stores/desk.ts +336 -0
  248. package/src/stores/model.ts +187 -0
  249. package/src/stores/routes.ts +126 -0
  250. package/src/stores/unit.ts +57 -0
  251. package/src/suite/calibrate.ts +127 -0
  252. package/src/suite/core-counters.ts +91 -0
  253. package/src/suite/judge-suites.ts +94 -34
  254. package/src/suite/suite-cli.ts +44 -10
  255. package/src/suite/suite-cpu-preload.ts +34 -9
  256. package/src/trailer/adapter.ts +4 -0
  257. package/src/trailer/build.ts +42 -11
  258. package/src/trailer/ffmpeg.ts +11 -0
  259. package/src/trailer/footage.ts +30 -13
  260. package/src/trailer/grammar.ts +18 -2
  261. package/src/trailer/graph.ts +28 -6
  262. package/src/trailer/passage.ts +17 -5
  263. package/src/trailer/plan.ts +74 -3
  264. package/src/trailer/stitch.ts +67 -26
  265. package/src/trailer/url.ts +1 -1
  266. package/src/trailer/versions.ts +24 -0
  267. package/src/ts/gate-typecheck.ts +32 -0
  268. package/src/ts/typecheck-cli.ts +9 -11
  269. package/src/tui/tui-app.tsx +0 -1
  270. package/src/veille/asks.ts +155 -0
  271. package/src/veille/auto.ts +31 -0
  272. package/src/veille/batch.ts +27 -0
  273. package/src/veille/chrome.ts +127 -0
  274. package/src/veille/collection.ts +28 -0
  275. package/src/veille/desk.ts +242 -0
  276. package/src/veille/identity.ts +80 -0
  277. package/src/veille/import.ts +68 -0
  278. package/src/veille/log.ts +183 -0
  279. package/src/veille/platforms.ts +118 -0
  280. package/src/veille/reads.ts +66 -0
  281. package/src/veille/replied.ts +110 -0
  282. package/src/veille/routes.ts +185 -0
  283. package/src/veille/service.ts +81 -0
  284. package/src/veille/watch.ts +116 -0
  285. package/src/veille/worth.ts +46 -0
  286. package/src/wiki/scan-md.ts +18 -0
  287. package/src/collections/posts.ts +0 -142
  288. package/src/contracts/manifests/social.contract.ts +0 -20
  289. package/src/scaffold/files/agent-coding.md +0 -35
  290. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,77 @@
1
+ // his notes on one thing a desk shows (a store page's picture or field, a draft): the first an item of the one store,
2
+ // its subject the thing, so the review page and `sk review inbox` hold it; the next ones, while that thread is open,
3
+ // his replies on it, never a second item. The one path for a note on a thing (wiki build/shipkit/stores.md)
4
+ import { stateOf, subjectKey, type Origin, type ReviewItem, type Subject } from './model.ts'
5
+ import { addMessage, raiseItem, readAll, specOf } from './store.ts'
6
+ import { membersOf, threadsOf, type Thread } from './threads.ts'
7
+
8
+ /** one note as a desk shows it: the owner's words, where it stands, the agent's last word once answered */
9
+ export type SubjectNote = { id: string; at: string; text: string; state: string; answer?: string }
10
+
11
+ const keyIn = (dir: string) => {
12
+ const spec = specOf(dir)
13
+ return (s: Subject): string | null => subjectKey(s, spec)
14
+ }
15
+
16
+ /** every word of his on the thing's threads, the first note and each reply, with the thread's state and last answer */
17
+ function notesOfThreads(threads: readonly Thread[]): SubjectNote[] {
18
+ const out: SubjectNote[] = []
19
+ for (const t of threads) {
20
+ const members = membersOf(t)
21
+ const state = stateOf(t.head, false).state
22
+ const answer = members
23
+ .flatMap((x) => x.thread)
24
+ .filter((m) => m.who !== 'owner' && m.text !== undefined && m.op === undefined)
25
+ .sort((a, b) => a.at.localeCompare(b.at))
26
+ .at(-1)?.text
27
+ for (const x of members)
28
+ for (const m of x.thread)
29
+ if (m.who === 'owner' && m.op === undefined && m.verdict === undefined && m.text !== undefined)
30
+ out.push({ id: x.item.id, at: m.at, text: m.text, state, ...(answer ? { answer } : {}) })
31
+ }
32
+ return out.sort((a, b) => b.at.localeCompare(a.at))
33
+ }
34
+
35
+ /** the notes of any thing, the threads grouped once: a desk that shows many things reads the store's threads once */
36
+ export function notesBy(dir: string, items: readonly ReviewItem[]): (subject: Subject) => SubjectNote[] {
37
+ const key = keyIn(dir)
38
+ const by = new Map<string, Thread[]>()
39
+ for (const t of threadsOf(items))
40
+ for (const k of new Set(membersOf(t).map((x) => key(x.item.subject))))
41
+ if (k !== null) by.set(k, [...(by.get(k) ?? []), t])
42
+ return (subject) => {
43
+ const k = key(subject)
44
+ if (k === null) throw new Error(`notes: a ${subject.kind} names no one thing`)
45
+ return notesOfThreads(by.get(k) ?? [])
46
+ }
47
+ }
48
+
49
+ /** his note on the thing: a reply on its thread still open, else a new item titled `<name> : <first line>` */
50
+ export async function noteOn(
51
+ dir: string,
52
+ o: { subject: Subject; origin: Extract<Origin, { by: 'owner' }>; name: string; text: string; topic?: string; image?: string },
53
+ ): Promise<{ id: string }> {
54
+ const key = keyIn(dir)
55
+ const k = key(o.subject)
56
+ const text = o.text.trim()
57
+ if (k === null) throw new Error(`note: a ${o.subject.kind} names no one thing`)
58
+ if (!text) throw new Error('note: the text is empty')
59
+ const open = threadsOf(readAll(dir).items)
60
+ .filter((t) => membersOf(t).some((x) => key(x.item.subject) === k))
61
+ .filter((t) => stateOf(t.head, false).state !== 'closed')
62
+ .sort((a, b) => b.head.item.created.localeCompare(a.head.item.created))[0]?.head.item.id
63
+ if (open) {
64
+ addMessage(dir, open, 'owner', text)
65
+ return { id: open }
66
+ }
67
+ const head = `${o.name} : ${text.split('\n')[0] ?? ''}`
68
+ const x = await raiseItem(dir, {
69
+ subject: o.subject,
70
+ origin: o.origin,
71
+ ...(o.topic ? { topic: o.topic } : {}),
72
+ title: head.length > 80 ? `${head.slice(0, 79).trimEnd()}…` : head,
73
+ text,
74
+ ...(o.image ? { image: o.image } : {}),
75
+ })
76
+ return { id: x.item.id }
77
+ }
@@ -1,48 +1,16 @@
1
1
  // a repo's review unit at work (wiki build/shipkit/review.md, A project's parts): its file found by a walk cached on the
2
2
  // walked dirs' times and its text, imported, its spec bound to the store; its sources pulled, its kinds' facts and data
3
3
  // view computed on the server, so the hub never bundles project code
4
- import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs'
5
- import { isAbsolute, join, relative, resolve } from 'node:path'
6
- import { importFresh, repoUnitFiles } from '../core/discover-checks.ts'
7
- import { LAYOUT } from '../core/layout.ts'
4
+ import { existsSync } from 'node:fs'
5
+ import { unitFilesDeclaring } from '../core/unit-files.ts'
6
+ import { isAbsolute, relative, resolve } from 'node:path'
7
+ import { importFresh } from '../core/discover-checks.ts'
8
8
  import type { ReviewItem } from './model.ts'
9
9
  import { bindSpec, readAll, storeDir } from './store.ts'
10
10
  import { specOfUnit, type Fact, type Link, type ReviewUnit, type ViewPart, type ViewText } from './unit.ts'
11
11
 
12
- /** the walk's answer kept in the cache: the unit files and every dir it read, each with its time; a dir whose time moved
13
- * means a file came or went, so the walk runs again */
14
- interface Found {
15
- dirs: [string, number][]
16
- files: [string, number, boolean][]
17
- }
18
-
19
- const foundFile = (root: string): string => join(root, LAYOUT.cache, 'review-unit.json')
20
- const mtime = (p: string): number => statSync(p, { throwIfNoEntry: false })?.mtimeMs ?? -1
21
-
22
- /** the unit files that declare a review unit, by a text test, never an import: the walk's dirs cached on their times */
23
- export function reviewUnitFiles(root: string): string[] {
24
- const cache = foundFile(root)
25
- let found: Found | null = null
26
- try {
27
- found = JSON.parse(readFileSync(cache, 'utf8')) as Found
28
- } catch {
29
- found = null
30
- }
31
- const fresh = (f: Found): boolean => f.dirs.every(([d, t]) => mtime(d) === t) && f.files.every(([p, t]) => mtime(p) === t)
32
- if (!found || !fresh(found)) {
33
- const dirs: string[] = []
34
- const files = repoUnitFiles(root, dirs).filter((f) => !f.endsWith('.check.shipkit.ts'))
35
- found = { dirs: dirs.map((d) => [d, mtime(d)]), files: files.map((f) => [f, mtime(f), /\breview\s*\(/.test(readFileSync(f, 'utf8'))]) }
36
- try {
37
- mkdirSync(join(root, LAYOUT.cache), { recursive: true })
38
- writeFileSync(`${cache}.${process.pid}.tmp`, JSON.stringify(found))
39
- renameSync(`${cache}.${process.pid}.tmp`, cache)
40
- } catch {
41
- // a read only checkout: the next run walks again
42
- }
43
- }
44
- return found.files.filter(([, , has]) => has).map(([f]) => f)
45
- }
12
+ /** the unit files that declare a review unit (core/unit-files.ts) */
13
+ export const reviewUnitFiles = (root: string): string[] => unitFilesDeclaring(root, 'review')
46
14
 
47
15
  /** the repo's review unit, or null; two of them is an error naming both files */
48
16
  export async function loadReviewUnit(root: string): Promise<ReviewUnit | null> {
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os'
6
6
  import { dirname, extname, join } from 'node:path'
7
7
  import { isAnimFormat, isAnimLabels, isAnimMode, pairAnimation } from './anim.ts'
8
8
  import { startAuto } from './auto.ts'
9
- import { bad, KEEP, NO_STORE, ranged, TYPES } from './http.ts'
9
+ import { bad, KEEP, NO_STORE, ranged, tagged, TYPES } from './http.ts'
10
10
  import { viewFilesOf, type Rect, type ReviewItem, type Subject } from './model.ts'
11
11
  import { pasteHosts } from './paste.ts'
12
12
  import { openReview, partFile, viewOfItem } from './project.ts'
@@ -20,6 +20,7 @@ import { remoteUrl, reviewKey } from './media-read.ts'
20
20
  import { trailerRoutes } from './trailer-routes.ts'
21
21
  import { specData, type ReviewUnit } from './unit.ts'
22
22
  import { liveWatchers } from './watchers.ts'
23
+ import { autoRulesOf } from '../veille/auto.ts'
23
24
 
24
25
  // ── each repo's review unit, read again at most every 5 s; its auto rules scheduled in this server while it serves ──
25
26
 
@@ -40,7 +41,7 @@ async function project(root: string): Promise<{ dir: string; unit: ReviewUnit |
40
41
  return { dir, unit }
41
42
  }
42
43
  held?.auto?.stop()
43
- const rules = unit?.auto ?? []
44
+ const rules = autoRulesOf(root, unit)
44
45
  opened.set(root, { at: Date.now(), unit, auto: rules.length > 0 ? startAuto(dir, rules, () => readAllCached(dir).items) : null })
45
46
  return { dir, unit }
46
47
  }
@@ -113,15 +114,6 @@ function missingOf(dir: string, members: readonly ReviewItem[]): string[] {
113
114
  /** a file the disk let go, answered by the Space: the signed URL lives an hour, the browser keeps the redirect half of it */
114
115
  const toSpace = (url: string): Response => new Response(null, { status: 302, headers: { Location: url, 'Cache-Control': 'private, max-age=1800' } })
115
116
 
116
- /** a json answer with its ETag, 304 when the page holds it; gzipped when the page takes it */
117
- function tagged(req: Request, tag: string, body: () => unknown): Response {
118
- const headers = { 'Content-Type': 'application/json', ETag: tag, 'Cache-Control': 'no-cache', Vary: 'Accept-Encoding' }
119
- if (req.headers.get('If-None-Match') === tag) return new Response(null, { status: 304, headers: { ETag: tag } })
120
- const text = JSON.stringify(body())
121
- if (text.length < 4096 || !/\bgzip\b/.test(req.headers.get('Accept-Encoding') ?? '')) return new Response(text, { headers })
122
- return new Response(Bun.gzipSync(new TextEncoder().encode(text)), { headers: { ...headers, 'Content-Encoding': 'gzip' } })
123
- }
124
-
125
117
  async function reviewRoute(req: Request, path: string, dir: string, unit: ReviewUnit | null): Promise<Response | null> {
126
118
  if (path === '/api/review' && req.method === 'GET') {
127
119
  // the page polls this list: it is read from disk and sent again only when a file of it changed
@@ -162,7 +154,7 @@ async function reviewRoute(req: Request, path: string, dir: string, unit: Review
162
154
  // where a card lives, for the paste that hands it to another agent session; a config that does not load leaves it out
163
155
  const where = await pasteHosts(dirname(dirname(dir))).catch(() => null)
164
156
  return Response.json(
165
- { ...specData(specOf(dir)), role: roleOf(dir), sources: (unit?.sources ?? []).map((s) => s.id), auto: (unit?.auto ?? []).map((r) => ({ id: r.id, every: r.every })), where },
157
+ { ...specData(specOf(dir)), role: roleOf(dir), sources: (unit?.sources ?? []).map((s) => s.id), auto: autoRulesOf(dirname(dirname(dir)), unit).map((r) => ({ id: r.id, every: r.every })), where },
166
158
  { headers: NO_STORE },
167
159
  )
168
160
  }
@@ -1,11 +1,12 @@
1
1
  // the one feedback store on disk (wiki build/shipkit/review.md): `.shipkit/review/<id>/`, gitignored: `item.json`, the
2
2
  // media, and `thread/`, one file per message, never rewritten. An item is built in a dot folder and renamed, every file
3
- // written beside its place and renamed, so no reader sees half of one. The format is pkm-multi's verbatim. A folder of
3
+ // written beside its place and renamed, so no reader sees half of one. The format is a project's own store's, verbatim. A folder of
4
4
  // the old shape (request.json, feedback.json, a message with `seen`) fails loud
5
5
  import * as fs from 'node:fs'
6
6
  import { existsSync, readdirSync, readFileSync, statSync, watch } from 'node:fs'
7
7
  import { basename, dirname, extname, join, resolve } from 'node:path'
8
8
  import { LAYOUT } from '../core/layout.ts'
9
+ import { yieldLoop } from '../core/loop-watch.ts'
9
10
  import { ffmpeg } from '../trailer/ffmpeg.ts'
10
11
  import { probe, sizeOf, stillAt } from './media.ts'
11
12
  import { factsOf } from '../media-store/content.ts'
@@ -592,8 +593,31 @@ const used = new Set<string>()
592
593
  /** a code that read no store for this long: its reads go */
593
594
  const CODE_KEEP_MS = 7 * 24 * 3600_000
594
595
 
596
+ /** items a step of a read covers before it gives the loop back (readRawsAsync) */
597
+ const READ_STEP = 250
598
+
595
599
  /** every item of the store, through the machine index (space/db.ts): an item whose stamp moved is read again */
596
600
  function readRaws(dir: string): ReadAll {
601
+ const steps = readRawsSteps(dir)
602
+ for (;;) {
603
+ const r = steps.next()
604
+ if (r.done) return r.value
605
+ }
606
+ }
607
+
608
+ /** the same read, the loop given back every READ_STEP items: a cold store of thousands of items is seconds of parsing
609
+ * (wiki build/shipkit/home.md, Nothing heavy on the daemon's loop) */
610
+ async function readRawsAsync(dir: string): Promise<ReadAll> {
611
+ const steps = readRawsSteps(dir)
612
+ for (;;) {
613
+ const r = steps.next()
614
+ if (r.done) return r.value
615
+ await yieldLoop()
616
+ }
617
+ }
618
+
619
+ /** the one read, in steps: it yields between two of them, and returns the store */
620
+ function* readRawsSteps(dir: string): Generator<void, ReadAll, void> {
597
621
  const out: ReadAll = { items: [], broken: [] }
598
622
  if (!existsSync(dir)) return out
599
623
  const store = resolve(dir)
@@ -612,8 +636,10 @@ function readRaws(dir: string): ReadAll {
612
636
  }
613
637
  const moved: { id: string; stamp: string; read: Read }[] = []
614
638
  const seen = new Set<string>()
639
+ let n = 0
615
640
  for (const id of readdirSync(dir).sort()) {
616
641
  if (id.startsWith('.')) continue
642
+ if (++n % READ_STEP === 0) yield
617
643
  seen.add(id)
618
644
  const stamp = stampOf(join(dir, id))
619
645
  const held = was.get(id)
@@ -1010,6 +1036,20 @@ function watchOf(dir: string): Watched | null {
1010
1036
  }
1011
1037
  }
1012
1038
 
1039
+ /** a watched store read whole before a page asks, the loop given back between two steps: the first read after a boot
1040
+ * is the only whole one, every later one reads the items that moved */
1041
+ export async function warmStore(dir: string): Promise<void> {
1042
+ if (!existsSync(dir)) return
1043
+ const w = watchOf(dir)
1044
+ if (!w || (w.held && w.all)) return
1045
+ // what moved before the read is in it; what moves during it stays dirty, read again by the next reader
1046
+ w.dirty.clear()
1047
+ const all = await readRawsAsync(dir)
1048
+ if (w.held && w.all) return
1049
+ w.held = new Map<string, Read>([...all.items.map((x) => [x.item.id, { x }] as const), ...all.broken.map((b) => [b.id, { error: b.error }] as const)])
1050
+ w.all = all
1051
+ }
1052
+
1013
1053
  /** changes when anything the list is built from changes: watched, a count of writes; else a scan. The list's ETag */
1014
1054
  export function storeStamp(dir: string): string {
1015
1055
  if (!existsSync(dir)) return 'none'
@@ -2,7 +2,8 @@
2
2
  // render's clone in the view folder and a kept version's own files, by the facts its view record keeps, and the shots
3
3
  // folders (trailer-shots.ts). Kept on the
4
4
  // disk: the newest render of each live cut, the render an open frame note was written on, and any render seen in the
5
- // window. A file goes only when its own bytes hash to the key. The takes and footage cache is never this kind's
5
+ // window. A file goes only when its own bytes hash to the key. A trailer's `voice/` clips go up and stay on the disk:
6
+ // they are its source. The takes and footage cache is never this kind's
6
7
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
7
8
  import { basename, dirname, join, relative } from 'node:path'
8
9
  import { factOf, shaOf, shaOfKey } from '../media-store/content.ts'
@@ -13,7 +14,7 @@ import { isFrame } from './model.ts'
13
14
  import { readAllCached, storeDir } from './store.ts'
14
15
  import { cutOf, cutsOf, pngSize, stripOf, TRAILER_KIND, trailerDir, trailerIds, trailerKey, trailerStamp, videoOf, VIEW_ITEM, viewDir, viewOf, writeView, type View } from './trailer-desk.ts'
15
16
  import { noteOf } from './trailer-model.ts'
16
- import { newestShelves, shotFolders, shotRows } from './trailer-shots.ts'
17
+ import { newestShelves, shotFolders, shotRows, voiceFolders } from './trailer-shots.ts'
17
18
 
18
19
  /** a view record's name, `<trailer>--<cut>--<mtime>` */
19
20
  const BASE_RE = /^(.+?)--(.+)--(\d+)$/
@@ -53,7 +54,7 @@ async function sameAs(root: string, file: string, f: MediaFact): Promise<string
53
54
  export const trailerMedia: MediaKind = {
54
55
  kind: TRAILER_KIND,
55
56
  storeOf: (root) => (existsSync(join(root, 'trailer')) ? root : null),
56
- stamp: (root) => `${trailerStamp(root)}#${existsSync(viewDir(root)) ? readdirSync(viewDir(root)).length : 0}#shots:${shotFolders(root).map((f) => `${f.item}@${f.born}`).join(',')}`,
57
+ stamp: (root) => `${trailerStamp(root)}#${existsSync(viewDir(root)) ? readdirSync(viewDir(root)).length : 0}#shots:${shotFolders(root).map((f) => `${f.item}@${f.born}`).join(',')}#voice:${voiceFolders(root).map((f) => `${f.item}@${f.born}`).join(',')}`,
57
58
  async scan(root, o) {
58
59
  // every settled render gets its record, whether or not the page was opened since
59
60
  for (const id of trailerIds(root)) {
@@ -114,7 +115,7 @@ export const trailerMedia: MediaKind = {
114
115
  if (media.from?.video) row(join(root, media.from.video), media.video)
115
116
  if (media.from?.strip) row(join(root, media.from.strip), media.strip)
116
117
  }
117
- for (const f of shotFolders(root)) rows.push(...(await shotRows(root, f, take)))
118
+ for (const f of [...shotFolders(root), ...voiceFolders(root)]) rows.push(...(await shotRows(root, f, take)))
118
119
  return { rows, filled, left }
119
120
  },
120
121
  async holds(root) {
@@ -142,6 +143,7 @@ export const trailerMedia: MediaKind = {
142
143
  // a shots folder: the shelf of each trailer's newest build stays, any other goes once quiet, unless a note is open on its cut
143
144
  const folders = new Map(shotFolders(root).map((f) => [f.item, f]))
144
145
  const shelves = newestShelves([...folders.values()])
146
+ const voices = new Set(voiceFolders(root).map((f) => f.item))
145
147
  const cutUse = (id: string, cut: string): { open: boolean; at: number } => {
146
148
  let at = 0
147
149
  let isOpen = false
@@ -150,6 +152,7 @@ export const trailerMedia: MediaKind = {
150
152
  return { open: isOpen, at }
151
153
  }
152
154
  return (row) => {
155
+ if (voices.has(row.item)) return { pinned: true, used: undefined }
153
156
  const f = folders.get(row.item)
154
157
  if (f) {
155
158
  const u = cutUse(f.trailer, f.cut)
@@ -1,12 +1,14 @@
1
1
  // the shots folders of the trailer kind (wiki build/trailer.md, Renders in the media store): each build's shelf
2
2
  // `out/<cut>-shots/` and each kept version's `versions/<v>/shots/`. Their facts sit in the folder's own `.media.json`,
3
- // which a build's new shelf drops with the old files. The shelf of each trailer's newest build stays on the disk
3
+ // which a build's new shelf drops with the old files. The shelf of each trailer's newest build stays on the disk. A
4
+ // trailer's `voice/` folder is its source clips (paid, never rebuilt): up the same way, never purged
4
5
  import { existsSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs'
5
6
  import { join, relative } from 'node:path'
6
7
  import { factOf, mediaKey } from '../media-store/content.ts'
7
8
  import type { MediaRow } from '../media-store/kind.ts'
8
9
  import { fetchBack } from '../media-store/remote.ts'
9
10
  import { SHOT_FACTS, shotFacts } from '../trailer/shelf.ts'
11
+ import { versionOf } from '../trailer/versions.ts'
10
12
  import { TRAILER_KIND, trailerIds } from './trailer-desk.ts'
11
13
 
12
14
  const SHELF_RE = /^(.+)-shots$/
@@ -35,18 +37,33 @@ export function shotFolders(root: string): ShotFolder[] {
35
37
  const m = SHELF_RE.exec(f)
36
38
  if (m) add(join(dir, 'out', f), m[1]!, false)
37
39
  }
38
- for (const v of existsSync(join(dir, 'versions')) ? readdirSync(join(dir, 'versions')) : []) if (/^v\d+$/.test(v)) add(join(dir, 'versions', v, 'shots'), v, true)
40
+ for (const v of existsSync(join(dir, 'versions')) ? readdirSync(join(dir, 'versions')) : []) if (versionOf(v) !== null) add(join(dir, 'versions', v, 'shots'), v, true)
39
41
  }
40
42
  return out
41
43
  }
42
44
 
43
- /** a folder's rows: its facts filled while `take()` allows, written back when they moved */
45
+ /** each trailer's `voice/` folder, the clips a cut names (`voice file voice/<clip>`): its source, never a render */
46
+ export function voiceFolders(root: string): ShotFolder[] {
47
+ const out: ShotFolder[] = []
48
+ for (const id of trailerIds(root)) {
49
+ const path = join(root, 'trailer', id, 'voice')
50
+ const s = statSync(path, { throwIfNoEntry: false })
51
+ if (!s?.isDirectory()) continue
52
+ // a clip recorded again under its name moves no folder time: the newest file's does
53
+ const born = Math.max(s.mtimeMs, ...readdirSync(path).map((n) => statSync(join(path, n), { throwIfNoEntry: false })?.mtimeMs ?? 0))
54
+ out.push({ item: relative(root, path), trailer: id, cut: 'voice', version: false, born })
55
+ }
56
+ return out
57
+ }
58
+
59
+ /** a folder's rows (its own files, never a folder inside): its facts filled while `take()` allows, written back when
60
+ * they moved */
44
61
  export async function shotRows(root: string, f: ShotFolder, take: () => boolean): Promise<MediaRow[]> {
45
62
  const folder = join(root, f.item)
46
63
  const facts = shotFacts(folder)
47
64
  let moved = false
48
65
  const rows: MediaRow[] = []
49
- const names = new Set([...Object.keys(facts), ...readdirSync(folder).filter((n) => !n.startsWith('.'))])
66
+ const names = new Set([...Object.keys(facts), ...readdirSync(folder, { withFileTypes: true }).filter((d) => d.isFile() && !d.name.startsWith('.')).map((d) => d.name)])
50
67
  for (const name of [...names].sort()) {
51
68
  const size = statSync(join(folder, name), { throwIfNoEntry: false })?.size
52
69
  let fact = facts[name]
@@ -11,7 +11,7 @@ export interface Fact {
11
11
  value: string
12
12
  }
13
13
 
14
- /** a link the hub opens. `host`: a page of the tool that frames the hub (pkm-multi's admin), its url relative to it:
14
+ /** a link the hub opens. `host`: a page of the tool that frames the hub (a project's admin), its url relative to it:
15
15
  * in a frame it is posted to the host (`{ shipkit: 'open', url }`), alone it opens in a new tab */
16
16
  export interface Link {
17
17
  label: string
@@ -0,0 +1,3 @@
1
+ # Handoff: where the last session stopped
2
+
3
+ Read this FIRST, act on it, then delete what you acted on. A session that closes with work in flight writes it here, one `## YYYY-MM-DD` section per offload. A handoff with no dated section has nothing waiting. Nothing durable lives here: a rule goes to its page, a real-world act to `sk ask`.
@@ -7,19 +7,11 @@
7
7
  - `bun run hub` → the repo toolbox at http://localhost:{{PORT}}
8
8
  - `sk ci` → THE gate: run it to check your work, never the parts
9
9
 
10
- This folder is the project's internal wiki and its SPEC. Update the page
11
- BEFORE the change it describes.
10
+ This folder is the project's internal wiki and its SPEC. Update the page BEFORE the change it describes.
12
11
 
13
- **Always loaded every session:**
12
+ **Always loaded every session**: the `@` lines here. A page that does not load lives in a topical folder whose own `index.md` lists it on one line, and that index gets its `@<folder>/index.md` line here.{{CLI_INCLUDE}}
14
13
 
15
- @coding.md{{CLI_INCLUDE}}
16
-
17
- Read the matching page before touching a surface:
18
-
19
- | read when touching… | page |
14
+ | read when… | page |
20
15
  |---|---|
21
- | any source file | → agent/coding.md |
16
+ | a session starts: work offloaded at the last close, read FIRST | → agent/handoff.md |
22
17
  | recent changes and why | → agent/changelog.md |{{CLI_ROW}}
23
-
24
- Grow this table: a subsystem, a service, a runbook each earn their own page,
25
- cross-linked from here.
@@ -38,15 +38,16 @@ export type ScaffoldOpts = {
38
38
  projectCli?: boolean
39
39
  }
40
40
 
41
- /** every dep the house toolchain needs for the scripts below to run. The
42
- * linter and the formatter are bun's own, declared in bunfig.toml */
41
+ /** every dep the house toolchain needs. The type checker, the linter and
42
+ * the formatter are bun's own; typescript serves the editor and the gate's
43
+ * tsc fallback on a bun with no `bun check` */
43
44
  export const TOOLCHAIN = ['typescript', '@types/bun'] as const
44
45
 
45
46
  /** script bodies for a fresh repo whose only source dir is src/. A stack
46
47
  * scaffold (vite, hono) adds dev/build on top. No `lint` or `fmt`: a script
47
48
  * of either name would shadow `bun lint` and `bun fmt` */
48
49
  const SCRIPTS: Record<string, string> = {
49
- typecheck: 'tsc --noEmit',
50
+ typecheck: 'bun check',
50
51
  }
51
52
 
52
53
  /** repo-owned ignore lines, written OUTSIDE rule SK004's managed block so its
@@ -162,8 +163,8 @@ function writeHouseFiles(write: (rel: string, body: string) => void, vars: Recor
162
163
  // agent/index.md (rule SK003) needs the file to exist, and a repo with no
163
164
  // CLAUDE.md at all still gets a place for its docs to live
164
165
  write('agent/index.md', template('agent-index.md', vars))
165
- write('agent/coding.md', template('agent-coding.md', vars))
166
166
  write('agent/changelog.md', template('agent-changelog.md', vars))
167
+ write('agent/handoff.md', template('agent-handoff.md', vars))
167
168
  // gitignored by policy, so it never ships: it exists so an agent hitting
168
169
  // friction with the toolchain finds the place to write it down
169
170
  write('.shipkit/reflections/README.md', REFLECTIONS_README)
@@ -1,6 +1,6 @@
1
1
  // a repo's review or trailer page alone, for another tool to frame (wiki build/shipkit/review.md, The review page):
2
2
  // `<base>/embed/?page=review` serves the same app bundled with RELATIVE asset paths, so the page and every request it
3
- // makes work under any prefix a proxy puts in front of the hub (pkm-multi's admin frames it under its own origin). The
3
+ // makes work under any prefix a proxy puts in front of the hub (a project's admin frames it under its own origin). The
4
4
  // bundle is made once a process, in memory
5
5
  import { join } from 'node:path'
6
6
 
@@ -1,4 +1,4 @@
1
- // Collection views: the item card (asks · creds · posts), and the health/status card with the streaming
1
+ // Collection views: the item card (asks · creds), and the health/status card with the streaming
2
2
  // check runner. Every verb posts to /api/act/* and lands in a git-tracked
3
3
  // truth file; the truth chip names the file the item IS (on disagreement
4
4
  // the file wins).
@@ -28,8 +28,6 @@ export const ColCard = observer(({ app, col, id }: { app: RepoSt; col: string; i
28
28
  const i = c.find(col, id)
29
29
  if (i == null) return <div className="ph">item vanished — the truth file moved on</div>
30
30
  const askFile = col === 'asks' ? id.replace(/^ask:/, '') : null
31
- const postM = col === 'posts' ? id.match(/^post:([^/]+)\/(.+?):(pick|topost|invalid|posted|rejected)$/) : null
32
- const postFile = (i.file ?? '').split('/').pop() ?? ''
33
31
  if (col === 'creds') {
34
32
  // no remark box, no generic dump — a cred has no truth file; the
35
33
  // copy block + steps only matter while it is MISSING
@@ -70,29 +68,17 @@ export const ColCard = observer(({ app, col, id }: { app: RepoSt; col: string; i
70
68
  ) : null}
71
69
  {i.artifact?.url != null ? <div className="row"><a href={i.artifact.url} target="_blank" rel="noreferrer">mint ↗</a></div> : null}
72
70
  {i.artifact?.steps != null ? <div className="row"><div>{i.artifact.steps.map((s, n) => <span key={n}>{n + 1}. {s}<br /></span>)}</div></div> : null}
73
- {postM?.[3] === 'pick' && i.candidates != null ? i.candidates.map((cd) => (
74
- <div className="cand" key={cd.id}>
75
- <div className="row"><b>{cd.label}</b><button onClick={() => void c.postPick(postM[1]!, cd.id)}>pick</button></div>
76
- <div className="candhint">{cd.hint ?? ''}</div>
77
- </div>
78
- )) : null}
79
- {postM?.[3] === 'topost' ? (
80
- <div className="row">
81
- <input placeholder="posted URL = proof" value={c.proofDraft} onChange={(e) => runInAction(() => { c.proofDraft = e.target.value })} />
82
- <button onClick={() => void c.postPosted(postM[1]!, postFile)}>posted ✓</button>
83
- </div>
84
- ) : null}
85
71
  {askFile != null && i.severity != null ? (
86
72
  <div className="row">
87
73
  <input placeholder="proof URL (optional)" value={c.proofDraft} onChange={(e) => runInAction(() => { c.proofDraft = e.target.value })} />
88
74
  <button onClick={() => void c.askDone(askFile)}>done ✓</button>
89
75
  </div>
90
76
  ) : null}
91
- {askFile != null || postM != null ? (
77
+ {askFile != null ? (
92
78
  <div className="row">
93
79
  <input placeholder="remark → lands in the file, agents read it" value={c.remarkDraft}
94
80
  onChange={(e) => runInAction(() => { c.remarkDraft = e.target.value })} />
95
- <button className="ghost" onClick={() => void c.remark(askFile != null ? { kind: 'ask', file: askFile } : { kind: 'post', channel: postM![1], file: postFile })}>remark</button>
81
+ <button className="ghost" onClick={() => void c.remark({ kind: 'ask', file: askFile })}>remark</button>
96
82
  </div>
97
83
  ) : null}
98
84
  {c.actErr !== '' ? <div className="err">✗ {c.actErr}</div> : null}
@@ -15,6 +15,7 @@ import type { Resource } from './hub-types.ts'
15
15
  import { sectionLabel } from './keys.ts'
16
16
  import type { RepoSt } from './repo-st.ts'
17
17
  import { TimeAgo } from './time-ago.tsx'
18
+ import { Caret } from './icons.tsx'
18
19
 
19
20
  const emptyWords = (app: RepoSt): string => (app.filter === 'red' ? 'no reds here' : app.filter === 'needs' ? 'nothing here needs you' : app.query.trim() !== '' ? 'nothing matches the filter' : 'nothing here yet')
20
21
 
@@ -42,7 +43,7 @@ const Group = observer(<K extends string>({ app, col, g, span, row }: { app: Rep
42
43
  return (
43
44
  <tbody className="ctgroup">
44
45
  <tr className={`ctgrp g-${g.key}`} data-k={g.key} onClick={() => app.cols.toggleGroup(key, g.foldedByDefault)}>
45
- <td colSpan={span}><span className="ctcaret">{folded ? '▸' : '▾'}</span>{g.label}</td>
46
+ <td colSpan={span}><span className="ctcaret"><Caret open={!folded} /></span>{g.label}</td>
46
47
  </tr>
47
48
  {folded ? null : g.rows.map(row)}
48
49
  </tbody>
@@ -263,19 +263,6 @@ export class ColsSvc {
263
263
  const url = this.proofDraft.trim()
264
264
  return url !== '' ? this.act('ask-proof', { file, url }) : this.act('ask-done', { file })
265
265
  }
266
- postPick(channel: string, file: string): Promise<boolean> {
267
- return this.act('post-pick', { channel, file })
268
- }
269
- async postPosted(channel: string, file: string): Promise<boolean> {
270
- const url = this.proofDraft.trim()
271
- if (url === '') {
272
- this.actErr = 'paste the posted URL first — the proof is the point'
273
- return false
274
- }
275
- const ok = await this.act('post-posted', { channel, file, url })
276
- if (ok) runInAction(() => { this.proofDraft = '' })
277
- return ok
278
- }
279
266
  async remark(body: Record<string, unknown>): Promise<void> {
280
267
  const text = this.remarkDraft.trim()
281
268
  if (text === '') return
@@ -97,7 +97,7 @@ export function lineWords(view: HouseView | null, now: number): string {
97
97
  /** a pill of the dock's header: a word or two in a dim box, its hover the
98
98
  * whole story. The last run adds its repo, its verdict and its age */
99
99
  export type DockPill = {
100
- key: 'state' | 'queued' | 'held' | 'last' | 'settling' | 'window'
100
+ key: 'state' | 'queued' | `held:${number}` | 'last' | 'settling' | 'window'
101
101
  tone: 'dim' | 'accent' | 'warn'
102
102
  text: string
103
103
  title: string
@@ -139,10 +139,12 @@ export function dockPills(view: HouseView | null, now: number, size: DockSize):
139
139
  : { key: 'state', tone: 'dim', text: 'idle', title: flight }]
140
140
  if (queued > 0) out.push({ key: 'queued', tone: 'dim', text: `${queued} queued`, title: flight })
141
141
  const settling: string[] = []
142
+ // a loaded machine holds several lines at once: each pill keyed by its place, never by its text, which ticks
143
+ let held = 0
142
144
  for (const line of view.held ?? []) {
143
145
  const m = line.match(SETTLING)
144
146
  if (m != null) settling.push(`${m[1]} ${m[2]}`)
145
- else out.push({ key: 'held', tone: 'warn', text: line.replace(/ on \d+ cores$/, ''), title: line })
147
+ else out.push({ key: `held:${held++}`, tone: 'warn', text: line.replace(/ on \d+ cores$/, ''), title: line })
146
148
  }
147
149
  if (last != null) {
148
150
  const v = PILL_MARK[last.bar.status]
@@ -13,6 +13,7 @@ import { CycleButton } from './cycle-button.tsx'
13
13
  import { DOCK_KEY } from './keys.ts'
14
14
  import { DOCK_SIZES, SLIM_WINDOW_MS, windowWords, type DockPill } from './dock-st.ts'
15
15
  import { PillRow } from './pill-row.tsx'
16
+ import { ListFoot } from './project-list.tsx'
16
17
  import { TimelineChart } from './timeline-chart.tsx'
17
18
  import type { PlacedGroup } from './timeline-geometry.ts'
18
19
 
@@ -91,6 +92,7 @@ export const Dock = observer(({ app }: { app: HomeSt }) => {
91
92
  <CycleButton options={DOCK_SIZES} value={d.size} onChange={(s) => d.setSize(s)} shortcut={DOCK_KEY} title={DOCK_HELP} />
92
93
  <PillRow items={d.pills.map((p) => ({ key: p.key, title: p.title, node: <PillFace app={app} p={p} /> }))} />
93
94
  {d.error !== '' ? <span className="warnline">{d.error}</span> : null}
95
+ <ListFoot app={app} />
94
96
  <CopyUrl />
95
97
  </div>
96
98
  {d.size === 'line' ? null : <div className="dbody">
@@ -0,0 +1,35 @@
1
+ // the repo pages' frames kept alive (wiki build/shipkit/project-pages.md, Kept frames): the last few opened, across
2
+ // repos, newest first. A switch back to one is a show, never a load; one past the cap unloads the oldest, and of the
3
+ // hidden ones one 3D page at most: its scene holds gigabytes while hidden. A node of the home (home-st.ts)
4
+ import { makeAutoObservable } from 'mobx'
5
+
6
+ export const PAGE_FRAMES_KEPT = 3
7
+ /** hidden 3D pages kept, the shown one aside */
8
+ export const PAGE_GL_HIDDEN = 1
9
+
10
+ export type FrameRef = { repo: string; id: string; gl?: true }
11
+
12
+ export class FrameCache {
13
+ /** newest first, at most PAGE_FRAMES_KEPT */
14
+ kept: FrameRef[] = []
15
+
16
+ constructor(private readonly cap = PAGE_FRAMES_KEPT) {
17
+ makeAutoObservable(this)
18
+ }
19
+
20
+ /** this page opened: it is the newest; a hidden 3D page past PAGE_GL_HIDDEN goes, then the oldest past the cap */
21
+ touch(repo: string, id: string, gl = false): void {
22
+ let hiddenGl = 0
23
+ const rest = this.kept.filter((f) => (f.repo !== repo || f.id !== id) && (f.gl !== true || ++hiddenGl <= PAGE_GL_HIDDEN))
24
+ this.kept = [{ repo, id, ...(gl ? { gl: true as const } : {}) }, ...rest].slice(0, this.cap)
25
+ }
26
+
27
+ /** a repo's kept frames in the order they stand in the page: by id, never by age, so a switch never moves one (a
28
+ * moved iframe loads again) */
29
+ of(repo: string): string[] {
30
+ return this.kept
31
+ .filter((f) => f.repo === repo)
32
+ .map((f) => f.id)
33
+ .sort()
34
+ }
35
+ }