omnius 1.0.414 → 1.0.416
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 +608 -451
- 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);
|
|
@@ -604087,7 +604087,9 @@ async function discoverAudioOutputs() {
|
|
|
604087
604087
|
return { devices: dedupeDevices(devices), errors };
|
|
604088
604088
|
}
|
|
604089
604089
|
async function recordAudioSample(device, durationSec, outputPath3) {
|
|
604090
|
-
const
|
|
604090
|
+
const duration = Math.max(0.2, Math.min(30, Number.isFinite(durationSec) ? durationSec : 1));
|
|
604091
|
+
const ffmpegSeconds = duration < 1 ? duration.toFixed(3) : String(Math.ceil(duration));
|
|
604092
|
+
const arecordSeconds = String(Math.max(1, Math.ceil(duration)));
|
|
604091
604093
|
if (device.startsWith("pulse:") && await commandExists2("ffmpeg", 1500)) {
|
|
604092
604094
|
const source = device.slice("pulse:".length);
|
|
604093
604095
|
await execFileText4("ffmpeg", [
|
|
@@ -604099,14 +604101,38 @@ async function recordAudioSample(device, durationSec, outputPath3) {
|
|
|
604099
604101
|
"-i",
|
|
604100
604102
|
source,
|
|
604101
604103
|
"-t",
|
|
604102
|
-
|
|
604104
|
+
ffmpegSeconds,
|
|
604103
604105
|
"-ac",
|
|
604104
604106
|
"1",
|
|
604105
604107
|
"-ar",
|
|
604106
604108
|
"16000",
|
|
604109
|
+
"-acodec",
|
|
604110
|
+
"pcm_s16le",
|
|
604107
604111
|
"-y",
|
|
604108
604112
|
outputPath3
|
|
604109
|
-
], { timeout: (
|
|
604113
|
+
], { timeout: (Math.ceil(duration) + 10) * 1e3 });
|
|
604114
|
+
return;
|
|
604115
|
+
}
|
|
604116
|
+
if (duration < 1 && await commandExists2("ffmpeg", 1500)) {
|
|
604117
|
+
await execFileText4("ffmpeg", [
|
|
604118
|
+
"-hide_banner",
|
|
604119
|
+
"-loglevel",
|
|
604120
|
+
"error",
|
|
604121
|
+
"-f",
|
|
604122
|
+
"alsa",
|
|
604123
|
+
"-i",
|
|
604124
|
+
device || "default",
|
|
604125
|
+
"-t",
|
|
604126
|
+
ffmpegSeconds,
|
|
604127
|
+
"-ac",
|
|
604128
|
+
"1",
|
|
604129
|
+
"-ar",
|
|
604130
|
+
"16000",
|
|
604131
|
+
"-acodec",
|
|
604132
|
+
"pcm_s16le",
|
|
604133
|
+
"-y",
|
|
604134
|
+
outputPath3
|
|
604135
|
+
], { timeout: (Math.ceil(duration) + 10) * 1e3 });
|
|
604110
604136
|
return;
|
|
604111
604137
|
}
|
|
604112
604138
|
await execFileText4("arecord", [
|
|
@@ -604119,10 +604145,10 @@ async function recordAudioSample(device, durationSec, outputPath3) {
|
|
|
604119
604145
|
"-c",
|
|
604120
604146
|
"1",
|
|
604121
604147
|
"-d",
|
|
604122
|
-
|
|
604148
|
+
arecordSeconds,
|
|
604123
604149
|
"-q",
|
|
604124
604150
|
outputPath3
|
|
604125
|
-
], { timeout: (Number(
|
|
604151
|
+
], { timeout: (Number(arecordSeconds) + 10) * 1e3 });
|
|
604126
604152
|
}
|
|
604127
604153
|
async function scoreCameraOrientationWithOpenCv(framePath) {
|
|
604128
604154
|
if (!await commandExists2("python3", 1200)) return null;
|
|
@@ -604196,19 +604222,25 @@ function hasLiveAudioSignal(activity) {
|
|
|
604196
604222
|
function audioCaptureMethod(device) {
|
|
604197
604223
|
return device.startsWith("pulse:") ? "pulse/ffmpeg" : "arecord";
|
|
604198
604224
|
}
|
|
604199
|
-
async function recordAudioSampleWithRecovery(preferred, devices, durationSec, outputPath3) {
|
|
604225
|
+
async function recordAudioSampleWithRecovery(preferred, devices, durationSec, outputPath3, options2 = {}) {
|
|
604226
|
+
const allowFallback = options2.allowFallback !== false;
|
|
604227
|
+
const requireSignal = options2.requireSignal !== false;
|
|
604200
604228
|
const ordered = [];
|
|
604201
604229
|
const add3 = (id2) => {
|
|
604202
604230
|
const clean5 = String(id2 ?? "").trim();
|
|
604203
604231
|
if (clean5 && !ordered.includes(clean5)) ordered.push(clean5);
|
|
604204
604232
|
};
|
|
604205
604233
|
const preferredInput = preferredLiveAudioInputId(devices, preferred);
|
|
604206
|
-
|
|
604207
|
-
|
|
604208
|
-
|
|
604209
|
-
|
|
604210
|
-
|
|
604211
|
-
|
|
604234
|
+
if (allowFallback) {
|
|
604235
|
+
add3(preferredInput);
|
|
604236
|
+
if (preferred) add3(preferred);
|
|
604237
|
+
for (const device of rankLiveAudioInputDevices(devices, preferred).filter((entry) => !isAudioOutputMonitorDevice(entry))) add3(device.id);
|
|
604238
|
+
add3("pulse:default");
|
|
604239
|
+
add3("default");
|
|
604240
|
+
for (const device of rankLiveAudioInputDevices(devices, preferred).filter((entry) => isAudioOutputMonitorDevice(entry))) add3(device.id);
|
|
604241
|
+
} else {
|
|
604242
|
+
add3(preferred || preferredInput || "default");
|
|
604243
|
+
}
|
|
604212
604244
|
const errors = [];
|
|
604213
604245
|
const attempts = [];
|
|
604214
604246
|
let firstQuietCapture = null;
|
|
@@ -604218,8 +604250,9 @@ async function recordAudioSampleWithRecovery(preferred, devices, durationSec, ou
|
|
|
604218
604250
|
await tryRecordAudioDevice(candidate, durationSec, outputPath3);
|
|
604219
604251
|
const activity = readPcm16WavActivity(outputPath3);
|
|
604220
604252
|
const method = audioCaptureMethod(candidate);
|
|
604221
|
-
|
|
604222
|
-
|
|
604253
|
+
const signalDetected = hasLiveAudioSignal(activity);
|
|
604254
|
+
if (!requireSignal || signalDetected) {
|
|
604255
|
+
return { ok: true, device: candidate, method, errors, attempts, activity, signalDetected };
|
|
604223
604256
|
}
|
|
604224
604257
|
if (!firstQuietCapture) {
|
|
604225
604258
|
firstQuietCapture = {
|
|
@@ -604325,7 +604358,7 @@ function formatLiveStatus(snapshot) {
|
|
|
604325
604358
|
}
|
|
604326
604359
|
return lines.join("\n");
|
|
604327
604360
|
}
|
|
604328
|
-
var MIN_VIDEO_INTERVAL_MS, LOW_LATENCY_VIDEO_INTERVAL_MS, MIN_AUDIO_INTERVAL_MS, LOW_LATENCY_AUDIO_INTERVAL_MS, DEFAULT_CONFIG7, managers, DASHBOARD_ANSI_STICKY_PATTERN, LiveSensorManager;
|
|
604361
|
+
var MIN_VIDEO_INTERVAL_MS, LOW_LATENCY_VIDEO_INTERVAL_MS, MIN_AUDIO_INTERVAL_MS, LOW_LATENCY_AUDIO_INTERVAL_MS, AUDIO_ACTIVITY_INTERVAL_MS, AUDIO_ACTIVITY_SAMPLE_SEC, DEFAULT_CONFIG7, managers, DASHBOARD_ANSI_STICKY_PATTERN, LiveSensorManager;
|
|
604329
604362
|
var init_live_sensors = __esm({
|
|
604330
604363
|
"packages/cli/src/tui/live-sensors.ts"() {
|
|
604331
604364
|
"use strict";
|
|
@@ -604336,6 +604369,8 @@ var init_live_sensors = __esm({
|
|
|
604336
604369
|
LOW_LATENCY_VIDEO_INTERVAL_MS = 250;
|
|
604337
604370
|
MIN_AUDIO_INTERVAL_MS = 1500;
|
|
604338
604371
|
LOW_LATENCY_AUDIO_INTERVAL_MS = 2e3;
|
|
604372
|
+
AUDIO_ACTIVITY_INTERVAL_MS = 200;
|
|
604373
|
+
AUDIO_ACTIVITY_SAMPLE_SEC = 0.2;
|
|
604339
604374
|
DEFAULT_CONFIG7 = {
|
|
604340
604375
|
videoEnabled: false,
|
|
604341
604376
|
audioEnabled: false,
|
|
@@ -604368,8 +604403,10 @@ var init_live_sensors = __esm({
|
|
|
604368
604403
|
snapshot;
|
|
604369
604404
|
videoTimer = null;
|
|
604370
604405
|
audioTimer = null;
|
|
604406
|
+
audioActivityTimer = null;
|
|
604371
604407
|
videoInFlight = false;
|
|
604372
604408
|
audioInFlight = false;
|
|
604409
|
+
audioActivityInFlight = false;
|
|
604373
604410
|
statusSink = null;
|
|
604374
604411
|
feedbackSink = null;
|
|
604375
604412
|
agentActionSink = null;
|
|
@@ -604580,10 +604617,7 @@ var init_live_sensors = __esm({
|
|
|
604580
604617
|
errors
|
|
604581
604618
|
};
|
|
604582
604619
|
if (!this.config.selectedCamera) this.config.selectedCamera = firstDeviceId(video);
|
|
604583
|
-
|
|
604584
|
-
if (!this.config.selectedAudioInput || isAudioOutputMonitorId(this.config.selectedAudioInput) && preferredInput && !isAudioOutputMonitorId(preferredInput)) {
|
|
604585
|
-
this.config.selectedAudioInput = preferredInput;
|
|
604586
|
-
}
|
|
604620
|
+
if (!this.config.selectedAudioInput) this.config.selectedAudioInput = preferredLiveAudioInputId(inputs.devices);
|
|
604587
604621
|
if (!this.config.selectedAudioOutput) this.config.selectedAudioOutput = firstDeviceId(outputs.devices);
|
|
604588
604622
|
this.persist();
|
|
604589
604623
|
return this.devices;
|
|
@@ -604987,13 +605021,93 @@ ${output}`).join("\n\n");
|
|
|
604987
605021
|
this.videoInFlight = false;
|
|
604988
605022
|
}
|
|
604989
605023
|
}
|
|
605024
|
+
resolveAudioInput() {
|
|
605025
|
+
const selected = String(this.config.selectedAudioInput ?? "").trim();
|
|
605026
|
+
if (selected) return selected;
|
|
605027
|
+
const input = preferredLiveAudioInputId(this.devices.audioInputs) || "default";
|
|
605028
|
+
this.config.selectedAudioInput = input;
|
|
605029
|
+
this.persist();
|
|
605030
|
+
return input;
|
|
605031
|
+
}
|
|
605032
|
+
async previewAudioInput(device = this.config.selectedAudioInput) {
|
|
605033
|
+
const input = String(device || "").trim() || this.resolveAudioInput();
|
|
605034
|
+
ensureLiveDir(this.repoRoot);
|
|
605035
|
+
const recordingPath = join124(liveDir(this.repoRoot), `audio-preview-${Date.now()}.wav`);
|
|
605036
|
+
const capture = await recordAudioSampleWithRecovery(input, this.devices.audioInputs, 0.8, recordingPath, {
|
|
605037
|
+
allowFallback: false
|
|
605038
|
+
});
|
|
605039
|
+
const now2 = Date.now();
|
|
605040
|
+
const activity = capture.activity ?? (capture.ok ? readPcm16WavActivity(recordingPath) : void 0);
|
|
605041
|
+
if (capture.ok) {
|
|
605042
|
+
this.snapshot.audio = {
|
|
605043
|
+
...this.snapshot.audio ?? { updatedAt: now2 },
|
|
605044
|
+
updatedAt: now2,
|
|
605045
|
+
input,
|
|
605046
|
+
output: this.config.selectedAudioOutput,
|
|
605047
|
+
recordingPath,
|
|
605048
|
+
activity,
|
|
605049
|
+
error: void 0
|
|
605050
|
+
};
|
|
605051
|
+
this.persist();
|
|
605052
|
+
this.emitDashboard();
|
|
605053
|
+
const signal = capture.signalDetected === false ? "quiet/no clear mic signal" : "signal detected";
|
|
605054
|
+
return {
|
|
605055
|
+
ok: true,
|
|
605056
|
+
input,
|
|
605057
|
+
recordingPath,
|
|
605058
|
+
activity,
|
|
605059
|
+
message: [
|
|
605060
|
+
`Audio input preview from ${input}: ${signal}`,
|
|
605061
|
+
activity ? `activity ${activity.waveform} rms=${activity.rmsDb.toFixed(1)}dB active=${Math.round(activity.activeRatio * 100)}% peak=${activity.peak.toFixed(3)}` : "",
|
|
605062
|
+
`recording: ${recordingPath}`
|
|
605063
|
+
].filter(Boolean).join("\n")
|
|
605064
|
+
};
|
|
605065
|
+
}
|
|
605066
|
+
const message2 = `Audio input preview failed for ${input}: ${capture.errors.slice(0, 5).join(" | ") || "capture failed"}`;
|
|
605067
|
+
this.snapshot.audio = {
|
|
605068
|
+
...this.snapshot.audio ?? { updatedAt: now2 },
|
|
605069
|
+
updatedAt: now2,
|
|
605070
|
+
input,
|
|
605071
|
+
output: this.config.selectedAudioOutput,
|
|
605072
|
+
error: message2
|
|
605073
|
+
};
|
|
605074
|
+
this.persist();
|
|
605075
|
+
this.emitDashboard();
|
|
605076
|
+
return { ok: false, input, message: message2 };
|
|
605077
|
+
}
|
|
605078
|
+
async sampleAudioActivityNow() {
|
|
605079
|
+
if (!this.config.audioEnabled || this.audioActivityInFlight) return;
|
|
605080
|
+
this.audioActivityInFlight = true;
|
|
605081
|
+
const input = this.resolveAudioInput();
|
|
605082
|
+
try {
|
|
605083
|
+
ensureLiveDir(this.repoRoot);
|
|
605084
|
+
const recordingPath = join124(liveDir(this.repoRoot), "audio-activity.wav");
|
|
605085
|
+
const capture = await recordAudioSampleWithRecovery(input, this.devices.audioInputs, AUDIO_ACTIVITY_SAMPLE_SEC, recordingPath, {
|
|
605086
|
+
allowFallback: false,
|
|
605087
|
+
requireSignal: false
|
|
605088
|
+
});
|
|
605089
|
+
const now2 = Date.now();
|
|
605090
|
+
const activity = capture.activity ?? (capture.ok ? readPcm16WavActivity(recordingPath) : void 0);
|
|
605091
|
+
this.snapshot.audio = {
|
|
605092
|
+
...this.snapshot.audio ?? { updatedAt: now2 },
|
|
605093
|
+
updatedAt: now2,
|
|
605094
|
+
input,
|
|
605095
|
+
output: this.config.selectedAudioOutput,
|
|
605096
|
+
recordingPath,
|
|
605097
|
+
activity,
|
|
605098
|
+
error: capture.ok ? this.snapshot.audio?.error : `Audio activity capture failed from ${input}: ${capture.errors.slice(0, 3).join(" | ")}`
|
|
605099
|
+
};
|
|
605100
|
+
this.persist();
|
|
605101
|
+
this.emitDashboard();
|
|
605102
|
+
} finally {
|
|
605103
|
+
this.audioActivityInFlight = false;
|
|
605104
|
+
}
|
|
605105
|
+
}
|
|
604990
605106
|
async sampleAudioNow() {
|
|
604991
605107
|
if (this.audioInFlight) return "Audio sampler is already running.";
|
|
604992
605108
|
this.audioInFlight = true;
|
|
604993
605109
|
try {
|
|
604994
|
-
const
|
|
604995
|
-
const input = this.config.selectedAudioInput && !isAudioOutputMonitorId(this.config.selectedAudioInput) ? this.config.selectedAudioInput : preferredInput;
|
|
604996
|
-
if (input !== this.config.selectedAudioInput) this.config.selectedAudioInput = input;
|
|
605110
|
+
const input = this.resolveAudioInput();
|
|
604997
605111
|
if (this.isLiveAudioMutedForTts()) {
|
|
604998
605112
|
const now2 = Date.now();
|
|
604999
605113
|
this.snapshot.audio = {
|
|
@@ -605016,9 +605130,11 @@ ${output}`).join("\n\n");
|
|
|
605016
605130
|
let analysis = "";
|
|
605017
605131
|
let intake;
|
|
605018
605132
|
const audioErrors = [];
|
|
605019
|
-
const capture = await recordAudioSampleWithRecovery(input, this.devices.audioInputs, 3, recordingPath
|
|
605133
|
+
const capture = await recordAudioSampleWithRecovery(input, this.devices.audioInputs, 3, recordingPath, {
|
|
605134
|
+
allowFallback: false
|
|
605135
|
+
});
|
|
605020
605136
|
if (!capture.ok) {
|
|
605021
|
-
const message2 = `Audio capture failed from ${input}
|
|
605137
|
+
const message2 = `Audio capture failed from selected input ${input}: ${capture.errors.slice(0, 5).join(" | ")}`;
|
|
605022
605138
|
this.snapshot.audio = {
|
|
605023
605139
|
updatedAt: Date.now(),
|
|
605024
605140
|
input,
|
|
@@ -605035,12 +605151,9 @@ ${output}`).join("\n\n");
|
|
|
605035
605151
|
this.emitDashboard();
|
|
605036
605152
|
return message2;
|
|
605037
605153
|
}
|
|
605038
|
-
if (capture.device !== this.config.selectedAudioInput) {
|
|
605039
|
-
this.config.selectedAudioInput = capture.device;
|
|
605040
|
-
}
|
|
605041
605154
|
const activity = capture.activity ?? readPcm16WavActivity(recordingPath);
|
|
605042
605155
|
if (capture.ok && capture.signalDetected === false) {
|
|
605043
|
-
audioErrors.push(`No live input signal detected
|
|
605156
|
+
audioErrors.push(`No live input signal detected from selected input ${capture.device}; keeping the explicit selection.`);
|
|
605044
605157
|
}
|
|
605045
605158
|
if (this.config.asrEnabled) {
|
|
605046
605159
|
try {
|
|
@@ -605135,7 +605248,7 @@ ${output}`).join("\n\n");
|
|
|
605135
605248
|
}
|
|
605136
605249
|
this.emitDashboard();
|
|
605137
605250
|
return [
|
|
605138
|
-
`Audio sample captured from ${capture.device}
|
|
605251
|
+
`Audio sample captured from selected input ${capture.device}: ${recordingPath}`,
|
|
605139
605252
|
transcript ? `
|
|
605140
605253
|
ASR${asrBackend ? ` (${asrBackend})` : ""}:
|
|
605141
605254
|
${transcript}` : "",
|
|
@@ -605158,6 +605271,10 @@ ${analysis}` : ""
|
|
|
605158
605271
|
clearTimeout(this.audioTimer);
|
|
605159
605272
|
this.audioTimer = null;
|
|
605160
605273
|
}
|
|
605274
|
+
if (this.audioActivityTimer) {
|
|
605275
|
+
clearTimeout(this.audioActivityTimer);
|
|
605276
|
+
this.audioActivityTimer = null;
|
|
605277
|
+
}
|
|
605161
605278
|
}
|
|
605162
605279
|
scheduleVideoLoop(delayMs) {
|
|
605163
605280
|
if (!this.config.videoEnabled || this.videoTimer) return;
|
|
@@ -605194,6 +605311,22 @@ ${analysis}` : ""
|
|
|
605194
605311
|
}, Math.max(0, delayMs));
|
|
605195
605312
|
this.audioTimer.unref?.();
|
|
605196
605313
|
}
|
|
605314
|
+
scheduleAudioActivityLoop(delayMs) {
|
|
605315
|
+
if (!this.config.audioEnabled || this.audioActivityTimer) return;
|
|
605316
|
+
this.audioActivityTimer = setTimeout(async () => {
|
|
605317
|
+
const startedAt2 = Date.now();
|
|
605318
|
+
this.audioActivityTimer = null;
|
|
605319
|
+
if (!this.config.audioEnabled) return;
|
|
605320
|
+
try {
|
|
605321
|
+
await this.sampleAudioActivityNow();
|
|
605322
|
+
} catch {
|
|
605323
|
+
} finally {
|
|
605324
|
+
const elapsedMs2 = Date.now() - startedAt2;
|
|
605325
|
+
if (this.config.audioEnabled) this.scheduleAudioActivityLoop(Math.max(0, AUDIO_ACTIVITY_INTERVAL_MS - elapsedMs2));
|
|
605326
|
+
}
|
|
605327
|
+
}, Math.max(0, delayMs));
|
|
605328
|
+
this.audioActivityTimer.unref?.();
|
|
605329
|
+
}
|
|
605197
605330
|
ensureLoops() {
|
|
605198
605331
|
if (this.config.videoEnabled && !this.videoTimer) {
|
|
605199
605332
|
this.scheduleVideoLoop(0);
|
|
@@ -605208,6 +605341,12 @@ ${analysis}` : ""
|
|
|
605208
605341
|
clearTimeout(this.audioTimer);
|
|
605209
605342
|
this.audioTimer = null;
|
|
605210
605343
|
}
|
|
605344
|
+
if (this.config.audioEnabled && !this.audioActivityTimer) {
|
|
605345
|
+
this.scheduleAudioActivityLoop(0);
|
|
605346
|
+
} else if (!this.config.audioEnabled && this.audioActivityTimer) {
|
|
605347
|
+
clearTimeout(this.audioActivityTimer);
|
|
605348
|
+
this.audioActivityTimer = null;
|
|
605349
|
+
}
|
|
605211
605350
|
}
|
|
605212
605351
|
emitStatus() {
|
|
605213
605352
|
this.statusSink?.({
|
|
@@ -605756,8 +605895,6 @@ __export(listen_exports, {
|
|
|
605756
605895
|
});
|
|
605757
605896
|
import { spawn as spawn29 } from "node:child_process";
|
|
605758
605897
|
import {
|
|
605759
|
-
accessSync as accessSync2,
|
|
605760
|
-
constants as constants2,
|
|
605761
605898
|
existsSync as existsSync111,
|
|
605762
605899
|
mkdirSync as mkdirSync69,
|
|
605763
605900
|
writeFileSync as writeFileSync58,
|
|
@@ -606000,7 +606137,21 @@ async function ensureVenvForTranscribeCli() {
|
|
|
606000
606137
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
606001
606138
|
const venvBin = join127(homedir39(), ".omnius", "venv", bin);
|
|
606002
606139
|
const venvPython2 = join127(venvBin, exe);
|
|
606003
|
-
if (!existsSync111(venvPython2))
|
|
606140
|
+
if (!existsSync111(venvPython2)) {
|
|
606141
|
+
try {
|
|
606142
|
+
const mod3 = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
|
|
606143
|
+
if (typeof mod3.ensureEmbedDeps === "function") mod3.ensureEmbedDeps();
|
|
606144
|
+
} catch {
|
|
606145
|
+
}
|
|
606146
|
+
}
|
|
606147
|
+
if (!existsSync111(venvPython2)) {
|
|
606148
|
+
try {
|
|
606149
|
+
mkdirSync69(join127(homedir39(), ".omnius", "venv"), { recursive: true });
|
|
606150
|
+
await execFileText4("python3", ["-m", "venv", join127(homedir39(), ".omnius", "venv")], { timeout: 6e4 });
|
|
606151
|
+
} catch {
|
|
606152
|
+
return false;
|
|
606153
|
+
}
|
|
606154
|
+
}
|
|
606004
606155
|
process.env.TRANSCRIBE_PYTHON = venvPython2;
|
|
606005
606156
|
const pathSep2 = process.platform === "win32" ? ";" : ":";
|
|
606006
606157
|
const currentPath = process.env.PATH || "";
|
|
@@ -606009,65 +606160,79 @@ async function ensureVenvForTranscribeCli() {
|
|
|
606009
606160
|
}
|
|
606010
606161
|
try {
|
|
606011
606162
|
await execFileText4(venvPython2, ["-c", "import numpy"], { timeout: 1e4 });
|
|
606163
|
+
} catch {
|
|
606164
|
+
try {
|
|
606165
|
+
await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "pip", "setuptools", "wheel", "numpy==1.26.4"], { timeout: 3e5 });
|
|
606166
|
+
} catch {
|
|
606167
|
+
return false;
|
|
606168
|
+
}
|
|
606169
|
+
}
|
|
606170
|
+
try {
|
|
606171
|
+
await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
|
|
606172
|
+
return true;
|
|
606173
|
+
} catch {
|
|
606174
|
+
}
|
|
606175
|
+
try {
|
|
606176
|
+
await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "transcribe-cli"], { timeout: 3e5 });
|
|
606177
|
+
await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
|
|
606012
606178
|
return true;
|
|
606013
606179
|
} catch {
|
|
606014
606180
|
return false;
|
|
606015
606181
|
}
|
|
606016
606182
|
}
|
|
606017
|
-
function
|
|
606018
|
-
|
|
606019
|
-
|
|
606020
|
-
|
|
606021
|
-
|
|
606022
|
-
|
|
606023
|
-
|
|
606024
|
-
|
|
606025
|
-
|
|
606026
|
-
|
|
606183
|
+
async function requireTranscribeCliFrom2(packageDir) {
|
|
606184
|
+
try {
|
|
606185
|
+
const { createRequire: createRequire11 } = await import("node:module");
|
|
606186
|
+
const req3 = createRequire11(import.meta.url);
|
|
606187
|
+
const distPath = join127(packageDir, "dist", "index.js");
|
|
606188
|
+
if (existsSync111(distPath)) return req3(distPath);
|
|
606189
|
+
return req3(packageDir);
|
|
606190
|
+
} catch {
|
|
606191
|
+
return null;
|
|
606192
|
+
}
|
|
606193
|
+
}
|
|
606194
|
+
async function loadManagedTranscribeCli() {
|
|
606195
|
+
const packageDir = join127(MANAGED_TRANSCRIBE_CLI_DIR2, "node_modules", "transcribe-cli");
|
|
606196
|
+
if (!existsSync111(join127(packageDir, "dist", "index.js"))) return null;
|
|
606197
|
+
return requireTranscribeCliFrom2(packageDir);
|
|
606198
|
+
}
|
|
606199
|
+
async function ensureManagedTranscribeCliNode() {
|
|
606200
|
+
if (await loadManagedTranscribeCli()) return true;
|
|
606201
|
+
if (_managedTranscribeCliInstallPromise) return _managedTranscribeCliInstallPromise;
|
|
606202
|
+
_managedTranscribeCliInstallPromise = (async () => {
|
|
606027
606203
|
try {
|
|
606028
|
-
|
|
606029
|
-
|
|
606030
|
-
|
|
606031
|
-
|
|
606032
|
-
|
|
606033
|
-
|
|
606204
|
+
mkdirSync69(MANAGED_TRANSCRIBE_CLI_DIR2, { recursive: true });
|
|
606205
|
+
if (!existsSync111(join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"))) {
|
|
606206
|
+
writeFileSync58(
|
|
606207
|
+
join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"),
|
|
606208
|
+
JSON.stringify({ private: true, dependencies: {} }, null, 2),
|
|
606209
|
+
"utf8"
|
|
606210
|
+
);
|
|
606034
606211
|
}
|
|
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
|
-
});
|
|
606212
|
+
await execFileText4("npm", ["install", "--prefix", MANAGED_TRANSCRIBE_CLI_DIR2, "transcribe-cli@^2.0.1"], {
|
|
606213
|
+
timeout: 18e4
|
|
606059
606214
|
});
|
|
606215
|
+
return Boolean(await loadManagedTranscribeCli());
|
|
606060
606216
|
} catch {
|
|
606061
606217
|
return false;
|
|
606062
606218
|
}
|
|
606063
606219
|
})();
|
|
606220
|
+
return _managedTranscribeCliInstallPromise;
|
|
606221
|
+
}
|
|
606222
|
+
function ensureTranscribeCliBackground() {
|
|
606223
|
+
if (_bgInstallPromise) return _bgInstallPromise;
|
|
606224
|
+
_bgInstallPromise = (async () => {
|
|
606225
|
+
const nodeReady = await ensureManagedTranscribeCliNode();
|
|
606226
|
+
const pyReady = await ensureVenvForTranscribeCli();
|
|
606227
|
+
return nodeReady && pyReady;
|
|
606228
|
+
})();
|
|
606064
606229
|
return _bgInstallPromise;
|
|
606065
606230
|
}
|
|
606066
606231
|
async function waitForTranscribeCli() {
|
|
606067
606232
|
if (_bgInstallPromise) {
|
|
606068
606233
|
return _bgInstallPromise;
|
|
606069
606234
|
}
|
|
606070
|
-
return
|
|
606235
|
+
return Boolean(await loadManagedTranscribeCli()) && await ensureVenvForTranscribeCli();
|
|
606071
606236
|
}
|
|
606072
606237
|
function getListenEngine(config) {
|
|
606073
606238
|
if (!_engine) {
|
|
@@ -606075,12 +606240,13 @@ function getListenEngine(config) {
|
|
|
606075
606240
|
}
|
|
606076
606241
|
return _engine;
|
|
606077
606242
|
}
|
|
606078
|
-
var AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _engine;
|
|
606243
|
+
var MANAGED_TRANSCRIBE_CLI_DIR2, AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _managedTranscribeCliInstallPromise, _engine;
|
|
606079
606244
|
var init_listen = __esm({
|
|
606080
606245
|
"packages/cli/src/tui/listen.ts"() {
|
|
606081
606246
|
"use strict";
|
|
606082
606247
|
init_typed_node_events();
|
|
606083
606248
|
init_async_process();
|
|
606249
|
+
MANAGED_TRANSCRIBE_CLI_DIR2 = join127(homedir39(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
606084
606250
|
AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
606085
606251
|
".mp3",
|
|
606086
606252
|
".wav",
|
|
@@ -606272,20 +606438,10 @@ var init_listen = __esm({
|
|
|
606272
606438
|
async isAvailable() {
|
|
606273
606439
|
if (this.transcribeCliAvailable !== null)
|
|
606274
606440
|
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
|
-
}
|
|
606441
|
+
const tc = await this.loadTranscribeCli() || (await ensureManagedTranscribeCliNode() ? await this.loadTranscribeCli() : null);
|
|
606442
|
+
const transcribeCliReady = Boolean(tc && await ensureVenvForTranscribeCli());
|
|
606443
|
+
const whisperFallbackReady = Boolean(await findLiveWhisperScript());
|
|
606444
|
+
this.transcribeCliAvailable = transcribeCliReady || whisperFallbackReady;
|
|
606289
606445
|
return this.transcribeCliAvailable;
|
|
606290
606446
|
}
|
|
606291
606447
|
/** Load transcribe-cli — bundled as a dependency of omnius. */
|
|
@@ -606296,13 +606452,14 @@ var init_listen = __esm({
|
|
|
606296
606452
|
return req3("transcribe-cli");
|
|
606297
606453
|
} catch {
|
|
606298
606454
|
}
|
|
606455
|
+
const managed = await loadManagedTranscribeCli();
|
|
606456
|
+
if (managed) return managed;
|
|
606299
606457
|
try {
|
|
606300
606458
|
const globalRoot = (await execFileText4("npm", ["root", "-g"], { timeout: 5e3 })).trim();
|
|
606301
606459
|
const tcPath = join127(globalRoot, "transcribe-cli");
|
|
606302
606460
|
if (existsSync111(join127(tcPath, "dist", "index.js"))) {
|
|
606303
|
-
const
|
|
606304
|
-
|
|
606305
|
-
return req3(join127(tcPath, "dist", "index.js"));
|
|
606461
|
+
const loaded = await requireTranscribeCliFrom2(tcPath);
|
|
606462
|
+
if (loaded) return loaded;
|
|
606306
606463
|
}
|
|
606307
606464
|
} catch {
|
|
606308
606465
|
}
|
|
@@ -606319,9 +606476,8 @@ var init_listen = __esm({
|
|
|
606319
606476
|
"transcribe-cli"
|
|
606320
606477
|
);
|
|
606321
606478
|
if (existsSync111(join127(tcPath, "dist", "index.js"))) {
|
|
606322
|
-
const
|
|
606323
|
-
|
|
606324
|
-
return req3(join127(tcPath, "dist", "index.js"));
|
|
606479
|
+
const loaded = await requireTranscribeCliFrom2(tcPath);
|
|
606480
|
+
if (loaded) return loaded;
|
|
606325
606481
|
}
|
|
606326
606482
|
}
|
|
606327
606483
|
} catch {
|
|
@@ -606348,7 +606504,7 @@ var init_listen = __esm({
|
|
|
606348
606504
|
}
|
|
606349
606505
|
if (!tc) {
|
|
606350
606506
|
try {
|
|
606351
|
-
await
|
|
606507
|
+
await ensureManagedTranscribeCliNode();
|
|
606352
606508
|
this.transcribeCliAvailable = null;
|
|
606353
606509
|
tc = await this.loadTranscribeCli();
|
|
606354
606510
|
} catch {
|
|
@@ -606385,7 +606541,7 @@ var init_listen = __esm({
|
|
|
606385
606541
|
}
|
|
606386
606542
|
if (!tcUpToDate) {
|
|
606387
606543
|
try {
|
|
606388
|
-
await
|
|
606544
|
+
await ensureManagedTranscribeCliNode();
|
|
606389
606545
|
this.transcribeCliAvailable = null;
|
|
606390
606546
|
const reloaded = await this.loadTranscribeCli();
|
|
606391
606547
|
if (reloaded?.TranscribeLive) {
|
|
@@ -606650,7 +606806,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606650
606806
|
}
|
|
606651
606807
|
if (!tc) {
|
|
606652
606808
|
try {
|
|
606653
|
-
await
|
|
606809
|
+
await ensureManagedTranscribeCliNode();
|
|
606654
606810
|
this.transcribeCliAvailable = null;
|
|
606655
606811
|
tc = await this.loadTranscribeCli();
|
|
606656
606812
|
} catch {
|
|
@@ -606709,7 +606865,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606709
606865
|
}
|
|
606710
606866
|
if (!tc) {
|
|
606711
606867
|
try {
|
|
606712
|
-
await
|
|
606868
|
+
await ensureManagedTranscribeCliNode();
|
|
606713
606869
|
this.transcribeCliAvailable = null;
|
|
606714
606870
|
tc = await this.loadTranscribeCli();
|
|
606715
606871
|
} catch {
|
|
@@ -606787,6 +606943,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
606787
606943
|
}
|
|
606788
606944
|
};
|
|
606789
606945
|
_bgInstallPromise = null;
|
|
606946
|
+
_managedTranscribeCliInstallPromise = null;
|
|
606790
606947
|
_engine = null;
|
|
606791
606948
|
}
|
|
606792
606949
|
});
|
|
@@ -613055,7 +613212,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
|
|
|
613055
613212
|
async function fetchPeerModels(peerId, authKey) {
|
|
613056
613213
|
try {
|
|
613057
613214
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
613058
|
-
const { existsSync: existsSync169, readFileSync:
|
|
613215
|
+
const { existsSync: existsSync169, readFileSync: readFileSync138 } = await import("node:fs");
|
|
613059
613216
|
const { join: join186 } = await import("node:path");
|
|
613060
613217
|
const cwd4 = process.cwd();
|
|
613061
613218
|
const nexusTool = new NexusTool2(cwd4);
|
|
@@ -613064,7 +613221,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613064
613221
|
try {
|
|
613065
613222
|
const statusPath = join186(nexusDir, "status.json");
|
|
613066
613223
|
if (existsSync169(statusPath)) {
|
|
613067
|
-
const status = JSON.parse(
|
|
613224
|
+
const status = JSON.parse(readFileSync138(statusPath, "utf8"));
|
|
613068
613225
|
if (status.peerId === peerId) isLocalPeer = true;
|
|
613069
613226
|
}
|
|
613070
613227
|
} catch {
|
|
@@ -613073,7 +613230,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613073
613230
|
const pricingPath = join186(nexusDir, "pricing.json");
|
|
613074
613231
|
if (existsSync169(pricingPath)) {
|
|
613075
613232
|
try {
|
|
613076
|
-
const pricing = JSON.parse(
|
|
613233
|
+
const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
|
|
613077
613234
|
const localModels = (pricing.models || []).map((m2) => ({
|
|
613078
613235
|
name: m2.model || "unknown",
|
|
613079
613236
|
size: m2.parameterSize || "",
|
|
@@ -613089,7 +613246,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613089
613246
|
const cachePath2 = join186(nexusDir, "peer-models-cache.json");
|
|
613090
613247
|
if (existsSync169(cachePath2)) {
|
|
613091
613248
|
try {
|
|
613092
|
-
const cache8 = JSON.parse(
|
|
613249
|
+
const cache8 = JSON.parse(readFileSync138(cachePath2, "utf8"));
|
|
613093
613250
|
if (cache8.peerId === peerId && cache8.models?.length > 0) {
|
|
613094
613251
|
const age = Date.now() - new Date(cache8.cachedAt).getTime();
|
|
613095
613252
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -613204,7 +613361,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
613204
613361
|
const pricingPath = join186(nexusDir, "pricing.json");
|
|
613205
613362
|
if (existsSync169(pricingPath)) {
|
|
613206
613363
|
try {
|
|
613207
|
-
const pricing = JSON.parse(
|
|
613364
|
+
const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
|
|
613208
613365
|
return (pricing.models || []).map((m2) => ({
|
|
613209
613366
|
name: m2.model || "unknown",
|
|
613210
613367
|
size: m2.parameterSize || "",
|
|
@@ -616742,7 +616899,7 @@ var init_voice_session = __esm({
|
|
|
616742
616899
|
|
|
616743
616900
|
// packages/cli/src/tui/scoped-personality.ts
|
|
616744
616901
|
import { createHash as createHash32 } from "node:crypto";
|
|
616745
|
-
import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as
|
|
616902
|
+
import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as readFileSync91, writeFileSync as writeFileSync59 } from "node:fs";
|
|
616746
616903
|
import { join as join128, resolve as resolve55 } from "node:path";
|
|
616747
616904
|
function safeName(input) {
|
|
616748
616905
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
@@ -616897,7 +617054,7 @@ function loadScopedPersonality(scope) {
|
|
|
616897
617054
|
const paths = scopedPersonalityPaths(scope);
|
|
616898
617055
|
if (!existsSync112(paths.json)) return newDocument(scope);
|
|
616899
617056
|
try {
|
|
616900
|
-
const parsed = JSON.parse(
|
|
617057
|
+
const parsed = JSON.parse(readFileSync91(paths.json, "utf8"));
|
|
616901
617058
|
if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
|
|
616902
617059
|
return normalizeDocument(scope, parsed);
|
|
616903
617060
|
} catch {
|
|
@@ -617121,7 +617278,7 @@ var init_scoped_personality = __esm({
|
|
|
617121
617278
|
|
|
617122
617279
|
// packages/cli/src/tui/voice-soul.ts
|
|
617123
617280
|
import { createHash as createHash33 } from "node:crypto";
|
|
617124
|
-
import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as
|
|
617281
|
+
import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as readFileSync92 } from "node:fs";
|
|
617125
617282
|
import { basename as basename24, join as join129, resolve as resolve56 } from "node:path";
|
|
617126
617283
|
function compactText(text2, limit) {
|
|
617127
617284
|
const compact4 = text2.replace(/\s+/g, " ").trim();
|
|
@@ -617148,7 +617305,7 @@ function loadSoulRuntimeState(input) {
|
|
|
617148
617305
|
const path12 = soulRuntimeStatePath(input);
|
|
617149
617306
|
if (!existsSync113(path12)) return { version: 1 };
|
|
617150
617307
|
try {
|
|
617151
|
-
const parsed = JSON.parse(
|
|
617308
|
+
const parsed = JSON.parse(readFileSync92(path12, "utf8"));
|
|
617152
617309
|
if (!parsed || parsed.version !== 1) return { version: 1 };
|
|
617153
617310
|
return {
|
|
617154
617311
|
version: 1,
|
|
@@ -617266,7 +617423,7 @@ function findProjectSoul(scope) {
|
|
|
617266
617423
|
]) {
|
|
617267
617424
|
if (!existsSync113(candidate)) continue;
|
|
617268
617425
|
try {
|
|
617269
|
-
return { path: candidate, content:
|
|
617426
|
+
return { path: candidate, content: readFileSync92(candidate, "utf8") };
|
|
617270
617427
|
} catch {
|
|
617271
617428
|
return null;
|
|
617272
617429
|
}
|
|
@@ -617285,7 +617442,7 @@ function findProjectVoice(scope) {
|
|
|
617285
617442
|
const first2 = files[0];
|
|
617286
617443
|
if (!first2) return null;
|
|
617287
617444
|
const path12 = join129(voiceDir3, first2);
|
|
617288
|
-
return { path: path12, content:
|
|
617445
|
+
return { path: path12, content: readFileSync92(path12, "utf8") };
|
|
617289
617446
|
} catch {
|
|
617290
617447
|
return null;
|
|
617291
617448
|
}
|
|
@@ -617550,7 +617707,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
|
|
|
617550
617707
|
import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
|
|
617551
617708
|
import { URL as URL2 } from "node:url";
|
|
617552
617709
|
import { loadavg, cpus as cpus3, totalmem as totalmem6, freemem as freemem4 } from "node:os";
|
|
617553
|
-
import { existsSync as existsSync114, readFileSync as
|
|
617710
|
+
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
617711
|
import { join as join130 } from "node:path";
|
|
617555
617712
|
function cleanForwardHeaders(raw, targetHost) {
|
|
617556
617713
|
const out = {};
|
|
@@ -617721,7 +617878,7 @@ function readSponsorUsageState(stateDir) {
|
|
|
617721
617878
|
try {
|
|
617722
617879
|
const path12 = join130(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
|
|
617723
617880
|
if (!existsSync114(path12)) return null;
|
|
617724
|
-
const parsed = JSON.parse(
|
|
617881
|
+
const parsed = JSON.parse(readFileSync93(path12, "utf8"));
|
|
617725
617882
|
const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
|
|
617726
617883
|
const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
|
|
617727
617884
|
if (!dailyTokensResetAt) return null;
|
|
@@ -617746,7 +617903,7 @@ function readExposeState(stateDir) {
|
|
|
617746
617903
|
try {
|
|
617747
617904
|
const path12 = join130(stateDir, STATE_FILE_NAME);
|
|
617748
617905
|
if (!existsSync114(path12)) return null;
|
|
617749
|
-
const raw =
|
|
617906
|
+
const raw = readFileSync93(path12, "utf8");
|
|
617750
617907
|
const data = JSON.parse(raw);
|
|
617751
617908
|
if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
|
|
617752
617909
|
return data;
|
|
@@ -617884,7 +618041,7 @@ function readP2PExposeState(stateDir) {
|
|
|
617884
618041
|
try {
|
|
617885
618042
|
const path12 = join130(stateDir, P2P_STATE_FILE_NAME);
|
|
617886
618043
|
if (!existsSync114(path12)) return null;
|
|
617887
|
-
const raw =
|
|
618044
|
+
const raw = readFileSync93(path12, "utf8");
|
|
617888
618045
|
const data = JSON.parse(raw);
|
|
617889
618046
|
if (!data.peerId || !data.authKey) return null;
|
|
617890
618047
|
return data;
|
|
@@ -619288,7 +619445,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619288
619445
|
const statusPath = join130(nexusDir, "status.json");
|
|
619289
619446
|
for (let i2 = 0; i2 < 80; i2++) {
|
|
619290
619447
|
try {
|
|
619291
|
-
const raw =
|
|
619448
|
+
const raw = readFileSync93(statusPath, "utf8");
|
|
619292
619449
|
if (raw.length > 10) {
|
|
619293
619450
|
const status = JSON.parse(raw);
|
|
619294
619451
|
if (status.connected && status.peerId) {
|
|
@@ -619353,7 +619510,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619353
619510
|
removeP2PExposeState(stateDir);
|
|
619354
619511
|
return null;
|
|
619355
619512
|
}
|
|
619356
|
-
const status = JSON.parse(
|
|
619513
|
+
const status = JSON.parse(readFileSync93(statusPath, "utf8"));
|
|
619357
619514
|
if (!status.connected || !status.peerId) {
|
|
619358
619515
|
removeP2PExposeState(stateDir);
|
|
619359
619516
|
return null;
|
|
@@ -619431,7 +619588,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619431
619588
|
let meteringLines = lastMeteringLineCount;
|
|
619432
619589
|
try {
|
|
619433
619590
|
if (existsSync114(meteringFile)) {
|
|
619434
|
-
const content =
|
|
619591
|
+
const content = readFileSync93(meteringFile, "utf8");
|
|
619435
619592
|
meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
|
|
619436
619593
|
}
|
|
619437
619594
|
} catch {
|
|
@@ -619460,7 +619617,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619460
619617
|
try {
|
|
619461
619618
|
const statusPath = join130(nexusDir, "status.json");
|
|
619462
619619
|
if (existsSync114(statusPath)) {
|
|
619463
|
-
const status = JSON.parse(
|
|
619620
|
+
const status = JSON.parse(readFileSync93(statusPath, "utf8"));
|
|
619464
619621
|
if (status.peerId && !this._peerId) {
|
|
619465
619622
|
this._peerId = status.peerId;
|
|
619466
619623
|
}
|
|
@@ -619483,7 +619640,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
619483
619640
|
try {
|
|
619484
619641
|
const meteringFile = join130(nexusDir, "metering.jsonl");
|
|
619485
619642
|
if (existsSync114(meteringFile)) {
|
|
619486
|
-
const content =
|
|
619643
|
+
const content = readFileSync93(meteringFile, "utf8");
|
|
619487
619644
|
if (content.length > lastMeteringSize) {
|
|
619488
619645
|
const newContent = content.slice(lastMeteringSize);
|
|
619489
619646
|
lastMeteringSize = content.length;
|
|
@@ -619780,7 +619937,7 @@ var init_types3 = __esm({
|
|
|
619780
619937
|
|
|
619781
619938
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
619782
619939
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
|
|
619783
|
-
import { readFileSync as
|
|
619940
|
+
import { readFileSync as readFileSync94, writeFileSync as writeFileSync61, existsSync as existsSync115, mkdirSync as mkdirSync72 } from "node:fs";
|
|
619784
619941
|
import { dirname as dirname39 } from "node:path";
|
|
619785
619942
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
619786
619943
|
var init_secret_vault = __esm({
|
|
@@ -619998,7 +620155,7 @@ var init_secret_vault = __esm({
|
|
|
619998
620155
|
*/
|
|
619999
620156
|
load(passphrase) {
|
|
620000
620157
|
if (!this.storePath || !existsSync115(this.storePath)) return 0;
|
|
620001
|
-
const blob =
|
|
620158
|
+
const blob = readFileSync94(this.storePath);
|
|
620002
620159
|
if (blob.length < SALT_LEN + IV_LEN + 16) {
|
|
620003
620160
|
throw new Error("Vault file is corrupted (too small)");
|
|
620004
620161
|
}
|
|
@@ -621036,7 +621193,7 @@ ${activitySummary}
|
|
|
621036
621193
|
});
|
|
621037
621194
|
|
|
621038
621195
|
// packages/cli/src/api/profiles.ts
|
|
621039
|
-
import { existsSync as existsSync116, readFileSync as
|
|
621196
|
+
import { existsSync as existsSync116, readFileSync as readFileSync95, writeFileSync as writeFileSync62, mkdirSync as mkdirSync73, readdirSync as readdirSync39, unlinkSync as unlinkSync21 } from "node:fs";
|
|
621040
621197
|
import { join as join132 } from "node:path";
|
|
621041
621198
|
import { homedir as homedir40 } from "node:os";
|
|
621042
621199
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -621056,7 +621213,7 @@ function listProfiles(projectDir2) {
|
|
|
621056
621213
|
if (existsSync116(projDir)) {
|
|
621057
621214
|
for (const f2 of readdirSync39(projDir).filter((f3) => f3.endsWith(".json"))) {
|
|
621058
621215
|
try {
|
|
621059
|
-
const raw = JSON.parse(
|
|
621216
|
+
const raw = JSON.parse(readFileSync95(join132(projDir, f2), "utf8"));
|
|
621060
621217
|
const name10 = f2.replace(".json", "");
|
|
621061
621218
|
seen.add(name10);
|
|
621062
621219
|
result.push({
|
|
@@ -621075,7 +621232,7 @@ function listProfiles(projectDir2) {
|
|
|
621075
621232
|
const name10 = f2.replace(".json", "");
|
|
621076
621233
|
if (seen.has(name10)) continue;
|
|
621077
621234
|
try {
|
|
621078
|
-
const raw = JSON.parse(
|
|
621235
|
+
const raw = JSON.parse(readFileSync95(join132(globDir, f2), "utf8"));
|
|
621079
621236
|
result.push({
|
|
621080
621237
|
name: name10,
|
|
621081
621238
|
description: raw.description || "",
|
|
@@ -621111,7 +621268,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
|
|
|
621111
621268
|
];
|
|
621112
621269
|
for (const candidate of candidates) {
|
|
621113
621270
|
if (!existsSync116(candidate.path)) continue;
|
|
621114
|
-
const raw = JSON.parse(
|
|
621271
|
+
const raw = JSON.parse(readFileSync95(candidate.path, "utf8"));
|
|
621115
621272
|
if (raw.encrypted === true) {
|
|
621116
621273
|
if (!password) return null;
|
|
621117
621274
|
const profile = decryptProfile(raw, password);
|
|
@@ -621418,7 +621575,7 @@ __export(omnius_directory_exports, {
|
|
|
621418
621575
|
writeIndexMeta: () => writeIndexMeta,
|
|
621419
621576
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
621420
621577
|
});
|
|
621421
|
-
import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync117, mkdirSync as mkdirSync74, readFileSync as
|
|
621578
|
+
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
621579
|
import { join as join133, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
|
|
621423
621580
|
import { homedir as homedir41 } from "node:os";
|
|
621424
621581
|
import { createHash as createHash37 } from "node:crypto";
|
|
@@ -621428,7 +621585,7 @@ function isGitRoot(dir) {
|
|
|
621428
621585
|
try {
|
|
621429
621586
|
const stat9 = statSync44(gitPath);
|
|
621430
621587
|
if (stat9.isFile()) {
|
|
621431
|
-
return
|
|
621588
|
+
return readFileSync96(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
621432
621589
|
}
|
|
621433
621590
|
if (!stat9.isDirectory()) return false;
|
|
621434
621591
|
return existsSync117(join133(gitPath, "HEAD")) || existsSync117(join133(gitPath, "config")) || existsSync117(join133(gitPath, "commondir"));
|
|
@@ -621487,7 +621644,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
621487
621644
|
const gitignoreDir = dirname40(gitignorePath);
|
|
621488
621645
|
const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
621489
621646
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
621490
|
-
const content =
|
|
621647
|
+
const content = readFileSync96(gitignorePath, "utf-8");
|
|
621491
621648
|
const normalizedTarget = normalizeIgnoreRule(ignorePattern);
|
|
621492
621649
|
const alreadyIgnored = content.split(/\r?\n/).some((line) => {
|
|
621493
621650
|
const trimmed = line.trim();
|
|
@@ -621610,7 +621767,7 @@ function loadProjectSettings(repoRoot) {
|
|
|
621610
621767
|
const settingsPath = join133(repoRoot, OMNIUS_DIR, "settings.json");
|
|
621611
621768
|
try {
|
|
621612
621769
|
if (existsSync117(settingsPath)) {
|
|
621613
|
-
return JSON.parse(
|
|
621770
|
+
return JSON.parse(readFileSync96(settingsPath, "utf-8"));
|
|
621614
621771
|
}
|
|
621615
621772
|
} catch {
|
|
621616
621773
|
}
|
|
@@ -621627,7 +621784,7 @@ function loadGlobalSettings() {
|
|
|
621627
621784
|
const settingsPath = join133(homedir41(), ".omnius", "settings.json");
|
|
621628
621785
|
try {
|
|
621629
621786
|
if (existsSync117(settingsPath)) {
|
|
621630
|
-
return JSON.parse(
|
|
621787
|
+
return JSON.parse(readFileSync96(settingsPath, "utf-8"));
|
|
621631
621788
|
}
|
|
621632
621789
|
} catch {
|
|
621633
621790
|
}
|
|
@@ -621658,7 +621815,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
621658
621815
|
if (existsSync117(filePath) && !seen.has(filePath)) {
|
|
621659
621816
|
seen.add(filePath);
|
|
621660
621817
|
try {
|
|
621661
|
-
let content =
|
|
621818
|
+
let content = readFileSync96(filePath, "utf-8");
|
|
621662
621819
|
if (content.length > maxContentLen) {
|
|
621663
621820
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
621664
621821
|
}
|
|
@@ -621691,7 +621848,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
621691
621848
|
function readIndexMeta(repoRoot) {
|
|
621692
621849
|
const metaPath = join133(repoRoot, OMNIUS_DIR, "index", "meta.json");
|
|
621693
621850
|
try {
|
|
621694
|
-
return JSON.parse(
|
|
621851
|
+
return JSON.parse(readFileSync96(metaPath, "utf-8"));
|
|
621695
621852
|
} catch {
|
|
621696
621853
|
return null;
|
|
621697
621854
|
}
|
|
@@ -621704,7 +621861,7 @@ function writeIndexMeta(repoRoot, meta) {
|
|
|
621704
621861
|
function readIndexData(repoRoot, filename) {
|
|
621705
621862
|
const filePath = join133(repoRoot, OMNIUS_DIR, "index", filename);
|
|
621706
621863
|
try {
|
|
621707
|
-
return JSON.parse(
|
|
621864
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621708
621865
|
} catch {
|
|
621709
621866
|
return null;
|
|
621710
621867
|
}
|
|
@@ -621783,7 +621940,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
621783
621940
|
}).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
|
|
621784
621941
|
return files.map((f2) => {
|
|
621785
621942
|
try {
|
|
621786
|
-
return JSON.parse(
|
|
621943
|
+
return JSON.parse(readFileSync96(join133(historyDir, f2.file), "utf-8"));
|
|
621787
621944
|
} catch {
|
|
621788
621945
|
return null;
|
|
621789
621946
|
}
|
|
@@ -621807,7 +621964,7 @@ function loadPendingTask(repoRoot) {
|
|
|
621807
621964
|
const filePath = join133(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
|
|
621808
621965
|
try {
|
|
621809
621966
|
if (!existsSync117(filePath)) return null;
|
|
621810
|
-
const data = JSON.parse(
|
|
621967
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621811
621968
|
try {
|
|
621812
621969
|
unlinkSync22(filePath);
|
|
621813
621970
|
} catch {
|
|
@@ -621837,7 +621994,7 @@ function readTaskHandoff2(repoRoot) {
|
|
|
621837
621994
|
const filePath = join133(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
|
|
621838
621995
|
try {
|
|
621839
621996
|
if (!existsSync117(filePath)) return null;
|
|
621840
|
-
const data = JSON.parse(
|
|
621997
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
621841
621998
|
const handoffTime = new Date(data.handoffAt).getTime();
|
|
621842
621999
|
const now2 = Date.now();
|
|
621843
622000
|
const ageMs = now2 - handoffTime;
|
|
@@ -621923,7 +622080,7 @@ function acquireLock(lockPath) {
|
|
|
621923
622080
|
} catch (err) {
|
|
621924
622081
|
if (existsSync117(lockPath)) {
|
|
621925
622082
|
try {
|
|
621926
|
-
const lockContent =
|
|
622083
|
+
const lockContent = readFileSync96(lockPath, "utf-8");
|
|
621927
622084
|
const lock = JSON.parse(lockContent);
|
|
621928
622085
|
const lockAge = Date.now() - lock.acquiredAt;
|
|
621929
622086
|
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
@@ -621949,7 +622106,7 @@ function acquireLock(lockPath) {
|
|
|
621949
622106
|
function releaseLock(lockPath) {
|
|
621950
622107
|
try {
|
|
621951
622108
|
if (existsSync117(lockPath)) {
|
|
621952
|
-
const lockContent =
|
|
622109
|
+
const lockContent = readFileSync96(lockPath, "utf-8");
|
|
621953
622110
|
const lock = JSON.parse(lockContent);
|
|
621954
622111
|
if (lock.pid === process.pid) {
|
|
621955
622112
|
unlinkSync22(lockPath);
|
|
@@ -622041,7 +622198,7 @@ function pruneContextLedger(ledgerPath) {
|
|
|
622041
622198
|
if (!existsSync117(ledgerPath)) return;
|
|
622042
622199
|
const st = statSync44(ledgerPath);
|
|
622043
622200
|
if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
|
|
622044
|
-
const lines =
|
|
622201
|
+
const lines = readFileSync96(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
622045
622202
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
622046
622203
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
622047
622204
|
const archiveDir = join133(dirname40(ledgerPath), "archive");
|
|
@@ -622069,7 +622226,7 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
622069
622226
|
let ctx3;
|
|
622070
622227
|
try {
|
|
622071
622228
|
if (existsSync117(filePath)) {
|
|
622072
|
-
ctx3 = JSON.parse(
|
|
622229
|
+
ctx3 = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622073
622230
|
} else {
|
|
622074
622231
|
ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
|
|
622075
622232
|
}
|
|
@@ -622231,7 +622388,7 @@ function loadSessionContext(repoRoot) {
|
|
|
622231
622388
|
const filePath = join133(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
|
|
622232
622389
|
try {
|
|
622233
622390
|
if (!existsSync117(filePath)) return null;
|
|
622234
|
-
return JSON.parse(
|
|
622391
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622235
622392
|
} catch {
|
|
622236
622393
|
return null;
|
|
622237
622394
|
}
|
|
@@ -622239,7 +622396,7 @@ function loadSessionContext(repoRoot) {
|
|
|
622239
622396
|
function readJsonOrNull(filePath) {
|
|
622240
622397
|
try {
|
|
622241
622398
|
if (!existsSync117(filePath)) return null;
|
|
622242
|
-
return JSON.parse(
|
|
622399
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622243
622400
|
} catch {
|
|
622244
622401
|
return null;
|
|
622245
622402
|
}
|
|
@@ -622450,7 +622607,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
|
|
|
622450
622607
|
const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
622451
622608
|
try {
|
|
622452
622609
|
if (!existsSync117(indexPath)) return false;
|
|
622453
|
-
const index = JSON.parse(
|
|
622610
|
+
const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622454
622611
|
const idx = index.findIndex((e2) => e2.id === sessionId);
|
|
622455
622612
|
if (idx < 0) return false;
|
|
622456
622613
|
index[idx] = { ...index[idx], ...patch };
|
|
@@ -622499,7 +622656,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
|
|
|
622499
622656
|
let index = [];
|
|
622500
622657
|
try {
|
|
622501
622658
|
if (existsSync117(indexPath)) {
|
|
622502
|
-
index = JSON.parse(
|
|
622659
|
+
index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622503
622660
|
}
|
|
622504
622661
|
} catch {
|
|
622505
622662
|
}
|
|
@@ -622531,7 +622688,7 @@ function listSessions(repoRoot) {
|
|
|
622531
622688
|
const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
622532
622689
|
try {
|
|
622533
622690
|
if (!existsSync117(indexPath)) return [];
|
|
622534
|
-
const index = JSON.parse(
|
|
622691
|
+
const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622535
622692
|
return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
|
|
622536
622693
|
} catch {
|
|
622537
622694
|
return [];
|
|
@@ -622541,7 +622698,7 @@ function loadSessionHistory(repoRoot, sessionId) {
|
|
|
622541
622698
|
const contentPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
622542
622699
|
try {
|
|
622543
622700
|
if (!existsSync117(contentPath)) return null;
|
|
622544
|
-
return
|
|
622701
|
+
return readFileSync96(contentPath, "utf-8").split("\n");
|
|
622545
622702
|
} catch {
|
|
622546
622703
|
return null;
|
|
622547
622704
|
}
|
|
@@ -622553,7 +622710,7 @@ function deleteSession(repoRoot, sessionId) {
|
|
|
622553
622710
|
const contentPath = join133(sessDir, `${sessionId}.jsonl`);
|
|
622554
622711
|
if (existsSync117(contentPath)) unlinkSync22(contentPath);
|
|
622555
622712
|
if (existsSync117(indexPath)) {
|
|
622556
|
-
let index = JSON.parse(
|
|
622713
|
+
let index = JSON.parse(readFileSync96(indexPath, "utf-8"));
|
|
622557
622714
|
index = index.filter((s2) => s2.id !== sessionId);
|
|
622558
622715
|
writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
|
|
622559
622716
|
}
|
|
@@ -622610,7 +622767,7 @@ function detectManifests(repoRoot) {
|
|
|
622610
622767
|
let name10;
|
|
622611
622768
|
if (check.nameField) {
|
|
622612
622769
|
try {
|
|
622613
|
-
const data = JSON.parse(
|
|
622770
|
+
const data = JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622614
622771
|
name10 = data[check.nameField];
|
|
622615
622772
|
} catch {
|
|
622616
622773
|
}
|
|
@@ -622681,7 +622838,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
622681
622838
|
function loadUsageFile(filePath) {
|
|
622682
622839
|
try {
|
|
622683
622840
|
if (existsSync117(filePath)) {
|
|
622684
|
-
return JSON.parse(
|
|
622841
|
+
return JSON.parse(readFileSync96(filePath, "utf-8"));
|
|
622685
622842
|
}
|
|
622686
622843
|
} catch {
|
|
622687
622844
|
}
|
|
@@ -623008,7 +623165,7 @@ var init_session_summary = __esm({
|
|
|
623008
623165
|
|
|
623009
623166
|
// packages/cli/src/tui/cad-model-viewer.ts
|
|
623010
623167
|
import { createServer as createServer7 } from "node:http";
|
|
623011
|
-
import { existsSync as existsSync118, readFileSync as
|
|
623168
|
+
import { existsSync as existsSync118, readFileSync as readFileSync97, statSync as statSync45 } from "node:fs";
|
|
623012
623169
|
import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
|
|
623013
623170
|
function getCurrentCadModelViewer() {
|
|
623014
623171
|
return currentViewer;
|
|
@@ -623068,7 +623225,7 @@ function handleViewerRequest(req3, res, filePath) {
|
|
|
623068
623225
|
"Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
|
|
623069
623226
|
"Cache-Control": "no-store"
|
|
623070
623227
|
});
|
|
623071
|
-
res.end(
|
|
623228
|
+
res.end(readFileSync97(filePath));
|
|
623072
623229
|
} catch (err) {
|
|
623073
623230
|
sendText(res, 500, err instanceof Error ? err.message : String(err));
|
|
623074
623231
|
}
|
|
@@ -623472,7 +623629,7 @@ var init_render2 = __esm({
|
|
|
623472
623629
|
});
|
|
623473
623630
|
|
|
623474
623631
|
// packages/prompts/dist/promptLoader.js
|
|
623475
|
-
import { readFileSync as
|
|
623632
|
+
import { readFileSync as readFileSync99, existsSync as existsSync120 } from "node:fs";
|
|
623476
623633
|
import { join as join135, dirname as dirname41 } from "node:path";
|
|
623477
623634
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
623478
623635
|
function loadPrompt2(promptPath, vars) {
|
|
@@ -623482,7 +623639,7 @@ function loadPrompt2(promptPath, vars) {
|
|
|
623482
623639
|
if (!existsSync120(fullPath)) {
|
|
623483
623640
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
623484
623641
|
}
|
|
623485
|
-
content =
|
|
623642
|
+
content = readFileSync99(fullPath, "utf-8");
|
|
623486
623643
|
cache6.set(promptPath, content);
|
|
623487
623644
|
}
|
|
623488
623645
|
if (!vars)
|
|
@@ -624579,7 +624736,7 @@ __export(tui_tasks_renderer_exports, {
|
|
|
624579
624736
|
setTuiTasksSession: () => setTuiTasksSession,
|
|
624580
624737
|
teardownTuiTasks: () => teardownTuiTasks
|
|
624581
624738
|
});
|
|
624582
|
-
import { existsSync as existsSync121, readFileSync as
|
|
624739
|
+
import { existsSync as existsSync121, readFileSync as readFileSync100, watch as fsWatch3 } from "node:fs";
|
|
624583
624740
|
import { join as join137 } from "node:path";
|
|
624584
624741
|
import { homedir as homedir43 } from "node:os";
|
|
624585
624742
|
function setTasksRendererWriter(writer) {
|
|
@@ -624706,7 +624863,7 @@ function loadTodos() {
|
|
|
624706
624863
|
_lastTodos = [];
|
|
624707
624864
|
return;
|
|
624708
624865
|
}
|
|
624709
|
-
const parsed = JSON.parse(
|
|
624866
|
+
const parsed = JSON.parse(readFileSync100(fp, "utf-8"));
|
|
624710
624867
|
_lastTodos = Array.isArray(parsed) ? parsed : [];
|
|
624711
624868
|
} catch {
|
|
624712
624869
|
_lastTodos = [];
|
|
@@ -630551,7 +630708,7 @@ __export(personaplex_exports, {
|
|
|
630551
630708
|
startPersonaPlexDaemon: () => startPersonaPlexDaemon,
|
|
630552
630709
|
stopPersonaPlex: () => stopPersonaPlex
|
|
630553
630710
|
});
|
|
630554
|
-
import { existsSync as existsSync122, writeFileSync as writeFileSync65, readFileSync as
|
|
630711
|
+
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
630712
|
import { join as join138, dirname as dirname43 } from "node:path";
|
|
630556
630713
|
import { homedir as homedir44 } from "node:os";
|
|
630557
630714
|
import { spawn as spawn32 } from "node:child_process";
|
|
@@ -630590,9 +630747,9 @@ function selectWeightTier(vramGB) {
|
|
|
630590
630747
|
}
|
|
630591
630748
|
function detectJetson() {
|
|
630592
630749
|
try {
|
|
630593
|
-
const model =
|
|
630750
|
+
const model = readFileSync101("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
|
|
630594
630751
|
if (/jetson|orin|tegra/i.test(model)) {
|
|
630595
|
-
const memInfo =
|
|
630752
|
+
const memInfo = readFileSync101("/proc/meminfo", "utf8");
|
|
630596
630753
|
const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
|
|
630597
630754
|
return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
|
|
630598
630755
|
}
|
|
@@ -630667,7 +630824,7 @@ function fileLink2(filePath, label) {
|
|
|
630667
630824
|
}
|
|
630668
630825
|
async function isPersonaPlexRunning() {
|
|
630669
630826
|
if (!existsSync122(PID_FILE)) return false;
|
|
630670
|
-
const pid = parseInt(
|
|
630827
|
+
const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
|
|
630671
630828
|
if (isNaN(pid) || pid <= 0) return false;
|
|
630672
630829
|
try {
|
|
630673
630830
|
process.kill(pid, 0);
|
|
@@ -630679,7 +630836,7 @@ async function isPersonaPlexRunning() {
|
|
|
630679
630836
|
async function getPersonaPlexWSUrl() {
|
|
630680
630837
|
if (!await isPersonaPlexRunning()) return null;
|
|
630681
630838
|
if (!existsSync122(PORT_FILE)) return null;
|
|
630682
|
-
const port = parseInt(
|
|
630839
|
+
const port = parseInt(readFileSync101(PORT_FILE, "utf8").trim(), 10);
|
|
630683
630840
|
return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
|
|
630684
630841
|
}
|
|
630685
630842
|
function isPersonaPlexInstalled() {
|
|
@@ -630689,7 +630846,7 @@ async function getWeightTier() {
|
|
|
630689
630846
|
const detected = await detectPersonaPlexCapability();
|
|
630690
630847
|
const tierFile = join138(PERSONAPLEX_DIR, "weight_tier");
|
|
630691
630848
|
if (existsSync122(tierFile)) {
|
|
630692
|
-
const saved =
|
|
630849
|
+
const saved = readFileSync101(tierFile, "utf8").trim();
|
|
630693
630850
|
if (saved in WEIGHT_REPOS) {
|
|
630694
630851
|
const vram = detected.vramGB;
|
|
630695
630852
|
if (saved === "nf4-distilled" && vram < 24) {
|
|
@@ -630819,7 +630976,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
630819
630976
|
})).trim();
|
|
630820
630977
|
const serverFile = join138(sitePackages, "server.py");
|
|
630821
630978
|
if (existsSync122(serverFile)) {
|
|
630822
|
-
let src2 =
|
|
630979
|
+
let src2 = readFileSync101(serverFile, "utf8");
|
|
630823
630980
|
if (src2.includes('int(request["seed"])')) {
|
|
630824
630981
|
src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
|
|
630825
630982
|
writeFileSync65(serverFile, src2);
|
|
@@ -630835,7 +630992,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
630835
630992
|
})).trim();
|
|
630836
630993
|
const loadersFile = join138(sitePackages, "models", "loaders.py");
|
|
630837
630994
|
if (existsSync122(loadersFile)) {
|
|
630838
|
-
let src2 =
|
|
630995
|
+
let src2 = readFileSync101(loadersFile, "utf8");
|
|
630839
630996
|
if (!src2.includes("_dequantize_2bit_state_dict")) {
|
|
630840
630997
|
const dequantPatch = `
|
|
630841
630998
|
import math
|
|
@@ -630938,28 +631095,28 @@ $2if filename.endswith(".safetensors"):`
|
|
|
630938
631095
|
})).trim();
|
|
630939
631096
|
const hybridDest = join138(sitePackages2, "hybrid_agent.py");
|
|
630940
631097
|
const serverDest = join138(sitePackages2, "server.py");
|
|
630941
|
-
if (!existsSync122(hybridDest) || !
|
|
631098
|
+
if (!existsSync122(hybridDest) || !readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
630942
631099
|
log22("Deploying hybrid_agent.py (Omnius API integration)...");
|
|
630943
631100
|
try {
|
|
630944
631101
|
await execAsync(
|
|
630945
631102
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
|
|
630946
631103
|
{ timeout: 3e4 }
|
|
630947
631104
|
);
|
|
630948
|
-
if (existsSync122(hybridDest) &&
|
|
631105
|
+
if (existsSync122(hybridDest) && readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
630949
631106
|
log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
|
|
630950
631107
|
}
|
|
630951
631108
|
} catch {
|
|
630952
631109
|
log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
|
|
630953
631110
|
}
|
|
630954
631111
|
}
|
|
630955
|
-
if (!
|
|
631112
|
+
if (!readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
|
|
630956
631113
|
log22("Deploying patched server.py (hybrid mode + API endpoints)...");
|
|
630957
631114
|
try {
|
|
630958
631115
|
await execAsync(
|
|
630959
631116
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
|
|
630960
631117
|
{ timeout: 3e4 }
|
|
630961
631118
|
);
|
|
630962
|
-
if (
|
|
631119
|
+
if (readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
|
|
630963
631120
|
log22("server.py patched with hybrid intercept + REST APIs.");
|
|
630964
631121
|
}
|
|
630965
631122
|
} catch {
|
|
@@ -631149,7 +631306,7 @@ print('Converted')
|
|
|
631149
631306
|
let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
|
|
631150
631307
|
if (!ollamaModel) {
|
|
631151
631308
|
try {
|
|
631152
|
-
const omniusConfig = JSON.parse(
|
|
631309
|
+
const omniusConfig = JSON.parse(readFileSync101(join138(homedir44(), ".omnius", "config.json"), "utf8"));
|
|
631153
631310
|
if (omniusConfig.model) ollamaModel = omniusConfig.model;
|
|
631154
631311
|
} catch {
|
|
631155
631312
|
}
|
|
@@ -631245,7 +631402,7 @@ print('Converted')
|
|
|
631245
631402
|
}
|
|
631246
631403
|
async function stopPersonaPlex() {
|
|
631247
631404
|
if (!existsSync122(PID_FILE)) return;
|
|
631248
|
-
const pid = parseInt(
|
|
631405
|
+
const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
|
|
631249
631406
|
if (isNaN(pid) || pid <= 0) return;
|
|
631250
631407
|
try {
|
|
631251
631408
|
if (process.platform === "win32") {
|
|
@@ -631442,7 +631599,7 @@ function patchFrontendVoiceList(onInfo) {
|
|
|
631442
631599
|
for (const f2 of readdirSync41(distDir)) {
|
|
631443
631600
|
if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
|
|
631444
631601
|
const jsPath = join138(distDir, f2);
|
|
631445
|
-
let js =
|
|
631602
|
+
let js = readFileSync101(jsPath, "utf8");
|
|
631446
631603
|
const customVoices = [];
|
|
631447
631604
|
if (existsSync122(CUSTOM_VOICES_DIR)) {
|
|
631448
631605
|
for (const vf of readdirSync41(CUSTOM_VOICES_DIR)) {
|
|
@@ -631562,7 +631719,7 @@ __export(setup_exports, {
|
|
|
631562
631719
|
import * as readline from "node:readline";
|
|
631563
631720
|
import { spawn as spawn33, exec as exec5 } from "node:child_process";
|
|
631564
631721
|
import { promisify as promisify7 } from "node:util";
|
|
631565
|
-
import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as
|
|
631722
|
+
import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as readFileSync102, appendFileSync as appendFileSync14, mkdirSync as mkdirSync77, chmodSync as chmodSync3 } from "node:fs";
|
|
631566
631723
|
import { delimiter as pathDelimiter, join as join139 } from "node:path";
|
|
631567
631724
|
import { freemem as freemem6, homedir as homedir45, platform as platform5, totalmem as totalmem8 } from "node:os";
|
|
631568
631725
|
function wrapText2(value2, width) {
|
|
@@ -631618,14 +631775,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
|
|
|
631618
631775
|
}
|
|
631619
631776
|
try {
|
|
631620
631777
|
if (existsSync123("/sys/devices/soc0/family")) {
|
|
631621
|
-
const family =
|
|
631778
|
+
const family = readFileSync102("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
|
|
631622
631779
|
if (family.includes("tegra")) return true;
|
|
631623
631780
|
}
|
|
631624
631781
|
} catch {
|
|
631625
631782
|
}
|
|
631626
631783
|
try {
|
|
631627
631784
|
if (existsSync123("/proc/device-tree/model")) {
|
|
631628
|
-
const model =
|
|
631785
|
+
const model = readFileSync102("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
|
|
631629
631786
|
if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
|
|
631630
631787
|
return true;
|
|
631631
631788
|
}
|
|
@@ -632779,7 +632936,7 @@ async function runOptionalDepsSetup(rl) {
|
|
|
632779
632936
|
}
|
|
632780
632937
|
const askTranscribe = await ask(rl, ` ${c3.bold("Install transcribe-cli for live transcription?")} (Y/n) `);
|
|
632781
632938
|
if (askTranscribe.toLowerCase() !== "n") {
|
|
632782
|
-
process.stdout.write(` ${c3.cyan("●")} Installing transcribe-cli
|
|
632939
|
+
process.stdout.write(` ${c3.cyan("●")} Installing managed transcribe-cli runtime...
|
|
632783
632940
|
`);
|
|
632784
632941
|
try {
|
|
632785
632942
|
const ok3 = await ensureTranscribeCliBackground();
|
|
@@ -633579,7 +633736,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
633579
633736
|
let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
|
|
633580
633737
|
try {
|
|
633581
633738
|
if (existsSync123(_visionMarkerFile)) {
|
|
633582
|
-
const _vm = JSON.parse(
|
|
633739
|
+
const _vm = JSON.parse(readFileSync102(_visionMarkerFile, "utf8"));
|
|
633583
633740
|
_visionPreviouslyInstalled = new Set(_vm.installed || []);
|
|
633584
633741
|
}
|
|
633585
633742
|
} catch {
|
|
@@ -634411,7 +634568,7 @@ function ensurePathInShellRc(binDir) {
|
|
|
634411
634568
|
const shell = process.env.SHELL ?? "";
|
|
634412
634569
|
const rcFile = shell.includes("zsh") ? join139(homedir45(), ".zshrc") : join139(homedir45(), ".bashrc");
|
|
634413
634570
|
try {
|
|
634414
|
-
const rcContent = existsSync123(rcFile) ?
|
|
634571
|
+
const rcContent = existsSync123(rcFile) ? readFileSync102(rcFile, "utf8") : "";
|
|
634415
634572
|
if (rcContent.includes(binDir)) return;
|
|
634416
634573
|
const exportLine = `
|
|
634417
634574
|
export PATH="${binDir}:$PATH" # Added by omnius for nvim
|
|
@@ -635191,7 +635348,7 @@ var init_platforms = __esm({
|
|
|
635191
635348
|
});
|
|
635192
635349
|
|
|
635193
635350
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
635194
|
-
import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as
|
|
635351
|
+
import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as readFileSync103, statSync as statSync47 } from "node:fs";
|
|
635195
635352
|
import { basename as basename27, extname as extname17, join as join140, relative as relative14, resolve as resolve59 } from "node:path";
|
|
635196
635353
|
function exploreWorkspace(root, options2 = {}) {
|
|
635197
635354
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
@@ -635290,7 +635447,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
|
635290
635447
|
""
|
|
635291
635448
|
].join("\n");
|
|
635292
635449
|
}
|
|
635293
|
-
const content =
|
|
635450
|
+
const content = readFileSync103(full, "utf8");
|
|
635294
635451
|
const rawLines = content.split(/\r?\n/);
|
|
635295
635452
|
const visible = rawLines.slice(0, maxLines);
|
|
635296
635453
|
const gutter = String(Math.min(rawLines.length, maxLines)).length;
|
|
@@ -635466,7 +635623,7 @@ var init_pricing = __esm({
|
|
|
635466
635623
|
});
|
|
635467
635624
|
|
|
635468
635625
|
// packages/cli/src/insights/engine.ts
|
|
635469
|
-
import { readdirSync as readdirSync43, readFileSync as
|
|
635626
|
+
import { readdirSync as readdirSync43, readFileSync as readFileSync104, existsSync as existsSync126 } from "node:fs";
|
|
635470
635627
|
import { join as join141 } from "node:path";
|
|
635471
635628
|
function formatDuration5(seconds) {
|
|
635472
635629
|
if (seconds < 60) return `${Math.round(seconds)}s`;
|
|
@@ -635541,7 +635698,7 @@ var init_engine = __esm({
|
|
|
635541
635698
|
return readdirSync43(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
|
|
635542
635699
|
try {
|
|
635543
635700
|
const data = JSON.parse(
|
|
635544
|
-
|
|
635701
|
+
readFileSync104(join141(this.historyDir, f2), "utf-8")
|
|
635545
635702
|
);
|
|
635546
635703
|
return data;
|
|
635547
635704
|
} catch {
|
|
@@ -635559,7 +635716,7 @@ var init_engine = __esm({
|
|
|
635559
635716
|
loadUsageStore() {
|
|
635560
635717
|
try {
|
|
635561
635718
|
if (existsSync126(this.usageFile)) {
|
|
635562
|
-
return JSON.parse(
|
|
635719
|
+
return JSON.parse(readFileSync104(this.usageFile, "utf-8"));
|
|
635563
635720
|
}
|
|
635564
635721
|
} catch {
|
|
635565
635722
|
}
|
|
@@ -638342,7 +638499,7 @@ var init_memory_menu = __esm({
|
|
|
638342
638499
|
});
|
|
638343
638500
|
|
|
638344
638501
|
// packages/cli/src/tui/audio-waveform.ts
|
|
638345
|
-
import { readFileSync as
|
|
638502
|
+
import { readFileSync as readFileSync105 } from "node:fs";
|
|
638346
638503
|
import { createRequire as createRequire6 } from "node:module";
|
|
638347
638504
|
function readAscii(buffer2, offset, length4) {
|
|
638348
638505
|
return buffer2.subarray(offset, offset + length4).toString("ascii");
|
|
@@ -638416,7 +638573,7 @@ function renderAudioWaveform(file, options2 = {}) {
|
|
|
638416
638573
|
} catch {
|
|
638417
638574
|
return null;
|
|
638418
638575
|
}
|
|
638419
|
-
const buffer2 =
|
|
638576
|
+
const buffer2 = readFileSync105(file);
|
|
638420
638577
|
const info = parseWav(buffer2);
|
|
638421
638578
|
if (!info) return null;
|
|
638422
638579
|
const frameCount = Math.floor(info.dataSize / info.frameSize);
|
|
@@ -638972,7 +639129,7 @@ __export(daemon_exports, {
|
|
|
638972
639129
|
stopDaemon: () => stopDaemon
|
|
638973
639130
|
});
|
|
638974
639131
|
import { spawn as spawn34 } from "node:child_process";
|
|
638975
|
-
import { existsSync as existsSync130, readFileSync as
|
|
639132
|
+
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
639133
|
import { join as join144 } from "node:path";
|
|
638977
639134
|
import { homedir as homedir47 } from "node:os";
|
|
638978
639135
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
@@ -639003,7 +639160,7 @@ function getLocalCliVersion() {
|
|
|
639003
639160
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
639004
639161
|
const p2 = join144(here, rel);
|
|
639005
639162
|
if (existsSync130(p2)) {
|
|
639006
|
-
const v = JSON.parse(
|
|
639163
|
+
const v = JSON.parse(readFileSync106(p2, "utf8"))?.version;
|
|
639007
639164
|
if (v) return String(v);
|
|
639008
639165
|
}
|
|
639009
639166
|
}
|
|
@@ -639042,7 +639199,7 @@ async function restartDaemon(port) {
|
|
|
639042
639199
|
function getDaemonPid() {
|
|
639043
639200
|
if (!existsSync130(PID_FILE2)) return null;
|
|
639044
639201
|
try {
|
|
639045
|
-
const pid = parseInt(
|
|
639202
|
+
const pid = parseInt(readFileSync106(PID_FILE2, "utf8").trim(), 10);
|
|
639046
639203
|
if (!pid || pid <= 0) return null;
|
|
639047
639204
|
process.kill(pid, 0);
|
|
639048
639205
|
return pid;
|
|
@@ -639057,7 +639214,7 @@ function getDaemonPid() {
|
|
|
639057
639214
|
function looksLikeNodeEntrypoint(path12) {
|
|
639058
639215
|
if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
|
|
639059
639216
|
try {
|
|
639060
|
-
const firstBytes =
|
|
639217
|
+
const firstBytes = readFileSync106(path12, "utf8").slice(0, 200);
|
|
639061
639218
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
639062
639219
|
} catch {
|
|
639063
639220
|
return false;
|
|
@@ -639731,7 +639888,7 @@ var init_types5 = __esm({
|
|
|
639731
639888
|
|
|
639732
639889
|
// packages/cli/src/cron/store.ts
|
|
639733
639890
|
import {
|
|
639734
|
-
readFileSync as
|
|
639891
|
+
readFileSync as readFileSync107,
|
|
639735
639892
|
writeFileSync as writeFileSync68,
|
|
639736
639893
|
mkdirSync as mkdirSync79,
|
|
639737
639894
|
chmodSync as chmodSync4,
|
|
@@ -639918,7 +640075,7 @@ function loadJobs() {
|
|
|
639918
640075
|
const path12 = jobsFilePath();
|
|
639919
640076
|
if (!existsSync133(path12)) return [];
|
|
639920
640077
|
try {
|
|
639921
|
-
const data = JSON.parse(
|
|
640078
|
+
const data = JSON.parse(readFileSync107(path12, "utf-8"));
|
|
639922
640079
|
return data.jobs || [];
|
|
639923
640080
|
} catch {
|
|
639924
640081
|
return [];
|
|
@@ -640286,7 +640443,7 @@ import {
|
|
|
640286
640443
|
closeSync as closeSync5,
|
|
640287
640444
|
writeFileSync as writeFileSync69,
|
|
640288
640445
|
unlinkSync as unlinkSync27,
|
|
640289
|
-
readFileSync as
|
|
640446
|
+
readFileSync as readFileSync108
|
|
640290
640447
|
} from "node:fs";
|
|
640291
640448
|
import { join as join148 } from "node:path";
|
|
640292
640449
|
import { homedir as homedir49 } from "node:os";
|
|
@@ -640303,7 +640460,7 @@ function acquireTickLock() {
|
|
|
640303
640460
|
mkdirSync80(cronDir2(), { recursive: true });
|
|
640304
640461
|
try {
|
|
640305
640462
|
if (existsSync134(lockPath)) {
|
|
640306
|
-
const content =
|
|
640463
|
+
const content = readFileSync108(lockPath, "utf-8").trim();
|
|
640307
640464
|
if (content) {
|
|
640308
640465
|
const lock = JSON.parse(content);
|
|
640309
640466
|
const age = Date.now() - lock.acquiredAt;
|
|
@@ -640671,7 +640828,7 @@ __export(sponsor_wizard_exports, {
|
|
|
640671
640828
|
selectedModelsForEndpoint: () => selectedModelsForEndpoint,
|
|
640672
640829
|
showSponsorDashboard: () => showSponsorDashboard
|
|
640673
640830
|
});
|
|
640674
|
-
import { existsSync as existsSync135, readFileSync as
|
|
640831
|
+
import { existsSync as existsSync135, readFileSync as readFileSync109, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
|
|
640675
640832
|
import { join as join149 } from "node:path";
|
|
640676
640833
|
function fmtTokens2(n2) {
|
|
640677
640834
|
if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
|
|
@@ -640692,7 +640849,7 @@ function loadSponsorConfig(projectDir2) {
|
|
|
640692
640849
|
const p2 = configPath(projectDir2);
|
|
640693
640850
|
if (!existsSync135(p2)) return null;
|
|
640694
640851
|
try {
|
|
640695
|
-
return JSON.parse(
|
|
640852
|
+
return JSON.parse(readFileSync109(p2, "utf8"));
|
|
640696
640853
|
} catch {
|
|
640697
640854
|
return null;
|
|
640698
640855
|
}
|
|
@@ -642039,7 +642196,7 @@ import {
|
|
|
642039
642196
|
existsSync as existsSync136,
|
|
642040
642197
|
mkdirSync as mkdirSync82,
|
|
642041
642198
|
writeFileSync as writeFileSync71,
|
|
642042
|
-
readFileSync as
|
|
642199
|
+
readFileSync as readFileSync110,
|
|
642043
642200
|
unlinkSync as unlinkSync28,
|
|
642044
642201
|
readdirSync as readdirSync45,
|
|
642045
642202
|
statSync as statSync50,
|
|
@@ -643540,7 +643697,7 @@ except Exception as exc:
|
|
|
643540
643697
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
643541
643698
|
const destPath = join150(refsDir, destFilename);
|
|
643542
643699
|
try {
|
|
643543
|
-
const data =
|
|
643700
|
+
const data = readFileSync110(audioPath);
|
|
643544
643701
|
writeFileSync71(destPath, data);
|
|
643545
643702
|
} catch (err) {
|
|
643546
643703
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -643615,7 +643772,7 @@ except Exception as exc:
|
|
|
643615
643772
|
const p2 = _VoiceEngine.cloneMetaFile();
|
|
643616
643773
|
if (!existsSync136(p2)) return {};
|
|
643617
643774
|
try {
|
|
643618
|
-
const raw = JSON.parse(
|
|
643775
|
+
const raw = JSON.parse(readFileSync110(p2, "utf8"));
|
|
643619
643776
|
if (typeof Object.values(raw)[0] === "string") {
|
|
643620
643777
|
const migrated = {};
|
|
643621
643778
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -644501,7 +644658,7 @@ except Exception as exc:
|
|
|
644501
644658
|
}
|
|
644502
644659
|
loadMisottsStore() {
|
|
644503
644660
|
try {
|
|
644504
|
-
const raw = JSON.parse(
|
|
644661
|
+
const raw = JSON.parse(readFileSync110(misottsProfilesFile(), "utf-8"));
|
|
644505
644662
|
const profiles = {};
|
|
644506
644663
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
644507
644664
|
profiles[name10] = normalizeMisottsSettings(settings);
|
|
@@ -644525,7 +644682,7 @@ except Exception as exc:
|
|
|
644525
644682
|
loadSupertonicStore() {
|
|
644526
644683
|
try {
|
|
644527
644684
|
const raw = JSON.parse(
|
|
644528
|
-
|
|
644685
|
+
readFileSync110(supertonicProfilesFile(), "utf-8")
|
|
644529
644686
|
);
|
|
644530
644687
|
const profiles = {};
|
|
644531
644688
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
@@ -644692,7 +644849,7 @@ except Exception as exc:
|
|
|
644692
644849
|
const wavPath = await this.synthesizeSupertonicWav(text2, 1);
|
|
644693
644850
|
if (!wavPath) return null;
|
|
644694
644851
|
try {
|
|
644695
|
-
const data =
|
|
644852
|
+
const data = readFileSync110(wavPath);
|
|
644696
644853
|
unlinkSync28(wavPath);
|
|
644697
644854
|
return data;
|
|
644698
644855
|
} catch {
|
|
@@ -644840,7 +644997,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644840
644997
|
if (!existsSync136(wavPath)) return;
|
|
644841
644998
|
if (volume !== 1) {
|
|
644842
644999
|
try {
|
|
644843
|
-
const wavData =
|
|
645000
|
+
const wavData = readFileSync110(wavPath);
|
|
644844
645001
|
if (wavData.length > 44) {
|
|
644845
645002
|
const header = wavData.subarray(0, 44);
|
|
644846
645003
|
const samples = new Int16Array(
|
|
@@ -644862,7 +645019,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644862
645019
|
}
|
|
644863
645020
|
if (this.onPCMOutput) {
|
|
644864
645021
|
try {
|
|
644865
|
-
const wavData =
|
|
645022
|
+
const wavData = readFileSync110(wavPath);
|
|
644866
645023
|
if (wavData.length > 44) {
|
|
644867
645024
|
const pcm = Buffer.from(
|
|
644868
645025
|
wavData.buffer,
|
|
@@ -644920,7 +645077,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
644920
645077
|
}
|
|
644921
645078
|
if (!existsSync136(wavPath)) return null;
|
|
644922
645079
|
try {
|
|
644923
|
-
const data =
|
|
645080
|
+
const data = readFileSync110(wavPath);
|
|
644924
645081
|
unlinkSync28(wavPath);
|
|
644925
645082
|
return data;
|
|
644926
645083
|
} catch {
|
|
@@ -645174,7 +645331,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
645174
645331
|
...isJetson ? (() => {
|
|
645175
645332
|
let jpVer = "v60";
|
|
645176
645333
|
try {
|
|
645177
|
-
const tegra = existsSync136("/etc/nv_tegra_release") ?
|
|
645334
|
+
const tegra = existsSync136("/etc/nv_tegra_release") ? readFileSync110("/etc/nv_tegra_release", "utf8").trim() : "";
|
|
645178
645335
|
const ver = process.env.JETSON_L4T_VERSION || "";
|
|
645179
645336
|
if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
|
|
645180
645337
|
jpVer = "v51";
|
|
@@ -645784,7 +645941,7 @@ if __name__ == '__main__':
|
|
|
645784
645941
|
async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
645785
645942
|
if (!existsSync136(wavPath)) return;
|
|
645786
645943
|
try {
|
|
645787
|
-
const wavData =
|
|
645944
|
+
const wavData = readFileSync110(wavPath);
|
|
645788
645945
|
if (wavData.length > 44) {
|
|
645789
645946
|
const sampleRate = wavData.readUInt32LE(24);
|
|
645790
645947
|
const samples = new Int16Array(
|
|
@@ -645815,7 +645972,7 @@ if __name__ == '__main__':
|
|
|
645815
645972
|
}
|
|
645816
645973
|
if (pitchFactor !== 1) {
|
|
645817
645974
|
try {
|
|
645818
|
-
const wavData =
|
|
645975
|
+
const wavData = readFileSync110(wavPath);
|
|
645819
645976
|
if (wavData.length > 44) {
|
|
645820
645977
|
const int16 = new Int16Array(
|
|
645821
645978
|
wavData.buffer,
|
|
@@ -645834,7 +645991,7 @@ if __name__ == '__main__':
|
|
|
645834
645991
|
}
|
|
645835
645992
|
if (this.onPCMOutput) {
|
|
645836
645993
|
try {
|
|
645837
|
-
const wavData =
|
|
645994
|
+
const wavData = readFileSync110(wavPath);
|
|
645838
645995
|
if (wavData.length > 44) {
|
|
645839
645996
|
const pcm = Buffer.from(
|
|
645840
645997
|
wavData.buffer,
|
|
@@ -645849,7 +646006,7 @@ if __name__ == '__main__':
|
|
|
645849
646006
|
}
|
|
645850
646007
|
if (stereoDelayMs > 0) {
|
|
645851
646008
|
try {
|
|
645852
|
-
const wavData =
|
|
646009
|
+
const wavData = readFileSync110(wavPath);
|
|
645853
646010
|
if (wavData.length > 44) {
|
|
645854
646011
|
const sampleRate = wavData.readUInt32LE(24);
|
|
645855
646012
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -645916,7 +646073,7 @@ if __name__ == '__main__':
|
|
|
645916
646073
|
}
|
|
645917
646074
|
if (!existsSync136(wavPath)) return null;
|
|
645918
646075
|
try {
|
|
645919
|
-
const data =
|
|
646076
|
+
const data = readFileSync110(wavPath);
|
|
645920
646077
|
unlinkSync28(wavPath);
|
|
645921
646078
|
return data;
|
|
645922
646079
|
} catch {
|
|
@@ -646151,7 +646308,7 @@ if __name__ == "__main__":
|
|
|
646151
646308
|
async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
646152
646309
|
if (!existsSync136(wavPath)) return;
|
|
646153
646310
|
try {
|
|
646154
|
-
const wavData =
|
|
646311
|
+
const wavData = readFileSync110(wavPath);
|
|
646155
646312
|
if (wavData.length > 44) {
|
|
646156
646313
|
const sampleRate = wavData.readUInt32LE(24);
|
|
646157
646314
|
const samples = new Int16Array(
|
|
@@ -646182,7 +646339,7 @@ if __name__ == "__main__":
|
|
|
646182
646339
|
}
|
|
646183
646340
|
if (pitchFactor !== 1) {
|
|
646184
646341
|
try {
|
|
646185
|
-
const wavData =
|
|
646342
|
+
const wavData = readFileSync110(wavPath);
|
|
646186
646343
|
if (wavData.length > 44) {
|
|
646187
646344
|
const int16 = new Int16Array(
|
|
646188
646345
|
wavData.buffer,
|
|
@@ -646201,7 +646358,7 @@ if __name__ == "__main__":
|
|
|
646201
646358
|
}
|
|
646202
646359
|
if (this.onPCMOutput) {
|
|
646203
646360
|
try {
|
|
646204
|
-
const wavData =
|
|
646361
|
+
const wavData = readFileSync110(wavPath);
|
|
646205
646362
|
if (wavData.length > 44) {
|
|
646206
646363
|
const pcm = Buffer.from(
|
|
646207
646364
|
wavData.buffer,
|
|
@@ -646216,7 +646373,7 @@ if __name__ == "__main__":
|
|
|
646216
646373
|
}
|
|
646217
646374
|
if (stereoDelayMs > 0) {
|
|
646218
646375
|
try {
|
|
646219
|
-
const wavData =
|
|
646376
|
+
const wavData = readFileSync110(wavPath);
|
|
646220
646377
|
if (wavData.length > 44) {
|
|
646221
646378
|
const sampleRate = wavData.readUInt32LE(24);
|
|
646222
646379
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -646292,7 +646449,7 @@ if __name__ == "__main__":
|
|
|
646292
646449
|
}
|
|
646293
646450
|
if (!existsSync136(wavPath)) return null;
|
|
646294
646451
|
try {
|
|
646295
|
-
const data =
|
|
646452
|
+
const data = readFileSync110(wavPath);
|
|
646296
646453
|
unlinkSync28(wavPath);
|
|
646297
646454
|
return data;
|
|
646298
646455
|
} catch {
|
|
@@ -646313,7 +646470,7 @@ if __name__ == "__main__":
|
|
|
646313
646470
|
};
|
|
646314
646471
|
if (existsSync136(pkgPath)) {
|
|
646315
646472
|
try {
|
|
646316
|
-
const existing = JSON.parse(
|
|
646473
|
+
const existing = JSON.parse(readFileSync110(pkgPath, "utf8"));
|
|
646317
646474
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
646318
646475
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
646319
646476
|
writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -646473,7 +646630,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
646473
646630
|
if (!existsSync136(onnxPath) || !existsSync136(configPath2)) {
|
|
646474
646631
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
646475
646632
|
}
|
|
646476
|
-
this.config = JSON.parse(
|
|
646633
|
+
this.config = JSON.parse(readFileSync110(configPath2, "utf8"));
|
|
646477
646634
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
646478
646635
|
executionProviders: ["cpu"],
|
|
646479
646636
|
graphOptimizationLevel: "all"
|
|
@@ -646633,7 +646790,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
|
|
|
646633
646790
|
import { createHash as createHash38 } from "node:crypto";
|
|
646634
646791
|
import {
|
|
646635
646792
|
existsSync as existsSync137,
|
|
646636
|
-
readFileSync as
|
|
646793
|
+
readFileSync as readFileSync111,
|
|
646637
646794
|
writeFileSync as writeFileSync72,
|
|
646638
646795
|
mkdirSync as mkdirSync83,
|
|
646639
646796
|
readdirSync as readdirSync46,
|
|
@@ -647954,10 +648111,10 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
647954
648111
|
if (!key) {
|
|
647955
648112
|
try {
|
|
647956
648113
|
const { homedir: homedir65 } = await import("node:os");
|
|
647957
|
-
const { readFileSync:
|
|
648114
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
647958
648115
|
const { join: join186 } = await import("node:path");
|
|
647959
648116
|
const p2 = join186(homedir65(), ".omnius", "api.key");
|
|
647960
|
-
if (existsSync169(p2)) key =
|
|
648117
|
+
if (existsSync169(p2)) key = readFileSync138(p2, "utf8").trim();
|
|
647961
648118
|
} catch {
|
|
647962
648119
|
}
|
|
647963
648120
|
}
|
|
@@ -648861,7 +649018,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
648861
649018
|
try {
|
|
648862
649019
|
const pidFile = join151(nexus.getNexusDir(), "daemon.pid");
|
|
648863
649020
|
if (existsSync137(pidFile)) {
|
|
648864
|
-
const pid = parseInt(
|
|
649021
|
+
const pid = parseInt(readFileSync111(pidFile, "utf8").trim(), 10);
|
|
648865
649022
|
if (pid > 0 && !registry2.daemons.has("Nexus")) {
|
|
648866
649023
|
registry2.register({
|
|
648867
649024
|
name: "Nexus",
|
|
@@ -649284,7 +649441,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649284
649441
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
649285
649442
|
return "handled";
|
|
649286
649443
|
}
|
|
649287
|
-
content =
|
|
649444
|
+
content = readFileSync111(toolFile, "utf8");
|
|
649288
649445
|
metadata = { type: "tool", name: shareName };
|
|
649289
649446
|
} else if (shareType === "skill") {
|
|
649290
649447
|
const skillDir = join151(ctx3.repoRoot, ".omnius", "skills", shareName);
|
|
@@ -649293,7 +649450,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649293
649450
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
649294
649451
|
return "handled";
|
|
649295
649452
|
}
|
|
649296
|
-
content =
|
|
649453
|
+
content = readFileSync111(skillFile, "utf8");
|
|
649297
649454
|
metadata = { type: "skill", name: shareName };
|
|
649298
649455
|
} else {
|
|
649299
649456
|
renderWarning(
|
|
@@ -649366,7 +649523,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649366
649523
|
"learning-cids.json"
|
|
649367
649524
|
);
|
|
649368
649525
|
if (existsSync137(regFile)) {
|
|
649369
|
-
const reg2 = JSON.parse(
|
|
649526
|
+
const reg2 = JSON.parse(readFileSync111(regFile, "utf8"));
|
|
649370
649527
|
const pinned = Object.values(reg2).some(
|
|
649371
649528
|
(e2) => e2.cid === importCid && e2.pinned
|
|
649372
649529
|
);
|
|
@@ -649484,7 +649641,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649484
649641
|
).getNexusDir();
|
|
649485
649642
|
const statusFile = join151(nexusDir, "status.json");
|
|
649486
649643
|
if (existsSync137(statusFile)) {
|
|
649487
|
-
const status = JSON.parse(
|
|
649644
|
+
const status = JSON.parse(readFileSync111(statusFile, "utf8"));
|
|
649488
649645
|
if (status.peerId) {
|
|
649489
649646
|
lines.push(`
|
|
649490
649647
|
${c3.bold("Peer Info")}`);
|
|
@@ -649509,7 +649666,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649509
649666
|
try {
|
|
649510
649667
|
const stateFile = join151(idDir, "self-state.json");
|
|
649511
649668
|
if (existsSync137(stateFile)) {
|
|
649512
|
-
const state = JSON.parse(
|
|
649669
|
+
const state = JSON.parse(readFileSync111(stateFile, "utf8"));
|
|
649513
649670
|
lines.push(
|
|
649514
649671
|
` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
|
|
649515
649672
|
);
|
|
@@ -649524,7 +649681,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649524
649681
|
}
|
|
649525
649682
|
const cidFile = join151(idDir, "cids.json");
|
|
649526
649683
|
if (existsSync137(cidFile)) {
|
|
649527
|
-
const cids = JSON.parse(
|
|
649684
|
+
const cids = JSON.parse(readFileSync111(cidFile, "utf8"));
|
|
649528
649685
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
649529
649686
|
if (lastCid)
|
|
649530
649687
|
lines.push(
|
|
@@ -649549,7 +649706,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649549
649706
|
"store.json"
|
|
649550
649707
|
);
|
|
649551
649708
|
if (existsSync137(metaFile2)) {
|
|
649552
|
-
const store2 = JSON.parse(
|
|
649709
|
+
const store2 = JSON.parse(readFileSync111(metaFile2, "utf8"));
|
|
649553
649710
|
const active = store2.filter((m2) => m2.type !== "quarantine");
|
|
649554
649711
|
const recoveries = active.filter(
|
|
649555
649712
|
(m2) => m2.content?.startsWith("[recovery]")
|
|
@@ -649787,7 +649944,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649787
649944
|
return "handled";
|
|
649788
649945
|
}
|
|
649789
649946
|
} else {
|
|
649790
|
-
content =
|
|
649947
|
+
content = readFileSync111(resolvedPath, "utf8");
|
|
649791
649948
|
}
|
|
649792
649949
|
if (!content.trim()) {
|
|
649793
649950
|
renderWarning("No content extracted.");
|
|
@@ -649895,7 +650052,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649895
650052
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
649896
650053
|
return "handled";
|
|
649897
650054
|
}
|
|
649898
|
-
const bridge = JSON.parse(
|
|
650055
|
+
const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
|
|
649899
650056
|
let alive = false;
|
|
649900
650057
|
try {
|
|
649901
650058
|
process.kill(bridge.pid, 0);
|
|
@@ -649931,7 +650088,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
649931
650088
|
if (fortemiSubCmd === "stop") {
|
|
649932
650089
|
const bridgeFile = join151(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
|
|
649933
650090
|
if (existsSync137(bridgeFile)) {
|
|
649934
|
-
const bridge = JSON.parse(
|
|
650091
|
+
const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
|
|
649935
650092
|
try {
|
|
649936
650093
|
process.kill(bridge.pid, "SIGTERM");
|
|
649937
650094
|
} catch {
|
|
@@ -651963,7 +652120,7 @@ sleep 1
|
|
|
651963
652120
|
`daemon.pid exists: ${existsSync137(join151(checkedNexusDir, "daemon.pid"))}`
|
|
651964
652121
|
);
|
|
651965
652122
|
try {
|
|
651966
|
-
const _statusRaw =
|
|
652123
|
+
const _statusRaw = readFileSync111(
|
|
651967
652124
|
join151(checkedNexusDir, "status.json"),
|
|
651968
652125
|
"utf8"
|
|
651969
652126
|
);
|
|
@@ -651972,7 +652129,7 @@ sleep 1
|
|
|
651972
652129
|
_spLog(`status.json read error: ${e2}`);
|
|
651973
652130
|
}
|
|
651974
652131
|
try {
|
|
651975
|
-
const _errRaw =
|
|
652132
|
+
const _errRaw = readFileSync111(
|
|
651976
652133
|
join151(checkedNexusDir, "daemon.err"),
|
|
651977
652134
|
"utf8"
|
|
651978
652135
|
);
|
|
@@ -652007,7 +652164,7 @@ sleep 1
|
|
|
652007
652164
|
"agent-name"
|
|
652008
652165
|
);
|
|
652009
652166
|
if (existsSync137(namePath))
|
|
652010
|
-
sponsorName =
|
|
652167
|
+
sponsorName = readFileSync111(namePath, "utf8").trim();
|
|
652011
652168
|
} catch {
|
|
652012
652169
|
}
|
|
652013
652170
|
if (!sponsorName) sponsorName = "Omnius Sponsor";
|
|
@@ -652111,7 +652268,7 @@ sleep 1
|
|
|
652111
652268
|
);
|
|
652112
652269
|
if (existsSync137(nexusPidFile)) {
|
|
652113
652270
|
const nPid = parseInt(
|
|
652114
|
-
|
|
652271
|
+
readFileSync111(nexusPidFile, "utf8").trim(),
|
|
652115
652272
|
10
|
|
652116
652273
|
);
|
|
652117
652274
|
if (nPid > 0) {
|
|
@@ -653410,7 +653567,7 @@ sleep 1
|
|
|
653410
653567
|
if (existsSync137(projectSettingsPath)) {
|
|
653411
653568
|
try {
|
|
653412
653569
|
const projectJson = JSON.parse(
|
|
653413
|
-
|
|
653570
|
+
readFileSync111(projectSettingsPath, "utf8")
|
|
653414
653571
|
);
|
|
653415
653572
|
projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
|
|
653416
653573
|
} catch {
|
|
@@ -657454,7 +657611,15 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
657454
657611
|
}
|
|
657455
657612
|
case "audio-input": {
|
|
657456
657613
|
const device = await chooseLiveDevice(ctx3, "Select Audio Input", devices.audioInputs, cfg.selectedAudioInput);
|
|
657457
|
-
if (device)
|
|
657614
|
+
if (device) {
|
|
657615
|
+
manager.configure({ selectedAudioInput: device.id, audioEnabled: true });
|
|
657616
|
+
renderInfo(`Selected audio input: ${device.id}
|
|
657617
|
+
Previewing microphone activity...`);
|
|
657618
|
+
const preview = await manager.previewAudioInput(device.id);
|
|
657619
|
+
if (preview.ok) renderInfo(preview.message);
|
|
657620
|
+
else renderWarning(preview.message);
|
|
657621
|
+
renderLiveDashboard(ctx3, manager);
|
|
657622
|
+
}
|
|
657458
657623
|
continue;
|
|
657459
657624
|
}
|
|
657460
657625
|
case "audio-output": {
|
|
@@ -659129,7 +659294,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
|
|
|
659129
659294
|
"known-sponsors.json"
|
|
659130
659295
|
);
|
|
659131
659296
|
if (existsSync137(knownFile)) {
|
|
659132
|
-
const saved = JSON.parse(
|
|
659297
|
+
const saved = JSON.parse(readFileSync111(knownFile, "utf8"));
|
|
659133
659298
|
if (Array.isArray(saved)) rawSponsors.push(...saved);
|
|
659134
659299
|
}
|
|
659135
659300
|
} catch {
|
|
@@ -659279,7 +659444,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
659279
659444
|
while (!done && Date.now() < deadline) {
|
|
659280
659445
|
await new Promise((resolve76) => setTimeout(resolve76, 250));
|
|
659281
659446
|
if (!existsSync137(args.streamFile)) continue;
|
|
659282
|
-
const raw =
|
|
659447
|
+
const raw = readFileSync111(args.streamFile, "utf8");
|
|
659283
659448
|
if (raw.length <= offset) continue;
|
|
659284
659449
|
pending2 += raw.slice(offset);
|
|
659285
659450
|
offset = raw.length;
|
|
@@ -659603,7 +659768,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
659603
659768
|
try {
|
|
659604
659769
|
if (existsSync137(knownFile)) {
|
|
659605
659770
|
const saved = JSON.parse(
|
|
659606
|
-
|
|
659771
|
+
readFileSync111(knownFile, "utf8")
|
|
659607
659772
|
);
|
|
659608
659773
|
for (const s2 of saved) {
|
|
659609
659774
|
if (!sponsors.some((sp) => sp.url === s2.url)) {
|
|
@@ -659779,7 +659944,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
659779
659944
|
const saveKey = selected.url || selected.peerId || selected.name;
|
|
659780
659945
|
try {
|
|
659781
659946
|
mkdirSync83(sponsorDir2, { recursive: true });
|
|
659782
|
-
const existing = existsSync137(knownFile) ? JSON.parse(
|
|
659947
|
+
const existing = existsSync137(knownFile) ? JSON.parse(readFileSync111(knownFile, "utf8")) : [];
|
|
659783
659948
|
const updated = existing.filter(
|
|
659784
659949
|
(s2) => (s2.url || s2.peerId || s2.name) !== saveKey
|
|
659785
659950
|
);
|
|
@@ -661203,9 +661368,9 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
661203
661368
|
(async () => {
|
|
661204
661369
|
try {
|
|
661205
661370
|
const prefix = await execA("npm prefix -g", { timeout: 5e3 });
|
|
661206
|
-
const { accessSync:
|
|
661371
|
+
const { accessSync: accessSync2, constants: constants2 } = await import("node:fs");
|
|
661207
661372
|
try {
|
|
661208
|
-
|
|
661373
|
+
accessSync2(prefix, constants2.W_OK);
|
|
661209
661374
|
return false;
|
|
661210
661375
|
} catch {
|
|
661211
661376
|
return true;
|
|
@@ -662052,16 +662217,8 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
662052
662217
|
} else {
|
|
662053
662218
|
installOverlay.setStatus("cloudflared ready");
|
|
662054
662219
|
}
|
|
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
|
-
}
|
|
662220
|
+
installOverlay.setStatus("Checking managed transcribe-cli runtime...");
|
|
662221
|
+
await ensureTranscribeCliBackground().catch(() => false);
|
|
662065
662222
|
installOverlay.setStatus("cloudflared/transcribe checks complete");
|
|
662066
662223
|
}
|
|
662067
662224
|
if (!primaryUpdated) {
|
|
@@ -662893,7 +663050,7 @@ var init_commands = __esm({
|
|
|
662893
663050
|
});
|
|
662894
663051
|
|
|
662895
663052
|
// packages/cli/src/tui/project-context.ts
|
|
662896
|
-
import { existsSync as existsSync138, readFileSync as
|
|
663053
|
+
import { existsSync as existsSync138, readFileSync as readFileSync112, readdirSync as readdirSync47, mkdirSync as mkdirSync84, statSync as statSync52, writeFileSync as writeFileSync73 } from "node:fs";
|
|
662897
663054
|
import { dirname as dirname47, join as join152, basename as basename29, resolve as resolve62 } from "node:path";
|
|
662898
663055
|
import { homedir as homedir52 } from "node:os";
|
|
662899
663056
|
function projectContextUrlSpanAt(text2, index) {
|
|
@@ -662944,7 +663101,7 @@ function loadProjectMap(repoRoot) {
|
|
|
662944
663101
|
const mapPath2 = join152(repoRoot, OMNIUS_DIR, "context", "project-map.md");
|
|
662945
663102
|
if (existsSync138(mapPath2)) {
|
|
662946
663103
|
try {
|
|
662947
|
-
const content =
|
|
663104
|
+
const content = readFileSync112(mapPath2, "utf-8");
|
|
662948
663105
|
return content;
|
|
662949
663106
|
} catch {
|
|
662950
663107
|
}
|
|
@@ -662957,7 +663114,7 @@ function findGitDir(repoRoot) {
|
|
|
662957
663114
|
const gitPath = join152(dir, ".git");
|
|
662958
663115
|
if (existsSync138(gitPath)) {
|
|
662959
663116
|
try {
|
|
662960
|
-
const raw =
|
|
663117
|
+
const raw = readFileSync112(gitPath, "utf8").trim();
|
|
662961
663118
|
const match = raw.match(/^gitdir:\s*(.+)$/i);
|
|
662962
663119
|
if (match?.[1]) {
|
|
662963
663120
|
return resolve62(dir, match[1]);
|
|
@@ -662977,12 +663134,12 @@ function getGitInfo(repoRoot) {
|
|
|
662977
663134
|
if (!gitDir) return "";
|
|
662978
663135
|
const lines = [];
|
|
662979
663136
|
try {
|
|
662980
|
-
const head =
|
|
663137
|
+
const head = readFileSync112(join152(gitDir, "HEAD"), "utf-8").trim();
|
|
662981
663138
|
const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
662982
663139
|
if (refMatch?.[1]) {
|
|
662983
663140
|
lines.push(`Branch: ${refMatch[1]}`);
|
|
662984
663141
|
try {
|
|
662985
|
-
const refHash =
|
|
663142
|
+
const refHash = readFileSync112(join152(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
|
|
662986
663143
|
if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
|
|
662987
663144
|
} catch {
|
|
662988
663145
|
}
|
|
@@ -663010,7 +663167,7 @@ function countJsonMemoryEntries(dir) {
|
|
|
663010
663167
|
if (!file.endsWith(".json")) continue;
|
|
663011
663168
|
topics++;
|
|
663012
663169
|
try {
|
|
663013
|
-
const parsed = JSON.parse(
|
|
663170
|
+
const parsed = JSON.parse(readFileSync112(join152(dir, file), "utf8"));
|
|
663014
663171
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
663015
663172
|
entries += Object.keys(parsed).length;
|
|
663016
663173
|
}
|
|
@@ -663026,7 +663183,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
663026
663183
|
const path12 = join152(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
|
|
663027
663184
|
if (!existsSync138(path12)) return 0;
|
|
663028
663185
|
try {
|
|
663029
|
-
const parsed = JSON.parse(
|
|
663186
|
+
const parsed = JSON.parse(readFileSync112(path12, "utf8"));
|
|
663030
663187
|
return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
|
|
663031
663188
|
} catch {
|
|
663032
663189
|
return 0;
|
|
@@ -663035,7 +663192,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
663035
663192
|
function countJsonlLines(path12, maxBytes = 1e6) {
|
|
663036
663193
|
if (!existsSync138(path12)) return 0;
|
|
663037
663194
|
try {
|
|
663038
|
-
const text2 =
|
|
663195
|
+
const text2 = readFileSync112(path12, "utf8").slice(-maxBytes);
|
|
663039
663196
|
return text2.split(/\r?\n/).filter((line) => line.trim()).length;
|
|
663040
663197
|
} catch {
|
|
663041
663198
|
return 0;
|
|
@@ -663079,7 +663236,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
|
|
|
663079
663236
|
const files = readdirSync47(dir).filter((f2) => f2.endsWith(".json"));
|
|
663080
663237
|
for (const file of files.slice(0, 10)) {
|
|
663081
663238
|
try {
|
|
663082
|
-
const raw =
|
|
663239
|
+
const raw = readFileSync112(join152(dir, file), "utf-8");
|
|
663083
663240
|
const entries = JSON.parse(raw);
|
|
663084
663241
|
const topic = basename29(file, ".json");
|
|
663085
663242
|
for (const [k, v] of Object.entries(entries)) {
|
|
@@ -663569,7 +663726,7 @@ function extractMakeBootstrapTargets(repoRoot) {
|
|
|
663569
663726
|
const makefile = ["Makefile", "makefile"].find((name10) => existsSync138(join152(repoRoot, name10)));
|
|
663570
663727
|
if (!makefile) return [];
|
|
663571
663728
|
try {
|
|
663572
|
-
const text2 =
|
|
663729
|
+
const text2 = readFileSync112(join152(repoRoot, makefile), "utf8");
|
|
663573
663730
|
const targets = [];
|
|
663574
663731
|
for (const line of text2.split(/\r?\n/)) {
|
|
663575
663732
|
const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
|
|
@@ -663713,7 +663870,7 @@ function loadCustomToolsContext(repoRoot) {
|
|
|
663713
663870
|
const registryPath = join152(repoRoot, ".omnius", "tools", "registry.json");
|
|
663714
663871
|
const indexPath = join152(repoRoot, ".omnius", "tools", "README.md");
|
|
663715
663872
|
if (!existsSync138(registryPath)) return "";
|
|
663716
|
-
const registry4 = JSON.parse(
|
|
663873
|
+
const registry4 = JSON.parse(readFileSync112(registryPath, "utf-8"));
|
|
663717
663874
|
const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
|
|
663718
663875
|
const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
|
|
663719
663876
|
if (byRate !== 0) return byRate;
|
|
@@ -663889,7 +664046,7 @@ var init_project_context = __esm({
|
|
|
663889
664046
|
});
|
|
663890
664047
|
|
|
663891
664048
|
// packages/cli/src/realtime.ts
|
|
663892
|
-
import { existsSync as existsSync139, readFileSync as
|
|
664049
|
+
import { existsSync as existsSync139, readFileSync as readFileSync113, readdirSync as readdirSync48 } from "node:fs";
|
|
663893
664050
|
import { basename as basename30, join as join153, resolve as resolve63 } from "node:path";
|
|
663894
664051
|
function clampInt2(value2, fallback, min, max) {
|
|
663895
664052
|
const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
|
|
@@ -663911,7 +664068,7 @@ function firstReadable(candidates) {
|
|
|
663911
664068
|
for (const path12 of candidates) {
|
|
663912
664069
|
if (!existsSync139(path12)) continue;
|
|
663913
664070
|
try {
|
|
663914
|
-
return { path: path12, content:
|
|
664071
|
+
return { path: path12, content: readFileSync113(path12, "utf8") };
|
|
663915
664072
|
} catch {
|
|
663916
664073
|
return null;
|
|
663917
664074
|
}
|
|
@@ -663934,7 +664091,7 @@ function projectVoice(repoRoot) {
|
|
|
663934
664091
|
return ap - bp || a2.localeCompare(b);
|
|
663935
664092
|
});
|
|
663936
664093
|
const first2 = files[0];
|
|
663937
|
-
return first2 ? { path: join153(voiceDir3, first2), content:
|
|
664094
|
+
return first2 ? { path: join153(voiceDir3, first2), content: readFileSync113(join153(voiceDir3, first2), "utf8") } : null;
|
|
663938
664095
|
} catch {
|
|
663939
664096
|
return null;
|
|
663940
664097
|
}
|
|
@@ -664122,7 +664279,7 @@ __export(chat_session_exports, {
|
|
|
664122
664279
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
664123
664280
|
import {
|
|
664124
664281
|
existsSync as existsSync140,
|
|
664125
|
-
readFileSync as
|
|
664282
|
+
readFileSync as readFileSync114,
|
|
664126
664283
|
readdirSync as readdirSync49,
|
|
664127
664284
|
writeFileSync as writeFileSync74,
|
|
664128
664285
|
renameSync as renameSync13,
|
|
@@ -664231,7 +664388,7 @@ function normalizeLoadedSession(parsed) {
|
|
|
664231
664388
|
}
|
|
664232
664389
|
function readSessionFile(fp) {
|
|
664233
664390
|
try {
|
|
664234
|
-
const parsed = JSON.parse(
|
|
664391
|
+
const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
|
|
664235
664392
|
if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
|
|
664236
664393
|
return normalizeLoadedSession(parsed);
|
|
664237
664394
|
} catch {
|
|
@@ -664264,7 +664421,7 @@ function loadPersistedSessions() {
|
|
|
664264
664421
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
664265
664422
|
const fp = join154(dir, f2);
|
|
664266
664423
|
try {
|
|
664267
|
-
const parsed = JSON.parse(
|
|
664424
|
+
const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
|
|
664268
664425
|
if (f2.endsWith(".inflight.json")) {
|
|
664269
664426
|
if (parsed && parsed.pid && parsed.status === "running") {
|
|
664270
664427
|
try {
|
|
@@ -664306,7 +664463,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664306
664463
|
const diaryPath = join154(cwd4, ".omnius", "context", "session-diary.md");
|
|
664307
664464
|
if (existsSync140(diaryPath)) {
|
|
664308
664465
|
try {
|
|
664309
|
-
const diary =
|
|
664466
|
+
const diary = readFileSync114(diaryPath, "utf-8").slice(0, 1e3);
|
|
664310
664467
|
parts.push(`\\nPrevious session history:\\n${diary}`);
|
|
664311
664468
|
} catch {
|
|
664312
664469
|
}
|
|
@@ -664321,7 +664478,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664321
664478
|
);
|
|
664322
664479
|
for (const f2 of files.slice(0, 3)) {
|
|
664323
664480
|
try {
|
|
664324
|
-
const data = JSON.parse(
|
|
664481
|
+
const data = JSON.parse(readFileSync114(join154(memDir, f2), "utf-8"));
|
|
664325
664482
|
const entries = Object.entries(data).slice(0, 3);
|
|
664326
664483
|
if (entries.length > 0) {
|
|
664327
664484
|
parts.push(
|
|
@@ -664341,7 +664498,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
664341
664498
|
const p2 = join154(cwd4, name10);
|
|
664342
664499
|
if (existsSync140(p2)) {
|
|
664343
664500
|
try {
|
|
664344
|
-
const content =
|
|
664501
|
+
const content = readFileSync114(p2, "utf-8").slice(0, 500);
|
|
664345
664502
|
parts.push(`\\nProject instructions (${name10}):\\n${content}`);
|
|
664346
664503
|
} catch {
|
|
664347
664504
|
}
|
|
@@ -664363,7 +664520,7 @@ function getSession2(sessionId, model, cwd4) {
|
|
|
664363
664520
|
try {
|
|
664364
664521
|
const fp = sessionPath(sessionId);
|
|
664365
664522
|
if (existsSync140(fp)) {
|
|
664366
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
664523
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
|
|
664367
664524
|
if (parsed && parsed.id === sessionId) {
|
|
664368
664525
|
parsed.lastActivity = Date.now();
|
|
664369
664526
|
if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
|
|
@@ -664550,7 +664707,7 @@ function drainCheckins(sessionId) {
|
|
|
664550
664707
|
const fp = checkinPath(sessionId);
|
|
664551
664708
|
if (!existsSync140(fp)) return [];
|
|
664552
664709
|
try {
|
|
664553
|
-
const raw =
|
|
664710
|
+
const raw = readFileSync114(fp, "utf-8");
|
|
664554
664711
|
try {
|
|
664555
664712
|
unlinkSync29(fp);
|
|
664556
664713
|
} catch {
|
|
@@ -664616,7 +664773,7 @@ function lookupSession(id2) {
|
|
|
664616
664773
|
try {
|
|
664617
664774
|
const fp = sessionPath(id2);
|
|
664618
664775
|
if (existsSync140(fp)) {
|
|
664619
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
664776
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
|
|
664620
664777
|
if (parsed && parsed.id === id2) {
|
|
664621
664778
|
sessions2.set(id2, parsed);
|
|
664622
664779
|
return parsed;
|
|
@@ -664669,7 +664826,7 @@ function getInFlightChat(sessionId) {
|
|
|
664669
664826
|
try {
|
|
664670
664827
|
const p2 = inFlightPath(sessionId);
|
|
664671
664828
|
if (existsSync140(p2)) {
|
|
664672
|
-
const parsed = JSON.parse(
|
|
664829
|
+
const parsed = JSON.parse(readFileSync114(p2, "utf-8"));
|
|
664673
664830
|
if (parsed && parsed.sessionId === sessionId) {
|
|
664674
664831
|
return parsed;
|
|
664675
664832
|
}
|
|
@@ -666074,7 +666231,7 @@ __export(banner_exports, {
|
|
|
666074
666231
|
setBannerWriter: () => setBannerWriter,
|
|
666075
666232
|
setGridText: () => setGridText
|
|
666076
666233
|
});
|
|
666077
|
-
import { existsSync as existsSync142, readFileSync as
|
|
666234
|
+
import { existsSync as existsSync142, readFileSync as readFileSync115, writeFileSync as writeFileSync75, mkdirSync as mkdirSync86 } from "node:fs";
|
|
666078
666235
|
import { join as join155 } from "node:path";
|
|
666079
666236
|
function setBannerWriter(writer) {
|
|
666080
666237
|
chromeWrite3 = writer;
|
|
@@ -666216,7 +666373,7 @@ function loadBannerDesign(workDir, id2) {
|
|
|
666216
666373
|
const file = join155(workDir, ".omnius", "banners", `${id2}.json`);
|
|
666217
666374
|
if (!existsSync142(file)) return null;
|
|
666218
666375
|
try {
|
|
666219
|
-
return JSON.parse(
|
|
666376
|
+
return JSON.parse(readFileSync115(file, "utf8"));
|
|
666220
666377
|
} catch {
|
|
666221
666378
|
return null;
|
|
666222
666379
|
}
|
|
@@ -666546,13 +666703,13 @@ var init_banner = __esm({
|
|
|
666546
666703
|
});
|
|
666547
666704
|
|
|
666548
666705
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
666549
|
-
import { existsSync as existsSync143, readFileSync as
|
|
666706
|
+
import { existsSync as existsSync143, readFileSync as readFileSync116, writeFileSync as writeFileSync76, mkdirSync as mkdirSync87, readdirSync as readdirSync50 } from "node:fs";
|
|
666550
666707
|
import { join as join156, basename as basename33 } from "node:path";
|
|
666551
666708
|
function loadToolProfile(repoRoot) {
|
|
666552
666709
|
const filePath = join156(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
666553
666710
|
try {
|
|
666554
666711
|
if (!existsSync143(filePath)) return null;
|
|
666555
|
-
return JSON.parse(
|
|
666712
|
+
return JSON.parse(readFileSync116(filePath, "utf-8"));
|
|
666556
666713
|
} catch {
|
|
666557
666714
|
return null;
|
|
666558
666715
|
}
|
|
@@ -666618,7 +666775,7 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
666618
666775
|
const filePath = join156(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
|
|
666619
666776
|
try {
|
|
666620
666777
|
if (!existsSync143(filePath)) return null;
|
|
666621
|
-
const cached = JSON.parse(
|
|
666778
|
+
const cached = JSON.parse(readFileSync116(filePath, "utf-8"));
|
|
666622
666779
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
666623
666780
|
} catch {
|
|
666624
666781
|
return null;
|
|
@@ -666682,7 +666839,7 @@ function extractFromPackageJson(repoRoot, tags) {
|
|
|
666682
666839
|
const pkgPath = join156(repoRoot, "package.json");
|
|
666683
666840
|
try {
|
|
666684
666841
|
if (!existsSync143(pkgPath)) return;
|
|
666685
|
-
const pkg = JSON.parse(
|
|
666842
|
+
const pkg = JSON.parse(readFileSync116(pkgPath, "utf-8"));
|
|
666686
666843
|
if (pkg.name && typeof pkg.name === "string") {
|
|
666687
666844
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
666688
666845
|
for (const p2 of parts) tags.push(p2);
|
|
@@ -666753,7 +666910,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
666753
666910
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
666754
666911
|
tags.push(topic);
|
|
666755
666912
|
try {
|
|
666756
|
-
const data = JSON.parse(
|
|
666913
|
+
const data = JSON.parse(readFileSync116(join156(memoryDir, file), "utf-8"));
|
|
666757
666914
|
if (data && typeof data === "object") {
|
|
666758
666915
|
const keys = Object.keys(data).slice(0, 3);
|
|
666759
666916
|
for (const key of keys) {
|
|
@@ -667796,7 +667953,7 @@ var init_edit_history = __esm({
|
|
|
667796
667953
|
});
|
|
667797
667954
|
|
|
667798
667955
|
// packages/cli/src/tui/snr-engine.ts
|
|
667799
|
-
import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as
|
|
667956
|
+
import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as readFileSync117, writeFileSync as writeFileSync77, mkdirSync as mkdirSync89, rmSync as rmSync13 } from "node:fs";
|
|
667800
667957
|
import { join as join158, basename as basename34 } from "node:path";
|
|
667801
667958
|
function computeDPrime(signalScores, noiseScores) {
|
|
667802
667959
|
if (signalScores.length === 0 || noiseScores.length === 0) return 0;
|
|
@@ -668103,7 +668260,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668103
668260
|
const topic = basename34(f2, ".json");
|
|
668104
668261
|
if (topics.length > 0 && !topics.includes(topic)) continue;
|
|
668105
668262
|
try {
|
|
668106
|
-
const data = JSON.parse(
|
|
668263
|
+
const data = JSON.parse(readFileSync117(join158(dir, f2), "utf-8"));
|
|
668107
668264
|
for (const [key, val] of Object.entries(data)) {
|
|
668108
668265
|
const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
668109
668266
|
entries.push({ topic, key, value: value2 });
|
|
@@ -668205,7 +668362,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668205
668362
|
const file = join158(memDir, `${topic}.json`);
|
|
668206
668363
|
if (!existsSync144(file)) continue;
|
|
668207
668364
|
try {
|
|
668208
|
-
const data = JSON.parse(
|
|
668365
|
+
const data = JSON.parse(readFileSync117(file, "utf-8"));
|
|
668209
668366
|
const moved = {};
|
|
668210
668367
|
for (const key of keys) {
|
|
668211
668368
|
if (key in data) {
|
|
@@ -668220,7 +668377,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668220
668377
|
let archiveData = {};
|
|
668221
668378
|
if (existsSync144(archiveFile)) {
|
|
668222
668379
|
try {
|
|
668223
|
-
archiveData = JSON.parse(
|
|
668380
|
+
archiveData = JSON.parse(readFileSync117(archiveFile, "utf-8"));
|
|
668224
668381
|
} catch {
|
|
668225
668382
|
}
|
|
668226
668383
|
}
|
|
@@ -668259,7 +668416,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
668259
668416
|
});
|
|
668260
668417
|
|
|
668261
668418
|
// packages/cli/src/tui/promptLoader.ts
|
|
668262
|
-
import { readFileSync as
|
|
668419
|
+
import { readFileSync as readFileSync118, existsSync as existsSync145 } from "node:fs";
|
|
668263
668420
|
import { join as join159, dirname as dirname49 } from "node:path";
|
|
668264
668421
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
668265
668422
|
function loadPrompt3(promptPath, vars) {
|
|
@@ -668269,7 +668426,7 @@ function loadPrompt3(promptPath, vars) {
|
|
|
668269
668426
|
if (!existsSync145(fullPath)) {
|
|
668270
668427
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
668271
668428
|
}
|
|
668272
|
-
content =
|
|
668429
|
+
content = readFileSync118(fullPath, "utf-8");
|
|
668273
668430
|
cache7.set(promptPath, content);
|
|
668274
668431
|
}
|
|
668275
668432
|
if (!vars) return content;
|
|
@@ -668289,7 +668446,7 @@ var init_promptLoader3 = __esm({
|
|
|
668289
668446
|
});
|
|
668290
668447
|
|
|
668291
668448
|
// packages/cli/src/tui/dream-engine.ts
|
|
668292
|
-
import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as
|
|
668449
|
+
import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as readFileSync119, existsSync as existsSync146, readdirSync as readdirSync52 } from "node:fs";
|
|
668293
668450
|
import { join as join160, basename as basename35 } from "node:path";
|
|
668294
668451
|
function setDreamWriteContent(fn) {
|
|
668295
668452
|
_dreamWriteContent = fn;
|
|
@@ -668305,7 +668462,7 @@ function loadAutoresearchMemory(repoRoot) {
|
|
|
668305
668462
|
const memoryPath = join160(repoRoot, ".omnius", "memory", "autoresearch.json");
|
|
668306
668463
|
if (!existsSync146(memoryPath)) return "";
|
|
668307
668464
|
try {
|
|
668308
|
-
const raw =
|
|
668465
|
+
const raw = readFileSync119(memoryPath, "utf-8");
|
|
668309
668466
|
const data = JSON.parse(raw);
|
|
668310
668467
|
const sections = [];
|
|
668311
668468
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -668540,7 +668697,7 @@ var init_dream_engine = __esm({
|
|
|
668540
668697
|
if (!existsSync146(targetPath)) {
|
|
668541
668698
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
668542
668699
|
}
|
|
668543
|
-
let content =
|
|
668700
|
+
let content = readFileSync119(targetPath, "utf-8");
|
|
668544
668701
|
if (!content.includes(oldStr)) {
|
|
668545
668702
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
668546
668703
|
}
|
|
@@ -668628,7 +668785,7 @@ var init_dream_engine = __esm({
|
|
|
668628
668785
|
if (!existsSync146(targetPath)) {
|
|
668629
668786
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
668630
668787
|
}
|
|
668631
|
-
let content =
|
|
668788
|
+
let content = readFileSync119(targetPath, "utf-8");
|
|
668632
668789
|
if (!content.includes(oldStr)) {
|
|
668633
668790
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
668634
668791
|
}
|
|
@@ -669592,7 +669749,7 @@ ${summary}` };
|
|
|
669592
669749
|
try {
|
|
669593
669750
|
let notes = [];
|
|
669594
669751
|
if (existsSync146(notesPath)) {
|
|
669595
|
-
notes = JSON.parse(
|
|
669752
|
+
notes = JSON.parse(readFileSync119(notesPath, "utf-8"));
|
|
669596
669753
|
}
|
|
669597
669754
|
if (action === "add") {
|
|
669598
669755
|
const note = {
|
|
@@ -670232,7 +670389,7 @@ var init_bless_engine = __esm({
|
|
|
670232
670389
|
});
|
|
670233
670390
|
|
|
670234
670391
|
// packages/cli/src/tui/dmn-engine.ts
|
|
670235
|
-
import { existsSync as existsSync147, readFileSync as
|
|
670392
|
+
import { existsSync as existsSync147, readFileSync as readFileSync120, writeFileSync as writeFileSync79, mkdirSync as mkdirSync91, readdirSync as readdirSync53, unlinkSync as unlinkSync30 } from "node:fs";
|
|
670236
670393
|
import { join as join161, basename as basename36 } from "node:path";
|
|
670237
670394
|
import { exec as exec6 } from "node:child_process";
|
|
670238
670395
|
import { promisify as promisify8 } from "node:util";
|
|
@@ -671117,7 +671274,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
671117
671274
|
const path12 = join161(this.stateDir, "state.json");
|
|
671118
671275
|
if (existsSync147(path12)) {
|
|
671119
671276
|
try {
|
|
671120
|
-
this.state = JSON.parse(
|
|
671277
|
+
this.state = JSON.parse(readFileSync120(path12, "utf-8"));
|
|
671121
671278
|
} catch {
|
|
671122
671279
|
}
|
|
671123
671280
|
}
|
|
@@ -671151,7 +671308,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
671151
671308
|
const latestByFingerprint = /* @__PURE__ */ new Map();
|
|
671152
671309
|
for (const file of files) {
|
|
671153
671310
|
try {
|
|
671154
|
-
const parsed = JSON.parse(
|
|
671311
|
+
const parsed = JSON.parse(readFileSync120(join161(this.historyDir, file), "utf-8"));
|
|
671155
671312
|
latestByFingerprint.set(this.fingerprintCycle(parsed), file);
|
|
671156
671313
|
} catch {
|
|
671157
671314
|
keep.add(file);
|
|
@@ -672829,7 +672986,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
|
|
|
672829
672986
|
import {
|
|
672830
672987
|
existsSync as existsSync148,
|
|
672831
672988
|
mkdirSync as mkdirSync92,
|
|
672832
|
-
readFileSync as
|
|
672989
|
+
readFileSync as readFileSync121,
|
|
672833
672990
|
statSync as statSync53,
|
|
672834
672991
|
unlinkSync as unlinkSync31,
|
|
672835
672992
|
writeFileSync as writeFileSync80
|
|
@@ -673059,7 +673216,7 @@ function scopedTool(base3, root, mode) {
|
|
|
673059
673216
|
);
|
|
673060
673217
|
if (!materialized.ok) return denied(materialized.error);
|
|
673061
673218
|
mkdirSync92(dirname50(guarded.path.abs), { recursive: true });
|
|
673062
|
-
writeFileSync80(guarded.path.abs,
|
|
673219
|
+
writeFileSync80(guarded.path.abs, readFileSync121(materialized.path));
|
|
673063
673220
|
materialized.cleanup?.();
|
|
673064
673221
|
restoredEditPath = guarded.path.abs;
|
|
673065
673222
|
}
|
|
@@ -673183,7 +673340,7 @@ function readManifest(root) {
|
|
|
673183
673340
|
ensureManifest(root);
|
|
673184
673341
|
try {
|
|
673185
673342
|
const parsed = JSON.parse(
|
|
673186
|
-
|
|
673343
|
+
readFileSync121(manifestPath(root), "utf8")
|
|
673187
673344
|
);
|
|
673188
673345
|
const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
|
|
673189
673346
|
Object.entries(parsed.objects).filter(
|
|
@@ -673235,7 +673392,7 @@ function rememberCreated(root, absPath) {
|
|
|
673235
673392
|
}
|
|
673236
673393
|
}
|
|
673237
673394
|
mkdirSync92(join162(root, OBJECTS_DIR), { recursive: true });
|
|
673238
|
-
const data =
|
|
673395
|
+
const data = readFileSync121(guarded.path.abs);
|
|
673239
673396
|
const prefix = randomBytes26(48);
|
|
673240
673397
|
const key = randomBytes26(32);
|
|
673241
673398
|
const iv = randomBytes26(12);
|
|
@@ -673291,7 +673448,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
673291
673448
|
error: `Scoped artifact storage is missing for ${rel}.`
|
|
673292
673449
|
};
|
|
673293
673450
|
}
|
|
673294
|
-
const blob =
|
|
673451
|
+
const blob = readFileSync121(storedAbs);
|
|
673295
673452
|
if (blob.length < object.prefixBytes) {
|
|
673296
673453
|
return {
|
|
673297
673454
|
ok: false,
|
|
@@ -674262,7 +674419,7 @@ import {
|
|
|
674262
674419
|
existsSync as existsSync149,
|
|
674263
674420
|
mkdirSync as mkdirSync93,
|
|
674264
674421
|
readdirSync as readdirSync54,
|
|
674265
|
-
readFileSync as
|
|
674422
|
+
readFileSync as readFileSync122,
|
|
674266
674423
|
writeFileSync as writeFileSync81,
|
|
674267
674424
|
unlinkSync as unlinkSync32
|
|
674268
674425
|
} from "node:fs";
|
|
@@ -675031,7 +675188,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
|
675031
675188
|
for (const file of files.reverse()) {
|
|
675032
675189
|
try {
|
|
675033
675190
|
return JSON.parse(
|
|
675034
|
-
|
|
675191
|
+
readFileSync122(join163(dir, file), "utf8")
|
|
675035
675192
|
);
|
|
675036
675193
|
} catch {
|
|
675037
675194
|
}
|
|
@@ -676769,7 +676926,7 @@ __export(vision_ingress_exports, {
|
|
|
676769
676926
|
resolveVisionModel: () => resolveVisionModel,
|
|
676770
676927
|
runVisionIngress: () => runVisionIngress
|
|
676771
676928
|
});
|
|
676772
|
-
import { existsSync as existsSync150, readFileSync as
|
|
676929
|
+
import { existsSync as existsSync150, readFileSync as readFileSync123, unlinkSync as unlinkSync33 } from "node:fs";
|
|
676773
676930
|
import { join as join164 } from "node:path";
|
|
676774
676931
|
async function isTesseractAvailable() {
|
|
676775
676932
|
try {
|
|
@@ -676824,7 +676981,7 @@ async function advancedOcr(imagePath) {
|
|
|
676824
676981
|
], { timeout: 15e3 });
|
|
676825
676982
|
const txtFile = `${outFile}.txt`;
|
|
676826
676983
|
if (existsSync150(txtFile)) {
|
|
676827
|
-
const text2 =
|
|
676984
|
+
const text2 = readFileSync123(txtFile, "utf-8").trim();
|
|
676828
676985
|
if (text2.length > 0) results.push(text2);
|
|
676829
676986
|
try {
|
|
676830
676987
|
unlinkSync33(txtFile);
|
|
@@ -677010,7 +677167,7 @@ import {
|
|
|
677010
677167
|
readdirSync as readdirSync55,
|
|
677011
677168
|
statSync as statSync54,
|
|
677012
677169
|
statfsSync as statfsSync8,
|
|
677013
|
-
readFileSync as
|
|
677170
|
+
readFileSync as readFileSync124,
|
|
677014
677171
|
writeFileSync as writeFileSync82,
|
|
677015
677172
|
appendFileSync as appendFileSync18
|
|
677016
677173
|
} from "node:fs";
|
|
@@ -683156,7 +683313,7 @@ ${mediaContext}` : ""
|
|
|
683156
683313
|
const path12 = this.telegramConversationPath(sessionKey);
|
|
683157
683314
|
if (!existsSync151(path12)) return;
|
|
683158
683315
|
try {
|
|
683159
|
-
const parsed = JSON.parse(
|
|
683316
|
+
const parsed = JSON.parse(readFileSync124(path12, "utf8"));
|
|
683160
683317
|
const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
|
|
683161
683318
|
if (Array.isArray(parsed.history)) {
|
|
683162
683319
|
this.chatHistory.set(
|
|
@@ -683370,7 +683527,7 @@ ${mediaContext}` : ""
|
|
|
683370
683527
|
for (const file of readdirSync55(this.telegramConversationDir)) {
|
|
683371
683528
|
if (!file.endsWith(".json")) continue;
|
|
683372
683529
|
try {
|
|
683373
|
-
const raw =
|
|
683530
|
+
const raw = readFileSync124(
|
|
683374
683531
|
join165(this.telegramConversationDir, file),
|
|
683375
683532
|
"utf8"
|
|
683376
683533
|
);
|
|
@@ -688057,7 +688214,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
688057
688214
|
const lockFile = join165(lockDir, `bot-${botUserId}.owner.lock`);
|
|
688058
688215
|
if (existsSync151(lockFile)) {
|
|
688059
688216
|
try {
|
|
688060
|
-
const prior = JSON.parse(
|
|
688217
|
+
const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
|
|
688061
688218
|
const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
|
|
688062
688219
|
if (priorAlive) {
|
|
688063
688220
|
throw new Error(
|
|
@@ -688090,7 +688247,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
688090
688247
|
try {
|
|
688091
688248
|
if (!existsSync151(lockFile)) return;
|
|
688092
688249
|
try {
|
|
688093
|
-
const prior = JSON.parse(
|
|
688250
|
+
const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
|
|
688094
688251
|
if (prior.pid !== process.pid) return;
|
|
688095
688252
|
} catch {
|
|
688096
688253
|
}
|
|
@@ -693033,7 +693190,7 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
693033
693190
|
readTelegramToolButtonState(nonce) {
|
|
693034
693191
|
try {
|
|
693035
693192
|
const parsed = JSON.parse(
|
|
693036
|
-
|
|
693193
|
+
readFileSync124(this.telegramToolButtonPath(nonce), "utf-8")
|
|
693037
693194
|
);
|
|
693038
693195
|
if (!parsed || parsed.expiresAt < Date.now()) return null;
|
|
693039
693196
|
return parsed;
|
|
@@ -694487,7 +694644,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
694487
694644
|
const ingressResult = await runVisionIngress2(
|
|
694488
694645
|
{
|
|
694489
694646
|
path: localPath,
|
|
694490
|
-
buffer:
|
|
694647
|
+
buffer: readFileSync124(localPath),
|
|
694491
694648
|
mime: telegramImageMime(media)
|
|
694492
694649
|
},
|
|
694493
694650
|
this.agentConfig?.model ?? ""
|
|
@@ -694882,7 +695039,7 @@ ${text2}`.trim()
|
|
|
694882
695039
|
}
|
|
694883
695040
|
if (!existsSync151(media.value))
|
|
694884
695041
|
throw new Error(`File does not exist: ${media.value}`);
|
|
694885
|
-
const buffer2 =
|
|
695042
|
+
const buffer2 = readFileSync124(media.value);
|
|
694886
695043
|
const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
694887
695044
|
const filename = basename39(media.value);
|
|
694888
695045
|
const contentType = mimeForPath(media.value, media.kind);
|
|
@@ -694996,7 +695153,7 @@ Content-Type: ${contentType}\r
|
|
|
694996
695153
|
const sidecarPath2 = `${imagePath}.json`;
|
|
694997
695154
|
if (!existsSync151(sidecarPath2)) return null;
|
|
694998
695155
|
try {
|
|
694999
|
-
const raw =
|
|
695156
|
+
const raw = readFileSync124(sidecarPath2, "utf8");
|
|
695000
695157
|
const parsed = JSON.parse(raw);
|
|
695001
695158
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
695002
695159
|
return null;
|
|
@@ -695056,7 +695213,7 @@ Content-Type: ${contentType}\r
|
|
|
695056
695213
|
const sidecarPath2 = `${videoPath}.json`;
|
|
695057
695214
|
if (!existsSync151(sidecarPath2)) return null;
|
|
695058
695215
|
try {
|
|
695059
|
-
const raw =
|
|
695216
|
+
const raw = readFileSync124(sidecarPath2, "utf8");
|
|
695060
695217
|
const parsed = JSON.parse(raw);
|
|
695061
695218
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
695062
695219
|
return null;
|
|
@@ -695201,7 +695358,7 @@ Content-Type: ${contentType}\r
|
|
|
695201
695358
|
addField(field, pathOrFileId);
|
|
695202
695359
|
continue;
|
|
695203
695360
|
}
|
|
695204
|
-
const buffer2 =
|
|
695361
|
+
const buffer2 = readFileSync124(pathOrFileId);
|
|
695205
695362
|
const filename = basename39(pathOrFileId);
|
|
695206
695363
|
parts.push(Buffer.from(`--${boundary}\r
|
|
695207
695364
|
`));
|
|
@@ -697165,14 +697322,14 @@ __export(projects_exports, {
|
|
|
697165
697322
|
setCurrentProject: () => setCurrentProject,
|
|
697166
697323
|
unregisterProject: () => unregisterProject
|
|
697167
697324
|
});
|
|
697168
|
-
import { readFileSync as
|
|
697325
|
+
import { readFileSync as readFileSync125, writeFileSync as writeFileSync83, mkdirSync as mkdirSync95, existsSync as existsSync152, statSync as statSync55, renameSync as renameSync14 } from "node:fs";
|
|
697169
697326
|
import { homedir as homedir55 } from "node:os";
|
|
697170
697327
|
import { basename as basename40, join as join166, resolve as resolve68 } from "node:path";
|
|
697171
697328
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
697172
697329
|
function readAll2() {
|
|
697173
697330
|
try {
|
|
697174
697331
|
if (!existsSync152(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
|
|
697175
|
-
const raw =
|
|
697332
|
+
const raw = readFileSync125(PROJECTS_FILE, "utf8");
|
|
697176
697333
|
const parsed = JSON.parse(raw);
|
|
697177
697334
|
if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
|
|
697178
697335
|
return { projects: parsed.projects, schemaVersion: 1 };
|
|
@@ -697249,7 +697406,7 @@ function getCurrentProject() {
|
|
|
697249
697406
|
if (!currentRoot) {
|
|
697250
697407
|
try {
|
|
697251
697408
|
if (existsSync152(CURRENT_FILE)) {
|
|
697252
|
-
const persisted =
|
|
697409
|
+
const persisted = readFileSync125(CURRENT_FILE, "utf8").trim();
|
|
697253
697410
|
if (persisted) currentRoot = persisted;
|
|
697254
697411
|
}
|
|
697255
697412
|
} catch {
|
|
@@ -698163,7 +698320,7 @@ var init_access_policy = __esm({
|
|
|
698163
698320
|
|
|
698164
698321
|
// packages/cli/src/api/project-preferences.ts
|
|
698165
698322
|
import { createHash as createHash43 } from "node:crypto";
|
|
698166
|
-
import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as
|
|
698323
|
+
import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as readFileSync126, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync35 } from "node:fs";
|
|
698167
698324
|
import { homedir as homedir56 } from "node:os";
|
|
698168
698325
|
import { join as join167, resolve as resolve69 } from "node:path";
|
|
698169
698326
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
@@ -698196,7 +698353,7 @@ function readProjectPreferences(root) {
|
|
|
698196
698353
|
try {
|
|
698197
698354
|
const file = prefsPath(root);
|
|
698198
698355
|
if (!existsSync153(file)) return { ...DEFAULT_PREFS };
|
|
698199
|
-
const raw =
|
|
698356
|
+
const raw = readFileSync126(file, "utf8");
|
|
698200
698357
|
const parsed = JSON.parse(raw);
|
|
698201
698358
|
if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
|
|
698202
698359
|
return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
|
|
@@ -698263,7 +698420,7 @@ __export(audit_log_exports, {
|
|
|
698263
698420
|
recordAudit: () => recordAudit,
|
|
698264
698421
|
sanitizeBody: () => sanitizeBody
|
|
698265
698422
|
});
|
|
698266
|
-
import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as
|
|
698423
|
+
import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as readFileSync127, existsSync as existsSync154 } from "node:fs";
|
|
698267
698424
|
import { join as join168 } from "node:path";
|
|
698268
698425
|
function initAuditLog(omniusDir) {
|
|
698269
698426
|
auditDir = join168(omniusDir, "audit");
|
|
@@ -698300,7 +698457,7 @@ function sanitizeBody(body, maxLen = 200) {
|
|
|
698300
698457
|
function queryAudit(opts) {
|
|
698301
698458
|
if (!initialized || !existsSync154(auditFile)) return [];
|
|
698302
698459
|
try {
|
|
698303
|
-
const raw =
|
|
698460
|
+
const raw = readFileSync127(auditFile, "utf-8");
|
|
698304
698461
|
const lines = raw.split("\n").filter(Boolean);
|
|
698305
698462
|
let records = lines.map((l2) => {
|
|
698306
698463
|
try {
|
|
@@ -699273,7 +699430,7 @@ var init_direct_tool_registry = __esm({
|
|
|
699273
699430
|
});
|
|
699274
699431
|
|
|
699275
699432
|
// packages/cli/src/api/external-tool-registry.ts
|
|
699276
|
-
import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as
|
|
699433
|
+
import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as readFileSync128, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
|
|
699277
699434
|
import { join as join170 } from "node:path";
|
|
699278
699435
|
function externalToolStorePath(workingDir) {
|
|
699279
699436
|
return join170(workingDir, ".omnius", "external-tools.json");
|
|
@@ -699282,7 +699439,7 @@ function loadExternalTools(workingDir) {
|
|
|
699282
699439
|
const path12 = externalToolStorePath(workingDir);
|
|
699283
699440
|
if (!existsSync157(path12)) return [];
|
|
699284
699441
|
try {
|
|
699285
|
-
const parsed = JSON.parse(
|
|
699442
|
+
const parsed = JSON.parse(readFileSync128(path12, "utf-8"));
|
|
699286
699443
|
if (!parsed || !Array.isArray(parsed.tools)) return [];
|
|
699287
699444
|
return parsed.tools.filter(
|
|
699288
699445
|
(t2) => t2 && typeof t2.name === "string" && t2.transport != null
|
|
@@ -699621,7 +699778,7 @@ __export(aiwg_exports, {
|
|
|
699621
699778
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
699622
699779
|
tryRouteAiwg: () => tryRouteAiwg
|
|
699623
699780
|
});
|
|
699624
|
-
import { existsSync as existsSync158, readFileSync as
|
|
699781
|
+
import { existsSync as existsSync158, readFileSync as readFileSync129, readdirSync as readdirSync56, statSync as statSync58 } from "node:fs";
|
|
699625
699782
|
import { join as join171 } from "node:path";
|
|
699626
699783
|
import { homedir as homedir57 } from "node:os";
|
|
699627
699784
|
import { execSync as execSync38 } from "node:child_process";
|
|
@@ -699692,7 +699849,7 @@ function resolveAiwgRoot() {
|
|
|
699692
699849
|
const pj = join171(cur, "package.json");
|
|
699693
699850
|
if (existsSync158(pj)) {
|
|
699694
699851
|
try {
|
|
699695
|
-
const pkg = JSON.parse(
|
|
699852
|
+
const pkg = JSON.parse(readFileSync129(pj, "utf-8"));
|
|
699696
699853
|
if (pkg.name === "aiwg") {
|
|
699697
699854
|
_cachedAiwgRoot = cur;
|
|
699698
699855
|
return cur;
|
|
@@ -699782,7 +699939,7 @@ function readFirstLineDescription(dir) {
|
|
|
699782
699939
|
const p2 = join171(dir, candidate);
|
|
699783
699940
|
if (!existsSync158(p2)) continue;
|
|
699784
699941
|
try {
|
|
699785
|
-
const txt =
|
|
699942
|
+
const txt = readFileSync129(p2, "utf-8");
|
|
699786
699943
|
const descMatch = txt.match(/^description:\s*(.+)$/m);
|
|
699787
699944
|
if (descMatch) return descMatch[1].trim().slice(0, 200);
|
|
699788
699945
|
for (const line of txt.split("\n")) {
|
|
@@ -699833,7 +699990,7 @@ function walkForItems(dir, out, depth) {
|
|
|
699833
699990
|
}
|
|
699834
699991
|
function parseItem(p2) {
|
|
699835
699992
|
try {
|
|
699836
|
-
const raw =
|
|
699993
|
+
const raw = readFileSync129(p2, "utf-8");
|
|
699837
699994
|
const header = raw.slice(0, 3e3);
|
|
699838
699995
|
const nameMatch = header.match(/^name:\s*(.+)$/m);
|
|
699839
699996
|
const descMatch = header.match(/^description:\s*(.+)$/m);
|
|
@@ -699872,7 +700029,7 @@ function deriveSource(p2) {
|
|
|
699872
700029
|
function loadAiwgItemContent(path12, maxBytes = 2e4) {
|
|
699873
700030
|
try {
|
|
699874
700031
|
if (!existsSync158(path12)) return null;
|
|
699875
|
-
const raw =
|
|
700032
|
+
const raw = readFileSync129(path12, "utf-8");
|
|
699876
700033
|
return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
|
|
699877
700034
|
} catch {
|
|
699878
700035
|
return null;
|
|
@@ -700408,7 +700565,7 @@ __export(runtime_keys_exports, {
|
|
|
700408
700565
|
mintKey: () => mintKey,
|
|
700409
700566
|
revokeByPrefix: () => revokeByPrefix
|
|
700410
700567
|
});
|
|
700411
|
-
import { existsSync as existsSync159, readFileSync as
|
|
700568
|
+
import { existsSync as existsSync159, readFileSync as readFileSync130, writeFileSync as writeFileSync86, mkdirSync as mkdirSync101, chmodSync as chmodSync5 } from "node:fs";
|
|
700412
700569
|
import { join as join172 } from "node:path";
|
|
700413
700570
|
import { homedir as homedir58 } from "node:os";
|
|
700414
700571
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
@@ -700419,7 +700576,7 @@ function ensureDir2() {
|
|
|
700419
700576
|
function loadAll() {
|
|
700420
700577
|
if (!existsSync159(KEYS_FILE)) return [];
|
|
700421
700578
|
try {
|
|
700422
|
-
const raw =
|
|
700579
|
+
const raw = readFileSync130(KEYS_FILE, "utf-8");
|
|
700423
700580
|
const parsed = JSON.parse(raw);
|
|
700424
700581
|
if (!Array.isArray(parsed)) return [];
|
|
700425
700582
|
return parsed;
|
|
@@ -700505,7 +700662,7 @@ __export(tor_fallback_exports, {
|
|
|
700505
700662
|
torIsReachable: () => torIsReachable,
|
|
700506
700663
|
tunnelViaTor: () => tunnelViaTor
|
|
700507
700664
|
});
|
|
700508
|
-
import { existsSync as existsSync160, readFileSync as
|
|
700665
|
+
import { existsSync as existsSync160, readFileSync as readFileSync131 } from "node:fs";
|
|
700509
700666
|
import { homedir as homedir59 } from "node:os";
|
|
700510
700667
|
import { join as join173 } from "node:path";
|
|
700511
700668
|
import { createConnection as createConnection3 } from "node:net";
|
|
@@ -700518,7 +700675,7 @@ function getLocalOnion() {
|
|
|
700518
700675
|
for (const p2 of candidates) {
|
|
700519
700676
|
try {
|
|
700520
700677
|
if (existsSync160(p2)) {
|
|
700521
|
-
const v =
|
|
700678
|
+
const v = readFileSync131(p2, "utf-8").trim();
|
|
700522
700679
|
if (v && v.endsWith(".onion")) return v;
|
|
700523
700680
|
}
|
|
700524
700681
|
} catch {
|
|
@@ -700779,7 +700936,7 @@ var init_graphical_sudo = __esm({
|
|
|
700779
700936
|
});
|
|
700780
700937
|
|
|
700781
700938
|
// packages/cli/src/api/routes-v1.ts
|
|
700782
|
-
import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as
|
|
700939
|
+
import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as readFileSync132, readdirSync as readdirSync57, statSync as statSync59 } from "node:fs";
|
|
700783
700940
|
import { join as join175, resolve as pathResolve3 } from "node:path";
|
|
700784
700941
|
import { homedir as homedir60 } from "node:os";
|
|
700785
700942
|
async function tryRouteV1(ctx3) {
|
|
@@ -701063,7 +701220,7 @@ function walkForSkills(dir, out, depth) {
|
|
|
701063
701220
|
walkForSkills(p2, out, depth + 1);
|
|
701064
701221
|
} else if (e2.isFile() && e2.name === "SKILL.md") {
|
|
701065
701222
|
try {
|
|
701066
|
-
const content =
|
|
701223
|
+
const content = readFileSync132(p2, "utf-8").slice(0, 2e3);
|
|
701067
701224
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
701068
701225
|
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
701069
701226
|
out.push({
|
|
@@ -702019,7 +702176,7 @@ async function handleFilesRead(ctx3) {
|
|
|
702019
702176
|
}));
|
|
702020
702177
|
return true;
|
|
702021
702178
|
}
|
|
702022
|
-
const content =
|
|
702179
|
+
const content = readFileSync132(resolved, "utf-8");
|
|
702023
702180
|
const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
|
|
702024
702181
|
const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
|
|
702025
702182
|
const slice2 = content.slice(offset, offset + limit);
|
|
@@ -702321,7 +702478,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
702321
702478
|
for (const p2 of statePaths) {
|
|
702322
702479
|
if (!existsSync162(p2)) continue;
|
|
702323
702480
|
try {
|
|
702324
|
-
const raw =
|
|
702481
|
+
const raw = readFileSync132(p2, "utf-8");
|
|
702325
702482
|
states2.push({ source: p2, data: JSON.parse(raw) });
|
|
702326
702483
|
} catch (e2) {
|
|
702327
702484
|
states2.push({ source: p2, error: String(e2) });
|
|
@@ -702349,7 +702506,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
702349
702506
|
function loadAgentName() {
|
|
702350
702507
|
try {
|
|
702351
702508
|
const p2 = join175(homedir60(), ".omnius", "agent-name");
|
|
702352
|
-
if (existsSync162(p2)) return
|
|
702509
|
+
if (existsSync162(p2)) return readFileSync132(p2, "utf-8").trim();
|
|
702353
702510
|
} catch {
|
|
702354
702511
|
}
|
|
702355
702512
|
return null;
|
|
@@ -702365,7 +702522,7 @@ async function handleSponsors(ctx3) {
|
|
|
702365
702522
|
for (const p2 of candidates) {
|
|
702366
702523
|
if (!existsSync162(p2)) continue;
|
|
702367
702524
|
try {
|
|
702368
|
-
const raw = JSON.parse(
|
|
702525
|
+
const raw = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
702369
702526
|
if (Array.isArray(raw)) {
|
|
702370
702527
|
sponsors = raw;
|
|
702371
702528
|
break;
|
|
@@ -702445,7 +702602,7 @@ async function handleEvaluate(ctx3) {
|
|
|
702445
702602
|
}));
|
|
702446
702603
|
return true;
|
|
702447
702604
|
}
|
|
702448
|
-
const job = JSON.parse(
|
|
702605
|
+
const job = JSON.parse(readFileSync132(jobPath, "utf-8"));
|
|
702449
702606
|
sendJson2(res, 200, {
|
|
702450
702607
|
run_id: runId,
|
|
702451
702608
|
task: job.task,
|
|
@@ -702585,7 +702742,7 @@ async function handleMintKey(ctx3) {
|
|
|
702585
702742
|
function _readStatusFile(p2) {
|
|
702586
702743
|
if (!existsSync162(p2)) return null;
|
|
702587
702744
|
try {
|
|
702588
|
-
const data = JSON.parse(
|
|
702745
|
+
const data = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
702589
702746
|
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
702590
702747
|
const pid = Number(data.pid);
|
|
702591
702748
|
if (pid > 0) {
|
|
@@ -702628,7 +702785,7 @@ function resolveLocalPeerId() {
|
|
|
702628
702785
|
try {
|
|
702629
702786
|
const regPath = join175(homedir60(), ".omnius", "nexus-registry.json");
|
|
702630
702787
|
if (existsSync162(regPath)) {
|
|
702631
|
-
const reg = JSON.parse(
|
|
702788
|
+
const reg = JSON.parse(readFileSync132(regPath, "utf-8"));
|
|
702632
702789
|
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
702633
702790
|
for (const entry of entries) {
|
|
702634
702791
|
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
@@ -704141,7 +704298,7 @@ function aimsDir() {
|
|
|
704141
704298
|
function readAimsFile(name10, fallback) {
|
|
704142
704299
|
try {
|
|
704143
704300
|
const p2 = join175(aimsDir(), name10);
|
|
704144
|
-
if (existsSync162(p2)) return JSON.parse(
|
|
704301
|
+
if (existsSync162(p2)) return JSON.parse(readFileSync132(p2, "utf-8"));
|
|
704145
704302
|
} catch {
|
|
704146
704303
|
}
|
|
704147
704304
|
return fallback;
|
|
@@ -704518,7 +704675,7 @@ async function handleAimsSuppliers(ctx3) {
|
|
|
704518
704675
|
for (const p2 of sponsorPaths) {
|
|
704519
704676
|
if (!existsSync162(p2)) continue;
|
|
704520
704677
|
try {
|
|
704521
|
-
const raw = JSON.parse(
|
|
704678
|
+
const raw = JSON.parse(readFileSync132(p2, "utf-8"));
|
|
704522
704679
|
const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
|
|
704523
704680
|
for (const s2 of list) {
|
|
704524
704681
|
suppliers.push({
|
|
@@ -716474,7 +716631,7 @@ var init_auth_oidc = __esm({
|
|
|
716474
716631
|
});
|
|
716475
716632
|
|
|
716476
716633
|
// packages/cli/src/api/usage-tracker.ts
|
|
716477
|
-
import { mkdirSync as mkdirSync104, readFileSync as
|
|
716634
|
+
import { mkdirSync as mkdirSync104, readFileSync as readFileSync133, writeFileSync as writeFileSync88, existsSync as existsSync163 } from "node:fs";
|
|
716478
716635
|
import { join as join176 } from "node:path";
|
|
716479
716636
|
function initUsageTracker(omniusDir) {
|
|
716480
716637
|
const dir = join176(omniusDir, "usage");
|
|
@@ -716482,7 +716639,7 @@ function initUsageTracker(omniusDir) {
|
|
|
716482
716639
|
usageFile = join176(dir, "token-usage.json");
|
|
716483
716640
|
try {
|
|
716484
716641
|
if (existsSync163(usageFile)) {
|
|
716485
|
-
store = JSON.parse(
|
|
716642
|
+
store = JSON.parse(readFileSync133(usageFile, "utf-8"));
|
|
716486
716643
|
}
|
|
716487
716644
|
} catch {
|
|
716488
716645
|
store = { providers: {}, lastSaved: "" };
|
|
@@ -717181,7 +717338,7 @@ import {
|
|
|
717181
717338
|
createReadStream as createReadStream2,
|
|
717182
717339
|
mkdirSync as mkdirSync106,
|
|
717183
717340
|
writeFileSync as writeFileSync90,
|
|
717184
|
-
readFileSync as
|
|
717341
|
+
readFileSync as readFileSync134,
|
|
717185
717342
|
readdirSync as readdirSync58,
|
|
717186
717343
|
existsSync as existsSync165,
|
|
717187
717344
|
watch as fsWatch4,
|
|
@@ -717213,7 +717370,7 @@ function getVersion3() {
|
|
|
717213
717370
|
for (const pkgPath of candidates) {
|
|
717214
717371
|
try {
|
|
717215
717372
|
if (!existsSync165(pkgPath)) continue;
|
|
717216
|
-
const pkg = JSON.parse(
|
|
717373
|
+
const pkg = JSON.parse(readFileSync134(pkgPath, "utf8"));
|
|
717217
717374
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
717218
717375
|
return pkg.version ?? "0.0.0";
|
|
717219
717376
|
}
|
|
@@ -717629,7 +717786,7 @@ function isOriginAllowed(origin) {
|
|
|
717629
717786
|
try {
|
|
717630
717787
|
const accessFile = join179(homedir62(), ".omnius", "access");
|
|
717631
717788
|
if (existsSync165(accessFile)) {
|
|
717632
|
-
const persisted =
|
|
717789
|
+
const persisted = readFileSync134(accessFile, "utf8").trim().toLowerCase();
|
|
717633
717790
|
if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
|
|
717634
717791
|
accessMode = persisted;
|
|
717635
717792
|
}
|
|
@@ -718481,7 +718638,7 @@ function loadJob(id2) {
|
|
|
718481
718638
|
const file = join179(jobsDir(), `${id2}.json`);
|
|
718482
718639
|
if (!existsSync165(file)) return null;
|
|
718483
718640
|
try {
|
|
718484
|
-
return JSON.parse(
|
|
718641
|
+
return JSON.parse(readFileSync134(file, "utf-8"));
|
|
718485
718642
|
} catch {
|
|
718486
718643
|
return null;
|
|
718487
718644
|
}
|
|
@@ -718494,7 +718651,7 @@ function listJobs2() {
|
|
|
718494
718651
|
for (const file of files) {
|
|
718495
718652
|
try {
|
|
718496
718653
|
jobs.push(
|
|
718497
|
-
JSON.parse(
|
|
718654
|
+
JSON.parse(readFileSync134(join179(dir, file), "utf-8"))
|
|
718498
718655
|
);
|
|
718499
718656
|
} catch {
|
|
718500
718657
|
}
|
|
@@ -718512,7 +718669,7 @@ function pruneOldJobs() {
|
|
|
718512
718669
|
if (!file.endsWith(".json")) continue;
|
|
718513
718670
|
const path12 = join179(dir, file);
|
|
718514
718671
|
try {
|
|
718515
|
-
const job = JSON.parse(
|
|
718672
|
+
const job = JSON.parse(readFileSync134(path12, "utf-8"));
|
|
718516
718673
|
if (job.status === "running") {
|
|
718517
718674
|
kept++;
|
|
718518
718675
|
continue;
|
|
@@ -720668,7 +720825,7 @@ function readUpdateState() {
|
|
|
720668
720825
|
try {
|
|
720669
720826
|
const p2 = updateStateFile();
|
|
720670
720827
|
if (!existsSync165(p2)) return null;
|
|
720671
|
-
return JSON.parse(
|
|
720828
|
+
return JSON.parse(readFileSync134(p2, "utf-8"));
|
|
720672
720829
|
} catch {
|
|
720673
720830
|
return null;
|
|
720674
720831
|
}
|
|
@@ -720973,7 +721130,7 @@ function handleV1UpdateStatus(res) {
|
|
|
720973
721130
|
let exitCode = null;
|
|
720974
721131
|
try {
|
|
720975
721132
|
if (existsSync165(logPath3)) {
|
|
720976
|
-
const raw =
|
|
721133
|
+
const raw = readFileSync134(logPath3, "utf-8");
|
|
720977
721134
|
const m2 = raw.match(/__EXIT_CODE=(\d+)/);
|
|
720978
721135
|
if (m2) exitCode = parseInt(m2[1], 10);
|
|
720979
721136
|
logTail = raw.slice(-2e3);
|
|
@@ -723248,7 +723405,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
|
|
|
723248
723405
|
if (!result) {
|
|
723249
723406
|
jsonResponse(res, 500, {
|
|
723250
723407
|
error: "transcribe_unavailable",
|
|
723251
|
-
message: "
|
|
723408
|
+
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
723409
|
});
|
|
723253
723410
|
return;
|
|
723254
723411
|
}
|
|
@@ -725454,7 +725611,7 @@ function listScheduledTasks() {
|
|
|
725454
725611
|
if (dir.endsWith(`${join179(".omnius", "scheduled")}`) || dir.includes(`${join179(".omnius", "scheduled")}`)) {
|
|
725455
725612
|
const file = join179(dir, "tasks.json");
|
|
725456
725613
|
try {
|
|
725457
|
-
const raw =
|
|
725614
|
+
const raw = readFileSync134(file, "utf-8");
|
|
725458
725615
|
const json = JSON.parse(raw);
|
|
725459
725616
|
const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725460
725617
|
tasks.forEach((t2, i2) => {
|
|
@@ -725552,7 +725709,7 @@ function setScheduledEnabled(id2, enabled2) {
|
|
|
725552
725709
|
const target = tasks.find((t2) => t2.id === id2);
|
|
725553
725710
|
if (!target) return false;
|
|
725554
725711
|
try {
|
|
725555
|
-
const raw =
|
|
725712
|
+
const raw = readFileSync134(target.file, "utf-8");
|
|
725556
725713
|
const json = JSON.parse(raw);
|
|
725557
725714
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725558
725715
|
if (!arr[target.index]) return false;
|
|
@@ -725585,7 +725742,7 @@ function deleteScheduledById(id2) {
|
|
|
725585
725742
|
const target = tasks.find((t2) => t2.id === id2);
|
|
725586
725743
|
if (!target) return false;
|
|
725587
725744
|
try {
|
|
725588
|
-
const raw =
|
|
725745
|
+
const raw = readFileSync134(target.file, "utf-8");
|
|
725589
725746
|
const json = JSON.parse(raw);
|
|
725590
725747
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
725591
725748
|
if (!arr[target.index]) return false;
|
|
@@ -725810,7 +725967,7 @@ function reconcileScheduledTasks(apply) {
|
|
|
725810
725967
|
try {
|
|
725811
725968
|
let json = { tasks: [] };
|
|
725812
725969
|
try {
|
|
725813
|
-
const raw =
|
|
725970
|
+
const raw = readFileSync134(file, "utf-8");
|
|
725814
725971
|
json = JSON.parse(raw);
|
|
725815
725972
|
} catch {
|
|
725816
725973
|
}
|
|
@@ -726189,7 +726346,7 @@ function startApiServer(options2 = {}) {
|
|
|
726189
726346
|
const sid = f2.replace(/\.json$/, "");
|
|
726190
726347
|
try {
|
|
726191
726348
|
const items = JSON.parse(
|
|
726192
|
-
|
|
726349
|
+
readFileSync134(join179(dir, f2), "utf-8")
|
|
726193
726350
|
);
|
|
726194
726351
|
if (Array.isArray(items)) {
|
|
726195
726352
|
cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
|
|
@@ -726223,7 +726380,7 @@ function startApiServer(options2 = {}) {
|
|
|
726223
726380
|
}
|
|
726224
726381
|
return;
|
|
726225
726382
|
}
|
|
726226
|
-
next = JSON.parse(
|
|
726383
|
+
next = JSON.parse(readFileSync134(fp, "utf-8"));
|
|
726227
726384
|
if (!Array.isArray(next)) return;
|
|
726228
726385
|
} catch {
|
|
726229
726386
|
return;
|
|
@@ -726286,7 +726443,7 @@ function startApiServer(options2 = {}) {
|
|
|
726286
726443
|
if (!f2.endsWith(".json")) continue;
|
|
726287
726444
|
try {
|
|
726288
726445
|
const jobPath = join179(jobsDir3, f2);
|
|
726289
|
-
const job = JSON.parse(
|
|
726446
|
+
const job = JSON.parse(readFileSync134(jobPath, "utf-8"));
|
|
726290
726447
|
const jobTime = new Date(
|
|
726291
726448
|
job.startedAt ?? job.completedAt ?? 0
|
|
726292
726449
|
).getTime();
|
|
@@ -726308,8 +726465,8 @@ function startApiServer(options2 = {}) {
|
|
|
726308
726465
|
if (useTls) {
|
|
726309
726466
|
try {
|
|
726310
726467
|
tlsOpts = {
|
|
726311
|
-
cert:
|
|
726312
|
-
key:
|
|
726468
|
+
cert: readFileSync134(resolve71(tlsCert)),
|
|
726469
|
+
key: readFileSync134(resolve71(tlsKey))
|
|
726313
726470
|
};
|
|
726314
726471
|
} catch (e2) {
|
|
726315
726472
|
log22(`
|
|
@@ -726322,7 +726479,7 @@ function startApiServer(options2 = {}) {
|
|
|
726322
726479
|
try {
|
|
726323
726480
|
const accessFile = join179(homedir62(), ".omnius", "access");
|
|
726324
726481
|
if (existsSync165(accessFile)) {
|
|
726325
|
-
const persisted =
|
|
726482
|
+
const persisted = readFileSync134(accessFile, "utf8").trim();
|
|
726326
726483
|
const resolved = resolveAccessMode(persisted, host);
|
|
726327
726484
|
if (resolved) runtimeAccessMode = resolved;
|
|
726328
726485
|
}
|
|
@@ -726753,7 +726910,7 @@ function startApiServer(options2 = {}) {
|
|
|
726753
726910
|
for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
|
|
726754
726911
|
const p2 = join179(here, rel);
|
|
726755
726912
|
if (existsSync165(p2)) {
|
|
726756
|
-
const pkg = JSON.parse(
|
|
726913
|
+
const pkg = JSON.parse(readFileSync134(p2, "utf8"));
|
|
726757
726914
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
726758
726915
|
return pkg.version ?? null;
|
|
726759
726916
|
}
|
|
@@ -727769,7 +727926,7 @@ var clipboard_media_exports = {};
|
|
|
727769
727926
|
__export(clipboard_media_exports, {
|
|
727770
727927
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
727771
727928
|
});
|
|
727772
|
-
import { mkdirSync as mkdirSync107, readFileSync as
|
|
727929
|
+
import { mkdirSync as mkdirSync107, readFileSync as readFileSync135, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
|
|
727773
727930
|
import { join as join180 } from "node:path";
|
|
727774
727931
|
async function pasteClipboardImageToFile(repoRoot) {
|
|
727775
727932
|
const image = await readClipboardImage();
|
|
@@ -727786,7 +727943,7 @@ async function readClipboardImage() {
|
|
|
727786
727943
|
if (!await commandExists2("pngpaste", 1e3)) return null;
|
|
727787
727944
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
727788
727945
|
await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
|
|
727789
|
-
const buffer2 =
|
|
727946
|
+
const buffer2 = readFileSync135(tmp);
|
|
727790
727947
|
try {
|
|
727791
727948
|
rmSync15(tmp);
|
|
727792
727949
|
} catch {
|
|
@@ -727846,7 +728003,7 @@ import { resolve as resolve72, join as join181, dirname as dirname54, extname as
|
|
|
727846
728003
|
import { createRequire as createRequire9 } from "node:module";
|
|
727847
728004
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
727848
728005
|
import {
|
|
727849
|
-
readFileSync as
|
|
728006
|
+
readFileSync as readFileSync136,
|
|
727850
728007
|
writeFileSync as writeFileSync92,
|
|
727851
728008
|
appendFileSync as appendFileSync20,
|
|
727852
728009
|
rmSync as rmSync16,
|
|
@@ -729327,7 +729484,7 @@ function gatherMemorySnippets(root) {
|
|
|
729327
729484
|
if (!existsSync166(dir)) continue;
|
|
729328
729485
|
try {
|
|
729329
729486
|
for (const f2 of readdirSync59(dir).filter((f3) => f3.endsWith(".json"))) {
|
|
729330
|
-
const data = JSON.parse(
|
|
729487
|
+
const data = JSON.parse(readFileSync136(join181(dir, f2), "utf-8"));
|
|
729331
729488
|
for (const val of Object.values(data)) {
|
|
729332
729489
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
729333
729490
|
if (v.length > 10) snippets.push(v);
|
|
@@ -729799,7 +729956,7 @@ ${metabolismMemories}
|
|
|
729799
729956
|
try {
|
|
729800
729957
|
const archeFile = join181(repoRoot, ".omnius", "arche", "variants.json");
|
|
729801
729958
|
if (existsSync166(archeFile)) {
|
|
729802
|
-
const variants = JSON.parse(
|
|
729959
|
+
const variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
729803
729960
|
if (variants.length > 0) {
|
|
729804
729961
|
let filtered = variants;
|
|
729805
729962
|
if (taskType) {
|
|
@@ -729990,7 +730147,7 @@ ${skillPack}`;
|
|
|
729990
730147
|
"self-state.json"
|
|
729991
730148
|
);
|
|
729992
730149
|
if (existsSync166(ikStateFile)) {
|
|
729993
|
-
const selfState = JSON.parse(
|
|
730150
|
+
const selfState = JSON.parse(readFileSync136(ikStateFile, "utf8"));
|
|
729994
730151
|
const lines = [
|
|
729995
730152
|
`[Identity State v${selfState.version}]`,
|
|
729996
730153
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -730329,7 +730486,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
730329
730486
|
}
|
|
730330
730487
|
}
|
|
730331
730488
|
try {
|
|
730332
|
-
const { readdirSync: readdirSync61, readFileSync:
|
|
730489
|
+
const { readdirSync: readdirSync61, readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
730333
730490
|
const { join: pathJoin } = await import("node:path");
|
|
730334
730491
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
730335
730492
|
if (existsSync169(chunksDir)) {
|
|
@@ -730339,7 +730496,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
730339
730496
|
for (const f2 of files) {
|
|
730340
730497
|
try {
|
|
730341
730498
|
const data = JSON.parse(
|
|
730342
|
-
|
|
730499
|
+
readFileSync138(pathJoin(chunksDir, f2), "utf-8")
|
|
730343
730500
|
);
|
|
730344
730501
|
if (data._deleted) continue;
|
|
730345
730502
|
if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
|
|
@@ -730405,7 +730562,7 @@ ${lines.join("\n")}`
|
|
|
730405
730562
|
const expand2 = args.expand === true;
|
|
730406
730563
|
if (expand2 && id2.startsWith("todo-ctx-")) {
|
|
730407
730564
|
try {
|
|
730408
|
-
const { readFileSync:
|
|
730565
|
+
const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
|
|
730409
730566
|
const { join: pathJoin } = await import("node:path");
|
|
730410
730567
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
730411
730568
|
const todoIdSuffix = id2.replace("todo-ctx-", "");
|
|
@@ -731920,7 +732077,7 @@ async function startInteractive(config, repoPath2) {
|
|
|
731920
732077
|
const omniusDir = join181(repoRoot, ".omnius");
|
|
731921
732078
|
const nexusPidFile = join181(omniusDir, "nexus", "daemon.pid");
|
|
731922
732079
|
if (existsSync166(nexusPidFile)) {
|
|
731923
|
-
const pid = parseInt(
|
|
732080
|
+
const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
731924
732081
|
if (pid > 0) {
|
|
731925
732082
|
try {
|
|
731926
732083
|
process.kill(pid, 0);
|
|
@@ -733114,7 +733271,7 @@ This is an independent background session started from /background.`
|
|
|
733114
733271
|
try {
|
|
733115
733272
|
const titleFile = join181(repoRoot, ".omnius", "session-title");
|
|
733116
733273
|
if (existsSync166(titleFile))
|
|
733117
|
-
sessionTitle =
|
|
733274
|
+
sessionTitle = readFileSync136(titleFile, "utf8").trim() || null;
|
|
733118
733275
|
} catch {
|
|
733119
733276
|
}
|
|
733120
733277
|
let carouselRetired = isResumed;
|
|
@@ -733229,7 +733386,7 @@ This is an independent background session started from /background.`
|
|
|
733229
733386
|
let savedHistory = [];
|
|
733230
733387
|
try {
|
|
733231
733388
|
if (existsSync166(HISTORY_FILE)) {
|
|
733232
|
-
const raw =
|
|
733389
|
+
const raw = readFileSync136(HISTORY_FILE, "utf8").trim();
|
|
733233
733390
|
if (raw) savedHistory = raw.split("\n").reverse();
|
|
733234
733391
|
}
|
|
733235
733392
|
} catch {
|
|
@@ -733384,7 +733541,7 @@ This is an independent background session started from /background.`
|
|
|
733384
733541
|
mkdirSync108(HISTORY_DIR, { recursive: true });
|
|
733385
733542
|
appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
|
|
733386
733543
|
if (Math.random() < 0.02) {
|
|
733387
|
-
const all2 =
|
|
733544
|
+
const all2 = readFileSync136(HISTORY_FILE, "utf8").trim().split("\n");
|
|
733388
733545
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
733389
733546
|
writeFileSync92(
|
|
733390
733547
|
HISTORY_FILE,
|
|
@@ -733613,7 +733770,7 @@ This is an independent background session started from /background.`
|
|
|
733613
733770
|
const nexusPidFile = join181(autoNexus.getNexusDir(), "daemon.pid");
|
|
733614
733771
|
if (existsSync166(nexusPidFile)) {
|
|
733615
733772
|
const nPid = parseInt(
|
|
733616
|
-
|
|
733773
|
+
readFileSync136(nexusPidFile, "utf8").trim(),
|
|
733617
733774
|
10
|
|
733618
733775
|
);
|
|
733619
733776
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
@@ -733795,7 +733952,7 @@ Log: ${nexusLogPath}`
|
|
|
733795
733952
|
let agName = "";
|
|
733796
733953
|
try {
|
|
733797
733954
|
if (existsSync166(globalNamePath))
|
|
733798
|
-
agName =
|
|
733955
|
+
agName = readFileSync136(globalNamePath, "utf8").trim();
|
|
733799
733956
|
} catch {
|
|
733800
733957
|
}
|
|
733801
733958
|
if (!agName) {
|
|
@@ -733836,7 +733993,7 @@ Log: ${nexusLogPath}`
|
|
|
733836
733993
|
try {
|
|
733837
733994
|
if (existsSync166(savedSponsorsPath)) {
|
|
733838
733995
|
savedSponsors = JSON.parse(
|
|
733839
|
-
|
|
733996
|
+
readFileSync136(savedSponsorsPath, "utf8")
|
|
733840
733997
|
);
|
|
733841
733998
|
const oneHourAgo = Date.now() - 36e5;
|
|
733842
733999
|
savedSponsors = savedSponsors.filter(
|
|
@@ -735306,7 +735463,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
735306
735463
|
}
|
|
735307
735464
|
const available = await engine.isAvailable();
|
|
735308
735465
|
if (!available) {
|
|
735309
|
-
return "transcribe-cli
|
|
735466
|
+
return "ASR runtime unavailable. Omnius attempted managed transcribe-cli and Whisper fallback setup; check ~/.omnius/runtimes/asr and ~/.omnius/venv.";
|
|
735310
735467
|
}
|
|
735311
735468
|
engine.on("transcript", (text2, isFinal) => {
|
|
735312
735469
|
if (engine.currentMode === "confirm") {
|
|
@@ -735999,7 +736156,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
735999
736156
|
try {
|
|
736000
736157
|
const nexusPidFile = join181(nexusTool.getNexusDir(), "daemon.pid");
|
|
736001
736158
|
if (existsSync166(nexusPidFile)) {
|
|
736002
|
-
const pid = parseInt(
|
|
736159
|
+
const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
736003
736160
|
if (pid > 0) {
|
|
736004
736161
|
registry2.register({
|
|
736005
736162
|
name: "Nexus",
|
|
@@ -736212,7 +736369,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736212
736369
|
const nexusDir = join181(repoRoot, OMNIUS_DIR, "nexus");
|
|
736213
736370
|
const pidFile = join181(nexusDir, "daemon.pid");
|
|
736214
736371
|
if (existsSync166(pidFile)) {
|
|
736215
|
-
const pid = parseInt(
|
|
736372
|
+
const pid = parseInt(readFileSync136(pidFile, "utf8").trim(), 10);
|
|
736216
736373
|
if (pid > 0) {
|
|
736217
736374
|
try {
|
|
736218
736375
|
if (process.platform === "win32") {
|
|
@@ -736242,7 +736399,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736242
736399
|
const pidPath = join181(voiceDir3, pf);
|
|
736243
736400
|
if (existsSync166(pidPath)) {
|
|
736244
736401
|
try {
|
|
736245
|
-
const pid = parseInt(
|
|
736402
|
+
const pid = parseInt(readFileSync136(pidPath, "utf8").trim(), 10);
|
|
736246
736403
|
if (pid > 0) {
|
|
736247
736404
|
if (process.platform === "win32") {
|
|
736248
736405
|
try {
|
|
@@ -736383,8 +736540,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736383
736540
|
"daemon.port"
|
|
736384
736541
|
);
|
|
736385
736542
|
if (existsSync166(ppPidFile)) {
|
|
736386
|
-
const ppPid = parseInt(
|
|
736387
|
-
const ppPort = existsSync166(ppPortFile) ? parseInt(
|
|
736543
|
+
const ppPid = parseInt(readFileSync136(ppPidFile, "utf8").trim(), 10);
|
|
736544
|
+
const ppPort = existsSync166(ppPortFile) ? parseInt(readFileSync136(ppPortFile, "utf8").trim(), 10) : void 0;
|
|
736388
736545
|
if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
|
|
736389
736546
|
registry2.register({
|
|
736390
736547
|
name: "PersonaPlex",
|
|
@@ -736401,7 +736558,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
736401
736558
|
"daemon.pid"
|
|
736402
736559
|
);
|
|
736403
736560
|
if (existsSync166(nexusPidFile)) {
|
|
736404
|
-
const nPid = parseInt(
|
|
736561
|
+
const nPid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
|
|
736405
736562
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
736406
736563
|
try {
|
|
736407
736564
|
process.kill(nPid, 0);
|
|
@@ -736845,7 +737002,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
736845
737002
|
if (isImage) {
|
|
736846
737003
|
try {
|
|
736847
737004
|
const imgPath = resolve72(repoRoot, cleanPath);
|
|
736848
|
-
const imgBuffer =
|
|
737005
|
+
const imgBuffer = readFileSync136(imgPath);
|
|
736849
737006
|
const base642 = imgBuffer.toString("base64");
|
|
736850
737007
|
const ext = extname22(cleanPath).toLowerCase();
|
|
736851
737008
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -737048,7 +737205,7 @@ ${result.text}`;
|
|
|
737048
737205
|
try {
|
|
737049
737206
|
const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
|
|
737050
737207
|
const ingressResult = await runVisionIngress2(
|
|
737051
|
-
{ path: imgPath, buffer:
|
|
737208
|
+
{ path: imgPath, buffer: readFileSync136(imgPath), mime },
|
|
737052
737209
|
currentConfig.model ?? ""
|
|
737053
737210
|
);
|
|
737054
737211
|
visionContext = formatImageContextPrefix2(ingressResult);
|
|
@@ -737116,7 +737273,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
|
|
|
737116
737273
|
if (isMarkdown && fullInput === input) {
|
|
737117
737274
|
try {
|
|
737118
737275
|
const mdPath = resolve72(repoRoot, cleanPath);
|
|
737119
|
-
const mdContent =
|
|
737276
|
+
const mdContent = readFileSync136(mdPath, "utf8");
|
|
737120
737277
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
737121
737278
|
const result = parseMcpMarkdown2(mdContent);
|
|
737122
737279
|
if (result.servers.length > 0) {
|
|
@@ -737776,7 +737933,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737776
737933
|
const ikFile = join181(ikDir, "self-state.json");
|
|
737777
737934
|
let ikState;
|
|
737778
737935
|
if (existsSync166(ikFile)) {
|
|
737779
|
-
ikState = JSON.parse(
|
|
737936
|
+
ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
|
|
737780
737937
|
} else {
|
|
737781
737938
|
mkdirSync108(ikDir, { recursive: true });
|
|
737782
737939
|
ikState = {
|
|
@@ -737849,7 +738006,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737849
738006
|
let variants = [];
|
|
737850
738007
|
try {
|
|
737851
738008
|
if (existsSync166(archeFile))
|
|
737852
|
-
variants = JSON.parse(
|
|
738009
|
+
variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
737853
738010
|
} catch {
|
|
737854
738011
|
}
|
|
737855
738012
|
variants.push({
|
|
@@ -737877,7 +738034,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
737877
738034
|
"store.json"
|
|
737878
738035
|
);
|
|
737879
738036
|
if (existsSync166(metaFile2)) {
|
|
737880
|
-
const store2 = JSON.parse(
|
|
738037
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
737881
738038
|
const surfaced = store2.filter(
|
|
737882
738039
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
737883
738040
|
).sort(
|
|
@@ -737980,7 +738137,7 @@ Rules:
|
|
|
737980
738137
|
let store2 = [];
|
|
737981
738138
|
try {
|
|
737982
738139
|
if (existsSync166(storeFile))
|
|
737983
|
-
store2 = JSON.parse(
|
|
738140
|
+
store2 = JSON.parse(readFileSync136(storeFile, "utf8"));
|
|
737984
738141
|
} catch {
|
|
737985
738142
|
}
|
|
737986
738143
|
store2.push({
|
|
@@ -738014,7 +738171,7 @@ Rules:
|
|
|
738014
738171
|
let cohereActive = false;
|
|
738015
738172
|
try {
|
|
738016
738173
|
if (existsSync166(cohereSettingsFile)) {
|
|
738017
|
-
const settings = JSON.parse(
|
|
738174
|
+
const settings = JSON.parse(readFileSync136(cohereSettingsFile, "utf8"));
|
|
738018
738175
|
cohereActive = settings.cohere === true;
|
|
738019
738176
|
}
|
|
738020
738177
|
} catch {
|
|
@@ -738028,7 +738185,7 @@ Rules:
|
|
|
738028
738185
|
"store.json"
|
|
738029
738186
|
);
|
|
738030
738187
|
if (existsSync166(metaFile2)) {
|
|
738031
|
-
const store2 = JSON.parse(
|
|
738188
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
738032
738189
|
const latest = store2.filter(
|
|
738033
738190
|
(m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
|
|
738034
738191
|
).slice(-1)[0];
|
|
@@ -738061,7 +738218,7 @@ Rules:
|
|
|
738061
738218
|
try {
|
|
738062
738219
|
const ikFile = join181(repoRoot, ".omnius", "identity", "self-state.json");
|
|
738063
738220
|
if (existsSync166(ikFile)) {
|
|
738064
|
-
const ikState = JSON.parse(
|
|
738221
|
+
const ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
|
|
738065
738222
|
ikState.homeostasis.uncertainty = Math.min(
|
|
738066
738223
|
1,
|
|
738067
738224
|
ikState.homeostasis.uncertainty + 0.1
|
|
@@ -738082,7 +738239,7 @@ Rules:
|
|
|
738082
738239
|
"store.json"
|
|
738083
738240
|
);
|
|
738084
738241
|
if (existsSync166(metaFile2)) {
|
|
738085
|
-
const store2 = JSON.parse(
|
|
738242
|
+
const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
|
|
738086
738243
|
const surfaced = store2.filter(
|
|
738087
738244
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
738088
738245
|
).sort(
|
|
@@ -738108,7 +738265,7 @@ Rules:
|
|
|
738108
738265
|
let variants = [];
|
|
738109
738266
|
try {
|
|
738110
738267
|
if (existsSync166(archeFile))
|
|
738111
|
-
variants = JSON.parse(
|
|
738268
|
+
variants = JSON.parse(readFileSync136(archeFile, "utf8"));
|
|
738112
738269
|
} catch {
|
|
738113
738270
|
}
|
|
738114
738271
|
variants.push({
|
|
@@ -738247,7 +738404,7 @@ import { spawn as spawn38 } from "node:child_process";
|
|
|
738247
738404
|
import {
|
|
738248
738405
|
mkdirSync as mkdirSync109,
|
|
738249
738406
|
writeFileSync as writeFileSync93,
|
|
738250
|
-
readFileSync as
|
|
738407
|
+
readFileSync as readFileSync137,
|
|
738251
738408
|
readdirSync as readdirSync60,
|
|
738252
738409
|
existsSync as existsSync167
|
|
738253
738410
|
} from "node:fs";
|
|
@@ -738455,7 +738612,7 @@ function statusCommand(jobId, repoPath2) {
|
|
|
738455
738612
|
console.log(`Available jobs: omnius jobs`);
|
|
738456
738613
|
process.exit(1);
|
|
738457
738614
|
}
|
|
738458
|
-
const job = JSON.parse(
|
|
738615
|
+
const job = JSON.parse(readFileSync137(file, "utf-8"));
|
|
738459
738616
|
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
738617
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
738461
738618
|
console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
|
|
@@ -738477,7 +738634,7 @@ function jobsCommand(repoPath2) {
|
|
|
738477
738634
|
console.log("Jobs:");
|
|
738478
738635
|
for (const file of files) {
|
|
738479
738636
|
try {
|
|
738480
|
-
const job = JSON.parse(
|
|
738637
|
+
const job = JSON.parse(readFileSync137(join182(dir, file), "utf-8"));
|
|
738481
738638
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
738482
738639
|
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
738640
|
const cleanListTask = cleanForStorage(job.task) || job.task;
|