rvlib-shipkit 2.17.0 → 2.18.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 (52) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/src/checks/SK039-vscode-watch-generated.check.ts +119 -0
  4. package/src/cli/cmd_Review.ts +4 -0
  5. package/src/core/discover-checks.ts +18 -5
  6. package/src/home/beat.ts +30 -0
  7. package/src/home/home-paths.ts +1 -0
  8. package/src/home/pm.ts +3 -1
  9. package/src/home/run-daemon.ts +5 -2
  10. package/src/home/run-web.ts +4 -2
  11. package/src/home/supervise.ts +18 -1
  12. package/src/review/model.ts +11 -0
  13. package/src/scaffold/files/vscode-settings.json +9 -1
  14. package/src/serve/hub-app/auto-text.tsx +6 -1
  15. package/src/serve/hub-app/hub-app.tsx +28 -2
  16. package/src/serve/hub-app/icons.tsx +1 -0
  17. package/src/serve/hub-app/identities-view.tsx +1 -1
  18. package/src/serve/hub-app/kept-cols.tsx +47 -8
  19. package/src/serve/hub-app/layout-st.ts +37 -3
  20. package/src/serve/hub-app/review/review-kit.ts +8 -0
  21. package/src/serve/hub-app/review/review-page.tsx +1 -1
  22. package/src/serve/hub-app/review/review-st.ts +38 -6
  23. package/src/serve/hub-app/review/review-thread.tsx +2 -1
  24. package/src/serve/hub-app/review/review-views.tsx +91 -20
  25. package/src/serve/hub-app/review/thread-st.ts +23 -1
  26. package/src/serve/hub-app/review/trailer-page.tsx +1 -1
  27. package/src/serve/hub-app/review.css +24 -0
  28. package/src/serve/hub-app/social/comms-page.tsx +1 -1
  29. package/src/serve/hub-app/social/kit.tsx +3 -3
  30. package/src/serve/hub-app/social/post-card.tsx +2 -1
  31. package/src/serve/hub-app/social/social-page.tsx +1 -1
  32. package/src/serve/hub-app/social.css +1 -1
  33. package/src/serve/hub-app/stores/stores-page.tsx +5 -4
  34. package/src/serve/hub-app/veille/veille-page.tsx +3 -2
  35. package/src/serve/serve-hub.ts +4 -4
  36. package/src/serve/warm-cell.ts +63 -1
  37. package/src/shot/box.ts +32 -9
  38. package/src/shot/browser-slot.ts +8 -1
  39. package/src/shot/client.ts +9 -4
  40. package/src/shot/clip-encoder.ts +5 -2
  41. package/src/shot/job-store.ts +167 -0
  42. package/src/shot/shooter.ts +31 -4
  43. package/src/social/load.ts +3 -1
  44. package/src/suite/select.ts +32 -6
  45. package/src/trailer/grammar.ts +2 -0
  46. package/src/trailer/graph.ts +9 -3
  47. package/src/trailer/sound/presets.ts +3 -3
  48. package/src/trailer/sound/run.ts +22 -14
  49. package/src/trailer/titles.ts +1 -1
  50. package/src/wiki/lint-md.ts +4 -2
  51. package/src/wiki/run-wiki.ts +11 -5
  52. package/src/wiki/scan-md.ts +3 -1
@@ -54,6 +54,14 @@ export interface StitchInput {
54
54
  }
55
55
 
56
56
  const n3 = (x: number): string => (+x.toFixed(4)).toString()
