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/threads.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
// the threads of the store (wiki tools/shipkit/
|
|
2
|
-
// items (a report, his note) the
|
|
3
|
-
//
|
|
1
|
+
// the threads of the store (wiki tools/shipkit/threads.md): a subject's versions, each superseding the last, the raised
|
|
2
|
+
// items (a report, his note) they answer, and his notes on an address the thread names, read as one thread per subject;
|
|
3
|
+
// their status, who acts now, who holds them, their conversation and order, and the thread an address already has.
|
|
4
|
+
// Pure, over the items of review/model.ts
|
|
4
5
|
import {
|
|
6
|
+
canonicalAddress,
|
|
7
|
+
coversCard,
|
|
8
|
+
type WatchFilter,
|
|
9
|
+
addressesOf,
|
|
10
|
+
ownAddressOf,
|
|
11
|
+
parentAddress,
|
|
5
12
|
inWork,
|
|
13
|
+
isOpening,
|
|
14
|
+
moveOf,
|
|
6
15
|
isReply,
|
|
7
16
|
partyOf,
|
|
17
|
+
proposeFields,
|
|
18
|
+
proposeOpen,
|
|
8
19
|
reworkOf,
|
|
9
20
|
stateOf,
|
|
10
21
|
subjectKey,
|
|
11
22
|
takenBackOf,
|
|
12
23
|
unreadBy,
|
|
24
|
+
updatesOf,
|
|
13
25
|
verdictOf,
|
|
14
26
|
withdrawnOf,
|
|
15
27
|
wordsOf,
|
|
@@ -19,7 +31,15 @@ import {
|
|
|
19
31
|
type Spec,
|
|
20
32
|
type Subject,
|
|
21
33
|
NO_SPEC,
|
|
34
|
+
isAskItem,
|
|
22
35
|
} from './model.ts'
|
|
36
|
+
import { addressKindProblem } from './kinds.ts'
|
|
37
|
+
import { heldOpen, holdMoveOf } from './holds.ts'
|
|
38
|
+
import { laneAskOf } from './lane-ask.ts'
|
|
39
|
+
import { askOpen } from './answer-kinds.ts'
|
|
40
|
+
import { currentInstructions, replacersOf } from './supersede.ts'
|
|
41
|
+
import { openVerdictAsks } from './verdict-items.ts'
|
|
42
|
+
import { hearingOf, heardBy, maySee, NO_PARTIES, sessionLabel, type Hearing, type Holder, type Me, type Parties } from './parties.ts'
|
|
23
43
|
|
|
24
44
|
/** one thread of versions: a head no later card supersedes, then the chain it supersedes back to the first, and the
|
|
25
45
|
* raised items any of them answers */
|
|
@@ -27,8 +47,11 @@ export interface Thread {
|
|
|
27
47
|
head: ReviewItem
|
|
28
48
|
/** the head first, then each older version; v1 is the last */
|
|
29
49
|
versions: ReviewItem[]
|
|
30
|
-
/** the reports and notes the versions answer, oldest first */
|
|
50
|
+
/** the reports and notes the versions answer, and his notes on an address it names, oldest first */
|
|
31
51
|
answers: ReviewItem[]
|
|
52
|
+
/** the ids of the notes among `answers` that joined by their address alone: no version answered them, so each
|
|
53
|
+
* keeps its own state (open, claimed, fixed) */
|
|
54
|
+
joined: ReadonlySet<string>
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
/** every item of a thread: its versions, then the raised items they answer */
|
|
@@ -101,17 +124,85 @@ export const followedIds = (items: readonly ReviewItem[]): Set<string> => {
|
|
|
101
124
|
return new Set([...l.superseders.keys(), ...l.answerers.keys()])
|
|
102
125
|
}
|
|
103
126
|
|
|
127
|
+
/** his note: an item he raised with words. A mark or an entry he checked says none, and is no note of a thread */
|
|
128
|
+
const isNote = (x: ReviewItem): boolean => x.item.origin.by === 'owner' && openingOf(x) !== undefined
|
|
129
|
+
|
|
130
|
+
/** the addresses a thread owns: its members' own, one thread each */
|
|
131
|
+
export const ownAddressesOf = (t: Thread, spec: Spec = NO_SPEC): string[] => [...new Set(membersOf(t).flatMap((x) => ownAddressOf(x.item, spec) ?? []))]
|
|
132
|
+
|
|
133
|
+
/** every address a thread names: the ones it owns, then each object it is about or a message attached (links) */
|
|
134
|
+
export const addressesOfThread = (t: Thread, spec: Spec = NO_SPEC): string[] =>
|
|
135
|
+
[...new Set([...ownAddressesOf(t, spec), ...membersOf(t).flatMap((x) => [...addressesOf(x.item, spec), ...x.thread.flatMap((m) => (m.about ?? []).map((a) => canonicalAddress(a) ?? a))])])]
|
|
136
|
+
|
|
137
|
+
const built = new WeakMap<readonly ReviewItem[], { spec: Spec; threads: Thread[] }>()
|
|
138
|
+
|
|
104
139
|
/** one thread per head: two cards superseding the same one are two threads sharing their history; a raised item a
|
|
105
|
-
* card answers is in that card's thread, never a head
|
|
106
|
-
|
|
140
|
+
* card answers is in that card's thread, never a head. A note of his reads in the thread that owns its address, else
|
|
141
|
+
* the one that owns the address above it (a place of a draft: the draft), in the order he wrote them; a note no
|
|
142
|
+
* thread owns an address of heads its own */
|
|
143
|
+
export function threadsOf(items: readonly ReviewItem[], spec: Spec = NO_SPEC): Thread[] {
|
|
144
|
+
const held = built.get(items)
|
|
145
|
+
if (held && held.spec === spec) return [...held.threads]
|
|
107
146
|
const byId = linksOf(items).byId
|
|
108
147
|
const followed = followedIds(items)
|
|
109
|
-
|
|
110
|
-
|
|
148
|
+
const heads = items.filter((x) => !followed.has(x.item.id))
|
|
149
|
+
const chains: Thread[] = heads
|
|
150
|
+
.filter((x) => !isNote(x))
|
|
111
151
|
.map((head) => {
|
|
112
152
|
const versions = chainOf(head, items)
|
|
113
|
-
return { head, versions, answers: answeredBy(versions, byId) }
|
|
153
|
+
return { head, versions, answers: answeredBy(versions, byId), joined: new Set<string>() }
|
|
114
154
|
})
|
|
155
|
+
const byAddress = new Map<string, Thread>()
|
|
156
|
+
const claim = (t: Thread): void => {
|
|
157
|
+
for (const a of ownAddressesOf(t, spec)) {
|
|
158
|
+
const was = byAddress.get(a)
|
|
159
|
+
if (!was || newest(t.head, was.head) < 0) byAddress.set(a, t)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const t of chains) if (t.head.item.origin.by === 'agent') claim(t)
|
|
163
|
+
const notes: Thread[] = []
|
|
164
|
+
for (const x of heads.filter(isNote).sort(oldest)) {
|
|
165
|
+
const into = upFrom(ownAddressOf(x.item, spec))
|
|
166
|
+
.map((a) => byAddress.get(a))
|
|
167
|
+
.find((t) => t !== undefined)
|
|
168
|
+
if (into) {
|
|
169
|
+
into.answers.push(x)
|
|
170
|
+
;(into.joined as Set<string>).add(x.item.id)
|
|
171
|
+
continue
|
|
172
|
+
}
|
|
173
|
+
const own: Thread = { head: x, versions: [x], answers: answeredBy([x], byId), joined: new Set<string>() }
|
|
174
|
+
notes.push(own)
|
|
175
|
+
claim(own)
|
|
176
|
+
}
|
|
177
|
+
for (const t of [...chains, ...notes]) if (t.joined.size > 0) t.answers.sort(oldest)
|
|
178
|
+
const threads = [...chains, ...notes]
|
|
179
|
+
built.set(items, { spec, threads })
|
|
180
|
+
return [...threads]
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** an address, then each one above it */
|
|
184
|
+
function upFrom(a: string | null): string[] {
|
|
185
|
+
const out: string[] = []
|
|
186
|
+
for (let at = a; at !== null; at = parentAddress(at)) out.push(at)
|
|
187
|
+
return out
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** the thread that owns this address, null when none does: the newest one, whatever its state. `up`: else the one
|
|
191
|
+
* that owns an address above it, where his note on a part of an object goes */
|
|
192
|
+
export function threadOfAddress(raw: string, items: readonly ReviewItem[], spec: Spec = NO_SPEC, o: { up?: boolean } = {}): Thread | null {
|
|
193
|
+
const address = canonicalAddress(raw) ?? raw
|
|
194
|
+
const threads = threadsOf(items, spec)
|
|
195
|
+
for (const a of o.up ? upFrom(address) : [address]) {
|
|
196
|
+
const t = threads.filter((x) => ownAddressesOf(x, spec).includes(a)).sort((x, y) => newest(x.head, y.head))[0]
|
|
197
|
+
if (t) return t
|
|
198
|
+
}
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** every thread that names this address or one under it, as its own or as a link: the threads of an object */
|
|
203
|
+
export function threadsNaming(raw: string, items: readonly ReviewItem[], spec: Spec = NO_SPEC): Thread[] {
|
|
204
|
+
const address = canonicalAddress(raw) ?? raw
|
|
205
|
+
return threadsOf(items, spec).filter((t) => addressesOfThread(t, spec).some((a) => a === address || a.startsWith(`${address}/`)))
|
|
115
206
|
}
|
|
116
207
|
|
|
117
208
|
/** the newest card answering this raised item, null when none does */
|
|
@@ -122,6 +213,19 @@ const supersederOf = (id: string, items: readonly ReviewItem[]): ReviewItem | nu
|
|
|
122
213
|
/** a later card follows the item: a new version of it, or a card answering it (stateOf's `superseded`) */
|
|
123
214
|
export const isFollowed = (id: string, items: readonly ReviewItem[]): boolean => supersederOf(id, items) !== null || answererOf(id, items) !== null
|
|
124
215
|
|
|
216
|
+
/** the title a thread shows: an ask's newest instructions, else its head's */
|
|
217
|
+
export const threadTitle = (t: Thread): string => currentInstructions(membersOf(t))?.instructions.title ?? t.head.item.title
|
|
218
|
+
|
|
219
|
+
/** the ask facts that stand on an ask's thread: its newest instructions', else its head's; null on another thread */
|
|
220
|
+
export const askFactsOf = (t: Thread): Omit<NonNullable<ReviewItem['item']['ask']>, 'created' | 'pinged'> | null =>
|
|
221
|
+
isAskItem(t.head.item) && t.head.item.ask !== undefined ? (currentInstructions(membersOf(t))?.instructions.ask ?? t.head.item.ask) : null
|
|
222
|
+
|
|
223
|
+
/** the members of the thread an item reads in, null when none */
|
|
224
|
+
export const membersOfItem = (items: readonly ReviewItem[]) => (id: string): ReviewItem[] | null => {
|
|
225
|
+
const t = threadOfItem(id, threadsOf(items))
|
|
226
|
+
return t === null ? null : membersOf(t)
|
|
227
|
+
}
|
|
228
|
+
|
|
125
229
|
/** the thread an item reads in: its own, the one whose history holds it, or the card's that answers it */
|
|
126
230
|
export const threadOfItem = (id: string, threads: readonly Thread[]): Thread | null =>
|
|
127
231
|
threads.find((t) => t.head.item.id === id) ?? threads.find((t) => membersOf(t).some((x) => x.item.id === id)) ?? null
|
|
@@ -130,9 +234,23 @@ export const threadOfItem = (id: string, threads: readonly Thread[]): Thread | n
|
|
|
130
234
|
* « no » until a new version or `wontfix`; reading the verdict is never doing it; an approval needs nothing), or a
|
|
131
235
|
* lane reworking it; what he or a player raised, until it is closed */
|
|
132
236
|
export function isActive(t: Thread, now = new Date()): boolean {
|
|
237
|
+
return heldOpen(membersOf(t)).length > 0 || owesWork(t, now)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** an agent owes the thread its next move, the objects that hold it open aside */
|
|
241
|
+
function owesWork(t: Thread, now: Date): boolean {
|
|
242
|
+
// his request for a lane waits on the orchestrator until an agent acts in the thread (review/lane-ask.ts)
|
|
243
|
+
if (laneAskOf(membersOf(t)) !== null) return true
|
|
244
|
+
if (openAsksOf(t).length > 0 || openItemVerdictsOf(t).length > 0) return true
|
|
245
|
+
if (t.answers.some((x) => t.joined.has(x.item.id) && stateOf(x, false).state !== 'closed')) return true
|
|
133
246
|
if (t.versions.some((x) => unreadBy(x, 'agent').some((m) => m !== openingOf(x)))) return true
|
|
134
247
|
if (t.answers.some((x) => unreadBy(x, 'agent').some((m) => m !== openingOf(x)))) return true
|
|
135
248
|
if (t.head.item.origin.by !== 'agent') return stateOf(t.head, false).state !== 'closed'
|
|
249
|
+
// opened with words: in work while the agent's latest update says so; a plain word owes nothing
|
|
250
|
+
if (isOpening(t.head.item)) {
|
|
251
|
+
const last = updatesOf(t.head).at(-1)?.update?.state
|
|
252
|
+
return last === 'broken' || last === 'better'
|
|
253
|
+
}
|
|
136
254
|
if (reworkOf(t.head, false, now)) return true
|
|
137
255
|
const f = verdictOf(t.head)
|
|
138
256
|
if (!f) return withdrawnOf(t.head) === undefined
|
|
@@ -149,7 +267,7 @@ export function conversationOf(t: Thread): (Message & { on: string })[] {
|
|
|
149
267
|
}
|
|
150
268
|
|
|
151
269
|
/** a head waits for the owner's verdict: an agent's card, none yet, not withdrawn, not a draft */
|
|
152
|
-
export const waits = (x: ReviewItem): boolean => x.item.origin.by === 'agent' && !inWork(x) && verdictOf(x) === null && withdrawnOf(x) === undefined
|
|
270
|
+
export const waits = (x: ReviewItem): boolean => x.item.origin.by === 'agent' && (!isOpening(x.item) || x.item.asksVerdict === true) && !inWork(x) && verdictOf(x) === null && withdrawnOf(x) === undefined
|
|
153
271
|
|
|
154
272
|
/** the active pending heads first in the order they were sent, then every other thread, newest first */
|
|
155
273
|
export function orderedThreads(items: readonly ReviewItem[]): Thread[] {
|
|
@@ -212,6 +330,8 @@ export function statusOf(x: ReviewItem, items: readonly ReviewItem[]): ShownStat
|
|
|
212
330
|
if (v) return v.status
|
|
213
331
|
if (withdrawnOf(x) !== undefined) return 'withdrawn'
|
|
214
332
|
if (inWork(x)) return 'wip'
|
|
333
|
+
// a thread opened with words that its agent called fixed: nothing waits
|
|
334
|
+
if (isOpening(x.item) && x.item.asksVerdict !== true) return 'fixed'
|
|
215
335
|
return supersederOf(x.item.id, items) ? 'superseded' : 'pending'
|
|
216
336
|
}
|
|
217
337
|
|
|
@@ -233,8 +353,223 @@ export function unseen(items: readonly ReviewItem[]): ReviewItem[] {
|
|
|
233
353
|
.map((u) => u.x)
|
|
234
354
|
}
|
|
235
355
|
|
|
236
|
-
/** what waits on him: the
|
|
237
|
-
export
|
|
238
|
-
|
|
239
|
-
|
|
356
|
+
/** what waits on him: the threads whose turn is his (turnOf), the one count the hub, the tree's pill and `sk needs` show */
|
|
357
|
+
export const waitingOnOwner = (items: readonly ReviewItem[], now = new Date()): Thread[] =>
|
|
358
|
+
// an ask's thread is counted as its ask, once (wiki tools/shipkit/threads-asks.md, An ask's thread)
|
|
359
|
+
orderedThreads(items).filter((t) => turnOf(t, now) === 'yours' && !isAskItem(t.head.item))
|
|
360
|
+
|
|
361
|
+
/** who acts now on a thread (wiki tools/shipkit/threads-how-it-fits.md, The model): his turn, his turn set aside, an
|
|
362
|
+
* agent's move (whether one works it now is the band's, band.ts), nothing owed */
|
|
363
|
+
export type Turn = 'yours' | 'aside' | 'agents' | 'done'
|
|
364
|
+
|
|
365
|
+
/** each question and proposed change of the agents that no message of his answers yet (`re` names it) and no newer
|
|
366
|
+
* object supersedes (review/supersede.ts), oldest first */
|
|
367
|
+
export function openAsksOf(t: Thread): (Message & { on: string })[] {
|
|
368
|
+
if (askStateOf(t)?.state === 'done' || askStateOf(t)?.state === 'declined') return []
|
|
369
|
+
const members = membersOf(t)
|
|
370
|
+
const gone = replacersOf(members)
|
|
371
|
+
const out = members.flatMap((x) => {
|
|
372
|
+
return x.thread.filter((m) => partyOf(m.who) === 'agent' && !gone.has(m.id) && (m.propose !== undefined ? proposeOpen(x.thread, m) : askOpen(x.thread, m))).map((m) => ({ ...m, on: x.item.id }))
|
|
373
|
+
})
|
|
374
|
+
return afterClose(t, out).sort((a, b) => a.at.localeCompare(b.at))
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** each message of the thread that asks the owner's verdict and has none, oldest first; a closed ask's thread asks nothing */
|
|
378
|
+
export function openItemVerdictsOf(t: Thread): (Message & { on: string })[] {
|
|
379
|
+
if (askStateOf(t)?.state === 'done' || askStateOf(t)?.state === 'declined') return []
|
|
380
|
+
const members = membersOf(t)
|
|
381
|
+
return afterClose(t, openVerdictAsks(members, new Set(replacersOf(members).keys())))
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** when he closed the thread: his act after which its head stays closed (his OK or archive, his close), null while it is
|
|
385
|
+
* open or when an agent or the machine closed it (a check's thread `fixed` by a run moots nothing); an ask's thread
|
|
386
|
+
* closes by its ask. A reopen or a new version opens the head, and its requests wait again (wiki
|
|
387
|
+
* tools/shipkit/threads-how-it-fits.md, The model) */
|
|
388
|
+
export function closedAt(t: Thread): string | null {
|
|
389
|
+
const x = t.head
|
|
390
|
+
if (isAskItem(x.item)) {
|
|
391
|
+
const a = askStateOf(t)
|
|
392
|
+
return a !== null && (a.state === 'done' || a.state === 'declined') ? a.at : null
|
|
393
|
+
}
|
|
394
|
+
if (stateOf(x, false).state !== 'closed') return null
|
|
395
|
+
for (let i = x.thread.length - 1; i >= 0; i--) {
|
|
396
|
+
if (stateOf({ ...x, thread: x.thread.slice(0, i) }, false).state === 'closed') continue
|
|
397
|
+
const m = x.thread[i]!
|
|
398
|
+
return partyOf(m.who) === 'owner' ? m.at : null
|
|
399
|
+
}
|
|
400
|
+
return null
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** a request written before his close is moot: it waits on nobody, its cell reads « closed, not answered » */
|
|
404
|
+
export const isMoot = (t: Thread, m: Pick<Message, 'at'>): boolean => {
|
|
405
|
+
const cut = closedAt(t)
|
|
406
|
+
return cut !== null && m.at <= cut
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const afterClose = <M extends Pick<Message, 'at'>>(t: Thread, ms: M[]): M[] => (ms.length === 0 ? ms : ms.filter((m) => !isMoot(t, m)))
|
|
410
|
+
|
|
411
|
+
/** yours: a version waits for the owner's verdict, a question or a proposed change for the owner's answer, a note the
|
|
412
|
+
* owner raised is the owner's move, or only an object whose move is the owner's holds it open (a branch to merge);
|
|
413
|
+
* agents: an agent owes the next move; done: nothing is owed */
|
|
414
|
+
export function turnOf(t: Thread, now = new Date()): Turn {
|
|
415
|
+
const base = baseTurnOf(t, now)
|
|
416
|
+
return base === 'yours' && asideUntil(t, now) !== null ? 'aside' : base
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** the newest ask state written in the thread with its time, null on a thread that is no ask's or never said one */
|
|
420
|
+
export function askStateOf(t: Thread): (NonNullable<Message['askState']> & { at: string }) | null {
|
|
421
|
+
let last: (NonNullable<Message['askState']> & { at: string }) | null = null
|
|
422
|
+
for (const x of membersOf(t)) for (const m of x.thread) if (m.askState && (last === null || m.at >= last.at)) last = { ...m.askState, at: m.at }
|
|
423
|
+
return last
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** when a thread set aside comes back, null when it is not set aside now: the newest « set aside » still ahead, unless
|
|
427
|
+
* he acted on the thread after it, or an agent sent an urgent message after it */
|
|
428
|
+
export function asideUntil(t: Thread, now = new Date()): string | null {
|
|
429
|
+
let snooze: { at: string; until: string | null } | null = null
|
|
430
|
+
const msgs = membersOf(t).flatMap((x) => x.thread)
|
|
431
|
+
for (const m of msgs) if (m.snooze && (snooze === null || m.at >= snooze.at)) snooze = { at: m.at, until: m.snooze.until }
|
|
432
|
+
if (snooze === null || snooze.until === null || Date.parse(snooze.until) <= now.getTime()) return null
|
|
433
|
+
const after = msgs.filter((m) => m.at > snooze!.at)
|
|
434
|
+
if (after.some((m) => m.urgent === true && partyOf(m.who) === 'agent')) return null
|
|
435
|
+
if (after.some((m) => partyOf(m.who) === 'owner' && m.op !== 'seen' && m.snooze === undefined)) return null
|
|
436
|
+
return snooze.until
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function baseTurnOf(t: Thread, now: Date): 'yours' | 'agents' | 'done' {
|
|
440
|
+
if (waits(t.head) || openAsksOf(t).length > 0 || openItemVerdictsOf(t).length > 0) return 'yours'
|
|
441
|
+
// an open ask with nothing open: its bar waits on him (« done ✓ », his hands until its check passes), unless his
|
|
442
|
+
// words came last, which an agent reads and answers
|
|
443
|
+
if (isAskItem(t.head.item) && askStateOf(t)?.state !== 'done' && askStateOf(t)?.state !== 'declined') {
|
|
444
|
+
const said = membersOf(t).flatMap((x) => x.thread).filter((m) => m.op !== 'seen' && m.op !== 'working' && m.askBar === undefined && m.snooze === undefined && m.askState === undefined)
|
|
445
|
+
const last = said.sort((a, b) => a.at.localeCompare(b.at)).at(-1)
|
|
446
|
+
return last !== undefined && partyOf(last.who) === 'owner' && last.answer === undefined && last.verdict === undefined ? 'agents' : 'yours'
|
|
447
|
+
}
|
|
448
|
+
const notes = [...(t.head.item.origin.by === 'agent' ? [] : [t.head]), ...t.answers.filter((x) => t.joined.has(x.item.id))]
|
|
449
|
+
if (notes.some((x) => moveOf(stateOf(x, false).state) === 'owner')) return 'yours'
|
|
450
|
+
if (owesWork(t, now)) return 'agents'
|
|
451
|
+
const held = heldOpen(membersOf(t))
|
|
452
|
+
if (held.length === 0) return 'done'
|
|
453
|
+
return held.some((h) => holdMoveOf(h) === 'owner') ? 'yours' : 'agents'
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/** the agent that holds a thread: its newest act in it (a version, an update, a reply, a question, a claim, a take;
|
|
457
|
+
* never a read mark), by its lane and its session. Null on a thread no agent touched. Who hears it and who may mark
|
|
458
|
+
* it seen follow from it (review/parties.ts) */
|
|
459
|
+
export type { Holder } from './parties.ts'
|
|
460
|
+
|
|
461
|
+
export function holderOf(t: Thread): Holder | null {
|
|
462
|
+
const acts: Holder[] = []
|
|
463
|
+
for (const x of membersOf(t)) {
|
|
464
|
+
const o = x.item.origin
|
|
465
|
+
if (o.by === 'agent') acts.push({ ...(o.lane ? { lane: o.lane } : {}), ...(o.session ? { session: o.session } : {}), at: x.item.created })
|
|
466
|
+
for (const m of x.thread)
|
|
467
|
+
if (partyOf(m.who) === 'agent' && m.op !== 'seen') acts.push({ ...(m.who !== 'agent' ? { lane: m.who } : {}), ...(m.session ? { session: m.session } : {}), at: m.at })
|
|
468
|
+
}
|
|
469
|
+
// an act that names nobody (an older message of an unnamed agent) holds nothing; on one instant the later written wins
|
|
470
|
+
return acts.filter((a) => a.lane !== undefined || a.session !== undefined).reduce<Holder | null>((best, a) => (best === null || a.at >= best.at ? a : best), null)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** `me` holds it by the act alone, no registry at hand: its lane when the holder names one, else its session */
|
|
474
|
+
const isHolder = (me: Me, h: Holder): boolean => (h.lane !== undefined ? me.lane === h.lane && (me.session === null || h.session === undefined || me.session === h.session) : me.session !== null && me.session === h.session)
|
|
475
|
+
|
|
476
|
+
/** each item's thread by its id, built once for a pass over many items */
|
|
477
|
+
export function threadByItem(threads: readonly Thread[]): Map<string, Thread> {
|
|
478
|
+
const by = new Map<string, Thread>()
|
|
479
|
+
for (const t of threads) for (const x of membersOf(t)) if (!by.has(x.item.id)) by.set(x.item.id, t)
|
|
480
|
+
return by
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** who hears his answer on a thread now, its light and its words (rule 3, review/parties.ts hearingOf) */
|
|
484
|
+
export const hearingOfThread = (t: Thread, p: Parties, repo: string): Hearing => hearingOf(holderOf(t), p, repo)
|
|
485
|
+
|
|
486
|
+
/** a watch or an inbox with this filter hears what lands on `x`. With the registry: the party that hears the thread
|
|
487
|
+
* now (its holder, else its parent session for it); with none, its holder by the act alone. A bare filter hears every
|
|
488
|
+
* thread (the dispatcher); a thread nobody holds, its maker's */
|
|
489
|
+
export function hears(f: WatchFilter, x: ReviewItem, byItem: ReadonlyMap<string, Thread>, p: Parties | null = null): boolean {
|
|
490
|
+
if (f.session === null && f.lane === null) return true
|
|
491
|
+
const t = byItem.get(x.item.id)
|
|
492
|
+
const h = t ? holderOf(t) : null
|
|
493
|
+
if (h === null) return coversCard(f, x)
|
|
494
|
+
return p === null ? (f.session === null || f.session === h.session) && (f.lane === null || f.lane === h.lane) : heardBy(f, hearingOf(h, p, ''), p)
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** the live watches that read his answer on `x`: the holder's, and a bare one, which hears every thread */
|
|
498
|
+
export const listenersOf = <W extends WatchFilter>(watchers: readonly W[], x: ReviewItem, byItem: ReadonlyMap<string, Thread>, p: Parties | null = null): W[] => watchers.filter((w) => hears(w, x, byItem, p))
|
|
499
|
+
|
|
500
|
+
/** as a hook (`inbox --hook`) of `me`, a session: `mine` when `me` hears the thread now (it holds it, or its lane that
|
|
501
|
+
* holds it does not hear), `nobody` when no live party does (every session of its repo sees it, until one takes it) */
|
|
502
|
+
export function hookHears(me: Me, x: ReviewItem, byItem: ReadonlyMap<string, Thread>, p: Parties, repo: string): 'mine' | 'nobody' | null {
|
|
503
|
+
const t = byItem.get(x.item.id)
|
|
504
|
+
const hearing = hearingOf(t ? holderOf(t) : null, p, repo)
|
|
505
|
+
if (hearing.light === 'nobody') return 'nobody'
|
|
506
|
+
return heardBy(me, hearing, p) ? 'mine' : null
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** why `me` may not mark the owner's answer on `x` seen, null when it may (rule 4: the holder or an ancestor, its
|
|
510
|
+
* session). A word is never refused: writing in a thread, or `sk thread take`, is how an agent takes it. A plain
|
|
511
|
+
* approval owes nothing, anyone reads it. An item he or a player raised follows the claim rules */
|
|
512
|
+
export function seenRefusal(x: ReviewItem, t: Thread | null, me: Me, p: Parties = NO_PARTIES): string | null {
|
|
513
|
+
if (x.item.origin.by !== 'agent') return null
|
|
514
|
+
const s = stateOf(x, false)
|
|
515
|
+
if (s.state === 'closed' && s.why === 'approved') return null
|
|
516
|
+
const h = t ? holderOf(t) : null
|
|
517
|
+
if (h === null || maySee(me, h, p) || isHolder(me, h)) return null
|
|
518
|
+
const hearing = hearingOf(h, p, '')
|
|
519
|
+
const holder = h.lane !== undefined ? `lane ${h.lane} of ${sessionLabel(h.session, p)}` : sessionLabel(h.session, p)
|
|
520
|
+
const address = t ? (ownAddressesOf(t)[0] ?? x.item.id) : x.item.id
|
|
521
|
+
return `${x.item.id} is held by ${holder} (${hearing.words}): that agent marks it seen, or its session; to act on it yourself, sk thread take ${address}, then mark it seen`
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** what moved since the owner's last act in the store (a verdict, a word, a note, an answer; never a read: the hub marks
|
|
525
|
+
* what he sees read a moment after the page opens, which would empty the line): the threads an agent wrote in since,
|
|
526
|
+
* and how many of them are his turn. Null before his first act. The line he reads on waking */
|
|
527
|
+
export function sinceHeLeft(items: readonly ReviewItem[], now = new Date()): { at: string; moved: number; yours: number } | null {
|
|
528
|
+
let at = ''
|
|
529
|
+
for (const x of items) {
|
|
530
|
+
if (x.item.origin.by === 'owner' && x.item.created > at) at = x.item.created
|
|
531
|
+
for (const m of x.thread) if (m.who === 'owner' && m.op !== 'seen' && m.at > at) at = m.at
|
|
532
|
+
}
|
|
533
|
+
if (at === '') return null
|
|
534
|
+
const moved = threadsOf(items).filter((t) => membersOf(t).some((x) => (x.item.origin.by === 'agent' && x.item.created > at) || x.thread.some((m) => partyOf(m.who) === 'agent' && m.op !== 'seen' && m.at > at)))
|
|
535
|
+
return { at, moved: moved.length, yours: moved.filter((t) => turnOf(t, now) === 'yours').length }
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/** what « it is fixed » does on a thread (`sk thread fixed`): `asked` a note of the owner, by its id, closes it; else the owner's one open note in
|
|
539
|
+
* the thread closes (two or more are named, one picked by its id); else the newest version he answered « ok with a fix »
|
|
540
|
+
* closes (done), and one he rejected or that is in work asks the owner's verdict again (an update `fixed`) */
|
|
541
|
+
export function fixedPlan(t: Thread, asked: ReviewItem, o: { byAddress?: boolean } = {}): { op: 'fixed' | 'done' | 'update'; id: string } | { error: string } {
|
|
542
|
+
// an address names the thread, never its head note: a closed note heading it stands for nothing
|
|
543
|
+
if (asked.item.origin.by !== 'agent' && !o.byAddress) return { op: 'fixed', id: asked.item.id }
|
|
544
|
+
const notes = [...(t.head.item.origin.by === 'agent' ? [] : [t.head]), ...t.answers.filter((x) => t.joined.has(x.item.id))].filter((x) => stateOf(x, false).state !== 'closed')
|
|
545
|
+
if (notes.length === 1) return { op: 'fixed', id: notes[0]!.item.id }
|
|
546
|
+
if (notes.length > 1) return { error: `${notes.length} open notes of his in this thread: sk thread fixed <id> "<what was done>" on the one you fixed: ${notes.map((x) => `${x.item.id} "${x.item.title}"`).join('; ')}` }
|
|
547
|
+
const h = t.head
|
|
548
|
+
const st = stateOf(h, false)
|
|
549
|
+
if (st.state === 'claimed' && verdictOf(h)?.status === 'approved-with-fix') return { op: 'done', id: h.item.id }
|
|
550
|
+
if (st.state === 'claimed' || st.state === 'draft') return { op: 'update', id: h.item.id }
|
|
551
|
+
if (st.state === 'asks') return { error: `${h.item.id} waits on the verdict of the owner already: nothing to say fixed` }
|
|
552
|
+
return { error: `${h.item.id} is closed already (${st.why ?? 'closed'}): nothing to say fixed` }
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** the views of an item its messages hold, never the version's own (wiki tools/shipkit/threads-store.md, A message's
|
|
556
|
+
* views): an update's media, a question's options, a proposed sound */
|
|
557
|
+
export function messageViewsOf(x: ReviewItem): Set<number> {
|
|
558
|
+
const out = new Set<number>()
|
|
559
|
+
for (const m of x.thread) {
|
|
560
|
+
if (partyOf(m.who) !== 'agent') continue
|
|
561
|
+
if (m.update?.view !== undefined) out.add(m.update.view)
|
|
562
|
+
for (const v of m.ask?.views ?? []) if (v !== null) out.add(v)
|
|
563
|
+
if (m.propose) for (const f of proposeFields(m.propose)) if (f.view !== undefined) out.add(f.view)
|
|
564
|
+
}
|
|
565
|
+
return out
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** why an agent may not start a thread or a link on an address, or null: its kind word is one a kind declares
|
|
569
|
+
* (review/kinds.ts), or a thread already names it (a note of his from a page's thread control, an older thread), so a
|
|
570
|
+
* link or a reply to it forks nothing */
|
|
571
|
+
export function addressRefusal(address: string, items: readonly ReviewItem[], spec: Spec = NO_SPEC): string | null {
|
|
572
|
+
const why = addressKindProblem(address, spec)
|
|
573
|
+
if (why === null || threadsNaming(address, items, spec).length > 0) return null
|
|
574
|
+
return why
|
|
240
575
|
}
|