omnirush 0.7.0 → 0.8.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.
Files changed (31) hide show
  1. package/assets/collect-once.ts +72 -141
  2. package/assets/extensions/omnirush/agents-lib.ts +23 -13
  3. package/assets/extensions/omnirush/agents.ts +19 -24
  4. package/assets/extensions/omnirush/capture/UPSTREAM +21 -0
  5. package/assets/extensions/omnirush/capture/collect-upload-budget.ts +39 -0
  6. package/assets/extensions/omnirush/capture/omnirush-swarm.ts +6 -0
  7. package/assets/extensions/omnirush/capture/server-fetch.ts +8 -0
  8. package/assets/extensions/omnirush/capture/session-archive/detect.ts +410 -0
  9. package/assets/extensions/omnirush/capture/session-archive/files.ts +85 -0
  10. package/assets/extensions/omnirush/capture/session-archive/ignored.ts +123 -0
  11. package/assets/extensions/omnirush/capture/session-archive/index.ts +1468 -0
  12. package/assets/extensions/omnirush/capture/session-archive/lifecycle.ts +606 -0
  13. package/assets/extensions/omnirush/capture/session-archive/manifest.ts +827 -0
  14. package/assets/extensions/omnirush/capture/session-archive/pack.ts +481 -0
  15. package/assets/extensions/omnirush/capture/session-archive/policy.ts +21 -0
  16. package/assets/extensions/omnirush/capture/session-archive/seal.ts +481 -0
  17. package/assets/extensions/omnirush/capture/session-archive/touched.ts +550 -0
  18. package/assets/extensions/omnirush/capture/session-archive/upload.ts +601 -0
  19. package/assets/extensions/omnirush/capture/turn-diff.ts +661 -0
  20. package/assets/extensions/omnirush/capture/vendor/minimatch.js +4 -0
  21. package/assets/extensions/omnirush/capture/vendor/zod.js +60 -0
  22. package/assets/extensions/omnirush/capture/workspace-collector.ts +5021 -0
  23. package/assets/extensions/omnirush/collector.ts +539 -171
  24. package/assets/extensions/omnirush/commands.ts +1 -1
  25. package/assets/extensions/omnirush/pi-engine.ts +655 -0
  26. package/assets/extensions/omnirush/plan.ts +6 -7
  27. package/package.json +5 -2
  28. package/scripts/build-capture-vendor.js +55 -0
  29. package/src/bin.js +30 -5
  30. package/assets/extensions/omnirush/collector-lib.ts +0 -2433
  31. package/assets/extensions/omnirush/trace-format.ts +0 -311
@@ -3,10 +3,10 @@
3
3
  // The model maintains an ordered task list (items with pending /
4
4
  // in-progress / done statuses) while it works. Every update:
5
5
  // - persists to <cwd>/__agent__/plan.json (the workspace collector
6
- // ships it, so buyers see how the agent structured the work),
7
- // - appends an `omnirush.plan` custom entry to the session JSONL —
8
- // trace-format.ts carries those as additive `plan_records` on the
9
- // trace artifact,
6
+ // ships it with the workspace snapshots),
7
+ // - appends an `omnirush.plan` custom entry to the session JSONL (the
8
+ // tool call itself, with the whole list, reaches the trace as a tool
9
+ // part of the session's engine messages),
10
10
  // - renders one line in the footer via ctx.ui.setStatus,
11
11
  // - returns the full list as the tool result.
12
12
  //
@@ -33,9 +33,8 @@ import {
33
33
  const PLAN_TOOL_NAME = "plan";
34
34
  const PLAN_ENTRY_TYPE = "omnirush.plan";
35
35
  const PLAN_STATUS_KEY = "omnirush-plan";
36
- // Same directory the collector journals under — it ships with the
37
- // workspace trace. (Mirrors collector-lib's AGENT_DIR; kept local so
38
- // this module stays independent of the collector's implementation.)
36
+ // The plan file's folder in the workspace (the CLI's earlier collector
37
+ // kept its journal there too).
39
38
  const AGENT_DIR = "__agent__";
40
39
 
41
40
  const PlanParams = Type.Object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnirush",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Omnirush \u2014 free daily tokens for the most powerful coding model on earth.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -14,6 +14,7 @@
14
14
  "test": "node --test",
15
15
  "test:bun": "if [ -x .runtime/bin/bun ]; then .runtime/bin/bun test --timeout 300000 test/; else bun test --timeout 300000 test/; fi",
16
16
  "build:mcp": "node scripts/build-mcp-bundle.js",
17
+ "build:capture-vendor": "node scripts/build-capture-vendor.js",
17
18
  "postinstall": "node scripts/patch-pi-branding.js && node scripts/postinstall.js"
18
19
  },
19
20
  "dependencies": {
@@ -36,6 +37,8 @@
36
37
  ],
37
38
  "devDependencies": {
38
39
  "@modelcontextprotocol/sdk": "^1.30.0",
39
- "esbuild": "^0.28.2"
40
+ "esbuild": "^0.28.2",
41
+ "minimatch": "^10.2.6",
42
+ "zod": "^4.6.5"
40
43
  }
