rvlib-shipkit 2.22.1 → 2.24.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 (139) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/render.ts +28 -14
  4. package/src/agent-time/report.ts +46 -25
  5. package/src/agent-time/store.ts +30 -10
  6. package/src/agent-time/timeline.ts +43 -15
  7. package/src/annex/annex.ts +3 -0
  8. package/src/annex/born.ts +464 -0
  9. package/src/annex/flush.ts +46 -0
  10. package/src/annex/offload.ts +171 -38
  11. package/src/annex/snapshots.ts +53 -0
  12. package/src/annex/tidy.ts +368 -0
  13. package/src/asks/asks-queue.ts +32 -11
  14. package/src/checks/SK041-annex-links.check.ts +4 -2
  15. package/src/checks/SK043-scratch-on-the-mac.check.ts +45 -0
  16. package/src/checks/SK044-behind-upstream.check.ts +38 -0
  17. package/src/cli/cmd_Annex.ts +60 -9
  18. package/src/cli/cmd_Asks.ts +2 -0
  19. package/src/cli/cmd_Backup.ts +7 -5
  20. package/src/cli/cmd_Bump.ts +1 -0
  21. package/src/cli/cmd_Capacity.ts +26 -0
  22. package/src/cli/cmd_Check.ts +1 -0
  23. package/src/cli/cmd_Checks.ts +1 -0
  24. package/src/cli/cmd_Ci.ts +1 -0
  25. package/src/cli/cmd_Commands.ts +50 -14
  26. package/src/cli/cmd_Home.ts +0 -1
  27. package/src/cli/cmd_Hooks.ts +1 -0
  28. package/src/cli/cmd_Mv.ts +1 -0
  29. package/src/cli/cmd_Rec.ts +17 -7
  30. package/src/cli/cmd_Reflect.ts +1 -0
  31. package/src/cli/cmd_Releases.ts +1 -0
  32. package/src/cli/cmd_Review.ts +124 -17
  33. package/src/cli/cmd_Secret.ts +41 -2
  34. package/src/cli/cmd_Shot.ts +1 -0
  35. package/src/cli/cmd_Status.ts +1 -0
  36. package/src/cli/cmd_Time.ts +3 -1
  37. package/src/cli/cmd_Tmp.ts +82 -0
  38. package/src/cli/cmd_Wiki.ts +1 -0
  39. package/src/cli/registry.ts +13 -1
  40. package/src/collections/pings.ts +1 -1
  41. package/src/core/capacity.ts +71 -0
  42. package/src/core/check-runner.ts +86 -15
  43. package/src/core/machine-db.ts +8 -0
  44. package/src/core/motherhome.ts +67 -9
  45. package/src/core/slots.ts +49 -12
  46. package/src/core/trace-audit.ts +4 -1
  47. package/src/drill/run.ts +5 -2
  48. package/src/home/daemon-jobs.ts +10 -3
  49. package/src/home/global-units.ts +3 -0
  50. package/src/home/gui-app/ShipkitGui.swift +1 -0
  51. package/src/home/home-launchd.ts +11 -3
  52. package/src/home/home-routes.ts +11 -4
  53. package/src/home/machine-host.ts +65 -0
  54. package/src/home/machine-stores.ts +30 -4
  55. package/src/home/machine-temp.ts +493 -0
  56. package/src/home/other-macs.ts +74 -0
  57. package/src/home/pm.ts +4 -1
  58. package/src/home/run-daemon.ts +10 -2
  59. package/src/home/run-pm.ts +1 -0
  60. package/src/home/serve-web.ts +2 -2
  61. package/src/home/via-hub.ts +6 -1
  62. package/src/identities/identities.ts +92 -24
  63. package/src/init-repo.ts +7 -3
  64. package/src/ledger/ledger.ts +6 -0
  65. package/src/ledger/store.ts +6 -0
  66. package/src/media-store/backup/keys.ts +21 -6
  67. package/src/media-store/backup/manifest.ts +52 -11
  68. package/src/media-store/backup/restore.ts +17 -10
  69. package/src/media-store/backup/run.ts +5 -2
  70. package/src/media-store/backup/sources.ts +2 -1
  71. package/src/media-store/daemon.ts +2 -2
  72. package/src/media-store/purge.ts +4 -0
  73. package/src/mv/mv-md.ts +121 -42
  74. package/src/recordings/load.ts +3 -3
  75. package/src/recordings/model.ts +7 -0
  76. package/src/recordings/open.ts +12 -0
  77. package/src/recordings/presets.ts +12 -5
  78. package/src/recordings/recorder-app/Capture.swift +34 -5
  79. package/src/recordings/recorder-app/Clip.swift +126 -17
  80. package/src/recordings/recorder-app/Editor.swift +177 -7
  81. package/src/recordings/recorder-app/Hud.swift +189 -0
  82. package/src/recordings/recorder-app/Tray.swift +179 -36
  83. package/src/recordings/recorder-app/icon.svg +16 -0
  84. package/src/recordings/recorder-app/main.swift +349 -18
  85. package/src/recordings/recorder-app.ts +8 -4
  86. package/src/recordings/recorder.shipkit.ts +2 -1
  87. package/src/recordings/routes.ts +52 -6
  88. package/src/recordings/run-recorder.ts +2 -1
  89. package/src/recordings/share.ts +27 -0
  90. package/src/recordings/take.ts +36 -4
  91. package/src/recordings/view.ts +11 -0
  92. package/src/reflect/transcript.ts +56 -11
  93. package/src/releases/from-card.ts +45 -3
  94. package/src/releases/model.ts +6 -0
  95. package/src/releases/store.ts +8 -1
  96. package/src/repo-config.ts +14 -4
  97. package/src/review/cells.ts +24 -3
  98. package/src/review/format.ts +33 -9
  99. package/src/review/media-kind.ts +14 -11
  100. package/src/review/media-read.ts +6 -5
  101. package/src/review/model.ts +104 -7
  102. package/src/review/paste.ts +2 -1
  103. package/src/review/previews.ts +123 -36
  104. package/src/review/routes.ts +29 -18
  105. package/src/review/store.ts +74 -12
  106. package/src/review/threads.ts +7 -5
  107. package/src/secrets/copy.ts +110 -0
  108. package/src/secrets/list.ts +17 -7
  109. package/src/serve/hub-app/home-strip.css +5 -0
  110. package/src/serve/hub-app/home-strip.tsx +18 -0
  111. package/src/serve/hub-app/hub-app.tsx +2 -1
  112. package/src/serve/hub-app/hub.css +18 -0
  113. package/src/serve/hub-app/inbox.css +1 -0
  114. package/src/serve/hub-app/pull-refresh.tsx +88 -0
  115. package/src/serve/hub-app/recordings-st.ts +135 -24
  116. package/src/serve/hub-app/recordings-view.tsx +293 -54
  117. package/src/serve/hub-app/recordings.css +77 -24
  118. package/src/serve/hub-app/review/review-cells.tsx +52 -13
  119. package/src/serve/hub-app/review/review-list.tsx +6 -1
  120. package/src/serve/hub-app/review/review-st.ts +6 -5
  121. package/src/serve/hub-app/review/review-thread.tsx +3 -1
  122. package/src/serve/hub-app/review/review-views.tsx +18 -11
  123. package/src/serve/hub-app/review/thread-st.ts +82 -14
  124. package/src/serve/hub-app/review.css +15 -2
  125. package/src/serve/hub-runtime.ts +2 -1
  126. package/src/serve/run-serve.ts +4 -2
  127. package/src/serve/serve-hub.ts +9 -2
  128. package/src/shipkit-files.ts +5 -0
  129. package/src/social/drafts.ts +4 -3
  130. package/src/social/load.ts +7 -2
  131. package/src/social/publish/discord.ts +10 -3
  132. package/src/suite/child-tools.ts +45 -0
  133. package/src/suite/judge-suites.ts +10 -22
  134. package/src/suite/select.ts +83 -8
  135. package/src/suite/suite-cli.ts +38 -14
  136. package/src/suite/suite-cores.ts +68 -0
  137. package/src/suite/suite-reads-preload.ts +8 -6
  138. package/src/ts/config.ts +44 -0
  139. package/src/ts/rename.ts +11 -1
