rvlib-shipkit 2.28.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/package.json +10 -2
- package/src/advisors/acts.ts +277 -0
- package/src/advisors/advice.ts +384 -0
- package/src/advisors/advisor-view.ts +417 -0
- package/src/advisors/app-graph.ts +112 -0
- package/src/advisors/app.ts +75 -0
- package/src/advisors/door.ts +59 -0
- package/src/advisors/edge/api.ts +292 -0
- package/src/advisors/edge/bucket.ts +43 -0
- package/src/advisors/edge/certs.ts +20 -0
- package/src/advisors/edge/form.ts +45 -0
- package/src/advisors/edge/handler.ts +156 -0
- package/src/advisors/edge/jwt.ts +76 -0
- package/src/advisors/edge/shell.ts +27 -0
- package/src/advisors/edge/status.ts +12 -0
- package/src/advisors/edge/types.ts +137 -0
- package/src/advisors/edge/worker.ts +52 -0
- package/src/advisors/expose.ts +150 -0
- package/src/advisors/job.ts +35 -0
- package/src/advisors/owner-store.ts +226 -0
- package/src/advisors/photos.ts +182 -0
- package/src/advisors/project.ts +311 -0
- package/src/advisors/r2.ts +48 -0
- package/src/advisors/routes.ts +469 -0
- package/src/advisors/scan.ts +194 -0
- package/src/advisors/sync.ts +363 -0
- package/src/agent-time/accounts-usage-disk.ts +29 -0
- package/src/agent-time/accounts-usage.ts +97 -0
- package/src/agent-time/hooks.ts +64 -27
- package/src/agent-time/lane-name.ts +7 -0
- package/src/agent-time/leads.ts +95 -0
- package/src/agent-time/registry.ts +106 -41
- package/src/agent-time/render.ts +35 -4
- package/src/agent-time/report-cache.ts +4 -8
- package/src/agent-time/report.ts +19 -1
- package/src/agent-time/store.ts +10 -16
- package/src/annex/snapshots.ts +3 -3
- package/src/annex/tidy.ts +10 -23
- package/src/asks/ask-after.ts +2 -1
- package/src/asks/ask-carry.ts +190 -0
- package/src/asks/ask-close.ts +72 -0
- package/src/asks/ask-doc.ts +42 -0
- package/src/asks/ask-migrate.ts +9 -9
- package/src/asks/ask-steps-fold.ts +71 -114
- package/src/asks/ask-store.ts +170 -53
- package/src/asks/ask-words-fold.ts +208 -0
- package/src/checks/SK001-package-json-shape.check.ts +5 -7
- package/src/checks/SK004-gitignore-policy.check.ts +13 -13
- package/src/checks/SK010-undeclared-unit.check.ts +77 -64
- package/src/checks/SK013-one-way-in-policy.check.ts +20 -8
- package/src/checks/SK027-agent-wiki-links.check.ts +46 -6
- package/src/checks/SK033-global-contribution.check.ts +1 -1
- package/src/checks/SK036-draft-media-size.check.ts +5 -4
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK040-release-words.check.ts +39 -10
- package/src/checks/SK042-post-kinds.check.ts +2 -2
- package/src/checks/SK045-slow-hooks.check.ts +5 -2
- package/src/checks/SK049-thread-answers-hook.check.ts +6 -4
- package/src/checks/SK051-no-formatter.check.ts +485 -0
- package/src/cli/cmd_Advisors.ts +336 -0
- package/src/cli/cmd_Annex.ts +10 -10
- package/src/cli/cmd_Asks.ts +111 -10
- package/src/cli/cmd_Backup.ts +7 -7
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Check.ts +3 -3
- package/src/cli/cmd_Checks.ts +1 -1
- package/src/cli/cmd_Ci.ts +15 -16
- package/src/cli/cmd_Db.ts +9 -9
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_History.ts +2 -2
- package/src/cli/cmd_Home.ts +5 -6
- package/src/cli/cmd_Hooks.ts +13 -3
- package/src/cli/cmd_Hq.ts +30 -19
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +9 -3
- package/src/cli/cmd_Media.ts +59 -13
- package/src/cli/cmd_Orchestrator.ts +138 -0
- package/src/cli/cmd_Rec.ts +5 -2
- package/src/cli/cmd_Reflect.ts +17 -3
- package/src/cli/cmd_Releases.ts +38 -38
- package/src/cli/cmd_Review.ts +690 -316
- package/src/cli/cmd_Shot.ts +14 -6
- package/src/cli/cmd_Social.ts +5 -4
- package/src/cli/cmd_SocialDrafts.ts +23 -10
- package/src/cli/cmd_Space.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +18 -11
- package/src/cli/cmd_ThreadReflect.ts +20 -12
- package/src/cli/cmd_ThreadSyncNeeds.ts +7 -7
- package/src/cli/cmd_Time.ts +2 -1
- package/src/cli/cmd_Tmp.ts +9 -8
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +5 -5
- package/src/cli/cmd_Urls.ts +3 -3
- package/src/cli/cmd_Vault.ts +4 -4
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Worktrees.ts +109 -0
- package/src/cli/registry.ts +15 -4
- package/src/cli.ts +21 -13
- package/src/collections/actions.ts +2 -1
- package/src/collections/checks.ts +1 -1
- package/src/collections/collection-types.ts +16 -5
- package/src/collections/pings.ts +3 -0
- package/src/collections/providers.ts +15 -15
- package/src/collections/review.ts +25 -23
- package/src/collections/state-rules.ts +8 -7
- package/src/comfy/comfy-panel.ts +2 -2
- package/src/commands/model.ts +1 -1
- package/src/commands/routes.ts +1 -1
- package/src/commands/runs.ts +1 -1
- package/src/core/app-icon.ts +3 -9
- package/src/core/atomic-write.ts +36 -0
- package/src/core/budget.ts +16 -1
- package/src/core/bun-builtins.ts +7 -7
- package/src/core/canonical-scripts.ts +4 -6
- package/src/core/check-ctx.ts +17 -3
- package/src/core/day-stamp.ts +20 -0
- package/src/core/git-bin.ts +10 -0
- package/src/core/git.ts +60 -16
- package/src/core/hard-reset.ts +1 -2
- package/src/core/history-files.ts +4 -8
- package/src/core/house-layout.ts +3 -0
- package/src/core/hub-theme.ts +16 -0
- package/src/core/identity.ts +1 -1
- package/src/core/in-base.ts +19 -0
- package/src/core/instance.ts +15 -5
- package/src/core/last-good.ts +42 -133
- package/src/core/layout.ts +1 -1
- package/src/core/load-probe.ts +4 -8
- package/src/core/locked-write.ts +117 -47
- package/src/core/loop-watch.ts +24 -3
- package/src/core/machine-db.ts +54 -12
- package/src/core/machine-link.ts +1 -1
- package/src/core/memory-watch.ts +3 -2
- package/src/core/motherhome.ts +2 -1
- package/src/core/nearest.ts +23 -0
- package/src/core/on-loop.ts +57 -0
- package/src/core/one-way-in-policy.ts +26 -13
- package/src/core/raw-access.ts +9 -2
- package/src/core/reexec.ts +3 -5
- package/src/core/repo-walk.ts +104 -0
- package/src/core/retention.ts +10 -12
- package/src/core/run-dirs.ts +45 -0
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +2 -2
- package/src/core/slug.ts +33 -0
- package/src/core/spawn-timeout.ts +3 -1
- package/src/core/squircle.ts +0 -8
- package/src/core/throwaway-worktree.ts +21 -2
- package/src/core/unit-files.ts +4 -4
- package/src/core/when-block.ts +4 -5
- package/src/core/when.ts +1 -3
- package/src/core/words.ts +33 -0
- package/src/fleet/push-fleet.ts +4 -11
- package/src/{core → gate}/cache-audit.ts +1 -1
- package/src/{core → gate}/check-runner.ts +24 -54
- package/src/{core → gate}/discover-checks.ts +5 -102
- package/src/{core → gate}/discover-legacy-checks.ts +3 -3
- package/src/{ledger → gate}/gate-checks.ts +5 -5
- package/src/gate/head-gate.ts +151 -0
- package/src/{core → gate}/job-follow.ts +1 -1
- package/src/{core → gate}/job-run.ts +3 -3
- package/src/{core → gate}/pre-commit-discovery.ts +2 -2
- package/src/{core → gate}/run-check.ts +7 -7
- package/src/{core → gate}/run-ci.ts +9 -9
- package/src/gate/run-fix.ts +173 -0
- package/src/{core → gate}/run-fixers.ts +14 -14
- package/src/{core → gate}/trace-audit.ts +8 -8
- package/src/home/activity-shape.ts +1 -1
- package/src/home/activity.ts +13 -11
- package/src/home/app-sign.ts +17 -9
- package/src/home/daemon-guard.ts +6 -0
- package/src/home/daemon-jobs.ts +52 -10
- package/src/home/database-words.ts +21 -27
- package/src/home/databases.ts +3 -3
- package/src/home/global-context.ts +2 -2
- package/src/home/global-units.ts +1 -1
- package/src/home/gui-app/ShipkitGui.swift +129 -55
- package/src/home/gui-app.ts +1 -1
- package/src/home/handover.ts +126 -0
- package/src/home/home-move.ts +29 -16
- package/src/home/home-paths.ts +30 -8
- package/src/home/home-routes.ts +75 -5
- package/src/home/home-start.ts +1 -1
- package/src/home/home-state.ts +12 -6
- package/src/home/hubs.ts +28 -5
- package/src/home/inbox-shape.ts +61 -38
- package/src/home/inbox.ts +2 -1
- package/src/home/lib-watch.ts +93 -74
- package/src/home/machine-fold.ts +46 -43
- package/src/home/machine-repair.ts +5 -6
- package/src/home/machine-stores.ts +3 -3
- package/src/home/machine-temp.ts +58 -67
- package/src/home/page-build.ts +330 -0
- package/src/home/page-held.ts +338 -0
- package/src/home/pm-config.ts +10 -2
- package/src/home/pm.ts +35 -1
- package/src/home/process-apps.ts +3 -3
- package/src/home/push-sources.ts +132 -0
- package/src/home/run-daemon.ts +54 -4
- package/src/home/run-pm.ts +2 -1
- package/src/home/run-web.ts +11 -6
- package/src/home/search-shape.ts +54 -0
- package/src/home/search.ts +114 -0
- package/src/home/serve-daemon.ts +40 -18
- package/src/home/serve-web.ts +86 -145
- package/src/home/space-page.ts +7 -7
- package/src/home/space-words.ts +11 -10
- package/src/home/supervise.ts +24 -0
- package/src/home/time-page-shape.ts +0 -13
- package/src/home/vault-page.ts +15 -15
- package/src/home/vault-reveal.ts +29 -0
- package/src/home/vault-words.ts +3 -3
- package/src/home/via-hub.ts +3 -4
- package/src/home/worktree-tidy.ts +236 -0
- package/src/hooks/edit-guard.ts +12 -0
- package/src/hooks/hook-gates.ts +2 -0
- package/src/hooks/leak-guard.ts +9 -3
- package/src/hooks/one-way-in-guard.ts +11 -3
- package/src/hooks/run-hooks.ts +58 -5
- package/src/hooks/shared-file.ts +174 -0
- package/src/{serve → house}/project-gutter.ts +5 -1
- package/src/hq/door-route.ts +2 -2
- package/src/hq/door.ts +3 -3
- package/src/hq/files-send.ts +5 -5
- package/src/hq/forgotten-log.ts +1 -1
- package/src/hq/history-check.ts +7 -6
- package/src/hq/history-send.ts +12 -14
- package/src/hq/hq-db.ts +1 -1
- package/src/hq/hq-local.ts +12 -10
- package/src/hq/hq-routes.ts +1 -1
- package/src/hq/hq-store.ts +4 -4
- package/src/hq/kinds/ask.ts +4 -3
- package/src/hq/kinds/index.ts +4 -4
- package/src/hq/kinds/{card-gone.ts → item-gone.ts} +24 -25
- package/src/hq/kinds/{card-msg.ts → item-msg.ts} +25 -27
- package/src/hq/kinds/{card.ts → item.ts} +31 -29
- package/src/hq/kinds/kind.ts +3 -0
- package/src/hq/kinds/media.ts +2 -3
- package/src/hq/kinds/prompt.ts +2 -1
- package/src/hq/kinds/time-day.ts +5 -4
- package/src/hq/ledger.ts +22 -22
- package/src/hq/machine-notes.ts +14 -15
- package/src/hq/outbox.ts +31 -22
- package/src/hq/report.ts +10 -12
- package/src/hq/switch.ts +20 -23
- package/src/hq/{cards.ts → thread-sync.ts} +127 -99
- package/src/hq/vault-route.ts +1 -1
- package/src/{serve → http}/door-forward.ts +11 -4
- package/src/http/loopback-serve.ts +84 -0
- package/src/{serve → http}/same-origin.ts +3 -2
- package/src/{serve → http}/tailnet-caller.ts +5 -4
- package/src/identities/machine-route.ts +2 -2
- package/src/identities/shown.ts +2 -6
- package/src/ledger/check-table.ts +1 -1
- package/src/ledger/db.ts +1 -0
- package/src/ledger/git-key.ts +9 -3
- package/src/ledger/git-scan.ts +2 -2
- package/src/ledger/ledger.ts +6 -16
- package/src/media-kinds.ts +4 -1
- package/src/media-store/backup/daemon.ts +3 -2
- package/src/media-store/backup/keys.ts +0 -3
- package/src/media-store/backup/manifest.ts +1 -1
- package/src/media-store/backup/prune.ts +15 -18
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/run.ts +8 -27
- package/src/media-store/backup/sources.ts +11 -12
- package/src/media-store/backup/thread-copy.ts +8 -9
- package/src/media-store/backup/watch.ts +10 -6
- package/src/media-store/content.ts +3 -0
- package/src/media-store/copy/night.ts +4 -4
- package/src/media-store/daemon.ts +5 -4
- package/src/media-store/db.ts +10 -20
- package/src/media-store/forget-one.ts +247 -0
- package/src/media-store/forget.ts +23 -4
- package/src/media-store/hq-send.ts +5 -4
- package/src/media-store/purge.ts +2 -2
- package/src/media-store/remote.ts +2 -2
- package/src/media-store/space-listing.ts +0 -5
- package/src/media-store/space.ts +1 -0
- package/src/media-store/tidy.ts +3 -3
- package/src/media-store/upload.ts +2 -2
- package/src/media-store/webp.ts +3 -3
- package/src/messages/objects.ts +5 -3
- package/src/messages/score.ts +1 -3
- package/src/messages/store-doc.ts +114 -0
- package/src/messages/verdicts.ts +6 -0
- package/src/messages/write.ts +3 -3
- package/src/mv/mv-md.ts +43 -12
- package/src/orchestrator/brief.md +29 -0
- package/src/orchestrator/deliver.ts +81 -0
- package/src/orchestrator/drill.ts +129 -0
- package/src/orchestrator/guards.ts +63 -0
- package/src/orchestrator/keeper.ts +332 -0
- package/src/orchestrator/phone.ts +98 -0
- package/src/orchestrator/pm.ts +20 -0
- package/src/orchestrator/presence-shape.ts +17 -0
- package/src/orchestrator/presence.ts +68 -0
- package/src/orchestrator/push.ts +102 -0
- package/src/orchestrator/routes.ts +113 -0
- package/src/orchestrator/state.ts +92 -0
- package/src/orchestrator/switch.ts +86 -0
- package/src/orchestrator/tmux.ts +82 -0
- package/src/orchestrator/unheard.ts +68 -0
- package/src/pages/unit.ts +1 -1
- package/src/plan/repo-source.ts +1 -1
- package/src/recordings/load.ts +1 -1
- package/src/recordings/model.ts +18 -10
- package/src/recordings/place.ts +3 -3
- package/src/recordings/recorder-app/Capture.swift +69 -21
- package/src/recordings/recorder-app/Editor.swift +214 -11
- package/src/recordings/recorder-app/main.swift +229 -47
- package/src/recordings/recorder-app.ts +1 -1
- package/src/recordings/routes.ts +11 -1
- package/src/recordings/take.ts +7 -5
- package/src/recordings/view.ts +6 -0
- package/src/reflect/prompt-corpus.ts +5 -3
- package/src/reflect/thread-words.ts +51 -0
- package/src/reflections/reflection-close.ts +123 -0
- package/src/reflections/reflection-doc.ts +59 -0
- package/src/reflections/reflection-place.ts +60 -0
- package/src/release/gate-checkout.ts +122 -20
- package/src/release/git-facts.ts +9 -8
- package/src/release/machine-words.ts +21 -3
- package/src/release/public-clean.ts +78 -19
- package/src/release/run-bump.ts +3 -5
- package/src/release/run-release.ts +42 -38
- package/src/releases/add.ts +33 -87
- package/src/releases/{from-card.ts → from-thread.ts} +47 -46
- package/src/releases/model.ts +207 -36
- package/src/releases/routes.ts +2 -2
- package/src/releases/shape.ts +184 -0
- package/src/releases/store.ts +10 -10
- package/src/repo-config.ts +13 -3
- package/src/review/anim.ts +7 -7
- package/src/review/answer-kinds.ts +39 -10
- package/src/review/auto.ts +3 -3
- package/src/review/band.ts +95 -3
- package/src/review/branch-hold.ts +12 -5
- package/src/review/cells.ts +169 -46
- package/src/review/doc-card.ts +41 -0
- package/src/review/doc-model.ts +100 -0
- package/src/review/doc-routes.ts +66 -0
- package/src/review/doc-save.ts +152 -0
- package/src/review/{draft-card.ts → draft-item.ts} +10 -7
- package/src/review/draft-model.ts +125 -17
- package/src/review/events.ts +5 -12
- package/src/review/file-tags.ts +52 -0
- package/src/review/format.ts +84 -41
- package/src/review/gone.ts +20 -20
- package/src/review/hand-over.ts +58 -0
- package/src/review/heard.ts +29 -0
- package/src/review/house-kind-defs.ts +34 -4
- package/src/review/http.ts +1 -1
- package/src/review/inbox-hook.ts +55 -9
- package/src/review/inbox-read.ts +38 -13
- package/src/review/instructions.ts +42 -0
- package/src/review/{card-db.ts → item-db.ts} +32 -30
- package/src/review/{card-rows.ts → item-rows.ts} +77 -50
- package/src/review/kind-still.ts +125 -0
- package/src/review/kinds.ts +46 -10
- package/src/review/lane-ask.ts +6 -2
- package/src/review/live-post.ts +107 -0
- package/src/review/live-view.ts +137 -0
- package/src/review/media-kind.ts +4 -4
- package/src/review/media-read.ts +4 -4
- package/src/review/media.ts +3 -5
- package/src/review/mentions.ts +100 -0
- package/src/review/model-moved.ts +76 -0
- package/src/review/model.ts +471 -149
- package/src/review/move.ts +59 -58
- package/src/review/need-address.ts +5 -5
- package/src/review/need-threads.ts +15 -57
- package/src/review/notes.ts +2 -1
- package/src/review/one-block.ts +64 -0
- package/src/review/owner-read.ts +41 -0
- package/src/review/owner-verdict.ts +3 -3
- package/src/review/parties.ts +101 -9
- package/src/review/paste.ts +4 -4
- package/src/review/phone-push.ts +137 -0
- package/src/review/previews.ts +16 -16
- package/src/review/project.ts +1 -1
- package/src/review/push.ts +269 -0
- package/src/review/referring.ts +26 -4
- package/src/review/reflection-object.ts +13 -18
- package/src/review/rev.ts +1 -1
- package/src/review/role.ts +3 -3
- package/src/review/routes.ts +113 -74
- package/src/review/search-index.ts +218 -0
- package/src/review/search-job.ts +40 -0
- package/src/review/search-ocr.ts +138 -0
- package/src/review/search-text.ts +129 -0
- package/src/review/secret-route.ts +44 -14
- package/src/review/settle.ts +67 -0
- package/src/review/stage-routes.ts +15 -13
- package/src/review/{stage-card.ts → stage-thread.ts} +18 -17
- package/src/review/store-index.ts +49 -0
- package/src/review/store-parties.ts +20 -0
- package/src/review/store.ts +394 -214
- package/src/review/supersede.ts +23 -7
- package/src/review/take-back.ts +19 -6
- package/src/review/threads.ts +184 -63
- package/src/review/traces.ts +21 -33
- package/src/review/trailer-desk.ts +7 -7
- package/src/review/{trailer-card.ts → trailer-item.ts} +10 -10
- package/src/review/trailer-model.ts +4 -4
- package/src/review/trailer-notes.ts +2 -2
- package/src/review/trailer-routes.ts +5 -4
- package/src/review/trailer-shots.ts +3 -3
- package/src/review/unit.ts +70 -9
- package/src/review/uploads.ts +103 -0
- package/src/review/verdict-items.ts +2 -2
- package/src/review/verdict-write.ts +1 -1
- package/src/review/view-layout.ts +69 -0
- package/src/review/wait.ts +11 -5
- package/src/review/wakes.ts +115 -0
- package/src/review/watch-feed.ts +183 -0
- package/src/review/watchers.ts +27 -6
- package/src/rules/untrack-generated.ts +40 -39
- package/src/scaffold/files/bunfig.toml +1 -9
- package/src/scaffold/files/vscode-settings.json +1 -1
- package/src/scaffold/project-scaffold.ts +14 -10
- package/src/secrets/archive.ts +2 -1
- package/src/secrets/keychain-write.ts +11 -3
- package/src/secrets/lapse-mark.ts +8 -3
- package/src/secrets/lapse.ts +26 -15
- package/src/secrets/security-line.ts +19 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/house-runs.ts +1 -1
- package/src/serve/hub-app/accounts-line.tsx +67 -0
- package/src/serve/hub-app/activity-st.ts +46 -50
- package/src/serve/hub-app/advice-box.tsx +66 -0
- package/src/serve/hub-app/advisor-app.tsx +46 -0
- package/src/serve/hub-app/advisor-face.tsx +29 -0
- package/src/serve/hub-app/advisor-host.ts +142 -0
- package/src/serve/hub-app/advisor.html +22 -0
- package/src/serve/hub-app/advisors-st.ts +261 -0
- package/src/serve/hub-app/advisors-view.tsx +269 -0
- package/src/serve/hub-app/advisors.css +57 -0
- package/src/serve/hub-app/app-bridge.ts +27 -24
- package/src/serve/hub-app/ask-steps-st.ts +60 -0
- package/src/serve/hub-app/ask-steps.tsx +23 -0
- package/src/serve/hub-app/asks-page.tsx +8 -5
- package/src/serve/hub-app/asks-st.ts +1 -4
- package/src/serve/hub-app/auto-text.tsx +106 -14
- package/src/serve/hub-app/checks-svc.ts +1 -1
- package/src/serve/hub-app/clock-svc.ts +21 -5
- package/src/serve/hub-app/code-copy.ts +173 -12
- package/src/serve/hub-app/col-card.tsx +14 -21
- package/src/serve/hub-app/col-list-page.tsx +2 -2
- package/src/serve/hub-app/col-list-st.ts +6 -1
- package/src/serve/hub-app/col-tables.ts +14 -8
- package/src/serve/hub-app/cols-svc.ts +11 -1
- package/src/serve/hub-app/comfy-svc.ts +3 -2
- package/src/serve/hub-app/commands/commands-st.ts +36 -26
- package/src/serve/hub-app/controls.css +27 -11
- package/src/serve/hub-app/cursor-spot.ts +81 -0
- package/src/serve/hub-app/database-st.ts +31 -26
- package/src/serve/hub-app/database-view.tsx +12 -12
- package/src/serve/hub-app/dock-st.ts +51 -10
- package/src/serve/hub-app/dock-view.tsx +14 -1
- package/src/serve/hub-app/editor/doc-editor-st.ts +223 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +116 -0
- package/src/serve/hub-app/editor/doc-saved.tsx +26 -0
- package/src/serve/hub-app/editor/doc-slot.ts +66 -0
- package/src/serve/hub-app/editor.css +36 -0
- package/src/serve/hub-app/emoji-names.ts +1915 -0
- package/src/serve/hub-app/emoji.ts +133 -0
- package/src/serve/hub-app/floating.tsx +162 -6
- package/src/serve/hub-app/git-st.ts +25 -19
- package/src/serve/hub-app/hash-route.ts +1 -1
- package/src/serve/hub-app/header-bar.tsx +4 -3
- package/src/serve/hub-app/held-keys.ts +25 -0
- package/src/serve/hub-app/home-st.ts +114 -16
- package/src/serve/hub-app/home-strip.css +3 -2
- package/src/serve/hub-app/home-strip.tsx +5 -2
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +56 -6
- package/src/serve/hub-app/hub.css +67 -31
- package/src/serve/hub-app/icons.tsx +10 -0
- package/src/serve/hub-app/identities-st.ts +35 -25
- package/src/serve/hub-app/identities-view.tsx +9 -6
- package/src/serve/hub-app/inbox-st.ts +39 -11
- package/src/serve/hub-app/inbox-view.tsx +10 -5
- package/src/serve/hub-app/inbox.css +6 -3
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/insights-st.ts +27 -19
- package/src/serve/hub-app/instructions.css +9 -6
- package/src/serve/hub-app/kept-folds.ts +43 -0
- package/src/serve/hub-app/keys.ts +9 -3
- package/src/serve/hub-app/later.tsx +1 -1
- package/src/serve/hub-app/layout-st.ts +37 -6
- package/src/serve/hub-app/list-filter.tsx +1 -1
- package/src/serve/hub-app/live-bar.css +12 -0
- package/src/serve/hub-app/live-svc.ts +12 -2
- package/src/serve/hub-app/machine-st.ts +36 -10
- package/src/serve/hub-app/machines-st.ts +40 -34
- package/src/serve/hub-app/machines-view.tsx +5 -5
- package/src/serve/hub-app/markdown.css +81 -4
- package/src/serve/hub-app/md.ts +155 -9
- package/src/serve/hub-app/media-svc.ts +44 -11
- package/src/serve/hub-app/messages/messages-page.tsx +56 -12
- package/src/serve/hub-app/messages/messages-st.ts +26 -22
- package/src/serve/hub-app/new-thread.tsx +121 -0
- package/src/serve/hub-app/objects.css +1 -0
- package/src/serve/hub-app/orchestrator-line.tsx +104 -0
- package/src/serve/hub-app/orchestrator.css +37 -0
- package/src/serve/hub-app/page-keys.ts +7 -4
- package/src/serve/hub-app/page-reload.ts +111 -0
- package/src/serve/hub-app/pages-frames.tsx +2 -1
- package/src/serve/hub-app/pages-svc.ts +8 -3
- package/src/serve/hub-app/palette-st.ts +7 -2
- package/src/serve/hub-app/pane-boundary.tsx +13 -0
- package/src/serve/hub-app/pane-errors.ts +2 -1
- package/src/serve/hub-app/pano.css +20 -0
- package/src/serve/hub-app/plan-view.tsx +1 -1
- package/src/serve/hub-app/planned-st.ts +30 -26
- package/src/serve/hub-app/planned-view.tsx +16 -9
- package/src/serve/hub-app/polled.ts +201 -0
- package/src/serve/hub-app/presence-st.ts +110 -0
- package/src/serve/hub-app/project-list.css +98 -55
- package/src/serve/hub-app/project-list.tsx +136 -149
- package/src/serve/hub-app/projects-svc.ts +109 -57
- package/src/serve/hub-app/push-sign.tsx +15 -0
- package/src/serve/hub-app/push-svc.ts +273 -0
- package/src/serve/hub-app/quiet-st.ts +59 -0
- package/src/serve/hub-app/rail-fly.tsx +95 -0
- package/src/serve/hub-app/reach.ts +16 -0
- package/src/serve/hub-app/recordings-st.ts +169 -9
- package/src/serve/hub-app/recordings-take.ts +58 -0
- package/src/serve/hub-app/recordings-view.tsx +42 -35
- package/src/serve/hub-app/recordings.css +1 -1
- package/src/serve/hub-app/reflections-page.tsx +16 -4
- package/src/serve/hub-app/releases/releases-page.tsx +52 -19
- package/src/serve/hub-app/releases/releases-st.ts +39 -26
- package/src/serve/hub-app/releases.css +4 -0
- package/src/serve/hub-app/repo-sections.ts +21 -10
- package/src/serve/hub-app/repo-st.ts +36 -9
- package/src/serve/hub-app/review/advisor-bar.tsx +40 -0
- package/src/serve/hub-app/review/attach-st.ts +195 -0
- package/src/serve/hub-app/review/attach-view.tsx +260 -0
- package/src/serve/hub-app/review/clip-st.ts +1 -1
- package/src/serve/hub-app/review/cta.tsx +11 -0
- package/src/serve/hub-app/review/diff-view.tsx +37 -35
- package/src/serve/hub-app/review/doc-body.tsx +109 -0
- package/src/serve/hub-app/review/dock.tsx +36 -22
- package/src/serve/hub-app/review/draft-body.tsx +235 -0
- package/src/serve/hub-app/review/faces.tsx +26 -0
- package/src/serve/hub-app/review/group-block.tsx +75 -45
- package/src/serve/hub-app/review/heard-line.tsx +31 -0
- package/src/serve/hub-app/review/instructions-view.tsx +57 -32
- package/src/serve/hub-app/review/item-verdict.tsx +99 -26
- package/src/serve/hub-app/review/kind-states.tsx +148 -76
- package/src/serve/hub-app/review/kind-view.tsx +22 -7
- package/src/serve/hub-app/review/kit.tsx +4 -28
- package/src/serve/hub-app/review/lane-bar.tsx +4 -4
- package/src/serve/hub-app/review/lightbox.tsx +16 -0
- package/src/serve/hub-app/review/line-window.ts +149 -0
- package/src/serve/hub-app/review/live-bar-st.ts +145 -0
- package/src/serve/hub-app/review/live-bar.tsx +126 -0
- package/src/serve/hub-app/review/live-view.tsx +104 -0
- package/src/serve/hub-app/review/mention-st.ts +85 -0
- package/src/serve/hub-app/review/mesh-view.tsx +9 -0
- package/src/serve/hub-app/review/object-panel.tsx +35 -17
- package/src/serve/hub-app/review/pano-gl.ts +145 -0
- package/src/serve/hub-app/review/pano-view.tsx +192 -0
- package/src/serve/hub-app/review/phone-top.tsx +16 -0
- package/src/serve/hub-app/review/pictures-st.ts +38 -0
- package/src/serve/hub-app/review/question-views.tsx +107 -105
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +169 -111
- package/src/serve/hub-app/review/review-host.ts +69 -0
- package/src/serve/hub-app/review/review-kit.ts +34 -19
- package/src/serve/hub-app/review/review-list.tsx +123 -20
- package/src/serve/hub-app/review/review-page.tsx +7 -18
- package/src/serve/hub-app/review/review-st.ts +241 -138
- package/src/serve/hub-app/review/review-thread.tsx +463 -150
- package/src/serve/hub-app/review/review-views.tsx +540 -449
- package/src/serve/hub-app/review/scene-view.tsx +26 -0
- package/src/serve/hub-app/review/secret-facts.ts +26 -0
- package/src/serve/hub-app/review/space3d.tsx +114 -0
- package/src/serve/hub-app/review/splat-view.tsx +9 -0
- package/src/serve/hub-app/review/superseded-runs.ts +76 -0
- package/src/serve/hub-app/review/thread-close.tsx +17 -7
- package/src/serve/hub-app/review/thread-control-st.ts +2 -1
- package/src/serve/hub-app/review/thread-st.ts +528 -158
- package/src/serve/hub-app/review/thread-views.ts +71 -0
- package/src/serve/hub-app/review/{trailer-card.tsx → trailer-body.tsx} +34 -34
- package/src/serve/hub-app/review/trailer-page.tsx +23 -25
- package/src/serve/hub-app/review/trailer-st.ts +38 -38
- package/src/serve/hub-app/review/trailer-timeline.tsx +23 -19
- package/src/serve/hub-app/review/trailer-voices.tsx +3 -2
- package/src/serve/hub-app/review.css +259 -147
- package/src/serve/hub-app/search-st.ts +138 -0
- package/src/serve/hub-app/search-view.tsx +92 -0
- package/src/serve/hub-app/section-head.tsx +5 -4
- package/src/serve/hub-app/shell-rows.ts +126 -0
- package/src/serve/hub-app/site/site-st.ts +18 -23
- package/src/serve/hub-app/social/comms-page.tsx +14 -11
- package/src/serve/hub-app/social/group-editor.tsx +44 -0
- package/src/serve/hub-app/social/kit.tsx +7 -46
- package/src/serve/hub-app/social/next-release.tsx +2 -2
- package/src/serve/hub-app/social/post-card.tsx +16 -52
- package/src/serve/hub-app/social/problems.tsx +5 -4
- package/src/serve/hub-app/social/social-page.tsx +3 -3
- package/src/serve/hub-app/social/social-st.ts +31 -84
- package/src/serve/hub-app/social/stage-popup.tsx +6 -6
- package/src/serve/hub-app/social/stage-st.ts +9 -9
- package/src/serve/hub-app/social.css +0 -8
- package/src/serve/hub-app/space-st.ts +38 -48
- package/src/serve/hub-app/space-view.tsx +6 -6
- package/src/serve/hub-app/stores/stores-page.tsx +4 -4
- package/src/serve/hub-app/stores/stores-st.ts +19 -23
- package/src/serve/hub-app/terminal-input.ts +12 -0
- package/src/serve/hub-app/terminal-panel.tsx +40 -0
- package/src/serve/hub-app/terminal-st.ts +416 -0
- package/src/serve/hub-app/terminal.css +15 -0
- package/src/serve/hub-app/tests-svc.ts +3 -2
- package/src/serve/hub-app/theme-st.ts +1 -9
- package/src/serve/hub-app/thread-row.tsx +52 -17
- package/src/serve/hub-app/time-ago.tsx +39 -16
- package/src/serve/hub-app/time-st.ts +43 -27
- package/src/serve/hub-app/time-view.tsx +3 -3
- package/src/serve/hub-app/tree-build.ts +2 -2
- package/src/serve/hub-app/tree-row.tsx +43 -18
- package/src/serve/hub-app/tree-svc.ts +1 -1
- package/src/serve/hub-app/urls-svc.ts +6 -5
- package/src/serve/hub-app/vault-st.ts +32 -27
- package/src/serve/hub-app/vault-view.tsx +53 -2
- package/src/serve/hub-app/vault.css +2 -0
- package/src/serve/hub-app/veille/veille-page.tsx +4 -4
- package/src/serve/hub-app/veille/veille-st.ts +56 -49
- package/src/serve/hub-app/view-layout.css +90 -0
- package/src/serve/hub-app/waiting-svc.ts +2 -1
- package/src/serve/hub-app/wiki-st.ts +3 -2
- package/src/serve/hub-app/wikis-view.tsx +18 -15
- package/src/serve/hub-app/words.tsx +15 -0
- package/src/serve/hub-collections.ts +105 -0
- package/src/serve/hub-runtime.ts +67 -89
- package/src/serve/live-hop.ts +102 -0
- package/src/serve/other-repos.ts +1 -1
- package/src/serve/project-gutter-route.ts +53 -40
- package/src/serve/read-thread.ts +76 -0
- package/src/serve/read-worker.ts +53 -0
- package/src/serve/run-serve.ts +11 -7
- package/src/serve/secret-gate.ts +3 -3
- package/src/serve/serve-hub.ts +103 -34
- package/src/serve/terminal-guard.ts +50 -0
- package/src/serve/terminal-route.ts +176 -0
- package/src/shipkit.ts +8 -8
- package/src/shot/client.ts +32 -16
- package/src/shot/dom-clip.ts +30 -5
- package/src/shot/film-box.ts +23 -8
- package/src/shot/serve-shot.ts +16 -5
- package/src/shot/shooter.ts +72 -24
- package/src/shot/shot-ask.ts +17 -6
- package/src/shot/shot-guard.ts +53 -0
- package/src/shot/shot-theme.ts +70 -0
- package/src/shot/still-file.ts +60 -0
- package/src/site/desk.ts +4 -3
- package/src/social/compose.ts +13 -7
- package/src/social/cover.ts +4 -3
- package/src/social/desk-index.ts +2 -2
- package/src/social/draft-doc.ts +88 -0
- package/src/social/draft-versions.ts +80 -0
- package/src/social/drafts.ts +22 -4
- package/src/social/fit.ts +4 -3
- package/src/social/house.ts +1 -1
- package/src/social/import-drafts.ts +1 -1
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +21 -13
- package/src/social/media-facts.ts +1 -19
- package/src/social/media-kind.ts +2 -2
- package/src/social/media-limit.ts +3 -18
- package/src/social/no-account.ts +38 -0
- package/src/social/post-sources.ts +4 -4
- package/src/social/post-text.ts +33 -13
- package/src/social/posts.ts +73 -18
- package/src/social/presence.ts +10 -8
- package/src/social/release-stage.ts +22 -22
- package/src/social/routes.ts +12 -30
- package/src/social/stage.ts +3 -3
- package/src/social/stats.ts +3 -4
- package/src/social/strip.ts +4 -6
- package/src/social/text.ts +2 -1
- package/src/social/{card-drafts.ts → thread-drafts.ts} +3 -3
- package/src/social/unit.ts +12 -3
- package/src/social/writes.ts +0 -6
- package/src/start-repo.ts +33 -13
- package/src/stores/desk.ts +1 -1
- package/src/suite/core-counters.ts +31 -3
- package/src/suite/judge-suites.ts +69 -47
- package/src/suite/select.ts +1 -27
- package/src/suite/suite-cli.ts +18 -8
- package/src/suite/suite-cpu-preload.ts +10 -6
- package/src/trace/tracer.ts +4 -5
- package/src/trailer/build.ts +30 -15
- package/src/trailer/ffmpeg.ts +90 -31
- package/src/trailer/fonts.ts +5 -6
- package/src/trailer/footage.ts +9 -3
- package/src/trailer/grammar.ts +2 -1
- package/src/trailer/graph.ts +12 -10
- package/src/trailer/load-unit.ts +1 -1
- package/src/trailer/passage.ts +4 -3
- package/src/trailer/prune.ts +4 -4
- package/src/trailer/score/sound.ts +3 -3
- package/src/trailer/shot-plan.ts +5 -5
- package/src/trailer/shot-state.ts +25 -31
- package/src/trailer/sound/eleven.ts +2 -1
- package/src/trailer/sound/gen.ts +3 -3
- package/src/trailer/sound/run.ts +76 -64
- package/src/trailer/sound/takes.ts +0 -3
- package/src/trailer/take-fault.ts +41 -0
- package/src/trailer/titles.ts +17 -13
- package/src/trailer/url.ts +1 -1
- package/src/trailer/vertical-draw.ts +7 -7
- package/src/trailer/vertical.ts +3 -3
- package/src/trailer/vocab.ts +3 -4
- package/src/ts/config.ts +60 -24
- package/src/ts/cycles.ts +3 -1
- package/src/ts/imports.ts +17 -3
- package/src/ts/rename.ts +6 -7
- package/src/ts/source-graph.ts +15 -9
- package/src/ts/workspaces.ts +26 -0
- package/src/tui/build-steps-panel.ts +3 -3
- package/src/tui/checks-panel.ts +2 -2
- package/src/urls/frame.ts +3 -3
- package/src/urls/routes.ts +1 -1
- package/src/urls/rows.ts +1 -1
- package/src/vault/house-keys.ts +1 -1
- package/src/vault/vault-audit.ts +2 -3
- package/src/vault/vault-config.ts +6 -2
- package/src/vault/vault-restore.ts +3 -9
- package/src/vault/vault-serve.ts +47 -11
- package/src/vault/vault-snapshot.ts +5 -14
- package/src/veille/desk.ts +2 -2
- package/src/veille/routes.ts +1 -1
- package/src/view3d/cam.ts +101 -0
- package/src/view3d/lib.ts +69 -0
- package/src/view3d/loop.ts +39 -0
- package/src/view3d/scene-cache.ts +62 -0
- package/src/view3d/viewer.ts +480 -0
- package/src/wiki/agent-paths.ts +55 -0
- package/src/wiki/run-wiki.ts +4 -1
- package/src/wiki/serve-graph.ts +2 -3
- package/src/core/run-fix.ts +0 -120
- package/src/home/hmr-keep.ts +0 -134
- package/src/serve/hub-app/review/draft-card.tsx +0 -163
- package/src/serve/hub-app/review/note-place.ts +0 -31
- /package/src/{serve → http}/door-names.ts +0 -0
- /package/src/{serve → http}/hub-port.ts +0 -0
package/src/home/supervise.ts
CHANGED
|
@@ -135,6 +135,12 @@ function writePid(key: string, r: PidRecord): void {
|
|
|
135
135
|
machineSet(pidRow(key), r)
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/** a running image hands its place to the next image it started (home/handover.ts): the record names it, and the
|
|
139
|
+
* supervisor adopts it once the running pid is gone */
|
|
140
|
+
export function handPid(key: string, pid: number, cmd: string[], now = Date.now()): void {
|
|
141
|
+
writePid(key, { pid, cmd, at: now })
|
|
142
|
+
}
|
|
143
|
+
|
|
138
144
|
const dropPid = (key: string): void => {
|
|
139
145
|
machineDelete(pidRow(key))
|
|
140
146
|
try { rmSync(key, { force: true }) } catch { /* an older copy's file, gone either way */ }
|
|
@@ -288,9 +294,27 @@ export class Proc {
|
|
|
288
294
|
dropPid(this.spec.pidKey)
|
|
289
295
|
}
|
|
290
296
|
|
|
297
|
+
/** the live pid the record names in place of a pid that is gone: the next image it handed its place to
|
|
298
|
+
* (handPid), started before the record was written, never a stranger that reused a pid */
|
|
299
|
+
private handedTo(): number | null {
|
|
300
|
+
const rec = readPid(this.spec.pidKey)
|
|
301
|
+
if (rec == null || rec.pid === this.pid || !this.d.alive(rec.pid)) return null
|
|
302
|
+
const at = this.d.startedAt?.(rec.pid) ?? null
|
|
303
|
+
return (at ?? 0) > rec.at + RECORD_SLACK_MS ? null : rec.pid
|
|
304
|
+
}
|
|
305
|
+
|
|
291
306
|
/** one look at the world: the pid, the probe, a due restart or kill */
|
|
292
307
|
async tick(): Promise<void> {
|
|
293
308
|
const now = this.d.now()
|
|
309
|
+
const next = this.pid != null && !this.d.alive(this.pid) && this.want === 'up' && !this.again && this.status !== 'stopping' ? this.handedTo() : null
|
|
310
|
+
if (next != null) {
|
|
311
|
+
this.spec.say?.(`ok: ${this.spec.id} (pid ${this.pid}) handed its place to pid ${next}: adopted`)
|
|
312
|
+
this.pid = next
|
|
313
|
+
this.started = { pid: next, at: this.d.startedAt?.(next) ?? null }
|
|
314
|
+
this.adopted = true
|
|
315
|
+
this.hung = null
|
|
316
|
+
this.set('starting')
|
|
317
|
+
}
|
|
294
318
|
if (this.pid != null && !this.d.alive(this.pid)) {
|
|
295
319
|
this.gone()
|
|
296
320
|
const hung = this.hung
|
|
@@ -24,7 +24,6 @@ export type RepoTime = { repo: string; sessions: number; subagents: number; call
|
|
|
24
24
|
/** a kind of read: the model time of the turns that issued it, and beside it how long the reads themselves ran */
|
|
25
25
|
export type ReadRow = ReadCost & { runMs: number }
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
export type TimePage = {
|
|
29
28
|
scope: string
|
|
30
29
|
since: Since
|
|
@@ -88,17 +87,6 @@ const MIN_CALLS_FOR_P95 = 5
|
|
|
88
87
|
|
|
89
88
|
/** the wall buckets a bar draws, in the order they are stacked; `idle` and `parked` are left out of every wall */
|
|
90
89
|
export const BUCKETS = ['model', 'tools', 'approval', 'subagent', 'background', 'human', 'unknown'] as const
|
|
91
|
-
export type DrawnBucket = (typeof BUCKETS)[number]
|
|
92
|
-
|
|
93
|
-
export const BUCKET_WORDS: Record<DrawnBucket, { label: string; title: string }> = {
|
|
94
|
-
model: { label: 'model', title: 'its API request in flight: reading its context, thinking, writing the next call' },
|
|
95
|
-
tools: { label: 'tools', title: 'a tool call in flight' },
|
|
96
|
-
approval: { label: 'your allow', title: 'a call waiting for you to allow it' },
|
|
97
|
-
subagent: { label: 'sub-agent wait', title: 'a foreground sub-agent in flight' },
|
|
98
|
-
background: { label: 'background wait', title: 'stopped until a background task woke it' },
|
|
99
|
-
human: { label: 'waiting on you', title: 'stopped until your next prompt, up to 30 minutes' },
|
|
100
|
-
unknown: { label: 'unknown', title: 'stopped, and nothing recorded woke it' },
|
|
101
|
-
}
|
|
102
90
|
|
|
103
91
|
export const wallOf = (b: Breakdown): number => BUCKETS.reduce((n, k) => n + b[k], 0)
|
|
104
92
|
|
|
@@ -134,7 +122,6 @@ export function byRepoOf(rows: readonly SessionRow[], lanes: readonly LaneRepo[]
|
|
|
134
122
|
return [...by.values()].sort((a, b) => wallOf(b.wall) + b.lanes - wallOf(a.wall) - a.lanes)
|
|
135
123
|
}
|
|
136
124
|
|
|
137
|
-
|
|
138
125
|
/** the runs of one kind, cut to what the pages draw */
|
|
139
126
|
function runSetOf(r: TimeReport, kind: RunKind): RunSet {
|
|
140
127
|
const of = (rows: readonly ShapeRow[]): ShapeRow[] => rows.filter((x) => isBgShape(x.shape) === (kind === 'bg'))
|
package/src/home/vault-page.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { existsSync, readdirSync, statSync } from 'fs'
|
|
|
8
8
|
import { homedir } from 'os'
|
|
9
9
|
import { join } from 'path'
|
|
10
10
|
import { scopeText, type Scope, type ScopeChip } from '../core/scope.ts'
|
|
11
|
-
import { ago } from '../hq/machine-notes.ts'
|
|
12
11
|
import { KV_MOUNT } from '../vault/layout.ts'
|
|
13
12
|
import { nameOfPath } from '../vault/vault-client.ts'
|
|
14
13
|
import { SECRET_NAME } from '../secrets/name.ts'
|
|
@@ -27,6 +26,8 @@ export type VaultProcess = { status: string; since: number; want: string; repo:
|
|
|
27
26
|
|
|
28
27
|
/** what the page reads, each one a test replaces */
|
|
29
28
|
import type { VaultReader } from '../hq/vault-route.ts'
|
|
29
|
+
import { dayStamp } from '../core/day-stamp.ts'
|
|
30
|
+
import { ageWords, bytesWords } from '../core/words.ts'
|
|
30
31
|
|
|
31
32
|
export type VaultPageDeps = {
|
|
32
33
|
place: VaultPlace
|
|
@@ -91,7 +92,7 @@ export function comparedOf(raw: unknown, now: number): { keychain: VaultPageDeps
|
|
|
91
92
|
if (held === undefined) return { keychain: null, compared, note: null }
|
|
92
93
|
if (!Array.isArray(held) || held.length > HELD_MAX || !held.every(isName)) return { keychain: null, compared, note: bad }
|
|
93
94
|
const stale = now - at > STALE_MS
|
|
94
|
-
return { keychain: { names: held, at, stale }, compared, note: stale ? { text: `the keychain column is the compare of ${
|
|
95
|
+
return { keychain: { names: held, at, stale }, compared, note: stale ? { text: `the keychain column is the compare of ${ageWords(at, now)}: run sk vault compare`, tone: 'warn' } : null }
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
/** a name's metadata as the vault keeps it: its current version and when it was written */
|
|
@@ -157,11 +158,11 @@ export function intruderWords(text: string): string {
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
/** the audit file's last rotation and the rotated files kept, said after its size */
|
|
160
|
-
const rotationWords = (a: AuditShape | null | undefined, now: number): string => (a == null ? '' : `, rotated ${a.rotatedAt == null ? 'never yet' : `${
|
|
161
|
+
const rotationWords = (a: AuditShape | null | undefined, now: number): string => (a == null ? '' : `, rotated ${a.rotatedAt == null ? 'never yet' : `${ageWords(a.rotatedAt, now)}`}, ${a.files} rotated file${a.files === 1 ? '' : 's'} kept (${bytesWords(a.filesBytes)}), 30 days at most`)
|
|
161
162
|
/** the last rotation's trouble, a WARN, or a DANGER when the vault refuses requests */
|
|
162
|
-
export const auditTrouble = (a: AuditShape | null | undefined, now: number = Date.now()): Fact[] => (a?.last == null || a.last.tone === 'ok' ? [] : [{ text: `the audit file's last rotation, ${
|
|
163
|
+
export const auditTrouble = (a: AuditShape | null | undefined, now: number = Date.now()): Fact[] => (a?.last == null || a.last.tone === 'ok' ? [] : [{ text: `the audit file's last rotation, ${ageWords(a.last.at, now)}: ${a.last.text}`, tone: a.last.tone }])
|
|
163
164
|
/** its audit file, its size and its rotation: names and sizes only, never a line of it read */
|
|
164
|
-
const auditFact = (path: string, a: AuditShape | null | undefined, now: number = Date.now()): Fact => (existsSync(path) ? { text: `its audit file: ${shown(path)}, ${
|
|
165
|
+
const auditFact = (path: string, a: AuditShape | null | undefined, now: number = Date.now()): Fact => (existsSync(path) ? { text: `its audit file: ${shown(path)}, ${bytesWords(statSync(path).size)}${rotationWords(a, now)}`, tone: 'ok' } : { text: `its audit file: ${shown(path)}, not there${rotationWords(a, now)}`, tone: 'warn' })
|
|
165
166
|
|
|
166
167
|
/** how the vault stands, the words `sk vault status` prints, each with its tone */
|
|
167
168
|
export function standFacts(s: VaultStatus): Fact[] {
|
|
@@ -171,7 +172,7 @@ export function standFacts(s: VaultStatus): Fact[] {
|
|
|
171
172
|
if (!s.answers && s.marker != null) out.push({ text: `the vault is initialised on this Mac and does not answer: every reader is on the keychain's old copy. Type: sk gp start vault${s.destroyLeft ? ' (a destroy was killed half way: its next run cleans its folder)' : ''}`, tone: 'danger' })
|
|
172
173
|
if (s.answers && s.initialised && s.sealed && s.marker != null) out.push({ text: 'the vault is sealed: every read on this Mac falls back to its keychain, which may be stale. Type: sk gp restart vault', tone: 'danger' })
|
|
173
174
|
if ((s.rootTokens ?? 0) > 0) out.push({ text: `${s.rootTokens} root token${s.rootTokens === 1 ? '' : 's'} alive, held by no act (a destroy or a restore killed after it made one): sk vault revoke-roots`, tone: 'danger' })
|
|
174
|
-
out.push(s.marker == null ? { text: 'sk vault init has not run on this machine', tone: 'dim' } : { text: `initialised ${s.marker.at
|
|
175
|
+
out.push(s.marker == null ? { text: 'sk vault init has not run on this machine', tone: 'dim' } : { text: `initialised ${dayStamp(new Date(s.marker.at))} on ${s.marker.machine}, seal key ${s.marker.keyId}`, tone: 'ok' })
|
|
175
176
|
if (s.marker != null) out.push(typeof s.marker.auditPath === 'string' ? auditFact(s.marker.auditPath, s.auditRotation) : { text: 'its audit file is not recorded in its marker: sk vault narrow records it (a move of the home waits on it)', tone: 'warn' })
|
|
176
177
|
out.push({ text: `seal key in the login keychain: ${s.sealKey === 'here' ? 'yes' : s.sealKey === 'absent' ? 'no' : s.sealKey}`, tone: s.sealKey === 'here' ? 'ok' : s.marker == null || s.sealKey === SEAL_NOT_LOOKED ? 'dim' : 'danger' })
|
|
177
178
|
if (s.audit != null) out.push({ text: `audit file: ${s.audit ? 'on' : 'OFF'}`, tone: s.audit ? 'ok' : 'danger' })
|
|
@@ -201,7 +202,6 @@ function folderBytes(dir: string): number | null {
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
export const sizeWords = (n: number): string => (n < 1e3 ? `${n} B` : n < 1e6 ? `${(n / 1e3).toFixed(0)} kB` : n < 1e9 ? `${(n / 1e6).toFixed(1)} MB` : `${(n / 1e9).toFixed(2)} GB`)
|
|
205
205
|
|
|
206
206
|
/** a scope's folder of a vault path as the scope it files: `all`, `repo/<key with ~>`, `identity/x`, `machine/x` */
|
|
207
207
|
export function scopeOfPath(path: string): Scope {
|
|
@@ -224,7 +224,7 @@ function livesFacts(d: VaultPageDeps, s: VaultStatus, proc: VaultProcess): Fact[
|
|
|
224
224
|
const p = d.place
|
|
225
225
|
const out: Fact[] = [{ text: `its address: ${vaultUrl(p)}, this Mac's loopback only (raft on 127.0.0.1:${p.clusterPort})`, tone: 'ok' }]
|
|
226
226
|
const bytes = folderBytes(dataDir(p))
|
|
227
|
-
out.push({ text: `its data: ${shown(dataDir(p))}${bytes == null ? ', not on this disk' : `, ${
|
|
227
|
+
out.push({ text: `its data: ${shown(dataDir(p))}${bytes == null ? ', not on this disk' : `, ${bytesWords(bytes)}`}`, tone: bytes == null ? 'dim' : 'ok' })
|
|
228
228
|
try {
|
|
229
229
|
const mode = statSync(p.dir).mode & 0o777
|
|
230
230
|
out.push({ text: `its folder: ${shown(p.dir)}, mode ${mode.toString(8).padStart(4, '0')}`, tone: (mode & 0o077) === 0 ? 'ok' : 'danger' })
|
|
@@ -233,7 +233,7 @@ function livesFacts(d: VaultPageDeps, s: VaultStatus, proc: VaultProcess): Fact[
|
|
|
233
233
|
}
|
|
234
234
|
out.push({ text: `its config: ${shown(configFile(p))}${existsSync(configFile(p)) ? '' : ', not written yet'}`, tone: 'ok' })
|
|
235
235
|
if (s.marker != null) out.push({ text: `its binary: OpenBao ${s.marker.bao} at ${s.marker.baoPath}, the one sk vault serve starts`, tone: s.version !== '' && s.version !== s.marker.bao ? 'warn' : 'ok' })
|
|
236
|
-
out.push(proc == null ? { text: 'kept up by pm as the global process vault: pm does not answer', tone: 'warn' } : { text: `kept up by pm as the global process vault (declared by ${proc.repo}): ${proc.status}${proc.since > 0 ? ` for ${
|
|
236
|
+
out.push(proc == null ? { text: 'kept up by pm as the global process vault: pm does not answer', tone: 'warn' } : { text: `kept up by pm as the global process vault (declared by ${proc.repo}): ${proc.status}${proc.since > 0 ? ` for ${ageWords(proc.since, d.now, { short: true })}` : ''}${proc.want === 'down' ? ', stopped by hand' : ''}`, tone: proc.status === 'up' ? 'ok' : s.marker == null ? 'dim' : 'danger', process: { repo: proc.repo, id: PROCESS.id } })
|
|
237
237
|
const seal = s.sealKey === 'here' ? ' (there)' : s.sealKey === SEAL_NOT_LOOKED ? '' : ' (not there)'
|
|
238
238
|
out.push({ text: `the seal key: the login keychain of this Mac${seal}, and your password manager`, tone: seal !== ' (not there)' || s.marker == null ? 'ok' : 'danger' })
|
|
239
239
|
out.push({ text: 'the recovery key: your password manager only, never on this Mac', tone: 'ok' })
|
|
@@ -243,7 +243,7 @@ function livesFacts(d: VaultPageDeps, s: VaultStatus, proc: VaultProcess): Fact[
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
/** the keychain against the vault, as sk vault compare last found it: how it stands, not where it lives */
|
|
246
|
-
const comparedFact = (d: VaultPageDeps): Fact | null => (d.compared == null ? null : { text: `the keychain against the vault, ${
|
|
246
|
+
const comparedFact = (d: VaultPageDeps): Fact | null => (d.compared == null ? null : { text: `the keychain against the vault, ${ageWords(d.compared.at, d.now)}: ${d.compared.same} same, ${d.compared.differs} differ, ${d.compared.absent} absent from the vault (sk vault compare)`, tone: d.compared.differs > 0 ? 'warn' : 'ok' })
|
|
247
247
|
|
|
248
248
|
/** its copies: the sealed snapshots beside it and in the Space, their proofs, the prune, the second place */
|
|
249
249
|
function copiesFacts(d: VaultPageDeps, stamp: string | null): Fact[] {
|
|
@@ -260,7 +260,7 @@ function copiesFacts(d: VaultPageDeps, stamp: string | null): Fact[] {
|
|
|
260
260
|
// none taken yet
|
|
261
261
|
}
|
|
262
262
|
const newest = near.at(-1)
|
|
263
|
-
out.push({ text: newest == null ? 'no snapshot beside the vault yet' : `${near.length} beside the vault (${shown(snapshotsDir(d.place))}), the newest ${newest}, ${
|
|
263
|
+
out.push({ text: newest == null ? 'no snapshot beside the vault yet' : `${near.length} beside the vault (${shown(snapshotsDir(d.place))}), the newest ${newest}, ${bytesWords(statSync(join(snapshotsDir(d.place), newest)).size)}`, tone: 'ok' })
|
|
264
264
|
out.push(d.pruneOn ? { text: 'the prune of old snapshots: ON, the daily tick deletes those older than 30 days from the Space for good (sk vault snapshot --prune off)', tone: 'warn' } : { text: 'the prune of old snapshots: off, nothing leaves the Space', tone: 'ok' })
|
|
265
265
|
out.push({ text: d.copyConfigured ? 'the second place: named in the house config, each snapshot goes there too' : 'the second place: none named in the house config', tone: d.copyConfigured ? 'ok' : 'dim' })
|
|
266
266
|
out.push({ text: 'to prove the dead disk way again, in your own Terminal: sk vault snapshot --prove --from-space --recovery', tone: 'dim' })
|
|
@@ -274,7 +274,7 @@ async function secretRows(d: VaultPageDeps, versions: Map<string, Meta> | null,
|
|
|
274
274
|
if ((d.notes ?? []).length > 0) {
|
|
275
275
|
// the compare record said what it is
|
|
276
276
|
} else if (d.keychain == null) notes.push({ text: here ? 'the keychain column is not read: the page never reads this Mac\'s keychain; sk vault compare records the names it holds' : 'this Mac\'s keychain is not read by the page: sk secret list says what it holds', tone: 'dim' })
|
|
277
|
-
else notes.push({ text: `the keychain column: the names sk vault compare found ${
|
|
277
|
+
else notes.push({ text: `the keychain column: the names sk vault compare found ${ageWords(d.keychain.at, d.now)}`, tone: 'dim' })
|
|
278
278
|
const byPath = new Map<string, string>()
|
|
279
279
|
for (const path of versions?.keys() ?? []) {
|
|
280
280
|
const name = nameOfPath(path)
|
|
@@ -345,7 +345,7 @@ export async function vaultPage(d: VaultPageDeps): Promise<VaultPage> {
|
|
|
345
345
|
const s: VaultStatus = { ...status, ...(status.intruder != null ? { intruder: intruderWords(status.intruder) } : {}) }
|
|
346
346
|
const proc = await d.process()
|
|
347
347
|
const stands = standFacts(s)
|
|
348
|
-
if (proc != null && proc.since > 0 && s.answers) stands.splice(1, 0, { text: `${proc.status} for ${
|
|
348
|
+
if (proc != null && proc.since > 0 && s.answers) stands.splice(1, 0, { text: `${proc.status} for ${ageWords(proc.since, d.now, { short: true })}, as pm counts it`, tone: proc.status === 'up' ? 'ok' : 'warn' })
|
|
349
349
|
if (d.keychainOnly) stands.push({ text: 'SHIPKIT_SECRET_KEYCHAIN_ONLY=1 in this daemon: its reads skip the vault for the keychain', tone: 'danger' })
|
|
350
350
|
let versions: Map<string, Meta> | null = null
|
|
351
351
|
let why: string | null = null
|
|
@@ -375,7 +375,7 @@ async function readerFacts(d: VaultPageDeps): Promise<Fact[]> {
|
|
|
375
375
|
if (rs == null) return [{ text: 'its readers on other Macs: not read, the daemon does not answer', tone: 'warn' }]
|
|
376
376
|
if (rs.length === 0) return [{ text: 'its readers on other Macs: none bound, so nobody reads it through the hq\'s vault route', tone: 'dim' }]
|
|
377
377
|
return rs.map((r) => ({
|
|
378
|
-
text: `its reader ${r.machine}: from the tailnet device ${r.device} (${r.os}), bound ${new Date(r.bound)
|
|
378
|
+
text: `its reader ${r.machine}: from the tailnet device ${r.device} (${r.os}), bound ${dayStamp(new Date(r.bound))}, ${r.readAt == null ? 'no read yet' : `last read ${ageWords(r.readAt, d.now)}`}${r.minted == null ? ', no live token' : `, its token minted ${ageWords(r.minted, d.now)}`}`,
|
|
379
379
|
tone: 'ok' as const,
|
|
380
380
|
}))
|
|
381
381
|
}
|
|
@@ -469,7 +469,7 @@ function keysOnce(root: string, read: (root: string) => Promise<Map<string, impo
|
|
|
469
469
|
|
|
470
470
|
/** the open credential asks of every house repo, by the names they store; a repo with no store is not made one */
|
|
471
471
|
async function houseAsks(root: string): Promise<AskOf[]> {
|
|
472
|
-
const [{ houseRepos }, { asksOfRepo }] = await Promise.all([import('../
|
|
472
|
+
const [{ houseRepos }, { asksOfRepo }] = await Promise.all([import('../house/project-gutter.ts'), import('../asks/ask-store.ts')])
|
|
473
473
|
return houseRepos(root, homedir()).repos.flatMap((r) => {
|
|
474
474
|
try {
|
|
475
475
|
return asksOfRepo(r.path)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// the vault page's « show » (wiki tools/shipkit/home-pages.md, Read a secret): one secret's value, to the owner's click
|
|
2
|
+
// on this Mac's own browser, read as a repo in the name's scope. The one constraint a reader breaks first: the value is
|
|
3
|
+
// the answer's body and nothing else holds it: never a log line, a thrown message, a url, a store or a thread; a
|
|
4
|
+
// refusal and a miss answer fixed words that never quote what the store said
|
|
5
|
+
import { SECRET_NAME } from '../secrets/name.ts'
|
|
6
|
+
import { readSecretHere } from '../secrets/read.ts'
|
|
7
|
+
import { terminalRefusal } from '../serve/terminal-guard.ts'
|
|
8
|
+
|
|
9
|
+
const NO_STORE = { 'cache-control': 'no-store', 'content-type': 'text/plain; charset=utf-8' }
|
|
10
|
+
const say = (text: string, status: number): Response => new Response(text, { status, headers: NO_STORE })
|
|
11
|
+
|
|
12
|
+
/** the answer to a reveal: the gate behind the web (`peer` the connection's address), then the name, then the first
|
|
13
|
+
* read of it as the house, else as a repo in its scope (`roots`, the house first) */
|
|
14
|
+
export async function revealRoute(req: Request, peer: string | null, roots: readonly string[], read: typeof readSecretHere = readSecretHere): Promise<Response> {
|
|
15
|
+
const why = terminalRefusal(req, peer, "a secret's value")
|
|
16
|
+
if (why != null) return say(why, 403)
|
|
17
|
+
// a body that is no json, or holds no name, answers fixed words: it may be anything pasted
|
|
18
|
+
const b = (await req.json().catch(() => null)) as { name?: unknown } | null
|
|
19
|
+
const name = typeof b?.name === 'string' ? b.name : ''
|
|
20
|
+
if (!SECRET_NAME.test(name)) return say('a reveal names one secret: { "name": "<secret name>" }', 400)
|
|
21
|
+
let refused = false
|
|
22
|
+
for (const cwd of roots) {
|
|
23
|
+
const r = await read({ name, cwd, say: () => {} })
|
|
24
|
+
if ('value' in r) return Response.json({ name, value: r.value, from: r.from }, { headers: { 'cache-control': 'no-store' } })
|
|
25
|
+
if ('missing' in r) return say(`${name}: no value is held on this Mac`, 404)
|
|
26
|
+
refused = true
|
|
27
|
+
}
|
|
28
|
+
return say(refused ? `${name}: no house repo may read it (its scope, or an archived name)` : `${name}: no house repo to read it from`, 403)
|
|
29
|
+
}
|
package/src/home/vault-words.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// the vault page's shape and its words, shared by the home page and `sk vault status`: pure and browser safe. The
|
|
2
2
|
// constraint a reader breaks first: nothing here holds or derives a value, only names, scopes, states and dates
|
|
3
3
|
import type { ScopeChip } from '../core/scope.ts'
|
|
4
|
-
import {
|
|
4
|
+
import { ageWords } from '../core/words.ts'
|
|
5
5
|
|
|
6
6
|
export type Tone = 'ok' | 'warn' | 'danger' | 'dim'
|
|
7
7
|
/** one line fact; `process` the global process it names, which the page links to */
|
|
@@ -68,7 +68,7 @@ export function heldOf(r: SecretRow, here: boolean): HeldState {
|
|
|
68
68
|
export function heldWords(r: SecretRow, here: boolean, now: number = Date.now()): { text: string; tone: Tone } {
|
|
69
69
|
const h = heldOf(r, here)
|
|
70
70
|
if (h === 'vault') return { text: 'in the vault', tone: 'ok' }
|
|
71
|
-
const age = r.keychainStale && r.keychainAt != null ? `, ${
|
|
71
|
+
const age = r.keychainStale && r.keychainAt != null ? `, ${ageWords(r.keychainAt, now)}` : ''
|
|
72
72
|
if (h === 'keychain') return here ? { text: `only in the keychain${age}`, tone: 'warn' } : { text: `in the keychain${age}`, tone: age === '' ? 'ok' : 'warn' }
|
|
73
73
|
if (h === 'unknown') return { text: 'not read', tone: 'dim' }
|
|
74
74
|
if (h === 'absent') return { text: 'not in the vault', tone: 'warn' }
|
|
@@ -82,7 +82,7 @@ const day = (at: number): string => {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/** how long ago its current version was written, the table's cell: the day is its hover */
|
|
85
|
-
export const writtenShort = (r: SecretRow, now: number): string => (r.written == null ? '' : `${
|
|
85
|
+
export const writtenShort = (r: SecretRow, now: number): string => (r.written == null ? '' : `${ageWords(r.written, now)}${r.version != null && r.version > 1 ? `, v${r.version}` : ''}`)
|
|
86
86
|
|
|
87
87
|
/** when its current version was written, and how long ago */
|
|
88
88
|
export const writtenWords = (r: SecretRow, now: number): string => (r.written == null ? '' : `${day(r.written)}, ${writtenShort(r, now)}`)
|
package/src/home/via-hub.ts
CHANGED
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
// the one constraint a reader breaks first: a process the home itself started
|
|
10
10
|
// (a check's child, a script calling shipkit) runs in process. Sending it back
|
|
11
11
|
// would queue it behind the very run that spawned it.
|
|
12
|
-
import { basename } from 'path'
|
|
13
12
|
import { isLinkedWorktree } from '../core/git-root.ts'
|
|
14
13
|
import { SLOT_HELD_ENV } from '../core/slots.ts'
|
|
15
|
-
import { homeRepo } from '../
|
|
14
|
+
import { homeRepo, hubNameOf } from '../house/project-gutter.ts'
|
|
16
15
|
import { daemonUp, daemonUrl, hubBase, WORKER_ENV } from './home-paths.ts'
|
|
17
16
|
import { homeWanted, startHome } from './home-start.ts'
|
|
18
17
|
import { RUN_EXIT, RUN_JOB } from './home-words.ts'
|
|
19
|
-
import { followJob, type FollowOpts } from '../
|
|
18
|
+
import { followJob, type FollowOpts } from '../gate/job-follow.ts'
|
|
20
19
|
import { TRACE_ENV } from '../trace/tracer.ts'
|
|
21
20
|
import { FRESH_ENV } from '../ledger/store.ts'
|
|
22
21
|
import { LEDGER_ENV } from '../ledger/ledger.ts'
|
|
@@ -49,7 +48,7 @@ export function runsHere(root: string, env: Env = process.env, wanted: (env: Env
|
|
|
49
48
|
* reached is a loud failure, never a quiet run elsewhere */
|
|
50
49
|
export async function runViaHub(root: string, kind: 'ci' | 'check', opts: Record<string, unknown>, io: RunIo): Promise<number | null> {
|
|
51
50
|
if (runsHere(root) != null) return null
|
|
52
|
-
const name =
|
|
51
|
+
const name = hubNameOf(root)
|
|
53
52
|
try {
|
|
54
53
|
if (!(await daemonUp())) await startHome()
|
|
55
54
|
} catch (e) {
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// the lane worktrees a repo no longer needs (wiki tools/shipkit/home-daemon-loop.md, the job worktrees): a checkout under
|
|
2
|
+
// `.claude/worktrees/` goes once it is clean, its commits are in the main branch, nothing uses it and it sat idle.
|
|
3
|
+
// The daemon's job `worktrees` runs it hourly over the house repos, `sk worktrees tidy` at once after a merge.
|
|
4
|
+
//
|
|
5
|
+
// the one constraint a reader breaks first: only git removes, and only the way that refuses. `git worktree remove`
|
|
6
|
+
// with no --force, `git branch -d` never -D. git deletes a worktree's ignored files with it, unasked: so any ignored
|
|
7
|
+
// file outside DISPOSABLE keeps the worktree, and a check here that misjudges leaves a worktree, never loses work
|
|
8
|
+
import { closeSync, existsSync, openSync, readdirSync, readFileSync, readlinkSync, readSync, realpathSync, rmSync, statSync } from 'node:fs'
|
|
9
|
+
import { basename, join, resolve } from 'node:path'
|
|
10
|
+
import { realGit, type GitIo } from '../core/git.ts'
|
|
11
|
+
import { commitsNotIn } from '../core/in-base.ts'
|
|
12
|
+
import { LANE_IDLE_MS, laneRunning } from '../agent-time/registry.ts'
|
|
13
|
+
import { listTranscripts } from '../agent-time/store.ts'
|
|
14
|
+
import { discoverConfigRoots } from '../reflect/prompt-corpus.ts'
|
|
15
|
+
import { liveUse } from './machine-temp.ts'
|
|
16
|
+
|
|
17
|
+
export const LANE_WORKTREES = '.claude/worktrees'
|
|
18
|
+
/** the ignored files a worktree may lose: what an install, a gate or a scratch makes again. Anything else ignored (a
|
|
19
|
+
* review, a reflection, a local secret, a build output) keeps it */
|
|
20
|
+
export const DISPOSABLE: readonly RegExp[] = [/(^|\/)node_modules(\/|$)/, /^\.shipkit\/(tmp|cache)(\/|$)/, /^\.shipkit\/STATUS[^/]*\.md$/, /(^|\/)\.DS_Store$/]
|
|
21
|
+
|
|
22
|
+
/** a worktree nothing touched for this long is idle: the daemon's wait */
|
|
23
|
+
export const WORKTREE_IDLE_MS = 24 * 3_600_000
|
|
24
|
+
|
|
25
|
+
/** what the machine says of a worktree: why something live uses it (else null), and its last act an agent wrote */
|
|
26
|
+
export interface Probe {
|
|
27
|
+
held: (path: string) => string | null
|
|
28
|
+
lastAct: (path: string) => number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TidyOptions {
|
|
32
|
+
now?: number
|
|
33
|
+
/** name what would go, remove nothing */
|
|
34
|
+
dry?: boolean
|
|
35
|
+
/** the idle wait; 0 right after a merge, where the orchestrator knows the lane ended */
|
|
36
|
+
idleMs?: number
|
|
37
|
+
/** only these worktrees (their paths as git lists them), not every one of the repos */
|
|
38
|
+
only?: ReadonlySet<string>
|
|
39
|
+
/** the live processes and agents, read once and only when a worktree passed every git check; null when they
|
|
40
|
+
* cannot be read, and then nothing goes */
|
|
41
|
+
use?: (worktrees: string[], now: number) => Probe | null
|
|
42
|
+
/** the user's home: its transcripts, its bun links and bun's cache */
|
|
43
|
+
home: string
|
|
44
|
+
print: (l: string) => void
|
|
45
|
+
printErr?: (l: string) => void
|
|
46
|
+
/** the git every question and removal goes through: the door by default */
|
|
47
|
+
git?: GitIo
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Verdict {
|
|
51
|
+
repo: string
|
|
52
|
+
path: string
|
|
53
|
+
branch: string | null
|
|
54
|
+
go: boolean
|
|
55
|
+
/** removed (false on --dry, or when git refused) */
|
|
56
|
+
done: boolean
|
|
57
|
+
why: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type Listed = { path: string; head: string; branch: string | null; locked: boolean; prunable: boolean }
|
|
61
|
+
|
|
62
|
+
const run = (cwd: string, args: string[], git: GitIo = realGit): { code: number; out: string } => {
|
|
63
|
+
const r = git.runSync(cwd, ['--no-optional-locks', ...args])
|
|
64
|
+
return { code: r.code, out: `${r.out}${r.code === 0 ? '' : r.err}`.trim() }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** the repo's main checkout and its worktrees under `.claude/worktrees/`, from any of its checkouts */
|
|
68
|
+
export function laneWorktrees(dir: string, git: GitIo = realGit): { main: string; trees: Listed[] } | null {
|
|
69
|
+
const r = run(dir, ['worktree', 'list', '--porcelain'], git)
|
|
70
|
+
if (r.code !== 0) return null
|
|
71
|
+
const all = r.out.split('\n\n').map((b): Listed => {
|
|
72
|
+
const l = b.split('\n')
|
|
73
|
+
const val = (k: string): string | null => l.find((x) => x === k || x.startsWith(`${k} `))?.slice(k.length + 1) ?? null
|
|
74
|
+
const ref = val('branch')
|
|
75
|
+
return { path: val('worktree') ?? '', head: val('HEAD') ?? '', branch: ref?.replace(/^refs\/heads\//, '') ?? null, locked: val('locked') != null, prunable: val('prunable') != null }
|
|
76
|
+
})
|
|
77
|
+
const main = all[0]?.path
|
|
78
|
+
if (main == null || main === '') return null
|
|
79
|
+
const under = join(main, LANE_WORKTREES) + '/'
|
|
80
|
+
return { main, trees: all.slice(1).filter((t) => t.path.startsWith(under)) }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const mainBranchOf = (main: string, git: GitIo): string | null => ['main', 'master'].find((b) => run(main, ['rev-parse', '--verify', '-q', `refs/heads/${b}`], git).code === 0) ?? null
|
|
84
|
+
|
|
85
|
+
const ago = (ms: number): string => (ms >= 2 * 86_400_000 ? `${Math.floor(ms / 86_400_000)} d` : ms >= 3_600_000 ? `${Math.floor(ms / 3_600_000)} h` : `${Math.max(0, Math.floor(ms / 60_000))} min`)
|
|
86
|
+
|
|
87
|
+
/** the git side of a worktree: why it stays, or what makes it safe to remove and when it last moved */
|
|
88
|
+
function judge(main: string, mainBranch: string, t: Listed, git: GitIo): { stay: string } | { safe: string; at: number } {
|
|
89
|
+
if (t.locked) return { stay: 'locked' }
|
|
90
|
+
if (t.prunable || !existsSync(t.path)) return { stay: 'its folder is gone: git worktree prune is the owner\'s' }
|
|
91
|
+
// the untracked mode named, never the repo's status.showUntrackedFiles: `no` there would hide a new file
|
|
92
|
+
const st = run(t.path, ['status', '--porcelain', '--ignored', '--untracked-files=normal'], git)
|
|
93
|
+
if (st.code !== 0) return { stay: `git status failed: ${st.out.split('\n')[0]}` }
|
|
94
|
+
const lines = st.out === '' ? [] : st.out.split('\n')
|
|
95
|
+
const n = lines.filter((l) => !l.startsWith('!! ')).length
|
|
96
|
+
if (n > 0) return { stay: `${n} change${n === 1 ? '' : 's'} not committed` }
|
|
97
|
+
const kept = lines.map((l) => l.slice(3).replace(/^"|"$/g, '')).filter((f) => !DISPOSABLE.some((d) => d.test(f)))
|
|
98
|
+
if (kept.length > 0) return { stay: `ignored files git would delete with it: ${kept.slice(0, 3).join(', ')}${kept.length > 3 ? ` and ${kept.length - 3} more` : ''}` }
|
|
99
|
+
const not = commitsNotIn(main, mainBranch, t.branch ?? t.head, git)
|
|
100
|
+
if ('error' in not) return { stay: not.error }
|
|
101
|
+
if (not.left > 0) return { stay: `${not.left} commit${not.left === 1 ? '' : 's'} not in ${mainBranch}` }
|
|
102
|
+
const safe = not.ahead > 0 ? `every commit patch equivalent in ${mainBranch}` : `its commits are all in ${mainBranch}`
|
|
103
|
+
// when it last moved: its HEAD, index and reflog (a commit writes it) in its git dir, named by its `.git` file
|
|
104
|
+
let gitDir = ''
|
|
105
|
+
try { gitDir = resolve(t.path, /^gitdir: (.*)$/m.exec(readFileSync(join(t.path, '.git'), 'utf8'))?.[1] ?? '') } catch {}
|
|
106
|
+
if (gitDir === '') return { stay: 'its .git file names no git dir' }
|
|
107
|
+
const times = [join(gitDir, 'HEAD'), join(gitDir, 'index'), join(gitDir, 'logs', 'HEAD'), t.path].map((p) => { try { return statSync(p).mtimeMs } catch { return 0 } })
|
|
108
|
+
return { safe, at: Math.max(...times) }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** every lane worktree of these repos judged, and removed unless dry; each removal said in one line */
|
|
112
|
+
export async function tidyWorktrees(repos: readonly string[], o: TidyOptions): Promise<Verdict[]> {
|
|
113
|
+
const now = o.now ?? Date.now()
|
|
114
|
+
const idle = o.idleMs ?? WORKTREE_IDLE_MS
|
|
115
|
+
const git = o.git ?? realGit
|
|
116
|
+
const out: Verdict[] = []
|
|
117
|
+
const passed: { v: Verdict; at: number; safe: string; main: string }[] = []
|
|
118
|
+
const seen = new Set<string>()
|
|
119
|
+
for (const repo of repos) {
|
|
120
|
+
const l = laneWorktrees(repo, git)
|
|
121
|
+
if (l == null || seen.has(l.main)) continue
|
|
122
|
+
seen.add(l.main)
|
|
123
|
+
if (l.trees.length === 0) continue
|
|
124
|
+
const mainBranch = mainBranchOf(l.main, git)
|
|
125
|
+
for (const t of l.trees.filter((x) => o.only == null || o.only.has(realOf(x.path)))) {
|
|
126
|
+
const v: Verdict = { repo: l.main, path: t.path, branch: t.branch, go: false, done: false, why: '' }
|
|
127
|
+
out.push(v)
|
|
128
|
+
const j = mainBranch == null ? { stay: 'the repo has no main or master branch' } : judge(l.main, mainBranch, t, git)
|
|
129
|
+
if ('stay' in j) v.why = j.stay
|
|
130
|
+
else passed.push({ v, at: j.at, safe: j.safe, main: l.main })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (passed.length === 0) return out
|
|
134
|
+
const use = (o.use ?? liveWorktreeUse(o.home))(passed.map((p) => p.v.path), now)
|
|
135
|
+
let removed = 0
|
|
136
|
+
for (const p of passed) {
|
|
137
|
+
const { v } = p
|
|
138
|
+
const held = use == null ? 'the live processes cannot be read' : use.held(v.path)
|
|
139
|
+
if (held != null || use == null) { v.why = held ?? ''; continue }
|
|
140
|
+
const at = Math.max(p.at, use.lastAct(v.path))
|
|
141
|
+
if (now - at < idle) { v.why = `active ${ago(now - at)} ago, idle ${ago(idle)} first`; continue }
|
|
142
|
+
v.go = true
|
|
143
|
+
v.why = p.safe
|
|
144
|
+
const name = `${basename(v.repo)}/${LANE_WORKTREES}/${v.path.slice(join(v.repo, LANE_WORKTREES).length + 1)}`
|
|
145
|
+
const says = `${v.why}, idle ${ago(now - at)}`
|
|
146
|
+
if (o.dry === true) { o.print(`would remove ${name}: ${says}${v.branch ? `, then its branch ${v.branch}` : ''}`); continue }
|
|
147
|
+
const rm = run(v.repo, ['worktree', 'remove', v.path], git)
|
|
148
|
+
if (rm.code !== 0) {
|
|
149
|
+
v.why = `git worktree remove refused: ${rm.out.split('\n')[0]}`
|
|
150
|
+
;(o.printErr ?? o.print)(`WARN worktree tidy: ${name} stays, ${v.why}`)
|
|
151
|
+
continue
|
|
152
|
+
}
|
|
153
|
+
v.done = true
|
|
154
|
+
removed++
|
|
155
|
+
let branch = ''
|
|
156
|
+
if (v.branch != null) {
|
|
157
|
+
const b = run(v.repo, ['branch', '-d', v.branch], git)
|
|
158
|
+
branch = b.code === 0 ? `; branch ${v.branch} deleted` : `; branch ${v.branch} kept: git branch -d refused (${b.out.split('\n')[0]})`
|
|
159
|
+
}
|
|
160
|
+
o.print(`ok: worktree tidy: removed ${name}: ${says}${branch}`)
|
|
161
|
+
}
|
|
162
|
+
// bun's transpiler cache keys a file by its bytes: a file of the main checkout identical to one of a removed
|
|
163
|
+
// worktree comes back with its imports resolved into the gone tree (wiki patterns/typescript/index.md, Toolchain)
|
|
164
|
+
if (removed > 0 && process.platform === 'darwin') rmSync(join(o.home, 'Library/Caches/bun/@t@'), { recursive: true, force: true })
|
|
165
|
+
return out
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** a path as the disk resolves it, else as given */
|
|
169
|
+
export const realOf = (p: string): string => { try { return realpathSync(p) } catch { return p } }
|
|
170
|
+
|
|
171
|
+
const inside = (p: string, dir: string): boolean => p === dir || p.startsWith(`${dir}/`)
|
|
172
|
+
|
|
173
|
+
/** the cwd lines of a transcript: its first agent's folder and where its last lines worked */
|
|
174
|
+
function cwdsOf(path: string): string[] {
|
|
175
|
+
try {
|
|
176
|
+
const size = statSync(path).size
|
|
177
|
+
const fd = openSync(path, 'r')
|
|
178
|
+
try {
|
|
179
|
+
const read = (at: number, len: number): string => {
|
|
180
|
+
const buf = Buffer.alloc(len)
|
|
181
|
+
return buf.subarray(0, readSync(fd, buf, 0, len, at)).toString('utf8')
|
|
182
|
+
}
|
|
183
|
+
const head = read(0, Math.min(size, 16 * 1024))
|
|
184
|
+
const tail = size > 16 * 1024 ? read(Math.max(16 * 1024, size - 32 * 1024), Math.min(size - 16 * 1024, 32 * 1024)) : ''
|
|
185
|
+
return [...new Set([...`${head}\n${tail}`.matchAll(/"cwd":"([^"]+)"/g)].map((m) => m[1]!))]
|
|
186
|
+
} finally {
|
|
187
|
+
closeSync(fd)
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
return []
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** the transcripts that worked in a folder: the latest one's time, and whether an agent still runs there (its tail is
|
|
195
|
+
* no hand back, nor an ended turn of a lane with no hand back tool, and it wrote within the lanes' idle time) */
|
|
196
|
+
export function transcriptUse(files: readonly { path: string; mtime: number }[], now: number): (path: string) => { at: number; running: boolean } | null {
|
|
197
|
+
const read = files.map((f) => ({ ...f, cwds: cwdsOf(f.path) }))
|
|
198
|
+
return (path) => {
|
|
199
|
+
const there = read.filter((f) => f.cwds.some((c) => inside(c, path)))
|
|
200
|
+
if (there.length === 0) return null
|
|
201
|
+
return { at: Math.max(...there.map((f) => f.mtime)), running: there.some((f) => now - f.mtime < LANE_IDLE_MS && laneRunning(f.path)) }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** the machine's probe: what live processes hold (lsof and ps), a bun link into a worktree, a transcript that still works
|
|
206
|
+
* there. Transcripts written within the idle window are read, so the idle date counts an agent's last act too */
|
|
207
|
+
export function liveWorktreeUse(home: string): NonNullable<TidyOptions['use']> {
|
|
208
|
+
return (worktrees, now) => {
|
|
209
|
+
const roots = [...new Set(worktrees.map((w) => resolve(w, '..')))]
|
|
210
|
+
const procs = liveUse(roots)
|
|
211
|
+
if (procs == null) return null
|
|
212
|
+
const recent = listTranscripts(discoverConfigRoots(home)).filter((f) => now - f.mtime < WORKTREE_IDLE_MS)
|
|
213
|
+
const agents = transcriptUse(recent, now)
|
|
214
|
+
const links = bunLinks(home)
|
|
215
|
+
return {
|
|
216
|
+
held: (path) => {
|
|
217
|
+
if (agents(path)?.running === true) return 'a Claude Code agent still works in it'
|
|
218
|
+
const link = links.find((l) => inside(l.to, path))
|
|
219
|
+
return procs(path) ?? (link == null ? null : `bun link ${link.name} points into it`)
|
|
220
|
+
},
|
|
221
|
+
lastAct: (path) => agents(path)?.at ?? 0,
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** the global bun links: a consumer repo linked to a lib resolves into the folder its link names */
|
|
227
|
+
function bunLinks(home: string): { name: string; to: string }[] {
|
|
228
|
+
const dir = join(home, '.bun/install/global/node_modules')
|
|
229
|
+
let names: string[]
|
|
230
|
+
try { names = readdirSync(dir) } catch { return [] }
|
|
231
|
+
const out: { name: string; to: string }[] = []
|
|
232
|
+
for (const n of names.flatMap((n) => (n.startsWith('@') ? (() => { try { return readdirSync(join(dir, n)).map((s) => `${n}/${s}`) } catch { return [] } })() : [n]))) {
|
|
233
|
+
try { out.push({ name: n, to: resolve(dir, readlinkSync(join(dir, n))) }) } catch { /* not a link */ }
|
|
234
|
+
}
|
|
235
|
+
return out
|
|
236
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// the edit guard's wiring in a repo's settings, pure: SK013 installs it and is a cached check (no fs here), and the
|
|
2
|
+
// shared-file gate reads it
|
|
3
|
+
|
|
4
|
+
/** the matcher the edit guard sees edits under: a hand written persona or value proposition (messages/guard.ts), and
|
|
5
|
+
* each edit noted for the shared-file gate (shared-file.ts); SK013 installs it */
|
|
6
|
+
export const EDIT_MATCHER = 'Edit|Write|MultiEdit'
|
|
7
|
+
|
|
8
|
+
type Settings = { hooks?: Record<string, Array<{ matcher?: string; hooks?: Array<{ command?: string }> }>> }
|
|
9
|
+
|
|
10
|
+
/** the settings run the edit guard on edits: without it no edit is noted, and the gate has nothing to judge */
|
|
11
|
+
export const hasEditGuard = (s: Settings): boolean =>
|
|
12
|
+
(s.hooks?.['PreToolUse'] ?? []).some((m) => m.matcher === EDIT_MATCHER && (m.hooks ?? []).some((h) => h.command?.includes('one-way-in-guard') === true))
|
package/src/hooks/hook-gates.ts
CHANGED
|
@@ -13,11 +13,13 @@ export type HookGate = { id: string; hook: HookName; title: string; description:
|
|
|
13
13
|
|
|
14
14
|
export const HOOK_GATES = [
|
|
15
15
|
{ id: 'tree-shrink', hook: 'pre-commit', title: 'tree shrink', description: 'the commit keeps at least half of the files HEAD tracks' },
|
|
16
|
+
{ id: 'shared-file', hook: 'pre-commit', title: 'shared file', description: 'no staged file holds the hunks of another agent that wrote it since its last commit' },
|
|
16
17
|
{ id: 'leak-guard', hook: 'both', title: 'leak guard', description: 'no staged added line, staged path or commit message matches a banned keyword' },
|
|
17
18
|
{ id: 'blocked-paths', hook: 'pre-commit', title: 'blocked paths', description: 'nothing under a hooks.blockedPaths prefix is staged' },
|
|
18
19
|
{ id: 'root-identity', hook: 'pre-commit', title: 'root identity', description: 'the repo name in package.json and repo.config.ts holds, and no scratch file is staged' },
|
|
19
20
|
{ id: 'commit-message', hook: 'commit-msg', title: 'commit message', description: 'the commit message carries no dash punctuation and no French' },
|
|
20
21
|
{ id: 'commit-language', hook: 'commit-msg', title: 'commit language', description: 'the commit message carries no French, the half of commit-message that off lifts alone' },
|
|
22
|
+
{ id: 'reflection-trailer', hook: 'commit-msg', title: 'reflection trailer', description: 'each Fixes-reflection or Declines-reflection line names an open reflection; post-commit closes it' },
|
|
21
23
|
] as const satisfies readonly HookGate[]
|
|
22
24
|
|
|
23
25
|
export type HookGateId = (typeof HOOK_GATES)[number]['id']
|
package/src/hooks/leak-guard.ts
CHANGED
|
@@ -84,8 +84,13 @@ export type ParsedPatterns = {
|
|
|
84
84
|
substrings: string[]
|
|
85
85
|
words: { word: string; re: RegExp }[]
|
|
86
86
|
regexes: { row: string; re: RegExp }[]
|
|
87
|
+
/** a `re:` row that does not compile: it scans nothing, so the guard says it, and every other row still runs */
|
|
88
|
+
bad: { row: string; why: string }[]
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
/** the warning line of a bad row, one shape for the commit guard and SK035 */
|
|
92
|
+
export const badRowNote = (b: { row: string; why: string }): string => `a keyword row does not compile, so it scans nothing: ${b.row} (${b.why}); fix it in the keyword file`
|
|
93
|
+
|
|
89
94
|
const escapeRegex = (s: string): string => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
90
95
|
|
|
91
96
|
/** a key shape is a token, so it starts where a token starts: `ask-the-...`
|
|
@@ -140,6 +145,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
140
145
|
const substrings: string[] = []
|
|
141
146
|
const words: { word: string; re: RegExp }[] = []
|
|
142
147
|
const regexes: { row: string; re: RegExp }[] = []
|
|
148
|
+
const bad: { row: string; why: string }[] = []
|
|
143
149
|
for (const raw of text.split('\n')) {
|
|
144
150
|
const row = raw.trim()
|
|
145
151
|
if (row === '' || row.startsWith('#')) continue
|
|
@@ -148,7 +154,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
148
154
|
// name carries); every other regex row is case-insensitive
|
|
149
155
|
const source = SEEDED_ROW_FIXES[row] ?? row
|
|
150
156
|
try { regexes.push({ row, re: new RegExp(source.slice(3), SECRET_ROWS.includes(source) ? '' : 'i') }) }
|
|
151
|
-
catch {
|
|
157
|
+
catch (e) { bad.push({ row, why: e instanceof Error ? e.message : String(e) }) }
|
|
152
158
|
} else if (row.startsWith('w:')) {
|
|
153
159
|
const word = row.slice(2).trim().toLowerCase()
|
|
154
160
|
// \b is ascii-only in JS, which lets an accented name match inside
|
|
@@ -156,7 +162,7 @@ export function parsePatterns(text: string): ParsedPatterns {
|
|
|
156
162
|
if (word !== '') words.push({ word, re: new RegExp(`(?<![\\p{L}\\p{N}_])${escapeRegex(word)}(?![\\p{L}\\p{N}_])`, 'giu') })
|
|
157
163
|
} else substrings.push(row.toLowerCase())
|
|
158
164
|
}
|
|
159
|
-
return { substrings, words, regexes }
|
|
165
|
+
return { substrings, words, regexes, bad }
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
/** the keyword text a scan reads: the built-in secret shapes, then the files' rows */
|
|
@@ -442,7 +448,7 @@ export function runLeakGuard(root: string, o: LeakGuardOpts = {}): LeakGuardResu
|
|
|
442
448
|
const patterns = parsePatterns(withBuiltinRows(sources.map((f) => readFileSync(f, 'utf8'))))
|
|
443
449
|
const count = patterns.substrings.length + patterns.words.length + patterns.regexes.length
|
|
444
450
|
|
|
445
|
-
const notes: string[] =
|
|
451
|
+
const notes: string[] = patterns.bad.map(badRowNote)
|
|
446
452
|
const allow: LoadedAllow[] = []
|
|
447
453
|
;(o.allow ?? []).forEach((e, i) => {
|
|
448
454
|
const problem = leakAllowProblem(e, `repo.config.ts hooks.leakAllow[${i}]`, true)
|