omnius 1.0.347 → 1.0.348
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 +254 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -547778,9 +547778,9 @@ function _findNemotronScript() {
|
|
|
547778
547778
|
return null;
|
|
547779
547779
|
}
|
|
547780
547780
|
function _wordSimilarity(a2, b) {
|
|
547781
|
-
const
|
|
547782
|
-
const sa =
|
|
547783
|
-
const sb =
|
|
547781
|
+
const tokenize7 = (s2) => new Set(s2.toLowerCase().replace(/[^a-z0-9\s']/g, " ").split(/\s+/).filter(Boolean));
|
|
547782
|
+
const sa = tokenize7(a2);
|
|
547783
|
+
const sb = tokenize7(b);
|
|
547784
547784
|
if (sa.size === 0 && sb.size === 0)
|
|
547785
547785
|
return 1;
|
|
547786
547786
|
let inter = 0;
|
|
@@ -567686,6 +567686,164 @@ var init_evidenceBranch = __esm({
|
|
|
567686
567686
|
}
|
|
567687
567687
|
});
|
|
567688
567688
|
|
|
567689
|
+
// packages/orchestrator/dist/resolution-memory.js
|
|
567690
|
+
function tokenize6(command) {
|
|
567691
|
+
return command.replace(/[|&;]+/g, " ").split(/\s+/).map((t2) => t2.trim()).filter((t2) => t2.length > 0);
|
|
567692
|
+
}
|
|
567693
|
+
function normalizeErrorKey(error) {
|
|
567694
|
+
const e2 = error.toLowerCase();
|
|
567695
|
+
if (/command not found|not found|no such file|enoent/.test(e2))
|
|
567696
|
+
return "not found";
|
|
567697
|
+
if (/permission denied|eacces/.test(e2))
|
|
567698
|
+
return "permission denied";
|
|
567699
|
+
if (/unrecognized|unknown option|invalid option|no such option/.test(e2))
|
|
567700
|
+
return "bad option";
|
|
567701
|
+
if (/unexpected keyword|got an unexpected/.test(e2))
|
|
567702
|
+
return "bad argument";
|
|
567703
|
+
if (/syntax error|invalid syntax/.test(e2))
|
|
567704
|
+
return "syntax error";
|
|
567705
|
+
if (/module|importerror|modulenotfound/.test(e2))
|
|
567706
|
+
return "missing module";
|
|
567707
|
+
return e2.replace(/['"`].*?['"`]/g, "").replace(/\d+/g, "").replace(/\s+/g, " ").trim().split(" ").slice(0, 6).join(" ");
|
|
567708
|
+
}
|
|
567709
|
+
function isNearVariant(a2, b) {
|
|
567710
|
+
if (a2.length === 0 || b.length === 0)
|
|
567711
|
+
return false;
|
|
567712
|
+
const setA = new Set(a2);
|
|
567713
|
+
const setB = new Set(b);
|
|
567714
|
+
const shared = [...setA].filter((t2) => setB.has(t2));
|
|
567715
|
+
const sharedOperative = shared.some((t2) => t2.length >= 3 && !t2.startsWith("-"));
|
|
567716
|
+
if (!sharedOperative)
|
|
567717
|
+
return false;
|
|
567718
|
+
const onlyA = [...setA].filter((t2) => !setB.has(t2));
|
|
567719
|
+
const onlyB = [...setB].filter((t2) => !setA.has(t2));
|
|
567720
|
+
return onlyA.length > 0 && onlyA.length <= MAX_DELTA_TOKENS && onlyB.length <= MAX_DELTA_TOKENS;
|
|
567721
|
+
}
|
|
567722
|
+
function computeDelta(failed, worked) {
|
|
567723
|
+
const setF = new Set(failed);
|
|
567724
|
+
const setW = new Set(worked);
|
|
567725
|
+
const from3 = failed.filter((t2) => !setW.has(t2));
|
|
567726
|
+
const to = worked.filter((t2) => !setF.has(t2));
|
|
567727
|
+
if (from3.length === 0 || from3.length > MAX_DELTA_TOKENS || to.length > MAX_DELTA_TOKENS) {
|
|
567728
|
+
return null;
|
|
567729
|
+
}
|
|
567730
|
+
return { from: from3, to };
|
|
567731
|
+
}
|
|
567732
|
+
function sameFix(a2, from3, to, errorKey) {
|
|
567733
|
+
return a2.errorKey === errorKey && a2.from.join(" ") === from3.join(" ") && a2.to.join(" ") === to.join(" ");
|
|
567734
|
+
}
|
|
567735
|
+
var WINDOW_TURNS, MAX_DELTA_TOKENS, MAX_FIXES, ResolutionMemory;
|
|
567736
|
+
var init_resolution_memory = __esm({
|
|
567737
|
+
"packages/orchestrator/dist/resolution-memory.js"() {
|
|
567738
|
+
"use strict";
|
|
567739
|
+
WINDOW_TURNS = 6;
|
|
567740
|
+
MAX_DELTA_TOKENS = 3;
|
|
567741
|
+
MAX_FIXES = 200;
|
|
567742
|
+
ResolutionMemory = class {
|
|
567743
|
+
fixes = [];
|
|
567744
|
+
recentFailures = [];
|
|
567745
|
+
/** Load prior fixes (cross-session). */
|
|
567746
|
+
loadFixes(fixes) {
|
|
567747
|
+
for (const f2 of fixes) {
|
|
567748
|
+
if (Array.isArray(f2.from) && Array.isArray(f2.to) && f2.from.length > 0) {
|
|
567749
|
+
this.fixes.push(f2);
|
|
567750
|
+
}
|
|
567751
|
+
}
|
|
567752
|
+
this.fixes.sort((a2, b) => b.count - a2.count);
|
|
567753
|
+
if (this.fixes.length > MAX_FIXES)
|
|
567754
|
+
this.fixes = this.fixes.slice(0, MAX_FIXES);
|
|
567755
|
+
}
|
|
567756
|
+
exportFixes() {
|
|
567757
|
+
return this.fixes;
|
|
567758
|
+
}
|
|
567759
|
+
get size() {
|
|
567760
|
+
return this.fixes.length;
|
|
567761
|
+
}
|
|
567762
|
+
/** Record a failed command (buffered until a resolving success is seen). */
|
|
567763
|
+
recordFailure(input) {
|
|
567764
|
+
if (!input.command)
|
|
567765
|
+
return;
|
|
567766
|
+
this.recentFailures.push({
|
|
567767
|
+
tool: input.tool,
|
|
567768
|
+
command: input.command,
|
|
567769
|
+
tokens: tokenize6(input.command),
|
|
567770
|
+
errorKey: normalizeErrorKey(input.error || ""),
|
|
567771
|
+
turn: input.turn
|
|
567772
|
+
});
|
|
567773
|
+
this.recentFailures = this.recentFailures.filter((f2) => input.turn - f2.turn <= WINDOW_TURNS).slice(-12);
|
|
567774
|
+
}
|
|
567775
|
+
/**
|
|
567776
|
+
* Record a successful command. If it is a near-variant of a recent failure
|
|
567777
|
+
* of the same tool, learn the fix. Returns the learned fix, if any.
|
|
567778
|
+
*/
|
|
567779
|
+
recordSuccess(input) {
|
|
567780
|
+
if (!input.command)
|
|
567781
|
+
return null;
|
|
567782
|
+
const workedTokens = tokenize6(input.command);
|
|
567783
|
+
let learned = null;
|
|
567784
|
+
for (let i2 = this.recentFailures.length - 1; i2 >= 0; i2--) {
|
|
567785
|
+
const fail3 = this.recentFailures[i2];
|
|
567786
|
+
if (fail3.tool !== input.tool)
|
|
567787
|
+
continue;
|
|
567788
|
+
if (input.turn - fail3.turn > WINDOW_TURNS)
|
|
567789
|
+
continue;
|
|
567790
|
+
if (fail3.command === input.command)
|
|
567791
|
+
continue;
|
|
567792
|
+
if (!isNearVariant(fail3.tokens, workedTokens))
|
|
567793
|
+
continue;
|
|
567794
|
+
const delta = computeDelta(fail3.tokens, workedTokens);
|
|
567795
|
+
if (!delta)
|
|
567796
|
+
continue;
|
|
567797
|
+
const existing = this.fixes.find((f2) => sameFix(f2, delta.from, delta.to, fail3.errorKey));
|
|
567798
|
+
if (existing) {
|
|
567799
|
+
existing.count++;
|
|
567800
|
+
existing.lastSeen = Date.now();
|
|
567801
|
+
existing.example = { failed: fail3.command, worked: input.command };
|
|
567802
|
+
learned = existing;
|
|
567803
|
+
} else {
|
|
567804
|
+
learned = {
|
|
567805
|
+
from: delta.from,
|
|
567806
|
+
to: delta.to,
|
|
567807
|
+
errorKey: fail3.errorKey,
|
|
567808
|
+
example: { failed: fail3.command, worked: input.command },
|
|
567809
|
+
count: 1,
|
|
567810
|
+
lastSeen: Date.now()
|
|
567811
|
+
};
|
|
567812
|
+
this.fixes.push(learned);
|
|
567813
|
+
}
|
|
567814
|
+
this.recentFailures.splice(i2, 1);
|
|
567815
|
+
break;
|
|
567816
|
+
}
|
|
567817
|
+
if (this.fixes.length > MAX_FIXES) {
|
|
567818
|
+
this.fixes.sort((a2, b) => b.count - a2.count);
|
|
567819
|
+
this.fixes = this.fixes.slice(0, MAX_FIXES);
|
|
567820
|
+
}
|
|
567821
|
+
return learned;
|
|
567822
|
+
}
|
|
567823
|
+
/**
|
|
567824
|
+
* Suggest a learned fix for a command about to run, or null. Matches when the
|
|
567825
|
+
* command contains the fix's `from` token sequence.
|
|
567826
|
+
*/
|
|
567827
|
+
suggest(command) {
|
|
567828
|
+
if (!command)
|
|
567829
|
+
return null;
|
|
567830
|
+
const tokens = new Set(tokenize6(command));
|
|
567831
|
+
let best = null;
|
|
567832
|
+
for (const f2 of this.fixes) {
|
|
567833
|
+
if (f2.from.every((t2) => tokens.has(t2))) {
|
|
567834
|
+
if (!best || f2.count > best.count)
|
|
567835
|
+
best = f2;
|
|
567836
|
+
}
|
|
567837
|
+
}
|
|
567838
|
+
if (!best)
|
|
567839
|
+
return null;
|
|
567840
|
+
const message2 = `[LEARNED FIX — from a prior session] A command using \`${best.from.join(" ")}\` failed with "${best.errorKey}"; the working form replaced it with \`${best.to.join(" ")}\` (confirmed ${best.count}× — e.g. \`${best.example.worked}\`). Apply that change here before running, instead of re-discovering it.`;
|
|
567841
|
+
return { fix: best, message: message2 };
|
|
567842
|
+
}
|
|
567843
|
+
};
|
|
567844
|
+
}
|
|
567845
|
+
});
|
|
567846
|
+
|
|
567689
567847
|
// packages/orchestrator/dist/contextEngine.js
|
|
567690
567848
|
function estimateTokens3(messages2) {
|
|
567691
567849
|
const chars = messages2.reduce((sum, message2) => sum + message2.content.length + message2.role.length + (message2.name?.length ?? 0), 0);
|
|
@@ -569449,6 +569607,7 @@ var init_agenticRunner = __esm({
|
|
|
569449
569607
|
init_evidenceLedger();
|
|
569450
569608
|
init_adversaryStream();
|
|
569451
569609
|
init_evidenceBranch();
|
|
569610
|
+
init_resolution_memory();
|
|
569452
569611
|
init_contextEngine();
|
|
569453
569612
|
init_prompt_cache();
|
|
569454
569613
|
TOOL_SUBSETS = {
|
|
@@ -569950,6 +570109,12 @@ var init_agenticRunner = __esm({
|
|
|
569950
570109
|
// adjacent to the main loop. Initialized per run when the step critic is
|
|
569951
570110
|
// enabled and a backend is available. See adversaryStream.ts.
|
|
569952
570111
|
_adversaryStream = null;
|
|
570112
|
+
// Generic, cross-session failure→resolution learning: learns the token-level
|
|
570113
|
+
// change that turned a failed command into a working one (e.g. python→python3)
|
|
570114
|
+
// from observed pairs, and surfaces it before a matching command runs — so
|
|
570115
|
+
// the loop stops re-discovering the same fix every session. See
|
|
570116
|
+
// resolution-memory.ts. Persisted to ~/.omnius/resolution-memory.json.
|
|
570117
|
+
_resolutionMemory = new ResolutionMemory();
|
|
569953
570118
|
_lastContextFrameDiagnostics = null;
|
|
569954
570119
|
_lastContextPressureSnapshot = null;
|
|
569955
570120
|
_lastActiveForgettingReport = null;
|
|
@@ -570673,6 +570838,46 @@ Your hypotheses MUST address this specific error, not generic causes.
|
|
|
570673
570838
|
}
|
|
570674
570839
|
};
|
|
570675
570840
|
}
|
|
570841
|
+
/** Cross-session resolution-memory stores: global (machine-wide) + local. */
|
|
570842
|
+
_resolutionMemoryPaths() {
|
|
570843
|
+
const global2 = _pathJoin(_osHomedir(), ".omnius", "resolution-memory.json");
|
|
570844
|
+
const local = _pathJoin(this.omniusStateDir(), "resolution-memory.json");
|
|
570845
|
+
return [global2, local];
|
|
570846
|
+
}
|
|
570847
|
+
_loadResolutionMemory() {
|
|
570848
|
+
const seen = /* @__PURE__ */ new Set();
|
|
570849
|
+
const merged = [];
|
|
570850
|
+
for (const p2 of this._resolutionMemoryPaths()) {
|
|
570851
|
+
try {
|
|
570852
|
+
if (!_fsExistsSync(p2))
|
|
570853
|
+
continue;
|
|
570854
|
+
const data = JSON.parse(_fsReadFileSync(p2, "utf-8"));
|
|
570855
|
+
const arr = Array.isArray(data) ? data : Array.isArray(data?.fixes) ? data.fixes : [];
|
|
570856
|
+
for (const f2 of arr) {
|
|
570857
|
+
const key = `${(f2.from ?? []).join(" ")}=>${(f2.to ?? []).join(" ")}|${f2.errorKey ?? ""}`;
|
|
570858
|
+
if (seen.has(key))
|
|
570859
|
+
continue;
|
|
570860
|
+
seen.add(key);
|
|
570861
|
+
merged.push(f2);
|
|
570862
|
+
}
|
|
570863
|
+
} catch {
|
|
570864
|
+
}
|
|
570865
|
+
}
|
|
570866
|
+
if (merged.length > 0)
|
|
570867
|
+
this._resolutionMemory.loadFixes(merged);
|
|
570868
|
+
}
|
|
570869
|
+
_persistResolutionMemory() {
|
|
570870
|
+
const fixes = this._resolutionMemory.exportFixes();
|
|
570871
|
+
if (fixes.length === 0)
|
|
570872
|
+
return;
|
|
570873
|
+
for (const p2 of this._resolutionMemoryPaths()) {
|
|
570874
|
+
try {
|
|
570875
|
+
_fsMkdirSync(_pathJoin(p2, ".."), { recursive: true });
|
|
570876
|
+
_fsWriteFileSync(p2, JSON.stringify(fixes, null, 2), { mode: 384 });
|
|
570877
|
+
} catch {
|
|
570878
|
+
}
|
|
570879
|
+
}
|
|
570880
|
+
}
|
|
570676
570881
|
/**
|
|
570677
570882
|
* Detect a failing approach and return a decisive root-cause directive, or
|
|
570678
570883
|
* null. Fires when a non-transient error recurs ≥3× in the recent window
|
|
@@ -574799,6 +575004,7 @@ Respond with your assessment, then take action.`;
|
|
|
574799
575004
|
}
|
|
574800
575005
|
} catch {
|
|
574801
575006
|
}
|
|
575007
|
+
this._loadResolutionMemory();
|
|
574802
575008
|
this._pauseResolve = null;
|
|
574803
575009
|
this.pendingUserMessages.length = 0;
|
|
574804
575010
|
this._taskState = {
|
|
@@ -577374,6 +577580,23 @@ Root cause hypothesis: the argument family may be wrong, a prerequisite may be m
|
|
|
577374
577580
|
Corrective action: try a different approach first: read relevant files, adjust arguments, or verify prerequisites.`);
|
|
577375
577581
|
}
|
|
577376
577582
|
}
|
|
577583
|
+
if (tc.name === "shell") {
|
|
577584
|
+
const _cmd = typeof tc.arguments?.["command"] === "string" ? tc.arguments["command"] : typeof tc.arguments?.["cmd"] === "string" ? tc.arguments["cmd"] : "";
|
|
577585
|
+
const _sug = _cmd ? this._resolutionMemory.suggest(_cmd) : null;
|
|
577586
|
+
if (_sug) {
|
|
577587
|
+
const _injKey = `resfix:${_sug.fix.from.join(" ")}=>${_sug.fix.to.join(" ")}`;
|
|
577588
|
+
if (!this._errorGuidanceInjected.has(_injKey)) {
|
|
577589
|
+
this._errorGuidanceInjected.add(_injKey);
|
|
577590
|
+
this.pendingUserMessages.push(_sug.message);
|
|
577591
|
+
this.emit({
|
|
577592
|
+
type: "status",
|
|
577593
|
+
content: `Resolution memory: suggested \`${_sug.fix.from.join(" ")}\`→\`${_sug.fix.to.join(" ")}\` before shell call`,
|
|
577594
|
+
turn,
|
|
577595
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
577596
|
+
});
|
|
577597
|
+
}
|
|
577598
|
+
}
|
|
577599
|
+
}
|
|
577377
577600
|
if (this._errorPatterns.size > 0) {
|
|
577378
577601
|
for (const [sig, pattern] of this._errorPatterns) {
|
|
577379
577602
|
if (pattern.tool === tc.name && pattern.count >= 2 && !this._errorGuidanceInjected.has(sig)) {
|
|
@@ -578480,6 +578703,34 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
578480
578703
|
} catch {
|
|
578481
578704
|
}
|
|
578482
578705
|
}
|
|
578706
|
+
{
|
|
578707
|
+
const _cmd = typeof tc.arguments?.["command"] === "string" ? tc.arguments["command"] : typeof tc.arguments?.["cmd"] === "string" ? tc.arguments["cmd"] : "";
|
|
578708
|
+
if (_cmd && tc.name === "shell") {
|
|
578709
|
+
if (!result.success) {
|
|
578710
|
+
this._resolutionMemory.recordFailure({
|
|
578711
|
+
tool: tc.name,
|
|
578712
|
+
command: _cmd,
|
|
578713
|
+
error: result.error ?? result.output ?? "",
|
|
578714
|
+
turn
|
|
578715
|
+
});
|
|
578716
|
+
} else {
|
|
578717
|
+
const _learned = this._resolutionMemory.recordSuccess({
|
|
578718
|
+
tool: tc.name,
|
|
578719
|
+
command: _cmd,
|
|
578720
|
+
turn
|
|
578721
|
+
});
|
|
578722
|
+
if (_learned) {
|
|
578723
|
+
this._persistResolutionMemory();
|
|
578724
|
+
this.emit({
|
|
578725
|
+
type: "status",
|
|
578726
|
+
content: `Learned fix: \`${_learned.from.join(" ")}\` → \`${_learned.to.join(" ")}\` (after "${_learned.errorKey}") — saved for future sessions`,
|
|
578727
|
+
turn,
|
|
578728
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
578729
|
+
});
|
|
578730
|
+
}
|
|
578731
|
+
}
|
|
578732
|
+
}
|
|
578733
|
+
}
|
|
578483
578734
|
if (!result.success && result.error) {
|
|
578484
578735
|
const errorText = result.error;
|
|
578485
578736
|
let errorType = "unknown";
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.348",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.348",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED