@castlemilk/omega 0.6.15 → 0.6.17

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 (57) hide show
  1. package/dist/cli.js +328 -22
  2. package/dist/server/dist/app.js +2 -2
  3. package/dist/server/dist/app.js.map +1 -1
  4. package/dist/server/dist/routes/benchmarks.d.ts +4 -0
  5. package/dist/server/dist/routes/benchmarks.d.ts.map +1 -0
  6. package/dist/server/dist/routes/benchmarks.js +129 -0
  7. package/dist/server/dist/routes/benchmarks.js.map +1 -0
  8. package/dist/server/dist/routes/metrics.d.ts.map +1 -1
  9. package/dist/server/dist/routes/metrics.js +1 -3
  10. package/dist/server/dist/routes/metrics.js.map +1 -1
  11. package/dist/server/dist/routes/prompt-versions.d.ts.map +1 -1
  12. package/dist/server/dist/routes/prompt-versions.js +15 -19
  13. package/dist/server/dist/routes/prompt-versions.js.map +1 -1
  14. package/dist/server/node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js +0 -0
  15. package/dist/server/node_modules/@omega/agent/dist/executor.js +23 -1
  16. package/dist/server/node_modules/@omega/agent/dist/executor.js.map +1 -1
  17. package/dist/server/node_modules/@omega/agent/dist/index.d.ts +1 -1
  18. package/dist/server/node_modules/@omega/agent/dist/index.d.ts.map +1 -1
  19. package/dist/server/node_modules/@omega/agent/dist/index.js +1 -1
  20. package/dist/server/node_modules/@omega/agent/dist/index.js.map +1 -1
  21. package/dist/server/node_modules/@omega/agent/dist/prompts.d.ts +1 -1
  22. package/dist/server/node_modules/@omega/agent/dist/prompts.d.ts.map +1 -1
  23. package/dist/server/node_modules/@omega/agent/dist/prompts.js +34 -13
  24. package/dist/server/node_modules/@omega/agent/dist/prompts.js.map +1 -1
  25. package/dist/server/node_modules/@omega/db/generated/client/libquery_engine-darwin-arm64.dylib.node +0 -0
  26. package/dist/server/node_modules/mime/cli.js +0 -0
  27. package/dist/server/node_modules/mime/src/build.js +0 -0
  28. package/dist/server/node_modules/wrap-ansi/index.js +0 -0
  29. package/dist/server/pglite-data/base/5/1247 +0 -0
  30. package/dist/server/pglite-data/base/5/1249 +0 -0
  31. package/dist/server/pglite-data/base/5/1259 +0 -0
  32. package/dist/server/pglite-data/base/5/16394 +0 -0
  33. package/dist/server/pglite-data/base/5/16404 +0 -0
  34. package/dist/server/pglite-data/base/5/16406 +0 -0
  35. package/dist/server/pglite-data/base/5/16421 +0 -0
  36. package/dist/server/pglite-data/base/5/16510 +0 -0
  37. package/dist/server/pglite-data/base/5/2604 +0 -0
  38. package/dist/server/pglite-data/base/5/2606 +0 -0
  39. package/dist/server/pglite-data/base/5/2610 +0 -0
  40. package/dist/server/pglite-data/base/5/2620 +0 -0
  41. package/dist/server/pglite-data/base/5/2662 +0 -0
  42. package/dist/server/pglite-data/base/5/2663 +0 -0
  43. package/dist/server/pglite-data/base/5/pg_internal.init +0 -0
  44. package/dist/server/pglite-data/global/pg_control +0 -0
  45. package/dist/server/pglite-data/global/pg_internal.init +0 -0
  46. package/dist/server/pglite-data/pg_wal/000000010000000000000001 +0 -0
  47. package/dist/server/pglite-data/pg_xact/0000 +0 -0
  48. package/dist/server/pglite-data/postmaster.pid +1 -1
  49. package/dist/server/src/app.ts +2 -2
  50. package/dist/server/src/routes/benchmarks.ts +150 -0
  51. package/dist/server/src/routes/metrics.ts +1 -3
  52. package/dist/server/src/routes/prompt-versions.ts +15 -20
  53. package/dist/web/dist/assets/index-B_XBuJZF.js +40 -0
  54. package/dist/web/dist/assets/index-CL9S3Jj5.js +40 -0
  55. package/dist/web/dist/assets/index-bU-GzLxD.css +1 -0
  56. package/dist/web/dist/index.html +2 -2
  57. package/package.json +14 -13
package/dist/cli.js CHANGED
@@ -982,7 +982,7 @@ async function runBenchmark(tasks, options) {
982
982
  }
983
983
  await runTask(apiUrl, harnessTask.id);
984
984
  const finished = await waitForTask(apiUrl, harnessTask.id, timeoutMs);
