omnius 1.0.481 → 1.0.483

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/dist/index.js CHANGED
@@ -559128,10 +559128,55 @@ function parseCompilerDiagnostics(text2, language = "unknown") {
559128
559128
  const out = [];
559129
559129
  if (!text2)
559130
559130
  return out;
559131
- for (const raw of text2.split(/\r?\n/)) {
559131
+ const allLines = text2.split(/\r?\n/);
559132
+ let pyFile;
559133
+ let pyLine;
559134
+ for (let i2 = 0; i2 < allLines.length; i2++) {
559135
+ const trimmed = allLines[i2].trim();
559136
+ const tbMatch = trimmed.match(/^File\s+"([^"]+)",\s*line\s+(\d+)/);
559137
+ if (tbMatch) {
559138
+ pyFile = tbMatch[1];
559139
+ pyLine = Number(tbMatch[2]);
559140
+ }
559141
+ const excMatch = trimmed.match(/^(\w+(?:\.\w+)*Error):\s*(.*)/);
559142
+ if (excMatch && pyFile && !out.some((d2) => d2.file === pyFile && d2.line === pyLine && d2.message === (excMatch[2] ?? excMatch[0]))) {
559143
+ const kind = /^(?:ModuleNotFound|Import)\w*Error$/.test(excMatch[1]) ? "import_error" : "type_error";
559144
+ out.push({
559145
+ file: pyFile,
559146
+ line: pyLine,
559147
+ kind,
559148
+ symbol: excMatch[1],
559149
+ message: excMatch[2] ?? excMatch[0]
559150
+ });
559151
+ }
559152
+ }
559153
+ for (const raw of allLines) {
559132
559154
  const line = raw.trim();
559133
- if (!line || !/error/i.test(line))
559155
+ if (!line)
559156
+ continue;
559157
+ const pytestMatch = line.match(/^FAILED\s+(.+?)(?:::(\w+))?(?:\s+-\s+(.+))?$/);
559158
+ if (pytestMatch) {
559159
+ out.push({
559160
+ file: pytestMatch[1],
559161
+ kind: "test_failure",
559162
+ symbol: pytestMatch[2],
559163
+ message: pytestMatch[3] ?? line
559164
+ });
559165
+ continue;
559166
+ }
559167
+ if (!/error|FAILED|unrecognized|Traceback|Warning|warning/i.test(line))
559134
559168
  continue;
559169
+ if (/unrecognized\s+(element|attribute)/i.test(line) || /not\s+allowed\s+here/i.test(line)) {
559170
+ const fileMatch = line.match(/^(.+?):/);
559171
+ const lnMatch = line.match(/:(\d+):/);
559172
+ out.push({
559173
+ file: fileMatch?.[1] ?? "unknown.xml",
559174
+ line: lnMatch ? Number(lnMatch[1]) : void 0,
559175
+ kind: "schema_error",
559176
+ message: line
559177
+ });
559178
+ continue;
559179
+ }
559135
559180
  const loc = line.match(/^(.+?):(\d+):(?:\d+:)?\s*(?:fatal\s+)?error:\s*(.*)$/i);
559136
559181
  const file = loc?.[1];
559137
559182
  const lineNo = loc ? Number(loc[2]) : void 0;
@@ -576236,7 +576281,7 @@ function failureProgressSignal(text2) {
576236
576281
  if (!s2.trim())
576237
576282
  return void 0;
576238
576283
  let explicit;
576239
- for (const m2 of s2.matchAll(/(\d+)\s+(?:errors?|failures?|failed|problems?)\b/gi)) {
576284
+ for (const m2 of s2.matchAll(/(\d+)\s+(?:errors?|failures?|failed|problems?|warnings?)\b/gi)) {
576240
576285
  const n2 = Number(m2[1]);
576241
576286
  if (Number.isFinite(n2))
576242
576287
  explicit = Math.max(explicit ?? 0, n2);
@@ -576245,7 +576290,11 @@ function failureProgressSignal(text2) {
576245
576290
  return explicit;
576246
576291
  let lines = 0;
576247
576292
  for (const line of s2.split(/\r?\n/)) {
576248
- if (/\b(errors?|fail(?:ed|ure|ures|s)?)\b/i.test(line))
576293
+ if (/\b(errors?|fail(?:ed|ure|ures|s)?|warnings?|unrecognized)\b/i.test(line))
576294
+ lines++;
576295
+ else if (/\b\w+Error\b/.test(line))
576296
+ lines++;
576297
+ else if (/\bTraceback\b/i.test(line))
576249
576298
  lines++;
576250
576299
  }
576251
576300
  return lines > 0 ? lines : void 0;
@@ -576745,7 +576794,9 @@ var init_focusSupervisor = __esm({
576745
576794
  state: "forced_replan",
576746
576795
  reason: verdict.reason,
576747
576796
  requiredNextAction: this.resolveRequiredNextAction("run_verification"),
576748
- forbiddenActionFamilies: [actionFamily(input.toolName, input.args, this.familyCwd)]
576797
+ forbiddenActionFamilies: [
576798
+ actionFamily(input.toolName, input.args, this.familyCwd)
576799
+ ]
576749
576800
  });
576750
576801
  }
576751
576802
  }
@@ -577354,7 +577405,7 @@ function languageOf(p2) {
577354
577405
  return "typescript";
577355
577406
  return "unknown";
577356
577407
  }
577357
- var JsonConvergenceStore, EDIT_TOOLS, LongHaulComponents, FIELD_STOPWORDS;
577408
+ var JsonConvergenceStore, EDIT_TOOLS, LOCKED_CONTRACT_FILE, LongHaulComponents, FIELD_STOPWORDS;
577358
577409
  var init_longhaul_integration = __esm({
577359
577410
  "packages/orchestrator/dist/longhaul-integration.js"() {
577360
577411
  "use strict";
@@ -577406,6 +577457,7 @@ var init_longhaul_integration = __esm({
577406
577457
  }
577407
577458
  };
577408
577459
  EDIT_TOOLS = /* @__PURE__ */ new Set(["file_edit", "file_patch", "batch_edit"]);
577460
+ LOCKED_CONTRACT_FILE = "locked-contract.json";
577409
577461
  LongHaulComponents = class {
577410
577462
  convergenceBreaker;
577411
577463
  adaptiveEdit;
@@ -577420,7 +577472,10 @@ var init_longhaul_integration = __esm({
577420
577472
  locked = /* @__PURE__ */ new Map();
577421
577473
  /** WO-11: provenance — which file each locked symbol was declared in. */
577422
577474
  lockedSource = /* @__PURE__ */ new Map();
577475
+ /** Persisted contract output path (relative to stateDir). */
577476
+ lockedContractPath;
577423
577477
  constructor(options2) {
577478
+ this.lockedContractPath = path7.join(options2.stateDir, LOCKED_CONTRACT_FILE);
577424
577479
  this.convergenceBreaker = new ConvergenceBreaker({
577425
577480
  ...options2.convergence,
577426
577481
  // Persist the cliff across sessions only when persistence is enabled;
@@ -577492,6 +577547,7 @@ var init_longhaul_integration = __esm({
577492
577547
  this.lockedSource.set(s2.name, input.path);
577493
577548
  }
577494
577549
  }
577550
+ this.persistLockedContract();
577495
577551
  return this.locked.size;
577496
577552
  } catch {
577497
577553
  return this.locked.size;
@@ -577501,6 +577557,22 @@ var init_longhaul_integration = __esm({
577501
577557
  lockedContract() {
577502
577558
  return { symbols: [...this.locked.values()] };
577503
577559
  }
577560
+ /**
577561
+ * Persist the locked contract to `.omnius/locked-contract.json` so sub-agent
577562
+ * fixers can read it as their canonical type reference. Fault-tolerant —
577563
+ * never throws; on error the in-memory contract remains available for
577564
+ * orchestrator-side gates.
577565
+ */
577566
+ persistLockedContract() {
577567
+ try {
577568
+ const contract = this.lockedContract();
577569
+ if (contract.symbols.length === 0)
577570
+ return;
577571
+ fs6.mkdirSync(path7.dirname(this.lockedContractPath), { recursive: true });
577572
+ fs6.writeFileSync(this.lockedContractPath, JSON.stringify(contract, null, 2));
577573
+ } catch {
577574
+ }
577575
+ }
577504
577576
  /** WO-11: map of locked symbol name → declaring file (for per-symbol units). */
577505
577577
  symbolSources() {
577506
577578
  return new Map(this.lockedSource);
@@ -577585,11 +577657,12 @@ var init_longhaul_integration = __esm({
577585
577657
  const symbol3 = top.symbol ? ` symbol \`${top.symbol}\`` : "";
577586
577658
  const kind = top.kind.replace(/_/g, " ");
577587
577659
  const contractHint = top.symbol && this.lockedSource.has(top.symbol) ? ` The locked contract for \`${top.symbol}\` lives in ${this.lockedSource.get(top.symbol)} — match it exactly.` : "";
577660
+ const persistHint = this.locked.size > 0 ? ` The canonical locked contract is at .omnius/${LOCKED_CONTRACT_FILE} — read it before editing and match its type names exactly.` : "";
577588
577661
  return `[DELEGATE — build is feedback, not the task] The build reported a stable diagnostic set. Do NOT re-run the build and do NOT keep editing in this context. Delegate ONE isolated fix to a seeded sub-agent, then re-run the build to test:
577589
577662
  sub_agent({
577590
577663
  subagent_type: "fixer",
577591
577664
  description: "fix ${top.symbol ?? file}",
577592
- prompt: "In ${file}, resolve the ${kind}${symbol3}. Read ONLY ${file} (and the file that declares${symbol3 || " the offending symbol"}). Make the minimal edit to satisfy the contract. Do not touch unrelated files. Report a one-line outcome.${contractHint}"
577665
+ prompt: "In ${file}, resolve the ${kind}${symbol3}. Read ONLY ${file} (and the file that declares${symbol3 || " the offending symbol"}). Make the minimal edit to satisfy the contract. Do not touch unrelated files. Report a one-line outcome.${contractHint}${persistHint}"
577593
577666
  })
577594
577667
  The sub-agent works in its own small context; when it folds back, run the build once to verify the diagnostic count dropped, then delegate the next one. This is fan-out/converge — keep THIS context on trajectory, not on the raw fix.`;
577595
577668
  } catch {
@@ -577606,16 +577679,29 @@ The sub-agent works in its own small context; when it folds back, run the build
577606
577679
  buildDelegationCall(output) {
577607
577680
  try {
577608
577681
  const diags = parseCompilerDiagnostics(String(output || ""));
577609
- const structural = diags.filter((d2) => d2.kind === "signature_mismatch" || d2.kind === "duplicate_definition" || d2.kind === "unknown_member" || d2.kind === "unknown_symbol" || d2.kind === "type_error");
577682
+ const structural = diags.filter((d2) => d2.kind === "signature_mismatch" || d2.kind === "duplicate_definition" || d2.kind === "unknown_member" || d2.kind === "unknown_symbol" || d2.kind === "type_error" || d2.kind === "test_failure" || d2.kind === "import_error" || d2.kind === "schema_error");
577610
577683
  const top = structural.find((d2) => d2.file && d2.symbol) ?? structural.find((d2) => d2.file) ?? diags.find((d2) => d2.file) ?? structural[0] ?? diags[0];
577611
- if (!top || !top.file)
577684
+ if (!top)
577685
+ return null;
577686
+ let file = top.file;
577687
+ if (!file && top.symbol && this.lockedSource.has(top.symbol)) {
577688
+ file = this.lockedSource.get(top.symbol);
577689
+ }
577690
+ if (!file)
577612
577691
  return null;
577613
- const file = top.file;
577692
+ if (top.kind === "test_failure") {
577693
+ file = file.replace(/::.*$/, "");
577694
+ }
577695
+ const cleanFile = file;
577614
577696
  const symbol3 = top.symbol;
577615
577697
  const kind = top.kind.replace(/_/g, " ");
577616
577698
  const declSrc = symbol3 ? this.lockedSource.get(symbol3) : void 0;
577617
- const focusFiles = [file, ...declSrc && declSrc !== file ? [declSrc] : []];
577618
- const prompt = `In ${file}, resolve the ${kind}${symbol3 ? ` for \`${symbol3}\`` : ""}. Read ONLY ${focusFiles.join(" and ")}. Make the minimal edit to satisfy the contract. Build once to verify the error is gone. Report a one-line outcome.` + (declSrc ? ` The contract for \`${symbol3}\` lives in ${declSrc} — match it exactly.` : "");
577699
+ const focusFiles = [
577700
+ file,
577701
+ ...declSrc && declSrc !== file ? [declSrc] : []
577702
+ ];
577703
+ const lockedRef = this.locked.size > 0 ? ` Also read .omnius/${LOCKED_CONTRACT_FILE} for the canonical type contract and match it exactly.` : "";
577704
+ const prompt = `In ${file}, resolve the ${kind}${symbol3 ? ` for \`${symbol3}\`` : ""}. Read ONLY ${focusFiles.join(" and ")}. Make the minimal edit to satisfy the contract. Build once to verify the error is gone. Report a one-line outcome.` + (declSrc ? ` The contract for \`${symbol3}\` lives in ${declSrc} — match it exactly.` : "") + lockedRef;
577619
577705
  return {
577620
577706
  description: `fix ${symbol3 ?? file}`,
577621
577707
  prompt,
@@ -577661,7 +577747,10 @@ The sub-agent works in its own small context; when it folds back, run the build
577661
577747
  try {
577662
577748
  return decideCompaction(input);
577663
577749
  } catch {
577664
- return { compact: input.pressureRatio >= 0.85, reason: "fallback threshold" };
577750
+ return {
577751
+ compact: input.pressureRatio >= 0.85,
577752
+ reason: "fallback threshold"
577753
+ };
577665
577754
  }
577666
577755
  }
577667
577756
  /** WO-5: validate a compaction preserved pinned invariants (Slipstream). */
@@ -579722,7 +579811,7 @@ RECOVERY: cd to the directory containing '${file}', run a plain install with no
579722
579811
 
579723
579812
  // packages/orchestrator/dist/agenticRunner.js
579724
579813
  import { existsSync as _fsExistsSync, readFileSync as _fsReadFileSync, writeFileSync as _fsWriteFileSync, appendFileSync as _fsAppendFileSync, unlinkSync as _fsUnlinkSync, mkdirSync as _fsMkdirSync, statSync as _fsStatSync, readdirSync as _fsReaddirSync } from "node:fs";
579725
- import { execFile as _execFile, spawn as _spawn } from "node:child_process";
579814
+ import { execFile as _execFile, execSync as _execSync, spawn as _spawn } from "node:child_process";
579726
579815
  import { createHash as _createHash } from "node:crypto";
579727
579816
  import { join as _pathJoin, relative as _pathRelative, resolve as _pathResolve } from "node:path";
579728
579817
  import { tmpdir as _osTmpdir } from "node:os";
@@ -580575,9 +580664,7 @@ var init_agenticRunner = __esm({
580575
580664
  "web_fetch",
580576
580665
  "tool_search"
580577
580666
  ]);
580578
- STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS = /* @__PURE__ */ new Set([
580579
- "todo_write"
580580
- ]);
580667
+ STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS = /* @__PURE__ */ new Set(["todo_write"]);
580581
580668
  TOOL_ACTION_REASON_SCHEMA = {
580582
580669
  type: "object",
580583
580670
  description: "Compact public action contract for this exact tool call. Do not include hidden chain-of-thought; use concise task-state facts.",
@@ -580604,13 +580691,7 @@ var init_agenticRunner = __esm({
580604
580691
  description: "Classify the action scope. Use targeted_patch for constrained edits; full_file_rewrite only for deliberate whole-file replacement."
580605
580692
  }
580606
580693
  },
580607
- required: [
580608
- "task_anchor",
580609
- "intent",
580610
- "evidence",
580611
- "expected_result",
580612
- "scope"
580613
- ]
580694
+ required: ["task_anchor", "intent", "evidence", "expected_result", "scope"]
580614
580695
  };
580615
580696
  SYSTEM_PROMPT = loadPrompt("agentic/system-large.md");
580616
580697
  SYSTEM_PROMPT_MEDIUM = loadPrompt("agentic/system-medium.md");
@@ -581116,6 +581197,10 @@ var init_agenticRunner = __esm({
581116
581197
  _decompModules = [];
581117
581198
  /** Auto-delegation: last failing build/verify output, for parsing the top unit. */
581118
581199
  _lastBuildOutput = null;
581200
+ /** Convergence gate: pre-fold error count for verifying fixer progress. */
581201
+ _preFoldErrorCount = null;
581202
+ /** Convergence gate: the fixer description being gated (for status messages). */
581203
+ _preFoldFixerDescription = null;
581119
581204
  /** Auto-delegation: directive ids we've already auto-delegated for (once each). */
581120
581205
  _autoDelegatedDirectiveIds = /* @__PURE__ */ new Set();
581121
581206
  _focusTerminalLedgerRecorded = false;
@@ -591662,6 +591747,18 @@ ${cachedResult}`,
591662
591747
  } catch {
591663
591748
  }
591664
591749
  }
591750
+ if ((tc.name === "sub_agent" || tc.name === "agent") && this._preFoldErrorCount === null && (tc.arguments?.subagent_type === "fixer" || finalArgs?.subagent_type === "fixer") && this._lastBuildOutput !== null) {
591751
+ this._preFoldErrorCount = failureProgressSignal(this._lastBuildOutput) ?? null;
591752
+ this._preFoldFixerDescription = tc.arguments?.description || finalArgs?.description || "voluntary fixer";
591753
+ try {
591754
+ _execSync('git stash push -m "pre-fixer" --include-untracked', {
591755
+ cwd: this.authoritativeWorkingDirectory(),
591756
+ stdio: "pipe",
591757
+ timeout: 1e4
591758
+ });
591759
+ } catch {
591760
+ }
591761
+ }
591665
591762
  try {
591666
591763
  if (typeof tool.executeStream === "function") {
591667
591764
  const gen = tool.executeStream(finalArgs);
@@ -593085,6 +593182,65 @@ Evidence: ${evidencePreview}`.slice(0, 500);
593085
593182
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
593086
593183
  });
593087
593184
  }
593185
+ if ((tc.name === "sub_agent" || tc.name === "agent") && result.success && this._preFoldErrorCount != null && this._preFoldFixerDescription) {
593186
+ const desc = this._preFoldFixerDescription;
593187
+ const preCount = this._preFoldErrorCount;
593188
+ const foldOutput = String(result.output ?? result.error ?? "");
593189
+ const postSignal = failureProgressSignal(foldOutput);
593190
+ const cwd4 = this.authoritativeWorkingDirectory();
593191
+ let accepted = false;
593192
+ if (postSignal == null) {
593193
+ accepted = /\b(?:verified|clean|passed|succeeded|0\s*error)\b/i.test(foldOutput);
593194
+ } else {
593195
+ accepted = postSignal < preCount;
593196
+ }
593197
+ if (accepted) {
593198
+ try {
593199
+ _execSync("git stash drop", {
593200
+ cwd: cwd4,
593201
+ stdio: "pipe",
593202
+ timeout: 5e3
593203
+ });
593204
+ } catch {
593205
+ }
593206
+ this.emit({
593207
+ type: "status",
593208
+ content: `[CONVERGE-ACCEPT] fixer for "${desc}" — errors ${preCount}→${postSignal != null ? postSignal : "0"}, changes kept`,
593209
+ turn,
593210
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
593211
+ });
593212
+ } else {
593213
+ try {
593214
+ _execSync("git checkout -- .", {
593215
+ cwd: cwd4,
593216
+ stdio: "pipe",
593217
+ timeout: 1e4
593218
+ });
593219
+ _execSync("git clean -fd", {
593220
+ cwd: cwd4,
593221
+ stdio: "pipe",
593222
+ timeout: 1e4
593223
+ });
593224
+ } catch {
593225
+ }
593226
+ try {
593227
+ _execSync("git stash pop", {
593228
+ cwd: cwd4,
593229
+ stdio: "pipe",
593230
+ timeout: 1e4
593231
+ });
593232
+ } catch {
593233
+ }
593234
+ this.emit({
593235
+ type: "status",
593236
+ content: `[CONVERGE-REJECT] fixer for "${desc}" — errors ${preCount}→${postSignal != null ? postSignal : "?"}, rolled back`,
593237
+ turn,
593238
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
593239
+ });
593240
+ }
593241
+ this._preFoldErrorCount = null;
593242
+ this._preFoldFixerDescription = null;
593243
+ }
593088
593244
  try {
593089
593245
  const lh = this._longHaul;
593090
593246
  if (lh) {
@@ -593112,7 +593268,10 @@ ${rec.guidance}` : rec.guidance;
593112
593268
 
593113
593269
  ${dir}` : dir;
593114
593270
  }
593115
- lh.maybeLockContract({ path: editPath, content: writtenContent });
593271
+ lh.maybeLockContract({
593272
+ path: editPath,
593273
+ content: writtenContent
593274
+ });
593116
593275
  const specDir = lh.specGateGuidance({
593117
593276
  path: editPath,
593118
593277
  content: writtenContent
@@ -596918,6 +597077,16 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
596918
597077
  const call = this._longHaul.buildDelegationCall(this._lastBuildOutput);
596919
597078
  if (!call)
596920
597079
  return false;
597080
+ this._preFoldErrorCount = failureProgressSignal(this._lastBuildOutput) ?? null;
597081
+ this._preFoldFixerDescription = call.description;
597082
+ try {
597083
+ _execSync('git stash push -m "pre-fixer" --include-untracked', {
597084
+ cwd: this.authoritativeWorkingDirectory(),
597085
+ stdio: "pipe",
597086
+ timeout: 1e4
597087
+ });
597088
+ } catch {
597089
+ }
596921
597090
  this._autoDelegatedDirectiveIds.add(directive.id);
596922
597091
  const parentTok = estimateMessagesTokens2(messages2);
596923
597092
  this.emit({
@@ -607675,7 +607844,7 @@ var init_subagent_prompt = __esm({
607675
607844
  "If the fix requires touching more than 2 files, STOP and report that the",
607676
607845
  "unit is larger than one fixer — the orchestrator will re-decompose it."
607677
607846
  ],
607678
- foldFormat: 'task_complete(summary="<file>: <what you changed> — build <verified|still failing on: X>")',
607847
+ foldFormat: 'task_complete(summary="<file>: <what you changed> — build <verified|still failing on: X> — contract <matched|diverged on: Y>")',
607679
607848
  mutates: true
607680
607849
  },
607681
607850
  explore: {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.481",
3
+ "version": "1.0.483",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.481",
9
+ "version": "1.0.483",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.481",
3
+ "version": "1.0.483",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",