omnitrix 0.4.3 → 0.5.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/README.md CHANGED
@@ -63,7 +63,7 @@ omnitrix init --apply
63
63
  omnitrix setup-claude
64
64
  ```
65
65
 
66
- `omnitrix init` lists the agent CLIs that omnitrix supports and finds on your PATH, the API keys set in the environment variables that `omnitrix providers` names (for example `DEEPSEEK_API_KEY`), and the local model servers that answer at their default addresses. It also shows which of them are already connected. Without `--apply`, it does not create or change anything. With `--apply`, it connects each new one in the same way as `omnitrix add <provider>` with no other options. It shows only the names of environment variables, never their values. For API keys, it stores a reference to the environment variable rather than the key itself, so the variable must also be set where Claude Code starts omnitrix. When it finishes, it opens the dashboard in your default browser, even if nothing is connected yet; use `--no-open` to skip this. It does not open a second tab when one is already open, and it does not start the dashboard when `CI` or `OMNITRIX_NO_BROWSER=1` is set.
66
+ `omnitrix init` lists the agent CLIs that omnitrix supports and finds on your PATH, the API keys set in the environment variables that `omnitrix providers` names (for example `DEEPSEEK_API_KEY`), and the local model servers that answer at their default addresses. It also shows which of them are already connected. Without `--apply`, it does not create or change anything. With `--apply`, it connects each new one in the same way as `omnitrix add <provider>` with no other options. It shows only the names of environment variables, never their values. For API keys, it stores a reference to the environment variable rather than the key itself, so the variable must also be set where Claude Code starts omnitrix. With `--apply`, when it finishes, it opens the dashboard in your default browser, even if nothing is connected yet; use `--no-open` to skip this. Without `--apply` it starts nothing, and only mentions `omnitrix dashboard`. It does not open a second tab when one is already open, and it does not start the dashboard when `CI` or `OMNITRIX_NO_BROWSER=1` is set.
67
67
 
68
68
  It lists some tools without adding them: Claude Code, because Claude Code leads the work and would spend the same Claude quota as a worker; Google Antigravity, because Google has suspended accounts used through outside tools; and the Gemini CLI while `GEMINI_API_KEY` is not set, because it cannot run without a key. After `--apply`, CLI accounts that do not use an API key, such as Codex, OpenCode and Qwen Code, need `omnitrix login <id>` once before they can run jobs.
69
69
 
@@ -98,7 +98,7 @@ Every task that Claude sends has a type, such as code, review or bulk work, and
98
98
 
99
99
  A model that is resting after errors is skipped, while the account's other models remain available. An account that fails three times in a row within ten minutes, through network errors, server errors, timeouts or unknown errors, rests for ten minutes. Rate limits, exhausted quota and sign-in problems are handled separately and do not count towards this. When `pool_status` or the dashboard shows the pool, omnitrix also asks each local model server, such as Ollama, for its model list at most once every 30 seconds, and shows a server that does not answer as offline for 60 seconds, during which the router skips it. Other failures rest the whole account for a short time: 60 seconds after a network error (30 seconds for a local server), 30 seconds after a server error on an account with only one model, and 60 seconds after a rate limit unless the provider names a time. Server errors and timeouts that all come from one model only pause that model, so they do not rest an account that has other models.
100
100
 
101
- Each remaining model receives a score based on how well it fits the task, how much quota the account has left, what the model costs, and how often its past work was accepted. An account without a known limit, such as a local model or an API key with no limits set, is counted as having 80% left, so that it ranks just below a fresh account whose quota is known; `omnitrix route` shows this as "no known limit". An account that is already running as many jobs as its concurrency limit allows has its score halved. The highest-scoring model receives the task. If that call fails, omnitrix ranks the accounts again, skips those it has already tried, and passes the task on without any action from Claude. After a timeout or a server error, the same account stays eligible with another of its models. A job makes at most three attempts, and at most twelve tries in total when retired models are included. A request that the provider rejects as invalid, including an `effort` value that the model does not accept, fails the job without another attempt, and so does an answer that arrived but could not be saved. A model that the provider no longer serves, or for which the plan has no allowance, is removed from the account and rests for 24 hours, and trying it does not count as an attempt.
101
+ Each remaining model receives a score based on how well it fits the task, how much quota the account has left, what the model costs, and how often its past work was accepted. An account without a known limit, such as a local model or an API key with no limits set, is counted as having 80% left, so that it ranks just below a fresh account whose quota is known; `omnitrix route` shows this as "no known limit". An account that is already running as many jobs as its concurrency limit allows has its score halved. The highest-scoring model receives the task. If that call fails, omnitrix ranks the accounts again, skips those it has already tried, and passes the task on without any action from Claude. After a timeout or a server error, the same account stays eligible with another of its models, but within that job the model that failed is never tried again, and after a local model times out, the job also skips that computer's models that are as big or bigger. A job makes at most three attempts, and at most twelve tries in total when retired models are included. A request that the provider rejects as invalid, including an `effort` value that the model does not accept, fails the job without another attempt, and so does an answer that arrived but could not be saved. A model that the provider no longer serves, or for which the plan has no allowance, is removed from the account and rests for 24 hours, and trying it does not count as an attempt.
102
102
 
103
103
  Three further adjustments multiply that score. Each adjustment that applies is listed in the reasons shown by `omnitrix route`, which lists the top eight candidates, and by `route_preview`, which lists the top three:
104
104
 
@@ -110,6 +110,8 @@ Together these adjustments can raise a score by about 44% or lower it by 25%, so
110
110
 
111
111
  omnitrix also notes how long each answer took. A model's typical answer time is the median of its last 20 successful answers in the last 30 days, once it has at least 3, and `omnitrix models <id>` shows it in the "typical" column. A task that sets `fast` to `true`, or `omnitrix run --fast` and `omnitrix route --fast`, prefers quick models: the model with the quickest typical time keeps its score, and one ten times slower loses about half of it. A model without a typical time yet is judged by its speed score, a little below the quickest measured model, so that a guess does not beat a measurement. Without `fast`, answer times do not affect routing.
112
112
 
113
+ On a computer with an NVIDIA graphics card, omnitrix reads the card's memory once with `nvidia-smi` and reads the size of each Ollama model every time it checks the local server. A local model larger than the card's memory runs mostly on the processor, which is many times slower, so its score is multiplied by 0.4 and the reasons say so, for example "about 19 GB, more than this computer's 4 GB of GPU memory". Other graphics cards and Apple's shared memory are not read, so nothing changes for them.
114
+
113
115
  Code tasks go only to agent CLIs that can edit files. Each task runs on a new branch in its own git worktree, so two workers never share a checkout. Other tasks that name a repository and go to an agent CLI run in a temporary copy of the repository that is removed afterwards, so a reviewing worker does not work in your checkout. The copy is taken at the last commit, and the files that the task lists are copied into the prompt from your working tree, including changes that are not committed.
114
116
 
115
117
  After a code task, omnitrix checks the branch itself rather than relying on the worker's report. It lists the files that the worker changed and, when the task named its files, the changed files that the task did not name. When the task gives a `test` command, such as `["npm", "test"]`, omnitrix runs it in the job's worktree after the worker finishes and reports whether it passed, its exit code and the end of its output, without terminal colour codes. The worktree is a fresh copy without installed packages, so for a Node.js project use `["npm", "install-test"]`, which installs them before it runs the tests. `get_results` waits for the test, and the dashboard shows the result on each job as "Checked by omnitrix". The test runs the worker's code on your computer, without keys in its environment, with an empty home folder of its own and with its own time limit, equal to the job limit but at most one hour; `cancel_job` stops it when it runs in the same omnitrix process. When two finished jobs in the same repository changed the same file and neither started from the other's result, `get_results` lists the other job under `also_changed` for each of them, because copying one job's files over the other's would silently lose work; the two changes have to be combined, for example with a merge. Rejected jobs and jobs whose branch was deleted are left out. omnitrix never merges anything: Claude still reviews the work, and you decide what to keep.
@@ -139,6 +141,8 @@ omnitrix route --type review "check this diff for auth bugs"
139
141
 
140
142
  `omnitrix dashboard` starts the dashboard in the background, or finds the one already running, and opens it in your default browser unless a dashboard tab is already open. The page updates by itself when accounts or models are added or removed, when jobs change state and when usage or quota changes. If the connection drops or the dashboard restarts, the page reconnects on its own and shows the time of the last update until it is live again. `omnitrix dashboard --stop` stops it. Installing an update does not stop a dashboard that is already running, so when Claude Code next starts omnitrix, omnitrix replaces a background dashboard of an older version with its own, without opening a tab; open pages reconnect by themselves. A dashboard of a newer version is left running. In the same way, omnitrix starts the dashboard again when it stopped without `omnitrix dashboard --stop`, for example after a restart of the computer. On Windows the dashboard is started outside the process tree of the program that started it, so closing Claude Code does not close the dashboard. In the Claude desktop app, Claude can open the same address in its own browser pane, because `pool_status` reports the dashboard address while it is running.
141
143
 
144
+ To show what omnitrix does for you, the dashboard, `pool_status` and `omnitrix usage` also report the work that other accounts did instead of Claude: in the last 7 days, or the days given to `omnitrix usage --days`, how many jobs another account answered, how many of them Claude accepted or rejected, and how many tokens those answers took, for example "other accounts answered 29 jobs (13 accepted, 9 rejected by Claude) and processed 1.5M tokens that Claude did not have to". The figures are counted from the usage log, not estimated. No price is put on them, because a Claude subscription is not billed per token.
145
+
142
146
  The dashboard shows each account's name, owner, usage in the last 24 hours and the quota remaining in each tracked window. When the provider's own numbers cannot be read again, it keeps the last ones, shows when they were read, and marks them as possibly out of date. In Claude Code, the status line gives a compact summary of up to four accounts. The Claude figures at the end appear when Claude Code provides them, which it does on Pro and Max plans:
143
147
 
144
148
  ```
