rvlib-shipkit 2.28.0 → 2.30.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 +75 -1
- package/package.json +11 -2
- package/src/advisors/acts.ts +277 -0
- package/src/advisors/advice.ts +384 -0
- package/src/advisors/advisor-view.ts +417 -0
- package/src/advisors/app-graph.ts +112 -0
- package/src/advisors/app.ts +75 -0
- package/src/advisors/door.ts +59 -0
- package/src/advisors/edge/api.ts +292 -0
- package/src/advisors/edge/bucket.ts +43 -0
- package/src/advisors/edge/certs.ts +20 -0
- package/src/advisors/edge/form.ts +45 -0
- package/src/advisors/edge/handler.ts +156 -0
- package/src/advisors/edge/jwt.ts +76 -0
- package/src/advisors/edge/shell.ts +27 -0
- package/src/advisors/edge/status.ts +12 -0
- package/src/advisors/edge/types.ts +137 -0
- package/src/advisors/edge/worker.ts +52 -0
- package/src/advisors/expose.ts +154 -0
- package/src/advisors/job.ts +35 -0
- package/src/advisors/owner-store.ts +226 -0
- package/src/advisors/photos.ts +182 -0
- package/src/advisors/project.ts +311 -0
- package/src/advisors/r2.ts +46 -0
- package/src/advisors/routes.ts +496 -0
- package/src/advisors/scan.ts +205 -0
- package/src/advisors/sync.ts +363 -0
- package/src/agent-time/accounts-usage-disk.ts +29 -0
- package/src/agent-time/accounts-usage.ts +105 -0
- package/src/agent-time/claude-sessions.ts +32 -0
- package/src/agent-time/hooks.ts +64 -27
- package/src/agent-time/lane-name.ts +7 -0
- package/src/agent-time/leads.ts +95 -0
- package/src/agent-time/live.ts +5 -2
- package/src/agent-time/registry.ts +248 -86
- package/src/agent-time/render.ts +35 -4
- package/src/agent-time/report-cache.ts +4 -8
- package/src/agent-time/report.ts +19 -1
- package/src/agent-time/store.ts +16 -20
- package/src/annex/snapshots.ts +3 -3
- package/src/annex/tidy.ts +10 -23
- package/src/asks/ask-after.ts +2 -1
- package/src/asks/ask-carry.ts +190 -0
- package/src/asks/ask-close.ts +72 -0
- package/src/asks/ask-doc.ts +42 -0
- package/src/asks/ask-migrate.ts +9 -9
- package/src/asks/ask-steps-fold.ts +71 -114
- package/src/asks/ask-store.ts +190 -58
- package/src/asks/ask-words-fold.ts +208 -0
- package/src/check.ts +9 -1
- package/src/checks/SK001-package-json-shape.check.ts +6 -7
- package/src/checks/SK003-claude-md-shape.check.ts +1 -0
- package/src/checks/SK004-gitignore-policy.check.ts +25 -19
- package/src/checks/SK008-reviewer-agent.check.ts +4 -7
- package/src/checks/SK010-undeclared-unit.check.ts +77 -64
- package/src/checks/SK013-one-way-in-policy.check.ts +21 -8
- package/src/checks/SK017-vscode-hub-task.check.ts +1 -0
- package/src/checks/SK024-identity-colors.check.ts +1 -1
- package/src/checks/SK027-agent-wiki-links.check.ts +47 -6
- package/src/checks/SK033-global-contribution.check.ts +2 -1
- package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
- package/src/checks/SK036-draft-media-size.check.ts +5 -4
- package/src/checks/SK039-vscode-watch-generated.check.ts +2 -1
- package/src/checks/SK040-release-words.check.ts +39 -10
- package/src/checks/SK042-post-kinds.check.ts +2 -2
- package/src/checks/SK045-slow-hooks.check.ts +5 -2
- package/src/checks/SK049-thread-answers-hook.check.ts +11 -5
- package/src/checks/SK050-retired-commands.check.ts +1 -0
- package/src/checks/SK051-no-formatter.check.ts +486 -0
- package/src/cli/channel-run.ts +17 -0
- package/src/cli/cmd_Advisors.ts +357 -0
- package/src/cli/cmd_Annex.ts +10 -10
- package/src/cli/cmd_Asks.ts +113 -12
- package/src/cli/cmd_Backup.ts +12 -8
- package/src/cli/cmd_CacheAudit.ts +2 -2
- package/src/cli/cmd_Channel.ts +43 -0
- package/src/cli/cmd_Check.ts +3 -3
- package/src/cli/cmd_Checks.ts +1 -1
- package/src/cli/cmd_Ci.ts +15 -16
- package/src/cli/cmd_Db.ts +9 -9
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_GlobalProcesses.ts +1 -0
- package/src/cli/cmd_History.ts +2 -2
- package/src/cli/cmd_Home.ts +17 -11
- package/src/cli/cmd_Hooks.ts +14 -4
- package/src/cli/cmd_Hq.ts +73 -19
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +22 -4
- package/src/cli/cmd_Media.ts +67 -16
- package/src/cli/cmd_Orchestrator.ts +307 -0
- package/src/cli/cmd_OrchestratorRole.ts +163 -0
- package/src/cli/cmd_Rec.ts +5 -2
- package/src/cli/cmd_Reflect.ts +17 -3
- package/src/cli/cmd_Releases.ts +38 -38
- package/src/cli/cmd_Review.ts +760 -409
- package/src/cli/cmd_Secret.ts +44 -14
- package/src/cli/cmd_Shot.ts +12 -6
- package/src/cli/cmd_Social.ts +5 -4
- package/src/cli/cmd_SocialDrafts.ts +23 -10
- package/src/cli/cmd_Sound.ts +1 -0
- package/src/cli/cmd_Space.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +18 -11
- package/src/cli/cmd_ThreadReflect.ts +20 -12
- package/src/cli/cmd_ThreadSyncNeeds.ts +7 -7
- package/src/cli/cmd_Time.ts +2 -1
- package/src/cli/cmd_Tmp.ts +9 -8
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -5
- package/src/cli/cmd_Urls.ts +6 -6
- package/src/cli/cmd_Vault.ts +4 -4
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Worktrees.ts +109 -0
- package/src/cli/inbox-hook-run.ts +109 -0
- package/src/cli/registry.ts +19 -4
- package/src/cli/review-here.ts +136 -0
- package/src/cli.ts +64 -25
- package/src/collections/actions.ts +7 -5
- package/src/collections/checks.ts +6 -1
- package/src/collections/collection-types.ts +20 -8
- package/src/collections/pings.ts +7 -1
- package/src/collections/providers.ts +21 -19
- package/src/collections/review.ts +25 -23
- package/src/collections/state-rules.ts +8 -7
- package/src/collections/tests.ts +7 -4
- package/src/comfy/comfy-panel.ts +2 -2
- package/src/commands/model.ts +1 -1
- package/src/commands/routes.ts +1 -1
- package/src/commands/runs.ts +1 -1
- package/src/core/app-icon-frame.ts +62 -0
- package/src/core/app-icon.ts +178 -22
- package/src/core/archived.ts +10 -7
- package/src/core/atomic-write.ts +36 -0
- package/src/core/budget.ts +16 -1
- package/src/core/bun-builtins.ts +7 -7
- package/src/core/canonical-scripts.ts +4 -6
- package/src/core/check-ctx.ts +54 -6
- package/src/core/check-pass.ts +7 -0
- package/src/core/day-stamp.ts +20 -0
- package/src/core/foreign.ts +87 -0
- package/src/core/git-bin.ts +10 -0
- package/src/core/git.ts +60 -16
- package/src/core/gui-color.ts +75 -0
- package/src/core/hard-reset.ts +1 -2
- package/src/core/history-files.ts +4 -8
- package/src/core/house-layout.ts +3 -0
- package/src/core/hub-theme.ts +14 -0
- package/src/core/identity.ts +1 -1
- package/src/core/in-base.ts +19 -0
- package/src/core/instance.ts +15 -5
- package/src/core/last-good.ts +42 -133
- package/src/core/layout.ts +4 -1
- package/src/core/load-probe.ts +4 -8
- package/src/core/locked-write.ts +117 -47
- package/src/core/loop-watch.ts +24 -3
- package/src/core/machine-commit.ts +9 -1
- package/src/core/machine-db.ts +54 -12
- package/src/core/machine-link.ts +1 -1
- package/src/core/memory-watch.ts +3 -2
- package/src/core/motherhome.ts +2 -1
- package/src/core/nearest.ts +23 -0
- package/src/core/on-loop.ts +57 -0
- package/src/core/one-lib.ts +2 -1
- package/src/core/one-way-in-policy.ts +43 -25
- package/src/core/owner-word-policy.ts +123 -0
- package/src/core/panel-shades.ts +140 -0
- package/src/core/raw-access.ts +9 -2
- package/src/core/reexec.ts +3 -5
- package/src/core/repo-gui-color.ts +16 -0
- package/src/core/repo-walk.ts +104 -0
- package/src/core/retention.ts +10 -12
- package/src/core/role-policy.ts +17 -0
- package/src/core/run-dirs.ts +45 -0
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/scope.ts +6 -3
- package/src/core/slots.ts +2 -2
- package/src/core/slug.ts +33 -0
- package/src/core/spawn-timeout.ts +3 -1
- package/src/core/squircle.ts +0 -8
- package/src/core/throwaway-worktree.ts +21 -2
- package/src/core/tmux-policy.ts +264 -0
- package/src/core/unit-files.ts +4 -4
- package/src/core/unit-icon.ts +43 -0
- package/src/core/when-block.ts +4 -5
- package/src/core/when.ts +1 -3
- package/src/core/words.ts +33 -0
- package/src/fleet/push-fleet.ts +6 -11
- package/src/fleet/scan-fleet.ts +3 -0
- package/src/{core → gate}/cache-audit.ts +8 -2
- package/src/{core → gate}/check-runner.ts +24 -54
- package/src/{core → gate}/discover-checks.ts +5 -102
- package/src/{core → gate}/discover-legacy-checks.ts +3 -3
- package/src/{ledger → gate}/gate-checks.ts +19 -14
- package/src/gate/head-gate.ts +151 -0
- package/src/{core → gate}/job-follow.ts +1 -1
- package/src/{core → gate}/job-run.ts +3 -3
- package/src/{core → gate}/pre-commit-discovery.ts +2 -2
- package/src/{core → gate}/run-check.ts +7 -7
- package/src/{core → gate}/run-ci.ts +9 -9
- package/src/gate/run-fix.ts +198 -0
- package/src/{core → gate}/run-fixers.ts +22 -17
- package/src/{core → gate}/trace-audit.ts +8 -8
- package/src/home/activity-shape.ts +3 -1
- package/src/home/activity.ts +15 -12
- package/src/home/app-sign.ts +17 -9
- package/src/home/daemon-guard.ts +24 -0
- package/src/home/daemon-jobs.ts +66 -16
- package/src/home/database-words.ts +21 -27
- package/src/home/databases.ts +3 -3
- package/src/home/global-context.ts +2 -2
- package/src/home/global-units.ts +1 -1
- package/src/home/gui-app/ShipkitGui.swift +2129 -187
- package/src/home/gui-app/icon.svg +8 -0
- package/src/home/gui-app.ts +95 -31
- package/src/home/handover.ts +126 -0
- package/src/home/home-move.ts +29 -16
- package/src/home/home-paths.ts +30 -8
- package/src/home/home-routes.ts +120 -6
- package/src/home/home-start.ts +28 -4
- package/src/home/home-state.ts +12 -6
- package/src/home/hubs.ts +28 -5
- package/src/home/inbox-shape.ts +64 -37
- package/src/home/inbox.ts +2 -1
- package/src/home/lib-watch.ts +93 -74
- package/src/home/log-follow.ts +117 -0
- package/src/home/machine-fold.ts +47 -44
- package/src/home/machine-repair.ts +5 -6
- package/src/home/machine-stores.ts +3 -3
- package/src/home/machine-temp.ts +58 -67
- package/src/home/open-app.ts +9 -3
- package/src/home/page-build.ts +334 -0
- package/src/home/page-held.ts +338 -0
- package/src/home/pm-config.ts +2 -2
- package/src/home/pm.ts +96 -5
- package/src/home/process-apps.ts +73 -26
- package/src/home/process-rows.ts +16 -1
- package/src/home/push-sources.ts +137 -0
- package/src/home/resources.ts +16 -7
- package/src/home/run-daemon.ts +58 -5
- package/src/home/run-pm.ts +2 -1
- package/src/home/run-web.ts +11 -6
- package/src/home/search-shape.ts +54 -0
- package/src/home/search.ts +114 -0
- package/src/home/serve-daemon.ts +51 -20
- package/src/home/serve-web.ts +214 -149
- package/src/home/space-page.ts +10 -10
- package/src/home/space-route.ts +2 -2
- package/src/home/space-words.ts +11 -10
- package/src/home/supervise.ts +26 -1
- package/src/home/time-page-shape.ts +0 -13
- package/src/home/vault-page.ts +17 -16
- package/src/home/vault-reveal.ts +29 -0
- package/src/home/vault-words.ts +3 -3
- package/src/home/via-hub.ts +3 -4
- package/src/home/web-places.ts +239 -0
- package/src/home/widgets.ts +16 -2
- package/src/home/worktree-tidy.ts +236 -0
- package/src/hooks/commit-message.ts +11 -9
- package/src/hooks/edit-guard.ts +12 -0
- package/src/hooks/hook-gates.ts +2 -0
- package/src/hooks/leak-guard.ts +9 -3
- package/src/hooks/one-way-in-guard.ts +146 -61
- package/src/hooks/run-hooks.ts +70 -7
- package/src/hooks/shared-file.ts +364 -0
- package/src/hooks/shell-writes.ts +620 -0
- package/src/hooks/write-log.ts +149 -0
- package/src/{serve → house}/project-gutter.ts +5 -1
- package/src/hq/door-route.ts +64 -8
- package/src/hq/door.ts +47 -14
- package/src/hq/files-send.ts +5 -5
- package/src/hq/forgotten-log.ts +1 -1
- package/src/hq/history-check.ts +7 -6
- package/src/hq/history-send.ts +15 -15
- package/src/hq/hq-db.ts +11 -4
- package/src/hq/hq-local.ts +36 -15
- package/src/hq/hq-routes.ts +4 -2
- package/src/hq/hq-store.ts +13 -7
- package/src/hq/kinds/ask.ts +4 -3
- package/src/hq/kinds/index.ts +5 -4
- package/src/hq/kinds/{card-gone.ts → item-gone.ts} +24 -25
- package/src/hq/kinds/{card-msg.ts → item-msg.ts} +25 -27
- package/src/hq/kinds/{card.ts → item.ts} +31 -29
- package/src/hq/kinds/kind.ts +12 -4
- package/src/hq/kinds/media.ts +2 -3
- package/src/hq/kinds/presence-rule.ts +56 -0
- package/src/hq/kinds/presence.ts +210 -0
- package/src/hq/kinds/prompt.ts +2 -1
- package/src/hq/kinds/report.ts +8 -5
- package/src/hq/kinds/time-day.ts +5 -4
- package/src/hq/lead-order.ts +68 -0
- package/src/hq/ledger.ts +22 -22
- package/src/hq/machine-notes.ts +14 -15
- package/src/hq/outbox.ts +38 -22
- package/src/hq/replica.ts +5 -7
- package/src/hq/report-facts.ts +14 -7
- package/src/hq/report.ts +57 -14
- package/src/hq/switch.ts +21 -23
- package/src/hq/terminal-hop.ts +64 -0
- package/src/hq/{cards.ts → thread-sync.ts} +140 -105
- package/src/hq/vault-route.ts +1 -1
- package/src/{serve → http}/door-forward.ts +21 -16
- package/src/{serve → http}/door-names.ts +9 -0
- package/src/http/hop-caller.ts +23 -0
- package/src/http/hop-names.ts +14 -0
- package/src/http/loopback-serve.ts +106 -0
- package/src/http/owner-word.ts +128 -0
- package/src/{serve → http}/same-origin.ts +15 -2
- package/src/{serve → http}/tailnet-caller.ts +5 -4
- package/src/identities/machine-route.ts +2 -2
- package/src/identities/shown.ts +2 -6
- package/src/ledger/check-table.ts +1 -1
- package/src/ledger/db.ts +1 -0
- package/src/ledger/git-key.ts +9 -3
- package/src/ledger/git-scan.ts +2 -2
- package/src/ledger/ledger.ts +6 -16
- package/src/ledger/run-log.ts +25 -1
- package/src/media-kinds.ts +4 -1
- package/src/media-store/backup/daemon.ts +3 -2
- package/src/media-store/backup/keys.ts +0 -3
- package/src/media-store/backup/manifest.ts +1 -1
- package/src/media-store/backup/prune.ts +15 -18
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/run.ts +8 -27
- package/src/media-store/backup/sources.ts +63 -17
- package/src/media-store/backup/thread-copy.ts +16 -13
- package/src/media-store/backup/watch.ts +10 -6
- package/src/media-store/content.ts +3 -0
- package/src/media-store/copy/config.ts +10 -9
- package/src/media-store/copy/night.ts +4 -4
- package/src/media-store/daemon.ts +10 -6
- package/src/media-store/db.ts +10 -20
- package/src/media-store/forget-one.ts +247 -0
- package/src/media-store/forget.ts +23 -4
- package/src/media-store/hq-send.ts +5 -4
- package/src/media-store/purge.ts +2 -2
- package/src/media-store/put.ts +3 -0
- package/src/media-store/remote.ts +2 -2
- package/src/media-store/space-listing.ts +0 -5
- package/src/media-store/space.ts +15 -16
- package/src/media-store/tidy.ts +3 -3
- package/src/media-store/upload.ts +6 -2
- package/src/media-store/webp.ts +3 -3
- package/src/messages/collection.ts +2 -2
- package/src/messages/model.ts +6 -1
- package/src/messages/objects.ts +5 -3
- package/src/messages/routes.ts +3 -0
- package/src/messages/score.ts +1 -3
- package/src/messages/store-doc.ts +114 -0
- package/src/messages/verdicts.ts +6 -0
- package/src/messages/write.ts +3 -3
- package/src/mv/mv-md.ts +43 -12
- package/src/orchestrator/brief.md +31 -0
- package/src/orchestrator/channel-declare.ts +58 -0
- package/src/orchestrator/channel.ts +226 -0
- package/src/orchestrator/guards.ts +72 -0
- package/src/orchestrator/host.ts +35 -0
- package/src/orchestrator/lead-shape.ts +86 -0
- package/src/orchestrator/now.ts +88 -0
- package/src/orchestrator/phone.ts +101 -0
- package/src/orchestrator/places-file.ts +38 -0
- package/src/orchestrator/places-look.ts +180 -0
- package/src/orchestrator/places-shape.ts +151 -0
- package/src/orchestrator/places.ts +50 -0
- package/src/orchestrator/presence-shape.ts +28 -0
- package/src/orchestrator/presence.ts +79 -0
- package/src/orchestrator/push.ts +97 -0
- package/src/orchestrator/role-shape.ts +270 -0
- package/src/orchestrator/role.ts +242 -0
- package/src/orchestrator/routes.ts +218 -0
- package/src/orchestrator/sessions-shape.ts +78 -0
- package/src/orchestrator/sessions.ts +86 -0
- package/src/orchestrator/share.ts +71 -0
- package/src/orchestrator/start-notice.ts +61 -0
- package/src/orchestrator/start.ts +137 -0
- package/src/orchestrator/started.ts +55 -0
- package/src/orchestrator/stuck.ts +196 -0
- package/src/orchestrator/unheard.ts +79 -0
- package/src/pages/frame-client.ts +44 -6
- package/src/pages/unit.ts +1 -1
- package/src/plan/repo-source.ts +1 -1
- package/src/problems/failure-words.ts +80 -0
- package/src/recordings/load.ts +1 -1
- package/src/recordings/model.ts +18 -10
- package/src/recordings/place.ts +3 -3
- package/src/recordings/recorder-app/Capture.swift +69 -21
- package/src/recordings/recorder-app/Editor.swift +214 -11
- package/src/recordings/recorder-app/main.swift +229 -47
- package/src/recordings/recorder-app.ts +1 -1
- package/src/recordings/routes.ts +11 -1
- package/src/recordings/take.ts +7 -5
- package/src/recordings/view.ts +6 -0
- package/src/reflect/prompt-corpus.ts +5 -3
- package/src/reflect/thread-words.ts +51 -0
- package/src/reflections/reflection-close.ts +123 -0
- package/src/reflections/reflection-doc.ts +59 -0
- package/src/reflections/reflection-place.ts +60 -0
- package/src/release/gate-checkout.ts +122 -20
- package/src/release/git-facts.ts +9 -8
- package/src/release/machine-words.ts +21 -3
- package/src/release/public-clean.ts +78 -19
- package/src/release/run-bump.ts +29 -10
- package/src/release/run-release.ts +76 -52
- package/src/releases/add.ts +33 -87
- package/src/releases/{from-card.ts → from-thread.ts} +47 -46
- package/src/releases/model.ts +207 -36
- package/src/releases/routes.ts +2 -2
- package/src/releases/shape.ts +184 -0
- package/src/releases/store.ts +10 -10
- package/src/repo-config.ts +46 -8
- package/src/review/anim.ts +7 -7
- package/src/review/answer-kinds.ts +39 -10
- package/src/review/aside-at.ts +19 -0
- package/src/review/auto.ts +3 -3
- package/src/review/band.ts +95 -3
- package/src/review/branch-hold.ts +12 -5
- package/src/review/cells.ts +169 -46
- package/src/review/doc-card.ts +41 -0
- package/src/review/doc-model.ts +100 -0
- package/src/review/doc-routes.ts +66 -0
- package/src/review/doc-save.ts +152 -0
- package/src/review/{draft-card.ts → draft-item.ts} +10 -7
- package/src/review/draft-model.ts +125 -17
- package/src/review/events.ts +5 -12
- package/src/review/file-tags.ts +52 -0
- package/src/review/format.ts +84 -41
- package/src/review/gone.ts +20 -20
- package/src/review/hand-over.ts +58 -0
- package/src/review/heard.ts +29 -0
- package/src/review/house-kind-defs.ts +34 -4
- package/src/review/http.ts +1 -1
- package/src/review/inbox-hook.ts +64 -10
- package/src/review/inbox-read.ts +54 -16
- package/src/review/instruction-guards.ts +137 -0
- package/src/review/instructions.ts +56 -2
- package/src/review/{card-db.ts → item-db.ts} +84 -32
- package/src/review/{card-rows.ts → item-rows.ts} +77 -50
- package/src/review/kind-still.ts +125 -0
- package/src/review/kinds.ts +46 -10
- package/src/review/lane-ask.ts +6 -2
- package/src/review/live-post.ts +107 -0
- package/src/review/live-view.ts +137 -0
- package/src/review/media-kind.ts +4 -4
- package/src/review/media-read.ts +4 -4
- package/src/review/media.ts +3 -5
- package/src/review/mentions.ts +102 -0
- package/src/review/model-moved.ts +76 -0
- package/src/review/model.ts +474 -151
- package/src/review/move.ts +59 -58
- package/src/review/need-address.ts +5 -5
- package/src/review/need-threads.ts +15 -57
- package/src/review/notes.ts +2 -1
- package/src/review/one-block.ts +64 -0
- package/src/review/owner-read.ts +41 -0
- package/src/review/owner-verdict.ts +3 -3
- package/src/review/parties.ts +172 -11
- package/src/review/paste.ts +4 -4
- package/src/review/phone-push.ts +137 -0
- package/src/review/previews.ts +16 -16
- package/src/review/project.ts +1 -1
- package/src/review/push.ts +286 -0
- package/src/review/referring.ts +26 -4
- package/src/review/reflection-object.ts +13 -18
- package/src/review/rev.ts +1 -1
- package/src/review/role.ts +3 -3
- package/src/review/routes.ts +124 -77
- package/src/review/search-index.ts +218 -0
- package/src/review/search-job.ts +40 -0
- package/src/review/search-ocr.ts +138 -0
- package/src/review/search-text.ts +129 -0
- package/src/review/secret-route.ts +45 -15
- package/src/review/settle.ts +67 -0
- package/src/review/snooze.ts +1 -16
- package/src/review/stage-routes.ts +15 -13
- package/src/review/{stage-card.ts → stage-thread.ts} +18 -17
- package/src/review/store-index.ts +49 -0
- package/src/review/store-parties.ts +22 -0
- package/src/review/store.ts +394 -214
- package/src/review/supersede.ts +23 -7
- package/src/review/take-back.ts +20 -6
- package/src/review/threads.ts +196 -64
- package/src/review/traces.ts +21 -33
- package/src/review/trailer-desk.ts +7 -7
- package/src/review/{trailer-card.ts → trailer-item.ts} +10 -10
- package/src/review/trailer-model.ts +4 -4
- package/src/review/trailer-notes.ts +2 -2
- package/src/review/trailer-routes.ts +5 -4
- package/src/review/trailer-shots.ts +3 -3
- package/src/review/unit.ts +71 -9
- package/src/review/uploads.ts +103 -0
- package/src/review/verdict-items.ts +2 -2
- package/src/review/verdict-write.ts +1 -1
- package/src/review/view-layout.ts +76 -0
- package/src/review/wait.ts +11 -5
- package/src/review/wakes.ts +115 -0
- package/src/review/watch-feed.ts +183 -0
- package/src/review/watchers.ts +48 -6
- package/src/rules/untrack-generated.ts +40 -39
- package/src/scaffold/files/bunfig.toml +1 -9
- package/src/scaffold/files/vscode-settings.json +1 -1
- package/src/scaffold/project-scaffold.ts +14 -10
- package/src/secrets/archive.ts +2 -1
- package/src/secrets/key-pair.ts +14 -0
- package/src/secrets/keychain-write.ts +11 -3
- package/src/secrets/lapse-mark.ts +8 -3
- package/src/secrets/lapse.ts +28 -17
- package/src/secrets/manager.ts +5 -1
- package/src/secrets/name-template.ts +83 -0
- package/src/secrets/name.ts +3 -0
- package/src/secrets/read.ts +10 -6
- package/src/secrets/secrets-view.ts +299 -0
- package/src/secrets/security-line.ts +19 -0
- package/src/secrets/who-reads.ts +2 -1
- package/src/serve/embed.ts +1 -1
- package/src/serve/frame-part.ts +49 -0
- package/src/serve/house-runs.ts +1 -1
- package/src/serve/hub-app/accounts-line.tsx +55 -0
- package/src/serve/hub-app/activity-st.ts +50 -53
- package/src/serve/hub-app/activity-view.tsx +10 -9
- package/src/serve/hub-app/advice-box.tsx +67 -0
- package/src/serve/hub-app/advisor-app.tsx +48 -0
- package/src/serve/hub-app/advisor-face.tsx +30 -0
- package/src/serve/hub-app/advisor-host.ts +142 -0
- package/src/serve/hub-app/advisor.html +23 -0
- package/src/serve/hub-app/advisors-st.ts +261 -0
- package/src/serve/hub-app/advisors-view.tsx +311 -0
- package/src/serve/hub-app/advisors.css +61 -0
- package/src/serve/hub-app/app-bridge.ts +53 -24
- package/src/serve/hub-app/ask-steps-st.ts +60 -0
- package/src/serve/hub-app/ask-steps.tsx +23 -0
- package/src/serve/hub-app/asked-page.ts +24 -0
- package/src/serve/hub-app/asks-page.tsx +16 -9
- package/src/serve/hub-app/asks-st.ts +1 -4
- package/src/serve/hub-app/auto-text.tsx +110 -16
- package/src/serve/hub-app/card-head.tsx +3 -2
- package/src/serve/hub-app/check-view.tsx +10 -9
- package/src/serve/hub-app/checks-svc.ts +96 -32
- package/src/serve/hub-app/clock-svc.ts +41 -9
- package/src/serve/hub-app/code-copy.ts +173 -12
- package/src/serve/hub-app/col-card.tsx +15 -21
- package/src/serve/hub-app/col-list-page.tsx +14 -8
- package/src/serve/hub-app/col-list-st.ts +18 -3
- package/src/serve/hub-app/col-tables-view.tsx +8 -44
- package/src/serve/hub-app/col-tables.ts +14 -22
- package/src/serve/hub-app/cols-svc.ts +17 -13
- package/src/serve/hub-app/columns.ts +94 -0
- package/src/serve/hub-app/comfy-svc.ts +3 -2
- package/src/serve/hub-app/comfy-view.tsx +8 -7
- package/src/serve/hub-app/commands/commands-page.tsx +4 -3
- package/src/serve/hub-app/commands/commands-st.ts +37 -27
- package/src/serve/hub-app/controls.css +80 -18
- package/src/serve/hub-app/cursor-spot.ts +81 -0
- package/src/serve/hub-app/cycle-button.tsx +2 -1
- package/src/serve/hub-app/database-st.ts +32 -27
- package/src/serve/hub-app/database-view.tsx +16 -14
- package/src/serve/hub-app/deaf.tsx +27 -0
- package/src/serve/hub-app/dock-st.ts +72 -26
- package/src/serve/hub-app/dock-view.tsx +32 -12
- package/src/serve/hub-app/editor/doc-editor-st.ts +223 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +116 -0
- package/src/serve/hub-app/editor/doc-saved.tsx +26 -0
- package/src/serve/hub-app/editor/doc-slot.ts +66 -0
- package/src/serve/hub-app/editor.css +36 -0
- package/src/serve/hub-app/emoji-names.ts +1915 -0
- package/src/serve/hub-app/emoji.ts +133 -0
- package/src/serve/hub-app/empty-section.tsx +30 -0
- package/src/serve/hub-app/entry-bar.css +1 -1
- package/src/serve/hub-app/entry-bar.tsx +11 -6
- package/src/serve/hub-app/entry-list.css +32 -0
- package/src/serve/hub-app/entry-list.tsx +123 -0
- package/src/serve/hub-app/entry-pick.ts +1 -1
- package/src/serve/hub-app/entry-sections.ts +140 -0
- package/src/serve/hub-app/event-stream-reader.ts +56 -0
- package/src/serve/hub-app/floating.tsx +217 -7
- package/src/serve/hub-app/geometry-view.tsx +3 -2
- package/src/serve/hub-app/git-st.ts +25 -19
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +15 -3
- package/src/serve/hub-app/header-bar.tsx +53 -35
- package/src/serve/hub-app/held-keys.ts +25 -0
- package/src/serve/hub-app/home-st.ts +238 -23
- package/src/serve/hub-app/home-strip.css +24 -12
- package/src/serve/hub-app/home-strip.tsx +134 -66
- package/src/serve/hub-app/home.html +12 -0
- package/src/serve/hub-app/hub-app.tsx +123 -81
- package/src/serve/hub-app/hub.css +92 -89
- package/src/serve/hub-app/icons.tsx +26 -0
- package/src/serve/hub-app/identities-st.ts +53 -78
- package/src/serve/hub-app/identities-view.tsx +34 -30
- package/src/serve/hub-app/identity-address.ts +2 -2
- package/src/serve/hub-app/in-sight.ts +10 -0
- package/src/serve/hub-app/inbox-st.ts +57 -11
- package/src/serve/hub-app/inbox-view.tsx +24 -12
- package/src/serve/hub-app/inbox.css +7 -3
- package/src/serve/hub-app/index.html +12 -0
- package/src/serve/hub-app/insights-st.ts +27 -19
- package/src/serve/hub-app/insights-view.tsx +6 -5
- package/src/serve/hub-app/instructions.css +13 -7
- package/src/serve/hub-app/kept-cols.tsx +83 -20
- package/src/serve/hub-app/kept-folds.ts +43 -0
- package/src/serve/hub-app/kept-width.tsx +76 -0
- package/src/serve/hub-app/keys.ts +122 -38
- package/src/serve/hub-app/later.tsx +1 -1
- package/src/serve/hub-app/layout-st.ts +118 -77
- package/src/serve/hub-app/lightbox-zoom.css +36 -0
- package/src/serve/hub-app/list-filter.tsx +15 -6
- package/src/serve/hub-app/list-head.tsx +29 -0
- package/src/serve/hub-app/list-row.ts +8 -0
- package/src/serve/hub-app/list-walk.ts +26 -105
- package/src/serve/hub-app/live-bar.css +12 -0
- package/src/serve/hub-app/live-socket.ts +274 -0
- package/src/serve/hub-app/live-sources.ts +189 -0
- package/src/serve/hub-app/live-svc.ts +12 -2
- package/src/serve/hub-app/machine-st.ts +105 -18
- package/src/serve/hub-app/machines-st.ts +40 -34
- package/src/serve/hub-app/machines-view.tsx +5 -5
- package/src/serve/hub-app/main-panel.css +211 -0
- package/src/serve/hub-app/main-panel.tsx +259 -0
- package/src/serve/hub-app/markdown.css +81 -4
- package/src/serve/hub-app/md.ts +155 -9
- package/src/serve/hub-app/media-svc.ts +49 -16
- package/src/serve/hub-app/media-view.tsx +13 -12
- package/src/serve/hub-app/messages/messages-page.tsx +63 -18
- package/src/serve/hub-app/messages/messages-st.ts +29 -22
- package/src/serve/hub-app/new-thread-st.ts +170 -0
- package/src/serve/hub-app/new-thread.tsx +147 -0
- package/src/serve/hub-app/objects.css +1 -0
- package/src/serve/hub-app/orchestrator-line.tsx +174 -0
- package/src/serve/hub-app/orchestrator-places.tsx +86 -0
- package/src/serve/hub-app/orchestrator.css +89 -0
- package/src/serve/hub-app/page-keys.ts +111 -69
- package/src/serve/hub-app/page-reload.ts +151 -0
- package/src/serve/hub-app/pages-frames.tsx +42 -4
- package/src/serve/hub-app/pages-svc.ts +11 -4
- package/src/serve/hub-app/palette-st.ts +200 -40
- package/src/serve/hub-app/palette-view.tsx +32 -8
- package/src/serve/hub-app/pane-boundary.tsx +13 -0
- package/src/serve/hub-app/pane-errors.ts +2 -1
- package/src/serve/hub-app/panel-head-action.tsx +39 -0
- package/src/serve/hub-app/panel-head.tsx +70 -0
- package/src/serve/hub-app/panel-repo.ts +42 -0
- package/src/serve/hub-app/panel-source.ts +195 -0
- package/src/serve/hub-app/panel-tint.css +6 -0
- package/src/serve/hub-app/panel-tint.ts +23 -0
- package/src/serve/hub-app/panel-walk.ts +107 -0
- package/src/serve/hub-app/pano.css +20 -0
- package/src/serve/hub-app/pill-row.tsx +2 -1
- package/src/serve/hub-app/place-path.ts +4 -0
- package/src/serve/hub-app/places-svc.ts +75 -0
- package/src/serve/hub-app/plan-view.tsx +4 -3
- package/src/serve/hub-app/planned-st.ts +30 -26
- package/src/serve/hub-app/planned-view.tsx +16 -9
- package/src/serve/hub-app/polled.ts +211 -0
- package/src/serve/hub-app/presence-st.ts +144 -0
- package/src/serve/hub-app/processes-view.tsx +2 -2
- package/src/serve/hub-app/project-bar.tsx +116 -0
- package/src/serve/hub-app/project-list.css +39 -149
- package/src/serve/hub-app/project-list.tsx +63 -344
- package/src/serve/hub-app/projects-svc.ts +166 -87
- package/src/serve/hub-app/push-sign.tsx +16 -0
- package/src/serve/hub-app/push-svc.ts +290 -0
- package/src/serve/hub-app/quiet-st.ts +61 -0
- package/src/serve/hub-app/rail-groups.ts +144 -0
- package/src/serve/hub-app/reach.ts +16 -0
- package/src/serve/hub-app/reader-chips.tsx +2 -1
- package/src/serve/hub-app/recordings-st.ts +171 -10
- package/src/serve/hub-app/recordings-take.ts +58 -0
- package/src/serve/hub-app/recordings-view.tsx +51 -72
- package/src/serve/hub-app/recordings.css +0 -2
- package/src/serve/hub-app/reflections-page.tsx +24 -8
- package/src/serve/hub-app/releases/releases-page.tsx +56 -22
- package/src/serve/hub-app/releases/releases-st.ts +39 -26
- package/src/serve/hub-app/releases.css +4 -0
- package/src/serve/hub-app/repo-sections.ts +143 -43
- package/src/serve/hub-app/repo-st.ts +91 -43
- package/src/serve/hub-app/review/advisor-bar.tsx +41 -0
- package/src/serve/hub-app/review/ask-proof.tsx +79 -0
- package/src/serve/hub-app/review/attach-st.ts +195 -0
- package/src/serve/hub-app/review/attach-view.tsx +261 -0
- package/src/serve/hub-app/review/box-view.ts +479 -0
- package/src/serve/hub-app/review/box-zoom.tsx +70 -0
- package/src/serve/hub-app/review/clip-st.ts +1 -1
- package/src/serve/hub-app/review/cta.tsx +11 -0
- package/src/serve/hub-app/review/diff-view.tsx +40 -37
- package/src/serve/hub-app/review/doc-body.tsx +110 -0
- package/src/serve/hub-app/review/dock.tsx +38 -23
- package/src/serve/hub-app/review/draft-body.tsx +236 -0
- package/src/serve/hub-app/review/faces.tsx +18 -0
- package/src/serve/hub-app/review/group-block.tsx +80 -49
- package/src/serve/hub-app/review/heard-line.tsx +32 -0
- package/src/serve/hub-app/review/instructions-view.tsx +58 -32
- package/src/serve/hub-app/review/item-verdict.tsx +99 -26
- package/src/serve/hub-app/review/kind-states.tsx +149 -76
- package/src/serve/hub-app/review/kind-view.tsx +22 -7
- package/src/serve/hub-app/review/kit.tsx +27 -31
- package/src/serve/hub-app/review/lane-bar.tsx +33 -31
- package/src/serve/hub-app/review/lightbox.tsx +18 -0
- package/src/serve/hub-app/review/line-window.ts +149 -0
- package/src/serve/hub-app/review/live-bar-st.ts +145 -0
- package/src/serve/hub-app/review/live-bar.tsx +127 -0
- package/src/serve/hub-app/review/live-view.tsx +105 -0
- package/src/serve/hub-app/review/mention-st.ts +85 -0
- package/src/serve/hub-app/review/mesh-view.tsx +9 -0
- package/src/serve/hub-app/review/object-card.tsx +2 -1
- package/src/serve/hub-app/review/object-panel.tsx +41 -22
- package/src/serve/hub-app/review/pano-gl.ts +145 -0
- package/src/serve/hub-app/review/pano-view.tsx +193 -0
- package/src/serve/hub-app/review/phone-top.tsx +16 -0
- package/src/serve/hub-app/review/pictures-st.ts +38 -0
- package/src/serve/hub-app/review/question-views.tsx +111 -108
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +175 -116
- package/src/serve/hub-app/review/review-host.ts +72 -0
- package/src/serve/hub-app/review/review-kit.ts +41 -24
- package/src/serve/hub-app/review/review-list.tsx +210 -61
- package/src/serve/hub-app/review/review-page.tsx +10 -21
- package/src/serve/hub-app/review/review-st.ts +307 -148
- package/src/serve/hub-app/review/review-thread.tsx +633 -224
- package/src/serve/hub-app/review/review-views.tsx +636 -570
- package/src/serve/hub-app/review/scene-view.tsx +26 -0
- package/src/serve/hub-app/review/secret-facts.ts +26 -0
- package/src/serve/hub-app/review/space3d.tsx +122 -0
- package/src/serve/hub-app/review/splat-view.tsx +9 -0
- package/src/serve/hub-app/review/superseded-runs.ts +76 -0
- package/src/serve/hub-app/review/thread-close.tsx +40 -38
- package/src/serve/hub-app/review/thread-control-st.ts +2 -1
- package/src/serve/hub-app/review/thread-st.ts +542 -158
- package/src/serve/hub-app/review/thread-views.ts +71 -0
- package/src/serve/hub-app/review/{trailer-card.tsx → trailer-body.tsx} +38 -37
- package/src/serve/hub-app/review/trailer-page.tsx +41 -41
- package/src/serve/hub-app/review/trailer-st.ts +41 -40
- package/src/serve/hub-app/review/trailer-timeline.tsx +32 -27
- package/src/serve/hub-app/review/trailer-voices.tsx +32 -30
- package/src/serve/hub-app/review.css +398 -169
- package/src/serve/hub-app/row-acts.tsx +126 -0
- package/src/serve/hub-app/row-face.tsx +29 -0
- package/src/serve/hub-app/running-rows.tsx +142 -0
- package/src/serve/hub-app/running-st.ts +110 -0
- package/src/serve/hub-app/search-st.ts +138 -0
- package/src/serve/hub-app/search-view.tsx +93 -0
- package/src/serve/hub-app/secrets-page.tsx +290 -0
- package/src/serve/hub-app/secrets-st.ts +181 -0
- package/src/serve/hub-app/secrets.css +65 -0
- package/src/serve/hub-app/section-head.tsx +6 -4
- package/src/serve/hub-app/session-chips.tsx +55 -0
- package/src/serve/hub-app/shell-rows.ts +126 -0
- package/src/serve/hub-app/shell.ts +56 -0
- package/src/serve/hub-app/site/site-part.tsx +6 -5
- package/src/serve/hub-app/site/site-st.ts +18 -29
- package/src/serve/hub-app/site.css +0 -1
- package/src/serve/hub-app/social/calendar.tsx +7 -6
- package/src/serve/hub-app/social/comms-page.tsx +41 -35
- package/src/serve/hub-app/social/group-editor.tsx +45 -0
- package/src/serve/hub-app/social/kit.tsx +19 -57
- package/src/serve/hub-app/social/next-release.tsx +5 -4
- package/src/serve/hub-app/social/post-card.tsx +35 -70
- package/src/serve/hub-app/social/post-page.tsx +2 -1
- package/src/serve/hub-app/social/problems.tsx +8 -6
- package/src/serve/hub-app/social/social-page.tsx +32 -30
- package/src/serve/hub-app/social/social-st.ts +35 -86
- package/src/serve/hub-app/social/stage-popup.tsx +17 -16
- package/src/serve/hub-app/social/stage-st.ts +9 -9
- package/src/serve/hub-app/social.css +7 -13
- package/src/serve/hub-app/source-acts.ts +79 -0
- package/src/serve/hub-app/source-page.tsx +17 -0
- package/src/serve/hub-app/space-st.ts +38 -48
- package/src/serve/hub-app/space-view.tsx +10 -9
- package/src/serve/hub-app/stores/stores-page.tsx +25 -23
- package/src/serve/hub-app/stores/stores-st.ts +20 -24
- package/src/serve/hub-app/stores.css +1 -1
- package/src/serve/hub-app/terminal-history-st.ts +112 -0
- package/src/serve/hub-app/terminal-input.ts +12 -0
- package/src/serve/hub-app/terminal-keys.ts +79 -0
- package/src/serve/hub-app/terminal-lib.ts +110 -0
- package/src/serve/hub-app/terminal-links.ts +55 -0
- package/src/serve/hub-app/terminal-list-st.ts +304 -0
- package/src/serve/hub-app/terminal-log-st.ts +242 -0
- package/src/serve/hub-app/terminal-out.ts +135 -0
- package/src/serve/hub-app/terminal-pages.tsx +115 -0
- package/src/serve/hub-app/terminal-panel.tsx +91 -0
- package/src/serve/hub-app/terminal-sources.tsx +335 -0
- package/src/serve/hub-app/terminal-st.ts +696 -0
- package/src/serve/hub-app/terminal-stream.ts +233 -0
- package/src/serve/hub-app/terminal-tab.tsx +64 -0
- package/src/serve/hub-app/terminal-widths.ts +30 -0
- package/src/serve/hub-app/terminal.css +61 -0
- package/src/serve/hub-app/test-view.tsx +5 -3
- package/src/serve/hub-app/tests-svc.ts +3 -2
- package/src/serve/hub-app/tests-view.tsx +16 -15
- package/src/serve/hub-app/theme-st.ts +6 -9
- package/src/serve/hub-app/thread-row.tsx +68 -25
- package/src/serve/hub-app/time-ago.tsx +41 -17
- package/src/serve/hub-app/time-st.ts +43 -27
- package/src/serve/hub-app/time-view.tsx +4 -3
- package/src/serve/hub-app/time.css +1 -1
- package/src/serve/hub-app/timeline-chart.tsx +5 -4
- package/src/serve/hub-app/timeline-view.tsx +10 -9
- package/src/serve/hub-app/tips.ts +247 -0
- package/src/serve/hub-app/tree-build.ts +42 -10
- package/src/serve/hub-app/tree-svc.ts +168 -135
- package/src/serve/hub-app/unit-icons.ts +26 -0
- package/src/serve/hub-app/url-address.ts +154 -0
- package/src/serve/hub-app/url-faces.ts +88 -0
- package/src/serve/hub-app/url-forms.tsx +183 -0
- package/src/serve/hub-app/urls-svc.ts +172 -9
- package/src/serve/hub-app/urls-view.tsx +56 -20
- package/src/serve/hub-app/urls.css +26 -0
- package/src/serve/hub-app/vault-st.ts +32 -27
- package/src/serve/hub-app/vault-view.tsx +56 -4
- package/src/serve/hub-app/vault.css +2 -0
- package/src/serve/hub-app/veille/veille-page.tsx +38 -37
- package/src/serve/hub-app/veille/veille-st.ts +60 -50
- package/src/serve/hub-app/view-layout.css +90 -0
- package/src/serve/hub-app/waiting-svc.ts +2 -1
- package/src/serve/hub-app/when-view.tsx +5 -4
- package/src/serve/hub-app/wiki-st.ts +3 -2
- package/src/serve/hub-app/wikis-view.tsx +24 -20
- package/src/serve/hub-app/words.tsx +22 -0
- package/src/serve/hub-collections.ts +105 -0
- package/src/serve/hub-runtime.ts +68 -89
- package/src/serve/live-hop.ts +102 -0
- package/src/serve/orchestrator-host.ts +58 -0
- package/src/serve/other-repos.ts +1 -1
- package/src/serve/page-live.ts +147 -0
- package/src/serve/project-gutter-route.ts +116 -42
- package/src/serve/read-thread.ts +76 -0
- package/src/serve/read-worker.ts +58 -0
- package/src/serve/run-serve.ts +11 -7
- package/src/serve/runs-stamp.ts +33 -0
- package/src/serve/secrets-read.ts +156 -0
- package/src/serve/serve-hub.ts +168 -50
- package/src/serve/terminal-claudes.ts +185 -0
- package/src/serve/terminal-guard.ts +55 -0
- package/src/serve/terminal-host.ts +517 -0
- package/src/serve/terminal-record.ts +104 -0
- package/src/serve/terminal-route.ts +539 -0
- package/src/serve/terminal-shells.ts +3 -0
- package/src/serve/terminal-watch.ts +102 -0
- package/src/shipkit-files.ts +9 -4
- package/src/shipkit.ts +8 -8
- package/src/shot/client.ts +27 -16
- package/src/shot/dom-clip.ts +30 -5
- package/src/shot/film-box.ts +23 -8
- package/src/shot/serve-shot.ts +16 -5
- package/src/shot/shooter.ts +70 -24
- package/src/shot/shot-ask.ts +12 -6
- package/src/shot/shot-guard.ts +53 -0
- package/src/shot/shot-theme.ts +59 -0
- package/src/shot/still-file.ts +60 -0
- package/src/site/desk.ts +4 -3
- package/src/social/compose.ts +13 -7
- package/src/social/cover.ts +4 -3
- package/src/social/desk-index.ts +2 -2
- package/src/social/draft-doc.ts +88 -0
- package/src/social/draft-versions.ts +80 -0
- package/src/social/drafts.ts +22 -4
- package/src/social/fit.ts +4 -3
- package/src/social/house.ts +1 -1
- package/src/social/import-drafts.ts +1 -1
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +21 -13
- package/src/social/media-facts.ts +1 -19
- package/src/social/media-kind.ts +2 -2
- package/src/social/media-limit.ts +3 -18
- package/src/social/no-account.ts +38 -0
- package/src/social/post-sources.ts +4 -4
- package/src/social/post-text.ts +33 -13
- package/src/social/posts.ts +73 -18
- package/src/social/presence.ts +10 -8
- package/src/social/release-stage.ts +22 -22
- package/src/social/routes.ts +14 -32
- package/src/social/stage.ts +3 -3
- package/src/social/stats.ts +3 -4
- package/src/social/strip.ts +4 -6
- package/src/social/text.ts +2 -1
- package/src/social/{card-drafts.ts → thread-drafts.ts} +3 -3
- package/src/social/unit.ts +12 -3
- package/src/social/writes.ts +3 -6
- package/src/start-repo.ts +33 -13
- package/src/stores/desk.ts +1 -1
- package/src/suite/core-counters.ts +31 -3
- package/src/suite/judge-suites.ts +69 -47
- package/src/suite/select.ts +1 -27
- package/src/suite/suite-cli.ts +18 -8
- package/src/suite/suite-cpu-preload.ts +10 -6
- package/src/suite/test-units.ts +6 -2
- package/src/trace/tracer.ts +4 -5
- package/src/trailer/build.ts +30 -15
- package/src/trailer/ffmpeg.ts +90 -31
- package/src/trailer/fonts.ts +5 -6
- package/src/trailer/footage.ts +9 -3
- package/src/trailer/grammar.ts +2 -1
- package/src/trailer/graph.ts +12 -10
- package/src/trailer/load-unit.ts +1 -1
- package/src/trailer/passage.ts +4 -3
- package/src/trailer/prune.ts +4 -4
- package/src/trailer/score/sound.ts +3 -3
- package/src/trailer/shot-plan.ts +5 -5
- package/src/trailer/shot-state.ts +25 -31
- package/src/trailer/sound/eleven.ts +3 -1
- package/src/trailer/sound/gen.ts +3 -3
- package/src/trailer/sound/run.ts +76 -64
- package/src/trailer/sound/takes.ts +0 -3
- package/src/trailer/take-fault.ts +41 -0
- package/src/trailer/titles.ts +17 -13
- package/src/trailer/url.ts +1 -1
- package/src/trailer/vertical-draw.ts +7 -7
- package/src/trailer/vertical.ts +3 -3
- package/src/trailer/vocab.ts +3 -4
- package/src/ts/config.ts +60 -24
- package/src/ts/cycles.ts +3 -1
- package/src/ts/imports.ts +17 -3
- package/src/ts/rename.ts +6 -7
- package/src/ts/source-graph.ts +15 -9
- package/src/ts/workspaces.ts +26 -0
- package/src/tui/build-steps-panel.ts +3 -3
- package/src/tui/checks-panel.ts +2 -2
- package/src/urls/added.ts +111 -0
- package/src/urls/frame.ts +3 -3
- package/src/urls/icons.ts +294 -0
- package/src/urls/places.ts +139 -0
- package/src/urls/routes.ts +18 -8
- package/src/urls/rows.ts +49 -16
- package/src/urls/unit.ts +57 -3
- package/src/urls/write-routes.ts +207 -0
- package/src/vault/house-keys.ts +1 -1
- package/src/vault/vault-audit.ts +2 -3
- package/src/vault/vault-config.ts +6 -2
- package/src/vault/vault-destroy.ts +2 -1
- package/src/vault/vault-import.ts +4 -11
- package/src/vault/vault-restore.ts +6 -11
- package/src/vault/vault-serve.ts +47 -11
- package/src/vault/vault-snapshot.ts +5 -14
- package/src/veille/chrome.ts +18 -3
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +6 -0
- package/src/veille/routes.ts +1 -1
- package/src/view3d/cam.ts +85 -0
- package/src/view3d/lib.ts +87 -0
- package/src/view3d/loop.ts +39 -0
- package/src/view3d/scene-cache.ts +62 -0
- package/src/view3d/viewer.ts +454 -0
- package/src/wiki/agent-paths.ts +56 -0
- package/src/wiki/run-wiki.ts +4 -1
- package/src/wiki/serve-graph.ts +2 -3
- package/src/core/run-fix.ts +0 -120
- package/src/home/hmr-keep.ts +0 -134
- package/src/serve/hub-app/review/draft-card.tsx +0 -163
- package/src/serve/hub-app/review/note-place.ts +0 -31
- package/src/serve/hub-app/side-lists.ts +0 -72
- package/src/serve/hub-app/sidebar.tsx +0 -62
- package/src/serve/hub-app/tree-row.tsx +0 -100
- /package/src/{serve → http}/hub-port.ts +0 -0
- /package/src/{serve → http}/secret-gate.ts +0 -0
package/src/cli/cmd_Review.ts
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
// sk thread: an agent shows the owner something as
|
|
1
|
+
// sk thread: an agent shows the owner something as a version in its thread and reads his answer; a dispatcher routes
|
|
2
2
|
// what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki tools/shipkit/threads.md).
|
|
3
3
|
// Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
4
|
import { Command, Option } from 'clipanion'
|
|
5
5
|
import type { AnswerKind } from '../review/model.ts'
|
|
6
|
+
import { holdsThread, laneOfCaller, maySee } from '../review/parties.ts'
|
|
7
|
+
import { realGit } from '../core/git.ts'
|
|
8
|
+
import { ageWords } from '../core/words.ts'
|
|
9
|
+
import { hereAt, hereStore, noRepo, openHere, partiesFor, pull, recordedStores, refused, reviewRoot, type Here } from './review-here.ts'
|
|
6
10
|
|
|
7
11
|
const DETAILS = `threads, the one exchange with the owner (wiki tools/shipkit/threads.md): one thread per subject, found by its address <kind>:<key>, for its whole life. sk thread post <address> sends a version into it, linked by the tool; ask, propose, reply and update write in it, and start it when no thread owns the address. He answers in the hub's threads page; you read his answer with watch, inbox or the inbox hook, then mark it seen. What he, a player or a rule raises is an item of the same store with its own state, closed with sk thread fixed. The store: .shipkit/review/ of each repo, or the daemon's rows (sk thread move). SK_AGENT names your lane.`
|
|
8
12
|
|
|
9
13
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
10
|
-
type Unit = import('../review/unit.ts').ReviewUnit
|
|
11
|
-
type Say = import('../review/format.ts').Say
|
|
12
|
-
|
|
13
|
-
/** what a verb works on: the store, its repo's unit (null when the verb reads no unit, or the repo has none), and how the unit's lines print */
|
|
14
|
-
interface Here {
|
|
15
|
-
dir: string
|
|
16
|
-
unit: Unit | null
|
|
17
|
-
say: Say
|
|
18
|
-
out: (l: string) => void
|
|
19
|
-
err: (l: string) => void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** the shipkit repo the cwd stands in: only its store reaches a hub, so anywhere else a card is refused before a
|
|
23
|
-
* stray .shipkit/review/ is made where nobody looks */
|
|
24
|
-
async function reviewRoot(cwd: string): Promise<string | null> {
|
|
25
|
-
const { findRepoRoot } = await import('../ts/config.ts')
|
|
26
|
-
const { existsSync } = await import('node:fs')
|
|
27
|
-
const { join } = await import('node:path')
|
|
28
|
-
const root = findRepoRoot(cwd)
|
|
29
|
-
return existsSync(join(root, 'repo.config.ts')) ? root : null
|
|
30
|
-
}
|
|
31
14
|
|
|
32
15
|
/** the store of the repo this runs in, its unit read when the verb needs it, and the body; a refusal is one FAIL line with its reason, exit 1 */
|
|
33
16
|
async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o: { unit?: boolean } = {}): Promise<number> {
|
|
@@ -38,7 +21,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
38
21
|
const argv = process.argv.slice(2)
|
|
39
22
|
if (argv[0] === 'review' && !argv.includes('--hook') && !argv.includes('--json')) err(`sk review is now sk thread: sk thread ${argv.slice(1).map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')}`)
|
|
40
23
|
const root = await reviewRoot(process.cwd())
|
|
41
|
-
if (root == null) throw new Error(
|
|
24
|
+
if (root == null) throw new Error(noRepo(process.cwd()))
|
|
42
25
|
// a repo where an agent writes in a thread needs a next session that hears it; the gate's repair wires the hook
|
|
43
26
|
if (WRITING_VERBS.has(argv[1] ?? '')) {
|
|
44
27
|
const { inboxHookLacks } = await import('../review/inbox-read.ts')
|
|
@@ -49,15 +32,9 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
49
32
|
const { storeDir } = await import('../review/store.ts')
|
|
50
33
|
return await body({ dir: storeDir(root), unit: null, say: { spec: (await import('../review/model.ts')).NO_SPEC, more: () => [] }, out, err })
|
|
51
34
|
}
|
|
52
|
-
|
|
53
|
-
const { specOf } = await import('../review/store.ts')
|
|
54
|
-
const { dir, unit } = await openReview(root)
|
|
55
|
-
return await body({ dir, unit, say: { spec: specOf(dir), more: (x) => factLines(unit, x) }, out, err })
|
|
35
|
+
return await body(await openHere(root, out, err))
|
|
56
36
|
} catch (e) {
|
|
57
|
-
|
|
58
|
-
// a walk of the cards' database runs: run it again once it ends
|
|
59
|
-
const { isStoreRefused, WAIT_EXIT } = await import('../core/machine-db.ts')
|
|
60
|
-
return isStoreRefused(e) && e.wait ? WAIT_EXIT : 1
|
|
37
|
+
return refused(e, err)
|
|
61
38
|
}
|
|
62
39
|
}
|
|
63
40
|
|
|
@@ -66,9 +43,9 @@ const isHelp = (a: string): boolean => a === '--help' || a === '-h'
|
|
|
66
43
|
/** the verbs that write an agent's act in a thread */
|
|
67
44
|
const WRITING_VERBS = new Set(['post', 'add', 'add-view', 'ask', 'propose', 'reply', 'update', 'take', 'assign', 'working', 'fixed', 'done', 'attach', 'ready'])
|
|
68
45
|
|
|
69
|
-
/** the agent that acts
|
|
46
|
+
/** the agent that acts (review/parties.ts laneOfCaller); `need` refuses an unnamed one */
|
|
70
47
|
function actor(as: string | undefined, need: boolean, verb: string): string {
|
|
71
|
-
const n = as
|
|
48
|
+
const n = callerLane(as)
|
|
72
49
|
if (n === 'owner') throw new Error('the owner acts from the hub, not from here')
|
|
73
50
|
if (n) return n
|
|
74
51
|
if (need) throw new Error(`${verb} needs --as <name> (or SK_AGENT)`)
|
|
@@ -77,15 +54,27 @@ function actor(as: string | undefined, need: boolean, verb: string): string {
|
|
|
77
54
|
|
|
78
55
|
/** an item id, a player report's ref (`live#3`), or an address (`trailer:comfy-ts/main`, the newest version of the
|
|
79
56
|
* thread that owns it, or the one above it) to its item id */
|
|
80
|
-
async function idOf(dir: string, ref: string): Promise<string> {
|
|
57
|
+
async function idOf(dir: string, ref: string, one?: { verb: string; objects?: boolean }): Promise<string> {
|
|
81
58
|
const { itemOfRef, readAll, specOf } = await import('../review/store.ts')
|
|
82
59
|
const { addressOrThrow, ID_RE } = await import('../review/model.ts')
|
|
60
|
+
const { THREAD_ID_RE, threadIdOf, threadOfAddress, threadsOf, threadsOfId } = await import('../review/threads.ts')
|
|
61
|
+
// a thread named where one item is needed: refused with the ids it could mean, never its newest version guessed
|
|
62
|
+
const itemOf = async (t: import('../review/threads.ts').Thread): Promise<string> => {
|
|
63
|
+
if (!one) return t.head.item.id
|
|
64
|
+
const { itemIdsOf } = await import('../review/format.ts')
|
|
65
|
+
throw new Error(`${ref === threadIdOf(t) ? `${ref} is a thread` : `${ref} is the thread ${threadIdOf(t)}`}: ${one.verb} takes one item of it, by its id: ${itemIdsOf(t, one.objects).join('; ')}`)
|
|
66
|
+
}
|
|
67
|
+
if (THREAD_ID_RE.test(ref)) {
|
|
68
|
+
const ts = threadsOfId(ref, threadsOf(readAll(dir).items, specOf(dir)))
|
|
69
|
+
if (ts.length === 0) throw new Error(`no thread ${ref} (sk thread --all lists them)`)
|
|
70
|
+
if (ts.length > 1) throw new Error(`${ref} is the first version of ${ts.length} threads (two versions superseded it): name one by its newest version, ${ts.map((t) => t.head.item.id).join(' or ')}`)
|
|
71
|
+
return itemOf(ts[0]!)
|
|
72
|
+
}
|
|
83
73
|
if (!ID_RE.test(ref) && ref.includes(':') && !/^\w+#\d+$/.test(ref)) {
|
|
84
74
|
const a = addressOrThrow(ref)
|
|
85
|
-
const { threadOfAddress } = await import('../review/threads.ts')
|
|
86
75
|
const t = threadOfAddress(a, readAll(dir).items, specOf(dir), { up: true })
|
|
87
76
|
if (!t) throw new Error(`no thread owns ${a}: sk thread post ${a} --title "…" --what "…" starts it`)
|
|
88
|
-
return t
|
|
77
|
+
return itemOf(t)
|
|
89
78
|
}
|
|
90
79
|
const x = itemOfRef(dir, ref)
|
|
91
80
|
if (!x) throw new Error(`no item ${ref}`)
|
|
@@ -119,31 +108,27 @@ async function idOrOpen(h: Here, ref: string, title: string, as: string | undefi
|
|
|
119
108
|
const t = threadOfAddress(a, readAll(h.dir).items, specOf(h.dir), { up: true })
|
|
120
109
|
if (t) return t.head.item.id
|
|
121
110
|
await declaredOrThrow(h, a)
|
|
122
|
-
const lane =
|
|
111
|
+
const lane = callerLane(as)
|
|
123
112
|
const x = await openThread(h.dir, a, { title, ...(lane ? { lane } : {}) })
|
|
124
113
|
h.err(`${a}: no thread owned it, this one starts it: ${x.id}`)
|
|
125
114
|
return x.id
|
|
126
115
|
}
|
|
127
116
|
|
|
117
|
+
/** a reply by address answers his newest open note of the thread (review/threads.ts replyTargetOf); an id stays exact */
|
|
118
|
+
async function replyTarget(h: Here, ref: string, id: string): Promise<string> {
|
|
119
|
+
const { ID_RE } = await import('../review/model.ts')
|
|
120
|
+
if (ID_RE.test(ref) || !ref.includes(':') || /^\w+#\d+$/.test(ref)) return id
|
|
121
|
+
const { readAll } = await import('../review/store.ts')
|
|
122
|
+
const { replyTargetOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
123
|
+
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
124
|
+
return t ? replyTargetOf(t) : id
|
|
125
|
+
}
|
|
126
|
+
|
|
128
127
|
/** why a version that names no subject is refused: a thread is found by its address, so a version without one would
|
|
129
128
|
* start a thread nobody finds again */
|
|
130
129
|
const NO_ADDRESS =
|
|
131
130
|
'a version names the subject he judges, so it goes into that subject\'s one thread: sk thread post <kind>:<key> --title "…" --what "…" <media> (screen:<screen>, asset:<asset>, page:<page>, or a kind this repo\'s review unit declares; --trailer and --draft name their own). Page: wiki tools/shipkit/threads.md, The model'
|
|
132
131
|
|
|
133
|
-
/** the sources pulled before a read: a line per source down, said once a process */
|
|
134
|
-
const downSaid = new Set<string>()
|
|
135
|
-
async function pull(h: Here): Promise<void> {
|
|
136
|
-
if (!h.unit?.sources?.length) return
|
|
137
|
-
const { pullSources } = await import('../review/project.ts')
|
|
138
|
-
const now = new Set<string>()
|
|
139
|
-
const got = await pullSources(h.dir, h.unit, (l) => {
|
|
140
|
-
now.add(l)
|
|
141
|
-
if (!downSaid.has(l)) h.err(l)
|
|
142
|
-
})
|
|
143
|
-
downSaid.clear()
|
|
144
|
-
for (const l of now) downSaid.add(l)
|
|
145
|
-
if (got.length > 0) h.err(`review: ${got.length} new items pulled`)
|
|
146
|
-
}
|
|
147
132
|
|
|
148
133
|
/** a gallery tile as given: `<label>=<file>`, or a file labelled by its name */
|
|
149
134
|
/** one tile of `--gallery`: `[<row>/]<label>=[<before>,]<after>`, or a bare file named by its own name */
|
|
@@ -197,7 +182,7 @@ export function takeViews(args: readonly string[]): { views: ViewInput[]; rest:
|
|
|
197
182
|
return { views, rest }
|
|
198
183
|
}
|
|
199
184
|
|
|
200
|
-
const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
|
|
185
|
+
const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --before <a.png> --after <b.png> | --video <clip> | --audio <sound> | --pano <360.png> | --splat <a.ply> [--image <poster.png>] | --mesh <a.glb> [--image <poster.png>] | --gallery <a.png> … [--label "<label>"] [--note "<text>"] [--keep]'
|
|
201
186
|
const MEDIA_FILE = /\.(png|jpe?g|webp|gif|mp4|webm|mov|wav|mp3|flac|ogg|opus|m4a)$/i
|
|
202
187
|
|
|
203
188
|
/** one `--option` of a question: words, a media file, `<label>=<file>` or `<label>=<before>,<after>` (a gallery tile's
|
|
@@ -211,6 +196,31 @@ export function askOption(a: string): { label: string; files?: string[] } {
|
|
|
211
196
|
}
|
|
212
197
|
const quoted = (a: string): string => (/^[\w./=,@:+-]+$/.test(a) ? a : `"${a.replace(/"/g, '\\"')}"`)
|
|
213
198
|
|
|
199
|
+
/** a splat's or a mesh's view with its poster: the one given (--image), else the 3D file shot at rest now through the
|
|
200
|
+
* warm browser (view3d/lib.ts); `drop` deletes a shot once the store copied it. Any other view as it is */
|
|
201
|
+
async function withPoster(view: ViewInput): Promise<{ view: ViewInput; drop: () => void }> {
|
|
202
|
+
const space = view.splat ?? view.mesh
|
|
203
|
+
if (space === undefined || view.image !== undefined) return { view, drop: () => {} }
|
|
204
|
+
const { mkdtempSync, rmSync } = await import('node:fs')
|
|
205
|
+
const { tmpdir } = await import('node:os')
|
|
206
|
+
const { join } = await import('node:path')
|
|
207
|
+
const { existsSync } = await import('node:fs')
|
|
208
|
+
const kind = view.splat !== undefined ? 'splat' : 'mesh'
|
|
209
|
+
if (!existsSync(space)) throw new Error(`--${kind} ${space}: no such file`)
|
|
210
|
+
const { SPACE_EXT } = await import('../review/model.ts')
|
|
211
|
+
if (!SPACE_EXT[kind].test(space)) throw new Error(`--${kind} ${space}: ${kind === 'splat' ? 'a Gaussian splat, .ply or .spz' : 'a .glb mesh'}`)
|
|
212
|
+
const tmp = mkdtempSync(join(tmpdir(), 'view3d-poster-'))
|
|
213
|
+
const drop = (): void => rmSync(tmp, { recursive: true, force: true })
|
|
214
|
+
try {
|
|
215
|
+
const out = join(tmp, 'poster.png')
|
|
216
|
+
await (await import('../view3d/lib.ts')).shootPoster(kind, space, out)
|
|
217
|
+
return { view: { ...view, image: out }, drop }
|
|
218
|
+
} catch (e) {
|
|
219
|
+
drop()
|
|
220
|
+
throw new Error(`--${kind} ${space}: its poster could not be shot (${(e as Error).message}); give one with --image <poster.png>`)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
214
224
|
/** add-view's args: the positional form, or the view flags of add; a flag is never a label, `own` are the repo unit's flags */
|
|
215
225
|
export async function addViewArgs(args: readonly string[], own: readonly string[]): Promise<{ id: string; view: ViewInput; repoFlags: Record<string, string[]> }> {
|
|
216
226
|
const one: Record<string, string> = {}
|
|
@@ -229,7 +239,7 @@ export async function addViewArgs(args: readonly string[], own: readonly string[
|
|
|
229
239
|
continue
|
|
230
240
|
}
|
|
231
241
|
if (name === 'what') throw new Error(`--what: a view takes no --what, a line on it is --note "<text>"; ${ADD_VIEW_USAGE}`)
|
|
232
|
-
if (!['label', 'note', 'image', 'video', 'audio', 'before', 'after', ...own].includes(name)) throw new Error(`${a}: add-view takes no such flag; ${ADD_VIEW_USAGE}`)
|
|
242
|
+
if (!['label', 'note', 'image', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', ...own].includes(name)) throw new Error(`${a}: add-view takes no such flag; ${ADD_VIEW_USAGE}`)
|
|
233
243
|
const v = args[i + 1]
|
|
234
244
|
if (v === undefined || v.startsWith('--')) throw new Error(`${a} needs its value; ${ADD_VIEW_USAGE}`)
|
|
235
245
|
i++
|
|
@@ -242,18 +252,23 @@ export async function addViewArgs(args: readonly string[], own: readonly string[
|
|
|
242
252
|
let files = rest
|
|
243
253
|
if (label === undefined && rest[0] !== undefined && !MEDIA_FILE.test(rest[0])) [label, ...files] = rest
|
|
244
254
|
if (label === undefined && gallery?.[0] !== undefined && !MEDIA_FILE.test(gallery[0]) && !gallery[0].includes('=')) label = gallery.shift()
|
|
245
|
-
const
|
|
255
|
+
const space = one.splat ?? one.mesh
|
|
256
|
+
const given = [files.length > 0 ? 'files' : '', one.image && space === undefined ? '--image' : '', one.splat ? '--splat' : '', one.mesh ? '--mesh' : '', one.video ? '--video' : '', one.audio ? '--audio' : '', one.pano ? '--pano' : '', one.before || one.after ? '--before --after' : '', gallery ? '--gallery' : ''].filter((x) => x !== '')
|
|
246
257
|
if (given.length !== 1) throw new Error(`${given.length === 0 ? 'no media' : `one media a view, not ${given.join(' and ')}`}; ${ADD_VIEW_USAGE}`)
|
|
247
258
|
if (!label?.trim()) throw new Error(`the view needs its label: sk thread ${['add-view', id, '"<label>"', ...args.filter((a) => a !== id).map(quoted)].join(' ')}`)
|
|
248
259
|
if ((one.before === undefined) !== (one.after === undefined)) throw new Error(`--before and --after go together; ${ADD_VIEW_USAGE}`)
|
|
249
260
|
if (gallery?.length === 0) throw new Error(`--gallery needs its images; ${ADD_VIEW_USAGE}`)
|
|
250
|
-
const view: ViewInput =
|
|
261
|
+
const view: ViewInput = space !== undefined
|
|
262
|
+
? { label, ...(one.splat ? { splat: one.splat } : { mesh: space }), ...(one.image ? { image: one.image } : {}) }
|
|
263
|
+
: one.image
|
|
251
264
|
? { label, image: one.image }
|
|
252
265
|
: one.video
|
|
253
266
|
? { label, video: one.video }
|
|
254
267
|
: one.audio
|
|
255
268
|
? { label, audio: one.audio }
|
|
256
|
-
: one.
|
|
269
|
+
: one.pano
|
|
270
|
+
? { label, pano: one.pano }
|
|
271
|
+
: one.before && one.after
|
|
257
272
|
? { label, before: one.before, after: one.after }
|
|
258
273
|
: gallery
|
|
259
274
|
? { label, gallery: gallery.map(tileOf) }
|
|
@@ -291,15 +306,22 @@ function flagsOf(args: readonly string[], values: readonly string[], repeat: rea
|
|
|
291
306
|
|
|
292
307
|
const ADD_FLAGS = `flags:
|
|
293
308
|
--title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same)
|
|
294
|
-
--what "<what>" what
|
|
309
|
+
--what "<what>" what he sees now, one or two short lines: never the mechanics (why no before, an internal rename, how a count is computed)
|
|
295
310
|
--post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
|
|
296
311
|
--changelog "<category>: <line>" its change in the release being filled: on his approval it lands in .shipkit/releases/next.md with the version's after picture (the repo's guard reads it)
|
|
297
312
|
--rating <safe|mild|explicit> with --changelog: what its media shows at full size, the rating its picture lands with; unset, unrated (reads explicit: no SFW venue shows it)
|
|
298
313
|
--verdict words with no media wait for the owner's verdict like a version (a version asks it always)
|
|
314
|
+
--md <file.md | -> a markdown document as the subject (a table, a list, numbers; light html: <sub> <kbd> <mark>, <span class="green|amber|red|blue|dim">): words and tables go this way, never as a picture of text; the next version shows a text diff
|
|
315
|
+
--html <file.html | -> an html card as the subject, in a sandboxed frame (its own scripts and styles, no network but the hub's media), for when markdown is not enough
|
|
299
316
|
--image <a.png> the subject; a clip (webm, mp4) goes anywhere an image goes
|
|
300
317
|
--video <clip.mp4> a clip
|
|
301
318
|
--audio <sound.wav> a sound: a waveform and a player (wav, mp3, flac, ogg, opus, m4a)
|
|
319
|
+
--pano <360.png> an equirectangular panorama (2:1): he drags to look around, wheel or pinch to zoom
|
|
320
|
+
--splat <a.ply | a.spz> a Gaussian splat he orbits and flies through, in the lightbox only; --image <poster.png> its still in the thread, else one shot now
|
|
321
|
+
--mesh <a.glb> a mesh he walks through, in the lightbox only; --image <poster.png> its still in the thread, else one shot now
|
|
302
322
|
--before <a.png> --after <b.png> a before and after: two images, two clips of one size, or two sounds
|
|
323
|
+
on an object of a kind: its states (a json file, or a git ref its kind reads, . the working tree); a kind whose page draws it gets a still of that page shot now, or --image <a.png> as that still; a state that names its "views" gets one still a view, --image <view>=<a.png> for one (repeat it)
|
|
324
|
+
--live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url, never the hub's own
|
|
303
325
|
--label "<label>" the first view's label
|
|
304
326
|
--view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
|
|
305
327
|
--choice the older form of a question: posts sk thread ask with each --view an option, and prints that form
|
|
@@ -339,9 +361,9 @@ async function helpWithUnit(context: Ctx, usage: string, kinds: boolean): Promis
|
|
|
339
361
|
return 0
|
|
340
362
|
}
|
|
341
363
|
|
|
342
|
-
/** --trailer and its flags as a
|
|
364
|
+
/** --trailer and its flags as a version: its cut, pinned renders and shots, the image it keeps (a still cut into a temp
|
|
343
365
|
* folder `drop` removes); null without --trailer, which then refuses its own flags */
|
|
344
|
-
export async function trailerOfFlags(o: Record<string, string>, others: boolean): Promise<{
|
|
366
|
+
export async function trailerOfFlags(o: Record<string, string>, others: boolean): Promise<{ item: import('../review/model.ts').ItemTrailer; image: string; drop: () => void } | null> {
|
|
345
367
|
if (o.trailer === undefined) {
|
|
346
368
|
for (const k of ['version', 'shots']) if (o[k] !== undefined) throw new Error(`--${k}: only with --trailer <cut.trailer>`)
|
|
347
369
|
return null
|
|
@@ -352,13 +374,13 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
|
|
|
352
374
|
const { tmpdir } = await import('node:os')
|
|
353
375
|
const { join } = await import('node:path')
|
|
354
376
|
const { findRepoRoot } = await import('../ts/config.ts')
|
|
355
|
-
const {
|
|
356
|
-
const tmp = mkdtempSync(join(tmpdir(), 'trailer-
|
|
377
|
+
const { trailerItemOf } = await import('../review/trailer-item.ts')
|
|
378
|
+
const tmp = mkdtempSync(join(tmpdir(), 'trailer-version-'))
|
|
357
379
|
const drop = (): void => rmSync(tmp, { recursive: true, force: true })
|
|
358
380
|
try {
|
|
359
381
|
const shots = o.shots?.split(',').map((s) => s.trim()).filter((s) => s !== '')
|
|
360
382
|
const input = { file: o.trailer, ...(o.version ? { version: o.version } : {}), ...(o.before ? { before: o.before } : {}), ...(shots ? { shots } : {}) }
|
|
361
|
-
const r = await
|
|
383
|
+
const r = await trailerItemOf(findRepoRoot(process.cwd()), process.cwd(), input, join(tmp, 'still.png'))
|
|
362
384
|
return { ...r, drop }
|
|
363
385
|
} catch (e) {
|
|
364
386
|
drop()
|
|
@@ -366,14 +388,40 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
|
|
|
366
388
|
}
|
|
367
389
|
}
|
|
368
390
|
|
|
369
|
-
/** --draft as a
|
|
391
|
+
/** --draft as a version: the post draft its slug names, pinned by the hashes of its head and of each message; null without
|
|
370
392
|
* --draft. A draft that does not load clean is refused in the loader's words */
|
|
371
|
-
export async function draftOfFlags(o: Record<string, string>, others: boolean, cwd: string = process.cwd()): Promise<import('../review/model.ts').
|
|
393
|
+
export async function draftOfFlags(o: Record<string, string>, others: boolean, cwd: string = process.cwd()): Promise<import('../review/model.ts').ItemDraft | null> {
|
|
372
394
|
if (o.draft === undefined) return null
|
|
373
395
|
const clash = ['image', 'video', 'audio', 'before', 'after', 'label', 'live', 'trailer'].filter((k) => o[k] !== undefined)
|
|
374
396
|
if (clash.length > 0 || others) throw new Error(`--draft: the version shows the draft itself; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery or --choice'} beside it`)
|
|
375
|
-
const [{ findRepoRoot }, { openDesk }, {
|
|
376
|
-
return
|
|
397
|
+
const [{ findRepoRoot }, { openDesk }, { draftItemOf }] = await Promise.all([import('../ts/config.ts'), import('../social/open.ts'), import('../review/draft-item.ts')])
|
|
398
|
+
return draftItemOf((await openDesk(findRepoRoot(cwd))).desk, o.draft, cwd).item
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** --md <file | -> or --html <file | ->: the version's subject is that document, its text read now (`-` stdin); null
|
|
402
|
+
* without either. Words, numbers and tables go this way, never as a picture of text */
|
|
403
|
+
export async function docOfFlags(o: Record<string, string>, beside: { trailer: unknown; draft: unknown; states: unknown; choice: boolean; wip: boolean }, stdin: () => Promise<string> = () => new Response(Bun.stdin.stream()).text()): Promise<import('../review/model.ts').ItemDoc | null> {
|
|
404
|
+
if (o.md !== undefined && o.html !== undefined) throw new Error('--md and --html: one document a version; markdown first, --html when markdown is not enough')
|
|
405
|
+
const kind = o.md !== undefined ? 'md' : o.html !== undefined ? 'html' : null
|
|
406
|
+
if (kind === null) return null
|
|
407
|
+
const other = beside.trailer ? '--trailer' : beside.draft ? '--draft' : beside.states ? "an object's --before and --after states" : beside.choice ? '--choice' : beside.wip ? '--wip --live' : null
|
|
408
|
+
if (other !== null) throw new Error(`--${kind}: a document is the version's subject, never with ${other}`)
|
|
409
|
+
const path = o[kind]!
|
|
410
|
+
const ext = kind === 'md' ? /\.(md|markdown|txt)$/i : /\.html?$/i
|
|
411
|
+
if (path !== '-' && !ext.test(path)) throw new Error(`--${kind} ${path}: ${kind === 'md' ? 'a .md file' : 'an .html file'}, or - to read it from stdin`)
|
|
412
|
+
let text: string
|
|
413
|
+
if (path === '-') text = await stdin()
|
|
414
|
+
else {
|
|
415
|
+
const { existsSync, readFileSync } = await import('node:fs')
|
|
416
|
+
if (!existsSync(path)) throw new Error(`--${kind} ${path}: no such file`)
|
|
417
|
+
text = readFileSync(path, 'utf8')
|
|
418
|
+
}
|
|
419
|
+
if (text.includes('\0')) throw new Error(`--${kind} ${path}: not text`)
|
|
420
|
+
const { docProblem } = await import('../review/model.ts')
|
|
421
|
+
const doc = { kind, text } as const
|
|
422
|
+
const why = docProblem(doc)
|
|
423
|
+
if (why !== null) throw new Error(why)
|
|
424
|
+
return doc
|
|
377
425
|
}
|
|
378
426
|
|
|
379
427
|
export class ReviewAddCommand extends Command {
|
|
@@ -387,13 +435,17 @@ export class ReviewAddCommand extends Command {
|
|
|
387
435
|
details: `${DETAILS}\n\nsk thread post [<address> | <id>] <flags>. The address is the version's own (screen:<screen>, asset:<asset>, page:<page>, a kind of the repo's unit); --trailer and --draft name theirs, so it may be left out. An id names its thread. With no media, --title and --what are words: they start the thread, or are a reply in it. sk thread add is its older name.\n\n${ADD_FLAGS}`,
|
|
388
436
|
examples: [
|
|
389
437
|
['one image', 'sk thread post screen:menu --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
|
|
438
|
+
['a report with a table: markdown, never a picture of text', 'sk thread post page:hub/speed --title "the hub, before and after" --what "every click under 50 ms" --md report.md'],
|
|
390
439
|
['a before and after', 'sk thread post asset:lamps --title "lamps lit" --what "..." --before a.png --after b.png'],
|
|
391
440
|
['the next version: the same address, the tool links it', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
|
|
392
441
|
['a pick among three voices, yours on the second', 'sk thread post asset:narrator --choice --pick 2 --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
|
|
442
|
+
['a 360° panorama he looks around in', 'sk thread post screen:hall --title "the hall in 360" --what "..." --pano hall-360.png'],
|
|
443
|
+
['a Gaussian splat he orbits, its poster shot now', 'sk thread post asset:hall --title "the hall as a splat" --what "..." --splat hall.ply'],
|
|
393
444
|
['icons he rates one by one', 'sk thread post asset:buff-icons --title "buff icons" --what "..." --gallery "icons" vitality=a.png haste=b.png greed=c.png'],
|
|
394
445
|
['a trailer cut against its last kept version', 'sk thread post --trailer trailer/demo/main.trailer --version v4 --before v3 --title "the drop, recut" --what "..."'],
|
|
395
446
|
['a post draft, each place answered on its own', 'sk thread post --draft 20261119-174922-trailer --title "the trailer post" --what "..."'],
|
|
396
|
-
['
|
|
447
|
+
['a running page, framed in the thread', 'sk thread post page:settings --title "the settings page" --what "..." --live "settings" http://localhost:5173/settings'],
|
|
448
|
+
['words, no picture', 'sk thread post messages:tui/u1 --title "the hook line" --what "the hook line, shorter: it names the gain first"'],
|
|
397
449
|
],
|
|
398
450
|
})
|
|
399
451
|
args = Option.Proxy()
|
|
@@ -405,16 +457,22 @@ export class ReviewAddCommand extends Command {
|
|
|
405
457
|
return run(this.context, async (h) => {
|
|
406
458
|
const { addItem, postUpdate, agentName } = await import('../review/store.ts')
|
|
407
459
|
if (this.path[1] === 'add') h.err('sk thread add is now sk thread post [<address>]: the same flags')
|
|
408
|
-
// `--wip "<what is still wrong>"`: a
|
|
460
|
+
// `--wip "<what is still wrong>"`: a version sent in work, its first update still broken; a bare --wip goes with --live
|
|
409
461
|
const w = this.args.indexOf('--wip')
|
|
410
462
|
const wipLine = w >= 0 && this.args[w + 1] !== undefined && !this.args[w + 1]!.startsWith('--') ? this.args[w + 1] : undefined
|
|
411
|
-
const {
|
|
463
|
+
const { takeLives } = await import('../review/live-post.ts')
|
|
464
|
+
const { lives, rest: unlived } = takeLives(wipLine === undefined ? this.args : [...this.args.slice(0, w + 1), ...this.args.slice(w + 2)])
|
|
465
|
+
const { views, rest } = takeViews(unlived)
|
|
412
466
|
// the repo's own flags: the subject kind's (--where), and the unit's for any kind (--mark), each repeatable
|
|
413
467
|
const kindName = rest[rest.indexOf('--subject') + 1]
|
|
414
468
|
const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
|
|
415
469
|
const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
|
|
416
|
-
const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', '
|
|
470
|
+
const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'choice', 'keep', 'verdict'])
|
|
417
471
|
const o = f.one
|
|
472
|
+
// --image repeats only as the stills of a kind's page, one a view (<view>=<a.png>)
|
|
473
|
+
const images = f.many.image ?? []
|
|
474
|
+
if (images.length === 1) o.image = images[0]!
|
|
475
|
+
if (images.length > 1 && f.on.has('choice')) throw new Error('--choice: one --image, the first option; the others are --view')
|
|
418
476
|
// the first word names the thread: an address (the version's own), or an id (its thread)
|
|
419
477
|
const { addressOrThrow, canonicalAddress, ID_RE } = await import('../review/model.ts')
|
|
420
478
|
const first = f.positionals[0]
|
|
@@ -444,9 +502,17 @@ export class ReviewAddCommand extends Command {
|
|
|
444
502
|
if (lone !== undefined && more.length === 0 && o.title === undefined && !MEDIA_FILE.test(lone)) o.title = lone
|
|
445
503
|
else if (lone !== undefined) throw new Error(`unexpected ${f.positionals.map(quoted).join(' ')}: the title is --title "<title>", the subject --image <a.png> (sk thread post --help)`)
|
|
446
504
|
if (f.on.has('choice') && f.on.has('verdict')) throw new Error("--choice --verdict: a choice is a question, its pick is the owner's answer; post it without --verdict")
|
|
505
|
+
if (lives.length > 0 && (f.on.has('choice') || o.trailer !== undefined || o.draft !== undefined || o.live !== undefined))
|
|
506
|
+
throw new Error(`--live <url>: a view of a running page; never with ${f.on.has('choice') ? '--choice (ask, then post)' : o.trailer !== undefined ? '--trailer' : o.draft !== undefined ? '--draft' : '--wip --live <name>'}`)
|
|
447
507
|
if (f.on.has('choice')) return choiceAsQuestion(h, o, views, f.many)
|
|
448
508
|
const states = await statesOfFlags(h, o, views.length > 0)
|
|
509
|
+
if (images.length > 1 && !states) throw new Error('--image: one picture a version; it repeats as <view>=<a.png> only beside --after on a kind whose page draws views')
|
|
510
|
+
// a version a kind's page draws shows its stills: the picture given wins over a shot of the page
|
|
511
|
+
const still = states ? await stillOfFlags(h, o, states, images) : null
|
|
449
512
|
const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
|
|
513
|
+
// a draft's own address with no media draws the draft itself, as --draft does: never a version of words
|
|
514
|
+
const ownDraft = o.on !== undefined ? /^draft:([^/]+)$/.exec(o.on) : null
|
|
515
|
+
if (ownDraft && o.draft === undefined && views.length === 0 && [o.image, o.video, o.audio, o.pano, o.before, o.after, o.live, o.trailer].every((v) => v === undefined)) o.draft = ownDraft[1]!
|
|
450
516
|
const draft = await draftOfFlags(o, views.length > 0 || f.on.has('choice'))
|
|
451
517
|
const repoFlags = Object.fromEntries(own.flatMap((k) => (f.many[k] ? [[k, f.many[k]]] : [])))
|
|
452
518
|
const parsed = kind?.parse ? kind.parse(Object.fromEntries(Object.keys(kind.flags ?? {}).map((k) => [k, f.many[k] ?? []]))) : null
|
|
@@ -456,23 +522,23 @@ export class ReviewAddCommand extends Command {
|
|
|
456
522
|
let wipViews: ViewInput[] = []
|
|
457
523
|
if (o.live !== undefined) {
|
|
458
524
|
if (!h.unit?.live) throw new Error("--live: the repo's review unit declares no live shots (live: { frames })")
|
|
459
|
-
if (o.image || o.video || o.audio || o.before || o.after || views.length > 0) throw new Error('--wip: the version shows the live shot alone, no --image, --video, pair or --view beside it')
|
|
525
|
+
if (o.image || o.video || o.audio || o.pano || o.splat || o.mesh || o.before || o.after || views.length > 0) throw new Error('--wip: the version shows the live shot alone, no --image, --video, pair or --view beside it')
|
|
460
526
|
const fr = h.unit.live.frames(o.live)
|
|
461
527
|
wipViews = [{ label: '', image: fr.image }, ...(fr.history.length > 0 ? [{ label: 'history', gallery: fr.history }] : [])]
|
|
462
528
|
}
|
|
463
529
|
const answers = await Promise.all((f.many.answers ?? []).map((a) => idOf(h.dir, a)))
|
|
464
530
|
if (o.post !== undefined) {
|
|
465
|
-
// a public line: the repo's guard reads it before the
|
|
531
|
+
// a public line: the repo's guard reads it before the version holds it
|
|
466
532
|
const { dirname } = await import('node:path')
|
|
467
533
|
const { loadSocialUnit } = await import('../social/unit.ts')
|
|
468
534
|
const unit = await loadSocialUnit(dirname(dirname(h.dir)))
|
|
469
535
|
const problems = unit?.guard ? [...unit.guard({ title: '', alt: '', texts: [o.post], files: [] })] : []
|
|
470
536
|
if (problems.length > 0) throw new Error(`--post: the repo's guard refuses it: ${problems.join('; ')}`)
|
|
471
537
|
}
|
|
472
|
-
let changelog: import('../review/model.ts').
|
|
538
|
+
let changelog: import('../review/model.ts').ItemChangelog | undefined
|
|
473
539
|
if (o.rating !== undefined && o.changelog === undefined) throw new Error('--rating rates the picture its --changelog line lands with: give --changelog too')
|
|
474
540
|
if (o.changelog !== undefined) {
|
|
475
|
-
// its category and line are public words: the repo's guard reads them before the
|
|
541
|
+
// its category and line are public words: the repo's guard reads them before the item holds them
|
|
476
542
|
const { dirname } = await import('node:path')
|
|
477
543
|
const { changelogOfFlag } = await import('../review/model.ts')
|
|
478
544
|
const { publicProblems } = await import('../social/unit.ts')
|
|
@@ -489,19 +555,24 @@ export class ReviewAddCommand extends Command {
|
|
|
489
555
|
if (problems.length > 0) throw new Error(`--changelog: the repo's guard refuses it: ${problems.join('; ')}`)
|
|
490
556
|
}
|
|
491
557
|
const topic = o.topic ?? parsed?.topic
|
|
558
|
+
const doc = await docOfFlags(o, { trailer, draft, states, choice: f.on.has('choice'), wip: o.live !== undefined })
|
|
492
559
|
let input: import('../review/store.ts').AddInput = {
|
|
493
560
|
title: o.title ?? '',
|
|
494
561
|
what: o.what ?? '',
|
|
495
562
|
...(o.post ? { post: o.post } : {}),
|
|
496
563
|
...(changelog ? { changelog } : {}),
|
|
497
|
-
...(parsed ? { subject: parsed.subject } : o.subject ? { subject: { kind: o.subject } } : trailer ? { subject: { kind: 'trailer' } } : draft ? { subject: { kind: 'draft', slug: draft.slug } } : {}),
|
|
564
|
+
...(parsed ? { subject: parsed.subject } : o.subject ? { subject: { kind: o.subject } } : trailer ? { subject: { kind: 'trailer' } } : draft ? { subject: { kind: 'draft', slug: draft.slug } } : doc ? { subject: { kind: 'doc' } } : {}),
|
|
565
|
+
...(doc ? { doc } : {}),
|
|
498
566
|
...(topic ? { topic } : {}),
|
|
499
|
-
...(trailer ? { image: trailer.image, trailer: trailer.
|
|
567
|
+
...(trailer ? { image: trailer.image, trailer: trailer.item } : {}),
|
|
500
568
|
...(draft ? { draft } : {}),
|
|
501
569
|
...(states ? { states } : {}),
|
|
502
570
|
...(o.image ? { image: o.image } : {}),
|
|
503
571
|
...(o.video ? { video: o.video } : {}),
|
|
504
572
|
...(o.audio ? { audio: o.audio } : {}),
|
|
573
|
+
...(o.pano ? { pano: o.pano } : {}),
|
|
574
|
+
...(o.splat ? { splat: o.splat } : {}),
|
|
575
|
+
...(o.mesh ? { mesh: o.mesh } : {}),
|
|
505
576
|
...(o.before && !trailer ? { before: o.before } : {}),
|
|
506
577
|
...(o.after ? { after: o.after } : {}),
|
|
507
578
|
...(o.label ? { label: o.label } : {}),
|
|
@@ -519,18 +590,31 @@ export class ReviewAddCommand extends Command {
|
|
|
519
590
|
...(o.pick !== undefined ? { agentPick: o.pick } : {}),
|
|
520
591
|
...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
|
|
521
592
|
}
|
|
522
|
-
const media = [o.image, o.video, o.audio, o.before, o.after, o.live, o.trailer, o.draft].some((v) => v !== undefined) || views.length > 0 || states !== null
|
|
593
|
+
const media = [o.image, o.video, o.audio, o.pano, o.splat, o.mesh, o.before, o.after, o.live, o.trailer, o.draft].some((v) => v !== undefined) || views.length > 0 || lives.length > 0 || states !== null || doc !== null
|
|
523
594
|
if (!media && input.on !== undefined) return postWords(h, input.on, input.title, input.what, input.lane, f.on.has('verdict'))
|
|
524
595
|
// a version asks the owner's verdict always: the field says it, the flag changes nothing else
|
|
525
596
|
if (f.on.has('verdict')) input = { ...input, asksVerdict: true }
|
|
597
|
+
// each live page asked and shot now: its shot is the view everyone but the owner's hub sees
|
|
598
|
+
const shots = lives.length > 0 ? await (await import('../review/live-post.ts')).liveViews(lives) : null
|
|
599
|
+
if (shots) input = { ...input, views: [...(input.views ?? []), ...shots.views] }
|
|
600
|
+
// a splat or a mesh with no --image: its poster shot now, the viewer at rest
|
|
601
|
+
const poster = await withPoster({ label: '', ...(input.splat ? { splat: input.splat } : {}), ...(input.mesh ? { mesh: input.mesh } : {}), ...(input.image ? { image: input.image } : {}) })
|
|
602
|
+
if (poster.view.image !== undefined) input = { ...input, image: poster.view.image }
|
|
526
603
|
if (h.unit?.add) input = await h.unit.add(input, repoFlags)
|
|
527
604
|
const { ownAddressOf } = await import('../review/model.ts')
|
|
528
605
|
const address = ownAddressOf({ subject: input.subject ?? { kind: 'shot' }, ...(input.on ? { on: input.on } : {}), ...(input.trailer ? { trailer: input.trailer } : {}), origin: { by: 'agent' }, views: [] } as unknown as import('../review/model.ts').Item, h.say.spec)
|
|
529
606
|
if (address === null && input.supersedes === undefined && (input.answers ?? []).length === 0) {
|
|
530
607
|
trailer?.drop()
|
|
608
|
+
shots?.drop()
|
|
609
|
+
poster.drop()
|
|
531
610
|
throw new Error(NO_ADDRESS)
|
|
532
611
|
}
|
|
533
|
-
const item = await addItem(h.dir, input).finally(() =>
|
|
612
|
+
const item = await addItem(h.dir, input).finally(() => {
|
|
613
|
+
trailer?.drop()
|
|
614
|
+
shots?.drop()
|
|
615
|
+
poster.drop()
|
|
616
|
+
})
|
|
617
|
+
if (still) await keepStill(h, item, still)
|
|
534
618
|
h.out(item.id)
|
|
535
619
|
// on stderr: a script reads the id alone on stdout
|
|
536
620
|
await saidIntoThread(h, item, o.supersedes !== undefined)
|
|
@@ -542,7 +626,7 @@ export class ReviewAddCommand extends Command {
|
|
|
542
626
|
// on stderr: a script reads the id alone on stdout
|
|
543
627
|
for (const line of await (await import('../review/previews.ts')).playCopies(h.dir, item)) h.err(line)
|
|
544
628
|
if (item.trailer) h.out(`trailer version: ${item.trailer.trailer}/${item.trailer.after.cut}${item.trailer.before ? ` against ${item.trailer.before.cut}` : ''}${item.trailer.shots.length > 0 ? `, shots ${item.trailer.shots.join(', ')}` : ''}`)
|
|
545
|
-
// a cut shown
|
|
629
|
+
// a cut shown in a thread is a version from then on: the next edit of its file makes the one after it
|
|
546
630
|
if (item.trailer && o.trailer !== undefined && o.version === undefined) {
|
|
547
631
|
try {
|
|
548
632
|
const [b, { keepShown, thumbnailKept, versionVideo }, { findRepoRoot }] = await Promise.all([import('../trailer/build.ts'), import('../trailer/passage.ts'), import('../ts/config.ts')])
|
|
@@ -566,7 +650,7 @@ export class ReviewAddCommand extends Command {
|
|
|
566
650
|
}
|
|
567
651
|
}
|
|
568
652
|
if (item.draft) h.out(`draft version: ${item.draft.slug}, ${item.draft.posts.length} place${item.draft.posts.length > 1 ? 's' : ''}: ${item.draft.posts.map((p) => p.name).join(', ')}`)
|
|
569
|
-
if (item.origin.by === 'agent' && !item.origin.lane) h.err(
|
|
653
|
+
if (item.origin.by === 'agent' && !item.origin.lane) h.err(`posted ${item.id} with no lane: on the next post pass --lane <id> (or SK_AGENT), so the hub colours it; never post this one again`)
|
|
570
654
|
if (item.choice && item.agentPick === undefined) h.err(`a choice with no pick of yours: every question carries one, sk thread pick ${item.id} <view> (or --pick on post)`)
|
|
571
655
|
const { unheardLine } = await import('../review/model.ts')
|
|
572
656
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
@@ -591,7 +675,7 @@ async function statesOfFlags(h: Here, o: Record<string, string>, views: boolean)
|
|
|
591
675
|
const kind = (await import('../review/house-kind-defs.ts')).serverKindOf(root, h.unit, word)
|
|
592
676
|
const json = (v: string): boolean => /\.json$/i.test(v)
|
|
593
677
|
if (!kind?.read && !json(o.after)) return null
|
|
594
|
-
if (views || o.
|
|
678
|
+
if (views || o.video || o.audio || o.pano || o.splat || o.mesh) throw new Error(`${o.on}: a version of an object shows its two states and their still (--image) alone, no other picture beside them`)
|
|
595
679
|
const { existsSync, readFileSync } = await import('node:fs')
|
|
596
680
|
const side = async (flag: string, v: string): Promise<import('../review/model.ts').StoredState> => {
|
|
597
681
|
if (json(v)) {
|
|
@@ -602,9 +686,9 @@ async function statesOfFlags(h: Here, o: Record<string, string>, views: boolean)
|
|
|
602
686
|
if (!kind?.read) throw new Error(`--${flag} ${v}: a json file, or a git ref the kind reads; the kind ${word} declares no read`)
|
|
603
687
|
let at: string | undefined
|
|
604
688
|
if (v !== '.') {
|
|
605
|
-
const p =
|
|
606
|
-
at = p.
|
|
607
|
-
if (p.
|
|
689
|
+
const p = realGit.runSync(root, ['rev-parse', '--verify', '--quiet', `${v}^{commit}`])
|
|
690
|
+
at = p.out.trim()
|
|
691
|
+
if (p.code !== 0 || at === '') throw new Error(`--${flag} ${v}: no commit of this repo by that name (a json file, a git ref, or . for the working tree)`)
|
|
608
692
|
}
|
|
609
693
|
const st = await kind.read(key, at)
|
|
610
694
|
if (st === null) throw new Error(`--${flag} ${v}: the kind ${word} reads no ${key} there`)
|
|
@@ -617,6 +701,63 @@ async function statesOfFlags(h: Here, o: Record<string, string>, views: boolean)
|
|
|
617
701
|
return { ...(before ? { before } : {}), after }
|
|
618
702
|
}
|
|
619
703
|
|
|
704
|
+
/** where the stills of a version of an object come from (review/kind-still.ts): `--image`, taken out of the flags so
|
|
705
|
+
* no view reads it, else a shot of the kind's page once the version exists, one a view its state names; null when its
|
|
706
|
+
* kind draws no page */
|
|
707
|
+
async function stillOfFlags(h: Here, o: Record<string, string>, states: { before?: import('../review/model.ts').StoredState; after: import('../review/model.ts').StoredState }, images: readonly string[]) {
|
|
708
|
+
const word = o.on!.slice(0, o.on!.indexOf(':'))
|
|
709
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
710
|
+
const kind = (await import('../review/house-kind-defs.ts')).serverKindOf(findRepoRoot(process.cwd()), h.unit, word)
|
|
711
|
+
const plan = (await import('../review/kind-still.ts')).stillPlan(kind, states, images)
|
|
712
|
+
delete o.image
|
|
713
|
+
return plan ? { plan, kind } : null
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** the version's stills kept beside its states: each picture given, else a shot of the kind's page through the hub
|
|
717
|
+
* (`mode=thumb`, the view's `view`), as a live view's shot is taken. A state that names views gets one gallery tile a
|
|
718
|
+
* view, else the one still. A still that cannot be shot never holds the version back: the thread then shows a
|
|
719
|
+
* placeholder that opens the page, and the line says why */
|
|
720
|
+
async function keepStill(h: Here, item: import('../review/model.ts').Item, still: NonNullable<Awaited<ReturnType<typeof stillOfFlags>>>): Promise<void> {
|
|
721
|
+
const { setStill, setKindStills } = await import('../review/store.ts')
|
|
722
|
+
const { kindFrames } = await import('../review/kind-still.ts')
|
|
723
|
+
const lone = still.plan.length === 1 && still.plan[0]!.view === null ? still.plan[0]! : null
|
|
724
|
+
if (lone?.image !== undefined) return void (await setStill(h.dir, item.id, { image: lone.image }))
|
|
725
|
+
const { pasteHosts } = await import('../review/paste.ts')
|
|
726
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
727
|
+
const hub = (await pasteHosts(findRepoRoot(process.cwd()))).open.replace(/\/$/, '')
|
|
728
|
+
const drops: (() => void)[] = []
|
|
729
|
+
try {
|
|
730
|
+
const shotOf = async (view: string | undefined) => {
|
|
731
|
+
const plan = kindFrames(still.kind, item, (side) => `${hub}/api/review/${item.id}/state?side=${side}`, { view, mode: 'thumb' })
|
|
732
|
+
if (plan === null) return null
|
|
733
|
+
const shots = await (await import('../review/live-post.ts')).kindStill(hub, plan.page, plan.frames)
|
|
734
|
+
drops.push(shots.drop)
|
|
735
|
+
return shots.files
|
|
736
|
+
}
|
|
737
|
+
if (lone) {
|
|
738
|
+
const files = await shotOf(undefined)
|
|
739
|
+
if (files) await setStill(h.dir, item.id, files)
|
|
740
|
+
return
|
|
741
|
+
}
|
|
742
|
+
const tiles: { view: string; label: string; file: string; before?: string }[] = []
|
|
743
|
+
for (const s of still.plan) {
|
|
744
|
+
const v = s.view!
|
|
745
|
+
if (s.image !== undefined) {
|
|
746
|
+
tiles.push({ view: v.id, label: v.label, file: s.image })
|
|
747
|
+
continue
|
|
748
|
+
}
|
|
749
|
+
const files = await shotOf(v.id)
|
|
750
|
+
if (files === null) return
|
|
751
|
+
tiles.push({ view: v.id, label: v.label, ...('image' in files ? { file: files.image } : { file: files.after, before: files.before }) })
|
|
752
|
+
}
|
|
753
|
+
await setKindStills(h.dir, item.id, tiles)
|
|
754
|
+
} catch (e) {
|
|
755
|
+
h.err(`WARN the version is sent with no still: ${(e as Error).message}. The thread shows a placeholder that opens the page; --image <a.png> gives one${lone ? '' : ', --image <view>=<a.png> one a view'}`)
|
|
756
|
+
} finally {
|
|
757
|
+
for (const d of drops) d()
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
620
761
|
/** `post --choice`, the older form of a question with media options: each view an option (its note after its label),
|
|
621
762
|
* the title and what its words, posted as the question into the address's thread; it prints the `ask` form */
|
|
622
763
|
async function choiceAsQuestion(h: Here, o: Record<string, string>, views: readonly ViewInput[], many: Record<string, string[]>): Promise<number> {
|
|
@@ -644,8 +785,8 @@ async function choiceAsQuestion(h: Here, o: Record<string, string>, views: reado
|
|
|
644
785
|
|
|
645
786
|
async function saidIntoThread(h: Here, item: import('../review/model.ts').Item, typed: boolean): Promise<void> {
|
|
646
787
|
const { readAll } = await import('../review/store.ts')
|
|
647
|
-
const { ownAddressOf,
|
|
648
|
-
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
788
|
+
const { ownAddressOf, verdictOf } = await import('../review/model.ts')
|
|
789
|
+
const { openNotesOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
649
790
|
const items = readAll(h.dir).items
|
|
650
791
|
const t = threadOfItem(item.id, threadsOf(items, h.say.spec))
|
|
651
792
|
const own = ownAddressOf(item, h.say.spec)
|
|
@@ -654,21 +795,22 @@ async function saidIntoThread(h: Here, item: import('../review/model.ts').Item,
|
|
|
654
795
|
const waited = verdictOf(before) === null && before.item.views.length > 0
|
|
655
796
|
h.err(`into its thread ${own ?? ''}: the next version after ${before.item.id} "${before.item.title}"${waited ? ', which waited on his answer: only this one takes his marks now' : ''}. A subject he judges on its own takes its own address: --on ${own ?? '<kind>:<key>'}/<part>`)
|
|
656
797
|
}
|
|
657
|
-
const
|
|
658
|
-
const open = notes.filter((x) => stateOf(x, false).state !== 'closed' && !(item.answers ?? []).includes(x.item.id))
|
|
798
|
+
const open = (t ? openNotesOf(t) : []).filter((x) => !(item.answers ?? []).includes(x.item.id))
|
|
659
799
|
if (open.length > 0) h.err(`his notes in the thread stay open: ${open.map((x) => `${x.item.id} "${x.item.title}"`).join('; ')}. Close one once done: sk thread fixed <id> "<what was done>"; or name it on the version: --answers <id>`)
|
|
660
800
|
}
|
|
661
801
|
|
|
662
|
-
/** `post <address>` with no media: words that start the address's thread, or a reply in the thread it has
|
|
802
|
+
/** `post <address>` with no media: words that start the address's thread, or a reply in the thread it has. The thread
|
|
803
|
+
* is the one its own address names, as a version's: a part address (`<kind>:<key>/<part>`) is its own thread, never
|
|
804
|
+
* its parent's */
|
|
663
805
|
async function postWords(h: Here, address: string, title: string, what: string, lane: string | undefined, verdict = false): Promise<number> {
|
|
664
806
|
const { agentName, openThread, readAll, specOf } = await import('../review/store.ts')
|
|
665
|
-
const { threadOfAddress } = await import('../review/threads.ts')
|
|
807
|
+
const { threadIdOf, threadOfAddress } = await import('../review/threads.ts')
|
|
666
808
|
if (!title.trim() && !what.trim()) throw new Error('--title "<words>" (and --what): with no media, a post is words')
|
|
667
|
-
const t = threadOfAddress(address, readAll(h.dir).items, specOf(h.dir)
|
|
809
|
+
const t = threadOfAddress(address, readAll(h.dir).items, specOf(h.dir))
|
|
668
810
|
if (t) {
|
|
669
811
|
const m = await wordsIn(h.dir, t.head.item.id, lane?.trim() || agentName(), [title.trim(), what.trim()].filter(Boolean).join('\n'), verdict)
|
|
670
812
|
h.out(`${t.head.item.id}: ${m.id}`)
|
|
671
|
-
h.err(`a word in the thread of ${address}${verdict ? ", waiting for the owner's verdict" : ''}`)
|
|
813
|
+
h.err(`a word in the thread ${threadIdOf(t)} of ${address}${verdict ? ", waiting for the owner's verdict" : ''}`)
|
|
672
814
|
return 0
|
|
673
815
|
}
|
|
674
816
|
const x = await openThread(h.dir, address, { title: title.trim() || what.trim(), ...(what.trim() ? { what } : {}), ...(lane?.trim() ? { lane: lane.trim() } : {}), ...(verdict ? { asksVerdict: true as const } : {}) })
|
|
@@ -682,7 +824,7 @@ async function wordsIn(dir: string, id: string, who: string, text: string, verdi
|
|
|
682
824
|
const { addMessage, appendMessage, readItem } = await import('../review/store.ts')
|
|
683
825
|
if (!verdict) return addMessage(dir, id, who, text, image)
|
|
684
826
|
const { textOf } = await import('../review/model.ts')
|
|
685
|
-
if (!readItem(dir, id)) throw new Error(`no
|
|
827
|
+
if (!readItem(dir, id)) throw new Error(`no item ${id}`)
|
|
686
828
|
const t = textOf(text)
|
|
687
829
|
if ('error' in t) throw new Error(t.error)
|
|
688
830
|
return appendMessage(dir, id, { who, text: t.text, asksVerdict: true }, image !== undefined ? { image } : {})
|
|
@@ -701,6 +843,7 @@ export class ReviewAddViewCommand extends Command {
|
|
|
701
843
|
examples: [
|
|
702
844
|
['a view from above', 'sk thread add-view <id> "from above" top.png'],
|
|
703
845
|
['a before and after', 'sk thread add-view <id> --label "on a phone" --before a.png --after b.png'],
|
|
846
|
+
['a 360° panorama', 'sk thread add-view <id> --label "inside" --pano hall-360.png'],
|
|
704
847
|
],
|
|
705
848
|
})
|
|
706
849
|
args = Option.Proxy()
|
|
@@ -710,16 +853,20 @@ export class ReviewAddViewCommand extends Command {
|
|
|
710
853
|
return helpWithUnit(this.context, this.cli.usage(ReviewAddViewCommand, { detailed: true }), false)
|
|
711
854
|
}
|
|
712
855
|
return run(this.context, async (h) => {
|
|
713
|
-
const {
|
|
856
|
+
const { addViewAlso } = await import('../review/store.ts')
|
|
714
857
|
const keep = this.args.includes('--keep')
|
|
715
858
|
const a = await addViewArgs(this.args.filter((x) => x !== '--keep'), Object.keys(h.unit?.flags ?? {}))
|
|
716
|
-
const v = a.view
|
|
717
859
|
const id = await idOf(h.dir, a.id)
|
|
860
|
+
const posted = await withPoster(a.view)
|
|
861
|
+
const v = posted.view
|
|
718
862
|
const extra = h.unit?.addView ? await h.unit.addView(v, a.repoFlags) : {}
|
|
719
|
-
const item = await
|
|
863
|
+
const { item, added } = await addViewAlso(h.dir, id, v, { ...extra, ...(keep ? { keep: true } : {}) }).finally(posted.drop)
|
|
720
864
|
const { viewNo } = await import('../review/model.ts')
|
|
721
|
-
|
|
722
|
-
for (const
|
|
865
|
+
const { playCopies } = await import('../review/previews.ts')
|
|
866
|
+
for (const n of added) {
|
|
867
|
+
h.out(`${id}: view ${viewNo(n)} "${item.views[n]!.label}" added`)
|
|
868
|
+
for (const line of await playCopies(h.dir, item, n)) h.err(line)
|
|
869
|
+
}
|
|
723
870
|
return 0
|
|
724
871
|
})
|
|
725
872
|
}
|
|
@@ -729,7 +876,7 @@ export class ReviewLsCommand extends Command {
|
|
|
729
876
|
static override paths = [['review'], ['review', 'ls']]
|
|
730
877
|
static override usage = Command.Usage({
|
|
731
878
|
category: 'Review',
|
|
732
|
-
description: "the
|
|
879
|
+
description: "the active threads: status, thread id, title, address; `sk thread <verb>` runs a unit's verb",
|
|
733
880
|
details: `${DETAILS}\n\nsk thread [--all] lists; sk thread <verb> … runs a verb the repo's review unit declares (verbs: {...}).`,
|
|
734
881
|
examples: [['what is open', 'sk thread ls'], ['every thread', 'sk thread ls --all']],
|
|
735
882
|
})
|
|
@@ -770,10 +917,11 @@ export class ReviewLsCommand extends Command {
|
|
|
770
917
|
for (const b of all.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
|
|
771
918
|
const threads = orderedThreads(all.items).filter((t) => every || isActive(t))
|
|
772
919
|
if (threads.length === 0) h.out(every ? 'review: the store is empty' : 'review: nothing active (--all shows every thread)')
|
|
773
|
-
const { ownAddressesOf, threadTitle } = await import('../review/threads.ts')
|
|
920
|
+
const { ownAddressesOf, threadIdOf, threadTitle } = await import('../review/threads.ts')
|
|
921
|
+
// the thread's own id, never an item's: the items' ids are `sk thread show <thread>`'s
|
|
774
922
|
for (const t of threads) {
|
|
775
923
|
const at = ownAddressesOf(t)[0]
|
|
776
|
-
h.out(`${statusOf(t.head, all.items).padEnd(17)} ${t
|
|
924
|
+
h.out(`${statusOf(t.head, all.items).padEnd(17)} ${threadIdOf(t)} ${threadTitle(t)}${t.versions.length > 1 ? ` (v${t.versions.length})` : ''}${at ? ` ${at}` : ''}`)
|
|
777
925
|
}
|
|
778
926
|
return all.broken.length > 0 ? 1 : 0
|
|
779
927
|
},
|
|
@@ -796,7 +944,7 @@ export class ReviewShowCommand extends Command {
|
|
|
796
944
|
|
|
797
945
|
async execute(): Promise<number> {
|
|
798
946
|
return run(this.context, async (h) => {
|
|
799
|
-
const { readAllCached } = await import('../review/store.ts')
|
|
947
|
+
const { mediaDir, readAllCached } = await import('../review/store.ts')
|
|
800
948
|
const { threadDetail, detail } = await import('../review/format.ts')
|
|
801
949
|
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
802
950
|
const id = await idOf(h.dir, this.id)
|
|
@@ -805,25 +953,25 @@ export class ReviewShowCommand extends Command {
|
|
|
805
953
|
if (!x) throw new Error(`no item ${this.id}`)
|
|
806
954
|
if (this.paste) {
|
|
807
955
|
const { dirname } = await import('node:path')
|
|
808
|
-
const { pasteHosts,
|
|
956
|
+
const { pasteHosts, threadUrl } = await import('../review/paste.ts')
|
|
809
957
|
const { pasteBlock, STATUS_LABEL } = await import('../review/model.ts')
|
|
810
958
|
const { statusOf } = await import('../review/threads.ts')
|
|
811
959
|
const w = await pasteHosts(dirname(dirname(h.dir)))
|
|
812
|
-
h.out(pasteBlock(x.item, STATUS_LABEL[statusOf(x, all.items)], { root: w.root, open:
|
|
960
|
+
h.out(pasteBlock(x.item, STATUS_LABEL[statusOf(x, all.items)], { root: w.root, open: threadUrl(w.open, x.item.id), phone: w.phone ? threadUrl(w.phone, x.item.id) : null }))
|
|
813
961
|
return 0
|
|
814
962
|
}
|
|
815
963
|
const t = threadOfItem(x.item.id, threadsOf(all.items))
|
|
816
|
-
// the
|
|
964
|
+
// the paths it prints are on the disk: a message's image or file the purge let go comes back first
|
|
817
965
|
const { ensureLocal } = await import('../review/media-read.ts')
|
|
818
966
|
const { membersOf } = await import('../review/threads.ts')
|
|
819
|
-
await Promise.all((t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => (m.image ? [ensureLocal(h.dir, y.item.id, `thread/${
|
|
820
|
-
h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, h.dir, true, h.say) : detail(x, h.dir, true, false, h.say))
|
|
967
|
+
await Promise.all((t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => [...(m.image ? [m.image] : []), ...(m.files ?? []).map((g) => g.file)].map((n) => ensureLocal(h.dir, y.item.id, `thread/${n}`).catch((e: Error) => h.err(`review: WARN thread/${n}: ${e.message}`))))))
|
|
968
|
+
h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, h.say) : detail(x, mediaDir(h.dir), true, false, h.say))
|
|
821
969
|
return 0
|
|
822
970
|
})
|
|
823
971
|
}
|
|
824
972
|
}
|
|
825
973
|
|
|
826
|
-
/** --mine or --session <id>: only the
|
|
974
|
+
/** --mine or --session <id>: only the items that session opened; null keeps every item */
|
|
827
975
|
async function sessionOf(mine: boolean, session: string | undefined): Promise<string | null> {
|
|
828
976
|
if (session !== undefined) return session
|
|
829
977
|
if (!mine) return null
|
|
@@ -846,47 +994,40 @@ export class ReviewInboxCommand extends Command {
|
|
|
846
994
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
847
995
|
subject = Option.String('--subject', { description: 'only items of this subject kind (frame, shot…)' })
|
|
848
996
|
all = Option.Boolean('--all', false, { description: 'a plain approval too, not only the counted line' })
|
|
849
|
-
hook = Option.Boolean('--hook', false, { description: 'run as a Claude Code hook (UserPromptSubmit, Stop): the hook input on stdin, its json answer on stdout.
|
|
997
|
+
hook = Option.Boolean('--hook', false, { description: 'run as a Claude Code hook (SessionStart, UserPromptSubmit, Stop, SubagentStop): the hook input on stdin, its json answer on stdout. At the start of a session: who hears the threads of the project and which hold a word nobody hears, three lines at most. A thread whose holder is gone passes on first (a lane that ended → its session); the unseen answers join a prompt as context, and a turn does not end while one is unseen, or while a thread of his turn has no watch to hear it' })
|
|
850
998
|
|
|
851
999
|
async execute(): Promise<number> {
|
|
852
|
-
const { hookPasses
|
|
853
|
-
|
|
854
|
-
const input = this.hook ? parseHookInput(process.stdin.isTTY === true ? '' : await new Response(Bun.stdin.stream()).text().catch(() => '')) : null
|
|
1000
|
+
const { hookPasses } = await import('../review/inbox-hook.ts')
|
|
1001
|
+
const input = this.hook ? await (await import('./inbox-hook-run.ts')).readHookInput() : null
|
|
855
1002
|
if (input != null && hookPasses(input)) return 0
|
|
856
1003
|
return run(this.context, async (h) => {
|
|
857
1004
|
const { BUILTIN_KINDS, untakenOf } = await import('../review/model.ts')
|
|
858
1005
|
const kinds = [...Object.keys(h.say.spec.kinds), ...Object.keys(BUILTIN_KINDS)]
|
|
859
1006
|
if (this.subject !== undefined && Object.keys(h.say.spec.kinds).length > 0 && !kinds.includes(this.subject)) throw new Error(`--subject: one of ${kinds.join(', ')}`)
|
|
860
|
-
|
|
1007
|
+
// as a hook: the same run as the hook's own boot (cli.ts)
|
|
1008
|
+
if (input != null) return (await import('./inbox-hook-run.ts')).inboxHook(h, input)
|
|
1009
|
+
const { selectInbox, selectedText } = await import('../review/inbox-read.ts')
|
|
861
1010
|
const { followedIds, hears, listenersOf, sinceHeLeft, threadByItem, threadsOf } = await import('../review/threads.ts')
|
|
862
1011
|
const { untakenLine } = await import('../review/format.ts')
|
|
863
1012
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
864
1013
|
await pull(h)
|
|
865
1014
|
const here = await hereStore(h)
|
|
866
1015
|
for (const b of here.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
|
|
867
|
-
if (input != null) {
|
|
868
|
-
// as a hook: what this session hears, in its own repo and in every store it or its lanes wrote in
|
|
869
|
-
const session = hookSession(input)
|
|
870
|
-
const { noteHanded, noteSession } = await import('../agent-time/registry.ts')
|
|
871
|
-
if (session !== null) noteSession(h.dir)
|
|
872
|
-
const stores = [here, ...(session === null ? [] : await storesOf(session, h.dir))]
|
|
873
|
-
const parties = await partiesFor(stores, session)
|
|
874
|
-
const me = { lane: null, session }
|
|
875
|
-
const answer = hookReply({ input, me, stores, parties, onHanded: noteHanded })
|
|
876
|
-
if (answer != null) h.out(answer)
|
|
877
|
-
return 0
|
|
878
|
-
}
|
|
879
1016
|
const session = await sessionOf(this.mine, this.session)
|
|
880
|
-
const lane = this.mine ?
|
|
1017
|
+
const lane = this.mine ? callerLane(undefined) : null
|
|
881
1018
|
const parties = session === null && lane === null ? null : await partiesFor([here], session)
|
|
882
1019
|
const since = sinceHeLeft(here.items)
|
|
883
1020
|
if (since && since.moved > 0) h.out(`since you left (${since.at}): ${since.moved} moved, ${since.yours} yours\n`)
|
|
884
1021
|
// his requests for a lane first: the orchestrator's (review/lane-ask.ts)
|
|
885
1022
|
const { laneAsksFor } = await import('../review/inbox-read.ts')
|
|
886
1023
|
for (const l of laneAsksFor(here, { session, lane }, parties ?? { sessions: [], lanes: [] })) h.out(`${l}\n`)
|
|
887
|
-
|
|
1024
|
+
// the owner's words that name another agent are that agent's (wiki tools/shipkit/threads-how-it-fits.md, Mentions)
|
|
1025
|
+
const { wordReaches } = await import('../review/threads.ts')
|
|
1026
|
+
const named = threadByItem(threadsOf(here.items, h.say.spec))
|
|
1027
|
+
const mine = { ...here, say: { ...here.say, to: (x: import('../review/model.ts').ReviewItem, m: import('../review/model.ts').Message) => wordReaches({ session, lane }, x, m, named, parties) } }
|
|
1028
|
+
const sel = selectInbox(mine, (x, byItem) => hears({ session, lane }, x, byItem, parties), { all: this.all, subject: this.subject })
|
|
888
1029
|
if (sel.threads.length === 0 && sel.news.length === 0) h.out('review: no unseen feedback or reply')
|
|
889
|
-
for (const g of sel.threads) h.out(`${selectedText(
|
|
1030
|
+
for (const g of sel.threads) h.out(`${selectedText(mine, g)}\n`)
|
|
890
1031
|
const { ownAddressOf, verdictOf } = await import('../review/model.ts')
|
|
891
1032
|
const owedLine = (t: (typeof sel.owed)[number]): string => {
|
|
892
1033
|
const x = t.head
|
|
@@ -910,68 +1051,25 @@ export class ReviewInboxCommand extends Command {
|
|
|
910
1051
|
}
|
|
911
1052
|
}
|
|
912
1053
|
|
|
913
|
-
/** the store the verb stands in, read for the inbox */
|
|
914
|
-
async function hereStore(h: Here): Promise<import('../review/inbox-read.ts').StoreRead> {
|
|
915
|
-
const { readAll } = await import('../review/store.ts')
|
|
916
|
-
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
917
|
-
const { dirname } = await import('node:path')
|
|
918
|
-
const root = dirname(dirname(h.dir))
|
|
919
|
-
return { repo: repoNameOf(root), root, dir: h.dir, here: true, ...readAll(h.dir), say: h.say }
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/** every other store this session or its lanes wrote in (agent-time/registry.ts), each with its repo's unit bound */
|
|
923
|
-
async function storesOf(session: string, hereDir: string): Promise<import('../review/inbox-read.ts').StoreRead[]> {
|
|
924
|
-
const { forgetStores, readSessionRecords, repoNameOf } = await import('../agent-time/registry.ts')
|
|
925
|
-
const { existsSync } = await import('node:fs')
|
|
926
|
-
const { dirname, resolve } = await import('node:path')
|
|
927
|
-
const dirs: string[] = []
|
|
928
|
-
const gone: string[] = []
|
|
929
|
-
// only a store its commands run in: `sk thread seen` there refuses a folder that is no shipkit repo
|
|
930
|
-
for (const d of (readSessionRecords().find((r) => r.session === session)?.stores ?? []).filter((x) => resolve(x) !== resolve(hereDir)))
|
|
931
|
-
(existsSync(d) && (await reviewRoot(dirname(dirname(d)))) !== null ? dirs : gone).push(d)
|
|
932
|
-
forgetStores(session, gone)
|
|
933
|
-
const out: import('../review/inbox-read.ts').StoreRead[] = []
|
|
934
|
-
for (const dir of dirs) {
|
|
935
|
-
const root = dirname(dirname(dir))
|
|
936
|
-
try {
|
|
937
|
-
const { openReview, factLines } = await import('../review/project.ts')
|
|
938
|
-
const { readAll, specOf } = await import('../review/store.ts')
|
|
939
|
-
const { unit } = await openReview(root)
|
|
940
|
-
out.push({ repo: repoNameOf(root), root, dir, here: false, ...readAll(dir), say: { spec: specOf(dir), more: (x) => factLines(unit, x) } })
|
|
941
|
-
} catch {
|
|
942
|
-
// a store that does not read now: its own repo's hook and inbox say why
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return out
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
/** the parties these stores' threads name: their holders' sessions and the caller's, with each store's live watches */
|
|
949
|
-
async function partiesFor(stores: readonly import('../review/inbox-read.ts').StoreRead[], self: string | null): Promise<import('../review/parties.ts').Parties> {
|
|
950
|
-
const { readParties } = await import('../agent-time/registry.ts')
|
|
951
|
-
const { holderOf, threadsOf } = await import('../review/threads.ts')
|
|
952
|
-
const { liveWatchers } = await import('../review/watchers.ts')
|
|
953
|
-
const ids = new Set<string>()
|
|
954
|
-
for (const s of stores) for (const t of threadsOf(s.items, s.say.spec)) {
|
|
955
|
-
const hs = holderOf(t)?.session
|
|
956
|
-
if (hs) ids.add(hs)
|
|
957
|
-
}
|
|
958
|
-
return readParties({ sessions: [...ids], watchers: stores.flatMap((s) => liveWatchers(s.dir)), self })
|
|
959
|
-
}
|
|
960
1054
|
|
|
961
|
-
/** the lane that acts on a reply or a seen
|
|
962
|
-
const
|
|
1055
|
+
/** the lane that acts on a reply or a seen, by this process's SK_AGENT (review/parties.ts laneOfCaller) */
|
|
1056
|
+
const callerLane = (as: string | undefined): string | null => laneOfCaller(as, process.env.SK_AGENT)
|
|
963
1057
|
|
|
964
1058
|
/** why the caller may not mark his answer on this item seen (review/threads.ts seenRefusal, rule 4: the holder or its
|
|
965
1059
|
* session), null when it may */
|
|
966
|
-
async function seenRefused(dir: string, id: string, as: string | undefined): Promise<string | null> {
|
|
1060
|
+
async function seenRefused(dir: string, id: string, as: string | undefined): Promise<{ refused: string | null; only?: string[] }> {
|
|
967
1061
|
const { readAll } = await import('../review/store.ts')
|
|
968
|
-
const { seenRefusal, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1062
|
+
const { seenOnly, seenRefusal, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
969
1063
|
const items = readAll(dir).items
|
|
970
1064
|
const x = items.find((y) => y.item.id === id)
|
|
971
|
-
if (x === undefined) return null
|
|
1065
|
+
if (x === undefined) return { refused: null }
|
|
972
1066
|
const t = threadOfItem(id, threadsOf(items))
|
|
973
1067
|
const { me, parties } = await callerParties(dir, t, as)
|
|
974
|
-
|
|
1068
|
+
// a lane the owner's words name reads those words only, on a thread another agent holds
|
|
1069
|
+
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
1070
|
+
const { dirname } = await import('node:path')
|
|
1071
|
+
const only = seenOnly(x, t, me, parties, repoNameOf(dirname(dirname(dir))))
|
|
1072
|
+
return { refused: seenRefusal(x, t, me, parties), ...(only !== undefined ? { only } : {}) }
|
|
975
1073
|
}
|
|
976
1074
|
|
|
977
1075
|
/** the caller and the parties its thread's holder names */
|
|
@@ -980,23 +1078,21 @@ async function callerParties(dir: string, t: import('../review/threads.ts').Thre
|
|
|
980
1078
|
const { holderOf } = await import('../review/threads.ts')
|
|
981
1079
|
const { readParties } = await import('../agent-time/registry.ts')
|
|
982
1080
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
983
|
-
const me = { lane:
|
|
1081
|
+
const me = { lane: callerLane(as), session: sessionId() }
|
|
984
1082
|
const hs = t ? holderOf(t)?.session : undefined
|
|
985
|
-
|
|
1083
|
+
const { hearingHolders } = await import('../orchestrator/role.ts')
|
|
1084
|
+
const { placeParties } = await import('../orchestrator/places.ts')
|
|
1085
|
+
return { me, parties: await readParties({ sessions: hs ? [hs] : [], watchers: liveWatchers(dir), self: me.session, roles: hearingHolders, places: placeParties }) }
|
|
986
1086
|
}
|
|
987
1087
|
|
|
988
|
-
/** the caller holds the item's thread
|
|
989
|
-
* may close what that lane claimed, as itself */
|
|
1088
|
+
/** the caller holds the item's thread (review/parties.ts holdsThread): it may close what that thread's lane claimed */
|
|
990
1089
|
async function callerHolds(dir: string, id: string, as: string | undefined): Promise<boolean> {
|
|
991
1090
|
const { readAll } = await import('../review/store.ts')
|
|
992
1091
|
const { holderOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
993
|
-
const { maySee } = await import('../review/parties.ts')
|
|
994
1092
|
const t = threadOfItem(id, threadsOf(readAll(dir).items))
|
|
995
|
-
if (t === null) return false
|
|
996
|
-
const h = holderOf(t)
|
|
997
|
-
if (h === null) return false
|
|
1093
|
+
if (t === null || holderOf(t) === null) return false
|
|
998
1094
|
const { me, parties } = await callerParties(dir, t, as)
|
|
999
|
-
return
|
|
1095
|
+
return holdsThread(me, holderOf(t), parties)
|
|
1000
1096
|
}
|
|
1001
1097
|
|
|
1002
1098
|
/** `--replaces <object>`: the thread item `id` is in, and the message id the new object supersedes, once the caller may
|
|
@@ -1015,10 +1111,9 @@ async function replacing(dir: string, ref: string, target: string, as: string |
|
|
|
1015
1111
|
return { id, replaces }
|
|
1016
1112
|
}
|
|
1017
1113
|
|
|
1018
|
-
/** the caller may act as the thread's holder: it holds it, or
|
|
1114
|
+
/** the caller may act as the thread's holder (review/parties.ts maySee): it holds it, or nobody does */
|
|
1019
1115
|
async function mayHold(dir: string, t: import('../review/threads.ts').Thread, as: string | undefined): Promise<boolean> {
|
|
1020
1116
|
const { holderOf } = await import('../review/threads.ts')
|
|
1021
|
-
const { maySee } = await import('../review/parties.ts')
|
|
1022
1117
|
const { me, parties } = await callerParties(dir, t, as)
|
|
1023
1118
|
return maySee(me, holderOf(t), parties)
|
|
1024
1119
|
}
|
|
@@ -1041,7 +1136,7 @@ export class ReviewSeenCommand extends Command {
|
|
|
1041
1136
|
async execute(): Promise<number> {
|
|
1042
1137
|
return run(this.context, async (h) => {
|
|
1043
1138
|
const { markSeen } = await import('../review/store.ts')
|
|
1044
|
-
// every id checked before any is marked: his answer on another lane's
|
|
1139
|
+
// every id checked before any is marked: his answer on another lane's version stays unread for that lane
|
|
1045
1140
|
const ids: [string, string][] = []
|
|
1046
1141
|
const { ID_RE } = await import('../review/model.ts')
|
|
1047
1142
|
for (const ref of this.ids) {
|
|
@@ -1059,13 +1154,17 @@ export class ReviewSeenCommand extends Command {
|
|
|
1059
1154
|
}
|
|
1060
1155
|
ids.push([ref, await idOf(h.dir, ref).catch(() => ref)])
|
|
1061
1156
|
}
|
|
1062
|
-
const
|
|
1157
|
+
const scopes = await Promise.all(ids.map(([, id]) => seenRefused(h.dir, id, this.as)))
|
|
1158
|
+
const refused = scopes.map((s) => s.refused).filter((w) => w !== null)
|
|
1063
1159
|
if (refused.length > 0) throw new Error(`nothing marked: ${refused.join('; ')}`)
|
|
1064
1160
|
let bad = 0
|
|
1065
|
-
for (const [ref, id] of ids) {
|
|
1066
|
-
if (markSeen(h.dir, id)) h.out(`${ref}: seen`)
|
|
1161
|
+
for (const [i, [ref, id]] of ids.entries()) {
|
|
1162
|
+
if (markSeen(h.dir, id, new Date(), scopes[i]!.only)) h.out(`${ref}: seen`)
|
|
1067
1163
|
else {
|
|
1068
|
-
|
|
1164
|
+
// say which: an item that does not exist, none of the owner's words on it is the caller's, or none unseen
|
|
1165
|
+
const { readItem } = await import('../review/store.ts')
|
|
1166
|
+
const why = readItem(h.dir, id) === null ? 'no such item' : scopes[i]!.only?.length === 0 ? `none of the owner's words on it is yours to mark: its holder marks them, or take it first (sk thread take ${ref})` : 'nothing of the owner unseen on it'
|
|
1167
|
+
h.err(`FAIL: review: ${ref}: ${why}`)
|
|
1069
1168
|
bad++
|
|
1070
1169
|
}
|
|
1071
1170
|
}
|
|
@@ -1099,7 +1198,7 @@ export class ThreadWorkingCommand extends Command {
|
|
|
1099
1198
|
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1100
1199
|
const id = await idOf(h.dir, this.ref)
|
|
1101
1200
|
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
1102
|
-
const who =
|
|
1201
|
+
const who = callerLane(this.as) ?? 'agent'
|
|
1103
1202
|
appendMessage(h.dir, t?.head.item.id ?? id, { who, op: 'working', note: line })
|
|
1104
1203
|
h.out(`${this.ref}: ${who} is on it: ${line} (your next act in this thread ends it)`)
|
|
1105
1204
|
return 0
|
|
@@ -1131,19 +1230,24 @@ export class ThreadTakeCommand extends Command {
|
|
|
1131
1230
|
const { dropHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
1132
1231
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1133
1232
|
const { sessionId } = await import('../review/store.ts')
|
|
1134
|
-
const lane =
|
|
1233
|
+
const lane = callerLane(this.as)
|
|
1135
1234
|
appendMessage(h.dir, head, { who: lane ?? 'agent', op: 'take' })
|
|
1136
1235
|
// taken here: the ended lane, resumed later, leaves it to its taker
|
|
1137
1236
|
const self = sessionId()
|
|
1138
1237
|
if (self) dropHanded(self, h.dir, head, lane)
|
|
1139
1238
|
const after = threadOfItem(head, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
1140
1239
|
const now = after ? holderOf(after) : null
|
|
1141
|
-
|
|
1240
|
+
// a house watch of the caller hears this store too, within 2 s of the take
|
|
1241
|
+
const { houseWatchesOf } = await import('../review/watchers.ts')
|
|
1242
|
+
const { readSessionRecord } = await import('../agent-time/registry.ts')
|
|
1243
|
+
const house = self ? houseWatchesOf(self, readSessionRecord(self)?.stores ?? []) : []
|
|
1244
|
+
const parties = await readParties({ sessions: [...new Set([was?.session, now?.session].filter((x): x is string => !!x))], watchers: [...liveWatchers(h.dir), ...house], self })
|
|
1142
1245
|
const { dirname } = await import('node:path')
|
|
1143
1246
|
const hearing = after ? hearingOfThread(after, parties, repoNameOf(dirname(dirname(h.dir)))) : null
|
|
1144
1247
|
const wasText = was === null ? 'nobody held it' : `it was held by ${was.lane ?? sessionLabel(was.session, parties)}`
|
|
1145
1248
|
h.out(`${this.ref}: yours now (${hearing?.chip ?? lane ?? 'this session'}), ${wasText}; ${hearing?.words ?? ''}`)
|
|
1146
|
-
|
|
1249
|
+
const { IN_BACKGROUND, WATCH } = await import('../review/inbox-hook.ts')
|
|
1250
|
+
if (hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
|
|
1147
1251
|
return 0
|
|
1148
1252
|
})
|
|
1149
1253
|
}
|
|
@@ -1154,7 +1258,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1154
1258
|
static override usage = Command.Usage({
|
|
1155
1259
|
category: 'Review',
|
|
1156
1260
|
description: 'give a thread to a lane: it holds it, a trace line names who gave it',
|
|
1157
|
-
details: `${DETAILS}\n\
|
|
1261
|
+
details: `${DETAILS}\n\nA session's answer to the owner's « start a lane »: on a thread nobody holds, sk thread take it first; then SendMessage to a live lane, or start a sub-agent with the thread as its brief (nothing starts a process for you); then assign the thread to that lane. The lane holds it (a take under its name, the state left as it is), and its trace line reads « L65 took the thread: assigned by app main ». The request clears at the lane's first act there: tell it to say \`sk thread working <address> "…"\` first (wiki tools/shipkit/threads-how-it-fits.md, A lane he asks for).`,
|
|
1158
1262
|
examples: [['a lane for the thread he asked one on', 'sk thread assign screen:orders/list L65']],
|
|
1159
1263
|
})
|
|
1160
1264
|
ref = Option.String({ name: 'address | id' })
|
|
@@ -1172,7 +1276,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1172
1276
|
const id = await idOf(h.dir, this.ref)
|
|
1173
1277
|
const head = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))?.head.item.id ?? id
|
|
1174
1278
|
const self = sessionId()
|
|
1175
|
-
const by =
|
|
1279
|
+
const by = callerLane(undefined) ?? (self ? sessionLabel(self, await readParties({ sessions: [], self })) : 'a terminal')
|
|
1176
1280
|
appendMessage(h.dir, head, { who: lane, op: 'take', note: `assigned by ${by}` })
|
|
1177
1281
|
if (self) dropHanded(self, h.dir, head, lane)
|
|
1178
1282
|
h.out(`${this.ref}: given to ${lane} (assigned by ${by}): its first act there (sk thread working ${this.ref} "…") clears his request`)
|
|
@@ -1184,7 +1288,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1184
1288
|
export class ReviewReplyCommand extends Command {
|
|
1185
1289
|
static override paths = [['review', 'reply']]
|
|
1186
1290
|
static essential = { args: '<address | id> <text>' }
|
|
1187
|
-
static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: DETAILS })
|
|
1291
|
+
static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: `${DETAILS}\n\nBy address, the words answer his newest open note in the thread (the one sk thread fixed closes), else its newest version; by id, that item.` })
|
|
1188
1292
|
id = Option.String({ name: 'address | id' })
|
|
1189
1293
|
text = Option.String()
|
|
1190
1294
|
image = Option.String('--image', { description: 'an image beside the words' })
|
|
@@ -1202,13 +1306,13 @@ export class ReviewReplyCommand extends Command {
|
|
|
1202
1306
|
const r = await replacing(h.dir, this.id, this.replaces, this.as)
|
|
1203
1307
|
const t = textOf(this.text)
|
|
1204
1308
|
if ('error' in t) throw new Error(t.error)
|
|
1205
|
-
const m = appendMessage(h.dir, r.id, { who:
|
|
1309
|
+
const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}) })
|
|
1206
1310
|
h.out(`${r.id}: ${m.id} supersedes ${r.replaces}`)
|
|
1207
1311
|
return 0
|
|
1208
1312
|
}
|
|
1209
|
-
const id = await idOrOpen(h, this.id, this.text, this.as)
|
|
1210
|
-
const m = await wordsIn(h.dir, id,
|
|
1211
|
-
if (this.urgent) await urgentOn(h.dir, id,
|
|
1313
|
+
const id = await replyTarget(h, this.id, await idOrOpen(h, this.id, this.text, this.as))
|
|
1314
|
+
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image)
|
|
1315
|
+
if (this.urgent) await urgentOn(h.dir, id, callerLane(this.as) ?? agentName())
|
|
1212
1316
|
h.out(`${id}: ${m.id}`)
|
|
1213
1317
|
return 0
|
|
1214
1318
|
})
|
|
@@ -1256,14 +1360,14 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1256
1360
|
if ((UPDATE_STATES as readonly string[]).includes(this.state)) throw new Error(`update <address | id> ${this.state} "<one line>": the line is missing`)
|
|
1257
1361
|
const at = await idOrOpen(h, this.id, this.state, this.as)
|
|
1258
1362
|
const on = threadOfId(at, threadsOf(readAll(h.dir).items))?.head.item.id ?? at
|
|
1259
|
-
const m = await wordsIn(h.dir, on,
|
|
1363
|
+
const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict)
|
|
1260
1364
|
h.out(`${on}: ${m.id}, a line, no state`)
|
|
1261
1365
|
return 0
|
|
1262
1366
|
}
|
|
1263
1367
|
const asked = await idOrOpen(h, this.id, this.text, this.as)
|
|
1264
1368
|
// an update goes where he reads: the thread's newest version
|
|
1265
1369
|
const id = threadOfId(asked, threadsOf(readAll(h.dir).items))?.head.item.id ?? asked
|
|
1266
|
-
const r = await postUpdate(h.dir, id, { who:
|
|
1370
|
+
const r = await postUpdate(h.dir, id, { who: callerLane(this.as) ?? agentName(), state: this.state, text: this.text, files: this.files, ...(this.keep ? { keep: true } : {}) })
|
|
1267
1371
|
const { viewNo, stateOf } = await import('../review/model.ts')
|
|
1268
1372
|
const { readItem } = await import('../review/store.ts')
|
|
1269
1373
|
const x = readItem(h.dir, id)
|
|
@@ -1283,8 +1387,8 @@ export class ReviewWithdrawCommand extends Command {
|
|
|
1283
1387
|
static override paths = [['review', 'withdraw']]
|
|
1284
1388
|
static override usage = Command.Usage({
|
|
1285
1389
|
category: 'Review',
|
|
1286
|
-
description: 'take back an
|
|
1287
|
-
details: `${DETAILS}\n\nA version (or a thread
|
|
1390
|
+
description: 'take back what an agent posted, with the reason: a version by its id, or one message by its id',
|
|
1391
|
+
details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner answered it in chat; the words are the reason, quoted, so it never stays open in the hub.`,
|
|
1288
1392
|
examples: [
|
|
1289
1393
|
['a version taken back', 'sk thread withdraw 20261120-101500-the-logo --why "a newer one follows"'],
|
|
1290
1394
|
['he answered the question in chat', 'sk thread withdraw 20261120-223154-747-agent-vg49 --chat "B only, keep both kill matrices"'],
|
|
@@ -1308,7 +1412,7 @@ export class ReviewWithdrawCommand extends Command {
|
|
|
1308
1412
|
h.out(`${msg}: withdrawn (${why}); it waits on nobody now`)
|
|
1309
1413
|
continue
|
|
1310
1414
|
}
|
|
1311
|
-
const id = await idOf(h.dir, ref)
|
|
1415
|
+
const id = await idOf(h.dir, ref, { verb: 'withdraw', objects: true })
|
|
1312
1416
|
const r = withdraw(h.dir, id, why)
|
|
1313
1417
|
if ('refused' in r) throw new Error(r.refused)
|
|
1314
1418
|
h.out(r.already ? `${id}: withdrawn already (${r.already}), nothing to do` : `${id}: withdrawn, its open questions and changes with it`)
|
|
@@ -1326,10 +1430,10 @@ export class ReviewReopenCommand extends Command {
|
|
|
1326
1430
|
async execute(): Promise<number> {
|
|
1327
1431
|
return run(this.context, async (h) => {
|
|
1328
1432
|
const { reopen } = await import('../review/store.ts')
|
|
1329
|
-
const { followAnswer } = await import('../releases/from-
|
|
1433
|
+
const { followAnswer } = await import('../releases/from-thread.ts')
|
|
1330
1434
|
const { dirname } = await import('node:path')
|
|
1331
1435
|
for (const ref of this.ids) {
|
|
1332
|
-
const id = await idOf(h.dir, ref)
|
|
1436
|
+
const id = await idOf(h.dir, ref, { verb: 'reopen' })
|
|
1333
1437
|
const v = reopen(h.dir, id)
|
|
1334
1438
|
if (!v) throw new Error(`${id}: no such version, or no answer to reopen`)
|
|
1335
1439
|
await followAnswer(dirname(dirname(h.dir)), id, v.status)
|
|
@@ -1392,12 +1496,37 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1392
1496
|
urgent = op === 'ask' ? Option.Boolean('--urgent', false, { description: 'brings back a thread he set aside, at once: only under the bar of a ping (an incident, a hard block, a deadline before it comes back)' }) : undefined
|
|
1393
1497
|
login = op === 'ask' ? Option.Boolean('--login', false, { description: 'with --secret: a login, its account (the email or user name) typed and stored beside it' }) : undefined
|
|
1394
1498
|
replaces = op === 'ask' ? Option.String('--replaces', { description: 'the id of your earlier question (or words) this one supersedes: it folds to one line « superseded by … » and leaves the dock, his answers on it kept' }) : undefined
|
|
1499
|
+
keep = op === 'ask' ? Option.Boolean('--keep', false, { description: 'keep his older open questions of the same kind on this thread open beside this one; by default this one supersedes them' }) : undefined
|
|
1395
1500
|
verdict = op === 'ask' ? Option.Boolean('--verdict', false, { description: "refused: a question waits for the owner's answer already, his answer is its verdict" }) : undefined
|
|
1396
1501
|
|
|
1397
|
-
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1502
|
+
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes. Named
|
|
1503
|
+
* none, it supersedes the older open questions of its kind on the thread (review/supersede.ts olderQuestions):
|
|
1504
|
+
* the newest by `replaces`, each other withdrawn by `withdrawOlder` once this one has its id; `--keep` none */
|
|
1505
|
+
async target(h: Here, q: { kind: AnswerKind; secret?: string }): Promise<{ id: string; replaces?: string; others: string[] }> {
|
|
1506
|
+
if (this.replaces !== undefined) return { ...(await replacing(h.dir, this.id, this.replaces, this.as)), others: [] }
|
|
1507
|
+
const id = await idOrOpen(h, this.id, this.words ?? '', this.as)
|
|
1508
|
+
if (this.keep) return { id, others: [] }
|
|
1509
|
+
const { readAll } = await import('../review/store.ts')
|
|
1510
|
+
const { membersOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1511
|
+
const { olderQuestions } = await import('../review/supersede.ts')
|
|
1512
|
+
const t = threadOfItem(id, threadsOf(readAll(h.dir).items))
|
|
1513
|
+
const older = t === null ? [] : olderQuestions(membersOf(t), q)
|
|
1514
|
+
if (older.length === 0) return { id, others: [] }
|
|
1515
|
+
if (!(await mayHold(h.dir, t!, this.as))) {
|
|
1516
|
+
h.err(` ${older.length} older open question${older.length > 1 ? 's' : ''} of this kind stay open (${older.map((m) => m.id).join(', ')}): another agent holds the thread; sk thread take <address>, then --replaces <id>`)
|
|
1517
|
+
return { id, others: [] }
|
|
1518
|
+
}
|
|
1519
|
+
return { id, replaces: older.at(-1)!.id, others: older.slice(0, -1).map((m) => m.id) }
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
/** the older questions `target` named beside the one it superseded: each withdrawn, « replaced by » the new one */
|
|
1523
|
+
async withdrawOlder(h: Here, t: { replaces?: string; others: string[] }, by: string): Promise<void> {
|
|
1524
|
+
if (t.replaces !== undefined && this.replaces === undefined) h.out(` supersedes ${t.replaces}${t.others.length > 0 ? ` and ${t.others.join(', ')}` : ''}: older open question${t.others.length > 0 ? 's' : ''} of this kind (--keep keeps them)`)
|
|
1525
|
+
const { withdrawObject } = await import('../review/store.ts')
|
|
1526
|
+
for (const re of t.others) {
|
|
1527
|
+
const r = withdrawObject(h.dir, re, `replaced by ${by}`)
|
|
1528
|
+
if ('refused' in r) h.err(` ${re} stays open: ${r.refused}`)
|
|
1529
|
+
}
|
|
1401
1530
|
}
|
|
1402
1531
|
|
|
1403
1532
|
/** after a question: set aside until --after, or brought back by --urgent */
|
|
@@ -1427,7 +1556,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1427
1556
|
|
|
1428
1557
|
async execute(): Promise<number> {
|
|
1429
1558
|
return run(this.context, async (h) => {
|
|
1430
|
-
const { act, readItem } = await import('../review/store.ts')
|
|
1559
|
+
const { act, mediaDir, readItem } = await import('../review/store.ts')
|
|
1431
1560
|
if (op === 'done') h.err(`sk thread done is now sk thread fixed ${this.id} "<what changed>"`)
|
|
1432
1561
|
if (this.verdict) throw new Error("ask --verdict: a question waits for the owner's answer already, his answer is its verdict; a thing made he approves goes in a reply --verdict")
|
|
1433
1562
|
const k = op === 'ask' ? this.kindFlags() : null
|
|
@@ -1435,13 +1564,19 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1435
1564
|
const { postAsk } = await import('../review/store.ts')
|
|
1436
1565
|
const { askStateText } = await import('../review/answer-kinds.ts')
|
|
1437
1566
|
if (!this.words?.trim()) throw new Error(`ask <address | id> "<what you ask>" ${k.label}`)
|
|
1567
|
+
if (k.kind === 'secret') {
|
|
1568
|
+
const joined = (await import('../review/instruction-guards.ts')).joinedSecretAsk(this.words)
|
|
1569
|
+
if (joined !== null) throw new Error(`« ${joined} » asks him for two values as one: one field a value, so ask twice, a --secret each with its own name (wiki tools/shipkit/threads-instructions.md, A field inside a step)`)
|
|
1570
|
+
}
|
|
1438
1571
|
if (k.kind === 'secret' && this.secret) {
|
|
1439
1572
|
const who = await (await import('../secrets/who-reads.ts')).whoReads([this.secret], process.cwd())
|
|
1440
1573
|
if (who[this.secret]?.registered !== true) throw new Error(`--secret ${this.secret}: no row in the secret registry, so the vault would refuse the value he types. Add its row first (the name, what it is for, its scope: wiki identities/_common/secrets-registry.md), then ask again`)
|
|
1441
1574
|
}
|
|
1442
|
-
const {
|
|
1575
|
+
const at = await this.target(h, { kind: k.kind, ...(k.kind === 'secret' && this.secret ? { secret: this.secret } : {}) })
|
|
1576
|
+
const { id, replaces } = at
|
|
1443
1577
|
const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, kind: k.kind, ...(k.kind === 'checklist' ? { options: this.checklist ?? [] } : {}), ...(k.kind === 'secret' ? { secret: { name: this.secret ?? '', login: this.login === true } } : {}), ...(replaces ? { replaces } : {}) })
|
|
1444
1578
|
h.out(`${id} asked: ${askStateText(readItem(h.dir, id)?.thread ?? [m], m)}`)
|
|
1579
|
+
await this.withdrawOlder(h, at, m.id)
|
|
1445
1580
|
await this.later(h, id)
|
|
1446
1581
|
if (k.kind === 'secret') h.out(` his answer reads « stored as ${m.ask?.secret?.name} »; then: sk secret get ${m.ask?.secret?.name}`)
|
|
1447
1582
|
return 0
|
|
@@ -1449,11 +1584,13 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1449
1584
|
if (op === 'ask' && this.options !== undefined) {
|
|
1450
1585
|
const { postAsk } = await import('../review/store.ts')
|
|
1451
1586
|
if (!this.words?.trim()) throw new Error('ask <address | id> "<question>" --option "<a>" --option "<b>" --pick <n>')
|
|
1452
|
-
const
|
|
1587
|
+
const at = await this.target(h, { kind: 'choice' })
|
|
1588
|
+
const { id, replaces } = at
|
|
1453
1589
|
const pick = this.pick === undefined ? undefined : Number(this.pick) - 1
|
|
1454
1590
|
if (pick === undefined) h.err('no --pick: the house rule wants your pick on every question')
|
|
1455
1591
|
const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, options: this.options.map(askOption), ...(pick !== undefined ? { pick } : {}), ...(replaces ? { replaces } : {}) })
|
|
1456
1592
|
h.out(`${id} asked: ${m.ask?.options.map((o, i) => `${i + 1} ${o}${m.ask?.views?.[i] != null ? ' [media]' : ''}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
|
|
1593
|
+
await this.withdrawOlder(h, at, m.id)
|
|
1457
1594
|
await this.later(h, id)
|
|
1458
1595
|
return 0
|
|
1459
1596
|
}
|
|
@@ -1478,7 +1615,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1478
1615
|
}
|
|
1479
1616
|
}
|
|
1480
1617
|
if (op === 'done') {
|
|
1481
|
-
// done is asked of
|
|
1618
|
+
// done is asked of an item he answered « fix »: closed already is the goal reached, unanswered is withdraw's
|
|
1482
1619
|
const { readAll } = await import('../review/store.ts')
|
|
1483
1620
|
const { followedIds } = await import('../review/threads.ts')
|
|
1484
1621
|
const was = readItem(h.dir, id)
|
|
@@ -1504,7 +1641,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1504
1641
|
const x = readItem(h.dir, id)
|
|
1505
1642
|
const st = x ? stateOf(x, false) : null
|
|
1506
1643
|
h.out(`${id} ${op}: ${st ? `${st.state}${st.why ? ` (${st.why})` : ''}${st.topic ? ` ${st.topic}` : ''}${st.worker ? ` ${st.worker}` : ''}` : 'gone'}`)
|
|
1507
|
-
if (op === 'claim' && x) h.out(detail(x, h.dir, false, false, h.say))
|
|
1644
|
+
if (op === 'claim' && x) h.out(detail(x, mediaDir(h.dir), false, false, h.say))
|
|
1508
1645
|
return 0
|
|
1509
1646
|
})
|
|
1510
1647
|
}
|
|
@@ -1566,10 +1703,10 @@ export class ReviewFixedCommand extends Command {
|
|
|
1566
1703
|
})
|
|
1567
1704
|
}
|
|
1568
1705
|
}
|
|
1569
|
-
export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as
|
|
1570
|
-
export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as
|
|
1571
|
-
export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as
|
|
1572
|
-
export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as
|
|
1706
|
+
export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as dispatcher']] })
|
|
1707
|
+
export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as dispatcher']] })
|
|
1708
|
+
export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as dispatcher']] })
|
|
1709
|
+
export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as dispatcher']] })
|
|
1573
1710
|
|
|
1574
1711
|
export class ReviewDispatcherCommand extends Command {
|
|
1575
1712
|
static override paths = [['review', 'dispatcher']]
|
|
@@ -1577,7 +1714,7 @@ export class ReviewDispatcherCommand extends Command {
|
|
|
1577
1714
|
category: 'Review',
|
|
1578
1715
|
description: 'take the dispatcher role: one session at a time routes what is raised',
|
|
1579
1716
|
details: `${DETAILS}\n\nRefused while another holder acted in the last 30 minutes, unless --take. Only in a repo whose review unit declares a dispatcher.`,
|
|
1580
|
-
examples: [['take the role', 'sk thread dispatcher --as
|
|
1717
|
+
examples: [['take the role', 'sk thread dispatcher --as dispatcher']],
|
|
1581
1718
|
})
|
|
1582
1719
|
as = Option.String('--as', { description: 'who takes it (else SK_AGENT)' })
|
|
1583
1720
|
take = Option.Boolean('--take', false, { description: 'take it from an active holder' })
|
|
@@ -1609,7 +1746,7 @@ export class ReviewNextCommand extends Command {
|
|
|
1609
1746
|
|
|
1610
1747
|
async execute(): Promise<number> {
|
|
1611
1748
|
return run(this.context, async (h) => {
|
|
1612
|
-
const { claimNext } = await import('../review/store.ts')
|
|
1749
|
+
const { claimNext, mediaDir } = await import('../review/store.ts')
|
|
1613
1750
|
const { stateOf } = await import('../review/model.ts')
|
|
1614
1751
|
const { detail } = await import('../review/format.ts')
|
|
1615
1752
|
const lane = this.lane?.trim()
|
|
@@ -1623,7 +1760,7 @@ export class ReviewNextCommand extends Command {
|
|
|
1623
1760
|
}
|
|
1624
1761
|
const topic = stateOf(got, false).topic
|
|
1625
1762
|
const read = topic ? h.say.spec.topics[topic]?.read : undefined
|
|
1626
|
-
h.out(`${detail(got, h.dir, false, false, h.say)}${read?.length ? `\nread first: ${read.join(', ')}` : ''}`)
|
|
1763
|
+
h.out(`${detail(got, mediaDir(h.dir), false, false, h.say)}${read?.length ? `\nread first: ${read.join(', ')}` : ''}`)
|
|
1627
1764
|
return 0
|
|
1628
1765
|
})
|
|
1629
1766
|
}
|
|
@@ -1850,13 +1987,13 @@ export class ReviewStageCommand extends Command {
|
|
|
1850
1987
|
const { isPostRating, POST_RATINGS } = await import('../identities/rating.ts')
|
|
1851
1988
|
const missing = [this.text === undefined ? '--text "<the post>"' : null, this.rating === undefined ? `--rating <${POST_RATINGS.join('|')}>` : null].filter((x) => x !== null)
|
|
1852
1989
|
if (this.text === undefined || this.rating === undefined) throw new Error(`sk thread stage ${this.id} needs ${missing.join(' and ')}`)
|
|
1853
|
-
const { stageInputOf,
|
|
1990
|
+
const { stageInputOf, stageOfThread } = await import('../review/stage-thread.ts')
|
|
1854
1991
|
const { askPolish, fitStage, stagedKind, stageDraft, stageDry } = await import('../social/stage.ts')
|
|
1855
1992
|
const { loadSocialUnit } = await import('../social/unit.ts')
|
|
1856
1993
|
if (!isPostRating(this.rating)) throw new Error(`--rating ${this.rating}: one of ${POST_RATINGS.join(', ')}`)
|
|
1857
1994
|
const root = dirname(dirname(h.dir))
|
|
1858
1995
|
const id = await idOf(h.dir, this.id)
|
|
1859
|
-
const s =
|
|
1996
|
+
const s = stageOfThread(h.dir, id)
|
|
1860
1997
|
let pick: string | undefined
|
|
1861
1998
|
if (this.view) {
|
|
1862
1999
|
// a view's number, or the letter it had before; either alone or after its version's number
|
|
@@ -1910,13 +2047,12 @@ export class ReviewAutoCommand extends Command {
|
|
|
1910
2047
|
if (this.verb === undefined) {
|
|
1911
2048
|
if (rules.length === 0) h.out("no auto rule: the repo's review unit declares none (auto: [...]), and no Veille names this repo")
|
|
1912
2049
|
const now = Date.now()
|
|
1913
|
-
const ago = (t: number): string => `${Math.round(Math.abs(now - t) / 60_000)} min`
|
|
1914
2050
|
for (const r of rules) {
|
|
1915
2051
|
const log = readAutoLog(h.dir, r.id)
|
|
1916
2052
|
const next = nextRun(r, log, now)
|
|
1917
2053
|
h.out(
|
|
1918
|
-
`${r.id} every ${r.every} ${log ? `ran ${
|
|
1919
|
-
`${log?.lastRaised ? ` last item ${log.lastRaised.id}` : ''} next ${next <= now ? 'due now' : `in ${
|
|
2054
|
+
`${r.id} every ${r.every} ${log ? `ran ${ageWords(Date.parse(log.at), now)} (${log.ms.toFixed(1)} ms): ${log.answer}${log.error ? `: ${log.error}` : ''}` : 'never ran'}` +
|
|
2055
|
+
`${log?.lastRaised ? ` last item ${log.lastRaised.id}` : ''} next ${next <= now ? 'due now' : `in ${ageWords(now, next, { short: true })}`}`,
|
|
1920
2056
|
)
|
|
1921
2057
|
}
|
|
1922
2058
|
if (rules.length > 0) h.out(`logs: ${autoLogDir(h.dir)}; the hub's daemon runs them`)
|
|
@@ -1946,191 +2082,403 @@ export class ReviewWatchCommand extends Command {
|
|
|
1946
2082
|
static override usage = Command.Usage({
|
|
1947
2083
|
category: 'Review',
|
|
1948
2084
|
description: 'one line per verdict, reply or raised note as it lands; every unseen one first; ends with its owner',
|
|
1949
|
-
details: `${DETAILS}\n\nRun it
|
|
1950
|
-
examples: [
|
|
2085
|
+
details: `${DETAILS}\n\nRun it with --once as a background command (the Bash tool with run_in_background), and again after each burst it prints: it has no 30 minute cap, where the Monitor tool stops after 30 minutes with no word. Unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. It exits within 2 s once a process above it at start is gone or nothing reads its output. An item nobody takes prints 2 minutes after its last message, then every 2 hours.\n\n--house: one watch for every repo where the session holds threads, each line headed [<repo>]; it reads the session's record every 2 s, so a repo where it takes a thread later joins with no restart, and the inbox hook counts it as the session's watch in every repo.`,
|
|
2086
|
+
examples: [
|
|
2087
|
+
['the ear of a session: its threads in every repo, one burst, in a background Bash', 'sk thread watch --mine --house --once'],
|
|
2088
|
+
['the threads this session holds, in this repo', 'sk thread watch --mine --once'],
|
|
2089
|
+
["one lane's items", 'sk thread watch --lane interaction'],
|
|
2090
|
+
],
|
|
1951
2091
|
})
|
|
1952
2092
|
mine = Option.Boolean('--mine', false, { description: "only the threads this Claude Code session holds" })
|
|
1953
2093
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
1954
2094
|
lane = Option.String('--lane', { description: "only that lane's items" })
|
|
2095
|
+
house = Option.Boolean('--house', false, { description: 'with --mine or --session: every repo where the session holds threads, one joined later too, each line headed [<repo>]' })
|
|
2096
|
+
once = Option.Boolean('--once', false, { description: 'print the first burst of new lines, then exit 0: the form for a background Bash, never capped at 30 minutes; a line it printed is never printed again by the next one' })
|
|
2097
|
+
json = Option.Boolean('--json', false, { description: 'each line as one JSON object: text, kind, repo, item, message, who, address (what a shipkit channel reads)' })
|
|
1955
2098
|
|
|
1956
2099
|
async execute(): Promise<number> {
|
|
1957
2100
|
return run(this.context, async (h) => {
|
|
1958
|
-
const {
|
|
1959
|
-
const {
|
|
1960
|
-
const {
|
|
1961
|
-
const { AGENT_RE, coversCard, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
|
|
1962
|
-
const { followedIds, unseen } = await import('../review/threads.ts')
|
|
1963
|
-
const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
|
|
1964
|
-
const { exitWithOwner, liveWatchers, registerWatch } = await import('../review/watchers.ts')
|
|
2101
|
+
const { AGENT_RE } = await import('../review/model.ts')
|
|
2102
|
+
const { exitWithOwner, liveWatchers } = await import('../review/watchers.ts')
|
|
2103
|
+
const { sessionId } = await import('../review/store.ts')
|
|
1965
2104
|
const session = await sessionOf(this.mine, this.session)
|
|
1966
2105
|
// --mine under SK_AGENT is that lane's watch: a lane shares its session's id, its name tells them apart
|
|
1967
|
-
const lane = this.lane?.trim() || (this.mine ?
|
|
2106
|
+
const lane = this.lane?.trim() || (this.mine ? callerLane(undefined) : null)
|
|
1968
2107
|
if (lane !== null && !AGENT_RE.test(lane)) throw new Error(`--lane: « ${lane} » is no lane id (${AGENT_RE.source})`)
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
// who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
|
|
1972
|
-
const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
1973
|
-
const { laneAsksFor, resumeOf } = await import('../review/inbox-read.ts')
|
|
1974
|
-
const { dirname } = await import('node:path')
|
|
1975
|
-
const { sessionId } = await import('../review/store.ts')
|
|
1976
|
-
const by = sessionId()
|
|
1977
|
-
let parties: import('../review/parties.ts').Parties | null = null
|
|
1978
|
-
const mine = (x: Parameters<typeof coversCard>[1]): boolean => hears({ session, lane }, x, byItem, parties)
|
|
2108
|
+
// a house watch follows one session's record: an unfiltered one would hear every thread of every repo
|
|
2109
|
+
if (this.house && session === null) throw new Error('--house hears the threads of one session in every repo it holds them in: with --mine, or --session <id>')
|
|
1979
2110
|
if (session === null && lane === null) {
|
|
1980
2111
|
const { bareWatchTaken } = await import('../review/model.ts')
|
|
1981
2112
|
const taken = bareWatchTaken(liveWatchers(h.dir), process.pid)
|
|
1982
2113
|
if (taken !== null) throw new Error(taken)
|
|
1983
2114
|
}
|
|
1984
|
-
const
|
|
1985
|
-
// before any await: a pull that hangs never keeps a watch alive past its owner
|
|
2115
|
+
const by = sessionId()
|
|
2116
|
+
// before any await of a store: a pull that hangs never keeps a watch alive past its owner
|
|
1986
2117
|
exitWithOwner()
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
const me = lane !== null && by !== null ? parties.lanes.filter((l) => l.name === lane && l.session === by) : []
|
|
1995
|
-
if (me.length > 0 && !me.some((l) => l.live)) {
|
|
1996
|
-
h.err(`review watch: exits, its lane ${lane} ended: its threads pass to its session`)
|
|
1997
|
-
process.exit(0)
|
|
1998
|
-
}
|
|
2118
|
+
await restartWatchOnModelMove(h)
|
|
2119
|
+
// the one stream for every store this watch hears, its own lines untagged
|
|
2120
|
+
await watchFeed(h.err)
|
|
2121
|
+
const f = { session, lane, by, house: this.house, json: this.json, once: this.once }
|
|
2122
|
+
if (!this.house || session === null) {
|
|
2123
|
+
await hearStore(h, f)
|
|
2124
|
+
return new Promise<number>(() => {})
|
|
1999
2125
|
}
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
refused = why
|
|
2015
|
-
}
|
|
2126
|
+
// one process, one loop a store: the store it starts in, then each one the session's record names
|
|
2127
|
+
const { noteSession, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2128
|
+
const { canonicalStore } = await import('../review/item-db.ts')
|
|
2129
|
+
const { dirname, resolve } = await import('node:path')
|
|
2130
|
+
noteSession(h.dir)
|
|
2131
|
+
// one store a loop, by its canonical folder: the checkout of a worktree it starts in, never both
|
|
2132
|
+
const heard = new Set<string>()
|
|
2133
|
+
const retry = new Map<string, number>()
|
|
2134
|
+
const hear = async (x: Here): Promise<string> => {
|
|
2135
|
+
heard.add(canonicalStore(x.dir))
|
|
2136
|
+
const repo = repoNameOf(dirname(dirname(x.dir)))
|
|
2137
|
+
const tagged = (print: (l: string) => void) => (l: string) => print(this.json && l.startsWith('{') ? JSON.stringify({ ...(JSON.parse(l) as object), repo }) : l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
|
|
2138
|
+
await hearStore({ ...x, out: tagged(h.out), err: tagged(h.err) }, f)
|
|
2139
|
+
return repo
|
|
2016
2140
|
}
|
|
2017
|
-
|
|
2018
|
-
const
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
h.out(l)
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
for (const x of unseen(all.items).filter(mine)) {
|
|
2035
|
-
const fresh = watchLines(x, all.items).filter((l) => !shown.has(l.key))
|
|
2036
|
-
for (const l of fresh) {
|
|
2037
|
-
shown.add(l.key)
|
|
2038
|
-
h.out(l.text)
|
|
2039
|
-
}
|
|
2040
|
-
// a session's watch, his message on its ended lane's thread: the way back to that lane
|
|
2041
|
-
const t = byItem.get(x.item.id)
|
|
2042
|
-
const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
|
|
2043
|
-
if (r) {
|
|
2044
|
-
h.out(` ${r.line}`)
|
|
2045
|
-
noteHanded(r.lane, r.session, r.thread)
|
|
2141
|
+
let busy = false
|
|
2142
|
+
const more = async (): Promise<string[]> => {
|
|
2143
|
+
if (busy) return []
|
|
2144
|
+
busy = true
|
|
2145
|
+
const joined: string[] = []
|
|
2146
|
+
try {
|
|
2147
|
+
for (const dir of await recordedStores(session, (d) => heard.has(d) || (retry.get(resolve(d)) ?? 0) > Date.now())) {
|
|
2148
|
+
try {
|
|
2149
|
+
joined.push(await hear(await hereAt(dir, h.out, h.err)))
|
|
2150
|
+
} catch (e) {
|
|
2151
|
+
// a store that does not open now: said once a minute, read again then
|
|
2152
|
+
retry.set(resolve(dir), Date.now() + 60_000)
|
|
2153
|
+
h.err(`review watch: WARN ${dir} does not open now (${(e as Error).message.split('\n')[0]}): tried again in a minute`)
|
|
2154
|
+
}
|
|
2046
2155
|
}
|
|
2156
|
+
} finally {
|
|
2157
|
+
busy = false
|
|
2047
2158
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2159
|
+
return joined
|
|
2160
|
+
}
|
|
2161
|
+
const home = canonicalStore(h.dir)
|
|
2162
|
+
const first = [await hear(home === resolve(h.dir) ? h : await hereAt(home, h.out, h.err)), ...(await more())]
|
|
2163
|
+
h.err(`review watch: hears ${first.join(', ')}; a repo where this session takes a thread joins within 2 s`)
|
|
2164
|
+
setInterval(
|
|
2165
|
+
() =>
|
|
2166
|
+
void more()
|
|
2167
|
+
.then((js) => js.forEach((r) => h.err(`review watch: hears ${r} too`)))
|
|
2168
|
+
.catch(() => {}),
|
|
2169
|
+
2000,
|
|
2170
|
+
)
|
|
2171
|
+
return new Promise<number>(() => {})
|
|
2172
|
+
})
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/** the saves of every store a `--once` watch hears, run as it exits */
|
|
2177
|
+
const onceSaves: (() => void)[] = []
|
|
2178
|
+
|
|
2179
|
+
/** what the earlier `--once` runs of one party printed in one store (review/watchers.ts onceFile) */
|
|
2180
|
+
async function onceMemory(dir: string, session: string | null, lane: string | null): Promise<{ printed: string[]; save: (shown: ReadonlySet<string>) => void }> {
|
|
2181
|
+
const { dirname } = await import('node:path')
|
|
2182
|
+
const { mkdirSync, readFileSync } = await import('node:fs')
|
|
2183
|
+
const { atomicWriteJson } = await import('../core/atomic-write.ts')
|
|
2184
|
+
const { onceFile } = await import('../review/watchers.ts')
|
|
2185
|
+
const file = onceFile(dir, session, lane)
|
|
2186
|
+
const folder = dirname(file)
|
|
2187
|
+
let printed: string[] = []
|
|
2188
|
+
try {
|
|
2189
|
+
const v = JSON.parse(readFileSync(file, 'utf8')) as unknown
|
|
2190
|
+
if (Array.isArray(v)) printed = v.filter((x): x is string => typeof x === 'string')
|
|
2191
|
+
} catch {}
|
|
2192
|
+
return {
|
|
2193
|
+
printed,
|
|
2194
|
+
save: (shown) => {
|
|
2195
|
+
try {
|
|
2196
|
+
mkdirSync(folder, { recursive: true })
|
|
2197
|
+
atomicWriteJson(file, [...shown].slice(-2000))
|
|
2198
|
+
} catch {}
|
|
2199
|
+
},
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/** a watch outlives a change of the thread model: once a read fails on an item the new model wrote, it runs again with
|
|
2204
|
+
* its args, same pid, onto code that loads (review/model-moved.ts) */
|
|
2205
|
+
async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
2206
|
+
const { modelWatch, MODEL_FILE } = await import('../review/model-moved.ts')
|
|
2207
|
+
modelWatch.onMove(async (why) => {
|
|
2208
|
+
const { bootEntries, probeLoad } = await import('../core/load-probe.ts')
|
|
2209
|
+
const { OWN_LIB } = await import('../core/last-good.ts')
|
|
2210
|
+
const { join } = await import('node:path')
|
|
2211
|
+
const a = await probeLoad(OWN_LIB, [...bootEntries(OWN_LIB), MODEL_FILE, join(OWN_LIB, 'src/review/store.ts')])
|
|
2212
|
+
if (!a.ok) {
|
|
2213
|
+
h.err(`review watch: WARN ${why}, and ${a.file} fails to load (${a.error}): this watch keeps its model until it loads`)
|
|
2214
|
+
return false
|
|
2215
|
+
}
|
|
2216
|
+
h.err(`review watch: ${why}: it runs again with its args`)
|
|
2217
|
+
const { reexecSelf } = await import('../core/reexec.ts')
|
|
2218
|
+
return reexecSelf()
|
|
2219
|
+
})
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
/** one store heard by a watch of filter `f`, until the process ends: registered beside it, its lines printed through `h` */
|
|
2223
|
+
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; json?: boolean; once?: boolean }): Promise<void> {
|
|
2224
|
+
const { session, lane, by } = f
|
|
2225
|
+
// --once: what an earlier run of this party printed is never printed again, and the process exits 0 once a burst
|
|
2226
|
+
// of new lines settled (400 ms), so a background Bash hears it with no 30 minute cap and no loop of turns
|
|
2227
|
+
const once = f.once === true ? await onceMemory(h.dir, session, lane) : null
|
|
2228
|
+
let settle: ReturnType<typeof setTimeout> | null = null
|
|
2229
|
+
// one line out: its text, or under --json the object a shipkit channel reads (orchestrator/channel.ts)
|
|
2230
|
+
const say = (text: string, m: { kind: string; item?: string; message?: string; who?: string; address?: string }): void => {
|
|
2231
|
+
h.out(f.json === true ? JSON.stringify({ text, ...m }) : text)
|
|
2232
|
+
if (once === null) return
|
|
2233
|
+
if (settle) clearTimeout(settle)
|
|
2234
|
+
// every store of a --house watch saves what it printed, then the process exits
|
|
2235
|
+
settle = setTimeout(() => {
|
|
2236
|
+
for (const save of onceSaves) save()
|
|
2237
|
+
process.exit(0)
|
|
2238
|
+
}, 400)
|
|
2239
|
+
}
|
|
2240
|
+
const { existsSync, mkdirSync, watch } = await import('node:fs')
|
|
2241
|
+
const { mediaDir, readAll, scanStamp } = await import('../review/store.ts')
|
|
2242
|
+
const { modelWatch } = await import('../review/model-moved.ts')
|
|
2243
|
+
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2244
|
+
const { coversItem, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
|
|
2245
|
+
const { followedIds, unseen } = await import('../review/threads.ts')
|
|
2246
|
+
const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
|
|
2247
|
+
const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
|
|
2248
|
+
const { hears, holderOf, listenersOf, ownAddressesOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
|
|
2249
|
+
let byItem = new Map<string, import('../review/threads.ts').Thread>()
|
|
2250
|
+
// who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
|
|
2251
|
+
const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2252
|
+
const { laneAsksFor, resumeOf } = await import('../review/inbox-read.ts')
|
|
2253
|
+
const { hearingHolders, readRole } = await import('../orchestrator/role.ts')
|
|
2254
|
+
const { placeParties, placeWatchers } = await import('../orchestrator/places.ts')
|
|
2255
|
+
const { withOtherPlaces } = await import('../review/parties.ts')
|
|
2256
|
+
const { shareOf, shareText } = await import('../orchestrator/share.ts')
|
|
2257
|
+
const { dirname } = await import('node:path')
|
|
2258
|
+
let parties: import('../review/parties.ts').Parties | null = null
|
|
2259
|
+
const mine = (x: Parameters<typeof coversItem>[1]): boolean => hears({ session, lane }, x, byItem, parties)
|
|
2260
|
+
// the owner's words that name another agent are that agent's (wiki tools/shipkit/threads-how-it-fits.md, Mentions)
|
|
2261
|
+
const to = (x: Parameters<typeof coversItem>[1], m: import('../review/model.ts').Message): boolean => wordReaches({ session, lane }, x, m, byItem, parties)
|
|
2262
|
+
const beat = registerWatch(h.dir, { session, lane }, new Date(), by, f.house)
|
|
2263
|
+
setInterval(() => beat(), 10_000)
|
|
2264
|
+
const known = async (): Promise<void> => {
|
|
2265
|
+
if (session === null && lane === null) return
|
|
2266
|
+
const all = readAll(h.dir)
|
|
2267
|
+
const ids = new Set(threadsOf(all.items, h.say.spec).flatMap((t) => [...(t.head.item.origin.by === 'agent' && t.head.item.origin.session ? [t.head.item.origin.session] : []), ...(holderOf(t)?.session ?? [])]))
|
|
2268
|
+
parties = await readParties({ sessions: [...ids, ...(session ? [session] : [])], watchers: liveWatchers(h.dir), self: by, roles: hearingHolders, places: placeParties })
|
|
2269
|
+
// a lane's watch ends with its lane: its threads pass to its session, whose hook or watch hears them
|
|
2270
|
+
const me = lane !== null && by !== null ? parties.lanes.filter((l) => l.name === lane && l.session === by) : []
|
|
2271
|
+
if (me.length > 0 && !me.some((l) => l.live)) {
|
|
2272
|
+
h.err(`review watch: exits, its lane ${lane} ended: its threads pass to its session`)
|
|
2273
|
+
process.exit(0)
|
|
2274
|
+
}
|
|
2275
|
+
// one ear a session: its shipkit channel, once proven, hears for it, so a plain watch of it leaves
|
|
2276
|
+
if (lane === null && session !== null && process.env.SHIPKIT_CHANNEL_EAR !== '1') {
|
|
2277
|
+
const { channelHears } = await import('../orchestrator/role.ts')
|
|
2278
|
+
if (channelHears(session)) {
|
|
2279
|
+
h.err(`review watch: exits, this session's shipkit channel hears for it: nothing to arm again`)
|
|
2280
|
+
process.exit(0)
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
await known().catch(() => {})
|
|
2285
|
+
setInterval(() => void known().catch(() => {}), 30_000)
|
|
2286
|
+
const shown = new Set<string>(once?.printed ?? [])
|
|
2287
|
+
if (once !== null) onceSaves.push(() => once.save(shown))
|
|
2288
|
+
// a store refused for a while (a fold or a way back of the daemon file walks): one line, and the next poll
|
|
2289
|
+
// reads again; never a watch that dies and hears nothing more
|
|
2290
|
+
let refused: string | null = null
|
|
2291
|
+
const safely = (fn: () => void): void => {
|
|
2292
|
+
try {
|
|
2293
|
+
fn()
|
|
2294
|
+
if (refused !== null) h.err(`review: ok, the store reads again: this watch goes on`)
|
|
2295
|
+
refused = null
|
|
2296
|
+
} catch (e) {
|
|
2297
|
+
const why = (e as Error).message.split('\n')[0] ?? ''
|
|
2298
|
+
if (refused === null) h.err(`review: WARN the store does not read now (${why}): this watch reads again at its next poll`)
|
|
2299
|
+
refused = why
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
const tick = (): void => safely(read)
|
|
2303
|
+
const read = (): void => {
|
|
2304
|
+
const all = readAll(h.dir)
|
|
2305
|
+
// the model moved under this watch: it runs again, and its broken lines are the old model's
|
|
2306
|
+
if (all.broken.length > 0 && modelWatch.readFailed()) return
|
|
2307
|
+
byItem = threadByItem(threadsOf(all.items, h.say.spec))
|
|
2308
|
+
for (const b of all.broken) {
|
|
2309
|
+
const key = `broken ${b.id} ${b.error}`
|
|
2310
|
+
if (!shown.has(key)) h.err(`review: FAIL ${b.id}: ${b.error}`)
|
|
2311
|
+
shown.add(key)
|
|
2312
|
+
}
|
|
2313
|
+
// his request for a lane, first: a session's watch (or a bare one) is the orchestrator's ear
|
|
2314
|
+
if (lane === null && (parties !== null || session === null)) {
|
|
2315
|
+
for (const l of laneAsksFor({ repo: repoNameOf(dirname(dirname(h.dir))), root: dirname(dirname(h.dir)), dir: h.dir, here: true, ...all, say: h.say }, { session, lane: null }, parties ?? { sessions: [], lanes: [] })) {
|
|
2316
|
+
if (shown.has(l)) continue
|
|
2317
|
+
shown.add(l)
|
|
2318
|
+
say(l, { kind: 'lane_ask' })
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
for (const x of unseen(all.items, to).filter(mine)) {
|
|
2322
|
+
const fresh = watchLines(x, all.items, mediaDir(h.dir), to).filter((l) => !shown.has(l.key))
|
|
2323
|
+
const t0 = byItem.get(x.item.id)
|
|
2324
|
+
const address = (t0 ? ownAddressesOf(t0, h.say.spec)[0] : undefined) ?? x.item.id
|
|
2325
|
+
for (const l of fresh) {
|
|
2326
|
+
shown.add(l.key)
|
|
2327
|
+
const message = l.key.split('#')[1]
|
|
2328
|
+
const who = message === undefined ? 'owner' : (x.thread.find((m) => m.id === message)?.who ?? 'owner')
|
|
2329
|
+
say(l.text, { kind: 'word', item: x.item.id, ...(message ? { message } : {}), who, address })
|
|
2330
|
+
}
|
|
2331
|
+
// a session's watch, his message on its ended lane's thread: the way back to that lane
|
|
2332
|
+
const t = byItem.get(x.item.id)
|
|
2333
|
+
const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
|
|
2334
|
+
if (r) {
|
|
2335
|
+
say(` ${r.line}`, { kind: 'resume', item: x.item.id })
|
|
2336
|
+
noteHanded(r.lane, r.session, r.thread)
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
// the orchestrator role's share: while this session holds the role of this store's project, the owner's words no
|
|
2340
|
+
// other live watch hears, here or on another place of the project, since its claim, each once, and of those the
|
|
2341
|
+
// ones this place answers for (orchestrator/share.ts)
|
|
2342
|
+
if (lane === null && session !== null && parties !== null) {
|
|
2343
|
+
const repo = repoNameOf(dirname(dirname(h.dir)))
|
|
2344
|
+
const r = readRole(repo)
|
|
2345
|
+
if (r?.holder?.session === session) {
|
|
2346
|
+
const others = [...liveWatchers(h.dir), ...placeWatchers(repo)].filter((w) => !(w.lane === null && (w.session === session || w.by === session)))
|
|
2347
|
+
// the other places as the view says them now, not as the last read of the parties (30 s ago at most)
|
|
2348
|
+
const placed = withOtherPlaces({ sessions: parties.sessions.filter((s) => s.place === undefined), lanes: parties.lanes }, placeParties())
|
|
2349
|
+
for (const l of shareOf({ items: all.items, spec: h.say.spec, parties: placed, watchers: others, media: mediaDir(h.dir), since: r.holder.since, me: { session, repo } })) {
|
|
2350
|
+
if (shown.has(l.key)) continue
|
|
2051
2351
|
shown.add(l.key)
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
// an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
|
|
2055
|
-
const now = new Date()
|
|
2056
|
-
const followed = followedIds(all.items)
|
|
2057
|
-
const watchers = liveWatchers(h.dir)
|
|
2058
|
-
for (const x of all.items) {
|
|
2059
|
-
if (lane !== null && laneOf(x) !== lane) continue
|
|
2060
|
-
const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now, h.say.spec.dispatcher)
|
|
2061
|
-
if (why === null) continue
|
|
2062
|
-
const round = Math.floor((now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)) / UNTAKEN_AGAIN_MS)
|
|
2063
|
-
const key = `untaken ${x.item.id} ${why} ${round}`
|
|
2064
|
-
if (shown.has(key)) continue
|
|
2065
|
-
shown.add(key)
|
|
2066
|
-
h.out(untakenLine(x, why, lane))
|
|
2352
|
+
say(shareText(l), { kind: 'share', item: l.item, ...(l.message ? { message: l.message } : {}), who: l.player ? 'player' : 'owner', address: l.address })
|
|
2067
2353
|
}
|
|
2068
2354
|
}
|
|
2355
|
+
}
|
|
2356
|
+
for (const x of all.items.filter(mine)) {
|
|
2357
|
+
const l = raisedLine(x)
|
|
2358
|
+
if (l === null || shown.has(l.key)) continue
|
|
2359
|
+
shown.add(l.key)
|
|
2360
|
+
say(l.text, { kind: 'raised', item: x.item.id, who: x.item.origin.by })
|
|
2361
|
+
}
|
|
2362
|
+
// an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
|
|
2363
|
+
const now = new Date()
|
|
2364
|
+
const followed = followedIds(all.items)
|
|
2365
|
+
const watchers = liveWatchers(h.dir)
|
|
2366
|
+
for (const x of all.items) {
|
|
2367
|
+
if (lane !== null && laneOf(x) !== lane) continue
|
|
2368
|
+
const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now, h.say.spec.dispatcher)
|
|
2369
|
+
if (why === null) continue
|
|
2370
|
+
const round = Math.floor((now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)) / UNTAKEN_AGAIN_MS)
|
|
2371
|
+
const key = `untaken ${x.item.id} ${why} ${round}`
|
|
2372
|
+
if (shown.has(key)) continue
|
|
2373
|
+
shown.add(key)
|
|
2374
|
+
say(untakenLine(x, why, lane), { kind: 'untaken', item: x.item.id })
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
tick()
|
|
2378
|
+
// the grace and the reminder pass with time alone: one read a minute
|
|
2379
|
+
setInterval(tick, 60_000)
|
|
2380
|
+
// the store the switch names, read again at each poll (a process reads the switch at most once a second), so a
|
|
2381
|
+
// watch follows a move while it runs. The rows: their stamp is a query of a few µs, asked every 50 ms, read at
|
|
2382
|
+
// once. The files: a watch of the folder asks again (debounced), and a stat stamp every 5 s catches a missed event
|
|
2383
|
+
let soon: ReturnType<typeof setTimeout> | null = null
|
|
2384
|
+
const again = (): void => {
|
|
2385
|
+
if (soon) clearTimeout(soon)
|
|
2386
|
+
soon = setTimeout(() => {
|
|
2387
|
+
soon = null
|
|
2069
2388
|
tick()
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2389
|
+
}, threadsInDb() ? 0 : 150)
|
|
2390
|
+
}
|
|
2391
|
+
// the store's own poll, for a watch the daemon's stream does not feed: no home, a store it serves no hub for, a
|
|
2392
|
+
// daemon that does not answer (review/watch-feed.ts)
|
|
2393
|
+
let polling = false
|
|
2394
|
+
let folderWatched = false
|
|
2395
|
+
const watchFolder = (): void => {
|
|
2396
|
+
if (folderWatched) return
|
|
2397
|
+
folderWatched = true
|
|
2398
|
+
if (!existsSync(h.dir)) mkdirSync(h.dir, { recursive: true })
|
|
2399
|
+
watch(h.dir, { recursive: true }, () => {
|
|
2400
|
+
if (polling && !threadsInDb()) again()
|
|
2401
|
+
})
|
|
2402
|
+
}
|
|
2403
|
+
let stamp = ''
|
|
2404
|
+
let scanned = Date.now()
|
|
2405
|
+
let loop: ReturnType<typeof setInterval> | null = null
|
|
2406
|
+
const poll = (on: boolean): void => {
|
|
2407
|
+
polling = on
|
|
2408
|
+
if (!on) {
|
|
2409
|
+
if (loop) clearInterval(loop)
|
|
2410
|
+
loop = null
|
|
2411
|
+
return
|
|
2412
|
+
}
|
|
2413
|
+
if (loop) return
|
|
2414
|
+
if (!threadsInDb()) watchFolder()
|
|
2415
|
+
stamp = ''
|
|
2416
|
+
loop = setInterval(() => {
|
|
2417
|
+
const rows = threadsInDb()
|
|
2418
|
+
// the files' stamp walks every item: once every 5 s, never at the rows' pace
|
|
2419
|
+
if (!rows) {
|
|
2420
|
+
watchFolder()
|
|
2421
|
+
if (Date.now() - scanned < 5000) return
|
|
2082
2422
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
if (
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2423
|
+
scanned = Date.now()
|
|
2424
|
+
// a refused stamp, or one read again after a refusal: the read says it, once
|
|
2425
|
+
try {
|
|
2426
|
+
const now = scanStamp(h.dir)
|
|
2427
|
+
if (now !== stamp || refused !== null) again()
|
|
2428
|
+
stamp = now
|
|
2429
|
+
} catch {
|
|
2430
|
+
again()
|
|
2091
2431
|
}
|
|
2092
|
-
|
|
2093
|
-
// the sources: pulled now and every 30 s, a new item lands and the tick prints it
|
|
2094
|
-
await pull(h)
|
|
2095
|
-
if (h.unit?.sources?.length) setInterval(() => void pull(h), 30_000)
|
|
2096
|
-
let stamp = ''
|
|
2097
|
-
let scanned = Date.now()
|
|
2098
|
-
setInterval(() => {
|
|
2099
|
-
const rows = cardsInDb()
|
|
2100
|
-
// the files' stamp walks every card: once every 5 s, never at the rows' pace
|
|
2101
|
-
if (!rows) {
|
|
2102
|
-
watchFolder()
|
|
2103
|
-
if (Date.now() - scanned < 5000) return
|
|
2104
|
-
}
|
|
2105
|
-
scanned = Date.now()
|
|
2106
|
-
// a refused stamp, or one read again after a refusal: the read says it, once
|
|
2107
|
-
try {
|
|
2108
|
-
const now = scanStamp(h.dir)
|
|
2109
|
-
if (now !== stamp || refused !== null) again()
|
|
2110
|
-
stamp = now
|
|
2111
|
-
} catch {
|
|
2112
|
-
again()
|
|
2113
|
-
}
|
|
2114
|
-
}, 50)
|
|
2115
|
-
return new Promise<number>(() => {})
|
|
2116
|
-
})
|
|
2432
|
+
}, 50)
|
|
2117
2433
|
}
|
|
2434
|
+
// the sources: pulled now and every 30 s, a new item lands and the tick prints it
|
|
2435
|
+
await pull(h)
|
|
2436
|
+
if (h.unit?.sources?.length) setInterval(() => void pull(h), 30_000)
|
|
2437
|
+
const feed = await watchFeed(h.err)
|
|
2438
|
+
if (feed === null) return poll(true)
|
|
2439
|
+
// a daemon down is said once for the whole watch by the feed; a store it serves no hub for, once here
|
|
2440
|
+
let saidAlone = false
|
|
2441
|
+
feed.hear(h.dir, {
|
|
2442
|
+
moved: again,
|
|
2443
|
+
push: () => {
|
|
2444
|
+
poll(false)
|
|
2445
|
+
again()
|
|
2446
|
+
},
|
|
2447
|
+
poll: (why) => {
|
|
2448
|
+
if (why !== null && !saidAlone) h.err(`review watch: ${why}: this watch reads the store itself`)
|
|
2449
|
+
if (why !== null) saidAlone = true
|
|
2450
|
+
poll(true)
|
|
2451
|
+
},
|
|
2452
|
+
})
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
/** the one stream of the daemon's store moves this process hears, null where no home runs (SHIPKIT_NO_HOME, CI, a
|
|
2456
|
+
* machine with none): a watch then polls its store */
|
|
2457
|
+
let feedHeld: import('../review/watch-feed.ts').WatchFeed | null | undefined
|
|
2458
|
+
/** `say`: the watch's own line, untagged: the first caller's, the command's before any store */
|
|
2459
|
+
async function watchFeed(say: (l: string) => void): Promise<import('../review/watch-feed.ts').WatchFeed | null> {
|
|
2460
|
+
if (feedHeld !== undefined) return feedHeld
|
|
2461
|
+
const set = (v: string | undefined): boolean => v != null && v !== ''
|
|
2462
|
+
const { homeWanted } = await import('../home/home-start.ts')
|
|
2463
|
+
if (set(process.env.SHIPKIT_NO_HOME) || set(process.env.CI) || !homeWanted()) return (feedHeld = null)
|
|
2464
|
+
const { daemonUrl } = await import('../home/home-paths.ts')
|
|
2465
|
+
const { WatchFeed } = await import('../review/watch-feed.ts')
|
|
2466
|
+
return (feedHeld = new WatchFeed(daemonUrl(), { say }))
|
|
2118
2467
|
}
|
|
2119
2468
|
|
|
2120
2469
|
/** the review folders of this machine's house, its archived repos included: what a move carries */
|
|
2121
2470
|
async function houseStores(): Promise<string[]> {
|
|
2122
2471
|
const { findRepoRoot } = await import('../ts/config.ts')
|
|
2123
|
-
const { houseRepos } = await import('../
|
|
2472
|
+
const { houseRepos } = await import('../house/project-gutter.ts')
|
|
2124
2473
|
const { homedir } = await import('node:os')
|
|
2125
2474
|
const { storeDir } = await import('../review/store.ts')
|
|
2126
2475
|
const house = houseRepos(findRepoRoot(process.cwd()), homedir())
|
|
2127
2476
|
if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it moves`)
|
|
2128
2477
|
const { existsSync } = await import('node:fs')
|
|
2129
2478
|
const repos = [...house.repos, ...house.archived].map((r) => r.path)
|
|
2130
|
-
// a lane's worktree holds the
|
|
2479
|
+
// a lane's worktree holds the items it sent there: they join their repo's rows
|
|
2131
2480
|
const trees = repos.flatMap((r) => {
|
|
2132
|
-
|
|
2133
|
-
return (p.stdout?.toString() ?? '').split('\n').flatMap((l) => (l.startsWith('worktree ') && l.slice(9) !== r ? [l.slice(9)] : []))
|
|
2481
|
+
return realGit.runSync(r, ['worktree', 'list', '--porcelain']).out.split('\n').flatMap((l) => (l.startsWith('worktree ') && l.slice(9) !== r ? [l.slice(9)] : []))
|
|
2134
2482
|
})
|
|
2135
2483
|
return [...repos, ...trees.filter((t) => existsSync(storeDir(t)))].map((r) => storeDir(r))
|
|
2136
2484
|
}
|
|
@@ -2156,17 +2504,16 @@ export class ReviewMoveCommand extends Command {
|
|
|
2156
2504
|
const stores = await houseStores()
|
|
2157
2505
|
const { moveBack, moveGo, tidyFiles } = await import('../review/move.ts')
|
|
2158
2506
|
const dry = !this.go
|
|
2159
|
-
// one move or look of the
|
|
2160
|
-
const {
|
|
2161
|
-
const
|
|
2162
|
-
|
|
2163
|
-
if (!dry && lease == null) throw new Error(`a look of the hq threads job or another move runs (pid ${leaseHolder(cardsLease())?.pid ?? '?'}): run it again once it ended`)
|
|
2507
|
+
// one move or look of the threads job at a time: the job would send what the move is writing
|
|
2508
|
+
const { threadsLeaseHolder, tryThreadsLease } = await import('../hq/thread-sync.ts')
|
|
2509
|
+
const lease = dry ? null : tryThreadsLease('review move')
|
|
2510
|
+
if (!dry && lease == null) throw new Error(`a look of the hq threads job or another move runs (pid ${threadsLeaseHolder()?.pid ?? '?'}): run it again once it ended`)
|
|
2164
2511
|
try {
|
|
2165
2512
|
const r = this.tidy ? await tidyFiles(stores, { dry, proof: await tidyProof(stores) }) : this.back ? await moveBack(stores, { dry }) : await moveGo(stores, { dry, hqDiff: hqDiffOf(stores) })
|
|
2166
2513
|
for (const l of r.lines) (l.startsWith('WARN') ? err : out)(l)
|
|
2167
|
-
const {
|
|
2514
|
+
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2168
2515
|
const { BACK_FIRST } = await import('../review/move.ts')
|
|
2169
|
-
if (
|
|
2516
|
+
if (threadsInDb()) out(BACK_FIRST)
|
|
2170
2517
|
if (dry) out(`a look: nothing ${this.tidy ? 'removed' : 'moved'}. sk thread move ${this.tidy ? '--tidy --go removes' : this.back ? '--back --go moves' : '--go moves'}`)
|
|
2171
2518
|
return r.ok ? 0 : 1
|
|
2172
2519
|
} finally {
|
|
@@ -2182,18 +2529,18 @@ export class ReviewMoveCommand extends Command {
|
|
|
2182
2529
|
/** what the tidy proves outside the store: the names of each repo's rows the hq lacks or holds at another rev (the
|
|
2183
2530
|
* check hq-cards, the hq asked once), and the Space's word on each file */
|
|
2184
2531
|
async function tidyProof(stores: readonly string[]): Promise<import('../review/move.ts').TidyProof> {
|
|
2185
|
-
const {
|
|
2532
|
+
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2186
2533
|
const { confirmedUp } = await import('../media-store/remote.ts')
|
|
2187
2534
|
const up = (key: string, size: number): Promise<boolean> => confirmedUp(key, size)
|
|
2188
|
-
if (!
|
|
2535
|
+
if (!threadsOn()) return { hqLacks: async () => ({ refused: 'the switch hq-cards is off: no hq holds them' }), up }
|
|
2189
2536
|
const { myHq } = await import('../hq/hq-local.ts')
|
|
2190
2537
|
const hq = myHq()
|
|
2191
2538
|
if ('refused' in hq) return { hqLacks: async () => ({ refused: `the hq is not reached (${hq.refused})` }), up }
|
|
2192
2539
|
const { dirname } = await import('node:path')
|
|
2193
2540
|
const { held, left } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2194
|
-
const diff = await
|
|
2541
|
+
const diff = await threadsDiff(hq, held)
|
|
2195
2542
|
if ('refused' in diff) return { hqLacks: async () => ({ refused: `the hq refused the check: ${diff.refused}` }), up }
|
|
2196
|
-
const { repoIdOf } = await import('../review/
|
|
2543
|
+
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2197
2544
|
const byRepo = new Map(diff.map((d) => [d.repo, new Set([...d.onlyHere, ...d.differ])]))
|
|
2198
2545
|
return {
|
|
2199
2546
|
hqLacks: async (dir) => {
|
|
@@ -2209,14 +2556,14 @@ async function tidyProof(stores: readonly string[]): Promise<import('../review/m
|
|
|
2209
2556
|
* proof that nothing it leaves behind is missing elsewhere. Null with the switch off */
|
|
2210
2557
|
function hqDiffOf(stores: readonly string[]): () => Promise<string[] | null> {
|
|
2211
2558
|
return async () => {
|
|
2212
|
-
const {
|
|
2213
|
-
if (!
|
|
2559
|
+
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2560
|
+
if (!threadsOn()) return null
|
|
2214
2561
|
const { myHq } = await import('../hq/hq-local.ts')
|
|
2215
2562
|
const hq = myHq()
|
|
2216
2563
|
if ('refused' in hq) return [`the hq is not reached (${hq.refused}): the check hq-cards cannot prove both sides equal`]
|
|
2217
2564
|
const { dirname } = await import('node:path')
|
|
2218
2565
|
const { held } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2219
|
-
const diff = await
|
|
2566
|
+
const diff = await threadsDiff(hq, held)
|
|
2220
2567
|
if ('refused' in diff) return [`the hq refused the check: ${diff.refused}`]
|
|
2221
2568
|
return diff.flatMap((d) => (d.onlyHere.length + d.onlyHq.length + d.differ.length === 0 ? [] : [`${d.repo}: ${d.onlyHere.length} only here, ${d.onlyHq.length} only in the hq, ${d.differ.length} at two revs (${[...d.onlyHere, ...d.onlyHq, ...d.differ].slice(0, 3).join(', ')})`]))
|
|
2222
2569
|
}
|
|
@@ -2236,24 +2583,24 @@ export class ReviewExportCommand extends Command {
|
|
|
2236
2583
|
|
|
2237
2584
|
async execute(): Promise<number> {
|
|
2238
2585
|
return run(this.context, async (h) => {
|
|
2239
|
-
const {
|
|
2586
|
+
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2240
2587
|
const { resolve } = await import('node:path')
|
|
2241
2588
|
if (this.all === this.ids.length > 0) throw new Error('give item ids or --all')
|
|
2242
2589
|
const to = resolve(this.to)
|
|
2243
2590
|
if (to === resolve(h.dir)) throw new Error(`--to ${this.to}: the store itself; sk thread move --back --go writes the rows into the store`)
|
|
2244
2591
|
const ids = this.all ? undefined : await Promise.all(this.ids.map((r) => idOf(h.dir, r)))
|
|
2245
2592
|
let r: import('../review/move.ts').Moved
|
|
2246
|
-
if (
|
|
2593
|
+
if (threadsInDb()) r = (await import('../review/move.ts')).exportRows(h.dir, { to, ...(ids ? { ids } : {}) })
|
|
2247
2594
|
else {
|
|
2248
2595
|
// the files are the store: a copy of each folder is the export
|
|
2249
2596
|
const { cpSync, existsSync } = await import('node:fs')
|
|
2250
|
-
const {
|
|
2597
|
+
const { itemIds } = await import('../review/store.ts')
|
|
2251
2598
|
const { join } = await import('node:path')
|
|
2252
|
-
const want = ids ??
|
|
2599
|
+
const want = ids ?? itemIds(h.dir)
|
|
2253
2600
|
for (const id of want) if (!existsSync(join(to, id))) cpSync(join(h.dir, id), join(to, id), { recursive: true })
|
|
2254
|
-
r = { dir: h.dir,
|
|
2601
|
+
r = { dir: h.dir, items: want.length, heads: want.length, msgs: 0, gone: 0, same: 0, files: 0, kept: [], broken: [], read: [] }
|
|
2255
2602
|
}
|
|
2256
|
-
h.out(`review: ${r.
|
|
2603
|
+
h.out(`review: ${r.items} items written into ${to} (${r.heads} heads, ${r.msgs} messages${r.media ? `, ${r.media.copied} media files` : ''})`)
|
|
2257
2604
|
for (const k of r.kept) h.out(` kept: ${k}`)
|
|
2258
2605
|
for (const b of r.broken) h.err(` does not read: ${b}`)
|
|
2259
2606
|
if (r.media && r.media.missing.length > 0) h.out(` ${r.media.missing.length} media files this machine no longer holds (the Space has them by their key in the head): ${r.media.missing.slice(0, 5).join(', ')}`)
|
|
@@ -2376,8 +2723,8 @@ export class ThreadAttachCommand extends Command {
|
|
|
2376
2723
|
static override paths = [['thread', 'attach']]
|
|
2377
2724
|
static override usage = Command.Usage({
|
|
2378
2725
|
category: 'Review',
|
|
2379
|
-
description: '
|
|
2380
|
-
details: `${DETAILS}\n\
|
|
2726
|
+
description: 'link one more object to a thread, never its own address: that object then finds the thread',
|
|
2727
|
+
details: `${DETAILS}\n\nThe thread is its address or an id. The object's thread control then finds the thread. A link: many threads may link one object. Page: wiki tools/shipkit/threads.md`,
|
|
2381
2728
|
examples: [['link a media', 'sk thread attach 20261119-233610-trailer-v15 media:thumbnail-v3']],
|
|
2382
2729
|
})
|
|
2383
2730
|
thread = Option.String()
|
|
@@ -2396,7 +2743,11 @@ export class ThreadAttachCommand extends Command {
|
|
|
2396
2743
|
// a kind with actions of its own (a reflection: accept, rework, discard): they are the owner's answer on the link
|
|
2397
2744
|
const { HOUSE_KINDS } = await import('../review/kinds.ts')
|
|
2398
2745
|
const k = a.slice(0, a.indexOf(':'))
|
|
2399
|
-
|
|
2746
|
+
const kind = specOf(h.dir).kinds[k] ?? HOUSE_KINDS[k]
|
|
2747
|
+
if (Object.keys(kind?.actions ?? {}).length > 0) throw new Error(`attach ${a} --verdict: the kind ${k} declares its own actions, which are the owner's answer on the link; attach it without --verdict`)
|
|
2748
|
+
// a draft is settled by what he does with it (publish, drop), never approved
|
|
2749
|
+
// only the house kinds' acts are read (review/settle.ts): a repo's own kind keeps the verdict
|
|
2750
|
+
if (!(k in specOf(h.dir).kinds) && Object.keys(kind?.acts ?? {}).length > 0) throw new Error(`attach ${a} --verdict: the kind ${k} is answered by its own acts (${Object.values(kind!.acts!).map((x) => x.label).join(', ')}), never a verdict${k === 'draft' ? '; show it here with sk social draft save <slug> <file|-> --thread <this thread>' : ''}`)
|
|
2400
2751
|
}
|
|
2401
2752
|
attachTo(h.dir, id, actor(this.as, false, 'attach'), this.address, new Date(), this.verdict ? { asksVerdict: true } : {})
|
|
2402
2753
|
h.out(`${id} links ${this.address}${this.verdict ? ", waiting for the owner's verdict" : ''}`)
|
|
@@ -2424,16 +2775,16 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2424
2775
|
const { dirname } = await import('node:path')
|
|
2425
2776
|
const { openReview } = await import('../review/project.ts')
|
|
2426
2777
|
const { foldStore } = await import('../review/thread-fold.ts')
|
|
2427
|
-
const { repoIdOf } = await import('../review/
|
|
2428
|
-
const {
|
|
2778
|
+
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2779
|
+
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2429
2780
|
const { existsSync } = await import('node:fs')
|
|
2430
2781
|
const dirs = this.all ? await houseStores() : [h.dir]
|
|
2431
2782
|
const seen = new Set<string>()
|
|
2432
2783
|
const stores = dirs.filter((d) => {
|
|
2433
|
-
const key =
|
|
2784
|
+
const key = threadsInDb() ? repoIdOf(d) : d
|
|
2434
2785
|
if (seen.has(key)) return false
|
|
2435
2786
|
seen.add(key)
|
|
2436
|
-
return
|
|
2787
|
+
return threadsInDb() || existsSync(d)
|
|
2437
2788
|
})
|
|
2438
2789
|
const plans = []
|
|
2439
2790
|
for (const d of stores) {
|