rvlib-shipkit 2.26.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/package.json +1 -1
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +16 -7
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +12 -8
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/render.ts +122 -21
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +314 -40
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +322 -101
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +29 -17
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +44 -0
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +361 -14
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/check.ts +3 -1
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +20 -9
- package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +244 -27
- package/src/cli/cmd_Backup.ts +153 -10
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +1357 -223
- package/src/cli/cmd_Secret.ts +295 -24
- package/src/cli/cmd_Social.ts +113 -28
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +76 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +5 -3
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +44 -4
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +42 -41
- package/src/collections/collection-types.ts +30 -4
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +147 -61
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +4 -4
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +13 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +370 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +9 -11
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/slots.ts +5 -4
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +1 -1
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +59 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +161 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +18 -6
- package/src/home/home-routes.ts +76 -0
- package/src/home/inbox-shape.ts +234 -91
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +815 -0
- package/src/home/machine-host.ts +38 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/other-macs.ts +2 -2
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +179 -10
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +516 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +41 -6
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +347 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +102 -0
- package/src/hq/hq-local.ts +502 -0
- package/src/hq/hq-routes.ts +204 -0
- package/src/hq/hq-store.ts +603 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +374 -0
- package/src/hq/replica.ts +167 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +24 -11
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +81 -27
- package/src/ledger/gate-checks.ts +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +73 -25
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +25 -19
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +83 -31
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +76 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +24 -13
- package/src/media-store/forget.ts +141 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +21 -17
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +256 -0
- package/src/media-store/space.ts +46 -26
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +3 -3
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +191 -4
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +129 -37
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +11 -5
- package/src/releases/from-card.ts +1 -1
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +71 -19
- package/src/review/anim.ts +3 -3
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/auto.ts +2 -2
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +254 -0
- package/src/review/card-rows.ts +267 -0
- package/src/review/cells.ts +360 -57
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +33 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +152 -19
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +98 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +23 -10
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +582 -109
- package/src/review/move.ts +491 -0
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/notes.ts +12 -20
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +18 -20
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +194 -38
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +12 -8
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +851 -124
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +64 -0
- package/src/review/threads.ts +349 -14
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +6 -6
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +77 -11
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +23 -10
- package/src/rules/untrack-generated.ts +92 -8
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +116 -0
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +21 -17
- package/src/secrets/manager.ts +55 -26
- package/src/secrets/read.ts +385 -0
- package/src/secrets/tail.ts +31 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +49 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +72 -30
- package/src/serve/hub-app/col-list-page.tsx +125 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +17 -45
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +18 -39
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +142 -11
- package/src/serve/hub-app/home-strip.css +6 -25
- package/src/serve/hub-app/home-strip.tsx +60 -93
- package/src/serve/hub-app/home.html +10 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +71 -166
- package/src/serve/hub-app/hub-types.ts +5 -1
- package/src/serve/hub-app/hub.css +146 -71
- package/src/serve/hub-app/icons.tsx +32 -5
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +104 -61
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +227 -49
- package/src/serve/hub-app/inbox-view.tsx +204 -120
- package/src/serve/hub-app/inbox.css +47 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +32 -17
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +217 -0
- package/src/serve/hub-app/machines.css +67 -0
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +57 -0
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +4 -2
- package/src/serve/hub-app/messages/messages-page.tsx +81 -8
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +21 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +46 -8
- package/src/serve/hub-app/project-list.tsx +125 -59
- package/src/serve/hub-app/projects-svc.ts +83 -8
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +22 -6
- package/src/serve/hub-app/reflections-page.tsx +95 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +28 -4
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +75 -29
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +148 -87
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +160 -65
- package/src/serve/hub-app/review/review-page.tsx +12 -12
- package/src/serve/hub-app/review/review-st.ts +174 -47
- package/src/serve/hub-app/review/review-thread.tsx +214 -53
- package/src/serve/hub-app/review/review-views.tsx +494 -159
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +288 -41
- package/src/serve/hub-app/review/trailer-card.tsx +2 -2
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +462 -97
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +43 -15
- package/src/serve/hub-app/social/kit.tsx +32 -13
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +142 -49
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +24 -5
- package/src/serve/hub-app/social/social-page.tsx +95 -36
- package/src/serve/hub-app/social/social-st.ts +162 -41
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +10 -17
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +97 -25
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +77 -0
- package/src/serve/hub-app/time.css +135 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +3 -11
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +6 -5
- package/src/serve/hub-runtime.ts +35 -8
- package/src/serve/project-gutter-route.ts +42 -19
- package/src/serve/project-gutter.ts +16 -50
- package/src/serve/same-origin.ts +13 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +38 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +3 -3
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +4 -4
- package/src/smoke/run-smoke.ts +6 -6
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/cover.ts +202 -0
- package/src/social/desk-index.ts +34 -13
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +7 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +111 -65
- package/src/social/media-kind.ts +68 -160
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +4 -4
- package/src/social/release-stage.ts +79 -63
- package/src/social/routes.ts +89 -24
- package/src/social/stage.ts +43 -58
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +347 -0
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +246 -47
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +16 -10
- package/src/suite/judge-suites.ts +41 -11
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +16 -10
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +360 -0
- package/src/vault/vault-import.ts +213 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -266
- package/src/social/migrate.ts +0 -123
package/src/review/model.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
// the one feedback store's model (wiki tools/shipkit/
|
|
1
|
+
// the one feedback store's model (wiki tools/shipkit/threads.md): every record the owner, a player or an agent raises
|
|
2
2
|
// is an ITEM, a head (`item.json`: a typed subject, who raised it, the views) and an append only thread of messages
|
|
3
3
|
// (verdicts, replies, ratings, state changes, read marks). The state is derived from the thread, never stored, so the
|
|
4
4
|
// hub and every CLI write at once with no lost update. Pure and browser safe: the store, the routes and the hub page
|
|
5
5
|
// share it. The on disk shape is the one a project's own review store writes, verbatim, so either store opens in the other.
|
|
6
6
|
import type { MediaFact } from '../media-store/fact.ts'
|
|
7
|
+
import type { KindColor } from './glyphs.ts'
|
|
8
|
+
import type { HoldsOpen } from './holds.ts'
|
|
9
|
+
import type { StepChoice } from './instructions.ts'
|
|
10
|
+
import { versionOf } from '../trailer/versions.ts'
|
|
11
|
+
import { SECRET_NAME } from '../secrets/name.ts'
|
|
7
12
|
|
|
8
13
|
/** WHAT is judged: `shot` (a plain image or clip), `screen`, `frame` (a frame of a trailer cut), or a kind a repo names
|
|
9
14
|
* for itself (a game's place, creature, song...), read as is */
|
|
@@ -45,17 +50,59 @@ export interface PostSubject extends Subject {
|
|
|
45
50
|
|
|
46
51
|
export const isPostSubject = (s: Subject): s is PostSubject => s.kind === 'post' && typeof s.card === 'string' && s.card !== ''
|
|
47
52
|
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
53
|
+
/** how two states of an object of a kind draw (wiki tools/shipkit/threads-how-it-fits.md, Kinds): its view twice, one
|
|
54
|
+
* shared state (one camera), or a table of its json fields; `diff.page` wins over both */
|
|
55
|
+
export const DIFF_DRAWS = ['views', 'fields'] as const
|
|
56
|
+
export type DiffDraw = (typeof DIFF_DRAWS)[number]
|
|
57
|
+
|
|
58
|
+
/** a question a kind asks of the owner: its words, and its answer: one of its options, or words */
|
|
59
|
+
export interface KindQuestion {
|
|
60
|
+
text: string
|
|
61
|
+
options?: readonly string[]
|
|
62
|
+
answer?: 'option' | 'words'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** a button the owner clicks on an object of a kind: a message the thread holds, which the holder's watch prints */
|
|
66
|
+
export interface KindAction {
|
|
67
|
+
label: string
|
|
68
|
+
icon?: string
|
|
69
|
+
/** what the holder does on it, one line, shown as the button's tooltip */
|
|
70
|
+
what?: string
|
|
71
|
+
/** the click opens a word box: the owner's words ride with the action */
|
|
72
|
+
words?: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** one kind of object a thread is about, declared once (wiki tools/shipkit/threads-how-it-fits.md, Kinds): the house's
|
|
76
|
+
* (review/kinds.ts) and a repo's `review({ kinds })` the same way. The pure part the model, the store and the hub read;
|
|
77
|
+
* review/unit.ts adds what runs on the server (read, apply, the data view) */
|
|
50
78
|
export interface SpecKind {
|
|
79
|
+
/** the word the threads list filters by */
|
|
51
80
|
label: string
|
|
81
|
+
/** its icon: SVG path data on the hub's 20 unit grid, one stroke (review/glyphs.ts); none, a neutral square */
|
|
52
82
|
icon?: string
|
|
83
|
+
/** its icon's colour, one of the kind hues (review/glyphs.ts KIND_HUES); none, the muted text colour */
|
|
84
|
+
color?: KindColor
|
|
85
|
+
/** the key's shape as an agent types it after `<kind>:` (`<species>`, `<screen>[/<part>]`): a kind with one, or with
|
|
86
|
+
* a `key`, names objects; one with neither is a subject kind only */
|
|
87
|
+
address?: string
|
|
53
88
|
/** what names one subject of this kind exactly, the kind left out; null names nothing */
|
|
54
89
|
key?(s: Subject): string | null
|
|
55
90
|
/** two subjects of this kind, in one topic, close enough to be one card */
|
|
56
91
|
near?(a: Subject, b: Subject): boolean
|
|
57
92
|
/** what is wrong with a subject of this kind; empty: nothing */
|
|
58
93
|
problems?(s: Subject): string[]
|
|
94
|
+
/** a page of the repo that draws ONE object from its state; its frame keys: threads-how-it-fits.md, The frame keys */
|
|
95
|
+
view?: { page: string }
|
|
96
|
+
/** how a change of an object of this kind draws: `draw` (`views` by default when the kind has a view, else `fields`),
|
|
97
|
+
* each json field's house value kind (`fields`: `color`, `code:<lang>`…), or a page of the repo that draws the whole
|
|
98
|
+
* change, which wins */
|
|
99
|
+
diff?: { draw?: DiffDraw; fields?: Record<string, string>; page?: string }
|
|
100
|
+
/** the questions this kind asks, by name */
|
|
101
|
+
questions?: Record<string, KindQuestion>
|
|
102
|
+
/** the buttons on an object of this kind, by name */
|
|
103
|
+
actions?: Record<string, KindAction>
|
|
104
|
+
/** an object of this kind attached to a thread holds it open until its condition is met (review/holds.ts) */
|
|
105
|
+
holdsOpen?: HoldsOpen
|
|
59
106
|
}
|
|
60
107
|
|
|
61
108
|
/** an area raised items are routed to, and the pages its worker reads first */
|
|
@@ -74,7 +121,9 @@ export interface Spec {
|
|
|
74
121
|
}
|
|
75
122
|
|
|
76
123
|
/** the kinds every repo has, whatever its unit declares */
|
|
77
|
-
|
|
124
|
+
/** the house kinds: review/kinds.ts owns them, the one registry */
|
|
125
|
+
export { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
|
|
126
|
+
import { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
|
|
78
127
|
|
|
79
128
|
export const NO_SPEC: Spec = { kinds: {}, topics: {}, dispatcher: false }
|
|
80
129
|
|
|
@@ -94,7 +143,84 @@ export type Origin =
|
|
|
94
143
|
/** what names one subject exactly, null when it names nothing (a plain shot, a screen): two items of different keys
|
|
95
144
|
* are never one subject. A kind the unit declares names it by its own `key`, or names nothing without one; a kind no
|
|
96
145
|
* unit declares by its first of species, key, slug, id */
|
|
146
|
+
/** an object's address (wiki tools/shipkit/threads-store.md, Addresses): one thread per address, for its whole life */
|
|
147
|
+
export const ADDRESS_RE = /^[a-z][a-z0-9-]*:[^\n]+$/
|
|
148
|
+
|
|
149
|
+
const canonical = new Map<string, string | null>()
|
|
150
|
+
|
|
151
|
+
/** an address in its one form, null when it is none (wiki tools/shipkit/threads-store.md, Addresses): trimmed and
|
|
152
|
+
* 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`. Every address written, read or compared goes through it */
|
|
154
|
+
export function canonicalAddress(raw: string): string | null {
|
|
155
|
+
const held = canonical.get(raw)
|
|
156
|
+
if (held !== undefined) return held
|
|
157
|
+
let a = raw.trim()
|
|
158
|
+
const file = /^trailer\/([^/\s]+)\/([^\s]+?)(?:\.trailer)?$/i.exec(a)
|
|
159
|
+
if (file) a = `trailer:${file[1]}/${file[2]}`
|
|
160
|
+
const colon = a.indexOf(':')
|
|
161
|
+
const kind = colon > 0 ? a.slice(0, colon).trim().toLowerCase() : ''
|
|
162
|
+
// a file's path and a branch's name keep their case: git and the disk read them case sensitive
|
|
163
|
+
const typed = colon > 0 ? a.slice(colon + 1).trim() : ''
|
|
164
|
+
let key = (kind === 'file' || kind === 'branch' ? typed : typed.toLowerCase()).replace(/\/+/g, '/').replace(/^\/|\/$/g, '')
|
|
165
|
+
if (kind === 'trailer') {
|
|
166
|
+
const parts = key.replace(/\.trailer$/, '').split('/')
|
|
167
|
+
if (parts.length >= 2 && /^v\d+$/.test(parts[1] ?? '')) parts[1] = versionOf(parts[1] ?? '')?.cut ?? parts[1] ?? ''
|
|
168
|
+
key = parts.join('/')
|
|
169
|
+
}
|
|
170
|
+
// an ask is named by its file: `ask:<id>.md` and `ask:<id>` are one thread
|
|
171
|
+
if (kind === 'ask') key = key.replace(/\.md$/, '')
|
|
172
|
+
let out: string | null = `${kind}:${key}`
|
|
173
|
+
if (out === 'page:review' || out.startsWith('page:review/')) out = `page:threads${out.slice('page:review'.length)}`
|
|
174
|
+
if (!/^[a-z][a-z0-9-]*$/.test(kind) || key === '' || /\s/.test(key) || !ADDRESS_RE.test(out)) out = null
|
|
175
|
+
canonical.set(raw, out)
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** an address as typed, in its one form, or a one line refusal that names the form */
|
|
180
|
+
export function addressOrThrow(raw: string): string {
|
|
181
|
+
const a = canonicalAddress(raw)
|
|
182
|
+
if (a !== null) return a
|
|
183
|
+
const colon = raw.indexOf(':')
|
|
184
|
+
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()} ?`)
|
|
185
|
+
throw new Error(`« ${raw.trim()} » is no address: <kind>:<key>, like screen:orders/list, asset:sword or trailer:<name>/<cut>`)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** an address as stored, in its one form; a stored one that reads as none stays as it was */
|
|
189
|
+
const canon = (a: string): string => canonicalAddress(a) ?? a
|
|
190
|
+
|
|
191
|
+
/** 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
|
+
* card names its cut itself; a name alone (an older card, a frame note) is read as a kept version when it reads as one */
|
|
193
|
+
export const cutAddress = (trailer: string, cut: string, of?: string): string => canon(`trailer:${trailer}/${of ?? versionOf(cut)?.cut ?? cut}`)
|
|
194
|
+
|
|
195
|
+
/** the address that is an item's own: the one its agent named, else its subject's (a trailer card or a frame note: the
|
|
196
|
+
* cut); null when it names none (a plain shot). One thread per own address */
|
|
197
|
+
export function ownAddressOf(i: Item, spec: Spec = NO_SPEC): string | null {
|
|
198
|
+
if (i.on !== undefined) return canon(i.on)
|
|
199
|
+
if (i.trailer) return cutAddress(i.trailer.trailer, i.trailer.after.cut, i.trailer.cut)
|
|
200
|
+
if (isFrame(i.subject)) return cutAddress(i.subject.trailer, i.subject.cut)
|
|
201
|
+
return subjectKey(i.subject, spec)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** the address above this one, null at the top: `draft:<slug>` above `draft:<slug>/discord` */
|
|
205
|
+
export function parentAddress(a: string): string | null {
|
|
206
|
+
const at = a.lastIndexOf('/')
|
|
207
|
+
return at > a.indexOf(':') ? a.slice(0, at) : null
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** every address one item names: its own, then the objects it is about */
|
|
211
|
+
export function addressesOf(i: Item, spec: Spec = NO_SPEC): string[] {
|
|
212
|
+
const own = ownAddressOf(i, spec)
|
|
213
|
+
return [...new Set([...(own !== null ? [own] : []), ...(i.about ?? []).map(canon)])]
|
|
214
|
+
}
|
|
215
|
+
|
|
97
216
|
export function subjectKey(s: Subject, spec: Spec = NO_SPEC): string | null {
|
|
217
|
+
const k = subjectKeyRaw(s, spec)
|
|
218
|
+
return k === null ? null : canon(k)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function subjectKeyRaw(s: Subject, spec: Spec): string | null {
|
|
222
|
+
// any object the hub shows, by its address: his note from its thread control
|
|
223
|
+
if (s.kind === 'object') return typeof s.address === 'string' && ADDRESS_RE.test(s.address) ? s.address : null
|
|
98
224
|
if (isFrame(s)) return `frame:${s.trailer}/${s.cut}/${s.shot}`
|
|
99
225
|
const kind = spec.kinds[s.kind]
|
|
100
226
|
if (!kind && isStoreSubject(s)) return `store:${s.store}/${s.asset}`
|
|
@@ -146,6 +272,8 @@ export interface MediaView {
|
|
|
146
272
|
marks?: ReviewMark[]
|
|
147
273
|
/** a line on this view alone (an option's description on a choice card) */
|
|
148
274
|
note?: string
|
|
275
|
+
/** a message holds it (an update, a question's option, a proposed sound): it draws in that message's cell */
|
|
276
|
+
message?: true
|
|
149
277
|
}
|
|
150
278
|
|
|
151
279
|
/** one image of a gallery view, a file of the folder (`v<n>-g<k>.<ext>`) */
|
|
@@ -219,6 +347,10 @@ export interface Item {
|
|
|
219
347
|
supersedes?: string
|
|
220
348
|
/** the raised items (a report, his note) this card answers: one thread per bug */
|
|
221
349
|
answers?: string[]
|
|
350
|
+
/** its subject's address when the agent names it (`sk thread post <address>`, `--on`): one thread per address */
|
|
351
|
+
on?: string
|
|
352
|
+
/** other objects it is about, each `<kind>:<key>`: links that find it, never its thread's address */
|
|
353
|
+
about?: string[]
|
|
222
354
|
/** what this new version keeps of the approved look it follows */
|
|
223
355
|
keeps?: string
|
|
224
356
|
/** why this card passed --new next to an active card */
|
|
@@ -232,8 +364,72 @@ export interface Item {
|
|
|
232
364
|
agentPick?: number
|
|
233
365
|
/** a trailer card: its body plays this cut in the trailer entry's player, never a compiled clip */
|
|
234
366
|
trailer?: TrailerCard
|
|
367
|
+
/** a draft card: its body shows this post draft read live, a block a message, never a picture of it */
|
|
368
|
+
draft?: DraftCard
|
|
369
|
+
/** 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
|
+
states?: { before?: StoredState; after: StoredState }
|
|
235
372
|
/** each media file the views name, by its name: what the Space keeps it under once the disk lets it go */
|
|
236
373
|
media?: Record<string, MediaFact>
|
|
374
|
+
/** an ask's facts, on the head of its thread `ask:<id>` (asks/ask-store.ts): its status and closed day are the
|
|
375
|
+
* thread's askState messages, its later day the thread's snooze, its body `what` */
|
|
376
|
+
ask?: AskHead
|
|
377
|
+
/** 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
|
+
asksVerdict?: true
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** a thread head that is an ask: on `ask:<id>` with its facts. The one test of « is an ask », for every reader */
|
|
382
|
+
export const isAskItem = (i: Pick<Item, 'on' | 'ask'>): boolean => i.ask !== undefined && (i.on ?? '').startsWith('ask:')
|
|
383
|
+
|
|
384
|
+
/** what an ask asks of the owner's hands; `answer` a question only he answers */
|
|
385
|
+
export const ASK_KINDS = ['action', 'purchase', 'credential', 'decision', 'answer'] as const
|
|
386
|
+
export type AskKind = (typeof ASK_KINDS)[number]
|
|
387
|
+
/** the other spellings a kind was written with, read as the one kind */
|
|
388
|
+
export const ASK_KIND_ALIASES: Readonly<Record<string, AskKind>> = { cred: 'credential', token: 'credential' }
|
|
389
|
+
/** the kind a word names, null for none */
|
|
390
|
+
export const askKindOf = (w: string): AskKind | null => ((ASK_KINDS as readonly string[]).includes(w) ? (w as AskKind) : (ASK_KIND_ALIASES[w] ?? null))
|
|
391
|
+
|
|
392
|
+
/** a warning an ask holds: the check that prints it and words of that one line */
|
|
393
|
+
export interface AskWait {
|
|
394
|
+
check: string
|
|
395
|
+
says: string
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** an ask's facts that its thread's messages do not already say */
|
|
399
|
+
export interface AskHead {
|
|
400
|
+
kind: AskKind
|
|
401
|
+
/** the day it was made, YYYY-MM-DD */
|
|
402
|
+
created: string
|
|
403
|
+
/** what it blocks, `-` for nothing named */
|
|
404
|
+
blocks: string
|
|
405
|
+
/** the shell probe that exits 0 once it is done */
|
|
406
|
+
check?: string
|
|
407
|
+
waits?: AskWait[]
|
|
408
|
+
/** the secret names a credential ask stores */
|
|
409
|
+
secrets?: string[]
|
|
410
|
+
/** those of its secrets stored with an account beside the value */
|
|
411
|
+
logins?: string[]
|
|
412
|
+
/** the day its one ping went, YYYY-MM-DD: never a second */
|
|
413
|
+
pinged?: string
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/
|
|
417
|
+
|
|
418
|
+
/** every reason a value is not an ask's head; empty, it is one */
|
|
419
|
+
export function askHeadProblems(v: unknown): string[] {
|
|
420
|
+
if (!obj(v)) return ['ask: { kind, created, blocks, … }']
|
|
421
|
+
const out: string[] = []
|
|
422
|
+
if (!(ASK_KINDS as readonly unknown[]).includes(v.kind)) out.push(`ask.kind: one of ${ASK_KINDS.join(', ')}`)
|
|
423
|
+
if (typeof v.created !== 'string' || !DAY_RE.test(v.created)) out.push('ask.created: YYYY-MM-DD')
|
|
424
|
+
if (typeof v.blocks !== 'string' || v.blocks === '') out.push('ask.blocks: a text, - for none')
|
|
425
|
+
if (v.check !== undefined && (typeof v.check !== 'string' || v.check.trim() === '')) out.push('ask.check: a shell line')
|
|
426
|
+
if (v.pinged !== undefined && (typeof v.pinged !== 'string' || !DAY_RE.test(v.pinged))) out.push('ask.pinged: YYYY-MM-DD')
|
|
427
|
+
const names = (x: unknown): boolean => Array.isArray(x) && x.every((n) => typeof n === 'string' && n !== '')
|
|
428
|
+
if (v.secrets !== undefined && !names(v.secrets)) out.push('ask.secrets: a list of secret names')
|
|
429
|
+
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')
|
|
430
|
+
if (v.waits !== undefined && !(Array.isArray(v.waits) && v.waits.every((w) => obj(w) && typeof w.check === 'string' && w.check !== '' && typeof w.says === 'string' && w.says.trim() !== '')))
|
|
431
|
+
out.push('ask.waits: a list of { check, says }, the words required')
|
|
432
|
+
return out
|
|
237
433
|
}
|
|
238
434
|
|
|
239
435
|
/** one render a trailer card plays: the cut, and the render pinned by its mtime in ms */
|
|
@@ -242,10 +438,12 @@ export interface TrailerSide {
|
|
|
242
438
|
render: number
|
|
243
439
|
}
|
|
244
440
|
|
|
245
|
-
/** what a trailer card plays (wiki tools/shipkit/
|
|
441
|
+
/** what a trailer card plays (wiki tools/shipkit/threads.md, A trailer): a cut of `trailer/<trailer>/`, the render it is
|
|
246
442
|
* compared with, the shots the change touched by name */
|
|
247
443
|
export interface TrailerCard {
|
|
248
444
|
trailer: string
|
|
445
|
+
/** the cut it is a version of: `main` for a kept `v15`; absent on a card made before it was written */
|
|
446
|
+
cut?: string
|
|
249
447
|
after: TrailerSide
|
|
250
448
|
before?: TrailerSide
|
|
251
449
|
shots: string[]
|
|
@@ -255,6 +453,28 @@ export interface TrailerCard {
|
|
|
255
453
|
|
|
256
454
|
export const isTrailerCard = (i: Item): i is Item & { trailer: TrailerCard } => i.trailer !== undefined
|
|
257
455
|
|
|
456
|
+
/** one message of a post draft as a draft card pinned it: its key in the draft (`x`, `reddit/comfyui`), its name as he
|
|
457
|
+
* reads it (« Reddit · comfyui »), the hash of what the draft says of it */
|
|
458
|
+
export interface DraftCardPost {
|
|
459
|
+
key: string
|
|
460
|
+
name: string
|
|
461
|
+
hash: string
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** what a draft card shows (wiki tools/shipkit/threads.md, A post draft): the draft `.shipkit/social/drafts/<slug>/`, read
|
|
465
|
+
* live. The hashes are the draft as it was sent: `hash` its head and angle, each message its own, so the card says what
|
|
466
|
+
* moved since. No view: the card holds no picture */
|
|
467
|
+
export interface DraftCard {
|
|
468
|
+
slug: string
|
|
469
|
+
hash: string
|
|
470
|
+
posts: DraftCardPost[]
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export const isDraftCard = (i: Item): i is Item & { draft: DraftCard } => i.draft !== undefined
|
|
474
|
+
|
|
475
|
+
/** a message's key in its draft: `<account>`, or `<account>/<name>` for one of several there */
|
|
476
|
+
export const POST_KEY = /^[a-z0-9-]+(?:\/[a-z0-9-]+)?$/
|
|
477
|
+
|
|
258
478
|
/** a choice card: he picks one of its views */
|
|
259
479
|
export const isChoice = (i: Item): boolean => i.choice === true
|
|
260
480
|
|
|
@@ -280,39 +500,42 @@ export function pasteBlock(i: Item, state: string, w: CardWhere): string {
|
|
|
280
500
|
return [
|
|
281
501
|
`review card "${i.title}" (${state}), id ${i.id}`,
|
|
282
502
|
`repo: ${w.root}`,
|
|
283
|
-
`see it whole: cd ${w.root} && sk
|
|
503
|
+
`see it whole: cd ${w.root} && sk thread show ${i.id}`,
|
|
284
504
|
`open: ${w.open}`,
|
|
285
505
|
...(w.phone ? [`phone: ${w.phone}`] : []),
|
|
286
506
|
].join('\n')
|
|
287
507
|
}
|
|
288
508
|
|
|
289
|
-
/** a view's
|
|
290
|
-
*
|
|
291
|
-
export
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
509
|
+
/** a view's number in its version: 1 for the first. Never a letter: a card's own views are often named A, B, C, and
|
|
510
|
+
* a letter assigned beside them would not match */
|
|
511
|
+
export const viewNo = (i: number): string => String(i + 1)
|
|
512
|
+
|
|
513
|
+
/** the index a typed view reference names: its number (`2`), or the letter it had before (`B`, AA the 27th) so a letter
|
|
514
|
+
* typed then still finds it; -1 for anything else */
|
|
515
|
+
export function viewRef(ref: string): number {
|
|
516
|
+
const r = ref.trim().toUpperCase()
|
|
517
|
+
if (/^\d+$/.test(r)) return Number(r) - 1
|
|
518
|
+
if (!/^[A-Z]+$/.test(r)) return -1
|
|
519
|
+
let n = 0
|
|
520
|
+
for (const c of r) n = n * 26 + (c.charCodeAt(0) - 64)
|
|
521
|
+
return n - 1
|
|
300
522
|
}
|
|
301
523
|
|
|
302
|
-
/** a view as the page and the CLI tag it: its version's number and its
|
|
303
|
-
export const viewTag = (n: number, i: number): string => `${n}.${
|
|
524
|
+
/** a view as the page and the CLI tag it: its version's number and its own, `3.2` */
|
|
525
|
+
export const viewTag = (n: number, i: number): string => `${n}.${viewNo(i)}`
|
|
304
526
|
|
|
305
|
-
/** a view's name as the page and the CLI show it: its label, or « view
|
|
306
|
-
export const viewName = (v: ReviewView | undefined, i: number): string => v?.label || `view ${
|
|
527
|
+
/** a view's name as the page and the CLI show it: its label, or « view 2 » */
|
|
528
|
+
export const viewName = (v: ReviewView | undefined, i: number): string => v?.label || `view ${viewNo(i)}`
|
|
307
529
|
|
|
308
|
-
/** a view named by its label, else by its letter (`B`); throws naming every view
|
|
530
|
+
/** a view named by its label, else by its number (`2`), else by the letter it had before (`B`); throws naming every view
|
|
531
|
+
* when none matches */
|
|
309
532
|
export function viewIndexOf(views: readonly { label: string }[], ref: string): number {
|
|
310
533
|
const r = ref.trim()
|
|
311
534
|
const byLabel = views.findIndex((v) => v.label === r)
|
|
312
535
|
if (r !== '' && byLabel >= 0) return byLabel
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${
|
|
536
|
+
const n = viewRef(r)
|
|
537
|
+
if (n >= 0 && n < views.length) return n
|
|
538
|
+
throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${viewNo(i)}${v.label ? ` "${v.label}"` : ''}`).join(', ')}`)
|
|
316
539
|
}
|
|
317
540
|
|
|
318
541
|
/** every media file a card's views name: images, pairs, clips and their posters, sounds and their waveforms, tiles */
|
|
@@ -368,10 +591,13 @@ export type ReviewStatus = (typeof STATUSES)[number]
|
|
|
368
591
|
|
|
369
592
|
export const isApproved = (s: ReviewStatus): boolean => s === 'approved' || s === 'approved-with-fix'
|
|
370
593
|
|
|
371
|
-
/** the owner's reaction to one view,
|
|
594
|
+
/** the owner's reaction to one view, to one tile of a gallery view, or to one message of a draft card; one per view,
|
|
595
|
+
* tile or message */
|
|
372
596
|
export interface ReviewReaction {
|
|
373
597
|
view: number
|
|
374
598
|
tile?: number
|
|
599
|
+
/** on a draft card: the message of the draft it answers, by its key (`x`, `reddit/comfyui`) */
|
|
600
|
+
post?: string
|
|
375
601
|
status?: ReviewStatus
|
|
376
602
|
comment: string
|
|
377
603
|
/** his score of the view, 1 to STARS */
|
|
@@ -380,8 +606,10 @@ export interface ReviewReaction {
|
|
|
380
606
|
picked?: true
|
|
381
607
|
}
|
|
382
608
|
|
|
383
|
-
/** a state change,
|
|
384
|
-
|
|
609
|
+
/** a state change, a read mark (`seen`, with the ids it read in `of`), a take (`take`: an agent holds the thread
|
|
610
|
+
* from now on, its state unchanged; review/parties.ts), or an agent on it (`working`, its line in `note`, none ends
|
|
611
|
+
* it; review/traces.ts) */
|
|
612
|
+
export const OPS = ['dispatch', 'ask', 'answer', 'reassign', 'claim', 'release', 'blocked', 'fixed', 'done', 'wontfix', 'drop', 'withdraw', 'reopen', 'ready', 'seen', 'take', 'working'] as const
|
|
385
613
|
export type Op = (typeof OPS)[number]
|
|
386
614
|
|
|
387
615
|
/** what an agent's update says of the work, at a glance: still broken, better, or fixed (it asks the owner's verdict again) */
|
|
@@ -424,6 +652,151 @@ export interface Message {
|
|
|
424
652
|
update?: MessageUpdate
|
|
425
653
|
/** his word on one message of the thread (a hint on an update): its id */
|
|
426
654
|
re?: string
|
|
655
|
+
/** the Claude Code session of the agent that wrote it: the thread's holder */
|
|
656
|
+
session?: string
|
|
657
|
+
/** the objects it attaches to its thread, each `<kind>:<key>` */
|
|
658
|
+
about?: string[]
|
|
659
|
+
/** a question to the owner: its words in `text`, its options, the option the agent picks */
|
|
660
|
+
ask?: MessageAsk
|
|
661
|
+
/** 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
|
+
step?: { of: string; i: number }
|
|
664
|
+
/** a change the agent proposes on an object's text: its words in `text` */
|
|
665
|
+
propose?: MessagePropose
|
|
666
|
+
/** the owner clicked one of the kind's actions on the thread's object */
|
|
667
|
+
action?: MessageAction
|
|
668
|
+
/** an ask's thread: its ask closed (done, declined) or opened again; a closed ask asks nothing more */
|
|
669
|
+
askState?: { state: 'open' | 'done' | 'declined'; why?: string }
|
|
670
|
+
/** 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
|
+
snooze?: { until: string | null }
|
|
672
|
+
/** an agent's message that brings back a thread set aside (wiki tools/shipkit/threads-asks.md, Snooze) */
|
|
673
|
+
urgent?: true
|
|
674
|
+
/** his answer to the question or the proposal `re` names: the option he clicked, or « apply » (an edit his `text`) */
|
|
675
|
+
answer?: MessageAnswer
|
|
676
|
+
/** the agent's object of the same thread (a question, a change, its words) this newer one supersedes, by its message
|
|
677
|
+
* id (wiki tools/shipkit/threads-asks.md, Superseded objects) */
|
|
678
|
+
replaces?: string
|
|
679
|
+
/** an ask's questions that its bar answers (« done ✓ », « I will not do this », the proof url), by their message ids:
|
|
680
|
+
* drawn nowhere, docked nowhere, waiting on nobody (wiki tools/shipkit/threads-asks.md, The ask bar) */
|
|
681
|
+
askBar?: string[]
|
|
682
|
+
/** an ask's instructions after its first, superseding the ones before it in the store's order: its words in `text`,
|
|
683
|
+
* its title, its facts as they stand now (its day and its ping stay the head's), and the questions it folds */
|
|
684
|
+
instructions?: { title: string; ask: Omit<AskHead, 'created' | 'pinged'>; folds: string[] }
|
|
685
|
+
/** an agent's message that waits for the owner's verdict; the owner's answer is the owner's message with `verdict` and `re` naming it
|
|
686
|
+
* (review/verdict-items.ts) */
|
|
687
|
+
asksVerdict?: true
|
|
688
|
+
/** the machine's: an attached object's hold flipped (review/holds.ts), its words in `text` */
|
|
689
|
+
hold?: { address: string; held: boolean; sha?: string; ahead?: number }
|
|
690
|
+
/** the owner's close of a held thread: the holds it releases, by address */
|
|
691
|
+
unhold?: string[]
|
|
692
|
+
/** the owner asks for a lane on the thread (review/lane-ask.ts): the owner's words in `text`, the orchestrator it
|
|
693
|
+
* waited on when asked; no reply, the thread's holder never hears it as one */
|
|
694
|
+
laneAsk?: { for: string; session?: string }
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/** what a question asks him for (wiki tools/shipkit/threads-asks.md, Answer kinds); absent on a question, a choice */
|
|
698
|
+
export const ANSWER_KINDS = ['choice', 'checklist', 'confirm', 'text', 'url', 'secret', 'file'] as const
|
|
699
|
+
export type AnswerKind = (typeof ANSWER_KINDS)[number]
|
|
700
|
+
|
|
701
|
+
/** `options`: a choice's options, a checklist's lines, empty for the other kinds */
|
|
702
|
+
export interface MessageAsk {
|
|
703
|
+
kind?: AnswerKind
|
|
704
|
+
options: string[]
|
|
705
|
+
pick?: number
|
|
706
|
+
/** option i's media: the item's view that holds it, null for words alone */
|
|
707
|
+
views?: (number | null)[]
|
|
708
|
+
/** a checklist's lines done before he looked, ticked from the start */
|
|
709
|
+
done?: number[]
|
|
710
|
+
/** an ask's instructions: each step's choice, its options as markdown lines and the agent's pick, null a step with
|
|
711
|
+
* none (review/instructions.ts); his pick rides on his tick of that step */
|
|
712
|
+
choices?: (StepChoice | null)[]
|
|
713
|
+
/** a secret's name in the house secret manager; `login`: an account goes with it */
|
|
714
|
+
secret?: { name: string; login?: true }
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/** how one field of a proposed change draws: a house kind (review/kinds.ts) */
|
|
718
|
+
export { DIFF_TYPES, type DiffType } from './kinds.ts'
|
|
719
|
+
import { DIFF_TYPES, sniffKind, type DiffType } from './kinds.ts'
|
|
720
|
+
|
|
721
|
+
/** 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
|
+
export interface ProposeField {
|
|
723
|
+
key: string
|
|
724
|
+
before?: string
|
|
725
|
+
after: string
|
|
726
|
+
type?: DiffType
|
|
727
|
+
lang?: string
|
|
728
|
+
view?: number
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** one field flat (`key` empty), or several in `fields`, `after` then their lines for an older reader */
|
|
732
|
+
export interface MessagePropose extends Omit<ProposeField, 'key'> {
|
|
733
|
+
on: string
|
|
734
|
+
fields?: ProposeField[]
|
|
735
|
+
/** the repo's page that draws the change, its kind's `diff.page` when it was proposed */
|
|
736
|
+
page?: string
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export interface MessageAnswer {
|
|
740
|
+
option?: number
|
|
741
|
+
apply?: true
|
|
742
|
+
/** the one field it applies; none only on a change of one field */
|
|
743
|
+
field?: string
|
|
744
|
+
/** the value he applied, the owner's edit or the agent's as it is; `text` keeps the owner's words, else the value; a
|
|
745
|
+
* text or a url question's answer */
|
|
746
|
+
value?: string
|
|
747
|
+
/** a checklist's line (`option`) ticked or unticked; a confirm's « done » */
|
|
748
|
+
tick?: boolean
|
|
749
|
+
/** on a tick of a choice step of an ask's instructions: the option he clicked */
|
|
750
|
+
pick?: number
|
|
751
|
+
/** a url answer: the status it opened with, 0 when it did not open */
|
|
752
|
+
opens?: number
|
|
753
|
+
/** a secret answer: the name its value went under; the value is never in the store */
|
|
754
|
+
stored?: string
|
|
755
|
+
/** a file answer: the item's view that holds the file */
|
|
756
|
+
view?: number
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/** the fields of a proposed change as a list, one for the flat form */
|
|
760
|
+
export const proposeFields = (p: MessagePropose): ProposeField[] =>
|
|
761
|
+
p.fields ?? [{ key: '', after: p.after, ...(p.before !== undefined ? { before: p.before } : {}), ...(p.type ? { type: p.type } : {}), ...(p.lang ? { lang: p.lang } : {}), ...(p.view !== undefined ? { view: p.view } : {}) }]
|
|
762
|
+
|
|
763
|
+
/** each field of the proposal `m` he applied, by its key: the value he applied and when. An apply that names no field
|
|
764
|
+
* is a change of one field, or an older one that applied every field as proposed */
|
|
765
|
+
export function appliedFields(thread: readonly Message[], m: Message): Map<string, { text: string; at: string }> {
|
|
766
|
+
const out = new Map<string, { text: string; at: string }>()
|
|
767
|
+
if (!m.propose) return out
|
|
768
|
+
const fields = proposeFields(m.propose)
|
|
769
|
+
for (const y of thread) {
|
|
770
|
+
if (y.re !== m.id || y.answer?.apply !== true || partyOf(y.who) !== 'owner') continue
|
|
771
|
+
const named = y.answer.field
|
|
772
|
+
for (const f of fields) {
|
|
773
|
+
if (out.has(f.key) || (named !== undefined && named !== f.key)) continue
|
|
774
|
+
out.set(f.key, { text: y.answer.value ?? (named !== undefined || fields.length === 1 ? (y.text ?? f.after) : f.after), at: y.at })
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return out
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/** a proposal waits on him until each of its fields is applied, or a message of the owner's with words names it */
|
|
781
|
+
export function proposeOpen(thread: readonly Message[], m: Message): boolean {
|
|
782
|
+
if (!m.propose) return false
|
|
783
|
+
if (thread.some((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner')) return false
|
|
784
|
+
return appliedFields(thread, m).size < proposeFields(m.propose).length
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** how a field draws when nothing names it: the first house kind that takes its values, words otherwise */
|
|
788
|
+
export const diffTypeOf = sniffKind
|
|
789
|
+
|
|
790
|
+
/** an object as one side of a change: its json and its files (repo relative), and the git ref it was read at */
|
|
791
|
+
export interface StoredState {
|
|
792
|
+
json: unknown
|
|
793
|
+
files?: Record<string, string>
|
|
794
|
+
at?: string
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/** 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` */
|
|
798
|
+
export interface MessageAction {
|
|
799
|
+
name: string
|
|
427
800
|
}
|
|
428
801
|
|
|
429
802
|
/** what the store reads of one folder, what the list sends */
|
|
@@ -438,10 +811,14 @@ export type Party = 'agent' | 'owner'
|
|
|
438
811
|
export const partyOf = (who: string): Party => (who === 'owner' || who === 'player' ? 'owner' : 'agent')
|
|
439
812
|
|
|
440
813
|
/** a message one party says to the other: a reply, a verdict, a rating, a question and its answer; never another op */
|
|
441
|
-
const isTalk = (m: Message): boolean => m.op === undefined || ((m.op === 'ask' || m.op === 'answer') && m.text !== undefined)
|
|
814
|
+
const isTalk = (m: Message): boolean => m.laneAsk === undefined && (m.op === undefined || ((m.op === 'ask' || m.op === 'answer') && m.text !== undefined))
|
|
815
|
+
|
|
816
|
+
/** the owner's verdict on the version itself; one that names `re` judges that message (review/verdict-items.ts) */
|
|
817
|
+
export const isVersionVerdict = (m: Pick<Message, 'verdict' | 're'>): boolean => m.verdict !== undefined && m.re === undefined
|
|
442
818
|
|
|
443
|
-
/** a reply: talk with words that is no verdict and no rating (a message moving a pin alone is no reply)
|
|
444
|
-
|
|
819
|
+
/** a reply: talk with words that is no verdict on the version and no rating (a message moving a pin alone is no reply);
|
|
820
|
+
* the owner's verdict on a message is the answer the agent reads, words or none */
|
|
821
|
+
export const isReply = (m: Message): boolean => isTalk(m) && !isVersionVerdict(m) && m.rate === undefined && (m.text !== undefined || m.verdict !== undefined)
|
|
445
822
|
|
|
446
823
|
export const MESSAGE_RE = /^\d{8}-\d{6}-\d{3}-(agent|owner|player)(-[a-z0-9]+)*$/
|
|
447
824
|
export const MESSAGE_FILE_RE = /^\d{8}-\d{6}-\d{3}-(agent|owner|player)(-[a-z0-9]+)*\.(png|jpe?g|webp)$/
|
|
@@ -453,10 +830,14 @@ export const AGENT_RE = /^[A-Za-z][A-Za-z0-9-]{0,23}$/
|
|
|
453
830
|
const two = (n: number): string => String(n).padStart(2, '0')
|
|
454
831
|
const stampOf = (at: Date): string => `${at.getFullYear()}${two(at.getMonth() + 1)}${two(at.getDate())}-${two(at.getHours())}${two(at.getMinutes())}${two(at.getSeconds())}`
|
|
455
832
|
|
|
456
|
-
/**
|
|
833
|
+
/** the part of a message id this process gives: two machines, or two processes, never make one id in one millisecond */
|
|
834
|
+
const PROCESS_PART = Array.from({ length: 4 }, () => 'abcdefghijklmnopqrstuvwxyz0123456789'[Math.floor(Math.random() * 36)]).join('')
|
|
835
|
+
|
|
836
|
+
/** `YYYYMMDD-HHMMSS-mmm-<owner|player|agent>-<process part>`, local time: the names sort in time. An id of before,
|
|
837
|
+
* with no process part, still reads */
|
|
457
838
|
export function messageIdOf(at: Date, who: string): string {
|
|
458
839
|
const role = who === 'owner' || who === 'player' ? who : 'agent'
|
|
459
|
-
return `${stampOf(at)}-${String(at.getMilliseconds()).padStart(3, '0')}-${role}`
|
|
840
|
+
return `${stampOf(at)}-${String(at.getMilliseconds()).padStart(3, '0')}-${role}-${PROCESS_PART}`
|
|
460
841
|
}
|
|
461
842
|
|
|
462
843
|
/** a message's text as sent, trimmed; an error is the reason it is refused */
|
|
@@ -474,9 +855,12 @@ const readBy = (x: ReviewItem, party: Party): Set<string> =>
|
|
|
474
855
|
const isTakeBack = (x: ReviewItem, m: Message): boolean => m.op === 'reopen' && m.who === 'owner' && x.item.origin.by === 'agent'
|
|
475
856
|
|
|
476
857
|
/** the talk of the other party that `party` has not read: replies, verdicts, ratings, his verdicts taken back */
|
|
858
|
+
/** 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
|
+
const isOwnerClose = (m: Message): boolean => partyOf(m.who) === 'owner' && (m.op === 'fixed' || m.op === 'done' || m.op === 'wontfix' || m.op === 'reopen')
|
|
860
|
+
|
|
477
861
|
const unreadTalk = (x: ReviewItem, party: Party): Message[] => {
|
|
478
862
|
const read = readBy(x, party)
|
|
479
|
-
return x.thread.filter((m) => (isTalk(m) || isTakeBack(x, m)) && partyOf(m.who) !== party && !read.has(m.id))
|
|
863
|
+
return x.thread.filter((m) => (isTalk(m) || isTakeBack(x, m) || isOwnerClose(m)) && partyOf(m.who) !== party && !read.has(m.id))
|
|
480
864
|
}
|
|
481
865
|
|
|
482
866
|
/** each verdict the owner took back that no agent marked seen: his reopen and the verdict it took back */
|
|
@@ -485,7 +869,7 @@ export function takenBackOf(x: ReviewItem): { m: Message; took: ReviewStatus; gi
|
|
|
485
869
|
const out: { m: Message; took: ReviewStatus; given: string }[] = []
|
|
486
870
|
let v: Message | undefined
|
|
487
871
|
for (const n of x.thread) {
|
|
488
|
-
if (n
|
|
872
|
+
if (isVersionVerdict(n)) v = n
|
|
489
873
|
else if (n.op === 'reopen' || isFixedUpdate(n)) {
|
|
490
874
|
if (v?.verdict && isTakeBack(x, n) && unread.has(n.id)) out.push({ m: n, took: v.verdict, given: v.at })
|
|
491
875
|
v = undefined
|
|
@@ -533,7 +917,7 @@ export function verdictOf(x: ReviewItem): Verdict | null {
|
|
|
533
917
|
let rects: Rect[] | undefined
|
|
534
918
|
for (const n of x.thread) {
|
|
535
919
|
if (n.op === 'reopen' || isFixedUpdate(n)) [m, text, rects] = [undefined, undefined, undefined]
|
|
536
|
-
else if (n
|
|
920
|
+
else if (isVersionVerdict(n)) {
|
|
537
921
|
if (m?.verdict !== n.verdict) [text, rects] = [undefined, undefined]
|
|
538
922
|
m = n
|
|
539
923
|
if (n.text !== undefined) text = n.text
|
|
@@ -566,7 +950,7 @@ export const STATUS_LABEL: Record<ShownStatus, string> = {
|
|
|
566
950
|
approved: 'approved',
|
|
567
951
|
'approved-with-fix': 'ok with a fix',
|
|
568
952
|
rejected: 'rejected',
|
|
569
|
-
archived: '
|
|
953
|
+
archived: 'not doing it',
|
|
570
954
|
superseded: 'replaced',
|
|
571
955
|
withdrawn: 'withdrawn',
|
|
572
956
|
raised: 'open',
|
|
@@ -575,7 +959,7 @@ export const STATUS_LABEL: Record<ShownStatus, string> = {
|
|
|
575
959
|
rated: 'rated',
|
|
576
960
|
}
|
|
577
961
|
|
|
578
|
-
/** the lifecycle (wiki tools/shipkit/
|
|
962
|
+
/** the lifecycle (wiki tools/shipkit/threads.md, The lifecycle) */
|
|
579
963
|
export type State = 'draft' | 'new' | 'question' | 'open' | 'claimed' | 'blocked' | 'asks' | 'closed'
|
|
580
964
|
type ClosedWhy = ReviewStatus | 'fixed' | 'wontfix' | 'dropped' | 'superseded' | 'withdrawn' | 'rated'
|
|
581
965
|
|
|
@@ -594,13 +978,16 @@ export type Move = 'owner' | 'agents' | 'none'
|
|
|
594
978
|
export const moveOf = (s: State): Move =>
|
|
595
979
|
s === 'asks' || s === 'question' || s === 'blocked' ? 'owner' : s === 'new' || s === 'open' || s === 'claimed' ? 'agents' : 'none'
|
|
596
980
|
|
|
597
|
-
export const MOVE_LABEL: Record<Move, string> = { owner: 'mine', agents:
|
|
981
|
+
export const MOVE_LABEL: Record<Move, string> = { owner: 'mine', agents: "an agent's", none: 'done' }
|
|
982
|
+
|
|
983
|
+
/** a thread an agent opened with words (a question, a proposed change, a line): nothing to judge, so no verdict waits */
|
|
984
|
+
export const isOpening = (i: Item): boolean => i.origin.by === 'agent' && i.on !== undefined && i.views.every((v) => !isGallery(v) && v.message === true) && i.draft === undefined && i.states === undefined
|
|
598
985
|
|
|
599
986
|
/** where an item starts: an agent's card asks for the owner's verdict (a draft waits); what he raises from a tool that named
|
|
600
987
|
* its topic (the trailer view: `film`) is open, else it waits on a dispatcher; an auto rule's item is open */
|
|
601
988
|
const startOf = (i: Item): ItemState =>
|
|
602
989
|
i.origin.by === 'agent'
|
|
603
|
-
? { state: i.wip ? 'draft' : 'asks' }
|
|
990
|
+
? { state: i.wip || (isOpening(i) && i.asksVerdict !== true) ? 'draft' : 'asks' }
|
|
604
991
|
: i.topic || i.origin.by === 'auto'
|
|
605
992
|
? { state: 'open', ...(i.topic ? { topic: i.topic } : {}) }
|
|
606
993
|
: { state: 'new' }
|
|
@@ -615,7 +1002,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
615
1002
|
let given: ItemState = s
|
|
616
1003
|
for (const m of x.thread) {
|
|
617
1004
|
const keep = s.topic ? { topic: s.topic } : {}
|
|
618
|
-
if (m.verdict !== undefined) {
|
|
1005
|
+
if (m.verdict !== undefined && isVersionVerdict(m)) {
|
|
619
1006
|
const v = m.verdict
|
|
620
1007
|
// « fix » and « no » owe the lane work: reading the verdict is never doing it (done, wontfix or a new version closes it)
|
|
621
1008
|
if (v === 'approved' || v === 'archived') s = { ...keep, state: 'closed', why: v }
|
|
@@ -630,7 +1017,9 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
630
1017
|
// an agent's update on its card: still broken or better holds it in work, fixed asks the owner's verdict again
|
|
631
1018
|
if (m.update !== undefined && i.origin.by === 'agent' && partyOf(m.who) === 'agent') {
|
|
632
1019
|
if (m.update.state === 'fixed') {
|
|
633
|
-
|
|
1020
|
+
// a thread opened with words holds nothing to judge: fixed ends its work, never asks a verdict
|
|
1021
|
+
if (isOpening(i)) s = { ...keep, state: 'closed', why: 'fixed' }
|
|
1022
|
+
else if (s.state === 'draft' || s.state === 'claimed' || s.state === 'closed') s = { ...keep, state: 'asks' }
|
|
634
1023
|
given = s
|
|
635
1024
|
} else if (s.state === 'asks') s = { ...keep, state: 'draft' }
|
|
636
1025
|
continue
|
|
@@ -697,7 +1086,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
697
1086
|
export const inWork = (x: ReviewItem): boolean => stateOf(x, false).state === 'draft'
|
|
698
1087
|
|
|
699
1088
|
/** the states each op leaves from */
|
|
700
|
-
const FROM: Record<Exclude<Op, 'seen'>, readonly State[]> = {
|
|
1089
|
+
const FROM: Record<Exclude<Op, 'seen' | 'take' | 'working'>, readonly State[]> = {
|
|
701
1090
|
dispatch: ['new', 'blocked'],
|
|
702
1091
|
ask: ['new', 'blocked'],
|
|
703
1092
|
answer: ['question'],
|
|
@@ -718,18 +1107,21 @@ const WORKER_OPS = new Set<Op>(['release', 'blocked', 'fixed', 'done', 'wontfix'
|
|
|
718
1107
|
|
|
719
1108
|
/** null when `who` may do `op` on an item in state `s`, else why not. The dispatcher (null: nobody holds the role)
|
|
720
1109
|
* routes, a worker acts on its own claim, the owner answers and may act over a claim. `routed` false: the repo has no
|
|
721
|
-
* dispatcher, so a worker takes a new item as it is
|
|
722
|
-
|
|
723
|
-
|
|
1110
|
+
* dispatcher, so a worker takes a new item as it is; `holds`: the caller holds the item's thread or is the session of
|
|
1111
|
+
* the lane that does */
|
|
1112
|
+
export function allowed(s: ItemState, op: Op, who: string, dispatcher: string | null, routed = true, holds = false): string | null {
|
|
1113
|
+
if (op === 'seen' || op === 'take' || op === 'working') return op !== 'seen' && who === 'owner' ? `an agent ${op === 'take' ? 'takes a thread' : 'says it is on it'}, never the owner` : null
|
|
724
1114
|
if (op === 'answer' && who !== 'owner') return 'only the owner answers a question'
|
|
725
1115
|
if (DISPATCHER_OPS.has(op)) {
|
|
726
1116
|
if (!routed) return 'this repo routes nothing: its review unit declares no dispatcher'
|
|
727
|
-
if (dispatcher === null) return 'nobody holds the dispatcher role: sk
|
|
1117
|
+
if (dispatcher === null) return 'nobody holds the dispatcher role: sk thread dispatcher --as <name>'
|
|
728
1118
|
if (who !== dispatcher) return `only the dispatcher (${dispatcher}) may ${op}`
|
|
729
1119
|
}
|
|
730
1120
|
if (!routed && s.state === 'new' && (op === 'claim' || op === 'fixed' || op === 'wontfix')) return op === 'claim' && who === 'owner' ? 'a worker claims, never the owner' : null
|
|
731
1121
|
if (op === 'claim' && (who === 'owner' || who === dispatcher)) return `a worker claims, never ${who === 'owner' ? 'the owner' : 'the dispatcher'}`
|
|
732
|
-
|
|
1122
|
+
// `holds`: the caller holds the thread or is its holder's session (review/parties.ts maySee), so a lane's claim never
|
|
1123
|
+
// locks its session out of its own thread
|
|
1124
|
+
if (WORKER_OPS.has(op) && who !== 'owner' && !holds && s.worker !== undefined && s.worker !== who) return `claimed by ${s.worker}, not by ${who}`
|
|
733
1125
|
if (op === 'claim' && s.state === 'claimed' && s.since !== undefined && s.worker !== who) return `already claimed by ${s.worker}: release it first (--as ${s.worker})`
|
|
734
1126
|
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`
|
|
735
1127
|
if (op === 'claim' && s.state === 'closed' && s.why !== 'rejected' && s.why !== 'approved-with-fix')
|
|
@@ -770,65 +1162,25 @@ export interface WatchFilter {
|
|
|
770
1162
|
lane: string | null
|
|
771
1163
|
}
|
|
772
1164
|
|
|
773
|
-
/** a live `sk
|
|
1165
|
+
/** a live `sk thread watch`: its process, its filter, when it started */
|
|
774
1166
|
export interface Watcher extends WatchFilter {
|
|
775
1167
|
pid: number
|
|
776
1168
|
started: string
|
|
1169
|
+
/** the session that runs it (CLAUDE_CODE_SESSION_ID), whatever it filters on */
|
|
1170
|
+
by?: string
|
|
1171
|
+
/** its heartbeat, rewritten every few seconds while it reads */
|
|
1172
|
+
beat?: string
|
|
777
1173
|
}
|
|
778
1174
|
|
|
779
1175
|
/** a watch with this filter reads his answers on `x` */
|
|
780
1176
|
export const coversCard = (f: WatchFilter, x: ReviewItem): boolean =>
|
|
781
1177
|
(f.session === null || (x.item.origin.by === 'agent' && x.item.origin.session === f.session)) && (f.lane === null || laneOf(x) === f.lane)
|
|
782
1178
|
|
|
783
|
-
/** who answers an agent's card, its reply or its seen: the worker of a live claim on it, else the lane that made it,
|
|
784
|
-
* else (a card with no lane) the session that sent it. null when `me` is that one, else why not and the way out.
|
|
785
|
-
* Another session hearing the verdict (a bare watch) is refused, so it never answers over the maker; a plain approval,
|
|
786
|
-
* which owes nothing, anyone marks seen. So does anyone once the maker stopped listening: `heardBy` is the live
|
|
787
|
-
* watches of the store, and when none of a lane or of a session covers the card (the lane ended), whoever reads the
|
|
788
|
-
* answer marks it seen; a reply stays the maker's. An item he raised, a player's or an auto one: the claim rules decide */
|
|
789
|
-
export function notAnswererOf(x: ReviewItem, me: { lane: string | null; session: string | null }, op: 'reply' | 'seen', heardBy?: readonly WatchFilter[]): string | null {
|
|
790
|
-
const o = x.item.origin
|
|
791
|
-
if (o.by !== 'agent') return null
|
|
792
|
-
const s = stateOf(x, false)
|
|
793
|
-
if (op === 'seen' && s.state === 'closed' && s.why === 'approved') return null
|
|
794
|
-
// a bare watch hears every card and is nobody's own: only a watch of a lane or of a session says the maker listens
|
|
795
|
-
if (op === 'seen' && heardBy !== undefined && !heardBy.some((w) => (w.lane !== null || w.session !== null) && coversCard(w, x))) return null
|
|
796
|
-
const id = x.item.id
|
|
797
|
-
// the way out names claim only where claim takes it
|
|
798
|
-
const noClaim = allowed(s, 'claim', me.lane ?? 'agent', null, false)
|
|
799
|
-
const takeOver =
|
|
800
|
-
noClaim === null
|
|
801
|
-
? `another lane takes it over with sk review claim ${id} --as <lane>`
|
|
802
|
-
: s.state === 'asks' || s.state === 'draft'
|
|
803
|
-
? 'no other lane takes it over before the verdict'
|
|
804
|
-
: `no takeover: ${noClaim}`
|
|
805
|
-
const claimed = s.state === 'claimed' && s.since !== undefined ? s.worker : undefined
|
|
806
|
-
const lane = claimed ?? o.lane
|
|
807
|
-
if (lane) return me.lane === lane ? null : `${id} is answered by lane ${lane} (${claimed ? 'its claim' : 'it made the card'}): as that lane, SK_AGENT=${lane} or --as ${lane}; ${takeOver}`
|
|
808
|
-
if (!o.session || me.session === o.session) return null
|
|
809
|
-
return `${id} is answered by the session that sent it (${o.session.slice(0, 8)}): ${takeOver}`
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/** the live watchers that will read his answer on any of these cards */
|
|
813
|
-
export const listenersOf = (cards: readonly ReviewItem[], watchers: readonly Watcher[]): Watcher[] => watchers.filter((w) => cards.some((x) => coversCard(w, x)))
|
|
814
|
-
|
|
815
|
-
/** who listens, in plain words: one lane's watch by its lane, any other by « an agent », several by their count */
|
|
816
|
-
export function listenWords(ws: readonly Watcher[]): string {
|
|
817
|
-
if (ws.length === 0) return 'nobody listens'
|
|
818
|
-
// a filtered watch is the card's own (its session or its lane); a bare one hears every card, for the dispatcher
|
|
819
|
-
const own = ws.filter((w) => w.lane !== null || w.session !== null)
|
|
820
|
-
const bare = ws.length - own.length
|
|
821
|
-
if (own.length === 0) return 'only a watch of every card hears it'
|
|
822
|
-
const lane = own.find((w) => w.lane !== null)?.lane
|
|
823
|
-
const head = lane ? `the ${lane} lane is listening` : 'its agent is listening'
|
|
824
|
-
return bare === 0 ? head : `${head} · ${bare} more ${bare === 1 ? 'watches' : 'watch'} every card`
|
|
825
|
-
}
|
|
826
|
-
|
|
827
1179
|
/** why a bare watch may not start: another one lives in the repo, so a verdict would reach two sessions. null when
|
|
828
1180
|
* none does. A repo keeps one, the dispatcher's; every other session watches its own cards or its lane's */
|
|
829
1181
|
export function bareWatchTaken(live: readonly Watcher[], self: number): string | null {
|
|
830
1182
|
const other = live.find((w) => w.pid !== self && w.lane === null && w.session === null)
|
|
831
|
-
return other ? `a watch of every card already runs (pid ${other.pid}): a repo keeps one, the dispatcher's. Yours: sk
|
|
1183
|
+
return other ? `a watch of every card already runs (pid ${other.pid}): a repo keeps one, the dispatcher's. Yours: sk thread watch --mine, or --lane <id>` : null
|
|
832
1184
|
}
|
|
833
1185
|
|
|
834
1186
|
/** what `review add` says when no live watch of the card's own session or lane will read his answer, else null: an
|
|
@@ -837,9 +1189,9 @@ export function unheardLine(item: Item, watchers: readonly Watcher[]): string |
|
|
|
837
1189
|
const o = item.origin
|
|
838
1190
|
if (o.by !== 'agent') return null
|
|
839
1191
|
const own = o.session || o.lane ? watchers.filter((w) => (o.session && w.session === o.session) || (o.lane && w.lane === o.lane)) : watchers
|
|
840
|
-
if (
|
|
841
|
-
const watch = o.session ? 'sk
|
|
842
|
-
return `no watch hears this
|
|
1192
|
+
if (own.some((w) => coversCard(w, { item, thread: [] }))) return null
|
|
1193
|
+
const watch = o.session ? 'sk thread watch --mine' : o.lane ? `sk thread watch --lane ${o.lane}` : 'sk thread watch'
|
|
1194
|
+
return `no watch hears this thread: run \`${watch}\` under a monitor now, so his answer reaches you as it lands`
|
|
843
1195
|
}
|
|
844
1196
|
|
|
845
1197
|
/** a card's own session has this long after its last message to claim it before a watch calls it untaken */
|
|
@@ -847,8 +1199,9 @@ export const UNTAKEN_GRACE_MS = 2 * 60 * 1000
|
|
|
847
1199
|
/** a card nobody takes is told again this often */
|
|
848
1200
|
export const UNTAKEN_AGAIN_MS = STALE_CLAIM_MS
|
|
849
1201
|
|
|
850
|
-
/** why an item waits on the agents and nobody holds it, else null; `superseded`: a later card follows it
|
|
851
|
-
|
|
1202
|
+
/** why an item waits on the agents and nobody holds it, else null; `superseded`: a later card follows it; `heard`: a
|
|
1203
|
+
* live watch hears its thread's holder (threads.ts listenersOf) */
|
|
1204
|
+
export function untakenOf(x: ReviewItem, superseded: boolean, heard: boolean, now: Date, routed = true): string | null {
|
|
852
1205
|
if (superseded) return null
|
|
853
1206
|
const quiet = now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)
|
|
854
1207
|
if (quiet < UNTAKEN_GRACE_MS) return null
|
|
@@ -859,10 +1212,12 @@ export function untakenOf(x: ReviewItem, superseded: boolean, watchers: readonly
|
|
|
859
1212
|
if (s.since !== undefined) return quiet > STALE_CLAIM_MS ? `${s.worker ?? 'its'} claim went stale` : null
|
|
860
1213
|
// an agent read the verdict: the work it owes is taken, only not done yet
|
|
861
1214
|
if (verdictOf(x)?.seen) return null
|
|
862
|
-
return
|
|
1215
|
+
return !heard ? `the owner's verdict went back to ${s.worker ?? 'its author'}, and no watch reads it` : null
|
|
863
1216
|
}
|
|
864
1217
|
|
|
865
1218
|
export const ID_RE = /^\d{8}-\d{6}-[a-z0-9-]+$/
|
|
1219
|
+
|
|
1220
|
+
const addressList = (v: unknown): boolean => Array.isArray(v) && v.length > 0 && v.every((a) => typeof a === 'string' && ADDRESS_RE.test(a))
|
|
866
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))$/
|
|
867
1222
|
/** a message's image as an item's media names it: `thread/<file>` */
|
|
868
1223
|
export const isThreadMedia = (n: string): boolean => n.startsWith('thread/') && MESSAGE_FILE_RE.test(n.slice('thread/'.length))
|
|
@@ -925,10 +1280,11 @@ function subjectProblems(s: unknown, spec: Spec): string[] {
|
|
|
925
1280
|
if (!obj(s) || typeof s.kind !== 'string' || s.kind === '') return ['subject: { kind }']
|
|
926
1281
|
const kind = spec.kinds[s.kind]
|
|
927
1282
|
const declared = Object.keys(spec.kinds)
|
|
928
|
-
if (!kind && !BUILTIN_KINDS[s.kind] && declared.length > 0) return [`subject: kind « ${s.kind} » is none of ${[...declared, ...Object.keys(BUILTIN_KINDS)].join(', ')}`]
|
|
1283
|
+
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(', ')}`]
|
|
929
1284
|
if (kind?.problems) return kind.problems(s as Subject).map((p) => `subject: ${p}`)
|
|
930
1285
|
if (s.kind === 'store' && !kind) return isStoreSubject(s as Subject) && s.store !== '' && s.asset !== '' ? [] : ['subject: a store thing has its store and asset']
|
|
931
1286
|
if (s.kind === 'post' && !kind) return isPostSubject(s as Subject) ? [] : ['subject: a post request names its card']
|
|
1287
|
+
if (s.kind === 'object') return typeof s.address === 'string' && ADDRESS_RE.test(s.address) ? [] : ['subject: an object names its address <kind>:<key>']
|
|
932
1288
|
if (s.kind !== 'frame') return []
|
|
933
1289
|
const str = (k: string): boolean => typeof s[k] === 'string' && s[k] !== ''
|
|
934
1290
|
const num = (k: string): boolean => typeof s[k] === 'number' && Number.isFinite(s[k])
|
|
@@ -956,11 +1312,23 @@ function originProblems(o: unknown): string[] {
|
|
|
956
1312
|
return ['origin.by: agent, owner, player or auto']
|
|
957
1313
|
}
|
|
958
1314
|
|
|
1315
|
+
function draftCardProblems(d: unknown): string[] {
|
|
1316
|
+
const text = (v: unknown): boolean => typeof v === 'string' && v !== ''
|
|
1317
|
+
if (!obj(d) || !text(d.slug) || !text(d.hash) || !Array.isArray(d.posts)) return ['draft: { slug, hash, posts: [{ key, name, hash }] }']
|
|
1318
|
+
const out: string[] = []
|
|
1319
|
+
d.posts.forEach((p: unknown, k: number) => {
|
|
1320
|
+
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 }`)
|
|
1321
|
+
})
|
|
1322
|
+
if (d.posts.length === 0) out.push('draft.posts: one message or more')
|
|
1323
|
+
return out
|
|
1324
|
+
}
|
|
1325
|
+
|
|
959
1326
|
function trailerCardProblems(t: unknown): string[] {
|
|
960
1327
|
const side = (v: unknown): boolean => obj(v) && typeof v.cut === 'string' && v.cut !== '' && typeof v.render === 'number' && Number.isFinite(v.render)
|
|
961
1328
|
if (!obj(t) || typeof t.trailer !== 'string' || t.trailer === '' || !side(t.after)) return ['trailer: { trailer, after: { cut, render }, before?, shots }']
|
|
962
1329
|
const out: string[] = []
|
|
963
1330
|
if (t.before !== undefined && !side(t.before)) out.push('trailer.before: { cut, render }, or absent')
|
|
1331
|
+
if (t.cut !== undefined && !(typeof t.cut === 'string' && t.cut !== '')) out.push('trailer.cut: the cut it is a version of, or absent')
|
|
964
1332
|
if (!Array.isArray(t.shots) || !t.shots.every((s) => typeof s === 'string' && s !== '')) out.push('trailer.shots: a list of shot names')
|
|
965
1333
|
if (t.size !== undefined && !(Array.isArray(t.size) && t.size.length === 2 && t.size.every((n) => Number.isInteger(n) && (n as number) > 0))) out.push('trailer.size: [width, height] in pixels, or absent')
|
|
966
1334
|
return out
|
|
@@ -975,13 +1343,19 @@ export function itemProblems(v: unknown): string[] {
|
|
|
975
1343
|
out.push(...subjectProblems(v.subject, NO_SPEC), ...originProblems(v.origin))
|
|
976
1344
|
if (v.topic !== undefined && typeof v.topic !== 'string') out.push('topic: a text')
|
|
977
1345
|
const agent = obj(v.origin) && v.origin.by === 'agent'
|
|
978
|
-
|
|
1346
|
+
// a draft card holds no picture: its body is the draft, read live; a thread opened with words names its address
|
|
1347
|
+
const needsView = agent && v.draft === undefined && v.on === undefined && v.states === undefined
|
|
1348
|
+
if (!Array.isArray(v.views) || (needsView && v.views.length === 0)) out.push(`views: a list${needsView ? ' of one view or more' : ''}`)
|
|
979
1349
|
else
|
|
980
1350
|
v.views.forEach((w: unknown, i: number) => {
|
|
981
1351
|
if (i > 0 && (!obj(w) || typeof w.label !== 'string' || w.label.trim() === '')) out.push(`views[${i}].label: a text`)
|
|
982
1352
|
if (obj(w) && w.gallery !== undefined) out.push(...galleryProblems(w, `views[${i}].`))
|
|
983
1353
|
else out.push(...viewProblems(obj(w) ? w : {}, `views[${i}].`))
|
|
984
1354
|
})
|
|
1355
|
+
if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
|
|
1356
|
+
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
|
+
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)')
|
|
1358
|
+
if (v.on !== undefined && !(typeof v.on === 'string' && ADDRESS_RE.test(v.on))) out.push('on: an address <kind>:<key>')
|
|
985
1359
|
if (v.answers !== undefined && !(Array.isArray(v.answers) && v.answers.length > 0 && v.answers.every((a) => typeof a === 'string' && ID_RE.test(a))))
|
|
986
1360
|
out.push('answers: a list of item ids')
|
|
987
1361
|
for (const k of ['what', 'post', 'commit', 'supersedes', 'why', 'keeps']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
|
|
@@ -990,9 +1364,14 @@ export function itemProblems(v: unknown): string[] {
|
|
|
990
1364
|
if (v.light !== undefined && v.light !== 'review') out.push('light: review, or absent')
|
|
991
1365
|
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')
|
|
992
1366
|
if (v.trailer !== undefined) out.push(...trailerCardProblems(v.trailer))
|
|
1367
|
+
if (v.draft !== undefined) out.push(...draftCardProblems(v.draft))
|
|
993
1368
|
if (v.choice !== undefined && !(v.choice === true && Array.isArray(v.views) && v.views.length >= 2)) out.push('choice: true on a card of two views or more, or absent')
|
|
994
1369
|
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))
|
|
995
1370
|
out.push('agentPick: the index of one of its views, on a choice card, or absent')
|
|
1371
|
+
if (v.ask !== undefined) {
|
|
1372
|
+
out.push(...askHeadProblems(v.ask))
|
|
1373
|
+
if (!(typeof v.on === 'string' && v.on.startsWith('ask:'))) out.push('ask: on the head of a thread ask:<id>')
|
|
1374
|
+
}
|
|
996
1375
|
if (v.media !== undefined) {
|
|
997
1376
|
if (!obj(v.media)) out.push('media: { <file name>: { sha, size, type } }, or absent')
|
|
998
1377
|
else
|
|
@@ -1022,7 +1401,72 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1022
1401
|
if (typeof v.text !== 'string') out.push('update: its line in text')
|
|
1023
1402
|
}
|
|
1024
1403
|
if (v.re !== undefined && !(typeof v.re === 'string' && MESSAGE_RE.test(v.re))) out.push('re: the id of a message of the thread')
|
|
1025
|
-
if (v.
|
|
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")
|
|
1406
|
+
if (v.session !== undefined && typeof v.session !== 'string') out.push('session: a text')
|
|
1407
|
+
if (v.about !== undefined && !addressList(v.about)) out.push('about: a list of addresses <kind>:<key>')
|
|
1408
|
+
if (v.ask !== undefined) {
|
|
1409
|
+
const a = v.ask
|
|
1410
|
+
const index = (x: unknown): boolean => Number.isInteger(x) && (x as number) >= 0
|
|
1411
|
+
const kind = obj(a) ? (a.kind ?? 'choice') : null
|
|
1412
|
+
const texts = obj(a) && Array.isArray(a.options) && a.options.every((o) => typeof o === 'string' && o.trim() !== '')
|
|
1413
|
+
if (!obj(a) || !ANSWER_KINDS.includes(kind as AnswerKind)) out.push(`ask: kind, one of ${ANSWER_KINDS.join(', ')}`)
|
|
1414
|
+
else if (kind === 'choice') {
|
|
1415
|
+
if (!texts || (a.options as unknown[]).length < 2 || (a.pick !== undefined && !(index(a.pick) && (a.pick as number) < (a.options as unknown[]).length)))
|
|
1416
|
+
out.push('ask: { options: two texts or more, pick?: an option index }')
|
|
1417
|
+
else if (a.views !== undefined && !(Array.isArray(a.views) && a.views.length === (a.options as unknown[]).length && a.views.every((x) => x === null || index(x)))) out.push('ask: views, one view index or null an option')
|
|
1418
|
+
} else if (kind === 'checklist') {
|
|
1419
|
+
if (!texts || (a.options as unknown[]).length < 1 || (a.done !== undefined && !(Array.isArray(a.done) && a.done.every((x) => index(x) && (x as number) < (a.options as unknown[]).length))))
|
|
1420
|
+
out.push('ask: a checklist, { options: its lines, one or more, done?: line indexes }')
|
|
1421
|
+
else if (a.choices !== undefined && !(Array.isArray(a.choices) && a.choices.length === (a.options as unknown[]).length && v.instructions !== undefined && a.choices.every((c) => c === null || (obj(c) && Array.isArray(c.options) && c.options.length >= 2 && c.options.every((o) => typeof o === 'string' && o.trim() !== '') && (c.pick === undefined || (index(c.pick) && (c.pick as number) < c.options.length))))))
|
|
1422
|
+
out.push("ask: choices, an instructions' steps only, one { options: two texts or more, pick? } or null a step")
|
|
1423
|
+
} else if (!(Array.isArray(a.options) && a.options.length === 0)) out.push(`ask: a ${kind} question holds no options`)
|
|
1424
|
+
if (kind === 'secret' && !(obj(a) && obj(a.secret) && typeof a.secret.name === 'string' && SECRET_NAME.test(a.secret.name) && (a.secret.login === undefined || a.secret.login === true)))
|
|
1425
|
+
out.push('ask: a secret question names its secret, { secret: { name, login? } }')
|
|
1426
|
+
if (typeof v.text !== 'string') out.push('ask: its question in text')
|
|
1427
|
+
}
|
|
1428
|
+
if (v.propose !== undefined) {
|
|
1429
|
+
const p = v.propose
|
|
1430
|
+
const field = (f: unknown, flat: boolean): boolean =>
|
|
1431
|
+
obj(f) &&
|
|
1432
|
+
(flat || (typeof f.key === 'string' && f.key.trim() !== '')) &&
|
|
1433
|
+
typeof f.after === 'string' &&
|
|
1434
|
+
(f.before === undefined || typeof f.before === 'string') &&
|
|
1435
|
+
(f.type === undefined || DIFF_TYPES.includes(f.type as DiffType)) &&
|
|
1436
|
+
(f.lang === undefined || typeof f.lang === 'string') &&
|
|
1437
|
+
(f.view === undefined || (Number.isInteger(f.view) && (f.view as number) >= 0))
|
|
1438
|
+
const keys = obj(p) && Array.isArray(p.fields) ? p.fields.map((f) => (obj(f) ? f.key : null)) : []
|
|
1439
|
+
if (!obj(p) || typeof p.on !== 'string' || !ADDRESS_RE.test(p.on) || !field(p, true) || (p.page !== undefined && typeof p.page !== 'string')) out.push('propose: { on: an address, before?, after, type?, lang?, view?, page? }')
|
|
1440
|
+
else if (p.fields !== undefined && !(Array.isArray(p.fields) && p.fields.length >= 1 && (p.fields.length >= 2 || keys[0] !== '') && p.fields.every((f) => field(f, false)) && new Set(keys).size === keys.length))
|
|
1441
|
+
out.push('propose: fields, one named or two or more, each { key, before?, after, type?, lang?, view? }, each key once')
|
|
1442
|
+
if (typeof v.text !== 'string') out.push('propose: its words in text')
|
|
1443
|
+
}
|
|
1444
|
+
if (v.askState !== undefined && !(obj(v.askState) && ['open', 'done', 'declined'].includes(v.askState.state as string) && (v.askState.why === undefined || typeof v.askState.why === 'string'))) out.push("askState: { state: open, done or declined, why? }")
|
|
1445
|
+
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
|
+
if (v.urgent !== undefined && v.urgent !== true) out.push('urgent: true')
|
|
1447
|
+
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 }')
|
|
1448
|
+
if (v.answer !== undefined) {
|
|
1449
|
+
const a = v.answer
|
|
1450
|
+
const says = obj(a) && (a.option !== undefined || a.apply === true || typeof a.value === 'string' || typeof a.stored === 'string' || a.view !== undefined)
|
|
1451
|
+
if (!obj(a) || !says || (a.option !== undefined && !(Number.isInteger(a.option) && (a.option as number) >= 0)) || (a.apply !== undefined && a.apply !== true) || (a.field !== undefined && typeof a.field !== 'string') || (a.value !== undefined && typeof a.value !== 'string')
|
|
1452
|
+
|| (a.tick !== undefined && !(typeof a.tick === 'boolean' && a.option !== undefined)) || (a.pick !== undefined && !(Number.isInteger(a.pick) && (a.pick as number) >= 0 && a.tick === true)) || (a.opens !== undefined && !(Number.isInteger(a.opens) && (a.opens as number) >= 0)) || (a.stored !== undefined && !(typeof a.stored === 'string' && SECRET_NAME.test(a.stored))) || (a.view !== undefined && !(Number.isInteger(a.view) && (a.view as number) >= 0)))
|
|
1453
|
+
out.push('answer: { option, tick? }, { apply: true, field?, value? }, { value, opens? }, { stored } or { view }')
|
|
1454
|
+
if (typeof v.re !== 'string') out.push('answer: the question or proposal it answers in re')
|
|
1455
|
+
}
|
|
1456
|
+
if (v.replaces !== undefined && !(typeof v.replaces === 'string' && MESSAGE_RE.test(v.replaces))) out.push('replaces: the id of a message of the thread')
|
|
1457
|
+
if (v.hold !== undefined && !(obj(v.hold) && typeof v.hold.address === 'string' && typeof v.hold.held === 'boolean' && (v.hold.sha === undefined || typeof v.hold.sha === 'string') && (v.hold.ahead === undefined || typeof v.hold.ahead === 'number') && typeof v.text === 'string')) out.push('hold: { address, held, sha?, ahead? } and its words in text')
|
|
1458
|
+
if (v.laneAsk !== undefined && !(obj(v.laneAsk) && typeof v.laneAsk.for === 'string' && (v.laneAsk.session === undefined || typeof v.laneAsk.session === 'string') && v.who === 'owner')) out.push("laneAsk: { for, session? }, the owner's")
|
|
1459
|
+
if (v.unhold !== undefined && !(Array.isArray(v.unhold) && v.unhold.length > 0 && v.unhold.every((a) => typeof a === 'string'))) out.push('unhold: the addresses it releases')
|
|
1460
|
+
if (v.askBar !== undefined && !(Array.isArray(v.askBar) && v.askBar.length > 0 && v.askBar.every((f) => typeof f === 'string' && MESSAGE_RE.test(f)))) out.push('askBar: the ids of messages of the thread')
|
|
1461
|
+
if (v.instructions !== undefined) {
|
|
1462
|
+
const i = v.instructions
|
|
1463
|
+
if (!obj(i) || typeof i.title !== 'string' || i.title.trim() === '' || !(Array.isArray(i.folds) && i.folds.every((f) => typeof f === 'string' && MESSAGE_RE.test(f)))) out.push('instructions: { title, ask, folds: message ids }')
|
|
1464
|
+
else if (!obj(i.ask) || 'created' in i.ask || 'pinged' in i.ask) out.push("instructions.ask: the facts, never the head's day or ping")
|
|
1465
|
+
else out.push(...askHeadProblems({ ...i.ask, created: '2000-01-01' }).map((p) => `instructions.${p}`))
|
|
1466
|
+
if (typeof v.text !== 'string') out.push('instructions: its words in text')
|
|
1467
|
+
if (v.replaces !== undefined) out.push('instructions: superseded by order, never by replaces')
|
|
1468
|
+
}
|
|
1469
|
+
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)
|
|
1026
1470
|
out.push('a message says something: text, rects, verdict, rate or op')
|
|
1027
1471
|
return out
|
|
1028
1472
|
}
|
|
@@ -1047,6 +1491,7 @@ function viewProblems(v: Record<string, unknown>, at: string): string[] {
|
|
|
1047
1491
|
const out: string[] = []
|
|
1048
1492
|
if (typeof v.label !== 'string') out.push(`${at}label: a text`)
|
|
1049
1493
|
if (v.note !== undefined && typeof v.note !== 'string') out.push(`${at}note: a text`)
|
|
1494
|
+
if (v.message !== undefined && v.message !== true) out.push(`${at}message: true or absent`)
|
|
1050
1495
|
const f = v.files
|
|
1051
1496
|
const okImage = (n: unknown): boolean => typeof n === 'string' && FILE_RE.test(n) && !isClipFile(n) && !isAudioFile(n)
|
|
1052
1497
|
const okClip = (n: unknown): boolean => typeof n === 'string' && FILE_RE.test(n) && isClipFile(n)
|
|
@@ -1160,7 +1605,7 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1160
1605
|
if (clip && typeof t === 'number') rect.t = t
|
|
1161
1606
|
out.push(rect)
|
|
1162
1607
|
}
|
|
1163
|
-
const reactions = reactionsOf(body.reactions, views, errors, isChoice(item))
|
|
1608
|
+
const reactions = reactionsOf(body.reactions, views, errors, isChoice(item), isDraftCard(item))
|
|
1164
1609
|
const pick = body.pick
|
|
1165
1610
|
if (pick !== undefined) {
|
|
1166
1611
|
if (!isChoice(item)) errors.push('pick: only on a choice card')
|
|
@@ -1182,8 +1627,9 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1182
1627
|
}
|
|
1183
1628
|
|
|
1184
1629
|
/** the reactions the page sends, checked against the card's views: each on a view, a tile only on a gallery, one per view
|
|
1185
|
-
* or tile;
|
|
1186
|
-
|
|
1630
|
+
* or tile; on a draft card each on a message of the draft, by its key (one the draft gained since the card is taken
|
|
1631
|
+
* too: the card shows the draft live); an empty one is dropped */
|
|
1632
|
+
function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[], choice: boolean, draft: boolean): ReviewReaction[] {
|
|
1187
1633
|
if (v === undefined) return []
|
|
1188
1634
|
if (!Array.isArray(v)) {
|
|
1189
1635
|
errors.push('reactions: a list')
|
|
@@ -1193,6 +1639,11 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1193
1639
|
const seen = new Set<string>()
|
|
1194
1640
|
const rowsPicked = new Set<string>()
|
|
1195
1641
|
for (const [i, r] of v.entries()) {
|
|
1642
|
+
if (obj(r) && (draft || r.post !== undefined)) {
|
|
1643
|
+
const q = postReaction(r, i, draft, seen, errors)
|
|
1644
|
+
if (q) out.push(q)
|
|
1645
|
+
continue
|
|
1646
|
+
}
|
|
1196
1647
|
const on = obj(r) && typeof r.view === 'number' && Number.isInteger(r.view) ? views[r.view] : undefined
|
|
1197
1648
|
if (!obj(r) || !on) {
|
|
1198
1649
|
errors.push(`reactions[${i}].view: the index of one of the card's views`)
|
|
@@ -1233,12 +1684,34 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1233
1684
|
return out
|
|
1234
1685
|
}
|
|
1235
1686
|
|
|
1687
|
+
/** a reaction to one message of a draft card, checked: its key, OK, fix or no, his word; null with its errors pushed, or
|
|
1688
|
+
* when it says nothing */
|
|
1689
|
+
function postReaction(r: Record<string, unknown>, i: number, draft: boolean, seen: Set<string>, errors: string[]): ReviewReaction | null {
|
|
1690
|
+
const bad: string[] = []
|
|
1691
|
+
if (!draft) bad.push(`reactions[${i}].post: only on a draft card`)
|
|
1692
|
+
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
|
+
if (r.status !== undefined && !STATUSES.includes(r.status as ReviewStatus)) bad.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
1694
|
+
if (r.comment !== undefined && typeof r.comment !== 'string') bad.push(`reactions[${i}].comment: a text`)
|
|
1695
|
+
for (const k of ['tile', 'stars', 'picked']) if (r[k] !== undefined) bad.push(`reactions[${i}].${k}: none on a message of a draft`)
|
|
1696
|
+
const key = `post/${String(r.post)}`
|
|
1697
|
+
if (seen.has(key)) bad.push(`reactions[${i}]: a second reaction on the same message`)
|
|
1698
|
+
seen.add(key)
|
|
1699
|
+
errors.push(...bad)
|
|
1700
|
+
const comment = typeof r.comment === 'string' ? r.comment.trim() : ''
|
|
1701
|
+
if (bad.length > 0 || (r.status === undefined && comment === '')) return null
|
|
1702
|
+
return { view: 0, post: r.post as string, ...(r.status !== undefined ? { status: r.status as ReviewStatus } : {}), comment }
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/** a draft card's message as the page and the CLI name it: the name the card pinned, else its key (one the draft gained since) */
|
|
1706
|
+
export const postLabel = (draft: DraftCard | undefined, key: string): string => draft?.posts.find((p) => p.key === key)?.name ?? key
|
|
1707
|
+
|
|
1236
1708
|
/** what a reaction or a rectangle is on, as the CLI prints it: its view's letter and label, `[B from above]`,
|
|
1237
|
-
* `[C trees / oak-v2]`, `[A]` */
|
|
1238
|
-
export function placeText(r: { view?: number | undefined; tile?: number | undefined }, views: readonly ReviewView[]): string {
|
|
1709
|
+
* `[C trees / oak-v2]`, `[A]`; on a draft card the message's name, `[Reddit · comfyui]` */
|
|
1710
|
+
export function placeText(r: { view?: number | undefined; tile?: number | undefined; post?: string | undefined }, views: readonly ReviewView[], draft?: DraftCard): string {
|
|
1711
|
+
if (r.post !== undefined) return `[${postLabel(draft, r.post)}]`
|
|
1239
1712
|
const i = r.view ?? 0
|
|
1240
1713
|
const v = views[i]
|
|
1241
1714
|
const t = r.tile !== undefined && v && isGallery(v) ? v.gallery[r.tile] : undefined
|
|
1242
1715
|
const tile = r.tile !== undefined && v && isGallery(v) ? ` / ${(t && tileName(t)) || `image ${r.tile + 1}`}` : ''
|
|
1243
|
-
return `[${
|
|
1716
|
+
return `[${viewNo(i)}${v?.label ? ` ${v.label}` : ''}${tile}]`
|
|
1244
1717
|
}
|