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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// the icons of a thread and its one object panel (wiki tools/shipkit/threads-page.md, The object panel): every framed
|
|
2
|
+
// cell heads with its type's icon (a version with its object's kind), an object a message links is a compact card
|
|
3
|
+
// (icon, title, one line, its kind's actions), and a click on it opens the object whole in ONE panel on the right of
|
|
4
|
+
// the thread, for every kind: its words, its kind's view at full size, a picture, its actions. Esc or a click outside
|
|
5
|
+
// closes it; on a phone it is a full screen sheet. The hub names no kind: it draws the declaration's icon and view
|
|
6
|
+
import { observer } from 'mobx-react-lite'
|
|
7
|
+
import { useEffect, useRef, type CSSProperties } from 'react'
|
|
8
|
+
import { createPortal } from 'react-dom'
|
|
9
|
+
import type { Cell, Linked, ReplyCell } from '../../../review/cells.ts'
|
|
10
|
+
import { glyphOf, hueOf, MESSAGE_TYPES, type MessageType } from '../../../review/glyphs.ts'
|
|
11
|
+
import { kindOf } from '../../../review/kinds.ts'
|
|
12
|
+
import { NO_SPEC, type Item, type Spec } from '../../../review/model.ts'
|
|
13
|
+
import type { WaitsOn } from '../../../review/wait.ts'
|
|
14
|
+
import { Icon } from '../icons.tsx'
|
|
15
|
+
import { renderMd } from '../md.ts'
|
|
16
|
+
import { Actions, Frames } from './kind-states.tsx'
|
|
17
|
+
import { keepFocus } from './kit.tsx'
|
|
18
|
+
import type { ReviewSt } from './review-st.ts'
|
|
19
|
+
import type { ThreadSt } from './thread-st.ts'
|
|
20
|
+
|
|
21
|
+
/** the type of one cell of a thread: a question by what it takes, a link, an update, the owner's note */
|
|
22
|
+
export function messageTypeOf(c: Cell): MessageType {
|
|
23
|
+
if (c.kind === 'event') return 'trace'
|
|
24
|
+
if (c.kind === 'version') return c.superseded ? 'instructions' : 'version'
|
|
25
|
+
if (c.kind === 'verdict') return 'verdict'
|
|
26
|
+
if (c.kind === 'note') return 'note'
|
|
27
|
+
if (c.instructions) return 'instructions'
|
|
28
|
+
if (c.propose) return 'change'
|
|
29
|
+
if (c.ask) return c.ask.kind === 'secret' ? 'secret' : c.ask.kind === 'checklist' ? 'checklist' : 'question'
|
|
30
|
+
if (c.op === 'ask') return 'question'
|
|
31
|
+
if (c.answers || c.op === 'answer') return 'answer'
|
|
32
|
+
if (c.update) return 'update'
|
|
33
|
+
if (c.re) return 'hint'
|
|
34
|
+
if (c.action) return 'action'
|
|
35
|
+
if (c.linked?.length || c.about?.length) return 'link'
|
|
36
|
+
return 'message'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const wordOf = (address: string): string => address.slice(0, address.indexOf(':'))
|
|
40
|
+
|
|
41
|
+
/** the kind word of a version's object: its address's, else its subject's */
|
|
42
|
+
const itemWord = (item: Item): string => (item.on ? wordOf(item.on) : item.subject.kind)
|
|
43
|
+
|
|
44
|
+
/** a kind's hue on the element that draws its icon: `data-hue` and `--kh` (hub.css), nothing for a kind with none */
|
|
45
|
+
export const hueProps = (kind: { color?: string } | undefined): { 'data-hue'?: string; style?: CSSProperties } => {
|
|
46
|
+
const h = hueOf(kind)
|
|
47
|
+
return h === null ? {} : { 'data-hue': '', style: { ['--kh' as string]: h } as CSSProperties }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** what waits on him first, as an icon and its words: a message's type, or an object's kind in its hue */
|
|
51
|
+
export function waitGlyph(on: WaitsOn, spec: Spec | null): { name: string; d: string; says: string; hue: number | null } {
|
|
52
|
+
if ('type' in on) return { name: on.type, d: MESSAGE_TYPES[on.type].icon, says: MESSAGE_TYPES[on.type].label, hue: null }
|
|
53
|
+
const k = kindOf(on.kind, spec ?? NO_SPEC)
|
|
54
|
+
return { name: on.kind, d: glyphOf(k), says: k?.label ?? on.kind, hue: hueOf(k) }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** a cell's icon at its head, small and muted: a version draws its object's kind, every other cell its type */
|
|
58
|
+
export const CellGlyph = ({ rv, c }: { rv: ReviewSt; c: Cell }) => {
|
|
59
|
+
const type = messageTypeOf(c)
|
|
60
|
+
const word = c.kind === 'version' && type === 'version' ? itemWord(c.item) : null
|
|
61
|
+
const kind = word !== null ? kindOf(word, rv.spec ?? NO_SPEC) : undefined
|
|
62
|
+
const says = word !== null ? `a version of ${kind?.label ?? word}` : MESSAGE_TYPES[type].label
|
|
63
|
+
return (
|
|
64
|
+
<span className="rv-cglyph" data-type={type} title={says} role="img" aria-label={says} {...(word !== null ? hueProps(kind) : {})}>
|
|
65
|
+
<Icon d={word !== null ? glyphOf(kind) : MESSAGE_TYPES[type].icon} />
|
|
66
|
+
</span>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** the one line a card says of an object's words: the first line that is no heading, its marks dropped */
|
|
71
|
+
const oneLine = (md: string): string => {
|
|
72
|
+
const line = md.split('\n').map((l) => l.trim()).find((l) => l !== '' && !l.startsWith('#')) ?? ''
|
|
73
|
+
return line.replace(/[*_`>]/g, '').replace(/\[([^\]]*)\]\([^)]*\)/g, '$1').slice(0, 200)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** an object a message linked: a compact card, its click opens the panel with the object whole; its kind's actions on
|
|
77
|
+
* it while it stands and its panel is shut (open, the panel holds them), the owner's answer once given, folded once its own
|
|
78
|
+
* thread is done */
|
|
79
|
+
export const ObjectCard = observer(({ rv, card, c, l }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; l: Linked }) => {
|
|
80
|
+
const word = wordOf(l.address)
|
|
81
|
+
const kind = kindOf(word, rv.spec ?? NO_SPEC)
|
|
82
|
+
const open = card.panel !== null && 'cell' in card.panel && card.panel.cell === c.id && card.panel.address === l.address
|
|
83
|
+
return (
|
|
84
|
+
<section className={`rv-objcard rv-linked${l.done ? ' done' : ''}${open ? ' on' : ''}`} aria-label={`${word} ${l.title}`}>
|
|
85
|
+
<button className="rv-objopen ghost" title="open it whole, on the right" aria-expanded={open} onMouseDown={keepFocus} onClick={() => card.openPanel({ cell: c.id, address: l.address })}>
|
|
86
|
+
<span className="rv-objglyph" title={kind?.label ?? word} {...hueProps(kind)}><Icon d={glyphOf(kind)} /></span>
|
|
87
|
+
<span className="rv-objtext">
|
|
88
|
+
<span className="rv-objhead"><span className="rv-linkedkind">{word}</span><b className="rv-objtitle">{l.title}</b></span>
|
|
89
|
+
{l.md.trim() !== '' ? <span className="rv-objline">{oneLine(l.md)}</span> : null}
|
|
90
|
+
</span>
|
|
91
|
+
</button>
|
|
92
|
+
{l.decided || l.done ? (
|
|
93
|
+
<div className="rv-objstate">
|
|
94
|
+
{l.decided ? <span className="rv-linkeddecided" title={l.decided.text}>you: {kind?.actions?.[l.decided.name]?.label ?? l.decided.name}</span> : null}
|
|
95
|
+
{l.done ? <span className="rv-dim">folded</span> : null}
|
|
96
|
+
</div>
|
|
97
|
+
) : null}
|
|
98
|
+
{kind?.actions && !l.done && !open ? <Actions rv={rv} card={card} id={c.on} actions={kind.actions} re={c.id.slice(c.on.length + 1)} about={l.address} /> : null}
|
|
99
|
+
</section>
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
/** an address a message names with nothing linked to draw: a chip with its kind's icon; its click opens the panel */
|
|
104
|
+
export const AddressChip = observer(({ rv, card, c, address }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; address: string }) => {
|
|
105
|
+
const kind = kindOf(wordOf(address), rv.spec ?? NO_SPEC)
|
|
106
|
+
return (
|
|
107
|
+
<button className="rv-objchip ghost" title={`${kind?.label ?? wordOf(address)}: open it on the right`} onMouseDown={keepFocus} onClick={() => card.openPanel({ cell: c.id, address })}>
|
|
108
|
+
<span className="rv-objglyph" {...hueProps(kind)}><Icon d={glyphOf(kind)} /></span>
|
|
109
|
+
<span className="rv-mono">{address}</span>
|
|
110
|
+
</button>
|
|
111
|
+
)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
/** THE object panel: a column on the right of the thread's cells, which keep their own scroll on its left; a full
|
|
115
|
+
* screen sheet over the page on a phone */
|
|
116
|
+
export const ObjectPanel = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
|
|
117
|
+
const el = useRef<HTMLElement | null>(null)
|
|
118
|
+
const p = card.panel
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (p === null) return
|
|
121
|
+
const key = (e: KeyboardEvent): void => {
|
|
122
|
+
if (e.key !== 'Escape') return
|
|
123
|
+
e.preventDefault()
|
|
124
|
+
e.stopPropagation()
|
|
125
|
+
card.closePanel()
|
|
126
|
+
}
|
|
127
|
+
// a press outside closes it, except on what opens a panel: that one opens its own object instead
|
|
128
|
+
const press = (e: PointerEvent): void => {
|
|
129
|
+
const t = e.target as Element | null
|
|
130
|
+
if (t == null || el.current?.contains(t) || t.closest('.rv-objopen, .rv-objchip, .rv-preview, .rv-raisedframe')) return
|
|
131
|
+
card.closePanel()
|
|
132
|
+
}
|
|
133
|
+
window.addEventListener('keydown', key, true)
|
|
134
|
+
document.addEventListener('pointerdown', press, true)
|
|
135
|
+
return () => {
|
|
136
|
+
window.removeEventListener('keydown', key, true)
|
|
137
|
+
document.removeEventListener('pointerdown', press, true)
|
|
138
|
+
}
|
|
139
|
+
}, [p, card])
|
|
140
|
+
if (p === null) return null
|
|
141
|
+
const linkedOf = (cell: string, address: string): { c: ReplyCell; l: Linked | undefined } | null => {
|
|
142
|
+
const c = card.cells.find((x): x is ReplyCell => x.kind === 'reply' && x.id === cell)
|
|
143
|
+
return c ? { c, l: c.linked?.find((x) => x.address === address) } : null
|
|
144
|
+
}
|
|
145
|
+
const at = 'cell' in p ? linkedOf(p.cell, p.address) : null
|
|
146
|
+
const word = 'cell' in p ? wordOf(p.address) : null
|
|
147
|
+
const kind = word !== null ? kindOf(word, rv.spec ?? NO_SPEC) : undefined
|
|
148
|
+
const title = 'cell' in p ? (at?.l?.title ?? p.address) : p.title
|
|
149
|
+
const view = 'cell' in p && kind?.view ? new URLSearchParams({ on: p.address, key: p.address.slice(p.address.indexOf(':') + 1) }) : null
|
|
150
|
+
const panel = (
|
|
151
|
+
<aside ref={el} className={`rv-panel${rv.phone.on ? ' sheet' : ''}`} role="dialog" aria-label={title}>
|
|
152
|
+
<header className="rv-panelhead">
|
|
153
|
+
<span className="rv-objglyph" {...('cell' in p ? hueProps(kind) : {})}><Icon d={'cell' in p ? glyphOf(kind) : MESSAGE_TYPES.message.icon} /></span>
|
|
154
|
+
<span className="rv-paneltitle">
|
|
155
|
+
{word !== null ? <span className="rv-linkedkind">{word}</span> : null}
|
|
156
|
+
<b title={title}>{title}</b>
|
|
157
|
+
{'cell' in p ? <span className="rv-mono rv-dim rv-paneladdr">{p.address}</span> : null}
|
|
158
|
+
</span>
|
|
159
|
+
{at?.l?.home ? <button className="ghost rv-linkedopen" title="its own thread" onMouseDown={keepFocus} onClick={() => { card.closePanel(); rv.pick(at.l!.home!) }}>its thread ↗</button> : null}
|
|
160
|
+
{'src' in p ? <a className="ghost rv-linkedopen" href={p.src} target="_blank" rel="noreferrer">open ↗</a> : null}
|
|
161
|
+
<button className="ghost rv-panelclose" title="close (Esc)" aria-label="close" onMouseDown={keepFocus} onClick={() => card.closePanel()}>✕</button>
|
|
162
|
+
</header>
|
|
163
|
+
<div className="rv-panelbody">
|
|
164
|
+
{'src' in p ? <img className="rv-panelimg" src={p.src} alt="" /> : null}
|
|
165
|
+
{view && kind?.view ? <div className="rv-panelview"><Frames rv={rv} page={kind.view.page} frames={[{ id: 'view', keys: view }]} /></div> : null}
|
|
166
|
+
{at?.l && at.l.md.trim() !== '' ? <div className="md rv-what" dangerouslySetInnerHTML={{ __html: renderMd(at.l.md) }} /> : null}
|
|
167
|
+
{'cell' in p && !view && !at?.l ? <div className="rv-dim">{kind?.label ?? word}: no view of it is declared, its words live in the message that names it.</div> : null}
|
|
168
|
+
</div>
|
|
169
|
+
{at?.l ? (
|
|
170
|
+
<footer className="rv-panelfoot">
|
|
171
|
+
{at.l.decided ? <span className="rv-linkeddecided" title={at.l.decided.text}>you: {kind?.actions?.[at.l.decided.name]?.label ?? at.l.decided.name}</span> : null}
|
|
172
|
+
{at.l.done ? <span className="rv-dim">folded: its own thread is done</span> : null}
|
|
173
|
+
{kind?.actions && !at.l.done ? <Actions rv={rv} card={card} id={at.c.on} actions={kind.actions} re={at.c.id.slice(at.c.on.length + 1)} about={at.l.address} /> : null}
|
|
174
|
+
</footer>
|
|
175
|
+
) : null}
|
|
176
|
+
</aside>
|
|
177
|
+
)
|
|
178
|
+
return rv.phone.on ? createPortal(panel, document.body) : panel
|
|
179
|
+
})
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
// what an agent asks of the owner in a thread, answered in one click (wiki tools/shipkit/threads.md, A question, A proposed
|
|
2
|
+
// change): a question's options, each words or a media drawn as a view, and a proposed change, each field drawn by its
|
|
3
|
+
// type and applied alone. The owner's words go with the click; words with no click answer « none of these »
|
|
4
|
+
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
6
|
+
import type { ReplyCell } from '../../../review/cells.ts'
|
|
7
|
+
import { kindOfValue, type ValueKind } from '../../../review/kinds.ts'
|
|
8
|
+
import { CodeHunk, Swatches, WordDiff } from './diff-view.tsx'
|
|
9
|
+
import { AutoText } from '../auto-text.tsx'
|
|
10
|
+
import { renderMdInline } from '../md.ts'
|
|
11
|
+
import { keepFocus } from './kit.tsx'
|
|
12
|
+
import type { ReviewSt } from './review-st.ts'
|
|
13
|
+
import { ViewCell } from './review-views.tsx'
|
|
14
|
+
import type { ThreadSt } from './thread-st.ts'
|
|
15
|
+
|
|
16
|
+
type Field = NonNullable<ReplyCell['propose']>['fields'][number]
|
|
17
|
+
|
|
18
|
+
/** an option's or a field's media, a view of the item the message sits on, drawn read only */
|
|
19
|
+
const MessageView = observer(({ rv, card, c, i }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; i: number }) => {
|
|
20
|
+
const version = card.versionOf(c.on)
|
|
21
|
+
const v = version?.item.views[i]
|
|
22
|
+
if (!version || !v) return <div className="rv-dim">the media is gone from the store</div>
|
|
23
|
+
return <ViewCell ver={{ rv, card, cell: version, live: false, claim: false }} v={v} i={i} noted={false} />
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
/** an agent's question: one button per option, its media over it, its pick marked; one click answers, the words box goes
|
|
27
|
+
* with it, and words alone say none of them */
|
|
28
|
+
export const AskBody = observer(({ rv, card, c, ask }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; ask: NonNullable<ReplyCell['ask']> }) => {
|
|
29
|
+
if (ask.kind !== undefined && ask.kind !== 'choice') return <KindAskBody rv={rv} card={card} c={c} ask={ask} />
|
|
30
|
+
const done = ask.answered
|
|
31
|
+
const media = ask.views?.some((v) => v !== null) === true
|
|
32
|
+
const words = (card.hints[c.id] ?? '').trim() !== ''
|
|
33
|
+
const button = (o: string, i: number) => (
|
|
34
|
+
<button
|
|
35
|
+
key={i}
|
|
36
|
+
className={`rv-askopt${done?.option === i ? ' picked' : ''}${ask.pick === i ? ' pick' : ''}`}
|
|
37
|
+
disabled={done !== undefined || card.busy}
|
|
38
|
+
onMouseDown={keepFocus}
|
|
39
|
+
onClick={() => void card.answer(c, { option: i })}
|
|
40
|
+
title={ask.pick === i ? "the agent's pick" : undefined}
|
|
41
|
+
>
|
|
42
|
+
<span className="rv-askn">{i + 1}</span>
|
|
43
|
+
<span className="rv-askoptlabel mdi" dangerouslySetInnerHTML={{ __html: renderMdInline(o) }} />
|
|
44
|
+
{ask.pick === i ? <span className="rv-mypick">my pick</span> : null}
|
|
45
|
+
{done?.option === i ? <span className="rv-badge">✓ yours</span> : null}
|
|
46
|
+
</button>
|
|
47
|
+
)
|
|
48
|
+
return (
|
|
49
|
+
<div className="rv-ask">
|
|
50
|
+
{done || c.superseded ? null : <AnswerWords card={card} c={c} placeholder="a word with your answer (optional), then click an option" />}
|
|
51
|
+
{media ? (
|
|
52
|
+
<div className="rv-askmedia">
|
|
53
|
+
{ask.options.map((o, i) => (
|
|
54
|
+
<div key={i} className={`rv-askcard${done?.option === i ? ' picked' : ''}${ask.pick === i ? ' pick' : ''}`}>
|
|
55
|
+
{ask.views?.[i] != null ? <MessageView rv={rv} card={card} c={c} i={ask.views[i]!} /> : null}
|
|
56
|
+
{button(o, i)}
|
|
57
|
+
</div>
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
) : (
|
|
61
|
+
<div className="rv-askopts">{ask.options.map(button)}</div>
|
|
62
|
+
)}
|
|
63
|
+
{!done && words ? (
|
|
64
|
+
<div className="rv-askopts">
|
|
65
|
+
<button className="rv-askopt" disabled={card.busy} onMouseDown={keepFocus} onClick={() => void card.noneOf(c)}>none of these: send my words</button>
|
|
66
|
+
</div>
|
|
67
|
+
) : null}
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
type CellAsk = NonNullable<ReplyCell['ask']>
|
|
73
|
+
|
|
74
|
+
/** a question of another answer kind (wiki tools/shipkit/threads-asks.md, Answer kinds): a checklist's boxes, a confirm's
|
|
75
|
+
* « done », a text's or a url's field, a secret's place; the owner's words alone answer it as none, or ride on a checklist */
|
|
76
|
+
const KindAskBody = observer(({ rv, card, c, ask }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
|
|
77
|
+
const words = (card.hints[c.id] ?? '').trim() !== ''
|
|
78
|
+
return (
|
|
79
|
+
<div className={`rv-ask rv-ask-${ask.kind}`}>
|
|
80
|
+
{ask.kind === 'checklist' ? <Checklist card={card} c={c} ask={ask} /> : null}
|
|
81
|
+
{ask.kind === 'confirm' ? <Confirm card={card} c={c} ask={ask} /> : null}
|
|
82
|
+
{ask.kind === 'text' || ask.kind === 'url' ? <ValueField card={card} c={c} ask={ask} /> : null}
|
|
83
|
+
{ask.kind === 'secret' ? <SecretPlace rv={rv} card={card} c={c} ask={ask} /> : null}
|
|
84
|
+
{ask.kind === 'file' ? <div className="rv-dim">{ask.value ? `his file: view ${(ask.value.view ?? 0) + 1}` : 'a file he drops: not built in the hub yet'}</div> : null}
|
|
85
|
+
{ask.none !== undefined ? <div className="rv-dim">answered with words: {ask.none}</div> : null}
|
|
86
|
+
{(ask.open || ask.kind === 'checklist') && ask.kind !== 'secret' && !c.superseded ? (
|
|
87
|
+
<div className="rv-askwords">
|
|
88
|
+
<AnswerWords card={card} c={c} placeholder={ask.kind === 'checklist' ? 'a word on these steps (optional)' : 'or answer with words alone'} />
|
|
89
|
+
{words ? (
|
|
90
|
+
<button className="rv-askopt" disabled={card.busy} onMouseDown={keepFocus} onClick={() => void card.noneOf(c)}>
|
|
91
|
+
{ask.kind === 'checklist' ? 'send my words' : 'send my words, not this'}
|
|
92
|
+
</button>
|
|
93
|
+
) : null}
|
|
94
|
+
</div>
|
|
95
|
+
) : null}
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
/** a checklist: a box a line, ticked or unticked in one click, « 2 of 5 » over it */
|
|
101
|
+
const Checklist = observer(({ card, c, ask }: { card: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
|
|
102
|
+
const lines = (ask.lines ?? []).map((l, i) => ({ ...l, tick: card.ticking[`${c.id}#${i}`] ?? l.tick }))
|
|
103
|
+
const done = lines.filter((l) => l.tick).length
|
|
104
|
+
return (
|
|
105
|
+
<div className="rv-checklist">
|
|
106
|
+
<div className={`rv-checkcount${done === lines.length ? ' all' : ''}`}>{done === lines.length ? `✓ all ${lines.length} done` : `${done} of ${lines.length} done`}</div>
|
|
107
|
+
{lines.map((l, i) => (
|
|
108
|
+
<label key={i} className={`rv-checkline${l.tick ? ' ticked' : ''}`}>
|
|
109
|
+
<input type="checkbox" checked={l.tick} onChange={() => void card.tick(c, i, !l.tick)} />
|
|
110
|
+
<span className="rv-checkn">{i + 1}</span>
|
|
111
|
+
<span className="rv-checktext"><InlineMd text={l.text} /></span>
|
|
112
|
+
</label>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
/** a step he does in the real world: one « done » */
|
|
119
|
+
const Confirm = observer(({ card, c, ask }: { card: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
|
|
120
|
+
const line = ask.lines?.[0]
|
|
121
|
+
if (line?.tick) return <div className="rv-checkcount all">✓ done{line.at ? ` · ${new Date(line.at).toLocaleString()}` : ''}</div>
|
|
122
|
+
return (
|
|
123
|
+
<div className="rv-askopts">
|
|
124
|
+
<button className="rv-askopt pick" disabled={card.busy || !ask.open} onMouseDown={keepFocus} onClick={() => void card.tick(c, 0, true)}>
|
|
125
|
+
done
|
|
126
|
+
</button>
|
|
127
|
+
</div>
|
|
128
|
+
)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
/** a value he types, a text or a url; once given, what he gave */
|
|
132
|
+
const ValueField = observer(({ card, c, ask }: { card: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
|
|
133
|
+
const box = card.fieldBox(c, 'value')
|
|
134
|
+
const value = card.hints[box] ?? ''
|
|
135
|
+
if (ask.value && !ask.open)
|
|
136
|
+
return (
|
|
137
|
+
<div className="rv-askvalue">
|
|
138
|
+
<span className="rv-badge">✓ given</span> {ask.kind === 'url' ? <a href={ask.value.text} target="_blank" rel="noreferrer noopener">{ask.value.text}</a> : <span className="rv-valuetext">{ask.value.text}</span>}
|
|
139
|
+
{ask.kind === 'url' ? <span className="rv-dim">{ask.value.opens ? ` opens (${ask.value.opens})` : ' did not open from this Mac'}</span> : null}
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
const send = (): void => void card.answer(c, { value })
|
|
143
|
+
const bad = ask.kind === 'url' && value.trim() !== '' && !/^https?:\/\/\S+$/.test(value.trim())
|
|
144
|
+
return (
|
|
145
|
+
<div className="rv-askfield">
|
|
146
|
+
{ask.kind === 'url' ? (
|
|
147
|
+
<input type="url" value={value} placeholder="https://…" spellCheck={false} onChange={(e) => card.setHint(box, e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter' && !bad) send() }} />
|
|
148
|
+
) : (
|
|
149
|
+
<AutoText className="rv-answerwords" value={value} placeholder="your answer" onText={(t) => card.setHint(box, t)} />
|
|
150
|
+
)}
|
|
151
|
+
<button className="rv-askopt pick" disabled={card.busy || value.trim() === '' || bad} onMouseDown={keepFocus} onClick={send}>
|
|
152
|
+
send
|
|
153
|
+
</button>
|
|
154
|
+
{bad ? <div className="rv-dim">a link starts with https:// or http://</div> : null}
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
type SecretFacts = { name: string; login: boolean; readers: { words: string; short: string }; held: { held: string; at?: number | null }; refused?: string }
|
|
160
|
+
|
|
161
|
+
/** a secret's place in the thread (wiki tools/shipkit/threads-asks.md, The secret field): once stored, its name and
|
|
162
|
+
* when; open, the field, or why this browser may not type it */
|
|
163
|
+
const SecretPlace = observer(({ rv, card, c, ask }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; ask: CellAsk }) => {
|
|
164
|
+
const s = ask.secret
|
|
165
|
+
if (s?.stored) return <div className="rv-askvalue"><span className="rv-badge">🔒 stored</span> as <code>{s.name}</code> · {new Date(s.stored).toLocaleString()}</div>
|
|
166
|
+
if (!ask.open) return <div className="rv-dim">🔒 <code>{s?.name}</code>: not given</div>
|
|
167
|
+
return <SecretField rv={rv} card={card} c={c} name={s?.name ?? ''} />
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
/** the field itself: a password input, its value in this component's state alone (never the answer box's draft, never
|
|
171
|
+
* the browser's storage), sent once to the hub on this Mac, emptied whatever the answer; while it shows, the hub
|
|
172
|
+
* unloads the repo pages it keeps alive */
|
|
173
|
+
const SecretField = observer(({ rv, card, c, name }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; name: string }) => {
|
|
174
|
+
const [facts, setFacts] = useState<SecretFacts | null>(null)
|
|
175
|
+
const [value, setValue] = useState('')
|
|
176
|
+
const [account, setAccount] = useState('')
|
|
177
|
+
const [err, setErr] = useState<string | null>(null)
|
|
178
|
+
const [busy, setBusy] = useState(false)
|
|
179
|
+
const [decline, setDecline] = useState(false)
|
|
180
|
+
const re = c.id.slice(c.on.length + 1)
|
|
181
|
+
const url = rv.url(`/api/review/${c.on}/secret`)
|
|
182
|
+
const embedded = rv.home.embedded
|
|
183
|
+
useEffect(() => (embedded ? undefined : rv.home.frames.hold()), [embedded, rv])
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
let live = true
|
|
186
|
+
fetch(`${url}?re=${encodeURIComponent(re)}`)
|
|
187
|
+
.then(async (r) => (r.ok ? ((await r.json()) as SecretFacts) : Promise.reject(new Error(await r.text()))))
|
|
188
|
+
.then((f) => live && setFacts(f))
|
|
189
|
+
.catch((e: Error) => live && setErr(e.message))
|
|
190
|
+
return () => {
|
|
191
|
+
live = false
|
|
192
|
+
}
|
|
193
|
+
}, [url, re])
|
|
194
|
+
const send = async (): Promise<void> => {
|
|
195
|
+
const v = value
|
|
196
|
+
setValue('')
|
|
197
|
+
if (v.trim() === '' || busy) return
|
|
198
|
+
setBusy(true)
|
|
199
|
+
setErr(null)
|
|
200
|
+
try {
|
|
201
|
+
const r = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ re, value: v, ...(facts?.login ? { account } : {}) }) })
|
|
202
|
+
if (!r.ok) setErr(await r.text())
|
|
203
|
+
else void card.refresh()
|
|
204
|
+
} catch (e) {
|
|
205
|
+
setErr((e as Error).message)
|
|
206
|
+
} finally {
|
|
207
|
+
setBusy(false)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const refused = embedded ? 'a secret is typed in the hub itself, not in a page that frames it: open this thread in the hub' : facts?.refused
|
|
211
|
+
return (
|
|
212
|
+
<div className="rv-keyfield">
|
|
213
|
+
<div className="rv-keyhead">
|
|
214
|
+
🔒 <code>{name}</code>
|
|
215
|
+
{facts ? <span className="rv-dim"> · read by {facts.readers.short}</span> : null}
|
|
216
|
+
{facts?.held.held === 'stored' ? <span className="rv-dim"> · replaces the value held{facts.held.at ? ` since ${new Date(facts.held.at).toLocaleDateString()}` : ''}</span> : null}
|
|
217
|
+
</div>
|
|
218
|
+
{facts ? <div className="rv-dim rv-keywho" title={facts.readers.words}>{facts.readers.words}</div> : null}
|
|
219
|
+
{refused ? (
|
|
220
|
+
<div className="rv-keyno">{refused}</div>
|
|
221
|
+
) : facts ? (
|
|
222
|
+
<div className="rv-askfield">
|
|
223
|
+
{facts.login ? <input type="text" autoComplete="off" spellCheck={false} data-1p-ignore="" data-lpignore="true" placeholder="account (the email or user name you sign in with)" value={account} onChange={(e) => setAccount(e.target.value)} /> : null}
|
|
224
|
+
<input
|
|
225
|
+
type="password"
|
|
226
|
+
className="rv-keyvalue"
|
|
227
|
+
autoComplete="off"
|
|
228
|
+
spellCheck={false}
|
|
229
|
+
data-1p-ignore=""
|
|
230
|
+
data-lpignore="true"
|
|
231
|
+
placeholder={facts.login ? 'password' : `paste the value of ${name}`}
|
|
232
|
+
value={value}
|
|
233
|
+
onChange={(e) => setValue(e.target.value)}
|
|
234
|
+
onKeyDown={(e) => {
|
|
235
|
+
if (e.key === 'Enter') void send()
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
238
|
+
<button className="rv-askopt pick" disabled={busy || value.trim() === '' || (facts.login && account.trim() === '')} onMouseDown={keepFocus} onClick={() => void send()}>
|
|
239
|
+
store
|
|
240
|
+
</button>
|
|
241
|
+
</div>
|
|
242
|
+
) : null}
|
|
243
|
+
{facts && !refused ? <div className="rv-dim">one line; a key of several lines (a PEM file): <code>sk secret set {name} < file</code></div> : null}
|
|
244
|
+
{err ? <div className="err">✗ {err}</div> : null}
|
|
245
|
+
{decline ? (
|
|
246
|
+
<div className="rv-askwords">
|
|
247
|
+
<AnswerWords card={card} c={c} placeholder="why not (never the key itself)" />
|
|
248
|
+
<button className="rv-askopt" disabled={card.busy || (card.hints[c.id] ?? '').trim() === ''} onMouseDown={keepFocus} onClick={() => void card.noneOf(c)}>send my words</button>
|
|
249
|
+
</div>
|
|
250
|
+
) : (
|
|
251
|
+
<button className="ghost rv-keydecline" onClick={() => setDecline(true)}>I will not give it</button>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
)
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
/** one line of markdown as a checklist line holds it: bold, `code` and [links](url), nothing else */
|
|
258
|
+
function InlineMd({ text }: { text: string }) {
|
|
259
|
+
const out: ReactNode[] = []
|
|
260
|
+
const re = /\*\*\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)\*\*|\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|\*\*([^*]+)\*\*|`([^`]+)`/g
|
|
261
|
+
let at = 0
|
|
262
|
+
for (let m = re.exec(text); m !== null; m = re.exec(text)) {
|
|
263
|
+
if (m.index > at) out.push(text.slice(at, m.index))
|
|
264
|
+
const k = out.length
|
|
265
|
+
if (m[1] !== undefined) out.push(<b key={k}><a href={m[2]} target="_blank" rel="noreferrer noopener">{m[1]}</a></b>)
|
|
266
|
+
else if (m[3] !== undefined) out.push(<a key={k} href={m[4]} target="_blank" rel="noreferrer noopener">{m[3]}</a>)
|
|
267
|
+
else if (m[5] !== undefined) out.push(<b key={k}>{m[5]}</b>)
|
|
268
|
+
else out.push(<code key={k}>{m[6]}</code>)
|
|
269
|
+
at = m.index + m[0].length
|
|
270
|
+
}
|
|
271
|
+
if (at < text.length) out.push(text.slice(at))
|
|
272
|
+
return <>{out}</>
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
type DiffProps = { rv: ReviewSt; card: ThreadSt; c: ReplyCell; f: Field; after: string }
|
|
276
|
+
|
|
277
|
+
/** each diff view a house kind names (review/kinds.ts): a new kind names one of these, or brings its own page */
|
|
278
|
+
const DIFF_VIEWS: Record<ValueKind['diff'], (p: DiffProps) => ReactNode> = {
|
|
279
|
+
words: ({ f, after }) => <WordDiff {...(f.before !== undefined ? { before: f.before } : {})} after={after} />,
|
|
280
|
+
swatches: ({ f, after }) => <Swatches {...(f.before !== undefined ? { before: f.before } : {})} after={after} />,
|
|
281
|
+
hunk: ({ f, after }) => <CodeHunk {...(f.before !== undefined ? { before: f.before } : {})} after={after} {...(f.lang ? { lang: f.lang } : {})} />,
|
|
282
|
+
media: ({ rv, card, c, f }) => (f.view !== undefined ? <MessageView rv={rv} card={card} c={c} i={f.view} /> : <div className="rv-dim">the files are gone from the store</div>),
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** one field's change, drawn by the diff view of its kind */
|
|
286
|
+
const FieldDiff = observer(({ rv, card, c, f }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; f: Field }) => DIFF_VIEWS[kindOfValue(f.type).diff]({ rv, card, c, f, after: f.applied?.text ?? f.after }))
|
|
287
|
+
|
|
288
|
+
/** the owner's edit of one field's value before he applies it, as its kind edits: a colour's picker and value, a box for words
|
|
289
|
+
* or code (behind « edit », so a table he applies as it is stays short) */
|
|
290
|
+
const FieldEdit = observer(({ card, c, f }: { card: ThreadSt; c: ReplyCell; f: Field }) => {
|
|
291
|
+
const box = card.fieldBox(c, f.key)
|
|
292
|
+
const value = card.hints[box] ?? ''
|
|
293
|
+
const edit = kindOfValue(f.type).edit
|
|
294
|
+
if (edit === null) return null
|
|
295
|
+
if (edit === 'color')
|
|
296
|
+
return (
|
|
297
|
+
<span className="rv-coloredit">
|
|
298
|
+
<input type="color" value={/^#[0-9a-f]{6}$/i.test(value || f.after) ? value || f.after : '#000000'} onChange={(e) => card.setHint(box, e.target.value)} title="pick another colour before you apply" />
|
|
299
|
+
<input type="text" value={value} placeholder={f.after} onChange={(e) => card.setHint(box, e.target.value)} />
|
|
300
|
+
</span>
|
|
301
|
+
)
|
|
302
|
+
if (card.hints[box] === undefined)
|
|
303
|
+
return (
|
|
304
|
+
<button className="ghost rv-fieldeditbtn" onMouseDown={keepFocus} onClick={() => card.setHint(box, f.after)} title="change the value before you apply it">
|
|
305
|
+
edit
|
|
306
|
+
</button>
|
|
307
|
+
)
|
|
308
|
+
return <AutoText className={`rv-answerwords${edit === 'code' ? ' code' : ''}`} autoFocus value={value} onText={(t) => card.setHint(box, t)} />
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
const ApplyButton = observer(({ card, c, f }: { card: ThreadSt; c: ReplyCell; f: Field }) => {
|
|
312
|
+
if (f.applied) return <span className="rv-badge" title={f.applied.text}>✓ applied</span>
|
|
313
|
+
const edited = (card.hints[card.fieldBox(c, f.key)] ?? '').trim() !== '' && card.hints[card.fieldBox(c, f.key)] !== f.after
|
|
314
|
+
return (
|
|
315
|
+
<button className="rv-askopt pick" disabled={card.busy} onMouseDown={keepFocus} onClick={() => void card.answer(c, { apply: true, field: f.key })}>
|
|
316
|
+
{edited ? 'apply my edit' : 'apply'}
|
|
317
|
+
</button>
|
|
318
|
+
)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
/** an agent's proposed change: one field drawn alone, several as a table of rows; each row its own « apply », « apply all »
|
|
322
|
+
* under it; a kind with its own diff page frames it above */
|
|
323
|
+
export const ProposeBody = observer(({ rv, card, c, p }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell; p: NonNullable<ReplyCell['propose']> }) => {
|
|
324
|
+
const left = p.fields.filter((f) => !f.applied)
|
|
325
|
+
const one = p.fields.length === 1 ? p.fields[0]! : null
|
|
326
|
+
return (
|
|
327
|
+
<div className="rv-propose">
|
|
328
|
+
<div className="rv-dim">on {p.on}</div>
|
|
329
|
+
{p.page ? <DiffPage rv={rv} c={c} page={p.page} on={p.on} /> : null}
|
|
330
|
+
{one ? (
|
|
331
|
+
<>
|
|
332
|
+
<FieldDiff rv={rv} card={card} c={c} f={one} />
|
|
333
|
+
{p.open && !one.applied ? <FieldEdit card={card} c={c} f={one} /> : null}
|
|
334
|
+
<div className="rv-askopts">{p.open || one.applied ? <ApplyButton card={card} c={c} f={one} /> : <span className="rv-badge">answered with words</span>}</div>
|
|
335
|
+
</>
|
|
336
|
+
) : (
|
|
337
|
+
<div className="rv-fieldtable">
|
|
338
|
+
{p.fields.map((f) => (
|
|
339
|
+
<div key={f.key} className={`rv-fieldrow${f.applied ? ' applied' : ''}`}>
|
|
340
|
+
<div className="rv-fieldkey">{f.key}<span className="rv-dim"> {f.type === 'code' && f.lang ? f.lang : kindOfValue(f.type).label}</span></div>
|
|
341
|
+
<div className="rv-fieldval">
|
|
342
|
+
<FieldDiff rv={rv} card={card} c={c} f={f} />
|
|
343
|
+
{p.open && !f.applied ? <FieldEdit card={card} c={c} f={f} /> : null}
|
|
344
|
+
</div>
|
|
345
|
+
<div className="rv-fieldgo">{p.open || f.applied ? <ApplyButton card={card} c={c} f={f} /> : null}</div>
|
|
346
|
+
</div>
|
|
347
|
+
))}
|
|
348
|
+
</div>
|
|
349
|
+
)}
|
|
350
|
+
{p.open && !c.superseded ? <AnswerWords card={card} c={c} placeholder="a word with it (optional); words alone, sent with « send my words », answer it without applying" /> : null}
|
|
351
|
+
{p.open ? (
|
|
352
|
+
<div className="rv-askopts">
|
|
353
|
+
{!one && left.length > 1 ? (
|
|
354
|
+
<button className="rv-askopt pick" disabled={card.busy} onMouseDown={keepFocus} onClick={() => void card.applyAll(c, left.map((f) => f.key))}>apply all {left.length}</button>
|
|
355
|
+
) : null}
|
|
356
|
+
{(card.hints[c.id] ?? '').trim() !== '' ? (
|
|
357
|
+
<button className="rv-askopt" disabled={card.busy} onMouseDown={keepFocus} onClick={() => void card.noneOf(c)}>send my words</button>
|
|
358
|
+
) : null}
|
|
359
|
+
</div>
|
|
360
|
+
) : null}
|
|
361
|
+
</div>
|
|
362
|
+
)
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
/** the repo's own page that draws this change, framed with its keys: the thread, the message, the object; it reads the
|
|
366
|
+
* fields from the hub's api, and its keys stay in its own frame */
|
|
367
|
+
const DiffPage = ({ rv, c, page, on }: { rv: ReviewSt; c: ReplyCell; page: string; on: string }) => {
|
|
368
|
+
const ref = useRef<HTMLIFrameElement>(null)
|
|
369
|
+
const keys = `thread=${encodeURIComponent(c.on)}&re=${encodeURIComponent(c.id.slice(c.on.length + 1))}&on=${encodeURIComponent(on)}`
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
const onMessage = (e: MessageEvent): void => {
|
|
372
|
+
if (e.source !== ref.current?.contentWindow || e.origin !== location.origin) return
|
|
373
|
+
const m = (e.data ?? {}) as { shipkit?: unknown }
|
|
374
|
+
if (m.shipkit === 'ready') ref.current?.contentWindow?.postMessage({ shipkit: 'hello', keys, theme: document.documentElement.dataset.theme === 'light' ? 'light' : 'dark', identity: null, on: true }, location.origin)
|
|
375
|
+
}
|
|
376
|
+
window.addEventListener('message', onMessage)
|
|
377
|
+
return () => window.removeEventListener('message', onMessage)
|
|
378
|
+
}, [keys])
|
|
379
|
+
return <iframe ref={ref} className="rv-diffpage" title={`${page}: the change`} src={`${rv.url(`/page/${page}/`)}?${keys}`} />
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** the words that go with an answer: the hint box of the cell, kept per cell until sent */
|
|
383
|
+
export const AnswerWords = observer(({ card, c, placeholder }: { card: ThreadSt; c: ReplyCell; placeholder: string }) => (
|
|
384
|
+
<AutoText className="rv-answerwords" placeholder={placeholder} value={card.hints[c.id] ?? ''} onText={(t) => card.setHint(c.id, t)} />
|
|
385
|
+
))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// the dispatcher's board (wiki tools/shipkit/
|
|
1
|
+
// the dispatcher's board (wiki tools/shipkit/threads.md, Raised items): what the owner, a player or a rule raised, by state,
|
|
2
2
|
// each with its topic and its worker, a stale claim marked (`GET /api/review/board`); who holds the dispatcher role. A row
|
|
3
3
|
// opens its item
|
|
4
4
|
import { observer } from 'mobx-react-lite'
|
|
@@ -20,7 +20,7 @@ export const ReviewBoard = observer(({ rv }: { rv: ReviewSt }) => {
|
|
|
20
20
|
const open = rv.card?.data?.members ?? []
|
|
21
21
|
return (
|
|
22
22
|
<div className="rv-listscroll rv-board">
|
|
23
|
-
<div className="rv-count">{role ? `dispatcher: ${role.name}, since ${role.since.slice(0, 16).replace('T', ' ')}` : 'dispatcher: nobody (sk
|
|
23
|
+
<div className="rv-count">{role ? `dispatcher: ${role.name}, since ${role.since.slice(0, 16).replace('T', ' ')}` : 'dispatcher: nobody (sk thread dispatcher --as <name>)'}</div>
|
|
24
24
|
{rows === null ? <div className="rv-empty"><span className="spin" /> reading the board…</div> : null}
|
|
25
25
|
{STATES.map(({ state, label }) => {
|
|
26
26
|
const of = (rows ?? []).filter((r) => r.state === state)
|