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
package/src/recordings/model.ts
CHANGED
|
@@ -165,7 +165,7 @@ export function moveRecording(r: Recording, repo: string): Recording {
|
|
|
165
165
|
m.repo = repo
|
|
166
166
|
writeMeta(to, m)
|
|
167
167
|
const db = mediaDb()
|
|
168
|
-
db?.query('update
|
|
168
|
+
db?.query('update media_files set store = ? where store = ? and item = ?').run(folder, join(r.root, r.repo), r.id)
|
|
169
169
|
return { ...m, dir: to, root: r.root }
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -361,7 +361,8 @@ final class KeyWindow: NSWindow {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
final class ChooseView: NSView {
|
|
364
|
-
|
|
364
|
+
// weak: a mouse or key event still in flight after the pick ended finds no chooser, and does nothing
|
|
365
|
+
weak var chooser: Chooser?
|
|
365
366
|
let screen: NSScreen
|
|
366
367
|
|
|
367
368
|
init(frame: NSRect, chooser: Chooser, screen: NSScreen) {
|
|
@@ -383,19 +384,20 @@ final class ChooseView: NSView {
|
|
|
383
384
|
|
|
384
385
|
private func local(_ r: NSRect) -> NSRect { r.offsetBy(dx: -screen.frame.minX, dy: -screen.frame.minY) }
|
|
385
386
|
|
|
386
|
-
override func mouseMoved(with e: NSEvent) { MainActor.assumeIsolated { chooser
|
|
387
|
-
override func mouseDown(with e: NSEvent) { MainActor.assumeIsolated { chooser
|
|
388
|
-
override func mouseDragged(with e: NSEvent) { MainActor.assumeIsolated { chooser
|
|
389
|
-
override func mouseUp(with e: NSEvent) { MainActor.assumeIsolated { chooser
|
|
387
|
+
override func mouseMoved(with e: NSEvent) { MainActor.assumeIsolated { chooser?.moved(global(e)) } }
|
|
388
|
+
override func mouseDown(with e: NSEvent) { MainActor.assumeIsolated { chooser?.down(global(e)) } }
|
|
389
|
+
override func mouseDragged(with e: NSEvent) { MainActor.assumeIsolated { chooser?.dragged(global(e)) } }
|
|
390
|
+
override func mouseUp(with e: NSEvent) { MainActor.assumeIsolated { chooser?.up(global(e)) } }
|
|
390
391
|
override func keyDown(with e: NSEvent) {
|
|
391
392
|
MainActor.assumeIsolated {
|
|
392
|
-
if e.keyCode == UInt16(kVK_Escape) { chooser
|
|
393
|
-
if e.keyCode == UInt16(kVK_Return) { chooser
|
|
393
|
+
if e.keyCode == UInt16(kVK_Escape) { chooser?.cancel() }
|
|
394
|
+
if e.keyCode == UInt16(kVK_Return) { chooser?.go() }
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
|
|
397
398
|
override func draw(_ dirty: NSRect) {
|
|
398
399
|
MainActor.assumeIsolated {
|
|
400
|
+
guard let chooser else { return }
|
|
399
401
|
if let f = chooser.frozen, f.screen === screen { NSGraphicsContext.current?.cgContext.draw(f.image, in: bounds) }
|
|
400
402
|
let lit: NSRect? = chooser.chosen ?? chooser.dragRect ?? chooser.hover?.frame
|
|
401
403
|
let shade = NSBezierPath(rect: bounds)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// the prompts the hq keeps of a repo, beside the local transcripts: Claude Code deletes a transcript after its
|
|
2
|
+
// retention, the hq never does (hq/kinds/prompt.ts). On the machine that carries the hq they are read from its file,
|
|
3
|
+
// read only; on another machine through the node's own read route, inside its grant. A row's text is as the hq keeps
|
|
4
|
+
// it: masked, cut
|
|
5
|
+
import { Database } from 'bun:sqlite'
|
|
6
|
+
import { existsSync } from 'fs'
|
|
7
|
+
import { READ_MAX_ROWS, type Refused } from '../hq/hq-store.ts'
|
|
8
|
+
import type { ReadLink } from '../hq/hq-routes.ts'
|
|
9
|
+
import { promptId, promptKind, type PromptBody } from '../hq/kinds/prompt.ts'
|
|
10
|
+
import type { PromptEntry } from './prompt-corpus.ts'
|
|
11
|
+
|
|
12
|
+
/** a prompt the hq keeps, as its read gives it */
|
|
13
|
+
export type HqPrompt = PromptBody & { node?: string }
|
|
14
|
+
|
|
15
|
+
/** where a prompt of the merged corpus came from, and what the hq did to it */
|
|
16
|
+
export type MergedEntry = PromptEntry & { from: 'here' | 'hq' | 'both'; cut?: number; masked?: number }
|
|
17
|
+
|
|
18
|
+
/** every prompt the hq keeps of one repo, oldest first: from its file (`file`), else through a node's link */
|
|
19
|
+
export async function readHqPrompts(repo: string, o: { file?: string; link?: Pick<ReadLink, 'read'> }): Promise<{ rows: HqPrompt[] } | Refused> {
|
|
20
|
+
const rows: HqPrompt[] = []
|
|
21
|
+
let after = ''
|
|
22
|
+
if (o.file != null && existsSync(o.file)) {
|
|
23
|
+
const db = new Database(o.file, { readonly: true })
|
|
24
|
+
try {
|
|
25
|
+
for (;;) {
|
|
26
|
+
const page = promptKind.read!.page(db, { repos: [repo], node: null, since: 0, after, limit: READ_MAX_ROWS })
|
|
27
|
+
rows.push(...(page.rows as HqPrompt[]))
|
|
28
|
+
if (page.next == null) return { rows }
|
|
29
|
+
after = page.next
|
|
30
|
+
}
|
|
31
|
+
} finally {
|
|
32
|
+
db.close()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (o.link == null) return { refused: 'this machine neither carries the hq nor joined one' }
|
|
36
|
+
for (;;) {
|
|
37
|
+
const page = await o.link.read('prompt', { repo, after })
|
|
38
|
+
if ('refused' in page) return page
|
|
39
|
+
rows.push(...(page.rows as HqPrompt[]))
|
|
40
|
+
if (page.next == null) return { rows }
|
|
41
|
+
after = page.next
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** the local prompts and the hq's, by prompt id, each once, in time order: a local text wins (unmasked, uncut),
|
|
46
|
+
* a prompt only the hq keeps comes with its marks */
|
|
47
|
+
export function mergeHq(local: PromptEntry[], hq: HqPrompt[]): MergedEntry[] {
|
|
48
|
+
const out = new Map<string, MergedEntry>()
|
|
49
|
+
for (const p of local) out.set(promptId(p.uuid, Date.parse(p.timestamp), p.text), { ...p, from: 'here' })
|
|
50
|
+
for (const r of hq) {
|
|
51
|
+
const held = out.get(r.id)
|
|
52
|
+
if (held != null) held.from = 'both'
|
|
53
|
+
else out.set(r.id, { uuid: r.id, timestamp: new Date(r.at).toISOString(), sessionId: r.session, account: r.account, text: r.text, origin: r.origin, from: 'hq', cut: r.cut, masked: r.masked })
|
|
54
|
+
}
|
|
55
|
+
return [...out.values()].sort((a, b) => a.timestamp.localeCompare(b.timestamp))
|
|
56
|
+
}
|
|
@@ -198,7 +198,9 @@ export function corpusMarkdown(repoPath: string, prompts: PromptEntry[]): string
|
|
|
198
198
|
const lines: string[] = [`# prompt corpus — ${resolve(repoPath)} (${count})`, '']
|
|
199
199
|
prompts.forEach((p, i) => {
|
|
200
200
|
const when = p.timestamp.replace('T', ' ').slice(0, 16)
|
|
201
|
-
const
|
|
201
|
+
const hq = p as PromptEntry & { from?: string; cut?: number; masked?: number }
|
|
202
|
+
const marks = hq.from === 'hq' ? [`from the hq${hq.masked ? `, ${hq.masked} masked` : ''}${hq.cut ? ', cut' : ''}`] : []
|
|
203
|
+
const tag = `${p.origin === 'queued' ? ' · queued' : ''}${marks.map((m) => ` · ${m}`).join('')}`
|
|
202
204
|
lines.push(`## ${i + 1} · ${when} · ${p.account} · ${p.sessionId.slice(0, 8)}${tag}`, '', fenced(p.text), '')
|
|
203
205
|
})
|
|
204
206
|
return `${lines.join('\n')}\n`
|
|
@@ -32,30 +32,43 @@ export type Outcome = 'ok' | 'exit' | 'timeout' | 'blocked' | 'denied' | 'interr
|
|
|
32
32
|
export type TranscriptEvent =
|
|
33
33
|
/** a prompt the human typed; `queued` = typed while the agent worked */
|
|
34
34
|
| { kind: 'prompt'; at: number; timestamp: string; uuid: string | null; sessionId: string | null; text: string; origin: PromptOrigin }
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** something he did that is no prompt: a slash command, an interrupt */
|
|
36
|
+
| { kind: 'act'; at: number }
|
|
37
|
+
/** a user-role turn nobody typed that wakes the agent: a task of its own
|
|
38
|
+
* that ended, a watch that delivered an event, a sub-agent hand-back, a
|
|
39
|
+
* script-driven prompt */
|
|
37
40
|
| { kind: 'wake'; at: number }
|
|
41
|
+
/** a watch (Monitor) that ran out with no event to deliver: the harness
|
|
42
|
+
* tells the agent, which arms it again. Nothing of the agent's own ended */
|
|
43
|
+
| { kind: 'lapse'; at: number }
|
|
38
44
|
/** a message relayed into the agent (the coordinator, the human, another
|
|
39
|
-
* session
|
|
40
|
-
* hours after the agent handed back */
|
|
45
|
+
* session): it can end a park of hours after the agent handed back */
|
|
41
46
|
| { kind: 'message'; at: number }
|
|
42
|
-
|
|
47
|
+
/** `msg`: the id of the assistant message that carries it, the same for every call of one turn.
|
|
48
|
+
* `model`, `ctx`, `out`: the model of that message, the tokens it read (input, cache read and cache
|
|
49
|
+
* write) and the tokens it wrote; every entry of a message carries the message's whole usage */
|
|
50
|
+
| { kind: 'use'; at: number; id: string; name: string; detail: string; msg?: string; model?: string; ctx?: number; out?: number }
|
|
43
51
|
/** `perm`: how the call was allowed; `user` = it waited for the human, so its time is his.
|
|
44
52
|
* `bg`: the call returned while its command runs on in the background
|
|
45
53
|
* (started so, or moved there at its timeout); its real end is a `bgend` */
|
|
46
|
-
| { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm; bg: boolean }
|
|
54
|
+
| { kind: 'result'; at: number; id: string; outcome: Outcome; code: number | null; perm: Perm; bg: boolean; /** what refused the call, in the harness's own words: only for a blocked or a denied one */ why?: string }
|
|
47
55
|
/** a background run's task notification: the call `id` ended at `at`. One
|
|
48
56
|
* run can be written two or three times (queued, then delivered): the
|
|
49
57
|
* earliest is its end */
|
|
50
58
|
| { kind: 'bgend'; at: number; id: string; outcome: Outcome; code: number | null }
|
|
51
|
-
/** an assistant text block: the agent talking, which can end its turn
|
|
59
|
+
/** an assistant text block: the agent talking, which can end its turn;
|
|
60
|
+
* also the output of a slash command, written when the command is done
|
|
61
|
+
* (a /compact: when its summary request returned) */
|
|
52
62
|
| { kind: 'reply'; at: number }
|
|
53
|
-
/** the text block that ends the turn (stop_reason end_turn)
|
|
54
|
-
*
|
|
63
|
+
/** the text block that ends the turn (stop_reason end_turn), or the API
|
|
64
|
+
* refusing the request (a limit, a login): the agent stopped, and what
|
|
65
|
+
* follows is a wait until something wakes it */
|
|
55
66
|
| { kind: 'end'; at: number }
|
|
56
|
-
/** a hook run the harness timed
|
|
57
|
-
* something, so a silent
|
|
58
|
-
*
|
|
67
|
+
/** a hook run the harness timed. A hook on a tool call or a prompt is
|
|
68
|
+
* written only when it printed something, so a silent one leaves none;
|
|
69
|
+
* the hooks of a turn's end are all written, silent or not. `tool` is ''
|
|
70
|
+
* on an event of no tool (a prompt, a turn end); `id` is the call it ran
|
|
71
|
+
* on, or the hook's own id */
|
|
59
72
|
| { kind: 'hook'; at: number; id: string; event: string; tool: string; command: string; ms: number; code: number | null; error: boolean }
|
|
60
73
|
|
|
61
74
|
// wrappers the harness injects as user-role entries: none of them are typed
|
|
@@ -86,6 +99,14 @@ type Block = { type?: unknown; text?: unknown; id?: unknown; name?: unknown; inp
|
|
|
86
99
|
|
|
87
100
|
export type RawEntry = {
|
|
88
101
|
type?: unknown
|
|
102
|
+
/** system entries only: `local_command` is a slash command he ran,
|
|
103
|
+
* `stop_hook_summary` the hooks of a turn's end with the time of each */
|
|
104
|
+
subtype?: unknown
|
|
105
|
+
hookInfos?: unknown
|
|
106
|
+
hookErrors?: unknown
|
|
107
|
+
toolUseID?: unknown
|
|
108
|
+
/** an assistant entry the harness wrote in place of an answer the API refused */
|
|
109
|
+
isApiErrorMessage?: unknown
|
|
89
110
|
entrypoint?: unknown
|
|
90
111
|
uuid?: unknown
|
|
91
112
|
timestamp?: unknown
|
|
@@ -111,20 +132,23 @@ export type RawEntry = {
|
|
|
111
132
|
|
|
112
133
|
const stripReminders = (text: string): string => text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '').trim()
|
|
113
134
|
|
|
114
|
-
/** the
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
function
|
|
135
|
+
/** the text of a user entry as the harness wrote it, reminders stripped; null
|
|
136
|
+
* when it carries no text at all (a pure tool_result turn). Content is a
|
|
137
|
+
* string for a plain prompt, an array of blocks when the message carried
|
|
138
|
+
* pastes or attachments (the text blocks in there are still his). */
|
|
139
|
+
function writtenText(entry: RawEntry): string | null {
|
|
119
140
|
const content = entry.message?.content
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
if (typeof content === 'string') return stripReminders(content)
|
|
142
|
+
if (!Array.isArray(content)) return null
|
|
143
|
+
const parts = (content as Block[]).filter((b) => b?.type === 'text' && typeof b?.text === 'string').map((b) => b.text as string)
|
|
144
|
+
return parts.length === 0 ? null : stripReminders(parts.join('\n'))
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** the user text of a user entry: its written text, a slash command's typed
|
|
148
|
+
* args rescued */
|
|
149
|
+
function userText(entry: RawEntry): string | null {
|
|
150
|
+
let text = writtenText(entry)
|
|
151
|
+
if (text == null) return null
|
|
128
152
|
// a slash-command entry is a harness WRAPPER around typed text:
|
|
129
153
|
// <command-name>/cmd</command-name><command-args>THE TEXT</command-args>.
|
|
130
154
|
// Dropping the whole entry throws away real instructions and repro pastes.
|
|
@@ -181,6 +205,8 @@ export function outcomeOf(r: { isError: boolean; text: string; extra: unknown })
|
|
|
181
205
|
}
|
|
182
206
|
|
|
183
207
|
const DETAIL_MAX = 400
|
|
208
|
+
/** enough of a refusal to name who refused and why */
|
|
209
|
+
const WHY_MAX = 600
|
|
184
210
|
const clip = (s: string): string => (s.length > DETAIL_MAX ? s.slice(0, DETAIL_MAX) : s)
|
|
185
211
|
|
|
186
212
|
/** a long command keeps its head and its tail: what runs after a heredoc
|
|
@@ -216,6 +242,18 @@ export function parseEntry(line: string): RawEntry | null {
|
|
|
216
242
|
|
|
217
243
|
export type Usage = { messageId: string; input: number; output: number; cacheRead: number; cacheWrite: number; model: string }
|
|
218
244
|
|
|
245
|
+
/** the model and the size of the turn an assistant entry belongs to: what it read and what it wrote, in tokens;
|
|
246
|
+
* nothing for an entry that says neither */
|
|
247
|
+
function turnOf(entry: RawEntry): { model?: string; ctx?: number; out?: number } {
|
|
248
|
+
const m = entry.message
|
|
249
|
+
const u = m?.usage
|
|
250
|
+
const n = (v: unknown): number => (typeof v === 'number' ? v : 0)
|
|
251
|
+
return {
|
|
252
|
+
...(typeof m?.model === 'string' ? { model: m.model } : {}),
|
|
253
|
+
...(u == null ? {} : { ctx: n(u.input_tokens) + n(u.cache_read_input_tokens) + n(u.cache_creation_input_tokens), out: n(u.output_tokens) }),
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
219
257
|
/** the token usage an assistant entry carries. The harness writes one entry per
|
|
220
258
|
* content block, each with the same message id and usage, so a reader counts
|
|
221
259
|
* each message id once */
|
|
@@ -275,13 +313,18 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
|
|
|
275
313
|
if (entry.type === 'assistant') {
|
|
276
314
|
const blocks = Array.isArray(entry.message?.content) ? (entry.message.content as Block[]) : []
|
|
277
315
|
const out: TranscriptEvent[] = []
|
|
278
|
-
const ends = entry.message?.stop_reason === 'end_turn'
|
|
316
|
+
const ends = entry.message?.stop_reason === 'end_turn' || entry.isApiErrorMessage === true
|
|
279
317
|
for (const b of blocks) {
|
|
280
|
-
if (b?.type === 'tool_use' && typeof b.id === 'string' && typeof b.name === 'string') out.push({ kind: 'use', at, id: b.id, name: b.name, detail: detailOf(b.name, b.input) })
|
|
318
|
+
if (b?.type === 'tool_use' && typeof b.id === 'string' && typeof b.name === 'string') out.push({ kind: 'use', at, id: b.id, name: b.name, detail: detailOf(b.name, b.input), ...(typeof entry.message?.id === 'string' ? { msg: entry.message.id } : {}), ...turnOf(entry) })
|
|
281
319
|
else if (b?.type === 'text') out.push({ kind: ends ? 'end' : 'reply', at })
|
|
282
320
|
}
|
|
283
321
|
return out
|
|
284
322
|
}
|
|
323
|
+
if (entry.type === 'system') {
|
|
324
|
+
if (entry.subtype === 'stop_hook_summary') return stopHooksOf(entry, at)
|
|
325
|
+
const kind = entry.subtype === 'local_command' && typeof entry.content === 'string' ? commandOf(entry.content.trim()) : null
|
|
326
|
+
return kind == null ? [] : [{ kind, at }]
|
|
327
|
+
}
|
|
285
328
|
if (entry.type !== 'user') return []
|
|
286
329
|
const out: TranscriptEvent[] = []
|
|
287
330
|
const content = entry.message?.content
|
|
@@ -291,24 +334,47 @@ export function eventsOf(entry: RawEntry): TranscriptEvent[] {
|
|
|
291
334
|
const bg = typeof extra.backgroundTaskId === 'string'
|
|
292
335
|
for (const b of content as Block[]) {
|
|
293
336
|
if (b?.type !== 'tool_result' || typeof b.tool_use_id !== 'string' || Number.isNaN(at)) continue
|
|
294
|
-
const
|
|
295
|
-
|
|
337
|
+
const text = resultText(b.content)
|
|
338
|
+
const o = outcomeOf({ isError: b.is_error === true, text, extra })
|
|
339
|
+
const refused = o.outcome === 'blocked' || o.outcome === 'denied'
|
|
340
|
+
out.push({ kind: 'result', at, id: b.tool_use_id, ...o, perm, bg, ...(refused ? { why: text.replace(/\s+/g, ' ').slice(0, WHY_MAX) } : {}) })
|
|
296
341
|
}
|
|
297
342
|
}
|
|
298
343
|
const typed = typedPromptOf(entry)
|
|
299
344
|
if (typed != null) out.push(prompt(typed, 'typed'))
|
|
300
345
|
if (out.length > 0 || Number.isNaN(at)) return out
|
|
301
|
-
const text =
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
if (text != null && text !== '') out.push({ kind: 'wake', at })
|
|
307
|
-
}
|
|
308
|
-
if (text != null) out.push(...bgEndsOf(text, at))
|
|
346
|
+
const text = writtenText(entry)
|
|
347
|
+
if (text == null) return out
|
|
348
|
+
const kind = untypedOf(entry, text)
|
|
349
|
+
if (kind != null) out.push({ kind, at })
|
|
350
|
+
out.push(...bgEndsOf(text, at))
|
|
309
351
|
return out
|
|
310
352
|
}
|
|
311
353
|
|
|
354
|
+
/** the wrappers of what he does at the keyboard that is no prompt: a slash
|
|
355
|
+
* command (its output is apart: written when the command is done) and an interrupt */
|
|
356
|
+
const HIS_ACT = ['<command-name>', '<command-message>', '[Request interrupted']
|
|
357
|
+
const COMMAND_OUT = '<local-command-stdout>'
|
|
358
|
+
|
|
359
|
+
const commandOf = (text: string): 'act' | 'reply' | null => (text.startsWith(COMMAND_OUT) ? 'reply' : HIS_ACT.some((p) => text.startsWith(p)) ? 'act' : null)
|
|
360
|
+
|
|
361
|
+
/** what a user-role entry nobody typed is to the agent's time: his act, a
|
|
362
|
+
* relayed message, a wake, or nothing */
|
|
363
|
+
function untypedOf(entry: RawEntry, text: string): 'act' | 'reply' | 'message' | 'wake' | 'lapse' | null {
|
|
364
|
+
if (entry.isMeta === true && RELAYED.test(text)) return 'message'
|
|
365
|
+
if (entry.isCompactSummary === true || text === '') return null
|
|
366
|
+
if (entry.isMeta !== true) {
|
|
367
|
+
const his = commandOf(text)
|
|
368
|
+
if (his != null) return his
|
|
369
|
+
}
|
|
370
|
+
// a peer message (a sub-agent hand-back, another session's message) and a
|
|
371
|
+
// sub-agent's task notification are written isMeta, yet they reach the agent
|
|
372
|
+
if (entry.isMeta === true && entry.turnOrigin !== 'peer' && entry.origin?.kind !== 'task-notification') return null
|
|
373
|
+
if (text.includes('<task-notification>')) return noticeOf(text)
|
|
374
|
+
// another session wrote: no task of this one ended
|
|
375
|
+
return text.includes('<cross-session-message') ? 'message' : 'wake'
|
|
376
|
+
}
|
|
377
|
+
|
|
312
378
|
/** a timed hook record: its event, the tool from `PostToolUse:Edit`, its
|
|
313
379
|
* command as the settings name it, its duration */
|
|
314
380
|
function hookOf(a: NonNullable<RawEntry['attachment']>, at: number): TranscriptEvent[] {
|
|
@@ -319,9 +385,35 @@ function hookOf(a: NonNullable<RawEntry['attachment']>, at: number): TranscriptE
|
|
|
319
385
|
return [{ kind: 'hook', at, id, event: a.hookEvent, tool, command: a.command, ms: a.durationMs, code: typeof a.exitCode === 'number' ? a.exitCode : null, error: a.type === 'hook_non_blocking_error' }]
|
|
320
386
|
}
|
|
321
387
|
|
|
388
|
+
/** the hooks of a turn's end, each a timed run: the summary names every one
|
|
389
|
+
* that ran, with its time, whether it printed or not. An error the summary
|
|
390
|
+
* reports is not tied to one hook, so it marks each run of that turn end */
|
|
391
|
+
function stopHooksOf(entry: RawEntry, at: number): TranscriptEvent[] {
|
|
392
|
+
const infos = Array.isArray(entry.hookInfos) ? (entry.hookInfos as { command?: unknown; durationMs?: unknown }[]) : []
|
|
393
|
+
const base = typeof entry.toolUseID === 'string' && entry.toolUseID !== '' ? entry.toolUseID : String(at)
|
|
394
|
+
const error = Array.isArray(entry.hookErrors) && entry.hookErrors.length > 0
|
|
395
|
+
const event = entry.isSidechain === true ? 'SubagentStop' : 'Stop'
|
|
396
|
+
const out: TranscriptEvent[] = []
|
|
397
|
+
infos.forEach((h, i) => {
|
|
398
|
+
if (typeof h?.command !== 'string' || typeof h.durationMs !== 'number') return
|
|
399
|
+
out.push({ kind: 'hook', at, id: i === 0 ? base : `${base}#${i}`, event, tool: '', command: h.command, ms: h.durationMs, code: null, error })
|
|
400
|
+
})
|
|
401
|
+
return out
|
|
402
|
+
}
|
|
403
|
+
|
|
322
404
|
const NOTICE = /<task-notification>([\s\S]*?)<\/task-notification>/g
|
|
323
405
|
const tagOf = (body: string, name: string): string | null => new RegExp(`<${name}>([^<]*)</${name}>`).exec(body)?.[1]?.trim() ?? null
|
|
324
406
|
|
|
407
|
+
/** what a notification text is to a stopped agent. A `stopped` notice counts
|
|
408
|
+
* for nothing: runs the harness lost at a session's end, written when he
|
|
409
|
+
* opens the session again, so his act and no task ending. A watch that ran
|
|
410
|
+
* out in silence is a `lapse`. Anything else wakes it */
|
|
411
|
+
function noticeOf(text: string): 'wake' | 'lapse' | null {
|
|
412
|
+
const notices = [...text.matchAll(NOTICE)].map((m) => m[1] ?? '').filter((body) => tagOf(body, 'status') !== 'stopped')
|
|
413
|
+
if (notices.length === 0) return text.includes('</task-notification>') ? null : 'wake'
|
|
414
|
+
return notices.every((body) => body.includes('<event>[Monitor expired after')) ? 'lapse' : 'wake'
|
|
415
|
+
}
|
|
416
|
+
|
|
325
417
|
/** the background runs a notification text says ended: each one that names
|
|
326
418
|
* its call and a final status. `stopped` is a run the harness lost track of
|
|
327
419
|
* (its session ended first): no end is known, so none is given */
|
|
@@ -54,7 +54,7 @@ export function classifyReflection(text: string): ReflectionKind {
|
|
|
54
54
|
export type Reflection = ReflectionKind & { file: string; title: string; unreadable: boolean }
|
|
55
55
|
|
|
56
56
|
/** the first heading, which is the line whoever logged it wrote to name it */
|
|
57
|
-
const firstHeading = (text: string): string | null =>
|
|
57
|
+
export const firstHeading = (text: string): string | null =>
|
|
58
58
|
text.split('\n').find((l) => /^\s*#{1,6}\s+\S/.test(l))?.replace(/^\s*#{1,6}\s+/, '').trim() ?? null
|
|
59
59
|
|
|
60
60
|
/** every file still pending. README.md is the scaffold's own seed, written
|
|
@@ -39,7 +39,8 @@ export function linkModules(repo: string, dir: string, nms: string[] = moduleDir
|
|
|
39
39
|
continue
|
|
40
40
|
}
|
|
41
41
|
const inRepo = st.isSymbolicLink() ? relative(repo, resolve(from, readlinkSync(entry))) : ''
|
|
42
|
-
|
|
42
|
+
// a link into a folder git ignores (a package built into .shipkit/cache) has no copy in the checkout: the repo's
|
|
43
|
+
const workspace = inRepo !== '' && !inRepo.startsWith('..') && !isAbsolute(inRepo) && !inRepo.split(sep).includes('node_modules') && existsSync(join(dir, inRepo))
|
|
43
44
|
symlinkSync(workspace ? join(dir, inRepo) : entry, join(dir, nm, name))
|
|
44
45
|
}
|
|
45
46
|
}
|
package/src/release/git-facts.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// import it without dragging the gate in.
|
|
5
5
|
import type { RepoConfig } from '../repo-config.ts'
|
|
6
6
|
import { gitBin } from '../core/git-bin.ts'
|
|
7
|
+
import { realGit } from '../core/git.ts'
|
|
7
8
|
import { CI_LOG_DIR, LAYOUT } from '../core/layout.ts'
|
|
8
9
|
|
|
9
10
|
export function git(root: string, args: string[]): { code: number; out: string } {
|
|
10
|
-
const
|
|
11
|
-
return { code:
|
|
11
|
+
const r = realGit.runSync(root, args)
|
|
12
|
+
return { code: r.code, out: `${r.out}${r.err}`.trim() }
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/** the push remote: the current branch's upstream when it has one, else the
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// the words that name the owner's machines, for what a unit publishes (release/public-clean.ts): the name this
|
|
2
|
+
// machine keeps, the tailnet's label, the dns label and addresses of each node of that tailnet, each ip address
|
|
3
|
+
// ~/.ssh/config reaches a host by. Read from the machine that runs the scan, so a machine is covered the day it
|
|
4
|
+
// joins, and this file names none
|
|
5
|
+
import { readFileSync } from 'fs'
|
|
6
|
+
import { homedir } from 'os'
|
|
7
|
+
import { join } from 'path'
|
|
8
|
+
import { machineName, readTailscaleStatus, type TailnetStatus } from '../home/machine-host.ts'
|
|
9
|
+
import type { HouseWord } from './public-clean.ts'
|
|
10
|
+
|
|
11
|
+
/** `off`: no machine is read (the test preload, so a suite never scans with the real ones) */
|
|
12
|
+
export const MACHINE_WORDS_ENV = 'SHIPKIT_MACHINE_WORDS'
|
|
13
|
+
|
|
14
|
+
const MIN = 4
|
|
15
|
+
const IP = /^(\d{1,3}(\.\d{1,3}){3}|[0-9a-f]*:[0-9a-f:]+)$/i
|
|
16
|
+
const label = (dns: string | undefined): string | undefined => dns?.split('.')[0]
|
|
17
|
+
/** a name that is a plain word (`ubuntu`, `server`, `localhost`) names no machine: one needs a digit or a dash */
|
|
18
|
+
const named = (name: string | null | undefined): string | null => (name != null && /[\d-]/.test(name) ? name : null)
|
|
19
|
+
|
|
20
|
+
/** the whole list, with no machine in it. A node counts by its dns label, never by its OS host name, which is often a
|
|
21
|
+
* product name (`MacBook Pro`); a node of another tailnet (a shared one, a vpn exit) is not the owner's. A host of
|
|
22
|
+
* the ssh config counts by its ip only: an alias or a dns name there is as often a public host (`github.com`) */
|
|
23
|
+
export function machineWords(o: { name: string | null; tailnet: TailnetStatus | null; sshConfig: string }): HouseWord[] {
|
|
24
|
+
const out: HouseWord[] = []
|
|
25
|
+
const add = (word: string | null | undefined, what: string): void => {
|
|
26
|
+
const w = (word ?? '').trim()
|
|
27
|
+
if (w.length >= MIN && !out.some((x) => x.word.toLowerCase() === w.toLowerCase())) out.push({ word: w, what })
|
|
28
|
+
}
|
|
29
|
+
add(named(o.name), 'a machine name')
|
|
30
|
+
const suffix = o.tailnet?.MagicDNSSuffix?.replace(/\.$/, '').toLowerCase()
|
|
31
|
+
add(label(suffix), 'a tailnet name')
|
|
32
|
+
for (const node of [o.tailnet?.Self, ...Object.values(o.tailnet?.Peer ?? {})]) {
|
|
33
|
+
const dns = node?.DNSName?.replace(/\.$/, '').toLowerCase()
|
|
34
|
+
if (dns == null || suffix == null || !dns.endsWith(`.${suffix}`)) continue
|
|
35
|
+
add(named(label(dns)), 'a machine name')
|
|
36
|
+
for (const ip of node?.TailscaleIPs ?? []) add(ip, 'a machine address')
|
|
37
|
+
}
|
|
38
|
+
for (const m of o.sshConfig.matchAll(/^[ \t]*hostname[ \t=]+"?([^\s"]+)/gim)) if (IP.test(m[1]!)) add(m[1], 'a machine address')
|
|
39
|
+
return out
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const KEEP_MS = 60_000
|
|
43
|
+
let kept: { at: number; home: string; value: { words: HouseWord[]; notes: string[] } } | undefined
|
|
44
|
+
|
|
45
|
+
/** this machine's words, read once a minute a process: the cache key and each unit's scan ask in one run */
|
|
46
|
+
export function readMachineWords(home = homedir(), now = Date.now()): { words: HouseWord[]; notes: string[] } {
|
|
47
|
+
if (process.env[MACHINE_WORDS_ENV] === 'off') return { words: [], notes: [`${MACHINE_WORDS_ENV}=off: no machine is scanned`] }
|
|
48
|
+
if (kept != null && kept.home === home && now - kept.at < KEEP_MS) return kept.value
|
|
49
|
+
const tailnet = readTailscaleStatus()
|
|
50
|
+
let name: string | null = null
|
|
51
|
+
try {
|
|
52
|
+
name = machineName()
|
|
53
|
+
} catch {
|
|
54
|
+
// a host name with no letter or digit names nothing
|
|
55
|
+
}
|
|
56
|
+
let sshConfig = ''
|
|
57
|
+
try {
|
|
58
|
+
sshConfig = readFileSync(join(home, '.ssh', 'config'), 'utf8')
|
|
59
|
+
} catch {
|
|
60
|
+
// no ssh config: no address from it
|
|
61
|
+
}
|
|
62
|
+
const words = machineWords({ name, tailnet, sshConfig })
|
|
63
|
+
const notes = tailnet == null ? ['no tailscale answers on this machine: no tailnet machine is scanned'] : words.some((w) => w.what === 'a tailnet name') ? [] : ['tailscale answers with no tailnet name: no tailnet machine is scanned']
|
|
64
|
+
const value = { words, notes }
|
|
65
|
+
kept = { at: now, home, value }
|
|
66
|
+
return value
|
|
67
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// what an npm unit publishes names nothing of the house (wiki tools/shipkit/units.md): the file list is npm's own
|
|
2
|
-
// pack list, the words come from the data (house repos, identities, the keyword file), so a
|
|
3
|
-
// covered the day it exists. A hit reports file:line and the masked word, never
|
|
2
|
+
// pack list, the words come from the data (house repos, identities, the owner's machines, the keyword file), so a
|
|
3
|
+
// new repo, identity or machine is covered the day it exists. A hit reports file:line and the masked word, never
|
|
4
|
+
// the word
|
|
4
5
|
import { createHash } from 'crypto'
|
|
5
6
|
import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
|
|
6
7
|
import { homedir } from 'os'
|
|
@@ -8,12 +9,14 @@ import { dirname, join, relative } from 'path'
|
|
|
8
9
|
import { scanFleet } from '../fleet/scan-fleet.ts'
|
|
9
10
|
import { evaluateLeak, globalAllowFile, withBuiltinRows, globalKeywordFile, leakAllowProblem, loadAllowFile, maskPattern, occurrences, parsePatterns, patternFingerprint, type LoadedAllow } from '../hooks/leak-guard.ts'
|
|
10
11
|
import { readIdentities, type Identities } from '../identities/identities.ts'
|
|
11
|
-
import { KEYWORD_FILE
|
|
12
|
+
import { KEYWORD_FILE } from '../core/layout.ts'
|
|
13
|
+
import { HOUSE_LAYOUT } from '../core/house-layout.ts'
|
|
12
14
|
import { parseDirectives, reaches } from '../core/waivers.ts'
|
|
13
15
|
import { fileStamp } from '../core/file-stamp.ts'
|
|
14
16
|
import { gitRoot } from '../core/git-root.ts'
|
|
15
17
|
import { houseIndex, houseRepos } from '../serve/project-gutter.ts'
|
|
16
18
|
import type { RepoConfig } from '../repo-config.ts'
|
|
19
|
+
import { readMachineWords } from './machine-words.ts'
|
|
17
20
|
|
|
18
21
|
/** a word the tarball may not carry, and what it is (never the word itself) */
|
|
19
22
|
export type HouseWord = { word: string; what: string }
|
|
@@ -61,7 +64,7 @@ export function houseIdentitiesDir(root: string, home = homedir()): string | nul
|
|
|
61
64
|
if (env) return env
|
|
62
65
|
const index = houseIndex(houseRepos(root, home).home, home)
|
|
63
66
|
const top = index == null ? null : gitRoot(dirname(index))?.top
|
|
64
|
-
return top == null ? null : join(top,
|
|
67
|
+
return top == null ? null : join(top, HOUSE_LAYOUT.identities)
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
const host = (url: string): string => {
|
|
@@ -248,10 +251,12 @@ export async function publicClean(root: string, config: RepoConfig, unit: { dir:
|
|
|
248
251
|
else for (const i of ids.identities) for (const f of [i.file, ...i.accounts.map((a) => a.file)]) read(f)
|
|
249
252
|
const allow = publicAllow(config, read)
|
|
250
253
|
notes.push(...allow.notes)
|
|
254
|
+
const machines = readMachineWords()
|
|
255
|
+
notes.push(...machines.notes)
|
|
251
256
|
const scanned = scanPublic({
|
|
252
257
|
rel,
|
|
253
258
|
files,
|
|
254
|
-
words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids))],
|
|
259
|
+
words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids)), ...machines.words],
|
|
255
260
|
keywordText: withBuiltinRows(kwFiles.map((f) => read(f) ?? '')),
|
|
256
261
|
allowedWords: allowedWords(pkg),
|
|
257
262
|
allow: allow.entries,
|
|
@@ -312,6 +317,7 @@ export function publicCleanKey(root: string, units: { dir: string }[]): string {
|
|
|
312
317
|
const parts: string[] = []
|
|
313
318
|
for (const u of units) treeStamp(u.dir, parts)
|
|
314
319
|
parts.push(houseRepoWords(root).map((w) => w.word).join(','))
|
|
320
|
+
parts.push(readMachineWords().words.map((w) => w.word).join(','))
|
|
315
321
|
const ids = houseIdentitiesDir(root)
|
|
316
322
|
if (ids != null) treeStamp(ids, parts)
|
|
317
323
|
for (const f of [join(root, KEYWORD_FILE), globalKeywordFile(), globalAllowFile()]) if (f != null) parts.push(fileStamp(f))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// a change written from a review card (wiki tools/shipkit/
|
|
1
|
+
// a change written from a review card (wiki tools/shipkit/threads.md, A change for the release): the card carries its
|
|
2
2
|
// public line (`--changelog "<category>: <line>"`), and the owner's approval adds it to next.md with the card's media
|
|
3
3
|
// (a pair of images as its after and its before, two stills, never a video; a clip as it is, else its image), kept
|
|
4
4
|
// private in the Space. The card named is the thread's first version, so a later version approved again replaces its
|
package/src/releases/routes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// the releases page's routes (wiki tools/shipkit/units.md, The release files): every release file read fresh
|
|
2
|
-
// private picture shown from its scratch copy, else through a signed link of
|
|
3
|
-
// written by an approval, `sk releases add` or a hand
|
|
1
|
+
// the releases page's routes (wiki tools/shipkit/units.md, The release files): every release file read fresh with the
|
|
2
|
+
// post draft each version staged, and a private picture shown from its scratch copy, else through a signed link of
|
|
3
|
+
// the Space. Read only: the files are written by an approval, `sk releases add` or a hand
|
|
4
4
|
import { existsSync } from 'node:fs'
|
|
5
5
|
import { extname, join } from 'node:path'
|
|
6
6
|
import { shaOfKey } from '../media-store/content.ts'
|
|
@@ -9,10 +9,12 @@ import { PICTURE_ROUTE, type Release } from './model.ts'
|
|
|
9
9
|
import { picturesDir, shownUrl } from './pictures.ts'
|
|
10
10
|
import { readReleases } from './store.ts'
|
|
11
11
|
|
|
12
|
-
/** what the page reads: every release, next first,
|
|
12
|
+
/** what the page reads: every release, next first, each file that does not parse, and the post draft each released
|
|
13
|
+
* version staged, its slug by version */
|
|
13
14
|
export interface ReleasesView {
|
|
14
15
|
releases: Release[]
|
|
15
16
|
errors: string[]
|
|
17
|
+
drafts: Record<string, string>
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/** the releases routes of the repo at `root`; null for any other path */
|
|
@@ -20,7 +22,10 @@ export async function releasesRoutes(root: string, req: Request, path: string):
|
|
|
20
22
|
if (path !== '/api/releases' && !path.startsWith('/api/releases/')) return null
|
|
21
23
|
if (req.method !== 'GET') return bad(`releases: no route ${req.method} ${path}`, 404)
|
|
22
24
|
try {
|
|
23
|
-
if (path === '/api/releases')
|
|
25
|
+
if (path === '/api/releases') {
|
|
26
|
+
const { releaseDrafts } = await import('../social/release-stage.ts')
|
|
27
|
+
return Response.json({ ...readReleases(root), drafts: releaseDrafts(root) } satisfies ReleasesView, { headers: NO_STORE })
|
|
28
|
+
}
|
|
24
29
|
if (path.startsWith(PICTURE_ROUTE)) {
|
|
25
30
|
const key = decodeURIComponent(path.slice(PICTURE_ROUTE.length))
|
|
26
31
|
const sha = shaOfKey(key)
|
package/src/releases/store.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// the release files on the disk (wiki tools/shipkit/units.md, The release files): `.shipkit/releases/next.md` and one
|
|
2
2
|
// `<version>.md` a released version, read, written, and a change added to next. Pictures: pictures.ts
|
|
3
3
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs'
|
|
4
|
-
import { join } from 'node:path'
|
|
4
|
+
import { basename, join } from 'node:path'
|
|
5
5
|
import { atomicWrite } from '../core/locked-write.ts'
|
|
6
6
|
import { LAYOUT } from '../core/layout.ts'
|
|
7
7
|
import { byVersion, emptyRelease, fileOf, NEXT, parseRelease, renderRelease, upsertChange, withoutCard, type Change, type Release, changesNamed, changesOf, withoutChange } from './model.ts'
|
|
@@ -20,6 +20,15 @@ export async function undeclaredReleases(root: string): Promise<string | null> {
|
|
|
20
20
|
export const hasReleases = (root: string): boolean => existsSync(releasesDir(root))
|
|
21
21
|
export const releaseFile = (root: string, version: string): string => join(releasesDir(root), fileOf(version))
|
|
22
22
|
|
|
23
|
+
/** the version whose release file a `<unit>@<version>` names (a staged draft's `release:`): only the root unit keeps
|
|
24
|
+
* release files, named `root` by a bump and by the repo's folder by `sk social release`; null for another unit, or
|
|
25
|
+
* when the folder holds no file of that version */
|
|
26
|
+
export function releaseVersionOf(root: string, ref: string | null | undefined): string | null {
|
|
27
|
+
const m = ref ? /^([^@]+)@(\d+\.\d+\.\d+)$/.exec(ref) : null
|
|
28
|
+
if (!m || (m[1] !== 'root' && m[1] !== basename(root))) return null
|
|
29
|
+
return existsSync(releaseFile(root, m[2]!)) ? m[2]! : null
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
/** the versions the folder holds a file for, next first, then newest first */
|
|
24
33
|
export function releaseVersions(root: string): string[] {
|
|
25
34
|
const dir = releasesDir(root)
|