57
+
58
+ /** a shot's slow push in, from whole to `push` over its `frames`, centred: sampled at sub pixel positions (perspective,
59
+ * cubic), where zoompan's crop steps by whole pixels, so a slow push held still for frames, then jumped */
60
+ export function pushFilter(push: number, frames: number, skip: number, [W, H]: readonly [number, number]): string {
61
+ const z = `(1+${n3(push - 1)}*(in+${skip})/${frames})`
62
+ const [x0, x1, y0, y1] = [`W/2*(1-1/${z})`, `W/2*(1+1/${z})`, `H/2*(1-1/${z})`, `H/2*(1+1/${z})`]
63
+ return `,scale=${W}:${H},perspective=x0='${x0}':y0='${y0}':x1='${x1}':y1='${y0}':x2='${x0}':y2='${y1}':x3='${x1}':y3='${y1}':interpolation=cubic:eval=frame`
64
+ }
57
65
  const even = (x: number): number => 2 * Math.round(x / 2)
58
66
 
59
67
  /** the grid's margin round the cells and the gap between them, and the corners' radius, in frame heights */
@@ -312,9 +320,7 @@ export function pieceArgs(a: Pick<StitchInput, 't' | 'sources' | 'titles' | 'loo
312
320
  const frames = Math.min(spans[i]!.b, p.to) - spans[i]!.a - skip
313
321
  count[i] = frames
314
322
  const push = s.push && s.push > 1 ? s.push : null
315
- const pushF = push
316
- ? `,scale=${W * 2}:${H * 2},zoompan=z='1+${n3(push - 1)}*(on+${skip})/${Math.round(len * fps)}':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d=1:s=${W}x${H}:fps=${fps}`
317
- : ''
323
+ const pushF = push ? pushFilter(push, Math.round(len * fps), skip, [W, H]) : ''
318
324
  const [ax, ay] = s.frameAt ?? [0.5, 0.5]
319
325
  const cropF = s.frame && s.frame > 1 ? `crop=w='2*trunc(iw/${n3(s.frame)}/2)':h='2*trunc(ih/${n3(s.frame)}/2)':x='min(max(iw*${n3(ax)}-ow/2,0),iw-ow)':y='min(max(ih*${n3(ay)}-oh/2,0),ih-oh)'` : null
320
326
  const frameF = cropF ? `,${cropF},scale=${W}:${H}` : ''
@@ -53,14 +53,14 @@ export function presetOf(a: SoundAsk, brand: TrailerSoundInput | undefined): Sou
53
53
  if (a.kind === 'voice') {
54
54
  const voice = voiceOf(brand, a.by)
55
55
  const v = voiceFlags(voice)
56
- return { cmd: ['sk sound voice', q(a.text), ...v.flags, ...('eleven' in voice ? [] : comfy), ...seed, '--out {out}'].join(' '), ...(v.reads.length ? { reads: v.reads } : {}) }
56
+ return { cmd: ['sk sound voice', q(a.text), ...v.flags, ...('eleven' in voice ? [] : comfy), ...seed, '--out {out}'].join(' '), ...(v.reads.length ? { reads: v.reads } : {}), remote: true }
57
57
  }
58
- if (a.kind === 'sfx') return { cmd: ['sk sound sfx', q(a.text), '--seconds', num(a.for ?? SFX_SECONDS), ...seed, ...(a.hit ? ['--hit'] : []), ...comfy, '--out {out}'].join(' ') }
58
+ if (a.kind === 'sfx') return { cmd: ['sk sound sfx', q(a.text), '--seconds', num(a.for ?? SFX_SECONDS), ...seed, ...(a.hit ? ['--hit'] : []), ...comfy, '--out {out}'].join(' '), remote: true }
59
59
  // the soundfont and fluidsynth are in the words as a comment: another one renders the file again
60
60
  if (isMidi(a.text)) return { cmd: `sk sound midi ${q(a.text)} --out {out} # fluid ${new Bun.CryptoHasher('sha1').update(fluidIdentity()).digest('hex').slice(0, 12)}`, reads: [a.text] }
61
61
  const engine = a.by ?? 'stable-audio'
62
62
  if (!(MUSIC_ENGINES as readonly string[]).includes(engine)) throw new Error(`music by ${engine}: the engines are ${MUSIC_ENGINES.join(', ')}`)
63
- return { cmd: ['sk sound music', q(a.text), '--engine', engine, '--seconds', num(a.for ?? musicSeconds(a.seconds)), ...seed, ...comfy, '--out {out}'].join(' ') }
63
+ return { cmd: ['sk sound music', q(a.text), '--engine', engine, '--seconds', num(a.for ?? musicSeconds(a.seconds)), ...seed, ...comfy, '--out {out}'].join(' '), remote: true }
64
64
  }
