omnitrix 0.5.0 → 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
@@ -141,6 +141,8 @@ omnitrix route --type review "check this diff for auth bugs"
141
141
 
142
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.
143
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
+
144
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:
145
147
 
146
148
  ```
package/dist/cli.js CHANGED
@@ -23,6 +23,7 @@ import { branchExists, branchMerged, deleteBranch, pruneWorktree } from './workt
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"
@@ -822,6 +823,12 @@ program
822
823
  const k = key.replace(/[\p{Cc}\p{Cf}]/gu, '?');
823
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` : ''}`);
824
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
+ }
825
832
  console.log('\nCosts are those reported by the provider, or estimated from model prices where they are known.');
826
833
  });
827
834
  program
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') {
@@ -248,7 +248,7 @@ header{display:flex;align-items:center;justify-content:space-between;gap:16px;fl
248
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
249
  h2{font-size:15px;font-weight:600;margin:0 0 12px;letter-spacing:-.005em;display:flex;align-items:baseline;gap:8px}
250
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}
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
252
  .ver{font-size:13px;color:var(--ink-3)}
253
253
  .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:14px;margin-bottom:32px}
254
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}
@@ -423,8 +423,11 @@ function draw(d){
423
423
  var sum=function(k){return acc.reduce(function(s,a){return s+(a.usage[k]||0)},0)};
424
424
  var attention=acc.filter(function(a){return a.enabled&&a.state!=='ready'&&a.state!=='busy'}).length;
425
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('');
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>';
428
431
  document.getElementById('acc-sub').textContent=acc.length?acc.length+' connected':'';
429
432
  document.getElementById('accounts').innerHTML=acc.length?acc.map(function(a){return cardHtml(a,open)}).join('')
430
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>';
package/dist/engine.js CHANGED
@@ -18,6 +18,7 @@ import { DriverError } from './types.js';
18
18
  import { statsKey } from './models.js';
19
19
  import { compactLedger, headroom, LedgerTail, recordUsage, summarize, typicalLatency } from './usage.js';
20
20
  import { outsideFiles, runTest } from './verify.js';
21
+ import { delegated } from './value.js';
21
22
  import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
22
23
  const MAX_ATTEMPTS = 3;
23
24
  // A model the provider no longer serves (or gives this plan no allowance for) is dropped from the account,
@@ -258,6 +259,22 @@ export class Engine {
258
259
  ...(Object.keys(this.localSizes).length ? { gpuBytes: gpuMemoryBytes(), localSizes: this.localSizes } : {}),
259
260
  };
260
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;
261
278
  pool() {
262
279
  const cfg = this.config();
263
280
  const ctx = this.routeContext(cfg);
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)
@@ -227,7 +230,10 @@ export function buildServer(engine) {
227
230
  }));
228
231
  if (dashboard)
229
232
  lines.push(`live dashboard: ${dashboard}`);
230
- 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 });
231
237
  });
232
238
  server.registerTool('route_preview', {
233
239
  title: 'Preview routing',
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.5.0';
1
+ export const VERSION = '0.5.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnitrix",
3
- "version": "0.5.0",
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": {