omnius 1.0.436 → 1.0.437
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 +566 -354
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11530,7 +11530,11 @@ var init_vision = __esm({
|
|
|
11530
11530
|
},
|
|
11531
11531
|
device: {
|
|
11532
11532
|
type: "string",
|
|
11533
|
-
description: "Optional camera device for auto-capture when image/path/file is omitted."
|
|
11533
|
+
description: "Optional camera device for auto-capture when image/path/file is omitted. Uses the shared /live or /camera preset for rotation, resolution, and FPS."
|
|
11534
|
+
},
|
|
11535
|
+
camera: {
|
|
11536
|
+
type: "string",
|
|
11537
|
+
description: "Alias for device when auto-capturing from a camera."
|
|
11534
11538
|
},
|
|
11535
11539
|
length: {
|
|
11536
11540
|
type: "string",
|
|
@@ -11701,7 +11705,8 @@ ${lastPointDiagnostics.slice(-8).map((line) => ` - ${line}`).join("\n")}
|
|
|
11701
11705
|
}
|
|
11702
11706
|
}
|
|
11703
11707
|
async captureEnvironmentFrame(args) {
|
|
11704
|
-
const
|
|
11708
|
+
const requestedDevice = typeof args["device"] === "string" ? args["device"] : typeof args["camera"] === "string" ? args["camera"] : void 0;
|
|
11709
|
+
const liveFrame = requestedDevice ? null : this.latestLiveFramePath();
|
|
11705
11710
|
if (liveFrame)
|
|
11706
11711
|
return { ok: true, path: liveFrame };
|
|
11707
11712
|
const captureDir = join14(process.env["TMPDIR"] || "/tmp", "omnius-vision");
|
|
@@ -11713,9 +11718,7 @@ ${lastPointDiagnostics.slice(-8).map((line) => ` - ${line}`).join("\n")}
|
|
|
11713
11718
|
const result = await new CameraCaptureTool().execute({
|
|
11714
11719
|
action: "capture",
|
|
11715
11720
|
output_path: outputPath3,
|
|
11716
|
-
device:
|
|
11717
|
-
width: 1920,
|
|
11718
|
-
height: 1080
|
|
11721
|
+
device: requestedDevice
|
|
11719
11722
|
});
|
|
11720
11723
|
if (result.success && existsSync16(outputPath3))
|
|
11721
11724
|
return { ok: true, path: outputPath3 };
|
|
@@ -276282,11 +276285,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
276282
276285
|
* what was previously computed. */
|
|
276283
276286
|
async loadSessionInfo() {
|
|
276284
276287
|
try {
|
|
276285
|
-
const { readFileSync:
|
|
276288
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
276286
276289
|
const sessionPath2 = join45(this.cwd, ".omnius", "rlm", "session.json");
|
|
276287
276290
|
if (!existsSync173(sessionPath2))
|
|
276288
276291
|
return null;
|
|
276289
|
-
return JSON.parse(
|
|
276292
|
+
return JSON.parse(readFileSync142(sessionPath2, "utf8"));
|
|
276290
276293
|
} catch {
|
|
276291
276294
|
return null;
|
|
276292
276295
|
}
|
|
@@ -276473,10 +276476,10 @@ var init_memory_metabolism = __esm({
|
|
|
276473
276476
|
const trajDir = join46(this.cwd, ".omnius", "rlm-trajectories");
|
|
276474
276477
|
let lessons = [];
|
|
276475
276478
|
try {
|
|
276476
|
-
const { readdirSync: readdirSync62, readFileSync:
|
|
276479
|
+
const { readdirSync: readdirSync62, readFileSync: readFileSync142 } = await import("node:fs");
|
|
276477
276480
|
const files = readdirSync62(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
276478
276481
|
for (const file of files) {
|
|
276479
|
-
const lines =
|
|
276482
|
+
const lines = readFileSync142(join46(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
|
|
276480
276483
|
for (const line of lines) {
|
|
276481
276484
|
try {
|
|
276482
276485
|
const entry = JSON.parse(line);
|
|
@@ -276860,14 +276863,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
276860
276863
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
276861
276864
|
*/
|
|
276862
276865
|
getTopMemoriesSync(k = 5, taskType) {
|
|
276863
|
-
const { readFileSync:
|
|
276866
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
276864
276867
|
const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
|
|
276865
276868
|
const storeFile = join46(metaDir, "store.json");
|
|
276866
276869
|
if (!existsSync173(storeFile))
|
|
276867
276870
|
return "";
|
|
276868
276871
|
let store2 = [];
|
|
276869
276872
|
try {
|
|
276870
|
-
store2 = JSON.parse(
|
|
276873
|
+
store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
|
|
276871
276874
|
} catch {
|
|
276872
276875
|
return "";
|
|
276873
276876
|
}
|
|
@@ -276889,14 +276892,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
276889
276892
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
276890
276893
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
276891
276894
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
276892
|
-
const { readFileSync:
|
|
276895
|
+
const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
|
|
276893
276896
|
const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
|
|
276894
276897
|
const storeFile = join46(metaDir, "store.json");
|
|
276895
276898
|
if (!existsSync173(storeFile))
|
|
276896
276899
|
return;
|
|
276897
276900
|
let store2 = [];
|
|
276898
276901
|
try {
|
|
276899
|
-
store2 = JSON.parse(
|
|
276902
|
+
store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
|
|
276900
276903
|
} catch {
|
|
276901
276904
|
return;
|
|
276902
276905
|
}
|
|
@@ -277343,13 +277346,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
277343
277346
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
277344
277347
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
277345
277348
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
277346
|
-
const { readFileSync:
|
|
277349
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
277347
277350
|
const archiveFile = join48(this.cwd, ".omnius", "arche", "variants.json");
|
|
277348
277351
|
if (!existsSync173(archiveFile))
|
|
277349
277352
|
return "";
|
|
277350
277353
|
let variants = [];
|
|
277351
277354
|
try {
|
|
277352
|
-
variants = JSON.parse(
|
|
277355
|
+
variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
|
|
277353
277356
|
} catch {
|
|
277354
277357
|
return "";
|
|
277355
277358
|
}
|
|
@@ -277367,13 +277370,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
277367
277370
|
}
|
|
277368
277371
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
277369
277372
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
277370
|
-
const { readFileSync:
|
|
277373
|
+
const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
|
|
277371
277374
|
const dir = join48(this.cwd, ".omnius", "arche");
|
|
277372
277375
|
const archiveFile = join48(dir, "variants.json");
|
|
277373
277376
|
let variants = [];
|
|
277374
277377
|
try {
|
|
277375
277378
|
if (existsSync173(archiveFile))
|
|
277376
|
-
variants = JSON.parse(
|
|
277379
|
+
variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
|
|
277377
277380
|
} catch {
|
|
277378
277381
|
}
|
|
277379
277382
|
variants.push({
|
|
@@ -556571,6 +556574,9 @@ def main():
|
|
|
556571
556574
|
source = cfg["source"]
|
|
556572
556575
|
media_path = None
|
|
556573
556576
|
rotate_degrees = int(cfg.get("rotate_degrees") or 0)
|
|
556577
|
+
capture_width = int(cfg.get("width") or 0)
|
|
556578
|
+
capture_height = int(cfg.get("height") or 0)
|
|
556579
|
+
capture_fps = float(cfg.get("fps") or cfg.get("framerate") or 0)
|
|
556574
556580
|
|
|
556575
556581
|
try:
|
|
556576
556582
|
import cv2
|
|
@@ -556620,6 +556626,13 @@ def main():
|
|
|
556620
556626
|
if not cap.isOpened():
|
|
556621
556627
|
print(json.dumps({"success": False, "error": "could not open media source: " + str(source_for_cv)}))
|
|
556622
556628
|
return
|
|
556629
|
+
if source_kind == "camera":
|
|
556630
|
+
if capture_width > 0:
|
|
556631
|
+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, capture_width)
|
|
556632
|
+
if capture_height > 0:
|
|
556633
|
+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, capture_height)
|
|
556634
|
+
if capture_fps > 0:
|
|
556635
|
+
cap.set(cv2.CAP_PROP_FPS, capture_fps)
|
|
556623
556636
|
|
|
556624
556637
|
yolo_model = cfg.get("yolo_model") or "yolo26n.pt"
|
|
556625
556638
|
yoloe_classes = [str(x).strip() for x in (cfg.get("yoloe_classes") or []) if str(x).strip()]
|
|
@@ -556907,6 +556920,10 @@ var init_live_media_loop = __esm({
|
|
|
556907
556920
|
rotate_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Clockwise correction applied to sampled frames before object tracking and face crops." },
|
|
556908
556921
|
rotation_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Alias for rotate_degrees." },
|
|
556909
556922
|
rotate: { type: "string", enum: ["none", "cw", "ccw", "180", "clockwise", "counterclockwise"], description: "Optional human-readable rotation alias." },
|
|
556923
|
+
width: { type: "number", description: "Requested camera capture width when source_kind=camera. /live passes the shared /camera preset." },
|
|
556924
|
+
height: { type: "number", description: "Requested camera capture height when source_kind=camera. /live passes the shared /camera preset." },
|
|
556925
|
+
fps: { type: "number", description: "Requested camera FPS when source_kind=camera. /live passes the shared /camera preset." },
|
|
556926
|
+
framerate: { type: "number", description: "Alias for fps." },
|
|
556910
556927
|
duration_sec: { type: "number", description: "Bounded watch duration, default 8" },
|
|
556911
556928
|
sample_interval_sec: { type: "number", description: "Seconds between sampled frames, default 1" },
|
|
556912
556929
|
max_frames: { type: "number", description: "Max sampled frames, default 8" },
|
|
@@ -557080,6 +557097,9 @@ var init_live_media_loop = __esm({
|
|
|
557080
557097
|
sample_interval_sec: Number(args["sample_interval_sec"] ?? 1),
|
|
557081
557098
|
max_frames: Number(args["max_frames"] ?? 8),
|
|
557082
557099
|
rotate_degrees: rotation,
|
|
557100
|
+
width: Number(args["width"] ?? 0),
|
|
557101
|
+
height: Number(args["height"] ?? 0),
|
|
557102
|
+
fps: Number(args["fps"] ?? args["framerate"] ?? 0),
|
|
557083
557103
|
end2end: optionalBoolean(args, "end2end"),
|
|
557084
557104
|
yoloe_classes: stringListFromArg(args["yoloe_classes"] ?? args["classes"]),
|
|
557085
557105
|
yoloe_prompt_mode: String(args["yoloe_prompt_mode"] ?? args["prompt_mode"] ?? ""),
|
|
@@ -569345,9 +569365,9 @@ var init_reflectionBuffer = __esm({
|
|
|
569345
569365
|
this.persistPath = persistPath ?? null;
|
|
569346
569366
|
if (this.persistPath) {
|
|
569347
569367
|
try {
|
|
569348
|
-
const { readFileSync:
|
|
569368
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
569349
569369
|
if (existsSync173(this.persistPath)) {
|
|
569350
|
-
this.state = JSON.parse(
|
|
569370
|
+
this.state = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
|
|
569351
569371
|
return;
|
|
569352
569372
|
}
|
|
569353
569373
|
} catch {
|
|
@@ -573597,9 +573617,9 @@ var init_adversaryStream = __esm({
|
|
|
573597
573617
|
if (!this.persistPath)
|
|
573598
573618
|
return;
|
|
573599
573619
|
try {
|
|
573600
|
-
const { readFileSync:
|
|
573620
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
573601
573621
|
if (existsSync173(this.persistPath)) {
|
|
573602
|
-
const data = JSON.parse(
|
|
573622
|
+
const data = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
|
|
573603
573623
|
if (Array.isArray(data?.ledger))
|
|
573604
573624
|
this.ledger = data.ledger.slice(-100);
|
|
573605
573625
|
}
|
|
@@ -592270,8 +592290,8 @@ ${telegramPersonaHead}` : stripped
|
|
|
592270
592290
|
let recoveredTokens = 0;
|
|
592271
592291
|
for (const [filePath, entry] of entries) {
|
|
592272
592292
|
try {
|
|
592273
|
-
const { readFileSync:
|
|
592274
|
-
const content =
|
|
592293
|
+
const { readFileSync: readFileSync142 } = await import("node:fs");
|
|
592294
|
+
const content = readFileSync142(filePath, "utf8");
|
|
592275
592295
|
const tokenEst = Math.ceil(content.length / 4);
|
|
592276
592296
|
if (recoveredTokens + tokenEst > fileRecoveryBudget)
|
|
592277
592297
|
break;
|
|
@@ -594245,7 +594265,7 @@ ${result}`
|
|
|
594245
594265
|
const buffer2 = Buffer.from(rawBase64, "base64");
|
|
594246
594266
|
let resizedBase64 = null;
|
|
594247
594267
|
try {
|
|
594248
|
-
const { writeFileSync: writeFileSync95, readFileSync:
|
|
594268
|
+
const { writeFileSync: writeFileSync95, readFileSync: readFileSync142, unlinkSync: unlinkSync38 } = await import("node:fs");
|
|
594249
594269
|
const { join: join188 } = await import("node:path");
|
|
594250
594270
|
const { tmpdir: tmpdir26 } = await import("node:os");
|
|
594251
594271
|
const tmpIn = join188(tmpdir26(), `omnius_img_in_${Date.now()}.png`);
|
|
@@ -594260,7 +594280,7 @@ ${result}`
|
|
|
594260
594280
|
`img.save(${JSON.stringify(tmpOut)}, 'JPEG', quality=75)`
|
|
594261
594281
|
].join("; ");
|
|
594262
594282
|
await execFileText4(pyBin, ["-c", resizeScript], { timeout: 1e4 });
|
|
594263
|
-
const resizedBuf =
|
|
594283
|
+
const resizedBuf = readFileSync142(tmpOut);
|
|
594264
594284
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
594265
594285
|
try {
|
|
594266
594286
|
unlinkSync38(tmpIn);
|
|
@@ -603330,7 +603350,7 @@ __export(py_embed_exports, {
|
|
|
603330
603350
|
runTranscribeFile: () => runTranscribeFile
|
|
603331
603351
|
});
|
|
603332
603352
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
603333
|
-
import { existsSync as existsSync110, mkdirSync as mkdirSync67, writeFileSync as writeFileSync56 } from "node:fs";
|
|
603353
|
+
import { existsSync as existsSync110, mkdirSync as mkdirSync67, readFileSync as readFileSync90, writeFileSync as writeFileSync56 } from "node:fs";
|
|
603334
603354
|
import { join as join125 } from "node:path";
|
|
603335
603355
|
import { homedir as homedir39 } from "node:os";
|
|
603336
603356
|
function getVenvDir() {
|
|
@@ -603342,6 +603362,88 @@ function getVenvPython() {
|
|
|
603342
603362
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
603343
603363
|
return join125(base3, bin, exe);
|
|
603344
603364
|
}
|
|
603365
|
+
function asrCpuAllowed() {
|
|
603366
|
+
const raw = String(process.env["OMNIUS_ASR_ALLOW_CPU"] ?? "").trim().toLowerCase();
|
|
603367
|
+
return raw === "1" || raw === "true" || raw === "yes" || raw === "on";
|
|
603368
|
+
}
|
|
603369
|
+
function isJetsonHost2() {
|
|
603370
|
+
if (process.arch !== "arm64" && process.arch !== "arm") return false;
|
|
603371
|
+
if (existsSync110("/etc/nv_tegra_release")) return true;
|
|
603372
|
+
if (existsSync110("/usr/local/cuda/targets/aarch64-linux")) return true;
|
|
603373
|
+
if (process.env["JETSON_L4T_VERSION"]) return true;
|
|
603374
|
+
try {
|
|
603375
|
+
const model = readFileSync90("/proc/device-tree/model", "utf8").replace(/\0/g, " ");
|
|
603376
|
+
return /\b(nvidia|jetson|orin|tegra)\b/i.test(model);
|
|
603377
|
+
} catch {
|
|
603378
|
+
return false;
|
|
603379
|
+
}
|
|
603380
|
+
}
|
|
603381
|
+
function enableVenvSystemSitePackages(venv = getVenvDir()) {
|
|
603382
|
+
const cfg = join125(venv, "pyvenv.cfg");
|
|
603383
|
+
if (!existsSync110(cfg)) return;
|
|
603384
|
+
try {
|
|
603385
|
+
const raw = readFileSync90(cfg, "utf8");
|
|
603386
|
+
const next = /include-system-site-packages\s*=/.test(raw) ? raw.replace(/include-system-site-packages\s*=\s*(?:true|false)/i, "include-system-site-packages = true") : `${raw.trimEnd()}
|
|
603387
|
+
include-system-site-packages = true
|
|
603388
|
+
`;
|
|
603389
|
+
if (next !== raw) writeFileSync56(cfg, next, "utf8");
|
|
603390
|
+
} catch {
|
|
603391
|
+
}
|
|
603392
|
+
}
|
|
603393
|
+
function cudaHardwarePresent() {
|
|
603394
|
+
if (existsSync110("/dev/nvidiactl")) return true;
|
|
603395
|
+
if (existsSync110("/sys/devices/gpu.0")) return true;
|
|
603396
|
+
if (existsSync110("/usr/local/cuda")) return true;
|
|
603397
|
+
return isJetsonHost2();
|
|
603398
|
+
}
|
|
603399
|
+
function jetsonPytorchIndex() {
|
|
603400
|
+
let jpVer = "v60";
|
|
603401
|
+
try {
|
|
603402
|
+
const tegra = existsSync110("/etc/nv_tegra_release") ? readFileSync90("/etc/nv_tegra_release", "utf8") : "";
|
|
603403
|
+
const env2 = process.env["JETSON_L4T_VERSION"] || "";
|
|
603404
|
+
if (env2.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34")) jpVer = "v51";
|
|
603405
|
+
else if (env2.startsWith("6.1") || tegra.includes("R36.4")) jpVer = "v61";
|
|
603406
|
+
else if (env2.startsWith("6.") || tegra.includes("R36")) jpVer = "v60";
|
|
603407
|
+
} catch {
|
|
603408
|
+
}
|
|
603409
|
+
return `https://developer.download.nvidia.com/compute/redist/jp/${jpVer}/pytorch/`;
|
|
603410
|
+
}
|
|
603411
|
+
function jetsonTorchInstallSource() {
|
|
603412
|
+
const wheel = String(process.env["OMNIUS_JETSON_TORCH_WHEEL"] || process.env["JETSON_TORCH_WHEEL"] || "").trim();
|
|
603413
|
+
if (wheel) {
|
|
603414
|
+
return {
|
|
603415
|
+
source: wheel,
|
|
603416
|
+
args: ["install", "--upgrade", "--force-reinstall", "--no-deps", wheel]
|
|
603417
|
+
};
|
|
603418
|
+
}
|
|
603419
|
+
const indexUrl = jetsonPytorchIndex();
|
|
603420
|
+
return {
|
|
603421
|
+
source: indexUrl,
|
|
603422
|
+
args: ["install", "--upgrade", "--force-reinstall", "--no-deps", "--index-url", indexUrl, "torch"]
|
|
603423
|
+
};
|
|
603424
|
+
}
|
|
603425
|
+
function torchCudaProbe(py = getVenvPython()) {
|
|
603426
|
+
const probe = spawnSync8(
|
|
603427
|
+
py,
|
|
603428
|
+
[
|
|
603429
|
+
"-c",
|
|
603430
|
+
[
|
|
603431
|
+
"import json",
|
|
603432
|
+
"try:",
|
|
603433
|
+
" import torch",
|
|
603434
|
+
" ok=bool(torch.cuda.is_available() and torch.cuda.device_count()>0)",
|
|
603435
|
+
" print(json.dumps({'ok':ok,'torch':getattr(torch,'__version__','unknown'),'cuda':getattr(getattr(torch,'version',None),'cuda',None),'devices':torch.cuda.device_count() if hasattr(torch,'cuda') else 0}))",
|
|
603436
|
+
" raise SystemExit(0 if ok else 2)",
|
|
603437
|
+
"except Exception as e:",
|
|
603438
|
+
" print(json.dumps({'ok':False,'error':str(e)}))",
|
|
603439
|
+
" raise SystemExit(2)"
|
|
603440
|
+
].join("\n")
|
|
603441
|
+
],
|
|
603442
|
+
{ encoding: "utf8", timeout: 3e4 }
|
|
603443
|
+
);
|
|
603444
|
+
const log22 = `${probe.stdout || ""}${probe.stderr || ""}`.trim();
|
|
603445
|
+
return { ok: probe.status === 0, log: log22 };
|
|
603446
|
+
}
|
|
603345
603447
|
function ensureEmbedDeps() {
|
|
603346
603448
|
const venv = getVenvDir();
|
|
603347
603449
|
let log22 = "";
|
|
@@ -603351,40 +603453,135 @@ function ensureEmbedDeps() {
|
|
|
603351
603453
|
}
|
|
603352
603454
|
const venvExisted = existsSync110(getVenvPython());
|
|
603353
603455
|
if (!venvExisted) {
|
|
603354
|
-
const mk = spawnSync8("python3", ["-m", "venv", venv], { encoding: "utf8" });
|
|
603456
|
+
const mk = spawnSync8("python3", ["-m", "venv", ...isJetsonHost2() ? ["--system-site-packages"] : [], venv], { encoding: "utf8" });
|
|
603355
603457
|
log22 += mk.stdout + mk.stderr;
|
|
603356
603458
|
}
|
|
603459
|
+
if (isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed()) {
|
|
603460
|
+
enableVenvSystemSitePackages(venv);
|
|
603461
|
+
}
|
|
603357
603462
|
if (venvExisted && !(process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1")) {
|
|
603358
603463
|
const check = spawnSync8(
|
|
603359
603464
|
getVenvPython(),
|
|
603360
|
-
["-c", "import numpy, soundfile, whisper,
|
|
603465
|
+
["-c", "import numpy, soundfile, whisper, PIL"],
|
|
603361
603466
|
{ encoding: "utf8", timeout: 3e4 }
|
|
603362
603467
|
);
|
|
603363
603468
|
if (check.status === 0) {
|
|
603364
|
-
|
|
603469
|
+
if (!cudaHardwarePresent() || asrCpuAllowed()) {
|
|
603470
|
+
return { ok: true, log: "embed deps already satisfied" };
|
|
603471
|
+
}
|
|
603472
|
+
const cudaProbe = torchCudaProbe();
|
|
603473
|
+
if (cudaProbe.ok) {
|
|
603474
|
+
return { ok: true, log: `embed deps already satisfied; torch CUDA OK ${cudaProbe.log}` };
|
|
603475
|
+
}
|
|
603476
|
+
log22 += `embed deps import OK but torch CUDA probe failed; repairing ASR torch. ${cudaProbe.log}
|
|
603477
|
+
`;
|
|
603365
603478
|
}
|
|
603366
603479
|
}
|
|
603367
603480
|
const pip = process.platform === "win32" ? join125(venv, "Scripts", "pip.exe") : join125(venv, "bin", "pip");
|
|
603368
603481
|
const up = spawnSync8(pip, ["install", "--upgrade", "pip", "setuptools<81", "wheel"], { encoding: "utf8", timeout: 3e5 });
|
|
603369
603482
|
log22 += up.stdout + up.stderr;
|
|
603370
|
-
|
|
603371
|
-
|
|
603372
|
-
|
|
603373
|
-
|
|
603374
|
-
|
|
603375
|
-
|
|
603376
|
-
|
|
603377
|
-
|
|
603378
|
-
|
|
603379
|
-
|
|
603483
|
+
let torchOk = true;
|
|
603484
|
+
if (cudaHardwarePresent() && !asrCpuAllowed()) {
|
|
603485
|
+
const before = torchCudaProbe();
|
|
603486
|
+
torchOk = before.ok;
|
|
603487
|
+
if (!torchOk && isJetsonHost2()) {
|
|
603488
|
+
const systemTorch = torchCudaProbe("python3");
|
|
603489
|
+
if (systemTorch.ok) {
|
|
603490
|
+
log22 += `Venv torch CUDA probe failed, but system Jetson torch CUDA works; enabling system site packages and removing venv-local torch.
|
|
603491
|
+
venv=${before.log}
|
|
603492
|
+
system=${systemTorch.log}
|
|
603493
|
+
`;
|
|
603494
|
+
const uninstall = spawnSync8(
|
|
603495
|
+
pip,
|
|
603496
|
+
["uninstall", "-y", "torch", "torchvision", "torchaudio"],
|
|
603497
|
+
{ encoding: "utf8", timeout: 3e5 }
|
|
603498
|
+
);
|
|
603499
|
+
log22 += uninstall.stdout + uninstall.stderr;
|
|
603500
|
+
enableVenvSystemSitePackages(venv);
|
|
603501
|
+
const inherited = torchCudaProbe();
|
|
603502
|
+
torchOk = inherited.ok;
|
|
603503
|
+
log22 += `Torch CUDA probe after inheriting system Jetson torch: ${inherited.log}
|
|
603504
|
+
`;
|
|
603505
|
+
}
|
|
603506
|
+
}
|
|
603507
|
+
if (!torchOk && isJetsonHost2()) {
|
|
603508
|
+
const torchDeps = spawnSync8(
|
|
603509
|
+
pip,
|
|
603510
|
+
["install", "--upgrade", "filelock", "typing-extensions", "networkx", "jinja2", "fsspec", "sympy"],
|
|
603511
|
+
{ encoding: "utf8", timeout: 3e5 }
|
|
603512
|
+
);
|
|
603513
|
+
log22 += torchDeps.stdout + torchDeps.stderr;
|
|
603514
|
+
const torchSource = jetsonTorchInstallSource();
|
|
603515
|
+
log22 += `Torch CUDA probe failed on Jetson; installing JetPack-compatible PyTorch from ${torchSource.source}
|
|
603516
|
+
${before.log}
|
|
603517
|
+
`;
|
|
603518
|
+
const torchInstall = spawnSync8(
|
|
603519
|
+
pip,
|
|
603520
|
+
torchSource.args,
|
|
603521
|
+
{ encoding: "utf8", timeout: 9e5 }
|
|
603522
|
+
);
|
|
603523
|
+
log22 += torchInstall.stdout + torchInstall.stderr;
|
|
603524
|
+
const after = torchCudaProbe();
|
|
603525
|
+
torchOk = after.ok;
|
|
603526
|
+
log22 += `Torch CUDA probe after Jetson install: ${after.log}
|
|
603527
|
+
`;
|
|
603528
|
+
} else if (!torchOk) {
|
|
603529
|
+
log22 += `Torch CUDA probe failed on CUDA host; not allowing ASR CPU fallback. ${before.log}
|
|
603530
|
+
`;
|
|
603531
|
+
}
|
|
603532
|
+
}
|
|
603533
|
+
let asrDepsOk = true;
|
|
603534
|
+
if (isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed()) {
|
|
603535
|
+
const asrSupportPkgs = [
|
|
603536
|
+
"numpy==1.26.4",
|
|
603537
|
+
"soundfile",
|
|
603538
|
+
"Pillow",
|
|
603539
|
+
"numba",
|
|
603540
|
+
"tqdm",
|
|
603541
|
+
"more-itertools",
|
|
603542
|
+
"tiktoken"
|
|
603543
|
+
];
|
|
603544
|
+
const support = spawnSync8(pip, ["install", ...asrSupportPkgs], { encoding: "utf8", timeout: 9e5 });
|
|
603545
|
+
log22 += support.stdout + support.stderr;
|
|
603546
|
+
const whisper = spawnSync8(pip, ["install", "--no-deps", "openai-whisper"], { encoding: "utf8", timeout: 9e5 });
|
|
603547
|
+
log22 += whisper.stdout + whisper.stderr;
|
|
603548
|
+
asrDepsOk = support.status === 0 && whisper.status === 0;
|
|
603549
|
+
} else {
|
|
603550
|
+
const asrPkgs = [
|
|
603551
|
+
"numpy==1.26.4",
|
|
603552
|
+
"soundfile",
|
|
603553
|
+
"openai-whisper",
|
|
603554
|
+
// Embedding helpers used elsewhere (kept lightweight compared to full torch stack)
|
|
603555
|
+
"Pillow"
|
|
603556
|
+
];
|
|
603557
|
+
const ins = spawnSync8(pip, ["install", ...asrPkgs], { encoding: "utf8", timeout: 9e5 });
|
|
603558
|
+
log22 += ins.stdout + ins.stderr;
|
|
603559
|
+
asrDepsOk = ins.status === 0;
|
|
603560
|
+
}
|
|
603561
|
+
if (cudaHardwarePresent() && !asrCpuAllowed()) {
|
|
603562
|
+
const finalTorch = torchCudaProbe();
|
|
603563
|
+
torchOk = finalTorch.ok;
|
|
603564
|
+
if (!torchOk) {
|
|
603565
|
+
log22 += `Torch CUDA probe still failed after ASR dependency install. ${finalTorch.log}
|
|
603566
|
+
`;
|
|
603567
|
+
}
|
|
603568
|
+
}
|
|
603380
603569
|
let fullOk = true;
|
|
603381
603570
|
if (process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1") {
|
|
603382
|
-
const
|
|
603383
|
-
const
|
|
603571
|
+
const jetsonCudaRequired = isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed();
|
|
603572
|
+
const fullPkgs = jetsonCudaRequired ? ["open_clip_torch", "speechbrain"] : ["torch", "torchaudio", "open_clip_torch", "speechbrain"];
|
|
603573
|
+
if (jetsonCudaRequired) {
|
|
603574
|
+
log22 += "Jetson CUDA ASR active; installing optional embed deps without resolving generic torch/torchaudio from PyPI.\n";
|
|
603575
|
+
}
|
|
603576
|
+
const full = spawnSync8(
|
|
603577
|
+
pip,
|
|
603578
|
+
jetsonCudaRequired ? ["install", "--upgrade", "--no-deps", ...fullPkgs] : ["install", "--upgrade", ...fullPkgs],
|
|
603579
|
+
{ encoding: "utf8", timeout: 18e5 }
|
|
603580
|
+
);
|
|
603384
603581
|
log22 += full.stdout + full.stderr;
|
|
603385
603582
|
fullOk = full.status === 0;
|
|
603386
603583
|
}
|
|
603387
|
-
const ok3 =
|
|
603584
|
+
const ok3 = asrDepsOk && up.status === 0 && fullOk && torchOk;
|
|
603388
603585
|
return { ok: ok3, log: log22 };
|
|
603389
603586
|
}
|
|
603390
603587
|
function runEmbedImage(input) {
|
|
@@ -603998,16 +604195,19 @@ var init_listen = __esm({
|
|
|
603998
604195
|
const ensure = mod3.ensureEmbedDeps;
|
|
603999
604196
|
const getPy = mod3.getVenvPython;
|
|
604000
604197
|
if (typeof ensure === "function") {
|
|
604001
|
-
|
|
604002
|
-
|
|
604003
|
-
|
|
604004
|
-
|
|
604198
|
+
const res = ensure();
|
|
604199
|
+
if (res?.log) this.emit("status", res.log.slice(-500));
|
|
604200
|
+
if (res && res.ok === false) {
|
|
604201
|
+
throw new Error(`ASR Python dependency setup failed: ${String(res.log ?? "").slice(-1200)}`);
|
|
604005
604202
|
}
|
|
604006
604203
|
}
|
|
604007
604204
|
if (typeof getPy === "function") {
|
|
604008
604205
|
pyPath = getPy();
|
|
604009
604206
|
}
|
|
604010
|
-
} catch {
|
|
604207
|
+
} catch (err) {
|
|
604208
|
+
if (err instanceof Error && err.message.startsWith("ASR Python dependency setup failed:")) {
|
|
604209
|
+
throw err;
|
|
604210
|
+
}
|
|
604011
604211
|
}
|
|
604012
604212
|
updateListenLiveState({
|
|
604013
604213
|
phase: "loading-model",
|
|
@@ -604094,7 +604294,13 @@ var init_listen = __esm({
|
|
|
604094
604294
|
break;
|
|
604095
604295
|
}
|
|
604096
604296
|
case "error":
|
|
604097
|
-
|
|
604297
|
+
{
|
|
604298
|
+
const err = new Error(String(evt.message ?? "Whisper worker error"));
|
|
604299
|
+
clearTimeout(timeout2);
|
|
604300
|
+
updateListenLiveState({ phase: "error", lastStatus: err.message.slice(0, 160) });
|
|
604301
|
+
this.emit("error", err);
|
|
604302
|
+
reject(err);
|
|
604303
|
+
}
|
|
604098
604304
|
break;
|
|
604099
604305
|
}
|
|
604100
604306
|
} catch {
|
|
@@ -605049,7 +605255,7 @@ var init_camera_streamer = __esm({
|
|
|
605049
605255
|
});
|
|
605050
605256
|
|
|
605051
605257
|
// packages/cli/src/tui/live-vlm.ts
|
|
605052
|
-
import { existsSync as existsSync113, readFileSync as
|
|
605258
|
+
import { existsSync as existsSync113, readFileSync as readFileSync92, statSync as statSync44 } from "node:fs";
|
|
605053
605259
|
var DEFAULT_LIVE_VLM_MODEL, MAX_IMAGE_BYTES, VLM_SYSTEM_PROMPT, LiveVlmEngine;
|
|
605054
605260
|
var init_live_vlm = __esm({
|
|
605055
605261
|
"packages/cli/src/tui/live-vlm.ts"() {
|
|
@@ -605178,7 +605384,7 @@ var init_live_vlm = __esm({
|
|
|
605178
605384
|
this.describeInFlight = true;
|
|
605179
605385
|
try {
|
|
605180
605386
|
if (!await this.ensureModel()) return null;
|
|
605181
|
-
const image =
|
|
605387
|
+
const image = readFileSync92(framePath).toString("base64");
|
|
605182
605388
|
const heard = String(opts.heard ?? "").trim();
|
|
605183
605389
|
const userText = [
|
|
605184
605390
|
opts.source ? `Camera: ${opts.source}` : "",
|
|
@@ -605611,7 +605817,7 @@ var init_live_resource_arbiter = __esm({
|
|
|
605611
605817
|
});
|
|
605612
605818
|
|
|
605613
605819
|
// packages/cli/src/tui/live-sensors.ts
|
|
605614
|
-
import { existsSync as existsSync114, mkdirSync as mkdirSync70, readFileSync as
|
|
605820
|
+
import { existsSync as existsSync114, mkdirSync as mkdirSync70, readFileSync as readFileSync93, writeFileSync as writeFileSync58 } from "node:fs";
|
|
605615
605821
|
import { arch as arch3, freemem as freemem5 } from "node:os";
|
|
605616
605822
|
import { basename as basename23, join as join128, relative as relative11 } from "node:path";
|
|
605617
605823
|
function liveDir(repoRoot) {
|
|
@@ -606049,7 +606255,7 @@ function sanitizeLiveAudioError(value2) {
|
|
|
606049
606255
|
}
|
|
606050
606256
|
function readPcm16WavActivity(filePath, bins = 36) {
|
|
606051
606257
|
try {
|
|
606052
|
-
const buf =
|
|
606258
|
+
const buf = readFileSync93(filePath);
|
|
606053
606259
|
if (buf.length < 44 || buf.toString("ascii", 0, 4) !== "RIFF" || buf.toString("ascii", 8, 12) !== "WAVE") return void 0;
|
|
606054
606260
|
let offset = 12;
|
|
606055
606261
|
let channels = 1;
|
|
@@ -606942,7 +607148,7 @@ function parseCameraListText(raw) {
|
|
|
606942
607148
|
}
|
|
606943
607149
|
function loadLiveSensorConfig(repoRoot) {
|
|
606944
607150
|
try {
|
|
606945
|
-
const parsed = JSON.parse(
|
|
607151
|
+
const parsed = JSON.parse(readFileSync93(liveConfigPath(repoRoot), "utf8"));
|
|
606946
607152
|
return {
|
|
606947
607153
|
...DEFAULT_CONFIG7,
|
|
606948
607154
|
...parsed,
|
|
@@ -606957,7 +607163,7 @@ function loadLiveSensorConfig(repoRoot) {
|
|
|
606957
607163
|
}
|
|
606958
607164
|
function readLiveSensorSnapshot(repoRoot) {
|
|
606959
607165
|
try {
|
|
606960
|
-
const parsed = JSON.parse(
|
|
607166
|
+
const parsed = JSON.parse(readFileSync93(liveSnapshotPath(repoRoot), "utf8"));
|
|
606961
607167
|
return parsed?.version === 1 ? parsed : null;
|
|
606962
607168
|
} catch {
|
|
606963
607169
|
return null;
|
|
@@ -607361,7 +607567,7 @@ async function recordAudioSampleWithRecovery(preferred, devices, durationSec, ou
|
|
|
607361
607567
|
device: candidate,
|
|
607362
607568
|
method,
|
|
607363
607569
|
activity,
|
|
607364
|
-
bytes:
|
|
607570
|
+
bytes: readFileSync93(outputPath3),
|
|
607365
607571
|
errors: [...errors]
|
|
607366
607572
|
};
|
|
607367
607573
|
}
|
|
@@ -607424,7 +607630,7 @@ function isJetsonUnifiedMemoryHost() {
|
|
|
607424
607630
|
if (!["arm64", "aarch64"].includes(arch3())) return false;
|
|
607425
607631
|
if (existsSync114("/etc/nv_tegra_release")) return true;
|
|
607426
607632
|
try {
|
|
607427
|
-
const model =
|
|
607633
|
+
const model = readFileSync93("/proc/device-tree/model", "utf8");
|
|
607428
607634
|
return /nvidia|jetson|orin|tegra/i.test(model);
|
|
607429
607635
|
} catch {
|
|
607430
607636
|
return false;
|
|
@@ -608453,6 +608659,7 @@ var init_live_sensors = __esm({
|
|
|
608453
608659
|
this.lastInferenceAt.set(source, sampledAt);
|
|
608454
608660
|
const loop = new LiveMediaLoopTool(this.repoRoot);
|
|
608455
608661
|
const inferFromCapturedFrame = preview.ok && Boolean(preview.framePath);
|
|
608662
|
+
const captureSize = liveCameraResolutionSize(this.getCameraStreamResolution(source));
|
|
608456
608663
|
const mediaAbortController = new AbortController();
|
|
608457
608664
|
this.liveMediaAbortControllers.add(mediaAbortController);
|
|
608458
608665
|
const result = await this.runSequentialLiveVision(() => loop.execute({
|
|
@@ -608467,6 +608674,8 @@ var init_live_sensors = __esm({
|
|
|
608467
608674
|
sample_interval_sec: inferFromCapturedFrame ? 0.1 : 0.25,
|
|
608468
608675
|
max_frames: 1,
|
|
608469
608676
|
rotate_degrees: inferFromCapturedFrame ? 0 : orientation?.rotation ?? 0,
|
|
608677
|
+
...inferFromCapturedFrame || !captureSize ? {} : { width: captureSize.width, height: captureSize.height },
|
|
608678
|
+
...inferFromCapturedFrame ? {} : { fps: this.getCameraStreamFps(source) },
|
|
608470
608679
|
auto_bootstrap: true,
|
|
608471
608680
|
audio_mode: "none",
|
|
608472
608681
|
detect_objects: true,
|
|
@@ -609296,7 +609505,7 @@ var init_tool_adapter = __esm({
|
|
|
609296
609505
|
});
|
|
609297
609506
|
|
|
609298
609507
|
// packages/cli/src/tui/runtime-verification.ts
|
|
609299
|
-
import { existsSync as existsSync115, readFileSync as
|
|
609508
|
+
import { existsSync as existsSync115, readFileSync as readFileSync94, readdirSync as readdirSync37 } from "node:fs";
|
|
609300
609509
|
import { dirname as dirname38, extname as extname14, join as join129, relative as relative12, resolve as resolve54 } from "node:path";
|
|
609301
609510
|
function safeRelative(root, file) {
|
|
609302
609511
|
const rel = relative12(root, file);
|
|
@@ -609350,7 +609559,7 @@ function resolveScriptSource(root, htmlFile, src2) {
|
|
|
609350
609559
|
function referencedScriptAssets(root, htmlFile) {
|
|
609351
609560
|
let html = "";
|
|
609352
609561
|
try {
|
|
609353
|
-
html =
|
|
609562
|
+
html = readFileSync94(htmlFile, "utf8");
|
|
609354
609563
|
} catch {
|
|
609355
609564
|
return [];
|
|
609356
609565
|
}
|
|
@@ -609393,7 +609602,7 @@ async function runStaticRuntimeAssetSyntaxCheck(projectRoot, options2 = {}) {
|
|
|
609393
609602
|
if (issueByAsset.has(assetFile)) continue;
|
|
609394
609603
|
let source = "";
|
|
609395
609604
|
try {
|
|
609396
|
-
source =
|
|
609605
|
+
source = readFileSync94(assetFile, "utf8");
|
|
609397
609606
|
} catch {
|
|
609398
609607
|
continue;
|
|
609399
609608
|
}
|
|
@@ -615736,7 +615945,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
|
|
|
615736
615945
|
async function fetchPeerModels(peerId, authKey) {
|
|
615737
615946
|
try {
|
|
615738
615947
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
615739
|
-
const { existsSync: existsSync173, readFileSync:
|
|
615948
|
+
const { existsSync: existsSync173, readFileSync: readFileSync142 } = await import("node:fs");
|
|
615740
615949
|
const { join: join188 } = await import("node:path");
|
|
615741
615950
|
const cwd4 = process.cwd();
|
|
615742
615951
|
const nexusTool = new NexusTool2(cwd4);
|
|
@@ -615745,7 +615954,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615745
615954
|
try {
|
|
615746
615955
|
const statusPath = join188(nexusDir, "status.json");
|
|
615747
615956
|
if (existsSync173(statusPath)) {
|
|
615748
|
-
const status = JSON.parse(
|
|
615957
|
+
const status = JSON.parse(readFileSync142(statusPath, "utf8"));
|
|
615749
615958
|
if (status.peerId === peerId) isLocalPeer = true;
|
|
615750
615959
|
}
|
|
615751
615960
|
} catch {
|
|
@@ -615754,7 +615963,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615754
615963
|
const pricingPath = join188(nexusDir, "pricing.json");
|
|
615755
615964
|
if (existsSync173(pricingPath)) {
|
|
615756
615965
|
try {
|
|
615757
|
-
const pricing = JSON.parse(
|
|
615966
|
+
const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
|
|
615758
615967
|
const localModels = (pricing.models || []).map((m2) => ({
|
|
615759
615968
|
name: m2.model || "unknown",
|
|
615760
615969
|
size: m2.parameterSize || "",
|
|
@@ -615770,7 +615979,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615770
615979
|
const cachePath2 = join188(nexusDir, "peer-models-cache.json");
|
|
615771
615980
|
if (existsSync173(cachePath2)) {
|
|
615772
615981
|
try {
|
|
615773
|
-
const cache8 = JSON.parse(
|
|
615982
|
+
const cache8 = JSON.parse(readFileSync142(cachePath2, "utf8"));
|
|
615774
615983
|
if (cache8.peerId === peerId && cache8.models?.length > 0) {
|
|
615775
615984
|
const age = Date.now() - new Date(cache8.cachedAt).getTime();
|
|
615776
615985
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -615885,7 +616094,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615885
616094
|
const pricingPath = join188(nexusDir, "pricing.json");
|
|
615886
616095
|
if (existsSync173(pricingPath)) {
|
|
615887
616096
|
try {
|
|
615888
|
-
const pricing = JSON.parse(
|
|
616097
|
+
const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
|
|
615889
616098
|
return (pricing.models || []).map((m2) => ({
|
|
615890
616099
|
name: m2.model || "unknown",
|
|
615891
616100
|
size: m2.parameterSize || "",
|
|
@@ -619556,7 +619765,7 @@ var init_voice_session = __esm({
|
|
|
619556
619765
|
|
|
619557
619766
|
// packages/cli/src/tui/scoped-personality.ts
|
|
619558
619767
|
import { createHash as createHash32 } from "node:crypto";
|
|
619559
|
-
import { appendFileSync as appendFileSync12, existsSync as existsSync116, mkdirSync as mkdirSync71, readFileSync as
|
|
619768
|
+
import { appendFileSync as appendFileSync12, existsSync as existsSync116, mkdirSync as mkdirSync71, readFileSync as readFileSync95, writeFileSync as writeFileSync59 } from "node:fs";
|
|
619560
619769
|
import { join as join130, resolve as resolve55 } from "node:path";
|
|
619561
619770
|
function safeName(input) {
|
|
619562
619771
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
@@ -619711,7 +619920,7 @@ function loadScopedPersonality(scope) {
|
|
|
619711
619920
|
const paths = scopedPersonalityPaths(scope);
|
|
619712
619921
|
if (!existsSync116(paths.json)) return newDocument(scope);
|
|
619713
619922
|
try {
|
|
619714
|
-
const parsed = JSON.parse(
|
|
619923
|
+
const parsed = JSON.parse(readFileSync95(paths.json, "utf8"));
|
|
619715
619924
|
if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
|
|
619716
619925
|
return normalizeDocument(scope, parsed);
|
|
619717
619926
|
} catch {
|
|
@@ -619935,7 +620144,7 @@ var init_scoped_personality = __esm({
|
|
|
619935
620144
|
|
|
619936
620145
|
// packages/cli/src/tui/voice-soul.ts
|
|
619937
620146
|
import { createHash as createHash33 } from "node:crypto";
|
|
619938
|
-
import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as
|
|
620147
|
+
import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as readFileSync96 } from "node:fs";
|
|
619939
620148
|
import { basename as basename24, join as join131, resolve as resolve56 } from "node:path";
|
|
619940
620149
|
function compactText(text2, limit) {
|
|
619941
620150
|
const compact4 = text2.replace(/\s+/g, " ").trim();
|
|
@@ -619962,7 +620171,7 @@ function loadSoulRuntimeState(input) {
|
|
|
619962
620171
|
const path12 = soulRuntimeStatePath(input);
|
|
619963
620172
|
if (!existsSync117(path12)) return { version: 1 };
|
|
619964
620173
|
try {
|
|
619965
|
-
const parsed = JSON.parse(
|
|
620174
|
+
const parsed = JSON.parse(readFileSync96(path12, "utf8"));
|
|
619966
620175
|
if (!parsed || parsed.version !== 1) return { version: 1 };
|
|
619967
620176
|
return {
|
|
619968
620177
|
version: 1,
|
|
@@ -620080,7 +620289,7 @@ function findProjectSoul(scope) {
|
|
|
620080
620289
|
]) {
|
|
620081
620290
|
if (!existsSync117(candidate)) continue;
|
|
620082
620291
|
try {
|
|
620083
|
-
return { path: candidate, content:
|
|
620292
|
+
return { path: candidate, content: readFileSync96(candidate, "utf8") };
|
|
620084
620293
|
} catch {
|
|
620085
620294
|
return null;
|
|
620086
620295
|
}
|
|
@@ -620099,7 +620308,7 @@ function findProjectVoice(scope) {
|
|
|
620099
620308
|
const first2 = files[0];
|
|
620100
620309
|
if (!first2) return null;
|
|
620101
620310
|
const path12 = join131(voiceDir3, first2);
|
|
620102
|
-
return { path: path12, content:
|
|
620311
|
+
return { path: path12, content: readFileSync96(path12, "utf8") };
|
|
620103
620312
|
} catch {
|
|
620104
620313
|
return null;
|
|
620105
620314
|
}
|
|
@@ -620364,7 +620573,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
|
|
|
620364
620573
|
import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
|
|
620365
620574
|
import { URL as URL2 } from "node:url";
|
|
620366
620575
|
import { loadavg as loadavg2, cpus as cpus4, totalmem as totalmem7, freemem as freemem6 } from "node:os";
|
|
620367
|
-
import { existsSync as existsSync118, readFileSync as
|
|
620576
|
+
import { existsSync as existsSync118, readFileSync as readFileSync97, writeFileSync as writeFileSync60, unlinkSync as unlinkSync21, mkdirSync as mkdirSync72, readdirSync as readdirSync39, statSync as statSync45, statfsSync as statfsSync7 } from "node:fs";
|
|
620368
620577
|
import { join as join132 } from "node:path";
|
|
620369
620578
|
function cleanForwardHeaders(raw, targetHost) {
|
|
620370
620579
|
const out = {};
|
|
@@ -620535,7 +620744,7 @@ function readSponsorUsageState(stateDir) {
|
|
|
620535
620744
|
try {
|
|
620536
620745
|
const path12 = join132(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
|
|
620537
620746
|
if (!existsSync118(path12)) return null;
|
|
620538
|
-
const parsed = JSON.parse(
|
|
620747
|
+
const parsed = JSON.parse(readFileSync97(path12, "utf8"));
|
|
620539
620748
|
const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
|
|
620540
620749
|
const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
|
|
620541
620750
|
if (!dailyTokensResetAt) return null;
|
|
@@ -620560,7 +620769,7 @@ function readExposeState(stateDir) {
|
|
|
620560
620769
|
try {
|
|
620561
620770
|
const path12 = join132(stateDir, STATE_FILE_NAME);
|
|
620562
620771
|
if (!existsSync118(path12)) return null;
|
|
620563
|
-
const raw =
|
|
620772
|
+
const raw = readFileSync97(path12, "utf8");
|
|
620564
620773
|
const data = JSON.parse(raw);
|
|
620565
620774
|
if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
|
|
620566
620775
|
return data;
|
|
@@ -620698,7 +620907,7 @@ function readP2PExposeState(stateDir) {
|
|
|
620698
620907
|
try {
|
|
620699
620908
|
const path12 = join132(stateDir, P2P_STATE_FILE_NAME);
|
|
620700
620909
|
if (!existsSync118(path12)) return null;
|
|
620701
|
-
const raw =
|
|
620910
|
+
const raw = readFileSync97(path12, "utf8");
|
|
620702
620911
|
const data = JSON.parse(raw);
|
|
620703
620912
|
if (!data.peerId || !data.authKey) return null;
|
|
620704
620913
|
return data;
|
|
@@ -622102,7 +622311,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622102
622311
|
const statusPath = join132(nexusDir, "status.json");
|
|
622103
622312
|
for (let i2 = 0; i2 < 80; i2++) {
|
|
622104
622313
|
try {
|
|
622105
|
-
const raw =
|
|
622314
|
+
const raw = readFileSync97(statusPath, "utf8");
|
|
622106
622315
|
if (raw.length > 10) {
|
|
622107
622316
|
const status = JSON.parse(raw);
|
|
622108
622317
|
if (status.connected && status.peerId) {
|
|
@@ -622167,7 +622376,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622167
622376
|
removeP2PExposeState(stateDir);
|
|
622168
622377
|
return null;
|
|
622169
622378
|
}
|
|
622170
|
-
const status = JSON.parse(
|
|
622379
|
+
const status = JSON.parse(readFileSync97(statusPath, "utf8"));
|
|
622171
622380
|
if (!status.connected || !status.peerId) {
|
|
622172
622381
|
removeP2PExposeState(stateDir);
|
|
622173
622382
|
return null;
|
|
@@ -622245,7 +622454,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622245
622454
|
let meteringLines = lastMeteringLineCount;
|
|
622246
622455
|
try {
|
|
622247
622456
|
if (existsSync118(meteringFile)) {
|
|
622248
|
-
const content =
|
|
622457
|
+
const content = readFileSync97(meteringFile, "utf8");
|
|
622249
622458
|
meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
|
|
622250
622459
|
}
|
|
622251
622460
|
} catch {
|
|
@@ -622274,7 +622483,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622274
622483
|
try {
|
|
622275
622484
|
const statusPath = join132(nexusDir, "status.json");
|
|
622276
622485
|
if (existsSync118(statusPath)) {
|
|
622277
|
-
const status = JSON.parse(
|
|
622486
|
+
const status = JSON.parse(readFileSync97(statusPath, "utf8"));
|
|
622278
622487
|
if (status.peerId && !this._peerId) {
|
|
622279
622488
|
this._peerId = status.peerId;
|
|
622280
622489
|
}
|
|
@@ -622297,7 +622506,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622297
622506
|
try {
|
|
622298
622507
|
const meteringFile = join132(nexusDir, "metering.jsonl");
|
|
622299
622508
|
if (existsSync118(meteringFile)) {
|
|
622300
|
-
const content =
|
|
622509
|
+
const content = readFileSync97(meteringFile, "utf8");
|
|
622301
622510
|
if (content.length > lastMeteringSize) {
|
|
622302
622511
|
const newContent = content.slice(lastMeteringSize);
|
|
622303
622512
|
lastMeteringSize = content.length;
|
|
@@ -622594,7 +622803,7 @@ var init_types3 = __esm({
|
|
|
622594
622803
|
|
|
622595
622804
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
622596
622805
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
|
|
622597
|
-
import { readFileSync as
|
|
622806
|
+
import { readFileSync as readFileSync98, writeFileSync as writeFileSync61, existsSync as existsSync119, mkdirSync as mkdirSync73 } from "node:fs";
|
|
622598
622807
|
import { dirname as dirname39 } from "node:path";
|
|
622599
622808
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
622600
622809
|
var init_secret_vault = __esm({
|
|
@@ -622812,7 +623021,7 @@ var init_secret_vault = __esm({
|
|
|
622812
623021
|
*/
|
|
622813
623022
|
load(passphrase) {
|
|
622814
623023
|
if (!this.storePath || !existsSync119(this.storePath)) return 0;
|
|
622815
|
-
const blob =
|
|
623024
|
+
const blob = readFileSync98(this.storePath);
|
|
622816
623025
|
if (blob.length < SALT_LEN + IV_LEN + 16) {
|
|
622817
623026
|
throw new Error("Vault file is corrupted (too small)");
|
|
622818
623027
|
}
|
|
@@ -623850,7 +624059,7 @@ ${activitySummary}
|
|
|
623850
624059
|
});
|
|
623851
624060
|
|
|
623852
624061
|
// packages/cli/src/api/profiles.ts
|
|
623853
|
-
import { existsSync as existsSync120, readFileSync as
|
|
624062
|
+
import { existsSync as existsSync120, readFileSync as readFileSync99, writeFileSync as writeFileSync62, mkdirSync as mkdirSync74, readdirSync as readdirSync40, unlinkSync as unlinkSync22 } from "node:fs";
|
|
623854
624063
|
import { join as join134 } from "node:path";
|
|
623855
624064
|
import { homedir as homedir41 } from "node:os";
|
|
623856
624065
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -623870,7 +624079,7 @@ function listProfiles(projectDir2) {
|
|
|
623870
624079
|
if (existsSync120(projDir)) {
|
|
623871
624080
|
for (const f2 of readdirSync40(projDir).filter((f3) => f3.endsWith(".json"))) {
|
|
623872
624081
|
try {
|
|
623873
|
-
const raw = JSON.parse(
|
|
624082
|
+
const raw = JSON.parse(readFileSync99(join134(projDir, f2), "utf8"));
|
|
623874
624083
|
const name10 = f2.replace(".json", "");
|
|
623875
624084
|
seen.add(name10);
|
|
623876
624085
|
result.push({
|
|
@@ -623889,7 +624098,7 @@ function listProfiles(projectDir2) {
|
|
|
623889
624098
|
const name10 = f2.replace(".json", "");
|
|
623890
624099
|
if (seen.has(name10)) continue;
|
|
623891
624100
|
try {
|
|
623892
|
-
const raw = JSON.parse(
|
|
624101
|
+
const raw = JSON.parse(readFileSync99(join134(globDir, f2), "utf8"));
|
|
623893
624102
|
result.push({
|
|
623894
624103
|
name: name10,
|
|
623895
624104
|
description: raw.description || "",
|
|
@@ -623925,7 +624134,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
|
|
|
623925
624134
|
];
|
|
623926
624135
|
for (const candidate of candidates) {
|
|
623927
624136
|
if (!existsSync120(candidate.path)) continue;
|
|
623928
|
-
const raw = JSON.parse(
|
|
624137
|
+
const raw = JSON.parse(readFileSync99(candidate.path, "utf8"));
|
|
623929
624138
|
if (raw.encrypted === true) {
|
|
623930
624139
|
if (!password) return null;
|
|
623931
624140
|
const profile = decryptProfile(raw, password);
|
|
@@ -624232,7 +624441,7 @@ __export(omnius_directory_exports, {
|
|
|
624232
624441
|
writeIndexMeta: () => writeIndexMeta,
|
|
624233
624442
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
624234
624443
|
});
|
|
624235
|
-
import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync121, mkdirSync as mkdirSync75, readFileSync as
|
|
624444
|
+
import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync121, mkdirSync as mkdirSync75, readFileSync as readFileSync100, writeFileSync as writeFileSync63, readdirSync as readdirSync41, statSync as statSync46, unlinkSync as unlinkSync23, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
|
|
624236
624445
|
import { join as join135, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
|
|
624237
624446
|
import { homedir as homedir42 } from "node:os";
|
|
624238
624447
|
import { createHash as createHash37 } from "node:crypto";
|
|
@@ -624242,7 +624451,7 @@ function isGitRoot(dir) {
|
|
|
624242
624451
|
try {
|
|
624243
624452
|
const stat9 = statSync46(gitPath);
|
|
624244
624453
|
if (stat9.isFile()) {
|
|
624245
|
-
return
|
|
624454
|
+
return readFileSync100(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
624246
624455
|
}
|
|
624247
624456
|
if (!stat9.isDirectory()) return false;
|
|
624248
624457
|
return existsSync121(join135(gitPath, "HEAD")) || existsSync121(join135(gitPath, "config")) || existsSync121(join135(gitPath, "commondir"));
|
|
@@ -624301,7 +624510,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
624301
624510
|
const gitignoreDir = dirname40(gitignorePath);
|
|
624302
624511
|
const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
624303
624512
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
624304
|
-
const content =
|
|
624513
|
+
const content = readFileSync100(gitignorePath, "utf-8");
|
|
624305
624514
|
const normalizedTarget = normalizeIgnoreRule(ignorePattern);
|
|
624306
624515
|
const alreadyIgnored = content.split(/\r?\n/).some((line) => {
|
|
624307
624516
|
const trimmed = line.trim();
|
|
@@ -624424,7 +624633,7 @@ function loadProjectSettings(repoRoot) {
|
|
|
624424
624633
|
const settingsPath = join135(repoRoot, OMNIUS_DIR, "settings.json");
|
|
624425
624634
|
try {
|
|
624426
624635
|
if (existsSync121(settingsPath)) {
|
|
624427
|
-
return JSON.parse(
|
|
624636
|
+
return JSON.parse(readFileSync100(settingsPath, "utf-8"));
|
|
624428
624637
|
}
|
|
624429
624638
|
} catch {
|
|
624430
624639
|
}
|
|
@@ -624441,7 +624650,7 @@ function loadGlobalSettings() {
|
|
|
624441
624650
|
const settingsPath = join135(homedir42(), ".omnius", "settings.json");
|
|
624442
624651
|
try {
|
|
624443
624652
|
if (existsSync121(settingsPath)) {
|
|
624444
|
-
return JSON.parse(
|
|
624653
|
+
return JSON.parse(readFileSync100(settingsPath, "utf-8"));
|
|
624445
624654
|
}
|
|
624446
624655
|
} catch {
|
|
624447
624656
|
}
|
|
@@ -624472,7 +624681,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
624472
624681
|
if (existsSync121(filePath) && !seen.has(filePath)) {
|
|
624473
624682
|
seen.add(filePath);
|
|
624474
624683
|
try {
|
|
624475
|
-
let content =
|
|
624684
|
+
let content = readFileSync100(filePath, "utf-8");
|
|
624476
624685
|
if (content.length > maxContentLen) {
|
|
624477
624686
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
624478
624687
|
}
|
|
@@ -624505,7 +624714,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
624505
624714
|
function readIndexMeta(repoRoot) {
|
|
624506
624715
|
const metaPath = join135(repoRoot, OMNIUS_DIR, "index", "meta.json");
|
|
624507
624716
|
try {
|
|
624508
|
-
return JSON.parse(
|
|
624717
|
+
return JSON.parse(readFileSync100(metaPath, "utf-8"));
|
|
624509
624718
|
} catch {
|
|
624510
624719
|
return null;
|
|
624511
624720
|
}
|
|
@@ -624518,7 +624727,7 @@ function writeIndexMeta(repoRoot, meta) {
|
|
|
624518
624727
|
function readIndexData(repoRoot, filename) {
|
|
624519
624728
|
const filePath = join135(repoRoot, OMNIUS_DIR, "index", filename);
|
|
624520
624729
|
try {
|
|
624521
|
-
return JSON.parse(
|
|
624730
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624522
624731
|
} catch {
|
|
624523
624732
|
return null;
|
|
624524
624733
|
}
|
|
@@ -624597,7 +624806,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
624597
624806
|
}).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
|
|
624598
624807
|
return files.map((f2) => {
|
|
624599
624808
|
try {
|
|
624600
|
-
return JSON.parse(
|
|
624809
|
+
return JSON.parse(readFileSync100(join135(historyDir, f2.file), "utf-8"));
|
|
624601
624810
|
} catch {
|
|
624602
624811
|
return null;
|
|
624603
624812
|
}
|
|
@@ -624621,7 +624830,7 @@ function loadPendingTask(repoRoot) {
|
|
|
624621
624830
|
const filePath = join135(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
|
|
624622
624831
|
try {
|
|
624623
624832
|
if (!existsSync121(filePath)) return null;
|
|
624624
|
-
const data = JSON.parse(
|
|
624833
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624625
624834
|
try {
|
|
624626
624835
|
unlinkSync23(filePath);
|
|
624627
624836
|
} catch {
|
|
@@ -624651,7 +624860,7 @@ function readTaskHandoff2(repoRoot) {
|
|
|
624651
624860
|
const filePath = join135(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
|
|
624652
624861
|
try {
|
|
624653
624862
|
if (!existsSync121(filePath)) return null;
|
|
624654
|
-
const data = JSON.parse(
|
|
624863
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624655
624864
|
const handoffTime = new Date(data.handoffAt).getTime();
|
|
624656
624865
|
const now2 = Date.now();
|
|
624657
624866
|
const ageMs = now2 - handoffTime;
|
|
@@ -624737,7 +624946,7 @@ function acquireLock(lockPath) {
|
|
|
624737
624946
|
} catch (err) {
|
|
624738
624947
|
if (existsSync121(lockPath)) {
|
|
624739
624948
|
try {
|
|
624740
|
-
const lockContent =
|
|
624949
|
+
const lockContent = readFileSync100(lockPath, "utf-8");
|
|
624741
624950
|
const lock = JSON.parse(lockContent);
|
|
624742
624951
|
const lockAge = Date.now() - lock.acquiredAt;
|
|
624743
624952
|
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
@@ -624763,7 +624972,7 @@ function acquireLock(lockPath) {
|
|
|
624763
624972
|
function releaseLock(lockPath) {
|
|
624764
624973
|
try {
|
|
624765
624974
|
if (existsSync121(lockPath)) {
|
|
624766
|
-
const lockContent =
|
|
624975
|
+
const lockContent = readFileSync100(lockPath, "utf-8");
|
|
624767
624976
|
const lock = JSON.parse(lockContent);
|
|
624768
624977
|
if (lock.pid === process.pid) {
|
|
624769
624978
|
unlinkSync23(lockPath);
|
|
@@ -624855,7 +625064,7 @@ function pruneContextLedger(ledgerPath) {
|
|
|
624855
625064
|
if (!existsSync121(ledgerPath)) return;
|
|
624856
625065
|
const st = statSync46(ledgerPath);
|
|
624857
625066
|
if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
|
|
624858
|
-
const lines =
|
|
625067
|
+
const lines = readFileSync100(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
624859
625068
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
624860
625069
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
624861
625070
|
const archiveDir = join135(dirname40(ledgerPath), "archive");
|
|
@@ -624883,7 +625092,7 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
624883
625092
|
let ctx3;
|
|
624884
625093
|
try {
|
|
624885
625094
|
if (existsSync121(filePath)) {
|
|
624886
|
-
ctx3 = JSON.parse(
|
|
625095
|
+
ctx3 = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624887
625096
|
} else {
|
|
624888
625097
|
ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
|
|
624889
625098
|
}
|
|
@@ -625045,7 +625254,7 @@ function loadSessionContext(repoRoot) {
|
|
|
625045
625254
|
const filePath = join135(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
|
|
625046
625255
|
try {
|
|
625047
625256
|
if (!existsSync121(filePath)) return null;
|
|
625048
|
-
return JSON.parse(
|
|
625257
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625049
625258
|
} catch {
|
|
625050
625259
|
return null;
|
|
625051
625260
|
}
|
|
@@ -625053,7 +625262,7 @@ function loadSessionContext(repoRoot) {
|
|
|
625053
625262
|
function readJsonOrNull(filePath) {
|
|
625054
625263
|
try {
|
|
625055
625264
|
if (!existsSync121(filePath)) return null;
|
|
625056
|
-
return JSON.parse(
|
|
625265
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625057
625266
|
} catch {
|
|
625058
625267
|
return null;
|
|
625059
625268
|
}
|
|
@@ -625264,7 +625473,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
|
|
|
625264
625473
|
const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
625265
625474
|
try {
|
|
625266
625475
|
if (!existsSync121(indexPath)) return false;
|
|
625267
|
-
const index = JSON.parse(
|
|
625476
|
+
const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625268
625477
|
const idx = index.findIndex((e2) => e2.id === sessionId);
|
|
625269
625478
|
if (idx < 0) return false;
|
|
625270
625479
|
index[idx] = { ...index[idx], ...patch };
|
|
@@ -625313,7 +625522,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
|
|
|
625313
625522
|
let index = [];
|
|
625314
625523
|
try {
|
|
625315
625524
|
if (existsSync121(indexPath)) {
|
|
625316
|
-
index = JSON.parse(
|
|
625525
|
+
index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625317
625526
|
}
|
|
625318
625527
|
} catch {
|
|
625319
625528
|
}
|
|
@@ -625345,7 +625554,7 @@ function listSessions(repoRoot) {
|
|
|
625345
625554
|
const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
625346
625555
|
try {
|
|
625347
625556
|
if (!existsSync121(indexPath)) return [];
|
|
625348
|
-
const index = JSON.parse(
|
|
625557
|
+
const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625349
625558
|
return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
|
|
625350
625559
|
} catch {
|
|
625351
625560
|
return [];
|
|
@@ -625355,7 +625564,7 @@ function loadSessionHistory(repoRoot, sessionId) {
|
|
|
625355
625564
|
const contentPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
625356
625565
|
try {
|
|
625357
625566
|
if (!existsSync121(contentPath)) return null;
|
|
625358
|
-
return
|
|
625567
|
+
return readFileSync100(contentPath, "utf-8").split("\n");
|
|
625359
625568
|
} catch {
|
|
625360
625569
|
return null;
|
|
625361
625570
|
}
|
|
@@ -625367,7 +625576,7 @@ function deleteSession(repoRoot, sessionId) {
|
|
|
625367
625576
|
const contentPath = join135(sessDir, `${sessionId}.jsonl`);
|
|
625368
625577
|
if (existsSync121(contentPath)) unlinkSync23(contentPath);
|
|
625369
625578
|
if (existsSync121(indexPath)) {
|
|
625370
|
-
let index = JSON.parse(
|
|
625579
|
+
let index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625371
625580
|
index = index.filter((s2) => s2.id !== sessionId);
|
|
625372
625581
|
writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
|
|
625373
625582
|
}
|
|
@@ -625424,7 +625633,7 @@ function detectManifests(repoRoot) {
|
|
|
625424
625633
|
let name10;
|
|
625425
625634
|
if (check.nameField) {
|
|
625426
625635
|
try {
|
|
625427
|
-
const data = JSON.parse(
|
|
625636
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625428
625637
|
name10 = data[check.nameField];
|
|
625429
625638
|
} catch {
|
|
625430
625639
|
}
|
|
@@ -625495,7 +625704,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
625495
625704
|
function loadUsageFile(filePath) {
|
|
625496
625705
|
try {
|
|
625497
625706
|
if (existsSync121(filePath)) {
|
|
625498
|
-
return JSON.parse(
|
|
625707
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625499
625708
|
}
|
|
625500
625709
|
} catch {
|
|
625501
625710
|
}
|
|
@@ -625822,7 +626031,7 @@ var init_session_summary = __esm({
|
|
|
625822
626031
|
|
|
625823
626032
|
// packages/cli/src/tui/cad-model-viewer.ts
|
|
625824
626033
|
import { createServer as createServer7 } from "node:http";
|
|
625825
|
-
import { existsSync as existsSync122, readFileSync as
|
|
626034
|
+
import { existsSync as existsSync122, readFileSync as readFileSync101, statSync as statSync47 } from "node:fs";
|
|
625826
626035
|
import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
|
|
625827
626036
|
function getCurrentCadModelViewer() {
|
|
625828
626037
|
return currentViewer;
|
|
@@ -625882,7 +626091,7 @@ function handleViewerRequest(req3, res, filePath) {
|
|
|
625882
626091
|
"Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
|
|
625883
626092
|
"Cache-Control": "no-store"
|
|
625884
626093
|
});
|
|
625885
|
-
res.end(
|
|
626094
|
+
res.end(readFileSync101(filePath));
|
|
625886
626095
|
} catch (err) {
|
|
625887
626096
|
sendText(res, 500, err instanceof Error ? err.message : String(err));
|
|
625888
626097
|
}
|
|
@@ -626286,7 +626495,7 @@ var init_render2 = __esm({
|
|
|
626286
626495
|
});
|
|
626287
626496
|
|
|
626288
626497
|
// packages/prompts/dist/promptLoader.js
|
|
626289
|
-
import { readFileSync as
|
|
626498
|
+
import { readFileSync as readFileSync103, existsSync as existsSync124 } from "node:fs";
|
|
626290
626499
|
import { join as join137, dirname as dirname41 } from "node:path";
|
|
626291
626500
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
626292
626501
|
function loadPrompt2(promptPath, vars) {
|
|
@@ -626296,7 +626505,7 @@ function loadPrompt2(promptPath, vars) {
|
|
|
626296
626505
|
if (!existsSync124(fullPath)) {
|
|
626297
626506
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
626298
626507
|
}
|
|
626299
|
-
content =
|
|
626508
|
+
content = readFileSync103(fullPath, "utf-8");
|
|
626300
626509
|
cache6.set(promptPath, content);
|
|
626301
626510
|
}
|
|
626302
626511
|
if (!vars)
|
|
@@ -627415,7 +627624,7 @@ __export(tui_tasks_renderer_exports, {
|
|
|
627415
627624
|
setTuiTasksSession: () => setTuiTasksSession,
|
|
627416
627625
|
teardownTuiTasks: () => teardownTuiTasks
|
|
627417
627626
|
});
|
|
627418
|
-
import { existsSync as existsSync125, readFileSync as
|
|
627627
|
+
import { existsSync as existsSync125, readFileSync as readFileSync104, watch as fsWatch3 } from "node:fs";
|
|
627419
627628
|
import { join as join139 } from "node:path";
|
|
627420
627629
|
import { homedir as homedir44 } from "node:os";
|
|
627421
627630
|
function setTasksRendererWriter(writer) {
|
|
@@ -627542,7 +627751,7 @@ function loadTodos() {
|
|
|
627542
627751
|
_lastTodos = [];
|
|
627543
627752
|
return;
|
|
627544
627753
|
}
|
|
627545
|
-
const parsed = JSON.parse(
|
|
627754
|
+
const parsed = JSON.parse(readFileSync104(fp, "utf-8"));
|
|
627546
627755
|
_lastTodos = Array.isArray(parsed) ? parsed : [];
|
|
627547
627756
|
} catch {
|
|
627548
627757
|
_lastTodos = [];
|
|
@@ -633415,7 +633624,7 @@ __export(personaplex_exports, {
|
|
|
633415
633624
|
startPersonaPlexDaemon: () => startPersonaPlexDaemon,
|
|
633416
633625
|
stopPersonaPlex: () => stopPersonaPlex
|
|
633417
633626
|
});
|
|
633418
|
-
import { existsSync as existsSync126, writeFileSync as writeFileSync65, readFileSync as
|
|
633627
|
+
import { existsSync as existsSync126, writeFileSync as writeFileSync65, readFileSync as readFileSync105, mkdirSync as mkdirSync77, copyFileSync as copyFileSync5, readdirSync as readdirSync42, statSync as statSync48 } from "node:fs";
|
|
633419
633628
|
import { join as join140, dirname as dirname43 } from "node:path";
|
|
633420
633629
|
import { homedir as homedir45 } from "node:os";
|
|
633421
633630
|
import { spawn as spawn33 } from "node:child_process";
|
|
@@ -633454,9 +633663,9 @@ function selectWeightTier(vramGB) {
|
|
|
633454
633663
|
}
|
|
633455
633664
|
function detectJetson() {
|
|
633456
633665
|
try {
|
|
633457
|
-
const model =
|
|
633666
|
+
const model = readFileSync105("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
|
|
633458
633667
|
if (/jetson|orin|tegra/i.test(model)) {
|
|
633459
|
-
const memInfo =
|
|
633668
|
+
const memInfo = readFileSync105("/proc/meminfo", "utf8");
|
|
633460
633669
|
const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
|
|
633461
633670
|
return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
|
|
633462
633671
|
}
|
|
@@ -633531,7 +633740,7 @@ function fileLink2(filePath, label) {
|
|
|
633531
633740
|
}
|
|
633532
633741
|
async function isPersonaPlexRunning() {
|
|
633533
633742
|
if (!existsSync126(PID_FILE)) return false;
|
|
633534
|
-
const pid = parseInt(
|
|
633743
|
+
const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
|
|
633535
633744
|
if (isNaN(pid) || pid <= 0) return false;
|
|
633536
633745
|
try {
|
|
633537
633746
|
process.kill(pid, 0);
|
|
@@ -633543,7 +633752,7 @@ async function isPersonaPlexRunning() {
|
|
|
633543
633752
|
async function getPersonaPlexWSUrl() {
|
|
633544
633753
|
if (!await isPersonaPlexRunning()) return null;
|
|
633545
633754
|
if (!existsSync126(PORT_FILE)) return null;
|
|
633546
|
-
const port = parseInt(
|
|
633755
|
+
const port = parseInt(readFileSync105(PORT_FILE, "utf8").trim(), 10);
|
|
633547
633756
|
return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
|
|
633548
633757
|
}
|
|
633549
633758
|
function isPersonaPlexInstalled() {
|
|
@@ -633553,7 +633762,7 @@ async function getWeightTier() {
|
|
|
633553
633762
|
const detected = await detectPersonaPlexCapability();
|
|
633554
633763
|
const tierFile = join140(PERSONAPLEX_DIR, "weight_tier");
|
|
633555
633764
|
if (existsSync126(tierFile)) {
|
|
633556
|
-
const saved =
|
|
633765
|
+
const saved = readFileSync105(tierFile, "utf8").trim();
|
|
633557
633766
|
if (saved in WEIGHT_REPOS) {
|
|
633558
633767
|
const vram = detected.vramGB;
|
|
633559
633768
|
if (saved === "nf4-distilled" && vram < 24) {
|
|
@@ -633683,7 +633892,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
633683
633892
|
})).trim();
|
|
633684
633893
|
const serverFile = join140(sitePackages, "server.py");
|
|
633685
633894
|
if (existsSync126(serverFile)) {
|
|
633686
|
-
let src2 =
|
|
633895
|
+
let src2 = readFileSync105(serverFile, "utf8");
|
|
633687
633896
|
if (src2.includes('int(request["seed"])')) {
|
|
633688
633897
|
src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
|
|
633689
633898
|
writeFileSync65(serverFile, src2);
|
|
@@ -633699,7 +633908,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
633699
633908
|
})).trim();
|
|
633700
633909
|
const loadersFile = join140(sitePackages, "models", "loaders.py");
|
|
633701
633910
|
if (existsSync126(loadersFile)) {
|
|
633702
|
-
let src2 =
|
|
633911
|
+
let src2 = readFileSync105(loadersFile, "utf8");
|
|
633703
633912
|
if (!src2.includes("_dequantize_2bit_state_dict")) {
|
|
633704
633913
|
const dequantPatch = `
|
|
633705
633914
|
import math
|
|
@@ -633802,28 +634011,28 @@ $2if filename.endswith(".safetensors"):`
|
|
|
633802
634011
|
})).trim();
|
|
633803
634012
|
const hybridDest = join140(sitePackages2, "hybrid_agent.py");
|
|
633804
634013
|
const serverDest = join140(sitePackages2, "server.py");
|
|
633805
|
-
if (!existsSync126(hybridDest) || !
|
|
634014
|
+
if (!existsSync126(hybridDest) || !readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
633806
634015
|
log22("Deploying hybrid_agent.py (Omnius API integration)...");
|
|
633807
634016
|
try {
|
|
633808
634017
|
await execAsync(
|
|
633809
634018
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
|
|
633810
634019
|
{ timeout: 3e4 }
|
|
633811
634020
|
);
|
|
633812
|
-
if (existsSync126(hybridDest) &&
|
|
634021
|
+
if (existsSync126(hybridDest) && readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
633813
634022
|
log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
|
|
633814
634023
|
}
|
|
633815
634024
|
} catch {
|
|
633816
634025
|
log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
|
|
633817
634026
|
}
|
|
633818
634027
|
}
|
|
633819
|
-
if (!
|
|
634028
|
+
if (!readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
|
|
633820
634029
|
log22("Deploying patched server.py (hybrid mode + API endpoints)...");
|
|
633821
634030
|
try {
|
|
633822
634031
|
await execAsync(
|
|
633823
634032
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
|
|
633824
634033
|
{ timeout: 3e4 }
|
|
633825
634034
|
);
|
|
633826
|
-
if (
|
|
634035
|
+
if (readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
|
|
633827
634036
|
log22("server.py patched with hybrid intercept + REST APIs.");
|
|
633828
634037
|
}
|
|
633829
634038
|
} catch {
|
|
@@ -634013,7 +634222,7 @@ print('Converted')
|
|
|
634013
634222
|
let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
|
|
634014
634223
|
if (!ollamaModel) {
|
|
634015
634224
|
try {
|
|
634016
|
-
const omniusConfig = JSON.parse(
|
|
634225
|
+
const omniusConfig = JSON.parse(readFileSync105(join140(homedir45(), ".omnius", "config.json"), "utf8"));
|
|
634017
634226
|
if (omniusConfig.model) ollamaModel = omniusConfig.model;
|
|
634018
634227
|
} catch {
|
|
634019
634228
|
}
|
|
@@ -634108,7 +634317,7 @@ print('Converted')
|
|
|
634108
634317
|
}
|
|
634109
634318
|
async function stopPersonaPlex() {
|
|
634110
634319
|
if (!existsSync126(PID_FILE)) return;
|
|
634111
|
-
const pid = parseInt(
|
|
634320
|
+
const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
|
|
634112
634321
|
if (isNaN(pid) || pid <= 0) return;
|
|
634113
634322
|
try {
|
|
634114
634323
|
if (process.platform === "win32") {
|
|
@@ -634305,7 +634514,7 @@ function patchFrontendVoiceList(onInfo) {
|
|
|
634305
634514
|
for (const f2 of readdirSync42(distDir)) {
|
|
634306
634515
|
if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
|
|
634307
634516
|
const jsPath = join140(distDir, f2);
|
|
634308
|
-
let js =
|
|
634517
|
+
let js = readFileSync105(jsPath, "utf8");
|
|
634309
634518
|
const customVoices = [];
|
|
634310
634519
|
if (existsSync126(CUSTOM_VOICES_DIR)) {
|
|
634311
634520
|
for (const vf of readdirSync42(CUSTOM_VOICES_DIR)) {
|
|
@@ -634425,7 +634634,7 @@ __export(setup_exports, {
|
|
|
634425
634634
|
import * as readline from "node:readline";
|
|
634426
634635
|
import { spawn as spawn34, exec as exec5 } from "node:child_process";
|
|
634427
634636
|
import { promisify as promisify7 } from "node:util";
|
|
634428
|
-
import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as
|
|
634637
|
+
import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as readFileSync106, appendFileSync as appendFileSync14, mkdirSync as mkdirSync78, chmodSync as chmodSync3 } from "node:fs";
|
|
634429
634638
|
import { delimiter as pathDelimiter, join as join141 } from "node:path";
|
|
634430
634639
|
import { freemem as freemem8, homedir as homedir46, platform as platform6, totalmem as totalmem9 } from "node:os";
|
|
634431
634640
|
function wrapText2(value2, width) {
|
|
@@ -634481,14 +634690,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
|
|
|
634481
634690
|
}
|
|
634482
634691
|
try {
|
|
634483
634692
|
if (existsSync127("/sys/devices/soc0/family")) {
|
|
634484
|
-
const family =
|
|
634693
|
+
const family = readFileSync106("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
|
|
634485
634694
|
if (family.includes("tegra")) return true;
|
|
634486
634695
|
}
|
|
634487
634696
|
} catch {
|
|
634488
634697
|
}
|
|
634489
634698
|
try {
|
|
634490
634699
|
if (existsSync127("/proc/device-tree/model")) {
|
|
634491
|
-
const model =
|
|
634700
|
+
const model = readFileSync106("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
|
|
634492
634701
|
if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
|
|
634493
634702
|
return true;
|
|
634494
634703
|
}
|
|
@@ -636440,7 +636649,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
636440
636649
|
let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
|
|
636441
636650
|
try {
|
|
636442
636651
|
if (existsSync127(_visionMarkerFile)) {
|
|
636443
|
-
const _vm = JSON.parse(
|
|
636652
|
+
const _vm = JSON.parse(readFileSync106(_visionMarkerFile, "utf8"));
|
|
636444
636653
|
_visionPreviouslyInstalled = new Set(_vm.installed || []);
|
|
636445
636654
|
}
|
|
636446
636655
|
} catch {
|
|
@@ -637276,7 +637485,7 @@ function ensurePathInShellRc(binDir) {
|
|
|
637276
637485
|
const shell = process.env.SHELL ?? "";
|
|
637277
637486
|
const rcFile = shell.includes("zsh") ? join141(homedir46(), ".zshrc") : join141(homedir46(), ".bashrc");
|
|
637278
637487
|
try {
|
|
637279
|
-
const rcContent = existsSync127(rcFile) ?
|
|
637488
|
+
const rcContent = existsSync127(rcFile) ? readFileSync106(rcFile, "utf8") : "";
|
|
637280
637489
|
if (rcContent.includes(binDir)) return;
|
|
637281
637490
|
const exportLine = `
|
|
637282
637491
|
export PATH="${binDir}:$PATH" # Added by omnius for nvim
|
|
@@ -638049,7 +638258,7 @@ var init_platforms = __esm({
|
|
|
638049
638258
|
});
|
|
638050
638259
|
|
|
638051
638260
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
638052
|
-
import { existsSync as existsSync129, readdirSync as readdirSync43, readFileSync as
|
|
638261
|
+
import { existsSync as existsSync129, readdirSync as readdirSync43, readFileSync as readFileSync107, statSync as statSync49 } from "node:fs";
|
|
638053
638262
|
import { basename as basename27, extname as extname17, join as join142, relative as relative14, resolve as resolve59 } from "node:path";
|
|
638054
638263
|
function exploreWorkspace(root, options2 = {}) {
|
|
638055
638264
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
@@ -638148,7 +638357,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
|
638148
638357
|
""
|
|
638149
638358
|
].join("\n");
|
|
638150
638359
|
}
|
|
638151
|
-
const content =
|
|
638360
|
+
const content = readFileSync107(full, "utf8");
|
|
638152
638361
|
const rawLines = content.split(/\r?\n/);
|
|
638153
638362
|
const visible = rawLines.slice(0, maxLines);
|
|
638154
638363
|
const gutter = String(Math.min(rawLines.length, maxLines)).length;
|
|
@@ -638324,7 +638533,7 @@ var init_pricing = __esm({
|
|
|
638324
638533
|
});
|
|
638325
638534
|
|
|
638326
638535
|
// packages/cli/src/insights/engine.ts
|
|
638327
|
-
import { readdirSync as readdirSync44, readFileSync as
|
|
638536
|
+
import { readdirSync as readdirSync44, readFileSync as readFileSync108, existsSync as existsSync130 } from "node:fs";
|
|
638328
638537
|
import { join as join143 } from "node:path";
|
|
638329
638538
|
function formatDuration5(seconds) {
|
|
638330
638539
|
if (seconds < 60) return `${Math.round(seconds)}s`;
|
|
@@ -638399,7 +638608,7 @@ var init_engine = __esm({
|
|
|
638399
638608
|
return readdirSync44(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
|
|
638400
638609
|
try {
|
|
638401
638610
|
const data = JSON.parse(
|
|
638402
|
-
|
|
638611
|
+
readFileSync108(join143(this.historyDir, f2), "utf-8")
|
|
638403
638612
|
);
|
|
638404
638613
|
return data;
|
|
638405
638614
|
} catch {
|
|
@@ -638417,7 +638626,7 @@ var init_engine = __esm({
|
|
|
638417
638626
|
loadUsageStore() {
|
|
638418
638627
|
try {
|
|
638419
638628
|
if (existsSync130(this.usageFile)) {
|
|
638420
|
-
return JSON.parse(
|
|
638629
|
+
return JSON.parse(readFileSync108(this.usageFile, "utf-8"));
|
|
638421
638630
|
}
|
|
638422
638631
|
} catch {
|
|
638423
638632
|
}
|
|
@@ -641200,7 +641409,7 @@ var init_memory_menu = __esm({
|
|
|
641200
641409
|
});
|
|
641201
641410
|
|
|
641202
641411
|
// packages/cli/src/tui/audio-waveform.ts
|
|
641203
|
-
import { readFileSync as
|
|
641412
|
+
import { readFileSync as readFileSync109 } from "node:fs";
|
|
641204
641413
|
import { createRequire as createRequire6 } from "node:module";
|
|
641205
641414
|
function readAscii(buffer2, offset, length4) {
|
|
641206
641415
|
return buffer2.subarray(offset, offset + length4).toString("ascii");
|
|
@@ -641274,7 +641483,7 @@ function renderAudioWaveform(file, options2 = {}) {
|
|
|
641274
641483
|
} catch {
|
|
641275
641484
|
return null;
|
|
641276
641485
|
}
|
|
641277
|
-
const buffer2 =
|
|
641486
|
+
const buffer2 = readFileSync109(file);
|
|
641278
641487
|
const info = parseWav(buffer2);
|
|
641279
641488
|
if (!info) return null;
|
|
641280
641489
|
const frameCount = Math.floor(info.dataSize / info.frameSize);
|
|
@@ -641830,7 +642039,7 @@ __export(daemon_exports, {
|
|
|
641830
642039
|
stopDaemon: () => stopDaemon
|
|
641831
642040
|
});
|
|
641832
642041
|
import { spawn as spawn35 } from "node:child_process";
|
|
641833
|
-
import { existsSync as existsSync134, readFileSync as
|
|
642042
|
+
import { existsSync as existsSync134, readFileSync as readFileSync110, writeFileSync as writeFileSync67, mkdirSync as mkdirSync79, unlinkSync as unlinkSync26, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
641834
642043
|
import { join as join146 } from "node:path";
|
|
641835
642044
|
import { homedir as homedir48 } from "node:os";
|
|
641836
642045
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
@@ -641861,7 +642070,7 @@ function getLocalCliVersion() {
|
|
|
641861
642070
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
641862
642071
|
const p2 = join146(here, rel);
|
|
641863
642072
|
if (existsSync134(p2)) {
|
|
641864
|
-
const v = JSON.parse(
|
|
642073
|
+
const v = JSON.parse(readFileSync110(p2, "utf8"))?.version;
|
|
641865
642074
|
if (v) return String(v);
|
|
641866
642075
|
}
|
|
641867
642076
|
}
|
|
@@ -641900,7 +642109,7 @@ async function restartDaemon(port) {
|
|
|
641900
642109
|
function getDaemonPid() {
|
|
641901
642110
|
if (!existsSync134(PID_FILE2)) return null;
|
|
641902
642111
|
try {
|
|
641903
|
-
const pid = parseInt(
|
|
642112
|
+
const pid = parseInt(readFileSync110(PID_FILE2, "utf8").trim(), 10);
|
|
641904
642113
|
if (!pid || pid <= 0) return null;
|
|
641905
642114
|
process.kill(pid, 0);
|
|
641906
642115
|
return pid;
|
|
@@ -641915,7 +642124,7 @@ function getDaemonPid() {
|
|
|
641915
642124
|
function looksLikeNodeEntrypoint(path12) {
|
|
641916
642125
|
if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
|
|
641917
642126
|
try {
|
|
641918
|
-
const firstBytes =
|
|
642127
|
+
const firstBytes = readFileSync110(path12, "utf8").slice(0, 200);
|
|
641919
642128
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
641920
642129
|
} catch {
|
|
641921
642130
|
return false;
|
|
@@ -642589,7 +642798,7 @@ var init_types5 = __esm({
|
|
|
642589
642798
|
|
|
642590
642799
|
// packages/cli/src/cron/store.ts
|
|
642591
642800
|
import {
|
|
642592
|
-
readFileSync as
|
|
642801
|
+
readFileSync as readFileSync111,
|
|
642593
642802
|
writeFileSync as writeFileSync68,
|
|
642594
642803
|
mkdirSync as mkdirSync80,
|
|
642595
642804
|
chmodSync as chmodSync4,
|
|
@@ -642776,7 +642985,7 @@ function loadJobs() {
|
|
|
642776
642985
|
const path12 = jobsFilePath();
|
|
642777
642986
|
if (!existsSync137(path12)) return [];
|
|
642778
642987
|
try {
|
|
642779
|
-
const data = JSON.parse(
|
|
642988
|
+
const data = JSON.parse(readFileSync111(path12, "utf-8"));
|
|
642780
642989
|
return data.jobs || [];
|
|
642781
642990
|
} catch {
|
|
642782
642991
|
return [];
|
|
@@ -643144,7 +643353,7 @@ import {
|
|
|
643144
643353
|
closeSync as closeSync5,
|
|
643145
643354
|
writeFileSync as writeFileSync69,
|
|
643146
643355
|
unlinkSync as unlinkSync28,
|
|
643147
|
-
readFileSync as
|
|
643356
|
+
readFileSync as readFileSync112
|
|
643148
643357
|
} from "node:fs";
|
|
643149
643358
|
import { join as join150 } from "node:path";
|
|
643150
643359
|
import { homedir as homedir50 } from "node:os";
|
|
@@ -643161,7 +643370,7 @@ function acquireTickLock() {
|
|
|
643161
643370
|
mkdirSync81(cronDir2(), { recursive: true });
|
|
643162
643371
|
try {
|
|
643163
643372
|
if (existsSync138(lockPath)) {
|
|
643164
|
-
const content =
|
|
643373
|
+
const content = readFileSync112(lockPath, "utf-8").trim();
|
|
643165
643374
|
if (content) {
|
|
643166
643375
|
const lock = JSON.parse(content);
|
|
643167
643376
|
const age = Date.now() - lock.acquiredAt;
|
|
@@ -643529,7 +643738,7 @@ __export(sponsor_wizard_exports, {
|
|
|
643529
643738
|
selectedModelsForEndpoint: () => selectedModelsForEndpoint,
|
|
643530
643739
|
showSponsorDashboard: () => showSponsorDashboard
|
|
643531
643740
|
});
|
|
643532
|
-
import { existsSync as existsSync139, readFileSync as
|
|
643741
|
+
import { existsSync as existsSync139, readFileSync as readFileSync113, writeFileSync as writeFileSync70, mkdirSync as mkdirSync82 } from "node:fs";
|
|
643533
643742
|
import { join as join151 } from "node:path";
|
|
643534
643743
|
function fmtTokens2(n2) {
|
|
643535
643744
|
if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
|
|
@@ -643550,7 +643759,7 @@ function loadSponsorConfig(projectDir2) {
|
|
|
643550
643759
|
const p2 = configPath(projectDir2);
|
|
643551
643760
|
if (!existsSync139(p2)) return null;
|
|
643552
643761
|
try {
|
|
643553
|
-
return JSON.parse(
|
|
643762
|
+
return JSON.parse(readFileSync113(p2, "utf8"));
|
|
643554
643763
|
} catch {
|
|
643555
643764
|
return null;
|
|
643556
643765
|
}
|
|
@@ -644897,7 +645106,7 @@ import {
|
|
|
644897
645106
|
existsSync as existsSync140,
|
|
644898
645107
|
mkdirSync as mkdirSync83,
|
|
644899
645108
|
writeFileSync as writeFileSync71,
|
|
644900
|
-
readFileSync as
|
|
645109
|
+
readFileSync as readFileSync114,
|
|
644901
645110
|
unlinkSync as unlinkSync29,
|
|
644902
645111
|
readdirSync as readdirSync46,
|
|
644903
645112
|
statSync as statSync52,
|
|
@@ -646398,7 +646607,7 @@ except Exception as exc:
|
|
|
646398
646607
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
646399
646608
|
const destPath = join152(refsDir, destFilename);
|
|
646400
646609
|
try {
|
|
646401
|
-
const data =
|
|
646610
|
+
const data = readFileSync114(audioPath);
|
|
646402
646611
|
writeFileSync71(destPath, data);
|
|
646403
646612
|
} catch (err) {
|
|
646404
646613
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -646473,7 +646682,7 @@ except Exception as exc:
|
|
|
646473
646682
|
const p2 = _VoiceEngine.cloneMetaFile();
|
|
646474
646683
|
if (!existsSync140(p2)) return {};
|
|
646475
646684
|
try {
|
|
646476
|
-
const raw = JSON.parse(
|
|
646685
|
+
const raw = JSON.parse(readFileSync114(p2, "utf8"));
|
|
646477
646686
|
if (typeof Object.values(raw)[0] === "string") {
|
|
646478
646687
|
const migrated = {};
|
|
646479
646688
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -647359,7 +647568,7 @@ except Exception as exc:
|
|
|
647359
647568
|
}
|
|
647360
647569
|
loadMisottsStore() {
|
|
647361
647570
|
try {
|
|
647362
|
-
const raw = JSON.parse(
|
|
647571
|
+
const raw = JSON.parse(readFileSync114(misottsProfilesFile(), "utf-8"));
|
|
647363
647572
|
const profiles = {};
|
|
647364
647573
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
647365
647574
|
profiles[name10] = normalizeMisottsSettings(settings);
|
|
@@ -647383,7 +647592,7 @@ except Exception as exc:
|
|
|
647383
647592
|
loadSupertonicStore() {
|
|
647384
647593
|
try {
|
|
647385
647594
|
const raw = JSON.parse(
|
|
647386
|
-
|
|
647595
|
+
readFileSync114(supertonicProfilesFile(), "utf-8")
|
|
647387
647596
|
);
|
|
647388
647597
|
const profiles = {};
|
|
647389
647598
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
@@ -647550,7 +647759,7 @@ except Exception as exc:
|
|
|
647550
647759
|
const wavPath = await this.synthesizeSupertonicWav(text2, 1);
|
|
647551
647760
|
if (!wavPath) return null;
|
|
647552
647761
|
try {
|
|
647553
|
-
const data =
|
|
647762
|
+
const data = readFileSync114(wavPath);
|
|
647554
647763
|
unlinkSync29(wavPath);
|
|
647555
647764
|
return data;
|
|
647556
647765
|
} catch {
|
|
@@ -647698,7 +647907,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647698
647907
|
if (!existsSync140(wavPath)) return;
|
|
647699
647908
|
if (volume !== 1) {
|
|
647700
647909
|
try {
|
|
647701
|
-
const wavData =
|
|
647910
|
+
const wavData = readFileSync114(wavPath);
|
|
647702
647911
|
if (wavData.length > 44) {
|
|
647703
647912
|
const header = wavData.subarray(0, 44);
|
|
647704
647913
|
const samples = new Int16Array(
|
|
@@ -647720,7 +647929,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647720
647929
|
}
|
|
647721
647930
|
if (this.onPCMOutput) {
|
|
647722
647931
|
try {
|
|
647723
|
-
const wavData =
|
|
647932
|
+
const wavData = readFileSync114(wavPath);
|
|
647724
647933
|
if (wavData.length > 44) {
|
|
647725
647934
|
const pcm = Buffer.from(
|
|
647726
647935
|
wavData.buffer,
|
|
@@ -647778,7 +647987,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647778
647987
|
}
|
|
647779
647988
|
if (!existsSync140(wavPath)) return null;
|
|
647780
647989
|
try {
|
|
647781
|
-
const data =
|
|
647990
|
+
const data = readFileSync114(wavPath);
|
|
647782
647991
|
unlinkSync29(wavPath);
|
|
647783
647992
|
return data;
|
|
647784
647993
|
} catch {
|
|
@@ -648032,7 +648241,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
648032
648241
|
...isJetson ? (() => {
|
|
648033
648242
|
let jpVer = "v60";
|
|
648034
648243
|
try {
|
|
648035
|
-
const tegra = existsSync140("/etc/nv_tegra_release") ?
|
|
648244
|
+
const tegra = existsSync140("/etc/nv_tegra_release") ? readFileSync114("/etc/nv_tegra_release", "utf8").trim() : "";
|
|
648036
648245
|
const ver = process.env.JETSON_L4T_VERSION || "";
|
|
648037
648246
|
if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
|
|
648038
648247
|
jpVer = "v51";
|
|
@@ -648642,7 +648851,7 @@ if __name__ == '__main__':
|
|
|
648642
648851
|
async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
648643
648852
|
if (!existsSync140(wavPath)) return;
|
|
648644
648853
|
try {
|
|
648645
|
-
const wavData =
|
|
648854
|
+
const wavData = readFileSync114(wavPath);
|
|
648646
648855
|
if (wavData.length > 44) {
|
|
648647
648856
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648648
648857
|
const samples = new Int16Array(
|
|
@@ -648673,7 +648882,7 @@ if __name__ == '__main__':
|
|
|
648673
648882
|
}
|
|
648674
648883
|
if (pitchFactor !== 1) {
|
|
648675
648884
|
try {
|
|
648676
|
-
const wavData =
|
|
648885
|
+
const wavData = readFileSync114(wavPath);
|
|
648677
648886
|
if (wavData.length > 44) {
|
|
648678
648887
|
const int16 = new Int16Array(
|
|
648679
648888
|
wavData.buffer,
|
|
@@ -648692,7 +648901,7 @@ if __name__ == '__main__':
|
|
|
648692
648901
|
}
|
|
648693
648902
|
if (this.onPCMOutput) {
|
|
648694
648903
|
try {
|
|
648695
|
-
const wavData =
|
|
648904
|
+
const wavData = readFileSync114(wavPath);
|
|
648696
648905
|
if (wavData.length > 44) {
|
|
648697
648906
|
const pcm = Buffer.from(
|
|
648698
648907
|
wavData.buffer,
|
|
@@ -648707,7 +648916,7 @@ if __name__ == '__main__':
|
|
|
648707
648916
|
}
|
|
648708
648917
|
if (stereoDelayMs > 0) {
|
|
648709
648918
|
try {
|
|
648710
|
-
const wavData =
|
|
648919
|
+
const wavData = readFileSync114(wavPath);
|
|
648711
648920
|
if (wavData.length > 44) {
|
|
648712
648921
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648713
648922
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -648774,7 +648983,7 @@ if __name__ == '__main__':
|
|
|
648774
648983
|
}
|
|
648775
648984
|
if (!existsSync140(wavPath)) return null;
|
|
648776
648985
|
try {
|
|
648777
|
-
const data =
|
|
648986
|
+
const data = readFileSync114(wavPath);
|
|
648778
648987
|
unlinkSync29(wavPath);
|
|
648779
648988
|
return data;
|
|
648780
648989
|
} catch {
|
|
@@ -649009,7 +649218,7 @@ if __name__ == "__main__":
|
|
|
649009
649218
|
async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
649010
649219
|
if (!existsSync140(wavPath)) return;
|
|
649011
649220
|
try {
|
|
649012
|
-
const wavData =
|
|
649221
|
+
const wavData = readFileSync114(wavPath);
|
|
649013
649222
|
if (wavData.length > 44) {
|
|
649014
649223
|
const sampleRate = wavData.readUInt32LE(24);
|
|
649015
649224
|
const samples = new Int16Array(
|
|
@@ -649040,7 +649249,7 @@ if __name__ == "__main__":
|
|
|
649040
649249
|
}
|
|
649041
649250
|
if (pitchFactor !== 1) {
|
|
649042
649251
|
try {
|
|
649043
|
-
const wavData =
|
|
649252
|
+
const wavData = readFileSync114(wavPath);
|
|
649044
649253
|
if (wavData.length > 44) {
|
|
649045
649254
|
const int16 = new Int16Array(
|
|
649046
649255
|
wavData.buffer,
|
|
@@ -649059,7 +649268,7 @@ if __name__ == "__main__":
|
|
|
649059
649268
|
}
|
|
649060
649269
|
if (this.onPCMOutput) {
|
|
649061
649270
|
try {
|
|
649062
|
-
const wavData =
|
|
649271
|
+
const wavData = readFileSync114(wavPath);
|
|
649063
649272
|
if (wavData.length > 44) {
|
|
649064
649273
|
const pcm = Buffer.from(
|
|
649065
649274
|
wavData.buffer,
|
|
@@ -649074,7 +649283,7 @@ if __name__ == "__main__":
|
|
|
649074
649283
|
}
|
|
649075
649284
|
if (stereoDelayMs > 0) {
|
|
649076
649285
|
try {
|
|
649077
|
-
const wavData =
|
|
649286
|
+
const wavData = readFileSync114(wavPath);
|
|
649078
649287
|
if (wavData.length > 44) {
|
|
649079
649288
|
const sampleRate = wavData.readUInt32LE(24);
|
|
649080
649289
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -649150,7 +649359,7 @@ if __name__ == "__main__":
|
|
|
649150
649359
|
}
|
|
649151
649360
|
if (!existsSync140(wavPath)) return null;
|
|
649152
649361
|
try {
|
|
649153
|
-
const data =
|
|
649362
|
+
const data = readFileSync114(wavPath);
|
|
649154
649363
|
unlinkSync29(wavPath);
|
|
649155
649364
|
return data;
|
|
649156
649365
|
} catch {
|
|
@@ -649171,7 +649380,7 @@ if __name__ == "__main__":
|
|
|
649171
649380
|
};
|
|
649172
649381
|
if (existsSync140(pkgPath)) {
|
|
649173
649382
|
try {
|
|
649174
|
-
const existing = JSON.parse(
|
|
649383
|
+
const existing = JSON.parse(readFileSync114(pkgPath, "utf8"));
|
|
649175
649384
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
649176
649385
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
649177
649386
|
writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -649331,7 +649540,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
649331
649540
|
if (!existsSync140(onnxPath) || !existsSync140(configPath2)) {
|
|
649332
649541
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
649333
649542
|
}
|
|
649334
|
-
this.config = JSON.parse(
|
|
649543
|
+
this.config = JSON.parse(readFileSync114(configPath2, "utf8"));
|
|
649335
649544
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
649336
649545
|
executionProviders: ["cpu"],
|
|
649337
649546
|
graphOptimizationLevel: "all"
|
|
@@ -649491,7 +649700,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
|
|
|
649491
649700
|
import { createHash as createHash38 } from "node:crypto";
|
|
649492
649701
|
import {
|
|
649493
649702
|
existsSync as existsSync141,
|
|
649494
|
-
readFileSync as
|
|
649703
|
+
readFileSync as readFileSync115,
|
|
649495
649704
|
writeFileSync as writeFileSync72,
|
|
649496
649705
|
mkdirSync as mkdirSync84,
|
|
649497
649706
|
readdirSync as readdirSync47,
|
|
@@ -649928,6 +650137,9 @@ async function ensureVoiceDeps(ctx3) {
|
|
|
649928
650137
|
const res = mod3.ensureEmbedDeps();
|
|
649929
650138
|
if (res?.log)
|
|
649930
650139
|
renderInfo(res.log.split("\n").slice(-3).join(" ").slice(0, 200));
|
|
650140
|
+
if (res && res.ok === false) {
|
|
650141
|
+
throw new Error(`ASR Python dependency setup failed: ${String(res.log ?? "").slice(-1200)}`);
|
|
650142
|
+
}
|
|
649931
650143
|
}
|
|
649932
650144
|
if (typeof mod3.getVenvPython === "function") {
|
|
649933
650145
|
const { dirname: dirname56 } = await import("node:path");
|
|
@@ -650812,10 +651024,10 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
650812
651024
|
if (!key) {
|
|
650813
651025
|
try {
|
|
650814
651026
|
const { homedir: homedir66 } = await import("node:os");
|
|
650815
|
-
const { readFileSync:
|
|
651027
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
650816
651028
|
const { join: join188 } = await import("node:path");
|
|
650817
651029
|
const p2 = join188(homedir66(), ".omnius", "api.key");
|
|
650818
|
-
if (existsSync173(p2)) key =
|
|
651030
|
+
if (existsSync173(p2)) key = readFileSync142(p2, "utf8").trim();
|
|
650819
651031
|
} catch {
|
|
650820
651032
|
}
|
|
650821
651033
|
}
|
|
@@ -651719,7 +651931,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
651719
651931
|
try {
|
|
651720
651932
|
const pidFile = join153(nexus.getNexusDir(), "daemon.pid");
|
|
651721
651933
|
if (existsSync141(pidFile)) {
|
|
651722
|
-
const pid = parseInt(
|
|
651934
|
+
const pid = parseInt(readFileSync115(pidFile, "utf8").trim(), 10);
|
|
651723
651935
|
if (pid > 0 && !registry2.daemons.has("Nexus")) {
|
|
651724
651936
|
registry2.register({
|
|
651725
651937
|
name: "Nexus",
|
|
@@ -652142,7 +652354,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652142
652354
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
652143
652355
|
return "handled";
|
|
652144
652356
|
}
|
|
652145
|
-
content =
|
|
652357
|
+
content = readFileSync115(toolFile, "utf8");
|
|
652146
652358
|
metadata = { type: "tool", name: shareName };
|
|
652147
652359
|
} else if (shareType === "skill") {
|
|
652148
652360
|
const skillDir = join153(ctx3.repoRoot, ".omnius", "skills", shareName);
|
|
@@ -652151,7 +652363,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652151
652363
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
652152
652364
|
return "handled";
|
|
652153
652365
|
}
|
|
652154
|
-
content =
|
|
652366
|
+
content = readFileSync115(skillFile, "utf8");
|
|
652155
652367
|
metadata = { type: "skill", name: shareName };
|
|
652156
652368
|
} else {
|
|
652157
652369
|
renderWarning(
|
|
@@ -652224,7 +652436,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652224
652436
|
"learning-cids.json"
|
|
652225
652437
|
);
|
|
652226
652438
|
if (existsSync141(regFile)) {
|
|
652227
|
-
const reg2 = JSON.parse(
|
|
652439
|
+
const reg2 = JSON.parse(readFileSync115(regFile, "utf8"));
|
|
652228
652440
|
const pinned = Object.values(reg2).some(
|
|
652229
652441
|
(e2) => e2.cid === importCid && e2.pinned
|
|
652230
652442
|
);
|
|
@@ -652342,7 +652554,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652342
652554
|
).getNexusDir();
|
|
652343
652555
|
const statusFile = join153(nexusDir, "status.json");
|
|
652344
652556
|
if (existsSync141(statusFile)) {
|
|
652345
|
-
const status = JSON.parse(
|
|
652557
|
+
const status = JSON.parse(readFileSync115(statusFile, "utf8"));
|
|
652346
652558
|
if (status.peerId) {
|
|
652347
652559
|
lines.push(`
|
|
652348
652560
|
${c3.bold("Peer Info")}`);
|
|
@@ -652367,7 +652579,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652367
652579
|
try {
|
|
652368
652580
|
const stateFile = join153(idDir, "self-state.json");
|
|
652369
652581
|
if (existsSync141(stateFile)) {
|
|
652370
|
-
const state = JSON.parse(
|
|
652582
|
+
const state = JSON.parse(readFileSync115(stateFile, "utf8"));
|
|
652371
652583
|
lines.push(
|
|
652372
652584
|
` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
|
|
652373
652585
|
);
|
|
@@ -652382,7 +652594,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652382
652594
|
}
|
|
652383
652595
|
const cidFile = join153(idDir, "cids.json");
|
|
652384
652596
|
if (existsSync141(cidFile)) {
|
|
652385
|
-
const cids = JSON.parse(
|
|
652597
|
+
const cids = JSON.parse(readFileSync115(cidFile, "utf8"));
|
|
652386
652598
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
652387
652599
|
if (lastCid)
|
|
652388
652600
|
lines.push(
|
|
@@ -652407,7 +652619,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652407
652619
|
"store.json"
|
|
652408
652620
|
);
|
|
652409
652621
|
if (existsSync141(metaFile2)) {
|
|
652410
|
-
const store2 = JSON.parse(
|
|
652622
|
+
const store2 = JSON.parse(readFileSync115(metaFile2, "utf8"));
|
|
652411
652623
|
const active = store2.filter((m2) => m2.type !== "quarantine");
|
|
652412
652624
|
const recoveries = active.filter(
|
|
652413
652625
|
(m2) => m2.content?.startsWith("[recovery]")
|
|
@@ -652645,7 +652857,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652645
652857
|
return "handled";
|
|
652646
652858
|
}
|
|
652647
652859
|
} else {
|
|
652648
|
-
content =
|
|
652860
|
+
content = readFileSync115(resolvedPath, "utf8");
|
|
652649
652861
|
}
|
|
652650
652862
|
if (!content.trim()) {
|
|
652651
652863
|
renderWarning("No content extracted.");
|
|
@@ -652753,7 +652965,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652753
652965
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
652754
652966
|
return "handled";
|
|
652755
652967
|
}
|
|
652756
|
-
const bridge = JSON.parse(
|
|
652968
|
+
const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
|
|
652757
652969
|
let alive = false;
|
|
652758
652970
|
try {
|
|
652759
652971
|
process.kill(bridge.pid, 0);
|
|
@@ -652789,7 +653001,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652789
653001
|
if (fortemiSubCmd === "stop") {
|
|
652790
653002
|
const bridgeFile = join153(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
|
|
652791
653003
|
if (existsSync141(bridgeFile)) {
|
|
652792
|
-
const bridge = JSON.parse(
|
|
653004
|
+
const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
|
|
652793
653005
|
try {
|
|
652794
653006
|
process.kill(bridge.pid, "SIGTERM");
|
|
652795
653007
|
} catch {
|
|
@@ -654825,7 +655037,7 @@ sleep 1
|
|
|
654825
655037
|
`daemon.pid exists: ${existsSync141(join153(checkedNexusDir, "daemon.pid"))}`
|
|
654826
655038
|
);
|
|
654827
655039
|
try {
|
|
654828
|
-
const _statusRaw =
|
|
655040
|
+
const _statusRaw = readFileSync115(
|
|
654829
655041
|
join153(checkedNexusDir, "status.json"),
|
|
654830
655042
|
"utf8"
|
|
654831
655043
|
);
|
|
@@ -654834,7 +655046,7 @@ sleep 1
|
|
|
654834
655046
|
_spLog(`status.json read error: ${e2}`);
|
|
654835
655047
|
}
|
|
654836
655048
|
try {
|
|
654837
|
-
const _errRaw =
|
|
655049
|
+
const _errRaw = readFileSync115(
|
|
654838
655050
|
join153(checkedNexusDir, "daemon.err"),
|
|
654839
655051
|
"utf8"
|
|
654840
655052
|
);
|
|
@@ -654869,7 +655081,7 @@ sleep 1
|
|
|
654869
655081
|
"agent-name"
|
|
654870
655082
|
);
|
|
654871
655083
|
if (existsSync141(namePath))
|
|
654872
|
-
sponsorName =
|
|
655084
|
+
sponsorName = readFileSync115(namePath, "utf8").trim();
|
|
654873
655085
|
} catch {
|
|
654874
655086
|
}
|
|
654875
655087
|
if (!sponsorName) sponsorName = "Omnius Sponsor";
|
|
@@ -654973,7 +655185,7 @@ sleep 1
|
|
|
654973
655185
|
);
|
|
654974
655186
|
if (existsSync141(nexusPidFile)) {
|
|
654975
655187
|
const nPid = parseInt(
|
|
654976
|
-
|
|
655188
|
+
readFileSync115(nexusPidFile, "utf8").trim(),
|
|
654977
655189
|
10
|
|
654978
655190
|
);
|
|
654979
655191
|
if (nPid > 0) {
|
|
@@ -656272,7 +656484,7 @@ sleep 1
|
|
|
656272
656484
|
if (existsSync141(projectSettingsPath)) {
|
|
656273
656485
|
try {
|
|
656274
656486
|
const projectJson = JSON.parse(
|
|
656275
|
-
|
|
656487
|
+
readFileSync115(projectSettingsPath, "utf8")
|
|
656276
656488
|
);
|
|
656277
656489
|
projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
|
|
656278
656490
|
} catch {
|
|
@@ -659952,8 +660164,8 @@ function attachLiveSinks(ctx3, manager, agentEnabled = false, speechEnabledOverr
|
|
|
659952
660164
|
manager.setAgentActionSink(void 0);
|
|
659953
660165
|
}
|
|
659954
660166
|
}
|
|
659955
|
-
async function ensureLiveStreamingAsr(ctx3, manager) {
|
|
659956
|
-
if (!manager.getConfig().asrEnabled) return;
|
|
660167
|
+
async function ensureLiveStreamingAsr(ctx3, manager, force = false) {
|
|
660168
|
+
if (!force && !manager.getConfig().asrEnabled) return;
|
|
659957
660169
|
if (!ctx3.listenStart) return;
|
|
659958
660170
|
ctx3.listenSetMode?.("auto");
|
|
659959
660171
|
const msg = await ctx3.listenStart("live");
|
|
@@ -660214,8 +660426,8 @@ async function handleLiveCommand(ctx3, arg) {
|
|
|
660214
660426
|
renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
|
|
660215
660427
|
}
|
|
660216
660428
|
await ensureLiveInventory(manager);
|
|
660429
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
660217
660430
|
renderInfo(manager.startRunMode({ agent: effectiveAgent, lowLatency: true, speech: effectiveAgent && Boolean(ctx3.voiceSpeak) }));
|
|
660218
|
-
await ensureLiveStreamingAsr(ctx3, manager);
|
|
660219
660431
|
return;
|
|
660220
660432
|
}
|
|
660221
660433
|
if (sub2 === "chat" || sub2 === "voicechat" || sub2 === "voice") {
|
|
@@ -660766,16 +660978,16 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
660766
660978
|
continue;
|
|
660767
660979
|
case "run-live":
|
|
660768
660980
|
attachLiveSinks(ctx3, manager, false);
|
|
660981
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
660769
660982
|
renderInfo(manager.startRunMode({ agent: false, lowLatency: true, speech: false }));
|
|
660770
|
-
await ensureLiveStreamingAsr(ctx3, manager);
|
|
660771
660983
|
continue;
|
|
660772
660984
|
case "run-agent":
|
|
660773
660985
|
attachLiveSinks(ctx3, manager, true);
|
|
660774
660986
|
if (!ctx3.startBackgroundPrompt) {
|
|
660775
660987
|
renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
|
|
660776
660988
|
}
|
|
660989
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
660777
660990
|
renderInfo(manager.startRunMode({ agent: Boolean(ctx3.startBackgroundPrompt), lowLatency: true, speech: Boolean(ctx3.startBackgroundPrompt && ctx3.voiceSpeak) }));
|
|
660778
|
-
await ensureLiveStreamingAsr(ctx3, manager);
|
|
660779
660991
|
continue;
|
|
660780
660992
|
case "run-chat":
|
|
660781
660993
|
await startLiveVoicechat(ctx3, manager);
|
|
@@ -662505,7 +662717,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
|
|
|
662505
662717
|
"known-sponsors.json"
|
|
662506
662718
|
);
|
|
662507
662719
|
if (existsSync141(knownFile)) {
|
|
662508
|
-
const saved = JSON.parse(
|
|
662720
|
+
const saved = JSON.parse(readFileSync115(knownFile, "utf8"));
|
|
662509
662721
|
if (Array.isArray(saved)) rawSponsors.push(...saved);
|
|
662510
662722
|
}
|
|
662511
662723
|
} catch {
|
|
@@ -662655,7 +662867,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
662655
662867
|
while (!done && Date.now() < deadline) {
|
|
662656
662868
|
await new Promise((resolve76) => setTimeout(resolve76, 250));
|
|
662657
662869
|
if (!existsSync141(args.streamFile)) continue;
|
|
662658
|
-
const raw =
|
|
662870
|
+
const raw = readFileSync115(args.streamFile, "utf8");
|
|
662659
662871
|
if (raw.length <= offset) continue;
|
|
662660
662872
|
pending2 += raw.slice(offset);
|
|
662661
662873
|
offset = raw.length;
|
|
@@ -662979,7 +663191,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
662979
663191
|
try {
|
|
662980
663192
|
if (existsSync141(knownFile)) {
|
|
662981
663193
|
const saved = JSON.parse(
|
|
662982
|
-
|
|
663194
|
+
readFileSync115(knownFile, "utf8")
|
|
662983
663195
|
);
|
|
662984
663196
|
for (const s2 of saved) {
|
|
662985
663197
|
if (!sponsors.some((sp) => sp.url === s2.url)) {
|
|
@@ -663155,7 +663367,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
663155
663367
|
const saveKey = selected.url || selected.peerId || selected.name;
|
|
663156
663368
|
try {
|
|
663157
663369
|
mkdirSync84(sponsorDir2, { recursive: true });
|
|
663158
|
-
const existing = existsSync141(knownFile) ? JSON.parse(
|
|
663370
|
+
const existing = existsSync141(knownFile) ? JSON.parse(readFileSync115(knownFile, "utf8")) : [];
|
|
663159
663371
|
const updated = existing.filter(
|
|
663160
663372
|
(s2) => (s2.url || s2.peerId || s2.name) !== saveKey
|
|
663161
663373
|
);
|
|
@@ -666262,7 +666474,7 @@ var init_commands = __esm({
|
|
|
666262
666474
|
});
|
|
666263
666475
|
|
|
666264
666476
|
// packages/cli/src/tui/project-context.ts
|
|
666265
|
-
import { existsSync as existsSync142, readFileSync as
|
|
666477
|
+
import { existsSync as existsSync142, readFileSync as readFileSync116, readdirSync as readdirSync48, mkdirSync as mkdirSync85, statSync as statSync54, writeFileSync as writeFileSync73 } from "node:fs";
|
|
666266
666478
|
import { dirname as dirname47, join as join154, basename as basename29, resolve as resolve62 } from "node:path";
|
|
666267
666479
|
import { homedir as homedir53 } from "node:os";
|
|
666268
666480
|
function projectContextUrlSpanAt(text2, index) {
|
|
@@ -666313,7 +666525,7 @@ function loadProjectMap(repoRoot) {
|
|
|
666313
666525
|
const mapPath2 = join154(repoRoot, OMNIUS_DIR, "context", "project-map.md");
|
|
666314
666526
|
if (existsSync142(mapPath2)) {
|
|
666315
666527
|
try {
|
|
666316
|
-
const content =
|
|
666528
|
+
const content = readFileSync116(mapPath2, "utf-8");
|
|
666317
666529
|
return content;
|
|
666318
666530
|
} catch {
|
|
666319
666531
|
}
|
|
@@ -666326,7 +666538,7 @@ function findGitDir(repoRoot) {
|
|
|
666326
666538
|
const gitPath = join154(dir, ".git");
|
|
666327
666539
|
if (existsSync142(gitPath)) {
|
|
666328
666540
|
try {
|
|
666329
|
-
const raw =
|
|
666541
|
+
const raw = readFileSync116(gitPath, "utf8").trim();
|
|
666330
666542
|
const match = raw.match(/^gitdir:\s*(.+)$/i);
|
|
666331
666543
|
if (match?.[1]) {
|
|
666332
666544
|
return resolve62(dir, match[1]);
|
|
@@ -666346,12 +666558,12 @@ function getGitInfo(repoRoot) {
|
|
|
666346
666558
|
if (!gitDir) return "";
|
|
666347
666559
|
const lines = [];
|
|
666348
666560
|
try {
|
|
666349
|
-
const head =
|
|
666561
|
+
const head = readFileSync116(join154(gitDir, "HEAD"), "utf-8").trim();
|
|
666350
666562
|
const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
666351
666563
|
if (refMatch?.[1]) {
|
|
666352
666564
|
lines.push(`Branch: ${refMatch[1]}`);
|
|
666353
666565
|
try {
|
|
666354
|
-
const refHash =
|
|
666566
|
+
const refHash = readFileSync116(join154(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
|
|
666355
666567
|
if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
|
|
666356
666568
|
} catch {
|
|
666357
666569
|
}
|
|
@@ -666379,7 +666591,7 @@ function countJsonMemoryEntries(dir) {
|
|
|
666379
666591
|
if (!file.endsWith(".json")) continue;
|
|
666380
666592
|
topics++;
|
|
666381
666593
|
try {
|
|
666382
|
-
const parsed = JSON.parse(
|
|
666594
|
+
const parsed = JSON.parse(readFileSync116(join154(dir, file), "utf8"));
|
|
666383
666595
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
666384
666596
|
entries += Object.keys(parsed).length;
|
|
666385
666597
|
}
|
|
@@ -666395,7 +666607,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
666395
666607
|
const path12 = join154(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
|
|
666396
666608
|
if (!existsSync142(path12)) return 0;
|
|
666397
666609
|
try {
|
|
666398
|
-
const parsed = JSON.parse(
|
|
666610
|
+
const parsed = JSON.parse(readFileSync116(path12, "utf8"));
|
|
666399
666611
|
return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
|
|
666400
666612
|
} catch {
|
|
666401
666613
|
return 0;
|
|
@@ -666404,7 +666616,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
666404
666616
|
function countJsonlLines(path12, maxBytes = 1e6) {
|
|
666405
666617
|
if (!existsSync142(path12)) return 0;
|
|
666406
666618
|
try {
|
|
666407
|
-
const text2 =
|
|
666619
|
+
const text2 = readFileSync116(path12, "utf8").slice(-maxBytes);
|
|
666408
666620
|
return text2.split(/\r?\n/).filter((line) => line.trim()).length;
|
|
666409
666621
|
} catch {
|
|
666410
666622
|
return 0;
|
|
@@ -666448,7 +666660,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
|
|
|
666448
666660
|
const files = readdirSync48(dir).filter((f2) => f2.endsWith(".json"));
|
|
666449
666661
|
for (const file of files.slice(0, 10)) {
|
|
666450
666662
|
try {
|
|
666451
|
-
const raw =
|
|
666663
|
+
const raw = readFileSync116(join154(dir, file), "utf-8");
|
|
666452
666664
|
const entries = JSON.parse(raw);
|
|
666453
666665
|
const topic = basename29(file, ".json");
|
|
666454
666666
|
for (const [k, v] of Object.entries(entries)) {
|
|
@@ -666938,7 +667150,7 @@ function extractMakeBootstrapTargets(repoRoot) {
|
|
|
666938
667150
|
const makefile = ["Makefile", "makefile"].find((name10) => existsSync142(join154(repoRoot, name10)));
|
|
666939
667151
|
if (!makefile) return [];
|
|
666940
667152
|
try {
|
|
666941
|
-
const text2 =
|
|
667153
|
+
const text2 = readFileSync116(join154(repoRoot, makefile), "utf8");
|
|
666942
667154
|
const targets = [];
|
|
666943
667155
|
for (const line of text2.split(/\r?\n/)) {
|
|
666944
667156
|
const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
|
|
@@ -667151,7 +667363,7 @@ function loadCustomToolsContext(repoRoot) {
|
|
|
667151
667363
|
const registryPath = join154(repoRoot, ".omnius", "tools", "registry.json");
|
|
667152
667364
|
const indexPath = join154(repoRoot, ".omnius", "tools", "README.md");
|
|
667153
667365
|
if (!existsSync142(registryPath)) return "";
|
|
667154
|
-
const registry4 = JSON.parse(
|
|
667366
|
+
const registry4 = JSON.parse(readFileSync116(registryPath, "utf-8"));
|
|
667155
667367
|
const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
|
|
667156
667368
|
const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
|
|
667157
667369
|
if (byRate !== 0) return byRate;
|
|
@@ -667361,7 +667573,7 @@ var init_project_context = __esm({
|
|
|
667361
667573
|
});
|
|
667362
667574
|
|
|
667363
667575
|
// packages/cli/src/realtime.ts
|
|
667364
|
-
import { existsSync as existsSync143, readFileSync as
|
|
667576
|
+
import { existsSync as existsSync143, readFileSync as readFileSync117, readdirSync as readdirSync49 } from "node:fs";
|
|
667365
667577
|
import { basename as basename30, join as join155, resolve as resolve63 } from "node:path";
|
|
667366
667578
|
function clampInt2(value2, fallback, min, max) {
|
|
667367
667579
|
const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
|
|
@@ -667383,7 +667595,7 @@ function firstReadable(candidates) {
|
|
|
667383
667595
|
for (const path12 of candidates) {
|
|
667384
667596
|
if (!existsSync143(path12)) continue;
|
|
667385
667597
|
try {
|
|
667386
|
-
return { path: path12, content:
|
|
667598
|
+
return { path: path12, content: readFileSync117(path12, "utf8") };
|
|
667387
667599
|
} catch {
|
|
667388
667600
|
return null;
|
|
667389
667601
|
}
|
|
@@ -667406,7 +667618,7 @@ function projectVoice(repoRoot) {
|
|
|
667406
667618
|
return ap - bp || a2.localeCompare(b);
|
|
667407
667619
|
});
|
|
667408
667620
|
const first2 = files[0];
|
|
667409
|
-
return first2 ? { path: join155(voiceDir3, first2), content:
|
|
667621
|
+
return first2 ? { path: join155(voiceDir3, first2), content: readFileSync117(join155(voiceDir3, first2), "utf8") } : null;
|
|
667410
667622
|
} catch {
|
|
667411
667623
|
return null;
|
|
667412
667624
|
}
|
|
@@ -667594,7 +667806,7 @@ __export(chat_session_exports, {
|
|
|
667594
667806
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
667595
667807
|
import {
|
|
667596
667808
|
existsSync as existsSync144,
|
|
667597
|
-
readFileSync as
|
|
667809
|
+
readFileSync as readFileSync118,
|
|
667598
667810
|
readdirSync as readdirSync50,
|
|
667599
667811
|
writeFileSync as writeFileSync74,
|
|
667600
667812
|
renameSync as renameSync13,
|
|
@@ -667703,7 +667915,7 @@ function normalizeLoadedSession(parsed) {
|
|
|
667703
667915
|
}
|
|
667704
667916
|
function readSessionFile(fp) {
|
|
667705
667917
|
try {
|
|
667706
|
-
const parsed = JSON.parse(
|
|
667918
|
+
const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
|
|
667707
667919
|
if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
|
|
667708
667920
|
return normalizeLoadedSession(parsed);
|
|
667709
667921
|
} catch {
|
|
@@ -667736,7 +667948,7 @@ function loadPersistedSessions() {
|
|
|
667736
667948
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
667737
667949
|
const fp = join156(dir, f2);
|
|
667738
667950
|
try {
|
|
667739
|
-
const parsed = JSON.parse(
|
|
667951
|
+
const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
|
|
667740
667952
|
if (f2.endsWith(".inflight.json")) {
|
|
667741
667953
|
if (parsed && parsed.pid && parsed.status === "running") {
|
|
667742
667954
|
try {
|
|
@@ -667778,7 +667990,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667778
667990
|
const diaryPath = join156(cwd4, ".omnius", "context", "session-diary.md");
|
|
667779
667991
|
if (existsSync144(diaryPath)) {
|
|
667780
667992
|
try {
|
|
667781
|
-
const diary =
|
|
667993
|
+
const diary = readFileSync118(diaryPath, "utf-8").slice(0, 1e3);
|
|
667782
667994
|
parts.push(`\\nPrevious session history:\\n${diary}`);
|
|
667783
667995
|
} catch {
|
|
667784
667996
|
}
|
|
@@ -667793,7 +668005,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667793
668005
|
);
|
|
667794
668006
|
for (const f2 of files.slice(0, 3)) {
|
|
667795
668007
|
try {
|
|
667796
|
-
const data = JSON.parse(
|
|
668008
|
+
const data = JSON.parse(readFileSync118(join156(memDir, f2), "utf-8"));
|
|
667797
668009
|
const entries = Object.entries(data).slice(0, 3);
|
|
667798
668010
|
if (entries.length > 0) {
|
|
667799
668011
|
parts.push(
|
|
@@ -667813,7 +668025,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667813
668025
|
const p2 = join156(cwd4, name10);
|
|
667814
668026
|
if (existsSync144(p2)) {
|
|
667815
668027
|
try {
|
|
667816
|
-
const content =
|
|
668028
|
+
const content = readFileSync118(p2, "utf-8").slice(0, 500);
|
|
667817
668029
|
parts.push(`\\nProject instructions (${name10}):\\n${content}`);
|
|
667818
668030
|
} catch {
|
|
667819
668031
|
}
|
|
@@ -667835,7 +668047,7 @@ function getSession2(sessionId, model, cwd4) {
|
|
|
667835
668047
|
try {
|
|
667836
668048
|
const fp = sessionPath(sessionId);
|
|
667837
668049
|
if (existsSync144(fp)) {
|
|
667838
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
668050
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
|
|
667839
668051
|
if (parsed && parsed.id === sessionId) {
|
|
667840
668052
|
parsed.lastActivity = Date.now();
|
|
667841
668053
|
if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
|
|
@@ -668022,7 +668234,7 @@ function drainCheckins(sessionId) {
|
|
|
668022
668234
|
const fp = checkinPath(sessionId);
|
|
668023
668235
|
if (!existsSync144(fp)) return [];
|
|
668024
668236
|
try {
|
|
668025
|
-
const raw =
|
|
668237
|
+
const raw = readFileSync118(fp, "utf-8");
|
|
668026
668238
|
try {
|
|
668027
668239
|
unlinkSync30(fp);
|
|
668028
668240
|
} catch {
|
|
@@ -668088,7 +668300,7 @@ function lookupSession(id2) {
|
|
|
668088
668300
|
try {
|
|
668089
668301
|
const fp = sessionPath(id2);
|
|
668090
668302
|
if (existsSync144(fp)) {
|
|
668091
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
668303
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
|
|
668092
668304
|
if (parsed && parsed.id === id2) {
|
|
668093
668305
|
sessions2.set(id2, parsed);
|
|
668094
668306
|
return parsed;
|
|
@@ -668141,7 +668353,7 @@ function getInFlightChat(sessionId) {
|
|
|
668141
668353
|
try {
|
|
668142
668354
|
const p2 = inFlightPath(sessionId);
|
|
668143
668355
|
if (existsSync144(p2)) {
|
|
668144
|
-
const parsed = JSON.parse(
|
|
668356
|
+
const parsed = JSON.parse(readFileSync118(p2, "utf-8"));
|
|
668145
668357
|
if (parsed && parsed.sessionId === sessionId) {
|
|
668146
668358
|
return parsed;
|
|
668147
668359
|
}
|
|
@@ -669546,7 +669758,7 @@ __export(banner_exports, {
|
|
|
669546
669758
|
setBannerWriter: () => setBannerWriter,
|
|
669547
669759
|
setGridText: () => setGridText
|
|
669548
669760
|
});
|
|
669549
|
-
import { existsSync as existsSync146, readFileSync as
|
|
669761
|
+
import { existsSync as existsSync146, readFileSync as readFileSync119, writeFileSync as writeFileSync75, mkdirSync as mkdirSync87 } from "node:fs";
|
|
669550
669762
|
import { join as join157 } from "node:path";
|
|
669551
669763
|
function setBannerWriter(writer) {
|
|
669552
669764
|
chromeWrite3 = writer;
|
|
@@ -669688,7 +669900,7 @@ function loadBannerDesign(workDir, id2) {
|
|
|
669688
669900
|
const file = join157(workDir, ".omnius", "banners", `${id2}.json`);
|
|
669689
669901
|
if (!existsSync146(file)) return null;
|
|
669690
669902
|
try {
|
|
669691
|
-
return JSON.parse(
|
|
669903
|
+
return JSON.parse(readFileSync119(file, "utf8"));
|
|
669692
669904
|
} catch {
|
|
669693
669905
|
return null;
|
|
669694
669906
|
}
|
|
@@ -670018,13 +670230,13 @@ var init_banner = __esm({
|
|
|
670018
670230
|
});
|
|
670019
670231
|
|
|
670020
670232
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
670021
|
-
import { existsSync as existsSync147, readFileSync as
|
|
670233
|
+
import { existsSync as existsSync147, readFileSync as readFileSync120, writeFileSync as writeFileSync76, mkdirSync as mkdirSync88, readdirSync as readdirSync51 } from "node:fs";
|
|
670022
670234
|
import { join as join158, basename as basename33 } from "node:path";
|
|
670023
670235
|
function loadToolProfile(repoRoot) {
|
|
670024
670236
|
const filePath = join158(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
670025
670237
|
try {
|
|
670026
670238
|
if (!existsSync147(filePath)) return null;
|
|
670027
|
-
return JSON.parse(
|
|
670239
|
+
return JSON.parse(readFileSync120(filePath, "utf-8"));
|
|
670028
670240
|
} catch {
|
|
670029
670241
|
return null;
|
|
670030
670242
|
}
|
|
@@ -670090,7 +670302,7 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
670090
670302
|
const filePath = join158(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
|
|
670091
670303
|
try {
|
|
670092
670304
|
if (!existsSync147(filePath)) return null;
|
|
670093
|
-
const cached = JSON.parse(
|
|
670305
|
+
const cached = JSON.parse(readFileSync120(filePath, "utf-8"));
|
|
670094
670306
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
670095
670307
|
} catch {
|
|
670096
670308
|
return null;
|
|
@@ -670154,7 +670366,7 @@ function extractFromPackageJson(repoRoot, tags) {
|
|
|
670154
670366
|
const pkgPath = join158(repoRoot, "package.json");
|
|
670155
670367
|
try {
|
|
670156
670368
|
if (!existsSync147(pkgPath)) return;
|
|
670157
|
-
const pkg = JSON.parse(
|
|
670369
|
+
const pkg = JSON.parse(readFileSync120(pkgPath, "utf-8"));
|
|
670158
670370
|
if (pkg.name && typeof pkg.name === "string") {
|
|
670159
670371
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
670160
670372
|
for (const p2 of parts) tags.push(p2);
|
|
@@ -670225,7 +670437,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
670225
670437
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
670226
670438
|
tags.push(topic);
|
|
670227
670439
|
try {
|
|
670228
|
-
const data = JSON.parse(
|
|
670440
|
+
const data = JSON.parse(readFileSync120(join158(memoryDir, file), "utf-8"));
|
|
670229
670441
|
if (data && typeof data === "object") {
|
|
670230
670442
|
const keys = Object.keys(data).slice(0, 3);
|
|
670231
670443
|
for (const key of keys) {
|
|
@@ -671268,7 +671480,7 @@ var init_edit_history = __esm({
|
|
|
671268
671480
|
});
|
|
671269
671481
|
|
|
671270
671482
|
// packages/cli/src/tui/snr-engine.ts
|
|
671271
|
-
import { existsSync as existsSync148, readdirSync as readdirSync52, readFileSync as
|
|
671483
|
+
import { existsSync as existsSync148, readdirSync as readdirSync52, readFileSync as readFileSync121, writeFileSync as writeFileSync77, mkdirSync as mkdirSync90, rmSync as rmSync13 } from "node:fs";
|
|
671272
671484
|
import { join as join160, basename as basename34 } from "node:path";
|
|
671273
671485
|
function computeDPrime(signalScores, noiseScores) {
|
|
671274
671486
|
if (signalScores.length === 0 || noiseScores.length === 0) return 0;
|
|
@@ -671575,7 +671787,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671575
671787
|
const topic = basename34(f2, ".json");
|
|
671576
671788
|
if (topics.length > 0 && !topics.includes(topic)) continue;
|
|
671577
671789
|
try {
|
|
671578
|
-
const data = JSON.parse(
|
|
671790
|
+
const data = JSON.parse(readFileSync121(join160(dir, f2), "utf-8"));
|
|
671579
671791
|
for (const [key, val] of Object.entries(data)) {
|
|
671580
671792
|
const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
671581
671793
|
entries.push({ topic, key, value: value2 });
|
|
@@ -671677,7 +671889,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671677
671889
|
const file = join160(memDir, `${topic}.json`);
|
|
671678
671890
|
if (!existsSync148(file)) continue;
|
|
671679
671891
|
try {
|
|
671680
|
-
const data = JSON.parse(
|
|
671892
|
+
const data = JSON.parse(readFileSync121(file, "utf-8"));
|
|
671681
671893
|
const moved = {};
|
|
671682
671894
|
for (const key of keys) {
|
|
671683
671895
|
if (key in data) {
|
|
@@ -671692,7 +671904,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671692
671904
|
let archiveData = {};
|
|
671693
671905
|
if (existsSync148(archiveFile)) {
|
|
671694
671906
|
try {
|
|
671695
|
-
archiveData = JSON.parse(
|
|
671907
|
+
archiveData = JSON.parse(readFileSync121(archiveFile, "utf-8"));
|
|
671696
671908
|
} catch {
|
|
671697
671909
|
}
|
|
671698
671910
|
}
|
|
@@ -671731,7 +671943,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671731
671943
|
});
|
|
671732
671944
|
|
|
671733
671945
|
// packages/cli/src/tui/promptLoader.ts
|
|
671734
|
-
import { readFileSync as
|
|
671946
|
+
import { readFileSync as readFileSync122, existsSync as existsSync149 } from "node:fs";
|
|
671735
671947
|
import { join as join161, dirname as dirname49 } from "node:path";
|
|
671736
671948
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
671737
671949
|
function loadPrompt3(promptPath, vars) {
|
|
@@ -671741,7 +671953,7 @@ function loadPrompt3(promptPath, vars) {
|
|
|
671741
671953
|
if (!existsSync149(fullPath)) {
|
|
671742
671954
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
671743
671955
|
}
|
|
671744
|
-
content =
|
|
671956
|
+
content = readFileSync122(fullPath, "utf-8");
|
|
671745
671957
|
cache7.set(promptPath, content);
|
|
671746
671958
|
}
|
|
671747
671959
|
if (!vars) return content;
|
|
@@ -671761,7 +671973,7 @@ var init_promptLoader3 = __esm({
|
|
|
671761
671973
|
});
|
|
671762
671974
|
|
|
671763
671975
|
// packages/cli/src/tui/dream-engine.ts
|
|
671764
|
-
import { mkdirSync as mkdirSync91, writeFileSync as writeFileSync78, readFileSync as
|
|
671976
|
+
import { mkdirSync as mkdirSync91, writeFileSync as writeFileSync78, readFileSync as readFileSync123, existsSync as existsSync150, readdirSync as readdirSync53 } from "node:fs";
|
|
671765
671977
|
import { join as join162, basename as basename35 } from "node:path";
|
|
671766
671978
|
function setDreamWriteContent(fn) {
|
|
671767
671979
|
_dreamWriteContent = fn;
|
|
@@ -671777,7 +671989,7 @@ function loadAutoresearchMemory(repoRoot) {
|
|
|
671777
671989
|
const memoryPath = join162(repoRoot, ".omnius", "memory", "autoresearch.json");
|
|
671778
671990
|
if (!existsSync150(memoryPath)) return "";
|
|
671779
671991
|
try {
|
|
671780
|
-
const raw =
|
|
671992
|
+
const raw = readFileSync123(memoryPath, "utf-8");
|
|
671781
671993
|
const data = JSON.parse(raw);
|
|
671782
671994
|
const sections = [];
|
|
671783
671995
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -672012,7 +672224,7 @@ var init_dream_engine = __esm({
|
|
|
672012
672224
|
if (!existsSync150(targetPath)) {
|
|
672013
672225
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
672014
672226
|
}
|
|
672015
|
-
let content =
|
|
672227
|
+
let content = readFileSync123(targetPath, "utf-8");
|
|
672016
672228
|
if (!content.includes(oldStr)) {
|
|
672017
672229
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
672018
672230
|
}
|
|
@@ -672100,7 +672312,7 @@ var init_dream_engine = __esm({
|
|
|
672100
672312
|
if (!existsSync150(targetPath)) {
|
|
672101
672313
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
672102
672314
|
}
|
|
672103
|
-
let content =
|
|
672315
|
+
let content = readFileSync123(targetPath, "utf-8");
|
|
672104
672316
|
if (!content.includes(oldStr)) {
|
|
672105
672317
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
672106
672318
|
}
|
|
@@ -673064,7 +673276,7 @@ ${summary}` };
|
|
|
673064
673276
|
try {
|
|
673065
673277
|
let notes = [];
|
|
673066
673278
|
if (existsSync150(notesPath)) {
|
|
673067
|
-
notes = JSON.parse(
|
|
673279
|
+
notes = JSON.parse(readFileSync123(notesPath, "utf-8"));
|
|
673068
673280
|
}
|
|
673069
673281
|
if (action === "add") {
|
|
673070
673282
|
const note = {
|
|
@@ -673704,7 +673916,7 @@ var init_bless_engine = __esm({
|
|
|
673704
673916
|
});
|
|
673705
673917
|
|
|
673706
673918
|
// packages/cli/src/tui/dmn-engine.ts
|
|
673707
|
-
import { existsSync as existsSync151, readFileSync as
|
|
673919
|
+
import { existsSync as existsSync151, readFileSync as readFileSync124, writeFileSync as writeFileSync79, mkdirSync as mkdirSync92, readdirSync as readdirSync54, unlinkSync as unlinkSync31 } from "node:fs";
|
|
673708
673920
|
import { join as join163, basename as basename36 } from "node:path";
|
|
673709
673921
|
import { exec as exec6 } from "node:child_process";
|
|
673710
673922
|
import { promisify as promisify8 } from "node:util";
|
|
@@ -674589,7 +674801,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
674589
674801
|
const path12 = join163(this.stateDir, "state.json");
|
|
674590
674802
|
if (existsSync151(path12)) {
|
|
674591
674803
|
try {
|
|
674592
|
-
this.state = JSON.parse(
|
|
674804
|
+
this.state = JSON.parse(readFileSync124(path12, "utf-8"));
|
|
674593
674805
|
} catch {
|
|
674594
674806
|
}
|
|
674595
674807
|
}
|
|
@@ -674623,7 +674835,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
674623
674835
|
const latestByFingerprint = /* @__PURE__ */ new Map();
|
|
674624
674836
|
for (const file of files) {
|
|
674625
674837
|
try {
|
|
674626
|
-
const parsed = JSON.parse(
|
|
674838
|
+
const parsed = JSON.parse(readFileSync124(join163(this.historyDir, file), "utf-8"));
|
|
674627
674839
|
latestByFingerprint.set(this.fingerprintCycle(parsed), file);
|
|
674628
674840
|
} catch {
|
|
674629
674841
|
keep.add(file);
|
|
@@ -676442,7 +676654,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
|
|
|
676442
676654
|
import {
|
|
676443
676655
|
existsSync as existsSync152,
|
|
676444
676656
|
mkdirSync as mkdirSync93,
|
|
676445
|
-
readFileSync as
|
|
676657
|
+
readFileSync as readFileSync125,
|
|
676446
676658
|
statSync as statSync55,
|
|
676447
676659
|
unlinkSync as unlinkSync32,
|
|
676448
676660
|
writeFileSync as writeFileSync80
|
|
@@ -676672,7 +676884,7 @@ function scopedTool(base3, root, mode) {
|
|
|
676672
676884
|
);
|
|
676673
676885
|
if (!materialized.ok) return denied(materialized.error);
|
|
676674
676886
|
mkdirSync93(dirname50(guarded.path.abs), { recursive: true });
|
|
676675
|
-
writeFileSync80(guarded.path.abs,
|
|
676887
|
+
writeFileSync80(guarded.path.abs, readFileSync125(materialized.path));
|
|
676676
676888
|
materialized.cleanup?.();
|
|
676677
676889
|
restoredEditPath = guarded.path.abs;
|
|
676678
676890
|
}
|
|
@@ -676796,7 +677008,7 @@ function readManifest(root) {
|
|
|
676796
677008
|
ensureManifest(root);
|
|
676797
677009
|
try {
|
|
676798
677010
|
const parsed = JSON.parse(
|
|
676799
|
-
|
|
677011
|
+
readFileSync125(manifestPath(root), "utf8")
|
|
676800
677012
|
);
|
|
676801
677013
|
const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
|
|
676802
677014
|
Object.entries(parsed.objects).filter(
|
|
@@ -676848,7 +677060,7 @@ function rememberCreated(root, absPath) {
|
|
|
676848
677060
|
}
|
|
676849
677061
|
}
|
|
676850
677062
|
mkdirSync93(join164(root, OBJECTS_DIR), { recursive: true });
|
|
676851
|
-
const data =
|
|
677063
|
+
const data = readFileSync125(guarded.path.abs);
|
|
676852
677064
|
const prefix = randomBytes26(48);
|
|
676853
677065
|
const key = randomBytes26(32);
|
|
676854
677066
|
const iv = randomBytes26(12);
|
|
@@ -676904,7 +677116,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
676904
677116
|
error: `Scoped artifact storage is missing for ${rel}.`
|
|
676905
677117
|
};
|
|
676906
677118
|
}
|
|
676907
|
-
const blob =
|
|
677119
|
+
const blob = readFileSync125(storedAbs);
|
|
676908
677120
|
if (blob.length < object.prefixBytes) {
|
|
676909
677121
|
return {
|
|
676910
677122
|
ok: false,
|
|
@@ -677875,7 +678087,7 @@ import {
|
|
|
677875
678087
|
existsSync as existsSync153,
|
|
677876
678088
|
mkdirSync as mkdirSync94,
|
|
677877
678089
|
readdirSync as readdirSync55,
|
|
677878
|
-
readFileSync as
|
|
678090
|
+
readFileSync as readFileSync126,
|
|
677879
678091
|
writeFileSync as writeFileSync81,
|
|
677880
678092
|
unlinkSync as unlinkSync33
|
|
677881
678093
|
} from "node:fs";
|
|
@@ -678644,7 +678856,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
|
678644
678856
|
for (const file of files.reverse()) {
|
|
678645
678857
|
try {
|
|
678646
678858
|
return JSON.parse(
|
|
678647
|
-
|
|
678859
|
+
readFileSync126(join165(dir, file), "utf8")
|
|
678648
678860
|
);
|
|
678649
678861
|
} catch {
|
|
678650
678862
|
}
|
|
@@ -680382,7 +680594,7 @@ __export(vision_ingress_exports, {
|
|
|
680382
680594
|
resolveVisionModel: () => resolveVisionModel,
|
|
680383
680595
|
runVisionIngress: () => runVisionIngress
|
|
680384
680596
|
});
|
|
680385
|
-
import { existsSync as existsSync154, readFileSync as
|
|
680597
|
+
import { existsSync as existsSync154, readFileSync as readFileSync127, unlinkSync as unlinkSync34 } from "node:fs";
|
|
680386
680598
|
import { join as join166 } from "node:path";
|
|
680387
680599
|
async function isTesseractAvailable() {
|
|
680388
680600
|
try {
|
|
@@ -680437,7 +680649,7 @@ async function advancedOcr(imagePath) {
|
|
|
680437
680649
|
], { timeout: 15e3 });
|
|
680438
680650
|
const txtFile = `${outFile}.txt`;
|
|
680439
680651
|
if (existsSync154(txtFile)) {
|
|
680440
|
-
const text2 =
|
|
680652
|
+
const text2 = readFileSync127(txtFile, "utf-8").trim();
|
|
680441
680653
|
if (text2.length > 0) results.push(text2);
|
|
680442
680654
|
try {
|
|
680443
680655
|
unlinkSync34(txtFile);
|
|
@@ -680622,7 +680834,7 @@ import {
|
|
|
680622
680834
|
unlinkSync as unlinkSync35,
|
|
680623
680835
|
readdirSync as readdirSync56,
|
|
680624
680836
|
statSync as statSync56,
|
|
680625
|
-
readFileSync as
|
|
680837
|
+
readFileSync as readFileSync128,
|
|
680626
680838
|
writeFileSync as writeFileSync82,
|
|
680627
680839
|
appendFileSync as appendFileSync18
|
|
680628
680840
|
} from "node:fs";
|
|
@@ -686734,7 +686946,7 @@ ${mediaContext}` : ""
|
|
|
686734
686946
|
const path12 = this.telegramConversationPath(sessionKey);
|
|
686735
686947
|
if (!existsSync155(path12)) return;
|
|
686736
686948
|
try {
|
|
686737
|
-
const parsed = JSON.parse(
|
|
686949
|
+
const parsed = JSON.parse(readFileSync128(path12, "utf8"));
|
|
686738
686950
|
const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
|
|
686739
686951
|
if (Array.isArray(parsed.history)) {
|
|
686740
686952
|
this.chatHistory.set(
|
|
@@ -686948,7 +687160,7 @@ ${mediaContext}` : ""
|
|
|
686948
687160
|
for (const file of readdirSync56(this.telegramConversationDir)) {
|
|
686949
687161
|
if (!file.endsWith(".json")) continue;
|
|
686950
687162
|
try {
|
|
686951
|
-
const raw =
|
|
687163
|
+
const raw = readFileSync128(
|
|
686952
687164
|
join167(this.telegramConversationDir, file),
|
|
686953
687165
|
"utf8"
|
|
686954
687166
|
);
|
|
@@ -691635,7 +691847,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
691635
691847
|
const lockFile = join167(lockDir, `bot-${botUserId}.owner.lock`);
|
|
691636
691848
|
if (existsSync155(lockFile)) {
|
|
691637
691849
|
try {
|
|
691638
|
-
const prior = JSON.parse(
|
|
691850
|
+
const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
|
|
691639
691851
|
const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
|
|
691640
691852
|
if (priorAlive) {
|
|
691641
691853
|
throw new Error(
|
|
@@ -691668,7 +691880,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
691668
691880
|
try {
|
|
691669
691881
|
if (!existsSync155(lockFile)) return;
|
|
691670
691882
|
try {
|
|
691671
|
-
const prior = JSON.parse(
|
|
691883
|
+
const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
|
|
691672
691884
|
if (prior.pid !== process.pid) return;
|
|
691673
691885
|
} catch {
|
|
691674
691886
|
}
|
|
@@ -696611,7 +696823,7 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
696611
696823
|
readTelegramToolButtonState(nonce) {
|
|
696612
696824
|
try {
|
|
696613
696825
|
const parsed = JSON.parse(
|
|
696614
|
-
|
|
696826
|
+
readFileSync128(this.telegramToolButtonPath(nonce), "utf-8")
|
|
696615
696827
|
);
|
|
696616
696828
|
if (!parsed || parsed.expiresAt < Date.now()) return null;
|
|
696617
696829
|
return parsed;
|
|
@@ -698065,7 +698277,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
698065
698277
|
const ingressResult = await runVisionIngress2(
|
|
698066
698278
|
{
|
|
698067
698279
|
path: localPath,
|
|
698068
|
-
buffer:
|
|
698280
|
+
buffer: readFileSync128(localPath),
|
|
698069
698281
|
mime: telegramImageMime(media)
|
|
698070
698282
|
},
|
|
698071
698283
|
this.agentConfig?.model ?? ""
|
|
@@ -698460,7 +698672,7 @@ ${text2}`.trim()
|
|
|
698460
698672
|
}
|
|
698461
698673
|
if (!existsSync155(media.value))
|
|
698462
698674
|
throw new Error(`File does not exist: ${media.value}`);
|
|
698463
|
-
const buffer2 =
|
|
698675
|
+
const buffer2 = readFileSync128(media.value);
|
|
698464
698676
|
const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
698465
698677
|
const filename = basename39(media.value);
|
|
698466
698678
|
const contentType = mimeForPath(media.value, media.kind);
|
|
@@ -698574,7 +698786,7 @@ Content-Type: ${contentType}\r
|
|
|
698574
698786
|
const sidecarPath2 = `${imagePath}.json`;
|
|
698575
698787
|
if (!existsSync155(sidecarPath2)) return null;
|
|
698576
698788
|
try {
|
|
698577
|
-
const raw =
|
|
698789
|
+
const raw = readFileSync128(sidecarPath2, "utf8");
|
|
698578
698790
|
const parsed = JSON.parse(raw);
|
|
698579
698791
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
698580
698792
|
return null;
|
|
@@ -698634,7 +698846,7 @@ Content-Type: ${contentType}\r
|
|
|
698634
698846
|
const sidecarPath2 = `${videoPath}.json`;
|
|
698635
698847
|
if (!existsSync155(sidecarPath2)) return null;
|
|
698636
698848
|
try {
|
|
698637
|
-
const raw =
|
|
698849
|
+
const raw = readFileSync128(sidecarPath2, "utf8");
|
|
698638
698850
|
const parsed = JSON.parse(raw);
|
|
698639
698851
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
698640
698852
|
return null;
|
|
@@ -698779,7 +698991,7 @@ Content-Type: ${contentType}\r
|
|
|
698779
698991
|
addField(field, pathOrFileId);
|
|
698780
698992
|
continue;
|
|
698781
698993
|
}
|
|
698782
|
-
const buffer2 =
|
|
698994
|
+
const buffer2 = readFileSync128(pathOrFileId);
|
|
698783
698995
|
const filename = basename39(pathOrFileId);
|
|
698784
698996
|
parts.push(Buffer.from(`--${boundary}\r
|
|
698785
698997
|
`));
|
|
@@ -700897,14 +701109,14 @@ __export(projects_exports, {
|
|
|
700897
701109
|
setCurrentProject: () => setCurrentProject,
|
|
700898
701110
|
unregisterProject: () => unregisterProject
|
|
700899
701111
|
});
|
|
700900
|
-
import { readFileSync as
|
|
701112
|
+
import { readFileSync as readFileSync129, writeFileSync as writeFileSync83, mkdirSync as mkdirSync96, existsSync as existsSync156, statSync as statSync57, renameSync as renameSync14 } from "node:fs";
|
|
700901
701113
|
import { homedir as homedir56 } from "node:os";
|
|
700902
701114
|
import { basename as basename40, join as join168, resolve as resolve68 } from "node:path";
|
|
700903
701115
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
700904
701116
|
function readAll2() {
|
|
700905
701117
|
try {
|
|
700906
701118
|
if (!existsSync156(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
|
|
700907
|
-
const raw =
|
|
701119
|
+
const raw = readFileSync129(PROJECTS_FILE, "utf8");
|
|
700908
701120
|
const parsed = JSON.parse(raw);
|
|
700909
701121
|
if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
|
|
700910
701122
|
return { projects: parsed.projects, schemaVersion: 1 };
|
|
@@ -700981,7 +701193,7 @@ function getCurrentProject() {
|
|
|
700981
701193
|
if (!currentRoot) {
|
|
700982
701194
|
try {
|
|
700983
701195
|
if (existsSync156(CURRENT_FILE)) {
|
|
700984
|
-
const persisted =
|
|
701196
|
+
const persisted = readFileSync129(CURRENT_FILE, "utf8").trim();
|
|
700985
701197
|
if (persisted) currentRoot = persisted;
|
|
700986
701198
|
}
|
|
700987
701199
|
} catch {
|
|
@@ -701895,7 +702107,7 @@ var init_access_policy = __esm({
|
|
|
701895
702107
|
|
|
701896
702108
|
// packages/cli/src/api/project-preferences.ts
|
|
701897
702109
|
import { createHash as createHash43 } from "node:crypto";
|
|
701898
|
-
import { existsSync as existsSync157, mkdirSync as mkdirSync97, readFileSync as
|
|
702110
|
+
import { existsSync as existsSync157, mkdirSync as mkdirSync97, readFileSync as readFileSync130, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync36 } from "node:fs";
|
|
701899
702111
|
import { homedir as homedir57 } from "node:os";
|
|
701900
702112
|
import { join as join169, resolve as resolve69 } from "node:path";
|
|
701901
702113
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
@@ -701928,7 +702140,7 @@ function readProjectPreferences(root) {
|
|
|
701928
702140
|
try {
|
|
701929
702141
|
const file = prefsPath(root);
|
|
701930
702142
|
if (!existsSync157(file)) return { ...DEFAULT_PREFS };
|
|
701931
|
-
const raw =
|
|
702143
|
+
const raw = readFileSync130(file, "utf8");
|
|
701932
702144
|
const parsed = JSON.parse(raw);
|
|
701933
702145
|
if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
|
|
701934
702146
|
return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
|
|
@@ -701995,7 +702207,7 @@ __export(audit_log_exports, {
|
|
|
701995
702207
|
recordAudit: () => recordAudit,
|
|
701996
702208
|
sanitizeBody: () => sanitizeBody
|
|
701997
702209
|
});
|
|
701998
|
-
import { mkdirSync as mkdirSync98, appendFileSync as appendFileSync19, readFileSync as
|
|
702210
|
+
import { mkdirSync as mkdirSync98, appendFileSync as appendFileSync19, readFileSync as readFileSync131, existsSync as existsSync158 } from "node:fs";
|
|
701999
702211
|
import { join as join170 } from "node:path";
|
|
702000
702212
|
function initAuditLog(omniusDir) {
|
|
702001
702213
|
auditDir = join170(omniusDir, "audit");
|
|
@@ -702032,7 +702244,7 @@ function sanitizeBody(body, maxLen = 200) {
|
|
|
702032
702244
|
function queryAudit(opts) {
|
|
702033
702245
|
if (!initialized || !existsSync158(auditFile)) return [];
|
|
702034
702246
|
try {
|
|
702035
|
-
const raw =
|
|
702247
|
+
const raw = readFileSync131(auditFile, "utf-8");
|
|
702036
702248
|
const lines = raw.split("\n").filter(Boolean);
|
|
702037
702249
|
let records = lines.map((l2) => {
|
|
702038
702250
|
try {
|
|
@@ -703005,7 +703217,7 @@ var init_direct_tool_registry = __esm({
|
|
|
703005
703217
|
});
|
|
703006
703218
|
|
|
703007
703219
|
// packages/cli/src/api/external-tool-registry.ts
|
|
703008
|
-
import { existsSync as existsSync161, mkdirSync as mkdirSync101, readFileSync as
|
|
703220
|
+
import { existsSync as existsSync161, mkdirSync as mkdirSync101, readFileSync as readFileSync132, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
|
|
703009
703221
|
import { join as join172 } from "node:path";
|
|
703010
703222
|
function externalToolStorePath(workingDir) {
|
|
703011
703223
|
return join172(workingDir, ".omnius", "external-tools.json");
|
|
@@ -703014,7 +703226,7 @@ function loadExternalTools(workingDir) {
|
|
|
703014
703226
|
const path12 = externalToolStorePath(workingDir);
|
|
703015
703227
|
if (!existsSync161(path12)) return [];
|
|
703016
703228
|
try {
|
|
703017
|
-
const parsed = JSON.parse(
|
|
703229
|
+
const parsed = JSON.parse(readFileSync132(path12, "utf-8"));
|
|
703018
703230
|
if (!parsed || !Array.isArray(parsed.tools)) return [];
|
|
703019
703231
|
return parsed.tools.filter(
|
|
703020
703232
|
(t2) => t2 && typeof t2.name === "string" && t2.transport != null
|
|
@@ -703353,7 +703565,7 @@ __export(aiwg_exports, {
|
|
|
703353
703565
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
703354
703566
|
tryRouteAiwg: () => tryRouteAiwg
|
|
703355
703567
|
});
|
|
703356
|
-
import { existsSync as existsSync162, readFileSync as
|
|
703568
|
+
import { existsSync as existsSync162, readFileSync as readFileSync133, readdirSync as readdirSync57, statSync as statSync60 } from "node:fs";
|
|
703357
703569
|
import { join as join173 } from "node:path";
|
|
703358
703570
|
import { homedir as homedir58 } from "node:os";
|
|
703359
703571
|
import { execSync as execSync38 } from "node:child_process";
|
|
@@ -703424,7 +703636,7 @@ function resolveAiwgRoot() {
|
|
|
703424
703636
|
const pj = join173(cur, "package.json");
|
|
703425
703637
|
if (existsSync162(pj)) {
|
|
703426
703638
|
try {
|
|
703427
|
-
const pkg = JSON.parse(
|
|
703639
|
+
const pkg = JSON.parse(readFileSync133(pj, "utf-8"));
|
|
703428
703640
|
if (pkg.name === "aiwg") {
|
|
703429
703641
|
_cachedAiwgRoot = cur;
|
|
703430
703642
|
return cur;
|
|
@@ -703514,7 +703726,7 @@ function readFirstLineDescription(dir) {
|
|
|
703514
703726
|
const p2 = join173(dir, candidate);
|
|
703515
703727
|
if (!existsSync162(p2)) continue;
|
|
703516
703728
|
try {
|
|
703517
|
-
const txt =
|
|
703729
|
+
const txt = readFileSync133(p2, "utf-8");
|
|
703518
703730
|
const descMatch = txt.match(/^description:\s*(.+)$/m);
|
|
703519
703731
|
if (descMatch) return descMatch[1].trim().slice(0, 200);
|
|
703520
703732
|
for (const line of txt.split("\n")) {
|
|
@@ -703565,7 +703777,7 @@ function walkForItems(dir, out, depth) {
|
|
|
703565
703777
|
}
|
|
703566
703778
|
function parseItem(p2) {
|
|
703567
703779
|
try {
|
|
703568
|
-
const raw =
|
|
703780
|
+
const raw = readFileSync133(p2, "utf-8");
|
|
703569
703781
|
const header = raw.slice(0, 3e3);
|
|
703570
703782
|
const nameMatch = header.match(/^name:\s*(.+)$/m);
|
|
703571
703783
|
const descMatch = header.match(/^description:\s*(.+)$/m);
|
|
@@ -703604,7 +703816,7 @@ function deriveSource(p2) {
|
|
|
703604
703816
|
function loadAiwgItemContent(path12, maxBytes = 2e4) {
|
|
703605
703817
|
try {
|
|
703606
703818
|
if (!existsSync162(path12)) return null;
|
|
703607
|
-
const raw =
|
|
703819
|
+
const raw = readFileSync133(path12, "utf-8");
|
|
703608
703820
|
return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
|
|
703609
703821
|
} catch {
|
|
703610
703822
|
return null;
|
|
@@ -704140,7 +704352,7 @@ __export(runtime_keys_exports, {
|
|
|
704140
704352
|
mintKey: () => mintKey,
|
|
704141
704353
|
revokeByPrefix: () => revokeByPrefix
|
|
704142
704354
|
});
|
|
704143
|
-
import { existsSync as existsSync163, readFileSync as
|
|
704355
|
+
import { existsSync as existsSync163, readFileSync as readFileSync134, writeFileSync as writeFileSync86, mkdirSync as mkdirSync102, chmodSync as chmodSync5 } from "node:fs";
|
|
704144
704356
|
import { join as join174 } from "node:path";
|
|
704145
704357
|
import { homedir as homedir59 } from "node:os";
|
|
704146
704358
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
@@ -704151,7 +704363,7 @@ function ensureDir2() {
|
|
|
704151
704363
|
function loadAll() {
|
|
704152
704364
|
if (!existsSync163(KEYS_FILE)) return [];
|
|
704153
704365
|
try {
|
|
704154
|
-
const raw =
|
|
704366
|
+
const raw = readFileSync134(KEYS_FILE, "utf-8");
|
|
704155
704367
|
const parsed = JSON.parse(raw);
|
|
704156
704368
|
if (!Array.isArray(parsed)) return [];
|
|
704157
704369
|
return parsed;
|
|
@@ -704237,7 +704449,7 @@ __export(tor_fallback_exports, {
|
|
|
704237
704449
|
torIsReachable: () => torIsReachable,
|
|
704238
704450
|
tunnelViaTor: () => tunnelViaTor
|
|
704239
704451
|
});
|
|
704240
|
-
import { existsSync as existsSync164, readFileSync as
|
|
704452
|
+
import { existsSync as existsSync164, readFileSync as readFileSync135 } from "node:fs";
|
|
704241
704453
|
import { homedir as homedir60 } from "node:os";
|
|
704242
704454
|
import { join as join175 } from "node:path";
|
|
704243
704455
|
import { createConnection as createConnection3 } from "node:net";
|
|
@@ -704250,7 +704462,7 @@ function getLocalOnion() {
|
|
|
704250
704462
|
for (const p2 of candidates) {
|
|
704251
704463
|
try {
|
|
704252
704464
|
if (existsSync164(p2)) {
|
|
704253
|
-
const v =
|
|
704465
|
+
const v = readFileSync135(p2, "utf-8").trim();
|
|
704254
704466
|
if (v && v.endsWith(".onion")) return v;
|
|
704255
704467
|
}
|
|
704256
704468
|
} catch {
|
|
@@ -704511,7 +704723,7 @@ var init_graphical_sudo = __esm({
|
|
|
704511
704723
|
});
|
|
704512
704724
|
|
|
704513
704725
|
// packages/cli/src/api/routes-v1.ts
|
|
704514
|
-
import { existsSync as existsSync166, mkdirSync as mkdirSync104, readFileSync as
|
|
704726
|
+
import { existsSync as existsSync166, mkdirSync as mkdirSync104, readFileSync as readFileSync136, readdirSync as readdirSync58, statSync as statSync61 } from "node:fs";
|
|
704515
704727
|
import { join as join177, resolve as pathResolve3 } from "node:path";
|
|
704516
704728
|
import { homedir as homedir61 } from "node:os";
|
|
704517
704729
|
async function tryRouteV1(ctx3) {
|
|
@@ -704795,7 +705007,7 @@ function walkForSkills(dir, out, depth) {
|
|
|
704795
705007
|
walkForSkills(p2, out, depth + 1);
|
|
704796
705008
|
} else if (e2.isFile() && e2.name === "SKILL.md") {
|
|
704797
705009
|
try {
|
|
704798
|
-
const content =
|
|
705010
|
+
const content = readFileSync136(p2, "utf-8").slice(0, 2e3);
|
|
704799
705011
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
704800
705012
|
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
704801
705013
|
out.push({
|
|
@@ -705751,7 +705963,7 @@ async function handleFilesRead(ctx3) {
|
|
|
705751
705963
|
}));
|
|
705752
705964
|
return true;
|
|
705753
705965
|
}
|
|
705754
|
-
const content =
|
|
705966
|
+
const content = readFileSync136(resolved, "utf-8");
|
|
705755
705967
|
const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
|
|
705756
705968
|
const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
|
|
705757
705969
|
const slice2 = content.slice(offset, offset + limit);
|
|
@@ -706053,7 +706265,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
706053
706265
|
for (const p2 of statePaths) {
|
|
706054
706266
|
if (!existsSync166(p2)) continue;
|
|
706055
706267
|
try {
|
|
706056
|
-
const raw =
|
|
706268
|
+
const raw = readFileSync136(p2, "utf-8");
|
|
706057
706269
|
states2.push({ source: p2, data: JSON.parse(raw) });
|
|
706058
706270
|
} catch (e2) {
|
|
706059
706271
|
states2.push({ source: p2, error: String(e2) });
|
|
@@ -706081,7 +706293,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
706081
706293
|
function loadAgentName() {
|
|
706082
706294
|
try {
|
|
706083
706295
|
const p2 = join177(homedir61(), ".omnius", "agent-name");
|
|
706084
|
-
if (existsSync166(p2)) return
|
|
706296
|
+
if (existsSync166(p2)) return readFileSync136(p2, "utf-8").trim();
|
|
706085
706297
|
} catch {
|
|
706086
706298
|
}
|
|
706087
706299
|
return null;
|
|
@@ -706097,7 +706309,7 @@ async function handleSponsors(ctx3) {
|
|
|
706097
706309
|
for (const p2 of candidates) {
|
|
706098
706310
|
if (!existsSync166(p2)) continue;
|
|
706099
706311
|
try {
|
|
706100
|
-
const raw = JSON.parse(
|
|
706312
|
+
const raw = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
706101
706313
|
if (Array.isArray(raw)) {
|
|
706102
706314
|
sponsors = raw;
|
|
706103
706315
|
break;
|
|
@@ -706177,7 +706389,7 @@ async function handleEvaluate(ctx3) {
|
|
|
706177
706389
|
}));
|
|
706178
706390
|
return true;
|
|
706179
706391
|
}
|
|
706180
|
-
const job = JSON.parse(
|
|
706392
|
+
const job = JSON.parse(readFileSync136(jobPath, "utf-8"));
|
|
706181
706393
|
sendJson2(res, 200, {
|
|
706182
706394
|
run_id: runId,
|
|
706183
706395
|
task: job.task,
|
|
@@ -706317,7 +706529,7 @@ async function handleMintKey(ctx3) {
|
|
|
706317
706529
|
function _readStatusFile(p2) {
|
|
706318
706530
|
if (!existsSync166(p2)) return null;
|
|
706319
706531
|
try {
|
|
706320
|
-
const data = JSON.parse(
|
|
706532
|
+
const data = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
706321
706533
|
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
706322
706534
|
const pid = Number(data.pid);
|
|
706323
706535
|
if (pid > 0) {
|
|
@@ -706360,7 +706572,7 @@ function resolveLocalPeerId() {
|
|
|
706360
706572
|
try {
|
|
706361
706573
|
const regPath = join177(homedir61(), ".omnius", "nexus-registry.json");
|
|
706362
706574
|
if (existsSync166(regPath)) {
|
|
706363
|
-
const reg = JSON.parse(
|
|
706575
|
+
const reg = JSON.parse(readFileSync136(regPath, "utf-8"));
|
|
706364
706576
|
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
706365
706577
|
for (const entry of entries) {
|
|
706366
706578
|
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
@@ -707873,7 +708085,7 @@ function aimsDir() {
|
|
|
707873
708085
|
function readAimsFile(name10, fallback) {
|
|
707874
708086
|
try {
|
|
707875
708087
|
const p2 = join177(aimsDir(), name10);
|
|
707876
|
-
if (existsSync166(p2)) return JSON.parse(
|
|
708088
|
+
if (existsSync166(p2)) return JSON.parse(readFileSync136(p2, "utf-8"));
|
|
707877
708089
|
} catch {
|
|
707878
708090
|
}
|
|
707879
708091
|
return fallback;
|
|
@@ -708250,7 +708462,7 @@ async function handleAimsSuppliers(ctx3) {
|
|
|
708250
708462
|
for (const p2 of sponsorPaths) {
|
|
708251
708463
|
if (!existsSync166(p2)) continue;
|
|
708252
708464
|
try {
|
|
708253
|
-
const raw = JSON.parse(
|
|
708465
|
+
const raw = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
708254
708466
|
const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
|
|
708255
708467
|
for (const s2 of list) {
|
|
708256
708468
|
suppliers.push({
|
|
@@ -720206,7 +720418,7 @@ var init_auth_oidc = __esm({
|
|
|
720206
720418
|
});
|
|
720207
720419
|
|
|
720208
720420
|
// packages/cli/src/api/usage-tracker.ts
|
|
720209
|
-
import { mkdirSync as mkdirSync105, readFileSync as
|
|
720421
|
+
import { mkdirSync as mkdirSync105, readFileSync as readFileSync137, writeFileSync as writeFileSync88, existsSync as existsSync167 } from "node:fs";
|
|
720210
720422
|
import { join as join178 } from "node:path";
|
|
720211
720423
|
function initUsageTracker(omniusDir) {
|
|
720212
720424
|
const dir = join178(omniusDir, "usage");
|
|
@@ -720214,7 +720426,7 @@ function initUsageTracker(omniusDir) {
|
|
|
720214
720426
|
usageFile = join178(dir, "token-usage.json");
|
|
720215
720427
|
try {
|
|
720216
720428
|
if (existsSync167(usageFile)) {
|
|
720217
|
-
store = JSON.parse(
|
|
720429
|
+
store = JSON.parse(readFileSync137(usageFile, "utf-8"));
|
|
720218
720430
|
}
|
|
720219
720431
|
} catch {
|
|
720220
720432
|
store = { providers: {}, lastSaved: "" };
|
|
@@ -720913,7 +721125,7 @@ import {
|
|
|
720913
721125
|
createReadStream as createReadStream2,
|
|
720914
721126
|
mkdirSync as mkdirSync107,
|
|
720915
721127
|
writeFileSync as writeFileSync90,
|
|
720916
|
-
readFileSync as
|
|
721128
|
+
readFileSync as readFileSync138,
|
|
720917
721129
|
readdirSync as readdirSync59,
|
|
720918
721130
|
existsSync as existsSync169,
|
|
720919
721131
|
watch as fsWatch4,
|
|
@@ -720945,7 +721157,7 @@ function getVersion3() {
|
|
|
720945
721157
|
for (const pkgPath of candidates) {
|
|
720946
721158
|
try {
|
|
720947
721159
|
if (!existsSync169(pkgPath)) continue;
|
|
720948
|
-
const pkg = JSON.parse(
|
|
721160
|
+
const pkg = JSON.parse(readFileSync138(pkgPath, "utf8"));
|
|
720949
721161
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
720950
721162
|
return pkg.version ?? "0.0.0";
|
|
720951
721163
|
}
|
|
@@ -721361,7 +721573,7 @@ function isOriginAllowed(origin) {
|
|
|
721361
721573
|
try {
|
|
721362
721574
|
const accessFile = join181(homedir63(), ".omnius", "access");
|
|
721363
721575
|
if (existsSync169(accessFile)) {
|
|
721364
|
-
const persisted =
|
|
721576
|
+
const persisted = readFileSync138(accessFile, "utf8").trim().toLowerCase();
|
|
721365
721577
|
if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
|
|
721366
721578
|
accessMode = persisted;
|
|
721367
721579
|
}
|
|
@@ -722208,7 +722420,7 @@ function loadJob(id2) {
|
|
|
722208
722420
|
const file = join181(jobsDir(), `${id2}.json`);
|
|
722209
722421
|
if (!existsSync169(file)) return null;
|
|
722210
722422
|
try {
|
|
722211
|
-
return JSON.parse(
|
|
722423
|
+
return JSON.parse(readFileSync138(file, "utf-8"));
|
|
722212
722424
|
} catch {
|
|
722213
722425
|
return null;
|
|
722214
722426
|
}
|
|
@@ -722221,7 +722433,7 @@ function listJobs2() {
|
|
|
722221
722433
|
for (const file of files) {
|
|
722222
722434
|
try {
|
|
722223
722435
|
jobs.push(
|
|
722224
|
-
JSON.parse(
|
|
722436
|
+
JSON.parse(readFileSync138(join181(dir, file), "utf-8"))
|
|
722225
722437
|
);
|
|
722226
722438
|
} catch {
|
|
722227
722439
|
}
|
|
@@ -722239,7 +722451,7 @@ function pruneOldJobs() {
|
|
|
722239
722451
|
if (!file.endsWith(".json")) continue;
|
|
722240
722452
|
const path12 = join181(dir, file);
|
|
722241
722453
|
try {
|
|
722242
|
-
const job = JSON.parse(
|
|
722454
|
+
const job = JSON.parse(readFileSync138(path12, "utf-8"));
|
|
722243
722455
|
if (job.status === "running") {
|
|
722244
722456
|
kept++;
|
|
722245
722457
|
continue;
|
|
@@ -724395,7 +724607,7 @@ function readUpdateState() {
|
|
|
724395
724607
|
try {
|
|
724396
724608
|
const p2 = updateStateFile();
|
|
724397
724609
|
if (!existsSync169(p2)) return null;
|
|
724398
|
-
return JSON.parse(
|
|
724610
|
+
return JSON.parse(readFileSync138(p2, "utf-8"));
|
|
724399
724611
|
} catch {
|
|
724400
724612
|
return null;
|
|
724401
724613
|
}
|
|
@@ -724700,7 +724912,7 @@ function handleV1UpdateStatus(res) {
|
|
|
724700
724912
|
let exitCode = null;
|
|
724701
724913
|
try {
|
|
724702
724914
|
if (existsSync169(logPath3)) {
|
|
724703
|
-
const raw =
|
|
724915
|
+
const raw = readFileSync138(logPath3, "utf-8");
|
|
724704
724916
|
const m2 = raw.match(/__EXIT_CODE=(\d+)/);
|
|
724705
724917
|
if (m2) exitCode = parseInt(m2[1], 10);
|
|
724706
724918
|
logTail = raw.slice(-2e3);
|
|
@@ -729181,7 +729393,7 @@ function listScheduledTasks() {
|
|
|
729181
729393
|
if (dir.endsWith(`${join181(".omnius", "scheduled")}`) || dir.includes(`${join181(".omnius", "scheduled")}`)) {
|
|
729182
729394
|
const file = join181(dir, "tasks.json");
|
|
729183
729395
|
try {
|
|
729184
|
-
const raw =
|
|
729396
|
+
const raw = readFileSync138(file, "utf-8");
|
|
729185
729397
|
const json = JSON.parse(raw);
|
|
729186
729398
|
const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
729187
729399
|
tasks.forEach((t2, i2) => {
|
|
@@ -729279,7 +729491,7 @@ function setScheduledEnabled(id2, enabled2) {
|
|
|
729279
729491
|
const target = tasks.find((t2) => t2.id === id2);
|
|
729280
729492
|
if (!target) return false;
|
|
729281
729493
|
try {
|
|
729282
|
-
const raw =
|
|
729494
|
+
const raw = readFileSync138(target.file, "utf-8");
|
|
729283
729495
|
const json = JSON.parse(raw);
|
|
729284
729496
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
729285
729497
|
if (!arr[target.index]) return false;
|
|
@@ -729312,7 +729524,7 @@ function deleteScheduledById(id2) {
|
|
|
729312
729524
|
const target = tasks.find((t2) => t2.id === id2);
|
|
729313
729525
|
if (!target) return false;
|
|
729314
729526
|
try {
|
|
729315
|
-
const raw =
|
|
729527
|
+
const raw = readFileSync138(target.file, "utf-8");
|
|
729316
729528
|
const json = JSON.parse(raw);
|
|
729317
729529
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
729318
729530
|
if (!arr[target.index]) return false;
|
|
@@ -729537,7 +729749,7 @@ function reconcileScheduledTasks(apply) {
|
|
|
729537
729749
|
try {
|
|
729538
729750
|
let json = { tasks: [] };
|
|
729539
729751
|
try {
|
|
729540
|
-
const raw =
|
|
729752
|
+
const raw = readFileSync138(file, "utf-8");
|
|
729541
729753
|
json = JSON.parse(raw);
|
|
729542
729754
|
} catch {
|
|
729543
729755
|
}
|
|
@@ -729916,7 +730128,7 @@ function startApiServer(options2 = {}) {
|
|
|
729916
730128
|
const sid = f2.replace(/\.json$/, "");
|
|
729917
730129
|
try {
|
|
729918
730130
|
const items = JSON.parse(
|
|
729919
|
-
|
|
730131
|
+
readFileSync138(join181(dir, f2), "utf-8")
|
|
729920
730132
|
);
|
|
729921
730133
|
if (Array.isArray(items)) {
|
|
729922
730134
|
cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
|
|
@@ -729950,7 +730162,7 @@ function startApiServer(options2 = {}) {
|
|
|
729950
730162
|
}
|
|
729951
730163
|
return;
|
|
729952
730164
|
}
|
|
729953
|
-
next = JSON.parse(
|
|
730165
|
+
next = JSON.parse(readFileSync138(fp, "utf-8"));
|
|
729954
730166
|
if (!Array.isArray(next)) return;
|
|
729955
730167
|
} catch {
|
|
729956
730168
|
return;
|
|
@@ -730013,7 +730225,7 @@ function startApiServer(options2 = {}) {
|
|
|
730013
730225
|
if (!f2.endsWith(".json")) continue;
|
|
730014
730226
|
try {
|
|
730015
730227
|
const jobPath = join181(jobsDir3, f2);
|
|
730016
|
-
const job = JSON.parse(
|
|
730228
|
+
const job = JSON.parse(readFileSync138(jobPath, "utf-8"));
|
|
730017
730229
|
const jobTime = new Date(
|
|
730018
730230
|
job.startedAt ?? job.completedAt ?? 0
|
|
730019
730231
|
).getTime();
|
|
@@ -730035,8 +730247,8 @@ function startApiServer(options2 = {}) {
|
|
|
730035
730247
|
if (useTls) {
|
|
730036
730248
|
try {
|
|
730037
730249
|
tlsOpts = {
|
|
730038
|
-
cert:
|
|
730039
|
-
key:
|
|
730250
|
+
cert: readFileSync138(resolve71(tlsCert)),
|
|
730251
|
+
key: readFileSync138(resolve71(tlsKey))
|
|
730040
730252
|
};
|
|
730041
730253
|
} catch (e2) {
|
|
730042
730254
|
log22(`
|
|
@@ -730049,7 +730261,7 @@ function startApiServer(options2 = {}) {
|
|
|
730049
730261
|
try {
|
|
730050
730262
|
const accessFile = join181(homedir63(), ".omnius", "access");
|
|
730051
730263
|
if (existsSync169(accessFile)) {
|
|
730052
|
-
const persisted =
|
|
730264
|
+
const persisted = readFileSync138(accessFile, "utf8").trim();
|
|
730053
730265
|
const resolved = resolveAccessMode(persisted, host);
|
|
730054
730266
|
if (resolved) runtimeAccessMode = resolved;
|
|
730055
730267
|
}
|
|
@@ -730480,7 +730692,7 @@ function startApiServer(options2 = {}) {
|
|
|
730480
730692
|
for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
|
|
730481
730693
|
const p2 = join181(here, rel);
|
|
730482
730694
|
if (existsSync169(p2)) {
|
|
730483
|
-
const pkg = JSON.parse(
|
|
730695
|
+
const pkg = JSON.parse(readFileSync138(p2, "utf8"));
|
|
730484
730696
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
730485
730697
|
return pkg.version ?? null;
|
|
730486
730698
|
}
|
|
@@ -731496,7 +731708,7 @@ var clipboard_media_exports = {};
|
|
|
731496
731708
|
__export(clipboard_media_exports, {
|
|
731497
731709
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
731498
731710
|
});
|
|
731499
|
-
import { mkdirSync as mkdirSync108, readFileSync as
|
|
731711
|
+
import { mkdirSync as mkdirSync108, readFileSync as readFileSync139, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
|
|
731500
731712
|
import { join as join182 } from "node:path";
|
|
731501
731713
|
async function pasteClipboardImageToFile(repoRoot) {
|
|
731502
731714
|
const image = await readClipboardImage();
|
|
@@ -731513,7 +731725,7 @@ async function readClipboardImage() {
|
|
|
731513
731725
|
if (!await commandExists2("pngpaste", 1e3)) return null;
|
|
731514
731726
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
731515
731727
|
await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
|
|
731516
|
-
const buffer2 =
|
|
731728
|
+
const buffer2 = readFileSync139(tmp);
|
|
731517
731729
|
try {
|
|
731518
731730
|
rmSync15(tmp);
|
|
731519
731731
|
} catch {
|
|
@@ -731573,7 +731785,7 @@ import { resolve as resolve72, join as join183, dirname as dirname54, extname as
|
|
|
731573
731785
|
import { createRequire as createRequire9 } from "node:module";
|
|
731574
731786
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
731575
731787
|
import {
|
|
731576
|
-
readFileSync as
|
|
731788
|
+
readFileSync as readFileSync140,
|
|
731577
731789
|
writeFileSync as writeFileSync92,
|
|
731578
731790
|
appendFileSync as appendFileSync20,
|
|
731579
731791
|
rmSync as rmSync16,
|
|
@@ -733054,7 +733266,7 @@ function gatherMemorySnippets(root) {
|
|
|
733054
733266
|
if (!existsSync170(dir)) continue;
|
|
733055
733267
|
try {
|
|
733056
733268
|
for (const f2 of readdirSync60(dir).filter((f3) => f3.endsWith(".json"))) {
|
|
733057
|
-
const data = JSON.parse(
|
|
733269
|
+
const data = JSON.parse(readFileSync140(join183(dir, f2), "utf-8"));
|
|
733058
733270
|
for (const val of Object.values(data)) {
|
|
733059
733271
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
733060
733272
|
if (v.length > 10) snippets.push(v);
|
|
@@ -733526,7 +733738,7 @@ ${metabolismMemories}
|
|
|
733526
733738
|
try {
|
|
733527
733739
|
const archeFile = join183(repoRoot, ".omnius", "arche", "variants.json");
|
|
733528
733740
|
if (existsSync170(archeFile)) {
|
|
733529
|
-
const variants = JSON.parse(
|
|
733741
|
+
const variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
733530
733742
|
if (variants.length > 0) {
|
|
733531
733743
|
let filtered = variants;
|
|
733532
733744
|
if (taskType) {
|
|
@@ -733717,7 +733929,7 @@ ${skillPack}`;
|
|
|
733717
733929
|
"self-state.json"
|
|
733718
733930
|
);
|
|
733719
733931
|
if (existsSync170(ikStateFile)) {
|
|
733720
|
-
const selfState = JSON.parse(
|
|
733932
|
+
const selfState = JSON.parse(readFileSync140(ikStateFile, "utf8"));
|
|
733721
733933
|
const lines = [
|
|
733722
733934
|
`[Identity State v${selfState.version}]`,
|
|
733723
733935
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -734056,7 +734268,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
734056
734268
|
}
|
|
734057
734269
|
}
|
|
734058
734270
|
try {
|
|
734059
|
-
const { readdirSync: readdirSync62, readFileSync:
|
|
734271
|
+
const { readdirSync: readdirSync62, readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
734060
734272
|
const { join: pathJoin } = await import("node:path");
|
|
734061
734273
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
734062
734274
|
if (existsSync173(chunksDir)) {
|
|
@@ -734066,7 +734278,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
734066
734278
|
for (const f2 of files) {
|
|
734067
734279
|
try {
|
|
734068
734280
|
const data = JSON.parse(
|
|
734069
|
-
|
|
734281
|
+
readFileSync142(pathJoin(chunksDir, f2), "utf-8")
|
|
734070
734282
|
);
|
|
734071
734283
|
if (data._deleted) continue;
|
|
734072
734284
|
if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
|
|
@@ -734132,7 +734344,7 @@ ${lines.join("\n")}`
|
|
|
734132
734344
|
const expand2 = args.expand === true;
|
|
734133
734345
|
if (expand2 && id2.startsWith("todo-ctx-")) {
|
|
734134
734346
|
try {
|
|
734135
|
-
const { readFileSync:
|
|
734347
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
734136
734348
|
const { join: pathJoin } = await import("node:path");
|
|
734137
734349
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
734138
734350
|
const todoIdSuffix = id2.replace("todo-ctx-", "");
|
|
@@ -735670,7 +735882,7 @@ async function startInteractive(config, repoPath2) {
|
|
|
735670
735882
|
const omniusDir = join183(repoRoot, ".omnius");
|
|
735671
735883
|
const nexusPidFile = join183(omniusDir, "nexus", "daemon.pid");
|
|
735672
735884
|
if (existsSync170(nexusPidFile)) {
|
|
735673
|
-
const pid = parseInt(
|
|
735885
|
+
const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
735674
735886
|
if (pid > 0) {
|
|
735675
735887
|
try {
|
|
735676
735888
|
process.kill(pid, 0);
|
|
@@ -736866,7 +737078,7 @@ This is an independent background session started from /background.`
|
|
|
736866
737078
|
try {
|
|
736867
737079
|
const titleFile = join183(repoRoot, ".omnius", "session-title");
|
|
736868
737080
|
if (existsSync170(titleFile))
|
|
736869
|
-
sessionTitle =
|
|
737081
|
+
sessionTitle = readFileSync140(titleFile, "utf8").trim() || null;
|
|
736870
737082
|
} catch {
|
|
736871
737083
|
}
|
|
736872
737084
|
let carouselRetired = isResumed;
|
|
@@ -736981,7 +737193,7 @@ This is an independent background session started from /background.`
|
|
|
736981
737193
|
let savedHistory = [];
|
|
736982
737194
|
try {
|
|
736983
737195
|
if (existsSync170(HISTORY_FILE)) {
|
|
736984
|
-
const raw =
|
|
737196
|
+
const raw = readFileSync140(HISTORY_FILE, "utf8").trim();
|
|
736985
737197
|
if (raw) savedHistory = raw.split("\n").reverse();
|
|
736986
737198
|
}
|
|
736987
737199
|
} catch {
|
|
@@ -737140,7 +737352,7 @@ This is an independent background session started from /background.`
|
|
|
737140
737352
|
mkdirSync109(HISTORY_DIR, { recursive: true });
|
|
737141
737353
|
appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
|
|
737142
737354
|
if (Math.random() < 0.02) {
|
|
737143
|
-
const all2 =
|
|
737355
|
+
const all2 = readFileSync140(HISTORY_FILE, "utf8").trim().split("\n");
|
|
737144
737356
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
737145
737357
|
writeFileSync92(
|
|
737146
737358
|
HISTORY_FILE,
|
|
@@ -737369,7 +737581,7 @@ This is an independent background session started from /background.`
|
|
|
737369
737581
|
const nexusPidFile = join183(autoNexus.getNexusDir(), "daemon.pid");
|
|
737370
737582
|
if (existsSync170(nexusPidFile)) {
|
|
737371
737583
|
const nPid = parseInt(
|
|
737372
|
-
|
|
737584
|
+
readFileSync140(nexusPidFile, "utf8").trim(),
|
|
737373
737585
|
10
|
|
737374
737586
|
);
|
|
737375
737587
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
@@ -737551,7 +737763,7 @@ Log: ${nexusLogPath}`
|
|
|
737551
737763
|
let agName = "";
|
|
737552
737764
|
try {
|
|
737553
737765
|
if (existsSync170(globalNamePath))
|
|
737554
|
-
agName =
|
|
737766
|
+
agName = readFileSync140(globalNamePath, "utf8").trim();
|
|
737555
737767
|
} catch {
|
|
737556
737768
|
}
|
|
737557
737769
|
if (!agName) {
|
|
@@ -737592,7 +737804,7 @@ Log: ${nexusLogPath}`
|
|
|
737592
737804
|
try {
|
|
737593
737805
|
if (existsSync170(savedSponsorsPath)) {
|
|
737594
737806
|
savedSponsors = JSON.parse(
|
|
737595
|
-
|
|
737807
|
+
readFileSync140(savedSponsorsPath, "utf8")
|
|
737596
737808
|
);
|
|
737597
737809
|
const oneHourAgo = Date.now() - 36e5;
|
|
737598
737810
|
savedSponsors = savedSponsors.filter(
|
|
@@ -739888,7 +740100,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739888
740100
|
try {
|
|
739889
740101
|
const nexusPidFile = join183(nexusTool.getNexusDir(), "daemon.pid");
|
|
739890
740102
|
if (existsSync170(nexusPidFile)) {
|
|
739891
|
-
const pid = parseInt(
|
|
740103
|
+
const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
739892
740104
|
if (pid > 0) {
|
|
739893
740105
|
registry2.register({
|
|
739894
740106
|
name: "Nexus",
|
|
@@ -740101,7 +740313,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
740101
740313
|
const nexusDir = join183(repoRoot, OMNIUS_DIR, "nexus");
|
|
740102
740314
|
const pidFile = join183(nexusDir, "daemon.pid");
|
|
740103
740315
|
if (existsSync170(pidFile)) {
|
|
740104
|
-
const pid = parseInt(
|
|
740316
|
+
const pid = parseInt(readFileSync140(pidFile, "utf8").trim(), 10);
|
|
740105
740317
|
if (pid > 0) {
|
|
740106
740318
|
try {
|
|
740107
740319
|
if (process.platform === "win32") {
|
|
@@ -740131,7 +740343,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
740131
740343
|
const pidPath = join183(voiceDir3, pf);
|
|
740132
740344
|
if (existsSync170(pidPath)) {
|
|
740133
740345
|
try {
|
|
740134
|
-
const pid = parseInt(
|
|
740346
|
+
const pid = parseInt(readFileSync140(pidPath, "utf8").trim(), 10);
|
|
740135
740347
|
if (pid > 0) {
|
|
740136
740348
|
if (process.platform === "win32") {
|
|
740137
740349
|
try {
|
|
@@ -740272,8 +740484,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
740272
740484
|
"daemon.port"
|
|
740273
740485
|
);
|
|
740274
740486
|
if (existsSync170(ppPidFile)) {
|
|
740275
|
-
const ppPid = parseInt(
|
|
740276
|
-
const ppPort = existsSync170(ppPortFile) ? parseInt(
|
|
740487
|
+
const ppPid = parseInt(readFileSync140(ppPidFile, "utf8").trim(), 10);
|
|
740488
|
+
const ppPort = existsSync170(ppPortFile) ? parseInt(readFileSync140(ppPortFile, "utf8").trim(), 10) : void 0;
|
|
740277
740489
|
if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
|
|
740278
740490
|
registry2.register({
|
|
740279
740491
|
name: "PersonaPlex",
|
|
@@ -740290,7 +740502,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
740290
740502
|
"daemon.pid"
|
|
740291
740503
|
);
|
|
740292
740504
|
if (existsSync170(nexusPidFile)) {
|
|
740293
|
-
const nPid = parseInt(
|
|
740505
|
+
const nPid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
740294
740506
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
740295
740507
|
try {
|
|
740296
740508
|
process.kill(nPid, 0);
|
|
@@ -740735,7 +740947,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
740735
740947
|
if (isImage) {
|
|
740736
740948
|
try {
|
|
740737
740949
|
const imgPath = resolve72(repoRoot, cleanPath);
|
|
740738
|
-
const imgBuffer =
|
|
740950
|
+
const imgBuffer = readFileSync140(imgPath);
|
|
740739
740951
|
const base642 = imgBuffer.toString("base64");
|
|
740740
740952
|
const ext = extname22(cleanPath).toLowerCase();
|
|
740741
740953
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -740938,7 +741150,7 @@ ${result.text}`;
|
|
|
740938
741150
|
try {
|
|
740939
741151
|
const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
|
|
740940
741152
|
const ingressResult = await runVisionIngress2(
|
|
740941
|
-
{ path: imgPath, buffer:
|
|
741153
|
+
{ path: imgPath, buffer: readFileSync140(imgPath), mime },
|
|
740942
741154
|
currentConfig.model ?? ""
|
|
740943
741155
|
);
|
|
740944
741156
|
visionContext = formatImageContextPrefix2(ingressResult);
|
|
@@ -741006,7 +741218,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
|
|
|
741006
741218
|
if (isMarkdown && fullInput === input) {
|
|
741007
741219
|
try {
|
|
741008
741220
|
const mdPath = resolve72(repoRoot, cleanPath);
|
|
741009
|
-
const mdContent =
|
|
741221
|
+
const mdContent = readFileSync140(mdPath, "utf8");
|
|
741010
741222
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
741011
741223
|
const result = parseMcpMarkdown2(mdContent);
|
|
741012
741224
|
if (result.servers.length > 0) {
|
|
@@ -741667,7 +741879,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741667
741879
|
const ikFile = join183(ikDir, "self-state.json");
|
|
741668
741880
|
let ikState;
|
|
741669
741881
|
if (existsSync170(ikFile)) {
|
|
741670
|
-
ikState = JSON.parse(
|
|
741882
|
+
ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
|
|
741671
741883
|
} else {
|
|
741672
741884
|
mkdirSync109(ikDir, { recursive: true });
|
|
741673
741885
|
ikState = {
|
|
@@ -741740,7 +741952,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741740
741952
|
let variants = [];
|
|
741741
741953
|
try {
|
|
741742
741954
|
if (existsSync170(archeFile))
|
|
741743
|
-
variants = JSON.parse(
|
|
741955
|
+
variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
741744
741956
|
} catch {
|
|
741745
741957
|
}
|
|
741746
741958
|
variants.push({
|
|
@@ -741768,7 +741980,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741768
741980
|
"store.json"
|
|
741769
741981
|
);
|
|
741770
741982
|
if (existsSync170(metaFile2)) {
|
|
741771
|
-
const store2 = JSON.parse(
|
|
741983
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741772
741984
|
const surfaced = store2.filter(
|
|
741773
741985
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
741774
741986
|
).sort(
|
|
@@ -741871,7 +742083,7 @@ Rules:
|
|
|
741871
742083
|
let store2 = [];
|
|
741872
742084
|
try {
|
|
741873
742085
|
if (existsSync170(storeFile))
|
|
741874
|
-
store2 = JSON.parse(
|
|
742086
|
+
store2 = JSON.parse(readFileSync140(storeFile, "utf8"));
|
|
741875
742087
|
} catch {
|
|
741876
742088
|
}
|
|
741877
742089
|
store2.push({
|
|
@@ -741905,7 +742117,7 @@ Rules:
|
|
|
741905
742117
|
let cohereActive = false;
|
|
741906
742118
|
try {
|
|
741907
742119
|
if (existsSync170(cohereSettingsFile)) {
|
|
741908
|
-
const settings = JSON.parse(
|
|
742120
|
+
const settings = JSON.parse(readFileSync140(cohereSettingsFile, "utf8"));
|
|
741909
742121
|
cohereActive = settings.cohere === true;
|
|
741910
742122
|
}
|
|
741911
742123
|
} catch {
|
|
@@ -741919,7 +742131,7 @@ Rules:
|
|
|
741919
742131
|
"store.json"
|
|
741920
742132
|
);
|
|
741921
742133
|
if (existsSync170(metaFile2)) {
|
|
741922
|
-
const store2 = JSON.parse(
|
|
742134
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741923
742135
|
const latest = store2.filter(
|
|
741924
742136
|
(m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
|
|
741925
742137
|
).slice(-1)[0];
|
|
@@ -741952,7 +742164,7 @@ Rules:
|
|
|
741952
742164
|
try {
|
|
741953
742165
|
const ikFile = join183(repoRoot, ".omnius", "identity", "self-state.json");
|
|
741954
742166
|
if (existsSync170(ikFile)) {
|
|
741955
|
-
const ikState = JSON.parse(
|
|
742167
|
+
const ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
|
|
741956
742168
|
ikState.homeostasis.uncertainty = Math.min(
|
|
741957
742169
|
1,
|
|
741958
742170
|
ikState.homeostasis.uncertainty + 0.1
|
|
@@ -741973,7 +742185,7 @@ Rules:
|
|
|
741973
742185
|
"store.json"
|
|
741974
742186
|
);
|
|
741975
742187
|
if (existsSync170(metaFile2)) {
|
|
741976
|
-
const store2 = JSON.parse(
|
|
742188
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741977
742189
|
const surfaced = store2.filter(
|
|
741978
742190
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
741979
742191
|
).sort(
|
|
@@ -741999,7 +742211,7 @@ Rules:
|
|
|
741999
742211
|
let variants = [];
|
|
742000
742212
|
try {
|
|
742001
742213
|
if (existsSync170(archeFile))
|
|
742002
|
-
variants = JSON.parse(
|
|
742214
|
+
variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
742003
742215
|
} catch {
|
|
742004
742216
|
}
|
|
742005
742217
|
variants.push({
|
|
@@ -742139,7 +742351,7 @@ import { spawn as spawn39 } from "node:child_process";
|
|
|
742139
742351
|
import {
|
|
742140
742352
|
mkdirSync as mkdirSync110,
|
|
742141
742353
|
writeFileSync as writeFileSync93,
|
|
742142
|
-
readFileSync as
|
|
742354
|
+
readFileSync as readFileSync141,
|
|
742143
742355
|
readdirSync as readdirSync61,
|
|
742144
742356
|
existsSync as existsSync171
|
|
742145
742357
|
} from "node:fs";
|
|
@@ -742347,7 +742559,7 @@ function statusCommand(jobId, repoPath2) {
|
|
|
742347
742559
|
console.log(`Available jobs: omnius jobs`);
|
|
742348
742560
|
process.exit(1);
|
|
742349
742561
|
}
|
|
742350
|
-
const job = JSON.parse(
|
|
742562
|
+
const job = JSON.parse(readFileSync141(file, "utf-8"));
|
|
742351
742563
|
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`;
|
|
742352
742564
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
742353
742565
|
console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
|
|
@@ -742369,7 +742581,7 @@ function jobsCommand(repoPath2) {
|
|
|
742369
742581
|
console.log("Jobs:");
|
|
742370
742582
|
for (const file of files) {
|
|
742371
742583
|
try {
|
|
742372
|
-
const job = JSON.parse(
|
|
742584
|
+
const job = JSON.parse(readFileSync141(join184(dir, file), "utf-8"));
|
|
742373
742585
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
742374
742586
|
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`;
|
|
742375
742587
|
const cleanListTask = cleanForStorage(job.task) || job.task;
|