omnius 1.0.481 → 1.0.482

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
@@ -577354,7 +577354,7 @@ function languageOf(p2) {
577354
577354
  return "typescript";
577355
577355
  return "unknown";
577356
577356
  }
577357
- var JsonConvergenceStore, EDIT_TOOLS, LongHaulComponents, FIELD_STOPWORDS;
577357
+ var JsonConvergenceStore, EDIT_TOOLS, LOCKED_CONTRACT_FILE, LongHaulComponents, FIELD_STOPWORDS;
577358
577358
  var init_longhaul_integration = __esm({
577359
577359
  "packages/orchestrator/dist/longhaul-integration.js"() {
577360
577360
  "use strict";
@@ -577406,6 +577406,7 @@ var init_longhaul_integration = __esm({
577406
577406
  }
577407
577407
  };
577408
577408
  EDIT_TOOLS = /* @__PURE__ */ new Set(["file_edit", "file_patch", "batch_edit"]);
577409
+ LOCKED_CONTRACT_FILE = "locked-contract.json";
577409
577410
  LongHaulComponents = class {
577410
577411
  convergenceBreaker;
577411
577412
  adaptiveEdit;
@@ -577420,7 +577421,10 @@ var init_longhaul_integration = __esm({
577420
577421
  locked = /* @__PURE__ */ new Map();
577421
577422
  /** WO-11: provenance — which file each locked symbol was declared in. */
577422
577423
  lockedSource = /* @__PURE__ */ new Map();
577424
+ /** Persisted contract output path (relative to stateDir). */
577425
+ lockedContractPath;
577423
577426
  constructor(options2) {
577427
+ this.lockedContractPath = path7.join(options2.stateDir, LOCKED_CONTRACT_FILE);
577424
577428
  this.convergenceBreaker = new ConvergenceBreaker({
577425
577429
  ...options2.convergence,
577426
577430
  // Persist the cliff across sessions only when persistence is enabled;
@@ -577492,6 +577496,7 @@ var init_longhaul_integration = __esm({
577492
577496
  this.lockedSource.set(s2.name, input.path);
577493
577497
  }
577494
577498
  }
577499
+ this.persistLockedContract();
577495
577500
  return this.locked.size;
577496
577501
  } catch {
577497
577502
  return this.locked.size;
@@ -577501,6 +577506,22 @@ var init_longhaul_integration = __esm({
577501
577506
  lockedContract() {
577502
577507
  return { symbols: [...this.locked.values()] };
577503
577508
  }
577509
+ /**
577510
+ * Persist the locked contract to `.omnius/locked-contract.json` so sub-agent
577511
+ * fixers can read it as their canonical type reference. Fault-tolerant —
577512
+ * never throws; on error the in-memory contract remains available for
577513
+ * orchestrator-side gates.
577514
+ */
577515
+ persistLockedContract() {
577516
+ try {
577517
+ const contract = this.lockedContract();
577518
+ if (contract.symbols.length === 0)
577519
+ return;
577520
+ fs6.mkdirSync(path7.dirname(this.lockedContractPath), { recursive: true });
577521
+ fs6.writeFileSync(this.lockedContractPath, JSON.stringify(contract, null, 2));
577522
+ } catch {
577523
+ }
577524
+ }
577504
577525
  /** WO-11: map of locked symbol name → declaring file (for per-symbol units). */
577505
577526
  symbolSources() {
577506
577527
  return new Map(this.lockedSource);
@@ -577585,11 +577606,12 @@ var init_longhaul_integration = __esm({
577585
577606
  const symbol3 = top.symbol ? ` symbol \`${top.symbol}\`` : "";
577586
577607
  const kind = top.kind.replace(/_/g, " ");
577587
577608
  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.` : "";
577609
+ 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
577610
  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
577611
  sub_agent({
577590
577612
  subagent_type: "fixer",
577591
577613
  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}"
577614
+ 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
577615
  })
577594
577616
  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
577617
  } catch {
@@ -577614,8 +577636,12 @@ The sub-agent works in its own small context; when it folds back, run the build
577614
577636
  const symbol3 = top.symbol;
577615
577637
  const kind = top.kind.replace(/_/g, " ");
577616
577638
  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.` : "");
577639
+ const focusFiles = [
577640
+ file,
577641
+ ...declSrc && declSrc !== file ? [declSrc] : []
577642
+ ];
577643
+ const lockedRef = this.locked.size > 0 ? ` Also read .omnius/${LOCKED_CONTRACT_FILE} for the canonical type contract and match it exactly.` : "";
577644
+ 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
577645
  return {
577620
577646
  description: `fix ${symbol3 ?? file}`,
577621
577647
  prompt,
@@ -577661,7 +577687,10 @@ The sub-agent works in its own small context; when it folds back, run the build
577661
577687
  try {
577662
577688
  return decideCompaction(input);
577663
577689
  } catch {
577664
- return { compact: input.pressureRatio >= 0.85, reason: "fallback threshold" };
577690
+ return {
577691
+ compact: input.pressureRatio >= 0.85,
577692
+ reason: "fallback threshold"
577693
+ };
577665
577694
  }
577666
577695
  }
577667
577696
  /** WO-5: validate a compaction preserved pinned invariants (Slipstream). */
@@ -579722,7 +579751,7 @@ RECOVERY: cd to the directory containing '${file}', run a plain install with no
579722
579751
 
579723
579752
  // packages/orchestrator/dist/agenticRunner.js
579724
579753
  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";
579754
+ import { execFile as _execFile, execSync as _execSync, spawn as _spawn } from "node:child_process";
579726
579755
  import { createHash as _createHash } from "node:crypto";
579727
579756
  import { join as _pathJoin, relative as _pathRelative, resolve as _pathResolve } from "node:path";
579728
579757
  import { tmpdir as _osTmpdir } from "node:os";
@@ -580575,9 +580604,7 @@ var init_agenticRunner = __esm({
580575
580604
  "web_fetch",
580576
580605
  "tool_search"
580577
580606
  ]);
580578
- STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS = /* @__PURE__ */ new Set([
580579
- "todo_write"
580580
- ]);
580607
+ STATE_UPDATE_ACTION_REASON_SYNTHESIS_TOOLS = /* @__PURE__ */ new Set(["todo_write"]);
580581
580608
  TOOL_ACTION_REASON_SCHEMA = {
580582
580609
  type: "object",
580583
580610
  description: "Compact public action contract for this exact tool call. Do not include hidden chain-of-thought; use concise task-state facts.",
@@ -580604,13 +580631,7 @@ var init_agenticRunner = __esm({
580604
580631
  description: "Classify the action scope. Use targeted_patch for constrained edits; full_file_rewrite only for deliberate whole-file replacement."
580605
580632
  }
580606
580633
  },
580607
- required: [
580608
- "task_anchor",
580609
- "intent",
580610
- "evidence",
580611
- "expected_result",
580612
- "scope"
580613
- ]
580634
+ required: ["task_anchor", "intent", "evidence", "expected_result", "scope"]
580614
580635
  };
580615
580636
  SYSTEM_PROMPT = loadPrompt("agentic/system-large.md");
580616
580637
  SYSTEM_PROMPT_MEDIUM = loadPrompt("agentic/system-medium.md");
@@ -581116,6 +581137,10 @@ var init_agenticRunner = __esm({
581116
581137
  _decompModules = [];
581117
581138
  /** Auto-delegation: last failing build/verify output, for parsing the top unit. */
581118
581139
  _lastBuildOutput = null;
581140
+ /** Convergence gate: pre-fold error count for verifying fixer progress. */
581141
+ _preFoldErrorCount = null;
581142
+ /** Convergence gate: the fixer description being gated (for status messages). */
581143
+ _preFoldFixerDescription = null;
581119
581144
  /** Auto-delegation: directive ids we've already auto-delegated for (once each). */
581120
581145
  _autoDelegatedDirectiveIds = /* @__PURE__ */ new Set();
581121
581146
  _focusTerminalLedgerRecorded = false;
@@ -593085,6 +593110,65 @@ Evidence: ${evidencePreview}`.slice(0, 500);
593085
593110
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
593086
593111
  });
593087
593112
  }
593113
+ if ((tc.name === "sub_agent" || tc.name === "agent") && result.success && this._preFoldErrorCount != null && this._preFoldFixerDescription) {
593114
+ const desc = this._preFoldFixerDescription;
593115
+ const preCount = this._preFoldErrorCount;
593116
+ const foldOutput = String(result.output ?? result.error ?? "");
593117
+ const postSignal = failureProgressSignal(foldOutput);
593118
+ const cwd4 = this.authoritativeWorkingDirectory();
593119
+ let accepted = false;
593120
+ if (postSignal == null) {
593121
+ accepted = /\b(?:verified|clean|passed|succeeded|0\s*error)\b/i.test(foldOutput);
593122
+ } else {
593123
+ accepted = postSignal < preCount;
593124
+ }
593125
+ if (accepted) {
593126
+ try {
593127
+ _execSync("git stash drop", {
593128
+ cwd: cwd4,
593129
+ stdio: "pipe",
593130
+ timeout: 5e3
593131
+ });
593132
+ } catch {
593133
+ }
593134
+ this.emit({
593135
+ type: "status",
593136
+ content: `[CONVERGE-ACCEPT] fixer for "${desc}" — errors ${preCount}→${postSignal != null ? postSignal : "0"}, changes kept`,
593137
+ turn,
593138
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
593139
+ });
593140
+ } else {
593141
+ try {
593142
+ _execSync("git checkout -- .", {
593143
+ cwd: cwd4,
593144
+ stdio: "pipe",
593145
+ timeout: 1e4
593146
+ });
593147
+ _execSync("git clean -fd", {
593148
+ cwd: cwd4,
593149
+ stdio: "pipe",
593150
+ timeout: 1e4
593151
+ });
593152
+ } catch {
593153
+ }
593154
+ try {
593155
+ _execSync("git stash pop", {
593156
+ cwd: cwd4,
593157
+ stdio: "pipe",
593158
+ timeout: 1e4
593159
+ });
593160
+ } catch {
593161
+ }
593162
+ this.emit({
593163
+ type: "status",
593164
+ content: `[CONVERGE-REJECT] fixer for "${desc}" — errors ${preCount}→${postSignal != null ? postSignal : "?"}, rolled back`,
593165
+ turn,
593166
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
593167
+ });
593168
+ }
593169
+ this._preFoldErrorCount = null;
593170
+ this._preFoldFixerDescription = null;
593171
+ }
593088
593172
  try {
593089
593173
  const lh = this._longHaul;
593090
593174
  if (lh) {
@@ -593112,7 +593196,10 @@ ${rec.guidance}` : rec.guidance;
593112
593196
 
593113
593197
  ${dir}` : dir;
593114
593198
  }
593115
- lh.maybeLockContract({ path: editPath, content: writtenContent });
593199
+ lh.maybeLockContract({
593200
+ path: editPath,
593201
+ content: writtenContent
593202
+ });
593116
593203
  const specDir = lh.specGateGuidance({
593117
593204
  path: editPath,
593118
593205
  content: writtenContent
@@ -596918,6 +597005,16 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
596918
597005
  const call = this._longHaul.buildDelegationCall(this._lastBuildOutput);
596919
597006
  if (!call)
596920
597007
  return false;
597008
+ this._preFoldErrorCount = failureProgressSignal(this._lastBuildOutput) ?? null;
597009
+ this._preFoldFixerDescription = call.description;
597010
+ try {
597011
+ _execSync('git stash push -m "pre-fixer" --include-untracked', {
597012
+ cwd: this.authoritativeWorkingDirectory(),
597013
+ stdio: "pipe",
597014
+ timeout: 1e4
597015
+ });
597016
+ } catch {
597017
+ }
596921
597018
  this._autoDelegatedDirectiveIds.add(directive.id);
596922
597019
  const parentTok = estimateMessagesTokens2(messages2);
596923
597020
  this.emit({
@@ -607675,7 +607772,7 @@ var init_subagent_prompt = __esm({
607675
607772
  "If the fix requires touching more than 2 files, STOP and report that the",
607676
607773
  "unit is larger than one fixer — the orchestrator will re-decompose it."
607677
607774
  ],
607678
- foldFormat: 'task_complete(summary="<file>: <what you changed> — build <verified|still failing on: X>")',
607775
+ foldFormat: 'task_complete(summary="<file>: <what you changed> — build <verified|still failing on: X> — contract <matched|diverged on: Y>")',
607679
607776
  mutates: true
607680
607777
  },
607681
607778
  explore: {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.481",
3
+ "version": "1.0.482",
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.482",
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.482",
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",