985
- status = finished.status === "timeout" ? "timeout" : finished.status;
985
+ const harnessStatus = finished.status === "timeout" ? "timeout" : finished.status;
986
986
  [agentRun, diffs, traceFlow] = await Promise.all([
987
987
  getAgentRun(apiUrl, harnessTask.id),
988
988
  getDiffs(apiUrl, harnessTask.id),
@@ -997,11 +997,13 @@ async function runBenchmark(tasks, options) {
997
997
  diffs,
998
998
  traceFlow
999
999
  });
1000
+ status = harnessStatus === "timeout" ? "timeout" : evaluation.passed ? "done" : "failed";
1000
1001
  } catch (err) {
1001
1002
  evaluation = {
1002
1003
  passed: false,
1003
1004
  message: err instanceof Error ? err.message : String(err)
1004
1005
  };
1006
+ status = "failed";
1005
1007
  }
1006
1008
  const durationMs = Date.now() - start;
1007
1009
  const result = {
@@ -1128,6 +1130,28 @@ function basePackage() {
1128
1130
  }
1129
1131
  };
1130
1132
  }
1133
+ function simpleTask(id, name, title, description, files, complexity = "simple") {
1134
+ return {
1135
+ id,
1136
+ name,
1137
+ title,
1138
+ description,
1139
+ complexity,
1140
+ setup: async (projectPath) => {
1141
+ await writeJson(projectPath, "package.json", basePackage());
1142
+ for (const [file, content] of Object.entries(files)) {
1143
+ await writeFile2(projectPath, file, content);
1144
+ }
1145
+ if (!files["lint.js"])
1146
+ await writeFile2(projectPath, "lint.js", `console.log('lint ok');
1147
+ `);
1148
+ if (!files["build.js"])
1149
+ await writeFile2(projectPath, "build.js", `console.log('build ok');
1150
+ `);
1151
+ },
1152
+ evaluate: (ctx) => Promise.resolve(validate(ctx))
1153
+ };
1154
+ }
1131
1155
  var TASKS = [
1132
1156
  {
1133
1157
  id: "greet-function",
@@ -1220,6 +1244,259 @@ console.log('constant test passed');
1220
1244
  },
1221
1245
  evaluate: (ctx) => Promise.resolve(validate(ctx))
1222
1246
  },
