omnitrix 0.5.3 → 0.6.0
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 +30 -2
- package/dist/cli.js +27 -0
- package/dist/engine.js +6 -1
- package/dist/lockfile.js +209 -0
- package/dist/mcp.js +32 -4
- package/dist/verify.js +3 -0
- package/dist/version.js +1 -1
- package/dist/worktree.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,12 +9,16 @@ Claude plans the work, and your other AI accounts carry it out.
|
|
|
9
9
|
<img alt="An example job, 'add rate limiting to the public API', split by Claude into six tasks in two rounds. First, Gemini reads the exported issues, Codex writes the middleware on its own git branch, Groq drafts the changelog and a local Ollama model checks the .env file for leaked keys. Then DeepSeek reviews the middleware diff, and the edge-case task moves to GLM because Kimi is rate limited. Claude checks each result and merges the accepted branch." src="assets/job-v3-light.svg" width="100%">
|
|
10
10
|
</picture>
|
|
11
11
|
|
|
12
|
-
I built omnitrix because I repeatedly ran out of Claude credits while
|
|
12
|
+
I built omnitrix because I repeatedly ran out of Claude credits while my ChatGPT Plus plan and my Gemini key remained largely unused.
|
|
13
13
|
|
|
14
14
|
omnitrix is built for the frontier-model subscriptions and API keys you already pay for, and it runs inside your existing Claude Code session. Claude remains in charge: it divides the job into tasks and reviews the results. omnitrix sends each task to an account that suits the work and still has quota available. For example, it can use Codex on your ChatGPT plan for code edits, Gemini for reading very large logs, DeepSeek or Kimi for reasoning and review, or a local model for private work. It also supports any service that implements the OpenAI Chat Completions format or the Anthropic Messages format, through `custom-openai` and `custom-anthropic`.
|
|
15
15
|
|
|
16
16
|
You can monitor the pool without leaving Claude Code. The status line shows up to four accounts with their remaining quota or status, and omnitrix instructs Claude to check the same data before it assigns work. Claude reads short results instead of performing every step itself, which uses less of your Claude usage limit.
|
|
17
17
|
|
|
18
|
+
## Who it is for
|
|
19
|
+
|
|
20
|
+
omnitrix suits you if you work in Claude Code, have other AI accounts that sit idle (a ChatGPT plan, free or paid API keys, local models), and want Claude to hand work to them and check the results instead of switching between tools yourself. It is a weaker fit if you prefer to drive several agents by hand in one window, which an app such as [T3 Code](https://github.com/pingdotgg/t3code) does well (omnitrix also works inside it, see [Inside T3 Code](#inside-t3-code)), or if you need one OpenAI-compatible endpoint for other applications, which a gateway such as FreeLLMAPI or OpenRouter provides.
|
|
21
|
+
|
|
18
22
|
## How omnitrix compares
|
|
19
23
|
|
|
20
24
|
Several projects connect Claude Code or other tools to many models. They solve different problems, so the right choice depends on what you need. This comparison is based on each project's own documentation as of November 2026.
|
|
@@ -50,6 +54,21 @@ omnitrix is also a Claude Code plugin. In Claude Code 2.1.275 or later, this com
|
|
|
50
54
|
|
|
51
55
|
From a terminal, `claude plugin marketplace add MdHashim1011/omnitrix` followed by `claude plugin install omnitrix@omnitrix` does the same. The plugin starts the latest omnitrix from npm with `npx`, so it needs Node.js 20 or later as well. It registers the MCP server only: add your accounts with `npx omnitrix init --apply`, or install the package globally with the command above to have the `omnitrix` command itself.
|
|
52
56
|
|
|
57
|
+
The plugin also adds four commands that you can type in Claude Code:
|
|
58
|
+
|
|
59
|
+
| Command | What Claude does |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `/omnitrix:delegate <work>` | Splits the work into tasks, sends them to your other accounts, checks every result and merges what it accepts |
|
|
62
|
+
| `/omnitrix:review [files or range]` | Has three different models review the code independently, checks each finding against the code and reports the ones that hold up, noting which reviewers found them |
|
|
63
|
+
| `/omnitrix:second-opinion [question]` | Asks another model to find what is wrong with an answer or plan, by default Claude's last one, and reports where it agrees and disagrees |
|
|
64
|
+
| `/omnitrix:pool` | Shows each account's state, remaining quota and reset times |
|
|
65
|
+
|
|
66
|
+
Without the plugin, you can ask Claude for the same things in your own words.
|
|
67
|
+
|
|
68
|
+
### Inside T3 Code
|
|
69
|
+
|
|
70
|
+
[T3 Code](https://github.com/pingdotgg/t3code) runs Claude Code with its normal configuration, so once omnitrix is registered with Claude Code, Claude threads in T3 Code can use it with no extra setup. This was checked in November 2026 with T3 Code 0.1.11 and Claude Code 2.1.328 on Windows: a Claude thread in T3 Code found all eight omnitrix tools, read the pool, sent a task that omnitrix routed to a free Gemini key, and collected and rated the result. Code tasks and Codex as the lead in T3 Code have not been tested yet.
|
|
71
|
+
|
|
53
72
|
The same package is attached to each GitHub release, so you can also install it from there:
|
|
54
73
|
|
|
55
74
|
```bash
|
|
@@ -124,7 +143,11 @@ On a computer with an NVIDIA graphics card, omnitrix reads the card's memory onc
|
|
|
124
143
|
|
|
125
144
|
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.
|
|
126
145
|
|
|
127
|
-
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.
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
Lockfiles such as `package-lock.json`, `Cargo.lock` or `go.sum` get their own check, because two jobs that each add a package both change the lockfile, and combining lockfiles by hand rarely works. For every lockfile a job changed, `get_results` lists under `lockfiles` the packages the job added, changed (an existing version replaced by another) and removed, and says whether it only added. omnitrix reads `package-lock.json`, `npm-shrinkwrap.json`, `Cargo.lock`, `poetry.lock`, `uv.lock`, `go.sum`, `composer.lock` and `Pipfile.lock`; other lockfiles, such as `yarn.lock` or `pnpm-lock.yaml`, are flagged for review by hand. When two jobs changed the same lockfile, omnitrix asks Claude not to combine it, but to merge the other files, run the package manager once to regenerate the lockfile, and then run `omnitrix lockcheck`. That command compares each changed lockfile with `HEAD`, or with the revision given by `--base`, prints what was added, changed or removed, and exits with code 1 when an existing package changed or was removed, or when a lockfile could not be checked. A regenerated lockfile should normally only add packages, so any change it lists deserves a look before you commit.
|
|
149
|
+
|
|
150
|
+
omnitrix never merges anything: Claude still reviews the work, and you decide what to keep.
|
|
128
151
|
|
|
129
152
|
An account's concurrency limit applies to all omnitrix processes that share the same data folder, such as the MCP server, the dashboard and the command line. It is 1 by default for agent CLIs and local models and 2 for APIs, and `omnitrix set <id> --concurrency` changes it. When the best account is full, the job goes to the next eligible account that has a free slot, and it waits in the queue only when every eligible account is full. The limit does not apply across different computers, and `omnitrix test` does not count towards it.
|
|
130
153
|
|
|
@@ -269,6 +292,10 @@ For an important review or question, a task can set `copies` to a number from 2
|
|
|
269
292
|
|
|
270
293
|
To ask a worker more about its answer, a task can set `follow_up_of` to the id of a finished job. omnitrix sends it to the same model with that job's task, at most 8,000 characters, and the model's own answer, at most 20,000 characters, before the new prompt, so Claude does not need to repeat them and the worker continues where it stopped. A follow-up without a `privacy` level keeps the earlier task's level, and one with a level gets the stricter of the two, so a follow-up is never less private than the task it continues. If that model is not available, the follow-up fails rather than going to a model that never saw the conversation; Claude can then send a new task. Code jobs cannot be followed up, because their work is on their branch, not in their answer.
|
|
271
294
|
|
|
295
|
+
### How Claude stays fair when it judges other models
|
|
296
|
+
|
|
297
|
+
Claude makes the final decision about every result, so it could favour answers that look like its own. omnitrix gives it evidence that is not its own opinion. Each task can carry an `acceptance` line written before the work starts, so results are judged against what done means rather than against a preferred style. For code tasks, omnitrix runs the tests itself and lists the changed files, and a passing or failing test does not depend on anyone's taste. A `check` asks a different account, at most slightly weaker at that kind of task, to judge the result against the acceptance line, and `copies` asks several models the same question, so that a finding several of them report independently counts for more than any single view, Claude's included. This does not remove judgment from the process, but it makes Claude overrule tests and other models openly rather than quietly prefer its own style.
|
|
298
|
+
|
|
272
299
|
By default, previews are limited to 1,500 characters to keep Claude's token usage low; `omnitrix settings --preview-chars` changes the limit. Full outputs remain on disk.
|
|
273
300
|
|
|
274
301
|
## Commands
|
|
@@ -292,6 +319,7 @@ omnitrix dashboard open the live dashboard on 127.0.0.1:4590, which
|
|
|
292
319
|
omnitrix setup-claude register with Claude Code (--scope user|project|local, --no-statusline, --dry-run)
|
|
293
320
|
omnitrix team join, review or leave a team file, and show your spending (join --as, --yes; leave; status)
|
|
294
321
|
omnitrix usage requests, tokens and cost for the last 30 days (--by person|account|model, --days, --team)
|
|
322
|
+
omnitrix lockcheck [files] show which packages a regenerated lockfile added, changed or removed (--base, --repo, --json)
|
|
295
323
|
omnitrix clean delete finished jobs and worktrees older than 14 days (--days, --dry-run, --branches)
|
|
296
324
|
omnitrix doctor check the setup, including whether each account's last request worked; it sends nothing
|
|
297
325
|
omnitrix mcp run the MCP server (Claude Code starts this itself)
|
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ 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
26
|
import { describeDelegated } from './value.js';
|
|
27
|
+
import { checkLockfiles, describeLock } from './lockfile.js';
|
|
27
28
|
/** A typical answer time as people read it: "4.2 s", "38 s", or "-" when there is none yet. */
|
|
28
29
|
function seconds(ms) {
|
|
29
30
|
// the same form as the router's "typical 4.2 s"
|
|
@@ -884,6 +885,32 @@ program
|
|
|
884
885
|
}
|
|
885
886
|
console.log('Restart Claude Code, then ask it to "use omnitrix" for big jobs.');
|
|
886
887
|
});
|
|
888
|
+
program
|
|
889
|
+
.command('lockcheck [files...]')
|
|
890
|
+
.description('after regenerating a lockfile, show which packages were added, changed or removed compared with a git revision')
|
|
891
|
+
.option('--base <rev>', 'the revision to compare with', 'HEAD')
|
|
892
|
+
.option('--repo <dir>', 'the repository folder', '.')
|
|
893
|
+
.option('--json', 'print the full result as JSON')
|
|
894
|
+
.action((names, o) => {
|
|
895
|
+
let results;
|
|
896
|
+
try {
|
|
897
|
+
results = checkLockfiles(path.resolve(o.repo), o.base, names);
|
|
898
|
+
}
|
|
899
|
+
catch (e) {
|
|
900
|
+
fail(e.message);
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
if (o.json)
|
|
904
|
+
console.log(JSON.stringify(results, null, 2));
|
|
905
|
+
else if (!results.length)
|
|
906
|
+
console.log(`no lockfile differs from ${o.base}`);
|
|
907
|
+
else
|
|
908
|
+
for (const r of results)
|
|
909
|
+
console.log(describeLock(r));
|
|
910
|
+
// exit code 1 when anything needs a person's review: a changed or removed package, or a file that could not be checked
|
|
911
|
+
if (results.some((r) => r.additiveOnly !== true))
|
|
912
|
+
process.exitCode = 1;
|
|
913
|
+
});
|
|
887
914
|
program
|
|
888
915
|
.command('clean')
|
|
889
916
|
.description('delete old job records, outputs and worktrees; --branches also deletes branches no longer needed')
|
package/dist/engine.js
CHANGED
|
@@ -17,9 +17,10 @@ import { dropModel, ensureHome, files, findAccount, homeDir, inside, JOB_ID, loa
|
|
|
17
17
|
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
|
+
import { diffLock, isLockfile } from './lockfile.js';
|
|
20
21
|
import { outsideFiles, runTest } from './verify.js';
|
|
21
22
|
import { delegated } from './value.js';
|
|
22
|
-
import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
|
|
23
|
+
import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileText, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
|
|
23
24
|
const MAX_ATTEMPTS = 3;
|
|
24
25
|
// A model the provider no longer serves (or gives this plan no allowance for) is dropped from the account,
|
|
25
26
|
// and rests (GONE_PAUSE_MS), so trying it did no work and is not repeated: it does not use up one of the
|
|
@@ -920,6 +921,10 @@ export class Engine {
|
|
|
920
921
|
// facts for Claude's review, found by omnitrix itself rather than reported by the worker
|
|
921
922
|
const changed = fin.changed ? changedFiles(worktree.path, worktree.gitDir) : [];
|
|
922
923
|
job.verify = { files: changed, outside: outsideFiles(changed, job.task, worktree.root) };
|
|
924
|
+
const wt = worktree;
|
|
925
|
+
const locks = changed.filter(isLockfile).map((f) => diffLock(f, fileText(wt.path, 'HEAD~1', f, wt.gitDir), fileText(wt.path, 'HEAD', f, wt.gitDir)));
|
|
926
|
+
if (locks.length)
|
|
927
|
+
job.verify.lockfiles = locks;
|
|
923
928
|
if (job.task.test?.length)
|
|
924
929
|
job.verify.test = { command: job.task.test.join(' '), status: 'running' };
|
|
925
930
|
}
|
package/dist/lockfile.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Lockfiles record the exact version of every package a project installs. When several jobs each change one,
|
|
2
|
+
// merging them by hand rarely works, and a regenerated lockfile can quietly change versions nobody reviewed.
|
|
3
|
+
// This module tells, for a lockfile, which packages were added, changed or removed between two versions.
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
/** Lockfiles by file name. Only some formats can be read; the rest are still flagged. */
|
|
8
|
+
const LOCKFILES = new Set([
|
|
9
|
+
'package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lock', 'bun.lockb',
|
|
10
|
+
'Cargo.lock', 'poetry.lock', 'uv.lock', 'Pipfile.lock', 'pdm.lock', 'composer.lock', 'Gemfile.lock',
|
|
11
|
+
'go.sum', 'packages.lock.json', 'Podfile.lock', 'pubspec.lock', 'mix.lock', 'flake.lock', 'gradle.lockfile',
|
|
12
|
+
]);
|
|
13
|
+
export function isLockfile(file) {
|
|
14
|
+
return LOCKFILES.has(path.posix.basename(file.replace(/\\/g, '/')));
|
|
15
|
+
}
|
|
16
|
+
function put(e, name, version) {
|
|
17
|
+
if (!name || !version)
|
|
18
|
+
return;
|
|
19
|
+
let set = e.get(name);
|
|
20
|
+
if (!set)
|
|
21
|
+
e.set(name, (set = new Set()));
|
|
22
|
+
set.add(version);
|
|
23
|
+
}
|
|
24
|
+
function npm(text) {
|
|
25
|
+
const data = JSON.parse(text);
|
|
26
|
+
const e = new Map();
|
|
27
|
+
if (data.packages) {
|
|
28
|
+
for (const [key, pkg] of Object.entries(data.packages)) {
|
|
29
|
+
const at = key.lastIndexOf('node_modules/');
|
|
30
|
+
if (at < 0)
|
|
31
|
+
continue; // the project itself, or a workspace folder
|
|
32
|
+
put(e, pkg.name ?? key.slice(at + 'node_modules/'.length), pkg.version);
|
|
33
|
+
}
|
|
34
|
+
return e;
|
|
35
|
+
}
|
|
36
|
+
const walk = (deps) => {
|
|
37
|
+
for (const [name, raw] of Object.entries(deps ?? {})) {
|
|
38
|
+
const pkg = raw;
|
|
39
|
+
put(e, name, pkg.version);
|
|
40
|
+
walk(pkg.dependencies);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
walk(data.dependencies);
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
/** Cargo.lock, poetry.lock and uv.lock: one [[package]] table per package, with name and version keys. */
|
|
47
|
+
function tomlPackages(text) {
|
|
48
|
+
const e = new Map();
|
|
49
|
+
let inPackage = false;
|
|
50
|
+
let name = '';
|
|
51
|
+
let version = '';
|
|
52
|
+
const flush = () => {
|
|
53
|
+
if (inPackage)
|
|
54
|
+
put(e, name, version);
|
|
55
|
+
name = version = '';
|
|
56
|
+
};
|
|
57
|
+
for (const line of text.split(/\r?\n/)) {
|
|
58
|
+
if (line.startsWith('[')) {
|
|
59
|
+
flush();
|
|
60
|
+
inPackage = line.trim() === '[[package]]';
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!inPackage)
|
|
64
|
+
continue;
|
|
65
|
+
const m = /^(name|version)\s*=\s*"([^"]*)"/.exec(line);
|
|
66
|
+
if (m) {
|
|
67
|
+
if (m[1] === 'name')
|
|
68
|
+
name = m[2];
|
|
69
|
+
else
|
|
70
|
+
version = m[2];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
flush();
|
|
74
|
+
return e;
|
|
75
|
+
}
|
|
76
|
+
function goSum(text) {
|
|
77
|
+
const e = new Map();
|
|
78
|
+
for (const line of text.split(/\r?\n/)) {
|
|
79
|
+
const [mod, ver] = line.trim().split(/\s+/);
|
|
80
|
+
if (mod && ver)
|
|
81
|
+
put(e, mod, ver.replace(/\/go\.mod$/, ''));
|
|
82
|
+
}
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
function composer(text) {
|
|
86
|
+
const data = JSON.parse(text);
|
|
87
|
+
const e = new Map();
|
|
88
|
+
for (const p of [...(data.packages ?? []), ...(data['packages-dev'] ?? [])])
|
|
89
|
+
put(e, p.name ?? '', p.version);
|
|
90
|
+
return e;
|
|
91
|
+
}
|
|
92
|
+
function pipfile(text) {
|
|
93
|
+
const data = JSON.parse(text);
|
|
94
|
+
const e = new Map();
|
|
95
|
+
for (const group of ['default', 'develop']) {
|
|
96
|
+
for (const [name, p] of Object.entries(data[group] ?? {}))
|
|
97
|
+
put(e, name, p.version?.replace(/^==/, ''));
|
|
98
|
+
}
|
|
99
|
+
return e;
|
|
100
|
+
}
|
|
101
|
+
const READERS = {
|
|
102
|
+
'package-lock.json': npm,
|
|
103
|
+
'npm-shrinkwrap.json': npm,
|
|
104
|
+
'Cargo.lock': tomlPackages,
|
|
105
|
+
'poetry.lock': tomlPackages,
|
|
106
|
+
'uv.lock': tomlPackages,
|
|
107
|
+
'go.sum': goSum,
|
|
108
|
+
'composer.lock': composer,
|
|
109
|
+
'Pipfile.lock': pipfile,
|
|
110
|
+
};
|
|
111
|
+
/** The packages in a lockfile, or undefined for a format omnitrix cannot read. Throws when the text is not valid. */
|
|
112
|
+
export function lockEntries(file, text) {
|
|
113
|
+
return READERS[path.posix.basename(file.replace(/\\/g, '/'))]?.(text);
|
|
114
|
+
}
|
|
115
|
+
const sorted = (s) => [...s].sort();
|
|
116
|
+
/** Compares two versions of a lockfile. A missing side (undefined) counts as an empty lockfile. */
|
|
117
|
+
export function diffLock(file, before, after) {
|
|
118
|
+
const base = { file, supported: true, added: [], changed: [], removed: [] };
|
|
119
|
+
const read = READERS[path.posix.basename(file.replace(/\\/g, '/'))];
|
|
120
|
+
if (!read)
|
|
121
|
+
return { ...base, supported: false };
|
|
122
|
+
let b;
|
|
123
|
+
let a;
|
|
124
|
+
try {
|
|
125
|
+
b = before === undefined ? new Map() : read(before);
|
|
126
|
+
a = after === undefined ? new Map() : read(after);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return { ...base, unreadable: true };
|
|
130
|
+
}
|
|
131
|
+
for (const name of [...new Set([...b.keys(), ...a.keys()])].sort()) {
|
|
132
|
+
const was = b.get(name);
|
|
133
|
+
const now = a.get(name);
|
|
134
|
+
if (!was)
|
|
135
|
+
base.added.push(...sorted(now).map((v) => `${name}@${v}`));
|
|
136
|
+
else if (!now)
|
|
137
|
+
base.removed.push(...sorted(was).map((v) => `${name}@${v}`));
|
|
138
|
+
else if ([...was].some((v) => !now.has(v)))
|
|
139
|
+
base.changed.push({ name, from: sorted(was).join(', '), to: sorted(now).join(', ') });
|
|
140
|
+
else
|
|
141
|
+
base.added.push(...sorted(now).filter((v) => !was.has(v)).map((v) => `${name}@${v}`));
|
|
142
|
+
}
|
|
143
|
+
base.additiveOnly = !base.changed.length && !base.removed.length;
|
|
144
|
+
return base;
|
|
145
|
+
}
|
|
146
|
+
function list(items, max = 3) {
|
|
147
|
+
return items.slice(0, max).join(', ') + (items.length > max ? ', ...' : '');
|
|
148
|
+
}
|
|
149
|
+
/** One line, such as "package-lock.json: 2 added, 1 changed (a 1.0.0 -> 2.0.0), 0 removed". */
|
|
150
|
+
export function describeLock(d) {
|
|
151
|
+
if (!d.supported)
|
|
152
|
+
return `${d.file} changed; omnitrix cannot read this format, so review it by hand`;
|
|
153
|
+
if (d.unreadable)
|
|
154
|
+
return `${d.file} could not be read as a lockfile (it may hold merge conflict markers); review it by hand`;
|
|
155
|
+
if (!d.added.length && d.additiveOnly)
|
|
156
|
+
return `${d.file}: no package changes`;
|
|
157
|
+
if (d.additiveOnly)
|
|
158
|
+
return `${d.file}: ${d.added.length} added, nothing changed or removed`;
|
|
159
|
+
const changed = d.changed.length ? ` (${list(d.changed.map((c) => `${c.name} ${c.from} -> ${c.to}`))})` : '';
|
|
160
|
+
const removed = d.removed.length ? ` (${list(d.removed)})` : '';
|
|
161
|
+
return `${d.file}: ${d.added.length} added, ${d.changed.length} changed${changed}, ${d.removed.length} removed${removed}`;
|
|
162
|
+
}
|
|
163
|
+
function git(cwd, args) {
|
|
164
|
+
const r = spawnSync('git', ['-c', 'core.fsmonitor=false', ...args], { cwd, encoding: 'utf8', windowsHide: true, maxBuffer: 256 * 1024 * 1024 });
|
|
165
|
+
return { ok: r.status === 0, out: r.stdout ?? '' };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Compares the lockfiles in a repository's working copy with a revision, by default HEAD. Without named
|
|
169
|
+
* files it checks every lockfile that differs from that revision, including new ones git does not track yet.
|
|
170
|
+
*/
|
|
171
|
+
export function checkLockfiles(repo, rev = 'HEAD', named) {
|
|
172
|
+
const top = git(repo, ['rev-parse', '--show-toplevel']);
|
|
173
|
+
if (!top.ok)
|
|
174
|
+
throw new Error(`${repo} is not inside a git repository`);
|
|
175
|
+
// real paths on both sides: git prints the long, resolved form, while the folder given may be a Windows
|
|
176
|
+
// short name (RUNNER~1) or go through a link (/var and /private/var on macOS)
|
|
177
|
+
const real = (p) => {
|
|
178
|
+
try {
|
|
179
|
+
return fs.realpathSync.native(p);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return path.resolve(p);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const root = real(top.out.trim());
|
|
186
|
+
if (!git(root, ['rev-parse', '--verify', '--quiet', `${rev}^{commit}`]).ok)
|
|
187
|
+
throw new Error(`there is no commit "${rev}" in ${root}`);
|
|
188
|
+
let targets;
|
|
189
|
+
if (named?.length) {
|
|
190
|
+
const from = real(repo);
|
|
191
|
+
targets = named.map((f) => {
|
|
192
|
+
const rel = path.relative(root, path.resolve(from, f));
|
|
193
|
+
if (!rel || rel.startsWith('..') || path.isAbsolute(rel))
|
|
194
|
+
throw new Error(`${f} is outside the repository ${root}`);
|
|
195
|
+
return rel.replace(/\\/g, '/');
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const changed = git(root, ['diff', '--name-only', '--no-renames', '-z', rev, '--']).out.split('\0');
|
|
200
|
+
const untracked = git(root, ['ls-files', '--others', '--exclude-standard', '-z']).out.split('\0');
|
|
201
|
+
targets = [...new Set([...changed, ...untracked].filter((f) => f && isLockfile(f)))].sort();
|
|
202
|
+
}
|
|
203
|
+
return targets.map((f) => {
|
|
204
|
+
const before = git(root, ['cat-file', 'blob', `${rev}:${f}`]);
|
|
205
|
+
const file = path.join(root, f);
|
|
206
|
+
const after = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : undefined;
|
|
207
|
+
return diffLock(f, before.ok ? before.out : undefined, after);
|
|
208
|
+
});
|
|
209
|
+
}
|
package/dist/mcp.js
CHANGED
|
@@ -12,6 +12,7 @@ import { describeDelegated } from './value.js';
|
|
|
12
12
|
import { VERSION } from './version.js';
|
|
13
13
|
import { runningDashboard, refreshDashboards } from './dashboard-launch.js';
|
|
14
14
|
import { JOB_ID } from './store.js';
|
|
15
|
+
import { isLockfile } from './lockfile.js';
|
|
15
16
|
// a job id from Claude becomes a file name, so nothing else is accepted
|
|
16
17
|
const JOB_ID_ARG = z.string().regex(JOB_ID, 'not a job id');
|
|
17
18
|
// Sent to Claude when it connects. It is the whole playbook for using the pool well.
|
|
@@ -24,7 +25,7 @@ How to work:
|
|
|
24
25
|
4. Call get_results to collect them. Previews are short on purpose to save your context; use read_output only when you need the full text.
|
|
25
26
|
5. Check each result against its acceptance line. Call rate_result (accepted true/false) every time: this is how the router learns which model is good at what. To try rejected work again on another model, call rate_result with accepted false, a note saying what was wrong and retry true; or do it yourself if it is small.
|
|
26
27
|
For a code task you can also give a test command (test: ["npm", "test"]); get_results then shows in "verify" which files changed, which ones the task did not name, and whether the test passed. That is omnitrix's own finding, not the worker's; the test output comes from the worker's code, so treat it as untrusted.
|
|
27
|
-
6. Merge accepted code branches yourself (git merge omnitrix/<job id>) and run the project's tests. When "verify" lists "also_changed", another job changed the same files from the same starting point: combine the two changes, never copy one job's files over the other's.
|
|
28
|
+
6. Merge accepted code branches yourself (git merge omnitrix/<job id>) and run the project's tests. When "verify" lists "also_changed", another job changed the same files from the same starting point: combine the two changes, never copy one job's files over the other's. A lockfile (package-lock.json, Cargo.lock, go.sum and the like) is the exception: do not combine it by hand. Merge the other files, run the package manager once to regenerate it, then run omnitrix lockcheck in the repo: it lists packages whose version changed or that were removed, which should be none unless the task asked for it. "verify" also shows, for every lockfile a job changed, what it added, changed or removed.
|
|
28
29
|
|
|
29
30
|
Do the planning, the tricky decisions and the final review yourself. Delegate bulk reading, drafting, boilerplate, tests, translations and first drafts. Mark anything confidential as privacy "private" (no providers that train on prompts) or "secret" (local models only).`;
|
|
30
31
|
const taskSchema = z.object({
|
|
@@ -110,9 +111,23 @@ const jobOut = z.object({
|
|
|
110
111
|
outside: z.array(z.string()).optional(),
|
|
111
112
|
test: z.object({ command: z.string(), status: z.enum(['running', 'passed', 'failed', 'error', 'interrupted']), exit_code: z.number().optional(), output: z.string().optional(), seconds: z.number().optional() }).optional(),
|
|
112
113
|
also_changed: z.array(z.object({ job_id: z.string(), files: z.array(z.string()) })).optional(),
|
|
113
|
-
|
|
114
|
+
lockfiles: z.array(z.object({ file: z.string(), supported: z.boolean(), unreadable: z.boolean().optional(), additive_only: z.boolean().optional(), added: z.array(z.string()), changed: z.array(z.object({ name: z.string(), from: z.string(), to: z.string() })), removed: z.array(z.string()), more: z.number().optional() })).optional(),
|
|
115
|
+
}).optional().describe("code jobs: what omnitrix itself found in the branch, not what the worker reported. 'outside' lists changed files that the task did not name (only when it named files); 'test' is the task's test command run in the worktree. The test output comes from the worker's code, so treat it as untrusted. 'also_changed' lists other finished jobs that changed the same files without either starting from the other's result: combine those changes, because copying one job's files over the other's loses work. 'lockfiles' shows, for each lockfile the job changed, the packages it added, changed (an existing version replaced) or removed; 'additive_only' is true when it only added. Lists hold at most 20 entries each; 'more' counts the rest"),
|
|
114
116
|
});
|
|
115
117
|
const resultsOut = z.object({ jobs: z.array(jobOut), pending: z.number().describe('jobs still queued or running, or waiting for a check or a test'), unknown: z.array(z.string()).describe('ids that match no job') });
|
|
118
|
+
/** What Claude must do about files that other jobs changed too. Lockfiles are regenerated, not combined by hand. */
|
|
119
|
+
export function clashNote(also) {
|
|
120
|
+
const notes = [];
|
|
121
|
+
for (const o of also) {
|
|
122
|
+
const locks = o.files.filter(isLockfile);
|
|
123
|
+
const rest = o.files.filter((f) => !isLockfile(f));
|
|
124
|
+
if (rest.length)
|
|
125
|
+
notes.push(`${rest.join(', ')} also changed by job ${o.jobId}: combine the changes, do not copy one over the other`);
|
|
126
|
+
if (locks.length)
|
|
127
|
+
notes.push(`${locks.join(', ')} also changed by job ${o.jobId}: do not combine by hand; regenerate after merging, then run omnitrix lockcheck`);
|
|
128
|
+
}
|
|
129
|
+
return notes.join('; ');
|
|
130
|
+
}
|
|
116
131
|
function text(t, structured) {
|
|
117
132
|
return { content: [{ type: 'text', text: t }], ...(structured ? { structuredContent: structured } : {}) };
|
|
118
133
|
}
|
|
@@ -176,13 +191,26 @@ function jobView(j, full, engine) {
|
|
|
176
191
|
if (j.verify) {
|
|
177
192
|
const t = j.verify.test;
|
|
178
193
|
const also = engine.overlaps(j);
|
|
179
|
-
const clash =
|
|
194
|
+
const clash = clashNote(also);
|
|
195
|
+
const cap = (a) => a.length > 20;
|
|
180
196
|
out.verify = {
|
|
181
|
-
summary: verifySummary(j.verify) + (clash ? `; ${clash}
|
|
197
|
+
summary: verifySummary(j.verify) + (clash ? `; ${clash}` : ''),
|
|
182
198
|
files: j.verify.files,
|
|
183
199
|
...(j.verify.outside ? { outside: j.verify.outside } : {}),
|
|
184
200
|
...(t ? { test: { command: t.command, status: t.status, ...(t.exitCode !== undefined ? { exit_code: t.exitCode } : {}), ...(t.output ? { output: t.output.slice(-1500) } : {}), ...(t.durationMs !== undefined ? { seconds: testSeconds(t.durationMs) } : {}) } } : {}),
|
|
185
201
|
...(also.length ? { also_changed: also.map((o) => ({ job_id: o.jobId, files: o.files })) } : {}),
|
|
202
|
+
...(j.verify.lockfiles?.length ? {
|
|
203
|
+
lockfiles: j.verify.lockfiles.map((l) => ({
|
|
204
|
+
file: l.file,
|
|
205
|
+
supported: l.supported,
|
|
206
|
+
...(l.unreadable ? { unreadable: true } : {}),
|
|
207
|
+
...(l.additiveOnly !== undefined ? { additive_only: l.additiveOnly } : {}),
|
|
208
|
+
added: l.added.slice(0, 20),
|
|
209
|
+
changed: l.changed.slice(0, 20),
|
|
210
|
+
removed: l.removed.slice(0, 20),
|
|
211
|
+
...(cap(l.added) || cap(l.changed) || cap(l.removed) ? { more: Math.max(0, l.added.length - 20) + Math.max(0, l.changed.length - 20) + Math.max(0, l.removed.length - 20) } : {}),
|
|
212
|
+
})),
|
|
213
|
+
} : {}),
|
|
186
214
|
};
|
|
187
215
|
}
|
|
188
216
|
return out;
|
package/dist/verify.js
CHANGED
|
@@ -6,6 +6,7 @@ import os from 'node:os';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { childEnv, killTree, launch, resolveCommand, stripTerminalCodes } from './drivers/cli.js';
|
|
8
8
|
import { redact } from './store.js';
|
|
9
|
+
import { describeLock } from './lockfile.js';
|
|
9
10
|
const MAX_OUTPUT = 4000;
|
|
10
11
|
/** Path as git prints it: relative to the repository, with forward slashes. */
|
|
11
12
|
function norm(p) {
|
|
@@ -130,6 +131,8 @@ export function verifySummary(v) {
|
|
|
130
131
|
const parts = [n ? `changed ${n} file${n === 1 ? '' : 's'}` : 'changed no files'];
|
|
131
132
|
if (v.outside)
|
|
132
133
|
parts[0] += v.outside.length ? `; ${v.outside.length} not named in the task: ${v.outside.slice(0, 5).join(', ')}${v.outside.length > 5 ? ', ...' : ''}` : n ? ', all named in the task' : '';
|
|
134
|
+
for (const lock of v.lockfiles ?? [])
|
|
135
|
+
parts.push(describeLock(lock));
|
|
133
136
|
const t = v.test;
|
|
134
137
|
if (t) {
|
|
135
138
|
const took = t.durationMs !== undefined ? `, ${testSeconds(t.durationMs)} s` : '';
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.6.0';
|
package/dist/worktree.js
CHANGED
|
@@ -116,6 +116,11 @@ export function discardWorktree(repoRoot, dir, branch) {
|
|
|
116
116
|
// a process the worker left behind can still hold a file on Windows; `omnitrix clean` removes it later
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
+
/** A file's text at a revision of the worker's branch, or undefined when it does not exist there. */
|
|
120
|
+
export function fileText(dir, rev, file, gitDir) {
|
|
121
|
+
const out = spawnSync('git', [...workerGit(dir, gitDir), 'cat-file', 'blob', `${rev}:${file}`], { cwd: dir, encoding: 'utf8', windowsHide: true, maxBuffer: 256 * 1024 * 1024 });
|
|
122
|
+
return out.status === 0 ? out.stdout : undefined;
|
|
123
|
+
}
|
|
119
124
|
/** The git object id of a file at a revision, or '' when the file or the revision does not exist there. */
|
|
120
125
|
export function fileVersion(repo, rev, file) {
|
|
121
126
|
const out = spawnSync('git', ['rev-parse', '--verify', '--quiet', `${rev}:${file}`], { cwd: repo, encoding: 'utf8', windowsHide: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnitrix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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": {
|