65
65
 
66
66
  /** a paid run: the characters its line costs, else null */
@@ -1,8 +1,8 @@
1
1
  // THE one way a trailer makes a sound: a command that writes `{out}`, cached on its words and the content of each file
2
2
  // it reads. A voice, an sfx, a music bed and a MIDI file are presets of it (presets.ts). The cache is
3
3
  // `.shipkit/cache/sound/<key>.wav` with `<key>.json` (the command, its measures) and `<key>.png` (its waveform), out of
4
- // the trailer's cache so a trailer prune never deletes a paid line. One sound is made at a time, under nice, never
5
- // while the machine's load is over 16
4
+ // the trailer's cache so a trailer prune never deletes a paid line. One sound is made at a time, under nice, and one
5
+ // that loads this machine (not `remote`) never starts while its load is over 16
6
6
  import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs'
7
7
  import { loadavg } from 'node:os'
8
8
  import { join, relative, resolve } from 'node:path'
@@ -55,7 +55,7 @@ let queue: Promise<unknown> = Promise.resolve()
55
55
  export function soundRun(r: SoundRun, p: RunPlace, say: (line: string) => void): Promise<{ file: string; made: boolean }> {
56
56
  const spec = runSpec(r, p)
57
57
  if (existsSync(spec.file)) return Promise.resolve({ file: spec.file, made: false })
58
- const job = queue.then(() => make(spec, p.root, say))
58
+ const job = queue.then(() => make(spec, p.root, r.remote === true, say))
59
59
  queue = job.catch(() => undefined)
60
60
  return job
61
61
  }
@@ -105,12 +105,12 @@ async function lockSound(spec: ReturnType<typeof runSpec>, say: (line: string) =
105
105
  }
106
106
  }
107
107
 