1247
+ simpleTask("sum-function", "Add a sum function", "Add math.js with a sum function", "Create math.js that exports sum(a, b) returning the numeric sum of the two arguments.", {
1248
+ "test.js": `import { sum } from './math.js';
1249
+ import assert from 'node:assert';
1250
+ assert.strictEqual(sum(2, 3), 5);
1251
+ assert.strictEqual(sum(-1, 1), 0);
1252
+ console.log('sum test passed');
1253
+ `
1254
+ }),
1255
+ simpleTask("reverse-string", "Add reverse string function", "Add string.js with reverse function", "Create string.js that exports reverse(str) returning the input string reversed.", {
1256
+ "test.js": `import { reverse } from './string.js';
1257
+ import assert from 'node:assert';
1258
+ assert.strictEqual(reverse('abc'), 'cba');
1259
+ assert.strictEqual(reverse('Hello'), 'olleH');
1260
+ console.log('reverse test passed');
1261
+ `
1262
+ }),
1263
+ simpleTask("is-even", "Add isEven helper", "Add helpers.js with isEven function", "Create helpers.js that exports isEven(n) returning true when n is divisible by 2.", {
1264
+ "test.js": `import { isEven } from './helpers.js';
1265
+ import assert from 'node:assert';
1266
+ assert.strictEqual(isEven(4), true);
1267
+ assert.strictEqual(isEven(3), false);
1268
+ console.log('isEven test passed');
1269
+ `
1270
+ }),
1271
+ simpleTask("uppercase-first", "Uppercase first letter", "Add capitalize.js with capitalize function", "Create capitalize.js that exports capitalize(str) returning the string with the first character upper-cased.", {
1272
+ "test.js": `import { capitalize } from './capitalize.js';
1273
+ import assert from 'node:assert';
1274
+ assert.strictEqual(capitalize('hello'), 'Hello');
1275
+ assert.strictEqual(capitalize(''), '');
1276
+ console.log('capitalize test passed');
1277
+ `
1278
+ }),
1279
+ simpleTask("remove-console-log", "Remove debug console.log", "Clean up debug logging", "Remove the console.log call from src/main.js so the linter passes. Do not change the exported function behavior.", {
1280
+ "src/main.js": `export function run() { console.log('debug'); return 'ok'; }
1281
+ `,
1282
+ "test.js": `import { run } from './src/main.js';
1283
+ import assert from 'node:assert';
1284
+ assert.strictEqual(run(), 'ok');
1285
+ console.log('run test passed');
1286
+ `,
1287
+ "lint.js": `import fs from 'node:fs/promises';
1288
+ const code = await fs.readFile('./src/main.js', 'utf-8');
1289
+ if (code.includes('console.log')) { console.error('lint failed: console.log found'); process.exit(1); }
1290
+ console.log('lint ok');
1291
+ `
1292
+ }),
1293
+ simpleTask("fix-indentation", "Fix indentation", "Normalize indentation in src/code.js", "Convert the mixed tabs/spaces indentation in src/code.js to two spaces so the lint script passes. Keep behavior.", {
1294
+ "src/code.js": `export function add(a, b) {
1295
+ return a + b;
1296
+ }
1297
+ `,
1298
+ "test.js": `import { add } from './src/code.js';
1299
+ import assert from 'node:assert';
1300
+ assert.strictEqual(add(1, 2), 3);
1301
+ console.log('add test passed');
1302
+ `,
1303
+ "lint.js": `import fs from 'node:fs/promises';
1304
+ const code = await fs.readFile('./src/code.js', 'utf-8');
1305
+ if (code.includes('\\t')) { console.error('lint failed: tabs found'); process.exit(1); }
1306
+ console.log('lint ok');
1307
+ `
1308
+ }),
1309
+ simpleTask("arrow-function", "Convert to arrow function", "Refactor src/math.js to use arrow function", "Rewrite src/math.js so double is defined as a const arrow function. Do not change behavior.", {
1310
+ "src/math.js": `export function double(n) { return n * 2; }
1311
+ `,
1312
+ "test.js": `import fs from 'node:fs/promises';
1313
+ import { double } from './src/math.js';
1314
+ import assert from 'node:assert';
1315
+ const code = await fs.readFile('./src/math.js', 'utf-8');
1316
+ assert.strictEqual(double(5), 10);
1317
+ if (!code.includes('=>')) { console.error('lint failed: not arrow function'); process.exit(1); }
1318
+ console.log('arrow test passed');
1319
+ `
1320
+ }),
1321
+ simpleTask("default-export", "Add a default export", "Make greet the default export", "Update greet.js so the greet function is the default export instead of a named export. Update the test accordingly.", {
1322
+ "greet.js": `export function greet(name) { return 'Hello, ' + name + '!'; }
1323
+ `,
1324
+ "test.js": `import greet from './greet.js';
1325
+ import assert from 'node:assert';
1326
+ assert.strictEqual(greet('World'), 'Hello, World!');
1327
+ console.log('default export test passed');
1328
+ `
1329
+ }),
1330
+ simpleTask("update-env", "Update environment variable default", "Set PORT in .env", "Create or update .env so it contains PORT=3000.", {
1331
+ "test.js": `import { readFile } from 'node:fs/promises';
1332
+ const env = await readFile('./.env', 'utf-8');
1333
+ if (!env.includes('PORT=3000')) { console.error('PORT=3000 not found'); process.exit(1); }
1334
+ console.log('env test passed');
1335
+ `
1336
+ }),
1337
+ simpleTask("add-package-script", "Add package script", "Add a format script to package.json", "Edit package.json to add a format script with value prettier --write .. Do not remove existing scripts.", {
1338
+ "test.js": `import { readFile } from 'node:fs/promises';
1339
+ const pkg = JSON.parse(await readFile('./package.json', 'utf-8'));
1340
+ if (pkg.scripts?.format !== 'prettier --write .') { console.error('format script missing'); process.exit(1); }
1341
+ console.log('package script test passed');
1342
+ `
1343
+ }),
1344
+ simpleTask("update-readme", "Update README heading", "Fix the README title", "Update README.md so the first line is # Omega Synthetic Bench instead of # Old Title.", {
1345
+ "README.md": `# Old Title
1346
+
1347
+ This is a sample project.
1348
+ `,
1349
+ "test.js": `import { readFile } from 'node:fs/promises';
1350
+ const readme = await readFile('./README.md', 'utf-8');
1351
+ if (!readme.startsWith('# Omega Synthetic Bench')) { console.error('README heading wrong'); process.exit(1); }
1352
+ console.log('readme test passed');
1353
+ `
1354
+ }),
1355
+ simpleTask("rename-variable", "Rename a variable", "Rename x to value", "In src/calc.js, rename the parameter x to value everywhere. Do not change behavior.", {
1356
+ "src/calc.js": `export function calc(x) { return x * 2; }
1357
+ `,
1358
+ "test.js": `import { calc } from './src/calc.js';
1359
+ import assert from 'node:assert';
1360
+ assert.strictEqual(calc(4), 8);
1361
+ console.log('rename test passed');
1362
+ `,
1363
+ "lint.js": `import fs from 'node:fs/promises';
1364
+ const code = await fs.readFile('./src/calc.js', 'utf-8');
1365
+ if (code.includes('(x)') || code.includes(' x ')) { console.error('old variable name found'); process.exit(1); }
1366
+ console.log('lint ok');
1367
+ `
1368
+ }),
1369
+ simpleTask("add-input-validation", "Add input validation", "Validate input in divide function", "Update src/divide.js so divide(a, b) throws an error when b is 0.", {
1370
+ "src/divide.js": `export function divide(a, b) { return a / b; }
1371
+ `,
1372
+ "test.js": `import { divide } from './src/divide.js';
1373
+ import assert from 'node:assert';
1374
+ assert.strictEqual(divide(10, 2), 5);
1375
+ try { divide(1, 0); console.error('should throw'); process.exit(1); } catch { }
1376
+ console.log('divide test passed');
1377
+ `
1378
+ }),
1379
+ simpleTask("handle-empty-array", "Handle empty array", "Make sumAll handle empty arrays", "Update src/sumAll.js so sumAll([]) returns 0 instead of throwing.", {
1380
+ "src/sumAll.js": `export function sumAll(numbers) { return numbers.reduce((a, b) => a + b); }
1381
+ `,
1382
+ "test.js": `import { sumAll } from './src/sumAll.js';
1383
+ import assert from 'node:assert';
1384
+ assert.strictEqual(sumAll([1, 2, 3]), 6);
1385
+ assert.strictEqual(sumAll([]), 0);
1386
+ console.log('sumAll test passed');
1387
+ `
1388
+ }),
1389
+ simpleTask("add-unit-test", "Add a unit test", "Write a test for multiply", "Create src/multiply.js exporting multiply(a, b). Then create test.js that asserts multiply(3, 4) === 12.", {
1390
+ "src/multiply.js": `export function multiply(a, b) { return a * b; }
1391
+ `,
1392
+ "test.js": `// replace with proper tests
1393
+ `,
1394
+ "lint.js": `import fs from 'node:fs/promises';
1395
+ const test = await fs.readFile('./test.js', 'utf-8');
1396
+ if (!test.includes('multiply')) { console.error('test does not cover multiply'); process.exit(1); }
1397
+ console.log('lint ok');
1398
+ `
1399
+ }),
1400
+ simpleTask("create-module-index", "Create module index", "Export all helpers from index.js", "Create src/index.js that re-exports foo from ./foo.js and bar from ./bar.js.", {
1401
+ "src/foo.js": `export const foo = 'foo';
1402
+ `,
1403
+ "src/bar.js": `export const bar = 'bar';
1404
+ `,
1405
+ "test.js": `import { foo, bar } from './src/index.js';
1406
+ import assert from 'node:assert';
1407
+ assert.strictEqual(foo, 'foo');
1408
+ assert.strictEqual(bar, 'bar');
1409
+ console.log('index test passed');
1410
+ `
1411
+ }),
1412
+ simpleTask("add-async-function", "Add async fetch wrapper", "Create fetchText function", "Create src/fetch.js exporting fetchText(url) that returns a Promise resolving to the string fetched: <url>.", {
1413
+ "test.js": `import { fetchText } from './src/fetch.js';
1414
+ import assert from 'node:assert';
1415
+ const result = await fetchText('https://example.com');
1416
+ assert.strictEqual(result, 'fetched: https://example.com');
1417
+ console.log('fetch test passed');
1418
+ `
1419
+ }),
1420
+ simpleTask("add-try-catch", "Wrap parsing in try/catch", "Make safeParse not throw", "Update src/parse.js so safeParse(str) returns null when JSON parsing fails instead of throwing.", {
1421
+ "src/parse.js": `export function safeParse(str) { return JSON.parse(str); }
1422
+ `,
1423
+ "test.js": `import { safeParse } from './src/parse.js';
1424
+ import assert from 'node:assert';
1425
+ assert.deepStrictEqual(safeParse('{"a":1}'), { a: 1 });
1426
+ assert.strictEqual(safeParse('not json'), null);
1427
+ console.log('safeParse test passed');
1428
+ `
1429
+ }),
1430
+ simpleTask("timeout-promise", "Add delay helper", "Create sleep(ms) helper", "Create src/time.js exporting sleep(ms) that returns a Promise resolving after ms milliseconds.", {
1431
+ "test.js": `import { sleep } from './src/time.js';
1432
+ const start = Date.now();
1433
+ await sleep(50);
1434
+ if (Date.now() - start < 40) { console.error('sleep too short'); process.exit(1); }
1435
+ console.log('sleep test passed');
1436
+ `
1437
+ }),
1438
+ simpleTask("read-test-path", "Create file at path from test", "Create lib/helpers.js with capitalize function", "Create a file that exports a capitalize(str) function. Read the existing test to find the exact import path and expected output.", {
1439
+ "test.js": `import { capitalize } from './lib/helpers.js';
1440
+ import assert from 'node:assert';
1441
+ assert.strictEqual(capitalize('hello'), 'Hello');
1442
+ console.log('capitalize test passed');
1443
+ `
1444
+ }, "medium"),
1445
+ simpleTask("add-cli-args-parser", "Add CLI argument parser", "Create parseArgs function", "Create src/args.js exporting parseArgs(argv) that returns an object from --key value pairs.", {
1446
+ "test.js": `import { parseArgs } from './src/args.js';
1447
+ import assert from 'node:assert';
1448
+ assert.deepStrictEqual(parseArgs(['--name', 'x', '--count', '2']), { name: 'x', count: '2' });
1449
+ console.log('args test passed');
1450
+ `
1451
+ }, "medium"),
1452
+ simpleTask("create-middleware", "Create logging middleware", "Add logger middleware", "Create src/middleware.js exporting logger(req, next) that calls next(), increments req.logCount and returns the result.", {
1453
+ "test.js": `import { logger } from './src/middleware.js';
1454
+ import assert from 'node:assert';
1455
+ const req = { logCount: 0 };
1456
+ const result = logger(req, () => 'done');
1457
+ assert.strictEqual(result, 'done');
1458
+ assert.strictEqual(req.logCount, 1);
1459
+ console.log('middleware test passed');
1460
+ `
1461
+ }, "medium"),
1462
+ simpleTask("add-throttle", "Add throttle helper", "Create throttle function", "Create src/throttle.js exporting throttle(fn, ms) that returns a throttled function (only calls fn at most once per ms).", {
1463
+ "test.js": `import { throttle } from './src/throttle.js';
1464
+ import assert from 'node:assert';
1465
+ let calls = 0;
1466
+ const fn = throttle(() => calls++, 100);
1467
+ fn(); fn(); fn();
1468
+ assert.strictEqual(calls, 1);
1469
+ console.log('throttle test passed');
1470
+ `
1471
+ }, "medium"),
1472
+ simpleTask("memoize-function", "Add memoize helper", "Create memoize function", "Create src/memoize.js exporting memoize(fn) that caches results by first argument.", {
1473
+ "test.js": `import { memoize } from './src/memoize.js';
1474
+ import assert from 'node:assert';
1475
+ let calls = 0;
1476
+ const fn = memoize((n) => { calls++; return n * 2; });
1477
+ assert.strictEqual(fn(3), 6);
1478
+ assert.strictEqual(fn(3), 6);
1479
+ assert.strictEqual(calls, 1);
1480
+ console.log('memoize test passed');
1481
+ `
1482
+ }, "medium"),
1483
+ simpleTask("fix-race-condition", "Fix a race condition", "Make counter increment atomic", "Update src/counter.js so increment() returns a Promise and uses a local variable correctly. Keep the async interface.", {
1484
+ "src/counter.js": `let count = 0;
1485
+ export async function increment() {
1486
+ const current = count;
1487
+ await Promise.resolve();
1488
+ count = current + 1;
1489
+ return count;
1490
+ }
1491
+ `,
1492
+ "test.js": `import { increment } from './src/counter.js';
1493
+ import assert from 'node:assert';
1494
+ await Promise.all([increment(), increment(), increment()]);
1495
+ const final = await increment();
1496
+ assert.strictEqual(final, 4);
1497
+ console.log('counter test passed');
1498
+ `
1499
+ }, "medium"),
1223
1500
  {
1224
1501
  id: "noop-validation",
1225
1502
  name: "Run validation on a clean project",
@@ -1393,11 +1670,14 @@ function buildOptimisePrompt(report, failedResult, traceFlowText) {
1393
1670
  lines.push("");
1394
1671
  }
1395
1672
  lines.push("## Instructions");
1396
- lines.push("Analyse the failures above and edit `packages/agent/src/prompts.ts` (and optionally `packages/agent/src/planner.ts`) to improve the Omega agent.");
1673
+ lines.push("Analyse the failures above and edit ONLY `packages/agent/src/prompts.ts` to improve the Omega agent.");
1674
+ lines.push("Your goal is to change the system prompt text so the agent avoids the observed failures.");
1397
1675
  lines.push("Rules:");
1398
- lines.push("- Keep changes minimal and targeted.");
1676
+ lines.push("- ONLY edit `packages/agent/src/prompts.ts`. Do NOT edit any other files, including schema files, migrations, or unrelated code.");
1677
+ lines.push("- Keep changes minimal and targeted to the failure pattern.");
1678
+ lines.push("- Use edit_file with an exact old_string from the file. Read the file first if needed.");
1399
1679
  lines.push("- Do not break existing tool signatures or system behaviour.");
1400
- lines.push("- Run `pnpm lint` and `pnpm test` after edits.");
1680
+ lines.push("- After editing, run `pnpm lint` and `pnpm test` to verify.");
1401
1681
  lines.push("- Finish with a summary of what changed and why it should help.");
1402
1682
  return lines.join("\n");
1403
1683
  }