@@ -265,7 +269,7 @@ omnitrix providers list the providers you can connect (--free for f
265
269
  omnitrix add <provider> connect an account (--label, --owner, --id, --key-env, --base-url, --model, --concurrency, limits)
266
270
  omnitrix login <id> sign in a CLI account in its own profile
267
271
  omnitrix list show accounts, usage and remaining quota (also "status"; --json for machine-readable output)
268
- omnitrix test <id> send a small request to check an account (--model picks one)
272
+ omnitrix test <id> send a small request to check an account (--model picks one); an empty answer counts as a failure
269
273
  omnitrix set <id> change limits, label, owner, key, base URL, priority, concurrency or --trains-on-data
270
274
  omnitrix enable|disable <id> enable or disable an account
271
275
  omnitrix remove <id> remove an account (--purge also deletes its login)
@@ -279,7 +283,7 @@ omnitrix setup-claude register with Claude Code (--scope user|project|
279
283
  omnitrix team join, review or leave a team file, and show your spending (join --as, --yes; leave; status)
280
284
  omnitrix usage requests, tokens and cost for the last 30 days (--by person|account|model, --days, --team)
281
285
  omnitrix clean delete finished jobs and worktrees older than 14 days (--days, --dry-run, --branches)
282
- omnitrix doctor check the setup
286
+ omnitrix doctor check the setup, including whether each account's last request worked; it sends nothing
283
287
  omnitrix mcp run the MCP server (Claude Code starts this itself)
284
288
  omnitrix statusline print the status line (Claude Code runs this itself)
285
289
  ```
package/dist/cli.js CHANGED
@@ -18,11 +18,12 @@ import { basisOf, isChatModel, makeModel, statsKey } from './models.js';
18
18
  import { loadStats } from './stats.js';
19
19
  import { PROVIDERS, getProvider } from './providers.js';
20
20
  import { renderStatusLine } from './statusline.js';
21
- import { deleteSecret, dropModel, ensureHome, files, findAccount, homeDir, inside, JOB_ID, loadConfig, updateConfig, readJson, redact, saveHealth, setSecret, uniqueAccountId } from './store.js';
21
+ import { deleteSecret, dropModel, ensureHome, files, findAccount, homeDir, inside, JOB_ID, loadConfig, loadHealth, updateConfig, readJson, redact, saveHealth, setSecret, uniqueAccountId } from './store.js';
22
22
  import { branchExists, branchMerged, deleteBranch, pruneWorktree } from './worktree.js';
23
23
  import { EFFORTS, DriverError, TASK_TYPES } from './types.js';
24
24
  import { refreshQuotas } from './quota.js';
25
25
  import { formatTokens, readLedger, recordUsage, typicalLatency } from './usage.js';
26
+ import { describeDelegated } from './value.js';
26
27
  /** A typical answer time as people read it: "4.2 s", "38 s", or "-" when there is none yet. */
27
28
  function seconds(ms) {
28
29
  // the same form as the router's "typical 4.2 s"
@@ -447,13 +448,23 @@ program
447
448
  const cfg = loadConfig();
448
449
  const acc = findAccount(cfg, id) ?? die(`no account "${id}"`);
449
450
  // try the listed models in order until one answers; a provider may still list models it has retired
450
- const queue = o.model ? [o.model] : acc.models.length ? acc.models.map((m) => m.id) : ['default'];
451
+ // a code-completion or scoring model in the list would fail a chat test for reasons of its own
452
+ const chat = acc.models.map((m) => m.id).filter(isChatModel);
453
+ const queue = o.model ? [o.model] : chat.length ? chat : acc.models.length ? acc.models.map((m) => m.id) : ['default'];
451
454
  for (const model of queue) {
452
455
  const t0 = Date.now();
453
456
  process.stdout.write(`testing ${id}/${model} ... `);
454
457
  try {
455
458
  const r = await runDriver({ account: acc, model, prompt: 'Reply with the single word OK.', timeoutMs: 180_000, maxOutputTokens: 64 });
456
459
  const ms = Date.now() - t0;
460
+ // an empty answer means the model cannot do chat work as it is, so it is not counted as a success
461
+ if (!r.text.trim()) {
462
+ console.log(`answered in ${(ms / 1000).toFixed(1)}s, but the answer was empty`);
463
+ if (!o.model)
464
+ continue;
465
+ fail(`${model} gave an empty answer; it may need more output room, or it may not suit chat tasks`);
466
+ return;
467
+ }
457
468
  const costUsd = r.costUsd ?? estimateCost(acc.models.find((m) => m.id === model), r.inputTokens, r.outputTokens);
458
469
  const rec = { ts: Date.now(), accountId: id, model, inputTokens: r.inputTokens, outputTokens: r.outputTokens, ok: true, latencyMs: ms, costUsd };
459
470
  // a test on a team account spends the team's money like any other request
@@ -627,10 +638,16 @@ program
627
638
  .action(async (o) => {
628
639
  // looking changes nothing; addAccount creates the data folder when something is connected
629
640
  const found = await detect(loadConfig());
641
+ // only --apply starts anything; looking, as the first step is described, changes nothing at all
642
+ const dashboard = async () => {
643
+ if (o.apply)
644
+ await showDashboard(DEFAULT_PORT, o.open, true).catch((err) => console.log(`could not open the dashboard: ${err instanceof Error ? err.message : err}`));
645
+ else
646
+ console.log('See the pool live with "omnitrix dashboard".');
647
+ };
630
648
  if (!found.length) {
631
649
  console.log('Nothing to connect was found. Run "omnitrix providers" to see what omnitrix supports.');
632
- // the dashboard shows the same first steps, and updates by itself once something is connected
633
- await showDashboard(DEFAULT_PORT, o.open, true).catch((err) => console.log(`could not open the dashboard: ${err instanceof Error ? err.message : err}`));
650
+ await dashboard();
634
651
  return;
635
652
  }
636
653
  console.log('Found on this computer:');
@@ -651,7 +668,7 @@ program
651
668
  }
652
669
  }
653
670
  console.log('\nTo use omnitrix from Claude Code, run "omnitrix setup-claude" once, then restart Claude Code.');
654
- await showDashboard(DEFAULT_PORT, o.open, true).catch((err) => console.log(`could not open the dashboard: ${err instanceof Error ? err.message : err}`));
671
+ await dashboard();
655
672
  });
656
673
  function money(v) {
657
674
  return `$${v.toFixed(2)}`;
@@ -806,6 +823,12 @@ program
806
823
  const k = key.replace(/[\p{Cc}\p{Cf}]/gu, '?');
807
824
  console.log(`${k.padEnd(width)}${`${g.n} requests`.padEnd(14)}${`${formatTokens(g.tokens)} tokens`.padEnd(16)}${money(g.cost).padEnd(10)}${g.failed ? `${g.failed} failed` : ''}`);
808
825
  }
826
+ // the work other accounts did instead of Claude; the team's shared log has no job verdicts
827
+ if (!o.team) {
828
+ const d = new Engine().delegated(o.days);
829
+ if (d.jobs)
830
+ console.log(`\n${describeDelegated(d)}.`);
831
+ }
809
832
  console.log('\nCosts are those reported by the provider, or estimated from model prices where they are known.');
810
833
  });
811
834
  program
@@ -957,6 +980,8 @@ program
957
980
  ok(fs.existsSync(homeDir()), `data folder ${homeDir()}`);
958
981
  const cfg = loadConfig();
959
982
  ok(cfg.accounts.length > 0, `${cfg.accounts.length} accounts`);
983
+ const health = loadHealth();
984
+ const answered = new Set(readLedger(Date.now() - 32 * 24 * 3600_000).filter((r) => r.ok).map((r) => r.accountId));
960
985
  for (const a of cfg.accounts) {
961
986
  if (a.driver === 'cli') {
962
987
  const tool = CLI_TOOLS[providerTool(a.provider)];
@@ -967,6 +992,17 @@ program
967
992
  ok(keyOk, `${a.id}: API key ${a.apiKey?.startsWith('env:') ? `from ${a.apiKey.slice(4)}` : a.local ? 'not needed' : 'saved'}`);
968
993
  }
969
994
  ok(a.models.length > 0, `${a.id}: ${a.models.length} models`);
995
+ // A key and a model list do not prove that requests work, so the last real request counts too.
996
+ // doctor itself sends nothing, so it never spends anyone's quota.
997
+ const h = health[a.id];
998
+ const broken = h && (h.state === 'auth_error' || h.state === 'disabled' || ((h.state === 'offline' || h.state === 'exhausted') && (h.until ?? Infinity) > Date.now()));
999
+ if (broken)
1000
+ ok(false, `${a.id}: last request failed: ${(h.reason ?? h.state).slice(0, 160)}`);
1001
+ else if (!answered.has(a.id))
1002
+ console.log(`note ${a.id}: no request has been sent yet; "omnitrix test ${a.id}" sends one`);
1003
+ }
1004
+ if (cfg.accounts.some((a) => a.apiKey?.startsWith('env:'))) {
1005
+ console.log('note Claude Code passes on only the key variables that existed when it started; restart it after setting one');
970
1006
  }
971
1007
  });
972
1008
  program.parseAsync().catch((err) => fail(err instanceof Error ? err.message : String(err)));
@@ -145,6 +145,9 @@ export async function ensureDashboard(opts = {}) {
145
145
  // After an upgrade the old version gives way. Exactly the process that answered is stopped, so a new
146
146
  // server started meanwhile by another `omnitrix init` is never stopped by mistake.
147
147
  if (running && running.version !== VERSION) {
148
+ // only a dashboard this data folder started gives way; one from another folder belongs to someone else's setup
149
+ if (recorded(port).pid !== running.pid)
150
+ throw new Error(`port ${port} is used by an omnitrix dashboard (${running.version}) of another omnitrix data folder; stop it from there, or choose another port with --port`);
148
151
  await stopProcess(port, running.pid);
149
152
  running = await ping(port);
150
153
  if (running && running.version !== VERSION)
package/dist/dashboard.js CHANGED
@@ -47,7 +47,7 @@ export function startDashboard(port) {
47
47
  let latest = '';
48
48
  let slowAt = 0;
49
49
  let openedAt = 0;
50
- const snapshot = () => JSON.stringify({ version: VERSION, accounts: engine.pool(), jobs: recentJobs(engine) });
50
+ const snapshot = () => JSON.stringify({ version: VERSION, accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7) });
51
51
  // Quota reads and local server probes run in the background and are throttled; the page never waits for them.
52
52
  const slowChecks = () => {
53
53
  if (Date.now() - slowAt < SLOW_MS)
@@ -134,7 +134,7 @@ export function startDashboard(port) {
134
134
  }
135
135
  if (req.url === '/api/status') {
136
136
  slowChecks();
137
- json(res, { version: VERSION, now: Date.now(), accounts: engine.pool(), jobs: recentJobs(engine) });
137
+ json(res, { version: VERSION, now: Date.now(), accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7) });
138
138
  return;
139
139
  }
140
140
  if (req.url === '/api/ping') {
@@ -204,263 +204,266 @@ export function serveDashboard(port) {
204
204
  // The page is one self-contained file: no fonts, scripts or images from other hosts, so it works offline
205
205
  // and sends nothing anywhere. The script below avoids backticks and backslashes because it lives in a
206
206
  // template literal.
207
- const PAGE = /* html */ `<!doctype html>
208
- <html lang="en">
209
- <head>
210
- <meta charset="utf-8">
211
- <meta name="viewport" content="width=device-width, initial-scale=1">
212
- <title>omnitrix</title>
213
- <style>
214
- :root{
215
- --bg:#f6f6f3;--surface:#ffffff;--tile:#efeee9;--line:rgba(20,20,19,.11);--line-strong:rgba(20,20,19,.2);
216
- --ink:#141413;--ink-2:#4d4c48;--ink-3:#66655f;
217
- --accent:#2563c9;--accent-bg:#e6eefb;--track:#e7e6e0;
218
- --ok:#1b6f35;--ok-bg:#e3f2e7;--warn:#8a5a00;--warn-bg:#fbf0d4;--bad:#b42323;--bad-bg:#fbe7e7;--idle:#55544f;--idle-bg:#ecebe6;
219
- --focus:#2563c9;--r:12px;--r-sm:8px;
220
- --font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
221
- --mono:ui-monospace,"Cascadia Mono",Consolas,Menlo,monospace;
222
- color-scheme:light;
223
- }
224
- @media (prefers-color-scheme:dark){:root{
225
- --bg:#181816;--surface:#21211f;--tile:#2a2a27;--line:rgba(255,255,255,.1);--line-strong:rgba(255,255,255,.2);
226
- --ink:#f0efea;--ink-2:#c9c8bf;--ink-3:#a3a299;
227
- --accent:#6ea3f2;--accent-bg:#1d2d45;--track:#34342f;
228
- --ok:#6fcf8b;--ok-bg:#16301f;--warn:#e9bf5c;--warn-bg:#382c0e;--bad:#f28b8b;--bad-bg:#3b1c1c;--idle:#bdbcb3;--idle-bg:#2f2f2b;
229
- --focus:#6ea3f2;color-scheme:dark;
230
- }}
231
- *{box-sizing:border-box}
232
- html{scroll-padding-top:72px}
233
- body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--font);-webkit-font-smoothing:antialiased}
234
- a{color:var(--accent)}
235
- :focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:4px}
236
- .wrap{max-width:1180px;margin:0 auto;padding:10px 24px 48px}
237
- header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 -24px 20px;padding:14px 24px;position:sticky;top:0;z-index:5;background:var(--bg)}
238
- @supports (background:color-mix(in srgb,red 50%,transparent)){header{background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(18px) saturate(140%);backdrop-filter:blur(18px) saturate(140%)}}
239
- .brand{display:flex;align-items:center;gap:10px}
240
- .brand h1{font-size:20px;font-weight:600;margin:0;line-height:1.2;letter-spacing:-.015em}
241
- .chip{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;line-height:1;padding:5px 9px;border-radius:999px;background:var(--tile);color:var(--ink-2);white-space:nowrap}
242
- .fresh{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--ink-2)}
243
- .dot{width:8px;height:8px;border-radius:50%;background:var(--ok);flex:none}
244
- .fresh.stale .dot{background:var(--warn)}.fresh.stale{color:var(--warn)}
245
- .kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:28px}
246
- .kpi{background:var(--tile);border-radius:var(--r);padding:14px 16px}
247
- .kpi span{display:block;font-size:13px;color:var(--ink-2)}
248
- .kpi b{display:block;font-size:26px;font-weight:600;line-height:1.15;margin-top:4px;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
249
- h2{font-size:15px;font-weight:600;margin:0 0 12px;letter-spacing:-.005em;display:flex;align-items:baseline;gap:8px}
250
- h2 small{font-size:13px;font-weight:400;color:var(--ink-3)}
251
- .kpi em{display:block;font-style:normal;font-size:13px;color:var(--warn);margin-top:2px}
252
- .ver{font-size:13px;color:var(--ink-3)}
253
- .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:14px;margin-bottom:32px}
254
- .card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px 18px;display:flex;flex-direction:column;gap:12px;min-width:0}
255
- .head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
256
- .title{display:flex;align-items:center;gap:10px;min-width:0}
257
- .title svg{flex:none;color:var(--ink-2)}
258
- .title h3{font-size:16px;font-weight:600;margin:0;line-height:1.3;letter-spacing:-.01em;overflow-wrap:break-word}
259
- .sub{font-size:13px;color:var(--ink-3);margin-top:1px;overflow-wrap:break-word}
260
- .state{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:500;padding:4px 10px;border-radius:999px;white-space:nowrap}
261
- .state i{width:7px;height:7px;border-radius:50%;background:currentColor}
262
- .s-ok{background:var(--ok-bg);color:var(--ok)}.s-busy{background:var(--accent-bg);color:var(--accent)}
263
- .s-warn{background:var(--warn-bg);color:var(--warn)}.s-bad{background:var(--bad-bg);color:var(--bad)}.s-idle{background:var(--idle-bg);color:var(--idle)}
264
- .note{font-size:13.5px;border-radius:var(--r-sm);padding:9px 11px;background:var(--tile);color:var(--ink-2)}
265
- .note.warn{background:var(--warn-bg);color:var(--warn)}.note.bad{background:var(--bad-bg);color:var(--bad)}
266
- .note code,.empty code{font:12.5px var(--mono);background:var(--surface);color:var(--ink);padding:1px 6px;border-radius:5px;border:1px solid var(--line)}
267
- .win+.win{margin-top:10px}
268
- .row{display:flex;justify-content:space-between;gap:10px;font-size:13.5px}
269
- .row span:first-child{color:var(--ink-2)}.row b{font-weight:600;font-variant-numeric:tabular-nums}
270
- .row b.low{color:var(--warn)}.row b.out{color:var(--bad)}
271
- .bar{height:8px;border-radius:99px;background:var(--track);overflow:hidden;margin:6px 0 4px}
272
- .bar i{display:block;height:100%;border-radius:99px;background:var(--accent);transition:width .4s ease}
273
- .bar i.low{background:var(--warn)}.bar i.out{background:var(--bad)}
274
- .when{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3)}
275
- .when.pace{color:var(--warn)}
276
- .prov{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3);display:flex;align-items:center;gap:6px}
277
- .stats{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:13px;color:var(--ink-2);border-top:1px solid var(--line);padding-top:10px}
278
- .stats b{font-weight:600;color:var(--ink);font-variant-numeric:tabular-nums}
279
- .stats .prov{margin-left:auto}
280
- details{font-size:13px;color:var(--ink-2)}
281
- summary{cursor:pointer;color:var(--ink-2);width:max-content;padding:4px 0;min-height:24px}
282
- summary:hover{color:var(--ink)}
283
- summary:active{color:var(--ink)}
284
- .models{margin:8px 0 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:6px}
285
- .models li{font:12px var(--mono);background:var(--tile);border-radius:6px;padding:3px 7px;overflow-wrap:anywhere}
286
- .jobs{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);overflow:hidden;list-style:none;margin:0;padding:0}
287
- .job{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:4px 14px;align-items:start;padding:12px 16px;border-top:1px solid var(--line)}
288
- .job:first-child{border-top:0}
289
- .job .t{font-weight:500;overflow-wrap:anywhere}
290
- .job .m{font:12px/1.6 var(--mono);color:var(--ink-3);overflow-wrap:anywhere}
291
- .job .r{font-size:13px;color:var(--ink-3);text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
292
- .job details{grid-column:2/4;margin-top:4px}
293
- .job .err{color:var(--bad);font:12.5px/1.5 var(--mono);margin-top:6px;white-space:pre-wrap;overflow-wrap:anywhere}
294
- .job .vf{grid-column:2/4;color:var(--ink-2);font-size:12.5px;line-height:1.5;overflow-wrap:anywhere}
295
- .job .vf.warn{color:var(--warn)}
296
- .empty{background:var(--surface);border:1px dashed var(--line-strong);border-radius:var(--r);padding:22px;color:var(--ink-2)}
297
- .empty h3{margin:0 0 6px;font-size:16px;color:var(--ink)}
298
- .empty ol{margin:10px 0 0;padding-left:20px;line-height:2}
299
- footer{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3);margin-top:28px}
300
- .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
301
- @media (max-width:720px){.wrap{padding:6px 16px 40px}header{margin:0 -16px 16px;padding:12px 16px}html{scroll-padding-top:112px}.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.kpi b{font-size:22px}.job{grid-template-columns:auto minmax(0,1fr)}.job .r{grid-column:2;text-align:left}.job details{grid-column:1/3}.job .vf{grid-column:2/3}}
302
- @media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
303
- @media (max-height:500px){header{position:static}html{scroll-padding-top:0}}
304
- @media (prefers-reduced-transparency:reduce),(prefers-contrast:more){header{background:var(--bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-bottom:1px solid var(--line)}}
305
- @media (prefers-contrast:more){:root{--line:var(--line-strong);--ink-3:var(--ink-2)}.card,.jobs,.kpi,.bar{border:1px solid var(--ink-3)}}
306
- @media (forced-colors:active){.bar{border:1px solid CanvasText}.bar i,.dot,.state i{forced-color-adjust:none;background:Highlight}header{background:Canvas;-webkit-backdrop-filter:none;backdrop-filter:none}}
307
- </style>
308
- </head>
309
- <body>
310
- <div class="wrap">
311
- <header>
312
- <div class="brand"><h1>omnitrix</h1><span class="ver" id="ver"></span></div>
313
- <div class="fresh" id="fresh"><span class="dot" aria-hidden="true"></span><span id="fresh-text">Connecting</span></div>
314
- <div class="sr" id="announce" role="status"></div>
315
- </header>
316
- <main>
317
- <section class="kpis" id="kpis" aria-label="Summary for the last 24 hours"></section>
318
- <section aria-labelledby="acc-h"><h2 id="acc-h">Accounts <small id="acc-sub"></small></h2><div class="grid" id="accounts"></div></section>
319
- <section aria-labelledby="job-h"><h2 id="job-h">Recent jobs <small>newest first</small></h2><div id="jobs"></div></section>
320
- </main>
321
- <footer>This page only shows status. Change accounts and settings with the omnitrix command.</footer>
322
- </div>
323
- <script>
324
- var esc=function(s){return String(s==null?'':s).replace(/[&<>"']/g,function(c){return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]})};
325
- var fmt=function(n){n=Number(n)||0;return n>=999500?(n/1e6).toFixed(1)+'M':n>=1e3?(Math.round(n/100)/10)+'k':String(Math.round(n))};
326
- var money=function(c){c=Number(c)||0;return c>0&&c<0.005?'under $0.01':'$'+c.toFixed(2)};
327
- var clock=function(t){return new Date(t).toLocaleString([],{weekday:'short',hour:'numeric',minute:'2-digit'})};
328
- var span=function(ms){var m=Math.max(0,Math.round(ms/60000));return m<1?'under a minute':m<60?m+' min':m<1440?Math.floor(m/60)+' h'+(m%60?' '+(m%60)+' min':''):Math.floor(m/1440)+' d '+Math.floor(m%1440/60)+' h'};
329
- var ago=function(t){var s=Math.round((Date.now()-t)/1000);return s<60?s+' s ago':s<3600?Math.round(s/60)+' min ago':s<172800?Math.round(s/3600)+' h ago':Math.round(s/86400)+' days ago'};
330
- function icon(name){
331
- var p={terminal:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M7 9l3 3-3 3M12 15h5"/>',
332
- cloud:'<path d="M7 18a4.5 4.5 0 0 1-.5-9 6 6 0 0 1 11.5 1.5A3.75 3.75 0 0 1 17.5 18z"/>',
333
- chip:'<rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/>'}[name];
334
- return '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+p+'</svg>';
335
- }
336
- var STATES={ready:['Ready','s-ok'],busy:['Working','s-busy'],cooling:['Resting','s-warn'],exhausted:['Out of quota','s-bad'],offline:['Offline','s-warn'],auth_error:['Needs sign-in','s-bad'],disabled:['Turned off','s-idle']};
337
- var SOURCES={measured:'Measured by the provider',estimated:'Counted by omnitrix against your limits',untracked:'Not tracked'};
338
- function windowHtml(w){
339
- var pct=w.unit==='percent', left=pct?Math.max(0,Math.min(100,w.remaining)):(w.limit>0?Math.max(0,Math.min(100,w.remaining/w.limit*100)):0);
340
- var cls=left<=0?'out':left<20?'low':'';
341
- var amount=pct?Math.round(left)+'% left':fmt(w.remaining)+' of '+fmt(w.limit)+' '+esc(w.unit)+' left';
342
- var label=esc(w.name)+(pct?'':' ('+esc(w.unit)+')');
343
- var reset=w.resetsAt?'<div class="when">Resets in '+esc(span(w.resetsAt-Date.now()))+', '+esc(clock(w.resetsAt))+'</div>':'';
344
- // the server only sends runsOutAt when the current pace empties the window before it resets
345
- if(w.runsOutAt&&w.runsOutAt>Date.now())reset+='<div class="when pace">At this pace it runs out in about '+esc(span(w.runsOutAt-Date.now()))+', '+esc(clock(w.runsOutAt))+'</div>';
346
- return '<div class="win"><div class="row"><span>'+label+'</span><b class="'+cls+'">'+amount+'</b></div>'
347
- +'<div class="bar" role="progressbar" aria-label="'+label+' remaining" aria-valuemin="0" aria-valuemax="100" aria-valuenow="'+Math.round(left)+'" aria-valuetext="'+esc(amount)+'"><i class="'+cls+'" style="width:'+left.toFixed(1)+'%"></i></div>'+reset+'</div>';
348
- }
349
- function cardHtml(a,open){
350
- var u=a.usage, st=STATES[a.state]||['Unknown','s-idle'];
351
- var ico=a.local?'chip':a.driver==='cli'?'terminal':'cloud';
352
- var facts=[a.owner?'Owned by '+esc(a.owner):'',esc(a.id),u.plan?esc(u.plan)+' plan':'',a.local?'Runs on this PC':'',a.trainsOnData?'Public tasks only':'',a.running?a.running+' job'+(a.running>1?'s':'')+' running':''];
353
- var sub=facts.filter(Boolean).join(' · ');
354
- var notes='';
355
- if(a.state!=='ready'&&a.state!=='busy'){
356
- var DEFAULT={exhausted:'No quota left in the current window',offline:'omnitrix cannot reach this account',cooling:'Taking a short break after errors',auth_error:'Not signed in',disabled:'Turned off in omnitrix'};
357
- // the engine's own reasons are lower case ("rate limited"); here they start a sentence. Provider
358
- // messages pass through untouched, since they may begin with a name like "openai".
359
- var why=String(a.reason||DEFAULT[a.state]||'').replace(/[.]+$/,'');
360
- if(/^(rate limited|provider error|no answer|every model is paused)/.test(why))why=why.charAt(0).toUpperCase()+why.slice(1);
361
- var back=a.until?' Back in '+esc(span(a.until-Date.now()))+', '+esc(clock(a.until))+'.':'';
362
- var fix=a.state==='auth_error'?' Run <code>omnitrix login '+esc(a.id)+'</code> to sign in again.':a.state==='disabled'?' Run <code>omnitrix enable '+esc(a.id)+'</code> to turn it on.':'';
363
- var text=(why?esc(why)+'.':'')+back+fix;
364
- if(text)notes+='<div class="note '+(st[1]==='s-bad'?'bad':st[1]==='s-warn'?'warn':'')+'">'+text+'</div>';
365
- }
366
- var paused=a.pausedModels||[];
367
- if(paused.length)notes+='<div class="note warn">Resting after errors: '+esc(paused.join(', '))+'.'+(paused.length<(a.models||[]).length?' omnitrix uses the other models meanwhile.':'')+'</div>';
368
- var quota=u.windows.length?u.windows.map(windowHtml).join('')
369
- :a.local?'<div class="note">No usage limit. It runs on this PC.</div>'
370
- :a.state==='auth_error'||a.state==='disabled'?''
371
- :a.driver==='cli'?'<div class="note">This plan does not publish its limits, so omnitrix shows what it has sent below.</div>'
372
- :'<div class="note">No limit is known for this account, so omnitrix cannot show what is left. To track one, run <code>omnitrix set '+esc(a.id)+' --rpd 1000</code> with your real daily limit.</div>';
373
- var models=a.models||[], shown=models.slice(0,40);
374
- var modelHtml=models.length?'<details data-key="m-'+esc(a.id)+'"'+(open['m-'+a.id]?' open':'')+'><summary>'+models.length+' model'+(models.length>1?'s':'')+'</summary><ul class="models">'+shown.map(function(m){return '<li>'+esc(m)+'</li>'}).join('')+(models.length>shown.length?'<li>and '+(models.length-shown.length)+' more</li>':'')+'</ul></details>':'';
375
- return '<article class="card" aria-label="'+esc(a.label)+'">'
376
- +'<div class="head"><div class="title">'+icon(ico)+'<div><h3>'+esc(a.label)+'</h3><div class="sub">'+sub+'</div></div></div><span class="state '+st[1]+'"><i aria-hidden="true"></i>'+st[0]+'</span></div>'
377
- +(quota?'<div>'+quota+'</div>':'')+notes
378
- +'<div class="stats"><span>Last 24 h</span><span><b>'+u.requestsToday+'</b> request'+(u.requestsToday===1?'':'s')+'</span><span><b>'+fmt(u.tokensToday)+'</b> tokens</span>'+(u.costToday?'<span><b>'+money(u.costToday)+'</b></span>':'')
379
- +(u.windows.length?'<span class="prov">'+esc(SOURCES[u.source]||u.source)+(u.updatedAt&&!u.stale?', updated '+esc(ago(u.updatedAt)):'')+'</span>':'')+'</div>'
380
- +(u.stale&&u.updatedAt?'<div class="note warn">omnitrix could not read these numbers again. They are from '+esc(clock(u.updatedAt))+' and may be out of date.</div>':'')
381
- +modelHtml+'</article>';
382
- }
383
- var JOB={done:['Done','s-ok'],running:['Running','s-busy'],queued:['Waiting','s-idle'],failed:['Failed','s-bad'],cancelled:['Cancelled','s-idle']};
384
- function jobHtml(j,open){
385
- var st=JOB[j.status]||[j.status,'s-idle'];
386
- var tokens=j.usage?fmt(j.usage.inputTokens+j.usage.outputTokens)+' tokens':'';
387
- var verdict=j.verdict?(j.verdict==='accepted'?'Accepted by Claude':'Rejected by Claude'):'';
388
- var err=j.error&&j.status!=='done'?'<details data-key="e-'+esc(j.id)+'"'+(open['e-'+j.id]?' open':'')+'><summary>Why it '+(j.status==='failed'?'failed':'stopped')+'</summary><div class="err">'+esc(j.error)+'</div></details>':'';
389
- return '<li class="job"><span class="state '+st[1]+'"><i aria-hidden="true"></i>'+st[0]+'</span>'
390
- +'<div><div class="t">'+esc(j.task.title)+'</div><div class="m">'+esc(j.task.type)+(j.accountId?' · '+esc(j.accountId)+(j.model?' / '+esc(j.model):''):'')+'</div></div>'
391
- +'<div class="r">'+[tokens,ago(j.createdAt)].filter(Boolean).join(' · ')+(verdict?'<div>'+verdict+'</div>':'')+'</div>'+err
392
- +(j.verify?'<div class="vf'+(j.verify.warn?' warn':'')+'">Checked by omnitrix: '+esc(j.verify.summary)+'</div>':'')+checkHtml(j.check)+'</li>';
393
- }
394
- // the second model's check, on the job it checks; a check that could not run is not a failure of the job
395
- function checkHtml(c){
396
- if(!c)return '';
397
- var by=c.by?' by '+esc(c.by):'', note=c.note?' '+esc(c.note):'';
398
- var text=c.status==='pass'?'Second check'+by+': passed.'+note
399
- :c.status==='fail'?'Second check'+by+': failed.'+note
400
- :c.status==='unclear'?'Second check'+by+' gave no clear answer.'+note
401
- :c.status==='pending'?'Second check is running.'
402
- :'Second check not run:'+note;
403
- return '<div class="vf'+(c.status==='fail'||c.status==='unclear'?' warn':'')+'">'+text+'</div>';
404
- }
405
- var last=0, wasStale=null, lastRaw='', drawnMinute=-1, started=Date.now(), connected=false, savedAt=0, down=false;
406
- function tick(){
407
- var el=document.getElementById('fresh'), t=document.getElementById('fresh-text');
408
- // a stream that dropped counts as lost at once; a quiet one only after it missed its signs of life
409
- var stale=connected?(down||Date.now()-last>15000):Date.now()-started>8000;
410
- el.className='fresh'+(stale?' stale':'');
411
- t.textContent=!connected&&!last?(stale?'Cannot reach omnitrix. Trying again. If this stays, run omnitrix dashboard in a terminal.':'Connecting')
412
- :!connected?(stale?'Cannot reach omnitrix. Trying again. Showing data from '+new Date(savedAt).toLocaleTimeString()+'.':'Connecting. Showing data from '+new Date(savedAt).toLocaleTimeString()+'.')
413
- :stale?'Connection lost. Trying again. Showing data from '+new Date(last).toLocaleTimeString()+'.':'Live, updated '+ago(last);
414
- // screen readers hear only a change between live and unreachable, not every second of the clock
415
- if(stale!==wasStale){document.getElementById('announce').textContent=stale?'omnitrix cannot be reached':(last?'omnitrix is live':'');wasStale=stale}
416
- }
417
- function draw(d){
418
- var focused=document.activeElement&&document.activeElement.closest?document.activeElement.closest('details[data-key]'):null;
419
- var focusKey=focused?focused.getAttribute('data-key'):null;
420
- var open={};document.querySelectorAll('details[data-key]').forEach(function(x){if(x.open)open[x.getAttribute('data-key')]=true});
421
- document.getElementById('ver').textContent='v'+d.version;
422
- var acc=d.accounts, ready=acc.filter(function(a){return a.state==='ready'||a.state==='busy'}).length;
423
- var sum=function(k){return acc.reduce(function(s,a){return s+(a.usage[k]||0)},0)};
424
- var attention=acc.filter(function(a){return a.enabled&&a.state!=='ready'&&a.state!=='busy'}).length;
425
- document.getElementById('kpis').innerHTML='<div class="kpi"><span>Accounts ready</span><b>'+ready+' of '+acc.length+'</b>'+(attention?'<em>'+attention+' need'+(attention>1?'':'s')+' attention</em>':'')+'</div>'
426
- +[['Requests, last 24 h',String(sum('requestsToday'))],['Tokens, last 24 h',fmt(sum('tokensToday'))],['Known cost, last 24 h',money(sum('costToday'))]]
427
- .map(function(k){return '<div class="kpi"><span>'+k[0]+'</span><b>'+esc(k[1])+'</b></div>'}).join('');
428
- document.getElementById('acc-sub').textContent=acc.length?acc.length+' connected':'';
429
- document.getElementById('accounts').innerHTML=acc.length?acc.map(function(a){return cardHtml(a,open)}).join('')
430
- :'<div class="empty"><h3>Connect your first account</h3>omnitrix has no accounts yet. In a terminal:<ol><li><code>omnitrix init --apply</code> connects the AI tools, API keys and local models it finds on this PC</li><li><code>omnitrix providers</code> lists what you can connect</li><li><code>omnitrix add ollama</code> adds models on this PC</li><li><code>omnitrix setup-claude</code> connects omnitrix to Claude Code</li></ol></div>';
431
- document.getElementById('jobs').innerHTML=d.jobs.length?'<ul class="jobs">'+d.jobs.map(function(j){return jobHtml(j,open)}).join('')+'</ul>'
432
- :'<div class="empty"><h3>No jobs yet</h3>Ask Claude to hand out a task, and it shows up here.</div>';
433
- if(focusKey){var again=document.querySelector('details[data-key="'+focusKey+'"] summary');if(again)again.focus({preventScroll:true})}
434
- tick();
435
- }
436
- // Draws a new state, and the same state again once a minute so times such as "5 min ago" stay right.
437
- function show(raw,live){
438
- var minute=Math.floor(Date.now()/60000);
439
- if(live){last=Date.now();connected=true}
440
- if(raw===lastRaw&&minute===drawnMinute){tick();return}
441
- var d;try{d=JSON.parse(raw)}catch(e){return}
442
- lastRaw=raw;drawnMinute=minute;
443
- if(live){try{localStorage.setItem('omnitrix-state',raw);localStorage.setItem('omnitrix-state-at',String(Date.now()))}catch(e){}}
444
- draw(d);
445
- }
446
- // The last state this browser saw is drawn at once, then the live stream takes over.
447
- try{var saved=localStorage.getItem('omnitrix-state');savedAt=Number(localStorage.getItem('omnitrix-state-at'))||0;if(saved)show(saved,false)}catch(e){}
448
- var stream=null;
449
- function connect(){
450
- if(!window.EventSource){poll();return}
451
- stream=new EventSource('/api/events');
452
- stream.onopen=function(){down=false;tick()};
453
- stream.onmessage=function(e){down=false;show(e.data,true)};
454
- stream.addEventListener('alive',function(){down=false;last=Date.now();connected=true;if(lastRaw)show(lastRaw,false);tick()});
455
- stream.onerror=function(){down=true;tick()};
456
- }
457
- async function poll(){
458
- try{show(await (await fetch('/api/status',{cache:'no-store'})).text(),true)}catch(e){tick()}
459
- setTimeout(poll,4000);
460
- }
461
- // The browser retries a dropped stream by itself; if it gives up, for example while the server restarts, start a new one.
462
- setInterval(function(){if(stream&&stream.readyState===2)connect()},3000);
463
- connect();setInterval(tick,1000);
464
- </script>
465
- </body>
207
+ const PAGE = /* html */ `<!doctype html>
208
+ <html lang="en">
209
+ <head>
210
+ <meta charset="utf-8">
211
+ <meta name="viewport" content="width=device-width, initial-scale=1">
212
+ <title>omnitrix</title>
213
+ <style>
214
+ :root{
215
+ --bg:#f6f6f3;--surface:#ffffff;--tile:#efeee9;--line:rgba(20,20,19,.11);--line-strong:rgba(20,20,19,.2);
216
+ --ink:#141413;--ink-2:#4d4c48;--ink-3:#66655f;
217
+ --accent:#2563c9;--accent-bg:#e6eefb;--track:#e7e6e0;
218
+ --ok:#1b6f35;--ok-bg:#e3f2e7;--warn:#8a5a00;--warn-bg:#fbf0d4;--bad:#b42323;--bad-bg:#fbe7e7;--idle:#55544f;--idle-bg:#ecebe6;
219
+ --focus:#2563c9;--r:12px;--r-sm:8px;
220
+ --font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
221
+ --mono:ui-monospace,"Cascadia Mono",Consolas,Menlo,monospace;
222
+ color-scheme:light;
223
+ }
224
+ @media (prefers-color-scheme:dark){:root{
225
+ --bg:#181816;--surface:#21211f;--tile:#2a2a27;--line:rgba(255,255,255,.1);--line-strong:rgba(255,255,255,.2);
226
+ --ink:#f0efea;--ink-2:#c9c8bf;--ink-3:#a3a299;
227
+ --accent:#6ea3f2;--accent-bg:#1d2d45;--track:#34342f;
228
+ --ok:#6fcf8b;--ok-bg:#16301f;--warn:#e9bf5c;--warn-bg:#382c0e;--bad:#f28b8b;--bad-bg:#3b1c1c;--idle:#bdbcb3;--idle-bg:#2f2f2b;
229
+ --focus:#6ea3f2;color-scheme:dark;
230
+ }}
231
+ *{box-sizing:border-box}
232
+ html{scroll-padding-top:72px}
233
+ body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--font);-webkit-font-smoothing:antialiased}
234
+ a{color:var(--accent)}
235
+ :focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:4px}
236
+ .wrap{max-width:1180px;margin:0 auto;padding:10px 24px 48px}
237
+ header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 -24px 20px;padding:14px 24px;position:sticky;top:0;z-index:5;background:var(--bg)}
238
+ @supports (background:color-mix(in srgb,red 50%,transparent)){header{background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(18px) saturate(140%);backdrop-filter:blur(18px) saturate(140%)}}
239
+ .brand{display:flex;align-items:center;gap:10px}
240
+ .brand h1{font-size:20px;font-weight:600;margin:0;line-height:1.2;letter-spacing:-.015em}
241
+ .chip{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;line-height:1;padding:5px 9px;border-radius:999px;background:var(--tile);color:var(--ink-2);white-space:nowrap}
242
+ .fresh{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--ink-2)}
243
+ .dot{width:8px;height:8px;border-radius:50%;background:var(--ok);flex:none}
244
+ .fresh.stale .dot{background:var(--warn)}.fresh.stale{color:var(--warn)}
245
+ .kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:28px}
246
+ .kpi{background:var(--tile);border-radius:var(--r);padding:14px 16px}
247
+ .kpi span{display:block;font-size:13px;color:var(--ink-2)}
248
+ .kpi b{display:block;font-size:26px;font-weight:600;line-height:1.15;margin-top:4px;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
249
+ h2{font-size:15px;font-weight:600;margin:0 0 12px;letter-spacing:-.005em;display:flex;align-items:baseline;gap:8px}
250
+ h2 small{font-size:13px;font-weight:400;color:var(--ink-3)}
251
+ .kpi em{display:block;font-style:normal;font-size:13px;color:var(--warn);margin-top:2px}.kpi small{display:block;font-size:13px;color:var(--ink-2);margin-top:2px}
252
+ .ver{font-size:13px;color:var(--ink-3)}
253
+ .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:14px;margin-bottom:32px}
254
+ .card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px 18px;display:flex;flex-direction:column;gap:12px;min-width:0}
255
+ .head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
256
+ .title{display:flex;align-items:center;gap:10px;min-width:0}
257
+ .title svg{flex:none;color:var(--ink-2)}
258
+ .title h3{font-size:16px;font-weight:600;margin:0;line-height:1.3;letter-spacing:-.01em;overflow-wrap:break-word}
259
+ .sub{font-size:13px;color:var(--ink-3);margin-top:1px;overflow-wrap:break-word}
260
+ .state{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:500;padding:4px 10px;border-radius:999px;white-space:nowrap}
261
+ .state i{width:7px;height:7px;border-radius:50%;background:currentColor}
262
+ .s-ok{background:var(--ok-bg);color:var(--ok)}.s-busy{background:var(--accent-bg);color:var(--accent)}
263
+ .s-warn{background:var(--warn-bg);color:var(--warn)}.s-bad{background:var(--bad-bg);color:var(--bad)}.s-idle{background:var(--idle-bg);color:var(--idle)}
264
+ .note{font-size:13.5px;border-radius:var(--r-sm);padding:9px 11px;background:var(--tile);color:var(--ink-2)}
265
+ .note.warn{background:var(--warn-bg);color:var(--warn)}.note.bad{background:var(--bad-bg);color:var(--bad)}
266
+ .note code,.empty code{font:12.5px var(--mono);background:var(--surface);color:var(--ink);padding:1px 6px;border-radius:5px;border:1px solid var(--line)}
267
+ .win+.win{margin-top:10px}
268
+ .row{display:flex;justify-content:space-between;gap:10px;font-size:13.5px}
269
+ .row span:first-child{color:var(--ink-2)}.row b{font-weight:600;font-variant-numeric:tabular-nums}
270
+ .row b.low{color:var(--warn)}.row b.out{color:var(--bad)}
271
+ .bar{height:8px;border-radius:99px;background:var(--track);overflow:hidden;margin:6px 0 4px}
272
+ .bar i{display:block;height:100%;border-radius:99px;background:var(--accent);transition:width .4s ease}
273
+ .bar i.low{background:var(--warn)}.bar i.out{background:var(--bad)}
274
+ .when{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3)}
275
+ .when.pace{color:var(--warn)}
276
+ .prov{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3);display:flex;align-items:center;gap:6px}
277
+ .stats{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:13px;color:var(--ink-2);border-top:1px solid var(--line);padding-top:10px}
278
+ .stats b{font-weight:600;color:var(--ink);font-variant-numeric:tabular-nums}
279
+ .stats .prov{margin-left:auto}
280
+ details{font-size:13px;color:var(--ink-2)}
281
+ summary{cursor:pointer;color:var(--ink-2);width:max-content;padding:4px 0;min-height:24px}
282
+ summary:hover{color:var(--ink)}
283
+ summary:active{color:var(--ink)}
284
+ .models{margin:8px 0 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:6px}
285
+ .models li{font:12px var(--mono);background:var(--tile);border-radius:6px;padding:3px 7px;overflow-wrap:anywhere}
286
+ .jobs{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);overflow:hidden;list-style:none;margin:0;padding:0}
287
+ .job{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:4px 14px;align-items:start;padding:12px 16px;border-top:1px solid var(--line)}
288
+ .job:first-child{border-top:0}
289
+ .job .t{font-weight:500;overflow-wrap:anywhere}
290
+ .job .m{font:12px/1.6 var(--mono);color:var(--ink-3);overflow-wrap:anywhere}
291
+ .job .r{font-size:13px;color:var(--ink-3);text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
292
+ .job details{grid-column:2/4;margin-top:4px}
293
+ .job .err{color:var(--bad);font:12.5px/1.5 var(--mono);margin-top:6px;white-space:pre-wrap;overflow-wrap:anywhere}
294
+ .job .vf{grid-column:2/4;color:var(--ink-2);font-size:12.5px;line-height:1.5;overflow-wrap:anywhere}
295
+ .job .vf.warn{color:var(--warn)}.stats .warn{color:var(--warn)}
296
+ .empty{background:var(--surface);border:1px dashed var(--line-strong);border-radius:var(--r);padding:22px;color:var(--ink-2)}
297
+ .empty h3{margin:0 0 6px;font-size:16px;color:var(--ink)}
298
+ .empty ol{margin:10px 0 0;padding-left:20px;line-height:2}
299
+ footer{font-size:12.5px;letter-spacing:.005em;color:var(--ink-3);margin-top:28px}
300
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
301
+ @media (max-width:720px){.wrap{padding:6px 16px 40px}header{margin:0 -16px 16px;padding:12px 16px}html{scroll-padding-top:112px}.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.kpi b{font-size:22px}.job{grid-template-columns:auto minmax(0,1fr)}.job .r{grid-column:2;text-align:left}.job details{grid-column:1/3}.job .vf{grid-column:2/3}}
302
+ @media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
303
+ @media (max-height:500px){header{position:static}html{scroll-padding-top:0}}
304
+ @media (prefers-reduced-transparency:reduce),(prefers-contrast:more){header{background:var(--bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-bottom:1px solid var(--line)}}
305
+ @media (prefers-contrast:more){:root{--line:var(--line-strong);--ink-3:var(--ink-2)}.card,.jobs,.kpi,.bar{border:1px solid var(--ink-3)}}
306
+ @media (forced-colors:active){.bar{border:1px solid CanvasText}.bar i,.dot,.state i{forced-color-adjust:none;background:Highlight}header{background:Canvas;-webkit-backdrop-filter:none;backdrop-filter:none}}
307
+ </style>
308
+ </head>
309
+ <body>
310
+ <div class="wrap">
311
+ <header>
312
+ <div class="brand"><h1>omnitrix</h1><span class="ver" id="ver"></span></div>
313
+ <div class="fresh" id="fresh"><span class="dot" aria-hidden="true"></span><span id="fresh-text">Connecting</span></div>
314
+ <div class="sr" id="announce" role="status"></div>
315
+ </header>
316
+ <main>
317
+ <section class="kpis" id="kpis" aria-label="Summary for the last 24 hours"></section>
318
+ <section aria-labelledby="acc-h"><h2 id="acc-h">Accounts <small id="acc-sub"></small></h2><div class="grid" id="accounts"></div></section>
319
+ <section aria-labelledby="job-h"><h2 id="job-h">Recent jobs <small>newest first</small></h2><div id="jobs"></div></section>
320
+ </main>
321
+ <footer>This page only shows status. Change accounts and settings with the omnitrix command.</footer>
322
+ </div>
323
+ <script>
324
+ var esc=function(s){return String(s==null?'':s).replace(/[&<>"']/g,function(c){return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]})};
325
+ var fmt=function(n){n=Number(n)||0;return n>=999500?(n/1e6).toFixed(1)+'M':n>=1e3?(Math.round(n/100)/10)+'k':String(Math.round(n))};
326
+ var money=function(c){c=Number(c)||0;return c>0&&c<0.005?'under $0.01':'$'+c.toFixed(2)};
327
+ var clock=function(t){return new Date(t).toLocaleString([],{weekday:'short',hour:'numeric',minute:'2-digit'})};
328
+ var span=function(ms){var m=Math.max(0,Math.round(ms/60000));return m<1?'under a minute':m<60?m+' min':m<1440?Math.floor(m/60)+' h'+(m%60?' '+(m%60)+' min':''):Math.floor(m/1440)+' d '+Math.floor(m%1440/60)+' h'};
329
+ var ago=function(t){var s=Math.round((Date.now()-t)/1000);return s<60?s+' s ago':s<3600?Math.round(s/60)+' min ago':s<172800?Math.round(s/3600)+' h ago':Math.round(s/86400)+' days ago'};
330
+ function icon(name){
331
+ var p={terminal:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M7 9l3 3-3 3M12 15h5"/>',
332
+ cloud:'<path d="M7 18a4.5 4.5 0 0 1-.5-9 6 6 0 0 1 11.5 1.5A3.75 3.75 0 0 1 17.5 18z"/>',
333
+ chip:'<rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/>'}[name];
334
+ return '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+p+'</svg>';
335
+ }
336
+ var STATES={ready:['Ready','s-ok'],busy:['Working','s-busy'],cooling:['Resting','s-warn'],exhausted:['Out of quota','s-bad'],offline:['Offline','s-warn'],auth_error:['Needs sign-in','s-bad'],disabled:['Turned off','s-idle']};
337
+ var SOURCES={measured:'Measured by the provider',estimated:'Counted by omnitrix against your limits',untracked:'Not tracked'};
338
+ function windowHtml(w){
339
+ var pct=w.unit==='percent', left=pct?Math.max(0,Math.min(100,w.remaining)):(w.limit>0?Math.max(0,Math.min(100,w.remaining/w.limit*100)):0);
340
+ var cls=left<=0?'out':left<20?'low':'';
341
+ var amount=pct?Math.round(left)+'% left':fmt(w.remaining)+' of '+fmt(w.limit)+' '+esc(w.unit)+' left';
342
+ var label=esc(w.name)+(pct?'':' ('+esc(w.unit)+')');
343
+ var reset=w.resetsAt?'<div class="when">Resets in '+esc(span(w.resetsAt-Date.now()))+', '+esc(clock(w.resetsAt))+'</div>':'';
344
+ // the server only sends runsOutAt when the current pace empties the window before it resets
345
+ if(w.runsOutAt&&w.runsOutAt>Date.now())reset+='<div class="when pace">At this pace it runs out in about '+esc(span(w.runsOutAt-Date.now()))+', '+esc(clock(w.runsOutAt))+'</div>';
346
+ return '<div class="win"><div class="row"><span>'+label+'</span><b class="'+cls+'">'+amount+'</b></div>'
347
+ +'<div class="bar" role="progressbar" aria-label="'+label+' remaining" aria-valuemin="0" aria-valuemax="100" aria-valuenow="'+Math.round(left)+'" aria-valuetext="'+esc(amount)+'"><i class="'+cls+'" style="width:'+left.toFixed(1)+'%"></i></div>'+reset+'</div>';
348
+ }
349
+ function cardHtml(a,open){
350
+ var u=a.usage, st=STATES[a.state]||['Unknown','s-idle'];
351
+ var ico=a.local?'chip':a.driver==='cli'?'terminal':'cloud';
352
+ var facts=[a.owner?'Owned by '+esc(a.owner):'',esc(a.id),u.plan?esc(u.plan)+' plan':'',a.local?'Runs on this PC':'',a.trainsOnData?'Public tasks only':'',a.running?a.running+' job'+(a.running>1?'s':'')+' running':''];
353
+ var sub=facts.filter(Boolean).join(' · ');
354
+ var notes='';
355
+ if(a.state!=='ready'&&a.state!=='busy'){
356
+ var DEFAULT={exhausted:'No quota left in the current window',offline:'omnitrix cannot reach this account',cooling:'Taking a short break after errors',auth_error:'Not signed in',disabled:'Turned off in omnitrix'};
357
+ // the engine's own reasons are lower case ("rate limited"); here they start a sentence. Provider
358
+ // messages pass through untouched, since they may begin with a name like "openai".
359
+ var why=String(a.reason||DEFAULT[a.state]||'').replace(/[.]+$/,'');
360
+ if(/^(rate limited|provider error|no answer|every model is paused)/.test(why))why=why.charAt(0).toUpperCase()+why.slice(1);
361
+ var back=a.until?' Back in '+esc(span(a.until-Date.now()))+', '+esc(clock(a.until))+'.':'';
362
+ var fix=a.state==='auth_error'?' Run <code>omnitrix login '+esc(a.id)+'</code> to sign in again.':a.state==='disabled'?' Run <code>omnitrix enable '+esc(a.id)+'</code> to turn it on.':'';
363
+ var text=(why?esc(why)+'.':'')+back+fix;
364
+ if(text)notes+='<div class="note '+(st[1]==='s-bad'?'bad':st[1]==='s-warn'?'warn':'')+'">'+text+'</div>';
365
+ }
366
+ var paused=a.pausedModels||[];
367
+ if(paused.length)notes+='<div class="note warn">Resting after errors: '+esc(paused.join(', '))+'.'+(paused.length<(a.models||[]).length?' omnitrix uses the other models meanwhile.':'')+'</div>';
368
+ var quota=u.windows.length?u.windows.map(windowHtml).join('')
369
+ :a.local?'<div class="note">No usage limit. It runs on this PC.</div>'
370
+ :a.state==='auth_error'||a.state==='disabled'?''
371
+ :a.driver==='cli'?'<div class="note">This plan does not publish its limits, so omnitrix shows what it has sent below.</div>'
372
+ :'<div class="note">No limit is known for this account, so omnitrix cannot show what is left. To track one, run <code>omnitrix set '+esc(a.id)+' --rpd 1000</code> with your real daily limit.</div>';
373
+ var models=a.models||[], shown=models.slice(0,40);
374
+ var modelHtml=models.length?'<details data-key="m-'+esc(a.id)+'"'+(open['m-'+a.id]?' open':'')+'><summary>'+models.length+' model'+(models.length>1?'s':'')+'</summary><ul class="models">'+shown.map(function(m){return '<li>'+esc(m)+'</li>'}).join('')+(models.length>shown.length?'<li>and '+(models.length-shown.length)+' more</li>':'')+'</ul></details>':'';
375
+ return '<article class="card" aria-label="'+esc(a.label)+'">'
376
+ +'<div class="head"><div class="title">'+icon(ico)+'<div><h3>'+esc(a.label)+'</h3><div class="sub">'+sub+'</div></div></div><span class="state '+st[1]+'"><i aria-hidden="true"></i>'+st[0]+'</span></div>'
377
+ +(quota?'<div>'+quota+'</div>':'')+notes
378
+ +'<div class="stats"><span>Last 24 h</span><span><b>'+u.requestsToday+'</b> answered</span>'+(u.failedToday?'<span class="warn"><b>'+u.failedToday+'</b> failed</span>':'')+'<span><b>'+fmt(u.tokensToday)+'</b> tokens</span>'+(u.costToday?'<span><b>'+money(u.costToday)+'</b></span>':'')
379
+ +(u.windows.length?'<span class="prov">'+esc(SOURCES[u.source]||u.source)+(u.updatedAt&&!u.stale?', updated '+esc(ago(u.updatedAt)):'')+'</span>':'')+'</div>'
380
+ +(u.stale&&u.updatedAt?'<div class="note warn">omnitrix could not read these numbers again. They are from '+esc(clock(u.updatedAt))+' and may be out of date.</div>':'')
381
+ +modelHtml+'</article>';
382
+ }
383
+ var JOB={done:['Done','s-ok'],running:['Running','s-busy'],queued:['Waiting','s-idle'],failed:['Failed','s-bad'],cancelled:['Cancelled','s-idle']};
384
+ function jobHtml(j,open){
385
+ var st=JOB[j.status]||[j.status,'s-idle'];
386
+ var tokens=j.usage?fmt(j.usage.inputTokens+j.usage.outputTokens)+' tokens':'';
387
+ var verdict=j.verdict?(j.verdict==='accepted'?'Accepted by Claude':'Rejected by Claude'):'';
388
+ var err=j.error&&j.status!=='done'?'<details data-key="e-'+esc(j.id)+'"'+(open['e-'+j.id]?' open':'')+'><summary>Why it '+(j.status==='failed'?'failed':'stopped')+'</summary><div class="err">'+esc(j.error)+'</div></details>':'';
389
+ return '<li class="job"><span class="state '+st[1]+'"><i aria-hidden="true"></i>'+st[0]+'</span>'
390
+ +'<div><div class="t">'+esc(j.task.title)+'</div><div class="m">'+esc(j.task.type)+(j.accountId?' · '+esc(j.accountId)+(j.model?' / '+esc(j.model):''):'')+'</div></div>'
391
+ +'<div class="r">'+[tokens,ago(j.createdAt)].filter(Boolean).join(' · ')+(verdict?'<div>'+verdict+'</div>':'')+'</div>'+err
392
+ +(j.verify?'<div class="vf'+(j.verify.warn?' warn':'')+'">Checked by omnitrix: '+esc(j.verify.summary)+'</div>':'')+checkHtml(j.check)+'</li>';
393
+ }
394
+ // the second model's check, on the job it checks; a check that could not run is not a failure of the job
395
+ function checkHtml(c){
396
+ if(!c)return '';
397
+ var by=c.by?' by '+esc(c.by):'', note=c.note?' '+esc(c.note):'';
398
+ var text=c.status==='pass'?'Second check'+by+': passed.'+note
399
+ :c.status==='fail'?'Second check'+by+': failed.'+note
400
+ :c.status==='unclear'?'Second check'+by+' gave no clear answer.'+note
401
+ :c.status==='pending'?'Second check is running.'
402
+ :'Second check not run:'+note;
403
+ return '<div class="vf'+(c.status==='fail'||c.status==='unclear'?' warn':'')+'">'+text+'</div>';
404
+ }
405
+ var last=0, wasStale=null, lastRaw='', drawnMinute=-1, started=Date.now(), connected=false, savedAt=0, down=false;
406
+ function tick(){
407
+ var el=document.getElementById('fresh'), t=document.getElementById('fresh-text');
408
+ // a stream that dropped counts as lost at once; a quiet one only after it missed its signs of life
409
+ var stale=connected?(down||Date.now()-last>15000):Date.now()-started>8000;
410
+ el.className='fresh'+(stale?' stale':'');
411
+ t.textContent=!connected&&!last?(stale?'Cannot reach omnitrix. Trying again. If this stays, run omnitrix dashboard in a terminal.':'Connecting')
412
+ :!connected?(stale?'Cannot reach omnitrix. Trying again. Showing data from '+new Date(savedAt).toLocaleTimeString()+'.':'Connecting. Showing data from '+new Date(savedAt).toLocaleTimeString()+'.')
413
+ :stale?'Connection lost. Trying again. Showing data from '+new Date(last).toLocaleTimeString()+'.':'Live, updated '+ago(last);
414
+ // screen readers hear only a change between live and unreachable, not every second of the clock
415
+ if(stale!==wasStale){document.getElementById('announce').textContent=stale?'omnitrix cannot be reached':(last?'omnitrix is live':'');wasStale=stale}
416
+ }
417
+ function draw(d){
418
+ var focused=document.activeElement&&document.activeElement.closest?document.activeElement.closest('details[data-key]'):null;
419
+ var focusKey=focused?focused.getAttribute('data-key'):null;
420
+ var open={};document.querySelectorAll('details[data-key]').forEach(function(x){if(x.open)open[x.getAttribute('data-key')]=true});
421
+ document.getElementById('ver').textContent='v'+d.version;
422
+ var acc=d.accounts, ready=acc.filter(function(a){return a.state==='ready'||a.state==='busy'}).length;
423
+ var sum=function(k){return acc.reduce(function(s,a){return s+(a.usage[k]||0)},0)};
424
+ var attention=acc.filter(function(a){return a.enabled&&a.state!=='ready'&&a.state!=='busy'}).length;
425
+ document.getElementById('kpis').innerHTML='<div class="kpi"><span>Accounts ready</span><b>'+ready+' of '+acc.length+'</b>'+(attention?'<em>'+attention+' need'+(attention>1?'':'s')+' attention</em>':'')+'</div>'
426
+ +[['Requests, last 24 h',String(sum('requestsToday'))]]
427
+ .map(function(k){return '<div class="kpi"><span>'+k[0]+'</span><b>'+esc(k[1])+'</b></div>'}).join('')
428
+ // the work other accounts did instead of Claude, counted from the usage log
429
+ +(function(g){g=g||{jobs:0,tokens:0,accepted:0};return '<div class="kpi"><span>Done by other accounts, 7 days</span><b>'+g.jobs+' job'+(g.jobs===1?'':'s')+'</b><small>'+esc(fmt(g.tokens))+' tokens'+(g.accepted?', '+g.accepted+' accepted':'')+'</small></div>'})(d.delegated)
430
+ +'<div class="kpi"><span>Known cost, last 24 h</span><b>'+esc(money(sum('costToday')))+'</b></div>';
431
+ document.getElementById('acc-sub').textContent=acc.length?acc.length+' connected':'';
432
+ document.getElementById('accounts').innerHTML=acc.length?acc.map(function(a){return cardHtml(a,open)}).join('')
433
+ :'<div class="empty"><h3>Connect your first account</h3>omnitrix has no accounts yet. In a terminal:<ol><li><code>omnitrix init --apply</code> connects the AI tools, API keys and local models it finds on this PC</li><li><code>omnitrix providers</code> lists what you can connect</li><li><code>omnitrix add ollama</code> adds models on this PC</li><li><code>omnitrix setup-claude</code> connects omnitrix to Claude Code</li></ol></div>';
434
+ document.getElementById('jobs').innerHTML=d.jobs.length?'<ul class="jobs">'+d.jobs.map(function(j){return jobHtml(j,open)}).join('')+'</ul>'
435
+ :'<div class="empty"><h3>No jobs yet</h3>Ask Claude to hand out a task, and it shows up here.</div>';
436
+ if(focusKey){var again=document.querySelector('details[data-key="'+focusKey+'"] summary');if(again)again.focus({preventScroll:true})}
437
+ tick();
438
+ }
439
+ // Draws a new state, and the same state again once a minute so times such as "5 min ago" stay right.
440
+ function show(raw,live){
441
+ var minute=Math.floor(Date.now()/60000);
442
+ if(live){last=Date.now();connected=true}
443
+ if(raw===lastRaw&&minute===drawnMinute){tick();return}
444
+ var d;try{d=JSON.parse(raw)}catch(e){return}
445
+ lastRaw=raw;drawnMinute=minute;
446
+ if(live){try{localStorage.setItem('omnitrix-state',raw);localStorage.setItem('omnitrix-state-at',String(Date.now()))}catch(e){}}
447
+ draw(d);
448
+ }
449
+ // The last state this browser saw is drawn at once, then the live stream takes over.
450
+ try{var saved=localStorage.getItem('omnitrix-state');savedAt=Number(localStorage.getItem('omnitrix-state-at'))||0;if(saved)show(saved,false)}catch(e){}
451
+ var stream=null;
452
+ function connect(){
453
+ if(!window.EventSource){poll();return}
454
+ stream=new EventSource('/api/events');
455
+ stream.onopen=function(){down=false;tick()};
456
+ stream.onmessage=function(e){down=false;show(e.data,true)};
457
+ stream.addEventListener('alive',function(){down=false;last=Date.now();connected=true;if(lastRaw)show(lastRaw,false);tick()});
458
+ stream.onerror=function(){down=true;tick()};
459
+ }
460
+ async function poll(){
461
+ try{show(await (await fetch('/api/status',{cache:'no-store'})).text(),true)}catch(e){tick()}
462
+ setTimeout(poll,4000);
463
+ }
464
+ // The browser retries a dropped stream by itself; if it gives up, for example while the server restarts, start a new one.
465
+ setInterval(function(){if(stream&&stream.readyState===2)connect()},3000);
466
+ connect();setInterval(tick,1000);
467
+ </script>
468
+ </body>
466
469
  </html>`;
@@ -1,10 +1,10 @@
1
1
  import { resolveKey } from '../store.js';
2
2
  import { DriverError } from '../types.js';
3
- import { getJson, joinUrl, postJson, readRateHeaders } from './http.js';
3
+ import { getJson, joinUrl, missingKey, postJson, readRateHeaders } from './http.js';
4
4
  function headers(account) {
5
5
  const key = resolveKey(account);
6
6
  if (!key)
7
- throw new DriverError(`no API key for ${account.id} (${account.apiKey?.startsWith('env:') ? `set ${account.apiKey.slice(4)}` : account.apiKey === 'secret' ? 'no saved key' : 'not set'})`, 'auth');
7
+ throw new DriverError(missingKey(account), 'auth');
8
8
  return { 'x-api-key': key, 'anthropic-version': '2023-06-01' };
9
9
  }
10
10
  /** The Anthropic Messages format. Also spoken by DeepSeek, Kimi, GLM and MiniMax at their /anthropic URLs. */
@@ -2,6 +2,20 @@
2
2
  // rate-limit headers into something the router can act on.
3
3
  import { redact } from '../store.js';
4
4
  import { DriverError } from '../types.js';
5
+ /**
6
+ * Why an account has no key, in words that lead to the fix. A key variable set in a terminal is not seen by
7
+ * omnitrix when Claude Code started it before the variable existed, which `omnitrix doctor` in that
8
+ * terminal cannot show.
9
+ */
10
+ export function missingKey(account) {
11
+ if (account.apiKey?.startsWith('env:')) {
12
+ const name = account.apiKey.slice(4);
13
+ return `no API key for ${account.id}: ${name} is not set where omnitrix runs. If it is set in your terminal, restart Claude Code, which passes on only the variables that existed when it started`;
14
+ }
15
+ if (account.apiKey === 'secret')
16
+ return `no API key for ${account.id}: no key is saved for it; save one with "omnitrix set ${account.id} --key-env NAME"`;
17
+ return `no API key for ${account.id}: none is set; use "omnitrix set ${account.id} --key-env NAME"`;
18
+ }
5
19
  export function classifyStatus(status, body) {
6
20
  const text = body.toLowerCase();
7
21
  if (status === 401 || status === 403)
@@ -31,6 +45,9 @@ export function classifyStatus(status, body) {
31
45
  function retiredModel(text) {
32
46
  if (/(parameter|\bparam\b|argument|max_tokens|max_completion_tokens|reasoning_effort|temperature)/.test(text))
33
47
  return false;
48
+ // NVIDIA lists models that a given key cannot call and answers them with "Function '<id>': Not found for account"
49
+ if (/function '[^']*': not found for account/.test(text))
50
+ return true;
34
51
  const names = /(model_not_found|invalid_model|models\/|the model|model `|model ')/.test(text);
35
52
  return names && /(no longer available|not found|does not exist|is not supported|deprecated|retired)/.test(text);
36
53
  }
@@ -1,6 +1,49 @@
1
1
  // Ollama's own API knows what each local model can do. The OpenAI-style model list does not say.
2
+ import { spawnSync } from 'node:child_process';
3
+ import path from 'node:path';
2
4
  import { makeModel } from '../models.js';
5
+ import { resolveCommand } from './cli.js';
3
6
  import { getJson, postJson } from './http.js';
7
+ /** Each local model's size in bytes, as Ollama reports it; empty when the server does not answer. */
8
+ export async function modelSizes(baseUrl) {
9
+ const root = baseUrl.replace(/\/+$/, '').replace(/\/v1$/, '');
10
+ try {
11
+ const list = await getJson(`${root}/api/tags`, {}, 5000);
12
+ const out = {};
13
+ for (const t of Array.isArray(list?.models) ? list.models : []) {
14
+ if (typeof t.name === 'string' && typeof t.size === 'number' && t.size > 0)
15
+ out[t.name] = t.size;
16
+ }
17
+ return out;
18
+ }
19
+ catch {
20
+ return {};
21
+ }
22
+ }
23
+ let gpuCache;
24
+ /**
25
+ * The memory of the largest NVIDIA graphics card, read once with nvidia-smi, or undefined without one.
26
+ * A local model larger than this runs mostly on the processor, which is many times slower. Other cards
27
+ * and Apple's shared memory are not read, so nothing changes for them.
28
+ */
29
+ export function gpuMemoryBytes() {
30
+ if (gpuCache)
31
+ return gpuCache.bytes;
32
+ gpuCache = { bytes: undefined };
33
+ // resolveCommand skips the current folder on Windows, so a project cannot plant its own nvidia-smi
34
+ const found = resolveCommand('nvidia-smi');
35
+ if (!found || !path.isAbsolute(found.file) || found.shell)
36
+ return undefined;
37
+ const r = spawnSync(found.file, ['--query-gpu=memory.total', '--format=csv,noheader,nounits'], { encoding: 'utf8', timeout: 5000, windowsHide: true });
38
+ if (r.status === 0)
39
+ gpuCache.bytes = parseGpuMemory(r.stdout ?? '');
40
+ return gpuCache.bytes;
41
+ }
42
+ /** nvidia-smi prints one line per card with its memory in MiB, such as "4096"; the largest card counts. */
43
+ export function parseGpuMemory(stdout) {
44
+ const mib = stdout.split(/\r?\n/).map((l) => Number(l.trim())).filter((n) => Number.isFinite(n) && n > 0);
45
+ return mib.length ? Math.max(...mib) * 1024 * 1024 : undefined;
46
+ }
4
47
  /** The given models with capabilities, size and version from Ollama; a model it cannot describe gets plain local scores. */
5
48
  export async function localModels(baseUrl, ids) {
6
49
  const root = baseUrl.replace(/\/+$/, '').replace(/\/v1$/, '');
@@ -1,10 +1,10 @@
1
1
  import { resolveKey } from '../store.js';
2
2
  import { DriverError } from '../types.js';
3
- import { getJson, joinUrl, postJson, readRateHeaders } from './http.js';
3
+ import { getJson, joinUrl, missingKey, postJson, readRateHeaders } from './http.js';
4
4
  function authHeaders(account) {
5
5
  const key = resolveKey(account);
6
6
  if (!key && !account.local)
7
- throw new DriverError(`no API key for ${account.id} (${account.apiKey?.startsWith('env:') ? `set ${account.apiKey.slice(4)}` : account.apiKey === 'secret' ? 'no saved key' : 'not set'})`, 'auth');
7
+ throw new DriverError(missingKey(account), 'auth');
8
8
  const h = key ? { authorization: `Bearer ${key}` } : {};
9
9
  if (account.provider === 'openrouter') {
10
10
  h['x-title'] = 'omnitrix';
package/dist/engine.js CHANGED
@@ -5,6 +5,7 @@ import fs from 'node:fs';
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import { runDriver } from './drivers/index.js';
8
+ import { gpuMemoryBytes, modelSizes } from './drivers/ollama.js';
8
9
  import { beat, isMine, OWNER, ownerAlive, sweepOwners } from './owner.js';
9
10
  import { reachable } from './init.js';
10
11
  import { budgetBlocks, budgetFor, estimateCost, loadTeam, periodStart, personSpend, readShared, shareRecord } from './team.js';
@@ -17,6 +18,7 @@ import { DriverError } from './types.js';
17
18
  import { statsKey } from './models.js';
18
19
  import { compactLedger, headroom, LedgerTail, recordUsage, summarize, typicalLatency } from './usage.js';
19
20
  import { outsideFiles, runTest } from './verify.js';
21
+ import { delegated } from './value.js';
20
22
  import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
21
23
  const MAX_ATTEMPTS = 3;
22
24
  // A model the provider no longer serves (or gives this plan no allowance for) is dropped from the account,
@@ -143,6 +145,8 @@ export class Engine {
143
145
  return this.usageCache.byAccount;
144
146
  }
145
147
  localProbedAt = new Map();
148
+ /** sizes in bytes of local Ollama models per "account/model", read with each check of the local servers */
149
+ localSizes = {};
146
150
  /** Ask each local server whether it answers, at most every 30 s, so the pool never shows a stopped one as ready. */
147
151
  async checkLocal() {
148
152
  const now = Date.now();
@@ -150,6 +154,11 @@ export class Engine {
150
154
  await Promise.all(due.map(async (a) => {
151
155
  this.localProbedAt.set(a.id, now);
152
156
  const up = await reachable(a.baseUrl);
157
+ // the size of each Ollama model, so routing can tell which ones fit in the graphics card's memory
158
+ if (up && a.provider === 'ollama') {
159
+ for (const [name, bytes] of Object.entries(await modelSizes(a.baseUrl)))
160
+ this.localSizes[`${a.id}/${name}`] = bytes;
161
+ }
153
162
  // Decide on the latest state from any process. A rest or a sign-in problem set for another reason is
154
163
  // left alone: answering its model list does not prove the server can do work, and is no reason to shorten it.
155
164
  const disk = loadHealth()[a.id];
@@ -243,8 +252,29 @@ export class Engine {
243
252
  const usage = {};
244
253
  for (const a of cfg.accounts)
245
254
  usage[a.id] = summarize(a, records.get(a.id) ?? [], this.health[a.id], Date.now(), quotas[a.id]);
246
- return { config: cfg, health: this.health, usage, running: this.running, stats: loadStats(), blocked: this.teamBlocks(cfg, records), latency: typicalLatency([...records.values()].flat()) };
255
+ return {
256
+ config: cfg, health: this.health, usage, running: this.running, stats: loadStats(), blocked: this.teamBlocks(cfg, records),
257
+ latency: typicalLatency([...records.values()].flat()),
258
+ // only read when a local model's size is known, so a computer without local models never runs nvidia-smi
259
+ ...(Object.keys(this.localSizes).length ? { gpuBytes: gpuMemoryBytes(), localSizes: this.localSizes } : {}),
260
+ };
247
261
  }
262
+ /** Work that other accounts did instead of Claude in the last `days` days (see value.ts). */
263
+ delegated(days = 7) {
264
+ // the dashboard asks every few seconds, and reading every job record each time is wasteful
265
+ const hit = this.delegatedCache;
266
+ if (hit && hit.days === days && Date.now() - hit.at < 15_000)
267
+ return hit.value;
268
+ const since = Date.now() - days * 24 * 3600_000;
269
+ const verdicts = new Map();
270
+ for (const j of this.listJobs(1000))
271
+ if (j.verdict && j.createdAt >= since - 24 * 3600_000)
272
+ verdicts.set(j.id, j.verdict);
273
+ const value = { days, ...delegated([...this.records().values()].flat(), verdicts, since) };
274
+ this.delegatedCache = { days, at: Date.now(), value };
275
+ return value;
276
+ }
277
+ delegatedCache;
248
278
  pool() {
249
279
  const cfg = this.config();
250
280
  const ctx = this.routeContext(cfg);
@@ -917,6 +947,13 @@ export class Engine {
917
947
  this.applyFailure(account, e, cand.model);
918
948
  this.tripBreaker(account, e);
919
949
  }
950
+ // A model that broke is paused for five minutes, but one attempt can take that long, so the job itself
951
+ // keeps it out from now on. After a local timeout, the same computer's models that are as big or
952
+ // bigger would most likely time out too.
953
+ if (MODEL_FAULTS.has(e.kind)) {
954
+ const out = e.kind === 'timeout' && account.local ? avoidAfterTimeout(account.id, cand.model, this.localSizes) : [`${account.id}/${cand.model}`];
955
+ job.task = { ...job.task, avoid: [...new Set([...(job.task.avoid ?? []), ...out])] };
956
+ }
920
957
  if (e.kind === 'model_gone') {
921
958
  try {
922
959
  dropModel(account.id, cand.model);
@@ -1108,6 +1145,17 @@ function attachable(full, repo) {
1108
1145
  return false;
1109
1146
  return !protectedDirs().some((d) => inside(full, d));
1110
1147
  }
1148
+ /**
1149
+ * The models a job leaves out after a local model timed out: that model and the same computer's models that
1150
+ * are as big or bigger, which would most likely time out as well. Without its size, only the model itself.
1151
+ */
1152
+ export function avoidAfterTimeout(accountId, model, sizes) {
1153
+ const key = `${accountId}/${model}`;
1154
+ const own = sizes[key];
1155
+ if (own === undefined)
1156
+ return [key];
1157
+ return Object.entries(sizes).filter(([k, bytes]) => k.startsWith(`${accountId}/`) && bytes >= own).map(([k]) => k);
1158
+ }
1111
1159
  const NUMBERED_TYPES = new Set(['review', 'reasoning']);
1112
1160
  /** "12| text" on each line, padded to the widest number, without numbering the end of a final newline. */
1113
1161
  function numberLines(body) {
package/dist/mcp.js CHANGED
@@ -8,6 +8,7 @@ import { refreshQuotas } from './quota.js';
8
8
  import { EFFORTS, TASK_TYPES } from './types.js';
9
9
  import { formatTokens, roughSpan } from './usage.js';
10
10
  import { testSeconds, verifySummary } from './verify.js';
11
+ import { describeDelegated } from './value.js';
11
12
  import { VERSION } from './version.js';
12
13
  import { runningDashboard, refreshDashboards } from './dashboard-launch.js';
13
14
  import { JOB_ID } from './store.js';
@@ -76,6 +77,8 @@ const poolOut = z.object({
76
77
  accounts: z.array(accountOut),
77
78
  team: teamOut.optional(),
78
79
  dashboard: z.string().nullable().describe('address of the live dashboard when it runs; a client with a browser can open it for the user'),
80
+ delegated: z.object({ days: z.number(), jobs: z.number(), accepted: z.number(), rejected: z.number(), tokens: z.number() }).optional()
81
+ .describe('work other accounts did instead of Claude in the last days: jobs answered, how many Claude accepted or rejected, and their tokens'),
79
82
  });
80
83
  function describeTeam(t) {
81
84
  if (t.error)
@@ -138,7 +141,8 @@ export function describeAccount(a) {
138
141
  }
139
142
  if (u.measured?.remainingRequests !== undefined)
140
143
  bits.push(`provider says ${u.measured.remainingRequests} requests left`);
141
- bits.push(`today: ${u.requestsToday} req, ${formatTokens(u.tokensToday)} tokens${u.costToday ? `, $${u.costToday.toFixed(3)}` : ''}`);
144
+ // a rolling day, and failures shown, so the line matches `omnitrix usage`
145
+ bits.push(`last 24 h: ${u.requestsToday} answered${u.failedToday ? `, ${u.failedToday} failed` : ''}, ${formatTokens(u.tokensToday)} tokens${u.costToday ? `, ${u.costToday.toFixed(3)}` : ''}`);
142
146
  if (a.until)
143
147
  bits.push(`back at ${new Date(a.until).toLocaleTimeString()}`);
144
148
  if (a.reason)
@@ -226,7 +230,10 @@ export function buildServer(engine) {
226
230
  }));
227
231
  if (dashboard)
228
232
  lines.push(`live dashboard: ${dashboard}`);
229
- return text(lines.join('\n'), { ready, total: pool.length, accounts, ...(team ? { team } : {}), dashboard });
233
+ const delegated = engine.delegated(7);
234
+ if (delegated.jobs)
235
+ lines.push(describeDelegated(delegated));
236
+ return text(lines.join('\n'), { ready, total: pool.length, accounts, ...(team ? { team } : {}), dashboard, delegated });
230
237
  });
231
238
  server.registerTool('route_preview', {
232
239
  title: 'Preview routing',
package/dist/models.js CHANGED
@@ -78,6 +78,9 @@ export function statsKey(m) {
78
78
  export function isChatModel(id) {
79
79
  if (/(embed|embedding|whisper|tts|audio|moderation|rerank|dall-e|image-gen|transcribe|guard)/i.test(id))
80
80
  return false;
81
+ // code-completion models (NVIDIA lists starcoder2) and reward models that only score answers do not chat
82
+ if (/(starcoder|santacoder|codegen\b|-reward\b|\breward-)/i.test(id))
83
+ return false;
81
84
  // Gemini lists music (lyria), image output (-image, nano-banana), voice sessions (-live, realtime), research
82
85
  // and computer-use agents and attributed QA beside its chat models; none of them answer a chat request
83
86
  return !/(lyria|nano-banana|-image(-preview)?$|-live\b|realtime|deep-research|computer-use|\baqa$)/i.test(id);
package/dist/router.js CHANGED
@@ -14,6 +14,8 @@ const WEIGHTS = {
14
14
  writing: { writing: 0.7, reasoning: 0.2, speed: 0.1 },
15
15
  vision: { vision: 0.7, reasoning: 0.3 },
16
16
  };
17
+ // a local model larger than the graphics card's memory runs mostly on the processor, many times slower
18
+ const TOO_BIG_FOR_GPU = 0.4;
17
19
  /** True when the address is this computer, so a "local" account really keeps prompts here. */
18
20
  export function loopback(baseUrl) {
19
21
  try {
@@ -203,6 +205,11 @@ export function route(task, ctx) {
203
205
  score *= acc.factor;
204
206
  if (acc.samples)
205
207
  why.push(`past results x${acc.factor.toFixed(2)} (${acc.samples} rated)`);
208
+ const size = account.local ? ctx.localSizes?.[`${account.id}/${model.id}`] : undefined;
209
+ if (size && ctx.gpuBytes && size > ctx.gpuBytes) {
210
+ score *= TOO_BIG_FOR_GPU;
211
+ why.push(`about ${Math.round(size / 1024 ** 3)} GB, more than this computer's ${Math.round(ctx.gpuBytes / 1024 ** 3)} GB of GPU memory, so it runs mostly on the processor and slowly`);
212
+ }
206
213
  // A fast task prefers models that answered quickly before: the quickest keeps its score and one ten
207
214
  // times slower loses about half. Without a typical time, the speed score stands in, a little below
208
215
  // the quickest measured model, since a guess should not beat a measurement.
package/dist/usage.js CHANGED
@@ -220,9 +220,12 @@ export function summarize(account, records, health, now = Date.now(), quota) {
220
220
  let hour = 0;
221
221
  let hourTokens = 0;
222
222
  const monthFrom = monthStart(now);
223
+ let failed = 0;
223
224
  for (const r of records) {
224
225
  if (r.accountId !== account.id)
225
226
  continue;
227
+ if (!r.ok && r.ts >= now - DAY)
228
+ failed++;
226
229
  // failed calls that never reached the model do not count against a quota
227
230
  if (!(r.ok || r.errorKind === 'rate_limit' || r.errorKind === 'quota'))
228
231
  continue;
@@ -290,6 +293,7 @@ export function summarize(account, records, health, now = Date.now(), quota) {
290
293
  return {
291
294
  accountId: account.id,
292
295
  requestsToday: day,
296
+ failedToday: failed,
293
297
  tokensToday: dayTokens,
294
298
  tokensMonth: monthTokens,
295
299
  costToday: dayCost,
package/dist/value.js ADDED
@@ -0,0 +1,30 @@
1
+ import { formatTokens } from './usage.js';
2
+ /** One line on the work other accounts did instead of Claude, such as "last 7 days: other accounts answered 29 jobs ...". */
3
+ export function describeDelegated(d) {
4
+ const rated = d.accepted || d.rejected ? ` (${d.accepted} accepted, ${d.rejected} rejected by Claude)` : '';
5
+ return `last ${d.days} days: other accounts answered ${d.jobs} job${d.jobs === 1 ? '' : 's'}${rated} and processed ${formatTokens(d.tokens)} tokens that Claude did not have to`;
6
+ }
7
+ /**
8
+ * Counts answered requests that belong to a job, since `since`. A failed request did no work, and a request
9
+ * without a job, such as `omnitrix test`, was not delegated by Claude, so neither counts.
10
+ */
11
+ export function delegated(records, verdicts, since) {
12
+ const jobs = new Set();
13
+ let tokens = 0;
14
+ for (const r of records) {
15
+ if (!r.ok || !r.jobId || r.ts < since)
16
+ continue;
17
+ jobs.add(r.jobId);
18
+ tokens += r.inputTokens + r.outputTokens;
19
+ }
20
+ let accepted = 0;
21
+ let rejected = 0;
22
+ for (const id of jobs) {
23
+ const v = verdicts.get(id);
24
+ if (v === 'accepted')
25
+ accepted++;
26
+ else if (v === 'rejected')
27
+ rejected++;
28
+ }
29
+ return { jobs: jobs.size, accepted, rejected, tokens };
30
+ }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.4.3';
1
+ export const VERSION = '0.5.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnitrix",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "Delegate tasks from Claude Code to the AI accounts you already pay for. Claude plans the work, and omnitrix routes each task to Codex, Gemini, DeepSeek, Kimi, GLM, a local model or any OpenAI- or Anthropic-compatible API while tracking each account's usage.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {