rvlib-shipkit 2.26.0 → 2.28.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 +36 -0
- package/package.json +1 -1
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +16 -7
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +12 -8
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/render.ts +122 -21
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +314 -40
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +322 -101
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +29 -17
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +44 -0
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +361 -14
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/check.ts +3 -1
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +20 -9
- package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +244 -27
- package/src/cli/cmd_Backup.ts +153 -10
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +1357 -223
- package/src/cli/cmd_Secret.ts +295 -24
- package/src/cli/cmd_Social.ts +113 -28
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Time.ts +76 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +5 -3
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +44 -4
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +42 -41
- package/src/collections/collection-types.ts +30 -4
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +147 -61
- package/src/collections/reflections.ts +9 -4
- package/src/collections/review.ts +4 -4
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +13 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +370 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +9 -11
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/slots.ts +5 -4
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +1 -1
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +59 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +161 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +18 -6
- package/src/home/home-routes.ts +76 -0
- package/src/home/inbox-shape.ts +234 -91
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +815 -0
- package/src/home/machine-host.ts +38 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/other-macs.ts +2 -2
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +179 -10
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +516 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +41 -6
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +347 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +102 -0
- package/src/hq/hq-local.ts +502 -0
- package/src/hq/hq-routes.ts +204 -0
- package/src/hq/hq-store.ts +603 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +374 -0
- package/src/hq/replica.ts +167 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +24 -11
- package/src/identities/machine-route.ts +8 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +81 -27
- package/src/ledger/gate-checks.ts +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +73 -25
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +25 -19
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +83 -31
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +76 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +24 -13
- package/src/media-store/forget.ts +141 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +21 -17
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +256 -0
- package/src/media-store/space.ts +46 -26
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +3 -3
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +191 -4
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +129 -37
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +11 -5
- package/src/releases/from-card.ts +1 -1
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +71 -19
- package/src/review/anim.ts +3 -3
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/auto.ts +2 -2
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +254 -0
- package/src/review/card-rows.ts +267 -0
- package/src/review/cells.ts +360 -57
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +33 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +152 -19
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +98 -0
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +23 -10
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +582 -109
- package/src/review/move.ts +491 -0
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/notes.ts +12 -20
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +18 -20
- package/src/review/project.ts +1 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +194 -38
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +12 -8
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +851 -124
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +64 -0
- package/src/review/threads.ts +349 -14
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +6 -6
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +77 -11
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +23 -10
- package/src/rules/untrack-generated.ts +92 -8
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +116 -0
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +21 -17
- package/src/secrets/manager.ts +55 -26
- package/src/secrets/read.ts +385 -0
- package/src/secrets/tail.ts +31 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +49 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +72 -30
- package/src/serve/hub-app/col-list-page.tsx +125 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +17 -45
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +18 -39
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +142 -11
- package/src/serve/hub-app/home-strip.css +6 -25
- package/src/serve/hub-app/home-strip.tsx +60 -93
- package/src/serve/hub-app/home.html +10 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +71 -166
- package/src/serve/hub-app/hub-types.ts +5 -1
- package/src/serve/hub-app/hub.css +146 -71
- package/src/serve/hub-app/icons.tsx +32 -5
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +104 -61
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +227 -49
- package/src/serve/hub-app/inbox-view.tsx +204 -120
- package/src/serve/hub-app/inbox.css +47 -47
- package/src/serve/hub-app/index.html +10 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +32 -17
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +217 -0
- package/src/serve/hub-app/machines.css +67 -0
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +57 -0
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +4 -2
- package/src/serve/hub-app/messages/messages-page.tsx +81 -8
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +21 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +46 -8
- package/src/serve/hub-app/project-list.tsx +125 -59
- package/src/serve/hub-app/projects-svc.ts +83 -8
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +22 -6
- package/src/serve/hub-app/reflections-page.tsx +95 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +28 -4
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +75 -29
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +148 -87
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +160 -65
- package/src/serve/hub-app/review/review-page.tsx +12 -12
- package/src/serve/hub-app/review/review-st.ts +174 -47
- package/src/serve/hub-app/review/review-thread.tsx +214 -53
- package/src/serve/hub-app/review/review-views.tsx +494 -159
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +288 -41
- package/src/serve/hub-app/review/trailer-card.tsx +2 -2
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +462 -97
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +43 -15
- package/src/serve/hub-app/social/kit.tsx +32 -13
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +142 -49
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +24 -5
- package/src/serve/hub-app/social/social-page.tsx +95 -36
- package/src/serve/hub-app/social/social-st.ts +162 -41
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +10 -17
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +97 -25
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/thread-row.tsx +101 -0
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +77 -0
- package/src/serve/hub-app/time.css +135 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +3 -11
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +6 -5
- package/src/serve/hub-runtime.ts +35 -8
- package/src/serve/project-gutter-route.ts +42 -19
- package/src/serve/project-gutter.ts +16 -50
- package/src/serve/same-origin.ts +13 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +38 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +3 -3
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +4 -4
- package/src/smoke/run-smoke.ts +6 -6
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/cover.ts +202 -0
- package/src/social/desk-index.ts +34 -13
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +7 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +111 -65
- package/src/social/media-kind.ts +68 -160
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +4 -4
- package/src/social/release-stage.ts +79 -63
- package/src/social/routes.ts +89 -24
- package/src/social/stage.ts +43 -58
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +347 -0
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +246 -47
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +16 -10
- package/src/suite/judge-suites.ts +41 -11
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +16 -10
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +360 -0
- package/src/vault/vault-import.ts +213 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -266
- package/src/social/migrate.ts +0 -123
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// the import of this machine's keychain values into the vault, and the compare of the two (wiki services/secrets,
|
|
2
|
+
// step 2, section 9). The keychain is only READ: a value goes from it into this process, exact or refused with its
|
|
3
|
+
// reason, then on http to the vault, and is read back and compared there by its bytes. No line, file or error holds a
|
|
4
|
+
// value, a part of one or a hash of one. A name with no registry row is never imported, a value the vault already
|
|
5
|
+
// holds differently is never overwritten, and a read back that differs stops the import and removes nothing
|
|
6
|
+
import { closeSync, openSync, readFileSync, rmSync, writeSync } from 'fs'
|
|
7
|
+
import { join } from 'path'
|
|
8
|
+
import { NAME_PART, scopeText, type Scope } from '../core/scope.ts'
|
|
9
|
+
import type { Keychain } from '../secrets/keychain.ts'
|
|
10
|
+
import { KV_MOUNT, scopeRefs } from './layout.ts'
|
|
11
|
+
import { SLOTS, type VaultGrant } from './policy.ts'
|
|
12
|
+
import { vaultPathOf } from './vault-client.ts'
|
|
13
|
+
import { VaultApi } from './vault-http.ts'
|
|
14
|
+
import { mintNode, setNodeSlots } from './vault-minter.ts'
|
|
15
|
+
|
|
16
|
+
export type RegistryRow = { name: string; for?: Scope; archived?: { at: string } }
|
|
17
|
+
|
|
18
|
+
/** where one name of this machine's keychain goes: its path, or why it has none */
|
|
19
|
+
export type Placed = { name: string; scope: string; path?: string; why?: string }
|
|
20
|
+
|
|
21
|
+
/** a template row (`rv/realm/<word>/thing`) as the names it stands for: each `<word>` one part of a name */
|
|
22
|
+
const templateOf = (name: string): RegExp | null =>
|
|
23
|
+
name.includes('<') ? new RegExp(`^${name.split(/<[a-z-]+>/).map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join(NAME_PART.source.slice(1, -1))}$`) : null
|
|
24
|
+
|
|
25
|
+
/** each registry name this machine's keychain holds, and each `rv/` name it holds with no row, placed. A template row
|
|
26
|
+
* places every name it stands for. A row of several scopes is refused: the node template carries no exact line,
|
|
27
|
+
* and bao refuses a slot value of two parts (vault/policy.ts) */
|
|
28
|
+
export async function placeNames(o: { rows: RegistryRow[]; held: string[]; keyOf: (id: string) => Promise<string | null> }): Promise<Placed[]> {
|
|
29
|
+
const out: Placed[] = []
|
|
30
|
+
const exact = new Map(o.rows.filter((r) => templateOf(r.name) == null).map((r) => [r.name, r]))
|
|
31
|
+
const templates = o.rows.flatMap((r) => {
|
|
32
|
+
const t = templateOf(r.name)
|
|
33
|
+
return t == null ? [] : [{ t, row: r }]
|
|
34
|
+
})
|
|
35
|
+
for (const name of o.held) {
|
|
36
|
+
const row = exact.get(name) ?? templates.find((x) => x.t.test(name))?.row
|
|
37
|
+
if (row == null) {
|
|
38
|
+
out.push({ name, scope: '', why: 'no row in the registry: not imported' })
|
|
39
|
+
continue
|
|
40
|
+
}
|
|
41
|
+
const scope = scopeText(row.for)
|
|
42
|
+
// a copy into the vault would undo the archive (sk secret archive)
|
|
43
|
+
if (row.archived != null) {
|
|
44
|
+
out.push({ name, scope, why: `archived on ${row.archived.at}: not imported` })
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
47
|
+
if (scopeRefs(row.for).length > 1) {
|
|
48
|
+
out.push({ name, scope, why: 'filed under several scopes: the vault carries one scope a secret' })
|
|
49
|
+
continue
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
out.push({ name, scope, path: await vaultPathOf(name, row.for, o.keyOf) })
|
|
53
|
+
} catch (e) {
|
|
54
|
+
out.push({ name, scope, why: (e as Error).message })
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** how a value came out of the keychain: as `security` printed it, decoded from its hex form, or not at all */
|
|
61
|
+
export type Form = 'plain' | 'hex' | 'refused'
|
|
62
|
+
|
|
63
|
+
export type Imported = { name: string; did: 'would' | 'ok' | 'same' | 'differs' | 'refused' | 'failed'; form: Form; bytes: number; path?: string; why?: string; version?: number }
|
|
64
|
+
|
|
65
|
+
/** the vault's value against the keychain's, by their bytes, and the count of bytes the keychain gave */
|
|
66
|
+
const sameBytes = (held: string, read: string, bytes: number): boolean => {
|
|
67
|
+
const h = Buffer.from(held, 'utf8')
|
|
68
|
+
return h.length === bytes && h.equals(Buffer.from(read, 'utf8'))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** every item under a name past the first a read gives: named, never copied */
|
|
72
|
+
function seconds(keychain: Keychain, name: string): (Imported & Compared)[] {
|
|
73
|
+
return keychain.accounts(name).slice(1).map((account) => ({ name, did: 'refused' as const, form: 'refused' as const, bytes: 0, why: `a second item under this name (account ${account}): not copied` }))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** a read back that differs from what went: the import stops there, the name said, nothing removed */
|
|
77
|
+
export class ImportStopped extends Error {}
|
|
78
|
+
|
|
79
|
+
/** each placed name into the vault. The keychain is read, never written. `go` false: what it would do, the vault
|
|
80
|
+
* read and nothing written. A name the vault holds already is compared by its bytes: the same is left, another is
|
|
81
|
+
* left and said. A new one is written with check and set 0, then read back: a byte off stops the import */
|
|
82
|
+
export async function importNames(o: { placed: Placed[]; keychain: Keychain; vault: Pick<VaultApi, 'currentVersion' | 'writeKvCas' | 'readKv'>; go: boolean }): Promise<Imported[]> {
|
|
83
|
+
const out: Imported[] = []
|
|
84
|
+
for (const p of o.placed) {
|
|
85
|
+
out.push(...seconds(o.keychain, p.name))
|
|
86
|
+
const read = o.keychain.read(p.name)
|
|
87
|
+
if (read == null) {
|
|
88
|
+
out.push({ name: p.name, did: 'failed', form: 'refused', bytes: 0, why: 'the keychain no longer holds it' })
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
if (!read.ok) {
|
|
92
|
+
out.push({ name: p.name, did: 'refused', form: 'refused', bytes: 0, why: read.why })
|
|
93
|
+
continue
|
|
94
|
+
}
|
|
95
|
+
const row = { name: p.name, form: read.form, bytes: read.bytes }
|
|
96
|
+
if (p.path == null) {
|
|
97
|
+
out.push({ ...row, did: 'refused', why: p.why })
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const v = await o.vault.currentVersion(KV_MOUNT, p.path)
|
|
102
|
+
if (v > 0) {
|
|
103
|
+
const held = await o.vault.readKv(KV_MOUNT, p.path)
|
|
104
|
+
const same = typeof held?.['value'] === 'string' && sameBytes(held['value'], read.value, read.bytes)
|
|
105
|
+
out.push({ ...row, did: same ? 'same' : 'differs', path: p.path, version: v, ...(same ? {} : { why: 'the vault holds another value: neither is changed, the owner decides' }) })
|
|
106
|
+
continue
|
|
107
|
+
}
|
|
108
|
+
if (!o.go) {
|
|
109
|
+
out.push({ ...row, did: 'would', path: p.path })
|
|
110
|
+
continue
|
|
111
|
+
}
|
|
112
|
+
const version = await o.vault.writeKvCas(KV_MOUNT, p.path, { value: read.value, account: read.account }, 0)
|
|
113
|
+
const back = await o.vault.readKv(KV_MOUNT, p.path)
|
|
114
|
+
if (typeof back?.['value'] !== 'string' || !sameBytes(back['value'], read.value, read.bytes) || back['account'] !== read.account) throw new ImportStopped(`${p.name}: the vault read it back as another value at v${version}: the import stops here, nothing is removed`)
|
|
115
|
+
out.push({ ...row, did: 'ok', path: p.path, version })
|
|
116
|
+
} catch (e) {
|
|
117
|
+
if (e instanceof ImportStopped) throw e
|
|
118
|
+
out.push({ ...row, did: 'failed', path: p.path, why: (e as Error).message })
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return out
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type Compared = { name: string; did: 'same' | 'differs' | 'absent' | 'refused' | 'failed'; form: Form; bytes: number; path?: string; why?: string }
|
|
125
|
+
|
|
126
|
+
/** each placed name, the keychain's value against the vault's, read by the same decoder as the import and compared
|
|
127
|
+
* in memory: same, differs, or absent from the vault. Nothing is written on either side */
|
|
128
|
+
export async function compareNames(o: { placed: Placed[]; keychain: Keychain; vault: Pick<VaultApi, 'readKv'> }): Promise<Compared[]> {
|
|
129
|
+
const out: Compared[] = []
|
|
130
|
+
for (const p of o.placed) {
|
|
131
|
+
out.push(...seconds(o.keychain, p.name))
|
|
132
|
+
const read = o.keychain.read(p.name)
|
|
133
|
+
if (read == null || !read.ok) {
|
|
134
|
+
out.push({ name: p.name, did: read == null ? 'failed' : 'refused', form: 'refused', bytes: 0, why: read == null ? 'the keychain no longer holds it' : read.why })
|
|
135
|
+
continue
|
|
136
|
+
}
|
|
137
|
+
const row = { name: p.name, form: read.form, bytes: read.bytes }
|
|
138
|
+
if (p.path == null) {
|
|
139
|
+
out.push({ ...row, did: 'refused', why: p.why })
|
|
140
|
+
continue
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const held = await o.vault.readKv(KV_MOUNT, p.path)
|
|
144
|
+
if (typeof held?.['value'] !== 'string') out.push({ ...row, did: 'absent', path: p.path })
|
|
145
|
+
else out.push({ ...row, did: sameBytes(held['value'], read.value, read.bytes) ? 'same' : 'differs', path: p.path })
|
|
146
|
+
} catch (e) {
|
|
147
|
+
out.push({ ...row, did: 'failed', path: p.path, why: (e as Error).message })
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return out
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** one import or compare at a time on this machine: a file made with O_EXCL beside the vault, its pid inside; one
|
|
154
|
+
* left by a process that is gone is taken over */
|
|
155
|
+
export async function withImportLock<T>(dir: string, run: () => Promise<T>): Promise<T> {
|
|
156
|
+
const file = join(dir, 'import.lock')
|
|
157
|
+
let fd: number
|
|
158
|
+
try {
|
|
159
|
+
fd = openSync(file, 'wx', 0o600)
|
|
160
|
+
} catch {
|
|
161
|
+
let pid = NaN
|
|
162
|
+
try {
|
|
163
|
+
pid = Number(readFileSync(file, 'utf8').trim())
|
|
164
|
+
} catch {
|
|
165
|
+
pid = NaN
|
|
166
|
+
}
|
|
167
|
+
let alive = false
|
|
168
|
+
try {
|
|
169
|
+
if (!Number.isInteger(pid) || pid <= 0) throw new Error('no pid')
|
|
170
|
+
process.kill(pid, 0)
|
|
171
|
+
alive = true
|
|
172
|
+
} catch {
|
|
173
|
+
alive = false
|
|
174
|
+
}
|
|
175
|
+
if (alive) throw new Error(`another import or compare runs on this machine (pid ${pid}): wait for it`)
|
|
176
|
+
rmSync(file, { force: true })
|
|
177
|
+
fd = openSync(file, 'wx', 0o600)
|
|
178
|
+
}
|
|
179
|
+
writeSync(fd, String(process.pid))
|
|
180
|
+
closeSync(fd)
|
|
181
|
+
try {
|
|
182
|
+
return await run()
|
|
183
|
+
} finally {
|
|
184
|
+
rmSync(file, { force: true })
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** the grants that write every placed path: all (all, repo and identity whole) and each machine named, four at most */
|
|
189
|
+
export function importGrants(placed: Placed[]): VaultGrant[] {
|
|
190
|
+
const machines = [...new Set(placed.flatMap((p) => (p.path?.startsWith('machine/') === true ? [p.path.split('/')[1]!] : [])))].sort()
|
|
191
|
+
if (machines.length > SLOTS.machine) throw new Error(`the import writes for ${machines.length} machines, and one token carries ${SLOTS.machine}: run it again with fewer names`)
|
|
192
|
+
return [{ kind: 'all' }, ...machines.map((name) => ({ kind: 'machine' as const, name }))]
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** a run with a node token of its own, minted by the minter for this one run and revoked after it, its entity
|
|
196
|
+
* emptied: the import never needs a root token, and nothing it held outlives it */
|
|
197
|
+
export async function withImportToken<T>(minter: VaultApi, url: string, machine: string, placed: Placed[], run: (vault: VaultApi) => Promise<T>): Promise<T> {
|
|
198
|
+
const t = await mintNode(minter, `import-${machine}`, importGrants(placed))
|
|
199
|
+
try {
|
|
200
|
+
return await run(new VaultApi(url, t.token))
|
|
201
|
+
} finally {
|
|
202
|
+
await minter.revokeAccessor(t.accessor).catch(() => undefined)
|
|
203
|
+
await setNodeSlots(minter, t.entity, null).catch(() => undefined)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** the counts of the last compare, names only, so the house check says them with no read of a value */
|
|
208
|
+
/** `held`: the `rv/` names the keychain held at the compare, names only (the vault page's keychain column) */
|
|
209
|
+
export type CompareSummary = { at: number; same: number; differs: number; absent: number; refused: number; failed: number; differing: string[]; held?: string[] }
|
|
210
|
+
export const summaryOf = (rows: Compared[], at: number): CompareSummary => {
|
|
211
|
+
const n = (d: Compared['did']): number => rows.filter((r) => r.did === d).length
|
|
212
|
+
return { at, same: n('same'), differs: n('differs'), absent: n('absent'), refused: n('refused'), failed: n('failed'), differing: rows.filter((r) => r.did === 'differs').map((r) => r.name) }
|
|
213
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// `sk vault init`, typed by the owner in his own terminal: it makes the seal key, keeps it in the login keychain,
|
|
2
|
+
// initialises the vault, sets up what the hq needs (the mounts, the token role `node`, the minter), revokes the root
|
|
3
|
+
// token, hands him the keys (vault-handover.ts), and only then hands the vault to pm. `--reset` undoes an init
|
|
4
|
+
// while the vault holds no secret. No line, file or returned value holds a key
|
|
5
|
+
import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'fs'
|
|
6
|
+
import { isAbsolute, resolve } from 'path'
|
|
7
|
+
import { AUDIT_DEVICE, auditLog, configFile, dataDir, isSealKey, markerFile, sealServiceOf, minterTokenFile, newSealKey, ROOT_ROAD, SEAL_KEY_ID, SEAL_SERVICE, vaultUrl, type MarkerData, type VaultPlace } from './vault-config.ts'
|
|
8
|
+
import { handOver, holdSealNote, initNote, KeyGuard, sealNote, type Clipboard, type Signals, type Terminal } from './vault-handover.ts'
|
|
9
|
+
import { VaultApi, vaultHealth, waitHealth } from './vault-http.ts'
|
|
10
|
+
import { MINTER_PERIOD, MINTER_POLICY, MINTER_POLICY_NAME, writeNodeSetup } from './vault-minter.ts'
|
|
11
|
+
import { auditPathOf, baoVersion, markerBaoProblem, readMarker, startBao, type SealStore } from './vault-serve.ts'
|
|
12
|
+
|
|
13
|
+
/** variables a coding agent's session sets in the shell it runs commands in. CLAUDE_CONFIG_DIR is not one: an
|
|
14
|
+
* owner's own terminal may set it to pick an account */
|
|
15
|
+
export const AGENT_ENV = ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT', 'CLAUDE_CODE_SESSION_ID', 'CLAUDE_PID', 'AI_AGENT', 'CODEX_SANDBOX', 'CODEX_THREAD_ID', 'GEMINI_CLI', 'CURSOR_AGENT']
|
|
16
|
+
const SSH_ENV = ['SSH_TTY', 'SSH_CONNECTION', 'SSH_CLIENT']
|
|
17
|
+
|
|
18
|
+
/** why this run is not the owner typing at the Mac's own desktop, null when it is. A guard against a mistake, not
|
|
19
|
+
* a wall: any process of his user reads the seal key, since `sk vault serve` reads it with no prompt */
|
|
20
|
+
export function notTypedByOwner(o: { env: Record<string, string | undefined>; stdinTTY: boolean; stdoutTTY: boolean }): string | null {
|
|
21
|
+
const set = (keys: string[]): string[] => keys.filter((k) => (o.env[k] ?? '') !== '')
|
|
22
|
+
const agent = set(AGENT_ENV)
|
|
23
|
+
if (agent.length > 0) return `this shell belongs to an agent's session (${agent.join(', ')}): no agent may hold a key of the vault. Run it in Terminal.app`
|
|
24
|
+
const ssh = set(SSH_ENV)
|
|
25
|
+
if (ssh.length > 0) return `this is an ssh session (${ssh.join(', ')}): the clipboard is not yours and the keychain may be locked. Run it in Terminal.app at the vault Mac's own desktop`
|
|
26
|
+
if ((o.env['RV_KEYCHAIN_BIN'] ?? '') !== '') return 'RV_KEYCHAIN_BIN is set: the seal key would go to that binary, not the login keychain. Unset it, then run it again'
|
|
27
|
+
if (!o.stdinTTY || !o.stdoutTTY) return 'no terminal on stdin and stdout: it is typed by the owner only. Run it in Terminal.app'
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type InitDeps = {
|
|
32
|
+
place: VaultPlace
|
|
33
|
+
seal: SealStore
|
|
34
|
+
clipboard: Clipboard
|
|
35
|
+
/** a round trip on a pasteboard before any key exists: why it cannot hand a note, or null */
|
|
36
|
+
proveClipboard?: () => string | null
|
|
37
|
+
/** one line typed by the owner */
|
|
38
|
+
ask: (question: string) => Promise<string>
|
|
39
|
+
say: (line: string) => void
|
|
40
|
+
machine: string
|
|
41
|
+
/** the absolute path of the bao to run: recorded in the marker, the only one serve starts */
|
|
42
|
+
bin: string
|
|
43
|
+
now?: () => Date
|
|
44
|
+
/** hand the vault to pm and wait until it answers unsealed: true when it did */
|
|
45
|
+
startUnderPm: () => Promise<boolean>
|
|
46
|
+
/** pins openbao so an upgrade is a deliberate act; absent under test */
|
|
47
|
+
pin?: () => string
|
|
48
|
+
clearAfterMs?: number
|
|
49
|
+
/** where bao writes while init holds it */
|
|
50
|
+
baoLog?: string
|
|
51
|
+
signals?: Signals
|
|
52
|
+
terminal?: Terminal
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const RESET = 'if the vault holds no secret yet (a crash during init), sk vault init --reset undoes it'
|
|
56
|
+
|
|
57
|
+
/** why init cannot run on this place, null when it can */
|
|
58
|
+
export async function initRefusal(d: Pick<InitDeps, 'place' | 'seal'>): Promise<string | null> {
|
|
59
|
+
if (existsSync(markerFile(d.place))) return `the vault of this machine is initialised already (${markerFile(d.place)}): init runs once. ${RESET}`
|
|
60
|
+
if (existsSync(dataDir(d.place)) && readdirSync(dataDir(d.place)).length > 0) return `a vault's data is there already (${dataDir(d.place)}): init never writes over it. ${RESET}`
|
|
61
|
+
try {
|
|
62
|
+
if (d.seal.has()) return `the keychain holds a seal key already (${sealServiceOf(d.place)}): init would orphan the data it opens. ${RESET}`
|
|
63
|
+
} catch (e) {
|
|
64
|
+
return (e as Error).message
|
|
65
|
+
}
|
|
66
|
+
const h = await vaultHealth(vaultUrl(d.place), 500)
|
|
67
|
+
if (h != null) return `something answers on 127.0.0.1:${d.place.port} already (health ${h.code}): stop it first: sk gp stop vault, or for a bao left by a killed init, pkill -f ${configFile(d.place)}`
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** what the hq needs and only the root token may write: the node policy, the role, the narrow minter. Its token */
|
|
72
|
+
export async function setupMinter(root: VaultApi): Promise<string> {
|
|
73
|
+
await writeNodeSetup(root)
|
|
74
|
+
await root.writePolicy(MINTER_POLICY_NAME, MINTER_POLICY)
|
|
75
|
+
return (await root.createToken({ policies: [MINTER_POLICY_NAME], period: MINTER_PERIOD, orphan: true, displayName: 'shipkit-minter' })).token
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** the mounts, the role, the minter, its token to a file: everything the root token is needed for */
|
|
79
|
+
async function configure(root: VaultApi, d: InitDeps): Promise<void> {
|
|
80
|
+
await root.mount('rv', 'kv', { version: '2' })
|
|
81
|
+
await root.mount('totp', 'totp')
|
|
82
|
+
if (!(await root.audits()).includes(`${AUDIT_DEVICE}/`)) throw new Error('the audit file of the config is not enabled')
|
|
83
|
+
writeFileSync(minterTokenFile(d.place), `${await setupMinter(root)}\n`, { mode: 0o600 })
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** the whole init, its exit code. Every line goes through `say`, and none holds a key. The guard is installed
|
|
87
|
+
* before the first key exists, and the keys are handed right after the root token is revoked: the slow steps
|
|
88
|
+
* (bao stopped, the marker, pm) come after he holds them */
|
|
89
|
+
export async function initVault(d: InitDeps): Promise<number> {
|
|
90
|
+
const now = d.now ?? (() => new Date())
|
|
91
|
+
const refused = await initRefusal(d)
|
|
92
|
+
if (refused != null) {
|
|
93
|
+
d.say(`FAIL: ${refused}`)
|
|
94
|
+
return 1
|
|
95
|
+
}
|
|
96
|
+
const board = d.proveClipboard?.() ?? null
|
|
97
|
+
if (board != null) {
|
|
98
|
+
d.say(`FAIL: the pasteboard cannot hand the keys over (${board}): nothing was made. Run it in Terminal.app at the vault Mac's own desktop`)
|
|
99
|
+
return 1
|
|
100
|
+
}
|
|
101
|
+
const version = isAbsolute(d.bin) ? baoVersion(d.bin) : null
|
|
102
|
+
if (version == null) {
|
|
103
|
+
d.say(`FAIL: ${d.bin} is no OpenBao (an absolute path to bao, brew install openbao): nothing was made`)
|
|
104
|
+
return 1
|
|
105
|
+
}
|
|
106
|
+
if (d.pin != null) d.say(d.pin())
|
|
107
|
+
const g = new KeyGuard(d).install()
|
|
108
|
+
try {
|
|
109
|
+
const sealKey = newSealKey()
|
|
110
|
+
g.rollback = () => {
|
|
111
|
+
d.seal.remove()
|
|
112
|
+
rmSync(dataDir(d.place), { recursive: true, force: true })
|
|
113
|
+
rmSync(configFile(d.place), { force: true })
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
d.seal.write(sealKey)
|
|
117
|
+
} catch (e) {
|
|
118
|
+
d.say(`FAIL: ${(e as Error).message}: nothing else was done`)
|
|
119
|
+
return 1
|
|
120
|
+
}
|
|
121
|
+
if (d.seal.read() !== sealKey) {
|
|
122
|
+
d.say(`FAIL: the keychain did not keep the seal key (${sealServiceOf(d.place)}): nothing else was done`)
|
|
123
|
+
return 1
|
|
124
|
+
}
|
|
125
|
+
d.say(`ok: a new seal key is in this Mac's login keychain (${sealServiceOf(d.place)})`)
|
|
126
|
+
const url = vaultUrl(d.place)
|
|
127
|
+
g.bao = startBao({ place: d.place, key: sealKey, bin: d.bin, out: d.baoLog, detached: true })
|
|
128
|
+
const fresh = await waitHealth(url, (h) => h?.code === 501, { ms: 30_000, gone: g.bao.gone })
|
|
129
|
+
if (fresh?.code !== 501) {
|
|
130
|
+
d.say(`FAIL: bao did not start on 127.0.0.1:${d.place.port} (${fresh == null ? 'no answer' : `health ${fresh.code}`}): the key and the data are removed, nothing was initialised${d.baoLog == null ? '' : `. Its log: ${d.baoLog}`}`)
|
|
131
|
+
return 1
|
|
132
|
+
}
|
|
133
|
+
let keys: { rootToken: string; recoveryKey: string }
|
|
134
|
+
try {
|
|
135
|
+
keys = await new VaultApi(url).init()
|
|
136
|
+
} catch (e) {
|
|
137
|
+
const h = await vaultHealth(url)
|
|
138
|
+
if (h?.initialized === true) g.rollback = null
|
|
139
|
+
d.say(`FAIL: the init was refused: ${(e as Error).message}${h?.initialized === true ? `. The vault says it is initialised: the key stays in the keychain (${sealServiceOf(d.place)}). ${RESET}` : ': the key and the data are removed'}`)
|
|
140
|
+
return 1
|
|
141
|
+
}
|
|
142
|
+
g.rollback = null
|
|
143
|
+
g.root = new VaultApi(url, keys.rootToken)
|
|
144
|
+
let ok = true
|
|
145
|
+
const up = await waitHealth(url, (h) => h?.code === 200, { ms: 30_000, gone: g.bao.gone })
|
|
146
|
+
if (up?.code !== 200) {
|
|
147
|
+
ok = false
|
|
148
|
+
d.say(`FAIL: the vault did not open after its init (${up == null ? 'no answer' : `health ${up.code}`})`)
|
|
149
|
+
} else
|
|
150
|
+
try {
|
|
151
|
+
await configure(g.root, d)
|
|
152
|
+
d.say('ok: the vault is initialised: kv at rv/, totp at totp/, the audit file, the token role node, the minter')
|
|
153
|
+
} catch (e) {
|
|
154
|
+
ok = false
|
|
155
|
+
d.say(`FAIL: the vault is initialised but its setup broke: ${(e as Error).message}. ${RESET}`)
|
|
156
|
+
}
|
|
157
|
+
if (await g.revokeRoot()) d.say('ok: the root token is revoked: no root token is alive')
|
|
158
|
+
else {
|
|
159
|
+
ok = false
|
|
160
|
+
d.say('FAIL: the root token still answers. It is held in this process only, and dies with no copy')
|
|
161
|
+
}
|
|
162
|
+
const proved = await handOver(initNote({ machine: d.machine, at: now(), sealKey, recoveryKey: keys.recoveryKey }), sealKey, { ...d, guard: g })
|
|
163
|
+
if (g.ended) return 1
|
|
164
|
+
if (proved) d.say('ok: your copy matches the seal key')
|
|
165
|
+
else ok = false
|
|
166
|
+
await g.bao.stop()
|
|
167
|
+
g.bao = null
|
|
168
|
+
if (!ok) {
|
|
169
|
+
d.say(`WARN the vault is not handed to pm. ${RESET}`)
|
|
170
|
+
return 1
|
|
171
|
+
}
|
|
172
|
+
const marker: MarkerData = { at: now().toISOString(), machine: d.machine, keyId: SEAL_KEY_ID, bao: version, baoPath: d.bin, auditPath: resolve(auditLog(d.place)) }
|
|
173
|
+
writeFileSync(markerFile(d.place), `${JSON.stringify(marker, null, 2)}\n`, { mode: 0o600 })
|
|
174
|
+
if (await d.startUnderPm()) d.say('ok: pm runs the vault, unsealed with nobody typing, and starts it at each login')
|
|
175
|
+
else {
|
|
176
|
+
d.say('WARN the vault is initialised, but pm did not bring it up unsealed: sk gp start vault, then sk vault status')
|
|
177
|
+
return 1
|
|
178
|
+
}
|
|
179
|
+
return 0
|
|
180
|
+
} finally {
|
|
181
|
+
if (!g.ended) await g.cleanup()
|
|
182
|
+
g.uninstall()
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** the mounts init makes, beside the ones every vault has */
|
|
187
|
+
const INIT_MOUNTS = ['cubbyhole/', 'identity/', 'sys/', 'rv/', 'totp/']
|
|
188
|
+
|
|
189
|
+
/** the secrets a vault holds, counted with its minter: every mount is read first, and one init never made may hold
|
|
190
|
+
* anything, so it is a refusal; then the kv paths and the totp keys, never a value. Why, when they cannot be counted */
|
|
191
|
+
export async function heldSecrets(url: string, minterToken: string): Promise<{ n: number } | { why: string }> {
|
|
192
|
+
const minter = new VaultApi(url, minterToken)
|
|
193
|
+
try {
|
|
194
|
+
const other = (await minter.mounts()).filter((m) => !INIT_MOUNTS.includes(m))
|
|
195
|
+
if (other.length > 0) return { why: `the vault holds mounts init never made (${other.join(', ')}): each may hold secrets` }
|
|
196
|
+
} catch (e) {
|
|
197
|
+
return { why: `the minter cannot read the vault's mounts (${(e as Error).message}): a vault made before the narrow needs sk vault narrow first` }
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const kv = (await minter.versions('rv')).size
|
|
201
|
+
const totp = await minter.listKeys('totp/keys')
|
|
202
|
+
return { n: kv + totp.length }
|
|
203
|
+
} catch (e) {
|
|
204
|
+
return { why: `the minter cannot count them: ${(e as Error).message}` }
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** what init's root token asks, in its order (configure, then setupMinter): the audit file of an init that stopped
|
|
209
|
+
* holds a beginning of it. The live tier of the init proves the order against a real audit file */
|
|
210
|
+
export const INIT_REQUESTS = ['sys/mounts/rv', 'sys/mounts/totp', 'sys/audit', 'sys/policies/acl/shipkit-node', 'auth/token/roles/node', 'sys/policies/acl/shipkit-minter', 'auth/token/create-orphan']
|
|
211
|
+
/** the line the audit device writes as it starts, before any request: the file of a vault begins with it */
|
|
212
|
+
const AUDIT_START = 'sys/audit/test'
|
|
213
|
+
|
|
214
|
+
/** why the audit file shows more than init at work, null when it shows init alone: it begins as a vault's start
|
|
215
|
+
* does, its root token's requests are a beginning of init's own in their order (the revoke of the root token may
|
|
216
|
+
* end them), and no token other than root made one. An empty file, a file cut at its start, or a line that does not
|
|
217
|
+
* read proves nothing. A file cut at its end is a crash at that line: it cannot be told apart, so it is taken */
|
|
218
|
+
export function auditBeyondInit(file: string): string | null {
|
|
219
|
+
if (!existsSync(file)) return `its audit file is not there (${file})`
|
|
220
|
+
let next = 0
|
|
221
|
+
let first = true
|
|
222
|
+
let revoked = false
|
|
223
|
+
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
224
|
+
if (line.trim() === '') continue
|
|
225
|
+
let e: { type?: string; auth?: { policies?: string[] | null }; request?: { path?: string } }
|
|
226
|
+
try {
|
|
227
|
+
e = JSON.parse(line) as typeof e
|
|
228
|
+
} catch {
|
|
229
|
+
return 'a line of its audit file does not read'
|
|
230
|
+
}
|
|
231
|
+
if (e.type !== 'request') continue
|
|
232
|
+
const path = e.request?.path ?? ''
|
|
233
|
+
if (first && path !== AUDIT_START) return `its audit file does not begin as a vault's start does (${path}): it was cut at its start`
|
|
234
|
+
first = false
|
|
235
|
+
const policies = e.auth?.policies
|
|
236
|
+
if (policies == null || policies.length === 0) continue
|
|
237
|
+
if (!policies.includes('root')) return `its audit file shows a token of ${policies.join(', ')} at work (${path})`
|
|
238
|
+
if (revoked) return `its audit file shows the root token at work after its revoke (${path})`
|
|
239
|
+
if (path === 'auth/token/revoke-self') revoked = true
|
|
240
|
+
else if (path === INIT_REQUESTS[next]) next++
|
|
241
|
+
else return `its audit file shows the root token out of init's order (${path})`
|
|
242
|
+
}
|
|
243
|
+
return first ? 'its audit file is empty: an audit file that does not hold a vault\'s start proves nothing' : null
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** `sk vault init --reset`: undo an init while the vault holds no secret, so init can run again. It proves the vault
|
|
247
|
+
* empty first: never initialised (501), or counted with its minter (zero kv paths, zero totp keys), or, with no
|
|
248
|
+
* minter and no marker, by construction: the root token never left init, and init writes no secret */
|
|
249
|
+
export async function resetVault(d: Pick<InitDeps, 'place' | 'seal' | 'say' | 'bin' | 'baoLog'>): Promise<number> {
|
|
250
|
+
const fail = (why: string): number => (d.say(`FAIL: ${why}`), 1)
|
|
251
|
+
const h0 = await vaultHealth(vaultUrl(d.place), 500)
|
|
252
|
+
if (h0 != null) return fail(`something answers on 127.0.0.1:${d.place.port} (health ${h0.code}): stop it first: sk gp stop vault, or for a bao left by a killed init, pkill -f ${configFile(d.place)}`)
|
|
253
|
+
let key: string | null
|
|
254
|
+
try {
|
|
255
|
+
key = d.seal.read()
|
|
256
|
+
} catch (e) {
|
|
257
|
+
return fail((e as Error).message)
|
|
258
|
+
}
|
|
259
|
+
const data = existsSync(dataDir(d.place)) && readdirSync(dataDir(d.place)).length > 0
|
|
260
|
+
const marker = readMarker(d.place)
|
|
261
|
+
if (!data && key == null && marker == null) return fail('there is nothing to reset: no data, no marker, no seal key')
|
|
262
|
+
// the key is removed only once the vault of this place opened with it: a key no data proves its own may open
|
|
263
|
+
// another vault's data or its snapshots
|
|
264
|
+
let opened = false
|
|
265
|
+
if (data) {
|
|
266
|
+
if (key == null) return fail(`the vault's data is there but its seal key is not in the keychain (${sealServiceOf(d.place)}): nothing can prove it empty. Put the key back from your password manager, then run it again`)
|
|
267
|
+
const wrong = marker == null ? null : markerBaoProblem(d.place, marker)
|
|
268
|
+
if (wrong != null) return fail(`${wrong}: nothing was removed`)
|
|
269
|
+
const bao = startBao({ place: d.place, key, bin: marker?.baoPath ?? d.bin, out: d.baoLog, detached: true })
|
|
270
|
+
try {
|
|
271
|
+
const h = await waitHealth(vaultUrl(d.place), (x) => x?.code === 200 || x?.code === 501, { ms: 30_000, gone: bao.gone })
|
|
272
|
+
if (h?.code === 501) d.say('the vault was never initialised: it holds nothing')
|
|
273
|
+
else if (h?.code !== 200) return fail(`the vault does not open with the keychain's key (${h == null ? 'no answer' : `health ${h.code}`}): nothing was removed`)
|
|
274
|
+
else if (existsSync(minterTokenFile(d.place))) {
|
|
275
|
+
const held = await heldSecrets(vaultUrl(d.place), (await Bun.file(minterTokenFile(d.place)).text()).trim())
|
|
276
|
+
if ('why' in held) return fail(`${held.why}: nothing was removed. The way is ${ROOT_ROAD}`)
|
|
277
|
+
if (held.n > 0) return fail(`the vault holds ${held.n} secret${held.n === 1 ? '' : 's'}: a reset would lose them, nothing was removed. The way is ${ROOT_ROAD}`)
|
|
278
|
+
d.say('the vault holds no secret: no kv path, no totp key (counted with the minter)')
|
|
279
|
+
} else if (marker != null) return fail(`${markerFile(d.place)} says init finished, but its minter token is gone: nothing can prove the vault empty. The way is ${ROOT_ROAD}`)
|
|
280
|
+
else {
|
|
281
|
+
const why = auditBeyondInit(auditPathOf(d.place))
|
|
282
|
+
if (why != null) return fail(`there is no minter token and no marker, but ${why}: nothing can prove the vault empty, nothing was removed. The way is ${ROOT_ROAD}`)
|
|
283
|
+
d.say("the vault holds no secret: there is no minter token, and the audit file shows init's root token alone at work, on sys and auth only")
|
|
284
|
+
}
|
|
285
|
+
opened = true
|
|
286
|
+
} finally {
|
|
287
|
+
await bao.stop()
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const removed: string[] = []
|
|
291
|
+
for (const [what, path] of [
|
|
292
|
+
['the data', dataDir(d.place)],
|
|
293
|
+
['the config', configFile(d.place)],
|
|
294
|
+
['the marker', markerFile(d.place)],
|
|
295
|
+
['the minter token', minterTokenFile(d.place)],
|
|
296
|
+
] as const)
|
|
297
|
+
if (existsSync(path)) {
|
|
298
|
+
rmSync(path, { recursive: true, force: true })
|
|
299
|
+
removed.push(`${what} (${path})`)
|
|
300
|
+
}
|
|
301
|
+
if (key != null && opened) {
|
|
302
|
+
d.seal.remove()
|
|
303
|
+
removed.push(`the seal key in the login keychain (${sealServiceOf(d.place)})`)
|
|
304
|
+
}
|
|
305
|
+
for (const r of removed) d.say(`removed ${r}`)
|
|
306
|
+
if (key != null && !opened) {
|
|
307
|
+
d.say(`FAIL: the seal key (${sealServiceOf(d.place)}) is kept: no vault data here opened with it, so it may be the one key of data or snapshots elsewhere. If it is the key of an init killed before its vault started, and your password manager holds no note of it: security delete-generic-password -s ${sealServiceOf(d.place)} -a vault`)
|
|
308
|
+
return 1
|
|
309
|
+
}
|
|
310
|
+
d.say('ok: the vault is reset; the audit file is kept. Run sk vault init again')
|
|
311
|
+
return 0
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** `sk vault key --copy`: the seal key from the keychain into the clipboard, as a short note, cleared after 90 s */
|
|
315
|
+
export async function copySealKey(d: Pick<InitDeps, 'seal' | 'clipboard' | 'say' | 'machine' | 'now' | 'clearAfterMs' | 'signals'> & { sleep?: (ms: number) => Promise<void> }): Promise<number> {
|
|
316
|
+
let key: string | null
|
|
317
|
+
try {
|
|
318
|
+
key = d.seal.read()
|
|
319
|
+
} catch (e) {
|
|
320
|
+
d.say(`FAIL: ${(e as Error).message}`)
|
|
321
|
+
return 1
|
|
322
|
+
}
|
|
323
|
+
if (key == null || !isSealKey(key)) {
|
|
324
|
+
d.say(`FAIL: no seal key in this Mac's login keychain (${SEAL_SERVICE}): the vault was not initialised here`)
|
|
325
|
+
return 1
|
|
326
|
+
}
|
|
327
|
+
return await holdSealNote(sealNote({ machine: d.machine, at: (d.now ?? (() => new Date()))(), sealKey: key }), d)
|
|
328
|
+
}
|