omnius 1.0.448 → 1.0.449

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
@@ -574750,15 +574750,16 @@ var init_focusSupervisor = __esm({
574750
574750
  if (strict && prior.ignoredCount >= 1) {
574751
574751
  const terminal = this.ignoredDirectiveStreak >= TERMINAL_INCOMPLETE_IGNORE_THRESHOLD;
574752
574752
  const ignoredManyTimes = this.ignoredDirectiveStreak >= 3;
574753
+ const accumulatedFamilies = [...prior.forbiddenActionFamilies, family];
574754
+ if (prior.requiredNextAction === "read_authoritative_target" && isEditTool(input.toolName)) {
574755
+ accumulatedFamilies.push(input.toolName);
574756
+ }
574753
574757
  const directive = this.setDirective({
574754
574758
  turn: input.turn,
574755
574759
  state: terminal ? "terminal_incomplete" : ignoredManyTimes ? "verify_or_block" : "single_next_action",
574756
574760
  reason: terminal ? `model ignored ${this.ignoredDirectiveStreak} focus directives with no satisfying recovery action; report incomplete with the blocker and evidence` : ignoredManyTimes ? `model ignored ${this.ignoredDirectiveStreak} focus directives; take the required recovery action before trying another variant` : `model ignored prior directive ${prior.id}; ${prior.reason}`,
574757
574761
  requiredNextAction: terminal ? "report_incomplete" : prior.requiredNextAction,
574758
- forbiddenActionFamilies: uniqueLimited([
574759
- ...prior.forbiddenActionFamilies,
574760
- family
574761
- ])
574762
+ forbiddenActionFamilies: uniqueLimited(accumulatedFamilies)
574762
574763
  });
574763
574764
  this.lastIgnoredDirectiveTurn = input.turn;
574764
574765
  return this.block(directive, [
@@ -574872,13 +574873,26 @@ var init_focusSupervisor = __esm({
574872
574873
  errorClass: failureErrorClass(input.error || input.output || "")
574873
574874
  };
574874
574875
  this.failureFamilies.set(family, next);
574875
- if (next.count >= 2 && this.shouldStrictlyIntervene(this.lastContext)) {
574876
+ if (next.count >= 2) {
574876
574877
  const staleEditFailure = isEditTool(input.toolName) && next.errorClass.startsWith("stale_");
574878
+ const forbidden = staleEditFailure ? uniqueLimited([
574879
+ actionFamily(input.toolName, input.args),
574880
+ input.toolName
574881
+ ]) : [actionFamily(input.toolName, input.args)];
574877
574882
  this.setDirective({
574878
574883
  turn: input.turn,
574879
574884
  state: "forced_replan",
574880
574885
  reason: `same ${input.toolName} failure family repeated ${next.count} times: ${next.sample}`,
574881
574886
  requiredNextAction: staleEditFailure ? "read_authoritative_target" : input.toolName === "shell" ? "edit_different_target" : "update_todos",
574887
+ forbiddenActionFamilies: forbidden
574888
+ });
574889
+ } else if (next.count === 1 && !this.directive) {
574890
+ const staleEditFailure = isEditTool(input.toolName) && next.errorClass.startsWith("stale_");
574891
+ this.setDirective({
574892
+ turn: input.turn,
574893
+ state: "warn",
574894
+ reason: `first ${input.toolName} failure (${next.errorClass}): ${next.sample}`,
574895
+ requiredNextAction: staleEditFailure ? "read_authoritative_target" : "update_todos",
574882
574896
  forbiddenActionFamilies: [actionFamily(input.toolName, input.args)]
574883
574897
  });
574884
574898
  }
@@ -579617,6 +579631,129 @@ Your hypotheses MUST address this specific error, not generic causes.
579617
579631
  return null;
579618
579632
  }
579619
579633
  }
579634
+ /**
579635
+ * GC old/stale system messages and cap total system chars at 60% of context
579636
+ * window. Classifies system messages by content markers, keeps only the latest
579637
+ * instance of each type, and drops whole types (most expendable first) when
579638
+ * the system budget is exceeded. Never removes the base system prompt (msg[0]),
579639
+ * mission contract, or active context frame. Mutates `messages` in place.
579640
+ */
579641
+ gcSystemMessages(messages2) {
579642
+ const ctx3 = this.options.contextWindowSize ?? 0;
579643
+ if (ctx3 <= 0)
579644
+ return;
579645
+ const systemMaxChars = Math.floor(ctx3 * 0.6);
579646
+ const EXPENDABLE_PRIORITY = /* @__PURE__ */ new Map([
579647
+ ["coaching_hint", 0],
579648
+ ["memory_retrieval", 1],
579649
+ ["reflection", 2],
579650
+ ["failure_handoff", 3],
579651
+ ["decomposition", 4],
579652
+ ["completion_prompt", 5],
579653
+ ["efficiency_hint", 6],
579654
+ ["reg61_nudge", 7],
579655
+ ["todo_status", 8],
579656
+ ["focus_directive", 9],
579657
+ ["reg46_world_state", 10]
579658
+ ]);
579659
+ const NEVER_REMOVE = /* @__PURE__ */ new Set([
579660
+ "base_system",
579661
+ "mission_contract",
579662
+ "context_frame"
579663
+ ]);
579664
+ const classify = (content) => {
579665
+ if (content.startsWith("[ACTIVE CONTEXT FRAME]"))
579666
+ return "context_frame";
579667
+ if (content.includes("<world-state"))
579668
+ return "reg46_world_state";
579669
+ if (content.startsWith("[ALL TODOS COMPLETED"))
579670
+ return "completion_prompt";
579671
+ if (content.startsWith("[BLOCKED") || content.includes("first") && content.includes("edit") && content.includes("nudge"))
579672
+ return "reg61_nudge";
579673
+ if (content.startsWith("Reflexion") || content.includes("prior failure reflection"))
579674
+ return "reflection";
579675
+ if (content.includes("failure") && content.includes("handoff"))
579676
+ return "failure_handoff";
579677
+ if (content.includes("associative memory") || content.includes("prior experience"))
579678
+ return "memory_retrieval";
579679
+ if (content.includes("MODULE DECOMPOSITION") || content.includes("decomposition"))
579680
+ return "decomposition";
579681
+ if (content.includes("mission") && content.includes("completion contract"))
579682
+ return "mission_contract";
579683
+ if (content.includes("efficiency") || content.includes("consider using"))
579684
+ return "efficiency_hint";
579685
+ if (content.includes("todo") || content.includes("TODO") || content.includes("task_complete"))
579686
+ return "todo_status";
579687
+ if (content.includes("forbidden") || content.includes("replan") || content.includes("directive"))
579688
+ return "focus_directive";
579689
+ if (content.includes("coaching") || content.includes("hint") || content.length < 80)
579690
+ return "coaching_hint";
579691
+ return "base_system";
579692
+ };
579693
+ const groups = /* @__PURE__ */ new Map();
579694
+ let totalSystemChars = 0;
579695
+ for (let i2 = 0; i2 < messages2.length; i2++) {
579696
+ const m2 = messages2[i2];
579697
+ if (m2?.role !== "system" || typeof m2.content !== "string")
579698
+ continue;
579699
+ const type = classify(m2.content);
579700
+ let group = groups.get(type);
579701
+ if (!group) {
579702
+ group = [];
579703
+ groups.set(type, group);
579704
+ }
579705
+ group.push({ index: i2, chars: m2.content.length });
579706
+ totalSystemChars += m2.content.length;
579707
+ }
579708
+ if (totalSystemChars <= systemMaxChars)
579709
+ return;
579710
+ const indicesToRemove = /* @__PURE__ */ new Set();
579711
+ for (const [type, entries] of groups) {
579712
+ if (NEVER_REMOVE.has(type))
579713
+ continue;
579714
+ if (entries.length <= 1)
579715
+ continue;
579716
+ for (let e2 = 0; e2 < entries.length - 1; e2++) {
579717
+ indicesToRemove.add(entries[e2].index);
579718
+ totalSystemChars -= entries[e2].chars;
579719
+ }
579720
+ }
579721
+ if (totalSystemChars <= systemMaxChars) {
579722
+ this._applySystemRemoval(messages2, indicesToRemove);
579723
+ return;
579724
+ }
579725
+ const sortedTypes = [...groups.entries()].filter(([type]) => !NEVER_REMOVE.has(type)).map(([type, entries]) => {
579726
+ const remaining = entries.filter((e2) => !indicesToRemove.has(e2.index));
579727
+ const total = remaining.reduce((s2, e2) => s2 + e2.chars, 0);
579728
+ return {
579729
+ type,
579730
+ entries: remaining,
579731
+ total,
579732
+ priority: EXPENDABLE_PRIORITY.get(type) ?? 999
579733
+ };
579734
+ }).sort((a2, b) => a2.priority - b.priority);
579735
+ for (const { entries } of sortedTypes) {
579736
+ if (totalSystemChars <= systemMaxChars)
579737
+ break;
579738
+ for (const entry of entries) {
579739
+ if (indicesToRemove.has(entry.index))
579740
+ continue;
579741
+ indicesToRemove.add(entry.index);
579742
+ totalSystemChars -= entry.chars;
579743
+ if (totalSystemChars <= systemMaxChars)
579744
+ break;
579745
+ }
579746
+ }
579747
+ this._applySystemRemoval(messages2, indicesToRemove);
579748
+ }
579749
+ _applySystemRemoval(messages2, indices) {
579750
+ if (indices.size === 0)
579751
+ return;
579752
+ const sorted = [...indices].sort((a2, b) => b - a2);
579753
+ for (const idx of sorted) {
579754
+ messages2.splice(idx, 1);
579755
+ }
579756
+ }
579620
579757
  // ── Failing-approach detector (the "stop retrying variants" reflex) ───────
579621
579758
  // Encodes the behavior an effective agent uses and the dropbear 27× loop
579622
579759
  // lacked: when the SAME error recurs ~3× — especially while the same target
@@ -586745,6 +586882,7 @@ ${memoryLines.join("\n")}`
586745
586882
  this.proactivePrune(compacted, turn);
586746
586883
  this.microcompact(compacted, recentToolResults);
586747
586884
  this._insertContextFrame(compacted, await this._buildTurnContextFrame(turn, compacted, recentToolResults, environmentBlock));
586885
+ this.gcSystemMessages(compacted);
586748
586886
  let requestMessages = sanitizeHistoryThink(compacted);
586749
586887
  {
586750
586888
  const _limits = this.contextLimits();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.448",
3
+ "version": "1.0.449",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.448",
9
+ "version": "1.0.449",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
@@ -502,9 +502,9 @@
502
502
  }
503
503
  },
504
504
  "node_modules/@ipld/dag-pb/node_modules/multiformats": {
505
- "version": "14.0.3",
506
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
507
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
505
+ "version": "14.0.4",
506
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
507
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
508
508
  "license": "Apache-2.0 OR MIT"
509
509
  },
510
510
  "node_modules/@ipshipyard/libp2p-auto-tls": {
@@ -553,9 +553,9 @@
553
553
  }
554
554
  },
555
555
  "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/multiformats": {
556
- "version": "14.0.3",
557
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
558
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
556
+ "version": "14.0.4",
557
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
558
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
559
559
  "license": "Apache-2.0 OR MIT"
560
560
  },
561
561
  "node_modules/@ipshipyard/libp2p-auto-tls/node_modules/uint8arrays": {
@@ -765,9 +765,9 @@
765
765
  }
766
766
  },
767
767
  "node_modules/@libp2p/http-utils/node_modules/multiformats": {
768
- "version": "14.0.3",
769
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
770
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
768
+ "version": "14.0.4",
769
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
770
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
771
771
  "license": "Apache-2.0 OR MIT"
772
772
  },
773
773
  "node_modules/@libp2p/http-utils/node_modules/uint8arraylist": {
@@ -807,9 +807,9 @@
807
807
  }
808
808
  },
809
809
  "node_modules/@libp2p/http-websocket/node_modules/multiformats": {
810
- "version": "14.0.3",
811
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
812
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
810
+ "version": "14.0.4",
811
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
812
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
813
813
  "license": "Apache-2.0 OR MIT"
814
814
  },
815
815
  "node_modules/@libp2p/http-websocket/node_modules/uint8arraylist": {
@@ -1045,9 +1045,9 @@
1045
1045
  }
1046
1046
  },
1047
1047
  "node_modules/@libp2p/peer-record/node_modules/multiformats": {
1048
- "version": "14.0.3",
1049
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1050
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1048
+ "version": "14.0.4",
1049
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1050
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1051
1051
  "license": "Apache-2.0 OR MIT"
1052
1052
  },
1053
1053
  "node_modules/@libp2p/peer-record/node_modules/protons-runtime": {
@@ -1155,9 +1155,9 @@
1155
1155
  }
1156
1156
  },
1157
1157
  "node_modules/@libp2p/record/node_modules/multiformats": {
1158
- "version": "14.0.3",
1159
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1160
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1158
+ "version": "14.0.4",
1159
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1160
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1161
1161
  "license": "Apache-2.0 OR MIT"
1162
1162
  },
1163
1163
  "node_modules/@libp2p/record/node_modules/protons-runtime": {
@@ -1393,9 +1393,9 @@
1393
1393
  }
1394
1394
  },
1395
1395
  "node_modules/@libp2p/webrtc/node_modules/multiformats": {
1396
- "version": "14.0.3",
1397
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1398
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1396
+ "version": "14.0.4",
1397
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1398
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1399
1399
  "license": "Apache-2.0 OR MIT"
1400
1400
  },
1401
1401
  "node_modules/@libp2p/webrtc/node_modules/node-datachannel": {
@@ -1534,9 +1534,9 @@
1534
1534
  }
1535
1535
  },
1536
1536
  "node_modules/@multiformats/dns/node_modules/multiformats": {
1537
- "version": "14.0.3",
1538
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1539
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1537
+ "version": "14.0.4",
1538
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1539
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1540
1540
  "license": "Apache-2.0 OR MIT"
1541
1541
  },
1542
1542
  "node_modules/@multiformats/dns/node_modules/uint8arrays": {
@@ -1579,9 +1579,9 @@
1579
1579
  }
1580
1580
  },
1581
1581
  "node_modules/@multiformats/multiaddr/node_modules/multiformats": {
1582
- "version": "14.0.3",
1583
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1584
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1582
+ "version": "14.0.4",
1583
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1584
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1585
1585
  "license": "Apache-2.0 OR MIT"
1586
1586
  },
1587
1587
  "node_modules/@multiformats/multiaddr/node_modules/uint8-varint": {
@@ -1626,9 +1626,9 @@
1626
1626
  }
1627
1627
  },
1628
1628
  "node_modules/@multiformats/murmur3/node_modules/multiformats": {
1629
- "version": "14.0.3",
1630
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
1631
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
1629
+ "version": "14.0.4",
1630
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
1631
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
1632
1632
  "license": "Apache-2.0 OR MIT"
1633
1633
  },
1634
1634
  "node_modules/@multiformats/uri-to-multiaddr": {
@@ -3919,9 +3919,9 @@
3919
3919
  }
3920
3920
  },
3921
3921
  "node_modules/hamt-sharding/node_modules/multiformats": {
3922
- "version": "14.0.3",
3923
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
3924
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
3922
+ "version": "14.0.4",
3923
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
3924
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
3925
3925
  "license": "Apache-2.0 OR MIT"
3926
3926
  },
3927
3927
  "node_modules/hamt-sharding/node_modules/uint8arrays": {
@@ -4685,9 +4685,9 @@
4685
4685
  }
4686
4686
  },
4687
4687
  "node_modules/it-protobuf-stream/node_modules/multiformats": {
4688
- "version": "14.0.3",
4689
- "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.3.tgz",
4690
- "integrity": "sha512-l7FEUCJb3tx1UWeovywhaidQdOGQOOKTfl51G2y6CQbcOHe9dp3z90NHqQ3v2SKetKgkxwa3wI+2jsyJrjJjTg==",
4688
+ "version": "14.0.4",
4689
+ "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-14.0.4.tgz",
4690
+ "integrity": "sha512-+SXItmOUWzT0kjlIfkZ4NawJaC9jW/mPlyn902V9Qgpc7YDwdEiwqbiZxTyvC0XWh1jZguXca3A/WQ+UOPRLUA==",
4691
4691
  "license": "Apache-2.0 OR MIT"
4692
4692
  },
4693
4693
  "node_modules/it-protobuf-stream/node_modules/uint8arraylist": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.448",
3
+ "version": "1.0.449",
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",