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.
- package/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/agent-time/hooks.ts +10 -3
- package/src/agent-time/live.ts +11 -5
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/store.ts +2 -2
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +12 -11
- package/src/asks/ask-after.ts +6 -2
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kits/identity-kit.ts +106 -38
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +8 -4
- package/src/checks/SK013-one-way-in-policy.check.ts +10 -0
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +204 -53
- package/src/cli/cmd_Backup.ts +151 -8
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Review.ts +931 -229
- package/src/cli/cmd_Secret.ts +255 -34
- package/src/cli/cmd_Social.ts +36 -33
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +2 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +21 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +25 -74
- package/src/collections/collection-types.ts +9 -5
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +53 -61
- package/src/collections/reflections.ts +9 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +10 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-db.ts +5 -3
- package/src/core/migrate-layout.ts +8 -10
- package/src/home/activity.ts +8 -15
- package/src/home/daemon-jobs.ts +13 -1
- package/src/home/home-paths.ts +6 -3
- package/src/home/home-routes.ts +8 -0
- package/src/home/inbox-shape.ts +233 -100
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +10 -15
- package/src/home/machine-host.ts +19 -1
- package/src/home/other-macs.ts +2 -2
- package/src/home/serve-web.ts +6 -5
- package/src/home/space-page.ts +1 -1
- package/src/home/vault-page.ts +51 -17
- package/src/home/vault-words.ts +2 -2
- package/src/hooks/one-way-in-guard.ts +24 -2
- package/src/hq/files-send.ts +27 -28
- package/src/hq/hq-db.ts +4 -1
- package/src/hq/hq-local.ts +37 -4
- package/src/hq/hq-routes.ts +10 -2
- package/src/hq/hq-store.ts +6 -2
- package/src/hq/kinds/ask.ts +6 -6
- package/src/hq/outbox.ts +5 -3
- package/src/hq/replica.ts +1 -2
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +9 -8
- package/src/identities/machine-route.ts +8 -3
- package/src/ledger/db.ts +8 -1
- package/src/media-store/backup/daemon.ts +48 -8
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +14 -8
- package/src/media-store/backup/sources.ts +18 -17
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +3 -4
- package/src/media-store/copy/store.ts +2 -2
- package/src/media-store/db.ts +2 -2
- package/src/media-store/forget.ts +118 -0
- package/src/media-store/purge.ts +3 -2
- package/src/media-store/space-listing.ts +20 -4
- package/src/media-store/space.ts +6 -5
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +1 -1
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +2 -2
- package/src/messages/score.ts +1 -1
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +181 -4
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/public-clean.ts +3 -2
- package/src/repo-config.ts +40 -18
- package/src/review/anim.ts +1 -1
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +16 -6
- package/src/review/card-rows.ts +4 -3
- package/src/review/cells.ts +297 -65
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +8 -16
- package/src/review/draft-model.ts +2 -2
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +128 -14
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +1 -1
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +22 -9
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/model.ts +396 -86
- package/src/review/move.ts +3 -3
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +3 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/routes.ts +137 -32
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +4 -4
- package/src/review/store.ts +366 -85
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +20 -7
- package/src/review/threads.ts +236 -39
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-card.ts +2 -2
- package/src/review/unit.ts +71 -5
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +22 -9
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +8 -5
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +16 -22
- package/src/secrets/manager.ts +31 -16
- package/src/secrets/read.ts +161 -33
- package/src/secrets/tail.ts +31 -0
- package/src/serve/hub-app/asks-page.tsx +2 -1
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +31 -40
- package/src/serve/hub-app/col-list-page.tsx +5 -2
- package/src/serve/hub-app/col-tables-view.tsx +7 -4
- package/src/serve/hub-app/col-tables.ts +5 -5
- package/src/serve/hub-app/cols-svc.ts +4 -79
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/home-st.ts +57 -6
- package/src/serve/hub-app/home-strip.css +1 -6
- package/src/serve/hub-app/home-strip.tsx +2 -1
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +48 -32
- package/src/serve/hub-app/hub-types.ts +2 -0
- package/src/serve/hub-app/hub.css +50 -61
- package/src/serve/hub-app/icons.tsx +14 -4
- package/src/serve/hub-app/identities-view.tsx +4 -3
- package/src/serve/hub-app/inbox-st.ts +203 -42
- package/src/serve/hub-app/inbox-view.tsx +189 -101
- package/src/serve/hub-app/inbox.css +47 -44
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/keys.ts +5 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-view.tsx +4 -11
- package/src/serve/hub-app/machines.css +0 -9
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +18 -40
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +2 -2
- package/src/serve/hub-app/messages/messages-page.tsx +2 -1
- package/src/serve/hub-app/messages/messages-st.ts +1 -1
- package/src/serve/hub-app/messages.css +0 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +1 -1
- package/src/serve/hub-app/pages-frames.tsx +11 -1
- package/src/serve/hub-app/palette-st.ts +4 -4
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +5 -13
- package/src/serve/hub-app/project-list.tsx +3 -6
- package/src/serve/hub-app/projects-svc.ts +6 -2
- package/src/serve/hub-app/readme.css +9 -15
- package/src/serve/hub-app/reflections-page.tsx +54 -1
- package/src/serve/hub-app/releases/releases-page.tsx +3 -2
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +2 -2
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +57 -54
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-cells.tsx +86 -105
- package/src/serve/hub-app/review/review-list.tsx +104 -47
- package/src/serve/hub-app/review/review-page.tsx +5 -4
- package/src/serve/hub-app/review/review-st.ts +68 -28
- package/src/serve/hub-app/review/review-thread.tsx +171 -40
- package/src/serve/hub-app/review/review-views.tsx +35 -31
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control.tsx +4 -4
- package/src/serve/hub-app/review/thread-st.ts +222 -22
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +216 -57
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +23 -10
- package/src/serve/hub-app/social/kit.tsx +8 -15
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +3 -0
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/social-model.ts +13 -5
- package/src/serve/hub-app/social/social-page.tsx +1 -1
- package/src/serve/hub-app/social/social-st.ts +42 -5
- package/src/serve/hub-app/social.css +7 -17
- package/src/serve/hub-app/space.css +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +6 -2
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +2 -1
- package/src/serve/hub-app/time.css +2 -5
- package/src/serve/hub-app/tree-row.tsx +1 -9
- package/src/serve/hub-app/vault-view.tsx +4 -4
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +4 -4
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +4 -3
- package/src/serve/hub-runtime.ts +20 -6
- package/src/serve/project-gutter-route.ts +16 -6
- package/src/serve/project-gutter.ts +6 -53
- package/src/serve/same-origin.ts +3 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +29 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit.ts +2 -2
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -4
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/desk-index.ts +34 -13
- package/src/social/drafts.ts +4 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +89 -64
- package/src/social/media-kind.ts +68 -161
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +58 -57
- package/src/social/routes.ts +64 -24
- package/src/social/stage.ts +42 -57
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +135 -43
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/desk.ts +16 -11
- package/src/stores/unit.ts +2 -2
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/urls/rows.ts +1 -1
- package/src/vault/vault-http.ts +11 -3
- package/src/vault/vault-import.ts +6 -1
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -424
- package/src/messages/suggest.ts +0 -96
- package/src/social/migrate.ts +0 -123
package/src/review/move.ts
CHANGED
|
@@ -115,7 +115,7 @@ function copyCard(id: string, from: CardBackend, to: CardBackend, out: Moved, dr
|
|
|
115
115
|
return
|
|
116
116
|
}
|
|
117
117
|
if (there != null && (there.head as { created?: unknown }).created !== (h.head as { created?: unknown }).created) {
|
|
118
|
-
out.kept.push(`${id}: another
|
|
118
|
+
out.kept.push(`${id}: another item of that id is on the other side, made at another moment: each stays`)
|
|
119
119
|
return
|
|
120
120
|
}
|
|
121
121
|
if (there == null || revOf(there.head) !== revOf(h.head)) {
|
|
@@ -186,7 +186,7 @@ export function exportRows(dir: string, o: { to?: string; ids?: readonly string[
|
|
|
186
186
|
const deleted = goneOf(target, false)
|
|
187
187
|
for (const id of ids) {
|
|
188
188
|
if (!from.has(id)) {
|
|
189
|
-
out.kept.push(`${id}: no
|
|
189
|
+
out.kept.push(`${id}: no item of that id in the rows`)
|
|
190
190
|
continue
|
|
191
191
|
}
|
|
192
192
|
const was = out.files
|
|
@@ -324,7 +324,7 @@ async function goOnce(stores: readonly string[], o: MoveOptions): Promise<{ ok:
|
|
|
324
324
|
...lines,
|
|
325
325
|
...(late.length > 0 ? ['read again after the switch:', ...late] : []),
|
|
326
326
|
...(after.length > 0 ? [`WARN ${after.length} files written after the switch are not in the rows: run sk thread move --go again`, ...after.slice(0, 20)] : []),
|
|
327
|
-
`ok: the switch cards-in-db is on${was ? ' (it was already)' : ''}: every
|
|
327
|
+
`ok: the switch cards-in-db is on${was ? ' (it was already)' : ''}: every thread is read and written in the daemon's database; the files stay where they are, untouched (sk thread move --back --go goes back)`,
|
|
328
328
|
],
|
|
329
329
|
}
|
|
330
330
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// the address of a need's thread (wiki tools/shipkit/threads-how-it-fits.md, The model): `check:<repo>/<id>`,
|
|
2
|
+
// `reflection:<repo>/<file>`. Pure and browser safe: the sync (need-threads.ts) writes by it, the inbox pairs a need
|
|
3
|
+
// with its thread by it
|
|
4
|
+
import type { Resource } from '../collections/collection-types.ts'
|
|
5
|
+
import { canonicalAddress } from './model.ts'
|
|
6
|
+
|
|
7
|
+
/** the collections whose needs are threads, and the kind word of their address */
|
|
8
|
+
export const NEED_KINDS: Readonly<Record<string, string>> = { checks: 'check', reflections: 'reflection' }
|
|
9
|
+
|
|
10
|
+
/** a need's thread address, null for a need of another collection */
|
|
11
|
+
export function needAddress(repo: string, n: Pick<Resource, 'collection' | 'id'>): string | null {
|
|
12
|
+
const kind = NEED_KINDS[n.collection]
|
|
13
|
+
if (kind === undefined || !n.id.startsWith(`${kind}:`)) return null
|
|
14
|
+
return canonicalAddress(`${kind}:${repo}/${n.id.slice(kind.length + 1)}`)
|
|
15
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// a failing check is a thread (wiki tools/shipkit/threads-how-it-fits.md, The model): one per address, `check:<repo>/<id>`,
|
|
2
|
+
// opened and kept by the machine from the hub's needs. A need that stands writes `broken` once; a need gone writes
|
|
3
|
+
// `fixed`, so the thread reads working, then done; never his turn. A reflection is an object (review/reflection-object.ts):
|
|
4
|
+
// no thread opens for its file here; a thread opened on it by the owner's act gets `fixed` once its file is gone.
|
|
5
|
+
//
|
|
6
|
+
// the one constraint a reader breaks first: a collection whose read broke (its `<collection>:broken` row) closes nothing,
|
|
7
|
+
// or one broken read would close every thread of it
|
|
8
|
+
import type { Resource } from '../collections/collection-types.ts'
|
|
9
|
+
import { canonicalAddress, updatesOf, type UpdateState } from './model.ts'
|
|
10
|
+
import { NEED_KINDS, needAddress } from './need-address.ts'
|
|
11
|
+
import { openThread, postUpdate, readAll, storeDir, storeStamp, updateHead } from './store.ts'
|
|
12
|
+
import { orderedThreads, turnOf, type Thread } from './threads.ts'
|
|
13
|
+
|
|
14
|
+
export interface NeedSync {
|
|
15
|
+
opened: number
|
|
16
|
+
/** a thread that was fixed, broken again */
|
|
17
|
+
broken: number
|
|
18
|
+
fixed: number
|
|
19
|
+
/** already as the needs say: nothing written */
|
|
20
|
+
same: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const LINE_MAX = 300
|
|
24
|
+
const lineOf = (t: string): string => {
|
|
25
|
+
const l = t.split('\n').find((x) => x.trim() !== '')?.trim() ?? ''
|
|
26
|
+
return l.length > LINE_MAX ? `${l.slice(0, LINE_MAX - 1)}…` : l
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const lastState = (t: Thread): UpdateState | null => updatesOf(t.head).at(-1)?.update?.state ?? null
|
|
30
|
+
|
|
31
|
+
/** what a check's thread opens with: its line and its last wire lines */
|
|
32
|
+
const openingOf = (n: Resource): string => [n.text, n.md].filter((x) => x != null && x !== '').join('\n\n')
|
|
33
|
+
|
|
34
|
+
/** per store, what the last sync saw: the same needs on an unmoved store write nothing and read nothing */
|
|
35
|
+
const seen = new Map<string, string>()
|
|
36
|
+
|
|
37
|
+
/** the store of `root` made to match its needs: a thread opened or broken again for each check need, a thread fixed
|
|
38
|
+
* for each one whose need is gone; a reflection opens none, and a thread opened on one is fixed once its file is gone.
|
|
39
|
+
* Re-runnable: what already stands writes nothing */
|
|
40
|
+
export async function syncNeedThreads(root: string, repo: string, needs: readonly Resource[], now = new Date()): Promise<NeedSync> {
|
|
41
|
+
const out: NeedSync = { opened: 0, broken: 0, fixed: 0, same: 0 }
|
|
42
|
+
const dir = storeDir(root)
|
|
43
|
+
const broken = new Set(needs.filter((n) => n.id === `${n.collection}:broken`).map((n) => n.collection))
|
|
44
|
+
const want = new Map<string, Resource>()
|
|
45
|
+
// the reflections whose file stands: a thread on one stays as it is, a thread on one gone is fixed
|
|
46
|
+
const standing = new Set<string>()
|
|
47
|
+
for (const n of needs) {
|
|
48
|
+
const a = n.severity != null && !broken.has(n.collection) ? needAddress(repo, n) : null
|
|
49
|
+
if (a === null) continue
|
|
50
|
+
if (a.startsWith('reflection:')) standing.add(a)
|
|
51
|
+
else want.set(a, n)
|
|
52
|
+
}
|
|
53
|
+
const needsKey = `${[...want].map(([a, n]) => `${a}=${n.title || n.label}`).sort().join('\n')}|${[...standing].sort().join(' ')}|${[...broken].sort().join(' ')}`
|
|
54
|
+
if (seen.get(dir) === `${needsKey}|${storeStamp(dir)}`) return { ...out, same: want.size }
|
|
55
|
+
const prefixes = Object.entries(NEED_KINDS)
|
|
56
|
+
.filter(([col]) => !broken.has(col))
|
|
57
|
+
.map(([, kind]) => canonicalAddress(`${kind}:${repo}/x`)!.slice(0, -1))
|
|
58
|
+
const mine = new Map<string, Thread>()
|
|
59
|
+
for (const t of orderedThreads(readAll(dir).items)) {
|
|
60
|
+
const a = t.head.item.on !== undefined ? canonicalAddress(t.head.item.on) : null
|
|
61
|
+
if (a !== null && t.head.item.origin.by === 'agent' && Object.values(NEED_KINDS).some((k) => a.startsWith(`${k}:`)) && !mine.has(a)) mine.set(a, t)
|
|
62
|
+
}
|
|
63
|
+
const update = (id: string, state: UpdateState, text: string): Promise<unknown> => postUpdate(dir, id, { who: 'agent', state, text, machine: true, now })
|
|
64
|
+
for (const [a, n] of want) {
|
|
65
|
+
const t = mine.get(a)
|
|
66
|
+
// the hub's needs route sends the label alone, the in process needs the title too
|
|
67
|
+
const title = n.title || n.label || n.id
|
|
68
|
+
if (t === undefined) {
|
|
69
|
+
const item = await openThread(dir, a, { title, what: openingOf(n), machine: true, now })
|
|
70
|
+
await update(item.id, 'broken', lineOf(n.text))
|
|
71
|
+
out.opened++
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
// a check renamed keeps its thread, under its new name
|
|
75
|
+
if (t.head.item.title !== title) updateHead(dir, t.head.item.id, (cur) => ({ ...cur, title }))
|
|
76
|
+
if (lastState(t) !== 'broken') {
|
|
77
|
+
await update(t.head.item.id, 'broken', lineOf(n.text))
|
|
78
|
+
out.broken++
|
|
79
|
+
} else out.same++
|
|
80
|
+
}
|
|
81
|
+
for (const [a, t] of mine) {
|
|
82
|
+
if (want.has(a) || standing.has(a) || !prefixes.some((p) => a.startsWith(p))) continue
|
|
83
|
+
const last = lastState(t)
|
|
84
|
+
const reflection = a.startsWith('reflection:')
|
|
85
|
+
// a check's thread is fixed from broken; a reflection's thread, opened by the owner's act with no update, from anything not done
|
|
86
|
+
if (reflection ? last === 'fixed' || turnOf(t) === 'done' : last !== 'broken' && last !== 'better') continue
|
|
87
|
+
await update(t.head.item.id, 'fixed', reflection ? 'folded: its file is gone from .shipkit/reflections/' : 'no longer fails or warns')
|
|
88
|
+
out.fixed++
|
|
89
|
+
}
|
|
90
|
+
// the stamp after the writes: the next run on the same needs reads nothing
|
|
91
|
+
seen.set(dir, `${needsKey}|${storeStamp(dir)}`)
|
|
92
|
+
return out
|
|
93
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// an object's card (wiki tools/shipkit/threads-how-it-fits.md, Kinds): what a kind's `read` or an agent's proposal puts
|
|
2
|
+
// beside a state's json, drawn by the hub one way for every kind. The hub names no kind: a state that carries a card
|
|
3
|
+
// draws as that card, whatever address its version is on. Pure: the hub bundles it
|
|
4
|
+
import type { StoredState } from './model.ts'
|
|
5
|
+
|
|
6
|
+
/** one score of a line, by one reader or gatekeeper: `said` what they said of it (the cell's tooltip) */
|
|
7
|
+
export interface CardScore {
|
|
8
|
+
who: string
|
|
9
|
+
score: number | null
|
|
10
|
+
said?: string
|
|
11
|
+
/** a gatekeeper's refusal: a veto, never a weight */
|
|
12
|
+
veto?: true
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** one line under the card: a phrasing, an option of a page top */
|
|
16
|
+
export interface CardLine {
|
|
17
|
+
id: string
|
|
18
|
+
text: string
|
|
19
|
+
/** the line under it (a page top's second line) */
|
|
20
|
+
second?: string
|
|
21
|
+
/** where it came from, or why it is held */
|
|
22
|
+
note?: string
|
|
23
|
+
scores?: CardScore[]
|
|
24
|
+
/** what the line is ranked on: its mean over the readers, or a page top's score */
|
|
25
|
+
best?: number | null
|
|
26
|
+
/** the run its scores come from */
|
|
27
|
+
run?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ObjectCard {
|
|
31
|
+
/** what the object is, in words (« value proposition », « persona »): the card names it, never the version's address */
|
|
32
|
+
kind?: string
|
|
33
|
+
title: string
|
|
34
|
+
/** short words drawn as chips: a role, a family, « held » */
|
|
35
|
+
chips?: string[]
|
|
36
|
+
/** each field with its words; `fill`: written with none, to fill */
|
|
37
|
+
fields?: { label: string; text: string; fill?: true }[]
|
|
38
|
+
lines?: CardLine[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** a state with its card beside its json */
|
|
42
|
+
export type CardState = StoredState & { card?: ObjectCard }
|
|
43
|
+
|
|
44
|
+
/** the card a state carries, null when it carries none or one the hub cannot draw */
|
|
45
|
+
export function cardOf(s: StoredState | undefined): ObjectCard | null {
|
|
46
|
+
const c = (s as CardState | undefined)?.card
|
|
47
|
+
return c != null && typeof c === 'object' && typeof c.title === 'string' ? c : null
|
|
48
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// what a linked object says now, read from where it lives, for the thread that links it (cells.ts ObjectRead): a
|
|
2
|
+
// reflection from its file, so its card draws whether or not a thread stands on it. Only this repo's own: an address of
|
|
3
|
+
// another repo reads nothing here, and its link stays a plain one
|
|
4
|
+
import { readdirSync, statSync } from 'fs'
|
|
5
|
+
import { basename, join } from 'path'
|
|
6
|
+
import { REFLECTIONS_DIR } from '../reflections/reflections-queue.ts'
|
|
7
|
+
import type { ObjectRead } from './cells.ts'
|
|
8
|
+
import { readReflection, reflectionOfAddress } from './reflection-object.ts'
|
|
9
|
+
|
|
10
|
+
export const objectReaderOf =
|
|
11
|
+
(root: string, repo = basename(root)): ObjectRead =>
|
|
12
|
+
(address) => {
|
|
13
|
+
const r = reflectionOfAddress(address)
|
|
14
|
+
return r === null || r.repo !== repo ? null : readReflection(root, r.repo, r.file)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** a word that moves when a file the reader reads moves (added, edited, folded away): a thread view's tag carries it, so a
|
|
18
|
+
* card never shows a reflection as it stood before */
|
|
19
|
+
export function objectsTag(root: string): string {
|
|
20
|
+
const dir = join(root, REFLECTIONS_DIR)
|
|
21
|
+
let h = 0
|
|
22
|
+
try {
|
|
23
|
+
for (const f of readdirSync(dir).sort()) {
|
|
24
|
+
const w = `${f}:${statSync(join(dir, f)).mtimeMs}`
|
|
25
|
+
for (let i = 0; i < w.length; i++) h = (h * 31 + w.charCodeAt(i)) | 0
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
return '0'
|
|
29
|
+
}
|
|
30
|
+
return (h >>> 0).toString(36)
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// the owner's verdict on a version, whichever button writes it (the verdicts under the version, the head's « close as done » and
|
|
2
|
+
// « not doing it »): one writer and one follow-up, so an approve lands the same from either. The release that holds the
|
|
3
|
+
// card hears the move, and the kind's apply lands the object (wiki tools/shipkit/threads-how-it-fits.md, Kinds)
|
|
4
|
+
import { dirname } from 'node:path'
|
|
5
|
+
import { applyOnVerdict } from './kind-apply.ts'
|
|
6
|
+
import { verdictOf, type Message, type ReviewStatus } from './model.ts'
|
|
7
|
+
import { readItem, writeVerdict } from './store.ts'
|
|
8
|
+
import type { ReviewUnit } from './unit.ts'
|
|
9
|
+
|
|
10
|
+
/** the verdict item `id` holds now, null when none */
|
|
11
|
+
export function statusNow(dir: string, id: string): ReviewStatus | null {
|
|
12
|
+
const x = readItem(dir, id)
|
|
13
|
+
return x ? (verdictOf(x)?.status ?? null) : null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** the release a card feeds follows its verdict's move from `was` (releases/from-card.ts); it never throws */
|
|
17
|
+
export async function releaseFollows(dir: string, id: string, was: ReviewStatus | null): Promise<void> {
|
|
18
|
+
const { followAnswer } = await import('../releases/from-card.ts')
|
|
19
|
+
await followAnswer(dirname(dirname(dir)), id, was)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** the owner's verdict `body` on version `id` written, then followed: the release in the background, the kind's apply awaited,
|
|
23
|
+
* its « landed » or « not landed » line in the thread before this returns */
|
|
24
|
+
export async function ownerVerdict(
|
|
25
|
+
dir: string,
|
|
26
|
+
unit: Pick<ReviewUnit, 'kinds'> | null,
|
|
27
|
+
id: string,
|
|
28
|
+
body: unknown,
|
|
29
|
+
): Promise<{ ok: true; message: Message } | { ok: false; errors: string[] }> {
|
|
30
|
+
const was = statusNow(dir, id)
|
|
31
|
+
const r = writeVerdict(dir, id, body)
|
|
32
|
+
if (!r.ok) return r
|
|
33
|
+
void releaseFollows(dir, id, was)
|
|
34
|
+
await applyOnVerdict(dirname(dirname(dir)), dir, unit, id, r.message.verdict)
|
|
35
|
+
return r
|
|
36
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// who holds a thread and who hears it (wiki tools/shipkit/threads-how-it-fits.md, The rules): the parties of the machine,
|
|
2
|
+
// a session and its lanes, and one function per rule, the same for the cli, the inbox hook, the watch and the hub.
|
|
3
|
+
// Pure: the hub imports it. The registry that fills `Parties` is agent-time/registry.ts
|
|
4
|
+
// the one constraint a reader breaks first: a lane shares its session's process, so the session id on its acts is its
|
|
5
|
+
// parent's; a lane is told from its parent by its SK_AGENT name alone, and the session itself acts with none
|
|
6
|
+
|
|
7
|
+
/** the agent that holds a thread: the lane and the session of its newest act (threads.ts holderOf) */
|
|
8
|
+
export interface Holder {
|
|
9
|
+
lane?: string
|
|
10
|
+
session?: string
|
|
11
|
+
at: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** one Claude Code session, the orchestrator, by the id its acts carry (CLAUDE_CODE_SESSION_ID) */
|
|
15
|
+
export interface SessionParty {
|
|
16
|
+
id: string
|
|
17
|
+
/** the repo it runs in, by its folder name */
|
|
18
|
+
repo: string
|
|
19
|
+
/** its process lives */
|
|
20
|
+
live: boolean
|
|
21
|
+
/** a live `sk thread watch --mine` of it: it hears at once, else at its next prompt (the inbox hook) */
|
|
22
|
+
watch: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** a lane: a sub agent its session started, by the name its acts carry (SK_AGENT) */
|
|
26
|
+
export interface LaneParty {
|
|
27
|
+
name: string
|
|
28
|
+
session: string
|
|
29
|
+
live: boolean
|
|
30
|
+
/** a live `sk thread watch --lane <name>` (or `--mine` under SK_AGENT) */
|
|
31
|
+
watch: boolean
|
|
32
|
+
/** what its session gave it to do */
|
|
33
|
+
what?: string
|
|
34
|
+
/** the harness's agent id, the one its session's SendMessage resumes it by: its transcript is `subagents/agent-<id>.jsonl` */
|
|
35
|
+
id?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface Parties {
|
|
39
|
+
sessions: readonly SessionParty[]
|
|
40
|
+
lanes: readonly LaneParty[]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const NO_PARTIES: Parties = { sessions: [], lanes: [] }
|
|
44
|
+
|
|
45
|
+
/** who asks: the lane it acts as (SK_AGENT, --as), and its session */
|
|
46
|
+
export interface Me {
|
|
47
|
+
lane: string | null
|
|
48
|
+
session: string | null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** a party as the rules see it: a session itself, or one lane of a session */
|
|
52
|
+
export type Party = { kind: 'session'; session: string } | { kind: 'lane'; lane: string; session: string | null }
|
|
53
|
+
|
|
54
|
+
const laneIn = (p: Parties, name: string, session: string | null): LaneParty | undefined =>
|
|
55
|
+
p.lanes.filter((l) => l.name === name && (session === null || l.session === session)).sort((a, b) => Number(b.live) - Number(a.live))[0]
|
|
56
|
+
|
|
57
|
+
/** the party an act or a caller is: a lane by its SK_AGENT name, else its session. A name the registry does not know
|
|
58
|
+
* stays a lane (an ended one), never the session: a guess there would let a lane mark its siblings' answers seen */
|
|
59
|
+
export function partyOf(who: { lane?: string | null; session?: string | null }, p: Parties): Party | null {
|
|
60
|
+
void p
|
|
61
|
+
const lane = who.lane ?? null
|
|
62
|
+
const session = who.session ?? null
|
|
63
|
+
if (lane !== null) return { kind: 'lane', lane, session }
|
|
64
|
+
return session === null ? null : { kind: 'session', session }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const sameSession = (a: string | null, b: string | null): boolean => a === null || b === null || a === b
|
|
68
|
+
|
|
69
|
+
export const sameParty = (a: Party | null, b: Party | null): boolean =>
|
|
70
|
+
a !== null && b !== null && (a.kind === 'session' ? b.kind === 'session' && a.session === b.session : b.kind === 'lane' && a.lane === b.lane && sameSession(a.session, b.session))
|
|
71
|
+
|
|
72
|
+
/** a session in words: `<repo> main`, with its short id when two live sessions share the repo */
|
|
73
|
+
export function sessionLabel(id: string | null | undefined, p: Parties): string {
|
|
74
|
+
if (!id) return 'a session'
|
|
75
|
+
const s = p.sessions.find((x) => x.id === id)
|
|
76
|
+
if (!s) return `session ${id.slice(0, 8)}`
|
|
77
|
+
const twin = p.sessions.some((x) => x.id !== id && x.repo === s.repo && x.live)
|
|
78
|
+
return `${s.repo} main${twin ? ` ${id.slice(0, 4)}` : ''}`
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** who wrote a message, in words: « you » for him, a lane by its name, a session's own act (`agent`, no lane) by its
|
|
82
|
+
* session, `<repo> main`; « agent » only when the act names no session */
|
|
83
|
+
export const actorName = (who: string, session: string | undefined, p: Parties): string =>
|
|
84
|
+
who === 'owner' ? 'you' : (who === 'agent' || who.startsWith('agent ')) && session ? sessionLabel(session, p) : who
|
|
85
|
+
|
|
86
|
+
/** the light on a thread: its holder hears it, its parent session hears it for it, or nobody does */
|
|
87
|
+
export type Light = 'hears' | 'parent' | 'nobody'
|
|
88
|
+
|
|
89
|
+
export interface Hearing {
|
|
90
|
+
light: Light
|
|
91
|
+
/** the party that hears his answer now: the holder, its parent session, or null */
|
|
92
|
+
by: Party | null
|
|
93
|
+
/** the holder in words: `L26 · from studio main` */
|
|
94
|
+
chip: string
|
|
95
|
+
/** the light in words: « L26 hears you » */
|
|
96
|
+
words: string
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const nobodyWords = (repo: string): string => `nobody hears now: the next session in ${repo} sees it first`
|
|
100
|
+
|
|
101
|
+
/** rule 3, hears: the holder when it lives and listens (a lane by its watch, a session by its watch or its prompt hook),
|
|
102
|
+
* else its parent session while that lives (rule 2, a lane's threads pass to its session), else nobody: the repo's
|
|
103
|
+
* next session sees it first */
|
|
104
|
+
export function hearingOf(h: Holder | null, p: Parties, repo: string): Hearing {
|
|
105
|
+
const holder = h === null ? null : partyOf(h, p)
|
|
106
|
+
if (holder === null) return { light: 'nobody', by: null, chip: 'nobody holds it', words: nobodyWords(repo) }
|
|
107
|
+
const session = holder.session === null ? undefined : p.sessions.find((s) => s.id === holder.session)
|
|
108
|
+
const label = sessionLabel(holder.session, p)
|
|
109
|
+
if (holder.kind === 'session') {
|
|
110
|
+
return session?.live ? { light: 'hears', by: holder, chip: label, words: `${label} hears you` } : { light: 'nobody', by: null, chip: label, words: nobodyWords(repo) }
|
|
111
|
+
}
|
|
112
|
+
const lane = laneIn(p, holder.lane, holder.session)
|
|
113
|
+
const chip = `${holder.lane} · from ${label}`
|
|
114
|
+
if (lane?.live && lane.watch) return { light: 'hears', by: holder, chip, words: `${holder.lane} hears you` }
|
|
115
|
+
if (session?.live) return { light: 'parent', by: { kind: 'session', session: session.id }, chip, words: `${holder.lane} ${lane?.live ? 'has no watch' : 'ended'}, ${label} hears you` }
|
|
116
|
+
return { light: 'nobody', by: null, chip, words: nobodyWords(repo) }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** a lane that holds a thread and ended while its session lives: the session hears for it, and may resume it */
|
|
120
|
+
export interface Resumable {
|
|
121
|
+
lane: string
|
|
122
|
+
session: string
|
|
123
|
+
id?: string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** the ended lane `h` names, its session alive; null for a session, a live lane, or a lane whose session ended */
|
|
127
|
+
export function resumableOf(h: Holder | null, p: Parties): Resumable | null {
|
|
128
|
+
if (h === null || h.lane === undefined || h.session === undefined) return null
|
|
129
|
+
if (!p.sessions.some((s) => s.id === h.session && s.live)) return null
|
|
130
|
+
const lane = laneIn(p, h.lane, h.session)
|
|
131
|
+
if (lane?.live) return null
|
|
132
|
+
return { lane: h.lane, session: h.session, ...(lane?.id ? { id: lane.id } : {}) }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** the one line that hands his message back to the lane that ended, or to its session */
|
|
136
|
+
export const resumeLine = (r: Resumable, address: string, bin = 'sk'): string =>
|
|
137
|
+
r.id === undefined
|
|
138
|
+
? `his reply on ${r.lane}'s thread ${address}: ${r.lane} cannot be resumed (its agent id not found), take it yourself (${bin} thread take ${address})`
|
|
139
|
+
: `his reply on ${r.lane}'s thread ${address}: resume ${r.lane} (SendMessage to ${r.id}) with it, or take it yourself (${bin} thread take ${address})`
|
|
140
|
+
|
|
141
|
+
/** the party `me` hears what `hearing` says: the one that hears it now */
|
|
142
|
+
export const heardBy = (me: Me, hearing: Hearing, p: Parties): boolean => sameParty(partyOf(me, p), hearing.by)
|
|
143
|
+
|
|
144
|
+
/** rule 4, may mark seen: the holder, or an ancestor of it (the session of a lane that holds it); a thread nobody
|
|
145
|
+
* holds, anyone. Writing is never refused: a word in a thread makes its writer the holder */
|
|
146
|
+
export function maySee(me: Me, h: Holder | null, p: Parties): boolean {
|
|
147
|
+
const holder = h === null ? null : partyOf(h, p)
|
|
148
|
+
if (holder === null) return true
|
|
149
|
+
const m = partyOf(me, p)
|
|
150
|
+
if (m === null) return false
|
|
151
|
+
if (sameParty(m, holder)) return true
|
|
152
|
+
return holder.kind === 'lane' && m.kind === 'session' && m.session === holder.session
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** the tree a click on the chip shows: the holder's session, each of its lanes, which live, which hears */
|
|
156
|
+
export interface TreeRow {
|
|
157
|
+
label: string
|
|
158
|
+
kind: 'session' | 'lane'
|
|
159
|
+
live: boolean
|
|
160
|
+
watch: boolean
|
|
161
|
+
holds: boolean
|
|
162
|
+
hears: boolean
|
|
163
|
+
what?: string
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function treeOf(h: Holder | null, p: Parties, hearing: Hearing): TreeRow[] {
|
|
167
|
+
const holder = h === null ? null : partyOf(h, p)
|
|
168
|
+
if (holder === null) return []
|
|
169
|
+
if (holder.kind === 'lane' && holder.session === null) return [{ label: holder.lane, kind: 'lane', live: false, watch: false, holds: true, hears: false }]
|
|
170
|
+
if (holder.session === null) return []
|
|
171
|
+
const s = p.sessions.find((x) => x.id === holder.session)
|
|
172
|
+
const sid = holder.session
|
|
173
|
+
const top: TreeRow = { label: `${sessionLabel(sid, p)} (${sid.slice(0, 8)})`, kind: 'session', live: s?.live ?? false, watch: s?.watch ?? false, holds: holder.kind === 'session', hears: hearing.by?.kind === 'session' && hearing.by.session === sid }
|
|
174
|
+
const names = [...new Set(p.lanes.filter((l) => l.session === sid).map((l) => l.name))]
|
|
175
|
+
if (holder.kind === 'lane' && !names.includes(holder.lane)) names.push(holder.lane)
|
|
176
|
+
const lanes = names.map((n): TreeRow => {
|
|
177
|
+
const l = laneIn(p, n, sid)
|
|
178
|
+
const holds = holder.kind === 'lane' && holder.lane === n
|
|
179
|
+
return { label: n, kind: 'lane', live: l?.live ?? false, watch: l?.watch ?? false, holds, hears: holds && hearing.light === 'hears', ...(l?.what ? { what: l.what } : {}) }
|
|
180
|
+
})
|
|
181
|
+
return [top, ...lanes.sort((a, b) => Number(b.holds) - Number(a.holds) || Number(b.live) - Number(a.live) || a.label.localeCompare(b.label, undefined, { numeric: true }))]
|
|
182
|
+
}
|
package/src/review/previews.ts
CHANGED
|
@@ -119,8 +119,10 @@ export async function previewFile(dir: string, id: string, name: string, size: P
|
|
|
119
119
|
.toFile(tmp)
|
|
120
120
|
}
|
|
121
121
|
} catch (e) {
|
|
122
|
-
console.error(`FAIL: review ${kind === 'clip' ? 'play copy' : `preview ${size}`} of ${id}/${name}: ${(e as Error).message}`)
|
|
123
122
|
rmSync(tmp, { force: true })
|
|
123
|
+
// its source left while the job ran (the item deleted, its store removed): nothing to make, no failure
|
|
124
|
+
if (!existsSync(src)) return null
|
|
125
|
+
console.error(`FAIL: review ${kind === 'clip' ? 'play copy' : `preview ${size}`} of ${id}/${name}: ${(e as Error).message}`)
|
|
124
126
|
if (kind === 'image') return null
|
|
125
127
|
failed.add(`${out}@${at}`)
|
|
126
128
|
return src
|