omnius 1.0.435 → 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 +1029 -445
- package/dist/scripts/live-whisper.py +101 -46
- package/dist/scripts/transcribe-file.py +18 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -906,9 +906,9 @@ var init_model_broker = __esm({
|
|
|
906
906
|
// VRAM total/free comes from system-metrics; broker computes its own snapshot
|
|
907
907
|
]);
|
|
908
908
|
const snapshot = this.buildSnapshot();
|
|
909
|
+
await this.checkPressure(snapshot);
|
|
909
910
|
this._lastSnapshot = snapshot;
|
|
910
911
|
this.emit("snapshot", snapshot);
|
|
911
|
-
this.checkPressure(snapshot);
|
|
912
912
|
return snapshot;
|
|
913
913
|
}
|
|
914
914
|
/** Best-known current snapshot. */
|
|
@@ -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 };
|
|
@@ -42867,6 +42870,8 @@ import { join as join41, basename as basename7, extname as extname4, resolve as
|
|
|
42867
42870
|
import { homedir as homedir11, tmpdir as tmpdir6 } from "node:os";
|
|
42868
42871
|
function transcriptionPythonEnv(extra = {}) {
|
|
42869
42872
|
const env2 = { ...process.env, ...extra };
|
|
42873
|
+
if (!env2["OMNIUS_ASR_DEVICE"])
|
|
42874
|
+
env2["OMNIUS_ASR_DEVICE"] = "cuda";
|
|
42870
42875
|
applyMediaCudaDeviceFilterToEnv(env2, "asr");
|
|
42871
42876
|
return env2;
|
|
42872
42877
|
}
|
|
@@ -43379,17 +43384,18 @@ audio_file = ${JSON.stringify(filePath)}
|
|
|
43379
43384
|
model_name = ${JSON.stringify(model)}
|
|
43380
43385
|
try:
|
|
43381
43386
|
import whisper
|
|
43382
|
-
device = os.environ.get("OMNIUS_ASR_DEVICE", "
|
|
43387
|
+
device = os.environ.get("OMNIUS_ASR_DEVICE", "cuda").strip().lower() or "cuda"
|
|
43388
|
+
allow_cpu = os.environ.get("OMNIUS_ASR_ALLOW_CPU", "").strip().lower() in ("1", "true", "yes", "on")
|
|
43383
43389
|
if device == "auto":
|
|
43384
|
-
device = "
|
|
43385
|
-
|
|
43386
|
-
|
|
43387
|
-
|
|
43388
|
-
|
|
43389
|
-
|
|
43390
|
-
|
|
43390
|
+
device = "cuda"
|
|
43391
|
+
if device.startswith("cuda"):
|
|
43392
|
+
import torch
|
|
43393
|
+
if not torch.cuda.is_available() or torch.cuda.device_count() <= 0:
|
|
43394
|
+
raise RuntimeError(f"CUDA-only ASR requested but torch cannot use CUDA (torch.version.cuda={getattr(torch.version, 'cuda', None)}, device_count={torch.cuda.device_count()}). Install a CUDA-enabled PyTorch build for this device, or set OMNIUS_ASR_ALLOW_CPU=1 only for emergency fallback.")
|
|
43395
|
+
elif device == "cpu" and not allow_cpu:
|
|
43396
|
+
raise RuntimeError("CPU ASR refused. Set OMNIUS_ASR_ALLOW_CPU=1 only for explicit emergency fallback.")
|
|
43391
43397
|
m = whisper.load_model(model_name, device=device)
|
|
43392
|
-
result = m.transcribe(audio_file, fp16=(
|
|
43398
|
+
result = m.transcribe(audio_file, fp16=device.startswith("cuda"), condition_on_previous_text=False)
|
|
43393
43399
|
segments = []
|
|
43394
43400
|
for seg in result.get("segments", []) or []:
|
|
43395
43401
|
segments.append({"start": float(seg.get("start", 0)), "end": float(seg.get("end", seg.get("start", 0))), "text": str(seg.get("text", "")).strip()})
|
|
@@ -276279,11 +276285,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
276279
276285
|
* what was previously computed. */
|
|
276280
276286
|
async loadSessionInfo() {
|
|
276281
276287
|
try {
|
|
276282
|
-
const { readFileSync:
|
|
276288
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
276283
276289
|
const sessionPath2 = join45(this.cwd, ".omnius", "rlm", "session.json");
|
|
276284
276290
|
if (!existsSync173(sessionPath2))
|
|
276285
276291
|
return null;
|
|
276286
|
-
return JSON.parse(
|
|
276292
|
+
return JSON.parse(readFileSync142(sessionPath2, "utf8"));
|
|
276287
276293
|
} catch {
|
|
276288
276294
|
return null;
|
|
276289
276295
|
}
|
|
@@ -276470,10 +276476,10 @@ var init_memory_metabolism = __esm({
|
|
|
276470
276476
|
const trajDir = join46(this.cwd, ".omnius", "rlm-trajectories");
|
|
276471
276477
|
let lessons = [];
|
|
276472
276478
|
try {
|
|
276473
|
-
const { readdirSync: readdirSync62, readFileSync:
|
|
276479
|
+
const { readdirSync: readdirSync62, readFileSync: readFileSync142 } = await import("node:fs");
|
|
276474
276480
|
const files = readdirSync62(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
276475
276481
|
for (const file of files) {
|
|
276476
|
-
const lines =
|
|
276482
|
+
const lines = readFileSync142(join46(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
|
|
276477
276483
|
for (const line of lines) {
|
|
276478
276484
|
try {
|
|
276479
276485
|
const entry = JSON.parse(line);
|
|
@@ -276857,14 +276863,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
276857
276863
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
276858
276864
|
*/
|
|
276859
276865
|
getTopMemoriesSync(k = 5, taskType) {
|
|
276860
|
-
const { readFileSync:
|
|
276866
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
276861
276867
|
const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
|
|
276862
276868
|
const storeFile = join46(metaDir, "store.json");
|
|
276863
276869
|
if (!existsSync173(storeFile))
|
|
276864
276870
|
return "";
|
|
276865
276871
|
let store2 = [];
|
|
276866
276872
|
try {
|
|
276867
|
-
store2 = JSON.parse(
|
|
276873
|
+
store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
|
|
276868
276874
|
} catch {
|
|
276869
276875
|
return "";
|
|
276870
276876
|
}
|
|
@@ -276886,14 +276892,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
276886
276892
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
276887
276893
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
276888
276894
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
276889
|
-
const { readFileSync:
|
|
276895
|
+
const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
|
|
276890
276896
|
const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
|
|
276891
276897
|
const storeFile = join46(metaDir, "store.json");
|
|
276892
276898
|
if (!existsSync173(storeFile))
|
|
276893
276899
|
return;
|
|
276894
276900
|
let store2 = [];
|
|
276895
276901
|
try {
|
|
276896
|
-
store2 = JSON.parse(
|
|
276902
|
+
store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
|
|
276897
276903
|
} catch {
|
|
276898
276904
|
return;
|
|
276899
276905
|
}
|
|
@@ -277340,13 +277346,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
277340
277346
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
277341
277347
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
277342
277348
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
277343
|
-
const { readFileSync:
|
|
277349
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
277344
277350
|
const archiveFile = join48(this.cwd, ".omnius", "arche", "variants.json");
|
|
277345
277351
|
if (!existsSync173(archiveFile))
|
|
277346
277352
|
return "";
|
|
277347
277353
|
let variants = [];
|
|
277348
277354
|
try {
|
|
277349
|
-
variants = JSON.parse(
|
|
277355
|
+
variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
|
|
277350
277356
|
} catch {
|
|
277351
277357
|
return "";
|
|
277352
277358
|
}
|
|
@@ -277364,13 +277370,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
277364
277370
|
}
|
|
277365
277371
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
277366
277372
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
277367
|
-
const { readFileSync:
|
|
277373
|
+
const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
|
|
277368
277374
|
const dir = join48(this.cwd, ".omnius", "arche");
|
|
277369
277375
|
const archiveFile = join48(dir, "variants.json");
|
|
277370
277376
|
let variants = [];
|
|
277371
277377
|
try {
|
|
277372
277378
|
if (existsSync173(archiveFile))
|
|
277373
|
-
variants = JSON.parse(
|
|
277379
|
+
variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
|
|
277374
277380
|
} catch {
|
|
277375
277381
|
}
|
|
277376
277382
|
variants.push({
|
|
@@ -556568,6 +556574,9 @@ def main():
|
|
|
556568
556574
|
source = cfg["source"]
|
|
556569
556575
|
media_path = None
|
|
556570
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)
|
|
556571
556580
|
|
|
556572
556581
|
try:
|
|
556573
556582
|
import cv2
|
|
@@ -556617,6 +556626,13 @@ def main():
|
|
|
556617
556626
|
if not cap.isOpened():
|
|
556618
556627
|
print(json.dumps({"success": False, "error": "could not open media source: " + str(source_for_cv)}))
|
|
556619
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)
|
|
556620
556636
|
|
|
556621
556637
|
yolo_model = cfg.get("yolo_model") or "yolo26n.pt"
|
|
556622
556638
|
yoloe_classes = [str(x).strip() for x in (cfg.get("yoloe_classes") or []) if str(x).strip()]
|
|
@@ -556904,6 +556920,10 @@ var init_live_media_loop = __esm({
|
|
|
556904
556920
|
rotate_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Clockwise correction applied to sampled frames before object tracking and face crops." },
|
|
556905
556921
|
rotation_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Alias for rotate_degrees." },
|
|
556906
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." },
|
|
556907
556927
|
duration_sec: { type: "number", description: "Bounded watch duration, default 8" },
|
|
556908
556928
|
sample_interval_sec: { type: "number", description: "Seconds between sampled frames, default 1" },
|
|
556909
556929
|
max_frames: { type: "number", description: "Max sampled frames, default 8" },
|
|
@@ -557077,6 +557097,9 @@ var init_live_media_loop = __esm({
|
|
|
557077
557097
|
sample_interval_sec: Number(args["sample_interval_sec"] ?? 1),
|
|
557078
557098
|
max_frames: Number(args["max_frames"] ?? 8),
|
|
557079
557099
|
rotate_degrees: rotation,
|
|
557100
|
+
width: Number(args["width"] ?? 0),
|
|
557101
|
+
height: Number(args["height"] ?? 0),
|
|
557102
|
+
fps: Number(args["fps"] ?? args["framerate"] ?? 0),
|
|
557080
557103
|
end2end: optionalBoolean(args, "end2end"),
|
|
557081
557104
|
yoloe_classes: stringListFromArg(args["yoloe_classes"] ?? args["classes"]),
|
|
557082
557105
|
yoloe_prompt_mode: String(args["yoloe_prompt_mode"] ?? args["prompt_mode"] ?? ""),
|
|
@@ -569342,9 +569365,9 @@ var init_reflectionBuffer = __esm({
|
|
|
569342
569365
|
this.persistPath = persistPath ?? null;
|
|
569343
569366
|
if (this.persistPath) {
|
|
569344
569367
|
try {
|
|
569345
|
-
const { readFileSync:
|
|
569368
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
569346
569369
|
if (existsSync173(this.persistPath)) {
|
|
569347
|
-
this.state = JSON.parse(
|
|
569370
|
+
this.state = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
|
|
569348
569371
|
return;
|
|
569349
569372
|
}
|
|
569350
569373
|
} catch {
|
|
@@ -573594,9 +573617,9 @@ var init_adversaryStream = __esm({
|
|
|
573594
573617
|
if (!this.persistPath)
|
|
573595
573618
|
return;
|
|
573596
573619
|
try {
|
|
573597
|
-
const { readFileSync:
|
|
573620
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
|
|
573598
573621
|
if (existsSync173(this.persistPath)) {
|
|
573599
|
-
const data = JSON.parse(
|
|
573622
|
+
const data = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
|
|
573600
573623
|
if (Array.isArray(data?.ledger))
|
|
573601
573624
|
this.ledger = data.ledger.slice(-100);
|
|
573602
573625
|
}
|
|
@@ -592267,8 +592290,8 @@ ${telegramPersonaHead}` : stripped
|
|
|
592267
592290
|
let recoveredTokens = 0;
|
|
592268
592291
|
for (const [filePath, entry] of entries) {
|
|
592269
592292
|
try {
|
|
592270
|
-
const { readFileSync:
|
|
592271
|
-
const content =
|
|
592293
|
+
const { readFileSync: readFileSync142 } = await import("node:fs");
|
|
592294
|
+
const content = readFileSync142(filePath, "utf8");
|
|
592272
592295
|
const tokenEst = Math.ceil(content.length / 4);
|
|
592273
592296
|
if (recoveredTokens + tokenEst > fileRecoveryBudget)
|
|
592274
592297
|
break;
|
|
@@ -594242,7 +594265,7 @@ ${result}`
|
|
|
594242
594265
|
const buffer2 = Buffer.from(rawBase64, "base64");
|
|
594243
594266
|
let resizedBase64 = null;
|
|
594244
594267
|
try {
|
|
594245
|
-
const { writeFileSync: writeFileSync95, readFileSync:
|
|
594268
|
+
const { writeFileSync: writeFileSync95, readFileSync: readFileSync142, unlinkSync: unlinkSync38 } = await import("node:fs");
|
|
594246
594269
|
const { join: join188 } = await import("node:path");
|
|
594247
594270
|
const { tmpdir: tmpdir26 } = await import("node:os");
|
|
594248
594271
|
const tmpIn = join188(tmpdir26(), `omnius_img_in_${Date.now()}.png`);
|
|
@@ -594257,7 +594280,7 @@ ${result}`
|
|
|
594257
594280
|
`img.save(${JSON.stringify(tmpOut)}, 'JPEG', quality=75)`
|
|
594258
594281
|
].join("; ");
|
|
594259
594282
|
await execFileText4(pyBin, ["-c", resizeScript], { timeout: 1e4 });
|
|
594260
|
-
const resizedBuf =
|
|
594283
|
+
const resizedBuf = readFileSync142(tmpOut);
|
|
594261
594284
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
594262
594285
|
try {
|
|
594263
594286
|
unlinkSync38(tmpIn);
|
|
@@ -603327,7 +603350,7 @@ __export(py_embed_exports, {
|
|
|
603327
603350
|
runTranscribeFile: () => runTranscribeFile
|
|
603328
603351
|
});
|
|
603329
603352
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
603330
|
-
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";
|
|
603331
603354
|
import { join as join125 } from "node:path";
|
|
603332
603355
|
import { homedir as homedir39 } from "node:os";
|
|
603333
603356
|
function getVenvDir() {
|
|
@@ -603339,6 +603362,88 @@ function getVenvPython() {
|
|
|
603339
603362
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
603340
603363
|
return join125(base3, bin, exe);
|
|
603341
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
|
+
}
|
|
603342
603447
|
function ensureEmbedDeps() {
|
|
603343
603448
|
const venv = getVenvDir();
|
|
603344
603449
|
let log22 = "";
|
|
@@ -603348,40 +603453,135 @@ function ensureEmbedDeps() {
|
|
|
603348
603453
|
}
|
|
603349
603454
|
const venvExisted = existsSync110(getVenvPython());
|
|
603350
603455
|
if (!venvExisted) {
|
|
603351
|
-
const mk = spawnSync8("python3", ["-m", "venv", venv], { encoding: "utf8" });
|
|
603456
|
+
const mk = spawnSync8("python3", ["-m", "venv", ...isJetsonHost2() ? ["--system-site-packages"] : [], venv], { encoding: "utf8" });
|
|
603352
603457
|
log22 += mk.stdout + mk.stderr;
|
|
603353
603458
|
}
|
|
603459
|
+
if (isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed()) {
|
|
603460
|
+
enableVenvSystemSitePackages(venv);
|
|
603461
|
+
}
|
|
603354
603462
|
if (venvExisted && !(process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1")) {
|
|
603355
603463
|
const check = spawnSync8(
|
|
603356
603464
|
getVenvPython(),
|
|
603357
|
-
["-c", "import numpy, soundfile, whisper,
|
|
603465
|
+
["-c", "import numpy, soundfile, whisper, PIL"],
|
|
603358
603466
|
{ encoding: "utf8", timeout: 3e4 }
|
|
603359
603467
|
);
|
|
603360
603468
|
if (check.status === 0) {
|
|
603361
|
-
|
|
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
|
+
`;
|
|
603362
603478
|
}
|
|
603363
603479
|
}
|
|
603364
603480
|
const pip = process.platform === "win32" ? join125(venv, "Scripts", "pip.exe") : join125(venv, "bin", "pip");
|
|
603365
603481
|
const up = spawnSync8(pip, ["install", "--upgrade", "pip", "setuptools<81", "wheel"], { encoding: "utf8", timeout: 3e5 });
|
|
603366
603482
|
log22 += up.stdout + up.stderr;
|
|
603367
|
-
|
|
603368
|
-
|
|
603369
|
-
|
|
603370
|
-
|
|
603371
|
-
|
|
603372
|
-
|
|
603373
|
-
|
|
603374
|
-
|
|
603375
|
-
|
|
603376
|
-
|
|
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
|
+
}
|
|
603377
603569
|
let fullOk = true;
|
|
603378
603570
|
if (process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1") {
|
|
603379
|
-
const
|
|
603380
|
-
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
|
+
);
|
|
603381
603581
|
log22 += full.stdout + full.stderr;
|
|
603382
603582
|
fullOk = full.status === 0;
|
|
603383
603583
|
}
|
|
603384
|
-
const ok3 =
|
|
603584
|
+
const ok3 = asrDepsOk && up.status === 0 && fullOk && torchOk;
|
|
603385
603585
|
return { ok: ok3, log: log22 };
|
|
603386
603586
|
}
|
|
603387
603587
|
function runEmbedImage(input) {
|
|
@@ -603816,6 +604016,10 @@ function asrConsensusEnabled() {
|
|
|
603816
604016
|
const consensusEnv = String(process.env["OMNIUS_ASR_CONSENSUS"] ?? "").trim().toLowerCase();
|
|
603817
604017
|
return !(consensusEnv === "0" || consensusEnv === "off" || consensusEnv === "false");
|
|
603818
604018
|
}
|
|
604019
|
+
function liveAsrUseTranscribeCli() {
|
|
604020
|
+
const value2 = String(process.env["OMNIUS_ASR_USE_TRANSCRIBE_CLI"] ?? "").trim().toLowerCase();
|
|
604021
|
+
return value2 === "1" || value2 === "true" || value2 === "yes" || value2 === "on";
|
|
604022
|
+
}
|
|
603819
604023
|
async function ensureVenvForTranscribeCli() {
|
|
603820
604024
|
const bin = process.platform === "win32" ? "Scripts" : "bin";
|
|
603821
604025
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
@@ -603930,6 +604134,7 @@ var init_listen = __esm({
|
|
|
603930
604134
|
"use strict";
|
|
603931
604135
|
init_typed_node_events();
|
|
603932
604136
|
init_async_process();
|
|
604137
|
+
init_dist5();
|
|
603933
604138
|
MANAGED_TRANSCRIBE_CLI_DIR2 = join126(homedir40(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
603934
604139
|
AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
603935
604140
|
".mp3",
|
|
@@ -603963,6 +604168,8 @@ var init_listen = __esm({
|
|
|
603963
604168
|
doa: null,
|
|
603964
604169
|
lastTranscript: "",
|
|
603965
604170
|
lastTranscriptAt: 0,
|
|
604171
|
+
lastPartialTranscript: "",
|
|
604172
|
+
lastPartialTranscriptAt: 0,
|
|
603966
604173
|
lastStatus: "",
|
|
603967
604174
|
updatedAt: 0
|
|
603968
604175
|
};
|
|
@@ -603977,6 +604184,7 @@ var init_listen = __esm({
|
|
|
603977
604184
|
scriptPath;
|
|
603978
604185
|
process = null;
|
|
603979
604186
|
_ready = false;
|
|
604187
|
+
registeredBrokerName = null;
|
|
603980
604188
|
get ready() {
|
|
603981
604189
|
return this._ready;
|
|
603982
604190
|
}
|
|
@@ -603987,16 +604195,19 @@ var init_listen = __esm({
|
|
|
603987
604195
|
const ensure = mod3.ensureEmbedDeps;
|
|
603988
604196
|
const getPy = mod3.getVenvPython;
|
|
603989
604197
|
if (typeof ensure === "function") {
|
|
603990
|
-
|
|
603991
|
-
|
|
603992
|
-
|
|
603993
|
-
|
|
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)}`);
|
|
603994
604202
|
}
|
|
603995
604203
|
}
|
|
603996
604204
|
if (typeof getPy === "function") {
|
|
603997
604205
|
pyPath = getPy();
|
|
603998
604206
|
}
|
|
603999
|
-
} catch {
|
|
604207
|
+
} catch (err) {
|
|
604208
|
+
if (err instanceof Error && err.message.startsWith("ASR Python dependency setup failed:")) {
|
|
604209
|
+
throw err;
|
|
604210
|
+
}
|
|
604000
604211
|
}
|
|
604001
604212
|
updateListenLiveState({
|
|
604002
604213
|
phase: "loading-model",
|
|
@@ -604051,6 +604262,7 @@ var init_listen = __esm({
|
|
|
604051
604262
|
this._ready = true;
|
|
604052
604263
|
clearTimeout(timeout2);
|
|
604053
604264
|
updateListenLiveState({ phase: "ready", lastStatus: "whisper model loaded" });
|
|
604265
|
+
this.registerBrokerModel(evt);
|
|
604054
604266
|
this.emit("ready");
|
|
604055
604267
|
resolve76();
|
|
604056
604268
|
break;
|
|
@@ -604082,7 +604294,13 @@ var init_listen = __esm({
|
|
|
604082
604294
|
break;
|
|
604083
604295
|
}
|
|
604084
604296
|
case "error":
|
|
604085
|
-
|
|
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
|
+
}
|
|
604086
604304
|
break;
|
|
604087
604305
|
}
|
|
604088
604306
|
} catch {
|
|
@@ -604097,6 +604315,7 @@ var init_listen = __esm({
|
|
|
604097
604315
|
reject(err);
|
|
604098
604316
|
});
|
|
604099
604317
|
onChildClose(this.process, (code8) => {
|
|
604318
|
+
this.unregisterBrokerModel();
|
|
604100
604319
|
if (!this._ready) {
|
|
604101
604320
|
clearTimeout(timeout2);
|
|
604102
604321
|
reject(
|
|
@@ -604114,6 +604333,7 @@ var init_listen = __esm({
|
|
|
604114
604333
|
}
|
|
604115
604334
|
/** Stop the worker. */
|
|
604116
604335
|
stop() {
|
|
604336
|
+
this.unregisterBrokerModel();
|
|
604117
604337
|
if (this.process) {
|
|
604118
604338
|
try {
|
|
604119
604339
|
this.process.stdin?.end();
|
|
@@ -604124,6 +604344,40 @@ var init_listen = __esm({
|
|
|
604124
604344
|
}
|
|
604125
604345
|
this._ready = false;
|
|
604126
604346
|
}
|
|
604347
|
+
registerBrokerModel(evt) {
|
|
604348
|
+
const device = String(evt["device"] ?? "");
|
|
604349
|
+
const cuda = evt["cuda"] === true || device.startsWith("cuda");
|
|
604350
|
+
const gpuIndexMatch = device.match(/^cuda:(\d+)/);
|
|
604351
|
+
const gpuIndex = gpuIndexMatch ? Number(gpuIndexMatch[1]) : null;
|
|
604352
|
+
const consensus = typeof evt["consensusModel"] === "string" && String(evt["consensusModel"]).trim() ? String(evt["consensusModel"]).trim() : "";
|
|
604353
|
+
const name10 = `whisper:${this.model}${consensus ? `+${consensus}` : ""}`;
|
|
604354
|
+
const vramMB = Math.max(0, Math.round(Number(evt["vramUsedMB"] ?? 0)));
|
|
604355
|
+
try {
|
|
604356
|
+
getModelBroker().registerLoaded({
|
|
604357
|
+
key: `whisper-cli:${name10}`,
|
|
604358
|
+
name: name10,
|
|
604359
|
+
domain: "asr",
|
|
604360
|
+
host: "whisper-cli",
|
|
604361
|
+
owner: "live-asr",
|
|
604362
|
+
vramMB: cuda ? vramMB : 0,
|
|
604363
|
+
ramMB: cuda ? 0 : vramMB,
|
|
604364
|
+
priority: 88,
|
|
604365
|
+
gpuIndex,
|
|
604366
|
+
gpuUuid: null
|
|
604367
|
+
});
|
|
604368
|
+
this.registeredBrokerName = name10;
|
|
604369
|
+
} catch {
|
|
604370
|
+
this.registeredBrokerName = null;
|
|
604371
|
+
}
|
|
604372
|
+
}
|
|
604373
|
+
unregisterBrokerModel() {
|
|
604374
|
+
if (!this.registeredBrokerName) return;
|
|
604375
|
+
try {
|
|
604376
|
+
getModelBroker().unregisterLoaded("whisper-cli", this.registeredBrokerName, "live-asr stopped");
|
|
604377
|
+
} catch {
|
|
604378
|
+
}
|
|
604379
|
+
this.registeredBrokerName = null;
|
|
604380
|
+
}
|
|
604127
604381
|
};
|
|
604128
604382
|
ListenEngine = class extends EventEmitter6 {
|
|
604129
604383
|
config;
|
|
@@ -604140,6 +604394,7 @@ var init_listen = __esm({
|
|
|
604140
604394
|
blinkTimer = null;
|
|
604141
604395
|
blinkState = false;
|
|
604142
604396
|
transcribeCliAvailable = null;
|
|
604397
|
+
owners = /* @__PURE__ */ new Set();
|
|
604143
604398
|
constructor(config) {
|
|
604144
604399
|
super();
|
|
604145
604400
|
this.config = {
|
|
@@ -604168,6 +604423,29 @@ var init_listen = __esm({
|
|
|
604168
604423
|
get pendingTranscript() {
|
|
604169
604424
|
return this.pendingText;
|
|
604170
604425
|
}
|
|
604426
|
+
hasOwner(owner) {
|
|
604427
|
+
return this.owners.has(owner);
|
|
604428
|
+
}
|
|
604429
|
+
ownerCount() {
|
|
604430
|
+
return this.owners.size;
|
|
604431
|
+
}
|
|
604432
|
+
async acquire(owner) {
|
|
604433
|
+
const clean5 = owner.trim() || "shared";
|
|
604434
|
+
this.owners.add(clean5);
|
|
604435
|
+
if (this.active) return `Live ASR already active (${[...this.owners].join(", ")}).`;
|
|
604436
|
+
const result = await this.start();
|
|
604437
|
+
if (!this.active) this.owners.delete(clean5);
|
|
604438
|
+
return result;
|
|
604439
|
+
}
|
|
604440
|
+
async release(owner) {
|
|
604441
|
+
const clean5 = owner.trim() || "shared";
|
|
604442
|
+
this.owners.delete(clean5);
|
|
604443
|
+
if (this.owners.size > 0) {
|
|
604444
|
+
return `Live ASR remains active (${[...this.owners].join(", ")}).`;
|
|
604445
|
+
}
|
|
604446
|
+
if (!this.active) return "Live ASR is not active.";
|
|
604447
|
+
return this.stop();
|
|
604448
|
+
}
|
|
604171
604449
|
setModel(model) {
|
|
604172
604450
|
this.config.model = model;
|
|
604173
604451
|
}
|
|
@@ -604318,19 +604596,21 @@ var init_listen = __esm({
|
|
|
604318
604596
|
updateListenLiveState({ phase: "error", lastStatus: "no mic capture tool (arecord/sox/ffmpeg)" });
|
|
604319
604597
|
return "No microphone capture tool found. Install arecord (Linux), sox (macOS), or ffmpeg.";
|
|
604320
604598
|
}
|
|
604321
|
-
const
|
|
604599
|
+
const consensusEnabled = asrConsensusEnabled();
|
|
604600
|
+
const useTranscribeCli = liveAsrUseTranscribeCli() && !consensusEnabled;
|
|
604601
|
+
const preferWhisperFallback = !useTranscribeCli;
|
|
604322
604602
|
if (preferWhisperFallback) {
|
|
604323
604603
|
this.emit(
|
|
604324
604604
|
"info",
|
|
604325
|
-
"ASR consensus enabled — using live-whisper.py
|
|
604605
|
+
consensusEnabled ? "ASR consensus enabled — using live-whisper.py with CUDA-only Whisper guard." : "Using live-whisper.py with CUDA-only Whisper guard."
|
|
604326
604606
|
);
|
|
604327
604607
|
updateListenLiveState({
|
|
604328
604608
|
backend: "openai-whisper",
|
|
604329
|
-
lastStatus: "starting consensus Whisper backend..."
|
|
604609
|
+
lastStatus: consensusEnabled ? "starting consensus Whisper backend..." : "starting CUDA Whisper backend..."
|
|
604330
604610
|
});
|
|
604331
604611
|
}
|
|
604332
|
-
let tc =
|
|
604333
|
-
if (
|
|
604612
|
+
let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
|
|
604613
|
+
if (useTranscribeCli && !tc) {
|
|
604334
604614
|
if (_bgInstallPromise) {
|
|
604335
604615
|
this.emit("info", "Waiting for transcribe-cli install...");
|
|
604336
604616
|
await _bgInstallPromise;
|
|
@@ -604413,7 +604693,7 @@ var init_listen = __esm({
|
|
|
604413
604693
|
if (!evt.text.trim()) return;
|
|
604414
604694
|
this.lastTranscriptTime = Date.now();
|
|
604415
604695
|
this.pendingText = evt.text.trim();
|
|
604416
|
-
updateListenLiveState({ lastTranscript: this.pendingText, lastTranscriptAt: this.lastTranscriptTime });
|
|
604696
|
+
updateListenLiveState(evt.isFinal ? { lastTranscript: this.pendingText, lastTranscriptAt: this.lastTranscriptTime } : { lastPartialTranscript: this.pendingText, lastPartialTranscriptAt: this.lastTranscriptTime });
|
|
604417
604697
|
this.emit("transcript", this.pendingText, evt.isFinal);
|
|
604418
604698
|
if (this.config.mode === "auto") this.resetSilenceTimer();
|
|
604419
604699
|
}
|
|
@@ -604471,7 +604751,7 @@ var init_listen = __esm({
|
|
|
604471
604751
|
if (!evt.text.trim()) return;
|
|
604472
604752
|
this.lastTranscriptTime = Date.now();
|
|
604473
604753
|
this.pendingText = evt.text.trim();
|
|
604474
|
-
updateListenLiveState({ lastTranscript: this.pendingText, lastTranscriptAt: this.lastTranscriptTime });
|
|
604754
|
+
updateListenLiveState(evt.isFinal ? { lastTranscript: this.pendingText, lastTranscriptAt: this.lastTranscriptTime } : { lastPartialTranscript: this.pendingText, lastPartialTranscriptAt: this.lastTranscriptTime });
|
|
604475
604755
|
this.emit("transcript", this.pendingText, evt.isFinal, { consensus: evt.consensus, doa: evt.doa });
|
|
604476
604756
|
if (this.config.mode === "auto") this.resetSilenceTimer();
|
|
604477
604757
|
});
|
|
@@ -604514,6 +604794,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
604514
604794
|
async stop() {
|
|
604515
604795
|
if (!this.active) return "Not listening.";
|
|
604516
604796
|
this.active = false;
|
|
604797
|
+
this.owners.clear();
|
|
604517
604798
|
this.blinkState = false;
|
|
604518
604799
|
updateListenLiveState({ phase: "idle", speechActive: false, micLevelDb: null, lastStatus: "stopped" });
|
|
604519
604800
|
if (this.blinkTimer) {
|
|
@@ -604609,13 +604890,14 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
604609
604890
|
*/
|
|
604610
604891
|
async createCallTranscriber() {
|
|
604611
604892
|
const requireConsensus = asrConsensusEnabled();
|
|
604612
|
-
|
|
604613
|
-
|
|
604893
|
+
const useTranscribeCli = liveAsrUseTranscribeCli() && !requireConsensus;
|
|
604894
|
+
let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
|
|
604895
|
+
if (useTranscribeCli && !tc && _bgInstallPromise) {
|
|
604614
604896
|
await _bgInstallPromise;
|
|
604615
604897
|
this.transcribeCliAvailable = null;
|
|
604616
604898
|
tc = await this.loadTranscribeCli();
|
|
604617
604899
|
}
|
|
604618
|
-
if (
|
|
604900
|
+
if (useTranscribeCli && !tc) {
|
|
604619
604901
|
try {
|
|
604620
604902
|
await ensureManagedTranscribeCliNode();
|
|
604621
604903
|
this.transcribeCliAvailable = null;
|
|
@@ -604623,7 +604905,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
604623
604905
|
} catch {
|
|
604624
604906
|
}
|
|
604625
604907
|
}
|
|
604626
|
-
if (
|
|
604908
|
+
if (useTranscribeCli && tc?.TranscribeLive && await ensureVenvForTranscribeCli()) {
|
|
604627
604909
|
try {
|
|
604628
604910
|
const transcriber = new tc.TranscribeLive({
|
|
604629
604911
|
model: this.config.model,
|
|
@@ -604973,7 +605255,7 @@ var init_camera_streamer = __esm({
|
|
|
604973
605255
|
});
|
|
604974
605256
|
|
|
604975
605257
|
// packages/cli/src/tui/live-vlm.ts
|
|
604976
|
-
import { existsSync as existsSync113, readFileSync as
|
|
605258
|
+
import { existsSync as existsSync113, readFileSync as readFileSync92, statSync as statSync44 } from "node:fs";
|
|
604977
605259
|
var DEFAULT_LIVE_VLM_MODEL, MAX_IMAGE_BYTES, VLM_SYSTEM_PROMPT, LiveVlmEngine;
|
|
604978
605260
|
var init_live_vlm = __esm({
|
|
604979
605261
|
"packages/cli/src/tui/live-vlm.ts"() {
|
|
@@ -605102,7 +605384,7 @@ var init_live_vlm = __esm({
|
|
|
605102
605384
|
this.describeInFlight = true;
|
|
605103
605385
|
try {
|
|
605104
605386
|
if (!await this.ensureModel()) return null;
|
|
605105
|
-
const image =
|
|
605387
|
+
const image = readFileSync92(framePath).toString("base64");
|
|
605106
605388
|
const heard = String(opts.heard ?? "").trim();
|
|
605107
605389
|
const userText = [
|
|
605108
605390
|
opts.source ? `Camera: ${opts.source}` : "",
|
|
@@ -605205,6 +605487,135 @@ function formatLiveResourceBudgetLines(width = 100) {
|
|
|
605205
605487
|
`└─ leases: ${truncateAnsi(leaseText, inner - 12)}`
|
|
605206
605488
|
];
|
|
605207
605489
|
}
|
|
605490
|
+
async function refreshLiveResourceModelSnapshot(minIntervalMs = 2500) {
|
|
605491
|
+
const now2 = Date.now();
|
|
605492
|
+
if (now2 - lastModelSnapshotRefreshAt < minIntervalMs) return;
|
|
605493
|
+
lastModelSnapshotRefreshAt = now2;
|
|
605494
|
+
await getModelBroker().pollOnce();
|
|
605495
|
+
}
|
|
605496
|
+
function formatLiveMenuResourceSummary() {
|
|
605497
|
+
const snap = getLiveResourceArbiter().snapshot();
|
|
605498
|
+
const broker = getModelBroker().snapshot();
|
|
605499
|
+
const totalGB = snap.totalMemMB / 1024;
|
|
605500
|
+
const usedGB = snap.usedMemMB / 1024;
|
|
605501
|
+
const vram = broker.vramMB;
|
|
605502
|
+
const vramText = vram ? `GPU/UMA ${mbToGb(vram.used)}/${mbToGb(vram.total)}GB` : "GPU/UMA unknown";
|
|
605503
|
+
const cuda = broker.vramPerDevice.length > 0 ? "CUDA on" : "CUDA off/unknown";
|
|
605504
|
+
return `RAM ${usedGB.toFixed(1)}/${totalGB.toFixed(1)}GB · ${vramText} · ${cuda} · models ${broker.loaded.length} loaded/${broker.inflight.length} loading`;
|
|
605505
|
+
}
|
|
605506
|
+
function formatLiveModelRuntimeLines(width = 100, opts = {}) {
|
|
605507
|
+
const broker = getModelBroker().snapshot();
|
|
605508
|
+
const inner = Math.max(24, width - 2);
|
|
605509
|
+
const loaded = broker.loaded ?? [];
|
|
605510
|
+
const inflight = broker.inflight ?? [];
|
|
605511
|
+
const modelsShown = Math.max(0, opts.maxModels ?? 4);
|
|
605512
|
+
const cudaAvailable = broker.vramPerDevice.length > 0;
|
|
605513
|
+
const gpuLine = formatGpuRuntimeLine(broker);
|
|
605514
|
+
const subsystemLine = formatSubsystemMemoryLine(loaded, inner);
|
|
605515
|
+
const unattributedLine = formatUnattributedMemoryLine(loaded, broker);
|
|
605516
|
+
const pollAge = broker.lastPollAt > 0 ? Math.max(0, Math.round((Date.now() - broker.lastPollAt) / 1e3)) : null;
|
|
605517
|
+
const lines = [
|
|
605518
|
+
colorText(" model runtime", 81),
|
|
605519
|
+
gpuLine,
|
|
605520
|
+
subsystemLine,
|
|
605521
|
+
unattributedLine,
|
|
605522
|
+
`├─ state: loaded=${loaded.length} loading=${inflight.length} slots=${broker.slots.inUse}/${broker.slots.capacity} queue=${broker.slots.queueDepth}/${broker.slots.queueCapacity}${pollAge !== null ? ` poll=${pollAge}s` : ""}`
|
|
605523
|
+
];
|
|
605524
|
+
if (loaded.length === 0 && inflight.length === 0) {
|
|
605525
|
+
lines.push(`└─ models: ${colorText("none tracked yet", 244)}${cudaAvailable ? "" : colorText(" (CUDA state unknown until broker/JTOP poll succeeds)", 244)}`);
|
|
605526
|
+
return lines;
|
|
605527
|
+
}
|
|
605528
|
+
const modelLines = loaded.sort((a2, b) => b.vramMB + b.ramMB - (a2.vramMB + a2.ramMB)).slice(0, modelsShown).map((model, index, shown) => {
|
|
605529
|
+
const last2 = index === shown.length - 1 && inflight.length === 0 && loaded.length <= modelsShown;
|
|
605530
|
+
return `${last2 ? "└" : "├"}─ ${formatLoadedModelRuntime(model, broker)}`;
|
|
605531
|
+
});
|
|
605532
|
+
lines.push(...modelLines.map((line) => truncateAnsi(line, inner)));
|
|
605533
|
+
if (loaded.length > modelsShown) {
|
|
605534
|
+
lines.push(`├─ ${colorText(`+${loaded.length - modelsShown} more loaded model(s)`, 244)}`);
|
|
605535
|
+
}
|
|
605536
|
+
if (inflight.length > 0) {
|
|
605537
|
+
const loading = inflight.slice(0, 3).map((entry) => {
|
|
605538
|
+
const age = Math.max(0, Math.round((Date.now() - entry.startedMs) / 1e3));
|
|
605539
|
+
return `${entry.key} owner=${entry.owner} ${age}s`;
|
|
605540
|
+
}).join("; ");
|
|
605541
|
+
lines.push(`└─ loading: ${truncateAnsi(loading, inner - 12)}`);
|
|
605542
|
+
}
|
|
605543
|
+
return lines;
|
|
605544
|
+
}
|
|
605545
|
+
function formatLiveResourceModelReport(width = 100) {
|
|
605546
|
+
return [
|
|
605547
|
+
...formatLiveResourceBudgetLines(width),
|
|
605548
|
+
...formatLiveModelRuntimeLines(width, { maxModels: 20 })
|
|
605549
|
+
].join("\n");
|
|
605550
|
+
}
|
|
605551
|
+
function formatGpuRuntimeLine(broker) {
|
|
605552
|
+
const devices = broker.vramPerDevice ?? [];
|
|
605553
|
+
if (devices.length === 0) {
|
|
605554
|
+
return `├─ accelerator: ${colorText("CUDA off/unknown", 208)} vram=unavailable`;
|
|
605555
|
+
}
|
|
605556
|
+
const parts = devices.map((device) => {
|
|
605557
|
+
const label = device.uuid === "jetson-uma" ? "jetson-uma" : `gpu${device.index}`;
|
|
605558
|
+
const pct = device.total > 0 ? device.used / device.total : 0;
|
|
605559
|
+
return `${label} ${pressureColor(pct, 0.78)(`${mbToGb(device.used)}/${mbToGb(device.total)}GB`)}`;
|
|
605560
|
+
});
|
|
605561
|
+
return `├─ accelerator: ${colorText("CUDA on", 82)} ${parts.join(" ")}`;
|
|
605562
|
+
}
|
|
605563
|
+
function formatSubsystemMemoryLine(loaded, width) {
|
|
605564
|
+
const totals = /* @__PURE__ */ new Map();
|
|
605565
|
+
for (const model of loaded) {
|
|
605566
|
+
const key = subsystemForModel(model);
|
|
605567
|
+
const current = totals.get(key) ?? { vram: 0, ram: 0, count: 0 };
|
|
605568
|
+
current.vram += Math.max(0, Number(model.vramMB ?? 0));
|
|
605569
|
+
current.ram += Math.max(0, Number(model.ramMB ?? 0));
|
|
605570
|
+
current.count += 1;
|
|
605571
|
+
totals.set(key, current);
|
|
605572
|
+
}
|
|
605573
|
+
if (totals.size === 0) return `├─ subsystems(tracked): ${colorText("no tracked model memory", 244)}`;
|
|
605574
|
+
const preferred = ["llm", "vision", "asr", "embedding", "image", "video", "audio", "other"];
|
|
605575
|
+
const parts = [...totals.entries()].sort((a2, b) => {
|
|
605576
|
+
const ai = preferred.indexOf(a2[0]);
|
|
605577
|
+
const bi = preferred.indexOf(b[0]);
|
|
605578
|
+
return (ai === -1 ? 99 : ai) - (bi === -1 ? 99 : bi);
|
|
605579
|
+
}).map(([name10, total]) => `${name10}=${mbToGb(total.vram)}Gv/${mbToGb(total.ram)}Gr`);
|
|
605580
|
+
return `├─ subsystems(tracked): ${truncateAnsi(parts.join(" "), width - 25)}`;
|
|
605581
|
+
}
|
|
605582
|
+
function formatUnattributedMemoryLine(loaded, broker) {
|
|
605583
|
+
const resource = getLiveResourceArbiter().snapshot();
|
|
605584
|
+
const trackedRam = loaded.reduce((sum, model) => sum + Math.max(0, Number(model.ramMB ?? 0)), 0);
|
|
605585
|
+
const trackedVram = loaded.reduce((sum, model) => sum + Math.max(0, Number(model.vramMB ?? 0)), 0);
|
|
605586
|
+
const ramGap = Math.max(0, resource.usedMemMB - trackedRam);
|
|
605587
|
+
const vramGap = broker.vramMB ? Math.max(0, broker.vramMB.used - trackedVram) : null;
|
|
605588
|
+
return `├─ unattributed/system: ram=${mbToGb(ramGap)}G${vramGap !== null ? ` vram/uma=${mbToGb(vramGap)}G` : ""} ${colorText("(OS, camera ffmpeg, CV libs, CUDA overhead, untracked subprocesses)", 244)}`;
|
|
605589
|
+
}
|
|
605590
|
+
function formatLoadedModelRuntime(model, broker) {
|
|
605591
|
+
const slots = broker.slots.byModel[model.name] ?? broker.slots.byModel[model.key] ?? null;
|
|
605592
|
+
const active = slots && slots.inUse > 0;
|
|
605593
|
+
const state = active ? colorText(`running x${slots.inUse}`, 82) : colorText("loaded idle", 244);
|
|
605594
|
+
const cuda = cudaStateForModel(model, broker.vramPerDevice.length > 0);
|
|
605595
|
+
const idle = Math.max(0, Math.round((Date.now() - model.lastUsedAt) / 1e3));
|
|
605596
|
+
const tps = slots && slots.samples > 0 ? ` ${slots.tokensPerSec.toFixed(1)}tok/s` : "";
|
|
605597
|
+
const ctx3 = model.numCtx ? ` ctx=${model.numCtx}` : "";
|
|
605598
|
+
return `${subsystemForModel(model)} ${model.host}:${model.name} ${state} ${cuda} vram=${model.vramMB}MB ram=${model.ramMB}MB idle=${idle}s${tps}${ctx3}`;
|
|
605599
|
+
}
|
|
605600
|
+
function cudaStateForModel(model, cudaAvailable) {
|
|
605601
|
+
if (model.gpuIndex !== null && model.gpuIndex !== void 0) return colorText(`cuda:on gpu${model.gpuIndex}`, 82);
|
|
605602
|
+
if (model.vramMB > 0) return colorText(cudaAvailable ? "cuda:on" : "gpu:on", 82);
|
|
605603
|
+
if (model.host === "external") return colorText("cuda:external", 244);
|
|
605604
|
+
return colorText(cudaAvailable ? "cuda:off/cpu" : "cuda:off", 208);
|
|
605605
|
+
}
|
|
605606
|
+
function subsystemForModel(model) {
|
|
605607
|
+
if (model.domain === "chat" || model.domain === "subagent") return "llm";
|
|
605608
|
+
if (model.domain === "vision" || model.host.includes("moondream")) return "vision";
|
|
605609
|
+
if (model.domain === "asr" || model.host.includes("whisper")) return "asr";
|
|
605610
|
+
if (model.domain === "embedding") return "embedding";
|
|
605611
|
+
if (model.domain === "image-gen") return "image";
|
|
605612
|
+
if (model.domain === "video-gen") return "video";
|
|
605613
|
+
if (model.domain === "tts" || model.domain === "music" || model.domain === "sound") return "audio";
|
|
605614
|
+
return "other";
|
|
605615
|
+
}
|
|
605616
|
+
function mbToGb(mb) {
|
|
605617
|
+
return (Math.max(0, Number(mb) || 0) / 1024).toFixed(1);
|
|
605618
|
+
}
|
|
605208
605619
|
function readBudget() {
|
|
605209
605620
|
const raw = String(process.env["OMNIUS_LIVE_RESOURCE_BUDGET"] ?? "").trim().toLowerCase();
|
|
605210
605621
|
if (raw === "low" || raw === "conserve" || raw === "conservative" || raw === "battery") return "conserve";
|
|
@@ -605240,10 +605651,11 @@ function truncateAnsi(text2, max) {
|
|
|
605240
605651
|
if (plain.length <= max) return text2;
|
|
605241
605652
|
return `${plain.slice(0, Math.max(0, max - 3))}...`;
|
|
605242
605653
|
}
|
|
605243
|
-
var LiveResourceArbiter, singleton;
|
|
605654
|
+
var LiveResourceArbiter, singleton, lastModelSnapshotRefreshAt;
|
|
605244
605655
|
var init_live_resource_arbiter = __esm({
|
|
605245
605656
|
"packages/cli/src/tui/live-resource-arbiter.ts"() {
|
|
605246
605657
|
"use strict";
|
|
605658
|
+
init_dist5();
|
|
605247
605659
|
LiveResourceArbiter = class {
|
|
605248
605660
|
leases = /* @__PURE__ */ new Map();
|
|
605249
605661
|
seq = 0;
|
|
@@ -605400,11 +605812,12 @@ var init_live_resource_arbiter = __esm({
|
|
|
605400
605812
|
}
|
|
605401
605813
|
};
|
|
605402
605814
|
singleton = null;
|
|
605815
|
+
lastModelSnapshotRefreshAt = 0;
|
|
605403
605816
|
}
|
|
605404
605817
|
});
|
|
605405
605818
|
|
|
605406
605819
|
// packages/cli/src/tui/live-sensors.ts
|
|
605407
|
-
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";
|
|
605408
605821
|
import { arch as arch3, freemem as freemem5 } from "node:os";
|
|
605409
605822
|
import { basename as basename23, join as join128, relative as relative11 } from "node:path";
|
|
605410
605823
|
function liveDir(repoRoot) {
|
|
@@ -605645,6 +606058,18 @@ function truncateCell(value2, width) {
|
|
|
605645
606058
|
function stripDashboardAnsi(value2) {
|
|
605646
606059
|
return value2.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
|
|
605647
606060
|
}
|
|
606061
|
+
function dashboardAnsi(code8, text2) {
|
|
606062
|
+
return `\x1B[${code8}m${text2}\x1B[0m`;
|
|
606063
|
+
}
|
|
606064
|
+
function dashboardDim(text2) {
|
|
606065
|
+
return dashboardAnsi("38;5;244", text2);
|
|
606066
|
+
}
|
|
606067
|
+
function dashboardSoundColor(score) {
|
|
606068
|
+
if (score === void 0) return "38;5;81";
|
|
606069
|
+
if (score >= 0.75) return "38;5;82";
|
|
606070
|
+
if (score >= 0.5) return "38;5;220";
|
|
606071
|
+
return "38;5;208";
|
|
606072
|
+
}
|
|
605648
606073
|
function dashboardVisibleWidth(value2) {
|
|
605649
606074
|
return stripDashboardAnsi(value2).length;
|
|
605650
606075
|
}
|
|
@@ -605830,7 +606255,7 @@ function sanitizeLiveAudioError(value2) {
|
|
|
605830
606255
|
}
|
|
605831
606256
|
function readPcm16WavActivity(filePath, bins = 36) {
|
|
605832
606257
|
try {
|
|
605833
|
-
const buf =
|
|
606258
|
+
const buf = readFileSync93(filePath);
|
|
605834
606259
|
if (buf.length < 44 || buf.toString("ascii", 0, 4) !== "RIFF" || buf.toString("ascii", 8, 12) !== "WAVE") return void 0;
|
|
605835
606260
|
let offset = 12;
|
|
605836
606261
|
let channels = 1;
|
|
@@ -605893,13 +606318,6 @@ function readPcm16WavActivity(filePath, bins = 36) {
|
|
|
605893
606318
|
return void 0;
|
|
605894
606319
|
}
|
|
605895
606320
|
}
|
|
605896
|
-
function extractAsrBackend(output) {
|
|
605897
|
-
const match = String(output ?? "").match(/^Backend:\s*(.+)$/m);
|
|
605898
|
-
if (!match?.[1]) return void 0;
|
|
605899
|
-
const backend = match[1].trim();
|
|
605900
|
-
if (/managed openai-whisper|transcribe-cli|whisper/i.test(backend)) return backend;
|
|
605901
|
-
return backend.slice(0, 80);
|
|
605902
|
-
}
|
|
605903
606321
|
function parseLiveAudioIntakeDecision(value2) {
|
|
605904
606322
|
const parsed = parseJsonObjectFromText(value2);
|
|
605905
606323
|
if (!parsed) return null;
|
|
@@ -606293,6 +606711,23 @@ function formatAudioAnalysisDashboardSummary(value2) {
|
|
|
606293
606711
|
}
|
|
606294
606712
|
return `sound: ${trimOneLine(text2.replace(/\{[\s\S]*$/, ""), 140) || trimOneLine(text2, 140)}`;
|
|
606295
606713
|
}
|
|
606714
|
+
function formatAudioAnalysisDashboardSummaryColored(value2) {
|
|
606715
|
+
const text2 = String(value2 ?? "").trim();
|
|
606716
|
+
if (!text2) return "";
|
|
606717
|
+
const parsed = parseJsonObjectFromText(text2);
|
|
606718
|
+
const classifications = Array.isArray(parsed?.["classifications"]) ? parsed["classifications"] : [];
|
|
606719
|
+
if (classifications.length > 0) {
|
|
606720
|
+
const parts = classifications.slice(0, 4).map((entry) => {
|
|
606721
|
+
const label = trimOneLine(entry["class"] ?? entry["label"] ?? entry["name"] ?? "sound", 44);
|
|
606722
|
+
const score = boundedConfidence(entry["score"] ?? entry["confidence"]);
|
|
606723
|
+
const coloredLabel = dashboardAnsi(dashboardSoundColor(score), label || "sound");
|
|
606724
|
+
return `${coloredLabel}${score !== void 0 ? ` ${dashboardDim(score.toFixed(2))}` : ""}`;
|
|
606725
|
+
});
|
|
606726
|
+
return `${dashboardAnsi("38;5;45", "sounds heard")}: ${parts.join(dashboardDim("; "))}`;
|
|
606727
|
+
}
|
|
606728
|
+
const summary = trimOneLine(text2.replace(/\{[\s\S]*$/, ""), 140) || trimOneLine(text2, 140);
|
|
606729
|
+
return `${dashboardAnsi("38;5;45", "sound")}: ${dashboardAnsi("38;5;250", summary)}`;
|
|
606730
|
+
}
|
|
606296
606731
|
function formatCameraRotationDashboard(camera) {
|
|
606297
606732
|
const orientation = camera.orientation;
|
|
606298
606733
|
const rotation = orientation?.rotation ?? camera.rotation ?? 0;
|
|
@@ -606378,6 +606813,9 @@ function formatLiveDashboardFromSnapshot(snapshot, opts = {}) {
|
|
|
606378
606813
|
for (const budgetLine of formatLiveResourceBudgetLines(width - 2)) {
|
|
606379
606814
|
lines.push(`│${truncateAnsiCell(budgetLine, width - 2)}│`);
|
|
606380
606815
|
}
|
|
606816
|
+
for (const modelLine of formatLiveModelRuntimeLines(width - 2, { maxModels: 4 })) {
|
|
606817
|
+
lines.push(`│${truncateAnsiCell(modelLine, width - 2)}│`);
|
|
606818
|
+
}
|
|
606381
606819
|
const enabledStreams = Object.entries(snapshot.config.cameraStreams ?? {}).filter(([, stream]) => stream.enabled !== false);
|
|
606382
606820
|
const selectedResolution = snapshot.config.selectedCamera ? formatLiveCameraResolution(snapshot.config.cameraStreams?.[snapshot.config.selectedCamera]?.resolution) : "none";
|
|
606383
606821
|
lines.push(`│${truncateCell(` systems: camera-streams=${enabledStreams.length}/${snapshot.devices.video.length} selected-res=${selectedResolution} yolo=${snapshot.config.inferEnabled ? "on" : "off"} clip=${snapshot.config.clipEnabled ? "on" : "off"} asr=${snapshot.config.asrEnabled ? "on" : "off"} sounds=${snapshot.config.audioAnalysisEnabled ? "on" : "off"}`, width - 2)}│`);
|
|
@@ -606423,13 +606861,16 @@ function formatLiveDashboardFromSnapshot(snapshot, opts = {}) {
|
|
|
606423
606861
|
pushDashboardWrapped(lines, detail, width);
|
|
606424
606862
|
}
|
|
606425
606863
|
});
|
|
606426
|
-
|
|
606864
|
+
const dashboardAsr = getListenLiveState();
|
|
606865
|
+
const showDashboardAudio = Boolean(snapshot.audio) || dashboardAsr.phase !== "idle";
|
|
606866
|
+
if (showDashboardAudio) {
|
|
606867
|
+
const audioSnapshot = snapshot.audio;
|
|
606427
606868
|
lines.push(`├${horizontal}┤`);
|
|
606428
606869
|
lines.push(`│${truncateCell(" audio monitor", width - 2)}│`);
|
|
606429
|
-
const transcriptFailure = isAudioFailureText(
|
|
606430
|
-
const transcript = transcriptFailure ?
|
|
606431
|
-
const audioError = sanitizeLiveAudioError([
|
|
606432
|
-
const asr =
|
|
606870
|
+
const transcriptFailure = audioSnapshot && isAudioFailureText(audioSnapshot.transcript) ? audioSnapshot.transcript : "";
|
|
606871
|
+
const transcript = audioSnapshot && !transcriptFailure ? audioSnapshot.transcript : "";
|
|
606872
|
+
const audioError = sanitizeLiveAudioError([audioSnapshot?.error, transcriptFailure].filter(Boolean).join(" | "));
|
|
606873
|
+
const asr = dashboardAsr;
|
|
606433
606874
|
const asrPhaseLabel = {
|
|
606434
606875
|
bootstrapping: "bootstrapping deps…",
|
|
606435
606876
|
"loading-model": "loading model…",
|
|
@@ -606440,21 +606881,26 @@ function formatLiveDashboardFromSnapshot(snapshot, opts = {}) {
|
|
|
606440
606881
|
};
|
|
606441
606882
|
const asrMicBits = asr.micLevelDb !== null ? ` mic=${asr.micLevelDb.toFixed(1)}dB${asr.speechActive ? " ●speech" : ""}${asr.doa !== null ? ` dir=${asr.doa}°` : ""}` : "";
|
|
606442
606883
|
const asrLine = asr.phase !== "idle" ? `│ ├─ whisper: ${[asr.backend, asr.model].filter(Boolean).join(" ") || "starting"} — ${asrPhaseLabel[asr.phase] ?? asr.phase}${asrMicBits}` : "";
|
|
606443
|
-
const
|
|
606444
|
-
const
|
|
606884
|
+
const asrFinalAge = asr.lastTranscriptAt > 0 ? Math.max(0, Math.round((now2 - asr.lastTranscriptAt) / 1e3)) : null;
|
|
606885
|
+
const asrPartialAge = asr.lastPartialTranscriptAt > 0 ? Math.max(0, Math.round((now2 - asr.lastPartialTranscriptAt) / 1e3)) : null;
|
|
606886
|
+
const showPartial = asr.lastPartialTranscript && (!asr.lastTranscriptAt || asr.lastPartialTranscriptAt >= asr.lastTranscriptAt);
|
|
606887
|
+
const asrHeardLine = asr.phase !== "idle" && (showPartial || asr.lastTranscript) ? showPartial ? `│ ├─ hearing${asrPartialAge !== null ? ` ${asrPartialAge}s ago` : ""}: ${trimOneLine(asr.lastPartialTranscript, 120)}` : `│ ├─ heard${asrFinalAge !== null ? ` ${asrFinalAge}s ago` : ""}: ${trimOneLine(asr.lastTranscript, 120)}` : "";
|
|
606445
606888
|
const asrStatusLine = (asr.phase === "bootstrapping" || asr.phase === "loading-model" || asr.phase === "error") && asr.lastStatus ? `│ ├─ whisper status: ${trimOneLine(asr.lastStatus, 120)}` : "";
|
|
606889
|
+
const coloredSoundSummary = audioSnapshot?.analysis ? formatAudioAnalysisDashboardSummaryColored(audioSnapshot.analysis) : "";
|
|
606446
606890
|
const audioBits = [
|
|
606447
|
-
`├─ input: ${
|
|
606891
|
+
`├─ input: ${audioSnapshot?.input || snapshot.config.selectedAudioInput || "none"}`,
|
|
606448
606892
|
asrLine,
|
|
606449
606893
|
asrStatusLine,
|
|
606450
606894
|
asrHeardLine,
|
|
606451
|
-
|
|
606895
|
+
audioSnapshot?.activity ? `│ ├─ activity: ${audioSnapshot.activity.waveform} rms=${audioSnapshot.activity.rmsDb.toFixed(1)}dB active=${Math.round(audioSnapshot.activity.activeRatio * 100)}%` : "",
|
|
606452
606896
|
audioError ? `│ ├─ error: ${trimOneLine(audioError, 140)}` : "",
|
|
606453
|
-
transcript ? `│ ├─ asr${
|
|
606454
|
-
|
|
606455
|
-
snapshot.audio.analysis ? `│ └─ ${formatAudioAnalysisDashboardSummary(snapshot.audio.analysis)}` : ""
|
|
606897
|
+
transcript ? `│ ├─ asr${audioSnapshot?.asrBackend ? ` (${audioSnapshot.asrBackend})` : ""}: ${trimOneLine(transcript, 140)}` : "",
|
|
606898
|
+
audioSnapshot?.intake ? `│ ├─ intake: ${audioSnapshot.intake.intendedForAgent ? "for-agent" : "ambient"} conf=${audioSnapshot.intake.confidence.toFixed(2)} action=${audioSnapshot.intake.action}` : ""
|
|
606456
606899
|
].filter(Boolean);
|
|
606457
606900
|
for (const item of audioBits.slice(0, 9)) pushDashboardWrapped(lines, item, width);
|
|
606901
|
+
if (coloredSoundSummary) {
|
|
606902
|
+
lines.push(`│${truncateAnsiCell(` └─ ${coloredSoundSummary}`, width - 2)}│`);
|
|
606903
|
+
}
|
|
606458
606904
|
}
|
|
606459
606905
|
lines.push(`╰${horizontal}╯`);
|
|
606460
606906
|
return lines;
|
|
@@ -606702,7 +607148,7 @@ function parseCameraListText(raw) {
|
|
|
606702
607148
|
}
|
|
606703
607149
|
function loadLiveSensorConfig(repoRoot) {
|
|
606704
607150
|
try {
|
|
606705
|
-
const parsed = JSON.parse(
|
|
607151
|
+
const parsed = JSON.parse(readFileSync93(liveConfigPath(repoRoot), "utf8"));
|
|
606706
607152
|
return {
|
|
606707
607153
|
...DEFAULT_CONFIG7,
|
|
606708
607154
|
...parsed,
|
|
@@ -606717,7 +607163,7 @@ function loadLiveSensorConfig(repoRoot) {
|
|
|
606717
607163
|
}
|
|
606718
607164
|
function readLiveSensorSnapshot(repoRoot) {
|
|
606719
607165
|
try {
|
|
606720
|
-
const parsed = JSON.parse(
|
|
607166
|
+
const parsed = JSON.parse(readFileSync93(liveSnapshotPath(repoRoot), "utf8"));
|
|
606721
607167
|
return parsed?.version === 1 ? parsed : null;
|
|
606722
607168
|
} catch {
|
|
606723
607169
|
return null;
|
|
@@ -606847,6 +607293,17 @@ function formatLiveSensorContextFromSnapshot(snapshot, opts = {}) {
|
|
|
606847
607293
|
lines.push(`summary: ${cameraSnapshotSummary(camera)}`);
|
|
606848
607294
|
}
|
|
606849
607295
|
}
|
|
607296
|
+
const liveAsr = getListenLiveState();
|
|
607297
|
+
const liveAsrFinalAge = liveAsr.lastTranscriptAt > 0 ? now2 - liveAsr.lastTranscriptAt : Number.POSITIVE_INFINITY;
|
|
607298
|
+
const liveAsrPartialAge = liveAsr.lastPartialTranscriptAt > 0 ? now2 - liveAsr.lastPartialTranscriptAt : Number.POSITIVE_INFINITY;
|
|
607299
|
+
const liveAsrText = liveAsr.lastTranscript && liveAsrFinalAge < maxAgeMs ? liveAsr.lastTranscript : liveAsr.lastPartialTranscript && liveAsrPartialAge < Math.min(maxAgeMs, 3e4) ? liveAsr.lastPartialTranscript : "";
|
|
607300
|
+
if (liveAsrText) {
|
|
607301
|
+
const label = liveAsr.lastTranscript && liveAsrFinalAge < maxAgeMs ? "Live streaming ASR" : "Live streaming ASR partial";
|
|
607302
|
+
lines.push("");
|
|
607303
|
+
lines.push("## LIVE STREAMING ASR");
|
|
607304
|
+
lines.push(`${label}${liveAsr.backend ? ` (${liveAsr.backend} ${liveAsr.model})` : ""}:`);
|
|
607305
|
+
lines.push(cleanPreview(liveAsrText, 1200));
|
|
607306
|
+
}
|
|
606850
607307
|
if (snapshot.audio) {
|
|
606851
607308
|
const transcriptFailure = isAudioFailureText(snapshot.audio.transcript) ? snapshot.audio.transcript : "";
|
|
606852
607309
|
const transcript = transcriptFailure ? "" : snapshot.audio.transcript;
|
|
@@ -606881,6 +607338,7 @@ function formatLiveSensorContextFromSnapshot(snapshot, opts = {}) {
|
|
|
606881
607338
|
lines.push(`intake_reason: ${snapshot.audio.intake.reason}`);
|
|
606882
607339
|
}
|
|
606883
607340
|
if (snapshot.audio.analysis) {
|
|
607341
|
+
lines.push(`Live sound summary: ${formatAudioAnalysisDashboardSummary(snapshot.audio.analysis)}`);
|
|
606884
607342
|
lines.push("Live sound analysis:");
|
|
606885
607343
|
lines.push(cleanPreview(snapshot.audio.analysis, 1600));
|
|
606886
607344
|
}
|
|
@@ -607109,7 +607567,7 @@ async function recordAudioSampleWithRecovery(preferred, devices, durationSec, ou
|
|
|
607109
607567
|
device: candidate,
|
|
607110
607568
|
method,
|
|
607111
607569
|
activity,
|
|
607112
|
-
bytes:
|
|
607570
|
+
bytes: readFileSync93(outputPath3),
|
|
607113
607571
|
errors: [...errors]
|
|
607114
607572
|
};
|
|
607115
607573
|
}
|
|
@@ -607172,7 +607630,7 @@ function isJetsonUnifiedMemoryHost() {
|
|
|
607172
607630
|
if (!["arm64", "aarch64"].includes(arch3())) return false;
|
|
607173
607631
|
if (existsSync114("/etc/nv_tegra_release")) return true;
|
|
607174
607632
|
try {
|
|
607175
|
-
const model =
|
|
607633
|
+
const model = readFileSync93("/proc/device-tree/model", "utf8");
|
|
607176
607634
|
return /nvidia|jetson|orin|tegra/i.test(model);
|
|
607177
607635
|
} catch {
|
|
607178
607636
|
return false;
|
|
@@ -607210,6 +607668,7 @@ function formatLiveStatus(snapshot) {
|
|
|
607210
607668
|
`Camera orientation: ${cfg.selectedCamera ? describeCameraOrientation(cfg.cameraOrientation?.[cfg.selectedCamera]) : "none"}`,
|
|
607211
607669
|
`Audio input: ${cfg.selectedAudioInput || "none"}`,
|
|
607212
607670
|
`Audio output: ${cfg.selectedAudioOutput || "none"}`,
|
|
607671
|
+
`Resources: ${formatLiveMenuResourceSummary()}`,
|
|
607213
607672
|
`Snapshot: ${liveSnapshotPath(snapshot.repoRoot)}`
|
|
607214
607673
|
];
|
|
607215
607674
|
if (snapshot.video?.updatedAt) {
|
|
@@ -607265,6 +607724,10 @@ var init_live_sensors = __esm({
|
|
|
607265
607724
|
config: this.config,
|
|
607266
607725
|
devices: this.devices
|
|
607267
607726
|
};
|
|
607727
|
+
try {
|
|
607728
|
+
getModelBroker().startPolling(2500);
|
|
607729
|
+
} catch {
|
|
607730
|
+
}
|
|
607268
607731
|
this.ensureLoops();
|
|
607269
607732
|
}
|
|
607270
607733
|
repoRoot;
|
|
@@ -608196,6 +608659,7 @@ var init_live_sensors = __esm({
|
|
|
608196
608659
|
this.lastInferenceAt.set(source, sampledAt);
|
|
608197
608660
|
const loop = new LiveMediaLoopTool(this.repoRoot);
|
|
608198
608661
|
const inferFromCapturedFrame = preview.ok && Boolean(preview.framePath);
|
|
608662
|
+
const captureSize = liveCameraResolutionSize(this.getCameraStreamResolution(source));
|
|
608199
608663
|
const mediaAbortController = new AbortController();
|
|
608200
608664
|
this.liveMediaAbortControllers.add(mediaAbortController);
|
|
608201
608665
|
const result = await this.runSequentialLiveVision(() => loop.execute({
|
|
@@ -608210,6 +608674,8 @@ var init_live_sensors = __esm({
|
|
|
608210
608674
|
sample_interval_sec: inferFromCapturedFrame ? 0.1 : 0.25,
|
|
608211
608675
|
max_frames: 1,
|
|
608212
608676
|
rotate_degrees: inferFromCapturedFrame ? 0 : orientation?.rotation ?? 0,
|
|
608677
|
+
...inferFromCapturedFrame || !captureSize ? {} : { width: captureSize.width, height: captureSize.height },
|
|
608678
|
+
...inferFromCapturedFrame ? {} : { fps: this.getCameraStreamFps(source) },
|
|
608213
608679
|
auto_bootstrap: true,
|
|
608214
608680
|
audio_mode: "none",
|
|
608215
608681
|
detect_objects: true,
|
|
@@ -608486,27 +608952,20 @@ ${output}`).join("\n\n");
|
|
|
608486
608952
|
audioErrors.push(`No live input signal detected from selected input ${capture.device}; keeping the explicit selection.`);
|
|
608487
608953
|
}
|
|
608488
608954
|
if (this.config.asrEnabled) {
|
|
608489
|
-
|
|
608490
|
-
|
|
608491
|
-
|
|
608492
|
-
|
|
608493
|
-
|
|
608494
|
-
|
|
608495
|
-
|
|
608496
|
-
|
|
608497
|
-
|
|
608498
|
-
|
|
608499
|
-
|
|
608500
|
-
|
|
608501
|
-
|
|
608502
|
-
|
|
608503
|
-
transcript = cleanPreview(typeof asr.llmContent === "string" ? asr.llmContent : "", 1600);
|
|
608504
|
-
asrBackend = extractAsrBackend(asr.output) ?? "whisper";
|
|
608505
|
-
} else {
|
|
608506
|
-
audioErrors.push(`ASR unavailable: ${asr.error || asr.output || "unknown error"}`);
|
|
608507
|
-
}
|
|
608508
|
-
} catch (err) {
|
|
608509
|
-
audioErrors.push(`ASR unavailable: ${err instanceof Error ? err.message : String(err)}`);
|
|
608955
|
+
const liveAsr = getListenLiveState();
|
|
608956
|
+
const now2 = Date.now();
|
|
608957
|
+
const finalAge = liveAsr.lastTranscriptAt > 0 ? now2 - liveAsr.lastTranscriptAt : Number.POSITIVE_INFINITY;
|
|
608958
|
+
const partialAge = liveAsr.lastPartialTranscriptAt > 0 ? now2 - liveAsr.lastPartialTranscriptAt : Number.POSITIVE_INFINITY;
|
|
608959
|
+
if (liveAsr.lastTranscript && finalAge < 45e3) {
|
|
608960
|
+
transcript = cleanPreview(liveAsr.lastTranscript, 1600);
|
|
608961
|
+
asrBackend = [liveAsr.backend, liveAsr.model, "streaming"].filter(Boolean).join(" ");
|
|
608962
|
+
} else if (liveAsr.lastPartialTranscript && partialAge < 2e4) {
|
|
608963
|
+
transcript = cleanPreview(liveAsr.lastPartialTranscript, 1600);
|
|
608964
|
+
asrBackend = [liveAsr.backend, liveAsr.model, "streaming-partial"].filter(Boolean).join(" ");
|
|
608965
|
+
} else if (liveAsr.phase === "idle") {
|
|
608966
|
+
audioErrors.push("Streaming ASR is not running. Start /live run or /listen to enable CUDA Whisper streaming.");
|
|
608967
|
+
} else if (liveAsr.lastStatus) {
|
|
608968
|
+
audioErrors.push(`Streaming ASR status: ${liveAsr.lastStatus}`);
|
|
608510
608969
|
}
|
|
608511
608970
|
}
|
|
608512
608971
|
if (this.config.audioAnalysisEnabled) {
|
|
@@ -608528,6 +608987,13 @@ ${output}`).join("\n\n");
|
|
|
608528
608987
|
analysis = parts.filter(Boolean).join("\n");
|
|
608529
608988
|
}
|
|
608530
608989
|
if (transcript) {
|
|
608990
|
+
asrLease = this.resourceArbiter.claim({
|
|
608991
|
+
owner: "live-asr",
|
|
608992
|
+
priority: 88,
|
|
608993
|
+
ttlMs: 18e3,
|
|
608994
|
+
reason: "live streaming ASR transcript accepted",
|
|
608995
|
+
suppress: ["vision"]
|
|
608996
|
+
});
|
|
608531
608997
|
intake = await classifyLiveAudioIntake(transcript, this.intakeAgentConfig);
|
|
608532
608998
|
keepAsrLease = true;
|
|
608533
608999
|
asrLease?.extend(
|
|
@@ -608735,17 +609201,17 @@ ${analysis}` : ""
|
|
|
608735
609201
|
this.videoTimer.unref?.();
|
|
608736
609202
|
}
|
|
608737
609203
|
scheduleAudioLoop(delayMs) {
|
|
608738
|
-
const wantsAudio = this.config.audioEnabled &&
|
|
609204
|
+
const wantsAudio = this.config.audioEnabled && this.config.audioAnalysisEnabled;
|
|
608739
609205
|
if (!wantsAudio || this.audioTimer) return;
|
|
608740
609206
|
this.audioTimer = setTimeout(async () => {
|
|
608741
609207
|
this.audioTimer = null;
|
|
608742
|
-
const stillWantsAudio = this.config.audioEnabled &&
|
|
609208
|
+
const stillWantsAudio = this.config.audioEnabled && this.config.audioAnalysisEnabled;
|
|
608743
609209
|
if (!stillWantsAudio) return;
|
|
608744
609210
|
try {
|
|
608745
609211
|
await this.sampleAudioNow();
|
|
608746
609212
|
} catch {
|
|
608747
609213
|
} finally {
|
|
608748
|
-
const wantsNext = this.config.audioEnabled &&
|
|
609214
|
+
const wantsNext = this.config.audioEnabled && this.config.audioAnalysisEnabled;
|
|
608749
609215
|
if (wantsNext) {
|
|
608750
609216
|
this.scheduleAudioLoop(this.config.audioIntervalMs);
|
|
608751
609217
|
}
|
|
@@ -608783,7 +609249,7 @@ ${analysis}` : ""
|
|
|
608783
609249
|
clearTimeout(this.previewTickTimer);
|
|
608784
609250
|
this.previewTickTimer = null;
|
|
608785
609251
|
}
|
|
608786
|
-
const wantsAudio = this.config.audioEnabled &&
|
|
609252
|
+
const wantsAudio = this.config.audioEnabled && this.config.audioAnalysisEnabled;
|
|
608787
609253
|
if (wantsAudio && !this.audioTimer) {
|
|
608788
609254
|
this.scheduleAudioLoop(0);
|
|
608789
609255
|
} else if (!wantsAudio && this.audioTimer) {
|
|
@@ -609039,7 +609505,7 @@ var init_tool_adapter = __esm({
|
|
|
609039
609505
|
});
|
|
609040
609506
|
|
|
609041
609507
|
// packages/cli/src/tui/runtime-verification.ts
|
|
609042
|
-
import { existsSync as existsSync115, readFileSync as
|
|
609508
|
+
import { existsSync as existsSync115, readFileSync as readFileSync94, readdirSync as readdirSync37 } from "node:fs";
|
|
609043
609509
|
import { dirname as dirname38, extname as extname14, join as join129, relative as relative12, resolve as resolve54 } from "node:path";
|
|
609044
609510
|
function safeRelative(root, file) {
|
|
609045
609511
|
const rel = relative12(root, file);
|
|
@@ -609093,7 +609559,7 @@ function resolveScriptSource(root, htmlFile, src2) {
|
|
|
609093
609559
|
function referencedScriptAssets(root, htmlFile) {
|
|
609094
609560
|
let html = "";
|
|
609095
609561
|
try {
|
|
609096
|
-
html =
|
|
609562
|
+
html = readFileSync94(htmlFile, "utf8");
|
|
609097
609563
|
} catch {
|
|
609098
609564
|
return [];
|
|
609099
609565
|
}
|
|
@@ -609136,7 +609602,7 @@ async function runStaticRuntimeAssetSyntaxCheck(projectRoot, options2 = {}) {
|
|
|
609136
609602
|
if (issueByAsset.has(assetFile)) continue;
|
|
609137
609603
|
let source = "";
|
|
609138
609604
|
try {
|
|
609139
|
-
source =
|
|
609605
|
+
source = readFileSync94(assetFile, "utf8");
|
|
609140
609606
|
} catch {
|
|
609141
609607
|
continue;
|
|
609142
609608
|
}
|
|
@@ -615479,7 +615945,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
|
|
|
615479
615945
|
async function fetchPeerModels(peerId, authKey) {
|
|
615480
615946
|
try {
|
|
615481
615947
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
615482
|
-
const { existsSync: existsSync173, readFileSync:
|
|
615948
|
+
const { existsSync: existsSync173, readFileSync: readFileSync142 } = await import("node:fs");
|
|
615483
615949
|
const { join: join188 } = await import("node:path");
|
|
615484
615950
|
const cwd4 = process.cwd();
|
|
615485
615951
|
const nexusTool = new NexusTool2(cwd4);
|
|
@@ -615488,7 +615954,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615488
615954
|
try {
|
|
615489
615955
|
const statusPath = join188(nexusDir, "status.json");
|
|
615490
615956
|
if (existsSync173(statusPath)) {
|
|
615491
|
-
const status = JSON.parse(
|
|
615957
|
+
const status = JSON.parse(readFileSync142(statusPath, "utf8"));
|
|
615492
615958
|
if (status.peerId === peerId) isLocalPeer = true;
|
|
615493
615959
|
}
|
|
615494
615960
|
} catch {
|
|
@@ -615497,7 +615963,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615497
615963
|
const pricingPath = join188(nexusDir, "pricing.json");
|
|
615498
615964
|
if (existsSync173(pricingPath)) {
|
|
615499
615965
|
try {
|
|
615500
|
-
const pricing = JSON.parse(
|
|
615966
|
+
const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
|
|
615501
615967
|
const localModels = (pricing.models || []).map((m2) => ({
|
|
615502
615968
|
name: m2.model || "unknown",
|
|
615503
615969
|
size: m2.parameterSize || "",
|
|
@@ -615513,7 +615979,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615513
615979
|
const cachePath2 = join188(nexusDir, "peer-models-cache.json");
|
|
615514
615980
|
if (existsSync173(cachePath2)) {
|
|
615515
615981
|
try {
|
|
615516
|
-
const cache8 = JSON.parse(
|
|
615982
|
+
const cache8 = JSON.parse(readFileSync142(cachePath2, "utf8"));
|
|
615517
615983
|
if (cache8.peerId === peerId && cache8.models?.length > 0) {
|
|
615518
615984
|
const age = Date.now() - new Date(cache8.cachedAt).getTime();
|
|
615519
615985
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -615628,7 +616094,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
615628
616094
|
const pricingPath = join188(nexusDir, "pricing.json");
|
|
615629
616095
|
if (existsSync173(pricingPath)) {
|
|
615630
616096
|
try {
|
|
615631
|
-
const pricing = JSON.parse(
|
|
616097
|
+
const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
|
|
615632
616098
|
return (pricing.models || []).map((m2) => ({
|
|
615633
616099
|
name: m2.model || "unknown",
|
|
615634
616100
|
size: m2.parameterSize || "",
|
|
@@ -616949,7 +617415,13 @@ function renderVoiceChatCoalescedRow(row, opts) {
|
|
|
616949
617415
|
return;
|
|
616950
617416
|
}
|
|
616951
617417
|
if (_voiceChatCoalesce) {
|
|
616952
|
-
|
|
617418
|
+
const replacePrefix = opts?.replaceLastPrefix;
|
|
617419
|
+
const lastIndex = _voiceChatCoalesce.rows.length - 1;
|
|
617420
|
+
if (replacePrefix && lastIndex >= 0 && _voiceChatCoalesce.rows[lastIndex]?.startsWith(replacePrefix)) {
|
|
617421
|
+
_voiceChatCoalesce.rows[lastIndex] = row;
|
|
617422
|
+
} else {
|
|
617423
|
+
_voiceChatCoalesce.rows.push(row);
|
|
617424
|
+
}
|
|
616953
617425
|
host.refreshDynamicBlocks();
|
|
616954
617426
|
return;
|
|
616955
617427
|
}
|
|
@@ -619293,7 +619765,7 @@ var init_voice_session = __esm({
|
|
|
619293
619765
|
|
|
619294
619766
|
// packages/cli/src/tui/scoped-personality.ts
|
|
619295
619767
|
import { createHash as createHash32 } from "node:crypto";
|
|
619296
|
-
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";
|
|
619297
619769
|
import { join as join130, resolve as resolve55 } from "node:path";
|
|
619298
619770
|
function safeName(input) {
|
|
619299
619771
|
return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
|
|
@@ -619448,7 +619920,7 @@ function loadScopedPersonality(scope) {
|
|
|
619448
619920
|
const paths = scopedPersonalityPaths(scope);
|
|
619449
619921
|
if (!existsSync116(paths.json)) return newDocument(scope);
|
|
619450
619922
|
try {
|
|
619451
|
-
const parsed = JSON.parse(
|
|
619923
|
+
const parsed = JSON.parse(readFileSync95(paths.json, "utf8"));
|
|
619452
619924
|
if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
|
|
619453
619925
|
return normalizeDocument(scope, parsed);
|
|
619454
619926
|
} catch {
|
|
@@ -619672,7 +620144,7 @@ var init_scoped_personality = __esm({
|
|
|
619672
620144
|
|
|
619673
620145
|
// packages/cli/src/tui/voice-soul.ts
|
|
619674
620146
|
import { createHash as createHash33 } from "node:crypto";
|
|
619675
|
-
import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as
|
|
620147
|
+
import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as readFileSync96 } from "node:fs";
|
|
619676
620148
|
import { basename as basename24, join as join131, resolve as resolve56 } from "node:path";
|
|
619677
620149
|
function compactText(text2, limit) {
|
|
619678
620150
|
const compact4 = text2.replace(/\s+/g, " ").trim();
|
|
@@ -619699,7 +620171,7 @@ function loadSoulRuntimeState(input) {
|
|
|
619699
620171
|
const path12 = soulRuntimeStatePath(input);
|
|
619700
620172
|
if (!existsSync117(path12)) return { version: 1 };
|
|
619701
620173
|
try {
|
|
619702
|
-
const parsed = JSON.parse(
|
|
620174
|
+
const parsed = JSON.parse(readFileSync96(path12, "utf8"));
|
|
619703
620175
|
if (!parsed || parsed.version !== 1) return { version: 1 };
|
|
619704
620176
|
return {
|
|
619705
620177
|
version: 1,
|
|
@@ -619817,7 +620289,7 @@ function findProjectSoul(scope) {
|
|
|
619817
620289
|
]) {
|
|
619818
620290
|
if (!existsSync117(candidate)) continue;
|
|
619819
620291
|
try {
|
|
619820
|
-
return { path: candidate, content:
|
|
620292
|
+
return { path: candidate, content: readFileSync96(candidate, "utf8") };
|
|
619821
620293
|
} catch {
|
|
619822
620294
|
return null;
|
|
619823
620295
|
}
|
|
@@ -619836,7 +620308,7 @@ function findProjectVoice(scope) {
|
|
|
619836
620308
|
const first2 = files[0];
|
|
619837
620309
|
if (!first2) return null;
|
|
619838
620310
|
const path12 = join131(voiceDir3, first2);
|
|
619839
|
-
return { path: path12, content:
|
|
620311
|
+
return { path: path12, content: readFileSync96(path12, "utf8") };
|
|
619840
620312
|
} catch {
|
|
619841
620313
|
return null;
|
|
619842
620314
|
}
|
|
@@ -620101,7 +620573,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
|
|
|
620101
620573
|
import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
|
|
620102
620574
|
import { URL as URL2 } from "node:url";
|
|
620103
620575
|
import { loadavg as loadavg2, cpus as cpus4, totalmem as totalmem7, freemem as freemem6 } from "node:os";
|
|
620104
|
-
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";
|
|
620105
620577
|
import { join as join132 } from "node:path";
|
|
620106
620578
|
function cleanForwardHeaders(raw, targetHost) {
|
|
620107
620579
|
const out = {};
|
|
@@ -620272,7 +620744,7 @@ function readSponsorUsageState(stateDir) {
|
|
|
620272
620744
|
try {
|
|
620273
620745
|
const path12 = join132(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
|
|
620274
620746
|
if (!existsSync118(path12)) return null;
|
|
620275
|
-
const parsed = JSON.parse(
|
|
620747
|
+
const parsed = JSON.parse(readFileSync97(path12, "utf8"));
|
|
620276
620748
|
const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
|
|
620277
620749
|
const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
|
|
620278
620750
|
if (!dailyTokensResetAt) return null;
|
|
@@ -620297,7 +620769,7 @@ function readExposeState(stateDir) {
|
|
|
620297
620769
|
try {
|
|
620298
620770
|
const path12 = join132(stateDir, STATE_FILE_NAME);
|
|
620299
620771
|
if (!existsSync118(path12)) return null;
|
|
620300
|
-
const raw =
|
|
620772
|
+
const raw = readFileSync97(path12, "utf8");
|
|
620301
620773
|
const data = JSON.parse(raw);
|
|
620302
620774
|
if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
|
|
620303
620775
|
return data;
|
|
@@ -620435,7 +620907,7 @@ function readP2PExposeState(stateDir) {
|
|
|
620435
620907
|
try {
|
|
620436
620908
|
const path12 = join132(stateDir, P2P_STATE_FILE_NAME);
|
|
620437
620909
|
if (!existsSync118(path12)) return null;
|
|
620438
|
-
const raw =
|
|
620910
|
+
const raw = readFileSync97(path12, "utf8");
|
|
620439
620911
|
const data = JSON.parse(raw);
|
|
620440
620912
|
if (!data.peerId || !data.authKey) return null;
|
|
620441
620913
|
return data;
|
|
@@ -621839,7 +622311,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
621839
622311
|
const statusPath = join132(nexusDir, "status.json");
|
|
621840
622312
|
for (let i2 = 0; i2 < 80; i2++) {
|
|
621841
622313
|
try {
|
|
621842
|
-
const raw =
|
|
622314
|
+
const raw = readFileSync97(statusPath, "utf8");
|
|
621843
622315
|
if (raw.length > 10) {
|
|
621844
622316
|
const status = JSON.parse(raw);
|
|
621845
622317
|
if (status.connected && status.peerId) {
|
|
@@ -621904,7 +622376,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
621904
622376
|
removeP2PExposeState(stateDir);
|
|
621905
622377
|
return null;
|
|
621906
622378
|
}
|
|
621907
|
-
const status = JSON.parse(
|
|
622379
|
+
const status = JSON.parse(readFileSync97(statusPath, "utf8"));
|
|
621908
622380
|
if (!status.connected || !status.peerId) {
|
|
621909
622381
|
removeP2PExposeState(stateDir);
|
|
621910
622382
|
return null;
|
|
@@ -621982,7 +622454,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
621982
622454
|
let meteringLines = lastMeteringLineCount;
|
|
621983
622455
|
try {
|
|
621984
622456
|
if (existsSync118(meteringFile)) {
|
|
621985
|
-
const content =
|
|
622457
|
+
const content = readFileSync97(meteringFile, "utf8");
|
|
621986
622458
|
meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
|
|
621987
622459
|
}
|
|
621988
622460
|
} catch {
|
|
@@ -622011,7 +622483,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622011
622483
|
try {
|
|
622012
622484
|
const statusPath = join132(nexusDir, "status.json");
|
|
622013
622485
|
if (existsSync118(statusPath)) {
|
|
622014
|
-
const status = JSON.parse(
|
|
622486
|
+
const status = JSON.parse(readFileSync97(statusPath, "utf8"));
|
|
622015
622487
|
if (status.peerId && !this._peerId) {
|
|
622016
622488
|
this._peerId = status.peerId;
|
|
622017
622489
|
}
|
|
@@ -622034,7 +622506,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
622034
622506
|
try {
|
|
622035
622507
|
const meteringFile = join132(nexusDir, "metering.jsonl");
|
|
622036
622508
|
if (existsSync118(meteringFile)) {
|
|
622037
|
-
const content =
|
|
622509
|
+
const content = readFileSync97(meteringFile, "utf8");
|
|
622038
622510
|
if (content.length > lastMeteringSize) {
|
|
622039
622511
|
const newContent = content.slice(lastMeteringSize);
|
|
622040
622512
|
lastMeteringSize = content.length;
|
|
@@ -622331,7 +622803,7 @@ var init_types3 = __esm({
|
|
|
622331
622803
|
|
|
622332
622804
|
// packages/cli/src/tui/p2p/secret-vault.ts
|
|
622333
622805
|
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
|
|
622334
|
-
import { readFileSync as
|
|
622806
|
+
import { readFileSync as readFileSync98, writeFileSync as writeFileSync61, existsSync as existsSync119, mkdirSync as mkdirSync73 } from "node:fs";
|
|
622335
622807
|
import { dirname as dirname39 } from "node:path";
|
|
622336
622808
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
622337
622809
|
var init_secret_vault = __esm({
|
|
@@ -622549,7 +623021,7 @@ var init_secret_vault = __esm({
|
|
|
622549
623021
|
*/
|
|
622550
623022
|
load(passphrase) {
|
|
622551
623023
|
if (!this.storePath || !existsSync119(this.storePath)) return 0;
|
|
622552
|
-
const blob =
|
|
623024
|
+
const blob = readFileSync98(this.storePath);
|
|
622553
623025
|
if (blob.length < SALT_LEN + IV_LEN + 16) {
|
|
622554
623026
|
throw new Error("Vault file is corrupted (too small)");
|
|
622555
623027
|
}
|
|
@@ -623587,7 +624059,7 @@ ${activitySummary}
|
|
|
623587
624059
|
});
|
|
623588
624060
|
|
|
623589
624061
|
// packages/cli/src/api/profiles.ts
|
|
623590
|
-
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";
|
|
623591
624063
|
import { join as join134 } from "node:path";
|
|
623592
624064
|
import { homedir as homedir41 } from "node:os";
|
|
623593
624065
|
import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
|
|
@@ -623607,7 +624079,7 @@ function listProfiles(projectDir2) {
|
|
|
623607
624079
|
if (existsSync120(projDir)) {
|
|
623608
624080
|
for (const f2 of readdirSync40(projDir).filter((f3) => f3.endsWith(".json"))) {
|
|
623609
624081
|
try {
|
|
623610
|
-
const raw = JSON.parse(
|
|
624082
|
+
const raw = JSON.parse(readFileSync99(join134(projDir, f2), "utf8"));
|
|
623611
624083
|
const name10 = f2.replace(".json", "");
|
|
623612
624084
|
seen.add(name10);
|
|
623613
624085
|
result.push({
|
|
@@ -623626,7 +624098,7 @@ function listProfiles(projectDir2) {
|
|
|
623626
624098
|
const name10 = f2.replace(".json", "");
|
|
623627
624099
|
if (seen.has(name10)) continue;
|
|
623628
624100
|
try {
|
|
623629
|
-
const raw = JSON.parse(
|
|
624101
|
+
const raw = JSON.parse(readFileSync99(join134(globDir, f2), "utf8"));
|
|
623630
624102
|
result.push({
|
|
623631
624103
|
name: name10,
|
|
623632
624104
|
description: raw.description || "",
|
|
@@ -623662,7 +624134,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
|
|
|
623662
624134
|
];
|
|
623663
624135
|
for (const candidate of candidates) {
|
|
623664
624136
|
if (!existsSync120(candidate.path)) continue;
|
|
623665
|
-
const raw = JSON.parse(
|
|
624137
|
+
const raw = JSON.parse(readFileSync99(candidate.path, "utf8"));
|
|
623666
624138
|
if (raw.encrypted === true) {
|
|
623667
624139
|
if (!password) return null;
|
|
623668
624140
|
const profile = decryptProfile(raw, password);
|
|
@@ -623969,7 +624441,7 @@ __export(omnius_directory_exports, {
|
|
|
623969
624441
|
writeIndexMeta: () => writeIndexMeta,
|
|
623970
624442
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
623971
624443
|
});
|
|
623972
|
-
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";
|
|
623973
624445
|
import { join as join135, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
|
|
623974
624446
|
import { homedir as homedir42 } from "node:os";
|
|
623975
624447
|
import { createHash as createHash37 } from "node:crypto";
|
|
@@ -623979,7 +624451,7 @@ function isGitRoot(dir) {
|
|
|
623979
624451
|
try {
|
|
623980
624452
|
const stat9 = statSync46(gitPath);
|
|
623981
624453
|
if (stat9.isFile()) {
|
|
623982
|
-
return
|
|
624454
|
+
return readFileSync100(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
623983
624455
|
}
|
|
623984
624456
|
if (!stat9.isDirectory()) return false;
|
|
623985
624457
|
return existsSync121(join135(gitPath, "HEAD")) || existsSync121(join135(gitPath, "config")) || existsSync121(join135(gitPath, "commondir"));
|
|
@@ -624038,7 +624510,7 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
624038
624510
|
const gitignoreDir = dirname40(gitignorePath);
|
|
624039
624511
|
const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
|
|
624040
624512
|
const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
|
|
624041
|
-
const content =
|
|
624513
|
+
const content = readFileSync100(gitignorePath, "utf-8");
|
|
624042
624514
|
const normalizedTarget = normalizeIgnoreRule(ignorePattern);
|
|
624043
624515
|
const alreadyIgnored = content.split(/\r?\n/).some((line) => {
|
|
624044
624516
|
const trimmed = line.trim();
|
|
@@ -624161,7 +624633,7 @@ function loadProjectSettings(repoRoot) {
|
|
|
624161
624633
|
const settingsPath = join135(repoRoot, OMNIUS_DIR, "settings.json");
|
|
624162
624634
|
try {
|
|
624163
624635
|
if (existsSync121(settingsPath)) {
|
|
624164
|
-
return JSON.parse(
|
|
624636
|
+
return JSON.parse(readFileSync100(settingsPath, "utf-8"));
|
|
624165
624637
|
}
|
|
624166
624638
|
} catch {
|
|
624167
624639
|
}
|
|
@@ -624178,7 +624650,7 @@ function loadGlobalSettings() {
|
|
|
624178
624650
|
const settingsPath = join135(homedir42(), ".omnius", "settings.json");
|
|
624179
624651
|
try {
|
|
624180
624652
|
if (existsSync121(settingsPath)) {
|
|
624181
|
-
return JSON.parse(
|
|
624653
|
+
return JSON.parse(readFileSync100(settingsPath, "utf-8"));
|
|
624182
624654
|
}
|
|
624183
624655
|
} catch {
|
|
624184
624656
|
}
|
|
@@ -624209,7 +624681,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
624209
624681
|
if (existsSync121(filePath) && !seen.has(filePath)) {
|
|
624210
624682
|
seen.add(filePath);
|
|
624211
624683
|
try {
|
|
624212
|
-
let content =
|
|
624684
|
+
let content = readFileSync100(filePath, "utf-8");
|
|
624213
624685
|
if (content.length > maxContentLen) {
|
|
624214
624686
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
624215
624687
|
}
|
|
@@ -624242,7 +624714,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
624242
624714
|
function readIndexMeta(repoRoot) {
|
|
624243
624715
|
const metaPath = join135(repoRoot, OMNIUS_DIR, "index", "meta.json");
|
|
624244
624716
|
try {
|
|
624245
|
-
return JSON.parse(
|
|
624717
|
+
return JSON.parse(readFileSync100(metaPath, "utf-8"));
|
|
624246
624718
|
} catch {
|
|
624247
624719
|
return null;
|
|
624248
624720
|
}
|
|
@@ -624255,7 +624727,7 @@ function writeIndexMeta(repoRoot, meta) {
|
|
|
624255
624727
|
function readIndexData(repoRoot, filename) {
|
|
624256
624728
|
const filePath = join135(repoRoot, OMNIUS_DIR, "index", filename);
|
|
624257
624729
|
try {
|
|
624258
|
-
return JSON.parse(
|
|
624730
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624259
624731
|
} catch {
|
|
624260
624732
|
return null;
|
|
624261
624733
|
}
|
|
@@ -624334,7 +624806,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
624334
624806
|
}).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
|
|
624335
624807
|
return files.map((f2) => {
|
|
624336
624808
|
try {
|
|
624337
|
-
return JSON.parse(
|
|
624809
|
+
return JSON.parse(readFileSync100(join135(historyDir, f2.file), "utf-8"));
|
|
624338
624810
|
} catch {
|
|
624339
624811
|
return null;
|
|
624340
624812
|
}
|
|
@@ -624358,7 +624830,7 @@ function loadPendingTask(repoRoot) {
|
|
|
624358
624830
|
const filePath = join135(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
|
|
624359
624831
|
try {
|
|
624360
624832
|
if (!existsSync121(filePath)) return null;
|
|
624361
|
-
const data = JSON.parse(
|
|
624833
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624362
624834
|
try {
|
|
624363
624835
|
unlinkSync23(filePath);
|
|
624364
624836
|
} catch {
|
|
@@ -624388,7 +624860,7 @@ function readTaskHandoff2(repoRoot) {
|
|
|
624388
624860
|
const filePath = join135(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
|
|
624389
624861
|
try {
|
|
624390
624862
|
if (!existsSync121(filePath)) return null;
|
|
624391
|
-
const data = JSON.parse(
|
|
624863
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624392
624864
|
const handoffTime = new Date(data.handoffAt).getTime();
|
|
624393
624865
|
const now2 = Date.now();
|
|
624394
624866
|
const ageMs = now2 - handoffTime;
|
|
@@ -624474,7 +624946,7 @@ function acquireLock(lockPath) {
|
|
|
624474
624946
|
} catch (err) {
|
|
624475
624947
|
if (existsSync121(lockPath)) {
|
|
624476
624948
|
try {
|
|
624477
|
-
const lockContent =
|
|
624949
|
+
const lockContent = readFileSync100(lockPath, "utf-8");
|
|
624478
624950
|
const lock = JSON.parse(lockContent);
|
|
624479
624951
|
const lockAge = Date.now() - lock.acquiredAt;
|
|
624480
624952
|
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
@@ -624500,7 +624972,7 @@ function acquireLock(lockPath) {
|
|
|
624500
624972
|
function releaseLock(lockPath) {
|
|
624501
624973
|
try {
|
|
624502
624974
|
if (existsSync121(lockPath)) {
|
|
624503
|
-
const lockContent =
|
|
624975
|
+
const lockContent = readFileSync100(lockPath, "utf-8");
|
|
624504
624976
|
const lock = JSON.parse(lockContent);
|
|
624505
624977
|
if (lock.pid === process.pid) {
|
|
624506
624978
|
unlinkSync23(lockPath);
|
|
@@ -624592,7 +625064,7 @@ function pruneContextLedger(ledgerPath) {
|
|
|
624592
625064
|
if (!existsSync121(ledgerPath)) return;
|
|
624593
625065
|
const st = statSync46(ledgerPath);
|
|
624594
625066
|
if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
|
|
624595
|
-
const lines =
|
|
625067
|
+
const lines = readFileSync100(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
624596
625068
|
if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
|
|
624597
625069
|
const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
|
|
624598
625070
|
const archiveDir = join135(dirname40(ledgerPath), "archive");
|
|
@@ -624620,7 +625092,7 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
624620
625092
|
let ctx3;
|
|
624621
625093
|
try {
|
|
624622
625094
|
if (existsSync121(filePath)) {
|
|
624623
|
-
ctx3 = JSON.parse(
|
|
625095
|
+
ctx3 = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624624
625096
|
} else {
|
|
624625
625097
|
ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
|
|
624626
625098
|
}
|
|
@@ -624782,7 +625254,7 @@ function loadSessionContext(repoRoot) {
|
|
|
624782
625254
|
const filePath = join135(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
|
|
624783
625255
|
try {
|
|
624784
625256
|
if (!existsSync121(filePath)) return null;
|
|
624785
|
-
return JSON.parse(
|
|
625257
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624786
625258
|
} catch {
|
|
624787
625259
|
return null;
|
|
624788
625260
|
}
|
|
@@ -624790,7 +625262,7 @@ function loadSessionContext(repoRoot) {
|
|
|
624790
625262
|
function readJsonOrNull(filePath) {
|
|
624791
625263
|
try {
|
|
624792
625264
|
if (!existsSync121(filePath)) return null;
|
|
624793
|
-
return JSON.parse(
|
|
625265
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
624794
625266
|
} catch {
|
|
624795
625267
|
return null;
|
|
624796
625268
|
}
|
|
@@ -625001,7 +625473,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
|
|
|
625001
625473
|
const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
625002
625474
|
try {
|
|
625003
625475
|
if (!existsSync121(indexPath)) return false;
|
|
625004
|
-
const index = JSON.parse(
|
|
625476
|
+
const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625005
625477
|
const idx = index.findIndex((e2) => e2.id === sessionId);
|
|
625006
625478
|
if (idx < 0) return false;
|
|
625007
625479
|
index[idx] = { ...index[idx], ...patch };
|
|
@@ -625050,7 +625522,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
|
|
|
625050
625522
|
let index = [];
|
|
625051
625523
|
try {
|
|
625052
625524
|
if (existsSync121(indexPath)) {
|
|
625053
|
-
index = JSON.parse(
|
|
625525
|
+
index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625054
625526
|
}
|
|
625055
625527
|
} catch {
|
|
625056
625528
|
}
|
|
@@ -625082,7 +625554,7 @@ function listSessions(repoRoot) {
|
|
|
625082
625554
|
const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
|
|
625083
625555
|
try {
|
|
625084
625556
|
if (!existsSync121(indexPath)) return [];
|
|
625085
|
-
const index = JSON.parse(
|
|
625557
|
+
const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625086
625558
|
return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
|
|
625087
625559
|
} catch {
|
|
625088
625560
|
return [];
|
|
@@ -625092,7 +625564,7 @@ function loadSessionHistory(repoRoot, sessionId) {
|
|
|
625092
625564
|
const contentPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
625093
625565
|
try {
|
|
625094
625566
|
if (!existsSync121(contentPath)) return null;
|
|
625095
|
-
return
|
|
625567
|
+
return readFileSync100(contentPath, "utf-8").split("\n");
|
|
625096
625568
|
} catch {
|
|
625097
625569
|
return null;
|
|
625098
625570
|
}
|
|
@@ -625104,7 +625576,7 @@ function deleteSession(repoRoot, sessionId) {
|
|
|
625104
625576
|
const contentPath = join135(sessDir, `${sessionId}.jsonl`);
|
|
625105
625577
|
if (existsSync121(contentPath)) unlinkSync23(contentPath);
|
|
625106
625578
|
if (existsSync121(indexPath)) {
|
|
625107
|
-
let index = JSON.parse(
|
|
625579
|
+
let index = JSON.parse(readFileSync100(indexPath, "utf-8"));
|
|
625108
625580
|
index = index.filter((s2) => s2.id !== sessionId);
|
|
625109
625581
|
writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
|
|
625110
625582
|
}
|
|
@@ -625161,7 +625633,7 @@ function detectManifests(repoRoot) {
|
|
|
625161
625633
|
let name10;
|
|
625162
625634
|
if (check.nameField) {
|
|
625163
625635
|
try {
|
|
625164
|
-
const data = JSON.parse(
|
|
625636
|
+
const data = JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625165
625637
|
name10 = data[check.nameField];
|
|
625166
625638
|
} catch {
|
|
625167
625639
|
}
|
|
@@ -625232,7 +625704,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
625232
625704
|
function loadUsageFile(filePath) {
|
|
625233
625705
|
try {
|
|
625234
625706
|
if (existsSync121(filePath)) {
|
|
625235
|
-
return JSON.parse(
|
|
625707
|
+
return JSON.parse(readFileSync100(filePath, "utf-8"));
|
|
625236
625708
|
}
|
|
625237
625709
|
} catch {
|
|
625238
625710
|
}
|
|
@@ -625559,7 +626031,7 @@ var init_session_summary = __esm({
|
|
|
625559
626031
|
|
|
625560
626032
|
// packages/cli/src/tui/cad-model-viewer.ts
|
|
625561
626033
|
import { createServer as createServer7 } from "node:http";
|
|
625562
|
-
import { existsSync as existsSync122, readFileSync as
|
|
626034
|
+
import { existsSync as existsSync122, readFileSync as readFileSync101, statSync as statSync47 } from "node:fs";
|
|
625563
626035
|
import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
|
|
625564
626036
|
function getCurrentCadModelViewer() {
|
|
625565
626037
|
return currentViewer;
|
|
@@ -625619,7 +626091,7 @@ function handleViewerRequest(req3, res, filePath) {
|
|
|
625619
626091
|
"Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
|
|
625620
626092
|
"Cache-Control": "no-store"
|
|
625621
626093
|
});
|
|
625622
|
-
res.end(
|
|
626094
|
+
res.end(readFileSync101(filePath));
|
|
625623
626095
|
} catch (err) {
|
|
625624
626096
|
sendText(res, 500, err instanceof Error ? err.message : String(err));
|
|
625625
626097
|
}
|
|
@@ -626023,7 +626495,7 @@ var init_render2 = __esm({
|
|
|
626023
626495
|
});
|
|
626024
626496
|
|
|
626025
626497
|
// packages/prompts/dist/promptLoader.js
|
|
626026
|
-
import { readFileSync as
|
|
626498
|
+
import { readFileSync as readFileSync103, existsSync as existsSync124 } from "node:fs";
|
|
626027
626499
|
import { join as join137, dirname as dirname41 } from "node:path";
|
|
626028
626500
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
626029
626501
|
function loadPrompt2(promptPath, vars) {
|
|
@@ -626033,7 +626505,7 @@ function loadPrompt2(promptPath, vars) {
|
|
|
626033
626505
|
if (!existsSync124(fullPath)) {
|
|
626034
626506
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
626035
626507
|
}
|
|
626036
|
-
content =
|
|
626508
|
+
content = readFileSync103(fullPath, "utf-8");
|
|
626037
626509
|
cache6.set(promptPath, content);
|
|
626038
626510
|
}
|
|
626039
626511
|
if (!vars)
|
|
@@ -627152,7 +627624,7 @@ __export(tui_tasks_renderer_exports, {
|
|
|
627152
627624
|
setTuiTasksSession: () => setTuiTasksSession,
|
|
627153
627625
|
teardownTuiTasks: () => teardownTuiTasks
|
|
627154
627626
|
});
|
|
627155
|
-
import { existsSync as existsSync125, readFileSync as
|
|
627627
|
+
import { existsSync as existsSync125, readFileSync as readFileSync104, watch as fsWatch3 } from "node:fs";
|
|
627156
627628
|
import { join as join139 } from "node:path";
|
|
627157
627629
|
import { homedir as homedir44 } from "node:os";
|
|
627158
627630
|
function setTasksRendererWriter(writer) {
|
|
@@ -627279,7 +627751,7 @@ function loadTodos() {
|
|
|
627279
627751
|
_lastTodos = [];
|
|
627280
627752
|
return;
|
|
627281
627753
|
}
|
|
627282
|
-
const parsed = JSON.parse(
|
|
627754
|
+
const parsed = JSON.parse(readFileSync104(fp, "utf-8"));
|
|
627283
627755
|
_lastTodos = Array.isArray(parsed) ? parsed : [];
|
|
627284
627756
|
} catch {
|
|
627285
627757
|
_lastTodos = [];
|
|
@@ -633152,7 +633624,7 @@ __export(personaplex_exports, {
|
|
|
633152
633624
|
startPersonaPlexDaemon: () => startPersonaPlexDaemon,
|
|
633153
633625
|
stopPersonaPlex: () => stopPersonaPlex
|
|
633154
633626
|
});
|
|
633155
|
-
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";
|
|
633156
633628
|
import { join as join140, dirname as dirname43 } from "node:path";
|
|
633157
633629
|
import { homedir as homedir45 } from "node:os";
|
|
633158
633630
|
import { spawn as spawn33 } from "node:child_process";
|
|
@@ -633191,9 +633663,9 @@ function selectWeightTier(vramGB) {
|
|
|
633191
633663
|
}
|
|
633192
633664
|
function detectJetson() {
|
|
633193
633665
|
try {
|
|
633194
|
-
const model =
|
|
633666
|
+
const model = readFileSync105("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
|
|
633195
633667
|
if (/jetson|orin|tegra/i.test(model)) {
|
|
633196
|
-
const memInfo =
|
|
633668
|
+
const memInfo = readFileSync105("/proc/meminfo", "utf8");
|
|
633197
633669
|
const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
|
|
633198
633670
|
return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
|
|
633199
633671
|
}
|
|
@@ -633268,7 +633740,7 @@ function fileLink2(filePath, label) {
|
|
|
633268
633740
|
}
|
|
633269
633741
|
async function isPersonaPlexRunning() {
|
|
633270
633742
|
if (!existsSync126(PID_FILE)) return false;
|
|
633271
|
-
const pid = parseInt(
|
|
633743
|
+
const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
|
|
633272
633744
|
if (isNaN(pid) || pid <= 0) return false;
|
|
633273
633745
|
try {
|
|
633274
633746
|
process.kill(pid, 0);
|
|
@@ -633280,7 +633752,7 @@ async function isPersonaPlexRunning() {
|
|
|
633280
633752
|
async function getPersonaPlexWSUrl() {
|
|
633281
633753
|
if (!await isPersonaPlexRunning()) return null;
|
|
633282
633754
|
if (!existsSync126(PORT_FILE)) return null;
|
|
633283
|
-
const port = parseInt(
|
|
633755
|
+
const port = parseInt(readFileSync105(PORT_FILE, "utf8").trim(), 10);
|
|
633284
633756
|
return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
|
|
633285
633757
|
}
|
|
633286
633758
|
function isPersonaPlexInstalled() {
|
|
@@ -633290,7 +633762,7 @@ async function getWeightTier() {
|
|
|
633290
633762
|
const detected = await detectPersonaPlexCapability();
|
|
633291
633763
|
const tierFile = join140(PERSONAPLEX_DIR, "weight_tier");
|
|
633292
633764
|
if (existsSync126(tierFile)) {
|
|
633293
|
-
const saved =
|
|
633765
|
+
const saved = readFileSync105(tierFile, "utf8").trim();
|
|
633294
633766
|
if (saved in WEIGHT_REPOS) {
|
|
633295
633767
|
const vram = detected.vramGB;
|
|
633296
633768
|
if (saved === "nf4-distilled" && vram < 24) {
|
|
@@ -633420,7 +633892,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
633420
633892
|
})).trim();
|
|
633421
633893
|
const serverFile = join140(sitePackages, "server.py");
|
|
633422
633894
|
if (existsSync126(serverFile)) {
|
|
633423
|
-
let src2 =
|
|
633895
|
+
let src2 = readFileSync105(serverFile, "utf8");
|
|
633424
633896
|
if (src2.includes('int(request["seed"])')) {
|
|
633425
633897
|
src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
|
|
633426
633898
|
writeFileSync65(serverFile, src2);
|
|
@@ -633436,7 +633908,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
633436
633908
|
})).trim();
|
|
633437
633909
|
const loadersFile = join140(sitePackages, "models", "loaders.py");
|
|
633438
633910
|
if (existsSync126(loadersFile)) {
|
|
633439
|
-
let src2 =
|
|
633911
|
+
let src2 = readFileSync105(loadersFile, "utf8");
|
|
633440
633912
|
if (!src2.includes("_dequantize_2bit_state_dict")) {
|
|
633441
633913
|
const dequantPatch = `
|
|
633442
633914
|
import math
|
|
@@ -633539,28 +634011,28 @@ $2if filename.endswith(".safetensors"):`
|
|
|
633539
634011
|
})).trim();
|
|
633540
634012
|
const hybridDest = join140(sitePackages2, "hybrid_agent.py");
|
|
633541
634013
|
const serverDest = join140(sitePackages2, "server.py");
|
|
633542
|
-
if (!existsSync126(hybridDest) || !
|
|
634014
|
+
if (!existsSync126(hybridDest) || !readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
633543
634015
|
log22("Deploying hybrid_agent.py (Omnius API integration)...");
|
|
633544
634016
|
try {
|
|
633545
634017
|
await execAsync(
|
|
633546
634018
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
|
|
633547
634019
|
{ timeout: 3e4 }
|
|
633548
634020
|
);
|
|
633549
|
-
if (existsSync126(hybridDest) &&
|
|
634021
|
+
if (existsSync126(hybridDest) && readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
|
|
633550
634022
|
log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
|
|
633551
634023
|
}
|
|
633552
634024
|
} catch {
|
|
633553
634025
|
log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
|
|
633554
634026
|
}
|
|
633555
634027
|
}
|
|
633556
|
-
if (!
|
|
634028
|
+
if (!readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
|
|
633557
634029
|
log22("Deploying patched server.py (hybrid mode + API endpoints)...");
|
|
633558
634030
|
try {
|
|
633559
634031
|
await execAsync(
|
|
633560
634032
|
`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
|
|
633561
634033
|
{ timeout: 3e4 }
|
|
633562
634034
|
);
|
|
633563
|
-
if (
|
|
634035
|
+
if (readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
|
|
633564
634036
|
log22("server.py patched with hybrid intercept + REST APIs.");
|
|
633565
634037
|
}
|
|
633566
634038
|
} catch {
|
|
@@ -633750,7 +634222,7 @@ print('Converted')
|
|
|
633750
634222
|
let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
|
|
633751
634223
|
if (!ollamaModel) {
|
|
633752
634224
|
try {
|
|
633753
|
-
const omniusConfig = JSON.parse(
|
|
634225
|
+
const omniusConfig = JSON.parse(readFileSync105(join140(homedir45(), ".omnius", "config.json"), "utf8"));
|
|
633754
634226
|
if (omniusConfig.model) ollamaModel = omniusConfig.model;
|
|
633755
634227
|
} catch {
|
|
633756
634228
|
}
|
|
@@ -633845,7 +634317,7 @@ print('Converted')
|
|
|
633845
634317
|
}
|
|
633846
634318
|
async function stopPersonaPlex() {
|
|
633847
634319
|
if (!existsSync126(PID_FILE)) return;
|
|
633848
|
-
const pid = parseInt(
|
|
634320
|
+
const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
|
|
633849
634321
|
if (isNaN(pid) || pid <= 0) return;
|
|
633850
634322
|
try {
|
|
633851
634323
|
if (process.platform === "win32") {
|
|
@@ -634042,7 +634514,7 @@ function patchFrontendVoiceList(onInfo) {
|
|
|
634042
634514
|
for (const f2 of readdirSync42(distDir)) {
|
|
634043
634515
|
if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
|
|
634044
634516
|
const jsPath = join140(distDir, f2);
|
|
634045
|
-
let js =
|
|
634517
|
+
let js = readFileSync105(jsPath, "utf8");
|
|
634046
634518
|
const customVoices = [];
|
|
634047
634519
|
if (existsSync126(CUSTOM_VOICES_DIR)) {
|
|
634048
634520
|
for (const vf of readdirSync42(CUSTOM_VOICES_DIR)) {
|
|
@@ -634162,7 +634634,7 @@ __export(setup_exports, {
|
|
|
634162
634634
|
import * as readline from "node:readline";
|
|
634163
634635
|
import { spawn as spawn34, exec as exec5 } from "node:child_process";
|
|
634164
634636
|
import { promisify as promisify7 } from "node:util";
|
|
634165
|
-
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";
|
|
634166
634638
|
import { delimiter as pathDelimiter, join as join141 } from "node:path";
|
|
634167
634639
|
import { freemem as freemem8, homedir as homedir46, platform as platform6, totalmem as totalmem9 } from "node:os";
|
|
634168
634640
|
function wrapText2(value2, width) {
|
|
@@ -634218,14 +634690,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
|
|
|
634218
634690
|
}
|
|
634219
634691
|
try {
|
|
634220
634692
|
if (existsSync127("/sys/devices/soc0/family")) {
|
|
634221
|
-
const family =
|
|
634693
|
+
const family = readFileSync106("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
|
|
634222
634694
|
if (family.includes("tegra")) return true;
|
|
634223
634695
|
}
|
|
634224
634696
|
} catch {
|
|
634225
634697
|
}
|
|
634226
634698
|
try {
|
|
634227
634699
|
if (existsSync127("/proc/device-tree/model")) {
|
|
634228
|
-
const model =
|
|
634700
|
+
const model = readFileSync106("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
|
|
634229
634701
|
if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
|
|
634230
634702
|
return true;
|
|
634231
634703
|
}
|
|
@@ -636177,7 +636649,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
636177
636649
|
let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
|
|
636178
636650
|
try {
|
|
636179
636651
|
if (existsSync127(_visionMarkerFile)) {
|
|
636180
|
-
const _vm = JSON.parse(
|
|
636652
|
+
const _vm = JSON.parse(readFileSync106(_visionMarkerFile, "utf8"));
|
|
636181
636653
|
_visionPreviouslyInstalled = new Set(_vm.installed || []);
|
|
636182
636654
|
}
|
|
636183
636655
|
} catch {
|
|
@@ -637013,7 +637485,7 @@ function ensurePathInShellRc(binDir) {
|
|
|
637013
637485
|
const shell = process.env.SHELL ?? "";
|
|
637014
637486
|
const rcFile = shell.includes("zsh") ? join141(homedir46(), ".zshrc") : join141(homedir46(), ".bashrc");
|
|
637015
637487
|
try {
|
|
637016
|
-
const rcContent = existsSync127(rcFile) ?
|
|
637488
|
+
const rcContent = existsSync127(rcFile) ? readFileSync106(rcFile, "utf8") : "";
|
|
637017
637489
|
if (rcContent.includes(binDir)) return;
|
|
637018
637490
|
const exportLine = `
|
|
637019
637491
|
export PATH="${binDir}:$PATH" # Added by omnius for nvim
|
|
@@ -637786,7 +638258,7 @@ var init_platforms = __esm({
|
|
|
637786
638258
|
});
|
|
637787
638259
|
|
|
637788
638260
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
637789
|
-
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";
|
|
637790
638262
|
import { basename as basename27, extname as extname17, join as join142, relative as relative14, resolve as resolve59 } from "node:path";
|
|
637791
638263
|
function exploreWorkspace(root, options2 = {}) {
|
|
637792
638264
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
@@ -637885,7 +638357,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
|
637885
638357
|
""
|
|
637886
638358
|
].join("\n");
|
|
637887
638359
|
}
|
|
637888
|
-
const content =
|
|
638360
|
+
const content = readFileSync107(full, "utf8");
|
|
637889
638361
|
const rawLines = content.split(/\r?\n/);
|
|
637890
638362
|
const visible = rawLines.slice(0, maxLines);
|
|
637891
638363
|
const gutter = String(Math.min(rawLines.length, maxLines)).length;
|
|
@@ -638061,7 +638533,7 @@ var init_pricing = __esm({
|
|
|
638061
638533
|
});
|
|
638062
638534
|
|
|
638063
638535
|
// packages/cli/src/insights/engine.ts
|
|
638064
|
-
import { readdirSync as readdirSync44, readFileSync as
|
|
638536
|
+
import { readdirSync as readdirSync44, readFileSync as readFileSync108, existsSync as existsSync130 } from "node:fs";
|
|
638065
638537
|
import { join as join143 } from "node:path";
|
|
638066
638538
|
function formatDuration5(seconds) {
|
|
638067
638539
|
if (seconds < 60) return `${Math.round(seconds)}s`;
|
|
@@ -638136,7 +638608,7 @@ var init_engine = __esm({
|
|
|
638136
638608
|
return readdirSync44(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
|
|
638137
638609
|
try {
|
|
638138
638610
|
const data = JSON.parse(
|
|
638139
|
-
|
|
638611
|
+
readFileSync108(join143(this.historyDir, f2), "utf-8")
|
|
638140
638612
|
);
|
|
638141
638613
|
return data;
|
|
638142
638614
|
} catch {
|
|
@@ -638154,7 +638626,7 @@ var init_engine = __esm({
|
|
|
638154
638626
|
loadUsageStore() {
|
|
638155
638627
|
try {
|
|
638156
638628
|
if (existsSync130(this.usageFile)) {
|
|
638157
|
-
return JSON.parse(
|
|
638629
|
+
return JSON.parse(readFileSync108(this.usageFile, "utf-8"));
|
|
638158
638630
|
}
|
|
638159
638631
|
} catch {
|
|
638160
638632
|
}
|
|
@@ -640937,7 +641409,7 @@ var init_memory_menu = __esm({
|
|
|
640937
641409
|
});
|
|
640938
641410
|
|
|
640939
641411
|
// packages/cli/src/tui/audio-waveform.ts
|
|
640940
|
-
import { readFileSync as
|
|
641412
|
+
import { readFileSync as readFileSync109 } from "node:fs";
|
|
640941
641413
|
import { createRequire as createRequire6 } from "node:module";
|
|
640942
641414
|
function readAscii(buffer2, offset, length4) {
|
|
640943
641415
|
return buffer2.subarray(offset, offset + length4).toString("ascii");
|
|
@@ -641011,7 +641483,7 @@ function renderAudioWaveform(file, options2 = {}) {
|
|
|
641011
641483
|
} catch {
|
|
641012
641484
|
return null;
|
|
641013
641485
|
}
|
|
641014
|
-
const buffer2 =
|
|
641486
|
+
const buffer2 = readFileSync109(file);
|
|
641015
641487
|
const info = parseWav(buffer2);
|
|
641016
641488
|
if (!info) return null;
|
|
641017
641489
|
const frameCount = Math.floor(info.dataSize / info.frameSize);
|
|
@@ -641567,7 +642039,7 @@ __export(daemon_exports, {
|
|
|
641567
642039
|
stopDaemon: () => stopDaemon
|
|
641568
642040
|
});
|
|
641569
642041
|
import { spawn as spawn35 } from "node:child_process";
|
|
641570
|
-
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";
|
|
641571
642043
|
import { join as join146 } from "node:path";
|
|
641572
642044
|
import { homedir as homedir48 } from "node:os";
|
|
641573
642045
|
import { fileURLToPath as fileURLToPath20 } from "node:url";
|
|
@@ -641598,7 +642070,7 @@ function getLocalCliVersion() {
|
|
|
641598
642070
|
for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
|
|
641599
642071
|
const p2 = join146(here, rel);
|
|
641600
642072
|
if (existsSync134(p2)) {
|
|
641601
|
-
const v = JSON.parse(
|
|
642073
|
+
const v = JSON.parse(readFileSync110(p2, "utf8"))?.version;
|
|
641602
642074
|
if (v) return String(v);
|
|
641603
642075
|
}
|
|
641604
642076
|
}
|
|
@@ -641637,7 +642109,7 @@ async function restartDaemon(port) {
|
|
|
641637
642109
|
function getDaemonPid() {
|
|
641638
642110
|
if (!existsSync134(PID_FILE2)) return null;
|
|
641639
642111
|
try {
|
|
641640
|
-
const pid = parseInt(
|
|
642112
|
+
const pid = parseInt(readFileSync110(PID_FILE2, "utf8").trim(), 10);
|
|
641641
642113
|
if (!pid || pid <= 0) return null;
|
|
641642
642114
|
process.kill(pid, 0);
|
|
641643
642115
|
return pid;
|
|
@@ -641652,7 +642124,7 @@ function getDaemonPid() {
|
|
|
641652
642124
|
function looksLikeNodeEntrypoint(path12) {
|
|
641653
642125
|
if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
|
|
641654
642126
|
try {
|
|
641655
|
-
const firstBytes =
|
|
642127
|
+
const firstBytes = readFileSync110(path12, "utf8").slice(0, 200);
|
|
641656
642128
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
641657
642129
|
} catch {
|
|
641658
642130
|
return false;
|
|
@@ -642326,7 +642798,7 @@ var init_types5 = __esm({
|
|
|
642326
642798
|
|
|
642327
642799
|
// packages/cli/src/cron/store.ts
|
|
642328
642800
|
import {
|
|
642329
|
-
readFileSync as
|
|
642801
|
+
readFileSync as readFileSync111,
|
|
642330
642802
|
writeFileSync as writeFileSync68,
|
|
642331
642803
|
mkdirSync as mkdirSync80,
|
|
642332
642804
|
chmodSync as chmodSync4,
|
|
@@ -642513,7 +642985,7 @@ function loadJobs() {
|
|
|
642513
642985
|
const path12 = jobsFilePath();
|
|
642514
642986
|
if (!existsSync137(path12)) return [];
|
|
642515
642987
|
try {
|
|
642516
|
-
const data = JSON.parse(
|
|
642988
|
+
const data = JSON.parse(readFileSync111(path12, "utf-8"));
|
|
642517
642989
|
return data.jobs || [];
|
|
642518
642990
|
} catch {
|
|
642519
642991
|
return [];
|
|
@@ -642881,7 +643353,7 @@ import {
|
|
|
642881
643353
|
closeSync as closeSync5,
|
|
642882
643354
|
writeFileSync as writeFileSync69,
|
|
642883
643355
|
unlinkSync as unlinkSync28,
|
|
642884
|
-
readFileSync as
|
|
643356
|
+
readFileSync as readFileSync112
|
|
642885
643357
|
} from "node:fs";
|
|
642886
643358
|
import { join as join150 } from "node:path";
|
|
642887
643359
|
import { homedir as homedir50 } from "node:os";
|
|
@@ -642898,7 +643370,7 @@ function acquireTickLock() {
|
|
|
642898
643370
|
mkdirSync81(cronDir2(), { recursive: true });
|
|
642899
643371
|
try {
|
|
642900
643372
|
if (existsSync138(lockPath)) {
|
|
642901
|
-
const content =
|
|
643373
|
+
const content = readFileSync112(lockPath, "utf-8").trim();
|
|
642902
643374
|
if (content) {
|
|
642903
643375
|
const lock = JSON.parse(content);
|
|
642904
643376
|
const age = Date.now() - lock.acquiredAt;
|
|
@@ -643266,7 +643738,7 @@ __export(sponsor_wizard_exports, {
|
|
|
643266
643738
|
selectedModelsForEndpoint: () => selectedModelsForEndpoint,
|
|
643267
643739
|
showSponsorDashboard: () => showSponsorDashboard
|
|
643268
643740
|
});
|
|
643269
|
-
import { existsSync as existsSync139, readFileSync as
|
|
643741
|
+
import { existsSync as existsSync139, readFileSync as readFileSync113, writeFileSync as writeFileSync70, mkdirSync as mkdirSync82 } from "node:fs";
|
|
643270
643742
|
import { join as join151 } from "node:path";
|
|
643271
643743
|
function fmtTokens2(n2) {
|
|
643272
643744
|
if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
|
|
@@ -643287,7 +643759,7 @@ function loadSponsorConfig(projectDir2) {
|
|
|
643287
643759
|
const p2 = configPath(projectDir2);
|
|
643288
643760
|
if (!existsSync139(p2)) return null;
|
|
643289
643761
|
try {
|
|
643290
|
-
return JSON.parse(
|
|
643762
|
+
return JSON.parse(readFileSync113(p2, "utf8"));
|
|
643291
643763
|
} catch {
|
|
643292
643764
|
return null;
|
|
643293
643765
|
}
|
|
@@ -644634,7 +645106,7 @@ import {
|
|
|
644634
645106
|
existsSync as existsSync140,
|
|
644635
645107
|
mkdirSync as mkdirSync83,
|
|
644636
645108
|
writeFileSync as writeFileSync71,
|
|
644637
|
-
readFileSync as
|
|
645109
|
+
readFileSync as readFileSync114,
|
|
644638
645110
|
unlinkSync as unlinkSync29,
|
|
644639
645111
|
readdirSync as readdirSync46,
|
|
644640
645112
|
statSync as statSync52,
|
|
@@ -646135,7 +646607,7 @@ except Exception as exc:
|
|
|
646135
646607
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
646136
646608
|
const destPath = join152(refsDir, destFilename);
|
|
646137
646609
|
try {
|
|
646138
|
-
const data =
|
|
646610
|
+
const data = readFileSync114(audioPath);
|
|
646139
646611
|
writeFileSync71(destPath, data);
|
|
646140
646612
|
} catch (err) {
|
|
646141
646613
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -646210,7 +646682,7 @@ except Exception as exc:
|
|
|
646210
646682
|
const p2 = _VoiceEngine.cloneMetaFile();
|
|
646211
646683
|
if (!existsSync140(p2)) return {};
|
|
646212
646684
|
try {
|
|
646213
|
-
const raw = JSON.parse(
|
|
646685
|
+
const raw = JSON.parse(readFileSync114(p2, "utf8"));
|
|
646214
646686
|
if (typeof Object.values(raw)[0] === "string") {
|
|
646215
646687
|
const migrated = {};
|
|
646216
646688
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -647096,7 +647568,7 @@ except Exception as exc:
|
|
|
647096
647568
|
}
|
|
647097
647569
|
loadMisottsStore() {
|
|
647098
647570
|
try {
|
|
647099
|
-
const raw = JSON.parse(
|
|
647571
|
+
const raw = JSON.parse(readFileSync114(misottsProfilesFile(), "utf-8"));
|
|
647100
647572
|
const profiles = {};
|
|
647101
647573
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
647102
647574
|
profiles[name10] = normalizeMisottsSettings(settings);
|
|
@@ -647120,7 +647592,7 @@ except Exception as exc:
|
|
|
647120
647592
|
loadSupertonicStore() {
|
|
647121
647593
|
try {
|
|
647122
647594
|
const raw = JSON.parse(
|
|
647123
|
-
|
|
647595
|
+
readFileSync114(supertonicProfilesFile(), "utf-8")
|
|
647124
647596
|
);
|
|
647125
647597
|
const profiles = {};
|
|
647126
647598
|
for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
|
|
@@ -647287,7 +647759,7 @@ except Exception as exc:
|
|
|
647287
647759
|
const wavPath = await this.synthesizeSupertonicWav(text2, 1);
|
|
647288
647760
|
if (!wavPath) return null;
|
|
647289
647761
|
try {
|
|
647290
|
-
const data =
|
|
647762
|
+
const data = readFileSync114(wavPath);
|
|
647291
647763
|
unlinkSync29(wavPath);
|
|
647292
647764
|
return data;
|
|
647293
647765
|
} catch {
|
|
@@ -647435,7 +647907,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647435
647907
|
if (!existsSync140(wavPath)) return;
|
|
647436
647908
|
if (volume !== 1) {
|
|
647437
647909
|
try {
|
|
647438
|
-
const wavData =
|
|
647910
|
+
const wavData = readFileSync114(wavPath);
|
|
647439
647911
|
if (wavData.length > 44) {
|
|
647440
647912
|
const header = wavData.subarray(0, 44);
|
|
647441
647913
|
const samples = new Int16Array(
|
|
@@ -647457,7 +647929,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647457
647929
|
}
|
|
647458
647930
|
if (this.onPCMOutput) {
|
|
647459
647931
|
try {
|
|
647460
|
-
const wavData =
|
|
647932
|
+
const wavData = readFileSync114(wavPath);
|
|
647461
647933
|
if (wavData.length > 44) {
|
|
647462
647934
|
const pcm = Buffer.from(
|
|
647463
647935
|
wavData.buffer,
|
|
@@ -647515,7 +647987,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647515
647987
|
}
|
|
647516
647988
|
if (!existsSync140(wavPath)) return null;
|
|
647517
647989
|
try {
|
|
647518
|
-
const data =
|
|
647990
|
+
const data = readFileSync114(wavPath);
|
|
647519
647991
|
unlinkSync29(wavPath);
|
|
647520
647992
|
return data;
|
|
647521
647993
|
} catch {
|
|
@@ -647769,7 +648241,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
647769
648241
|
...isJetson ? (() => {
|
|
647770
648242
|
let jpVer = "v60";
|
|
647771
648243
|
try {
|
|
647772
|
-
const tegra = existsSync140("/etc/nv_tegra_release") ?
|
|
648244
|
+
const tegra = existsSync140("/etc/nv_tegra_release") ? readFileSync114("/etc/nv_tegra_release", "utf8").trim() : "";
|
|
647773
648245
|
const ver = process.env.JETSON_L4T_VERSION || "";
|
|
647774
648246
|
if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
|
|
647775
648247
|
jpVer = "v51";
|
|
@@ -648379,7 +648851,7 @@ if __name__ == '__main__':
|
|
|
648379
648851
|
async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
648380
648852
|
if (!existsSync140(wavPath)) return;
|
|
648381
648853
|
try {
|
|
648382
|
-
const wavData =
|
|
648854
|
+
const wavData = readFileSync114(wavPath);
|
|
648383
648855
|
if (wavData.length > 44) {
|
|
648384
648856
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648385
648857
|
const samples = new Int16Array(
|
|
@@ -648410,7 +648882,7 @@ if __name__ == '__main__':
|
|
|
648410
648882
|
}
|
|
648411
648883
|
if (pitchFactor !== 1) {
|
|
648412
648884
|
try {
|
|
648413
|
-
const wavData =
|
|
648885
|
+
const wavData = readFileSync114(wavPath);
|
|
648414
648886
|
if (wavData.length > 44) {
|
|
648415
648887
|
const int16 = new Int16Array(
|
|
648416
648888
|
wavData.buffer,
|
|
@@ -648429,7 +648901,7 @@ if __name__ == '__main__':
|
|
|
648429
648901
|
}
|
|
648430
648902
|
if (this.onPCMOutput) {
|
|
648431
648903
|
try {
|
|
648432
|
-
const wavData =
|
|
648904
|
+
const wavData = readFileSync114(wavPath);
|
|
648433
648905
|
if (wavData.length > 44) {
|
|
648434
648906
|
const pcm = Buffer.from(
|
|
648435
648907
|
wavData.buffer,
|
|
@@ -648444,7 +648916,7 @@ if __name__ == '__main__':
|
|
|
648444
648916
|
}
|
|
648445
648917
|
if (stereoDelayMs > 0) {
|
|
648446
648918
|
try {
|
|
648447
|
-
const wavData =
|
|
648919
|
+
const wavData = readFileSync114(wavPath);
|
|
648448
648920
|
if (wavData.length > 44) {
|
|
648449
648921
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648450
648922
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -648511,7 +648983,7 @@ if __name__ == '__main__':
|
|
|
648511
648983
|
}
|
|
648512
648984
|
if (!existsSync140(wavPath)) return null;
|
|
648513
648985
|
try {
|
|
648514
|
-
const data =
|
|
648986
|
+
const data = readFileSync114(wavPath);
|
|
648515
648987
|
unlinkSync29(wavPath);
|
|
648516
648988
|
return data;
|
|
648517
648989
|
} catch {
|
|
@@ -648746,7 +649218,7 @@ if __name__ == "__main__":
|
|
|
648746
649218
|
async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
648747
649219
|
if (!existsSync140(wavPath)) return;
|
|
648748
649220
|
try {
|
|
648749
|
-
const wavData =
|
|
649221
|
+
const wavData = readFileSync114(wavPath);
|
|
648750
649222
|
if (wavData.length > 44) {
|
|
648751
649223
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648752
649224
|
const samples = new Int16Array(
|
|
@@ -648777,7 +649249,7 @@ if __name__ == "__main__":
|
|
|
648777
649249
|
}
|
|
648778
649250
|
if (pitchFactor !== 1) {
|
|
648779
649251
|
try {
|
|
648780
|
-
const wavData =
|
|
649252
|
+
const wavData = readFileSync114(wavPath);
|
|
648781
649253
|
if (wavData.length > 44) {
|
|
648782
649254
|
const int16 = new Int16Array(
|
|
648783
649255
|
wavData.buffer,
|
|
@@ -648796,7 +649268,7 @@ if __name__ == "__main__":
|
|
|
648796
649268
|
}
|
|
648797
649269
|
if (this.onPCMOutput) {
|
|
648798
649270
|
try {
|
|
648799
|
-
const wavData =
|
|
649271
|
+
const wavData = readFileSync114(wavPath);
|
|
648800
649272
|
if (wavData.length > 44) {
|
|
648801
649273
|
const pcm = Buffer.from(
|
|
648802
649274
|
wavData.buffer,
|
|
@@ -648811,7 +649283,7 @@ if __name__ == "__main__":
|
|
|
648811
649283
|
}
|
|
648812
649284
|
if (stereoDelayMs > 0) {
|
|
648813
649285
|
try {
|
|
648814
|
-
const wavData =
|
|
649286
|
+
const wavData = readFileSync114(wavPath);
|
|
648815
649287
|
if (wavData.length > 44) {
|
|
648816
649288
|
const sampleRate = wavData.readUInt32LE(24);
|
|
648817
649289
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -648887,7 +649359,7 @@ if __name__ == "__main__":
|
|
|
648887
649359
|
}
|
|
648888
649360
|
if (!existsSync140(wavPath)) return null;
|
|
648889
649361
|
try {
|
|
648890
|
-
const data =
|
|
649362
|
+
const data = readFileSync114(wavPath);
|
|
648891
649363
|
unlinkSync29(wavPath);
|
|
648892
649364
|
return data;
|
|
648893
649365
|
} catch {
|
|
@@ -648908,7 +649380,7 @@ if __name__ == "__main__":
|
|
|
648908
649380
|
};
|
|
648909
649381
|
if (existsSync140(pkgPath)) {
|
|
648910
649382
|
try {
|
|
648911
|
-
const existing = JSON.parse(
|
|
649383
|
+
const existing = JSON.parse(readFileSync114(pkgPath, "utf8"));
|
|
648912
649384
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
648913
649385
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
648914
649386
|
writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -649068,7 +649540,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
|
|
|
649068
649540
|
if (!existsSync140(onnxPath) || !existsSync140(configPath2)) {
|
|
649069
649541
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
649070
649542
|
}
|
|
649071
|
-
this.config = JSON.parse(
|
|
649543
|
+
this.config = JSON.parse(readFileSync114(configPath2, "utf8"));
|
|
649072
649544
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
649073
649545
|
executionProviders: ["cpu"],
|
|
649074
649546
|
graphOptimizationLevel: "all"
|
|
@@ -649228,7 +649700,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
|
|
|
649228
649700
|
import { createHash as createHash38 } from "node:crypto";
|
|
649229
649701
|
import {
|
|
649230
649702
|
existsSync as existsSync141,
|
|
649231
|
-
readFileSync as
|
|
649703
|
+
readFileSync as readFileSync115,
|
|
649232
649704
|
writeFileSync as writeFileSync72,
|
|
649233
649705
|
mkdirSync as mkdirSync84,
|
|
649234
649706
|
readdirSync as readdirSync47,
|
|
@@ -649665,6 +650137,9 @@ async function ensureVoiceDeps(ctx3) {
|
|
|
649665
650137
|
const res = mod3.ensureEmbedDeps();
|
|
649666
650138
|
if (res?.log)
|
|
649667
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
|
+
}
|
|
649668
650143
|
}
|
|
649669
650144
|
if (typeof mod3.getVenvPython === "function") {
|
|
649670
650145
|
const { dirname: dirname56 } = await import("node:path");
|
|
@@ -650549,10 +651024,10 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
650549
651024
|
if (!key) {
|
|
650550
651025
|
try {
|
|
650551
651026
|
const { homedir: homedir66 } = await import("node:os");
|
|
650552
|
-
const { readFileSync:
|
|
651027
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
650553
651028
|
const { join: join188 } = await import("node:path");
|
|
650554
651029
|
const p2 = join188(homedir66(), ".omnius", "api.key");
|
|
650555
|
-
if (existsSync173(p2)) key =
|
|
651030
|
+
if (existsSync173(p2)) key = readFileSync142(p2, "utf8").trim();
|
|
650556
651031
|
} catch {
|
|
650557
651032
|
}
|
|
650558
651033
|
}
|
|
@@ -651456,7 +651931,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
651456
651931
|
try {
|
|
651457
651932
|
const pidFile = join153(nexus.getNexusDir(), "daemon.pid");
|
|
651458
651933
|
if (existsSync141(pidFile)) {
|
|
651459
|
-
const pid = parseInt(
|
|
651934
|
+
const pid = parseInt(readFileSync115(pidFile, "utf8").trim(), 10);
|
|
651460
651935
|
if (pid > 0 && !registry2.daemons.has("Nexus")) {
|
|
651461
651936
|
registry2.register({
|
|
651462
651937
|
name: "Nexus",
|
|
@@ -651879,7 +652354,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
651879
652354
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
651880
652355
|
return "handled";
|
|
651881
652356
|
}
|
|
651882
|
-
content =
|
|
652357
|
+
content = readFileSync115(toolFile, "utf8");
|
|
651883
652358
|
metadata = { type: "tool", name: shareName };
|
|
651884
652359
|
} else if (shareType === "skill") {
|
|
651885
652360
|
const skillDir = join153(ctx3.repoRoot, ".omnius", "skills", shareName);
|
|
@@ -651888,7 +652363,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
651888
652363
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
651889
652364
|
return "handled";
|
|
651890
652365
|
}
|
|
651891
|
-
content =
|
|
652366
|
+
content = readFileSync115(skillFile, "utf8");
|
|
651892
652367
|
metadata = { type: "skill", name: shareName };
|
|
651893
652368
|
} else {
|
|
651894
652369
|
renderWarning(
|
|
@@ -651961,7 +652436,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
651961
652436
|
"learning-cids.json"
|
|
651962
652437
|
);
|
|
651963
652438
|
if (existsSync141(regFile)) {
|
|
651964
|
-
const reg2 = JSON.parse(
|
|
652439
|
+
const reg2 = JSON.parse(readFileSync115(regFile, "utf8"));
|
|
651965
652440
|
const pinned = Object.values(reg2).some(
|
|
651966
652441
|
(e2) => e2.cid === importCid && e2.pinned
|
|
651967
652442
|
);
|
|
@@ -652079,7 +652554,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652079
652554
|
).getNexusDir();
|
|
652080
652555
|
const statusFile = join153(nexusDir, "status.json");
|
|
652081
652556
|
if (existsSync141(statusFile)) {
|
|
652082
|
-
const status = JSON.parse(
|
|
652557
|
+
const status = JSON.parse(readFileSync115(statusFile, "utf8"));
|
|
652083
652558
|
if (status.peerId) {
|
|
652084
652559
|
lines.push(`
|
|
652085
652560
|
${c3.bold("Peer Info")}`);
|
|
@@ -652104,7 +652579,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652104
652579
|
try {
|
|
652105
652580
|
const stateFile = join153(idDir, "self-state.json");
|
|
652106
652581
|
if (existsSync141(stateFile)) {
|
|
652107
|
-
const state = JSON.parse(
|
|
652582
|
+
const state = JSON.parse(readFileSync115(stateFile, "utf8"));
|
|
652108
652583
|
lines.push(
|
|
652109
652584
|
` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
|
|
652110
652585
|
);
|
|
@@ -652119,7 +652594,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652119
652594
|
}
|
|
652120
652595
|
const cidFile = join153(idDir, "cids.json");
|
|
652121
652596
|
if (existsSync141(cidFile)) {
|
|
652122
|
-
const cids = JSON.parse(
|
|
652597
|
+
const cids = JSON.parse(readFileSync115(cidFile, "utf8"));
|
|
652123
652598
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
652124
652599
|
if (lastCid)
|
|
652125
652600
|
lines.push(
|
|
@@ -652144,7 +652619,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652144
652619
|
"store.json"
|
|
652145
652620
|
);
|
|
652146
652621
|
if (existsSync141(metaFile2)) {
|
|
652147
|
-
const store2 = JSON.parse(
|
|
652622
|
+
const store2 = JSON.parse(readFileSync115(metaFile2, "utf8"));
|
|
652148
652623
|
const active = store2.filter((m2) => m2.type !== "quarantine");
|
|
652149
652624
|
const recoveries = active.filter(
|
|
652150
652625
|
(m2) => m2.content?.startsWith("[recovery]")
|
|
@@ -652382,7 +652857,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652382
652857
|
return "handled";
|
|
652383
652858
|
}
|
|
652384
652859
|
} else {
|
|
652385
|
-
content =
|
|
652860
|
+
content = readFileSync115(resolvedPath, "utf8");
|
|
652386
652861
|
}
|
|
652387
652862
|
if (!content.trim()) {
|
|
652388
652863
|
renderWarning("No content extracted.");
|
|
@@ -652490,7 +652965,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652490
652965
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
652491
652966
|
return "handled";
|
|
652492
652967
|
}
|
|
652493
|
-
const bridge = JSON.parse(
|
|
652968
|
+
const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
|
|
652494
652969
|
let alive = false;
|
|
652495
652970
|
try {
|
|
652496
652971
|
process.kill(bridge.pid, 0);
|
|
@@ -652526,7 +653001,7 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
652526
653001
|
if (fortemiSubCmd === "stop") {
|
|
652527
653002
|
const bridgeFile = join153(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
|
|
652528
653003
|
if (existsSync141(bridgeFile)) {
|
|
652529
|
-
const bridge = JSON.parse(
|
|
653004
|
+
const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
|
|
652530
653005
|
try {
|
|
652531
653006
|
process.kill(bridge.pid, "SIGTERM");
|
|
652532
653007
|
} catch {
|
|
@@ -654562,7 +655037,7 @@ sleep 1
|
|
|
654562
655037
|
`daemon.pid exists: ${existsSync141(join153(checkedNexusDir, "daemon.pid"))}`
|
|
654563
655038
|
);
|
|
654564
655039
|
try {
|
|
654565
|
-
const _statusRaw =
|
|
655040
|
+
const _statusRaw = readFileSync115(
|
|
654566
655041
|
join153(checkedNexusDir, "status.json"),
|
|
654567
655042
|
"utf8"
|
|
654568
655043
|
);
|
|
@@ -654571,7 +655046,7 @@ sleep 1
|
|
|
654571
655046
|
_spLog(`status.json read error: ${e2}`);
|
|
654572
655047
|
}
|
|
654573
655048
|
try {
|
|
654574
|
-
const _errRaw =
|
|
655049
|
+
const _errRaw = readFileSync115(
|
|
654575
655050
|
join153(checkedNexusDir, "daemon.err"),
|
|
654576
655051
|
"utf8"
|
|
654577
655052
|
);
|
|
@@ -654606,7 +655081,7 @@ sleep 1
|
|
|
654606
655081
|
"agent-name"
|
|
654607
655082
|
);
|
|
654608
655083
|
if (existsSync141(namePath))
|
|
654609
|
-
sponsorName =
|
|
655084
|
+
sponsorName = readFileSync115(namePath, "utf8").trim();
|
|
654610
655085
|
} catch {
|
|
654611
655086
|
}
|
|
654612
655087
|
if (!sponsorName) sponsorName = "Omnius Sponsor";
|
|
@@ -654710,7 +655185,7 @@ sleep 1
|
|
|
654710
655185
|
);
|
|
654711
655186
|
if (existsSync141(nexusPidFile)) {
|
|
654712
655187
|
const nPid = parseInt(
|
|
654713
|
-
|
|
655188
|
+
readFileSync115(nexusPidFile, "utf8").trim(),
|
|
654714
655189
|
10
|
|
654715
655190
|
);
|
|
654716
655191
|
if (nPid > 0) {
|
|
@@ -656009,7 +656484,7 @@ sleep 1
|
|
|
656009
656484
|
if (existsSync141(projectSettingsPath)) {
|
|
656010
656485
|
try {
|
|
656011
656486
|
const projectJson = JSON.parse(
|
|
656012
|
-
|
|
656487
|
+
readFileSync115(projectSettingsPath, "utf8")
|
|
656013
656488
|
);
|
|
656014
656489
|
projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
|
|
656015
656490
|
} catch {
|
|
@@ -659689,6 +660164,19 @@ function attachLiveSinks(ctx3, manager, agentEnabled = false, speechEnabledOverr
|
|
|
659689
660164
|
manager.setAgentActionSink(void 0);
|
|
659690
660165
|
}
|
|
659691
660166
|
}
|
|
660167
|
+
async function ensureLiveStreamingAsr(ctx3, manager, force = false) {
|
|
660168
|
+
if (!force && !manager.getConfig().asrEnabled) return;
|
|
660169
|
+
if (!ctx3.listenStart) return;
|
|
660170
|
+
ctx3.listenSetMode?.("auto");
|
|
660171
|
+
const msg = await ctx3.listenStart("live");
|
|
660172
|
+
if (!/already active/i.test(msg)) renderInfo(`Live ASR: ${msg}`);
|
|
660173
|
+
}
|
|
660174
|
+
async function releaseLiveStreamingAsr(ctx3) {
|
|
660175
|
+
try {
|
|
660176
|
+
await ctx3.listenRelease?.("live");
|
|
660177
|
+
} catch {
|
|
660178
|
+
}
|
|
660179
|
+
}
|
|
659692
660180
|
async function startLiveVoicechat(ctx3, manager) {
|
|
659693
660181
|
const speechEnabled = Boolean(ctx3.voiceSpeak);
|
|
659694
660182
|
attachLiveSinks(ctx3, manager, false, speechEnabled);
|
|
@@ -659920,6 +660408,7 @@ async function handleLiveCommand(ctx3, arg) {
|
|
|
659920
660408
|
if (sub2 === "stop" || sub2 === "off" || sub2 === "disable") {
|
|
659921
660409
|
manager.stopAll();
|
|
659922
660410
|
manager.setAgentActionSink(void 0);
|
|
660411
|
+
await releaseLiveStreamingAsr(ctx3);
|
|
659923
660412
|
if (ctx3.isVoiceChatActive?.()) {
|
|
659924
660413
|
try {
|
|
659925
660414
|
await ctx3.voiceChatStop?.();
|
|
@@ -659937,6 +660426,7 @@ async function handleLiveCommand(ctx3, arg) {
|
|
|
659937
660426
|
renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
|
|
659938
660427
|
}
|
|
659939
660428
|
await ensureLiveInventory(manager);
|
|
660429
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
659940
660430
|
renderInfo(manager.startRunMode({ agent: effectiveAgent, lowLatency: true, speech: effectiveAgent && Boolean(ctx3.voiceSpeak) }));
|
|
659941
660431
|
return;
|
|
659942
660432
|
}
|
|
@@ -660037,10 +660527,13 @@ async function handleLiveCommand(ctx3, arg) {
|
|
|
660037
660527
|
}
|
|
660038
660528
|
if (sub2 === "asr") {
|
|
660039
660529
|
const cfg = manager.getConfig();
|
|
660530
|
+
const enabled2 = setBool(value2, !cfg.asrEnabled);
|
|
660040
660531
|
manager.configure({
|
|
660041
660532
|
audioEnabled: true,
|
|
660042
|
-
asrEnabled:
|
|
660533
|
+
asrEnabled: enabled2
|
|
660043
660534
|
});
|
|
660535
|
+
if (enabled2) await ensureLiveStreamingAsr(ctx3, manager);
|
|
660536
|
+
else await releaseLiveStreamingAsr(ctx3);
|
|
660044
660537
|
renderInfo(formatLiveStatus(manager.getSnapshot()));
|
|
660045
660538
|
return;
|
|
660046
660539
|
}
|
|
@@ -660328,6 +660821,7 @@ async function handleCameraCommand(ctx3, arg) {
|
|
|
660328
660821
|
async function showLiveMenu(ctx3, manager) {
|
|
660329
660822
|
await ensureLiveInventory(manager);
|
|
660330
660823
|
while (true) {
|
|
660824
|
+
await refreshLiveResourceModelSnapshot().catch(() => void 0);
|
|
660331
660825
|
const snapshot = manager.getSnapshot();
|
|
660332
660826
|
const cfg = manager.getConfig();
|
|
660333
660827
|
const devices = snapshot.devices;
|
|
@@ -660339,6 +660833,15 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
660339
660833
|
` video ${liveEnabled(cfg.videoEnabled)} · infer ${liveEnabled(cfg.inferEnabled)} · clip ${liveEnabled(cfg.clipEnabled)} · audio ${liveEnabled(cfg.audioEnabled)} · asr ${liveEnabled(cfg.asrEnabled)} · sounds ${liveEnabled(cfg.audioAnalysisEnabled)}`
|
|
660340
660834
|
)
|
|
660341
660835
|
},
|
|
660836
|
+
{
|
|
660837
|
+
key: "info:resources",
|
|
660838
|
+
label: selectColors.dim(` ${formatLiveMenuResourceSummary()}`)
|
|
660839
|
+
},
|
|
660840
|
+
{
|
|
660841
|
+
key: "resources",
|
|
660842
|
+
label: "Show Resource + Model State",
|
|
660843
|
+
detail: "RAM/VRAM by subsystem, CUDA per loaded model, active slots, inflight loads"
|
|
660844
|
+
},
|
|
660342
660845
|
{
|
|
660343
660846
|
key: "run-live",
|
|
660344
660847
|
label: "Start Live Run",
|
|
@@ -660475,6 +660978,7 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
660475
660978
|
continue;
|
|
660476
660979
|
case "run-live":
|
|
660477
660980
|
attachLiveSinks(ctx3, manager, false);
|
|
660981
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
660478
660982
|
renderInfo(manager.startRunMode({ agent: false, lowLatency: true, speech: false }));
|
|
660479
660983
|
continue;
|
|
660480
660984
|
case "run-agent":
|
|
@@ -660482,6 +660986,7 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
660482
660986
|
if (!ctx3.startBackgroundPrompt) {
|
|
660483
660987
|
renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
|
|
660484
660988
|
}
|
|
660989
|
+
await ensureLiveStreamingAsr(ctx3, manager, true);
|
|
660485
660990
|
renderInfo(manager.startRunMode({ agent: Boolean(ctx3.startBackgroundPrompt), lowLatency: true, speech: Boolean(ctx3.startBackgroundPrompt && ctx3.voiceSpeak) }));
|
|
660486
660991
|
continue;
|
|
660487
660992
|
case "run-chat":
|
|
@@ -660501,6 +661006,8 @@ async function showLiveMenu(ctx3, manager) {
|
|
|
660501
661006
|
continue;
|
|
660502
661007
|
case "toggle-asr":
|
|
660503
661008
|
manager.configure({ audioEnabled: true, asrEnabled: !cfg.asrEnabled });
|
|
661009
|
+
if (!cfg.asrEnabled) await ensureLiveStreamingAsr(ctx3, manager);
|
|
661010
|
+
else await releaseLiveStreamingAsr(ctx3);
|
|
660504
661011
|
continue;
|
|
660505
661012
|
case "toggle-sounds":
|
|
660506
661013
|
manager.configure({ audioEnabled: true, audioAnalysisEnabled: !cfg.audioAnalysisEnabled });
|
|
@@ -660561,6 +661068,10 @@ Previewing microphone activity...`);
|
|
|
660561
661068
|
renderWarning("Live transcript UI is unavailable in this context.");
|
|
660562
661069
|
}
|
|
660563
661070
|
continue;
|
|
661071
|
+
case "resources":
|
|
661072
|
+
await refreshLiveResourceModelSnapshot(0).catch(() => void 0);
|
|
661073
|
+
renderInfo(formatLiveResourceModelReport(110));
|
|
661074
|
+
continue;
|
|
660564
661075
|
case "refresh":
|
|
660565
661076
|
renderInfo(formatLiveInventory(await manager.refreshDevices()));
|
|
660566
661077
|
continue;
|
|
@@ -660570,6 +661081,7 @@ Previewing microphone activity...`);
|
|
|
660570
661081
|
case "stop":
|
|
660571
661082
|
manager.stopAll();
|
|
660572
661083
|
manager.setAgentActionSink(void 0);
|
|
661084
|
+
await releaseLiveStreamingAsr(ctx3);
|
|
660573
661085
|
if (ctx3.isVoiceChatActive?.()) {
|
|
660574
661086
|
try {
|
|
660575
661087
|
await ctx3.voiceChatStop?.();
|
|
@@ -662205,7 +662717,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
|
|
|
662205
662717
|
"known-sponsors.json"
|
|
662206
662718
|
);
|
|
662207
662719
|
if (existsSync141(knownFile)) {
|
|
662208
|
-
const saved = JSON.parse(
|
|
662720
|
+
const saved = JSON.parse(readFileSync115(knownFile, "utf8"));
|
|
662209
662721
|
if (Array.isArray(saved)) rawSponsors.push(...saved);
|
|
662210
662722
|
}
|
|
662211
662723
|
} catch {
|
|
@@ -662355,7 +662867,7 @@ async function collectSponsorMediaStream(args) {
|
|
|
662355
662867
|
while (!done && Date.now() < deadline) {
|
|
662356
662868
|
await new Promise((resolve76) => setTimeout(resolve76, 250));
|
|
662357
662869
|
if (!existsSync141(args.streamFile)) continue;
|
|
662358
|
-
const raw =
|
|
662870
|
+
const raw = readFileSync115(args.streamFile, "utf8");
|
|
662359
662871
|
if (raw.length <= offset) continue;
|
|
662360
662872
|
pending2 += raw.slice(offset);
|
|
662361
662873
|
offset = raw.length;
|
|
@@ -662679,7 +663191,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
662679
663191
|
try {
|
|
662680
663192
|
if (existsSync141(knownFile)) {
|
|
662681
663193
|
const saved = JSON.parse(
|
|
662682
|
-
|
|
663194
|
+
readFileSync115(knownFile, "utf8")
|
|
662683
663195
|
);
|
|
662684
663196
|
for (const s2 of saved) {
|
|
662685
663197
|
if (!sponsors.some((sp) => sp.url === s2.url)) {
|
|
@@ -662855,7 +663367,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
662855
663367
|
const saveKey = selected.url || selected.peerId || selected.name;
|
|
662856
663368
|
try {
|
|
662857
663369
|
mkdirSync84(sponsorDir2, { recursive: true });
|
|
662858
|
-
const existing = existsSync141(knownFile) ? JSON.parse(
|
|
663370
|
+
const existing = existsSync141(knownFile) ? JSON.parse(readFileSync115(knownFile, "utf8")) : [];
|
|
662859
663371
|
const updated = existing.filter(
|
|
662860
663372
|
(s2) => (s2.url || s2.peerId || s2.name) !== saveKey
|
|
662861
663373
|
);
|
|
@@ -665644,6 +666156,7 @@ var init_commands = __esm({
|
|
|
665644
666156
|
init_generative_progress();
|
|
665645
666157
|
init_cad_model_viewer();
|
|
665646
666158
|
init_live_sensors();
|
|
666159
|
+
init_live_resource_arbiter();
|
|
665647
666160
|
init_command_registry();
|
|
665648
666161
|
init_hf_token_prompt();
|
|
665649
666162
|
init_dist5();
|
|
@@ -665961,7 +666474,7 @@ var init_commands = __esm({
|
|
|
665961
666474
|
});
|
|
665962
666475
|
|
|
665963
666476
|
// packages/cli/src/tui/project-context.ts
|
|
665964
|
-
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";
|
|
665965
666478
|
import { dirname as dirname47, join as join154, basename as basename29, resolve as resolve62 } from "node:path";
|
|
665966
666479
|
import { homedir as homedir53 } from "node:os";
|
|
665967
666480
|
function projectContextUrlSpanAt(text2, index) {
|
|
@@ -666012,7 +666525,7 @@ function loadProjectMap(repoRoot) {
|
|
|
666012
666525
|
const mapPath2 = join154(repoRoot, OMNIUS_DIR, "context", "project-map.md");
|
|
666013
666526
|
if (existsSync142(mapPath2)) {
|
|
666014
666527
|
try {
|
|
666015
|
-
const content =
|
|
666528
|
+
const content = readFileSync116(mapPath2, "utf-8");
|
|
666016
666529
|
return content;
|
|
666017
666530
|
} catch {
|
|
666018
666531
|
}
|
|
@@ -666025,7 +666538,7 @@ function findGitDir(repoRoot) {
|
|
|
666025
666538
|
const gitPath = join154(dir, ".git");
|
|
666026
666539
|
if (existsSync142(gitPath)) {
|
|
666027
666540
|
try {
|
|
666028
|
-
const raw =
|
|
666541
|
+
const raw = readFileSync116(gitPath, "utf8").trim();
|
|
666029
666542
|
const match = raw.match(/^gitdir:\s*(.+)$/i);
|
|
666030
666543
|
if (match?.[1]) {
|
|
666031
666544
|
return resolve62(dir, match[1]);
|
|
@@ -666045,12 +666558,12 @@ function getGitInfo(repoRoot) {
|
|
|
666045
666558
|
if (!gitDir) return "";
|
|
666046
666559
|
const lines = [];
|
|
666047
666560
|
try {
|
|
666048
|
-
const head =
|
|
666561
|
+
const head = readFileSync116(join154(gitDir, "HEAD"), "utf-8").trim();
|
|
666049
666562
|
const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
666050
666563
|
if (refMatch?.[1]) {
|
|
666051
666564
|
lines.push(`Branch: ${refMatch[1]}`);
|
|
666052
666565
|
try {
|
|
666053
|
-
const refHash =
|
|
666566
|
+
const refHash = readFileSync116(join154(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
|
|
666054
666567
|
if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
|
|
666055
666568
|
} catch {
|
|
666056
666569
|
}
|
|
@@ -666078,7 +666591,7 @@ function countJsonMemoryEntries(dir) {
|
|
|
666078
666591
|
if (!file.endsWith(".json")) continue;
|
|
666079
666592
|
topics++;
|
|
666080
666593
|
try {
|
|
666081
|
-
const parsed = JSON.parse(
|
|
666594
|
+
const parsed = JSON.parse(readFileSync116(join154(dir, file), "utf8"));
|
|
666082
666595
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
666083
666596
|
entries += Object.keys(parsed).length;
|
|
666084
666597
|
}
|
|
@@ -666094,7 +666607,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
666094
666607
|
const path12 = join154(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
|
|
666095
666608
|
if (!existsSync142(path12)) return 0;
|
|
666096
666609
|
try {
|
|
666097
|
-
const parsed = JSON.parse(
|
|
666610
|
+
const parsed = JSON.parse(readFileSync116(path12, "utf8"));
|
|
666098
666611
|
return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
|
|
666099
666612
|
} catch {
|
|
666100
666613
|
return 0;
|
|
@@ -666103,7 +666616,7 @@ function countReflectionBuffer(repoRoot) {
|
|
|
666103
666616
|
function countJsonlLines(path12, maxBytes = 1e6) {
|
|
666104
666617
|
if (!existsSync142(path12)) return 0;
|
|
666105
666618
|
try {
|
|
666106
|
-
const text2 =
|
|
666619
|
+
const text2 = readFileSync116(path12, "utf8").slice(-maxBytes);
|
|
666107
666620
|
return text2.split(/\r?\n/).filter((line) => line.trim()).length;
|
|
666108
666621
|
} catch {
|
|
666109
666622
|
return 0;
|
|
@@ -666147,7 +666660,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
|
|
|
666147
666660
|
const files = readdirSync48(dir).filter((f2) => f2.endsWith(".json"));
|
|
666148
666661
|
for (const file of files.slice(0, 10)) {
|
|
666149
666662
|
try {
|
|
666150
|
-
const raw =
|
|
666663
|
+
const raw = readFileSync116(join154(dir, file), "utf-8");
|
|
666151
666664
|
const entries = JSON.parse(raw);
|
|
666152
666665
|
const topic = basename29(file, ".json");
|
|
666153
666666
|
for (const [k, v] of Object.entries(entries)) {
|
|
@@ -666637,7 +667150,7 @@ function extractMakeBootstrapTargets(repoRoot) {
|
|
|
666637
667150
|
const makefile = ["Makefile", "makefile"].find((name10) => existsSync142(join154(repoRoot, name10)));
|
|
666638
667151
|
if (!makefile) return [];
|
|
666639
667152
|
try {
|
|
666640
|
-
const text2 =
|
|
667153
|
+
const text2 = readFileSync116(join154(repoRoot, makefile), "utf8");
|
|
666641
667154
|
const targets = [];
|
|
666642
667155
|
for (const line of text2.split(/\r?\n/)) {
|
|
666643
667156
|
const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
|
|
@@ -666850,7 +667363,7 @@ function loadCustomToolsContext(repoRoot) {
|
|
|
666850
667363
|
const registryPath = join154(repoRoot, ".omnius", "tools", "registry.json");
|
|
666851
667364
|
const indexPath = join154(repoRoot, ".omnius", "tools", "README.md");
|
|
666852
667365
|
if (!existsSync142(registryPath)) return "";
|
|
666853
|
-
const registry4 = JSON.parse(
|
|
667366
|
+
const registry4 = JSON.parse(readFileSync116(registryPath, "utf-8"));
|
|
666854
667367
|
const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
|
|
666855
667368
|
const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
|
|
666856
667369
|
if (byRate !== 0) return byRate;
|
|
@@ -667060,7 +667573,7 @@ var init_project_context = __esm({
|
|
|
667060
667573
|
});
|
|
667061
667574
|
|
|
667062
667575
|
// packages/cli/src/realtime.ts
|
|
667063
|
-
import { existsSync as existsSync143, readFileSync as
|
|
667576
|
+
import { existsSync as existsSync143, readFileSync as readFileSync117, readdirSync as readdirSync49 } from "node:fs";
|
|
667064
667577
|
import { basename as basename30, join as join155, resolve as resolve63 } from "node:path";
|
|
667065
667578
|
function clampInt2(value2, fallback, min, max) {
|
|
667066
667579
|
const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
|
|
@@ -667082,7 +667595,7 @@ function firstReadable(candidates) {
|
|
|
667082
667595
|
for (const path12 of candidates) {
|
|
667083
667596
|
if (!existsSync143(path12)) continue;
|
|
667084
667597
|
try {
|
|
667085
|
-
return { path: path12, content:
|
|
667598
|
+
return { path: path12, content: readFileSync117(path12, "utf8") };
|
|
667086
667599
|
} catch {
|
|
667087
667600
|
return null;
|
|
667088
667601
|
}
|
|
@@ -667105,7 +667618,7 @@ function projectVoice(repoRoot) {
|
|
|
667105
667618
|
return ap - bp || a2.localeCompare(b);
|
|
667106
667619
|
});
|
|
667107
667620
|
const first2 = files[0];
|
|
667108
|
-
return first2 ? { path: join155(voiceDir3, first2), content:
|
|
667621
|
+
return first2 ? { path: join155(voiceDir3, first2), content: readFileSync117(join155(voiceDir3, first2), "utf8") } : null;
|
|
667109
667622
|
} catch {
|
|
667110
667623
|
return null;
|
|
667111
667624
|
}
|
|
@@ -667293,7 +667806,7 @@ __export(chat_session_exports, {
|
|
|
667293
667806
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
667294
667807
|
import {
|
|
667295
667808
|
existsSync as existsSync144,
|
|
667296
|
-
readFileSync as
|
|
667809
|
+
readFileSync as readFileSync118,
|
|
667297
667810
|
readdirSync as readdirSync50,
|
|
667298
667811
|
writeFileSync as writeFileSync74,
|
|
667299
667812
|
renameSync as renameSync13,
|
|
@@ -667402,7 +667915,7 @@ function normalizeLoadedSession(parsed) {
|
|
|
667402
667915
|
}
|
|
667403
667916
|
function readSessionFile(fp) {
|
|
667404
667917
|
try {
|
|
667405
|
-
const parsed = JSON.parse(
|
|
667918
|
+
const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
|
|
667406
667919
|
if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
|
|
667407
667920
|
return normalizeLoadedSession(parsed);
|
|
667408
667921
|
} catch {
|
|
@@ -667435,7 +667948,7 @@ function loadPersistedSessions() {
|
|
|
667435
667948
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
667436
667949
|
const fp = join156(dir, f2);
|
|
667437
667950
|
try {
|
|
667438
|
-
const parsed = JSON.parse(
|
|
667951
|
+
const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
|
|
667439
667952
|
if (f2.endsWith(".inflight.json")) {
|
|
667440
667953
|
if (parsed && parsed.pid && parsed.status === "running") {
|
|
667441
667954
|
try {
|
|
@@ -667477,7 +667990,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667477
667990
|
const diaryPath = join156(cwd4, ".omnius", "context", "session-diary.md");
|
|
667478
667991
|
if (existsSync144(diaryPath)) {
|
|
667479
667992
|
try {
|
|
667480
|
-
const diary =
|
|
667993
|
+
const diary = readFileSync118(diaryPath, "utf-8").slice(0, 1e3);
|
|
667481
667994
|
parts.push(`\\nPrevious session history:\\n${diary}`);
|
|
667482
667995
|
} catch {
|
|
667483
667996
|
}
|
|
@@ -667492,7 +668005,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667492
668005
|
);
|
|
667493
668006
|
for (const f2 of files.slice(0, 3)) {
|
|
667494
668007
|
try {
|
|
667495
|
-
const data = JSON.parse(
|
|
668008
|
+
const data = JSON.parse(readFileSync118(join156(memDir, f2), "utf-8"));
|
|
667496
668009
|
const entries = Object.entries(data).slice(0, 3);
|
|
667497
668010
|
if (entries.length > 0) {
|
|
667498
668011
|
parts.push(
|
|
@@ -667512,7 +668025,7 @@ function buildSystemPrompt(cwd4) {
|
|
|
667512
668025
|
const p2 = join156(cwd4, name10);
|
|
667513
668026
|
if (existsSync144(p2)) {
|
|
667514
668027
|
try {
|
|
667515
|
-
const content =
|
|
668028
|
+
const content = readFileSync118(p2, "utf-8").slice(0, 500);
|
|
667516
668029
|
parts.push(`\\nProject instructions (${name10}):\\n${content}`);
|
|
667517
668030
|
} catch {
|
|
667518
668031
|
}
|
|
@@ -667534,7 +668047,7 @@ function getSession2(sessionId, model, cwd4) {
|
|
|
667534
668047
|
try {
|
|
667535
668048
|
const fp = sessionPath(sessionId);
|
|
667536
668049
|
if (existsSync144(fp)) {
|
|
667537
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
668050
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
|
|
667538
668051
|
if (parsed && parsed.id === sessionId) {
|
|
667539
668052
|
parsed.lastActivity = Date.now();
|
|
667540
668053
|
if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
|
|
@@ -667721,7 +668234,7 @@ function drainCheckins(sessionId) {
|
|
|
667721
668234
|
const fp = checkinPath(sessionId);
|
|
667722
668235
|
if (!existsSync144(fp)) return [];
|
|
667723
668236
|
try {
|
|
667724
|
-
const raw =
|
|
668237
|
+
const raw = readFileSync118(fp, "utf-8");
|
|
667725
668238
|
try {
|
|
667726
668239
|
unlinkSync30(fp);
|
|
667727
668240
|
} catch {
|
|
@@ -667787,7 +668300,7 @@ function lookupSession(id2) {
|
|
|
667787
668300
|
try {
|
|
667788
668301
|
const fp = sessionPath(id2);
|
|
667789
668302
|
if (existsSync144(fp)) {
|
|
667790
|
-
const parsed = normalizeLoadedSession(JSON.parse(
|
|
668303
|
+
const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
|
|
667791
668304
|
if (parsed && parsed.id === id2) {
|
|
667792
668305
|
sessions2.set(id2, parsed);
|
|
667793
668306
|
return parsed;
|
|
@@ -667840,7 +668353,7 @@ function getInFlightChat(sessionId) {
|
|
|
667840
668353
|
try {
|
|
667841
668354
|
const p2 = inFlightPath(sessionId);
|
|
667842
668355
|
if (existsSync144(p2)) {
|
|
667843
|
-
const parsed = JSON.parse(
|
|
668356
|
+
const parsed = JSON.parse(readFileSync118(p2, "utf-8"));
|
|
667844
668357
|
if (parsed && parsed.sessionId === sessionId) {
|
|
667845
668358
|
return parsed;
|
|
667846
668359
|
}
|
|
@@ -669245,7 +669758,7 @@ __export(banner_exports, {
|
|
|
669245
669758
|
setBannerWriter: () => setBannerWriter,
|
|
669246
669759
|
setGridText: () => setGridText
|
|
669247
669760
|
});
|
|
669248
|
-
import { existsSync as existsSync146, readFileSync as
|
|
669761
|
+
import { existsSync as existsSync146, readFileSync as readFileSync119, writeFileSync as writeFileSync75, mkdirSync as mkdirSync87 } from "node:fs";
|
|
669249
669762
|
import { join as join157 } from "node:path";
|
|
669250
669763
|
function setBannerWriter(writer) {
|
|
669251
669764
|
chromeWrite3 = writer;
|
|
@@ -669387,7 +669900,7 @@ function loadBannerDesign(workDir, id2) {
|
|
|
669387
669900
|
const file = join157(workDir, ".omnius", "banners", `${id2}.json`);
|
|
669388
669901
|
if (!existsSync146(file)) return null;
|
|
669389
669902
|
try {
|
|
669390
|
-
return JSON.parse(
|
|
669903
|
+
return JSON.parse(readFileSync119(file, "utf8"));
|
|
669391
669904
|
} catch {
|
|
669392
669905
|
return null;
|
|
669393
669906
|
}
|
|
@@ -669717,13 +670230,13 @@ var init_banner = __esm({
|
|
|
669717
670230
|
});
|
|
669718
670231
|
|
|
669719
670232
|
// packages/cli/src/tui/carousel-descriptors.ts
|
|
669720
|
-
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";
|
|
669721
670234
|
import { join as join158, basename as basename33 } from "node:path";
|
|
669722
670235
|
function loadToolProfile(repoRoot) {
|
|
669723
670236
|
const filePath = join158(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
|
|
669724
670237
|
try {
|
|
669725
670238
|
if (!existsSync147(filePath)) return null;
|
|
669726
|
-
return JSON.parse(
|
|
670239
|
+
return JSON.parse(readFileSync120(filePath, "utf-8"));
|
|
669727
670240
|
} catch {
|
|
669728
670241
|
return null;
|
|
669729
670242
|
}
|
|
@@ -669789,7 +670302,7 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
669789
670302
|
const filePath = join158(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
|
|
669790
670303
|
try {
|
|
669791
670304
|
if (!existsSync147(filePath)) return null;
|
|
669792
|
-
const cached = JSON.parse(
|
|
670305
|
+
const cached = JSON.parse(readFileSync120(filePath, "utf-8"));
|
|
669793
670306
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
669794
670307
|
} catch {
|
|
669795
670308
|
return null;
|
|
@@ -669853,7 +670366,7 @@ function extractFromPackageJson(repoRoot, tags) {
|
|
|
669853
670366
|
const pkgPath = join158(repoRoot, "package.json");
|
|
669854
670367
|
try {
|
|
669855
670368
|
if (!existsSync147(pkgPath)) return;
|
|
669856
|
-
const pkg = JSON.parse(
|
|
670369
|
+
const pkg = JSON.parse(readFileSync120(pkgPath, "utf-8"));
|
|
669857
670370
|
if (pkg.name && typeof pkg.name === "string") {
|
|
669858
670371
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
669859
670372
|
for (const p2 of parts) tags.push(p2);
|
|
@@ -669924,7 +670437,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
669924
670437
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
669925
670438
|
tags.push(topic);
|
|
669926
670439
|
try {
|
|
669927
|
-
const data = JSON.parse(
|
|
670440
|
+
const data = JSON.parse(readFileSync120(join158(memoryDir, file), "utf-8"));
|
|
669928
670441
|
if (data && typeof data === "object") {
|
|
669929
670442
|
const keys = Object.keys(data).slice(0, 3);
|
|
669930
670443
|
for (const key of keys) {
|
|
@@ -670967,7 +671480,7 @@ var init_edit_history = __esm({
|
|
|
670967
671480
|
});
|
|
670968
671481
|
|
|
670969
671482
|
// packages/cli/src/tui/snr-engine.ts
|
|
670970
|
-
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";
|
|
670971
671484
|
import { join as join160, basename as basename34 } from "node:path";
|
|
670972
671485
|
function computeDPrime(signalScores, noiseScores) {
|
|
670973
671486
|
if (signalScores.length === 0 || noiseScores.length === 0) return 0;
|
|
@@ -671274,7 +671787,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671274
671787
|
const topic = basename34(f2, ".json");
|
|
671275
671788
|
if (topics.length > 0 && !topics.includes(topic)) continue;
|
|
671276
671789
|
try {
|
|
671277
|
-
const data = JSON.parse(
|
|
671790
|
+
const data = JSON.parse(readFileSync121(join160(dir, f2), "utf-8"));
|
|
671278
671791
|
for (const [key, val] of Object.entries(data)) {
|
|
671279
671792
|
const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
671280
671793
|
entries.push({ topic, key, value: value2 });
|
|
@@ -671376,7 +671889,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671376
671889
|
const file = join160(memDir, `${topic}.json`);
|
|
671377
671890
|
if (!existsSync148(file)) continue;
|
|
671378
671891
|
try {
|
|
671379
|
-
const data = JSON.parse(
|
|
671892
|
+
const data = JSON.parse(readFileSync121(file, "utf-8"));
|
|
671380
671893
|
const moved = {};
|
|
671381
671894
|
for (const key of keys) {
|
|
671382
671895
|
if (key in data) {
|
|
@@ -671391,7 +671904,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671391
671904
|
let archiveData = {};
|
|
671392
671905
|
if (existsSync148(archiveFile)) {
|
|
671393
671906
|
try {
|
|
671394
|
-
archiveData = JSON.parse(
|
|
671907
|
+
archiveData = JSON.parse(readFileSync121(archiveFile, "utf-8"));
|
|
671395
671908
|
} catch {
|
|
671396
671909
|
}
|
|
671397
671910
|
}
|
|
@@ -671430,7 +671943,7 @@ Call task_complete with the JSON array when done.`,
|
|
|
671430
671943
|
});
|
|
671431
671944
|
|
|
671432
671945
|
// packages/cli/src/tui/promptLoader.ts
|
|
671433
|
-
import { readFileSync as
|
|
671946
|
+
import { readFileSync as readFileSync122, existsSync as existsSync149 } from "node:fs";
|
|
671434
671947
|
import { join as join161, dirname as dirname49 } from "node:path";
|
|
671435
671948
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
671436
671949
|
function loadPrompt3(promptPath, vars) {
|
|
@@ -671440,7 +671953,7 @@ function loadPrompt3(promptPath, vars) {
|
|
|
671440
671953
|
if (!existsSync149(fullPath)) {
|
|
671441
671954
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
671442
671955
|
}
|
|
671443
|
-
content =
|
|
671956
|
+
content = readFileSync122(fullPath, "utf-8");
|
|
671444
671957
|
cache7.set(promptPath, content);
|
|
671445
671958
|
}
|
|
671446
671959
|
if (!vars) return content;
|
|
@@ -671460,7 +671973,7 @@ var init_promptLoader3 = __esm({
|
|
|
671460
671973
|
});
|
|
671461
671974
|
|
|
671462
671975
|
// packages/cli/src/tui/dream-engine.ts
|
|
671463
|
-
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";
|
|
671464
671977
|
import { join as join162, basename as basename35 } from "node:path";
|
|
671465
671978
|
function setDreamWriteContent(fn) {
|
|
671466
671979
|
_dreamWriteContent = fn;
|
|
@@ -671476,7 +671989,7 @@ function loadAutoresearchMemory(repoRoot) {
|
|
|
671476
671989
|
const memoryPath = join162(repoRoot, ".omnius", "memory", "autoresearch.json");
|
|
671477
671990
|
if (!existsSync150(memoryPath)) return "";
|
|
671478
671991
|
try {
|
|
671479
|
-
const raw =
|
|
671992
|
+
const raw = readFileSync123(memoryPath, "utf-8");
|
|
671480
671993
|
const data = JSON.parse(raw);
|
|
671481
671994
|
const sections = [];
|
|
671482
671995
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -671711,7 +672224,7 @@ var init_dream_engine = __esm({
|
|
|
671711
672224
|
if (!existsSync150(targetPath)) {
|
|
671712
672225
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
671713
672226
|
}
|
|
671714
|
-
let content =
|
|
672227
|
+
let content = readFileSync123(targetPath, "utf-8");
|
|
671715
672228
|
if (!content.includes(oldStr)) {
|
|
671716
672229
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
671717
672230
|
}
|
|
@@ -671799,7 +672312,7 @@ var init_dream_engine = __esm({
|
|
|
671799
672312
|
if (!existsSync150(targetPath)) {
|
|
671800
672313
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
|
|
671801
672314
|
}
|
|
671802
|
-
let content =
|
|
672315
|
+
let content = readFileSync123(targetPath, "utf-8");
|
|
671803
672316
|
if (!content.includes(oldStr)) {
|
|
671804
672317
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
|
|
671805
672318
|
}
|
|
@@ -672763,7 +673276,7 @@ ${summary}` };
|
|
|
672763
673276
|
try {
|
|
672764
673277
|
let notes = [];
|
|
672765
673278
|
if (existsSync150(notesPath)) {
|
|
672766
|
-
notes = JSON.parse(
|
|
673279
|
+
notes = JSON.parse(readFileSync123(notesPath, "utf-8"));
|
|
672767
673280
|
}
|
|
672768
673281
|
if (action === "add") {
|
|
672769
673282
|
const note = {
|
|
@@ -673403,7 +673916,7 @@ var init_bless_engine = __esm({
|
|
|
673403
673916
|
});
|
|
673404
673917
|
|
|
673405
673918
|
// packages/cli/src/tui/dmn-engine.ts
|
|
673406
|
-
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";
|
|
673407
673920
|
import { join as join163, basename as basename36 } from "node:path";
|
|
673408
673921
|
import { exec as exec6 } from "node:child_process";
|
|
673409
673922
|
import { promisify as promisify8 } from "node:util";
|
|
@@ -674288,7 +674801,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
674288
674801
|
const path12 = join163(this.stateDir, "state.json");
|
|
674289
674802
|
if (existsSync151(path12)) {
|
|
674290
674803
|
try {
|
|
674291
|
-
this.state = JSON.parse(
|
|
674804
|
+
this.state = JSON.parse(readFileSync124(path12, "utf-8"));
|
|
674292
674805
|
} catch {
|
|
674293
674806
|
}
|
|
674294
674807
|
}
|
|
@@ -674322,7 +674835,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
|
|
|
674322
674835
|
const latestByFingerprint = /* @__PURE__ */ new Map();
|
|
674323
674836
|
for (const file of files) {
|
|
674324
674837
|
try {
|
|
674325
|
-
const parsed = JSON.parse(
|
|
674838
|
+
const parsed = JSON.parse(readFileSync124(join163(this.historyDir, file), "utf-8"));
|
|
674326
674839
|
latestByFingerprint.set(this.fingerprintCycle(parsed), file);
|
|
674327
674840
|
} catch {
|
|
674328
674841
|
keep.add(file);
|
|
@@ -676141,7 +676654,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
|
|
|
676141
676654
|
import {
|
|
676142
676655
|
existsSync as existsSync152,
|
|
676143
676656
|
mkdirSync as mkdirSync93,
|
|
676144
|
-
readFileSync as
|
|
676657
|
+
readFileSync as readFileSync125,
|
|
676145
676658
|
statSync as statSync55,
|
|
676146
676659
|
unlinkSync as unlinkSync32,
|
|
676147
676660
|
writeFileSync as writeFileSync80
|
|
@@ -676371,7 +676884,7 @@ function scopedTool(base3, root, mode) {
|
|
|
676371
676884
|
);
|
|
676372
676885
|
if (!materialized.ok) return denied(materialized.error);
|
|
676373
676886
|
mkdirSync93(dirname50(guarded.path.abs), { recursive: true });
|
|
676374
|
-
writeFileSync80(guarded.path.abs,
|
|
676887
|
+
writeFileSync80(guarded.path.abs, readFileSync125(materialized.path));
|
|
676375
676888
|
materialized.cleanup?.();
|
|
676376
676889
|
restoredEditPath = guarded.path.abs;
|
|
676377
676890
|
}
|
|
@@ -676495,7 +677008,7 @@ function readManifest(root) {
|
|
|
676495
677008
|
ensureManifest(root);
|
|
676496
677009
|
try {
|
|
676497
677010
|
const parsed = JSON.parse(
|
|
676498
|
-
|
|
677011
|
+
readFileSync125(manifestPath(root), "utf8")
|
|
676499
677012
|
);
|
|
676500
677013
|
const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
|
|
676501
677014
|
Object.entries(parsed.objects).filter(
|
|
@@ -676547,7 +677060,7 @@ function rememberCreated(root, absPath) {
|
|
|
676547
677060
|
}
|
|
676548
677061
|
}
|
|
676549
677062
|
mkdirSync93(join164(root, OBJECTS_DIR), { recursive: true });
|
|
676550
|
-
const data =
|
|
677063
|
+
const data = readFileSync125(guarded.path.abs);
|
|
676551
677064
|
const prefix = randomBytes26(48);
|
|
676552
677065
|
const key = randomBytes26(32);
|
|
676553
677066
|
const iv = randomBytes26(12);
|
|
@@ -676603,7 +677116,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
676603
677116
|
error: `Scoped artifact storage is missing for ${rel}.`
|
|
676604
677117
|
};
|
|
676605
677118
|
}
|
|
676606
|
-
const blob =
|
|
677119
|
+
const blob = readFileSync125(storedAbs);
|
|
676607
677120
|
if (blob.length < object.prefixBytes) {
|
|
676608
677121
|
return {
|
|
676609
677122
|
ok: false,
|
|
@@ -677574,7 +678087,7 @@ import {
|
|
|
677574
678087
|
existsSync as existsSync153,
|
|
677575
678088
|
mkdirSync as mkdirSync94,
|
|
677576
678089
|
readdirSync as readdirSync55,
|
|
677577
|
-
readFileSync as
|
|
678090
|
+
readFileSync as readFileSync126,
|
|
677578
678091
|
writeFileSync as writeFileSync81,
|
|
677579
678092
|
unlinkSync as unlinkSync33
|
|
677580
678093
|
} from "node:fs";
|
|
@@ -678343,7 +678856,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
|
678343
678856
|
for (const file of files.reverse()) {
|
|
678344
678857
|
try {
|
|
678345
678858
|
return JSON.parse(
|
|
678346
|
-
|
|
678859
|
+
readFileSync126(join165(dir, file), "utf8")
|
|
678347
678860
|
);
|
|
678348
678861
|
} catch {
|
|
678349
678862
|
}
|
|
@@ -680081,7 +680594,7 @@ __export(vision_ingress_exports, {
|
|
|
680081
680594
|
resolveVisionModel: () => resolveVisionModel,
|
|
680082
680595
|
runVisionIngress: () => runVisionIngress
|
|
680083
680596
|
});
|
|
680084
|
-
import { existsSync as existsSync154, readFileSync as
|
|
680597
|
+
import { existsSync as existsSync154, readFileSync as readFileSync127, unlinkSync as unlinkSync34 } from "node:fs";
|
|
680085
680598
|
import { join as join166 } from "node:path";
|
|
680086
680599
|
async function isTesseractAvailable() {
|
|
680087
680600
|
try {
|
|
@@ -680136,7 +680649,7 @@ async function advancedOcr(imagePath) {
|
|
|
680136
680649
|
], { timeout: 15e3 });
|
|
680137
680650
|
const txtFile = `${outFile}.txt`;
|
|
680138
680651
|
if (existsSync154(txtFile)) {
|
|
680139
|
-
const text2 =
|
|
680652
|
+
const text2 = readFileSync127(txtFile, "utf-8").trim();
|
|
680140
680653
|
if (text2.length > 0) results.push(text2);
|
|
680141
680654
|
try {
|
|
680142
680655
|
unlinkSync34(txtFile);
|
|
@@ -680321,7 +680834,7 @@ import {
|
|
|
680321
680834
|
unlinkSync as unlinkSync35,
|
|
680322
680835
|
readdirSync as readdirSync56,
|
|
680323
680836
|
statSync as statSync56,
|
|
680324
|
-
readFileSync as
|
|
680837
|
+
readFileSync as readFileSync128,
|
|
680325
680838
|
writeFileSync as writeFileSync82,
|
|
680326
680839
|
appendFileSync as appendFileSync18
|
|
680327
680840
|
} from "node:fs";
|
|
@@ -686433,7 +686946,7 @@ ${mediaContext}` : ""
|
|
|
686433
686946
|
const path12 = this.telegramConversationPath(sessionKey);
|
|
686434
686947
|
if (!existsSync155(path12)) return;
|
|
686435
686948
|
try {
|
|
686436
|
-
const parsed = JSON.parse(
|
|
686949
|
+
const parsed = JSON.parse(readFileSync128(path12, "utf8"));
|
|
686437
686950
|
const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
|
|
686438
686951
|
if (Array.isArray(parsed.history)) {
|
|
686439
686952
|
this.chatHistory.set(
|
|
@@ -686647,7 +687160,7 @@ ${mediaContext}` : ""
|
|
|
686647
687160
|
for (const file of readdirSync56(this.telegramConversationDir)) {
|
|
686648
687161
|
if (!file.endsWith(".json")) continue;
|
|
686649
687162
|
try {
|
|
686650
|
-
const raw =
|
|
687163
|
+
const raw = readFileSync128(
|
|
686651
687164
|
join167(this.telegramConversationDir, file),
|
|
686652
687165
|
"utf8"
|
|
686653
687166
|
);
|
|
@@ -691334,7 +691847,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
691334
691847
|
const lockFile = join167(lockDir, `bot-${botUserId}.owner.lock`);
|
|
691335
691848
|
if (existsSync155(lockFile)) {
|
|
691336
691849
|
try {
|
|
691337
|
-
const prior = JSON.parse(
|
|
691850
|
+
const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
|
|
691338
691851
|
const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
|
|
691339
691852
|
if (priorAlive) {
|
|
691340
691853
|
throw new Error(
|
|
@@ -691367,7 +691880,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
691367
691880
|
try {
|
|
691368
691881
|
if (!existsSync155(lockFile)) return;
|
|
691369
691882
|
try {
|
|
691370
|
-
const prior = JSON.parse(
|
|
691883
|
+
const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
|
|
691371
691884
|
if (prior.pid !== process.pid) return;
|
|
691372
691885
|
} catch {
|
|
691373
691886
|
}
|
|
@@ -696310,7 +696823,7 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
696310
696823
|
readTelegramToolButtonState(nonce) {
|
|
696311
696824
|
try {
|
|
696312
696825
|
const parsed = JSON.parse(
|
|
696313
|
-
|
|
696826
|
+
readFileSync128(this.telegramToolButtonPath(nonce), "utf-8")
|
|
696314
696827
|
);
|
|
696315
696828
|
if (!parsed || parsed.expiresAt < Date.now()) return null;
|
|
696316
696829
|
return parsed;
|
|
@@ -697764,7 +698277,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
697764
698277
|
const ingressResult = await runVisionIngress2(
|
|
697765
698278
|
{
|
|
697766
698279
|
path: localPath,
|
|
697767
|
-
buffer:
|
|
698280
|
+
buffer: readFileSync128(localPath),
|
|
697768
698281
|
mime: telegramImageMime(media)
|
|
697769
698282
|
},
|
|
697770
698283
|
this.agentConfig?.model ?? ""
|
|
@@ -698159,7 +698672,7 @@ ${text2}`.trim()
|
|
|
698159
698672
|
}
|
|
698160
698673
|
if (!existsSync155(media.value))
|
|
698161
698674
|
throw new Error(`File does not exist: ${media.value}`);
|
|
698162
|
-
const buffer2 =
|
|
698675
|
+
const buffer2 = readFileSync128(media.value);
|
|
698163
698676
|
const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
698164
698677
|
const filename = basename39(media.value);
|
|
698165
698678
|
const contentType = mimeForPath(media.value, media.kind);
|
|
@@ -698273,7 +698786,7 @@ Content-Type: ${contentType}\r
|
|
|
698273
698786
|
const sidecarPath2 = `${imagePath}.json`;
|
|
698274
698787
|
if (!existsSync155(sidecarPath2)) return null;
|
|
698275
698788
|
try {
|
|
698276
|
-
const raw =
|
|
698789
|
+
const raw = readFileSync128(sidecarPath2, "utf8");
|
|
698277
698790
|
const parsed = JSON.parse(raw);
|
|
698278
698791
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
698279
698792
|
return null;
|
|
@@ -698333,7 +698846,7 @@ Content-Type: ${contentType}\r
|
|
|
698333
698846
|
const sidecarPath2 = `${videoPath}.json`;
|
|
698334
698847
|
if (!existsSync155(sidecarPath2)) return null;
|
|
698335
698848
|
try {
|
|
698336
|
-
const raw =
|
|
698849
|
+
const raw = readFileSync128(sidecarPath2, "utf8");
|
|
698337
698850
|
const parsed = JSON.parse(raw);
|
|
698338
698851
|
if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
|
|
698339
698852
|
return null;
|
|
@@ -698478,7 +698991,7 @@ Content-Type: ${contentType}\r
|
|
|
698478
698991
|
addField(field, pathOrFileId);
|
|
698479
698992
|
continue;
|
|
698480
698993
|
}
|
|
698481
|
-
const buffer2 =
|
|
698994
|
+
const buffer2 = readFileSync128(pathOrFileId);
|
|
698482
698995
|
const filename = basename39(pathOrFileId);
|
|
698483
698996
|
parts.push(Buffer.from(`--${boundary}\r
|
|
698484
698997
|
`));
|
|
@@ -699583,9 +700096,15 @@ Rules:
|
|
|
699583
700096
|
this._retryMicTimer = null;
|
|
699584
700097
|
if (!this.active) return;
|
|
699585
700098
|
try {
|
|
699586
|
-
|
|
699587
|
-
|
|
699588
|
-
|
|
700099
|
+
if (typeof this.listen.release === "function" && typeof this.listen.acquire === "function") {
|
|
700100
|
+
await this.listen.release("voicechat").catch(() => {
|
|
700101
|
+
});
|
|
700102
|
+
await this.listen.acquire("voicechat");
|
|
700103
|
+
} else {
|
|
700104
|
+
await this.listen.stop().catch(() => {
|
|
700105
|
+
});
|
|
700106
|
+
await this.listen.start();
|
|
700107
|
+
}
|
|
699589
700108
|
if (this.verbose) this.onStatus("Mic auto-recovered — LISTENING");
|
|
699590
700109
|
} catch {
|
|
699591
700110
|
}
|
|
@@ -699595,7 +700114,11 @@ Rules:
|
|
|
699595
700114
|
this.listen.on("transcript", this._onTranscript);
|
|
699596
700115
|
this.listen.on("error", this._onError);
|
|
699597
700116
|
try {
|
|
699598
|
-
|
|
700117
|
+
if (typeof this.listen.acquire === "function") {
|
|
700118
|
+
await this.listen.acquire("voicechat");
|
|
700119
|
+
} else {
|
|
700120
|
+
await this.listen.start();
|
|
700121
|
+
}
|
|
699599
700122
|
this.setState("LISTENING");
|
|
699600
700123
|
if (this.verbose) this.onStatus("Mic active — LISTENING for speech...");
|
|
699601
700124
|
} catch (err) {
|
|
@@ -699622,15 +700145,21 @@ Rules:
|
|
|
699622
700145
|
this.finalizeSegment();
|
|
699623
700146
|
}
|
|
699624
700147
|
if (this._onTranscript) {
|
|
699625
|
-
this.listen.
|
|
700148
|
+
if (typeof this.listen.off === "function") this.listen.off("transcript", this._onTranscript);
|
|
700149
|
+
else this.listen.removeAllListeners("transcript");
|
|
699626
700150
|
this._onTranscript = null;
|
|
699627
700151
|
}
|
|
699628
700152
|
if (this._onError) {
|
|
699629
|
-
this.listen.
|
|
700153
|
+
if (typeof this.listen.off === "function") this.listen.off("error", this._onError);
|
|
700154
|
+
else this.listen.removeAllListeners("error");
|
|
699630
700155
|
this._onError = null;
|
|
699631
700156
|
}
|
|
699632
700157
|
try {
|
|
699633
|
-
|
|
700158
|
+
if (typeof this.listen.release === "function") {
|
|
700159
|
+
await this.listen.release("voicechat");
|
|
700160
|
+
} else {
|
|
700161
|
+
await this.listen.stop();
|
|
700162
|
+
}
|
|
699634
700163
|
} catch {
|
|
699635
700164
|
}
|
|
699636
700165
|
this.releaseLiveResources();
|
|
@@ -700580,14 +701109,14 @@ __export(projects_exports, {
|
|
|
700580
701109
|
setCurrentProject: () => setCurrentProject,
|
|
700581
701110
|
unregisterProject: () => unregisterProject
|
|
700582
701111
|
});
|
|
700583
|
-
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";
|
|
700584
701113
|
import { homedir as homedir56 } from "node:os";
|
|
700585
701114
|
import { basename as basename40, join as join168, resolve as resolve68 } from "node:path";
|
|
700586
701115
|
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
700587
701116
|
function readAll2() {
|
|
700588
701117
|
try {
|
|
700589
701118
|
if (!existsSync156(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
|
|
700590
|
-
const raw =
|
|
701119
|
+
const raw = readFileSync129(PROJECTS_FILE, "utf8");
|
|
700591
701120
|
const parsed = JSON.parse(raw);
|
|
700592
701121
|
if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
|
|
700593
701122
|
return { projects: parsed.projects, schemaVersion: 1 };
|
|
@@ -700664,7 +701193,7 @@ function getCurrentProject() {
|
|
|
700664
701193
|
if (!currentRoot) {
|
|
700665
701194
|
try {
|
|
700666
701195
|
if (existsSync156(CURRENT_FILE)) {
|
|
700667
|
-
const persisted =
|
|
701196
|
+
const persisted = readFileSync129(CURRENT_FILE, "utf8").trim();
|
|
700668
701197
|
if (persisted) currentRoot = persisted;
|
|
700669
701198
|
}
|
|
700670
701199
|
} catch {
|
|
@@ -701578,7 +702107,7 @@ var init_access_policy = __esm({
|
|
|
701578
702107
|
|
|
701579
702108
|
// packages/cli/src/api/project-preferences.ts
|
|
701580
702109
|
import { createHash as createHash43 } from "node:crypto";
|
|
701581
|
-
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";
|
|
701582
702111
|
import { homedir as homedir57 } from "node:os";
|
|
701583
702112
|
import { join as join169, resolve as resolve69 } from "node:path";
|
|
701584
702113
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
@@ -701611,7 +702140,7 @@ function readProjectPreferences(root) {
|
|
|
701611
702140
|
try {
|
|
701612
702141
|
const file = prefsPath(root);
|
|
701613
702142
|
if (!existsSync157(file)) return { ...DEFAULT_PREFS };
|
|
701614
|
-
const raw =
|
|
702143
|
+
const raw = readFileSync130(file, "utf8");
|
|
701615
702144
|
const parsed = JSON.parse(raw);
|
|
701616
702145
|
if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
|
|
701617
702146
|
return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
|
|
@@ -701678,7 +702207,7 @@ __export(audit_log_exports, {
|
|
|
701678
702207
|
recordAudit: () => recordAudit,
|
|
701679
702208
|
sanitizeBody: () => sanitizeBody
|
|
701680
702209
|
});
|
|
701681
|
-
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";
|
|
701682
702211
|
import { join as join170 } from "node:path";
|
|
701683
702212
|
function initAuditLog(omniusDir) {
|
|
701684
702213
|
auditDir = join170(omniusDir, "audit");
|
|
@@ -701715,7 +702244,7 @@ function sanitizeBody(body, maxLen = 200) {
|
|
|
701715
702244
|
function queryAudit(opts) {
|
|
701716
702245
|
if (!initialized || !existsSync158(auditFile)) return [];
|
|
701717
702246
|
try {
|
|
701718
|
-
const raw =
|
|
702247
|
+
const raw = readFileSync131(auditFile, "utf-8");
|
|
701719
702248
|
const lines = raw.split("\n").filter(Boolean);
|
|
701720
702249
|
let records = lines.map((l2) => {
|
|
701721
702250
|
try {
|
|
@@ -702688,7 +703217,7 @@ var init_direct_tool_registry = __esm({
|
|
|
702688
703217
|
});
|
|
702689
703218
|
|
|
702690
703219
|
// packages/cli/src/api/external-tool-registry.ts
|
|
702691
|
-
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";
|
|
702692
703221
|
import { join as join172 } from "node:path";
|
|
702693
703222
|
function externalToolStorePath(workingDir) {
|
|
702694
703223
|
return join172(workingDir, ".omnius", "external-tools.json");
|
|
@@ -702697,7 +703226,7 @@ function loadExternalTools(workingDir) {
|
|
|
702697
703226
|
const path12 = externalToolStorePath(workingDir);
|
|
702698
703227
|
if (!existsSync161(path12)) return [];
|
|
702699
703228
|
try {
|
|
702700
|
-
const parsed = JSON.parse(
|
|
703229
|
+
const parsed = JSON.parse(readFileSync132(path12, "utf-8"));
|
|
702701
703230
|
if (!parsed || !Array.isArray(parsed.tools)) return [];
|
|
702702
703231
|
return parsed.tools.filter(
|
|
702703
703232
|
(t2) => t2 && typeof t2.name === "string" && t2.transport != null
|
|
@@ -703036,7 +703565,7 @@ __export(aiwg_exports, {
|
|
|
703036
703565
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
703037
703566
|
tryRouteAiwg: () => tryRouteAiwg
|
|
703038
703567
|
});
|
|
703039
|
-
import { existsSync as existsSync162, readFileSync as
|
|
703568
|
+
import { existsSync as existsSync162, readFileSync as readFileSync133, readdirSync as readdirSync57, statSync as statSync60 } from "node:fs";
|
|
703040
703569
|
import { join as join173 } from "node:path";
|
|
703041
703570
|
import { homedir as homedir58 } from "node:os";
|
|
703042
703571
|
import { execSync as execSync38 } from "node:child_process";
|
|
@@ -703107,7 +703636,7 @@ function resolveAiwgRoot() {
|
|
|
703107
703636
|
const pj = join173(cur, "package.json");
|
|
703108
703637
|
if (existsSync162(pj)) {
|
|
703109
703638
|
try {
|
|
703110
|
-
const pkg = JSON.parse(
|
|
703639
|
+
const pkg = JSON.parse(readFileSync133(pj, "utf-8"));
|
|
703111
703640
|
if (pkg.name === "aiwg") {
|
|
703112
703641
|
_cachedAiwgRoot = cur;
|
|
703113
703642
|
return cur;
|
|
@@ -703197,7 +703726,7 @@ function readFirstLineDescription(dir) {
|
|
|
703197
703726
|
const p2 = join173(dir, candidate);
|
|
703198
703727
|
if (!existsSync162(p2)) continue;
|
|
703199
703728
|
try {
|
|
703200
|
-
const txt =
|
|
703729
|
+
const txt = readFileSync133(p2, "utf-8");
|
|
703201
703730
|
const descMatch = txt.match(/^description:\s*(.+)$/m);
|
|
703202
703731
|
if (descMatch) return descMatch[1].trim().slice(0, 200);
|
|
703203
703732
|
for (const line of txt.split("\n")) {
|
|
@@ -703248,7 +703777,7 @@ function walkForItems(dir, out, depth) {
|
|
|
703248
703777
|
}
|
|
703249
703778
|
function parseItem(p2) {
|
|
703250
703779
|
try {
|
|
703251
|
-
const raw =
|
|
703780
|
+
const raw = readFileSync133(p2, "utf-8");
|
|
703252
703781
|
const header = raw.slice(0, 3e3);
|
|
703253
703782
|
const nameMatch = header.match(/^name:\s*(.+)$/m);
|
|
703254
703783
|
const descMatch = header.match(/^description:\s*(.+)$/m);
|
|
@@ -703287,7 +703816,7 @@ function deriveSource(p2) {
|
|
|
703287
703816
|
function loadAiwgItemContent(path12, maxBytes = 2e4) {
|
|
703288
703817
|
try {
|
|
703289
703818
|
if (!existsSync162(path12)) return null;
|
|
703290
|
-
const raw =
|
|
703819
|
+
const raw = readFileSync133(path12, "utf-8");
|
|
703291
703820
|
return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
|
|
703292
703821
|
} catch {
|
|
703293
703822
|
return null;
|
|
@@ -703823,7 +704352,7 @@ __export(runtime_keys_exports, {
|
|
|
703823
704352
|
mintKey: () => mintKey,
|
|
703824
704353
|
revokeByPrefix: () => revokeByPrefix
|
|
703825
704354
|
});
|
|
703826
|
-
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";
|
|
703827
704356
|
import { join as join174 } from "node:path";
|
|
703828
704357
|
import { homedir as homedir59 } from "node:os";
|
|
703829
704358
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
@@ -703834,7 +704363,7 @@ function ensureDir2() {
|
|
|
703834
704363
|
function loadAll() {
|
|
703835
704364
|
if (!existsSync163(KEYS_FILE)) return [];
|
|
703836
704365
|
try {
|
|
703837
|
-
const raw =
|
|
704366
|
+
const raw = readFileSync134(KEYS_FILE, "utf-8");
|
|
703838
704367
|
const parsed = JSON.parse(raw);
|
|
703839
704368
|
if (!Array.isArray(parsed)) return [];
|
|
703840
704369
|
return parsed;
|
|
@@ -703920,7 +704449,7 @@ __export(tor_fallback_exports, {
|
|
|
703920
704449
|
torIsReachable: () => torIsReachable,
|
|
703921
704450
|
tunnelViaTor: () => tunnelViaTor
|
|
703922
704451
|
});
|
|
703923
|
-
import { existsSync as existsSync164, readFileSync as
|
|
704452
|
+
import { existsSync as existsSync164, readFileSync as readFileSync135 } from "node:fs";
|
|
703924
704453
|
import { homedir as homedir60 } from "node:os";
|
|
703925
704454
|
import { join as join175 } from "node:path";
|
|
703926
704455
|
import { createConnection as createConnection3 } from "node:net";
|
|
@@ -703933,7 +704462,7 @@ function getLocalOnion() {
|
|
|
703933
704462
|
for (const p2 of candidates) {
|
|
703934
704463
|
try {
|
|
703935
704464
|
if (existsSync164(p2)) {
|
|
703936
|
-
const v =
|
|
704465
|
+
const v = readFileSync135(p2, "utf-8").trim();
|
|
703937
704466
|
if (v && v.endsWith(".onion")) return v;
|
|
703938
704467
|
}
|
|
703939
704468
|
} catch {
|
|
@@ -704194,7 +704723,7 @@ var init_graphical_sudo = __esm({
|
|
|
704194
704723
|
});
|
|
704195
704724
|
|
|
704196
704725
|
// packages/cli/src/api/routes-v1.ts
|
|
704197
|
-
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";
|
|
704198
704727
|
import { join as join177, resolve as pathResolve3 } from "node:path";
|
|
704199
704728
|
import { homedir as homedir61 } from "node:os";
|
|
704200
704729
|
async function tryRouteV1(ctx3) {
|
|
@@ -704478,7 +705007,7 @@ function walkForSkills(dir, out, depth) {
|
|
|
704478
705007
|
walkForSkills(p2, out, depth + 1);
|
|
704479
705008
|
} else if (e2.isFile() && e2.name === "SKILL.md") {
|
|
704480
705009
|
try {
|
|
704481
|
-
const content =
|
|
705010
|
+
const content = readFileSync136(p2, "utf-8").slice(0, 2e3);
|
|
704482
705011
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
704483
705012
|
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
704484
705013
|
out.push({
|
|
@@ -705434,7 +705963,7 @@ async function handleFilesRead(ctx3) {
|
|
|
705434
705963
|
}));
|
|
705435
705964
|
return true;
|
|
705436
705965
|
}
|
|
705437
|
-
const content =
|
|
705966
|
+
const content = readFileSync136(resolved, "utf-8");
|
|
705438
705967
|
const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
|
|
705439
705968
|
const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
|
|
705440
705969
|
const slice2 = content.slice(offset, offset + limit);
|
|
@@ -705736,7 +706265,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
705736
706265
|
for (const p2 of statePaths) {
|
|
705737
706266
|
if (!existsSync166(p2)) continue;
|
|
705738
706267
|
try {
|
|
705739
|
-
const raw =
|
|
706268
|
+
const raw = readFileSync136(p2, "utf-8");
|
|
705740
706269
|
states2.push({ source: p2, data: JSON.parse(raw) });
|
|
705741
706270
|
} catch (e2) {
|
|
705742
706271
|
states2.push({ source: p2, error: String(e2) });
|
|
@@ -705764,7 +706293,7 @@ async function handleNexusStatus(ctx3) {
|
|
|
705764
706293
|
function loadAgentName() {
|
|
705765
706294
|
try {
|
|
705766
706295
|
const p2 = join177(homedir61(), ".omnius", "agent-name");
|
|
705767
|
-
if (existsSync166(p2)) return
|
|
706296
|
+
if (existsSync166(p2)) return readFileSync136(p2, "utf-8").trim();
|
|
705768
706297
|
} catch {
|
|
705769
706298
|
}
|
|
705770
706299
|
return null;
|
|
@@ -705780,7 +706309,7 @@ async function handleSponsors(ctx3) {
|
|
|
705780
706309
|
for (const p2 of candidates) {
|
|
705781
706310
|
if (!existsSync166(p2)) continue;
|
|
705782
706311
|
try {
|
|
705783
|
-
const raw = JSON.parse(
|
|
706312
|
+
const raw = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
705784
706313
|
if (Array.isArray(raw)) {
|
|
705785
706314
|
sponsors = raw;
|
|
705786
706315
|
break;
|
|
@@ -705860,7 +706389,7 @@ async function handleEvaluate(ctx3) {
|
|
|
705860
706389
|
}));
|
|
705861
706390
|
return true;
|
|
705862
706391
|
}
|
|
705863
|
-
const job = JSON.parse(
|
|
706392
|
+
const job = JSON.parse(readFileSync136(jobPath, "utf-8"));
|
|
705864
706393
|
sendJson2(res, 200, {
|
|
705865
706394
|
run_id: runId,
|
|
705866
706395
|
task: job.task,
|
|
@@ -706000,7 +706529,7 @@ async function handleMintKey(ctx3) {
|
|
|
706000
706529
|
function _readStatusFile(p2) {
|
|
706001
706530
|
if (!existsSync166(p2)) return null;
|
|
706002
706531
|
try {
|
|
706003
|
-
const data = JSON.parse(
|
|
706532
|
+
const data = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
706004
706533
|
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
706005
706534
|
const pid = Number(data.pid);
|
|
706006
706535
|
if (pid > 0) {
|
|
@@ -706043,7 +706572,7 @@ function resolveLocalPeerId() {
|
|
|
706043
706572
|
try {
|
|
706044
706573
|
const regPath = join177(homedir61(), ".omnius", "nexus-registry.json");
|
|
706045
706574
|
if (existsSync166(regPath)) {
|
|
706046
|
-
const reg = JSON.parse(
|
|
706575
|
+
const reg = JSON.parse(readFileSync136(regPath, "utf-8"));
|
|
706047
706576
|
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
706048
706577
|
for (const entry of entries) {
|
|
706049
706578
|
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
@@ -707556,7 +708085,7 @@ function aimsDir() {
|
|
|
707556
708085
|
function readAimsFile(name10, fallback) {
|
|
707557
708086
|
try {
|
|
707558
708087
|
const p2 = join177(aimsDir(), name10);
|
|
707559
|
-
if (existsSync166(p2)) return JSON.parse(
|
|
708088
|
+
if (existsSync166(p2)) return JSON.parse(readFileSync136(p2, "utf-8"));
|
|
707560
708089
|
} catch {
|
|
707561
708090
|
}
|
|
707562
708091
|
return fallback;
|
|
@@ -707933,7 +708462,7 @@ async function handleAimsSuppliers(ctx3) {
|
|
|
707933
708462
|
for (const p2 of sponsorPaths) {
|
|
707934
708463
|
if (!existsSync166(p2)) continue;
|
|
707935
708464
|
try {
|
|
707936
|
-
const raw = JSON.parse(
|
|
708465
|
+
const raw = JSON.parse(readFileSync136(p2, "utf-8"));
|
|
707937
708466
|
const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
|
|
707938
708467
|
for (const s2 of list) {
|
|
707939
708468
|
suppliers.push({
|
|
@@ -719889,7 +720418,7 @@ var init_auth_oidc = __esm({
|
|
|
719889
720418
|
});
|
|
719890
720419
|
|
|
719891
720420
|
// packages/cli/src/api/usage-tracker.ts
|
|
719892
|
-
import { mkdirSync as mkdirSync105, readFileSync as
|
|
720421
|
+
import { mkdirSync as mkdirSync105, readFileSync as readFileSync137, writeFileSync as writeFileSync88, existsSync as existsSync167 } from "node:fs";
|
|
719893
720422
|
import { join as join178 } from "node:path";
|
|
719894
720423
|
function initUsageTracker(omniusDir) {
|
|
719895
720424
|
const dir = join178(omniusDir, "usage");
|
|
@@ -719897,7 +720426,7 @@ function initUsageTracker(omniusDir) {
|
|
|
719897
720426
|
usageFile = join178(dir, "token-usage.json");
|
|
719898
720427
|
try {
|
|
719899
720428
|
if (existsSync167(usageFile)) {
|
|
719900
|
-
store = JSON.parse(
|
|
720429
|
+
store = JSON.parse(readFileSync137(usageFile, "utf-8"));
|
|
719901
720430
|
}
|
|
719902
720431
|
} catch {
|
|
719903
720432
|
store = { providers: {}, lastSaved: "" };
|
|
@@ -720596,7 +721125,7 @@ import {
|
|
|
720596
721125
|
createReadStream as createReadStream2,
|
|
720597
721126
|
mkdirSync as mkdirSync107,
|
|
720598
721127
|
writeFileSync as writeFileSync90,
|
|
720599
|
-
readFileSync as
|
|
721128
|
+
readFileSync as readFileSync138,
|
|
720600
721129
|
readdirSync as readdirSync59,
|
|
720601
721130
|
existsSync as existsSync169,
|
|
720602
721131
|
watch as fsWatch4,
|
|
@@ -720628,7 +721157,7 @@ function getVersion3() {
|
|
|
720628
721157
|
for (const pkgPath of candidates) {
|
|
720629
721158
|
try {
|
|
720630
721159
|
if (!existsSync169(pkgPath)) continue;
|
|
720631
|
-
const pkg = JSON.parse(
|
|
721160
|
+
const pkg = JSON.parse(readFileSync138(pkgPath, "utf8"));
|
|
720632
721161
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
720633
721162
|
return pkg.version ?? "0.0.0";
|
|
720634
721163
|
}
|
|
@@ -721044,7 +721573,7 @@ function isOriginAllowed(origin) {
|
|
|
721044
721573
|
try {
|
|
721045
721574
|
const accessFile = join181(homedir63(), ".omnius", "access");
|
|
721046
721575
|
if (existsSync169(accessFile)) {
|
|
721047
|
-
const persisted =
|
|
721576
|
+
const persisted = readFileSync138(accessFile, "utf8").trim().toLowerCase();
|
|
721048
721577
|
if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
|
|
721049
721578
|
accessMode = persisted;
|
|
721050
721579
|
}
|
|
@@ -721891,7 +722420,7 @@ function loadJob(id2) {
|
|
|
721891
722420
|
const file = join181(jobsDir(), `${id2}.json`);
|
|
721892
722421
|
if (!existsSync169(file)) return null;
|
|
721893
722422
|
try {
|
|
721894
|
-
return JSON.parse(
|
|
722423
|
+
return JSON.parse(readFileSync138(file, "utf-8"));
|
|
721895
722424
|
} catch {
|
|
721896
722425
|
return null;
|
|
721897
722426
|
}
|
|
@@ -721904,7 +722433,7 @@ function listJobs2() {
|
|
|
721904
722433
|
for (const file of files) {
|
|
721905
722434
|
try {
|
|
721906
722435
|
jobs.push(
|
|
721907
|
-
JSON.parse(
|
|
722436
|
+
JSON.parse(readFileSync138(join181(dir, file), "utf-8"))
|
|
721908
722437
|
);
|
|
721909
722438
|
} catch {
|
|
721910
722439
|
}
|
|
@@ -721922,7 +722451,7 @@ function pruneOldJobs() {
|
|
|
721922
722451
|
if (!file.endsWith(".json")) continue;
|
|
721923
722452
|
const path12 = join181(dir, file);
|
|
721924
722453
|
try {
|
|
721925
|
-
const job = JSON.parse(
|
|
722454
|
+
const job = JSON.parse(readFileSync138(path12, "utf-8"));
|
|
721926
722455
|
if (job.status === "running") {
|
|
721927
722456
|
kept++;
|
|
721928
722457
|
continue;
|
|
@@ -724078,7 +724607,7 @@ function readUpdateState() {
|
|
|
724078
724607
|
try {
|
|
724079
724608
|
const p2 = updateStateFile();
|
|
724080
724609
|
if (!existsSync169(p2)) return null;
|
|
724081
|
-
return JSON.parse(
|
|
724610
|
+
return JSON.parse(readFileSync138(p2, "utf-8"));
|
|
724082
724611
|
} catch {
|
|
724083
724612
|
return null;
|
|
724084
724613
|
}
|
|
@@ -724383,7 +724912,7 @@ function handleV1UpdateStatus(res) {
|
|
|
724383
724912
|
let exitCode = null;
|
|
724384
724913
|
try {
|
|
724385
724914
|
if (existsSync169(logPath3)) {
|
|
724386
|
-
const raw =
|
|
724915
|
+
const raw = readFileSync138(logPath3, "utf-8");
|
|
724387
724916
|
const m2 = raw.match(/__EXIT_CODE=(\d+)/);
|
|
724388
724917
|
if (m2) exitCode = parseInt(m2[1], 10);
|
|
724389
724918
|
logTail = raw.slice(-2e3);
|
|
@@ -728864,7 +729393,7 @@ function listScheduledTasks() {
|
|
|
728864
729393
|
if (dir.endsWith(`${join181(".omnius", "scheduled")}`) || dir.includes(`${join181(".omnius", "scheduled")}`)) {
|
|
728865
729394
|
const file = join181(dir, "tasks.json");
|
|
728866
729395
|
try {
|
|
728867
|
-
const raw =
|
|
729396
|
+
const raw = readFileSync138(file, "utf-8");
|
|
728868
729397
|
const json = JSON.parse(raw);
|
|
728869
729398
|
const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
728870
729399
|
tasks.forEach((t2, i2) => {
|
|
@@ -728962,7 +729491,7 @@ function setScheduledEnabled(id2, enabled2) {
|
|
|
728962
729491
|
const target = tasks.find((t2) => t2.id === id2);
|
|
728963
729492
|
if (!target) return false;
|
|
728964
729493
|
try {
|
|
728965
|
-
const raw =
|
|
729494
|
+
const raw = readFileSync138(target.file, "utf-8");
|
|
728966
729495
|
const json = JSON.parse(raw);
|
|
728967
729496
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
728968
729497
|
if (!arr[target.index]) return false;
|
|
@@ -728995,7 +729524,7 @@ function deleteScheduledById(id2) {
|
|
|
728995
729524
|
const target = tasks.find((t2) => t2.id === id2);
|
|
728996
729525
|
if (!target) return false;
|
|
728997
729526
|
try {
|
|
728998
|
-
const raw =
|
|
729527
|
+
const raw = readFileSync138(target.file, "utf-8");
|
|
728999
729528
|
const json = JSON.parse(raw);
|
|
729000
729529
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
729001
729530
|
if (!arr[target.index]) return false;
|
|
@@ -729220,7 +729749,7 @@ function reconcileScheduledTasks(apply) {
|
|
|
729220
729749
|
try {
|
|
729221
729750
|
let json = { tasks: [] };
|
|
729222
729751
|
try {
|
|
729223
|
-
const raw =
|
|
729752
|
+
const raw = readFileSync138(file, "utf-8");
|
|
729224
729753
|
json = JSON.parse(raw);
|
|
729225
729754
|
} catch {
|
|
729226
729755
|
}
|
|
@@ -729599,7 +730128,7 @@ function startApiServer(options2 = {}) {
|
|
|
729599
730128
|
const sid = f2.replace(/\.json$/, "");
|
|
729600
730129
|
try {
|
|
729601
730130
|
const items = JSON.parse(
|
|
729602
|
-
|
|
730131
|
+
readFileSync138(join181(dir, f2), "utf-8")
|
|
729603
730132
|
);
|
|
729604
730133
|
if (Array.isArray(items)) {
|
|
729605
730134
|
cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
|
|
@@ -729633,7 +730162,7 @@ function startApiServer(options2 = {}) {
|
|
|
729633
730162
|
}
|
|
729634
730163
|
return;
|
|
729635
730164
|
}
|
|
729636
|
-
next = JSON.parse(
|
|
730165
|
+
next = JSON.parse(readFileSync138(fp, "utf-8"));
|
|
729637
730166
|
if (!Array.isArray(next)) return;
|
|
729638
730167
|
} catch {
|
|
729639
730168
|
return;
|
|
@@ -729696,7 +730225,7 @@ function startApiServer(options2 = {}) {
|
|
|
729696
730225
|
if (!f2.endsWith(".json")) continue;
|
|
729697
730226
|
try {
|
|
729698
730227
|
const jobPath = join181(jobsDir3, f2);
|
|
729699
|
-
const job = JSON.parse(
|
|
730228
|
+
const job = JSON.parse(readFileSync138(jobPath, "utf-8"));
|
|
729700
730229
|
const jobTime = new Date(
|
|
729701
730230
|
job.startedAt ?? job.completedAt ?? 0
|
|
729702
730231
|
).getTime();
|
|
@@ -729718,8 +730247,8 @@ function startApiServer(options2 = {}) {
|
|
|
729718
730247
|
if (useTls) {
|
|
729719
730248
|
try {
|
|
729720
730249
|
tlsOpts = {
|
|
729721
|
-
cert:
|
|
729722
|
-
key:
|
|
730250
|
+
cert: readFileSync138(resolve71(tlsCert)),
|
|
730251
|
+
key: readFileSync138(resolve71(tlsKey))
|
|
729723
730252
|
};
|
|
729724
730253
|
} catch (e2) {
|
|
729725
730254
|
log22(`
|
|
@@ -729732,7 +730261,7 @@ function startApiServer(options2 = {}) {
|
|
|
729732
730261
|
try {
|
|
729733
730262
|
const accessFile = join181(homedir63(), ".omnius", "access");
|
|
729734
730263
|
if (existsSync169(accessFile)) {
|
|
729735
|
-
const persisted =
|
|
730264
|
+
const persisted = readFileSync138(accessFile, "utf8").trim();
|
|
729736
730265
|
const resolved = resolveAccessMode(persisted, host);
|
|
729737
730266
|
if (resolved) runtimeAccessMode = resolved;
|
|
729738
730267
|
}
|
|
@@ -730163,7 +730692,7 @@ function startApiServer(options2 = {}) {
|
|
|
730163
730692
|
for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
|
|
730164
730693
|
const p2 = join181(here, rel);
|
|
730165
730694
|
if (existsSync169(p2)) {
|
|
730166
|
-
const pkg = JSON.parse(
|
|
730695
|
+
const pkg = JSON.parse(readFileSync138(p2, "utf8"));
|
|
730167
730696
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
730168
730697
|
return pkg.version ?? null;
|
|
730169
730698
|
}
|
|
@@ -731179,7 +731708,7 @@ var clipboard_media_exports = {};
|
|
|
731179
731708
|
__export(clipboard_media_exports, {
|
|
731180
731709
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
731181
731710
|
});
|
|
731182
|
-
import { mkdirSync as mkdirSync108, readFileSync as
|
|
731711
|
+
import { mkdirSync as mkdirSync108, readFileSync as readFileSync139, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
|
|
731183
731712
|
import { join as join182 } from "node:path";
|
|
731184
731713
|
async function pasteClipboardImageToFile(repoRoot) {
|
|
731185
731714
|
const image = await readClipboardImage();
|
|
@@ -731196,7 +731725,7 @@ async function readClipboardImage() {
|
|
|
731196
731725
|
if (!await commandExists2("pngpaste", 1e3)) return null;
|
|
731197
731726
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
731198
731727
|
await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
|
|
731199
|
-
const buffer2 =
|
|
731728
|
+
const buffer2 = readFileSync139(tmp);
|
|
731200
731729
|
try {
|
|
731201
731730
|
rmSync15(tmp);
|
|
731202
731731
|
} catch {
|
|
@@ -731256,7 +731785,7 @@ import { resolve as resolve72, join as join183, dirname as dirname54, extname as
|
|
|
731256
731785
|
import { createRequire as createRequire9 } from "node:module";
|
|
731257
731786
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
731258
731787
|
import {
|
|
731259
|
-
readFileSync as
|
|
731788
|
+
readFileSync as readFileSync140,
|
|
731260
731789
|
writeFileSync as writeFileSync92,
|
|
731261
731790
|
appendFileSync as appendFileSync20,
|
|
731262
731791
|
rmSync as rmSync16,
|
|
@@ -732737,7 +733266,7 @@ function gatherMemorySnippets(root) {
|
|
|
732737
733266
|
if (!existsSync170(dir)) continue;
|
|
732738
733267
|
try {
|
|
732739
733268
|
for (const f2 of readdirSync60(dir).filter((f3) => f3.endsWith(".json"))) {
|
|
732740
|
-
const data = JSON.parse(
|
|
733269
|
+
const data = JSON.parse(readFileSync140(join183(dir, f2), "utf-8"));
|
|
732741
733270
|
for (const val of Object.values(data)) {
|
|
732742
733271
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
732743
733272
|
if (v.length > 10) snippets.push(v);
|
|
@@ -733209,7 +733738,7 @@ ${metabolismMemories}
|
|
|
733209
733738
|
try {
|
|
733210
733739
|
const archeFile = join183(repoRoot, ".omnius", "arche", "variants.json");
|
|
733211
733740
|
if (existsSync170(archeFile)) {
|
|
733212
|
-
const variants = JSON.parse(
|
|
733741
|
+
const variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
733213
733742
|
if (variants.length > 0) {
|
|
733214
733743
|
let filtered = variants;
|
|
733215
733744
|
if (taskType) {
|
|
@@ -733400,7 +733929,7 @@ ${skillPack}`;
|
|
|
733400
733929
|
"self-state.json"
|
|
733401
733930
|
);
|
|
733402
733931
|
if (existsSync170(ikStateFile)) {
|
|
733403
|
-
const selfState = JSON.parse(
|
|
733932
|
+
const selfState = JSON.parse(readFileSync140(ikStateFile, "utf8"));
|
|
733404
733933
|
const lines = [
|
|
733405
733934
|
`[Identity State v${selfState.version}]`,
|
|
733406
733935
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -733739,7 +734268,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
733739
734268
|
}
|
|
733740
734269
|
}
|
|
733741
734270
|
try {
|
|
733742
|
-
const { readdirSync: readdirSync62, readFileSync:
|
|
734271
|
+
const { readdirSync: readdirSync62, readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
733743
734272
|
const { join: pathJoin } = await import("node:path");
|
|
733744
734273
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
733745
734274
|
if (existsSync173(chunksDir)) {
|
|
@@ -733749,7 +734278,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
|
|
|
733749
734278
|
for (const f2 of files) {
|
|
733750
734279
|
try {
|
|
733751
734280
|
const data = JSON.parse(
|
|
733752
|
-
|
|
734281
|
+
readFileSync142(pathJoin(chunksDir, f2), "utf-8")
|
|
733753
734282
|
);
|
|
733754
734283
|
if (data._deleted) continue;
|
|
733755
734284
|
if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
|
|
@@ -733815,7 +734344,7 @@ ${lines.join("\n")}`
|
|
|
733815
734344
|
const expand2 = args.expand === true;
|
|
733816
734345
|
if (expand2 && id2.startsWith("todo-ctx-")) {
|
|
733817
734346
|
try {
|
|
733818
|
-
const { readFileSync:
|
|
734347
|
+
const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
|
|
733819
734348
|
const { join: pathJoin } = await import("node:path");
|
|
733820
734349
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
733821
734350
|
const todoIdSuffix = id2.replace("todo-ctx-", "");
|
|
@@ -735353,7 +735882,7 @@ async function startInteractive(config, repoPath2) {
|
|
|
735353
735882
|
const omniusDir = join183(repoRoot, ".omnius");
|
|
735354
735883
|
const nexusPidFile = join183(omniusDir, "nexus", "daemon.pid");
|
|
735355
735884
|
if (existsSync170(nexusPidFile)) {
|
|
735356
|
-
const pid = parseInt(
|
|
735885
|
+
const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
735357
735886
|
if (pid > 0) {
|
|
735358
735887
|
try {
|
|
735359
735888
|
process.kill(pid, 0);
|
|
@@ -736549,7 +737078,7 @@ This is an independent background session started from /background.`
|
|
|
736549
737078
|
try {
|
|
736550
737079
|
const titleFile = join183(repoRoot, ".omnius", "session-title");
|
|
736551
737080
|
if (existsSync170(titleFile))
|
|
736552
|
-
sessionTitle =
|
|
737081
|
+
sessionTitle = readFileSync140(titleFile, "utf8").trim() || null;
|
|
736553
737082
|
} catch {
|
|
736554
737083
|
}
|
|
736555
737084
|
let carouselRetired = isResumed;
|
|
@@ -736664,7 +737193,7 @@ This is an independent background session started from /background.`
|
|
|
736664
737193
|
let savedHistory = [];
|
|
736665
737194
|
try {
|
|
736666
737195
|
if (existsSync170(HISTORY_FILE)) {
|
|
736667
|
-
const raw =
|
|
737196
|
+
const raw = readFileSync140(HISTORY_FILE, "utf8").trim();
|
|
736668
737197
|
if (raw) savedHistory = raw.split("\n").reverse();
|
|
736669
737198
|
}
|
|
736670
737199
|
} catch {
|
|
@@ -736823,7 +737352,7 @@ This is an independent background session started from /background.`
|
|
|
736823
737352
|
mkdirSync109(HISTORY_DIR, { recursive: true });
|
|
736824
737353
|
appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
|
|
736825
737354
|
if (Math.random() < 0.02) {
|
|
736826
|
-
const all2 =
|
|
737355
|
+
const all2 = readFileSync140(HISTORY_FILE, "utf8").trim().split("\n");
|
|
736827
737356
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
736828
737357
|
writeFileSync92(
|
|
736829
737358
|
HISTORY_FILE,
|
|
@@ -737052,7 +737581,7 @@ This is an independent background session started from /background.`
|
|
|
737052
737581
|
const nexusPidFile = join183(autoNexus.getNexusDir(), "daemon.pid");
|
|
737053
737582
|
if (existsSync170(nexusPidFile)) {
|
|
737054
737583
|
const nPid = parseInt(
|
|
737055
|
-
|
|
737584
|
+
readFileSync140(nexusPidFile, "utf8").trim(),
|
|
737056
737585
|
10
|
|
737057
737586
|
);
|
|
737058
737587
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
@@ -737234,7 +737763,7 @@ Log: ${nexusLogPath}`
|
|
|
737234
737763
|
let agName = "";
|
|
737235
737764
|
try {
|
|
737236
737765
|
if (existsSync170(globalNamePath))
|
|
737237
|
-
agName =
|
|
737766
|
+
agName = readFileSync140(globalNamePath, "utf8").trim();
|
|
737238
737767
|
} catch {
|
|
737239
737768
|
}
|
|
737240
737769
|
if (!agName) {
|
|
@@ -737275,7 +737804,7 @@ Log: ${nexusLogPath}`
|
|
|
737275
737804
|
try {
|
|
737276
737805
|
if (existsSync170(savedSponsorsPath)) {
|
|
737277
737806
|
savedSponsors = JSON.parse(
|
|
737278
|
-
|
|
737807
|
+
readFileSync140(savedSponsorsPath, "utf8")
|
|
737279
737808
|
);
|
|
737280
737809
|
const oneHourAgo = Date.now() - 36e5;
|
|
737281
737810
|
savedSponsors = savedSponsors.filter(
|
|
@@ -738730,8 +739259,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
738730
739259
|
// Listen mode (transcribe-cli integration + live voice session)
|
|
738731
739260
|
async listenToggle() {
|
|
738732
739261
|
const engine = getListenEngine();
|
|
738733
|
-
if (engine.isActive) {
|
|
738734
|
-
const text2 = await engine.
|
|
739262
|
+
if (engine.isActive && engine.hasOwner("listen")) {
|
|
739263
|
+
const text2 = await engine.release("listen");
|
|
738735
739264
|
statusBar.setRecording(false);
|
|
738736
739265
|
if (voiceSession?.isActive) {
|
|
738737
739266
|
const sessionMsg = await voiceSession.stop();
|
|
@@ -738774,7 +739303,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
738774
739303
|
engine.on("info", (msg2) => {
|
|
738775
739304
|
writeContent(() => renderInfo(msg2));
|
|
738776
739305
|
});
|
|
738777
|
-
const msg = await engine.
|
|
739306
|
+
const msg = await engine.acquire("listen");
|
|
738778
739307
|
if (voiceEngine.enabled && voiceEngine.ready) {
|
|
738779
739308
|
try {
|
|
738780
739309
|
voiceSession = new VoiceSession();
|
|
@@ -738803,6 +739332,39 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
738803
739332
|
}
|
|
738804
739333
|
return msg;
|
|
738805
739334
|
},
|
|
739335
|
+
async listenStart(owner = "live") {
|
|
739336
|
+
const engine = getListenEngine();
|
|
739337
|
+
const available = await engine.isAvailable();
|
|
739338
|
+
if (!available) {
|
|
739339
|
+
return "ASR runtime unavailable. Omnius attempted managed Whisper setup; check ~/.omnius/runtimes/asr and CUDA PyTorch.";
|
|
739340
|
+
}
|
|
739341
|
+
const uiEngine = engine;
|
|
739342
|
+
if (!uiEngine.__omniusLiveAsrUiWired) {
|
|
739343
|
+
uiEngine.__omniusLiveAsrUiWired = true;
|
|
739344
|
+
engine.on("recording", (active) => {
|
|
739345
|
+
statusBar.setRecording(active);
|
|
739346
|
+
});
|
|
739347
|
+
engine.on("level", (evt) => {
|
|
739348
|
+
statusBar.setMicActivity(evt.speechActive, evt.levelDb);
|
|
739349
|
+
});
|
|
739350
|
+
engine.on("error", (err) => {
|
|
739351
|
+
writeContent(() => renderWarning(`Live ASR error: ${err.message}`));
|
|
739352
|
+
});
|
|
739353
|
+
engine.on("info", (msg) => {
|
|
739354
|
+
if (/CUDA|Whisper|consensus|ASR|VAD|torch/i.test(msg)) {
|
|
739355
|
+
writeContent(() => renderInfo(`[asr] ${msg}`));
|
|
739356
|
+
}
|
|
739357
|
+
});
|
|
739358
|
+
}
|
|
739359
|
+
return engine.acquire(owner);
|
|
739360
|
+
},
|
|
739361
|
+
async listenRelease(owner = "live") {
|
|
739362
|
+
const engine = getListenEngine();
|
|
739363
|
+
return engine.release(owner);
|
|
739364
|
+
},
|
|
739365
|
+
listenIsActive() {
|
|
739366
|
+
return getListenEngine().isActive;
|
|
739367
|
+
},
|
|
738806
739368
|
async listenSetModel(model) {
|
|
738807
739369
|
const engine = getListenEngine();
|
|
738808
739370
|
engine.setModel(model);
|
|
@@ -738815,8 +739377,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
738815
739377
|
},
|
|
738816
739378
|
async listenStop() {
|
|
738817
739379
|
const engine = getListenEngine();
|
|
738818
|
-
const text2 = await engine.stop();
|
|
738819
|
-
statusBar.setRecording(false);
|
|
739380
|
+
const text2 = engine.hasOwner("listen") ? await engine.release("listen") : engine.ownerCount() > 0 ? "Shared ASR is still running for /live, /voicechat, or /call." : await engine.stop();
|
|
739381
|
+
if (engine.ownerCount() === 0) statusBar.setRecording(false);
|
|
738820
739382
|
if (voiceSession?.isActive) {
|
|
738821
739383
|
const runtime = voiceSession.runtime;
|
|
738822
739384
|
await voiceSession.stop();
|
|
@@ -739128,19 +739690,22 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739128
739690
|
writeContent(() => renderInfo(voiceMsg));
|
|
739129
739691
|
}
|
|
739130
739692
|
const { VoiceChatSession: VoiceChatSession2 } = await Promise.resolve().then(() => (init_voicechat(), voicechat_exports));
|
|
739131
|
-
const
|
|
739132
|
-
const
|
|
739133
|
-
|
|
739134
|
-
|
|
739135
|
-
|
|
739136
|
-
|
|
739137
|
-
|
|
739138
|
-
|
|
739139
|
-
|
|
739140
|
-
|
|
739141
|
-
|
|
739142
|
-
|
|
739143
|
-
|
|
739693
|
+
const listenEng = getListenEngine();
|
|
739694
|
+
const voicechatUiEngine = listenEng;
|
|
739695
|
+
if (!voicechatUiEngine.__omniusVoiceChatAsrUiWired) {
|
|
739696
|
+
voicechatUiEngine.__omniusVoiceChatAsrUiWired = true;
|
|
739697
|
+
listenEng.on("recording", (active) => {
|
|
739698
|
+
statusBar.setRecording(active);
|
|
739699
|
+
});
|
|
739700
|
+
listenEng.on("level", (evt) => {
|
|
739701
|
+
statusBar.setMicActivity(evt.speechActive, evt.levelDb);
|
|
739702
|
+
});
|
|
739703
|
+
listenEng.on("info", (msg) => {
|
|
739704
|
+
if (/consensus rejected|loading whisper|whisper model loaded|Whisper VAD|no accepted speech text|very short utterance/i.test(msg)) {
|
|
739705
|
+
writeContent(() => renderInfo(`[voicechat/asr] ${msg}`));
|
|
739706
|
+
}
|
|
739707
|
+
});
|
|
739708
|
+
}
|
|
739144
739709
|
const summaryRunner = {
|
|
739145
739710
|
injectUserMessage(content) {
|
|
739146
739711
|
if (activeTask?.runner) {
|
|
@@ -739148,6 +739713,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739148
739713
|
}
|
|
739149
739714
|
}
|
|
739150
739715
|
};
|
|
739716
|
+
const voicechatPartialPrefix = `\x1B[38;5;244m[hearing]\x1B[0m`;
|
|
739151
739717
|
_voiceChatSession2 = new VoiceChatSession2({
|
|
739152
739718
|
voice: voiceEngine,
|
|
739153
739719
|
listen: listenEng,
|
|
@@ -739305,11 +739871,20 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739305
739871
|
},
|
|
739306
739872
|
onUserSpeech(text2) {
|
|
739307
739873
|
writeContent(
|
|
739308
|
-
() => renderVoiceChatCoalescedRow(`\x1B[38;5;45m[you]\x1B[0m ${text2}
|
|
739874
|
+
() => renderVoiceChatCoalescedRow(`\x1B[38;5;45m[you]\x1B[0m ${text2}`, {
|
|
739875
|
+
replaceLastPrefix: voicechatPartialPrefix
|
|
739876
|
+
})
|
|
739309
739877
|
);
|
|
739310
739878
|
},
|
|
739311
|
-
|
|
739312
|
-
|
|
739879
|
+
onPartialTranscript(text2) {
|
|
739880
|
+
const cleaned = text2.trim();
|
|
739881
|
+
if (!cleaned) return;
|
|
739882
|
+
writeContent(
|
|
739883
|
+
() => renderVoiceChatCoalescedRow(
|
|
739884
|
+
`${voicechatPartialPrefix} ${truncateByLines(cleaned, 2, 240)}`,
|
|
739885
|
+
{ replaceLastPrefix: voicechatPartialPrefix }
|
|
739886
|
+
)
|
|
739887
|
+
);
|
|
739313
739888
|
},
|
|
739314
739889
|
onAgentSpeech(text2) {
|
|
739315
739890
|
writeContent(
|
|
@@ -739322,6 +739897,15 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739322
739897
|
onStateChange(_state4) {
|
|
739323
739898
|
}
|
|
739324
739899
|
});
|
|
739900
|
+
_voiceChatSession2.on("consensusFiltered", (evt) => {
|
|
739901
|
+
const text2 = String(evt?.text ?? "").trim();
|
|
739902
|
+
writeContent(
|
|
739903
|
+
() => renderVoiceChatCoalescedRow(
|
|
739904
|
+
`\x1B[38;5;244m[filtered]\x1B[0m no ASR consensus${text2 ? `: ${truncateByLines(text2, 1, 180)}` : ""}`,
|
|
739905
|
+
{ replaceLastPrefix: voicechatPartialPrefix }
|
|
739906
|
+
)
|
|
739907
|
+
);
|
|
739908
|
+
});
|
|
739325
739909
|
await _voiceChatSession2.start();
|
|
739326
739910
|
},
|
|
739327
739911
|
async voiceChatStop() {
|
|
@@ -739516,7 +740100,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739516
740100
|
try {
|
|
739517
740101
|
const nexusPidFile = join183(nexusTool.getNexusDir(), "daemon.pid");
|
|
739518
740102
|
if (existsSync170(nexusPidFile)) {
|
|
739519
|
-
const pid = parseInt(
|
|
740103
|
+
const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
739520
740104
|
if (pid > 0) {
|
|
739521
740105
|
registry2.register({
|
|
739522
740106
|
name: "Nexus",
|
|
@@ -739729,7 +740313,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739729
740313
|
const nexusDir = join183(repoRoot, OMNIUS_DIR, "nexus");
|
|
739730
740314
|
const pidFile = join183(nexusDir, "daemon.pid");
|
|
739731
740315
|
if (existsSync170(pidFile)) {
|
|
739732
|
-
const pid = parseInt(
|
|
740316
|
+
const pid = parseInt(readFileSync140(pidFile, "utf8").trim(), 10);
|
|
739733
740317
|
if (pid > 0) {
|
|
739734
740318
|
try {
|
|
739735
740319
|
if (process.platform === "win32") {
|
|
@@ -739759,7 +740343,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739759
740343
|
const pidPath = join183(voiceDir3, pf);
|
|
739760
740344
|
if (existsSync170(pidPath)) {
|
|
739761
740345
|
try {
|
|
739762
|
-
const pid = parseInt(
|
|
740346
|
+
const pid = parseInt(readFileSync140(pidPath, "utf8").trim(), 10);
|
|
739763
740347
|
if (pid > 0) {
|
|
739764
740348
|
if (process.platform === "win32") {
|
|
739765
740349
|
try {
|
|
@@ -739900,8 +740484,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739900
740484
|
"daemon.port"
|
|
739901
740485
|
);
|
|
739902
740486
|
if (existsSync170(ppPidFile)) {
|
|
739903
|
-
const ppPid = parseInt(
|
|
739904
|
-
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;
|
|
739905
740489
|
if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
|
|
739906
740490
|
registry2.register({
|
|
739907
740491
|
name: "PersonaPlex",
|
|
@@ -739918,7 +740502,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
739918
740502
|
"daemon.pid"
|
|
739919
740503
|
);
|
|
739920
740504
|
if (existsSync170(nexusPidFile)) {
|
|
739921
|
-
const nPid = parseInt(
|
|
740505
|
+
const nPid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
|
|
739922
740506
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
739923
740507
|
try {
|
|
739924
740508
|
process.kill(nPid, 0);
|
|
@@ -740363,7 +740947,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
740363
740947
|
if (isImage) {
|
|
740364
740948
|
try {
|
|
740365
740949
|
const imgPath = resolve72(repoRoot, cleanPath);
|
|
740366
|
-
const imgBuffer =
|
|
740950
|
+
const imgBuffer = readFileSync140(imgPath);
|
|
740367
740951
|
const base642 = imgBuffer.toString("base64");
|
|
740368
740952
|
const ext = extname22(cleanPath).toLowerCase();
|
|
740369
740953
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -740566,7 +741150,7 @@ ${result.text}`;
|
|
|
740566
741150
|
try {
|
|
740567
741151
|
const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
|
|
740568
741152
|
const ingressResult = await runVisionIngress2(
|
|
740569
|
-
{ path: imgPath, buffer:
|
|
741153
|
+
{ path: imgPath, buffer: readFileSync140(imgPath), mime },
|
|
740570
741154
|
currentConfig.model ?? ""
|
|
740571
741155
|
);
|
|
740572
741156
|
visionContext = formatImageContextPrefix2(ingressResult);
|
|
@@ -740634,7 +741218,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
|
|
|
740634
741218
|
if (isMarkdown && fullInput === input) {
|
|
740635
741219
|
try {
|
|
740636
741220
|
const mdPath = resolve72(repoRoot, cleanPath);
|
|
740637
|
-
const mdContent =
|
|
741221
|
+
const mdContent = readFileSync140(mdPath, "utf8");
|
|
740638
741222
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
|
|
740639
741223
|
const result = parseMcpMarkdown2(mdContent);
|
|
740640
741224
|
if (result.servers.length > 0) {
|
|
@@ -741295,7 +741879,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741295
741879
|
const ikFile = join183(ikDir, "self-state.json");
|
|
741296
741880
|
let ikState;
|
|
741297
741881
|
if (existsSync170(ikFile)) {
|
|
741298
|
-
ikState = JSON.parse(
|
|
741882
|
+
ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
|
|
741299
741883
|
} else {
|
|
741300
741884
|
mkdirSync109(ikDir, { recursive: true });
|
|
741301
741885
|
ikState = {
|
|
@@ -741368,7 +741952,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741368
741952
|
let variants = [];
|
|
741369
741953
|
try {
|
|
741370
741954
|
if (existsSync170(archeFile))
|
|
741371
|
-
variants = JSON.parse(
|
|
741955
|
+
variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
741372
741956
|
} catch {
|
|
741373
741957
|
}
|
|
741374
741958
|
variants.push({
|
|
@@ -741396,7 +741980,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
|
|
|
741396
741980
|
"store.json"
|
|
741397
741981
|
);
|
|
741398
741982
|
if (existsSync170(metaFile2)) {
|
|
741399
|
-
const store2 = JSON.parse(
|
|
741983
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741400
741984
|
const surfaced = store2.filter(
|
|
741401
741985
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
741402
741986
|
).sort(
|
|
@@ -741499,7 +742083,7 @@ Rules:
|
|
|
741499
742083
|
let store2 = [];
|
|
741500
742084
|
try {
|
|
741501
742085
|
if (existsSync170(storeFile))
|
|
741502
|
-
store2 = JSON.parse(
|
|
742086
|
+
store2 = JSON.parse(readFileSync140(storeFile, "utf8"));
|
|
741503
742087
|
} catch {
|
|
741504
742088
|
}
|
|
741505
742089
|
store2.push({
|
|
@@ -741533,7 +742117,7 @@ Rules:
|
|
|
741533
742117
|
let cohereActive = false;
|
|
741534
742118
|
try {
|
|
741535
742119
|
if (existsSync170(cohereSettingsFile)) {
|
|
741536
|
-
const settings = JSON.parse(
|
|
742120
|
+
const settings = JSON.parse(readFileSync140(cohereSettingsFile, "utf8"));
|
|
741537
742121
|
cohereActive = settings.cohere === true;
|
|
741538
742122
|
}
|
|
741539
742123
|
} catch {
|
|
@@ -741547,7 +742131,7 @@ Rules:
|
|
|
741547
742131
|
"store.json"
|
|
741548
742132
|
);
|
|
741549
742133
|
if (existsSync170(metaFile2)) {
|
|
741550
|
-
const store2 = JSON.parse(
|
|
742134
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741551
742135
|
const latest = store2.filter(
|
|
741552
742136
|
(m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
|
|
741553
742137
|
).slice(-1)[0];
|
|
@@ -741580,7 +742164,7 @@ Rules:
|
|
|
741580
742164
|
try {
|
|
741581
742165
|
const ikFile = join183(repoRoot, ".omnius", "identity", "self-state.json");
|
|
741582
742166
|
if (existsSync170(ikFile)) {
|
|
741583
|
-
const ikState = JSON.parse(
|
|
742167
|
+
const ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
|
|
741584
742168
|
ikState.homeostasis.uncertainty = Math.min(
|
|
741585
742169
|
1,
|
|
741586
742170
|
ikState.homeostasis.uncertainty + 0.1
|
|
@@ -741601,7 +742185,7 @@ Rules:
|
|
|
741601
742185
|
"store.json"
|
|
741602
742186
|
);
|
|
741603
742187
|
if (existsSync170(metaFile2)) {
|
|
741604
|
-
const store2 = JSON.parse(
|
|
742188
|
+
const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
|
|
741605
742189
|
const surfaced = store2.filter(
|
|
741606
742190
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
741607
742191
|
).sort(
|
|
@@ -741627,7 +742211,7 @@ Rules:
|
|
|
741627
742211
|
let variants = [];
|
|
741628
742212
|
try {
|
|
741629
742213
|
if (existsSync170(archeFile))
|
|
741630
|
-
variants = JSON.parse(
|
|
742214
|
+
variants = JSON.parse(readFileSync140(archeFile, "utf8"));
|
|
741631
742215
|
} catch {
|
|
741632
742216
|
}
|
|
741633
742217
|
variants.push({
|
|
@@ -741767,7 +742351,7 @@ import { spawn as spawn39 } from "node:child_process";
|
|
|
741767
742351
|
import {
|
|
741768
742352
|
mkdirSync as mkdirSync110,
|
|
741769
742353
|
writeFileSync as writeFileSync93,
|
|
741770
|
-
readFileSync as
|
|
742354
|
+
readFileSync as readFileSync141,
|
|
741771
742355
|
readdirSync as readdirSync61,
|
|
741772
742356
|
existsSync as existsSync171
|
|
741773
742357
|
} from "node:fs";
|
|
@@ -741975,7 +742559,7 @@ function statusCommand(jobId, repoPath2) {
|
|
|
741975
742559
|
console.log(`Available jobs: omnius jobs`);
|
|
741976
742560
|
process.exit(1);
|
|
741977
742561
|
}
|
|
741978
|
-
const job = JSON.parse(
|
|
742562
|
+
const job = JSON.parse(readFileSync141(file, "utf-8"));
|
|
741979
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`;
|
|
741980
742564
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
741981
742565
|
console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
|
|
@@ -741997,7 +742581,7 @@ function jobsCommand(repoPath2) {
|
|
|
741997
742581
|
console.log("Jobs:");
|
|
741998
742582
|
for (const file of files) {
|
|
741999
742583
|
try {
|
|
742000
|
-
const job = JSON.parse(
|
|
742584
|
+
const job = JSON.parse(readFileSync141(join184(dir, file), "utf-8"));
|
|
742001
742585
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
742002
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`;
|
|
742003
742587
|
const cleanListTask = cleanForStorage(job.task) || job.task;
|