@@ -11,6 +11,20 @@ import type { HomeSt } from './home-st.ts'
11
11
  import { ownTrouble, reach } from './reach.ts'
12
12
 
13
13
  const REPO_KEY = 'home:recordings:repo'
14
+ const COPY_KEY = 'home:recordings:copy'
15
+
16
+ /** what ⌘C copies in the editor: the capture's file (a still as PNG), a still as WebP HQ, or a private link */
17
+ export const COPY_MODES = ['file', 'webp-hq', 'link'] as const
18
+ export type CopyMode = (typeof COPY_MODES)[number]
19
+
20
+ function keptCopy(): CopyMode {
21
+ try {
22
+ const m = globalThis.localStorage?.getItem(COPY_KEY)
23
+ return (COPY_MODES as readonly string[]).includes(m ?? '') ? (m as CopyMode) : 'file'
24
+ } catch {
25
+ return 'file'
26
+ }
27
+ }
14
28
  const API = '/api/home/recordings'
15
29
 
16
30
  function kept(): string {
@@ -71,7 +85,7 @@ export class EditorSt {
71
85
 
72
86
  constructor(public rec: RecView, private page: RecordingsSt, draft: string | null = null) {
73
87
  this.text = draft ?? rec.edit
74
- makeAutoObservable<this, 'page' | 'raf' | 'past' | 'future' | 'wroteAt'>(this, { rec: false, page: false, video: false, raf: false, past: false, future: false, wroteAt: false })
88
+ makeAutoObservable<this, 'page' | 'raf' | 'past' | 'future' | 'wroteAt'>(this, { rec: observableRef, page: false, video: false, raf: false, past: false, future: false, wroteAt: false })
75
89
  }
76
90
 
77
91
  get cropping(): boolean {
@@ -108,6 +122,29 @@ export class EditorSt {
108
122
  return this.rec.seconds
109
123
  }
110
124
 
125
+ /** the save whose edit the text is now (0: the take as shot); null while the text is no save yet */
126
+ get versionNow(): number | null {
127
+ const t = this.text.trim()
128
+ if (t === this.rec.edit.trim()) return this.rec.version
129
+ const v = [...this.rec.versions].reverse().find((x) => x.text.trim() === t)
130
+ return v ? v.n : t === '' ? 0 : null
131
+ }
132
+
133
+ /** the number the next save takes */
134
+ get nextVersion(): number {
135
+ return (this.rec.versions.at(-1)?.n ?? this.rec.version) + 1
136
+ }
137
+
138
+ /** a save's edit in the editor again (0: the take as shot), one undo step; ⌘S then makes it the one that plays */
139
+ loadVersion(n: number): void {
140
+ const v = this.rec.versions.find((x) => x.n === n)
141
+ this.wroteAt = 0
142
+ this.remember()
143
+ this.text = v?.text ?? ''
144
+ this.selected = null
145
+ this.page.keepDraft(this)
146
+ }
147
+
111
148
  /** the pieces that play, or the reason none does */
112
149
  get plays(): { from: number; to: number; factor: number }[] {
113
150
  try {
@@ -229,18 +266,6 @@ export class EditorSt {
229
266
  this.updateMark(i, { ...m, span: whole ? null : span && { from: round(span.from), to: round(span.to) } })
230
267
  }
231
268
 
232
- /** the trim: what plays starts at `from` and ends at `to`, the cuts between kept */
233
- setTrim(from: number, to: number): void {
234
- const a = Math.max(0, round(Math.min(from, to - 0.2)))
235
- const b = Math.min(this.length, round(Math.max(to, a + 0.2)))
236
- const keep = within(this.kept, { from: a, to: b })
237
- const parts = keep.length === 0 ? [{ from: a, to: b }] : keep
238
- if (parts[0]!.from > a) parts[0] = { ...parts[0]!, from: a }
239
- if (parts.at(-1)!.to < b) parts[parts.length - 1] = { ...parts.at(-1)!, to: b }
240
- const whole = parts.length === 1 && parts[0]!.from <= 0.05 && parts[0]!.to >= this.length - 0.05
241
- this.write({ ...this.edit, keep: whole ? [] : parts })
242
- }
243
-
244
269
  startText(at: Pt): void {
245
270
  this.typing = { at, value: '' }
246
271
  }
@@ -345,10 +370,57 @@ export class EditorSt {
345
370
  cut(): void {
346
371
  const s = this.selection
347
372
  if (!s) return this.page.say('mark a part first: i at its start, o at its end')
373
+ if (this.cutSpan(s)) this.clearMarks()
374
+ }
375
+
376
+ /** `s` taken out of what plays (a part painted red on the cuts lane, or the selection); false when it would cut
377
+ * everything */
378
+ cutSpan(span: Span): boolean {
379
+ const s = { from: Math.max(0, round(span.from)), to: Math.min(this.length, round(span.to)) }
348
380
  const keep = without(this.kept, s)
349
- if (keep.length === 0) return this.page.say('that would cut everything')
350
- this.write({ ...this.edit, keep: keep.length === 1 && keep[0]!.from === 0 && keep[0]!.to >= this.length - 0.05 ? [] : keep, speed: this.edit.speed.filter((p) => without([p], s).length > 0) })
351
- this.clearMarks()
381
+ if (keep.length === 0) {
382
+ this.page.say('that would cut everything')
383
+ return false
384
+ }
385
+ this.writeKeep(keep, this.edit.speed.filter((p) => without([p], s).length > 0))
386
+ return true
387
+ }
388
+
389
+ /** a cut part plays again: `s` back into what is kept, touching parts joined */
390
+ restore(span: Span): void {
391
+ const s = { from: Math.max(0, round(span.from)), to: Math.min(this.length, round(span.to)) }
392
+ const all = [...this.kept, s].sort((a, b) => a.from - b.from)
393
+ const keep: Span[] = []
394
+ for (const k of all) {
395
+ const last = keep.at(-1)
396
+ if (last && k.from <= last.to + 0.05) last.to = Math.max(last.to, k.to)
397
+ else keep.push({ ...k })
398
+ }
399
+ this.writeKeep(keep, this.edit.speed)
400
+ }
401
+
402
+ /** a drag on the cuts lane from `from`: started on a red part it puts `span` back, anywhere else it cuts it out */
403
+ paint(from: number, span: Span): void {
404
+ if (this.removed.some((c) => from >= c.from && from <= c.to)) this.restore(span)
405
+ else this.cutSpan(span)
406
+ }
407
+
408
+ /** the parts cut out, in order: what the cuts lane paints red */
409
+ get removed(): Span[] {
410
+ const out: Span[] = []
411
+ let at = 0
412
+ for (const k of this.kept) {
413
+ if (k.from - at >= 0.05) out.push({ from: at, to: k.from })
414
+ at = k.to
415
+ }
416
+ if (this.length - at >= 0.05) out.push({ from: at, to: this.length })
417
+ return out
418
+ }
419
+
420
+ /** what is kept written: the whole take writes no keep line */
421
+ private writeKeep(keep: Span[], speed: typeof this.edit.speed): void {
422
+ const whole = keep.length === 1 && keep[0]!.from <= 0.05 && keep[0]!.to >= this.length - 0.05
423
+ this.write({ ...this.edit, keep: whole ? [] : keep, speed })
352
424
  }
353
425
 
354
426
  /** only the selection kept: both ends trimmed */
@@ -389,15 +461,22 @@ export class EditorSt {
389
461
  this.selected = null
390
462
  }
391
463
 
464
+ /** the edit saved as a new version and sent up; nothing asked of the hub when the text is the one already saved.
465
+ * The editor stays as it is: its playhead, its tool, its undo */
392
466
  async save(): Promise<void> {
393
467
  if (this.parsed.error) return this.page.say(this.parsed.error)
468
+ if (this.exporting) return
469
+ if (!this.dirty) return this.page.say(`nothing changed since ${this.rec.version > 0 ? `v${this.rec.version}` : 'the take'}: no new save, no upload`)
394
470
  this.exporting = true
395
471
  try {
396
472
  const r = await this.page.post<{ recording: RecView; said: string }>(this.rec, 'edit', { text: this.text })
397
- if (r) {
398
- this.page.dropDraft(this.rec)
399
- this.page.replace(r.recording)
400
- }
473
+ if (!r) return
474
+ runInAction(() => {
475
+ this.rec = r.recording
476
+ this.text = r.recording.edit
477
+ })
478
+ this.page.dropDraft(r.recording)
479
+ this.page.replace(r.recording)
401
480
  } finally {
402
481
  runInAction(() => (this.exporting = false))
403
482
  }
@@ -421,10 +500,16 @@ export class RecordingsSt {
421
500
  open: { repo: string; id: string } | null = null
422
501
  /** every thumb at once, big, in place of the editor */
423
502
  gallery = false
503
+ /** the recorder app's window (`?solo=1`): its addresses keep that, so a move inside it is never another page */
504
+ solo = typeof location !== 'undefined' && new URLSearchParams(location.search).has('solo')
424
505
  editor: EditorSt | null = null
425
506
  busy = ''
426
507
  /** the thumb whose delete waits for its second click */
427
508
  arming: string | null = null
509
+ /** what ⌘C copies, kept in the browser */
510
+ copyMode: CopyMode = keptCopy()
511
+ /** the mode a ⌘C copy runs in, until the hub answers */
512
+ copying: CopyMode | null = null
428
513
  private gen = 0
429
514
  private sayTimer: ReturnType<typeof setTimeout> | null = null
430
515
  /** each capture's edit text not exported yet, by `<repo>/<id>`: it waits there while another is open */
@@ -450,7 +535,28 @@ export class RecordingsSt {
450
535
  }
451
536
 
452
537
  get address(): string {
453
- return this.gallery ? '/recordings#gallery' : recordingAddress(this.open)
538
+ const a = this.gallery ? '/recordings#gallery' : recordingAddress(this.open)
539
+ return this.solo ? a.replace(/^\/recordings/, '/recordings?solo=1') : a
540
+ }
541
+
542
+ setCopyMode(m: CopyMode): void {
543
+ this.copyMode = m
544
+ try { globalThis.localStorage?.setItem(COPY_KEY, m) } catch { /* private window: the pick lasts the tab */ }
545
+ }
546
+
547
+ /** ⌘C: the capture copied as the mode says; a video under WebP copies as an animated WebP */
548
+ async copy(r: RecView): Promise<void> {
549
+ const mode = this.copyMode
550
+ this.copying = mode
551
+ try {
552
+ await this.share(r, 'copy', { format: mode })
553
+ } finally {
554
+ runInAction(() => (this.copying = null))
555
+ }
556
+ // the WebP a copy made reads as ready: a video's is made before the answer, a still's by the recorder just after
557
+ if (mode !== 'webp-hq') return
558
+ await this.load()
559
+ if (this.current?.webp == null) setTimeout(() => void this.load(), 1500)
454
560
  }
455
561
 
456
562
  setRepo(r: string): void {
@@ -481,6 +587,11 @@ export class RecordingsSt {
481
587
  else this.drafts.delete(k)
482
588
  }
483
589
 
590
+ /** an edit a capture opens with, not saved yet (the address's `draft`) */
591
+ seedDraft(r: Pick<RecView, 'repo' | 'id'>, text: string): void {
592
+ this.drafts.set(`${r.repo}/${r.id}`, text)
593
+ }
594
+
484
595
  dropDraft(r: Pick<RecView, 'repo' | 'id'>): void {
485
596
  this.drafts.delete(`${r.repo}/${r.id}`)
486
597
  }
@@ -545,13 +656,13 @@ export class RecordingsSt {
545
656
  }
546
657
  }
547
658
 
548
- /** a share of a thumb (copy file, copy link, Finder): the edit open on it exported first, so what goes out is what he sees */
549
- async share(r: RecView, verb: 'link' | 'copy-file' | 'reveal', body: Record<string, unknown> = {}): Promise<void> {
659
+ /** a share of a thumb (copy file, copy link, Finder): the edit open on it saved first, so what goes out is what shows */
660
+ async share(r: RecView, verb: 'link' | 'copy-file' | 'copy' | 'reveal', body: Record<string, unknown> = {}): Promise<void> {
550
661
  const ed = this.editor
551
662
  if (ed && ed.rec.repo === r.repo && ed.rec.id === r.id && ed.dirty) {
552
663
  await ed.save()
553
664
  if (this.editor?.dirty) return
554
- } else if (this.hasDraft(r)) return this.say(`${r.name} has an edit not exported: open it and export it first`)
665
+ } else if (this.hasDraft(r)) return this.say(`${r.name} has an edit not saved: open it and save it first (⌘S)`)
555
666
  await this.post(r, verb, body)
556
667
  }
557
668