rvlib-shipkit 2.28.0 → 2.29.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 +55 -0
- package/package.json +10 -2
- package/src/advisors/acts.ts +277 -0
- package/src/advisors/advice.ts +384 -0
- package/src/advisors/advisor-view.ts +417 -0
- package/src/advisors/app-graph.ts +112 -0
- package/src/advisors/app.ts +75 -0
- package/src/advisors/door.ts +59 -0
- package/src/advisors/edge/api.ts +292 -0
- package/src/advisors/edge/bucket.ts +43 -0
- package/src/advisors/edge/certs.ts +20 -0
- package/src/advisors/edge/form.ts +45 -0
- package/src/advisors/edge/handler.ts +156 -0
- package/src/advisors/edge/jwt.ts +76 -0
- package/src/advisors/edge/shell.ts +27 -0
- package/src/advisors/edge/status.ts +12 -0
- package/src/advisors/edge/types.ts +137 -0
- package/src/advisors/edge/worker.ts +52 -0
- package/src/advisors/expose.ts +150 -0
- package/src/advisors/job.ts +35 -0
- package/src/advisors/owner-store.ts +226 -0
- package/src/advisors/photos.ts +182 -0
- package/src/advisors/project.ts +311 -0
- package/src/advisors/r2.ts +48 -0
- package/src/advisors/routes.ts +469 -0
- package/src/advisors/scan.ts +194 -0
- package/src/advisors/sync.ts +363 -0
- package/src/agent-time/accounts-usage-disk.ts +29 -0
- package/src/agent-time/accounts-usage.ts +97 -0
- package/src/agent-time/hooks.ts +64 -27
- package/src/agent-time/lane-name.ts +7 -0
- package/src/agent-time/leads.ts +95 -0
- package/src/agent-time/registry.ts +106 -41
- package/src/agent-time/render.ts +35 -4
- package/src/agent-time/report-cache.ts +4 -8
- package/src/agent-time/report.ts +19 -1
- package/src/agent-time/store.ts +10 -16
- package/src/annex/snapshots.ts +3 -3
- package/src/annex/tidy.ts +10 -23
- package/src/asks/ask-after.ts +2 -1
- package/src/asks/ask-carry.ts +190 -0
- package/src/asks/ask-close.ts +72 -0
- package/src/asks/ask-doc.ts +42 -0
- package/src/asks/ask-migrate.ts +9 -9
- package/src/asks/ask-steps-fold.ts +71 -114
- package/src/asks/ask-store.ts +170 -53
- package/src/asks/ask-words-fold.ts +208 -0
- package/src/checks/SK001-package-json-shape.check.ts +5 -7
- package/src/checks/SK004-gitignore-policy.check.ts +13 -13
- package/src/checks/SK010-undeclared-unit.check.ts +77 -64
- package/src/checks/SK013-one-way-in-policy.check.ts +20 -8
- package/src/checks/SK027-agent-wiki-links.check.ts +46 -6
- package/src/checks/SK033-global-contribution.check.ts +1 -1
- package/src/checks/SK036-draft-media-size.check.ts +5 -4
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK040-release-words.check.ts +39 -10
- package/src/checks/SK042-post-kinds.check.ts +2 -2
- package/src/checks/SK045-slow-hooks.check.ts +5 -2
- package/src/checks/SK049-thread-answers-hook.check.ts +6 -4
- package/src/checks/SK051-no-formatter.check.ts +485 -0
- package/src/cli/cmd_Advisors.ts +336 -0
- package/src/cli/cmd_Annex.ts +10 -10
- package/src/cli/cmd_Asks.ts +111 -10
- package/src/cli/cmd_Backup.ts +7 -7
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Check.ts +3 -3
- package/src/cli/cmd_Checks.ts +1 -1
- package/src/cli/cmd_Ci.ts +15 -16
- package/src/cli/cmd_Db.ts +9 -9
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_History.ts +2 -2
- package/src/cli/cmd_Home.ts +5 -6
- package/src/cli/cmd_Hooks.ts +13 -3
- package/src/cli/cmd_Hq.ts +30 -19
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +9 -3
- package/src/cli/cmd_Media.ts +59 -13
- package/src/cli/cmd_Orchestrator.ts +138 -0
- package/src/cli/cmd_Rec.ts +5 -2
- package/src/cli/cmd_Reflect.ts +17 -3
- package/src/cli/cmd_Releases.ts +38 -38
- package/src/cli/cmd_Review.ts +690 -316
- package/src/cli/cmd_Shot.ts +14 -6
- package/src/cli/cmd_Social.ts +5 -4
- package/src/cli/cmd_SocialDrafts.ts +23 -10
- package/src/cli/cmd_Space.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +18 -11
- package/src/cli/cmd_ThreadReflect.ts +20 -12
- package/src/cli/cmd_ThreadSyncNeeds.ts +7 -7
- package/src/cli/cmd_Time.ts +2 -1
- package/src/cli/cmd_Tmp.ts +9 -8
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -5
- package/src/cli/cmd_Urls.ts +3 -3
- package/src/cli/cmd_Vault.ts +4 -4
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Worktrees.ts +109 -0
- package/src/cli/registry.ts +15 -4
- package/src/cli.ts +21 -13
- package/src/collections/actions.ts +2 -1
- package/src/collections/checks.ts +1 -1
- package/src/collections/collection-types.ts +16 -5
- package/src/collections/pings.ts +3 -0
- package/src/collections/providers.ts +15 -15
- package/src/collections/review.ts +25 -23
- package/src/collections/state-rules.ts +8 -7
- package/src/comfy/comfy-panel.ts +2 -2
- package/src/commands/model.ts +1 -1
- package/src/commands/routes.ts +1 -1
- package/src/commands/runs.ts +1 -1
- package/src/core/app-icon.ts +3 -9
- package/src/core/atomic-write.ts +36 -0
- package/src/core/budget.ts +16 -1
- package/src/core/bun-builtins.ts +7 -7
- package/src/core/canonical-scripts.ts +4 -6
- package/src/core/check-ctx.ts +17 -3
- package/src/core/day-stamp.ts +20 -0
- package/src/core/git-bin.ts +10 -0
- package/src/core/git.ts +60 -16
- package/src/core/hard-reset.ts +1 -2
- package/src/core/history-files.ts +4 -8
- package/src/core/house-layout.ts +3 -0
- package/src/core/hub-theme.ts +16 -0
- package/src/core/identity.ts +1 -1
- package/src/core/in-base.ts +19 -0
- package/src/core/instance.ts +15 -5
- package/src/core/last-good.ts +42 -133
- package/src/core/layout.ts +1 -1
- package/src/core/load-probe.ts +4 -8
- package/src/core/locked-write.ts +117 -47
- package/src/core/loop-watch.ts +24 -3
- package/src/core/machine-db.ts +54 -12
- package/src/core/machine-link.ts +1 -1
- package/src/core/memory-watch.ts +3 -2
- package/src/core/motherhome.ts +2 -1
- package/src/core/nearest.ts +23 -0
- package/src/core/on-loop.ts +57 -0
- package/src/core/one-way-in-policy.ts +26 -13
- package/src/core/raw-access.ts +9 -2
- package/src/core/reexec.ts +3 -5
- package/src/core/repo-walk.ts +104 -0
- package/src/core/retention.ts +10 -12
- package/src/core/run-dirs.ts +45 -0
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +2 -2
- package/src/core/slug.ts +33 -0
- package/src/core/spawn-timeout.ts +3 -1
- package/src/core/squircle.ts +0 -8
- package/src/core/throwaway-worktree.ts +21 -2
- package/src/core/unit-files.ts +4 -4
- package/src/core/when-block.ts +4 -5
- package/src/core/when.ts +1 -3
- package/src/core/words.ts +33 -0
- package/src/fleet/push-fleet.ts +4 -11
- package/src/{core → gate}/cache-audit.ts +1 -1
- package/src/{core → gate}/check-runner.ts +24 -54
- package/src/{core → gate}/discover-checks.ts +5 -102
- package/src/{core → gate}/discover-legacy-checks.ts +3 -3
- package/src/{ledger → gate}/gate-checks.ts +5 -5
- package/src/gate/head-gate.ts +151 -0
- package/src/{core → gate}/job-follow.ts +1 -1
- package/src/{core → gate}/job-run.ts +3 -3
- package/src/{core → gate}/pre-commit-discovery.ts +2 -2
- package/src/{core → gate}/run-check.ts +7 -7
- package/src/{core → gate}/run-ci.ts +9 -9
- package/src/gate/run-fix.ts +173 -0
- package/src/{core → gate}/run-fixers.ts +14 -14
- package/src/{core → gate}/trace-audit.ts +8 -8
- package/src/home/activity-shape.ts +1 -1
- package/src/home/activity.ts +13 -11
- package/src/home/app-sign.ts +17 -9
- package/src/home/daemon-guard.ts +6 -0
- package/src/home/daemon-jobs.ts +52 -10
- package/src/home/database-words.ts +21 -27
- package/src/home/databases.ts +3 -3
- package/src/home/global-context.ts +2 -2
- package/src/home/global-units.ts +1 -1
- package/src/home/gui-app/ShipkitGui.swift +129 -55
- package/src/home/gui-app.ts +1 -1
- package/src/home/handover.ts +126 -0
- package/src/home/home-move.ts +29 -16
- package/src/home/home-paths.ts +30 -8
- package/src/home/home-routes.ts +75 -5
- package/src/home/home-start.ts +1 -1
- package/src/home/home-state.ts +12 -6
- package/src/home/hubs.ts +28 -5
- package/src/home/inbox-shape.ts +61 -38
- package/src/home/inbox.ts +2 -1
- package/src/home/lib-watch.ts +93 -74
- package/src/home/machine-fold.ts +46 -43
- package/src/home/machine-repair.ts +5 -6
- package/src/home/machine-stores.ts +3 -3
- package/src/home/machine-temp.ts +58 -67
- package/src/home/page-build.ts +330 -0
- package/src/home/page-held.ts +338 -0
- package/src/home/pm-config.ts +10 -2
- package/src/home/pm.ts +35 -1
- package/src/home/process-apps.ts +3 -3
- package/src/home/push-sources.ts +132 -0
- package/src/home/run-daemon.ts +54 -4
- package/src/home/run-pm.ts +2 -1
- package/src/home/run-web.ts +11 -6
- package/src/home/search-shape.ts +54 -0
- package/src/home/search.ts +114 -0
- package/src/home/serve-daemon.ts +40 -18
- package/src/home/serve-web.ts +86 -145
- package/src/home/space-page.ts +7 -7
- package/src/home/space-words.ts +11 -10
- package/src/home/supervise.ts +24 -0
- package/src/home/time-page-shape.ts +0 -13
- package/src/home/vault-page.ts +15 -15
- package/src/home/vault-reveal.ts +29 -0
- package/src/home/vault-words.ts +3 -3
- package/src/home/via-hub.ts +3 -4
- package/src/home/worktree-tidy.ts +236 -0
- package/src/hooks/edit-guard.ts +12 -0
- package/src/hooks/hook-gates.ts +2 -0
- package/src/hooks/leak-guard.ts +9 -3
- package/src/hooks/one-way-in-guard.ts +11 -3
- package/src/hooks/run-hooks.ts +58 -5
- package/src/hooks/shared-file.ts +174 -0
- package/src/{serve → house}/project-gutter.ts +5 -1
- package/src/hq/door-route.ts +2 -2
- package/src/hq/door.ts +3 -3
- package/src/hq/files-send.ts +5 -5
- package/src/hq/forgotten-log.ts +1 -1
- package/src/hq/history-check.ts +7 -6
- package/src/hq/history-send.ts +12 -14
- package/src/hq/hq-db.ts +1 -1
- package/src/hq/hq-local.ts +12 -10
- package/src/hq/hq-routes.ts +1 -1
- package/src/hq/hq-store.ts +4 -4
- package/src/hq/kinds/ask.ts +4 -3
- package/src/hq/kinds/index.ts +4 -4
- package/src/hq/kinds/{card-gone.ts → item-gone.ts} +24 -25
- package/src/hq/kinds/{card-msg.ts → item-msg.ts} +25 -27
- package/src/hq/kinds/{card.ts → item.ts} +31 -29
- package/src/hq/kinds/kind.ts +3 -0
- package/src/hq/kinds/media.ts +2 -3
- package/src/hq/kinds/prompt.ts +2 -1
- package/src/hq/kinds/time-day.ts +5 -4
- package/src/hq/ledger.ts +22 -22
- package/src/hq/machine-notes.ts +14 -15
- package/src/hq/outbox.ts +31 -22
- package/src/hq/report.ts +10 -12
- package/src/hq/switch.ts +20 -23
- package/src/hq/{cards.ts → thread-sync.ts} +127 -99
- package/src/hq/vault-route.ts +1 -1
- package/src/{serve → http}/door-forward.ts +11 -4
- package/src/http/loopback-serve.ts +84 -0
- package/src/{serve → http}/same-origin.ts +3 -2
- package/src/{serve → http}/tailnet-caller.ts +5 -4
- package/src/identities/machine-route.ts +2 -2
- package/src/identities/shown.ts +2 -6
- package/src/ledger/check-table.ts +1 -1
- package/src/ledger/db.ts +1 -0
- package/src/ledger/git-key.ts +9 -3
- package/src/ledger/git-scan.ts +2 -2
- package/src/ledger/ledger.ts +6 -16
- package/src/media-kinds.ts +4 -1
- package/src/media-store/backup/daemon.ts +3 -2
- package/src/media-store/backup/keys.ts +0 -3
- package/src/media-store/backup/manifest.ts +1 -1
- package/src/media-store/backup/prune.ts +15 -18
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/run.ts +8 -27
- package/src/media-store/backup/sources.ts +11 -12
- package/src/media-store/backup/thread-copy.ts +8 -9
- package/src/media-store/backup/watch.ts +10 -6
- package/src/media-store/content.ts +3 -0
- package/src/media-store/copy/night.ts +4 -4
- package/src/media-store/daemon.ts +5 -4
- package/src/media-store/db.ts +10 -20
- package/src/media-store/forget-one.ts +247 -0
- package/src/media-store/forget.ts +23 -4
- package/src/media-store/hq-send.ts +5 -4
- package/src/media-store/purge.ts +2 -2
- package/src/media-store/remote.ts +2 -2
- package/src/media-store/space-listing.ts +0 -5
- package/src/media-store/space.ts +1 -0
- package/src/media-store/tidy.ts +3 -3
- package/src/media-store/upload.ts +2 -2
- package/src/media-store/webp.ts +3 -3
- package/src/messages/objects.ts +5 -3
- package/src/messages/score.ts +1 -3
- package/src/messages/store-doc.ts +114 -0
- package/src/messages/verdicts.ts +6 -0
- package/src/messages/write.ts +3 -3
- package/src/mv/mv-md.ts +43 -12
- package/src/orchestrator/brief.md +29 -0
- package/src/orchestrator/deliver.ts +81 -0
- package/src/orchestrator/drill.ts +129 -0
- package/src/orchestrator/guards.ts +63 -0
- package/src/orchestrator/keeper.ts +332 -0
- package/src/orchestrator/phone.ts +98 -0
- package/src/orchestrator/pm.ts +20 -0
- package/src/orchestrator/presence-shape.ts +17 -0
- package/src/orchestrator/presence.ts +68 -0
- package/src/orchestrator/push.ts +102 -0
- package/src/orchestrator/routes.ts +113 -0
- package/src/orchestrator/state.ts +92 -0
- package/src/orchestrator/switch.ts +86 -0
- package/src/orchestrator/tmux.ts +82 -0
- package/src/orchestrator/unheard.ts +68 -0
- package/src/pages/unit.ts +1 -1
- package/src/plan/repo-source.ts +1 -1
- package/src/recordings/load.ts +1 -1
- package/src/recordings/model.ts +18 -10
- package/src/recordings/place.ts +3 -3
- package/src/recordings/recorder-app/Capture.swift +69 -21
- package/src/recordings/recorder-app/Editor.swift +214 -11
- package/src/recordings/recorder-app/main.swift +229 -47
- package/src/recordings/recorder-app.ts +1 -1
- package/src/recordings/routes.ts +11 -1
- package/src/recordings/take.ts +7 -5
- package/src/recordings/view.ts +6 -0
- package/src/reflect/prompt-corpus.ts +5 -3
- package/src/reflect/thread-words.ts +51 -0
- package/src/reflections/reflection-close.ts +123 -0
- package/src/reflections/reflection-doc.ts +59 -0
- package/src/reflections/reflection-place.ts +60 -0
- package/src/release/gate-checkout.ts +122 -20
- package/src/release/git-facts.ts +9 -8
- package/src/release/machine-words.ts +21 -3
- package/src/release/public-clean.ts +78 -19
- package/src/release/run-bump.ts +3 -5
- package/src/release/run-release.ts +42 -38
- package/src/releases/add.ts +33 -87
- package/src/releases/{from-card.ts → from-thread.ts} +47 -46
- package/src/releases/model.ts +207 -36
- package/src/releases/routes.ts +2 -2
- package/src/releases/shape.ts +184 -0
- package/src/releases/store.ts +10 -10
- package/src/repo-config.ts +13 -3
- package/src/review/anim.ts +7 -7
- package/src/review/answer-kinds.ts +39 -10
- package/src/review/auto.ts +3 -3
- package/src/review/band.ts +95 -3
- package/src/review/branch-hold.ts +12 -5
- package/src/review/cells.ts +169 -46
- package/src/review/doc-card.ts +41 -0
- package/src/review/doc-model.ts +100 -0
- package/src/review/doc-routes.ts +66 -0
- package/src/review/doc-save.ts +152 -0
- package/src/review/{draft-card.ts → draft-item.ts} +10 -7
- package/src/review/draft-model.ts +125 -17
- package/src/review/events.ts +5 -12
- package/src/review/file-tags.ts +52 -0
- package/src/review/format.ts +84 -41
- package/src/review/gone.ts +20 -20
- package/src/review/hand-over.ts +58 -0
- package/src/review/heard.ts +29 -0
- package/src/review/house-kind-defs.ts +34 -4
- package/src/review/http.ts +1 -1
- package/src/review/inbox-hook.ts +55 -9
- package/src/review/inbox-read.ts +38 -13
- package/src/review/instructions.ts +42 -0
- package/src/review/{card-db.ts → item-db.ts} +32 -30
- package/src/review/{card-rows.ts → item-rows.ts} +77 -50
- package/src/review/kind-still.ts +125 -0
- package/src/review/kinds.ts +46 -10
- package/src/review/lane-ask.ts +6 -2
- package/src/review/live-post.ts +107 -0
- package/src/review/live-view.ts +137 -0
- package/src/review/media-kind.ts +4 -4
- package/src/review/media-read.ts +4 -4
- package/src/review/media.ts +3 -5
- package/src/review/mentions.ts +100 -0
- package/src/review/model-moved.ts +76 -0
- package/src/review/model.ts +471 -149
- package/src/review/move.ts +59 -58
- package/src/review/need-address.ts +5 -5
- package/src/review/need-threads.ts +15 -57
- package/src/review/notes.ts +2 -1
- package/src/review/one-block.ts +64 -0
- package/src/review/owner-read.ts +41 -0
- package/src/review/owner-verdict.ts +3 -3
- package/src/review/parties.ts +101 -9
- package/src/review/paste.ts +4 -4
- package/src/review/phone-push.ts +137 -0
- package/src/review/previews.ts +16 -16
- package/src/review/project.ts +1 -1
- package/src/review/push.ts +269 -0
- package/src/review/referring.ts +26 -4
- package/src/review/reflection-object.ts +13 -18
- package/src/review/rev.ts +1 -1
- package/src/review/role.ts +3 -3
- package/src/review/routes.ts +113 -74
- package/src/review/search-index.ts +218 -0
- package/src/review/search-job.ts +40 -0
- package/src/review/search-ocr.ts +138 -0
- package/src/review/search-text.ts +129 -0
- package/src/review/secret-route.ts +44 -14
- package/src/review/settle.ts +67 -0
- package/src/review/stage-routes.ts +15 -13
- package/src/review/{stage-card.ts → stage-thread.ts} +18 -17
- package/src/review/store-index.ts +49 -0
- package/src/review/store-parties.ts +20 -0
- package/src/review/store.ts +394 -214
- package/src/review/supersede.ts +23 -7
- package/src/review/take-back.ts +19 -6
- package/src/review/threads.ts +184 -63
- package/src/review/traces.ts +21 -33
- package/src/review/trailer-desk.ts +7 -7
- package/src/review/{trailer-card.ts → trailer-item.ts} +10 -10
- package/src/review/trailer-model.ts +4 -4
- package/src/review/trailer-notes.ts +2 -2
- package/src/review/trailer-routes.ts +5 -4
- package/src/review/trailer-shots.ts +3 -3
- package/src/review/unit.ts +70 -9
- package/src/review/uploads.ts +103 -0
- package/src/review/verdict-items.ts +2 -2
- package/src/review/verdict-write.ts +1 -1
- package/src/review/view-layout.ts +69 -0
- package/src/review/wait.ts +11 -5
- package/src/review/wakes.ts +115 -0
- package/src/review/watch-feed.ts +183 -0
- package/src/review/watchers.ts +27 -6
- package/src/rules/untrack-generated.ts +40 -39
- package/src/scaffold/files/bunfig.toml +1 -9
- package/src/scaffold/files/vscode-settings.json +1 -1
- package/src/scaffold/project-scaffold.ts +14 -10
- package/src/secrets/archive.ts +2 -1
- package/src/secrets/keychain-write.ts +11 -3
- package/src/secrets/lapse-mark.ts +8 -3
- package/src/secrets/lapse.ts +26 -15
- package/src/secrets/security-line.ts +19 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/house-runs.ts +1 -1
- package/src/serve/hub-app/accounts-line.tsx +67 -0
- package/src/serve/hub-app/activity-st.ts +46 -50
- package/src/serve/hub-app/advice-box.tsx +66 -0
- package/src/serve/hub-app/advisor-app.tsx +46 -0
- package/src/serve/hub-app/advisor-face.tsx +29 -0
- package/src/serve/hub-app/advisor-host.ts +142 -0
- package/src/serve/hub-app/advisor.html +22 -0
- package/src/serve/hub-app/advisors-st.ts +261 -0
- package/src/serve/hub-app/advisors-view.tsx +269 -0
- package/src/serve/hub-app/advisors.css +57 -0
- package/src/serve/hub-app/app-bridge.ts +27 -24
- package/src/serve/hub-app/ask-steps-st.ts +60 -0
- package/src/serve/hub-app/ask-steps.tsx +23 -0
- package/src/serve/hub-app/asks-page.tsx +8 -5
- package/src/serve/hub-app/asks-st.ts +1 -4
- package/src/serve/hub-app/auto-text.tsx +106 -14
- package/src/serve/hub-app/checks-svc.ts +1 -1
- package/src/serve/hub-app/clock-svc.ts +21 -5
- package/src/serve/hub-app/code-copy.ts +173 -12
- package/src/serve/hub-app/col-card.tsx +14 -21
- package/src/serve/hub-app/col-list-page.tsx +2 -2
- package/src/serve/hub-app/col-list-st.ts +6 -1
- package/src/serve/hub-app/col-tables.ts +14 -8
- package/src/serve/hub-app/cols-svc.ts +11 -1
- package/src/serve/hub-app/comfy-svc.ts +3 -2
- package/src/serve/hub-app/commands/commands-st.ts +36 -26
- package/src/serve/hub-app/controls.css +27 -11
- package/src/serve/hub-app/cursor-spot.ts +81 -0
- package/src/serve/hub-app/database-st.ts +31 -26
- package/src/serve/hub-app/database-view.tsx +12 -12
- package/src/serve/hub-app/dock-st.ts +51 -10
- package/src/serve/hub-app/dock-view.tsx +14 -1
- package/src/serve/hub-app/editor/doc-editor-st.ts +223 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +116 -0
- package/src/serve/hub-app/editor/doc-saved.tsx +26 -0
- package/src/serve/hub-app/editor/doc-slot.ts +66 -0
- package/src/serve/hub-app/editor.css +36 -0
- package/src/serve/hub-app/emoji-names.ts +1915 -0
- package/src/serve/hub-app/emoji.ts +133 -0
- package/src/serve/hub-app/floating.tsx +162 -6
- package/src/serve/hub-app/git-st.ts +25 -19
- package/src/serve/hub-app/hash-route.ts +1 -1
- package/src/serve/hub-app/header-bar.tsx +4 -3
- package/src/serve/hub-app/held-keys.ts +25 -0
- package/src/serve/hub-app/home-st.ts +114 -16
- package/src/serve/hub-app/home-strip.css +3 -2
- package/src/serve/hub-app/home-strip.tsx +5 -2
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +56 -6
- package/src/serve/hub-app/hub.css +67 -31
- package/src/serve/hub-app/icons.tsx +10 -0
- package/src/serve/hub-app/identities-st.ts +35 -25
- package/src/serve/hub-app/identities-view.tsx +9 -6
- package/src/serve/hub-app/inbox-st.ts +39 -11
- package/src/serve/hub-app/inbox-view.tsx +10 -5
- package/src/serve/hub-app/inbox.css +6 -3
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/insights-st.ts +27 -19
- package/src/serve/hub-app/instructions.css +9 -6
- package/src/serve/hub-app/kept-folds.ts +43 -0
- package/src/serve/hub-app/keys.ts +9 -3
- package/src/serve/hub-app/later.tsx +1 -1
- package/src/serve/hub-app/layout-st.ts +37 -6
- package/src/serve/hub-app/list-filter.tsx +1 -1
- package/src/serve/hub-app/live-bar.css +12 -0
- package/src/serve/hub-app/live-svc.ts +12 -2
- package/src/serve/hub-app/machine-st.ts +36 -10
- package/src/serve/hub-app/machines-st.ts +40 -34
- package/src/serve/hub-app/machines-view.tsx +5 -5
- package/src/serve/hub-app/markdown.css +81 -4
- package/src/serve/hub-app/md.ts +155 -9
- package/src/serve/hub-app/media-svc.ts +44 -11
- package/src/serve/hub-app/messages/messages-page.tsx +56 -12
- package/src/serve/hub-app/messages/messages-st.ts +26 -22
- package/src/serve/hub-app/new-thread.tsx +121 -0
- package/src/serve/hub-app/objects.css +1 -0
- package/src/serve/hub-app/orchestrator-line.tsx +104 -0
- package/src/serve/hub-app/orchestrator.css +37 -0
- package/src/serve/hub-app/page-keys.ts +7 -4
- package/src/serve/hub-app/page-reload.ts +111 -0
- package/src/serve/hub-app/pages-frames.tsx +2 -1
- package/src/serve/hub-app/pages-svc.ts +8 -3
- package/src/serve/hub-app/palette-st.ts +7 -2
- package/src/serve/hub-app/pane-boundary.tsx +13 -0
- package/src/serve/hub-app/pane-errors.ts +2 -1
- package/src/serve/hub-app/pano.css +20 -0
- package/src/serve/hub-app/plan-view.tsx +1 -1
- package/src/serve/hub-app/planned-st.ts +30 -26
- package/src/serve/hub-app/planned-view.tsx +16 -9
- package/src/serve/hub-app/polled.ts +201 -0
- package/src/serve/hub-app/presence-st.ts +110 -0
- package/src/serve/hub-app/project-list.css +98 -55
- package/src/serve/hub-app/project-list.tsx +136 -149
- package/src/serve/hub-app/projects-svc.ts +109 -57
- package/src/serve/hub-app/push-sign.tsx +15 -0
- package/src/serve/hub-app/push-svc.ts +273 -0
- package/src/serve/hub-app/quiet-st.ts +59 -0
- package/src/serve/hub-app/rail-fly.tsx +95 -0
- package/src/serve/hub-app/reach.ts +16 -0
- package/src/serve/hub-app/recordings-st.ts +169 -9
- package/src/serve/hub-app/recordings-take.ts +58 -0
- package/src/serve/hub-app/recordings-view.tsx +42 -35
- package/src/serve/hub-app/recordings.css +1 -1
- package/src/serve/hub-app/reflections-page.tsx +16 -4
- package/src/serve/hub-app/releases/releases-page.tsx +52 -19
- package/src/serve/hub-app/releases/releases-st.ts +39 -26
- package/src/serve/hub-app/releases.css +4 -0
- package/src/serve/hub-app/repo-sections.ts +21 -10
- package/src/serve/hub-app/repo-st.ts +36 -9
- package/src/serve/hub-app/review/advisor-bar.tsx +40 -0
- package/src/serve/hub-app/review/attach-st.ts +195 -0
- package/src/serve/hub-app/review/attach-view.tsx +260 -0
- package/src/serve/hub-app/review/clip-st.ts +1 -1
- package/src/serve/hub-app/review/cta.tsx +11 -0
- package/src/serve/hub-app/review/diff-view.tsx +37 -35
- package/src/serve/hub-app/review/doc-body.tsx +109 -0
- package/src/serve/hub-app/review/dock.tsx +36 -22
- package/src/serve/hub-app/review/draft-body.tsx +235 -0
- package/src/serve/hub-app/review/faces.tsx +26 -0
- package/src/serve/hub-app/review/group-block.tsx +75 -45
- package/src/serve/hub-app/review/heard-line.tsx +31 -0
- package/src/serve/hub-app/review/instructions-view.tsx +57 -32
- package/src/serve/hub-app/review/item-verdict.tsx +99 -26
- package/src/serve/hub-app/review/kind-states.tsx +148 -76
- package/src/serve/hub-app/review/kind-view.tsx +22 -7
- package/src/serve/hub-app/review/kit.tsx +4 -28
- package/src/serve/hub-app/review/lane-bar.tsx +4 -4
- package/src/serve/hub-app/review/lightbox.tsx +16 -0
- package/src/serve/hub-app/review/line-window.ts +149 -0
- package/src/serve/hub-app/review/live-bar-st.ts +145 -0
- package/src/serve/hub-app/review/live-bar.tsx +126 -0
- package/src/serve/hub-app/review/live-view.tsx +104 -0
- package/src/serve/hub-app/review/mention-st.ts +85 -0
- package/src/serve/hub-app/review/mesh-view.tsx +9 -0
- package/src/serve/hub-app/review/object-panel.tsx +35 -17
- package/src/serve/hub-app/review/pano-gl.ts +145 -0
- package/src/serve/hub-app/review/pano-view.tsx +192 -0
- package/src/serve/hub-app/review/phone-top.tsx +16 -0
- package/src/serve/hub-app/review/pictures-st.ts +38 -0
- package/src/serve/hub-app/review/question-views.tsx +107 -105
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +169 -111
- package/src/serve/hub-app/review/review-host.ts +69 -0
- package/src/serve/hub-app/review/review-kit.ts +34 -19
- package/src/serve/hub-app/review/review-list.tsx +123 -20
- package/src/serve/hub-app/review/review-page.tsx +7 -18
- package/src/serve/hub-app/review/review-st.ts +241 -138
- package/src/serve/hub-app/review/review-thread.tsx +463 -150
- package/src/serve/hub-app/review/review-views.tsx +540 -449
- package/src/serve/hub-app/review/scene-view.tsx +26 -0
- package/src/serve/hub-app/review/secret-facts.ts +26 -0
- package/src/serve/hub-app/review/space3d.tsx +114 -0
- package/src/serve/hub-app/review/splat-view.tsx +9 -0
- package/src/serve/hub-app/review/superseded-runs.ts +76 -0
- package/src/serve/hub-app/review/thread-close.tsx +17 -7
- package/src/serve/hub-app/review/thread-control-st.ts +2 -1
- package/src/serve/hub-app/review/thread-st.ts +528 -158
- package/src/serve/hub-app/review/thread-views.ts +71 -0
- package/src/serve/hub-app/review/{trailer-card.tsx → trailer-body.tsx} +34 -34
- package/src/serve/hub-app/review/trailer-page.tsx +23 -25
- package/src/serve/hub-app/review/trailer-st.ts +38 -38
- package/src/serve/hub-app/review/trailer-timeline.tsx +23 -19
- package/src/serve/hub-app/review/trailer-voices.tsx +3 -2
- package/src/serve/hub-app/review.css +259 -147
- package/src/serve/hub-app/search-st.ts +138 -0
- package/src/serve/hub-app/search-view.tsx +92 -0
- package/src/serve/hub-app/section-head.tsx +5 -4
- package/src/serve/hub-app/shell-rows.ts +126 -0
- package/src/serve/hub-app/site/site-st.ts +18 -23
- package/src/serve/hub-app/social/comms-page.tsx +14 -11
- package/src/serve/hub-app/social/group-editor.tsx +44 -0
- package/src/serve/hub-app/social/kit.tsx +7 -46
- package/src/serve/hub-app/social/next-release.tsx +2 -2
- package/src/serve/hub-app/social/post-card.tsx +16 -52
- package/src/serve/hub-app/social/problems.tsx +5 -4
- package/src/serve/hub-app/social/social-page.tsx +3 -3
- package/src/serve/hub-app/social/social-st.ts +31 -84
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social/stage-st.ts +9 -9
- package/src/serve/hub-app/social.css +0 -8
- package/src/serve/hub-app/space-st.ts +38 -48
- package/src/serve/hub-app/space-view.tsx +6 -6
- package/src/serve/hub-app/stores/stores-page.tsx +4 -4
- package/src/serve/hub-app/stores/stores-st.ts +19 -23
- package/src/serve/hub-app/terminal-input.ts +12 -0
- package/src/serve/hub-app/terminal-panel.tsx +40 -0
- package/src/serve/hub-app/terminal-st.ts +416 -0
- package/src/serve/hub-app/terminal.css +15 -0
- package/src/serve/hub-app/tests-svc.ts +3 -2
- package/src/serve/hub-app/theme-st.ts +1 -9
- package/src/serve/hub-app/thread-row.tsx +52 -17
- package/src/serve/hub-app/time-ago.tsx +39 -16
- package/src/serve/hub-app/time-st.ts +43 -27
- package/src/serve/hub-app/time-view.tsx +3 -3
- package/src/serve/hub-app/tree-build.ts +2 -2
- package/src/serve/hub-app/tree-row.tsx +43 -18
- package/src/serve/hub-app/tree-svc.ts +1 -1
- package/src/serve/hub-app/urls-svc.ts +6 -5
- package/src/serve/hub-app/vault-st.ts +32 -27
- package/src/serve/hub-app/vault-view.tsx +53 -2
- package/src/serve/hub-app/vault.css +2 -0
- package/src/serve/hub-app/veille/veille-page.tsx +4 -4
- package/src/serve/hub-app/veille/veille-st.ts +56 -49
- package/src/serve/hub-app/view-layout.css +90 -0
- package/src/serve/hub-app/waiting-svc.ts +2 -1
- package/src/serve/hub-app/wiki-st.ts +3 -2
- package/src/serve/hub-app/wikis-view.tsx +18 -15
- package/src/serve/hub-app/words.tsx +15 -0
- package/src/serve/hub-collections.ts +105 -0
- package/src/serve/hub-runtime.ts +67 -89
- package/src/serve/live-hop.ts +102 -0
- package/src/serve/other-repos.ts +1 -1
- package/src/serve/project-gutter-route.ts +53 -40
- package/src/serve/read-thread.ts +76 -0
- package/src/serve/read-worker.ts +53 -0
- package/src/serve/run-serve.ts +11 -7
- package/src/serve/secret-gate.ts +3 -3
- package/src/serve/serve-hub.ts +103 -34
- package/src/serve/terminal-guard.ts +50 -0
- package/src/serve/terminal-route.ts +176 -0
- package/src/shipkit.ts +8 -8
- package/src/shot/client.ts +32 -16
- package/src/shot/dom-clip.ts +30 -5
- package/src/shot/film-box.ts +23 -8
- package/src/shot/serve-shot.ts +16 -5
- package/src/shot/shooter.ts +72 -24
- package/src/shot/shot-ask.ts +17 -6
- package/src/shot/shot-guard.ts +53 -0
- package/src/shot/shot-theme.ts +70 -0
- package/src/shot/still-file.ts +60 -0
- package/src/site/desk.ts +4 -3
- package/src/social/compose.ts +13 -7
- package/src/social/cover.ts +4 -3
- package/src/social/desk-index.ts +2 -2
- package/src/social/draft-doc.ts +88 -0
- package/src/social/draft-versions.ts +80 -0
- package/src/social/drafts.ts +22 -4
- package/src/social/fit.ts +4 -3
- package/src/social/house.ts +1 -1
- package/src/social/import-drafts.ts +1 -1
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +21 -13
- package/src/social/media-facts.ts +1 -19
- package/src/social/media-kind.ts +2 -2
- package/src/social/media-limit.ts +3 -18
- package/src/social/no-account.ts +38 -0
- package/src/social/post-sources.ts +4 -4
- package/src/social/post-text.ts +33 -13
- package/src/social/posts.ts +73 -18
- package/src/social/presence.ts +10 -8
- package/src/social/release-stage.ts +22 -22
- package/src/social/routes.ts +12 -30
- package/src/social/stage.ts +3 -3
- package/src/social/stats.ts +3 -4
- package/src/social/strip.ts +4 -6
- package/src/social/text.ts +2 -1
- package/src/social/{card-drafts.ts → thread-drafts.ts} +3 -3
- package/src/social/unit.ts +12 -3
- package/src/social/writes.ts +0 -6
- package/src/start-repo.ts +33 -13
- package/src/stores/desk.ts +1 -1
- package/src/suite/core-counters.ts +31 -3
- package/src/suite/judge-suites.ts +69 -47
- package/src/suite/select.ts +1 -27
- package/src/suite/suite-cli.ts +18 -8
- package/src/suite/suite-cpu-preload.ts +10 -6
- package/src/trace/tracer.ts +4 -5
- package/src/trailer/build.ts +30 -15
- package/src/trailer/ffmpeg.ts +90 -31
- package/src/trailer/fonts.ts +5 -6
- package/src/trailer/footage.ts +9 -3
- package/src/trailer/grammar.ts +2 -1
- package/src/trailer/graph.ts +12 -10
- package/src/trailer/load-unit.ts +1 -1
- package/src/trailer/passage.ts +4 -3
- package/src/trailer/prune.ts +4 -4
- package/src/trailer/score/sound.ts +3 -3
- package/src/trailer/shot-plan.ts +5 -5
- package/src/trailer/shot-state.ts +25 -31
- package/src/trailer/sound/eleven.ts +2 -1
- package/src/trailer/sound/gen.ts +3 -3
- package/src/trailer/sound/run.ts +76 -64
- package/src/trailer/sound/takes.ts +0 -3
- package/src/trailer/take-fault.ts +41 -0
- package/src/trailer/titles.ts +17 -13
- package/src/trailer/url.ts +1 -1
- package/src/trailer/vertical-draw.ts +7 -7
- package/src/trailer/vertical.ts +3 -3
- package/src/trailer/vocab.ts +3 -4
- package/src/ts/config.ts +60 -24
- package/src/ts/cycles.ts +3 -1
- package/src/ts/imports.ts +17 -3
- package/src/ts/rename.ts +6 -7
- package/src/ts/source-graph.ts +15 -9
- package/src/ts/workspaces.ts +26 -0
- package/src/tui/build-steps-panel.ts +3 -3
- package/src/tui/checks-panel.ts +2 -2
- package/src/urls/frame.ts +3 -3
- package/src/urls/routes.ts +1 -1
- package/src/urls/rows.ts +1 -1
- package/src/vault/house-keys.ts +1 -1
- package/src/vault/vault-audit.ts +2 -3
- package/src/vault/vault-config.ts +6 -2
- package/src/vault/vault-restore.ts +3 -9
- package/src/vault/vault-serve.ts +47 -11
- package/src/vault/vault-snapshot.ts +5 -14
- package/src/veille/desk.ts +2 -2
- package/src/veille/routes.ts +1 -1
- package/src/view3d/cam.ts +101 -0
- package/src/view3d/lib.ts +69 -0
- package/src/view3d/loop.ts +39 -0
- package/src/view3d/scene-cache.ts +62 -0
- package/src/view3d/viewer.ts +480 -0
- package/src/wiki/agent-paths.ts +55 -0
- package/src/wiki/run-wiki.ts +4 -1
- package/src/wiki/serve-graph.ts +2 -3
- package/src/core/run-fix.ts +0 -120
- package/src/home/hmr-keep.ts +0 -134
- package/src/serve/hub-app/review/draft-card.tsx +0 -163
- package/src/serve/hub-app/review/note-place.ts +0 -31
- /package/src/{serve → http}/door-names.ts +0 -0
- /package/src/{serve → http}/hub-port.ts +0 -0
package/src/review/model.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { HoldsOpen } from './holds.ts'
|
|
|
9
9
|
import type { StepChoice } from './instructions.ts'
|
|
10
10
|
import { versionOf } from '../trailer/versions.ts'
|
|
11
11
|
import { SECRET_NAME } from '../secrets/name.ts'
|
|
12
|
+
import type { ViewLive } from './live-view.ts'
|
|
12
13
|
|
|
13
14
|
/** WHAT is judged: `shot` (a plain image or clip), `screen`, `frame` (a frame of a trailer cut), or a kind a repo names
|
|
14
15
|
* for itself (a game's place, creature, song...), read as is */
|
|
@@ -42,7 +43,7 @@ export interface StoreSubject extends Subject {
|
|
|
42
43
|
|
|
43
44
|
export const isStoreSubject = (s: Subject): s is StoreSubject => s.kind === 'store' && typeof s.store === 'string' && typeof s.asset === 'string'
|
|
44
45
|
|
|
45
|
-
/** a public post he asked for from a
|
|
46
|
+
/** a public post he asked for from a thread: `card` the thread's first version, so every later version asks the same */
|
|
46
47
|
export interface PostSubject extends Subject {
|
|
47
48
|
kind: 'post'
|
|
48
49
|
card: string
|
|
@@ -72,6 +73,18 @@ export interface KindAction {
|
|
|
72
73
|
words?: boolean
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
/** an act of the owner on a version of a kind that answers its versions with its own acts (a draft: publish, drop,
|
|
77
|
+
* edit, ask a change) in place of the generic verdict (review/settle.ts) */
|
|
78
|
+
export interface KindAct {
|
|
79
|
+
label: string
|
|
80
|
+
/** what it does, one line: the button's tooltip */
|
|
81
|
+
what: string
|
|
82
|
+
/** done on a spot of the version (a place of a draft), it settles that spot; every spot settled is his yes */
|
|
83
|
+
settles?: true
|
|
84
|
+
/** the owner's words ride with it: the reply box's chip names the spot */
|
|
85
|
+
words?: true
|
|
86
|
+
}
|
|
87
|
+
|
|
75
88
|
/** one kind of object a thread is about, declared once (wiki tools/shipkit/threads-how-it-fits.md, Kinds): the house's
|
|
76
89
|
* (review/kinds.ts) and a repo's `review({ kinds })` the same way. The pure part the model, the store and the hub read;
|
|
77
90
|
* review/unit.ts adds what runs on the server (read, apply, the data view) */
|
|
@@ -87,7 +100,7 @@ export interface SpecKind {
|
|
|
87
100
|
address?: string
|
|
88
101
|
/** what names one subject of this kind exactly, the kind left out; null names nothing */
|
|
89
102
|
key?(s: Subject): string | null
|
|
90
|
-
/** two subjects of this kind, in one topic, close enough to be one
|
|
103
|
+
/** two subjects of this kind, in one topic, close enough to be one thread */
|
|
91
104
|
near?(a: Subject, b: Subject): boolean
|
|
92
105
|
/** what is wrong with a subject of this kind; empty: nothing */
|
|
93
106
|
problems?(s: Subject): string[]
|
|
@@ -101,6 +114,8 @@ export interface SpecKind {
|
|
|
101
114
|
questions?: Record<string, KindQuestion>
|
|
102
115
|
/** the buttons on an object of this kind, by name */
|
|
103
116
|
actions?: Record<string, KindAction>
|
|
117
|
+
/** its versions answered by these acts, by name, never by approve, fix, reject (review/settle.ts); none: the verdict */
|
|
118
|
+
acts?: Record<string, KindAct>
|
|
104
119
|
/** an object of this kind attached to a thread holds it open until its condition is met (review/holds.ts) */
|
|
105
120
|
holdsOpen?: HoldsOpen
|
|
106
121
|
}
|
|
@@ -124,6 +139,7 @@ export interface Spec {
|
|
|
124
139
|
/** the house kinds: review/kinds.ts owns them, the one registry */
|
|
125
140
|
export { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
|
|
126
141
|
import { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
|
|
142
|
+
import { settlingOf } from './settle.ts'
|
|
127
143
|
|
|
128
144
|
export const NO_SPEC: Spec = { kinds: {}, topics: {}, dispatcher: false }
|
|
129
145
|
|
|
@@ -133,7 +149,7 @@ export const subjectLabel = (kind: string, spec: Spec = NO_SPEC): string => (spe
|
|
|
133
149
|
/** a topic's words, its id when no unit names it */
|
|
134
150
|
export const topicLabel = (topic: string, spec: Spec = NO_SPEC): string => spec.topics[topic]?.label ?? topic
|
|
135
151
|
|
|
136
|
-
/** WHO raised it: an agent's
|
|
152
|
+
/** WHO raised it: an agent's version goes back to its lane on a rejection */
|
|
137
153
|
export type Origin =
|
|
138
154
|
| { by: 'agent'; lane?: string; session?: string }
|
|
139
155
|
| { by: 'owner'; from: string; kind?: string; lane?: string }
|
|
@@ -150,7 +166,7 @@ const canonical = new Map<string, string | null>()
|
|
|
150
166
|
|
|
151
167
|
/** an address in its one form, null when it is none (wiki tools/shipkit/threads-store.md, Addresses): trimmed and
|
|
152
168
|
* lowercased, no space around the colon, no empty or trailing `/`; a cut's file is its cut, a bare kept version the main
|
|
153
|
-
* cut (`trailer:x/v15`); `page:review` is `page:threads
|
|
169
|
+
* cut (`trailer:x/v15`); `page:review` is `page:threads`, `topic:<slug>` is `talk:<slug>`. Every address written, read or compared goes through it */
|
|
154
170
|
export function canonicalAddress(raw: string): string | null {
|
|
155
171
|
const held = canonical.get(raw)
|
|
156
172
|
if (held !== undefined) return held
|
|
@@ -171,6 +187,8 @@ export function canonicalAddress(raw: string): string | null {
|
|
|
171
187
|
if (kind === 'ask') key = key.replace(/\.md$/, '')
|
|
172
188
|
let out: string | null = `${kind}:${key}`
|
|
173
189
|
if (out === 'page:review' || out.startsWith('page:review/')) out = `page:threads${out.slice('page:review'.length)}`
|
|
190
|
+
// a conversation in words is one kind: a thread an advisor's proposal opened was `topic:<slug>`
|
|
191
|
+
if (out.startsWith('topic:')) out = `talk:${out.slice('topic:'.length)}`
|
|
174
192
|
if (!/^[a-z][a-z0-9-]*$/.test(kind) || key === '' || /\s/.test(key) || !ADDRESS_RE.test(out)) out = null
|
|
175
193
|
canonical.set(raw, out)
|
|
176
194
|
return out
|
|
@@ -179,6 +197,8 @@ export function canonicalAddress(raw: string): string | null {
|
|
|
179
197
|
/** an address as typed, in its one form, or a one line refusal that names the form */
|
|
180
198
|
export function addressOrThrow(raw: string): string {
|
|
181
199
|
const a = canonicalAddress(raw)
|
|
200
|
+
const retired = a === null ? undefined : BUILTIN_KINDS[a.slice(0, a.indexOf(':'))]?.retired
|
|
201
|
+
if (retired !== undefined) throw new Error(`${a}: ${retired}`)
|
|
182
202
|
if (a !== null) return a
|
|
183
203
|
const colon = raw.indexOf(':')
|
|
184
204
|
if (colon > 0 && /\s/.test(raw.slice(colon + 1).trim())) throw new Error(`« ${raw.trim()} »: an address has no space: ${raw.trim().replace(/\s*:\s*/, ':').replace(/\s+/g, '-').toLowerCase()} ?`)
|
|
@@ -189,10 +209,10 @@ export function addressOrThrow(raw: string): string {
|
|
|
189
209
|
const canon = (a: string): string => canonicalAddress(a) ?? a
|
|
190
210
|
|
|
191
211
|
/** a trailer's cut as an address: a kept version names the cut it was kept from, so every version is one thread. A
|
|
192
|
-
*
|
|
212
|
+
* version names its cut itself; a name alone (an older version, a frame note) is read as a kept version when it reads as one */
|
|
193
213
|
export const cutAddress = (trailer: string, cut: string, of?: string): string => canon(`trailer:${trailer}/${of ?? versionOf(cut)?.cut ?? cut}`)
|
|
194
214
|
|
|
195
|
-
/** the address that is an item's own: the one its agent named, else its subject's (a trailer
|
|
215
|
+
/** the address that is an item's own: the one its agent named, else its subject's (a trailer version or a frame note: the
|
|
196
216
|
* cut); null when it names none (a plain shot). One thread per own address */
|
|
197
217
|
export function ownAddressOf(i: Item, spec: Spec = NO_SPEC): string | null {
|
|
198
218
|
if (i.on !== undefined) return canon(i.on)
|
|
@@ -251,6 +271,30 @@ export interface ReviewAudio {
|
|
|
251
271
|
waveBefore?: string
|
|
252
272
|
}
|
|
253
273
|
|
|
274
|
+
/** a view he looks around in rather than at: the kind names the viewer the hub draws (serve/hub-app/review/scene-view.tsx).
|
|
275
|
+
* `pano`: the view's one image is an equirectangular panorama, twice as wide as tall, seen from its center. `splat` (a
|
|
276
|
+
* Gaussian splat, .ply or .spz) and `mesh` (a .glb): the view's image is its poster, `file` the 3D file beside it in the
|
|
277
|
+
* folder, loaded only in the lightbox (view3d/viewer.ts) */
|
|
278
|
+
export type ReviewScene = { kind: 'pano' } | { kind: 'splat' | 'mesh'; file: string }
|
|
279
|
+
|
|
280
|
+
export const SCENE_KINDS: readonly ReviewScene['kind'][] = ['pano', 'splat', 'mesh']
|
|
281
|
+
|
|
282
|
+
/** what each scene is called where he reads it */
|
|
283
|
+
export const SCENE_WORDS: Record<ReviewScene['kind'], string> = { pano: '360°', splat: 'splat', mesh: '3D mesh' }
|
|
284
|
+
|
|
285
|
+
/** the 3D files a scene takes, by its kind */
|
|
286
|
+
export const SPACE_EXT: Record<'splat' | 'mesh', RegExp> = { splat: /\.(ply|spz)$/i, mesh: /\.glb$/i }
|
|
287
|
+
|
|
288
|
+
/** a scene's 3D file in the item's folder: `space.<ext>` on the first view, `v<n>-space.<ext>` on a later one */
|
|
289
|
+
export const SPACE_RE = /^(v\d+-)?space\.(ply|spz|glb)$/
|
|
290
|
+
|
|
291
|
+
/** how far a panorama's width may be from twice its height, as a share */
|
|
292
|
+
export const PANO_SLACK = 0.02
|
|
293
|
+
|
|
294
|
+
/** why an image of this size is no equirectangular panorama, null when it is one */
|
|
295
|
+
export const panoRefusal = (size: { w: number; h: number }): string | null =>
|
|
296
|
+
Math.abs(size.w / size.h - 2) <= 2 * PANO_SLACK ? null : `${size.w}x${size.h}: an equirectangular panorama is twice as wide as tall (2:1)`
|
|
297
|
+
|
|
254
298
|
/** a ring a repo drew over its own shot (a game's world tiles): its center normalized 0..1, its radius as a share of
|
|
255
299
|
* the image width; `side` only on a pair */
|
|
256
300
|
export interface ReviewMark {
|
|
@@ -262,18 +306,22 @@ export interface ReviewMark {
|
|
|
262
306
|
side?: Side
|
|
263
307
|
}
|
|
264
308
|
|
|
265
|
-
/** one view of a
|
|
309
|
+
/** one view of a version's subject: an image or a pair, its size, its marks; the first view's label may be empty */
|
|
266
310
|
export interface MediaView {
|
|
267
311
|
label: string
|
|
268
312
|
files: ReviewFiles
|
|
269
313
|
size: { w: number; h: number }
|
|
270
314
|
clip?: ReviewClip
|
|
271
315
|
audio?: ReviewAudio
|
|
316
|
+
/** a space he looks around in: its image is drawn by the scene's viewer, never as a flat picture */
|
|
317
|
+
scene?: ReviewScene
|
|
272
318
|
marks?: ReviewMark[]
|
|
273
|
-
/** a line on this view alone (an option's description on a choice
|
|
319
|
+
/** a line on this view alone (an option's description on a choice version) */
|
|
274
320
|
note?: string
|
|
275
321
|
/** a message holds it (an update, a question's option, a proposed sound): it draws in that message's cell */
|
|
276
322
|
message?: true
|
|
323
|
+
/** a live view: the running page the owner's hub frames over this image, its shot at post time (review/live-view.ts) */
|
|
324
|
+
live?: ViewLive
|
|
277
325
|
}
|
|
278
326
|
|
|
279
327
|
/** one image of a gallery view, a file of the folder (`v<n>-g<k>.<ext>`) */
|
|
@@ -285,6 +333,9 @@ export interface GalleryTile {
|
|
|
285
333
|
before?: string
|
|
286
334
|
/** the row it is a variant in: one asset per row, he picks at most one tile of a row */
|
|
287
335
|
group?: string
|
|
336
|
+
/** the still of a view of a kind's page (its state's `views`, review/kind-still.ts): the lightbox frames that page,
|
|
337
|
+
* live, with `view=<id>`, in place of the picture */
|
|
338
|
+
view?: string
|
|
288
339
|
}
|
|
289
340
|
|
|
290
341
|
/** a tile's name in the CLI's lines: `vitality/b` for a variant, else its label */
|
|
@@ -298,8 +349,10 @@ export interface GalleryView {
|
|
|
298
349
|
// this type: a consumer narrows with `'files' in view`, which an optional key here would stop
|
|
299
350
|
clip?: undefined
|
|
300
351
|
audio?: undefined
|
|
352
|
+
scene?: undefined
|
|
301
353
|
marks?: undefined
|
|
302
354
|
note?: undefined
|
|
355
|
+
live?: undefined
|
|
303
356
|
}
|
|
304
357
|
|
|
305
358
|
export type ReviewView = MediaView | GalleryView
|
|
@@ -309,8 +362,8 @@ export const isGallery = (v: ReviewView): v is GalleryView => 'gallery' in v
|
|
|
309
362
|
|
|
310
363
|
export const SHA_RE = /^[0-9a-f]{64}$/
|
|
311
364
|
|
|
312
|
-
/** a
|
|
313
|
-
export interface
|
|
365
|
+
/** a version's public change: the release category it goes under and its one line, the `### ` title */
|
|
366
|
+
export interface ItemChangelog {
|
|
314
367
|
category: string
|
|
315
368
|
line: string
|
|
316
369
|
/** what its media shows (`--rating`): the rating its picture lands with; absent, unrated (it reads explicit) */
|
|
@@ -318,7 +371,7 @@ export interface CardChangelog {
|
|
|
318
371
|
}
|
|
319
372
|
|
|
320
373
|
/** `--changelog "<category>: <line>"` read; a line with no category throws saying the shape */
|
|
321
|
-
export function changelogOfFlag(s: string):
|
|
374
|
+
export function changelogOfFlag(s: string): ItemChangelog {
|
|
322
375
|
const m = /^([^:]+):\s*(.+)$/.exec(s.trim())
|
|
323
376
|
if (!m || m[1]!.trim() === '' || m[2]!.trim() === '') throw new Error(`--changelog "${s}": "<category>: <public line>", like "Studio: Move the body anywhere on the floor"`)
|
|
324
377
|
return { category: m[1]!.trim(), line: m[2]!.trim() }
|
|
@@ -332,20 +385,20 @@ export interface Item {
|
|
|
332
385
|
subject: Subject
|
|
333
386
|
origin: Origin
|
|
334
387
|
title: string
|
|
335
|
-
/** an agent
|
|
388
|
+
/** an agent version's markdown: what changed and why */
|
|
336
389
|
what?: string
|
|
337
390
|
/** the public line its agent wrote for a post of it (`--post`), checked by the repo's guard at add */
|
|
338
391
|
post?: string
|
|
339
|
-
/** the change its approval adds to the release being filled (`--changelog "<category>: <line>"`, releases/from-
|
|
392
|
+
/** the change its approval adds to the release being filled (`--changelog "<category>: <line>"`, releases/from-thread.ts),
|
|
340
393
|
* checked by the repo's guard at add */
|
|
341
|
-
changelog?:
|
|
394
|
+
changelog?: ItemChangelog
|
|
342
395
|
topic?: string
|
|
343
396
|
commit?: string
|
|
344
397
|
/** a media view (an image, a clip, a sound, a pair) or a gallery of images, any of them first */
|
|
345
398
|
views: ReviewView[]
|
|
346
|
-
/** an earlier
|
|
399
|
+
/** an earlier version this one follows; never a raised item */
|
|
347
400
|
supersedes?: string
|
|
348
|
-
/** the raised items (a report, his note) this
|
|
401
|
+
/** the raised items (a report, his note) this version answers: one thread per bug */
|
|
349
402
|
answers?: string[]
|
|
350
403
|
/** its subject's address when the agent names it (`sk thread post <address>`, `--on`): one thread per address */
|
|
351
404
|
on?: string
|
|
@@ -353,22 +406,26 @@ export interface Item {
|
|
|
353
406
|
about?: string[]
|
|
354
407
|
/** what this new version keeps of the approved look it follows */
|
|
355
408
|
keeps?: string
|
|
356
|
-
/** why this
|
|
409
|
+
/** why this version passed --new next to an active version */
|
|
357
410
|
why?: string
|
|
358
411
|
light?: 'review'
|
|
359
|
-
/** a draft
|
|
412
|
+
/** a draft version of a repo that shoots live: no verdict until it is ready */
|
|
360
413
|
wip?: { live: string; frame: number }
|
|
361
414
|
/** a choice: every view is an option, he scores them and picks one */
|
|
362
415
|
choice?: true
|
|
363
416
|
/** on a choice: the option its agent suggests, the view's index (the hub's « my pick » pill); his own pick is the verdict's */
|
|
364
417
|
agentPick?: number
|
|
365
|
-
/** a trailer
|
|
366
|
-
trailer?:
|
|
367
|
-
/** a draft
|
|
368
|
-
draft?:
|
|
418
|
+
/** a trailer version: its body plays this cut in the trailer entry's player, never a compiled clip */
|
|
419
|
+
trailer?: ItemTrailer
|
|
420
|
+
/** a draft version: its body shows this post draft read live, a block a message, never a picture of it */
|
|
421
|
+
draft?: ItemDraft
|
|
369
422
|
/** a version of an object of a kind (its `on`): the object's two states as its kind read them when it was posted,
|
|
370
|
-
* drawn by the kind's diff (wiki tools/shipkit/threads-how-it-fits.md, Kinds)
|
|
371
|
-
|
|
423
|
+
* drawn by the kind's diff (wiki tools/shipkit/threads-how-it-fits.md, Kinds); `still`, a picture of the kind's page
|
|
424
|
+
* taken when it was posted (review/kind-still.ts), what the thread shows of a version a page draws */
|
|
425
|
+
states?: { before?: StoredState; after: StoredState; still?: KindStill }
|
|
426
|
+
/** a save of the object itself in its home (review/doc-save.ts), its states the text before and after: who saved it,
|
|
427
|
+
* the owner or an agent's lane. The owner's own save holds nothing for him to judge */
|
|
428
|
+
saved?: { by: string }
|
|
372
429
|
/** each media file the views name, by its name: what the Space keeps it under once the disk lets it go */
|
|
373
430
|
media?: Record<string, MediaFact>
|
|
374
431
|
/** an ask's facts, on the head of its thread `ask:<id>` (asks/ask-store.ts): its status and closed day are the
|
|
@@ -376,6 +433,30 @@ export interface Item {
|
|
|
376
433
|
ask?: AskHead
|
|
377
434
|
/** it waits for the owner's verdict: set by `--verdict`; an agent's version asks it always, an opening of words only with it */
|
|
378
435
|
asksVerdict?: true
|
|
436
|
+
/** a version whose subject is a document (`--md`, `--html`): its text whole, drawn by the hub */
|
|
437
|
+
doc?: ItemDoc
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** a document a version shows (wiki tools/shipkit/threads.md, Every kind of version): markdown through the hub's one
|
|
441
|
+
* words renderer, or an html card in a sandboxed frame. The text lives in the head: the advisors' scan reads it */
|
|
442
|
+
export interface ItemDoc {
|
|
443
|
+
kind: 'md' | 'html'
|
|
444
|
+
text: string
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export const DOC_KINDS: readonly ItemDoc['kind'][] = ['md', 'html']
|
|
448
|
+
/** the most a document weighs, in bytes: a report, never a dump */
|
|
449
|
+
export const DOC_MAX: Readonly<Record<ItemDoc['kind'], number>> = { md: 64 * 1024, html: 256 * 1024 }
|
|
450
|
+
|
|
451
|
+
/** why a document is refused, or null */
|
|
452
|
+
export function docProblem(d: unknown): string | null {
|
|
453
|
+
if (d === null || typeof d !== 'object') return 'doc: { kind: md | html, text }'
|
|
454
|
+
const { kind, text } = d as Partial<ItemDoc>
|
|
455
|
+
if (kind === undefined || !DOC_KINDS.includes(kind)) return 'doc.kind: md or html'
|
|
456
|
+
if (typeof text !== 'string' || text.trim() === '') return `doc.text: the ${kind} text, not empty`
|
|
457
|
+
const bytes = new TextEncoder().encode(text).length
|
|
458
|
+
if (bytes > DOC_MAX[kind]) return `--${kind}: ${Math.round(bytes / 1024)} KB, over ${DOC_MAX[kind] / 1024} KB: a document he reads, never a dump (the detail goes in a file he opens)`
|
|
459
|
+
return null
|
|
379
460
|
}
|
|
380
461
|
|
|
381
462
|
/** a thread head that is an ask: on `ask:<id>` with its facts. The one test of « is an ask », for every reader */
|
|
@@ -389,6 +470,15 @@ export const ASK_KIND_ALIASES: Readonly<Record<string, AskKind>> = { cred: 'cred
|
|
|
389
470
|
/** the kind a word names, null for none */
|
|
390
471
|
export const askKindOf = (w: string): AskKind | null => ((ASK_KINDS as readonly string[]).includes(w) ? (w as AskKind) : (ASK_KIND_ALIASES[w] ?? null))
|
|
391
472
|
|
|
473
|
+
/** where an ask stands (wiki tools/shipkit/threads-asks.md, Closing an ask): open, or closed one of four ways: done,
|
|
474
|
+
* declined (his no), cancelled (an agent: no longer needed), merged (into another ask that asks the same act) */
|
|
475
|
+
export const ASK_STATES = ['open', 'done', 'declined', 'cancelled', 'merged'] as const
|
|
476
|
+
export type AskState = (typeof ASK_STATES)[number]
|
|
477
|
+
export const CLOSED_ASK_STATES = ['done', 'declined', 'cancelled', 'merged'] as const
|
|
478
|
+
export type ClosedAskState = (typeof CLOSED_ASK_STATES)[number]
|
|
479
|
+
/** every reader asks this, never one state by name: a closed ask asks nothing, waits on nobody, counts nowhere */
|
|
480
|
+
export const isClosedAskState = (s: string | null | undefined): s is ClosedAskState => (CLOSED_ASK_STATES as readonly (string | null | undefined)[]).includes(s)
|
|
481
|
+
|
|
392
482
|
/** a warning an ask holds: the check that prints it and words of that one line */
|
|
393
483
|
export interface AskWait {
|
|
394
484
|
check: string
|
|
@@ -396,6 +486,10 @@ export interface AskWait {
|
|
|
396
486
|
}
|
|
397
487
|
|
|
398
488
|
/** an ask's facts that its thread's messages do not already say */
|
|
489
|
+
/** the words of his « later » on a refresh ask (an ask with `lapses`): it closes as declined with them, and a
|
|
490
|
+
* project's need reopens it (secrets/lapse.ts) */
|
|
491
|
+
export const LAPSE_LATER = 'later: when a project needs it again'
|
|
492
|
+
|
|
399
493
|
export interface AskHead {
|
|
400
494
|
kind: AskKind
|
|
401
495
|
/** the day it was made, YYYY-MM-DD */
|
|
@@ -411,6 +505,9 @@ export interface AskHead {
|
|
|
411
505
|
logins?: string[]
|
|
412
506
|
/** the day its one ping went, YYYY-MM-DD: never a second */
|
|
413
507
|
pinged?: string
|
|
508
|
+
/** the secret it refreshes, a token that lapses by design (wiki services/secrets, A secret that may lapse): his
|
|
509
|
+
* « later » sets it aside until a project needs it again */
|
|
510
|
+
lapses?: string
|
|
414
511
|
}
|
|
415
512
|
|
|
416
513
|
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/
|
|
@@ -424,6 +521,7 @@ export function askHeadProblems(v: unknown): string[] {
|
|
|
424
521
|
if (typeof v.blocks !== 'string' || v.blocks === '') out.push('ask.blocks: a text, - for none')
|
|
425
522
|
if (v.check !== undefined && (typeof v.check !== 'string' || v.check.trim() === '')) out.push('ask.check: a shell line')
|
|
426
523
|
if (v.pinged !== undefined && (typeof v.pinged !== 'string' || !DAY_RE.test(v.pinged))) out.push('ask.pinged: YYYY-MM-DD')
|
|
524
|
+
if (v.lapses !== undefined && (typeof v.lapses !== 'string' || v.lapses === '')) out.push('ask.lapses: the secret name it refreshes')
|
|
427
525
|
const names = (x: unknown): boolean => Array.isArray(x) && x.every((n) => typeof n === 'string' && n !== '')
|
|
428
526
|
if (v.secrets !== undefined && !names(v.secrets)) out.push('ask.secrets: a list of secret names')
|
|
429
527
|
if (v.logins !== undefined && !(names(v.logins) && (v.logins as string[]).every((l) => Array.isArray(v.secrets) && v.secrets.includes(l)))) out.push('ask.logins: names among its secrets')
|
|
@@ -432,17 +530,17 @@ export function askHeadProblems(v: unknown): string[] {
|
|
|
432
530
|
return out
|
|
433
531
|
}
|
|
434
532
|
|
|
435
|
-
/** one render a trailer
|
|
533
|
+
/** one render a trailer version plays: the cut, and the render pinned by its mtime in ms */
|
|
436
534
|
export interface TrailerSide {
|
|
437
535
|
cut: string
|
|
438
536
|
render: number
|
|
439
537
|
}
|
|
440
538
|
|
|
441
|
-
/** what a trailer
|
|
539
|
+
/** what a trailer version plays (wiki tools/shipkit/threads.md, A trailer): a cut of `trailer/<trailer>/`, the render it is
|
|
442
540
|
* compared with, the shots the change touched by name */
|
|
443
|
-
export interface
|
|
541
|
+
export interface ItemTrailer {
|
|
444
542
|
trailer: string
|
|
445
|
-
/** the cut it is a version of: `main` for a kept `v15`; absent on a
|
|
543
|
+
/** the cut it is a version of: `main` for a kept `v15`; absent on a version made before it was written */
|
|
446
544
|
cut?: string
|
|
447
545
|
after: TrailerSide
|
|
448
546
|
before?: TrailerSide
|
|
@@ -451,54 +549,74 @@ export interface TrailerCard {
|
|
|
451
549
|
size?: [number, number]
|
|
452
550
|
}
|
|
453
551
|
|
|
454
|
-
export const
|
|
552
|
+
export const isTrailerItem = (i: Item): i is Item & { trailer: ItemTrailer } => i.trailer !== undefined
|
|
455
553
|
|
|
456
|
-
/** one message of a post draft as a draft
|
|
554
|
+
/** one message of a post draft as a draft version pinned it: its key in the draft (`x`, `reddit/comfyui`), its name as he
|
|
457
555
|
* reads it (« Reddit · comfyui »), the hash of what the draft says of it */
|
|
458
|
-
export interface
|
|
556
|
+
export interface ItemDraftPost {
|
|
459
557
|
key: string
|
|
460
558
|
name: string
|
|
461
559
|
hash: string
|
|
560
|
+
/** the post was already posted or dropped when the version was made: that place is settled from the start */
|
|
561
|
+
state?: 'posted' | 'dropped'
|
|
562
|
+
/** what the draft said of it then, the snapshot its hash covers: the next version draws its diff against it */
|
|
563
|
+
words?: DraftWords
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** a place's words and options as a version keeps them, each field only when it says something */
|
|
567
|
+
export interface DraftWords {
|
|
568
|
+
body: string
|
|
569
|
+
title?: string
|
|
570
|
+
tags?: string
|
|
571
|
+
media?: string
|
|
572
|
+
place?: string
|
|
462
573
|
}
|
|
463
574
|
|
|
464
|
-
/**
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
575
|
+
/** the fields of a place a version's line names, in this order */
|
|
576
|
+
export const DRAFT_FIELDS = ['body', 'title', 'tags', 'media', 'place'] as const satisfies readonly (keyof DraftWords)[]
|
|
577
|
+
|
|
578
|
+
/** what a draft version shows (wiki tools/shipkit/threads.md, A post draft): the draft `.shipkit/social/drafts/<slug>/`, read
|
|
579
|
+
* live. The hashes are the draft as it was sent: `hash` its head and angle, each message its own, so the version says what
|
|
580
|
+
* moved since. No view: the version holds no picture */
|
|
581
|
+
export interface ItemDraft {
|
|
468
582
|
slug: string
|
|
469
583
|
hash: string
|
|
470
|
-
posts:
|
|
584
|
+
posts: ItemDraftPost[]
|
|
585
|
+
/** what the draft said beside its places then: its title and angle, the snapshot `hash` covers */
|
|
586
|
+
head?: { title: string; angle?: string }
|
|
587
|
+
/** who saved the draft this version shows: `owner` for his edit in the hub, else the agent's lane */
|
|
588
|
+
by?: string
|
|
471
589
|
}
|
|
472
590
|
|
|
473
|
-
export const
|
|
591
|
+
export const isDraftItem = (i: Item): i is Item & { draft: ItemDraft } => i.draft !== undefined
|
|
474
592
|
|
|
475
593
|
/** a message's key in its draft: `<account>`, or `<account>/<name>` for one of several there */
|
|
476
594
|
export const POST_KEY = /^[a-z0-9-]+(?:\/[a-z0-9-]+)?$/
|
|
477
595
|
|
|
478
|
-
/** a choice
|
|
596
|
+
/** a choice version: he picks one of its views */
|
|
479
597
|
export const isChoice = (i: Item): boolean => i.choice === true
|
|
480
598
|
|
|
481
599
|
/** a view that plays on its own: one clip or one sound, never a pair */
|
|
482
600
|
export const isPlayable = (v: ReviewView | undefined): v is MediaView => v !== undefined && !isGallery(v) && !isPair(v.files) && (v.clip !== undefined || v.audio !== undefined)
|
|
483
601
|
|
|
484
|
-
/** a
|
|
602
|
+
/** a version shown as options, one thin row a view: a choice, or two views or more that each play on their own */
|
|
485
603
|
export const asOptions = (i: Item): boolean => isChoice(i) || (i.views.length >= 2 && i.views.every(isPlayable))
|
|
486
604
|
|
|
487
605
|
/** the most stars a reaction gives */
|
|
488
606
|
export const STARS = 5
|
|
489
607
|
|
|
490
|
-
/** where a
|
|
608
|
+
/** where a thread is, for a fresh agent session in any repo: the repo as `~/dev/<repo>`, the thread's url where it is open
|
|
491
609
|
* now, and its phone url when the repo has a public host */
|
|
492
|
-
export interface
|
|
610
|
+
export interface ThreadWhere {
|
|
493
611
|
root: string
|
|
494
612
|
open: string
|
|
495
613
|
phone?: string | null
|
|
496
614
|
}
|
|
497
615
|
|
|
498
|
-
/** one paste that hands a
|
|
499
|
-
export function pasteBlock(i: Item, state: string, w:
|
|
616
|
+
/** one paste that hands a thread to any agent session: what it is, where, the command that shows it whole, its links */
|
|
617
|
+
export function pasteBlock(i: Item, state: string, w: ThreadWhere): string {
|
|
500
618
|
return [
|
|
501
|
-
`
|
|
619
|
+
`thread "${i.title}" (${state}), id ${i.id}`,
|
|
502
620
|
`repo: ${w.root}`,
|
|
503
621
|
`see it whole: cd ${w.root} && sk thread show ${i.id}`,
|
|
504
622
|
`open: ${w.open}`,
|
|
@@ -506,7 +624,7 @@ export function pasteBlock(i: Item, state: string, w: CardWhere): string {
|
|
|
506
624
|
].join('\n')
|
|
507
625
|
}
|
|
508
626
|
|
|
509
|
-
/** a view's number in its version: 1 for the first. Never a letter: a
|
|
627
|
+
/** a view's number in its version: 1 for the first. Never a letter: a version's own views are often named A, B, C, and
|
|
510
628
|
* a letter assigned beside them would not match */
|
|
511
629
|
export const viewNo = (i: number): string => String(i + 1)
|
|
512
630
|
|
|
@@ -538,12 +656,12 @@ export function viewIndexOf(views: readonly { label: string }[], ref: string): n
|
|
|
538
656
|
throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${viewNo(i)}${v.label ? ` "${v.label}"` : ''}`).join(', ')}`)
|
|
539
657
|
}
|
|
540
658
|
|
|
541
|
-
/** every media file
|
|
659
|
+
/** every media file an item's views name: images, pairs, clips and their posters, sounds and their waveforms, tiles */
|
|
542
660
|
export function viewFilesOf(i: Item): string[] {
|
|
543
661
|
return i.views.flatMap((v) => {
|
|
544
662
|
if (isGallery(v)) return v.gallery.flatMap((g) => [g.file, ...(g.before ? [g.before] : [])])
|
|
545
|
-
return [...Object.values(v.files), ...(v.clip ? [v.clip.poster] : []), ...(v.audio ? [v.audio.wave, ...(v.audio.waveBefore ? [v.audio.waveBefore] : [])] : [])]
|
|
546
|
-
})
|
|
663
|
+
return [...Object.values(v.files), ...(v.scene && 'file' in v.scene ? [v.scene.file] : []), ...(v.clip ? [v.clip.poster] : []), ...(v.audio ? [v.audio.wave, ...(v.audio.waveBefore ? [v.audio.waveBefore] : [])] : [])]
|
|
664
|
+
}).concat(i.states?.still ? Object.values(i.states.still.files) : [])
|
|
547
665
|
}
|
|
548
666
|
|
|
549
667
|
/** the first view: media or a gallery; a note with no image has none */
|
|
@@ -564,8 +682,8 @@ export const onFrame = (t: number, time: number, fps: number): boolean => Math.f
|
|
|
564
682
|
export type Side = 'before' | 'after'
|
|
565
683
|
|
|
566
684
|
/** a rectangle on a view, normalized 0..1; w = h = 0 is a pin. `view` the index of its view, absent on the first;
|
|
567
|
-
* `side` only on a pair (on a trailer
|
|
568
|
-
*
|
|
685
|
+
* `side` only on a pair (on a trailer version with a before, the render it is drawn on); `t` only on a clip or a trailer
|
|
686
|
+
* version's frame */
|
|
569
687
|
export interface Rect {
|
|
570
688
|
x: number
|
|
571
689
|
y: number
|
|
@@ -576,7 +694,7 @@ export interface Rect {
|
|
|
576
694
|
side?: Side
|
|
577
695
|
/** the clip time it was drawn at, in seconds */
|
|
578
696
|
t?: number
|
|
579
|
-
/** on a trailer
|
|
697
|
+
/** on a trailer version's frame: the shot it sits on and the seconds into it, so a new render places it */
|
|
580
698
|
shot?: { name: string; time: number }
|
|
581
699
|
/** the gallery tile it is drawn on, its coordinates the tile's image */
|
|
582
700
|
tile?: number
|
|
@@ -591,12 +709,12 @@ export type ReviewStatus = (typeof STATUSES)[number]
|
|
|
591
709
|
|
|
592
710
|
export const isApproved = (s: ReviewStatus): boolean => s === 'approved' || s === 'approved-with-fix'
|
|
593
711
|
|
|
594
|
-
/** the owner's reaction to one view, to one tile of a gallery view, or to one message of a draft
|
|
712
|
+
/** the owner's reaction to one view, to one tile of a gallery view, or to one message of a draft version; one per view,
|
|
595
713
|
* tile or message */
|
|
596
714
|
export interface ReviewReaction {
|
|
597
715
|
view: number
|
|
598
716
|
tile?: number
|
|
599
|
-
/** on a draft
|
|
717
|
+
/** on a draft version: the message of the draft it answers, by its key (`x`, `reddit/comfyui`) */
|
|
600
718
|
post?: string
|
|
601
719
|
status?: ReviewStatus
|
|
602
720
|
comment: string
|
|
@@ -609,6 +727,10 @@ export interface ReviewReaction {
|
|
|
609
727
|
/** a state change, a read mark (`seen`, with the ids it read in `of`), a take (`take`: an agent holds the thread
|
|
610
728
|
* from now on, its state unchanged; review/parties.ts), or an agent on it (`working`, its line in `note`, none ends
|
|
611
729
|
* it; review/traces.ts) */
|
|
730
|
+
/** a `take` the machine wrote for a gone holder (review/hand-over.ts): no agent chose it, so it is no move, no act on
|
|
731
|
+
* his lane request, and no sign that anyone works the thread */
|
|
732
|
+
export const handedOver = (m: Pick<Message, 'op' | 'from'>): boolean => m.op === 'take' && m.from !== undefined
|
|
733
|
+
|
|
612
734
|
export const OPS = ['dispatch', 'ask', 'answer', 'reassign', 'claim', 'release', 'blocked', 'fixed', 'done', 'wontfix', 'drop', 'withdraw', 'reopen', 'ready', 'seen', 'take', 'working'] as const
|
|
613
735
|
export type Op = (typeof OPS)[number]
|
|
614
736
|
|
|
@@ -617,12 +739,21 @@ export const UPDATE_STATES = ['broken', 'better', 'fixed'] as const
|
|
|
617
739
|
export type UpdateState = (typeof UPDATE_STATES)[number]
|
|
618
740
|
export const UPDATE_WORDS: Record<UpdateState, string> = { broken: 'still broken', better: 'better', fixed: 'fixed' }
|
|
619
741
|
|
|
620
|
-
/** an agent's progress post on
|
|
742
|
+
/** an agent's progress post on an item: its state, and the view of the item that holds its picture, clip or sound */
|
|
621
743
|
export interface MessageUpdate {
|
|
622
744
|
state: UpdateState
|
|
623
745
|
view?: number
|
|
624
746
|
}
|
|
625
747
|
|
|
748
|
+
/** a file attached to a message: `file` its name in `thread/`, `name` the name it came with, its bytes, its type by
|
|
749
|
+
* its extension */
|
|
750
|
+
export interface MessageFile {
|
|
751
|
+
file: string
|
|
752
|
+
name: string
|
|
753
|
+
size: number
|
|
754
|
+
type: string
|
|
755
|
+
}
|
|
756
|
+
|
|
626
757
|
/** one act on an item, one file of `thread/`, never rewritten */
|
|
627
758
|
export interface Message {
|
|
628
759
|
id: string
|
|
@@ -633,10 +764,12 @@ export interface Message {
|
|
|
633
764
|
text?: string
|
|
634
765
|
/** a file of the folder's `thread/` beside it */
|
|
635
766
|
image?: string
|
|
767
|
+
/** files of any kind attached to the message, each a file of `thread/` beside it (`<id>-f<n>.<ext>`) */
|
|
768
|
+
files?: MessageFile[]
|
|
636
769
|
rects?: Rect[]
|
|
637
770
|
reactions?: ReviewReaction[]
|
|
638
771
|
verdict?: ReviewStatus
|
|
639
|
-
/** the view he picked on a choice
|
|
772
|
+
/** the view he picked on a choice version, its index */
|
|
640
773
|
pick?: number
|
|
641
774
|
/** a repo's own mark on a subject (stars, a song's mark): kept as written */
|
|
642
775
|
rate?: { stars?: number; mark?: string; part?: string }
|
|
@@ -654,19 +787,38 @@ export interface Message {
|
|
|
654
787
|
re?: string
|
|
655
788
|
/** the Claude Code session of the agent that wrote it: the thread's holder */
|
|
656
789
|
session?: string
|
|
790
|
+
/** a `take` that is a hand-over (review/hand-over.ts): the holder that was gone */
|
|
791
|
+
from?: { lane?: string; session?: string }
|
|
657
792
|
/** the objects it attaches to its thread, each `<kind>:<key>` */
|
|
658
793
|
about?: string[]
|
|
659
794
|
/** a question to the owner: its words in `text`, its options, the option the agent picks */
|
|
660
795
|
ask?: MessageAsk
|
|
661
796
|
/** a question that is a field inside a step of an ask's instructions (`of`: their message id, `i`: the step): drawn
|
|
662
|
-
* in that step, never beside it; the step counts ticked once its every field is answered (review/instructions.ts)
|
|
663
|
-
|
|
797
|
+
* in that step, never beside it; the step counts ticked once its every field is answered (review/instructions.ts).
|
|
798
|
+
* `carries`: the question it took the place of when a fold moved that one into the step: his answers to it are its */
|
|
799
|
+
step?: { of: string; i: number; carries?: string }
|
|
664
800
|
/** a change the agent proposes on an object's text: its words in `text` */
|
|
665
801
|
propose?: MessagePropose
|
|
666
802
|
/** the owner clicked one of the kind's actions on the thread's object */
|
|
667
803
|
action?: MessageAction
|
|
668
|
-
/** an
|
|
669
|
-
|
|
804
|
+
/** an act of the version's kind done on one of its spots (review/settle.ts): `name` the kind's act, `post` the
|
|
805
|
+
* place of a draft, `url` where it went, `undo` it is taken back (a link cleared, a drop taken back); its line in
|
|
806
|
+
* `note`, never words he owes an answer */
|
|
807
|
+
act?: MessageAct
|
|
808
|
+
/** an ask's thread: its ask closed (done, declined, cancelled, merged) or opened again; a closed ask asks nothing
|
|
809
|
+
* more. `into`: the id of the ask a merged one went into */
|
|
810
|
+
askState?: { state: AskState; why?: string; into?: string }
|
|
811
|
+
/** an answer of his carried here by a merge from another ask (asks/ask-close.ts): `from` that ask's id, `at` when he
|
|
812
|
+
* gave it. His answer for every reader of the answer, never a new act of his: no thread word, no wake, no return
|
|
813
|
+
* from set aside */
|
|
814
|
+
carried?: { from: string; at: string }
|
|
815
|
+
/** the owner's own save of the thread's object from the hub's editor (review/doc-save.ts saveDoc): `of` the version it
|
|
816
|
+
* made (an item, or an ask's instructions message), or the version waiting on the owner's verdict that the save went over;
|
|
817
|
+
* its line of what changed in `text`, its changed lines in `diff` (`- ` gone, `+ ` new). His act, never the agent's:
|
|
818
|
+
* it wakes the thread's holder (wakes.ts `edit`). His saves of one burst are one wake (doc-save.ts ownerEdit): `base`
|
|
819
|
+
* the text before a burst's first save; a later save of it lands beside that first edit, its diff from `base`, and
|
|
820
|
+
* `folds` names the edit it takes the place of, a trace from then on (wakes.ts `edit-folded`) */
|
|
821
|
+
edit?: { of: string; diff: string[]; base?: string; folds?: string }
|
|
670
822
|
/** a thread set aside until `until` (an ISO time), his from the hub or an agent's when it posts; null brings it back */
|
|
671
823
|
snooze?: { until: string | null }
|
|
672
824
|
/** an agent's message that brings back a thread set aside (wiki tools/shipkit/threads-asks.md, Snooze) */
|
|
@@ -692,6 +844,26 @@ export interface Message {
|
|
|
692
844
|
/** the owner asks for a lane on the thread (review/lane-ask.ts): the owner's words in `text`, the orchestrator it
|
|
693
845
|
* waited on when asked; no reply, the thread's holder never hears it as one */
|
|
694
846
|
laneAsk?: { for: string; session?: string }
|
|
847
|
+
/** the parties the owner's words name with `@` (review/mentions.ts): they wake those parties only */
|
|
848
|
+
to?: Mention[]
|
|
849
|
+
/** his bell on the thread: true, no push to his phone from it; false, pushes again (review/phone-push.ts) */
|
|
850
|
+
mute?: boolean
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/** a party the owner's words name: a lane (and its session), a session alone (the orchestrator), or an advisor by id */
|
|
854
|
+
export interface Mention {
|
|
855
|
+
name: string
|
|
856
|
+
lane?: string
|
|
857
|
+
session?: string
|
|
858
|
+
advisor?: string
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** an act of a kind done on a spot of a version */
|
|
862
|
+
export interface MessageAct {
|
|
863
|
+
name: string
|
|
864
|
+
post?: string
|
|
865
|
+
url?: string
|
|
866
|
+
undo?: true
|
|
695
867
|
}
|
|
696
868
|
|
|
697
869
|
/** what a question asks him for (wiki tools/shipkit/threads-asks.md, Answer kinds); absent on a question, a choice */
|
|
@@ -717,6 +889,7 @@ export interface MessageAsk {
|
|
|
717
889
|
/** how one field of a proposed change draws: a house kind (review/kinds.ts) */
|
|
718
890
|
export { DIFF_TYPES, type DiffType } from './kinds.ts'
|
|
719
891
|
import { DIFF_TYPES, sniffKind, type DiffType } from './kinds.ts'
|
|
892
|
+
import { slugOf } from '../core/slug.ts'
|
|
720
893
|
|
|
721
894
|
/** one field of a proposed change: its value before and after, how it draws; a sound's pair is a view of the item */
|
|
722
895
|
export interface ProposeField {
|
|
@@ -787,11 +960,28 @@ export function proposeOpen(thread: readonly Message[], m: Message): boolean {
|
|
|
787
960
|
/** how a field draws when nothing names it: the first house kind that takes its values, words otherwise */
|
|
788
961
|
export const diffTypeOf = sniffKind
|
|
789
962
|
|
|
790
|
-
/** an object as one side of a change: its json and its files (repo relative), and the git ref it was read at
|
|
963
|
+
/** an object as one side of a change: its json and its files (repo relative), and the git ref it was read at.
|
|
964
|
+
* `views`: the views its kind's page draws it in, one still each in the thread (review/kind-still.ts) */
|
|
791
965
|
export interface StoredState {
|
|
792
966
|
json: unknown
|
|
793
967
|
files?: Record<string, string>
|
|
794
968
|
at?: string
|
|
969
|
+
views?: KindViewRef[]
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/** one view of a kind's page: its `view` frame key, and the legend under its still */
|
|
973
|
+
export interface KindViewRef {
|
|
974
|
+
id: string
|
|
975
|
+
label: string
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/** a view's id: the `view` frame key a kind's page reads */
|
|
979
|
+
export const KIND_VIEW_RE = /^[a-z0-9][a-z0-9_-]*$/i
|
|
980
|
+
|
|
981
|
+
/** a still of a kind's page, its files in the item's folder as a view's: one image, or a before and an after */
|
|
982
|
+
export interface KindStill {
|
|
983
|
+
files: { image: string } | { before: string; after: string }
|
|
984
|
+
size: { w: number; h: number }
|
|
795
985
|
}
|
|
796
986
|
|
|
797
987
|
/** an owner's click on a kind's action (wiki tools/shipkit/threads-how-it-fits.md, Kinds): its name, the owner's words in `text` */
|
|
@@ -822,6 +1012,56 @@ export const isReply = (m: Message): boolean => isTalk(m) && !isVersionVerdict(m
|
|
|
822
1012
|
|
|
823
1013
|
export const MESSAGE_RE = /^\d{8}-\d{6}-\d{3}-(agent|owner|player)(-[a-z0-9]+)*$/
|
|
824
1014
|
export const MESSAGE_FILE_RE = /^\d{8}-\d{6}-\d{3}-(agent|owner|player)(-[a-z0-9]+)*\.(png|jpe?g|webp)$/
|
|
1015
|
+
/** a file attached to a message, `<id>-f<n>.<ext>`: any kind */
|
|
1016
|
+
export const MESSAGE_ATTACH_RE = /^(\d{8}-\d{6}-\d{3}-(agent|owner|player)(-[a-z0-9]+)*)-f([1-9]\d?)\.([a-z0-9]{1,8})$/
|
|
1017
|
+
/** the files one message carries at most */
|
|
1018
|
+
export const MESSAGE_FILES_MAX = 20
|
|
1019
|
+
/** the bytes one attached file may hold: under the 128 MiB every Bun server on its way takes by default (the web, the
|
|
1020
|
+
* daemon), which hold a request's body whole */
|
|
1021
|
+
export const UPLOAD_MAX = 100 * 1024 * 1024
|
|
1022
|
+
const FILE_NAME_MAX = 120
|
|
1023
|
+
|
|
1024
|
+
/** the name a file came with, as a message keeps it: no folder, no control character, at most 120 characters */
|
|
1025
|
+
export function cleanFileName(name: string): string {
|
|
1026
|
+
const base = name.split(/[/\\]/).pop() ?? ''
|
|
1027
|
+
// eslint-disable-next-line no-control-regex
|
|
1028
|
+
const clean = base.replace(/[\u0000-\u001f\u007f]/g, '').trim()
|
|
1029
|
+
if (clean === '' || clean === '.' || clean === '..') return 'file'
|
|
1030
|
+
if (clean.length <= FILE_NAME_MAX) return clean
|
|
1031
|
+
const dot = clean.lastIndexOf('.')
|
|
1032
|
+
const ext = dot > 0 && clean.length - dot <= 9 ? clean.slice(dot) : ''
|
|
1033
|
+
return `${clean.slice(0, FILE_NAME_MAX - ext.length)}${ext}`
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** the extension a stored file takes from its name: lowercase letters and digits, 1 to 8, else `bin` */
|
|
1037
|
+
export function attachExt(name: string): string {
|
|
1038
|
+
const m = /\.([A-Za-z0-9]{1,8})$/.exec(name)
|
|
1039
|
+
return m ? m[1]!.toLowerCase() : 'bin'
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/** the name of a message's `n`th file (from 1) in `thread/` */
|
|
1043
|
+
export const attachFile = (messageId: string, n: number, name: string): string => `${messageId}-f${n}.${attachExt(name)}`
|
|
1044
|
+
|
|
1045
|
+
const MIME: Record<string, string> = {
|
|
1046
|
+
png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp', gif: 'image/gif', svg: 'image/svg+xml', heic: 'image/heic',
|
|
1047
|
+
mp4: 'video/mp4', webm: 'video/webm', mov: 'video/quicktime', mkv: 'video/x-matroska',
|
|
1048
|
+
mp3: 'audio/mpeg', wav: 'audio/wav', ogg: 'audio/ogg', opus: 'audio/opus', m4a: 'audio/mp4', flac: 'audio/flac',
|
|
1049
|
+
pdf: 'application/pdf', zip: 'application/zip', gz: 'application/gzip', tgz: 'application/gzip', tar: 'application/x-tar', '7z': 'application/x-7z-compressed',
|
|
1050
|
+
txt: 'text/plain', md: 'text/markdown', csv: 'text/csv', json: 'application/json', html: 'text/html', htm: 'text/html',
|
|
1051
|
+
}
|
|
1052
|
+
/** a file's type by its extension, `application/octet-stream` when unknown */
|
|
1053
|
+
export const mimeOf = (file: string): string => MIME[attachExt(file)] ?? 'application/octet-stream'
|
|
1054
|
+
|
|
1055
|
+
/** how the hub shows a file in place: the kinds a browser plays safely on the hub's own origin. Never svg or html:
|
|
1056
|
+
* they run script there */
|
|
1057
|
+
export const INLINE: Record<string, 'image' | 'video' | 'audio'> = { png: 'image', jpg: 'image', jpeg: 'image', webp: 'image', gif: 'image', mp4: 'video', webm: 'video', mov: 'video', mp3: 'audio', wav: 'audio', ogg: 'audio', opus: 'audio', m4a: 'audio', flac: 'audio' }
|
|
1058
|
+
export const inlineOf = (file: string): 'image' | 'video' | 'audio' | null => INLINE[attachExt(file)] ?? null
|
|
1059
|
+
|
|
1060
|
+
const fileProblem = (f: unknown, id: string, i: number): boolean => {
|
|
1061
|
+
if (!obj(f)) return true
|
|
1062
|
+
const m = typeof f.file === 'string' ? MESSAGE_ATTACH_RE.exec(f.file) : null
|
|
1063
|
+
return m === null || m[1] !== id || Number(m[4]) !== i + 1 || typeof f.name !== 'string' || f.name === '' || cleanFileName(f.name) !== f.name || !(Number.isInteger(f.size) && (f.size as number) >= 0) || typeof f.type !== 'string'
|
|
1064
|
+
}
|
|
825
1065
|
const MAX_TEXT = 4000
|
|
826
1066
|
|
|
827
1067
|
/** an agent's name: its lane (`L135`, `REVIEW`) */
|
|
@@ -851,13 +1091,23 @@ export function textOf(v: unknown): { text: string } | { error: string } {
|
|
|
851
1091
|
const readBy = (x: ReviewItem, party: Party): Set<string> =>
|
|
852
1092
|
new Set(x.thread.flatMap((m) => (m.op === 'seen' && partyOf(m.who) === party ? (m.of ?? []) : [])))
|
|
853
1093
|
|
|
854
|
-
/** the owner took a verdict back on an agent's
|
|
1094
|
+
/** the owner took a verdict back on an agent's version: news for the agent, which may have acted on that verdict */
|
|
855
1095
|
const isTakeBack = (x: ReviewItem, m: Message): boolean => m.op === 'reopen' && m.who === 'owner' && x.item.origin.by === 'agent'
|
|
856
1096
|
|
|
857
1097
|
/** the talk of the other party that `party` has not read: replies, verdicts, ratings, his verdicts taken back */
|
|
858
1098
|
/** the owner's close or reopen of a whole thread from the hub: heard by its holder and acknowledged like the owner's words */
|
|
859
1099
|
const isOwnerClose = (m: Message): boolean => partyOf(m.who) === 'owner' && (m.op === 'fixed' || m.op === 'done' || m.op === 'wontfix' || m.op === 'reopen')
|
|
860
1100
|
|
|
1101
|
+
/** the agents the owner's words name with `@`, none for words that name no agent */
|
|
1102
|
+
export const agentsNamed = (m: Pick<Message, 'to'>): Mention[] => (m.to ?? []).filter((t) => t.advisor === undefined)
|
|
1103
|
+
|
|
1104
|
+
/** the words a `seen` of agent `who` (its session `session`) may read by default: every word, except one that names
|
|
1105
|
+
* agents and none of them is it. `sk thread seen` narrows it further with the registry (threads.ts seenOnly) */
|
|
1106
|
+
export const mayReadNamed = (m: Pick<Message, 'to'>, who: string, session: string | null): boolean => {
|
|
1107
|
+
const named = agentsNamed(m)
|
|
1108
|
+
return named.length === 0 || named.some((t) => (t.lane !== undefined && t.lane === who && (t.session === undefined || session === null || t.session === session)) || (who === 'agent' && session !== null && t.session === session))
|
|
1109
|
+
}
|
|
1110
|
+
|
|
861
1111
|
const unreadTalk = (x: ReviewItem, party: Party): Message[] => {
|
|
862
1112
|
const read = readBy(x, party)
|
|
863
1113
|
return x.thread.filter((m) => (isTalk(m) || isTakeBack(x, m) || isOwnerClose(m)) && partyOf(m.who) !== party && !read.has(m.id))
|
|
@@ -884,14 +1134,14 @@ export const unreadBy = (x: ReviewItem, party: Party): Message[] => unreadTalk(x
|
|
|
884
1134
|
/** what a `seen` of `party` reads on `x`: every message of the other party it has not read yet */
|
|
885
1135
|
export const toAcknowledge = (x: ReviewItem, party: Party): string[] => unreadTalk(x, party).map((m) => m.id)
|
|
886
1136
|
|
|
887
|
-
/** the owner's verdict as the
|
|
1137
|
+
/** the owner's verdict as the version shows it: the latest one since the last reopen; `seen`: an agent read it */
|
|
888
1138
|
export interface Verdict {
|
|
889
1139
|
id: string
|
|
890
1140
|
status: ReviewStatus
|
|
891
1141
|
comment: string
|
|
892
1142
|
rects: Rect[]
|
|
893
1143
|
reactions?: ReviewReaction[]
|
|
894
|
-
/** the view he picked, on a choice
|
|
1144
|
+
/** the view he picked, on a choice version */
|
|
895
1145
|
pick?: number
|
|
896
1146
|
at: string
|
|
897
1147
|
seen: boolean
|
|
@@ -912,18 +1162,27 @@ export function updateTag(x: ReviewItem, id: string): string | null {
|
|
|
912
1162
|
}
|
|
913
1163
|
|
|
914
1164
|
export function verdictOf(x: ReviewItem): Verdict | null {
|
|
1165
|
+
// a version answered by its kind's acts: the act that settles its last spot is his yes, owing the agent nothing
|
|
1166
|
+
const settling = settlingOf(x)
|
|
1167
|
+
let settled: Pick<Message, 'id' | 'at'> | null = settling?.start ? { id: x.item.id, at: x.item.created } : null
|
|
915
1168
|
let m: Message | undefined
|
|
916
1169
|
let text: string | undefined
|
|
917
1170
|
let rects: Rect[] | undefined
|
|
918
1171
|
for (const n of x.thread) {
|
|
919
|
-
|
|
1172
|
+
const flip = settling?.flips.get(n.id)
|
|
1173
|
+
if (flip !== undefined) {
|
|
1174
|
+
settled = flip ? n : null
|
|
1175
|
+
if (flip) [m, text, rects] = [undefined, undefined, undefined]
|
|
1176
|
+
} else if (n.op === 'reopen' || isFixedUpdate(n)) [m, text, rects, settled] = [undefined, undefined, undefined, null]
|
|
920
1177
|
else if (isVersionVerdict(n)) {
|
|
921
1178
|
if (m?.verdict !== n.verdict) [text, rects] = [undefined, undefined]
|
|
922
1179
|
m = n
|
|
1180
|
+
settled = null
|
|
923
1181
|
if (n.text !== undefined) text = n.text
|
|
924
1182
|
if (n.rects !== undefined) rects = n.rects
|
|
925
1183
|
}
|
|
926
1184
|
}
|
|
1185
|
+
if (settled !== null) return { id: settled.id, status: 'approved', comment: '', rects: [], at: settled.at, seen: true }
|
|
927
1186
|
if (!m?.verdict) return null
|
|
928
1187
|
return {
|
|
929
1188
|
id: m.id,
|
|
@@ -938,10 +1197,12 @@ export function verdictOf(x: ReviewItem): Verdict | null {
|
|
|
938
1197
|
}
|
|
939
1198
|
}
|
|
940
1199
|
|
|
941
|
-
/**
|
|
942
|
-
export const
|
|
1200
|
+
/** the agent's withdraw of the version itself; one that names one object of it (`re`) leaves the version as it was */
|
|
1201
|
+
export const itemWithdrawOf = (x: ReviewItem): Message | undefined => x.thread.filter((m) => m.op === 'withdraw' && m.re === undefined).at(-1)
|
|
1202
|
+
/** why the agent took the version back unanswered; undefined when it did not */
|
|
1203
|
+
export const withdrawnOf = (x: ReviewItem): string | undefined => itemWithdrawOf(x)?.note
|
|
943
1204
|
|
|
944
|
-
/** what the list says of an item: an agent's
|
|
1205
|
+
/** what the list says of an item: an agent's version by the owner's verdict, what he or a player raised by its state */
|
|
945
1206
|
export type ShownStatus = 'pending' | 'wip' | ReviewStatus | 'superseded' | 'withdrawn' | 'raised' | 'fixed' | 'wontfix' | 'rated'
|
|
946
1207
|
|
|
947
1208
|
export const STATUS_LABEL: Record<ShownStatus, string> = {
|
|
@@ -959,6 +1220,21 @@ export const STATUS_LABEL: Record<ShownStatus, string> = {
|
|
|
959
1220
|
rated: 'rated',
|
|
960
1221
|
}
|
|
961
1222
|
|
|
1223
|
+
/** a verdict as he reads it: a fix on a draft's places names them (« fix on X »), never the whole version, whose other
|
|
1224
|
+
* places still wait for publish or drop */
|
|
1225
|
+
export function verdictLabel(item: Pick<Item, 'draft'>, status: ShownStatus, reactions: readonly Pick<ReviewReaction, 'post' | 'status'>[] = []): string {
|
|
1226
|
+
if (status !== 'approved-with-fix' || item.draft === undefined) return STATUS_LABEL[status]
|
|
1227
|
+
const names = reactions.filter((r) => r.post !== undefined && r.status === 'approved-with-fix').map((r) => item.draft!.posts.find((p) => p.key === r.post)?.name ?? r.post!)
|
|
1228
|
+
return names.length === 0 ? STATUS_LABEL[status] : `fix on ${[...new Set(names)].join(', ')}`
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** a draft verdict's words when the verdict itself holds none: each place's, « X: <words> » */
|
|
1232
|
+
export const placeWords = (reactions: readonly Pick<ReviewReaction, 'post' | 'comment'>[], item: Pick<Item, 'draft'>): string =>
|
|
1233
|
+
reactions
|
|
1234
|
+
.filter((r) => r.post !== undefined && r.comment.trim() !== '')
|
|
1235
|
+
.map((r) => `${item.draft?.posts.find((p) => p.key === r.post)?.name ?? r.post}: ${r.comment.trim()}`)
|
|
1236
|
+
.join('; ')
|
|
1237
|
+
|
|
962
1238
|
/** the lifecycle (wiki tools/shipkit/threads.md, The lifecycle) */
|
|
963
1239
|
export type State = 'draft' | 'new' | 'question' | 'open' | 'claimed' | 'blocked' | 'asks' | 'closed'
|
|
964
1240
|
type ClosedWhy = ReviewStatus | 'fixed' | 'wontfix' | 'dropped' | 'superseded' | 'withdrawn' | 'rated'
|
|
@@ -969,7 +1245,7 @@ export interface ItemState {
|
|
|
969
1245
|
topic?: string
|
|
970
1246
|
/** who holds a claim */
|
|
971
1247
|
worker?: string
|
|
972
|
-
/** the time of the `claim` that holds it; none on the claim the owner's verdict gives the
|
|
1248
|
+
/** the time of the `claim` that holds it; none on the claim the owner's verdict gives the version's lane until it is read */
|
|
973
1249
|
since?: string
|
|
974
1250
|
}
|
|
975
1251
|
|
|
@@ -980,28 +1256,46 @@ export const moveOf = (s: State): Move =>
|
|
|
980
1256
|
|
|
981
1257
|
export const MOVE_LABEL: Record<Move, string> = { owner: 'mine', agents: "an agent's", none: 'done' }
|
|
982
1258
|
|
|
983
|
-
/** a thread an agent opened with words (a question, a proposed change, a line): nothing to judge, so no verdict waits
|
|
984
|
-
|
|
1259
|
+
/** a thread an agent opened with words (a question, a proposed change, a line): nothing to judge, so no verdict waits;
|
|
1260
|
+
* words posted with `--verdict` (asksVerdict) wait for it as a version does, so every reader takes them as one */
|
|
1261
|
+
export const isOpening = (i: Item): boolean => i.origin.by === 'agent' && i.on !== undefined && i.asksVerdict !== true && i.views.every((v) => !isGallery(v) && v.message === true) && i.draft === undefined && i.states === undefined && i.doc === undefined
|
|
1262
|
+
|
|
1263
|
+
/** the owner's own save of an object (review/doc-save.ts): his, done when made, nothing for him to judge. A post draft he
|
|
1264
|
+
* saved is no such save: its places still wait on his publish or drop (review/settle.ts) */
|
|
1265
|
+
export const ownSave = (i: Pick<Item, 'saved'>): boolean => i.saved?.by === 'owner'
|
|
985
1266
|
|
|
986
|
-
/**
|
|
1267
|
+
/** a version that asks the owner no verdict: a thread opened with words, or his own save */
|
|
1268
|
+
export const asksNoVerdict = (i: Item): boolean => isOpening(i) || ownSave(i)
|
|
1269
|
+
|
|
1270
|
+
/** where an item starts: an agent's version asks for the owner's verdict (a draft waits); what he raises from a tool that named
|
|
987
1271
|
* its topic (the trailer view: `film`) is open, else it waits on a dispatcher; an auto rule's item is open */
|
|
988
1272
|
const startOf = (i: Item): ItemState =>
|
|
989
|
-
i
|
|
990
|
-
? { state:
|
|
1273
|
+
ownSave(i)
|
|
1274
|
+
? { state: 'closed', why: 'fixed' }
|
|
1275
|
+
: i.origin.by === 'agent'
|
|
1276
|
+
? { state: i.wip || isOpening(i) ? 'draft' : 'asks' }
|
|
991
1277
|
: i.topic || i.origin.by === 'auto'
|
|
992
1278
|
? { state: 'open', ...(i.topic ? { topic: i.topic } : {}) }
|
|
993
1279
|
: { state: 'new' }
|
|
994
1280
|
|
|
995
|
-
/** the state of an item, folded from its thread. A verdict wins over a withdrawal, as
|
|
996
|
-
* later version follows it. « fix » and « no » give the
|
|
1281
|
+
/** the state of an item, folded from its thread. A verdict wins over a withdrawal, as the thread shows it; `superseded`: a
|
|
1282
|
+
* later version follows it. « fix » and « no » give the version back to its author until an agent reads them */
|
|
997
1283
|
export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
998
1284
|
const i = x.item
|
|
999
1285
|
const lane = i.origin.by === 'agent' ? i.origin.lane : undefined
|
|
1000
|
-
|
|
1001
|
-
|
|
1286
|
+
const settling = settlingOf(x)
|
|
1287
|
+
let s: ItemState = settling?.start ? { state: 'closed', why: 'approved' } : startOf(i)
|
|
1288
|
+
// what his latest verdict left: a released or superseded rework of an agent's version goes back to it
|
|
1002
1289
|
let given: ItemState = s
|
|
1003
1290
|
for (const m of x.thread) {
|
|
1004
1291
|
const keep = s.topic ? { topic: s.topic } : {}
|
|
1292
|
+
// a version answered by its kind's acts: every spot settled is his yes, a spot opened again waits on him
|
|
1293
|
+
const flip = settling?.flips.get(m.id)
|
|
1294
|
+
if (flip !== undefined) {
|
|
1295
|
+
s = flip ? { ...keep, state: 'closed', why: 'approved' } : { ...keep, state: 'asks' }
|
|
1296
|
+
given = s
|
|
1297
|
+
continue
|
|
1298
|
+
}
|
|
1005
1299
|
if (m.verdict !== undefined && isVersionVerdict(m)) {
|
|
1006
1300
|
const v = m.verdict
|
|
1007
1301
|
// « fix » and « no » owe the lane work: reading the verdict is never doing it (done, wontfix or a new version closes it)
|
|
@@ -1014,7 +1308,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1014
1308
|
s = { ...keep, state: 'closed', why: 'rated' }
|
|
1015
1309
|
continue
|
|
1016
1310
|
}
|
|
1017
|
-
// an agent's update on its
|
|
1311
|
+
// an agent's update on its version: still broken or better holds it in work, fixed asks the owner's verdict again
|
|
1018
1312
|
if (m.update !== undefined && i.origin.by === 'agent' && partyOf(m.who) === 'agent') {
|
|
1019
1313
|
if (m.update.state === 'fixed') {
|
|
1020
1314
|
// a thread opened with words holds nothing to judge: fixed ends its work, never asks a verdict
|
|
@@ -1072,7 +1366,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1072
1366
|
break
|
|
1073
1367
|
}
|
|
1074
1368
|
}
|
|
1075
|
-
// the
|
|
1369
|
+
// the version that redoes it landed: the work its verdict owed is over
|
|
1076
1370
|
const owed = verdictOf(x)?.status
|
|
1077
1371
|
if (superseded && i.origin.by === 'agent' && s.state === 'claimed' && owed !== undefined) return { ...(s.topic ? { topic: s.topic } : {}), state: 'closed', why: owed }
|
|
1078
1372
|
if (verdictOf(x) === null) {
|
|
@@ -1082,7 +1376,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1082
1376
|
return s
|
|
1083
1377
|
}
|
|
1084
1378
|
|
|
1085
|
-
/** a
|
|
1379
|
+
/** a version in work: a draft on a live shot, or an agent's version its latest update calls still broken or better */
|
|
1086
1380
|
export const inWork = (x: ReviewItem): boolean => stateOf(x, false).state === 'draft'
|
|
1087
1381
|
|
|
1088
1382
|
/** the states each op leaves from */
|
|
@@ -1125,7 +1419,7 @@ export function allowed(s: ItemState, op: Op, who: string, dispatcher: string |
|
|
|
1125
1419
|
if (op === 'claim' && s.state === 'claimed' && s.since !== undefined && s.worker !== who) return `already claimed by ${s.worker}: release it first (--as ${s.worker})`
|
|
1126
1420
|
if (op === 'claim' && s.state === 'blocked' && s.worker !== undefined && s.worker !== who) return `blocked by ${s.worker}, who takes it back (--as ${s.worker}); the dispatcher routes it to another`
|
|
1127
1421
|
if (op === 'claim' && s.state === 'closed' && s.why !== 'rejected' && s.why !== 'approved-with-fix')
|
|
1128
|
-
return `claim needs open, or a
|
|
1422
|
+
return `claim needs open, or a thread he answered « fix » or « no », it is closed (${s.why})`
|
|
1129
1423
|
if (!FROM[op].includes(s.state)) {
|
|
1130
1424
|
if (op === 'claim' && s.state === 'claimed') return `already claimed by ${s.worker ?? 'an agent'}`
|
|
1131
1425
|
if (op === 'claim' && s.state === 'new') return 'not dispatched yet: only the dispatcher sends an item to a topic'
|
|
@@ -1141,7 +1435,7 @@ export const STALE_CLAIM_MS = 2 * 60 * 60 * 1000
|
|
|
1141
1435
|
export const isStale = (x: ReviewItem, now: Date): boolean =>
|
|
1142
1436
|
stateOf(x, false).state === 'claimed' && now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created) > STALE_CLAIM_MS
|
|
1143
1437
|
|
|
1144
|
-
/** the lane working on an item now: it claimed it, no later
|
|
1438
|
+
/** the lane working on an item now: it claimed it, no later version redoes it, the claim is not stale; `until` is when it
|
|
1145
1439
|
* goes stale with no new message. Null when nobody does */
|
|
1146
1440
|
export function reworkOf(x: ReviewItem, superseded: boolean, now: Date): { lane: string; since: string; until: number } | null {
|
|
1147
1441
|
const s = stateOf(x, superseded)
|
|
@@ -1153,10 +1447,10 @@ export function reworkOf(x: ReviewItem, superseded: boolean, now: Date): { lane:
|
|
|
1153
1447
|
/** an item the owner opened for marks only: every message a rating (an empty one is a marks item just opened) */
|
|
1154
1448
|
export const isMarkItem = (x: ReviewItem): boolean => x.item.origin.by === 'owner' && x.item.views.length === 0 && x.thread.every((m) => m.rate !== undefined || m.op === 'seen')
|
|
1155
1449
|
|
|
1156
|
-
/** the lane an item belongs to: the lane that made a
|
|
1450
|
+
/** the lane an item belongs to: the lane that made a version, or the one he raised an item to */
|
|
1157
1451
|
export const laneOf = (x: ReviewItem): string | undefined => (x.item.origin.by === 'player' ? undefined : x.item.origin.lane)
|
|
1158
1452
|
|
|
1159
|
-
/** what a watch keeps: one session's
|
|
1453
|
+
/** what a watch keeps: one session's items (`--mine`), one lane's items (`--lane`); null keeps all */
|
|
1160
1454
|
export interface WatchFilter {
|
|
1161
1455
|
session: string | null
|
|
1162
1456
|
lane: string | null
|
|
@@ -1170,36 +1464,38 @@ export interface Watcher extends WatchFilter {
|
|
|
1170
1464
|
by?: string
|
|
1171
1465
|
/** its heartbeat, rewritten every few seconds while it reads */
|
|
1172
1466
|
beat?: string
|
|
1467
|
+
/** one watch of `sk thread watch --house`: it hears every store its session holds threads in, a later one too */
|
|
1468
|
+
house?: true
|
|
1173
1469
|
}
|
|
1174
1470
|
|
|
1175
1471
|
/** a watch with this filter reads his answers on `x` */
|
|
1176
|
-
export const
|
|
1472
|
+
export const coversItem = (f: WatchFilter, x: ReviewItem): boolean =>
|
|
1177
1473
|
(f.session === null || (x.item.origin.by === 'agent' && x.item.origin.session === f.session)) && (f.lane === null || laneOf(x) === f.lane)
|
|
1178
1474
|
|
|
1179
1475
|
/** why a bare watch may not start: another one lives in the repo, so a verdict would reach two sessions. null when
|
|
1180
|
-
* none does. A repo keeps one, the dispatcher's; every other session watches its own
|
|
1476
|
+
* none does. A repo keeps one, the dispatcher's; every other session watches its own items or its lane's */
|
|
1181
1477
|
export function bareWatchTaken(live: readonly Watcher[], self: number): string | null {
|
|
1182
1478
|
const other = live.find((w) => w.pid !== self && w.lane === null && w.session === null)
|
|
1183
|
-
return other ? `a watch of every
|
|
1479
|
+
return other ? `a watch of every thread already runs (pid ${other.pid}): a repo keeps one, the dispatcher's. Yours: sk thread watch --mine, or --lane <id>` : null
|
|
1184
1480
|
}
|
|
1185
1481
|
|
|
1186
|
-
/** what `review add` says when no live watch of the
|
|
1482
|
+
/** what `review add` says when no live watch of the item's own session or lane will read his answer, else null: an
|
|
1187
1483
|
* unfiltered watch (a dispatcher, another session) hears it for someone else */
|
|
1188
1484
|
export function unheardLine(item: Item, watchers: readonly Watcher[]): string | null {
|
|
1189
1485
|
const o = item.origin
|
|
1190
1486
|
if (o.by !== 'agent') return null
|
|
1191
1487
|
const own = o.session || o.lane ? watchers.filter((w) => (o.session && w.session === o.session) || (o.lane && w.lane === o.lane)) : watchers
|
|
1192
|
-
if (own.some((w) =>
|
|
1488
|
+
if (own.some((w) => coversItem(w, { item, thread: [] }))) return null
|
|
1193
1489
|
const watch = o.session ? 'sk thread watch --mine' : o.lane ? `sk thread watch --lane ${o.lane}` : 'sk thread watch'
|
|
1194
1490
|
return `no watch hears this thread: run \`${watch}\` under a monitor now, so his answer reaches you as it lands`
|
|
1195
1491
|
}
|
|
1196
1492
|
|
|
1197
|
-
/**
|
|
1493
|
+
/** an item's own session has this long after its last message to claim it before a watch calls it untaken */
|
|
1198
1494
|
export const UNTAKEN_GRACE_MS = 2 * 60 * 1000
|
|
1199
|
-
/**
|
|
1495
|
+
/** an item nobody takes is told again this often */
|
|
1200
1496
|
export const UNTAKEN_AGAIN_MS = STALE_CLAIM_MS
|
|
1201
1497
|
|
|
1202
|
-
/** why an item waits on the agents and nobody holds it, else null; `superseded`: a later
|
|
1498
|
+
/** why an item waits on the agents and nobody holds it, else null; `superseded`: a later version follows it; `heard`: a
|
|
1203
1499
|
* live watch hears its thread's holder (threads.ts listenersOf) */
|
|
1204
1500
|
export function untakenOf(x: ReviewItem, superseded: boolean, heard: boolean, now: Date, routed = true): string | null {
|
|
1205
1501
|
if (superseded) return null
|
|
@@ -1218,13 +1514,13 @@ export function untakenOf(x: ReviewItem, superseded: boolean, heard: boolean, no
|
|
|
1218
1514
|
export const ID_RE = /^\d{8}-\d{6}-[a-z0-9-]+$/
|
|
1219
1515
|
|
|
1220
1516
|
const addressList = (v: unknown): boolean => Array.isArray(v) && v.length > 0 && v.every((a) => typeof a === 'string' && ADDRESS_RE.test(a))
|
|
1221
|
-
export const FILE_RE = /^((v\d+-)?((image|before|after|poster|wave|before-wave)\.(png|jpe?g|webp)|(video|before|after)\.(webm|mp4)|(audio|before|after)\.(wav|mp3|flac|ogg|opus|m4a))|v\d+-g\d+(-before)?\.(png|jpe?g|webp))$/
|
|
1517
|
+
export const FILE_RE = /^((v\d+-)?((image|before|after|poster|wave|before-wave)\.(png|jpe?g|webp)|(video|before|after)\.(webm|mp4)|(audio|before|after)\.(wav|mp3|flac|ogg|opus|m4a)|space\.(ply|spz|glb))|v\d+-g\d+(-before)?\.(png|jpe?g|webp))$/
|
|
1222
1518
|
/** a message's image as an item's media names it: `thread/<file>` */
|
|
1223
|
-
export const isThreadMedia = (n: string): boolean => n.startsWith('thread/') && MESSAGE_FILE_RE.test(n.slice('thread/'.length))
|
|
1519
|
+
export const isThreadMedia = (n: string): boolean => n.startsWith('thread/') && (MESSAGE_FILE_RE.test(n.slice('thread/'.length)) || MESSAGE_ATTACH_RE.test(n.slice('thread/'.length)))
|
|
1224
1520
|
/** a name an item's media may hold: a view's file or a message's image */
|
|
1225
1521
|
export const isMediaName = (n: string): boolean => FILE_RE.test(n) || isThreadMedia(n)
|
|
1226
1522
|
/** every file of an item the media store keeps: its views' files, then its messages' images */
|
|
1227
|
-
export const mediaFilesOf = (x: { item: Item; thread: readonly Message[] }): string[] => [...viewFilesOf(x.item), ...x.thread.flatMap((m) => (m.image ? [`thread/${m.image}`] : []))]
|
|
1523
|
+
export const mediaFilesOf = (x: { item: Item; thread: readonly Message[] }): string[] => [...viewFilesOf(x.item), ...x.thread.flatMap((m) => [...(m.image ? [`thread/${m.image}`] : []), ...(m.files ?? []).map((f) => `thread/${f.file}`)])]
|
|
1228
1524
|
/** the message images an item's media already holds: a rewrite of its views keeps their facts */
|
|
1229
1525
|
export const threadMediaOf = (i: Item): string[] => Object.keys(i.media ?? {}).filter(isThreadMedia)
|
|
1230
1526
|
const TILE_RE = /^v\d+-g\d+\.(png|jpe?g|webp)$/
|
|
@@ -1241,34 +1537,17 @@ const WAVE_RE = /^(v\d+-)?(wave|before-wave)\.png$/
|
|
|
1241
1537
|
|
|
1242
1538
|
export const isPair = (f: ReviewFiles): f is { before: string; after: string } => 'before' in f
|
|
1243
1539
|
|
|
1244
|
-
/** what
|
|
1540
|
+
/** what an item is about, as the list and the CLI name it: its topic, then its subject (once when they say the same).
|
|
1541
|
+
* The default subject (`shot`) names no kind of its own: an item on an address reads as that address's kind */
|
|
1245
1542
|
export function aboutText(i: Item, spec: Spec = NO_SPEC): string {
|
|
1246
|
-
const
|
|
1543
|
+
const own = i.subject.kind === 'shot' && i.on !== undefined ? canonicalAddress(i.on) : null
|
|
1544
|
+
const subject = subjectLabel(own !== null ? own.slice(0, own.indexOf(':')) : i.subject.kind, spec)
|
|
1247
1545
|
const topic = i.topic ? topicLabel(i.topic, spec) : subject
|
|
1248
1546
|
return topic === subject ? subject : `${topic} · ${subject}`
|
|
1249
1547
|
}
|
|
1250
1548
|
|
|
1251
|
-
/** the lowercase ascii words of a title */
|
|
1252
|
-
export const wordsOf = (title: string): string[] =>
|
|
1253
|
-
title
|
|
1254
|
-
.normalize('NFD')
|
|
1255
|
-
.replace(/\p{M}/gu, '')
|
|
1256
|
-
.toLowerCase()
|
|
1257
|
-
.split(/[^a-z0-9]+/)
|
|
1258
|
-
.filter((w) => w !== '')
|
|
1259
|
-
|
|
1260
|
-
/** the lowercase ascii words of a title, for the id, cut on a word */
|
|
1261
|
-
function slugOf(title: string): string {
|
|
1262
|
-
let s = ''
|
|
1263
|
-
for (const w of wordsOf(title)) {
|
|
1264
|
-
if (s && s.length + 1 + w.length > 40) break
|
|
1265
|
-
s = s ? `${s}-${w}` : w.slice(0, 40)
|
|
1266
|
-
}
|
|
1267
|
-
return s || 'request'
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
1549
|
/** `YYYYMMDD-HHMMSS-<slug>`, local time */
|
|
1271
|
-
export const idOf = (at: Date, title: string): string => `${stampOf(at)}-${slugOf(title)}`
|
|
1550
|
+
export const idOf = (at: Date, title: string): string => `${stampOf(at)}-${slugOf(title, { max: 40 }) || 'request'}`
|
|
1272
1551
|
|
|
1273
1552
|
const obj = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
1274
1553
|
const unit = (n: unknown): n is number => typeof n === 'number' && Number.isFinite(n) && n >= 0 && n <= 1
|
|
@@ -1283,7 +1562,7 @@ function subjectProblems(s: unknown, spec: Spec): string[] {
|
|
|
1283
1562
|
if (!kind && !BUILTIN_KINDS[s.kind] && declared.length > 0) return [`subject: kind « ${s.kind} » is none of ${[...new Set([...declared, ...Object.keys(BUILTIN_KINDS)])].join(', ')}`]
|
|
1284
1563
|
if (kind?.problems) return kind.problems(s as Subject).map((p) => `subject: ${p}`)
|
|
1285
1564
|
if (s.kind === 'store' && !kind) return isStoreSubject(s as Subject) && s.store !== '' && s.asset !== '' ? [] : ['subject: a store thing has its store and asset']
|
|
1286
|
-
if (s.kind === 'post' && !kind) return isPostSubject(s as Subject) ? [] : ['subject: a post request names its
|
|
1565
|
+
if (s.kind === 'post' && !kind) return isPostSubject(s as Subject) ? [] : ['subject: a post request names its thread']
|
|
1287
1566
|
if (s.kind === 'object') return typeof s.address === 'string' && ADDRESS_RE.test(s.address) ? [] : ['subject: an object names its address <kind>:<key>']
|
|
1288
1567
|
if (s.kind !== 'frame') return []
|
|
1289
1568
|
const str = (k: string): boolean => typeof s[k] === 'string' && s[k] !== ''
|
|
@@ -1312,18 +1591,23 @@ function originProblems(o: unknown): string[] {
|
|
|
1312
1591
|
return ['origin.by: agent, owner, player or auto']
|
|
1313
1592
|
}
|
|
1314
1593
|
|
|
1315
|
-
function
|
|
1594
|
+
function draftItemProblems(d: unknown): string[] {
|
|
1316
1595
|
const text = (v: unknown): boolean => typeof v === 'string' && v !== ''
|
|
1317
1596
|
if (!obj(d) || !text(d.slug) || !text(d.hash) || !Array.isArray(d.posts)) return ['draft: { slug, hash, posts: [{ key, name, hash }] }']
|
|
1318
1597
|
const out: string[] = []
|
|
1319
1598
|
d.posts.forEach((p: unknown, k: number) => {
|
|
1320
1599
|
if (!obj(p) || typeof p.key !== 'string' || !POST_KEY.test(p.key) || !text(p.name) || !text(p.hash)) out.push(`draft.posts[${k}]: { key: <account>[/<name>], name, hash }`)
|
|
1600
|
+
else if (p.state !== undefined && p.state !== 'posted' && p.state !== 'dropped') out.push(`draft.posts[${k}].state: posted or dropped`)
|
|
1601
|
+
else if (p.words !== undefined && !(obj(p.words) && typeof p.words.body === 'string' && Object.entries(p.words).every(([f, v]) => (DRAFT_FIELDS as readonly string[]).includes(f) && typeof v === 'string')))
|
|
1602
|
+
out.push(`draft.posts[${k}].words: { body, title?, tags?, media?, place? }, each a text`)
|
|
1321
1603
|
})
|
|
1604
|
+
if (d.head !== undefined && !(obj(d.head) && typeof d.head.title === 'string' && (d.head.angle === undefined || typeof d.head.angle === 'string'))) out.push('draft.head: { title, angle? }')
|
|
1605
|
+
if (d.by !== undefined && !text(d.by)) out.push('draft.by: who saved it')
|
|
1322
1606
|
if (d.posts.length === 0) out.push('draft.posts: one message or more')
|
|
1323
1607
|
return out
|
|
1324
1608
|
}
|
|
1325
1609
|
|
|
1326
|
-
function
|
|
1610
|
+
function trailerItemProblems(t: unknown): string[] {
|
|
1327
1611
|
const side = (v: unknown): boolean => obj(v) && typeof v.cut === 'string' && v.cut !== '' && typeof v.render === 'number' && Number.isFinite(v.render)
|
|
1328
1612
|
if (!obj(t) || typeof t.trailer !== 'string' || t.trailer === '' || !side(t.after)) return ['trailer: { trailer, after: { cut, render }, before?, shots }']
|
|
1329
1613
|
const out: string[] = []
|
|
@@ -1343,8 +1627,8 @@ export function itemProblems(v: unknown): string[] {
|
|
|
1343
1627
|
out.push(...subjectProblems(v.subject, NO_SPEC), ...originProblems(v.origin))
|
|
1344
1628
|
if (v.topic !== undefined && typeof v.topic !== 'string') out.push('topic: a text')
|
|
1345
1629
|
const agent = obj(v.origin) && v.origin.by === 'agent'
|
|
1346
|
-
// a draft
|
|
1347
|
-
const needsView = agent && v.draft === undefined && v.on === undefined && v.states === undefined
|
|
1630
|
+
// a draft version holds no picture: its body is the draft, read live; a thread opened with words names its address
|
|
1631
|
+
const needsView = agent && v.draft === undefined && v.on === undefined && v.states === undefined && v.doc === undefined
|
|
1348
1632
|
if (!Array.isArray(v.views) || (needsView && v.views.length === 0)) out.push(`views: a list${needsView ? ' of one view or more' : ''}`)
|
|
1349
1633
|
else
|
|
1350
1634
|
v.views.forEach((w: unknown, i: number) => {
|
|
@@ -1355,6 +1639,10 @@ export function itemProblems(v: unknown): string[] {
|
|
|
1355
1639
|
if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
|
|
1356
1640
|
const stateOk = (x: unknown): boolean => obj(x) && 'json' in x && (x.at === undefined || typeof x.at === 'string') && (x.files === undefined || (obj(x.files) && Object.values(x.files).every((f) => typeof f === 'string')))
|
|
1357
1641
|
if (v.states !== undefined && !(obj(v.states) && stateOk(v.states.after) && (v.states.before === undefined || stateOk(v.states.before)) && typeof v.on === 'string')) out.push('states: { before?, after }, each { json, files?, at? }, on a version that names its object (on)')
|
|
1642
|
+
if (obj(v.states)) for (const side of ['before', 'after'] as const) if (obj(v.states[side]) && v.states[side].views !== undefined && !kindViewsOk(v.states[side].views)) out.push(`states.${side}.views: a list of { id, label }, each id once`)
|
|
1643
|
+
const stillOk = (x: unknown): boolean => obj(x) && obj(x.files) && obj(x.size) && Object.values(x.files).length > 0 && Object.values(x.files).every((f) => typeof f === 'string' && FILE_RE.test(f))
|
|
1644
|
+
if (obj(v.states) && v.states.still !== undefined && !stillOk(v.states.still)) out.push('states.still: { files: { image } | { before, after }, size }, files of its folder')
|
|
1645
|
+
if (v.saved !== undefined && !(obj(v.saved) && typeof v.saved.by === 'string' && v.saved.by !== '' && v.states !== undefined)) out.push('saved: { by }, on a version that holds its states')
|
|
1358
1646
|
if (v.on !== undefined && !(typeof v.on === 'string' && ADDRESS_RE.test(v.on))) out.push('on: an address <kind>:<key>')
|
|
1359
1647
|
if (v.answers !== undefined && !(Array.isArray(v.answers) && v.answers.length > 0 && v.answers.every((a) => typeof a === 'string' && ID_RE.test(a))))
|
|
1360
1648
|
out.push('answers: a list of item ids')
|
|
@@ -1363,11 +1651,15 @@ export function itemProblems(v: unknown): string[] {
|
|
|
1363
1651
|
out.push('changelog: { category, line, rating? }, or absent')
|
|
1364
1652
|
if (v.light !== undefined && v.light !== 'review') out.push('light: review, or absent')
|
|
1365
1653
|
if (v.wip !== undefined && !(obj(v.wip) && typeof v.wip.live === 'string' && v.wip.live !== '' && Number.isInteger(v.wip.frame))) out.push('wip: { live, frame }, or absent')
|
|
1366
|
-
if (v.trailer !== undefined) out.push(...
|
|
1367
|
-
if (v.draft !== undefined) out.push(...
|
|
1368
|
-
if (v.
|
|
1654
|
+
if (v.trailer !== undefined) out.push(...trailerItemProblems(v.trailer))
|
|
1655
|
+
if (v.draft !== undefined) out.push(...draftItemProblems(v.draft))
|
|
1656
|
+
if (v.doc !== undefined) {
|
|
1657
|
+
const p = docProblem(v.doc)
|
|
1658
|
+
if (p !== null) out.push(p)
|
|
1659
|
+
}
|
|
1660
|
+
if (v.choice !== undefined && !(v.choice === true && Array.isArray(v.views) && v.views.length >= 2)) out.push('choice: true on a version of two views or more, or absent')
|
|
1369
1661
|
if (v.agentPick !== undefined && !(v.choice === true && Number.isInteger(v.agentPick) && Array.isArray(v.views) && (v.agentPick as number) >= 0 && (v.agentPick as number) < v.views.length))
|
|
1370
|
-
out.push('agentPick: the index of one of its views, on a choice
|
|
1662
|
+
out.push('agentPick: the index of one of its views, on a choice version, or absent')
|
|
1371
1663
|
if (v.ask !== undefined) {
|
|
1372
1664
|
out.push(...askHeadProblems(v.ask))
|
|
1373
1665
|
if (!(typeof v.on === 'string' && v.on.startsWith('ask:'))) out.push('ask: on the head of a thread ask:<id>')
|
|
@@ -1392,6 +1684,8 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1392
1684
|
if (v.op !== undefined && !OPS.includes(v.op as Op)) out.push(`op: one of ${OPS.join(', ')}`)
|
|
1393
1685
|
if (v.verdict !== undefined && !STATUSES.includes(v.verdict as ReviewStatus)) out.push(`verdict: one of ${STATUSES.join(', ')}`)
|
|
1394
1686
|
for (const k of ['text', 'image', 'note']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
|
|
1687
|
+
if (v.files !== undefined && !(Array.isArray(v.files) && v.files.length >= 1 && v.files.length <= MESSAGE_FILES_MAX && v.files.every((f, i) => !fileProblem(f, name, i))))
|
|
1688
|
+
out.push(`files: 1 to ${MESSAGE_FILES_MAX} of { file: <id>-f<n>.<ext> in order, name: a clean file name, size, type }`)
|
|
1395
1689
|
if (v.pick !== undefined && !(Number.isInteger(v.pick) && (v.pick as number) >= 0 && v.verdict !== undefined)) out.push('pick: a view index, on a verdict')
|
|
1396
1690
|
if (v.op === 'seen' && !(Array.isArray(v.of) && v.of.every((x) => typeof x === 'string'))) out.push('of: the ids a seen message read')
|
|
1397
1691
|
if (v.update !== undefined) {
|
|
@@ -1401,8 +1695,8 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1401
1695
|
if (typeof v.text !== 'string') out.push('update: its line in text')
|
|
1402
1696
|
}
|
|
1403
1697
|
if (v.re !== undefined && !(typeof v.re === 'string' && MESSAGE_RE.test(v.re))) out.push('re: the id of a message of the thread')
|
|
1404
|
-
if (v.step !== undefined && !(obj(v.step) && typeof v.step.of === 'string' && MESSAGE_RE.test(v.step.of) && Number.isInteger(v.step.i) && (v.step.i as number) >= 0 && v.ask !== undefined))
|
|
1405
|
-
out.push("step: { of: an instructions message id, i: its step }, on a question")
|
|
1698
|
+
if (v.step !== undefined && !(obj(v.step) && typeof v.step.of === 'string' && MESSAGE_RE.test(v.step.of) && Number.isInteger(v.step.i) && (v.step.i as number) >= 0 && (v.step.carries === undefined || (typeof v.step.carries === 'string' && MESSAGE_RE.test(v.step.carries))) && v.ask !== undefined))
|
|
1699
|
+
out.push("step: { of: an instructions message id, i: its step, carries?: a question's id }, on a question")
|
|
1406
1700
|
if (v.session !== undefined && typeof v.session !== 'string') out.push('session: a text')
|
|
1407
1701
|
if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
|
|
1408
1702
|
if (v.ask !== undefined) {
|
|
@@ -1441,10 +1735,16 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1441
1735
|
out.push('propose: fields, one named or two or more, each { key, before?, after, type?, lang?, view? }, each key once')
|
|
1442
1736
|
if (typeof v.text !== 'string') out.push('propose: its words in text')
|
|
1443
1737
|
}
|
|
1444
|
-
if (v.askState !== undefined && !(obj(v.askState) &&
|
|
1738
|
+
if (v.askState !== undefined && !(obj(v.askState) && (ASK_STATES as readonly string[]).includes(v.askState.state as string) && (v.askState.why === undefined || typeof v.askState.why === 'string') && (v.askState.state === 'merged' ? typeof v.askState.into === 'string' && v.askState.into !== '' : v.askState.into === undefined)))
|
|
1739
|
+
out.push(`askState: { state: ${ASK_STATES.join(', ')}, why?, into: the ask's id on a merged one only }`)
|
|
1445
1740
|
if (v.snooze !== undefined && !(obj(v.snooze) && (v.snooze.until === null || (typeof v.snooze.until === 'string' && !Number.isNaN(Date.parse(v.snooze.until)))))) out.push('snooze: { until: an ISO time, or null }')
|
|
1446
1741
|
if (v.urgent !== undefined && v.urgent !== true) out.push('urgent: true')
|
|
1742
|
+
if (v.carried !== undefined && !(obj(v.carried) && typeof v.carried.from === 'string' && v.carried.from !== '' && typeof v.carried.at === 'string' && v.answer !== undefined)) out.push('carried: { from: an ask id, at: an ISO time }, on an answer only')
|
|
1743
|
+
if (v.edit !== undefined && !(obj(v.edit) && typeof v.edit.of === 'string' && v.edit.of !== '' && Array.isArray(v.edit.diff) && v.edit.diff.every((l) => typeof l === 'string') && (v.edit.base === undefined || typeof v.edit.base === 'string') && (v.edit.folds === undefined || (typeof v.edit.folds === 'string' && v.edit.folds !== '')) && v.who === 'owner' && typeof v.text === 'string'))
|
|
1744
|
+
out.push("edit: { of: a version's id, diff: its changed lines, base?: the text before, folds?: the edit it takes the place of }, the owner's, its line in text")
|
|
1447
1745
|
if (v.action !== undefined && !(obj(v.action) && typeof v.action.name === 'string' && /^[a-z][a-z0-9-]*$/.test(v.action.name))) out.push('action: { name: a lowercase word }')
|
|
1746
|
+
if (v.act !== undefined && !(obj(v.act) && typeof v.act.name === 'string' && /^[a-z][a-z0-9-]*$/.test(v.act.name) && (v.act.post === undefined || (typeof v.act.post === 'string' && POST_KEY.test(v.act.post))) && (v.act.url === undefined || typeof v.act.url === 'string') && (v.act.undo === undefined || v.act.undo === true)))
|
|
1747
|
+
out.push('act: { name: a lowercase word, post?: <account>[/<name>], url?, undo?: true }')
|
|
1448
1748
|
if (v.answer !== undefined) {
|
|
1449
1749
|
const a = v.answer
|
|
1450
1750
|
const says = obj(a) && (a.option !== undefined || a.apply === true || typeof a.value === 'string' || typeof a.stored === 'string' || a.view !== undefined)
|
|
@@ -1466,11 +1766,17 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1466
1766
|
if (typeof v.text !== 'string') out.push('instructions: its words in text')
|
|
1467
1767
|
if (v.replaces !== undefined) out.push('instructions: superseded by order, never by replaces')
|
|
1468
1768
|
}
|
|
1469
|
-
if (v.
|
|
1769
|
+
if (v.to !== undefined && !(Array.isArray(v.to) && v.to.length > 0 && v.to.every(mentionOk) && typeof v.text === 'string' && v.who === 'owner')) out.push("to: the owner's words, one or more { name, lane, session? }, { name, session } or { name, advisor }")
|
|
1770
|
+
if (v.mute !== undefined && !(typeof v.mute === 'boolean' && v.who === 'owner')) out.push("mute: true or false, the owner's")
|
|
1771
|
+
if (v.op === undefined && v.verdict === undefined && v.rate === undefined && typeof v.text !== 'string' && !Array.isArray(v.rects) && v.snooze === undefined && v.askState === undefined && v.urgent === undefined && v.askBar === undefined && v.unhold === undefined && v.laneAsk === undefined && v.act === undefined && v.mute === undefined)
|
|
1470
1772
|
out.push('a message says something: text, rects, verdict, rate or op')
|
|
1471
1773
|
return out
|
|
1472
1774
|
}
|
|
1473
1775
|
|
|
1776
|
+
const word = (x: unknown): boolean => typeof x === 'string' && x !== ''
|
|
1777
|
+
const mentionOk = (m: unknown): boolean =>
|
|
1778
|
+
obj(m) && word(m.name) && (m.advisor !== undefined ? word(m.advisor) && m.lane === undefined && m.session === undefined : m.lane !== undefined ? word(m.lane) && (m.session === undefined || word(m.session)) : word(m.session))
|
|
1779
|
+
|
|
1474
1780
|
/** what is wrong with a gallery view: at least one image tile, each its file, its label and its size, and no media field */
|
|
1475
1781
|
function galleryProblems(v: Record<string, unknown>, at: string): string[] {
|
|
1476
1782
|
const g = v.gallery
|
|
@@ -1481,11 +1787,19 @@ function galleryProblems(v: Record<string, unknown>, at: string): string[] {
|
|
|
1481
1787
|
if (!ok) out.push(`${at}gallery[${k}]: { file: v<n>-g<k>.<png|jpg|webp>, label, size: { w, h } }`)
|
|
1482
1788
|
if (obj(t) && t.before !== undefined && !(typeof t.before === 'string' && TILE_BEFORE_RE.test(t.before))) out.push(`${at}gallery[${k}].before: v<n>-g<k>-before.<png|jpg|webp>`)
|
|
1483
1789
|
if (obj(t) && t.group !== undefined && !(typeof t.group === 'string' && t.group.trim() !== '')) out.push(`${at}gallery[${k}].group: a text`)
|
|
1790
|
+
if (obj(t) && t.view !== undefined && !(typeof t.view === 'string' && KIND_VIEW_RE.test(t.view))) out.push(`${at}gallery[${k}].view: a view's id, letters, digits, - and _`)
|
|
1484
1791
|
})
|
|
1485
1792
|
for (const k of ['files', 'size', 'clip', 'marks']) if (v[k] !== undefined) out.push(`${at}${k}: none on a gallery view`)
|
|
1486
1793
|
return out
|
|
1487
1794
|
}
|
|
1488
1795
|
|
|
1796
|
+
/** a state's views: each { id, label }, the id a frame key value, each once */
|
|
1797
|
+
function kindViewsOk(x: unknown): boolean {
|
|
1798
|
+
if (!Array.isArray(x) || x.length === 0) return false
|
|
1799
|
+
const ids = x.map((v: unknown) => (obj(v) && typeof v.id === 'string' && KIND_VIEW_RE.test(v.id) && typeof v.label === 'string' && v.label.trim() !== '' ? v.id : null))
|
|
1800
|
+
return ids.every((id) => id !== null) && new Set(ids).size === ids.length
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1489
1803
|
/** what is wrong with one view's files, size and marks, each reason under `at` */
|
|
1490
1804
|
function viewProblems(v: Record<string, unknown>, at: string): string[] {
|
|
1491
1805
|
const out: string[] = []
|
|
@@ -1514,6 +1828,14 @@ function viewProblems(v: Record<string, unknown>, at: string): string[] {
|
|
|
1514
1828
|
if (!obj(c) || typeof c.poster !== 'string' || !POSTER_RE.test(c.poster) || !(Number(c.duration) > 0) || !(Number(c.fps) > 0)) out.push(`${at}clip: { poster, duration, fps } on a clip`)
|
|
1515
1829
|
if (v.marks !== undefined) out.push(`${at}marks: none on a clip`)
|
|
1516
1830
|
} else if (c !== undefined) out.push(`${at}clip: only on a clip`)
|
|
1831
|
+
const sc = v.scene
|
|
1832
|
+
if (sc !== undefined) {
|
|
1833
|
+
if (!obj(sc) || !SCENE_KINDS.includes(sc.kind as ReviewScene['kind'])) out.push(`${at}scene: { kind } of ${SCENE_KINDS.join(', ')}`)
|
|
1834
|
+
else if (sc.kind === 'pano' ? sc.file !== undefined : !(typeof sc.file === 'string' && SPACE_RE.test(sc.file) && SPACE_EXT[sc.kind as 'splat' | 'mesh'].test(sc.file)))
|
|
1835
|
+
out.push(sc.kind === 'pano' ? `${at}scene.file: none on a panorama` : `${at}scene.file: space.${sc.kind === 'splat' ? '<ply|spz>' : 'glb'} of its folder`)
|
|
1836
|
+
if (!obj(f) || !okImage(f.image)) out.push(`${at}scene: on one image`)
|
|
1837
|
+
if (v.marks !== undefined) out.push(`${at}marks: none on a scene`)
|
|
1838
|
+
}
|
|
1517
1839
|
if (v.marks !== undefined) {
|
|
1518
1840
|
const pair = obj(f) && typeof f.before === 'string'
|
|
1519
1841
|
const ok =
|
|
@@ -1536,16 +1858,16 @@ function viewProblems(v: Record<string, unknown>, at: string): string[] {
|
|
|
1536
1858
|
}
|
|
1537
1859
|
|
|
1538
1860
|
/** the verdict the page sends for an item, checked: every rectangle inside its view, a side exactly on a pair */
|
|
1539
|
-
/** what a rectangle on a trailer
|
|
1861
|
+
/** what a rectangle on a trailer version's frame carries beyond its box: the time on the cut it was drawn at, the shot and
|
|
1540
1862
|
* the seconds into it, and with a before the render it sits on; null with its errors pushed */
|
|
1541
|
-
function trailerRect(r: Record<string, unknown>, t:
|
|
1863
|
+
function trailerRect(r: Record<string, unknown>, t: ItemTrailer, i: number, errors: string[]): Pick<Rect, 't' | 'shot' | 'side'> | null {
|
|
1542
1864
|
const at = r.t
|
|
1543
1865
|
const shot = r.shot as { name?: unknown; time?: unknown } | undefined
|
|
1544
1866
|
const bad: string[] = []
|
|
1545
1867
|
if (typeof at !== 'number' || !Number.isFinite(at) || at < 0) bad.push(`rects[${i}].t: the time on the cut it was drawn at`)
|
|
1546
1868
|
if (!obj(shot) || typeof shot.name !== 'string' || shot.name === '' || typeof shot.time !== 'number' || !Number.isFinite(shot.time) || shot.time < 0)
|
|
1547
1869
|
bad.push(`rects[${i}].shot: { name, time }, the shot it sits on and the seconds into it`)
|
|
1548
|
-
if (t.before ? r.side !== 'before' && r.side !== 'after' : r.side !== undefined) bad.push(`rects[${i}].side: ${t.before ? 'before or after, the render it is drawn on' : 'none on a trailer
|
|
1870
|
+
if (t.before ? r.side !== 'before' && r.side !== 'after' : r.side !== undefined) bad.push(`rects[${i}].side: ${t.before ? 'before or after, the render it is drawn on' : 'none on a trailer version with no before'}`)
|
|
1549
1871
|
errors.push(...bad)
|
|
1550
1872
|
if (bad.length > 0 || !obj(shot)) return null
|
|
1551
1873
|
return { t: at as number, shot: { name: shot.name as string, time: shot.time as number }, ...(t.before ? { side: r.side as Side } : {}) }
|
|
@@ -1570,7 +1892,7 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1570
1892
|
const view = r.view === undefined ? 0 : r.view
|
|
1571
1893
|
const on = typeof view === 'number' && Number.isInteger(view) && (r.view === undefined || view >= 1) ? views[view] : undefined
|
|
1572
1894
|
if (!on) {
|
|
1573
|
-
errors.push(`rects[${i}].view: the index of one of the
|
|
1895
|
+
errors.push(`rects[${i}].view: the index of one of the version's other views (absent on the first)`)
|
|
1574
1896
|
continue
|
|
1575
1897
|
}
|
|
1576
1898
|
if (isGallery(on)) {
|
|
@@ -1587,7 +1909,7 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1587
1909
|
errors.push(`rects[${i}].view: no rectangle on a sound, react to the view instead`)
|
|
1588
1910
|
continue
|
|
1589
1911
|
}
|
|
1590
|
-
if (view === 0 &&
|
|
1912
|
+
if (view === 0 && isTrailerItem(item)) {
|
|
1591
1913
|
const r2 = trailerRect(r, item.trailer, i, errors)
|
|
1592
1914
|
if (r2) out.push({ x: r.x, y: r.y, w: r.w, h: r.h, comment: typeof r.comment === 'string' ? r.comment : '', ...r2 })
|
|
1593
1915
|
continue
|
|
@@ -1605,11 +1927,11 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1605
1927
|
if (clip && typeof t === 'number') rect.t = t
|
|
1606
1928
|
out.push(rect)
|
|
1607
1929
|
}
|
|
1608
|
-
const reactions = reactionsOf(body.reactions, views, errors, isChoice(item),
|
|
1930
|
+
const reactions = reactionsOf(body.reactions, views, errors, isChoice(item), isDraftItem(item))
|
|
1609
1931
|
const pick = body.pick
|
|
1610
1932
|
if (pick !== undefined) {
|
|
1611
|
-
if (!isChoice(item)) errors.push('pick: only on a choice
|
|
1612
|
-
else if (!(typeof pick === 'number' && Number.isInteger(pick) && pick >= 0 && pick < views.length)) errors.push(`pick: the index of one of the
|
|
1933
|
+
if (!isChoice(item)) errors.push('pick: only on a choice version')
|
|
1934
|
+
else if (!(typeof pick === 'number' && Number.isInteger(pick) && pick >= 0 && pick < views.length)) errors.push(`pick: the index of one of the version's ${views.length} views`)
|
|
1613
1935
|
else if (!isApproved(body.status as ReviewStatus)) errors.push('pick: goes with approved or approved-with-fix; rejecting every option is a plain rejected')
|
|
1614
1936
|
}
|
|
1615
1937
|
if (errors.length > 0) return { ok: false, errors }
|
|
@@ -1626,9 +1948,9 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1626
1948
|
}
|
|
1627
1949
|
}
|
|
1628
1950
|
|
|
1629
|
-
/** the reactions the page sends, checked against the
|
|
1630
|
-
* or tile; on a draft
|
|
1631
|
-
* too: the
|
|
1951
|
+
/** the reactions the page sends, checked against the version's views: each on a view, a tile only on a gallery, one per view
|
|
1952
|
+
* or tile; on a draft version each on a message of the draft, by its key (one the draft gained since the version is taken
|
|
1953
|
+
* too: the version shows the draft live); an empty one is dropped */
|
|
1632
1954
|
function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[], choice: boolean, draft: boolean): ReviewReaction[] {
|
|
1633
1955
|
if (v === undefined) return []
|
|
1634
1956
|
if (!Array.isArray(v)) {
|
|
@@ -1646,7 +1968,7 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1646
1968
|
}
|
|
1647
1969
|
const on = obj(r) && typeof r.view === 'number' && Number.isInteger(r.view) ? views[r.view] : undefined
|
|
1648
1970
|
if (!obj(r) || !on) {
|
|
1649
|
-
errors.push(`reactions[${i}].view: the index of one of the
|
|
1971
|
+
errors.push(`reactions[${i}].view: the index of one of the version's views`)
|
|
1650
1972
|
continue
|
|
1651
1973
|
}
|
|
1652
1974
|
const tiles = isGallery(on) ? on.gallery.length : 0
|
|
@@ -1658,7 +1980,7 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1658
1980
|
// a choice scores its options, a gallery each of its tiles
|
|
1659
1981
|
const scored = choice || (typeof tile === 'number' && tiles > 0)
|
|
1660
1982
|
if (stars !== undefined && !(scored && typeof stars === 'number' && Number.isInteger(stars) && stars >= 1 && stars <= STARS))
|
|
1661
|
-
errors.push(scored ? `reactions[${i}].stars: 1 to ${STARS}` : `reactions[${i}].stars: only on a choice
|
|
1983
|
+
errors.push(scored ? `reactions[${i}].stars: 1 to ${STARS}` : `reactions[${i}].stars: only on a choice version or a gallery tile`)
|
|
1662
1984
|
const key = `${String(r.view)}/${String(tile ?? '')}`
|
|
1663
1985
|
if (seen.has(key)) errors.push(`reactions[${i}]: a second reaction on the same view or tile`)
|
|
1664
1986
|
seen.add(key)
|
|
@@ -1684,11 +2006,11 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1684
2006
|
return out
|
|
1685
2007
|
}
|
|
1686
2008
|
|
|
1687
|
-
/** a reaction to one message of a draft
|
|
2009
|
+
/** a reaction to one message of a draft version, checked: its key, OK, fix or no, his word; null with its errors pushed, or
|
|
1688
2010
|
* when it says nothing */
|
|
1689
2011
|
function postReaction(r: Record<string, unknown>, i: number, draft: boolean, seen: Set<string>, errors: string[]): ReviewReaction | null {
|
|
1690
2012
|
const bad: string[] = []
|
|
1691
|
-
if (!draft) bad.push(`reactions[${i}].post: only on a draft
|
|
2013
|
+
if (!draft) bad.push(`reactions[${i}].post: only on a draft version`)
|
|
1692
2014
|
else if (typeof r.post !== 'string' || !POST_KEY.test(r.post)) bad.push(`reactions[${i}].post: the key of one message of the draft, <account> or <account>/<name>`)
|
|
1693
2015
|
if (r.status !== undefined && !STATUSES.includes(r.status as ReviewStatus)) bad.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
1694
2016
|
if (r.comment !== undefined && typeof r.comment !== 'string') bad.push(`reactions[${i}].comment: a text`)
|
|
@@ -1702,12 +2024,12 @@ function postReaction(r: Record<string, unknown>, i: number, draft: boolean, see
|
|
|
1702
2024
|
return { view: 0, post: r.post as string, ...(r.status !== undefined ? { status: r.status as ReviewStatus } : {}), comment }
|
|
1703
2025
|
}
|
|
1704
2026
|
|
|
1705
|
-
/** a draft
|
|
1706
|
-
export const postLabel = (draft:
|
|
2027
|
+
/** a draft version's message as the page and the CLI name it: the name the version pinned, else its key (one the draft gained since) */
|
|
2028
|
+
export const postLabel = (draft: ItemDraft | undefined, key: string): string => draft?.posts.find((p) => p.key === key)?.name ?? key
|
|
1707
2029
|
|
|
1708
2030
|
/** what a reaction or a rectangle is on, as the CLI prints it: its view's letter and label, `[B from above]`,
|
|
1709
|
-
* `[C trees / oak-v2]`, `[A]`; on a draft
|
|
1710
|
-
export function placeText(r: { view?: number | undefined; tile?: number | undefined; post?: string | undefined }, views: readonly ReviewView[], draft?:
|
|
2031
|
+
* `[C trees / oak-v2]`, `[A]`; on a draft version the message's name, `[Reddit · comfyui]` */
|
|
2032
|
+
export function placeText(r: { view?: number | undefined; tile?: number | undefined; post?: string | undefined }, views: readonly ReviewView[], draft?: ItemDraft): string {
|
|
1711
2033
|
if (r.post !== undefined) return `[${postLabel(draft, r.post)}]`
|
|
1712
2034
|
const i = r.view ?? 0
|
|
1713
2035
|
const v = views[i]
|