rvlib-shipkit 2.25.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/package.json +2 -2
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +331 -0
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +1 -3
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/render.ts +130 -17
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +349 -23
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +370 -95
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/offload.ts +17 -6
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +40 -0
- package/src/asks/asks-queue.ts +205 -47
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +289 -10
- package/src/check.ts +3 -1
- package/src/checks/SK004-gitignore-policy.check.ts +12 -5
- package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
- package/src/checks/SK026-asks-autoclose.check.ts +5 -5
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK045-slow-hooks.check.ts +47 -0
- package/src/checks/SK046-hook-records.check.ts +76 -0
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/cli/cmd_Asks.ts +71 -5
- package/src/cli/cmd_Backup.ts +5 -3
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Releases.ts +30 -0
- package/src/cli/cmd_Review.ts +569 -118
- package/src/cli/cmd_Secret.ts +62 -12
- package/src/cli/cmd_Social.ts +83 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Time.ts +82 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/family-help.ts +4 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/registry.ts +26 -4
- package/src/collections/actions.ts +63 -13
- package/src/collections/collection-types.ts +23 -1
- package/src/collections/providers.ts +117 -23
- package/src/collections/review.ts +4 -4
- package/src/commands/runner.ts +5 -1
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/history-files.ts +9 -5
- package/src/core/layout.ts +3 -0
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +368 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +1 -1
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/signal-name.ts +6 -0
- package/src/core/slots.ts +5 -4
- package/src/core/trace-audit.ts +6 -1
- package/src/core/transient.ts +6 -0
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +2 -2
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +66 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +149 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +12 -3
- package/src/home/home-routes.ts +68 -0
- package/src/home/inbox-shape.ts +24 -14
- package/src/home/machine-fold.ts +820 -0
- package/src/home/machine-host.ts +20 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +175 -7
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +482 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +17 -4
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +348 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +99 -0
- package/src/hq/hq-local.ts +469 -0
- package/src/hq/hq-routes.ts +196 -0
- package/src/hq/hq-store.ts +599 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +372 -0
- package/src/hq/replica.ts +168 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/identities/identities.ts +15 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +73 -26
- package/src/ledger/gate-checks.ts +29 -4
- package/src/ledger/git-key.ts +3 -3
- package/src/ledger/git-scan.ts +49 -7
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +36 -17
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/run.ts +11 -11
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +68 -20
- package/src/media-store/copy/config.ts +77 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +22 -11
- package/src/media-store/forget.ts +23 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +18 -15
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +240 -0
- package/src/media-store/space.ts +40 -21
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +2 -2
- package/src/messages/suggest.ts +96 -0
- package/src/pages/frame-client.ts +10 -0
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +146 -36
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +8 -3
- package/src/releases/from-card.ts +1 -1
- package/src/releases/model.ts +18 -0
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +23 -2
- package/src/repo-config.ts +42 -2
- package/src/review/anim.ts +2 -2
- package/src/review/auto.ts +2 -2
- package/src/review/card-db.ts +244 -0
- package/src/review/card-rows.ts +266 -0
- package/src/review/cells.ts +76 -5
- package/src/review/draft-card.ts +41 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/format.ts +29 -10
- package/src/review/gone.ts +98 -0
- package/src/review/inbox-hook.ts +35 -0
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +214 -45
- package/src/review/move.ts +491 -0
- package/src/review/notes.ts +12 -20
- package/src/review/previews.ts +15 -19
- package/src/review/project.ts +1 -1
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +64 -13
- package/src/review/stage-card.ts +8 -4
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +529 -83
- package/src/review/thread-fold.ts +51 -0
- package/src/review/threads.ts +147 -9
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +4 -4
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +6 -6
- package/src/review/watchers.ts +1 -1
- package/src/rules/untrack-generated.ts +92 -8
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain.ts +113 -0
- package/src/secrets/list.ts +16 -6
- package/src/secrets/manager.ts +24 -10
- package/src/secrets/read.ts +257 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +48 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/col-card.tsx +64 -13
- package/src/serve/hub-app/col-list-page.tsx +122 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +10 -41
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +70 -16
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +89 -9
- package/src/serve/hub-app/home-strip.css +5 -19
- package/src/serve/hub-app/home-strip.tsx +58 -92
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +31 -142
- package/src/serve/hub-app/hub-types.ts +3 -1
- package/src/serve/hub-app/hub.css +109 -23
- package/src/serve/hub-app/icons.tsx +18 -1
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +100 -58
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +41 -24
- package/src/serve/hub-app/inbox-view.tsx +37 -41
- package/src/serve/hub-app/inbox.css +2 -5
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +28 -15
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +224 -0
- package/src/serve/hub-app/machines.css +76 -0
- package/src/serve/hub-app/md-copy.tsx +79 -0
- package/src/serve/hub-app/media-view.tsx +2 -0
- package/src/serve/hub-app/messages/messages-page.tsx +79 -7
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +11 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/project-list.css +54 -8
- package/src/serve/hub-app/project-list.tsx +128 -59
- package/src/serve/hub-app/projects-svc.ts +78 -7
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +27 -5
- package/src/serve/hub-app/reflections-page.tsx +42 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +25 -2
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/kit.tsx +50 -7
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +145 -65
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +68 -30
- package/src/serve/hub-app/review/review-page.tsx +7 -8
- package/src/serve/hub-app/review/review-st.ts +111 -24
- package/src/serve/hub-app/review/review-thread.tsx +49 -19
- package/src/serve/hub-app/review/review-views.tsx +475 -144
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +73 -26
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review.css +267 -61
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/comms-page.tsx +20 -5
- package/src/serve/hub-app/social/kit.tsx +30 -4
- package/src/serve/hub-app/social/post-card.tsx +139 -49
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +11 -0
- package/src/serve/hub-app/social/social-page.tsx +94 -35
- package/src/serve/hub-app/social/social-st.ts +120 -36
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +3 -0
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +91 -23
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +76 -0
- package/src/serve/hub-app/time.css +138 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +4 -4
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/wikis-view.tsx +2 -2
- package/src/serve/hub-runtime.ts +15 -2
- package/src/serve/project-gutter-route.ts +27 -14
- package/src/serve/project-gutter.ts +25 -12
- package/src/serve/same-origin.ts +10 -0
- package/src/serve/serve-hub.ts +13 -4
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +1 -1
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -2
- package/src/social/cover.ts +202 -0
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +3 -0
- package/src/social/load.ts +23 -2
- package/src/social/media-kind.ts +2 -1
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +28 -13
- package/src/social/routes.ts +26 -1
- package/src/social/stage.ts +1 -1
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/thumbnail.ts +255 -0
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +236 -42
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +14 -8
- package/src/suite/judge-suites.ts +113 -16
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +81 -34
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +352 -0
- package/src/vault/vault-import.ts +208 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
- package/src/wiki/run-wiki.ts +2 -1
- package/src/wiki/scan-md.ts +42 -2
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
// the pages of the time page, one per entry of its left panel. Each answers
|
|
2
|
+
// ONE question: a title that asks it, one sentence that answers it with the
|
|
3
|
+
// figure that matters, a chart, then the table of every figure.
|
|
4
|
+
//
|
|
5
|
+
// The constraint a reader breaks first: a page holds one chart per question.
|
|
6
|
+
// A second question is a second entry of the panel, never a second box here.
|
|
7
|
+
import { observer } from 'mobx-react-lite'
|
|
8
|
+
import type { ReactNode } from 'react'
|
|
9
|
+
import { FAMILY_WORDS } from '../../agent-time/family.ts'
|
|
10
|
+
import type { Insight, RefusedCut, ShapeRow, TurnCut } from '../../agent-time/report.ts'
|
|
11
|
+
import { REFUSER_WORDS } from '../../agent-time/refused.ts'
|
|
12
|
+
import { ALL, RUN_KINDS, type RunKind, type RunSet, type TimeoutShape, type TimePage, TOP_RUNS, wallOf } from '../../home/time-page-shape.ts'
|
|
13
|
+
import { type Col, Columns, dur, group, Hint, Legend, type Num, num, PART_WORDS, type Part, partsOf, pct, RankBars, type Ranked, type Row, SegBar, Table, Tile, Tiles, wholeOf } from './time-charts.tsx'
|
|
14
|
+
import { RUNS_MODES, type RunsMode, type TimeEntry, type TimeSt } from './time-st.ts'
|
|
15
|
+
|
|
16
|
+
type Ctx = { d: TimePage; st: TimeSt; house: ReadonlySet<string> }
|
|
17
|
+
|
|
18
|
+
/** the question each page answers: its title, and what its entry in the panel says on hover */
|
|
19
|
+
export const TITLES: Record<TimeEntry, string> = {
|
|
20
|
+
overview: "Where the agents' time went",
|
|
21
|
+
days: 'Day by day',
|
|
22
|
+
repos: 'Which repos take the time',
|
|
23
|
+
lanes: 'What the lanes do with their time',
|
|
24
|
+
main: 'What the main sessions do with their time',
|
|
25
|
+
turns: 'How many steps the agents take',
|
|
26
|
+
timeouts: 'Which commands hit their time limit',
|
|
27
|
+
costs: 'What costs the most',
|
|
28
|
+
tools: 'Which tools take the time',
|
|
29
|
+
commands: 'Which commands take the time',
|
|
30
|
+
slow: 'Which commands make an agent wait',
|
|
31
|
+
failures: 'Which commands fail',
|
|
32
|
+
hooks: 'What the hooks cost',
|
|
33
|
+
remarks: 'What you said about speed',
|
|
34
|
+
overhead: 'What a call costs before its command starts',
|
|
35
|
+
models: 'What makes a turn long: the model and its context',
|
|
36
|
+
refused: 'Which calls were refused, and by whom',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const Page = ({ title, lead, children }: { title: string; lead: ReactNode; children: ReactNode }) => (
|
|
41
|
+
<article className="tvpage">
|
|
42
|
+
<h1>{title}</h1>
|
|
43
|
+
<p className="tvlead">{lead}</p>
|
|
44
|
+
{children}
|
|
45
|
+
</article>
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
const Section = ({ title, hint, children }: { title: string; hint?: string; children: ReactNode }) => (
|
|
49
|
+
<section className="tvsec">
|
|
50
|
+
<h2>{title}</h2>
|
|
51
|
+
{hint == null ? null : <p className="tvhint">{hint}</p>}
|
|
52
|
+
{children}
|
|
53
|
+
</section>
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const FOLD_HINT = 'a row with a caret is a command that stands for many scripts: click it to open the scripts it ran'
|
|
57
|
+
|
|
58
|
+
/** one row of a table of commands, and under it what the row opens on (the scripts of a `<file>` command), each
|
|
59
|
+
* drawn by the same `cells` as its row. Every table of commands builds its rows here, so none can show a command
|
|
60
|
+
* that stands for many scripts and not open it */
|
|
61
|
+
function foldRow<T>(key: string, r: T & { parts?: T[] }, nameOf: (x: T) => string, cells: (x: T) => Row['cells']): Row {
|
|
62
|
+
return { key, title: nameOf(r), cells: cells(r), children: r.parts?.map((x) => ({ key: `${key}/${nameOf(x)}`, title: nameOf(x), cells: [nameOf(x), ...cells(x).slice(1)] })) }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** a table whose order the viewer picks with a click on a header */
|
|
66
|
+
const Sorted = observer(({ st, id, head, rows, empty }: { st: TimeSt; id: string; head: Col[]; rows: Row[]; empty: string }) => {
|
|
67
|
+
const open = new Set(rows.filter((r) => st.opened.has(`${id}/${r.key}`)).map((r) => r.key))
|
|
68
|
+
return <Table head={head} rows={rows} empty={empty} sort={st.sorts.get(id) ?? null} onSort={(col) => st.sortBy(id, col)} open={open} onToggle={(key) => st.toggle(`${id}/${key}`)} />
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
/** the part that takes the most of a wall, as words: « 67% in the model » */
|
|
72
|
+
const biggest = (parts: Part[]): string => {
|
|
73
|
+
const top = [...parts].sort((a, b) => b.value - a.value)[0]
|
|
74
|
+
return top == null || top.value === 0 ? 'nothing recorded' : `${pct(top.value, wholeOf(parts))} ${top.id === 'model' || top.id === 'tools' ? 'in' : ''} ${PART_WORDS[top.id].label}`.replace(/\s+/g, ' ')
|
|
75
|
+
}
|
|
76
|
+
/** the model time before a call: of the turns that wrote a call, never of a turn that only wrote text */
|
|
77
|
+
const beforeCall = (cuts: TurnCut[]): number => {
|
|
78
|
+
const whole = cuts.filter((c) => c.ctx === '')
|
|
79
|
+
const calls = whole.reduce((n, c) => n + c.calls, 0)
|
|
80
|
+
return calls === 0 ? 0 : whole.reduce((n, c) => n + c.ms, 0) / calls
|
|
81
|
+
}
|
|
82
|
+
/** the model and its tools: an agent at work, as against an agent that waits */
|
|
83
|
+
const atWork = (d: TimePage): { lanes: number; main: number } => ({ lanes: d.turns.sub.work.model + d.turns.sub.work.tools, main: d.wall.model + d.wall.tools })
|
|
84
|
+
const dayLabel = (day: string): string => day.slice(5)
|
|
85
|
+
const when = (at: number): string => new Date(at).toLocaleString(undefined, { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
|
|
86
|
+
|
|
87
|
+
/** the background commands run beside the agent: their hours are no wait, so they are no cost of its time */
|
|
88
|
+
const costsOf = (d: TimePage): Insight[] => d.insights.filter((i) => i.id !== 'background')
|
|
89
|
+
|
|
90
|
+
function Overview({ d, st }: Ctx) {
|
|
91
|
+
const lanes = partsOf(d.turns.sub.work)
|
|
92
|
+
const main = partsOf(d.wall)
|
|
93
|
+
const work = atWork(d)
|
|
94
|
+
const costs = costsOf(d)
|
|
95
|
+
return (
|
|
96
|
+
<Page
|
|
97
|
+
title={TITLES.overview}
|
|
98
|
+
lead={<>The agents were at work <b>{dur(work.lanes + work.main)}</b>, the model and its tools: {dur(work.lanes)} in {group(d.turns.sub.runs)} lane runs and {dur(work.main)} in {d.sessions} main sessions. The lane runs lasted {dur(wholeOf(lanes))} and spent {biggest(lanes)}. The main sessions were open {dur(wholeOf(main))} and spent {biggest(main)}: a main session that waits on its lanes counts there, so the two do not add up.</>}
|
|
99
|
+
>
|
|
100
|
+
<Tiles>
|
|
101
|
+
<Tile value={dur(work.lanes + work.main)} label="at work: the model and its tools" hint="the lanes and the main sessions together; their waits are in the two bars below" />
|
|
102
|
+
<Tile value={group(d.turns.sub.runs)} label="lane runs" hint="sub-agent runs started by the main sessions" />
|
|
103
|
+
<Tile value={group(d.callCount)} label="tool calls" />
|
|
104
|
+
<Tile value={dur(beforeCall(d.models.sub))} label="of model before each call, in lanes" hint="each tool call costs a model turn before it" />
|
|
105
|
+
</Tiles>
|
|
106
|
+
{d.turns.sub.runs === 0 ? null : (
|
|
107
|
+
<Section title="Lanes" hint="the sub-agents: where the hours of their runs went">
|
|
108
|
+
<SegBar parts={lanes} />
|
|
109
|
+
<Legend parts={lanes} />
|
|
110
|
+
</Section>
|
|
111
|
+
)}
|
|
112
|
+
<Section title="Main sessions" hint="the sessions you talk to: where their hours went, idle past 30 minutes left out">
|
|
113
|
+
<SegBar parts={main} />
|
|
114
|
+
<Legend parts={main} />
|
|
115
|
+
</Section>
|
|
116
|
+
{costs.length === 0 ? null : (
|
|
117
|
+
<Section title="The three biggest costs">
|
|
118
|
+
<RankBars empty="" rows={costs.slice(0, 3).map((i) => ({ name: COST_WORDS[i.id] ?? i.id, value: i.ms, shown: `${i.estimate ? 'about ' : ''}${dur(i.ms)}`, title: i.text, onClick: () => st.setEntry('costs') }))} />
|
|
119
|
+
</Section>
|
|
120
|
+
)}
|
|
121
|
+
</Page>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function Days({ d, st }: Ctx) {
|
|
126
|
+
const top = Math.max(0, ...d.days.flatMap((r) => [wallOf(r.main), wallOf(r.sub)]))
|
|
127
|
+
const busiest = [...d.days].sort((a, b) => wallOf(b.sub) + wallOf(b.main) - wallOf(a.sub) - wallOf(a.main))[0]
|
|
128
|
+
const legend = partsOf(d.turns.sub.work).map((p, i) => ({ id: p.id, value: p.value + (partsOf(d.wall)[i]?.value ?? 0) }))
|
|
129
|
+
return (
|
|
130
|
+
<Page title={TITLES.days} lead={busiest == null ? 'No day in this window.' : <>The busiest day was <b>{busiest.day}</b>: {dur(wallOf(busiest.sub))} of lanes in {group(busiest.runs)} runs, and {dur(wallOf(busiest.main))} of main sessions.</>}>
|
|
131
|
+
<Legend parts={legend} amounts={false} />
|
|
132
|
+
<Section title="Lanes, per day" hint="the hours of sub-agent work inside each day, split the same way">
|
|
133
|
+
<Columns top={top} cols={d.days.map((r) => ({ label: dayLabel(r.day), parts: partsOf(r.sub) }))} />
|
|
134
|
+
</Section>
|
|
135
|
+
<Section title="Main sessions, per day" hint="on the same scale as the lanes above">
|
|
136
|
+
<Columns top={top} cols={d.days.map((r) => ({ label: dayLabel(r.day), parts: partsOf(r.main) }))} />
|
|
137
|
+
</Section>
|
|
138
|
+
<Section title="The figures">
|
|
139
|
+
<Sorted
|
|
140
|
+
st={st}
|
|
141
|
+
id="days"
|
|
142
|
+
empty="no day in this window"
|
|
143
|
+
head={[{ label: 'day' }, { label: 'lanes', num: true, look: 'bar' }, { label: 'lanes, in the model', num: true, look: 'bar' }, { label: 'lane runs', num: true, look: 'bar' }, { label: 'main sessions', num: true, look: 'bar' }, { label: 'main, waiting on background', num: true, look: 'bar' }, { label: 'tool calls', num: true, look: 'bar' }]}
|
|
144
|
+
rows={d.days.map((r) => ({ key: r.day, cells: [r.day, num.h(wallOf(r.sub)), num.h(r.sub.model), num.n(r.runs), num.h(wallOf(r.main)), num.h(r.main.background), num.n(r.calls)] }))}
|
|
145
|
+
/>
|
|
146
|
+
</Section>
|
|
147
|
+
</Page>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function Repos({ d, st, house }: Ctx) {
|
|
152
|
+
const top = d.byRepo[0]
|
|
153
|
+
const open = (repo: string): (() => void) | undefined => (house.has(repo) ? () => st.setScope(repo) : undefined)
|
|
154
|
+
return (
|
|
155
|
+
<Page title={TITLES.repos} lead={top == null ? 'No session in this window.' : <><b>{top.repo}</b> leads with {dur(wallOf(top.wall) + top.lanes)}: {dur(top.lanes)} of lanes in {group(top.subagents)} runs and {dur(wallOf(top.wall))} of main sessions. Click a repo to see every page for it alone.</>}>
|
|
156
|
+
<Section title="Lanes and main sessions, by repo" hint="two bars a row, on one scale">
|
|
157
|
+
<ul className="tvkeys">
|
|
158
|
+
<li><i className="k1" />lanes</li>
|
|
159
|
+
<li><i className="k2" />main sessions</li>
|
|
160
|
+
</ul>
|
|
161
|
+
<RankBars empty="no session in this window" rows={d.byRepo.map((r) => ({ name: r.repo, value: r.lanes, shown: dur(r.lanes), second: { value: wallOf(r.wall), shown: dur(wallOf(r.wall)) }, onClick: open(r.repo) }))} />
|
|
162
|
+
</Section>
|
|
163
|
+
<Section title="The figures" hint="the last four columns split the main sessions">
|
|
164
|
+
<Sorted
|
|
165
|
+
st={st}
|
|
166
|
+
id="repos"
|
|
167
|
+
empty="no session in this window"
|
|
168
|
+
head={[{ label: 'repo' }, { label: 'lanes', num: true, look: 'bar' }, { label: 'lane runs', num: true, look: 'bar' }, { label: 'main sessions', num: true, look: 'bar' }, { label: 'sessions', num: true }, { label: 'the model', num: true, look: 'bar' }, { label: 'tools', num: true, look: 'bar' }, { label: 'waiting on background', num: true, look: 'bar' }, { label: 'waiting on you', num: true, look: 'bar' }]}
|
|
169
|
+
rows={d.byRepo.map((r) => ({ key: r.repo, cells: [r.repo, num.h(r.lanes), num.n(r.subagents), num.h(wallOf(r.wall)), num.n(r.sessions), num.h(r.wall.model), num.h(r.wall.tools), num.h(r.wall.background), num.h(r.wall.human)], onClick: open(r.repo) }))}
|
|
170
|
+
/>
|
|
171
|
+
</Section>
|
|
172
|
+
</Page>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function Lanes({ d, st }: Ctx) {
|
|
177
|
+
const sub = d.turns.sub
|
|
178
|
+
const parts = partsOf(sub.work)
|
|
179
|
+
return (
|
|
180
|
+
<Page title={TITLES.lanes} lead={sub.runs === 0 ? 'No lane ran in this window.' : <>{group(sub.runs)} lane runs took <b>{dur(wholeOf(parts))}</b> and spent {biggest(parts)}. Half of the runs end within {dur(sub.runP50)}, nine in ten within {dur(sub.runP90)}.</>}>
|
|
181
|
+
<Tiles>
|
|
182
|
+
<Tile value={group(sub.runs)} label="lane runs" />
|
|
183
|
+
<Tile value={dur(sub.runP50)} label="a typical run" hint="the median length of a run" />
|
|
184
|
+
<Tile value={dur(sub.runP90)} label="a long run" hint="nine runs in ten are shorter" />
|
|
185
|
+
<Tile value={group(sub.callsP50)} label="tool calls in a typical run" />
|
|
186
|
+
</Tiles>
|
|
187
|
+
<Section title="Where their hours went">
|
|
188
|
+
<SegBar parts={parts} />
|
|
189
|
+
<Legend parts={parts} />
|
|
190
|
+
</Section>
|
|
191
|
+
<Section title="Per day">
|
|
192
|
+
<Columns cols={d.days.map((r) => ({ label: dayLabel(r.day), parts: partsOf(r.sub) }))} />
|
|
193
|
+
</Section>
|
|
194
|
+
<Section title="The longest runs" hint="at work is the model and its tool calls; the rest of a run is a wait on its own background work">
|
|
195
|
+
<Sorted
|
|
196
|
+
st={st}
|
|
197
|
+
id="lanes"
|
|
198
|
+
empty="no lane ran in this window"
|
|
199
|
+
head={[{ label: 'run' }, { label: 'started' }, { label: 'start to end', num: true, look: 'bar' }, { label: 'at work', num: true, look: 'bar' }, { label: 'the model', num: true, look: 'bar' }, { label: 'tool calls', num: true, look: 'bar' }, { label: 'model, per call', num: true, look: 'heat' }]}
|
|
200
|
+
rows={d.laneRuns.map((r) => ({ key: `${r.session}/${r.agent}`, title: `session ${r.session}, lane ${r.agent}`, cells: [`${r.repo} ${r.agent.replace(/^agent-/, '').slice(0, 8)}`, { v: r.start, text: when(r.start) }, num.h(r.wall), num.h(r.work), num.h(r.model), num.n(r.calls), num.s(r.calls === 0 ? 0 : r.model / r.calls)] }))}
|
|
201
|
+
/>
|
|
202
|
+
</Section>
|
|
203
|
+
</Page>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function Main({ d, st }: Ctx) {
|
|
208
|
+
const parts = partsOf(d.wall)
|
|
209
|
+
return (
|
|
210
|
+
<Page title={TITLES.main} lead={<>{d.sessions} main sessions took <b>{dur(wholeOf(parts))}</b> and spent {biggest(parts)}. Idle time past 30 minutes is left out.</>}>
|
|
211
|
+
<Section title="Where their hours went">
|
|
212
|
+
<SegBar parts={parts} />
|
|
213
|
+
<Legend parts={parts} />
|
|
214
|
+
</Section>
|
|
215
|
+
<Section title="The longest sessions" hint="hover a row for its first prompt">
|
|
216
|
+
<RankBars empty="no session in this window" rows={d.longest.map((s) => ({ name: `${s.repo} ${s.session.slice(0, 8)}`, value: wallOf(s.wall), shown: dur(wallOf(s.wall)), title: s.first }))} />
|
|
217
|
+
</Section>
|
|
218
|
+
<Section title="The figures">
|
|
219
|
+
<Sorted
|
|
220
|
+
st={st}
|
|
221
|
+
id="main"
|
|
222
|
+
empty="no session in this window"
|
|
223
|
+
head={[{ label: 'session' }, { label: 'wall', num: true, look: 'bar' }, { label: 'the model', num: true, look: 'bar' }, { label: 'tools', num: true, look: 'bar' }, { label: 'waiting on background', num: true, look: 'bar' }, { label: 'waiting on you', num: true, look: 'bar' }, { label: 'tool calls', num: true, look: 'bar' }, { label: 'lane runs', num: true, look: 'bar' }]}
|
|
224
|
+
rows={d.longest.map((s) => ({ key: s.session, title: s.first, cells: [`${s.repo} ${s.session.slice(0, 8)}`, num.h(wallOf(s.wall)), num.h(s.wall.model), num.h(s.wall.tools), num.h(s.wall.background), num.h(s.wall.human), num.n(s.calls), num.n(s.subagents)] }))}
|
|
225
|
+
/>
|
|
226
|
+
</Section>
|
|
227
|
+
</Page>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function Turns({ d, st }: Ctx) {
|
|
232
|
+
const { sub, reads } = d.turns
|
|
233
|
+
const top = reads[0]
|
|
234
|
+
return (
|
|
235
|
+
<Page
|
|
236
|
+
title={TITLES.turns}
|
|
237
|
+
lead={<>Before each tool call the model takes a turn: <b>{dur(beforeCall(d.models.sub))}</b> in a lane, {dur(beforeCall(d.models.main))} in a main session. The time is in those turns, not in the commands{top == null ? '' : <>: the turns that issued a <b>{top.shape}</b> took {dur(top.model)} of model, and the {top.shape} runs themselves {dur(top.runMs)}</>}. A faster command saves little: what shortens a turn is under the chart.</>}
|
|
238
|
+
>
|
|
239
|
+
<Tiles>
|
|
240
|
+
<Tile value={dur(beforeCall(d.models.sub))} label="of model before each call, lanes" />
|
|
241
|
+
<Tile value={pct(sub.reads, sub.calls)} label="of lane calls are a single read" hint="a grep, a sed, a Read alone in its turn: the turns a command that answers whole would save" />
|
|
242
|
+
<Tile value={pct(sub.parallel, sub.calls)} label="of lane calls go out with others" hint="calls sent together in one turn" />
|
|
243
|
+
<Tile value={dur(beforeCall(d.models.main))} label="of model before each call, main sessions" />
|
|
244
|
+
</Tiles>
|
|
245
|
+
<Section title="Each kind of read: the model's turns, and the read itself" hint={top == null || top.calls === 0 ? 'two bars a row, on one scale' : `two bars a row, on one scale. Read them per call: a ${top.shape} costs ${dur(top.model / top.calls)} of model before it (the agent reads its context, decides, writes the call) and ${dur(top.runMs / top.calls)} of ${top.shape} itself`}>
|
|
246
|
+
<ul className="tvkeys">
|
|
247
|
+
<li><i className="k1" />the model's turns that issued it</li>
|
|
248
|
+
<li><i className="k2" />the reads themselves, running</li>
|
|
249
|
+
</ul>
|
|
250
|
+
<RankBars empty="no read in this window" rows={reads.map((r) => ({ name: r.shape, value: r.model, shown: dur(r.model), note: `${group(r.calls)} calls`, second: { value: r.runMs, shown: dur(r.runMs) } }))} />
|
|
251
|
+
</Section>
|
|
252
|
+
<Section title="What shortens the blue bars" hint="the model time is paid once per turn, whatever the turn holds: the lever is fewer turns, then shorter ones">
|
|
253
|
+
<dl className="tvdefs">
|
|
254
|
+
<div><dt>reads sent together <b>about {dur((sub.reads / 2) * beforeCall(d.models.sub))}</b></dt><dd>{pct(sub.reads, sub.calls)} of the lanes' calls are one read alone in its turn ({group(sub.reads)} calls), and only {pct(sub.parallel, sub.calls)} of their calls go out with others. If those reads went out two per turn, half of their turns would go: an estimate, at {dur(beforeCall(d.models.sub))} a turn.</dd></div>
|
|
255
|
+
<div><dt>one command that answers whole</dt><dd>a search that takes six greps is six turns. A command or a page that answers the question in one call is one turn. Not measured here: a drill measures it (sk drill).</dd></div>
|
|
256
|
+
<div><dt>shorter turns</dt><dd>a turn takes longer with a larger context and a larger model: the page Model and context gives the typical turn of each model at each size of context.</dd></div>
|
|
257
|
+
</dl>
|
|
258
|
+
</Section>
|
|
259
|
+
<Section title="The figures">
|
|
260
|
+
<Sorted
|
|
261
|
+
st={st}
|
|
262
|
+
id="turns"
|
|
263
|
+
empty="no read in this window"
|
|
264
|
+
head={[{ label: 'read' }, { label: 'calls', num: true, look: 'bar' }, { label: 'model turns', num: true, look: 'bar' }, { label: 'model, per call', num: true, look: 'heat' }, { label: 'running', num: true, look: 'bar' }, { label: 'running, per call', num: true, look: 'heat' }]}
|
|
265
|
+
rows={reads.map((r) => ({ key: r.shape, cells: [r.shape, num.n(r.calls), num.h(r.model), num.s(r.calls === 0 ? 0 : r.model / r.calls), num.h(r.runMs), num.s(r.calls === 0 ? 0 : r.runMs / r.calls)] }))}
|
|
266
|
+
/>
|
|
267
|
+
</Section>
|
|
268
|
+
</Page>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** a cut with too few turns says nothing about a typical turn */
|
|
273
|
+
const MIN_TURNS = 20
|
|
274
|
+
const tokens = (n: number): string => (n <= 0 ? '' : n >= 1000 ? `${Math.round(n / 1000)}k` : `${Math.round(n)}`)
|
|
275
|
+
|
|
276
|
+
function ModelCuts({ st, id, cuts }: { st: TimeSt; id: string; cuts: TurnCut[] }) {
|
|
277
|
+
const whole = cuts.filter((c) => c.ctx === '')
|
|
278
|
+
const top = whole[0]
|
|
279
|
+
const sizes = top == null ? [] : cuts.filter((c) => c.model === top.model && c.ctx !== '' && c.turns >= MIN_TURNS)
|
|
280
|
+
return (
|
|
281
|
+
<>
|
|
282
|
+
{top == null || sizes.length < 2 ? null : (
|
|
283
|
+
<Section title={`A typical turn of ${top.model}, by the size of its context`} hint="the tokens the turn read before it wrote its call; a size with fewer than 20 turns is left out of the chart">
|
|
284
|
+
<RankBars empty="" rows={sizes.map((c) => ({ key: c.ctx, name: c.ctx, note: `${group(c.turns)} turns`, value: c.p50, shown: dur(c.p50) }))} />
|
|
285
|
+
</Section>
|
|
286
|
+
)}
|
|
287
|
+
{whole.filter((c) => c.turns >= MIN_TURNS).length < 2 ? null : (
|
|
288
|
+
<Section title="A typical turn, by model" hint="every size of context together">
|
|
289
|
+
<RankBars empty="" rows={whole.filter((c) => c.turns >= MIN_TURNS).map((c) => ({ key: c.model, name: c.model, note: `${group(c.turns)} turns`, value: c.p50, shown: dur(c.p50) }))} />
|
|
290
|
+
</Section>
|
|
291
|
+
)}
|
|
292
|
+
<Section title="The figures" hint="a row with a dot is one size of context of the model above it; read and written are the typical tokens of a turn">
|
|
293
|
+
<Sorted
|
|
294
|
+
st={st}
|
|
295
|
+
id={id}
|
|
296
|
+
empty="no turn wrote a call in this window"
|
|
297
|
+
head={[{ label: 'model, context' }, { label: 'turns', num: true, look: 'bar' }, { label: 'model time', num: true, look: 'bar' }, { label: 'typical turn', num: true, look: 'heat', title: 'the median turn' }, { label: 'slow turn', num: true, look: 'heat', title: 'the turn 95 in 100 are faster than' }, { label: 'read', num: true, title: 'the tokens a typical turn read: its context' }, { label: 'written', num: true, look: 'heat', title: 'the tokens a typical turn wrote' }, { label: 'calls a turn', num: true, title: 'the calls a turn sends together, on average' }]}
|
|
298
|
+
rows={cuts.map((c) => ({ key: `${c.model}/${c.ctx}`, cells: [c.ctx === '' ? c.model : `· ${c.ctx}`, num.n(c.turns), num.h(c.ms), num.s(c.p50), num.s(c.p95), { v: c.ctxP50, text: tokens(c.ctxP50) }, { v: c.outP50, text: tokens(c.outP50) }, { v: c.turns === 0 ? 0 : c.calls / c.turns, text: c.turns === 0 ? '' : (c.calls / c.turns).toFixed(2) }] }))}
|
|
299
|
+
/>
|
|
300
|
+
</Section>
|
|
301
|
+
</>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** « 4.1 s under 50k, 9.8 s at 200k to 400k »: the smallest and the largest size of a model with enough turns */
|
|
306
|
+
const growth = (cuts: TurnCut[]): ReactNode => {
|
|
307
|
+
const top = cuts.find((c) => c.ctx === '')
|
|
308
|
+
const sizes = top == null ? [] : cuts.filter((c) => c.model === top.model && c.ctx !== '' && c.ctx !== 'not recorded' && c.turns >= MIN_TURNS)
|
|
309
|
+
const [small, large] = [sizes[0], sizes[sizes.length - 1]]
|
|
310
|
+
if (top == null) return 'No turn wrote a call.'
|
|
311
|
+
return <><b>{top.model}</b> wrote {group(top.turns)} turns: a typical one takes <b>{dur(top.p50)}</b>{small == null || large == null || small === large ? '' : <>, {dur(small.p50)} with a context {small.ctx} and {dur(large.p50)} with {large.ctx}</>}.</>
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function Models({ d, st }: Ctx) {
|
|
315
|
+
const { main, sub } = d.models
|
|
316
|
+
return (
|
|
317
|
+
<Page title={TITLES.models} lead={<>A turn is the model reading its context, deciding, and writing its next call. In the lanes, {growth(sub)} In the main sessions, {growth(main)} Only the turns that wrote a call are counted, each with the model time before its call.</>}>
|
|
318
|
+
<h2 className="tvpart">Lanes</h2>
|
|
319
|
+
<ModelCuts st={st} id="models/sub" cuts={sub} />
|
|
320
|
+
<h2 className="tvpart">Main sessions</h2>
|
|
321
|
+
<ModelCuts st={st} id="models/main" cuts={main} />
|
|
322
|
+
</Page>
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const AFTER_WORDS: Record<string, string> = { ok: 'finished later', failed: 'failed later', stopped: 'was stopped', none: 'no end recorded' }
|
|
327
|
+
|
|
328
|
+
function Timeouts({ d, st }: Ctx) {
|
|
329
|
+
const t = d.timeouts
|
|
330
|
+
return (
|
|
331
|
+
<Page
|
|
332
|
+
title={TITLES.timeouts}
|
|
333
|
+
lead={t.count === 0 ? 'No command reached the time limit of its call in this window.' : <><b>{group(t.count)}</b> commands ran into the time limit of their call. The harness does not kill them: it moves each one to the background and the agent goes on. {group(t.finished)} finished later, {group(t.failed)} failed, {group(t.stopped)} were stopped, and {group(t.lost)} have no end recorded: their session ended first, or they still run.</>}
|
|
334
|
+
>
|
|
335
|
+
<Tiles>
|
|
336
|
+
<Tile value={group(t.count)} label="commands hit their limit" />
|
|
337
|
+
<Tile value={group(t.finished)} label="finished later, in the background" />
|
|
338
|
+
<Tile value={group(t.lost)} label="have no end recorded" hint="the session ended before the command, or it still runs" />
|
|
339
|
+
<Tile value={dur(t.limitMs)} label="waited in front of them" hint="the time the agent sat in the call before the limit moved it to the background" />
|
|
340
|
+
</Tiles>
|
|
341
|
+
<Section title="How often, by command">
|
|
342
|
+
<RankBars empty="no command reached its limit in this window" rows={t.byShape.map((s) => ({ name: s.shape, value: s.n, shown: `${group(s.n)} times` }))} />
|
|
343
|
+
</Section>
|
|
344
|
+
<Section title="By command" hint={`in all is the typical time from start to end, for the ones that ended. ${FOLD_HINT}`}>
|
|
345
|
+
<Sorted
|
|
346
|
+
st={st}
|
|
347
|
+
id="timeouts/shapes"
|
|
348
|
+
empty="no command reached its limit in this window"
|
|
349
|
+
head={[{ label: 'command' }, { label: 'times', num: true, look: 'bar' }, { label: 'finished later', num: true, look: 'bar' }, { label: 'no end recorded', num: true, look: 'heat' }, { label: 'waited', num: true, look: 'bar' }, { label: 'in all', num: true, look: 'heat' }]}
|
|
350
|
+
rows={t.byShape.map((s) => foldRow<TimeoutShape>(s.shape, s, (x) => x.shape, (x) => [x.shape, num.n(x.n), num.n(x.finished), num.n0(x.lost), num.h(x.limitMs), x.typicalTotalMs == null ? '' : num.s(x.typicalTotalMs)]))}
|
|
351
|
+
/>
|
|
352
|
+
</Section>
|
|
353
|
+
<Section title="The newest ones" hint="hover a command to read it whole">
|
|
354
|
+
<Sorted
|
|
355
|
+
st={st}
|
|
356
|
+
id="timeouts/newest"
|
|
357
|
+
empty="no command reached its limit in this window"
|
|
358
|
+
head={[{ label: 'command' }, { label: 'when' }, { label: 'where' }, { label: 'limit', num: true }, { label: 'what became of it' }, { label: 'in all', num: true, look: 'heat' }]}
|
|
359
|
+
rows={t.rows.map((r, i) => ({ key: `${i}/${r.session}/${r.at}`, title: r.cmd, cells: [<span className="tvcmd">{r.cmd}</span>, { v: r.at, text: when(r.at) }, `${r.repo}${r.agent ? ', a lane' : ''}`, num.s(r.limitMs), AFTER_WORDS[r.after] ?? r.after, r.totalMs == null ? '' : num.s(r.totalMs)] }))}
|
|
360
|
+
/>
|
|
361
|
+
</Section>
|
|
362
|
+
</Page>
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** each measured cost in a few plain words; the report's own sentence is the row's detail */
|
|
367
|
+
export const COST_WORDS: Record<string, string> = {
|
|
368
|
+
background: 'background commands, from start to end',
|
|
369
|
+
failed: 'commands that failed',
|
|
370
|
+
'bash-edits': 'file edits done through the shell',
|
|
371
|
+
classifier: 'the permission check before each command',
|
|
372
|
+
polling: 'loops that wait and poll',
|
|
373
|
+
hooks: 'a hook on every tool call',
|
|
374
|
+
approval: 'waiting for you to allow a call',
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function Costs({ d }: Ctx) {
|
|
378
|
+
const costs = costsOf(d)
|
|
379
|
+
const top = costs[0]
|
|
380
|
+
const beside = d.insights.find((i) => i.id === 'background')
|
|
381
|
+
return (
|
|
382
|
+
<Page title={TITLES.costs} lead={top == null ? 'Nothing measured in this window.' : <>The largest measured cost is <b>{COST_WORDS[top.id] ?? top.id}</b>: {top.estimate ? 'about ' : ''}{dur(top.ms)}. « about » marks an estimate, every other figure is counted.</>}>
|
|
383
|
+
<Section title="Measured costs, largest first">
|
|
384
|
+
<RankBars empty="nothing measured in this window" rows={costs.map((i) => ({ name: COST_WORDS[i.id] ?? i.id, value: i.ms, shown: `${i.estimate ? 'about ' : ''}${dur(i.ms)}` }))} />
|
|
385
|
+
</Section>
|
|
386
|
+
<Section title="What each one is">
|
|
387
|
+
<dl className="tvdefs">
|
|
388
|
+
{costs.map((i) => <div key={i.id}><dt>{COST_WORDS[i.id] ?? i.id} <b>{i.estimate ? 'about ' : ''}{dur(i.ms)}</b></dt><dd>{i.text}</dd></div>)}
|
|
389
|
+
</dl>
|
|
390
|
+
</Section>
|
|
391
|
+
{beside == null ? null : (
|
|
392
|
+
<Section title="Not a cost: what ran in the background" hint="a dev server, a watcher or a long job goes on beside the agent, so its hours are no wait. The time an agent did stop for background work is the green part of the walls">
|
|
393
|
+
<dl className="tvdefs">
|
|
394
|
+
<div><dt>{COST_WORDS[beside.id]} <b>{dur(beside.ms)}</b></dt><dd>{beside.text}</dd></div>
|
|
395
|
+
</dl>
|
|
396
|
+
</Section>
|
|
397
|
+
)}
|
|
398
|
+
</Page>
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const RUNS_WORDS: Record<RunsMode, { label: string; title: string }> = {
|
|
403
|
+
fg: { label: 'foreground', title: 'the calls an agent waits inside' },
|
|
404
|
+
bg: { label: 'background', title: 'the runs that go on beside the agent, timed from their start to their end' },
|
|
405
|
+
split: { label: 'side by side', title: 'each kind in its own chart, on its own scale' },
|
|
406
|
+
both: { label: 'together', title: 'both kinds in one chart, on one scale' },
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** which runs the page shows; the pick is kept for every page of commands */
|
|
410
|
+
const RunsPick = observer(({ st }: { st: TimeSt }) => (
|
|
411
|
+
<div className="tvruns">
|
|
412
|
+
<div className="seg" role="radiogroup" aria-label="which runs">
|
|
413
|
+
{RUNS_MODES.map((m) => <button key={m} role="radio" aria-checked={st.runs === m} className={st.runs === m ? 'on' : ''} onClick={() => st.setRuns(m)}><Hint tip={RUNS_WORDS[m].title}>{RUNS_WORDS[m].label}</Hint></button>)}
|
|
414
|
+
</div>
|
|
415
|
+
<span>an agent waits inside a foreground call; a background run goes on beside it, timed from its start to its end</span>
|
|
416
|
+
</div>
|
|
417
|
+
))
|
|
418
|
+
|
|
419
|
+
type Listed<T> = { row: T; kind: RunKind }
|
|
420
|
+
type RunList<T> = { id: RunKind | 'both'; title: string; hint: string; rows: Listed<T>[] }
|
|
421
|
+
const KIND_WORDS: Record<RunList<never>['id'], { title: string; hint: string }> = {
|
|
422
|
+
fg: { title: 'Foreground', hint: 'the agent waits inside the call' },
|
|
423
|
+
bg: { title: 'Background', hint: 'beside the agent, from start to end' },
|
|
424
|
+
both: { title: 'Foreground and background', hint: 'on one scale' },
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/** the lists the control asks for: one per kind, or both kinds in one list ranked by `by` */
|
|
428
|
+
function runLists<T>(d: TimePage, mode: RunsMode, pick: (s: RunSet) => T[], by: (r: T) => number): RunList<T>[] {
|
|
429
|
+
const of = (kind: RunKind): Listed<T>[] => pick(d.runs[kind]).map((row) => ({ row, kind }))
|
|
430
|
+
if (mode === 'both') return [{ id: 'both', ...KIND_WORDS.both, rows: [...of('fg'), ...of('bg')].sort((a, b) => by(b.row) - by(a.row)).slice(0, TOP_RUNS) }]
|
|
431
|
+
return (mode === 'split' ? RUN_KINDS : [mode]).map((k) => ({ id: k, ...KIND_WORDS[k], rows: of(k) }))
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** a background row says so where both kinds share a list */
|
|
435
|
+
const tagOf = (l: RunList<unknown>, kind: RunKind): string | undefined => (l.id === 'both' && kind === 'bg' ? 'background' : undefined)
|
|
436
|
+
const nameCell = (name: string, tag: string | undefined): ReactNode => (tag == null ? name : <>{name}<em className="tvtag">{tag}</em></>)
|
|
437
|
+
|
|
438
|
+
/** one chart per list, side by side when there are two, then the table of each */
|
|
439
|
+
function RunSections<T>({ lists, title, hint, folds = false, chart, table }: { lists: RunList<T>[]; title: string; hint?: string; /** its tables hold rows that open on their scripts */ folds?: boolean; chart: (l: RunList<T>) => ReactNode; table: (l: RunList<T>) => ReactNode }) {
|
|
440
|
+
return (
|
|
441
|
+
<>
|
|
442
|
+
<Section title={title} hint={hint}>
|
|
443
|
+
<div className={lists.length > 1 ? 'tvsplit' : undefined}>
|
|
444
|
+
{lists.map((l) => <div key={l.id}><h3 className="tvkind">{l.title}<em>{l.hint}</em></h3>{chart(l)}</div>)}
|
|
445
|
+
</div>
|
|
446
|
+
</Section>
|
|
447
|
+
{lists.map((l) => <Section key={l.id} title={`The figures: ${l.title.toLowerCase()}`} hint={folds ? FOLD_HINT : undefined}>{table(l)}</Section>)}
|
|
448
|
+
</>
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** a row of the tools page: a family of Bash commands, or another tool */
|
|
453
|
+
type ToolRow = { name: string; title: string; row: ShapeRow; more: string }
|
|
454
|
+
const toolRows = (s: RunSet): ToolRow[] => [
|
|
455
|
+
...s.families.map((f) => ({ name: `Bash: ${FAMILY_WORDS[f.family].label}`, title: FAMILY_WORDS[f.family].title, row: f, more: f.top.map((t) => `${t.shape} ${dur(t.ms)}`).join(', ') })),
|
|
456
|
+
...s.tools.map((t) => ({ name: t.shape, title: t.shape, row: t, more: '' })),
|
|
457
|
+
].sort((a, b) => b.row.ms - a.row.ms)
|
|
458
|
+
|
|
459
|
+
const bashOf = (s: RunSet): number => s.families.reduce((n, f) => n + f.ms, 0)
|
|
460
|
+
|
|
461
|
+
const Tools = observer(function Tools({ d, st }: Ctx) {
|
|
462
|
+
const { fg, bg } = d.runs
|
|
463
|
+
const top = [...fg.families].sort((a, b) => b.ms - a.ms)[0]
|
|
464
|
+
const lists = runLists(d, st.runs, toolRows, (r) => r.row.ms)
|
|
465
|
+
return (
|
|
466
|
+
<Page
|
|
467
|
+
title={TITLES.tools}
|
|
468
|
+
lead={fg.calls === 0 ? 'No tool call in this window.' : <>The agents waited <b>{dur(fg.ms)}</b> inside {group(fg.calls)} foreground calls: {dur(bashOf(fg))} in Bash and {dur(fg.ms - bashOf(fg))} in every other tool.{top == null ? '' : <> The largest part of Bash is <b>{FAMILY_WORDS[top.family].label}</b>: {dur(top.ms)}.</>} {group(bg.calls)} background runs lasted {dur(bg.ms)} beside them.</>}
|
|
469
|
+
>
|
|
470
|
+
<RunsPick st={st} />
|
|
471
|
+
<RunSections
|
|
472
|
+
lists={lists}
|
|
473
|
+
title="Total time, by tool"
|
|
474
|
+
hint="Bash is split by what the command does; hover a row for what falls in it"
|
|
475
|
+
chart={(l) => <RankBars empty="no call of this kind in this window" rows={l.rows.map(({ row: r, kind }): Ranked => ({ key: `${kind}/${r.name}`, name: r.name, note: tagOf(l, kind), title: `${r.title}${r.more === '' ? '' : ` · the largest: ${r.more}`}`, value: r.row.ms, shown: dur(r.row.ms) }))} />}
|
|
476
|
+
table={(l) => (
|
|
477
|
+
<Sorted
|
|
478
|
+
st={st}
|
|
479
|
+
id={`tools/${l.id}`}
|
|
480
|
+
empty="no call of this kind in this window"
|
|
481
|
+
head={[{ label: 'tool' }, { label: 'calls', num: true, look: 'bar' }, { label: 'total', num: true, look: 'bar' }, { label: 'typical', num: true, look: 'heat', title: 'the median call' }, { label: 'slow', num: true, look: 'heat', title: 'the call 95 in 100 are faster than' }, { label: 'failed', num: true, look: 'heat' }, { label: 'the largest commands', more: true }]}
|
|
482
|
+
rows={l.rows.map(({ row: r, kind }) => ({ key: `${kind}/${r.name}`, title: r.title, cells: [nameCell(r.name, tagOf(l, kind)), num.n(r.row.calls), num.h(r.row.ms), perRun(l)(r.row.p50), perRun(l)(r.row.p95), num.n0(r.row.failed + r.row.blocked), r.more] }))}
|
|
483
|
+
/>
|
|
484
|
+
)}
|
|
485
|
+
/>
|
|
486
|
+
</Page>
|
|
487
|
+
)
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
const topOf = (rows: ShapeRow[]): ShapeRow | undefined => rows[0]
|
|
491
|
+
/** a foreground call is seconds, so its column keeps one unit; a background run goes from seconds to hours */
|
|
492
|
+
const perRun = (l: RunList<unknown>): ((ms: number) => Num) => (l.id === 'fg' ? num.s : num.d)
|
|
493
|
+
|
|
494
|
+
const Commands = observer(function Commands({ d, st }: Ctx) {
|
|
495
|
+
const [fg, bg] = [topOf(d.runs.fg.commands), topOf(d.runs.bg.commands)]
|
|
496
|
+
const lists = runLists(d, st.runs, (s) => s.commands, (r) => r.ms)
|
|
497
|
+
return (
|
|
498
|
+
<Page
|
|
499
|
+
title={TITLES.commands}
|
|
500
|
+
lead={fg == null && bg == null ? 'No command in this window.' : <>{fg == null ? 'No foreground command.' : <>In the foreground <b>{fg.shape}</b> takes the most: {dur(fg.ms)} over {group(fg.calls)} runs.</>} {bg == null ? '' : <>In the background <b>{bg.shape}</b> ran the longest: {dur(bg.ms)} over {group(bg.calls)} runs.</>} Commands are grouped by their shape.</>}
|
|
501
|
+
>
|
|
502
|
+
<RunsPick st={st} />
|
|
503
|
+
<RunSections
|
|
504
|
+
lists={lists}
|
|
505
|
+
title="Total time, by command"
|
|
506
|
+
folds
|
|
507
|
+
chart={(l) => <RankBars empty="no command of this kind in this window" rows={l.rows.map(({ row: r, kind }): Ranked => ({ key: `${kind}/${r.shape}`, name: r.shape, note: tagOf(l, kind), value: r.ms, shown: dur(r.ms) }))} />}
|
|
508
|
+
table={(l) => (
|
|
509
|
+
<Sorted
|
|
510
|
+
st={st}
|
|
511
|
+
id={`commands/${l.id}`}
|
|
512
|
+
empty="no command of this kind in this window"
|
|
513
|
+
head={[{ label: 'command' }, { label: 'runs', num: true, look: 'bar' }, { label: 'total', num: true, look: 'bar' }, { label: 'typical', num: true, look: 'heat', title: 'the median run' }, { label: 'slow', num: true, look: 'heat', title: 'the run 95 in 100 are faster than' }, { label: 'longest', num: true, look: 'heat' }, { label: 'failed', num: true, look: 'heat' }, { label: 'hit its limit', num: true, look: 'heat' }, { label: 'no end', num: true, title: 'runs with no end recorded: still running, or their session ended first; left out of the times' }]}
|
|
514
|
+
rows={l.rows.map(({ row: r, kind }) => {
|
|
515
|
+
const cells = (x: ShapeRow): Row['cells'] => [nameCell(x.shape, tagOf(l, kind)), num.n(x.calls), num.h(x.ms), x.p95 === 0 ? '' : perRun(l)(x.p50), x.p95 === 0 ? '' : perRun(l)(x.p95), x.max === 0 ? '' : perRun(l)(x.max), num.n0(x.failed + x.blocked), num.n0(x.timeouts), num.n0(x.noEnd)]
|
|
516
|
+
return foldRow<ShapeRow>(`${kind}/${r.shape}`, r, (x) => x.shape, cells)
|
|
517
|
+
})}
|
|
518
|
+
/>
|
|
519
|
+
)}
|
|
520
|
+
/>
|
|
521
|
+
</Page>
|
|
522
|
+
)
|
|
523
|
+
})
|
|
524
|
+
|
|
525
|
+
const Slow = observer(function Slow({ d, st }: Ctx) {
|
|
526
|
+
const [fg, bg] = [topOf(d.runs.fg.slow), topOf(d.runs.bg.slow)]
|
|
527
|
+
const lists = runLists(d, st.runs, (s) => s.slow, (r) => r.p95)
|
|
528
|
+
return (
|
|
529
|
+
<Page
|
|
530
|
+
title={TITLES.slow}
|
|
531
|
+
lead={fg == null && bg == null ? 'No command ran five times in this window.' : <>{fg == null ? 'No foreground command ran five times.' : <>The slowest foreground call is <b>{fg.shape}</b>: 95 runs in 100 end within {dur(fg.p95)}, and the agent waits that long.</>} {bg == null ? '' : <>The longest background run is <b>{bg.shape}</b>: {dur(bg.p95)}.</>} Only commands run five times or more are listed.</>}
|
|
532
|
+
>
|
|
533
|
+
<RunsPick st={st} />
|
|
534
|
+
<RunSections
|
|
535
|
+
lists={lists}
|
|
536
|
+
title="A slow run, by command"
|
|
537
|
+
folds
|
|
538
|
+
hint="the run that 95 in 100 are faster than"
|
|
539
|
+
chart={(l) => <RankBars empty="no command of this kind ran five times in this window" rows={l.rows.map(({ row: r, kind }): Ranked => ({ key: `${kind}/${r.shape}`, name: r.shape, note: tagOf(l, kind), value: r.p95, shown: dur(r.p95) }))} />}
|
|
540
|
+
table={(l) => (
|
|
541
|
+
<Sorted
|
|
542
|
+
st={st}
|
|
543
|
+
id={`slow/${l.id}`}
|
|
544
|
+
empty="no command of this kind ran five times in this window"
|
|
545
|
+
head={[{ label: 'command' }, { label: 'runs', num: true, look: 'bar' }, { label: 'typical', num: true, look: 'heat', title: 'the median run' }, { label: 'slow', num: true, look: 'heat', title: 'the run 95 in 100 are faster than' }, { label: 'longest', num: true, look: 'heat' }, { label: 'total', num: true, look: 'bar' }]}
|
|
546
|
+
rows={l.rows.map(({ row: r, kind }) => {
|
|
547
|
+
const cells = (x: ShapeRow): Row['cells'] => [nameCell(x.shape, tagOf(l, kind)), num.n(x.calls), x.p95 === 0 ? '' : perRun(l)(x.p50), x.p95 === 0 ? '' : perRun(l)(x.p95), x.max === 0 ? '' : perRun(l)(x.max), num.h(x.ms)]
|
|
548
|
+
return foldRow<ShapeRow>(`${kind}/${r.shape}`, r, (x) => x.shape, cells)
|
|
549
|
+
})}
|
|
550
|
+
/>
|
|
551
|
+
)}
|
|
552
|
+
/>
|
|
553
|
+
</Page>
|
|
554
|
+
)
|
|
555
|
+
})
|
|
556
|
+
|
|
557
|
+
const Failures = observer(function Failures({ d, st }: Ctx) {
|
|
558
|
+
const { fg, bg } = d.runs
|
|
559
|
+
const lists = runLists(d, st.runs, (s) => s.failedShapes, (r) => r.failedMs)
|
|
560
|
+
return (
|
|
561
|
+
<Page
|
|
562
|
+
title={TITLES.failures}
|
|
563
|
+
lead={fg.failed + bg.failed === 0 ? 'No command failed in this window.' : <>In the foreground {group(fg.failed)} calls failed and lost <b>{dur(fg.failedMs)}</b> of waiting. In the background {group(bg.failed)} runs ended with an error or were stopped, {dur(bg.failedMs)} after their start: a server someone stops counts here, so that figure is no loss. « unchanged » counts the runs started again with no change: the wait is paid twice.</>}
|
|
564
|
+
>
|
|
565
|
+
<RunsPick st={st} />
|
|
566
|
+
<RunSections
|
|
567
|
+
lists={lists}
|
|
568
|
+
title="Time in failed runs, by command"
|
|
569
|
+
folds
|
|
570
|
+
chart={(l) => <RankBars empty="no command of this kind failed in this window" rows={l.rows.map(({ row: r, kind }): Ranked => ({ key: `${kind}/${r.shape}`, name: r.shape, note: tagOf(l, kind), value: r.failedMs, shown: dur(r.failedMs) }))} />}
|
|
571
|
+
table={(l) => (
|
|
572
|
+
<Sorted
|
|
573
|
+
st={st}
|
|
574
|
+
id={`failures/${l.id}`}
|
|
575
|
+
empty="no command of this kind failed in this window"
|
|
576
|
+
head={[{ label: 'command' }, { label: 'failed', num: true, look: 'heat' }, { label: 'of its runs', num: true, look: 'heat' }, { label: 'time in failed runs', num: true, look: 'bar' }, { label: 'run again', num: true, look: 'bar' }, { label: 'unchanged', num: true, look: 'heat', title: 'started again with no change in between' }]}
|
|
577
|
+
rows={l.rows.map(({ row: r, kind }) => {
|
|
578
|
+
const cells = (x: ShapeRow): Row['cells'] => [nameCell(x.shape, tagOf(l, kind)), num.n0(x.failed + x.blocked), num.pct(x.failed + x.blocked, x.calls), num.h(x.failedMs), num.n0(x.retried), num.n0(x.blind)]
|
|
579
|
+
const row = foldRow<ShapeRow>(`${kind}/${r.shape}`, { ...r, parts: r.parts?.filter((x) => x.failed + x.blocked > 0) }, (x) => x.shape, cells)
|
|
580
|
+
return row
|
|
581
|
+
})}
|
|
582
|
+
/>
|
|
583
|
+
)}
|
|
584
|
+
/>
|
|
585
|
+
</Page>
|
|
586
|
+
)
|
|
587
|
+
})
|
|
588
|
+
|
|
589
|
+
function RefusedPage({ d, st }: Ctx) {
|
|
590
|
+
const r = d.refused
|
|
591
|
+
const of = (by: string): RefusedCut | undefined => r.by.find((c) => c.by === by)
|
|
592
|
+
const [checked, hook, rule, you] = [of('classifier'), of('hook'), of('rule'), of('you')]
|
|
593
|
+
const said = (c: RefusedCut | undefined, words: string): ReactNode => (c == null ? null : <> {group(c.n)} {words} ({dur(c.ms)}),</>)
|
|
594
|
+
return (
|
|
595
|
+
<Page
|
|
596
|
+
title={TITLES.refused}
|
|
597
|
+
lead={r.count === 0 ? 'No call was refused in this window.' : <><b>{group(r.count)}</b> calls were refused before they ran:{said(checked, 'by the auto mode classifier')}{said(hook, 'by a hook')}{said(rule, 'by a permission rule')}{said(you, 'by you')} in all <b>{dur(r.ms)}</b> of model time. That time is the turns that wrote those calls: each refusal is a turn spent for nothing, and the next turn reads the refusal and tries another way.</>}
|
|
598
|
+
>
|
|
599
|
+
<Tiles>
|
|
600
|
+
<Tile value={group(r.count)} label="calls refused" />
|
|
601
|
+
<Tile value={dur(r.ms)} label="of model, in the turns that wrote them" hint="the model time before each refused call: the turn was written for nothing" />
|
|
602
|
+
<Tile value={checked == null ? '0' : group(checked.n)} label="refused by the classifier" hint={checked == null ? undefined : `${dur(checked.ms)} of model time in those turns`} />
|
|
603
|
+
<Tile value={checked == null ? '0' : dur(checked.ms)} label="of model, in the classifier's refusals" />
|
|
604
|
+
</Tiles>
|
|
605
|
+
<Section title="Who refused" hint="the bar is the number of calls; the figure after it is the model time of the turns that wrote them">
|
|
606
|
+
<RankBars empty="no call was refused in this window" rows={r.by.map((c) => ({ key: c.name, name: REFUSER_WORDS[c.by ?? 'other'].label, title: REFUSER_WORDS[c.by ?? 'other'].title, note: dur(c.ms), value: c.n, shown: `${group(c.n)} calls` }))} />
|
|
607
|
+
</Section>
|
|
608
|
+
<Section title="Why" hint="a hook by its script (or its place in the settings, where the harness gives no more), the classifier by the reason it gives. A hook marked ▶ opens on what it said">
|
|
609
|
+
<Sorted
|
|
610
|
+
st={st}
|
|
611
|
+
id="refused/why"
|
|
612
|
+
empty="no call was refused in this window"
|
|
613
|
+
head={[{ label: 'refused by' }, { label: 'which, or why' }, { label: 'calls', num: true, look: 'bar' }, { label: 'model time of those turns', num: true, look: 'bar' }, { label: 'a turn', num: true, look: 'heat', title: 'the model time of one such turn, on average' }]}
|
|
614
|
+
rows={r.reasons.map((c) => {
|
|
615
|
+
const cells = (x: RefusedCut): Row['cells'] => [REFUSER_WORDS[c.by ?? 'other'].label, x.name, num.n(x.n), num.h(x.ms), num.s(x.n === 0 ? 0 : x.ms / x.n)]
|
|
616
|
+
const row = foldRow<RefusedCut>(`${c.by}/${c.name}`, c, (x) => x.name, cells)
|
|
617
|
+
// a reason sits in the second column, under the hook that gave it
|
|
618
|
+
return { ...row, title: undefined, children: row.children?.map((k, i) => ({ ...k, title: undefined, cells: ['', ...cells((c.parts ?? [])[i] as RefusedCut).slice(1)] })) }
|
|
619
|
+
})}
|
|
620
|
+
/>
|
|
621
|
+
</Section>
|
|
622
|
+
<Section title="By command" hint={FOLD_HINT}>
|
|
623
|
+
<Sorted
|
|
624
|
+
st={st}
|
|
625
|
+
id="refused/shapes"
|
|
626
|
+
empty="no call was refused in this window"
|
|
627
|
+
head={[{ label: 'command' }, { label: 'calls', num: true, look: 'bar' }, { label: 'model time of those turns', num: true, look: 'bar' }]}
|
|
628
|
+
rows={r.shapes.slice(0, TOP_RUNS).map((c) => foldRow<RefusedCut>(c.name, c, (x) => x.name, (x) => [x.name, num.n(x.n), num.h(x.ms)]))}
|
|
629
|
+
/>
|
|
630
|
+
</Section>
|
|
631
|
+
<Section title="The newest ones" hint="hover a command to read it whole, and a reason to read all of it">
|
|
632
|
+
<Sorted
|
|
633
|
+
st={st}
|
|
634
|
+
id="refused/newest"
|
|
635
|
+
empty="no call was refused in this window"
|
|
636
|
+
head={[{ label: 'command' }, { label: 'when' }, { label: 'where' }, { label: 'refused by' }, { label: 'why', more: true }, { label: 'its turn', num: true, look: 'heat' }]}
|
|
637
|
+
rows={r.rows.map((x, i) => ({ key: `${i}/${x.session}/${x.at}`, title: x.cmd, cells: [<span className="tvcmd">{x.cmd === '' ? x.tool : x.cmd}</span>, { v: x.at, text: when(x.at) }, `${x.repo}${x.agent ? ', a lane' : ''}`, `${REFUSER_WORDS[x.by].label}${x.name === '' ? '' : `: ${x.name}`}`, x.reason, num.s(x.ms)] }))}
|
|
638
|
+
/>
|
|
639
|
+
</Section>
|
|
640
|
+
</Page>
|
|
641
|
+
)
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const PERM_WORDS: Record<string, string> = { rule: 'an allow rule let it through', classifier: 'the auto mode classifier checked it', user: 'you allowed it', mode: 'the permission mode let it through', 'not recorded': 'not recorded' }
|
|
645
|
+
|
|
646
|
+
function OverheadPage({ d, st }: Ctx) {
|
|
647
|
+
const o = d.overhead
|
|
648
|
+
const perm = (id: string): number | null => o.byPerm.find((r) => r.shape === id)?.p50 ?? null
|
|
649
|
+
const [rule, checked] = [perm('rule'), perm('classifier')]
|
|
650
|
+
const head: Col[] = [{ label: '' }, { label: 'calls', num: true, look: 'bar' }, { label: 'typical', num: true, look: 'heat', title: 'the median call' }, { label: 'slow', num: true, look: 'heat', title: 'the call 95 in 100 are faster than' }, { label: 'longest', num: true, look: 'heat' }]
|
|
651
|
+
const cells = (name: string, r: ShapeRow): Row['cells'] => [name, num.n(r.calls), num.s(r.p50), num.s(r.p95), num.s(r.max)]
|
|
652
|
+
return (
|
|
653
|
+
<Page
|
|
654
|
+
title={TITLES.overhead}
|
|
655
|
+
lead={o.calls === 0 ? 'No instant command ran in this window.' : <>A command that does next to nothing (echo, pwd, ls, cat, wc) takes <b>{dur(o.p50)}</b> from the call to its result in a typical case, and {dur(o.p95)} in a slow one. Every Bash call pays that floor: the permission check, the hooks on the call and the start of the shell.{rule != null && checked != null ? <> Through an allow rule it is {dur(rule)}, through the classifier {dur(checked)}.</> : null}</>}
|
|
656
|
+
>
|
|
657
|
+
<Tiles>
|
|
658
|
+
<Tile value={dur(o.p50)} label="a typical instant call" hint="the median of the foreground calls of commands whose own work is a few milliseconds" />
|
|
659
|
+
<Tile value={dur(o.p95)} label="a slow one" hint="95 in 100 are faster" />
|
|
660
|
+
{rule == null ? null : <Tile value={dur(rule)} label="when an allow rule lets it through" />}
|
|
661
|
+
{checked == null ? null : <Tile value={dur(checked)} label="when the classifier checks it" />}
|
|
662
|
+
<Tile value={group(o.calls)} label="instant calls measured" hint="echo, pwd, true, printf, date, which, cd, test, ls, cat, wc, head, tail, basename, dirname, git rev-parse" />
|
|
663
|
+
</Tiles>
|
|
664
|
+
<Section title="By how the call was allowed" hint="the same commands, so the difference is the check itself">
|
|
665
|
+
<RankBars empty="no instant command in this window" rows={o.byPerm.map((r) => ({ name: PERM_WORDS[r.shape] ?? r.shape, note: `${group(r.calls)} calls`, value: r.p50, shown: dur(r.p50) }))} />
|
|
666
|
+
</Section>
|
|
667
|
+
<Section title="By repo" hint="a hook on every call, or a slow shell profile, shows here as a repo above the others">
|
|
668
|
+
<Sorted st={st} id="overhead/repo" empty="no instant command in this window" head={[{ label: 'repo' }, ...head.slice(1)]} rows={o.byRepo.map((r) => ({ key: r.shape, cells: cells(r.shape, r) }))} />
|
|
669
|
+
</Section>
|
|
670
|
+
<Section title="Day by day">
|
|
671
|
+
<Sorted st={st} id="overhead/day" empty="no instant command in this window" head={[{ label: 'day' }, ...head.slice(1)]} rows={o.byDay.map((r) => ({ key: r.shape, cells: cells(r.shape, r) }))} />
|
|
672
|
+
</Section>
|
|
673
|
+
</Page>
|
|
674
|
+
)
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function Hooks({ d, st }: Ctx) {
|
|
678
|
+
const top = d.hooks[0]
|
|
679
|
+
return (
|
|
680
|
+
<Page title={TITLES.hooks} lead={top == null ? 'No hook run was timed in this window. The harness times every hook of a turn end, and a hook on a tool call or a prompt only when it prints something.' : <>The costliest hook is <b>{top.command}</b> in {top.repos.join(', ')}: about {dur(top.waited ?? top.total)} waited. That figure is an estimate: the mean of its timed runs times the calls it applies to.</>}>
|
|
681
|
+
<Section title="Time waited, by hook" hint="an estimate, in the repos the hook ran in. The harness times every hook of a turn end (Stop); it times a hook on a tool call or a prompt only when the hook prints something, so a silent one is missing there">
|
|
682
|
+
<RankBars empty="no hook run was timed in this window" rows={d.hooks.map((h): Ranked => ({ key: `${h.event}/${h.command}/${h.repos.join(',')}`, name: h.command, note: h.repos.join(', '), value: h.waited ?? h.total, shown: `about ${dur(h.waited ?? h.total)}`, title: `${h.command} · ${h.event} · ${h.repos.join(', ')}` }))} />
|
|
683
|
+
</Section>
|
|
684
|
+
<Section title="The figures" hint="typical is the median timed run">
|
|
685
|
+
<Sorted
|
|
686
|
+
st={st}
|
|
687
|
+
id="hooks"
|
|
688
|
+
empty="no hook run was timed in this window"
|
|
689
|
+
head={[{ label: 'hook' }, { label: 'on' }, { label: 'repo' }, { label: 'timed runs', num: true, look: 'bar' }, { label: 'typical', num: true, look: 'heat' }, { label: 'slow', num: true, look: 'heat', title: 'the timed run 9 in 10 are faster than' }, { label: 'calls it applies to', num: true, look: 'bar' }, { label: 'waited', num: true, look: 'bar' }]}
|
|
690
|
+
rows={d.hooks.map((h) => ({ key: `${h.event}/${h.command}/${h.repos.join(',')}`, title: h.command, cells: [h.command, h.event, h.repos.join(', '), num.n(h.runs), num.s(h.p50), num.s(h.p90), h.calls == null ? '' : num.n(h.calls), h.waited == null ? '' : num.h(h.waited)] }))}
|
|
691
|
+
/>
|
|
692
|
+
</Section>
|
|
693
|
+
</Page>
|
|
694
|
+
)
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function Remarks({ d }: Ctx) {
|
|
698
|
+
const f = d.feedback
|
|
699
|
+
return (
|
|
700
|
+
<Page title={TITLES.remarks} lead={<>You typed <b>{group(f.prompts)}</b> prompts, {group(f.queued)} of them while an agent worked. The newest remarks about speed are below, each with what ran just before it.</>}>
|
|
701
|
+
<Tiles>
|
|
702
|
+
<Tile value={group(f.prompts)} label="prompts" />
|
|
703
|
+
<Tile value={group(f.queued)} label="typed while an agent worked" />
|
|
704
|
+
{Object.entries(f.counts).filter(([, n]) => n > 0).map(([k, n]) => <Tile key={k} value={group(n)} label={REMARK_WORDS[k] ?? k} />)}
|
|
705
|
+
</Tiles>
|
|
706
|
+
<Section title="The newest remarks">
|
|
707
|
+
{f.hits.length === 0 ? <p className="tvnone">no remark about speed in this window</p> : (
|
|
708
|
+
<ul className="tvhits">
|
|
709
|
+
{f.hits.map((h) => (
|
|
710
|
+
<li key={`${h.session}/${h.at}`}>
|
|
711
|
+
<time>{new Date(h.at).toLocaleString(undefined, { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}</time>
|
|
712
|
+
<q>{h.text}</q>
|
|
713
|
+
{h.ran.length === 0 ? null : <span>just before: {h.ran.map((r) => `${r.shape} ${dur(r.ms)}`).join(', ')}</span>}
|
|
714
|
+
</li>
|
|
715
|
+
))}
|
|
716
|
+
</ul>
|
|
717
|
+
)}
|
|
718
|
+
</Section>
|
|
719
|
+
</Page>
|
|
720
|
+
)
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const REMARK_WORDS: Record<string, string> = { status: 'asked where it stands', slowness: 'said it is slow', correction: 'corrections', 'make-faster': 'asked to go faster', 'world-slow': 'said the tools are slow' }
|
|
724
|
+
|
|
725
|
+
type Entry = { id: TimeEntry; group: string; label: string; figure: (d: TimePage) => string; page: (c: Ctx) => ReactNode; allOnly?: boolean }
|
|
726
|
+
|
|
727
|
+
/** the left panel: every entry, its group, its name and the one figure it shows beside it */
|
|
728
|
+
export const ENTRIES: Entry[] = [
|
|
729
|
+
{ id: 'overview', group: 'the whole', label: 'Overview', figure: (d) => dur(atWork(d).lanes + atWork(d).main), page: (c) => <Overview {...c} /> },
|
|
730
|
+
{ id: 'days', group: 'the whole', label: 'Day by day', figure: (d) => `${d.days.length} days`, page: (c) => <Days {...c} /> },
|
|
731
|
+
{ id: 'repos', group: 'the whole', label: 'Repos', figure: (d) => `${d.byRepo.length}`, page: (c) => <Repos {...c} />, allOnly: true },
|
|
732
|
+
{ id: 'lanes', group: 'who', label: 'Lanes', figure: (d) => dur(wallOf(d.turns.sub.work)), page: (c) => <Lanes {...c} /> },
|
|
733
|
+
{ id: 'main', group: 'who', label: 'Main sessions', figure: (d) => dur(wallOf(d.wall)), page: (c) => <Main {...c} /> },
|
|
734
|
+
{ id: 'turns', group: 'how', label: 'Steps and reads', figure: (d) => `${dur(beforeCall(d.models.sub))} a call`, page: (c) => <Turns {...c} /> },
|
|
735
|
+
{ id: 'models', group: 'how', label: 'Model and context', figure: (d) => { const top = d.models.sub.find((c) => c.ctx === ''); return top == null ? '' : `${dur(top.p50)} a turn` }, page: (c) => <Models {...c} /> },
|
|
736
|
+
{ id: 'costs', group: 'how', label: 'Biggest costs', figure: (d) => { const top = costsOf(d)[0]; return top == null ? '' : dur(top.ms) }, page: (c) => <Costs {...c} /> },
|
|
737
|
+
{ id: 'tools', group: 'what runs', label: 'Tools', figure: (d) => dur(d.runs.fg.ms), page: (c) => <Tools {...c} /> },
|
|
738
|
+
{ id: 'commands', group: 'what runs', label: 'Commands', figure: (d) => { const top = d.runs.fg.commands[0]; return top == null ? '' : dur(top.ms) }, page: (c) => <Commands {...c} /> },
|
|
739
|
+
{ id: 'slow', group: 'what runs', label: 'Slow commands', figure: (d) => { const top = d.runs.fg.slow[0]; return top == null ? '' : dur(top.p95) }, page: (c) => <Slow {...c} /> },
|
|
740
|
+
{ id: 'failures', group: 'what runs', label: 'Failed commands', figure: (d) => dur(d.runs.fg.failedMs), page: (c) => <Failures {...c} /> },
|
|
741
|
+
{ id: 'refused', group: 'what runs', label: 'Refused calls', figure: (d) => `${group(d.refused.count)}`, page: (c) => <RefusedPage {...c} /> },
|
|
742
|
+
{ id: 'timeouts', group: 'what runs', label: 'Time limits hit', figure: (d) => `${group(d.timeouts.count)}`, page: (c) => <Timeouts {...c} /> },
|
|
743
|
+
{ id: 'overhead', group: 'what runs', label: 'Call overhead', figure: (d) => (d.overhead.calls === 0 ? '' : dur(d.overhead.p50)), page: (c) => <OverheadPage {...c} /> },
|
|
744
|
+
{ id: 'hooks', group: 'what runs', label: 'Hooks', figure: (d) => (d.hooks[0] == null ? 'none' : `about ${dur(d.hooks[0].waited ?? d.hooks[0].total)}`), page: (c) => <Hooks {...c} /> },
|
|
745
|
+
{ id: 'remarks', group: 'you', label: 'Your remarks', figure: (d) => `${d.feedback.hits.length}`, page: (c) => <Remarks {...c} /> },
|
|
746
|
+
]
|
|
747
|
+
|
|
748
|
+
/** the entries a scope shows: one repo alone has no page of repos */
|
|
749
|
+
export const entriesOf = (scope: string): Entry[] => ENTRIES.filter((e) => scope === ALL || e.allOnly !== true)
|