omnius 1.0.599 → 1.0.600

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
@@ -630870,6 +630870,23 @@ function mergeRanges(ranges) {
630870
630870
  function rangeLabel(ranges) {
630871
630871
  return ranges.map((r2) => r2.end === Infinity || r2.start === 0 ? "whole file" : `lines ${r2.start}-${r2.end}`).join(", ");
630872
630872
  }
630873
+ function sameRange(a2, b) {
630874
+ return a2.start === b.start && a2.end === b.end;
630875
+ }
630876
+ function rangeCovers(observed, requested) {
630877
+ const requestedWhole = requested.start === 0 || requested.end === Infinity;
630878
+ const observedWhole = observed.start === 0 || observed.end === Infinity;
630879
+ if (requestedWhole)
630880
+ return observedWhole;
630881
+ if (observedWhole)
630882
+ return true;
630883
+ return observed.start <= requested.start && requested.end <= observed.end;
630884
+ }
630885
+ function rangeWidth(range) {
630886
+ if (range.start === 0 || range.end === Infinity)
630887
+ return Infinity;
630888
+ return Math.max(0, range.end - range.start + 1);
630889
+ }
630873
630890
  function looksLikePartialCapture(content) {
630874
630891
  return /\[(?:oversize\s+(?:output|llmContent)|Tool output truncated|GREP_PARTIAL)\b/i.test(content);
630875
630892
  }
@@ -630895,16 +630912,36 @@ var init_evidenceLedger = __esm({
630895
630912
  "use strict";
630896
630913
  EvidenceLedger = class {
630897
630914
  entries = /* @__PURE__ */ new Map();
630915
+ /** Exact replay bodies, independently range-bound from aggregate receipts. */
630916
+ readBodies = /* @__PURE__ */ new Map();
630917
+ recordBody(path16, body, reset) {
630918
+ const prior = reset ? [] : this.readBodies.get(path16) ?? [];
630919
+ const retained = prior.filter((candidate) => !sameRange(candidate.range, body.range));
630920
+ retained.push(body);
630921
+ retained.sort((a2, b) => b.lastReadTurn - a2.lastReadTurn);
630922
+ this.readBodies.set(path16, retained.slice(0, 16));
630923
+ }
630898
630924
  /** Record a successful read. `fileVersion` is the file's current writeCount. */
630899
630925
  recordRead(input) {
630900
- const { path: path16, content, range, fileVersion, turn } = input;
630926
+ const { path: path16, content, fileVersion, turn } = input;
630901
630927
  if (!path16 || !content)
630902
630928
  return;
630929
+ const reportedRange = input.artifactMaterialization?.sourceRange;
630930
+ const materializedRange = reportedRange && typeof reportedRange.endLine === "number" ? {
630931
+ startLine: reportedRange.startLine,
630932
+ endLine: reportedRange.endLine
630933
+ } : void 0;
630934
+ const requestedWhole = input.range.start === 0 || input.range.end === Infinity;
630935
+ const range = !requestedWhole && materializedRange ? {
630936
+ start: materializedRange.startLine,
630937
+ end: materializedRange.endLine
630938
+ } : { ...input.range };
630903
630939
  const inferredPartial = input.artifactMaterialization?.status === "partial" || input.fidelity === "partial" || looksLikePartialCapture(content);
630904
630940
  const built = input.fidelity === "extract" ? { text: content, fidelity: "extract" } : inferredPartial ? { text: content, fidelity: "partial" } : { text: content, fidelity: "full" };
630905
630941
  const materialization = input.artifactMaterialization ?? (inferredPartial ? inferredPartialMaterialization(content) : void 0);
630906
630942
  const existing = this.entries.get(path16);
630907
- if (existing && existing.readVersion === fileVersion && !existing.stale) {
630943
+ const sameRevision = existing && existing.readVersion === fileVersion && !existing.stale && (!existing.contentHash || !input.contentHash || existing.contentHash === input.contentHash);
630944
+ if (existing && sameRevision) {
630908
630945
  if (built.fidelity === "extract" && existing.fidelity === "full") {
630909
630946
  const keepExistingCompleteExtract = existing.derivedExtract?.complete === true && input.extractComplete !== true;
630910
630947
  this.entries.set(path16, {
@@ -630926,6 +630963,14 @@ var init_evidenceLedger = __esm({
630926
630963
  return;
630927
630964
  }
630928
630965
  if (built.fidelity === "partial" && existing.fidelity === "full") {
630966
+ this.recordBody(path16, {
630967
+ range,
630968
+ content: built.text,
630969
+ ...input.contentHash ? { contentHash: input.contentHash } : {},
630970
+ fidelity: "partial",
630971
+ lastReadTurn: turn,
630972
+ ...materialization ? { artifactMaterialization: materialization } : {}
630973
+ }, false);
630929
630974
  this.entries.set(path16, {
630930
630975
  ...existing,
630931
630976
  lastReadTurn: turn,
@@ -630934,9 +630979,20 @@ var init_evidenceLedger = __esm({
630934
630979
  return;
630935
630980
  }
630936
630981
  const keepNew = existing.fidelity === "partial" && built.fidelity !== "partial" || built.text.length >= existing.content.length;
630982
+ if (built.fidelity !== "extract") {
630983
+ this.recordBody(path16, {
630984
+ range,
630985
+ content: built.text,
630986
+ ...input.contentHash ? { contentHash: input.contentHash } : {},
630987
+ fidelity: built.fidelity,
630988
+ lastReadTurn: turn,
630989
+ ...materialization ? { artifactMaterialization: materialization } : {}
630990
+ }, false);
630991
+ }
630937
630992
  this.entries.set(path16, {
630938
630993
  ...existing,
630939
630994
  content: keepNew ? built.text : existing.content,
630995
+ contentRange: keepNew ? range : existing.contentRange,
630940
630996
  contentHash: input.contentHash ?? existing.contentHash,
630941
630997
  fidelity: keepNew ? built.fidelity : existing.fidelity,
630942
630998
  ...keepNew && materialization ? { artifactMaterialization: materialization } : existing.artifactMaterialization ? { artifactMaterialization: existing.artifactMaterialization } : {},
@@ -630948,12 +631004,25 @@ var init_evidenceLedger = __esm({
630948
631004
  });
630949
631005
  return;
630950
631006
  }
631007
+ if (built.fidelity !== "extract") {
631008
+ this.recordBody(path16, {
631009
+ range,
631010
+ content: built.text,
631011
+ ...input.contentHash ? { contentHash: input.contentHash } : {},
631012
+ fidelity: built.fidelity,
631013
+ lastReadTurn: turn,
631014
+ ...materialization ? { artifactMaterialization: materialization } : {}
631015
+ }, true);
631016
+ } else {
631017
+ this.readBodies.delete(path16);
631018
+ }
630951
631019
  this.entries.set(path16, {
630952
631020
  path: path16,
630953
631021
  contentHash: input.contentHash,
630954
631022
  readVersion: fileVersion,
630955
631023
  mtimeMs: input.mtimeMs ?? 0,
630956
631024
  lastReadTurn: turn,
631025
+ contentRange: range,
630957
631026
  ranges: [range],
630958
631027
  content: built.text,
630959
631028
  fidelity: built.fidelity,
@@ -630974,6 +631043,19 @@ var init_evidenceLedger = __esm({
630974
631043
  const e2 = this.entries.get(path16);
630975
631044
  return !!e2 && !e2.stale && e2.fidelity !== "partial";
630976
631045
  }
631046
+ /**
631047
+ * Resolve a replay body only when that body's own provenance fully covers
631048
+ * the requested range. Aggregate `EvidenceEntry.ranges` are receipts only.
631049
+ */
631050
+ resolveFreshRead(input) {
631051
+ const entry = this.entries.get(input.path);
631052
+ if (!entry || entry.stale)
631053
+ return void 0;
631054
+ if (input.contentHash && input.contentHash !== entry.contentHash) {
631055
+ return void 0;
631056
+ }
631057
+ return (this.readBodies.get(input.path) ?? []).filter((body) => body.fidelity === "full" && (!input.contentHash || body.contentHash === input.contentHash) && rangeCovers(body.range, input.requestedRange)).sort((a2, b) => rangeWidth(a2.range) - rangeWidth(b.range) || b.lastReadTurn - a2.lastReadTurn)[0];
631058
+ }
630977
631059
  /**
630978
631060
  * Validate evidence freshness against the real filesystem via stat().
630979
631061
  * If the file's mtime has changed since we last read it (external mutation
@@ -631022,6 +631104,7 @@ var init_evidenceLedger = __esm({
631022
631104
  const cap = Math.max(1, Math.min(200, Math.floor(maxEntries)));
631023
631105
  return [...this.entries.values()].sort((a2, b) => b.lastReadTurn - a2.lastReadTurn).slice(0, cap).map((entry) => ({
631024
631106
  ...entry,
631107
+ contentRange: { ...entry.contentRange },
631025
631108
  ranges: entry.ranges.map((range) => ({ ...range })),
631026
631109
  ...entry.derivedExtract ? {
631027
631110
  derivedExtract: {
@@ -631053,6 +631136,7 @@ var init_evidenceLedger = __esm({
631053
631136
  }
631054
631137
  clear() {
631055
631138
  this.entries.clear();
631139
+ this.readBodies.clear();
631056
631140
  }
631057
631141
  /**
631058
631142
  * Render the evidence block for the ACTIVE CONTEXT FRAME. Freshest reads
@@ -631077,8 +631161,10 @@ var init_evidenceLedger = __esm({
631077
631161
  let used = lines.join("\n").length;
631078
631162
  for (const e2 of sorted) {
631079
631163
  const selectedExtract = !e2.stale && e2.derivedExtract?.complete === true ? e2.derivedExtract : void 0;
631080
- const renderedRanges = selectedExtract?.ranges ?? e2.ranges;
631081
- const header = e2.stale ? `▸ ${e2.path} @v${e2.readVersion} [STALE — changed since read; re-read needed] (${rangeLabel(e2.ranges)})` : selectedExtract ? `▸ ${e2.path} @v${e2.readVersion} [DERIVED EXTRACT — contract complete; canonical full source retained] (${rangeLabel(renderedRanges)}):` : e2.fidelity === "partial" ? `▸ ${e2.path} @v${e2.readVersion} [PARTIAL — successful output was capped; do not infer omitted text is absent] (${rangeLabel(e2.ranges)})` : `▸ ${e2.path} @v${e2.readVersion} [FRESH${e2.contentHash ? ` sha256=${e2.contentHash}` : ""}] (${rangeLabel(e2.ranges)}):`;
631164
+ const renderedRanges = selectedExtract?.ranges ?? [e2.contentRange];
631165
+ const coverage = rangeLabel(e2.ranges);
631166
+ const bodyRange = rangeLabel(renderedRanges);
631167
+ const header = e2.stale ? `▸ ${e2.path} @v${e2.readVersion} [STALE — changed since read; re-read needed] (${rangeLabel(e2.ranges)})` : selectedExtract ? `▸ ${e2.path} @v${e2.readVersion} [DERIVED EXTRACT — contract complete; canonical full source retained] (${rangeLabel(renderedRanges)}):` : e2.fidelity === "partial" ? `▸ ${e2.path} @v${e2.readVersion} [PARTIAL — successful output was capped; do not infer omitted text is absent] (body ${bodyRange}; coverage ${coverage})` : `▸ ${e2.path} @v${e2.readVersion} [FRESH${e2.contentHash ? ` sha256=${e2.contentHash}` : ""}] (body ${bodyRange}; coverage ${coverage}):`;
631082
631168
  if (compact6) {
631083
631169
  const receipt2 = `- evidence_id=file:${e2.path}@v${e2.readVersion} outcome=${e2.stale ? "stale" : "fresh"} fidelity=${e2.fidelity} sha256=${e2.contentHash ?? "unknown"} ranges=${rangeLabel(renderedRanges)}`;
631084
631170
  if (used + receipt2.length + 1 <= maxChars) {
@@ -651412,20 +651498,6 @@ ${blob}
651412
651498
  const p2 = pathForResult(idx);
651413
651499
  if (p2 && latestIdxForPath.get(p2) === idx)
651414
651500
  continue;
651415
- if (p2 && content.length >= 100) {
651416
- try {
651417
- this._evidenceLedger.recordRead({
651418
- path: this._normalizeEvidencePath(p2),
651419
- content,
651420
- contentHash: this._extractFileReadSha256(content) ?? void 0,
651421
- range: { start: 0, end: Number.POSITIVE_INFINITY },
651422
- fileVersion: this._worldFacts.files.get(p2)?.writeCount ?? 0,
651423
- mtimeMs: this._statMtimeMsForToolPath(p2),
651424
- turn: this._taskState?.toolCallCount ?? 0
651425
- });
651426
- } catch {
651427
- }
651428
- }
651429
651501
  const meta = metaForResult(idx);
651430
651502
  let stub;
651431
651503
  if (p2) {
@@ -651585,20 +651657,6 @@ ${blob}
651585
651657
  if (covered)
651586
651658
  return cov.fingerprint;
651587
651659
  }
651588
- if (!iv.whole && Number.isFinite(iv.end)) {
651589
- let best = null;
651590
- const requestedLength = Math.max(1, iv.end - iv.start + 1);
651591
- for (const cov of intervals) {
651592
- if (cov.whole || !Number.isFinite(cov.end))
651593
- continue;
651594
- const overlap = Math.max(0, Math.min(iv.end, cov.end) - Math.max(iv.start, cov.start) + 1);
651595
- if (overlap / requestedLength >= 0.8 && (!best || overlap > best.overlap)) {
651596
- best = { fingerprint: cov.fingerprint, overlap };
651597
- }
651598
- }
651599
- if (best)
651600
- return best.fingerprint;
651601
- }
651602
651660
  return exactFingerprint;
651603
651661
  }
651604
651662
  /** Register a read's region under the fingerprint that cached its result. */
@@ -652779,16 +652837,12 @@ ${notice}`;
652779
652837
  this._emitSteeringLifecycle(record, gatesOldPlan ? `admitted at turn ${turn}; old-plan actions are gated pending structured reconciliation` : `admitted at turn ${turn}; awaiting structured reconciliation`);
652780
652838
  }
652781
652839
  }
652782
- _canonicalReadEvidencePayload(canonicalPath2, contentHash2) {
652783
- const evidence = this._evidenceLedger.get(canonicalPath2);
652784
- if (evidence && !evidence.stale && evidence.contentHash === contentHash2 && evidence.fidelity === "full" && this._mustHonorExplicitFullFileRead(Buffer.byteLength(evidence.content, "utf8"), evidence.content.split("\n").length, this._branchRoutingContextWindow())) {
652785
- return evidence.content;
652786
- }
652787
- const branch = this._branchEvidenceByPath.get(canonicalPath2);
652788
- if (branch && branch.contentHash === contentHash2 && branch.taskEpoch === this._taskEpoch && branch.contractComplete) {
652789
- return branch.output;
652790
- }
652791
- return null;
652840
+ _canonicalReadEvidencePayload(canonicalPath2, contentHash2, requestedRange) {
652841
+ return this._evidenceLedger.resolveFreshRead({
652842
+ path: canonicalPath2,
652843
+ requestedRange,
652844
+ contentHash: contentHash2
652845
+ })?.content ?? null;
652792
652846
  }
652793
652847
  _rehydrateResolvedReadEvidence(input) {
652794
652848
  return [
@@ -658897,27 +658951,26 @@ ${cachedResult}`,
658897
658951
  let branchEvidenceResult = null;
658898
658952
  if (normalizedDispatchName === "file_read" && this._fileReadMode(tc.arguments) !== "extract") {
658899
658953
  const exactReadFingerprint = this._buildToolFingerprint("file_read", tc.arguments);
658954
+ const exactReadInterval = this._readIntervalFromArgs("file_read", tc.arguments);
658955
+ const requestedReadRange = exactReadInterval && !exactReadInterval.whole ? {
658956
+ start: exactReadInterval.start,
658957
+ end: exactReadInterval.end
658958
+ } : {
658959
+ start: 0,
658960
+ end: Number.POSITIVE_INFINITY
658961
+ };
658900
658962
  const exactReadKey = this._resolveReadCoverageFingerprint("file_read", tc.arguments, exactReadFingerprint);
658901
658963
  const priorRead = exactFileReadObservations.get(exactReadKey);
658902
658964
  if (priorRead) {
658903
658965
  const currentRead = this._fileReadDiskIdentity(tc.arguments);
658904
658966
  if (currentRead && currentRead.contentHash === priorRead.contentHash) {
658905
658967
  exactFileReadObservations.set(exactReadKey, currentRead);
658906
- const canonicalPayload = this._canonicalReadEvidencePayload(currentRead.canonicalPath, currentRead.contentHash);
658968
+ const canonicalPayload = this._canonicalReadEvidencePayload(currentRead.canonicalPath, currentRead.contentHash, requestedReadRange);
658907
658969
  if (canonicalPayload) {
658908
- const evidence = this._evidenceLedger.get(currentRead.canonicalPath);
658909
- const fullSource = evidence?.fidelity === "full" && evidence.content === canonicalPayload;
658910
- const delivered = fullSource ? canonicalPayload : this._rehydrateResolvedReadEvidence({
658911
- fingerprint: exactReadKey,
658912
- canonicalPath: currentRead.canonicalPath,
658913
- contentHash: currentRead.contentHash,
658914
- payload: canonicalPayload,
658915
- turn
658916
- });
658917
658970
  branchEvidenceResult = {
658918
658971
  success: true,
658919
- output: delivered,
658920
- llmContent: delivered,
658972
+ output: canonicalPayload,
658973
+ llmContent: canonicalPayload,
658921
658974
  beforeHash: currentRead.contentHash,
658922
658975
  runtimeAuthored: true,
658923
658976
  noop: true,
@@ -658930,16 +658983,15 @@ ${cachedResult}`,
658930
658983
  this.emit({
658931
658984
  type: "status",
658932
658985
  toolName: normalizedDispatchName,
658933
- content: fullSource ? `Exact unchanged file_read served as canonical full source: ${currentRead.path} sha256=${currentRead.contentHash.slice(0, 12)}` : `Exact unchanged file_read reused complete branch evidence: ${currentRead.path} sha256=${currentRead.contentHash.slice(0, 12)}`,
658986
+ content: `Unchanged file_read served from range-safe canonical source: ${currentRead.path} sha256=${currentRead.contentHash.slice(0, 12)}`,
658934
658987
  turn,
658935
658988
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
658936
658989
  });
658937
658990
  } else {
658938
- exactFileReadObservations.delete(exactReadKey);
658939
658991
  this.emit({
658940
658992
  type: "status",
658941
658993
  toolName: normalizedDispatchName,
658942
- content: `Exact read cache lacks model-visible source; executing requested read: ${currentRead.path}`,
658994
+ content: `Read cache has no body covering the requested range; executing requested read: ${currentRead.path}`,
658943
658995
  turn,
658944
658996
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
658945
658997
  });
@@ -659265,6 +659317,14 @@ ${diagnostic}`;
659265
659317
  const rLimit = typeof tc.arguments?.["limit"] === "number" ? tc.arguments["limit"] : void 0;
659266
659318
  const start3 = rOffset === void 0 && rLimit === void 0 ? 0 : Math.max(1, rOffset ?? 1);
659267
659319
  const end = rOffset === void 0 && rLimit === void 0 ? Number.POSITIVE_INFINITY : rLimit !== void 0 ? Math.max(1, rOffset ?? 1) + Math.max(0, rLimit) - 1 : Number.POSITIVE_INFINITY;
659320
+ const requestedWhole = start3 === 0;
659321
+ const reportedRange = result.artifactMaterialization?.sourceRange;
659322
+ const materializedRange = reportedRange && typeof reportedRange.endLine === "number" ? {
659323
+ startLine: reportedRange.startLine,
659324
+ endLine: reportedRange.endLine
659325
+ } : void 0;
659326
+ const effectiveStart = !requestedWhole && materializedRange ? materializedRange.startLine : start3;
659327
+ const effectiveEnd = !requestedWhole && materializedRange ? materializedRange.endLine : end;
659268
659328
  this._evidenceLedger.recordRead({
659269
659329
  path: this._normalizeEvidencePath(p2),
659270
659330
  content: result.output,
@@ -659283,8 +659343,8 @@ ${diagnostic}`;
659283
659343
  path: this._normalizeEvidencePath(p2),
659284
659344
  contentHash: result.beforeHash,
659285
659345
  sourceRange: {
659286
- startLine: start3 || 1,
659287
- endLine: end === Number.POSITIVE_INFINITY ? Number.MAX_SAFE_INTEGER : end
659346
+ startLine: effectiveStart || 1,
659347
+ endLine: effectiveEnd === Number.POSITIVE_INFINITY ? Number.MAX_SAFE_INTEGER : effectiveEnd
659288
659348
  },
659289
659349
  turn
659290
659350
  });
@@ -659295,8 +659355,14 @@ ${diagnostic}`;
659295
659355
  this._inlineReadArtifacts.delete(oldest);
659296
659356
  }
659297
659357
  }
659298
- if (result.partial !== true && result.artifactMaterialization?.status !== "partial") {
659299
- this._registerReadCoverage("file_read", tc.arguments, toolFingerprint);
659358
+ if (result.runtimeAuthored !== true && result.partial !== true && result.artifactMaterialization?.status !== "partial" && this._fileReadMode(tc.arguments) !== "extract") {
659359
+ const coverageArgs = !requestedWhole && materializedRange ? {
659360
+ ...tc.arguments,
659361
+ offset: effectiveStart,
659362
+ limit: Math.max(0, effectiveEnd - effectiveStart + 1)
659363
+ } : tc.arguments;
659364
+ const exactCoverageFingerprint = this._buildToolFingerprint("file_read", coverageArgs);
659365
+ this._registerReadCoverage("file_read", coverageArgs, this._resolveReadCoverageFingerprint("file_read", coverageArgs, exactCoverageFingerprint));
659300
659366
  }
659301
659367
  }
659302
659368
  if (this._fileSummaryStore && result.success && result.output && result.output.length > 100) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.599",
3
+ "version": "1.0.600",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.599",
9
+ "version": "1.0.600",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
@@ -7675,9 +7675,9 @@
7675
7675
  "license": "ISC"
7676
7676
  },
7677
7677
  "node_modules/ws": {
7678
- "version": "8.21.1",
7679
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz",
7680
- "integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==",
7678
+ "version": "8.21.2",
7679
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.2.tgz",
7680
+ "integrity": "sha512-54dMVAo4WIe6SKy3vBgN+9bJZqqQ8IMRevAkOLQALhi49qkkQDQfWdAZ8KQlXiEabw88ARXXdUrlvtbKQX+aKw==",
7681
7681
  "license": "MIT",
7682
7682
  "engines": {
7683
7683
  "node": ">=10.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.599",
3
+ "version": "1.0.600",
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/library.js",