41
44
  }
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ // Bundle the two npm libraries the ported capture modules use (zod for the
3
+ // project archive's state/queue/API schemas, minimatch for the .gitignore
4
+ // fallback matcher) into self-contained ESM files committed at
5
+ // assets/extensions/omnirush/capture/vendor/.
6
+ //
7
+ // Same reason as the MCP bundle (scripts/build-mcp-bundle.js): the extension
8
+ // directory is copied to ~/.pi/agent/extensions/omnirush/ where there is no
9
+ // npm resolution, and the published package ships no node_modules. The
10
+ // versions are the devDependencies in package.json, kept in step with the
11
+ // desktop app's (omnirush-gui apps/server/package.json). Regenerate with:
12
+ //
13
+ // npm run build:capture-vendor
14
+
15
+ import { build } from "esbuild";
16
+ import { readFileSync } from "node:fs";
17
+ import path from "node:path";
18
+ import { fileURLToPath } from "node:url";
19
+
20
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
21
+ const outdir = path.join(root, "assets", "extensions", "omnirush", "capture", "vendor");
22
+ const version = (name) => JSON.parse(readFileSync(path.join(root, "node_modules", name, "package.json"), "utf8")).version;
23
+
24
+ for (const [name, source] of [
25
+ // Only the schema builders the archive modules call (tree-shaken: the whole
26
+ // zod namespace with its locales is ~450 KiB minified, this is ~95 KiB).
27
+ // `z.infer` is type-only and never reaches the runtime.
28
+ [
29
+ "zod",
30
+ 'import { object, string, number, literal, enum as zenum, array, record, boolean } from "zod";\n' +
31
+ "export const z = { object, string, number, literal, enum: zenum, array, record, boolean };",
32
+ ],
33
+ ["minimatch", 'export { minimatch } from "minimatch";'],
34
+ ]) {
35
+ await build({
36
+ stdin: { contents: source, resolveDir: root, loader: "js" },
37
+ outfile: path.join(outdir, `${name}.js`),
38
+ bundle: true,
39
+ platform: "node",
40
+ format: "esm",
41
+ target: "node18",
42
+ external: ["node:*"],
43
+ minify: true,
44
+ sourcemap: false,
45
+ legalComments: "none",
46
+ logLevel: "info",
47
+ banner: {
48
+ js: [
49
+ "// GENERATED FILE — do not edit by hand.",
50
+ "// Regenerate with: npm run build:capture-vendor",
51
+ `// Bundled from ${name}@${version(name)} (devDependency) via esbuild.`,
52
+ ].join("\n"),
53
+ },
54
+ });
55
+ }
package/src/bin.js CHANGED
@@ -164,11 +164,23 @@ function installModelsJson(gatewayUrl) {
164
164
 
165
165
  function installExtensions() {
166
166
  const src = path.join(__dirname, "..", "assets", "extensions", "omnirush");
167
- for (const f of fs.readdirSync(src)) {
168
- // pi loads extensions/<dir>/index.ts only; that aggregator imports the
169
- // sibling .ts modules and the shared auth.js — copy all loadable files.
170
- if (!f.endsWith(".ts") && !f.endsWith(".js")) continue;
171
- fs.copyFileSync(path.join(src, f), path.join(PI_EXT_DIR, f));
167
+ // pi loads extensions/<dir>/index.ts only; that aggregator imports the
168
+ // sibling .ts modules, the shared auth.js and the capture/ modules (the
169
+ // desktop's collector and project archive, in subfolders) — copy every
170
+ // loadable file, keeping the folder layout.
171
+ const copy = (from, to) => {
172
+ fs.mkdirSync(to, { recursive: true });
173
+ for (const entry of fs.readdirSync(from, { withFileTypes: true })) {
174
+ if (entry.isDirectory()) copy(path.join(from, entry.name), path.join(to, entry.name));
175
+ else if (entry.name.endsWith(".ts") || entry.name.endsWith(".js")) {
176
+ fs.copyFileSync(path.join(from, entry.name), path.join(to, entry.name));
177
+ }
178
+ }
179
+ };
180
+ copy(src, PI_EXT_DIR);
181
+ // Modules of the earlier collector: nothing imports them any more.
182
+ for (const stale of ["collector-lib.ts", "trace-format.ts"]) {
183
+ fs.rmSync(path.join(PI_EXT_DIR, stale), { force: true });
172
184
  }
173
185
  }
174
186
 
@@ -621,6 +633,17 @@ function bunVersionOf(bunPath) {
621
633
  }
622
634
  }
623
635
 
636
+ /** The agent core release the launcher pins (its package.json reports ours after the branding patch). */
637
+ function engineVersion() {
638
+ try {
639
+ const pinned = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"))
640
+ .dependencies?.["@earendil-works/pi-coding-agent"];
641
+ return typeof pinned === "string" ? pinned.replace(/^[^\d]*/, "") : "";
642
+ } catch {
643
+ return "";
644
+ }
645
+ }
646
+
624
647
  function ownVersion() {
625
648
  try {
626
649
  return JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8")).version;
@@ -642,6 +665,8 @@ function childEnv(auth) {
642
665
  // /status shows the CLI version; extensions have no package.json of
643
666
  // their own in ~/.pi, so the launcher hands it over.
644
667
  OMNIRUSH_VERSION: ownVersion(),
668
+ // The collector reports it as the environment's engine_version.
669
+ OMNIRUSH_ENGINE_VERSION: engineVersion(),
645
670
  // The agent resolves its config dir from <APP>_CODING_AGENT_DIR. The
646
671
  // branding patch renames the app to omnirush, so set the omnirush
647
672
  // spelling; the pi spelling stays for unpatched cores.