omnius 1.0.447 → 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 +404 -131
- package/npm-shrinkwrap.json +38 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -272845,11 +272845,11 @@ var require_out = __commonJS({
|
|
|
272845
272845
|
async.read(path12, getSettings(optionsOrSettingsOrCallback), callback);
|
|
272846
272846
|
}
|
|
272847
272847
|
exports.stat = stat9;
|
|
272848
|
-
function
|
|
272848
|
+
function statSync67(path12, optionsOrSettings) {
|
|
272849
272849
|
const settings = getSettings(optionsOrSettings);
|
|
272850
272850
|
return sync.read(path12, settings);
|
|
272851
272851
|
}
|
|
272852
|
-
exports.statSync =
|
|
272852
|
+
exports.statSync = statSync67;
|
|
272853
272853
|
function getSettings(settingsOrOptions = {}) {
|
|
272854
272854
|
if (settingsOrOptions instanceof settings_1.default) {
|
|
272855
272855
|
return settingsOrOptions;
|
|
@@ -310276,7 +310276,7 @@ ${lanes.join("\n")}
|
|
|
310276
310276
|
return process.memoryUsage().heapUsed;
|
|
310277
310277
|
},
|
|
310278
310278
|
getFileSize(path12) {
|
|
310279
|
-
const stat9 =
|
|
310279
|
+
const stat9 = statSync67(path12);
|
|
310280
310280
|
if (stat9 == null ? void 0 : stat9.isFile()) {
|
|
310281
310281
|
return stat9.size;
|
|
310282
310282
|
}
|
|
@@ -310320,7 +310320,7 @@ ${lanes.join("\n")}
|
|
|
310320
310320
|
}
|
|
310321
310321
|
};
|
|
310322
310322
|
return nodeSystem;
|
|
310323
|
-
function
|
|
310323
|
+
function statSync67(path12) {
|
|
310324
310324
|
try {
|
|
310325
310325
|
return _fs.statSync(path12, statSyncOptions);
|
|
310326
310326
|
} catch {
|
|
@@ -310379,7 +310379,7 @@ ${lanes.join("\n")}
|
|
|
310379
310379
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
310380
310380
|
var _a2;
|
|
310381
310381
|
if (!err) {
|
|
310382
|
-
if ((_a2 =
|
|
310382
|
+
if ((_a2 = statSync67(profilePath)) == null ? void 0 : _a2.isDirectory()) {
|
|
310383
310383
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
310384
310384
|
}
|
|
310385
310385
|
try {
|
|
@@ -310499,7 +310499,7 @@ ${lanes.join("\n")}
|
|
|
310499
310499
|
let stat9;
|
|
310500
310500
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
310501
310501
|
const name10 = combinePaths(path12, entry);
|
|
310502
|
-
stat9 =
|
|
310502
|
+
stat9 = statSync67(name10);
|
|
310503
310503
|
if (!stat9) {
|
|
310504
310504
|
continue;
|
|
310505
310505
|
}
|
|
@@ -310523,7 +310523,7 @@ ${lanes.join("\n")}
|
|
|
310523
310523
|
return matchFiles(path12, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
310524
310524
|
}
|
|
310525
310525
|
function fileSystemEntryExists(path12, entryKind) {
|
|
310526
|
-
const stat9 =
|
|
310526
|
+
const stat9 = statSync67(path12);
|
|
310527
310527
|
if (!stat9) {
|
|
310528
310528
|
return false;
|
|
310529
310529
|
}
|
|
@@ -310565,7 +310565,7 @@ ${lanes.join("\n")}
|
|
|
310565
310565
|
}
|
|
310566
310566
|
function getModifiedTime3(path12) {
|
|
310567
310567
|
var _a2;
|
|
310568
|
-
return (_a2 =
|
|
310568
|
+
return (_a2 = statSync67(path12)) == null ? void 0 : _a2.mtime;
|
|
310569
310569
|
}
|
|
310570
310570
|
function setModifiedTime(path12, time) {
|
|
310571
310571
|
try {
|
|
@@ -573005,6 +573005,7 @@ context_fabric: included=${included.length} dropped=${dropped.length} truncated=
|
|
|
573005
573005
|
});
|
|
573006
573006
|
|
|
573007
573007
|
// packages/orchestrator/dist/evidenceLedger.js
|
|
573008
|
+
import { statSync as statSync36 } from "node:fs";
|
|
573008
573009
|
function buildExtract(content) {
|
|
573009
573010
|
const lines = content.split("\n");
|
|
573010
573011
|
if (lines.length <= SMALL_LINES && content.length <= SMALL_CHARS) {
|
|
@@ -573075,13 +573076,15 @@ var init_evidenceLedger = __esm({
|
|
|
573075
573076
|
fidelity: keepNew ? built.fidelity : existing.fidelity,
|
|
573076
573077
|
ranges: mergeRanges([...existing.ranges, range]),
|
|
573077
573078
|
lastReadTurn: turn,
|
|
573078
|
-
stale: false
|
|
573079
|
+
stale: false,
|
|
573080
|
+
mtimeMs: input.mtimeMs ?? existing.mtimeMs
|
|
573079
573081
|
});
|
|
573080
573082
|
return;
|
|
573081
573083
|
}
|
|
573082
573084
|
this.entries.set(path12, {
|
|
573083
573085
|
path: path12,
|
|
573084
573086
|
readVersion: fileVersion,
|
|
573087
|
+
mtimeMs: input.mtimeMs ?? 0,
|
|
573085
573088
|
lastReadTurn: turn,
|
|
573086
573089
|
ranges: [range],
|
|
573087
573090
|
content: built.text,
|
|
@@ -573102,6 +573105,33 @@ var init_evidenceLedger = __esm({
|
|
|
573102
573105
|
const e2 = this.entries.get(path12);
|
|
573103
573106
|
return !!e2 && !e2.stale;
|
|
573104
573107
|
}
|
|
573108
|
+
/**
|
|
573109
|
+
* Validate evidence freshness against the real filesystem via stat().
|
|
573110
|
+
* If the file's mtime has changed since we last read it (external mutation
|
|
573111
|
+
* like a manual chmod, device reconnect, or human edit), mark as stale.
|
|
573112
|
+
* Returns true if evidence was valid, false if became stale or stat failed.
|
|
573113
|
+
*/
|
|
573114
|
+
validateFreshness(path12) {
|
|
573115
|
+
const e2 = this.entries.get(path12);
|
|
573116
|
+
if (!e2)
|
|
573117
|
+
return false;
|
|
573118
|
+
if (e2.stale)
|
|
573119
|
+
return false;
|
|
573120
|
+
if (e2.mtimeMs <= 0)
|
|
573121
|
+
return true;
|
|
573122
|
+
try {
|
|
573123
|
+
const st = statSync36(path12, { throwIfNoEntry: false });
|
|
573124
|
+
if (!st)
|
|
573125
|
+
return true;
|
|
573126
|
+
if (st.mtimeMs > e2.mtimeMs) {
|
|
573127
|
+
e2.stale = true;
|
|
573128
|
+
return false;
|
|
573129
|
+
}
|
|
573130
|
+
return true;
|
|
573131
|
+
} catch {
|
|
573132
|
+
return true;
|
|
573133
|
+
}
|
|
573134
|
+
}
|
|
573105
573135
|
get(path12) {
|
|
573106
573136
|
return this.entries.get(path12);
|
|
573107
573137
|
}
|
|
@@ -573150,7 +573180,7 @@ var init_evidenceLedger = __esm({
|
|
|
573150
573180
|
});
|
|
573151
573181
|
|
|
573152
573182
|
// packages/orchestrator/dist/contextWindowDump.js
|
|
573153
|
-
import { existsSync as existsSync100, mkdirSync as mkdirSync58, readdirSync as readdirSync32, readFileSync as readFileSync78, statSync as
|
|
573183
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync58, readdirSync as readdirSync32, readFileSync as readFileSync78, statSync as statSync37, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48, appendFileSync as appendFileSync9 } from "node:fs";
|
|
573154
573184
|
import { homedir as homedir35 } from "node:os";
|
|
573155
573185
|
import { join as join111, resolve as resolve51 } from "node:path";
|
|
573156
573186
|
import { createHash as createHash28 } from "node:crypto";
|
|
@@ -573394,7 +573424,7 @@ function pruneOldDumpFiles(dir) {
|
|
|
573394
573424
|
try {
|
|
573395
573425
|
const files = readdirSync32(dir).filter((file) => file.endsWith(".json") && file !== "latest.json").map((file) => {
|
|
573396
573426
|
const path12 = join111(dir, file);
|
|
573397
|
-
return { path: path12, mtimeMs:
|
|
573427
|
+
return { path: path12, mtimeMs: statSync37(path12).mtimeMs };
|
|
573398
573428
|
}).sort((a2, b) => b.mtimeMs - a2.mtimeMs);
|
|
573399
573429
|
for (const file of files.slice(maxFiles))
|
|
573400
573430
|
unlinkSync17(file.path);
|
|
@@ -573762,7 +573792,7 @@ var init_adversaryStream = __esm({
|
|
|
573762
573792
|
});
|
|
573763
573793
|
|
|
573764
573794
|
// packages/orchestrator/dist/debugArtifactLibrary.js
|
|
573765
|
-
import { appendFileSync as appendFileSync10, existsSync as existsSync101, mkdirSync as mkdirSync59, readFileSync as readFileSync79, statSync as
|
|
573795
|
+
import { appendFileSync as appendFileSync10, existsSync as existsSync101, mkdirSync as mkdirSync59, readFileSync as readFileSync79, statSync as statSync38, writeFileSync as writeFileSync49 } from "node:fs";
|
|
573766
573796
|
import { createHash as createHash29 } from "node:crypto";
|
|
573767
573797
|
import { basename as basename23, join as join112, relative as relative10, resolve as resolve52 } from "node:path";
|
|
573768
573798
|
function debugArtifactRoot(cwd4 = process.cwd(), stateDir) {
|
|
@@ -574354,7 +574384,7 @@ function readJson2(path12) {
|
|
|
574354
574384
|
}
|
|
574355
574385
|
function pathExists(path12) {
|
|
574356
574386
|
try {
|
|
574357
|
-
|
|
574387
|
+
statSync38(path12);
|
|
574358
574388
|
return true;
|
|
574359
574389
|
} catch {
|
|
574360
574390
|
return false;
|
|
@@ -574459,12 +574489,7 @@ function isEvidenceGatheringTool(toolName) {
|
|
|
574459
574489
|
].includes(toolName);
|
|
574460
574490
|
}
|
|
574461
574491
|
function isEditTool(toolName) {
|
|
574462
|
-
return [
|
|
574463
|
-
"file_write",
|
|
574464
|
-
"file_edit",
|
|
574465
|
-
"file_patch",
|
|
574466
|
-
"batch_edit"
|
|
574467
|
-
].includes(toolName);
|
|
574492
|
+
return ["file_write", "file_edit", "file_patch", "batch_edit"].includes(toolName);
|
|
574468
574493
|
}
|
|
574469
574494
|
function isReportTool(toolName) {
|
|
574470
574495
|
return toolName === "task_complete" || toolName === "ask_user";
|
|
@@ -574604,7 +574629,9 @@ function quickHash(input) {
|
|
|
574604
574629
|
return hash.toString(16).padStart(8, "0");
|
|
574605
574630
|
}
|
|
574606
574631
|
function uniqueLimited(values) {
|
|
574607
|
-
const uniqueValues = [
|
|
574632
|
+
const uniqueValues = [
|
|
574633
|
+
...new Set(values.filter((value2) => value2.trim().length > 0))
|
|
574634
|
+
];
|
|
574608
574635
|
if (uniqueValues.length <= MAX_FORBIDDEN_FAMILIES)
|
|
574609
574636
|
return uniqueValues;
|
|
574610
574637
|
return uniqueValues.slice(-MAX_FORBIDDEN_FAMILIES);
|
|
@@ -574672,6 +574699,17 @@ var init_focusSupervisor = __esm({
|
|
|
574672
574699
|
this.lastContext = input.context ?? this.lastContext;
|
|
574673
574700
|
if (!this.enabled)
|
|
574674
574701
|
return this.pass();
|
|
574702
|
+
if (input.context && this.lastContext && this.ignoredDirectiveStreak > 0) {
|
|
574703
|
+
const oldP = this.lastContext.pressureRatio ?? 0;
|
|
574704
|
+
const newP = input.context.pressureRatio ?? 0;
|
|
574705
|
+
const oldS = this.lastContext.signalToNoiseRatio;
|
|
574706
|
+
const newS = input.context.signalToNoiseRatio;
|
|
574707
|
+
const pressureShift = oldP > 0 ? Math.abs(newP - oldP) / oldP : 0;
|
|
574708
|
+
const snrShift = oldS !== null && oldS !== void 0 && oldS > 0 ? Math.abs((newS ?? 0) - oldS) / oldS : 0;
|
|
574709
|
+
if (pressureShift > 0.2 || snrShift > 0.2) {
|
|
574710
|
+
this.ignoredDirectiveStreak = 0;
|
|
574711
|
+
}
|
|
574712
|
+
}
|
|
574675
574713
|
const family = actionFamily(input.toolName, input.args);
|
|
574676
574714
|
const prior = this.directive;
|
|
574677
574715
|
if (prior && violatesDirective(prior, input)) {
|
|
@@ -574694,18 +574732,34 @@ var init_focusSupervisor = __esm({
|
|
|
574694
574732
|
prior.ignoredCount++;
|
|
574695
574733
|
this.ignoredDirectiveStreak++;
|
|
574696
574734
|
this.lastIgnoredDirectiveTurn = input.turn;
|
|
574735
|
+
if ((prior.requiredNextAction === "read_authoritative_target" || prior.requiredNextAction === "use_cached_evidence") && input.cachedResult && (input.duplicateHitCount ?? 0) >= Math.max(1, this.repeatGateMax - 1)) {
|
|
574736
|
+
const deadlockDirective = this.setDirective({
|
|
574737
|
+
turn: input.turn,
|
|
574738
|
+
state: "terminal_incomplete",
|
|
574739
|
+
reason: `read target is repeat-gated (${input.duplicateHitCount} hits); directive ${prior.id} cannot be satisfied without fresh reads; report blocked with evidence`,
|
|
574740
|
+
requiredNextAction: "report_incomplete",
|
|
574741
|
+
forbiddenActionFamilies: []
|
|
574742
|
+
});
|
|
574743
|
+
return this.block(deadlockDirective, [
|
|
574744
|
+
"[FOCUS SUPERVISOR: DEADLOCK]",
|
|
574745
|
+
`Directive ${prior.id} (${prior.requiredNextAction}) requires reading evidence that is repeat-gated (${input.duplicateHitCount} identical reads).`,
|
|
574746
|
+
"The model cannot satisfy this directive because the repeat gate blocks re-reads, and other actions are forbidden by the current directive.",
|
|
574747
|
+
"Report incomplete/blocked with the concrete evidence you have, and describe what additional access would break the deadlock."
|
|
574748
|
+
].join("\n"), false);
|
|
574749
|
+
}
|
|
574697
574750
|
if (strict && prior.ignoredCount >= 1) {
|
|
574698
574751
|
const terminal = this.ignoredDirectiveStreak >= TERMINAL_INCOMPLETE_IGNORE_THRESHOLD;
|
|
574699
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
|
+
}
|
|
574700
574757
|
const directive = this.setDirective({
|
|
574701
574758
|
turn: input.turn,
|
|
574702
574759
|
state: terminal ? "terminal_incomplete" : ignoredManyTimes ? "verify_or_block" : "single_next_action",
|
|
574703
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}`,
|
|
574704
574761
|
requiredNextAction: terminal ? "report_incomplete" : prior.requiredNextAction,
|
|
574705
|
-
forbiddenActionFamilies: uniqueLimited(
|
|
574706
|
-
...prior.forbiddenActionFamilies,
|
|
574707
|
-
family
|
|
574708
|
-
])
|
|
574762
|
+
forbiddenActionFamilies: uniqueLimited(accumulatedFamilies)
|
|
574709
574763
|
});
|
|
574710
574764
|
this.lastIgnoredDirectiveTurn = input.turn;
|
|
574711
574765
|
return this.block(directive, [
|
|
@@ -574819,13 +574873,26 @@ var init_focusSupervisor = __esm({
|
|
|
574819
574873
|
errorClass: failureErrorClass(input.error || input.output || "")
|
|
574820
574874
|
};
|
|
574821
574875
|
this.failureFamilies.set(family, next);
|
|
574822
|
-
if (next.count >= 2
|
|
574876
|
+
if (next.count >= 2) {
|
|
574823
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)];
|
|
574824
574882
|
this.setDirective({
|
|
574825
574883
|
turn: input.turn,
|
|
574826
574884
|
state: "forced_replan",
|
|
574827
574885
|
reason: `same ${input.toolName} failure family repeated ${next.count} times: ${next.sample}`,
|
|
574828
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",
|
|
574829
574896
|
forbiddenActionFamilies: [actionFamily(input.toolName, input.args)]
|
|
574830
574897
|
});
|
|
574831
574898
|
}
|
|
@@ -574912,12 +574979,21 @@ var init_focusSupervisor = __esm({
|
|
|
574912
574979
|
this.lastIgnoredDirectiveTurn = null;
|
|
574913
574980
|
}
|
|
574914
574981
|
pass() {
|
|
574915
|
-
return {
|
|
574982
|
+
return {
|
|
574983
|
+
kind: "pass",
|
|
574984
|
+
state: this.state,
|
|
574985
|
+
...this.directive ? { directive: this.directive } : {}
|
|
574986
|
+
};
|
|
574916
574987
|
}
|
|
574917
574988
|
inject(directive, message2) {
|
|
574918
574989
|
this.lastDecision = "inject_guidance";
|
|
574919
574990
|
this.lastReason = directive.reason;
|
|
574920
|
-
return {
|
|
574991
|
+
return {
|
|
574992
|
+
kind: "inject_guidance",
|
|
574993
|
+
state: directive.state,
|
|
574994
|
+
directive,
|
|
574995
|
+
message: message2
|
|
574996
|
+
};
|
|
574921
574997
|
}
|
|
574922
574998
|
block(directive, message2, success) {
|
|
574923
574999
|
this.lastDecision = "block_tool_call";
|
|
@@ -575926,7 +576002,7 @@ __export(preflightSnapshot_exports, {
|
|
|
575926
576002
|
formatPreflightStatus: () => formatPreflightStatus,
|
|
575927
576003
|
freeDiskBytes: () => freeDiskBytes
|
|
575928
576004
|
});
|
|
575929
|
-
import { existsSync as existsSync102, readFileSync as readFileSync80, statSync as
|
|
576005
|
+
import { existsSync as existsSync102, readFileSync as readFileSync80, statSync as statSync39, statfsSync as statfsSync6 } from "node:fs";
|
|
575930
576006
|
import { homedir as homedir36, platform as platform4, arch as arch2, totalmem as totalmem4, freemem as freemem3, hostname as hostname3 } from "node:os";
|
|
575931
576007
|
import { join as join113 } from "node:path";
|
|
575932
576008
|
import { createHash as createHash30 } from "node:crypto";
|
|
@@ -576102,7 +576178,7 @@ function sha2564(s2) {
|
|
|
576102
576178
|
}
|
|
576103
576179
|
function freeDiskBytes(path12 = "/tmp") {
|
|
576104
576180
|
try {
|
|
576105
|
-
const st =
|
|
576181
|
+
const st = statSync39(path12);
|
|
576106
576182
|
if (!st.isDirectory())
|
|
576107
576183
|
return -1;
|
|
576108
576184
|
const fs11 = statfsSync6(path12);
|
|
@@ -576146,7 +576222,7 @@ __export(postActionVerifier_exports, {
|
|
|
576146
576222
|
classifyShellIntent: () => classifyShellIntent,
|
|
576147
576223
|
verifyShellOutcome: () => verifyShellOutcome
|
|
576148
576224
|
});
|
|
576149
|
-
import { existsSync as existsSync103, readFileSync as readFileSync81, readdirSync as readdirSync33, statSync as
|
|
576225
|
+
import { existsSync as existsSync103, readFileSync as readFileSync81, readdirSync as readdirSync33, statSync as statSync40 } from "node:fs";
|
|
576150
576226
|
import { join as join114 } from "node:path";
|
|
576151
576227
|
function classifyShellIntent(cmd) {
|
|
576152
576228
|
const stripped = cmd.replace(/^cd\s+\S+\s*&&\s*/, "").trim();
|
|
@@ -576359,7 +576435,7 @@ function listNpmInstalled(installRootAbs) {
|
|
|
576359
576435
|
continue;
|
|
576360
576436
|
const sub2 = join114(installRootAbs, name10);
|
|
576361
576437
|
try {
|
|
576362
|
-
if (!
|
|
576438
|
+
if (!statSync40(sub2).isDirectory())
|
|
576363
576439
|
continue;
|
|
576364
576440
|
} catch {
|
|
576365
576441
|
continue;
|
|
@@ -576431,7 +576507,7 @@ function mostRecentFileMtimeMs(root, maxDepth) {
|
|
|
576431
576507
|
const full = join114(dir, name10);
|
|
576432
576508
|
let st;
|
|
576433
576509
|
try {
|
|
576434
|
-
st =
|
|
576510
|
+
st = statSync40(full);
|
|
576435
576511
|
} catch {
|
|
576436
576512
|
continue;
|
|
576437
576513
|
}
|
|
@@ -577288,19 +577364,62 @@ function detectTaskMode(task) {
|
|
|
577288
577364
|
}
|
|
577289
577365
|
return false;
|
|
577290
577366
|
}
|
|
577291
|
-
function slimSystemPromptForTaskMode(prompt) {
|
|
577292
|
-
const
|
|
577293
|
-
|
|
577294
|
-
|
|
577295
|
-
|
|
577296
|
-
|
|
577297
|
-
|
|
577298
|
-
|
|
577367
|
+
function slimSystemPromptForTaskMode(prompt, task) {
|
|
577368
|
+
const taskLower = (task ?? "").toLowerCase();
|
|
577369
|
+
const taskMentions = (...keywords2) => keywords2.some((k) => taskLower.includes(k));
|
|
577370
|
+
const SECTION_RULES = [
|
|
577371
|
+
{
|
|
577372
|
+
header: /^##\s*Interactive\s*\/\s*Long-?Running Sessions\s*$/im,
|
|
577373
|
+
keywords: []
|
|
577374
|
+
},
|
|
577375
|
+
{ header: /^##\s*Document Generation Strategy\s*$/im, keywords: [] },
|
|
577376
|
+
{
|
|
577377
|
+
header: /^##\s*Calculations\s*[—-]\s*Always Execute, Never Guess\s*$/im,
|
|
577378
|
+
keywords: []
|
|
577379
|
+
},
|
|
577380
|
+
{
|
|
577381
|
+
header: /^##\s*Knowledge Gaps\s*[—-]\s*Search, Don't Hallucinate\s*$/im,
|
|
577382
|
+
keywords: []
|
|
577383
|
+
},
|
|
577384
|
+
{ header: /^##\s*Self-Awareness( & Introspection)?\s*$/im, keywords: [] },
|
|
577385
|
+
{
|
|
577386
|
+
header: /^##\s*Debugging\s*[—-]\s*Observe Before Reasoning\s*$/im,
|
|
577387
|
+
keywords: []
|
|
577388
|
+
},
|
|
577389
|
+
// Feature-heavy sections — stripped unless task is relevant
|
|
577390
|
+
{
|
|
577391
|
+
header: /^##\s*Nexus P2P Networking\b.*$/im,
|
|
577392
|
+
keywords: ["nexus", "p2p", "peer", "wallet", "payment", "invoke", "mesh"]
|
|
577393
|
+
},
|
|
577394
|
+
{
|
|
577395
|
+
header: /^##\s*Temporal Agency\b.*$/im,
|
|
577396
|
+
keywords: ["cron", "schedule", "reminder", "agenda", "temporal"]
|
|
577397
|
+
},
|
|
577398
|
+
{ header: /^##\s*Skills \(AIWG\)\s*$/im, keywords: ["skill", "aiwg"] },
|
|
577399
|
+
{ header: /^##\s*Slash Commands\b.*$/im, keywords: ["slash", "command"] },
|
|
577400
|
+
{
|
|
577401
|
+
header: /^##\s*Priority Ingress\b.*$/im,
|
|
577402
|
+
keywords: ["priority", "delegate", "ingress", "classify"]
|
|
577403
|
+
},
|
|
577404
|
+
{
|
|
577405
|
+
header: /^##\s*Custom Tools\b.*$/im,
|
|
577406
|
+
keywords: ["create_tool", "custom tool", "workflow", "reusable"]
|
|
577407
|
+
},
|
|
577408
|
+
{
|
|
577409
|
+
header: /^##\s*RLM Context Operating System\b.*$/im,
|
|
577410
|
+
keywords: ["rlm", "repl", "recursive", "llm_query"]
|
|
577411
|
+
},
|
|
577412
|
+
{
|
|
577413
|
+
header: /^##\s*Desktop Automation\s*&?\s*Vision\b.*$/im,
|
|
577414
|
+
keywords: ["desktop", "click", "screenshot", "xdotool", "browser", "ui"]
|
|
577415
|
+
}
|
|
577299
577416
|
];
|
|
577300
577417
|
const CHAT_MODE_BLOCK = /^\*\*CHAT MODE\*\*[\s\S]*?(?=\*\*TASK MODE\*\*)/im;
|
|
577301
577418
|
let out = prompt;
|
|
577302
|
-
for (const
|
|
577303
|
-
|
|
577419
|
+
for (const rule of SECTION_RULES) {
|
|
577420
|
+
if (rule.keywords.length > 0 && taskMentions(...rule.keywords))
|
|
577421
|
+
continue;
|
|
577422
|
+
out = out.replace(new RegExp(rule.header.source + "[\\s\\S]*?(?=^##\\s|\\Z)", "im"), "");
|
|
577304
577423
|
}
|
|
577305
577424
|
out = out.replace(CHAT_MODE_BLOCK, "");
|
|
577306
577425
|
out = out.replace(/^\*\*TASK MODE\*\*[^\n]*\n/im, "");
|
|
@@ -578403,7 +578522,12 @@ ${parts.join("\n")}
|
|
|
578403
578522
|
_workboardHasEditEvidence(card) {
|
|
578404
578523
|
if (!card)
|
|
578405
578524
|
return false;
|
|
578406
|
-
const editTools = /* @__PURE__ */ new Set([
|
|
578525
|
+
const editTools = /* @__PURE__ */ new Set([
|
|
578526
|
+
"file_write",
|
|
578527
|
+
"file_edit",
|
|
578528
|
+
"batch_edit",
|
|
578529
|
+
"file_patch"
|
|
578530
|
+
]);
|
|
578407
578531
|
return card.evidence.some((e2) => {
|
|
578408
578532
|
if (typeof e2.tool === "string" && editTools.has(e2.tool))
|
|
578409
578533
|
return true;
|
|
@@ -579035,7 +579159,10 @@ ${parts.join("\n")}
|
|
|
579035
579159
|
const selected = /* @__PURE__ */ new Map();
|
|
579036
579160
|
let selectedBy = "none";
|
|
579037
579161
|
try {
|
|
579038
|
-
const embeddings = await generateEmbeddingBatch([
|
|
579162
|
+
const embeddings = await generateEmbeddingBatch([
|
|
579163
|
+
taskGoal,
|
|
579164
|
+
...candidates.map((pattern) => this._failurePatternText(pattern))
|
|
579165
|
+
], { baseUrl: this._embeddingBaseUrl(), timeoutMs: 12e3 });
|
|
579039
579166
|
const query = embeddings[0]?.vector;
|
|
579040
579167
|
const minScore = Number.parseFloat(process.env["OMNIUS_FAILURE_PATTERN_SIM_MIN"] ?? "0.58");
|
|
579041
579168
|
if (query) {
|
|
@@ -579242,7 +579369,7 @@ ${parts.join("\n")}
|
|
|
579242
579369
|
const pressureCue = pressureCheck(task);
|
|
579243
579370
|
const rawPrompt = getSystemPromptForTier(this.options.modelTier);
|
|
579244
579371
|
const taskModeOn = detectTaskMode(task);
|
|
579245
|
-
const slimmedPrompt = taskModeOn ? slimSystemPromptForTaskMode(rawPrompt) : rawPrompt;
|
|
579372
|
+
const slimmedPrompt = taskModeOn ? slimSystemPromptForTaskMode(rawPrompt, task) : rawPrompt;
|
|
579246
579373
|
const basePrompt = slimmedPrompt + pressureCue;
|
|
579247
579374
|
if (taskModeOn) {
|
|
579248
579375
|
this.emit({
|
|
@@ -579504,6 +579631,129 @@ Your hypotheses MUST address this specific error, not generic causes.
|
|
|
579504
579631
|
return null;
|
|
579505
579632
|
}
|
|
579506
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
|
+
}
|
|
579507
579757
|
// ── Failing-approach detector (the "stop retrying variants" reflex) ───────
|
|
579508
579758
|
// Encodes the behavior an effective agent uses and the dropbear 27× loop
|
|
579509
579759
|
// lacked: when the SAME error recurs ~3× — especially while the same target
|
|
@@ -582193,7 +582443,9 @@ ${contentPreview}
|
|
|
582193
582443
|
return true;
|
|
582194
582444
|
if (/\bperl\s+-[A-Za-z]*i[A-Za-z]*\b/.test(cmd))
|
|
582195
582445
|
return true;
|
|
582196
|
-
if (/\b(?:cp|mv|rm|mkdir|rmdir|touch|truncate|ln|install)\b/i.test(cmd))
|
|
582446
|
+
if (/\b(?:cp|mv|rm|mkdir|rmdir|touch|truncate|ln|install|chmod|chown|chgrp|setfacl)\b/i.test(cmd))
|
|
582447
|
+
return true;
|
|
582448
|
+
if (/\b(?:udevadm|mount|umount|modprobe|insmod)\b/i.test(cmd))
|
|
582197
582449
|
return true;
|
|
582198
582450
|
if (/\b(?:python3?|node|ruby|deno|bun)\b[\s\S]{0,240}\b(?:writeFile|writeFileSync|openSync|mkdirSync|renameSync|unlinkSync|rmSync)\b/i.test(cmd))
|
|
582199
582451
|
return true;
|
|
@@ -582614,7 +582866,8 @@ ${sections.join("\n")}` : sections.join("\n");
|
|
|
582614
582866
|
try {
|
|
582615
582867
|
const memMod = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
582616
582868
|
if (typeof memMod.contextItemsFromMessages === "function") {
|
|
582617
|
-
|
|
582869
|
+
const msgsForCtx = input.messages.filter((m2) => m2.role !== "system");
|
|
582870
|
+
helperItems = this._normalizeExternalContextItems(await memMod.contextItemsFromMessages(msgsForCtx.slice(-12)));
|
|
582618
582871
|
}
|
|
582619
582872
|
} catch {
|
|
582620
582873
|
helperItems = [];
|
|
@@ -582872,7 +583125,7 @@ ${chunk.content}`, {
|
|
|
582872
583125
|
this._contextLedger.prune(turn);
|
|
582873
583126
|
const goalBlock = [
|
|
582874
583127
|
this._renderRuntimeRootBlock(),
|
|
582875
|
-
this._taskState.goal ? `Active task:
|
|
583128
|
+
this._taskState.goal ? `Active task: (see user message above — the goal block defers to the user message as the authoritative source)` : null
|
|
582876
583129
|
].filter(Boolean).join("\n\n");
|
|
582877
583130
|
const filesystemBlock = this._renderFilesystemStateBlock(turn);
|
|
582878
583131
|
const todoBlock = this._renderTodoStateBlock(turn);
|
|
@@ -586629,6 +586882,7 @@ ${memoryLines.join("\n")}`
|
|
|
586629
586882
|
this.proactivePrune(compacted, turn);
|
|
586630
586883
|
this.microcompact(compacted, recentToolResults);
|
|
586631
586884
|
this._insertContextFrame(compacted, await this._buildTurnContextFrame(turn, compacted, recentToolResults, environmentBlock));
|
|
586885
|
+
this.gcSystemMessages(compacted);
|
|
586632
586886
|
let requestMessages = sanitizeHistoryThink(compacted);
|
|
586633
586887
|
{
|
|
586634
586888
|
const _limits = this.contextLimits();
|
|
@@ -587830,6 +588084,24 @@ Read the current file if needed, make a different concrete edit, or move to veri
|
|
|
587830
588084
|
const _repeatGateMax = this._resolveRepeatGateMax();
|
|
587831
588085
|
const isFailedShellRepeat = tc.name === "shell" && typeof _existingFp?.result === "string" && _existingFp.result.includes("status: failure");
|
|
587832
588086
|
const repeatGateEligible = isReadLike || tc.name === "memory_write" || isFailedShellRepeat;
|
|
588087
|
+
if (isReadLike && this._evidenceLedger) {
|
|
588088
|
+
const readArgs = tc.arguments;
|
|
588089
|
+
const readPath2 = String(readArgs?.["path"] ?? readArgs?.["file"] ?? "");
|
|
588090
|
+
if (readPath2) {
|
|
588091
|
+
const wasFresh = this._evidenceLedger.validateFreshness(readPath2);
|
|
588092
|
+
if (!wasFresh) {
|
|
588093
|
+
recentToolResults.delete(toolFingerprint);
|
|
588094
|
+
dedupHitCount.delete(toolFingerprint);
|
|
588095
|
+
this._recentFailures = (this._recentFailures ?? []).filter((f2) => f2.fingerprint !== toolFingerprint);
|
|
588096
|
+
repeatShortCircuit = null;
|
|
588097
|
+
this.emit({
|
|
588098
|
+
type: "status",
|
|
588099
|
+
content: `[EXTERNAL MUTATION] ${readPath2} mtime changed since last read — cache invalidated, fresh read allowed`,
|
|
588100
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
588101
|
+
});
|
|
588102
|
+
}
|
|
588103
|
+
}
|
|
588104
|
+
}
|
|
587833
588105
|
if (repeatGateEligible && _existingFp !== void 0 && _repeatGateMax > 0) {
|
|
587834
588106
|
if (criticDecision.hitNumber >= _repeatGateMax) {
|
|
587835
588107
|
if (isReadLike) {
|
|
@@ -588235,6 +588507,7 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
588235
588507
|
content: result.output,
|
|
588236
588508
|
range: { start: start3, end },
|
|
588237
588509
|
fileVersion: this._worldFacts.files.get(p2)?.writeCount ?? 0,
|
|
588510
|
+
mtimeMs: Date.now(),
|
|
588238
588511
|
turn
|
|
588239
588512
|
});
|
|
588240
588513
|
}
|
|
@@ -596973,7 +597246,7 @@ var init_constraint_learner = __esm({
|
|
|
596973
597246
|
});
|
|
596974
597247
|
|
|
596975
597248
|
// packages/orchestrator/dist/nexusBackend.js
|
|
596976
|
-
import { existsSync as existsSync104, statSync as
|
|
597249
|
+
import { existsSync as existsSync104, statSync as statSync41, openSync, readSync, closeSync, unlinkSync as unlinkSync18, writeFileSync as writeFileSync50 } from "node:fs";
|
|
596977
597250
|
import { watch as fsWatch } from "node:fs";
|
|
596978
597251
|
import { join as join115 } from "node:path";
|
|
596979
597252
|
import { tmpdir as tmpdir21 } from "node:os";
|
|
@@ -597334,7 +597607,7 @@ ${suffix}` } : m2);
|
|
|
597334
597607
|
finish();
|
|
597335
597608
|
}, 50);
|
|
597336
597609
|
});
|
|
597337
|
-
const stat9 =
|
|
597610
|
+
const stat9 = statSync41(streamFile, { throwIfNoEntry: false });
|
|
597338
597611
|
if (!stat9 || stat9.size <= position)
|
|
597339
597612
|
continue;
|
|
597340
597613
|
const fd = openSync(streamFile, "r");
|
|
@@ -602237,7 +602510,7 @@ var init_missionSystem = __esm({
|
|
|
602237
602510
|
});
|
|
602238
602511
|
|
|
602239
602512
|
// packages/orchestrator/dist/context-references.js
|
|
602240
|
-
import { readFileSync as readFileSync88, readdirSync as readdirSync35, statSync as
|
|
602513
|
+
import { readFileSync as readFileSync88, readdirSync as readdirSync35, statSync as statSync42 } from "node:fs";
|
|
602241
602514
|
import { homedir as homedir38 } from "node:os";
|
|
602242
602515
|
import { join as join123, resolve as resolve53, relative as relative11, sep as sep3, extname as extname13 } from "node:path";
|
|
602243
602516
|
function estimateTokens6(text2) {
|
|
@@ -602384,7 +602657,7 @@ function buildFolderListing(dirPath, cwd4, limit = 200) {
|
|
|
602384
602657
|
continue;
|
|
602385
602658
|
const full = join123(current, entry);
|
|
602386
602659
|
try {
|
|
602387
|
-
if (
|
|
602660
|
+
if (statSync42(full).isDirectory()) {
|
|
602388
602661
|
dirs.push(entry);
|
|
602389
602662
|
} else {
|
|
602390
602663
|
files.push(entry);
|
|
@@ -602408,7 +602681,7 @@ function buildFolderListing(dirPath, cwd4, limit = 200) {
|
|
|
602408
602681
|
const full = join123(current, f2);
|
|
602409
602682
|
let meta = "?";
|
|
602410
602683
|
try {
|
|
602411
|
-
const st =
|
|
602684
|
+
const st = statSync42(full);
|
|
602412
602685
|
if (st.isFile()) {
|
|
602413
602686
|
const size = st.size;
|
|
602414
602687
|
if (isBinaryFile(full)) {
|
|
@@ -602447,7 +602720,7 @@ function expandFileReference(ref, cwd4, allowedRoot) {
|
|
|
602447
602720
|
} catch (err) {
|
|
602448
602721
|
return [`${ref.raw}: ${err.message}`, null];
|
|
602449
602722
|
}
|
|
602450
|
-
if (!
|
|
602723
|
+
if (!statSync42(filePath, { throwIfNoEntry: false })?.isFile()) {
|
|
602451
602724
|
return [`${ref.raw}: file not found`, null];
|
|
602452
602725
|
}
|
|
602453
602726
|
if (isBinaryFile(filePath)) {
|
|
@@ -602480,7 +602753,7 @@ function expandFolderReference(ref, cwd4, allowedRoot) {
|
|
|
602480
602753
|
} catch (err) {
|
|
602481
602754
|
return [`${ref.raw}: ${err.message}`, null];
|
|
602482
602755
|
}
|
|
602483
|
-
if (!
|
|
602756
|
+
if (!statSync42(dirPath, { throwIfNoEntry: false })?.isDirectory()) {
|
|
602484
602757
|
return [`${ref.raw}: folder not found`, null];
|
|
602485
602758
|
}
|
|
602486
602759
|
const listing = buildFolderListing(dirPath, cwd4);
|
|
@@ -603607,7 +603880,7 @@ __export(memory_maintenance_exports, {
|
|
|
603607
603880
|
startIdleMemoryMaintenance: () => startIdleMemoryMaintenance
|
|
603608
603881
|
});
|
|
603609
603882
|
import { spawn as spawn27 } from "node:child_process";
|
|
603610
|
-
import { createWriteStream, existsSync as existsSync109, mkdirSync as mkdirSync66, readFileSync as readFileSync89, statSync as
|
|
603883
|
+
import { createWriteStream, existsSync as existsSync109, mkdirSync as mkdirSync66, readFileSync as readFileSync89, statSync as statSync43, writeFileSync as writeFileSync56 } from "node:fs";
|
|
603611
603884
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
603612
603885
|
import { join as join124 } from "node:path";
|
|
603613
603886
|
function startIdleMemoryMaintenance(options2) {
|
|
@@ -603840,7 +604113,7 @@ function writeLastRunAt(repoRoot, value2) {
|
|
|
603840
604113
|
function readLatestSummary(repoRoot) {
|
|
603841
604114
|
const ledgerPath = join124(repoRoot, ".omnius", "memory-maintenance", "runs.jsonl");
|
|
603842
604115
|
try {
|
|
603843
|
-
if (!existsSync109(ledgerPath) ||
|
|
604116
|
+
if (!existsSync109(ledgerPath) || statSync43(ledgerPath).size === 0) return null;
|
|
603844
604117
|
const lines = readFileSync89(ledgerPath, "utf8").split(/\r?\n/).filter(Boolean);
|
|
603845
604118
|
const last2 = lines.at(-1);
|
|
603846
604119
|
if (!last2) return null;
|
|
@@ -604118,7 +604391,7 @@ __export(image_ascii_preview_exports, {
|
|
|
604118
604391
|
isLowInformationAsciiPreview: () => isLowInformationAsciiPreview
|
|
604119
604392
|
});
|
|
604120
604393
|
import { createRequire as createRequire5 } from "node:module";
|
|
604121
|
-
import { existsSync as existsSync110, readFileSync as readFileSync90, statSync as
|
|
604394
|
+
import { existsSync as existsSync110, readFileSync as readFileSync90, statSync as statSync44 } from "node:fs";
|
|
604122
604395
|
import { resolve as resolve54 } from "node:path";
|
|
604123
604396
|
function clamp7(n2, min, max) {
|
|
604124
604397
|
if (!Number.isFinite(n2)) return min;
|
|
@@ -604398,7 +604671,7 @@ async function buildImageAsciiPreview(inputPath, options2 = {}) {
|
|
|
604398
604671
|
const imagePath = resolve54(inputPath);
|
|
604399
604672
|
if (!existsSync110(imagePath)) return null;
|
|
604400
604673
|
try {
|
|
604401
|
-
if (!
|
|
604674
|
+
if (!statSync44(imagePath).isFile()) return null;
|
|
604402
604675
|
} catch {
|
|
604403
604676
|
return null;
|
|
604404
604677
|
}
|
|
@@ -606493,7 +606766,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606493
606766
|
|
|
606494
606767
|
// packages/cli/src/tui/camera-streamer.ts
|
|
606495
606768
|
import { spawn as spawn30 } from "node:child_process";
|
|
606496
|
-
import { existsSync as existsSync113, mkdirSync as mkdirSync70, statSync as
|
|
606769
|
+
import { existsSync as existsSync113, mkdirSync as mkdirSync70, statSync as statSync45, unlinkSync as unlinkSync20 } from "node:fs";
|
|
606497
606770
|
import { join as join128 } from "node:path";
|
|
606498
606771
|
function streamFps(configured) {
|
|
606499
606772
|
const raw = configured ?? Number(process.env["OMNIUS_LIVE_STREAM_FPS"] ?? "");
|
|
@@ -606557,7 +606830,7 @@ var init_camera_streamer = __esm({
|
|
|
606557
606830
|
const stream = this.streams.get(source);
|
|
606558
606831
|
if (!stream || !existsSync113(stream.framePath)) return null;
|
|
606559
606832
|
try {
|
|
606560
|
-
const stats =
|
|
606833
|
+
const stats = statSync45(stream.framePath);
|
|
606561
606834
|
if (!stats.isFile() || stats.size <= 0) return null;
|
|
606562
606835
|
return { path: stream.framePath, mtimeMs: stats.mtimeMs };
|
|
606563
606836
|
} catch {
|
|
@@ -606705,7 +606978,7 @@ var init_camera_streamer = __esm({
|
|
|
606705
606978
|
});
|
|
606706
606979
|
|
|
606707
606980
|
// packages/cli/src/tui/live-vlm.ts
|
|
606708
|
-
import { existsSync as existsSync114, readFileSync as readFileSync93, statSync as
|
|
606981
|
+
import { existsSync as existsSync114, readFileSync as readFileSync93, statSync as statSync46 } from "node:fs";
|
|
606709
606982
|
var DEFAULT_LIVE_VLM_MODEL, MAX_IMAGE_BYTES, VLM_SYSTEM_PROMPT, LiveVlmEngine;
|
|
606710
606983
|
var init_live_vlm = __esm({
|
|
606711
606984
|
"packages/cli/src/tui/live-vlm.ts"() {
|
|
@@ -606827,7 +607100,7 @@ var init_live_vlm = __esm({
|
|
|
606827
607100
|
if (Date.now() - this.lastFailureAt < 2e4) return null;
|
|
606828
607101
|
if (!existsSync114(framePath)) return null;
|
|
606829
607102
|
try {
|
|
606830
|
-
if (
|
|
607103
|
+
if (statSync46(framePath).size > MAX_IMAGE_BYTES) return null;
|
|
606831
607104
|
} catch {
|
|
606832
607105
|
return null;
|
|
606833
607106
|
}
|
|
@@ -622041,7 +622314,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
|
|
|
622041
622314
|
import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
|
|
622042
622315
|
import { URL as URL2 } from "node:url";
|
|
622043
622316
|
import { loadavg as loadavg2, cpus as cpus4, totalmem as totalmem7, freemem as freemem6 } from "node:os";
|
|
622044
|
-
import { existsSync as existsSync119, readFileSync as readFileSync98, writeFileSync as writeFileSync61, unlinkSync as unlinkSync21, mkdirSync as mkdirSync73, readdirSync as readdirSync39, statSync as
|
|
622317
|
+
import { existsSync as existsSync119, readFileSync as readFileSync98, writeFileSync as writeFileSync61, unlinkSync as unlinkSync21, mkdirSync as mkdirSync73, readdirSync as readdirSync39, statSync as statSync47, statfsSync as statfsSync7 } from "node:fs";
|
|
622045
622318
|
import { join as join133 } from "node:path";
|
|
622046
622319
|
function cleanForwardHeaders(raw, targetHost) {
|
|
622047
622320
|
const out = {};
|
|
@@ -623913,7 +624186,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
623913
624186
|
let recentActive = 0;
|
|
623914
624187
|
for (const f2 of files.slice(-10)) {
|
|
623915
624188
|
try {
|
|
623916
|
-
const st =
|
|
624189
|
+
const st = statSync47(join133(invocDir, f2));
|
|
623917
624190
|
if (now2 - st.mtimeMs < 1e4) recentActive++;
|
|
623918
624191
|
} catch {
|
|
623919
624192
|
}
|
|
@@ -625909,7 +626182,7 @@ __export(omnius_directory_exports, {
|
|
|
625909
626182
|
writeIndexMeta: () => writeIndexMeta,
|
|
625910
626183
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
625911
626184
|
});
|
|
625912
|
-
import { appendFileSync as appendFileSync14, cpSync as cpSync2, existsSync as existsSync122, mkdirSync as mkdirSync76, readFileSync as readFileSync101, writeFileSync as writeFileSync64, readdirSync as readdirSync41, statSync as
|
|
626185
|
+
import { appendFileSync as appendFileSync14, cpSync as cpSync2, existsSync as existsSync122, mkdirSync as mkdirSync76, readFileSync as readFileSync101, writeFileSync as writeFileSync64, readdirSync as readdirSync41, statSync as statSync48, unlinkSync as unlinkSync23, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
|
|
625913
626186
|
import { join as join136, relative as relative14, basename as basename26, dirname as dirname40, resolve as resolve58 } from "node:path";
|
|
625914
626187
|
import { homedir as homedir42 } from "node:os";
|
|
625915
626188
|
import { createHash as createHash39 } from "node:crypto";
|
|
@@ -625917,7 +626190,7 @@ function isGitRoot(dir) {
|
|
|
625917
626190
|
const gitPath = join136(dir, ".git");
|
|
625918
626191
|
if (!existsSync122(gitPath)) return false;
|
|
625919
626192
|
try {
|
|
625920
|
-
const stat9 =
|
|
626193
|
+
const stat9 = statSync48(gitPath);
|
|
625921
626194
|
if (stat9.isFile()) {
|
|
625922
626195
|
return readFileSync101(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
625923
626196
|
}
|
|
@@ -626269,7 +626542,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
626269
626542
|
if (!existsSync122(historyDir)) return [];
|
|
626270
626543
|
try {
|
|
626271
626544
|
const files = readdirSync41(historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
|
|
626272
|
-
const stat9 =
|
|
626545
|
+
const stat9 = statSync48(join136(historyDir, f2));
|
|
626273
626546
|
return { file: f2, mtime: stat9.mtimeMs };
|
|
626274
626547
|
}).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
|
|
626275
626548
|
return files.map((f2) => {
|
|
@@ -626530,7 +626803,7 @@ function mergeSessionContextEntry(previous, incoming) {
|
|
|
626530
626803
|
function pruneContextLedger(ledgerPath) {
|
|
626531
626804
|
try {
|
|
626532
626805
|
if (!existsSync122(ledgerPath)) return;
|
|
626533
|
-
const st =
|
|
626806
|
+
const st = statSync48(ledgerPath);
|
|
626534
626807
|
if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
|
|
626535
626808
|
const lines = readFileSync101(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
626536
626809
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
@@ -626804,7 +627077,7 @@ function selectActiveTaskAnchor(repoRoot) {
|
|
|
626804
627077
|
const runId = ledger.runId || name10.replace(/\.json$/, "");
|
|
626805
627078
|
const workboard = readRestoreWorkboard(repoRoot, runId);
|
|
626806
627079
|
const score = scoreRestoreLedger(ledger, workboard);
|
|
626807
|
-
const mtimeMs =
|
|
627080
|
+
const mtimeMs = statSync48(filePath).mtimeMs;
|
|
626808
627081
|
return { ledger: { ...ledger, runId }, workboard, score, mtimeMs };
|
|
626809
627082
|
}).filter((item) => Boolean(item));
|
|
626810
627083
|
candidates.sort((a2, b) => b.score - a2.score || b.mtimeMs - a2.mtimeMs);
|
|
@@ -627499,14 +627772,14 @@ var init_session_summary = __esm({
|
|
|
627499
627772
|
|
|
627500
627773
|
// packages/cli/src/tui/cad-model-viewer.ts
|
|
627501
627774
|
import { createServer as createServer7 } from "node:http";
|
|
627502
|
-
import { existsSync as existsSync123, readFileSync as readFileSync102, statSync as
|
|
627775
|
+
import { existsSync as existsSync123, readFileSync as readFileSync102, statSync as statSync49 } from "node:fs";
|
|
627503
627776
|
import { basename as basename27, extname as extname16, resolve as resolve59 } from "node:path";
|
|
627504
627777
|
function getCurrentCadModelViewer() {
|
|
627505
627778
|
return currentViewer;
|
|
627506
627779
|
}
|
|
627507
627780
|
async function startCadModelViewer(filePath) {
|
|
627508
627781
|
const resolved = filePath ? resolve59(filePath) : void 0;
|
|
627509
|
-
if (resolved && (!existsSync123(resolved) || !
|
|
627782
|
+
if (resolved && (!existsSync123(resolved) || !statSync49(resolved).isFile())) {
|
|
627510
627783
|
throw new Error(`3D model file not found: ${resolved}`);
|
|
627511
627784
|
}
|
|
627512
627785
|
if (currentViewer) {
|
|
@@ -635092,7 +635365,7 @@ __export(personaplex_exports, {
|
|
|
635092
635365
|
startPersonaPlexDaemon: () => startPersonaPlexDaemon,
|
|
635093
635366
|
stopPersonaPlex: () => stopPersonaPlex
|
|
635094
635367
|
});
|
|
635095
|
-
import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as readFileSync106, mkdirSync as mkdirSync78, copyFileSync as copyFileSync5, readdirSync as readdirSync42, statSync as
|
|
635368
|
+
import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as readFileSync106, mkdirSync as mkdirSync78, copyFileSync as copyFileSync5, readdirSync as readdirSync42, statSync as statSync50 } from "node:fs";
|
|
635096
635369
|
import { join as join141, dirname as dirname43 } from "node:path";
|
|
635097
635370
|
import { homedir as homedir45 } from "node:os";
|
|
635098
635371
|
import { spawn as spawn33 } from "node:child_process";
|
|
@@ -635627,7 +635900,7 @@ print('Converted')
|
|
|
635627
635900
|
}
|
|
635628
635901
|
if (existsSync127(cachedBf16)) {
|
|
635629
635902
|
extraArgs.push("--moshi-weight", cachedBf16);
|
|
635630
|
-
log22(`Using distilled weights: ${(
|
|
635903
|
+
log22(`Using distilled weights: ${(statSync50(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
|
|
635631
635904
|
} else {
|
|
635632
635905
|
extraArgs.push("--moshi-weight", weightPath);
|
|
635633
635906
|
}
|
|
@@ -635658,7 +635931,7 @@ print('Converted')
|
|
|
635658
635931
|
);
|
|
635659
635932
|
if (existsSync127(cachedBf16)) {
|
|
635660
635933
|
extraArgs.push("--moshi-weight", cachedBf16);
|
|
635661
|
-
log22(`Using dequantized cache: ${(
|
|
635934
|
+
log22(`Using dequantized cache: ${(statSync50(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
|
|
635662
635935
|
}
|
|
635663
635936
|
} catch (e2) {
|
|
635664
635937
|
log22(`Dequantization failed — server will try to load original weights`);
|
|
@@ -639726,7 +639999,7 @@ var init_platforms = __esm({
|
|
|
639726
639999
|
});
|
|
639727
640000
|
|
|
639728
640001
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
639729
|
-
import { existsSync as existsSync130, readdirSync as readdirSync43, readFileSync as readFileSync108, statSync as
|
|
640002
|
+
import { existsSync as existsSync130, readdirSync as readdirSync43, readFileSync as readFileSync108, statSync as statSync51 } from "node:fs";
|
|
639730
640003
|
import { basename as basename28, extname as extname17, join as join143, relative as relative15, resolve as resolve60 } from "node:path";
|
|
639731
640004
|
function exploreWorkspace(root, options2 = {}) {
|
|
639732
640005
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
@@ -639763,7 +640036,7 @@ function exploreWorkspace(root, options2 = {}) {
|
|
|
639763
640036
|
const rel = relative15(root, full).replace(/\\/g, "/");
|
|
639764
640037
|
if (query && !rel.toLowerCase().includes(query)) continue;
|
|
639765
640038
|
try {
|
|
639766
|
-
const st =
|
|
640039
|
+
const st = statSync51(full);
|
|
639767
640040
|
entries.push({
|
|
639768
640041
|
path: rel,
|
|
639769
640042
|
sizeBytes: st.size,
|
|
@@ -639815,7 +640088,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
|
639815
640088
|
throw new Error("File path escapes workspace root");
|
|
639816
640089
|
}
|
|
639817
640090
|
if (!existsSync130(full)) throw new Error(`File not found: ${relPath}`);
|
|
639818
|
-
const st =
|
|
640091
|
+
const st = statSync51(full);
|
|
639819
640092
|
if (!st.isFile()) throw new Error(`Not a file: ${relPath}`);
|
|
639820
640093
|
if (st.size > maxBytes) {
|
|
639821
640094
|
return [
|
|
@@ -643999,7 +644272,7 @@ __export(kg_prune_exports, {
|
|
|
643999
644272
|
pruneKnowledgeGraph: () => pruneKnowledgeGraph,
|
|
644000
644273
|
pruneKnowledgeGraphWithInference: () => pruneKnowledgeGraphWithInference
|
|
644001
644274
|
});
|
|
644002
|
-
import { existsSync as existsSync137, statSync as
|
|
644275
|
+
import { existsSync as existsSync137, statSync as statSync53 } from "node:fs";
|
|
644003
644276
|
import { join as join149 } from "node:path";
|
|
644004
644277
|
function stateDirFor(workingDir) {
|
|
644005
644278
|
return join149(workingDir, ".omnius");
|
|
@@ -644019,13 +644292,13 @@ function knowledgeGraphStats(workingDir) {
|
|
|
644019
644292
|
};
|
|
644020
644293
|
if (stats.exists) {
|
|
644021
644294
|
try {
|
|
644022
|
-
stats.sizeBytes =
|
|
644295
|
+
stats.sizeBytes = statSync53(dbPath).size;
|
|
644023
644296
|
} catch {
|
|
644024
644297
|
}
|
|
644025
644298
|
}
|
|
644026
644299
|
if (existsSync137(archivePath)) {
|
|
644027
644300
|
try {
|
|
644028
|
-
stats.archiveSizeBytes =
|
|
644301
|
+
stats.archiveSizeBytes = statSync53(archivePath).size;
|
|
644029
644302
|
} catch {
|
|
644030
644303
|
}
|
|
644031
644304
|
}
|
|
@@ -646577,7 +646850,7 @@ import {
|
|
|
646577
646850
|
readFileSync as readFileSync115,
|
|
646578
646851
|
unlinkSync as unlinkSync29,
|
|
646579
646852
|
readdirSync as readdirSync46,
|
|
646580
|
-
statSync as
|
|
646853
|
+
statSync as statSync54,
|
|
646581
646854
|
copyFileSync as copyFileSync6,
|
|
646582
646855
|
rmSync as rmSync11
|
|
646583
646856
|
} from "node:fs";
|
|
@@ -646711,7 +646984,7 @@ function mergeDir2(src2, dst) {
|
|
|
646711
646984
|
if (entry.isDirectory()) {
|
|
646712
646985
|
mergeDir2(s2, d2);
|
|
646713
646986
|
} else if (entry.isFile()) {
|
|
646714
|
-
if (!existsSync141(d2) ||
|
|
646987
|
+
if (!existsSync141(d2) || statSync54(s2).mtimeMs > statSync54(d2).mtimeMs) {
|
|
646715
646988
|
copyFileSync6(s2, d2);
|
|
646716
646989
|
}
|
|
646717
646990
|
}
|
|
@@ -648194,7 +648467,7 @@ except Exception as exc:
|
|
|
648194
648467
|
const p2 = join153(dir, f2);
|
|
648195
648468
|
let size = 0;
|
|
648196
648469
|
try {
|
|
648197
|
-
size =
|
|
648470
|
+
size = statSync54(p2).size;
|
|
648198
648471
|
} catch {
|
|
648199
648472
|
}
|
|
648200
648473
|
const entry = meta[f2];
|
|
@@ -651173,7 +651446,7 @@ import {
|
|
|
651173
651446
|
mkdirSync as mkdirSync85,
|
|
651174
651447
|
readdirSync as readdirSync47,
|
|
651175
651448
|
lstatSync as lstatSync2,
|
|
651176
|
-
statSync as
|
|
651449
|
+
statSync as statSync55,
|
|
651177
651450
|
rmSync as rmSync12,
|
|
651178
651451
|
appendFileSync as appendFileSync16,
|
|
651179
651452
|
writeSync as writeSync2
|
|
@@ -653982,7 +654255,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
653982
654255
|
ipfsFiles = files.length;
|
|
653983
654256
|
for (const f2 of files) {
|
|
653984
654257
|
try {
|
|
653985
|
-
ipfsBytes +=
|
|
654258
|
+
ipfsBytes += statSync55(join154(ipfsLocalDir, f2)).size;
|
|
653986
654259
|
} catch {
|
|
653987
654260
|
}
|
|
653988
654261
|
}
|
|
@@ -653995,7 +654268,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
653995
654268
|
else {
|
|
653996
654269
|
heliaBlocks++;
|
|
653997
654270
|
try {
|
|
653998
|
-
heliaBytes +=
|
|
654271
|
+
heliaBytes += statSync55(join154(dir, entry.name)).size;
|
|
653999
654272
|
} catch {
|
|
654000
654273
|
}
|
|
654001
654274
|
}
|
|
@@ -654138,7 +654411,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
654138
654411
|
lines.push(`
|
|
654139
654412
|
${c3.bold("Structured Memory (SQLite)")}`);
|
|
654140
654413
|
lines.push(
|
|
654141
|
-
` Memories: ${c3.bold(String(count))} DB: ${c3.dim(formatFileSize(
|
|
654414
|
+
` Memories: ${c3.bold(String(count))} DB: ${c3.dim(formatFileSize(statSync55(dbPath).size))}`
|
|
654142
654415
|
);
|
|
654143
654416
|
cDb(db);
|
|
654144
654417
|
}
|
|
@@ -654170,7 +654443,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
654170
654443
|
walkStorage(full, subCat);
|
|
654171
654444
|
} else {
|
|
654172
654445
|
try {
|
|
654173
|
-
const sz =
|
|
654446
|
+
const sz = statSync55(full).size;
|
|
654174
654447
|
totalBytes += sz;
|
|
654175
654448
|
if (!categories[category])
|
|
654176
654449
|
categories[category] = { files: 0, bytes: 0 };
|
|
@@ -661330,7 +661603,7 @@ async function showCohereDashboard(ctx3) {
|
|
|
661330
661603
|
const snapItems = snaps.slice(0, 20).map((f2) => ({
|
|
661331
661604
|
key: f2,
|
|
661332
661605
|
label: f2.replace(".json", ""),
|
|
661333
|
-
detail: `${formatFileSize(
|
|
661606
|
+
detail: `${formatFileSize(statSync55(join154(snapDir, f2)).size)}`
|
|
661334
661607
|
}));
|
|
661335
661608
|
if (snapItems.length > 0) {
|
|
661336
661609
|
await tuiSelect({
|
|
@@ -667974,7 +668247,7 @@ var init_commands = __esm({
|
|
|
667974
668247
|
});
|
|
667975
668248
|
|
|
667976
668249
|
// packages/cli/src/tui/project-context.ts
|
|
667977
|
-
import { existsSync as existsSync143, readFileSync as readFileSync117, readdirSync as readdirSync48, mkdirSync as mkdirSync86, statSync as
|
|
668250
|
+
import { existsSync as existsSync143, readFileSync as readFileSync117, readdirSync as readdirSync48, mkdirSync as mkdirSync86, statSync as statSync56, writeFileSync as writeFileSync74 } from "node:fs";
|
|
667978
668251
|
import { dirname as dirname47, join as join155, basename as basename30, resolve as resolve63 } from "node:path";
|
|
667979
668252
|
import { homedir as homedir53 } from "node:os";
|
|
667980
668253
|
function projectContextUrlSpanAt(text2, index) {
|
|
@@ -668636,7 +668909,7 @@ function safeReadDir(dir) {
|
|
|
668636
668909
|
}
|
|
668637
668910
|
function isDirectory2(path12) {
|
|
668638
668911
|
try {
|
|
668639
|
-
return
|
|
668912
|
+
return statSync56(path12).isDirectory();
|
|
668640
668913
|
} catch {
|
|
668641
668914
|
return false;
|
|
668642
668915
|
}
|
|
@@ -678156,7 +678429,7 @@ import {
|
|
|
678156
678429
|
existsSync as existsSync153,
|
|
678157
678430
|
mkdirSync as mkdirSync94,
|
|
678158
678431
|
readFileSync as readFileSync126,
|
|
678159
|
-
statSync as
|
|
678432
|
+
statSync as statSync57,
|
|
678160
678433
|
unlinkSync as unlinkSync32,
|
|
678161
678434
|
writeFileSync as writeFileSync81
|
|
678162
678435
|
} from "node:fs";
|
|
@@ -678669,7 +678942,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
678669
678942
|
}
|
|
678670
678943
|
function safeStatFile(path12) {
|
|
678671
678944
|
try {
|
|
678672
|
-
return
|
|
678945
|
+
return statSync57(path12).isFile();
|
|
678673
678946
|
} catch {
|
|
678674
678947
|
return false;
|
|
678675
678948
|
}
|
|
@@ -678941,7 +679214,7 @@ ${(result.error || result.output || "").slice(0, 1200)}`,
|
|
|
678941
679214
|
for (const fn of cleanup) fn();
|
|
678942
679215
|
}
|
|
678943
679216
|
rememberCreated(this.root, guarded.path.abs);
|
|
678944
|
-
const sizeKB = Math.round(
|
|
679217
|
+
const sizeKB = Math.round(statSync57(guarded.path.abs).size / 1024);
|
|
678945
679218
|
this.emitProgress(start2, {
|
|
678946
679219
|
stage: "save",
|
|
678947
679220
|
message: `Saved scoped audio file (${sizeKB}KB)`
|
|
@@ -682334,7 +682607,7 @@ import {
|
|
|
682334
682607
|
existsSync as existsSync156,
|
|
682335
682608
|
unlinkSync as unlinkSync35,
|
|
682336
682609
|
readdirSync as readdirSync56,
|
|
682337
|
-
statSync as
|
|
682610
|
+
statSync as statSync58,
|
|
682338
682611
|
readFileSync as readFileSync129,
|
|
682339
682612
|
writeFileSync as writeFileSync83,
|
|
682340
682613
|
appendFileSync as appendFileSync19
|
|
@@ -687288,7 +687561,7 @@ Model: <code>${escapeTelegramHTML(model.id)}</code>`
|
|
|
687288
687561
|
}
|
|
687289
687562
|
let sent = 0;
|
|
687290
687563
|
for (const path12 of paths) {
|
|
687291
|
-
if (!existsSync156(path12) || !
|
|
687564
|
+
if (!existsSync156(path12) || !statSync58(path12).isFile()) continue;
|
|
687292
687565
|
const kind = classifyMedia(path12) ?? "document";
|
|
687293
687566
|
const messageId = await this.sendMediaReference(
|
|
687294
687567
|
msg.chatId,
|
|
@@ -699617,7 +699890,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
699617
699890
|
const abs = isAbsolute14(trimmed) ? resolve68(trimmed) : resolve68(base3, trimmed);
|
|
699618
699891
|
if (!existsSync156(abs))
|
|
699619
699892
|
return { ok: false, error: `File does not exist: ${trimmed}` };
|
|
699620
|
-
if (!
|
|
699893
|
+
if (!statSync58(abs).isFile())
|
|
699621
699894
|
return { ok: false, error: `Path is not a file: ${trimmed}` };
|
|
699622
699895
|
return { ok: true, path: abs };
|
|
699623
699896
|
}
|
|
@@ -700131,7 +700404,7 @@ ${text2}`.trim()
|
|
|
700131
700404
|
}
|
|
700132
700405
|
async sendTelegramFileToChat(chatId, path12, options2) {
|
|
700133
700406
|
const abs = resolve68(path12);
|
|
700134
|
-
if (!existsSync156(abs) || !
|
|
700407
|
+
if (!existsSync156(abs) || !statSync58(abs).isFile()) {
|
|
700135
700408
|
throw new Error(`File does not exist or is not a regular file: ${path12}`);
|
|
700136
700409
|
}
|
|
700137
700410
|
return this.sendMediaReferenceStrict(
|
|
@@ -700401,7 +700674,7 @@ Content-Type: ${contentType}\r
|
|
|
700401
700674
|
for (const path12 of paths) {
|
|
700402
700675
|
const abs = resolve68(path12);
|
|
700403
700676
|
if (subAgent.deliveredArtifacts.includes(abs)) continue;
|
|
700404
|
-
if (!existsSync156(abs) || !
|
|
700677
|
+
if (!existsSync156(abs) || !statSync58(abs).isFile()) continue;
|
|
700405
700678
|
subAgent.deliveredArtifacts.push(abs);
|
|
700406
700679
|
await this.sendMediaReference(
|
|
700407
700680
|
msg.chatId,
|
|
@@ -700443,7 +700716,7 @@ Content-Type: ${contentType}\r
|
|
|
700443
700716
|
abs
|
|
700444
700717
|
);
|
|
700445
700718
|
if (!materialized.ok) continue;
|
|
700446
|
-
if (!existsSync156(materialized.path) || !
|
|
700719
|
+
if (!existsSync156(materialized.path) || !statSync58(materialized.path).isFile()) {
|
|
700447
700720
|
materialized.cleanup?.();
|
|
700448
700721
|
continue;
|
|
700449
700722
|
}
|
|
@@ -702631,7 +702904,7 @@ __export(projects_exports, {
|
|
|
702631
702904
|
setCurrentProject: () => setCurrentProject,
|
|
702632
702905
|
unregisterProject: () => unregisterProject
|
|
702633
702906
|
});
|
|
702634
|
-
import { readFileSync as readFileSync130, writeFileSync as writeFileSync84, mkdirSync as mkdirSync97, existsSync as existsSync157, statSync as
|
|
702907
|
+
import { readFileSync as readFileSync130, writeFileSync as writeFileSync84, mkdirSync as mkdirSync97, existsSync as existsSync157, statSync as statSync59, renameSync as renameSync14 } from "node:fs";
|
|
702635
702908
|
import { homedir as homedir56 } from "node:os";
|
|
702636
702909
|
import { basename as basename41, join as join169, resolve as resolve69 } from "node:path";
|
|
702637
702910
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
@@ -702657,7 +702930,7 @@ function listProjects() {
|
|
|
702657
702930
|
const alive = [];
|
|
702658
702931
|
for (const p2 of projects) {
|
|
702659
702932
|
try {
|
|
702660
|
-
if (
|
|
702933
|
+
if (statSync59(p2.root).isDirectory()) alive.push(p2);
|
|
702661
702934
|
} catch {
|
|
702662
702935
|
}
|
|
702663
702936
|
}
|
|
@@ -703803,7 +704076,7 @@ var init_audit_log = __esm({
|
|
|
703803
704076
|
|
|
703804
704077
|
// packages/cli/src/api/disk-task-output.ts
|
|
703805
704078
|
import { open } from "node:fs/promises";
|
|
703806
|
-
import { existsSync as existsSync160, mkdirSync as mkdirSync100, statSync as
|
|
704079
|
+
import { existsSync as existsSync160, mkdirSync as mkdirSync100, statSync as statSync60 } from "node:fs";
|
|
703807
704080
|
import { dirname as dirname51 } from "node:path";
|
|
703808
704081
|
import * as fsConstants from "node:constants";
|
|
703809
704082
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
@@ -703902,7 +704175,7 @@ var init_disk_task_output = __esm({
|
|
|
703902
704175
|
if (!existsSync160(this.path)) {
|
|
703903
704176
|
return { content: "", nextOffset: offset, eof: true, size: 0 };
|
|
703904
704177
|
}
|
|
703905
|
-
const st =
|
|
704178
|
+
const st = statSync60(this.path);
|
|
703906
704179
|
if (offset >= st.size) {
|
|
703907
704180
|
return { content: "", nextOffset: offset, eof: true, size: st.size };
|
|
703908
704181
|
}
|
|
@@ -704090,7 +704363,7 @@ data: ${JSON.stringify(ev)}
|
|
|
704090
704363
|
});
|
|
704091
704364
|
|
|
704092
704365
|
// packages/cli/src/api/routes-media.ts
|
|
704093
|
-
import { existsSync as existsSync161, mkdirSync as mkdirSync101, statSync as
|
|
704366
|
+
import { existsSync as existsSync161, mkdirSync as mkdirSync101, statSync as statSync61, copyFileSync as copyFileSync7, createReadStream } from "node:fs";
|
|
704094
704367
|
import { basename as basename42, join as join172, resolve as pathResolve2 } from "node:path";
|
|
704095
704368
|
function mediaWorkDir() {
|
|
704096
704369
|
return join172(omniusHomeDir(), "media", "_work");
|
|
@@ -704391,7 +704664,7 @@ async function runGeneration(ctx3, kind, buildTool, buildArgs) {
|
|
|
704391
704664
|
const published = publishToGallery(srcPath, kind);
|
|
704392
704665
|
const size = (() => {
|
|
704393
704666
|
try {
|
|
704394
|
-
return
|
|
704667
|
+
return statSync61(published.path).size;
|
|
704395
704668
|
} catch {
|
|
704396
704669
|
return 0;
|
|
704397
704670
|
}
|
|
@@ -704498,7 +704771,7 @@ function handleFile(ctx3) {
|
|
|
704498
704771
|
const ext = full.slice(full.lastIndexOf(".")).toLowerCase();
|
|
704499
704772
|
ctx3.res.writeHead(200, {
|
|
704500
704773
|
"Content-Type": MIME_BY_EXT[ext] || "application/octet-stream",
|
|
704501
|
-
"Content-Length":
|
|
704774
|
+
"Content-Length": statSync61(full).size,
|
|
704502
704775
|
"Cache-Control": "private, max-age=3600"
|
|
704503
704776
|
});
|
|
704504
704777
|
createReadStream(full).pipe(ctx3.res);
|
|
@@ -705087,7 +705360,7 @@ __export(aiwg_exports, {
|
|
|
705087
705360
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
705088
705361
|
tryRouteAiwg: () => tryRouteAiwg
|
|
705089
705362
|
});
|
|
705090
|
-
import { existsSync as existsSync163, readFileSync as readFileSync134, readdirSync as readdirSync57, statSync as
|
|
705363
|
+
import { existsSync as existsSync163, readFileSync as readFileSync134, readdirSync as readdirSync57, statSync as statSync62 } from "node:fs";
|
|
705091
705364
|
import { join as join174 } from "node:path";
|
|
705092
705365
|
import { homedir as homedir58 } from "node:os";
|
|
705093
705366
|
import { execSync as execSync38 } from "node:child_process";
|
|
@@ -705189,7 +705462,7 @@ function listAiwgFrameworks() {
|
|
|
705189
705462
|
for (const name10 of readdirSync57(frameworksDir)) {
|
|
705190
705463
|
const p2 = join174(frameworksDir, name10);
|
|
705191
705464
|
try {
|
|
705192
|
-
const st =
|
|
705465
|
+
const st = statSync62(p2);
|
|
705193
705466
|
if (!st.isDirectory()) continue;
|
|
705194
705467
|
const agg = aggregateDir(p2);
|
|
705195
705468
|
out.push({
|
|
@@ -705226,7 +705499,7 @@ function aggregateDir(dir, depth = 0) {
|
|
|
705226
705499
|
out.commands += sub2.commands;
|
|
705227
705500
|
} else if (e2.isFile()) {
|
|
705228
705501
|
try {
|
|
705229
|
-
const st =
|
|
705502
|
+
const st = statSync62(p2);
|
|
705230
705503
|
out.files++;
|
|
705231
705504
|
out.bytes += st.size;
|
|
705232
705505
|
if (e2.name.endsWith(".md")) {
|
|
@@ -705360,7 +705633,7 @@ function listAiwgAddons() {
|
|
|
705360
705633
|
for (const name10 of readdirSync57(addonsDir)) {
|
|
705361
705634
|
const p2 = join174(addonsDir, name10);
|
|
705362
705635
|
try {
|
|
705363
|
-
const st =
|
|
705636
|
+
const st = statSync62(p2);
|
|
705364
705637
|
if (!st.isDirectory()) continue;
|
|
705365
705638
|
const agg = aggregateDir(p2);
|
|
705366
705639
|
out.push({
|
|
@@ -706245,7 +706518,7 @@ var init_graphical_sudo = __esm({
|
|
|
706245
706518
|
});
|
|
706246
706519
|
|
|
706247
706520
|
// packages/cli/src/api/routes-v1.ts
|
|
706248
|
-
import { existsSync as existsSync167, mkdirSync as mkdirSync105, readFileSync as readFileSync137, readdirSync as readdirSync58, statSync as
|
|
706521
|
+
import { existsSync as existsSync167, mkdirSync as mkdirSync105, readFileSync as readFileSync137, readdirSync as readdirSync58, statSync as statSync63 } from "node:fs";
|
|
706249
706522
|
import { join as join178, resolve as pathResolve3 } from "node:path";
|
|
706250
706523
|
import { homedir as homedir61 } from "node:os";
|
|
706251
706524
|
async function tryRouteV1(ctx3) {
|
|
@@ -707463,7 +707736,7 @@ async function handleFilesRead(ctx3) {
|
|
|
707463
707736
|
}));
|
|
707464
707737
|
return true;
|
|
707465
707738
|
}
|
|
707466
|
-
const st =
|
|
707739
|
+
const st = statSync63(resolved);
|
|
707467
707740
|
if (st.isDirectory()) {
|
|
707468
707741
|
sendProblem(res, problemDetails({
|
|
707469
707742
|
type: P2.invalidRequest,
|
|
@@ -722653,7 +722926,7 @@ import {
|
|
|
722653
722926
|
watch as fsWatch4,
|
|
722654
722927
|
renameSync as renameSync17,
|
|
722655
722928
|
unlinkSync as unlinkSync37,
|
|
722656
|
-
statSync as
|
|
722929
|
+
statSync as statSync64,
|
|
722657
722930
|
openSync as openSync6,
|
|
722658
722931
|
readSync as readSync2,
|
|
722659
722932
|
closeSync as closeSync6
|
|
@@ -723013,7 +723286,7 @@ function fileEntryMetadata(dir, entry) {
|
|
|
723013
723286
|
kind: fileKindForPath(entry.name)
|
|
723014
723287
|
};
|
|
723015
723288
|
try {
|
|
723016
|
-
const st =
|
|
723289
|
+
const st = statSync64(target);
|
|
723017
723290
|
meta["size"] = st.size;
|
|
723018
723291
|
meta["mtime"] = new Date(st.mtimeMs).toISOString();
|
|
723019
723292
|
} catch {
|
|
@@ -723025,7 +723298,7 @@ function contentDispositionName(filePath) {
|
|
|
723025
723298
|
return name10.replace(/["\r\n]/g, "");
|
|
723026
723299
|
}
|
|
723027
723300
|
function streamWorkspaceFile(req3, res, target) {
|
|
723028
|
-
const st =
|
|
723301
|
+
const st = statSync64(target);
|
|
723029
723302
|
if (!st.isFile()) {
|
|
723030
723303
|
jsonResponse(res, 400, { error: "Path is not a file", path: target });
|
|
723031
723304
|
return;
|
|
@@ -727022,7 +727295,7 @@ function handleV1RunsById(res, id2) {
|
|
|
727022
727295
|
const enriched = { ...job };
|
|
727023
727296
|
if (outputFile && existsSync170(outputFile)) {
|
|
727024
727297
|
try {
|
|
727025
|
-
const size =
|
|
727298
|
+
const size = statSync64(outputFile).size;
|
|
727026
727299
|
const tailSize = Math.min(size, 4096);
|
|
727027
727300
|
const buffer2 = Buffer.alloc(tailSize);
|
|
727028
727301
|
const fd = openSync6(outputFile, "r");
|
|
@@ -727670,7 +727943,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
727670
727943
|
const dir = path12.dirname(cssEntry);
|
|
727671
727944
|
const fullPath = path12.join(dir, entry.path);
|
|
727672
727945
|
if (fs11.existsSync(fullPath)) {
|
|
727673
|
-
const stat9 =
|
|
727946
|
+
const stat9 = statSync64(fullPath);
|
|
727674
727947
|
res.writeHead(200, {
|
|
727675
727948
|
"Content-Type": entry.ct,
|
|
727676
727949
|
"Content-Length": String(stat9.size),
|
|
@@ -728222,17 +728495,17 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
728222
728495
|
const child = join182(dir, e2.name);
|
|
728223
728496
|
const omniusDir = join182(child, ".omnius");
|
|
728224
728497
|
try {
|
|
728225
|
-
if (
|
|
728498
|
+
if (statSync64(omniusDir).isDirectory()) {
|
|
728226
728499
|
const name10 = e2.name;
|
|
728227
728500
|
const prefsFile = join182(omniusDir, "config.json");
|
|
728228
728501
|
let lastSeen = 0;
|
|
728229
728502
|
try {
|
|
728230
|
-
lastSeen =
|
|
728503
|
+
lastSeen = statSync64(prefsFile).mtimeMs;
|
|
728231
728504
|
} catch {
|
|
728232
728505
|
}
|
|
728233
728506
|
if (!lastSeen) {
|
|
728234
728507
|
try {
|
|
728235
|
-
lastSeen =
|
|
728508
|
+
lastSeen = statSync64(omniusDir).mtimeMs;
|
|
728236
728509
|
} catch {
|
|
728237
728510
|
}
|
|
728238
728511
|
}
|
|
@@ -728281,17 +728554,17 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
728281
728554
|
const child = join182(dir, e2.name);
|
|
728282
728555
|
const omniusDir = join182(child, ".omnius");
|
|
728283
728556
|
try {
|
|
728284
|
-
if (
|
|
728557
|
+
if (statSync64(omniusDir).isDirectory()) {
|
|
728285
728558
|
const name10 = e2.name;
|
|
728286
728559
|
const prefsFile = join182(omniusDir, "config.json");
|
|
728287
728560
|
let lastSeen = 0;
|
|
728288
728561
|
try {
|
|
728289
|
-
lastSeen =
|
|
728562
|
+
lastSeen = statSync64(prefsFile).mtimeMs;
|
|
728290
728563
|
} catch {
|
|
728291
728564
|
}
|
|
728292
728565
|
if (!lastSeen) {
|
|
728293
728566
|
try {
|
|
728294
|
-
lastSeen =
|
|
728567
|
+
lastSeen = statSync64(omniusDir).mtimeMs;
|
|
728295
728568
|
} catch {
|
|
728296
728569
|
}
|
|
728297
728570
|
}
|
|
@@ -733312,7 +733585,7 @@ import {
|
|
|
733312
733585
|
appendFileSync as appendFileSync21,
|
|
733313
733586
|
rmSync as rmSync16,
|
|
733314
733587
|
readdirSync as readdirSync60,
|
|
733315
|
-
statSync as
|
|
733588
|
+
statSync as statSync65,
|
|
733316
733589
|
mkdirSync as mkdirSync110
|
|
733317
733590
|
} from "node:fs";
|
|
733318
733591
|
import { existsSync as existsSync171 } from "node:fs";
|
|
@@ -738701,7 +738974,7 @@ This is an independent background session started from /background.`
|
|
|
738701
738974
|
if (!entry.startsWith(partialName)) continue;
|
|
738702
738975
|
const full = join184(searchDir, entry);
|
|
738703
738976
|
try {
|
|
738704
|
-
const st =
|
|
738977
|
+
const st = statSync65(full);
|
|
738705
738978
|
const suffix = st.isDirectory() ? "/" : "";
|
|
738706
738979
|
const display = isAbsolute15 ? full : full.startsWith(repoRoot + sep5) ? full.slice(repoRoot.length + 1) : full;
|
|
738707
738980
|
completions.push(display + suffix);
|
|
@@ -741365,11 +741638,11 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
741365
741638
|
}
|
|
741366
741639
|
if (name10 === "voice_list_files") {
|
|
741367
741640
|
const baseDir = String(args?.dir ?? ".");
|
|
741368
|
-
const { readdirSync: readdirSync62, statSync:
|
|
741641
|
+
const { readdirSync: readdirSync62, statSync: statSync67 } = __require("node:fs");
|
|
741369
741642
|
const { join: join189, resolve: resolve77 } = __require("node:path");
|
|
741370
741643
|
const base3 = baseDir.startsWith("/") ? baseDir : resolve77(join189(repoRoot, baseDir));
|
|
741371
741644
|
const items = readdirSync62(base3).slice(0, 200).map((f2) => {
|
|
741372
|
-
const s2 =
|
|
741645
|
+
const s2 = statSync67(join189(base3, f2));
|
|
741373
741646
|
return { name: f2, dir: s2.isDirectory(), size: s2.size };
|
|
741374
741647
|
});
|
|
741375
741648
|
return JSON.stringify({ dir: base3, items }, null, 2);
|
|
@@ -744153,7 +744426,7 @@ __export(index_repo_exports, {
|
|
|
744153
744426
|
indexRepoCommand: () => indexRepoCommand
|
|
744154
744427
|
});
|
|
744155
744428
|
import { resolve as resolve75 } from "node:path";
|
|
744156
|
-
import { existsSync as existsSync173, statSync as
|
|
744429
|
+
import { existsSync as existsSync173, statSync as statSync66 } from "node:fs";
|
|
744157
744430
|
import { cwd as cwd2 } from "node:process";
|
|
744158
744431
|
async function indexRepoCommand(opts, _config3) {
|
|
744159
744432
|
const repoRoot = resolve75(opts.repoPath ?? cwd2());
|
|
@@ -744163,7 +744436,7 @@ async function indexRepoCommand(opts, _config3) {
|
|
|
744163
744436
|
printError(`Path does not exist: ${repoRoot}`);
|
|
744164
744437
|
process.exit(1);
|
|
744165
744438
|
}
|
|
744166
|
-
const stat9 =
|
|
744439
|
+
const stat9 = statSync66(repoRoot);
|
|
744167
744440
|
if (!stat9.isDirectory()) {
|
|
744168
744441
|
printError(`Path is not a directory: ${repoRoot}`);
|
|
744169
744442
|
process.exit(1);
|