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
package/src/agent-time/store.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// THE AGENT TIME INDEX: every Claude Code transcript on this machine, every
|
|
2
|
-
// config root, read once into
|
|
2
|
+
// config root, read once into the `time_*` tables of the machine db.
|
|
3
3
|
// A file is read again only when it changed, and a live session only from
|
|
4
4
|
// where the last read stopped, so a warm query reads a few new lines.
|
|
5
5
|
//
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
// transaction that reads its row again first, so two indexers never both
|
|
15
15
|
// append the same lines, and a killed build resumes at the next file.
|
|
16
16
|
import { Database } from 'bun:sqlite'
|
|
17
|
-
import { closeSync, mkdirSync, openSync, readSync, readdirSync, statSync } from 'fs'
|
|
17
|
+
import { closeSync, mkdirSync, openSync, readSync, readdirSync, realpathSync, statSync } from 'fs'
|
|
18
18
|
import { homedir } from 'os'
|
|
19
19
|
import { basename, dirname, join } from 'path'
|
|
20
|
+
import { foldRefusal, MACHINE_DB_FILE, machineFileCreate, ownerOnlyFile, StoreRefused, storeHome } from '../core/machine-db.ts'
|
|
21
|
+
import { createRefusal, machinePath } from '../core/machine-layout.ts'
|
|
20
22
|
import { ensureWal } from '../ledger/db.ts'
|
|
21
23
|
import { type ConfigRoot, discoverConfigRoots } from '../reflect/prompt-corpus.ts'
|
|
22
24
|
import { type TranscriptEvent, readTranscriptLine } from '../reflect/transcript.ts'
|
|
@@ -24,19 +26,26 @@ import { SHAPE_VERSION, toolShape } from './shape.ts'
|
|
|
24
26
|
import { READ_VERSION, isReadOnly } from './turns.ts'
|
|
25
27
|
import type { Call, Mark } from './timeline.ts'
|
|
26
28
|
|
|
29
|
+
/** the file that holds the index's tables for one process (a suite, a scratch); else the machine db */
|
|
27
30
|
export const AGENT_TIME_DB_ENV = 'SHIPKIT_AGENT_TIME_DB'
|
|
28
31
|
|
|
29
32
|
/** bumped when what a row holds changes: every file is read again */
|
|
30
|
-
export const INDEX_VERSION =
|
|
33
|
+
export const INDEX_VERSION = 17
|
|
31
34
|
|
|
32
|
-
export function agentTimeDbPath(): string {
|
|
35
|
+
export function agentTimeDbPath(home = homedir()): string {
|
|
33
36
|
const env = process.env[AGENT_TIME_DB_ENV]
|
|
34
37
|
if (env != null && env !== '') return env
|
|
35
|
-
return
|
|
38
|
+
return home === homedir() ? storeHome('agent time index') : machinePath(MACHINE_DB_FILE, home)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** the cached answers of `sk time`, a folder of the machine's own */
|
|
42
|
+
export const timeReportsDir = (): string => {
|
|
43
|
+
const env = process.env[AGENT_TIME_DB_ENV]
|
|
44
|
+
return env != null && env !== '' ? join(dirname(env), 'agent-time-reports') : machinePath('agent-time-reports')
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
const SCHEMA = `
|
|
39
|
-
create table if not exists
|
|
48
|
+
create table if not exists time_files (
|
|
40
49
|
id integer primary key,
|
|
41
50
|
path text not null unique,
|
|
42
51
|
account text not null,
|
|
@@ -51,8 +60,8 @@ create table if not exists files (
|
|
|
51
60
|
last_at integer,
|
|
52
61
|
gone integer not null default 0
|
|
53
62
|
);
|
|
54
|
-
create index if not exists
|
|
55
|
-
create table if not exists
|
|
63
|
+
create index if not exists time_files_project on time_files (project);
|
|
64
|
+
create table if not exists time_calls (
|
|
56
65
|
file_id integer not null,
|
|
57
66
|
id text not null,
|
|
58
67
|
start integer not null,
|
|
@@ -65,25 +74,44 @@ create table if not exists calls (
|
|
|
65
74
|
approval integer not null default 0,
|
|
66
75
|
perm text not null default '',
|
|
67
76
|
read integer not null default 0,
|
|
68
|
-
bg integer not null default 0
|
|
77
|
+
bg integer not null default 0,
|
|
78
|
+
msg text not null default '',
|
|
79
|
+
model text not null default '',
|
|
80
|
+
ctx integer not null default 0,
|
|
81
|
+
out integer not null default 0,
|
|
82
|
+
why text not null default '',
|
|
83
|
+
cmd_sum integer
|
|
69
84
|
);
|
|
70
|
-
create index if not exists
|
|
71
|
-
create table if not exists
|
|
85
|
+
create index if not exists time_calls_file on time_calls (file_id, start);
|
|
86
|
+
create table if not exists time_marks (
|
|
72
87
|
file_id integer not null,
|
|
73
88
|
at integer not null,
|
|
74
89
|
kind text not null
|
|
75
90
|
);
|
|
76
|
-
create index if not exists
|
|
77
|
-
create table if not exists
|
|
91
|
+
create index if not exists time_marks_file on time_marks (file_id, at);
|
|
92
|
+
create table if not exists time_prompts (
|
|
78
93
|
file_id integer not null,
|
|
79
94
|
at integer not null,
|
|
80
95
|
uuid text,
|
|
81
96
|
origin text not null,
|
|
82
97
|
text text not null
|
|
83
98
|
);
|
|
84
|
-
create index if not exists
|
|
85
|
-
create table if not exists
|
|
86
|
-
create table if not exists
|
|
99
|
+
create index if not exists time_prompts_file on time_prompts (file_id, at);
|
|
100
|
+
create table if not exists time_meta (key text primary key, value text not null);
|
|
101
|
+
create table if not exists time_hooks (
|
|
102
|
+
file_id integer not null,
|
|
103
|
+
id text not null,
|
|
104
|
+
at integer not null,
|
|
105
|
+
event text not null,
|
|
106
|
+
tool text not null,
|
|
107
|
+
command text not null,
|
|
108
|
+
ms integer not null,
|
|
109
|
+
code integer,
|
|
110
|
+
error integer not null default 0
|
|
111
|
+
);
|
|
112
|
+
create unique index if not exists time_hooks_run on time_hooks (id, event, command);
|
|
113
|
+
create index if not exists time_hooks_file on time_hooks (file_id, at);
|
|
114
|
+
create table if not exists time_bg_ends (
|
|
87
115
|
id text primary key,
|
|
88
116
|
at integer not null,
|
|
89
117
|
outcome text not null,
|
|
@@ -91,10 +119,38 @@ create table if not exists bg_ends (
|
|
|
91
119
|
);
|
|
92
120
|
`
|
|
93
121
|
|
|
122
|
+
/** the index's tables, made where they are not: the fold makes them before it copies the old file's rows in */
|
|
123
|
+
/** the index's tables and every index they need, made where they are not: the fold makes them before it copies the
|
|
124
|
+
* old file's rows in, so no open builds an index over real rows */
|
|
125
|
+
export const createIndexTables = (db: Database): void => void db.exec(`${SCHEMA}\n${UNIQUE}`)
|
|
126
|
+
|
|
127
|
+
/** the unique index of a call's id, apart from SCHEMA: a file of before it may hold a call twice, so it comes after
|
|
128
|
+
* their dedupe (migrate) */
|
|
129
|
+
const UNIQUE = 'create unique index if not exists time_calls_id on time_calls (id)'
|
|
130
|
+
|
|
131
|
+
/** the columns added after the first build, with their type: added in place, a row of a pruned transcript cannot be
|
|
132
|
+
* read again */
|
|
133
|
+
const ADDED: readonly [string, string][] = [
|
|
134
|
+
['approval', 'integer not null default 0'],
|
|
135
|
+
['perm', "text not null default ''"],
|
|
136
|
+
['read', 'integer not null default 0'],
|
|
137
|
+
['bg', 'integer not null default 0'],
|
|
138
|
+
['msg', "text not null default ''"],
|
|
139
|
+
['model', "text not null default ''"],
|
|
140
|
+
['ctx', 'integer not null default 0'],
|
|
141
|
+
['out', 'integer not null default 0'],
|
|
142
|
+
['why', "text not null default ''"],
|
|
143
|
+
['cmd_sum', 'integer'],
|
|
144
|
+
]
|
|
145
|
+
|
|
94
146
|
export function openIndex(path = agentTimeDbPath()): Database {
|
|
147
|
+
const refused = createRefusal(path) ?? foldRefusal('agent time index', path)
|
|
148
|
+
if (refused != null) throw new StoreRefused(refused)
|
|
95
149
|
mkdirSync(dirname(path), { recursive: true })
|
|
150
|
+
ownerOnlyFile(path)
|
|
96
151
|
const db = new Database(path, { create: true, readwrite: true })
|
|
97
152
|
db.exec('pragma busy_timeout = 30000')
|
|
153
|
+
machineFileCreate(path, db)
|
|
98
154
|
ensureWal(db, 5_000)
|
|
99
155
|
db.exec('pragma synchronous = normal')
|
|
100
156
|
db.exec(SCHEMA)
|
|
@@ -105,40 +161,117 @@ export function openIndex(path = agentTimeDbPath()): Database {
|
|
|
105
161
|
/** columns added after the first build, added in place: the rows of pruned
|
|
106
162
|
* transcripts cannot be read again, so a migration never drops a table */
|
|
107
163
|
function migrate(db: Database): void {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (!cols.includes('read')) db.exec('alter table calls add column read integer not null default 0')
|
|
112
|
-
if (!cols.includes('bg')) db.exec('alter table calls add column bg integer not null default 0')
|
|
113
|
-
// a tool use id is unique on the machine: a session copied into a second
|
|
114
|
-
// account (to resume it there) holds the same calls, written once
|
|
115
|
-
const unique = db.query("select 1 from sqlite_master where type = 'index' and name = 'calls_id'").get()
|
|
116
|
-
if (unique == null) {
|
|
117
|
-
db.exec('drop index if exists calls_open')
|
|
118
|
-
db.exec('delete from calls where rowid not in (select min(rowid) from calls group by id)')
|
|
119
|
-
db.exec('create unique index calls_id on calls (id)')
|
|
164
|
+
const missing = (): { cols: string[]; unique: boolean } => {
|
|
165
|
+
const cols = (db.query('pragma table_info(time_calls)').all() as { name: string }[]).map((c) => c.name)
|
|
166
|
+
return { cols: ADDED.filter(([c]) => !cols.includes(c)).map(([c]) => c), unique: db.query("select 1 from sqlite_master where type = 'index' and name = 'time_calls_id'").get() == null }
|
|
120
167
|
}
|
|
121
|
-
|
|
168
|
+
// read first with no lock: a file of today's shape (a fold makes it so) takes no write at its open. Else under the
|
|
169
|
+
// write lock, read again: two first opens at once, the second finds the work done
|
|
170
|
+
const m = missing()
|
|
171
|
+
if (m.cols.length > 0 || m.unique)
|
|
172
|
+
db.transaction(() => {
|
|
173
|
+
const again = missing()
|
|
174
|
+
for (const [c, sql] of ADDED) if (again.cols.includes(c)) db.exec(`alter table time_calls add column ${c} ${sql}`)
|
|
175
|
+
// a tool use id is unique on the machine: a session copied into a second account (to resume it there)
|
|
176
|
+
// holds the same calls, written once
|
|
177
|
+
if (again.unique) {
|
|
178
|
+
db.exec('drop index if exists time_calls_open')
|
|
179
|
+
db.exec('delete from time_calls where rowid not in (select min(rowid) from time_calls group by id)')
|
|
180
|
+
db.exec(UNIQUE)
|
|
181
|
+
}
|
|
182
|
+
}).immediate()
|
|
183
|
+
if (db.query("select 1 from time_meta where key = 'aliases'").get() == null) {
|
|
184
|
+
foldAliases(db)
|
|
185
|
+
db.query("insert or replace into time_meta (key, value) values ('aliases', '1')").run()
|
|
186
|
+
}
|
|
187
|
+
const row = db.query("select value from time_meta where key = 'shape'").get() as { value: string } | null
|
|
122
188
|
if (row?.value === RULES_VERSION) return
|
|
123
189
|
reshape(db)
|
|
124
190
|
}
|
|
125
191
|
|
|
192
|
+
const realOf = (path: string): string => {
|
|
193
|
+
try {
|
|
194
|
+
return realpathSync(path)
|
|
195
|
+
} catch {
|
|
196
|
+
return path
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** the neighbour a project folder is a link to, as a path beside it; null for a folder of its own, and for a link
|
|
201
|
+
* to somewhere else (that folder has no other name here) */
|
|
202
|
+
function neighbourOf(dir: string): string | null {
|
|
203
|
+
try {
|
|
204
|
+
const parent = realpathSync(dirname(dir))
|
|
205
|
+
const real = realpathSync(dir)
|
|
206
|
+
return real !== join(parent, basename(dir)) && dirname(real) === parent ? join(dirname(dir), basename(real)) : null
|
|
207
|
+
} catch {
|
|
208
|
+
return null
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** the rows a lister read under a project folder that is a link to its neighbour (a renamed repo keeps its old
|
|
213
|
+
* name as a link) go to the real folder: a call is kept once on the machine, so the linked name held calls its
|
|
214
|
+
* real folder then missed, and showed as a repo of its own. Run once per index (migrate): the lister no longer
|
|
215
|
+
* lists a linked name. Returns the file rows folded */
|
|
216
|
+
export function foldAliases(db: Database): number {
|
|
217
|
+
const rows = db.query('select id, path, project from time_files').all() as { id: number; path: string; project: string }[]
|
|
218
|
+
const idOf = new Map(rows.map((r) => [r.path, r.id]))
|
|
219
|
+
const targets = new Map<string, string | null>()
|
|
220
|
+
let folded = 0
|
|
221
|
+
db.transaction(() => {
|
|
222
|
+
for (const r of rows) {
|
|
223
|
+
const at = r.path.indexOf(`/${r.project}/`)
|
|
224
|
+
if (at < 0) continue
|
|
225
|
+
const dir = r.path.slice(0, at + 1 + r.project.length)
|
|
226
|
+
if (!targets.has(dir)) targets.set(dir, neighbourOf(dir))
|
|
227
|
+
const target = targets.get(dir)
|
|
228
|
+
if (target == null) continue
|
|
229
|
+
const path = target + r.path.slice(dir.length)
|
|
230
|
+
const real = idOf.get(path)
|
|
231
|
+
if (real == null) {
|
|
232
|
+
db.query('update time_files set path = ?, project = ? where id = ?').run(path, basename(target), r.id)
|
|
233
|
+
idOf.set(path, r.id)
|
|
234
|
+
} else {
|
|
235
|
+
// the real row holds the same marks and prompts (the same file): only what is kept once moves
|
|
236
|
+
db.query('update time_calls set file_id = ? where file_id = ?').run(real, r.id)
|
|
237
|
+
db.query('update time_hooks set file_id = ? where file_id = ?').run(real, r.id)
|
|
238
|
+
db.query('delete from time_marks where file_id = ?').run(r.id)
|
|
239
|
+
db.query('delete from time_prompts where file_id = ?').run(r.id)
|
|
240
|
+
db.query('delete from time_files where id = ?').run(r.id)
|
|
241
|
+
}
|
|
242
|
+
folded++
|
|
243
|
+
}
|
|
244
|
+
})()
|
|
245
|
+
return folded
|
|
246
|
+
}
|
|
247
|
+
|
|
126
248
|
/** the shape rules and the read rules, one stamp: either changing reshapes */
|
|
127
249
|
const RULES_VERSION = `${SHAPE_VERSION}.${READ_VERSION}`
|
|
128
250
|
|
|
251
|
+
/** rows a reshape step reads and writes: about 30 ms of the write lock */
|
|
252
|
+
const RESHAPE_STEP = 5_000
|
|
253
|
+
|
|
129
254
|
/** a shape or read rule changed: every call is shaped and judged again from
|
|
130
|
-
* its stored command, pruned transcripts included, no file read
|
|
255
|
+
* its stored command, pruned transcripts included, no file read. In steps of
|
|
256
|
+
* RESHAPE_STEP rows, the stamp last: a killed one starts again and writes only
|
|
257
|
+
* the rows that still differ */
|
|
131
258
|
function reshape(db: Database): void {
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
db.
|
|
259
|
+
// a call whose text the diet dropped keeps the shape it had: there is no text to shape again
|
|
260
|
+
const page = db.query('select rowid, tool, cmd, shape, read from time_calls where rowid > ? and cmd_sum is null order by rowid limit ?')
|
|
261
|
+
const set = db.query('update time_calls set shape = ?, read = ? where rowid = ?')
|
|
262
|
+
for (let last = 0; ; ) {
|
|
263
|
+
const rows = page.all(last, RESHAPE_STEP) as { rowid: number; tool: string; cmd: string; shape: string; read: number }[]
|
|
264
|
+
if (rows.length === 0) break
|
|
265
|
+
const moved: [string, number, number][] = []
|
|
135
266
|
for (const r of rows) {
|
|
136
267
|
const shape = toolShape(r.tool, r.cmd)
|
|
137
268
|
const read = isReadOnly({ tool: r.tool, shape, cmd: r.cmd }) ? 1 : 0
|
|
138
|
-
if (shape !== r.shape || read !== r.read)
|
|
269
|
+
if (shape !== r.shape || read !== r.read) moved.push([shape, read, r.rowid])
|
|
139
270
|
}
|
|
140
|
-
db.
|
|
141
|
-
|
|
271
|
+
if (moved.length > 0) db.transaction(() => { for (const m of moved) set.run(...m) }).immediate()
|
|
272
|
+
last = rows[rows.length - 1]!.rowid
|
|
273
|
+
}
|
|
274
|
+
db.query("insert or replace into time_meta (key, value) values ('shape', ?)").run(RULES_VERSION)
|
|
142
275
|
}
|
|
143
276
|
|
|
144
277
|
/** one transcript file on disk */
|
|
@@ -163,7 +296,9 @@ export function freshness(prev: IndexedFile | null, now: { size: number; mtime:
|
|
|
163
296
|
export type ProjectFilter = (project: string) => boolean
|
|
164
297
|
|
|
165
298
|
/** every transcript file under every config root: sessions, and the sub-agent
|
|
166
|
-
* runs under `<session>/subagents
|
|
299
|
+
* runs under `<session>/subagents/`. A real folder is listed once: a project
|
|
300
|
+
* folder that is a link to its neighbour is a second name for the same
|
|
301
|
+
* files, never a second repo */
|
|
167
302
|
export function listTranscripts(roots: ConfigRoot[] = discoverConfigRoots(), keep: ProjectFilter = () => true): TranscriptFile[] {
|
|
168
303
|
const out: TranscriptFile[] = []
|
|
169
304
|
const add = (path: string, account: string, project: string, session: string, agent: string): void => {
|
|
@@ -172,12 +307,21 @@ export function listTranscripts(roots: ConfigRoot[] = discoverConfigRoots(), kee
|
|
|
172
307
|
out.push({ path, account, project, session, agent, size: st.size, mtime: Math.floor(st.mtimeMs) })
|
|
173
308
|
} catch { /* deleted between the listing and the stat */ }
|
|
174
309
|
}
|
|
310
|
+
const listed = new Set<string>()
|
|
175
311
|
for (const root of roots) {
|
|
176
312
|
let projects: string[]
|
|
177
313
|
try { projects = readdirSync(root.projects) } catch { continue }
|
|
178
|
-
|
|
179
|
-
|
|
314
|
+
const home = realOf(root.projects)
|
|
315
|
+
const dirs = projects.map((project) => {
|
|
180
316
|
const dir = join(root.projects, project)
|
|
317
|
+
const real = realOf(dir)
|
|
318
|
+
return { project, dir, real, link: real !== join(home, project) }
|
|
319
|
+
})
|
|
320
|
+
// the folders of their own first, so of two names for one folder the link is the one left out
|
|
321
|
+
for (const { project, dir, real } of dirs.sort((a, b) => Number(a.link) - Number(b.link))) {
|
|
322
|
+
if (listed.has(real)) continue
|
|
323
|
+
listed.add(real)
|
|
324
|
+
if (!keep(project)) continue
|
|
181
325
|
let entries: string[]
|
|
182
326
|
try { entries = readdirSync(dir) } catch { continue }
|
|
183
327
|
const sessions = new Set(entries.filter((e) => e.endsWith('.jsonl')).map((e) => e.slice(0, -6)))
|
|
@@ -198,8 +342,8 @@ const CHUNK_BYTES = 32 * 1024 * 1024
|
|
|
198
342
|
|
|
199
343
|
/** every complete line of a file from `offset`, read in chunks so a session
|
|
200
344
|
* of half a gigabyte never becomes one string. Returns the offset after the
|
|
201
|
-
* last newline, so a half written tail line is read next time */
|
|
202
|
-
function eachLine(path: string, offset: number, size: number, onLine: (line: string) => void): number {
|
|
345
|
+
* last newline, so a half written tail line is read next time. `onLine` gets the offset after the line's newline */
|
|
346
|
+
function eachLine(path: string, offset: number, size: number, onLine: (line: string, end: number) => void): number {
|
|
203
347
|
const fd = openSync(path, 'r')
|
|
204
348
|
let pos = offset
|
|
205
349
|
let carry: Buffer | null = null
|
|
@@ -209,13 +353,14 @@ function eachLine(path: string, offset: number, size: number, onLine: (line: str
|
|
|
209
353
|
const fresh = Buffer.allocUnsafe(want)
|
|
210
354
|
const n = readSync(fd, fresh, 0, want, pos)
|
|
211
355
|
if (n <= 0) break
|
|
356
|
+
const bufAt = pos - (carry?.length ?? 0)
|
|
212
357
|
pos += n
|
|
213
358
|
const buf: Buffer = carry == null ? fresh.subarray(0, n) : Buffer.concat([carry, fresh.subarray(0, n)])
|
|
214
359
|
let start = 0
|
|
215
360
|
for (;;) {
|
|
216
361
|
const end = buf.indexOf(10, start)
|
|
217
362
|
if (end === -1) break
|
|
218
|
-
if (end > start) onLine(buf.toString('utf8', start, end))
|
|
363
|
+
if (end > start) onLine(buf.toString('utf8', start, end), bufAt + end + 1)
|
|
219
364
|
start = end + 1
|
|
220
365
|
}
|
|
221
366
|
carry = start < buf.length ? Buffer.from(buf.subarray(start)) : null
|
|
@@ -228,18 +373,22 @@ function eachLine(path: string, offset: number, size: number, onLine: (line: str
|
|
|
228
373
|
|
|
229
374
|
type Stmts = ReturnType<typeof statements>
|
|
230
375
|
const statements = (db: Database) => ({
|
|
231
|
-
get: db.query('select id, size, mtime, offset, version from
|
|
232
|
-
insFile: db.query('insert into
|
|
233
|
-
setFile: db.query('update
|
|
234
|
-
clear: [db.query('delete from
|
|
235
|
-
resetFile: db.query('update
|
|
236
|
-
|
|
237
|
-
|
|
376
|
+
get: db.query('select id, size, mtime, offset, version from time_files where path = ?'),
|
|
377
|
+
insFile: db.query('insert into time_files (path, account, project, session, agent, size, mtime, offset, version, first_at, last_at) values (?, ?, ?, ?, ?, 0, 0, 0, 0, null, null) returning id'),
|
|
378
|
+
setFile: db.query('update time_files set size = ?, mtime = ?, offset = ?, version = ?, first_at = coalesce(first_at, ?), last_at = coalesce(?, last_at), gone = 0 where id = ?'),
|
|
379
|
+
clear: [db.query('delete from time_calls where file_id = ?'), db.query('delete from time_marks where file_id = ?'), db.query('delete from time_prompts where file_id = ?'), db.query('delete from time_hooks where file_id = ?')],
|
|
380
|
+
resetFile: db.query('update time_files set offset = 0, first_at = null, last_at = null where id = ?'),
|
|
381
|
+
unread: db.query('update time_files set size = 0, mtime = 0, offset = 0, version = 0, first_at = null, last_at = null where id = ?'),
|
|
382
|
+
clearStep: [db.query('delete from time_calls where rowid in (select rowid from time_calls where file_id = ? limit ?)'), db.query('delete from time_marks where rowid in (select rowid from time_marks where file_id = ? limit ?)'), db.query('delete from time_prompts where rowid in (select rowid from time_prompts where file_id = ? limit ?)'), db.query('delete from time_hooks where rowid in (select rowid from time_hooks where file_id = ? limit ?)')],
|
|
383
|
+
insCall: db.query('insert or ignore into time_calls (file_id, id, start, end, tool, shape, cmd, outcome, code, approval, perm, read, bg, msg, model, ctx, out, why) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'),
|
|
384
|
+
endCall: db.query('update time_calls set end = ?, outcome = ?, code = ?, approval = ?, perm = ?, bg = ?, why = ? where id = ? and end is null'),
|
|
238
385
|
// keyed by the call's id, not the file: the notification can sit in
|
|
239
386
|
// another file (the session's queue) read before the call's own
|
|
240
|
-
bgEnd: db.query('insert into
|
|
241
|
-
insMark: db.query('insert into
|
|
242
|
-
insPrompt: db.query('insert into
|
|
387
|
+
bgEnd: db.query('insert into time_bg_ends (id, at, outcome, code) values (?, ?, ?, ?) on conflict (id) do update set at = excluded.at, outcome = excluded.outcome, code = excluded.code where excluded.at < time_bg_ends.at'),
|
|
388
|
+
insMark: db.query('insert into time_marks (file_id, at, kind) values (?, ?, ?)'),
|
|
389
|
+
insPrompt: db.query('insert into time_prompts (file_id, at, uuid, origin, text) values (?, ?, ?, ?, ?)'),
|
|
390
|
+
// one run is one call and one command: a copy of the session in another account is the same run
|
|
391
|
+
insHook: db.query('insert or ignore into time_hooks (file_id, id, at, event, tool, command, ms, code, error) values (?, ?, ?, ?, ?, ?, ?, ?, ?)'),
|
|
243
392
|
})
|
|
244
393
|
|
|
245
394
|
/** write the events of a chunk of lines: a call is written once its result
|
|
@@ -247,7 +396,9 @@ const statements = (db: Database) => ({
|
|
|
247
396
|
* the session in another account is ignored); a result for a call written by
|
|
248
397
|
* an earlier read, or by the copy, closes that row */
|
|
249
398
|
function writeEvents(st: Stmts, fileId: number, events: TranscriptEvent[]): { first: number | null; last: number | null } {
|
|
250
|
-
const pending = new Map<string, { id: string; start: number; end: number | null; tool: string; detail: string; outcome: string | null; code: number | null; perm: string; bg: boolean }>()
|
|
399
|
+
const pending = new Map<string, { id: string; start: number; end: number | null; tool: string; detail: string; outcome: string | null; code: number | null; perm: string; bg: boolean; msg: string; model: string; ctx: number; out: number; why: string }>()
|
|
400
|
+
// the calls of one message, in the order the model wrote them
|
|
401
|
+
const sent = new Map<string, string[]>()
|
|
251
402
|
let first: number | null = null
|
|
252
403
|
let last: number | null = null
|
|
253
404
|
const seen = (at: number): void => {
|
|
@@ -257,31 +408,140 @@ function writeEvents(st: Stmts, fileId: number, events: TranscriptEvent[]): { fi
|
|
|
257
408
|
}
|
|
258
409
|
for (const e of events) {
|
|
259
410
|
seen(e.at)
|
|
260
|
-
if (e.kind === 'use')
|
|
411
|
+
if (e.kind === 'use') {
|
|
412
|
+
pending.set(e.id, { id: e.id, start: e.at, end: null, tool: e.name, detail: e.detail, outcome: null, code: null, perm: '', bg: false, msg: e.msg ?? '', model: e.model ?? '', ctx: e.ctx ?? 0, out: e.out ?? 0, why: '' })
|
|
413
|
+
// the model writes the calls of a turn one after the other. The harness runs some as soon as they
|
|
414
|
+
// are written and holds others until the message is whole, and the transcript does not say which. A
|
|
415
|
+
// call still unanswered when a later call of its message is written starts at that later time, so it
|
|
416
|
+
// is never charged the writing of the later ones; one answered before keeps its own time. A message
|
|
417
|
+
// cut by the end of a chunk keeps the earlier calls' own times
|
|
418
|
+
if (e.msg != null) {
|
|
419
|
+
const ids = sent.get(e.msg) ?? []
|
|
420
|
+
sent.set(e.msg, [...ids, e.id])
|
|
421
|
+
for (const id of ids) {
|
|
422
|
+
const p = pending.get(id)
|
|
423
|
+
if (p != null && p.end == null && !Number.isNaN(e.at) && p.start < e.at) p.start = e.at
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
261
427
|
else if (e.kind === 'bgend') st.bgEnd.run(e.id, e.at, e.outcome, e.code)
|
|
262
428
|
else if (e.kind === 'result') {
|
|
263
429
|
const p = pending.get(e.id)
|
|
264
|
-
if (p != null) Object.assign(p, { end: e.at, outcome: e.outcome, code: e.code, perm: e.perm, bg: e.bg })
|
|
265
|
-
else st.endCall.run(e.at, e.outcome, e.code, e.perm === 'user' ? 1 : 0, e.perm, e.bg ? 1 : 0, e.id)
|
|
430
|
+
if (p != null) Object.assign(p, { end: e.at, outcome: e.outcome, code: e.code, perm: e.perm, bg: e.bg, why: e.why ?? '' })
|
|
431
|
+
else st.endCall.run(e.at, e.outcome, e.code, e.perm === 'user' ? 1 : 0, e.perm, e.bg ? 1 : 0, e.why ?? '', e.id)
|
|
266
432
|
} else if (e.kind === 'prompt') {
|
|
267
433
|
if (!Number.isNaN(e.at)) st.insPrompt.run(fileId, e.at, e.uuid, e.origin, e.text)
|
|
268
434
|
if (e.origin === 'typed' && !Number.isNaN(e.at)) st.insMark.run(fileId, e.at, 'prompt')
|
|
269
|
-
} else st.
|
|
435
|
+
} else if (e.kind === 'hook') st.insHook.run(fileId, e.id === '' ? String(e.at) : e.id, e.at, e.event, e.tool, e.command, Math.round(e.ms), e.code, e.error ? 1 : 0)
|
|
436
|
+
else st.insMark.run(fileId, e.at, e.kind)
|
|
270
437
|
}
|
|
271
438
|
for (const p of pending.values()) {
|
|
272
439
|
const shape = toolShape(p.tool, p.detail)
|
|
273
|
-
st.insCall.run(fileId, p.id, p.start, p.end, p.tool, shape, p.detail, p.outcome, p.code, p.perm === 'user' ? 1 : 0, p.perm, isReadOnly({ tool: p.tool, shape, cmd: p.detail }) ? 1 : 0, p.bg ? 1 : 0)
|
|
440
|
+
st.insCall.run(fileId, p.id, p.start, p.end, p.tool, shape, p.detail, p.outcome, p.code, p.perm === 'user' ? 1 : 0, p.perm, isReadOnly({ tool: p.tool, shape, cmd: p.detail }) ? 1 : 0, p.bg ? 1 : 0, p.msg, p.model, p.ctx, p.out, p.why)
|
|
274
441
|
}
|
|
275
442
|
return { first, last }
|
|
276
443
|
}
|
|
277
444
|
|
|
278
445
|
export type IndexProgress = { files: number; done: number; bytes: number; doneBytes: number }
|
|
279
446
|
|
|
280
|
-
|
|
447
|
+
/** `heldMs`: the longest the index's write lock was held, one step */
|
|
448
|
+
export type IndexResult = { scanned: number; read: number; bytes: number; ms: number; gone: number; heldMs?: number }
|
|
449
|
+
|
|
450
|
+
/** the events one write step holds at most: a few ms of the file's write lock, so another store's write in the same
|
|
451
|
+
* file waits one step, never a whole transcript (one of 685 MB held it 1,049 ms) */
|
|
452
|
+
export const STEP_EVENTS = 2_000
|
|
453
|
+
|
|
454
|
+
/** rows of each table a step of a rebuild's emptying deletes */
|
|
455
|
+
const CLEAR_STEP = 5_000
|
|
456
|
+
|
|
457
|
+
/** another indexer moved the file's row since this one planned it: that one goes on with the file */
|
|
458
|
+
class Moved extends Error {}
|
|
459
|
+
|
|
460
|
+
/** one file read with no lock and written in steps: each step is one immediate transaction that finds the row where
|
|
461
|
+
* the last step left it, writes its events and the offset it reached, so a killed read resumes there. A step ends
|
|
462
|
+
* only before a line that starts another message, so the rows are those of a whole read. The bytes read, 0 when
|
|
463
|
+
* another indexer had the file */
|
|
464
|
+
function indexFile(db: Database, st: Stmts, f: TranscriptFile, step: number, held: { ms: number }): number {
|
|
465
|
+
let plan = st.get.get(f.path) as ({ id: number } & IndexedFile) | null
|
|
466
|
+
const how = freshness(plan, f)
|
|
467
|
+
if (how === 'skip') return 0
|
|
468
|
+
const timed = <T>(body: () => T): T => {
|
|
469
|
+
const t = performance.now()
|
|
470
|
+
try {
|
|
471
|
+
return body()
|
|
472
|
+
} finally {
|
|
473
|
+
held.ms = Math.max(held.ms, performance.now() - t)
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// a rebuild first empties the file's rows in steps, its row marked unread (offset 0, version 0) by the first one
|
|
477
|
+
if (how === 'rebuild' && plan != null) {
|
|
478
|
+
const was = plan
|
|
479
|
+
for (let first = true; ; first = false) {
|
|
480
|
+
const n = timed(() => db.transaction(() => {
|
|
481
|
+
const row = st.get.get(f.path) as ({ id: number } & IndexedFile) | null
|
|
482
|
+
if (row == null || row.id !== was.id || (first ? row.offset !== was.offset || row.version !== was.version : row.offset !== 0 || row.version !== 0)) throw new Moved()
|
|
483
|
+
if (first) st.unread.run(row.id)
|
|
484
|
+
let gone = 0
|
|
485
|
+
for (const q of st.clearStep) gone += q.run(row.id, CLEAR_STEP).changes
|
|
486
|
+
return gone
|
|
487
|
+
}).immediate())
|
|
488
|
+
if (n === 0) break
|
|
489
|
+
}
|
|
490
|
+
plan = { ...was, offset: 0, version: 0, size: 0, mtime: 0 }
|
|
491
|
+
}
|
|
492
|
+
const from = how === 'rebuild' || plan == null ? 0 : plan.offset
|
|
493
|
+
let id = plan?.id ?? null
|
|
494
|
+
let at = from
|
|
495
|
+
let first = true
|
|
496
|
+
let events: TranscriptEvent[] = []
|
|
497
|
+
let reached = from
|
|
498
|
+
let msg: string | null = null
|
|
499
|
+
const write = (final: boolean): void => timed(() => {
|
|
500
|
+
db.exec('begin immediate')
|
|
501
|
+
try {
|
|
502
|
+
const row = st.get.get(f.path) as ({ id: number } & IndexedFile) | null
|
|
503
|
+
if (first) {
|
|
504
|
+
if (row?.id !== plan?.id || row?.offset !== plan?.offset || row?.version !== plan?.version) throw new Moved()
|
|
505
|
+
if (row == null) id = (st.insFile.get(f.path, f.account, f.project, f.session, f.agent) as { id: number }).id
|
|
506
|
+
else if (how === 'rebuild') {
|
|
507
|
+
for (const q of st.clear) q.run(row.id)
|
|
508
|
+
st.resetFile.run(row.id)
|
|
509
|
+
}
|
|
510
|
+
} else if (row == null || row.id !== id || row.offset !== at || row.version !== INDEX_VERSION) throw new Moved()
|
|
511
|
+
const span = writeEvents(st, id!, events)
|
|
512
|
+
// a step short of the end keeps the size it reached and no time, so a resumed read appends from there
|
|
513
|
+
st.setFile.run(final ? f.size : reached, final ? f.mtime : 0, reached, INDEX_VERSION, span.first, span.last, id)
|
|
514
|
+
db.exec('commit')
|
|
515
|
+
} catch (e) {
|
|
516
|
+
db.exec('rollback')
|
|
517
|
+
throw e
|
|
518
|
+
}
|
|
519
|
+
first = false
|
|
520
|
+
at = reached
|
|
521
|
+
events = []
|
|
522
|
+
})
|
|
523
|
+
try {
|
|
524
|
+
eachLine(f.path, from, f.size, (line, end) => {
|
|
525
|
+
const evs = readTranscriptLine(line)
|
|
526
|
+
if (events.length >= step && evs.some((e) => e.kind === 'use' && (e.msg ?? null) !== msg)) write(false)
|
|
527
|
+
for (const e of evs) {
|
|
528
|
+
events.push(e)
|
|
529
|
+
if (e.kind === 'use') msg = e.msg ?? null
|
|
530
|
+
}
|
|
531
|
+
reached = end
|
|
532
|
+
})
|
|
533
|
+
write(true)
|
|
534
|
+
} catch (e) {
|
|
535
|
+
if (e instanceof Moved) return 0
|
|
536
|
+
throw e
|
|
537
|
+
}
|
|
538
|
+
return reached - from
|
|
539
|
+
}
|
|
281
540
|
|
|
282
541
|
/** bring the index up to date for the files listed: unchanged files cost a
|
|
283
542
|
* stat, a grown one its new lines. `onProgress` fires after each file read */
|
|
284
|
-
export function indexTranscripts(db: Database, files: TranscriptFile[], onProgress?: (p: IndexProgress) => void): IndexResult {
|
|
543
|
+
export function indexTranscripts(db: Database, files: TranscriptFile[], onProgress?: (p: IndexProgress) => void, step = STEP_EVENTS): IndexResult {
|
|
544
|
+
const held = { ms: 0 }
|
|
285
545
|
const t0 = performance.now()
|
|
286
546
|
const st = statements(db)
|
|
287
547
|
const prevOf = (path: string) => st.get.get(path) as ({ id: number } & IndexedFile) | null
|
|
@@ -296,47 +556,62 @@ export function indexTranscripts(db: Database, files: TranscriptFile[], onProgre
|
|
|
296
556
|
let doneBytes = 0
|
|
297
557
|
let readBytes = 0
|
|
298
558
|
todo.forEach((f, i) => {
|
|
299
|
-
db.exec('begin immediate')
|
|
300
559
|
try {
|
|
301
|
-
|
|
302
|
-
const how = freshness(row, f)
|
|
303
|
-
if (how !== 'skip') {
|
|
304
|
-
if (row == null) {
|
|
305
|
-
const ins = st.insFile.get(f.path, f.account, f.project, f.session, f.agent) as { id: number }
|
|
306
|
-
row = { id: ins.id, size: 0, mtime: 0, offset: 0, version: 0 }
|
|
307
|
-
}
|
|
308
|
-
let from = row.offset
|
|
309
|
-
if (how === 'rebuild') {
|
|
310
|
-
for (const q of st.clear) q.run(row.id)
|
|
311
|
-
st.resetFile.run(row.id)
|
|
312
|
-
from = 0
|
|
313
|
-
}
|
|
314
|
-
const events: TranscriptEvent[] = []
|
|
315
|
-
const next = eachLine(f.path, from, f.size, (line) => {
|
|
316
|
-
for (const e of readTranscriptLine(line)) events.push(e)
|
|
317
|
-
})
|
|
318
|
-
readBytes += next - from
|
|
319
|
-
const span = writeEvents(st, row.id, events)
|
|
320
|
-
st.setFile.run(f.size, f.mtime, next, INDEX_VERSION, span.first, span.last, row.id)
|
|
321
|
-
}
|
|
322
|
-
db.exec('commit')
|
|
560
|
+
readBytes += indexFile(db, st, f, step, held)
|
|
323
561
|
} catch (e) {
|
|
324
|
-
|
|
325
|
-
throw e
|
|
562
|
+
if (!(e instanceof Moved)) throw e
|
|
326
563
|
}
|
|
327
564
|
doneBytes += toRead.get(f.path) ?? 0
|
|
328
565
|
onProgress?.({ files: todo.length, done: i + 1, bytes: total, doneBytes })
|
|
329
566
|
})
|
|
330
|
-
return { scanned: files.length, read: todo.length, bytes: readBytes, ms: Math.round(performance.now() - t0), gone: 0 }
|
|
567
|
+
return { scanned: files.length, read: todo.length, bytes: readBytes, ms: Math.round(performance.now() - t0), gone: 0, heldMs: Math.round(held.ms) }
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/** the files to read now, newest first, while their unread bytes fit
|
|
571
|
+
* `maxBytes`, and the unread bytes left for a later run: a bounded catch up
|
|
572
|
+
* that a gate can afford, each file committing alone */
|
|
573
|
+
export function catchUpPlan(db: Database, files: TranscriptFile[], maxBytes: number): { take: TranscriptFile[]; behind: number } {
|
|
574
|
+
const get = db.query('select size, mtime, offset, version from time_files where path = ?')
|
|
575
|
+
const take: TranscriptFile[] = []
|
|
576
|
+
let room = maxBytes
|
|
577
|
+
let behind = 0
|
|
578
|
+
for (const f of [...files].sort((a, b) => b.mtime - a.mtime)) {
|
|
579
|
+
const prev = get.get(f.path) as IndexedFile | null
|
|
580
|
+
const how = freshness(prev, f)
|
|
581
|
+
if (how === 'skip') continue
|
|
582
|
+
const bytes = how === 'append' && prev != null ? f.size - prev.offset : f.size
|
|
583
|
+
if (bytes <= room) {
|
|
584
|
+
take.push(f)
|
|
585
|
+
room -= bytes
|
|
586
|
+
} else behind += bytes
|
|
587
|
+
}
|
|
588
|
+
return { take, behind }
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/** one timed hook run as the index holds it */
|
|
592
|
+
export type HookRun = { file_id: number; project: string; at: number; event: string; tool: string; command: string; ms: number; code: number | null; error: boolean }
|
|
593
|
+
|
|
594
|
+
/** the timed hook runs of the matching projects since `from` */
|
|
595
|
+
export function hookRuns(db: Database, keep: ProjectFilter, from: number, to = Number.MAX_SAFE_INTEGER): HookRun[] {
|
|
596
|
+
const files = (db.query('select id, project from time_files').all() as { id: number; project: string }[]).filter((f) => keep(f.project))
|
|
597
|
+
const projectOf = new Map(files.map((f) => [f.id, f.project]))
|
|
598
|
+
const ids = files.map((f) => f.id)
|
|
599
|
+
const out: HookRun[] = []
|
|
600
|
+
for (let i = 0; i < ids.length; i += 500) {
|
|
601
|
+
const part = ids.slice(i, i + 500)
|
|
602
|
+
const rows = db.query(`select file_id, at, event, tool, command, ms, code, error = 1 as error from time_hooks where file_id in (${part.map(() => '?').join(',')}) and at between ? and ?`).all(...part, from, to) as Omit<HookRun, 'project'>[]
|
|
603
|
+
for (const r of rows) out.push({ ...r, error: Boolean(r.error), project: projectOf.get(r.file_id) ?? '' })
|
|
604
|
+
}
|
|
605
|
+
return out.sort((a, b) => a.at - b.at)
|
|
331
606
|
}
|
|
332
607
|
|
|
333
608
|
/** the files the index holds that are no longer on disk, marked so the
|
|
334
609
|
* report can say how much history outlived the harness */
|
|
335
610
|
export function markGone(db: Database, onDisk: TranscriptFile[], keep: ProjectFilter): number {
|
|
336
611
|
const present = new Set(onDisk.map((f) => f.path))
|
|
337
|
-
const rows = db.query('select id, path, project, gone from
|
|
612
|
+
const rows = db.query('select id, path, project, gone from time_files').all() as { id: number; path: string; project: string; gone: number }[]
|
|
338
613
|
let gone = 0
|
|
339
|
-
const set = db.query('update
|
|
614
|
+
const set = db.query('update time_files set gone = ? where id = ?')
|
|
340
615
|
db.transaction(() => {
|
|
341
616
|
for (const r of rows) {
|
|
342
617
|
if (!keep(r.project)) continue
|
|
@@ -350,11 +625,11 @@ export function markGone(db: Database, onDisk: TranscriptFile[], keep: ProjectFi
|
|
|
350
625
|
|
|
351
626
|
export type FileRow = { id: number; path: string; account: string; project: string; session: string; agent: string; first_at: number | null; last_at: number | null; gone: number }
|
|
352
627
|
|
|
353
|
-
export type Loaded = { files: FileRow[]; calls: Map<number, Call[]>; marks: Map<number, Mark[]>; prompts: { file_id: number; at: number; origin: 'typed' | 'queued'; text: string }[] }
|
|
628
|
+
export type Loaded = { files: FileRow[]; calls: Map<number, Call[]>; marks: Map<number, Mark[]>; prompts: { file_id: number; at: number; origin: 'typed' | 'queued'; text: string }[]; hooks: HookRun[] }
|
|
354
629
|
|
|
355
630
|
/** every row of the matching projects with activity in [from, to] */
|
|
356
631
|
export function loadWindow(db: Database, keep: ProjectFilter, from: number, to: number): Loaded {
|
|
357
|
-
const all = db.query('select id, path, account, project, session, agent, first_at, last_at, gone from
|
|
632
|
+
const all = db.query('select id, path, account, project, session, agent, first_at, last_at, gone from time_files').all() as FileRow[]
|
|
358
633
|
const files = all.filter((f) => keep(f.project) && f.last_at != null && f.last_at >= from && (f.first_at ?? 0) <= to)
|
|
359
634
|
const ids = files.map((f) => f.id)
|
|
360
635
|
const calls = new Map<number, Call[]>()
|
|
@@ -367,8 +642,8 @@ export function loadWindow(db: Database, keep: ProjectFilter, from: number, to:
|
|
|
367
642
|
// a background run's outcome is its notification's, once there is one
|
|
368
643
|
const rows = db
|
|
369
644
|
.query(
|
|
370
|
-
`select c.file_id, c.id, c.start, c.end, c.tool, c.shape, c.cmd, c.outcome, c.code, c.approval = 1 as approval, c.perm, c.read = 1 as read, c.bg = 1 as bg, b.at as bgAt, b.outcome as bgOutcome, b.code as bgCode
|
|
371
|
-
from
|
|
645
|
+
`select c.file_id, c.id, c.start, c.end, c.tool, c.shape, c.cmd, c.cmd_sum as cmdSum, c.outcome, c.code, c.approval = 1 as approval, c.perm, c.read = 1 as read, c.bg = 1 as bg, c.msg, c.model, c.ctx, c.out, c.why, c.outcome = 'timeout' as limited, b.at as bgAt, b.outcome as bgOutcome, b.code as bgCode
|
|
646
|
+
from time_calls c left join time_bg_ends b on c.bg = 1 and b.id = c.id where c.file_id in (${inList}) and c.start between ? and ?`,
|
|
372
647
|
)
|
|
373
648
|
.all(...part, from, to) as (Omit<Call, 'bgEnd'> & { file_id: number; bgAt: number | null; bgOutcome: Call['outcome']; bgCode: number | null })[]
|
|
374
649
|
for (const { bgAt, bgOutcome, bgCode, ...r } of rows) {
|
|
@@ -377,14 +652,14 @@ export function loadWindow(db: Database, keep: ProjectFilter, from: number, to:
|
|
|
377
652
|
list.push(c)
|
|
378
653
|
calls.set(c.file_id, list)
|
|
379
654
|
}
|
|
380
|
-
for (const m of db.query(`select file_id, at, kind from
|
|
655
|
+
for (const m of db.query(`select file_id, at, kind from time_marks where file_id in (${inList}) and at between ? and ?`).all(...part, from, to) as (Mark & { file_id: number })[]) {
|
|
381
656
|
const list = marks.get(m.file_id) ?? []
|
|
382
657
|
list.push(m)
|
|
383
658
|
marks.set(m.file_id, list)
|
|
384
659
|
}
|
|
385
|
-
prompts.push(...(db.query(`select file_id, at, origin, text from
|
|
660
|
+
prompts.push(...(db.query(`select file_id, at, origin, text from time_prompts where file_id in (${inList}) and at between ? and ?`).all(...part, from, to) as Loaded['prompts']))
|
|
386
661
|
}
|
|
387
|
-
return { files, calls, marks, prompts }
|
|
662
|
+
return { files, calls, marks, prompts, hooks: hookRuns(db, keep, from, to) }
|
|
388
663
|
}
|
|
389
664
|
|
|
390
665
|
/** the repo a project dir belongs to: its slug without the worktree suffix,
|