rvlib-shipkit 2.26.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 +20 -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 +6 -4
- 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 +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 +320 -99
- 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/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 +2 -2
- 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_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +548 -116
- 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 +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/family-help.ts +4 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/registry.ts +24 -3
- 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/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/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/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 +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 +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +25 -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 +67 -16
- 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 +129 -37
- 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/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +32 -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 +4 -4
- 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 +202 -39
- 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 +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/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
|
@@ -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 */
|
|
@@ -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'
|
|
@@ -14,6 +15,7 @@ import { fileStamp } from '../core/file-stamp.ts'
|
|
|
14
15
|
import { gitRoot } from '../core/git-root.ts'
|
|
15
16
|
import { houseIndex, houseRepos } from '../serve/project-gutter.ts'
|
|
16
17
|
import type { RepoConfig } from '../repo-config.ts'
|
|
18
|
+
import { readMachineWords } from './machine-words.ts'
|
|
17
19
|
|
|
18
20
|
/** a word the tarball may not carry, and what it is (never the word itself) */
|
|
19
21
|
export type HouseWord = { word: string; what: string }
|
|
@@ -248,10 +250,12 @@ export async function publicClean(root: string, config: RepoConfig, unit: { dir:
|
|
|
248
250
|
else for (const i of ids.identities) for (const f of [i.file, ...i.accounts.map((a) => a.file)]) read(f)
|
|
249
251
|
const allow = publicAllow(config, read)
|
|
250
252
|
notes.push(...allow.notes)
|
|
253
|
+
const machines = readMachineWords()
|
|
254
|
+
notes.push(...machines.notes)
|
|
251
255
|
const scanned = scanPublic({
|
|
252
256
|
rel,
|
|
253
257
|
files,
|
|
254
|
-
words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids))],
|
|
258
|
+
words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids)), ...machines.words],
|
|
255
259
|
keywordText: withBuiltinRows(kwFiles.map((f) => read(f) ?? '')),
|
|
256
260
|
allowedWords: allowedWords(pkg),
|
|
257
261
|
allow: allow.entries,
|
|
@@ -312,6 +316,7 @@ export function publicCleanKey(root: string, units: { dir: string }[]): string {
|
|
|
312
316
|
const parts: string[] = []
|
|
313
317
|
for (const u of units) treeStamp(u.dir, parts)
|
|
314
318
|
parts.push(houseRepoWords(root).map((w) => w.word).join(','))
|
|
319
|
+
parts.push(readMachineWords().words.map((w) => w.word).join(','))
|
|
315
320
|
const ids = houseIdentitiesDir(root)
|
|
316
321
|
if (ids != null) treeStamp(ids, parts)
|
|
317
322
|
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)
|
package/src/repo-config.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// a slot that can't fill emits a visible reason, and one turned off with
|
|
9
9
|
// `off: { x: '<why>' }` prints a skipped-by-config line, never silence.
|
|
10
10
|
// The `contracts` task is always present when any contract applies.
|
|
11
|
-
import type
|
|
11
|
+
import { repoIdOf, type Scope } from './core/scope.ts'
|
|
12
12
|
import { existsSync, readFileSync } from 'fs'
|
|
13
13
|
import { isAbsolute, join, normalize } from 'path'
|
|
14
14
|
import { ROUTED_SCRIPTS } from './core/canonical-scripts.ts'
|
|
@@ -78,6 +78,12 @@ export type ServeConfig = {
|
|
|
78
78
|
* media store (review cards, trailer cuts...), read only in the house
|
|
79
79
|
* config; its key pair read through `credsReadCommand` */
|
|
80
80
|
mediaSpace?: import('./media-store/space.ts').MediaSpace
|
|
81
|
+
/** only in the house config: the bucket that holds the second copy of the hq's database, sent by Litestream
|
|
82
|
+
* (wiki tools/shipkit/hq.md). A bucket of its own, with versioning off */
|
|
83
|
+
hqReplica?: import('./hq/replica.ts').HqReplica
|
|
84
|
+
/** only in the house config: a bucket at another provider that holds a copy of every object of `mediaSpace` and
|
|
85
|
+
* the hq's nightly snapshot, copied by stream and proven each night (`sk space copy`) */
|
|
86
|
+
spaceCopy?: import('./media-store/copy/config.ts').SpaceCopy
|
|
81
87
|
/** folders on external drives for the machine's heavy files, never a db,
|
|
82
88
|
* in order, read only in the house config: the purge moves media there,
|
|
83
89
|
* `sk annex offload` moves scratch there behind a symlink. Present only
|
|
@@ -113,6 +119,10 @@ export type RepoConfig = {
|
|
|
113
119
|
* title, the motherhome row, the default hub port hash. The pre-commit
|
|
114
120
|
* root-identity gate compares it to the package.json name. */
|
|
115
121
|
name: string
|
|
122
|
+
/** the repo's permanent id: the same on every machine, whatever its folder, its remote or its printed name is
|
|
123
|
+
* called. What a secret's scope names the repo by (`repo:<id>`, wiki services/secrets). Lowercase letters,
|
|
124
|
+
* digits, `.`, `_` or `-`, starting with a letter or a digit. Absent: the name */
|
|
125
|
+
id?: string
|
|
116
126
|
/** venue ids this repo ships on — selects which contracts are REQUIRED */
|
|
117
127
|
venues?: string[]
|
|
118
128
|
/** retired with the v2 social contract: read by nothing; delete the line (`sk social migrate` moves the posts) */
|
|
@@ -256,6 +266,18 @@ export type RepoConfig = {
|
|
|
256
266
|
* The button in the repo header and the page's unarchive toggle it, and
|
|
257
267
|
* only this key moves (core/archived.ts) */
|
|
258
268
|
archived?: boolean
|
|
269
|
+
/** only in the house config: what of the owner's history the daemon never sends to the hq (wiki
|
|
270
|
+
* tools/shipkit/hq.md) */
|
|
271
|
+
history?: {
|
|
272
|
+
/** names whose prompts and day rows never leave their machine, over every other rule: a folder of that name,
|
|
273
|
+
* whatever its case, and every form made from it (`<name>-…`, `<name>--…`, `<name>.…`, a subfolder), under
|
|
274
|
+
* any parent */
|
|
275
|
+
skip?: string[]
|
|
276
|
+
/** folders sent beside the house repos and their worktrees, which go by themselves: a name under the home dev
|
|
277
|
+
* folder, a path, or a folder as Claude Code names it (`-…`). Every folder neither names stays on its
|
|
278
|
+
* machine; `sk history send --dry` lists them */
|
|
279
|
+
also?: string[]
|
|
280
|
+
}
|
|
259
281
|
/** declared github visibility INTENT (absent = 'private'): public means
|
|
260
282
|
* strangers read the tracked tree. What each check does with it:
|
|
261
283
|
* wiki/tools/shipkit/built-in-checks.md */
|
|
@@ -342,6 +364,10 @@ export type RepoConfig = {
|
|
|
342
364
|
start?: {
|
|
343
365
|
/** repo names `sk start` never touches: no CLAUDE.md include, no git, no scaffold, no push (a day-job checkout) */
|
|
344
366
|
skip?: string[]
|
|
367
|
+
/** folders sent beside the house repos and their worktrees, which go by themselves: a name under the home dev
|
|
368
|
+
* folder, a path, or a folder as Claude Code names it (`-…`). Every folder neither names stays on its
|
|
369
|
+
* machine; `sk history send --dry` lists them */
|
|
370
|
+
also?: string[]
|
|
345
371
|
}
|
|
346
372
|
/** the headless browsers that shoot or record for this repo at once, on any machine (an sk shot ask, a take, a
|
|
347
373
|
* look sheet's tabs, the trailer's films, sk smoke): each holds a slot of the repo's pool for its whole life,
|
|
@@ -390,10 +416,11 @@ export type RepoConfig = {
|
|
|
390
416
|
logDir?: string
|
|
391
417
|
}
|
|
392
418
|
|
|
393
|
-
const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'speaksAs', 'backup', 'annex','docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'instantHooks', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'recorder', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
|
|
419
|
+
const KNOWN_KEYS = new Set(['name', 'id', 'venues', 'social', 'speaksAs', 'backup', 'annex','docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'instantHooks', 'ruleExempt', 'visibility', 'archived', 'history', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'recorder', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
|
|
394
420
|
|
|
395
421
|
export function defineRepo(c: RepoConfig): RepoConfig {
|
|
396
422
|
if (typeof c.name !== 'string' || c.name === '') throw new Error('defineRepo: name is required')
|
|
423
|
+
repoIdOf(c)
|
|
397
424
|
for (const v of c.venues ?? []) if (!/^[a-z0-9-]+$/.test(v)) throw new Error(`defineRepo: venue '${v}' must be kebab-case`)
|
|
398
425
|
if (c.speaksAs != null && !/^[a-z0-9][a-z0-9-]*$/.test(c.speaksAs)) throw new Error(`defineRepo: speaksAs '${String(c.speaksAs)}' must be an identity id, kebab-case (sk identities)`)
|
|
399
426
|
if (c.visibility != null && c.visibility !== 'private' && c.visibility !== 'public')
|
|
@@ -401,6 +428,9 @@ export function defineRepo(c: RepoConfig): RepoConfig {
|
|
|
401
428
|
// a half-declared reviewer would lint a path like `.claude/agents/.md`
|
|
402
429
|
if (c.reviewer != null && (!/^[a-z0-9][a-z0-9-]*$/.test(c.reviewer.name ?? '') || (c.reviewer.brief ?? '') === ''))
|
|
403
430
|
throw new Error(`defineRepo: reviewer needs { name: kebab-case, brief: path to the standing brief }`)
|
|
431
|
+
const names = (v: unknown): boolean => v == null || (Array.isArray(v) && v.every((x) => typeof x === 'string' && x !== ''))
|
|
432
|
+
if (c.history != null && (typeof c.history !== 'object' || !names(c.history.skip) || !names(c.history.also)))
|
|
433
|
+
throw new Error('defineRepo: history is { skip: [folder names], also: [folders] }')
|
|
404
434
|
if (c.serve != null && 'processes' in c.serve)
|
|
405
435
|
throw new Error(`defineRepo: serve.processes was removed; declare each process in a <name>.shipkit.ts file as \`export default globalProcess({...})\``)
|
|
406
436
|
if (c.ignoredInputs != null && (typeof c.ignoredInputs !== 'object' || Array.isArray(c.ignoredInputs)))
|
package/src/review/anim.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// a card's before and after as a looping animation to send (wiki tools/shipkit/
|
|
2
|
-
// function behind the hub's « animation » and `sk
|
|
1
|
+
// a card's before and after as a looping animation to send (wiki tools/shipkit/threads.md, Verbs on the store): the one
|
|
2
|
+
// function behind the hub's « animation » and `sk thread anim`. One cycle is drawn by ffmpeg's own filters (no per pixel
|
|
3
3
|
// expression: a card renders in a few seconds), an mp4 then repeats it with no second encode
|
|
4
4
|
import { createCanvas, GlobalFonts } from '@napi-rs/canvas'
|
|
5
5
|
import { existsSync, mkdirSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
package/src/review/auto.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// auto rules (wiki tools/shipkit/
|
|
1
|
+
// auto rules (wiki tools/shipkit/threads.md, A project's parts): a rule of the repo's review unit answers on a clock, and
|
|
2
2
|
// its answer is raised as an item to a lane, open from the start. One open item a rule and key. The hub's daemon runs
|
|
3
|
-
// them (startAuto), `sk
|
|
3
|
+
// them (startAuto), `sk thread auto` reads their logs and runs one now
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
|
|
5
5
|
import { join } from 'node:path'
|
|
6
6
|
import { stateOf, type ReviewItem } from './model.ts'
|