even-keel 0.2.4 → 0.3.0-rc.2
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/.claude-plugin/marketplace.json +16 -4
- package/.env.example +2 -2
- package/CHANGELOG.md +23 -0
- package/README.md +10 -8
- package/dist/src/account/aws.js +76 -0
- package/dist/src/account/azure.js +36 -0
- package/dist/src/account/cloud-errors.js +72 -0
- package/dist/src/account/cloud.js +335 -0
- package/dist/src/account/credit.js +49 -7
- package/dist/src/account/gcloud.js +71 -0
- package/dist/src/account/header-levels.js +3 -2
- package/dist/src/account/homes.js +49 -5
- package/dist/src/account/keycheck.js +57 -4
- package/dist/src/account/management.js +41 -0
- package/dist/src/account/model.js +41 -18
- package/dist/src/account/network.js +8 -3
- package/dist/src/account/service-defaults.js +12 -3
- package/dist/src/account/settingsGuard.js +92 -0
- package/dist/src/account/settingsGuardStrip.js +36 -0
- package/dist/src/account/settingsHook.js +15 -0
- package/dist/src/account/settingsLayer.js +190 -0
- package/dist/src/account/settingsUninstall.js +7 -0
- package/dist/src/account/share.js +23 -6
- package/dist/src/account/spend.js +155 -0
- package/dist/src/account/watcher.js +189 -24
- package/dist/src/agent/adapters.js +13 -2
- package/dist/src/agent/env.js +22 -7
- package/dist/src/agent/model-slots.js +32 -0
- package/dist/src/agent/process.js +32 -6
- package/dist/src/agent/projectRules.js +3 -2
- package/dist/src/agent/providers.js +18 -1
- package/dist/src/agent/scripted.js +319 -0
- package/dist/src/agent/windows.js +35 -3
- package/dist/src/badge/action.js +41 -0
- package/dist/src/badge/check.js +60 -0
- package/dist/src/badge/collect.js +174 -0
- package/dist/src/badge/dates.js +29 -0
- package/dist/src/badge/drawing.js +3 -0
- package/dist/src/badge/fonts.generated.js +11 -0
- package/dist/src/badge/model.js +9 -0
- package/dist/src/badge/privacy.js +151 -0
- package/dist/src/badge/push.js +117 -0
- package/dist/src/badge/render.js +490 -0
- package/dist/src/badge/settings.js +43 -0
- package/dist/src/badge/stats.js +31 -0
- package/dist/src/badge/status.js +57 -0
- package/dist/src/badge/text.js +52 -0
- package/dist/src/badge/theme.js +54 -0
- package/dist/src/badge/translate.js +162 -0
- package/dist/src/builtin/adapter.js +40 -0
- package/dist/src/builtin/control.js +179 -0
- package/dist/src/builtin/editor.js +117 -0
- package/dist/src/builtin/export-store.js +67 -0
- package/dist/src/builtin/export.js +202 -0
- package/dist/src/builtin/exporting.js +25 -0
- package/dist/src/builtin/files.js +155 -0
- package/dist/src/builtin/links.js +25 -0
- package/dist/src/builtin/model.js +59 -0
- package/dist/src/builtin/routes.js +108 -0
- package/dist/src/builtin/source.js +240 -0
- package/dist/src/builtin/store.js +520 -0
- package/dist/src/builtin/switch.js +77 -0
- package/dist/src/chain/answers.js +27 -0
- package/dist/src/chain/archive.js +0 -1
- package/dist/src/chain/dispatcher.js +105 -12
- package/dist/src/chain/fence.js +30 -0
- package/dist/src/chain/handover.js +27 -9
- package/dist/src/chain/launches.js +4 -4
- package/dist/src/chain/limitNotice.js +1 -1
- package/dist/src/chain/lists.js +42 -6
- package/dist/src/chain/log.js +3 -1
- package/dist/src/chain/maincheck.js +116 -10
- package/dist/src/chain/mainci.js +26 -7
- package/dist/src/chain/mainfix.js +12 -1
- package/dist/src/chain/milestone-sequence.js +40 -0
- package/dist/src/chain/milestones.js +3 -2
- package/dist/src/chain/order.js +20 -5
- package/dist/src/chain/overage.js +7 -2
- package/dist/src/chain/places.js +1 -1
- package/dist/src/chain/prompts.js +64 -6
- package/dist/src/chain/relay.js +35 -14
- package/dist/src/chain/reviews.js +8 -4
- package/dist/src/chain/rules.js +40 -11
- package/dist/src/chain/snapshots.js +2 -0
- package/dist/src/chain/start.js +21 -1
- package/dist/src/chain/store.js +16 -6
- package/dist/src/chain/unchanged.js +68 -5
- package/dist/src/ci/adapters.js +3 -1
- package/dist/src/ci/forgejo-profile.js +3 -24
- package/dist/src/ci/forgejo.js +2 -1
- package/dist/src/ci/github.js +10 -2
- package/dist/src/ci/gitlab.js +10 -3
- package/dist/src/ci/http.js +4 -0
- package/dist/src/ci/model.js +79 -6
- package/dist/src/ci/report.js +6 -3
- package/dist/src/ci/shared.js +9 -0
- package/dist/src/ci/verdict.js +18 -7
- package/dist/src/ci/watcher.js +95 -23
- package/dist/src/ci/wiring.js +15 -0
- package/dist/src/claude/adapter.js +34 -8
- package/dist/src/claude/cli.js +32 -8
- package/dist/src/claude/instructions.js +42 -7
- package/dist/src/claude/oauth.js +67 -0
- package/dist/src/claude/sdk/host.js +9 -4
- package/dist/src/claude/tree.js +45 -14
- package/dist/src/cli-check/run.js +3 -3
- package/dist/src/cli-check/support.js +4 -4
- package/dist/src/cli.js +54 -17
- package/dist/src/codex/adapter.js +2 -0
- package/dist/src/codex/cli.js +34 -18
- package/dist/src/codex/protection.js +17 -11
- package/dist/src/codex/rollout.js +9 -2
- package/dist/src/codex/turns.js +6 -3
- package/dist/src/codex/window.js +14 -0
- package/dist/src/config-form.js +63 -7
- package/dist/src/config-store.js +29 -7
- package/dist/src/config.js +45 -15
- package/dist/src/copilot/adapter.js +2 -0
- package/dist/src/copilot/cli.js +8 -11
- package/dist/src/copilot/home.js +1 -1
- package/dist/src/copilot/transcript.js +1 -2
- package/dist/src/demo/agent.js +97 -0
- package/dist/src/demo/model.js +6 -0
- package/dist/src/demo/scenario.js +139 -0
- package/dist/src/demo/service.js +161 -0
- package/dist/src/diagnostics/stop.js +16 -0
- package/dist/src/env-file.js +4 -0
- package/dist/src/error-reason.js +10 -0
- package/dist/src/event-log/log.js +97 -0
- package/dist/src/event-log/model.js +1 -0
- package/dist/src/event-log/page-events.js +71 -0
- package/dist/src/event-log/watch.js +236 -0
- package/dist/src/events.js +57 -1
- package/dist/src/forgejo/adapter.js +49 -0
- package/dist/src/forgejo/api.js +95 -0
- package/dist/src/forgejo/editor.js +196 -0
- package/dist/src/forgejo/model.js +90 -0
- package/dist/src/forgejo/profile.js +24 -0
- package/dist/src/forgejo/source.js +292 -0
- package/dist/src/forgejo/trust.js +45 -0
- package/dist/src/git/branches.js +88 -0
- package/dist/src/git/clone-progress.js +168 -0
- package/dist/src/git/remote-run.js +162 -0
- package/dist/src/git/run.js +6 -2
- package/dist/src/git/setup.js +4 -5
- package/dist/src/git/slot.js +9 -7
- package/dist/src/git/worktree.js +13 -10
- package/dist/src/github/adapter.js +1 -0
- package/dist/src/github/editor.js +214 -0
- package/dist/src/github/edits.js +31 -0
- package/dist/src/github/model.js +10 -4
- package/dist/src/github/source.js +66 -15
- package/dist/src/gitlab/adapter.js +1 -0
- package/dist/src/gitlab/api.js +4 -2
- package/dist/src/gitlab/editor.js +248 -0
- package/dist/src/gitlab/model.js +43 -4
- package/dist/src/gitlab/source.js +113 -22
- package/dist/src/guard.js +26 -10
- package/dist/src/hotkeys.js +51 -0
- package/dist/src/huly/adapter.js +1 -0
- package/dist/src/huly/collab.js +15 -0
- package/dist/src/huly/editor.js +241 -0
- package/dist/src/huly/marks.js +48 -0
- package/dist/src/huly/model.js +22 -5
- package/dist/src/huly/source.js +111 -48
- package/dist/src/intake/github.js +10 -0
- package/dist/src/intake/intake.js +41 -1
- package/dist/src/intake/model.js +8 -3
- package/dist/src/jira/adapter.js +1 -0
- package/dist/src/jira/api.js +28 -7
- package/dist/src/jira/editor.js +243 -0
- package/dist/src/jira/model.js +19 -5
- package/dist/src/jira/source.js +41 -9
- package/dist/src/jobs/model.js +1 -0
- package/dist/src/jobs/runner.js +236 -0
- package/dist/src/limits/chatgpt.js +11 -0
- package/dist/src/limits/copilot.js +51 -18
- package/dist/src/limits/model.js +62 -8
- package/dist/src/limits/overage-session.js +2 -2
- package/dist/src/limits/overage.js +8 -5
- package/dist/src/limits/reset.js +7 -0
- package/dist/src/limits/usage.js +60 -5
- package/dist/src/linear/adapter.js +1 -0
- package/dist/src/linear/editor.js +220 -0
- package/dist/src/linear/estimate.js +32 -0
- package/dist/src/linear/model.js +24 -3
- package/dist/src/linear/source.js +74 -21
- package/dist/src/main.js +53 -23
- package/dist/src/notice/en-advice.js +28 -0
- package/dist/src/notice/en-review.js +29 -0
- package/dist/src/notice/en-startup.js +21 -0
- package/dist/src/notice/en-values.js +47 -0
- package/dist/src/notice/en.js +265 -96
- package/dist/src/notice/kinds.js +26 -0
- package/dist/src/notice/notice.js +49 -6
- package/dist/src/npm-access.js +58 -0
- package/dist/src/opencode/adapter.js +4 -2
- package/dist/src/opencode/cli.js +34 -25
- package/dist/src/opencode/go.js +51 -0
- package/dist/src/opencode/home.js +41 -8
- package/dist/src/opencode/transcript.js +5 -5
- package/dist/src/opencode/usage.js +10 -4
- package/dist/src/opencode/window.js +54 -0
- package/dist/src/packages/check.js +11 -5
- package/dist/src/packages/gateway.js +76 -6
- package/dist/src/packages/launch.js +6 -3
- package/dist/src/packages/model.js +61 -2
- package/dist/src/packages/npm.js +55 -6
- package/dist/src/packages/plugins.js +23 -2
- package/dist/src/packages/service.js +104 -17
- package/dist/src/packages/settings.js +13 -0
- package/dist/src/packages/store.js +1 -1
- package/dist/src/paths.js +32 -0
- package/dist/src/profiles/control.js +1 -0
- package/dist/src/profiles/model.js +2 -2
- package/dist/src/profiles/oauth-error.js +1 -9
- package/dist/src/profiles/oauth-response.js +2 -0
- package/dist/src/profiles/service.js +46 -4
- package/dist/src/profiles/store.js +10 -5
- package/dist/src/projects/add.js +25 -2
- package/dist/src/projects/branch-control.js +86 -0
- package/dist/src/projects/branch-move.js +39 -0
- package/dist/src/projects/branch.js +13 -0
- package/dist/src/projects/check.js +80 -36
- package/dist/src/projects/creation.js +166 -0
- package/dist/src/projects/git-found.js +62 -0
- package/dist/src/projects/git-mode.js +116 -0
- package/dist/src/projects/own-folder.js +8 -0
- package/dist/src/projects/place.js +235 -0
- package/dist/src/projects/remote-branches.js +24 -0
- package/dist/src/projects/target-read.js +95 -0
- package/dist/src/projects/target.js +56 -0
- package/dist/src/review/events.js +1 -1
- package/dist/src/review/note.js +58 -0
- package/dist/src/review/open.js +3 -3
- package/dist/src/review/wiring.js +25 -3
- package/dist/src/secrets/catalog.js +4 -1
- package/dist/src/server-control.js +1 -0
- package/dist/src/server-guard.js +4 -0
- package/dist/src/server-request.js +88 -10
- package/dist/src/server-response.js +143 -0
- package/dist/src/server-security.js +16 -0
- package/dist/src/server.js +105 -117
- package/dist/src/service/account-packages.js +116 -0
- package/dist/src/service/accounts.js +109 -81
- package/dist/src/service/badge-private.js +62 -0
- package/dist/src/service/badge.js +203 -0
- package/dist/src/service/chain-prompts.js +87 -0
- package/dist/src/service/chain.js +120 -190
- package/dist/src/service/cleanup.js +114 -0
- package/dist/src/service/cli-check.js +1 -1
- package/dist/src/service/closing.js +57 -0
- package/dist/src/service/demo.js +46 -0
- package/dist/src/service/hosting.js +239 -18
- package/dist/src/service/install-check.js +78 -0
- package/dist/src/service/lifecycle.js +4 -7
- package/dist/src/service/stats.js +3 -3
- package/dist/src/service/trackers.js +27 -1
- package/dist/src/service/vocabulary.js +17 -0
- package/dist/src/service.js +215 -19
- package/dist/src/sessions/agents.js +10 -2
- package/dist/src/sessions/approvals.js +1 -1
- package/dist/src/sessions/ask.js +32 -6
- package/dist/src/sessions/boot.js +7 -0
- package/dist/src/sessions/chat.js +16 -4
- package/dist/src/sessions/commandPrompt.js +13 -6
- package/dist/src/sessions/history.js +2 -0
- package/dist/src/sessions/keepwarm.js +1 -1
- package/dist/src/sessions/launch.js +21 -25
- package/dist/src/sessions/lingering.js +30 -7
- package/dist/src/sessions/mail.js +7 -6
- package/dist/src/sessions/mailRelay.js +2 -2
- package/dist/src/sessions/mailbox.js +1 -1
- package/dist/src/sessions/monitor.js +47 -3
- package/dist/src/sessions/note.js +44 -19
- package/dist/src/sessions/permission.js +32 -10
- package/dist/src/sessions/protection.js +38 -14
- package/dist/src/sessions/rare.js +130 -0
- package/dist/src/sessions/runs-store.js +20 -0
- package/dist/src/sessions/runs.js +140 -0
- package/dist/src/sessions/tail.js +4 -0
- package/dist/src/sessions/transcript.js +64 -8
- package/dist/src/settings/defaults.js +1 -0
- package/dist/src/settings/registry.js +86 -24
- package/dist/src/settings/store.js +14 -5
- package/dist/src/setup.js +5 -0
- package/dist/src/shown-work.js +22 -0
- package/dist/src/state/settings.js +1 -0
- package/dist/src/stats/base-sql.js +7 -1
- package/dist/src/stats/checkpoint.js +8 -5
- package/dist/src/stats/model.js +1 -1
- package/dist/src/stats/reader.js +50 -25
- package/dist/src/stats/rules-reader.js +6 -2
- package/dist/src/stats/steps-reader.js +5 -0
- package/dist/src/stats/tally-schema.js +1 -1
- package/dist/src/storage/backup-model.js +3 -0
- package/dist/src/storage/backup-schedule.js +197 -0
- package/dist/src/storage/backup-worker.js +9 -0
- package/dist/src/storage/backup.js +141 -0
- package/dist/src/storage/browser-hotkeys.js +25 -0
- package/dist/src/storage/context-windows.js +39 -0
- package/dist/src/storage/copy.js +44 -13
- package/dist/src/storage/database.js +343 -4
- package/dist/src/storage/left-folders.js +16 -0
- package/dist/src/storage/migrations.js +98 -1
- package/dist/src/storage/owner.js +12 -7
- package/dist/src/storage/schema.js +1 -1
- package/dist/src/storage/startup.js +25 -0
- package/dist/src/storage/state-files.js +1 -1
- package/dist/src/storage/vacuum.js +29 -0
- package/dist/src/taskmcp/args.js +146 -0
- package/dist/src/taskmcp/calls.js +741 -0
- package/dist/src/taskmcp/downloads.js +87 -0
- package/dist/src/taskmcp/files.js +58 -0
- package/dist/src/taskmcp/retries.js +57 -0
- package/dist/src/taskmcp/server.js +81 -0
- package/dist/src/taskmcp/tools.js +128 -0
- package/dist/src/taskmcp/vocabulary.js +75 -0
- package/dist/src/tools/panel.js +41 -8
- package/dist/src/tools/sessionSettings.js +2 -1
- package/dist/src/tools/settings.js +16 -3
- package/dist/src/tracker/adapters.js +3 -1
- package/dist/src/tracker/card.js +16 -12
- package/dist/src/tracker/close.js +57 -0
- package/dist/src/tracker/closer.js +18 -15
- package/dist/src/tracker/closes.js +6 -0
- package/dist/src/tracker/control.js +32 -13
- package/dist/src/tracker/diagnostics.js +5 -2
- package/dist/src/tracker/editor.js +108 -0
- package/dist/src/tracker/export-target.js +30 -0
- package/dist/src/tracker/export.js +168 -0
- package/dist/src/tracker/health.js +5 -0
- package/dist/src/tracker/link.js +127 -24
- package/dist/src/tracker/markers.js +7 -0
- package/dist/src/tracker/model.js +0 -12
- package/dist/src/tracker/parents.js +8 -0
- package/dist/src/tracker/questions.js +24 -3
- package/dist/src/tracker/readers.js +19 -3
- package/dist/src/tracker/source.js +5 -0
- package/dist/src/tracker/start.js +61 -6
- package/dist/src/tracker/templates.js +102 -0
- package/dist/src/tracker/trackers.js +20 -10
- package/dist/src/updates/runner.js +1 -1
- package/dist/src/updates/settle.js +11 -3
- package/dist/src/updates/updater.js +4 -4
- package/dist/tally/src/builtin-tasks.js +45 -0
- package/dist/tally/src/catalogue.js +70 -0
- package/dist/tally/src/classify.js +1 -0
- package/dist/tally/src/collect.js +33 -10
- package/dist/tally/src/copilot.js +1 -0
- package/dist/tally/src/db-classify.js +46 -0
- package/dist/tally/src/db.js +66 -60
- package/dist/tally/src/migrations/10-rework-label.sql +73 -0
- package/dist/tally/src/migrations/11-catalogue-prices.sql +53 -0
- package/dist/tally/src/migrations/12-key-spends.sql +30 -0
- package/dist/tally/src/migrations/13-normal-spans.sql +110 -0
- package/dist/tally/src/migrations/14-model-families.sql +25 -0
- package/dist/tally/src/migrations/15-task-moves.sql +32 -0
- package/dist/tally/src/migrations.js +1 -1
- package/dist/tally/src/opencode.js +1 -0
- package/dist/tally/src/parse.js +3 -0
- package/dist/tally/src/rollout.js +2 -1
- package/dist/tally/src/rule-hook-size.js +2 -1
- package/dist/tally/src/rule-hook.js +3 -0
- package/dist/tally/src/task-moves.js +32 -0
- package/dist/web/assets/BadgeDialog-Dx2EERWr.js +1 -0
- package/dist/web/assets/BadgeDialog-W0giN4k2.css +1 -0
- package/dist/web/assets/DescriptionEditor-BL_6314d.js +216 -0
- package/dist/web/assets/ProjectPackages-D-Hqs0sG.js +1 -0
- package/dist/web/assets/Select-B5xZpiCG.js +1 -0
- package/dist/web/assets/Select-CYemy5Na.css +1 -0
- package/dist/web/assets/TaskCard-B9EJ_Qa2.js +2 -0
- package/dist/web/assets/TaskCard-BV2lQojC.css +1 -0
- package/dist/web/assets/TranscriptWindow-BN6jSpev.css +1 -0
- package/dist/web/assets/TranscriptWindow-E8DxggYC.js +4 -0
- package/dist/web/assets/accountParts-c2gPSGKK.js +3 -0
- package/dist/web/assets/accountParts-tFRVownp.css +1 -0
- package/dist/web/assets/blocks-B03KxlgQ.js +12 -0
- package/dist/web/assets/blocks-Dx3DACiG.css +1 -0
- package/dist/web/assets/cardDrafts-Cb5dNpJ3.js +12 -0
- package/dist/web/assets/cardDrafts-izWnctoh.css +1 -0
- package/dist/web/assets/cardSide-63fNWHHv.css +1 -0
- package/dist/web/assets/cardSide-CIGvmTwG.js +2 -0
- package/dist/web/assets/description-C-o9LBbp.css +1 -0
- package/dist/web/assets/feedLine-Buzox_AA.js +1 -0
- package/dist/web/assets/feedLine-CBjZXWwX.css +1 -0
- package/dist/web/assets/hooks-DdmIE6gF.js +1 -0
- package/dist/web/assets/index-CkYiatZt.css +1 -0
- package/dist/web/assets/index-DELgEMlH.js +25 -0
- package/dist/web/assets/lib-B8qNeB0X.css +1 -0
- package/dist/web/assets/lib-C1i2rKJZ.js +18 -0
- package/dist/web/assets/overview-B7iEgjQD.css +1 -0
- package/dist/web/assets/overview-D9PUjFeR.js +7 -0
- package/dist/web/assets/packageGroups-B34vA6-0.js +1 -0
- package/dist/web/assets/packages-Dld4uH9X.css +1 -0
- package/dist/web/assets/react-dom-vGPErQYp.js +1 -0
- package/dist/web/assets/rules-BVB-I2tg.js +1 -0
- package/dist/web/assets/rules-Bgil4ZBp.css +1 -0
- package/dist/web/assets/secret-CmK85pY6.js +1 -0
- package/dist/web/assets/secret-DldsC74x.css +1 -0
- package/dist/web/assets/useFileDrop-eZtIxL1H.js +1 -0
- package/dist/web/assets/useHeightGlide-BmtdsmN0.css +1 -0
- package/dist/web/assets/useHeightGlide-DQvvOoIL.js +3 -0
- package/dist/web/assets/useRowFocus-CwOoEmzD.js +1 -0
- package/dist/web/index.html +30 -9
- package/dist/web/theme.js +6 -0
- package/even-keel.config.example.json +5 -4
- package/package.json +21 -5
- package/plugins/agent-bridge/.claude-plugin/plugin.json +16 -0
- package/plugins/{checkpoint → agent-bridge}/README.md +20 -6
- package/plugins/agent-bridge/hooks/addressban.mjs +64 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/checkpoint-mark.mjs +4 -3
- package/plugins/{checkpoint → agent-bridge}/hooks/evenkeel.mjs +28 -11
- package/plugins/agent-bridge/hooks/git-ban.mjs +31 -0
- package/plugins/agent-bridge/hooks/gitban.mjs +83 -0
- package/plugins/agent-bridge/hooks/handoff.mjs +20 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/hooks.json +10 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/mailbox.mjs +6 -3
- package/plugins/{checkpoint → agent-bridge}/hooks/nudges.mjs +11 -7
- package/plugins/{checkpoint/opencode/checkpoint.mjs → agent-bridge/opencode/agent-bridge.mjs} +15 -9
- package/plugins/forgejo/.claude-plugin/plugin.json +7 -0
- package/plugins/forgejo/.mcp.json +13 -0
- package/plugins/forgejo/README.md +23 -0
- package/plugins/forgejo/skills/task/SKILL.md +55 -0
- package/plugins/github/.claude-plugin/plugin.json +1 -1
- package/plugins/github/README.md +1 -1
- package/plugins/github/skills/task/SKILL.md +2 -2
- package/plugins/gitlab/.claude-plugin/plugin.json +1 -1
- package/plugins/gitlab/skills/task/SKILL.md +2 -2
- package/plugins/huly/.claude-plugin/plugin.json +1 -1
- package/plugins/huly/skills/task/SKILL.md +4 -4
- package/plugins/jira/.claude-plugin/plugin.json +1 -1
- package/plugins/jira/skills/task/SKILL.md +3 -3
- package/plugins/linear/.claude-plugin/plugin.json +1 -1
- package/plugins/linear/README.md +1 -1
- package/plugins/linear/skills/task/SKILL.md +3 -3
- package/plugins/tally/.claude-plugin/plugin.json +1 -1
- package/plugins/tally/skills/session-audit/SKILL.md +5 -5
- package/plugins/tasks/.claude-plugin/plugin.json +9 -0
- package/plugins/tasks/.mcp.json +8 -0
- package/plugins/tasks/README.md +42 -0
- package/plugins/tasks/hooks/calibration-context.mjs +45 -0
- package/plugins/tasks/hooks/calibration.mjs +92 -0
- package/plugins/tasks/hooks/check-service.mjs +15 -0
- package/plugins/tasks/hooks/hooks.json +28 -0
- package/plugins/tasks/hooks/service-check.mjs +34 -0
- package/plugins/tasks/hooks/show-calibration.mjs +19 -0
- package/plugins/tasks/opencode/tasks.mjs +28 -0
- package/plugins/tasks/skills/split/SKILL.md +29 -0
- package/plugins/tasks/skills/task/SKILL.md +61 -0
- package/service/EvenKeelTray.cs +4 -20
- package/service/install.sh +25 -2
- package/service/uninstall.ps1 +16 -0
- package/service/uninstall.sh +10 -0
- package/tally/tally.config.json +2 -0
- package/dist/web/assets/Loader-CRe-GCoI.js +0 -31
- package/dist/web/assets/Loader-DJJTBsaF.css +0 -1
- package/dist/web/assets/TaskCard-Br2QIllc.css +0 -1
- package/dist/web/assets/TaskCard-C2xeaHWD.js +0 -2
- package/dist/web/assets/TranscriptWindow-B9zsSmIg.css +0 -1
- package/dist/web/assets/TranscriptWindow-COL_WTrF.js +0 -4
- package/dist/web/assets/feedLine-D0lnFyBZ.js +0 -1
- package/dist/web/assets/index-DQje9Nfo.js +0 -25
- package/dist/web/assets/index-mDBlgk2Y.css +0 -1
- package/dist/web/assets/media-BlW-XXN0.js +0 -1
- package/dist/web/assets/media-DR8nAbPy.css +0 -1
- package/dist/web/assets/useModels-1oIk0mDX.css +0 -1
- package/dist/web/assets/useModels-DRW63oka.js +0 -15
- package/plugins/checkpoint/.claude-plugin/plugin.json +0 -9
- package/plugins/checkpoint/hooks/handoff.mjs +0 -9
- /package/plugins/{checkpoint → agent-bridge}/hooks/context-checkpoint.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/merge-check.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/merges.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/permission.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/schema-hint.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/standard-gate.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/standards.mjs +0 -0
|
@@ -5,7 +5,7 @@ import { saveQuestions } from '../chain/store.js';
|
|
|
5
5
|
import { parseRemote } from '../ci/remote.js';
|
|
6
6
|
import { intakeRepo } from '../intake/github.js';
|
|
7
7
|
import { Intake } from '../intake/intake.js';
|
|
8
|
-
import { feedRules, idPrefixOf, ownerOf, projectLabel, readerIds, readersOf, readKeyOf } from '../config.js';
|
|
8
|
+
import { feedRules, idPrefixOf, isPlain, ownerOf, projectLabel, readerIds, readersOf, readKeyOf } from '../config.js';
|
|
9
9
|
import { englishOf, noticeOf } from '../notice/notice.js';
|
|
10
10
|
import { profileFor } from '../profiles/model.js';
|
|
11
11
|
import { projectRules } from '../profiles/rules.js';
|
|
@@ -17,6 +17,8 @@ import { StatusMover } from '../tracker/mover.js';
|
|
|
17
17
|
import { TrackerQuestions } from '../tracker/questions.js';
|
|
18
18
|
import { ReaderTasks } from '../tracker/readers.js';
|
|
19
19
|
import { startTracker } from '../tracker/start.js';
|
|
20
|
+
import { IssueTemplateReader, isOwnRepo } from '../tracker/templates.js';
|
|
21
|
+
import { runGit } from '../git/run.js';
|
|
20
22
|
import { Trackers } from '../tracker/trackers.js';
|
|
21
23
|
export function wireReaderRules(ctx) {
|
|
22
24
|
return (reader) => {
|
|
@@ -45,6 +47,9 @@ export function wireReaderMoves(ctx) {
|
|
|
45
47
|
const tracker = ctx.readers().trackers[reader];
|
|
46
48
|
if (tracker === undefined || ADAPTERS[tracker]?.moves === undefined)
|
|
47
49
|
return undefined;
|
|
50
|
+
const fixed = ADAPTERS[tracker].fixedMoves;
|
|
51
|
+
if (fixed !== undefined)
|
|
52
|
+
return { reader, rules: ctx.readerRules(reader), profile: { ...fixed } };
|
|
48
53
|
const feed = ctx.feedOf(reader);
|
|
49
54
|
const profile = profileFor(ctx.profiles.current(), reader, tracker)?.moves;
|
|
50
55
|
const source = feed === undefined ? ctx.configStore.current.moves[reader] : feed.moves;
|
|
@@ -68,11 +73,24 @@ export function wireStatusMover(ctx) {
|
|
|
68
73
|
changed: () => ctx.hub.broadcastSoon('state', ctx.getState),
|
|
69
74
|
});
|
|
70
75
|
}
|
|
76
|
+
const templateReader = new IssueTemplateReader(runGit);
|
|
77
|
+
/**
|
|
78
|
+
* The issue templates of the project's main branch, where its folder is the tracker's repository `place` (BTN-1130);
|
|
79
|
+
* `null` — not known: a project without git, or a repository the folder is not a clone of.
|
|
80
|
+
*/
|
|
81
|
+
function ownTemplates(ctx, project, place) {
|
|
82
|
+
const config = ctx.configStore.current;
|
|
83
|
+
const repo = config.projects[project];
|
|
84
|
+
if (repo === undefined || place === undefined || isPlain(config, project) || !isOwnRepo(ctx.remotes.urls[project] ?? [], place))
|
|
85
|
+
return Promise.resolve(null);
|
|
86
|
+
return templateReader.read(repo, ctx.branchOf(project));
|
|
87
|
+
}
|
|
71
88
|
export function wireTrackers(ctx) {
|
|
72
89
|
return new Trackers({
|
|
73
90
|
adapters: ADAPTERS,
|
|
74
91
|
start: (view, setup) => startTracker(view, setup, {
|
|
75
92
|
repoOf: (reader) => ctx.configStore.current.projects[ctx.ownerOfReader(reader)],
|
|
93
|
+
plain: (reader) => isPlain(ctx.configStore.current, ctx.ownerOfReader(reader)),
|
|
76
94
|
rulesOf: ctx.readerRules,
|
|
77
95
|
links: ctx.links,
|
|
78
96
|
tasksByProject: ctx.readerTasks,
|
|
@@ -84,17 +102,20 @@ export function wireTrackers(ctx) {
|
|
|
84
102
|
return ranSince(own, project, since).filter((task) => ctx.readerFor(project, task) === reader);
|
|
85
103
|
},
|
|
86
104
|
dispatcher: ctx.readerTasks,
|
|
105
|
+
parents: ctx.readerTasks,
|
|
87
106
|
doneOf: (reader) => {
|
|
88
107
|
const plan = ctx.readerMoves(reader);
|
|
89
108
|
return plan === undefined ? undefined : doneMove(plan.rules, plan.profile, plan.source);
|
|
90
109
|
},
|
|
91
110
|
marks: ctx.mergeMarks,
|
|
111
|
+
pending: ctx.pendingCloses,
|
|
92
112
|
fillsMilestone: (reader) => ctx.configStore.current.settings[ctx.ownerOfReader(reader)]?.fillMilestone ?? false,
|
|
93
113
|
mainBranch: (reader) => ctx.branchOf(ctx.ownerOfReader(reader)),
|
|
94
114
|
readKey: (reader) => readKeyOf(ctx.readers(), reader),
|
|
95
115
|
broadcast: () => ctx.hub.broadcastSoon('state', ctx.getState),
|
|
96
116
|
refreshers: ctx.refreshers,
|
|
97
117
|
recovered: (profile) => ctx.profiles.recheckSoon(profile),
|
|
118
|
+
issueTemplates: (reader) => ownTemplates(ctx, ctx.ownerOfReader(reader), ctx.readers().trackerProjects[reader]),
|
|
98
119
|
}),
|
|
99
120
|
tasksByProject: ctx.readerTasks,
|
|
100
121
|
refreshers: ctx.refreshers,
|
|
@@ -167,6 +188,9 @@ export function wireIntake(ctx) {
|
|
|
167
188
|
save: (entries) => ctx.writes.add('the issues taken in', setStateValue(ctx.db, 'intake', entries)),
|
|
168
189
|
now: () => new Date(),
|
|
169
190
|
log: (message) => console.log(message),
|
|
191
|
+
templates: (place) => ownTemplates(ctx, place.project, place.slug),
|
|
192
|
+
templateHits: ctx.intakeTemplateHits,
|
|
193
|
+
changed: () => ctx.hub.broadcastSoon('state', ctx.getState),
|
|
170
194
|
});
|
|
171
195
|
}
|
|
172
196
|
export function projectsChanged(ctx, before) {
|
|
@@ -179,6 +203,7 @@ export function projectsChanged(ctx, before) {
|
|
|
179
203
|
}
|
|
180
204
|
ctx.dispatcher.forget(project);
|
|
181
205
|
ctx.tasksByProject.delete(project);
|
|
206
|
+
ctx.parentsByProject.delete(project);
|
|
182
207
|
console.log(`config: ${projectLabel(before, project)} is gone from the config; its chain is let go, its sessions are left as they are`);
|
|
183
208
|
}
|
|
184
209
|
for (const project of Object.keys(after.projects))
|
|
@@ -232,6 +257,7 @@ export function wireReaderTasks(ctx) {
|
|
|
232
257
|
readers: (project) => readerIds(ctx.configStore.current, project),
|
|
233
258
|
belongs: (reader, task) => ctx.readerFor(ctx.ownerOfReader(reader), task) === reader,
|
|
234
259
|
tasksByProject: ctx.tasksByProject,
|
|
260
|
+
parentsByProject: ctx.parentsByProject,
|
|
235
261
|
get dispatcher() {
|
|
236
262
|
return ctx.dispatcher;
|
|
237
263
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { idPrefixOf, readerIds } from '../config.js';
|
|
2
|
+
import { servesTasks } from '../taskmcp/server.js';
|
|
3
|
+
import { termsOf } from '../taskmcp/vocabulary.js';
|
|
4
|
+
import { ADAPTERS } from '../tracker/adapters.js';
|
|
5
|
+
/**
|
|
6
|
+
* The project's trackers the tasks tools serve, its own first, each with its terms for a session's prompt (BTN-893). A
|
|
7
|
+
* tracker that is off or did not answer gets no terms: the prompt goes without its line rather than wait for it.
|
|
8
|
+
*/
|
|
9
|
+
export async function promptTrackers(ctx, project) {
|
|
10
|
+
const readers = ctx.readers();
|
|
11
|
+
const served = readerIds(ctx.configStore.current, project).filter((id) => servesTasks(ADAPTERS[readers.trackers[id] ?? '']));
|
|
12
|
+
return Promise.all(served.map(async (id) => {
|
|
13
|
+
const link = ctx.linkOf(id);
|
|
14
|
+
const terms = link === undefined ? null : await link.page((tracker) => termsOf(tracker, id, ctx.readerRules(id))).catch(() => null);
|
|
15
|
+
return { prefix: idPrefixOf(readers, id).toUpperCase(), title: ADAPTERS[readers.trackers[id]].title, terms };
|
|
16
|
+
}));
|
|
17
|
+
}
|
package/dist/src/service.js
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { openAccountHomes } from './account/globals.js';
|
|
4
|
+
import { AccountSettings, loadAccountSettings, saveAccountSettings } from './account/settingsLayer.js';
|
|
4
5
|
import { loadLedger, saveLedger } from './account/ledger.js';
|
|
5
6
|
import { loadKeyOrganizations } from './account/organizations.js';
|
|
7
|
+
import { loadManagementKeys } from './account/management.js';
|
|
8
|
+
import { loadBrowserHotkeys } from './storage/browser-hotkeys.js';
|
|
9
|
+
import { KEY_SPEND_POLL_MS, KEY_SPEND_TAIL_MS, KEY_SPEND_TIMEOUT_MS } from './account/service-defaults.js';
|
|
10
|
+
import { KeySpend, readOpenRouterKey, saveKeySpend } from './account/spend.js';
|
|
11
|
+
import { keyVendor } from './opencode/home.js';
|
|
6
12
|
import { loadSavedLimits } from './limits/saved.js';
|
|
13
|
+
import { loadRareEvents, pruneRareEvents, rareEvents, saveRareEvent } from './sessions/rare.js';
|
|
14
|
+
import { PendingCloses } from './tracker/close.js';
|
|
7
15
|
import { loadMergeMarks, MergeMarks, saveMergeMark } from './tracker/closes.js';
|
|
16
|
+
import { TaskRuns } from './sessions/runs.js';
|
|
17
|
+
import { dropRunImport, dropTaskRun, loadRunImports, loadTaskRuns, saveTaskRun } from './sessions/runs-store.js';
|
|
18
|
+
import { EventLog, loadEventLog, pruneEventLog, saveEventEntry, saveEventMemory } from './event-log/log.js';
|
|
8
19
|
import { providerUrl } from './account/network.js';
|
|
9
20
|
import { copies } from './agent/copies.js';
|
|
10
21
|
import { CLAUDE } from './claude/name.js';
|
|
22
|
+
import { OPENCODE } from './opencode/name.js';
|
|
11
23
|
import { launchedProjects } from './chain/launches.js';
|
|
12
24
|
import { pullReadiness } from './review/open.js';
|
|
13
25
|
import { PullRefusals } from './review/refusals.js';
|
|
14
26
|
import { closedTasks, loadQuestions, readLaunches } from './chain/store.js';
|
|
15
27
|
import { ciToken, gitlabUrls, projectTargets } from './ci/adapters.js';
|
|
16
28
|
import { ProtectionAudit } from './ci/protection-audit.js';
|
|
17
|
-
import {
|
|
18
|
-
import { DEFAULT_BRANCH, listenOf, mcpPortOf, ownerOf, projectLabels, readerIds, readerOf, readersOf } from './config.js';
|
|
29
|
+
import { DEFAULT_BRANCH, gitProjects, isPlain, plainProjects, listenOf, mcpPortOf, ownerOf, projectLabel, projectLabels, readerIds, readerOf, readersOf } from './config.js';
|
|
19
30
|
import { EventHub } from './events.js';
|
|
20
31
|
import { runGit } from './git/run.js';
|
|
21
32
|
import { limitRecovery } from './limits/recovery.js';
|
|
22
33
|
import { englishOf, fail, noticeOf, withLabels } from './notice/notice.js';
|
|
23
34
|
import { guardToken } from './guard.js';
|
|
24
35
|
import { ProjectRemotes } from './projects/remotes.js';
|
|
36
|
+
import { GitFound } from './projects/git-found.js';
|
|
25
37
|
import { Approvals } from './sessions/approvals.js';
|
|
26
38
|
import { CheckReports } from './chain/checkreports.js';
|
|
27
39
|
import { createChat } from './sessions/chat.js';
|
|
40
|
+
import { noteFileOf } from './sessions/note.js';
|
|
28
41
|
import { Mailbox } from './sessions/mailbox.js';
|
|
29
42
|
import { settleMail } from './sessions/mailRelay.js';
|
|
30
43
|
import { Lingering } from './sessions/lingering.js';
|
|
@@ -34,14 +47,23 @@ import { TranscriptWatch } from './sessions/watch.js';
|
|
|
34
47
|
import { loadEnv, root, stateDirOf } from './locations.js';
|
|
35
48
|
import { hulyClient, installForProfiles } from './huly/client.js';
|
|
36
49
|
import { gitSetup } from './git/setup.js';
|
|
50
|
+
import { stepJobs } from './jobs/runner.js';
|
|
37
51
|
import { profileKinds } from './profiles/model.js';
|
|
38
52
|
import { importForgejo, importProfiles } from './profiles/store.js';
|
|
39
53
|
import { Writes } from './storage/database.js';
|
|
54
|
+
import { dropLeftFolder, loadLeftFolders, saveLeftFolder } from './storage/left-folders.js';
|
|
55
|
+
import { VACUUM_EVERY_MS, vacuumDatabase } from './storage/vacuum.js';
|
|
56
|
+
import { loadContextWindows, loadSessionWindows } from './storage/context-windows.js';
|
|
40
57
|
import { keptDatabase } from './storage/owner.js';
|
|
58
|
+
import { backupDirOf } from './storage/backup.js';
|
|
59
|
+
import { Backups, copyOnThread, takeStartFailure } from './storage/backup-schedule.js';
|
|
41
60
|
import { stateValue } from './storage/service-state.js';
|
|
42
61
|
import { inferredTallyMode, tallyKey } from './stats/mode.js';
|
|
43
62
|
import { createSessionSettings } from './tools/sessionSettings.js';
|
|
44
63
|
import { ADAPTERS } from './tracker/adapters.js';
|
|
64
|
+
import { attachBuiltin } from './builtin/adapter.js';
|
|
65
|
+
import { attachmentsDirOf, SWEEP_EVERY_MS, sweepAttachments } from './builtin/files.js';
|
|
66
|
+
import { BuiltinStore } from './builtin/store.js';
|
|
45
67
|
import { profileStatusesOf } from './tracker/statuses.js';
|
|
46
68
|
import { KeptReads, Vocabularies } from './tracker/vocabulary.js';
|
|
47
69
|
import { updatesView } from './updates/release.js';
|
|
@@ -53,6 +75,8 @@ import * as statsService from './service/stats.js';
|
|
|
53
75
|
import * as trackersService from './service/trackers.js';
|
|
54
76
|
import * as lifecycleService from './service/lifecycle.js';
|
|
55
77
|
import * as cliCheckService from './service/cli-check.js';
|
|
78
|
+
import * as demoService from './service/demo.js';
|
|
79
|
+
import { wireBadges } from './service/badge.js';
|
|
56
80
|
import { AccountLease } from './cli-check/lease.js';
|
|
57
81
|
const SESSION_POLL_MS = 3_000;
|
|
58
82
|
/** How often the CLI and the account's settings are looked at for a context window that may have changed. */
|
|
@@ -115,6 +139,7 @@ const context = {
|
|
|
115
139
|
get activeAccount() { return activeAccount; },
|
|
116
140
|
get agentExtras() { return agentExtras; },
|
|
117
141
|
get agentOf() { return agentOf; },
|
|
142
|
+
get badges() { return badges; },
|
|
118
143
|
get agentStatus() { return agentStatus; },
|
|
119
144
|
get agents() { return agents; },
|
|
120
145
|
set agents(value) { agents = value; },
|
|
@@ -128,6 +153,7 @@ const context = {
|
|
|
128
153
|
get approved() { return approved; },
|
|
129
154
|
get archive() { return archive; },
|
|
130
155
|
get archiveClosed() { return archiveClosed; },
|
|
156
|
+
get backups() { return backups; },
|
|
131
157
|
get branchOf() { return branchOf; },
|
|
132
158
|
get briefOn() { return briefOn; },
|
|
133
159
|
get briefed() { return briefed; },
|
|
@@ -151,10 +177,16 @@ const context = {
|
|
|
151
177
|
get contextWindows() { return contextWindows; },
|
|
152
178
|
get daemons() { return daemons; },
|
|
153
179
|
get db() { return db; },
|
|
180
|
+
get demo() { return demo; },
|
|
154
181
|
get dismissedUpdate() { return dismissedUpdate; },
|
|
155
182
|
set dismissedUpdate(value) { dismissedUpdate = value; },
|
|
183
|
+
get dismissedNotices() { return dismissedNotices; },
|
|
184
|
+
set dismissedNotices(value) { dismissedNotices = value; },
|
|
185
|
+
get browserHotkeys() { return browserHotkeys; },
|
|
186
|
+
set browserHotkeys(value) { browserHotkeys = value; },
|
|
156
187
|
get dispatcher() { return dispatcher; },
|
|
157
188
|
get emailAt() { return emailAt; },
|
|
189
|
+
get eventLog() { return eventLog; },
|
|
158
190
|
get envChanged() { return envChanged; },
|
|
159
191
|
get envFile() { return envFile; },
|
|
160
192
|
get envOf() { return envOf; },
|
|
@@ -166,14 +198,21 @@ const context = {
|
|
|
166
198
|
get hasAccount() { return hasAccount; },
|
|
167
199
|
get homeOf() { return homeOf; },
|
|
168
200
|
get homes() { return homes; },
|
|
201
|
+
get accountSettings() { return accountSettings; },
|
|
169
202
|
get hub() { return hub; },
|
|
170
203
|
get importedProfiles() { return importedProfiles; },
|
|
171
204
|
get inHomes() { return inHomes; },
|
|
172
205
|
get intakeEntries() { return intakeEntries; },
|
|
173
206
|
get intakePlaces() { return intakePlaces; },
|
|
207
|
+
get intakeTemplateHits() { return intakeTemplateHits; },
|
|
174
208
|
get keepWarm() { return keepWarm; },
|
|
175
209
|
get keyOrganizations() { return keyOrganizations; },
|
|
210
|
+
get keySpend() { return keySpend; },
|
|
176
211
|
get knownTask() { return knownTask; },
|
|
212
|
+
get runOfTask() { return runOfTask; },
|
|
213
|
+
get runsOfProject() { return runsOfProject; },
|
|
214
|
+
get setTaskRun() { return setTaskRun; },
|
|
215
|
+
get taskRuns() { return taskRuns; },
|
|
177
216
|
get launchIn() { return launchIn; },
|
|
178
217
|
get launches() { return launches; },
|
|
179
218
|
get ledger() { return ledger; },
|
|
@@ -194,8 +233,10 @@ const context = {
|
|
|
194
233
|
get logStartupDialogs() { return logStartupDialogs; },
|
|
195
234
|
get mailRelay() { return mailRelay; },
|
|
196
235
|
get mailbox() { return mailbox; },
|
|
236
|
+
get managementKeys() { return managementKeys; },
|
|
197
237
|
get mcpPort() { return mcpPort; },
|
|
198
238
|
get mergeMarks() { return mergeMarks; },
|
|
239
|
+
get pendingCloses() { return pendingCloses; },
|
|
199
240
|
set mcpPort(value) { mcpPort = value; },
|
|
200
241
|
get models() { return models; },
|
|
201
242
|
get monitor() { return monitor; },
|
|
@@ -233,6 +274,8 @@ const context = {
|
|
|
233
274
|
get releasesView() { return releasesView; },
|
|
234
275
|
get remotes() { return remotes; },
|
|
235
276
|
get removalFacts() { return removalFacts; },
|
|
277
|
+
get branches() { return branches; },
|
|
278
|
+
get gitFound() { return gitFound; },
|
|
236
279
|
get requireModel() { return requireModel; },
|
|
237
280
|
get resumeIn() { return resumeIn; },
|
|
238
281
|
get resumeWith() { return resumeWith; },
|
|
@@ -273,9 +316,11 @@ const context = {
|
|
|
273
316
|
set tallyRestarts(value) { tallyRestarts = value; },
|
|
274
317
|
get tallyRuns() { return tallyRuns; },
|
|
275
318
|
set tallyRuns(value) { tallyRuns = value; },
|
|
319
|
+
get taskNote() { return taskNote; },
|
|
276
320
|
get taskRun() { return taskRun; },
|
|
277
321
|
get taskSource() { return taskSource; },
|
|
278
322
|
get tasksByProject() { return tasksByProject; },
|
|
323
|
+
get parentsByProject() { return parentsByProject; },
|
|
279
324
|
get token() { return token; },
|
|
280
325
|
set token(value) { token = value; },
|
|
281
326
|
get trackerPlace() { return trackerPlace; },
|
|
@@ -298,9 +343,31 @@ const context = {
|
|
|
298
343
|
export const service = context;
|
|
299
344
|
const stateDb = keptDatabase();
|
|
300
345
|
const db = stateDb.db;
|
|
346
|
+
const attachmentsDir = attachmentsDirOf(stateDirOf());
|
|
347
|
+
attachBuiltin(db, attachmentsDir);
|
|
348
|
+
const sweepFiles = () => void sweepAttachments(new BuiltinStore(db), attachmentsDir);
|
|
349
|
+
sweepFiles();
|
|
301
350
|
/** The database's writes are not waited for: the dispatcher and the page go on from what they hold in memory. */
|
|
302
351
|
const writes = new Writes((line) => console.warn(line));
|
|
352
|
+
/** What happened while nobody looked (BTN-350): the page's toasts and its /log come from it. */
|
|
353
|
+
const eventLog = new EventLog(await loadEventLog(db), {
|
|
354
|
+
save: (entry) => writes.add(`the event log entry ${entry.id}`, saveEventEntry(db, entry)),
|
|
355
|
+
prune: (below) => writes.add('the old event log entries', pruneEventLog(db, below)),
|
|
356
|
+
remember: (memory) => writes.add('the event log memory', saveEventMemory(db, memory)),
|
|
357
|
+
}, undefined, () => stateChanged());
|
|
303
358
|
const configStore = await hostingService.wireConfigStore(context);
|
|
359
|
+
eventLog.settingsSeen(configStore.raw());
|
|
360
|
+
const backups = new Backups({
|
|
361
|
+
db,
|
|
362
|
+
files: attachmentsDir,
|
|
363
|
+
settings: () => ({ dir: backupDirOf(stateDirOf(), configStore.current.backup.dir), keep: configStore.current.backup.keep }),
|
|
364
|
+
run: copyOnThread,
|
|
365
|
+
log: (line) => console.log(line),
|
|
366
|
+
changed: () => stateChanged(),
|
|
367
|
+
});
|
|
368
|
+
const backupAtStart = takeStartFailure();
|
|
369
|
+
if (backupAtStart !== null)
|
|
370
|
+
backups.failedAtStart(backupAtStart);
|
|
304
371
|
// The service names a project by its id (BTN-271): its log shows the project's label (`projectLabel`) instead.
|
|
305
372
|
for (const method of ['log', 'warn', 'error']) {
|
|
306
373
|
const write = console[method].bind(console);
|
|
@@ -308,21 +375,52 @@ for (const method of ['log', 'warn', 'error']) {
|
|
|
308
375
|
}
|
|
309
376
|
/** The version whose toast the user closed: state, not a setting (BTN-199). */
|
|
310
377
|
let dismissedUpdate = (await stateValue(db, 'updates.dismissed'));
|
|
378
|
+
/** The page's "Got it" marks (BTN-759): state, not a setting. */
|
|
379
|
+
let dismissedNotices = (await stateValue(db, 'notices.dismissed')) ?? {};
|
|
380
|
+
/** The page's hotkeys of each browser (BTN-880), held in memory and written behind. */
|
|
381
|
+
let browserHotkeys = await loadBrowserHotkeys(db);
|
|
311
382
|
const intakeEntries = (await stateValue(db, 'intake')) ?? [];
|
|
383
|
+
/** By project, the issue templates that put its intake label on (BTN-1130); filled by the intake's ticks. */
|
|
384
|
+
const intakeTemplateHits = {};
|
|
312
385
|
/** The organization each API account's key pays through (BTN-418), held in memory and written behind. */
|
|
313
386
|
const keyOrganizations = await loadKeyOrganizations(db);
|
|
387
|
+
/** The management key of each OpenRouter account, for its balance (BTN-868), held in memory and written behind. */
|
|
388
|
+
const managementKeys = await loadManagementKeys(db);
|
|
314
389
|
/** What polls and sessions last told of each account's limits before this start (BTN-631). */
|
|
315
390
|
const savedLimits = await loadSavedLimits(db);
|
|
391
|
+
/** The context windows the agents named before this start, per launch and per session (BTN-946). */
|
|
392
|
+
const savedWindows = await loadContextWindows(db);
|
|
393
|
+
const savedSessionWindows = await loadSessionWindows(db);
|
|
316
394
|
/** The tasks the merge closer closed and the commits main had of their branches then (BTN-689). */
|
|
317
395
|
const mergeMarks = new MergeMarks(await loadMergeMarks(db), (mark) => writes.add(`the close of ${mark.task}`, saveMergeMark(db, mark)));
|
|
396
|
+
/** The merged pull requests' tasks whose close the tracker refused, retried by the merge closers (BTN-1163). */
|
|
397
|
+
const pendingCloses = new PendingCloses();
|
|
398
|
+
/** What each task's sessions run on, set on its card (BTN-983), and the projects whose run labels are still to be moved. */
|
|
399
|
+
const taskRuns = new TaskRuns(await loadTaskRuns(db), await loadRunImports(db), {
|
|
400
|
+
save: (run) => writes.add(`the run of ${run.task}`, saveTaskRun(db, run)),
|
|
401
|
+
drop: (project, task) => writes.add(`the run of ${task}`, dropTaskRun(db, project, task)),
|
|
402
|
+
imported: (project) => writes.add(`the moved run labels of ${project}`, dropRunImport(db, project)),
|
|
403
|
+
});
|
|
404
|
+
/** The `rare:` lines already written and the pairs still open (BTN-814); unreadable rows only risk a repeated line. */
|
|
405
|
+
rareEvents.restore(await loadRareEvents(db).catch((error) => {
|
|
406
|
+
console.warn(`storage: the rare events not read: ${error instanceof Error ? error.message : String(error)}`);
|
|
407
|
+
return [];
|
|
408
|
+
}), {
|
|
409
|
+
save: (record) => writes.add(`the rare event ${record.entry}`, saveRareEvent(db, record)),
|
|
410
|
+
prune: (before) => writes.add('the old rare events', pruneRareEvents(db, before)),
|
|
411
|
+
});
|
|
318
412
|
const envFile = loadEnv();
|
|
319
|
-
/** What a profile is made for: the trackers,
|
|
320
|
-
const profileKindsOf = profileKinds(ADAPTERS
|
|
321
|
-
/**
|
|
413
|
+
/** What a profile is made for: the trackers, Forgejo's among them, which serves its CI too (BTN-201, BTN-476). */
|
|
414
|
+
const profileKindsOf = profileKinds(ADAPTERS);
|
|
415
|
+
/**
|
|
416
|
+
* The trackers' and Forgejo's credentials (BTN-200, BTN-201); the first start makes them of the variables of `.env`.
|
|
417
|
+
* Forgejo's are `importForgejo`'s: `FORGEJO_TOKEN` alone is the CI's older form and makes a profile per remote host.
|
|
418
|
+
*/
|
|
419
|
+
const { forgejo: _forgejo, ...importedAdapters } = ADAPTERS;
|
|
322
420
|
const trackerProfiles = await importProfiles({
|
|
323
421
|
db,
|
|
324
422
|
env: process.env,
|
|
325
|
-
adapters:
|
|
423
|
+
adapters: importedAdapters,
|
|
326
424
|
trackers: configStore.current.trackers,
|
|
327
425
|
log: (line) => console.log(line),
|
|
328
426
|
});
|
|
@@ -330,7 +428,7 @@ const importedProfiles = await importForgejo({
|
|
|
330
428
|
db,
|
|
331
429
|
env: process.env,
|
|
332
430
|
webs: async () => {
|
|
333
|
-
const targets = await Promise.all(Object.values(configStore.current
|
|
431
|
+
const targets = await Promise.all(Object.values(gitProjects(configStore.current)).map((repo) => projectTargets(runGit, repo, trackerProfiles.profiles).catch(() => [])));
|
|
334
432
|
return targets.flat().flatMap((target) => (target.kind === 'forgejo' ? [target.web] : []));
|
|
335
433
|
},
|
|
336
434
|
log: (line) => console.log(line),
|
|
@@ -388,11 +486,13 @@ const refreshProject = async (project) => {
|
|
|
388
486
|
await Promise.all(found.map((refresh) => refresh()));
|
|
389
487
|
return found.length > 0;
|
|
390
488
|
};
|
|
391
|
-
const vocabularies = new Vocabularies(async (project) => linkOf(project)?.
|
|
489
|
+
const vocabularies = new Vocabularies(async (project) => linkOf(project)?.page(async (tracker) => tracker.vocabulary?.(project)));
|
|
392
490
|
/** The statuses of each tracker profile (BTN-554), for its status moves. */
|
|
393
491
|
const profileStatuses = new KeptReads((id) => profileStatusesOf(ADAPTERS, profiles.current(), id));
|
|
394
492
|
// The state goes to the page whole once, then by its changed parts, the sessions one by one (BTN-695).
|
|
395
|
-
const hub = new EventHub({ state: { sessions: 'sessionId' } });
|
|
493
|
+
const hub = new EventHub({ state: { sessions: 'sessionId', eventLog: 'id' } });
|
|
494
|
+
// The event log looks at the state also while no page listens, at most every two seconds (BTN-350).
|
|
495
|
+
hub.watch('state', (state) => eventLog.observe(state), 2_000);
|
|
396
496
|
/**
|
|
397
497
|
* Sends the page the new state soon. `getState` is read only when the state is built: handlers wired above its
|
|
398
498
|
* declaration may fire while this module still starts — the Huly client's install does at once (EKR-52).
|
|
@@ -400,6 +500,11 @@ const hub = new EventHub({ state: { sessions: 'sessionId' } });
|
|
|
400
500
|
const stateChanged = () => hub.broadcastSoon('state', () => getState());
|
|
401
501
|
const transcriptWatch = new TranscriptWatch((sessionId) => hub.signal('transcript', { sessionId }), (error) => console.error(`sessions: watching a transcript: ${error instanceof Error ? error.message : String(error)}`));
|
|
402
502
|
const homes = await openAccountHomes(db, process.env);
|
|
503
|
+
/** What the transfer wrote into each account folder's settings.json and each account's own layer (BTN-901), written behind. */
|
|
504
|
+
const accountSettings = new AccountSettings(await loadAccountSettings(db), homes.global.dir, (account, record) => writes.add(`the settings of ${account}`, saveAccountSettings(db, account, record, new Date())));
|
|
505
|
+
homes.useSettings(accountSettings);
|
|
506
|
+
/** The demo on the first run (BTN-776): its account folder is listed from here on, before anything reads the folders. */
|
|
507
|
+
const demo = demoService.wireDemo(context);
|
|
403
508
|
/** The shared pool's Claude entry: whose `.claude.json` and tools the Claude-only checks read. */
|
|
404
509
|
const claudeAccount = () => configStore.current.accounts[CLAUDE];
|
|
405
510
|
/** `.claude.json` files sessions read: the global one and that of a Claude account folder, the shared one by default. */
|
|
@@ -431,6 +536,7 @@ const resumeIn = accountsService.wireResumeIn(context);
|
|
|
431
536
|
const stopIn = accountsService.wireStopIn(context);
|
|
432
537
|
const startedAt = new Date().toISOString();
|
|
433
538
|
const tasksByProject = new Map();
|
|
539
|
+
const parentsByProject = new Map();
|
|
434
540
|
const refreshers = new Map();
|
|
435
541
|
let sessions = [];
|
|
436
542
|
let agents = [];
|
|
@@ -440,6 +546,11 @@ let agents = [];
|
|
|
440
546
|
*/
|
|
441
547
|
let agentsRead = false;
|
|
442
548
|
const lingering = new Lingering();
|
|
549
|
+
/** The worktree folders the cleanup left held before this start, tried again after the first read of the sessions (BTN-925). */
|
|
550
|
+
lingering.restore(await loadLeftFolders(db), {
|
|
551
|
+
save: (folder) => writes.add(`the left folder ${folder.path}`, saveLeftFolder(db, folder)),
|
|
552
|
+
drop: (path) => writes.add(`the settled left folder ${path}`, dropLeftFolder(db, path)),
|
|
553
|
+
});
|
|
443
554
|
const launches = await readLaunches(db);
|
|
444
555
|
/** The tasks the chain ran and saw closed, in memory as the database keeps them. */
|
|
445
556
|
const archive = await closedTasks(db);
|
|
@@ -450,7 +561,7 @@ const trackers = trackersService.wireTrackers(context);
|
|
|
450
561
|
* The remote's CI token from the project's explicit choice or the automatic profile of its forge and host.
|
|
451
562
|
*/
|
|
452
563
|
const ciTokenOf = (project, target) => ciToken(target, profiles.current(), project, configStore.current.trackers[project], configStore.current.settings[project]?.remoteProfiles);
|
|
453
|
-
const protectionAudit = new ProtectionAudit({ config: () => configStore.current, git: runGit, token: (project, target) => ciTokenOf(project, target)?.token ?? null, gitlabUrls: () => gitlabUrls(profiles.current().profiles), changed: stateChanged });
|
|
564
|
+
const protectionAudit = new ProtectionAudit({ config: () => ({ ...configStore.current, projects: gitProjects(configStore.current) }), git: runGit, token: (project, target) => ciTokenOf(project, target)?.token ?? null, gitlabUrls: () => gitlabUrls(profiles.current().profiles), changed: stateChanged });
|
|
454
565
|
/** The remotes whose CI takes the profile's token, shown or not. */
|
|
455
566
|
const ciOn = (profileId, hidden) => ciWatches
|
|
456
567
|
.places(hidden)
|
|
@@ -458,6 +569,13 @@ const ciOn = (profileId, hidden) => ciWatches
|
|
|
458
569
|
.map(({ project, target }) => ({ project, remote: target.remote }));
|
|
459
570
|
const pullRefusals = new PullRefusals();
|
|
460
571
|
const remotes = new ProjectRemotes(runGit);
|
|
572
|
+
const gitFound = new GitFound({
|
|
573
|
+
git: runGit,
|
|
574
|
+
gitStarts: () => (gitSetup.view()?.version ?? null) !== null,
|
|
575
|
+
folders: () => plainProjects(configStore.current),
|
|
576
|
+
label: (project) => projectLabel(configStore.current, project),
|
|
577
|
+
});
|
|
578
|
+
gitFound.changed = stateChanged;
|
|
461
579
|
const ciWatches = chainService.wireCiWatches(context);
|
|
462
580
|
/** The setting; an installation from before it that has not chosen keeps what Tally already ran on (BTN-247). */
|
|
463
581
|
const tallyMode = () => configStore.current.tally ?? inferredTallyMode(process.env, existsSync(join(stateDir, 'tally', 'pgdata')));
|
|
@@ -484,7 +602,33 @@ const homeOf = (key) => {
|
|
|
484
602
|
return home;
|
|
485
603
|
};
|
|
486
604
|
const reach = accountsService.wireReach(context);
|
|
487
|
-
|
|
605
|
+
/**
|
|
606
|
+
* The real spend of chain sessions on an OpenRouter key, by its `usage` (BTN-860); the same read tells the account card
|
|
607
|
+
* what is left of the key's own limit (BTN-847), and the account's balance is read beside it (BTN-868).
|
|
608
|
+
*/
|
|
609
|
+
const keySpend = new KeySpend({
|
|
610
|
+
metered: (key) => {
|
|
611
|
+
const home = homes.find(key);
|
|
612
|
+
if (home === undefined || home.agent !== OPENCODE || home.global)
|
|
613
|
+
return false;
|
|
614
|
+
const apiKey = homes.apiKeyOf(home);
|
|
615
|
+
return apiKey !== null && keyVendor(apiKey) === 'openrouter';
|
|
616
|
+
},
|
|
617
|
+
read: async (key) => {
|
|
618
|
+
const home = homes.find(key);
|
|
619
|
+
const apiKey = home === undefined ? null : homes.apiKeyOf(home);
|
|
620
|
+
account.readBalance(key).catch((error) => console.error(`account: the balance of ${key}: ${error instanceof Error ? error.message : String(error)}`));
|
|
621
|
+
const read = apiKey === null ? null : await readOpenRouterKey(apiKey, KEY_SPEND_TIMEOUT_MS);
|
|
622
|
+
if (read !== null)
|
|
623
|
+
account.noteKeyLimit(key, read.limit);
|
|
624
|
+
return read?.usage ?? null;
|
|
625
|
+
},
|
|
626
|
+
onSpend: (growth) => writes.add(`the key spend of session ${growth.sessionId}`, saveKeySpend(db, growth)),
|
|
627
|
+
now: () => Date.now(),
|
|
628
|
+
tailMs: KEY_SPEND_TAIL_MS,
|
|
629
|
+
pollMs: KEY_SPEND_POLL_MS,
|
|
630
|
+
});
|
|
631
|
+
const online = (home) => reach.up(providerUrl(home.agent, home.agent === OPENCODE ? homes.apiKeyOf(home) : null));
|
|
488
632
|
const { spendsByKey, limitRetries, retryAfterLimit } = limitRecovery({
|
|
489
633
|
homeOf: (key) => homes.find(key),
|
|
490
634
|
agentOf,
|
|
@@ -507,7 +651,9 @@ const secrets = accountsService.wireSecrets(context);
|
|
|
507
651
|
const profiles = accountsService.wireProfiles(context);
|
|
508
652
|
hulyClient.changed = stateChanged;
|
|
509
653
|
gitSetup.changed = stateChanged;
|
|
510
|
-
|
|
654
|
+
stepJobs.changed = stateChanged;
|
|
655
|
+
// The folders of projects without git are checked once git's own read tells whether it starts (BTN-1025).
|
|
656
|
+
void gitSetup.check().catch((error) => console.error(`git: could not read its version and identity: ${englishOf(noticeOf(error))}`)).then(() => gitFound.checkAll());
|
|
511
657
|
installForProfiles(profiles.current().profiles);
|
|
512
658
|
/** The tracker refused the credentials of the profile the project runs on: its chain waits (BTN-200). */
|
|
513
659
|
const profileBlock = accountsService.wireProfileBlock(context);
|
|
@@ -527,8 +673,8 @@ const emailAt = accountsService.wireEmailAt(context);
|
|
|
527
673
|
const sessionAccount = accountsService.wireSessionAccount(context);
|
|
528
674
|
/** The account folder `key` (the active one unless given) as the chain judges a launch in it. */
|
|
529
675
|
const accountNow = accountsService.wireAccountNow(context);
|
|
530
|
-
const contextWindows = accountsService.wireContextWindows(context);
|
|
531
|
-
const monitor = accountsService.wireMonitor(context);
|
|
676
|
+
const contextWindows = accountsService.wireContextWindows(context, savedWindows);
|
|
677
|
+
const monitor = accountsService.wireMonitor(context, savedSessionWindows);
|
|
532
678
|
const wedgedSessions = new Set();
|
|
533
679
|
function logStartupDialogs(views) { return accountsService.logStartupDialogs(context, views); }
|
|
534
680
|
const liveView = accountsService.wireLiveView(context);
|
|
@@ -537,6 +683,30 @@ const steering = accountsService.wireSteering(context);
|
|
|
537
683
|
/** A session just resumed is mid-turn until the daemon shows it working, which lags the resume by seconds (BTN-307). */
|
|
538
684
|
const agentStatus = accountsService.wireAgentStatus(context);
|
|
539
685
|
const knownTask = (task) => [...tasksByProject.values()].flat().find((each) => each.id === task);
|
|
686
|
+
/** The first look at a project that read run labels before BTN-983 moves them into runs, once its tasks are listed. */
|
|
687
|
+
const moveRunLabels = (project) => {
|
|
688
|
+
const tasks = tasksByProject.get(project);
|
|
689
|
+
if (tasks === undefined)
|
|
690
|
+
return;
|
|
691
|
+
const moved = taskRuns.importLabels(project, tasks);
|
|
692
|
+
if (moved.length > 0)
|
|
693
|
+
console.log(`run labels moved into runs: ${moved.join(', ')}`);
|
|
694
|
+
};
|
|
695
|
+
const runOfTask = (project, task) => {
|
|
696
|
+
if (project === undefined)
|
|
697
|
+
return undefined;
|
|
698
|
+
moveRunLabels(project);
|
|
699
|
+
return taskRuns.of(project, task);
|
|
700
|
+
};
|
|
701
|
+
const runsOfProject = (project) => {
|
|
702
|
+
moveRunLabels(project);
|
|
703
|
+
return taskRuns.ofProject(project);
|
|
704
|
+
};
|
|
705
|
+
/** The page's card and the tasks server set a run; a live session keeps what it started on. */
|
|
706
|
+
const setTaskRun = (project, task, run) => {
|
|
707
|
+
taskRuns.set(project, task, run);
|
|
708
|
+
stateChanged();
|
|
709
|
+
};
|
|
540
710
|
/** A pool entry counts only while its folder exists and belongs to the provider it is filed under. */
|
|
541
711
|
const hasAccount = accountsService.wireHasAccount(context);
|
|
542
712
|
/** What a new session of the task (or of the fix session `task`) runs on, and in which account folder. */
|
|
@@ -617,25 +787,43 @@ const { mailRelay, answerSession } = createChat({
|
|
|
617
787
|
steering,
|
|
618
788
|
steer,
|
|
619
789
|
language: promptLanguage,
|
|
790
|
+
note: taskNote,
|
|
620
791
|
changed: stateChanged,
|
|
621
792
|
log: (line) => console.log(line),
|
|
622
793
|
now: () => new Date(),
|
|
623
794
|
});
|
|
624
795
|
function occupantsOf(slot, task) { return chainService.occupantsOf(context, slot, task); }
|
|
625
796
|
function slotUse(slot, task) { return chainService.slotUse(context, slot, task); }
|
|
626
|
-
function vacateSlot(slot, task) { return chainService.vacateSlot(context, slot, task); }
|
|
627
|
-
function stopTaskSessions(project, repo, task, count) { return chainService.stopTaskSessions(context, project, repo, task, count); }
|
|
797
|
+
function vacateSlot(slot, task, shared = false) { return chainService.vacateSlot(context, slot, task, shared); }
|
|
798
|
+
function stopTaskSessions(project, repo, task, count, shared = false) { return chainService.stopTaskSessions(context, project, repo, task, count, shared); }
|
|
628
799
|
function stopLingering() { return chainService.stopLingering(context); }
|
|
629
800
|
/** What holds a project the page asks to remove: its chain, live sessions of its tasks or in its folders, the places it keeps. */
|
|
630
801
|
function removalFacts(project, repo) { return chainService.removalFacts(context, project, repo); }
|
|
802
|
+
/** The project's main branch and its main checkout as one (BTN-754). */
|
|
803
|
+
const branches = chainService.wireBranches(context);
|
|
631
804
|
const getState = hostingService.wireGetState(context);
|
|
805
|
+
// The README badge (BTN-915): pushed on a state change, and on a timer for its delayed change and its pulse.
|
|
806
|
+
const badges = wireBadges({
|
|
807
|
+
config: () => configStore.current,
|
|
808
|
+
state: getState,
|
|
809
|
+
period: (query) => stats.period(query),
|
|
810
|
+
read: (project) => agentsRead && readerIds(configStore.current, project).every((reader) => readerTasks.has(reader)),
|
|
811
|
+
closed: (project) => archive.filter((each) => each.project === project),
|
|
812
|
+
});
|
|
813
|
+
hub.watch('state', () => void badges.tick(), 2_000);
|
|
814
|
+
setInterval(() => void badges.tick(), 30_000).unref();
|
|
632
815
|
// The chain's switches are Even Keel's setting rows: the page's switches write them, and `onChange` hands them to the dispatcher.
|
|
633
816
|
const SWITCHES = {
|
|
634
817
|
setUnattended: (on) => configStore.saveChainSwitches({ unattended: on }),
|
|
635
818
|
setTrimTools: (on) => configStore.saveChainSwitches({ trimTools: on }),
|
|
636
819
|
};
|
|
820
|
+
// The chain's start reads the checkout, so its card warns of a moved folder before a task's launch refuses (BTN-754).
|
|
821
|
+
const startChain = async (project) => {
|
|
822
|
+
await branches.refresh(project);
|
|
823
|
+
return dispatcher.start(project);
|
|
824
|
+
};
|
|
637
825
|
const chainControl = new Proxy(dispatcher, {
|
|
638
|
-
get: (target, key, receiver) => SWITCHES[key] ?? Reflect.get(target, key, receiver),
|
|
826
|
+
get: (target, key, receiver) => (key === 'start' ? startChain : (SWITCHES[key] ?? Reflect.get(target, key, receiver))),
|
|
639
827
|
});
|
|
640
828
|
let server = hostingService.wireServer(context);
|
|
641
829
|
/** The first answer `read` finds in any account folder. */
|
|
@@ -652,6 +840,11 @@ async function inHomes(read) {
|
|
|
652
840
|
* project, or on one Linear team, share a prefix that is not their key (BTN-172); a feed's ids name its project (BTN-66).
|
|
653
841
|
*/
|
|
654
842
|
function configuredProject(task) { return trackersService.configuredProject(context, task); }
|
|
843
|
+
/** The handoff note a session of the task writes: one of its own in a project without git, whose folder is shared (BTN-964). */
|
|
844
|
+
function taskNote(task) {
|
|
845
|
+
const project = configuredProject(task);
|
|
846
|
+
return noteFileOf(task, project === undefined || !isPlain(configStore.current, project));
|
|
847
|
+
}
|
|
655
848
|
const postedQuestions = await loadQuestions(db);
|
|
656
849
|
const questions = trackersService.wireQuestions(context);
|
|
657
850
|
/** A project with `intakeLabel` on a tracker other than GitHub takes in the issues of its first github.com remote, on the token its CI takes. */
|
|
@@ -662,9 +855,12 @@ setInterval(() => void questions.tick(), 15_000).unref();
|
|
|
662
855
|
setInterval(() => settleMail(mailRelay), 15_000).unref();
|
|
663
856
|
setInterval(() => dispatcher.check(), LIMIT_CHECK_MS).unref();
|
|
664
857
|
setInterval(() => void keepWarm.check(), KEEP_WARM_TICK_MS).unref();
|
|
858
|
+
setInterval(sweepFiles, SWEEP_EVERY_MS).unref();
|
|
859
|
+
setInterval(() => writes.add('the vacuum', vacuumDatabase(db)), VACUUM_EVERY_MS).unref();
|
|
860
|
+
backups.start();
|
|
665
861
|
setInterval(() => void cliChecks.check(), cliCheckService.CLI_CHECK_TICK_MS).unref();
|
|
666
862
|
setInterval(() => void dispatcher.pollReviews().catch((error) => console.error(`review: the poll failed: ${englishOf(noticeOf(error))}`)), 60_000).unref();
|
|
667
|
-
const applyCi = () => void Promise.all([ciWatches.apply(configStore.current
|
|
863
|
+
const applyCi = () => void Promise.all([ciWatches.apply(gitProjects(configStore.current)), remotes.apply(gitProjects(configStore.current))]).then(() => {
|
|
668
864
|
dispatcher.check();
|
|
669
865
|
stateChanged();
|
|
670
866
|
});
|
|
@@ -684,7 +880,7 @@ const pollWorks = () => {
|
|
|
684
880
|
};
|
|
685
881
|
pollWorks();
|
|
686
882
|
setInterval(pollWorks, WORK_TICK_MS).unref();
|
|
687
|
-
setInterval(() => void Promise.all([ciWatches.refresh(), remotes.apply(configStore.current
|
|
883
|
+
setInterval(() => void Promise.all([ciWatches.refresh(), remotes.apply(gitProjects(configStore.current))]).then(([changed, moved]) => {
|
|
688
884
|
if (changed || moved)
|
|
689
885
|
dispatcher.check();
|
|
690
886
|
if (changed || moved)
|
|
@@ -139,12 +139,14 @@ const SHELL_HANG_MS = 60 * 60_000;
|
|
|
139
139
|
* The status the chain goes by. A session in `shell` waits for its own background command (a long build or test run)
|
|
140
140
|
* and counts as busy; after an hour without a line in its transcript the command is taken for hung and the session for idle.
|
|
141
141
|
* A turn that ended on a limit has nothing to continue with when the command ends, so such a session is idle at once.
|
|
142
|
+
* So has a turn that ended on a mark the chain answers by handing the task over or opening its pull request (`marked`):
|
|
143
|
+
* nobody needs the command's output (BTN-959).
|
|
142
144
|
* A turn the CLI marked `blocked` ended on the user (a `Monitor` watching for a button they are to press): it waits.
|
|
143
145
|
*/
|
|
144
|
-
export function turnStatus(status, lastActivityAt, now, limit = false, blocked = false) {
|
|
146
|
+
export function turnStatus(status, lastActivityAt, now, limit = false, blocked = false, marked = false) {
|
|
145
147
|
if (status !== 'shell')
|
|
146
148
|
return status;
|
|
147
|
-
if (limit)
|
|
149
|
+
if (limit || marked)
|
|
148
150
|
return 'idle';
|
|
149
151
|
if (blocked)
|
|
150
152
|
return 'waiting';
|
|
@@ -152,6 +154,12 @@ export function turnStatus(status, lastActivityAt, now, limit = false, blocked =
|
|
|
152
154
|
return 'busy';
|
|
153
155
|
return now.getTime() - Date.parse(lastActivityAt) >= SHELL_HANG_MS ? 'idle' : 'busy';
|
|
154
156
|
}
|
|
157
|
+
/** The wait of a session with a `working` lamp in `shell`; `null` for any other. */
|
|
158
|
+
export function backgroundWait(agent, lamp, lastActivityAt, command) {
|
|
159
|
+
if (agent?.status !== 'shell' || lamp !== 'working')
|
|
160
|
+
return null;
|
|
161
|
+
return { command, hangsAt: lastActivityAt === null ? null : new Date(Date.parse(lastActivityAt) + SHELL_HANG_MS).toISOString() };
|
|
162
|
+
}
|
|
155
163
|
function isAgentEntry(value) {
|
|
156
164
|
if (typeof value !== 'object' || value === null)
|
|
157
165
|
return false;
|
|
@@ -9,7 +9,7 @@ const CLOSED_MS = 30 * 60_000;
|
|
|
9
9
|
/** Its dialog is the question itself, read and answered as one: a hook of a plugin before 0.11.2 still asks about it. */
|
|
10
10
|
const ASK_TOOL = 'AskUserQuestion';
|
|
11
11
|
/**
|
|
12
|
-
* The tool calls Claude sessions of the chain wait to have approved (BTN-269). The `
|
|
12
|
+
* The tool calls Claude sessions of the chain wait to have approved (BTN-269). The `agent-bridge` plugin's
|
|
13
13
|
* `PermissionRequest` hook asks about its call every second while the CLI shows its dialog; the oldest call not yet
|
|
14
14
|
* decided is the session's question on the page, and the answer to it is handed to the hook's next poll. The CLI
|
|
15
15
|
* leaves the hook running when the dialog is answered elsewhere (Remote Control), so a call of a session seen no
|