omnius 1.0.477 → 1.0.478
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 +338 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26393,6 +26393,116 @@ var init_compaction_policy = __esm({
|
|
|
26393
26393
|
}
|
|
26394
26394
|
});
|
|
26395
26395
|
|
|
26396
|
+
// packages/memory/dist/evidence-retirement.js
|
|
26397
|
+
function extractDiagnosticSymbols(text2) {
|
|
26398
|
+
const symbols = /* @__PURE__ */ new Set();
|
|
26399
|
+
let count = 0;
|
|
26400
|
+
for (const line of text2.split("\n")) {
|
|
26401
|
+
if (!DIAG_LINE.test(line))
|
|
26402
|
+
continue;
|
|
26403
|
+
count += 1;
|
|
26404
|
+
let m2;
|
|
26405
|
+
QUOTED_SYMBOL.lastIndex = 0;
|
|
26406
|
+
while ((m2 = QUOTED_SYMBOL.exec(line)) !== null) {
|
|
26407
|
+
if (/^[A-Za-z_]/.test(m2[1]) && !m2[1].includes("/"))
|
|
26408
|
+
symbols.add(m2[1]);
|
|
26409
|
+
if (symbols.size >= 12)
|
|
26410
|
+
break;
|
|
26411
|
+
}
|
|
26412
|
+
}
|
|
26413
|
+
return { count, symbols: [...symbols] };
|
|
26414
|
+
}
|
|
26415
|
+
function isRetirableEvidence(message2, minChars) {
|
|
26416
|
+
if (message2.pinned)
|
|
26417
|
+
return false;
|
|
26418
|
+
if (typeof message2.content !== "string")
|
|
26419
|
+
return false;
|
|
26420
|
+
if (message2.content.length < minChars)
|
|
26421
|
+
return false;
|
|
26422
|
+
if (message2.role === "tool")
|
|
26423
|
+
return true;
|
|
26424
|
+
if (message2.role !== "system")
|
|
26425
|
+
return false;
|
|
26426
|
+
return EVIDENCE_MARKERS.some((m2) => message2.content.includes(m2));
|
|
26427
|
+
}
|
|
26428
|
+
function foldEvidenceOutcome(message2) {
|
|
26429
|
+
const text2 = message2.content;
|
|
26430
|
+
const diag = extractDiagnosticSymbols(text2);
|
|
26431
|
+
if (diag.count > 0) {
|
|
26432
|
+
const syms = diag.symbols.slice(0, 6);
|
|
26433
|
+
const exit = /exit_code:\s*(\d+)|Exit code (\d+)/.exec(text2);
|
|
26434
|
+
const code8 = exit ? exit[1] ?? exit[2] : void 0;
|
|
26435
|
+
return `${diag.count} diagnostic(s)${code8 ? ` (exit ${code8})` : ""}${syms.length ? `: ${syms.join(", ")}` : ""}`;
|
|
26436
|
+
}
|
|
26437
|
+
const fileHdr = /\[FILE CONTEXT[^\]]*\]/.exec(text2);
|
|
26438
|
+
if (fileHdr)
|
|
26439
|
+
return fileHdr[0].replace(/^\[|\]$/g, "").trim();
|
|
26440
|
+
if (text2.includes("[SHELL TRANSCRIPT]")) {
|
|
26441
|
+
const cmd = /command:\s*([^\n]+)/.exec(text2);
|
|
26442
|
+
const exit = /exit_code:\s*(\d+)|Exit code (\d+)/.exec(text2);
|
|
26443
|
+
const err = /(^|\n)\s*([^\n]*\berror\b[^\n]*)/i.exec(text2);
|
|
26444
|
+
const parts = [
|
|
26445
|
+
cmd ? `cmd: ${cmd[1].trim().slice(0, 80)}` : "",
|
|
26446
|
+
exit ? `exit ${exit[1] ?? exit[2]}` : "",
|
|
26447
|
+
err ? err[2].trim().slice(0, 100) : ""
|
|
26448
|
+
].filter(Boolean);
|
|
26449
|
+
if (parts.length)
|
|
26450
|
+
return parts.join("; ");
|
|
26451
|
+
}
|
|
26452
|
+
const firstLine = text2.split("\n").map((l2) => l2.trim()).find((l2) => l2.length > 0 && !EVIDENCE_MARKERS.some((m2) => l2.startsWith(m2)));
|
|
26453
|
+
return (firstLine ?? "evidence").slice(0, 120);
|
|
26454
|
+
}
|
|
26455
|
+
function retirementStub(message2, outcome, originalChars) {
|
|
26456
|
+
const ref = message2.diskRef ? ` ref=${message2.diskRef}` : "";
|
|
26457
|
+
const tool = message2.toolName ? ` tool=${message2.toolName}` : "";
|
|
26458
|
+
const turn = typeof message2.turn === "number" ? ` turn=${message2.turn}` : "";
|
|
26459
|
+
return `[RETIRED EVIDENCE${tool}${turn} bytes=${originalChars}${ref}] outcome: ${outcome}
|
|
26460
|
+
(full evidence retired to disk — re-read the file or re-run the command to re-materialise if you need the detail)`;
|
|
26461
|
+
}
|
|
26462
|
+
function retireStaleEvidence(messages2, options2) {
|
|
26463
|
+
const keepRecentTurns = Math.max(0, options2.keepRecentTurns ?? 2);
|
|
26464
|
+
const minChars = Math.max(256, options2.minChars ?? 2e3);
|
|
26465
|
+
const summarize2 = options2.summarize ?? foldEvidenceOutcome;
|
|
26466
|
+
const staleBefore = options2.currentTurn - keepRecentTurns;
|
|
26467
|
+
let retiredCount = 0;
|
|
26468
|
+
let reclaimedChars = 0;
|
|
26469
|
+
const out = messages2.map((message2) => {
|
|
26470
|
+
if (typeof message2.turn !== "number" || message2.turn > staleBefore) {
|
|
26471
|
+
return message2;
|
|
26472
|
+
}
|
|
26473
|
+
if (!isRetirableEvidence(message2, minChars))
|
|
26474
|
+
return message2;
|
|
26475
|
+
const originalChars = message2.content.length;
|
|
26476
|
+
let outcome;
|
|
26477
|
+
try {
|
|
26478
|
+
outcome = summarize2(message2);
|
|
26479
|
+
} catch {
|
|
26480
|
+
outcome = "evidence";
|
|
26481
|
+
}
|
|
26482
|
+
const stub = retirementStub(message2, outcome, originalChars);
|
|
26483
|
+
if (stub.length >= originalChars)
|
|
26484
|
+
return message2;
|
|
26485
|
+
retiredCount += 1;
|
|
26486
|
+
reclaimedChars += originalChars - stub.length;
|
|
26487
|
+
return { ...message2, content: stub };
|
|
26488
|
+
});
|
|
26489
|
+
return { messages: out, retiredCount, reclaimedChars };
|
|
26490
|
+
}
|
|
26491
|
+
var DIAG_LINE, QUOTED_SYMBOL, EVIDENCE_MARKERS;
|
|
26492
|
+
var init_evidence_retirement = __esm({
|
|
26493
|
+
"packages/memory/dist/evidence-retirement.js"() {
|
|
26494
|
+
"use strict";
|
|
26495
|
+
DIAG_LINE = /\berror\b\s*:/i;
|
|
26496
|
+
QUOTED_SYMBOL = /['"`]([A-Za-z_][A-Za-z0-9_:.<>]{1,80})['"`]/g;
|
|
26497
|
+
EVIDENCE_MARKERS = [
|
|
26498
|
+
"[SHELL TRANSCRIPT]",
|
|
26499
|
+
"[FILE CONTEXT",
|
|
26500
|
+
"[RUN EVIDENCE]",
|
|
26501
|
+
"[TOOL RESULT]"
|
|
26502
|
+
];
|
|
26503
|
+
}
|
|
26504
|
+
});
|
|
26505
|
+
|
|
26396
26506
|
// packages/memory/dist/index.js
|
|
26397
26507
|
var dist_exports = {};
|
|
26398
26508
|
__export(dist_exports, {
|
|
@@ -26494,6 +26604,7 @@ __export(dist_exports, {
|
|
|
26494
26604
|
extractTrace: () => extractTrace,
|
|
26495
26605
|
findNeighbors: () => findNeighbors,
|
|
26496
26606
|
fingerprintSignature: () => fingerprintSignature,
|
|
26607
|
+
foldEvidenceOutcome: () => foldEvidenceOutcome,
|
|
26497
26608
|
freshNodeId: () => freshNodeId,
|
|
26498
26609
|
generateEmbedding: () => generateEmbedding,
|
|
26499
26610
|
generateEmbeddingBatch: () => generateEmbeddingBatch,
|
|
@@ -26503,6 +26614,7 @@ __export(dist_exports, {
|
|
|
26503
26614
|
inferDomainFromEpisode: () => inferDomainFromEpisode,
|
|
26504
26615
|
ingestContextFeedbackMarkdown: () => ingestContextFeedbackMarkdown,
|
|
26505
26616
|
initDb: () => initDb,
|
|
26617
|
+
isRetirableEvidence: () => isRetirableEvidence,
|
|
26506
26618
|
isSessionGist: () => isSessionGist,
|
|
26507
26619
|
lightSleep: () => lightSleep,
|
|
26508
26620
|
linkEpisode: () => linkEpisode,
|
|
@@ -26525,6 +26637,7 @@ __export(dist_exports, {
|
|
|
26525
26637
|
reinforceGraphNodes: () => reinforceGraphNodes,
|
|
26526
26638
|
remDream: () => remDream,
|
|
26527
26639
|
resetCRLConfigStore: () => resetCRLConfigStore,
|
|
26640
|
+
retireStaleEvidence: () => retireStaleEvidence,
|
|
26528
26641
|
retrieveByPPR: () => retrieveByPPR,
|
|
26529
26642
|
runConsolidationCycle: () => runConsolidationCycle,
|
|
26530
26643
|
runMemoryMaintenance: () => runMemoryMaintenance,
|
|
@@ -26609,6 +26722,7 @@ var init_dist = __esm({
|
|
|
26609
26722
|
init_attention_select();
|
|
26610
26723
|
init_context_folding();
|
|
26611
26724
|
init_compaction_policy();
|
|
26725
|
+
init_evidence_retirement();
|
|
26612
26726
|
}
|
|
26613
26727
|
});
|
|
26614
26728
|
|
|
@@ -577058,6 +577172,93 @@ var init_spec_gate = __esm({
|
|
|
577058
577172
|
}
|
|
577059
577173
|
});
|
|
577060
577174
|
|
|
577175
|
+
// packages/orchestrator/dist/decomposition-orchestrator.js
|
|
577176
|
+
function decomposeToUnits(modules, contract, symbolSources = /* @__PURE__ */ new Map(), options2 = {}) {
|
|
577177
|
+
const maxUnits = Math.max(1, options2.maxUnits ?? 200);
|
|
577178
|
+
const units = [];
|
|
577179
|
+
const symbolsByPath = /* @__PURE__ */ new Map();
|
|
577180
|
+
for (const spec of contract.symbols) {
|
|
577181
|
+
const src2 = symbolSources.get(spec.name);
|
|
577182
|
+
if (!src2)
|
|
577183
|
+
continue;
|
|
577184
|
+
const arr = symbolsByPath.get(src2) ?? [];
|
|
577185
|
+
arr.push(spec);
|
|
577186
|
+
symbolsByPath.set(src2, arr);
|
|
577187
|
+
}
|
|
577188
|
+
let i2 = 0;
|
|
577189
|
+
for (const m2 of modules) {
|
|
577190
|
+
if (units.length >= maxUnits)
|
|
577191
|
+
break;
|
|
577192
|
+
const fileId = `unit-file-${++i2}`;
|
|
577193
|
+
const symbols = symbolsByPath.get(m2.path) ?? [];
|
|
577194
|
+
units.push({
|
|
577195
|
+
id: fileId,
|
|
577196
|
+
path: m2.path,
|
|
577197
|
+
content: `Implement ${m2.path} (delegate via sub_agent for isolated context)`,
|
|
577198
|
+
status: "pending",
|
|
577199
|
+
exitCriterion: symbols.length > 0 ? `${m2.path} compiles AND declares ${symbols.map((s2) => s2.name).join(", ")} matching the locked contract` : `${m2.path} compiles cleanly`
|
|
577200
|
+
});
|
|
577201
|
+
let j = 0;
|
|
577202
|
+
for (const s2 of symbols) {
|
|
577203
|
+
if (units.length >= maxUnits)
|
|
577204
|
+
break;
|
|
577205
|
+
units.push({
|
|
577206
|
+
id: `${fileId}-sym-${++j}`,
|
|
577207
|
+
parentId: fileId,
|
|
577208
|
+
path: m2.path,
|
|
577209
|
+
symbol: s2.name,
|
|
577210
|
+
content: `Declare ${s2.kind} ${s2.name} in ${m2.path} to match the locked contract`,
|
|
577211
|
+
status: "pending",
|
|
577212
|
+
exitCriterion: `${s2.name} declared exactly once with the contract shape; ${m2.path} compiles`
|
|
577213
|
+
});
|
|
577214
|
+
}
|
|
577215
|
+
}
|
|
577216
|
+
return units;
|
|
577217
|
+
}
|
|
577218
|
+
function evaluateUnitResult(input) {
|
|
577219
|
+
const expectedSymbols = input.unit.symbol ? [input.unit.symbol] : input.contract.symbols.filter((s2) => true).map((s2) => s2.name).filter((name10) => input.emittedSource.includes(name10));
|
|
577220
|
+
const spec = evaluateSpecGate({ path: input.unit.path, source: input.emittedSource }, input.contract, { expectedSymbols });
|
|
577221
|
+
const diagnostics = parseCompilerDiagnostics(String(input.buildOutput || ""));
|
|
577222
|
+
const structural = diagnostics.filter((d2) => d2.kind === "signature_mismatch" || d2.kind === "duplicate_definition" || d2.kind === "unknown_member" || d2.kind === "unknown_symbol" || d2.kind === "type_error");
|
|
577223
|
+
if (spec.pass && structural.length === 0) {
|
|
577224
|
+
const label = input.unit.symbol ?? input.unit.path;
|
|
577225
|
+
return {
|
|
577226
|
+
decision: "accept",
|
|
577227
|
+
foldSummary: `${label}: verified (declares ${expectedSymbols.join(", ") || "unit"}, compiles clean)`,
|
|
577228
|
+
violations: [],
|
|
577229
|
+
diagnosticsCount: 0
|
|
577230
|
+
};
|
|
577231
|
+
}
|
|
577232
|
+
const reasons = [];
|
|
577233
|
+
if (!spec.pass)
|
|
577234
|
+
reasons.push(spec.summary);
|
|
577235
|
+
if (structural.length > 0) {
|
|
577236
|
+
const syms = [...new Set(structural.map((d2) => d2.symbol).filter(Boolean))];
|
|
577237
|
+
reasons.push(`${structural.length} compiler diagnostic(s)${syms.length ? ` on ${syms.slice(0, 4).join(", ")}` : ""}`);
|
|
577238
|
+
}
|
|
577239
|
+
return {
|
|
577240
|
+
decision: "reject_regenerate",
|
|
577241
|
+
rejectReason: `Unit ${input.unit.path}${input.unit.symbol ? ` (${input.unit.symbol})` : ""} does not verify — regenerate against the locked contract: ${reasons.join("; ")}`,
|
|
577242
|
+
violations: spec.violations,
|
|
577243
|
+
diagnosticsCount: structural.length
|
|
577244
|
+
};
|
|
577245
|
+
}
|
|
577246
|
+
function buildUnitTodos(units) {
|
|
577247
|
+
return units.map((u) => ({
|
|
577248
|
+
id: u.id,
|
|
577249
|
+
content: u.content,
|
|
577250
|
+
status: u.status,
|
|
577251
|
+
...u.parentId ? { parentId: u.parentId } : {}
|
|
577252
|
+
}));
|
|
577253
|
+
}
|
|
577254
|
+
var init_decomposition_orchestrator = __esm({
|
|
577255
|
+
"packages/orchestrator/dist/decomposition-orchestrator.js"() {
|
|
577256
|
+
"use strict";
|
|
577257
|
+
init_spec_gate();
|
|
577258
|
+
init_dist5();
|
|
577259
|
+
}
|
|
577260
|
+
});
|
|
577261
|
+
|
|
577061
577262
|
// packages/orchestrator/dist/longhaul-integration.js
|
|
577062
577263
|
import fs6 from "node:fs";
|
|
577063
577264
|
import path7 from "node:path";
|
|
@@ -577110,6 +577311,7 @@ var init_longhaul_integration = __esm({
|
|
|
577110
577311
|
init_convergence_breaker();
|
|
577111
577312
|
init_coherence_gate();
|
|
577112
577313
|
init_spec_gate();
|
|
577314
|
+
init_decomposition_orchestrator();
|
|
577113
577315
|
init_dist5();
|
|
577114
577316
|
init_dist();
|
|
577115
577317
|
init_dist();
|
|
@@ -577166,6 +577368,8 @@ var init_longhaul_integration = __esm({
|
|
|
577166
577368
|
* breaker's "regenerate from the locked contract" guidance a real target.
|
|
577167
577369
|
*/
|
|
577168
577370
|
locked = /* @__PURE__ */ new Map();
|
|
577371
|
+
/** WO-11: provenance — which file each locked symbol was declared in. */
|
|
577372
|
+
lockedSource = /* @__PURE__ */ new Map();
|
|
577169
577373
|
constructor(options2) {
|
|
577170
577374
|
this.convergenceBreaker = new ConvergenceBreaker({
|
|
577171
577375
|
...options2.convergence,
|
|
@@ -577233,8 +577437,10 @@ var init_longhaul_integration = __esm({
|
|
|
577233
577437
|
if (verdict.regime === "regenerate")
|
|
577234
577438
|
return this.locked.size;
|
|
577235
577439
|
for (const s2 of extractSymbols3(input.content, lang)) {
|
|
577236
|
-
if (!this.locked.has(s2.name))
|
|
577440
|
+
if (!this.locked.has(s2.name)) {
|
|
577237
577441
|
this.locked.set(s2.name, s2);
|
|
577442
|
+
this.lockedSource.set(s2.name, input.path);
|
|
577443
|
+
}
|
|
577238
577444
|
}
|
|
577239
577445
|
return this.locked.size;
|
|
577240
577446
|
} catch {
|
|
@@ -577245,6 +577451,39 @@ var init_longhaul_integration = __esm({
|
|
|
577245
577451
|
lockedContract() {
|
|
577246
577452
|
return { symbols: [...this.locked.values()] };
|
|
577247
577453
|
}
|
|
577454
|
+
/** WO-11: map of locked symbol name → declaring file (for per-symbol units). */
|
|
577455
|
+
symbolSources() {
|
|
577456
|
+
return new Map(this.lockedSource);
|
|
577457
|
+
}
|
|
577458
|
+
/**
|
|
577459
|
+
* WO-11: extreme-granularity unit todo TREE for the TUI expanded-list mirror.
|
|
577460
|
+
* When the locked contract has symbols, each file expands into per-symbol
|
|
577461
|
+
* children; otherwise it degrades to the existing per-file granularity (safe
|
|
577462
|
+
* drop-in). Enriches as the contract fills across the run.
|
|
577463
|
+
*/
|
|
577464
|
+
unitTreeTodos(modules) {
|
|
577465
|
+
try {
|
|
577466
|
+
const units = decomposeToUnits(modules, this.lockedContract(), this.symbolSources());
|
|
577467
|
+
return buildUnitTodos(units);
|
|
577468
|
+
} catch {
|
|
577469
|
+
return modules.map((m2, i2) => ({
|
|
577470
|
+
id: `unit-file-${i2 + 1}`,
|
|
577471
|
+
content: `Implement ${m2.path}`,
|
|
577472
|
+
status: "pending"
|
|
577473
|
+
}));
|
|
577474
|
+
}
|
|
577475
|
+
}
|
|
577476
|
+
/** WO-11: whether the contract is rich enough to expand into symbol children. */
|
|
577477
|
+
hasSymbolGranularity() {
|
|
577478
|
+
return this.lockedSource.size > 0;
|
|
577479
|
+
}
|
|
577480
|
+
/**
|
|
577481
|
+
* WO-11: compile-verify-FOLD gate for a delegated unit's result. Accept only
|
|
577482
|
+
* when it matches the contract AND compiles; else return the regenerate reason.
|
|
577483
|
+
*/
|
|
577484
|
+
evaluateUnit(input) {
|
|
577485
|
+
return evaluateUnitResult({ ...input, contract: this.lockedContract() });
|
|
577486
|
+
}
|
|
577248
577487
|
/**
|
|
577249
577488
|
* WO-6: gate an emitted boundary unit against the locked contract. Returns
|
|
577250
577489
|
* guidance naming symbols that diverge from (or duplicate) a locked shape, so
|
|
@@ -580759,6 +580998,8 @@ var init_agenticRunner = __esm({
|
|
|
580759
580998
|
/** WO-1..WO-8 long-haul integration bundle (convergence, adaptive-edit,
|
|
580760
580999
|
* coherence, folding). Constructed at run setup alongside the supervisor. */
|
|
580761
581000
|
_longHaul = null;
|
|
581001
|
+
/** WO-11: decomposition modules (files) stashed for contract-enriched todo trees. */
|
|
581002
|
+
_decompModules = [];
|
|
580762
581003
|
_focusTerminalLedgerRecorded = false;
|
|
580763
581004
|
// Generic, cross-session failure→resolution learning: learns the token-level
|
|
580764
581005
|
// change that turned a failed command into a working one (e.g. python→python3)
|
|
@@ -587819,7 +588060,23 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
587819
588060
|
if (_decomp.modules.length > 0) {
|
|
587820
588061
|
const _directive = buildDecompositionDirective(_decomp.modules, _decomp.strategy);
|
|
587821
588062
|
messages2.push({ role: "system", content: _directive });
|
|
587822
|
-
|
|
588063
|
+
this._decompModules = _decomp.modules;
|
|
588064
|
+
if (this._longHaul) {
|
|
588065
|
+
const _wd = this.authoritativeWorkingDirectory();
|
|
588066
|
+
for (const _m of _decomp.modules) {
|
|
588067
|
+
try {
|
|
588068
|
+
const _abs = _pathResolve(_wd, _m.path);
|
|
588069
|
+
if (_fsExistsSync(_abs)) {
|
|
588070
|
+
this._longHaul.maybeLockContract({
|
|
588071
|
+
path: _m.path,
|
|
588072
|
+
content: _fsReadFileSync(_abs, "utf-8")
|
|
588073
|
+
});
|
|
588074
|
+
}
|
|
588075
|
+
} catch {
|
|
588076
|
+
}
|
|
588077
|
+
}
|
|
588078
|
+
}
|
|
588079
|
+
const _todos = this._longHaul && this._longHaul.hasSymbolGranularity() ? this._longHaul.unitTreeTodos(_decomp.modules) : buildDecompositionTodos(_decomp.modules);
|
|
587823
588080
|
try {
|
|
587824
588081
|
const sid = this._sessionId || process.env["OMNIUS_SESSION_ID"] || "default";
|
|
587825
588082
|
const safe = sid.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
@@ -589681,6 +589938,7 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
589681
589938
|
messages2.push(...compacted);
|
|
589682
589939
|
compacted = messages2;
|
|
589683
589940
|
}
|
|
589941
|
+
this._retireStaleEvidenceInPlace(messages2, turn);
|
|
589684
589942
|
if (turn > 0 && this._toolEvents.length > 0) {
|
|
589685
589943
|
try {
|
|
589686
589944
|
const _limits = this.contextLimits();
|
|
@@ -596496,6 +596754,80 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
596496
596754
|
* Replaces both assistant messages AND their associated tool-result
|
|
596497
596755
|
* messages in the turn range [startTurn, currentTurn].
|
|
596498
596756
|
*/
|
|
596757
|
+
/**
|
|
596758
|
+
* Staleness-based evidence retirement (WO-4 realized; operator's microcompaction
|
|
596759
|
+
* goal). The sibling `_evictCompletedTodoMessages` only fires when a todo
|
|
596760
|
+
* COMPLETES and — critically — SKIPS `system` messages. But the live
|
|
596761
|
+
* `myactuator` frame (turn 11) was dominated by a ~77 KB `system`
|
|
596762
|
+
* `[SHELL TRANSCRIPT]` pinned from turn 3: a stuck debug loop completes no
|
|
596763
|
+
* todos, so nothing retired it, and system-role evidence is exempt from the
|
|
596764
|
+
* todo evictor anyway.
|
|
596765
|
+
*
|
|
596766
|
+
* This pass fills that gap: it retires STALE, LARGE evidence bodies (tool
|
|
596767
|
+
* results and marker-gated `system` evidence blocks — `[SHELL TRANSCRIPT]`,
|
|
596768
|
+
* `[FILE CONTEXT`, `[RUN EVIDENCE]`) to a one-line world-state stub, keeping
|
|
596769
|
+
* the OUTCOME resident and moving the bytes out. It mirrors the evictor's safe
|
|
596770
|
+
* in-place, same-length-array style (no index shifting) and reuses the pure,
|
|
596771
|
+
* unit-tested `isRetirableEvidence` / `foldEvidenceOutcome` from @omnius/memory
|
|
596772
|
+
* for the decision — so directives, plans, the completion contract, ordinary
|
|
596773
|
+
* reasoning, and the base prompt are never touched (they carry no evidence
|
|
596774
|
+
* marker). Marker-gating is what makes touching `system` messages safe here.
|
|
596775
|
+
*
|
|
596776
|
+
* OPT-IN (`OMNIUS_EVIDENCE_RETIREMENT=1`) so it cannot perturb a live run until
|
|
596777
|
+
* the operator flips it on and validates — matching the runtime-harness
|
|
596778
|
+
* discipline we hold for anything that reshapes the model-visible frame. The
|
|
596779
|
+
* canonical message history is unaffected structurally (same length); full
|
|
596780
|
+
* evidence remains on disk (`.omnius/tool-results/`) and re-materialisable.
|
|
596781
|
+
*/
|
|
596782
|
+
_retireStaleEvidenceInPlace(messages2, currentTurn) {
|
|
596783
|
+
if (process.env["OMNIUS_EVIDENCE_RETIREMENT"] !== "1")
|
|
596784
|
+
return;
|
|
596785
|
+
const keepRecent = Math.max(0, Number(process.env["OMNIUS_EVIDENCE_KEEP_TURNS"] ?? 2));
|
|
596786
|
+
const minChars = Math.max(512, Number(process.env["OMNIUS_EVIDENCE_MIN_CHARS"] ?? 2e3));
|
|
596787
|
+
const staleBefore = currentTurn - keepRecent;
|
|
596788
|
+
if (staleBefore <= 0)
|
|
596789
|
+
return;
|
|
596790
|
+
let turnCount = 0;
|
|
596791
|
+
let retired = 0;
|
|
596792
|
+
let reclaimed = 0;
|
|
596793
|
+
for (let i2 = 0; i2 < messages2.length; i2++) {
|
|
596794
|
+
const msg = messages2[i2];
|
|
596795
|
+
if (msg.role === "assistant") {
|
|
596796
|
+
turnCount++;
|
|
596797
|
+
if (turnCount > staleBefore)
|
|
596798
|
+
break;
|
|
596799
|
+
}
|
|
596800
|
+
const content = typeof msg.content === "string" ? msg.content : "";
|
|
596801
|
+
if (!content)
|
|
596802
|
+
continue;
|
|
596803
|
+
if (content.startsWith("[RETIRED EVIDENCE") || content.startsWith("[Todo context archived") || content.startsWith("[Tool result cleared")) {
|
|
596804
|
+
continue;
|
|
596805
|
+
}
|
|
596806
|
+
const rm4 = { role: msg.role, content };
|
|
596807
|
+
if (!isRetirableEvidence(rm4, minChars))
|
|
596808
|
+
continue;
|
|
596809
|
+
let outcome;
|
|
596810
|
+
try {
|
|
596811
|
+
outcome = foldEvidenceOutcome(rm4);
|
|
596812
|
+
} catch {
|
|
596813
|
+
outcome = "evidence";
|
|
596814
|
+
}
|
|
596815
|
+
const stub = `[RETIRED EVIDENCE turn<=${staleBefore} bytes=${content.length}] outcome: ${outcome}
|
|
596816
|
+
(full evidence retired to disk — re-read the file or re-run the command to re-materialise if you need the detail)`;
|
|
596817
|
+
if (stub.length >= content.length)
|
|
596818
|
+
continue;
|
|
596819
|
+
messages2[i2].content = stub;
|
|
596820
|
+
retired += 1;
|
|
596821
|
+
reclaimed += content.length - stub.length;
|
|
596822
|
+
}
|
|
596823
|
+
if (retired > 0) {
|
|
596824
|
+
this.emit({
|
|
596825
|
+
type: "status",
|
|
596826
|
+
content: `[evidence-retirement] retired ${retired} stale evidence block(s), reclaimed ~${Math.round(reclaimed / 4)} tokens (world-state outcomes retained; bytes on disk)`,
|
|
596827
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
596828
|
+
});
|
|
596829
|
+
}
|
|
596830
|
+
}
|
|
596499
596831
|
_evictCompletedTodoMessages(startTurn, currentTurn, todoId, todoContent, messages2) {
|
|
596500
596832
|
const placeholder = [
|
|
596501
596833
|
`[Todo context archived: "${todoContent.slice(0, 120)}"`,
|
|
@@ -607130,6 +607462,7 @@ __export(dist_exports3, {
|
|
|
607130
607462
|
buildRecentSteeringContext: () => buildRecentSteeringContext,
|
|
607131
607463
|
buildSkillDescription: () => buildSkillDescription,
|
|
607132
607464
|
buildSteeringPacket: () => buildSteeringPacket,
|
|
607465
|
+
buildUnitTodos: () => buildUnitTodos,
|
|
607133
607466
|
checkMilestoneComplete: () => checkMilestoneComplete,
|
|
607134
607467
|
chooseCheapModelRoute: () => chooseCheapModelRoute,
|
|
607135
607468
|
claimAssertion: () => claimAssertion,
|
|
@@ -607163,6 +607496,7 @@ __export(dist_exports3, {
|
|
|
607163
607496
|
criticalPathDepth: () => criticalPathDepth,
|
|
607164
607497
|
debugArtifactRoot: () => debugArtifactRoot,
|
|
607165
607498
|
decomposeSpec: () => decomposeSpec,
|
|
607499
|
+
decomposeToUnits: () => decomposeToUnits,
|
|
607166
607500
|
defaultContextWindowDumpLocations: () => defaultContextWindowDumpLocations,
|
|
607167
607501
|
deleteAgentTaskSidecar: () => deleteAgentTaskSidecar,
|
|
607168
607502
|
deriveClaimsFromProposedText: () => deriveClaimsFromProposedText,
|
|
@@ -607175,6 +607509,7 @@ __export(dist_exports3, {
|
|
|
607175
607509
|
discoverSystemOllamaModelStore: () => discoverSystemOllamaModelStore,
|
|
607176
607510
|
evaluateExecutorStep: () => evaluateExecutorStep,
|
|
607177
607511
|
evaluateSpecGate: () => evaluateSpecGate,
|
|
607512
|
+
evaluateUnitResult: () => evaluateUnitResult,
|
|
607178
607513
|
executeBatch: () => executeBatch,
|
|
607179
607514
|
executeHook: () => executeHook,
|
|
607180
607515
|
expandContextReference: () => expandContextReference,
|
|
@@ -607406,6 +607741,7 @@ var init_dist8 = __esm({
|
|
|
607406
607741
|
init_coherence_gate();
|
|
607407
607742
|
init_spec_gate();
|
|
607408
607743
|
init_longhaul_integration();
|
|
607744
|
+
init_decomposition_orchestrator();
|
|
607409
607745
|
}
|
|
607410
607746
|
});
|
|
607411
607747
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.478",
|
|
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.478",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED