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/format.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
// what `sk
|
|
1
|
+
// what `sk thread inbox`, `show`, `watch`, `next` and `board` print of an item and its answer (wiki tools/shipkit/threads.md):
|
|
2
2
|
// one record per thread, rectangles normalized and in pixels, a frame note's cut, shot and time into it, and the lines the
|
|
3
3
|
// repo's unit adds (a kind's facts, a source's), handed in as `more` so this module stays pure
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { kindOfValue } from './kinds.ts'
|
|
5
|
+
import { askOpen, askStateText, kindAnswerLine, kindOfAsk, questionWords } from './answer-kinds.ts'
|
|
6
|
+
import { toAcknowledge, aboutText, appliedFields, ownAddressOf, partyOf, proposeFields, proposeOpen, isFrame, isOpening, isGallery, isPair, NO_SPEC, placeText, stateOf, takenBackOf, unreadBy, updateTag, verdictOf, type DraftCard, type Message, type Rect, type ReviewItem, type ReviewStatus, type Spec, type Subject } from './model.ts'
|
|
7
|
+
import { answererOf, conversationOf, membersOf, openingOf, ownAddressesOf, waits, type Thread } from './threads.ts'
|
|
8
|
+
import { itemTitle, replacersOf, titleOf } from './supersede.ts'
|
|
9
|
+
import { itemVerdictLine } from './verdict-items.ts'
|
|
6
10
|
|
|
7
11
|
/** what a message is in a thread beyond its words: ` [update 2 (still broken)]` on an agent's update, ` (on update 2
|
|
8
12
|
* (still broken))` on his hint about one */
|
|
@@ -28,9 +32,9 @@ const flat = (t: string): string => t.replace(/\s+/g, ' ').trim()
|
|
|
28
32
|
const atText = (t: number | undefined, shot?: Rect['shot']): string =>
|
|
29
33
|
(t === undefined ? '' : ` at ${t.toFixed(2)} s`) + (shot ? ` (shot ${shot.name} +${shot.time.toFixed(2)} s)` : '')
|
|
30
34
|
|
|
31
|
-
/** each reaction to one view or
|
|
35
|
+
/** each reaction to one view, tile or message of a draft: its place by label, its status, its comment */
|
|
32
36
|
const reactionTexts = (x: ReviewItem): string[] =>
|
|
33
|
-
(verdictOf(x)?.reactions ?? []).map((q) => `${placeText(q, x.item.views)}${q.picked ? ' picked' : ''}${q.status ? ` ${q.status}` : ''}${q.stars ? ` ★${q.stars}` : ''}${q.comment ? `: ${flat(q.comment)}` : ''}`)
|
|
37
|
+
(verdictOf(x)?.reactions ?? []).map((q) => `${placeText(q, x.item.views, x.item.draft)}${q.picked ? ' picked' : ''}${q.status ? ` ${q.status}` : ''}${q.stars ? ` ★${q.stars}` : ''}${q.comment ? `: ${flat(q.comment)}` : ''}`)
|
|
34
38
|
|
|
35
39
|
/** the view he picked on a choice card, `picked [voice 1]`; null when he picked none */
|
|
36
40
|
const pickText = (x: ReviewItem): string | null => {
|
|
@@ -54,8 +58,84 @@ export function line(x: ReviewItem): string {
|
|
|
54
58
|
export const refOf = (x: ReviewItem): string => (x.item.origin.by === 'player' ? `${x.item.origin.server}#${x.item.origin.serverId}` : x.item.id)
|
|
55
59
|
|
|
56
60
|
/** one owner reply, for a monitor; on an item a card answers, it reads on the card's thread */
|
|
61
|
+
/** his answer to a question or a proposed change, as an agent reads it: what was asked, what he picked or applied */
|
|
62
|
+
function answerLine(x: ReviewItem, m: Message): string | null {
|
|
63
|
+
const asked = m.answer && m.re ? x.thread.find((y) => y.id === m.re) : undefined
|
|
64
|
+
if (!asked || !m.answer) return null
|
|
65
|
+
const kinded = asked.ask ? kindAnswerLine(x.item.id, x.thread, asked, m, flat) : null
|
|
66
|
+
if (kinded !== null) return kinded
|
|
67
|
+
if (asked.ask && m.answer.option !== undefined) {
|
|
68
|
+
const label = asked.ask.options[m.answer.option] ?? `option ${m.answer.option + 1}`
|
|
69
|
+
const words = (m.text ?? '').startsWith(label) ? (m.text ?? '').slice(label.length).replace(/^:\s*/, '') : (m.text ?? '')
|
|
70
|
+
return `${x.item.id} answered "${flat(asked.text ?? '')}": picked ${m.answer.option + 1} « ${label} »${asked.ask.pick === m.answer.option ? ' (your pick)' : ''}${words ? `: ${flat(words)}` : ''}`
|
|
71
|
+
}
|
|
72
|
+
if (asked.propose && m.answer.apply) {
|
|
73
|
+
const fields = proposeFields(asked.propose)
|
|
74
|
+
const f = fields.find((y) => y.key === (m.answer?.field ?? '')) ?? fields[0]!
|
|
75
|
+
const value = m.answer.value ?? m.text ?? f.after
|
|
76
|
+
const words = m.text !== undefined && m.text !== value ? `, the owner's words: ${flat(m.text)}` : ''
|
|
77
|
+
if (fields.length === 1) return `${x.item.id} applied your change of ${asked.propose.on}: land this ${kindOfValue(f.type).file ? 'file' : 'value'}: ${flat(value)}${words}`
|
|
78
|
+
if (m.answer.field !== undefined) return `${x.item.id} applied ${m.answer.field} of ${asked.propose.on}: land ${flat(value)}${words}`
|
|
79
|
+
return `${x.item.id} applied every field of ${asked.propose.on}: land ${fields.map((y) => `${y.key} ${flat(y.after)}`).join(' · ')}`
|
|
80
|
+
}
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** the owner's words on a question with no option clicked: none of them, and why */
|
|
85
|
+
function noneLine(x: ReviewItem, m: Message): string | null {
|
|
86
|
+
const asked = m.answer === undefined && m.re && partyOf(m.who) === 'owner' ? x.thread.find((y) => y.id === m.re) : undefined
|
|
87
|
+
if (asked?.ask && kindOfAsk(asked) === 'checklist') return `${x.item.id} on your ${asked.instructions ? 'instructions' : 'checklist'} "${flat(questionWords(asked))}": ${flat(m.text ?? '')}`
|
|
88
|
+
if (asked?.ask) return `${x.item.id} answered "${flat(questionWords(asked))}": none: ${flat(m.text ?? '')}`
|
|
89
|
+
if (asked?.propose) return `${x.item.id} on your change of ${asked.propose.on}: ${flat(m.text ?? '')}`
|
|
90
|
+
return null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** an ask's state as its thread says it (its newest askState), null on an item that is no ask's */
|
|
94
|
+
function askLine(x: ReviewItem): string | null {
|
|
95
|
+
if (!x.item.on?.startsWith('ask:')) return null
|
|
96
|
+
const last = x.thread.filter((m) => m.askState !== undefined).at(-1)
|
|
97
|
+
const s = last?.askState
|
|
98
|
+
return ` ask ${s?.state ?? 'open'}${s?.why ? `: ${flat(s.why)}` : ''}${last ? ` (${last.at})` : ''}`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** each question and proposed change an agent put on the item, open or answered: its options and the agent's pick, its
|
|
102
|
+
* fields and which the owner applied; one a newer object superseded, or that its closed ask closed, says so */
|
|
103
|
+
function asksText(x: ReviewItem): string[] {
|
|
104
|
+
const out: string[] = []
|
|
105
|
+
const gone = replacersOf([x])
|
|
106
|
+
const ask = askLine(x)
|
|
107
|
+
const closed = ask !== null && !ask.startsWith(' ask open')
|
|
108
|
+
if (ask !== null) out.push(ask)
|
|
109
|
+
if (gone.has(x.item.id)) out.push(` its first instructions (« ${x.item.title} ») superseded by ${gone.get(x.item.id)!.id} « ${titleOf(gone.get(x.item.id)!)} »`)
|
|
110
|
+
const state = (m: Message, open: boolean): string => {
|
|
111
|
+
const by = gone.get(m.id)
|
|
112
|
+
return by ? (by.op === 'withdraw' ? `${titleOf(by)}, ${by.id}` : `superseded by ${by.id} « ${titleOf(by)} »`) : closed ? (open ? 'closed with the ask' : 'answered') : open ? 'open' : 'answered'
|
|
113
|
+
}
|
|
114
|
+
for (const m of x.thread) {
|
|
115
|
+
if (partyOf(m.who) !== 'agent') continue
|
|
116
|
+
if (m.instructions) out.push(` instructions ${m.at} (${gone.has(m.id) ? state(m, false) : 'current'}): « ${m.instructions.title} » ${m.id}${m.instructions.folds.length > 0 ? `, folds ${m.instructions.folds.join(' ')}` : ''}`)
|
|
117
|
+
if (m.ask && kindOfAsk(m) !== 'choice') out.push(` ${m.instructions ? 'its steps' : `question ${m.at}`} (${state(m, askOpen(x.thread, m))}): "${flat(questionWords(m))}" ${askStateText(x.thread, m)}`)
|
|
118
|
+
else if (m.ask) {
|
|
119
|
+
const answered = x.thread.some((y) => y.re === m.id && partyOf(y.who) === 'owner')
|
|
120
|
+
out.push(` question ${m.at} (${state(m, !answered)}): "${flat(m.text ?? '')}" ${m.ask.options.map((o, i) => `${i + 1} ${o}${m.ask!.views?.[i] != null ? ' [media]' : ''}${m.ask!.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
|
|
121
|
+
}
|
|
122
|
+
if (m.propose) {
|
|
123
|
+
const applied = appliedFields(x.thread, m)
|
|
124
|
+
out.push(` proposed change ${m.at} (${state(m, proposeOpen(x.thread, m))}) of ${m.propose.on}: ${proposeFields(m.propose).map((f) => `${f.key || 'the value'} ${applied.has(f.key) ? 'applied' : 'waits'}`).join(' · ')}`)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return out
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** the owner's click on one of the kind's actions: what the holder does next */
|
|
131
|
+
const actionLine = (x: ReviewItem, m: Message): string | null =>
|
|
132
|
+
m.action ? `${x.item.id} action ${m.action.name} "${x.item.title}"${m.text && m.text !== m.action.name ? `: ${flat(m.text)}` : ''}` : null
|
|
133
|
+
|
|
57
134
|
export const replyLine = (x: ReviewItem, m: Message, card: ReviewItem | null = null): string =>
|
|
58
|
-
|
|
135
|
+
actionLine(x, m) ??
|
|
136
|
+
answerLine(x, m) ??
|
|
137
|
+
noneLine(x, m) ??
|
|
138
|
+
`${(card ?? x).item.id} reply "${itemTitle(card ?? x)}"${card ? ` (on ${refOf(x)})` : ''}${updateText(x, m)}: ${flat(m.text ?? '')}${m.image ? ` [image thread/${m.image}]` : ''}`
|
|
59
139
|
|
|
60
140
|
const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-with-fix': '« ok with a fix »', rejected: 'rejection', archived: '« archived, later »' }
|
|
61
141
|
|
|
@@ -63,19 +143,35 @@ const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-wit
|
|
|
63
143
|
export const takeBackTexts = (x: ReviewItem): { m: Message; text: string }[] =>
|
|
64
144
|
takenBackOf(x).map(({ m, took, given }) => ({
|
|
65
145
|
m,
|
|
66
|
-
text: `he took his ${TOOK[took]} back (given ${given}): the
|
|
146
|
+
text: `he took his ${TOOK[took]} back (given ${given}): the version waits for the owner's answer again and that ${TOOK[took]} no longer holds; hold or undo what you did on it, then sk thread seen ${x.item.id}`,
|
|
67
147
|
}))
|
|
68
148
|
|
|
149
|
+
/** the end of a line of his new content: the agent says it read it, then what it does (wiki
|
|
150
|
+
* tools/shipkit/threads-how-it-fits.md, Read and on it) */
|
|
151
|
+
export const markIt = (ref: string, bin = 'sk'): string => ` · mark it: ${bin} thread seen ${ref}, then ${bin} thread working ${ref} "…"`
|
|
152
|
+
|
|
69
153
|
/** what watch prints of an item, each with the key it prints once under: a verdict he took back, an unseen feedback (again
|
|
70
154
|
* when sent again), each unseen reply */
|
|
71
155
|
export function watchLines(x: ReviewItem, items: readonly ReviewItem[] = []): { key: string; text: string }[] {
|
|
72
156
|
const out: { key: string; text: string }[] = takeBackTexts(x).map((t) => ({ key: `${x.item.id}#${t.m.id}`, text: `${x.item.id} taken back "${x.item.title}": ${t.text}` }))
|
|
73
157
|
const f = verdictOf(x)
|
|
74
|
-
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: line(x) })
|
|
158
|
+
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: `${line(x)}${markIt(x.item.id)}` })
|
|
75
159
|
const card = x.item.origin.by === 'agent' ? null : answererOf(x.item.id, items)
|
|
76
160
|
// the words that raised an item the card answers are what the card answers
|
|
77
161
|
const opening = card ? openingOf(x) : undefined
|
|
78
|
-
|
|
162
|
+
// the owner's verdict on a message that asked it reads as that verdict; every other word as a reply
|
|
163
|
+
for (const m of unreadBy(x, 'agent')) if (m !== opening) out.push({ key: `${x.item.id}#${m.id}`, text: `${(m.verdict !== undefined ? itemVerdictLine(x, m) : null) ?? replyLine(x, m, card)}${markIt(x.item.id)}` })
|
|
164
|
+
// his « set aside » and his close of an ask: heard, owed nothing, so never an unread word that holds a stop
|
|
165
|
+
const pending = new Set(toAcknowledge(x, 'agent'))
|
|
166
|
+
for (const m of x.thread) {
|
|
167
|
+
if (!pending.has(m.id) || partyOf(m.who) !== 'owner') continue
|
|
168
|
+
if (m.snooze) out.push({ key: `${x.item.id}#${m.id}`, text: m.snooze.until === null ? `${x.item.id} back "${x.item.title}": he brought it back` : `${x.item.id} set aside "${x.item.title}" until ${m.snooze.until}` })
|
|
169
|
+
if (m.askState) out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} ask ${m.askState.state} "${itemTitle(x)}"${m.askState.why ? `: ${flat(m.askState.why)}` : ''}` })
|
|
170
|
+
// the owner's close of the whole thread from the hub; a reopen of an agent's verdict prints above, as a take back
|
|
171
|
+
if (m.op === 'fixed' || m.op === 'done') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} closed as done by the owner "${x.item.title}"${m.note ? `: ${flat(m.note)}` : ''}` })
|
|
172
|
+
if (m.op === 'wontfix') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} closed by the owner, not doing it "${x.item.title}"${m.note ? `: ${flat(m.note)}` : ''}` })
|
|
173
|
+
if (m.op === 'reopen' && x.item.origin.by !== 'agent') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} reopened by the owner "${x.item.title}": it waits on its holder again` })
|
|
174
|
+
}
|
|
79
175
|
return out
|
|
80
176
|
}
|
|
81
177
|
|
|
@@ -84,18 +180,19 @@ export function watchLines(x: ReviewItem, items: readonly ReviewItem[] = []): {
|
|
|
84
180
|
export function raisedLine(x: ReviewItem): { key: string; text: string } | null {
|
|
85
181
|
const o = x.item.origin
|
|
86
182
|
if (o.by !== 'auto' || stateOf(x, false).state !== 'open') return null
|
|
87
|
-
return { key: `raised ${x.item.id}`, text: `${x.item.id} raised "${x.item.title}" (auto rule ${o.rule}, key ${o.key}) to ${o.lane}: take it: sk
|
|
183
|
+
return { key: `raised ${x.item.id}`, text: `${x.item.id} raised "${x.item.title}" (auto rule ${o.rule}, key ${o.key}) to ${o.lane}: take it: sk thread next --lane ${o.lane}` }
|
|
88
184
|
}
|
|
89
185
|
|
|
90
186
|
/** an item nobody takes, for a watch and the inbox */
|
|
91
187
|
export const untakenLine = (x: ReviewItem, why: string, lane: string | null): string =>
|
|
92
|
-
`${x.item.id} untaken "${x.item.title}" (${why}): ask the other sessions (ListAgents, then SendMessage) whether one of them wants it; if none answers, claim it: sk
|
|
188
|
+
`${x.item.id} untaken "${x.item.title}" (${why}): ask the other sessions (ListAgents, then SendMessage) whether one of them wants it; if none answers, claim it: sk thread claim ${x.item.id} --as ${lane ?? '<your lane>'}`
|
|
93
189
|
|
|
94
190
|
/** one thread as one record: each item the card answers, then the card, its older versions, and with `full` the whole conversation */
|
|
95
191
|
export function threadDetail(t: Thread, dir: string, full = false, say: Say = PLAIN): string {
|
|
96
192
|
if (t.answers.length === 0 && t.versions.length === 1 && !full) return detail(t.head, dir, false, false, say)
|
|
97
193
|
const out: string[] = []
|
|
98
|
-
|
|
194
|
+
// a note joined by its address alone keeps its own state: no version answered it
|
|
195
|
+
for (const r of t.answers) out.push(`${t.joined.has(r.item.id) ? 'his note' : 'answers'} ${refOf(r)}:`, detail(r, dir, false, !t.joined.has(r.item.id), say), '')
|
|
99
196
|
out.push(detail(t.head, dir, full, false, say))
|
|
100
197
|
const older = t.versions.slice(1)
|
|
101
198
|
if (older.length > 0) out.push(` versions: ${older.map((x) => x.item.id).join(' ')}`)
|
|
@@ -111,6 +208,32 @@ export function threadDetail(t: Thread, dir: string, full = false, say: Say = PL
|
|
|
111
208
|
return out.join('\n')
|
|
112
209
|
}
|
|
113
210
|
|
|
211
|
+
/** a thread as the inbox reads it out: each item of it that holds something for the agent (his answer, his note), by
|
|
212
|
+
* its own id and state, so his answer on an older version names that version; then the newest version, when it is none
|
|
213
|
+
* of them, as what it is: sent after his answer, waiting for him, never his answer */
|
|
214
|
+
export function newsDetail(t: Thread, news: readonly ReviewItem[], dir: string, say: Say = PLAIN): string {
|
|
215
|
+
const ids = new Set(news.map((x) => x.item.id))
|
|
216
|
+
const own = ownAddressesOf(t, say.spec)[0]
|
|
217
|
+
const nOf = (x: ReviewItem): string => {
|
|
218
|
+
const i = t.versions.indexOf(x)
|
|
219
|
+
return i < 0 || t.versions.length < 2 ? '' : `v${t.versions.length - i} `
|
|
220
|
+
}
|
|
221
|
+
const out: string[] = [`thread ${own ?? t.head.item.id}:`]
|
|
222
|
+
for (const x of membersOf(t).filter((y) => ids.has(y.item.id)).sort((a, b) => a.item.created.localeCompare(b.item.created))) {
|
|
223
|
+
const raised = x.item.origin.by !== 'agent'
|
|
224
|
+
if (raised) out.push(`${t.joined.has(x.item.id) ? 'his note' : 'answers'} ${refOf(x)}:`)
|
|
225
|
+
else if (nOf(x) !== '') out.push(`his answer on ${nOf(x)}of ${t.versions.length}:`)
|
|
226
|
+
out.push(detail(x, dir, false, raised && !t.joined.has(x.item.id), say))
|
|
227
|
+
}
|
|
228
|
+
if (!ids.has(t.head.item.id) && t.head.item.origin.by === 'agent') {
|
|
229
|
+
const h = t.head
|
|
230
|
+
const v = verdictOf(h)
|
|
231
|
+
const where = waits(h) ? 'sent after his answer, waits for a verdict: nothing to act on' : v ? `verdict ${v.status}${v.seen ? ', seen' : ''}` : stateOf(h, false).state
|
|
232
|
+
out.push(` newest: ${nOf(h)}${h.item.id} "${itemTitle(h)}", ${where}`)
|
|
233
|
+
}
|
|
234
|
+
return out.join('\n')
|
|
235
|
+
}
|
|
236
|
+
|
|
114
237
|
/** `m:ss.cc` */
|
|
115
238
|
const clock = (t: number): string => `${Math.floor(t / 60)}:${(t % 60).toFixed(2).padStart(5, '0')}`
|
|
116
239
|
|
|
@@ -120,6 +243,9 @@ function subjectText(s: Subject): string | null {
|
|
|
120
243
|
return null
|
|
121
244
|
}
|
|
122
245
|
|
|
246
|
+
/** a draft card's draft: its file, and each message the card pinned by name, the names his answers come back under */
|
|
247
|
+
const draftText = (d: DraftCard): string => ` posts: draft:${d.slug}, ${d.posts.length} place${d.posts.length > 1 ? 's' : ''}: ${d.posts.map((p) => p.name).join(', ')}`
|
|
248
|
+
|
|
123
249
|
const boxText = (b: { x0: number; y0: number; x1: number; y1: number }): string => `${b.x0},${b.y0}..${b.x1},${b.y1}`
|
|
124
250
|
|
|
125
251
|
/** a rectangle's world box and the nodes under its middle, when the tool that drew it knew them */
|
|
@@ -140,10 +266,15 @@ const raisedBy = (o: ReviewItem['item']['origin']): string =>
|
|
|
140
266
|
export function detail(x: ReviewItem, dir: string, full = false, followed = false, say: Say = PLAIN): string {
|
|
141
267
|
const f = verdictOf(x)
|
|
142
268
|
const r = x.item
|
|
143
|
-
const
|
|
269
|
+
const own = ownAddressOf(r, say.spec)
|
|
270
|
+
const head = ` "${itemTitle(x)}" (${aboutText(r, say.spec)})${own !== null ? `\n address: ${own}` : ''}`
|
|
144
271
|
const frame = subjectText(r.subject)
|
|
145
|
-
const sub = [...(frame ? [frame] : []), ...say.more(x)]
|
|
146
|
-
const replies = unreadBy(x, 'agent').map((m) =>
|
|
272
|
+
const sub = [...(frame ? [frame] : []), ...(r.draft ? [draftText(r.draft)] : []), ...say.more(x)]
|
|
273
|
+
const replies = unreadBy(x, 'agent').map((m) => {
|
|
274
|
+
const answer = answerLine(x, m) ?? noneLine(x, m)
|
|
275
|
+
return answer ? ` ${answer.slice(r.id.length + 1)} (${m.at})` : ` reply ${m.at}${updateText(x, m)}: ${m.text}${m.image ? ` [image ${dir}/${r.id}/thread/${m.image}]` : ''}`
|
|
276
|
+
})
|
|
277
|
+
const asked = asksText(x)
|
|
147
278
|
if (r.origin.by !== 'agent') {
|
|
148
279
|
const st = stateOf(x, followed)
|
|
149
280
|
const said = x.thread.filter((m) => m.who === 'owner' || m.who === 'player')
|
|
@@ -155,6 +286,7 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
|
|
|
155
286
|
`${r.id} ${st.state.toUpperCase()}${st.why ? ` (${st.why})` : ''} raised by ${raisedBy(r.origin)} ${r.created}${r.commit ? ` at ${r.commit}` : ''}`,
|
|
156
287
|
head,
|
|
157
288
|
...sub,
|
|
289
|
+
...asked,
|
|
158
290
|
...(r.what ? r.what.split('\n').map((l) => ` ${l}`) : []),
|
|
159
291
|
...(st.topic ? [` topic ${st.topic}${st.worker ? `, claimed by ${st.worker}` : ''}${r.origin.by === 'owner' && r.origin.kind ? `, ${r.origin.kind}` : ''}`] : []),
|
|
160
292
|
...words.map((m) => ` ${m.who} ${m.at}${m.op ? ` ${m.op}${m.topic ? ` ${m.topic}` : ''}` : ''}: ${m.text ?? m.note ?? ''}${m.fix ? ` (${m.fix.commit})` : ''}`),
|
|
@@ -163,10 +295,10 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
|
|
|
163
295
|
].join('\n')
|
|
164
296
|
}
|
|
165
297
|
const back = takeBackTexts(x).map((t) => ` taken back ${t.m.at}: ${t.text}`)
|
|
166
|
-
if (!f) return [`${r.id} ${back.length > 0 ? 'TAKEN BACK, NO VERDICT NOW' : 'NO VERDICT YET'}`, head, ...sub, ...back, ...replies].join('\n')
|
|
298
|
+
if (!f) return [`${r.id} ${back.length > 0 ? 'TAKEN BACK, NO VERDICT NOW' : isOpening(r) ? 'OPENED WITH WORDS, NO VERDICT ASKED' : 'NO VERDICT YET'}`, head, ...sub, ...asked, ...back, ...replies].join('\n')
|
|
167
299
|
const pick = pickText(x)
|
|
168
|
-
const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
|
|
169
|
-
for (const t of reactionTexts(x)) out.push(` view ${t}`)
|
|
300
|
+
const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...asked, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
|
|
301
|
+
for (const t of reactionTexts(x)) out.push(` ${r.draft ? 'place' : 'view'} ${t}`)
|
|
170
302
|
const px = (v: number, of: number): number => Math.round(v * of)
|
|
171
303
|
const views = r.views
|
|
172
304
|
f.rects.forEach((q, i) => {
|
|
@@ -181,6 +313,7 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
|
|
|
181
313
|
out.push(` #${i + 1}${on}${side} ${norm} (${pix})${atText(q.t, q.shot)}: ${q.comment || '(no comment)'}`)
|
|
182
314
|
})
|
|
183
315
|
const files = views.flatMap((v) => (isGallery(v) ? v.gallery.map((t) => t.file) : Object.values(v.files)))
|
|
184
|
-
out.push(` files: ${files.map((n) => `${dir}/${r.id}/${n}`).join(' ')}
|
|
316
|
+
if (files.length > 0) out.push(` files: ${files.map((n) => `${dir}/${r.id}/${n}`).join(' ')}`)
|
|
317
|
+
out.push(...replies)
|
|
185
318
|
return out.join('\n')
|
|
186
319
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// the icons of a thread (wiki tools/shipkit/threads-how-it-fits.md, Kinds): a kind's `icon` and a message type's are SVG
|
|
2
|
+
// path data on the hub's 20 unit grid, stroked in the text colour at one weight by the hub's one renderer (hub-app
|
|
3
|
+
// icons.tsx Icon), the contract a project page's `icon` already follows. Path data, never markup: the hub draws a
|
|
4
|
+
// repo's declaration without running or injecting it
|
|
5
|
+
|
|
6
|
+
/** path data the hub can draw: move first, path commands and numbers only */
|
|
7
|
+
export const isGlyph = (s: string | undefined): s is string => s !== undefined && s.length <= 2000 && /^\s*[Mm][\d\s.,eMmLlHhVvCcSsQqTtAaZz+-]*$/.test(s)
|
|
8
|
+
|
|
9
|
+
/** what a kind with no icon draws: a plain square with a dot, so a missing icon reads as missing */
|
|
10
|
+
export const DEFAULT_GLYPH = 'M4 4h12v12H4zM10 10h.01'
|
|
11
|
+
|
|
12
|
+
/** a kind's icon as the hub draws it: its own when it is path data, else the neutral default (an emoji too) */
|
|
13
|
+
export const glyphOf = (kind: { icon?: string } | undefined): string => (isGlyph(kind?.icon) ? kind.icon : DEFAULT_GLYPH)
|
|
14
|
+
|
|
15
|
+
/** the colours a kind's icon takes: a hue each, 15 degrees apart; each theme sets one muted saturation and lightness
|
|
16
|
+
* for all of them (hub.css --kind-s, --kind-l), so every hue reads in every theme and none shouts. The colour lives on
|
|
17
|
+
* the icon only, never as a filled pill or a row's background */
|
|
18
|
+
export const KIND_HUES = {
|
|
19
|
+
red: 0, vermilion: 15, orange: 30, amber: 45, yellow: 60, chartreuse: 75, lime: 90, leaf: 105,
|
|
20
|
+
green: 120, emerald: 135, jade: 150, teal: 165, cyan: 180, sky: 195, azure: 210, blue: 225,
|
|
21
|
+
cobalt: 240, indigo: 255, violet: 270, purple: 285, plum: 300, magenta: 315, pink: 330, rose: 345,
|
|
22
|
+
} as const
|
|
23
|
+
|
|
24
|
+
export type KindColor = keyof typeof KIND_HUES
|
|
25
|
+
export const KIND_COLORS = Object.keys(KIND_HUES) as KindColor[]
|
|
26
|
+
export const isKindColor = (c: unknown): c is KindColor => typeof c === 'string' && c in KIND_HUES
|
|
27
|
+
|
|
28
|
+
/** a kind's hue, or null: a kind with no colour draws its icon in the muted text colour */
|
|
29
|
+
export const hueOf = (kind: { color?: string } | undefined): number | null => (isKindColor(kind?.color) ? KIND_HUES[kind.color] : null)
|
|
30
|
+
|
|
31
|
+
/** the hue as one fixed colour, for a file that knows no theme (the objects page's icons): mid tone, read on a light
|
|
32
|
+
* ground and a dark one */
|
|
33
|
+
export function hueHex(h: number, s = 0.5, l = 0.52): string {
|
|
34
|
+
const k = (n: number): number => (n + h / 30) % 12
|
|
35
|
+
const a = s * Math.min(l, 1 - l)
|
|
36
|
+
const f = (n: number): number => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))
|
|
37
|
+
return `#${[f(0), f(8), f(4)].map((x) => Math.round(x * 255).toString(16).padStart(2, '0')).join('')}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** an icon as a standalone SVG file, stroked in one colour */
|
|
41
|
+
export const glyphSvg = (d: string, color: string): string =>
|
|
42
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>\n`
|
|
43
|
+
|
|
44
|
+
/** the types of message a thread holds, each one icon at its head */
|
|
45
|
+
export const MESSAGE_TYPES = {
|
|
46
|
+
version: { label: 'version', shows: "what an agent made, as the owner sees it: pictures, a before and after, a clip, a sound, two states; the owner's verdict", icon: 'M10 3 17 6.5 10 10 3 6.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5' },
|
|
47
|
+
verdict: { label: 'verdict', shows: "the owner's answer to a version: OK, fix or no, the owner's notes and rectangles", icon: 'M10 3.5v13M6 16.5h8M4 6h12M4 6l-2 5h4zM16 6l-2 5h4z' },
|
|
48
|
+
message: { label: 'message', shows: "words of an agent or of the owner", icon: 'M3 4h14v9H8l-4 3.5V13H3z' },
|
|
49
|
+
question: { label: 'question', shows: "a question the owner answers with a click or a word: a choice, a confirm, a text, a url, a file", icon: 'M3 4h14v9H8l-4 3.5V13H3zM8.3 7.2a1.8 1.8 0 1 1 2.5 1.6c-.5.3-.8.6-.8 1.1M10 11.3h.01' },
|
|
50
|
+
checklist: { label: 'checklist', shows: "steps the owner ticks one by one", icon: 'M3.5 5l1.5 1.5L7.5 4M10 5.5h6.5M3.5 10.5 5 12l2.5-2.5M10 11h6.5M3.5 16h4M10 16h6.5' },
|
|
51
|
+
secret: { label: 'secret field', shows: "a field the owner types a secret into: it goes to the vault, never shown again", icon: 'M7 7a3 3 0 1 0 0 6a3 3 0 1 0 0-6M10 10h7.5M15 10v2.5M17.5 10v2' },
|
|
52
|
+
change: { label: 'proposed change', shows: "a proposed change, field by field (words, a colour, code, a file): the owner applies or edits it", icon: 'M4.5 3h11v14h-11zM7.5 7.5h5M10 5v5M7.5 13.5h5' },
|
|
53
|
+
instructions: { label: 'instructions', shows: "an ask's steps for an act only the owner can do", icon: 'M5 2.5h10v15H5zM7.5 6h5M7.5 9h5M7.5 12h2.5' },
|
|
54
|
+
answer: { label: 'answer', shows: "the owner's answer to a question", icon: 'M3 4h14v9H8l-4 3.5V13H3zM7 8.5l2 2 4-4' },
|
|
55
|
+
update: { label: 'update', shows: "an agent's line on where the work stands: broken, better, fixed", icon: 'M2 10h3.5l2-5 5 10 2-5H18' },
|
|
56
|
+
hint: { label: 'hint', shows: "the owner's few words on an update", icon: 'M4 16l.75-3L13 4.75l2.25 2.25L7 15.25zM11.5 6.25l2.25 2.25' },
|
|
57
|
+
note: { label: 'note', shows: "what the owner or a player raised, with its rectangles", icon: 'M4 3.5h12V12l-4.5 4.5H4zM11.5 16.5V12H16' },
|
|
58
|
+
action: { label: 'action', shows: "the owner's click on an object's action (accept, rework, discard)", icon: 'M5 3l10 6-4.5 1.5L8.5 15z' },
|
|
59
|
+
link: { label: 'link', shows: "an object an agent linked into the thread: a card that opens it whole", icon: 'M8.5 11.5a3.5 3.5 0 0 0 5 0l2.5-2.5a3.5 3.5 0 0 0-5-5l-1 1M11.5 8.5a3.5 3.5 0 0 0-5 0L4 11a3.5 3.5 0 0 0 5 5l1-1' },
|
|
60
|
+
trace: { label: 'trace', shows: "a muted line: who did what, when", icon: 'M3.5 10a6.5 6.5 0 1 0 1.9-4.6M3 3.5v3h3M10 6.5V10l2.5 1.5' },
|
|
61
|
+
} as const satisfies Record<string, { label: string; shows: string; icon: string }>
|
|
62
|
+
|
|
63
|
+
export type MessageType = keyof typeof MESSAGE_TYPES
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// the cards a store set aside (`.shipkit/review/.gone/<id>`, the rows of `review_gone` with the switch cards-in-db): a
|
|
2
|
+
// card deleted while its machine carries cards to the hq, or one another machine deleted. Kept 30 days, then removed by the repo's retention sweep, whatever the switch. A
|
|
3
|
+
// second card of one id set aside keeps the first: `<id>.2`, `<id>.3`. No heavy import: the retention reads it
|
|
4
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, rmSync, statSync } from 'node:fs'
|
|
5
|
+
import { join } from 'node:path'
|
|
6
|
+
import { cardsInDb } from '../hq/switch.ts'
|
|
7
|
+
import { GONE } from './card-db.ts'
|
|
8
|
+
import { rowsGone, rowsGoneCreated, rowsGoneUse, rowsSweepGone } from './card-rows.ts'
|
|
9
|
+
import { ID_RE } from './model.ts'
|
|
10
|
+
|
|
11
|
+
export { GONE }
|
|
12
|
+
/** how long a card set aside stays before it goes for good */
|
|
13
|
+
export const GONE_KEEP_MS = 30 * 24 * 3600_000
|
|
14
|
+
|
|
15
|
+
const ENTRY_RE = /^(.+?)(?:\.(\d+))?$/
|
|
16
|
+
|
|
17
|
+
/** `.gone` as a real folder, never a link or a file: the sweep removes what is in it, and the job sends a deletion
|
|
18
|
+
* of each card it holds. True when it is one, false when there is none; throws when something else holds its name */
|
|
19
|
+
export function goneDir(dir: string): boolean {
|
|
20
|
+
const s = lstatSync(join(dir, GONE), { throwIfNoEntry: false })
|
|
21
|
+
if (s == null) return false
|
|
22
|
+
// a file in the way, as the disk says it: a card the hq deleted waits until the folder is one again
|
|
23
|
+
if (!s.isDirectory()) throw Object.assign(new Error(`${join(dir, GONE)} is not a folder (${s.isSymbolicLink() ? 'a link' : 'a file'}): no item is set aside, swept or sent through it`), { code: 'ENOTDIR' })
|
|
24
|
+
return true
|
|
25
|
+
}
|
|
26
|
+
const realGone = (dir: string): boolean => {
|
|
27
|
+
try {
|
|
28
|
+
return goneDir(dir)
|
|
29
|
+
} catch {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** the cards set aside in a store: each one's id and its folder's name there */
|
|
35
|
+
export const goneEntries = (dir: string): { id: string; entry: string }[] => (cardsInDb() ? rowsGone(dir) : goneFolders(dir))
|
|
36
|
+
|
|
37
|
+
/** the cards set aside in a store's files */
|
|
38
|
+
export function goneFolders(dir: string): { id: string; entry: string }[] {
|
|
39
|
+
const g = join(dir, GONE)
|
|
40
|
+
if (!realGone(dir)) return []
|
|
41
|
+
return readdirSync(g)
|
|
42
|
+
.flatMap((entry) => {
|
|
43
|
+
const id = ENTRY_RE.exec(entry)?.[1] ?? ''
|
|
44
|
+
return ID_RE.test(id) ? [{ id, entry }] : []
|
|
45
|
+
})
|
|
46
|
+
.sort((a, b) => (a.entry < b.entry ? -1 : 1))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** a free name in `.gone` for that id: the id, else the id and the next number */
|
|
50
|
+
export function goneEntryFor(dir: string, id: string): string {
|
|
51
|
+
goneDir(dir)
|
|
52
|
+
if (!existsSync(join(dir, GONE, id))) return id
|
|
53
|
+
for (let n = 2; ; n++) if (!existsSync(join(dir, GONE, `${id}.${n}`))) return `${id}.${n}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** how many cards are set aside, and since when the oldest: the folder's change time is the moment it was moved */
|
|
57
|
+
export function goneUse(dir: string): { count: number; oldest: number | null } {
|
|
58
|
+
let oldest: number | null = null
|
|
59
|
+
const all = goneFolders(dir)
|
|
60
|
+
for (const e of all) {
|
|
61
|
+
const s = statSync(join(dir, GONE, e.entry), { throwIfNoEntry: false })
|
|
62
|
+
if (s) oldest = oldest == null ? s.ctimeMs : Math.min(oldest, s.ctimeMs)
|
|
63
|
+
}
|
|
64
|
+
if (!cardsInDb()) return { count: all.length, oldest }
|
|
65
|
+
// the rows, and the folders the files set aside before the move: an entry the move copied is counted once
|
|
66
|
+
const r = rowsGoneUse(dir)
|
|
67
|
+
const rows = new Set(rowsGone(dir).map((g) => g.entry))
|
|
68
|
+
return { count: r.count + all.filter((e) => !rows.has(e.entry)).length, oldest: r.oldest == null ? oldest : oldest == null ? r.oldest : Math.min(oldest, r.oldest) }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** the cards set aside more than `keepMs` ago go for good: how many */
|
|
72
|
+
export function sweepGone(dir: string, now: number = Date.now(), keepMs: number = GONE_KEEP_MS): number {
|
|
73
|
+
// with the rows, the folders the files set aside before the move go at the same age: the rows hold each one
|
|
74
|
+
let n = cardsInDb() ? rowsSweepGone(dir, now, keepMs) : 0
|
|
75
|
+
const rows = cardsInDb() ? new Set(rowsGone(dir).map((g) => g.entry)) : new Set<string>()
|
|
76
|
+
for (const e of goneFolders(dir)) {
|
|
77
|
+
const f = join(dir, GONE, e.entry)
|
|
78
|
+
const s = statSync(f, { throwIfNoEntry: false })
|
|
79
|
+
if (s && s.ctimeMs < now - keepMs) {
|
|
80
|
+
rmSync(f, { recursive: true, force: true })
|
|
81
|
+
if (!rows.has(e.entry)) n++
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return n
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** the `created` of a card set aside, null when its head does not read */
|
|
88
|
+
export const goneCreated = (dir: string, entry: string): string | null => (cardsInDb() ? rowsGoneCreated(dir, entry) : goneFolderCreated(dir, entry))
|
|
89
|
+
|
|
90
|
+
/** the `created` of a card set aside in a store's files */
|
|
91
|
+
export function goneFolderCreated(dir: string, entry: string): string | null {
|
|
92
|
+
try {
|
|
93
|
+
const v = JSON.parse(readFileSync(join(dir, GONE, entry, 'item.json'), 'utf8')) as { created?: unknown }
|
|
94
|
+
return typeof v.created === 'string' && v.created !== '' ? v.created : null
|
|
95
|
+
} catch {
|
|
96
|
+
return null
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// the pass that checks each standing hold (wiki tools/shipkit/threads-how-it-fits.md, The model): every object that
|
|
2
|
+
// holds a thread open, its kind's check run server side, a `hold` message written only when it flips (its first check
|
|
3
|
+
// included), so a minute's pass on unmoved objects writes nothing. The hub runs it with its ping; `sk thread holds` now.
|
|
4
|
+
//
|
|
5
|
+
// the one constraint a reader breaks first: a check that throws holds, its words the error, never a clear: one broken
|
|
6
|
+
// read must never close a thread
|
|
7
|
+
import { existsSync } from 'node:fs'
|
|
8
|
+
import { branchHold } from './branch-hold.ts'
|
|
9
|
+
import { heldOpen, holdsOpenOf, type Hold, type HoldState, type HoldsOpen } from './holds.ts'
|
|
10
|
+
import type { ReviewItem, Spec } from './model.ts'
|
|
11
|
+
import { appendMessage, readAll, specOf, storeDir } from './store.ts'
|
|
12
|
+
import { membersOf, threadsOf } from './threads.ts'
|
|
13
|
+
|
|
14
|
+
/** the house kinds' checks: server side, beside a declaration the hub bundles (review/kinds.ts) */
|
|
15
|
+
const HOUSE_CHECKS: Record<string, NonNullable<HoldsOpen['check']>> = { branch: branchHold }
|
|
16
|
+
|
|
17
|
+
export interface HoldSync {
|
|
18
|
+
checked: number
|
|
19
|
+
flipped: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** one hold checked now, null when its kind declares no check; a check that throws holds */
|
|
23
|
+
async function checkHold(root: string, h: Hold, spec: Spec): Promise<HoldState | null> {
|
|
24
|
+
const word = h.address.slice(0, h.address.indexOf(':'))
|
|
25
|
+
const check = holdsOpenOf(word, spec)?.check ?? HOUSE_CHECKS[word]
|
|
26
|
+
if (check === undefined) return null
|
|
27
|
+
try {
|
|
28
|
+
return await check(h.address.slice(word.length + 1), { root, ...(h.sha !== undefined ? { sha: h.sha } : {}), ...(h.ahead !== undefined ? { ahead: h.ahead } : {}) })
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return { held: true, words: `held open by ${h.address}: its check broke: ${(e as Error).message.split('\n')[0]}` }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** the thread's standing holds as they stand this instant, for the page: each one's words and facts read now, nothing
|
|
35
|
+
* written (the pass writes the flips) */
|
|
36
|
+
export async function liveHolds(root: string, members: readonly ReviewItem[], spec: Spec): Promise<(Hold & { facts?: Record<string, unknown> })[]> {
|
|
37
|
+
return Promise.all(
|
|
38
|
+
heldOpen(members, spec).map(async (h) => {
|
|
39
|
+
const s = await checkHold(root, h, spec)
|
|
40
|
+
return s === null ? h : { ...h, words: s.words, ...(s.facts ? { facts: s.facts } : {}) }
|
|
41
|
+
}),
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** each standing hold of the store of `root` checked; a flip written as the machine's message on its thread */
|
|
46
|
+
export async function syncHolds(root: string, now = new Date()): Promise<HoldSync> {
|
|
47
|
+
const out: HoldSync = { checked: 0, flipped: 0 }
|
|
48
|
+
const dir = storeDir(root)
|
|
49
|
+
if (!existsSync(dir)) return out
|
|
50
|
+
const spec = specOf(dir)
|
|
51
|
+
for (const t of threadsOf(readAll(dir).items, spec))
|
|
52
|
+
for (const h of heldOpen(membersOf(t), spec)) {
|
|
53
|
+
const s = await checkHold(root, h, spec)
|
|
54
|
+
if (s === null) continue
|
|
55
|
+
out.checked++
|
|
56
|
+
if (h.checked && s.held) continue
|
|
57
|
+
const ahead = s.facts?.ahead
|
|
58
|
+
appendMessage(dir, t.head.item.id, { who: 'agent', text: s.words, hold: { address: h.address, held: s.held, ...(s.sha !== undefined ? { sha: s.sha } : {}), ...(typeof ahead === 'number' ? { ahead } : {}) } }, { machine: true, now })
|
|
59
|
+
out.flipped++
|
|
60
|
+
}
|
|
61
|
+
return out
|
|
62
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// an attached object that holds its thread open (wiki tools/shipkit/threads-how-it-fits.md, The model): its kind
|
|
2
|
+
// declares `holdsOpen`, an attach (`about`) starts the hold, the machine writes a `hold` message each time one flips,
|
|
3
|
+
// his close (`unhold`) releases the standing ones. Pure and browser safe: the checks run server side
|
|
4
|
+
// (review/holds-sync.ts)
|
|
5
|
+
//
|
|
6
|
+
// the one constraint a reader breaks first: only the messages after an object's newest attach count, so an object
|
|
7
|
+
// attached again after a release or a clear holds again until its next check
|
|
8
|
+
import { HOUSE_KINDS } from './kinds.ts'
|
|
9
|
+
import { canonicalAddress, NO_SPEC, partyOf, type ReviewItem, type Spec } from './model.ts'
|
|
10
|
+
|
|
11
|
+
/** what a kind's check says of one object now: held while its condition is not met; `sha` the object's version the
|
|
12
|
+
* next check may need (a branch deleted after its merge) */
|
|
13
|
+
export interface HoldState {
|
|
14
|
+
held: boolean
|
|
15
|
+
words: string
|
|
16
|
+
sha?: string
|
|
17
|
+
/** what the box draws beside the words: ahead, behind, the last commit, the diff */
|
|
18
|
+
facts?: Record<string, unknown>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** a kind's hold: its condition in words, whose move it is while it holds, and server side, its check on one object by
|
|
22
|
+
* its key */
|
|
23
|
+
export interface HoldsOpen {
|
|
24
|
+
until: string
|
|
25
|
+
/** who meets the condition: the owner (a merge into main is his gate), else an agent */
|
|
26
|
+
move?: 'owner' | 'agents'
|
|
27
|
+
check?(key: string, ctx: { root: string; sha?: string; ahead?: number }): HoldState | Promise<HoldState>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** one object that holds or held a thread since its newest attach */
|
|
31
|
+
export interface Hold {
|
|
32
|
+
address: string
|
|
33
|
+
held: boolean
|
|
34
|
+
words: string
|
|
35
|
+
/** the newest flip's time, else the attach's */
|
|
36
|
+
at: string
|
|
37
|
+
/** false until the machine checked it once: it holds meanwhile */
|
|
38
|
+
checked: boolean
|
|
39
|
+
sha?: string
|
|
40
|
+
ahead?: number
|
|
41
|
+
/** his close released it */
|
|
42
|
+
released: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const wordOf = (address: string): string => address.slice(0, address.indexOf(':'))
|
|
46
|
+
|
|
47
|
+
/** the hold a kind word declares, the repo's kind first */
|
|
48
|
+
export const holdsOpenOf = (word: string, spec: Spec = NO_SPEC): HoldsOpen | undefined => (spec.kinds[word] ?? HOUSE_KINDS[word])?.holdsOpen
|
|
49
|
+
|
|
50
|
+
/** every object attached to the thread whose kind holds, or that a hold message names, as it stands since its newest
|
|
51
|
+
* attach, oldest attach first */
|
|
52
|
+
export function holdsOf(members: readonly ReviewItem[], spec: Spec = NO_SPEC): Hold[] {
|
|
53
|
+
const msgs = members.flatMap((x) => x.thread).sort((a, b) => a.at.localeCompare(b.at) || a.id.localeCompare(b.id))
|
|
54
|
+
const named = new Set(msgs.flatMap((m) => (m.hold ? [m.hold.address] : [])))
|
|
55
|
+
const attached = new Map<string, string>()
|
|
56
|
+
for (const m of msgs)
|
|
57
|
+
for (const raw of m.about ?? []) {
|
|
58
|
+
const a = canonicalAddress(raw) ?? raw
|
|
59
|
+
if (holdsOpenOf(wordOf(a), spec) !== undefined || named.has(a)) attached.set(a, m.at)
|
|
60
|
+
}
|
|
61
|
+
const out: Hold[] = []
|
|
62
|
+
for (const [address, since] of [...attached].sort((a, b) => a[1].localeCompare(b[1]))) {
|
|
63
|
+
const after = msgs.filter((m) => m.at >= since)
|
|
64
|
+
const flip = after.filter((m) => m.hold?.address === address && partyOf(m.who) === 'agent').at(-1)
|
|
65
|
+
const released = after.some((m) => partyOf(m.who) === 'owner' && m.unhold?.includes(address))
|
|
66
|
+
const until = holdsOpenOf(wordOf(address), spec)?.until ?? 'its condition is met'
|
|
67
|
+
out.push({
|
|
68
|
+
address,
|
|
69
|
+
held: !released && (flip?.hold?.held ?? true),
|
|
70
|
+
words: flip?.text ?? `held open by ${address} until ${until}: not checked yet`,
|
|
71
|
+
at: flip?.at ?? since,
|
|
72
|
+
checked: flip !== undefined,
|
|
73
|
+
...(flip?.hold?.sha ? { sha: flip.hold.sha } : {}),
|
|
74
|
+
...(flip?.hold?.ahead !== undefined ? { ahead: flip.hold.ahead } : {}),
|
|
75
|
+
released,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
return out
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** the objects that hold the thread open now */
|
|
82
|
+
export const heldOpen = (members: readonly ReviewItem[], spec: Spec = NO_SPEC): Hold[] => holdsOf(members, spec).filter((h) => h.held)
|
|
83
|
+
|
|
84
|
+
/** whose move a standing hold is: its kind's `move`, an agent's when the kind says none */
|
|
85
|
+
export const holdMoveOf = (h: Pick<Hold, 'address'>, spec: Spec = NO_SPEC): 'owner' | 'agents' => holdsOpenOf(wordOf(h.address), spec)?.move ?? 'agents'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// the server part of the house kinds that read and apply an object (wiki tools/shipkit/threads-how-it-fits.md, Kinds):
|
|
2
|
+
// the messages store's `persona`, `messages` and `surface`, their read and apply bound to the repo root. One lookup for
|
|
3
|
+
// every server caller (`sk thread post`'s states, the apply on the owner's verdict): the repo unit's kind of that word first,
|
|
4
|
+
// as a repo's word wins, else the house's. The one constraint a reader breaks first: this module reads the disk, so
|
|
5
|
+
// nothing the hub bundles imports it (the pure declarations stay in kinds.ts)
|
|
6
|
+
import { isObjectKind, readObject, type MessageJson } from '../messages/objects.ts'
|
|
7
|
+
import { applyObject } from '../messages/write.ts'
|
|
8
|
+
import { HOUSE_KINDS } from './kinds.ts'
|
|
9
|
+
import type { KindDef, ObjectState, ReviewUnit } from './unit.ts'
|
|
10
|
+
|
|
11
|
+
/** one field of a proposed change set on a store object's json: a message's own fields sit under `fields`, a field the owner
|
|
12
|
+
* filled leaves `toFill`; a phrasing's or an option's words are its `text` or `headline` (an empty field name) */
|
|
13
|
+
export function withField(state: ObjectState, field: string, value: string): ObjectState {
|
|
14
|
+
const j = { ...(state.json as Record<string, unknown>) }
|
|
15
|
+
if ('phrasings' in j && field !== 'title') {
|
|
16
|
+
const m = j as unknown as MessageJson
|
|
17
|
+
const fields = { ...m.fields, [field]: value }
|
|
18
|
+
// an empty value is the field with no words: to fill when it was written so, else absent
|
|
19
|
+
if (value.trim() === '') delete fields[field]
|
|
20
|
+
const toFill = value.trim() === '' ? m.toFill : m.toFill.filter((k) => k !== field)
|
|
21
|
+
return { json: { ...m, fields, toFill } }
|
|
22
|
+
}
|
|
23
|
+
const k = field !== '' ? field : 'text' in j ? 'text' : 'headline' in j ? 'headline' : field
|
|
24
|
+
if (k === '') throw new Error('name the field the change sets (--field <key>)')
|
|
25
|
+
return { json: { ...j, [k]: value } }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** the house kind of `word` with its server part, bound to `root`; undefined for a kind with none */
|
|
29
|
+
function houseDef(root: string, word: string): KindDef | undefined {
|
|
30
|
+
const spec = HOUSE_KINDS[word]
|
|
31
|
+
if (spec == null || !isObjectKind(word)) return undefined
|
|
32
|
+
return {
|
|
33
|
+
...spec,
|
|
34
|
+
read: (key, at) => readObject(root, word, key, at),
|
|
35
|
+
apply: (key, after, before) => void applyObject(root, word, key, after.json, before?.json),
|
|
36
|
+
field: withField,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** the kind that reads and applies objects of `word` in this repo: the unit's own, else the house's */
|
|
41
|
+
export const serverKindOf = (root: string, unit: Pick<ReviewUnit, 'kinds'> | null | undefined, word: string): KindDef | undefined => unit?.kinds?.[word] ?? houseDef(root, word)
|