@@ -1669,26 +1949,40 @@ Available tools:
1669
1949
  - run_command: Run a single simple command. No pipes (|), &&, ;, redirects, or globs. Prefer pnpm/npm/node. Arguments: { "command": "pnpm lint" }
1670
1950
  - think: Record a reasoning step. Arguments: { "thought": "..." }
1671
1951
  - finish: Mark the task complete. Arguments: { "summary": "what was done", "success": true }. Use summary, not message.
1672
- - publish: Run build/test/publish validation. Only after your edits pass validation. Arguments: { "version": "optional" }
1952
+ - publish: Run lint/test/build validation in one step. This is the preferred validation tool. Arguments: { "version": "optional" }
1673
1953
 
1674
1954
  Rules:
1675
1955
  1. Read the task, then use think to plan.
1676
1956
  2. Use edit_file for small changes; write_file only when creating a file or rewriting most of it.
1677
1957
  3. ALWAYS read a file with read_file before using edit_file on it. Do NOT read a file before write_file when creating a new file.
1678
1958
  4. Before creating JavaScript files, read package.json to check whether "type" is "module" and use ESM (export) or CommonJS (module.exports) accordingly.
1679
- 5. You MUST run validation (pnpm lint, pnpm test, or the project's validation command) after every edit using publish or run_command.
1680
- 6. Do NOT call finish until validation passes. If validation fails, fix the issue and re-run validation.
1681
- 7. Do not expose secrets or run destructive commands.
1682
- 8. Finish only when the task is done. Always include summary and success.
1683
- 9. Do not repeat the same tool call with the same arguments. If something fails, change your approach.
1684
- 10. Do not ask the user for clarification. Do not say "No task was provided". Use the Task and Description above to proceed.
1959
+ 5. Immediately after making any edit, call publish to run validation. Do not read more files, do not think, and do not call finish before validating.
1960
+ 6. If validation fails, fix the issue and call publish again. Repeat until validation passes.
1961
+ 7. Do NOT call finish until validation passes. If you call finish without validation, the task will fail.
1962
+ 8. Do not expose secrets or run destructive commands.
1963
+ 9. Finish only when the task is done. Always include summary and success.
1964
+ 10. Do not repeat the same tool call with the same arguments. If something fails, change your approach.
1965
+ 11. Do not ask the user for clarification. Do not say "No task was provided". Use the Task and Description above to proceed.
1966
+ 12. You have a limited number of steps. If you spend too many steps reading or planning without validating, the task will fail.
1967
+ 13. NEVER read the same file twice in a row. Once you have read a file, the next step must be edit_file, write_file, run_command, or publish.
1968
+ 14. If you already know what change to make, do not read additional files. Edit and validate immediately.
1969
+ 15. The think tool is for planning only. After thinking, you must use a concrete action tool next, not think or read_file again.
1970
+ 16. When publish reports allPassed=true, call finish with success=true immediately. Do not make additional edits or run extra commands.
1971
+ 17. Do NOT modify test files (test.js, *.test.js, *.spec.js) unless the task explicitly tells you to update the test.
1972
+ 18. If a task asks you to read a test to find an import path or expected output, read the test file once and then create the required source file. Do not modify the test.
1685
1973
 
1686
1974
  Example tool call sequence for "Add a greet function":
1687
1975
  1. think: { "thought": "I need to create greet.js and export a greet function." }
1688
- 2. write_file: { "path": "greet.js", "content": "export function greet(name) { return 'Hello, ' + name + '!'; }
1689
- " }
1976
+ 2. write_file: { "path": "greet.js", "content": "export function greet(name) { return 'Hello, ' + name + '!'; }\\n" }
1690
1977
  3. publish: { }
1691
- 4. finish: { "summary": "Created greet.js with greet(name) function and verified it passes tests.", "success": true }`;
1978
+ 4. finish: { "summary": "Created greet.js with greet(name) function and verified it passes tests.", "success": true }
1979
+
1980
+ Example tool call sequence for "Fix a lint warning":
1981
+ 1. think: { "thought": "The linter flags var. I need to read src/index.js and replace var with const or let." }
1982
+ 2. read_file: { "path": "src/index.js" }
1983
+ 3. edit_file: { "path": "src/index.js", "old_string": "var greeting = 'Hello';", "new_string": "const greeting = 'Hello';" }
1984
+ 4. publish: { }
1985
+ 5. finish: { "summary": "Replaced var with const and verified lint passes.", "success": true }`;
1692
1986
  var TEXT_TOOLS_SYSTEM_PROMPT = loadPromptFromEnv("OMEGA_TEXT_TOOLS_PROMPT") ?? `You are Omega, an autonomous software engineering agent running inside a project repository.
1693
1987
 
1694
1988
  You MUST respond with a single JSON object containing a "tool_calls" array. Do not output markdown, explanations, or reasoning outside the JSON.
@@ -1708,18 +2002,22 @@ Rules:
1708
2002
  - Use edit_file for small changes; write_file only for new files or large rewrites.
1709
2003
  - ALWAYS read a file with read_file before using edit_file on it. Do NOT read a file before write_file when creating a new file.
1710
2004
  - Before creating JavaScript files, read package.json to check whether "type" is "module" and use ESM (export) or CommonJS (module.exports) accordingly.
1711
- - You MUST run validation (pnpm lint, pnpm test, or the project's validation command) after every edit using publish or run_command.
1712
- - Do NOT call finish until validation passes. If validation fails, fix the issue and re-run validation.
2005
+ - Immediately after making any edit, call publish to run validation. Do not read more files or call finish before validating.
2006
+ - If validation fails, fix the issue and call publish again.
2007
+ - Do NOT call finish until validation passes.
1713
2008
  - Do not expose secrets or run destructive commands.
1714
2009
  - Finish only when done. Use summary, not message.
1715
2010
  - Do not repeat the same tool call with the same arguments.
1716
2011
  - Do not ask the user for clarification. Do not say "No task was provided". Use the Task and Description above to proceed.
2012
+ - NEVER read the same file twice in a row. Once read, the next step must edit, write, run_command, or publish.
2013
+ - The think tool is for planning only. After thinking, use a concrete action tool next.
2014
+ - When publish reports allPassed=true, call finish with success=true immediately.
2015
+ - Do NOT modify test files unless the task explicitly tells you to update the test.
1717
2016
 
1718
2017
  Example response for "Add a greet function":
1719
2018
  { "tool_calls": [
1720
2019
  { "id": "1", "name": "think", "arguments": { "thought": "Create greet.js with greet(name)." } },
1721
- { "id": "2", "name": "write_file", "arguments": { "path": "greet.js", "content": "export function greet(name) { return 'Hello, ' + name + '!'; }
1722
- " } },
2020
+ { "id": "2", "name": "write_file", "arguments": { "path": "greet.js", "content": "export function greet(name) { return 'Hello, ' + name + '!'; }\\n" } },
1723
2021
  { "id": "3", "name": "publish", "arguments": {} },
1724
2022
  { "id": "4", "name": "finish", "arguments": { "summary": "Created greet.js and verified tests pass.", "success": true } }
1725
2023
  ] }`;
@@ -1935,7 +2233,10 @@ var loopCmd = new Command8("loop").description("Run a self-improve benchmark loo
1935
2233
  for (let i = 1; i <= maxIterations; i++) {
1936
2234
  console.log(`
1937
2235
  === Iteration ${String(i)}/${String(maxIterations)} ===`);
1938
- const beforeVersion = await savePromptVersion(apiUrl, `loop-before-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`);
2236
+ const beforeVersion = await savePromptVersion(
2237
+ apiUrl,
2238
+ `loop-before-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`
2239
+ );
1939
2240
  if (beforeVersion) {
1940
2241
  console.log(`Saved before-loop prompt version: ${beforeVersion.name} (${beforeVersion.id})`);
1941
2242
  }
@@ -1972,8 +2273,10 @@ Running ${String(tasks.length)} benchmark tasks...`);
1972
2273
  body: JSON.stringify({ provider: opts.provider, model: opts.model })
1973
2274
  });
1974
2275
  }
1975
- console.log(`
1976
- Created self-improve task ${task.id}${opts.provider ? ` (provider: ${opts.provider})` : ""}${opts.model ? ` (model: ${opts.model})` : ""}`);
2276
+ console.log(
2277
+ `
2278
+ Created self-improve task ${task.id}${opts.provider ? ` (provider: ${opts.provider})` : ""}${opts.model ? ` (model: ${opts.model})` : ""}`
2279
+ );
1977
2280
  console.log("Running agent...");
1978
2281
  await runTask(apiUrl, task.id);
1979
2282
  const finished = await waitForTask(apiUrl, task.id, timeoutMs * 5);
@@ -1981,7 +2284,10 @@ Created self-improve task ${task.id}${opts.provider ? ` (provider: ${opts.provid
1981
2284
  if (finished.error) {
1982
2285
  console.error(`Agent error: ${finished.error}`);
1983
2286
  }
1984
- const afterVersion = await savePromptVersion(apiUrl, `loop-after-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`);
2287
+ const afterVersion = await savePromptVersion(
2288
+ apiUrl,
2289
+ `loop-after-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`
2290
+ );
1985
2291
  if (afterVersion) {
1986
2292
  console.log(`Saved after-loop prompt version: ${afterVersion.name} (${afterVersion.id})`);
1987
2293
  }
@@ -7,7 +7,7 @@ import { providerRoutes } from './routes/providers.js';
7
7
  import { routerRoutes } from './routes/router.js';
8
8
  import { metricsRoutes } from './routes/metrics.js';
9
9
  import { promptVersionRoutes } from './routes/prompt-versions.js';
10
- import { reportRoutes } from './routes/reports.js';
10
+ import { benchmarkRoutes } from './routes/benchmarks.js';
11
11
  export const app = express();
12
12
  app.use(cors());
13
13
  app.use(express.json());
@@ -17,7 +17,7 @@ app.use('/providers', providerRoutes(prisma));
17
17
  app.use('/router', routerRoutes(prisma));
18
18
  app.use('/metrics', metricsRoutes(prisma));
19
19
  app.use('/prompt-versions', promptVersionRoutes(prisma));
20
- app.use('/reports', reportRoutes());
20
+ app.use('/benchmarks', benchmarkRoutes(prisma));
21
21
  app.use((err, _req, res, _next) => {
22
22
  console.error(err);
23
23
  const message = err instanceof Error ? err.message : 'Internal error';
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO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AAC3C,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhD,GAAG,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,IAAqB,EAAE,GAAqB,EAAE,KAA2B,EAAE,EAAE;IAClG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACtE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Router } from 'express';
2
+ import type { PrismaClient } from '@omega/db';
3
+ export declare function benchmarkRoutes(_prisma: PrismaClient): Router;
4
+ //# sourceMappingURL=benchmarks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmarks.d.ts","sourceRoot":"","sources":["../../src/routes/benchmarks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuD9C,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA6F7D"}
@@ -0,0 +1,129 @@
1
+ import { Router } from 'express';
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { spawn } from 'node:child_process';
5
+ import { z } from 'zod';
6
+ import { asyncHandler } from '../lib/async-handler.js';
7
+ const root = process.cwd();
8
+ const reportsDir = path.join(root, '.omega', 'reports');
9
+ const statusFile = path.join(root, '.omega', 'bench-run-status.json');
10
+ const runSchema = z.object({
11
+ suite: z.enum(['synthetic', 'deep-swe']).optional(),
12
+ nTasks: z.number().int().positive().optional(),
13
+ provider: z.string().optional(),
14
+ model: z.string().optional(),
15
+ timeout: z.number().int().positive().optional(),
16
+ });
17
+ async function readStatus() {
18
+ try {
19
+ const raw = await fs.readFile(statusFile, 'utf-8');
20
+ return JSON.parse(raw);
21
+ }
22
+ catch {
23
+ return { running: false };
24
+ }
25
+ }
26
+ async function writeStatus(status) {
27
+ await fs.mkdir(path.dirname(statusFile), { recursive: true });
28
+ await fs.writeFile(statusFile, JSON.stringify(status, null, 2), 'utf-8');
29
+ }
30
+ function isReportFile(name, prefix) {
31
+ return name.startsWith(prefix) && name.endsWith('.json');
32
+ }
33
+ async function listReports(prefix) {
34
+ try {
35
+ const files = await fs.readdir(reportsDir);
36
+ return files
37
+ .filter((f) => isReportFile(f, prefix))
38
+ .sort()
39
+ .reverse();
40
+ }
41
+ catch {
42
+ return [];
43
+ }
44
+ }
45
+ export function benchmarkRoutes(_prisma) {
46
+ const r = Router();
47
+ r.get('/reports', asyncHandler(async (_req, res) => {
48
+ const [benchmark, ab] = await Promise.all([
49
+ listReports('benchmark-'),
50
+ listReports('ab-'),
51
+ ]);
52
+ res.json({ benchmark, ab });
53
+ }));
54
+ r.get('/reports/:file', asyncHandler(async (req, res) => {
55
+ const file = req.params.file;
56
+ if (!isReportFile(file, 'benchmark-') && !isReportFile(file, 'ab-')) {
57
+ res.status(400).json({ error: 'Invalid report file' });
58
+ return;
59
+ }
60
+ const filePath = path.join(reportsDir, file);
61
+ const resolved = path.resolve(filePath);
62
+ const resolvedReportsDir = path.resolve(reportsDir);
63
+ if (!resolved.startsWith(resolvedReportsDir + path.sep) && resolved !== resolvedReportsDir) {
64
+ res.status(400).json({ error: 'Invalid report path' });
65
+ return;
66
+ }
67
+ try {
68
+ const raw = await fs.readFile(filePath, 'utf-8');
69
+ const data = JSON.parse(raw);
70
+ res.json(data);
71
+ }
72
+ catch {
73
+ res.status(404).json({ error: 'Report not found' });
74
+ }
75
+ }));
76
+ r.post('/run', asyncHandler(async (req, res) => {
77
+ const body = runSchema.parse(req.body);
78
+ const status = await readStatus();
79
+ if (status.running) {
80
+ res.status(409).json({ error: 'Benchmark run already in progress', pid: status.pid });
81
+ return;
82
+ }
83
+ const args = ['apps/cli/dist/index.js', 'bench', 'run'];
84
+ if (body.suite) {
85
+ args.push('--suite', body.suite);
86
+ }
87
+ if (body.nTasks) {
88
+ args.push('--n-tasks', String(body.nTasks));
89
+ }
90
+ if (body.timeout) {
91
+ args.push('--timeout', String(body.timeout));
92
+ }
93
+ if (body.provider) {
94
+ args.push('--provider', body.provider);
95
+ }
96
+ if (body.model) {
97
+ args.push('--model', body.model);
98
+ }
99
+ const child = spawn('node', args, {
100
+ cwd: root,
101
+ detached: true,
102
+ stdio: ['ignore', 'pipe', 'pipe'],
103
+ });
104
+ let output = '';
105
+ child.stdout.on('data', (chunk) => {
106
+ output += chunk.toString();
107
+ });
108
+ child.stderr.on('data', (chunk) => {
109
+ output += chunk.toString();
110
+ });
111
+ child.on('exit', () => {
112
+ void (async () => {
113
+ const current = await readStatus();
114
+ if (current.pid === child.pid) {
115
+ await writeStatus({ running: false, output });
116
+ }
117
+ })();
118
+ });
119
+ child.unref();
120
+ await writeStatus({ running: true, pid: child.pid, output: '' });
121
+ res.status(202).json({ pid: child.pid, status: 'started' });
122
+ }));
123
+ r.get('/run-status', asyncHandler(async (_req, res) => {
124
+ const status = await readStatus();
125
+ res.json(status);
126
+ }));
127
+ return r;
128
+ }
129
+ //# sourceMappingURL=benchmarks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmarks.js","sourceRoot":"","sources":["../../src/routes/benchmarks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OA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M,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/routes/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAgC9C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA8E1D"}
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/routes/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA8B9C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA8E1D"}
@@ -1,10 +1,8 @@
1
1
  import { Router } from 'express';
2
2
  import fs from 'node:fs/promises';
3
3
  import path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
4
  import { asyncHandler } from '../lib/async-handler.js';
6
- const __filename = fileURLToPath(import.meta.url);
7
- const root = path.resolve(__filename, '..', '..', '..', '..');
5
+ const root = process.cwd();
8
6
  const reportsDir = path.join(root, '.omega', 'reports');
9
7
  async function latestReport(pattern) {
10
8
  try {