rvlib-shipkit 2.25.0 → 2.27.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 +33 -0
- package/package.json +2 -2
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +331 -0
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +1 -3
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/render.ts +130 -17
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +349 -23
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +370 -95
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/offload.ts +17 -6
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +40 -0
- package/src/asks/asks-queue.ts +205 -47
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +289 -10
- package/src/check.ts +3 -1
- package/src/checks/SK004-gitignore-policy.check.ts +12 -5
- package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
- package/src/checks/SK026-asks-autoclose.check.ts +5 -5
- 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/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK045-slow-hooks.check.ts +47 -0
- package/src/checks/SK046-hook-records.check.ts +76 -0
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/cli/cmd_Asks.ts +71 -5
- package/src/cli/cmd_Backup.ts +5 -3
- package/src/cli/cmd_Capacity.ts +2 -2
- 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_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Releases.ts +30 -0
- package/src/cli/cmd_Review.ts +569 -118
- package/src/cli/cmd_Secret.ts +62 -12
- package/src/cli/cmd_Social.ts +83 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Time.ts +82 -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/family-help.ts +4 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/registry.ts +26 -4
- package/src/collections/actions.ts +63 -13
- package/src/collections/collection-types.ts +23 -1
- package/src/collections/providers.ts +117 -23
- package/src/collections/review.ts +4 -4
- package/src/commands/runner.ts +5 -1
- 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/history-files.ts +9 -5
- package/src/core/layout.ts +3 -0
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +368 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +1 -1
- 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/signal-name.ts +6 -0
- package/src/core/slots.ts +5 -4
- package/src/core/trace-audit.ts +6 -1
- package/src/core/transient.ts +6 -0
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +2 -2
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +66 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +149 -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 +12 -3
- package/src/home/home-routes.ts +68 -0
- package/src/home/inbox-shape.ts +24 -14
- package/src/home/machine-fold.ts +820 -0
- package/src/home/machine-host.ts +20 -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/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 +175 -7
- 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 +482 -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 +17 -4
- 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 +348 -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 +99 -0
- package/src/hq/hq-local.ts +469 -0
- package/src/hq/hq-routes.ts +196 -0
- package/src/hq/hq-store.ts +599 -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 +372 -0
- package/src/hq/replica.ts +168 -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/identities/identities.ts +15 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +73 -26
- package/src/ledger/gate-checks.ts +29 -4
- package/src/ledger/git-key.ts +3 -3
- package/src/ledger/git-scan.ts +49 -7
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +36 -17
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/run.ts +11 -11
- 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 +68 -20
- package/src/media-store/copy/config.ts +77 -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 +22 -11
- package/src/media-store/forget.ts +23 -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 +18 -15
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +240 -0
- package/src/media-store/space.ts +40 -21
- 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/model.ts +16 -7
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +2 -2
- package/src/messages/suggest.ts +96 -0
- package/src/pages/frame-client.ts +10 -0
- 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 +146 -36
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +8 -3
- package/src/releases/from-card.ts +1 -1
- package/src/releases/model.ts +18 -0
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +23 -2
- package/src/repo-config.ts +42 -2
- package/src/review/anim.ts +2 -2
- package/src/review/auto.ts +2 -2
- package/src/review/card-db.ts +244 -0
- package/src/review/card-rows.ts +266 -0
- package/src/review/cells.ts +76 -5
- package/src/review/draft-card.ts +41 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/format.ts +29 -10
- package/src/review/gone.ts +98 -0
- package/src/review/inbox-hook.ts +35 -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 +214 -45
- package/src/review/move.ts +491 -0
- package/src/review/notes.ts +12 -20
- package/src/review/previews.ts +15 -19
- package/src/review/project.ts +1 -1
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +64 -13
- package/src/review/stage-card.ts +8 -4
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +529 -83
- package/src/review/thread-fold.ts +51 -0
- package/src/review/threads.ts +147 -9
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +4 -4
- 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 +6 -6
- package/src/review/watchers.ts +1 -1
- package/src/rules/untrack-generated.ts +92 -8
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain.ts +113 -0
- package/src/secrets/list.ts +16 -6
- package/src/secrets/manager.ts +24 -10
- package/src/secrets/read.ts +257 -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 +48 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/col-card.tsx +64 -13
- package/src/serve/hub-app/col-list-page.tsx +122 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +10 -41
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +70 -16
- 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/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +89 -9
- package/src/serve/hub-app/home-strip.css +5 -19
- package/src/serve/hub-app/home-strip.tsx +58 -92
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +31 -142
- package/src/serve/hub-app/hub-types.ts +3 -1
- package/src/serve/hub-app/hub.css +109 -23
- package/src/serve/hub-app/icons.tsx +18 -1
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +100 -58
- 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 +41 -24
- package/src/serve/hub-app/inbox-view.tsx +37 -41
- package/src/serve/hub-app/inbox.css +2 -5
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +28 -15
- 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/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +224 -0
- package/src/serve/hub-app/machines.css +76 -0
- package/src/serve/hub-app/md-copy.tsx +79 -0
- package/src/serve/hub-app/media-view.tsx +2 -0
- package/src/serve/hub-app/messages/messages-page.tsx +79 -7
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +11 -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/project-list.css +54 -8
- package/src/serve/hub-app/project-list.tsx +128 -59
- package/src/serve/hub-app/projects-svc.ts +78 -7
- 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 +27 -5
- package/src/serve/hub-app/reflections-page.tsx +42 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +25 -2
- package/src/serve/hub-app/releases/releases-st.ts +1 -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/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/kit.tsx +50 -7
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +145 -65
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +68 -30
- package/src/serve/hub-app/review/review-page.tsx +7 -8
- package/src/serve/hub-app/review/review-st.ts +111 -24
- package/src/serve/hub-app/review/review-thread.tsx +49 -19
- package/src/serve/hub-app/review/review-views.tsx +475 -144
- 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 +73 -26
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- 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.css +267 -61
- 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/comms-page.tsx +20 -5
- package/src/serve/hub-app/social/kit.tsx +30 -4
- package/src/serve/hub-app/social/post-card.tsx +139 -49
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +11 -0
- package/src/serve/hub-app/social/social-page.tsx +94 -35
- package/src/serve/hub-app/social/social-st.ts +120 -36
- 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 +3 -0
- 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 +91 -23
- 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/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 +76 -0
- package/src/serve/hub-app/time.css +138 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +4 -4
- 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-st.ts +12 -10
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/wikis-view.tsx +2 -2
- package/src/serve/hub-runtime.ts +15 -2
- package/src/serve/project-gutter-route.ts +27 -14
- package/src/serve/project-gutter.ts +25 -12
- package/src/serve/same-origin.ts +10 -0
- package/src/serve/serve-hub.ts +13 -4
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +1 -1
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -2
- package/src/social/cover.ts +202 -0
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +3 -0
- package/src/social/load.ts +23 -2
- package/src/social/media-kind.ts +2 -1
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +28 -13
- package/src/social/routes.ts +26 -1
- package/src/social/stage.ts +1 -1
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/thumbnail.ts +255 -0
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +236 -42
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +14 -8
- package/src/suite/judge-suites.ts +113 -16
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +81 -34
- 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/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 +352 -0
- package/src/vault/vault-import.ts +208 -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/wiki/run-wiki.ts +2 -1
- package/src/wiki/scan-md.ts +42 -2
|
@@ -9,7 +9,7 @@ import type { RepoSt } from './repo-st.ts'
|
|
|
9
9
|
import type { Resource } from './hub-types.ts'
|
|
10
10
|
import { repoSections, type RepoSection } from './repo-sections.ts'
|
|
11
11
|
import { walkKey, type WalkHost } from './list-walk.ts'
|
|
12
|
-
import { buildTree, commandResources, dirKeys, flattenTree, matchesQuery, passesFilter, processResources, whenCounts, type TreeNode, type TreeRow } from './tree-build.ts'
|
|
12
|
+
import { buildTree, commandResources, dirKeys, flattenTree, matchesQuery, passesFilter, processResources, urlResources, whenCounts, type TreeNode, type TreeRow } from './tree-build.ts'
|
|
13
13
|
|
|
14
14
|
const EXPANDED_KEY = 'shipkit.tree.expanded'
|
|
15
15
|
|
|
@@ -35,10 +35,12 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
35
35
|
expanded = new Set<string>()
|
|
36
36
|
/** the row key under the keyboard cursor */
|
|
37
37
|
cursor: string | null = null
|
|
38
|
+
/** an arrow is opening the page it landed on: that page unfolds nothing (reveal) */
|
|
39
|
+
private walking = false
|
|
38
40
|
|
|
39
41
|
constructor(private st: RepoSt) {
|
|
40
42
|
for (const p of readStore(EXPANDED_KEY).split('\n')) if (p !== '') this.expanded.add(p)
|
|
41
|
-
makeAutoObservable<this, 'st'>(this, { st: false })
|
|
43
|
+
makeAutoObservable<this, 'st' | 'walking'>(this, { st: false, walking: false })
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
private get q(): string {
|
|
@@ -52,7 +54,7 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
52
54
|
* global processes, which pm reports and the hub never lists, then the
|
|
53
55
|
* commands of its project CLI, which the CLI itself lists */
|
|
54
56
|
private get all(): Resource[] {
|
|
55
|
-
return [...this.st.cols.resources, ...processResources(this.st.globalProcesses), ...commandResources(this.st.commands.rows, this.st.commands.runs)]
|
|
57
|
+
return [...this.st.cols.resources, ...processResources(this.st.globalProcesses), ...urlResources(this.st.urls.list, this.st.globalProcesses), ...commandResources(this.st.commands.rows, this.st.commands.runs)]
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
get visible(): Resource[] {
|
|
@@ -84,7 +86,7 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
84
86
|
/** what is unfolded right now: a live search must SHOW its matches, so
|
|
85
87
|
* the folds yield while it runs, and they are back once it is cleared */
|
|
86
88
|
get open(): Set<string> {
|
|
87
|
-
return this.q === '' ? this.expanded : new Set(dirKeys(this.nodes
|
|
89
|
+
return this.q === '' ? this.expanded : new Set(dirKeys(this.nodes))
|
|
88
90
|
}
|
|
89
91
|
isOpen(key: string): boolean {
|
|
90
92
|
return this.open.has(key)
|
|
@@ -122,9 +124,10 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
122
124
|
this.expanded.has(key) ? this.expanded.delete(key) : this.expanded.add(key)
|
|
123
125
|
this.save()
|
|
124
126
|
}
|
|
125
|
-
/** unfold a branch the page shown lives in, so its rows are in sight (a page's tab rows); kept like a fold
|
|
127
|
+
/** unfold a branch the page shown lives in, so its rows are in sight (a page's tab rows); kept like a fold.
|
|
128
|
+
* Never under an arrow walk: a branch that unfolds as the cursor crosses it moves the rows under it, → unfolds */
|
|
126
129
|
reveal(key: string): void {
|
|
127
|
-
if (this.expanded.has(key)) return
|
|
130
|
+
if (this.walking || this.expanded.has(key)) return
|
|
128
131
|
this.expanded.add(key)
|
|
129
132
|
this.save()
|
|
130
133
|
}
|
|
@@ -176,11 +179,17 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
176
179
|
return on == null ? -1 : rows.findIndex((r) => r.section === on)
|
|
177
180
|
}
|
|
178
181
|
|
|
179
|
-
/** an arrow lands on a row and opens its page at once. A branch with
|
|
180
|
-
* nothing to open only takes the cursor: a fold is the chevron's job */
|
|
182
|
+
/** an arrow lands on a row and opens its page at once, its fold untouched. A branch with
|
|
183
|
+
* nothing to open only takes the cursor: a fold is the chevron's job, or → */
|
|
181
184
|
land(row: TreeRow): void {
|
|
182
185
|
this.cursor = row.key
|
|
183
|
-
if (row.section
|
|
186
|
+
if (row.section == null && row.page == null && row.res == null) return
|
|
187
|
+
this.walking = true
|
|
188
|
+
try {
|
|
189
|
+
this.st.walk(() => this.activate(row))
|
|
190
|
+
} finally {
|
|
191
|
+
this.walking = false
|
|
192
|
+
}
|
|
184
193
|
}
|
|
185
194
|
|
|
186
195
|
/** a greyed section with no page: the arrows step over it */
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// every url of a repo (wiki tools/shipkit/urls.md), as the hub page holds it: the list, and the copy of one field of
|
|
2
|
+
// a login. The one constraint a reader breaks first: a copied value goes from the answer to the clipboard and
|
|
3
|
+
// nowhere else, never into this state
|
|
4
|
+
import { makeAutoObservable, runInAction } from 'mobx'
|
|
5
|
+
import type { FrameMode } from '../../urls/frame.ts'
|
|
6
|
+
import type { LoginField, RepoUrls, UrlRow } from '../../urls/rows.ts'
|
|
7
|
+
import { urlFrameOrigin } from '../door-names.ts'
|
|
8
|
+
import type { RepoSt } from './repo-st.ts'
|
|
9
|
+
|
|
10
|
+
/** how long a chip says copied */
|
|
11
|
+
const SAID_MS = 1600
|
|
12
|
+
|
|
13
|
+
/** whether this page can frame a url, or why not: a page over https never loads an http frame, and a loopback url
|
|
14
|
+
* answers only on the machine that serves it */
|
|
15
|
+
export function frameRefusal(url: string, page: { protocol: string; hostname: string }): string | null {
|
|
16
|
+
const loop = (h: string): boolean => h === 'localhost' || h.endsWith('.localhost') || h === '[::1]' || /^127\./.test(h)
|
|
17
|
+
let u: URL
|
|
18
|
+
try { u = new URL(url) } catch { return `${url} is no url` }
|
|
19
|
+
if (loop(u.hostname) && !loop(page.hostname)) return `${u.host} answers only on the Mac that runs it: open the hub there`
|
|
20
|
+
if (page.protocol === 'https:' && u.protocol === 'http:') return `a page over https cannot frame ${u.host}, which is http: open it in a tab`
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const loopPage = (h: string): boolean => h === 'localhost' || h.endsWith('.localhost') || h === '[::1]' || h === '::1' || /^127\./.test(h)
|
|
25
|
+
|
|
26
|
+
/** what the page shows for a url: its frame's address, a line that says why none, or a wait while the hub probes */
|
|
27
|
+
export type FrameChoice = { src: string } | { why: string } | { reading: string }
|
|
28
|
+
|
|
29
|
+
/** the frame of url `u` as the hub probed it (`mode`, null while unknown). `repo`: its name on the home, null on a hub
|
|
30
|
+
* of its own, which forwards no url's name */
|
|
31
|
+
export function frameChoice(u: UrlRow, mode: FrameMode | null, page: { protocol: string; hostname: string; port: string }, repo: string | null): FrameChoice {
|
|
32
|
+
const refused = frameRefusal(u.url, page)
|
|
33
|
+
if (refused != null) return { why: refused }
|
|
34
|
+
let url: URL
|
|
35
|
+
try { url = new URL(u.url) } catch { return { why: `${u.url} is no url` } }
|
|
36
|
+
if (mode == null) return { reading: url.host }
|
|
37
|
+
if (mode.frame === 'direct') return { src: u.url }
|
|
38
|
+
if (mode.frame === 'none') return { why: mode.why }
|
|
39
|
+
if (repo == null) return { why: `${url.host} ${mode.login ? 'asks a login' : 'refuses a frame of another site'}: the home's hub frames it, a hub of its own does not` }
|
|
40
|
+
if (!loopPage(page.hostname)) return { why: 'this frame answers on the Mac that serves the hub: open it there, or in a tab' }
|
|
41
|
+
const origin = urlFrameOrigin(u.id, repo, page.port || (page.protocol === 'https:' ? '443' : '80'))
|
|
42
|
+
if (origin == null) return { why: `the url id ${u.id} is too long to name a frame: give it a shorter id` }
|
|
43
|
+
return { src: `${origin}${url.pathname}${url.search}${url.hash}` }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const chipKey = (id: string, login: number, field: LoginField): string => `${id}/${login}/${field}`
|
|
47
|
+
|
|
48
|
+
export class UrlsSvc {
|
|
49
|
+
list: UrlRow[] = []
|
|
50
|
+
problem: string | null = null
|
|
51
|
+
loaded = false
|
|
52
|
+
/** the chip that copied last, lit for a moment */
|
|
53
|
+
copied: string | null = null
|
|
54
|
+
/** why the last copy failed, said under the chips until the next one */
|
|
55
|
+
failed: string | null = null
|
|
56
|
+
/** how the hub frames each url it was asked about, by id */
|
|
57
|
+
frames: Record<string, FrameMode> = {}
|
|
58
|
+
private timer: ReturnType<typeof setTimeout> | null = null
|
|
59
|
+
|
|
60
|
+
constructor(private st: RepoSt) {
|
|
61
|
+
makeAutoObservable<this, 'st' | 'timer'>(this, { st: false, timer: false })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
find(id: string | null): UrlRow | null {
|
|
65
|
+
return id == null ? null : (this.list.find((u) => u.id === id) ?? null)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async load(): Promise<void> {
|
|
69
|
+
try {
|
|
70
|
+
const r = await fetch(this.st.url('/api/urls.json'))
|
|
71
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
72
|
+
const j = (await r.json()) as { urls: UrlRow[]; problem: string | null }
|
|
73
|
+
runInAction(() => {
|
|
74
|
+
this.list = j.urls
|
|
75
|
+
this.problem = j.problem
|
|
76
|
+
this.loaded = true
|
|
77
|
+
})
|
|
78
|
+
} catch (e) {
|
|
79
|
+
runInAction(() => {
|
|
80
|
+
this.problem = `the urls did not load: ${(e as Error).message}`
|
|
81
|
+
this.loaded = true
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** how the hub frames url `id`: asked once a page, again on a reload (`fresh`); the hub keeps its own probe */
|
|
87
|
+
async probe(id: string, fresh = false): Promise<void> {
|
|
88
|
+
if (!fresh && this.frames[id] != null) return
|
|
89
|
+
if (fresh) delete this.frames[id]
|
|
90
|
+
let mode: FrameMode
|
|
91
|
+
try {
|
|
92
|
+
const r = await fetch(this.st.url(`/api/urls/frame?${new URLSearchParams({ id, ...(typeof location === 'undefined' ? {} : { from: location.origin }), ...(fresh ? { fresh: '1' } : {}) })}`))
|
|
93
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
94
|
+
mode = (await r.json()) as FrameMode
|
|
95
|
+
} catch (e) {
|
|
96
|
+
mode = { frame: 'none', why: `the hub did not say how ${id} answers: ${(e as Error).message}` }
|
|
97
|
+
}
|
|
98
|
+
runInAction(() => { this.frames[id] = mode })
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private async read(id: string, login: number, field: LoginField): Promise<string> {
|
|
102
|
+
const r = await fetch(this.st.url('/api/urls/copy'), { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id, login, field }) })
|
|
103
|
+
if (!r.ok) throw new Error((await r.text()) || `the hub answered ${r.status}`)
|
|
104
|
+
return ((await r.json()) as { value: string }).value
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** one field of a login into the clipboard. The write starts inside the click and takes the value as a promise:
|
|
108
|
+
* the macOS app's web view refuses a write that starts after an await */
|
|
109
|
+
async copy(id: string, login: number, field: LoginField): Promise<void> {
|
|
110
|
+
const key = chipKey(id, login, field)
|
|
111
|
+
try {
|
|
112
|
+
const clip = globalThis.navigator?.clipboard
|
|
113
|
+
if (clip == null) throw new Error('this page has no clipboard: it needs https or localhost')
|
|
114
|
+
const value = this.read(id, login, field)
|
|
115
|
+
if (typeof ClipboardItem === 'function' && typeof clip.write === 'function') await clip.write([new ClipboardItem({ 'text/plain': value.then((v) => new Blob([v], { type: 'text/plain' })) })])
|
|
116
|
+
else await clip.writeText(await value)
|
|
117
|
+
runInAction(() => {
|
|
118
|
+
this.copied = key
|
|
119
|
+
this.failed = null
|
|
120
|
+
})
|
|
121
|
+
if (this.timer != null) clearTimeout(this.timer)
|
|
122
|
+
this.timer = setTimeout(() => runInAction(() => { if (this.copied === key) this.copied = null }), SAID_MS)
|
|
123
|
+
} catch (e) {
|
|
124
|
+
runInAction(() => {
|
|
125
|
+
this.copied = null
|
|
126
|
+
this.failed = (e as Error).message
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** every repo's urls, for the home's overview: read when the overview shows. A node of the home (home-st.ts) */
|
|
133
|
+
export class HouseUrlsSvc {
|
|
134
|
+
repos: RepoUrls[] = []
|
|
135
|
+
problem: string | null = null
|
|
136
|
+
|
|
137
|
+
constructor() {
|
|
138
|
+
makeAutoObservable(this)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async load(): Promise<void> {
|
|
142
|
+
try {
|
|
143
|
+
const r = await fetch('/api/home/urls.json')
|
|
144
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
145
|
+
const j = (await r.json()) as RepoUrls[]
|
|
146
|
+
runInAction(() => {
|
|
147
|
+
this.repos = j
|
|
148
|
+
this.problem = null
|
|
149
|
+
})
|
|
150
|
+
} catch (e) {
|
|
151
|
+
runInAction(() => { this.problem = `the urls did not load: ${(e as Error).message}` })
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// the urls page of a repo (wiki tools/shipkit/urls.md): a url opened is framed alone, its logins as chips above the
|
|
2
|
+
// frame, one click a copy; with none opened, the list of every url, dev and prod. A password is never drawn
|
|
3
|
+
import { observer } from 'mobx-react-lite'
|
|
4
|
+
import { useEffect, useRef, useState } from 'react'
|
|
5
|
+
import type { ProcessRow } from '../../home/process-rows.ts'
|
|
6
|
+
import type { UrlRow } from '../../urls/rows.ts'
|
|
7
|
+
import { Icon, ICON } from './icons.tsx'
|
|
8
|
+
import type { RepoSt } from './repo-st.ts'
|
|
9
|
+
import { chipKey, frameChoice } from './urls-svc.ts'
|
|
10
|
+
|
|
11
|
+
const hostOf = (url: string): string => url.replace(/^https?:\/\//, '').replace(/\/$/, '')
|
|
12
|
+
|
|
13
|
+
/** the process that serves a url, as pm reports it: null when none is declared or pm does not say */
|
|
14
|
+
const processOf = (app: RepoSt, u: UrlRow): ProcessRow | null => (u.process == null ? null : (app.globalProcesses.find((r) => r.id === u.process) ?? null))
|
|
15
|
+
|
|
16
|
+
const Chip = observer(({ app, u, login, field, text }: { app: RepoSt; u: UrlRow; login: number; field: 'account' | 'password'; text: string }) => {
|
|
17
|
+
const said = app.urls.copied === chipKey(u.id, login, field)
|
|
18
|
+
return (
|
|
19
|
+
<button className={`urlchip${said ? ' said' : ''}`} title={`copy the ${field} of ${u.logins[login]?.label ?? 'this login'}`} onClick={() => void app.urls.copy(u.id, login, field)}>
|
|
20
|
+
<Icon d={ICON.copy} />
|
|
21
|
+
<span>{said ? 'copied' : text}</span>
|
|
22
|
+
</button>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
/** above the frame: the url's name, each login as two chips, then reload and open in a tab */
|
|
27
|
+
const UrlBar = observer(({ app, u, reload }: { app: RepoSt; u: UrlRow; reload: () => void }) => (
|
|
28
|
+
<div className="urlbar">
|
|
29
|
+
<span className={`urlenv ${u.env}`}>{u.env}</span>
|
|
30
|
+
<b>{u.label}</b>
|
|
31
|
+
{u.logins.length === 0 ? <span className="dim">no login declared</span> : u.logins.map((l, i) => (
|
|
32
|
+
<span className="urllogin" key={i}>
|
|
33
|
+
<span className="dim">{l.label}</span>
|
|
34
|
+
<Chip app={app} u={u} login={i} field="account" text={l.account ?? 'account'} />
|
|
35
|
+
<Chip app={app} u={u} login={i} field="password" text="password" />
|
|
36
|
+
</span>
|
|
37
|
+
))}
|
|
38
|
+
<span className="sp" />
|
|
39
|
+
<button className="ghost" onClick={reload} title={`ask ${u.url} again and load it`}>reload</button>
|
|
40
|
+
<a className="urlout" href={u.url} target="_blank" rel="noopener" title={`open ${u.url} in a browser tab`}>open in a tab</a>
|
|
41
|
+
</div>
|
|
42
|
+
))
|
|
43
|
+
|
|
44
|
+
const UrlStage = observer(({ app, u }: { app: RepoSt; u: UrlRow }) => {
|
|
45
|
+
const [epoch, setEpoch] = useState(0)
|
|
46
|
+
const proc = processOf(app, u)
|
|
47
|
+
const m = app.home.machine
|
|
48
|
+
const down = proc != null && proc.dot !== 'up' && proc.dot !== 'unknown'
|
|
49
|
+
const choice = frameChoice(u, app.urls.frames[u.id] ?? null, location, app.base === '' ? null : app.key)
|
|
50
|
+
const starting = proc?.dot === 'starting'
|
|
51
|
+
// the process that serves it came up since the probe: the probe saw it down, ask again
|
|
52
|
+
const dot = useRef(proc?.dot)
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (dot.current !== proc?.dot && proc?.dot === 'up' && dot.current != null) void app.urls.probe(u.id, true)
|
|
55
|
+
dot.current = proc?.dot
|
|
56
|
+
}, [app, u.id, proc?.dot])
|
|
57
|
+
const reload = (): void => {
|
|
58
|
+
void app.urls.probe(u.id, true)
|
|
59
|
+
setEpoch((n) => n + 1)
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<UrlBar app={app} u={u} reload={reload} />
|
|
64
|
+
{app.urls.failed == null ? null : <div className="urlfail">the copy failed: {app.urls.failed}</div>}
|
|
65
|
+
{down ? (
|
|
66
|
+
<div className="urlnote">
|
|
67
|
+
<span>{proc.label} is {proc.dot}: it serves this url</span>
|
|
68
|
+
{m == null ? null : <button disabled={starting} onClick={() => void m.processAct(proc.id, 'start')}>{starting ? `starting ${proc.label}…` : `start ${proc.label}`}</button>}
|
|
69
|
+
</div>
|
|
70
|
+
) : 'src' in choice ? (
|
|
71
|
+
<iframe key={`${u.id}:${epoch}`} className="urlframe" src={choice.src} title={u.label} referrerPolicy="strict-origin" />
|
|
72
|
+
) : 'why' in choice ? (
|
|
73
|
+
<div className="urlnote">
|
|
74
|
+
<span>{choice.why}</span>
|
|
75
|
+
<a className="urlout" href={u.url} target="_blank" rel="noopener">open in a tab</a>
|
|
76
|
+
</div>
|
|
77
|
+
) : (
|
|
78
|
+
<div className="urlnote"><span>asking {choice.reading} how it answers…</span></div>
|
|
79
|
+
)}
|
|
80
|
+
</>
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const UrlsPage = observer(({ app, id }: { app: RepoSt; id: string | null }) => {
|
|
85
|
+
const { list, problem, loaded } = app.urls
|
|
86
|
+
const open = app.urls.find(id)
|
|
87
|
+
// the tree's leaves are the list while a url shows: the frame takes the whole page
|
|
88
|
+
if (open != null) return <div className="urlspage"><UrlStage app={app} u={open} /></div>
|
|
89
|
+
return (
|
|
90
|
+
<div className="urlspage">
|
|
91
|
+
<div className="urlshead">
|
|
92
|
+
<div className="chead">
|
|
93
|
+
<span className="tid">urls</span>
|
|
94
|
+
<h3 className="ctitle">{app.name}</h3>
|
|
95
|
+
</div>
|
|
96
|
+
{problem != null ? <div className="urlfail">{problem}</div> : null}
|
|
97
|
+
{loaded && list.length === 0 && problem == null ? <div className="dim">this repo lists no url: a global process with a url, a <code>urls([...])</code> unit or <code>smoke.base</code> adds one</div> : null}
|
|
98
|
+
<div className="urllist" role="list">
|
|
99
|
+
{list.map((u) => {
|
|
100
|
+
const proc = processOf(app, u)
|
|
101
|
+
return (
|
|
102
|
+
<button key={u.id} role="listitem" className="urlrow" onClick={() => app.showUrls(u.id)} title={`${u.url}, declared in ${u.file}`}>
|
|
103
|
+
<span className={`urlenv ${u.env}`}>{u.env}</span>
|
|
104
|
+
<i className={`pdot ${proc?.dot ?? (u.process == null ? 'none' : 'unknown')}`} />
|
|
105
|
+
<b>{u.label}</b>
|
|
106
|
+
{hostOf(u.url) === u.label ? null : <span className="urlhost">{hostOf(u.url)}</span>}
|
|
107
|
+
<span className="sp" />
|
|
108
|
+
<span className="dim">{u.logins.length === 0 ? '' : u.logins.map((l) => l.label).join(', ')}</span>
|
|
109
|
+
</button>
|
|
110
|
+
)
|
|
111
|
+
})}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
{id != null && loaded ? <div className="urlnote"><span>this repo lists no url {id}</span></div> : null}
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* the urls page (urls-view.tsx): a url opened is the bar of chips and the frame; with none opened, the list */
|
|
2
|
+
.urlspage{flex:1;min-height:0;display:flex;flex-direction:column}
|
|
3
|
+
.urlshead{flex:0 1 auto;min-height:0;overflow-y:auto;padding:var(--s3) var(--s4) var(--s2)}
|
|
4
|
+
.urlshead .chead{display:flex;align-items:baseline;gap:var(--s2);margin-bottom:var(--s2)}
|
|
5
|
+
.urlshead .ctitle{margin:0;font-size:15px}
|
|
6
|
+
.urlshead code{font:12px ui-monospace,Menlo,monospace}
|
|
7
|
+
.urllist{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:4px;background:var(--panel)}
|
|
8
|
+
.urllist:empty{display:none}
|
|
9
|
+
button.urlrow{display:flex;align-items:center;gap:var(--s2);width:100%;min-height:32px;padding:0 var(--s3);border:0;border-radius:0;border-bottom:1px solid var(--line);text-align:left;font-size:12.5px;cursor:pointer}
|
|
10
|
+
button.urlrow:last-child{border-bottom:0}
|
|
11
|
+
button.urlrow:hover{background:var(--panel2)}
|
|
12
|
+
.urlrow .sp,.urlbar .sp{flex:1}
|
|
13
|
+
.urlhost{font:11.5px ui-monospace,Menlo,monospace;color:var(--dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
|
|
14
|
+
.urlenv{flex:none;width:34px;text-align:center;font:10px ui-monospace,Menlo,monospace;letter-spacing:.04em;border:1px solid var(--line);border-radius:3px;color:var(--dim);line-height:16px}
|
|
15
|
+
.urlenv.prod{color:var(--warn);border-color:var(--warn)}
|
|
16
|
+
.pdot.none{visibility:hidden}
|
|
17
|
+
.urlbar{flex:none;display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap;padding:var(--s2) var(--s4);border-bottom:1px solid var(--line);background:var(--bg-top);font-size:12.5px}
|
|
18
|
+
.urllogin{display:inline-flex;align-items:center;gap:var(--s1);margin-left:var(--s2)}
|
|
19
|
+
button.urlchip{display:inline-flex;align-items:center;gap:var(--s1);min-height:26px;padding:0 var(--s2);font:12px ui-monospace,Menlo,monospace;cursor:pointer}
|
|
20
|
+
button.urlchip svg{width:13px;height:13px;flex:none}
|
|
21
|
+
button.urlchip.said{color:var(--ok);border-color:var(--ok)}
|
|
22
|
+
a.urlout{color:var(--accent);font-size:12px;white-space:nowrap}
|
|
23
|
+
.urlfail{flex:none;color:var(--red);font-size:12.5px;padding:var(--s2) var(--s4)}
|
|
24
|
+
.urlnote{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:var(--s2);padding:var(--s4);color:var(--dim);font-size:13px}
|
|
25
|
+
iframe.urlframe{flex:1;min-height:0;width:100%;border:0;display:block}
|
|
26
|
+
@media (max-width:700px){
|
|
27
|
+
.urlhost{display:none}
|
|
28
|
+
button.urlrow{min-height:44px}
|
|
29
|
+
button.urlchip{min-height:36px}
|
|
30
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// the vault page's state: `GET /api/home/vault` read while the page shows, the entry of its bar shown (in the address,
|
|
2
|
+
// `/vault#about`), and the list's filter (text, missing, a repo, an identity), kept per viewer. The words are
|
|
3
|
+
// `sk vault status`'s (home/vault-words.ts)
|
|
4
|
+
import { makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
5
|
+
import { keeps, NO_FILTER, scopesOf, type Fact, type RowFilter, type SecretRow, type VaultPage } from '../../home/vault-words.ts'
|
|
6
|
+
import type { EntryMark } from './entry-bar.tsx'
|
|
7
|
+
import { EntryPick } from './entry-pick.ts'
|
|
8
|
+
import type { HomeSt } from './home-st.ts'
|
|
9
|
+
import { ownTrouble, reach } from './reach.ts'
|
|
10
|
+
|
|
11
|
+
/** the page asks again by itself this often; the daemon keeps what it read of the vault an hour, so such a read costs
|
|
12
|
+
* the vault its health call alone, and only the refresh button reads everything again */
|
|
13
|
+
export const VAULT_POLL_MS = 5 * 60_000
|
|
14
|
+
const FILTER_KEY = 'home:vault:filter'
|
|
15
|
+
|
|
16
|
+
function keptFilter(): RowFilter {
|
|
17
|
+
try {
|
|
18
|
+
const v = JSON.parse(globalThis.localStorage?.getItem(FILTER_KEY) ?? 'null') as Partial<RowFilter> | null
|
|
19
|
+
return { ...NO_FILTER, ...(v != null && typeof v === 'object' ? v : {}) }
|
|
20
|
+
} catch {
|
|
21
|
+
return { ...NO_FILTER }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** the bar's entries, in their order: the names first, the page's default */
|
|
26
|
+
export const VAULT_ENTRIES = ['passwords', 'about', 'health', 'backups'] as const
|
|
27
|
+
export type VaultEntry = (typeof VAULT_ENTRIES)[number]
|
|
28
|
+
|
|
29
|
+
/** the facts an entry shows: the list's notes above the names, where it lives, how it stands, its copies */
|
|
30
|
+
export function factsOf(d: VaultPage, e: VaultEntry): Fact[] {
|
|
31
|
+
return e === 'passwords' ? d.notes : e === 'about' ? d.lives : e === 'health' ? d.stands : d.copies
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** an entry's dot: red when one of its facts is a DANGER, orange when one is to look at; its counts are the title */
|
|
35
|
+
export function entryMark(facts: readonly Fact[]): EntryMark {
|
|
36
|
+
const danger = facts.filter((f) => f.tone === 'danger').length
|
|
37
|
+
const warn = facts.filter((f) => f.tone === 'warn').length
|
|
38
|
+
const title = [danger > 0 ? `${danger} DANGER` : '', warn > 0 ? `${warn} to look at` : ''].filter((x) => x !== '').join(', ')
|
|
39
|
+
return { tone: danger > 0 ? 'red' : warn > 0 ? 'warn' : '', title }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class VaultSt {
|
|
43
|
+
data: VaultPage | null = null
|
|
44
|
+
error = ''
|
|
45
|
+
loading = false
|
|
46
|
+
filter: RowFilter = keptFilter()
|
|
47
|
+
/** the entry of the bar shown, as the address names it */
|
|
48
|
+
readonly pick = new EntryPick<VaultEntry>('/vault', VAULT_ENTRIES)
|
|
49
|
+
private timer: ReturnType<typeof setInterval> | null = null
|
|
50
|
+
private gen = 0
|
|
51
|
+
|
|
52
|
+
constructor(private st: HomeSt) {
|
|
53
|
+
makeAutoObservable<this, 'st' | 'timer' | 'gen'>(this, { st: false, timer: false, gen: false, pick: false, data: observableRef })
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get rows(): SecretRow[] {
|
|
57
|
+
const here = this.data?.here ?? false
|
|
58
|
+
return (this.data?.secrets ?? []).filter((r) => keeps(r, this.filter, here))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get scopes(): { repos: string[]; identities: string[] } {
|
|
62
|
+
return scopesOf(this.data?.secrets ?? [])
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get filtered(): boolean {
|
|
66
|
+
const f = this.filter
|
|
67
|
+
return f.text !== '' || f.missing || f.repo !== '' || f.identity !== ''
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
set(part: Partial<RowFilter>): void {
|
|
71
|
+
this.filter = { ...this.filter, ...part }
|
|
72
|
+
try { globalThis.localStorage?.setItem(FILTER_KEY, JSON.stringify(this.filter)) } catch { /* private window: the filter lasts the tab */ }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get entry(): VaultEntry {
|
|
76
|
+
return this.pick.entry
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** `/vault` on the names, `/vault#<entry>` on any other */
|
|
80
|
+
get address(): string {
|
|
81
|
+
return this.pick.address
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fromHash(hash: string): void {
|
|
85
|
+
this.pick.fromHash(hash)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
open(e: VaultEntry, how: 'push' | 'replace' = 'push'): void {
|
|
89
|
+
this.pick.open(e, how)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** every DANGER of the page with the entry that holds it: each stays on top whatever entry is open */
|
|
93
|
+
get dangers(): { f: Fact; entry: VaultEntry }[] {
|
|
94
|
+
const d = this.data
|
|
95
|
+
return d == null ? [] : VAULT_ENTRIES.flatMap((entry) => factsOf(d, entry).filter((f) => f.tone === 'danger').map((f) => ({ f, entry })))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** `fresh`: the refresh button, which reads the vault again whole */
|
|
99
|
+
async poll(fresh = false): Promise<void> {
|
|
100
|
+
const id = this.gen
|
|
101
|
+
this.loading = true
|
|
102
|
+
try {
|
|
103
|
+
const r = await reach(`/api/home/vault${fresh ? '?fresh=1' : ''}`, { signal: AbortSignal.timeout(8_000) })
|
|
104
|
+
if (!r.ok && r.status !== 503) throw new Error(`the daemon answers ${r.status} ${r.statusText} to /api/home/vault`)
|
|
105
|
+
const j = (await r.json()) as VaultPage | { refused: string }
|
|
106
|
+
if ('refused' in j) throw new Error(j.refused)
|
|
107
|
+
runInAction(() => { if (id === this.gen) { this.data = j; this.error = '' } })
|
|
108
|
+
} catch (e) {
|
|
109
|
+
runInAction(() => { if (id === this.gen) this.error = ownTrouble(e, this.st.machine) })
|
|
110
|
+
} finally {
|
|
111
|
+
runInAction(() => { this.loading = false })
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** reads while the page shows */
|
|
116
|
+
start(): void {
|
|
117
|
+
if (this.timer != null) return
|
|
118
|
+
void this.poll()
|
|
119
|
+
this.timer = setInterval(() => void this.poll(), VAULT_POLL_MS)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
stop(): void {
|
|
123
|
+
if (this.timer != null) clearInterval(this.timer)
|
|
124
|
+
this.timer = null
|
|
125
|
+
this.gen++
|
|
126
|
+
}
|
|
127
|
+
}
|