rvlib-shipkit 2.29.0 → 2.31.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 +35 -1
- package/README.md +15 -0
- package/package.json +2 -1
- package/src/advisors/acts.ts +174 -83
- package/src/advisors/advice.ts +201 -24
- package/src/advisors/advisor-view.ts +60 -12
- package/src/advisors/app-graph.ts +8 -2
- package/src/advisors/cf-api.ts +44 -0
- package/src/advisors/copy-truth.ts +49 -0
- package/src/advisors/dir-bucket.ts +69 -0
- package/src/advisors/door-child.ts +112 -0
- package/src/advisors/door-probe.ts +88 -0
- package/src/advisors/door-serve.ts +52 -0
- package/src/advisors/door.ts +82 -23
- package/src/advisors/edge/api.ts +14 -7
- package/src/advisors/edge/bucket.ts +10 -1
- package/src/advisors/edge/handler.ts +85 -44
- package/src/advisors/edge/here.ts +63 -0
- package/src/advisors/edge/pages.ts +87 -0
- package/src/advisors/edge/shell.ts +5 -3
- package/src/advisors/edge/sign-in.ts +144 -0
- package/src/advisors/edge/status.ts +28 -6
- package/src/advisors/edge/types.ts +25 -17
- package/src/advisors/expose.ts +226 -116
- package/src/advisors/here.ts +66 -0
- package/src/advisors/invite-send.ts +176 -0
- package/src/advisors/invite.ts +49 -0
- package/src/advisors/job.ts +89 -11
- package/src/advisors/login.ts +66 -0
- package/src/advisors/owner-name.ts +37 -0
- package/src/advisors/owner-store.ts +267 -62
- package/src/advisors/photos.ts +10 -50
- package/src/advisors/project.ts +92 -48
- package/src/advisors/rights.ts +152 -0
- package/src/advisors/routes.ts +342 -83
- package/src/advisors/scan.ts +39 -2
- package/src/advisors/setup-run.ts +132 -0
- package/src/advisors/share-trace.ts +78 -0
- package/src/advisors/sync.ts +197 -82
- package/src/advisors/tunnel.ts +118 -0
- package/src/advisors/users-router.ts +186 -0
- package/src/agent-time/accounts-usage-disk.ts +45 -3
- package/src/agent-time/accounts-usage.ts +8 -0
- package/src/agent-time/claude-sessions.ts +92 -0
- package/src/agent-time/hooks.ts +1 -1
- package/src/agent-time/live.ts +5 -2
- package/src/agent-time/registry.ts +287 -106
- package/src/agent-time/store.ts +199 -34
- package/src/annex/born.ts +2 -9
- package/src/asks/ask-carry.ts +14 -7
- package/src/asks/ask-doc.ts +2 -2
- package/src/asks/ask-edit.ts +49 -0
- package/src/asks/ask-since.ts +74 -0
- package/src/asks/ask-store.ts +91 -35
- package/src/asks/ask-words-fold.ts +2 -2
- package/src/check.ts +9 -1
- package/src/checks/SK001-package-json-shape.check.ts +13 -3
- package/src/checks/SK003-claude-md-shape.check.ts +78 -19
- package/src/checks/SK004-gitignore-policy.check.ts +15 -6
- package/src/checks/SK008-reviewer-agent.check.ts +5 -8
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK013-one-way-in-policy.check.ts +1 -0
- 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 +2 -1
- package/src/checks/SK032-ignored-inputs.check.ts +9 -5
- package/src/checks/SK033-global-contribution.check.ts +1 -0
- package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
- package/src/checks/SK036-draft-media-size.check.ts +4 -3
- package/src/checks/SK038-speaks-as.check.ts +6 -5
- package/src/checks/SK039-vscode-watch-generated.check.ts +6 -25
- package/src/checks/SK044-behind-upstream.check.ts +2 -1
- package/src/checks/SK049-thread-answers-hook.check.ts +9 -5
- package/src/checks/SK050-retired-commands.check.ts +1 -0
- package/src/checks/SK051-no-formatter.check.ts +1 -0
- package/src/checks/SK052-url-old-words.check.ts +56 -0
- package/src/checks/SK053-tools.check.ts +46 -0
- package/src/checks/SK054-agent-allow-list.check.ts +142 -0
- package/src/cli/clip.ts +44 -0
- package/src/cli/cmd_Advisors.ts +322 -133
- package/src/cli/cmd_Annex.ts +1 -1
- package/src/cli/cmd_Asks.ts +125 -23
- package/src/cli/cmd_Assets.ts +1 -1
- package/src/cli/cmd_Backup.ts +29 -66
- package/src/cli/cmd_BackupTargets.ts +106 -0
- package/src/cli/cmd_Bump.ts +1 -1
- package/src/cli/cmd_CacheAudit.ts +2 -2
- package/src/cli/cmd_Calls.ts +1 -1
- package/src/cli/cmd_Capacity.ts +1 -1
- package/src/cli/cmd_Check.ts +2 -2
- package/src/cli/cmd_Checks.ts +2 -1
- package/src/cli/cmd_Ci.ts +1 -1
- package/src/cli/cmd_Commands.ts +1 -1
- package/src/cli/cmd_ConfigKeys.ts +1 -1
- package/src/cli/cmd_Contracts.ts +1 -1
- package/src/cli/cmd_CrossRepoActivity.ts +1 -6
- package/src/cli/cmd_Db.ts +47 -3
- package/src/cli/cmd_Drill.ts +1 -1
- package/src/cli/cmd_Drive.ts +259 -0
- package/src/cli/cmd_Fleet.ts +1 -1
- package/src/cli/cmd_FleetContext.ts +45 -0
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_FleetUpdate.ts +104 -0
- package/src/cli/cmd_GlobalContext.ts +1 -1
- package/src/cli/cmd_GlobalProcesses.ts +7 -4
- package/src/cli/cmd_History.ts +8 -27
- package/src/cli/cmd_Home.ts +16 -9
- package/src/cli/cmd_Hooks.ts +4 -13
- package/src/cli/cmd_Hq.ts +80 -63
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Insights.ts +1 -1
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +20 -7
- package/src/cli/cmd_Machines.ts +1 -1
- package/src/cli/cmd_Media.ts +14 -22
- package/src/cli/cmd_Messages.ts +1 -1
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Needs.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +245 -85
- package/src/cli/cmd_OrchestratorRole.ts +152 -0
- package/src/cli/cmd_Overview.ts +1 -1
- package/src/cli/cmd_Pb.ts +1 -1
- package/src/cli/cmd_Planned.ts +1 -1
- package/src/cli/cmd_Rec.ts +1 -1
- package/src/cli/cmd_Reflect.ts +3 -3
- package/src/cli/cmd_Release.ts +1 -1
- package/src/cli/cmd_Releases.ts +1 -1
- package/src/cli/cmd_Review.ts +430 -339
- package/src/cli/cmd_Secret.ts +128 -16
- package/src/cli/cmd_Serve.ts +1 -1
- package/src/cli/cmd_Setup.ts +30 -0
- package/src/cli/cmd_Shot.ts +3 -5
- package/src/cli/cmd_Sign.ts +1 -1
- package/src/cli/cmd_Smoke.ts +1 -1
- package/src/cli/cmd_Social.ts +6 -3
- package/src/cli/cmd_SocialDrafts.ts +20 -6
- package/src/cli/cmd_Sound.ts +2 -1
- package/src/cli/cmd_Space.ts +4 -4
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Status.ts +1 -1
- package/src/cli/cmd_ThreadHolds.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +1 -1
- package/src/cli/cmd_ThreadReflect.ts +3 -3
- package/src/cli/cmd_ThreadSyncNeeds.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Tmp.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/cmd_Tui.ts +1 -1
- package/src/cli/cmd_Urls.ts +61 -9
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_Veille.ts +1 -1
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Wiki.ts +5 -2
- package/src/cli/cmd_Worktrees.ts +1 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/inbox-hook-run.ts +135 -0
- package/src/cli/line.ts +131 -0
- package/src/cli/registry-cli.ts +100 -0
- package/src/cli/registry-heads.ts +448 -0
- package/src/cli/registry.ts +385 -250
- package/src/cli/review-here.ts +136 -0
- package/src/cli.ts +65 -22
- package/src/collections/actions.ts +5 -4
- package/src/collections/checks.ts +5 -0
- package/src/collections/collection-types.ts +7 -3
- package/src/collections/pings.ts +4 -1
- package/src/collections/providers.ts +10 -5
- package/src/collections/review.ts +3 -4
- package/src/collections/tests.ts +7 -4
- package/src/context/context-line.ts +29 -0
- package/src/context/context-view.ts +34 -0
- package/src/context/project-context.ts +144 -0
- package/src/core/agent-allow-policy.ts +99 -0
- package/src/core/agent-spawn.ts +2 -0
- package/src/core/app-icon-frame.ts +62 -0
- package/src/core/app-icon.ts +179 -17
- package/src/core/archived.ts +10 -7
- package/src/core/capacity.ts +3 -2
- package/src/core/check-ctx.ts +38 -4
- package/src/core/check-pass.ts +7 -0
- package/src/core/daemon-port.ts +10 -0
- package/src/core/es2022.ts +19 -0
- package/src/core/footprint.ts +35 -0
- package/src/core/foreign.ts +87 -0
- package/src/core/git-bin.ts +18 -0
- package/src/core/git-root.ts +40 -4
- package/src/core/git.ts +22 -0
- package/src/core/gui-color.ts +75 -0
- package/src/core/hard-reset.ts +7 -1
- package/src/core/house-config-text.ts +47 -0
- package/src/core/house-layout.ts +4 -0
- package/src/core/hub-theme.ts +1 -3
- package/src/core/identities-path.ts +67 -0
- package/src/core/identities-root.ts +26 -0
- package/src/core/instance.ts +1 -1
- package/src/core/jobs.ts +1 -4
- package/src/core/layout.ts +6 -0
- package/src/core/loop-watch.ts +28 -5
- package/src/core/machine-commit.ts +9 -1
- package/src/core/machine-db.ts +1 -8
- package/src/core/machine-name.ts +31 -0
- package/src/core/memory-watch.ts +56 -8
- package/src/core/on-loop.ts +10 -7
- package/src/core/one-lib.ts +2 -1
- package/src/core/one-way-in-policy.ts +17 -12
- package/src/core/owner-word-policy.ts +123 -0
- package/src/core/panel-shades.ts +140 -0
- package/src/core/pid-alive.ts +11 -0
- package/src/core/proc-path.ts +42 -0
- package/src/core/repo-gui-color.ts +16 -0
- package/src/core/retention.ts +2 -2
- package/src/core/role-policy.ts +16 -0
- package/src/core/run-dirs.ts +2 -5
- package/src/core/runs.ts +5 -3
- package/src/core/scope.ts +50 -3
- package/src/core/scratch-objects.ts +1 -1
- package/src/core/slot-env.ts +4 -0
- package/src/core/slots.ts +2 -2
- package/src/core/spawn-timeout.ts +9 -3
- package/src/core/tmux-policy.ts +264 -0
- package/src/core/tools.ts +20 -0
- package/src/core/tree-watch.ts +304 -0
- package/src/core/unit-icon.ts +43 -0
- package/src/core/window-policy.ts +132 -0
- package/src/drives/context.ts +29 -0
- package/src/drives/drives-view.ts +121 -0
- package/src/drives/file.ts +89 -0
- package/src/drives/local-folder.ts +107 -0
- package/src/drives/login.ts +181 -0
- package/src/drives/named.ts +33 -0
- package/src/drives/rclone.ts +100 -0
- package/src/drives/reach.ts +73 -0
- package/src/drives/routes.ts +89 -0
- package/src/drives/shares.ts +292 -0
- package/src/fleet/context-fleet.ts +83 -0
- package/src/fleet/follow.ts +172 -0
- package/src/fleet/push-fleet.ts +2 -0
- package/src/fleet/scan-fleet.ts +3 -0
- package/src/gate/builtin-checks-dir.ts +32 -0
- package/src/gate/cache-audit.ts +7 -1
- package/src/gate/discover-checks.ts +9 -32
- package/src/gate/gate-checks.ts +14 -9
- package/src/gate/pre-commit-discovery.ts +214 -24
- package/src/gate/run-fix.ts +30 -5
- package/src/gate/run-fixers.ts +16 -3
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +2 -1
- package/src/home/advisors-tunnel-start.ts +9 -0
- package/src/home/autostart.ts +61 -17
- package/src/home/backup-status.ts +366 -0
- package/src/home/backup-verdict.ts +19 -0
- package/src/home/daemon-guard.ts +20 -2
- package/src/home/daemon-jobs.ts +203 -52
- package/src/home/database-words.ts +19 -2
- package/src/home/databases.ts +72 -25
- package/src/home/drives-deps.ts +54 -0
- package/src/home/follow-run.ts +146 -0
- package/src/home/global-context.ts +26 -22
- package/src/home/global-units.ts +3 -1
- package/src/home/gui-app/ShipkitGui.swift +3732 -286
- package/src/home/gui-app/icon.svg +8 -0
- package/src/home/gui-app.ts +93 -33
- package/src/home/handoff.ts +5 -3
- package/src/home/handover.ts +2 -10
- package/src/home/home-paths.ts +16 -7
- package/src/home/home-routes.ts +152 -38
- package/src/home/home-start.ts +27 -3
- package/src/home/inbox-shape.ts +9 -5
- package/src/home/log-follow.ts +117 -0
- package/src/home/machine-fold.ts +3 -11
- package/src/home/machine-host.ts +3 -17
- package/src/home/machine-stores.ts +8 -7
- package/src/home/open-app.ts +9 -3
- package/src/home/owner-switch-route.ts +33 -0
- package/src/home/page-build.ts +25 -5
- package/src/home/page-files.ts +79 -0
- package/src/home/page-held.ts +1 -1
- package/src/home/pm-config.ts +0 -8
- package/src/home/pm-switch.ts +10 -0
- package/src/home/pm.ts +74 -5
- package/src/home/process-apps.ts +82 -23
- package/src/home/process-rows.ts +16 -1
- package/src/home/push-sources.ts +31 -14
- package/src/home/resources.ts +16 -7
- package/src/home/resume.ts +8 -6
- package/src/home/run-daemon.ts +73 -7
- package/src/home/run-pm.ts +4 -4
- package/src/home/secrets-context.ts +119 -0
- package/src/home/serve-daemon.ts +13 -4
- package/src/home/serve-web.ts +152 -23
- package/src/home/shipkit-mark.ts +26 -0
- package/src/home/space-page.ts +4 -4
- package/src/home/space-route.ts +5 -12
- package/src/home/supervise.ts +4 -10
- package/src/home/vault-page.ts +41 -19
- package/src/home/vault-reveal.ts +2 -1
- package/src/home/web-places.ts +241 -0
- package/src/home/widgets.ts +16 -2
- package/src/hooks/commit-message.ts +11 -9
- package/src/hooks/commit-run.ts +420 -0
- package/src/hooks/git-hook.ts +49 -0
- package/src/hooks/held-calls.ts +104 -0
- package/src/hooks/hook-config.ts +104 -0
- package/src/hooks/hook-gates.ts +15 -9
- package/src/hooks/leak-guard.ts +15 -14
- package/src/hooks/one-way-in-guard.ts +156 -70
- package/src/hooks/pre-commit-checks.ts +64 -0
- package/src/hooks/root-identity.ts +15 -18
- package/src/hooks/run-hooks.ts +130 -293
- package/src/hooks/shared-file.ts +277 -84
- package/src/hooks/shell-writes.ts +526 -0
- package/src/hooks/staged.ts +245 -18
- package/src/hooks/write-log.ts +243 -0
- package/src/house/project-gutter.ts +32 -8
- package/src/hq/backup-targets.ts +74 -0
- package/src/hq/daemon-db.ts +177 -0
- package/src/hq/door-route.ts +68 -12
- package/src/hq/door.ts +71 -24
- package/src/hq/files-send.ts +23 -17
- package/src/hq/follow-fact.ts +66 -0
- package/src/hq/forgotten-log.ts +3 -1
- package/src/hq/history-check.ts +9 -0
- package/src/hq/history-send.ts +9 -23
- package/src/hq/holds-shape.ts +42 -0
- package/src/hq/hq-db.ts +25 -28
- package/src/hq/hq-holds.ts +181 -0
- package/src/hq/hq-local.ts +87 -49
- package/src/hq/hq-role.ts +150 -0
- package/src/hq/hq-routes.ts +18 -4
- package/src/hq/hq-store.ts +52 -13
- package/src/hq/item-direct.ts +57 -0
- package/src/hq/item-shapes.ts +54 -0
- package/src/hq/kinds/index.ts +3 -1
- package/src/hq/kinds/item-gone.ts +20 -12
- package/src/hq/kinds/item-msg.ts +21 -6
- package/src/hq/kinds/item.ts +22 -13
- package/src/hq/kinds/items-read.ts +4 -0
- package/src/hq/kinds/kind.ts +18 -4
- package/src/hq/kinds/presence-rule.ts +56 -0
- package/src/hq/kinds/presence.ts +228 -0
- package/src/hq/kinds/prompt.ts +1 -0
- package/src/hq/kinds/reflection.ts +1 -0
- package/src/hq/kinds/report.ts +13 -5
- package/src/hq/kinds/thread-event.ts +105 -0
- package/src/hq/lead-order.ts +68 -0
- package/src/hq/machine-key.ts +10 -3
- package/src/hq/machine-notes.ts +3 -2
- package/src/hq/outbox.ts +9 -153
- package/src/hq/owner-switch.ts +61 -0
- package/src/hq/replica.ts +168 -23
- package/src/hq/report-facts.ts +39 -9
- package/src/hq/report.ts +71 -2
- package/src/hq/shapes-words.ts +31 -0
- package/src/hq/switch.ts +29 -59
- package/src/hq/terminal-hop.ts +64 -0
- package/src/hq/thread-events.ts +91 -0
- package/src/hq/thread-sync.ts +39 -51
- package/src/http/door-forward.ts +13 -15
- package/src/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 +28 -6
- package/src/http/owner-word.ts +133 -0
- package/src/http/same-origin.ts +12 -0
- package/src/{serve → http}/secret-gate.ts +3 -3
- package/src/identities/collection.ts +2 -3
- package/src/identities/identities.ts +43 -6
- package/src/init-repo.ts +12 -0
- package/src/ledger/db.ts +19 -6
- package/src/ledger/git-scan.ts +23 -9
- package/src/ledger/live-runs.ts +1 -12
- package/src/ledger/record-kept.ts +40 -12
- package/src/ledger/run-log.ts +25 -0
- package/src/media-store/backup/daemon.ts +37 -22
- package/src/media-store/backup/facts.ts +63 -0
- package/src/media-store/backup/prune.ts +2 -5
- package/src/media-store/backup/restore.ts +15 -4
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/sources.ts +33 -68
- package/src/media-store/backup/ssh-space.ts +202 -0
- package/src/media-store/backup/ssh-target.ts +74 -0
- package/src/media-store/backup/target-send.ts +162 -0
- package/src/media-store/backup/watch.ts +26 -19
- package/src/media-store/copy/config.ts +15 -13
- package/src/media-store/copy/copy.ts +11 -6
- package/src/media-store/copy/proof.ts +17 -10
- package/src/media-store/copy/snapshot.ts +29 -22
- package/src/media-store/copy/store.ts +2 -10
- package/src/media-store/copy/stream.ts +7 -2
- package/src/media-store/daemon.ts +13 -7
- package/src/media-store/db.ts +6 -1
- package/src/media-store/forget-one.ts +14 -3
- package/src/media-store/hq-find.ts +1 -3
- package/src/media-store/hq-send.ts +4 -5
- package/src/media-store/put.ts +3 -0
- package/src/media-store/space.ts +14 -16
- package/src/media-store/upload.ts +4 -0
- package/src/messages/collection.ts +2 -2
- package/src/messages/model.ts +6 -1
- package/src/messages/routes.ts +3 -0
- package/src/orchestrator/brief.md +8 -6
- package/src/orchestrator/guards.ts +9 -3
- package/src/orchestrator/host.ts +35 -0
- package/src/orchestrator/lead-shape.ts +87 -0
- package/src/orchestrator/now.ts +88 -0
- package/src/orchestrator/phone.ts +4 -1
- package/src/orchestrator/places-file.ts +38 -0
- package/src/orchestrator/places-look.ts +208 -0
- package/src/orchestrator/places-shape.ts +166 -0
- package/src/orchestrator/places.ts +50 -0
- package/src/orchestrator/presence-shape.ts +13 -2
- package/src/orchestrator/presence.ts +41 -20
- package/src/orchestrator/push.ts +5 -10
- package/src/orchestrator/role-shape.ts +261 -0
- package/src/orchestrator/role.ts +191 -0
- package/src/orchestrator/routes.ts +155 -41
- package/src/orchestrator/sessions-shape.ts +123 -0
- package/src/orchestrator/sessions.ts +83 -0
- package/src/orchestrator/share.ts +71 -0
- package/src/orchestrator/start-notice.ts +61 -0
- package/src/orchestrator/start.ts +130 -0
- package/src/orchestrator/started.ts +55 -0
- package/src/orchestrator/stuck.ts +196 -0
- package/src/orchestrator/talk-key.ts +21 -0
- package/src/orchestrator/unheard.ts +18 -7
- package/src/pages/frame-client.ts +44 -6
- package/src/problems/failure-words.ts +80 -0
- package/src/recordings/recorder-app/Editor.swift +6 -0
- package/src/recordings/recorder-app/main.swift +3 -0
- package/src/reflections/reflection-close.ts +2 -1
- package/src/reflections/reflections-queue.ts +9 -6
- package/src/release/public-clean.ts +40 -15
- package/src/release/run-bump.ts +26 -5
- package/src/release/run-release.ts +34 -14
- package/src/repo-config.ts +54 -14
- package/src/review/answer-kinds.ts +15 -3
- package/src/review/aside-at.ts +19 -0
- package/src/review/band.ts +53 -16
- package/src/review/cell-copy.ts +27 -0
- package/src/review/cells.ts +246 -35
- package/src/review/doc-save.ts +1 -1
- package/src/review/events.ts +24 -4
- package/src/review/expect.ts +128 -0
- package/src/review/file-tags.ts +9 -0
- package/src/review/folders.ts +216 -0
- package/src/review/format.ts +113 -25
- package/src/review/gone.ts +10 -86
- package/src/review/hook-ask.ts +58 -0
- package/src/review/inbox-hook.ts +17 -6
- package/src/review/inbox-read.ts +99 -18
- package/src/review/instruction-guards.ts +192 -0
- package/src/review/instructions.ts +38 -2
- package/src/review/item-db.ts +157 -23
- package/src/review/item-hq.ts +119 -0
- package/src/review/item-rows.ts +96 -52
- package/src/review/kind-catalog.ts +2 -0
- package/src/review/kinds.ts +7 -4
- package/src/review/live-post.ts +20 -6
- package/src/review/live-view.ts +18 -1
- package/src/review/media-away.ts +35 -0
- package/src/review/mentions.ts +9 -10
- package/src/review/model.ts +126 -13
- package/src/review/notes.ts +4 -4
- package/src/review/object-read.ts +26 -7
- package/src/review/parties.ts +104 -19
- package/src/review/phone-push.ts +11 -10
- package/src/review/previews-job.ts +49 -0
- package/src/review/previews.ts +50 -28
- package/src/review/push.ts +56 -55
- package/src/review/referring.ts +2 -2
- package/src/review/reflection-object.ts +24 -11
- package/src/review/refs.ts +143 -0
- package/src/review/reply-guards.ts +71 -0
- package/src/review/routes.ts +99 -35
- package/src/review/search-index.ts +6 -10
- package/src/review/search-job.ts +4 -6
- package/src/review/search-ocr.ts +1 -1
- package/src/review/secret-route.ts +18 -14
- package/src/review/snooze.ts +1 -16
- package/src/review/store-index.ts +1 -1
- package/src/review/store-parties.ts +4 -2
- package/src/review/store.ts +171 -556
- package/src/review/supersede.ts +3 -3
- package/src/review/take-back.ts +1 -1
- package/src/review/thread-code.ts +101 -0
- package/src/review/thread-md.ts +127 -0
- package/src/review/thread-query.ts +67 -0
- package/src/review/threads.ts +104 -18
- package/src/review/traces.ts +17 -5
- package/src/review/unit.ts +3 -2
- package/src/review/verdict-items.ts +4 -4
- package/src/review/view-layout.ts +11 -1
- package/src/review/wait.ts +2 -2
- package/src/review/wakes.ts +7 -3
- package/src/review/watchers.ts +26 -14
- package/src/review/working-guards.ts +39 -0
- package/src/scaffold/jsonc-spans.ts +42 -0
- package/src/scaffold/starter-house.ts +85 -0
- package/src/secrets/about-words.ts +33 -0
- package/src/secrets/archive.ts +2 -2
- package/src/secrets/audit-run.ts +53 -0
- package/src/secrets/audit.ts +407 -0
- package/src/secrets/changed-mark.ts +15 -0
- package/src/secrets/clip.ts +29 -0
- package/src/secrets/held.ts +4 -4
- package/src/secrets/key-pair.ts +14 -0
- package/src/secrets/lapse.ts +3 -3
- package/src/secrets/list.ts +9 -4
- 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 +15 -7
- package/src/secrets/ref-state.ts +18 -0
- package/src/secrets/registry-rows.ts +18 -0
- package/src/secrets/secret-ref.ts +42 -0
- package/src/secrets/secrets-view.ts +299 -0
- package/src/secrets/token-siblings.ts +60 -0
- package/src/secrets/who-reads.ts +27 -21
- package/src/serve/frame-part.ts +50 -0
- package/src/serve/hook-thread.ts +37 -0
- package/src/serve/hook-work.ts +92 -0
- package/src/serve/hook-worker.ts +57 -0
- package/src/serve/hub-app/accounts-line.tsx +33 -45
- package/src/serve/hub-app/activity-st.ts +6 -5
- package/src/serve/hub-app/activity-view.tsx +16 -15
- package/src/serve/hub-app/admin-view.tsx +7 -6
- package/src/serve/hub-app/advice-box.tsx +6 -5
- package/src/serve/hub-app/advisor-app.tsx +78 -13
- package/src/serve/hub-app/advisor-face.tsx +22 -7
- package/src/serve/hub-app/advisor-host.ts +102 -10
- package/src/serve/hub-app/advisor.html +1 -0
- package/src/serve/hub-app/advisors-model.ts +234 -0
- package/src/serve/hub-app/advisors-rights.tsx +66 -0
- package/src/serve/hub-app/advisors-st.ts +430 -34
- package/src/serve/hub-app/advisors-view.tsx +334 -195
- package/src/serve/hub-app/advisors.css +135 -18
- package/src/serve/hub-app/app-bridge.ts +124 -8
- package/src/serve/hub-app/ask-steps.tsx +6 -3
- package/src/serve/hub-app/asked-page.ts +24 -0
- package/src/serve/hub-app/asks-page.tsx +10 -6
- package/src/serve/hub-app/auto-text.tsx +50 -8
- package/src/serve/hub-app/backups-st.ts +55 -0
- package/src/serve/hub-app/backups-view.tsx +115 -0
- package/src/serve/hub-app/backups.css +33 -0
- package/src/serve/hub-app/card-head.tsx +3 -2
- package/src/serve/hub-app/check-view.tsx +16 -15
- package/src/serve/hub-app/checks-svc.ts +96 -32
- package/src/serve/hub-app/clock-svc.ts +24 -8
- package/src/serve/hub-app/code-copy.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +6 -5
- package/src/serve/hub-app/col-list-page.tsx +14 -7
- package/src/serve/hub-app/col-list-st.ts +12 -2
- package/src/serve/hub-app/col-tables-view.tsx +8 -44
- package/src/serve/hub-app/col-tables.ts +5 -18
- package/src/serve/hub-app/cols-svc.ts +6 -12
- package/src/serve/hub-app/columns.ts +94 -0
- package/src/serve/hub-app/comfy-view.tsx +9 -8
- package/src/serve/hub-app/commands/commands-page.tsx +6 -5
- package/src/serve/hub-app/commands/commands-st.ts +2 -2
- package/src/serve/hub-app/controls.css +91 -24
- package/src/serve/hub-app/cycle-button.tsx +3 -2
- package/src/serve/hub-app/database-st.ts +41 -12
- package/src/serve/hub-app/database-view.tsx +71 -4
- package/src/serve/hub-app/database.css +3 -0
- package/src/serve/hub-app/deaf.tsx +27 -0
- package/src/serve/hub-app/dock-st.ts +21 -16
- package/src/serve/hub-app/dock-view.tsx +20 -13
- package/src/serve/hub-app/drives-page.tsx +309 -0
- package/src/serve/hub-app/drives-st.ts +486 -0
- package/src/serve/hub-app/drives.css +122 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +4 -3
- package/src/serve/hub-app/empty-section.tsx +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 +68 -15
- package/src/serve/hub-app/frame-refusal.ts +13 -0
- package/src/serve/hub-app/geometry-view.tsx +4 -3
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +25 -6
- package/src/serve/hub-app/header-bar.tsx +54 -36
- package/src/serve/hub-app/home-pages.ts +40 -0
- package/src/serve/hub-app/home-st.ts +138 -14
- package/src/serve/hub-app/home-strip.css +24 -13
- package/src/serve/hub-app/home-strip.tsx +151 -84
- package/src/serve/hub-app/home.html +6 -0
- package/src/serve/hub-app/hub-app.tsx +108 -103
- package/src/serve/hub-app/hub.css +133 -99
- package/src/serve/hub-app/icons.tsx +24 -0
- package/src/serve/hub-app/identities-st.ts +19 -54
- package/src/serve/hub-app/identities-view.tsx +29 -27
- 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 +20 -2
- package/src/serve/hub-app/inbox-view.tsx +26 -19
- package/src/serve/hub-app/inbox.css +1 -0
- package/src/serve/hub-app/index.html +6 -0
- package/src/serve/hub-app/insights-view.tsx +11 -10
- package/src/serve/hub-app/instructions.css +4 -1
- package/src/serve/hub-app/kept-cols.tsx +83 -20
- package/src/serve/hub-app/kept-width.tsx +76 -0
- package/src/serve/hub-app/keys.ts +143 -45
- package/src/serve/hub-app/layout-st.ts +113 -100
- package/src/serve/hub-app/lightbox-zoom.css +46 -0
- package/src/serve/hub-app/list-filter.tsx +58 -8
- 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-socket.ts +280 -0
- package/src/serve/hub-app/live-sources.ts +260 -0
- package/src/serve/hub-app/live-svc.ts +2 -2
- package/src/serve/hub-app/machine-groups.ts +87 -0
- package/src/serve/hub-app/machine-st.ts +75 -14
- package/src/serve/hub-app/machines-st.ts +100 -3
- package/src/serve/hub-app/machines-view.tsx +50 -3
- package/src/serve/hub-app/machines.css +22 -0
- package/src/serve/hub-app/main-panel.css +217 -0
- package/src/serve/hub-app/main-panel.tsx +257 -0
- package/src/serve/hub-app/markdown.css +12 -2
- package/src/serve/hub-app/md.ts +64 -22
- package/src/serve/hub-app/media-svc.ts +5 -5
- package/src/serve/hub-app/media-view.tsx +32 -22
- package/src/serve/hub-app/messages/messages-page.tsx +22 -12
- package/src/serve/hub-app/messages/messages-st.ts +5 -2
- package/src/serve/hub-app/new-thread-st.ts +170 -0
- package/src/serve/hub-app/new-thread.tsx +136 -107
- package/src/serve/hub-app/orchestrator-line.tsx +115 -45
- package/src/serve/hub-app/orchestrator-places.tsx +112 -0
- package/src/serve/hub-app/orchestrator.css +62 -5
- package/src/serve/hub-app/page-keys.ts +109 -67
- package/src/serve/hub-app/page-reload.ts +46 -6
- package/src/serve/hub-app/pages-frames.tsx +42 -4
- package/src/serve/hub-app/pages-svc.ts +3 -1
- package/src/serve/hub-app/palette-st.ts +450 -70
- package/src/serve/hub-app/palette-view.tsx +123 -21
- package/src/serve/hub-app/pane-boundary.tsx +3 -2
- 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 +206 -0
- package/src/serve/hub-app/panel-tint.ts +8 -0
- package/src/serve/hub-app/panel-walk.ts +107 -0
- package/src/serve/hub-app/pic.tsx +37 -0
- package/src/serve/hub-app/pick-kinds.ts +101 -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 +109 -0
- package/src/serve/hub-app/plan-view.tsx +4 -3
- package/src/serve/hub-app/planned-view.tsx +6 -5
- package/src/serve/hub-app/polled.ts +25 -4
- package/src/serve/hub-app/presence-st.ts +74 -32
- package/src/serve/hub-app/processes-view.tsx +18 -12
- package/src/serve/hub-app/project-bar.tsx +172 -0
- package/src/serve/hub-app/project-list.css +20 -173
- package/src/serve/hub-app/project-list.tsx +27 -307
- package/src/serve/hub-app/projects-svc.ts +102 -45
- package/src/serve/hub-app/push-sign.tsx +2 -1
- package/src/serve/hub-app/push-svc.ts +86 -69
- package/src/serve/hub-app/quiet-st.ts +5 -3
- package/src/serve/hub-app/rail-groups.ts +145 -0
- package/src/serve/hub-app/reader-chips.tsx +2 -1
- package/src/serve/hub-app/recordings-st.ts +2 -1
- package/src/serve/hub-app/recordings-view.tsx +42 -70
- package/src/serve/hub-app/recordings.css +0 -2
- package/src/serve/hub-app/ref-list-slot.ts +10 -0
- package/src/serve/hub-app/ref-pill.ts +58 -0
- package/src/serve/hub-app/reflections-page.tsx +12 -8
- package/src/serve/hub-app/releases/releases-page.tsx +11 -10
- package/src/serve/hub-app/repo-mark.tsx +29 -0
- package/src/serve/hub-app/repo-sections.ts +137 -41
- package/src/serve/hub-app/repo-st.ts +116 -42
- package/src/serve/hub-app/review/advisor-add.tsx +155 -0
- package/src/serve/hub-app/review/advisor-bar.tsx +93 -22
- package/src/serve/hub-app/review/advisor-invite.tsx +66 -0
- package/src/serve/hub-app/review/ask-proof.tsx +80 -0
- package/src/serve/hub-app/review/attach-view.tsx +16 -14
- package/src/serve/hub-app/review/box-view.ts +496 -0
- package/src/serve/hub-app/review/box-zoom.tsx +70 -0
- package/src/serve/hub-app/review/copy-button.tsx +29 -0
- package/src/serve/hub-app/review/diff-mode.ts +41 -0
- package/src/serve/hub-app/review/diff-view.tsx +95 -21
- package/src/serve/hub-app/review/doc-body.tsx +4 -3
- package/src/serve/hub-app/review/dock.tsx +54 -25
- package/src/serve/hub-app/review/draft-body.tsx +6 -5
- package/src/serve/hub-app/review/faces.tsx +0 -8
- package/src/serve/hub-app/review/group-block.tsx +11 -10
- package/src/serve/hub-app/review/heard-line.tsx +4 -3
- package/src/serve/hub-app/review/instructions-view.tsx +6 -11
- package/src/serve/hub-app/review/item-verdict.tsx +41 -40
- package/src/serve/hub-app/review/kind-states.tsx +5 -4
- package/src/serve/hub-app/review/kind-view.tsx +13 -19
- package/src/serve/hub-app/review/kit.tsx +37 -9
- package/src/serve/hub-app/review/lane-bar.tsx +30 -28
- package/src/serve/hub-app/review/lightbox.tsx +6 -4
- package/src/serve/hub-app/review/line-window.ts +51 -8
- package/src/serve/hub-app/review/live-bar.tsx +11 -7
- package/src/serve/hub-app/review/live-view.tsx +14 -13
- package/src/serve/hub-app/review/mention-st.ts +9 -38
- package/src/serve/hub-app/review/object-card.tsx +2 -1
- package/src/serve/hub-app/review/object-panel.tsx +49 -23
- package/src/serve/hub-app/review/outbox-st.ts +200 -0
- package/src/serve/hub-app/review/pano-view.tsx +4 -3
- package/src/serve/hub-app/review/phone-top.tsx +2 -1
- package/src/serve/hub-app/review/question-views.tsx +176 -43
- package/src/serve/hub-app/review/review-cells.tsx +215 -57
- package/src/serve/hub-app/review/review-host.ts +13 -1
- package/src/serve/hub-app/review/review-kit.ts +28 -10
- package/src/serve/hub-app/review/review-list.tsx +136 -129
- package/src/serve/hub-app/review/review-page.tsx +8 -7
- package/src/serve/hub-app/review/review-st.ts +138 -28
- package/src/serve/hub-app/review/review-thread.tsx +444 -228
- package/src/serve/hub-app/review/review-views.tsx +248 -235
- package/src/serve/hub-app/review/secret-facts.ts +2 -1
- package/src/serve/hub-app/review/share-lines.tsx +40 -0
- package/src/serve/hub-app/review/space3d.tsx +17 -9
- package/src/serve/hub-app/review/start-st.ts +137 -0
- package/src/serve/hub-app/review/start-thread.tsx +104 -0
- package/src/serve/hub-app/review/superseded-runs.ts +20 -2
- package/src/serve/hub-app/review/thread-close.tsx +24 -32
- package/src/serve/hub-app/review/thread-control.tsx +5 -4
- package/src/serve/hub-app/review/thread-st.ts +293 -65
- package/src/serve/hub-app/review/thread-views.ts +3 -2
- package/src/serve/hub-app/review/trailer-body.tsx +7 -6
- package/src/serve/hub-app/review/trailer-page.tsx +46 -44
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-timeline.tsx +10 -9
- package/src/serve/hub-app/review/trailer-voices.tsx +31 -30
- package/src/serve/hub-app/review/zoom-still.tsx +60 -0
- package/src/serve/hub-app/review.css +319 -79
- package/src/serve/hub-app/row-acts.tsx +128 -0
- package/src/serve/hub-app/row-face.tsx +28 -0
- package/src/serve/hub-app/run-page.tsx +236 -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-view.tsx +4 -3
- package/src/serve/hub-app/secret-cli.tsx +32 -0
- package/src/serve/hub-app/secret-readable.tsx +59 -0
- package/src/serve/hub-app/secret-refs.ts +173 -0
- package/src/serve/hub-app/secrets-page.tsx +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 +5 -2
- package/src/serve/hub-app/seen-rows.ts +72 -0
- package/src/serve/hub-app/session-chips.tsx +55 -0
- package/src/serve/hub-app/shared-faces.tsx +32 -0
- package/src/serve/hub-app/shell.ts +56 -0
- package/src/serve/hub-app/side-frame-view.tsx +115 -0
- package/src/serve/hub-app/side-frame.ts +120 -0
- package/src/serve/hub-app/site/site-part.tsx +12 -11
- package/src/serve/hub-app/site/site-st.ts +0 -6
- package/src/serve/hub-app/site.css +0 -1
- package/src/serve/hub-app/social/calendar.tsx +8 -7
- package/src/serve/hub-app/social/comms-page.tsx +32 -29
- package/src/serve/hub-app/social/copy-forms.ts +31 -0
- package/src/serve/hub-app/social/group-editor.tsx +2 -1
- package/src/serve/hub-app/social/kit.tsx +48 -28
- package/src/serve/hub-app/social/next-release.tsx +3 -2
- package/src/serve/hub-app/social/post-card.tsx +26 -25
- package/src/serve/hub-app/social/post-page.tsx +4 -3
- package/src/serve/hub-app/social/problems.tsx +3 -2
- package/src/serve/hub-app/social/social-page.tsx +58 -37
- package/src/serve/hub-app/social/social-st.ts +12 -4
- package/src/serve/hub-app/social/stage-popup.tsx +15 -14
- package/src/serve/hub-app/social.css +14 -6
- package/src/serve/hub-app/source-acts.ts +79 -0
- package/src/serve/hub-app/source-page.tsx +19 -0
- package/src/serve/hub-app/space-view.tsx +8 -7
- package/src/serve/hub-app/stores/stores-page.tsx +32 -29
- package/src/serve/hub-app/stores/stores-st.ts +1 -1
- package/src/serve/hub-app/stores.css +1 -1
- package/src/serve/hub-app/terminal-gone.tsx +41 -0
- package/src/serve/hub-app/terminal-history-st.ts +115 -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 +328 -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 +155 -0
- package/src/serve/hub-app/terminal-panel.tsx +62 -11
- package/src/serve/hub-app/terminal-picture.ts +78 -0
- package/src/serve/hub-app/terminal-sources.tsx +605 -0
- package/src/serve/hub-app/terminal-st.ts +503 -168
- package/src/serve/hub-app/terminal-stream.ts +233 -0
- package/src/serve/hub-app/terminal-tab.tsx +65 -0
- package/src/serve/hub-app/terminal-widths.ts +30 -0
- package/src/serve/hub-app/terminal.css +55 -4
- package/src/serve/hub-app/test-view.tsx +7 -5
- package/src/serve/hub-app/tests-view.tsx +19 -18
- package/src/serve/hub-app/theme-st.ts +5 -0
- package/src/serve/hub-app/thread-row.tsx +49 -31
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +3 -2
- package/src/serve/hub-app/time-pages.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +8 -6
- 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 +22 -13
- package/src/serve/hub-app/tips.ts +247 -0
- package/src/serve/hub-app/tree-build.ts +40 -8
- package/src/serve/hub-app/tree-svc.ts +167 -134
- 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 +87 -0
- package/src/serve/hub-app/url-forms.tsx +275 -0
- package/src/serve/hub-app/url-needs.ts +31 -0
- package/src/serve/hub-app/urls-svc.ts +321 -21
- package/src/serve/hub-app/urls-view.tsx +114 -78
- package/src/serve/hub-app/urls.css +85 -2
- package/src/serve/hub-app/vault-view.tsx +18 -17
- package/src/serve/hub-app/veille/veille-page.tsx +42 -40
- package/src/serve/hub-app/veille/veille-st.ts +6 -3
- package/src/serve/hub-app/view-layout.css +5 -3
- package/src/serve/hub-app/when-view.tsx +6 -5
- package/src/serve/hub-app/wikis-view.tsx +7 -6
- package/src/serve/hub-app/word-refs.ts +12 -0
- package/src/serve/hub-app/words.tsx +30 -6
- package/src/serve/hub-runtime.ts +3 -2
- package/src/serve/orchestrator-host.ts +58 -0
- package/src/serve/page-live.ts +147 -0
- package/src/serve/picture-types.ts +10 -0
- package/src/serve/project-gutter-route.ts +81 -15
- package/src/serve/read-thread.ts +31 -12
- package/src/serve/read-worker.ts +14 -2
- package/src/serve/runs-stamp.ts +33 -0
- package/src/serve/secret-ref-routes.ts +71 -0
- package/src/serve/secrets-read.ts +156 -0
- package/src/serve/serve-hub.ts +97 -23
- package/src/serve/terminal-claudes.ts +222 -0
- package/src/serve/terminal-guard.ts +15 -6
- package/src/serve/terminal-host.ts +521 -0
- package/src/serve/terminal-paste.ts +49 -0
- package/src/serve/terminal-record.ts +110 -0
- package/src/serve/terminal-route.ts +479 -103
- package/src/serve/terminal-shells.ts +3 -0
- package/src/serve/terminal-watch.ts +102 -0
- package/src/serve/tracked-watch.ts +13 -11
- package/src/setup-house.ts +333 -0
- package/src/shipkit-files.ts +23 -7
- package/src/shot/client.ts +4 -9
- package/src/shot/film-box.ts +1 -9
- package/src/shot/shooter.ts +2 -4
- package/src/shot/shot-ask.ts +2 -7
- package/src/shot/shot-theme.ts +6 -17
- package/src/social/discord-layout.ts +1 -1
- package/src/social/kind-pages.ts +11 -5
- package/src/social/media-limit.ts +18 -8
- package/src/social/media-of.ts +5 -5
- package/src/social/publish/discord.ts +1 -1
- package/src/social/routes.ts +8 -5
- package/src/social/writes.ts +3 -0
- package/src/start-repo.ts +5 -0
- package/src/suite/judge-suites.ts +9 -51
- package/src/suite/red-alone.ts +69 -0
- package/src/suite/suite-cli.ts +27 -26
- package/src/suite/test-units.ts +6 -2
- package/src/trailer/sound/eleven.ts +1 -0
- package/src/trailer/titles.ts +2 -2
- package/src/urls/added.ts +130 -0
- package/src/urls/fill.ts +127 -0
- package/src/urls/frame.ts +39 -0
- package/src/urls/icons.ts +294 -0
- package/src/urls/places.ts +145 -0
- package/src/urls/routes.ts +43 -13
- package/src/urls/rows.ts +133 -25
- package/src/urls/totp.ts +121 -0
- package/src/urls/unit.ts +123 -10
- package/src/urls/write-routes.ts +323 -0
- package/src/vault/vault-destroy.ts +2 -1
- package/src/vault/vault-import.ts +6 -20
- package/src/vault/vault-init.ts +2 -1
- package/src/vault/vault-restore.ts +4 -11
- package/src/veille/chrome.ts +7 -2
- package/src/veille/identity.ts +12 -5
- package/src/view3d/cam.ts +30 -46
- package/src/view3d/lib.ts +20 -2
- package/src/view3d/viewer.ts +62 -88
- package/src/wiki/agent-paths.ts +2 -1
- package/src/wiki/graph-page.ts +27 -37
- package/src/wiki/graph-positions.ts +13 -3
- package/src/wiki/graph-sim.ts +77 -0
- package/src/wiki/run-wiki.ts +12 -1
- package/src/advisors/edge/certs.ts +0 -20
- package/src/advisors/edge/jwt.ts +0 -76
- package/src/advisors/edge/worker.ts +0 -52
- package/src/advisors/r2.ts +0 -48
- package/src/media-store/backup/thread-copy.ts +0 -339
- package/src/orchestrator/deliver.ts +0 -81
- package/src/orchestrator/drill.ts +0 -129
- package/src/orchestrator/keeper.ts +0 -332
- package/src/orchestrator/pm.ts +0 -20
- package/src/orchestrator/state.ts +0 -92
- package/src/orchestrator/switch.ts +0 -86
- package/src/orchestrator/tmux.ts +0 -82
- package/src/review/move.ts +0 -492
- package/src/serve/hub-app/rail-fly.tsx +0 -95
- 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 -125
package/src/cli/cmd_Review.ts
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
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
|
-
import { Command, Option } from '
|
|
4
|
+
import { Command, Option } from './clip.ts'
|
|
5
5
|
import type { AnswerKind } from '../review/model.ts'
|
|
6
6
|
import { holdsThread, laneOfCaller, maySee } from '../review/parties.ts'
|
|
7
7
|
import { realGit } from '../core/git.ts'
|
|
8
8
|
import { ageWords } from '../core/words.ts'
|
|
9
|
+
import { hereAt, hereStore, noRepo, openHere, partiesFor, pull, recordedStores, refused, reviewRoot, type Here } from './review-here.ts'
|
|
9
10
|
|
|
10
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.`
|
|
11
12
|
|
|
12
13
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
13
|
-
type Unit = import('../review/unit.ts').ReviewUnit
|
|
14
|
-
type Say = import('../review/format.ts').Say
|
|
15
|
-
|
|
16
|
-
/** 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 */
|
|
17
|
-
interface Here {
|
|
18
|
-
dir: string
|
|
19
|
-
unit: Unit | null
|
|
20
|
-
say: Say
|
|
21
|
-
out: (l: string) => void
|
|
22
|
-
err: (l: string) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** the shipkit repo the cwd stands in: only its store reaches a hub, so anywhere else an item is refused before a
|
|
26
|
-
* stray .shipkit/review/ is made where nobody looks */
|
|
27
|
-
async function reviewRoot(cwd: string): Promise<string | null> {
|
|
28
|
-
const { findRepoRoot } = await import('../ts/config.ts')
|
|
29
|
-
const { existsSync } = await import('node:fs')
|
|
30
|
-
const { join } = await import('node:path')
|
|
31
|
-
const root = findRepoRoot(cwd)
|
|
32
|
-
return existsSync(join(root, 'repo.config.ts')) ? root : null
|
|
33
|
-
}
|
|
34
14
|
|
|
35
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 */
|
|
36
16
|
async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o: { unit?: boolean } = {}): Promise<number> {
|
|
@@ -41,7 +21,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
41
21
|
const argv = process.argv.slice(2)
|
|
42
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(' ')}`)
|
|
43
23
|
const root = await reviewRoot(process.cwd())
|
|
44
|
-
if (root == null) throw new Error(
|
|
24
|
+
if (root == null) throw new Error(noRepo(process.cwd()))
|
|
45
25
|
// a repo where an agent writes in a thread needs a next session that hears it; the gate's repair wires the hook
|
|
46
26
|
if (WRITING_VERBS.has(argv[1] ?? '')) {
|
|
47
27
|
const { inboxHookLacks } = await import('../review/inbox-read.ts')
|
|
@@ -52,15 +32,9 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
52
32
|
const { storeDir } = await import('../review/store.ts')
|
|
53
33
|
return await body({ dir: storeDir(root), unit: null, say: { spec: (await import('../review/model.ts')).NO_SPEC, more: () => [] }, out, err })
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
const { specOf } = await import('../review/store.ts')
|
|
57
|
-
const { dir, unit } = await openReview(root)
|
|
58
|
-
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))
|
|
59
36
|
} catch (e) {
|
|
60
|
-
|
|
61
|
-
// a walk of the items' database runs: run it again once it ends
|
|
62
|
-
const { isStoreRefused, WAIT_EXIT } = await import('../core/machine-db.ts')
|
|
63
|
-
return isStoreRefused(e) && e.wait ? WAIT_EXIT : 1
|
|
37
|
+
return refused(e, err)
|
|
64
38
|
}
|
|
65
39
|
}
|
|
66
40
|
|
|
@@ -109,11 +83,30 @@ async function idOf(dir: string, ref: string, one?: { verb: string; objects?: bo
|
|
|
109
83
|
|
|
110
84
|
/** an address an agent starts a thread on or links: its kind word must be one a kind declares (the repo's or the
|
|
111
85
|
* house's, `sk thread kinds`), so one subject never becomes two threads under two words */
|
|
112
|
-
async function declaredOrThrow(h: Here, a: string): Promise<
|
|
86
|
+
async function declaredOrThrow(h: Here, a: string): Promise<string> {
|
|
113
87
|
const { readAll } = await import('../review/store.ts')
|
|
114
|
-
const { addressRefusal } = await import('../review/threads.ts')
|
|
115
|
-
const
|
|
88
|
+
const { addressRefusal, ownAddressesOf, threadOfAddress } = await import('../review/threads.ts')
|
|
89
|
+
const items = readAll(h.dir).items
|
|
90
|
+
// only `sk ask` opens an ask's thread: an ask address no thread owns (a wrong number, a typo) never starts one
|
|
91
|
+
if (a.startsWith('ask:')) {
|
|
92
|
+
const t = threadOfAddress(a, items, h.say.spec)
|
|
93
|
+
if (t === null) throw new Error(await noAsk(h, a))
|
|
94
|
+
// `ask:21` is written as the address its thread owns, so a version never starts a second thread
|
|
95
|
+
return ownAddressesOf(t, h.say.spec).find((x) => x.startsWith('ask:')) ?? a
|
|
96
|
+
}
|
|
97
|
+
const why = addressRefusal(a, items, h.say.spec)
|
|
116
98
|
if (why !== null) throw new Error(why)
|
|
99
|
+
return a
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** why an ask address names no ask, with the open asks nearest its number */
|
|
103
|
+
async function noAsk(h: Here, a: string): Promise<string> {
|
|
104
|
+
const { openAsks } = await import('../asks/ask-store.ts')
|
|
105
|
+
const { dirname } = await import('node:path')
|
|
106
|
+
const n = parseInt(a.slice('ask:'.length), 10)
|
|
107
|
+
const open = openAsks(dirname(dirname(h.dir)))
|
|
108
|
+
const near = [...open].sort((x, y) => (Number.isNaN(n) ? 0 : Math.abs(parseInt(x.id, 10) - n) - Math.abs(parseInt(y.id, 10) - n))).slice(0, 5)
|
|
109
|
+
return `no ask ${a.slice('ask:'.length)}: only sk ask opens an ask's thread, so nothing is written. ${near.length > 0 ? `The open asks nearest it: ${near.map((x) => `ask:${parseInt(x.id, 10)} « ${x.title} »`).join(', ')}` : 'No ask is open here'} (sk asks lists them)`
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
/** the item an act on `ref` goes on: an id's, or the newest version of the thread its address has; an address no
|
|
@@ -140,25 +133,21 @@ async function idOrOpen(h: Here, ref: string, title: string, as: string | undefi
|
|
|
140
133
|
return x.id
|
|
141
134
|
}
|
|
142
135
|
|
|
136
|
+
/** a reply by address answers his newest open note of the thread (review/threads.ts replyTargetOf); an id stays exact */
|
|
137
|
+
async function replyTarget(h: Here, ref: string, id: string): Promise<string> {
|
|
138
|
+
const { ID_RE } = await import('../review/model.ts')
|
|
139
|
+
if (ID_RE.test(ref) || !ref.includes(':') || /^\w+#\d+$/.test(ref)) return id
|
|
140
|
+
const { readAll } = await import('../review/store.ts')
|
|
141
|
+
const { replyTargetOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
142
|
+
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
143
|
+
return t ? replyTargetOf(t) : id
|
|
144
|
+
}
|
|
145
|
+
|
|
143
146
|
/** why a version that names no subject is refused: a thread is found by its address, so a version without one would
|
|
144
147
|
* start a thread nobody finds again */
|
|
145
148
|
const NO_ADDRESS =
|
|
146
149
|
'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'
|
|
147
150
|
|
|
148
|
-
/** the sources pulled before a read: a line per source down, said once a process and a store */
|
|
149
|
-
const downSaid = new Map<string, Set<string>>()
|
|
150
|
-
async function pull(h: Here): Promise<void> {
|
|
151
|
-
if (!h.unit?.sources?.length) return
|
|
152
|
-
const { pullSources } = await import('../review/project.ts')
|
|
153
|
-
const now = new Set<string>()
|
|
154
|
-
const said = downSaid.get(h.dir)
|
|
155
|
-
const got = await pullSources(h.dir, h.unit, (l) => {
|
|
156
|
-
now.add(l)
|
|
157
|
-
if (!said?.has(l)) h.err(l)
|
|
158
|
-
})
|
|
159
|
-
downSaid.set(h.dir, now)
|
|
160
|
-
if (got.length > 0) h.err(`review: ${got.length} new items pulled`)
|
|
161
|
-
}
|
|
162
151
|
|
|
163
152
|
/** a gallery tile as given: `<label>=<file>`, or a file labelled by its name */
|
|
164
153
|
/** one tile of `--gallery`: `[<row>/]<label>=[<before>,]<after>`, or a bare file named by its own name */
|
|
@@ -212,7 +201,7 @@ export function takeViews(args: readonly string[]): { views: ViewInput[]; rest:
|
|
|
212
201
|
return { views, rest }
|
|
213
202
|
}
|
|
214
203
|
|
|
215
|
-
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]'
|
|
204
|
+
const ADD_VIEW_USAGE = 'add-view <id> "<label>" <a.png> [<b.png>] | --image <a.png> | --live [<label>] <url> | --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]'
|
|
216
205
|
const MEDIA_FILE = /\.(png|jpe?g|webp|gif|mp4|webm|mov|wav|mp3|flac|ogg|opus|m4a)$/i
|
|
217
206
|
|
|
218
207
|
/** one `--option` of a question: words, a media file, `<label>=<file>` or `<label>=<before>,<after>` (a gallery tile's
|
|
@@ -251,6 +240,16 @@ async function withPoster(view: ViewInput): Promise<{ view: ViewInput; drop: ()
|
|
|
251
240
|
}
|
|
252
241
|
}
|
|
253
242
|
|
|
243
|
+
/** add-view's args with `--live [<label>] <url>` taken out (review/live-post.ts takeLives): the id, the page alone in
|
|
244
|
+
* the view, its label the live one's, else --label, else « live page » */
|
|
245
|
+
export function addViewLive(rest: readonly string[], lives: readonly { label: string; url: string }[]): { id: string; view: ViewInput; repoFlags: Record<string, string[]> } {
|
|
246
|
+
const l = rest.indexOf('--label')
|
|
247
|
+
const label = lives[0]?.label || (l >= 0 ? rest[l + 1] : undefined) || 'live page'
|
|
248
|
+
const words = l < 0 ? [...rest] : rest.filter((_, i) => i !== l && i !== l + 1)
|
|
249
|
+
if (lives.length !== 1 || words.length !== 1 || words[0]!.startsWith('--')) throw new Error(`--live: one page a view, alone; add-view <id> --live [<label>] <url>`)
|
|
250
|
+
return { id: words[0]!, view: { label }, repoFlags: {} }
|
|
251
|
+
}
|
|
252
|
+
|
|
254
253
|
/** 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 */
|
|
255
254
|
export async function addViewArgs(args: readonly string[], own: readonly string[]): Promise<{ id: string; view: ViewInput; repoFlags: Record<string, string[]> }> {
|
|
256
255
|
const one: Record<string, string> = {}
|
|
@@ -335,7 +334,8 @@ function flagsOf(args: readonly string[], values: readonly string[], repeat: rea
|
|
|
335
334
|
}
|
|
336
335
|
|
|
337
336
|
const ADD_FLAGS = `flags:
|
|
338
|
-
--title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same)
|
|
337
|
+
--title "<title>" one short line: what he looks at (a lone "<title>" after the address is the same); the first version's names the thread, a next version's is its own caption (left out: the one before it)
|
|
338
|
+
--rename a next version's --title renames the thread too, on purpose: a trace line in the thread says so
|
|
339
339
|
--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)
|
|
340
340
|
--post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
|
|
341
341
|
--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)
|
|
@@ -351,7 +351,7 @@ const ADD_FLAGS = `flags:
|
|
|
351
351
|
--mesh <a.glb> a mesh he walks through, in the lightbox only; --image <poster.png> its still in the thread, else one shot now
|
|
352
352
|
--before <a.png> --after <b.png> a before and after: two images, two clips of one size, or two sounds
|
|
353
353
|
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)
|
|
354
|
-
--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
|
|
354
|
+
--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; a page of the hub itself: its shot and a link, never a frame
|
|
355
355
|
--label "<label>" the first view's label
|
|
356
356
|
--view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
|
|
357
357
|
--choice the older form of a question: posts sk thread ask with each --view an option, and prints that form
|
|
@@ -467,7 +467,7 @@ export class ReviewAddCommand extends Command {
|
|
|
467
467
|
['one image', 'sk thread post screen:menu --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
|
|
468
468
|
['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'],
|
|
469
469
|
['a before and after', 'sk thread post asset:lamps --title "lamps lit" --what "..." --before a.png --after b.png'],
|
|
470
|
-
['the next version: the same address, the tool links it', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
|
|
470
|
+
['the next version: the same address, the tool links it, the thread keeps its name', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
|
|
471
471
|
['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'],
|
|
472
472
|
['a 360° panorama he looks around in', 'sk thread post screen:hall --title "the hall in 360" --what "..." --pano hall-360.png'],
|
|
473
473
|
['a Gaussian splat he orbits, its poster shot now', 'sk thread post asset:hall --title "the hall as a splat" --what "..." --splat hall.ply'],
|
|
@@ -497,8 +497,11 @@ export class ReviewAddCommand extends Command {
|
|
|
497
497
|
const kindName = rest[rest.indexOf('--subject') + 1]
|
|
498
498
|
const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
|
|
499
499
|
const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
|
|
500
|
-
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'])
|
|
500
|
+
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', 'rename'])
|
|
501
501
|
const o = f.one
|
|
502
|
+
// --what is one or two short lines: a wall goes as a document, --md, and needs no escape
|
|
503
|
+
const wall = o.what !== undefined ? (await import('../review/reply-guards.ts')).wallInWords(o.what, '--what', f.positionals[0] ?? '<address>', false) : null
|
|
504
|
+
if (wall !== null) throw new Error(wall)
|
|
502
505
|
// --image repeats only as the stills of a kind's page, one a view (<view>=<a.png>)
|
|
503
506
|
const images = f.many.image ?? []
|
|
504
507
|
if (images.length === 1) o.image = images[0]!
|
|
@@ -525,7 +528,7 @@ export class ReviewAddCommand extends Command {
|
|
|
525
528
|
if (o.on !== undefined && addressOrThrow(o.on) !== a) throw new Error(`${a} and --on ${o.on}: one address a version`)
|
|
526
529
|
o.on = a
|
|
527
530
|
}
|
|
528
|
-
if (o.on !== undefined) await declaredOrThrow(h, addressOrThrow(o.on))
|
|
531
|
+
if (o.on !== undefined) o.on = await declaredOrThrow(h, addressOrThrow(o.on))
|
|
529
532
|
for (const a of f.many.about ?? []) await declaredOrThrow(h, addressOrThrow(a))
|
|
530
533
|
// a lone word is the title, as `sk ask <title>` takes it; a media file never is
|
|
531
534
|
const [lone, ...more] = f.positionals
|
|
@@ -617,10 +620,12 @@ export class ReviewAddCommand extends Command {
|
|
|
617
620
|
...(f.on.has('new') ? { fresh: true } : {}),
|
|
618
621
|
...(f.on.has('choice') ? { choice: true } : {}),
|
|
619
622
|
...(f.on.has('keep') ? { keep: true } : {}),
|
|
623
|
+
...(f.on.has('rename') ? { rename: true as const } : {}),
|
|
620
624
|
...(o.pick !== undefined ? { agentPick: o.pick } : {}),
|
|
621
625
|
...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
|
|
622
626
|
}
|
|
623
627
|
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
|
|
628
|
+
if (!media && input.on !== undefined && input.rename) throw new Error('--rename: a version renames its thread; words with no media are a reply in it and never rename it: post the version with its media, or leave --rename out')
|
|
624
629
|
if (!media && input.on !== undefined) return postWords(h, input.on, input.title, input.what, input.lane, f.on.has('verdict'))
|
|
625
630
|
// a version asks the owner's verdict always: the field says it, the flag changes nothing else
|
|
626
631
|
if (f.on.has('verdict')) input = { ...input, asksVerdict: true }
|
|
@@ -646,6 +651,12 @@ export class ReviewAddCommand extends Command {
|
|
|
646
651
|
})
|
|
647
652
|
if (still) await keepStill(h, item, still)
|
|
648
653
|
h.out(item.id)
|
|
654
|
+
if (item.rename !== true) {
|
|
655
|
+
const { readAll, captionLine } = await import('../review/store.ts')
|
|
656
|
+
const { membersOf, threadOfItem, threadsOf, threadTitle } = await import('../review/threads.ts')
|
|
657
|
+
const t = threadOfItem(item.id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
658
|
+
if (t !== null && membersOf(t).length > 1 && threadTitle(t).trim() !== item.title) h.err(captionLine(threadTitle(t).trim(), item.title))
|
|
659
|
+
}
|
|
649
660
|
// on stderr: a script reads the id alone on stdout
|
|
650
661
|
await saidIntoThread(h, item, o.supersedes !== undefined)
|
|
651
662
|
if (wipLine !== undefined) {
|
|
@@ -686,6 +697,10 @@ export class ReviewAddCommand extends Command {
|
|
|
686
697
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
687
698
|
const unheard = unheardLine(item, liveWatchers(h.dir))
|
|
688
699
|
if (unheard) h.err(unheard)
|
|
700
|
+
// last: the page he could open from the thread, when its kind runs one
|
|
701
|
+
const { liveHint } = await import('../review/live-post.ts')
|
|
702
|
+
const hint = liveHint(address, h.say.spec, { id: item.id, media, live: lives.length > 0 || o.live !== undefined })
|
|
703
|
+
if (hint) h.err(hint)
|
|
689
704
|
return 0
|
|
690
705
|
})
|
|
691
706
|
}
|
|
@@ -815,8 +830,8 @@ async function choiceAsQuestion(h: Here, o: Record<string, string>, views: reado
|
|
|
815
830
|
|
|
816
831
|
async function saidIntoThread(h: Here, item: import('../review/model.ts').Item, typed: boolean): Promise<void> {
|
|
817
832
|
const { readAll } = await import('../review/store.ts')
|
|
818
|
-
const { ownAddressOf,
|
|
819
|
-
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
833
|
+
const { ownAddressOf, verdictOf } = await import('../review/model.ts')
|
|
834
|
+
const { openNotesOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
820
835
|
const items = readAll(h.dir).items
|
|
821
836
|
const t = threadOfItem(item.id, threadsOf(items, h.say.spec))
|
|
822
837
|
const own = ownAddressOf(item, h.say.spec)
|
|
@@ -825,8 +840,7 @@ async function saidIntoThread(h: Here, item: import('../review/model.ts').Item,
|
|
|
825
840
|
const waited = verdictOf(before) === null && before.item.views.length > 0
|
|
826
841
|
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>`)
|
|
827
842
|
}
|
|
828
|
-
const
|
|
829
|
-
const open = notes.filter((x) => stateOf(x, false).state !== 'closed' && !(item.answers ?? []).includes(x.item.id))
|
|
843
|
+
const open = (t ? openNotesOf(t) : []).filter((x) => !(item.answers ?? []).includes(x.item.id))
|
|
830
844
|
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>`)
|
|
831
845
|
}
|
|
832
846
|
|
|
@@ -851,8 +865,27 @@ async function postWords(h: Here, address: string, title: string, what: string,
|
|
|
851
865
|
}
|
|
852
866
|
|
|
853
867
|
/** an agent's words in a thread, its image beside them; `verdict`: they wait for the owner's verdict (review/verdict-items.ts) */
|
|
854
|
-
|
|
868
|
+
/** an agent's words to the owner pass the wall guard, `long` the reason they may not; a hint when many lines carry no marker
|
|
869
|
+
* (review/reply-guards.ts) */
|
|
870
|
+
async function guardWords(h: { err: (s: string) => void }, text: string, verb: string, address: string, long: string | undefined): Promise<void> {
|
|
871
|
+
const { unmarkedHint, wallInWords } = await import('../review/reply-guards.ts')
|
|
872
|
+
if (long !== undefined && long.trim() === '') throw new Error('--long "<why>": the reason it is long, shown in the thread')
|
|
873
|
+
const wall = long === undefined ? wallInWords(text, verb, address) : null
|
|
874
|
+
if (wall !== null) throw new Error(wall)
|
|
875
|
+
const hint = unmarkedHint(text)
|
|
876
|
+
if (hint !== null) h.err(hint)
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
const LONG_FLAG = 'past the wall bound on purpose: why, a quiet mark under the words in the thread; a long text is a document (sk thread post <address> --md <file>)'
|
|
880
|
+
|
|
881
|
+
async function wordsIn(dir: string, id: string, who: string, text: string, verdict: boolean, image?: string, long?: string): Promise<import('../review/model.ts').Message> {
|
|
855
882
|
const { addMessage, appendMessage, readItem } = await import('../review/store.ts')
|
|
883
|
+
if (long !== undefined) {
|
|
884
|
+
const { textOf } = await import('../review/model.ts')
|
|
885
|
+
const t = textOf(text)
|
|
886
|
+
if ('error' in t) throw new Error(t.error)
|
|
887
|
+
return appendMessage(dir, id, { who, text: t.text, long: long.trim(), ...(verdict ? { asksVerdict: true as const } : {}) }, image !== undefined ? { image } : {})
|
|
888
|
+
}
|
|
856
889
|
if (!verdict) return addMessage(dir, id, who, text, image)
|
|
857
890
|
const { textOf } = await import('../review/model.ts')
|
|
858
891
|
if (!readItem(dir, id)) throw new Error(`no item ${id}`)
|
|
@@ -861,12 +894,31 @@ async function wordsIn(dir: string, id: string, who: string, text: string, verdi
|
|
|
861
894
|
return appendMessage(dir, id, { who, text: t.text, asksVerdict: true }, image !== undefined ? { image } : {})
|
|
862
895
|
}
|
|
863
896
|
|
|
897
|
+
/** what an agent asked in the thread of item `id` that still waits on the owner after its reply `mine`: the owner's words
|
|
898
|
+
* answer a question, a change or words asking the owner's verdict by themselves (model.ts wordsAnswerOf), so each line
|
|
899
|
+
* left is one his click answers or its agent takes back; never left open under a reply that says nothing more is needed */
|
|
900
|
+
async function stillOpenLines(dir: string, id: string, mine: string): Promise<string[]> {
|
|
901
|
+
const { readAll } = await import('../review/store.ts')
|
|
902
|
+
const { openAsksOf, openItemVerdictsOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
903
|
+
const t = threadOfItem(id, threadsOf(readAll(dir).items))
|
|
904
|
+
if (t === null) return []
|
|
905
|
+
const open = [...openAsksOf(t), ...openItemVerdictsOf(t)].filter((m) => m.id !== mine)
|
|
906
|
+
if (open.length === 0) return []
|
|
907
|
+
const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
|
|
908
|
+
return [
|
|
909
|
+
` ${open.length} still wait${open.length > 1 ? '' : 's'} on him in this thread: his click answers ${open.length > 1 ? 'each' : 'it'}; when it asks nothing more, sk thread withdraw <id> --why "<why>" takes it back`,
|
|
910
|
+
...open.map((m) => ` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`),
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
|
|
864
914
|
/** `--verdict` on a posting verb: it waits for the owner's verdict (wiki tools/shipkit/threads-how-it-fits.md, The model) */
|
|
865
915
|
const VERDICT_FLAG = "it waits for the owner's verdict (approve, fix, reject on it in the hub, « judge » in the inbox): a thing made that the owner approves before it ships or lands; a choice of what to do is a question, a visible change a version, never on a progress line"
|
|
866
916
|
|
|
867
917
|
export class ReviewAddViewCommand extends Command {
|
|
868
918
|
static override paths = [['review', 'add-view']]
|
|
869
919
|
static essential = {}
|
|
920
|
+
/** the flags its proxy reads, as its usage lists them: what a doc may name (RV019) */
|
|
921
|
+
static proxyFlags = [...new Set(ADD_VIEW_USAGE.match(/--[a-z][a-z0-9-]*/g) ?? [])]
|
|
870
922
|
static override usage = Command.Usage({
|
|
871
923
|
category: 'Review',
|
|
872
924
|
description: 'another angle on a version he has not answered yet: an image, a pair, a clip or a gallery',
|
|
@@ -875,6 +927,7 @@ export class ReviewAddViewCommand extends Command {
|
|
|
875
927
|
['a view from above', 'sk thread add-view <id> "from above" top.png'],
|
|
876
928
|
['a before and after', 'sk thread add-view <id> --label "on a phone" --before a.png --after b.png'],
|
|
877
929
|
['a 360° panorama', 'sk thread add-view <id> --label "inside" --pano hall-360.png'],
|
|
930
|
+
['the running page, framed', 'sk thread add-view <id> --live http://localhost:5173/settings'],
|
|
878
931
|
],
|
|
879
932
|
})
|
|
880
933
|
args = Option.Proxy()
|
|
@@ -886,9 +939,13 @@ export class ReviewAddViewCommand extends Command {
|
|
|
886
939
|
return run(this.context, async (h) => {
|
|
887
940
|
const { addViewAlso } = await import('../review/store.ts')
|
|
888
941
|
const keep = this.args.includes('--keep')
|
|
889
|
-
const
|
|
942
|
+
const { liveViews, takeLives } = await import('../review/live-post.ts')
|
|
943
|
+
const { lives, rest } = takeLives(this.args.filter((x) => x !== '--keep'))
|
|
944
|
+
const a = lives.length > 0 ? addViewLive(rest, lives) : await addViewArgs(rest, Object.keys(h.unit?.flags ?? {}))
|
|
890
945
|
const id = await idOf(h.dir, a.id)
|
|
891
|
-
|
|
946
|
+
// a live page asked and shot now, as post does: its shot is the view, its page beside it
|
|
947
|
+
const shot = lives.length > 0 ? await liveViews(lives) : null
|
|
948
|
+
const posted = shot ? { view: { ...shot.views[0]!, label: a.view.label }, drop: shot.drop } : await withPoster(a.view)
|
|
892
949
|
const v = posted.view
|
|
893
950
|
const extra = h.unit?.addView ? await h.unit.addView(v, a.repoFlags) : {}
|
|
894
951
|
const { item, added } = await addViewAlso(h.dir, id, v, { ...extra, ...(keep ? { keep: true } : {}) }).finally(posted.drop)
|
|
@@ -967,11 +1024,12 @@ export class ReviewShowCommand extends Command {
|
|
|
967
1024
|
static override usage = Command.Usage({
|
|
968
1025
|
category: 'Review',
|
|
969
1026
|
description: 'one item and its thread: the verdict, rectangles, reactions, the whole conversation',
|
|
970
|
-
details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same).`,
|
|
971
|
-
examples: [['hand a thread to another session', 'sk thread show <id> --paste']],
|
|
1027
|
+
details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3); an ask by its number too (ask:21). --paste prints the short block that hands the thread to another agent session (the hub's copy button gives the same). --md prints the whole thread as markdown, oldest first, each object whole (an ask's instructions as their source, the text sk ask edit writes), a superseded one in one line.`,
|
|
1028
|
+
examples: [['hand a thread to another session', 'sk thread show <id> --paste'], ['ask 21 as markdown, its instructions as their source', 'sk thread show ask:21 --md']],
|
|
972
1029
|
})
|
|
973
1030
|
id = Option.String({ name: 'address | id' })
|
|
974
1031
|
paste = Option.Boolean('--paste', false, { description: 'the block another agent session acts on: title, repo, this command, the links' })
|
|
1032
|
+
md = Option.Boolean('--md', false, { description: 'the whole thread as markdown: its facts, then every item and message oldest first, each object whole, a superseded one in one line' })
|
|
975
1033
|
|
|
976
1034
|
async execute(): Promise<number> {
|
|
977
1035
|
return run(this.context, async (h) => {
|
|
@@ -992,11 +1050,32 @@ export class ReviewShowCommand extends Command {
|
|
|
992
1050
|
return 0
|
|
993
1051
|
}
|
|
994
1052
|
const t = threadOfItem(x.item.id, threadsOf(all.items))
|
|
1053
|
+
// who the thread is shared with, read from the advisors' store at their times (advisors/share-trace.ts)
|
|
1054
|
+
const { dirname } = await import('node:path')
|
|
1055
|
+
const { ownAddressOf } = await import('../review/model.ts')
|
|
1056
|
+
const { shareLine, threadShareEvents } = await import('../advisors/share-trace.ts')
|
|
1057
|
+
const address = t === null ? null : ownAddressOf(t.head.item, h.say.spec)
|
|
1058
|
+
const shared = address === null ? [] : await threadShareEvents({ root: dirname(dirname(h.dir)), address })
|
|
1059
|
+
// the drive shares the owner's words name, each with its words and the command that lists it (drives/named.ts)
|
|
1060
|
+
const { membersOf } = await import('../review/threads.ts')
|
|
1061
|
+
const { sharesNamed } = await import('../drives/named.ts')
|
|
1062
|
+
const texts = (t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => (m.text === undefined ? [] : [m.text])))
|
|
1063
|
+
if (this.md) {
|
|
1064
|
+
if (t === null) throw new Error(`${this.id} reads in no thread`)
|
|
1065
|
+
const { threadMarkdown } = await import('../review/thread-md.ts')
|
|
1066
|
+
const { withThreadLook } = await import('../review/refs.ts')
|
|
1067
|
+
h.out(withThreadLook(h.say.look, () => threadMarkdown(t, mediaDir(h.dir), h.say.spec, shared.map((e) => ({ at: e.at, md: `- ${shareLine(e)}` })))).replace(/\n$/, ''))
|
|
1068
|
+
const named = sharesNamed(dirname(dirname(h.dir)), texts, true)
|
|
1069
|
+
if (named !== null) h.out(`\n${named}`)
|
|
1070
|
+
return 0
|
|
1071
|
+
}
|
|
995
1072
|
// the paths it prints are on the disk: a message's image or file the purge let go comes back first
|
|
996
1073
|
const { ensureLocal } = await import('../review/media-read.ts')
|
|
997
|
-
const { membersOf } = await import('../review/threads.ts')
|
|
998
1074
|
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}`))))))
|
|
999
1075
|
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))
|
|
1076
|
+
if (shared.length > 0) h.out([' shared with people outside (the advisors):', ...shared.map((e) => ` ${shareLine(e)}`)].join('\n'))
|
|
1077
|
+
const named = sharesNamed(dirname(dirname(h.dir)), texts)
|
|
1078
|
+
if (named !== null) h.out(named)
|
|
1000
1079
|
return 0
|
|
1001
1080
|
})
|
|
1002
1081
|
}
|
|
@@ -1025,47 +1104,25 @@ export class ReviewInboxCommand extends Command {
|
|
|
1025
1104
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
1026
1105
|
subject = Option.String('--subject', { description: 'only items of this subject kind (frame, shot…)' })
|
|
1027
1106
|
all = Option.Boolean('--all', false, { description: 'a plain approval too, not only the counted line' })
|
|
1028
|
-
hook = Option.Boolean('--hook', false, { description: 'run as a Claude Code hook (UserPromptSubmit, Stop, SubagentStop): the hook input on stdin, its json answer on stdout. 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' })
|
|
1107
|
+
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' })
|
|
1029
1108
|
|
|
1030
1109
|
async execute(): Promise<number> {
|
|
1031
|
-
const {
|
|
1032
|
-
|
|
1033
|
-
const input = this.hook ? parseHookInput(process.stdin.isTTY === true ? '' : await new Response(Bun.stdin.stream()).text().catch(() => '')) : null
|
|
1110
|
+
const { hookPasses } = await import('../review/inbox-hook.ts')
|
|
1111
|
+
const input = this.hook ? await (await import('./inbox-hook-run.ts')).readHookInput() : null
|
|
1034
1112
|
if (input != null && hookPasses(input)) return 0
|
|
1035
1113
|
return run(this.context, async (h) => {
|
|
1036
1114
|
const { BUILTIN_KINDS, untakenOf } = await import('../review/model.ts')
|
|
1037
1115
|
const kinds = [...Object.keys(h.say.spec.kinds), ...Object.keys(BUILTIN_KINDS)]
|
|
1038
1116
|
if (this.subject !== undefined && Object.keys(h.say.spec.kinds).length > 0 && !kinds.includes(this.subject)) throw new Error(`--subject: one of ${kinds.join(', ')}`)
|
|
1039
|
-
|
|
1117
|
+
// as a hook: the same run as the hook's own boot (cli.ts)
|
|
1118
|
+
if (input != null) return (await import('./inbox-hook-run.ts')).inboxHook(h, input)
|
|
1119
|
+
const { selectInbox, selectedText } = await import('../review/inbox-read.ts')
|
|
1040
1120
|
const { followedIds, hears, listenersOf, sinceHeLeft, threadByItem, threadsOf } = await import('../review/threads.ts')
|
|
1041
1121
|
const { untakenLine } = await import('../review/format.ts')
|
|
1042
1122
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1043
1123
|
await pull(h)
|
|
1044
1124
|
const here = await hereStore(h)
|
|
1045
1125
|
for (const b of here.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
|
|
1046
|
-
if (input != null) {
|
|
1047
|
-
// as a hook: what this session hears, in its own repo and in every store it or its lanes wrote in
|
|
1048
|
-
const session = hookSession(input)
|
|
1049
|
-
const { noteHanded, noteSession } = await import('../agent-time/registry.ts')
|
|
1050
|
-
if (session !== null) noteSession(h.dir)
|
|
1051
|
-
let stores = [here, ...(session === null ? [] : await storesOf(session, h.dir))]
|
|
1052
|
-
// a SubagentStop fires at every turn a lane ends, one that waits on its background work too: the
|
|
1053
|
-
// registry reads which (agent-time/registry.ts readParties, stopped)
|
|
1054
|
-
const parties = await partiesFor(stores, session, endedAgentOf(input))
|
|
1055
|
-
// rule 2 as a write: a thread whose holder is gone passes on now (review/hand-over.ts)
|
|
1056
|
-
const { handOver, handedLines } = await import('../review/hand-over.ts')
|
|
1057
|
-
const handed = session === null ? [] : stores.flatMap((s) => handOver(s.dir, s.say.spec, parties, s.repo, { onHanded: noteHanded }))
|
|
1058
|
-
if (input.hook_event_name === 'SubagentStop') return 0
|
|
1059
|
-
if (handed.length > 0) stores = [await hereStore(h), ...(session === null ? [] : await storesOf(session, h.dir))]
|
|
1060
|
-
const me = { lane: null, session }
|
|
1061
|
-
// the session's own watch in a store, or its one house watch for all of them
|
|
1062
|
-
const { laneWatchesOf, watchedBy } = await import('../review/watchers.ts')
|
|
1063
|
-
const watchedIn = watchedBy(session, stores.map((s) => s.dir))
|
|
1064
|
-
const laneWatches = session === null ? [] : laneWatchesOf(session, stores.map((s) => s.dir))
|
|
1065
|
-
const answer = hookReply({ input, me, stores, parties, onHanded: noteHanded, handed: handedLines(handed.filter((x) => x.to === session)), watchedIn, laneWatches })
|
|
1066
|
-
if (answer != null) h.out(answer)
|
|
1067
|
-
return 0
|
|
1068
|
-
}
|
|
1069
1126
|
const session = await sessionOf(this.mine, this.session)
|
|
1070
1127
|
const lane = this.mine ? callerLane(undefined) : null
|
|
1071
1128
|
const parties = session === null && lane === null ? null : await partiesFor([here], session)
|
|
@@ -1089,6 +1146,15 @@ export class ReviewInboxCommand extends Command {
|
|
|
1089
1146
|
return ` ${x.item.id} ${fix ? 'ok with a fix' : 'rejected'} "${x.item.title}": ${close}, or sk thread wontfix ${x.item.id} --note "<why>"`
|
|
1090
1147
|
}
|
|
1091
1148
|
if (sel.owed.length > 0) h.out(`owed, read and not done:\n${sel.owed.map(owedLine).join('\n')}\n`)
|
|
1149
|
+
// the threads this process's session or lane holds whose move is the agents' (review/inbox-read.ts heldOwedLines)
|
|
1150
|
+
const { sessionId } = await import('../review/store.ts')
|
|
1151
|
+
const holder = { session: session ?? sessionId(), lane: lane ?? callerLane(undefined) }
|
|
1152
|
+
if (holder.session !== null || holder.lane !== null) {
|
|
1153
|
+
const { heldOwedLines } = await import('../review/inbox-read.ts')
|
|
1154
|
+
const shown = new Set([...sel.threads.flatMap((g) => (g.t ? [g.t.head.item.id] : [])), ...sel.owed.map((t) => t.head.item.id)])
|
|
1155
|
+
const held = heldOwedLines(here, holder, parties ?? (await partiesFor([here], holder.session)), shown)
|
|
1156
|
+
if (held.length > 0) h.out(`yours to close, nobody at work on them:\n${held.join('\n')}\n`)
|
|
1157
|
+
}
|
|
1092
1158
|
const watchers = liveWatchers(h.dir)
|
|
1093
1159
|
const byItem = threadByItem(threadsOf(here.items, h.say.spec))
|
|
1094
1160
|
const followed = followedIds(here.items)
|
|
@@ -1104,67 +1170,6 @@ export class ReviewInboxCommand extends Command {
|
|
|
1104
1170
|
}
|
|
1105
1171
|
}
|
|
1106
1172
|
|
|
1107
|
-
/** the store the verb stands in, read for the inbox */
|
|
1108
|
-
async function hereStore(h: Here): Promise<import('../review/inbox-read.ts').StoreRead> {
|
|
1109
|
-
const { readAll } = await import('../review/store.ts')
|
|
1110
|
-
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
1111
|
-
const { dirname } = await import('node:path')
|
|
1112
|
-
const root = dirname(dirname(h.dir))
|
|
1113
|
-
return { repo: repoNameOf(root), root, dir: h.dir, here: true, ...readAll(h.dir), say: h.say }
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
/** every other store this session or its lanes wrote in (agent-time/registry.ts), each with its repo's unit bound */
|
|
1117
|
-
async function storesOf(session: string, hereDir: string): Promise<import('../review/inbox-read.ts').StoreRead[]> {
|
|
1118
|
-
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
1119
|
-
const { readAll } = await import('../review/store.ts')
|
|
1120
|
-
const { dirname, resolve } = await import('node:path')
|
|
1121
|
-
const out: import('../review/inbox-read.ts').StoreRead[] = []
|
|
1122
|
-
for (const dir of await recordedStores(session, (d) => resolve(d) === resolve(hereDir))) {
|
|
1123
|
-
const root = dirname(dirname(dir))
|
|
1124
|
-
try {
|
|
1125
|
-
const { say } = await hereAt(dir, () => {}, () => {})
|
|
1126
|
-
out.push({ repo: repoNameOf(root), root, dir, here: false, ...readAll(dir), say })
|
|
1127
|
-
} catch {
|
|
1128
|
-
// a store that does not read now: its own repo's hook and inbox say why
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
return out
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
/** the stores the session's record names, but those `skip` keeps out; only a store its commands run in (`sk thread
|
|
1135
|
-
* seen` there refuses a folder that is no shipkit repo), the others leave its record */
|
|
1136
|
-
async function recordedStores(session: string, skip: (dir: string) => boolean): Promise<string[]> {
|
|
1137
|
-
const { forgetStores, readSessionRecord, scratchStore } = await import('../agent-time/registry.ts')
|
|
1138
|
-
const { existsSync } = await import('node:fs')
|
|
1139
|
-
const { dirname } = await import('node:path')
|
|
1140
|
-
const dirs: string[] = []
|
|
1141
|
-
const gone: string[] = []
|
|
1142
|
-
for (const d of (readSessionRecord(session)?.stores ?? []).filter((x) => !skip(x))) (!scratchStore(d) && existsSync(d) && (await reviewRoot(dirname(dirname(d)))) !== null ? dirs : gone).push(d)
|
|
1143
|
-
forgetStores(session, gone)
|
|
1144
|
-
return dirs
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
/** the store at `dir` of another repo as a verb works on it, its repo's unit bound */
|
|
1148
|
-
async function hereAt(dir: string, out: (l: string) => void, err: (l: string) => void): Promise<Here> {
|
|
1149
|
-
const { openReview, factLines } = await import('../review/project.ts')
|
|
1150
|
-
const { specOf } = await import('../review/store.ts')
|
|
1151
|
-
const { dirname } = await import('node:path')
|
|
1152
|
-
const { unit } = await openReview(dirname(dirname(dir)))
|
|
1153
|
-
return { dir, unit, say: { spec: specOf(dir), more: (x) => factLines(unit, x) }, out, err }
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
/** the parties these stores' threads name: their holders' sessions and the caller's, with each store's live watches */
|
|
1157
|
-
async function partiesFor(stores: readonly import('../review/inbox-read.ts').StoreRead[], self: string | null, stopped: string | null = null): Promise<import('../review/parties.ts').Parties> {
|
|
1158
|
-
const { readParties } = await import('../agent-time/registry.ts')
|
|
1159
|
-
const { holderOf, threadsOf } = await import('../review/threads.ts')
|
|
1160
|
-
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1161
|
-
const ids = new Set<string>()
|
|
1162
|
-
for (const s of stores) for (const t of threadsOf(s.items, s.say.spec)) {
|
|
1163
|
-
const hs = holderOf(t)?.session
|
|
1164
|
-
if (hs) ids.add(hs)
|
|
1165
|
-
}
|
|
1166
|
-
return readParties({ sessions: [...ids], watchers: stores.flatMap((s) => liveWatchers(s.dir)), self, stopped })
|
|
1167
|
-
}
|
|
1168
1173
|
|
|
1169
1174
|
/** the lane that acts on a reply or a seen, by this process's SK_AGENT (review/parties.ts laneOfCaller) */
|
|
1170
1175
|
const callerLane = (as: string | undefined): string | null => laneOfCaller(as, process.env.SK_AGENT)
|
|
@@ -1186,6 +1191,27 @@ async function seenRefused(dir: string, id: string, as: string | undefined): Pro
|
|
|
1186
1191
|
return { refused: seenRefusal(x, t, me, parties), ...(only !== undefined ? { only } : {}) }
|
|
1187
1192
|
}
|
|
1188
1193
|
|
|
1194
|
+
/** the line the owner reads at the bottom of the thread of item `id` now, in its dock (review/expect.ts expectOf, the
|
|
1195
|
+
* hub's own): an agent's words never contradict it */
|
|
1196
|
+
async function headLine(dir: string, id: string): Promise<string | null> {
|
|
1197
|
+
const { readAll } = await import('../review/store.ts')
|
|
1198
|
+
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1199
|
+
const { threadView, waitsOnOwner } = await import('../review/cells.ts')
|
|
1200
|
+
const { expectOf, waitLinesOf } = await import('../review/expect.ts')
|
|
1201
|
+
const { validatedOf } = await import('../review/band.ts')
|
|
1202
|
+
const items = readAll(dir).items
|
|
1203
|
+
const threads = threadsOf(items)
|
|
1204
|
+
const t = threadOfItem(id, threads)
|
|
1205
|
+
if (t === null) return null
|
|
1206
|
+
const v = threadView(t, items, threads, t.head.item.id)
|
|
1207
|
+
const head = v.cells.find((c) => c.id === v.head && c.kind === 'version')
|
|
1208
|
+
const version = v.waits && v.state.state !== 'closed' && head?.kind === 'version' ? { id: head.id, n: head.n } : null
|
|
1209
|
+
const waiting = waitLinesOf(v.cells.filter(waitsOnOwner), version, v.ask ? { state: v.ask.state, title: v.ask.title, head: v.head } : undefined)
|
|
1210
|
+
const { parties } = await callerParties(dir, t, undefined)
|
|
1211
|
+
const e = expectOf({ ...v, waiting, ...(v.aside ? { aside: v.aside } : {}), validated: validatedOf({ turn: v.turn, status: v.status, ...(v.ask ? { ask: v.ask.state } : {}) }) }, parties)
|
|
1212
|
+
return `the owner reads at the bottom of the thread: « ${e.words} »: your words never say otherwise`
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1189
1215
|
/** the caller and the parties its thread's holder names */
|
|
1190
1216
|
async function callerParties(dir: string, t: import('../review/threads.ts').Thread | null, as: string | undefined): Promise<{ me: import('../review/parties.ts').Me; parties: import('../review/parties.ts').Parties }> {
|
|
1191
1217
|
const { sessionId } = await import('../review/store.ts')
|
|
@@ -1194,7 +1220,9 @@ async function callerParties(dir: string, t: import('../review/threads.ts').Thre
|
|
|
1194
1220
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1195
1221
|
const me = { lane: callerLane(as), session: sessionId() }
|
|
1196
1222
|
const hs = t ? holderOf(t)?.session : undefined
|
|
1197
|
-
|
|
1223
|
+
const { hearingHolders } = await import('../orchestrator/role.ts')
|
|
1224
|
+
const { placeParties } = await import('../orchestrator/places.ts')
|
|
1225
|
+
return { me, parties: await readParties({ sessions: hs ? [hs] : [], watchers: liveWatchers(dir), self: me.session, roles: hearingHolders, places: placeParties }) }
|
|
1198
1226
|
}
|
|
1199
1227
|
|
|
1200
1228
|
/** the caller holds the item's thread (review/parties.ts holdsThread): it may close what that thread's lane claimed */
|
|
@@ -1270,10 +1298,21 @@ export class ReviewSeenCommand extends Command {
|
|
|
1270
1298
|
const refused = scopes.map((s) => s.refused).filter((w) => w !== null)
|
|
1271
1299
|
if (refused.length > 0) throw new Error(`nothing marked: ${refused.join('; ')}`)
|
|
1272
1300
|
let bad = 0
|
|
1301
|
+
const { readItem } = await import('../review/store.ts')
|
|
1302
|
+
const { wordText } = await import('../review/format.ts')
|
|
1273
1303
|
for (const [i, [ref, id]] of ids.entries()) {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1304
|
+
const at = new Date()
|
|
1305
|
+
if (markSeen(h.dir, id, at, scopes[i]!.only)) {
|
|
1306
|
+
// each word the mark names, so a thread marked by its address is read, never skipped
|
|
1307
|
+
const x = readItem(h.dir, id)
|
|
1308
|
+
const mark = x?.thread.find((m) => m.op === 'seen' && m.at === at.toISOString() && m.who !== 'owner')
|
|
1309
|
+
const words = (mark?.of ?? []).flatMap((w) => x?.thread.find((m) => m.id === w) ?? [])
|
|
1310
|
+
h.out(`${ref}: seen${words.length > 0 ? `, ${words.length} word${words.length > 1 ? 's' : ''}` : ''}`)
|
|
1311
|
+
for (const m of words) h.out(` ${wordText(m)}`)
|
|
1312
|
+
} else {
|
|
1313
|
+
// say which: an item that does not exist, none of the owner's words on it is the caller's, or none unseen
|
|
1314
|
+
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'
|
|
1315
|
+
h.err(`FAIL: review: ${ref}: ${why}`)
|
|
1277
1316
|
bad++
|
|
1278
1317
|
}
|
|
1279
1318
|
}
|
|
@@ -1291,12 +1330,16 @@ export class ThreadWorkingCommand extends Command {
|
|
|
1291
1330
|
static override usage = Command.Usage({
|
|
1292
1331
|
category: 'Review',
|
|
1293
1332
|
description: 'say you are on his new words in a thread, one line of what you do now; your next act there ends it',
|
|
1294
|
-
details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for
|
|
1295
|
-
examples: [
|
|
1333
|
+
details: `${DETAILS}\n\nMark his new words seen as you read them (sk thread seen), then, for work longer than your next call, say what you do with them here: he sees « L29 is on it: <line> » in the thread, its head and its row. It ends with the next act in the thread, yours or another agent's (a version, an update, a reply, a question, a change, a close, a take, a newer working), or once nothing moved for 30 min: past it the thread reads « waiting for an agent », its row « said working <age> ago, nothing since », and a longer piece of work says working again. A read with no act after it keeps his word owed: a turn's end holds on it. A working line answers nothing: one that only acknowledges his answer to a question or a pick (« noted », « ok », « I collect your picks ») is refused, and sk thread reply answers it. Never written for you: no watch, beat or hook says it (wiki tools/shipkit/threads-how-it-fits.md, Read and on it).`,
|
|
1334
|
+
examples: [
|
|
1335
|
+
['on it', 'SK_AGENT=L29 sk thread working page:backup "backing up the key in OpenBao"'],
|
|
1336
|
+
['the next version promised: v1 asks no verdict meanwhile, late past the time', 'SK_AGENT=L29 sk thread working page:plans/x "v2: the plan with your picks" --next 2026-11-30'],
|
|
1337
|
+
],
|
|
1296
1338
|
})
|
|
1297
1339
|
ref = Option.String({ name: 'address | id' })
|
|
1298
1340
|
line = Option.String()
|
|
1299
1341
|
as = Option.String('--as', { description: 'the lane on it (else SK_AGENT)' })
|
|
1342
|
+
next = Option.String('--next', { description: 'you promise the next version by then: a span (90m, 4h, 3d) or a time (2026-11-30, 2026-11-30T18:00); the version before it asks no verdict meanwhile, and past that time the thread says the promise is late, naming you' })
|
|
1300
1343
|
|
|
1301
1344
|
async execute(): Promise<number> {
|
|
1302
1345
|
return run(this.context, async (h) => {
|
|
@@ -1307,9 +1350,43 @@ export class ThreadWorkingCommand extends Command {
|
|
|
1307
1350
|
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1308
1351
|
const id = await idOf(h.dir, this.ref)
|
|
1309
1352
|
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
1353
|
+
if (t !== null) {
|
|
1354
|
+
const no = (await import('../review/working-guards.ts')).workingRefusal(t, line, this.ref)
|
|
1355
|
+
if (no !== null) throw new Error(no)
|
|
1356
|
+
}
|
|
1310
1357
|
const who = callerLane(this.as) ?? 'agent'
|
|
1311
|
-
|
|
1312
|
-
|
|
1358
|
+
const until = this.next === undefined ? null : (await import('../review/expect.ts')).promiseUntil(this.next)
|
|
1359
|
+
if (until !== null && 'error' in until) throw new Error(until.error)
|
|
1360
|
+
appendMessage(h.dir, t?.head.item.id ?? id, { who, op: 'working', note: line, ...(until !== null ? { next: { until: until.until } } : {}) })
|
|
1361
|
+
h.out(until !== null ? `${this.ref}: ${who} promises the next version by ${until.until}: ${line} (your next version ends it; past that time the thread says it is late)` : `${this.ref}: ${who} is on it: ${line} (your next act in this thread ends it)`)
|
|
1362
|
+
const said = await headLine(h.dir, t?.head.item.id ?? id)
|
|
1363
|
+
if (said !== null) h.out(said)
|
|
1364
|
+
return 0
|
|
1365
|
+
})
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
export class ThreadTagCommand extends Command {
|
|
1370
|
+
static override paths = [['thread', 'tag']]
|
|
1371
|
+
static override usage = Command.Usage({
|
|
1372
|
+
category: 'Review',
|
|
1373
|
+
description: "a thread's tags: lowercase words that sort and find threads; with no tag, the tags it has",
|
|
1374
|
+
details: `${DETAILS}\n\nA tag is a lowercase word of letters, digits and dashes (ux, login-flow). +<tag> or a bare <tag> adds it, -<tag> takes it away; the thread's tags print after. The owner sets them from the thread's head in the hub; the list's search and ⌘P find them with t:<tag> (wiki tools/shipkit/threads-store.md, Tags). A tag change is a write of the thread's oldest item's head, carried to every machine like any other.`,
|
|
1375
|
+
examples: [['tag a thread', 'sk thread tag k7m2 +ux +login'], ['take one away', 'sk thread tag screen:orders/list -old'], ['its tags', 'sk thread tag k7m2']],
|
|
1376
|
+
})
|
|
1377
|
+
ref = Option.String({ name: 'address | id | code' })
|
|
1378
|
+
edits = Option.Rest({ name: 'tags' })
|
|
1379
|
+
|
|
1380
|
+
async execute(): Promise<number> {
|
|
1381
|
+
return run(this.context, async (h) => {
|
|
1382
|
+
const { tagEdits } = await import('../review/thread-query.ts')
|
|
1383
|
+
const { readAll, setThreadTags } = await import('../review/store.ts')
|
|
1384
|
+
const { threadOfItem, threadsOf, membersOf } = await import('../review/threads.ts')
|
|
1385
|
+
const { tagsOfItems } = await import('../review/thread-query.ts')
|
|
1386
|
+
const id = await idOf(h.dir, this.ref)
|
|
1387
|
+
const e = tagEdits(this.edits)
|
|
1388
|
+
const tags = e.add.length + e.remove.length === 0 ? tagsOfItems(membersOf(threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))!)) : setThreadTags(h.dir, id, e)
|
|
1389
|
+
h.out(`${this.ref}: ${tags.length === 0 ? 'no tag' : tags.map((t) => `t:${t}`).join(' ')}`)
|
|
1313
1390
|
return 0
|
|
1314
1391
|
})
|
|
1315
1392
|
}
|
|
@@ -1355,7 +1432,8 @@ export class ThreadTakeCommand extends Command {
|
|
|
1355
1432
|
const hearing = after ? hearingOfThread(after, parties, repoNameOf(dirname(dirname(h.dir)))) : null
|
|
1356
1433
|
const wasText = was === null ? 'nobody held it' : `it was held by ${was.lane ?? sessionLabel(was.session, parties)}`
|
|
1357
1434
|
h.out(`${this.ref}: yours now (${hearing?.chip ?? lane ?? 'this session'}), ${wasText}; ${hearing?.words ?? ''}`)
|
|
1358
|
-
|
|
1435
|
+
const { IN_BACKGROUND, WATCH } = await import('../review/inbox-hook.ts')
|
|
1436
|
+
if (!lane && 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`)
|
|
1359
1437
|
return 0
|
|
1360
1438
|
})
|
|
1361
1439
|
}
|
|
@@ -1366,7 +1444,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1366
1444
|
static override usage = Command.Usage({
|
|
1367
1445
|
category: 'Review',
|
|
1368
1446
|
description: 'give a thread to a lane: it holds it, a trace line names who gave it',
|
|
1369
|
-
details: `${DETAILS}\n\
|
|
1447
|
+
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).`,
|
|
1370
1448
|
examples: [['a lane for the thread he asked one on', 'sk thread assign screen:orders/list L65']],
|
|
1371
1449
|
})
|
|
1372
1450
|
ref = Option.String({ name: 'address | id' })
|
|
@@ -1396,7 +1474,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1396
1474
|
export class ReviewReplyCommand extends Command {
|
|
1397
1475
|
static override paths = [['review', 'reply']]
|
|
1398
1476
|
static essential = { args: '<address | id> <text>' }
|
|
1399
|
-
static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: DETAILS })
|
|
1477
|
+
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.` })
|
|
1400
1478
|
id = Option.String({ name: 'address | id' })
|
|
1401
1479
|
text = Option.String()
|
|
1402
1480
|
image = Option.String('--image', { description: 'an image beside the words' })
|
|
@@ -1404,9 +1482,13 @@ export class ReviewReplyCommand extends Command {
|
|
|
1404
1482
|
urgent = 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)' })
|
|
1405
1483
|
replaces = Option.String('--replaces', { description: 'the id of your earlier words (or question, or change) these supersede: it folds to one line « superseded by … » and leaves the dock, its answers kept' })
|
|
1406
1484
|
verdict = Option.Boolean('--verdict', false, { description: VERDICT_FLAG })
|
|
1485
|
+
long = Option.String('--long', { description: LONG_FLAG })
|
|
1407
1486
|
|
|
1408
1487
|
async execute(): Promise<number> {
|
|
1409
1488
|
return run(this.context, async (h) => {
|
|
1489
|
+
const asked = (await import('../review/reply-guards.ts')).questionInReply(this.text, this.id)
|
|
1490
|
+
if (asked !== null) throw new Error(asked)
|
|
1491
|
+
await guardWords(h, this.text, 'reply', this.id, this.long)
|
|
1410
1492
|
const { agentName, appendMessage } = await import('../review/store.ts')
|
|
1411
1493
|
if (this.replaces !== undefined) {
|
|
1412
1494
|
if (this.image !== undefined) throw new Error('--replaces with --image: post the image as its own reply')
|
|
@@ -1414,14 +1496,21 @@ export class ReviewReplyCommand extends Command {
|
|
|
1414
1496
|
const r = await replacing(h.dir, this.id, this.replaces, this.as)
|
|
1415
1497
|
const t = textOf(this.text)
|
|
1416
1498
|
if ('error' in t) throw new Error(t.error)
|
|
1417
|
-
const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}) })
|
|
1499
|
+
const m = appendMessage(h.dir, r.id, { who: callerLane(this.as) ?? agentName(), text: t.text, replaces: r.replaces, ...(this.verdict ? { asksVerdict: true as const } : {}), ...(this.long !== undefined ? { long: this.long.trim() } : {}) })
|
|
1418
1500
|
h.out(`${r.id}: ${m.id} supersedes ${r.replaces}`)
|
|
1419
1501
|
return 0
|
|
1420
1502
|
}
|
|
1421
|
-
const id = await idOrOpen(h, this.id, this.text, this.as)
|
|
1422
|
-
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image)
|
|
1503
|
+
const id = await replyTarget(h, this.id, await idOrOpen(h, this.id, this.text, this.as))
|
|
1504
|
+
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image, this.long)
|
|
1423
1505
|
if (this.urgent) await urgentOn(h.dir, id, callerLane(this.as) ?? agentName())
|
|
1424
1506
|
h.out(`${id}: ${m.id}`)
|
|
1507
|
+
// steps written as a reply sit under the old ones, which still stand: they belong in the instructions
|
|
1508
|
+
const ask = /^ask:(\d+)-/.exec((await import('../review/store.ts')).readAll(h.dir).items.find((x) => x.item.id === id)?.item.on ?? '')?.[1]
|
|
1509
|
+
const stepsLike = /^\s*##\s/m.test(this.text) || (this.text.match(/(?:^|\s)\d+[.)]\s+\S/g)?.length ?? 0) >= 2 || (this.text.match(/^\s*[-*]\s+\S/gm)?.length ?? 0) >= 2
|
|
1510
|
+
if (ask !== undefined && stepsLike) h.err(`review: steps belong in the ask's instructions, where he ticks them: sk ask edit ${Number(ask)}, then --save (this reply stays under the old steps)`)
|
|
1511
|
+
for (const l of await stillOpenLines(h.dir, id, m.id)) h.out(l)
|
|
1512
|
+
const said = await headLine(h.dir, id)
|
|
1513
|
+
if (said !== null) h.out(said)
|
|
1425
1514
|
return 0
|
|
1426
1515
|
})
|
|
1427
1516
|
}
|
|
@@ -1432,7 +1521,7 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1432
1521
|
static essential = { args: '<address | id> [state] <text>' }
|
|
1433
1522
|
static override usage = Command.Usage({
|
|
1434
1523
|
category: 'Review',
|
|
1435
|
-
description: "where a thread's work stands
|
|
1524
|
+
description: "where a thread's work stands: broken, better, a line; fixed asks the owner's verdict again",
|
|
1436
1525
|
details: `${DETAILS}\n\nsk thread update <id> <broken|better|fixed> "<one line>" [<file> | <before> <after>]: the file (an image, a clip or a sound, as it is: no special file) becomes the version's next view, the line and the state go on its thread in time order. Two files make that view a before and after pair, as add --before --after does: two images of one size, two clips of one size and length, or two sounds, never one of each; the owner picks how he compares them (side by side, wipe, fade). broken or better holds the version « in progress » (not waiting on the owner's verdict, still new in the list), fixed asks the owner's verdict again on the same thread, even after an answer. The owner's hint on an update reaches watch and inbox as a reply « on update <k> ». Posted on the thread's newest version.`,
|
|
1437
1526
|
examples: [
|
|
1438
1527
|
['still broken, the take as it is', 'SK_AGENT=L2 sk thread update <id> broken "her arm still crosses her leg at 2 s" take.mp4'],
|
|
@@ -1454,9 +1543,12 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1454
1543
|
as = Option.String('--as', { description: 'the lane that posts (else SK_AGENT)' })
|
|
1455
1544
|
keep = Option.Boolean('--keep', false, { description: 'its pictures as given: a png lands as a lossless webp otherwise, its pixels checked exact, and the version keeps only the webp' })
|
|
1456
1545
|
verdict = Option.Boolean('--verdict', false, { description: `on a plain line only: ${VERDICT_FLAG}` })
|
|
1546
|
+
long = Option.String('--long', { description: `on a plain line only: ${LONG_FLAG}` })
|
|
1457
1547
|
|
|
1458
1548
|
async execute(): Promise<number> {
|
|
1459
1549
|
return run(this.context, async (h) => {
|
|
1550
|
+
if (this.long !== undefined && this.text !== undefined) throw new Error(`update ${this.state} --long: an update's line is one line; a long text goes as a document (sk thread post ${this.id} --md <file>)`)
|
|
1551
|
+
await guardWords(h, this.text ?? this.state, 'update', this.id, this.long)
|
|
1460
1552
|
const { postUpdate, agentName, readAll } = await import('../review/store.ts')
|
|
1461
1553
|
const { threadsOf } = await import('../review/threads.ts')
|
|
1462
1554
|
const { threadOfId } = await import('../review/cells.ts')
|
|
@@ -1468,8 +1560,10 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1468
1560
|
if ((UPDATE_STATES as readonly string[]).includes(this.state)) throw new Error(`update <address | id> ${this.state} "<one line>": the line is missing`)
|
|
1469
1561
|
const at = await idOrOpen(h, this.id, this.state, this.as)
|
|
1470
1562
|
const on = threadOfId(at, threadsOf(readAll(h.dir).items))?.head.item.id ?? at
|
|
1471
|
-
const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict)
|
|
1563
|
+
const m = await wordsIn(h.dir, on, callerLane(this.as) ?? agentName(), this.state, this.verdict, undefined, this.long)
|
|
1472
1564
|
h.out(`${on}: ${m.id}, a line, no state`)
|
|
1565
|
+
const said = await headLine(h.dir, on)
|
|
1566
|
+
if (said !== null) h.out(said)
|
|
1473
1567
|
return 0
|
|
1474
1568
|
}
|
|
1475
1569
|
const asked = await idOrOpen(h, this.id, this.text, this.as)
|
|
@@ -1481,6 +1575,8 @@ export class ReviewUpdateCommand extends Command {
|
|
|
1481
1575
|
const x = readItem(h.dir, id)
|
|
1482
1576
|
const now = x && stateOf(x, false).state === 'asks' ? "waits for the owner's verdict" : x && stateOf(x, false).state === 'draft' ? 'in progress, no verdict asked' : 'in work'
|
|
1483
1577
|
h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}; the version ${now}`)
|
|
1578
|
+
const said = await headLine(h.dir, id)
|
|
1579
|
+
if (said !== null) h.out(said)
|
|
1484
1580
|
if (r.view !== null) for (const line of await (await import('../review/previews.ts')).playCopies(h.dir, r.item, r.view)) h.err(line)
|
|
1485
1581
|
const { unheardLine } = await import('../review/model.ts')
|
|
1486
1582
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
@@ -1496,7 +1592,7 @@ export class ReviewWithdrawCommand extends Command {
|
|
|
1496
1592
|
static override usage = Command.Usage({
|
|
1497
1593
|
category: 'Review',
|
|
1498
1594
|
description: 'take back what an agent posted, with the reason: a version by its id, or one message by its id',
|
|
1499
|
-
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
|
|
1595
|
+
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, outside the thread; the words are the reason, quoted, so it never stays open in the hub. The owner's words in the thread itself need nothing: they answer what an agent asked before them on that item (a question, a change, words asking the owner's verdict) by themselves, « answered in words ».`,
|
|
1500
1596
|
examples: [
|
|
1501
1597
|
['a version taken back', 'sk thread withdraw 20261120-101500-the-logo --why "a newer one follows"'],
|
|
1502
1598
|
['he answered the question in chat', 'sk thread withdraw 20261120-223154-747-agent-vg49 --chat "B only, keep both kill matrices"'],
|
|
@@ -1603,22 +1699,23 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1603
1699
|
after = op === 'ask' ? Option.String('--after', { description: 'set the thread aside until then (2h, tomorrow, next-week, YYYY-MM-DD[THH:MM]): your question waits for that day; only when you post it' }) : undefined
|
|
1604
1700
|
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
|
|
1605
1701
|
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
|
|
1606
|
-
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
|
|
1607
|
-
keep = op === 'ask' ? Option.Boolean('--keep', false, { description: '
|
|
1702
|
+
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; `all`: every older open question of its kind on the thread. Without it, a new question is asked beside the open ones' }) : undefined
|
|
1703
|
+
keep = op === 'ask' ? Option.Boolean('--keep', false, { description: 'does nothing: a new question never supersedes another unless --replaces names it' }) : undefined
|
|
1608
1704
|
verdict = op === 'ask' ? Option.Boolean('--verdict', false, { description: "refused: a question waits for the owner's answer already, his answer is its verdict" }) : undefined
|
|
1609
1705
|
|
|
1610
|
-
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes.
|
|
1611
|
-
*
|
|
1612
|
-
* the newest by `replaces`, each other withdrawn by `withdrawOlder` once
|
|
1613
|
-
|
|
1614
|
-
|
|
1706
|
+
/** the thread item the question goes on and what it supersedes: never a new thread when it supersedes. It
|
|
1707
|
+
* supersedes only what `--replaces` names: an id, or `all`, the older open questions of its kind on the thread
|
|
1708
|
+
* (review/supersede.ts olderQuestions), the newest by `replaces`, each other withdrawn by `withdrawOlder` once
|
|
1709
|
+
* this one has its id. Named none, it is asked beside them, `beside` counting them */
|
|
1710
|
+
async target(h: Here, q: { kind: AnswerKind; secret?: string }): Promise<{ id: string; replaces?: string; others: string[]; beside?: number }> {
|
|
1711
|
+
if (this.replaces !== undefined && this.replaces !== 'all') return { ...(await replacing(h.dir, this.id, this.replaces, this.as)), others: [] }
|
|
1615
1712
|
const id = await idOrOpen(h, this.id, this.words ?? '', this.as)
|
|
1616
|
-
if (this.keep) return { id, others: [] }
|
|
1617
1713
|
const { readAll } = await import('../review/store.ts')
|
|
1618
1714
|
const { membersOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
1619
1715
|
const { olderQuestions } = await import('../review/supersede.ts')
|
|
1620
1716
|
const t = threadOfItem(id, threadsOf(readAll(h.dir).items))
|
|
1621
1717
|
const older = t === null ? [] : olderQuestions(membersOf(t), q)
|
|
1718
|
+
if (this.replaces !== 'all') return { id, others: [], ...(older.length > 0 ? { beside: older.length } : {}) }
|
|
1622
1719
|
if (older.length === 0) return { id, others: [] }
|
|
1623
1720
|
if (!(await mayHold(h.dir, t!, this.as))) {
|
|
1624
1721
|
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>`)
|
|
@@ -1628,8 +1725,9 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1628
1725
|
}
|
|
1629
1726
|
|
|
1630
1727
|
/** the older questions `target` named beside the one it superseded: each withdrawn, « replaced by » the new one */
|
|
1631
|
-
async withdrawOlder(h: Here, t: { replaces?: string; others: string[] }, by: string): Promise<void> {
|
|
1632
|
-
if (t.
|
|
1728
|
+
async withdrawOlder(h: Here, t: { replaces?: string; others: string[]; beside?: number }, by: string): Promise<void> {
|
|
1729
|
+
if (t.beside !== undefined) h.out(` asked beside ${t.beside} open question${t.beside > 1 ? 's' : ''} of this kind, ${t.beside > 1 ? 'all' : 'it'} still open: --replaces <id> supersedes one, --replaces all every one`)
|
|
1730
|
+
if (t.replaces !== undefined && this.replaces === 'all') h.out(` supersedes ${t.replaces}${t.others.length > 0 ? ` and ${t.others.join(', ')}` : ''}: older open question${t.others.length > 0 ? 's' : ''} of this kind (--replaces all)`)
|
|
1633
1731
|
const { withdrawObject } = await import('../review/store.ts')
|
|
1634
1732
|
for (const re of t.others) {
|
|
1635
1733
|
const r = withdrawObject(h.dir, re, `replaced by ${by}`)
|
|
@@ -1672,6 +1770,10 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1672
1770
|
const { postAsk } = await import('../review/store.ts')
|
|
1673
1771
|
const { askStateText } = await import('../review/answer-kinds.ts')
|
|
1674
1772
|
if (!this.words?.trim()) throw new Error(`ask <address | id> "<what you ask>" ${k.label}`)
|
|
1773
|
+
if (k.kind === 'secret') {
|
|
1774
|
+
const joined = (await import('../review/instruction-guards.ts')).joinedSecretAsk(this.words)
|
|
1775
|
+
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)`)
|
|
1776
|
+
}
|
|
1675
1777
|
if (k.kind === 'secret' && this.secret) {
|
|
1676
1778
|
const who = await (await import('../secrets/who-reads.ts')).whoReads([this.secret], process.cwd())
|
|
1677
1779
|
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`)
|
|
@@ -1755,7 +1857,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1755
1857
|
export const ReviewWontfixCommand = actCommand('wontfix', 'close an item he raised as not done, with the reason', { note: 'required', named: false, examples: [['not done', 'sk thread wontfix <id> --note "the room is gone"']] })
|
|
1756
1858
|
export const ReviewClaimCommand = actCommand('claim', 'take an item to work on it: the hub shows the thread in work by your lane', { named: true, examples: [['take it', 'sk thread claim <id> --as L12']] })
|
|
1757
1859
|
export const ReviewReleaseCommand = actCommand('release', 'give back an item you claimed', { note: 'optional', named: true, examples: [['give it back', 'sk thread release <id> --as L12']] })
|
|
1758
|
-
export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two
|
|
1860
|
+
export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two layouts?" --as L12']] })
|
|
1759
1861
|
export const ReviewDoneCommand = actCommand('done', 'the older name of sk thread fixed on a version he answered « ok with a fix »', { text: 'what changed', named: false, examples: [['the fix made', 'sk thread fixed <id> "the sign moved one tile up"']] })
|
|
1760
1862
|
|
|
1761
1863
|
/** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/threads.ts fixedPlan) */
|
|
@@ -1807,10 +1909,10 @@ export class ReviewFixedCommand extends Command {
|
|
|
1807
1909
|
})
|
|
1808
1910
|
}
|
|
1809
1911
|
}
|
|
1810
|
-
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
|
|
1811
|
-
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
|
|
1812
|
-
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
|
|
1813
|
-
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
|
|
1912
|
+
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']] })
|
|
1913
|
+
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']] })
|
|
1914
|
+
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']] })
|
|
1915
|
+
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']] })
|
|
1814
1916
|
|
|
1815
1917
|
export class ReviewDispatcherCommand extends Command {
|
|
1816
1918
|
static override paths = [['review', 'dispatcher']]
|
|
@@ -1818,7 +1920,7 @@ export class ReviewDispatcherCommand extends Command {
|
|
|
1818
1920
|
category: 'Review',
|
|
1819
1921
|
description: 'take the dispatcher role: one session at a time routes what is raised',
|
|
1820
1922
|
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.`,
|
|
1821
|
-
examples: [['take the role', 'sk thread dispatcher --as
|
|
1923
|
+
examples: [['take the role', 'sk thread dispatcher --as dispatcher']],
|
|
1822
1924
|
})
|
|
1823
1925
|
as = Option.String('--as', { description: 'who takes it (else SK_AGENT)' })
|
|
1824
1926
|
take = Option.Boolean('--take', false, { description: 'take it from an active holder' })
|
|
@@ -2186,10 +2288,10 @@ export class ReviewWatchCommand extends Command {
|
|
|
2186
2288
|
static override usage = Command.Usage({
|
|
2187
2289
|
category: 'Review',
|
|
2188
2290
|
description: 'one line per verdict, reply or raised note as it lands; every unseen one first; ends with its owner',
|
|
2189
|
-
details: `${DETAILS}\n\nRun it
|
|
2291
|
+
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.`,
|
|
2190
2292
|
examples: [
|
|
2191
|
-
['the
|
|
2192
|
-
['the threads this session holds, in
|
|
2293
|
+
['the ear of a session: its threads in every repo, one burst, in a background Bash', 'sk thread watch --mine --house --once'],
|
|
2294
|
+
['the threads this session holds, in this repo', 'sk thread watch --mine --once'],
|
|
2193
2295
|
["one lane's items", 'sk thread watch --lane interaction'],
|
|
2194
2296
|
],
|
|
2195
2297
|
})
|
|
@@ -2197,6 +2299,7 @@ export class ReviewWatchCommand extends Command {
|
|
|
2197
2299
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
2198
2300
|
lane = Option.String('--lane', { description: "only that lane's items" })
|
|
2199
2301
|
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>]' })
|
|
2302
|
+
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' })
|
|
2200
2303
|
|
|
2201
2304
|
async execute(): Promise<number> {
|
|
2202
2305
|
return run(this.context, async (h) => {
|
|
@@ -2220,19 +2323,21 @@ export class ReviewWatchCommand extends Command {
|
|
|
2220
2323
|
await restartWatchOnModelMove(h)
|
|
2221
2324
|
// the one stream for every store this watch hears, its own lines untagged
|
|
2222
2325
|
await watchFeed(h.err)
|
|
2223
|
-
const f = { session, lane, by, house: this.house }
|
|
2326
|
+
const f = { session, lane, by, house: this.house, once: this.once }
|
|
2224
2327
|
if (!this.house || session === null) {
|
|
2225
2328
|
await hearStore(h, f)
|
|
2226
2329
|
return new Promise<number>(() => {})
|
|
2227
2330
|
}
|
|
2228
2331
|
// one process, one loop a store: the store it starts in, then each one the session's record names
|
|
2229
2332
|
const { noteSession, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2333
|
+
const { canonicalStore } = await import('../review/item-db.ts')
|
|
2230
2334
|
const { dirname, resolve } = await import('node:path')
|
|
2231
2335
|
noteSession(h.dir)
|
|
2336
|
+
// one store a loop, by its canonical folder: the checkout of a worktree it starts in, never both
|
|
2232
2337
|
const heard = new Set<string>()
|
|
2233
2338
|
const retry = new Map<string, number>()
|
|
2234
2339
|
const hear = async (x: Here): Promise<string> => {
|
|
2235
|
-
heard.add(
|
|
2340
|
+
heard.add(canonicalStore(x.dir))
|
|
2236
2341
|
const repo = repoNameOf(dirname(dirname(x.dir)))
|
|
2237
2342
|
const tagged = (print: (l: string) => void) => (l: string) => print(l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
|
|
2238
2343
|
await hearStore({ ...x, out: tagged(h.out), err: tagged(h.err) }, f)
|
|
@@ -2244,7 +2349,7 @@ export class ReviewWatchCommand extends Command {
|
|
|
2244
2349
|
busy = true
|
|
2245
2350
|
const joined: string[] = []
|
|
2246
2351
|
try {
|
|
2247
|
-
for (const dir of await recordedStores(session, (d) => heard.has(
|
|
2352
|
+
for (const dir of await recordedStores(session, (d) => heard.has(d) || (retry.get(resolve(d)) ?? 0) > Date.now())) {
|
|
2248
2353
|
try {
|
|
2249
2354
|
joined.push(await hear(await hereAt(dir, h.out, h.err)))
|
|
2250
2355
|
} catch (e) {
|
|
@@ -2258,7 +2363,8 @@ export class ReviewWatchCommand extends Command {
|
|
|
2258
2363
|
}
|
|
2259
2364
|
return joined
|
|
2260
2365
|
}
|
|
2261
|
-
const
|
|
2366
|
+
const home = canonicalStore(h.dir)
|
|
2367
|
+
const first = [await hear(home === resolve(h.dir) ? h : await hereAt(home, h.out, h.err)), ...(await more())]
|
|
2262
2368
|
h.err(`review watch: hears ${first.join(', ')}; a repo where this session takes a thread joins within 2 s`)
|
|
2263
2369
|
setInterval(
|
|
2264
2370
|
() =>
|
|
@@ -2272,6 +2378,33 @@ export class ReviewWatchCommand extends Command {
|
|
|
2272
2378
|
}
|
|
2273
2379
|
}
|
|
2274
2380
|
|
|
2381
|
+
/** the saves of every store a `--once` watch hears, run as it exits */
|
|
2382
|
+
const onceSaves: (() => void)[] = []
|
|
2383
|
+
|
|
2384
|
+
/** what the earlier `--once` runs of one party printed in one store (review/watchers.ts onceFile) */
|
|
2385
|
+
async function onceMemory(dir: string, session: string | null, lane: string | null): Promise<{ printed: string[]; save: (shown: ReadonlySet<string>) => void }> {
|
|
2386
|
+
const { dirname } = await import('node:path')
|
|
2387
|
+
const { mkdirSync, readFileSync } = await import('node:fs')
|
|
2388
|
+
const { atomicWriteJson } = await import('../core/atomic-write.ts')
|
|
2389
|
+
const { onceFile } = await import('../review/watchers.ts')
|
|
2390
|
+
const file = onceFile(dir, session, lane)
|
|
2391
|
+
const folder = dirname(file)
|
|
2392
|
+
let printed: string[] = []
|
|
2393
|
+
try {
|
|
2394
|
+
const v = JSON.parse(readFileSync(file, 'utf8')) as unknown
|
|
2395
|
+
if (Array.isArray(v)) printed = v.filter((x): x is string => typeof x === 'string')
|
|
2396
|
+
} catch {}
|
|
2397
|
+
return {
|
|
2398
|
+
printed,
|
|
2399
|
+
save: (shown) => {
|
|
2400
|
+
try {
|
|
2401
|
+
mkdirSync(folder, { recursive: true })
|
|
2402
|
+
atomicWriteJson(file, [...shown].slice(-2000))
|
|
2403
|
+
} catch {}
|
|
2404
|
+
},
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2275
2408
|
/** a watch outlives a change of the thread model: once a read fails on an item the new model wrote, it runs again with
|
|
2276
2409
|
* its args, same pid, onto code that loads (review/model-moved.ts) */
|
|
2277
2410
|
async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
@@ -2292,21 +2425,38 @@ async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
|
2292
2425
|
}
|
|
2293
2426
|
|
|
2294
2427
|
/** one store heard by a watch of filter `f`, until the process ends: registered beside it, its lines printed through `h` */
|
|
2295
|
-
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean }): Promise<void> {
|
|
2428
|
+
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; once?: boolean }): Promise<void> {
|
|
2296
2429
|
const { session, lane, by } = f
|
|
2297
|
-
|
|
2298
|
-
|
|
2430
|
+
// --once: what an earlier run of this party printed is never printed again, and the process exits 0 once a burst
|
|
2431
|
+
// of new lines settled (400 ms), so a background Bash hears it with no 30 minute cap and no loop of turns
|
|
2432
|
+
const once = f.once === true ? await onceMemory(h.dir, session, lane) : null
|
|
2433
|
+
let settle: ReturnType<typeof setTimeout> | null = null
|
|
2434
|
+
const say = (text: string): void => {
|
|
2435
|
+
h.out(text)
|
|
2436
|
+
if (once === null) return
|
|
2437
|
+
if (settle) clearTimeout(settle)
|
|
2438
|
+
// every store of a --house watch saves what it printed, then the process exits
|
|
2439
|
+
settle = setTimeout(() => {
|
|
2440
|
+
for (const save of onceSaves) save()
|
|
2441
|
+
process.exit(0)
|
|
2442
|
+
}, 400)
|
|
2443
|
+
}
|
|
2444
|
+
const { mediaDir, readAll, storeStamp } = await import('../review/store.ts')
|
|
2299
2445
|
const { modelWatch } = await import('../review/model-moved.ts')
|
|
2300
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2301
2446
|
const { coversItem, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
|
|
2302
2447
|
const { followedIds, unseen } = await import('../review/threads.ts')
|
|
2303
2448
|
const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
|
|
2449
|
+
const { withThreadLook } = await import('../review/refs.ts')
|
|
2304
2450
|
const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
|
|
2305
2451
|
const { hears, holderOf, listenersOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
|
|
2306
2452
|
let byItem = new Map<string, import('../review/threads.ts').Thread>()
|
|
2307
2453
|
// who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
|
|
2308
2454
|
const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2309
2455
|
const { laneAsksFor, resumeOf } = await import('../review/inbox-read.ts')
|
|
2456
|
+
const { hearingHolders, readRole } = await import('../orchestrator/role.ts')
|
|
2457
|
+
const { placeParties, placeWatchers } = await import('../orchestrator/places.ts')
|
|
2458
|
+
const { withOtherPlaces } = await import('../review/parties.ts')
|
|
2459
|
+
const { shareOf, shareText } = await import('../orchestrator/share.ts')
|
|
2310
2460
|
const { dirname } = await import('node:path')
|
|
2311
2461
|
let parties: import('../review/parties.ts').Parties | null = null
|
|
2312
2462
|
const mine = (x: Parameters<typeof coversItem>[1]): boolean => hears({ session, lane }, x, byItem, parties)
|
|
@@ -2318,7 +2468,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2318
2468
|
if (session === null && lane === null) return
|
|
2319
2469
|
const all = readAll(h.dir)
|
|
2320
2470
|
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 ?? [])]))
|
|
2321
|
-
parties = await readParties({ sessions: [...ids, ...(session ? [session] : [])], watchers: liveWatchers(h.dir), self: by })
|
|
2471
|
+
parties = await readParties({ sessions: [...ids, ...(session ? [session] : [])], watchers: liveWatchers(h.dir), self: by, roles: hearingHolders, places: placeParties })
|
|
2322
2472
|
// a lane's watch ends with its lane: its threads pass to its session, whose hook or watch hears them
|
|
2323
2473
|
const me = lane !== null && by !== null ? parties.lanes.filter((l) => l.name === lane && l.session === by) : []
|
|
2324
2474
|
if (me.length > 0 && !me.some((l) => l.live)) {
|
|
@@ -2328,7 +2478,8 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2328
2478
|
}
|
|
2329
2479
|
await known().catch(() => {})
|
|
2330
2480
|
setInterval(() => void known().catch(() => {}), 30_000)
|
|
2331
|
-
const shown = new Set<string>()
|
|
2481
|
+
const shown = new Set<string>(once?.printed ?? [])
|
|
2482
|
+
if (once !== null) onceSaves.push(() => once.save(shown))
|
|
2332
2483
|
// a store refused for a while (a fold or a way back of the daemon file walks): one line, and the next poll
|
|
2333
2484
|
// reads again; never a watch that dies and hears nothing more
|
|
2334
2485
|
let refused: string | null = null
|
|
@@ -2359,28 +2510,47 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2359
2510
|
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: [] })) {
|
|
2360
2511
|
if (shown.has(l)) continue
|
|
2361
2512
|
shown.add(l)
|
|
2362
|
-
|
|
2513
|
+
say(l)
|
|
2363
2514
|
}
|
|
2364
2515
|
}
|
|
2365
2516
|
for (const x of unseen(all.items, to).filter(mine)) {
|
|
2366
|
-
const fresh = watchLines(x, all.items, mediaDir(h.dir), to).filter((l) => !shown.has(l.key))
|
|
2517
|
+
const fresh = withThreadLook(h.say.look, () => watchLines(x, all.items, mediaDir(h.dir), to)).filter((l) => !shown.has(l.key))
|
|
2518
|
+
const t = byItem.get(x.item.id)
|
|
2519
|
+
// each line after its item's id names its thread's code, the one an agent types back
|
|
2520
|
+
const code = t && h.say.code ? ` #${h.say.code(t)}` : ''
|
|
2367
2521
|
for (const l of fresh) {
|
|
2368
2522
|
shown.add(l.key)
|
|
2369
|
-
|
|
2523
|
+
say(code === '' || !l.text.startsWith(`${x.item.id} `) ? l.text : `${x.item.id}${code}${l.text.slice(x.item.id.length)}`)
|
|
2370
2524
|
}
|
|
2371
2525
|
// a session's watch, his message on its ended lane's thread: the way back to that lane
|
|
2372
|
-
const t = byItem.get(x.item.id)
|
|
2373
2526
|
const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
|
|
2374
2527
|
if (r) {
|
|
2375
|
-
|
|
2528
|
+
say(` ${r.line}`)
|
|
2376
2529
|
noteHanded(r.lane, r.session, r.thread)
|
|
2377
2530
|
}
|
|
2378
2531
|
}
|
|
2532
|
+
// the orchestrator role's share: while this session holds the role of this store's project, the owner's words no
|
|
2533
|
+
// other live watch hears, here or on another place of the project, since its claim, each once, and of those the
|
|
2534
|
+
// ones this place answers for (orchestrator/share.ts)
|
|
2535
|
+
if (lane === null && session !== null && parties !== null) {
|
|
2536
|
+
const repo = repoNameOf(dirname(dirname(h.dir)))
|
|
2537
|
+
const r = readRole(repo)
|
|
2538
|
+
if (r?.holder?.session === session) {
|
|
2539
|
+
const others = [...liveWatchers(h.dir), ...placeWatchers(repo)].filter((w) => !(w.lane === null && (w.session === session || w.by === session)))
|
|
2540
|
+
// the other places as the view says them now, not as the last read of the parties (30 s ago at most)
|
|
2541
|
+
const placed = withOtherPlaces({ sessions: parties.sessions.filter((s) => s.place === undefined), lanes: parties.lanes }, placeParties())
|
|
2542
|
+
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 } })) {
|
|
2543
|
+
if (shown.has(l.key)) continue
|
|
2544
|
+
shown.add(l.key)
|
|
2545
|
+
say(shareText(l))
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2379
2549
|
for (const x of all.items.filter(mine)) {
|
|
2380
2550
|
const l = raisedLine(x)
|
|
2381
2551
|
if (l === null || shown.has(l.key)) continue
|
|
2382
2552
|
shown.add(l.key)
|
|
2383
|
-
|
|
2553
|
+
say(l.text)
|
|
2384
2554
|
}
|
|
2385
2555
|
// an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
|
|
2386
2556
|
const now = new Date()
|
|
@@ -2394,59 +2564,37 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2394
2564
|
const key = `untaken ${x.item.id} ${why} ${round}`
|
|
2395
2565
|
if (shown.has(key)) continue
|
|
2396
2566
|
shown.add(key)
|
|
2397
|
-
|
|
2567
|
+
say(untakenLine(x, why, lane))
|
|
2398
2568
|
}
|
|
2399
2569
|
}
|
|
2400
2570
|
tick()
|
|
2401
2571
|
// the grace and the reminder pass with time alone: one read a minute
|
|
2402
2572
|
setInterval(tick, 60_000)
|
|
2403
|
-
// the
|
|
2404
|
-
// watch follows a move while it runs. The rows: their stamp is a query of a few µs, asked every 50 ms, read at
|
|
2405
|
-
// once. The files: a watch of the folder asks again (debounced), and a stat stamp every 5 s catches a missed event
|
|
2573
|
+
// the rows' stamp is a query of a few µs, asked every 50 ms, read at once; one tick for a burst of moves
|
|
2406
2574
|
let soon: ReturnType<typeof setTimeout> | null = null
|
|
2407
2575
|
const again = (): void => {
|
|
2408
2576
|
if (soon) clearTimeout(soon)
|
|
2409
2577
|
soon = setTimeout(() => {
|
|
2410
2578
|
soon = null
|
|
2411
2579
|
tick()
|
|
2412
|
-
},
|
|
2580
|
+
}, 0)
|
|
2413
2581
|
}
|
|
2414
2582
|
// 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
|
|
2415
2583
|
// daemon that does not answer (review/watch-feed.ts)
|
|
2416
|
-
let polling = false
|
|
2417
|
-
let folderWatched = false
|
|
2418
|
-
const watchFolder = (): void => {
|
|
2419
|
-
if (folderWatched) return
|
|
2420
|
-
folderWatched = true
|
|
2421
|
-
if (!existsSync(h.dir)) mkdirSync(h.dir, { recursive: true })
|
|
2422
|
-
watch(h.dir, { recursive: true }, () => {
|
|
2423
|
-
if (polling && !threadsInDb()) again()
|
|
2424
|
-
})
|
|
2425
|
-
}
|
|
2426
2584
|
let stamp = ''
|
|
2427
|
-
let scanned = Date.now()
|
|
2428
2585
|
let loop: ReturnType<typeof setInterval> | null = null
|
|
2429
2586
|
const poll = (on: boolean): void => {
|
|
2430
|
-
polling = on
|
|
2431
2587
|
if (!on) {
|
|
2432
2588
|
if (loop) clearInterval(loop)
|
|
2433
2589
|
loop = null
|
|
2434
2590
|
return
|
|
2435
2591
|
}
|
|
2436
2592
|
if (loop) return
|
|
2437
|
-
if (!threadsInDb()) watchFolder()
|
|
2438
2593
|
stamp = ''
|
|
2439
2594
|
loop = setInterval(() => {
|
|
2440
|
-
const rows = threadsInDb()
|
|
2441
|
-
// the files' stamp walks every item: once every 5 s, never at the rows' pace
|
|
2442
|
-
if (!rows) {
|
|
2443
|
-
watchFolder()
|
|
2444
|
-
if (Date.now() - scanned < 5000) return
|
|
2445
|
-
}
|
|
2446
|
-
scanned = Date.now()
|
|
2447
2595
|
// a refused stamp, or one read again after a refusal: the read says it, once
|
|
2448
2596
|
try {
|
|
2449
|
-
const now =
|
|
2597
|
+
const now = storeStamp(h.dir)
|
|
2450
2598
|
if (now !== stamp || refused !== null) again()
|
|
2451
2599
|
stamp = now
|
|
2452
2600
|
} catch {
|
|
@@ -2489,14 +2637,14 @@ async function watchFeed(say: (l: string) => void): Promise<import('../review/wa
|
|
|
2489
2637
|
return (feedHeld = new WatchFeed(daemonUrl(), { say }))
|
|
2490
2638
|
}
|
|
2491
2639
|
|
|
2492
|
-
/** the review folders of this machine's house, its archived repos
|
|
2640
|
+
/** the review folders of this machine's house, its archived repos and their worktrees included */
|
|
2493
2641
|
async function houseStores(): Promise<string[]> {
|
|
2494
2642
|
const { findRepoRoot } = await import('../ts/config.ts')
|
|
2495
2643
|
const { houseRepos } = await import('../house/project-gutter.ts')
|
|
2496
2644
|
const { homedir } = await import('node:os')
|
|
2497
2645
|
const { storeDir } = await import('../review/store.ts')
|
|
2498
2646
|
const house = houseRepos(findRepoRoot(process.cwd()), homedir())
|
|
2499
|
-
if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it
|
|
2647
|
+
if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it reads`)
|
|
2500
2648
|
const { existsSync } = await import('node:fs')
|
|
2501
2649
|
const repos = [...house.repos, ...house.archived].map((r) => r.path)
|
|
2502
2650
|
// a lane's worktree holds the items it sent there: they join their repo's rows
|
|
@@ -2506,89 +2654,42 @@ async function houseStores(): Promise<string[]> {
|
|
|
2506
2654
|
return [...repos, ...trees.filter((t) => existsSync(storeDir(t)))].map((r) => storeDir(r))
|
|
2507
2655
|
}
|
|
2508
2656
|
|
|
2509
|
-
export class
|
|
2510
|
-
static override paths = [['review', '
|
|
2657
|
+
export class ReviewImportCommand extends Command {
|
|
2658
|
+
static override paths = [['review', 'import']]
|
|
2511
2659
|
static override usage = Command.Usage({
|
|
2512
2660
|
category: 'Review',
|
|
2513
|
-
description: "
|
|
2514
|
-
details:
|
|
2515
|
-
|
|
2516
|
-
examples: [['what the tidy would remove', 'sk thread move --tidy'], ['what a move would do', 'sk thread move'], ['move this machine', 'sk thread move --go'], ['what the way back would do', 'sk thread move --back'], ['go back to the files', 'sk thread move --back --go']],
|
|
2661
|
+
description: "threads kept as folders into the daemon's database: an older shipkit's store, or an export",
|
|
2662
|
+
details: `${DETAILS}\n\nEvery thread is rows of the daemon's database. A shipkit older than the rows kept a repo's threads as folders in \`.shipkit/review/<id>/\` (\`item.json\`, \`thread/<message>.json\`, the media beside them, \`.gone/\` the items set aside), and sk thread export writes the same layout. A look by default: what it would write. \`--go\` writes every head the rows lack or hold older and every message they lack (by id and rev), links each media file into the spool, then proves each one it read is in the rows. A head the rows hold later stays, named; a folder that does not read stays as it is, named, and the exit is 1. The folders are read, never written nor removed, so a second run writes nothing. \`--from <folder>\` reads an export instead of the repo's own folder; \`--all\` reads every house repo of this machine and their worktrees. Page: wiki tools/shipkit/threads-store.md, Folders`,
|
|
2663
|
+
examples: [['what it would import here', 'sk thread import'], ["this repo's old threads into the rows", 'sk thread import --go'], ['every house repo', 'sk thread import --all --go'], ['an export', 'sk thread import --from /tmp/threads --go']],
|
|
2517
2664
|
})
|
|
2518
|
-
go = Option.Boolean('--go', false, { description: '
|
|
2519
|
-
|
|
2520
|
-
|
|
2665
|
+
go = Option.Boolean('--go', false, { description: 'write it; without it, a look' })
|
|
2666
|
+
all = Option.Boolean('--all', false, { description: 'every house repo of this machine, not only this repo' })
|
|
2667
|
+
from = Option.String('--from', { description: "a folder sk thread export wrote, instead of the repo's own" })
|
|
2521
2668
|
|
|
2522
2669
|
async execute(): Promise<number> {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
const stores = await houseStores()
|
|
2528
|
-
const { moveBack, moveGo, tidyFiles } = await import('../review/move.ts')
|
|
2670
|
+
return run(this.context, async (h) => {
|
|
2671
|
+
if (this.all && this.from != null) throw new Error('--all or --from, not both')
|
|
2672
|
+
const { resolve } = await import('node:path')
|
|
2673
|
+
const { importFolders, importLines, notInRows } = await import('../review/folders.ts')
|
|
2674
|
+
const stores = this.all ? await houseStores() : [h.dir]
|
|
2529
2675
|
const dry = !this.go
|
|
2530
|
-
|
|
2531
|
-
const {
|
|
2532
|
-
const
|
|
2533
|
-
if (
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
for (const l of r.lines) (l.startsWith('WARN') ? err : out)(l)
|
|
2537
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2538
|
-
const { BACK_FIRST } = await import('../review/move.ts')
|
|
2539
|
-
if (threadsInDb()) out(BACK_FIRST)
|
|
2540
|
-
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'}`)
|
|
2541
|
-
return r.ok ? 0 : 1
|
|
2542
|
-
} finally {
|
|
2543
|
-
lease?.release()
|
|
2676
|
+
const from = this.from == null ? {} : { from: resolve(this.from) }
|
|
2677
|
+
const passes = stores.map((d) => importFolders(d, { dry, ...from }))
|
|
2678
|
+
for (const l of importLines(passes, dry)) h.out(l)
|
|
2679
|
+
if (dry) {
|
|
2680
|
+
h.out('a look: nothing written. sk thread import --go writes it')
|
|
2681
|
+
return 0
|
|
2544
2682
|
}
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2556
|
-
const { confirmedUp } = await import('../media-store/remote.ts')
|
|
2557
|
-
const up = (key: string, size: number): Promise<boolean> => confirmedUp(key, size)
|
|
2558
|
-
if (!threadsOn()) return { hqLacks: async () => ({ refused: 'the switch hq-cards is off: no hq holds them' }), up }
|
|
2559
|
-
const { myHq } = await import('../hq/hq-local.ts')
|
|
2560
|
-
const hq = myHq()
|
|
2561
|
-
if ('refused' in hq) return { hqLacks: async () => ({ refused: `the hq is not reached (${hq.refused})` }), up }
|
|
2562
|
-
const { dirname } = await import('node:path')
|
|
2563
|
-
const { held, left } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2564
|
-
const diff = await threadsDiff(hq, held)
|
|
2565
|
-
if ('refused' in diff) return { hqLacks: async () => ({ refused: `the hq refused the check: ${diff.refused}` }), up }
|
|
2566
|
-
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2567
|
-
const byRepo = new Map(diff.map((d) => [d.repo, new Set([...d.onlyHere, ...d.differ])]))
|
|
2568
|
-
return {
|
|
2569
|
-
hqLacks: async (dir) => {
|
|
2570
|
-
const set = byRepo.get(repoIdOf(dir))
|
|
2571
|
-
if (set != null) return set
|
|
2572
|
-
return { refused: left.some((l) => dir.startsWith(l)) ? 'a repo with no remote: the hq carries none of its threads' : 'the hq holds no threads of this repo' }
|
|
2573
|
-
},
|
|
2574
|
-
up,
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
|
|
2578
|
-
/** with the switch hq-cards on, what the hq and this machine's files do not hold alike, a line each: the move's
|
|
2579
|
-
* proof that nothing it leaves behind is missing elsewhere. Null with the switch off */
|
|
2580
|
-
function hqDiffOf(stores: readonly string[]): () => Promise<string[] | null> {
|
|
2581
|
-
return async () => {
|
|
2582
|
-
const { threadsDiff, threadsOn, heldRepos } = await import('../hq/thread-sync.ts')
|
|
2583
|
-
if (!threadsOn()) return null
|
|
2584
|
-
const { myHq } = await import('../hq/hq-local.ts')
|
|
2585
|
-
const hq = myHq()
|
|
2586
|
-
if ('refused' in hq) return [`the hq is not reached (${hq.refused}): the check hq-cards cannot prove both sides equal`]
|
|
2587
|
-
const { dirname } = await import('node:path')
|
|
2588
|
-
const { held } = await heldRepos(stores.map((d) => ({ name: d, path: dirname(dirname(d)) })))
|
|
2589
|
-
const diff = await threadsDiff(hq, held)
|
|
2590
|
-
if ('refused' in diff) return [`the hq refused the check: ${diff.refused}`]
|
|
2591
|
-
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(', ')})`]))
|
|
2683
|
+
const left = passes.flatMap((p) => notInRows(p).map((l) => `${p.dir}: ${l}`))
|
|
2684
|
+
if (left.length > 0) {
|
|
2685
|
+
h.err(`FAIL: review import: ${left.length} items or messages it read are not in the rows: run it again`)
|
|
2686
|
+
for (const l of left.slice(0, 20)) h.err(` ${l}`)
|
|
2687
|
+
return 1
|
|
2688
|
+
}
|
|
2689
|
+
const broken = passes.reduce((n, p) => n + p.broken.length, 0)
|
|
2690
|
+
h.out(`ok: ${passes.reduce((n, p) => n + p.items, 0)} threads read, each one in the rows of the daemon's database; the folders stay as they are`)
|
|
2691
|
+
return broken > 0 ? 1 : 0
|
|
2692
|
+
})
|
|
2592
2693
|
}
|
|
2593
2694
|
}
|
|
2594
2695
|
|
|
@@ -2596,8 +2697,8 @@ export class ReviewExportCommand extends Command {
|
|
|
2596
2697
|
static override paths = [['review', 'export']]
|
|
2597
2698
|
static override usage = Command.Usage({
|
|
2598
2699
|
category: 'Review',
|
|
2599
|
-
description: 'threads of this repo written as
|
|
2600
|
-
details: `${DETAILS}\n\
|
|
2700
|
+
description: 'threads of this repo written as folders, one an item, into a folder of yours',
|
|
2701
|
+
details: `${DETAILS}\n\nEvery thread is rows of the daemon's database; export writes each one as a folder a person reads (\`<to>/<id>/item.json\`, \`thread/<message>.json\`, and each media file this machine still holds; a file the disk let go is named, its key in the head's media). sk thread import --from <to> reads it back. Nothing in the rows changes.`,
|
|
2601
2702
|
examples: [['one item', 'sk thread export 20261118-210000-the-gate --to /tmp/threads'], ['every item of the repo', 'sk thread export --all --to /tmp/threads']],
|
|
2602
2703
|
})
|
|
2603
2704
|
all = Option.Boolean('--all', false, { description: 'every item of the repo' })
|
|
@@ -2606,28 +2707,24 @@ export class ReviewExportCommand extends Command {
|
|
|
2606
2707
|
|
|
2607
2708
|
async execute(): Promise<number> {
|
|
2608
2709
|
return run(this.context, async (h) => {
|
|
2609
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2610
2710
|
const { resolve } = await import('node:path')
|
|
2711
|
+
const { realpathSync } = await import('node:fs')
|
|
2611
2712
|
if (this.all === this.ids.length > 0) throw new Error('give item ids or --all')
|
|
2612
2713
|
const to = resolve(this.to)
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
const { cpSync, existsSync } = await import('node:fs')
|
|
2620
|
-
const { itemIds } = await import('../review/store.ts')
|
|
2621
|
-
const { join } = await import('node:path')
|
|
2622
|
-
const want = ids ?? itemIds(h.dir)
|
|
2623
|
-
for (const id of want) if (!existsSync(join(to, id))) cpSync(join(h.dir, id), join(to, id), { recursive: true })
|
|
2624
|
-
r = { dir: h.dir, items: want.length, heads: want.length, msgs: 0, gone: 0, same: 0, files: 0, kept: [], broken: [], read: [] }
|
|
2714
|
+
const real = (p: string): string => {
|
|
2715
|
+
try {
|
|
2716
|
+
return realpathSync(p)
|
|
2717
|
+
} catch {
|
|
2718
|
+
return resolve(p)
|
|
2719
|
+
}
|
|
2625
2720
|
}
|
|
2626
|
-
|
|
2721
|
+
if (real(to) === real(h.dir)) throw new Error(`--to ${this.to}: the store's own folder, which sk thread import reads as an older shipkit's store`)
|
|
2722
|
+
const ids = this.all ? undefined : await Promise.all(this.ids.map((r) => idOf(h.dir, r)))
|
|
2723
|
+
const r = (await import('../review/folders.ts')).exportFolders(h.dir, to, ids)
|
|
2724
|
+
h.out(`review: ${r.items} items written into ${to} (${r.heads} heads, ${r.msgs} messages, ${r.media?.copied ?? 0} media files)`)
|
|
2627
2725
|
for (const k of r.kept) h.out(` kept: ${k}`)
|
|
2628
|
-
for (const b of r.broken) h.err(` does not read: ${b}`)
|
|
2629
2726
|
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(', ')}`)
|
|
2630
|
-
return
|
|
2727
|
+
return 0
|
|
2631
2728
|
})
|
|
2632
2729
|
}
|
|
2633
2730
|
}
|
|
@@ -2787,7 +2884,7 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2787
2884
|
static override usage = Command.Usage({
|
|
2788
2885
|
category: 'Review',
|
|
2789
2886
|
description: "fold the threads that own one address into one; dry run, --go after a backup",
|
|
2790
|
-
details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go
|
|
2887
|
+
details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go writes each link through the head's one rewrite path, and nothing else: no backup run holds a head (the hq does, with its copies). Only a missing link is written: a second run finds nothing. His notes read in their thread already: none is written. Each changed head goes to the hq like any changed head. Page: wiki tools/shipkit/threads-store.md, The one thread guard`,
|
|
2791
2888
|
examples: [['what it would fold here', 'sk thread migrate'], ['every house store', 'sk thread migrate --all'], ['fold them', 'sk thread migrate --all --go']],
|
|
2792
2889
|
})
|
|
2793
2890
|
go = Option.Boolean('--go', false, { description: 'write the links, after a backup' })
|
|
@@ -2799,15 +2896,13 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2799
2896
|
const { openReview } = await import('../review/project.ts')
|
|
2800
2897
|
const { foldStore } = await import('../review/thread-fold.ts')
|
|
2801
2898
|
const { repoIdOf } = await import('../review/item-db.ts')
|
|
2802
|
-
const { threadsInDb } = await import('../hq/switch.ts')
|
|
2803
|
-
const { existsSync } = await import('node:fs')
|
|
2804
2899
|
const dirs = this.all ? await houseStores() : [h.dir]
|
|
2805
2900
|
const seen = new Set<string>()
|
|
2806
2901
|
const stores = dirs.filter((d) => {
|
|
2807
|
-
const key =
|
|
2902
|
+
const key = repoIdOf(d)
|
|
2808
2903
|
if (seen.has(key)) return false
|
|
2809
2904
|
seen.add(key)
|
|
2810
|
-
return
|
|
2905
|
+
return true
|
|
2811
2906
|
})
|
|
2812
2907
|
const plans = []
|
|
2813
2908
|
for (const d of stores) {
|
|
@@ -2822,14 +2917,9 @@ export class ReviewMigrateCommand extends Command {
|
|
|
2822
2917
|
return 0
|
|
2823
2918
|
}
|
|
2824
2919
|
if (!this.go) {
|
|
2825
|
-
h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'}
|
|
2920
|
+
h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'} folds`)
|
|
2826
2921
|
return 0
|
|
2827
2922
|
}
|
|
2828
|
-
h.out('backup first: sk backup')
|
|
2829
|
-
const b = Bun.spawnSync(['sk', 'backup'], { stdout: 'pipe', stderr: 'pipe' })
|
|
2830
|
-
const said = `${b.stdout?.toString() ?? ''}${b.stderr?.toString() ?? ''}`.trim()
|
|
2831
|
-
for (const l of said.split('\n').slice(-3)) h.out(` ${l}`)
|
|
2832
|
-
if (b.exitCode !== 0) throw new Error('sk backup failed: nothing folded, the stores are as they were')
|
|
2833
2923
|
for (const p of todo) {
|
|
2834
2924
|
const r = foldStore(p.d, { go: true })
|
|
2835
2925
|
h.out(`${p.d}: ${r.links.length} links written, ${r.before} threads to ${r.after}`)
|
|
@@ -2872,12 +2962,13 @@ export const REVIEW_COMMANDS = [
|
|
|
2872
2962
|
ReviewStageCommand,
|
|
2873
2963
|
ReviewAutoCommand,
|
|
2874
2964
|
ReviewWatchCommand,
|
|
2875
|
-
|
|
2965
|
+
ReviewImportCommand,
|
|
2876
2966
|
ReviewExportCommand,
|
|
2877
2967
|
ReviewMigrateCommand,
|
|
2878
2968
|
ThreadProposeCommand,
|
|
2879
2969
|
ThreadAttachCommand,
|
|
2880
2970
|
ThreadTakeCommand,
|
|
2971
|
+
ThreadTagCommand,
|
|
2881
2972
|
ThreadAssignCommand,
|
|
2882
2973
|
ThreadWorkingCommand,
|
|
2883
2974
|
]
|