108
- async function make(spec: ReturnType<typeof runSpec>, root: string, say: (line: string) => void): Promise<{ file: string; made: boolean }> {
108
+ async function make(spec: ReturnType<typeof runSpec>, root: string, remote: boolean, say: (line: string) => void): Promise<{ file: string; made: boolean }> {
109
109
  mkdirSync(soundCache(root), { recursive: true })
110
110
  const unlock = await lockSound(spec, say)
111
111
  if (!unlock) return { file: spec.file, made: false }
112
112
  try {
113
- return await makeLocked(spec, root, say)
113
+ return await makeLocked(spec, root, remote, say)
114
114
  } finally {
115
115
  unlock()
116
116
  }
@@ -134,27 +134,35 @@ export function killGroup(pid: number): void {
134
134
  setTimeout(() => kill('SIGKILL'), 5000).unref()
135
135
  }
136
136
 
137
- const prepared = new Map<string, Promise<void>>()
137
+ const swept = new Set<string>()
138
+ let calm: Promise<void> | null = null
138
139
 
139
- /** once per process and repo, before the first sound it makes: the folders killed makes left swept, then a wait while
140
- * the machine's load is over 16 */
141
- async function prepare(root: string, say: (line: string) => void): Promise<void> {
140
+ /** once per process and repo, before the first sound it makes: the folders killed makes left swept */
141
+ function sweep(root: string): void {
142
+ if (swept.has(root)) return
143
+ swept.add(root)
142
144
  const cache = soundCache(root)
143
145
  for (const e of readdirSync(cache)) {
144
146
  const f = join(cache, e)
145
147
  if (e.startsWith('.make-') && Date.now() - statSync(f).mtimeMs > STALE_MAKE_MS) rmSync(f, { recursive: true, force: true })
146
148
  }
149
+ }
150
+
151
+ /** once per process, before the first sound that loads this machine: a wait while its load is over 16 */
152
+ async function waitCalm(say: (line: string) => void): Promise<void> {
147
153
  for (let waited = 0; loadavg()[0]! > 16; waited += 5) {
148
- if (waited === 0) say(`sound: the load is ${loadavg()[0]!.toFixed(1)}, over 16: waiting before the first sound`)
154
+ if (waited === 0) say(`sound: the load is ${loadavg()[0]!.toFixed(1)}, over 16: waiting before the first local sound`)
149
155
  if (waited > 600) throw new Error('sound: the load stayed over 16 for 10 minutes')
150
156
  await Bun.sleep(5000)
151
157
  }
152
158
  }
153
159
 
154
- async function makeLocked(spec: ReturnType<typeof runSpec>, root: string, say: (line: string) => void): Promise<{ file: string; made: boolean }> {
155
- let ready = prepared.get(root)
156
- if (!ready) prepared.set(root, (ready = prepare(root, say)))
157
- await ready
160
+ async function makeLocked(spec: ReturnType<typeof runSpec>, root: string, remote: boolean, say: (line: string) => void): Promise<{ file: string; made: boolean }> {
161
+ sweep(root)
162
+ if (!remote) {
163
+ calm ??= waitCalm(say)
164
+ await calm
165
+ }
158
166
  const dir = mkdtempSync(join(soundCache(root), '.make-'))
159
167
  try {
160
168
  const out = join(dir, 'out.wav')
@@ -401,7 +401,7 @@ function drawInto(g: SKRSContext2D, d: TitleDraw, [W, H]: readonly [number, numb
401
401
  // a strong display line in the upper third: light words in a thick edge outline, an accent stroke inside it
402
402
  const p = own({ ...base((d.fx?.size ?? 112) * k, 900), outline: { w: 22 * k, color: look.edge }, inner: { w: 8 * k, color: look.accent }, shadow: { blur: 26 * k, dy: 10 * k, color: alpha(look.edge, 0.55) } })
403
403
  setFace(g, p)
404
- const lines = wrap(g, [first, ...more].join(' '), W * 0.82)
404
+ const lines = wrap(g, text, W * 0.82)
405
405
  lines.forEach((l, i) => ink(cx, g, p, l, W / 2, H * 0.26 + (i - (lines.length - 1) / 2) * p.px * 1.12))
406
406
  } else if (style === 'line') {
407
407
  // a tagline: light words centred low on a soft dark band, no plate, the frame stays the picture
@@ -12,9 +12,11 @@ export type MdLintReport = {
12
12
  ok: boolean
13
13
  }
14
14
 
15
- export function lintMd(cfg: ScanMdConfig): MdLintReport {
15
+ /** `listedElsewhere`: pages another wiki's index lists (scan-root relative), never an orphan here */
16
+ export function lintMd(cfg: ScanMdConfig & { listedElsewhere?: string[] }): MdLintReport {
16
17
  const scan = scanMd(cfg)
17
- const orphans = scan.index == null ? [] : scan.graph.nodes.filter((n) => n.depth == null).map((n) => n.id)
18
+ const elsewhere = new Set(cfg.listedElsewhere ?? [])
19
+ const orphans = scan.index == null ? [] : scan.graph.nodes.filter((n) => n.depth == null && !elsewhere.has(n.id)).map((n) => n.id)
18
20
  return {
19
21
  index: scan.index,
20
22
  files: scan.graph.nodes.length,
@@ -3,7 +3,7 @@
3
3
  // clipanion owns the option parsing.
4
4
  import { existsSync } from 'fs'
5
5
  import { basename, join, relative, resolve } from 'path'
6
- import { agentDirAt } from '../core/agent-dir-at.ts'
6
+ import { agentDirAt, contributionFileAt } from '../core/agent-dir-at.ts'
7
7
  import { lintMd } from './lint-md.ts'
8
8
  import { scanMdGraph } from './scan-md.ts'
9
9
  import { serveMdGraph } from './serve-graph.ts'
@@ -11,6 +11,8 @@ import { serveMdGraph } from './serve-graph.ts'
11
11
  export type WikiScanOpts = {
12
12
  /** default: the repo's wiki, as the hub mounts it (`wiki/`, else the agent folder, else the cwd) */
13
13
  root?: string
14
+ /** the repo the command runs in, default the process's cwd */
15
+ cwd?: string
14
16
  index?: string
15
17
  skip?: string
16
18
  /** where the verdict goes. The command passes its own stream, so the
@@ -27,7 +29,7 @@ export function defaultWikiRoot(cwd: string): string {
27
29
  }
28
30
 
29
31
  const scanConfig = (o: WikiScanOpts): { root: string; index?: string; skipDirs?: string[] } => ({
30
- root: resolve(process.cwd(), o.root ?? defaultWikiRoot(process.cwd())),
32
+ root: resolve(o.cwd ?? process.cwd(), o.root ?? defaultWikiRoot(o.cwd ?? process.cwd())),
31
33
  index: o.index,
32
34
  skipDirs: o.skip?.split(',').filter(Boolean),
33
35
  })
@@ -35,8 +37,9 @@ const scanConfig = (o: WikiScanOpts): { root: string; index?: string; skipDirs?:
35
37
  export async function runWikiServe(o: WikiScanOpts & { port: number; title?: string }): Promise<number> {
36
38
  const say = o.print ?? console.log
37
39
  const cfg = scanConfig(o)
38
- const rel = relative(process.cwd(), cfg.root)
39
- const title = o.title ?? (rel === '' ? basename(cfg.root) : `${basename(process.cwd())} ${rel}`)
40
+ const cwd = o.cwd ?? process.cwd()
41
+ const rel = relative(cwd, cfg.root)
42
+ const title = o.title ?? (rel === '' ? basename(cfg.root) : `${basename(cwd)} ${rel}`)
40
43
  try {
41
44
  serveMdGraph({ port: o.port, title, root: cfg.root, load: () => scanMdGraph(cfg) })
42
45
  say(`wiki graph → http://localhost:${o.port} (open in browser, or VSCode "Simple Browser: Show")`)
@@ -55,7 +58,10 @@ export async function runWikiServe(o: WikiScanOpts & { port: number; title?: str
55
58
  export function runWikiLint(o: WikiScanOpts): number {
56
59
  const say = o.print ?? console.log
57
60
  const cfg = scanConfig(o)
58
- const r = lintMd(cfg)
61
+ // the global contribution is listed by the house index (SK033), never by agent/'s own
62
+ const cwd = o.cwd ?? process.cwd()
63
+ const contribution = relative(cfg.root, resolve(cwd, contributionFileAt(cwd)))
64
+ const r = lintMd({ ...cfg, listedElsewhere: contribution.startsWith('..') ? [] : [contribution] })
59
65
  if (r.index == null) {
60
66
  say(o.index != null
61
67
  ? `FAIL entrypoint '${o.index}' not found in ${cfg.root}`
@@ -61,7 +61,9 @@ function scanMdNow(cfg: ScanMdConfig): MdScan {
61
61
  const walk = (rel: string) => {
62
62
  for (const e of readdirSync(join(cfg.root, rel))) {
63
63
  const r = rel === '' ? e : `${rel}/${e}`
64
- if (statSync(join(cfg.root, r)).isDirectory()) {
64
+ const st = statSync(join(cfg.root, r), { throwIfNoEntry: false })
65
+ if (st == null) continue // a link to nothing (a deploy stage's gone target)
66
+ if (st.isDirectory()) {
65
67
  if (!skip.has(e) && !e.startsWith('.') && !vendored.has(join(cfg.root, r))) walk(r)
66
68
  } else if (e.endsWith('.md')) files.push(r)
67
69
  }