rvlib-shipkit 2.30.0 → 2.32.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 +46 -0
- package/README.md +15 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +186 -94
- package/src/advisors/advice.ts +227 -96
- package/src/advisors/advisor-view.ts +141 -68
- package/src/advisors/app-graph.ts +8 -2
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +44 -0
- package/src/advisors/dir-bucket.ts +70 -0
- package/src/advisors/edge/api.ts +32 -197
- package/src/advisors/edge/bucket.ts +10 -1
- package/src/advisors/edge/handler.ts +36 -137
- package/src/advisors/edge/here.ts +63 -0
- package/src/advisors/edge/pages.ts +90 -0
- package/src/advisors/edge/shell.ts +11 -8
- package/src/advisors/edge/sign-in.ts +209 -0
- package/src/advisors/edge/status.ts +41 -6
- package/src/advisors/edge/types.ts +42 -58
- package/src/advisors/expose.ts +227 -121
- package/src/advisors/here.ts +66 -0
- package/src/advisors/invite-send.ts +220 -0
- package/src/advisors/invite.ts +72 -0
- package/src/advisors/job.ts +100 -14
- package/src/advisors/login.ts +91 -0
- package/src/advisors/owner-name.ts +37 -0
- package/src/advisors/owner-store.ts +295 -66
- package/src/advisors/photos.ts +12 -52
- package/src/advisors/project.ts +105 -59
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +152 -0
- package/src/advisors/routes.ts +340 -127
- package/src/advisors/scan.ts +24 -2
- package/src/advisors/setup-run.ts +132 -0
- package/src/advisors/share-trace.ts +78 -0
- package/src/advisors/sign-in-probe.ts +89 -0
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +219 -194
- package/src/advisors/tunnel.ts +119 -0
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +358 -0
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/accounts-usage-disk.ts +45 -3
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/claude-sessions.ts +63 -3
- package/src/agent-time/registry.ts +142 -51
- package/src/agent-time/store.ts +204 -141
- package/src/annex/born.ts +2 -9
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-carry.ts +14 -7
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-edit.ts +49 -0
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-since.ts +74 -0
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +74 -32
- package/src/asks/ask-words-fold.ts +2 -2
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +16 -58
- package/src/checks/SK003-claude-md-shape.check.ts +78 -20
- package/src/checks/SK004-gitignore-policy.check.ts +31 -73
- package/src/checks/SK008-reviewer-agent.check.ts +1 -1
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK032-ignored-inputs.check.ts +9 -5
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK036-draft-media-size.check.ts +4 -3
- package/src/checks/SK038-speaks-as.check.ts +6 -5
- package/src/checks/SK039-vscode-watch-generated.check.ts +5 -25
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK044-behind-upstream.check.ts +2 -1
- package/src/checks/SK052-url-old-words.check.ts +56 -0
- package/src/checks/SK053-tools.check.ts +46 -0
- package/src/checks/SK054-agent-allow-list.check.ts +73 -0
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/clip.ts +44 -0
- package/src/cli/cmd_Advisors.ts +278 -144
- package/src/cli/cmd_Annex.ts +1 -1
- package/src/cli/cmd_Asks.ts +126 -31
- package/src/cli/cmd_Assets.ts +1 -1
- package/src/cli/cmd_Backup.ts +25 -168
- package/src/cli/cmd_BackupTargets.ts +106 -0
- package/src/cli/cmd_Bump.ts +1 -1
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Calls.ts +1 -1
- package/src/cli/cmd_Capacity.ts +1 -1
- package/src/cli/cmd_Check.ts +2 -2
- package/src/cli/cmd_Checks.ts +2 -15
- package/src/cli/cmd_Ci.ts +1 -1
- package/src/cli/cmd_Commands.ts +1 -1
- package/src/cli/cmd_ConfigKeys.ts +1 -1
- package/src/cli/cmd_Contracts.ts +1 -1
- package/src/cli/cmd_CrossRepoActivity.ts +1 -6
- package/src/cli/cmd_Db.ts +33 -68
- package/src/cli/cmd_Drill.ts +1 -1
- package/src/cli/cmd_Drive.ts +259 -0
- package/src/cli/cmd_Fleet.ts +1 -1
- package/src/cli/cmd_FleetContext.ts +45 -0
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_FleetUpdate.ts +104 -0
- package/src/cli/cmd_GlobalContext.ts +1 -1
- package/src/cli/cmd_GlobalProcesses.ts +6 -4
- package/src/cli/cmd_History.ts +8 -27
- package/src/cli/cmd_Home.ts +8 -36
- package/src/cli/cmd_Hooks.ts +3 -12
- package/src/cli/cmd_Hq.ts +47 -90
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Insights.ts +1 -1
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +5 -4
- package/src/cli/cmd_Machines.ts +1 -1
- package/src/cli/cmd_Media.ts +6 -19
- package/src/cli/cmd_Messages.ts +1 -1
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Needs.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +7 -16
- package/src/cli/cmd_OrchestratorRole.ts +10 -21
- package/src/cli/cmd_Overview.ts +1 -1
- package/src/cli/cmd_Pb.ts +1 -1
- package/src/cli/cmd_Planned.ts +1 -1
- package/src/cli/cmd_Rec.ts +1 -1
- package/src/cli/cmd_Reflect.ts +3 -3
- package/src/cli/cmd_Release.ts +1 -1
- package/src/cli/cmd_Releases.ts +58 -5
- package/src/cli/cmd_Review.ts +576 -483
- package/src/cli/cmd_Secret.ts +84 -2
- package/src/cli/cmd_Serve.ts +1 -1
- package/src/cli/cmd_Setup.ts +30 -0
- package/src/cli/cmd_Shot.ts +1 -1
- package/src/cli/cmd_Sign.ts +1 -1
- package/src/cli/cmd_Smoke.ts +1 -1
- package/src/cli/cmd_Social.ts +6 -3
- package/src/cli/cmd_SocialDrafts.ts +23 -16
- package/src/cli/cmd_Sound.ts +1 -1
- package/src/cli/cmd_Space.ts +4 -4
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Status.ts +1 -1
- package/src/cli/cmd_ThreadHolds.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +1 -1
- package/src/cli/cmd_ThreadReflect.ts +3 -3
- package/src/cli/cmd_ThreadSyncNeeds.ts +7 -3
- package/src/cli/cmd_Time.ts +2 -2
- package/src/cli/cmd_Tmp.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +2 -2
- package/src/cli/cmd_Tui.ts +1 -1
- package/src/cli/cmd_Urls.ts +61 -9
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_Veille.ts +1 -1
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Wiki.ts +5 -2
- package/src/cli/cmd_Worktrees.ts +1 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/inbox-hook-run.ts +26 -18
- package/src/cli/line.ts +131 -0
- package/src/cli/registry-cli.ts +100 -0
- package/src/cli/registry-heads.ts +398 -0
- package/src/cli/registry.ts +381 -254
- package/src/cli/review-here.ts +5 -5
- package/src/cli.ts +47 -35
- package/src/collections/collection-types.ts +4 -1
- package/src/collections/providers.ts +6 -3
- package/src/collections/review.ts +6 -6
- package/src/context/context-line.ts +29 -0
- package/src/context/context-view.ts +34 -0
- package/src/context/project-context.ts +144 -0
- package/src/core/agent-allow-policy.ts +129 -0
- package/src/core/agent-env.ts +8 -0
- package/src/core/agent-spawn.ts +2 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/capacity.ts +3 -2
- package/src/core/check-file-names.ts +19 -106
- package/src/core/es2022.ts +19 -0
- package/src/core/footprint.ts +39 -0
- package/src/core/git-bin.ts +18 -0
- package/src/core/git-root.ts +40 -4
- package/src/core/git.ts +22 -0
- package/src/core/hard-reset.ts +7 -1
- package/src/core/house-config-text.ts +47 -0
- package/src/core/house-layout.ts +4 -0
- package/src/core/identities-path.ts +67 -0
- package/src/core/identities-root.ts +23 -0
- package/src/core/instance.ts +1 -1
- package/src/core/jobs.ts +1 -4
- package/src/{scaffold → core}/jsonc-spans.ts +42 -0
- package/src/core/layout.ts +4 -2
- package/src/core/loop-watch.ts +28 -5
- package/src/core/machine-db.ts +34 -216
- package/src/core/machine-layout.ts +14 -127
- package/src/core/machine-name.ts +31 -0
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +62 -11
- package/src/core/motherhome.ts +8 -35
- package/src/core/on-loop.ts +10 -7
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/pid-alive.ts +11 -0
- package/src/core/proc-path.ts +42 -0
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +3 -11
- package/src/core/retired-checks.ts +2 -0
- package/src/core/role-policy.ts +6 -7
- package/src/core/run-dirs.ts +2 -5
- package/src/core/runs.ts +5 -3
- package/src/core/scope.ts +44 -0
- package/src/core/scratch-objects.ts +1 -1
- package/src/core/slot-env.ts +4 -0
- package/src/core/slots.ts +2 -2
- package/src/core/spawn-timeout.ts +9 -3
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tools.ts +20 -0
- package/src/core/tree-watch.ts +304 -0
- package/src/core/when.ts +7 -45
- package/src/core/window-policy.ts +132 -0
- package/src/drives/context.ts +29 -0
- package/src/drives/drives-view.ts +121 -0
- package/src/drives/file.ts +89 -0
- package/src/drives/local-folder.ts +107 -0
- package/src/drives/login.ts +181 -0
- package/src/drives/named.ts +33 -0
- package/src/drives/rclone.ts +100 -0
- package/src/drives/reach.ts +73 -0
- package/src/drives/routes.ts +89 -0
- package/src/drives/shares.ts +292 -0
- package/src/fleet/context-fleet.ts +83 -0
- package/src/fleet/follow.ts +172 -0
- package/src/gate/builtin-checks-dir.ts +32 -0
- package/src/gate/discover-checks.ts +45 -58
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/pre-commit-discovery.ts +205 -24
- package/src/gate/run-check.ts +0 -4
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +13 -41
- package/src/home/advisors-tunnel-start.ts +9 -0
- package/src/home/app-sign.ts +2 -2
- package/src/home/autostart.ts +61 -17
- package/src/home/backup-status.ts +326 -0
- package/src/home/backup-verdict.ts +19 -0
- package/src/home/daemon-jobs.ts +206 -107
- package/src/home/database-words.ts +18 -2
- package/src/home/databases.ts +70 -39
- package/src/home/drives-deps.ts +54 -0
- package/src/home/follow-run.ts +146 -0
- package/src/home/global-context.ts +26 -22
- package/src/home/global-units.ts +3 -1
- package/src/home/gui-app/ShipkitGui.swift +1595 -17
- package/src/home/gui-app.ts +12 -16
- package/src/home/handoff.ts +5 -3
- package/src/home/handover.ts +2 -10
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +20 -7
- package/src/home/home-routes.ts +92 -29
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +15 -16
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-host.ts +3 -17
- package/src/home/machine-repair.ts +102 -103
- package/src/home/machine-stores.ts +8 -7
- package/src/home/owner-switch-route.ts +33 -0
- package/src/home/page-build.ts +20 -4
- package/src/home/page-files.ts +79 -0
- package/src/home/pm-switch.ts +10 -0
- package/src/home/pm.ts +13 -1
- package/src/home/process-apps.ts +15 -3
- package/src/home/push-sources.ts +17 -5
- package/src/home/resume.ts +7 -19
- package/src/home/run-daemon.ts +63 -7
- package/src/home/run-pm.ts +3 -3
- package/src/home/secrets-context.ts +119 -0
- package/src/home/serve-web.ts +12 -7
- package/src/home/shipkit-mark.ts +26 -0
- package/src/home/space-page.ts +3 -2
- package/src/home/space-route.ts +3 -10
- package/src/home/supervise.ts +5 -16
- package/src/home/vault-page.ts +39 -18
- package/src/home/vault-reveal.ts +2 -1
- package/src/home/web-places.ts +5 -3
- package/src/hooks/commit-run.ts +420 -0
- package/src/hooks/git-hook.ts +49 -0
- package/src/hooks/held-calls.ts +104 -0
- package/src/hooks/hook-config.ts +103 -0
- package/src/hooks/hook-gates.ts +15 -9
- package/src/hooks/leak-guard.ts +16 -15
- package/src/hooks/one-way-in-guard.ts +12 -3
- package/src/hooks/pre-commit-checks.ts +64 -0
- package/src/hooks/root-identity.ts +15 -18
- package/src/hooks/run-hooks.ts +123 -301
- package/src/hooks/shared-file.ts +18 -15
- package/src/hooks/shell-writes.ts +6 -100
- package/src/hooks/staged.ts +245 -18
- package/src/hooks/write-log.ts +122 -28
- package/src/house/project-gutter.ts +32 -8
- package/src/hq/backup-targets.ts +74 -0
- package/src/hq/daemon-db.ts +177 -0
- package/src/hq/door-route.ts +5 -5
- package/src/hq/door.ts +16 -15
- package/src/hq/files-send.ts +23 -17
- package/src/hq/follow-fact.ts +66 -0
- package/src/hq/forgotten-log.ts +3 -1
- package/src/hq/history-check.ts +9 -0
- package/src/hq/history-send.ts +6 -22
- package/src/hq/holds-shape.ts +42 -0
- package/src/hq/hq-db.ts +17 -26
- package/src/hq/hq-holds.ts +181 -0
- package/src/hq/hq-local.ts +65 -47
- package/src/hq/hq-role.ts +150 -0
- package/src/hq/hq-routes.ts +15 -3
- package/src/hq/hq-store.ts +28 -10
- package/src/hq/item-direct.ts +55 -0
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/index.ts +2 -1
- package/src/hq/kinds/item-gone.ts +18 -13
- package/src/hq/kinds/item-msg.ts +19 -10
- package/src/hq/kinds/item.ts +22 -19
- package/src/hq/kinds/kind.ts +9 -0
- package/src/hq/kinds/presence.ts +21 -3
- package/src/hq/kinds/prompt.ts +1 -0
- package/src/hq/kinds/reflection.ts +1 -0
- package/src/hq/kinds/report.ts +6 -2
- package/src/hq/kinds/thread-event.ts +105 -0
- package/src/hq/lead-order.ts +5 -5
- package/src/hq/machine-key.ts +10 -3
- package/src/hq/machine-notes.ts +3 -2
- package/src/hq/outbox.ts +2 -153
- package/src/hq/owner-switch.ts +61 -0
- package/src/hq/replica.ts +165 -18
- package/src/hq/report-facts.ts +26 -3
- package/src/hq/report.ts +26 -6
- package/src/hq/switch.ts +20 -60
- package/src/hq/terminal-hop.ts +1 -1
- package/src/hq/thread-events.ts +91 -0
- package/src/hq/thread-sync.ts +34 -65
- package/src/hq/threads-words.ts +21 -0
- package/src/http/door-forward.ts +3 -3
- package/src/http/hop-names.ts +3 -3
- package/src/http/owner-word.ts +7 -2
- package/src/identities/collection.ts +2 -3
- package/src/identities/identities.ts +43 -6
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +12 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +18 -7
- package/src/ledger/git-scan.ts +23 -9
- package/src/ledger/live-runs.ts +1 -12
- package/src/ledger/record-kept.ts +139 -42
- package/src/ledger/run-log.ts +23 -3
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +29 -0
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +11 -9
- package/src/media-store/backup/retention.ts +14 -2
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +21 -213
- package/src/media-store/backup/ssh-target.ts +74 -0
- package/src/media-store/backup/target-send.ts +138 -0
- package/src/media-store/copy/config.ts +5 -4
- package/src/media-store/copy/copy.ts +11 -6
- package/src/media-store/copy/proof.ts +17 -10
- package/src/media-store/copy/snapshot.ts +29 -22
- package/src/media-store/copy/store.ts +2 -10
- package/src/media-store/copy/stream.ts +7 -2
- package/src/media-store/daemon.ts +8 -5
- package/src/media-store/db.ts +11 -5
- package/src/media-store/forget-one.ts +15 -4
- package/src/media-store/forget.ts +1 -80
- package/src/media-store/hq-find.ts +1 -3
- package/src/media-store/hq-send.ts +4 -5
- package/src/orchestrator/brief.md +1 -1
- package/src/orchestrator/guards.ts +0 -4
- package/src/orchestrator/lead-shape.ts +5 -4
- package/src/orchestrator/now.ts +1 -1
- package/src/orchestrator/places-look.ts +45 -17
- package/src/orchestrator/places-shape.ts +17 -2
- package/src/orchestrator/places.ts +1 -1
- package/src/orchestrator/presence.ts +17 -7
- package/src/orchestrator/role-shape.ts +12 -21
- package/src/orchestrator/role.ts +7 -58
- package/src/orchestrator/routes.ts +26 -17
- package/src/orchestrator/sessions-shape.ts +48 -3
- package/src/orchestrator/sessions.ts +5 -8
- package/src/orchestrator/start.ts +3 -10
- package/src/orchestrator/started.ts +1 -10
- package/src/orchestrator/talk-key.ts +20 -0
- package/src/orchestrator/unheard.ts +2 -2
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/recordings/recorder-app/Editor.swift +6 -0
- package/src/recordings/recorder-app/main.swift +3 -0
- package/src/reflections/reflection-close.ts +2 -1
- package/src/reflections/reflections-queue.ts +5 -9
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +102 -17
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +45 -68
- package/src/review/answer-kinds.ts +71 -2
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cell-copy.ts +27 -0
- package/src/review/cells.ts +317 -219
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +27 -11
- package/src/review/expect.ts +112 -0
- package/src/review/file-tags.ts +9 -0
- package/src/review/format.ts +160 -39
- package/src/review/glyphs.ts +1 -0
- package/src/review/gone.ts +10 -86
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +8 -5
- package/src/review/inbox-read.ts +96 -22
- package/src/review/instruction-guards.ts +68 -1
- package/src/review/instructions.ts +25 -2
- package/src/review/item-db.ts +124 -70
- package/src/review/item-hq.ts +119 -0
- package/src/review/item-rows.ts +95 -62
- package/src/review/kind-catalog.ts +5 -1
- package/src/review/kinds.ts +25 -12
- package/src/review/live-post.ts +20 -6
- package/src/review/live-view.ts +21 -1
- package/src/review/media-away.ts +35 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +4 -8
- package/src/review/model.ts +254 -98
- package/src/review/move.ts +131 -474
- package/src/review/need-threads.ts +3 -2
- package/src/review/notes.ts +4 -4
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +32 -8
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/parties.ts +16 -0
- package/src/review/phone-push.ts +15 -13
- package/src/review/previews-job.ts +49 -0
- package/src/review/previews.ts +79 -29
- package/src/review/push.ts +26 -42
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +28 -14
- package/src/review/refs.ts +143 -0
- package/src/review/reply-guards.ts +71 -0
- package/src/review/routes.ts +133 -47
- package/src/review/search-index.ts +6 -10
- package/src/review/search-job.ts +4 -6
- package/src/review/search-ocr.ts +1 -1
- package/src/review/secret-route.ts +14 -9
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store-index.ts +1 -1
- package/src/review/store.ts +256 -614
- package/src/review/supersede.ts +3 -3
- package/src/review/take-back.ts +1 -2
- package/src/review/thread-code.ts +101 -0
- package/src/review/{wakes.ts → thread-events.ts} +97 -8
- package/src/review/thread-md.ts +148 -0
- package/src/review/thread-query.ts +67 -0
- package/src/review/thread-state.ts +798 -0
- package/src/review/threads.ts +58 -301
- package/src/review/traces.ts +121 -12
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +10 -8
- package/src/review/view-layout.ts +28 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/watchers.ts +1 -10
- package/src/review/working-guards.ts +38 -0
- package/src/rules/untrack-generated.ts +1 -15
- package/src/scaffold/starter-house.ts +85 -0
- package/src/secrets/about-words.ts +33 -0
- package/src/secrets/archive.ts +2 -2
- package/src/secrets/audit-run.ts +53 -0
- package/src/secrets/audit.ts +407 -0
- package/src/secrets/changed-mark.ts +15 -0
- package/src/secrets/clip.ts +29 -0
- package/src/secrets/held.ts +4 -4
- package/src/secrets/lapse.ts +3 -2
- package/src/secrets/list.ts +9 -4
- package/src/secrets/read.ts +5 -1
- package/src/secrets/ref-state.ts +18 -0
- package/src/secrets/registry-rows.ts +18 -0
- package/src/secrets/secret-ref.ts +42 -0
- package/src/secrets/token-siblings.ts +60 -0
- package/src/secrets/who-reads.ts +25 -20
- package/src/serve/frame-part.ts +2 -1
- package/src/serve/hub-app/activity-view.tsx +6 -6
- package/src/serve/hub-app/admin-view.tsx +7 -6
- package/src/serve/hub-app/advisor-app.tsx +80 -17
- package/src/serve/hub-app/advisor-face.tsx +27 -7
- package/src/serve/hub-app/advisor-host.ts +113 -21
- package/src/serve/hub-app/advisors-model.ts +243 -0
- package/src/serve/hub-app/advisors-rights.tsx +66 -0
- package/src/serve/hub-app/advisors-st.ts +433 -36
- package/src/serve/hub-app/advisors-view.tsx +333 -234
- package/src/serve/hub-app/advisors.css +134 -21
- package/src/serve/hub-app/app-bridge.ts +116 -6
- package/src/serve/hub-app/ask-steps.tsx +6 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +114 -19
- package/src/serve/hub-app/backups-st.ts +55 -0
- package/src/serve/hub-app/backups-view.tsx +115 -0
- package/src/serve/hub-app/backups.css +33 -0
- package/src/serve/hub-app/card-head.tsx +1 -1
- package/src/serve/hub-app/check-view.tsx +7 -15
- package/src/serve/hub-app/col-card.tsx +4 -4
- package/src/serve/hub-app/col-list-page.tsx +2 -1
- package/src/serve/hub-app/col-tables.ts +5 -4
- package/src/serve/hub-app/comfy-view.tsx +1 -1
- package/src/serve/hub-app/commands/commands-page.tsx +2 -2
- package/src/serve/hub-app/controls.css +34 -2
- package/src/serve/hub-app/cycle-button.tsx +2 -2
- package/src/serve/hub-app/database-st.ts +40 -11
- package/src/serve/hub-app/database-view.tsx +67 -3
- package/src/serve/hub-app/database.css +3 -0
- package/src/serve/hub-app/dock-view.tsx +1 -1
- package/src/serve/hub-app/drives-page.tsx +309 -0
- package/src/serve/hub-app/drives-st.ts +486 -0
- package/src/serve/hub-app/drives.css +122 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +4 -3
- package/src/serve/hub-app/empty-section.tsx +1 -1
- package/src/serve/hub-app/entry-list.tsx +1 -1
- package/src/serve/hub-app/floating.tsx +0 -1
- package/src/serve/hub-app/frame-refusal.ts +13 -0
- package/src/serve/hub-app/geometry-view.tsx +3 -3
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hash-route.ts +12 -5
- package/src/serve/hub-app/header-bar.tsx +2 -1
- package/src/serve/hub-app/home-pages.ts +40 -0
- package/src/serve/hub-app/home-st.ts +8 -1
- package/src/serve/hub-app/home-strip.tsx +22 -20
- package/src/serve/hub-app/home.html +2 -1
- package/src/serve/hub-app/hub-app.tsx +16 -3
- package/src/serve/hub-app/hub.css +84 -10
- package/src/serve/hub-app/icons.tsx +9 -1
- package/src/serve/hub-app/identities-view.tsx +5 -4
- package/src/serve/hub-app/inbox-view.tsx +11 -12
- package/src/serve/hub-app/index.html +2 -1
- package/src/serve/hub-app/insights-view.tsx +8 -8
- package/src/serve/hub-app/keys.ts +31 -11
- package/src/serve/hub-app/layout-st.ts +4 -1
- package/src/serve/hub-app/lightbox-zoom.css +29 -19
- package/src/serve/hub-app/list-filter.tsx +46 -5
- package/src/serve/hub-app/live-socket.ts +12 -6
- package/src/serve/hub-app/live-sources.ts +138 -67
- package/src/serve/hub-app/machine-groups.ts +87 -0
- package/src/serve/hub-app/machines-st.ts +100 -3
- package/src/serve/hub-app/machines-view.tsx +50 -3
- package/src/serve/hub-app/machines.css +22 -0
- package/src/serve/hub-app/main-panel.css +16 -10
- package/src/serve/hub-app/main-panel.tsx +8 -9
- package/src/serve/hub-app/markdown.css +12 -2
- package/src/serve/hub-app/md.ts +60 -18
- package/src/serve/hub-app/media-view.tsx +21 -12
- package/src/serve/hub-app/messages/messages-page.tsx +15 -6
- package/src/serve/hub-app/new-thread.tsx +6 -3
- package/src/serve/hub-app/orchestrator-line.tsx +1 -1
- package/src/serve/hub-app/orchestrator-places.tsx +28 -2
- package/src/serve/hub-app/orchestrator.css +5 -0
- package/src/serve/hub-app/page-keys.ts +4 -1
- package/src/serve/hub-app/pages-frames.tsx +2 -1
- package/src/serve/hub-app/palette-st.ts +285 -60
- package/src/serve/hub-app/palette-view.tsx +96 -18
- package/src/serve/hub-app/pane-boundary.tsx +3 -2
- package/src/serve/hub-app/panel-head.tsx +1 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/panel-source.ts +16 -5
- package/src/serve/hub-app/panel-tint.ts +3 -18
- package/src/serve/hub-app/panel-walk.ts +1 -1
- package/src/serve/hub-app/pic.tsx +54 -0
- package/src/serve/hub-app/pick-kinds.ts +101 -0
- package/src/serve/hub-app/places-svc.ts +44 -10
- package/src/serve/hub-app/plan-view.tsx +2 -2
- package/src/serve/hub-app/planned-view.tsx +6 -5
- package/src/serve/hub-app/polled.ts +33 -8
- package/src/serve/hub-app/presence-st.ts +9 -1
- package/src/serve/hub-app/processes-view.tsx +16 -10
- package/src/serve/hub-app/project-bar.tsx +85 -29
- package/src/serve/hub-app/project-list.tsx +7 -19
- package/src/serve/hub-app/projects-svc.ts +50 -20
- package/src/serve/hub-app/rail-groups.ts +1 -0
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +94 -36
- package/src/serve/hub-app/ref-list-slot.ts +10 -0
- package/src/serve/hub-app/ref-pill.ts +58 -0
- package/src/serve/hub-app/reflections-page.tsx +3 -3
- package/src/serve/hub-app/releases/releases-page.tsx +6 -6
- package/src/serve/hub-app/repo-mark.tsx +29 -0
- package/src/serve/hub-app/repo-sections.ts +16 -9
- package/src/serve/hub-app/repo-st.ts +68 -16
- package/src/serve/hub-app/review/advisor-add.tsx +155 -0
- package/src/serve/hub-app/review/advisor-bar.tsx +92 -22
- package/src/serve/hub-app/review/advisor-invite.tsx +66 -0
- package/src/serve/hub-app/review/ask-proof.tsx +4 -3
- package/src/serve/hub-app/review/attach-view.tsx +7 -6
- package/src/serve/hub-app/review/box-view.ts +35 -18
- package/src/serve/hub-app/review/box-zoom.tsx +1 -1
- package/src/serve/hub-app/review/copy-button.tsx +29 -0
- package/src/serve/hub-app/review/diff-mode.ts +41 -0
- package/src/serve/hub-app/review/diff-view.tsx +92 -19
- package/src/serve/hub-app/review/doc-body.tsx +2 -2
- package/src/serve/hub-app/review/draft-body.tsx +4 -4
- package/src/serve/hub-app/review/group-block.tsx +8 -8
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +4 -17
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kind-view.tsx +13 -19
- package/src/serve/hub-app/review/kit.tsx +19 -18
- package/src/serve/hub-app/review/lane-bar.tsx +4 -4
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +55 -9
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-bar.tsx +5 -2
- package/src/serve/hub-app/review/live-view.tsx +67 -11
- package/src/serve/hub-app/review/mention-st.ts +9 -38
- package/src/serve/hub-app/review/object-panel.tsx +58 -21
- package/src/serve/hub-app/review/outbox-st.ts +200 -0
- package/src/serve/hub-app/review/pano-view.tsx +2 -2
- package/src/serve/hub-app/review/phone-top.tsx +2 -1
- package/src/serve/hub-app/review/question-views.tsx +321 -62
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +327 -112
- package/src/serve/hub-app/review/review-host.ts +11 -2
- package/src/serve/hub-app/review/review-kit.ts +38 -16
- package/src/serve/hub-app/review/review-list.tsx +63 -110
- package/src/serve/hub-app/review/review-page.tsx +6 -5
- package/src/serve/hub-app/review/review-st.ts +114 -70
- package/src/serve/hub-app/review/review-thread.tsx +378 -204
- package/src/serve/hub-app/review/review-views.tsx +205 -111
- package/src/serve/hub-app/review/secret-facts.ts +2 -1
- package/src/serve/hub-app/review/share-lines.tsx +40 -0
- package/src/serve/hub-app/review/start-st.ts +134 -0
- package/src/serve/hub-app/review/start-thread.tsx +104 -0
- package/src/serve/hub-app/review/superseded-runs.ts +24 -5
- package/src/serve/hub-app/review/thread-close.tsx +11 -8
- package/src/serve/hub-app/review/thread-control.tsx +5 -4
- package/src/serve/hub-app/review/thread-st.ts +591 -206
- package/src/serve/hub-app/review/thread-views.ts +3 -2
- package/src/serve/hub-app/review/tone-bar.tsx +126 -0
- package/src/serve/hub-app/review/tones.ts +35 -0
- package/src/serve/hub-app/review/trailer-body.tsx +8 -8
- package/src/serve/hub-app/review/trailer-page.tsx +33 -33
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices.tsx +10 -10
- package/src/serve/hub-app/review/zoom-still.tsx +60 -0
- package/src/serve/hub-app/review.css +320 -123
- package/src/serve/hub-app/row-acts.tsx +2 -0
- package/src/serve/hub-app/row-face.tsx +0 -1
- package/src/serve/hub-app/run-page.tsx +236 -0
- package/src/serve/hub-app/running-rows.tsx +2 -2
- package/src/serve/hub-app/search-view.tsx +2 -2
- package/src/serve/hub-app/secret-cli.tsx +32 -0
- package/src/serve/hub-app/secret-readable.tsx +59 -0
- package/src/serve/hub-app/secret-refs.ts +173 -0
- package/src/serve/hub-app/secrets-page.tsx +2 -2
- package/src/serve/hub-app/section-head.tsx +3 -1
- package/src/serve/hub-app/seen-rows.ts +72 -0
- package/src/serve/hub-app/shared-faces.tsx +32 -0
- package/src/serve/hub-app/side-frame-view.tsx +115 -0
- package/src/serve/hub-app/side-frame.ts +120 -0
- package/src/serve/hub-app/site/site-part.tsx +7 -7
- package/src/serve/hub-app/social/calendar.tsx +1 -1
- package/src/serve/hub-app/social/comms-page.tsx +3 -3
- package/src/serve/hub-app/social/copy-forms.ts +31 -0
- package/src/serve/hub-app/social/kit.tsx +42 -23
- package/src/serve/hub-app/social/post-card.tsx +5 -5
- package/src/serve/hub-app/social/post-page.tsx +2 -2
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/social/social-page.tsx +31 -12
- package/src/serve/hub-app/social/social-st.ts +8 -2
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social.css +7 -1
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/source-page.tsx +2 -0
- package/src/serve/hub-app/space-view.tsx +3 -3
- package/src/serve/hub-app/stores/stores-page.tsx +20 -19
- package/src/serve/hub-app/terminal-gone.tsx +41 -0
- package/src/serve/hub-app/terminal-history-st.ts +3 -0
- package/src/serve/hub-app/terminal-list-st.ts +27 -3
- package/src/serve/hub-app/terminal-pages.tsx +50 -10
- package/src/serve/hub-app/terminal-panel.tsx +3 -3
- package/src/serve/hub-app/terminal-picture.ts +78 -0
- package/src/serve/hub-app/terminal-sources.tsx +320 -49
- package/src/serve/hub-app/terminal-st.ts +57 -2
- package/src/serve/hub-app/terminal-tab.tsx +2 -1
- package/src/serve/hub-app/terminal.css +5 -0
- package/src/serve/hub-app/test-view.tsx +2 -2
- package/src/serve/hub-app/tests-view.tsx +3 -3
- package/src/serve/hub-app/thread-row.tsx +15 -6
- package/src/serve/hub-app/time-charts.tsx +3 -2
- package/src/serve/hub-app/time-pages.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +6 -5
- package/src/serve/hub-app/timeline-chart.tsx +1 -1
- package/src/serve/hub-app/timeline-view.tsx +12 -4
- package/src/serve/hub-app/tree-build.ts +3 -7
- package/src/serve/hub-app/url-faces.ts +3 -4
- package/src/serve/hub-app/url-forms.tsx +112 -20
- package/src/serve/hub-app/url-needs.ts +31 -0
- package/src/serve/hub-app/urls-svc.ts +163 -25
- package/src/serve/hub-app/urls-view.tsx +76 -75
- package/src/serve/hub-app/urls.css +62 -5
- package/src/serve/hub-app/vault-view.tsx +13 -13
- package/src/serve/hub-app/veille/veille-page.tsx +12 -11
- package/src/serve/hub-app/view-layout.css +13 -1
- package/src/serve/hub-app/when-view.tsx +2 -2
- package/src/serve/hub-app/wikis-view.tsx +6 -3
- package/src/serve/hub-app/word-refs.ts +12 -0
- package/src/serve/hub-app/words.tsx +25 -8
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/picture-types.ts +10 -0
- package/src/serve/project-gutter-route.ts +24 -15
- package/src/serve/read-thread.ts +49 -12
- package/src/serve/read-worker.ts +16 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/secret-ref-routes.ts +71 -0
- package/src/serve/serve-hub.ts +28 -3
- package/src/serve/terminal-claudes.ts +44 -7
- package/src/serve/terminal-guard.ts +5 -1
- package/src/serve/terminal-host.ts +6 -2
- package/src/serve/terminal-paste.ts +49 -0
- package/src/serve/terminal-record.ts +8 -2
- package/src/serve/terminal-route.ts +19 -8
- package/src/serve/tracked-watch.ts +14 -14
- package/src/setup-house.ts +333 -0
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +1 -6
- package/src/shot/film-box.ts +1 -29
- package/src/social/discord-layout.ts +1 -1
- package/src/social/drafts.ts +1 -1
- package/src/social/kind-pages.ts +11 -5
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/media-limit.ts +18 -8
- package/src/social/media-of.ts +5 -5
- package/src/social/post-object.ts +3 -2
- package/src/social/publish/discord.ts +1 -1
- package/src/social/release-stage.ts +1 -1
- package/src/social/routes.ts +6 -3
- package/src/social/stage.ts +2 -2
- package/src/start-repo.ts +5 -0
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +67 -51
- package/src/suite/red-alone.ts +105 -0
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +88 -34
- package/src/suite/test-units.ts +2 -1
- package/src/trailer/titles.ts +2 -2
- package/src/urls/added.ts +34 -15
- package/src/urls/fill.ts +127 -0
- package/src/urls/frame.ts +39 -0
- package/src/urls/places.ts +18 -13
- package/src/urls/routes.ts +30 -10
- package/src/urls/rows.ts +98 -23
- package/src/urls/totp.ts +121 -0
- package/src/urls/unit.ts +95 -36
- package/src/urls/write-routes.ts +141 -25
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-import.ts +2 -9
- package/src/vault/vault-init.ts +1 -4
- package/src/vault/vault-restore.ts +1 -9
- package/src/veille/chrome.ts +8 -18
- package/src/veille/identity.ts +6 -5
- package/src/wiki/graph-page.ts +41 -39
- package/src/wiki/graph-positions.ts +13 -3
- package/src/wiki/graph-sim.ts +77 -0
- package/src/wiki/run-wiki.ts +12 -1
- package/src/advisors/door.ts +0 -59
- package/src/advisors/edge/certs.ts +0 -20
- package/src/advisors/edge/jwt.ts +0 -76
- package/src/advisors/edge/worker.ts +0 -52
- package/src/advisors/r2.ts +0 -46
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/cli/channel-run.ts +0 -17
- package/src/cli/cmd_Channel.ts +0 -43
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -818
- package/src/media-store/backup/daemon.ts +0 -205
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -362
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/thread-copy.ts +0 -343
- package/src/media-store/backup/watch.ts +0 -110
- package/src/orchestrator/channel-declare.ts +0 -58
- package/src/orchestrator/channel.ts +0 -226
- package/src/review/band.ts +0 -145
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hub-app/panel-tint.css +0 -6
- package/src/serve/hub-app/review/dock.tsx +0 -119
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -111
- package/src/serve/hub-app/review/review-board.tsx +0 -48
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
// newest version (rectangles, reactions, stars, the pick, his word), each clip's clock. Made when a thread opens,
|
|
4
4
|
// disposed when another one does. Only the newest version takes his marks: an older one shows what was said on it
|
|
5
5
|
import { compareShallow, computed, computedStruct, makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
6
|
-
import
|
|
7
|
-
import type {
|
|
6
|
+
import { waitLinesOf } from '../../../review/expect.ts'
|
|
7
|
+
import type { WordRefs } from '../word-refs.ts'
|
|
8
|
+
import { viewHolderOf, waitsOnOwner, type Backlink, type Cell, type EventCell, type NoteCell, type ReplyCell, type ThreadView, type VerdictCell, type VersionCell } from '../../../review/cells.ts'
|
|
9
|
+
import { foldQuiet, quietOf, type QuietPiece, type Trace } from '../../../review/traces.ts'
|
|
10
|
+
import type { ShareEvent } from '../../../advisors/share-trace.ts'
|
|
8
11
|
import {
|
|
9
12
|
asOptions,
|
|
10
13
|
isApproved,
|
|
@@ -26,25 +29,33 @@ import {
|
|
|
26
29
|
asksNoVerdict,
|
|
27
30
|
} from '../../../review/model.ts'
|
|
28
31
|
import { AttachSt } from './attach-st.ts'
|
|
32
|
+
import { OutboxSt } from './outbox-st.ts'
|
|
29
33
|
import { DocSlot } from '../editor/doc-slot.ts'
|
|
30
|
-
import { MentionSt } from './mention-st.ts'
|
|
34
|
+
import { MentionSt, partyJump } from './mention-st.ts'
|
|
35
|
+
import type { RefBox } from '../auto-text.tsx'
|
|
31
36
|
import { PicturesSt } from './pictures-st.ts'
|
|
32
37
|
import { ClipSt } from './clip-st.ts'
|
|
33
|
-
import { answeredAs, postJson } from './review-kit.ts'
|
|
38
|
+
import { answeredAs, movedOfError, postJson, READ_MS } from './review-kit.ts'
|
|
39
|
+
import { reach } from '../reach.ts'
|
|
34
40
|
import type { ReviewSt } from './review-st.ts'
|
|
35
|
-
import type {
|
|
41
|
+
import type { ThreadBarSt } from '../advisors-st.ts'
|
|
42
|
+
import { ADVISOR_WHO, type ReviewAct } from './review-host.ts'
|
|
36
43
|
import { TrailerSt } from './trailer-st.ts'
|
|
37
44
|
import { laneNotes, notesNow, sortedDraft, type LaneNote } from '../../../review/trailer-notes.ts'
|
|
38
45
|
import { ITEM_VERDICTS, type ItemVerdict } from '../../../review/verdict-items.ts'
|
|
46
|
+
import { toneOfStatus } from './tones.ts'
|
|
39
47
|
import { versionActs } from '../../../review/settle.ts'
|
|
40
48
|
import type { LaneMark } from '../../../review/trailer-model.ts'
|
|
41
49
|
import { KeptFolds } from '../kept-folds.ts'
|
|
42
50
|
import { foldSuperseded, runOf } from './superseded-runs.ts'
|
|
43
51
|
import { fixReactions, spotWords, versionFix, versionObject, type ReplyOn, type Spot } from '../../../review/one-block.ts'
|
|
52
|
+
import { findLast } from '../../../core/es2022.ts'
|
|
53
|
+
import { bandOf, mootAt } from '../../../review/thread-state.ts'
|
|
44
54
|
|
|
45
55
|
|
|
46
|
-
/** what the object panel shows: the object a message links (its cell, its address),
|
|
47
|
-
|
|
56
|
+
/** what the object panel shows: the object a message links (its cell, its address), a loose picture, or a cell's
|
|
57
|
+
* content whole (« open beside », its button in the cell's head) */
|
|
58
|
+
export type PanelObject = { cell: string; address: string } | { src: string; title: string } | { whole: string }
|
|
48
59
|
export interface Draft {
|
|
49
60
|
rects: Rect[]
|
|
50
61
|
comment: string
|
|
@@ -57,6 +68,8 @@ const EMPTY: Draft = { rects: [], comment: '' }
|
|
|
57
68
|
|
|
58
69
|
/** a draft's marks, its words left out */
|
|
59
70
|
type Marks = Pick<Draft, 'rects' | 'reactions' | 'pick'>
|
|
71
|
+
/** his click on a kind's action, on its way or answered: `why` the store's refusal */
|
|
72
|
+
export type ActState = { name: string; state: 'sending' | 'sent' | 'failed'; why?: string }
|
|
60
73
|
const sameMarks = (a: Marks, b: Marks): boolean => a.rects === b.rects && a.reactions === b.reactions && a.pick === b.pick
|
|
61
74
|
|
|
62
75
|
const isDirty = (d: Draft | undefined): boolean => d !== undefined && (d.rects.length > 0 || d.comment.trim() !== '' || (d.reactions ?? []).length > 0 || d.pick !== undefined)
|
|
@@ -68,12 +81,51 @@ export type Framed = VersionCell | VerdictCell | ReplyCell | NoteCell
|
|
|
68
81
|
export const TILE_FILTERS = ['all', 'unrated', 'low', 'fix'] as const
|
|
69
82
|
export type TileFilter = (typeof TILE_FILTERS)[number]
|
|
70
83
|
|
|
71
|
-
/** a cell drawn as one trace line (review/traces.ts): an event, a verdict with no words
|
|
72
|
-
|
|
84
|
+
/** a cell drawn as one trace line (review/traces.ts): an event, a verdict with no words; `share` a share's act, read
|
|
85
|
+
* from the advisors' store through the thread's bar, never a cell of the thread store (advisors/share-trace.ts) */
|
|
86
|
+
export type Traced = (EventCell | VerdictCell) & { trace: Trace; share?: ShareEvent; backlink?: Backlink }
|
|
73
87
|
|
|
74
88
|
/** one line of the thread as drawn: a day's divider, a run of traces, a framed cell, or a run of items a newer one
|
|
75
|
-
* superseded, one quiet line that opens to show them (superseded-runs.ts): `key` its first cell, `n` its items
|
|
76
|
-
|
|
89
|
+
* superseded, one quiet line that opens to show them (superseded-runs.ts): `key` its first cell, `n` its items;
|
|
90
|
+
* `recap`: the run is everything before the recap he accepted */
|
|
91
|
+
export type Line = { kind: 'day'; day: string } | { kind: 'events'; cells: Traced[] } | { kind: 'cell'; cell: Framed } | { kind: 'superseded'; key: string; n: number; words: string; recap?: true; lines: Line[] }
|
|
92
|
+
|
|
93
|
+
/** one trace line as drawn: the same trace in a row said once, `n` times, from `c` to `last` */
|
|
94
|
+
export interface TraceRun {
|
|
95
|
+
c: Traced
|
|
96
|
+
n: number
|
|
97
|
+
last: Traced
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** a run of traces as drawn (review-cells.tsx TraceLines): the same trace in a row one line, then two or more quiet lines
|
|
101
|
+
* in a row one fold, its key its first cell */
|
|
102
|
+
export function traceRunsOf(cells: readonly Traced[]): QuietPiece<TraceRun>[] {
|
|
103
|
+
const runs: TraceRun[] = []
|
|
104
|
+
for (const c of cells) {
|
|
105
|
+
const run = runs.at(-1)
|
|
106
|
+
if (run && run.c.summary === c.summary) {
|
|
107
|
+
run.n++
|
|
108
|
+
run.last = c
|
|
109
|
+
} else runs.push({ c, n: 1, last: c })
|
|
110
|
+
}
|
|
111
|
+
return foldQuiet(runs, (r) => quietOf(r.c.trace))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** the key of a fold of quiet trace lines: its first cell */
|
|
115
|
+
export const quietKey = (first: TraceRun): string => `quiet:${first.c.id}`
|
|
116
|
+
|
|
117
|
+
/** the fold of quiet trace lines a cell sits in, by its key; null when it sits in none */
|
|
118
|
+
export function quietFoldOf(lines: readonly Line[], cell: string): string | null {
|
|
119
|
+
for (const l of lines) {
|
|
120
|
+
const inner = l.kind === 'superseded' ? quietFoldOf(l.lines, cell) : null
|
|
121
|
+
if (inner !== null) return inner
|
|
122
|
+
const at = l.kind === 'events' ? l.cells.findIndex((c) => c.id === cell) : -1
|
|
123
|
+
if (l.kind !== 'events' || at < 0) continue
|
|
124
|
+
// a fold's lines are its cells in a row, first to last
|
|
125
|
+
for (const p of traceRunsOf(l.cells)) if ('fold' in p && at >= l.cells.indexOf(p.fold[0]!.c) && at <= l.cells.indexOf(p.fold.at(-1)!.last)) return quietKey(p.fold[0]!)
|
|
126
|
+
}
|
|
127
|
+
return null
|
|
128
|
+
}
|
|
77
129
|
|
|
78
130
|
/** one item of the contents strip: a cell, or one view of a version, and the key a click unfolds */
|
|
79
131
|
export interface Entry {
|
|
@@ -107,45 +159,42 @@ export interface SaidNote {
|
|
|
107
159
|
|
|
108
160
|
/** the dom id of a cell and of a view of a version: a message id carries a slash */
|
|
109
161
|
export const cellDom = (id: string): string => `rvc-${id.replace(/[^A-Za-z0-9-]/g, '_')}`
|
|
110
|
-
/** a step of an ask's instructions in the timeline
|
|
162
|
+
/** a step of an ask's instructions in the timeline */
|
|
111
163
|
export const stepDom = (cell: string, step: number): string => `${cellDom(cell)}-s${step}`
|
|
112
164
|
export const viewDom = (id: string, view: number): string => `${cellDom(id)}-v${view}`
|
|
113
165
|
export const viewKey = (id: string, view: number): string => `${id}#${view}`
|
|
114
166
|
/** one message's block in a draft version */
|
|
115
167
|
export const postDom = (id: string, key: string): string => `${cellDom(id)}-p-${key.replace(/[^a-z0-9-]/gi, '_')}`
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
export const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (a.kind === 'url' && a.value) return `${a.value.text}${a.value.opens ? '' : ' · did not open from this Mac'}`
|
|
147
|
-
if (a.value) return a.kind === 'file' ? `his file, view ${(a.value.view ?? 0) + 1}` : a.value.text
|
|
148
|
-
return 'yes'
|
|
168
|
+
|
|
169
|
+
/** where a question or a change stands in its cell: orange while it waits on the owner, green once answered, plain when
|
|
170
|
+
* a newer one superseded it, the thread's close ended it unanswered, or he left it unanswered (« no answer ») */
|
|
171
|
+
export const requestState = (c: ReplyCell, waiting: boolean): 'superseded' | 'waiting' | 'moot' | 'no-answer' | 'answered' =>
|
|
172
|
+
c.superseded ? 'superseded' : waiting ? 'waiting' : c.moot ? 'moot' : c.ask?.tone === 'no-answer' ? 'no-answer' : 'answered'
|
|
173
|
+
|
|
174
|
+
/** the owner's answer on a choice's row: the option clicked, else the owner's words alone, one more option at the
|
|
175
|
+
* row's end; null while none */
|
|
176
|
+
export const ownerChoice = (a: NonNullable<ReplyCell['ask']>): { option: number } | { words: string } | null =>
|
|
177
|
+
a.answered ? { option: a.answered.option } : a.none !== undefined ? { words: a.none } : null
|
|
178
|
+
|
|
179
|
+
/** cells in reading order: a divider when the day changes, the state changes in a row folded into one line, each run of
|
|
180
|
+
* superseded items folded into one line */
|
|
181
|
+
function linesOf(cells: readonly Cell[]): Line[] {
|
|
182
|
+
const out: Line[] = []
|
|
183
|
+
let day = ''
|
|
184
|
+
for (const c of cells) {
|
|
185
|
+
const d = dayOf(c.at)
|
|
186
|
+
if (d !== day) {
|
|
187
|
+
out.push({ kind: 'day', day: d })
|
|
188
|
+
day = d
|
|
189
|
+
}
|
|
190
|
+
const last = out.at(-1)
|
|
191
|
+
if (c.kind === 'event' || (c.kind === 'verdict' && c.trace !== undefined)) {
|
|
192
|
+
const t = c as Traced
|
|
193
|
+
if (last?.kind === 'events') last.cells.push(t)
|
|
194
|
+
else out.push({ kind: 'events', cells: [t] })
|
|
195
|
+
} else out.push({ kind: 'cell', cell: c })
|
|
196
|
+
}
|
|
197
|
+
return foldSuperseded(out)
|
|
149
198
|
}
|
|
150
199
|
|
|
151
200
|
/** a reaction is on that view, that tile of it, or that message of a draft version */
|
|
@@ -186,6 +235,8 @@ export class ThreadSt {
|
|
|
186
235
|
folds: Record<string, boolean> = {}
|
|
187
236
|
/** each run of superseded items he opened, by its first cell: kept in the browser, a run's cells belong to one thread */
|
|
188
237
|
readonly runs = new KeptFolds('hub:superseded-runs')
|
|
238
|
+
/** each fold of quiet trace lines he opened, by its first cell (review/traces.ts foldQuiet) */
|
|
239
|
+
readonly quiets = new KeptFolds('hub:quiet-traces')
|
|
189
240
|
/** a scroll asked of the thread column: it brings that dom id into view once, then clears it */
|
|
190
241
|
jump: string | null = null
|
|
191
242
|
/** the column scrolled to the newest cell once, on the first load */
|
|
@@ -194,9 +245,6 @@ export class ThreadSt {
|
|
|
194
245
|
* gallery the one tile it shows large; or the page of a version of an object (`states`), framed live */
|
|
195
246
|
boxed: { cell: string; view: number; tile?: number } | { cell: string; states: true } | null = null
|
|
196
247
|
private drafts: Record<string, Draft> = {}
|
|
197
|
-
/** the older version his answer goes to: a version landed while he wrote, or he chose to answer it. His first mark
|
|
198
|
-
* on the newest version, or « answer v4 », brings his answer back to the newest */
|
|
199
|
-
draftOn: string | null = null
|
|
200
248
|
/** the newest version's active view: the one last drawn on or picked, whose clip the keys drive */
|
|
201
249
|
view = 0
|
|
202
250
|
/** a picked rectangle of his draft: its note box opens beside it */
|
|
@@ -228,8 +276,11 @@ export class ThreadSt {
|
|
|
228
276
|
replyOn: ReplyOn | null = null
|
|
229
277
|
/** each ask to put the caret in the reply box: the composer takes it once no lightbox covers it */
|
|
230
278
|
replyAsk = 0
|
|
231
|
-
/** the kind's action he
|
|
232
|
-
|
|
279
|
+
/** the kind's action he clicked on an item, by `<item>#<link>`: drawn chosen in the click's frame (« sending… »), then
|
|
280
|
+
* « sent », or the linked object as it was with one line why */
|
|
281
|
+
acting: Record<string, ActState> = {}
|
|
282
|
+
/** the head's tag field: what he types in it, null while it is shut; « + tag » or « more » opens it */
|
|
283
|
+
tagTyping: string | null = null
|
|
233
284
|
busy = false
|
|
234
285
|
/** the verdict he just gave (null: the one he took back): drawn as given in the click's frame, the store's write
|
|
235
286
|
* behind it */
|
|
@@ -239,7 +290,7 @@ export class ThreadSt {
|
|
|
239
290
|
/** the popup of a face clicked on a version (its id) or a message that asks a verdict (its cell's id): the verdict
|
|
240
291
|
* `status` and its note as he types it; its send gives both in one answer, a bare send the plain verdict. `why`:
|
|
241
292
|
* the store refused that send, the popup back with the words typed. Never the reply box's words, a comment of their own */
|
|
242
|
-
note: { on: string; status: ItemVerdict; text: string; why?: string } | null = null
|
|
293
|
+
note: { on: string; status: ItemVerdict; text: string; why?: string; option?: number } | null = null
|
|
243
294
|
/** the verdicts on their way, written in the order he clicked; the number of the newest */
|
|
244
295
|
private saves: Promise<void> = Promise.resolve()
|
|
245
296
|
private saved = 0
|
|
@@ -249,12 +300,17 @@ export class ThreadSt {
|
|
|
249
300
|
/** the agent words already sent as read, by message id */
|
|
250
301
|
private readonly reading = new Set<string>()
|
|
251
302
|
private readonly load: () => Promise<ThreadView>
|
|
303
|
+
/** the next read after a failed one while nothing is drawn; `gone` once the thread closed */
|
|
304
|
+
private again: ReturnType<typeof setTimeout> | null = null
|
|
305
|
+
private gone = false
|
|
252
306
|
/** the reply box's files: each sent to the store as it is given */
|
|
253
307
|
readonly attach: AttachSt
|
|
254
308
|
/** the reply box's `@` list (mention-st.ts) */
|
|
255
309
|
readonly mentions: MentionSt
|
|
256
310
|
/** a message's pictures in the lightbox (pictures-st.ts) */
|
|
257
311
|
readonly pictures: PicturesSt
|
|
312
|
+
/** the owner's words on their way, drawn in the thread until the store has them (outbox-st.ts) */
|
|
313
|
+
readonly outbox: OutboxSt
|
|
258
314
|
|
|
259
315
|
constructor(
|
|
260
316
|
private readonly rv: ReviewSt,
|
|
@@ -267,7 +323,8 @@ export class ThreadSt {
|
|
|
267
323
|
this.attach = new AttachSt(() => rv.url(`/api/review/${encodeURIComponent(this.data?.head ?? id)}/upload`), { get: () => this.draft.comment, set: (t) => this.setComment(t) })
|
|
268
324
|
this.mentions = new MentionSt(() => rv.url(`/api/review/${encodeURIComponent(this.data?.head ?? id)}/mentions`))
|
|
269
325
|
this.pictures = new PicturesSt()
|
|
270
|
-
|
|
326
|
+
this.outbox = new OutboxSt({ url: (on) => rv.url(`/api/review/${on}/reply`), stored: (on) => rv.storedOutbox(on), keep: (on, v) => rv.keepOutbox(on, v), sent: () => this.answeredHere(), who: rv.host.role === 'advisor' ? ADVISOR_WHO : 'owner' })
|
|
327
|
+
makeAutoObservable<this, 'rv' | 'clips' | 'trailers' | 'reading' | 'load' | 'saves' | 'saved' | 'again' | 'gone' | 'acts'>(this, { rv: false, clips: false, trailers: false, reading: false, load: false, saves: false, acts: false, saved: false, again: false, gone: false, attach: false, mentions: false, pictures: false, outbox: false, data: observableRef, docs: false, openRef: false, marks: computed({ equals: sameMarks }), viewMarks: computedStruct, waitingViews: computedStruct, shownReactions: computed({ equals: compareShallow }) })
|
|
271
328
|
// a thread read before draws in this frame; the open reads it again at once
|
|
272
329
|
const held = rv.views.view(id)
|
|
273
330
|
if (held !== null) this.receive(held)
|
|
@@ -276,6 +333,14 @@ export class ThreadSt {
|
|
|
276
333
|
/** an ask's standing instructions open whole in the hub's one editor (asks/ask-doc.ts); a save reads the thread again */
|
|
277
334
|
readonly docs = new DocSlot((p) => this.rv.url(p), () => void this.refresh())
|
|
278
335
|
|
|
336
|
+
/** the `@` list of a box whose words an agent of this thread reads (auto-text.tsx): every resource of the owner's
|
|
337
|
+
* repo, with `parties` the parties a reply names first; none at the advisors' door */
|
|
338
|
+
refBox(parties = false): RefBox | undefined {
|
|
339
|
+
const owner = this.rv.host.owner
|
|
340
|
+
if (owner == null) return undefined
|
|
341
|
+
return { list: owner.home.refs, repo: owner, ...(parties ? { extra: () => (this.mentions.candidates ?? []).map(partyJump) } : {}) }
|
|
342
|
+
}
|
|
343
|
+
|
|
279
344
|
/** the ask `id`'s instructions opened in the editor; its save is new instructions, every answer of his kept on its
|
|
280
345
|
* step or field, and the thread reads again */
|
|
281
346
|
editAsk(id: string): void {
|
|
@@ -283,6 +348,9 @@ export class ThreadSt {
|
|
|
283
348
|
}
|
|
284
349
|
|
|
285
350
|
dispose(): void {
|
|
351
|
+
this.gone = true
|
|
352
|
+
if (this.again !== null) clearTimeout(this.again)
|
|
353
|
+
this.again = null
|
|
286
354
|
this.docs.dispose()
|
|
287
355
|
for (const c of this.clips.values()) c.pause()
|
|
288
356
|
this.clips.clear()
|
|
@@ -314,19 +382,31 @@ export class ThreadSt {
|
|
|
314
382
|
this.error = null
|
|
315
383
|
})
|
|
316
384
|
} catch (e) {
|
|
385
|
+
// a thread moved to another repo: its old link opens it where it is now
|
|
386
|
+
const moved = movedOfError(e)
|
|
387
|
+
if (moved !== null && this.followMove(moved)) return
|
|
317
388
|
runInAction(() => (this.error = (e as Error).message))
|
|
389
|
+
// a pane with nothing drawn reads again by itself: under the live socket no poll would
|
|
390
|
+
if (this.data === null && !this.gone && this.again === null) {
|
|
391
|
+
this.again = setTimeout(() => {
|
|
392
|
+
this.again = null
|
|
393
|
+
if (!this.gone) void this.refresh()
|
|
394
|
+
}, this.rv.host.readMs ?? READ_MS)
|
|
395
|
+
}
|
|
318
396
|
}
|
|
319
397
|
}
|
|
320
398
|
|
|
321
|
-
/** a thread from the server: a cell he sees keeps its fold when a new answer changes the defaults; a
|
|
322
|
-
*
|
|
399
|
+
/** a thread from the server: a cell he sees keeps its fold when a new answer changes the defaults; a draft on an
|
|
400
|
+
* older version (one that landed while he wrote, or one kept in the browser) goes to the newest, which his answer
|
|
401
|
+
* answers when sent */
|
|
323
402
|
receive(v: ThreadView): void {
|
|
324
|
-
|
|
403
|
+
// the same answer again (a 304) still settles a send that turned sent since: the read that drew its message may
|
|
404
|
+
// have come before the send's own answer, and no later read changes
|
|
405
|
+
if (v === this.data) return this.outbox.settle(v.cells.map((c) => ({ id: c.id, who: c.who, ...(c.kind === 'reply' ? { text: c.text } : {}) })))
|
|
325
406
|
const before = this.data
|
|
326
407
|
// a cell a newer object just superseded folds even under the owner's eyes: that is the point of superseding it
|
|
327
408
|
const gone = new Set(v.cells.flatMap((c) => (c.superseded ? [c.id] : [])))
|
|
328
409
|
if (before) for (const c of before.cells) if (c.kind !== 'event' && !gone.has(c.id) && this.folds[c.id] === undefined && this.defaultOpen(c, before) !== this.defaultOpen(c, v)) this.folds = { ...this.folds, [c.id]: this.defaultOpen(c, before) }
|
|
329
|
-
if (before && before.head !== v.head && this.draftOn === null && isDirty(this.drafts[before.head]) && v.members.includes(before.head)) this.draftOn = before.head
|
|
330
410
|
this.data = v
|
|
331
411
|
// an address's view on a link to an old version is that version's view, never the newest's
|
|
332
412
|
if (!before && v.asked !== v.head && this.view > 0) {
|
|
@@ -334,14 +414,18 @@ export class ThreadSt {
|
|
|
334
414
|
this.view = 0
|
|
335
415
|
this.reveal(v.asked, at)
|
|
336
416
|
}
|
|
337
|
-
|
|
338
|
-
// every version's draft kept in the browser is found again: an older one stays on its version (`parked`)
|
|
417
|
+
// every version's draft kept in the browser is found again
|
|
339
418
|
const found: Record<string, Draft> = {}
|
|
340
419
|
for (const id of v.members) {
|
|
341
420
|
const d = this.drafts[id] === undefined ? this.rv.storedDraft(id) : null
|
|
342
421
|
if (d) found[id] = d
|
|
343
422
|
}
|
|
344
423
|
if (Object.keys(found).length > 0) this.drafts = { ...this.drafts, ...found }
|
|
424
|
+
for (const id of v.members) if (id !== v.head && isDirty(this.drafts[id])) this.carry(id, v.head)
|
|
425
|
+
const ids = new Set(v.cells.map((c) => c.id))
|
|
426
|
+
this.outbox.settle(v.cells.map((c) => ({ id: c.id, who: c.who, ...(c.kind === 'reply' ? { text: c.text } : {}) })))
|
|
427
|
+
if (Object.keys(this.deleting).some((id) => !ids.has(id))) this.deleting = Object.fromEntries(Object.keys(this.deleting).filter((id) => ids.has(id)).map((id) => [id, true as const]))
|
|
428
|
+
this.outbox.restore(v.members)
|
|
345
429
|
}
|
|
346
430
|
|
|
347
431
|
private defaultOpen(c: Cell, v: ThreadView): boolean {
|
|
@@ -355,10 +439,9 @@ export class ThreadSt {
|
|
|
355
439
|
return this.data?.cells ?? []
|
|
356
440
|
}
|
|
357
441
|
|
|
358
|
-
/** the cell the owner's verdict and reply go to: the newest version, or the raised item no version answers
|
|
359
|
-
* version his draft sits on while a newer one landed */
|
|
442
|
+
/** the cell the owner's verdict and reply go to: the newest version, or the raised item no version answers */
|
|
360
443
|
get head(): Framed | null {
|
|
361
|
-
const h = this.
|
|
444
|
+
const h = this.data?.head
|
|
362
445
|
return (this.cells.find((c) => c.id === h && c.kind !== 'event') as Framed | undefined) ?? null
|
|
363
446
|
}
|
|
364
447
|
|
|
@@ -368,68 +451,32 @@ export class ThreadSt {
|
|
|
368
451
|
return (this.cells.find((c) => c.id === h && c.kind !== 'event') as Framed | undefined) ?? null
|
|
369
452
|
}
|
|
370
453
|
|
|
371
|
-
/**
|
|
372
|
-
*
|
|
373
|
-
|
|
374
|
-
if (this.draftOn !== null || !this.data) return null
|
|
375
|
-
const head = this.data.head
|
|
376
|
-
return [...this.data.members].reverse().find((id) => id !== head && isDirty(this.drafts[id])) ?? null
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/** the newest version takes his marks while his answer sits on an older one: his first mark brings it back */
|
|
380
|
-
get claims(): boolean {
|
|
381
|
-
const n = this.newest
|
|
382
|
-
return this.draftOn !== null && n?.kind === 'version' && !n.item.wip
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/** his answer goes to the newest version; the draft on the older one stays there, parked */
|
|
386
|
-
answerNewest(): void {
|
|
387
|
-
if (this.draftOn === null) return
|
|
388
|
-
this.draftOn = null
|
|
389
|
-
this.rect = null
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/** his answer goes to the older version his parked draft is on */
|
|
393
|
-
answerParked(): void {
|
|
394
|
-
const p = this.parked
|
|
395
|
-
if (p === null) return
|
|
396
|
-
this.draftOn = p
|
|
397
|
-
this.rect = null
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/** the parked draft dropped: his notes and his word on the older version */
|
|
401
|
-
dropParked(): void {
|
|
402
|
-
const p = this.parked
|
|
403
|
-
if (p !== null) this.put(p, null)
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/** his draft moved onto the newest version: his word, and the marks whose view the newest has; what does not fit
|
|
407
|
-
* stays on the older one */
|
|
408
|
-
moveDraft(): void {
|
|
409
|
-
const from = this.draftOn ?? this.parked
|
|
410
|
-
const to = this.data?.head
|
|
411
|
-
if (from === null || !to) return
|
|
454
|
+
/** a draft moved from an older version onto `to`: his word, and the marks whose view `to` has; what does not fit
|
|
455
|
+
* stays on the older one, never dropped */
|
|
456
|
+
private carry(from: string, to: string): void {
|
|
412
457
|
const d = this.drafts[from] ?? EMPTY
|
|
413
458
|
const toItem = this.versionOf(to)?.item
|
|
414
459
|
const views = (toItem?.views ?? []).length
|
|
415
460
|
const fits = (view: number | undefined): boolean => (view ?? 0) < views
|
|
416
461
|
// a word on a message of a draft follows to a newer draft version, which holds no view
|
|
417
462
|
const takes = (r: ReviewReaction): boolean => (r.post !== undefined ? toItem?.draft !== undefined : fits(r.view))
|
|
463
|
+
const rects = d.rects.filter((r) => fits(r.view))
|
|
464
|
+
const taken = (d.reactions ?? []).filter(takes)
|
|
465
|
+
if (d.comment.trim() === '' && rects.length === 0 && taken.length === 0) return
|
|
418
466
|
const into = this.drafts[to] ?? EMPTY
|
|
419
467
|
const moved: Draft = {
|
|
420
468
|
comment: [into.comment, d.comment].filter((x) => x.trim() !== '').join('\n'),
|
|
421
|
-
rects: [...into.rects, ...
|
|
469
|
+
rects: [...into.rects, ...rects],
|
|
422
470
|
...(into.pick !== undefined ? { pick: into.pick } : {}),
|
|
423
471
|
}
|
|
424
|
-
const reactions = [...(into.reactions ?? []), ...
|
|
472
|
+
const reactions = [...(into.reactions ?? []), ...taken.filter((r) => !(into.reactions ?? []).some((q) => sameSpot(q, r.view, r.tile, r.post)))]
|
|
425
473
|
if (reactions.length > 0) moved.reactions = reactions
|
|
426
|
-
|
|
474
|
+
// a pick names a view of the older version: it stays there with it
|
|
475
|
+
const left: Draft = { comment: '', rects: d.rects.filter((r) => !fits(r.view)), ...(d.pick !== undefined ? { pick: d.pick } : {}) }
|
|
427
476
|
const leftReactions = (d.reactions ?? []).filter((r) => !takes(r))
|
|
428
477
|
if (leftReactions.length > 0) left.reactions = leftReactions
|
|
429
478
|
this.put(to, moved)
|
|
430
479
|
this.put(from, isDirty(left) ? left : null)
|
|
431
|
-
this.draftOn = null
|
|
432
|
-
this.rect = null
|
|
433
480
|
}
|
|
434
481
|
|
|
435
482
|
get headItem(): Item | null {
|
|
@@ -442,7 +489,8 @@ export class ThreadSt {
|
|
|
442
489
|
const h = this.head
|
|
443
490
|
// a thread opened with words holds nothing to judge: its questions and changes take his answer in their cells;
|
|
444
491
|
// his own save neither
|
|
445
|
-
|
|
492
|
+
// a promised next version replaces it: no verdict needed (review/thread-state.ts ThreadState next)
|
|
493
|
+
return h?.kind === 'version' && !h.item.wip && !asksNoVerdict(h.item) && this.data?.state.next == null
|
|
446
494
|
}
|
|
447
495
|
|
|
448
496
|
/** the version cell an item id names */
|
|
@@ -450,25 +498,109 @@ export class ThreadSt {
|
|
|
450
498
|
return (this.cells.find((c) => c.kind === 'version' && c.id === id) as VersionCell | undefined) ?? null
|
|
451
499
|
}
|
|
452
500
|
|
|
453
|
-
/** the
|
|
454
|
-
*
|
|
455
|
-
get
|
|
456
|
-
const out
|
|
457
|
-
let day = ''
|
|
501
|
+
/** the cell whose item holds the views a message names: a version, or the item he raised (review/cells.ts viewHolderOf);
|
|
502
|
+
* every reader of a message's media goes through it */
|
|
503
|
+
get holders(): ReadonlyMap<string, VersionCell> {
|
|
504
|
+
const out = new Map<string, VersionCell>()
|
|
458
505
|
for (const c of this.cells) {
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
506
|
+
const h = viewHolderOf(c)
|
|
507
|
+
if (h !== null) out.set(c.id, h)
|
|
508
|
+
}
|
|
509
|
+
return out
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
holderOf(id: string): VersionCell | null {
|
|
513
|
+
return this.holders.get(id) ?? null
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** the house repos this thread may move to, every one but its own, as the move route takes them; null until read */
|
|
517
|
+
moveTargets: string[] | null = null
|
|
518
|
+
|
|
519
|
+
/** the house repos read once, when the head first draws its « move to project… » */
|
|
520
|
+
async readMoveTargets(): Promise<void> {
|
|
521
|
+
if (this.moveTargets !== null || this.rv.host.owner == null || !this.rv.can('move')) return
|
|
522
|
+
try {
|
|
523
|
+
const r = await (await reach(this.rv.url('/api/review/move-targets'), { cache: 'no-store' })).json() as { repos?: string[] }
|
|
524
|
+
runInAction(() => (this.moveTargets = r.repos ?? []))
|
|
525
|
+
} catch {
|
|
526
|
+
runInAction(() => (this.moveTargets = []))
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** his « move to project… »: the thread moves whole to `repo` (review/move.ts), then opens there */
|
|
531
|
+
async moveTo(repo: string): Promise<void> {
|
|
532
|
+
const head = this.data?.head
|
|
533
|
+
if (head === undefined) return
|
|
534
|
+
try {
|
|
535
|
+
const m = await postJson<{ repo: string; head: string }>(this.rv.url(`/api/review/${head}/move`), { repo })
|
|
536
|
+
this.followMove(m)
|
|
537
|
+
} catch (e) {
|
|
538
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** the thread opened where it moved, in its repo's threads; false at the advisors' door, which has no other repo */
|
|
543
|
+
followMove(m: { repo: string; head: string }): boolean {
|
|
544
|
+
const o = this.rv.host.owner
|
|
545
|
+
if (o == null) return false
|
|
546
|
+
o.home.openReview(m.repo, m.head)
|
|
547
|
+
return true
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** the thread's bar of advisors, where he may share: its shares' acts are lines of this timeline */
|
|
551
|
+
get shareBar(): ThreadBarSt | null {
|
|
552
|
+
const o = this.rv.host.owner
|
|
553
|
+
const head = this.data?.head
|
|
554
|
+
if (o == null || head === undefined || !this.rv.can('share')) return null
|
|
555
|
+
return o.home.advisors.bar(this.rv.host.name, head)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** each act of the thread's shares as a trace cell, at its own time (advisors/share-trace.ts) */
|
|
559
|
+
get shareCells(): Traced[] {
|
|
560
|
+
const head = this.data?.head ?? ''
|
|
561
|
+
return (this.shareBar?.data?.trace ?? []).map((e) => ({ kind: 'event' as const, id: e.id, on: head, at: e.at, who: e.who, party: 'owner' as const, summary: e.words, open: false, trace: { act: 'share' as const, did: e.words, ...(e.live === true ? { live: true as const } : {}) }, share: e }))
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/** each message of another thread that names this one by its code, a quiet line of the timeline at its time */
|
|
565
|
+
get backlinkCells(): Traced[] {
|
|
566
|
+
const head = this.data?.head ?? ''
|
|
567
|
+
return (this.data?.backlinks ?? []).map((b) => ({ kind: 'event' as const, id: `mention:${b.cell}`, on: head, at: b.at, who: 'agent', party: 'agent' as const, summary: `mentioned in #${b.from.code} ${b.from.title}`, open: false, trace: { act: 'mention' as const, did: 'mentioned in' }, backlink: b }))
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** what the words of this thread know of the threads they name by code: each pill's title and band, a click opens it */
|
|
571
|
+
get wordRefs(): WordRefs {
|
|
572
|
+
const refs = this.data?.refs ?? {}
|
|
573
|
+
const parties = this.rv.parties
|
|
574
|
+
const now = this.rv.bandNow
|
|
575
|
+
return {
|
|
576
|
+
look: (c) => {
|
|
577
|
+
const r = refs[c]
|
|
578
|
+
return r === undefined ? null : { code: r.code, head: r.head, title: r.title, band: bandOf(r.state, parties, now) }
|
|
579
|
+
},
|
|
580
|
+
open: this.openRef,
|
|
470
581
|
}
|
|
471
|
-
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** a thread a pill or a backlink names, opened in the page */
|
|
585
|
+
readonly openRef = (head: string): void => this.rv.pick(head)
|
|
586
|
+
|
|
587
|
+
/** the thread in reading order: a divider when the day changes, the state changes in a row folded into one line,
|
|
588
|
+
* each run of superseded items folded into one line; the shares' acts among them by their time */
|
|
589
|
+
get lines(): Line[] {
|
|
590
|
+
const shares = [...this.shareCells, ...this.backlinkCells]
|
|
591
|
+
// the owner's words on their way stand last: the newest, whatever the clock of the store says
|
|
592
|
+
const cells = Object.keys(this.deleting).length === 0 ? this.cells : this.cells.filter((c) => !this.deleting[c.id])
|
|
593
|
+
const all: Cell[] = [...(shares.length === 0 ? cells : [...cells, ...shares].sort((a, b) => a.at.localeCompare(b.at))), ...this.outbox.cells]
|
|
594
|
+
// past a recap he accepted, what came before it is one quiet line that opens (review/cells.ts ThreadView recap)
|
|
595
|
+
const recap = this.data?.recap
|
|
596
|
+
if (recap === undefined) return linesOf(all)
|
|
597
|
+
const before = new Set(recap.before)
|
|
598
|
+
const own = new Set(cells)
|
|
599
|
+
// a share's act or a backlink before the recap folds with it
|
|
600
|
+
const fold = new Set(all.filter((c) => before.has(c.id) || (c.at < recap.at && !own.has(c))))
|
|
601
|
+
if (fold.size === 0) return linesOf(all)
|
|
602
|
+
const n = [...fold].filter((c) => c.kind !== 'event').length
|
|
603
|
+
return [{ kind: 'superseded', key: `recap:${recap.cell}`, n, words: `${n} message${n === 1 ? '' : 's'} before the recap`, recap: true, lines: linesOf(all.filter((c) => fold.has(c))) }, ...linesOf(all.filter((c) => !fold.has(c)))]
|
|
472
604
|
}
|
|
473
605
|
|
|
474
606
|
/** the run of superseded items is open: shut until he opens it */
|
|
@@ -480,38 +612,74 @@ export class ThreadSt {
|
|
|
480
612
|
this.runs.flipFold(key, false)
|
|
481
613
|
}
|
|
482
614
|
|
|
483
|
-
/** a
|
|
615
|
+
/** a fold of quiet trace lines is open: shut until he opens it */
|
|
616
|
+
quietOpen(key: string): boolean {
|
|
617
|
+
return this.quiets.isOpen(key, false)
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
toggleQuiet(key: string): void {
|
|
621
|
+
this.quiets.flipFold(key, false)
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** a jump to a cell inside a shut run opens the run, and the fold of quiet traces it sits in */
|
|
484
625
|
private openRunOf(cell: string): void {
|
|
485
626
|
const key = runOf(this.lines, cell)
|
|
486
627
|
if (key !== null) this.runs.setFold(key, true)
|
|
628
|
+
const fold = quietFoldOf(this.lines, cell)
|
|
629
|
+
if (fold !== null) this.quiets.setFold(fold, true)
|
|
487
630
|
}
|
|
488
631
|
|
|
489
|
-
// ──
|
|
632
|
+
// ── what waits on his answer: the arrows at the column's top count it (wiki tools/shipkit/threads-page.md, The timeline) ──
|
|
490
633
|
|
|
491
|
-
/** each question and proposed change of an agent that still waits on him, oldest first
|
|
492
|
-
*
|
|
634
|
+
/** each question and proposed change of an agent that still waits on him, oldest first: the server closes a request
|
|
635
|
+
* asked before the close, whoever closed (review/cells.ts, moot), and one asked after it waits */
|
|
493
636
|
get openRequests(): ReplyCell[] {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
637
|
+
// a question with a row per thing waits as one, by its first row: the cell that draws every row
|
|
638
|
+
const seen = new Set<string>()
|
|
639
|
+
const out: ReplyCell[] = []
|
|
640
|
+
// what the thread's state says waits on him (review/thread-state.ts), its rows as one; an answer on its way
|
|
641
|
+
// already closes its cell here
|
|
642
|
+
const waits = new Set(this.data ? waitLinesOf(this.data.state).map((l) => l.id) : [])
|
|
643
|
+
const rowOf = (c: ReplyCell): ReplyCell => (c.ask?.row ? (this.rowsOf(c)[0] ?? c) : c)
|
|
644
|
+
for (const c of this.cells.filter((x): x is ReplyCell => waitsOnOwner(x) && (waits.has(x.id) || waits.has(rowOf(x).id)))) {
|
|
645
|
+
const g = c.ask?.row?.group
|
|
646
|
+
if (g === undefined) out.push(c)
|
|
647
|
+
else if (!seen.has(g)) {
|
|
648
|
+
seen.add(g)
|
|
649
|
+
out.push(this.rowsOf(c)[0] ?? c)
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return out
|
|
497
653
|
}
|
|
498
654
|
|
|
499
|
-
/**
|
|
500
|
-
|
|
655
|
+
/** the rows of the question with a row per thing that `c` is one row of, in row order; empty for any other cell */
|
|
656
|
+
rowsOf(c: ReplyCell): ReplyCell[] {
|
|
657
|
+
const g = c.ask?.row?.group
|
|
658
|
+
if (g === undefined) return []
|
|
659
|
+
return this.cells.filter((x): x is ReplyCell => x.kind === 'reply' && x.ask?.row?.group === g).sort((a, b) => a.ask!.row!.i - b.ask!.row!.i)
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** every cell that waits on him: the open requests, then the version that waits for the owner's verdict */
|
|
663
|
+
get waiting(): string[] {
|
|
664
|
+
const v = this.verdictAbove
|
|
665
|
+
return [...this.openRequests.map((c) => c.id), ...(v ? [v.id] : [])]
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/** when the close moots what was asked before it, whoever closed; null while it is open (review/thread-state.ts
|
|
669
|
+
* mootAt): a request asked before it closes with it, one asked after it still waits */
|
|
501
670
|
get closedAt(): string | null {
|
|
502
|
-
return this.data
|
|
671
|
+
return this.data ? mootAt(this.data.state) : null
|
|
503
672
|
}
|
|
504
673
|
|
|
505
|
-
/** the request still waits on him: its cell draws its controls live
|
|
674
|
+
/** the request still waits on him: its cell draws its controls live */
|
|
506
675
|
waitsNow(id: string): boolean {
|
|
507
676
|
return this.openRequests.some((c) => c.id === id)
|
|
508
677
|
}
|
|
509
678
|
|
|
510
|
-
/** the version that waits for the owner's verdict: its
|
|
511
|
-
* dock holds one line that reminds of it */
|
|
679
|
+
/** the version that waits for the owner's verdict: its answer bar sits at its foot (tone-bar.tsx) */
|
|
512
680
|
get verdictAbove(): VersionCell | null {
|
|
513
681
|
const h = this.head
|
|
514
|
-
if (h?.kind !== 'version' || !this.takesVerdict || this.chosenOn(h.id) !== undefined || this.data?.state.
|
|
682
|
+
if (h?.kind !== 'version' || !this.takesVerdict || this.chosenOn(h.id) !== undefined || this.data?.state.closed != null) return null
|
|
515
683
|
return h
|
|
516
684
|
}
|
|
517
685
|
|
|
@@ -521,10 +689,11 @@ export class ThreadSt {
|
|
|
521
689
|
return this.save(c.id, status, () => postJson(this.rv.url(`/api/review/${c.on}/item-verdict`), { re: c.id.slice(c.on.length + 1), status, ...(text !== '' ? { text } : {}) }), false)
|
|
522
690
|
}
|
|
523
691
|
|
|
524
|
-
/** V F R
|
|
525
|
-
* when none waits. It opens that
|
|
692
|
+
/** 1 to 5, V F R X Y: the tone on the newest open item that asks the owner's answer, a message, a question or the
|
|
693
|
+
* version; the version when none waits. It opens that tone's box, ok and your call too: a key alone never sends,
|
|
694
|
+
* Enter does */
|
|
526
695
|
judgeKey(status: ItemVerdict): Promise<void> | void {
|
|
527
|
-
const c = [...this.openRequests].reverse().find((x) => x.judge?.open === true)
|
|
696
|
+
const c = [...this.openRequests].reverse().find((x) => x.judge?.open === true || this.questionCell(x.id) !== undefined)
|
|
528
697
|
const v = this.verdictAbove
|
|
529
698
|
if (c !== undefined && (v === null || c.at >= v.at)) return this.face(c.id, status)
|
|
530
699
|
// a version answered by its kind's acts (a draft) takes no verdict, by key either
|
|
@@ -535,9 +704,86 @@ export class ThreadSt {
|
|
|
535
704
|
|
|
536
705
|
/** a face clicked on `on` (a version's id, or a message's cell id): its popup opens there, its box empty; another
|
|
537
706
|
* face of that item open swaps to this one and keeps the words typed; the same face again closes it. Nothing is sent */
|
|
538
|
-
face(on: string, status: ItemVerdict): void {
|
|
539
|
-
const n = this.note?.on === on ? this.note : null
|
|
540
|
-
this.note = n?.status === status ? null : { on, status, text: n?.text ?? '' }
|
|
707
|
+
face(on: string, status: ItemVerdict, option?: number): void {
|
|
708
|
+
const n = this.note?.on === on && this.note.option === option ? this.note : null
|
|
709
|
+
this.note = n?.status === status ? null : { on, status, text: n?.text ?? '', ...(option !== undefined ? { option } : {}) }
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/** a click on a tone of the bar (tone-bar.tsx): ok and your call send at once; one that takes words, or the one
|
|
713
|
+
* already given, opens its box (face). `option`: the bar of one option of a question (the lightbox's side panel),
|
|
714
|
+
* whose ok and fix take that option */
|
|
715
|
+
tone(on: string, status: ItemVerdict, option?: number): Promise<void> | void {
|
|
716
|
+
if (toneOfStatus(status)?.words === true || this.litOn(on, status, option)) return this.face(on, status, option)
|
|
717
|
+
this.note = { on, status, text: '', ...(option !== undefined ? { option } : {}) }
|
|
718
|
+
return this.sendNote()
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** the tone given on `on`, read for the bar of one option: its ok and fix are lit on the option he picked alone */
|
|
722
|
+
litOn(on: string, status: ItemVerdict, option?: number): boolean {
|
|
723
|
+
if (this.givenOn(on) !== status) return false
|
|
724
|
+
if (option === undefined || (status !== 'approved' && status !== 'approved-with-fix')) return true
|
|
725
|
+
const q = this.questionCell(on)
|
|
726
|
+
return q !== undefined && this.yours(q) === option
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/** the option of a question marked as the reader's: their click on its way, else their own pick (the owner's, on his hub) */
|
|
730
|
+
yours(c: ReplyCell): number | undefined {
|
|
731
|
+
const ask = c.ask
|
|
732
|
+
if (ask === undefined) return undefined
|
|
733
|
+
const local = this.picking[c.id]
|
|
734
|
+
if (local !== undefined && local.state !== 'failed') return local.option
|
|
735
|
+
if (this.rv.host.role === 'advisor') return ask.people?.find((p) => p.you === true)?.option
|
|
736
|
+
const his = ownerChoice(ask)
|
|
737
|
+
return ask.ownerPick ?? (ask.answered?.by === undefined && his !== null && 'option' in his ? his.option : undefined)
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/** the reader's remark with their pick (« pick with a remark »): their click on its way, else the answer's; '' with none */
|
|
741
|
+
yourRemark(c: ReplyCell): string {
|
|
742
|
+
const local = this.picking[c.id]
|
|
743
|
+
if (local !== undefined && local.state !== 'failed') return local.remark ?? ''
|
|
744
|
+
const yours = this.yours(c)
|
|
745
|
+
return yours !== undefined && c.ask?.answered?.option === yours ? (c.ask.answered.remark ?? '') : ''
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** the question and its option a view of version `cell` draws (an option's picture), the newest question first; the
|
|
749
|
+
* lightbox opened on it steps through that question's options (a row question's, its row's) */
|
|
750
|
+
optionAt(cell: string, view: number): { c: ReplyCell; i: number; order: number[] } | null {
|
|
751
|
+
for (const c of [...this.cells].reverse()) {
|
|
752
|
+
if (c.kind !== 'reply' || c.ask?.views === undefined || c.on !== cell) continue
|
|
753
|
+
const i = c.ask.views.indexOf(view)
|
|
754
|
+
if (i < 0) continue
|
|
755
|
+
return { c, i, order: c.ask.views.flatMap((v, k) => (v === null ? [] : [k])) }
|
|
756
|
+
}
|
|
757
|
+
return null
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/** the question `on` names when the bar answers it: a choice of one thing, no step of an ask's instructions */
|
|
761
|
+
questionCell(on: string): ReplyCell | undefined {
|
|
762
|
+
const c = this.askingCell(on)
|
|
763
|
+
return c?.ask !== undefined && (c.ask.kind === undefined || c.ask.kind === 'choice') && c.step === undefined && c.judge === undefined ? c : undefined
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** the tone the owner's answer to a question gives, the one on its way first: a pick ok, a pick with the owner's words a fix, words
|
|
767
|
+
* alone a rework unless he named another tone */
|
|
768
|
+
private questionTone(c: ReplyCell): ItemVerdict | undefined {
|
|
769
|
+
const a = c.ask!
|
|
770
|
+
const local = this.picking[c.id]
|
|
771
|
+
if (local !== undefined && local.state !== 'failed') return local.remark ? 'approved-with-fix' : 'approved'
|
|
772
|
+
if (a.tone !== undefined && (ITEM_VERDICTS as readonly string[]).includes(a.tone)) return a.tone as ItemVerdict
|
|
773
|
+
if (a.answered !== undefined) return a.answered.remark ? 'approved-with-fix' : 'approved'
|
|
774
|
+
return a.none !== undefined ? 'rework' : undefined
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/** the owner's tone on a question (sendNote): ok takes the agent's pick, a fix the pick with the owner's words; a rework, a wrong
|
|
778
|
+
* direction or your call goes as his answer in that tone (store.ts answerAsk `tone`) */
|
|
779
|
+
private answerTone(c: ReplyCell, status: ItemVerdict, text: string, option?: number): Promise<void> {
|
|
780
|
+
const pick = option ?? c.ask?.pick
|
|
781
|
+
if ((status === 'approved' || status === 'approved-with-fix') && pick !== undefined) return this.pickOption(c, pick, status === 'approved' ? '' : text)
|
|
782
|
+
if (status === 'approved' || status === 'approved-with-fix') {
|
|
783
|
+
this.failed = { on: c.id, why: 'the agent named no pick: click an option above' }
|
|
784
|
+
return Promise.resolve()
|
|
785
|
+
}
|
|
786
|
+
return this.save(c.id, status, () => postJson(this.rv.url(`/api/review/${c.on}/answer`), { re: c.id.slice(c.on.length + 1), tone: status, ...(text !== '' ? { text } : {}) }), false)
|
|
541
787
|
}
|
|
542
788
|
|
|
543
789
|
setNote(text: string): void {
|
|
@@ -550,8 +796,8 @@ export class ThreadSt {
|
|
|
550
796
|
}
|
|
551
797
|
|
|
552
798
|
/** the verdict already given is the one the popup holds and nothing new goes with it: a bare send changes nothing */
|
|
553
|
-
private sameAsGiven(n: { on: string; status: ItemVerdict; text: string }): boolean {
|
|
554
|
-
return n.text.trim() === '' && this.
|
|
799
|
+
private sameAsGiven(n: { on: string; status: ItemVerdict; text: string; option?: number }): boolean {
|
|
800
|
+
return n.text.trim() === '' && this.litOn(n.on, n.status, n.option) && (this.askingCell(n.on) !== undefined || !this.marked)
|
|
555
801
|
}
|
|
556
802
|
|
|
557
803
|
/** « take it back » in the popup of a version's lit face: the version waits for the owner's verdict again */
|
|
@@ -562,7 +808,8 @@ export class ThreadSt {
|
|
|
562
808
|
|
|
563
809
|
/** the verdict given on `on` (a version's id or a message's cell id), the one on its way first */
|
|
564
810
|
givenOn(on: string): ItemVerdict | undefined {
|
|
565
|
-
const
|
|
811
|
+
const q = this.questionCell(on)
|
|
812
|
+
const s = this.chosenOn(on) ?? (q !== undefined ? this.questionTone(q) : this.askingCell(on)?.judge?.verdict?.status)
|
|
566
813
|
return s !== undefined && (ITEM_VERDICTS as readonly string[]).includes(s) ? (s as ItemVerdict) : undefined
|
|
567
814
|
}
|
|
568
815
|
|
|
@@ -580,13 +827,14 @@ export class ThreadSt {
|
|
|
580
827
|
this.note = null
|
|
581
828
|
if (this.sameAsGiven(n)) return
|
|
582
829
|
const text = n.text.trim()
|
|
830
|
+
const q = this.questionCell(n.on)
|
|
583
831
|
const c = this.askingCell(n.on)
|
|
584
832
|
this.error = null
|
|
585
|
-
await (c !== undefined ? this.judge(c, n.status, text) : this.submit(n.status, text))
|
|
833
|
+
await (q !== undefined ? this.answerTone(q, n.status, text, n.option) : c !== undefined ? this.judge(c, n.status, text) : this.submit(n.status, text))
|
|
586
834
|
runInAction(() => {
|
|
587
835
|
const why = this.failed?.on === n.on ? this.failed.why : this.error
|
|
588
836
|
if (why === null || this.note !== null) return
|
|
589
|
-
this.note = { on: n.on, status: n.status, text: n.text, why }
|
|
837
|
+
this.note = { on: n.on, status: n.status, text: n.text, why, ...(n.option !== undefined ? { option: n.option } : {}) }
|
|
590
838
|
if (this.failed?.on === n.on) this.failed = null
|
|
591
839
|
this.error = null
|
|
592
840
|
})
|
|
@@ -634,13 +882,6 @@ export class ThreadSt {
|
|
|
634
882
|
if (view !== undefined && cell === this.target) this.setView(view)
|
|
635
883
|
}
|
|
636
884
|
|
|
637
|
-
/** the dock's reminder of an ask's instructions: the column scrolls to that step and lights it */
|
|
638
|
-
revealStep(cell: string, step: number): void {
|
|
639
|
-
this.openRunOf(cell)
|
|
640
|
-
this.folds = { ...this.folds, [cell]: true }
|
|
641
|
-
this.jump = stepDom(cell, step)
|
|
642
|
-
}
|
|
643
|
-
|
|
644
885
|
jumped(): void {
|
|
645
886
|
this.jump = null
|
|
646
887
|
}
|
|
@@ -668,6 +909,16 @@ export class ThreadSt {
|
|
|
668
909
|
this.panel = null
|
|
669
910
|
}
|
|
670
911
|
|
|
912
|
+
/** a cell whole in the panel, in place of what it showed */
|
|
913
|
+
openBeside(cell: string): void {
|
|
914
|
+
this.openPanel({ whole: cell })
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/** the cell the panel shows whole, marked in the thread */
|
|
918
|
+
get beside(): string | null {
|
|
919
|
+
return this.panel !== null && 'whole' in this.panel ? this.panel.whole : null
|
|
920
|
+
}
|
|
921
|
+
|
|
671
922
|
openPicture(src: string, title: string): void {
|
|
672
923
|
this.openPanel({ src, title })
|
|
673
924
|
}
|
|
@@ -686,7 +937,7 @@ export class ThreadSt {
|
|
|
686
937
|
if (v.asked !== v.head && this.cells.some((c) => c.id === v.asked)) return cellDom(v.asked)
|
|
687
938
|
const unread = this.firstFresh
|
|
688
939
|
if (unread !== null) return cellDom(unread)
|
|
689
|
-
const to = this.cells
|
|
940
|
+
const to = findLast(this.cells, (c) => c.kind !== 'event')
|
|
690
941
|
return to ? cellDom(to.id) : null
|
|
691
942
|
}
|
|
692
943
|
|
|
@@ -748,7 +999,7 @@ export class ThreadSt {
|
|
|
748
999
|
get viewMarks(): ViewMark[] {
|
|
749
1000
|
const h = this.head
|
|
750
1001
|
if (h?.kind !== 'version' || h.item.wip) return []
|
|
751
|
-
const sent = this.verdictsOn(h.id)
|
|
1002
|
+
const sent = findLast(this.verdictsOn(h.id), (v) => v.current)
|
|
752
1003
|
const choice = isChoice(h.item)
|
|
753
1004
|
// an older update's picture is history: only the newest one waits for his answer
|
|
754
1005
|
const ups = this.updateViewsOf(h.id)
|
|
@@ -760,7 +1011,7 @@ export class ThreadSt {
|
|
|
760
1011
|
const r = own ?? given
|
|
761
1012
|
const picked = this.pickShown(h) === i
|
|
762
1013
|
// a gallery is answered tile by tile: one tile scored or marked answers the view
|
|
763
|
-
const tiles = isGallery(v) && [...(this.marks.reactions ?? []), ...(sent?.reactions ?? [])].some((q) => q.view === i && q.tile !== undefined && (q.status || q.stars
|
|
1014
|
+
const tiles = isGallery(v) && [...(this.marks.reactions ?? []), ...(sent?.reactions ?? [])].some((q) => q.view === i && q.tile !== undefined && (q.status || q.stars))
|
|
764
1015
|
const answer: ViewMark['answer'] = picked ? 'picked' : r?.status ? r.status : (choice && r?.stars) || tiles ? 'scored' : sent ? 'sent' : 'none'
|
|
765
1016
|
const noted = this.marks.rects.some((q) => (q.view ?? 0) === i) || (own?.comment ?? '').trim() !== ''
|
|
766
1017
|
return { view: i, tag: viewTag(h.n, i), answer, noted }
|
|
@@ -850,14 +1101,14 @@ export class ThreadSt {
|
|
|
850
1101
|
/** the option picked on a version: his draft's pick on the newest, else the latest verdict's */
|
|
851
1102
|
pickShown(c: VersionCell): number | undefined {
|
|
852
1103
|
if (c.id === this.target && this.marks.pick !== undefined) return this.marks.pick
|
|
853
|
-
return this.verdictsOn(c.id)
|
|
1104
|
+
return findLast(this.verdictsOn(c.id), (v) => v.pick !== undefined)?.pick
|
|
854
1105
|
}
|
|
855
1106
|
|
|
856
1107
|
// ── his draft on the newest version ──
|
|
857
1108
|
|
|
858
1109
|
/** the id his draft and his answer go to */
|
|
859
1110
|
get target(): string | null {
|
|
860
|
-
return this.
|
|
1111
|
+
return this.data?.head ?? null
|
|
861
1112
|
}
|
|
862
1113
|
|
|
863
1114
|
get draft(): Draft {
|
|
@@ -905,7 +1156,6 @@ export class ThreadSt {
|
|
|
905
1156
|
const h = this.target
|
|
906
1157
|
if (!h) return
|
|
907
1158
|
this.put(h, null)
|
|
908
|
-
if (this.draftOn === h) this.draftOn = null
|
|
909
1159
|
this.rect = null
|
|
910
1160
|
this.attach.follow('')
|
|
911
1161
|
}
|
|
@@ -926,7 +1176,6 @@ export class ThreadSt {
|
|
|
926
1176
|
if (reactions.length > 0) left.reactions = reactions
|
|
927
1177
|
this.put(on, isDirty(left) ? left : null)
|
|
928
1178
|
}
|
|
929
|
-
if (this.draftOn === on) this.draftOn = null
|
|
930
1179
|
if (this.target !== on) this.rect = null
|
|
931
1180
|
}
|
|
932
1181
|
|
|
@@ -1092,9 +1341,9 @@ export class ThreadSt {
|
|
|
1092
1341
|
this.putReaction(view, tile, { comment: '' })
|
|
1093
1342
|
}
|
|
1094
1343
|
|
|
1095
|
-
private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined
|
|
1096
|
-
const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(post !== undefined ? { post } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {})
|
|
1097
|
-
const empty = !r.status && r.comment === '' && !r.stars
|
|
1344
|
+
private putReaction(view: number, tile: number | undefined, r: { status?: ReviewStatus | undefined; comment: string; stars?: number | undefined }, post?: string): void {
|
|
1345
|
+
const next: ReviewReaction = { view, ...(tile !== undefined ? { tile } : {}), ...(post !== undefined ? { post } : {}), ...(r.status ? { status: r.status } : {}), comment: r.comment, ...(r.stars ? { stars: r.stars } : {}) }
|
|
1346
|
+
const empty = !r.status && r.comment === '' && !r.stars
|
|
1098
1347
|
this.edit((d) => {
|
|
1099
1348
|
const rest = (d.reactions ?? []).filter((q) => !sameSpot(q, view, tile, post))
|
|
1100
1349
|
return { ...d, reactions: empty ? rest : [...rest, next] }
|
|
@@ -1176,23 +1425,9 @@ export class ThreadSt {
|
|
|
1176
1425
|
tileShown(r: ReviewReaction | null): boolean {
|
|
1177
1426
|
const f = this.tileFilter
|
|
1178
1427
|
if (f === 'all') return true
|
|
1179
|
-
if (f === 'unrated') return !r?.stars && !r?.status
|
|
1428
|
+
if (f === 'unrated') return !r?.stars && !r?.status
|
|
1180
1429
|
if (f === 'low') return r?.stars !== undefined && r.stars < 3
|
|
1181
|
-
return r?.status === 'approved-with-fix' || r?.status === '
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
/** a variant kept for its row: the row's other pick clears; the same tile again clears it */
|
|
1185
|
-
pickTile(view: number, tile: number, group: string, tiles: readonly { group?: string }[]): void {
|
|
1186
|
-
const was = this.reactionOf(view, tile)?.picked === true
|
|
1187
|
-
tiles.forEach((t, k) => {
|
|
1188
|
-
if (t.group !== group) return
|
|
1189
|
-
const cur = this.reactionOf(view, k)
|
|
1190
|
-
if (cur?.picked) this.putReaction(view, k, { ...cur, picked: undefined })
|
|
1191
|
-
})
|
|
1192
|
-
if (!was) {
|
|
1193
|
-
const cur = this.reactionOf(view, tile)
|
|
1194
|
-
this.putReaction(view, tile, { ...cur, comment: cur?.comment ?? '', picked: true })
|
|
1195
|
-
}
|
|
1430
|
+
return r?.status === 'approved-with-fix' || r?.status === 'rework'
|
|
1196
1431
|
}
|
|
1197
1432
|
|
|
1198
1433
|
/** a version as thin option rows: a choice, or views that each play alone, unless he asked them full */
|
|
@@ -1279,7 +1514,7 @@ export class ThreadSt {
|
|
|
1279
1514
|
|
|
1280
1515
|
/** the verdict that holds on a version now, as sent: what a click on the lit verdict takes back */
|
|
1281
1516
|
private currentVerdict(id: string): VerdictCell | undefined {
|
|
1282
|
-
return this.verdictsOn(id)
|
|
1517
|
+
return findLast(this.verdictsOn(id), (x) => x.current)
|
|
1283
1518
|
}
|
|
1284
1519
|
|
|
1285
1520
|
/** that option is the pick his answer holds: a click on it takes it back */
|
|
@@ -1340,22 +1575,26 @@ export class ThreadSt {
|
|
|
1340
1575
|
})
|
|
1341
1576
|
}
|
|
1342
1577
|
|
|
1343
|
-
/** a kind's action on item `id`
|
|
1578
|
+
/** what his click on a kind's action on item `id` (`re` the link it acts on) is doing now, if he clicked one */
|
|
1579
|
+
actOn(id: string, re?: string): ActState | undefined {
|
|
1580
|
+
return this.acting[`${id}#${re ?? ''}`]
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
/** a kind's action on item `id` with its words; `re` the link it acts on: drawn chosen at once, the store's write
|
|
1584
|
+
* behind it; a click on that object while one is on its way does nothing. True once the store took it */
|
|
1344
1585
|
async act(id: string, name: string, text: string, re?: string): Promise<boolean> {
|
|
1345
|
-
|
|
1346
|
-
this.
|
|
1347
|
-
this.
|
|
1586
|
+
const key = `${id}#${re ?? ''}`
|
|
1587
|
+
if (this.acting[key]?.state === 'sending') return false
|
|
1588
|
+
this.acting = { ...this.acting, [key]: { name, state: 'sending' } }
|
|
1348
1589
|
try {
|
|
1349
1590
|
await postJson(this.rv.url(`/api/review/${id}/action`), { name, ...(text !== '' ? { text } : {}), ...(re ? { re } : {}) })
|
|
1350
|
-
runInAction(() => (this.
|
|
1591
|
+
runInAction(() => (this.acting = { ...this.acting, [key]: { name, state: 'sent' } }))
|
|
1351
1592
|
await this.refresh()
|
|
1352
1593
|
await this.answeredHere()
|
|
1353
1594
|
return true
|
|
1354
1595
|
} catch (e) {
|
|
1355
|
-
runInAction(() => (this.
|
|
1596
|
+
runInAction(() => (this.acting = { ...this.acting, [key]: { name, state: 'failed', why: (e as Error).message } }))
|
|
1356
1597
|
return false
|
|
1357
|
-
} finally {
|
|
1358
|
-
runInAction(() => (this.busy = false))
|
|
1359
1598
|
}
|
|
1360
1599
|
}
|
|
1361
1600
|
|
|
@@ -1410,7 +1649,7 @@ export class ThreadSt {
|
|
|
1410
1649
|
const h = this.target
|
|
1411
1650
|
const sent = this.draft.comment
|
|
1412
1651
|
const { text, files } = this.attach.outgoing(sent.trim())
|
|
1413
|
-
if (!h || (!text && files.length === 0)
|
|
1652
|
+
if (!h || (!text && files.length === 0)) return
|
|
1414
1653
|
if (this.attach.waits !== null) {
|
|
1415
1654
|
this.error = this.attach.waits
|
|
1416
1655
|
return
|
|
@@ -1419,24 +1658,60 @@ export class ThreadSt {
|
|
|
1419
1658
|
this.error = this.mentions.refused
|
|
1420
1659
|
return
|
|
1421
1660
|
}
|
|
1422
|
-
this.
|
|
1661
|
+
this.error = null
|
|
1662
|
+
// drawn in the thread at once and gone from the box: nothing is left to send twice, and his next word waits on nothing
|
|
1663
|
+
const sending = this.outbox.send(h, text, files)
|
|
1664
|
+
this.attach.clear(files)
|
|
1665
|
+
const now = this.drafts[h] ?? EMPTY
|
|
1666
|
+
this.put(h, isDirty({ ...now, comment: '' }) ? { ...now, comment: '' } : null)
|
|
1667
|
+
await sending
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** the message whose « delete » asks its one line confirm, by cell id */
|
|
1671
|
+
deleteAsk: string | null = null
|
|
1672
|
+
/** his messages deleted and not yet gone from the store's answer: hidden at once */
|
|
1673
|
+
deleting: Record<string, true> = {}
|
|
1674
|
+
|
|
1675
|
+
/** his own plain words, which he may delete (store.ts deleteOwnMessage judges): never an agent's, never a verdict or an answer */
|
|
1676
|
+
deletable(c: Framed): boolean {
|
|
1677
|
+
return this.can('delete') && c.kind === 'reply' && c.who === 'owner' && c.party === 'owner' && c.advisor === undefined && c.op === undefined && c.answers === undefined && c.action === undefined && c.edit === undefined && c.ask === undefined && c.propose === undefined && !c.id.includes('/out-')
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
askDelete(cell: string | null): void {
|
|
1681
|
+
this.deleteAsk = cell
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/** his own message out of the thread: gone from the view at once, the store's delete behind; a refusal brings it back with why */
|
|
1685
|
+
async deleteMessage(c: { id: string; on: string }): Promise<void> {
|
|
1686
|
+
this.deleteAsk = null
|
|
1687
|
+
this.deleting = { ...this.deleting, [c.id]: true }
|
|
1423
1688
|
this.error = null
|
|
1424
1689
|
try {
|
|
1425
|
-
await postJson(this.rv.url(`/api/review/${
|
|
1426
|
-
// only the word sent leaves: a word typed while it was on its way stays
|
|
1427
|
-
runInAction(() => {
|
|
1428
|
-
this.attach.clear(files)
|
|
1429
|
-
const now = this.drafts[h]
|
|
1430
|
-
if (now && now.comment === sent) this.put(h, isDirty({ ...now, comment: '' }) ? { ...now, comment: '' } : null)
|
|
1431
|
-
})
|
|
1690
|
+
await postJson(this.rv.url(`/api/review/${c.on}/delete-message`), { re: c.id.slice(c.on.length + 1) })
|
|
1432
1691
|
await this.answeredHere()
|
|
1433
1692
|
} catch (e) {
|
|
1434
|
-
runInAction(() =>
|
|
1435
|
-
|
|
1436
|
-
|
|
1693
|
+
runInAction(() => {
|
|
1694
|
+
const { [c.id]: _, ...rest } = this.deleting
|
|
1695
|
+
this.deleting = rest
|
|
1696
|
+
this.error = `not deleted: ${(e as Error).message}`
|
|
1697
|
+
})
|
|
1437
1698
|
}
|
|
1438
1699
|
}
|
|
1439
1700
|
|
|
1701
|
+
/** « retry » on the owner's words the store did not take */
|
|
1702
|
+
retrySend(cid: string): Promise<void> {
|
|
1703
|
+
return this.outbox.retry(cid)
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/** « edit » on the owner's words the store did not take: back in the box, after what was typed since */
|
|
1707
|
+
editSend(cid: string): void {
|
|
1708
|
+
const words = this.outbox.takeBack(cid)
|
|
1709
|
+
if (words === null) return
|
|
1710
|
+
const typed = this.draft.comment.trim()
|
|
1711
|
+
this.setComment(typed === '' ? words : `${typed}\n${words}`)
|
|
1712
|
+
this.replyAsk++
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1440
1715
|
/** the reply box's words to what its chip names: a fix on a spot or the version, a message's fix, a kind's action */
|
|
1441
1716
|
private async sendOn(on: ReplyOn): Promise<void> {
|
|
1442
1717
|
if (on.to === 'spot' || on.to === 'version') return this.sendFix(on)
|
|
@@ -1478,8 +1753,65 @@ export class ThreadSt {
|
|
|
1478
1753
|
* field's box, `<cell>#<key>`): the owner's answer goes to the item it sits on, naming it, the owner's words the cell's box, and wakes
|
|
1479
1754
|
* the agent that holds the thread */
|
|
1480
1755
|
async answer(c: { id: string; on: string }, a: { option?: number; apply?: true; field?: string; tick?: boolean; value?: string }): Promise<void> {
|
|
1481
|
-
if (
|
|
1482
|
-
|
|
1756
|
+
if (a.option !== undefined && a.apply === undefined && a.field === undefined && a.tick === undefined && a.value === undefined) return this.pickOption(c, a.option)
|
|
1757
|
+
// never dropped: it waits for the act before it
|
|
1758
|
+
this.acts = this.acts.then(() => this.answering(c, [a]))
|
|
1759
|
+
return this.acts
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
/** the acts of the page on questions, one after the other in the order he clicked */
|
|
1763
|
+
private acts: Promise<void> = Promise.resolve()
|
|
1764
|
+
/** a click on a question's option, by cell: drawn on its question at once (« sending… »), then « sent » or why not with
|
|
1765
|
+
* « retry »; the next read of the thread draws the answer itself */
|
|
1766
|
+
picking: Record<string, { option: number; state: 'sending' | 'sent' | 'failed'; why?: string; remark?: string }> = {}
|
|
1767
|
+
/** the option whose « pick with a remark » box is open, by question cell: one box a question at a time */
|
|
1768
|
+
remarking: Record<string, number> = {}
|
|
1769
|
+
|
|
1770
|
+
setRemarking(cell: string, option: number | null): void {
|
|
1771
|
+
const { [cell]: _, ...rest } = this.remarking
|
|
1772
|
+
this.remarking = option === null ? rest : { ...rest, [cell]: option }
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
/** the key of the box that holds his remark with a pick, apart from the « none of these » words (`hints[c.id]`) */
|
|
1776
|
+
remarkBox = (c: { id: string }): string => `${c.id}#remark`
|
|
1777
|
+
/** the questions he chose to answer again (« change it » on an answer a person's pick gave), by cell */
|
|
1778
|
+
changing: Record<string, true> = {}
|
|
1779
|
+
|
|
1780
|
+
setChanging(cell: string, on: boolean): void {
|
|
1781
|
+
const { [cell]: _, ...rest } = this.changing
|
|
1782
|
+
this.changing = on ? { ...rest, [cell]: true } : rest
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/** one click on an option, `remark` the owner's words with it (« pick with a remark »; none for a plain pick): shown taken at
|
|
1786
|
+
* once, queued behind any act still on its way, never silently dropped */
|
|
1787
|
+
pickOption(c: { id: string; on: string }, option: number, remark = ''): Promise<void> {
|
|
1788
|
+
const sent = remark.trim()
|
|
1789
|
+
const re = c.id.slice(c.on.length + 1)
|
|
1790
|
+
const words = sent !== '' ? { remark: sent } : {}
|
|
1791
|
+
this.picking = { ...this.picking, [c.id]: { option, state: 'sending', ...words } }
|
|
1792
|
+
this.error = null
|
|
1793
|
+
const run = async (): Promise<void> => {
|
|
1794
|
+
try {
|
|
1795
|
+
const r = await postJson<{ moved?: { repo: string; head: string } }>(this.rv.url(`/api/review/${c.on}/answer`), { re, option, ...(sent !== '' ? { text: sent } : {}) })
|
|
1796
|
+
// his « move to <repo> » moved the thread: it opens there
|
|
1797
|
+
if (r.moved !== undefined && this.followMove(r.moved)) return
|
|
1798
|
+
runInAction(() => {
|
|
1799
|
+
if (this.picking[c.id]?.option === option) this.picking = { ...this.picking, [c.id]: { option, state: 'sent', ...words } }
|
|
1800
|
+
this.setChanging(c.id, false)
|
|
1801
|
+
if (sent !== '') {
|
|
1802
|
+
if (this.remarking[c.id] === option) this.setRemarking(c.id, null)
|
|
1803
|
+
if ((this.hints[this.remarkBox(c)] ?? '').trim() === sent) delete this.hints[this.remarkBox(c)]
|
|
1804
|
+
}
|
|
1805
|
+
})
|
|
1806
|
+
await this.answeredHere()
|
|
1807
|
+
} catch (e) {
|
|
1808
|
+
runInAction(() => {
|
|
1809
|
+
if (this.picking[c.id]?.option === option) this.picking = { ...this.picking, [c.id]: { option, state: 'failed', why: (e as Error).message, ...words } }
|
|
1810
|
+
})
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
this.acts = this.acts.then(run)
|
|
1814
|
+
return this.acts
|
|
1483
1815
|
}
|
|
1484
1816
|
|
|
1485
1817
|
/** « apply all »: one answer a field not applied yet, each with its value as he left it */
|
|
@@ -1496,6 +1828,36 @@ export class ThreadSt {
|
|
|
1496
1828
|
/** the key of the box that holds the owner's edit of one field's value */
|
|
1497
1829
|
fieldBox = (c: { id: string }, key: string): string => `${c.id}#${key}`
|
|
1498
1830
|
|
|
1831
|
+
/** a text or a url he gave, by cell: drawn given at his click while the store writes it (a url after the hub tried
|
|
1832
|
+
* it, up to 4 s), or his value back in its field with why it was not sent */
|
|
1833
|
+
giving: Record<string, { value: string; state: 'sending' | 'failed'; why?: string }> = {}
|
|
1834
|
+
|
|
1835
|
+
/** his « send » on a text or a url question: given at once, queued behind any act on its way, never dropped */
|
|
1836
|
+
give(c: { id: string; on: string }, value: string): Promise<void> {
|
|
1837
|
+
const sent = value.trim()
|
|
1838
|
+
if (sent === '') return this.acts
|
|
1839
|
+
this.giving = { ...this.giving, [c.id]: { value: sent, state: 'sending' } }
|
|
1840
|
+
this.error = null
|
|
1841
|
+
const box = this.fieldBox(c, 'value')
|
|
1842
|
+
const run = async (): Promise<void> => {
|
|
1843
|
+
try {
|
|
1844
|
+
await postJson(this.rv.url(`/api/review/${c.on}/answer`), { re: c.id.slice(c.on.length + 1), value: sent })
|
|
1845
|
+
runInAction(() => {
|
|
1846
|
+
if ((this.hints[box] ?? '').trim() === sent) delete this.hints[box]
|
|
1847
|
+
})
|
|
1848
|
+
await this.answeredHere()
|
|
1849
|
+
runInAction(() => {
|
|
1850
|
+
const { [c.id]: _, ...rest } = this.giving
|
|
1851
|
+
this.giving = rest
|
|
1852
|
+
})
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
runInAction(() => (this.giving = { ...this.giving, [c.id]: { value: sent, state: 'failed', why: (e as Error).message } }))
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
this.acts = this.acts.then(run)
|
|
1858
|
+
return this.acts
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1499
1861
|
private async answering(c: { id: string; on: string }, all: readonly { option?: number; apply?: true; field?: string; tick?: boolean; value?: string }[]): Promise<void> {
|
|
1500
1862
|
const sent = this.hints[c.id] ?? ''
|
|
1501
1863
|
const re = c.id.slice(c.on.length + 1)
|
|
@@ -1529,6 +1891,29 @@ export class ThreadSt {
|
|
|
1529
1891
|
}
|
|
1530
1892
|
}
|
|
1531
1893
|
|
|
1894
|
+
/** the head's tag field opened on `typed`, or shut with null; opened, the repo's known tags are read again */
|
|
1895
|
+
typeTag(typed: string | null): void {
|
|
1896
|
+
if (this.tagTyping === null && typed !== null) void this.rv.readCodes()
|
|
1897
|
+
this.tagTyping = typed
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/** his tags on the thread from its head (review/thread-query.ts): added, taken away; the known ones read again */
|
|
1901
|
+
async setTags(add: readonly string[], remove: readonly string[] = []): Promise<void> {
|
|
1902
|
+
const h = this.data?.head
|
|
1903
|
+
if (!h || this.busy) return
|
|
1904
|
+
this.busy = true
|
|
1905
|
+
this.error = null
|
|
1906
|
+
try {
|
|
1907
|
+
await postJson(this.rv.url(`/api/review/${encodeURIComponent(h)}/tags`), { add, remove })
|
|
1908
|
+
await this.answeredHere()
|
|
1909
|
+
void this.rv.readCodes()
|
|
1910
|
+
} catch (e) {
|
|
1911
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
1912
|
+
} finally {
|
|
1913
|
+
runInAction(() => (this.busy = false))
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1532
1917
|
/** his bell: no push to his phone from this thread (on), or pushes again */
|
|
1533
1918
|
async setMuted(on: boolean): Promise<void> {
|
|
1534
1919
|
const h = this.data?.head
|