omnius 1.0.414 → 1.0.415
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 +431 -421
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -146128,7 +146128,7 @@ var require_client_h1 = __commonJS({
|
|
|
146128
146128
|
kHTTPContext,
|
|
146129
146129
|
kClosed
|
|
146130
146130
|
} = require_symbols();
|
|
146131
|
-
var
|
|
146131
|
+
var constants2 = require_constants2();
|
|
146132
146132
|
var EMPTY_BUF = Buffer.alloc(0);
|
|
146133
146133
|
var FastBuffer = Buffer[Symbol.species];
|
|
146134
146134
|
var removeAllListeners = util2.removeAllListeners;
|
|
@@ -146254,7 +146254,7 @@ var require_client_h1 = __commonJS({
|
|
|
146254
146254
|
*/
|
|
146255
146255
|
constructor(client, socket, { exports: exports2 }) {
|
|
146256
146256
|
this.llhttp = exports2;
|
|
146257
|
-
this.ptr = this.llhttp.llhttp_alloc(
|
|
146257
|
+
this.ptr = this.llhttp.llhttp_alloc(constants2.TYPE.RESPONSE);
|
|
146258
146258
|
this.client = client;
|
|
146259
146259
|
this.socket = socket;
|
|
146260
146260
|
this.timeout = null;
|
|
@@ -146349,11 +146349,11 @@ var require_client_h1 = __commonJS({
|
|
|
146349
146349
|
currentParser = null;
|
|
146350
146350
|
currentBufferRef = null;
|
|
146351
146351
|
}
|
|
146352
|
-
if (ret !==
|
|
146352
|
+
if (ret !== constants2.ERROR.OK) {
|
|
146353
146353
|
const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
|
|
146354
|
-
if (ret ===
|
|
146354
|
+
if (ret === constants2.ERROR.PAUSED_UPGRADE) {
|
|
146355
146355
|
this.onUpgrade(data);
|
|
146356
|
-
} else if (ret ===
|
|
146356
|
+
} else if (ret === constants2.ERROR.PAUSED) {
|
|
146357
146357
|
this.paused = true;
|
|
146358
146358
|
socket.unshift(data);
|
|
146359
146359
|
} else {
|
|
@@ -146363,7 +146363,7 @@ var require_client_h1 = __commonJS({
|
|
|
146363
146363
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
146364
146364
|
message2 = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
146365
146365
|
}
|
|
146366
|
-
throw new HTTPParserError(message2,
|
|
146366
|
+
throw new HTTPParserError(message2, constants2.ERROR[ret], data);
|
|
146367
146367
|
}
|
|
146368
146368
|
}
|
|
146369
146369
|
} catch (err) {
|
|
@@ -146570,7 +146570,7 @@ var require_client_h1 = __commonJS({
|
|
|
146570
146570
|
socket[kBlocking] = false;
|
|
146571
146571
|
client[kResume]();
|
|
146572
146572
|
}
|
|
146573
|
-
return pause ?
|
|
146573
|
+
return pause ? constants2.ERROR.PAUSED : 0;
|
|
146574
146574
|
}
|
|
146575
146575
|
/**
|
|
146576
146576
|
* @param {Buffer} buf
|
|
@@ -146596,7 +146596,7 @@ var require_client_h1 = __commonJS({
|
|
|
146596
146596
|
}
|
|
146597
146597
|
this.bytesRead += buf.length;
|
|
146598
146598
|
if (request.onData(buf) === false) {
|
|
146599
|
-
return
|
|
146599
|
+
return constants2.ERROR.PAUSED;
|
|
146600
146600
|
}
|
|
146601
146601
|
return 0;
|
|
146602
146602
|
}
|
|
@@ -146635,13 +146635,13 @@ var require_client_h1 = __commonJS({
|
|
|
146635
146635
|
if (socket[kWriting]) {
|
|
146636
146636
|
assert(client[kRunning] === 0);
|
|
146637
146637
|
util2.destroy(socket, new InformationalError("reset"));
|
|
146638
|
-
return
|
|
146638
|
+
return constants2.ERROR.PAUSED;
|
|
146639
146639
|
} else if (!shouldKeepAlive) {
|
|
146640
146640
|
util2.destroy(socket, new InformationalError("reset"));
|
|
146641
|
-
return
|
|
146641
|
+
return constants2.ERROR.PAUSED;
|
|
146642
146642
|
} else if (socket[kReset] && client[kRunning] === 0) {
|
|
146643
146643
|
util2.destroy(socket, new InformationalError("reset"));
|
|
146644
|
-
return
|
|
146644
|
+
return constants2.ERROR.PAUSED;
|
|
146645
146645
|
} else if (client[kPipelining] == null || client[kPipelining] === 1) {
|
|
146646
146646
|
setImmediate(client[kResume]);
|
|
146647
146647
|
} else {
|
|
@@ -269503,7 +269503,7 @@ var require_scan = __commonJS({
|
|
|
269503
269503
|
var require_parse3 = __commonJS({
|
|
269504
269504
|
"../node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
269505
269505
|
"use strict";
|
|
269506
|
-
var
|
|
269506
|
+
var constants2 = require_constants8();
|
|
269507
269507
|
var utils = require_utils4();
|
|
269508
269508
|
var {
|
|
269509
269509
|
MAX_LENGTH,
|
|
@@ -269511,7 +269511,7 @@ var require_parse3 = __commonJS({
|
|
|
269511
269511
|
REGEX_NON_SPECIAL_CHARS,
|
|
269512
269512
|
REGEX_SPECIAL_CHARS_BACKREF,
|
|
269513
269513
|
REPLACEMENTS
|
|
269514
|
-
} =
|
|
269514
|
+
} = constants2;
|
|
269515
269515
|
var expandRange = (args, options2) => {
|
|
269516
269516
|
if (typeof options2.expandRange === "function") {
|
|
269517
269517
|
return options2.expandRange(...args, options2);
|
|
@@ -269717,7 +269717,7 @@ var require_parse3 = __commonJS({
|
|
|
269717
269717
|
if (options2.maxExtglobRecursion === false) {
|
|
269718
269718
|
return { risky: false };
|
|
269719
269719
|
}
|
|
269720
|
-
const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion :
|
|
269720
|
+
const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
269721
269721
|
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
269722
269722
|
if (branches.length > 1) {
|
|
269723
269723
|
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
@@ -269750,8 +269750,8 @@ var require_parse3 = __commonJS({
|
|
|
269750
269750
|
const tokens = [bos];
|
|
269751
269751
|
const capture = opts.capture ? "" : "?:";
|
|
269752
269752
|
const win32 = utils.isWindows(options2);
|
|
269753
|
-
const PLATFORM_CHARS =
|
|
269754
|
-
const EXTGLOB_CHARS =
|
|
269753
|
+
const PLATFORM_CHARS = constants2.globChars(win32);
|
|
269754
|
+
const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
|
|
269755
269755
|
const {
|
|
269756
269756
|
DOT_LITERAL,
|
|
269757
269757
|
PLUS_LITERAL,
|
|
@@ -270450,7 +270450,7 @@ var require_parse3 = __commonJS({
|
|
|
270450
270450
|
NO_DOTS_SLASH,
|
|
270451
270451
|
STAR,
|
|
270452
270452
|
START_ANCHOR
|
|
270453
|
-
} =
|
|
270453
|
+
} = constants2.globChars(win32);
|
|
270454
270454
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
270455
270455
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
270456
270456
|
const capture = opts.capture ? "" : "?:";
|
|
@@ -270509,7 +270509,7 @@ var require_picomatch = __commonJS({
|
|
|
270509
270509
|
var scan = require_scan();
|
|
270510
270510
|
var parse3 = require_parse3();
|
|
270511
270511
|
var utils = require_utils4();
|
|
270512
|
-
var
|
|
270512
|
+
var constants2 = require_constants8();
|
|
270513
270513
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
270514
270514
|
var picomatch = (glob3, options2, returnState = false) => {
|
|
270515
270515
|
if (Array.isArray(glob3)) {
|
|
@@ -270637,7 +270637,7 @@ var require_picomatch = __commonJS({
|
|
|
270637
270637
|
return /$^/;
|
|
270638
270638
|
}
|
|
270639
270639
|
};
|
|
270640
|
-
picomatch.constants =
|
|
270640
|
+
picomatch.constants = constants2;
|
|
270641
270641
|
module.exports = picomatch;
|
|
270642
270642
|
}
|
|
270643
270643
|
});
|
|
@@ -274827,11 +274827,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
274827
274827
|
* what was previously computed. */
|
|
274828
274828
|
async loadSessionInfo() {
|
|
274829
274829
|
try {
|
|
274830
|
-
const { readFileSync:
|
|
274830
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
274831
274831
|
const sessionPath2 = join44(this.cwd, ".omnius", "rlm", "session.json");
|
|
274832
274832
|
if (!existsSync169(sessionPath2))
|
|
274833
274833
|
return null;
|
|
274834
|
-
return JSON.parse(
|
|
274834
|
+
return JSON.parse(readFileSync138(sessionPath2, "utf8"));
|
|
274835
274835
|
} catch {
|
|
274836
274836
|
return null;
|
|
274837
274837
|
}
|
|
@@ -275018,10 +275018,10 @@ var init_memory_metabolism = __esm({
|
|
|
275018
275018
|
const trajDir = join45(this.cwd, ".omnius", "rlm-trajectories");
|
|
275019
275019
|
let lessons = [];
|
|
275020
275020
|
try {
|
|
275021
|
-
const { readdirSync: readdirSync61, readFileSync:
|
|
275021
|
+
const { readdirSync: readdirSync61, readFileSync: readFileSync138 } = await import("node:fs");
|
|
275022
275022
|
const files = readdirSync61(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
275023
275023
|
for (const file of files) {
|
|
275024
|
-
const lines =
|
|
275024
|
+
const lines = readFileSync138(join45(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
|
|
275025
275025
|
for (const line of lines) {
|
|
275026
275026
|
try {
|
|
275027
275027
|
const entry = JSON.parse(line);
|
|
@@ -275405,14 +275405,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
275405
275405
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
275406
275406
|
*/
|
|
275407
275407
|
getTopMemoriesSync(k = 5, taskType) {
|
|
275408
|
-
const { readFileSync:
|
|
275408
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
|
|
275409
275409
|
const metaDir = join45(this.cwd, ".omnius", "memory", "metabolism");
|
|
275410
275410
|
const storeFile = join45(metaDir, "store.json");
|
|
275411
275411
|
if (!existsSync169(storeFile))
|
|
275412
275412
|
return "";
|
|
275413
275413
|
let store2 = [];
|
|
275414
275414
|
try {
|
|
275415
|
-
store2 = JSON.parse(
|
|
275415
|
+
store2 = JSON.parse(readFileSync138(storeFile, "utf8"));
|
|
275416
275416
|
} catch {
|
|
275417
275417
|
return "";
|
|
275418
275418
|
}
|
|
@@ -275434,14 +275434,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
275434
275434
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
275435
275435
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
275436
275436
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
275437
|
-
const { readFileSync:
|
|
275437
|
+
const { readFileSync: readFileSync138, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
|
|
275438
275438
|
const metaDir = join45(this.cwd, ".omnius", "memory", "metabolism");
|
|
275439
275439
|
const storeFile = join45(metaDir, "store.json");
|
|
275440
275440
|
if (!existsSync169(storeFile))
|
|
275441
275441
|
return;
|
|
275442
275442
|
let store2 = [];
|
|
275443
275443
|
try {
|
|
275444
|
-
store2 = JSON.parse(
|
|
275444
|
+
store2 = JSON.parse(readFileSync138(storeFile, "utf8"));
|
|
275445
275445
|
} catch {
|
|
275446
275446
|
return;
|
|
275447
275447
|
}
|
|
@@ -275888,13 +275888,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
275888
275888
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
275889
275889
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
275890
275890
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
275891
|
-
const { readFileSync:
|
|
275891
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
|
|
275892
275892
|
const archiveFile = join47(this.cwd, ".omnius", "arche", "variants.json");
|
|
275893
275893
|
if (!existsSync169(archiveFile))
|
|
275894
275894
|
return "";
|
|
275895
275895
|
let variants = [];
|
|
275896
275896
|
try {
|
|
275897
|
-
variants = JSON.parse(
|
|
275897
|
+
variants = JSON.parse(readFileSync138(archiveFile, "utf8"));
|
|
275898
275898
|
} catch {
|
|
275899
275899
|
return "";
|
|
275900
275900
|
}
|
|
@@ -275912,13 +275912,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
275912
275912
|
}
|
|
275913
275913
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
275914
275914
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
275915
|
-
const { readFileSync:
|
|
275915
|
+
const { readFileSync: readFileSync138, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
|
|
275916
275916
|
const dir = join47(this.cwd, ".omnius", "arche");
|
|
275917
275917
|
const archiveFile = join47(dir, "variants.json");
|
|
275918
275918
|
let variants = [];
|
|
275919
275919
|
try {
|
|
275920
275920
|
if (existsSync169(archiveFile))
|
|
275921
|
-
variants = JSON.parse(
|
|
275921
|
+
variants = JSON.parse(readFileSync138(archiveFile, "utf8"));
|
|
275922
275922
|
} catch {
|
|
275923
275923
|
}
|
|
275924
275924
|
variants.push({
|
|
@@ -514515,7 +514515,7 @@ var require_scan2 = __commonJS({
|
|
|
514515
514515
|
var require_parse4 = __commonJS({
|
|
514516
514516
|
"node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
514517
514517
|
"use strict";
|
|
514518
|
-
var
|
|
514518
|
+
var constants2 = require_constants10();
|
|
514519
514519
|
var utils = require_utils7();
|
|
514520
514520
|
var {
|
|
514521
514521
|
MAX_LENGTH,
|
|
@@ -514523,7 +514523,7 @@ var require_parse4 = __commonJS({
|
|
|
514523
514523
|
REGEX_NON_SPECIAL_CHARS,
|
|
514524
514524
|
REGEX_SPECIAL_CHARS_BACKREF,
|
|
514525
514525
|
REPLACEMENTS
|
|
514526
|
-
} =
|
|
514526
|
+
} = constants2;
|
|
514527
514527
|
var expandRange = (args, options2) => {
|
|
514528
514528
|
if (typeof options2.expandRange === "function") {
|
|
514529
514529
|
return options2.expandRange(...args, options2);
|
|
@@ -514729,7 +514729,7 @@ var require_parse4 = __commonJS({
|
|
|
514729
514729
|
if (options2.maxExtglobRecursion === false) {
|
|
514730
514730
|
return { risky: false };
|
|
514731
514731
|
}
|
|
514732
|
-
const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion :
|
|
514732
|
+
const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
514733
514733
|
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
514734
514734
|
if (branches.length > 1) {
|
|
514735
514735
|
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
@@ -514761,8 +514761,8 @@ var require_parse4 = __commonJS({
|
|
|
514761
514761
|
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
514762
514762
|
const tokens = [bos];
|
|
514763
514763
|
const capture = opts.capture ? "" : "?:";
|
|
514764
|
-
const PLATFORM_CHARS =
|
|
514765
|
-
const EXTGLOB_CHARS =
|
|
514764
|
+
const PLATFORM_CHARS = constants2.globChars(opts.windows);
|
|
514765
|
+
const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
|
|
514766
514766
|
const {
|
|
514767
514767
|
DOT_LITERAL,
|
|
514768
514768
|
PLUS_LITERAL,
|
|
@@ -515457,7 +515457,7 @@ var require_parse4 = __commonJS({
|
|
|
515457
515457
|
NO_DOTS_SLASH,
|
|
515458
515458
|
STAR,
|
|
515459
515459
|
START_ANCHOR
|
|
515460
|
-
} =
|
|
515460
|
+
} = constants2.globChars(opts.windows);
|
|
515461
515461
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
515462
515462
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
515463
515463
|
const capture = opts.capture ? "" : "?:";
|
|
@@ -515515,7 +515515,7 @@ var require_picomatch3 = __commonJS({
|
|
|
515515
515515
|
var scan = require_scan2();
|
|
515516
515516
|
var parse3 = require_parse4();
|
|
515517
515517
|
var utils = require_utils7();
|
|
515518
|
-
var
|
|
515518
|
+
var constants2 = require_constants10();
|
|
515519
515519
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
515520
515520
|
var picomatch = (glob3, options2, returnState = false) => {
|
|
515521
515521
|
if (Array.isArray(glob3)) {
|
|
@@ -515643,7 +515643,7 @@ var require_picomatch3 = __commonJS({
|
|
|
515643
515643
|
return /$^/;
|
|
515644
515644
|
}
|
|
515645
515645
|
};
|
|
515646
|
-
picomatch.constants =
|
|
515646
|
+
picomatch.constants = constants2;
|
|
515647
515647
|
module.exports = picomatch;
|
|
515648
515648
|
}
|
|
515649
515649
|
});
|
|
@@ -568893,9 +568893,9 @@ var init_reflectionBuffer = __esm({
|
|
|
568893
568893
|
this.persistPath = persistPath ?? null;
|
|
568894
568894
|
if (this.persistPath) {
|
|
568895
568895
|
try {
|
|
568896
|
-
const { readFileSync:
|
|
568896
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
|
|
568897
568897
|
if (existsSync169(this.persistPath)) {
|
|
568898
|
-
this.state = JSON.parse(
|
|
568898
|
+
this.state = JSON.parse(readFileSync138(this.persistPath, "utf-8"));
|
|
568899
568899
|
return;
|
|
568900
568900
|
}
|
|
568901
568901
|
} catch {
|
|
@@ -573145,9 +573145,9 @@ var init_adversaryStream = __esm({
|
|
|
573145
573145
|
if (!this.persistPath)
|
|
573146
573146
|
return;
|
|
573147
573147
|
try {
|
|
573148
|
-
const { readFileSync:
|
|
573148
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
|
|
573149
573149
|
if (existsSync169(this.persistPath)) {
|
|
573150
|
-
const data = JSON.parse(
|
|
573150
|
+
const data = JSON.parse(readFileSync138(this.persistPath, "utf-8"));
|
|
573151
573151
|
if (Array.isArray(data?.ledger))
|
|
573152
573152
|
this.ledger = data.ledger.slice(-100);
|
|
573153
573153
|
}
|
|
@@ -591795,8 +591795,8 @@ ${telegramPersonaHead}` : stripped
|
|
|
591795
591795
|
let recoveredTokens = 0;
|
|
591796
591796
|
for (const [filePath, entry] of entries) {
|
|
591797
591797
|
try {
|
|
591798
|
-
const { readFileSync:
|
|
591799
|
-
const content =
|
|
591798
|
+
const { readFileSync: readFileSync138 } = await import("node:fs");
|
|
591799
|
+
const content = readFileSync138(filePath, "utf8");
|
|
591800
591800
|
const tokenEst = Math.ceil(content.length / 4);
|
|
591801
591801
|
if (recoveredTokens + tokenEst > fileRecoveryBudget)
|
|
591802
591802
|
break;
|
|
@@ -593770,7 +593770,7 @@ ${result}`
|
|
|
593770
593770
|
const buffer2 = Buffer.from(rawBase64, "base64");
|
|
593771
593771
|
let resizedBase64 = null;
|
|
593772
593772
|
try {
|
|
593773
|
-
const { writeFileSync: writeFileSync95, readFileSync:
|
|
593773
|
+
const { writeFileSync: writeFileSync95, readFileSync: readFileSync138, unlinkSync: unlinkSync37 } = await import("node:fs");
|
|
593774
593774
|
const { join: join186 } = await import("node:path");
|
|
593775
593775
|
const { tmpdir: tmpdir26 } = await import("node:os");
|
|
593776
593776
|
const tmpIn = join186(tmpdir26(), `omnius_img_in_${Date.now()}.png`);
|
|
@@ -593785,7 +593785,7 @@ ${result}`
|
|
|
593785
593785
|
`img.save(${JSON.stringify(tmpOut)}, 'JPEG', quality=75)`
|
|
593786
593786
|
].join("; ");
|
|
593787
593787
|
await execFileText3(pyBin, ["-c", resizeScript], { timeout: 1e4 });
|
|
593788
|
-
const resizedBuf =
|
|
593788
|
+
const resizedBuf = readFileSync138(tmpOut);
|
|
593789
593789
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
593790
593790
|
try {
|
|
593791
593791
|
unlinkSync37(tmpIn);
|
|
@@ -605756,8 +605756,6 @@ __export(listen_exports, {
|
|
|
605756
605756
|
});
|
|
605757
605757
|
import { spawn as spawn29 } from "node:child_process";
|
|
605758
605758
|
import {
|
|
605759
|
-
accessSync as accessSync2,
|
|
605760
|
-
constants as constants2,
|
|
605761
605759
|
existsSync as existsSync111,
|
|
605762
605760
|
mkdirSync as mkdirSync69,
|
|
605763
605761
|
writeFileSync as writeFileSync58,
|
|
@@ -606000,7 +605998,21 @@ async function ensureVenvForTranscribeCli() {
|
|
|
606000
605998
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
606001
605999
|
const venvBin = join127(homedir39(), ".omnius", "venv", bin);
|
|
606002
606000
|
const venvPython2 = join127(venvBin, exe);
|
|
606003
|
-
if (!existsSync111(venvPython2))
|
|
606001
|
+
if (!existsSync111(venvPython2)) {
|
|
606002
|
+
try {
|
|
606003
|
+
const mod3 = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
|
|
606004
|
+
if (typeof mod3.ensureEmbedDeps === "function") mod3.ensureEmbedDeps();
|
|
606005
|
+
} catch {
|
|
606006
|
+
}
|
|
606007
|
+
}
|
|
606008
|
+
if (!existsSync111(venvPython2)) {
|
|
606009
|
+
try {
|
|
606010
|
+
mkdirSync69(join127(homedir39(), ".omnius", "venv"), { recursive: true });
|
|
606011
|
+
await execFileText4("python3", ["-m", "venv", join127(homedir39(), ".omnius", "venv")], { timeout: 6e4 });
|
|
606012
|
+
} catch {
|
|
606013
|
+
return false;
|
|
606014
|
+
}
|
|
606015
|
+
}
|
|
606004
606016
|
process.env.TRANSCRIBE_PYTHON = venvPython2;
|
|
606005
606017
|
const pathSep2 = process.platform === "win32" ? ";" : ":";
|
|
606006
606018
|
const currentPath = process.env.PATH || "";
|
|
@@ -606009,65 +606021,79 @@ async function ensureVenvForTranscribeCli() {
|
|
|
606009
606021
|
}
|
|
606010
606022
|
try {
|
|
606011
606023
|
await execFileText4(venvPython2, ["-c", "import numpy"], { timeout: 1e4 });
|
|
606024
|
+
} catch {
|
|
606025
|
+
try {
|
|
606026
|
+
await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "pip", "setuptools", "wheel", "numpy==1.26.4"], { timeout: 3e5 });
|
|
606027
|
+
} catch {
|
|
606028
|
+
return false;
|
|
606029
|
+
}
|
|
606030
|
+
}
|
|
606031
|
+
try {
|
|
606032
|
+
await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
|
|
606033
|
+
return true;
|
|
606034
|
+
} catch {
|
|
606035
|
+
}
|
|
606036
|
+
try {
|
|
606037
|
+
await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "transcribe-cli"], { timeout: 3e5 });
|
|
606038
|
+
await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
|
|
606012
606039
|
return true;
|
|
606013
606040
|
} catch {
|
|
606014
606041
|
return false;
|
|
606015
606042
|
}
|
|
606016
606043
|
}
|
|
606017
|
-
function
|
|
606018
|
-
|
|
606019
|
-
|
|
606020
|
-
|
|
606021
|
-
|
|
606022
|
-
|
|
606023
|
-
|
|
606024
|
-
|
|
606025
|
-
|
|
606026
|
-
|
|
606044
|
+
async function requireTranscribeCliFrom2(packageDir) {
|
|
606045
|
+
try {
|
|
606046
|
+
const { createRequire: createRequire11 } = await import("node:module");
|
|
606047
|
+
const req3 = createRequire11(import.meta.url);
|
|
606048
|
+
const distPath = join127(packageDir, "dist", "index.js");
|
|
606049
|
+
if (existsSync111(distPath)) return req3(distPath);
|
|
606050
|
+
return req3(packageDir);
|
|
606051
|
+
} catch {
|
|
606052
|
+
return null;
|
|
606053
|
+
}
|
|
606054
|
+
}
|
|
606055
|
+
async function loadManagedTranscribeCli() {
|
|
606056
|
+
const packageDir = join127(MANAGED_TRANSCRIBE_CLI_DIR2, "node_modules", "transcribe-cli");
|
|
606057
|
+
if (!existsSync111(join127(packageDir, "dist", "index.js"))) return null;
|
|
606058
|
+
return requireTranscribeCliFrom2(packageDir);
|
|
606059
|
+
}
|
|
606060
|
+
async function ensureManagedTranscribeCliNode() {
|
|
606061
|
+
if (await loadManagedTranscribeCli()) return true;
|
|
606062
|
+
if (_managedTranscribeCliInstallPromise) return _managedTranscribeCliInstallPromise;
|
|
606063
|
+
_managedTranscribeCliInstallPromise = (async () => {
|
|
606027
606064
|
try {
|
|
606028
|
-
|
|
606029
|
-
|
|
606030
|
-
|
|
606031
|
-
|
|
606032
|
-
|
|
606033
|
-
|
|
606065
|
+
mkdirSync69(MANAGED_TRANSCRIBE_CLI_DIR2, { recursive: true });
|
|
606066
|
+
if (!existsSync111(join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"))) {
|
|
606067
|
+
writeFileSync58(
|
|
606068
|
+
join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"),
|
|
606069
|
+
JSON.stringify({ private: true, dependencies: {} }, null, 2),
|
|
606070
|
+
"utf8"
|
|
606071
|
+
);
|
|
606034
606072
|
}
|
|
606035
|
-
|
|
606036
|
-
|
|
606037
|
-
const args = terminalElevation && needsSudo ? ["npm", "i", "-g", "transcribe-cli"] : ["i", "-g", "transcribe-cli"];
|
|
606038
|
-
return new Promise((resolve76) => {
|
|
606039
|
-
const child = spawn29(command, args, {
|
|
606040
|
-
stdio: terminalElevation ? "inherit" : "ignore",
|
|
606041
|
-
timeout: 18e4
|
|
606042
|
-
});
|
|
606043
|
-
const timeout2 = setTimeout(() => {
|
|
606044
|
-
try {
|
|
606045
|
-
child.kill("SIGTERM");
|
|
606046
|
-
} catch {
|
|
606047
|
-
}
|
|
606048
|
-
resolve76(false);
|
|
606049
|
-
}, 18e4);
|
|
606050
|
-
timeout2.unref?.();
|
|
606051
|
-
onChildClose(child, (code8) => {
|
|
606052
|
-
clearTimeout(timeout2);
|
|
606053
|
-
resolve76(code8 === 0);
|
|
606054
|
-
});
|
|
606055
|
-
onChildError(child, () => {
|
|
606056
|
-
clearTimeout(timeout2);
|
|
606057
|
-
resolve76(false);
|
|
606058
|
-
});
|
|
606073
|
+
await execFileText4("npm", ["install", "--prefix", MANAGED_TRANSCRIBE_CLI_DIR2, "transcribe-cli@^2.0.1"], {
|
|
606074
|
+
timeout: 18e4
|
|
606059
606075
|
});
|
|
606076
|
+
return Boolean(await loadManagedTranscribeCli());
|
|
606060
606077
|
} catch {
|
|
606061
606078
|
return false;
|
|
606062
606079
|
}
|
|
606063
606080
|
})();
|
|
606081
|
+
return _managedTranscribeCliInstallPromise;
|
|
606082
|
+
}
|
|
606083
|
+
function ensureTranscribeCliBackground() {
|
|
606084
|
+
if (_bgInstallPromise) return _bgInstallPromise;
|
|
606085
|
+
_bgInstallPromise = (async () => {
|
|
606086
|
+
const nodeReady = await ensureManagedTranscribeCliNode();
|
|
606087
|
+
const pyReady = await ensureVenvForTranscribeCli();
|
|
606088
|
+
return nodeReady && pyReady;
|
|
606089
|
+
})();
|
|
606064
606090
|
return _bgInstallPromise;
|
|
606065
606091
|
}
|
|
606066
606092
|
async function waitForTranscribeCli() {
|
|
606067
606093
|
if (_bgInstallPromise) {
|
|
606068
606094
|
return _bgInstallPromise;
|
|
606069
606095
|
}
|
|
606070
|
-
return
|
|
606096
|
+
return Boolean(await loadManagedTranscribeCli()) && await ensureVenvForTranscribeCli();
|
|
606071
606097
|
}
|
|
606072
606098
|
function getListenEngine(config) {
|
|
606073
606099
|
if (!_engine) {
|
|
@@ -606075,12 +606101,13 @@ function getListenEngine(config) {
|
|
|
606075
606101
|
}
|
|
606076
606102
|
return _engine;
|
|
606077
606103
|
}
|
|
606078
|
-
var AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _engine;
|
|
606104
|
+
var MANAGED_TRANSCRIBE_CLI_DIR2, AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _managedTranscribeCliInstallPromise, _engine;
|
|
606079
606105
|
var init_listen = __esm({
|
|
606080
606106
|
"packages/cli/src/tui/listen.ts"() {
|
|
606081
606107
|
"use strict";
|
|
606082
606108
|
init_typed_node_events();
|
|
606083
606109
|
init_async_process();
|
|
606110
|
+
MANAGED_TRANSCRIBE_CLI_DIR2 = join127(homedir39(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
606084
606111
|
AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
606085
606112
|
".mp3",
|
|
606086
606113
|
".wav",
|
|
@@ -606272,20 +606299,10 @@ var init_listen = __esm({
|
|
|
606272
606299
|
async isAvailable() {
|
|
606273
606300
|
if (this.transcribeCliAvailable !== null)
|
|
606274
606301
|
return this.transcribeCliAvailable;
|
|
606275
|
-
|
|
606276
|
-
|
|
606277
|
-
|
|
606278
|
-
|
|
606279
|
-
this.transcribeCliAvailable = false;
|
|
606280
|
-
}
|
|
606281
|
-
if (!this.transcribeCliAvailable) {
|
|
606282
|
-
try {
|
|
606283
|
-
await execFileText4("transcribe-cli", ["--version"], { timeout: 5e3 });
|
|
606284
|
-
this.transcribeCliAvailable = true;
|
|
606285
|
-
} catch {
|
|
606286
|
-
this.transcribeCliAvailable = false;
|
|
606287
|
-
}
|
|
606288
|
-
}
|
|
606302
|
+
const tc = await this.loadTranscribeCli() || (await ensureManagedTranscribeCliNode() ? await this.loadTranscribeCli() : null);
|
|
606303
|
+
const transcribeCliReady = Boolean(tc && await ensureVenvForTranscribeCli());
|
|
606304
|
+
const whisperFallbackReady = Boolean(await findLiveWhisperScript());
|
|
606305
|
+
this.transcribeCliAvailable = transcribeCliReady || whisperFallbackReady;
|
|
606289
606306
|
return this.transcribeCliAvailable;
|
|
606290
606307
|
}
|
|
606291
606308
|
/** Load transcribe-cli — bundled as a dependency of omnius. */
|
|
@@ -606296,13 +606313,14 @@ var init_listen = __esm({
|
|
|
606296
606313
|
return req3("transcribe-cli");
|
|
606297
606314
|
} catch {
|
|
606298
606315
|
}
|
|
606316
|
+
const managed = await loadManagedTranscribeCli();
|
|
606317
|
+
if (managed) return managed;
|
|
606299
606318
|
try {
|
|
606300
606319
|
const globalRoot = (await execFileText4("npm", ["root", "-g"], { timeout: 5e3 })).trim();
|
|
606301
606320
|
const tcPath = join127(globalRoot, "transcribe-cli");
|
|
606302
606321
|
if (existsSync111(join127(tcPath, "dist", "index.js"))) {
|
|
606303
|
-
const
|
|
606304
|
-
|
|
606305
|
-
return req3(join127(tcPath, "dist", "index.js"));
|
|
606322
|
+
const loaded = await requireTranscribeCliFrom2(tcPath);
|
|
606323
|
+
if (loaded) return loaded;
|
|
606306
606324
|
}
|
|
606307
606325
|
} catch {
|
|
606308
606326
|
}
|
|
@@ -606319,9 +606337,8 @@ var init_listen = __esm({
|
|
|
606319
606337
|
"transcribe-cli"
|
|
606320
606338
|
);
|
|
606321
606339
|
if (existsSync111(join127(tcPath, "dist", "index.js"))) {
|
|
606322
|
-
const
|
|
606323
|
-
|
|
606324
|
-
return req3(join127(tcPath, "dist", "index.js"));
|
|
606340
|
+
const loaded = await requireTranscribeCliFrom2(tcPath);
|
|
606341
|
+
if (loaded) return loaded;
|
|
606325
606342
|
}
|
|
606326
606343
|
}
|
|
606327
606344
|
} catch {
|
|
@@ -606348,7 +606365,7 @@ var init_listen = __esm({
|
|
|
606348
606365
|
}
|
|
606349
606366
|
if (!tc) {
|
|
606350
606367
|
try {
|
|
606351
|
-
await
|
|
606368
|
+
await ensureManagedTranscribeCliNode();
|
|
606352
606369
|
this.transcribeCliAvailable = null;
|
|
606353
606370
|
tc = await this.loadTranscribeCli();
|
|
606354
606371
|
} catch {
|
|
@@ -606385,7 +606402,7 @@ var init_listen = __esm({
|
|
|
606385
606402
|
}
|
|
606386
606403
|
if (!tcUpToDate) {
|
|
606387
606404
|
try {
|
|
606388
|
-
await
|
|
606405
|
+
await ensureManagedTranscribeCliNode();
|
|
606389
606406
|
this.transcribeCliAvailable = null;
|
|
606390
606407
|
const reloaded = await this.loadTranscribeCli();
|
|
606391
606408
|
if (reloaded?.TranscribeLive) {
|
|
@@ -606650,7 +606667,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606650
606667
|
}
|
|
606651
606668
|
if (!tc) {
|
|
606652
606669
|
try {
|
|
606653
|
-
await
|
|
606670
|
+
await ensureManagedTranscribeCliNode();
|
|
606654
606671
|
this.transcribeCliAvailable = null;
|
|
606655
606672
|
tc = await this.loadTranscribeCli();
|
|
606656
606673
|
} catch {
|
|
@@ -606709,7 +606726,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606709
606726
|
}
|
|
606710
606727
|
if (!tc) {
|
|
606711
606728
|
try {
|
|
606712
|
-
await
|
|
606729
|
+
await ensureManagedTranscribeCliNode();
|
|
606713
606730
|
this.transcribeCliAvailable = null;
|
|
606714
606731
|
tc = await this.loadTranscribeCli();
|
|
606715
606732
|
} catch {
|
|
@@ -606787,6 +606804,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606787
606804
|
}
|
|
606788
606805
|
};
|
|
606789
606806
|
_bgInstallPromise = null;
|
|
606807
|
+
_managedTranscribeCliInstallPromise = null;
|
|
606790
606808
|
_engine = null;
|
|
606791
606809
|
}
|
|
606792
606810
|
});
|
|
@@ -613055,7 +613073,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
|
|
|
613055
613073
|
async function fetchPeerModels(peerId, authKey) {
|
|
613056
613074
|
try {
|
|
613057
613075
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
613058
|
-
const { existsSync: existsSync169, readFileSync:
|
|
613076
|
+
const { existsSync: existsSync169, readFileSync: readFileSync138 } = await import("node:fs");
|
|
613059
613077
|
const { join: join186 } = await import("node:path");
|
|
613060
613078
|
const cwd4 = process.cwd();
|
|
613061
613079
|
const nexusTool = new NexusTool2(cwd4);
|
|
@@ -613064,7 +613082,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613064
613082
|
try {
|
|
613065
613083
|
const statusPath = join186(nexusDir, "status.json");
|
|
613066
613084
|
if (existsSync169(statusPath)) {
|
|
613067
|
-
const status = JSON.parse(
|
|
613085
|
+
const status = JSON.parse(readFileSync138(statusPath, "utf8"));
|
|
613068
613086
|
if (status.peerId === peerId) isLocalPeer = true;
|
|
613069
613087
|
}
|
|
613070
613088
|
} catch {
|
|
@@ -613073,7 +613091,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613073
613091
|
const pricingPath = join186(nexusDir, "pricing.json");
|
|
613074
613092
|
if (existsSync169(pricingPath)) {
|
|
613075
613093
|
try {
|
|
613076
|
-
const pricing = JSON.parse(
|
|
613094
|
+
const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
|
|
613077
613095
|
const localModels = (pricing.models || []).map((m2) => ({
|
|
613078
613096
|
name: m2.model || "unknown",
|
|
613079
613097
|
size: m2.parameterSize || "",
|
|
@@ -613089,7 +613107,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613089
613107
|
const cachePath2 = join186(nexusDir, "peer-models-cache.json");
|
|
613090
613108
|
if (existsSync169(cachePath2)) {
|
|
613091
613109
|
try {
|
|
613092
|
-
const cache8 = JSON.parse(
|
|
613110
|
+
const cache8 = JSON.parse(readFileSync138(cachePath2, "utf8"));
|
|
613093
613111
|
if (cache8.peerId === peerId && cache8.models?.length > 0) {
|
|
613094
613112
|
const age = Date.now() - new Date(cache8.cachedAt).getTime();
|
|
613095
613113
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -613204,7 +613222,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613204
613222
|
const pricingPath = join186(nexusDir, "pricing.json");
|
|
613205
613223
|
if (existsSync169(pricingPath)) {
|
|
613206
613224
|
try {
|
|
613207
|
-
const pricing = JSON.parse(
|
|
613225
|
+
const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
|
|
613208
613226
|
return (pricing.models || []).map((m2) => ({
|
|
613209
613227
|
name: m2.model || "unknown",
|
|
613210
613228
|
size: m2.parameterSize || "",
|
|
@@ -616742,7 +616760,7 @@ var init_voice_session = __esm({
|
|
|
616742
616760
|
|
|
616743
616761
|
// packages/cli/src/tui/scoped-personality.ts
|
|
616744
616762
|
import { createHash as createHash32 } from "node:crypto";
|
|
616745
|
-
import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as
|
|
616763
|
+
import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as readFileSync91, writeFileSync as writeFileSync59 } from "node:fs";
|
|
616746
616764
|
import { join as join128, resolve as resolve55 } from "node:path";
|
|
616747
616765
|
function safeName(input) {
|
|
616748
616766
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
@@ -616897,7 +616915,7 @@ function loadScopedPersonality(scope) {
|
|
|
616897
616915
|
const paths = scopedPersonalityPaths(scope);
|
|
616898
616916
|
if (!existsSync112(paths.json)) return newDocument(scope);
|
|
616899
616917
|
try {
|
|
616900
|
-
const parsed = JSON.parse(
|
|
616918
|
+
const parsed = JSON.parse(readFileSync91(paths.json, "utf8"));
|
|
616901
616919
|
if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
|
|
616902
616920
|
return normalizeDocument(scope, parsed);
|
|
616903
616921
|
} catch {
|
|
@@ -617121,7 +617139,7 @@ var init_scoped_personality = __esm({
|
|
|
617121
617139
|
|
|
617122
617140
|
// packages/cli/src/tui/voice-soul.ts
|
|
617123
617141
|
import { createHash as createHash33 } from "node:crypto";
|
|
617124
|
-
import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as
|
|
617142
|
+
import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as readFileSync92 } from "node:fs";
|
|
617125
617143
|
import { basename as basename24, join as join129, resolve as resolve56 } from "node:path";
|
|
617126
617144
|
function compactText(text2, limit) {
|
|
617127
617145
|
const compact4 = text2.replace(/\s+/g, " ").trim();
|
|
@@ -617148,7 +617166,7 @@ function loadSoulRuntimeState(input) {
|
|
|
617148
617166
|
const path12 = soulRuntimeStatePath(input);
|
|
617149
617167
|
if (!existsSync113(path12)) return { version: 1 };
|
|
617150
617168
|
try {
|
|
617151
|
-
const parsed = JSON.parse(
|
|
617169
|
+
const parsed = JSON.parse(readFileSync92(path12, "utf8"));
|
|
617152
617170
|
if (!parsed || parsed.version !== 1) return { version: 1 };
|
|
617153
617171
|
return {
|
|
617154
617172
|
version: 1,
|
|
@@ -617266,7 +617284,7 @@ function findProjectSoul(scope) {
|
|
|
617266
617284
|
]) {
|
|
617267
617285
|
if (!existsSync113(candidate)) continue;
|
|
617268
617286
|
try {
|
|
617269
|
-
return { path: candidate, content:
|
|
617287
|
+
return { path: candidate, content: readFileSync92(candidate, "utf8") };
|
|
617270
617288
|
} catch {
|
|
617271
617289
|
return null;
|
|
617272
617290
|
}
|
|
@@ -617285,7 +617303,7 @@ function findProjectVoice(scope) {
|
|
|
617285
617303
|
const first2 = files[0];
|
|
617286
617304
|
if (!first2) return null;
|
|
617287
617305
|
const path12 = join129(voiceDir3, first2);
|
|
617288
|
-
return { path: path12, content:
|
|
617306
|
+
return { path: path12, content: readFileSync92(path12, "utf8") };
|
|
617289
617307
|
} catch {
|
|
617290
617308
|
return null;
|
|
617291
617309
|
}
|
|
@@ -617550,7 +617568,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
|
|
|
617550
617568
|
import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
|
|
617551
617569
|
import { URL as URL2 } from "node:url";
|
|
617552
617570
|
import { loadavg, cpus as cpus3, totalmem as totalmem6, freemem as freemem4 } from "node:os";
|
|
617553
|
-
import { existsSync as existsSync114, readFileSync as
|
|
617571
|
+
import { existsSync as existsSync114, readFileSync as readFileSync93, writeFileSync as writeFileSync60, unlinkSync as unlinkSync20, mkdirSync as mkdirSync71, readdirSync as readdirSync38, statSync as statSync43, statfsSync as statfsSync7 } from "node:fs";
|
|
617554
617572
|
import { join as join130 } from "node:path";
|
|
617555
617573
|
function cleanForwardHeaders(raw, targetHost) {
|
|
617556
617574
|
const out = {};
|
|
@@ -617721,7 +617739,7 @@ function readSponsorUsageState(stateDir) {
|
|
|
617721
617739
|
try {
|
|
617722
617740
|
const path12 = join130(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
|
|
617723
617741
|
if (!existsSync114(path12)) return null;
|
|
617724
|
-
const parsed = JSON.parse(
|
|
617742
|
+
const parsed = JSON.parse(readFileSync93(path12, "utf8"));
|
|
617725
617743
|
const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
|
|
617726
617744
|
const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
|
|
617727
617745
|
if (!dailyTokensResetAt) return null;
|
|
@@ -617746,7 +617764,7 @@ function readExposeState(stateDir) {
|
|
|
617746
617764
|
try {
|
|
617747
617765
|
const path12 = join130(stateDir, STATE_FILE_NAME);
|
|
617748
617766
|
if (!existsSync114(path12)) return null;
|
|
617749
|
-
const raw =
|
|
617767
|
+
const raw = readFileSync93(path12, "utf8");
|
|
617750
617768
|
const data = JSON.parse(raw);
|
|
617751
617769
|
if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
|
|
617752
617770
|
return data;
|
|
@@ -617884,7 +617902,7 @@ function readP2PExposeState(stateDir) {
|
|
|
617884
617902
|
try {
|
|
617885
617903
|
const path12 = join130(stateDir, P2P_STATE_FILE_NAME);
|
|
617886
617904
|
if (!existsSync114(path12)) return null;
|
|
617887
|
-
const raw =
|
|
617905
|
+
const raw = readFileSync93(path12, "utf8");
|
|
617888
617906
|
const data = JSON.parse(raw);
|
|
617889
617907
|
if (!data.peerId || !data.authKey) return null;
|
|
617890
617908
|
return data;
|
|
@@ -619288,7 +619306,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619288
619306
|
const statusPath = join130(nexusDir, "status.json");
|
|
619289
619307
|
for (let i2 = 0; i2 < 80; i2++) {
|
|
619290
619308
|
try {
|
|
619291
|
-
const raw =
|
|
619309
|
+
const raw = readFileSync93(statusPath, "utf8");
|
|
619292
619310
|
if (raw.length > 10) {
|
|
619293
619311
|
const status = JSON.parse(raw);
|
|
619294
619312
|
if (status.connected && status.peerId) {
|
|
@@ -619353,7 +619371,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619353
619371
|
removeP2PExposeState(stateDir);
|
|
619354
619372
|
return null;
|
|
619355
619373
|
}
|
|
619356
|
-
const status = JSON.parse(
|
|
619374
|
+
const status = JSON.parse(readFileSync93(statusPath, "utf8"));
|
|
619357
619375
|
if (!status.connected || !status.peerId) {
|
|
619358
619376
|
removeP2PExposeState(stateDir);
|
|
619359
619377
|
return null;
|
|
@@ -619431,7 +619449,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619431
619449
|
let meteringLines = lastMeteringLineCount;
|
|
619432
619450
|
try {
|
|
619433
619451
|
if (existsSync114(meteringFile)) {
|
|
619434
|
-
const content =
|
|
619452
|
+
const content = readFileSync93(meteringFile, "utf8");
|
|
619435
619453
|
meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
|
|
619436
619454
|
}
|
|
619437
619455
|
} catch {
|
|
@@ -619460,7 +619478,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619460
619478
|
try {
|
|
619461
619479
|
const statusPath = join130(nexusDir, "status.json");
|
|
619462
619480
|
if (existsSync114(statusPath)) {
|
|
619463
|
-
const status = JSON.parse(
|
|
619481
|
+
const status = JSON.parse(readFileSync93(statusPath, "utf8"));
|
|
619464
619482
|
if (status.peerId && !this._peerId) {
|
|
619465
619483
|
this._peerId = status.peerId;
|
|
619466
619484
|
}
|
|
@@ -619483,7 +619501,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619483
619501
|
try {
|
|
619484
619502
|
const meteringFile = join130(nexusDir, "metering.jsonl");
|
|
619485
619503
|
if (existsSync114(meteringFile)) {
|
|
619486
|
-
const content =
|
|
619504
|
+
const content = readFileSync93(meteringFile, "utf8");
|
|
619487
619505
|
if (content.length > lastMeteringSize) {
|
|
619488
619506
|
const newContent = content.slice(lastMeteringSize);
|
|
619489
619507
|
lastMeteringSize = content.length;
|
|
@@ -619780,7 +619798,7 @@ var init_types3 = __esm({
|
|
|
619780
619798
|
|
|
619781
619799
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
619782
619800
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
|
|
619783
|
-
import { readFileSync as
|
|
619801
|
+
import { readFileSync as readFileSync94, writeFileSync as writeFileSync61, existsSync as existsSync115, mkdirSync as mkdirSync72 } from "node:fs";
|
|
619784
619802
|
import { dirname as dirname39 } from "node:path";
|
|
619785
619803
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
619786
619804
|
var init_secret_vault = __esm({
|
|
@@ -619998,7 +620016,7 @@ var init_secret_vault = __esm({
|
|
|
619998
620016
|
*/
|
|
619999
620017
|
load(passphrase) {
|
|
620000
620018
|
if (!this.storePath || !existsSync115(this.storePath)) return 0;
|
|
620001
|
-
const blob =
|
|
620019
|
+
const blob = readFileSync94(this.storePath);
|
|
620002
620020
|
if (blob.length < SALT_LEN + IV_LEN + 16) {
|
|
620003
620021
|
throw new Error("Vault file is corrupted (too small)");
|
|
620004
620022
|
}
|
|
@@ -621036,7 +621054,7 @@ ${activitySummary}
|
|
|
621036
621054
|
});
|
|
621037
621055
|
|
|
621038
621056
|
// packages/cli/src/api/profiles.ts
|
|
621039
|
-
import { existsSync as existsSync116, readFileSync as
|
|
621057
|
+
import { existsSync as existsSync116, readFileSync as readFileSync95, writeFileSync as writeFileSync62, mkdirSync as mkdirSync73, readdirSync as readdirSync39, unlinkSync as unlinkSync21 } from "node:fs";
|
|
621040
621058
|
import { join as join132 } from "node:path";
|
|
621041
621059
|
import { homedir as homedir40 } from "node:os";
|
|
621042
621060
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -621056,7 +621074,7 @@ function listProfiles(projectDir2) {
|
|
|
621056
621074
|
if (existsSync116(projDir)) {
|
|
621057
621075
|
for (const f2 of readdirSync39(projDir).filter((f3) => f3.endsWith(".json"))) {
|
|
621058
621076
|
try {
|
|
621059
|
-
const raw = JSON.parse(
|
|
621077
|
+
const raw = JSON.parse(readFileSync95(join132(projDir, f2), "utf8"));
|
|
621060
621078
|
const name10 = f2.replace(".json", "");
|
|
621061
621079
|
seen.add(name10);
|
|
621062
621080
|
result.push({
|
|
@@ -621075,7 +621093,7 @@ function listProfiles(projectDir2) {
|
|
|
621075
621093
|
const name10 = f2.replace(".json", "");
|
|
621076
621094
|
if (seen.has(name10)) continue;
|
|
621077
621095
|
try {
|
|
621078
|
-
const raw = JSON.parse(
|
|
621096
|
+
const raw = JSON.parse(readFileSync95(join132(globDir, f2), "utf8"));
|
|
621079
621097
|
result.push({
|
|
621080
621098
|
name: name10,
|
|
621081
621099
|
description: raw.description || "",
|
|
@@ -621111,7 +621129,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
|
|
|
621111
621129
|
];
|
|
621112
621130
|
for (const candidate of candidates) {
|
|
621113
621131
|
if (!existsSync116(candidate.path)) continue;
|
|
621114
|
-
const raw = JSON.parse(
|
|
621132
|
+
const raw = JSON.parse(readFileSync95(candidate.path, "utf8"));
|
|
621115
621133
|
if (raw.encrypted === true) {
|
|
621116
621134
|
if (!password) return null;
|
|
621117
621135
|
const profile = decryptProfile(raw, password);
|
|
@@ -621418,7 +621436,7 @@ __export(omnius_directory_exports, {
|
|
|
621418
621436
|
writeIndexMeta: () => writeIndexMeta,
|
|
621419
621437
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
621420
621438
|
});
|
|
621421
|
-
import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync117, mkdirSync as mkdirSync74, readFileSync as
|
|
621439
|
+
import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync117, mkdirSync as mkdirSync74, readFileSync as readFileSync96, writeFileSync as writeFileSync63, readdirSync as readdirSync40, statSync as statSync44, unlinkSync as unlinkSync22, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
|
|
621422
621440
|
import { join as join133, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
|
|
621423
621441
|
import { homedir as homedir41 } from "node:os";
|
|
621424
621442
|
import { createHash as createHash37 } from "node:crypto";
|
|
@@ -621428,7 +621446,7 @@ function isGitRoot(dir) {
|
|
|
621428
621446
|
try {
|
|
621429
621447
|
const stat9 = statSync44(gitPath);
|
|
621430
621448
|
if (stat9.isFile()) {
|
|
621431
|
-
return
|
|
621449
|
+
return readFileSync96(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
621432
621450
|
}
|
|
621433
621451
|
if (!stat9.isDirectory()) return false;
|
|
621434
621452
|
return existsSync117(join133(gitPath, "HEAD")) || existsSync117(join133(gitPath, "config")) || existsSync117(join133(gitPath, "commondir"));
|
|
@@ -621487,7 +621505,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
621487
621505
|
const gitignoreDir = dirname40(gitignorePath);
|
|
621488
621506
|
const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
621489
621507
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
621490
|
-
const content =
|
|
621508
|
+
const content = readFileSync96(gitignorePath, "utf-8");
|
|
621491
621509
|
const normalizedTarget = normalizeIgnoreRule(ignorePattern);
|
|
621492
621510
|
const alreadyIgnored = content.split(/\r?\n/).some((line) => {
|
|
621493
621511
|
const trimmed = line.trim();
|
|
@@ -621610,7 +621628,7 @@ function loadProjectSettings(repoRoot) {
|
|
|
621610
621628
|
const settingsPath = join133(repoRoot, OMNIUS_DIR, "settings.json");
|
|
621611
621629
|
try {
|
|
621612
621630
|
if (existsSync117(settingsPath)) {
|
|
621613
|
-
return JSON.parse(
|
|
621631
|
+
return JSON.parse(readFileSync96(settingsPath, "utf-8"));
|
|
621614
621632
|
}
|
|
621615
621633
|
} catch {
|
|
621616
621634
|
}
|
|
@@ -621627,7 +621645,7 @@ function loadGlobalSettings() {
|
|
|
621627
621645
|
const settingsPath = join133(homedir41(), ".omnius", "settings.json");
|
|
621628
621646
|
try {
|
|
621629
621647
|
if (existsSync117(settingsPath)) {
|
|
621630
|
-
return JSON.parse(
|
|
621648
|
+
return JSON.parse(readFileSync96(settingsPath, "utf-8"));
|
|
621631
621649
|
}
|
|
621632
621650
|
} catch {
|
|
621633
621651
|
}
|
|
@@ -621658,7 +621676,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
621658
621676
|
if (existsSync117(filePath) && !seen.has(filePath)) {
|
|
621659
621677
|
seen.add(filePath);
|
|
621660
621678
|
try {
|
|
621661
|
-
let content =
|
|
621679
|
+
let content = readFileSync96(filePath, "utf-8");
|
|
621662
621680
|
if (content.length > maxContentLen) {
|
|
621663
621681
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
621664
621682
|
}
|
|
@@ -621691,7 +621709,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
621691
621709
|
function readIndexMeta(repoRoot) {
|
|
621692
621710
|
const metaPath = join133(repoRoot, OMNIUS_DIR, "index", "meta.json");
|
|
621693
621711
|
try {
|
|
621694
|
-
return JSON.parse(
|
|
621712
|
+
return JSON.parse(readFileSync96(metaPath, "utf-8"));
|
|
621695
621713
|
} catch {
|
|
621696
621714
|
return null;
|
|
621697
621715
|
}
|
|
@@ -621704,7 +621722,7 @@ function writeIndexMeta(repoRoot, meta) {
|
|
|
621704
621722
|
function readIndexData(repoRoot, filename) {
|
|
621705
621723
|
const filePath = join133(repoRoot, OMNIUS_DIR, "index", filename);
|
|
621706
621724
|
try {
|
|
621707
|
-
return JSON.parse(
|
|
621725
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621708
621726
|
} catch {
|
|
621709
621727
|
return null;
|
|
621710
621728
|
}
|
|
@@ -621783,7 +621801,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
621783
621801
|
}).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
|
|
621784
621802
|
return files.map((f2) => {
|
|
621785
621803
|
try {
|
|
621786
|
-
return JSON.parse(
|
|
621804
|
+
return JSON.parse(readFileSync96(join133(historyDir, f2.file), "utf-8"));
|
|
621787
621805
|
} catch {
|
|
621788
621806
|
return null;
|
|
621789
621807
|
}
|
|
@@ -621807,7 +621825,7 @@ function loadPendingTask(repoRoot) {
|
|
|
621807
621825
|
const filePath = join133(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
|
|
621808
621826
|
try {
|
|
621809
621827
|
if (!existsSync117(filePath)) return null;
|
|
621810
|
-
const data = JSON.parse(
|
|
621828
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621811
621829
|
try {
|
|
621812
621830
|
unlinkSync22(filePath);
|
|
621813
621831
|
} catch {
|
|
@@ -621837,7 +621855,7 @@ function readTaskHandoff2(repoRoot) {
|
|
|
621837
621855
|
const filePath = join133(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
|
|
621838
621856
|
try {
|
|
621839
621857
|
if (!existsSync117(filePath)) return null;
|
|
621840
|
-
const data = JSON.parse(
|
|
621858
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621841
621859
|
const handoffTime = new Date(data.handoffAt).getTime();
|
|
621842
621860
|
const now2 = Date.now();
|
|
621843
621861
|
const ageMs = now2 - handoffTime;
|
|
@@ -621923,7 +621941,7 @@ function acquireLock(lockPath) {
|
|
|
621923
621941
|
} catch (err) {
|
|
621924
621942
|
if (existsSync117(lockPath)) {
|
|
621925
621943
|
try {
|
|
621926
|
-
const lockContent =
|
|
621944
|
+
const lockContent = readFileSync96(lockPath, "utf-8");
|
|
621927
621945
|
const lock = JSON.parse(lockContent);
|
|
621928
621946
|
const lockAge = Date.now() - lock.acquiredAt;
|
|
621929
621947
|
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
@@ -621949,7 +621967,7 @@ function acquireLock(lockPath) {
|
|
|
621949
621967
|
function releaseLock(lockPath) {
|
|
621950
621968
|
try {
|
|
621951
621969
|
if (existsSync117(lockPath)) {
|
|
621952
|
-
const lockContent =
|
|
621970
|
+
const lockContent = readFileSync96(lockPath, "utf-8");
|
|
621953
621971
|
const lock = JSON.parse(lockContent);
|
|
621954
621972
|
if (lock.pid === process.pid) {
|
|
621955
621973
|
unlinkSync22(lockPath);
|
|
@@ -622041,7 +622059,7 @@ function pruneContextLedger(ledgerPath) {
|
|
|
622041
622059
|
if (!existsSync117(ledgerPath)) return;
|
|
622042
622060
|
const st = statSync44(ledgerPath);
|
|
622043
622061
|
if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
|
|
622044
|
-
const lines =
|
|
622062
|
+
const lines = readFileSync96(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
622045
622063
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
622046
622064
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
622047
622065
|
const archiveDir = join133(dirname40(ledgerPath), "archive");
|
|
@@ -622069,7 +622087,7 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
622069
622087
|
let ctx3;
|
|
622070
622088
|
try {
|
|
622071
622089
|
if (existsSync117(filePath)) {
|
|
622072
|
-
ctx3 = JSON.parse(
|
|
622090
|
+
ctx3 = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622073
622091
|
} else {
|
|
622074
622092
|
ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
|
|
622075
622093
|
}
|
|
@@ -622231,7 +622249,7 @@ function loadSessionContext(repoRoot) {
|
|
|
622231
622249
|
const filePath = join133(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
|
|
622232
622250
|
try {
|
|
622233
622251
|
if (!existsSync117(filePath)) return null;
|
|
622234
|
-
return JSON.parse(
|
|
622252
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622235
622253
|
} catch {
|
|
622236
622254
|
return null;
|
|
622237
622255
|
}
|
|
@@ -622239,7 +622257,7 @@ function loadSessionContext(repoRoot) {
|
|
|
622239
622257
|
function readJsonOrNull(filePath) {
|
|
622240
622258
|
try {
|
|
622241
622259
|
if (!existsSync117(filePath)) return null;
|
|
622242
|
-
return JSON.parse(
|
|
622260
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622243
622261
|
} catch {
|
|
622244
622262
|
return null;
|
|
622245
622263
|
}
|
|
@@ -622450,7 +622468,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
|
|
|
622450
622468
|
const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
622451
622469
|
try {
|
|
622452
622470
|
if (!existsSync117(indexPath)) return false;
|
|
622453
|
-
const index = JSON.parse(
|
|
622471
|
+
const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622454
622472
|
const idx = index.findIndex((e2) => e2.id === sessionId);
|
|
622455
622473
|
if (idx < 0) return false;
|
|
622456
622474
|
index[idx] = { ...index[idx], ...patch };
|
|
@@ -622499,7 +622517,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
|
|
|
622499
622517
|
let index = [];
|
|
622500
622518
|
try {
|
|
622501
622519
|
if (existsSync117(indexPath)) {
|
|
622502
|
-
index = JSON.parse(
|
|
622520
|
+
index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622503
622521
|
}
|
|
622504
622522
|
} catch {
|
|
622505
622523
|
}
|
|
@@ -622531,7 +622549,7 @@ function listSessions(repoRoot) {
|
|
|
622531
622549
|
const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
622532
622550
|
try {
|
|
622533
622551
|
if (!existsSync117(indexPath)) return [];
|
|
622534
|
-
const index = JSON.parse(
|
|
622552
|
+
const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622535
622553
|
return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
|
|
622536
622554
|
} catch {
|
|
622537
622555
|
return [];
|
|
@@ -622541,7 +622559,7 @@ function loadSessionHistory(repoRoot, sessionId) {
|
|
|
622541
622559
|
const contentPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
622542
622560
|
try {
|
|
622543
622561
|
if (!existsSync117(contentPath)) return null;
|
|
622544
|
-
return
|
|
622562
|
+
return readFileSync96(contentPath, "utf-8").split("\n");
|
|
622545
622563
|
} catch {
|
|
622546
622564
|
return null;
|
|
622547
622565
|
}
|
|
@@ -622553,7 +622571,7 @@ function deleteSession(repoRoot, sessionId) {
|
|
|
622553
622571
|
const contentPath = join133(sessDir, `${sessionId}.jsonl`);
|
|
622554
622572
|
if (existsSync117(contentPath)) unlinkSync22(contentPath);
|
|
622555
622573
|
if (existsSync117(indexPath)) {
|
|
622556
|
-
let index = JSON.parse(
|
|
622574
|
+
let index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622557
622575
|
index = index.filter((s2) => s2.id !== sessionId);
|
|
622558
622576
|
writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
|
|
622559
622577
|
}
|
|
@@ -622610,7 +622628,7 @@ function detectManifests(repoRoot) {
|
|
|
622610
622628
|
let name10;
|
|
622611
622629
|
if (check.nameField) {
|
|
622612
622630
|
try {
|
|
622613
|
-
const data = JSON.parse(
|
|
622631
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622614
622632
|
name10 = data[check.nameField];
|
|
622615
622633
|
} catch {
|
|
622616
622634
|
}
|
|
@@ -622681,7 +622699,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
622681
622699
|
function loadUsageFile(filePath) {
|
|
622682
622700
|
try {
|
|
622683
622701
|
if (existsSync117(filePath)) {
|
|
622684
|
-
return JSON.parse(
|
|
622702
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622685
622703
|
}
|
|
622686
622704
|
} catch {
|
|
622687
622705
|
}
|
|
@@ -623008,7 +623026,7 @@ var init_session_summary = __esm({
|
|
|
623008
623026
|
|
|
623009
623027
|
// packages/cli/src/tui/cad-model-viewer.ts
|
|
623010
623028
|
import { createServer as createServer7 } from "node:http";
|
|
623011
|
-
import { existsSync as existsSync118, readFileSync as
|
|
623029
|
+
import { existsSync as existsSync118, readFileSync as readFileSync97, statSync as statSync45 } from "node:fs";
|
|
623012
623030
|
import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
|
|
623013
623031
|
function getCurrentCadModelViewer() {
|
|
623014
623032
|
return currentViewer;
|
|
@@ -623068,7 +623086,7 @@ function handleViewerRequest(req3, res, filePath) {
|
|
|
623068
623086
|
"Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
|
|
623069
623087
|
"Cache-Control": "no-store"
|
|
623070
623088
|
});
|
|
623071
|
-
res.end(
|
|
623089
|
+
res.end(readFileSync97(filePath));
|
|
623072
623090
|
} catch (err) {
|
|
623073
623091
|
sendText(res, 500, err instanceof Error ? err.message : String(err));
|
|
623074
623092
|
}
|
|
@@ -623472,7 +623490,7 @@ var init_render2 = __esm({
|
|
|
623472
623490
|
});
|
|
623473
623491
|
|
|
623474
623492
|
// packages/prompts/dist/promptLoader.js
|
|
623475
|
-
import { readFileSync as
|
|
623493
|
+
import { readFileSync as readFileSync99, existsSync as existsSync120 } from "node:fs";
|
|
623476
623494
|
import { join as join135, dirname as dirname41 } from "node:path";
|
|
623477
623495
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
623478
623496
|
function loadPrompt2(promptPath, vars) {
|
|
@@ -623482,7 +623500,7 @@ function loadPrompt2(promptPath, vars) {
|
|
|
623482
623500
|
if (!existsSync120(fullPath)) {
|
|
623483
623501
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
623484
623502
|
}
|
|
623485
|
-
content =
|
|
623503
|
+
content = readFileSync99(fullPath, "utf-8");
|
|
623486
623504
|
cache6.set(promptPath, content);
|
|
623487
623505
|
}
|
|
623488
623506
|
if (!vars)
|
|
@@ -624579,7 +624597,7 @@ __export(tui_tasks_renderer_exports, {
|
|
|
624579
624597
|
setTuiTasksSession: () => setTuiTasksSession,
|
|
624580
624598
|
teardownTuiTasks: () => teardownTuiTasks
|
|
624581
624599
|
});
|
|
624582
|
-
import { existsSync as existsSync121, readFileSync as
|
|
624600
|
+
import { existsSync as existsSync121, readFileSync as readFileSync100, watch as fsWatch3 } from "node:fs";
|
|
624583
624601
|
import { join as join137 } from "node:path";
|
|
624584
624602
|
import { homedir as homedir43 } from "node:os";
|
|
624585
624603
|
function setTasksRendererWriter(writer) {
|
|
@@ -624706,7 +624724,7 @@ function loadTodos() {
|
|
|
624706
624724
|
_lastTodos = [];
|
|
624707
624725
|
return;
|
|
624708
624726
|
}
|
|
624709
|
-
const parsed = JSON.parse(
|
|
624727
|
+
const parsed = JSON.parse(readFileSync100(fp, "utf-8"));
|
|
624710
624728
|
_lastTodos = Array.isArray(parsed) ? parsed : [];
|
|
624711
624729
|
} catch {
|
|
624712
624730
|
_lastTodos = [];
|
|
@@ -630551,7 +630569,7 @@ __export(personaplex_exports, {
|
|
|
630551
630569
|
startPersonaPlexDaemon: () => startPersonaPlexDaemon,
|
|
630552
630570
|
stopPersonaPlex: () => stopPersonaPlex
|
|
630553
630571
|
});
|
|
630554
|
-
import { existsSync as existsSync122, writeFileSync as writeFileSync65, readFileSync as
|
|
630572
|
+
import { existsSync as existsSync122, writeFileSync as writeFileSync65, readFileSync as readFileSync101, mkdirSync as mkdirSync76, copyFileSync as copyFileSync5, readdirSync as readdirSync41, statSync as statSync46 } from "node:fs";
|
|
630555
630573
|
import { join as join138, dirname as dirname43 } from "node:path";
|
|
630556
630574
|
import { homedir as homedir44 } from "node:os";
|
|
630557
630575
|
import { spawn as spawn32 } from "node:child_process";
|
|
@@ -630590,9 +630608,9 @@ function selectWeightTier(vramGB) {
|
|
|
630590
630608
|
}
|
|
630591
630609
|
function detectJetson() {
|
|
630592
630610
|
try {
|
|
630593
|
-
const model =
|
|
630611
|
+
const model = readFileSync101("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
|
|
630594
630612
|
if (/jetson|orin|tegra/i.test(model)) {
|
|
630595
|
-
const memInfo =
|
|
630613
|
+
const memInfo = readFileSync101("/proc/meminfo", "utf8");
|
|
630596
630614
|
const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
|
|
630597
630615
|
return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
|
|
630598
630616
|
}
|
|
@@ -630667,7 +630685,7 @@ function fileLink2(filePath, label) {
|
|
|
630667
630685
|
}
|
|
630668
630686
|
async function isPersonaPlexRunning() {
|
|
630669
630687
|
if (!existsSync122(PID_FILE)) return false;
|
|
630670
|
-
const pid = parseInt(
|
|
630688
|
+
const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
|
|
630671
630689
|
if (isNaN(pid) || pid <= 0) return false;
|
|
630672
630690
|
try {
|
|
630673
630691
|
process.kill(pid, 0);
|
|
@@ -630679,7 +630697,7 @@ async function isPersonaPlexRunning() {
|
|
|
630679
630697
|
async function getPersonaPlexWSUrl() {
|
|
630680
630698
|
if (!await isPersonaPlexRunning()) return null;
|
|
630681
630699
|
if (!existsSync122(PORT_FILE)) return null;
|
|
630682
|
-
const port = parseInt(
|
|
630700
|
+
const port = parseInt(readFileSync101(PORT_FILE, "utf8").trim(), 10);
|
|
630683
630701
|
return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
|
|
630684
630702
|
}
|
|
630685
630703
|
function isPersonaPlexInstalled() {
|
|
@@ -630689,7 +630707,7 @@ async function getWeightTier() {
|
|
|
630689
630707
|
const detected = await detectPersonaPlexCapability();
|
|
630690
630708
|
const tierFile = join138(PERSONAPLEX_DIR, "weight_tier");
|
|
630691
630709
|
if (existsSync122(tierFile)) {
|
|
630692
|
-
const saved =
|
|
630710
|
+
const saved = readFileSync101(tierFile, "utf8").trim();
|
|
630693
630711
|
if (saved in WEIGHT_REPOS) {
|
|
630694
630712
|
const vram = detected.vramGB;
|
|
630695
630713
|
if (saved === "nf4-distilled" && vram < 24) {
|
|
@@ -630819,7 +630837,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
630819
630837
|
})).trim();
|
|
630820
630838
|
const serverFile = join138(sitePackages, "server.py");
|
|
630821
630839
|
if (existsSync122(serverFile)) {
|
|
630822
|
-
let src2 =
|
|
630840
|
+
let src2 = readFileSync101(serverFile, "utf8");
|
|
630823
630841
|
if (src2.includes('int(request["seed"])')) {
|
|
630824
630842
|
src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
|
|
630825
630843
|
writeFileSync65(serverFile, src2);
|
|
@@ -630835,7 +630853,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
630835
630853
|
})).trim();
|
|
630836
630854
|
const loadersFile = join138(sitePackages, "models", "loaders.py");
|
|
630837
630855
|
if (existsSync122(loadersFile)) {
|
|
630838
|
-
let src2 =
|
|
630856
|
+
let src2 = readFileSync101(loadersFile, "utf8");
|
|
630839
630857
|
if (!src2.includes("_dequantize_2bit_state_dict")) {
|
|
630840
630858
|
const dequantPatch = `
|
|
630841
630859
|
import math
|
|
@@ -630938,28 +630956,28 @@ $2if filename.endswith(".safetensors"):`
|
|
|
630938
630956
|
})).trim();
|
|
630939
630957
|
const hybridDest = join138(sitePackages2, "hybrid_agent.py");
|
|
630940
630958
|
const serverDest = join138(sitePackages2, "server.py");
|
|
630941
|
-
if (!existsSync122(hybridDest) || !
|
|
630959
|
+
if (!existsSync122(hybridDest) || !readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
630942
630960
|
log22("Deploying hybrid_agent.py (Omnius API integration)...");
|
|
630943
630961
|
try {
|
|
630944
630962
|
await execAsync(
|
|
630945
630963
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
|
|
630946
630964
|
{ timeout: 3e4 }
|
|
630947
630965
|
);
|
|
630948
|
-
if (existsSync122(hybridDest) &&
|
|
630966
|
+
if (existsSync122(hybridDest) && readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
630949
630967
|
log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
|
|
630950
630968
|
}
|
|
630951
630969
|
} catch {
|
|
630952
630970
|
log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
|
|
630953
630971
|
}
|
|
630954
630972
|
}
|
|
630955
|
-
if (!
|
|
630973
|
+
if (!readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
|
|
630956
630974
|
log22("Deploying patched server.py (hybrid mode + API endpoints)...");
|
|
630957
630975
|
try {
|
|
630958
630976
|
await execAsync(
|
|
630959
630977
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
|
|
630960
630978
|
{ timeout: 3e4 }
|
|
630961
630979
|
);
|
|
630962
|
-
if (
|
|
630980
|
+
if (readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
|
|
630963
630981
|
log22("server.py patched with hybrid intercept + REST APIs.");
|
|
630964
630982
|
}
|
|
630965
630983
|
} catch {
|
|
@@ -631149,7 +631167,7 @@ print('Converted')
|
|
|
631149
631167
|
let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
|
|
631150
631168
|
if (!ollamaModel) {
|
|
631151
631169
|
try {
|
|
631152
|
-
const omniusConfig = JSON.parse(
|
|
631170
|
+
const omniusConfig = JSON.parse(readFileSync101(join138(homedir44(), ".omnius", "config.json"), "utf8"));
|
|
631153
631171
|
if (omniusConfig.model) ollamaModel = omniusConfig.model;
|
|
631154
631172
|
} catch {
|
|
631155
631173
|
}
|
|
@@ -631245,7 +631263,7 @@ print('Converted')
|
|
|
631245
631263
|
}
|
|
631246
631264
|
async function stopPersonaPlex() {
|
|
631247
631265
|
if (!existsSync122(PID_FILE)) return;
|
|
631248
|
-
const pid = parseInt(
|
|
631266
|
+
const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
|
|
631249
631267
|
if (isNaN(pid) || pid <= 0) return;
|
|
631250
631268
|
try {
|
|
631251
631269
|
if (process.platform === "win32") {
|
|
@@ -631442,7 +631460,7 @@ function patchFrontendVoiceList(onInfo) {
|
|
|
631442
631460
|
for (const f2 of readdirSync41(distDir)) {
|
|
631443
631461
|
if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
|
|
631444
631462
|
const jsPath = join138(distDir, f2);
|
|
631445
|
-
let js =
|
|
631463
|
+
let js = readFileSync101(jsPath, "utf8");
|
|
631446
631464
|
const customVoices = [];
|
|
631447
631465
|
if (existsSync122(CUSTOM_VOICES_DIR)) {
|
|
631448
631466
|
for (const vf of readdirSync41(CUSTOM_VOICES_DIR)) {
|
|
@@ -631562,7 +631580,7 @@ __export(setup_exports, {
|
|
|
631562
631580
|
import * as readline from "node:readline";
|
|
631563
631581
|
import { spawn as spawn33, exec as exec5 } from "node:child_process";
|
|
631564
631582
|
import { promisify as promisify7 } from "node:util";
|
|
631565
|
-
import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as
|
|
631583
|
+
import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as readFileSync102, appendFileSync as appendFileSync14, mkdirSync as mkdirSync77, chmodSync as chmodSync3 } from "node:fs";
|
|
631566
631584
|
import { delimiter as pathDelimiter, join as join139 } from "node:path";
|
|
631567
631585
|
import { freemem as freemem6, homedir as homedir45, platform as platform5, totalmem as totalmem8 } from "node:os";
|
|
631568
631586
|
function wrapText2(value2, width) {
|
|
@@ -631618,14 +631636,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
|
|
|
631618
631636
|
}
|
|
631619
631637
|
try {
|
|
631620
631638
|
if (existsSync123("/sys/devices/soc0/family")) {
|
|
631621
|
-
const family =
|
|
631639
|
+
const family = readFileSync102("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
|
|
631622
631640
|
if (family.includes("tegra")) return true;
|
|
631623
631641
|
}
|
|
631624
631642
|
} catch {
|
|
631625
631643
|
}
|
|
631626
631644
|
try {
|
|
631627
631645
|
if (existsSync123("/proc/device-tree/model")) {
|
|
631628
|
-
const model =
|
|
631646
|
+
const model = readFileSync102("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
|
|
631629
631647
|
if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
|
|
631630
631648
|
return true;
|
|
631631
631649
|
}
|
|
@@ -632779,7 +632797,7 @@ async function runOptionalDepsSetup(rl) {
|
|
|
632779
632797
|
}
|
|
632780
632798
|
const askTranscribe = await ask(rl, ` ${c3.bold("Install transcribe-cli for live transcription?")} (Y/n) `);
|
|
632781
632799
|
if (askTranscribe.toLowerCase() !== "n") {
|
|
632782
|
-
process.stdout.write(` ${c3.cyan("●")} Installing transcribe-cli
|
|
632800
|
+
process.stdout.write(` ${c3.cyan("●")} Installing managed transcribe-cli runtime...
|
|
632783
632801
|
`);
|
|
632784
632802
|
try {
|
|
632785
632803
|
const ok3 = await ensureTranscribeCliBackground();
|
|
@@ -633579,7 +633597,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
633579
633597
|
let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
|
|
633580
633598
|
try {
|
|
633581
633599
|
if (existsSync123(_visionMarkerFile)) {
|
|
633582
|
-
const _vm = JSON.parse(
|
|
633600
|
+
const _vm = JSON.parse(readFileSync102(_visionMarkerFile, "utf8"));
|
|
633583
633601
|
_visionPreviouslyInstalled = new Set(_vm.installed || []);
|
|
633584
633602
|
}
|
|
633585
633603
|
} catch {
|
|
@@ -634411,7 +634429,7 @@ function ensurePathInShellRc(binDir) {
|
|
|
634411
634429
|
const shell = process.env.SHELL ?? "";
|
|
634412
634430
|
const rcFile = shell.includes("zsh") ? join139(homedir45(), ".zshrc") : join139(homedir45(), ".bashrc");
|
|
634413
634431
|
try {
|
|
634414
|
-
const rcContent = existsSync123(rcFile) ?
|
|
634432
|
+
const rcContent = existsSync123(rcFile) ? readFileSync102(rcFile, "utf8") : "";
|
|
634415
634433
|
if (rcContent.includes(binDir)) return;
|
|
634416
634434
|
const exportLine = `
|
|
634417
634435
|
export PATH="${binDir}:$PATH" # Added by omnius for nvim
|
|
@@ -635191,7 +635209,7 @@ var init_platforms = __esm({
|
|
|
635191
635209
|
});
|
|
635192
635210
|
|
|
635193
635211
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
635194
|
-
import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as
|
|
635212
|
+
import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as readFileSync103, statSync as statSync47 } from "node:fs";
|
|
635195
635213
|
import { basename as basename27, extname as extname17, join as join140, relative as relative14, resolve as resolve59 } from "node:path";
|
|
635196
635214
|
function exploreWorkspace(root, options2 = {}) {
|
|
635197
635215
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
@@ -635290,7 +635308,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
|
635290
635308
|
""
|
|
635291
635309
|
].join("\n");
|
|
635292
635310
|
}
|
|
635293
|
-
const content =
|
|
635311
|
+
const content = readFileSync103(full, "utf8");
|
|
635294
635312
|
const rawLines = content.split(/\r?\n/);
|
|
635295
635313
|
const visible = rawLines.slice(0, maxLines);
|
|
635296
635314
|
const gutter = String(Math.min(rawLines.length, maxLines)).length;
|
|
@@ -635466,7 +635484,7 @@ var init_pricing = __esm({
|
|
|
635466
635484
|
});
|
|
635467
635485
|
|
|
635468
635486
|
// packages/cli/src/insights/engine.ts
|
|
635469
|
-
import { readdirSync as readdirSync43, readFileSync as
|
|
635487
|
+
import { readdirSync as readdirSync43, readFileSync as readFileSync104, existsSync as existsSync126 } from "node:fs";
|
|
635470
635488
|
import { join as join141 } from "node:path";
|
|
635471
635489
|
function formatDuration5(seconds) {
|
|
635472
635490
|
if (seconds < 60) return `${Math.round(seconds)}s`;
|
|
@@ -635541,7 +635559,7 @@ var init_engine = __esm({
|
|
|
635541
635559
|
return readdirSync43(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
|
|
635542
635560
|
try {
|
|
635543
635561
|
const data = JSON.parse(
|
|
635544
|
-
|
|
635562
|
+
readFileSync104(join141(this.historyDir, f2), "utf-8")
|
|
635545
635563
|
);
|
|
635546
635564
|
return data;
|
|
635547
635565
|
} catch {
|
|
@@ -635559,7 +635577,7 @@ var init_engine = __esm({
|
|
|
635559
635577
|
loadUsageStore() {
|
|
635560
635578
|
try {
|
|
635561
635579
|
if (existsSync126(this.usageFile)) {
|
|
635562
|
-
return JSON.parse(
|
|
635580
|
+
return JSON.parse(readFileSync104(this.usageFile, "utf-8"));
|
|
635563
635581
|
}
|
|
635564
635582
|
} catch {
|
|
635565
635583
|
}
|
|
@@ -638342,7 +638360,7 @@ var init_memory_menu = __esm({
|
|
|
638342
638360
|
});
|
|
638343
638361
|
|
|
638344
638362
|
// packages/cli/src/tui/audio-waveform.ts
|
|
638345
|
-
import { readFileSync as
|
|
638363
|
+
import { readFileSync as readFileSync105 } from "node:fs";
|
|
638346
638364
|
import { createRequire as createRequire6 } from "node:module";
|
|
638347
638365
|
function readAscii(buffer2, offset, length4) {
|
|
638348
638366
|
return buffer2.subarray(offset, offset + length4).toString("ascii");
|
|
@@ -638416,7 +638434,7 @@ function renderAudioWaveform(file, options2 = {}) {
|
|
|
638416
638434
|
} catch {
|
|
638417
638435
|
return null;
|
|
638418
638436
|
}
|
|
638419
|
-
const buffer2 =
|
|
638437
|
+
const buffer2 = readFileSync105(file);
|
|
638420
638438
|
const info = parseWav(buffer2);
|
|
638421
638439
|
if (!info) return null;
|
|
638422
638440
|
const frameCount = Math.floor(info.dataSize / info.frameSize);
|
|
@@ -638972,7 +638990,7 @@ __export(daemon_exports, {
|
|
|
638972
638990
|
stopDaemon: () => stopDaemon
|
|
638973
638991
|
});
|
|
638974
638992
|
import { spawn as spawn34 } from "node:child_process";
|
|
638975
|
-
import { existsSync as existsSync130, readFileSync as
|
|
638993
|
+
import { existsSync as existsSync130, readFileSync as readFileSync106, writeFileSync as writeFileSync67, mkdirSync as mkdirSync78, unlinkSync as unlinkSync25, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
638976
638994
|
import { join as join144 } from "node:path";
|
|
638977
638995
|
import { homedir as homedir47 } from "node:os";
|
|
638978
638996
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
@@ -639003,7 +639021,7 @@ function getLocalCliVersion() {
|
|
|
639003
639021
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
639004
639022
|
const p2 = join144(here, rel);
|
|
639005
639023
|
if (existsSync130(p2)) {
|
|
639006
|
-
const v = JSON.parse(
|
|
639024
|
+
const v = JSON.parse(readFileSync106(p2, "utf8"))?.version;
|
|
639007
639025
|
if (v) return String(v);
|
|
639008
639026
|
}
|
|
639009
639027
|
}
|
|
@@ -639042,7 +639060,7 @@ async function restartDaemon(port) {
|
|
|
639042
639060
|
function getDaemonPid() {
|
|
639043
639061
|
if (!existsSync130(PID_FILE2)) return null;
|
|
639044
639062
|
try {
|
|
639045
|
-
const pid = parseInt(
|
|
639063
|
+
const pid = parseInt(readFileSync106(PID_FILE2, "utf8").trim(), 10);
|
|
639046
639064
|
if (!pid || pid <= 0) return null;
|
|
639047
639065
|
process.kill(pid, 0);
|
|
639048
639066
|
return pid;
|
|
@@ -639057,7 +639075,7 @@ function getDaemonPid() {
|
|
|
639057
639075
|
function looksLikeNodeEntrypoint(path12) {
|
|
639058
639076
|
if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
|
|
639059
639077
|
try {
|
|
639060
|
-
const firstBytes =
|
|
639078
|
+
const firstBytes = readFileSync106(path12, "utf8").slice(0, 200);
|
|
639061
639079
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
639062
639080
|
} catch {
|
|
639063
639081
|
return false;
|
|
@@ -639731,7 +639749,7 @@ var init_types5 = __esm({
|
|
|
639731
639749
|
|
|
639732
639750
|
// packages/cli/src/cron/store.ts
|
|
639733
639751
|
import {
|
|
639734
|
-
readFileSync as
|
|
639752
|
+
readFileSync as readFileSync107,
|
|
639735
639753
|
writeFileSync as writeFileSync68,
|
|
639736
639754
|
mkdirSync as mkdirSync79,
|
|
639737
639755
|
chmodSync as chmodSync4,
|
|
@@ -639918,7 +639936,7 @@ function loadJobs() {
|
|
|
639918
639936
|
const path12 = jobsFilePath();
|
|
639919
639937
|
if (!existsSync133(path12)) return [];
|
|
639920
639938
|
try {
|
|
639921
|
-
const data = JSON.parse(
|
|
639939
|
+
const data = JSON.parse(readFileSync107(path12, "utf-8"));
|
|
639922
639940
|
return data.jobs || [];
|
|
639923
639941
|
} catch {
|
|
639924
639942
|
return [];
|
|
@@ -640286,7 +640304,7 @@ import {
|
|
|
640286
640304
|
closeSync as closeSync5,
|
|
640287
640305
|
writeFileSync as writeFileSync69,
|
|
640288
640306
|
unlinkSync as unlinkSync27,
|
|
640289
|
-
readFileSync as
|
|
640307
|
+
readFileSync as readFileSync108
|
|
640290
640308
|
} from "node:fs";
|
|
640291
640309
|
import { join as join148 } from "node:path";
|
|
640292
640310
|
import { homedir as homedir49 } from "node:os";
|
|
@@ -640303,7 +640321,7 @@ function acquireTickLock() {
|
|
|
640303
640321
|
mkdirSync80(cronDir2(), { recursive: true });
|
|
640304
640322
|
try {
|
|
640305
640323
|
if (existsSync134(lockPath)) {
|
|
640306
|
-
const content =
|
|
640324
|
+
const content = readFileSync108(lockPath, "utf-8").trim();
|
|
640307
640325
|
if (content) {
|
|
640308
640326
|
const lock = JSON.parse(content);
|
|
640309
640327
|
const age = Date.now() - lock.acquiredAt;
|
|
@@ -640671,7 +640689,7 @@ __export(sponsor_wizard_exports, {
|
|
|
640671
640689
|
selectedModelsForEndpoint: () => selectedModelsForEndpoint,
|
|
640672
640690
|
showSponsorDashboard: () => showSponsorDashboard
|
|
640673
640691
|
});
|
|
640674
|
-
import { existsSync as existsSync135, readFileSync as
|
|
640692
|
+
import { existsSync as existsSync135, readFileSync as readFileSync109, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
|
|
640675
640693
|
import { join as join149 } from "node:path";
|
|
640676
640694
|
function fmtTokens2(n2) {
|
|
640677
640695
|
if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
|
|
@@ -640692,7 +640710,7 @@ function loadSponsorConfig(projectDir2) {
|
|
|
640692
640710
|
const p2 = configPath(projectDir2);
|
|
640693
640711
|
if (!existsSync135(p2)) return null;
|
|
640694
640712
|
try {
|
|
640695
|
-
return JSON.parse(
|
|
640713
|
+
return JSON.parse(readFileSync109(p2, "utf8"));
|
|
640696
640714
|
} catch {
|
|
640697
640715
|
return null;
|
|
640698
640716
|
}
|
|
@@ -642039,7 +642057,7 @@ import {
|
|
|
642039
642057
|
existsSync as existsSync136,
|
|
642040
642058
|
mkdirSync as mkdirSync82,
|
|
642041
642059
|
writeFileSync as writeFileSync71,
|
|
642042
|
-
readFileSync as
|
|
642060
|
+
readFileSync as readFileSync110,
|
|
642043
642061
|
unlinkSync as unlinkSync28,
|
|
642044
642062
|
readdirSync as readdirSync45,
|
|
642045
642063
|
statSync as statSync50,
|
|
@@ -643540,7 +643558,7 @@ except Exception as exc:
|
|
|
643540
643558
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
643541
643559
|
const destPath = join150(refsDir, destFilename);
|
|
643542
643560
|
try {
|
|
643543
|
-
const data =
|
|
643561
|
+
const data = readFileSync110(audioPath);
|
|
643544
643562
|
writeFileSync71(destPath, data);
|
|
643545
643563
|
} catch (err) {
|
|
643546
643564
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -643615,7 +643633,7 @@ except Exception as exc:
|
|
|
643615
643633
|
const p2 = _VoiceEngine.cloneMetaFile();
|
|
643616
643634
|
if (!existsSync136(p2)) return {};
|
|
643617
643635
|
try {
|
|
643618
|
-
const raw = JSON.parse(
|
|
643636
|
+
const raw = JSON.parse(readFileSync110(p2, "utf8"));
|
|
643619
643637
|
if (typeof Object.values(raw)[0] === "string") {
|
|
643620
643638
|
const migrated = {};
|
|
643621
643639
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -644501,7 +644519,7 @@ except Exception as exc:
|
|
|
644501
644519
|
}
|
|
644502
644520
|
loadMisottsStore() {
|
|
644503
644521
|
try {
|
|
644504
|
-
const raw = JSON.parse(
|
|
644522
|
+
const raw = JSON.parse(readFileSync110(misottsProfilesFile(), "utf-8"));
|
|
644505
644523
|
const profiles = {};
|
|
644506
644524
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
644507
644525
|
profiles[name10] = normalizeMisottsSettings(settings);
|
|
@@ -644525,7 +644543,7 @@ except Exception as exc:
|
|
|
644525
644543
|
loadSupertonicStore() {
|
|
644526
644544
|
try {
|
|
644527
644545
|
const raw = JSON.parse(
|
|
644528
|
-
|
|
644546
|
+
readFileSync110(supertonicProfilesFile(), "utf-8")
|
|
644529
644547
|
);
|
|
644530
644548
|
const profiles = {};
|
|
644531
644549
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
@@ -644692,7 +644710,7 @@ except Exception as exc:
|
|
|
644692
644710
|
const wavPath = await this.synthesizeSupertonicWav(text2, 1);
|
|
644693
644711
|
if (!wavPath) return null;
|
|
644694
644712
|
try {
|
|
644695
|
-
const data =
|
|
644713
|
+
const data = readFileSync110(wavPath);
|
|
644696
644714
|
unlinkSync28(wavPath);
|
|
644697
644715
|
return data;
|
|
644698
644716
|
} catch {
|
|
@@ -644840,7 +644858,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644840
644858
|
if (!existsSync136(wavPath)) return;
|
|
644841
644859
|
if (volume !== 1) {
|
|
644842
644860
|
try {
|
|
644843
|
-
const wavData =
|
|
644861
|
+
const wavData = readFileSync110(wavPath);
|
|
644844
644862
|
if (wavData.length > 44) {
|
|
644845
644863
|
const header = wavData.subarray(0, 44);
|
|
644846
644864
|
const samples = new Int16Array(
|
|
@@ -644862,7 +644880,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644862
644880
|
}
|
|
644863
644881
|
if (this.onPCMOutput) {
|
|
644864
644882
|
try {
|
|
644865
|
-
const wavData =
|
|
644883
|
+
const wavData = readFileSync110(wavPath);
|
|
644866
644884
|
if (wavData.length > 44) {
|
|
644867
644885
|
const pcm = Buffer.from(
|
|
644868
644886
|
wavData.buffer,
|
|
@@ -644920,7 +644938,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644920
644938
|
}
|
|
644921
644939
|
if (!existsSync136(wavPath)) return null;
|
|
644922
644940
|
try {
|
|
644923
|
-
const data =
|
|
644941
|
+
const data = readFileSync110(wavPath);
|
|
644924
644942
|
unlinkSync28(wavPath);
|
|
644925
644943
|
return data;
|
|
644926
644944
|
} catch {
|
|
@@ -645174,7 +645192,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
645174
645192
|
...isJetson ? (() => {
|
|
645175
645193
|
let jpVer = "v60";
|
|
645176
645194
|
try {
|
|
645177
|
-
const tegra = existsSync136("/etc/nv_tegra_release") ?
|
|
645195
|
+
const tegra = existsSync136("/etc/nv_tegra_release") ? readFileSync110("/etc/nv_tegra_release", "utf8").trim() : "";
|
|
645178
645196
|
const ver = process.env.JETSON_L4T_VERSION || "";
|
|
645179
645197
|
if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
|
|
645180
645198
|
jpVer = "v51";
|
|
@@ -645784,7 +645802,7 @@ if __name__ == '__main__':
|
|
|
645784
645802
|
async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
645785
645803
|
if (!existsSync136(wavPath)) return;
|
|
645786
645804
|
try {
|
|
645787
|
-
const wavData =
|
|
645805
|
+
const wavData = readFileSync110(wavPath);
|
|
645788
645806
|
if (wavData.length > 44) {
|
|
645789
645807
|
const sampleRate = wavData.readUInt32LE(24);
|
|
645790
645808
|
const samples = new Int16Array(
|
|
@@ -645815,7 +645833,7 @@ if __name__ == '__main__':
|
|
|
645815
645833
|
}
|
|
645816
645834
|
if (pitchFactor !== 1) {
|
|
645817
645835
|
try {
|
|
645818
|
-
const wavData =
|
|
645836
|
+
const wavData = readFileSync110(wavPath);
|
|
645819
645837
|
if (wavData.length > 44) {
|
|
645820
645838
|
const int16 = new Int16Array(
|
|
645821
645839
|
wavData.buffer,
|
|
@@ -645834,7 +645852,7 @@ if __name__ == '__main__':
|
|
|
645834
645852
|
}
|
|
645835
645853
|
if (this.onPCMOutput) {
|
|
645836
645854
|
try {
|
|
645837
|
-
const wavData =
|
|
645855
|
+
const wavData = readFileSync110(wavPath);
|
|
645838
645856
|
if (wavData.length > 44) {
|
|
645839
645857
|
const pcm = Buffer.from(
|
|
645840
645858
|
wavData.buffer,
|
|
@@ -645849,7 +645867,7 @@ if __name__ == '__main__':
|
|
|
645849
645867
|
}
|
|
645850
645868
|
if (stereoDelayMs > 0) {
|
|
645851
645869
|
try {
|
|
645852
|
-
const wavData =
|
|
645870
|
+
const wavData = readFileSync110(wavPath);
|
|
645853
645871
|
if (wavData.length > 44) {
|
|
645854
645872
|
const sampleRate = wavData.readUInt32LE(24);
|
|
645855
645873
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -645916,7 +645934,7 @@ if __name__ == '__main__':
|
|
|
645916
645934
|
}
|
|
645917
645935
|
if (!existsSync136(wavPath)) return null;
|
|
645918
645936
|
try {
|
|
645919
|
-
const data =
|
|
645937
|
+
const data = readFileSync110(wavPath);
|
|
645920
645938
|
unlinkSync28(wavPath);
|
|
645921
645939
|
return data;
|
|
645922
645940
|
} catch {
|
|
@@ -646151,7 +646169,7 @@ if __name__ == "__main__":
|
|
|
646151
646169
|
async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
646152
646170
|
if (!existsSync136(wavPath)) return;
|
|
646153
646171
|
try {
|
|
646154
|
-
const wavData =
|
|
646172
|
+
const wavData = readFileSync110(wavPath);
|
|
646155
646173
|
if (wavData.length > 44) {
|
|
646156
646174
|
const sampleRate = wavData.readUInt32LE(24);
|
|
646157
646175
|
const samples = new Int16Array(
|
|
@@ -646182,7 +646200,7 @@ if __name__ == "__main__":
|
|
|
646182
646200
|
}
|
|
646183
646201
|
if (pitchFactor !== 1) {
|
|
646184
646202
|
try {
|
|
646185
|
-
const wavData =
|
|
646203
|
+
const wavData = readFileSync110(wavPath);
|
|
646186
646204
|
if (wavData.length > 44) {
|
|
646187
646205
|
const int16 = new Int16Array(
|
|
646188
646206
|
wavData.buffer,
|
|
@@ -646201,7 +646219,7 @@ if __name__ == "__main__":
|
|
|
646201
646219
|
}
|
|
646202
646220
|
if (this.onPCMOutput) {
|
|
646203
646221
|
try {
|
|
646204
|
-
const wavData =
|
|
646222
|
+
const wavData = readFileSync110(wavPath);
|
|
646205
646223
|
if (wavData.length > 44) {
|
|
646206
646224
|
const pcm = Buffer.from(
|
|
646207
646225
|
wavData.buffer,
|
|
@@ -646216,7 +646234,7 @@ if __name__ == "__main__":
|
|
|
646216
646234
|
}
|
|
646217
646235
|
if (stereoDelayMs > 0) {
|
|
646218
646236
|
try {
|
|
646219
|
-
const wavData =
|
|
646237
|
+
const wavData = readFileSync110(wavPath);
|
|
646220
646238
|
if (wavData.length > 44) {
|
|
646221
646239
|
const sampleRate = wavData.readUInt32LE(24);
|
|
646222
646240
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -646292,7 +646310,7 @@ if __name__ == "__main__":
|
|
|
646292
646310
|
}
|
|
646293
646311
|
if (!existsSync136(wavPath)) return null;
|
|
646294
646312
|
try {
|
|
646295
|
-
const data =
|
|
646313
|
+
const data = readFileSync110(wavPath);
|
|
646296
646314
|
unlinkSync28(wavPath);
|
|
646297
646315
|
return data;
|
|
646298
646316
|
} catch {
|
|
@@ -646313,7 +646331,7 @@ if __name__ == "__main__":
|
|
|
646313
646331
|
};
|
|
646314
646332
|
if (existsSync136(pkgPath)) {
|
|
646315
646333
|
try {
|
|
646316
|
-
const existing = JSON.parse(
|
|
646334
|
+
const existing = JSON.parse(readFileSync110(pkgPath, "utf8"));
|
|
646317
646335
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
646318
646336
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
646319
646337
|
writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -646473,7 +646491,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
646473
646491
|
if (!existsSync136(onnxPath) || !existsSync136(configPath2)) {
|
|
646474
646492
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
646475
646493
|
}
|
|
646476
|
-
this.config = JSON.parse(
|
|
646494
|
+
this.config = JSON.parse(readFileSync110(configPath2, "utf8"));
|
|
646477
646495
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
646478
646496
|
executionProviders: ["cpu"],
|
|
646479
646497
|
graphOptimizationLevel: "all"
|
|
@@ -646633,7 +646651,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
|
|
|
646633
646651
|
import { createHash as createHash38 } from "node:crypto";
|
|
646634
646652
|
import {
|
|
646635
646653
|
existsSync as existsSync137,
|
|
646636
|
-
readFileSync as
|
|
646654
|
+
readFileSync as readFileSync111,
|
|
646637
646655
|
writeFileSync as writeFileSync72,
|
|
646638
646656
|
mkdirSync as mkdirSync83,
|
|
646639
646657
|
readdirSync as readdirSync46,
|
|
@@ -647954,10 +647972,10 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
647954
647972
|
if (!key) {
|
|
647955
647973
|
try {
|
|
647956
647974
|
const { homedir: homedir65 } = await import("node:os");
|
|
647957
|
-
const { readFileSync:
|
|
647975
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
647958
647976
|
const { join: join186 } = await import("node:path");
|
|
647959
647977
|
const p2 = join186(homedir65(), ".omnius", "api.key");
|
|
647960
|
-
if (existsSync169(p2)) key =
|
|
647978
|
+
if (existsSync169(p2)) key = readFileSync138(p2, "utf8").trim();
|
|
647961
647979
|
} catch {
|
|
647962
647980
|
}
|
|
647963
647981
|
}
|
|
@@ -648861,7 +648879,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
648861
648879
|
try {
|
|
648862
648880
|
const pidFile = join151(nexus.getNexusDir(), "daemon.pid");
|
|
648863
648881
|
if (existsSync137(pidFile)) {
|
|
648864
|
-
const pid = parseInt(
|
|
648882
|
+
const pid = parseInt(readFileSync111(pidFile, "utf8").trim(), 10);
|
|
648865
648883
|
if (pid > 0 && !registry2.daemons.has("Nexus")) {
|
|
648866
648884
|
registry2.register({
|
|
648867
648885
|
name: "Nexus",
|
|
@@ -649284,7 +649302,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649284
649302
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
649285
649303
|
return "handled";
|
|
649286
649304
|
}
|
|
649287
|
-
content =
|
|
649305
|
+
content = readFileSync111(toolFile, "utf8");
|
|
649288
649306
|
metadata = { type: "tool", name: shareName };
|
|
649289
649307
|
} else if (shareType === "skill") {
|
|
649290
649308
|
const skillDir = join151(ctx3.repoRoot, ".omnius", "skills", shareName);
|
|
@@ -649293,7 +649311,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649293
649311
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
649294
649312
|
return "handled";
|
|
649295
649313
|
}
|
|
649296
|
-
content =
|
|
649314
|
+
content = readFileSync111(skillFile, "utf8");
|
|
649297
649315
|
metadata = { type: "skill", name: shareName };
|
|
649298
649316
|
} else {
|
|
649299
649317
|
renderWarning(
|
|
@@ -649366,7 +649384,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649366
649384
|
"learning-cids.json"
|
|
649367
649385
|
);
|
|
649368
649386
|
if (existsSync137(regFile)) {
|
|
649369
|
-
const reg2 = JSON.parse(
|
|
649387
|
+
const reg2 = JSON.parse(readFileSync111(regFile, "utf8"));
|
|
649370
649388
|
const pinned = Object.values(reg2).some(
|
|
649371
649389
|
(e2) => e2.cid === importCid && e2.pinned
|
|
649372
649390
|
);
|
|
@@ -649484,7 +649502,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649484
649502
|
).getNexusDir();
|
|
649485
649503
|
const statusFile = join151(nexusDir, "status.json");
|
|
649486
649504
|
if (existsSync137(statusFile)) {
|
|
649487
|
-
const status = JSON.parse(
|
|
649505
|
+
const status = JSON.parse(readFileSync111(statusFile, "utf8"));
|
|
649488
649506
|
if (status.peerId) {
|
|
649489
649507
|
lines.push(`
|
|
649490
649508
|
${c3.bold("Peer Info")}`);
|
|
@@ -649509,7 +649527,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649509
649527
|
try {
|
|
649510
649528
|
const stateFile = join151(idDir, "self-state.json");
|
|
649511
649529
|
if (existsSync137(stateFile)) {
|
|
649512
|
-
const state = JSON.parse(
|
|
649530
|
+
const state = JSON.parse(readFileSync111(stateFile, "utf8"));
|
|
649513
649531
|
lines.push(
|
|
649514
649532
|
` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
|
|
649515
649533
|
);
|
|
@@ -649524,7 +649542,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649524
649542
|
}
|
|
649525
649543
|
const cidFile = join151(idDir, "cids.json");
|
|
649526
649544
|
if (existsSync137(cidFile)) {
|
|
649527
|
-
const cids = JSON.parse(
|
|
649545
|
+
const cids = JSON.parse(readFileSync111(cidFile, "utf8"));
|
|
649528
649546
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
649529
649547
|
if (lastCid)
|
|
649530
649548
|
lines.push(
|
|
@@ -649549,7 +649567,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649549
649567
|
"store.json"
|
|
649550
649568
|
);
|
|
649551
649569
|
if (existsSync137(metaFile2)) {
|
|
649552
|
-
const store2 = JSON.parse(
|
|
649570
|
+
const store2 = JSON.parse(readFileSync111(metaFile2, "utf8"));
|
|
649553
649571
|
const active = store2.filter((m2) => m2.type !== "quarantine");
|
|
649554
649572
|
const recoveries = active.filter(
|
|
649555
649573
|
(m2) => m2.content?.startsWith("[recovery]")
|
|
@@ -649787,7 +649805,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649787
649805
|
return "handled";
|
|
649788
649806
|
}
|
|
649789
649807
|
} else {
|
|
649790
|
-
content =
|
|
649808
|
+
content = readFileSync111(resolvedPath, "utf8");
|
|
649791
649809
|
}
|
|
649792
649810
|
if (!content.trim()) {
|
|
649793
649811
|
renderWarning("No content extracted.");
|
|
@@ -649895,7 +649913,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649895
649913
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
649896
649914
|
return "handled";
|
|
649897
649915
|
}
|
|
649898
|
-
const bridge = JSON.parse(
|
|
649916
|
+
const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
|
|
649899
649917
|
let alive = false;
|
|
649900
649918
|
try {
|
|
649901
649919
|
process.kill(bridge.pid, 0);
|
|
@@ -649931,7 +649949,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649931
649949
|
if (fortemiSubCmd === "stop") {
|
|
649932
649950
|
const bridgeFile = join151(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
|
|
649933
649951
|
if (existsSync137(bridgeFile)) {
|
|
649934
|
-
const bridge = JSON.parse(
|
|
649952
|
+
const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
|
|
649935
649953
|
try {
|
|
649936
649954
|
process.kill(bridge.pid, "SIGTERM");
|
|
649937
649955
|
} catch {
|
|
@@ -651963,7 +651981,7 @@ sleep 1
|
|
|
651963
651981
|
`daemon.pid exists: ${existsSync137(join151(checkedNexusDir, "daemon.pid"))}`
|
|
651964
651982
|
);
|
|
651965
651983
|
try {
|
|
651966
|
-
const _statusRaw =
|
|
651984
|
+
const _statusRaw = readFileSync111(
|
|
651967
651985
|
join151(checkedNexusDir, "status.json"),
|
|
651968
651986
|
"utf8"
|
|
651969
651987
|
);
|
|
@@ -651972,7 +651990,7 @@ sleep 1
|
|
|
651972
651990
|
_spLog(`status.json read error: ${e2}`);
|
|
651973
651991
|
}
|
|
651974
651992
|
try {
|
|
651975
|
-
const _errRaw =
|
|
651993
|
+
const _errRaw = readFileSync111(
|
|
651976
651994
|
join151(checkedNexusDir, "daemon.err"),
|
|
651977
651995
|
"utf8"
|
|
651978
651996
|
);
|
|
@@ -652007,7 +652025,7 @@ sleep 1
|
|
|
652007
652025
|
"agent-name"
|
|
652008
652026
|
);
|
|
652009
652027
|
if (existsSync137(namePath))
|
|
652010
|
-
sponsorName =
|
|
652028
|
+
sponsorName = readFileSync111(namePath, "utf8").trim();
|
|
652011
652029
|
} catch {
|
|
652012
652030
|
}
|
|
652013
652031
|
if (!sponsorName) sponsorName = "Omnius Sponsor";
|
|
@@ -652111,7 +652129,7 @@ sleep 1
|
|
|
652111
652129
|
);
|
|
652112
652130
|
if (existsSync137(nexusPidFile)) {
|
|
652113
652131
|
const nPid = parseInt(
|
|
652114
|
-
|
|
652132
|
+
readFileSync111(nexusPidFile, "utf8").trim(),
|
|
652115
652133
|
10
|
|
652116
652134
|
);
|
|
652117
652135
|
if (nPid > 0) {
|
|
@@ -653410,7 +653428,7 @@ sleep 1
|
|
|
653410
653428
|
if (existsSync137(projectSettingsPath)) {
|
|
653411
653429
|
try {
|
|
653412
653430
|
const projectJson = JSON.parse(
|
|
653413
|
-
|
|
653431
|
+
readFileSync111(projectSettingsPath, "utf8")
|
|
653414
653432
|
);
|
|
653415
653433
|
projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
|
|
653416
653434
|
} catch {
|
|
@@ -659129,7 +659147,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
|
|
|
659129
659147
|
"known-sponsors.json"
|
|
659130
659148
|
);
|
|
659131
659149
|
if (existsSync137(knownFile)) {
|
|
659132
|
-
const saved = JSON.parse(
|
|
659150
|
+
const saved = JSON.parse(readFileSync111(knownFile, "utf8"));
|
|
659133
659151
|
if (Array.isArray(saved)) rawSponsors.push(...saved);
|
|
659134
659152
|
}
|
|
659135
659153
|
} catch {
|
|
@@ -659279,7 +659297,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
659279
659297
|
while (!done && Date.now() < deadline) {
|
|
659280
659298
|
await new Promise((resolve76) => setTimeout(resolve76, 250));
|
|
659281
659299
|
if (!existsSync137(args.streamFile)) continue;
|
|
659282
|
-
const raw =
|
|
659300
|
+
const raw = readFileSync111(args.streamFile, "utf8");
|
|
659283
659301
|
if (raw.length <= offset) continue;
|
|
659284
659302
|
pending2 += raw.slice(offset);
|
|
659285
659303
|
offset = raw.length;
|
|
@@ -659603,7 +659621,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
659603
659621
|
try {
|
|
659604
659622
|
if (existsSync137(knownFile)) {
|
|
659605
659623
|
const saved = JSON.parse(
|
|
659606
|
-
|
|
659624
|
+
readFileSync111(knownFile, "utf8")
|
|
659607
659625
|
);
|
|
659608
659626
|
for (const s2 of saved) {
|
|
659609
659627
|
if (!sponsors.some((sp) => sp.url === s2.url)) {
|
|
@@ -659779,7 +659797,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
659779
659797
|
const saveKey = selected.url || selected.peerId || selected.name;
|
|
659780
659798
|
try {
|
|
659781
659799
|
mkdirSync83(sponsorDir2, { recursive: true });
|
|
659782
|
-
const existing = existsSync137(knownFile) ? JSON.parse(
|
|
659800
|
+
const existing = existsSync137(knownFile) ? JSON.parse(readFileSync111(knownFile, "utf8")) : [];
|
|
659783
659801
|
const updated = existing.filter(
|
|
659784
659802
|
(s2) => (s2.url || s2.peerId || s2.name) !== saveKey
|
|
659785
659803
|
);
|
|
@@ -661203,9 +661221,9 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
661203
661221
|
(async () => {
|
|
661204
661222
|
try {
|
|
661205
661223
|
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
661206
|
-
const { accessSync:
|
|
661224
|
+
const { accessSync: accessSync2, constants: constants2 } = await import("node:fs");
|
|
661207
661225
|
try {
|
|
661208
|
-
|
|
661226
|
+
accessSync2(prefix, constants2.W_OK);
|
|
661209
661227
|
return false;
|
|
661210
661228
|
} catch {
|
|
661211
661229
|
return true;
|
|
@@ -662052,16 +662070,8 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
662052
662070
|
} else {
|
|
662053
662071
|
installOverlay.setStatus("cloudflared ready");
|
|
662054
662072
|
}
|
|
662055
|
-
installOverlay.setStatus("Checking transcribe-cli...");
|
|
662056
|
-
|
|
662057
|
-
await withTransientTerminalPrivilegePrompt(
|
|
662058
|
-
ctx3,
|
|
662059
|
-
"Installing transcribe-cli may need administrator privileges.",
|
|
662060
|
-
() => ensureTranscribeCliBackground()
|
|
662061
|
-
).catch(() => false);
|
|
662062
|
-
} else {
|
|
662063
|
-
await ensureTranscribeCliBackground().catch(() => false);
|
|
662064
|
-
}
|
|
662073
|
+
installOverlay.setStatus("Checking managed transcribe-cli runtime...");
|
|
662074
|
+
await ensureTranscribeCliBackground().catch(() => false);
|
|
662065
662075
|
installOverlay.setStatus("cloudflared/transcribe checks complete");
|
|
662066
662076
|
}
|
|
662067
662077
|
if (!primaryUpdated) {
|
|
@@ -662893,7 +662903,7 @@ var init_commands = __esm({
|
|
|
662893
662903
|
});
|
|
662894
662904
|
|
|
662895
662905
|
// packages/cli/src/tui/project-context.ts
|
|
662896
|
-
import { existsSync as existsSync138, readFileSync as
|
|
662906
|
+
import { existsSync as existsSync138, readFileSync as readFileSync112, readdirSync as readdirSync47, mkdirSync as mkdirSync84, statSync as statSync52, writeFileSync as writeFileSync73 } from "node:fs";
|
|
662897
662907
|
import { dirname as dirname47, join as join152, basename as basename29, resolve as resolve62 } from "node:path";
|
|
662898
662908
|
import { homedir as homedir52 } from "node:os";
|
|
662899
662909
|
function projectContextUrlSpanAt(text2, index) {
|
|
@@ -662944,7 +662954,7 @@ function loadProjectMap(repoRoot) {
|
|
|
662944
662954
|
const mapPath2 = join152(repoRoot, OMNIUS_DIR, "context", "project-map.md");
|
|
662945
662955
|
if (existsSync138(mapPath2)) {
|
|
662946
662956
|
try {
|
|
662947
|
-
const content =
|
|
662957
|
+
const content = readFileSync112(mapPath2, "utf-8");
|
|
662948
662958
|
return content;
|
|
662949
662959
|
} catch {
|
|
662950
662960
|
}
|
|
@@ -662957,7 +662967,7 @@ function findGitDir(repoRoot) {
|
|
|
662957
662967
|
const gitPath = join152(dir, ".git");
|
|
662958
662968
|
if (existsSync138(gitPath)) {
|
|
662959
662969
|
try {
|
|
662960
|
-
const raw =
|
|
662970
|
+
const raw = readFileSync112(gitPath, "utf8").trim();
|
|
662961
662971
|
const match = raw.match(/^gitdir:\s*(.+)$/i);
|
|
662962
662972
|
if (match?.[1]) {
|
|
662963
662973
|
return resolve62(dir, match[1]);
|
|
@@ -662977,12 +662987,12 @@ function getGitInfo(repoRoot) {
|
|
|
662977
662987
|
if (!gitDir) return "";
|
|
662978
662988
|
const lines = [];
|
|
662979
662989
|
try {
|
|
662980
|
-
const head =
|
|
662990
|
+
const head = readFileSync112(join152(gitDir, "HEAD"), "utf-8").trim();
|
|
662981
662991
|
const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
662982
662992
|
if (refMatch?.[1]) {
|
|
662983
662993
|
lines.push(`Branch: ${refMatch[1]}`);
|
|
662984
662994
|
try {
|
|
662985
|
-
const refHash =
|
|
662995
|
+
const refHash = readFileSync112(join152(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
|
|
662986
662996
|
if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
|
|
662987
662997
|
} catch {
|
|
662988
662998
|
}
|
|
@@ -663010,7 +663020,7 @@ function countJsonMemoryEntries(dir) {
|
|
|
663010
663020
|
if (!file.endsWith(".json")) continue;
|
|
663011
663021
|
topics++;
|
|
663012
663022
|
try {
|
|
663013
|
-
const parsed = JSON.parse(
|
|
663023
|
+
const parsed = JSON.parse(readFileSync112(join152(dir, file), "utf8"));
|
|
663014
663024
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
663015
663025
|
entries += Object.keys(parsed).length;
|
|
663016
663026
|
}
|
|
@@ -663026,7 +663036,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
663026
663036
|
const path12 = join152(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
|
|
663027
663037
|
if (!existsSync138(path12)) return 0;
|
|
663028
663038
|
try {
|
|
663029
|
-
const parsed = JSON.parse(
|
|
663039
|
+
const parsed = JSON.parse(readFileSync112(path12, "utf8"));
|
|
663030
663040
|
return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
|
|
663031
663041
|
} catch {
|
|
663032
663042
|
return 0;
|
|
@@ -663035,7 +663045,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
663035
663045
|
function countJsonlLines(path12, maxBytes = 1e6) {
|
|
663036
663046
|
if (!existsSync138(path12)) return 0;
|
|
663037
663047
|
try {
|
|
663038
|
-
const text2 =
|
|
663048
|
+
const text2 = readFileSync112(path12, "utf8").slice(-maxBytes);
|
|
663039
663049
|
return text2.split(/\r?\n/).filter((line) => line.trim()).length;
|
|
663040
663050
|
} catch {
|
|
663041
663051
|
return 0;
|
|
@@ -663079,7 +663089,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
|
|
|
663079
663089
|
const files = readdirSync47(dir).filter((f2) => f2.endsWith(".json"));
|
|
663080
663090
|
for (const file of files.slice(0, 10)) {
|
|
663081
663091
|
try {
|
|
663082
|
-
const raw =
|
|
663092
|
+
const raw = readFileSync112(join152(dir, file), "utf-8");
|
|
663083
663093
|
const entries = JSON.parse(raw);
|
|
663084
663094
|
const topic = basename29(file, ".json");
|
|
663085
663095
|
for (const [k, v] of Object.entries(entries)) {
|
|
@@ -663569,7 +663579,7 @@ function extractMakeBootstrapTargets(repoRoot) {
|
|
|
663569
663579
|
const makefile = ["Makefile", "makefile"].find((name10) => existsSync138(join152(repoRoot, name10)));
|
|
663570
663580
|
if (!makefile) return [];
|
|
663571
663581
|
try {
|
|
663572
|
-
const text2 =
|
|
663582
|
+
const text2 = readFileSync112(join152(repoRoot, makefile), "utf8");
|
|
663573
663583
|
const targets = [];
|
|
663574
663584
|
for (const line of text2.split(/\r?\n/)) {
|
|
663575
663585
|
const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
|
|
@@ -663713,7 +663723,7 @@ function loadCustomToolsContext(repoRoot) {
|
|
|
663713
663723
|
const registryPath = join152(repoRoot, ".omnius", "tools", "registry.json");
|
|
663714
663724
|
const indexPath = join152(repoRoot, ".omnius", "tools", "README.md");
|
|
663715
663725
|
if (!existsSync138(registryPath)) return "";
|
|
663716
|
-
const registry4 = JSON.parse(
|
|
663726
|
+
const registry4 = JSON.parse(readFileSync112(registryPath, "utf-8"));
|
|
663717
663727
|
const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
|
|
663718
663728
|
const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
|
|
663719
663729
|
if (byRate !== 0) return byRate;
|
|
@@ -663889,7 +663899,7 @@ var init_project_context = __esm({
|
|
|
663889
663899
|
});
|
|
663890
663900
|
|
|
663891
663901
|
// packages/cli/src/realtime.ts
|
|
663892
|
-
import { existsSync as existsSync139, readFileSync as
|
|
663902
|
+
import { existsSync as existsSync139, readFileSync as readFileSync113, readdirSync as readdirSync48 } from "node:fs";
|
|
663893
663903
|
import { basename as basename30, join as join153, resolve as resolve63 } from "node:path";
|
|
663894
663904
|
function clampInt2(value2, fallback, min, max) {
|
|
663895
663905
|
const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
|
|
@@ -663911,7 +663921,7 @@ function firstReadable(candidates) {
|
|
|
663911
663921
|
for (const path12 of candidates) {
|
|
663912
663922
|
if (!existsSync139(path12)) continue;
|
|
663913
663923
|
try {
|
|
663914
|
-
return { path: path12, content:
|
|
663924
|
+
return { path: path12, content: readFileSync113(path12, "utf8") };
|
|
663915
663925
|
} catch {
|
|
663916
663926
|
return null;
|
|
663917
663927
|
}
|
|
@@ -663934,7 +663944,7 @@ function projectVoice(repoRoot) {
|
|
|
663934
663944
|
return ap - bp || a2.localeCompare(b);
|
|
663935
663945
|
});
|
|
663936
663946
|
const first2 = files[0];
|
|
663937
|
-
return first2 ? { path: join153(voiceDir3, first2), content:
|
|
663947
|
+
return first2 ? { path: join153(voiceDir3, first2), content: readFileSync113(join153(voiceDir3, first2), "utf8") } : null;
|
|
663938
663948
|
} catch {
|
|
663939
663949
|
return null;
|
|
663940
663950
|
}
|
|
@@ -664122,7 +664132,7 @@ __export(chat_session_exports, {
|
|
|
664122
664132
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
664123
664133
|
import {
|
|
664124
664134
|
existsSync as existsSync140,
|
|
664125
|
-
readFileSync as
|
|
664135
|
+
readFileSync as readFileSync114,
|
|
664126
664136
|
readdirSync as readdirSync49,
|
|
664127
664137
|
writeFileSync as writeFileSync74,
|
|
664128
664138
|
renameSync as renameSync13,
|
|
@@ -664231,7 +664241,7 @@ function normalizeLoadedSession(parsed) {
|
|
|
664231
664241
|
}
|
|
664232
664242
|
function readSessionFile(fp) {
|
|
664233
664243
|
try {
|
|
664234
|
-
const parsed = JSON.parse(
|
|
664244
|
+
const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
|
|
664235
664245
|
if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
|
|
664236
664246
|
return normalizeLoadedSession(parsed);
|
|
664237
664247
|
} catch {
|
|
@@ -664264,7 +664274,7 @@ function loadPersistedSessions() {
|
|
|
664264
664274
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
664265
664275
|
const fp = join154(dir, f2);
|
|
664266
664276
|
try {
|
|
664267
|
-
const parsed = JSON.parse(
|
|
664277
|
+
const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
|
|
664268
664278
|
if (f2.endsWith(".inflight.json")) {
|
|
664269
664279
|
if (parsed && parsed.pid && parsed.status === "running") {
|
|
664270
664280
|
try {
|
|
@@ -664306,7 +664316,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664306
664316
|
const diaryPath = join154(cwd4, ".omnius", "context", "session-diary.md");
|
|
664307
664317
|
if (existsSync140(diaryPath)) {
|
|
664308
664318
|
try {
|
|
664309
|
-
const diary =
|
|
664319
|
+
const diary = readFileSync114(diaryPath, "utf-8").slice(0, 1e3);
|
|
664310
664320
|
parts.push(`\\nPrevious session history:\\n${diary}`);
|
|
664311
664321
|
} catch {
|
|
664312
664322
|
}
|
|
@@ -664321,7 +664331,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664321
664331
|
);
|
|
664322
664332
|
for (const f2 of files.slice(0, 3)) {
|
|
664323
664333
|
try {
|
|
664324
|
-
const data = JSON.parse(
|
|
664334
|
+
const data = JSON.parse(readFileSync114(join154(memDir, f2), "utf-8"));
|
|
664325
664335
|
const entries = Object.entries(data).slice(0, 3);
|
|
664326
664336
|
if (entries.length > 0) {
|
|
664327
664337
|
parts.push(
|
|
@@ -664341,7 +664351,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664341
664351
|
const p2 = join154(cwd4, name10);
|
|
664342
664352
|
if (existsSync140(p2)) {
|
|
664343
664353
|
try {
|
|
664344
|
-
const content =
|
|
664354
|
+
const content = readFileSync114(p2, "utf-8").slice(0, 500);
|
|
664345
664355
|
parts.push(`\\nProject instructions (${name10}):\\n${content}`);
|
|
664346
664356
|
} catch {
|
|
664347
664357
|
}
|
|
@@ -664363,7 +664373,7 @@ function getSession2(sessionId, model, cwd4) {
|
|
|
664363
664373
|
try {
|
|
664364
664374
|
const fp = sessionPath(sessionId);
|
|
664365
664375
|
if (existsSync140(fp)) {
|
|
664366
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
664376
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
|
|
664367
664377
|
if (parsed && parsed.id === sessionId) {
|
|
664368
664378
|
parsed.lastActivity = Date.now();
|
|
664369
664379
|
if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
|
|
@@ -664550,7 +664560,7 @@ function drainCheckins(sessionId) {
|
|
|
664550
664560
|
const fp = checkinPath(sessionId);
|
|
664551
664561
|
if (!existsSync140(fp)) return [];
|
|
664552
664562
|
try {
|
|
664553
|
-
const raw =
|
|
664563
|
+
const raw = readFileSync114(fp, "utf-8");
|
|
664554
664564
|
try {
|
|
664555
664565
|
unlinkSync29(fp);
|
|
664556
664566
|
} catch {
|
|
@@ -664616,7 +664626,7 @@ function lookupSession(id2) {
|
|
|
664616
664626
|
try {
|
|
664617
664627
|
const fp = sessionPath(id2);
|
|
664618
664628
|
if (existsSync140(fp)) {
|
|
664619
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
664629
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
|
|
664620
664630
|
if (parsed && parsed.id === id2) {
|
|
664621
664631
|
sessions2.set(id2, parsed);
|
|
664622
664632
|
return parsed;
|
|
@@ -664669,7 +664679,7 @@ function getInFlightChat(sessionId) {
|
|
|
664669
664679
|
try {
|
|
664670
664680
|
const p2 = inFlightPath(sessionId);
|
|
664671
664681
|
if (existsSync140(p2)) {
|
|
664672
|
-
const parsed = JSON.parse(
|
|
664682
|
+
const parsed = JSON.parse(readFileSync114(p2, "utf-8"));
|
|
664673
664683
|
if (parsed && parsed.sessionId === sessionId) {
|
|
664674
664684
|
return parsed;
|
|
664675
664685
|
}
|
|
@@ -666074,7 +666084,7 @@ __export(banner_exports, {
|
|
|
666074
666084
|
setBannerWriter: () => setBannerWriter,
|
|
666075
666085
|
setGridText: () => setGridText
|
|
666076
666086
|
});
|
|
666077
|
-
import { existsSync as existsSync142, readFileSync as
|
|
666087
|
+
import { existsSync as existsSync142, readFileSync as readFileSync115, writeFileSync as writeFileSync75, mkdirSync as mkdirSync86 } from "node:fs";
|
|
666078
666088
|
import { join as join155 } from "node:path";
|
|
666079
666089
|
function setBannerWriter(writer) {
|
|
666080
666090
|
chromeWrite3 = writer;
|
|
@@ -666216,7 +666226,7 @@ function loadBannerDesign(workDir, id2) {
|
|
|
666216
666226
|
const file = join155(workDir, ".omnius", "banners", `${id2}.json`);
|
|
666217
666227
|
if (!existsSync142(file)) return null;
|
|
666218
666228
|
try {
|
|
666219
|
-
return JSON.parse(
|
|
666229
|
+
return JSON.parse(readFileSync115(file, "utf8"));
|
|
666220
666230
|
} catch {
|
|
666221
666231
|
return null;
|
|
666222
666232
|
}
|
|
@@ -666546,13 +666556,13 @@ var init_banner = __esm({
|
|
|
666546
666556
|
});
|
|
666547
666557
|
|
|
666548
666558
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
666549
|
-
import { existsSync as existsSync143, readFileSync as
|
|
666559
|
+
import { existsSync as existsSync143, readFileSync as readFileSync116, writeFileSync as writeFileSync76, mkdirSync as mkdirSync87, readdirSync as readdirSync50 } from "node:fs";
|
|
666550
666560
|
import { join as join156, basename as basename33 } from "node:path";
|
|
666551
666561
|
function loadToolProfile(repoRoot) {
|
|
666552
666562
|
const filePath = join156(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
666553
666563
|
try {
|
|
666554
666564
|
if (!existsSync143(filePath)) return null;
|
|
666555
|
-
return JSON.parse(
|
|
666565
|
+
return JSON.parse(readFileSync116(filePath, "utf-8"));
|
|
666556
666566
|
} catch {
|
|
666557
666567
|
return null;
|
|
666558
666568
|
}
|
|
@@ -666618,7 +666628,7 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
666618
666628
|
const filePath = join156(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
|
|
666619
666629
|
try {
|
|
666620
666630
|
if (!existsSync143(filePath)) return null;
|
|
666621
|
-
const cached = JSON.parse(
|
|
666631
|
+
const cached = JSON.parse(readFileSync116(filePath, "utf-8"));
|
|
666622
666632
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
666623
666633
|
} catch {
|
|
666624
666634
|
return null;
|
|
@@ -666682,7 +666692,7 @@ function extractFromPackageJson(repoRoot, tags) {
|
|
|
666682
666692
|
const pkgPath = join156(repoRoot, "package.json");
|
|
666683
666693
|
try {
|
|
666684
666694
|
if (!existsSync143(pkgPath)) return;
|
|
666685
|
-
const pkg = JSON.parse(
|
|
666695
|
+
const pkg = JSON.parse(readFileSync116(pkgPath, "utf-8"));
|
|
666686
666696
|
if (pkg.name && typeof pkg.name === "string") {
|
|
666687
666697
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
666688
666698
|
for (const p2 of parts) tags.push(p2);
|
|
@@ -666753,7 +666763,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
666753
666763
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
666754
666764
|
tags.push(topic);
|
|
666755
666765
|
try {
|
|
666756
|
-
const data = JSON.parse(
|
|
666766
|
+
const data = JSON.parse(readFileSync116(join156(memoryDir, file), "utf-8"));
|
|
666757
666767
|
if (data && typeof data === "object") {
|
|
666758
666768
|
const keys = Object.keys(data).slice(0, 3);
|
|
666759
666769
|
for (const key of keys) {
|
|
@@ -667796,7 +667806,7 @@ var init_edit_history = __esm({
|
|
|
667796
667806
|
});
|
|
667797
667807
|
|
|
667798
667808
|
// packages/cli/src/tui/snr-engine.ts
|
|
667799
|
-
import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as
|
|
667809
|
+
import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as readFileSync117, writeFileSync as writeFileSync77, mkdirSync as mkdirSync89, rmSync as rmSync13 } from "node:fs";
|
|
667800
667810
|
import { join as join158, basename as basename34 } from "node:path";
|
|
667801
667811
|
function computeDPrime(signalScores, noiseScores) {
|
|
667802
667812
|
if (signalScores.length === 0 || noiseScores.length === 0) return 0;
|
|
@@ -668103,7 +668113,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668103
668113
|
const topic = basename34(f2, ".json");
|
|
668104
668114
|
if (topics.length > 0 && !topics.includes(topic)) continue;
|
|
668105
668115
|
try {
|
|
668106
|
-
const data = JSON.parse(
|
|
668116
|
+
const data = JSON.parse(readFileSync117(join158(dir, f2), "utf-8"));
|
|
668107
668117
|
for (const [key, val] of Object.entries(data)) {
|
|
668108
668118
|
const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
668109
668119
|
entries.push({ topic, key, value: value2 });
|
|
@@ -668205,7 +668215,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668205
668215
|
const file = join158(memDir, `${topic}.json`);
|
|
668206
668216
|
if (!existsSync144(file)) continue;
|
|
668207
668217
|
try {
|
|
668208
|
-
const data = JSON.parse(
|
|
668218
|
+
const data = JSON.parse(readFileSync117(file, "utf-8"));
|
|
668209
668219
|
const moved = {};
|
|
668210
668220
|
for (const key of keys) {
|
|
668211
668221
|
if (key in data) {
|
|
@@ -668220,7 +668230,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668220
668230
|
let archiveData = {};
|
|
668221
668231
|
if (existsSync144(archiveFile)) {
|
|
668222
668232
|
try {
|
|
668223
|
-
archiveData = JSON.parse(
|
|
668233
|
+
archiveData = JSON.parse(readFileSync117(archiveFile, "utf-8"));
|
|
668224
668234
|
} catch {
|
|
668225
668235
|
}
|
|
668226
668236
|
}
|
|
@@ -668259,7 +668269,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668259
668269
|
});
|
|
668260
668270
|
|
|
668261
668271
|
// packages/cli/src/tui/promptLoader.ts
|
|
668262
|
-
import { readFileSync as
|
|
668272
|
+
import { readFileSync as readFileSync118, existsSync as existsSync145 } from "node:fs";
|
|
668263
668273
|
import { join as join159, dirname as dirname49 } from "node:path";
|
|
668264
668274
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
668265
668275
|
function loadPrompt3(promptPath, vars) {
|
|
@@ -668269,7 +668279,7 @@ function loadPrompt3(promptPath, vars) {
|
|
|
668269
668279
|
if (!existsSync145(fullPath)) {
|
|
668270
668280
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
668271
668281
|
}
|
|
668272
|
-
content =
|
|
668282
|
+
content = readFileSync118(fullPath, "utf-8");
|
|
668273
668283
|
cache7.set(promptPath, content);
|
|
668274
668284
|
}
|
|
668275
668285
|
if (!vars) return content;
|
|
@@ -668289,7 +668299,7 @@ var init_promptLoader3 = __esm({
|
|
|
668289
668299
|
});
|
|
668290
668300
|
|
|
668291
668301
|
// packages/cli/src/tui/dream-engine.ts
|
|
668292
|
-
import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as
|
|
668302
|
+
import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as readFileSync119, existsSync as existsSync146, readdirSync as readdirSync52 } from "node:fs";
|
|
668293
668303
|
import { join as join160, basename as basename35 } from "node:path";
|
|
668294
668304
|
function setDreamWriteContent(fn) {
|
|
668295
668305
|
_dreamWriteContent = fn;
|
|
@@ -668305,7 +668315,7 @@ function loadAutoresearchMemory(repoRoot) {
|
|
|
668305
668315
|
const memoryPath = join160(repoRoot, ".omnius", "memory", "autoresearch.json");
|
|
668306
668316
|
if (!existsSync146(memoryPath)) return "";
|
|
668307
668317
|
try {
|
|
668308
|
-
const raw =
|
|
668318
|
+
const raw = readFileSync119(memoryPath, "utf-8");
|
|
668309
668319
|
const data = JSON.parse(raw);
|
|
668310
668320
|
const sections = [];
|
|
668311
668321
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -668540,7 +668550,7 @@ var init_dream_engine = __esm({
|
|
|
668540
668550
|
if (!existsSync146(targetPath)) {
|
|
668541
668551
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
668542
668552
|
}
|
|
668543
|
-
let content =
|
|
668553
|
+
let content = readFileSync119(targetPath, "utf-8");
|
|
668544
668554
|
if (!content.includes(oldStr)) {
|
|
668545
668555
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
668546
668556
|
}
|
|
@@ -668628,7 +668638,7 @@ var init_dream_engine = __esm({
|
|
|
668628
668638
|
if (!existsSync146(targetPath)) {
|
|
668629
668639
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
668630
668640
|
}
|
|
668631
|
-
let content =
|
|
668641
|
+
let content = readFileSync119(targetPath, "utf-8");
|
|
668632
668642
|
if (!content.includes(oldStr)) {
|
|
668633
668643
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
668634
668644
|
}
|
|
@@ -669592,7 +669602,7 @@ ${summary}` };
|
|
|
669592
669602
|
try {
|
|
669593
669603
|
let notes = [];
|
|
669594
669604
|
if (existsSync146(notesPath)) {
|
|
669595
|
-
notes = JSON.parse(
|
|
669605
|
+
notes = JSON.parse(readFileSync119(notesPath, "utf-8"));
|
|
669596
669606
|
}
|
|
669597
669607
|
if (action === "add") {
|
|
669598
669608
|
const note = {
|
|
@@ -670232,7 +670242,7 @@ var init_bless_engine = __esm({
|
|
|
670232
670242
|
});
|
|
670233
670243
|
|
|
670234
670244
|
// packages/cli/src/tui/dmn-engine.ts
|
|
670235
|
-
import { existsSync as existsSync147, readFileSync as
|
|
670245
|
+
import { existsSync as existsSync147, readFileSync as readFileSync120, writeFileSync as writeFileSync79, mkdirSync as mkdirSync91, readdirSync as readdirSync53, unlinkSync as unlinkSync30 } from "node:fs";
|
|
670236
670246
|
import { join as join161, basename as basename36 } from "node:path";
|
|
670237
670247
|
import { exec as exec6 } from "node:child_process";
|
|
670238
670248
|
import { promisify as promisify8 } from "node:util";
|
|
@@ -671117,7 +671127,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
671117
671127
|
const path12 = join161(this.stateDir, "state.json");
|
|
671118
671128
|
if (existsSync147(path12)) {
|
|
671119
671129
|
try {
|
|
671120
|
-
this.state = JSON.parse(
|
|
671130
|
+
this.state = JSON.parse(readFileSync120(path12, "utf-8"));
|
|
671121
671131
|
} catch {
|
|
671122
671132
|
}
|
|
671123
671133
|
}
|
|
@@ -671151,7 +671161,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
671151
671161
|
const latestByFingerprint = /* @__PURE__ */ new Map();
|
|
671152
671162
|
for (const file of files) {
|
|
671153
671163
|
try {
|
|
671154
|
-
const parsed = JSON.parse(
|
|
671164
|
+
const parsed = JSON.parse(readFileSync120(join161(this.historyDir, file), "utf-8"));
|
|
671155
671165
|
latestByFingerprint.set(this.fingerprintCycle(parsed), file);
|
|
671156
671166
|
} catch {
|
|
671157
671167
|
keep.add(file);
|
|
@@ -672829,7 +672839,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
|
|
|
672829
672839
|
import {
|
|
672830
672840
|
existsSync as existsSync148,
|
|
672831
672841
|
mkdirSync as mkdirSync92,
|
|
672832
|
-
readFileSync as
|
|
672842
|
+
readFileSync as readFileSync121,
|
|
672833
672843
|
statSync as statSync53,
|
|
672834
672844
|
unlinkSync as unlinkSync31,
|
|
672835
672845
|
writeFileSync as writeFileSync80
|
|
@@ -673059,7 +673069,7 @@ function scopedTool(base3, root, mode) {
|
|
|
673059
673069
|
);
|
|
673060
673070
|
if (!materialized.ok) return denied(materialized.error);
|
|
673061
673071
|
mkdirSync92(dirname50(guarded.path.abs), { recursive: true });
|
|
673062
|
-
writeFileSync80(guarded.path.abs,
|
|
673072
|
+
writeFileSync80(guarded.path.abs, readFileSync121(materialized.path));
|
|
673063
673073
|
materialized.cleanup?.();
|
|
673064
673074
|
restoredEditPath = guarded.path.abs;
|
|
673065
673075
|
}
|
|
@@ -673183,7 +673193,7 @@ function readManifest(root) {
|
|
|
673183
673193
|
ensureManifest(root);
|
|
673184
673194
|
try {
|
|
673185
673195
|
const parsed = JSON.parse(
|
|
673186
|
-
|
|
673196
|
+
readFileSync121(manifestPath(root), "utf8")
|
|
673187
673197
|
);
|
|
673188
673198
|
const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
|
|
673189
673199
|
Object.entries(parsed.objects).filter(
|
|
@@ -673235,7 +673245,7 @@ function rememberCreated(root, absPath) {
|
|
|
673235
673245
|
}
|
|
673236
673246
|
}
|
|
673237
673247
|
mkdirSync92(join162(root, OBJECTS_DIR), { recursive: true });
|
|
673238
|
-
const data =
|
|
673248
|
+
const data = readFileSync121(guarded.path.abs);
|
|
673239
673249
|
const prefix = randomBytes26(48);
|
|
673240
673250
|
const key = randomBytes26(32);
|
|
673241
673251
|
const iv = randomBytes26(12);
|
|
@@ -673291,7 +673301,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
673291
673301
|
error: `Scoped artifact storage is missing for ${rel}.`
|
|
673292
673302
|
};
|
|
673293
673303
|
}
|
|
673294
|
-
const blob =
|
|
673304
|
+
const blob = readFileSync121(storedAbs);
|
|
673295
673305
|
if (blob.length < object.prefixBytes) {
|
|
673296
673306
|
return {
|
|
673297
673307
|
ok: false,
|
|
@@ -674262,7 +674272,7 @@ import {
|
|
|
674262
674272
|
existsSync as existsSync149,
|
|
674263
674273
|
mkdirSync as mkdirSync93,
|
|
674264
674274
|
readdirSync as readdirSync54,
|
|
674265
|
-
readFileSync as
|
|
674275
|
+
readFileSync as readFileSync122,
|
|
674266
674276
|
writeFileSync as writeFileSync81,
|
|
674267
674277
|
unlinkSync as unlinkSync32
|
|
674268
674278
|
} from "node:fs";
|
|
@@ -675031,7 +675041,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
|
675031
675041
|
for (const file of files.reverse()) {
|
|
675032
675042
|
try {
|
|
675033
675043
|
return JSON.parse(
|
|
675034
|
-
|
|
675044
|
+
readFileSync122(join163(dir, file), "utf8")
|
|
675035
675045
|
);
|
|
675036
675046
|
} catch {
|
|
675037
675047
|
}
|
|
@@ -676769,7 +676779,7 @@ __export(vision_ingress_exports, {
|
|
|
676769
676779
|
resolveVisionModel: () => resolveVisionModel,
|
|
676770
676780
|
runVisionIngress: () => runVisionIngress
|
|
676771
676781
|
});
|
|
676772
|
-
import { existsSync as existsSync150, readFileSync as
|
|
676782
|
+
import { existsSync as existsSync150, readFileSync as readFileSync123, unlinkSync as unlinkSync33 } from "node:fs";
|
|
676773
676783
|
import { join as join164 } from "node:path";
|
|
676774
676784
|
async function isTesseractAvailable() {
|
|
676775
676785
|
try {
|
|
@@ -676824,7 +676834,7 @@ async function advancedOcr(imagePath) {
|
|
|
676824
676834
|
], { timeout: 15e3 });
|
|
676825
676835
|
const txtFile = `${outFile}.txt`;
|
|
676826
676836
|
if (existsSync150(txtFile)) {
|
|
676827
|
-
const text2 =
|
|
676837
|
+
const text2 = readFileSync123(txtFile, "utf-8").trim();
|
|
676828
676838
|
if (text2.length > 0) results.push(text2);
|
|
676829
676839
|
try {
|
|
676830
676840
|
unlinkSync33(txtFile);
|
|
@@ -677010,7 +677020,7 @@ import {
|
|
|
677010
677020
|
readdirSync as readdirSync55,
|
|
677011
677021
|
statSync as statSync54,
|
|
677012
677022
|
statfsSync as statfsSync8,
|
|
677013
|
-
readFileSync as
|
|
677023
|
+
readFileSync as readFileSync124,
|
|
677014
677024
|
writeFileSync as writeFileSync82,
|
|
677015
677025
|
appendFileSync as appendFileSync18
|
|
677016
677026
|
} from "node:fs";
|
|
@@ -683156,7 +683166,7 @@ ${mediaContext}` : ""
|
|
|
683156
683166
|
const path12 = this.telegramConversationPath(sessionKey);
|
|
683157
683167
|
if (!existsSync151(path12)) return;
|
|
683158
683168
|
try {
|
|
683159
|
-
const parsed = JSON.parse(
|
|
683169
|
+
const parsed = JSON.parse(readFileSync124(path12, "utf8"));
|
|
683160
683170
|
const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
|
|
683161
683171
|
if (Array.isArray(parsed.history)) {
|
|
683162
683172
|
this.chatHistory.set(
|
|
@@ -683370,7 +683380,7 @@ ${mediaContext}` : ""
|
|
|
683370
683380
|
for (const file of readdirSync55(this.telegramConversationDir)) {
|
|
683371
683381
|
if (!file.endsWith(".json")) continue;
|
|
683372
683382
|
try {
|
|
683373
|
-
const raw =
|
|
683383
|
+
const raw = readFileSync124(
|
|
683374
683384
|
join165(this.telegramConversationDir, file),
|
|
683375
683385
|
"utf8"
|
|
683376
683386
|
);
|
|
@@ -688057,7 +688067,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
688057
688067
|
const lockFile = join165(lockDir, `bot-${botUserId}.owner.lock`);
|
|
688058
688068
|
if (existsSync151(lockFile)) {
|
|
688059
688069
|
try {
|
|
688060
|
-
const prior = JSON.parse(
|
|
688070
|
+
const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
|
|
688061
688071
|
const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
|
|
688062
688072
|
if (priorAlive) {
|
|
688063
688073
|
throw new Error(
|
|
@@ -688090,7 +688100,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
688090
688100
|
try {
|
|
688091
688101
|
if (!existsSync151(lockFile)) return;
|
|
688092
688102
|
try {
|
|
688093
|
-
const prior = JSON.parse(
|
|
688103
|
+
const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
|
|
688094
688104
|
if (prior.pid !== process.pid) return;
|
|
688095
688105
|
} catch {
|
|
688096
688106
|
}
|
|
@@ -693033,7 +693043,7 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
693033
693043
|
readTelegramToolButtonState(nonce) {
|
|
693034
693044
|
try {
|
|
693035
693045
|
const parsed = JSON.parse(
|
|
693036
|
-
|
|
693046
|
+
readFileSync124(this.telegramToolButtonPath(nonce), "utf-8")
|
|
693037
693047
|
);
|
|
693038
693048
|
if (!parsed || parsed.expiresAt < Date.now()) return null;
|
|
693039
693049
|
return parsed;
|
|
@@ -694487,7 +694497,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
694487
694497
|
const ingressResult = await runVisionIngress2(
|
|
694488
694498
|
{
|
|
694489
694499
|
path: localPath,
|
|
694490
|
-
buffer:
|
|
694500
|
+
buffer: readFileSync124(localPath),
|
|
694491
694501
|
mime: telegramImageMime(media)
|
|
694492
694502
|
},
|
|
694493
694503
|
this.agentConfig?.model ?? ""
|
|
@@ -694882,7 +694892,7 @@ ${text2}`.trim()
|
|
|
694882
694892
|
}
|
|
694883
694893
|
if (!existsSync151(media.value))
|
|
694884
694894
|
throw new Error(`File does not exist: ${media.value}`);
|
|
694885
|
-
const buffer2 =
|
|
694895
|
+
const buffer2 = readFileSync124(media.value);
|
|
694886
694896
|
const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
694887
694897
|
const filename = basename39(media.value);
|
|
694888
694898
|
const contentType = mimeForPath(media.value, media.kind);
|
|
@@ -694996,7 +695006,7 @@ Content-Type: ${contentType}\r
|
|
|
694996
695006
|
const sidecarPath2 = `${imagePath}.json`;
|
|
694997
695007
|
if (!existsSync151(sidecarPath2)) return null;
|
|
694998
695008
|
try {
|
|
694999
|
-
const raw =
|
|
695009
|
+
const raw = readFileSync124(sidecarPath2, "utf8");
|
|
695000
695010
|
const parsed = JSON.parse(raw);
|
|
695001
695011
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
695002
695012
|
return null;
|
|
@@ -695056,7 +695066,7 @@ Content-Type: ${contentType}\r
|
|
|
695056
695066
|
const sidecarPath2 = `${videoPath}.json`;
|
|
695057
695067
|
if (!existsSync151(sidecarPath2)) return null;
|
|
695058
695068
|
try {
|
|
695059
|
-
const raw =
|
|
695069
|
+
const raw = readFileSync124(sidecarPath2, "utf8");
|
|
695060
695070
|
const parsed = JSON.parse(raw);
|
|
695061
695071
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
695062
695072
|
return null;
|
|
@@ -695201,7 +695211,7 @@ Content-Type: ${contentType}\r
|
|
|
695201
695211
|
addField(field, pathOrFileId);
|
|
695202
695212
|
continue;
|
|
695203
695213
|
}
|
|
695204
|
-
const buffer2 =
|
|
695214
|
+
const buffer2 = readFileSync124(pathOrFileId);
|
|
695205
695215
|
const filename = basename39(pathOrFileId);
|
|
695206
695216
|
parts.push(Buffer.from(`--${boundary}\r
|
|
695207
695217
|
`));
|
|
@@ -697165,14 +697175,14 @@ __export(projects_exports, {
|
|
|
697165
697175
|
setCurrentProject: () => setCurrentProject,
|
|
697166
697176
|
unregisterProject: () => unregisterProject
|
|
697167
697177
|
});
|
|
697168
|
-
import { readFileSync as
|
|
697178
|
+
import { readFileSync as readFileSync125, writeFileSync as writeFileSync83, mkdirSync as mkdirSync95, existsSync as existsSync152, statSync as statSync55, renameSync as renameSync14 } from "node:fs";
|
|
697169
697179
|
import { homedir as homedir55 } from "node:os";
|
|
697170
697180
|
import { basename as basename40, join as join166, resolve as resolve68 } from "node:path";
|
|
697171
697181
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
697172
697182
|
function readAll2() {
|
|
697173
697183
|
try {
|
|
697174
697184
|
if (!existsSync152(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
|
|
697175
|
-
const raw =
|
|
697185
|
+
const raw = readFileSync125(PROJECTS_FILE, "utf8");
|
|
697176
697186
|
const parsed = JSON.parse(raw);
|
|
697177
697187
|
if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
|
|
697178
697188
|
return { projects: parsed.projects, schemaVersion: 1 };
|
|
@@ -697249,7 +697259,7 @@ function getCurrentProject() {
|
|
|
697249
697259
|
if (!currentRoot) {
|
|
697250
697260
|
try {
|
|
697251
697261
|
if (existsSync152(CURRENT_FILE)) {
|
|
697252
|
-
const persisted =
|
|
697262
|
+
const persisted = readFileSync125(CURRENT_FILE, "utf8").trim();
|
|
697253
697263
|
if (persisted) currentRoot = persisted;
|
|
697254
697264
|
}
|
|
697255
697265
|
} catch {
|
|
@@ -698163,7 +698173,7 @@ var init_access_policy = __esm({
|
|
|
698163
698173
|
|
|
698164
698174
|
// packages/cli/src/api/project-preferences.ts
|
|
698165
698175
|
import { createHash as createHash43 } from "node:crypto";
|
|
698166
|
-
import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as
|
|
698176
|
+
import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as readFileSync126, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync35 } from "node:fs";
|
|
698167
698177
|
import { homedir as homedir56 } from "node:os";
|
|
698168
698178
|
import { join as join167, resolve as resolve69 } from "node:path";
|
|
698169
698179
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
@@ -698196,7 +698206,7 @@ function readProjectPreferences(root) {
|
|
|
698196
698206
|
try {
|
|
698197
698207
|
const file = prefsPath(root);
|
|
698198
698208
|
if (!existsSync153(file)) return { ...DEFAULT_PREFS };
|
|
698199
|
-
const raw =
|
|
698209
|
+
const raw = readFileSync126(file, "utf8");
|
|
698200
698210
|
const parsed = JSON.parse(raw);
|
|
698201
698211
|
if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
|
|
698202
698212
|
return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
|
|
@@ -698263,7 +698273,7 @@ __export(audit_log_exports, {
|
|
|
698263
698273
|
recordAudit: () => recordAudit,
|
|
698264
698274
|
sanitizeBody: () => sanitizeBody
|
|
698265
698275
|
});
|
|
698266
|
-
import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as
|
|
698276
|
+
import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as readFileSync127, existsSync as existsSync154 } from "node:fs";
|
|
698267
698277
|
import { join as join168 } from "node:path";
|
|
698268
698278
|
function initAuditLog(omniusDir) {
|
|
698269
698279
|
auditDir = join168(omniusDir, "audit");
|
|
@@ -698300,7 +698310,7 @@ function sanitizeBody(body, maxLen = 200) {
|
|
|
698300
698310
|
function queryAudit(opts) {
|
|
698301
698311
|
if (!initialized || !existsSync154(auditFile)) return [];
|
|
698302
698312
|
try {
|
|
698303
|
-
const raw =
|
|
698313
|
+
const raw = readFileSync127(auditFile, "utf-8");
|
|
698304
698314
|
const lines = raw.split("\n").filter(Boolean);
|
|
698305
698315
|
let records = lines.map((l2) => {
|
|
698306
698316
|
try {
|
|
@@ -699273,7 +699283,7 @@ var init_direct_tool_registry = __esm({
|
|
|
699273
699283
|
});
|
|
699274
699284
|
|
|
699275
699285
|
// packages/cli/src/api/external-tool-registry.ts
|
|
699276
|
-
import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as
|
|
699286
|
+
import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as readFileSync128, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
|
|
699277
699287
|
import { join as join170 } from "node:path";
|
|
699278
699288
|
function externalToolStorePath(workingDir) {
|
|
699279
699289
|
return join170(workingDir, ".omnius", "external-tools.json");
|
|
@@ -699282,7 +699292,7 @@ function loadExternalTools(workingDir) {
|
|
|
699282
699292
|
const path12 = externalToolStorePath(workingDir);
|
|
699283
699293
|
if (!existsSync157(path12)) return [];
|
|
699284
699294
|
try {
|
|
699285
|
-
const parsed = JSON.parse(
|
|
699295
|
+
const parsed = JSON.parse(readFileSync128(path12, "utf-8"));
|
|
699286
699296
|
if (!parsed || !Array.isArray(parsed.tools)) return [];
|
|
699287
699297
|
return parsed.tools.filter(
|
|
699288
699298
|
(t2) => t2 && typeof t2.name === "string" && t2.transport != null
|
|
@@ -699621,7 +699631,7 @@ __export(aiwg_exports, {
|
|
|
699621
699631
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
699622
699632
|
tryRouteAiwg: () => tryRouteAiwg
|
|
699623
699633
|
});
|
|
699624
|
-
import { existsSync as existsSync158, readFileSync as
|
|
699634
|
+
import { existsSync as existsSync158, readFileSync as readFileSync129, readdirSync as readdirSync56, statSync as statSync58 } from "node:fs";
|
|
699625
699635
|
import { join as join171 } from "node:path";
|
|
699626
699636
|
import { homedir as homedir57 } from "node:os";
|
|
699627
699637
|
import { execSync as execSync38 } from "node:child_process";
|
|
@@ -699692,7 +699702,7 @@ function resolveAiwgRoot() {
|
|
|
699692
699702
|
const pj = join171(cur, "package.json");
|
|
699693
699703
|
if (existsSync158(pj)) {
|
|
699694
699704
|
try {
|
|
699695
|
-
const pkg = JSON.parse(
|
|
699705
|
+
const pkg = JSON.parse(readFileSync129(pj, "utf-8"));
|
|
699696
699706
|
if (pkg.name === "aiwg") {
|
|
699697
699707
|
_cachedAiwgRoot = cur;
|
|
699698
699708
|
return cur;
|
|
@@ -699782,7 +699792,7 @@ function readFirstLineDescription(dir) {
|
|
|
699782
699792
|
const p2 = join171(dir, candidate);
|
|
699783
699793
|
if (!existsSync158(p2)) continue;
|
|
699784
699794
|
try {
|
|
699785
|
-
const txt =
|
|
699795
|
+
const txt = readFileSync129(p2, "utf-8");
|
|
699786
699796
|
const descMatch = txt.match(/^description:\s*(.+)$/m);
|
|
699787
699797
|
if (descMatch) return descMatch[1].trim().slice(0, 200);
|
|
699788
699798
|
for (const line of txt.split("\n")) {
|
|
@@ -699833,7 +699843,7 @@ function walkForItems(dir, out, depth) {
|
|
|
699833
699843
|
}
|
|
699834
699844
|
function parseItem(p2) {
|
|
699835
699845
|
try {
|
|
699836
|
-
const raw =
|
|
699846
|
+
const raw = readFileSync129(p2, "utf-8");
|
|
699837
699847
|
const header = raw.slice(0, 3e3);
|
|
699838
699848
|
const nameMatch = header.match(/^name:\s*(.+)$/m);
|
|
699839
699849
|
const descMatch = header.match(/^description:\s*(.+)$/m);
|
|
@@ -699872,7 +699882,7 @@ function deriveSource(p2) {
|
|
|
699872
699882
|
function loadAiwgItemContent(path12, maxBytes = 2e4) {
|
|
699873
699883
|
try {
|
|
699874
699884
|
if (!existsSync158(path12)) return null;
|
|
699875
|
-
const raw =
|
|
699885
|
+
const raw = readFileSync129(path12, "utf-8");
|
|
699876
699886
|
return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
|
|
699877
699887
|
} catch {
|
|
699878
699888
|
return null;
|
|
@@ -700408,7 +700418,7 @@ __export(runtime_keys_exports, {
|
|
|
700408
700418
|
mintKey: () => mintKey,
|
|
700409
700419
|
revokeByPrefix: () => revokeByPrefix
|
|
700410
700420
|
});
|
|
700411
|
-
import { existsSync as existsSync159, readFileSync as
|
|
700421
|
+
import { existsSync as existsSync159, readFileSync as readFileSync130, writeFileSync as writeFileSync86, mkdirSync as mkdirSync101, chmodSync as chmodSync5 } from "node:fs";
|
|
700412
700422
|
import { join as join172 } from "node:path";
|
|
700413
700423
|
import { homedir as homedir58 } from "node:os";
|
|
700414
700424
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
@@ -700419,7 +700429,7 @@ function ensureDir2() {
|
|
|
700419
700429
|
function loadAll() {
|
|
700420
700430
|
if (!existsSync159(KEYS_FILE)) return [];
|
|
700421
700431
|
try {
|
|
700422
|
-
const raw =
|
|
700432
|
+
const raw = readFileSync130(KEYS_FILE, "utf-8");
|
|
700423
700433
|
const parsed = JSON.parse(raw);
|
|
700424
700434
|
if (!Array.isArray(parsed)) return [];
|
|
700425
700435
|
return parsed;
|
|
@@ -700505,7 +700515,7 @@ __export(tor_fallback_exports, {
|
|
|
700505
700515
|
torIsReachable: () => torIsReachable,
|
|
700506
700516
|
tunnelViaTor: () => tunnelViaTor
|
|
700507
700517
|
});
|
|
700508
|
-
import { existsSync as existsSync160, readFileSync as
|
|
700518
|
+
import { existsSync as existsSync160, readFileSync as readFileSync131 } from "node:fs";
|
|
700509
700519
|
import { homedir as homedir59 } from "node:os";
|
|
700510
700520
|
import { join as join173 } from "node:path";
|
|
700511
700521
|
import { createConnection as createConnection3 } from "node:net";
|
|
@@ -700518,7 +700528,7 @@ function getLocalOnion() {
|
|
|
700518
700528
|
for (const p2 of candidates) {
|
|
700519
700529
|
try {
|
|
700520
700530
|
if (existsSync160(p2)) {
|
|
700521
|
-
const v =
|
|
700531
|
+
const v = readFileSync131(p2, "utf-8").trim();
|
|
700522
700532
|
if (v && v.endsWith(".onion")) return v;
|
|
700523
700533
|
}
|
|
700524
700534
|
} catch {
|
|
@@ -700779,7 +700789,7 @@ var init_graphical_sudo = __esm({
|
|
|
700779
700789
|
});
|
|
700780
700790
|
|
|
700781
700791
|
// packages/cli/src/api/routes-v1.ts
|
|
700782
|
-
import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as
|
|
700792
|
+
import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as readFileSync132, readdirSync as readdirSync57, statSync as statSync59 } from "node:fs";
|
|
700783
700793
|
import { join as join175, resolve as pathResolve3 } from "node:path";
|
|
700784
700794
|
import { homedir as homedir60 } from "node:os";
|
|
700785
700795
|
async function tryRouteV1(ctx3) {
|
|
@@ -701063,7 +701073,7 @@ function walkForSkills(dir, out, depth) {
|
|
|
701063
701073
|
walkForSkills(p2, out, depth + 1);
|
|
701064
701074
|
} else if (e2.isFile() && e2.name === "SKILL.md") {
|
|
701065
701075
|
try {
|
|
701066
|
-
const content =
|
|
701076
|
+
const content = readFileSync132(p2, "utf-8").slice(0, 2e3);
|
|
701067
701077
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
701068
701078
|
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
701069
701079
|
out.push({
|
|
@@ -702019,7 +702029,7 @@ async function handleFilesRead(ctx3) {
|
|
|
702019
702029
|
}));
|
|
702020
702030
|
return true;
|
|
702021
702031
|
}
|
|
702022
|
-
const content =
|
|
702032
|
+
const content = readFileSync132(resolved, "utf-8");
|
|
702023
702033
|
const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
|
|
702024
702034
|
const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
|
|
702025
702035
|
const slice2 = content.slice(offset, offset + limit);
|
|
@@ -702321,7 +702331,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
702321
702331
|
for (const p2 of statePaths) {
|
|
702322
702332
|
if (!existsSync162(p2)) continue;
|
|
702323
702333
|
try {
|
|
702324
|
-
const raw =
|
|
702334
|
+
const raw = readFileSync132(p2, "utf-8");
|
|
702325
702335
|
states2.push({ source: p2, data: JSON.parse(raw) });
|
|
702326
702336
|
} catch (e2) {
|
|
702327
702337
|
states2.push({ source: p2, error: String(e2) });
|
|
@@ -702349,7 +702359,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
702349
702359
|
function loadAgentName() {
|
|
702350
702360
|
try {
|
|
702351
702361
|
const p2 = join175(homedir60(), ".omnius", "agent-name");
|
|
702352
|
-
if (existsSync162(p2)) return
|
|
702362
|
+
if (existsSync162(p2)) return readFileSync132(p2, "utf-8").trim();
|
|
702353
702363
|
} catch {
|
|
702354
702364
|
}
|
|
702355
702365
|
return null;
|
|
@@ -702365,7 +702375,7 @@ async function handleSponsors(ctx3) {
|
|
|
702365
702375
|
for (const p2 of candidates) {
|
|
702366
702376
|
if (!existsSync162(p2)) continue;
|
|
702367
702377
|
try {
|
|
702368
|
-
const raw = JSON.parse(
|
|
702378
|
+
const raw = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
702369
702379
|
if (Array.isArray(raw)) {
|
|
702370
702380
|
sponsors = raw;
|
|
702371
702381
|
break;
|
|
@@ -702445,7 +702455,7 @@ async function handleEvaluate(ctx3) {
|
|
|
702445
702455
|
}));
|
|
702446
702456
|
return true;
|
|
702447
702457
|
}
|
|
702448
|
-
const job = JSON.parse(
|
|
702458
|
+
const job = JSON.parse(readFileSync132(jobPath, "utf-8"));
|
|
702449
702459
|
sendJson2(res, 200, {
|
|
702450
702460
|
run_id: runId,
|
|
702451
702461
|
task: job.task,
|
|
@@ -702585,7 +702595,7 @@ async function handleMintKey(ctx3) {
|
|
|
702585
702595
|
function _readStatusFile(p2) {
|
|
702586
702596
|
if (!existsSync162(p2)) return null;
|
|
702587
702597
|
try {
|
|
702588
|
-
const data = JSON.parse(
|
|
702598
|
+
const data = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
702589
702599
|
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
702590
702600
|
const pid = Number(data.pid);
|
|
702591
702601
|
if (pid > 0) {
|
|
@@ -702628,7 +702638,7 @@ function resolveLocalPeerId() {
|
|
|
702628
702638
|
try {
|
|
702629
702639
|
const regPath = join175(homedir60(), ".omnius", "nexus-registry.json");
|
|
702630
702640
|
if (existsSync162(regPath)) {
|
|
702631
|
-
const reg = JSON.parse(
|
|
702641
|
+
const reg = JSON.parse(readFileSync132(regPath, "utf-8"));
|
|
702632
702642
|
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
702633
702643
|
for (const entry of entries) {
|
|
702634
702644
|
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
@@ -704141,7 +704151,7 @@ function aimsDir() {
|
|
|
704141
704151
|
function readAimsFile(name10, fallback) {
|
|
704142
704152
|
try {
|
|
704143
704153
|
const p2 = join175(aimsDir(), name10);
|
|
704144
|
-
if (existsSync162(p2)) return JSON.parse(
|
|
704154
|
+
if (existsSync162(p2)) return JSON.parse(readFileSync132(p2, "utf-8"));
|
|
704145
704155
|
} catch {
|
|
704146
704156
|
}
|
|
704147
704157
|
return fallback;
|
|
@@ -704518,7 +704528,7 @@ async function handleAimsSuppliers(ctx3) {
|
|
|
704518
704528
|
for (const p2 of sponsorPaths) {
|
|
704519
704529
|
if (!existsSync162(p2)) continue;
|
|
704520
704530
|
try {
|
|
704521
|
-
const raw = JSON.parse(
|
|
704531
|
+
const raw = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
704522
704532
|
const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
|
|
704523
704533
|
for (const s2 of list) {
|
|
704524
704534
|
suppliers.push({
|
|
@@ -716474,7 +716484,7 @@ var init_auth_oidc = __esm({
|
|
|
716474
716484
|
});
|
|
716475
716485
|
|
|
716476
716486
|
// packages/cli/src/api/usage-tracker.ts
|
|
716477
|
-
import { mkdirSync as mkdirSync104, readFileSync as
|
|
716487
|
+
import { mkdirSync as mkdirSync104, readFileSync as readFileSync133, writeFileSync as writeFileSync88, existsSync as existsSync163 } from "node:fs";
|
|
716478
716488
|
import { join as join176 } from "node:path";
|
|
716479
716489
|
function initUsageTracker(omniusDir) {
|
|
716480
716490
|
const dir = join176(omniusDir, "usage");
|
|
@@ -716482,7 +716492,7 @@ function initUsageTracker(omniusDir) {
|
|
|
716482
716492
|
usageFile = join176(dir, "token-usage.json");
|
|
716483
716493
|
try {
|
|
716484
716494
|
if (existsSync163(usageFile)) {
|
|
716485
|
-
store = JSON.parse(
|
|
716495
|
+
store = JSON.parse(readFileSync133(usageFile, "utf-8"));
|
|
716486
716496
|
}
|
|
716487
716497
|
} catch {
|
|
716488
716498
|
store = { providers: {}, lastSaved: "" };
|
|
@@ -717181,7 +717191,7 @@ import {
|
|
|
717181
717191
|
createReadStream as createReadStream2,
|
|
717182
717192
|
mkdirSync as mkdirSync106,
|
|
717183
717193
|
writeFileSync as writeFileSync90,
|
|
717184
|
-
readFileSync as
|
|
717194
|
+
readFileSync as readFileSync134,
|
|
717185
717195
|
readdirSync as readdirSync58,
|
|
717186
717196
|
existsSync as existsSync165,
|
|
717187
717197
|
watch as fsWatch4,
|
|
@@ -717213,7 +717223,7 @@ function getVersion3() {
|
|
|
717213
717223
|
for (const pkgPath of candidates) {
|
|
717214
717224
|
try {
|
|
717215
717225
|
if (!existsSync165(pkgPath)) continue;
|
|
717216
|
-
const pkg = JSON.parse(
|
|
717226
|
+
const pkg = JSON.parse(readFileSync134(pkgPath, "utf8"));
|
|
717217
717227
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
717218
717228
|
return pkg.version ?? "0.0.0";
|
|
717219
717229
|
}
|
|
@@ -717629,7 +717639,7 @@ function isOriginAllowed(origin) {
|
|
|
717629
717639
|
try {
|
|
717630
717640
|
const accessFile = join179(homedir62(), ".omnius", "access");
|
|
717631
717641
|
if (existsSync165(accessFile)) {
|
|
717632
|
-
const persisted =
|
|
717642
|
+
const persisted = readFileSync134(accessFile, "utf8").trim().toLowerCase();
|
|
717633
717643
|
if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
|
|
717634
717644
|
accessMode = persisted;
|
|
717635
717645
|
}
|
|
@@ -718481,7 +718491,7 @@ function loadJob(id2) {
|
|
|
718481
718491
|
const file = join179(jobsDir(), `${id2}.json`);
|
|
718482
718492
|
if (!existsSync165(file)) return null;
|
|
718483
718493
|
try {
|
|
718484
|
-
return JSON.parse(
|
|
718494
|
+
return JSON.parse(readFileSync134(file, "utf-8"));
|
|
718485
718495
|
} catch {
|
|
718486
718496
|
return null;
|
|
718487
718497
|
}
|
|
@@ -718494,7 +718504,7 @@ function listJobs2() {
|
|
|
718494
718504
|
for (const file of files) {
|
|
718495
718505
|
try {
|
|
718496
718506
|
jobs.push(
|
|
718497
|
-
JSON.parse(
|
|
718507
|
+
JSON.parse(readFileSync134(join179(dir, file), "utf-8"))
|
|
718498
718508
|
);
|
|
718499
718509
|
} catch {
|
|
718500
718510
|
}
|
|
@@ -718512,7 +718522,7 @@ function pruneOldJobs() {
|
|
|
718512
718522
|
if (!file.endsWith(".json")) continue;
|
|
718513
718523
|
const path12 = join179(dir, file);
|
|
718514
718524
|
try {
|
|
718515
|
-
const job = JSON.parse(
|
|
718525
|
+
const job = JSON.parse(readFileSync134(path12, "utf-8"));
|
|
718516
718526
|
if (job.status === "running") {
|
|
718517
718527
|
kept++;
|
|
718518
718528
|
continue;
|
|
@@ -720668,7 +720678,7 @@ function readUpdateState() {
|
|
|
720668
720678
|
try {
|
|
720669
720679
|
const p2 = updateStateFile();
|
|
720670
720680
|
if (!existsSync165(p2)) return null;
|
|
720671
|
-
return JSON.parse(
|
|
720681
|
+
return JSON.parse(readFileSync134(p2, "utf-8"));
|
|
720672
720682
|
} catch {
|
|
720673
720683
|
return null;
|
|
720674
720684
|
}
|
|
@@ -720973,7 +720983,7 @@ function handleV1UpdateStatus(res) {
|
|
|
720973
720983
|
let exitCode = null;
|
|
720974
720984
|
try {
|
|
720975
720985
|
if (existsSync165(logPath3)) {
|
|
720976
|
-
const raw =
|
|
720986
|
+
const raw = readFileSync134(logPath3, "utf-8");
|
|
720977
720987
|
const m2 = raw.match(/__EXIT_CODE=(\d+)/);
|
|
720978
720988
|
if (m2) exitCode = parseInt(m2[1], 10);
|
|
720979
720989
|
logTail = raw.slice(-2e3);
|
|
@@ -723248,7 +723258,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
723248
723258
|
if (!result) {
|
|
723249
723259
|
jsonResponse(res, 500, {
|
|
723250
723260
|
error: "transcribe_unavailable",
|
|
723251
|
-
message: "
|
|
723261
|
+
message: "ASR runtime unavailable; Omnius attempted managed transcribe-cli and Whisper fallback setup. Run /listen once or inspect ~/.omnius/runtimes/asr and ~/.omnius/venv."
|
|
723252
723262
|
});
|
|
723253
723263
|
return;
|
|
723254
723264
|
}
|
|
@@ -725454,7 +725464,7 @@ function listScheduledTasks() {
|
|
|
725454
725464
|
if (dir.endsWith(`${join179(".omnius", "scheduled")}`) || dir.includes(`${join179(".omnius", "scheduled")}`)) {
|
|
725455
725465
|
const file = join179(dir, "tasks.json");
|
|
725456
725466
|
try {
|
|
725457
|
-
const raw =
|
|
725467
|
+
const raw = readFileSync134(file, "utf-8");
|
|
725458
725468
|
const json = JSON.parse(raw);
|
|
725459
725469
|
const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725460
725470
|
tasks.forEach((t2, i2) => {
|
|
@@ -725552,7 +725562,7 @@ function setScheduledEnabled(id2, enabled2) {
|
|
|
725552
725562
|
const target = tasks.find((t2) => t2.id === id2);
|
|
725553
725563
|
if (!target) return false;
|
|
725554
725564
|
try {
|
|
725555
|
-
const raw =
|
|
725565
|
+
const raw = readFileSync134(target.file, "utf-8");
|
|
725556
725566
|
const json = JSON.parse(raw);
|
|
725557
725567
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725558
725568
|
if (!arr[target.index]) return false;
|
|
@@ -725585,7 +725595,7 @@ function deleteScheduledById(id2) {
|
|
|
725585
725595
|
const target = tasks.find((t2) => t2.id === id2);
|
|
725586
725596
|
if (!target) return false;
|
|
725587
725597
|
try {
|
|
725588
|
-
const raw =
|
|
725598
|
+
const raw = readFileSync134(target.file, "utf-8");
|
|
725589
725599
|
const json = JSON.parse(raw);
|
|
725590
725600
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725591
725601
|
if (!arr[target.index]) return false;
|
|
@@ -725810,7 +725820,7 @@ function reconcileScheduledTasks(apply) {
|
|
|
725810
725820
|
try {
|
|
725811
725821
|
let json = { tasks: [] };
|
|
725812
725822
|
try {
|
|
725813
|
-
const raw =
|
|
725823
|
+
const raw = readFileSync134(file, "utf-8");
|
|
725814
725824
|
json = JSON.parse(raw);
|
|
725815
725825
|
} catch {
|
|
725816
725826
|
}
|
|
@@ -726189,7 +726199,7 @@ function startApiServer(options2 = {}) {
|
|
|
726189
726199
|
const sid = f2.replace(/\.json$/, "");
|
|
726190
726200
|
try {
|
|
726191
726201
|
const items = JSON.parse(
|
|
726192
|
-
|
|
726202
|
+
readFileSync134(join179(dir, f2), "utf-8")
|
|
726193
726203
|
);
|
|
726194
726204
|
if (Array.isArray(items)) {
|
|
726195
726205
|
cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
|
|
@@ -726223,7 +726233,7 @@ function startApiServer(options2 = {}) {
|
|
|
726223
726233
|
}
|
|
726224
726234
|
return;
|
|
726225
726235
|
}
|
|
726226
|
-
next = JSON.parse(
|
|
726236
|
+
next = JSON.parse(readFileSync134(fp, "utf-8"));
|
|
726227
726237
|
if (!Array.isArray(next)) return;
|
|
726228
726238
|
} catch {
|
|
726229
726239
|
return;
|
|
@@ -726286,7 +726296,7 @@ function startApiServer(options2 = {}) {
|
|
|
726286
726296
|
if (!f2.endsWith(".json")) continue;
|
|
726287
726297
|
try {
|
|
726288
726298
|
const jobPath = join179(jobsDir3, f2);
|
|
726289
|
-
const job = JSON.parse(
|
|
726299
|
+
const job = JSON.parse(readFileSync134(jobPath, "utf-8"));
|
|
726290
726300
|
const jobTime = new Date(
|
|
726291
726301
|
job.startedAt ?? job.completedAt ?? 0
|
|
726292
726302
|
).getTime();
|
|
@@ -726308,8 +726318,8 @@ function startApiServer(options2 = {}) {
|
|
|
726308
726318
|
if (useTls) {
|
|
726309
726319
|
try {
|
|
726310
726320
|
tlsOpts = {
|
|
726311
|
-
cert:
|
|
726312
|
-
key:
|
|
726321
|
+
cert: readFileSync134(resolve71(tlsCert)),
|
|
726322
|
+
key: readFileSync134(resolve71(tlsKey))
|
|
726313
726323
|
};
|
|
726314
726324
|
} catch (e2) {
|
|
726315
726325
|
log22(`
|
|
@@ -726322,7 +726332,7 @@ function startApiServer(options2 = {}) {
|
|
|
726322
726332
|
try {
|
|
726323
726333
|
const accessFile = join179(homedir62(), ".omnius", "access");
|
|
726324
726334
|
if (existsSync165(accessFile)) {
|
|
726325
|
-
const persisted =
|
|
726335
|
+
const persisted = readFileSync134(accessFile, "utf8").trim();
|
|
726326
726336
|
const resolved = resolveAccessMode(persisted, host);
|
|
726327
726337
|
if (resolved) runtimeAccessMode = resolved;
|
|
726328
726338
|
}
|
|
@@ -726753,7 +726763,7 @@ function startApiServer(options2 = {}) {
|
|
|
726753
726763
|
for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
|
|
726754
726764
|
const p2 = join179(here, rel);
|
|
726755
726765
|
if (existsSync165(p2)) {
|
|
726756
|
-
const pkg = JSON.parse(
|
|
726766
|
+
const pkg = JSON.parse(readFileSync134(p2, "utf8"));
|
|
726757
726767
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
726758
726768
|
return pkg.version ?? null;
|
|
726759
726769
|
}
|
|
@@ -727769,7 +727779,7 @@ var clipboard_media_exports = {};
|
|
|
727769
727779
|
__export(clipboard_media_exports, {
|
|
727770
727780
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
727771
727781
|
});
|
|
727772
|
-
import { mkdirSync as mkdirSync107, readFileSync as
|
|
727782
|
+
import { mkdirSync as mkdirSync107, readFileSync as readFileSync135, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
|
|
727773
727783
|
import { join as join180 } from "node:path";
|
|
727774
727784
|
async function pasteClipboardImageToFile(repoRoot) {
|
|
727775
727785
|
const image = await readClipboardImage();
|
|
@@ -727786,7 +727796,7 @@ async function readClipboardImage() {
|
|
|
727786
727796
|
if (!await commandExists2("pngpaste", 1e3)) return null;
|
|
727787
727797
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
727788
727798
|
await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
|
|
727789
|
-
const buffer2 =
|
|
727799
|
+
const buffer2 = readFileSync135(tmp);
|
|
727790
727800
|
try {
|
|
727791
727801
|
rmSync15(tmp);
|
|
727792
727802
|
} catch {
|
|
@@ -727846,7 +727856,7 @@ import { resolve as resolve72, join as join181, dirname as dirname54, extname as
|
|
|
727846
727856
|
import { createRequire as createRequire9 } from "node:module";
|
|
727847
727857
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
727848
727858
|
import {
|
|
727849
|
-
readFileSync as
|
|
727859
|
+
readFileSync as readFileSync136,
|
|
727850
727860
|
writeFileSync as writeFileSync92,
|
|
727851
727861
|
appendFileSync as appendFileSync20,
|
|
727852
727862
|
rmSync as rmSync16,
|
|
@@ -729327,7 +729337,7 @@ function gatherMemorySnippets(root) {
|
|
|
729327
729337
|
if (!existsSync166(dir)) continue;
|
|
729328
729338
|
try {
|
|
729329
729339
|
for (const f2 of readdirSync59(dir).filter((f3) => f3.endsWith(".json"))) {
|
|
729330
|
-
const data = JSON.parse(
|
|
729340
|
+
const data = JSON.parse(readFileSync136(join181(dir, f2), "utf-8"));
|
|
729331
729341
|
for (const val of Object.values(data)) {
|
|
729332
729342
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
729333
729343
|
if (v.length > 10) snippets.push(v);
|
|
@@ -729799,7 +729809,7 @@ ${metabolismMemories}
|
|
|
729799
729809
|
try {
|
|
729800
729810
|
const archeFile = join181(repoRoot, ".omnius", "arche", "variants.json");
|
|
729801
729811
|
if (existsSync166(archeFile)) {
|
|
729802
|
-
const variants = JSON.parse(
|
|
729812
|
+
const variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
729803
729813
|
if (variants.length > 0) {
|
|
729804
729814
|
let filtered = variants;
|
|
729805
729815
|
if (taskType) {
|
|
@@ -729990,7 +730000,7 @@ ${skillPack}`;
|
|
|
729990
730000
|
"self-state.json"
|
|
729991
730001
|
);
|
|
729992
730002
|
if (existsSync166(ikStateFile)) {
|
|
729993
|
-
const selfState = JSON.parse(
|
|
730003
|
+
const selfState = JSON.parse(readFileSync136(ikStateFile, "utf8"));
|
|
729994
730004
|
const lines = [
|
|
729995
730005
|
`[Identity State v${selfState.version}]`,
|
|
729996
730006
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -730329,7 +730339,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
730329
730339
|
}
|
|
730330
730340
|
}
|
|
730331
730341
|
try {
|
|
730332
|
-
const { readdirSync: readdirSync61, readFileSync:
|
|
730342
|
+
const { readdirSync: readdirSync61, readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
730333
730343
|
const { join: pathJoin } = await import("node:path");
|
|
730334
730344
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
730335
730345
|
if (existsSync169(chunksDir)) {
|
|
@@ -730339,7 +730349,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
730339
730349
|
for (const f2 of files) {
|
|
730340
730350
|
try {
|
|
730341
730351
|
const data = JSON.parse(
|
|
730342
|
-
|
|
730352
|
+
readFileSync138(pathJoin(chunksDir, f2), "utf-8")
|
|
730343
730353
|
);
|
|
730344
730354
|
if (data._deleted) continue;
|
|
730345
730355
|
if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
|
|
@@ -730405,7 +730415,7 @@ ${lines.join("\n")}`
|
|
|
730405
730415
|
const expand2 = args.expand === true;
|
|
730406
730416
|
if (expand2 && id2.startsWith("todo-ctx-")) {
|
|
730407
730417
|
try {
|
|
730408
|
-
const { readFileSync:
|
|
730418
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
730409
730419
|
const { join: pathJoin } = await import("node:path");
|
|
730410
730420
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
730411
730421
|
const todoIdSuffix = id2.replace("todo-ctx-", "");
|
|
@@ -731920,7 +731930,7 @@ async function startInteractive(config, repoPath2) {
|
|
|
731920
731930
|
const omniusDir = join181(repoRoot, ".omnius");
|
|
731921
731931
|
const nexusPidFile = join181(omniusDir, "nexus", "daemon.pid");
|
|
731922
731932
|
if (existsSync166(nexusPidFile)) {
|
|
731923
|
-
const pid = parseInt(
|
|
731933
|
+
const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
731924
731934
|
if (pid > 0) {
|
|
731925
731935
|
try {
|
|
731926
731936
|
process.kill(pid, 0);
|
|
@@ -733114,7 +733124,7 @@ This is an independent background session started from /background.`
|
|
|
733114
733124
|
try {
|
|
733115
733125
|
const titleFile = join181(repoRoot, ".omnius", "session-title");
|
|
733116
733126
|
if (existsSync166(titleFile))
|
|
733117
|
-
sessionTitle =
|
|
733127
|
+
sessionTitle = readFileSync136(titleFile, "utf8").trim() || null;
|
|
733118
733128
|
} catch {
|
|
733119
733129
|
}
|
|
733120
733130
|
let carouselRetired = isResumed;
|
|
@@ -733229,7 +733239,7 @@ This is an independent background session started from /background.`
|
|
|
733229
733239
|
let savedHistory = [];
|
|
733230
733240
|
try {
|
|
733231
733241
|
if (existsSync166(HISTORY_FILE)) {
|
|
733232
|
-
const raw =
|
|
733242
|
+
const raw = readFileSync136(HISTORY_FILE, "utf8").trim();
|
|
733233
733243
|
if (raw) savedHistory = raw.split("\n").reverse();
|
|
733234
733244
|
}
|
|
733235
733245
|
} catch {
|
|
@@ -733384,7 +733394,7 @@ This is an independent background session started from /background.`
|
|
|
733384
733394
|
mkdirSync108(HISTORY_DIR, { recursive: true });
|
|
733385
733395
|
appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
|
|
733386
733396
|
if (Math.random() < 0.02) {
|
|
733387
|
-
const all2 =
|
|
733397
|
+
const all2 = readFileSync136(HISTORY_FILE, "utf8").trim().split("\n");
|
|
733388
733398
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
733389
733399
|
writeFileSync92(
|
|
733390
733400
|
HISTORY_FILE,
|
|
@@ -733613,7 +733623,7 @@ This is an independent background session started from /background.`
|
|
|
733613
733623
|
const nexusPidFile = join181(autoNexus.getNexusDir(), "daemon.pid");
|
|
733614
733624
|
if (existsSync166(nexusPidFile)) {
|
|
733615
733625
|
const nPid = parseInt(
|
|
733616
|
-
|
|
733626
|
+
readFileSync136(nexusPidFile, "utf8").trim(),
|
|
733617
733627
|
10
|
|
733618
733628
|
);
|
|
733619
733629
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
@@ -733795,7 +733805,7 @@ Log: ${nexusLogPath}`
|
|
|
733795
733805
|
let agName = "";
|
|
733796
733806
|
try {
|
|
733797
733807
|
if (existsSync166(globalNamePath))
|
|
733798
|
-
agName =
|
|
733808
|
+
agName = readFileSync136(globalNamePath, "utf8").trim();
|
|
733799
733809
|
} catch {
|
|
733800
733810
|
}
|
|
733801
733811
|
if (!agName) {
|
|
@@ -733836,7 +733846,7 @@ Log: ${nexusLogPath}`
|
|
|
733836
733846
|
try {
|
|
733837
733847
|
if (existsSync166(savedSponsorsPath)) {
|
|
733838
733848
|
savedSponsors = JSON.parse(
|
|
733839
|
-
|
|
733849
|
+
readFileSync136(savedSponsorsPath, "utf8")
|
|
733840
733850
|
);
|
|
733841
733851
|
const oneHourAgo = Date.now() - 36e5;
|
|
733842
733852
|
savedSponsors = savedSponsors.filter(
|
|
@@ -735306,7 +735316,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
735306
735316
|
}
|
|
735307
735317
|
const available = await engine.isAvailable();
|
|
735308
735318
|
if (!available) {
|
|
735309
|
-
return "transcribe-cli
|
|
735319
|
+
return "ASR runtime unavailable. Omnius attempted managed transcribe-cli and Whisper fallback setup; check ~/.omnius/runtimes/asr and ~/.omnius/venv.";
|
|
735310
735320
|
}
|
|
735311
735321
|
engine.on("transcript", (text2, isFinal) => {
|
|
735312
735322
|
if (engine.currentMode === "confirm") {
|
|
@@ -735999,7 +736009,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
735999
736009
|
try {
|
|
736000
736010
|
const nexusPidFile = join181(nexusTool.getNexusDir(), "daemon.pid");
|
|
736001
736011
|
if (existsSync166(nexusPidFile)) {
|
|
736002
|
-
const pid = parseInt(
|
|
736012
|
+
const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
736003
736013
|
if (pid > 0) {
|
|
736004
736014
|
registry2.register({
|
|
736005
736015
|
name: "Nexus",
|
|
@@ -736212,7 +736222,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736212
736222
|
const nexusDir = join181(repoRoot, OMNIUS_DIR, "nexus");
|
|
736213
736223
|
const pidFile = join181(nexusDir, "daemon.pid");
|
|
736214
736224
|
if (existsSync166(pidFile)) {
|
|
736215
|
-
const pid = parseInt(
|
|
736225
|
+
const pid = parseInt(readFileSync136(pidFile, "utf8").trim(), 10);
|
|
736216
736226
|
if (pid > 0) {
|
|
736217
736227
|
try {
|
|
736218
736228
|
if (process.platform === "win32") {
|
|
@@ -736242,7 +736252,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736242
736252
|
const pidPath = join181(voiceDir3, pf);
|
|
736243
736253
|
if (existsSync166(pidPath)) {
|
|
736244
736254
|
try {
|
|
736245
|
-
const pid = parseInt(
|
|
736255
|
+
const pid = parseInt(readFileSync136(pidPath, "utf8").trim(), 10);
|
|
736246
736256
|
if (pid > 0) {
|
|
736247
736257
|
if (process.platform === "win32") {
|
|
736248
736258
|
try {
|
|
@@ -736383,8 +736393,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736383
736393
|
"daemon.port"
|
|
736384
736394
|
);
|
|
736385
736395
|
if (existsSync166(ppPidFile)) {
|
|
736386
|
-
const ppPid = parseInt(
|
|
736387
|
-
const ppPort = existsSync166(ppPortFile) ? parseInt(
|
|
736396
|
+
const ppPid = parseInt(readFileSync136(ppPidFile, "utf8").trim(), 10);
|
|
736397
|
+
const ppPort = existsSync166(ppPortFile) ? parseInt(readFileSync136(ppPortFile, "utf8").trim(), 10) : void 0;
|
|
736388
736398
|
if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
|
|
736389
736399
|
registry2.register({
|
|
736390
736400
|
name: "PersonaPlex",
|
|
@@ -736401,7 +736411,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736401
736411
|
"daemon.pid"
|
|
736402
736412
|
);
|
|
736403
736413
|
if (existsSync166(nexusPidFile)) {
|
|
736404
|
-
const nPid = parseInt(
|
|
736414
|
+
const nPid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
736405
736415
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
736406
736416
|
try {
|
|
736407
736417
|
process.kill(nPid, 0);
|
|
@@ -736845,7 +736855,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
736845
736855
|
if (isImage) {
|
|
736846
736856
|
try {
|
|
736847
736857
|
const imgPath = resolve72(repoRoot, cleanPath);
|
|
736848
|
-
const imgBuffer =
|
|
736858
|
+
const imgBuffer = readFileSync136(imgPath);
|
|
736849
736859
|
const base642 = imgBuffer.toString("base64");
|
|
736850
736860
|
const ext = extname22(cleanPath).toLowerCase();
|
|
736851
736861
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -737048,7 +737058,7 @@ ${result.text}`;
|
|
|
737048
737058
|
try {
|
|
737049
737059
|
const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
|
|
737050
737060
|
const ingressResult = await runVisionIngress2(
|
|
737051
|
-
{ path: imgPath, buffer:
|
|
737061
|
+
{ path: imgPath, buffer: readFileSync136(imgPath), mime },
|
|
737052
737062
|
currentConfig.model ?? ""
|
|
737053
737063
|
);
|
|
737054
737064
|
visionContext = formatImageContextPrefix2(ingressResult);
|
|
@@ -737116,7 +737126,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
|
|
|
737116
737126
|
if (isMarkdown && fullInput === input) {
|
|
737117
737127
|
try {
|
|
737118
737128
|
const mdPath = resolve72(repoRoot, cleanPath);
|
|
737119
|
-
const mdContent =
|
|
737129
|
+
const mdContent = readFileSync136(mdPath, "utf8");
|
|
737120
737130
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
737121
737131
|
const result = parseMcpMarkdown2(mdContent);
|
|
737122
737132
|
if (result.servers.length > 0) {
|
|
@@ -737776,7 +737786,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737776
737786
|
const ikFile = join181(ikDir, "self-state.json");
|
|
737777
737787
|
let ikState;
|
|
737778
737788
|
if (existsSync166(ikFile)) {
|
|
737779
|
-
ikState = JSON.parse(
|
|
737789
|
+
ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
|
|
737780
737790
|
} else {
|
|
737781
737791
|
mkdirSync108(ikDir, { recursive: true });
|
|
737782
737792
|
ikState = {
|
|
@@ -737849,7 +737859,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737849
737859
|
let variants = [];
|
|
737850
737860
|
try {
|
|
737851
737861
|
if (existsSync166(archeFile))
|
|
737852
|
-
variants = JSON.parse(
|
|
737862
|
+
variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
737853
737863
|
} catch {
|
|
737854
737864
|
}
|
|
737855
737865
|
variants.push({
|
|
@@ -737877,7 +737887,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737877
737887
|
"store.json"
|
|
737878
737888
|
);
|
|
737879
737889
|
if (existsSync166(metaFile2)) {
|
|
737880
|
-
const store2 = JSON.parse(
|
|
737890
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
737881
737891
|
const surfaced = store2.filter(
|
|
737882
737892
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
737883
737893
|
).sort(
|
|
@@ -737980,7 +737990,7 @@ Rules:
|
|
|
737980
737990
|
let store2 = [];
|
|
737981
737991
|
try {
|
|
737982
737992
|
if (existsSync166(storeFile))
|
|
737983
|
-
store2 = JSON.parse(
|
|
737993
|
+
store2 = JSON.parse(readFileSync136(storeFile, "utf8"));
|
|
737984
737994
|
} catch {
|
|
737985
737995
|
}
|
|
737986
737996
|
store2.push({
|
|
@@ -738014,7 +738024,7 @@ Rules:
|
|
|
738014
738024
|
let cohereActive = false;
|
|
738015
738025
|
try {
|
|
738016
738026
|
if (existsSync166(cohereSettingsFile)) {
|
|
738017
|
-
const settings = JSON.parse(
|
|
738027
|
+
const settings = JSON.parse(readFileSync136(cohereSettingsFile, "utf8"));
|
|
738018
738028
|
cohereActive = settings.cohere === true;
|
|
738019
738029
|
}
|
|
738020
738030
|
} catch {
|
|
@@ -738028,7 +738038,7 @@ Rules:
|
|
|
738028
738038
|
"store.json"
|
|
738029
738039
|
);
|
|
738030
738040
|
if (existsSync166(metaFile2)) {
|
|
738031
|
-
const store2 = JSON.parse(
|
|
738041
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
738032
738042
|
const latest = store2.filter(
|
|
738033
738043
|
(m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
|
|
738034
738044
|
).slice(-1)[0];
|
|
@@ -738061,7 +738071,7 @@ Rules:
|
|
|
738061
738071
|
try {
|
|
738062
738072
|
const ikFile = join181(repoRoot, ".omnius", "identity", "self-state.json");
|
|
738063
738073
|
if (existsSync166(ikFile)) {
|
|
738064
|
-
const ikState = JSON.parse(
|
|
738074
|
+
const ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
|
|
738065
738075
|
ikState.homeostasis.uncertainty = Math.min(
|
|
738066
738076
|
1,
|
|
738067
738077
|
ikState.homeostasis.uncertainty + 0.1
|
|
@@ -738082,7 +738092,7 @@ Rules:
|
|
|
738082
738092
|
"store.json"
|
|
738083
738093
|
);
|
|
738084
738094
|
if (existsSync166(metaFile2)) {
|
|
738085
|
-
const store2 = JSON.parse(
|
|
738095
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
738086
738096
|
const surfaced = store2.filter(
|
|
738087
738097
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
738088
738098
|
).sort(
|
|
@@ -738108,7 +738118,7 @@ Rules:
|
|
|
738108
738118
|
let variants = [];
|
|
738109
738119
|
try {
|
|
738110
738120
|
if (existsSync166(archeFile))
|
|
738111
|
-
variants = JSON.parse(
|
|
738121
|
+
variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
738112
738122
|
} catch {
|
|
738113
738123
|
}
|
|
738114
738124
|
variants.push({
|
|
@@ -738247,7 +738257,7 @@ import { spawn as spawn38 } from "node:child_process";
|
|
|
738247
738257
|
import {
|
|
738248
738258
|
mkdirSync as mkdirSync109,
|
|
738249
738259
|
writeFileSync as writeFileSync93,
|
|
738250
|
-
readFileSync as
|
|
738260
|
+
readFileSync as readFileSync137,
|
|
738251
738261
|
readdirSync as readdirSync60,
|
|
738252
738262
|
existsSync as existsSync167
|
|
738253
738263
|
} from "node:fs";
|
|
@@ -738455,7 +738465,7 @@ function statusCommand(jobId, repoPath2) {
|
|
|
738455
738465
|
console.log(`Available jobs: omnius jobs`);
|
|
738456
738466
|
process.exit(1);
|
|
738457
738467
|
}
|
|
738458
|
-
const job = JSON.parse(
|
|
738468
|
+
const job = JSON.parse(readFileSync137(file, "utf-8"));
|
|
738459
738469
|
const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
|
|
738460
738470
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
738461
738471
|
console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
|
|
@@ -738477,7 +738487,7 @@ function jobsCommand(repoPath2) {
|
|
|
738477
738487
|
console.log("Jobs:");
|
|
738478
738488
|
for (const file of files) {
|
|
738479
738489
|
try {
|
|
738480
|
-
const job = JSON.parse(
|
|
738490
|
+
const job = JSON.parse(readFileSync137(join182(dir, file), "utf-8"));
|
|
738481
738491
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
738482
738492
|
const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
|
|
738483
738493
|
const cleanListTask = cleanForStorage(job.task) || job.task;
|