even-keel 0.3.4 → 0.4.0-rc.1
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/.env.example +10 -0
- package/CHANGELOG.md +4 -0
- package/README.md +4 -2
- package/dist/src/account/globals.js +3 -3
- package/dist/src/account/homes.js +16 -0
- package/dist/src/account/longToken.js +99 -0
- package/dist/src/account/settingsGuard.js +1 -1
- package/dist/src/account/settingsLayer.js +53 -8
- package/dist/src/account/share.js +12 -3
- package/dist/src/account/tokenAccount.js +53 -0
- package/dist/src/account/watcher-options.js +1 -0
- package/dist/src/account/watcher.js +80 -12
- package/dist/src/agent/copies.js +2 -2
- package/dist/src/agent/copy.js +6 -3
- package/dist/src/agent/npm-global.js +21 -2
- package/dist/src/badge/collect.js +2 -3
- package/dist/src/badge/render.js +115 -34
- package/dist/src/badge/theme.js +17 -0
- package/dist/src/builtin/components.js +86 -0
- package/dist/src/builtin/control.js +70 -2
- package/dist/src/builtin/diff.js +73 -0
- package/dist/src/builtin/editor.js +6 -3
- package/dist/src/builtin/export-store.js +36 -5
- package/dist/src/builtin/export.js +244 -37
- package/dist/src/builtin/files.js +13 -4
- package/dist/src/builtin/history-log.js +40 -0
- package/dist/src/builtin/import-reading.js +125 -0
- package/dist/src/builtin/import-run.js +294 -0
- package/dist/src/builtin/import-store.js +75 -0
- package/dist/src/builtin/import.js +373 -0
- package/dist/src/builtin/milestones.js +116 -0
- package/dist/src/builtin/routes.js +84 -4
- package/dist/src/builtin/source.js +38 -11
- package/dist/src/builtin/store.js +204 -128
- package/dist/src/builtin/switch.js +18 -10
- package/dist/src/builtin/task-rows.js +157 -0
- package/dist/src/builtin/transfer-store.js +62 -0
- package/dist/src/chain/answers.js +14 -11
- package/dist/src/chain/archive-pages.js +44 -0
- package/dist/src/chain/arrange.js +109 -0
- package/dist/src/chain/carry.js +3 -3
- package/dist/src/chain/checkreports.js +9 -0
- package/dist/src/chain/cleanup.js +90 -20
- package/dist/src/chain/dispatcher.js +189 -482
- package/dist/src/chain/handoff-note.js +5 -0
- package/dist/src/chain/handoff-notes.js +44 -0
- package/dist/src/chain/lanes.js +55 -0
- package/dist/src/chain/launches.js +17 -2
- package/dist/src/chain/limit-moves.js +32 -0
- package/dist/src/chain/limitNotice.js +19 -8
- package/dist/src/chain/lists.js +26 -2
- package/dist/src/chain/maincheck.js +49 -10
- package/dist/src/chain/mainci.js +11 -62
- package/dist/src/chain/mainfix.js +114 -25
- package/dist/src/chain/order.js +48 -6
- package/dist/src/chain/outside.js +28 -0
- package/dist/src/chain/pauses.js +33 -3
- package/dist/src/chain/placement.js +113 -0
- package/dist/src/chain/prompts.js +32 -4
- package/dist/src/chain/quiet.js +25 -0
- package/dist/src/chain/relay.js +46 -11
- package/dist/src/chain/restartGuard.js +2 -2
- package/dist/src/chain/reviews.js +12 -7
- package/dist/src/chain/rules.js +14 -0
- package/dist/src/chain/shelved.js +3 -3
- package/dist/src/chain/start.js +7 -7
- package/dist/src/chain/step.js +246 -0
- package/dist/src/chain/store.js +2 -2
- package/dist/src/chain/talk.js +122 -0
- package/dist/src/chain/unchanged.js +8 -8
- package/dist/src/chain/user-message.js +38 -0
- package/dist/src/chats/chats.js +345 -0
- package/dist/src/chats/model.js +115 -0
- package/dist/src/chats/prompt.js +51 -0
- package/dist/src/chats/routes.js +60 -0
- package/dist/src/chats/store.js +101 -0
- package/dist/src/ci/adapters.js +2 -1
- package/dist/src/ci/forgejo-profile.js +2 -2
- package/dist/src/ci/protection-audit.js +2 -1
- package/dist/src/ci/watcher.js +2 -2
- package/dist/src/claude/adapter.js +1 -1
- package/dist/src/claude/cli.js +22 -4
- package/dist/src/claude/listing.js +128 -0
- package/dist/src/claude/login-browser.js +42 -0
- package/dist/src/claude/sdk/registry.js +1 -1
- package/dist/src/cli-args.js +62 -5
- package/dist/src/cli-check/lease.js +2 -1
- package/dist/src/cli-check/run.js +1 -1
- package/dist/src/cli-install.js +44 -0
- package/dist/src/cli.js +111 -36
- package/dist/src/codex/adapter.js +11 -4
- package/dist/src/codex/cli.js +13 -6
- package/dist/src/codex/plugins.js +6 -3
- package/dist/src/codex/rollout.js +51 -43
- package/dist/src/codex/rolloutFiles.js +62 -0
- package/dist/src/codex/tail.js +16 -3
- package/dist/src/codex/turns.js +1 -1
- package/dist/src/codex/usage.js +7 -2
- package/dist/src/config-form.js +36 -6
- package/dist/src/config-store.js +18 -4
- package/dist/src/config.js +15 -3
- package/dist/src/copilot/cli.js +11 -5
- package/dist/src/diagnostics/missing-package.js +9 -0
- package/dist/src/diagnostics/stall-profile.js +99 -0
- package/dist/src/diagnostics/start-watch.js +45 -12
- package/dist/src/dictation/transcribe.js +124 -0
- package/dist/src/event-log/watch.js +28 -3
- package/dist/src/events.js +52 -10
- package/dist/src/fetch-dispatcher.js +11 -0
- package/dist/src/forgejo/api.js +11 -2
- package/dist/src/forgejo/editor.js +1 -1
- package/dist/src/git/diff.js +52 -0
- package/dist/src/git/dirs.js +19 -0
- package/dist/src/git/patterns.js +91 -0
- package/dist/src/git/push.js +63 -0
- package/dist/src/git/remote-head.js +69 -0
- package/dist/src/git/remote-urls.js +47 -0
- package/dist/src/git/slot-clean.js +144 -0
- package/dist/src/git/slot.js +12 -4
- package/dist/src/git/sync.js +49 -12
- package/dist/src/git/work.js +32 -8
- package/dist/src/git/worktree.js +12 -3
- package/dist/src/github/adapter.js +1 -0
- package/dist/src/github/editor.js +2 -0
- package/dist/src/github/import.js +311 -0
- package/dist/src/github/profile.js +1 -1
- package/dist/src/github/source.js +121 -28
- package/dist/src/github/uploads.js +8 -0
- package/dist/src/gitlab/api.js +4 -0
- package/dist/src/gitlab/editor.js +1 -1
- package/dist/src/gitlab/profile.js +1 -1
- package/dist/src/huly/adapter.js +2 -1
- package/dist/src/huly/colors.js +41 -0
- package/dist/src/huly/import-text.js +31 -0
- package/dist/src/huly/import.js +317 -0
- package/dist/src/huly/model.js +10 -3
- package/dist/src/huly/profile.js +1 -1
- package/dist/src/huly/source.js +46 -10
- package/dist/src/huly/transient.js +32 -0
- package/dist/src/intake/intake.js +42 -17
- package/dist/src/intake/model.js +2 -0
- package/dist/src/jira/api.js +4 -0
- package/dist/src/jira/editor.js +1 -1
- package/dist/src/jira/model.js +7 -2
- package/dist/src/jira/profile.js +1 -1
- package/dist/src/jobs/model.js +7 -1
- package/dist/src/jobs/runner.js +25 -7
- package/dist/src/limits/chatgpt.js +9 -0
- package/dist/src/limits/identity.js +51 -0
- package/dist/src/limits/model.js +17 -3
- package/dist/src/limits/polls.js +200 -0
- package/dist/src/limits/token-windows.js +30 -0
- package/dist/src/limits/watcher.js +93 -9
- package/dist/src/linear/adapter.js +1 -0
- package/dist/src/linear/answer.js +27 -0
- package/dist/src/linear/import.js +282 -0
- package/dist/src/linear/profile.js +3 -2
- package/dist/src/linear/source.js +62 -8
- package/dist/src/link/address.js +28 -0
- package/dist/src/link/cert.js +41 -0
- package/dist/src/link/colors.js +20 -0
- package/dist/src/link/hooks.js +30 -0
- package/dist/src/link/hub-server.js +164 -0
- package/dist/src/link/hub-store.js +84 -0
- package/dist/src/link/hub.js +249 -0
- package/dist/src/link/identity.js +20 -0
- package/dist/src/link/local.js +75 -0
- package/dist/src/link/machine-store.js +177 -0
- package/dist/src/link/machine-transport.js +184 -0
- package/dist/src/link/machine.js +402 -0
- package/dist/src/link/protocol.js +77 -0
- package/dist/src/link/view.js +2 -0
- package/dist/src/locations.js +3 -0
- package/dist/src/machine/about.js +53 -0
- package/dist/src/machine/account-here.js +26 -0
- package/dist/src/machine/assignments.js +99 -0
- package/dist/src/machine/brief.js +99 -0
- package/dist/src/machine/chain-machines.js +37 -0
- package/dist/src/machine/config.js +48 -0
- package/dist/src/machine/facts.js +118 -0
- package/dist/src/machine/folder-check.js +103 -0
- package/dist/src/{chain → machine}/handover.js +70 -82
- package/dist/src/machine/hook-receiver.js +124 -0
- package/dist/src/machine/host.js +1 -0
- package/dist/src/machine/join-cli.js +59 -0
- package/dist/src/machine/join.js +96 -0
- package/dist/src/machine/main.js +71 -0
- package/dist/src/machine/marks.js +81 -0
- package/dist/src/machine/move-call.js +42 -0
- package/dist/src/machine/moves.js +210 -0
- package/dist/src/{chain → machine}/overage.js +9 -11
- package/dist/src/machine/own.js +33 -0
- package/dist/src/machine/page.js +74 -0
- package/dist/src/machine/pool.js +100 -0
- package/dist/src/machine/port.js +1 -0
- package/dist/src/machine/reassign.js +30 -0
- package/dist/src/machine/records.js +73 -0
- package/dist/src/machine/remote.js +300 -0
- package/dist/src/machine/runner.js +268 -0
- package/dist/src/machine/services.js +52 -0
- package/dist/src/machine/state.js +54 -0
- package/dist/src/machine/tally.js +65 -0
- package/dist/src/machine/task-moves.js +46 -0
- package/dist/src/machine/tasks.js +165 -0
- package/dist/src/machine-service.js +141 -0
- package/dist/src/main.js +12 -104
- package/dist/src/memory/mcp.js +206 -0
- package/dist/src/memory/mirror.js +142 -0
- package/dist/src/memory/record.js +69 -0
- package/dist/src/memory/store.js +81 -0
- package/dist/src/notice/en-advice.js +7 -0
- package/dist/src/notice/en-review.js +3 -0
- package/dist/src/notice/en-transfer.js +30 -0
- package/dist/src/notice/en-values.js +2 -0
- package/dist/src/notice/en.js +119 -11
- package/dist/src/npm-access.js +18 -2
- package/dist/src/opencode/adapter.js +3 -1
- package/dist/src/opencode/cli.js +11 -10
- package/dist/src/opencode/home.js +24 -4
- package/dist/src/opencode/tail.js +7 -1
- package/dist/src/opencode/transcript.js +21 -7
- package/dist/src/opencode/window.js +21 -5
- package/dist/src/packages/check.js +17 -8
- package/dist/src/packages/follow.js +54 -0
- package/dist/src/packages/gateway.js +86 -4
- package/dist/src/packages/hub.js +64 -0
- package/dist/src/packages/installs.js +226 -0
- package/dist/src/packages/launch.js +61 -13
- package/dist/src/packages/repo-reads.js +41 -0
- package/dist/src/packages/service.js +169 -243
- package/dist/src/packages/skills-package.js +39 -0
- package/dist/src/packages/stdio.js +24 -0
- package/dist/src/packages/version.js +2 -1
- package/dist/src/pass-memo.js +27 -0
- package/dist/src/patch.js +2 -1
- package/dist/src/profiles/rules.js +2 -2
- package/dist/src/projects/check.js +3 -2
- package/dist/src/projects/remotes.js +2 -1
- package/dist/src/projects/target-read.js +2 -1
- package/dist/src/review/open.js +27 -4
- package/dist/src/review/outsider.js +39 -0
- package/dist/src/review/wiring.js +2 -1
- package/dist/src/secrets/catalog.js +2 -0
- package/dist/src/server-request.js +51 -6
- package/dist/src/server-response.js +10 -2
- package/dist/src/server.js +101 -3
- package/dist/src/service/account-packages.js +24 -41
- package/dist/src/service/accounts.js +88 -135
- package/dist/src/service/badge.js +39 -6
- package/dist/src/service/chain-prompts.js +50 -5
- package/dist/src/service/chain.js +33 -378
- package/dist/src/service/chats.js +41 -0
- package/dist/src/service/cleanup.js +22 -7
- package/dist/src/service/cli-check.js +4 -4
- package/dist/src/service/defaults.js +32 -0
- package/dist/src/service/demo.js +3 -2
- package/dist/src/service/folders-here.js +21 -0
- package/dist/src/service/hosting-state.js +204 -0
- package/dist/src/service/hosting.js +153 -209
- package/dist/src/service/hub-bootstrap.js +204 -0
- package/dist/src/service/hub-brief.js +72 -0
- package/dist/src/service/hub-hooks.js +44 -0
- package/dist/src/service/hub-mcp.js +140 -0
- package/dist/src/service/install-check.js +19 -5
- package/dist/src/service/lifecycle.js +4 -2
- package/dist/src/service/machine-bootstrap.js +105 -0
- package/dist/src/service/machine-cards.js +62 -0
- package/dist/src/service/machine-chain.js +499 -0
- package/dist/src/service/machine-chats.js +91 -0
- package/dist/src/service/machine-context.js +103 -0
- package/dist/src/service/machine-host.js +226 -0
- package/dist/src/service/machine-link.js +476 -0
- package/dist/src/service/machine-network-options.js +12 -0
- package/dist/src/service/machine-network.js +741 -0
- package/dist/src/service/machine-packages.js +38 -0
- package/dist/src/service/machine-page.js +88 -0
- package/dist/src/service/machine-pool.js +177 -0
- package/dist/src/service/machine-process.js +84 -0
- package/dist/src/service/machine-services.js +117 -0
- package/dist/src/service/machine-settings.js +84 -0
- package/dist/src/service/machine-side.js +220 -0
- package/dist/src/service/page-history.js +31 -0
- package/dist/src/service/pool-after-green.js +92 -0
- package/dist/src/service/reassign.js +79 -0
- package/dist/src/service/session-monitor.js +119 -0
- package/dist/src/service/stats.js +3 -1
- package/dist/src/service/ticks.js +37 -0
- package/dist/src/service/trackers.js +1 -0
- package/dist/src/service.js +183 -440
- package/dist/src/sessions/agents.js +8 -4
- package/dist/src/sessions/cache.js +19 -0
- package/dist/src/sessions/chat.js +60 -13
- package/dist/src/sessions/inbox.js +10 -0
- package/dist/src/sessions/inboxes.js +112 -0
- package/dist/src/sessions/keepwarm.js +14 -0
- package/dist/src/sessions/lingering.js +4 -0
- package/dist/src/sessions/mail.js +3 -1
- package/dist/src/sessions/mailRelay.js +38 -2
- package/dist/src/sessions/mailbox-store.js +25 -0
- package/dist/src/sessions/mailbox.js +55 -26
- package/dist/src/sessions/monitor.js +17 -1
- package/dist/src/sessions/note.js +15 -4
- package/dist/src/sessions/orphans.js +131 -0
- package/dist/src/sessions/remote.js +2 -0
- package/dist/src/sessions/runs.js +39 -21
- package/dist/src/sessions/title.js +11 -6
- package/dist/src/sessions/transcript.js +41 -16
- package/dist/src/sessions/turn-ends.js +23 -0
- package/dist/src/sessions/view-index.js +38 -0
- package/dist/src/sessions/warm-pings.js +30 -0
- package/dist/src/settings/defaults.js +6 -1
- package/dist/src/settings/registry.js +49 -13
- package/dist/src/start.js +110 -0
- package/dist/src/stats/base-sql.js +8 -0
- package/dist/src/stats/machine-tally.js +46 -0
- package/dist/src/stats/model.js +3 -2
- package/dist/src/stats/reader.js +69 -16
- package/dist/src/stats/tally-schema.js +1 -1
- package/dist/src/stats/tally.js +13 -0
- package/dist/src/storage/backup-schedule.js +9 -2
- package/dist/src/storage/copy.js +9 -3
- package/dist/src/storage/database-steps.js +942 -0
- package/dist/src/storage/database.js +2 -630
- package/dist/src/storage/json-folder.js +44 -9
- package/dist/src/storage/migrations.js +6 -1
- package/dist/src/storage/owner.js +1 -1
- package/dist/src/storage/schema.js +1 -1
- package/dist/src/taskmcp/calls.js +26 -12
- package/dist/src/taskmcp/carried.js +69 -0
- package/dist/src/taskmcp/downloads.js +68 -32
- package/dist/src/taskmcp/files.js +4 -0
- package/dist/src/taskmcp/handoff.js +21 -0
- package/dist/src/taskmcp/history.js +48 -0
- package/dist/src/taskmcp/machine.js +205 -0
- package/dist/src/taskmcp/server.js +7 -2
- package/dist/src/taskmcp/tools.js +24 -4
- package/dist/src/tools/panel.js +5 -3
- package/dist/src/tools/sessionSettings.js +4 -1
- package/dist/src/tracker/author.js +13 -0
- package/dist/src/tracker/brief.js +24 -0
- package/dist/src/tracker/comments.js +19 -2
- package/dist/src/tracker/control.js +6 -1
- package/dist/src/tracker/editor.js +3 -2
- package/dist/src/tracker/error-text.js +21 -0
- package/dist/src/tracker/export-target.js +2 -1
- package/dist/src/tracker/export.js +116 -53
- package/dist/src/tracker/file-names.js +34 -0
- package/dist/src/tracker/history-export.js +14 -0
- package/dist/src/tracker/history.js +55 -0
- package/dist/src/tracker/import-plan.js +155 -0
- package/dist/src/tracker/import-retry.js +107 -0
- package/dist/src/tracker/import-source.js +33 -0
- package/dist/src/tracker/import.js +34 -0
- package/dist/src/tracker/link.js +4 -8
- package/dist/src/tracker/model.js +13 -0
- package/dist/src/tracker/pace.js +74 -0
- package/dist/src/tracker/parents.js +2 -1
- package/dist/src/tracker/rate-limit.js +63 -0
- package/dist/src/tracker/source.js +16 -6
- package/dist/src/tracker/start.js +72 -9
- package/dist/src/tracker/transfer-check.js +278 -0
- package/dist/src/tracker/transfer-stop.js +49 -0
- package/dist/src/updates/checkout.js +8 -0
- package/dist/src/updates/follow.js +108 -0
- package/dist/src/updates/model.js +23 -11
- package/dist/src/updates/rebuild.js +27 -0
- package/dist/src/updates/run.js +32 -16
- package/dist/src/updates/runner.js +193 -12
- package/dist/src/updates/steps.js +9 -6
- package/dist/src/updates/updater.js +18 -12
- package/dist/tally/src/activity-result.js +24 -0
- package/dist/tally/src/activity.js +52 -0
- package/dist/tally/src/chat-sessions.js +14 -0
- package/dist/tally/src/classify.js +2 -2
- package/dist/tally/src/collect.js +12 -4
- package/dist/tally/src/db-activity.js +28 -0
- package/dist/tally/src/db-backfills.js +38 -0
- package/dist/tally/src/db.js +104 -101
- package/dist/tally/src/machine-rows.js +23 -0
- package/dist/tally/src/migrations/17-machines.sql +7 -0
- package/dist/tally/src/migrations/18-chat-sessions.sql +70 -0
- package/dist/tally/src/migrations/19-limit-shares-one-pass.sql +32 -0
- package/dist/tally/src/migrations/20-warm-pings.sql +114 -0
- package/dist/tally/src/migrations/21-session-activity.sql +80 -0
- package/dist/tally/src/migrations/22-line-raws.sql +57 -0
- package/dist/tally/src/migrations.js +1 -1
- package/dist/tally/src/ship.js +82 -0
- package/dist/tally/src/step-runs.js +5 -20
- package/dist/tally/src/stream.js +4 -6
- package/dist/tally/src/turns.js +2 -2
- package/dist/tally/src/warm-pings.js +15 -0
- package/dist/web/assets/BadgeDialog-B_puf4gn.js +1 -0
- package/dist/web/assets/ButtonWithTip-CKUX2Zj9.css +1 -0
- package/dist/web/assets/ButtonWithTip-Dv_lTY2w.js +1 -0
- package/dist/web/assets/ChainDivider-BWHmlwAN.css +1 -0
- package/dist/web/assets/ChainDivider-CAgORlAt.js +2 -0
- package/dist/web/assets/{DescriptionEditor-BGZ9A6x7.js → DescriptionEditor-BP9G4eW1.js} +5 -5
- package/dist/web/assets/FixButtons-VKGqxhsJ.js +7 -0
- package/dist/web/assets/FixButtons-xuzSmDiG.css +1 -0
- package/dist/web/assets/Loader-CRa8gNSO.css +1 -0
- package/dist/web/assets/Loader-gLtpd-HU.js +1 -0
- package/dist/web/assets/NewChatDialog-BNeZwqhQ.css +1 -0
- package/dist/web/assets/NewChatDialog-BPhSEUlM.js +1 -0
- package/dist/web/assets/OutsideView-CjqU_1_v.js +1 -0
- package/dist/web/assets/OutsideView-Hfkm7sQH.css +1 -0
- package/dist/web/assets/ProjectChatWindow-DFHqXtJT.js +1 -0
- package/dist/web/assets/ProjectPackages-C3WBhYWn.js +1 -0
- package/dist/web/assets/Select-ClnxKCav.js +1 -0
- package/dist/web/assets/Select-L3DXe4x4.css +1 -0
- package/dist/web/assets/TaskCard-DQJ_pizZ.js +2 -0
- package/dist/web/assets/TaskCard-MSKfeQSB.css +1 -0
- package/dist/web/assets/TranscriptWindow-B_0lkEov.css +1 -0
- package/dist/web/assets/TranscriptWindow-D-EQPrlF.js +6 -0
- package/dist/web/assets/TranscriptWindow-DTy64neg.js +1 -0
- package/dist/web/assets/accountParts-CIVGro5M.css +1 -0
- package/dist/web/assets/accountParts-CxNOHLQV.js +3 -0
- package/dist/web/assets/blocks-C3-5RdLi.css +1 -0
- package/dist/web/assets/blocks-DEe611CF.js +14 -0
- package/dist/web/assets/cardDrafts-BIJBcK7y.css +1 -0
- package/dist/web/assets/cardDrafts-Cu4oR7jf.js +12 -0
- package/dist/web/assets/cardSide-EOcop8Wv.css +1 -0
- package/dist/web/assets/cardSide-rO6Ughfv.js +2 -0
- package/dist/web/assets/{feedLine-CBjZXWwX.css → feedPin-BXDM-u8h.css} +1 -1
- package/dist/web/assets/feedPin-CHY_Owsx.js +3 -0
- package/dist/web/assets/format-DecSum6S.js +1 -0
- package/dist/web/assets/index-BgmurD3-.js +36 -0
- package/dist/web/assets/index-KJhwihX1.css +1 -0
- package/dist/web/assets/lib-D5hQoyXI.js +18 -0
- package/dist/web/assets/overview-BGjnxKG3.css +1 -0
- package/dist/web/assets/packageGroups-B-lwU2vO.js +1 -0
- package/dist/web/assets/packages-Cr9yWzy2.css +1 -0
- package/dist/web/assets/{react-dom-m8C9mC5F.js → react-dom-CzZfPJAD.js} +1 -1
- package/dist/web/assets/settingsRun-Cl3nW7b_.css +1 -0
- package/dist/web/assets/settingsRun-D-Dqm7pY.js +3 -0
- package/dist/web/assets/useFileDrop-ChaeIqmQ.js +1 -0
- package/dist/web/assets/useRowFocus-9aJnL77Z.js +1 -0
- package/dist/web/index.html +32 -24
- package/even-keel.config.example.json +1 -2
- package/package.json +11 -5
- package/plugins/agent-bridge/.claude-plugin/plugin.json +2 -2
- package/plugins/agent-bridge/.mcp.json +8 -0
- package/plugins/agent-bridge/README.md +4 -0
- package/plugins/agent-bridge/hooks/checkpoint-mark.mjs +4 -3
- package/plugins/agent-bridge/hooks/evenkeel.mjs +40 -3
- package/plugins/agent-bridge/hooks/handoff.mjs +12 -2
- package/plugins/agent-bridge/hooks/hooks.json +9 -0
- package/plugins/agent-bridge/hooks/inbox.mjs +26 -0
- package/plugins/agent-bridge/hooks/mailpost.mjs +52 -0
- package/plugins/agent-bridge/hooks/merge-check.mjs +2 -1
- package/plugins/agent-bridge/hooks/merges.mjs +24 -1
- package/plugins/agent-bridge/hooks/nudges.mjs +16 -7
- package/plugins/agent-bridge/opencode/agent-bridge.mjs +17 -14
- package/plugins/tally/.claude-plugin/plugin.json +1 -1
- package/plugins/tally/skills/session-audit/SKILL.md +4 -4
- package/plugins/tasks/.claude-plugin/plugin.json +1 -1
- package/plugins/tasks/skills/split/SKILL.md +4 -1
- package/plugins/tasks/skills/task/SKILL.md +1 -0
- package/service/EvenKeelTray.cs +52 -4
- package/service/install.ps1 +25 -3
- package/service/install.sh +61 -4
- package/dist/web/assets/BadgeDialog-Dytdlslk.js +0 -1
- package/dist/web/assets/ProjectPackages-XDRyVrDZ.js +0 -1
- package/dist/web/assets/Select-C1zxlcfk.js +0 -1
- package/dist/web/assets/Select-CYemy5Na.css +0 -1
- package/dist/web/assets/TaskCard-BV2lQojC.css +0 -1
- package/dist/web/assets/TaskCard-ixAKvQuF.js +0 -2
- package/dist/web/assets/TranscriptWindow-BNF7AkTM.css +0 -1
- package/dist/web/assets/TranscriptWindow-DJUwXoAb.js +0 -4
- package/dist/web/assets/accountParts-BRDCFhw7.js +0 -3
- package/dist/web/assets/accountParts-tFRVownp.css +0 -1
- package/dist/web/assets/blocks-CRzT04_P.js +0 -12
- package/dist/web/assets/blocks-Dx3DACiG.css +0 -1
- package/dist/web/assets/cardDrafts-2oX1SbA7.css +0 -1
- package/dist/web/assets/cardDrafts-D7iH-zNK.js +0 -12
- package/dist/web/assets/cardSide-63fNWHHv.css +0 -1
- package/dist/web/assets/cardSide-DT3aKjf9.js +0 -2
- package/dist/web/assets/feedLine-C60ODRrO.js +0 -1
- package/dist/web/assets/hooks-UYkBK54l.js +0 -1
- package/dist/web/assets/index-BUZWji2e.css +0 -1
- package/dist/web/assets/index-DrV6L65j.js +0 -25
- package/dist/web/assets/lib-CzxqvNiV.js +0 -18
- package/dist/web/assets/overview-B7iEgjQD.css +0 -1
- package/dist/web/assets/overview-DVOx9Lzw.js +0 -7
- package/dist/web/assets/packageGroups-py7H8wzR.js +0 -1
- package/dist/web/assets/packages-Dld4uH9X.css +0 -1
- package/dist/web/assets/rules-Bm27YbzZ.js +0 -1
- package/dist/web/assets/useFileDrop-DiTOLKSY.js +0 -1
- package/dist/web/assets/useHeightGlide-B2o4yzDR.css +0 -1
- package/dist/web/assets/useHeightGlide-Cx8nEUXF.js +0 -3
- package/dist/web/assets/useRowFocus-DKQshgF0.js +0 -1
- /package/dist/web/assets/{rules-Bgil4ZBp.css → lib-Bgil4ZBp.css} +0 -0
package/.env.example
CHANGED
|
@@ -23,11 +23,19 @@
|
|
|
23
23
|
# EVEN_KEEL_HOST=127.0.0.1
|
|
24
24
|
# EVEN_KEEL_PORT=4747
|
|
25
25
|
|
|
26
|
+
# Sample the service CPU and save profiles of event-loop stalls in logs/. Off by default.
|
|
27
|
+
# EVEN_KEEL_STALL_PROFILE=1
|
|
28
|
+
|
|
26
29
|
# The local MCP gateway chain sessions reach their packages' servers through (docs/packages.md); always on 127.0.0.1.
|
|
27
30
|
# EVEN_KEEL_MCP_PORT=4748
|
|
28
31
|
|
|
32
|
+
# The port the hub listens for other machines on, on all interfaces, while "Hub address for machines" is set (docs/machines.md). Read at startup.
|
|
33
|
+
# EVEN_KEEL_MACHINES_PORT=4749
|
|
34
|
+
|
|
29
35
|
# The page's token for requests from other machines; required when EVEN_KEEL_HOST is not loopback (docs/guide/setup.md).
|
|
30
36
|
# EVEN_KEEL_TOKEN=change-me-0123456789abcdef
|
|
37
|
+
# For Docker Compose, set a fresh token above. Image tag: latest, next, or an exact version.
|
|
38
|
+
# EVEN_KEEL_IMAGE_TAG=latest
|
|
31
39
|
|
|
32
40
|
# Folder with one Claude config folder per extra account; defaults to ~/.claude-accounts.
|
|
33
41
|
# EVEN_KEEL_ACCOUNTS_DIR=C:\Users\john.doe\.claude-accounts
|
|
@@ -64,3 +72,5 @@
|
|
|
64
72
|
# TALLY_LLM_URL=http://100.64.0.1:4000
|
|
65
73
|
# TALLY_LLM_KEY=sk-change-me
|
|
66
74
|
# TALLY_LLM_MODEL=google-gemini-3.1-flash-lite
|
|
75
|
+
# The chat microphone's model on the same LiteLLM (it must take audio); empty — the one below.
|
|
76
|
+
# TALLY_LLM_DICTATION_MODEL=google-gemini-3.5-flash-lite
|
package/CHANGELOG.md
CHANGED
|
@@ -122,6 +122,10 @@ A patch of 0.3: the CI and limit fixes that cost a chain time, and a clearer car
|
|
|
122
122
|
- The ⋯ menu of an account row offers **Replace key** for a working key too.
|
|
123
123
|
- **`even-keel install`, `even-keel update` and the first install from `npx` print the page's address** once the page answers, taken from `EVEN_KEEL_HOST`/`EVEN_KEEL_PORT` of the environment and the data folder's `.env`. If the page has not answered after 30 s, they say where the log is instead. The first install from `npx` then opens the page in the browser. On Linux it does that only on a desktop with a display, never over SSH.
|
|
124
124
|
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- **A Claude subscription can be added on a long token.** "Subscription" in the new Claude Code account dialog now offers two cards: the full sign-in, with what it gives, and the long token of `claude setup-token`, with what it lacks — no Remote Control, limits only while a session runs, no e-mail, a new token in a year. Paste the token and one short turn checks it before the account is added; say which full sign-in it is the same account as, and it shows that account's limits. The account's row shows "long token" and its last day, warns a month before it, and "Issue a new token" replaces a refused or outdated one in the same folder.
|
|
128
|
+
|
|
125
129
|
### Changed
|
|
126
130
|
|
|
127
131
|
- **What a task runs on is set on its card, not by a tracker label.** A task's run — provider, model and effort — is kept by Even Keel: the card's **Runs on** picks it, and a session can set it through the tasks server's `run` field of `tasks_create` and `task_update`. The effort is new: Claude Code's `low` to `max`, Codex's `minimal` to `xhigh`, OpenCode's variant and Copilot's reasoning effort; empty passes none. Labels `<Provider> | <model>` are no longer read. The update moves the run label of each open task into its run once, in the projects that had run labels on; the labels stay in the tracker. The setting `modelLabels` is removed.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
**You write the tickets. It takes the night shift.** Even Keel is a service on your own machine that you drive from one web page. It takes a project's open tasks, in the order of their `blocks` links, and works through them one at a time with [Claude Code](https://docs.claude.com/en/docs/claude-code/overview), [Codex](https://github.com/openai/codex), [OpenCode](https://opencode.ai) or [GitHub Copilot](https://github.com/github/copilot-cli) while you do something else. It waits out a spent usage limit, hands a long session over to a fresh one and keeps going while you are away; only a question or a decision waits for you — on that page, in the tracker or on your phone.
|
|
11
11
|
|
|
12
|
-
**Who it's for:** you have a bunch of ideas and an agent subscription, and you'd rather have the agent work through them one task at a time than watch a terminal. No tracker? It has one built in. No git? A plain folder works.
|
|
12
|
+
**Who it's for:** you have a bunch of ideas and an agent subscription, and you'd rather have the agent work through them one task at a time than watch a terminal. No tracker? It has one built in. No git? A plain folder works. No subscription? OpenCode's free models, Codex and Copilot free tiers work too.
|
|
13
13
|
|
|
14
14
|
**Not for:** ten agents at once — it runs one task per folder, on purpose. And it won't write your tasks for you: a clear task makes a good night.
|
|
15
15
|
|
|
@@ -89,6 +89,8 @@ Parallel agents decide on their own what an unfinished task will look like, hand
|
|
|
89
89
|
|
|
90
90
|
## As a service
|
|
91
91
|
|
|
92
|
+
On a server or NAS, [install with Docker Compose](docs/guide/docker.md) and update by pulling the image.
|
|
93
|
+
|
|
92
94
|
`npx even-keel` sets it up as your own user, no administrator needed: a start at sign-in with a tray icon on Windows, a systemd user unit on Linux, a launchd agent on macOS. It restarts Even Keel if it fails; stopping it leaves running sessions alone. `even-keel install` sets it up again (in PowerShell `even-keel.cmd`, [why](docs/guide/setup.md#windows-powershell)). Logs, the data folder, running it in a terminal or from a clone: [setup](docs/guide/setup.md#as-a-service).
|
|
93
95
|
|
|
94
96
|
## Updating
|
|
@@ -105,7 +107,7 @@ The settings live in Even Keel's database and are edited on the page, applied at
|
|
|
105
107
|
|
|
106
108
|
## What comes next
|
|
107
109
|
|
|
108
|
-
Looked at, not promised: several machines taking the tasks of one project,
|
|
110
|
+
Looked at, not promised: several machines taking the tasks of one project, a cap on how much of the usage limit one task may spend.
|
|
109
111
|
|
|
110
112
|
## Extending
|
|
111
113
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountHomes, accountsRoot, codexAccountsRoot, copilotAccountsRoot, openCodeAccountsRoot } from './homes.js';
|
|
2
2
|
import { inTransaction } from '../storage/database.js';
|
|
3
3
|
/** Registration belongs to this installation; a CLI's own folder and credentials remain the CLI's. */
|
|
4
|
-
export async function openAccountHomes(db, env) {
|
|
4
|
+
export async function openAccountHomes(db, env, stateTable = 'service_state') {
|
|
5
5
|
const { rows } = await db.query('select account from global_accounts');
|
|
6
6
|
const registration = {
|
|
7
7
|
keys: new Set(rows.map((row) => row.account)),
|
|
@@ -10,13 +10,13 @@ export async function openAccountHomes(db, env) {
|
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
const homes = new AccountHomes(env, accountsRoot(env), codexAccountsRoot(env), openCodeAccountsRoot(env), copilotAccountsRoot(env), registration);
|
|
13
|
-
const legacy = await db.query(
|
|
13
|
+
const legacy = await db.query(`select 1 from ${stateTable} where name = 'accounts.adoptLegacy'`);
|
|
14
14
|
if (legacy.rows.length > 0) {
|
|
15
15
|
const visible = homes.availableGlobals();
|
|
16
16
|
await inTransaction(db, async (tx) => {
|
|
17
17
|
for (const home of visible)
|
|
18
18
|
await tx.query('insert into global_accounts (account) values ($1) on conflict do nothing', [home.key]);
|
|
19
|
-
await tx.query(
|
|
19
|
+
await tx.query(`delete from ${stateTable} where name = 'accounts.adoptLegacy'`);
|
|
20
20
|
});
|
|
21
21
|
for (const home of visible)
|
|
22
22
|
registration.keys.add(home.key);
|
|
@@ -14,6 +14,7 @@ import { shortLivedProfile } from './aws.js';
|
|
|
14
14
|
import { userCredentials } from './gcloud.js';
|
|
15
15
|
import { cloudEnv, cloudOf } from './cloud.js';
|
|
16
16
|
import { KeychainCredentials, keychainService } from './keychain.js';
|
|
17
|
+
import { readLongToken, writeLongToken } from './longToken.js';
|
|
17
18
|
import { CODEX_ACCOUNT, folderName, GLOBAL_ACCOUNT, parseCredentialTimes } from './model.js';
|
|
18
19
|
import { API_KEY_VARIABLE, shareConfig } from './share.js';
|
|
19
20
|
const PENDING_PREFIX = '.pending-';
|
|
@@ -206,6 +207,21 @@ export class AccountHomes {
|
|
|
206
207
|
writeFileSync(join(home.dir, 'settings.json'), JSON.stringify({ env: cloudEnv(connection) }, null, 2));
|
|
207
208
|
return home;
|
|
208
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* A subscription account on a long token of `claude setup-token` (BTN-1005): a Claude folder whose `settings.json`
|
|
212
|
+
* carries the token, as an API account's carries its key; named `token` when the name is blank.
|
|
213
|
+
*/
|
|
214
|
+
addLongToken(name, token, now, tie = {}) {
|
|
215
|
+
const home = this.home(CLAUDE, folderName(name.trim() === '' ? 'token' : name, this.taken()));
|
|
216
|
+
mkdirSync(home.dir, { recursive: true });
|
|
217
|
+
this.forget();
|
|
218
|
+
writeLongToken(home.dir, token, now, tie);
|
|
219
|
+
return home;
|
|
220
|
+
}
|
|
221
|
+
/** The long token a Claude folder runs on; null for a folder signed in any other way. */
|
|
222
|
+
longTokenOf(home) {
|
|
223
|
+
return home.agent === CLAUDE ? readLongToken(home.dir) : null;
|
|
224
|
+
}
|
|
209
225
|
/** The cloud a Claude folder's `settings.json` connects to; null for any other folder. */
|
|
210
226
|
cloudOf(home) {
|
|
211
227
|
if (home.agent !== CLAUDE)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fail } from '../notice/notice.js';
|
|
4
|
+
import { OAUTH_TOKEN_VARIABLE } from './share.js';
|
|
5
|
+
/** What Even Keel knows of a folder's long token beside the token itself; kept in the account folder, never in git. */
|
|
6
|
+
export const LONG_TOKEN_FILE = 'even-keel-token.json';
|
|
7
|
+
/** `claude setup-token` issues a token for a year and the token carries no readable date: counted from the day it was added. */
|
|
8
|
+
const VALID_MS = 365 * 24 * 3600_000;
|
|
9
|
+
const TOKEN = /^sk-ant-oat\d\d-\S{20,}$/;
|
|
10
|
+
/** The trimmed token of the form `claude setup-token` prints; an API key or anything else is refused. */
|
|
11
|
+
export function assertLongToken(token) {
|
|
12
|
+
const value = token.trim();
|
|
13
|
+
if (!TOKEN.test(value))
|
|
14
|
+
throw fail('account.tokenInvalid', {});
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function readObject(file) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(readFileSync(file, 'utf8'));
|
|
20
|
+
return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function tokenIn(dir) {
|
|
27
|
+
const env = readObject(join(dir, 'settings.json')).env;
|
|
28
|
+
const token = typeof env === 'object' && env !== null ? env[OAUTH_TOKEN_VARIABLE] : undefined;
|
|
29
|
+
return typeof token === 'string' && token !== '' ? token : null;
|
|
30
|
+
}
|
|
31
|
+
/** The folder's long token as Even Keel knows it; null — its `settings.json` holds none. */
|
|
32
|
+
export function readLongToken(dir) {
|
|
33
|
+
if (tokenIn(dir) === null)
|
|
34
|
+
return null;
|
|
35
|
+
const kept = readObject(join(dir, LONG_TOKEN_FILE));
|
|
36
|
+
const account = accountOf(kept.account);
|
|
37
|
+
return {
|
|
38
|
+
until: typeof kept.until === 'string' ? kept.until : null,
|
|
39
|
+
...(typeof kept.sameAs === 'string' && kept.sameAs !== '' && { sameAs: kept.sameAs }),
|
|
40
|
+
...(account !== undefined && { account }),
|
|
41
|
+
...(typeof kept.refusedAt === 'string' && { refusedAt: kept.refusedAt }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function accountOf(value) {
|
|
45
|
+
if (typeof value !== 'object' || value === null)
|
|
46
|
+
return undefined;
|
|
47
|
+
const { account, email } = value;
|
|
48
|
+
if (typeof account !== 'string' || account === '')
|
|
49
|
+
return undefined;
|
|
50
|
+
return { account, email: typeof email === 'string' && email !== '' ? email : null };
|
|
51
|
+
}
|
|
52
|
+
/** The token into the folder's `settings.json`, the rest of the file as it was, and a year from `now` as its last day. */
|
|
53
|
+
export function writeLongToken(dir, token, now, tie = {}) {
|
|
54
|
+
const file = join(dir, 'settings.json');
|
|
55
|
+
const settings = readObject(file);
|
|
56
|
+
const env = typeof settings.env === 'object' && settings.env !== null ? settings.env : {};
|
|
57
|
+
writeFileSync(file, JSON.stringify({ ...settings, env: { ...env, [OAUTH_TOKEN_VARIABLE]: token } }, null, 2));
|
|
58
|
+
const kept = {
|
|
59
|
+
until: new Date(now.getTime() + VALID_MS).toISOString(),
|
|
60
|
+
...(tie.sameAs !== undefined && { sameAs: tie.sameAs }),
|
|
61
|
+
...(tie.account !== undefined && { account: tie.account }),
|
|
62
|
+
};
|
|
63
|
+
writeFileSync(join(dir, LONG_TOKEN_FILE), JSON.stringify(kept, null, 2));
|
|
64
|
+
}
|
|
65
|
+
/** Puts back what `takeLongToken` returned, after a new token failed its check. */
|
|
66
|
+
export function restoreLongToken(dir, held) {
|
|
67
|
+
const file = join(dir, 'settings.json');
|
|
68
|
+
const settings = readObject(file);
|
|
69
|
+
const env = typeof settings.env === 'object' && settings.env !== null ? settings.env : {};
|
|
70
|
+
writeFileSync(file, JSON.stringify({ ...settings, env: { ...env, [OAUTH_TOKEN_VARIABLE]: held.token } }, null, 2));
|
|
71
|
+
if (held.kept === null)
|
|
72
|
+
rmSync(join(dir, LONG_TOKEN_FILE), { force: true });
|
|
73
|
+
else
|
|
74
|
+
writeFileSync(join(dir, LONG_TOKEN_FILE), held.kept);
|
|
75
|
+
}
|
|
76
|
+
/** The folder's token and its file as they are, to put back; null — the folder holds no token. */
|
|
77
|
+
export function takeLongToken(dir) {
|
|
78
|
+
const token = tokenIn(dir);
|
|
79
|
+
if (token === null)
|
|
80
|
+
return null;
|
|
81
|
+
try {
|
|
82
|
+
return { token, kept: readFileSync(join(dir, LONG_TOKEN_FILE), 'utf8') };
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return { token, kept: null };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Notes that the provider refused the folder's token; false — already noted or no token there. */
|
|
89
|
+
export function noteTokenRefused(dir, at) {
|
|
90
|
+
const known = readLongToken(dir);
|
|
91
|
+
if (known === null || known.refusedAt !== undefined)
|
|
92
|
+
return false;
|
|
93
|
+
writeFileSync(join(dir, LONG_TOKEN_FILE), JSON.stringify({ ...known, refusedAt: at }, null, 2));
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
/** The token no longer signs the folder in: refused by the provider, or past its last day. */
|
|
97
|
+
export function tokenOver(token, now) {
|
|
98
|
+
return token.refusedAt !== undefined || (token.until !== null && Date.parse(token.until) <= now.getTime());
|
|
99
|
+
}
|
|
@@ -84,7 +84,7 @@ export async function guardSettingsEdit(input, config, ask = async () => {
|
|
|
84
84
|
&& paths.basename(account.key) === account.key
|
|
85
85
|
&& targets.some((path) => samePath(path, paths.join(config.accountsDir, account.key, 'settings.json'), platform));
|
|
86
86
|
});
|
|
87
|
-
return managed ? 'Even Keel manages this account folder’s settings.json. Edit shared settings in ~/.claude/settings.json; Even Keel transfers them to all Claude accounts before launch. For account-only settings, use Accounts in Even Keel: resolve a settings change with “
|
|
87
|
+
return managed ? 'Even Keel manages this account folder’s settings.json. Edit shared settings in ~/.claude/settings.json; Even Keel transfers them to all Claude accounts before launch. For account-only settings, use Accounts in Even Keel: resolve a settings change with “This account only”.' : null;
|
|
88
88
|
}
|
|
89
89
|
catch {
|
|
90
90
|
return null;
|
|
@@ -38,6 +38,36 @@ export function editedKeys(folder, written) {
|
|
|
38
38
|
const keys = new Set([...Object.keys(folder), ...Object.keys(written)]);
|
|
39
39
|
return [...keys].filter((key) => !SILENT_KEYS.has(key) && !FOLDER_KEYS.has(key) && comparable(key, folder[key]) !== comparable(key, written[key])).sort();
|
|
40
40
|
}
|
|
41
|
+
/** Longer values are cut: the page shows them in a tip, and a whole `hooks` block would weigh on every state. */
|
|
42
|
+
const SHOWN_VALUE = 2000;
|
|
43
|
+
function shown(value) {
|
|
44
|
+
if (value === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
const text = JSON.stringify(value);
|
|
47
|
+
return text.length <= SHOWN_VALUE ? text : `${text.slice(0, SHOWN_VALUE - 1)}…`;
|
|
48
|
+
}
|
|
49
|
+
/** What the page shows of an edited key: its value before and after, or for `env` only the names of what moved. */
|
|
50
|
+
export function settingsEdit(key, was, now) {
|
|
51
|
+
if (key === 'env') {
|
|
52
|
+
const before = sharedEnv(was);
|
|
53
|
+
const after = sharedEnv(now);
|
|
54
|
+
const names = [...new Set([...Object.keys(before), ...Object.keys(after)])].sort();
|
|
55
|
+
const differs = (name) => JSON.stringify(before[name]) !== JSON.stringify(after[name]);
|
|
56
|
+
return { key, variables: {
|
|
57
|
+
added: names.filter((name) => !(name in before)),
|
|
58
|
+
removed: names.filter((name) => !(name in after)),
|
|
59
|
+
changed: names.filter((name) => name in before && name in after && differs(name)),
|
|
60
|
+
} };
|
|
61
|
+
}
|
|
62
|
+
const edit = { key };
|
|
63
|
+
const before = shown(was);
|
|
64
|
+
const after = shown(now);
|
|
65
|
+
if (before !== undefined)
|
|
66
|
+
edit.was = before;
|
|
67
|
+
if (after !== undefined)
|
|
68
|
+
edit.now = after;
|
|
69
|
+
return edit;
|
|
70
|
+
}
|
|
41
71
|
/** The transfer of `settings.json` with the account's layer on top and the folder's own edits kept (`docs/accounts.md`). */
|
|
42
72
|
export function planSettings(global, folder, record, discard = new Set()) {
|
|
43
73
|
const file = mergeSettings(global, folder);
|
|
@@ -88,6 +118,10 @@ export class AccountSettings {
|
|
|
88
118
|
}
|
|
89
119
|
/** The folder edits that would still need a decision at the next transfer. */
|
|
90
120
|
edits(home) {
|
|
121
|
+
return this.changes(home).map((change) => change.key);
|
|
122
|
+
}
|
|
123
|
+
/** `edits` with what each key was and is now. */
|
|
124
|
+
changes(home) {
|
|
91
125
|
const record = this.records.get(home.key);
|
|
92
126
|
if (record === undefined)
|
|
93
127
|
return [];
|
|
@@ -99,20 +133,31 @@ export class AccountSettings {
|
|
|
99
133
|
const stamp = `${this.version}:${folderStamp}:${fileStamp(globalFile)}`;
|
|
100
134
|
const cached = this.seen.get(home.key);
|
|
101
135
|
if (cached?.stamp === stamp)
|
|
102
|
-
return cached.
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
136
|
+
return cached.changes;
|
|
137
|
+
const read = readJson(file);
|
|
138
|
+
const folder = stripSettingsGuard(read ?? {});
|
|
139
|
+
const written = stripSettingsGuard(record.written);
|
|
140
|
+
const changes = read === undefined ? [] : planSettings(stripSettingsGuard(readJson(globalFile) ?? {}), folder, record, this.discards.get(home.key)).edits.map((key) => settingsEdit(key, written[key], folder[key]));
|
|
141
|
+
this.seen.set(home.key, { stamp, changes });
|
|
142
|
+
return changes;
|
|
107
143
|
}
|
|
108
144
|
/** The keys of the account's own layer. */
|
|
109
145
|
own(account) {
|
|
110
146
|
return Object.keys(this.records.get(account)?.own ?? {}).sort();
|
|
111
147
|
}
|
|
112
|
-
/** Takes effect at the next transfer
|
|
113
|
-
resolve(home,
|
|
148
|
+
/** Every key or none: a key that is no edit any more refuses them all. Takes effect at the next transfer, which the caller starts. */
|
|
149
|
+
resolve(home, keys, choice) {
|
|
150
|
+
const list = typeof keys === 'string' ? [keys] : keys;
|
|
151
|
+
const edits = this.edits(home);
|
|
152
|
+
const missing = list.find((key) => !edits.includes(key));
|
|
153
|
+
if (missing !== undefined)
|
|
154
|
+
throw fail('account.settingsNoEdit', { account: home.key, key: missing });
|
|
155
|
+
for (const key of new Set(list))
|
|
156
|
+
this.resolveOne(home, key, choice);
|
|
157
|
+
}
|
|
158
|
+
resolveOne(home, key, choice) {
|
|
114
159
|
const record = this.records.get(home.key);
|
|
115
|
-
if (record === undefined
|
|
160
|
+
if (record === undefined)
|
|
116
161
|
throw fail('account.settingsNoEdit', { account: home.key, key });
|
|
117
162
|
const value = stripSettingsGuard(readJson(join(home.dir, 'settings.json')) ?? {})[key];
|
|
118
163
|
if (choice === 'discard') {
|
|
@@ -20,17 +20,26 @@ const ONBOARDING_KEYS = ['hasCompletedOnboarding', 'lastOnboardingVersion'];
|
|
|
20
20
|
const LINKED_DIRS = ['agents', 'commands', 'hooks', 'output-styles'];
|
|
21
21
|
const OWN_SKILLS = new Set(['synced', '.trash']);
|
|
22
22
|
export const API_KEY_VARIABLE = 'ANTHROPIC_API_KEY';
|
|
23
|
+
/** The long-lived token of `claude setup-token` (BTN-1005): it makes a long-token account, never shared between folders. */
|
|
24
|
+
export const OAUTH_TOKEN_VARIABLE = 'CLAUDE_CODE_OAUTH_TOKEN';
|
|
23
25
|
const COPIED_FILES = ['CLAUDE.md', join('plugins', 'installed_plugins.json'), join('plugins', 'known_marketplaces.json')];
|
|
24
26
|
/**
|
|
25
|
-
* The global settings win, except the folder's own API key and cloud connection: they are what makes an API
|
|
26
|
-
* account (`docs/accounts.md`). A cloud folder takes none of the cloud's variables from the global
|
|
27
|
+
* The global settings win, except the folder's own API key, long token and cloud connection: they are what makes an API,
|
|
28
|
+
* a long-token or a cloud account (`docs/accounts.md`). A cloud folder takes none of the cloud's variables from the global
|
|
29
|
+
* settings, and no folder takes the global long token.
|
|
27
30
|
*/
|
|
28
31
|
export function mergeSettings(global, folder) {
|
|
29
32
|
const merged = { ...folder, ...global };
|
|
30
33
|
const own = objectOf(folder?.env);
|
|
34
|
+
const globalEnv = Object.fromEntries(Object.entries(objectOf(global.env)).filter(([name]) => name !== OAUTH_TOKEN_VARIABLE));
|
|
35
|
+
if (OAUTH_TOKEN_VARIABLE in objectOf(global.env))
|
|
36
|
+
merged.env = globalEnv;
|
|
31
37
|
const key = own[API_KEY_VARIABLE];
|
|
32
38
|
if (typeof key === 'string')
|
|
33
|
-
merged.env = { ...
|
|
39
|
+
merged.env = { ...globalEnv, [API_KEY_VARIABLE]: key };
|
|
40
|
+
const token = own[OAUTH_TOKEN_VARIABLE];
|
|
41
|
+
if (typeof token === 'string')
|
|
42
|
+
merged.env = { ...globalEnv, [OAUTH_TOKEN_VARIABLE]: token };
|
|
34
43
|
if (cloudOf(own) !== null) {
|
|
35
44
|
const shared = Object.fromEntries(Object.entries(objectOf(merged.env ?? global.env)).filter(([name]) => !isCloudVariable(name)));
|
|
36
45
|
const cloud = Object.fromEntries(Object.entries(own).filter(([name]) => isCloudVariable(name)));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CLAUDE } from '../claude/name.js';
|
|
2
|
+
import { fail } from '../notice/notice.js';
|
|
3
|
+
import { assertLongToken, restoreLongToken, takeLongToken, writeLongToken } from './longToken.js';
|
|
4
|
+
const reasonOf = (reason) => (reason instanceof Error ? reason.message : String(reason)).slice(0, 500);
|
|
5
|
+
/** The folder with a full sign-in the token is said to be of: a Claude folder that is on no token itself. */
|
|
6
|
+
function sameAccount(homes, key) {
|
|
7
|
+
if (key === undefined || key === null || key === '')
|
|
8
|
+
return undefined;
|
|
9
|
+
const home = homes.find(key);
|
|
10
|
+
if (home === undefined || home.agent !== CLAUDE || homes.longTokenOf(home) !== null)
|
|
11
|
+
throw fail('account.unknown', { key });
|
|
12
|
+
return key;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A subscription account on a long token (BTN-1005): the folder is made, one short turn runs on it, and a refusal
|
|
16
|
+
* removes it again, so no account is added that cannot run a session. `account` — the hub's account a machine's token
|
|
17
|
+
* is of (BTN-1002); `sameAs` may come as null through the link.
|
|
18
|
+
*/
|
|
19
|
+
export async function addTokenAccount(accounts, name, token, sameAs, account) {
|
|
20
|
+
const value = assertLongToken(token);
|
|
21
|
+
const same = sameAccount(accounts.homes, sameAs);
|
|
22
|
+
const home = accounts.homes.addLongToken(name, value, accounts.now(), { ...(same !== undefined && { sameAs: same }), ...(account != null && { account }) });
|
|
23
|
+
try {
|
|
24
|
+
await accounts.check(home);
|
|
25
|
+
}
|
|
26
|
+
catch (reason) {
|
|
27
|
+
await accounts.homes.remove(home);
|
|
28
|
+
throw fail('account.tokenRejected', { reason: reasonOf(reason) });
|
|
29
|
+
}
|
|
30
|
+
return home;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A new token in the folder of a long-token account, its name, roles and pools kept: checked by one short turn, and the
|
|
34
|
+
* old one is put back when the new one is refused. Running sessions go on with the token they started with.
|
|
35
|
+
*/
|
|
36
|
+
export async function replaceToken(accounts, home, token) {
|
|
37
|
+
const value = assertLongToken(token);
|
|
38
|
+
const held = home.global ? null : takeLongToken(home.dir);
|
|
39
|
+
if (held === null)
|
|
40
|
+
throw fail('account.keyNotHeld', { agent: home.agent });
|
|
41
|
+
const known = accounts.homes.longTokenOf(home);
|
|
42
|
+
writeLongToken(home.dir, value, accounts.now(), {
|
|
43
|
+
...(known?.sameAs !== undefined && { sameAs: known.sameAs }),
|
|
44
|
+
...(known?.account !== undefined && { account: known.account }),
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
await accounts.check(home);
|
|
48
|
+
}
|
|
49
|
+
catch (reason) {
|
|
50
|
+
restoreLongToken(home.dir, held);
|
|
51
|
+
throw fail('account.tokenRejected', { reason: reasonOf(reason) });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,6 +8,8 @@ import { CreditChecks } from './credit.js';
|
|
|
8
8
|
import { KeyChecks } from './keycheck.js';
|
|
9
9
|
import { CLAUDE } from '../claude/name.js';
|
|
10
10
|
import { cloudErrorNotice } from './cloud-errors.js';
|
|
11
|
+
import { noteTokenRefused, tokenOver } from './longToken.js';
|
|
12
|
+
import { addTokenAccount, replaceToken } from './tokenAccount.js';
|
|
11
13
|
import { cleanOutput, isApiKey, loginBlockNotice, loginCode, loginUrls, missingNotice, needsLogin, paysPerToken, removeProblem, secondFreeProblem, switchProblem, takesShared, withIdentity, } from './model.js';
|
|
12
14
|
const MAX_OUTPUT_CHARS = 16 * 1024;
|
|
13
15
|
const SHOWN_OUTPUT_CHARS = 2 * 1024;
|
|
@@ -45,6 +47,11 @@ export class AccountWatcher {
|
|
|
45
47
|
balances = new Map();
|
|
46
48
|
/** The account's own key `/credits` refused, by folder key: the balance is asked of the management key until it changes. */
|
|
47
49
|
ownKeyRefused = new Map();
|
|
50
|
+
batching = false;
|
|
51
|
+
batched;
|
|
52
|
+
get tokens() {
|
|
53
|
+
return { homes: this.options.homes, check: this.options.checkCloud, now: this.options.now };
|
|
54
|
+
}
|
|
48
55
|
constructor(options) {
|
|
49
56
|
this.options = options;
|
|
50
57
|
this.keys = new KeyChecks(options.keyCheckMs);
|
|
@@ -55,11 +62,54 @@ export class AccountWatcher {
|
|
|
55
62
|
const known = this.known.find((entry) => entry.home.key === key);
|
|
56
63
|
if (known === undefined)
|
|
57
64
|
return true;
|
|
65
|
+
if (known.longToken !== null && tokenOver(known.longToken, this.options.now()))
|
|
66
|
+
return true;
|
|
58
67
|
return needsLogin(known.status, this.options.homes.times(known.home), this.options.now()) || (isApiKey(known.status) && this.keys.rejected(key));
|
|
59
68
|
}
|
|
69
|
+
/** The long token the account runs on, as of the last poll (BTN-1005). */
|
|
70
|
+
longToken(key) {
|
|
71
|
+
return this.known.find((entry) => entry.home.key === key)?.longToken ?? undefined;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The folder's e-mail as `view` shows it, its status's or the one its sign-in last showed, read without building the
|
|
75
|
+
* view (BTN-1317): a view reads every folder's files.
|
|
76
|
+
*/
|
|
77
|
+
shownEmailOf(key) {
|
|
78
|
+
const known = this.known.find((entry) => entry.home.key === key);
|
|
79
|
+
if (known === undefined)
|
|
80
|
+
return null;
|
|
81
|
+
return known.status?.email ?? this.options.signedInAs?.(key)?.last ?? null;
|
|
82
|
+
}
|
|
83
|
+
/** A session's request was refused as not signed in: on a long token the account needs a new one, as after a sign-out. */
|
|
84
|
+
tokenRefused(key, at) {
|
|
85
|
+
const home = this.options.homes.find(key);
|
|
86
|
+
if (home !== undefined && this.longToken(key) !== undefined && noteTokenRefused(home.dir, at))
|
|
87
|
+
void this.refresh();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Runs `body` with one view for all its reads: a view reads every folder's files, and the machine's facts ask for it
|
|
91
|
+
* per project and per task. `body` must not change the accounts.
|
|
92
|
+
*/
|
|
93
|
+
batch(body) {
|
|
94
|
+
if (this.batching)
|
|
95
|
+
return body();
|
|
96
|
+
this.batching = true;
|
|
97
|
+
try {
|
|
98
|
+
return body();
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
this.batching = false;
|
|
102
|
+
this.batched = undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
60
105
|
get view() {
|
|
106
|
+
if (!this.batching)
|
|
107
|
+
return this.build();
|
|
108
|
+
return (this.batched ??= this.build());
|
|
109
|
+
}
|
|
110
|
+
build() {
|
|
61
111
|
const now = this.options.now();
|
|
62
|
-
const accounts = this.known.map(({ home, status, error, keyHeld, openRouter, cloud, remote }) => {
|
|
112
|
+
const accounts = this.known.map(({ home, status, error, keyHeld, openRouter, cloud, longToken, remote }) => {
|
|
63
113
|
const times = this.options.homes.times(home);
|
|
64
114
|
const transport = this.options.transportOf(home, paysPerToken(status));
|
|
65
115
|
const seen = this.options.signedInAs?.(home.key);
|
|
@@ -84,9 +134,10 @@ export class AccountWatcher {
|
|
|
84
134
|
configPending: this.options.configPending(home.key),
|
|
85
135
|
...this.settingsOf(home),
|
|
86
136
|
apiKey: isApiKey(status),
|
|
87
|
-
keyReplaceable: keyHeld && (isApiKey(status) || status?.authMethod === 'subscription_key'),
|
|
137
|
+
keyReplaceable: (keyHeld && (isApiKey(status) || status?.authMethod === 'subscription_key')) || (longToken !== null && !home.global),
|
|
138
|
+
...(longToken !== null && { longToken }),
|
|
88
139
|
...(cloud !== null && { cloud }),
|
|
89
|
-
...(remote === false && fullSignIn(home, status) && { remoteOff: true }),
|
|
140
|
+
...(remote === false && longToken === null && fullSignIn(home, status) && { remoteOff: true }),
|
|
90
141
|
...(this.checkedModels.has(home.key) && { checkedModel: this.checkedModels.get(home.key) ?? null }),
|
|
91
142
|
...(transport !== null && { transport }),
|
|
92
143
|
limits: this.options.limits(home.key),
|
|
@@ -329,6 +380,13 @@ export class AccountWatcher {
|
|
|
329
380
|
this.claimShared(home);
|
|
330
381
|
await this.refresh();
|
|
331
382
|
}
|
|
383
|
+
/** A subscription account on a long token of `claude setup-token`, checked by one short turn (`addTokenAccount`). */
|
|
384
|
+
async addLongToken(name, token, sameAs, account) {
|
|
385
|
+
const home = await addTokenAccount(this.tokens, name, token, sameAs, account);
|
|
386
|
+
this.options.name(home.key, name);
|
|
387
|
+
this.claimShared(home);
|
|
388
|
+
await this.refresh();
|
|
389
|
+
}
|
|
332
390
|
/**
|
|
333
391
|
* A new key in the folder of an API account (BTN-418): its name, roles and pools stay. Checked as a new account's key
|
|
334
392
|
* is, and refused when the account's organization is known and the key's is another one. Running sessions go on with
|
|
@@ -338,6 +396,10 @@ export class AccountWatcher {
|
|
|
338
396
|
const home = this.options.homes.find(key);
|
|
339
397
|
if (home === undefined)
|
|
340
398
|
throw fail('account.unknown', { key });
|
|
399
|
+
if (this.options.homes.longTokenOf(home) !== null) {
|
|
400
|
+
await replaceToken(this.tokens, home, value);
|
|
401
|
+
return this.refresh();
|
|
402
|
+
}
|
|
341
403
|
const next = this.options.homes.replacement(home, value);
|
|
342
404
|
const verdict = await this.accepted(home.agent, next, home.agent === 'opencode' && consoleKey(readAuth(home.dir)) !== null);
|
|
343
405
|
const known = this.options.organizations.of(key);
|
|
@@ -424,14 +486,14 @@ export class AccountWatcher {
|
|
|
424
486
|
const settings = this.options.settings;
|
|
425
487
|
if (settings === undefined || home.global || home.agent !== CLAUDE)
|
|
426
488
|
return {};
|
|
427
|
-
const edits = settings.
|
|
489
|
+
const edits = settings.changes(home);
|
|
428
490
|
const own = settings.own(home.key);
|
|
429
491
|
return { ...(edits.length > 0 && { settingsEdits: edits }), ...(own.length > 0 && { ownSettings: own }) };
|
|
430
492
|
}
|
|
431
493
|
/** An edit right in the folder's `settings.json`: made shared, kept as the account's own or dropped, then transferred. */
|
|
432
|
-
async resolveSettingsEdit(key,
|
|
494
|
+
async resolveSettingsEdit(key, settings, choice) {
|
|
433
495
|
const home = this.claudeHome(key);
|
|
434
|
-
this.options.settings?.resolve(home,
|
|
496
|
+
this.options.settings?.resolve(home, settings, choice);
|
|
435
497
|
await this.options.prepare(home);
|
|
436
498
|
this.options.onChange();
|
|
437
499
|
}
|
|
@@ -508,7 +570,7 @@ export class AccountWatcher {
|
|
|
508
570
|
async drop(key) {
|
|
509
571
|
const home = this.options.homes.find(key);
|
|
510
572
|
const status = this.known.find((known) => known.home.key === key)?.status;
|
|
511
|
-
if (!home.global && status?.loggedIn === true && !paysPerToken(status))
|
|
573
|
+
if (!home.global && status?.loggedIn === true && !paysPerToken(status) && this.longToken(home.key) === undefined)
|
|
512
574
|
await this.options.agentOf(home).logout(home);
|
|
513
575
|
await this.options.homes.remove(home);
|
|
514
576
|
this.options.forget(key);
|
|
@@ -541,18 +603,18 @@ export class AccountWatcher {
|
|
|
541
603
|
const apiKey = home.global ? null : this.options.homes.apiKeyOf(home);
|
|
542
604
|
const keyHeld = apiKey !== null;
|
|
543
605
|
const openRouter = apiKey !== null && keyProvider(home.agent, apiKey) === 'openrouter';
|
|
544
|
-
const cloud = this.options.homes.cloudOf(home);
|
|
545
606
|
const remote = home.agent === CLAUDE ? this.options.homes.remoteOn(home) : null;
|
|
607
|
+
const facts = { home, keyHeld, openRouter, cloud: this.options.homes.cloudOf(home), longToken: this.options.homes.longTokenOf(home), remote };
|
|
546
608
|
if (!(await this.options.online(home)))
|
|
547
|
-
return {
|
|
609
|
+
return { ...facts, status: before?.status ?? null, error: before?.error ?? null };
|
|
548
610
|
try {
|
|
549
|
-
return {
|
|
611
|
+
return { ...facts, status: withIdentity(await this.options.agentOf(home).authStatus(home), home.key), error: null };
|
|
550
612
|
}
|
|
551
613
|
catch (reason) {
|
|
552
614
|
const error = noticeOf(reason);
|
|
553
615
|
if (!sameNotice(error, before?.error ?? null))
|
|
554
616
|
this.options.onError(reason);
|
|
555
|
-
return {
|
|
617
|
+
return { ...facts, status: before?.status ?? null, error };
|
|
556
618
|
}
|
|
557
619
|
}
|
|
558
620
|
requireIdle() {
|
|
@@ -560,7 +622,13 @@ export class AccountWatcher {
|
|
|
560
622
|
throw fail('login.running', {});
|
|
561
623
|
}
|
|
562
624
|
begin(home, adding, method) {
|
|
563
|
-
const
|
|
625
|
+
const onLocalLink = (localUrl) => {
|
|
626
|
+
if (this.running !== running || this.current === null)
|
|
627
|
+
return;
|
|
628
|
+
this.current = { ...this.current, localUrl };
|
|
629
|
+
this.options.onChange();
|
|
630
|
+
};
|
|
631
|
+
const child = this.options.agentOf(home).login(home, method, onLocalLink);
|
|
564
632
|
const running = { child, home, adding };
|
|
565
633
|
this.running = running;
|
|
566
634
|
this.output = '';
|
package/dist/src/agent/copies.js
CHANGED
|
@@ -36,7 +36,7 @@ export function copies(runtimes, save, fallBack, changed, check, consent) {
|
|
|
36
36
|
};
|
|
37
37
|
/** Missing, not failed: a failed download waits for the explicit retry. */
|
|
38
38
|
const fetchesItself = (name) => {
|
|
39
|
-
const view = runtimes.get(name)?.cli?.
|
|
39
|
+
const view = runtimes.get(name)?.cli?.state();
|
|
40
40
|
return consented.has(name) && view?.source === 'checked' && view.status === 'missing';
|
|
41
41
|
};
|
|
42
42
|
const auto = (name) => {
|
|
@@ -46,7 +46,7 @@ export function copies(runtimes, save, fallBack, changed, check, consent) {
|
|
|
46
46
|
return {
|
|
47
47
|
view: () => Object.fromEntries([...runtimes].flatMap(([name, agent]) => agent.cli ? [[name, agent.cli.view()]] : [])),
|
|
48
48
|
blocked(name) {
|
|
49
|
-
const view = runtimes.get(name)?.cli?.
|
|
49
|
+
const view = runtimes.get(name)?.cli?.state();
|
|
50
50
|
if (view?.source !== 'checked' || view.status === 'ready')
|
|
51
51
|
return undefined;
|
|
52
52
|
if (fetchesItself(name))
|
package/dist/src/agent/copy.js
CHANGED
|
@@ -15,13 +15,16 @@ export function cliCopy(copy, options, version, system, overridden, approximate,
|
|
|
15
15
|
return { received: whole, total: whole };
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
18
|
-
view
|
|
18
|
+
/** The view without `system`, which searches the disk: what a launch asks before each start. */
|
|
19
|
+
state() {
|
|
19
20
|
return {
|
|
20
|
-
|
|
21
|
+
source: options.checkedCli() && !overridden() ? 'checked' : 'system',
|
|
21
22
|
status: downloading || copy?.downloading || extra?.downloading ? 'downloading' : copy?.error || extra?.error ? 'failed' : copy?.path() !== undefined && (extra === undefined || extra.path() !== undefined) ? 'ready' : 'missing',
|
|
22
|
-
system: system(), ...bytes(), approximate,
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
|
+
view() {
|
|
26
|
+
return { version, ...this.state(), system: system(), ...bytes(), approximate };
|
|
27
|
+
},
|
|
25
28
|
async download() {
|
|
26
29
|
if (!copy)
|
|
27
30
|
throw new Error('No checked CLI for this platform');
|