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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "even-keel",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.0-rc.2",
|
|
4
4
|
"description": "Runs Claude Code sessions over a tracker's tasks one after another, in the order of their blocks relations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,12 @@
|
|
|
40
40
|
"dev:fake": "vite --config web/vite.config.ts --mode fake",
|
|
41
41
|
"build": "tsc -p tsconfig.json && tsx scripts/copy-assets.ts && tsc -p web/tsconfig.json && vite build --config web/vite.config.ts",
|
|
42
42
|
"prepack": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && npm run build",
|
|
43
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p web/tsconfig.json && tsc -p tally/tsconfig.json",
|
|
44
|
-
"test": "vitest run
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p web/tsconfig.json && tsc -p tally/tsconfig.json && tsc -p packages/badge/worker.tsconfig.json",
|
|
44
|
+
"test": "vitest run",
|
|
45
45
|
"test:e2e": "vitest run src/e2e/",
|
|
46
|
-
"test:
|
|
46
|
+
"test:cli": "vitest run src/e2e-cli/",
|
|
47
|
+
"test:trackers": "vitest run src/e2e-trackers/",
|
|
48
|
+
"test:all": "vitest run --mode all --exclude \"src/e2e-cli/**\" --exclude \"src/e2e-trackers/**\"",
|
|
47
49
|
"tally": "tsx tally/src/main.ts",
|
|
48
50
|
"shot": "tsx scripts/shot.ts",
|
|
49
51
|
"storage": "tsx scripts/storage.ts",
|
|
@@ -60,11 +62,22 @@
|
|
|
60
62
|
"@hcengineering/rank": "0.7.423",
|
|
61
63
|
"@hcengineering/text-core": "0.7.423",
|
|
62
64
|
"@hcengineering/text-markdown": "0.7.423",
|
|
65
|
+
"@tiptap/core": "3.32.2",
|
|
66
|
+
"@tiptap/extension-code": "3.32.2",
|
|
67
|
+
"@tiptap/extension-code-block": "3.32.2",
|
|
68
|
+
"@tiptap/extension-list": "3.32.2",
|
|
69
|
+
"@tiptap/extension-table": "3.32.2",
|
|
70
|
+
"@tiptap/extensions": "3.32.2",
|
|
71
|
+
"@tiptap/markdown": "3.32.2",
|
|
72
|
+
"@tiptap/pm": "3.32.2",
|
|
73
|
+
"@tiptap/react": "3.32.2",
|
|
74
|
+
"@tiptap/starter-kit": "3.32.2",
|
|
63
75
|
"@types/node": "^24.19.0",
|
|
64
76
|
"@types/pg": "^8.23.1",
|
|
65
77
|
"@types/react": "^19.3.0",
|
|
66
78
|
"@types/react-dom": "^19.3.0",
|
|
67
79
|
"@vitejs/plugin-react": "^6.1.1",
|
|
80
|
+
"happy-dom": "21.0.4",
|
|
68
81
|
"playwright": "^1.64.1",
|
|
69
82
|
"react": "^19.3.0",
|
|
70
83
|
"react-dom": "^19.3.0",
|
|
@@ -73,10 +86,13 @@
|
|
|
73
86
|
"rehype-raw": "^7.0.0",
|
|
74
87
|
"rehype-sanitize": "^6.0.0",
|
|
75
88
|
"remark-gfm": "^4.0.1",
|
|
89
|
+
"remark-parse": "11.0.0",
|
|
76
90
|
"tsx": "^4.23.15",
|
|
77
91
|
"typescript": "^5.9.3",
|
|
92
|
+
"unified": "11.0.5",
|
|
78
93
|
"vite": "^8.3.5",
|
|
79
|
-
"vitest": "^5.0.5"
|
|
94
|
+
"vitest": "^5.0.5",
|
|
95
|
+
"yaml": "^2.9.1"
|
|
80
96
|
},
|
|
81
97
|
"dependencies": {
|
|
82
98
|
"@electric-sql/pglite": "^0.5.8",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-bridge",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Bridge between agent sessions and Even Keel: context handoffs, chat messages mid-turn, permission questions, checks before merges, project standards, badge status and MCP schema hints. Context checkpoints for Even Keel chain sessions of Claude Code, Codex and OpenCode: once the context passes 200k tokens (and every 50k after, every 25k past 250k), the session is asked to write a handoff note and end its turn with `CHECKPOINT: <path>`, so that Even Keel continues the task in a fresh session instead of re-reading the whole context on every turn. A session that writes the note but forgets the line is sent back to add it. In a project without git, where every task shares one folder, the note is the task's own `.temp/handoff-<task>.md` instead of `.temp/handoff.md`. The context and the note come from Even Keel, which reads the transcripts of both agents, so a session it did not start is left alone. The first threshold is the project's calibrated one, and a task that has had three handoffs is asked only from 300k; on a small context window the late and hard thresholds come down to 85 % and 95 % of it. A project that turns handoffs by context off in Even Keel gets no nudge at all and is left to the agent's own compaction. Thresholds: CHECKPOINT_FIRST_TOKENS, CHECKPOINT_STEP_TOKENS, CHECKPOINT_LATE_TOKENS, CHECKPOINT_LATE_STEP_TOKENS, CHECKPOINT_HARD_TOKENS and CHECKPOINT_MAX_HANDOFFS. In a chain session of a project without a CI to judge its main branch, the merge of the task branch waits for the project's check commands from Even Keel and is blocked while they fail. In a session of a project added to Even Keel without git, a shell call of git is refused, also inside a compound command, behind a wrapper or in another shell. While the project's Protection refuses requests to Even Keel's own address, a shell command that sends one (curl, wget, Invoke-WebRequest, node or python with the address) is refused too. A message the user writes from Even Keel's chat to a working session reaches it mid-turn: before or after its next tool call, at its stop (the turn goes on), or in place of a question it was about to ask. With the same call Even Keel may add a note of its own to a tool call's context: for a project that publishes a README badge, a request for one `status: …` line in the session's next message. A tool call Claude Code stops on a permission dialog for is asked on Even Keel's page too, and the user's \"Allow\" or \"Deny\" there answers the dialog without stopping the session. An MCP call Claude Code made before loading the tool's schema, whose numbers or lists went as strings and failed the server's validation, gets a hint in the context: load the schema with ToolSearch and repeat the call. A project's standards, set on Even Keel's page (a document of the repository and the files it guards): the first read of a guarded file brings the document into the context, the first edit of one before that is refused with the document, a compaction brings it again, and a standard that asks for it holds the merge (in PR mode, the PULL REQUEST mark) of a branch that changed its files until `.temp/shot/` has shots newer than the change and `.temp/<document>-check.md` answers each question of the document's section \"The check\". OpenCode sessions get the nudges and the chat's messages after each tool call, the standards, the merge check and the CHECKPOINT line from the plugin's OpenCode plugin (opencode/agent-bridge.mjs): a turn that wrote the note gets the line added to its last text instead of being sent back.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Even Keel"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"context",
|
|
10
|
+
"checkpoint",
|
|
11
|
+
"handoff",
|
|
12
|
+
"even-keel",
|
|
13
|
+
"hook",
|
|
14
|
+
"bridge"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# agent-bridge
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A bridge between an agent session and Even Keel: context handoffs, chat messages mid-turn, permission questions, the check before a merge, project standards, badge status and MCP schema hints.
|
|
4
|
+
|
|
5
|
+
Context handoffs keep long sessions cheap. Every turn re-reads the whole context, so a session that goes through a loop of checks (test runs, debugging, screenshots) or the wrap-up (docs, review, merge) with a big context pays for it again and again. A fresh session that starts from a short note costs a fraction of that.
|
|
4
6
|
|
|
5
7
|
The hooks work in Even Keel's chain sessions of Claude Code and Codex, and of OpenCode through a plugin of its own (see [OpenCode](#opencode)): they read no transcript and ask Even Keel, which reads every agent's (`EVEN_KEEL_URL`, by default `http://127.0.0.1:4747`). A session Even Keel did not start, or no Even Keel at all, and they stay silent.
|
|
6
8
|
|
|
@@ -10,6 +12,8 @@ After every tool call the hook asks Even Keel for the size of the main thread's
|
|
|
10
12
|
CHECKPOINT: .temp/handoff.md
|
|
11
13
|
```
|
|
12
14
|
|
|
15
|
+
In a project without git every task works in the project's one folder, so each task gets a note of its own, `.temp/handoff-<task>.md` (characters of the task outside `A-Z a-z 0-9 . _ -` become `-`); Even Keel's `/checkpoint` answer names it in `note`, and the nudge and the mark use that name.
|
|
16
|
+
|
|
13
17
|
The first nudge lets the session pick the moment: before a loop of checks or the wrap-up, not in the middle of a change that does not build yet or of a step that needs what is loaded. Sessions used that last clause to carry on through every nudge, so the later ones drop it: checkpoint now or as soon as the current change builds, unless all that is left is the merge and the final report. Subagents are not nudged.
|
|
14
18
|
|
|
15
19
|
Sessions sometimes write the note and then close the turn with a report, without the line. A second hook, on `Stop`, catches that: if the last line of the last message is not the mark and Even Keel says `.temp/handoff.md` was written or edited among the last three tool calls of the turn (`/api/sessions/<id>/note`), it sends the session back to reply with the line alone. It asks once per stop, so a session that still refuses is let go.
|
|
@@ -26,7 +30,7 @@ A project that turns **handoffs by context** off in Even Keel (`contextHandoffs`
|
|
|
26
30
|
|
|
27
31
|
Even Keel knows the context as of its last poll of the session, a few seconds back, so a nudge may come one tool call late. A session never waits for an answer longer than two seconds (five on `Stop`).
|
|
28
32
|
|
|
29
|
-
Even Keel takes it from there: it stops the session and starts a new one in the same worktree with a handoff prompt that points at the note (see [Handoffs](../../docs/guide/
|
|
33
|
+
Even Keel takes it from there: it stops the session and starts a new one in the same worktree with a handoff prompt that points at the note (see [Handoffs](../../docs/guide/sessions.md#handoffs) in Even Keel's guide). Outside a chain the line is just the end of a turn — start a new session yourself and give it the note.
|
|
30
34
|
|
|
31
35
|
## The check before the merge
|
|
32
36
|
|
|
@@ -34,6 +38,14 @@ A third hook, on `PreToolUse` of Bash, guards the merge of a chain session. When
|
|
|
34
38
|
|
|
35
39
|
The refusal is an explicit `permissionDecision: deny`, which also blocks nested shell calls from Codex code mode. Codex 0.164.0 was seen to ignore exit code 2 alone for those calls.
|
|
36
40
|
|
|
41
|
+
## Git in a project without git
|
|
42
|
+
|
|
43
|
+
A project added to Even Keel "Without git" works in a folder that may still be a repository or lie inside someone else's. Its sessions get the agent's own deny rules on git from Even Keel; `git-ban.mjs` on `PreToolUse` of the shell tools refuses what those rules miss: git in any part of a compound command (`cd sub && git status`), behind `env`, `sudo` and the like, by its path, and in the text given to another shell (`bash -c "git …"`). A command that only names git (`grep git`, `cat .git/config`) goes through. The hook asks Even Keel (`/api/sessions/<id>/check`, `git: false`) only for a command that calls git, and stays silent for a project with git, a session Even Keel did not start and without Even Keel.
|
|
44
|
+
|
|
45
|
+
## Even Keel's own address
|
|
46
|
+
|
|
47
|
+
Even Keel lets a request from its own machine through without the page's token, so a chain session could change Protection or answer for the user with a plain `curl`. While the project's Protection group "Requests to Even Keel's address" is on, the same `git-ban.mjs` (and OpenCode's plugin) refuses a shell command that names the service's address — `localhost`, `127.x.x.x`, `[::1]`, `0.0.0.0` or the host of `EVEN_KEEL_URL` with its port, or `EVEN_KEEL_URL` itself — together with a network tool (`curl`, `wget`, `Invoke-WebRequest`, `irm`, `node`, `python` and the like, `fetch(`, `WebClient`). `grep 127.0.0.1:4747` alone goes through. The hook asks Even Keel (`/check`, `ownAddress: true`) only for such a command. A script the session wrote or an address built in a string gets past it: a guardrail, not a sandbox.
|
|
48
|
+
|
|
37
49
|
## Messages from the chat
|
|
38
50
|
|
|
39
51
|
A message the user writes from Even Keel's chat window to a session in the middle of a turn waits in Even Keel's mailbox; the fourth hook, `mailbox.mjs`, takes it (`POST /api/sessions/<id>/mail` with the event) and hands it to the session without stopping it:
|
|
@@ -42,6 +54,8 @@ A message the user writes from Even Keel's chat window to a session in the middl
|
|
|
42
54
|
- on `Stop` — the stop is blocked with the message as its reason, and the turn goes on;
|
|
43
55
|
- on `PreToolUse` of `AskUserQuestion` — the question is turned down with the message, and the session asks again only if it still needs to.
|
|
44
56
|
|
|
57
|
+
The same answer may hold a note of Even Keel's own (`context`), which the hook adds to the context of a tool call only, after the message: for a project that publishes a README badge, a request for one `status: …` line in the session's next message, at most every two minutes. Even Keel reads the line from the transcript; no tool is called for it.
|
|
58
|
+
|
|
45
59
|
Each message comes inside `<even-keel-message id="N">…</even-keel-message>`, so the chat shows it as the user's message. The hook says nothing in a subagent (the message waits for the main thread), for a session Even Keel did not start, or when Even Keel does not answer within two seconds (five on `Stop`). Even Keel counts a session as listening only once its hook has asked: a session of an older version of the plugin is answered only between turns.
|
|
46
60
|
|
|
47
61
|
## Permission dialogs
|
|
@@ -54,9 +68,9 @@ Claude Code defers MCP tools: until a session loads a tool's schema with `ToolSe
|
|
|
54
68
|
|
|
55
69
|
## OpenCode
|
|
56
70
|
|
|
57
|
-
OpenCode runs no hook commands: its hooks are JS plugins loaded into its own process. Even Keel loads every script of this plugin's `opencode/` folder into a chain session's config, and `opencode/
|
|
71
|
+
OpenCode runs no hook commands: its hooks are JS plugins loaded into its own process. Even Keel loads every script of this plugin's `opencode/` folder into a chain session's config, and `opencode/agent-bridge.mjs` does after each tool call what `context-checkpoint.mjs` and `mailbox.mjs` do on `PostToolUse` (both ask Even Keel through `hooks/evenkeel.mjs`). OpenCode has no way into the context in the middle of a turn but the tool's result, so the nudge and the chat's messages come after the tool's output, each in a `<system-reminder>` block; a delivered message is also kept in the call's metadata, where Even Keel's chat finds it (a tool that prints the mark from a file fakes no message). A subagent runs in a session of its own, which Even Keel does not know, so it is left alone.
|
|
58
72
|
|
|
59
|
-
The merge check
|
|
73
|
+
The ban on git of a project without git (`gitRefusal` in `hooks/gitban.mjs`) and the merge check run on `tool.execute.before` of the `bash` tool; the check has the same rules as the hook (`mergeRefusal` in `hooks/merges.mjs`), the worktree being the session's folder: the commands run asynchronously, so OpenCode's process is not blocked while they run, and a failed one throws, which keeps the call from running and gives the session the same text as its error.
|
|
60
74
|
|
|
61
75
|
`opencode run` has no stop that a plugin can block: the turn ends on the session's first idle, and a prompt sent from inside a hook hung the turn. So the stop guard works the other way round: once the session has written `.temp/handoff.md` (`write`, `edit`), for the next three tool calls each text part that completes (`experimental.text.complete`) is checked as the `Stop` hook checks the last message — no mark on its last line and Even Keel's `/note` says yes — and gets the line `CHECKPOINT: .temp/handoff.md` added at its end. The session is not asked anything; the transcript Even Keel reads ends with the line. A text followed by more tool calls in the same step gets the line too, which does no harm: Even Keel reads only the turn's last message.
|
|
62
76
|
|
|
@@ -78,7 +92,7 @@ Keep `.temp/` in the project's `.gitignore`, or the note ends up in a commit.
|
|
|
78
92
|
| `CHECKPOINT_LATE_STEP_TOKENS` | `25000` | a new nudge every this many tokens past `CHECKPOINT_LATE_TOKENS` |
|
|
79
93
|
| `CHECKPOINT_HARD_TOKENS` | `300000` | context size of the first nudge for a task that has had its handoffs |
|
|
80
94
|
| `CHECKPOINT_MAX_HANDOFFS` | `3` | handoffs of a task after which nudges wait for `CHECKPOINT_HARD_TOKENS` |
|
|
81
|
-
| `EVEN_KEEL_URL` | `http://127.0.0.1:4747` | where the hook asks Even Keel |
|
|
95
|
+
| `EVEN_KEEL_URL` | `http://127.0.0.1:4747` | where the hook asks Even Keel; Even Keel sets it for its own sessions to the address it listens on |
|
|
82
96
|
|
|
83
97
|
Put them into the environment the sessions run with. Set the first nudge well below the size where the CLI compacts the context. A step that would land less than a late step before `CHECKPOINT_LATE_TOKENS` is skipped, so two nudges do not come one right after the other.
|
|
84
98
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Whether a shell command sends a request to Even Keel's own address, and what a session is told when the project's
|
|
2
|
+
// Protection group "Even Keel's address" (`ownAddress`, BTN-1127) is on. The service lets a request from this machine
|
|
3
|
+
// through without the page's token, so a chain session under someone else's text could change Protection, answer for
|
|
4
|
+
// the user or write to another project's tasks. A pattern guardrail, not a sandbox: a script the session wrote, an
|
|
5
|
+
// address built in a string or the machine's own network address go past it.
|
|
6
|
+
|
|
7
|
+
const DEFAULT_URL = "http://127.0.0.1:4747";
|
|
8
|
+
const NETWORK_TOOLS = new Set(["curl", "wget", "invoke-webrequest", "iwr", "invoke-restmethod", "irm", "http", "https", "xh", "nc", "ncat", "telnet", "node", "python", "python3", "py", "deno", "bun"]);
|
|
9
|
+
const NETWORK_CALLS = /fetch\s*\(|webclient|httpclient|urllib|requests\.|http\.(get|request)\b|socket/i;
|
|
10
|
+
const URL_VARIABLE = /\bEVEN_KEEL_URL\b/;
|
|
11
|
+
|
|
12
|
+
const escaped = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13
|
+
|
|
14
|
+
function serviceOf(url) {
|
|
15
|
+
try {
|
|
16
|
+
const parsed = new URL(url || DEFAULT_URL);
|
|
17
|
+
return { host: parsed.hostname, port: parsed.port || (parsed.protocol === "https:" ? "443" : "80") };
|
|
18
|
+
} catch {
|
|
19
|
+
return serviceOf(DEFAULT_URL);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The service's address in `text`: by a loopback name or the host Even Keel gives, with its port, or as `EVEN_KEEL_URL`. */
|
|
24
|
+
function namesAddress(text, url) {
|
|
25
|
+
if (URL_VARIABLE.test(text)) return true;
|
|
26
|
+
const { host, port } = serviceOf(url);
|
|
27
|
+
const hosts = ["localhost", "127(?:\\.\\d{1,3}){3}", "\\[::1\\]", "0\\.0\\.0\\.0", escaped(host)];
|
|
28
|
+
return new RegExp(`(?<![\\w.-])(?:${hosts.join("|")}):${port}(?!\\d)`, "i").test(text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A network tool in the place of any word, by any path and as `.exe`, or a request made in code given to an interpreter. */
|
|
32
|
+
function usesNetwork(text) {
|
|
33
|
+
if (NETWORK_CALLS.test(text)) return true;
|
|
34
|
+
return text
|
|
35
|
+
.split(/[\s;|&(){}`'"]+/)
|
|
36
|
+
.map((word) => word.split(/[\\/]/).pop().toLowerCase().replace(/\.exe$/, ""))
|
|
37
|
+
.some((word) => NETWORK_TOOLS.has(word));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* `command` names the service's address (`url`, `EVEN_KEEL_URL` of the hook's process) and a network tool or call:
|
|
42
|
+
* `grep 127.0.0.1:4747` or `echo $EVEN_KEEL_URL` alone is not a request.
|
|
43
|
+
*/
|
|
44
|
+
export function reachesService(command, url) {
|
|
45
|
+
const text = String(command ?? "");
|
|
46
|
+
return text !== "" && namesAddress(text, url) && usesNetwork(text);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const ADDRESS_REFUSAL =
|
|
50
|
+
"Even Keel: this call sends a request to Even Keel's own address, and the project's Protection turns that off, so it did not run. " +
|
|
51
|
+
"A chain session works with its task through the tasks tools; do not retry it through a script or another spelling of the address. " +
|
|
52
|
+
"If the task needs Even Keel's API, say so in your answer: the user can turn off the group \"Even Keel's address\" in the project's Protection.";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The refusal text for `command`, or null: it does not reach the service, the project's group is off, or Even Keel
|
|
56
|
+
* did not answer. `checkOf` asks Even Keel only for a command that reaches it.
|
|
57
|
+
*/
|
|
58
|
+
export async function addressRefusal(command, checkOf, url = process.env.EVEN_KEEL_URL) {
|
|
59
|
+
if (!reachesService(command, url)) return null;
|
|
60
|
+
const check = await Promise.resolve()
|
|
61
|
+
.then(checkOf)
|
|
62
|
+
.catch(() => null);
|
|
63
|
+
return check?.ownAddress === true ? ADDRESS_REFUSAL : null;
|
|
64
|
+
}
|
|
@@ -10,13 +10,14 @@ async function main() {
|
|
|
10
10
|
const input = JSON.parse(readFileSync(0, "utf8"));
|
|
11
11
|
if (!input || input.stop_hook_active || input.agent_id || !input.session_id) return;
|
|
12
12
|
if (typeof input.last_assistant_message !== "string" || hasMark(input.last_assistant_message)) return;
|
|
13
|
-
|
|
13
|
+
const note = await noteAtEnd(input.session_id);
|
|
14
|
+
if (note === null) return;
|
|
14
15
|
process.stdout.write(
|
|
15
16
|
JSON.stringify({
|
|
16
17
|
decision: "block",
|
|
17
18
|
reason:
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
`You wrote \`${note}\` at the end of this turn, but your last message does not end with ` +
|
|
20
|
+
`the line \`CHECKPOINT: ${note}\`, so Even Keel will not hand the task to a fresh session ` +
|
|
20
21
|
"and will wait for a reply instead. Reply with that line alone, nothing before or after it.",
|
|
21
22
|
}),
|
|
22
23
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// What the hooks ask Even Keel about a session, shared by the hook commands of Claude Code, Codex and Copilot and by
|
|
2
|
-
// OpenCode's plugin (../opencode/
|
|
2
|
+
// OpenCode's plugin (../opencode/agent-bridge.mjs): the checkpoint nudge due now, the chat's waiting messages, the
|
|
3
3
|
// check before a merge, the project's standards and whether the turn wrote the handoff note at its end.
|
|
4
4
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
+
import { noteIn } from "./handoff.mjs";
|
|
7
8
|
import { markOf, nudge, planOf } from "./nudges.mjs";
|
|
8
9
|
|
|
9
10
|
export const STATE_DIR = join(tmpdir(), "claude-context-checkpoint");
|
|
@@ -76,14 +77,15 @@ export async function decisionOf(sessionId, tool, input, since) {
|
|
|
76
77
|
/**
|
|
77
78
|
* The project's check before the session merges its task branch, its standards (../hooks/standards.mjs) and the
|
|
78
79
|
* project's main branch (`main` when Even Keel does not name one). No commands — Even Keel did not start this session,
|
|
79
|
-
* the project has none, or a CI will judge main.
|
|
80
|
+
* the project has none, or a CI will judge main. `git: false` — the project's git is off (./gitban.mjs);
|
|
81
|
+
* `ownAddress` — its Protection refuses requests to Even Keel's own address (./addressban.mjs).
|
|
80
82
|
*/
|
|
81
83
|
export async function checkOf(sessionId) {
|
|
82
84
|
const response = await fetch(`${base()}/api/sessions/${encodeURIComponent(sessionId)}/check`, { signal: AbortSignal.timeout(2000) });
|
|
83
|
-
if (!response.ok) return { commands: [], standards: [], main: "main" };
|
|
85
|
+
if (!response.ok) return { commands: [], standards: [], main: "main", git: true, ownAddress: false };
|
|
84
86
|
const body = await response.json();
|
|
85
87
|
const commands = Array.isArray(body?.commands) ? body.commands.filter((command) => typeof command === "string" && command.trim() !== "") : [];
|
|
86
|
-
return { commands, standards: standardsIn(body), main: typeof body?.branch === "string" && body.branch !== "" ? body.branch : "main" };
|
|
88
|
+
return { commands, standards: standardsIn(body), main: typeof body?.branch === "string" && body.branch !== "" ? body.branch : "main", git: body?.git !== false, ownAddress: body?.ownAddress === true };
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
/** Tells Even Keel the project's check before the merge passed on `tree` (EKR-103); a failure is the caller's to swallow. */
|
|
@@ -107,21 +109,36 @@ export async function standardsOf(sessionId) {
|
|
|
107
109
|
return response.ok ? standardsIn(await response.json()) : [];
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* The note the session's turn wrote among its last tool calls, as `.temp/handoff….md`, or null: none, or no Even Keel.
|
|
114
|
+
* Even Keel reads the transcript of any agent; one before BTN-964 names no path, and its note is the shared one.
|
|
115
|
+
*/
|
|
111
116
|
export async function noteAtEnd(sessionId) {
|
|
112
117
|
const response = await fetch(`${base()}/api/sessions/${encodeURIComponent(sessionId)}/note`, { signal: AbortSignal.timeout(5000) });
|
|
113
|
-
|
|
118
|
+
if (!response.ok) return null;
|
|
119
|
+
const answer = await response.json();
|
|
120
|
+
return answer?.note === true ? noteIn(answer.path) : null;
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
/**
|
|
117
|
-
|
|
123
|
+
/**
|
|
124
|
+
* What Even Keel has for the session on `event`: `message` — the text of what waited in the chat, now delivered;
|
|
125
|
+
* `context` — a note of Even Keel's own for the context at a tool call (the request for the README badge's status
|
|
126
|
+
* line). Each null when there is none, both when Even Keel did not start the session.
|
|
127
|
+
*/
|
|
128
|
+
export async function hookMailOf(sessionId, event) {
|
|
118
129
|
const response = await fetch(`${base()}/api/sessions/${encodeURIComponent(sessionId)}/mail`, {
|
|
119
130
|
method: "POST",
|
|
120
131
|
headers: { "content-type": "application/json" },
|
|
121
132
|
body: JSON.stringify({ event }),
|
|
122
133
|
signal: AbortSignal.timeout(5000),
|
|
123
134
|
});
|
|
124
|
-
if (!response.ok) return null;
|
|
125
|
-
const
|
|
126
|
-
|
|
135
|
+
if (!response.ok) return { message: null, context: null };
|
|
136
|
+
const body = await response.json();
|
|
137
|
+
const text = (value) => (typeof value === "string" && value !== "" ? value : null);
|
|
138
|
+
return { message: text(body?.message), context: text(body?.context) };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The text of what waited for the session, now delivered on `event`, or null: nothing waits, or Even Keel did not start it. */
|
|
142
|
+
export async function mailOf(sessionId, event) {
|
|
143
|
+
return (await hookMailOf(sessionId, event)).message;
|
|
127
144
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PreToolUse guard on a shell call: a session of a project whose git is off in Even Keel is refused any call of git,
|
|
3
|
+
// also one the agent's own deny rules miss (a compound command, a wrapper, another shell). Even Keel is asked only
|
|
4
|
+
// when the command calls git. The same hook refuses a request to Even Keel's own address while the project's
|
|
5
|
+
// Protection group `ownAddress` is on (./addressban.mjs, BTN-1127).
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
import { addressRefusal } from "./addressban.mjs";
|
|
8
|
+
import { checkOf } from "./evenkeel.mjs";
|
|
9
|
+
import { gitRefusal } from "./gitban.mjs";
|
|
10
|
+
|
|
11
|
+
function readInput() {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(readFileSync(0, "utf8"));
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function main() {
|
|
20
|
+
const input = readInput();
|
|
21
|
+
if (!input || !input.session_id) return;
|
|
22
|
+
const command = typeof input.tool_input === "string" ? input.tool_input : input.tool_input?.command;
|
|
23
|
+
const check = () => checkOf(input.session_id);
|
|
24
|
+
const text = (await gitRefusal(command, check)) ?? (await addressRefusal(command, check));
|
|
25
|
+
if (text === null) return;
|
|
26
|
+
// An explicit denial: Codex ignores exit code 2 alone for the nested shell calls of code mode.
|
|
27
|
+
process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: text } }));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Even Keel not answering leaves the call to the agent's own rules.
|
|
31
|
+
main().catch(() => {});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Whether a shell command calls git, and what a session of a project whose git is off is told when it does.
|
|
2
|
+
// The agents' native deny rules match the start of a command; this finds git in any part of a compound command,
|
|
3
|
+
// behind a wrapper (`env`, `sudo`) and in the command line given to another shell (`bash -c "git …"`).
|
|
4
|
+
|
|
5
|
+
const SEPARATORS = /&&|\|\||[;|&\n(){}]|\$\(|`/;
|
|
6
|
+
const WRAPPERS = new Set(["env", "sudo", "command", "exec", "time", "nohup", "xargs", "builtin", "call", "start"]);
|
|
7
|
+
const SHELLS = /(^|[\\/])(ba|z|da|k)?sh(\.exe)?$|(^|[\\/])(cmd|pwsh|powershell)(\.exe)?$/i;
|
|
8
|
+
const RUNS_TEXT = new Set(["-c", "-lc", "-ic", "/c", "/k", "-command", "-encodedcommand"]);
|
|
9
|
+
|
|
10
|
+
const unquoted = (token) => token.replace(/^["']+|["']+$/g, "");
|
|
11
|
+
const isGit = (token) => /(^|[\\/])git(\.exe)?$/i.test(unquoted(token));
|
|
12
|
+
|
|
13
|
+
/** The part's words with a quoted path of several words (`"C:\Program Files\Git\cmd\git.exe"`) kept as one. */
|
|
14
|
+
function wordsOf(part) {
|
|
15
|
+
return part.match(/"[^"]*"\S*|'[^']*'\S*|\S+/g) ?? [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function partCallsGit(part) {
|
|
19
|
+
const words = wordsOf(part);
|
|
20
|
+
let at = 0;
|
|
21
|
+
// Before the command itself: `VAR=value`, a wrapper with its options and its own assignments.
|
|
22
|
+
while (at < words.length && (/^[A-Za-z_][A-Za-z0-9_]*=/.test(words[at]) || WRAPPERS.has(words[at].toLowerCase()) || (at > 0 && words[at].startsWith("-")))) {
|
|
23
|
+
// `sudo -u john`: the option's value is not the command.
|
|
24
|
+
if (words[at] === "-u" || words[at] === "-g") at += 1;
|
|
25
|
+
at += 1;
|
|
26
|
+
}
|
|
27
|
+
const command = words[at];
|
|
28
|
+
if (command === undefined) return false;
|
|
29
|
+
if (isGit(command)) return true;
|
|
30
|
+
if (!SHELLS.test(unquoted(command))) return false;
|
|
31
|
+
const text = words.findIndex((word, index) => index > at && RUNS_TEXT.has(word.toLowerCase()));
|
|
32
|
+
return text >= 0 && callsGit(words.slice(text + 1).map(unquoted).join(" "));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* git in the place of a command anywhere in `command`: with any arguments and global options, as `git.exe` or by a
|
|
37
|
+
* path. A command that only names git (`grep git`, `cat .git/config`, `echo "git status"`) is not a call.
|
|
38
|
+
*/
|
|
39
|
+
export function callsGit(command) {
|
|
40
|
+
const text = String(command ?? "");
|
|
41
|
+
if (!/git/i.test(text)) return false;
|
|
42
|
+
// A quoted string is one word of its part, except what a shell is told to run: that is looked into by `partCallsGit`.
|
|
43
|
+
const parts = [];
|
|
44
|
+
let part = "";
|
|
45
|
+
let quote = null;
|
|
46
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
47
|
+
const char = text[index];
|
|
48
|
+
if (quote !== null) {
|
|
49
|
+
part += char;
|
|
50
|
+
if (char === quote) quote = null;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (char === '"' || char === "'") {
|
|
54
|
+
quote = char;
|
|
55
|
+
part += char;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const found = SEPARATORS.exec(text.slice(index, index + 2));
|
|
59
|
+
if (found !== null && found.index === 0) {
|
|
60
|
+
parts.push(part);
|
|
61
|
+
part = "";
|
|
62
|
+
index += found[0].length - 1;
|
|
63
|
+
} else part += char;
|
|
64
|
+
}
|
|
65
|
+
parts.push(part);
|
|
66
|
+
return parts.some(partCallsGit);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const REFUSAL =
|
|
70
|
+
"Even Keel: git is turned off for this project, so this call did not run. " +
|
|
71
|
+
"The project's folder is not a repository of its own: do the task without git, and do not retry it through another shell or a script.";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The refusal text for `command` in a session of a project whose git is off, or null: no git in it, the project has
|
|
75
|
+
* git, or Even Keel did not answer. `checkOf` asks Even Keel only for a command that calls git.
|
|
76
|
+
*/
|
|
77
|
+
export async function gitRefusal(command, checkOf) {
|
|
78
|
+
if (!callsGit(command)) return null;
|
|
79
|
+
const check = await Promise.resolve()
|
|
80
|
+
.then(checkOf)
|
|
81
|
+
.catch(() => null);
|
|
82
|
+
return check?.git === false ? REFUSAL : null;
|
|
83
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Whether a session's last message ends with the CHECKPOINT line; whether its turn wrote the
|
|
2
|
+
// handoff note at its very end is Even Keel's answer (`noteWritten` in src/sessions/note.ts).
|
|
3
|
+
|
|
4
|
+
const MARK = /^[`*_]*CHECKPOINT:[`*_]*\s*[`*_]*([^`*\s][^`*]*?)[`*_]*$/;
|
|
5
|
+
|
|
6
|
+
// The shared note, and a task's own one in a project without git, whose folder every task shares (BTN-964).
|
|
7
|
+
export const NOTE = ".temp/handoff.md";
|
|
8
|
+
const OWN_NOTE = /^\.temp\/handoff(?:-[A-Za-z0-9._-]+)?\.md$/;
|
|
9
|
+
const NOTE_PATH = /(^|\/)\.temp\/handoff(?:-[A-Za-z0-9._-]+)?\.md$/;
|
|
10
|
+
|
|
11
|
+
export function hasMark(text) {
|
|
12
|
+
const last = (text ?? "").trimEnd().split("\n").pop() ?? "";
|
|
13
|
+
return MARK.test(last.trim());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The note Even Keel named, or the shared one when it named none, or anything else: an older Even Keel. */
|
|
17
|
+
export const noteIn = (value) => (typeof value === "string" && OWN_NOTE.test(value) ? value : NOTE);
|
|
18
|
+
|
|
19
|
+
/** Whether a written path is a handoff note, the shared one or a task's own. */
|
|
20
|
+
export const isNotePath = (path) => typeof path === "string" && NOTE_PATH.test(path.replace(/\\/g, "/"));
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
"matcher": "Bash|PowerShell|bash|powershell|shell",
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/git-ban.mjs\"",
|
|
20
|
+
"timeout": 10
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
14
24
|
{
|
|
15
25
|
"matcher": "Edit|Write|MultiEdit|NotebookEdit|apply_patch|edit|create|write|str_replace",
|
|
16
26
|
"hooks": [
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// going; before AskUserQuestion it turns the question down, so that the question does not hang next to an
|
|
5
5
|
// unread message. Subagents are left alone: the message waits for the main thread.
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
|
-
import { contextOutput,
|
|
7
|
+
import { contextOutput, hookMailOf } from "./evenkeel.mjs";
|
|
8
8
|
|
|
9
9
|
function readInput() {
|
|
10
10
|
try {
|
|
@@ -28,8 +28,11 @@ async function main() {
|
|
|
28
28
|
const hookEvent = input.hook_event_name;
|
|
29
29
|
if (hookEvent !== "PreToolUse" && hookEvent !== "PostToolUse" && hookEvent !== "Stop") return;
|
|
30
30
|
const event = hookEvent === "PreToolUse" && input.tool_name === "AskUserQuestion" ? "AskUserQuestion" : hookEvent;
|
|
31
|
-
const message = await
|
|
32
|
-
|
|
31
|
+
const { message, context } = await hookMailOf(input.session_id, event);
|
|
32
|
+
// Even Keel's own note rides only with a tool call's context: it must neither keep a turn going nor turn a question down.
|
|
33
|
+
const note = hookEvent === "Stop" || event === "AskUserQuestion" ? null : context;
|
|
34
|
+
const text = [message, note].filter((each) => each !== null).join("\n\n");
|
|
35
|
+
if (text !== "") process.stdout.write(JSON.stringify(outputOf(hookEvent, event, text)));
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
// No Even Keel, or no answer in time, must never break the tool call or keep the session from stopping.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// When the
|
|
1
|
+
// When the agent-bridge hook nudges and what it says: the thresholds from the environment, what Even Keel
|
|
2
2
|
// answered about the session, and the mark a context size falls on.
|
|
3
|
+
import { NOTE, noteIn } from "./handoff.mjs";
|
|
3
4
|
|
|
4
5
|
const DEFAULTS = { first: 200_000, step: 50_000, late: 250_000, lateStep: 25_000, hard: 300_000, maxHandoffs: 3 };
|
|
5
6
|
const VARIABLES = {
|
|
@@ -29,6 +30,7 @@ export function planOf(env, answer) {
|
|
|
29
30
|
plan.held = plan.handoffs >= plan.maxHandoffs;
|
|
30
31
|
if (plan.held) plan.first = Math.max(plan.first, plan.hard);
|
|
31
32
|
plan.off = answer?.source === "off";
|
|
33
|
+
plan.note = noteIn(answer?.note);
|
|
32
34
|
return plan;
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -39,21 +41,23 @@ export function markOf(context, plan) {
|
|
|
39
41
|
return mark > plan.first && plan.late - mark < plan.lateStep ? mark - plan.step : mark;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
/** `note` — the task's note Even Keel named: one of its own in a project without git (BTN-964). */
|
|
45
|
+
const howOf = (note) =>
|
|
46
|
+
`leave the working tree as it is (no commit needed), write \`${note}\` at the root of ` +
|
|
44
47
|
"the working tree — what is done, what is left, the current hypotheses, what was already tried " +
|
|
45
48
|
"and ruled out, the files and symbols that matter, the exact next command — and end your turn " +
|
|
46
|
-
|
|
49
|
+
`with a final line \`CHECKPOINT: ${note}\`. A fresh session picks the work up from that ` +
|
|
47
50
|
"note at a fraction of the cost.";
|
|
48
51
|
|
|
49
52
|
/** `last` is the mark of the previous nudge, 0 when there was none. */
|
|
50
53
|
export function nudge(context, last, plan) {
|
|
54
|
+
const how = howOf(plan.note ?? NOTE);
|
|
51
55
|
const size = `Context is now ~${Math.round(context / 1000)}k tokens, and every further turn re-reads all of it. `;
|
|
52
56
|
if (last > 0) {
|
|
53
57
|
return (
|
|
54
58
|
size +
|
|
55
59
|
"You were already asked for a checkpoint and carried on. Make it now, or, if the change you " +
|
|
56
|
-
`are in the middle of does not build yet, as soon as it builds: ${
|
|
60
|
+
`are in the middle of does not build yet, as soon as it builds: ${how} ` +
|
|
57
61
|
"That the next step needs what is loaded right now is not a reason to carry on: put what it " +
|
|
58
62
|
"needs into the note. Carry on only if all that is left is the merge and the final report."
|
|
59
63
|
);
|
|
@@ -63,7 +67,7 @@ export function nudge(context, last, plan) {
|
|
|
63
67
|
size +
|
|
64
68
|
`This task has already been handed over ${plan.handoffs} times, and every handoff costs the next ` +
|
|
65
69
|
"session its recovery, so you were not asked for a checkpoint earlier. At this size it pays off " +
|
|
66
|
-
`again: make one now, or, if the change you are in the middle of does not build yet, as soon as it builds: ${
|
|
70
|
+
`again: make one now, or, if the change you are in the middle of does not build yet, as soon as it builds: ${how} ` +
|
|
67
71
|
"Carry on only if all that is left is the merge and the final report."
|
|
68
72
|
);
|
|
69
73
|
}
|
|
@@ -71,7 +75,7 @@ export function nudge(context, last, plan) {
|
|
|
71
75
|
size +
|
|
72
76
|
"If the code for the current step is written and what comes next is a loop of checks " +
|
|
73
77
|
"(repeated test runs, trace-and-fix debugging, engine checks, screenshots) or the wrap-up " +
|
|
74
|
-
`(docs, review, merge), make a checkpoint before it: ${
|
|
78
|
+
`(docs, review, merge), make a checkpoint before it: ${how} ` +
|
|
75
79
|
"If you are in the middle of a change that does not build yet, or the next step needs " +
|
|
76
80
|
"what is loaded right now, carry on and checkpoint at the next stable point instead."
|
|
77
81
|
);
|