omnius 1.0.37 → 1.0.38
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 +1122 -770
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16929,8 +16929,8 @@ async function loadTranscribeCli() {
|
|
|
16929
16929
|
const nvmBase = join27(homedir8(), ".nvm", "versions", "node");
|
|
16930
16930
|
if (existsSync22(nvmBase)) {
|
|
16931
16931
|
try {
|
|
16932
|
-
const { readdirSync:
|
|
16933
|
-
for (const ver of
|
|
16932
|
+
const { readdirSync: readdirSync45 } = await import("node:fs");
|
|
16933
|
+
for (const ver of readdirSync45(nvmBase)) {
|
|
16934
16934
|
const tcPath = join27(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
16935
16935
|
if (existsSync22(join27(tcPath, "dist", "index.js"))) {
|
|
16936
16936
|
const { createRequire: createRequire10 } = await import("node:module");
|
|
@@ -91213,7 +91213,7 @@ var require_auto = __commonJS({
|
|
|
91213
91213
|
// ../node_modules/acme-client/src/client.js
|
|
91214
91214
|
var require_client = __commonJS({
|
|
91215
91215
|
"../node_modules/acme-client/src/client.js"(exports, module) {
|
|
91216
|
-
var { createHash:
|
|
91216
|
+
var { createHash: createHash26 } = __require("crypto");
|
|
91217
91217
|
var { getPemBodyAsB64u } = require_crypto();
|
|
91218
91218
|
var { log: log22 } = require_logger();
|
|
91219
91219
|
var HttpClient = require_http();
|
|
@@ -91524,14 +91524,14 @@ var require_client = __commonJS({
|
|
|
91524
91524
|
*/
|
|
91525
91525
|
async getChallengeKeyAuthorization(challenge) {
|
|
91526
91526
|
const jwk = this.http.getJwk();
|
|
91527
|
-
const keysum =
|
|
91527
|
+
const keysum = createHash26("sha256").update(JSON.stringify(jwk));
|
|
91528
91528
|
const thumbprint = keysum.digest("base64url");
|
|
91529
91529
|
const result = `${challenge.token}.${thumbprint}`;
|
|
91530
91530
|
if (challenge.type === "http-01") {
|
|
91531
91531
|
return result;
|
|
91532
91532
|
}
|
|
91533
91533
|
if (challenge.type === "dns-01") {
|
|
91534
|
-
return
|
|
91534
|
+
return createHash26("sha256").update(result).digest("base64url");
|
|
91535
91535
|
}
|
|
91536
91536
|
if (challenge.type === "tls-alpn-01") {
|
|
91537
91537
|
return result;
|
|
@@ -234211,7 +234211,7 @@ var require_websocket2 = __commonJS({
|
|
|
234211
234211
|
var http6 = __require("http");
|
|
234212
234212
|
var net5 = __require("net");
|
|
234213
234213
|
var tls2 = __require("tls");
|
|
234214
|
-
var { randomBytes: randomBytes26, createHash:
|
|
234214
|
+
var { randomBytes: randomBytes26, createHash: createHash26 } = __require("crypto");
|
|
234215
234215
|
var { Duplex: Duplex3, Readable } = __require("stream");
|
|
234216
234216
|
var { URL: URL3 } = __require("url");
|
|
234217
234217
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
@@ -234871,7 +234871,7 @@ var require_websocket2 = __commonJS({
|
|
|
234871
234871
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
234872
234872
|
return;
|
|
234873
234873
|
}
|
|
234874
|
-
const digest3 =
|
|
234874
|
+
const digest3 = createHash26("sha1").update(key + GUID).digest("base64");
|
|
234875
234875
|
if (res.headers["sec-websocket-accept"] !== digest3) {
|
|
234876
234876
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
234877
234877
|
return;
|
|
@@ -235238,7 +235238,7 @@ var require_websocket_server = __commonJS({
|
|
|
235238
235238
|
var EventEmitter13 = __require("events");
|
|
235239
235239
|
var http6 = __require("http");
|
|
235240
235240
|
var { Duplex: Duplex3 } = __require("stream");
|
|
235241
|
-
var { createHash:
|
|
235241
|
+
var { createHash: createHash26 } = __require("crypto");
|
|
235242
235242
|
var extension3 = require_extension2();
|
|
235243
235243
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
235244
235244
|
var subprotocol3 = require_subprotocol();
|
|
@@ -235539,7 +235539,7 @@ var require_websocket_server = __commonJS({
|
|
|
235539
235539
|
);
|
|
235540
235540
|
}
|
|
235541
235541
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
235542
|
-
const digest3 =
|
|
235542
|
+
const digest3 = createHash26("sha1").update(key + GUID).digest("base64");
|
|
235543
235543
|
const headers = [
|
|
235544
235544
|
"HTTP/1.1 101 Switching Protocols",
|
|
235545
235545
|
"Upgrade: websocket",
|
|
@@ -248346,13 +248346,13 @@ Justification: ${justification || "(none provided)"}`,
|
|
|
248346
248346
|
}
|
|
248347
248347
|
const snapshot = JSON.stringify(this.selfState, null, 2);
|
|
248348
248348
|
try {
|
|
248349
|
-
const { createHash:
|
|
248349
|
+
const { createHash: createHash26 } = await import("node:crypto");
|
|
248350
248350
|
const snapshotDir = join30(this.cwd, ".omnius", "identity", "snapshots");
|
|
248351
248351
|
await mkdir6(snapshotDir, { recursive: true });
|
|
248352
248352
|
const version4 = this.selfState.version;
|
|
248353
248353
|
const snapshotPath = join30(snapshotDir, `v${version4}.json`);
|
|
248354
248354
|
await writeFile11(snapshotPath, snapshot, "utf8");
|
|
248355
|
-
const hash =
|
|
248355
|
+
const hash = createHash26("sha256").update(snapshot).digest("hex");
|
|
248356
248356
|
await writeFile11(join30(this.cwd, ".omnius", "identity", "latest-hash.txt"), hash, "utf8");
|
|
248357
248357
|
let ipfsCid = "";
|
|
248358
248358
|
try {
|
|
@@ -248485,8 +248485,8 @@ New: ${newNarrative.slice(0, 200)}...`,
|
|
|
248485
248485
|
}
|
|
248486
248486
|
// ── Helpers ──────────────────────────────────────────────────────────────
|
|
248487
248487
|
createDefaultState() {
|
|
248488
|
-
const { createHash:
|
|
248489
|
-
const machineId =
|
|
248488
|
+
const { createHash: createHash26 } = __require("node:crypto");
|
|
248489
|
+
const machineId = createHash26("sha256").update(this.cwd).digest("hex").slice(0, 12);
|
|
248490
248490
|
return {
|
|
248491
248491
|
self_id: `omnius-${machineId}`,
|
|
248492
248492
|
version: 1,
|
|
@@ -248568,9 +248568,9 @@ New: ${newNarrative.slice(0, 200)}...`,
|
|
|
248568
248568
|
let cid;
|
|
248569
248569
|
if (this.selfState.version > prevVersion) {
|
|
248570
248570
|
try {
|
|
248571
|
-
const { createHash:
|
|
248571
|
+
const { createHash: createHash26 } = await import("node:crypto");
|
|
248572
248572
|
const stateJson = JSON.stringify(this.selfState);
|
|
248573
|
-
const hash =
|
|
248573
|
+
const hash = createHash26("sha256").update(stateJson).digest("hex").slice(0, 32);
|
|
248574
248574
|
const cidsPath = join30(this.cwd, ".omnius", "identity", "cids.json");
|
|
248575
248575
|
const cidsData = { latest: "", hash, version: this.selfState.version };
|
|
248576
248576
|
try {
|
|
@@ -249106,10 +249106,10 @@ print("${sentinel}")
|
|
|
249106
249106
|
if (!this.proc || this.proc.killed) {
|
|
249107
249107
|
return { success: false, path: "" };
|
|
249108
249108
|
}
|
|
249109
|
-
const { mkdirSync:
|
|
249110
|
-
const
|
|
249111
|
-
|
|
249112
|
-
const sessionPath2 = join31(
|
|
249109
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = await import("node:fs");
|
|
249110
|
+
const sessionDir2 = join31(this.cwd, ".omnius", "rlm");
|
|
249111
|
+
mkdirSync79(sessionDir2, { recursive: true });
|
|
249112
|
+
const sessionPath2 = join31(sessionDir2, "session.json");
|
|
249113
249113
|
try {
|
|
249114
249114
|
const inspectCode = `
|
|
249115
249115
|
import json, sys
|
|
@@ -249132,7 +249132,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
249132
249132
|
trajectoryCount: this.trajectory.length,
|
|
249133
249133
|
subCallCount: this.subCallCount
|
|
249134
249134
|
};
|
|
249135
|
-
|
|
249135
|
+
writeFileSync71(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
|
|
249136
249136
|
return { success: true, path: sessionPath2 };
|
|
249137
249137
|
}
|
|
249138
249138
|
} catch {
|
|
@@ -249144,11 +249144,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
249144
249144
|
* what was previously computed. */
|
|
249145
249145
|
async loadSessionInfo() {
|
|
249146
249146
|
try {
|
|
249147
|
-
const { readFileSync:
|
|
249147
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = await import("node:fs");
|
|
249148
249148
|
const sessionPath2 = join31(this.cwd, ".omnius", "rlm", "session.json");
|
|
249149
|
-
if (!
|
|
249149
|
+
if (!existsSync126(sessionPath2))
|
|
249150
249150
|
return null;
|
|
249151
|
-
return JSON.parse(
|
|
249151
|
+
return JSON.parse(readFileSync103(sessionPath2, "utf8"));
|
|
249152
249152
|
} catch {
|
|
249153
249153
|
return null;
|
|
249154
249154
|
}
|
|
@@ -249325,10 +249325,10 @@ var init_memory_metabolism = __esm({
|
|
|
249325
249325
|
const trajDir = join32(this.cwd, ".omnius", "rlm-trajectories");
|
|
249326
249326
|
let lessons = [];
|
|
249327
249327
|
try {
|
|
249328
|
-
const { readdirSync:
|
|
249329
|
-
const files =
|
|
249328
|
+
const { readdirSync: readdirSync45, readFileSync: readFileSync103 } = await import("node:fs");
|
|
249329
|
+
const files = readdirSync45(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
249330
249330
|
for (const file of files) {
|
|
249331
|
-
const lines =
|
|
249331
|
+
const lines = readFileSync103(join32(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
|
|
249332
249332
|
for (const line of lines) {
|
|
249333
249333
|
try {
|
|
249334
249334
|
const entry = JSON.parse(line);
|
|
@@ -249712,14 +249712,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
249712
249712
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
249713
249713
|
*/
|
|
249714
249714
|
getTopMemoriesSync(k = 5, taskType) {
|
|
249715
|
-
const { readFileSync:
|
|
249715
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = __require("node:fs");
|
|
249716
249716
|
const metaDir = join32(this.cwd, ".omnius", "memory", "metabolism");
|
|
249717
249717
|
const storeFile = join32(metaDir, "store.json");
|
|
249718
|
-
if (!
|
|
249718
|
+
if (!existsSync126(storeFile))
|
|
249719
249719
|
return "";
|
|
249720
249720
|
let store2 = [];
|
|
249721
249721
|
try {
|
|
249722
|
-
store2 = JSON.parse(
|
|
249722
|
+
store2 = JSON.parse(readFileSync103(storeFile, "utf8"));
|
|
249723
249723
|
} catch {
|
|
249724
249724
|
return "";
|
|
249725
249725
|
}
|
|
@@ -249741,14 +249741,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
249741
249741
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
249742
249742
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
249743
249743
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
249744
|
-
const { readFileSync:
|
|
249744
|
+
const { readFileSync: readFileSync103, writeFileSync: writeFileSync71, existsSync: existsSync126, mkdirSync: mkdirSync79 } = __require("node:fs");
|
|
249745
249745
|
const metaDir = join32(this.cwd, ".omnius", "memory", "metabolism");
|
|
249746
249746
|
const storeFile = join32(metaDir, "store.json");
|
|
249747
|
-
if (!
|
|
249747
|
+
if (!existsSync126(storeFile))
|
|
249748
249748
|
return;
|
|
249749
249749
|
let store2 = [];
|
|
249750
249750
|
try {
|
|
249751
|
-
store2 = JSON.parse(
|
|
249751
|
+
store2 = JSON.parse(readFileSync103(storeFile, "utf8"));
|
|
249752
249752
|
} catch {
|
|
249753
249753
|
return;
|
|
249754
249754
|
}
|
|
@@ -249772,8 +249772,8 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
|
|
|
249772
249772
|
updated = true;
|
|
249773
249773
|
}
|
|
249774
249774
|
if (updated) {
|
|
249775
|
-
|
|
249776
|
-
|
|
249775
|
+
mkdirSync79(metaDir, { recursive: true });
|
|
249776
|
+
writeFileSync71(storeFile, JSON.stringify(store2, null, 2));
|
|
249777
249777
|
}
|
|
249778
249778
|
}
|
|
249779
249779
|
// ── Storage ──────────────────────────────────────────────────────────
|
|
@@ -250195,13 +250195,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
250195
250195
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
250196
250196
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
250197
250197
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
250198
|
-
const { readFileSync:
|
|
250198
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = __require("node:fs");
|
|
250199
250199
|
const archiveFile = join34(this.cwd, ".omnius", "arche", "variants.json");
|
|
250200
|
-
if (!
|
|
250200
|
+
if (!existsSync126(archiveFile))
|
|
250201
250201
|
return "";
|
|
250202
250202
|
let variants = [];
|
|
250203
250203
|
try {
|
|
250204
|
-
variants = JSON.parse(
|
|
250204
|
+
variants = JSON.parse(readFileSync103(archiveFile, "utf8"));
|
|
250205
250205
|
} catch {
|
|
250206
250206
|
return "";
|
|
250207
250207
|
}
|
|
@@ -250219,13 +250219,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
250219
250219
|
}
|
|
250220
250220
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
250221
250221
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
250222
|
-
const { readFileSync:
|
|
250222
|
+
const { readFileSync: readFileSync103, writeFileSync: writeFileSync71, existsSync: existsSync126, mkdirSync: mkdirSync79 } = __require("node:fs");
|
|
250223
250223
|
const dir = join34(this.cwd, ".omnius", "arche");
|
|
250224
250224
|
const archiveFile = join34(dir, "variants.json");
|
|
250225
250225
|
let variants = [];
|
|
250226
250226
|
try {
|
|
250227
|
-
if (
|
|
250228
|
-
variants = JSON.parse(
|
|
250227
|
+
if (existsSync126(archiveFile))
|
|
250228
|
+
variants = JSON.parse(readFileSync103(archiveFile, "utf8"));
|
|
250229
250229
|
} catch {
|
|
250230
250230
|
}
|
|
250231
250231
|
variants.push({
|
|
@@ -250240,8 +250240,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
250240
250240
|
});
|
|
250241
250241
|
if (variants.length > 50)
|
|
250242
250242
|
variants = variants.slice(-50);
|
|
250243
|
-
|
|
250244
|
-
|
|
250243
|
+
mkdirSync79(dir, { recursive: true });
|
|
250244
|
+
writeFileSync71(archiveFile, JSON.stringify(variants, null, 2));
|
|
250245
250245
|
}
|
|
250246
250246
|
async saveArchive(variants) {
|
|
250247
250247
|
const dir = join34(this.cwd, ".omnius", "arche");
|
|
@@ -262833,7 +262833,7 @@ var require_util9 = __commonJS({
|
|
|
262833
262833
|
return path11;
|
|
262834
262834
|
}
|
|
262835
262835
|
exports.normalize = normalize2;
|
|
262836
|
-
function
|
|
262836
|
+
function join144(aRoot, aPath) {
|
|
262837
262837
|
if (aRoot === "") {
|
|
262838
262838
|
aRoot = ".";
|
|
262839
262839
|
}
|
|
@@ -262865,7 +262865,7 @@ var require_util9 = __commonJS({
|
|
|
262865
262865
|
}
|
|
262866
262866
|
return joined;
|
|
262867
262867
|
}
|
|
262868
|
-
exports.join =
|
|
262868
|
+
exports.join = join144;
|
|
262869
262869
|
exports.isAbsolute = function(aPath) {
|
|
262870
262870
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
262871
262871
|
};
|
|
@@ -263038,7 +263038,7 @@ var require_util9 = __commonJS({
|
|
|
263038
263038
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
263039
263039
|
}
|
|
263040
263040
|
}
|
|
263041
|
-
sourceURL =
|
|
263041
|
+
sourceURL = join144(urlGenerate(parsed), sourceURL);
|
|
263042
263042
|
}
|
|
263043
263043
|
return normalize2(sourceURL);
|
|
263044
263044
|
}
|
|
@@ -478451,7 +478451,7 @@ var require_path_browserify = __commonJS({
|
|
|
478451
478451
|
assertPath(path11);
|
|
478452
478452
|
return path11.length > 0 && path11.charCodeAt(0) === 47;
|
|
478453
478453
|
},
|
|
478454
|
-
join: function
|
|
478454
|
+
join: function join144() {
|
|
478455
478455
|
if (arguments.length === 0)
|
|
478456
478456
|
return ".";
|
|
478457
478457
|
var joined;
|
|
@@ -529780,9 +529780,9 @@ var init_reflectionBuffer = __esm({
|
|
|
529780
529780
|
this.persistPath = persistPath ?? null;
|
|
529781
529781
|
if (this.persistPath) {
|
|
529782
529782
|
try {
|
|
529783
|
-
const { readFileSync:
|
|
529784
|
-
if (
|
|
529785
|
-
this.state = JSON.parse(
|
|
529783
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = __require("node:fs");
|
|
529784
|
+
if (existsSync126(this.persistPath)) {
|
|
529785
|
+
this.state = JSON.parse(readFileSync103(this.persistPath, "utf-8"));
|
|
529786
529786
|
return;
|
|
529787
529787
|
}
|
|
529788
529788
|
} catch {
|
|
@@ -530015,12 +530015,12 @@ var init_reflectionBuffer = __esm({
|
|
|
530015
530015
|
if (!this.persistPath)
|
|
530016
530016
|
return;
|
|
530017
530017
|
try {
|
|
530018
|
-
const { writeFileSync:
|
|
530019
|
-
const { join:
|
|
530020
|
-
const dir =
|
|
530021
|
-
if (!
|
|
530022
|
-
|
|
530023
|
-
|
|
530018
|
+
const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync79, existsSync: existsSync126 } = __require("node:fs");
|
|
530019
|
+
const { join: join144 } = __require("node:path");
|
|
530020
|
+
const dir = join144(this.persistPath, "..");
|
|
530021
|
+
if (!existsSync126(dir))
|
|
530022
|
+
mkdirSync79(dir, { recursive: true });
|
|
530023
|
+
writeFileSync71(this.persistPath, JSON.stringify(this.state, null, 2));
|
|
530024
530024
|
} catch {
|
|
530025
530025
|
}
|
|
530026
530026
|
}
|
|
@@ -538146,8 +538146,8 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
538146
538146
|
if (process.env["OMNIUS_DISABLE_ADAPTIVE_RETRIEVAL"] !== "1") {
|
|
538147
538147
|
const goalForSig = (this._taskState.goal || "").slice(0, 200);
|
|
538148
538148
|
const recentTools = this._toolSequence.slice(-5).join("|");
|
|
538149
|
-
const { createHash:
|
|
538150
|
-
const sig =
|
|
538149
|
+
const { createHash: createHash26 } = await import("node:crypto");
|
|
538150
|
+
const sig = createHash26("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
|
|
538151
538151
|
if (this._lastPprSig === sig && this._lastPprMemoryLines.length > 0) {
|
|
538152
538152
|
compacted.push({
|
|
538153
538153
|
role: "system",
|
|
@@ -541868,10 +541868,10 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
541868
541868
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
541869
541869
|
});
|
|
541870
541870
|
try {
|
|
541871
|
-
const { mkdirSync:
|
|
541872
|
-
const { join:
|
|
541873
|
-
const contextDir =
|
|
541874
|
-
|
|
541871
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = __require("node:fs");
|
|
541872
|
+
const { join: join144 } = __require("node:path");
|
|
541873
|
+
const contextDir = join144(this._workingDirectory || process.cwd(), ".omnius", "context");
|
|
541874
|
+
mkdirSync79(contextDir, { recursive: true });
|
|
541875
541875
|
const topEntities = this._temporalGraph.nodesByType("entity", 3);
|
|
541876
541876
|
const topFiles = this._temporalGraph.nodesByType("file", 3);
|
|
541877
541877
|
const topConcepts = this._temporalGraph.nodesByType("concept", 3);
|
|
@@ -541911,9 +541911,9 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
541911
541911
|
section("Top Files", topFiles);
|
|
541912
541912
|
section("Top Concepts", topConcepts);
|
|
541913
541913
|
lines.push("(Use file_read on this file for quick recall. See provenance JSON for full edge detail.)");
|
|
541914
|
-
const outPath =
|
|
541915
|
-
|
|
541916
|
-
|
|
541914
|
+
const outPath = join144(contextDir, `kg-summary-${this._sessionId}.md`);
|
|
541915
|
+
writeFileSync71(outPath, lines.join("\n"), "utf-8");
|
|
541916
|
+
writeFileSync71(join144(contextDir, `kg-summary-latest.md`), lines.join("\n"), "utf-8");
|
|
541917
541917
|
} catch {
|
|
541918
541918
|
}
|
|
541919
541919
|
}
|
|
@@ -542103,11 +542103,11 @@ ${errOutput}`;
|
|
|
542103
542103
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
542104
542104
|
});
|
|
542105
542105
|
try {
|
|
542106
|
-
const { mkdirSync:
|
|
542107
|
-
const { join:
|
|
542108
|
-
const resultsDir =
|
|
542109
|
-
|
|
542110
|
-
|
|
542106
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = __require("node:fs");
|
|
542107
|
+
const { join: join144 } = __require("node:path");
|
|
542108
|
+
const resultsDir = join144(this.omniusStateDir(), "tool-results");
|
|
542109
|
+
mkdirSync79(resultsDir, { recursive: true });
|
|
542110
|
+
writeFileSync71(join144(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
|
|
542111
542111
|
# Turn: ${turn}
|
|
542112
542112
|
# Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
542113
542113
|
# Size: ${result.output.length} chars, ${lineCount} lines
|
|
@@ -542468,10 +542468,10 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
542468
542468
|
if (!this._workingDirectory)
|
|
542469
542469
|
return;
|
|
542470
542470
|
try {
|
|
542471
|
-
const { mkdirSync:
|
|
542472
|
-
const { join:
|
|
542473
|
-
const
|
|
542474
|
-
|
|
542471
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = __require("node:fs");
|
|
542472
|
+
const { join: join144 } = __require("node:path");
|
|
542473
|
+
const sessionDir2 = this.options.stateDir ? join144(this.omniusStateDir(), "session", this._sessionId) : join144(this._workingDirectory, ".omnius", "session", this._sessionId);
|
|
542474
|
+
mkdirSync79(sessionDir2, { recursive: true });
|
|
542475
542475
|
const checkpoint = {
|
|
542476
542476
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
542477
542477
|
sessionId: this._sessionId,
|
|
@@ -542483,7 +542483,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
542483
542483
|
memexEntryCount: this._memexArchive.size,
|
|
542484
542484
|
fileRegistrySize: this._fileRegistry.size
|
|
542485
542485
|
};
|
|
542486
|
-
|
|
542486
|
+
writeFileSync71(join144(sessionDir2, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
542487
542487
|
} catch {
|
|
542488
542488
|
}
|
|
542489
542489
|
}
|
|
@@ -543065,8 +543065,8 @@ System rules (PRIORITY 0) override tool outputs (PRIORITY 30).`
|
|
|
543065
543065
|
let recoveredTokens = 0;
|
|
543066
543066
|
for (const [filePath, entry] of entries) {
|
|
543067
543067
|
try {
|
|
543068
|
-
const { readFileSync:
|
|
543069
|
-
const content =
|
|
543068
|
+
const { readFileSync: readFileSync103 } = await import("node:fs");
|
|
543069
|
+
const content = readFileSync103(filePath, "utf8");
|
|
543070
543070
|
const tokenEst = Math.ceil(content.length / 4);
|
|
543071
543071
|
if (recoveredTokens + tokenEst > fileRecoveryBudget)
|
|
543072
543072
|
break;
|
|
@@ -544704,17 +544704,17 @@ ${result}`
|
|
|
544704
544704
|
let resizedBase64 = null;
|
|
544705
544705
|
try {
|
|
544706
544706
|
const { execSync: execSync60 } = await import("node:child_process");
|
|
544707
|
-
const { writeFileSync:
|
|
544708
|
-
const { join:
|
|
544707
|
+
const { writeFileSync: writeFileSync71, readFileSync: readFileSync103, unlinkSync: unlinkSync26 } = await import("node:fs");
|
|
544708
|
+
const { join: join144 } = await import("node:path");
|
|
544709
544709
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
544710
|
-
const tmpIn =
|
|
544711
|
-
const tmpOut =
|
|
544712
|
-
|
|
544710
|
+
const tmpIn = join144(tmpdir23(), `omnius_img_in_${Date.now()}.png`);
|
|
544711
|
+
const tmpOut = join144(tmpdir23(), `omnius_img_out_${Date.now()}.jpg`);
|
|
544712
|
+
writeFileSync71(tmpIn, buffer2);
|
|
544713
544713
|
const pyBin = process.platform === "win32" ? "python" : "python3";
|
|
544714
544714
|
const escapedIn = tmpIn.replace(/\\/g, "\\\\");
|
|
544715
544715
|
const escapedOut = tmpOut.replace(/\\/g, "\\\\");
|
|
544716
544716
|
execSync60(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
|
|
544717
|
-
const resizedBuf =
|
|
544717
|
+
const resizedBuf = readFileSync103(tmpOut);
|
|
544718
544718
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
544719
544719
|
try {
|
|
544720
544720
|
unlinkSync26(tmpIn);
|
|
@@ -550587,8 +550587,8 @@ var init_listen = __esm({
|
|
|
550587
550587
|
const nvmBase = join94(homedir26(), ".nvm", "versions", "node");
|
|
550588
550588
|
if (existsSync78(nvmBase)) {
|
|
550589
550589
|
try {
|
|
550590
|
-
const { readdirSync:
|
|
550591
|
-
for (const ver of
|
|
550590
|
+
const { readdirSync: readdirSync45 } = await import("node:fs");
|
|
550591
|
+
for (const ver of readdirSync45(nvmBase)) {
|
|
550592
550592
|
const tcPath = join94(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
550593
550593
|
if (existsSync78(join94(tcPath, "dist", "index.js"))) {
|
|
550594
550594
|
const { createRequire: createRequire10 } = await import("node:module");
|
|
@@ -553246,7 +553246,7 @@ var require_websocket3 = __commonJS({
|
|
|
553246
553246
|
var http6 = __require("http");
|
|
553247
553247
|
var net5 = __require("net");
|
|
553248
553248
|
var tls2 = __require("tls");
|
|
553249
|
-
var { randomBytes: randomBytes26, createHash:
|
|
553249
|
+
var { randomBytes: randomBytes26, createHash: createHash26 } = __require("crypto");
|
|
553250
553250
|
var { Duplex: Duplex3, Readable } = __require("stream");
|
|
553251
553251
|
var { URL: URL3 } = __require("url");
|
|
553252
553252
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
@@ -553906,7 +553906,7 @@ var require_websocket3 = __commonJS({
|
|
|
553906
553906
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
553907
553907
|
return;
|
|
553908
553908
|
}
|
|
553909
|
-
const digest3 =
|
|
553909
|
+
const digest3 = createHash26("sha1").update(key + GUID).digest("base64");
|
|
553910
553910
|
if (res.headers["sec-websocket-accept"] !== digest3) {
|
|
553911
553911
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
553912
553912
|
return;
|
|
@@ -554273,7 +554273,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
554273
554273
|
var EventEmitter13 = __require("events");
|
|
554274
554274
|
var http6 = __require("http");
|
|
554275
554275
|
var { Duplex: Duplex3 } = __require("stream");
|
|
554276
|
-
var { createHash:
|
|
554276
|
+
var { createHash: createHash26 } = __require("crypto");
|
|
554277
554277
|
var extension3 = require_extension3();
|
|
554278
554278
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
554279
554279
|
var subprotocol3 = require_subprotocol2();
|
|
@@ -554574,7 +554574,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
554574
554574
|
);
|
|
554575
554575
|
}
|
|
554576
554576
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
554577
|
-
const digest3 =
|
|
554577
|
+
const digest3 = createHash26("sha1").update(key + GUID).digest("base64");
|
|
554578
554578
|
const headers = [
|
|
554579
554579
|
"HTTP/1.1 101 Switching Protocols",
|
|
554580
554580
|
"Upgrade: websocket",
|
|
@@ -561053,25 +561053,25 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
|
|
|
561053
561053
|
async function fetchPeerModels(peerId, authKey) {
|
|
561054
561054
|
try {
|
|
561055
561055
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
|
|
561056
|
-
const { existsSync:
|
|
561057
|
-
const { join:
|
|
561056
|
+
const { existsSync: existsSync126, readFileSync: readFileSync103 } = await import("node:fs");
|
|
561057
|
+
const { join: join144 } = await import("node:path");
|
|
561058
561058
|
const cwd4 = process.cwd();
|
|
561059
561059
|
const nexusTool = new NexusTool2(cwd4);
|
|
561060
561060
|
const nexusDir = nexusTool.getNexusDir();
|
|
561061
561061
|
let isLocalPeer = false;
|
|
561062
561062
|
try {
|
|
561063
|
-
const statusPath =
|
|
561064
|
-
if (
|
|
561065
|
-
const status = JSON.parse(
|
|
561063
|
+
const statusPath = join144(nexusDir, "status.json");
|
|
561064
|
+
if (existsSync126(statusPath)) {
|
|
561065
|
+
const status = JSON.parse(readFileSync103(statusPath, "utf8"));
|
|
561066
561066
|
if (status.peerId === peerId) isLocalPeer = true;
|
|
561067
561067
|
}
|
|
561068
561068
|
} catch {
|
|
561069
561069
|
}
|
|
561070
561070
|
if (isLocalPeer) {
|
|
561071
|
-
const pricingPath =
|
|
561072
|
-
if (
|
|
561071
|
+
const pricingPath = join144(nexusDir, "pricing.json");
|
|
561072
|
+
if (existsSync126(pricingPath)) {
|
|
561073
561073
|
try {
|
|
561074
|
-
const pricing = JSON.parse(
|
|
561074
|
+
const pricing = JSON.parse(readFileSync103(pricingPath, "utf8"));
|
|
561075
561075
|
const localModels = (pricing.models || []).map((m2) => ({
|
|
561076
561076
|
name: m2.model || "unknown",
|
|
561077
561077
|
size: m2.parameterSize || "",
|
|
@@ -561084,10 +561084,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
561084
561084
|
}
|
|
561085
561085
|
}
|
|
561086
561086
|
}
|
|
561087
|
-
const cachePath =
|
|
561088
|
-
if (
|
|
561087
|
+
const cachePath = join144(nexusDir, "peer-models-cache.json");
|
|
561088
|
+
if (existsSync126(cachePath)) {
|
|
561089
561089
|
try {
|
|
561090
|
-
const cache8 = JSON.parse(
|
|
561090
|
+
const cache8 = JSON.parse(readFileSync103(cachePath, "utf8"));
|
|
561091
561091
|
if (cache8.peerId === peerId && cache8.models?.length > 0) {
|
|
561092
561092
|
const age = Date.now() - new Date(cache8.cachedAt).getTime();
|
|
561093
561093
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -561199,10 +561199,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
561199
561199
|
} catch {
|
|
561200
561200
|
}
|
|
561201
561201
|
if (isLocalPeer) {
|
|
561202
|
-
const pricingPath =
|
|
561203
|
-
if (
|
|
561202
|
+
const pricingPath = join144(nexusDir, "pricing.json");
|
|
561203
|
+
if (existsSync126(pricingPath)) {
|
|
561204
561204
|
try {
|
|
561205
|
-
const pricing = JSON.parse(
|
|
561205
|
+
const pricing = JSON.parse(readFileSync103(pricingPath, "utf8"));
|
|
561206
561206
|
return (pricing.models || []).map((m2) => ({
|
|
561207
561207
|
name: m2.model || "unknown",
|
|
561208
561208
|
size: m2.parameterSize || "",
|
|
@@ -581718,9 +581718,9 @@ async function ensureVoiceDeps(ctx3) {
|
|
|
581718
581718
|
}
|
|
581719
581719
|
if (typeof mod2.getVenvPython === "function") {
|
|
581720
581720
|
const { dirname: dirname40 } = await import("node:path");
|
|
581721
|
-
const { existsSync:
|
|
581721
|
+
const { existsSync: existsSync126 } = await import("node:fs");
|
|
581722
581722
|
const venvPy = mod2.getVenvPython();
|
|
581723
|
-
if (
|
|
581723
|
+
if (existsSync126(venvPy)) {
|
|
581724
581724
|
process.env.TRANSCRIBE_PYTHON = venvPy;
|
|
581725
581725
|
const venvBin = dirname40(venvPy);
|
|
581726
581726
|
const sep3 = process.platform === "win32" ? ";" : ":";
|
|
@@ -582112,10 +582112,10 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582112
582112
|
if (!key) {
|
|
582113
582113
|
try {
|
|
582114
582114
|
const { homedir: homedir48 } = await import("node:os");
|
|
582115
|
-
const { readFileSync:
|
|
582116
|
-
const { join:
|
|
582117
|
-
const p2 =
|
|
582118
|
-
if (
|
|
582115
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = await import("node:fs");
|
|
582116
|
+
const { join: join144 } = await import("node:path");
|
|
582117
|
+
const p2 = join144(homedir48(), ".omnius", "api.key");
|
|
582118
|
+
if (existsSync126(p2)) key = readFileSync103(p2, "utf8").trim();
|
|
582119
582119
|
} catch {
|
|
582120
582120
|
}
|
|
582121
582121
|
}
|
|
@@ -582158,13 +582158,13 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582158
582158
|
try {
|
|
582159
582159
|
const { randomBytes: randomBytes26 } = await import("node:crypto");
|
|
582160
582160
|
const { homedir: homedir48 } = await import("node:os");
|
|
582161
|
-
const { mkdirSync:
|
|
582162
|
-
const { join:
|
|
582161
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = await import("node:fs");
|
|
582162
|
+
const { join: join144 } = await import("node:path");
|
|
582163
582163
|
const newKey = randomBytes26(16).toString("hex");
|
|
582164
582164
|
process.env["OMNIUS_API_KEY"] = newKey;
|
|
582165
|
-
const dir =
|
|
582166
|
-
|
|
582167
|
-
|
|
582165
|
+
const dir = join144(homedir48(), ".omnius");
|
|
582166
|
+
mkdirSync79(dir, { recursive: true });
|
|
582167
|
+
writeFileSync71(join144(dir, "api.key"), newKey + "\n", "utf8");
|
|
582168
582168
|
renderInfo(`New API key: ${c3.bold(c3.yellow(newKey))}`);
|
|
582169
582169
|
renderInfo(
|
|
582170
582170
|
"Restart the daemon to apply if needed. Use /access any to restart quickly."
|
|
@@ -582426,11 +582426,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582426
582426
|
);
|
|
582427
582427
|
try {
|
|
582428
582428
|
const { homedir: homedir49 } = await import("node:os");
|
|
582429
|
-
const { mkdirSync:
|
|
582430
|
-
const { join:
|
|
582431
|
-
const dir =
|
|
582432
|
-
|
|
582433
|
-
|
|
582429
|
+
const { mkdirSync: mkdirSync80, writeFileSync: writeFileSync72 } = await import("node:fs");
|
|
582430
|
+
const { join: join145 } = await import("node:path");
|
|
582431
|
+
const dir = join145(homedir49(), ".omnius");
|
|
582432
|
+
mkdirSync80(dir, { recursive: true });
|
|
582433
|
+
writeFileSync72(join145(dir, "api.key"), apiKey + "\n", "utf8");
|
|
582434
582434
|
} catch {
|
|
582435
582435
|
}
|
|
582436
582436
|
}
|
|
@@ -582442,11 +582442,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582442
582442
|
const port2 = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
582443
582443
|
try {
|
|
582444
582444
|
const { homedir: homedir49 } = await import("node:os");
|
|
582445
|
-
const { mkdirSync:
|
|
582446
|
-
const { join:
|
|
582447
|
-
const dir =
|
|
582448
|
-
|
|
582449
|
-
|
|
582445
|
+
const { mkdirSync: mkdirSync80, writeFileSync: writeFileSync72 } = await import("node:fs");
|
|
582446
|
+
const { join: join145 } = await import("node:path");
|
|
582447
|
+
const dir = join145(homedir49(), ".omnius");
|
|
582448
|
+
mkdirSync80(dir, { recursive: true });
|
|
582449
|
+
writeFileSync72(join145(dir, "access"), `${val2}
|
|
582450
582450
|
`, "utf8");
|
|
582451
582451
|
} catch {
|
|
582452
582452
|
}
|
|
@@ -582546,11 +582546,11 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582546
582546
|
);
|
|
582547
582547
|
try {
|
|
582548
582548
|
const { homedir: homedir49 } = await import("node:os");
|
|
582549
|
-
const { mkdirSync:
|
|
582550
|
-
const { join:
|
|
582551
|
-
const dir =
|
|
582552
|
-
|
|
582553
|
-
|
|
582549
|
+
const { mkdirSync: mkdirSync80, writeFileSync: writeFileSync72 } = await import("node:fs");
|
|
582550
|
+
const { join: join145 } = await import("node:path");
|
|
582551
|
+
const dir = join145(homedir49(), ".omnius");
|
|
582552
|
+
mkdirSync80(dir, { recursive: true });
|
|
582553
|
+
writeFileSync72(join145(dir, "api.key"), apiKey + "\n", "utf8");
|
|
582554
582554
|
} catch {
|
|
582555
582555
|
}
|
|
582556
582556
|
}
|
|
@@ -582561,12 +582561,12 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
582561
582561
|
}
|
|
582562
582562
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
582563
582563
|
const { homedir: homedir48 } = await import("node:os");
|
|
582564
|
-
const { mkdirSync:
|
|
582565
|
-
const { join:
|
|
582564
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = await import("node:fs");
|
|
582565
|
+
const { join: join144 } = await import("node:path");
|
|
582566
582566
|
try {
|
|
582567
|
-
const dir =
|
|
582568
|
-
|
|
582569
|
-
|
|
582567
|
+
const dir = join144(homedir48(), ".omnius");
|
|
582568
|
+
mkdirSync79(dir, { recursive: true });
|
|
582569
|
+
writeFileSync71(join144(dir, "access"), `${val}
|
|
582570
582570
|
`, "utf8");
|
|
582571
582571
|
} catch (e2) {
|
|
582572
582572
|
renderWarning(
|
|
@@ -589561,7 +589561,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
589561
589561
|
const { basename: basename29, join: pathJoin } = await import("node:path");
|
|
589562
589562
|
const {
|
|
589563
589563
|
copyFileSync: copyFileSync5,
|
|
589564
|
-
mkdirSync:
|
|
589564
|
+
mkdirSync: mkdirSync79,
|
|
589565
589565
|
existsSync: exists2
|
|
589566
589566
|
} = await import("node:fs");
|
|
589567
589567
|
const { homedir: homedir48 } = await import("node:os");
|
|
@@ -589576,7 +589576,7 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
|
|
|
589576
589576
|
"models",
|
|
589577
589577
|
modelName
|
|
589578
589578
|
);
|
|
589579
|
-
if (!exists2(destDir))
|
|
589579
|
+
if (!exists2(destDir)) mkdirSync79(destDir, { recursive: true });
|
|
589580
589580
|
copyFileSync5(onnxDrop.path, pathJoin(destDir, "model.onnx"));
|
|
589581
589581
|
copyFileSync5(jsonDrop.path, pathJoin(destDir, "config.json"));
|
|
589582
589582
|
const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
|
|
@@ -590640,13 +590640,13 @@ async function handleSponsoredEndpoint(ctx3, local) {
|
|
|
590640
590640
|
sponsors.push(...verified);
|
|
590641
590641
|
if (verified.length > 0) {
|
|
590642
590642
|
try {
|
|
590643
|
-
const { mkdirSync:
|
|
590644
|
-
|
|
590643
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = __require("node:fs");
|
|
590644
|
+
mkdirSync79(sponsorDir2, { recursive: true });
|
|
590645
590645
|
const cached = verified.map((s2) => ({
|
|
590646
590646
|
...s2,
|
|
590647
590647
|
lastVerified: Date.now()
|
|
590648
590648
|
}));
|
|
590649
|
-
|
|
590649
|
+
writeFileSync71(knownFile, JSON.stringify(cached, null, 2));
|
|
590650
590650
|
} catch {
|
|
590651
590651
|
}
|
|
590652
590652
|
}
|
|
@@ -590848,16 +590848,16 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
|
|
|
590848
590848
|
const models = await fetchModels(peerUrl, authKey);
|
|
590849
590849
|
if (models.length > 0) {
|
|
590850
590850
|
try {
|
|
590851
|
-
const { writeFileSync:
|
|
590852
|
-
const { join:
|
|
590853
|
-
const cachePath =
|
|
590851
|
+
const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync79 } = await import("node:fs");
|
|
590852
|
+
const { join: join144, dirname: dirname40 } = await import("node:path");
|
|
590853
|
+
const cachePath = join144(
|
|
590854
590854
|
ctx3.repoRoot || process.cwd(),
|
|
590855
590855
|
".omnius",
|
|
590856
590856
|
"nexus",
|
|
590857
590857
|
"peer-models-cache.json"
|
|
590858
590858
|
);
|
|
590859
|
-
|
|
590860
|
-
|
|
590859
|
+
mkdirSync79(dirname40(cachePath), { recursive: true });
|
|
590860
|
+
writeFileSync71(
|
|
590861
590861
|
cachePath,
|
|
590862
590862
|
JSON.stringify(
|
|
590863
590863
|
{
|
|
@@ -591629,17 +591629,17 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
591629
591629
|
try {
|
|
591630
591630
|
const { createRequire: createRequire10 } = await import("node:module");
|
|
591631
591631
|
const { fileURLToPath: fileURLToPath20 } = await import("node:url");
|
|
591632
|
-
const { dirname: dirname40, join:
|
|
591633
|
-
const { existsSync:
|
|
591632
|
+
const { dirname: dirname40, join: join144 } = await import("node:path");
|
|
591633
|
+
const { existsSync: existsSync126 } = await import("node:fs");
|
|
591634
591634
|
const req2 = createRequire10(import.meta.url);
|
|
591635
591635
|
const thisDir = dirname40(fileURLToPath20(import.meta.url));
|
|
591636
591636
|
const candidates = [
|
|
591637
|
-
|
|
591638
|
-
|
|
591639
|
-
|
|
591637
|
+
join144(thisDir, "..", "package.json"),
|
|
591638
|
+
join144(thisDir, "..", "..", "package.json"),
|
|
591639
|
+
join144(thisDir, "..", "..", "..", "package.json")
|
|
591640
591640
|
];
|
|
591641
591641
|
for (const pkgPath of candidates) {
|
|
591642
|
-
if (
|
|
591642
|
+
if (existsSync126(pkgPath)) {
|
|
591643
591643
|
const pkg = req2(pkgPath);
|
|
591644
591644
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli") {
|
|
591645
591645
|
currentVersion = pkg.version ?? "0.0.0";
|
|
@@ -593097,13 +593097,13 @@ var init_commands = __esm({
|
|
|
593097
593097
|
try {
|
|
593098
593098
|
const { randomBytes: randomBytes26 } = await import("node:crypto");
|
|
593099
593099
|
const { homedir: homedir48 } = await import("node:os");
|
|
593100
|
-
const { mkdirSync:
|
|
593101
|
-
const { join:
|
|
593100
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = await import("node:fs");
|
|
593101
|
+
const { join: join144 } = await import("node:path");
|
|
593102
593102
|
const apiKey = randomBytes26(16).toString("hex");
|
|
593103
593103
|
process.env["OMNIUS_API_KEY"] = apiKey;
|
|
593104
|
-
const dir =
|
|
593105
|
-
|
|
593106
|
-
|
|
593104
|
+
const dir = join144(homedir48(), ".omnius");
|
|
593105
|
+
mkdirSync79(dir, { recursive: true });
|
|
593106
|
+
writeFileSync71(join144(dir, "api.key"), apiKey + "\n", "utf8");
|
|
593107
593107
|
renderInfo(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
|
|
593108
593108
|
renderInfo(
|
|
593109
593109
|
"Use Authorization: Bearer <key> or click 'key' in the Web UI header to paste it."
|
|
@@ -593122,11 +593122,11 @@ var init_commands = __esm({
|
|
|
593122
593122
|
const port = parseInt(process.env["OMNIUS_PORT"] || "11435", 10);
|
|
593123
593123
|
try {
|
|
593124
593124
|
const { homedir: homedir48 } = await import("node:os");
|
|
593125
|
-
const { mkdirSync:
|
|
593126
|
-
const { join:
|
|
593127
|
-
const dir =
|
|
593128
|
-
|
|
593129
|
-
|
|
593125
|
+
const { mkdirSync: mkdirSync79, writeFileSync: writeFileSync71 } = await import("node:fs");
|
|
593126
|
+
const { join: join144 } = await import("node:path");
|
|
593127
|
+
const dir = join144(homedir48(), ".omnius");
|
|
593128
|
+
mkdirSync79(dir, { recursive: true });
|
|
593129
|
+
writeFileSync71(join144(dir, "access"), `${val}
|
|
593130
593130
|
`, "utf8");
|
|
593131
593131
|
} catch {
|
|
593132
593132
|
}
|
|
@@ -594391,8 +594391,8 @@ function listBannerDesigns(workDir) {
|
|
|
594391
594391
|
const dir = join113(workDir, ".omnius", "banners");
|
|
594392
594392
|
if (!existsSync99(dir)) return [];
|
|
594393
594393
|
try {
|
|
594394
|
-
const { readdirSync:
|
|
594395
|
-
return
|
|
594394
|
+
const { readdirSync: readdirSync45 } = __require("node:fs");
|
|
594395
|
+
return readdirSync45(dir).filter((f2) => f2.endsWith(".json")).map((f2) => f2.replace(".json", ""));
|
|
594396
594396
|
} catch {
|
|
594397
594397
|
return [];
|
|
594398
594398
|
}
|
|
@@ -600240,6 +600240,239 @@ var init_stimulation = __esm({
|
|
|
600240
600240
|
}
|
|
600241
600241
|
});
|
|
600242
600242
|
|
|
600243
|
+
// packages/cli/src/tui/telegram-channel-dmn.ts
|
|
600244
|
+
import { existsSync as existsSync106, mkdirSync as mkdirSync62, readdirSync as readdirSync36, readFileSync as readFileSync86, writeFileSync as writeFileSync55 } from "node:fs";
|
|
600245
|
+
import { join as join121 } from "node:path";
|
|
600246
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
600247
|
+
function safeFilePart(value2) {
|
|
600248
|
+
return value2.replace(/[^A-Za-z0-9_.-]+/g, "_").slice(0, 80) || "telegram";
|
|
600249
|
+
}
|
|
600250
|
+
function daydreamRoot(repoRoot) {
|
|
600251
|
+
return join121(repoRoot, ".omnius", "telegram-daydreams");
|
|
600252
|
+
}
|
|
600253
|
+
function sessionDir(repoRoot, sessionKey) {
|
|
600254
|
+
const hash = createHash20("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
600255
|
+
return join121(daydreamRoot(repoRoot), safeFilePart(hash));
|
|
600256
|
+
}
|
|
600257
|
+
function compactLine2(value2, max = 220) {
|
|
600258
|
+
const clean3 = value2.replace(/\s+/g, " ").trim();
|
|
600259
|
+
return clean3.length > max ? `${clean3.slice(0, Math.max(0, max - 3)).trimEnd()}...` : clean3;
|
|
600260
|
+
}
|
|
600261
|
+
function isoFromMs(value2) {
|
|
600262
|
+
return value2 ? new Date(value2).toISOString() : void 0;
|
|
600263
|
+
}
|
|
600264
|
+
function topParticipants(input) {
|
|
600265
|
+
return [...input.participants].sort((a2, b) => b.messageCount - a2.messageCount || b.lastSeenTs - a2.lastSeenTs).slice(0, 8);
|
|
600266
|
+
}
|
|
600267
|
+
function recentUserMessages(input) {
|
|
600268
|
+
return input.history.filter((entry) => entry.role === "user" && entry.text.trim()).slice(-18);
|
|
600269
|
+
}
|
|
600270
|
+
function buildRelationshipSignals(input) {
|
|
600271
|
+
const signals = [];
|
|
600272
|
+
for (const participant of topParticipants(input)) {
|
|
600273
|
+
const label = participant.username && participant.username !== "unknown" ? `@${participant.username}` : participant.firstName || `user:${participant.fromUserId}`;
|
|
600274
|
+
const tones = participant.toneTags.length ? ` tones=${participant.toneTags.slice(0, 5).join(",")}` : "";
|
|
600275
|
+
const direct = participant.directAddressCount ? ` direct-addresses=${participant.directAddressCount}` : "";
|
|
600276
|
+
const replies = participant.replyCount ? ` replies=${participant.replyCount}` : "";
|
|
600277
|
+
signals.push(`${label}: messages=${participant.messageCount}${direct}${replies}${tones}; last="${compactLine2(participant.lastMessage, 160)}"`);
|
|
600278
|
+
}
|
|
600279
|
+
return signals;
|
|
600280
|
+
}
|
|
600281
|
+
function buildContextEngineeringNotes(input) {
|
|
600282
|
+
const notes2 = [];
|
|
600283
|
+
const recent = recentUserMessages(input);
|
|
600284
|
+
const replied = recent.filter((entry) => entry.replyToMessageId);
|
|
600285
|
+
const media = recent.filter((entry) => entry.mediaSummary);
|
|
600286
|
+
const speakers = new Set(recent.map((entry) => entry.speaker || entry.username || "unknown"));
|
|
600287
|
+
notes2.push(`Keep the next prompt anchored to ${speakers.size} active participant(s) and ${recent.length} recent user message(s).`);
|
|
600288
|
+
if (replied.length > 0) notes2.push(`Preserve ${replied.length} reply relationship(s) explicitly; pronouns like this/that likely refer to replied-to content.`);
|
|
600289
|
+
if (media.length > 0) notes2.push(`Recent media appears in the room; keep paths as tool-only context and avoid exposing local paths in visible Telegram replies.`);
|
|
600290
|
+
if (input.memoryCards.length > 0) notes2.push(`Use existing scoped memory cards before claiming prior context is unavailable.`);
|
|
600291
|
+
if (input.stimulationContext) notes2.push("Route decisions should consider the stimulation state but must still infer reply need from the live thread.");
|
|
600292
|
+
return notes2;
|
|
600293
|
+
}
|
|
600294
|
+
function buildOpenQuestions(input) {
|
|
600295
|
+
const questions = [];
|
|
600296
|
+
const recent = recentUserMessages(input);
|
|
600297
|
+
for (const entry of recent.slice(-10)) {
|
|
600298
|
+
const text = compactLine2(entry.text, 180);
|
|
600299
|
+
if (/[??]\s*$/.test(text)) {
|
|
600300
|
+
questions.push(`${entry.speaker || entry.username || "user"} asked: ${text}`);
|
|
600301
|
+
} else if (/\b(unclear|not sure|maybe|wonder|how do we|what if|why|need to)\b/i.test(text)) {
|
|
600302
|
+
questions.push(`${entry.speaker || entry.username || "user"} left an unresolved thread: ${text}`);
|
|
600303
|
+
}
|
|
600304
|
+
}
|
|
600305
|
+
return questions.slice(-6);
|
|
600306
|
+
}
|
|
600307
|
+
function buildReplyOpportunities(input, openQuestions) {
|
|
600308
|
+
const opportunities = [];
|
|
600309
|
+
for (const question of openQuestions.slice(-3)) {
|
|
600310
|
+
opportunities.push({
|
|
600311
|
+
trigger: question,
|
|
600312
|
+
rationale: "The group left a question or uncertainty that may benefit from a concise clarification.",
|
|
600313
|
+
suggestedTone: "brief, contextual, ask one concrete follow-up if needed",
|
|
600314
|
+
confidence: 0.62
|
|
600315
|
+
});
|
|
600316
|
+
}
|
|
600317
|
+
const recent = recentUserMessages(input);
|
|
600318
|
+
const last2 = recent[recent.length - 1];
|
|
600319
|
+
if (last2 && /\b(omnius|bot|agent)\b/i.test(last2.text) && opportunities.length < 4) {
|
|
600320
|
+
opportunities.push({
|
|
600321
|
+
trigger: `${last2.speaker || last2.username || "user"} mentioned the agent: ${compactLine2(last2.text, 160)}`,
|
|
600322
|
+
rationale: "A later live-router pass should consider whether this is a direct social opening or just third-person chatter.",
|
|
600323
|
+
suggestedTone: "low-intrusion, do not assume the turn belongs to the agent",
|
|
600324
|
+
confidence: 0.48
|
|
600325
|
+
});
|
|
600326
|
+
}
|
|
600327
|
+
return opportunities;
|
|
600328
|
+
}
|
|
600329
|
+
function buildMemoryProposals(input) {
|
|
600330
|
+
const proposals = [];
|
|
600331
|
+
const bySpeaker = /* @__PURE__ */ new Map();
|
|
600332
|
+
for (const entry of recentUserMessages(input)) {
|
|
600333
|
+
const speaker = entry.speaker || entry.username || "unknown";
|
|
600334
|
+
const bucket = bySpeaker.get(speaker) ?? [];
|
|
600335
|
+
bucket.push(entry);
|
|
600336
|
+
bySpeaker.set(speaker, bucket);
|
|
600337
|
+
}
|
|
600338
|
+
for (const [speaker, messages2] of [...bySpeaker.entries()].slice(0, 6)) {
|
|
600339
|
+
if (messages2.length < 2) continue;
|
|
600340
|
+
proposals.push({
|
|
600341
|
+
title: `${speaker} interaction pattern`,
|
|
600342
|
+
rationale: `Consolidate repeated tone/preferences from ${messages2.length} recent messages.`,
|
|
600343
|
+
sourceMessages: messages2.map((entry) => entry.messageId).filter((id) => typeof id === "number").slice(-8)
|
|
600344
|
+
});
|
|
600345
|
+
}
|
|
600346
|
+
return proposals.slice(0, 6);
|
|
600347
|
+
}
|
|
600348
|
+
function buildTelegramChannelDaydream(input) {
|
|
600349
|
+
const firstTs = input.history.map((entry) => entry.ts).find((ts) => typeof ts === "number");
|
|
600350
|
+
const lastTs = [...input.history].reverse().map((entry) => entry.ts).find((ts) => typeof ts === "number");
|
|
600351
|
+
const relationshipSignals = buildRelationshipSignals(input);
|
|
600352
|
+
const contextEngineeringNotes = buildContextEngineeringNotes(input);
|
|
600353
|
+
const openQuestions = buildOpenQuestions(input);
|
|
600354
|
+
const replyOpportunities = buildReplyOpportunities(input, openQuestions);
|
|
600355
|
+
const memoryProposals = buildMemoryProposals(input);
|
|
600356
|
+
const artifactProposals = [
|
|
600357
|
+
relationshipSignals.length > 0 ? {
|
|
600358
|
+
title: "Channel relationship map",
|
|
600359
|
+
kind: "relationship_note",
|
|
600360
|
+
rationale: "Use participant cadence, reply counts, and tone tags to keep future prompts socially grounded."
|
|
600361
|
+
} : null,
|
|
600362
|
+
contextEngineeringNotes.length > 0 ? {
|
|
600363
|
+
title: "Scoped context summary",
|
|
600364
|
+
kind: "context_summary",
|
|
600365
|
+
rationale: "Compress repeated channel facts into a clean prompt section for future live-router decisions."
|
|
600366
|
+
} : null,
|
|
600367
|
+
memoryProposals.length > 0 ? {
|
|
600368
|
+
title: "Memory card consolidation",
|
|
600369
|
+
kind: "memory_card",
|
|
600370
|
+
rationale: "Promote repeated user/channel patterns into scoped memory cards rather than raw transcript clutter."
|
|
600371
|
+
} : null
|
|
600372
|
+
].filter((entry) => Boolean(entry));
|
|
600373
|
+
const seed = `${input.sessionKey}:${input.generatedAtMs}:${input.history.length}`;
|
|
600374
|
+
return {
|
|
600375
|
+
version: 1,
|
|
600376
|
+
id: createHash20("sha1").update(seed).digest("hex").slice(0, 16),
|
|
600377
|
+
sessionKey: input.sessionKey,
|
|
600378
|
+
chatId: input.chatId,
|
|
600379
|
+
chatTitle: input.chatTitle,
|
|
600380
|
+
chatType: input.chatType,
|
|
600381
|
+
generatedAt: new Date(input.generatedAtMs).toISOString(),
|
|
600382
|
+
messageWindow: {
|
|
600383
|
+
totalRetained: input.history.length,
|
|
600384
|
+
firstMessageAt: isoFromMs(firstTs),
|
|
600385
|
+
lastMessageAt: isoFromMs(lastTs)
|
|
600386
|
+
},
|
|
600387
|
+
relationshipSignals,
|
|
600388
|
+
contextEngineeringNotes,
|
|
600389
|
+
openQuestions,
|
|
600390
|
+
replyOpportunities,
|
|
600391
|
+
memoryProposals,
|
|
600392
|
+
artifactProposals,
|
|
600393
|
+
stimulationContext: input.stimulationContext
|
|
600394
|
+
};
|
|
600395
|
+
}
|
|
600396
|
+
function formatTelegramChannelDaydreamMarkdown(artifact) {
|
|
600397
|
+
const section = (title, lines) => [`## ${title}`, lines.length ? lines.map((line) => `- ${line}`).join("\n") : "- None"].join("\n");
|
|
600398
|
+
return [
|
|
600399
|
+
`# Telegram Channel Daydream ${artifact.id}`,
|
|
600400
|
+
"",
|
|
600401
|
+
`Generated: ${artifact.generatedAt}`,
|
|
600402
|
+
`Session: ${artifact.sessionKey}`,
|
|
600403
|
+
`Chat: ${artifact.chatTitle || artifact.chatId} (${artifact.chatType})`,
|
|
600404
|
+
"",
|
|
600405
|
+
section("Relationship Signals", artifact.relationshipSignals),
|
|
600406
|
+
"",
|
|
600407
|
+
section("Context Engineering Notes", artifact.contextEngineeringNotes),
|
|
600408
|
+
"",
|
|
600409
|
+
section("Open Questions", artifact.openQuestions),
|
|
600410
|
+
"",
|
|
600411
|
+
"## Reply Opportunities",
|
|
600412
|
+
artifact.replyOpportunities.length ? artifact.replyOpportunities.map((item) => `- ${item.trigger}
|
|
600413
|
+
- rationale: ${item.rationale}
|
|
600414
|
+
- tone: ${item.suggestedTone}
|
|
600415
|
+
- confidence: ${item.confidence.toFixed(2)}`).join("\n") : "- None",
|
|
600416
|
+
"",
|
|
600417
|
+
"## Memory Proposals",
|
|
600418
|
+
artifact.memoryProposals.length ? artifact.memoryProposals.map((item) => `- ${item.title}: ${item.rationale}${item.sourceMessages.length ? ` (messages ${item.sourceMessages.join(", ")})` : ""}`).join("\n") : "- None",
|
|
600419
|
+
"",
|
|
600420
|
+
"## Artifact Proposals",
|
|
600421
|
+
artifact.artifactProposals.length ? artifact.artifactProposals.map((item) => `- ${item.title} [${item.kind}]: ${item.rationale}`).join("\n") : "- None",
|
|
600422
|
+
artifact.stimulationContext ? `
|
|
600423
|
+
## Stimulation Snapshot
|
|
600424
|
+
|
|
600425
|
+
\`\`\`text
|
|
600426
|
+
${artifact.stimulationContext}
|
|
600427
|
+
\`\`\`` : "",
|
|
600428
|
+
""
|
|
600429
|
+
].join("\n");
|
|
600430
|
+
}
|
|
600431
|
+
function writeTelegramChannelDaydream(repoRoot, artifact) {
|
|
600432
|
+
const dir = sessionDir(repoRoot, artifact.sessionKey);
|
|
600433
|
+
mkdirSync62(dir, { recursive: true });
|
|
600434
|
+
const base3 = `${artifact.generatedAt.replace(/[:.]/g, "-")}-${artifact.id}`;
|
|
600435
|
+
const jsonPath = join121(dir, `${base3}.json`);
|
|
600436
|
+
const markdownPath = join121(dir, `${base3}.md`);
|
|
600437
|
+
writeFileSync55(jsonPath, JSON.stringify(artifact, null, 2) + "\n", "utf8");
|
|
600438
|
+
writeFileSync55(markdownPath, formatTelegramChannelDaydreamMarkdown(artifact), "utf8");
|
|
600439
|
+
return { dir, jsonPath, markdownPath };
|
|
600440
|
+
}
|
|
600441
|
+
function latestTelegramChannelDaydream(repoRoot, sessionKey) {
|
|
600442
|
+
const dir = sessionDir(repoRoot, sessionKey);
|
|
600443
|
+
if (!existsSync106(dir)) return null;
|
|
600444
|
+
const files = readdirSync36(dir).filter((file) => file.endsWith(".json")).sort();
|
|
600445
|
+
for (const file of files.reverse()) {
|
|
600446
|
+
try {
|
|
600447
|
+
return JSON.parse(readFileSync86(join121(dir, file), "utf8"));
|
|
600448
|
+
} catch {
|
|
600449
|
+
}
|
|
600450
|
+
}
|
|
600451
|
+
return null;
|
|
600452
|
+
}
|
|
600453
|
+
function formatTelegramChannelDaydreamContext(artifact) {
|
|
600454
|
+
if (!artifact) return "";
|
|
600455
|
+
const lines = [
|
|
600456
|
+
"### Telegram Channel Daydream",
|
|
600457
|
+
"Private idle reflection artifact. Use it as context only; do not mention it unless the user asks about internal memory.",
|
|
600458
|
+
`Generated: ${artifact.generatedAt}`,
|
|
600459
|
+
artifact.relationshipSignals.length ? `Relationship signals:
|
|
600460
|
+
${artifact.relationshipSignals.slice(0, 5).map((line) => `- ${line}`).join("\n")}` : "",
|
|
600461
|
+
artifact.contextEngineeringNotes.length ? `Context notes:
|
|
600462
|
+
${artifact.contextEngineeringNotes.slice(0, 5).map((line) => `- ${line}`).join("\n")}` : "",
|
|
600463
|
+
artifact.openQuestions.length ? `Open questions:
|
|
600464
|
+
${artifact.openQuestions.slice(0, 4).map((line) => `- ${line}`).join("\n")}` : "",
|
|
600465
|
+
artifact.replyOpportunities.length ? `Possible reply opportunities:
|
|
600466
|
+
${artifact.replyOpportunities.slice(0, 3).map((item) => `- ${item.trigger} (confidence ${item.confidence.toFixed(2)}; ${item.suggestedTone})`).join("\n")}` : ""
|
|
600467
|
+
].filter(Boolean);
|
|
600468
|
+
return lines.join("\n");
|
|
600469
|
+
}
|
|
600470
|
+
var init_telegram_channel_dmn = __esm({
|
|
600471
|
+
"packages/cli/src/tui/telegram-channel-dmn.ts"() {
|
|
600472
|
+
"use strict";
|
|
600473
|
+
}
|
|
600474
|
+
});
|
|
600475
|
+
|
|
600243
600476
|
// packages/cli/src/tui/vision-ingress.ts
|
|
600244
600477
|
var vision_ingress_exports = {};
|
|
600245
600478
|
__export(vision_ingress_exports, {
|
|
@@ -600251,8 +600484,8 @@ __export(vision_ingress_exports, {
|
|
|
600251
600484
|
runVisionIngress: () => runVisionIngress
|
|
600252
600485
|
});
|
|
600253
600486
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
600254
|
-
import { existsSync as
|
|
600255
|
-
import { join as
|
|
600487
|
+
import { existsSync as existsSync107, readFileSync as readFileSync87, unlinkSync as unlinkSync20 } from "node:fs";
|
|
600488
|
+
import { join as join122 } from "node:path";
|
|
600256
600489
|
function isTesseractAvailable() {
|
|
600257
600490
|
try {
|
|
600258
600491
|
execFileSync6("tesseract", ["--version"], { stdio: "ignore", timeout: 3e3 });
|
|
@@ -600286,8 +600519,8 @@ function isVisionModel(modelName) {
|
|
|
600286
600519
|
}
|
|
600287
600520
|
function advancedOcr(imagePath) {
|
|
600288
600521
|
if (!isTesseractAvailable()) return "";
|
|
600289
|
-
if (!
|
|
600290
|
-
const tmpBase =
|
|
600522
|
+
if (!existsSync107(imagePath)) return "";
|
|
600523
|
+
const tmpBase = join122(
|
|
600291
600524
|
imagePath.replace(/\.[^.]+$/, ""),
|
|
600292
600525
|
`_ocr_${Date.now()}`
|
|
600293
600526
|
);
|
|
@@ -600305,8 +600538,8 @@ function advancedOcr(imagePath) {
|
|
|
600305
600538
|
"eng"
|
|
600306
600539
|
], { timeout: 15e3, stdio: "pipe" });
|
|
600307
600540
|
const txtFile = `${outFile}.txt`;
|
|
600308
|
-
if (
|
|
600309
|
-
const text =
|
|
600541
|
+
if (existsSync107(txtFile)) {
|
|
600542
|
+
const text = readFileSync87(txtFile, "utf-8").trim();
|
|
600310
600543
|
if (text.length > 0) results.push(text);
|
|
600311
600544
|
try {
|
|
600312
600545
|
unlinkSync20(txtFile);
|
|
@@ -600322,8 +600555,8 @@ function advancedOcr(imagePath) {
|
|
|
600322
600555
|
}
|
|
600323
600556
|
async function queryVisionModel(modelName, imagePath, prompt = "Describe what you see in this image in detail. Include any text, UI elements, code, diagrams, or visual content.") {
|
|
600324
600557
|
if (!isVisionModel(modelName)) return "";
|
|
600325
|
-
if (!
|
|
600326
|
-
const imageBuffer =
|
|
600558
|
+
if (!existsSync107(imagePath)) return "";
|
|
600559
|
+
const imageBuffer = readFileSync87(imagePath);
|
|
600327
600560
|
const base64Image = imageBuffer.toString("base64");
|
|
600328
600561
|
try {
|
|
600329
600562
|
const response = await fetch("http://localhost:11434/api/generate", {
|
|
@@ -600394,10 +600627,10 @@ var init_vision_ingress = __esm({
|
|
|
600394
600627
|
});
|
|
600395
600628
|
|
|
600396
600629
|
// packages/cli/src/tui/telegram-bridge.ts
|
|
600397
|
-
import { mkdirSync as
|
|
600398
|
-
import { join as
|
|
600630
|
+
import { mkdirSync as mkdirSync63, existsSync as existsSync108, unlinkSync as unlinkSync21, readdirSync as readdirSync37, statSync as statSync36, statfsSync as statfsSync3, readFileSync as readFileSync88, writeFileSync as writeFileSync57 } from "node:fs";
|
|
600631
|
+
import { join as join123, resolve as resolve41, basename as basename26, relative as relative13, isAbsolute as isAbsolute7, extname as extname16 } from "node:path";
|
|
600399
600632
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
600400
|
-
import { createHash as
|
|
600633
|
+
import { createHash as createHash21, randomInt } from "node:crypto";
|
|
600401
600634
|
function parseTelegramInteractionDecision(text, forcedRoute, options2 = {}) {
|
|
600402
600635
|
const cleaned = stripTelegramHiddenThinking(text).replace(/```(?:json)?/gi, "").replace(/```/g, "").trim();
|
|
600403
600636
|
const jsonText = cleaned.startsWith("{") ? cleaned : cleaned.match(/\{[\s\S]*\}/)?.[0] ?? "";
|
|
@@ -600732,7 +600965,7 @@ function buildTelegramRuntimeContext(now = /* @__PURE__ */ new Date(), repoRoot)
|
|
|
600732
600965
|
].filter(Boolean).join("\n");
|
|
600733
600966
|
}
|
|
600734
600967
|
function telegramSessionIdFromKey(sessionKey) {
|
|
600735
|
-
return `telegram-${
|
|
600968
|
+
return `telegram-${createHash21("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
|
|
600736
600969
|
}
|
|
600737
600970
|
function selectTelegramFinalResponse(args) {
|
|
600738
600971
|
const committedVisibleReply = cleanTelegramVisibleReply(args.visibleReplyText || "");
|
|
@@ -600756,14 +600989,20 @@ function formatTelegramProgressEvent(event) {
|
|
|
600756
600989
|
if (event.type === "tool_call" && event.toolName === "task_complete") return null;
|
|
600757
600990
|
if (event.type === "tool_result" && event.toolName === "task_complete") return null;
|
|
600758
600991
|
if (event.type === "tool_call") {
|
|
600759
|
-
return
|
|
600992
|
+
return `<b>Tool call</b> <code>${escapeTelegramHTML(event.toolName || "tool")}</code>`;
|
|
600760
600993
|
}
|
|
600761
600994
|
if (event.type === "tool_result") {
|
|
600762
|
-
const preview = sanitizeTelegramProgressText(event.content || "",
|
|
600995
|
+
const preview = sanitizeTelegramProgressText(event.content || "", 180);
|
|
600763
600996
|
if (isTelegramInternalStatusText(preview)) return null;
|
|
600764
600997
|
const toolName = escapeTelegramHTML(event.toolName || "tool");
|
|
600765
|
-
if (preview)
|
|
600766
|
-
|
|
600998
|
+
if (preview) {
|
|
600999
|
+
return [
|
|
601000
|
+
`<b>Tool result</b> <code>${toolName}</code>`,
|
|
601001
|
+
`<blockquote>${escapeTelegramHTML(preview)}</blockquote>`
|
|
601002
|
+
].join("\n");
|
|
601003
|
+
}
|
|
601004
|
+
return `<b>Tool result</b> <code>${toolName}</code>
|
|
601005
|
+
<i>${event.success ? "completed" : "failed"}</i>`;
|
|
600767
601006
|
}
|
|
600768
601007
|
if (event.type === "status") {
|
|
600769
601008
|
if (isCodebaseMemoryStatus(event.content || "")) {
|
|
@@ -600771,7 +601010,7 @@ function formatTelegramProgressEvent(event) {
|
|
|
600771
601010
|
}
|
|
600772
601011
|
const content = sanitizeTelegramProgressText(event.content || "", 120);
|
|
600773
601012
|
if (isTelegramInternalStatusText(content)) return null;
|
|
600774
|
-
return content ? escapeTelegramHTML(content) : null;
|
|
601013
|
+
return content ? `<b>Status</b> ${escapeTelegramHTML(content)}` : null;
|
|
600775
601014
|
}
|
|
600776
601015
|
return null;
|
|
600777
601016
|
}
|
|
@@ -601418,7 +601657,7 @@ function renderTelegramSubAgentError(username, error) {
|
|
|
601418
601657
|
process.stdout.write(` ${c3.dim("⎿")} ${c3.red("✘")} @${username}: ${c3.dim(preview)}
|
|
601419
601658
|
`);
|
|
601420
601659
|
}
|
|
601421
|
-
var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_PUBLIC_HELP_COMMANDS, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TelegramBridge;
|
|
601660
|
+
var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_PUBLIC_HELP_COMMANDS, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TelegramBridge;
|
|
601422
601661
|
var init_telegram_bridge = __esm({
|
|
601423
601662
|
"packages/cli/src/tui/telegram-bridge.ts"() {
|
|
601424
601663
|
"use strict";
|
|
@@ -601434,6 +601673,7 @@ var init_telegram_bridge = __esm({
|
|
|
601434
601673
|
init_omnius_directory();
|
|
601435
601674
|
init_stimulation();
|
|
601436
601675
|
init_identity_memory_tool();
|
|
601676
|
+
init_telegram_channel_dmn();
|
|
601437
601677
|
TELEGRAM_SAFETY_PROMPT = `
|
|
601438
601678
|
CRITICAL SAFETY NOTICE — PUBLIC TELEGRAM CHANNEL
|
|
601439
601679
|
|
|
@@ -601619,6 +601859,10 @@ Telegram response contract:
|
|
|
601619
601859
|
TELEGRAM_REMINDER_SLASH_COMMANDS = /* @__PURE__ */ new Set(["remind", "reminder", "reminders"]);
|
|
601620
601860
|
TELEGRAM_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".tiff", ".tif", ".svg"]);
|
|
601621
601861
|
MEDIA_CACHE_TTL_MS = 30 * 60 * 1e3;
|
|
601862
|
+
TELEGRAM_CHANNEL_DMN_SWEEP_MS = 2 * 60 * 1e3;
|
|
601863
|
+
TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS = 10 * 60 * 1e3;
|
|
601864
|
+
TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS = 20 * 60 * 1e3;
|
|
601865
|
+
TELEGRAM_CHANNEL_DMN_MIN_MESSAGES = 4;
|
|
601622
601866
|
TelegramBridge = class {
|
|
601623
601867
|
constructor(botToken, onMessage, agentConfig, repoRoot, toolPolicyConfig) {
|
|
601624
601868
|
this.botToken = botToken;
|
|
@@ -601707,6 +601951,14 @@ Telegram response contract:
|
|
|
601707
601951
|
mediaMetadata = /* @__PURE__ */ new Map();
|
|
601708
601952
|
/** Cleanup timer for expired media cache entries */
|
|
601709
601953
|
mediaCacheCleanupTimer = null;
|
|
601954
|
+
/** Background channel DMN timer for idle Telegram group reflection. */
|
|
601955
|
+
channelDmnTimer = null;
|
|
601956
|
+
/** Last successful channel DMN artifact time per Telegram session key. */
|
|
601957
|
+
channelDmnLastRunAt = /* @__PURE__ */ new Map();
|
|
601958
|
+
/** Sessions currently being reflected on by channel DMN. */
|
|
601959
|
+
channelDmnRunning = /* @__PURE__ */ new Set();
|
|
601960
|
+
/** Daydream artifact already used to force a live-router check. */
|
|
601961
|
+
channelDmnPromptedArtifactAt = /* @__PURE__ */ new Map();
|
|
601710
601962
|
/** Set admin user ID filter */
|
|
601711
601963
|
setAdmin(userId) {
|
|
601712
601964
|
this.adminUserId = userId;
|
|
@@ -601791,7 +602043,7 @@ Telegram response contract:
|
|
|
601791
602043
|
return !!this.adminAuthChallenge && this.adminAuthChallenge.expiresAtMs > Date.now();
|
|
601792
602044
|
}
|
|
601793
602045
|
hashAdminAuthCode(code8) {
|
|
601794
|
-
return
|
|
602046
|
+
return createHash21("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
|
|
601795
602047
|
}
|
|
601796
602048
|
viewIdForMessage(msg) {
|
|
601797
602049
|
return `telegram-${this.sessionKeyForMessage(msg).replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
@@ -602129,8 +602381,8 @@ ${mediaContext}` : ""
|
|
|
602129
602381
|
return payload;
|
|
602130
602382
|
}
|
|
602131
602383
|
telegramConversationPath(sessionKey) {
|
|
602132
|
-
const safe =
|
|
602133
|
-
return
|
|
602384
|
+
const safe = createHash21("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
602385
|
+
return join123(this.telegramConversationDir, `${safe}.json`);
|
|
602134
602386
|
}
|
|
602135
602387
|
telegramPersonalityScope(sessionKey, msg) {
|
|
602136
602388
|
const label = msg.chatType !== "private" ? `${msg.chatTitle || msg.chatType}-${String(msg.chatId)}` : `private-${msg.username || msg.fromUserId || msg.chatId}`;
|
|
@@ -602145,9 +602397,9 @@ ${mediaContext}` : ""
|
|
|
602145
602397
|
if (this.loadedConversationState.has(sessionKey)) return;
|
|
602146
602398
|
this.loadedConversationState.add(sessionKey);
|
|
602147
602399
|
const path11 = this.telegramConversationPath(sessionKey);
|
|
602148
|
-
if (!
|
|
602400
|
+
if (!existsSync108(path11)) return;
|
|
602149
602401
|
try {
|
|
602150
|
-
const parsed = JSON.parse(
|
|
602402
|
+
const parsed = JSON.parse(readFileSync88(path11, "utf8"));
|
|
602151
602403
|
if (Array.isArray(parsed.history)) {
|
|
602152
602404
|
this.chatHistory.set(sessionKey, parsed.history.slice(-TELEGRAM_CHAT_HISTORY_LIMIT));
|
|
602153
602405
|
}
|
|
@@ -602175,12 +602427,12 @@ ${mediaContext}` : ""
|
|
|
602175
602427
|
ensureAllTelegramConversationsLoaded() {
|
|
602176
602428
|
if (this.loadedAllConversationState) return;
|
|
602177
602429
|
this.loadedAllConversationState = true;
|
|
602178
|
-
if (!
|
|
602430
|
+
if (!existsSync108(this.telegramConversationDir)) return;
|
|
602179
602431
|
try {
|
|
602180
|
-
for (const file of
|
|
602432
|
+
for (const file of readdirSync37(this.telegramConversationDir)) {
|
|
602181
602433
|
if (!file.endsWith(".json")) continue;
|
|
602182
602434
|
try {
|
|
602183
|
-
const parsed = JSON.parse(
|
|
602435
|
+
const parsed = JSON.parse(readFileSync88(join123(this.telegramConversationDir, file), "utf8"));
|
|
602184
602436
|
if (parsed.sessionKey) this.ensureTelegramConversationLoaded(parsed.sessionKey);
|
|
602185
602437
|
} catch {
|
|
602186
602438
|
}
|
|
@@ -602191,7 +602443,7 @@ ${mediaContext}` : ""
|
|
|
602191
602443
|
saveTelegramConversationState(sessionKey) {
|
|
602192
602444
|
if (!this.repoRoot) return;
|
|
602193
602445
|
try {
|
|
602194
|
-
|
|
602446
|
+
mkdirSync63(this.telegramConversationDir, { recursive: true });
|
|
602195
602447
|
const participants = [...this.chatParticipants.get(sessionKey)?.values() ?? []].map((profile) => ({
|
|
602196
602448
|
...profile,
|
|
602197
602449
|
toneTags: [...profile.toneTags]
|
|
@@ -602205,10 +602457,94 @@ ${mediaContext}` : ""
|
|
|
602205
602457
|
memoryCards: this.chatMemoryCards.get(sessionKey) ?? [],
|
|
602206
602458
|
stimulation: this.stimulation.getState(sessionKey)
|
|
602207
602459
|
};
|
|
602208
|
-
|
|
602460
|
+
writeFileSync57(this.telegramConversationPath(sessionKey), JSON.stringify(payload, null, 2) + "\n", "utf8");
|
|
602209
602461
|
} catch {
|
|
602210
602462
|
}
|
|
602211
602463
|
}
|
|
602464
|
+
latestTelegramChannelDaydream(sessionKey) {
|
|
602465
|
+
if (!this.repoRoot) return null;
|
|
602466
|
+
return latestTelegramChannelDaydream(this.repoRoot, sessionKey);
|
|
602467
|
+
}
|
|
602468
|
+
buildTelegramChannelDaydreamInput(sessionKey, nowMs = Date.now()) {
|
|
602469
|
+
const history = this.chatHistory.get(sessionKey) ?? [];
|
|
602470
|
+
if (history.length === 0) return null;
|
|
602471
|
+
const last2 = [...history].reverse().find((entry) => entry.chatId !== void 0);
|
|
602472
|
+
if (!last2) return null;
|
|
602473
|
+
const participants = [...this.chatParticipants.get(sessionKey)?.values() ?? []].map((profile) => ({
|
|
602474
|
+
...profile,
|
|
602475
|
+
toneTags: [...profile.toneTags],
|
|
602476
|
+
samples: [...profile.samples]
|
|
602477
|
+
}));
|
|
602478
|
+
const memoryCards = this.chatMemoryCards.get(sessionKey) ?? [];
|
|
602479
|
+
return {
|
|
602480
|
+
sessionKey,
|
|
602481
|
+
chatId: String(last2.chatId),
|
|
602482
|
+
chatTitle: last2.chatTitle,
|
|
602483
|
+
chatType: last2.chatType || "unknown",
|
|
602484
|
+
generatedAtMs: nowMs,
|
|
602485
|
+
history: history.map((entry) => ({
|
|
602486
|
+
role: entry.role,
|
|
602487
|
+
speaker: entry.speaker,
|
|
602488
|
+
username: entry.username,
|
|
602489
|
+
text: entry.text,
|
|
602490
|
+
ts: entry.ts,
|
|
602491
|
+
mode: entry.mode,
|
|
602492
|
+
messageId: entry.messageId,
|
|
602493
|
+
replyToMessageId: entry.replyToMessageId,
|
|
602494
|
+
mediaSummary: entry.mediaSummary
|
|
602495
|
+
})),
|
|
602496
|
+
participants,
|
|
602497
|
+
memoryCards: memoryCards.map((card) => ({ ...card })),
|
|
602498
|
+
stimulationContext: this.stimulation.formatContext(sessionKey)
|
|
602499
|
+
};
|
|
602500
|
+
}
|
|
602501
|
+
async runTelegramChannelDmnForSession(sessionKey, reason = "idle", nowMs = Date.now(), force = false) {
|
|
602502
|
+
if (!this.repoRoot) return null;
|
|
602503
|
+
if (this.channelDmnRunning.has(sessionKey)) return null;
|
|
602504
|
+
if (this.subAgents.has(sessionKey)) return null;
|
|
602505
|
+
const input = this.buildTelegramChannelDaydreamInput(sessionKey, nowMs);
|
|
602506
|
+
if (!input) return null;
|
|
602507
|
+
if (input.chatType === "private") return null;
|
|
602508
|
+
const lastMessageAt = input.history.map((entry) => entry.ts).filter((ts) => typeof ts === "number").sort((a2, b) => b - a2)[0] ?? nowMs;
|
|
602509
|
+
const lastRunAt = this.channelDmnLastRunAt.get(sessionKey) ?? 0;
|
|
602510
|
+
if (!force) {
|
|
602511
|
+
if (input.history.length < TELEGRAM_CHANNEL_DMN_MIN_MESSAGES) return null;
|
|
602512
|
+
if (nowMs - lastMessageAt < TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS) return null;
|
|
602513
|
+
if (nowMs - lastRunAt < TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS) return null;
|
|
602514
|
+
}
|
|
602515
|
+
this.channelDmnRunning.add(sessionKey);
|
|
602516
|
+
try {
|
|
602517
|
+
const artifact = buildTelegramChannelDaydream(input);
|
|
602518
|
+
writeTelegramChannelDaydream(this.repoRoot, artifact);
|
|
602519
|
+
this.channelDmnLastRunAt.set(sessionKey, nowMs);
|
|
602520
|
+
void reason;
|
|
602521
|
+
return artifact;
|
|
602522
|
+
} finally {
|
|
602523
|
+
this.channelDmnRunning.delete(sessionKey);
|
|
602524
|
+
}
|
|
602525
|
+
}
|
|
602526
|
+
async runTelegramChannelDmnSweep(reason = "timer") {
|
|
602527
|
+
if (!this.repoRoot) return;
|
|
602528
|
+
this.ensureAllTelegramConversationsLoaded();
|
|
602529
|
+
const now = Date.now();
|
|
602530
|
+
for (const sessionKey of this.chatHistory.keys()) {
|
|
602531
|
+
await this.runTelegramChannelDmnForSession(sessionKey, reason, now).catch(() => null);
|
|
602532
|
+
}
|
|
602533
|
+
}
|
|
602534
|
+
formatLatestTelegramChannelDaydreamContext(sessionKey) {
|
|
602535
|
+
return formatTelegramChannelDaydreamContext(this.latestTelegramChannelDaydream(sessionKey));
|
|
602536
|
+
}
|
|
602537
|
+
shouldForceAnalysisFromChannelDaydream(sessionKey) {
|
|
602538
|
+
const artifact = this.latestTelegramChannelDaydream(sessionKey);
|
|
602539
|
+
if (!artifact || artifact.replyOpportunities.length === 0) return false;
|
|
602540
|
+
const generated = Date.parse(artifact.generatedAt);
|
|
602541
|
+
if (!Number.isFinite(generated)) return false;
|
|
602542
|
+
if (Date.now() - generated > 6 * 60 * 6e4) return false;
|
|
602543
|
+
const prior = this.channelDmnPromptedArtifactAt.get(sessionKey);
|
|
602544
|
+
if (prior === artifact.generatedAt) return false;
|
|
602545
|
+
this.channelDmnPromptedArtifactAt.set(sessionKey, artifact.generatedAt);
|
|
602546
|
+
return true;
|
|
602547
|
+
}
|
|
602212
602548
|
renderTelegramScopedPersonality(sessionKey, msg) {
|
|
602213
602549
|
try {
|
|
602214
602550
|
return buildScopedPersonalityContext(this.telegramPersonalityScope(sessionKey, msg));
|
|
@@ -602357,7 +602693,7 @@ ${mediaContext}` : ""
|
|
|
602357
602693
|
});
|
|
602358
602694
|
if (matchingEntry) return { ok: true, path: matchingEntry.localPath };
|
|
602359
602695
|
const creativeCandidate = isAbsolute7(raw) ? resolve41(raw) : resolve41(creativeRoot, raw);
|
|
602360
|
-
if (isPathInside(creativeRoot, creativeCandidate) &&
|
|
602696
|
+
if (isPathInside(creativeRoot, creativeCandidate) && existsSync108(creativeCandidate)) {
|
|
602361
602697
|
return { ok: true, path: creativeCandidate };
|
|
602362
602698
|
}
|
|
602363
602699
|
return {
|
|
@@ -602489,7 +602825,7 @@ ${mediaContext}` : ""
|
|
|
602489
602825
|
const titleTags = tags.slice(0, 4);
|
|
602490
602826
|
const title = titleTags.length > 0 ? `${speaker} / ${titleTags.join(" ")}` : `${speaker} / conversation`;
|
|
602491
602827
|
const card = {
|
|
602492
|
-
id:
|
|
602828
|
+
id: createHash21("sha1").update(`${sessionKey}:${now}:${speaker}:${text}`).digest("hex").slice(0, 12),
|
|
602493
602829
|
title,
|
|
602494
602830
|
notes: [],
|
|
602495
602831
|
tags: [],
|
|
@@ -602608,6 +602944,10 @@ ${notes2}`;
|
|
|
602608
602944
|
sections.push(`### Zettelkasten Memory Recall
|
|
602609
602945
|
${cardLines.join("\n")}`);
|
|
602610
602946
|
}
|
|
602947
|
+
const channelDaydream = this.formatLatestTelegramChannelDaydreamContext(sessionKey);
|
|
602948
|
+
if (channelDaydream) {
|
|
602949
|
+
sections.push(channelDaydream);
|
|
602950
|
+
}
|
|
602611
602951
|
const recentMedia = this.recentTelegramMediaEntries(msg.chatId, 10);
|
|
602612
602952
|
if (recentMedia.length > 0) {
|
|
602613
602953
|
const mediaLines = recentMedia.map((entry) => {
|
|
@@ -602722,12 +603062,14 @@ ${lines.join("\n")}`);
|
|
|
602722
603062
|
const isGroup = msg.chatType !== "private";
|
|
602723
603063
|
const addressesBot = this.telegramMessageAddressesBot(msg);
|
|
602724
603064
|
const sessionKey = this.sessionKeyForMessage(msg);
|
|
603065
|
+
const daydreamForceCheck = isGroup && this.shouldForceAnalysisFromChannelDaydream(sessionKey);
|
|
602725
603066
|
const stimulationProbe = this.stimulation.observe({
|
|
602726
603067
|
channelId: sessionKey,
|
|
602727
603068
|
privateChannel: !isGroup,
|
|
602728
603069
|
directSignal: addressesBot,
|
|
602729
603070
|
replyToAgent: this.telegramMessageRepliesToBot(msg),
|
|
602730
|
-
activeAgent: this.subAgents.has(sessionKey)
|
|
603071
|
+
activeAgent: this.subAgents.has(sessionKey),
|
|
603072
|
+
forceAnalyze: daydreamForceCheck
|
|
602731
603073
|
});
|
|
602732
603074
|
if (isGroup && !stimulationProbe.shouldAnalyze) {
|
|
602733
603075
|
return {
|
|
@@ -602768,9 +603110,10 @@ ${lines.join("\n")}`);
|
|
|
602768
603110
|
`- action: tools, workspace context, media processing, web lookup, delegation, or a multi-step agent loop may be needed.`,
|
|
602769
603111
|
`Route discipline: greetings, acknowledgements, casual tone/style discussion, and simple conversational questions are chat. Use action only when the message asks you to inspect, create, change, send, remember, search, analyze media, name/enroll/identify a person/face/voice from media, or otherwise do tool-backed work.`,
|
|
602770
603112
|
``,
|
|
602771
|
-
`Reply discretion: infer from the live thread, speaker relationships, direct platform signals, replies, tone, and
|
|
603113
|
+
`Reply discretion: infer from the live thread, speaker relationships, direct platform signals, replies, tone, current message, and any private channel daydream artifact supplied in context. Do not use static keyword rules.`,
|
|
602772
603114
|
`Private chats: should_reply is normally true.`,
|
|
602773
603115
|
`Group/public chats: default should_reply to false unless the current message clearly addresses the bot, replies to the bot, continues an active bot-involved exchange, assigns the bot work, or asks for the bot's view. Ambient chatter, third-person discussion about the bot, commands meant for a human, or questions among other people are false. Do not set true just because the bot could help.`,
|
|
603116
|
+
`Channel daydream discipline: a daydream artifact may highlight relationship signals, unresolved questions, or possible reply opportunities from idle reflection. It can justify analyzing this turn, but it does not force a reply. Reply only if the current user entry makes the intervention timely and socially appropriate.`,
|
|
602774
603117
|
`Stimulation discipline: also set attention_state, attention_delta, and optional next_check_after_messages/next_check_after_ms. These control future analysis cadence only; they do not force a reply. Use engaged for active back-and-forth, observing for likely relevant context, cooldown for recently irrelevant context, and idle for ambient chatter.`,
|
|
602775
603118
|
forcedLine,
|
|
602776
603119
|
``,
|
|
@@ -602954,8 +603297,8 @@ ${list}` : "No shared group target is currently known for this sender. Ask in th
|
|
|
602954
603297
|
}
|
|
602955
603298
|
telegramRunnerStateDir(sessionKey) {
|
|
602956
603299
|
if (!this.repoRoot) return void 0;
|
|
602957
|
-
const safe =
|
|
602958
|
-
return
|
|
603300
|
+
const safe = createHash21("sha1").update(sessionKey).digest("hex").slice(0, 20);
|
|
603301
|
+
return join123(this.repoRoot, ".omnius", "telegram-runner-state", safe);
|
|
602959
603302
|
}
|
|
602960
603303
|
buildTelegramAdminOverviewContext(currentSessionKey) {
|
|
602961
603304
|
const sections = [];
|
|
@@ -603127,10 +603470,15 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
603127
603470
|
this.polling = true;
|
|
603128
603471
|
this.abortController = new AbortController();
|
|
603129
603472
|
try {
|
|
603130
|
-
|
|
603473
|
+
mkdirSync63(this.mediaCacheDir, { recursive: true });
|
|
603131
603474
|
} catch {
|
|
603132
603475
|
}
|
|
603133
603476
|
this.mediaCacheCleanupTimer = setInterval(() => this.cleanupMediaCache(), 5 * 60 * 1e3);
|
|
603477
|
+
this.channelDmnTimer = setInterval(() => {
|
|
603478
|
+
this.runTelegramChannelDmnSweep("timer").catch(() => {
|
|
603479
|
+
});
|
|
603480
|
+
}, TELEGRAM_CHANNEL_DMN_SWEEP_MS);
|
|
603481
|
+
this.channelDmnTimer.unref?.();
|
|
603134
603482
|
this.pollLoop();
|
|
603135
603483
|
}
|
|
603136
603484
|
/** Stop polling and kill all active sub-agents */
|
|
@@ -603143,6 +603491,10 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
603143
603491
|
clearInterval(this.mediaCacheCleanupTimer);
|
|
603144
603492
|
this.mediaCacheCleanupTimer = null;
|
|
603145
603493
|
}
|
|
603494
|
+
if (this.channelDmnTimer) {
|
|
603495
|
+
clearInterval(this.channelDmnTimer);
|
|
603496
|
+
this.channelDmnTimer = null;
|
|
603497
|
+
}
|
|
603146
603498
|
for (const [, agent] of this.subAgents) {
|
|
603147
603499
|
agent.aborted = true;
|
|
603148
603500
|
if (agent.typingInterval) clearInterval(agent.typingInterval);
|
|
@@ -604854,7 +605206,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
604854
605206
|
return { ...materialized, logicalPath };
|
|
604855
605207
|
}
|
|
604856
605208
|
const abs = isAbsolute7(trimmed) ? resolve41(trimmed) : resolve41(base3, trimmed);
|
|
604857
|
-
if (!
|
|
605209
|
+
if (!existsSync108(abs)) return { ok: false, error: `File does not exist: ${trimmed}` };
|
|
604858
605210
|
if (!statSync36(abs).isFile()) return { ok: false, error: `Path is not a file: ${trimmed}` };
|
|
604859
605211
|
return { ok: true, path: abs };
|
|
604860
605212
|
}
|
|
@@ -604907,7 +605259,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
604907
605259
|
if (!res.ok) return null;
|
|
604908
605260
|
const buffer2 = Buffer.from(await res.arrayBuffer());
|
|
604909
605261
|
const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension3}`;
|
|
604910
|
-
const localPath =
|
|
605262
|
+
const localPath = join123(this.mediaCacheDir, fileName);
|
|
604911
605263
|
await writeFileAsync(localPath, buffer2);
|
|
604912
605264
|
return localPath;
|
|
604913
605265
|
} catch {
|
|
@@ -604968,7 +605320,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
604968
605320
|
const ingressResult = await runVisionIngress2(
|
|
604969
605321
|
{
|
|
604970
605322
|
path: localPath,
|
|
604971
|
-
buffer:
|
|
605323
|
+
buffer: readFileSync88(localPath),
|
|
604972
605324
|
mime: telegramImageMime(media)
|
|
604973
605325
|
},
|
|
604974
605326
|
this.agentConfig?.model ?? ""
|
|
@@ -605129,7 +605481,7 @@ ${text}`.trim());
|
|
|
605129
605481
|
}
|
|
605130
605482
|
async sendTelegramFileToChat(chatId, path11, options2) {
|
|
605131
605483
|
const abs = resolve41(path11);
|
|
605132
|
-
if (!
|
|
605484
|
+
if (!existsSync108(abs) || !statSync36(abs).isFile()) {
|
|
605133
605485
|
throw new Error(`File does not exist or is not a regular file: ${path11}`);
|
|
605134
605486
|
}
|
|
605135
605487
|
return this.sendMediaReferenceStrict(chatId, {
|
|
@@ -605162,8 +605514,8 @@ ${text}`.trim());
|
|
|
605162
605514
|
this.state.messagesSent++;
|
|
605163
605515
|
return result2.result?.message_id ?? null;
|
|
605164
605516
|
}
|
|
605165
|
-
if (!
|
|
605166
|
-
const buffer2 =
|
|
605517
|
+
if (!existsSync108(media.value)) throw new Error(`File does not exist: ${media.value}`);
|
|
605518
|
+
const buffer2 = readFileSync88(media.value);
|
|
605167
605519
|
const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
605168
605520
|
const filename = basename26(media.value);
|
|
605169
605521
|
const contentType = mimeForPath(media.value, media.kind);
|
|
@@ -605228,7 +605580,7 @@ Content-Type: ${contentType}\r
|
|
|
605228
605580
|
if (!includeMentioned && alreadySentByText.has(abs)) continue;
|
|
605229
605581
|
const materialized = materializeTelegramCreativeArtifactForSend(rootAbs, abs);
|
|
605230
605582
|
if (!materialized.ok) continue;
|
|
605231
|
-
if (!
|
|
605583
|
+
if (!existsSync108(materialized.path) || !statSync36(materialized.path).isFile()) {
|
|
605232
605584
|
materialized.cleanup?.();
|
|
605233
605585
|
continue;
|
|
605234
605586
|
}
|
|
@@ -605265,11 +605617,11 @@ Content-Type: ${contentType}\r
|
|
|
605265
605617
|
addField(name10, value2);
|
|
605266
605618
|
}
|
|
605267
605619
|
for (const [field, pathOrFileId] of Object.entries(files)) {
|
|
605268
|
-
if (!
|
|
605620
|
+
if (!existsSync108(pathOrFileId)) {
|
|
605269
605621
|
addField(field, pathOrFileId);
|
|
605270
605622
|
continue;
|
|
605271
605623
|
}
|
|
605272
|
-
const buffer2 =
|
|
605624
|
+
const buffer2 = readFileSync88(pathOrFileId);
|
|
605273
605625
|
const filename = basename26(pathOrFileId);
|
|
605274
605626
|
parts.push(Buffer.from(`--${boundary}\r
|
|
605275
605627
|
`));
|
|
@@ -605413,7 +605765,7 @@ Content-Type: ${mimeForPath(pathOrFileId, field === "photo" ? "image" : "video")
|
|
|
605413
605765
|
return result.result?.message_id ?? null;
|
|
605414
605766
|
}
|
|
605415
605767
|
async sendLivePhoto(chatId, livePhoto, photo, options2 = {}) {
|
|
605416
|
-
if (!
|
|
605768
|
+
if (!existsSync108(livePhoto) && !existsSync108(photo)) {
|
|
605417
605769
|
const result2 = await this.apiCall("sendLivePhoto", {
|
|
605418
605770
|
chat_id: chatId,
|
|
605419
605771
|
live_photo: livePhoto,
|
|
@@ -605682,43 +606034,43 @@ __export(chat_session_exports, {
|
|
|
605682
606034
|
});
|
|
605683
606035
|
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
605684
606036
|
import {
|
|
605685
|
-
existsSync as
|
|
605686
|
-
readFileSync as
|
|
605687
|
-
readdirSync as
|
|
605688
|
-
writeFileSync as
|
|
606037
|
+
existsSync as existsSync109,
|
|
606038
|
+
readFileSync as readFileSync89,
|
|
606039
|
+
readdirSync as readdirSync38,
|
|
606040
|
+
writeFileSync as writeFileSync58,
|
|
605689
606041
|
renameSync as renameSync5,
|
|
605690
|
-
mkdirSync as
|
|
606042
|
+
mkdirSync as mkdirSync64,
|
|
605691
606043
|
unlinkSync as unlinkSync22
|
|
605692
606044
|
} from "node:fs";
|
|
605693
|
-
import { join as
|
|
606045
|
+
import { join as join124 } from "node:path";
|
|
605694
606046
|
import { homedir as homedir36 } from "node:os";
|
|
605695
606047
|
function sessionsDir() {
|
|
605696
|
-
return
|
|
606048
|
+
return join124(homedir36(), ".omnius", "chat-sessions");
|
|
605697
606049
|
}
|
|
605698
606050
|
function sessionPath(id) {
|
|
605699
606051
|
const safe = id.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
605700
|
-
return
|
|
606052
|
+
return join124(sessionsDir(), `${safe}.json`);
|
|
605701
606053
|
}
|
|
605702
606054
|
function inFlightPath(id) {
|
|
605703
606055
|
const safe = id.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
605704
|
-
return
|
|
606056
|
+
return join124(sessionsDir(), `${safe}.inflight.json`);
|
|
605705
606057
|
}
|
|
605706
606058
|
function persistSession(s2) {
|
|
605707
606059
|
try {
|
|
605708
|
-
|
|
606060
|
+
mkdirSync64(sessionsDir(), { recursive: true });
|
|
605709
606061
|
const final2 = sessionPath(s2.id);
|
|
605710
606062
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
605711
|
-
|
|
606063
|
+
writeFileSync58(tmp, JSON.stringify(s2, null, 2), "utf-8");
|
|
605712
606064
|
renameSync5(tmp, final2);
|
|
605713
606065
|
} catch {
|
|
605714
606066
|
}
|
|
605715
606067
|
}
|
|
605716
606068
|
function persistInFlight(j) {
|
|
605717
606069
|
try {
|
|
605718
|
-
|
|
606070
|
+
mkdirSync64(sessionsDir(), { recursive: true });
|
|
605719
606071
|
const final2 = inFlightPath(j.sessionId);
|
|
605720
606072
|
const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
|
|
605721
|
-
|
|
606073
|
+
writeFileSync58(tmp, JSON.stringify(j, null, 2), "utf-8");
|
|
605722
606074
|
renameSync5(tmp, final2);
|
|
605723
606075
|
} catch {
|
|
605724
606076
|
}
|
|
@@ -605726,7 +606078,7 @@ function persistInFlight(j) {
|
|
|
605726
606078
|
function deleteInFlightFile(id) {
|
|
605727
606079
|
try {
|
|
605728
606080
|
const p2 = inFlightPath(id);
|
|
605729
|
-
if (
|
|
606081
|
+
if (existsSync109(p2)) unlinkSync22(p2);
|
|
605730
606082
|
} catch {
|
|
605731
606083
|
}
|
|
605732
606084
|
}
|
|
@@ -605734,13 +606086,13 @@ function loadPersistedSessions() {
|
|
|
605734
606086
|
const report2 = { restored: 0, staleInFlight: 0 };
|
|
605735
606087
|
try {
|
|
605736
606088
|
const dir = sessionsDir();
|
|
605737
|
-
if (!
|
|
606089
|
+
if (!existsSync109(dir)) return report2;
|
|
605738
606090
|
const cutoff = Date.now() - SESSION_TTL_MS;
|
|
605739
|
-
for (const f2 of
|
|
606091
|
+
for (const f2 of readdirSync38(dir)) {
|
|
605740
606092
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
605741
|
-
const fp =
|
|
606093
|
+
const fp = join124(dir, f2);
|
|
605742
606094
|
try {
|
|
605743
|
-
const parsed = JSON.parse(
|
|
606095
|
+
const parsed = JSON.parse(readFileSync89(fp, "utf-8"));
|
|
605744
606096
|
if (f2.endsWith(".inflight.json")) {
|
|
605745
606097
|
if (parsed && parsed.pid && parsed.status === "running") {
|
|
605746
606098
|
try {
|
|
@@ -605750,7 +606102,7 @@ function loadPersistedSessions() {
|
|
|
605750
606102
|
parsed.error = "Daemon restart while subprocess was running";
|
|
605751
606103
|
parsed.completedAt = Date.now();
|
|
605752
606104
|
try {
|
|
605753
|
-
|
|
606105
|
+
writeFileSync58(fp, JSON.stringify(parsed, null, 2), "utf-8");
|
|
605754
606106
|
} catch {
|
|
605755
606107
|
}
|
|
605756
606108
|
report2.staleInFlight++;
|
|
@@ -605777,23 +606129,23 @@ function buildSystemPrompt(cwd4) {
|
|
|
605777
606129
|
"You are Open Agent (Omnius), an AI coding assistant running locally via Ollama. You have access to the user's workspace and can discuss code, files, and projects. Be helpful, concise, and technically precise. When asked about files or code, describe what you know from the conversation context."
|
|
605778
606130
|
);
|
|
605779
606131
|
parts.push(`\\nEnvironment: ${process.platform}, Node ${process.version}, CWD: ${cwd4}`);
|
|
605780
|
-
const diaryPath =
|
|
605781
|
-
if (
|
|
606132
|
+
const diaryPath = join124(cwd4, ".omnius", "context", "session-diary.md");
|
|
606133
|
+
if (existsSync109(diaryPath)) {
|
|
605782
606134
|
try {
|
|
605783
|
-
const diary =
|
|
606135
|
+
const diary = readFileSync89(diaryPath, "utf-8").slice(0, 1e3);
|
|
605784
606136
|
parts.push(`\\nPrevious session history:\\n${diary}`);
|
|
605785
606137
|
} catch {
|
|
605786
606138
|
}
|
|
605787
606139
|
}
|
|
605788
|
-
const memDir =
|
|
605789
|
-
if (
|
|
606140
|
+
const memDir = join124(cwd4, ".omnius", "memory");
|
|
606141
|
+
if (existsSync109(memDir)) {
|
|
605790
606142
|
try {
|
|
605791
|
-
const files =
|
|
606143
|
+
const files = readdirSync38(memDir).filter((f2) => f2.endsWith(".json")).slice(0, 5);
|
|
605792
606144
|
if (files.length > 0) {
|
|
605793
606145
|
parts.push("\\nPersistent memory topics: " + files.map((f2) => f2.replace(".json", "")).join(", "));
|
|
605794
606146
|
for (const f2 of files.slice(0, 3)) {
|
|
605795
606147
|
try {
|
|
605796
|
-
const data = JSON.parse(
|
|
606148
|
+
const data = JSON.parse(readFileSync89(join124(memDir, f2), "utf-8"));
|
|
605797
606149
|
const entries = Object.entries(data).slice(0, 3);
|
|
605798
606150
|
if (entries.length > 0) {
|
|
605799
606151
|
parts.push(`\\nMemory [${f2.replace(".json", "")}]: ` + entries.map(([k, v]) => `${k}: ${String(v.value ?? v).slice(0, 100)}`).join("; "));
|
|
@@ -605806,10 +606158,10 @@ function buildSystemPrompt(cwd4) {
|
|
|
605806
606158
|
}
|
|
605807
606159
|
}
|
|
605808
606160
|
for (const name10 of ["AGENTS.md", "Omnius.md", ".omnius.md"]) {
|
|
605809
|
-
const p2 =
|
|
605810
|
-
if (
|
|
606161
|
+
const p2 = join124(cwd4, name10);
|
|
606162
|
+
if (existsSync109(p2)) {
|
|
605811
606163
|
try {
|
|
605812
|
-
const content =
|
|
606164
|
+
const content = readFileSync89(p2, "utf-8").slice(0, 500);
|
|
605813
606165
|
parts.push(`\\nProject instructions (${name10}):\\n${content}`);
|
|
605814
606166
|
} catch {
|
|
605815
606167
|
}
|
|
@@ -605826,8 +606178,8 @@ function getSession(sessionId, model, cwd4) {
|
|
|
605826
606178
|
if (sessionId) {
|
|
605827
606179
|
try {
|
|
605828
606180
|
const fp = sessionPath(sessionId);
|
|
605829
|
-
if (
|
|
605830
|
-
const parsed = JSON.parse(
|
|
606181
|
+
if (existsSync109(fp)) {
|
|
606182
|
+
const parsed = JSON.parse(readFileSync89(fp, "utf-8"));
|
|
605831
606183
|
if (parsed && parsed.id === sessionId) {
|
|
605832
606184
|
parsed.lastActivity = Date.now();
|
|
605833
606185
|
sessions.set(sessionId, parsed);
|
|
@@ -605929,11 +606281,11 @@ function addTriageResponseMessage(session, acknowledgment, steering) {
|
|
|
605929
606281
|
}
|
|
605930
606282
|
function checkinPath(sessionId) {
|
|
605931
606283
|
const safe = sessionId.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
605932
|
-
return
|
|
606284
|
+
return join124(sessionsDir(), `${safe}.checkins.jsonl`);
|
|
605933
606285
|
}
|
|
605934
606286
|
function appendCheckin(sessionId, steering) {
|
|
605935
606287
|
try {
|
|
605936
|
-
|
|
606288
|
+
mkdirSync64(sessionsDir(), { recursive: true });
|
|
605937
606289
|
const fp = checkinPath(sessionId);
|
|
605938
606290
|
const entry = JSON.stringify({ ts: Date.now(), steering }) + "\n";
|
|
605939
606291
|
const { appendFileSync: appendFileSync9 } = __require("node:fs");
|
|
@@ -605943,9 +606295,9 @@ function appendCheckin(sessionId, steering) {
|
|
|
605943
606295
|
}
|
|
605944
606296
|
function drainCheckins(sessionId) {
|
|
605945
606297
|
const fp = checkinPath(sessionId);
|
|
605946
|
-
if (!
|
|
606298
|
+
if (!existsSync109(fp)) return [];
|
|
605947
606299
|
try {
|
|
605948
|
-
const raw =
|
|
606300
|
+
const raw = readFileSync89(fp, "utf-8");
|
|
605949
606301
|
try {
|
|
605950
606302
|
unlinkSync22(fp);
|
|
605951
606303
|
} catch {
|
|
@@ -605985,7 +606337,7 @@ function listSessions2() {
|
|
|
605985
606337
|
function deleteSession2(id) {
|
|
605986
606338
|
try {
|
|
605987
606339
|
const p2 = sessionPath(id);
|
|
605988
|
-
if (
|
|
606340
|
+
if (existsSync109(p2)) unlinkSync22(p2);
|
|
605989
606341
|
} catch {
|
|
605990
606342
|
}
|
|
605991
606343
|
deleteInFlightFile(id);
|
|
@@ -605997,8 +606349,8 @@ function lookupSession(id) {
|
|
|
605997
606349
|
if (cached) return cached;
|
|
605998
606350
|
try {
|
|
605999
606351
|
const fp = sessionPath(id);
|
|
606000
|
-
if (
|
|
606001
|
-
const parsed = JSON.parse(
|
|
606352
|
+
if (existsSync109(fp)) {
|
|
606353
|
+
const parsed = JSON.parse(readFileSync89(fp, "utf-8"));
|
|
606002
606354
|
if (parsed && parsed.id === id) {
|
|
606003
606355
|
sessions.set(id, parsed);
|
|
606004
606356
|
return parsed;
|
|
@@ -606050,8 +606402,8 @@ function getInFlightChat(sessionId) {
|
|
|
606050
606402
|
if (cached) return cached;
|
|
606051
606403
|
try {
|
|
606052
606404
|
const p2 = inFlightPath(sessionId);
|
|
606053
|
-
if (
|
|
606054
|
-
const parsed = JSON.parse(
|
|
606405
|
+
if (existsSync109(p2)) {
|
|
606406
|
+
const parsed = JSON.parse(readFileSync89(p2, "utf-8"));
|
|
606055
606407
|
if (parsed && parsed.sessionId === sessionId) {
|
|
606056
606408
|
return parsed;
|
|
606057
606409
|
}
|
|
@@ -606332,14 +606684,14 @@ __export(projects_exports, {
|
|
|
606332
606684
|
setCurrentProject: () => setCurrentProject,
|
|
606333
606685
|
unregisterProject: () => unregisterProject
|
|
606334
606686
|
});
|
|
606335
|
-
import { readFileSync as
|
|
606687
|
+
import { readFileSync as readFileSync90, writeFileSync as writeFileSync59, mkdirSync as mkdirSync65, existsSync as existsSync110, statSync as statSync37, renameSync as renameSync6 } from "node:fs";
|
|
606336
606688
|
import { homedir as homedir37 } from "node:os";
|
|
606337
|
-
import { basename as basename27, join as
|
|
606689
|
+
import { basename as basename27, join as join125, resolve as resolve42 } from "node:path";
|
|
606338
606690
|
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
606339
606691
|
function readAll2() {
|
|
606340
606692
|
try {
|
|
606341
|
-
if (!
|
|
606342
|
-
const raw =
|
|
606693
|
+
if (!existsSync110(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
|
|
606694
|
+
const raw = readFileSync90(PROJECTS_FILE, "utf8");
|
|
606343
606695
|
const parsed = JSON.parse(raw);
|
|
606344
606696
|
if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
|
|
606345
606697
|
return { projects: parsed.projects, schemaVersion: 1 };
|
|
@@ -606348,9 +606700,9 @@ function readAll2() {
|
|
|
606348
606700
|
}
|
|
606349
606701
|
}
|
|
606350
606702
|
function writeAll(file) {
|
|
606351
|
-
|
|
606703
|
+
mkdirSync65(OMNIUS_DIR3, { recursive: true });
|
|
606352
606704
|
const tmp = `${PROJECTS_FILE}.${randomUUID14().slice(0, 8)}.tmp`;
|
|
606353
|
-
|
|
606705
|
+
writeFileSync59(tmp, JSON.stringify(file, null, 2), "utf8");
|
|
606354
606706
|
renameSync6(tmp, PROJECTS_FILE);
|
|
606355
606707
|
}
|
|
606356
606708
|
function listProjects() {
|
|
@@ -606376,7 +606728,7 @@ function registerProject(root, pid) {
|
|
|
606376
606728
|
...existing,
|
|
606377
606729
|
lastSeen: now,
|
|
606378
606730
|
pid: pid ?? existing.pid,
|
|
606379
|
-
omniusDir:
|
|
606731
|
+
omniusDir: join125(canonical, ".omnius")
|
|
606380
606732
|
};
|
|
606381
606733
|
file.projects = file.projects.map((p2) => p2.root === canonical ? entry : p2);
|
|
606382
606734
|
} else {
|
|
@@ -606386,7 +606738,7 @@ function registerProject(root, pid) {
|
|
|
606386
606738
|
firstSeen: now,
|
|
606387
606739
|
lastSeen: now,
|
|
606388
606740
|
pid: pid ?? null,
|
|
606389
|
-
omniusDir:
|
|
606741
|
+
omniusDir: join125(canonical, ".omnius")
|
|
606390
606742
|
};
|
|
606391
606743
|
file.projects.push(entry);
|
|
606392
606744
|
}
|
|
@@ -606415,8 +606767,8 @@ function renameProject(root, name10) {
|
|
|
606415
606767
|
function getCurrentProject() {
|
|
606416
606768
|
if (!currentRoot) {
|
|
606417
606769
|
try {
|
|
606418
|
-
if (
|
|
606419
|
-
const persisted =
|
|
606770
|
+
if (existsSync110(CURRENT_FILE)) {
|
|
606771
|
+
const persisted = readFileSync90(CURRENT_FILE, "utf8").trim();
|
|
606420
606772
|
if (persisted) currentRoot = persisted;
|
|
606421
606773
|
}
|
|
606422
606774
|
} catch {
|
|
@@ -606432,8 +606784,8 @@ function setCurrentProject(root) {
|
|
|
606432
606784
|
if (!entry) return null;
|
|
606433
606785
|
currentRoot = canonical;
|
|
606434
606786
|
try {
|
|
606435
|
-
|
|
606436
|
-
|
|
606787
|
+
mkdirSync65(OMNIUS_DIR3, { recursive: true });
|
|
606788
|
+
writeFileSync59(CURRENT_FILE, `${canonical}
|
|
606437
606789
|
`, "utf8");
|
|
606438
606790
|
} catch {
|
|
606439
606791
|
}
|
|
@@ -606446,9 +606798,9 @@ var OMNIUS_DIR3, PROJECTS_FILE, CURRENT_FILE, currentRoot;
|
|
|
606446
606798
|
var init_projects = __esm({
|
|
606447
606799
|
"packages/cli/src/api/projects.ts"() {
|
|
606448
606800
|
"use strict";
|
|
606449
|
-
OMNIUS_DIR3 =
|
|
606450
|
-
PROJECTS_FILE =
|
|
606451
|
-
CURRENT_FILE =
|
|
606801
|
+
OMNIUS_DIR3 = join125(homedir37(), ".omnius");
|
|
606802
|
+
PROJECTS_FILE = join125(OMNIUS_DIR3, "projects.json");
|
|
606803
|
+
CURRENT_FILE = join125(OMNIUS_DIR3, "current-project");
|
|
606452
606804
|
currentRoot = null;
|
|
606453
606805
|
}
|
|
606454
606806
|
});
|
|
@@ -607151,31 +607503,31 @@ var init_access_policy = __esm({
|
|
|
607151
607503
|
});
|
|
607152
607504
|
|
|
607153
607505
|
// packages/cli/src/api/project-preferences.ts
|
|
607154
|
-
import { createHash as
|
|
607155
|
-
import { existsSync as
|
|
607506
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
607507
|
+
import { existsSync as existsSync111, mkdirSync as mkdirSync66, readFileSync as readFileSync91, renameSync as renameSync7, writeFileSync as writeFileSync60, unlinkSync as unlinkSync23 } from "node:fs";
|
|
607156
607508
|
import { homedir as homedir38 } from "node:os";
|
|
607157
|
-
import { join as
|
|
607509
|
+
import { join as join126, resolve as resolve43 } from "node:path";
|
|
607158
607510
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
607159
607511
|
function projectKey(root) {
|
|
607160
607512
|
const canonical = resolve43(root);
|
|
607161
|
-
return
|
|
607513
|
+
return createHash22("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
607162
607514
|
}
|
|
607163
607515
|
function projectDir(root) {
|
|
607164
|
-
return
|
|
607516
|
+
return join126(PROJECTS_DIR, projectKey(root));
|
|
607165
607517
|
}
|
|
607166
607518
|
function prefsPath(root) {
|
|
607167
|
-
return
|
|
607519
|
+
return join126(projectDir(root), "preferences.json");
|
|
607168
607520
|
}
|
|
607169
607521
|
function rootSentinelPath(root) {
|
|
607170
|
-
return
|
|
607522
|
+
return join126(projectDir(root), ".root");
|
|
607171
607523
|
}
|
|
607172
607524
|
function ensureDir(root) {
|
|
607173
607525
|
const dir = projectDir(root);
|
|
607174
|
-
|
|
607526
|
+
mkdirSync66(dir, { recursive: true });
|
|
607175
607527
|
const sentinel = rootSentinelPath(root);
|
|
607176
607528
|
try {
|
|
607177
|
-
if (!
|
|
607178
|
-
|
|
607529
|
+
if (!existsSync111(sentinel)) {
|
|
607530
|
+
writeFileSync60(sentinel, `${resolve43(root)}
|
|
607179
607531
|
`, "utf8");
|
|
607180
607532
|
}
|
|
607181
607533
|
} catch {
|
|
@@ -607184,8 +607536,8 @@ function ensureDir(root) {
|
|
|
607184
607536
|
function readProjectPreferences(root) {
|
|
607185
607537
|
try {
|
|
607186
607538
|
const file = prefsPath(root);
|
|
607187
|
-
if (!
|
|
607188
|
-
const raw =
|
|
607539
|
+
if (!existsSync111(file)) return { ...DEFAULT_PREFS };
|
|
607540
|
+
const raw = readFileSync91(file, "utf8");
|
|
607189
607541
|
const parsed = JSON.parse(raw);
|
|
607190
607542
|
if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
|
|
607191
607543
|
return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
|
|
@@ -607204,12 +607556,12 @@ function writeProjectPreferences(root, partial) {
|
|
|
607204
607556
|
};
|
|
607205
607557
|
const file = prefsPath(root);
|
|
607206
607558
|
const tmp = `${file}.${randomUUID15().slice(0, 8)}.tmp`;
|
|
607207
|
-
|
|
607559
|
+
writeFileSync60(tmp, JSON.stringify(merged, null, 2), "utf8");
|
|
607208
607560
|
try {
|
|
607209
607561
|
renameSync7(tmp, file);
|
|
607210
607562
|
} catch (err) {
|
|
607211
607563
|
try {
|
|
607212
|
-
|
|
607564
|
+
writeFileSync60(file, JSON.stringify(merged, null, 2), "utf8");
|
|
607213
607565
|
} catch {
|
|
607214
607566
|
}
|
|
607215
607567
|
try {
|
|
@@ -607223,7 +607575,7 @@ function writeProjectPreferences(root, partial) {
|
|
|
607223
607575
|
function deleteProjectPreferences(root) {
|
|
607224
607576
|
try {
|
|
607225
607577
|
const file = prefsPath(root);
|
|
607226
|
-
if (!
|
|
607578
|
+
if (!existsSync111(file)) return false;
|
|
607227
607579
|
unlinkSync23(file);
|
|
607228
607580
|
return true;
|
|
607229
607581
|
} catch {
|
|
@@ -607234,8 +607586,8 @@ var OMNIUS_DIR4, PROJECTS_DIR, SCHEMA_VERSION, DEFAULT_PREFS;
|
|
|
607234
607586
|
var init_project_preferences = __esm({
|
|
607235
607587
|
"packages/cli/src/api/project-preferences.ts"() {
|
|
607236
607588
|
"use strict";
|
|
607237
|
-
OMNIUS_DIR4 =
|
|
607238
|
-
PROJECTS_DIR =
|
|
607589
|
+
OMNIUS_DIR4 = join126(homedir38(), ".omnius");
|
|
607590
|
+
PROJECTS_DIR = join126(OMNIUS_DIR4, "projects");
|
|
607239
607591
|
SCHEMA_VERSION = 1;
|
|
607240
607592
|
DEFAULT_PREFS = {
|
|
607241
607593
|
v: SCHEMA_VERSION,
|
|
@@ -608136,13 +608488,13 @@ __export(audit_log_exports, {
|
|
|
608136
608488
|
recordAudit: () => recordAudit,
|
|
608137
608489
|
sanitizeBody: () => sanitizeBody
|
|
608138
608490
|
});
|
|
608139
|
-
import { mkdirSync as
|
|
608140
|
-
import { join as
|
|
608491
|
+
import { mkdirSync as mkdirSync67, appendFileSync as appendFileSync7, readFileSync as readFileSync92, existsSync as existsSync112 } from "node:fs";
|
|
608492
|
+
import { join as join127 } from "node:path";
|
|
608141
608493
|
function initAuditLog(omniusDir) {
|
|
608142
|
-
auditDir =
|
|
608143
|
-
auditFile =
|
|
608494
|
+
auditDir = join127(omniusDir, "audit");
|
|
608495
|
+
auditFile = join127(auditDir, "audit.jsonl");
|
|
608144
608496
|
try {
|
|
608145
|
-
|
|
608497
|
+
mkdirSync67(auditDir, { recursive: true });
|
|
608146
608498
|
initialized = true;
|
|
608147
608499
|
} catch {
|
|
608148
608500
|
}
|
|
@@ -608171,9 +608523,9 @@ function sanitizeBody(body, maxLen = 200) {
|
|
|
608171
608523
|
return safe.length > maxLen ? safe.slice(0, maxLen) + "..." : safe;
|
|
608172
608524
|
}
|
|
608173
608525
|
function queryAudit(opts) {
|
|
608174
|
-
if (!initialized || !
|
|
608526
|
+
if (!initialized || !existsSync112(auditFile)) return [];
|
|
608175
608527
|
try {
|
|
608176
|
-
const raw =
|
|
608528
|
+
const raw = readFileSync92(auditFile, "utf-8");
|
|
608177
608529
|
const lines = raw.split("\n").filter(Boolean);
|
|
608178
608530
|
let records = lines.map((l2) => {
|
|
608179
608531
|
try {
|
|
@@ -608210,7 +608562,7 @@ var init_audit_log = __esm({
|
|
|
608210
608562
|
|
|
608211
608563
|
// packages/cli/src/api/disk-task-output.ts
|
|
608212
608564
|
import { open } from "node:fs/promises";
|
|
608213
|
-
import { existsSync as
|
|
608565
|
+
import { existsSync as existsSync113, mkdirSync as mkdirSync68, statSync as statSync38 } from "node:fs";
|
|
608214
608566
|
import { dirname as dirname35 } from "node:path";
|
|
608215
608567
|
import * as fsConstants from "node:constants";
|
|
608216
608568
|
var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
|
|
@@ -608230,7 +608582,7 @@ var init_disk_task_output = __esm({
|
|
|
608230
608582
|
fileSize = 0;
|
|
608231
608583
|
constructor(outputPath2) {
|
|
608232
608584
|
this.path = outputPath2;
|
|
608233
|
-
|
|
608585
|
+
mkdirSync68(dirname35(outputPath2), { recursive: true });
|
|
608234
608586
|
}
|
|
608235
608587
|
/** Queue content for async append. Non-blocking. */
|
|
608236
608588
|
append(chunk) {
|
|
@@ -608306,7 +608658,7 @@ var init_disk_task_output = __esm({
|
|
|
608306
608658
|
async readFrom(offset, limit = 65536) {
|
|
608307
608659
|
let handle2 = null;
|
|
608308
608660
|
try {
|
|
608309
|
-
if (!
|
|
608661
|
+
if (!existsSync113(this.path)) {
|
|
608310
608662
|
return { content: "", nextOffset: offset, eof: true, size: 0 };
|
|
608311
608663
|
}
|
|
608312
608664
|
const st = statSync38(this.path);
|
|
@@ -608336,7 +608688,7 @@ var init_disk_task_output = __esm({
|
|
|
608336
608688
|
});
|
|
608337
608689
|
|
|
608338
608690
|
// packages/cli/src/api/http.ts
|
|
608339
|
-
import { createHash as
|
|
608691
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
608340
608692
|
function problemDetails(opts) {
|
|
608341
608693
|
const p2 = {
|
|
608342
608694
|
type: opts.type ?? "about:blank",
|
|
@@ -608399,7 +608751,7 @@ function paginated(items, page2, total) {
|
|
|
608399
608751
|
}
|
|
608400
608752
|
function computeEtag(payload) {
|
|
608401
608753
|
const json = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
608402
|
-
const hash =
|
|
608754
|
+
const hash = createHash23("sha1").update(json).digest("hex").slice(0, 16);
|
|
608403
608755
|
return `W/"${hash}"`;
|
|
608404
608756
|
}
|
|
608405
608757
|
function checkNotModified(req2, res, etag) {
|
|
@@ -608508,19 +608860,19 @@ __export(aiwg_exports, {
|
|
|
608508
608860
|
resolveAiwgRoot: () => resolveAiwgRoot,
|
|
608509
608861
|
tryRouteAiwg: () => tryRouteAiwg
|
|
608510
608862
|
});
|
|
608511
|
-
import { existsSync as
|
|
608512
|
-
import { join as
|
|
608863
|
+
import { existsSync as existsSync114, readFileSync as readFileSync93, readdirSync as readdirSync39, statSync as statSync39 } from "node:fs";
|
|
608864
|
+
import { join as join128 } from "node:path";
|
|
608513
608865
|
import { homedir as homedir39 } from "node:os";
|
|
608514
608866
|
import { execSync as execSync55 } from "node:child_process";
|
|
608515
608867
|
function resolveAiwgRoot() {
|
|
608516
608868
|
if (_cachedAiwgRoot !== void 0) return _cachedAiwgRoot;
|
|
608517
608869
|
const envRoot = process.env["OMNIUS_AIWG_ROOT"];
|
|
608518
|
-
if (envRoot &&
|
|
608870
|
+
if (envRoot && existsSync114(join128(envRoot, "package.json"))) {
|
|
608519
608871
|
_cachedAiwgRoot = envRoot;
|
|
608520
608872
|
return envRoot;
|
|
608521
608873
|
}
|
|
608522
|
-
const shareDir =
|
|
608523
|
-
if (
|
|
608874
|
+
const shareDir = join128(homedir39(), ".local", "share", "ai-writing-guide");
|
|
608875
|
+
if (existsSync114(join128(shareDir, "agentic"))) {
|
|
608524
608876
|
_cachedAiwgRoot = shareDir;
|
|
608525
608877
|
return shareDir;
|
|
608526
608878
|
}
|
|
@@ -608530,8 +608882,8 @@ function resolveAiwgRoot() {
|
|
|
608530
608882
|
timeout: 5e3,
|
|
608531
608883
|
stdio: ["pipe", "pipe", "pipe"]
|
|
608532
608884
|
}).trim();
|
|
608533
|
-
const candidate =
|
|
608534
|
-
if (
|
|
608885
|
+
const candidate = join128(globalRoot, "aiwg");
|
|
608886
|
+
if (existsSync114(join128(candidate, "package.json"))) {
|
|
608535
608887
|
_cachedAiwgRoot = candidate;
|
|
608536
608888
|
return candidate;
|
|
608537
608889
|
}
|
|
@@ -608542,22 +608894,22 @@ function resolveAiwgRoot() {
|
|
|
608542
608894
|
"/usr/lib/node_modules/aiwg",
|
|
608543
608895
|
"/opt/homebrew/lib/node_modules/aiwg"
|
|
608544
608896
|
]) {
|
|
608545
|
-
if (
|
|
608897
|
+
if (existsSync114(join128(p2, "package.json"))) {
|
|
608546
608898
|
_cachedAiwgRoot = p2;
|
|
608547
608899
|
return p2;
|
|
608548
608900
|
}
|
|
608549
608901
|
}
|
|
608550
608902
|
const versionDirs = [
|
|
608551
|
-
|
|
608552
|
-
|
|
608903
|
+
join128(homedir39(), ".nvm", "versions", "node"),
|
|
608904
|
+
join128(homedir39(), ".local", "share", "fnm", "node-versions")
|
|
608553
608905
|
];
|
|
608554
608906
|
for (const vdir of versionDirs) {
|
|
608555
|
-
if (!
|
|
608907
|
+
if (!existsSync114(vdir)) continue;
|
|
608556
608908
|
try {
|
|
608557
|
-
for (const ver of
|
|
608909
|
+
for (const ver of readdirSync39(vdir)) {
|
|
608558
608910
|
for (const prefix of ["lib/node_modules/aiwg", "installation/lib/node_modules/aiwg"]) {
|
|
608559
|
-
const cand =
|
|
608560
|
-
if (
|
|
608911
|
+
const cand = join128(vdir, ver, prefix);
|
|
608912
|
+
if (existsSync114(join128(cand, "package.json"))) {
|
|
608561
608913
|
_cachedAiwgRoot = cand;
|
|
608562
608914
|
return cand;
|
|
608563
608915
|
}
|
|
@@ -608575,11 +608927,11 @@ function resolveAiwgRoot() {
|
|
|
608575
608927
|
if (whichAiwg) {
|
|
608576
608928
|
let cur = whichAiwg;
|
|
608577
608929
|
for (let i2 = 0; i2 < 8; i2++) {
|
|
608578
|
-
cur =
|
|
608579
|
-
const pj =
|
|
608580
|
-
if (
|
|
608930
|
+
cur = join128(cur, "..");
|
|
608931
|
+
const pj = join128(cur, "package.json");
|
|
608932
|
+
if (existsSync114(pj)) {
|
|
608581
608933
|
try {
|
|
608582
|
-
const pkg = JSON.parse(
|
|
608934
|
+
const pkg = JSON.parse(readFileSync93(pj, "utf-8"));
|
|
608583
608935
|
if (pkg.name === "aiwg") {
|
|
608584
608936
|
_cachedAiwgRoot = cur;
|
|
608585
608937
|
return cur;
|
|
@@ -608601,14 +608953,14 @@ function listAiwgFrameworks() {
|
|
|
608601
608953
|
_cachedFrameworks = [];
|
|
608602
608954
|
return _cachedFrameworks;
|
|
608603
608955
|
}
|
|
608604
|
-
const frameworksDir =
|
|
608605
|
-
if (!
|
|
608956
|
+
const frameworksDir = join128(root, "agentic", "code", "frameworks");
|
|
608957
|
+
if (!existsSync114(frameworksDir)) {
|
|
608606
608958
|
_cachedFrameworks = [];
|
|
608607
608959
|
return _cachedFrameworks;
|
|
608608
608960
|
}
|
|
608609
608961
|
const out = [];
|
|
608610
|
-
for (const name10 of
|
|
608611
|
-
const p2 =
|
|
608962
|
+
for (const name10 of readdirSync39(frameworksDir)) {
|
|
608963
|
+
const p2 = join128(frameworksDir, name10);
|
|
608612
608964
|
try {
|
|
608613
608965
|
const st = statSync39(p2);
|
|
608614
608966
|
if (!st.isDirectory()) continue;
|
|
@@ -608634,9 +608986,9 @@ function aggregateDir(dir, depth = 0) {
|
|
|
608634
608986
|
const out = { files: 0, bytes: 0, mdChars: 0, skills: 0, agents: 0, commands: 0 };
|
|
608635
608987
|
if (depth > 8) return out;
|
|
608636
608988
|
try {
|
|
608637
|
-
for (const e2 of
|
|
608989
|
+
for (const e2 of readdirSync39(dir, { withFileTypes: true })) {
|
|
608638
608990
|
if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
|
|
608639
|
-
const p2 =
|
|
608991
|
+
const p2 = join128(dir, e2.name);
|
|
608640
608992
|
if (e2.isDirectory()) {
|
|
608641
608993
|
const sub = aggregateDir(p2, depth + 1);
|
|
608642
608994
|
out.files += sub.files;
|
|
@@ -608666,10 +609018,10 @@ function aggregateDir(dir, depth = 0) {
|
|
|
608666
609018
|
}
|
|
608667
609019
|
function readFirstLineDescription(dir) {
|
|
608668
609020
|
for (const candidate of ["README.md", "SKILL.md", "INDEX.md"]) {
|
|
608669
|
-
const p2 =
|
|
608670
|
-
if (!
|
|
609021
|
+
const p2 = join128(dir, candidate);
|
|
609022
|
+
if (!existsSync114(p2)) continue;
|
|
608671
609023
|
try {
|
|
608672
|
-
const txt =
|
|
609024
|
+
const txt = readFileSync93(p2, "utf-8");
|
|
608673
609025
|
const descMatch = txt.match(/^description:\s*(.+)$/m);
|
|
608674
609026
|
if (descMatch) return descMatch[1].trim().slice(0, 200);
|
|
608675
609027
|
for (const line of txt.split("\n")) {
|
|
@@ -608691,12 +609043,12 @@ function listAiwgItems() {
|
|
|
608691
609043
|
}
|
|
608692
609044
|
const out = [];
|
|
608693
609045
|
const walkRoots = [
|
|
608694
|
-
|
|
608695
|
-
|
|
608696
|
-
|
|
609046
|
+
join128(root, "agentic", "code", "frameworks"),
|
|
609047
|
+
join128(root, "agentic", "code", "addons"),
|
|
609048
|
+
join128(root, "plugins")
|
|
608697
609049
|
];
|
|
608698
609050
|
for (const wr of walkRoots) {
|
|
608699
|
-
if (!
|
|
609051
|
+
if (!existsSync114(wr)) continue;
|
|
608700
609052
|
walkForItems(wr, out, 0);
|
|
608701
609053
|
}
|
|
608702
609054
|
_cachedItems = out;
|
|
@@ -608705,9 +609057,9 @@ function listAiwgItems() {
|
|
|
608705
609057
|
function walkForItems(dir, out, depth) {
|
|
608706
609058
|
if (depth > 10) return;
|
|
608707
609059
|
try {
|
|
608708
|
-
for (const e2 of
|
|
609060
|
+
for (const e2 of readdirSync39(dir, { withFileTypes: true })) {
|
|
608709
609061
|
if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
|
|
608710
|
-
const p2 =
|
|
609062
|
+
const p2 = join128(dir, e2.name);
|
|
608711
609063
|
if (e2.isDirectory()) {
|
|
608712
609064
|
walkForItems(p2, out, depth + 1);
|
|
608713
609065
|
} else if (e2.isFile() && e2.name.endsWith(".md")) {
|
|
@@ -608720,7 +609072,7 @@ function walkForItems(dir, out, depth) {
|
|
|
608720
609072
|
}
|
|
608721
609073
|
function parseItem(p2) {
|
|
608722
609074
|
try {
|
|
608723
|
-
const raw =
|
|
609075
|
+
const raw = readFileSync93(p2, "utf-8");
|
|
608724
609076
|
const header = raw.slice(0, 3e3);
|
|
608725
609077
|
const nameMatch = header.match(/^name:\s*(.+)$/m);
|
|
608726
609078
|
const descMatch = header.match(/^description:\s*(.+)$/m);
|
|
@@ -608758,8 +609110,8 @@ function deriveSource(p2) {
|
|
|
608758
609110
|
}
|
|
608759
609111
|
function loadAiwgItemContent(path11, maxBytes = 2e4) {
|
|
608760
609112
|
try {
|
|
608761
|
-
if (!
|
|
608762
|
-
const raw =
|
|
609113
|
+
if (!existsSync114(path11)) return null;
|
|
609114
|
+
const raw = readFileSync93(path11, "utf-8");
|
|
608763
609115
|
return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
|
|
608764
609116
|
} catch {
|
|
608765
609117
|
return null;
|
|
@@ -608772,14 +609124,14 @@ function listAiwgAddons() {
|
|
|
608772
609124
|
_cachedAddons = [];
|
|
608773
609125
|
return _cachedAddons;
|
|
608774
609126
|
}
|
|
608775
|
-
const addonsDir =
|
|
608776
|
-
if (!
|
|
609127
|
+
const addonsDir = join128(root, "agentic", "code", "addons");
|
|
609128
|
+
if (!existsSync114(addonsDir)) {
|
|
608777
609129
|
_cachedAddons = [];
|
|
608778
609130
|
return _cachedAddons;
|
|
608779
609131
|
}
|
|
608780
609132
|
const out = [];
|
|
608781
|
-
for (const name10 of
|
|
608782
|
-
const p2 =
|
|
609133
|
+
for (const name10 of readdirSync39(addonsDir)) {
|
|
609134
|
+
const p2 = join128(addonsDir, name10);
|
|
608783
609135
|
try {
|
|
608784
609136
|
const st = statSync39(p2);
|
|
608785
609137
|
if (!st.isDirectory()) continue;
|
|
@@ -609268,18 +609620,18 @@ __export(runtime_keys_exports, {
|
|
|
609268
609620
|
mintKey: () => mintKey,
|
|
609269
609621
|
revokeByPrefix: () => revokeByPrefix
|
|
609270
609622
|
});
|
|
609271
|
-
import { existsSync as
|
|
609272
|
-
import { join as
|
|
609623
|
+
import { existsSync as existsSync115, readFileSync as readFileSync94, writeFileSync as writeFileSync61, mkdirSync as mkdirSync69, chmodSync } from "node:fs";
|
|
609624
|
+
import { join as join129 } from "node:path";
|
|
609273
609625
|
import { homedir as homedir40 } from "node:os";
|
|
609274
609626
|
import { randomBytes as randomBytes22 } from "node:crypto";
|
|
609275
609627
|
function ensureDir2() {
|
|
609276
|
-
const dir =
|
|
609277
|
-
if (!
|
|
609628
|
+
const dir = join129(homedir40(), ".omnius");
|
|
609629
|
+
if (!existsSync115(dir)) mkdirSync69(dir, { recursive: true });
|
|
609278
609630
|
}
|
|
609279
609631
|
function loadAll() {
|
|
609280
|
-
if (!
|
|
609632
|
+
if (!existsSync115(KEYS_FILE)) return [];
|
|
609281
609633
|
try {
|
|
609282
|
-
const raw =
|
|
609634
|
+
const raw = readFileSync94(KEYS_FILE, "utf-8");
|
|
609283
609635
|
const parsed = JSON.parse(raw);
|
|
609284
609636
|
if (!Array.isArray(parsed)) return [];
|
|
609285
609637
|
return parsed;
|
|
@@ -609289,7 +609641,7 @@ function loadAll() {
|
|
|
609289
609641
|
}
|
|
609290
609642
|
function persistAll(records) {
|
|
609291
609643
|
ensureDir2();
|
|
609292
|
-
|
|
609644
|
+
writeFileSync61(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
|
|
609293
609645
|
try {
|
|
609294
609646
|
chmodSync(KEYS_FILE, 384);
|
|
609295
609647
|
} catch {
|
|
@@ -609354,7 +609706,7 @@ var KEYS_FILE;
|
|
|
609354
609706
|
var init_runtime_keys = __esm({
|
|
609355
609707
|
"packages/cli/src/api/runtime-keys.ts"() {
|
|
609356
609708
|
"use strict";
|
|
609357
|
-
KEYS_FILE =
|
|
609709
|
+
KEYS_FILE = join129(homedir40(), ".omnius", "keys.json");
|
|
609358
609710
|
}
|
|
609359
609711
|
});
|
|
609360
609712
|
|
|
@@ -609365,20 +609717,20 @@ __export(tor_fallback_exports, {
|
|
|
609365
609717
|
torIsReachable: () => torIsReachable,
|
|
609366
609718
|
tunnelViaTor: () => tunnelViaTor
|
|
609367
609719
|
});
|
|
609368
|
-
import { existsSync as
|
|
609720
|
+
import { existsSync as existsSync116, readFileSync as readFileSync95 } from "node:fs";
|
|
609369
609721
|
import { homedir as homedir41 } from "node:os";
|
|
609370
|
-
import { join as
|
|
609722
|
+
import { join as join130 } from "node:path";
|
|
609371
609723
|
import { createConnection as createConnection3 } from "node:net";
|
|
609372
609724
|
function getLocalOnion() {
|
|
609373
609725
|
const candidates = [
|
|
609374
|
-
|
|
609375
|
-
|
|
609726
|
+
join130(homedir41(), "hidden_service_hostname"),
|
|
609727
|
+
join130(homedir41(), ".omnius", "tor", "hostname"),
|
|
609376
609728
|
"/var/lib/tor/hidden_service/hostname"
|
|
609377
609729
|
];
|
|
609378
609730
|
for (const p2 of candidates) {
|
|
609379
609731
|
try {
|
|
609380
|
-
if (
|
|
609381
|
-
const v =
|
|
609732
|
+
if (existsSync116(p2)) {
|
|
609733
|
+
const v = readFileSync95(p2, "utf-8").trim();
|
|
609382
609734
|
if (v && v.endsWith(".onion")) return v;
|
|
609383
609735
|
}
|
|
609384
609736
|
} catch {
|
|
@@ -609523,8 +609875,8 @@ __export(graphical_sudo_exports, {
|
|
|
609523
609875
|
runGraphicalSudo: () => runGraphicalSudo
|
|
609524
609876
|
});
|
|
609525
609877
|
import { spawn as spawn27 } from "node:child_process";
|
|
609526
|
-
import { existsSync as
|
|
609527
|
-
import { join as
|
|
609878
|
+
import { existsSync as existsSync117, mkdirSync as mkdirSync70, writeFileSync as writeFileSync62, chmodSync as chmodSync2 } from "node:fs";
|
|
609879
|
+
import { join as join131 } from "node:path";
|
|
609528
609880
|
import { tmpdir as tmpdir21 } from "node:os";
|
|
609529
609881
|
function detectSudoHelper() {
|
|
609530
609882
|
if (process.platform === "win32") return null;
|
|
@@ -609540,15 +609892,15 @@ function which2(cmd) {
|
|
|
609540
609892
|
const path11 = process.env["PATH"] || "/usr/bin:/bin:/usr/local/bin";
|
|
609541
609893
|
for (const dir of path11.split(":")) {
|
|
609542
609894
|
if (!dir) continue;
|
|
609543
|
-
const full =
|
|
609544
|
-
if (
|
|
609895
|
+
const full = join131(dir, cmd);
|
|
609896
|
+
if (existsSync117(full)) return full;
|
|
609545
609897
|
}
|
|
609546
609898
|
return null;
|
|
609547
609899
|
}
|
|
609548
609900
|
function ensureAskpassShim(helper, description) {
|
|
609549
|
-
const shimDir =
|
|
609550
|
-
|
|
609551
|
-
const shim =
|
|
609901
|
+
const shimDir = join131(tmpdir21(), "omnius-askpass");
|
|
609902
|
+
mkdirSync70(shimDir, { recursive: true });
|
|
609903
|
+
const shim = join131(shimDir, `${helper}.sh`);
|
|
609552
609904
|
let body;
|
|
609553
609905
|
if (helper === "zenity") {
|
|
609554
609906
|
body = `#!/bin/sh
|
|
@@ -609559,7 +609911,7 @@ exec zenity --password --title="Omnius needs sudo" --text="${description.replace
|
|
|
609559
609911
|
exec kdialog --password "${description.replace(/"/g, '\\"')}" 2>/dev/null
|
|
609560
609912
|
`;
|
|
609561
609913
|
}
|
|
609562
|
-
|
|
609914
|
+
writeFileSync62(shim, body, "utf-8");
|
|
609563
609915
|
chmodSync2(shim, 493);
|
|
609564
609916
|
return shim;
|
|
609565
609917
|
}
|
|
@@ -609639,8 +609991,8 @@ var init_graphical_sudo = __esm({
|
|
|
609639
609991
|
});
|
|
609640
609992
|
|
|
609641
609993
|
// packages/cli/src/api/routes-v1.ts
|
|
609642
|
-
import { existsSync as
|
|
609643
|
-
import { join as
|
|
609994
|
+
import { existsSync as existsSync118, readFileSync as readFileSync96, readdirSync as readdirSync40, statSync as statSync40 } from "node:fs";
|
|
609995
|
+
import { join as join132, resolve as pathResolve2 } from "node:path";
|
|
609644
609996
|
import { homedir as homedir42 } from "node:os";
|
|
609645
609997
|
async function tryRouteV1(ctx3) {
|
|
609646
609998
|
const { pathname, method } = ctx3;
|
|
@@ -609876,11 +610228,11 @@ async function handleGetSkill(ctx3, name10) {
|
|
|
609876
610228
|
async function fallbackDiscoverSkills() {
|
|
609877
610229
|
return (_root) => {
|
|
609878
610230
|
const roots = [
|
|
609879
|
-
|
|
610231
|
+
join132(homedir42(), ".local", "share", "ai-writing-guide")
|
|
609880
610232
|
];
|
|
609881
610233
|
const out = [];
|
|
609882
610234
|
for (const root of roots) {
|
|
609883
|
-
if (!
|
|
610235
|
+
if (!existsSync118(root)) continue;
|
|
609884
610236
|
walkForSkills(root, out, 0);
|
|
609885
610237
|
}
|
|
609886
610238
|
return out;
|
|
@@ -609889,14 +610241,14 @@ async function fallbackDiscoverSkills() {
|
|
|
609889
610241
|
function walkForSkills(dir, out, depth) {
|
|
609890
610242
|
if (depth > 6) return;
|
|
609891
610243
|
try {
|
|
609892
|
-
for (const e2 of
|
|
610244
|
+
for (const e2 of readdirSync40(dir, { withFileTypes: true })) {
|
|
609893
610245
|
if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
|
|
609894
|
-
const p2 =
|
|
610246
|
+
const p2 = join132(dir, e2.name);
|
|
609895
610247
|
if (e2.isDirectory()) {
|
|
609896
610248
|
walkForSkills(p2, out, depth + 1);
|
|
609897
610249
|
} else if (e2.isFile() && e2.name === "SKILL.md") {
|
|
609898
610250
|
try {
|
|
609899
|
-
const content =
|
|
610251
|
+
const content = readFileSync96(p2, "utf-8").slice(0, 2e3);
|
|
609900
610252
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
609901
610253
|
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
609902
610254
|
out.push({
|
|
@@ -610076,10 +610428,10 @@ async function handleCallMcp(ctx3, name10) {
|
|
|
610076
610428
|
}
|
|
610077
610429
|
}
|
|
610078
610430
|
function memoryDbPaths2(baseDir = process.cwd()) {
|
|
610079
|
-
const dir =
|
|
610431
|
+
const dir = join132(baseDir, ".omnius");
|
|
610080
610432
|
return {
|
|
610081
|
-
episodes:
|
|
610082
|
-
knowledge:
|
|
610433
|
+
episodes: join132(dir, "episodes.db"),
|
|
610434
|
+
knowledge: join132(dir, "knowledge.db")
|
|
610083
610435
|
};
|
|
610084
610436
|
}
|
|
610085
610437
|
async function getMemoryStores() {
|
|
@@ -610345,7 +610697,7 @@ async function handleFilesRead(ctx3) {
|
|
|
610345
610697
|
}));
|
|
610346
610698
|
return true;
|
|
610347
610699
|
}
|
|
610348
|
-
if (!
|
|
610700
|
+
if (!existsSync118(resolved)) {
|
|
610349
610701
|
sendProblem(res, problemDetails({
|
|
610350
610702
|
type: P.notFound,
|
|
610351
610703
|
status: 404,
|
|
@@ -610377,7 +610729,7 @@ async function handleFilesRead(ctx3) {
|
|
|
610377
610729
|
}));
|
|
610378
610730
|
return true;
|
|
610379
610731
|
}
|
|
610380
|
-
const content =
|
|
610732
|
+
const content = readFileSync96(resolved, "utf-8");
|
|
610381
610733
|
const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
|
|
610382
610734
|
const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
|
|
610383
610735
|
const slice2 = content.slice(offset, offset + limit);
|
|
@@ -610610,14 +610962,14 @@ async function handleNexusStatus(ctx3) {
|
|
|
610610
610962
|
const { res, requestId } = ctx3;
|
|
610611
610963
|
try {
|
|
610612
610964
|
const statePaths = [
|
|
610613
|
-
|
|
610614
|
-
|
|
610965
|
+
join132(process.cwd(), ".omnius", "nexus-peer-state.json"),
|
|
610966
|
+
join132(homedir42(), ".omnius", "nexus-peer-cache.json")
|
|
610615
610967
|
];
|
|
610616
610968
|
const states = [];
|
|
610617
610969
|
for (const p2 of statePaths) {
|
|
610618
|
-
if (!
|
|
610970
|
+
if (!existsSync118(p2)) continue;
|
|
610619
610971
|
try {
|
|
610620
|
-
const raw =
|
|
610972
|
+
const raw = readFileSync96(p2, "utf-8");
|
|
610621
610973
|
states.push({ source: p2, data: JSON.parse(raw) });
|
|
610622
610974
|
} catch (e2) {
|
|
610623
610975
|
states.push({ source: p2, error: String(e2) });
|
|
@@ -610644,8 +610996,8 @@ async function handleNexusStatus(ctx3) {
|
|
|
610644
610996
|
}
|
|
610645
610997
|
function loadAgentName() {
|
|
610646
610998
|
try {
|
|
610647
|
-
const p2 =
|
|
610648
|
-
if (
|
|
610999
|
+
const p2 = join132(homedir42(), ".omnius", "agent-name");
|
|
611000
|
+
if (existsSync118(p2)) return readFileSync96(p2, "utf-8").trim();
|
|
610649
611001
|
} catch {
|
|
610650
611002
|
}
|
|
610651
611003
|
return null;
|
|
@@ -610654,14 +611006,14 @@ async function handleSponsors(ctx3) {
|
|
|
610654
611006
|
const { req: req2, res, url, requestId } = ctx3;
|
|
610655
611007
|
try {
|
|
610656
611008
|
const candidates = [
|
|
610657
|
-
|
|
610658
|
-
|
|
611009
|
+
join132(homedir42(), ".omnius", "sponsor-cache.json"),
|
|
611010
|
+
join132(homedir42(), ".omnius", "sponsors.json")
|
|
610659
611011
|
];
|
|
610660
611012
|
let sponsors = [];
|
|
610661
611013
|
for (const p2 of candidates) {
|
|
610662
|
-
if (!
|
|
611014
|
+
if (!existsSync118(p2)) continue;
|
|
610663
611015
|
try {
|
|
610664
|
-
const raw = JSON.parse(
|
|
611016
|
+
const raw = JSON.parse(readFileSync96(p2, "utf-8"));
|
|
610665
611017
|
if (Array.isArray(raw)) {
|
|
610666
611018
|
sponsors = raw;
|
|
610667
611019
|
break;
|
|
@@ -610730,8 +611082,8 @@ async function handleEvaluate(ctx3) {
|
|
|
610730
611082
|
}));
|
|
610731
611083
|
return true;
|
|
610732
611084
|
}
|
|
610733
|
-
const jobPath =
|
|
610734
|
-
if (!
|
|
611085
|
+
const jobPath = join132(process.cwd(), ".omnius", "jobs", `${runId}.json`);
|
|
611086
|
+
if (!existsSync118(jobPath)) {
|
|
610735
611087
|
sendProblem(res, problemDetails({
|
|
610736
611088
|
type: P.notFound,
|
|
610737
611089
|
status: 404,
|
|
@@ -610741,7 +611093,7 @@ async function handleEvaluate(ctx3) {
|
|
|
610741
611093
|
}));
|
|
610742
611094
|
return true;
|
|
610743
611095
|
}
|
|
610744
|
-
const job = JSON.parse(
|
|
611096
|
+
const job = JSON.parse(readFileSync96(jobPath, "utf-8"));
|
|
610745
611097
|
sendJson(res, 200, {
|
|
610746
611098
|
run_id: runId,
|
|
610747
611099
|
task: job.task,
|
|
@@ -610879,9 +611231,9 @@ async function handleMintKey(ctx3) {
|
|
|
610879
611231
|
return true;
|
|
610880
611232
|
}
|
|
610881
611233
|
function _readStatusFile(p2) {
|
|
610882
|
-
if (!
|
|
611234
|
+
if (!existsSync118(p2)) return null;
|
|
610883
611235
|
try {
|
|
610884
|
-
const data = JSON.parse(
|
|
611236
|
+
const data = JSON.parse(readFileSync96(p2, "utf-8"));
|
|
610885
611237
|
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
610886
611238
|
const pid = Number(data.pid);
|
|
610887
611239
|
if (pid > 0) {
|
|
@@ -610904,32 +611256,32 @@ function _readStatusFile(p2) {
|
|
|
610904
611256
|
function resolveLocalPeerId() {
|
|
610905
611257
|
const override = process.env["OMNIUS_NEXUS_DIR"];
|
|
610906
611258
|
if (override) {
|
|
610907
|
-
const r2 = _readStatusFile(
|
|
611259
|
+
const r2 = _readStatusFile(join132(override, "status.json"));
|
|
610908
611260
|
if (r2) return r2;
|
|
610909
611261
|
}
|
|
610910
611262
|
const scope = (process.env["OMNIUS_NEXUS_SCOPE"] || "").toLowerCase();
|
|
610911
611263
|
const projectScopeFlag = (process.env["OMNIUS_NEXUS_PROJECT_SCOPE"] || "").toLowerCase();
|
|
610912
611264
|
const projectScoped = scope === "project" || scope === "local" || projectScopeFlag === "1" || projectScopeFlag === "true" || projectScopeFlag === "yes";
|
|
610913
611265
|
const candidates = projectScoped ? [
|
|
610914
|
-
|
|
610915
|
-
|
|
611266
|
+
join132(process.cwd(), ".omnius", "nexus", "status.json"),
|
|
611267
|
+
join132(homedir42(), ".omnius", "nexus", "status.json")
|
|
610916
611268
|
] : [
|
|
610917
|
-
|
|
610918
|
-
|
|
611269
|
+
join132(homedir42(), ".omnius", "nexus", "status.json"),
|
|
611270
|
+
join132(process.cwd(), ".omnius", "nexus", "status.json")
|
|
610919
611271
|
];
|
|
610920
611272
|
for (const p2 of candidates) {
|
|
610921
611273
|
const r2 = _readStatusFile(p2);
|
|
610922
611274
|
if (r2) return r2;
|
|
610923
611275
|
}
|
|
610924
611276
|
try {
|
|
610925
|
-
const regPath =
|
|
610926
|
-
if (
|
|
610927
|
-
const reg = JSON.parse(
|
|
611277
|
+
const regPath = join132(homedir42(), ".omnius", "nexus-registry.json");
|
|
611278
|
+
if (existsSync118(regPath)) {
|
|
611279
|
+
const reg = JSON.parse(readFileSync96(regPath, "utf-8"));
|
|
610928
611280
|
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
610929
611281
|
for (const entry of entries) {
|
|
610930
611282
|
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
610931
611283
|
if (typeof dir === "string") {
|
|
610932
|
-
const r2 = _readStatusFile(
|
|
611284
|
+
const r2 = _readStatusFile(join132(dir, "status.json"));
|
|
610933
611285
|
if (r2) return r2;
|
|
610934
611286
|
}
|
|
610935
611287
|
}
|
|
@@ -610963,21 +611315,21 @@ function locateTorScript(filename) {
|
|
|
610963
611315
|
const candidates = [
|
|
610964
611316
|
// npm-installed layout: build-publish.mjs copies scripts to
|
|
610965
611317
|
// publish/dist/scripts/tor/ which lands at <install>/dist/scripts/tor/.
|
|
610966
|
-
|
|
610967
|
-
|
|
610968
|
-
|
|
611318
|
+
join132(__dirname, "scripts", "tor", filename),
|
|
611319
|
+
join132(__dirname, "..", "scripts", "tor", filename),
|
|
611320
|
+
join132(__dirname, "..", "..", "scripts", "tor", filename),
|
|
610969
611321
|
// Workspace dev: cli package's source tree.
|
|
610970
|
-
|
|
610971
|
-
|
|
611322
|
+
join132(process.cwd(), "packages", "cli", "scripts", "tor", filename),
|
|
611323
|
+
join132(process.cwd(), "scripts", "tor", filename)
|
|
610972
611324
|
];
|
|
610973
611325
|
for (const p2 of candidates) {
|
|
610974
|
-
if (
|
|
611326
|
+
if (existsSync118(p2)) return p2;
|
|
610975
611327
|
}
|
|
610976
611328
|
try {
|
|
610977
611329
|
const { execSync: execSync60 } = __require("node:child_process");
|
|
610978
611330
|
const root = execSync60("npm root -g", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
610979
|
-
const p2 =
|
|
610980
|
-
if (
|
|
611331
|
+
const p2 = join132(root, "omnius", "dist", "scripts", "tor", filename);
|
|
611332
|
+
if (existsSync118(p2)) return p2;
|
|
610981
611333
|
} catch {
|
|
610982
611334
|
}
|
|
610983
611335
|
return null;
|
|
@@ -611249,15 +611601,15 @@ async function handleRemoteProxy(ctx3) {
|
|
|
611249
611601
|
const tunnelScope = (process.env["OMNIUS_NEXUS_SCOPE"] || "").toLowerCase();
|
|
611250
611602
|
const tunnelProjectScope = tunnelScope === "project" || tunnelScope === "local" || ["1", "true", "yes"].includes((process.env["OMNIUS_NEXUS_PROJECT_SCOPE"] || "").toLowerCase());
|
|
611251
611603
|
const nexusCandidates = tunnelProjectScope ? [
|
|
611252
|
-
|
|
611253
|
-
|
|
611604
|
+
join132(process.cwd(), ".omnius", "nexus"),
|
|
611605
|
+
join132(homedir42(), ".omnius", "nexus")
|
|
611254
611606
|
] : [
|
|
611255
|
-
|
|
611256
|
-
|
|
611607
|
+
join132(homedir42(), ".omnius", "nexus"),
|
|
611608
|
+
join132(process.cwd(), ".omnius", "nexus")
|
|
611257
611609
|
];
|
|
611258
611610
|
let nexusDirPath = null;
|
|
611259
611611
|
for (const p2 of nexusCandidates) {
|
|
611260
|
-
if (
|
|
611612
|
+
if (existsSync118(join132(p2, "status.json"))) {
|
|
611261
611613
|
nexusDirPath = p2;
|
|
611262
611614
|
break;
|
|
611263
611615
|
}
|
|
@@ -611353,7 +611705,7 @@ async function handleRemoteProxy(ctx3) {
|
|
|
611353
611705
|
}));
|
|
611354
611706
|
return true;
|
|
611355
611707
|
}
|
|
611356
|
-
const streamFile =
|
|
611708
|
+
const streamFile = join132(nexusDirPath, `tunnel-${requestId}-${Date.now()}.jsonl`);
|
|
611357
611709
|
try {
|
|
611358
611710
|
const { writeFileSync: _wfs } = await import("node:fs");
|
|
611359
611711
|
_wfs(streamFile, "");
|
|
@@ -611914,14 +612266,14 @@ async function handleListEngines(ctx3) {
|
|
|
611914
612266
|
const home = homedir42();
|
|
611915
612267
|
sendJson(res, 200, {
|
|
611916
612268
|
engines: [
|
|
611917
|
-
{ name: "dream", state_file:
|
|
611918
|
-
{ name: "bless", state_file:
|
|
611919
|
-
{ name: "call", state_file:
|
|
611920
|
-
{ name: "listen", state_file:
|
|
611921
|
-
{ name: "telegram", state_file:
|
|
611922
|
-
{ name: "expose", state_file:
|
|
611923
|
-
{ name: "nexus", state_file:
|
|
611924
|
-
{ name: "ipfs", state_file:
|
|
612269
|
+
{ name: "dream", state_file: join132(process.cwd(), ".omnius", "dreams"), controllable_via: "SSE + slash commands" },
|
|
612270
|
+
{ name: "bless", state_file: join132(process.cwd(), ".omnius", "bless-state.json"), controllable_via: "slash commands" },
|
|
612271
|
+
{ name: "call", state_file: join132(process.cwd(), ".omnius", "call-state.json"), controllable_via: "slash commands" },
|
|
612272
|
+
{ name: "listen", state_file: join132(process.cwd(), ".omnius", "listen-state.json"), controllable_via: "slash commands" },
|
|
612273
|
+
{ name: "telegram", state_file: join132(home, ".omnius", "telegram-state.json"), controllable_via: "slash commands" },
|
|
612274
|
+
{ name: "expose", state_file: join132(process.cwd(), ".omnius", "expose-state.json"), controllable_via: "/expose commands" },
|
|
612275
|
+
{ name: "nexus", state_file: join132(home, ".omnius", "nexus-peer-cache.json"), controllable_via: "/nexus commands" },
|
|
612276
|
+
{ name: "ipfs", state_file: join132(process.cwd(), ".omnius", "ipfs"), controllable_via: "slash commands" }
|
|
611925
612277
|
],
|
|
611926
612278
|
note: "Engine instrumentation lives in the running TUI process. Full status + control requires the daemon↔TUI bridge (PT-07). See parity audit WO-PARITY-04."
|
|
611927
612279
|
});
|
|
@@ -612004,21 +612356,21 @@ async function tryAimsRoute(ctx3) {
|
|
|
612004
612356
|
return false;
|
|
612005
612357
|
}
|
|
612006
612358
|
function aimsDir() {
|
|
612007
|
-
return
|
|
612359
|
+
return join132(homedir42(), ".omnius", "aims");
|
|
612008
612360
|
}
|
|
612009
612361
|
function readAimsFile(name10, fallback) {
|
|
612010
612362
|
try {
|
|
612011
|
-
const p2 =
|
|
612012
|
-
if (
|
|
612363
|
+
const p2 = join132(aimsDir(), name10);
|
|
612364
|
+
if (existsSync118(p2)) return JSON.parse(readFileSync96(p2, "utf-8"));
|
|
612013
612365
|
} catch {
|
|
612014
612366
|
}
|
|
612015
612367
|
return fallback;
|
|
612016
612368
|
}
|
|
612017
612369
|
function writeAimsFile(name10, data) {
|
|
612018
612370
|
const dir = aimsDir();
|
|
612019
|
-
const { mkdirSync:
|
|
612020
|
-
|
|
612021
|
-
const finalPath =
|
|
612371
|
+
const { mkdirSync: mkdirSync79, writeFileSync: wf, renameSync: rn } = __require("node:fs");
|
|
612372
|
+
mkdirSync79(dir, { recursive: true });
|
|
612373
|
+
const finalPath = join132(dir, name10);
|
|
612022
612374
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
612023
612375
|
try {
|
|
612024
612376
|
wf(tmpPath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
@@ -612348,12 +612700,12 @@ async function handleAimsSuppliers(ctx3) {
|
|
|
612348
612700
|
}
|
|
612349
612701
|
];
|
|
612350
612702
|
const sponsorPaths = [
|
|
612351
|
-
|
|
612703
|
+
join132(homedir42(), ".omnius", "sponsor-cache.json")
|
|
612352
612704
|
];
|
|
612353
612705
|
for (const p2 of sponsorPaths) {
|
|
612354
|
-
if (!
|
|
612706
|
+
if (!existsSync118(p2)) continue;
|
|
612355
612707
|
try {
|
|
612356
|
-
const raw = JSON.parse(
|
|
612708
|
+
const raw = JSON.parse(readFileSync96(p2, "utf-8"));
|
|
612357
612709
|
const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
|
|
612358
612710
|
for (const s2 of list) {
|
|
612359
612711
|
suppliers.push({
|
|
@@ -621747,15 +622099,15 @@ var init_auth_oidc = __esm({
|
|
|
621747
622099
|
});
|
|
621748
622100
|
|
|
621749
622101
|
// packages/cli/src/api/usage-tracker.ts
|
|
621750
|
-
import { mkdirSync as
|
|
621751
|
-
import { join as
|
|
622102
|
+
import { mkdirSync as mkdirSync71, readFileSync as readFileSync97, writeFileSync as writeFileSync63, existsSync as existsSync119 } from "node:fs";
|
|
622103
|
+
import { join as join133 } from "node:path";
|
|
621752
622104
|
function initUsageTracker(omniusDir) {
|
|
621753
|
-
const dir =
|
|
621754
|
-
|
|
621755
|
-
usageFile =
|
|
622105
|
+
const dir = join133(omniusDir, "usage");
|
|
622106
|
+
mkdirSync71(dir, { recursive: true });
|
|
622107
|
+
usageFile = join133(dir, "token-usage.json");
|
|
621756
622108
|
try {
|
|
621757
|
-
if (
|
|
621758
|
-
store = JSON.parse(
|
|
622109
|
+
if (existsSync119(usageFile)) {
|
|
622110
|
+
store = JSON.parse(readFileSync97(usageFile, "utf-8"));
|
|
621759
622111
|
}
|
|
621760
622112
|
} catch {
|
|
621761
622113
|
store = { providers: {}, lastSaved: "" };
|
|
@@ -621791,7 +622143,7 @@ function flush2() {
|
|
|
621791
622143
|
if (!initialized2 || !dirty) return;
|
|
621792
622144
|
try {
|
|
621793
622145
|
store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
|
|
621794
|
-
|
|
622146
|
+
writeFileSync63(usageFile, JSON.stringify(store, null, 2), "utf-8");
|
|
621795
622147
|
dirty = false;
|
|
621796
622148
|
} catch {
|
|
621797
622149
|
}
|
|
@@ -621819,24 +622171,24 @@ var init_usage_tracker = __esm({
|
|
|
621819
622171
|
});
|
|
621820
622172
|
|
|
621821
622173
|
// packages/cli/src/api/profiles.ts
|
|
621822
|
-
import { existsSync as
|
|
621823
|
-
import { join as
|
|
622174
|
+
import { existsSync as existsSync120, readFileSync as readFileSync98, writeFileSync as writeFileSync64, mkdirSync as mkdirSync72, readdirSync as readdirSync41, unlinkSync as unlinkSync24 } from "node:fs";
|
|
622175
|
+
import { join as join134 } from "node:path";
|
|
621824
622176
|
import { homedir as homedir43 } from "node:os";
|
|
621825
622177
|
import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv5, randomBytes as randomBytes23, scryptSync as scryptSync3 } from "node:crypto";
|
|
621826
622178
|
function globalProfileDir() {
|
|
621827
|
-
return
|
|
622179
|
+
return join134(homedir43(), ".omnius", "profiles");
|
|
621828
622180
|
}
|
|
621829
622181
|
function projectProfileDir(projectDir2) {
|
|
621830
|
-
return
|
|
622182
|
+
return join134(projectDir2 || process.cwd(), ".omnius", "profiles");
|
|
621831
622183
|
}
|
|
621832
622184
|
function listProfiles(projectDir2) {
|
|
621833
622185
|
const result = [];
|
|
621834
622186
|
const seen = /* @__PURE__ */ new Set();
|
|
621835
622187
|
const projDir = projectProfileDir(projectDir2);
|
|
621836
|
-
if (
|
|
621837
|
-
for (const f2 of
|
|
622188
|
+
if (existsSync120(projDir)) {
|
|
622189
|
+
for (const f2 of readdirSync41(projDir).filter((f3) => f3.endsWith(".json"))) {
|
|
621838
622190
|
try {
|
|
621839
|
-
const raw = JSON.parse(
|
|
622191
|
+
const raw = JSON.parse(readFileSync98(join134(projDir, f2), "utf8"));
|
|
621840
622192
|
const name10 = f2.replace(".json", "");
|
|
621841
622193
|
seen.add(name10);
|
|
621842
622194
|
result.push({
|
|
@@ -621850,12 +622202,12 @@ function listProfiles(projectDir2) {
|
|
|
621850
622202
|
}
|
|
621851
622203
|
}
|
|
621852
622204
|
const globDir = globalProfileDir();
|
|
621853
|
-
if (
|
|
621854
|
-
for (const f2 of
|
|
622205
|
+
if (existsSync120(globDir)) {
|
|
622206
|
+
for (const f2 of readdirSync41(globDir).filter((f3) => f3.endsWith(".json"))) {
|
|
621855
622207
|
const name10 = f2.replace(".json", "");
|
|
621856
622208
|
if (seen.has(name10)) continue;
|
|
621857
622209
|
try {
|
|
621858
|
-
const raw = JSON.parse(
|
|
622210
|
+
const raw = JSON.parse(readFileSync98(join134(globDir, f2), "utf8"));
|
|
621859
622211
|
result.push({
|
|
621860
622212
|
name: name10,
|
|
621861
622213
|
description: raw.description || "",
|
|
@@ -621870,11 +622222,11 @@ function listProfiles(projectDir2) {
|
|
|
621870
622222
|
}
|
|
621871
622223
|
function loadProfile(name10, password, projectDir2) {
|
|
621872
622224
|
const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
621873
|
-
const projPath =
|
|
621874
|
-
const globPath =
|
|
621875
|
-
const filePath =
|
|
622225
|
+
const projPath = join134(projectProfileDir(projectDir2), `${sanitized}.json`);
|
|
622226
|
+
const globPath = join134(globalProfileDir(), `${sanitized}.json`);
|
|
622227
|
+
const filePath = existsSync120(projPath) ? projPath : existsSync120(globPath) ? globPath : null;
|
|
621876
622228
|
if (!filePath) return null;
|
|
621877
|
-
const raw = JSON.parse(
|
|
622229
|
+
const raw = JSON.parse(readFileSync98(filePath, "utf8"));
|
|
621878
622230
|
if (raw.encrypted === true) {
|
|
621879
622231
|
if (!password) return null;
|
|
621880
622232
|
return decryptProfile(raw, password);
|
|
@@ -621883,23 +622235,23 @@ function loadProfile(name10, password, projectDir2) {
|
|
|
621883
622235
|
}
|
|
621884
622236
|
function saveProfile(profile, password, scope = "global", projectDir2) {
|
|
621885
622237
|
const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
|
|
621886
|
-
|
|
622238
|
+
mkdirSync72(dir, { recursive: true });
|
|
621887
622239
|
const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
621888
|
-
const filePath =
|
|
622240
|
+
const filePath = join134(dir, `${sanitized}.json`);
|
|
621889
622241
|
profile.modified = (/* @__PURE__ */ new Date()).toISOString();
|
|
621890
622242
|
if (password) {
|
|
621891
622243
|
const encrypted = encryptProfile(profile, password);
|
|
621892
|
-
|
|
622244
|
+
writeFileSync64(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
|
|
621893
622245
|
} else {
|
|
621894
622246
|
profile.encrypted = false;
|
|
621895
|
-
|
|
622247
|
+
writeFileSync64(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
|
|
621896
622248
|
}
|
|
621897
622249
|
}
|
|
621898
622250
|
function deleteProfile(name10, scope = "global", projectDir2) {
|
|
621899
622251
|
const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
621900
622252
|
const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
|
|
621901
|
-
const filePath =
|
|
621902
|
-
if (
|
|
622253
|
+
const filePath = join134(dir, `${sanitized}.json`);
|
|
622254
|
+
if (existsSync120(filePath)) {
|
|
621903
622255
|
unlinkSync24(filePath);
|
|
621904
622256
|
return true;
|
|
621905
622257
|
}
|
|
@@ -622076,23 +622428,23 @@ var init_profiles = __esm({
|
|
|
622076
622428
|
|
|
622077
622429
|
// packages/cli/src/docker.ts
|
|
622078
622430
|
import { execSync as execSync56, spawn as spawn28 } from "node:child_process";
|
|
622079
|
-
import { existsSync as
|
|
622080
|
-
import { join as
|
|
622431
|
+
import { existsSync as existsSync121, mkdirSync as mkdirSync73, writeFileSync as writeFileSync65 } from "node:fs";
|
|
622432
|
+
import { join as join135, resolve as resolve44, dirname as dirname36 } from "node:path";
|
|
622081
622433
|
import { homedir as homedir44 } from "node:os";
|
|
622082
622434
|
import { fileURLToPath as fileURLToPath16 } from "node:url";
|
|
622083
622435
|
function getDockerDir() {
|
|
622084
622436
|
try {
|
|
622085
622437
|
if (typeof __dirname !== "undefined") {
|
|
622086
|
-
return
|
|
622438
|
+
return join135(__dirname, "..", "..", "..", "docker");
|
|
622087
622439
|
}
|
|
622088
622440
|
} catch {
|
|
622089
622441
|
}
|
|
622090
622442
|
try {
|
|
622091
622443
|
const thisDir = dirname36(fileURLToPath16(import.meta.url));
|
|
622092
|
-
return
|
|
622444
|
+
return join135(thisDir, "..", "..", "..", "docker");
|
|
622093
622445
|
} catch {
|
|
622094
622446
|
}
|
|
622095
|
-
return
|
|
622447
|
+
return join135(process.cwd(), "docker");
|
|
622096
622448
|
}
|
|
622097
622449
|
function isDockerAvailable() {
|
|
622098
622450
|
try {
|
|
@@ -622223,11 +622575,11 @@ async function ensureOmniusImage(force = false) {
|
|
|
622223
622575
|
}
|
|
622224
622576
|
let buildContext;
|
|
622225
622577
|
const dockerDir = getDockerDir();
|
|
622226
|
-
if (
|
|
622578
|
+
if (existsSync121(join135(dockerDir, "Dockerfile"))) {
|
|
622227
622579
|
buildContext = dockerDir;
|
|
622228
622580
|
} else {
|
|
622229
|
-
buildContext =
|
|
622230
|
-
|
|
622581
|
+
buildContext = join135(homedir44(), ".omnius", "docker-build");
|
|
622582
|
+
mkdirSync73(buildContext, { recursive: true });
|
|
622231
622583
|
writeDockerfiles(buildContext);
|
|
622232
622584
|
}
|
|
622233
622585
|
try {
|
|
@@ -622301,8 +622653,8 @@ chown -R node:node /workspace /home/node/.omnius 2>/dev/null || true
|
|
|
622301
622653
|
if [ "$1" = "omnius" ]; then shift; exec su - node -c "cd /workspace && omnius $*"; fi
|
|
622302
622654
|
exec "$@"
|
|
622303
622655
|
`;
|
|
622304
|
-
|
|
622305
|
-
|
|
622656
|
+
writeFileSync65(join135(dir, "Dockerfile"), dockerfile);
|
|
622657
|
+
writeFileSync65(join135(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
|
|
622306
622658
|
}
|
|
622307
622659
|
function hasNvidiaGpu() {
|
|
622308
622660
|
try {
|
|
@@ -622375,7 +622727,7 @@ __export(embedding_workers_exports, {
|
|
|
622375
622727
|
startEmbeddingWorkers: () => startEmbeddingWorkers,
|
|
622376
622728
|
stopEmbeddingWorkers: () => stopEmbeddingWorkers
|
|
622377
622729
|
});
|
|
622378
|
-
import { basename as basename28, join as
|
|
622730
|
+
import { basename as basename28, join as join136 } from "node:path";
|
|
622379
622731
|
function startEmbeddingWorkers(opts) {
|
|
622380
622732
|
if (_running) return;
|
|
622381
622733
|
_running = true;
|
|
@@ -622441,8 +622793,8 @@ async function runEmbeddingTask(modality, episodeId, taskId, opts) {
|
|
|
622441
622793
|
try {
|
|
622442
622794
|
if (!_aligner) {
|
|
622443
622795
|
const stateRoot = process.env.OMNIUS_DIR || process.cwd();
|
|
622444
|
-
const omniusDir = basename28(stateRoot) === ".omnius" ? stateRoot :
|
|
622445
|
-
const memDir =
|
|
622796
|
+
const omniusDir = basename28(stateRoot) === ".omnius" ? stateRoot : join136(stateRoot, ".omnius");
|
|
622797
|
+
const memDir = join136(omniusDir, "memory");
|
|
622446
622798
|
_aligner = new EmbeddingAligner(
|
|
622447
622799
|
`${modality}-${emb.length}`,
|
|
622448
622800
|
// e.g. "visual-512"
|
|
@@ -622557,31 +622909,31 @@ import * as http5 from "node:http";
|
|
|
622557
622909
|
import * as https3 from "node:https";
|
|
622558
622910
|
import { createRequire as createRequire7 } from "node:module";
|
|
622559
622911
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
622560
|
-
import { dirname as dirname37, join as
|
|
622912
|
+
import { dirname as dirname37, join as join137, resolve as resolve45 } from "node:path";
|
|
622561
622913
|
import { homedir as homedir45 } from "node:os";
|
|
622562
622914
|
import { spawn as spawn29, execSync as execSync57 } from "node:child_process";
|
|
622563
|
-
import { mkdirSync as
|
|
622915
|
+
import { mkdirSync as mkdirSync74, writeFileSync as writeFileSync66, readFileSync as readFileSync99, readdirSync as readdirSync42, existsSync as existsSync122, watch as fsWatch3, renameSync as renameSync8, unlinkSync as unlinkSync25 } from "node:fs";
|
|
622564
622916
|
import { randomBytes as randomBytes24, randomUUID as randomUUID16 } from "node:crypto";
|
|
622565
|
-
import { createHash as
|
|
622917
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
622566
622918
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
622567
|
-
const dir =
|
|
622919
|
+
const dir = join137(baseDir, ".omnius");
|
|
622568
622920
|
return {
|
|
622569
622921
|
dir,
|
|
622570
|
-
episodes:
|
|
622571
|
-
knowledge:
|
|
622922
|
+
episodes: join137(dir, "episodes.db"),
|
|
622923
|
+
knowledge: join137(dir, "knowledge.db")
|
|
622572
622924
|
};
|
|
622573
622925
|
}
|
|
622574
622926
|
function getVersion3() {
|
|
622575
622927
|
try {
|
|
622576
622928
|
const thisDir = dirname37(fileURLToPath17(import.meta.url));
|
|
622577
622929
|
const candidates = [
|
|
622578
|
-
|
|
622579
|
-
|
|
622580
|
-
|
|
622930
|
+
join137(thisDir, "..", "package.json"),
|
|
622931
|
+
join137(thisDir, "..", "..", "package.json"),
|
|
622932
|
+
join137(thisDir, "..", "..", "..", "package.json")
|
|
622581
622933
|
];
|
|
622582
622934
|
for (const pkgPath of candidates) {
|
|
622583
622935
|
try {
|
|
622584
|
-
if (!
|
|
622936
|
+
if (!existsSync122(pkgPath)) continue;
|
|
622585
622937
|
const pkg = require4(pkgPath);
|
|
622586
622938
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
622587
622939
|
return pkg.version ?? "0.0.0";
|
|
@@ -622873,9 +623225,9 @@ function isOriginAllowed(origin) {
|
|
|
622873
623225
|
if (!origin) return true;
|
|
622874
623226
|
let accessMode = (process.env["OMNIUS_ACCESS"] || "").toLowerCase().trim();
|
|
622875
623227
|
try {
|
|
622876
|
-
const accessFile =
|
|
622877
|
-
if (
|
|
622878
|
-
const persisted =
|
|
623228
|
+
const accessFile = join137(homedir45(), ".omnius", "access");
|
|
623229
|
+
if (existsSync122(accessFile)) {
|
|
623230
|
+
const persisted = readFileSync99(accessFile, "utf8").trim().toLowerCase();
|
|
622879
623231
|
if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
|
|
622880
623232
|
accessMode = persisted;
|
|
622881
623233
|
}
|
|
@@ -623317,27 +623669,27 @@ function ollamaStream(ollamaUrl, path11, method, body, onData, onEnd, onError, t
|
|
|
623317
623669
|
}
|
|
623318
623670
|
function jobsDir() {
|
|
623319
623671
|
const root = resolve45(process.cwd());
|
|
623320
|
-
const dir =
|
|
623321
|
-
|
|
623672
|
+
const dir = join137(root, ".omnius", "jobs");
|
|
623673
|
+
mkdirSync74(dir, { recursive: true });
|
|
623322
623674
|
return dir;
|
|
623323
623675
|
}
|
|
623324
623676
|
function loadJob(id) {
|
|
623325
|
-
const file =
|
|
623326
|
-
if (!
|
|
623677
|
+
const file = join137(jobsDir(), `${id}.json`);
|
|
623678
|
+
if (!existsSync122(file)) return null;
|
|
623327
623679
|
try {
|
|
623328
|
-
return JSON.parse(
|
|
623680
|
+
return JSON.parse(readFileSync99(file, "utf-8"));
|
|
623329
623681
|
} catch {
|
|
623330
623682
|
return null;
|
|
623331
623683
|
}
|
|
623332
623684
|
}
|
|
623333
623685
|
function listJobs() {
|
|
623334
623686
|
const dir = jobsDir();
|
|
623335
|
-
if (!
|
|
623336
|
-
const files =
|
|
623687
|
+
if (!existsSync122(dir)) return [];
|
|
623688
|
+
const files = readdirSync42(dir).filter((f2) => f2.endsWith(".json")).sort();
|
|
623337
623689
|
const jobs = [];
|
|
623338
623690
|
for (const file of files) {
|
|
623339
623691
|
try {
|
|
623340
|
-
jobs.push(JSON.parse(
|
|
623692
|
+
jobs.push(JSON.parse(readFileSync99(join137(dir, file), "utf-8")));
|
|
623341
623693
|
} catch {
|
|
623342
623694
|
}
|
|
623343
623695
|
}
|
|
@@ -623347,14 +623699,14 @@ function pruneOldJobs() {
|
|
|
623347
623699
|
const retentionH = parseFloat(process.env["OMNIUS_RUN_RETENTION_H"] || "24");
|
|
623348
623700
|
const cutoffMs = Date.now() - (Number.isFinite(retentionH) && retentionH > 0 ? retentionH : 24) * 36e5;
|
|
623349
623701
|
const dir = jobsDir();
|
|
623350
|
-
if (!
|
|
623702
|
+
if (!existsSync122(dir)) return { pruned: 0, kept: 0 };
|
|
623351
623703
|
let pruned = 0;
|
|
623352
623704
|
let kept = 0;
|
|
623353
|
-
for (const file of
|
|
623705
|
+
for (const file of readdirSync42(dir)) {
|
|
623354
623706
|
if (!file.endsWith(".json")) continue;
|
|
623355
|
-
const path11 =
|
|
623707
|
+
const path11 = join137(dir, file);
|
|
623356
623708
|
try {
|
|
623357
|
-
const job = JSON.parse(
|
|
623709
|
+
const job = JSON.parse(readFileSync99(path11, "utf-8"));
|
|
623358
623710
|
if (job.status === "running") {
|
|
623359
623711
|
kept++;
|
|
623360
623712
|
continue;
|
|
@@ -623367,7 +623719,7 @@ function pruneOldJobs() {
|
|
|
623367
623719
|
} catch {
|
|
623368
623720
|
}
|
|
623369
623721
|
const outFile = path11.replace(/\.json$/, ".output");
|
|
623370
|
-
if (
|
|
623722
|
+
if (existsSync122(outFile)) {
|
|
623371
623723
|
try {
|
|
623372
623724
|
unlinkSync25(outFile);
|
|
623373
623725
|
} catch {
|
|
@@ -623660,14 +624012,14 @@ function autoSeedTodosFromPrompt(prompt) {
|
|
|
623660
624012
|
return [];
|
|
623661
624013
|
}
|
|
623662
624014
|
function atomicJobWrite(dir, id, job) {
|
|
623663
|
-
const finalPath =
|
|
624015
|
+
const finalPath = join137(dir, `${id}.json`);
|
|
623664
624016
|
const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
|
|
623665
624017
|
try {
|
|
623666
|
-
|
|
624018
|
+
writeFileSync66(tmpPath, JSON.stringify(job, null, 2), "utf-8");
|
|
623667
624019
|
renameSync8(tmpPath, finalPath);
|
|
623668
624020
|
} catch {
|
|
623669
624021
|
try {
|
|
623670
|
-
|
|
624022
|
+
writeFileSync66(finalPath, JSON.stringify(job, null, 2), "utf-8");
|
|
623671
624023
|
} catch {
|
|
623672
624024
|
}
|
|
623673
624025
|
try {
|
|
@@ -625105,27 +625457,27 @@ ${task}` : task;
|
|
|
625105
625457
|
});
|
|
625106
625458
|
}
|
|
625107
625459
|
function updateStateFile() {
|
|
625108
|
-
return
|
|
625460
|
+
return join137(homedir45(), ".omnius", "update-state.json");
|
|
625109
625461
|
}
|
|
625110
625462
|
function updateLogPath() {
|
|
625111
|
-
return
|
|
625463
|
+
return join137(homedir45(), ".omnius", "update.log");
|
|
625112
625464
|
}
|
|
625113
625465
|
function readUpdateState() {
|
|
625114
625466
|
try {
|
|
625115
625467
|
const p2 = updateStateFile();
|
|
625116
|
-
if (!
|
|
625117
|
-
return JSON.parse(
|
|
625468
|
+
if (!existsSync122(p2)) return null;
|
|
625469
|
+
return JSON.parse(readFileSync99(p2, "utf-8"));
|
|
625118
625470
|
} catch {
|
|
625119
625471
|
return null;
|
|
625120
625472
|
}
|
|
625121
625473
|
}
|
|
625122
625474
|
function writeUpdateState(state) {
|
|
625123
625475
|
try {
|
|
625124
|
-
const dir =
|
|
625125
|
-
|
|
625476
|
+
const dir = join137(homedir45(), ".omnius");
|
|
625477
|
+
mkdirSync74(dir, { recursive: true });
|
|
625126
625478
|
const finalPath = updateStateFile();
|
|
625127
625479
|
const tmpPath = `${finalPath}.tmp.${process.pid}`;
|
|
625128
|
-
|
|
625480
|
+
writeFileSync66(tmpPath, JSON.stringify(state, null, 2), "utf-8");
|
|
625129
625481
|
renameSync8(tmpPath, finalPath);
|
|
625130
625482
|
} catch {
|
|
625131
625483
|
}
|
|
@@ -625169,15 +625521,15 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
625169
625521
|
const { execSync: es } = require4("node:child_process");
|
|
625170
625522
|
const isWin2 = process.platform === "win32";
|
|
625171
625523
|
let npmBin = "";
|
|
625172
|
-
for (const candidate of isWin2 ? [
|
|
625173
|
-
if (
|
|
625524
|
+
for (const candidate of isWin2 ? [join137(nodeDir, "npm.cmd"), join137(nodeDir, "npm")] : [join137(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm"]) {
|
|
625525
|
+
if (existsSync122(candidate)) {
|
|
625174
625526
|
npmBin = candidate;
|
|
625175
625527
|
break;
|
|
625176
625528
|
}
|
|
625177
625529
|
}
|
|
625178
625530
|
if (!npmBin) npmBin = isWin2 ? "npm.cmd" : "npm";
|
|
625179
625531
|
const pkgSpec = `omnius@${targetVersion}`;
|
|
625180
|
-
const dir =
|
|
625532
|
+
const dir = join137(homedir45(), ".omnius");
|
|
625181
625533
|
fs10.mkdirSync(dir, { recursive: true });
|
|
625182
625534
|
const logFd = fs10.openSync(logPath3, "w");
|
|
625183
625535
|
const npmPrefix = dirname37(nodeDir);
|
|
@@ -625187,13 +625539,13 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
625187
625539
|
globalBinDir = es(`${npmBin} bin -g`, { encoding: "utf8", timeout: 5e3, stdio: "pipe" }).trim();
|
|
625188
625540
|
} else {
|
|
625189
625541
|
const npmCliCandidates = [
|
|
625190
|
-
|
|
625191
|
-
|
|
625542
|
+
join137(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
|
|
625543
|
+
join137(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
|
|
625192
625544
|
];
|
|
625193
625545
|
let npmCli = "";
|
|
625194
625546
|
for (const c9 of npmCliCandidates) {
|
|
625195
625547
|
try {
|
|
625196
|
-
if (
|
|
625548
|
+
if (existsSync122(c9)) {
|
|
625197
625549
|
npmCli = c9;
|
|
625198
625550
|
break;
|
|
625199
625551
|
}
|
|
@@ -625225,13 +625577,13 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
625225
625577
|
});
|
|
625226
625578
|
} else {
|
|
625227
625579
|
const npmCliCandidates = [
|
|
625228
|
-
|
|
625229
|
-
|
|
625580
|
+
join137(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
|
|
625581
|
+
join137(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
|
|
625230
625582
|
];
|
|
625231
625583
|
let npmCli = "";
|
|
625232
625584
|
for (const c9 of npmCliCandidates) {
|
|
625233
625585
|
try {
|
|
625234
|
-
if (
|
|
625586
|
+
if (existsSync122(c9)) {
|
|
625235
625587
|
npmCli = c9;
|
|
625236
625588
|
break;
|
|
625237
625589
|
}
|
|
@@ -625328,8 +625680,8 @@ function handleV1UpdateStatus(res) {
|
|
|
625328
625680
|
let logTail = "";
|
|
625329
625681
|
let exitCode = null;
|
|
625330
625682
|
try {
|
|
625331
|
-
if (
|
|
625332
|
-
const raw =
|
|
625683
|
+
if (existsSync122(logPath3)) {
|
|
625684
|
+
const raw = readFileSync99(logPath3, "utf-8");
|
|
625333
625685
|
const m2 = raw.match(/__EXIT_CODE=(\d+)/);
|
|
625334
625686
|
if (m2) exitCode = parseInt(m2[1], 10);
|
|
625335
625687
|
logTail = raw.slice(-2e3);
|
|
@@ -625425,8 +625777,8 @@ async function handleV1Run(req2, res) {
|
|
|
625425
625777
|
if (workingDir) {
|
|
625426
625778
|
cwd4 = resolve45(workingDir);
|
|
625427
625779
|
} else if (isolate) {
|
|
625428
|
-
const wsDir =
|
|
625429
|
-
|
|
625780
|
+
const wsDir = join137(dir, "..", "workspaces", id);
|
|
625781
|
+
mkdirSync74(wsDir, { recursive: true });
|
|
625430
625782
|
cwd4 = wsDir;
|
|
625431
625783
|
} else {
|
|
625432
625784
|
cwd4 = resolve45(process.cwd());
|
|
@@ -625612,7 +625964,7 @@ async function handleV1Run(req2, res) {
|
|
|
625612
625964
|
let output = "";
|
|
625613
625965
|
let tailBytes = 0;
|
|
625614
625966
|
const TAIL_BUDGET = 1048576;
|
|
625615
|
-
const outputWriter = new DiskTaskOutput(
|
|
625967
|
+
const outputWriter = new DiskTaskOutput(join137(dir, `${id}.output`));
|
|
625616
625968
|
job.outputFile = outputWriter.path;
|
|
625617
625969
|
atomicJobWrite(dir, id, job);
|
|
625618
625970
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -626417,7 +626769,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
626417
626769
|
if (pathname === "/v1/files" && method === "GET") {
|
|
626418
626770
|
const dir = urlObj.searchParams.get("path") || process.cwd();
|
|
626419
626771
|
try {
|
|
626420
|
-
const entries =
|
|
626772
|
+
const entries = readdirSync42(resolve45(dir), { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".") && e2.name !== "node_modules").slice(0, 100).map((e2) => ({ name: e2.name, type: e2.isDirectory() ? "dir" : "file" }));
|
|
626421
626773
|
jsonResponse(res, 200, { path: resolve45(dir), entries });
|
|
626422
626774
|
} catch (e2) {
|
|
626423
626775
|
jsonResponse(res, 400, { error: e2.message });
|
|
@@ -626706,10 +627058,10 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
626706
627058
|
return;
|
|
626707
627059
|
}
|
|
626708
627060
|
const { tmpdir: tmpdir23 } = await import("node:os");
|
|
626709
|
-
const { writeFileSync:
|
|
627061
|
+
const { writeFileSync: writeFileSync71, unlinkSync: unlinkSync26 } = await import("node:fs");
|
|
626710
627062
|
const { join: pjoin } = await import("node:path");
|
|
626711
627063
|
const tmpPath = pjoin(tmpdir23(), `omnius-clone-upload-${Date.now()}-${safeName2}`);
|
|
626712
|
-
|
|
627064
|
+
writeFileSync71(tmpPath, buf);
|
|
626713
627065
|
try {
|
|
626714
627066
|
const ve = getVoiceEngine();
|
|
626715
627067
|
const msg = await ve.setCloneVoice(tmpPath);
|
|
@@ -627301,7 +627653,7 @@ data: ${JSON.stringify(data)}
|
|
|
627301
627653
|
}
|
|
627302
627654
|
for (const f2 of seenFiles) {
|
|
627303
627655
|
try {
|
|
627304
|
-
|
|
627656
|
+
writeFileSync66(f2, JSON.stringify({ tasks: [] }, null, 2));
|
|
627305
627657
|
deleted++;
|
|
627306
627658
|
} catch {
|
|
627307
627659
|
}
|
|
@@ -628412,7 +628764,7 @@ ${steering}`;
|
|
|
628412
628764
|
function getScheduleRoots() {
|
|
628413
628765
|
const rootsEnv = process.env["OMNIUS_SCHEDULE_ROOTS"] || "";
|
|
628414
628766
|
const roots = rootsEnv.split(rootsEnv.includes(";") ? ";" : ":").filter(Boolean);
|
|
628415
|
-
const defaults3 = [process.cwd(),
|
|
628767
|
+
const defaults3 = [process.cwd(), join137(homedir45(), "Documents")];
|
|
628416
628768
|
const set = /* @__PURE__ */ new Set([...defaults3, ...roots]);
|
|
628417
628769
|
return [...set];
|
|
628418
628770
|
}
|
|
@@ -628424,10 +628776,10 @@ function listScheduledTasks() {
|
|
|
628424
628776
|
for (const root of roots) {
|
|
628425
628777
|
try {
|
|
628426
628778
|
walk(root, 0, (dir) => {
|
|
628427
|
-
if (dir.endsWith(`${
|
|
628428
|
-
const file =
|
|
628779
|
+
if (dir.endsWith(`${join137(".omnius", "scheduled")}`) || dir.includes(`${join137(".omnius", "scheduled")}`)) {
|
|
628780
|
+
const file = join137(dir, "tasks.json");
|
|
628429
628781
|
try {
|
|
628430
|
-
const raw =
|
|
628782
|
+
const raw = readFileSync99(file, "utf-8");
|
|
628431
628783
|
const json = JSON.parse(raw);
|
|
628432
628784
|
const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
628433
628785
|
tasks.forEach((t2, i2) => {
|
|
@@ -628435,7 +628787,7 @@ function listScheduledTasks() {
|
|
|
628435
628787
|
const schedule = String(t2?.schedule || t2?.cron || t2?.when || "");
|
|
628436
628788
|
const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
|
|
628437
628789
|
const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
|
|
628438
|
-
const fallbackId =
|
|
628790
|
+
const fallbackId = createHash25("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
|
|
628439
628791
|
const uid = realId || fallbackId;
|
|
628440
628792
|
const key = `${uid}`;
|
|
628441
628793
|
if (seen.has(key)) return;
|
|
@@ -628483,7 +628835,7 @@ function walk(dir, depth, onDir, maxDepth) {
|
|
|
628483
628835
|
onDir(dir);
|
|
628484
628836
|
let entries = [];
|
|
628485
628837
|
try {
|
|
628486
|
-
entries =
|
|
628838
|
+
entries = readdirSync42(dir, { withFileTypes: true });
|
|
628487
628839
|
} catch {
|
|
628488
628840
|
return;
|
|
628489
628841
|
}
|
|
@@ -628492,7 +628844,7 @@ function walk(dir, depth, onDir, maxDepth) {
|
|
|
628492
628844
|
if (e2.name === "node_modules" || e2.name.startsWith(".")) {
|
|
628493
628845
|
if (e2.name !== ".omnius") continue;
|
|
628494
628846
|
}
|
|
628495
|
-
const child =
|
|
628847
|
+
const child = join137(dir, e2.name);
|
|
628496
628848
|
walk(child, depth + 1, onDir, maxDepth);
|
|
628497
628849
|
}
|
|
628498
628850
|
}
|
|
@@ -628501,18 +628853,18 @@ function setScheduledEnabled(id, enabled2) {
|
|
|
628501
628853
|
const target = tasks.find((t2) => t2.id === id);
|
|
628502
628854
|
if (!target) return false;
|
|
628503
628855
|
try {
|
|
628504
|
-
const raw =
|
|
628856
|
+
const raw = readFileSync99(target.file, "utf-8");
|
|
628505
628857
|
const json = JSON.parse(raw);
|
|
628506
628858
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
628507
628859
|
if (!arr[target.index]) return false;
|
|
628508
628860
|
arr[target.index].enabled = enabled2;
|
|
628509
628861
|
if (Array.isArray(json?.tasks)) {
|
|
628510
628862
|
json.tasks = arr;
|
|
628511
|
-
|
|
628863
|
+
writeFileSync66(target.file, JSON.stringify(json, null, 2));
|
|
628512
628864
|
} else if (Array.isArray(json)) {
|
|
628513
|
-
|
|
628865
|
+
writeFileSync66(target.file, JSON.stringify(arr, null, 2));
|
|
628514
628866
|
} else {
|
|
628515
|
-
|
|
628867
|
+
writeFileSync66(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
628516
628868
|
}
|
|
628517
628869
|
if (!enabled2) {
|
|
628518
628870
|
try {
|
|
@@ -628534,7 +628886,7 @@ function deleteScheduledById(id) {
|
|
|
628534
628886
|
const target = tasks.find((t2) => t2.id === id);
|
|
628535
628887
|
if (!target) return false;
|
|
628536
628888
|
try {
|
|
628537
|
-
const raw =
|
|
628889
|
+
const raw = readFileSync99(target.file, "utf-8");
|
|
628538
628890
|
const json = JSON.parse(raw);
|
|
628539
628891
|
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
628540
628892
|
if (!arr[target.index]) return false;
|
|
@@ -628542,18 +628894,18 @@ function deleteScheduledById(id) {
|
|
|
628542
628894
|
arr.splice(target.index, 1);
|
|
628543
628895
|
if (Array.isArray(json?.tasks)) {
|
|
628544
628896
|
json.tasks = arr;
|
|
628545
|
-
|
|
628897
|
+
writeFileSync66(target.file, JSON.stringify(json, null, 2));
|
|
628546
628898
|
} else if (Array.isArray(json)) {
|
|
628547
|
-
|
|
628899
|
+
writeFileSync66(target.file, JSON.stringify(arr, null, 2));
|
|
628548
628900
|
} else {
|
|
628549
|
-
|
|
628901
|
+
writeFileSync66(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
628550
628902
|
}
|
|
628551
628903
|
const candidates = [];
|
|
628552
628904
|
if (id) candidates.push(id);
|
|
628553
628905
|
if (typeof entry?.id === "string" && entry.id && !candidates.includes(entry.id)) candidates.push(entry.id);
|
|
628554
628906
|
try {
|
|
628555
|
-
const { createHash:
|
|
628556
|
-
const fallback =
|
|
628907
|
+
const { createHash: createHash26 } = require4("node:crypto");
|
|
628908
|
+
const fallback = createHash26("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
|
|
628557
628909
|
if (!candidates.includes(fallback)) candidates.push(fallback);
|
|
628558
628910
|
} catch {
|
|
628559
628911
|
}
|
|
@@ -628799,11 +629151,11 @@ function reconcileScheduledTasks(apply) {
|
|
|
628799
629151
|
const errors = [];
|
|
628800
629152
|
for (const f2 of found) {
|
|
628801
629153
|
const wdir = f2.workingDir || process.cwd();
|
|
628802
|
-
const file =
|
|
629154
|
+
const file = join137(wdir, ".omnius", "scheduled", "tasks.json");
|
|
628803
629155
|
try {
|
|
628804
629156
|
let json = { tasks: [] };
|
|
628805
629157
|
try {
|
|
628806
|
-
const raw =
|
|
629158
|
+
const raw = readFileSync99(file, "utf-8");
|
|
628807
629159
|
json = JSON.parse(raw);
|
|
628808
629160
|
} catch {
|
|
628809
629161
|
}
|
|
@@ -628814,9 +629166,9 @@ function reconcileScheduledTasks(apply) {
|
|
|
628814
629166
|
const entry = { task: f2.task || `legacy ${f2.id}`, schedule: f2.cron, enabled: true };
|
|
628815
629167
|
arr.push(entry);
|
|
628816
629168
|
const toWrite = Array.isArray(json?.tasks) ? { ...json, tasks: arr } : Array.isArray(json) ? arr : { tasks: arr };
|
|
628817
|
-
|
|
628818
|
-
|
|
628819
|
-
|
|
629169
|
+
mkdirSync74(join137(wdir, ".omnius", "scheduled"), { recursive: true });
|
|
629170
|
+
mkdirSync74(join137(wdir, ".omnius", "scheduled", "logs"), { recursive: true });
|
|
629171
|
+
writeFileSync66(file, JSON.stringify(toWrite, null, 2));
|
|
628820
629172
|
adopted.push({ file, index: arr.length - 1 });
|
|
628821
629173
|
}
|
|
628822
629174
|
} else {
|
|
@@ -628860,32 +629212,32 @@ function writeCrontabLines(lines) {
|
|
|
628860
629212
|
}
|
|
628861
629213
|
function canonicalCronLine(rec) {
|
|
628862
629214
|
const omniusBin = findOmniusBinary4();
|
|
628863
|
-
const logDir =
|
|
628864
|
-
const logFile =
|
|
628865
|
-
const storeFile =
|
|
629215
|
+
const logDir = join137(rec.workingDir, ".omnius", "scheduled", "logs");
|
|
629216
|
+
const logFile = join137(logDir, `${rec.id}.log`);
|
|
629217
|
+
const storeFile = join137(rec.workingDir, ".omnius", "scheduled", "tasks.json");
|
|
628866
629218
|
const taskEsc = rec.task.replace(/'/g, "'\\''");
|
|
628867
|
-
const lockDir =
|
|
628868
|
-
const lockPath =
|
|
629219
|
+
const lockDir = join137(rec.workingDir, ".omnius", "run");
|
|
629220
|
+
const lockPath = join137(lockDir, `${rec.id}.lock`);
|
|
628869
629221
|
const wrapper = [
|
|
628870
629222
|
`cd ${JSON.stringify(rec.workingDir)}`,
|
|
628871
629223
|
`mkdir -p ${JSON.stringify(logDir)}`,
|
|
628872
629224
|
`mkdir -p ${JSON.stringify(lockDir)}`,
|
|
628873
629225
|
`if mkdir ${JSON.stringify(lockPath)} 2>/dev/null; then`,
|
|
628874
|
-
` echo $$ > ${JSON.stringify(
|
|
629226
|
+
` echo $$ > ${JSON.stringify(join137(lockPath, "pid"))}`,
|
|
628875
629227
|
` trap 'rm -rf ${lockPath}' EXIT`,
|
|
628876
629228
|
`else`,
|
|
628877
|
-
` if [ -f ${JSON.stringify(
|
|
628878
|
-
` oldpid=$(cat ${JSON.stringify(
|
|
629229
|
+
` if [ -f ${JSON.stringify(join137(lockPath, "pid"))} ]; then`,
|
|
629230
|
+
` oldpid=$(cat ${JSON.stringify(join137(lockPath, "pid"))} 2>/dev/null || echo)`,
|
|
628879
629231
|
` if [ -n "$oldpid" ] && kill -0 "$oldpid" 2>/dev/null; then`,
|
|
628880
629232
|
` echo "[omnius-scheduler] ${rec.id} already running as PID $oldpid; skipping" >> ${JSON.stringify(logFile)}`,
|
|
628881
629233
|
` exit 0`,
|
|
628882
629234
|
` else`,
|
|
628883
629235
|
` rm -rf ${JSON.stringify(lockPath)} 2>/dev/null || true`,
|
|
628884
|
-
` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(
|
|
629236
|
+
` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join137(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
|
|
628885
629237
|
` fi`,
|
|
628886
629238
|
` else`,
|
|
628887
629239
|
` rm -rf ${JSON.stringify(lockPath)} 2>/dev/null || true`,
|
|
628888
|
-
` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(
|
|
629240
|
+
` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join137(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
|
|
628889
629241
|
` fi`,
|
|
628890
629242
|
`fi`,
|
|
628891
629243
|
`${omniusBin} '${taskEsc}' >> ${JSON.stringify(logFile)} 2>&1; _omnius_exit=$?`,
|
|
@@ -628917,9 +629269,9 @@ function fixupOrMigrateScheduled(mode, dryRun) {
|
|
|
628917
629269
|
try {
|
|
628918
629270
|
if (!f2.workingDir || !f2.task) continue;
|
|
628919
629271
|
const unitBase = `omnius-${f2.id}`;
|
|
628920
|
-
const unitDir =
|
|
628921
|
-
const svc =
|
|
628922
|
-
const tim =
|
|
629272
|
+
const unitDir = join137(homedir45(), ".config", "systemd", "user");
|
|
629273
|
+
const svc = join137(unitDir, `${unitBase}.service`);
|
|
629274
|
+
const tim = join137(unitDir, `${unitBase}.timer`);
|
|
628923
629275
|
const omniusBin = findOmniusBinary4();
|
|
628924
629276
|
const rec = { id: f2.id, cron: f2.cron, workingDir: f2.workingDir, task: f2.task };
|
|
628925
629277
|
const cmd = canonicalCronLine(rec).split(" ").slice(5).join(" ");
|
|
@@ -628949,9 +629301,9 @@ Persistent=true
|
|
|
628949
629301
|
WantedBy=timers.target
|
|
628950
629302
|
`;
|
|
628951
629303
|
if (!dryRun) {
|
|
628952
|
-
|
|
628953
|
-
|
|
628954
|
-
|
|
629304
|
+
mkdirSync74(unitDir, { recursive: true });
|
|
629305
|
+
writeFileSync66(svc, svcText);
|
|
629306
|
+
writeFileSync66(tim, timText);
|
|
628955
629307
|
try {
|
|
628956
629308
|
const { execSync: es } = require4("node:child_process");
|
|
628957
629309
|
es("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
@@ -629046,8 +629398,8 @@ function startApiServer(options2 = {}) {
|
|
|
629046
629398
|
const config = loadConfig();
|
|
629047
629399
|
const ollamaUrl = options2.ollamaUrl ?? config.backendUrl;
|
|
629048
629400
|
const cwd4 = process.cwd();
|
|
629049
|
-
initAuditLog(
|
|
629050
|
-
initUsageTracker(
|
|
629401
|
+
initAuditLog(join137(cwd4, ".omnius"));
|
|
629402
|
+
initUsageTracker(join137(cwd4, ".omnius"));
|
|
629051
629403
|
try {
|
|
629052
629404
|
const taskMgr = getSharedTaskManager();
|
|
629053
629405
|
taskMgr.setEventPublisher((type, data, opts) => {
|
|
@@ -629095,16 +629447,16 @@ function startApiServer(options2 = {}) {
|
|
|
629095
629447
|
if (!apiTestMode) try {
|
|
629096
629448
|
const dir = todoDir();
|
|
629097
629449
|
try {
|
|
629098
|
-
|
|
629450
|
+
mkdirSync74(dir, { recursive: true });
|
|
629099
629451
|
} catch {
|
|
629100
629452
|
}
|
|
629101
629453
|
const cache8 = /* @__PURE__ */ new Map();
|
|
629102
629454
|
try {
|
|
629103
|
-
for (const f2 of
|
|
629455
|
+
for (const f2 of readdirSync42(dir)) {
|
|
629104
629456
|
if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
|
|
629105
629457
|
const sid = f2.replace(/\.json$/, "");
|
|
629106
629458
|
try {
|
|
629107
|
-
const items = JSON.parse(
|
|
629459
|
+
const items = JSON.parse(readFileSync99(join137(dir, f2), "utf-8"));
|
|
629108
629460
|
if (Array.isArray(items)) {
|
|
629109
629461
|
cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
|
|
629110
629462
|
}
|
|
@@ -629116,10 +629468,10 @@ function startApiServer(options2 = {}) {
|
|
|
629116
629468
|
const watcher = fsWatch3(dir, (_evt, fname) => {
|
|
629117
629469
|
if (!fname || !fname.endsWith(".json") || fname.includes(".tmp.")) return;
|
|
629118
629470
|
const sid = fname.replace(/\.json$/, "");
|
|
629119
|
-
const fp =
|
|
629471
|
+
const fp = join137(dir, fname);
|
|
629120
629472
|
let next = [];
|
|
629121
629473
|
try {
|
|
629122
|
-
if (!
|
|
629474
|
+
if (!existsSync122(fp)) {
|
|
629123
629475
|
const old = cache8.get(sid);
|
|
629124
629476
|
if (old) {
|
|
629125
629477
|
for (const t2 of old.values()) {
|
|
@@ -629132,7 +629484,7 @@ function startApiServer(options2 = {}) {
|
|
|
629132
629484
|
}
|
|
629133
629485
|
return;
|
|
629134
629486
|
}
|
|
629135
|
-
next = JSON.parse(
|
|
629487
|
+
next = JSON.parse(readFileSync99(fp, "utf-8"));
|
|
629136
629488
|
if (!Array.isArray(next)) return;
|
|
629137
629489
|
} catch {
|
|
629138
629490
|
return;
|
|
@@ -629171,14 +629523,14 @@ function startApiServer(options2 = {}) {
|
|
|
629171
629523
|
const retentionDays = parseInt(process.env["OMNIUS_JOB_RETENTION_DAYS"] ?? "30", 10);
|
|
629172
629524
|
if (!apiTestMode && retentionDays > 0) {
|
|
629173
629525
|
try {
|
|
629174
|
-
const jobsDir3 =
|
|
629175
|
-
if (
|
|
629526
|
+
const jobsDir3 = join137(cwd4, ".omnius", "jobs");
|
|
629527
|
+
if (existsSync122(jobsDir3)) {
|
|
629176
629528
|
const cutoff = Date.now() - retentionDays * 864e5;
|
|
629177
|
-
for (const f2 of
|
|
629529
|
+
for (const f2 of readdirSync42(jobsDir3)) {
|
|
629178
629530
|
if (!f2.endsWith(".json")) continue;
|
|
629179
629531
|
try {
|
|
629180
|
-
const jobPath =
|
|
629181
|
-
const job = JSON.parse(
|
|
629532
|
+
const jobPath = join137(jobsDir3, f2);
|
|
629533
|
+
const job = JSON.parse(readFileSync99(jobPath, "utf-8"));
|
|
629182
629534
|
const jobTime = new Date(job.startedAt ?? job.completedAt ?? 0).getTime();
|
|
629183
629535
|
if (jobTime > 0 && jobTime < cutoff && job.status !== "running") {
|
|
629184
629536
|
const { unlinkSync: unlinkSync26 } = require4("node:fs");
|
|
@@ -629198,8 +629550,8 @@ function startApiServer(options2 = {}) {
|
|
|
629198
629550
|
if (useTls) {
|
|
629199
629551
|
try {
|
|
629200
629552
|
tlsOpts = {
|
|
629201
|
-
cert:
|
|
629202
|
-
key:
|
|
629553
|
+
cert: readFileSync99(resolve45(tlsCert)),
|
|
629554
|
+
key: readFileSync99(resolve45(tlsKey))
|
|
629203
629555
|
};
|
|
629204
629556
|
} catch (e2) {
|
|
629205
629557
|
log22(`
|
|
@@ -629210,9 +629562,9 @@ function startApiServer(options2 = {}) {
|
|
|
629210
629562
|
}
|
|
629211
629563
|
let runtimeAccessMode = resolveAccessMode(process.env["OMNIUS_ACCESS"], host);
|
|
629212
629564
|
try {
|
|
629213
|
-
const accessFile =
|
|
629214
|
-
if (
|
|
629215
|
-
const persisted =
|
|
629565
|
+
const accessFile = join137(homedir45(), ".omnius", "access");
|
|
629566
|
+
if (existsSync122(accessFile)) {
|
|
629567
|
+
const persisted = readFileSync99(accessFile, "utf8").trim();
|
|
629216
629568
|
const resolved = resolveAccessMode(persisted, host);
|
|
629217
629569
|
if (resolved) runtimeAccessMode = resolved;
|
|
629218
629570
|
}
|
|
@@ -629272,9 +629624,9 @@ function startApiServer(options2 = {}) {
|
|
|
629272
629624
|
const previous = runtimeAccessMode;
|
|
629273
629625
|
runtimeAccessMode = requested;
|
|
629274
629626
|
try {
|
|
629275
|
-
const dir =
|
|
629276
|
-
|
|
629277
|
-
|
|
629627
|
+
const dir = join137(homedir45(), ".omnius");
|
|
629628
|
+
mkdirSync74(dir, { recursive: true });
|
|
629629
|
+
writeFileSync66(join137(dir, "access"), `${runtimeAccessMode}
|
|
629278
629630
|
`, "utf8");
|
|
629279
629631
|
} catch {
|
|
629280
629632
|
}
|
|
@@ -629567,7 +629919,7 @@ function startApiServer(options2 = {}) {
|
|
|
629567
629919
|
return;
|
|
629568
629920
|
}
|
|
629569
629921
|
try {
|
|
629570
|
-
const { writeFileSync:
|
|
629922
|
+
const { writeFileSync: writeFileSync71, mkdirSync: mkdirSync79, existsSync: _exists, readFileSync: _rfs } = require4("node:fs");
|
|
629571
629923
|
const { join: _join } = require4("node:path");
|
|
629572
629924
|
const { homedir: _homedir } = require4("node:os");
|
|
629573
629925
|
const apiHint = JSON.stringify({
|
|
@@ -629596,8 +629948,8 @@ function startApiServer(options2 = {}) {
|
|
|
629596
629948
|
let written = 0;
|
|
629597
629949
|
for (const dir of dirSet) {
|
|
629598
629950
|
try {
|
|
629599
|
-
if (!_exists(dir))
|
|
629600
|
-
|
|
629951
|
+
if (!_exists(dir)) mkdirSync79(dir, { recursive: true });
|
|
629952
|
+
writeFileSync71(_join(dir, "api-port.json"), apiHint);
|
|
629601
629953
|
written++;
|
|
629602
629954
|
} catch {
|
|
629603
629955
|
}
|
|
@@ -630091,15 +630443,15 @@ __export(clipboard_media_exports, {
|
|
|
630091
630443
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
630092
630444
|
});
|
|
630093
630445
|
import { execFileSync as execFileSync7, execSync as execSync58 } from "node:child_process";
|
|
630094
|
-
import { mkdirSync as
|
|
630095
|
-
import { join as
|
|
630446
|
+
import { mkdirSync as mkdirSync75, readFileSync as readFileSync100, rmSync as rmSync5, writeFileSync as writeFileSync67 } from "node:fs";
|
|
630447
|
+
import { join as join138 } from "node:path";
|
|
630096
630448
|
function pasteClipboardImageToFile(repoRoot) {
|
|
630097
630449
|
const image = readClipboardImage();
|
|
630098
630450
|
if (!image) return null;
|
|
630099
|
-
const dir =
|
|
630100
|
-
|
|
630101
|
-
const path11 =
|
|
630102
|
-
|
|
630451
|
+
const dir = join138(repoRoot, ".omnius", "clipboard");
|
|
630452
|
+
mkdirSync75(dir, { recursive: true });
|
|
630453
|
+
const path11 = join138(dir, `clipboard-${Date.now()}${image.ext}`);
|
|
630454
|
+
writeFileSync67(path11, image.buffer);
|
|
630103
630455
|
return { path: path11, buffer: image.buffer, mime: image.mime };
|
|
630104
630456
|
}
|
|
630105
630457
|
function readClipboardImage() {
|
|
@@ -630108,7 +630460,7 @@ function readClipboardImage() {
|
|
|
630108
630460
|
execSync58("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
|
|
630109
630461
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
630110
630462
|
execFileSync7("pngpaste", [tmp], { timeout: 3e3 });
|
|
630111
|
-
const buffer2 =
|
|
630463
|
+
const buffer2 = readFileSync100(tmp);
|
|
630112
630464
|
try {
|
|
630113
630465
|
rmSync5(tmp);
|
|
630114
630466
|
} catch {
|
|
@@ -630163,18 +630515,18 @@ var init_clipboard_media = __esm({
|
|
|
630163
630515
|
|
|
630164
630516
|
// packages/cli/src/tui/interactive.ts
|
|
630165
630517
|
import { cwd } from "node:process";
|
|
630166
|
-
import { resolve as resolve46, join as
|
|
630518
|
+
import { resolve as resolve46, join as join139, dirname as dirname38, extname as extname17, relative as relative14 } from "node:path";
|
|
630167
630519
|
import { createRequire as createRequire8 } from "node:module";
|
|
630168
630520
|
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
630169
630521
|
import {
|
|
630170
|
-
readFileSync as
|
|
630171
|
-
writeFileSync as
|
|
630522
|
+
readFileSync as readFileSync101,
|
|
630523
|
+
writeFileSync as writeFileSync68,
|
|
630172
630524
|
appendFileSync as appendFileSync8,
|
|
630173
630525
|
rmSync as rmSync6,
|
|
630174
|
-
readdirSync as
|
|
630175
|
-
mkdirSync as
|
|
630526
|
+
readdirSync as readdirSync43,
|
|
630527
|
+
mkdirSync as mkdirSync76
|
|
630176
630528
|
} from "node:fs";
|
|
630177
|
-
import { existsSync as
|
|
630529
|
+
import { existsSync as existsSync123 } from "node:fs";
|
|
630178
630530
|
import { execSync as execSync59 } from "node:child_process";
|
|
630179
630531
|
import { homedir as homedir46 } from "node:os";
|
|
630180
630532
|
function formatTimeAgo2(date) {
|
|
@@ -630192,12 +630544,12 @@ function getVersion4() {
|
|
|
630192
630544
|
const require5 = createRequire8(import.meta.url);
|
|
630193
630545
|
const thisDir = dirname38(fileURLToPath18(import.meta.url));
|
|
630194
630546
|
const candidates = [
|
|
630195
|
-
|
|
630196
|
-
|
|
630197
|
-
|
|
630547
|
+
join139(thisDir, "..", "package.json"),
|
|
630548
|
+
join139(thisDir, "..", "..", "package.json"),
|
|
630549
|
+
join139(thisDir, "..", "..", "..", "package.json")
|
|
630198
630550
|
];
|
|
630199
630551
|
for (const pkgPath of candidates) {
|
|
630200
|
-
if (
|
|
630552
|
+
if (existsSync123(pkgPath)) {
|
|
630201
630553
|
const pkg = require5(pkgPath);
|
|
630202
630554
|
if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
|
|
630203
630555
|
return pkg.version ?? "0.0.0";
|
|
@@ -631162,14 +631514,14 @@ Meta-critique: quality ${meta.quality}/5, thorough: ${meta.thorough}`;
|
|
|
631162
631514
|
function gatherMemorySnippets(root) {
|
|
631163
631515
|
const snippets = [];
|
|
631164
631516
|
const dirs = [
|
|
631165
|
-
|
|
631166
|
-
|
|
631517
|
+
join139(root, ".omnius", "memory"),
|
|
631518
|
+
join139(root, ".omnius", "memory")
|
|
631167
631519
|
];
|
|
631168
631520
|
for (const dir of dirs) {
|
|
631169
|
-
if (!
|
|
631521
|
+
if (!existsSync123(dir)) continue;
|
|
631170
631522
|
try {
|
|
631171
|
-
for (const f2 of
|
|
631172
|
-
const data = JSON.parse(
|
|
631523
|
+
for (const f2 of readdirSync43(dir).filter((f3) => f3.endsWith(".json"))) {
|
|
631524
|
+
const data = JSON.parse(readFileSync101(join139(dir, f2), "utf-8"));
|
|
631173
631525
|
for (const val of Object.values(data)) {
|
|
631174
631526
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
631175
631527
|
if (v.length > 10) snippets.push(v);
|
|
@@ -631304,7 +631656,7 @@ function extractGeneratedAudioPath(output, repoRoot) {
|
|
|
631304
631656
|
const match = output.match(/(?:Sound|Music|TTS) generated:\s+([^\n\r]+)/i);
|
|
631305
631657
|
const raw = match?.[1]?.trim().replace(/^["']|["']$/g, "");
|
|
631306
631658
|
if (!raw) return null;
|
|
631307
|
-
return raw.startsWith("/") || raw.startsWith("~") ? raw.replace(/^~(?=\/)/, homedir46()) :
|
|
631659
|
+
return raw.startsWith("/") || raw.startsWith("~") ? raw.replace(/^~(?=\/)/, homedir46()) : join139(repoRoot, raw);
|
|
631308
631660
|
}
|
|
631309
631661
|
async function playGeneratedAudioForToolResult(toolName, output, repoRoot, writer) {
|
|
631310
631662
|
if (!toolName || !["generate_audio", "generate_tts", "audio_playback"].includes(toolName) || !output) return;
|
|
@@ -631441,9 +631793,9 @@ ${metabolismMemories}
|
|
|
631441
631793
|
} catch {
|
|
631442
631794
|
}
|
|
631443
631795
|
try {
|
|
631444
|
-
const archeFile =
|
|
631445
|
-
if (
|
|
631446
|
-
const variants = JSON.parse(
|
|
631796
|
+
const archeFile = join139(repoRoot, ".omnius", "arche", "variants.json");
|
|
631797
|
+
if (existsSync123(archeFile)) {
|
|
631798
|
+
const variants = JSON.parse(readFileSync101(archeFile, "utf8"));
|
|
631447
631799
|
if (variants.length > 0) {
|
|
631448
631800
|
let filtered = variants;
|
|
631449
631801
|
if (taskType) {
|
|
@@ -631674,9 +632026,9 @@ RULES:
|
|
|
631674
632026
|
const compactionThreshold = Number.isFinite(envOverride) && envOverride > 0 ? envOverride : modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
631675
632027
|
let identityInjection = "";
|
|
631676
632028
|
try {
|
|
631677
|
-
const ikStateFile =
|
|
631678
|
-
if (
|
|
631679
|
-
const selfState = JSON.parse(
|
|
632029
|
+
const ikStateFile = join139(repoRoot, ".omnius", "identity", "self-state.json");
|
|
632030
|
+
if (existsSync123(ikStateFile)) {
|
|
632031
|
+
const selfState = JSON.parse(readFileSync101(ikStateFile, "utf8"));
|
|
631680
632032
|
const lines = [
|
|
631681
632033
|
`[Identity State v${selfState.version}]`,
|
|
631682
632034
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -631950,17 +632302,17 @@ Review its full output in the [${id}] tab or via sub_agent(action='output', id='
|
|
|
631950
632302
|
}
|
|
631951
632303
|
}
|
|
631952
632304
|
try {
|
|
631953
|
-
const { readdirSync:
|
|
632305
|
+
const { readdirSync: readdirSync45, readFileSync: readFileSync103, existsSync: existsSync126 } = await import("node:fs");
|
|
631954
632306
|
const { join: pathJoin } = await import("node:path");
|
|
631955
632307
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
631956
|
-
if (
|
|
631957
|
-
const files =
|
|
632308
|
+
if (existsSync126(chunksDir)) {
|
|
632309
|
+
const files = readdirSync45(chunksDir).filter(
|
|
631958
632310
|
(f2) => f2.endsWith(".json")
|
|
631959
632311
|
);
|
|
631960
632312
|
for (const f2 of files) {
|
|
631961
632313
|
try {
|
|
631962
632314
|
const data = JSON.parse(
|
|
631963
|
-
|
|
632315
|
+
readFileSync103(pathJoin(chunksDir, f2), "utf-8")
|
|
631964
632316
|
);
|
|
631965
632317
|
if (data._deleted) continue;
|
|
631966
632318
|
if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
|
|
@@ -632026,11 +632378,11 @@ ${lines.join("\n")}`
|
|
|
632026
632378
|
const expand2 = args.expand === true;
|
|
632027
632379
|
if (expand2 && id.startsWith("todo-ctx-")) {
|
|
632028
632380
|
try {
|
|
632029
|
-
const { readFileSync:
|
|
632381
|
+
const { readFileSync: readFileSync103, existsSync: existsSync126 } = await import("node:fs");
|
|
632030
632382
|
const { join: pathJoin } = await import("node:path");
|
|
632031
632383
|
const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
|
|
632032
632384
|
const todoIdSuffix = id.replace("todo-ctx-", "");
|
|
632033
|
-
const files =
|
|
632385
|
+
const files = existsSync126(chunksDir) ? (await import("node:fs")).readdirSync(chunksDir).filter((f2) => f2.endsWith(".json")) : [];
|
|
632034
632386
|
let chunkData = null;
|
|
632035
632387
|
for (const f2 of files) {
|
|
632036
632388
|
try {
|
|
@@ -632812,13 +633164,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
632812
633164
|
});
|
|
632813
633165
|
}
|
|
632814
633166
|
try {
|
|
632815
|
-
const ikDir =
|
|
632816
|
-
const ikFile =
|
|
633167
|
+
const ikDir = join139(repoRoot, ".omnius", "identity");
|
|
633168
|
+
const ikFile = join139(ikDir, "self-state.json");
|
|
632817
633169
|
let ikState;
|
|
632818
|
-
if (
|
|
632819
|
-
ikState = JSON.parse(
|
|
633170
|
+
if (existsSync123(ikFile)) {
|
|
633171
|
+
ikState = JSON.parse(readFileSync101(ikFile, "utf8"));
|
|
632820
633172
|
} else {
|
|
632821
|
-
|
|
633173
|
+
mkdirSync76(ikDir, { recursive: true });
|
|
632822
633174
|
const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
|
632823
633175
|
ikState = {
|
|
632824
633176
|
self_id: `omnius-${machineId}`,
|
|
@@ -632928,7 +633280,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
632928
633280
|
}
|
|
632929
633281
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
632930
633282
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
632931
|
-
|
|
633283
|
+
writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
|
|
632932
633284
|
} catch (ikErr) {
|
|
632933
633285
|
try {
|
|
632934
633286
|
console.error("[IK-OBSERVE]", ikErr);
|
|
@@ -632960,9 +633312,9 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
632960
633312
|
tokens
|
|
632961
633313
|
);
|
|
632962
633314
|
try {
|
|
632963
|
-
const ikFile =
|
|
632964
|
-
if (
|
|
632965
|
-
const ikState = JSON.parse(
|
|
633315
|
+
const ikFile = join139(repoRoot, ".omnius", "identity", "self-state.json");
|
|
633316
|
+
if (existsSync123(ikFile)) {
|
|
633317
|
+
const ikState = JSON.parse(readFileSync101(ikFile, "utf8"));
|
|
632966
633318
|
if (!ikState.stats) ikState.stats = { queries_served: 0 };
|
|
632967
633319
|
ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
|
|
632968
633320
|
ikState.homeostasis.uncertainty = Math.min(
|
|
@@ -632984,7 +633336,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
632984
633336
|
ikState.version_history = ikState.version_history.slice(-200);
|
|
632985
633337
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
632986
633338
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
632987
|
-
|
|
633339
|
+
writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
|
|
632988
633340
|
}
|
|
632989
633341
|
} catch {
|
|
632990
633342
|
}
|
|
@@ -633251,10 +633603,10 @@ async function startInteractive(config, repoPath) {
|
|
|
633251
633603
|
process.stdin.pause();
|
|
633252
633604
|
}
|
|
633253
633605
|
try {
|
|
633254
|
-
const omniusDir =
|
|
633255
|
-
const nexusPidFile =
|
|
633256
|
-
if (
|
|
633257
|
-
const pid = parseInt(
|
|
633606
|
+
const omniusDir = join139(repoRoot, ".omnius");
|
|
633607
|
+
const nexusPidFile = join139(omniusDir, "nexus", "daemon.pid");
|
|
633608
|
+
if (existsSync123(nexusPidFile)) {
|
|
633609
|
+
const pid = parseInt(readFileSync101(nexusPidFile, "utf8").trim(), 10);
|
|
633258
633610
|
if (pid > 0) {
|
|
633259
633611
|
try {
|
|
633260
633612
|
process.kill(pid, 0);
|
|
@@ -633986,7 +634338,7 @@ ${result.summary}`
|
|
|
633986
634338
|
let p2pGateway = null;
|
|
633987
634339
|
let peerMesh = null;
|
|
633988
634340
|
let inferenceRouter = null;
|
|
633989
|
-
const secretVault = new SecretVault(
|
|
634341
|
+
const secretVault = new SecretVault(join139(repoRoot, ".omnius", "vault.enc"));
|
|
633990
634342
|
let adminSessionKey = null;
|
|
633991
634343
|
const callSubAgents = /* @__PURE__ */ new Map();
|
|
633992
634344
|
const streamRenderer = new StreamRenderer();
|
|
@@ -634296,22 +634648,22 @@ Respond to the scoped Telegram target when complete.`);
|
|
|
634296
634648
|
const out = [];
|
|
634297
634649
|
const pushJsonFiles = (dir, prefix) => {
|
|
634298
634650
|
try {
|
|
634299
|
-
if (!
|
|
634300
|
-
for (const file of
|
|
634651
|
+
if (!existsSync123(dir)) return;
|
|
634652
|
+
for (const file of readdirSync43(dir)) {
|
|
634301
634653
|
if (!file.endsWith(".json")) continue;
|
|
634302
634654
|
const id = file.replace(/\.json$/, "");
|
|
634303
|
-
out.push({ id: `${prefix}:${id}`, label: id, path:
|
|
634655
|
+
out.push({ id: `${prefix}:${id}`, label: id, path: join139(dir, file) });
|
|
634304
634656
|
}
|
|
634305
634657
|
} catch {
|
|
634306
634658
|
}
|
|
634307
634659
|
};
|
|
634308
|
-
pushJsonFiles(
|
|
634660
|
+
pushJsonFiles(join139(repoRoot, ".omnius", "checkpoints"), "turn");
|
|
634309
634661
|
try {
|
|
634310
|
-
const
|
|
634311
|
-
if (
|
|
634312
|
-
for (const entry of
|
|
634313
|
-
const cp2 =
|
|
634314
|
-
if (
|
|
634662
|
+
const sessionDir2 = join139(repoRoot, ".omnius", "session");
|
|
634663
|
+
if (existsSync123(sessionDir2)) {
|
|
634664
|
+
for (const entry of readdirSync43(sessionDir2)) {
|
|
634665
|
+
const cp2 = join139(sessionDir2, entry, "checkpoint.json");
|
|
634666
|
+
if (existsSync123(cp2)) out.push({ id: `session:${entry}`, label: entry, path: cp2 });
|
|
634315
634667
|
}
|
|
634316
634668
|
}
|
|
634317
634669
|
} catch {
|
|
@@ -634370,8 +634722,8 @@ This is an independent background session started from /background.`
|
|
|
634370
634722
|
return id;
|
|
634371
634723
|
};
|
|
634372
634724
|
try {
|
|
634373
|
-
const titleFile =
|
|
634374
|
-
if (
|
|
634725
|
+
const titleFile = join139(repoRoot, ".omnius", "session-title");
|
|
634726
|
+
if (existsSync123(titleFile)) sessionTitle = readFileSync101(titleFile, "utf8").trim() || null;
|
|
634375
634727
|
} catch {
|
|
634376
634728
|
}
|
|
634377
634729
|
let carouselRetired = isResumed;
|
|
@@ -634428,13 +634780,13 @@ This is an independent background session started from /background.`
|
|
|
634428
634780
|
);
|
|
634429
634781
|
return [hits, line];
|
|
634430
634782
|
}
|
|
634431
|
-
const HISTORY_DIR =
|
|
634432
|
-
const HISTORY_FILE =
|
|
634783
|
+
const HISTORY_DIR = join139(homedir46(), ".omnius");
|
|
634784
|
+
const HISTORY_FILE = join139(HISTORY_DIR, "repl-history");
|
|
634433
634785
|
const MAX_HISTORY_LINES = 500;
|
|
634434
634786
|
let savedHistory = [];
|
|
634435
634787
|
try {
|
|
634436
|
-
if (
|
|
634437
|
-
const raw =
|
|
634788
|
+
if (existsSync123(HISTORY_FILE)) {
|
|
634789
|
+
const raw = readFileSync101(HISTORY_FILE, "utf8").trim();
|
|
634438
634790
|
if (raw) savedHistory = raw.split("\n").reverse();
|
|
634439
634791
|
}
|
|
634440
634792
|
} catch {
|
|
@@ -634591,12 +634943,12 @@ This is an independent background session started from /background.`
|
|
|
634591
634943
|
function persistHistoryLine(line) {
|
|
634592
634944
|
if (!line.trim()) return;
|
|
634593
634945
|
try {
|
|
634594
|
-
|
|
634946
|
+
mkdirSync76(HISTORY_DIR, { recursive: true });
|
|
634595
634947
|
appendFileSync8(HISTORY_FILE, line + "\n", "utf8");
|
|
634596
634948
|
if (Math.random() < 0.02) {
|
|
634597
|
-
const all2 =
|
|
634949
|
+
const all2 = readFileSync101(HISTORY_FILE, "utf8").trim().split("\n");
|
|
634598
634950
|
if (all2.length > MAX_HISTORY_LINES) {
|
|
634599
|
-
|
|
634951
|
+
writeFileSync68(
|
|
634600
634952
|
HISTORY_FILE,
|
|
634601
634953
|
all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n",
|
|
634602
634954
|
"utf8"
|
|
@@ -634799,10 +635151,10 @@ This is an independent background session started from /background.`
|
|
|
634799
635151
|
const { unlinkSync: _rmStale } = await import("node:fs");
|
|
634800
635152
|
const { homedir: _hdir } = await import("node:os");
|
|
634801
635153
|
for (const dp of [
|
|
634802
|
-
|
|
634803
|
-
|
|
635154
|
+
join139(repoRoot, ".omnius", "nexus", "nexus-daemon.mjs"),
|
|
635155
|
+
join139(_hdir(), ".omnius", "nexus", "nexus-daemon.mjs")
|
|
634804
635156
|
]) {
|
|
634805
|
-
if (
|
|
635157
|
+
if (existsSync123(dp))
|
|
634806
635158
|
try {
|
|
634807
635159
|
_rmStale(dp);
|
|
634808
635160
|
} catch {
|
|
@@ -634814,10 +635166,10 @@ This is an independent background session started from /background.`
|
|
|
634814
635166
|
const autoNexus = new NexusTool(repoRoot);
|
|
634815
635167
|
const _registerNexusDaemon = () => {
|
|
634816
635168
|
try {
|
|
634817
|
-
const nexusPidFile =
|
|
634818
|
-
if (
|
|
635169
|
+
const nexusPidFile = join139(autoNexus.getNexusDir(), "daemon.pid");
|
|
635170
|
+
if (existsSync123(nexusPidFile)) {
|
|
634819
635171
|
const nPid = parseInt(
|
|
634820
|
-
|
|
635172
|
+
readFileSync101(nexusPidFile, "utf8").trim(),
|
|
634821
635173
|
10
|
|
634822
635174
|
);
|
|
634823
635175
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
@@ -634848,7 +635200,7 @@ This is an independent background session started from /background.`
|
|
|
634848
635200
|
await new Promise((r3) => setTimeout(r3, 5e3));
|
|
634849
635201
|
return _tryNexusConnect(attempt + 1);
|
|
634850
635202
|
}
|
|
634851
|
-
const nexusLogPath =
|
|
635203
|
+
const nexusLogPath = join139(autoNexus.getNexusDir(), "daemon.err");
|
|
634852
635204
|
const visibleOut = out.length > 1200 ? `${out.slice(0, 1200)}...` : out;
|
|
634853
635205
|
writeContent(
|
|
634854
635206
|
() => renderWarning(`Nexus auto-connect failed:
|
|
@@ -634889,7 +635241,7 @@ Log: ${nexusLogPath}`)
|
|
|
634889
635241
|
} catch {
|
|
634890
635242
|
}
|
|
634891
635243
|
try {
|
|
634892
|
-
const omniusDir =
|
|
635244
|
+
const omniusDir = join139(repoRoot, ".omnius");
|
|
634893
635245
|
const reconnected = await ExposeGateway.checkAndReconnect(omniusDir, {
|
|
634894
635246
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
634895
635247
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -634927,7 +635279,7 @@ Log: ${nexusLogPath}`)
|
|
|
634927
635279
|
} catch {
|
|
634928
635280
|
}
|
|
634929
635281
|
try {
|
|
634930
|
-
const omniusDir =
|
|
635282
|
+
const omniusDir = join139(repoRoot, ".omnius");
|
|
634931
635283
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(
|
|
634932
635284
|
omniusDir,
|
|
634933
635285
|
new NexusTool(repoRoot),
|
|
@@ -634991,11 +635343,11 @@ Log: ${nexusLogPath}`)
|
|
|
634991
635343
|
hostname: _hn,
|
|
634992
635344
|
userInfo: _ui
|
|
634993
635345
|
} = await import("node:os");
|
|
634994
|
-
const globalNamePath =
|
|
635346
|
+
const globalNamePath = join139(_hd(), ".omnius", "agent-name");
|
|
634995
635347
|
let agName = "";
|
|
634996
635348
|
try {
|
|
634997
|
-
if (
|
|
634998
|
-
agName =
|
|
635349
|
+
if (existsSync123(globalNamePath))
|
|
635350
|
+
agName = readFileSync101(globalNamePath, "utf8").trim();
|
|
634999
635351
|
} catch {
|
|
635000
635352
|
}
|
|
635001
635353
|
if (!agName) {
|
|
@@ -635026,7 +635378,7 @@ Log: ${nexusLogPath}`)
|
|
|
635026
635378
|
}
|
|
635027
635379
|
if (!ollamaAlive) {
|
|
635028
635380
|
try {
|
|
635029
|
-
const savedSponsorsPath =
|
|
635381
|
+
const savedSponsorsPath = join139(
|
|
635030
635382
|
repoRoot,
|
|
635031
635383
|
".omnius",
|
|
635032
635384
|
"sponsor",
|
|
@@ -635034,9 +635386,9 @@ Log: ${nexusLogPath}`)
|
|
|
635034
635386
|
);
|
|
635035
635387
|
let savedSponsors = [];
|
|
635036
635388
|
try {
|
|
635037
|
-
if (
|
|
635389
|
+
if (existsSync123(savedSponsorsPath)) {
|
|
635038
635390
|
savedSponsors = JSON.parse(
|
|
635039
|
-
|
|
635391
|
+
readFileSync101(savedSponsorsPath, "utf8")
|
|
635040
635392
|
);
|
|
635041
635393
|
const oneHourAgo = Date.now() - 36e5;
|
|
635042
635394
|
savedSponsors = savedSponsors.filter(
|
|
@@ -635465,8 +635817,8 @@ Log: ${nexusLogPath}`)
|
|
|
635465
635817
|
setSessionTitle(title) {
|
|
635466
635818
|
sessionTitle = title.trim() || null;
|
|
635467
635819
|
try {
|
|
635468
|
-
|
|
635469
|
-
|
|
635820
|
+
mkdirSync76(join139(repoRoot, ".omnius"), { recursive: true });
|
|
635821
|
+
writeFileSync68(join139(repoRoot, ".omnius", "session-title"), `${sessionTitle ?? ""}
|
|
635470
635822
|
`, "utf8");
|
|
635471
635823
|
} catch {
|
|
635472
635824
|
}
|
|
@@ -636561,11 +636913,11 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
636561
636913
|
}
|
|
636562
636914
|
if (name10 === "voice_list_files") {
|
|
636563
636915
|
const baseDir = String(args?.dir ?? ".");
|
|
636564
|
-
const { readdirSync:
|
|
636565
|
-
const { join:
|
|
636566
|
-
const base3 = baseDir.startsWith("/") ? baseDir : resolve50(
|
|
636567
|
-
const items =
|
|
636568
|
-
const s2 = statSync42(
|
|
636916
|
+
const { readdirSync: readdirSync45, statSync: statSync42 } = __require("node:fs");
|
|
636917
|
+
const { join: join144, resolve: resolve50 } = __require("node:path");
|
|
636918
|
+
const base3 = baseDir.startsWith("/") ? baseDir : resolve50(join144(repoRoot, baseDir));
|
|
636919
|
+
const items = readdirSync45(base3).slice(0, 200).map((f2) => {
|
|
636920
|
+
const s2 = statSync42(join144(base3, f2));
|
|
636569
636921
|
return { name: f2, dir: s2.isDirectory(), size: s2.size };
|
|
636570
636922
|
});
|
|
636571
636923
|
return JSON.stringify({ dir: base3, items }, null, 2);
|
|
@@ -636664,7 +637016,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
636664
637016
|
kind,
|
|
636665
637017
|
targetUrl,
|
|
636666
637018
|
authKey,
|
|
636667
|
-
stateDir:
|
|
637019
|
+
stateDir: join139(repoRoot, ".omnius"),
|
|
636668
637020
|
passthrough: passthrough ?? false,
|
|
636669
637021
|
loadbalance: loadbalance ?? false,
|
|
636670
637022
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
@@ -636719,7 +637071,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
636719
637071
|
targetUrl,
|
|
636720
637072
|
authKey,
|
|
636721
637073
|
fullAccess,
|
|
636722
|
-
stateDir:
|
|
637074
|
+
stateDir: join139(repoRoot, ".omnius")
|
|
636723
637075
|
});
|
|
636724
637076
|
newTunnel.on("stats", (stats) => {
|
|
636725
637077
|
statusBar.setExposeStatus({
|
|
@@ -636809,9 +637161,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
636809
637161
|
});
|
|
636810
637162
|
if (!result.success) throw new Error(result.error || "Connect failed");
|
|
636811
637163
|
try {
|
|
636812
|
-
const nexusPidFile =
|
|
636813
|
-
if (
|
|
636814
|
-
const pid = parseInt(
|
|
637164
|
+
const nexusPidFile = join139(nexusTool.getNexusDir(), "daemon.pid");
|
|
637165
|
+
if (existsSync123(nexusPidFile)) {
|
|
637166
|
+
const pid = parseInt(readFileSync101(nexusPidFile, "utf8").trim(), 10);
|
|
636815
637167
|
if (pid > 0) {
|
|
636816
637168
|
registry2.register({
|
|
636817
637169
|
name: "Nexus",
|
|
@@ -637020,10 +637372,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
637020
637372
|
);
|
|
637021
637373
|
}
|
|
637022
637374
|
try {
|
|
637023
|
-
const nexusDir =
|
|
637024
|
-
const pidFile =
|
|
637025
|
-
if (
|
|
637026
|
-
const pid = parseInt(
|
|
637375
|
+
const nexusDir = join139(repoRoot, OMNIUS_DIR, "nexus");
|
|
637376
|
+
const pidFile = join139(nexusDir, "daemon.pid");
|
|
637377
|
+
if (existsSync123(pidFile)) {
|
|
637378
|
+
const pid = parseInt(readFileSync101(pidFile, "utf8").trim(), 10);
|
|
637027
637379
|
if (pid > 0) {
|
|
637028
637380
|
try {
|
|
637029
637381
|
if (process.platform === "win32") {
|
|
@@ -637050,13 +637402,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
637050
637402
|
} catch {
|
|
637051
637403
|
}
|
|
637052
637404
|
try {
|
|
637053
|
-
const voiceDir3 =
|
|
637405
|
+
const voiceDir3 = join139(homedir46(), ".omnius", "voice");
|
|
637054
637406
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
637055
637407
|
for (const pf of voicePidFiles) {
|
|
637056
|
-
const pidPath =
|
|
637057
|
-
if (
|
|
637408
|
+
const pidPath = join139(voiceDir3, pf);
|
|
637409
|
+
if (existsSync123(pidPath)) {
|
|
637058
637410
|
try {
|
|
637059
|
-
const pid = parseInt(
|
|
637411
|
+
const pid = parseInt(readFileSync101(pidPath, "utf8").trim(), 10);
|
|
637060
637412
|
if (pid > 0) {
|
|
637061
637413
|
if (process.platform === "win32") {
|
|
637062
637414
|
try {
|
|
@@ -637086,8 +637438,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
637086
637438
|
);
|
|
637087
637439
|
} catch {
|
|
637088
637440
|
}
|
|
637089
|
-
const omniusPath =
|
|
637090
|
-
if (
|
|
637441
|
+
const omniusPath = join139(repoRoot, OMNIUS_DIR);
|
|
637442
|
+
if (existsSync123(omniusPath)) {
|
|
637091
637443
|
let deleted = false;
|
|
637092
637444
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
637093
637445
|
try {
|
|
@@ -637185,23 +637537,23 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
637185
637537
|
try {
|
|
637186
637538
|
const { isPersonaPlexRunning: isPersonaPlexRunning2 } = await Promise.resolve().then(() => (init_personaplex(), personaplex_exports));
|
|
637187
637539
|
if (isPersonaPlexRunning2()) {
|
|
637188
|
-
const ppPidFile =
|
|
637540
|
+
const ppPidFile = join139(
|
|
637189
637541
|
homedir46(),
|
|
637190
637542
|
".omnius",
|
|
637191
637543
|
"voice",
|
|
637192
637544
|
"personaplex",
|
|
637193
637545
|
"daemon.pid"
|
|
637194
637546
|
);
|
|
637195
|
-
const ppPortFile =
|
|
637547
|
+
const ppPortFile = join139(
|
|
637196
637548
|
homedir46(),
|
|
637197
637549
|
".omnius",
|
|
637198
637550
|
"voice",
|
|
637199
637551
|
"personaplex",
|
|
637200
637552
|
"daemon.port"
|
|
637201
637553
|
);
|
|
637202
|
-
if (
|
|
637203
|
-
const ppPid = parseInt(
|
|
637204
|
-
const ppPort =
|
|
637554
|
+
if (existsSync123(ppPidFile)) {
|
|
637555
|
+
const ppPid = parseInt(readFileSync101(ppPidFile, "utf8").trim(), 10);
|
|
637556
|
+
const ppPort = existsSync123(ppPortFile) ? parseInt(readFileSync101(ppPortFile, "utf8").trim(), 10) : void 0;
|
|
637205
637557
|
if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
|
|
637206
637558
|
registry2.register({
|
|
637207
637559
|
name: "PersonaPlex",
|
|
@@ -637213,9 +637565,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
637213
637565
|
}
|
|
637214
637566
|
}
|
|
637215
637567
|
}
|
|
637216
|
-
const nexusPidFile =
|
|
637217
|
-
if (
|
|
637218
|
-
const nPid = parseInt(
|
|
637568
|
+
const nexusPidFile = join139(new NexusTool(repoRoot).getNexusDir(), "daemon.pid");
|
|
637569
|
+
if (existsSync123(nexusPidFile)) {
|
|
637570
|
+
const nPid = parseInt(readFileSync101(nexusPidFile, "utf8").trim(), 10);
|
|
637219
637571
|
if (nPid > 0 && !registry2.daemons.has("Nexus")) {
|
|
637220
637572
|
try {
|
|
637221
637573
|
process.kill(nPid, 0);
|
|
@@ -637650,9 +638002,9 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
637650
638002
|
}
|
|
637651
638003
|
}
|
|
637652
638004
|
const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
|
|
637653
|
-
const isImage = isImagePath(cleanPath) &&
|
|
637654
|
-
const isMedia = !isImage && isTranscribablePath(cleanPath) &&
|
|
637655
|
-
const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) &&
|
|
638005
|
+
const isImage = isImagePath(cleanPath) && existsSync123(resolve46(repoRoot, cleanPath));
|
|
638006
|
+
const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync123(resolve46(repoRoot, cleanPath));
|
|
638007
|
+
const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) && existsSync123(resolve46(repoRoot, cleanPath));
|
|
637656
638008
|
if (activeTask) {
|
|
637657
638009
|
if (activeTask.runner.isPaused) {
|
|
637658
638010
|
activeTask.runner.resume();
|
|
@@ -637661,7 +638013,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
637661
638013
|
if (isImage) {
|
|
637662
638014
|
try {
|
|
637663
638015
|
const imgPath = resolve46(repoRoot, cleanPath);
|
|
637664
|
-
const imgBuffer =
|
|
638016
|
+
const imgBuffer = readFileSync101(imgPath);
|
|
637665
638017
|
const base642 = imgBuffer.toString("base64");
|
|
637666
638018
|
const ext = extname17(cleanPath).toLowerCase();
|
|
637667
638019
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
@@ -637855,7 +638207,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
|
|
|
637855
638207
|
if (isMarkdown && fullInput === input) {
|
|
637856
638208
|
try {
|
|
637857
638209
|
const mdPath = resolve46(repoRoot, cleanPath);
|
|
637858
|
-
const mdContent =
|
|
638210
|
+
const mdContent = readFileSync101(mdPath, "utf8");
|
|
637859
638211
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
|
|
637860
638212
|
const result = parseMcpMarkdown2(mdContent);
|
|
637861
638213
|
if (result.servers.length > 0) {
|
|
@@ -638033,13 +638385,13 @@ NEW TASK: ${fullInput}`;
|
|
|
638033
638385
|
writeContent(() => renderError(errMsg));
|
|
638034
638386
|
if (failureStore) {
|
|
638035
638387
|
try {
|
|
638036
|
-
const { createHash:
|
|
638388
|
+
const { createHash: createHash26 } = await import("node:crypto");
|
|
638037
638389
|
failureStore.insert({
|
|
638038
638390
|
taskId: "",
|
|
638039
638391
|
sessionId: `${Date.now()}`,
|
|
638040
638392
|
repoRoot,
|
|
638041
638393
|
failureType: "runtime-error",
|
|
638042
|
-
fingerprint:
|
|
638394
|
+
fingerprint: createHash26("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
|
|
638043
638395
|
filePath: null,
|
|
638044
638396
|
errorMessage: errMsg.slice(0, 500),
|
|
638045
638397
|
context: null,
|
|
@@ -638406,13 +638758,13 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
638406
638758
|
const handle2 = startTask(task, config, repoRoot);
|
|
638407
638759
|
await handle2.promise;
|
|
638408
638760
|
try {
|
|
638409
|
-
const ikDir =
|
|
638410
|
-
const ikFile =
|
|
638761
|
+
const ikDir = join139(repoRoot, ".omnius", "identity");
|
|
638762
|
+
const ikFile = join139(ikDir, "self-state.json");
|
|
638411
638763
|
let ikState;
|
|
638412
|
-
if (
|
|
638413
|
-
ikState = JSON.parse(
|
|
638764
|
+
if (existsSync123(ikFile)) {
|
|
638765
|
+
ikState = JSON.parse(readFileSync101(ikFile, "utf8"));
|
|
638414
638766
|
} else {
|
|
638415
|
-
|
|
638767
|
+
mkdirSync76(ikDir, { recursive: true });
|
|
638416
638768
|
ikState = {
|
|
638417
638769
|
self_id: `omnius-${Date.now().toString(36)}`,
|
|
638418
638770
|
version: 1,
|
|
@@ -638465,7 +638817,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
638465
638817
|
);
|
|
638466
638818
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
638467
638819
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
638468
|
-
|
|
638820
|
+
writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
|
|
638469
638821
|
} catch (ikErr) {
|
|
638470
638822
|
}
|
|
638471
638823
|
try {
|
|
@@ -638478,12 +638830,12 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
638478
638830
|
);
|
|
638479
638831
|
} catch {
|
|
638480
638832
|
try {
|
|
638481
|
-
const archeDir =
|
|
638482
|
-
const archeFile =
|
|
638833
|
+
const archeDir = join139(repoRoot, ".omnius", "arche");
|
|
638834
|
+
const archeFile = join139(archeDir, "variants.json");
|
|
638483
638835
|
let variants = [];
|
|
638484
638836
|
try {
|
|
638485
|
-
if (
|
|
638486
|
-
variants = JSON.parse(
|
|
638837
|
+
if (existsSync123(archeFile))
|
|
638838
|
+
variants = JSON.parse(readFileSync101(archeFile, "utf8"));
|
|
638487
638839
|
} catch {
|
|
638488
638840
|
}
|
|
638489
638841
|
variants.push({
|
|
@@ -638497,21 +638849,21 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
638497
638849
|
tags: ["general"]
|
|
638498
638850
|
});
|
|
638499
638851
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
638500
|
-
|
|
638501
|
-
|
|
638852
|
+
mkdirSync76(archeDir, { recursive: true });
|
|
638853
|
+
writeFileSync68(archeFile, JSON.stringify(variants, null, 2));
|
|
638502
638854
|
} catch {
|
|
638503
638855
|
}
|
|
638504
638856
|
}
|
|
638505
638857
|
try {
|
|
638506
|
-
const metaFile =
|
|
638858
|
+
const metaFile = join139(
|
|
638507
638859
|
repoRoot,
|
|
638508
638860
|
".omnius",
|
|
638509
638861
|
"memory",
|
|
638510
638862
|
"metabolism",
|
|
638511
638863
|
"store.json"
|
|
638512
638864
|
);
|
|
638513
|
-
if (
|
|
638514
|
-
const store2 = JSON.parse(
|
|
638865
|
+
if (existsSync123(metaFile)) {
|
|
638866
|
+
const store2 = JSON.parse(readFileSync101(metaFile, "utf8"));
|
|
638515
638867
|
const surfaced = store2.filter(
|
|
638516
638868
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
638517
638869
|
).sort(
|
|
@@ -638529,7 +638881,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
638529
638881
|
updated = true;
|
|
638530
638882
|
}
|
|
638531
638883
|
if (updated) {
|
|
638532
|
-
|
|
638884
|
+
writeFileSync68(metaFile, JSON.stringify(store2, null, 2));
|
|
638533
638885
|
}
|
|
638534
638886
|
}
|
|
638535
638887
|
} catch {
|
|
@@ -638587,9 +638939,9 @@ Rules:
|
|
|
638587
638939
|
try {
|
|
638588
638940
|
const { initDb: initDb2 } = __require("@omnius/memory");
|
|
638589
638941
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@omnius/memory");
|
|
638590
|
-
const dbDir =
|
|
638591
|
-
|
|
638592
|
-
const db = initDb2(
|
|
638942
|
+
const dbDir = join139(repoRoot, ".omnius", "memory");
|
|
638943
|
+
mkdirSync76(dbDir, { recursive: true });
|
|
638944
|
+
const db = initDb2(join139(dbDir, "structured.db"));
|
|
638593
638945
|
const memStore = new ProceduralMemoryStore2(db);
|
|
638594
638946
|
memStore.createWithEmbedding(
|
|
638595
638947
|
{
|
|
@@ -638609,12 +638961,12 @@ Rules:
|
|
|
638609
638961
|
db.close();
|
|
638610
638962
|
} catch {
|
|
638611
638963
|
}
|
|
638612
|
-
const metaDir =
|
|
638613
|
-
const storeFile =
|
|
638964
|
+
const metaDir = join139(repoRoot, ".omnius", "memory", "metabolism");
|
|
638965
|
+
const storeFile = join139(metaDir, "store.json");
|
|
638614
638966
|
let store2 = [];
|
|
638615
638967
|
try {
|
|
638616
|
-
if (
|
|
638617
|
-
store2 = JSON.parse(
|
|
638968
|
+
if (existsSync123(storeFile))
|
|
638969
|
+
store2 = JSON.parse(readFileSync101(storeFile, "utf8"));
|
|
638618
638970
|
} catch {
|
|
638619
638971
|
}
|
|
638620
638972
|
store2.push({
|
|
@@ -638637,32 +638989,32 @@ Rules:
|
|
|
638637
638989
|
accessCount: 0
|
|
638638
638990
|
});
|
|
638639
638991
|
if (store2.length > 100) store2 = store2.slice(-100);
|
|
638640
|
-
|
|
638641
|
-
|
|
638992
|
+
mkdirSync76(metaDir, { recursive: true });
|
|
638993
|
+
writeFileSync68(storeFile, JSON.stringify(store2, null, 2));
|
|
638642
638994
|
}
|
|
638643
638995
|
}
|
|
638644
638996
|
} catch {
|
|
638645
638997
|
}
|
|
638646
638998
|
try {
|
|
638647
|
-
const cohereSettingsFile =
|
|
638999
|
+
const cohereSettingsFile = join139(repoRoot, ".omnius", "settings.json");
|
|
638648
639000
|
let cohereActive = false;
|
|
638649
639001
|
try {
|
|
638650
|
-
if (
|
|
638651
|
-
const settings = JSON.parse(
|
|
639002
|
+
if (existsSync123(cohereSettingsFile)) {
|
|
639003
|
+
const settings = JSON.parse(readFileSync101(cohereSettingsFile, "utf8"));
|
|
638652
639004
|
cohereActive = settings.cohere === true;
|
|
638653
639005
|
}
|
|
638654
639006
|
} catch {
|
|
638655
639007
|
}
|
|
638656
639008
|
if (cohereActive) {
|
|
638657
|
-
const metaFile =
|
|
639009
|
+
const metaFile = join139(
|
|
638658
639010
|
repoRoot,
|
|
638659
639011
|
".omnius",
|
|
638660
639012
|
"memory",
|
|
638661
639013
|
"metabolism",
|
|
638662
639014
|
"store.json"
|
|
638663
639015
|
);
|
|
638664
|
-
if (
|
|
638665
|
-
const store2 = JSON.parse(
|
|
639016
|
+
if (existsSync123(metaFile)) {
|
|
639017
|
+
const store2 = JSON.parse(readFileSync101(metaFile, "utf8"));
|
|
638666
639018
|
const latest = store2.filter(
|
|
638667
639019
|
(m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
|
|
638668
639020
|
).slice(-1)[0];
|
|
@@ -638689,9 +639041,9 @@ Rules:
|
|
|
638689
639041
|
}
|
|
638690
639042
|
} catch (err) {
|
|
638691
639043
|
try {
|
|
638692
|
-
const ikFile =
|
|
638693
|
-
if (
|
|
638694
|
-
const ikState = JSON.parse(
|
|
639044
|
+
const ikFile = join139(repoRoot, ".omnius", "identity", "self-state.json");
|
|
639045
|
+
if (existsSync123(ikFile)) {
|
|
639046
|
+
const ikState = JSON.parse(readFileSync101(ikFile, "utf8"));
|
|
638695
639047
|
ikState.homeostasis.uncertainty = Math.min(
|
|
638696
639048
|
1,
|
|
638697
639049
|
ikState.homeostasis.uncertainty + 0.1
|
|
@@ -638702,17 +639054,17 @@ Rules:
|
|
|
638702
639054
|
);
|
|
638703
639055
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
638704
639056
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
638705
|
-
|
|
639057
|
+
writeFileSync68(ikFile, JSON.stringify(ikState, null, 2));
|
|
638706
639058
|
}
|
|
638707
|
-
const metaFile =
|
|
639059
|
+
const metaFile = join139(
|
|
638708
639060
|
repoRoot,
|
|
638709
639061
|
".omnius",
|
|
638710
639062
|
"memory",
|
|
638711
639063
|
"metabolism",
|
|
638712
639064
|
"store.json"
|
|
638713
639065
|
);
|
|
638714
|
-
if (
|
|
638715
|
-
const store2 = JSON.parse(
|
|
639066
|
+
if (existsSync123(metaFile)) {
|
|
639067
|
+
const store2 = JSON.parse(readFileSync101(metaFile, "utf8"));
|
|
638716
639068
|
const surfaced = store2.filter(
|
|
638717
639069
|
(m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
|
|
638718
639070
|
).sort(
|
|
@@ -638730,15 +639082,15 @@ Rules:
|
|
|
638730
639082
|
(item.scores.confidence || 0.5) - 0.02
|
|
638731
639083
|
);
|
|
638732
639084
|
}
|
|
638733
|
-
|
|
639085
|
+
writeFileSync68(metaFile, JSON.stringify(store2, null, 2));
|
|
638734
639086
|
}
|
|
638735
639087
|
try {
|
|
638736
|
-
const archeDir =
|
|
638737
|
-
const archeFile =
|
|
639088
|
+
const archeDir = join139(repoRoot, ".omnius", "arche");
|
|
639089
|
+
const archeFile = join139(archeDir, "variants.json");
|
|
638738
639090
|
let variants = [];
|
|
638739
639091
|
try {
|
|
638740
|
-
if (
|
|
638741
|
-
variants = JSON.parse(
|
|
639092
|
+
if (existsSync123(archeFile))
|
|
639093
|
+
variants = JSON.parse(readFileSync101(archeFile, "utf8"));
|
|
638742
639094
|
} catch {
|
|
638743
639095
|
}
|
|
638744
639096
|
variants.push({
|
|
@@ -638752,8 +639104,8 @@ Rules:
|
|
|
638752
639104
|
tags: ["general"]
|
|
638753
639105
|
});
|
|
638754
639106
|
if (variants.length > 50) variants = variants.slice(-50);
|
|
638755
|
-
|
|
638756
|
-
|
|
639107
|
+
mkdirSync76(archeDir, { recursive: true });
|
|
639108
|
+
writeFileSync68(archeFile, JSON.stringify(variants, null, 2));
|
|
638757
639109
|
} catch {
|
|
638758
639110
|
}
|
|
638759
639111
|
} catch {
|
|
@@ -638847,13 +639199,13 @@ __export(run_exports, {
|
|
|
638847
639199
|
});
|
|
638848
639200
|
import { resolve as resolve47 } from "node:path";
|
|
638849
639201
|
import { spawn as spawn30 } from "node:child_process";
|
|
638850
|
-
import { mkdirSync as
|
|
639202
|
+
import { mkdirSync as mkdirSync77, writeFileSync as writeFileSync69, readFileSync as readFileSync102, readdirSync as readdirSync44, existsSync as existsSync124 } from "node:fs";
|
|
638851
639203
|
import { randomBytes as randomBytes25 } from "node:crypto";
|
|
638852
|
-
import { join as
|
|
639204
|
+
import { join as join140 } from "node:path";
|
|
638853
639205
|
function jobsDir2(repoPath) {
|
|
638854
639206
|
const root = resolve47(repoPath ?? process.cwd());
|
|
638855
|
-
const dir =
|
|
638856
|
-
|
|
639207
|
+
const dir = join140(root, ".omnius", "jobs");
|
|
639208
|
+
mkdirSync77(dir, { recursive: true });
|
|
638857
639209
|
return dir;
|
|
638858
639210
|
}
|
|
638859
639211
|
async function runCommand2(opts, config) {
|
|
@@ -638975,7 +639327,7 @@ async function runBackground(task, config, opts) {
|
|
|
638975
639327
|
}
|
|
638976
639328
|
});
|
|
638977
639329
|
job.pid = child.pid ?? 0;
|
|
638978
|
-
|
|
639330
|
+
writeFileSync69(join140(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
638979
639331
|
let output = "";
|
|
638980
639332
|
child.stdout?.on("data", (chunk) => {
|
|
638981
639333
|
output += chunk.toString();
|
|
@@ -638991,7 +639343,7 @@ async function runBackground(task, config, opts) {
|
|
|
638991
639343
|
job.summary = result.summary;
|
|
638992
639344
|
job.durationMs = result.durationMs;
|
|
638993
639345
|
job.error = result.error;
|
|
638994
|
-
|
|
639346
|
+
writeFileSync69(join140(dir, `${id}.json`), JSON.stringify(job, null, 2));
|
|
638995
639347
|
} catch {
|
|
638996
639348
|
}
|
|
638997
639349
|
});
|
|
@@ -639007,13 +639359,13 @@ async function runBackground(task, config, opts) {
|
|
|
639007
639359
|
}
|
|
639008
639360
|
function statusCommand(jobId, repoPath) {
|
|
639009
639361
|
const dir = jobsDir2(repoPath);
|
|
639010
|
-
const file =
|
|
639011
|
-
if (!
|
|
639362
|
+
const file = join140(dir, `${jobId}.json`);
|
|
639363
|
+
if (!existsSync124(file)) {
|
|
639012
639364
|
console.error(`Job not found: ${jobId}`);
|
|
639013
639365
|
console.log(`Available jobs: omnius jobs`);
|
|
639014
639366
|
process.exit(1);
|
|
639015
639367
|
}
|
|
639016
|
-
const job = JSON.parse(
|
|
639368
|
+
const job = JSON.parse(readFileSync102(file, "utf-8"));
|
|
639017
639369
|
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`;
|
|
639018
639370
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
639019
639371
|
console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
|
|
@@ -639026,7 +639378,7 @@ function statusCommand(jobId, repoPath) {
|
|
|
639026
639378
|
}
|
|
639027
639379
|
function jobsCommand(repoPath) {
|
|
639028
639380
|
const dir = jobsDir2(repoPath);
|
|
639029
|
-
const files =
|
|
639381
|
+
const files = readdirSync44(dir).filter((f2) => f2.endsWith(".json")).sort();
|
|
639030
639382
|
if (files.length === 0) {
|
|
639031
639383
|
console.log("No jobs found.");
|
|
639032
639384
|
return;
|
|
@@ -639034,7 +639386,7 @@ function jobsCommand(repoPath) {
|
|
|
639034
639386
|
console.log("Jobs:");
|
|
639035
639387
|
for (const file of files) {
|
|
639036
639388
|
try {
|
|
639037
|
-
const job = JSON.parse(
|
|
639389
|
+
const job = JSON.parse(readFileSync102(join140(dir, file), "utf-8"));
|
|
639038
639390
|
const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
|
|
639039
639391
|
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`;
|
|
639040
639392
|
const cleanListTask = cleanForStorage(job.task) || job.task;
|
|
@@ -639058,13 +639410,13 @@ __export(index_repo_exports, {
|
|
|
639058
639410
|
indexRepoCommand: () => indexRepoCommand
|
|
639059
639411
|
});
|
|
639060
639412
|
import { resolve as resolve48 } from "node:path";
|
|
639061
|
-
import { existsSync as
|
|
639413
|
+
import { existsSync as existsSync125, statSync as statSync41 } from "node:fs";
|
|
639062
639414
|
import { cwd as cwd2 } from "node:process";
|
|
639063
639415
|
async function indexRepoCommand(opts, _config3) {
|
|
639064
639416
|
const repoRoot = resolve48(opts.repoPath ?? cwd2());
|
|
639065
639417
|
printHeader("Index Repository");
|
|
639066
639418
|
printInfo(`Indexing: ${repoRoot}`);
|
|
639067
|
-
if (!
|
|
639419
|
+
if (!existsSync125(repoRoot)) {
|
|
639068
639420
|
printError(`Path does not exist: ${repoRoot}`);
|
|
639069
639421
|
process.exit(1);
|
|
639070
639422
|
}
|
|
@@ -639316,7 +639668,7 @@ var config_exports2 = {};
|
|
|
639316
639668
|
__export(config_exports2, {
|
|
639317
639669
|
configCommand: () => configCommand
|
|
639318
639670
|
});
|
|
639319
|
-
import { join as
|
|
639671
|
+
import { join as join141, resolve as resolve49 } from "node:path";
|
|
639320
639672
|
import { homedir as homedir47 } from "node:os";
|
|
639321
639673
|
import { cwd as cwd3 } from "node:process";
|
|
639322
639674
|
function redactIfSensitive(key, value2) {
|
|
@@ -639399,7 +639751,7 @@ function handleShow(opts, config) {
|
|
|
639399
639751
|
}
|
|
639400
639752
|
}
|
|
639401
639753
|
printSection("Config File");
|
|
639402
|
-
printInfo(`~/.omnius/config.json (${
|
|
639754
|
+
printInfo(`~/.omnius/config.json (${join141(homedir47(), ".omnius", "config.json")})`);
|
|
639403
639755
|
printSection("Priority Chain");
|
|
639404
639756
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
639405
639757
|
printInfo(" 2. Project .omnius/settings.json (--local)");
|
|
@@ -639438,7 +639790,7 @@ function handleSet(opts, _config3) {
|
|
|
639438
639790
|
const coerced = coerceForSettings(key, value2);
|
|
639439
639791
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
639440
639792
|
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value2)}`);
|
|
639441
|
-
printInfo(`Saved to ${
|
|
639793
|
+
printInfo(`Saved to ${join141(repoRoot, ".omnius", "settings.json")}`);
|
|
639442
639794
|
printInfo("This override applies only when running in this workspace.");
|
|
639443
639795
|
} catch (err) {
|
|
639444
639796
|
printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -639623,8 +639975,8 @@ __export(eval_exports, {
|
|
|
639623
639975
|
evalCommand: () => evalCommand
|
|
639624
639976
|
});
|
|
639625
639977
|
import { tmpdir as tmpdir22 } from "node:os";
|
|
639626
|
-
import { mkdirSync as
|
|
639627
|
-
import { join as
|
|
639978
|
+
import { mkdirSync as mkdirSync78, writeFileSync as writeFileSync70 } from "node:fs";
|
|
639979
|
+
import { join as join142 } from "node:path";
|
|
639628
639980
|
async function evalCommand(opts, config) {
|
|
639629
639981
|
const suiteName = opts.suite ?? "basic";
|
|
639630
639982
|
const suite = SUITES[suiteName];
|
|
@@ -639753,10 +640105,10 @@ async function evalCommand(opts, config) {
|
|
|
639753
640105
|
process.exit(failed > 0 ? 1 : 0);
|
|
639754
640106
|
}
|
|
639755
640107
|
function createTempEvalRepo() {
|
|
639756
|
-
const dir =
|
|
639757
|
-
|
|
639758
|
-
|
|
639759
|
-
|
|
640108
|
+
const dir = join142(tmpdir22(), `omnius-eval-${Date.now()}`);
|
|
640109
|
+
mkdirSync78(dir, { recursive: true });
|
|
640110
|
+
writeFileSync70(
|
|
640111
|
+
join142(dir, "package.json"),
|
|
639760
640112
|
JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
|
|
639761
640113
|
"utf8"
|
|
639762
640114
|
);
|
|
@@ -639820,7 +640172,7 @@ init_typed_node_events();
|
|
|
639820
640172
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
639821
640173
|
import { createRequire as createRequire9 } from "node:module";
|
|
639822
640174
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
639823
|
-
import { dirname as dirname39, join as
|
|
640175
|
+
import { dirname as dirname39, join as join143 } from "node:path";
|
|
639824
640176
|
|
|
639825
640177
|
// packages/cli/src/cli.ts
|
|
639826
640178
|
init_typed_node_events();
|
|
@@ -639960,7 +640312,7 @@ init_output();
|
|
|
639960
640312
|
function getVersion5() {
|
|
639961
640313
|
try {
|
|
639962
640314
|
const require5 = createRequire9(import.meta.url);
|
|
639963
|
-
const pkgPath =
|
|
640315
|
+
const pkgPath = join143(dirname39(fileURLToPath19(import.meta.url)), "..", "package.json");
|
|
639964
640316
|
const pkg = require5(pkgPath);
|
|
639965
640317
|
return pkg.version;
|
|
639966
640318
|
} catch {
|
|
@@ -640274,12 +640626,12 @@ function crashLog(label, err) {
|
|
|
640274
640626
|
const logLine = `[${timestamp}] ${label}: ${msg}
|
|
640275
640627
|
`;
|
|
640276
640628
|
try {
|
|
640277
|
-
const { appendFileSync: appendFileSync9, mkdirSync:
|
|
640278
|
-
const { join:
|
|
640629
|
+
const { appendFileSync: appendFileSync9, mkdirSync: mkdirSync79 } = __require("node:fs");
|
|
640630
|
+
const { join: join144 } = __require("node:path");
|
|
640279
640631
|
const { homedir: homedir48 } = __require("node:os");
|
|
640280
|
-
const logDir =
|
|
640281
|
-
|
|
640282
|
-
appendFileSync9(
|
|
640632
|
+
const logDir = join144(homedir48(), ".omnius");
|
|
640633
|
+
mkdirSync79(logDir, { recursive: true });
|
|
640634
|
+
appendFileSync9(join144(logDir, "crash.log"), logLine);
|
|
640283
640635
|
} catch {
|
|
640284
640636
|
}
|
|
640285
640637
|
try {
|