even-keel 0.3.0-rc.2 → 0.3.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +48 -112
- package/dist/src/account/keycheck.js +4 -2
- package/dist/src/account/management.js +5 -2
- package/dist/src/account/watcher.js +37 -8
- package/dist/src/agent/copies.js +48 -9
- package/dist/src/agent/copy.js +2 -0
- package/dist/src/agent/npm-global.js +31 -0
- package/dist/src/agent/pinned.js +8 -1
- package/dist/src/agent/scripted.js +5 -0
- package/dist/src/badge/collect.js +6 -18
- package/dist/src/badge/dates.js +0 -4
- package/dist/src/badge/render.js +5 -21
- package/dist/src/builtin/export.js +17 -1
- package/dist/src/builtin/routes.js +4 -0
- package/dist/src/chain/dispatcher.js +27 -3
- package/dist/src/chain/prompts.js +12 -2
- package/dist/src/chain/relay.js +4 -0
- package/dist/src/claude/cli.js +26 -8
- package/dist/src/cli-args.js +5 -0
- package/dist/src/cli.js +9 -6
- package/dist/src/codex/cli.js +11 -4
- package/dist/src/codex/trust.js +77 -0
- package/dist/src/config.js +7 -1
- package/dist/src/demo/scenario.js +13 -2
- package/dist/src/demo/service.js +37 -20
- package/dist/src/git/worktree.js +10 -3
- package/dist/src/notice/en-values.js +2 -0
- package/dist/src/notice/en.js +17 -7
- package/dist/src/opencode/cli.js +19 -7
- package/dist/src/paths.js +20 -3
- package/dist/src/profiles/service.js +26 -7
- package/dist/src/server-response.js +1 -1
- package/dist/src/server.js +3 -3
- package/dist/src/service/accounts.js +1 -1
- package/dist/src/service/chain-prompts.js +5 -5
- package/dist/src/service/hosting.js +5 -0
- package/dist/src/service/lifecycle.js +1 -0
- package/dist/src/service/trackers.js +2 -1
- package/dist/src/service/vocabulary.js +9 -3
- package/dist/src/service.js +6 -3
- package/dist/src/stats/base-sql.js +1 -1
- package/dist/src/stats/reader.js +55 -11
- package/dist/src/stats/tally-schema.js +17 -1
- package/dist/src/stats/tally.js +2 -2
- package/dist/src/storage/backup.js +21 -4
- package/dist/src/taskmcp/calls.js +1 -23
- package/dist/src/taskmcp/downloads.js +9 -1
- package/dist/src/tools/panel.js +4 -1
- package/dist/src/tracker/editor.js +23 -0
- package/dist/src/tracker/export.js +5 -1
- package/dist/src/tracker/link.js +14 -2
- package/dist/src/tracker/start.js +38 -5
- package/dist/tally/src/collect-worker.js +8 -1
- package/dist/tally/src/migrations/16-minimax-family.sql +25 -0
- package/dist/tally/src/migrations.js +10 -1
- package/dist/web/assets/{BadgeDialog-Dx2EERWr.js → BadgeDialog-B8RUL_Ow.js} +1 -1
- package/dist/web/assets/{DescriptionEditor-BL_6314d.js → DescriptionEditor-DUSwRGCZ.js} +3 -3
- package/dist/web/assets/{ProjectPackages-D-Hqs0sG.js → ProjectPackages-BJEPijBV.js} +1 -1
- package/dist/web/assets/{Select-B5xZpiCG.js → Select-NXi_Bsw-.js} +1 -1
- package/dist/web/assets/TaskCard-097ft8uY.js +2 -0
- package/dist/web/assets/{TranscriptWindow-E8DxggYC.js → TranscriptWindow-Bz5yFw-z.js} +1 -1
- package/dist/web/assets/accountParts-CNUeXPYn.js +3 -0
- package/dist/web/assets/blocks-CiOz7u_W.js +12 -0
- package/dist/web/assets/{cardDrafts-Cb5dNpJ3.js → cardDrafts-DDpQR0kq.js} +1 -1
- package/dist/web/assets/{cardSide-CIGvmTwG.js → cardSide-DEslYiM-.js} +2 -2
- package/dist/web/assets/feedLine-CNG43g34.js +1 -0
- package/dist/web/assets/{hooks-DdmIE6gF.js → hooks-CgKVeUg8.js} +1 -1
- package/dist/web/assets/index-4Ta6ufEr.js +25 -0
- package/dist/web/assets/index-6af4d6up.css +1 -0
- package/dist/web/assets/lib-DnFFmOv9.js +18 -0
- package/dist/web/assets/overview-0NAogPYB.js +7 -0
- package/dist/web/assets/{packageGroups-B34vA6-0.js → packageGroups-6mYiV3fk.js} +1 -1
- package/dist/web/assets/{react-dom-vGPErQYp.js → react-dom-DiYkIXNS.js} +1 -1
- package/dist/web/assets/{rules-BVB-I2tg.js → rules-DLe7kZM5.js} +1 -1
- package/dist/web/assets/{useFileDrop-eZtIxL1H.js → useFileDrop-CEn6qZnh.js} +1 -1
- package/dist/web/assets/useHeightGlide-B2o4yzDR.css +1 -0
- package/dist/web/assets/useHeightGlide-BPjzH9PL.js +3 -0
- package/dist/web/assets/{useRowFocus-CwOoEmzD.js → useRowFocus-COI8llTH.js} +1 -1
- package/dist/web/index.html +16 -17
- package/package.json +3 -2
- package/plugins/tally/.claude-plugin/plugin.json +1 -1
- package/plugins/tally/skills/session-audit/SKILL.md +1 -1
- package/service/install.sh +21 -0
- package/dist/web/assets/TaskCard-B9EJ_Qa2.js +0 -2
- package/dist/web/assets/accountParts-c2gPSGKK.js +0 -3
- package/dist/web/assets/blocks-B03KxlgQ.js +0 -12
- package/dist/web/assets/feedLine-Buzox_AA.js +0 -1
- package/dist/web/assets/index-CkYiatZt.css +0 -1
- package/dist/web/assets/index-DELgEMlH.js +0 -25
- package/dist/web/assets/lib-B8qNeB0X.css +0 -1
- package/dist/web/assets/lib-C1i2rKJZ.js +0 -18
- package/dist/web/assets/overview-D9PUjFeR.js +0 -7
- package/dist/web/assets/useHeightGlide-BmtdsmN0.css +0 -1
- package/dist/web/assets/useHeightGlide-DQvvOoIL.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
13
13
|
|
|
14
14
|
- **No label is kept out of the chain by default.** `chain.excludedLabels` starts empty and the built-in tracker no longer offers `Manual`: name the label you mark your own tasks with in the chain rules. An installation that relied on the default keeps `Manual` in its shared list after the update, so the same tasks stay out.
|
|
15
15
|
- **The main branch field offers the repository's branches, and saving another branch switches the main checkout to it**, in a project's settings and in the wizard that adds one: a branch the repository lacks is created from where the checkout stands, one only on a remote is taken from there, and the line under the field says which before you save. The wizard fills in the checkout's current branch and no longer refuses a branch the repository lacks. A checkout switched by hand is shown in the settings and on the chain's card, with buttons to make its branch the main one or to put the folder back, instead of only when a task fails to start.
|
|
16
|
+
- **The `checkpoint` plugin is now `agent-bridge`.** The first start after the update replaces `checkpoint@even-keel` with `agent-bridge@even-keel` in every project; a task already running keeps the old plugin until it ends. Let running tasks reach Done before you update: a task carried across the update on the old plugin was not tried through a handoff or a second restart. If you installed `checkpoint` into your own Claude Code by hand, uninstall it as [setup](docs/guide/setup.md#plugins) says.
|
|
17
|
+
- **A page tab open over the update may need a reload.** Page commands now answer only `{ok:true}`. A tab opened before the update reloads itself once the new service answers, but one held by an open dialog or a field you are typing in waits, and a command sent from it before the reload leaves it broken: reload it by hand.
|
|
16
18
|
|
|
17
19
|
### Security
|
|
18
20
|
|
package/README.md
CHANGED
|
@@ -7,45 +7,55 @@
|
|
|
7
7
|
|
|
8
8
|
<a href="https://github.com/NamerekT/even-keel/releases"><picture><source media="(prefers-color-scheme: light)" srcset="https://even-keel-badge.nykolai-tymchenko.workers.dev/even-keel.svg?theme=light"><img alt="Even Keel: what the chain is building now" src="https://even-keel-badge.nykolai-tymchenko.workers.dev/even-keel.svg?theme=dark"></picture></a>
|
|
9
9
|
|
|
10
|
-
**You write the tickets. It takes the night shift.** Even Keel takes
|
|
10
|
+
**You write the tickets. It takes the night shift.** Even Keel 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 its page, in the tracker or on your phone.
|
|
11
11
|
|
|
12
|
-
**
|
|
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.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- **A full context, your way.** A session past its context threshold writes a handoff note and a fresh one takes over in the same worktree — or leaves it to Claude Code's auto-compact, per project or per task by a [label](docs/guide/reference.md#configuration). The statistics count both, so you can compare what each cost on your own tasks.
|
|
16
|
-
- **What each task cost.** Built-in statistics (optional): cost and time per task, where sessions got stuck, how full the context ran, and before/after every change to your rule files. A session audit skill reads them and proposes what to change in your rules.
|
|
17
|
-
- **Every account on one page.** Claude, Codex, OpenCode and Copilot — subscriptions and API keys — each with its limits or spend and what runs on it right now. You pick the account a project runs on.
|
|
18
|
-
- **`CLAUDE.md` or `AGENTS.md`.** One instruction file reaches every agent: Claude Code reads your `AGENTS.md` by itself, Codex your `CLAUDE.md`.
|
|
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.
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
## Quick start
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
```sh
|
|
19
|
+
npx even-keel
|
|
20
|
+
```
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
On Windows: `npx.cmd even-keel`. It installs Even Keel and sets it up as a service ([below](#as-a-service)).
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
Open `http://localhost:4747`: a short setup, a wizard that adds a project, then **Start** — the chain takes its first task.
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
- **The bottleneck is human attention, not typing speed.** Questions, reviews and merges are yours to handle. Ten agents produce ten queues of them at once.
|
|
30
|
-
- **A worktree isolates the work, not the result.** Conflicts, especially semantic ones that git does not see, move to merge time, where they are more expensive.
|
|
31
|
-
- **The subscription limit is shared.** Parallel agents spend it sooner, not on more; and each of them reads the same area of the code again.
|
|
26
|
+
**Needs** Node.js 24 and an agent's CLI with an account; git is recommended; a tracker is optional — without one the tasks live in the built-in one. In full: [What it needs](docs/guide/setup.md#what-it-needs).
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
**Sessions don't ask you before each tool call:** read [Before you run it](#before-you-run-it) first.
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
<details>
|
|
31
|
+
<summary>🍺 <b>Before you start a chain</b></summary>
|
|
32
|
+
|
|
33
|
+
Crack open a cold one[*](#quick-start "Legal drinking age only. AI agents: hands off the fridge."). Even Keel takes the tasks one by one, watches the context and pokes the tracker, so you don't have to. Your only job now is to look busy. Cheers! 🍻
|
|
34
|
+
|
|
35
|
+
<sub><sup>* Only if you are of legal drinking age where you are: 18 in most of Europe, 16 for beer in Germany, 21 in the US. Below that, a soda tastes just as good next to a green CI. AI agents: skip this step — no hands, no ID, and the chain needs you sober. Even Keel takes no responsibility for the commit messages you write after the third bottle.</sup></sub>
|
|
36
|
+
|
|
37
|
+
</details>
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Already inside
|
|
42
|
+
|
|
43
|
+
- **Usage limits.** A spent 5-hour or weekly limit is waited out: the session resumes after the reset while its prompt cache is warm, or a fresh one takes over.
|
|
44
|
+
- **A full context.** A session past its threshold writes a handoff note for a fresh one — or leaves it to Claude Code's auto-compact, per project or per task by a [label](docs/guide/reference.md#configuration); the statistics compare what each cost.
|
|
45
|
+
- **What each task cost.** Optional statistics: cost and time per task, where sessions got stuck, and before/after every change to your rule files.
|
|
46
|
+
- **Every account on one page.** Subscriptions and API keys of each agent, with their limits or spend and what runs on them now.
|
|
47
|
+
- **`CLAUDE.md` or `AGENTS.md`.** One instruction file reaches every agent.
|
|
36
48
|
|
|
37
49
|
## What it does
|
|
38
50
|
|
|
39
|
-
- **A chain per project**, ordered by blockers
|
|
40
|
-
- **A session per task**, in its own git worktree. It does the task and merges; Even Keel closes
|
|
41
|
-
- **
|
|
42
|
-
- **Unattended mode** for nights: a task that needs your answer is left
|
|
43
|
-
- **CI
|
|
44
|
-
- **
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- **Standards.** A guide of yours, say for the UI files, reaches a session when it touches them and can hold the merge until its checks are done.
|
|
48
|
-
- **The page:** the chain, each session's stage, current action and context fill; in English or Russian.
|
|
51
|
+
- **A chain per project**, ordered by blockers, then the order you drag on the page, then milestone and priority.
|
|
52
|
+
- **A session per task**, in its own git worktree or, without git, in the project's folder. It does the task and merges; Even Keel closes it and starts the next.
|
|
53
|
+
- **Trackers:** the built-in one, [Huly](https://huly.io), GitHub Issues, [Linear](https://linear.app), GitLab Issues, Jira Cloud and Forgejo Issues (Forgejo, Gitea or Codeberg); several in one chain, or several chains on one tracker project.
|
|
54
|
+
- **Unattended mode** for nights: a task that needs your answer is left with the question, and the chain moves on.
|
|
55
|
+
- **CI and pull requests:** the next task waits for a green main branch; PRs instead of merging on GitHub, Forgejo or GitLab.
|
|
56
|
+
- **Plugins, MCP servers and standards** per project, their keys kept away from the sessions; destructive commands are refused for every agent.
|
|
57
|
+
|
|
58
|
+
It runs as a service on your own machine, next to your repositories, on your own subscription, through the unmodified `claude`, `codex`, `opencode` and `copilot` CLIs.
|
|
49
59
|
|
|
50
60
|
| A question in the page's chat | A spent limit, waited out with the cache warm | Statistics |
|
|
51
61
|
| --- | --- | --- |
|
|
@@ -53,13 +63,11 @@ Even Keel wins in time, not in width: the agent keeps working while you are away
|
|
|
53
63
|
|
|
54
64
|
Every feature in full: [docs/guide](docs/guide/README.md), a page per area.
|
|
55
65
|
|
|
56
|
-
##
|
|
66
|
+
## Sequential by design
|
|
67
|
+
|
|
68
|
+
Parallel agents decide on their own what an unfinished task will look like, hand you ten queues of questions at once and spend the shared limit sooner. Even Keel wins in time, not in width: one task at a time per folder, and the chain survives what usually stops it. Why, in full: [Why one task at a time](docs/guide/chain.md#why-one-task-at-a-time).
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
- **git** ([git-scm.com](https://git-scm.com/downloads)) with your name and e-mail set (`git config --global user.name` and `user.email`): sessions commit and merge under that name.
|
|
60
|
-
- **An agent and an account of it:** [Claude Code](https://docs.claude.com/en/docs/claude-code/setup), [Codex](https://github.com/openai/codex), [OpenCode](https://opencode.ai) (preview) or [GitHub Copilot CLI](https://github.com/github/copilot-cli) (preview), on a subscription or an API key; OpenCode also runs its free models. The setup can download the CLI for you.
|
|
61
|
-
- **A tracker:** a Huly workspace, GitHub, GitLab or Forgejo projects with Issues, a Linear workspace or a Jira Cloud site.
|
|
62
|
-
- **Windows, Linux or macOS.** Windows is where it runs every day; Linux and macOS (Apple silicon) were checked end to end. The MSI installer of Node can sit on "Preparing to install…" for over 10 minutes: wait it out.
|
|
70
|
+

|
|
63
71
|
|
|
64
72
|
## Before you run it
|
|
65
73
|
|
|
@@ -79,105 +87,33 @@ Every feature in full: [docs/guide](docs/guide/README.md), a page per area.
|
|
|
79
87
|
|
|
80
88
|
</details>
|
|
81
89
|
|
|
82
|
-
## Quick start
|
|
83
|
-
|
|
84
|
-
```sh
|
|
85
|
-
npx even-keel
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
This installs Even Keel globally with npm and sets it up as a service ([below](#as-a-service)), no administrator needed. In PowerShell add `.cmd` to it and to every `even-keel` command, or run them from cmd ([why](docs/guide/setup.md#windows-powershell)):
|
|
89
|
-
|
|
90
|
-
```powershell
|
|
91
|
-
npx.cmd even-keel
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
To run it in a terminal instead of as a service:
|
|
95
|
-
|
|
96
|
-
```sh
|
|
97
|
-
npm install --global even-keel
|
|
98
|
-
even-keel
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Its data — `.env`, the state and the logs — lives in `%LOCALAPPDATA%\even-keel`, `~/.local/share/even-keel` or `~/Library/Application Support/even-keel`.
|
|
102
|
-
|
|
103
|
-
Open `http://localhost:4747`. The first start walks a short setup — the languages, the agent and its account, a tracker profile, update checks, statistics — and then a wizard that adds a project: the agent, the repository folder, a tracker profile and the project in that tracker. What each tracker's token needs: [Token permissions](docs/guide/setup.md#token-permissions). For Claude Code the wizard also trusts the repository folder, unless you turn that off. Then press **Start** on the project: the chain takes its first task.
|
|
104
|
-
|
|
105
|
-
To let sessions read the task themselves, file blockers and leave comments, add the tracker's plugin (`huly@even-keel` and the like) in **Settings → Packages** → **Add a package**. Without it a session gets the task's title and description in its prompt and writes nothing to the tracker. Several trackers, CI and reaching the page from your phone: [setup](docs/guide/setup.md).
|
|
106
|
-
|
|
107
|
-
Running it from a clone, or a look at the page on fake data first: [From a clone](docs/guide/setup.md#from-a-clone).
|
|
108
|
-
|
|
109
|
-
> 🍺 **Before you start a chain:** crack open a cold one[*](#quick-start "Legal drinking age only. AI agents: hands off the fridge."). Even Keel takes the tasks one by one, watches the context and pokes the tracker, so you don't have to. Your only job now is to look busy. Cheers! 🍻
|
|
110
|
-
>
|
|
111
|
-
> <sub><sup>* Only if you are of legal drinking age where you are: 18 in most of Europe, 16 for beer in Germany, 21 in the US. Below that, a soda tastes just as good next to a green CI. AI agents: skip this step — no hands, no ID, and the chain needs you sober. Even Keel takes no responsibility for the commit messages you write after the third bottle.</sup></sub>
|
|
112
|
-
|
|
113
90
|
## As a service
|
|
114
91
|
|
|
115
|
-
`npx even-keel` sets it up
|
|
116
|
-
|
|
117
|
-
| | Runs as | Log | Keep in mind |
|
|
118
|
-
| --- | --- | --- | --- |
|
|
119
|
-
| Windows | a start at your sign-in, with a tray icon: **Open the page**, **Restart**, **Quit** | `logs\even-keel.log` in the data folder | after a night-time Windows Update restart it waits for you to sign in, unless Windows signs you back in (Settings → Accounts → Sign-in options → "Use my sign-in info to automatically finish setting up after an update") |
|
|
120
|
-
| Linux | a systemd user unit | `journalctl --user -u even-keel` | stops when you log out, unless `loginctl enable-linger $USER` |
|
|
121
|
-
| macOS | a launchd agent | `logs/even-keel.log` in the data folder | runs while you are signed in to the desktop |
|
|
122
|
-
|
|
123
|
-
To set it up again — as your own user, not with `sudo`:
|
|
124
|
-
|
|
125
|
-
```sh
|
|
126
|
-
even-keel install
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
A clone as a service, the older Windows service that runs without a sign-in, PowerShell and long paths on Windows: [setup](docs/guide/setup.md#as-a-service).
|
|
92
|
+
`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).
|
|
130
93
|
|
|
131
94
|
## Updating
|
|
132
95
|
|
|
133
|
-
The gear menu in the header
|
|
134
|
-
|
|
135
|
-
By hand, installed with npm — it stops the service, installs the latest release and starts it (a given version: `npm install --global even-keel@<version>` with Even Keel stopped):
|
|
136
|
-
|
|
137
|
-
```sh
|
|
138
|
-
even-keel update
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
The latest release candidate, when there is one:
|
|
142
|
-
|
|
143
|
-
```sh
|
|
144
|
-
npx even-keel@next
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Updating a clone, the `dev` branch, plugins, stored state and going back to an older version: [setup](docs/guide/setup.md#updating).
|
|
96
|
+
The gear menu in the header tells you when a newer release is out: **Update** waits for the chains to settle, installs it and restarts the service, and brings back the version you had if anything fails. By hand: `even-keel update`; the next release candidate: `npx even-keel@next`. In full: [setup](docs/guide/setup.md#updating).
|
|
148
97
|
|
|
149
98
|
## Uninstall
|
|
150
99
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
```sh
|
|
154
|
-
even-keel uninstall
|
|
155
|
-
npm uninstall --global even-keel
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
A clone, and what stays in your repositories and your Claude Code config: [setup](docs/guide/setup.md#uninstall).
|
|
100
|
+
`even-keel uninstall` removes the service and nothing else, then `npm uninstall --global even-keel` the package; delete the data folder yourself. What stays in your repositories and agents' config: [setup](docs/guide/setup.md#uninstall).
|
|
159
101
|
|
|
160
102
|
## Configuration
|
|
161
103
|
|
|
162
|
-
The settings live in Even Keel's database and are edited on the page
|
|
104
|
+
The settings live in Even Keel's database and are edited on the page, applied at once with no restart; `.env` holds the page's address and a few paths. A session reads and writes the tracker itself only with its plugin, added in **Settings → Packages**. Every variable and key: [docs/guide/reference.md](docs/guide/reference.md).
|
|
163
105
|
|
|
164
106
|
## What comes next
|
|
165
107
|
|
|
166
|
-
Looked at, not promised: several machines taking the tasks of one project,
|
|
108
|
+
Looked at, not promised: several machines taking the tasks of one project, running in Docker, a cap on how much of the usage limit one task may spend.
|
|
167
109
|
|
|
168
110
|
## Extending
|
|
169
111
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
Where it could grow:
|
|
173
|
-
|
|
174
|
-
- Other trackers: YouTrack, Jira Data Center…
|
|
175
|
-
- Your own classifier for the statistics, or a different model behind it.
|
|
176
|
-
- Other APIs and other agents: today Even Keel runs the Claude Code, Codex, OpenCode and GitHub Copilot CLIs and is built around the first two's subscription limits.
|
|
112
|
+
A new tracker is an adapter and a plugin ([CONTRIBUTING.md](CONTRIBUTING.md#extending)); YouTrack, Jira Data Center, other agents or your own classifier for the statistics are all welcome.
|
|
177
113
|
|
|
178
114
|
## Development
|
|
179
115
|
|
|
180
|
-
`main` is always the latest release
|
|
116
|
+
`main` is always the latest release; the next version is built on `dev`, fixes on `release/v<x.y>` ([docs/releases.md](docs/releases.md)). Pull requests are not accepted for now: bugs and ideas go to issues. Running from a clone, or the page on fake data: [setup](docs/guide/setup.md#from-a-clone) and [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
181
117
|
|
|
182
118
|
## Security
|
|
183
119
|
|
|
@@ -41,8 +41,10 @@ export async function checkOpenAiKey(key, timeoutMs, fetchImpl = fetch) {
|
|
|
41
41
|
export async function checkOpenRouterKey(key, timeoutMs, fetchImpl = fetch) {
|
|
42
42
|
return askModels(OPENROUTER_KEY_URL, { authorization: `Bearer ${key}` }, timeoutMs, fetchImpl, undefined, async (response) => {
|
|
43
43
|
const body = await response.json();
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const data = typeof body === 'object' && body !== null ? body.data : null;
|
|
45
|
+
const limit = openRouterLimit(data);
|
|
46
|
+
const management = typeof data === 'object' && data !== null && data.is_management_key === true;
|
|
47
|
+
return { ...(limit !== null && { limit }), ...(management && { management: true }) };
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Tells the account's credits bought and used. Documented for a management key only, yet live it answered the key a
|
|
3
|
+
* session runs on too, with the same totals (2026-11-15, BTN-1206).
|
|
4
|
+
*/
|
|
2
5
|
const OPENROUTER_CREDITS_URL = 'https://openrouter.ai/api/v1/credits';
|
|
3
|
-
/** The account's balance, `total_credits` less `total_usage`; 401 and 403 are a key
|
|
6
|
+
/** The account's balance, `total_credits` less `total_usage`; 401 and 403 are a key OpenRouter does not tell it to. */
|
|
4
7
|
export async function readOpenRouterBalance(key, timeoutMs, fetchImpl = fetch) {
|
|
5
8
|
let response;
|
|
6
9
|
try {
|
|
@@ -41,8 +41,10 @@ export class AccountWatcher {
|
|
|
41
41
|
/** The model each cloud account's check turn answered with, by folder key (BTN-822). */
|
|
42
42
|
checkedModels = new Map();
|
|
43
43
|
credit;
|
|
44
|
-
/** Each OpenRouter account's balance as
|
|
44
|
+
/** Each OpenRouter account's balance as last read, by folder key (BTN-868, BTN-1206). */
|
|
45
45
|
balances = new Map();
|
|
46
|
+
/** The account's own key `/credits` refused, by folder key: the balance is asked of the management key until it changes. */
|
|
47
|
+
ownKeyRefused = new Map();
|
|
46
48
|
constructor(options) {
|
|
47
49
|
this.options = options;
|
|
48
50
|
this.keys = new KeyChecks(options.keyCheckMs);
|
|
@@ -144,7 +146,8 @@ export class AccountWatcher {
|
|
|
144
146
|
const next = value?.trim() ?? '';
|
|
145
147
|
if (next === '') {
|
|
146
148
|
this.options.managementKeys.forget(key);
|
|
147
|
-
this.
|
|
149
|
+
if (this.ownKeyRefused.has(key))
|
|
150
|
+
this.balances.delete(key);
|
|
148
151
|
this.options.onChange();
|
|
149
152
|
return;
|
|
150
153
|
}
|
|
@@ -157,25 +160,48 @@ export class AccountWatcher {
|
|
|
157
160
|
this.balances.set(key, { usd: verdict.usd, at: this.options.now().toISOString() });
|
|
158
161
|
this.options.onChange();
|
|
159
162
|
}
|
|
160
|
-
/** Reads the balance of an account
|
|
163
|
+
/** Reads the balance of an account on an OpenRouter key, between the hourly checks; the page hears of a change. */
|
|
161
164
|
async readBalance(key) {
|
|
165
|
+
if (this.known.find((known) => known.home.key === key)?.openRouter !== true)
|
|
166
|
+
return;
|
|
162
167
|
if (await this.noteBalance(key))
|
|
163
168
|
this.options.onChange();
|
|
164
169
|
}
|
|
165
170
|
/** True when the balance changed; an answer that tells nothing, or a key replaced meanwhile, keeps the last one. */
|
|
166
171
|
async noteBalance(key) {
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
return false;
|
|
170
|
-
const verdict = await this.options.readBalance(managementKey);
|
|
171
|
-
if (verdict.state === 'unknown' || this.options.managementKeys.of(key) !== managementKey)
|
|
172
|
+
const verdict = await this.balanceOf(key);
|
|
173
|
+
if (verdict === null)
|
|
172
174
|
return false;
|
|
175
|
+
if (verdict === 'none')
|
|
176
|
+
return this.balances.delete(key);
|
|
173
177
|
const at = this.options.now().toISOString();
|
|
174
178
|
const before = this.balances.get(key);
|
|
175
179
|
const next = verdict.state === 'ok' ? { usd: verdict.usd, at } : { rejected: true, at };
|
|
176
180
|
this.balances.set(key, next);
|
|
177
181
|
return before === undefined || ('usd' in before ? !('usd' in next) || before.usd !== next.usd : 'usd' in next);
|
|
178
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* The balance as the account's own key reads it, OpenRouter answering `/credits` to it too (BTN-1206), else as its
|
|
185
|
+
* management key does: null — nothing learned, `none` — the own key is refused and there is no management key.
|
|
186
|
+
*/
|
|
187
|
+
async balanceOf(key) {
|
|
188
|
+
const home = this.options.homes.find(key);
|
|
189
|
+
const own = home === undefined ? null : this.options.homes.apiKeyOf(home);
|
|
190
|
+
if (own !== null && this.ownKeyRefused.get(key) !== own) {
|
|
191
|
+
const verdict = await this.options.readBalance(own);
|
|
192
|
+
if (verdict.state === 'ok')
|
|
193
|
+
return this.options.homes.apiKeyOf(home) === own ? verdict : null;
|
|
194
|
+
if (verdict.state === 'rejected')
|
|
195
|
+
this.ownKeyRefused.set(key, own);
|
|
196
|
+
}
|
|
197
|
+
const managementKey = this.options.managementKeys.of(key);
|
|
198
|
+
if (managementKey === undefined)
|
|
199
|
+
return own !== null && this.ownKeyRefused.get(key) === own ? 'none' : null;
|
|
200
|
+
const verdict = await this.options.readBalance(managementKey);
|
|
201
|
+
if (verdict.state === 'unknown' || this.options.managementKeys.of(key) !== managementKey)
|
|
202
|
+
return null;
|
|
203
|
+
return verdict;
|
|
204
|
+
}
|
|
179
205
|
/** When an API key can pay again after a credit or spending refusal at `at`; asking keeps it checked. */
|
|
180
206
|
creditBackAfter(key, at, text) {
|
|
181
207
|
return this.credit.restoredAfter(key, at, this.options.now(), text);
|
|
@@ -337,6 +363,8 @@ export class AccountWatcher {
|
|
|
337
363
|
throw fail(REJECTED[provider], {});
|
|
338
364
|
if (verdict.state === 'unknown')
|
|
339
365
|
throw fail(UNCHECKED[provider], { reason: verdict.reason });
|
|
366
|
+
if (verdict.management === true)
|
|
367
|
+
throw fail('account.openRouterManagementKey', {});
|
|
340
368
|
return verdict;
|
|
341
369
|
}
|
|
342
370
|
/** True when the verdict or the key's limit changed. */
|
|
@@ -481,6 +509,7 @@ export class AccountWatcher {
|
|
|
481
509
|
this.options.organizations.forget(key);
|
|
482
510
|
this.options.managementKeys.forget(key);
|
|
483
511
|
this.balances.delete(key);
|
|
512
|
+
this.ownKeyRefused.delete(key);
|
|
484
513
|
}
|
|
485
514
|
code(code) {
|
|
486
515
|
if (this.running === undefined || this.current === null)
|
package/dist/src/agent/copies.js
CHANGED
|
@@ -2,29 +2,68 @@ import { AGENTS } from './adapters.js';
|
|
|
2
2
|
import { notice } from '../notice/notice.js';
|
|
3
3
|
/**
|
|
4
4
|
* Service operations for copies; source changes use the ordinary live config writer, a failed download its `fallBack`,
|
|
5
|
-
* which may keep the copy chosen (`ConfigStore.fallBackCli`).
|
|
5
|
+
* which may keep the copy chosen (`ConfigStore.fallBackCli`). Consent to Checked is given once: a provider on Checked
|
|
6
|
+
* whose copy was ever downloaded with it fetches each new checked version by itself (BTN-1175).
|
|
6
7
|
*/
|
|
7
|
-
export function copies(runtimes, save, fallBack, changed, check) {
|
|
8
|
+
export function copies(runtimes, save, fallBack, changed, check, consent) {
|
|
9
|
+
const consented = new Set(consent.downloaded);
|
|
10
|
+
const remember = (name) => {
|
|
11
|
+
if (consented.has(name))
|
|
12
|
+
return;
|
|
13
|
+
consented.add(name);
|
|
14
|
+
consent.remember([...consented].sort());
|
|
15
|
+
};
|
|
16
|
+
// A copy on disk from before the record, the old version the next sweep removes included.
|
|
17
|
+
for (const [name, agent] of runtimes)
|
|
18
|
+
if (agent.cli?.hadCopy?.())
|
|
19
|
+
remember(name);
|
|
8
20
|
const controlOf = (name) => {
|
|
9
21
|
const cli = runtimes.get(name)?.cli;
|
|
10
22
|
if (!cli)
|
|
11
23
|
throw new Error('Unknown agent');
|
|
12
24
|
return cli;
|
|
13
25
|
};
|
|
26
|
+
const fetch = (name) => {
|
|
27
|
+
const cli = controlOf(name);
|
|
28
|
+
void cli.download().then(() => {
|
|
29
|
+
if (cli.view().status === 'ready')
|
|
30
|
+
remember(name);
|
|
31
|
+
}, (error) => {
|
|
32
|
+
console.warn(`agents: ${name} download failed: ${String(error)}`);
|
|
33
|
+
fallBack(name);
|
|
34
|
+
}).finally(changed);
|
|
35
|
+
changed();
|
|
36
|
+
};
|
|
37
|
+
/** Missing, not failed: a failed download waits for the explicit retry. */
|
|
38
|
+
const fetchesItself = (name) => {
|
|
39
|
+
const view = runtimes.get(name)?.cli?.view();
|
|
40
|
+
return consented.has(name) && view?.source === 'checked' && view.status === 'missing';
|
|
41
|
+
};
|
|
42
|
+
const auto = (name) => {
|
|
43
|
+
console.log(`agents: ${name} downloads the checked version ${runtimes.get(name).cli.view().version} by itself, its copy was downloaded with consent before`);
|
|
44
|
+
fetch(name);
|
|
45
|
+
};
|
|
14
46
|
return {
|
|
15
47
|
view: () => Object.fromEntries([...runtimes].flatMap(([name, agent]) => agent.cli ? [[name, agent.cli.view()]] : [])),
|
|
16
48
|
blocked(name) {
|
|
17
49
|
const view = runtimes.get(name)?.cli?.view();
|
|
18
|
-
|
|
50
|
+
if (view?.source !== 'checked' || view.status === 'ready')
|
|
51
|
+
return undefined;
|
|
52
|
+
if (fetchesItself(name))
|
|
53
|
+
auto(name);
|
|
54
|
+
return notice('agent.copyMissing', { title: AGENTS[name].title, agent: name });
|
|
55
|
+
},
|
|
56
|
+
/** At the start: the consented providers on Checked fetch a checked version they lack; gives their names. */
|
|
57
|
+
resume() {
|
|
58
|
+
const names = [...runtimes.keys()].filter(fetchesItself);
|
|
59
|
+
for (const name of names)
|
|
60
|
+
auto(name);
|
|
61
|
+
return names;
|
|
19
62
|
},
|
|
20
63
|
download(name) {
|
|
21
|
-
|
|
64
|
+
controlOf(name);
|
|
22
65
|
save(name, 'checked');
|
|
23
|
-
|
|
24
|
-
console.warn(`agents: ${name} download failed: ${String(error)}`);
|
|
25
|
-
fallBack(name);
|
|
26
|
-
}).finally(changed);
|
|
27
|
-
changed();
|
|
66
|
+
fetch(name);
|
|
28
67
|
},
|
|
29
68
|
system(name) {
|
|
30
69
|
if (!controlOf(name).view().system)
|
package/dist/src/agent/copy.js
CHANGED
|
@@ -38,5 +38,7 @@ export function cliCopy(copy, options, version, system, overridden, approximate,
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
async prune() { await copy?.prune(); await extra?.prune(); },
|
|
41
|
+
/** The CLI's copy, not the second package: its download is the one consented to. */
|
|
42
|
+
hadCopy: () => copy?.hadCopy() ?? false,
|
|
41
43
|
};
|
|
42
44
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { isRunnable, pathFolders, pathsOf } from '../paths.js';
|
|
3
|
+
export const thisMachine = () => ({ platform: process.platform, arch: process.arch, home: homedir(), runnable: isRunnable });
|
|
4
|
+
/**
|
|
5
|
+
* The folders a global npm install may sit in: on Windows the `node_modules` beside a PATH folder (npm's prefix holds
|
|
6
|
+
* its wrappers) and `%APPDATA%\npm`'s, elsewhere the `lib/node_modules` of a PATH folder's prefix (`<prefix>/bin`).
|
|
7
|
+
*/
|
|
8
|
+
export function npmGlobalModules(env, platform = process.platform) {
|
|
9
|
+
const paths = pathsOf(platform);
|
|
10
|
+
const folders = platform === 'win32'
|
|
11
|
+
? [...pathFolders(env, platform), ...(env.APPDATA === undefined ? [] : [paths.join(env.APPDATA, 'npm')])].map((folder) => paths.join(folder, 'node_modules'))
|
|
12
|
+
: pathFolders(env, platform).map((folder) => paths.join(paths.dirname(folder), 'lib', 'node_modules'));
|
|
13
|
+
return [...new Set(folders)];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The binary of a global npm install that runs: the wrapper's `bin` once the postinstall has replaced the placeholder
|
|
17
|
+
* (it took the build that fits the machine), else the platform package's own, inside the wrapper or hoisted beside it.
|
|
18
|
+
*/
|
|
19
|
+
export function npmCliBinary(cli, env, platform = process.platform, runnable = isRunnable) {
|
|
20
|
+
const paths = pathsOf(platform);
|
|
21
|
+
const parts = (path) => path.split('/');
|
|
22
|
+
const candidates = npmGlobalModules(env, platform).flatMap((modules) => {
|
|
23
|
+
const wrapper = paths.join(modules, ...parts(cli.wrapper));
|
|
24
|
+
return [
|
|
25
|
+
paths.join(wrapper, ...parts(cli.bin)),
|
|
26
|
+
...cli.natives.map(({ pkg, file }) => paths.join(wrapper, 'node_modules', ...parts(pkg), ...parts(file))),
|
|
27
|
+
...cli.natives.map(({ pkg, file }) => paths.join(modules, ...parts(pkg), ...parts(file))),
|
|
28
|
+
];
|
|
29
|
+
});
|
|
30
|
+
return candidates.find(runnable);
|
|
31
|
+
}
|
package/dist/src/agent/pinned.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { mkdir, readdir, rename, rm } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
const PARTIAL = '.partial';
|
|
@@ -26,6 +26,13 @@ export class PinnedCli {
|
|
|
26
26
|
}
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
|
+
/** Some version, this one or an older one the next sweep removes, was downloaded whole: consent was given (BTN-1175). */
|
|
30
|
+
hadCopy() {
|
|
31
|
+
if (!existsSync(this.options.dir))
|
|
32
|
+
return false;
|
|
33
|
+
return readdirSync(this.options.dir, { withFileTypes: true })
|
|
34
|
+
.some((entry) => entry.isDirectory() && !entry.name.endsWith(PARTIAL) && existsSync(this.options.binary(join(this.options.dir, entry.name))));
|
|
35
|
+
}
|
|
29
36
|
ensure() {
|
|
30
37
|
if (this.path() !== undefined)
|
|
31
38
|
return Promise.resolve();
|
|
@@ -307,6 +307,11 @@ export class ScriptedAgent {
|
|
|
307
307
|
session.entry = resting;
|
|
308
308
|
session.summary = { ...said(`NO CHANGES: ${end.noChanges}`), noChanges: end.noChanges };
|
|
309
309
|
}
|
|
310
|
+
else if ('done' in end) {
|
|
311
|
+
// A bare `TASK DONE` gives an empty reason, as `noChangesOf` reads it from a real transcript.
|
|
312
|
+
session.entry = resting;
|
|
313
|
+
session.summary = { ...said(`${end.done}\n\nTASK DONE`), noChanges: '' };
|
|
314
|
+
}
|
|
310
315
|
else if ('pullRequest' in end) {
|
|
311
316
|
session.entry = resting;
|
|
312
317
|
session.summary = { ...said(`PULL REQUEST: ${end.pullRequest}`), pullRequest: end.pullRequest };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localStamp } from './dates.js';
|
|
2
2
|
import { STATUS_FRESH_MS } from './status.js';
|
|
3
3
|
import { BADGE_FIELDS, BADGE_VERSION } from './model.js';
|
|
4
4
|
const DONE_CHIPS = 5;
|
|
5
5
|
const QUEUED_CHIPS = 12;
|
|
6
|
-
const DAY_MS = 86_400_000;
|
|
7
|
-
/** The agent's pace is counted over this many last days. */
|
|
8
|
-
const PACE_DAYS = 7;
|
|
9
6
|
/** The project's badge state from the service's state (BTN-915): only what `fields` picks, never a task's own title. */
|
|
10
7
|
export function badgeStateOf(state, project, inputs) {
|
|
11
8
|
const on = new Set(inputs.fields);
|
|
@@ -24,7 +21,7 @@ export function badgeStateOf(state, project, inputs) {
|
|
|
24
21
|
const result = { v: BADGE_VERSION, at: inputs.now.toISOString(), project: { key, name: state.config.projects[project]?.name ?? key }, active, chain };
|
|
25
22
|
const anchor = active[0]?.key ?? next ?? lastClosed(tasks, closed);
|
|
26
23
|
if (on.has('milestone'))
|
|
27
|
-
result.milestone = milestoneOf(tasks, anchor, new Set([...order, ...working])
|
|
24
|
+
result.milestone = milestoneOf(tasks, anchor, new Set([...order, ...working]));
|
|
28
25
|
const stats = statsOf(inputs.stats, on);
|
|
29
26
|
if (stats !== null)
|
|
30
27
|
result.stats = stats;
|
|
@@ -135,26 +132,17 @@ function lastClosed(tasks, closed) {
|
|
|
135
132
|
}
|
|
136
133
|
/**
|
|
137
134
|
* The milestone of `anchor` (BTN-970): its done tasks, the open ones, and those of them the chain takes — `queue`, the
|
|
138
|
-
* chain's own order and the tasks in work.
|
|
135
|
+
* chain's own order and the tasks in work. No release date (BTN-1197): neither a forecast of the agent's part, which
|
|
136
|
+
* missed the milestone's growth, nor the tracker's own date, which read as a promise.
|
|
139
137
|
*/
|
|
140
|
-
function milestoneOf(tasks, anchor, queue
|
|
138
|
+
function milestoneOf(tasks, anchor, queue) {
|
|
141
139
|
const milestone = tasks.find((task) => task.id === anchor)?.milestone;
|
|
142
140
|
if (milestone === undefined || milestone === null)
|
|
143
141
|
return null;
|
|
144
142
|
const of = tasks.filter((task) => task.milestone?.label === milestone.label);
|
|
145
143
|
const open = of.filter((task) => task.status.category !== 'Won' && task.status.category !== 'Lost');
|
|
146
144
|
const queued = open.filter((task) => queue.has(task.id)).length;
|
|
147
|
-
|
|
148
|
-
const now = when.now.getTime();
|
|
149
|
-
const recent = when.closed.filter((each) => {
|
|
150
|
-
const age = now - Date.parse(each.closedAt);
|
|
151
|
-
return age >= 0 && age <= PACE_DAYS * DAY_MS;
|
|
152
|
-
}).length;
|
|
153
|
-
if (queued > 0 && recent > 0)
|
|
154
|
-
result.eta = localDay(new Date(now + (queued / (recent / PACE_DAYS)) * DAY_MS), when.tz);
|
|
155
|
-
if (milestone.targetDate)
|
|
156
|
-
result.target = localDay(new Date(milestone.targetDate), when.tz);
|
|
157
|
-
return result;
|
|
145
|
+
return { name: milestone.label, done: of.filter((task) => task.status.category === 'Won').length, left: open.length, queued };
|
|
158
146
|
}
|
|
159
147
|
function statsOf(stats, on) {
|
|
160
148
|
if (stats === null)
|
package/dist/src/badge/dates.js
CHANGED
|
@@ -12,10 +12,6 @@ export function localStamp(at, tz) {
|
|
|
12
12
|
const two = (value) => String(value).padStart(2, '0');
|
|
13
13
|
return `${local}${offset < 0 ? '-' : '+'}${two(Math.floor(Math.abs(offset) / 60))}:${two(Math.abs(offset) % 60)}`;
|
|
14
14
|
}
|
|
15
|
-
/** The day of a moment in `tz`: `2026-11-10`. */
|
|
16
|
-
export function localDay(at, tz) {
|
|
17
|
-
return localStamp(at, tz).slice(0, 10);
|
|
18
|
-
}
|
|
19
15
|
/**
|
|
20
16
|
* A local stamp or day as the badge prints it, the month by its name since `11-10` reads two ways: `Nov 10` and, of a
|
|
21
17
|
* stamp, `03:40`. `null` — not such a text.
|
package/dist/src/badge/render.js
CHANGED
|
@@ -370,35 +370,19 @@ function drawPanels(draw, state, top) {
|
|
|
370
370
|
draw.text(WIDTH - PAD, y + CARD_HEIGHT + 16, '* at API list prices', 'sans', 10.5, theme.faint, ' text-anchor="end"');
|
|
371
371
|
return y + CARD_HEIGHT + 16;
|
|
372
372
|
}
|
|
373
|
-
/** When the milestone is due: the forecast of the agent's part and the tracker's own date. The maintainer's part has none. */
|
|
374
|
-
function whenOf(milestone) {
|
|
375
|
-
const eta = milestone.eta === undefined ? null : printed(milestone.eta);
|
|
376
|
-
const forecast = milestone.queued === undefined ? null : milestone.queued <= 0 ? "agent's part done" : eta === null ? null : `agent's part ≈ ${eta.day}`;
|
|
377
|
-
return { forecast, target: (milestone.target === undefined ? null : printed(milestone.target))?.day ?? null };
|
|
378
|
-
}
|
|
379
373
|
/**
|
|
380
|
-
* The milestone's card: its name,
|
|
381
|
-
*
|
|
374
|
+
* The milestone's card: its name, the bar of its parts — done, queued for the agent and with the maintainer — and their
|
|
375
|
+
* legend. A part of no task has neither a piece of the bar nor a legend entry. No release date (BTN-1197), even when an
|
|
376
|
+
* older service still sends `eta` and `target`.
|
|
382
377
|
*/
|
|
383
378
|
function drawMilestone(draw, milestone, x, y, width) {
|
|
384
379
|
const { theme } = draw;
|
|
385
380
|
const base = y + 25;
|
|
386
|
-
const
|
|
387
|
-
const targetLead = forecast === null ? 'target ' : ' · target ';
|
|
388
|
-
const whenWidth = (forecast === null ? 0 : measure(forecast, 'sans', 11.5)) + (target === null ? 0 : measure(`${targetLead}${target}`, 'sans', 11.5));
|
|
389
|
-
const room = width - (whenWidth === 0 ? 0 : whenWidth + 12);
|
|
390
|
-
const name = fit(milestone.name, 'sans-bold', 14, room);
|
|
381
|
+
const name = fit(milestone.name, 'sans-bold', 14, width);
|
|
391
382
|
draw.text(x, base, name, 'sans-bold', 14, theme.fg);
|
|
392
383
|
const after = measure(name, 'sans-bold', 14) + 8;
|
|
393
|
-
if (after + measure('next release', 'sans', 11.5) <=
|
|
384
|
+
if (after + measure('next release', 'sans', 11.5) <= width)
|
|
394
385
|
draw.text(x + after, base, 'next release', 'sans', 11.5, theme.faint);
|
|
395
|
-
if (whenWidth > 0) {
|
|
396
|
-
const spans = [
|
|
397
|
-
forecast === null ? '' : `<tspan fill="${theme.fgMuted}">${escapeXml(forecast)}</tspan>`,
|
|
398
|
-
target === null ? '' : `<tspan fill="${theme.faint}">${targetLead}</tspan><tspan fill="${theme.fg}">${target}</tspan>`,
|
|
399
|
-
];
|
|
400
|
-
draw.add(`<text x="${n(x + width)}" y="${base}" class="s" font-size="11.5" text-anchor="end" xml:space="preserve">${spans.join('')}</text>`);
|
|
401
|
-
}
|
|
402
386
|
const split = milestone.queued !== undefined;
|
|
403
387
|
const queued = Math.max(0, Math.min(milestone.left, milestone.queued ?? 0));
|
|
404
388
|
const hatch = `fill="url(#ek-hold)" stroke="${theme.waiting}" stroke-opacity="0.6"`;
|