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
package/src/review/model.ts
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
// (verdicts, replies, ratings, state changes, read marks). The state is derived from the thread, never stored, so the
|
|
4
4
|
// hub and every CLI write at once with no lost update. Pure and browser safe: the store, the routes and the hub page
|
|
5
5
|
// share it. The on disk shape is the one a project's own review store writes, verbatim, so either store opens in the other.
|
|
6
|
+
import { TAG_RE } from './thread-query.ts'
|
|
6
7
|
import type { MediaFact } from '../media-store/fact.ts'
|
|
7
8
|
import type { KindColor } from './glyphs.ts'
|
|
8
9
|
import type { HoldsOpen } from './holds.ts'
|
|
9
10
|
import type { StepChoice } from './instructions.ts'
|
|
10
11
|
import { versionOf } from '../trailer/versions.ts'
|
|
11
12
|
import { SECRET_NAME } from '../secrets/name.ts'
|
|
13
|
+
import { findLastIndex } from '../core/es2022.ts'
|
|
12
14
|
import type { ViewLive } from './live-view.ts'
|
|
13
15
|
|
|
14
16
|
/** WHAT is judged: `shot` (a plain image or clip), `screen`, `frame` (a frame of a trailer cut), or a kind a repo names
|
|
@@ -71,6 +73,10 @@ export interface KindAction {
|
|
|
71
73
|
what?: string
|
|
72
74
|
/** the click opens a word box: the owner's words ride with the action */
|
|
73
75
|
words?: boolean
|
|
76
|
+
/** with `words`: the box starts with the text of the object's line that begins `<fill>:`, for him to edit */
|
|
77
|
+
fill?: string
|
|
78
|
+
/** a no (refuse, discard): once he chose it, it draws picked in red, a yes in green */
|
|
79
|
+
no?: true
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
/** an act of the owner on a version of a kind that answers its versions with its own acts (a draft: publish, drop,
|
|
@@ -114,10 +120,15 @@ export interface SpecKind {
|
|
|
114
120
|
questions?: Record<string, KindQuestion>
|
|
115
121
|
/** the buttons on an object of this kind, by name */
|
|
116
122
|
actions?: Record<string, KindAction>
|
|
123
|
+
/** its card where a message links it shows its words whole, not their one line: what the owner judges is in them */
|
|
124
|
+
whole?: true
|
|
117
125
|
/** its versions answered by these acts, by name, never by approve, fix, reject (review/settle.ts); none: the verdict */
|
|
118
126
|
acts?: Record<string, KindAct>
|
|
119
127
|
/** an object of this kind attached to a thread holds it open until its condition is met (review/holds.ts) */
|
|
120
128
|
holdsOpen?: HoldsOpen
|
|
129
|
+
/** its objects are surfaces that run (a screen, a hub page): a version of one is best with its page (`--live <url>`),
|
|
130
|
+
* and a post without one ends with a hint (review/live-post.ts liveHint); unset, the house kind's of the same word */
|
|
131
|
+
runs?: boolean
|
|
121
132
|
}
|
|
122
133
|
|
|
123
134
|
/** an area raised items are routed to, and the pages its worker reads first */
|
|
@@ -131,8 +142,6 @@ export interface SpecTopic {
|
|
|
131
142
|
export interface Spec {
|
|
132
143
|
kinds: Record<string, SpecKind>
|
|
133
144
|
topics: Record<string, SpecTopic>
|
|
134
|
-
/** one session holds the dispatcher role and routes what is raised */
|
|
135
|
-
dispatcher: boolean
|
|
136
145
|
}
|
|
137
146
|
|
|
138
147
|
/** the kinds every repo has, whatever its unit declares */
|
|
@@ -142,7 +151,7 @@ import { HOUSE_KINDS as BUILTIN_KINDS } from './kinds.ts'
|
|
|
142
151
|
import { settlingOf } from './settle.ts'
|
|
143
152
|
import { IN_BACKGROUND, WATCH } from './inbox-hook.ts'
|
|
144
153
|
|
|
145
|
-
export const NO_SPEC: Spec = { kinds: {}, topics: {}
|
|
154
|
+
export const NO_SPEC: Spec = { kinds: {}, topics: {} }
|
|
146
155
|
|
|
147
156
|
/** the words the list's subject filter shows; a kind no unit names shows its own name */
|
|
148
157
|
export const subjectLabel = (kind: string, spec: Spec = NO_SPEC): string => (spec.kinds[kind] ?? BUILTIN_KINDS[kind])?.label ?? kind
|
|
@@ -167,7 +176,7 @@ const canonical = new Map<string, string | null>()
|
|
|
167
176
|
|
|
168
177
|
/** an address in its one form, null when it is none (wiki tools/shipkit/threads-store.md, Addresses): trimmed and
|
|
169
178
|
* lowercased, no space around the colon, no empty or trailing `/`; a cut's file is its cut, a bare kept version the main
|
|
170
|
-
* cut (`trailer:x/v15`)
|
|
179
|
+
* cut (`trailer:x/v15`). Every address written, read or compared goes through it */
|
|
171
180
|
export function canonicalAddress(raw: string): string | null {
|
|
172
181
|
const held = canonical.get(raw)
|
|
173
182
|
if (held !== undefined) return held
|
|
@@ -187,9 +196,6 @@ export function canonicalAddress(raw: string): string | null {
|
|
|
187
196
|
// an ask is named by its file: `ask:<id>.md` and `ask:<id>` are one thread
|
|
188
197
|
if (kind === 'ask') key = key.replace(/\.md$/, '')
|
|
189
198
|
let out: string | null = `${kind}:${key}`
|
|
190
|
-
if (out === 'page:review' || out.startsWith('page:review/')) out = `page:threads${out.slice('page:review'.length)}`
|
|
191
|
-
// a conversation in words is one kind: a thread an advisor's proposal opened was `topic:<slug>`
|
|
192
|
-
if (out.startsWith('topic:')) out = `talk:${out.slice('topic:'.length)}`
|
|
193
199
|
if (!/^[a-z][a-z0-9-]*$/.test(kind) || key === '' || /\s/.test(key) || !ADDRESS_RE.test(out)) out = null
|
|
194
200
|
canonical.set(raw, out)
|
|
195
201
|
return out
|
|
@@ -434,8 +440,13 @@ export interface Item {
|
|
|
434
440
|
ask?: AskHead
|
|
435
441
|
/** it waits for the owner's verdict: set by `--verdict`; an agent's version asks it always, an opening of words only with it */
|
|
436
442
|
asksVerdict?: true
|
|
443
|
+
/** its title renames the thread (`--rename`): else the title is the version's own caption, and the thread keeps its
|
|
444
|
+
* name (review/threads.ts threadName) */
|
|
445
|
+
rename?: true
|
|
437
446
|
/** a version whose subject is a document (`--md`, `--html`): its text whole, drawn by the hub */
|
|
438
447
|
doc?: ItemDoc
|
|
448
|
+
/** the thread's tags, on its oldest item (review/thread-query.ts): a thread's tags are those of all its items */
|
|
449
|
+
tags?: string[]
|
|
439
450
|
}
|
|
440
451
|
|
|
441
452
|
/** a document a version shows (wiki tools/shipkit/threads.md, Every kind of version): markdown through the hub's one
|
|
@@ -614,6 +625,15 @@ export interface ThreadWhere {
|
|
|
614
625
|
phone?: string | null
|
|
615
626
|
}
|
|
616
627
|
|
|
628
|
+
/** the page a paste links to, from where the hub is open: its keys kept but the window's shell (`?shell=project`), which
|
|
629
|
+
* shapes this window and never the reader's */
|
|
630
|
+
export function pasteBase(origin: string, pathname: string, search: string): string {
|
|
631
|
+
const keys = new URLSearchParams(search)
|
|
632
|
+
keys.delete('shell')
|
|
633
|
+
const rest = keys.toString()
|
|
634
|
+
return `${origin}${pathname}${rest ? `?${rest}` : ''}`
|
|
635
|
+
}
|
|
636
|
+
|
|
617
637
|
/** one paste that hands a thread to any agent session: what it is, where, the command that shows it whole, its links */
|
|
618
638
|
export function pasteBlock(i: Item, state: string, w: ThreadWhere): string {
|
|
619
639
|
return [
|
|
@@ -646,17 +666,6 @@ export const viewTag = (n: number, i: number): string => `${n}.${viewNo(i)}`
|
|
|
646
666
|
/** a view's name as the page and the CLI show it: its label, or « view 2 » */
|
|
647
667
|
export const viewName = (v: ReviewView | undefined, i: number): string => v?.label || `view ${viewNo(i)}`
|
|
648
668
|
|
|
649
|
-
/** a view named by its label, else by its number (`2`), else by the letter it had before (`B`); throws naming every view
|
|
650
|
-
* when none matches */
|
|
651
|
-
export function viewIndexOf(views: readonly { label: string }[], ref: string): number {
|
|
652
|
-
const r = ref.trim()
|
|
653
|
-
const byLabel = views.findIndex((v) => v.label === r)
|
|
654
|
-
if (r !== '' && byLabel >= 0) return byLabel
|
|
655
|
-
const n = viewRef(r)
|
|
656
|
-
if (n >= 0 && n < views.length) return n
|
|
657
|
-
throw new Error(`« ${ref} » names no view: ${views.map((v, i) => `${viewNo(i)}${v.label ? ` "${v.label}"` : ''}`).join(', ')}`)
|
|
658
|
-
}
|
|
659
|
-
|
|
660
669
|
/** every media file an item's views name: images, pairs, clips and their posters, sounds and their waveforms, tiles */
|
|
661
670
|
export function viewFilesOf(i: Item): string[] {
|
|
662
671
|
return i.views.flatMap((v) => {
|
|
@@ -703,13 +712,58 @@ export interface Rect {
|
|
|
703
712
|
nodes?: string[]
|
|
704
713
|
}
|
|
705
714
|
|
|
706
|
-
/**
|
|
707
|
-
*
|
|
708
|
-
|
|
715
|
+
/** the owner's five tones, or no answer (wiki tools/shipkit/threads.md, The five tones): ok, ok with a fix, rework (redo
|
|
716
|
+
* it, same direction), wrong direction (stop, rethink, ask before building), your call (the agent decides if it still
|
|
717
|
+
* holds), no answer (that request leaves his turn, nothing else changes, no agent wakes). `approved-with-fix` counts as
|
|
718
|
+
* approved: its comment and rectangles are a small follow up; `archived` is set aside with no verdict, so it asks
|
|
719
|
+
* nothing of the agent */
|
|
720
|
+
export const STATUSES = ['approved', 'approved-with-fix', 'rework', 'wrong-direction', 'your-call', 'no-answer', 'archived'] as const
|
|
709
721
|
export type ReviewStatus = (typeof STATUSES)[number]
|
|
710
722
|
|
|
723
|
+
/** a status an older store wrote, read as the tone it meant and never written again: « rejected » asked a new version
|
|
724
|
+
* in the same thread, which is a rework */
|
|
725
|
+
const LEGACY_STATUS: Readonly<Record<string, ReviewStatus>> = { rejected: 'rework' }
|
|
726
|
+
|
|
727
|
+
/** a stored status as this code reads it: an old word as its tone, any other value as it is */
|
|
728
|
+
export const statusRead = (s: unknown): unknown => (typeof s === 'string' ? (LEGACY_STATUS[s] ?? s) : s)
|
|
729
|
+
|
|
730
|
+
/** a message read from the store with its old status words as their tones: its verdict and its reactions' */
|
|
731
|
+
export function upgradeMessage(m: Message): Message {
|
|
732
|
+
const v = m.verdict === undefined ? undefined : (statusRead(m.verdict) as ReviewStatus)
|
|
733
|
+
const old = (r: ReviewReaction): boolean => r.status !== undefined && statusRead(r.status) !== r.status
|
|
734
|
+
if (v === m.verdict && !(m.reactions ?? []).some(old)) return m
|
|
735
|
+
return {
|
|
736
|
+
...m,
|
|
737
|
+
...(v !== undefined ? { verdict: v } : {}),
|
|
738
|
+
...(m.reactions ? { reactions: m.reactions.map((r) => (old(r) ? { ...r, status: statusRead(r.status) as ReviewStatus } : r)) } : {}),
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
711
742
|
export const isApproved = (s: ReviewStatus): boolean => s === 'approved' || s === 'approved-with-fix'
|
|
712
743
|
|
|
744
|
+
/** the tones that give the version back to its agent with work owed: every one but ok and archived */
|
|
745
|
+
export const OWES_WORK: ReadonlySet<ReviewStatus> = new Set(['approved-with-fix', 'rework', 'wrong-direction', 'your-call'])
|
|
746
|
+
|
|
747
|
+
/** the tones a choice question takes besides a pick and a pick with a remark: none of its options right, said as a
|
|
748
|
+
* rework (other options, the same direction) or a wrong direction; « your call » takes the agent's pick if it still holds;
|
|
749
|
+
* « no answer » leaves it unanswered */
|
|
750
|
+
export const QUESTION_TONES = ['rework', 'wrong-direction', 'your-call', 'no-answer'] as const satisfies readonly ReviewStatus[]
|
|
751
|
+
export type QuestionTone = (typeof QUESTION_TONES)[number]
|
|
752
|
+
|
|
753
|
+
/** what a tone that owes work asks of the agent, as its watch and the inbox say it: ` (<ask>)`, '' for ok or archived */
|
|
754
|
+
export const toneAskTail = (s: ReviewStatus, id: string): string => (OWES_WORK.has(s) ? ` (${TONE_ASKS[s].replace('<id>', id)})` : '')
|
|
755
|
+
|
|
756
|
+
/** what each tone asks of the agent, as its watch and the inbox say it */
|
|
757
|
+
export const TONE_ASKS: Record<ReviewStatus, string> = {
|
|
758
|
+
approved: 'nothing owed: he is ok with it',
|
|
759
|
+
'approved-with-fix': 'fix what the owner says and keep the rest, then sk thread fixed',
|
|
760
|
+
rework: 'redo it in the same direction, then post the next version',
|
|
761
|
+
'wrong-direction': 'stop: the direction is wrong; rethink it and, unless the owner named the new one, ask (sk thread ask) before you build again',
|
|
762
|
+
'your-call': 'decide yourself: if the ask still holds, do what you judge best, else drop it; then say what you chose (sk thread fixed <id> "<what you chose>")',
|
|
763
|
+
'no-answer': 'nothing owed: he left it unanswered',
|
|
764
|
+
archived: 'nothing owed: set aside',
|
|
765
|
+
}
|
|
766
|
+
|
|
713
767
|
/** the owner's reaction to one view, to one tile of a gallery view, or to one message of a draft version; one per view,
|
|
714
768
|
* tile or message */
|
|
715
769
|
export interface ReviewReaction {
|
|
@@ -721,8 +775,6 @@ export interface ReviewReaction {
|
|
|
721
775
|
comment: string
|
|
722
776
|
/** his score of the view, 1 to STARS */
|
|
723
777
|
stars?: number
|
|
724
|
-
/** a variant tile he keeps for its row: at most one a row */
|
|
725
|
-
picked?: true
|
|
726
778
|
}
|
|
727
779
|
|
|
728
780
|
/** a state change, a read mark (`seen`, with the ids it read in `of`), a take (`take`: an agent holds the thread
|
|
@@ -734,6 +786,11 @@ export const handedOver = (m: Pick<Message, 'op' | 'from'>): boolean => m.op ===
|
|
|
734
786
|
|
|
735
787
|
export const OPS = ['dispatch', 'ask', 'answer', 'reassign', 'claim', 'release', 'blocked', 'fixed', 'done', 'wontfix', 'drop', 'withdraw', 'reopen', 'ready', 'seen', 'take', 'working'] as const
|
|
736
788
|
export type Op = (typeof OPS)[number]
|
|
789
|
+
/** the ops old threads hold and nothing writes now (the dispatcher's routing, its question and his answer to it, a
|
|
790
|
+
* worker's block): read as history by stateOf, never an act */
|
|
791
|
+
export type HistoryOp = 'dispatch' | 'ask' | 'answer' | 'reassign' | 'blocked' | 'drop'
|
|
792
|
+
/** the ops an act writes */
|
|
793
|
+
export type ActOp = Exclude<Op, HistoryOp>
|
|
737
794
|
|
|
738
795
|
/** what an agent's update says of the work, at a glance: still broken, better, or fixed (it asks the owner's verdict again) */
|
|
739
796
|
export const UPDATE_STATES = ['broken', 'better', 'fixed'] as const
|
|
@@ -762,6 +819,8 @@ export interface Message {
|
|
|
762
819
|
at: string
|
|
763
820
|
/** `owner`, `player`, or an agent: its lane name, `agent` when unnamed */
|
|
764
821
|
who: string
|
|
822
|
+
/** with `who: player`: a person outside who sent it straight to the thread, their rights direct (advisors/rights.ts) */
|
|
823
|
+
advisor?: { id: string; name: string }
|
|
765
824
|
text?: string
|
|
766
825
|
/** a file of the folder's `thread/` beside it */
|
|
767
826
|
image?: string
|
|
@@ -777,7 +836,7 @@ export interface Message {
|
|
|
777
836
|
op?: Op
|
|
778
837
|
/** the op's reason or answer */
|
|
779
838
|
note?: string
|
|
780
|
-
/** `dispatch
|
|
839
|
+
/** `dispatch`, in an old thread: where it went */
|
|
781
840
|
topic?: string
|
|
782
841
|
/** `seen`: the messages it read */
|
|
783
842
|
of?: string[]
|
|
@@ -816,14 +875,22 @@ export interface Message {
|
|
|
816
875
|
/** the owner's own save of the thread's object from the hub's editor (review/doc-save.ts saveDoc): `of` the version it
|
|
817
876
|
* made (an item, or an ask's instructions message), or the version waiting on the owner's verdict that the save went over;
|
|
818
877
|
* its line of what changed in `text`, its changed lines in `diff` (`- ` gone, `+ ` new). His act, never the agent's:
|
|
819
|
-
* it wakes the thread's holder (
|
|
878
|
+
* it wakes the thread's holder (thread-events.ts `edit`). His saves of one burst are one wake (doc-save.ts ownerEdit): `base`
|
|
820
879
|
* the text before a burst's first save; a later save of it lands beside that first edit, its diff from `base`, and
|
|
821
|
-
* `folds` names the edit it takes the place of, a trace from then on (
|
|
880
|
+
* `folds` names the edit it takes the place of, a trace from then on (thread-events.ts `edit-folded`) */
|
|
822
881
|
edit?: { of: string; diff: string[]; base?: string; folds?: string }
|
|
823
882
|
/** a thread set aside until `until` (an ISO time), his from the hub or an agent's when it posts; null brings it back */
|
|
824
883
|
snooze?: { until: string | null }
|
|
825
884
|
/** an agent's message that brings back a thread set aside (wiki tools/shipkit/threads-asks.md, Snooze) */
|
|
826
885
|
urgent?: true
|
|
886
|
+
/** the thread renamed on purpose (`sk thread rename`, his edit of the head's title): its name before and after */
|
|
887
|
+
rename?: { from: string; to: string }
|
|
888
|
+
/** the thread moved whole from one repo's store to another's (review/move.ts), by the owner: the repo names, the
|
|
889
|
+
* trace line on both sides; the acts before it hold nothing, so the repo it came to hears it */
|
|
890
|
+
moved?: { from: string; to: string }
|
|
891
|
+
/** an agent's `done` that closes the thread it finished (`sk thread close`, review/close.ts agentClose): `thread` on
|
|
892
|
+
* its head, the trace line; `version` on a version that waited on the owner's verdict, which then needs none */
|
|
893
|
+
closes?: 'thread' | 'version'
|
|
827
894
|
/** his answer to the question or the proposal `re` names: the option he clicked, or « apply » (an edit his `text`) */
|
|
828
895
|
answer?: MessageAnswer
|
|
829
896
|
/** the agent's object of the same thread (a question, a change, its words) this newer one supersedes, by its message
|
|
@@ -838,6 +905,11 @@ export interface Message {
|
|
|
838
905
|
/** an agent's message that waits for the owner's verdict; the owner's answer is the owner's message with `verdict` and `re` naming it
|
|
839
906
|
* (review/verdict-items.ts) */
|
|
840
907
|
asksVerdict?: true
|
|
908
|
+
/** an agent's recap of the thread (review/recap.ts): its four sections in `text`, asking the owner's verdict; once he
|
|
909
|
+
* accepts it, readers start at it */
|
|
910
|
+
recap?: true
|
|
911
|
+
/** the owner asks the thread's holder for a recap (the hub's « recap »): the owner's words in `text`, a word that asks work */
|
|
912
|
+
recapAsk?: true
|
|
841
913
|
/** the machine's: an attached object's hold flipped (review/holds.ts), its words in `text` */
|
|
842
914
|
hold?: { address: string; held: boolean; sha?: string; ahead?: number }
|
|
843
915
|
/** the owner's close of a held thread: the holds it releases, by address */
|
|
@@ -849,8 +921,19 @@ export interface Message {
|
|
|
849
921
|
to?: Mention[]
|
|
850
922
|
/** his bell on the thread: true, no push to his phone from it; false, pushes again (review/phone-push.ts) */
|
|
851
923
|
mute?: boolean
|
|
924
|
+
/** an agent's words past the wall bound on purpose (review/reply-guards.ts): why, drawn as a quiet mark under them */
|
|
925
|
+
long?: string
|
|
926
|
+
/** on a `working`: the agent promises the thread's next version by `until` (an ISO time); the version before it asks
|
|
927
|
+
* no verdict while the promise stands, and a promise past its time reads late (review/thread-state.ts ThreadState next) */
|
|
928
|
+
next?: { until: string }
|
|
929
|
+
/** the send's own id, made by the page that sent it: a send again with the same id is that message, never a second
|
|
930
|
+
* one (store.ts addMessage) */
|
|
931
|
+
cid?: string
|
|
852
932
|
}
|
|
853
933
|
|
|
934
|
+
/** a send's own id: what a page makes (crypto.randomUUID) and the store keeps */
|
|
935
|
+
export const CID_RE = /^[\w-]{8,64}$/
|
|
936
|
+
|
|
854
937
|
/** a party the owner's words name: a lane (and its session), a session alone (the orchestrator), or an advisor by id */
|
|
855
938
|
export interface Mention {
|
|
856
939
|
name: string
|
|
@@ -885,8 +968,23 @@ export interface MessageAsk {
|
|
|
885
968
|
choices?: (StepChoice | null)[]
|
|
886
969
|
/** a secret's name in the house secret manager; `login`: an account goes with it */
|
|
887
970
|
secret?: { name: string; login?: true }
|
|
971
|
+
/** a choice that is one row of a question with a row per thing (`sk thread ask --row`): the rows share `group` and
|
|
972
|
+
* draw as one question, row `i` of `n` names its thing in `label`; each row is answered alone */
|
|
973
|
+
row?: AskRow
|
|
974
|
+
/** a question that suggests moving the thread to the repo `to` (`sk thread suggest-move`): his click on option 0
|
|
975
|
+
* moves it there (review/move.ts moveOnAnswer), option 1 keeps it */
|
|
976
|
+
move?: { to: string }
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
export interface AskRow {
|
|
980
|
+
group: string
|
|
981
|
+
i: number
|
|
982
|
+
n: number
|
|
983
|
+
label: string
|
|
888
984
|
}
|
|
889
985
|
|
|
986
|
+
export const ROW_GROUP_RE = /^[\w-]{4,64}$/
|
|
987
|
+
|
|
890
988
|
/** how one field of a proposed change draws: a house kind (review/kinds.ts) */
|
|
891
989
|
export { DIFF_TYPES, type DiffType } from './kinds.ts'
|
|
892
990
|
import { DIFF_TYPES, sniffKind, type DiffType } from './kinds.ts'
|
|
@@ -951,7 +1049,8 @@ export function appliedFields(thread: readonly Message[], m: Message): Map<strin
|
|
|
951
1049
|
return out
|
|
952
1050
|
}
|
|
953
1051
|
|
|
954
|
-
/** a proposal waits on
|
|
1052
|
+
/** a proposal waits on the owner until each of its fields is applied, or the owner's words in its own box name it (`re`); a plain reply
|
|
1053
|
+
* of his after it answers nothing (wiki tools/shipkit/threads-asks.md, Answered in its control only) */
|
|
955
1054
|
export function proposeOpen(thread: readonly Message[], m: Message): boolean {
|
|
956
1055
|
if (!m.propose) return false
|
|
957
1056
|
if (thread.some((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner')) return false
|
|
@@ -1088,9 +1187,22 @@ export function textOf(v: unknown): { text: string } | { error: string } {
|
|
|
1088
1187
|
return { text: v.trim() }
|
|
1089
1188
|
}
|
|
1090
1189
|
|
|
1190
|
+
/** a pure reading of an item kept for that item object, by its one other argument, while its messages stay the same
|
|
1191
|
+
* array of the same length: a message the page adds in place is a new reading. The inbox asks the same item from
|
|
1192
|
+
* several selections. A reading's answer is shared, so no caller changes it */
|
|
1193
|
+
export function perItem<A, T>(read: (x: ReviewItem, a: A) => T): (x: ReviewItem, a: A) => T {
|
|
1194
|
+
const kept = new WeakMap<ReviewItem, { thread: readonly Message[]; n: number; by: Map<A, T> }>()
|
|
1195
|
+
return (x, a) => {
|
|
1196
|
+
let k = kept.get(x)
|
|
1197
|
+
if (k === undefined || k.thread !== x.thread || k.n !== x.thread.length) kept.set(x, (k = { thread: x.thread, n: x.thread.length, by: new Map() }))
|
|
1198
|
+
if (!k.by.has(a)) k.by.set(a, read(x, a))
|
|
1199
|
+
return k.by.get(a)!
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
const perParty = <T>(read: (x: ReviewItem, party: Party) => T): ((x: ReviewItem, party: Party) => T) => perItem(read)
|
|
1203
|
+
|
|
1091
1204
|
/** every message id a party marked read */
|
|
1092
|
-
const readBy = (x
|
|
1093
|
-
new Set(x.thread.flatMap((m) => (m.op === 'seen' && partyOf(m.who) === party ? (m.of ?? []) : [])))
|
|
1205
|
+
const readBy = perParty((x, party): ReadonlySet<string> => new Set(x.thread.flatMap((m) => (m.op === 'seen' && partyOf(m.who) === party ? (m.of ?? []) : []))))
|
|
1094
1206
|
|
|
1095
1207
|
/** the owner took a verdict back on an agent's version: news for the agent, which may have acted on that verdict */
|
|
1096
1208
|
const isTakeBack = (x: ReviewItem, m: Message): boolean => m.op === 'reopen' && m.who === 'owner' && x.item.origin.by === 'agent'
|
|
@@ -1109,10 +1221,10 @@ export const mayReadNamed = (m: Pick<Message, 'to'>, who: string, session: strin
|
|
|
1109
1221
|
return named.length === 0 || named.some((t) => (t.lane !== undefined && t.lane === who && (t.session === undefined || session === null || t.session === session)) || (who === 'agent' && session !== null && t.session === session))
|
|
1110
1222
|
}
|
|
1111
1223
|
|
|
1112
|
-
const unreadTalk = (x
|
|
1224
|
+
const unreadTalk = perParty((x, party): readonly Message[] => {
|
|
1113
1225
|
const read = readBy(x, party)
|
|
1114
1226
|
return x.thread.filter((m) => (isTalk(m) || isTakeBack(x, m) || isOwnerClose(m)) && partyOf(m.who) !== party && !read.has(m.id))
|
|
1115
|
-
}
|
|
1227
|
+
})
|
|
1116
1228
|
|
|
1117
1229
|
/** each verdict the owner took back that no agent marked seen: his reopen and the verdict it took back */
|
|
1118
1230
|
export function takenBackOf(x: ReviewItem): { m: Message; took: ReviewStatus; given: string }[] {
|
|
@@ -1154,6 +1266,16 @@ const isFixedUpdate = (m: Message): boolean => m.update?.state === 'fixed' && pa
|
|
|
1154
1266
|
/** the agent's updates on an item, oldest first */
|
|
1155
1267
|
export const updatesOf = (x: ReviewItem): Message[] => x.thread.filter((m) => m.update !== undefined && partyOf(m.who) === 'agent')
|
|
1156
1268
|
|
|
1269
|
+
/** a line the machine wrote (a setup run, a sync, a fold): an agent's party with no session stamped, so nobody holds it */
|
|
1270
|
+
export const byMachine = (m: Message): boolean => partyOf(m.who) === 'agent' && m.session === undefined
|
|
1271
|
+
|
|
1272
|
+
/** the « broken » updates still open on an item before `at` (none after the newest other update), oldest first */
|
|
1273
|
+
export const openBrokenOf = (x: ReviewItem, at = '9999'): Message[] => {
|
|
1274
|
+
const us = updatesOf(x).filter((m) => m.at <= at)
|
|
1275
|
+
const from = findLastIndex(us, (m) => m.update?.state !== 'broken')
|
|
1276
|
+
return us.slice(from + 1)
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1157
1279
|
/** an update as the CLI and the page name it: `update 3 (still broken)`; null for a message that is no update */
|
|
1158
1280
|
export function updateTag(x: ReviewItem, id: string): string | null {
|
|
1159
1281
|
const all = updatesOf(x)
|
|
@@ -1162,7 +1284,10 @@ export function updateTag(x: ReviewItem, id: string): string | null {
|
|
|
1162
1284
|
return u ? `update ${k + 1} (${UPDATE_WORDS[u.state]})` : null
|
|
1163
1285
|
}
|
|
1164
1286
|
|
|
1165
|
-
export
|
|
1287
|
+
export const verdictOf = (x: ReviewItem): Verdict | null => verdictKept(x, null)
|
|
1288
|
+
const verdictKept = perItem((x: ReviewItem, _: null): Verdict | null => verdictOfItem(x))
|
|
1289
|
+
|
|
1290
|
+
function verdictOfItem(x: ReviewItem): Verdict | null {
|
|
1166
1291
|
// a version answered by its kind's acts: the act that settles its last spot is his yes, owing the agent nothing
|
|
1167
1292
|
const settling = settlingOf(x)
|
|
1168
1293
|
let settled: Pick<Message, 'id' | 'at'> | null = settling?.start ? { id: x.item.id, at: x.item.created } : null
|
|
@@ -1175,7 +1300,7 @@ export function verdictOf(x: ReviewItem): Verdict | null {
|
|
|
1175
1300
|
settled = flip ? n : null
|
|
1176
1301
|
if (flip) [m, text, rects] = [undefined, undefined, undefined]
|
|
1177
1302
|
} else if (n.op === 'reopen' || isFixedUpdate(n)) [m, text, rects, settled] = [undefined, undefined, undefined, null]
|
|
1178
|
-
else if (isVersionVerdict(n)) {
|
|
1303
|
+
else if (isVersionVerdict(n) && n.verdict !== 'no-answer') {
|
|
1179
1304
|
if (m?.verdict !== n.verdict) [text, rects] = [undefined, undefined]
|
|
1180
1305
|
m = n
|
|
1181
1306
|
settled = null
|
|
@@ -1198,20 +1323,57 @@ export function verdictOf(x: ReviewItem): Verdict | null {
|
|
|
1198
1323
|
}
|
|
1199
1324
|
}
|
|
1200
1325
|
|
|
1326
|
+
/** his « no answer » on the version, while it stands: no verdict, reopen or fixed update came after it. It takes the
|
|
1327
|
+
* verdict request off his turn and nothing else: the version keeps its state and its verdict, the thread stays open */
|
|
1328
|
+
export function leftUnansweredOf(x: ReviewItem): Message | null {
|
|
1329
|
+
let left: Message | null = null
|
|
1330
|
+
for (const n of x.thread) {
|
|
1331
|
+
if (n.op === 'reopen' || isFixedUpdate(n)) left = null
|
|
1332
|
+
else if (isVersionVerdict(n)) left = n.verdict === 'no-answer' ? n : null
|
|
1333
|
+
}
|
|
1334
|
+
return left
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/** a person's delete of their own words: a `withdraw` that names them in `re`, written by their author (the owner, or
|
|
1338
|
+
* an advisor by their id); an agent's withdraw is never one (review/supersede.ts) */
|
|
1339
|
+
export const deletes = (w: Message, m: Message): boolean =>
|
|
1340
|
+
w.op === 'withdraw' && w.re === m.id && partyOf(w.who) !== 'agent' && w.who === m.who && w.advisor?.id === m.advisor?.id
|
|
1341
|
+
|
|
1342
|
+
/** the words a person may delete: plain words or files they wrote, no verdict, no answer, no act */
|
|
1343
|
+
export const deletable = (m: Message): boolean =>
|
|
1344
|
+
partyOf(m.who) !== 'agent' && m.op === undefined && m.verdict === undefined && m.answer === undefined && m.rate === undefined && m.edit === undefined && m.laneAsk === undefined && m.action === undefined && m.snooze === undefined && m.mute === undefined && (m.text !== undefined || m.files !== undefined)
|
|
1345
|
+
|
|
1346
|
+
/** a thread as every reader sees it: a deleted message and its delete both gone (review/item-rows.ts reads every item
|
|
1347
|
+
* through it, so the hub, the cli, the hq's copy and the advisors' copy follow one rule) */
|
|
1348
|
+
export function withoutDeleted(thread: Message[]): Message[] {
|
|
1349
|
+
const ids = new Map(thread.map((m) => [m.id, m]))
|
|
1350
|
+
const gone = new Set<string>()
|
|
1351
|
+
for (const w of thread) {
|
|
1352
|
+
if (w.op !== 'withdraw' || w.re === undefined) continue
|
|
1353
|
+
const m = ids.get(w.re)
|
|
1354
|
+
if (m !== undefined && deletable(m) && deletes(w, m)) gone.add(w.id).add(m.id)
|
|
1355
|
+
}
|
|
1356
|
+
return gone.size === 0 ? thread : thread.filter((m) => !gone.has(m.id))
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1201
1359
|
/** the agent's withdraw of the version itself; one that names one object of it (`re`) leaves the version as it was */
|
|
1202
1360
|
export const itemWithdrawOf = (x: ReviewItem): Message | undefined => x.thread.filter((m) => m.op === 'withdraw' && m.re === undefined).at(-1)
|
|
1203
1361
|
/** why the agent took the version back unanswered; undefined when it did not */
|
|
1204
1362
|
export const withdrawnOf = (x: ReviewItem): string | undefined => itemWithdrawOf(x)?.note
|
|
1205
1363
|
|
|
1206
1364
|
/** what the list says of an item: an agent's version by the owner's verdict, what he or a player raised by its state */
|
|
1207
|
-
export type ShownStatus = 'pending' | 'wip' | ReviewStatus | 'superseded' | 'withdrawn' | 'raised' | 'fixed' | 'wontfix' | 'rated'
|
|
1365
|
+
export type ShownStatus = 'pending' | 'wip' | ReviewStatus | 'superseded' | 'withdrawn' | 'raised' | 'fixed' | 'wontfix' | 'rated' | 'closed'
|
|
1208
1366
|
|
|
1209
1367
|
export const STATUS_LABEL: Record<ShownStatus, string> = {
|
|
1210
1368
|
pending: 'waiting',
|
|
1369
|
+
closed: 'no verdict needed',
|
|
1211
1370
|
wip: 'in progress',
|
|
1212
1371
|
approved: 'approved',
|
|
1213
1372
|
'approved-with-fix': 'ok with a fix',
|
|
1214
|
-
|
|
1373
|
+
rework: 'rework',
|
|
1374
|
+
'wrong-direction': 'wrong direction',
|
|
1375
|
+
'your-call': 'your call',
|
|
1376
|
+
'no-answer': 'no answer',
|
|
1215
1377
|
archived: 'not doing it',
|
|
1216
1378
|
superseded: 'replaced',
|
|
1217
1379
|
withdrawn: 'withdrawn',
|
|
@@ -1269,7 +1431,7 @@ export const ownSave = (i: Pick<Item, 'saved'>): boolean => i.saved?.by === 'own
|
|
|
1269
1431
|
export const asksNoVerdict = (i: Item): boolean => isOpening(i) || ownSave(i)
|
|
1270
1432
|
|
|
1271
1433
|
/** where an item starts: an agent's version asks for the owner's verdict (a draft waits); what he raises from a tool that named
|
|
1272
|
-
* its topic (the trailer view: `film`) is open, else
|
|
1434
|
+
* its topic (the trailer view: `film`) is open, else new, for any worker to claim; an auto rule's item is open */
|
|
1273
1435
|
const startOf = (i: Item): ItemState =>
|
|
1274
1436
|
ownSave(i)
|
|
1275
1437
|
? { state: 'closed', why: 'fixed' }
|
|
@@ -1281,7 +1443,10 @@ const startOf = (i: Item): ItemState =>
|
|
|
1281
1443
|
|
|
1282
1444
|
/** the state of an item, folded from its thread. A verdict wins over a withdrawal, as the thread shows it; `superseded`: a
|
|
1283
1445
|
* later version follows it. « fix » and « no » give the version back to its author until an agent reads them */
|
|
1284
|
-
export
|
|
1446
|
+
export const stateOf = (x: ReviewItem, superseded: boolean): ItemState => stateKept(x, superseded)
|
|
1447
|
+
const stateKept = perItem((x: ReviewItem, superseded: boolean): ItemState => stateOfItem(x, superseded))
|
|
1448
|
+
|
|
1449
|
+
function stateOfItem(x: ReviewItem, superseded: boolean): ItemState {
|
|
1285
1450
|
const i = x.item
|
|
1286
1451
|
const lane = i.origin.by === 'agent' ? i.origin.lane : undefined
|
|
1287
1452
|
const settling = settlingOf(x)
|
|
@@ -1297,6 +1462,8 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1297
1462
|
given = s
|
|
1298
1463
|
continue
|
|
1299
1464
|
}
|
|
1465
|
+
// his « no answer » on a version changes nothing of its state (leftUnansweredOf)
|
|
1466
|
+
if (m.verdict === 'no-answer' && isVersionVerdict(m)) continue
|
|
1300
1467
|
if (m.verdict !== undefined && isVersionVerdict(m)) {
|
|
1301
1468
|
const v = m.verdict
|
|
1302
1469
|
// « fix » and « no » owe the lane work: reading the verdict is never doing it (done, wontfix or a new version closes it)
|
|
@@ -1319,7 +1486,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1319
1486
|
} else if (s.state === 'asks') s = { ...keep, state: 'draft' }
|
|
1320
1487
|
continue
|
|
1321
1488
|
}
|
|
1322
|
-
// the owner's words on a question answer it:
|
|
1489
|
+
// the owner's words on a question of an old thread answer it: the item is new again
|
|
1323
1490
|
if (m.op === undefined && partyOf(m.who) === 'owner' && m.text !== undefined && s.state === 'question') {
|
|
1324
1491
|
s = { ...keep, state: 'new' }
|
|
1325
1492
|
continue
|
|
@@ -1352,7 +1519,7 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1352
1519
|
s = { ...keep, state: 'closed', why: 'fixed' }
|
|
1353
1520
|
break
|
|
1354
1521
|
case 'done':
|
|
1355
|
-
s = { ...keep, state: 'closed', why:
|
|
1522
|
+
s = { ...keep, state: 'closed', why: ((v) => (v === 'approved-with-fix' || v === 'your-call' ? v : 'fixed'))(verdictOf(x)?.status) }
|
|
1356
1523
|
break
|
|
1357
1524
|
case 'wontfix':
|
|
1358
1525
|
s = { ...keep, state: 'closed', why: 'wontfix' }
|
|
@@ -1380,16 +1547,10 @@ export function stateOf(x: ReviewItem, superseded: boolean): ItemState {
|
|
|
1380
1547
|
/** a version in work: a draft on a live shot, or an agent's version its latest update calls still broken or better */
|
|
1381
1548
|
export const inWork = (x: ReviewItem): boolean => stateOf(x, false).state === 'draft'
|
|
1382
1549
|
|
|
1383
|
-
/** the states each
|
|
1384
|
-
const FROM: Record<Exclude<
|
|
1385
|
-
dispatch: ['new', 'blocked'],
|
|
1386
|
-
ask: ['new', 'blocked'],
|
|
1387
|
-
answer: ['question'],
|
|
1388
|
-
reassign: ['open', 'claimed'],
|
|
1389
|
-
drop: ['new', 'question', 'open', 'blocked'],
|
|
1550
|
+
/** the states each act leaves from; a raised item still new is claimed, fixed or closed as it is */
|
|
1551
|
+
const FROM: Record<Exclude<ActOp, 'seen' | 'take' | 'working'>, readonly State[]> = {
|
|
1390
1552
|
claim: ['open', 'claimed', 'closed', 'blocked'],
|
|
1391
1553
|
release: ['claimed'],
|
|
1392
|
-
blocked: ['claimed'],
|
|
1393
1554
|
fixed: ['open', 'claimed', 'blocked'],
|
|
1394
1555
|
done: ['claimed'],
|
|
1395
1556
|
wontfix: ['open', 'claimed', 'blocked'],
|
|
@@ -1397,41 +1558,36 @@ const FROM: Record<Exclude<Op, 'seen' | 'take' | 'working'>, readonly State[]> =
|
|
|
1397
1558
|
reopen: ['closed', 'claimed'],
|
|
1398
1559
|
ready: ['draft'],
|
|
1399
1560
|
}
|
|
1400
|
-
const
|
|
1401
|
-
const WORKER_OPS = new Set<Op>(['release', 'blocked', 'fixed', 'done', 'wontfix'])
|
|
1561
|
+
const WORKER_OPS = new Set<Op>(['release', 'fixed', 'done', 'wontfix'])
|
|
1402
1562
|
|
|
1403
|
-
/** null when `who` may do `op` on an item in state `s`, else why not.
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
|
|
1407
|
-
export function allowed(s: ItemState, op: Op, who: string, dispatcher: string | null, routed = true, holds = false): string | null {
|
|
1563
|
+
/** null when `who` may do `op` on an item in state `s`, else why not. A worker takes a raised item as it is and acts on
|
|
1564
|
+
* its own claim, the owner may act over a claim; `holds`: the caller holds the item's thread or is the session of the
|
|
1565
|
+
* lane that does */
|
|
1566
|
+
export function allowed(s: ItemState, op: ActOp, who: string, holds = false): string | null {
|
|
1408
1567
|
if (op === 'seen' || op === 'take' || op === 'working') return op !== 'seen' && who === 'owner' ? `an agent ${op === 'take' ? 'takes a thread' : 'says it is on it'}, never the owner` : null
|
|
1409
|
-
if (op === '
|
|
1410
|
-
if (
|
|
1411
|
-
if (!routed) return 'this repo routes nothing: its review unit declares no dispatcher'
|
|
1412
|
-
if (dispatcher === null) return 'nobody holds the dispatcher role: sk thread dispatcher --as <name>'
|
|
1413
|
-
if (who !== dispatcher) return `only the dispatcher (${dispatcher}) may ${op}`
|
|
1414
|
-
}
|
|
1415
|
-
if (!routed && s.state === 'new' && (op === 'claim' || op === 'fixed' || op === 'wontfix')) return op === 'claim' && who === 'owner' ? 'a worker claims, never the owner' : null
|
|
1416
|
-
if (op === 'claim' && (who === 'owner' || who === dispatcher)) return `a worker claims, never ${who === 'owner' ? 'the owner' : 'the dispatcher'}`
|
|
1568
|
+
if (op === 'claim' && who === 'owner') return 'a worker claims, never the owner'
|
|
1569
|
+
if (s.state === 'new' && (op === 'claim' || op === 'fixed' || op === 'wontfix')) return null
|
|
1417
1570
|
// `holds`: the caller holds the thread or is its holder's session (review/parties.ts maySee), so a lane's claim never
|
|
1418
1571
|
// locks its session out of its own thread
|
|
1419
1572
|
if (WORKER_OPS.has(op) && who !== 'owner' && !holds && s.worker !== undefined && s.worker !== who) return `claimed by ${s.worker}, not by ${who}`
|
|
1420
1573
|
if (op === 'claim' && s.state === 'claimed' && s.since !== undefined && s.worker !== who) return `already claimed by ${s.worker}: release it first (--as ${s.worker})`
|
|
1421
|
-
if (op === 'claim' && s.state === 'blocked' && s.worker !== undefined && s.worker !== who) return `blocked by ${s.worker}, who takes it back (--as ${s.worker})
|
|
1422
|
-
if (op === 'claim' && s.state === 'closed' &&
|
|
1423
|
-
return `claim needs open, or a thread he answered « fix » or «
|
|
1574
|
+
if (op === 'claim' && s.state === 'blocked' && s.worker !== undefined && s.worker !== who) return `blocked by ${s.worker}, who takes it back (--as ${s.worker})`
|
|
1575
|
+
if (op === 'claim' && s.state === 'closed' && !OWES_WORK.has(s.why as ReviewStatus))
|
|
1576
|
+
return `claim needs open, or a thread he answered « fix », « rework », « wrong direction » or « your call », it is closed (${s.why})`
|
|
1424
1577
|
if (!FROM[op].includes(s.state)) {
|
|
1425
1578
|
if (op === 'claim' && s.state === 'claimed') return `already claimed by ${s.worker ?? 'an agent'}`
|
|
1426
|
-
if (op === 'claim' && s.state === 'new') return 'not dispatched yet: only the dispatcher sends an item to a topic'
|
|
1427
1579
|
return `${op} needs ${FROM[op].join(' or ')}, it is ${s.state}${s.why ? ` (${s.why})` : ''}`
|
|
1428
1580
|
}
|
|
1429
1581
|
return null
|
|
1430
1582
|
}
|
|
1431
1583
|
|
|
1432
|
-
/** a claim with no message for this long is stale:
|
|
1584
|
+
/** a claim with no message for this long is stale: a watch says so, a rework stops showing */
|
|
1433
1585
|
export const STALE_CLAIM_MS = 2 * 60 * 60 * 1000
|
|
1434
1586
|
|
|
1587
|
+
/** how long a `working` line says an agent is on it with nothing since (wiki tools/shipkit/threads-how-it-fits.md, Read
|
|
1588
|
+
* and on it): past the knee of the store's own history, where 94 % of the lines had their agent's next act */
|
|
1589
|
+
export const WORKING_FRESH_MS = 30 * 60 * 1000
|
|
1590
|
+
|
|
1435
1591
|
/** a claim no message touched for STALE_CLAIM_MS */
|
|
1436
1592
|
export const isStale = (x: ReviewItem, now: Date): boolean =>
|
|
1437
1593
|
stateOf(x, false).state === 'claimed' && now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created) > STALE_CLAIM_MS
|
|
@@ -1474,20 +1630,21 @@ export const coversItem = (f: WatchFilter, x: ReviewItem): boolean =>
|
|
|
1474
1630
|
(f.session === null || (x.item.origin.by === 'agent' && x.item.origin.session === f.session)) && (f.lane === null || laneOf(x) === f.lane)
|
|
1475
1631
|
|
|
1476
1632
|
/** why a bare watch may not start: another one lives in the repo, so a verdict would reach two sessions. null when
|
|
1477
|
-
* none does. A repo keeps one
|
|
1633
|
+
* none does. A repo keeps one; every other session watches its own items or its lane's */
|
|
1478
1634
|
export function bareWatchTaken(live: readonly Watcher[], self: number): string | null {
|
|
1479
1635
|
const other = live.find((w) => w.pid !== self && w.lane === null && w.session === null)
|
|
1480
|
-
return other ? `a watch of every thread already runs (pid ${other.pid}): a repo keeps one
|
|
1636
|
+
return other ? `a watch of every thread already runs (pid ${other.pid}): a repo keeps one. Yours: sk thread watch --mine, or --lane <id>` : null
|
|
1481
1637
|
}
|
|
1482
1638
|
|
|
1483
|
-
/** what `
|
|
1484
|
-
* unfiltered watch (
|
|
1639
|
+
/** what `sk thread post` says when no live watch of the item's own session will read his answer, else null: an
|
|
1640
|
+
* unfiltered watch (another session) hears it for someone else. A lane never arms a watch, its session
|
|
1641
|
+
* hears its threads (wiki tools/shipkit/threads-essentials.md), so a lane is told nothing */
|
|
1485
1642
|
export function unheardLine(item: Item, watchers: readonly Watcher[]): string | null {
|
|
1486
1643
|
const o = item.origin
|
|
1487
|
-
if (o.by !== 'agent') return null
|
|
1488
|
-
const own = o.session
|
|
1644
|
+
if (o.by !== 'agent' || o.lane) return null
|
|
1645
|
+
const own = o.session ? watchers.filter((w) => w.session === o.session) : watchers
|
|
1489
1646
|
if (own.some((w) => coversItem(w, { item, thread: [] }))) return null
|
|
1490
|
-
const watch = o.session ? WATCH('sk') :
|
|
1647
|
+
const watch = o.session ? WATCH('sk') : 'sk thread watch --once'
|
|
1491
1648
|
return `no watch hears this thread: run \`${watch}\` now ${IN_BACKGROUND}, so his answer reaches you as it lands`
|
|
1492
1649
|
}
|
|
1493
1650
|
|
|
@@ -1498,12 +1655,12 @@ export const UNTAKEN_AGAIN_MS = STALE_CLAIM_MS
|
|
|
1498
1655
|
|
|
1499
1656
|
/** why an item waits on the agents and nobody holds it, else null; `superseded`: a later version follows it; `heard`: a
|
|
1500
1657
|
* live watch hears its thread's holder (threads.ts listenersOf) */
|
|
1501
|
-
export function untakenOf(x: ReviewItem, superseded: boolean, heard: boolean, now: Date
|
|
1658
|
+
export function untakenOf(x: ReviewItem, superseded: boolean, heard: boolean, now: Date): string | null {
|
|
1502
1659
|
if (superseded) return null
|
|
1503
1660
|
const quiet = now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)
|
|
1504
1661
|
if (quiet < UNTAKEN_GRACE_MS) return null
|
|
1505
1662
|
const s = stateOf(x, false)
|
|
1506
|
-
if (s.state === 'new') return
|
|
1663
|
+
if (s.state === 'new') return 'raised, nobody claimed it'
|
|
1507
1664
|
if (s.state === 'open') return `raised${s.topic ? ` on ${s.topic}` : ''}, nobody claimed it`
|
|
1508
1665
|
if (s.state !== 'claimed') return null
|
|
1509
1666
|
if (s.since !== undefined) return quiet > STALE_CLAIM_MS ? `${s.worker ?? 'its'} claim went stale` : null
|
|
@@ -1658,6 +1815,7 @@ export function itemProblems(v: unknown): string[] {
|
|
|
1658
1815
|
const p = docProblem(v.doc)
|
|
1659
1816
|
if (p !== null) out.push(p)
|
|
1660
1817
|
}
|
|
1818
|
+
if (v.tags !== undefined && !(Array.isArray(v.tags) && v.tags.every((t) => typeof t === 'string' && TAG_RE.test(t)))) out.push('tags: a list of lowercase words (letters, digits, dashes)')
|
|
1661
1819
|
if (v.choice !== undefined && !(v.choice === true && Array.isArray(v.views) && v.views.length >= 2)) out.push('choice: true on a version of two views or more, or absent')
|
|
1662
1820
|
if (v.agentPick !== undefined && !(v.choice === true && Number.isInteger(v.agentPick) && Array.isArray(v.views) && (v.agentPick as number) >= 0 && (v.agentPick as number) < v.views.length))
|
|
1663
1821
|
out.push('agentPick: the index of one of its views, on a choice version, or absent')
|
|
@@ -1681,9 +1839,8 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1681
1839
|
const out: string[] = []
|
|
1682
1840
|
if (v.id !== name) out.push(`id: ${String(v.id)} is not its file name ${name}`)
|
|
1683
1841
|
if (typeof v.at !== 'string' || typeof v.who !== 'string' || v.who === '') out.push('at, who: texts')
|
|
1684
|
-
if ('seen' in v) out.push('seen: a message of the old shape, before the one store')
|
|
1685
1842
|
if (v.op !== undefined && !OPS.includes(v.op as Op)) out.push(`op: one of ${OPS.join(', ')}`)
|
|
1686
|
-
if (v.verdict !== undefined && !STATUSES.includes(v.verdict as ReviewStatus)) out.push(`verdict: one of ${STATUSES.join(', ')}`)
|
|
1843
|
+
if (v.verdict !== undefined && !STATUSES.includes(statusRead(v.verdict) as ReviewStatus)) out.push(`verdict: one of ${STATUSES.join(', ')}`)
|
|
1687
1844
|
for (const k of ['text', 'image', 'note']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
|
|
1688
1845
|
if (v.files !== undefined && !(Array.isArray(v.files) && v.files.length >= 1 && v.files.length <= MESSAGE_FILES_MAX && v.files.every((f, i) => !fileProblem(f, name, i))))
|
|
1689
1846
|
out.push(`files: 1 to ${MESSAGE_FILES_MAX} of { file: <id>-f<n>.<ext> in order, name: a clean file name, size, type }`)
|
|
@@ -1710,12 +1867,16 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1710
1867
|
if (!texts || (a.options as unknown[]).length < 2 || (a.pick !== undefined && !(index(a.pick) && (a.pick as number) < (a.options as unknown[]).length)))
|
|
1711
1868
|
out.push('ask: { options: two texts or more, pick?: an option index }')
|
|
1712
1869
|
else if (a.views !== undefined && !(Array.isArray(a.views) && a.views.length === (a.options as unknown[]).length && a.views.every((x) => x === null || index(x)))) out.push('ask: views, one view index or null an option')
|
|
1870
|
+
else if (a.row !== undefined && !(obj(a.row) && typeof a.row.group === 'string' && ROW_GROUP_RE.test(a.row.group) && index(a.row.i) && Number.isInteger(a.row.n) && (a.row.i as number) < (a.row.n as number) && typeof a.row.label === 'string' && a.row.label.trim() !== ''))
|
|
1871
|
+
out.push('ask: row, { group, i, n: i below n, label: the thing it picks for }')
|
|
1872
|
+
else if (a.move !== undefined && !(obj(a.move) && typeof a.move.to === 'string' && /^[\w.-]+$/.test(a.move.to) && (a.options as unknown[]).length === 2)) out.push('ask: move, { to: a repo name }, on a choice of two options: move, keep')
|
|
1713
1873
|
} else if (kind === 'checklist') {
|
|
1714
1874
|
if (!texts || (a.options as unknown[]).length < 1 || (a.done !== undefined && !(Array.isArray(a.done) && a.done.every((x) => index(x) && (x as number) < (a.options as unknown[]).length))))
|
|
1715
1875
|
out.push('ask: a checklist, { options: its lines, one or more, done?: line indexes }')
|
|
1716
1876
|
else if (a.choices !== undefined && !(Array.isArray(a.choices) && a.choices.length === (a.options as unknown[]).length && v.instructions !== undefined && a.choices.every((c) => c === null || (obj(c) && Array.isArray(c.options) && c.options.length >= 2 && c.options.every((o) => typeof o === 'string' && o.trim() !== '') && (c.pick === undefined || (index(c.pick) && (c.pick as number) < c.options.length))))))
|
|
1717
1877
|
out.push("ask: choices, an instructions' steps only, one { options: two texts or more, pick? } or null a step")
|
|
1718
1878
|
} else if (!(Array.isArray(a.options) && a.options.length === 0)) out.push(`ask: a ${kind} question holds no options`)
|
|
1879
|
+
if (kind !== 'choice' && obj(a) && a.row !== undefined) out.push('ask: row, on a choice only')
|
|
1719
1880
|
if (kind === 'secret' && !(obj(a) && obj(a.secret) && typeof a.secret.name === 'string' && SECRET_NAME.test(a.secret.name) && (a.secret.login === undefined || a.secret.login === true)))
|
|
1720
1881
|
out.push('ask: a secret question names its secret, { secret: { name, login? } }')
|
|
1721
1882
|
if (typeof v.text !== 'string') out.push('ask: its question in text')
|
|
@@ -1757,6 +1918,8 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1757
1918
|
if (v.replaces !== undefined && !(typeof v.replaces === 'string' && MESSAGE_RE.test(v.replaces))) out.push('replaces: the id of a message of the thread')
|
|
1758
1919
|
if (v.hold !== undefined && !(obj(v.hold) && typeof v.hold.address === 'string' && typeof v.hold.held === 'boolean' && (v.hold.sha === undefined || typeof v.hold.sha === 'string') && (v.hold.ahead === undefined || typeof v.hold.ahead === 'number') && typeof v.text === 'string')) out.push('hold: { address, held, sha?, ahead? } and its words in text')
|
|
1759
1920
|
if (v.laneAsk !== undefined && !(obj(v.laneAsk) && typeof v.laneAsk.for === 'string' && (v.laneAsk.session === undefined || typeof v.laneAsk.session === 'string') && v.who === 'owner')) out.push("laneAsk: { for, session? }, the owner's")
|
|
1921
|
+
if (v.recap !== undefined && !(v.recap === true && v.asksVerdict === true && typeof v.text === 'string' && v.who !== 'owner' && v.who !== 'player')) out.push("recap: true, an agent's words that ask the owner's verdict")
|
|
1922
|
+
if (v.recapAsk !== undefined && !(v.recapAsk === true && v.who === 'owner' && typeof v.text === 'string')) out.push("recapAsk: true, the owner's words")
|
|
1760
1923
|
if (v.unhold !== undefined && !(Array.isArray(v.unhold) && v.unhold.length > 0 && v.unhold.every((a) => typeof a === 'string'))) out.push('unhold: the addresses it releases')
|
|
1761
1924
|
if (v.askBar !== undefined && !(Array.isArray(v.askBar) && v.askBar.length > 0 && v.askBar.every((f) => typeof f === 'string' && MESSAGE_RE.test(f)))) out.push('askBar: the ids of messages of the thread')
|
|
1762
1925
|
if (v.instructions !== undefined) {
|
|
@@ -1769,7 +1932,10 @@ export function messageProblems(v: unknown, name: string): string[] {
|
|
|
1769
1932
|
}
|
|
1770
1933
|
if (v.to !== undefined && !(Array.isArray(v.to) && v.to.length > 0 && v.to.every(mentionOk) && typeof v.text === 'string' && v.who === 'owner')) out.push("to: the owner's words, one or more { name, lane, session? }, { name, session } or { name, advisor }")
|
|
1771
1934
|
if (v.mute !== undefined && !(typeof v.mute === 'boolean' && v.who === 'owner')) out.push("mute: true or false, the owner's")
|
|
1772
|
-
if (v.
|
|
1935
|
+
if (v.rename !== undefined && !(obj(v.rename) && typeof v.rename.from === 'string' && typeof v.rename.to === 'string' && v.rename.to.trim() !== '')) out.push('rename: { from, to: the new name }')
|
|
1936
|
+
if (v.moved !== undefined && !(obj(v.moved) && word(v.moved.from) && word(v.moved.to))) out.push('moved: { from, to: repo names }')
|
|
1937
|
+
if (v.closes !== undefined && !((v.closes === 'thread' || v.closes === 'version') && v.op === 'done')) out.push("closes: 'thread' or 'version', on a done")
|
|
1938
|
+
if (v.op === undefined && v.verdict === undefined && v.rate === undefined && typeof v.text !== 'string' && !Array.isArray(v.rects) && v.snooze === undefined && v.askState === undefined && v.urgent === undefined && v.askBar === undefined && v.unhold === undefined && v.laneAsk === undefined && v.act === undefined && v.mute === undefined && v.rename === undefined && v.moved === undefined)
|
|
1773
1939
|
out.push('a message says something: text, rects, verdict, rate or op')
|
|
1774
1940
|
return out
|
|
1775
1941
|
}
|
|
@@ -1877,7 +2043,7 @@ function trailerRect(r: Record<string, unknown>, t: ItemTrailer, i: number, erro
|
|
|
1877
2043
|
export function verdictMessageOf(body: unknown, item: Item): { ok: true; message: Pick<Message, 'verdict' | 'text' | 'rects' | 'reactions' | 'pick'> } | { ok: false; errors: string[] } {
|
|
1878
2044
|
if (!obj(body)) return { ok: false, errors: ['not an object'] }
|
|
1879
2045
|
const errors: string[] = []
|
|
1880
|
-
if (!STATUSES.includes(body.status as ReviewStatus)) errors.push(`status: one of ${STATUSES.join(', ')}`)
|
|
2046
|
+
if (!STATUSES.includes(statusRead(body.status) as ReviewStatus)) errors.push(`status: one of ${STATUSES.join(', ')}`)
|
|
1881
2047
|
if (body.comment !== undefined && typeof body.comment !== 'string') errors.push('comment: a text')
|
|
1882
2048
|
const rects = body.rects ?? []
|
|
1883
2049
|
if (!Array.isArray(rects)) errors.push('rects: a list')
|
|
@@ -1933,14 +2099,14 @@ export function verdictMessageOf(body: unknown, item: Item): { ok: true; message
|
|
|
1933
2099
|
if (pick !== undefined) {
|
|
1934
2100
|
if (!isChoice(item)) errors.push('pick: only on a choice version')
|
|
1935
2101
|
else if (!(typeof pick === 'number' && Number.isInteger(pick) && pick >= 0 && pick < views.length)) errors.push(`pick: the index of one of the version's ${views.length} views`)
|
|
1936
|
-
else if (!isApproved(body.status as ReviewStatus)) errors.push('pick: goes with approved or approved-with-fix;
|
|
2102
|
+
else if (!isApproved(statusRead(body.status) as ReviewStatus)) errors.push('pick: goes with approved or approved-with-fix; no option right is a rework or a wrong direction')
|
|
1937
2103
|
}
|
|
1938
2104
|
if (errors.length > 0) return { ok: false, errors }
|
|
1939
2105
|
const comment = typeof body.comment === 'string' ? body.comment : ''
|
|
1940
2106
|
return {
|
|
1941
2107
|
ok: true,
|
|
1942
2108
|
message: {
|
|
1943
|
-
verdict: body.status as ReviewStatus,
|
|
2109
|
+
verdict: statusRead(body.status) as ReviewStatus,
|
|
1944
2110
|
...(comment ? { text: comment } : {}),
|
|
1945
2111
|
...(out.length > 0 ? { rects: out } : {}),
|
|
1946
2112
|
...(reactions.length > 0 ? { reactions } : {}),
|
|
@@ -1960,7 +2126,6 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1960
2126
|
}
|
|
1961
2127
|
const out: ReviewReaction[] = []
|
|
1962
2128
|
const seen = new Set<string>()
|
|
1963
|
-
const rowsPicked = new Set<string>()
|
|
1964
2129
|
for (const [i, r] of v.entries()) {
|
|
1965
2130
|
if (obj(r) && (draft || r.post !== undefined)) {
|
|
1966
2131
|
const q = postReaction(r, i, draft, seen, errors)
|
|
@@ -1975,7 +2140,7 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1975
2140
|
const tiles = isGallery(on) ? on.gallery.length : 0
|
|
1976
2141
|
const tile = r.tile
|
|
1977
2142
|
if (tile !== undefined && !(typeof tile === 'number' && Number.isInteger(tile) && tile >= 0 && tile < tiles)) errors.push(`reactions[${i}].tile: the index of one tile of a gallery view`)
|
|
1978
|
-
if (r.status !== undefined && !STATUSES.includes(r.status as ReviewStatus)) errors.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
2143
|
+
if (r.status !== undefined && !STATUSES.includes(statusRead(r.status) as ReviewStatus)) errors.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
1979
2144
|
if (r.comment !== undefined && typeof r.comment !== 'string') errors.push(`reactions[${i}].comment: a text`)
|
|
1980
2145
|
const stars = r.stars
|
|
1981
2146
|
// a choice scores its options, a gallery each of its tiles
|
|
@@ -1985,23 +2150,14 @@ function reactionsOf(v: unknown, views: readonly ReviewView[], errors: string[],
|
|
|
1985
2150
|
const key = `${String(r.view)}/${String(tile ?? '')}`
|
|
1986
2151
|
if (seen.has(key)) errors.push(`reactions[${i}]: a second reaction on the same view or tile`)
|
|
1987
2152
|
seen.add(key)
|
|
1988
|
-
// a variant he keeps: one tile a row
|
|
1989
|
-
const group = typeof tile === 'number' && isGallery(on) ? on.gallery[tile]?.group : undefined
|
|
1990
|
-
const picked = r.picked
|
|
1991
|
-
if (picked !== undefined) {
|
|
1992
|
-
if (picked !== true || group === undefined) errors.push(`reactions[${i}].picked: true, only on a tile of a row of variants`)
|
|
1993
|
-
else if (rowsPicked.has(`${String(r.view)}/${group}`)) errors.push(`reactions[${i}].picked: one tile a row, and ${group} has one already`)
|
|
1994
|
-
else rowsPicked.add(`${String(r.view)}/${group}`)
|
|
1995
|
-
}
|
|
1996
2153
|
const comment = typeof r.comment === 'string' ? r.comment.trim() : ''
|
|
1997
|
-
if (r.status === undefined && comment === '' && stars === undefined
|
|
2154
|
+
if (r.status === undefined && comment === '' && stars === undefined) continue
|
|
1998
2155
|
out.push({
|
|
1999
2156
|
view: r.view as number,
|
|
2000
2157
|
...(typeof tile === 'number' ? { tile } : {}),
|
|
2001
|
-
...(r.status !== undefined ? { status: r.status as ReviewStatus } : {}),
|
|
2158
|
+
...(r.status !== undefined ? { status: statusRead(r.status) as ReviewStatus } : {}),
|
|
2002
2159
|
comment,
|
|
2003
2160
|
...(typeof stars === 'number' ? { stars } : {}),
|
|
2004
|
-
...(picked === true && group !== undefined ? { picked: true as const } : {}),
|
|
2005
2161
|
})
|
|
2006
2162
|
}
|
|
2007
2163
|
return out
|
|
@@ -2013,16 +2169,16 @@ function postReaction(r: Record<string, unknown>, i: number, draft: boolean, see
|
|
|
2013
2169
|
const bad: string[] = []
|
|
2014
2170
|
if (!draft) bad.push(`reactions[${i}].post: only on a draft version`)
|
|
2015
2171
|
else if (typeof r.post !== 'string' || !POST_KEY.test(r.post)) bad.push(`reactions[${i}].post: the key of one message of the draft, <account> or <account>/<name>`)
|
|
2016
|
-
if (r.status !== undefined && !STATUSES.includes(r.status as ReviewStatus)) bad.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
2172
|
+
if (r.status !== undefined && !STATUSES.includes(statusRead(r.status) as ReviewStatus)) bad.push(`reactions[${i}].status: one of ${STATUSES.join(', ')}`)
|
|
2017
2173
|
if (r.comment !== undefined && typeof r.comment !== 'string') bad.push(`reactions[${i}].comment: a text`)
|
|
2018
|
-
for (const k of ['tile', 'stars'
|
|
2174
|
+
for (const k of ['tile', 'stars']) if (r[k] !== undefined) bad.push(`reactions[${i}].${k}: none on a message of a draft`)
|
|
2019
2175
|
const key = `post/${String(r.post)}`
|
|
2020
2176
|
if (seen.has(key)) bad.push(`reactions[${i}]: a second reaction on the same message`)
|
|
2021
2177
|
seen.add(key)
|
|
2022
2178
|
errors.push(...bad)
|
|
2023
2179
|
const comment = typeof r.comment === 'string' ? r.comment.trim() : ''
|
|
2024
2180
|
if (bad.length > 0 || (r.status === undefined && comment === '')) return null
|
|
2025
|
-
return { view: 0, post: r.post as string, ...(r.status !== undefined ? { status: r.status as ReviewStatus } : {}), comment }
|
|
2181
|
+
return { view: 0, post: r.post as string, ...(r.status !== undefined ? { status: statusRead(r.status) as ReviewStatus } : {}), comment }
|
|
2026
2182
|
}
|
|
2027
2183
|
|
|
2028
2184
|
/** a draft version's message as the page and the CLI name it: the name the version pinned, else its key (one the draft gained since) */
|