rvlib-shipkit 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/package.json +10 -2
- package/src/advisors/acts.ts +277 -0
- package/src/advisors/advice.ts +384 -0
- package/src/advisors/advisor-view.ts +417 -0
- package/src/advisors/app-graph.ts +112 -0
- package/src/advisors/app.ts +75 -0
- package/src/advisors/door.ts +59 -0
- package/src/advisors/edge/api.ts +292 -0
- package/src/advisors/edge/bucket.ts +43 -0
- package/src/advisors/edge/certs.ts +20 -0
- package/src/advisors/edge/form.ts +45 -0
- package/src/advisors/edge/handler.ts +156 -0
- package/src/advisors/edge/jwt.ts +76 -0
- package/src/advisors/edge/shell.ts +27 -0
- package/src/advisors/edge/status.ts +12 -0
- package/src/advisors/edge/types.ts +137 -0
- package/src/advisors/edge/worker.ts +52 -0
- package/src/advisors/expose.ts +150 -0
- package/src/advisors/job.ts +35 -0
- package/src/advisors/owner-store.ts +226 -0
- package/src/advisors/photos.ts +182 -0
- package/src/advisors/project.ts +311 -0
- package/src/advisors/r2.ts +48 -0
- package/src/advisors/routes.ts +469 -0
- package/src/advisors/scan.ts +194 -0
- package/src/advisors/sync.ts +363 -0
- package/src/agent-time/accounts-usage-disk.ts +29 -0
- package/src/agent-time/accounts-usage.ts +97 -0
- package/src/agent-time/hooks.ts +73 -29
- package/src/agent-time/lane-name.ts +7 -0
- package/src/agent-time/leads.ts +95 -0
- package/src/agent-time/live.ts +11 -5
- package/src/agent-time/registry.ts +354 -0
- package/src/agent-time/render.ts +35 -4
- package/src/agent-time/report-cache.ts +4 -8
- package/src/agent-time/report.ts +19 -1
- package/src/agent-time/store.ts +10 -16
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +12 -11
- package/src/annex/snapshots.ts +3 -3
- package/src/annex/tidy.ts +10 -23
- package/src/asks/ask-after.ts +8 -3
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-carry.ts +190 -0
- package/src/asks/ask-close.ts +72 -0
- package/src/asks/ask-doc.ts +42 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +123 -0
- package/src/asks/ask-store.ts +703 -0
- package/src/asks/ask-words-fold.ts +208 -0
- package/src/assets/kits/identity-kit.ts +106 -38
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/checks/SK001-package-json-shape.check.ts +5 -7
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +21 -17
- package/src/checks/SK010-undeclared-unit.check.ts +77 -64
- package/src/checks/SK013-one-way-in-policy.check.ts +27 -5
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK027-agent-wiki-links.check.ts +46 -6
- package/src/checks/SK033-global-contribution.check.ts +1 -1
- package/src/checks/SK036-draft-media-size.check.ts +5 -4
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK040-release-words.check.ts +39 -10
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK045-slow-hooks.check.ts +5 -2
- package/src/checks/SK049-thread-answers-hook.check.ts +83 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/checks/SK051-no-formatter.check.ts +485 -0
- package/src/cli/cmd_Advisors.ts +336 -0
- package/src/cli/cmd_Annex.ts +10 -10
- package/src/cli/cmd_Asks.ts +303 -51
- package/src/cli/cmd_Backup.ts +157 -14
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Check.ts +3 -3
- package/src/cli/cmd_Checks.ts +1 -1
- package/src/cli/cmd_Ci.ts +15 -16
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_Db.ts +9 -9
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_History.ts +2 -2
- package/src/cli/cmd_Home.ts +5 -6
- package/src/cli/cmd_Hooks.ts +13 -3
- package/src/cli/cmd_Hq.ts +30 -19
- package/src/cli/cmd_Keys.ts +2 -1
- package/src/cli/cmd_Lanes.ts +21 -4
- package/src/cli/cmd_Media.ts +59 -13
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Orchestrator.ts +138 -0
- package/src/cli/cmd_Rec.ts +5 -2
- package/src/cli/cmd_Reflect.ts +17 -3
- package/src/cli/cmd_Releases.ts +38 -38
- package/src/cli/cmd_Review.ts +1500 -424
- package/src/cli/cmd_Secret.ts +255 -34
- package/src/cli/cmd_Shot.ts +14 -6
- package/src/cli/cmd_Social.ts +41 -37
- package/src/cli/cmd_SocialDrafts.ts +248 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +1 -1
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +153 -0
- package/src/cli/cmd_ThreadReflect.ts +91 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +2 -1
- package/src/cli/cmd_Tmp.ts +9 -8
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -5
- package/src/cli/cmd_Urls.ts +3 -3
- package/src/cli/cmd_Vault.ts +5 -5
- package/src/cli/cmd_When.ts +2 -1
- package/src/cli/cmd_Worktrees.ts +109 -0
- package/src/cli/family-help.ts +2 -2
- 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 +35 -5
- package/src/cli.ts +26 -15
- package/src/collections/actions.ts +27 -75
- package/src/collections/checks.ts +1 -1
- package/src/collections/collection-types.ts +23 -8
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +16 -6
- package/src/collections/providers.ts +63 -71
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +25 -23
- package/src/collections/state-rules.ts +8 -7
- package/src/comfy/comfy-panel.ts +2 -2
- package/src/commands/model.ts +1 -1
- package/src/commands/routes.ts +1 -1
- package/src/commands/runs.ts +1 -1
- package/src/core/app-icon.ts +3 -9
- package/src/core/atomic-write.ts +36 -0
- package/src/core/budget.ts +16 -1
- package/src/core/bun-builtins.ts +7 -7
- package/src/core/canonical-scripts.ts +4 -6
- package/src/core/check-ctx.ts +17 -3
- package/src/core/day-stamp.ts +20 -0
- package/src/core/git-bin.ts +10 -0
- package/src/core/git.ts +75 -0
- package/src/core/hard-reset.ts +1 -2
- package/src/core/history-files.ts +4 -8
- package/src/core/house-layout.ts +20 -0
- package/src/core/hub-theme.ts +16 -0
- package/src/core/identity.ts +1 -1
- package/src/core/in-base.ts +19 -0
- package/src/core/instance.ts +15 -5
- package/src/core/last-good.ts +42 -133
- package/src/core/layout.ts +11 -6
- package/src/core/load-probe.ts +4 -8
- package/src/core/locked-write.ts +116 -43
- package/src/core/loop-watch.ts +24 -3
- package/src/core/machine-db.ts +58 -14
- package/src/core/machine-link.ts +1 -1
- package/src/core/memory-watch.ts +3 -2
- package/src/core/migrate-layout.ts +8 -10
- package/src/core/motherhome.ts +2 -1
- package/src/core/nearest.ts +23 -0
- package/src/core/on-loop.ts +57 -0
- package/src/core/one-way-in-policy.ts +26 -13
- package/src/core/raw-access.ts +9 -2
- package/src/core/reexec.ts +3 -5
- package/src/core/repo-walk.ts +104 -0
- package/src/core/retention.ts +10 -12
- package/src/core/run-dirs.ts +45 -0
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +2 -2
- package/src/core/slug.ts +33 -0
- package/src/core/spawn-timeout.ts +3 -1
- package/src/core/squircle.ts +0 -8
- package/src/core/throwaway-worktree.ts +21 -2
- package/src/core/unit-files.ts +4 -4
- package/src/core/when-block.ts +4 -5
- package/src/core/when.ts +1 -3
- package/src/core/words.ts +33 -0
- package/src/fleet/push-fleet.ts +4 -11
- package/src/{core → gate}/cache-audit.ts +1 -1
- package/src/{core → gate}/check-runner.ts +24 -54
- package/src/{core → gate}/discover-checks.ts +19 -101
- package/src/{core → gate}/discover-legacy-checks.ts +3 -3
- package/src/{ledger → gate}/gate-checks.ts +5 -5
- package/src/gate/head-gate.ts +151 -0
- package/src/{core → gate}/job-follow.ts +1 -1
- package/src/{core → gate}/job-run.ts +3 -3
- package/src/{core → gate}/pre-commit-discovery.ts +2 -2
- package/src/{core → gate}/run-check.ts +7 -7
- package/src/{core → gate}/run-ci.ts +9 -9
- package/src/gate/run-fix.ts +173 -0
- package/src/{core → gate}/run-fixers.ts +14 -14
- package/src/{core → gate}/trace-audit.ts +8 -8
- package/src/home/activity-shape.ts +1 -1
- package/src/home/activity.ts +21 -26
- package/src/home/app-sign.ts +17 -9
- package/src/home/daemon-guard.ts +6 -0
- package/src/home/daemon-jobs.ts +64 -10
- package/src/home/database-words.ts +21 -27
- package/src/home/databases.ts +3 -3
- package/src/home/global-context.ts +2 -2
- package/src/home/global-units.ts +1 -1
- package/src/home/gui-app/ShipkitGui.swift +129 -55
- package/src/home/gui-app.ts +1 -1
- package/src/home/handover.ts +126 -0
- package/src/home/home-move.ts +29 -16
- package/src/home/home-paths.ts +33 -8
- package/src/home/home-routes.ts +83 -5
- package/src/home/home-start.ts +1 -1
- package/src/home/home-state.ts +12 -6
- package/src/home/hubs.ts +28 -5
- package/src/home/inbox-shape.ts +250 -94
- package/src/home/inbox.ts +27 -71
- package/src/home/lib-watch.ts +93 -74
- package/src/home/machine-fold.ts +54 -56
- package/src/home/machine-host.ts +19 -1
- package/src/home/machine-repair.ts +5 -6
- package/src/home/machine-stores.ts +3 -3
- package/src/home/machine-temp.ts +58 -67
- package/src/home/other-macs.ts +2 -2
- package/src/home/page-build.ts +330 -0
- package/src/home/page-held.ts +338 -0
- package/src/home/pm-config.ts +10 -2
- package/src/home/pm.ts +35 -1
- package/src/home/process-apps.ts +3 -3
- package/src/home/push-sources.ts +132 -0
- package/src/home/run-daemon.ts +54 -4
- package/src/home/run-pm.ts +2 -1
- package/src/home/run-web.ts +11 -6
- package/src/home/search-shape.ts +54 -0
- package/src/home/search.ts +114 -0
- package/src/home/serve-daemon.ts +40 -18
- package/src/home/serve-web.ts +90 -148
- package/src/home/space-page.ts +8 -8
- package/src/home/space-words.ts +11 -10
- package/src/home/supervise.ts +24 -0
- package/src/home/time-page-shape.ts +0 -13
- package/src/home/vault-page.ts +64 -30
- package/src/home/vault-reveal.ts +29 -0
- package/src/home/vault-words.ts +5 -5
- package/src/home/via-hub.ts +3 -4
- package/src/home/worktree-tidy.ts +236 -0
- package/src/hooks/edit-guard.ts +12 -0
- package/src/hooks/hook-gates.ts +2 -0
- package/src/hooks/leak-guard.ts +9 -3
- package/src/hooks/one-way-in-guard.ts +32 -2
- package/src/hooks/run-hooks.ts +58 -5
- package/src/hooks/shared-file.ts +174 -0
- package/src/{serve → house}/project-gutter.ts +11 -54
- package/src/hq/door-route.ts +2 -2
- package/src/hq/door.ts +3 -3
- package/src/hq/files-send.ts +32 -33
- package/src/hq/forgotten-log.ts +1 -1
- package/src/hq/history-check.ts +7 -6
- package/src/hq/history-send.ts +12 -14
- package/src/hq/hq-db.ts +5 -2
- package/src/hq/hq-local.ts +48 -13
- package/src/hq/hq-routes.ts +10 -2
- package/src/hq/hq-store.ts +10 -6
- package/src/hq/kinds/ask.ts +9 -8
- package/src/hq/kinds/index.ts +4 -4
- package/src/hq/kinds/{card-gone.ts → item-gone.ts} +24 -25
- package/src/hq/kinds/{card-msg.ts → item-msg.ts} +25 -27
- package/src/hq/kinds/{card.ts → item.ts} +31 -29
- package/src/hq/kinds/kind.ts +3 -0
- package/src/hq/kinds/media.ts +2 -3
- package/src/hq/kinds/prompt.ts +2 -1
- package/src/hq/kinds/time-day.ts +5 -4
- package/src/hq/ledger.ts +22 -22
- package/src/hq/machine-notes.ts +14 -15
- package/src/hq/outbox.ts +35 -24
- package/src/hq/replica.ts +1 -2
- package/src/hq/report.ts +10 -12
- package/src/hq/switch.ts +20 -23
- package/src/hq/{cards.ts → thread-sync.ts} +127 -99
- package/src/hq/vault-route.ts +112 -0
- package/src/{serve → http}/door-forward.ts +11 -4
- package/src/http/loopback-serve.ts +84 -0
- package/src/{serve → http}/same-origin.ts +6 -2
- package/src/http/tailnet-caller.ts +118 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +9 -8
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/shown.ts +2 -6
- package/src/ledger/check-table.ts +1 -1
- package/src/ledger/db.ts +9 -1
- package/src/ledger/git-key.ts +9 -3
- package/src/ledger/git-scan.ts +2 -2
- package/src/ledger/ledger.ts +6 -16
- package/src/media-kinds.ts +4 -1
- package/src/media-store/backup/daemon.ts +51 -10
- package/src/media-store/backup/keys.ts +1 -4
- package/src/media-store/backup/manifest.ts +21 -3
- package/src/media-store/backup/prune.ts +362 -0
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +22 -35
- package/src/media-store/backup/sources.ts +27 -27
- package/src/media-store/backup/thread-copy.ts +339 -0
- package/src/media-store/backup/watch.ts +10 -6
- package/src/media-store/content.ts +3 -0
- package/src/media-store/copy/config.ts +3 -4
- package/src/media-store/copy/night.ts +4 -4
- package/src/media-store/copy/store.ts +2 -2
- package/src/media-store/daemon.ts +5 -4
- package/src/media-store/db.ts +10 -20
- package/src/media-store/forget-one.ts +247 -0
- package/src/media-store/forget.ts +141 -4
- package/src/media-store/hq-send.ts +5 -4
- package/src/media-store/purge.ts +5 -4
- package/src/media-store/remote.ts +2 -2
- package/src/media-store/space-listing.ts +20 -9
- package/src/media-store/space.ts +7 -5
- package/src/media-store/tidy.ts +3 -3
- package/src/media-store/upload.ts +2 -2
- package/src/media-store/webp.ts +3 -3
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +1 -1
- package/src/messages/objects.ts +203 -0
- package/src/messages/routes.ts +2 -2
- package/src/messages/score.ts +2 -4
- package/src/messages/store-doc.ts +114 -0
- package/src/messages/verdicts.ts +6 -0
- package/src/messages/write.ts +285 -0
- package/src/mv/mv-md.ts +43 -12
- package/src/orchestrator/brief.md +29 -0
- package/src/orchestrator/deliver.ts +81 -0
- package/src/orchestrator/drill.ts +129 -0
- package/src/orchestrator/guards.ts +63 -0
- package/src/orchestrator/keeper.ts +332 -0
- package/src/orchestrator/phone.ts +98 -0
- package/src/orchestrator/pm.ts +20 -0
- package/src/orchestrator/presence-shape.ts +17 -0
- package/src/orchestrator/presence.ts +68 -0
- package/src/orchestrator/push.ts +102 -0
- package/src/orchestrator/routes.ts +113 -0
- package/src/orchestrator/state.ts +92 -0
- package/src/orchestrator/switch.ts +86 -0
- package/src/orchestrator/tmux.ts +82 -0
- package/src/orchestrator/unheard.ts +68 -0
- package/src/pages/frame-client.ts +181 -4
- package/src/pages/unit.ts +1 -1
- package/src/plan/repo-source.ts +1 -1
- package/src/recordings/load.ts +1 -1
- package/src/recordings/model.ts +18 -10
- package/src/recordings/place.ts +3 -3
- package/src/recordings/recorder-app/Capture.swift +69 -21
- package/src/recordings/recorder-app/Editor.swift +214 -11
- package/src/recordings/recorder-app/main.swift +229 -47
- package/src/recordings/recorder-app.ts +1 -1
- package/src/recordings/routes.ts +11 -1
- package/src/recordings/take.ts +7 -5
- package/src/recordings/view.ts +6 -0
- package/src/reflect/prompt-corpus.ts +5 -3
- package/src/reflect/thread-words.ts +51 -0
- package/src/reflections/reflection-close.ts +123 -0
- package/src/reflections/reflection-doc.ts +59 -0
- package/src/reflections/reflection-place.ts +60 -0
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +124 -21
- package/src/release/git-facts.ts +11 -9
- package/src/release/machine-words.ts +21 -3
- package/src/release/public-clean.ts +81 -21
- package/src/release/run-bump.ts +3 -5
- package/src/release/run-release.ts +42 -38
- package/src/releases/add.ts +33 -87
- package/src/releases/{from-card.ts → from-thread.ts} +47 -46
- package/src/releases/model.ts +207 -36
- package/src/releases/routes.ts +2 -2
- package/src/releases/shape.ts +184 -0
- package/src/releases/store.ts +10 -10
- package/src/repo-config.ts +53 -21
- package/src/review/anim.ts +8 -8
- package/src/review/answer-kinds.ts +160 -0
- package/src/review/auto.ts +3 -3
- package/src/review/band.ts +145 -0
- package/src/review/branch-hold.ts +91 -0
- package/src/review/cells.ts +451 -96
- package/src/review/close.ts +92 -0
- package/src/review/doc-card.ts +41 -0
- package/src/review/doc-model.ts +100 -0
- package/src/review/doc-routes.ts +66 -0
- package/src/review/doc-save.ts +152 -0
- package/src/review/draft-item.ts +36 -0
- package/src/review/draft-model.ts +125 -17
- package/src/review/events.ts +164 -0
- package/src/review/file-tags.ts +52 -0
- package/src/review/format.ts +195 -38
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +21 -21
- package/src/review/hand-over.ts +58 -0
- package/src/review/heard.ts +29 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +71 -0
- package/src/review/http.ts +1 -1
- package/src/review/inbox-hook.ts +69 -10
- package/src/review/inbox-read.ts +226 -0
- package/src/review/instructions.ts +241 -0
- package/src/review/{card-db.ts → item-db.ts} +48 -36
- package/src/review/{card-rows.ts → item-rows.ts} +79 -51
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kind-still.ts +125 -0
- package/src/review/kinds.ts +314 -0
- package/src/review/lane-ask.ts +113 -0
- package/src/review/live-post.ts +107 -0
- package/src/review/live-view.ts +137 -0
- package/src/review/media-kind.ts +4 -4
- package/src/review/media-read.ts +4 -4
- package/src/review/media.ts +3 -5
- package/src/review/mentions.ts +100 -0
- package/src/review/model-moved.ts +76 -0
- package/src/review/model.ts +846 -214
- package/src/review/move.ts +62 -61
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +51 -0
- package/src/review/notes.ts +2 -1
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/one-block.ts +64 -0
- package/src/review/owner-read.ts +41 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +274 -0
- package/src/review/paste.ts +4 -4
- package/src/review/phone-push.ts +137 -0
- package/src/review/previews.ts +19 -17
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/push.ts +269 -0
- package/src/review/referring.ts +76 -0
- package/src/review/reflection-object.ts +190 -0
- package/src/review/rev.ts +1 -1
- package/src/review/role.ts +3 -3
- package/src/review/routes.ts +227 -83
- package/src/review/search-index.ts +218 -0
- package/src/review/search-job.ts +40 -0
- package/src/review/search-ocr.ts +138 -0
- package/src/review/search-text.ts +129 -0
- package/src/review/secret-route.ts +110 -0
- package/src/review/settle.ts +67 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-routes.ts +15 -13
- package/src/review/{stage-card.ts → stage-thread.ts} +22 -21
- package/src/review/store-index.ts +49 -0
- package/src/review/store-parties.ts +20 -0
- package/src/review/store.ts +721 -260
- package/src/review/supersede.ts +132 -0
- package/src/review/take-back.ts +65 -0
- package/src/review/thread-fold.ts +20 -7
- package/src/review/threads.ts +397 -79
- package/src/review/traces.ts +206 -0
- package/src/review/trailer-desk.ts +7 -7
- package/src/review/{trailer-card.ts → trailer-item.ts} +12 -12
- package/src/review/trailer-model.ts +4 -4
- package/src/review/trailer-notes.ts +2 -2
- package/src/review/trailer-routes.ts +5 -4
- package/src/review/trailer-shots.ts +3 -3
- package/src/review/unit.ts +140 -13
- package/src/review/uploads.ts +103 -0
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/view-layout.ts +69 -0
- package/src/review/wait.ts +91 -0
- package/src/review/wakes.ts +115 -0
- package/src/review/watch-feed.ts +183 -0
- package/src/review/watchers.ts +44 -10
- package/src/rules/untrack-generated.ts +40 -39
- package/src/scaffold/files/bunfig.toml +1 -9
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/scaffold/files/vscode-settings.json +1 -1
- package/src/scaffold/project-scaffold.ts +14 -10
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +84 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/keychain-write.ts +56 -0
- package/src/secrets/keychain.ts +8 -5
- package/src/secrets/lapse-mark.ts +38 -0
- package/src/secrets/lapse.ts +71 -0
- package/src/secrets/list.ts +16 -22
- package/src/secrets/manager.ts +31 -16
- package/src/secrets/read.ts +161 -33
- package/src/secrets/security-line.ts +19 -0
- package/src/secrets/tail.ts +31 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/house-runs.ts +1 -1
- package/src/serve/hub-app/accounts-line.tsx +67 -0
- package/src/serve/hub-app/activity-st.ts +46 -50
- package/src/serve/hub-app/advice-box.tsx +66 -0
- package/src/serve/hub-app/advisor-app.tsx +46 -0
- package/src/serve/hub-app/advisor-face.tsx +29 -0
- package/src/serve/hub-app/advisor-host.ts +142 -0
- package/src/serve/hub-app/advisor.html +22 -0
- package/src/serve/hub-app/advisors-st.ts +261 -0
- package/src/serve/hub-app/advisors-view.tsx +269 -0
- package/src/serve/hub-app/advisors.css +57 -0
- package/src/serve/hub-app/app-bridge.ts +27 -24
- package/src/serve/hub-app/ask-steps-st.ts +60 -0
- package/src/serve/hub-app/ask-steps.tsx +23 -0
- package/src/serve/hub-app/asks-page.tsx +9 -5
- package/src/serve/hub-app/asks-st.ts +1 -4
- package/src/serve/hub-app/auto-text.tsx +118 -18
- 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/checks-svc.ts +1 -1
- package/src/serve/hub-app/clock-svc.ts +21 -5
- package/src/serve/hub-app/code-copy.ts +196 -0
- package/src/serve/hub-app/col-card.tsx +24 -40
- package/src/serve/hub-app/col-list-page.tsx +7 -4
- package/src/serve/hub-app/col-list-st.ts +6 -1
- package/src/serve/hub-app/col-tables-view.tsx +7 -4
- package/src/serve/hub-app/col-tables.ts +19 -13
- package/src/serve/hub-app/cols-svc.ts +15 -80
- package/src/serve/hub-app/comfy-svc.ts +3 -2
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/commands/commands-st.ts +36 -26
- package/src/serve/hub-app/controls.css +99 -0
- package/src/serve/hub-app/cursor-spot.ts +81 -0
- package/src/serve/hub-app/database-st.ts +31 -26
- package/src/serve/hub-app/database-view.tsx +12 -12
- package/src/serve/hub-app/dock-st.ts +51 -10
- package/src/serve/hub-app/dock-view.tsx +14 -1
- package/src/serve/hub-app/editor/doc-editor-st.ts +223 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +116 -0
- package/src/serve/hub-app/editor/doc-saved.tsx +26 -0
- package/src/serve/hub-app/editor/doc-slot.ts +66 -0
- package/src/serve/hub-app/editor.css +36 -0
- package/src/serve/hub-app/emoji-names.ts +1915 -0
- package/src/serve/hub-app/emoji.ts +133 -0
- package/src/serve/hub-app/floating.tsx +162 -6
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-st.ts +25 -19
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +1 -1
- package/src/serve/hub-app/header-bar.tsx +4 -3
- package/src/serve/hub-app/held-keys.ts +25 -0
- package/src/serve/hub-app/home-st.ts +167 -18
- package/src/serve/hub-app/home-strip.css +4 -8
- package/src/serve/hub-app/home-strip.tsx +7 -3
- 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 +102 -36
- package/src/serve/hub-app/hub-types.ts +2 -0
- package/src/serve/hub-app/hub.css +117 -92
- package/src/serve/hub-app/icons.tsx +24 -4
- package/src/serve/hub-app/identities-st.ts +35 -25
- package/src/serve/hub-app/identities-view.tsx +11 -7
- package/src/serve/hub-app/inbox-st.ts +241 -52
- package/src/serve/hub-app/inbox-view.tsx +198 -105
- package/src/serve/hub-app/inbox.css +53 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/insights-st.ts +27 -19
- package/src/serve/hub-app/instructions.css +33 -0
- package/src/serve/hub-app/kept-folds.ts +43 -0
- package/src/serve/hub-app/keys.ts +13 -5
- package/src/serve/hub-app/later.tsx +1 -1
- package/src/serve/hub-app/layout-st.ts +37 -6
- package/src/serve/hub-app/list-filter.tsx +1 -1
- package/src/serve/hub-app/live-bar.css +12 -0
- package/src/serve/hub-app/live-svc.ts +12 -2
- package/src/serve/hub-app/machine-st.ts +38 -12
- package/src/serve/hub-app/machines-st.ts +40 -34
- package/src/serve/hub-app/machines-view.tsx +9 -16
- package/src/serve/hub-app/machines.css +0 -9
- package/src/serve/hub-app/markdown.css +128 -0
- package/src/serve/hub-app/md-copy.tsx +18 -40
- package/src/serve/hub-app/md.ts +176 -14
- package/src/serve/hub-app/media-svc.ts +44 -11
- package/src/serve/hub-app/media-view.tsx +2 -2
- package/src/serve/hub-app/messages/messages-page.tsx +57 -12
- package/src/serve/hub-app/messages/messages-st.ts +27 -23
- package/src/serve/hub-app/messages.css +0 -1
- package/src/serve/hub-app/new-thread.tsx +121 -0
- package/src/serve/hub-app/objects.css +52 -0
- package/src/serve/hub-app/orchestrator-line.tsx +104 -0
- package/src/serve/hub-app/orchestrator.css +37 -0
- package/src/serve/hub-app/page-keys.ts +8 -5
- package/src/serve/hub-app/page-reload.ts +111 -0
- package/src/serve/hub-app/pages-frames.tsx +12 -1
- package/src/serve/hub-app/pages-svc.ts +8 -3
- package/src/serve/hub-app/palette-st.ts +11 -6
- package/src/serve/hub-app/pane-boundary.tsx +85 -0
- package/src/serve/hub-app/pane-errors.ts +55 -0
- package/src/serve/hub-app/pano.css +20 -0
- package/src/serve/hub-app/plan-view.tsx +4 -3
- package/src/serve/hub-app/planned-st.ts +30 -26
- package/src/serve/hub-app/planned-view.tsx +17 -10
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/polled.ts +201 -0
- package/src/serve/hub-app/presence-st.ts +110 -0
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +101 -66
- package/src/serve/hub-app/project-list.tsx +139 -155
- package/src/serve/hub-app/projects-svc.ts +113 -57
- package/src/serve/hub-app/push-sign.tsx +15 -0
- package/src/serve/hub-app/push-svc.ts +273 -0
- package/src/serve/hub-app/quiet-st.ts +59 -0
- package/src/serve/hub-app/rail-fly.tsx +95 -0
- package/src/serve/hub-app/reach.ts +16 -0
- package/src/serve/hub-app/readme.css +9 -15
- package/src/serve/hub-app/recordings-st.ts +169 -9
- package/src/serve/hub-app/recordings-take.ts +58 -0
- package/src/serve/hub-app/recordings-view.tsx +42 -35
- package/src/serve/hub-app/recordings.css +1 -1
- package/src/serve/hub-app/reflections-page.tsx +70 -5
- package/src/serve/hub-app/releases/releases-page.tsx +54 -20
- package/src/serve/hub-app/releases/releases-st.ts +39 -26
- package/src/serve/hub-app/releases.css +4 -1
- package/src/serve/hub-app/repo-sections.ts +21 -10
- package/src/serve/hub-app/repo-st.ts +36 -9
- package/src/serve/hub-app/review/advisor-bar.tsx +40 -0
- package/src/serve/hub-app/review/attach-st.ts +195 -0
- package/src/serve/hub-app/review/attach-view.tsx +260 -0
- package/src/serve/hub-app/review/clip-st.ts +1 -1
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/cta.tsx +11 -0
- package/src/serve/hub-app/review/diff-view.tsx +77 -0
- package/src/serve/hub-app/review/doc-body.tsx +109 -0
- package/src/serve/hub-app/review/dock.tsx +118 -0
- package/src/serve/hub-app/review/draft-body.tsx +235 -0
- package/src/serve/hub-app/review/faces.tsx +26 -0
- package/src/serve/hub-app/review/group-block.tsx +239 -0
- package/src/serve/hub-app/review/heard-line.tsx +31 -0
- package/src/serve/hub-app/review/instructions-view.tsx +141 -0
- package/src/serve/hub-app/review/item-verdict.tsx +111 -0
- package/src/serve/hub-app/review/kind-states.tsx +265 -0
- package/src/serve/hub-app/review/kind-view.tsx +23 -44
- package/src/serve/hub-app/review/kit.tsx +54 -75
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/lightbox.tsx +16 -0
- package/src/serve/hub-app/review/line-window.ts +149 -0
- package/src/serve/hub-app/review/live-bar-st.ts +145 -0
- package/src/serve/hub-app/review/live-bar.tsx +126 -0
- package/src/serve/hub-app/review/live-view.tsx +104 -0
- package/src/serve/hub-app/review/mention-st.ts +85 -0
- package/src/serve/hub-app/review/mesh-view.tsx +9 -0
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +197 -0
- package/src/serve/hub-app/review/pano-gl.ts +145 -0
- package/src/serve/hub-app/review/pano-view.tsx +192 -0
- package/src/serve/hub-app/review/phone-top.tsx +16 -0
- package/src/serve/hub-app/review/pictures-st.ts +38 -0
- package/src/serve/hub-app/review/question-views.tsx +387 -0
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +223 -184
- package/src/serve/hub-app/review/review-host.ts +69 -0
- package/src/serve/hub-app/review/review-kit.ts +34 -19
- package/src/serve/hub-app/review/review-list.tsx +211 -51
- package/src/serve/hub-app/review/review-page.tsx +10 -20
- package/src/serve/hub-app/review/review-st.ts +294 -151
- package/src/serve/hub-app/review/review-thread.tsx +605 -161
- package/src/serve/hub-app/review/review-views.tsx +547 -452
- package/src/serve/hub-app/review/scene-view.tsx +26 -0
- package/src/serve/hub-app/review/secret-facts.ts +26 -0
- package/src/serve/hub-app/review/space3d.tsx +114 -0
- package/src/serve/hub-app/review/splat-view.tsx +9 -0
- package/src/serve/hub-app/review/superseded-runs.ts +76 -0
- package/src/serve/hub-app/review/thread-close.tsx +134 -0
- package/src/serve/hub-app/review/thread-control-st.ts +2 -1
- package/src/serve/hub-app/review/thread-control.tsx +4 -4
- package/src/serve/hub-app/review/thread-st.ts +710 -140
- package/src/serve/hub-app/review/thread-views.ts +71 -0
- package/src/serve/hub-app/review/{trailer-card.tsx → trailer-body.tsx} +35 -35
- package/src/serve/hub-app/review/trailer-page.tsx +23 -25
- package/src/serve/hub-app/review/trailer-st.ts +38 -38
- package/src/serve/hub-app/review/trailer-timeline.tsx +24 -20
- package/src/serve/hub-app/review/trailer-voices.tsx +3 -2
- package/src/serve/hub-app/review.css +459 -188
- package/src/serve/hub-app/search-st.ts +138 -0
- package/src/serve/hub-app/search-view.tsx +92 -0
- package/src/serve/hub-app/section-head.tsx +52 -0
- package/src/serve/hub-app/shell-rows.ts +126 -0
- package/src/serve/hub-app/site/site-st.ts +18 -23
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +36 -20
- package/src/serve/hub-app/social/group-editor.tsx +44 -0
- package/src/serve/hub-app/social/kit.tsx +15 -61
- package/src/serve/hub-app/social/next-release.tsx +5 -7
- package/src/serve/hub-app/social/post-card.tsx +19 -52
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +9 -12
- package/src/serve/hub-app/social/social-model.ts +13 -5
- package/src/serve/hub-app/social/social-page.tsx +4 -4
- package/src/serve/hub-app/social/social-st.ts +67 -83
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social/stage-st.ts +9 -9
- package/src/serve/hub-app/social.css +7 -25
- package/src/serve/hub-app/space-st.ts +38 -48
- package/src/serve/hub-app/space-view.tsx +6 -6
- package/src/serve/hub-app/space.css +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +10 -6
- package/src/serve/hub-app/stores/stores-st.ts +19 -23
- package/src/serve/hub-app/terminal-input.ts +12 -0
- package/src/serve/hub-app/terminal-panel.tsx +40 -0
- package/src/serve/hub-app/terminal-st.ts +416 -0
- package/src/serve/hub-app/terminal.css +15 -0
- package/src/serve/hub-app/tests-svc.ts +3 -2
- package/src/serve/hub-app/theme-st.ts +1 -9
- package/src/serve/hub-app/thread-row.tsx +136 -0
- package/src/serve/hub-app/time-ago.tsx +40 -16
- package/src/serve/hub-app/time-st.ts +43 -27
- package/src/serve/hub-app/time-view.tsx +4 -3
- package/src/serve/hub-app/time.css +2 -5
- package/src/serve/hub-app/tree-build.ts +2 -2
- package/src/serve/hub-app/tree-row.tsx +44 -27
- package/src/serve/hub-app/tree-svc.ts +1 -1
- package/src/serve/hub-app/urls-svc.ts +6 -5
- package/src/serve/hub-app/vault-st.ts +32 -27
- package/src/serve/hub-app/vault-view.tsx +57 -6
- package/src/serve/hub-app/vault.css +2 -0
- package/src/serve/hub-app/veille/veille-page.tsx +5 -14
- package/src/serve/hub-app/veille/veille-st.ts +56 -49
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/view-layout.css +90 -0
- package/src/serve/hub-app/waiting-svc.ts +5 -4
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +33 -6
- package/src/serve/hub-app/wikis-view.tsx +22 -18
- package/src/serve/hub-app/words.tsx +15 -0
- package/src/serve/hub-collections.ts +105 -0
- package/src/serve/hub-runtime.ts +83 -91
- package/src/serve/live-hop.ts +102 -0
- package/src/serve/other-repos.ts +1 -1
- package/src/serve/project-gutter-route.ts +69 -46
- package/src/serve/read-thread.ts +76 -0
- package/src/serve/read-worker.ts +53 -0
- package/src/serve/run-serve.ts +11 -7
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +129 -51
- package/src/serve/terminal-guard.ts +50 -0
- package/src/serve/terminal-route.ts +176 -0
- package/src/shipkit.ts +10 -10
- package/src/shot/client.ts +32 -16
- package/src/shot/dom-clip.ts +30 -5
- package/src/shot/film-box.ts +23 -8
- package/src/shot/serve-shot.ts +16 -5
- package/src/shot/shooter.ts +72 -24
- package/src/shot/shot-ask.ts +17 -6
- package/src/shot/shot-guard.ts +53 -0
- package/src/shot/shot-theme.ts +70 -0
- package/src/shot/still-file.ts +60 -0
- package/src/site/desk.ts +6 -5
- package/src/smoke/run-smoke.ts +3 -4
- package/src/social/brands.ts +4 -0
- package/src/social/compose.ts +13 -7
- package/src/social/cover.ts +4 -3
- package/src/social/desk-index.ts +34 -13
- package/src/social/draft-doc.ts +88 -0
- package/src/social/draft-versions.ts +80 -0
- package/src/social/drafts.ts +26 -8
- package/src/social/fit.ts +4 -3
- package/src/social/house.ts +1 -1
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +2 -2
- package/src/social/load.ts +106 -73
- package/src/social/media-facts.ts +1 -19
- package/src/social/media-kind.ts +68 -161
- package/src/social/media-limit.ts +3 -18
- package/src/social/media-of.ts +5 -4
- package/src/social/no-account.ts +38 -0
- 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 +123 -0
- package/src/social/posts.ts +433 -0
- package/src/social/presence.ts +17 -13
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +76 -75
- package/src/social/routes.ts +72 -50
- package/src/social/stage.ts +45 -60
- package/src/social/stats.ts +3 -4
- package/src/social/strip.ts +4 -6
- package/src/social/text.ts +6 -4
- package/src/social/thread-drafts.ts +16 -0
- package/src/social/thumbnail.ts +135 -43
- package/src/social/tracker.ts +1 -1
- package/src/social/unit.ts +12 -3
- package/src/social/writes.ts +8 -31
- package/src/start-repo.ts +33 -13
- package/src/stores/desk.ts +17 -12
- package/src/stores/unit.ts +2 -2
- package/src/suite/core-counters.ts +31 -3
- package/src/suite/judge-suites.ts +69 -47
- package/src/suite/select.ts +1 -27
- package/src/suite/suite-cli.ts +18 -8
- package/src/suite/suite-cpu-preload.ts +10 -6
- package/src/trace/tracer.ts +4 -5
- package/src/trailer/build.ts +30 -15
- package/src/trailer/ffmpeg.ts +90 -31
- package/src/trailer/fonts.ts +5 -6
- package/src/trailer/footage.ts +9 -3
- package/src/trailer/grammar.ts +2 -1
- package/src/trailer/graph.ts +12 -10
- package/src/trailer/load-unit.ts +1 -1
- package/src/trailer/passage.ts +4 -3
- package/src/trailer/prune.ts +4 -4
- package/src/trailer/score/sound.ts +3 -3
- package/src/trailer/shot-plan.ts +5 -5
- package/src/trailer/shot-state.ts +25 -31
- package/src/trailer/sound/eleven.ts +34 -3
- package/src/trailer/sound/gen.ts +3 -3
- package/src/trailer/sound/run.ts +76 -64
- package/src/trailer/sound/takes.ts +0 -3
- package/src/trailer/take-fault.ts +41 -0
- package/src/trailer/titles.ts +17 -13
- package/src/trailer/url.ts +1 -1
- package/src/trailer/vertical-draw.ts +7 -7
- package/src/trailer/vertical.ts +3 -3
- package/src/trailer/vocab.ts +3 -4
- package/src/ts/config.ts +60 -24
- package/src/ts/cycles.ts +3 -1
- package/src/ts/imports.ts +17 -3
- package/src/ts/rename.ts +6 -7
- package/src/ts/source-graph.ts +15 -9
- package/src/ts/workspaces.ts +26 -0
- package/src/tui/build-steps-panel.ts +3 -3
- package/src/tui/checks-panel.ts +2 -2
- package/src/urls/frame.ts +3 -3
- package/src/urls/routes.ts +1 -1
- package/src/urls/rows.ts +2 -2
- package/src/vault/house-keys.ts +1 -1
- package/src/vault/vault-audit.ts +2 -3
- package/src/vault/vault-config.ts +6 -2
- package/src/vault/vault-http.ts +11 -3
- package/src/vault/vault-import.ts +6 -1
- package/src/vault/vault-restore.ts +3 -9
- package/src/vault/vault-serve.ts +47 -11
- package/src/vault/vault-snapshot.ts +5 -14
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/veille/routes.ts +1 -1
- package/src/view3d/cam.ts +101 -0
- package/src/view3d/lib.ts +69 -0
- package/src/view3d/loop.ts +39 -0
- package/src/view3d/scene-cache.ts +62 -0
- package/src/view3d/viewer.ts +480 -0
- package/src/wiki/agent-paths.ts +55 -0
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/run-wiki.ts +4 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/wiki/serve-graph.ts +2 -3
- package/src/asks/asks-queue.ts +0 -424
- package/src/core/run-fix.ts +0 -120
- package/src/home/hmr-keep.ts +0 -134
- package/src/messages/suggest.ts +0 -96
- package/src/review/draft-card.ts +0 -41
- package/src/serve/hub-app/review/draft-card.tsx +0 -163
- package/src/serve/hub-app/review/note-place.ts +0 -31
- package/src/social/card-drafts.ts +0 -24
- package/src/social/migrate.ts +0 -123
- /package/src/{serve → http}/door-names.ts +0 -0
- /package/src/{serve → http}/hub-port.ts +0 -0
package/src/review/cells.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
// a thread read as one conversation (wiki tools/shipkit/threads.md, The thread): every version of
|
|
1
|
+
// a thread read as one conversation (wiki tools/shipkit/threads.md, The thread): every version of the thread, every verdict,
|
|
2
2
|
// reply, note and state change is one cell, in time order, built at read time from the store's files (a supersedes chain
|
|
3
3
|
// folds into one thread, nothing is rewritten). The paged list's rows and its query. Pure and browser safe: the routes
|
|
4
4
|
// send these shapes, the hub page draws them
|
|
5
5
|
import {
|
|
6
|
+
type AnswerKind,
|
|
7
|
+
canonicalAddress,
|
|
6
8
|
inWork,
|
|
7
9
|
UPDATE_WORDS,
|
|
8
10
|
updatesOf,
|
|
11
|
+
appliedFields,
|
|
12
|
+
proposeFields,
|
|
13
|
+
proposeOpen,
|
|
14
|
+
type ProposeField,
|
|
9
15
|
type UpdateState,
|
|
10
16
|
isMarkItem,
|
|
11
17
|
isReply,
|
|
@@ -16,15 +22,16 @@ import {
|
|
|
16
22
|
reworkOf,
|
|
17
23
|
stateOf,
|
|
18
24
|
STATUS_LABEL,
|
|
25
|
+
verdictLabel,
|
|
19
26
|
thumbFileOf,
|
|
20
27
|
firstView,
|
|
21
28
|
isGallery,
|
|
22
29
|
isPair,
|
|
23
|
-
unreadBy,
|
|
24
30
|
verdictOf,
|
|
25
31
|
type Item,
|
|
26
32
|
type ItemState,
|
|
27
33
|
type Message,
|
|
34
|
+
type MessageFile,
|
|
28
35
|
type Move,
|
|
29
36
|
type Op,
|
|
30
37
|
type Origin,
|
|
@@ -37,9 +44,25 @@ import {
|
|
|
37
44
|
type Subject,
|
|
38
45
|
type Verdict,
|
|
39
46
|
parentAddress,
|
|
47
|
+
isAskItem,
|
|
48
|
+
handedOver,
|
|
49
|
+
ownSave,
|
|
50
|
+
type AskState,
|
|
51
|
+
LAPSE_LATER,
|
|
40
52
|
} from './model.ts'
|
|
41
|
-
import {
|
|
42
|
-
|
|
53
|
+
import { holdsOf, type Hold } from './holds.ts'
|
|
54
|
+
import { threadTitle, askStateOf, asideUntil, closedAt, addressesOfThread, ownAddressesOf, followedIds, holderOf, isActive, membersOf, openingOf, orderedThreads, sinceHeLeft, statusOf, turnOf, waits, type Thread, type Turn } from './threads.ts'
|
|
55
|
+
import { askOpen, kindCellAsk } from './answer-kinds.ts'
|
|
56
|
+
import { currentInstructions, replacersOf, titleOf } from './supersede.ts'
|
|
57
|
+
import { judgeOf, type MessageVerdict } from './verdict-items.ts'
|
|
58
|
+
import { cursorOf, supersedeTrace, traceOf, traceWords, workingsOf, type Cursor, type Trace, type TraceCtx } from './traces.ts'
|
|
59
|
+
import { laneAskOf, type LaneAsk } from './lane-ask.ts'
|
|
60
|
+
import { heardOf, type Heard } from './heard.ts'
|
|
61
|
+
import { mutedOf } from './phone-push.ts'
|
|
62
|
+
import { validatedOf } from './band.ts'
|
|
63
|
+
import { countsUnread, newToOwner, ownerCursorAt, type Fresh } from './owner-read.ts'
|
|
64
|
+
import { settledSpots, versionActs } from './settle.ts'
|
|
65
|
+
import { verbsOf, waitEntryOf, waitsMatch, type WaitsOn, waitsOfParam, type OwnerWait, type Wait } from './wait.ts'
|
|
43
66
|
export type CellKind = 'version' | 'verdict' | 'reply' | 'note' | 'event'
|
|
44
67
|
|
|
45
68
|
interface CellOf<K extends CellKind> {
|
|
@@ -52,20 +75,35 @@ interface CellOf<K extends CellKind> {
|
|
|
52
75
|
at: string
|
|
53
76
|
/** `owner`, `player`, or the agent's lane */
|
|
54
77
|
who: string
|
|
78
|
+
/** an agent's Claude Code session: a session's own act is named by it (review/parties.ts actorName) */
|
|
79
|
+
session?: string
|
|
55
80
|
party: Party
|
|
56
81
|
/** the one line a folded cell shows */
|
|
57
82
|
summary: string
|
|
58
83
|
/** unfolded when the thread opens: the latest version, the owner's latest answer, what the owner has not read, what came after the
|
|
59
84
|
* latest version; everything older folded */
|
|
60
85
|
open: boolean
|
|
86
|
+
/** a newer object supersedes it (review/supersede.ts): the cell of that one and its title; it folds to one line,
|
|
87
|
+
* waits on nobody and keeps its answers */
|
|
88
|
+
/** a newer object superseded it, or its agent withdrew it (`withdrawn`, its title « withdrawn: <why> ») */
|
|
89
|
+
superseded?: { by: string; title: string; withdrawn?: true }
|
|
90
|
+
/** an act with no words of its own (an event, his bare verdict): drawn as one trace line (review/traces.ts) */
|
|
91
|
+
trace?: Trace
|
|
92
|
+
/** his word that wakes an agent (review/wakes.ts): the first agent read of it, null while no agent read it */
|
|
93
|
+
heard?: Heard | null
|
|
61
94
|
}
|
|
62
95
|
|
|
63
|
-
|
|
96
|
+
|
|
97
|
+
/** an agent's post: one version of the thread, its markdown and its views */
|
|
64
98
|
export interface VersionCell extends CellOf<'version'> {
|
|
65
99
|
/** 1 for the first version */
|
|
66
100
|
n: number
|
|
67
101
|
item: Item
|
|
68
102
|
status: ShownStatus
|
|
103
|
+
/** its status as he reads it: a draft's place fix names the place (model.ts verdictLabel) */
|
|
104
|
+
label: string
|
|
105
|
+
/** a version answered by its kind's acts: its spots settled now, by key (review/settle.ts) */
|
|
106
|
+
settled?: string[]
|
|
69
107
|
}
|
|
70
108
|
|
|
71
109
|
/** the owner's verdict on one version: as written in that message, never merged with an earlier one */
|
|
@@ -79,6 +117,8 @@ export interface VerdictCell extends CellOf<'verdict'> {
|
|
|
79
117
|
pick?: number
|
|
80
118
|
/** the verdict the version holds now: the latest since the last reopen */
|
|
81
119
|
current: boolean
|
|
120
|
+
/** the owner's verdict on a message that asked it, not on the version: that message's cell id */
|
|
121
|
+
judges?: string
|
|
82
122
|
/** an agent marked it seen */
|
|
83
123
|
read: boolean
|
|
84
124
|
}
|
|
@@ -88,6 +128,8 @@ export interface ReplyCell extends CellOf<'reply'> {
|
|
|
88
128
|
text: string
|
|
89
129
|
/** a file of the item's `thread/` */
|
|
90
130
|
image?: string
|
|
131
|
+
/** files of any kind attached to it, each a file of the item's `thread/` */
|
|
132
|
+
files?: MessageFile[]
|
|
91
133
|
op?: 'ask' | 'answer'
|
|
92
134
|
/** the other party marked it seen */
|
|
93
135
|
read: boolean
|
|
@@ -96,13 +138,45 @@ export interface ReplyCell extends CellOf<'reply'> {
|
|
|
96
138
|
/** his hint on an update: the update's cell id, its number and state */
|
|
97
139
|
re?: { id: string; k: number; state: UpdateState }
|
|
98
140
|
/** an agent's question: its options, its pick, and the owner's answer once given (the option, the words) */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
141
|
+
/** a question: `kind` absent on a choice; a checklist's and a confirm's lines with his ticks; a text's, a url's or a
|
|
142
|
+
* file's value; a secret's name and when it was stored, never a value; `open` while it waits on him */
|
|
143
|
+
ask?: { kind?: AnswerKind; options: string[]; pick?: number; views?: (number | null)[]; answered?: { option: number; text: string; at: string }; open?: boolean; lines?: { text: string; tick: boolean; at: string | null; pick?: number }[]; choices?: ({ options: string[]; pick?: number } | null)[]; value?: { text: string; at: string; opens?: number; view?: number }; secret?: { name: string; login?: boolean; stored?: string }; none?: string }
|
|
144
|
+
/** an agent's proposed change of an object: each field, drawn by its type, and whether he applied it (the value he
|
|
145
|
+
* applied, the owner's edit or not); `open` while it waits on him; `page` the repo's page that draws it */
|
|
146
|
+
propose?: { on: string; fields: (ProposeField & { applied?: { text: string; at: string } })[]; open: boolean; page?: string }
|
|
147
|
+
/** the owner clicked one of the kind's actions */
|
|
148
|
+
action?: { name: string }
|
|
149
|
+
/** a request written before his close and never answered: it waits on nobody, it reads « closed, not answered » */
|
|
150
|
+
moot?: true
|
|
102
151
|
/** his answer to a question or a proposal: the cell it answers */
|
|
103
152
|
answers?: string
|
|
153
|
+
/** it asks the owner's verdict (review/verdict-items.ts): `open` while it has none and nothing supersedes it, the owner's newest one */
|
|
154
|
+
judge?: { open: boolean; verdict?: MessageVerdict }
|
|
104
155
|
/** the objects this message linked to the thread */
|
|
105
156
|
about?: string[]
|
|
157
|
+
/** the parties his word names with `@`, by name (review/mentions.ts); an advisor's copy says `you` alone */
|
|
158
|
+
to?: string[]
|
|
159
|
+
/** an ask's instructions: its words in `text` are markdown (its steps in `ask`, review/instructions.ts), its title,
|
|
160
|
+
* and the agent's check, which the hub folds under the steps */
|
|
161
|
+
instructions?: { title: string; check: string | null }
|
|
162
|
+
/** the owner's save of the object from the hub's editor: the cell of the version it made (or went over), the lines it
|
|
163
|
+
* changed (`- ` gone, `+ ` new) */
|
|
164
|
+
edit?: { of: string; diff: string[] }
|
|
165
|
+
/** a field inside a step of an ask's instructions: drawn in that step (`of`: their message id), never on its own */
|
|
166
|
+
step?: { of: string; i: number }
|
|
167
|
+
/** an agent's link to an object that has its own thread (a reflection it wrote): what it is, its opening words, its
|
|
168
|
+
* thread done (a reflection folded or deleted), and the owner's newest action on this link */
|
|
169
|
+
linked?: Linked[]
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface Linked {
|
|
173
|
+
address: string
|
|
174
|
+
title: string
|
|
175
|
+
md: string
|
|
176
|
+
/** its own thread, while one stands on it */
|
|
177
|
+
home?: string
|
|
178
|
+
done: boolean
|
|
179
|
+
decided?: { name: string; text: string; at: string }
|
|
106
180
|
}
|
|
107
181
|
|
|
108
182
|
/** what the owner or a player raised (its item, its opening words and rectangles), or the owner's mark on the subject */
|
|
@@ -116,19 +190,20 @@ export interface NoteCell extends CellOf<'note'> {
|
|
|
116
190
|
read: boolean
|
|
117
191
|
}
|
|
118
192
|
|
|
119
|
-
/** a state change: one
|
|
193
|
+
/** an act on an object (a state change, his pick, an agent's read): one trace line, never a framed cell */
|
|
120
194
|
export interface EventCell extends CellOf<'event'> {
|
|
121
|
-
op
|
|
195
|
+
op?: Op
|
|
122
196
|
note?: string
|
|
123
197
|
topic?: string
|
|
124
198
|
commit?: string
|
|
199
|
+
trace: Trace
|
|
125
200
|
}
|
|
126
201
|
|
|
127
202
|
export type Cell = VersionCell | VerdictCell | ReplyCell | NoteCell | EventCell
|
|
128
203
|
|
|
129
|
-
/** one thread as the per
|
|
204
|
+
/** one thread as the per thread api sends it: the head's state, then every cell in time order */
|
|
130
205
|
export interface ThreadView {
|
|
131
|
-
/** the newest version, or the raised item no
|
|
206
|
+
/** the newest version, or the raised item no version answers */
|
|
132
207
|
head: string
|
|
133
208
|
/** the item id asked for, its cell's id too: an old version's id opens its thread at that version */
|
|
134
209
|
asked: string
|
|
@@ -150,13 +225,36 @@ export interface ThreadView {
|
|
|
150
225
|
forks: string[]
|
|
151
226
|
/** every item of the thread: the versions oldest first, then the raised items */
|
|
152
227
|
members: string[]
|
|
153
|
-
/**
|
|
154
|
-
|
|
228
|
+
/** what an agent wrote after his cursor (review/owner-read.ts), oldest first: opening the thread reads up to its newest */
|
|
229
|
+
fresh: Fresh[]
|
|
230
|
+
/** his cursor: when he last read or acted in the thread, '' before his first */
|
|
231
|
+
cursorAt: string
|
|
155
232
|
/** the media files a view names that the store no longer holds, `<item id>/<name>`: the page says so in place of a
|
|
156
233
|
* broken player (the routes fill it, the model never reads the disk) */
|
|
157
234
|
missing: string[]
|
|
158
|
-
/** the social drafts naming this
|
|
235
|
+
/** the social drafts naming this item in their `review:`, oldest first (the routes fill it, the model never reads the disk) */
|
|
159
236
|
drafts: { slug: string; title: string }[]
|
|
237
|
+
/** an ask's thread: its ask's id, where it stands and the title of its newest instructions (wiki
|
|
238
|
+
* tools/shipkit/threads-asks.md, An ask's thread) */
|
|
239
|
+
/** `lapses`: the secret a refresh ask renews, so the bar offers « later »; `parked`: his « later » closed it */
|
|
240
|
+
ask?: { id: string; state: AskState; title: string; into?: { id: string; head: string | null }; lapses?: string; parked?: true }
|
|
241
|
+
/** set aside until this time, his turn again then */
|
|
242
|
+
aside?: string
|
|
243
|
+
/** his bell is off: nothing of it pushes to his phone (review/phone-push.ts) */
|
|
244
|
+
muted?: true
|
|
245
|
+
/** who acts now on the thread */
|
|
246
|
+
turn: Turn
|
|
247
|
+
/** who holds it and where his newest word stands: the head draws them from the thread, never from a list row */
|
|
248
|
+
holder?: { lane?: string; session?: string }
|
|
249
|
+
cursor?: Cursor
|
|
250
|
+
/** the agent of its `working` not ended, `agent` a session's own: with the parties, its band (review/band.ts) */
|
|
251
|
+
working?: string
|
|
252
|
+
/** his request for a lane while it stands (review/lane-ask.ts) */
|
|
253
|
+
laneAsk?: LaneAsk
|
|
254
|
+
/** when he closed it, null while open: a request written before reads « closed, not answered » */
|
|
255
|
+
closedAt: string | null
|
|
256
|
+
/** the objects attached to it that hold or held it open (review/holds.ts) */
|
|
257
|
+
holds: Hold[]
|
|
160
258
|
cells: Cell[]
|
|
161
259
|
}
|
|
162
260
|
|
|
@@ -168,37 +266,49 @@ const firstLine = (s: string | undefined, max = 140): string => {
|
|
|
168
266
|
/** who posted an agent's item, as its cell names it: its lane, else its session's first letters, else « agent » */
|
|
169
267
|
export const agentWho = (o: Origin): string => (o.by === 'auto' ? o.lane : o.by === 'agent' ? (o.lane ?? (o.session ? `agent ${o.session.slice(0, 6)}` : 'agent')) : 'agent')
|
|
170
268
|
|
|
269
|
+
/** an agent item's session, for its cell's name */
|
|
270
|
+
const originSession = (o: Origin): { session?: string } => (o.by === 'agent' && o.session ? { session: o.session } : {})
|
|
271
|
+
|
|
171
272
|
const readBy = (x: ReviewItem, party: Party): Set<string> => new Set(x.thread.flatMap((m) => (m.op === 'seen' && partyOf(m.who) === party ? (m.of ?? []) : [])))
|
|
172
273
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
ready: 'made ready',
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** the cells of one item's messages: a read mark is no cell, it marks the cells it read */
|
|
191
|
-
function messageCells(x: ReviewItem, n: number, opening: Message | undefined): Cell[] {
|
|
274
|
+
/** a trace line's cell: an act with no words of its own */
|
|
275
|
+
const traceCell = (base: Omit<EventCell, 'kind' | 'summary' | 'trace'>, m: Message, trace: Trace): EventCell => ({
|
|
276
|
+
...base,
|
|
277
|
+
kind: 'event',
|
|
278
|
+
...(m.op !== undefined ? { op: m.op } : {}),
|
|
279
|
+
...(m.note !== undefined ? { note: m.note } : {}),
|
|
280
|
+
...(m.topic !== undefined ? { topic: m.topic } : {}),
|
|
281
|
+
...(m.fix?.commit ? { commit: m.fix.commit } : {}),
|
|
282
|
+
trace,
|
|
283
|
+
summary: traceWords(m.who, trace),
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
/** the cells of one item's messages: an act with no words is a trace line (review/traces.ts), an owner's read mark no cell */
|
|
287
|
+
function messageCells(x: ReviewItem, n: number, opening: Message | undefined, gone: Gone, linkOf: LinkOf, ctx: TraceCtx, readObject?: ObjectRead): Cell[] {
|
|
192
288
|
const id = x.item.id
|
|
193
289
|
const current = verdictOf(x)?.id
|
|
194
290
|
const read = { agent: readBy(x, 'agent'), owner: readBy(x, 'owner') }
|
|
195
291
|
const other = (who: string): Party => (partyOf(who) === 'owner' ? 'agent' : 'owner')
|
|
196
292
|
const updates = updatesOf(x)
|
|
293
|
+
// the versions the owner's saves made in this item's thread (an ask's instructions): the owner's, written in no lane's name
|
|
294
|
+
const his = new Set(x.thread.flatMap((m) => (m.edit !== undefined && partyOf(m.who) === 'owner' ? [m.edit.of] : [])))
|
|
197
295
|
const out: Cell[] = []
|
|
198
296
|
for (const m of x.thread) {
|
|
199
|
-
if (m
|
|
297
|
+
if (m === opening) continue
|
|
298
|
+
const trace = traceOf(x, m, n, ctx)
|
|
299
|
+
if ((m.op === 'seen' || m.askBar !== undefined) && trace === null) continue
|
|
300
|
+
const by = gone.get(m.id)
|
|
301
|
+
// a question the ask bar answers draws nowhere: the bar is its one control
|
|
302
|
+
if (by?.bar) continue
|
|
200
303
|
const party = partyOf(m.who)
|
|
201
|
-
const base = { id: `${id}/${m.id}`, on: id, at: m.at, who: m.who, party, open: false }
|
|
304
|
+
const base = { id: `${id}/${m.id}`, on: id, at: m.at, who: his.has(m.id) ? 'owner' : m.who, ...(m.session ? { session: m.session } : {}), party, open: false, ...(by ? { superseded: by } : {}), ...heardOf(x, m) }
|
|
305
|
+
const replaced = supersedeTrace(m, ctx)
|
|
306
|
+
if (replaced !== null) out.push(traceCell({ ...base, id: `${base.id}~replaces` }, m, replaced))
|
|
307
|
+
if (trace !== null && m.verdict === undefined) {
|
|
308
|
+
out.push(traceCell(base, m, trace))
|
|
309
|
+
continue
|
|
310
|
+
}
|
|
311
|
+
if (m.op === 'working') continue
|
|
202
312
|
const wasRead = read[other(m.who)].has(m.id)
|
|
203
313
|
if (m.verdict !== undefined) {
|
|
204
314
|
const picked = m.pick !== undefined ? ` · picked ${x.item.views[m.pick]?.label || `view ${m.pick + 1}`}` : ''
|
|
@@ -214,7 +324,9 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined): C
|
|
|
214
324
|
...(m.pick !== undefined ? { pick: m.pick } : {}),
|
|
215
325
|
current: m.id === current,
|
|
216
326
|
read: wasRead,
|
|
217
|
-
|
|
327
|
+
...(m.re !== undefined ? { judges: `${id}/${m.re}` } : {}),
|
|
328
|
+
...(trace !== null ? { trace } : {}),
|
|
329
|
+
summary: trace !== null ? traceWords(m.who, trace) : `${verdictLabel(x.item, m.verdict, m.reactions)}${picked}${notes}${m.text ? `: ${firstLine(m.text)}` : ''}`,
|
|
218
330
|
})
|
|
219
331
|
} else if (m.rate !== undefined) {
|
|
220
332
|
const r = m.rate
|
|
@@ -229,22 +341,16 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined): C
|
|
|
229
341
|
const re = reOn ? { id: `${id}/${m.re}`, k: rk + 1, state: reOn.state } : undefined
|
|
230
342
|
const said = update ? `${UPDATE_WORDS[update.state]}: ` : re ? `on update ${re.k}: ` : ''
|
|
231
343
|
const reply = x.thread.find((y) => y.re === m.id && y.answer !== undefined && partyOf(y.who) === 'owner')
|
|
232
|
-
|
|
233
|
-
const
|
|
344
|
+
// the owner's words alone on a choice answer it as none of the options
|
|
345
|
+
const words = reply === undefined ? x.thread.find((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner') : undefined
|
|
346
|
+
const ask = m.ask ? (m.ask.kind === undefined || m.ask.kind === 'choice' ? { options: m.ask.options, ...(m.ask.pick !== undefined ? { pick: m.ask.pick } : {}), ...(m.ask.views ? { views: m.ask.views } : {}), ...(reply?.answer?.option !== undefined ? { answered: { option: reply.answer.option, text: reply.text ?? '', at: reply.at } } : {}), open: askOpen(x.thread, m) && !by, ...(words !== undefined ? { none: words.text ?? '' } : {}) } : { ...kindCellAsk(x.thread, m), ...(by ? { open: false } : {}) }) : undefined
|
|
347
|
+
const applied = m.propose ? appliedFields(x.thread, m) : null
|
|
348
|
+
const propose = m.propose
|
|
349
|
+
? { on: m.propose.on, fields: proposeFields(m.propose).map((f) => ({ ...f, ...(applied?.has(f.key) ? { applied: applied.get(f.key)! } : {}) })), open: proposeOpen(x.thread, m) && !by, ...(m.propose.page ? { page: m.propose.page } : {}) }
|
|
350
|
+
: undefined
|
|
234
351
|
const asked = m.answer && m.re ? `${id}/${m.re}` : undefined
|
|
235
|
-
const what = ask ? (ask.
|
|
236
|
-
out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(op ? { op } : {}), read: wasRead, ...(update ? { update } : {}), ...(re ? { re } : {}), ...(ask ? { ask } : {}), ...(propose ? { propose } : {}), ...(asked ? { answers: asked } : {}), ...(m.about ? { about: m.about } : {}), summary: `${what}${said}${firstLine(m.text)}` })
|
|
237
|
-
} else if (m.op !== undefined) {
|
|
238
|
-
const commit = m.fix?.commit
|
|
239
|
-
out.push({
|
|
240
|
-
...base,
|
|
241
|
-
kind: 'event',
|
|
242
|
-
op: m.op,
|
|
243
|
-
...(m.note !== undefined ? { note: m.note } : {}),
|
|
244
|
-
...(m.topic !== undefined ? { topic: m.topic } : {}),
|
|
245
|
-
...(commit ? { commit } : {}),
|
|
246
|
-
summary: `${m.who} ${OP_WORDS[m.op]}${m.topic ? ` to ${m.topic}` : ''}${m.note ? `: ${firstLine(m.note)}` : ''}${commit ? ` (${commit})` : ''}`,
|
|
247
|
-
})
|
|
352
|
+
const what = by ? (by.withdrawn ? `${by.title}: ` : `superseded by « ${by.title} »: `) : m.edit ? 'edited: ' : m.instructions ? 'new instructions: ' : m.action ? `action ${m.action.name}: ` : ask ? ('answered' in ask || ('open' in ask && !ask.open) ? 'answered: ' : 'asks: ') : propose ? (propose.open ? 'proposes: ' : 'applied: ') : asked ? 'answer: ' : ''
|
|
353
|
+
out.push({ ...base, kind: 'reply', text: m.text ?? '', ...(m.image ? { image: m.image } : {}), ...(m.files ? { files: m.files } : {}), ...(op ? { op } : {}), read: wasRead, ...(update ? { update } : {}), ...(re ? { re } : {}), ...(ask ? { ask } : {}), ...(propose ? { propose } : {}), ...(asked ? { answers: asked } : {}), ...(m.about ? { about: m.about } : {}), ...(m.to ? { to: m.to.map((t) => t.name) } : {}), ...(m.action ? { action: { name: m.action.name } } : {}), ...(m.instructions ? { instructions: { title: m.instructions.title, check: m.instructions.ask.check ?? null } } : {}), ...(m.step ? { step: m.step } : {}), ...(m.edit ? { edit: { of: m.edit.of === id ? id : `${x.thread.some((y) => y.id === m.edit!.of) ? `${id}/` : ''}${m.edit.of}`, diff: m.edit.diff } } : {}), ...linkedOf(x, m, linkOf, readObject), ...judgeOf(x.thread, m, by !== undefined), summary: `${what}${said}${firstLine(m.text)}` })
|
|
248
354
|
} else if (m.rects && m.rects.length > 0) {
|
|
249
355
|
// rectangles with no words and no verdict: the owner's note on the item
|
|
250
356
|
out.push({ ...base, kind: 'note', rects: m.rects, ...(m.image ? { image: m.image } : {}), read: wasRead, summary: `${m.rects.length} note${m.rects.length > 1 ? 's' : ''}` })
|
|
@@ -263,6 +369,7 @@ function raisedCell(x: ReviewItem): NoteCell {
|
|
|
263
369
|
on: x.item.id,
|
|
264
370
|
at: x.item.created,
|
|
265
371
|
who: x.item.origin.by === 'player' ? 'player' : x.item.origin.by === 'owner' ? 'owner' : agentWho(x.item.origin),
|
|
372
|
+
...originSession(x.item.origin),
|
|
266
373
|
party: x.item.origin.by === 'owner' || x.item.origin.by === 'player' ? 'owner' : 'agent',
|
|
267
374
|
item: x.item,
|
|
268
375
|
...(o?.text !== undefined ? { text: o.text } : {}),
|
|
@@ -271,17 +378,99 @@ function raisedCell(x: ReviewItem): NoteCell {
|
|
|
271
378
|
read,
|
|
272
379
|
summary: firstLine(o?.text) || x.item.title,
|
|
273
380
|
open: false,
|
|
381
|
+
...(o && x.item.origin.by === 'owner' ? heardOf(x, o) : {}),
|
|
274
382
|
}
|
|
275
383
|
}
|
|
276
384
|
|
|
277
385
|
const rank: Record<CellKind, number> = { version: 0, note: 1, verdict: 2, reply: 3, event: 4 }
|
|
278
386
|
|
|
387
|
+
/** what a linked object says now, read from where it lives (review/object-read.ts: a reflection's file); null when
|
|
388
|
+
* nothing reads it here. The card draws from it whether or not a thread stands on the object */
|
|
389
|
+
export type ObjectRead = (address: string) => { title: string; md: string; standing: boolean } | null
|
|
390
|
+
|
|
391
|
+
/** the thread an address of another thread links to has, by its own address; null for none, or the thread itself */
|
|
392
|
+
type LinkOf = (address: string) => Thread | null
|
|
393
|
+
|
|
394
|
+
function linkResolver(t: Thread, items: readonly ReviewItem[]): LinkOf {
|
|
395
|
+
let own: Map<string, Thread> | null = null
|
|
396
|
+
return (address) => {
|
|
397
|
+
// built once, and only for a thread that links something
|
|
398
|
+
if (own === null) {
|
|
399
|
+
own = new Map()
|
|
400
|
+
for (const o of orderedThreads(items)) for (const a of ownAddressesOf(o)) if (!own.has(a)) own.set(a, o)
|
|
401
|
+
}
|
|
402
|
+
const o = own.get(canonicalAddress(address) ?? address) ?? null
|
|
403
|
+
return o === t ? null : o
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** an agent's link message's linked objects that have their own thread, each with the owner's newest action on it */
|
|
408
|
+
function linkedOf(x: ReviewItem, m: Message, linkOf: LinkOf, readObject?: ObjectRead): { linked?: Linked[] } {
|
|
409
|
+
if (m.about === undefined || partyOf(m.who) !== 'agent') return {}
|
|
410
|
+
const out: Linked[] = []
|
|
411
|
+
for (const address of m.about) {
|
|
412
|
+
const o = linkOf(address)
|
|
413
|
+
const f = readObject?.(address) ?? null
|
|
414
|
+
if (o === null && f === null) continue
|
|
415
|
+
const closed = o !== null && stateOf(o.head, false).state === 'closed'
|
|
416
|
+
const act = x.thread.filter((y) => y.re === m.id && y.action !== undefined && partyOf(y.who) === 'owner').at(-1)
|
|
417
|
+
out.push({
|
|
418
|
+
address,
|
|
419
|
+
title: f?.standing ? f.title : (o?.head.item.title ?? f!.title),
|
|
420
|
+
md: f?.standing ? f.md : (o?.head.item.what ?? ''),
|
|
421
|
+
...(o !== null ? { home: o.head.item.id } : {}),
|
|
422
|
+
done: closed || (f !== null && !f.standing),
|
|
423
|
+
...(act ? { decided: { name: act.action!.name, text: act.text ?? '', at: act.at } } : {}),
|
|
424
|
+
})
|
|
425
|
+
}
|
|
426
|
+
return out.length > 0 ? { linked: out } : {}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** each superseded object's id (a message id, or the head's item id) → the cell of the one that supersedes it */
|
|
430
|
+
type Gone = ReadonlyMap<string, { by: string; title: string; bar?: true; withdrawn?: true }>
|
|
431
|
+
|
|
432
|
+
function goneOf(t: Thread): Gone {
|
|
433
|
+
const members = membersOf(t)
|
|
434
|
+
const home = new Map(members.flatMap((x) => x.thread.map((m) => [m.id, x.item.id] as const)))
|
|
435
|
+
return new Map([...replacersOf(members)].map(([id, m]) => [id, { by: `${home.get(m.id)}/${m.id}`, title: titleOf(m), ...(m.askBar !== undefined ? { bar: true as const } : {}), ...(m.op === 'withdraw' ? { withdrawn: true as const } : {}) }]))
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** what a trace line reads across the thread: the agents' workings that ended, any message or item by its id */
|
|
439
|
+
function traceCtxOf(t: Thread): TraceCtx {
|
|
440
|
+
const members = membersOf(t)
|
|
441
|
+
const msg = new Map(members.flatMap((x) => x.thread.map((m) => [m.id, { x, m }] as const)))
|
|
442
|
+
const item = new Map(members.map((x) => [x.item.id, x] as const))
|
|
443
|
+
return {
|
|
444
|
+
ended: workingsOf(t).ended,
|
|
445
|
+
cell: (id) => (msg.has(id) ? `${msg.get(id)!.x.item.id}/${id}` : item.has(id) ? id : null),
|
|
446
|
+
title: (id) => (msg.has(id) ? titleOf(msg.get(id)!.m) : (item.get(id)?.item.title ?? null)),
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** a run of takes with nothing between them (a holder passed on and taken back, again and again) reads as its last
|
|
451
|
+
* take, once: « took the thread: handed back and forth 20× »; a single pass and its take back stay two lines */
|
|
452
|
+
function foldTakes(cells: Cell[]): void {
|
|
453
|
+
const isTake = (c: Cell | undefined): c is EventCell => c?.kind === 'event' && c.op === 'take'
|
|
454
|
+
for (let i = 0; i < cells.length; i++) {
|
|
455
|
+
let j = i
|
|
456
|
+
while (isTake(cells[j])) j++
|
|
457
|
+
if (j - i >= 3) {
|
|
458
|
+
const last = cells[j - 1] as EventCell
|
|
459
|
+
const trace = { ...last.trace, did: `${last.trace.did}: handed back and forth ${Math.ceil((j - i) / 2)}×` }
|
|
460
|
+
cells.splice(i, j - i, { ...last, trace, summary: traceWords(last.who, trace) })
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
279
465
|
/** every cell of a thread in time order: each version, then what was said on it; a raised item it answers where it was
|
|
280
466
|
* raised. Folding: the latest version, the owner's latest answer, what the owner has not read and everything after the latest version
|
|
281
467
|
* open; everything older folded */
|
|
282
|
-
export function cellsOf(t: Thread, items: readonly ReviewItem[]): Cell[] {
|
|
468
|
+
export function cellsOf(t: Thread, items: readonly ReviewItem[], readObject?: ObjectRead): Cell[] {
|
|
283
469
|
const chain = [...t.versions].reverse()
|
|
284
470
|
const cells: Cell[] = []
|
|
471
|
+
const gone = goneOf(t)
|
|
472
|
+
const linkOf = linkResolver(t, items)
|
|
473
|
+
const ctx = traceCtxOf(t)
|
|
285
474
|
chain.forEach((x, i) => {
|
|
286
475
|
if (x.item.origin.by === 'agent') {
|
|
287
476
|
cells.push({
|
|
@@ -289,35 +478,55 @@ export function cellsOf(t: Thread, items: readonly ReviewItem[]): Cell[] {
|
|
|
289
478
|
id: x.item.id,
|
|
290
479
|
on: x.item.id,
|
|
291
480
|
at: x.item.created,
|
|
292
|
-
|
|
481
|
+
// a draft or a document he saved himself (his edit in the hub) is his version, written by the machine
|
|
482
|
+
who: ownSave(x.item) || x.item.draft?.by === 'owner' ? 'owner' : agentWho(x.item.origin),
|
|
483
|
+
...originSession(x.item.origin),
|
|
293
484
|
party: 'agent',
|
|
294
485
|
n: i + 1,
|
|
295
486
|
item: x.item,
|
|
296
487
|
status: statusOf(x, items),
|
|
297
|
-
|
|
488
|
+
label: verdictLabel(x.item, statusOf(x, items), verdictOf(x)?.reactions),
|
|
489
|
+
...(versionActs(x.item) !== null ? { settled: [...settledSpots(x)] } : {}),
|
|
490
|
+
// a draft's first version has no change to say, and its places are its head's: its title
|
|
491
|
+
summary: gone.has(x.item.id) ? `superseded by « ${gone.get(x.item.id)!.title} »` : (x.item.draft && x.item.supersedes === undefined ? '' : firstLine(x.item.what)) || x.item.title,
|
|
298
492
|
open: false,
|
|
493
|
+
...(gone.has(x.item.id) ? { superseded: gone.get(x.item.id)! } : {}),
|
|
299
494
|
})
|
|
300
|
-
cells.push(...messageCells(x, i + 1, undefined))
|
|
495
|
+
cells.push(...messageCells(x, i + 1, undefined, gone, linkOf, ctx, readObject))
|
|
301
496
|
} else {
|
|
302
497
|
// a raised item is no version: a verdict on it names no `vN`
|
|
303
498
|
cells.push(raisedCell(x))
|
|
304
|
-
cells.push(...messageCells(x, 0, openingOf(x)))
|
|
499
|
+
cells.push(...messageCells(x, 0, openingOf(x), gone, linkOf, ctx, readObject))
|
|
305
500
|
}
|
|
306
501
|
})
|
|
307
502
|
for (const x of t.answers) {
|
|
308
503
|
cells.push(raisedCell(x))
|
|
309
|
-
cells.push(...messageCells(x, 0, openingOf(x)))
|
|
504
|
+
cells.push(...messageCells(x, 0, openingOf(x), gone, linkOf, ctx, readObject))
|
|
310
505
|
}
|
|
311
506
|
cells.sort((a, b) => a.at.localeCompare(b.at) || rank[a.kind] - rank[b.kind] || a.id.localeCompare(b.id))
|
|
507
|
+
foldTakes(cells)
|
|
312
508
|
const last = t.head.item.id
|
|
313
509
|
const latest = cells.find((c) => c.id === last)
|
|
314
510
|
// no findLast: a consumer's own typecheck reads this source, under whatever lib its tsconfig names
|
|
315
511
|
const answer = [...cells].reverse().find((c) => c.party === 'owner' && c.kind !== 'event' && c.id !== last)
|
|
316
|
-
|
|
512
|
+
// an agent word is read once his cursor passed it (review/owner-read.ts), marked or not; an unread word stays open
|
|
513
|
+
const unreadIds = new Set(newToOwner(membersOf(t)).flatMap((f) => (f.id.includes('/') ? [f.id] : [])))
|
|
317
514
|
for (const c of cells) {
|
|
318
515
|
if (c.kind === 'event') continue
|
|
319
|
-
c.
|
|
516
|
+
if ((c.kind === 'reply' || c.kind === 'note') && c.party === 'agent') c.read = !unreadIds.has(c.id)
|
|
517
|
+
// a message dated at the newest version's own instant (an ask's steps, posted as its thread opens) is part of it
|
|
518
|
+
c.open = c.superseded === undefined && (c === latest || c === answer || unreadIds.has(c.id) || (latest !== undefined && c.at >= latest.at))
|
|
320
519
|
}
|
|
520
|
+
const cut = closedAt(t)
|
|
521
|
+
if (cut !== null)
|
|
522
|
+
for (const c of cells) {
|
|
523
|
+
if (c.kind !== 'reply' || c.party !== 'agent' || c.at > cut || !((c.ask !== undefined && (c.ask.open ?? c.ask.answered === undefined)) || c.propose?.open || c.judge?.open)) continue
|
|
524
|
+
if (c.ask) c.ask = { ...c.ask, open: false }
|
|
525
|
+
if (c.propose) c.propose = { ...c.propose, open: false }
|
|
526
|
+
if (c.judge) c.judge = { ...c.judge, open: false }
|
|
527
|
+
c.moot = true
|
|
528
|
+
c.summary = `closed, not answered: ${firstLine(c.text)}`
|
|
529
|
+
}
|
|
321
530
|
return cells
|
|
322
531
|
}
|
|
323
532
|
|
|
@@ -332,8 +541,25 @@ export function threadOfId(id: string, threads: readonly Thread[]): Thread | nul
|
|
|
332
541
|
return holding.sort((a, b) => b.head.item.created.localeCompare(a.head.item.created))[0] ?? null
|
|
333
542
|
}
|
|
334
543
|
|
|
335
|
-
/** one thread for the per
|
|
336
|
-
|
|
544
|
+
/** one thread for the per item api; `asked` the id the caller named (an old version opens at its cell) */
|
|
545
|
+
/** an ask's state on its thread's view; a merged one names the ask it went into and that thread's head, so the bar
|
|
546
|
+
* links to it (null when that thread is gone) */
|
|
547
|
+
function askCellOf(t: Thread, threads: readonly Thread[]): NonNullable<ThreadView['ask']> {
|
|
548
|
+
const s = askStateOf(t)
|
|
549
|
+
const into = s?.state === 'merged' && s.into !== undefined ? s.into : null
|
|
550
|
+
const head = into === null ? null : (threads.find((x) => x.head.item.on === `ask:${into}`)?.head.item.id ?? null)
|
|
551
|
+
const lapses = currentInstructions(membersOf(t))?.instructions.ask.lapses ?? t.head.item.ask?.lapses
|
|
552
|
+
return {
|
|
553
|
+
id: (t.head.item.on ?? '').slice('ask:'.length),
|
|
554
|
+
state: s?.state ?? 'open',
|
|
555
|
+
title: threadTitle(t),
|
|
556
|
+
...(into !== null ? { into: { id: into, head } } : {}),
|
|
557
|
+
...(lapses !== undefined ? { lapses } : {}),
|
|
558
|
+
...(s?.state === 'declined' && s.why === LAPSE_LATER ? { parked: true as const } : {}),
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export function threadView(t: Thread, items: readonly ReviewItem[], threads: readonly Thread[], asked: string, now = new Date(), readObject?: ObjectRead): ThreadView {
|
|
337
563
|
const h = t.head
|
|
338
564
|
const followed = followedIds(items)
|
|
339
565
|
const state = stateOf(h, followed.has(h.item.id))
|
|
@@ -343,10 +569,14 @@ export function threadView(t: Thread, items: readonly ReviewItem[], threads: rea
|
|
|
343
569
|
return {
|
|
344
570
|
head: h.item.id,
|
|
345
571
|
asked,
|
|
346
|
-
title:
|
|
572
|
+
title: threadTitle(t),
|
|
347
573
|
subject: h.item.subject,
|
|
348
574
|
...(h.item.topic ? { topic: h.item.topic } : {}),
|
|
349
575
|
...(lane ? { lane } : {}),
|
|
576
|
+
...holderRow(t),
|
|
577
|
+
...cursorRow(t, now),
|
|
578
|
+
...workingRow(t, now),
|
|
579
|
+
...laneAskRow(t),
|
|
350
580
|
origin: h.item.origin,
|
|
351
581
|
status: statusOf(h, items),
|
|
352
582
|
state,
|
|
@@ -358,12 +588,17 @@ export function threadView(t: Thread, items: readonly ReviewItem[], threads: rea
|
|
|
358
588
|
versions: t.versions.length,
|
|
359
589
|
forks,
|
|
360
590
|
members: idsOf(t),
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
.map((x) => x.item.id),
|
|
591
|
+
fresh: newToOwner(membersOf(t)),
|
|
592
|
+
cursorAt: ownerCursorAt(membersOf(t)),
|
|
364
593
|
missing: [],
|
|
365
594
|
drafts: [],
|
|
366
|
-
|
|
595
|
+
...(isAskItem(t.head.item) ? { ask: askCellOf(t, threads) } : {}),
|
|
596
|
+
...(asideUntil(t, now) !== null ? { aside: asideUntil(t, now)! } : {}),
|
|
597
|
+
...(mutedOf(t) ? { muted: true as const } : {}),
|
|
598
|
+
turn: turnOf(t, now),
|
|
599
|
+
closedAt: closedAt(t),
|
|
600
|
+
holds: holdsOf(membersOf(t)),
|
|
601
|
+
cells: cellsOf(t, items, readObject),
|
|
367
602
|
}
|
|
368
603
|
}
|
|
369
604
|
|
|
@@ -399,15 +634,33 @@ export interface ThreadRow {
|
|
|
399
634
|
update?: { state: UpdateState; text: string; at: string }
|
|
400
635
|
waits: boolean
|
|
401
636
|
active: boolean
|
|
402
|
-
/** agent
|
|
637
|
+
/** an agent wrote after his cursor (review/owner-read.ts): a version or words new to him */
|
|
403
638
|
unread: boolean
|
|
404
639
|
rework: { lane: string; since: string; until: number } | null
|
|
405
|
-
/** every item id of the thread, the versions oldest first then the raised items: an old
|
|
640
|
+
/** every item id of the thread, the versions oldest first then the raised items: an old version's link finds its row */
|
|
406
641
|
ids: string[]
|
|
407
642
|
/** who acts now: the owner, an agent, nobody */
|
|
408
643
|
turn: Turn
|
|
409
|
-
/**
|
|
410
|
-
|
|
644
|
+
/** what it waits on from him (review/wait.ts): the inbox's verb, the list's « what I must do » */
|
|
645
|
+
wait: Wait
|
|
646
|
+
/** what waits on him first, the icon its row draws (review/wait.ts waitEntryOf) */
|
|
647
|
+
waitsOn?: WaitsOn
|
|
648
|
+
/** on the agents' move after his last word, what still waits on him: a quiet mark, never his turn (review/wait.ts waitEntryOf) */
|
|
649
|
+
owed?: OwnerWait
|
|
650
|
+
/** every verb its open objects ask, the badge's first: what the verbs filter and its counts read (review/wait.ts verbsOf) */
|
|
651
|
+
verbs: OwnerWait[]
|
|
652
|
+
/** set aside: when it comes back, and whether an agent wrote in it since */
|
|
653
|
+
aside?: { until: string; moved: boolean }
|
|
654
|
+
/** the agent that holds it: a live claim's worker, else its newest act; `handed` when that act is a hand-over */
|
|
655
|
+
holder?: { lane?: string; session?: string; handed?: true }
|
|
656
|
+
/** where his newest word stands: an agent on it, else read by one (review/traces.ts cursorOf) */
|
|
657
|
+
cursor?: Cursor
|
|
658
|
+
/** the agent of its `working` not ended, `agent` a session's own: with the parties, its band (review/band.ts) */
|
|
659
|
+
working?: string
|
|
660
|
+
/** his request for a lane while it stands (review/lane-ask.ts) */
|
|
661
|
+
laneAsk?: LaneAsk
|
|
662
|
+
/** everything validated, nothing owed (review/band.ts validatedOf): the list draws it a quiet green */
|
|
663
|
+
validated?: true
|
|
411
664
|
/** the addresses it owns, then its links */
|
|
412
665
|
addresses: string[]
|
|
413
666
|
}
|
|
@@ -421,7 +674,11 @@ export interface ThreadQuery {
|
|
|
421
674
|
turn: Turn | null
|
|
422
675
|
status: ShownStatus | null
|
|
423
676
|
lane: string | null
|
|
677
|
+
/** « what I must do »: these verbs of his, null every thread */
|
|
678
|
+
wait: OwnerWait[] | null
|
|
424
679
|
q: string
|
|
680
|
+
/** the open thread, by any id of it: its row stays in the page whatever the filters, until he leaves it */
|
|
681
|
+
keep: string | null
|
|
425
682
|
offset: number
|
|
426
683
|
limit: number
|
|
427
684
|
}
|
|
@@ -445,10 +702,12 @@ export function queryOf(p: URLSearchParams): ThreadQuery {
|
|
|
445
702
|
handled: p.get('handled') === '1',
|
|
446
703
|
subject: s('subject'),
|
|
447
704
|
whose: whose && MOVES.has(whose) ? (whose as Move) : null,
|
|
448
|
-
turn: turn === 'yours' || turn === '
|
|
705
|
+
turn: turn === 'yours' || turn === 'aside' || turn === 'agents' || turn === 'done' ? turn : null,
|
|
449
706
|
status: status && status in STATUS_LABEL ? (status as ShownStatus) : null,
|
|
450
707
|
lane: s('lane'),
|
|
708
|
+
wait: waitsOfParam(p.get('waits')),
|
|
451
709
|
q: (p.get('q') ?? '').trim().toLowerCase(),
|
|
710
|
+
keep: s('keep'),
|
|
452
711
|
offset: n('offset', 0, Number.MAX_SAFE_INTEGER),
|
|
453
712
|
limit: Math.max(1, n('limit', PAGE, MAX_PAGE)),
|
|
454
713
|
}
|
|
@@ -462,11 +721,44 @@ export interface ThreadPage {
|
|
|
462
721
|
offset: number
|
|
463
722
|
limit: number
|
|
464
723
|
/** every thread, the active ones, the ones waiting on the owner: the counts the list's head shows */
|
|
465
|
-
|
|
724
|
+
/** waiting: his turn; unread: something new to him in a thread not done or set aside (the nav's pill) */
|
|
725
|
+
counts: { threads: number; active: number; waiting: number; unread: number }
|
|
726
|
+
/** the threads of each verb of his under every filter but « what I must do » */
|
|
727
|
+
byWait: Record<OwnerWait, number>
|
|
466
728
|
/** every subject kind and lane the store holds, for the filters */
|
|
467
729
|
subjects: string[]
|
|
468
730
|
lanes: string[]
|
|
469
731
|
broken: { id: string; error: string }[]
|
|
732
|
+
/** what moved since the owner's last act in the store (threads.ts sinceHeLeft), null before his first */
|
|
733
|
+
since: { at: string; moved: number; yours: number } | null
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/** each verb of his at 0: a page's byWait holds every key, a verb no thread asks counts 0 */
|
|
737
|
+
const NO_WAITS: Readonly<Record<OwnerWait, number>> = { judge: 0, answer: 0, do: 0 }
|
|
738
|
+
|
|
739
|
+
type RequiredKeys<T> = { [K in keyof T]-?: object extends Pick<T, K> ? never : K }[keyof T]
|
|
740
|
+
/** every field a row always carries: a kept page with a row that lacks one was written by an older hub */
|
|
741
|
+
const ROW_KEYS = Object.keys({ head: 1, title: 1, created: 1, updated: 1, subject: 1, origin: 1, status: 1, move: 1, versions: 1, views: 1, thumb: 1, clip: 1, pair: 1, choice: 1, wip: 1, waits: 1, active: 1, unread: 1, rework: 1, ids: 1, turn: 1, wait: 1, verbs: 1, addresses: 1 } satisfies Record<RequiredKeys<ThreadRow>, 1>)
|
|
742
|
+
|
|
743
|
+
/** a list page as the hub reads it, from the server or from the browser's kept copy of an older hub: the page fields
|
|
744
|
+
* added since are filled (each verb at 0, no since); null when a row lacks a field rows always carry, and that page
|
|
745
|
+
* is never drawn */
|
|
746
|
+
export function threadPageOf(v: unknown): ThreadPage | null {
|
|
747
|
+
if (typeof v !== 'object' || v === null) return null
|
|
748
|
+
const p = v as Partial<ThreadPage>
|
|
749
|
+
if (!Array.isArray(p.rows) || p.counts == null || !p.rows.every((r) => ROW_KEYS.every((k) => k in r))) return null
|
|
750
|
+
return {
|
|
751
|
+
rows: p.rows,
|
|
752
|
+
total: p.total ?? p.rows.length,
|
|
753
|
+
offset: p.offset ?? 0,
|
|
754
|
+
limit: p.limit ?? PAGE,
|
|
755
|
+
counts: p.counts,
|
|
756
|
+
byWait: { ...NO_WAITS, ...p.byWait },
|
|
757
|
+
subjects: p.subjects ?? [],
|
|
758
|
+
lanes: p.lanes ?? [],
|
|
759
|
+
broken: p.broken ?? [],
|
|
760
|
+
since: p.since ?? null,
|
|
761
|
+
}
|
|
470
762
|
}
|
|
471
763
|
|
|
472
764
|
/** the list's threads in order with what a query reads of each: built once per store state, read by every page */
|
|
@@ -477,23 +769,31 @@ export interface ThreadIndex {
|
|
|
477
769
|
lanes: string[]
|
|
478
770
|
/** the heads that wait on the owner, the threads `counts.waiting` counts */
|
|
479
771
|
waiting: ReadonlySet<string>
|
|
772
|
+
since: ThreadPage['since']
|
|
480
773
|
}
|
|
481
774
|
|
|
482
775
|
function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<string>, now: Date): ThreadRow {
|
|
483
776
|
const h = t.head
|
|
484
|
-
|
|
777
|
+
// the views a message holds (an update's, a question's option, a proposed sound) are no view of the version
|
|
778
|
+
const own = h.item.views.filter((v) => isGallery(v) || v.message !== true)
|
|
779
|
+
const first = firstView({ ...h.item, views: own })
|
|
485
780
|
const lane = laneOf(h)
|
|
486
781
|
const members = membersOf(t)
|
|
782
|
+
// a hand-over (review/hand-over.ts) is the machine passing the thread on, never a move he sees in his lists
|
|
487
783
|
const updated = members.reduce((u, x) => {
|
|
488
|
-
|
|
784
|
+
// a read mark moves nothing: opening a thread never lifts it in the list
|
|
785
|
+
const m = x.thread.filter((y) => !handedOver(y) && y.op !== 'seen').at(-1)?.at ?? x.item.created
|
|
489
786
|
return m > u ? m : u
|
|
490
787
|
}, h.item.created)
|
|
491
788
|
const newest = updatesOf(h).at(-1)
|
|
492
789
|
const shows = newest?.update?.view !== undefined ? h.item.views[newest.update.view] : undefined
|
|
493
|
-
const
|
|
790
|
+
const picture = h.item.views.find((v) => !isGallery(v) && v.message === true && v.audio === undefined)
|
|
791
|
+
const thumbOf = shows ?? first ?? picture
|
|
792
|
+
const turn = turnOf(t, now)
|
|
793
|
+
const status = statusOf(h, items)
|
|
494
794
|
return {
|
|
495
795
|
head: h.item.id,
|
|
496
|
-
title:
|
|
796
|
+
title: threadTitle(t),
|
|
497
797
|
created: h.item.created,
|
|
498
798
|
updated,
|
|
499
799
|
subject: h.item.subject.kind,
|
|
@@ -502,33 +802,69 @@ function rowOf(t: Thread, items: readonly ReviewItem[], followed: ReadonlySet<st
|
|
|
502
802
|
origin: h.item.origin.by,
|
|
503
803
|
...(h.item.origin.by === 'auto' ? { rule: h.item.origin.rule } : {}),
|
|
504
804
|
...(h.item.origin.by === 'agent' && h.item.origin.session ? { session: h.item.origin.session } : {}),
|
|
505
|
-
status
|
|
805
|
+
status,
|
|
506
806
|
move: moveOf(stateOf(h, followed.has(h.item.id)).state),
|
|
507
807
|
versions: t.versions.length,
|
|
508
|
-
views:
|
|
808
|
+
views: own.length,
|
|
509
809
|
thumb: thumbOf ? thumbFileOf(thumbOf) || null : null,
|
|
510
|
-
clip:
|
|
810
|
+
clip: own.some((v) => !isGallery(v) && v.clip !== undefined),
|
|
511
811
|
pair: first !== undefined && !isGallery(first) && isPair(first.files),
|
|
512
812
|
choice: h.item.choice === true,
|
|
513
813
|
wip: inWork(h),
|
|
514
814
|
...(newest?.update ? { update: { state: newest.update.state, text: newest.text ?? '', at: newest.at } } : {}),
|
|
515
815
|
waits: waits(h),
|
|
516
816
|
active: isActive(t, now),
|
|
517
|
-
unread: members
|
|
817
|
+
unread: newToOwner(members).length > 0,
|
|
518
818
|
rework: reworkOf(h, followed.has(h.item.id), now),
|
|
519
819
|
ids: idsOf(t),
|
|
520
|
-
turn
|
|
820
|
+
turn,
|
|
821
|
+
...(validatedOf({ turn, status, ...(isAskItem(h.item) ? { ask: askStateOf(t)?.state ?? 'open' } : {}) }) ? { validated: true as const } : {}),
|
|
822
|
+
...waitRow(t, now),
|
|
823
|
+
...asideRow(t, now),
|
|
521
824
|
...holderRow(t),
|
|
825
|
+
...cursorRow(t, now),
|
|
826
|
+
...workingRow(t, now),
|
|
827
|
+
...laneAskRow(t),
|
|
522
828
|
addresses: addressesOfThread(t),
|
|
523
829
|
}
|
|
524
830
|
}
|
|
525
831
|
|
|
526
|
-
const
|
|
832
|
+
const waitRow = (t: Thread, now: Date): { wait: Wait; waitsOn?: WaitsOn; owed?: OwnerWait; verbs: OwnerWait[] } => {
|
|
833
|
+
const w = waitEntryOf(t, now)
|
|
834
|
+
const verbs = verbsOf(t, now)
|
|
835
|
+
return { wait: w.wait, ...(w.on ? { waitsOn: w.on } : {}), ...(w.owed ? { owed: w.owed } : {}), verbs }
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const workingRow = (t: Thread, now: Date): { working?: string } => {
|
|
839
|
+
const open = workingsOf(t, now).open
|
|
840
|
+
return open ? { working: open.who } : {}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const holderRow = (t: Thread): { holder?: { lane?: string; session?: string; handed?: true } } => {
|
|
527
844
|
const h = holderOf(t)
|
|
528
|
-
return h ? { holder: { ...(h.lane ? { lane: h.lane } : {}), ...(h.session ? { session: h.session } : {}) } } : {}
|
|
845
|
+
return h ? { holder: { ...(h.lane ? { lane: h.lane } : {}), ...(h.session ? { session: h.session } : {}), ...(h.from ? { handed: true as const } : {}) } } : {}
|
|
529
846
|
}
|
|
530
847
|
|
|
531
|
-
const
|
|
848
|
+
const laneAskRow = (t: Thread): { laneAsk?: LaneAsk } => {
|
|
849
|
+
const a = laneAskOf(membersOf(t))
|
|
850
|
+
return a ? { laneAsk: a } : {}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
const cursorRow = (t: Thread, now: Date): { cursor?: Cursor } => {
|
|
854
|
+
const c = cursorOf(t, now)
|
|
855
|
+
return c ? { cursor: c } : {}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/** a row set aside: when it comes back, and whether an agent wrote in it after he set it aside */
|
|
859
|
+
const asideRow = (t: Thread, now: Date): { aside?: { until: string; moved: boolean } } => {
|
|
860
|
+
const until = asideUntil(t, now)
|
|
861
|
+
if (until === null) return {}
|
|
862
|
+
const msgs = membersOf(t).flatMap((x) => x.thread)
|
|
863
|
+
const set = msgs.filter((m) => m.snooze).map((m) => m.at).sort().at(-1) ?? ''
|
|
864
|
+
return { aside: { until, moved: msgs.some((m) => m.at > set && m.who !== 'owner' && m.op !== 'seen') || membersOf(t).some((x) => x.item.created > set) } }
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const TURN_RANK: Record<Turn, number> = { yours: 0, aside: 1, agents: 2, done: 3 }
|
|
532
868
|
|
|
533
869
|
/** what a search reads of a thread: every item's title, words and id, and every message's words */
|
|
534
870
|
const textOf = (t: Thread): string =>
|
|
@@ -538,27 +874,35 @@ const textOf = (t: Thread): string =>
|
|
|
538
874
|
.join('\n')
|
|
539
875
|
.toLowerCase()
|
|
540
876
|
|
|
541
|
-
/** the list's index over a store's items: the order of the hub's list (
|
|
542
|
-
*
|
|
877
|
+
/** the list's index over a store's items: the order of the hub's list (his turn, set aside, the agents', done; in
|
|
878
|
+
* each, the newest activity first, the time the row shows), one row and one search text per thread */
|
|
543
879
|
export function threadIndex(items: readonly ReviewItem[], now = new Date()): ThreadIndex {
|
|
544
880
|
const followed = followedIds(items)
|
|
545
|
-
// his turn first, then the agents' work, then what is done; the order within each the list's own
|
|
546
881
|
const entries = orderedThreads(items)
|
|
547
882
|
.map((t) => ({ t, row: rowOf(t, items, followed, now), text: textOf(t) }))
|
|
548
883
|
.map((e, i) => ({ e, i }))
|
|
549
|
-
.sort((a, b) => TURN_RANK[a.e.row.turn] - TURN_RANK[b.e.row.turn] || a.i - b.i)
|
|
884
|
+
.sort((a, b) => TURN_RANK[a.e.row.turn] - TURN_RANK[b.e.row.turn] || b.e.row.updated.localeCompare(a.e.row.updated) || a.i - b.i)
|
|
550
885
|
.map(({ e }) => e)
|
|
551
|
-
const waiting = new Set(
|
|
886
|
+
const waiting = new Set(entries.filter((e) => e.row.turn === 'yours').map((e) => e.row.head))
|
|
552
887
|
return {
|
|
553
888
|
entries,
|
|
554
|
-
counts: { threads: entries.length, active: entries.filter((e) => e.row.active).length, waiting: waiting.size },
|
|
889
|
+
counts: { threads: entries.length, active: entries.filter((e) => e.row.active).length, waiting: waiting.size, unread: entries.filter((e) => e.row.unread && countsUnread(e.row.turn) && !isAskItem(e.t.head.item)).length },
|
|
555
890
|
subjects: [...new Set(items.map((x) => x.item.subject.kind))].sort(),
|
|
556
891
|
lanes: [...new Set(entries.flatMap((e) => (e.row.lane ? [e.row.lane] : [])))].sort(),
|
|
557
892
|
waiting,
|
|
893
|
+
since: sinceHeLeft(items, now),
|
|
558
894
|
}
|
|
559
895
|
}
|
|
560
896
|
|
|
561
|
-
/**
|
|
897
|
+
/** where the kept row sits among a page's rows: in the index's own order, after the last row that comes before it */
|
|
898
|
+
function keptAt(ix: ThreadIndex, rows: readonly ThreadRow[], kept: ThreadRow): number {
|
|
899
|
+
const order = new Map(ix.entries.map((e, i) => [e.row, i]))
|
|
900
|
+
const at = order.get(kept)!
|
|
901
|
+
const i = rows.findIndex((r) => order.get(r)! > at)
|
|
902
|
+
return i === -1 ? rows.length : i
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/** one page of the index for a query; the open thread's row (`keep`) in it whatever the filters */
|
|
562
906
|
export function pageOf(ix: ThreadIndex, q: ThreadQuery, broken: ThreadPage['broken'] = []): ThreadPage {
|
|
563
907
|
const words = q.q.split(/\s+/).filter(Boolean)
|
|
564
908
|
const hits = ix.entries.filter(
|
|
@@ -571,15 +915,25 @@ export function pageOf(ix: ThreadIndex, q: ThreadQuery, broken: ThreadPage['brok
|
|
|
571
915
|
(q.lane === null || row.lane === q.lane) &&
|
|
572
916
|
words.every((w) => text.includes(w)),
|
|
573
917
|
)
|
|
918
|
+
// each verb's count under every other filter, so the « what I must do » toggles say what each one gives
|
|
919
|
+
const byWait = { ...NO_WAITS }
|
|
920
|
+
for (const e of hits) for (const v of e.row.verbs) byWait[v] += 1
|
|
921
|
+
const shown = hits.filter((e) => waitsMatch(q.wait, e.row.verbs))
|
|
922
|
+
const rows = shown.slice(q.offset, q.offset + q.limit).map((e) => e.row)
|
|
923
|
+
const keep = q.keep
|
|
924
|
+
const kept = keep === null ? null : (ix.entries.find((e) => e.row.head === keep || e.row.ids.includes(keep))?.row ?? null)
|
|
925
|
+
if (kept !== null && !rows.includes(kept)) rows.splice(keptAt(ix, rows, kept), 0, kept)
|
|
574
926
|
return {
|
|
575
|
-
rows
|
|
576
|
-
total:
|
|
927
|
+
rows,
|
|
928
|
+
total: shown.length + (kept !== null && !shown.some((e) => e.row === kept) ? 1 : 0),
|
|
577
929
|
offset: q.offset,
|
|
578
930
|
limit: q.limit,
|
|
579
931
|
counts: ix.counts,
|
|
932
|
+
byWait,
|
|
580
933
|
subjects: ix.subjects,
|
|
581
934
|
lanes: ix.lanes,
|
|
582
935
|
broken,
|
|
936
|
+
since: ix.since,
|
|
583
937
|
}
|
|
584
938
|
}
|
|
585
939
|
|
|
@@ -598,7 +952,8 @@ export interface ObjectThread {
|
|
|
598
952
|
|
|
599
953
|
/** what an object's thread control shows: the threads that name its address or a part of it, the one his note would go
|
|
600
954
|
* to, and the open threads he may attach it to */
|
|
601
|
-
export function threadsOfAddress(ix: ThreadIndex, threads: readonly Thread[],
|
|
955
|
+
export function threadsOfAddress(ix: ThreadIndex, threads: readonly Thread[], asked: string): { address: string; threads: ObjectThread[]; noteGoesTo: string | null; open: ObjectThread[] } {
|
|
956
|
+
const address = canonicalAddress(asked) ?? asked
|
|
602
957
|
const rows = new Map(ix.entries.map((e) => [e.row.head, e.row]))
|
|
603
958
|
const as = (t: Thread, owns: boolean): ObjectThread | null => {
|
|
604
959
|
const r = rows.get(t.head.item.id)
|
|
@@ -610,7 +965,7 @@ export function threadsOfAddress(ix: ThreadIndex, threads: readonly Thread[], ad
|
|
|
610
965
|
const naming = threads.filter((t) => addressesOfThread(t).some((a) => a === address || a.startsWith(`${address}/`)) || t === owner)
|
|
611
966
|
const list = naming.flatMap((t) => as(t, t === owner) ?? []).sort((a, b) => b.updated.localeCompare(a.updated))
|
|
612
967
|
const open = ix.entries.filter((e) => e.row.turn !== 'done' && !list.some((l) => l.head === e.row.head)).slice(0, 30).flatMap((e) => as(e.t, false) ?? [])
|
|
613
|
-
return { address, threads: list, noteGoesTo: owner?.head.item.id ?? null, open }
|
|
968
|
+
return { address: asked, threads: list, noteGoesTo: owner?.head.item.id ?? null, open }
|
|
614
969
|
}
|
|
615
970
|
|
|
616
971
|
// ── the dispatcher's board ──
|