@kl-c/matrixos 0.3.58 → 0.3.59
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/cli/index.js +1 -9
- package/dist/cli/snapshot/snapshot-core.d.ts +2 -2
- package/dist/cli-node/index.js +1 -9
- package/dist/config/schema/oh-my-opencode-config.d.ts +0 -4
- package/dist/index.js +726 -688
- package/dist/matrixos.schema.json +0 -14
- package/dist/tui.js +0 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -165846,10 +165846,10 @@ var require_FsPromise = __commonJS((exports) => {
|
|
|
165846
165846
|
});
|
|
165847
165847
|
}
|
|
165848
165848
|
exports.writeFile = writeFile4;
|
|
165849
|
-
function
|
|
165849
|
+
function writeFileSync26(path29, data) {
|
|
165850
165850
|
fs25.writeFileSync(path29, data);
|
|
165851
165851
|
}
|
|
165852
|
-
exports.writeFileSync =
|
|
165852
|
+
exports.writeFileSync = writeFileSync26;
|
|
165853
165853
|
async function readFile14(path29) {
|
|
165854
165854
|
return new Promise((resolve43, reject2) => {
|
|
165855
165855
|
fs25.readFile(path29, (err, buffer) => {
|
|
@@ -196795,7 +196795,7 @@ var require_filesystem = __commonJS((exports, module) => {
|
|
|
196795
196795
|
var LDD_PATH = "/usr/bin/ldd";
|
|
196796
196796
|
var SELF_PATH = "/proc/self/exe";
|
|
196797
196797
|
var MAX_LENGTH = 2048;
|
|
196798
|
-
var
|
|
196798
|
+
var readFileSync80 = (path29) => {
|
|
196799
196799
|
const fd = fs26.openSync(path29, "r");
|
|
196800
196800
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
196801
196801
|
const bytesRead = fs26.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -196818,7 +196818,7 @@ var require_filesystem = __commonJS((exports, module) => {
|
|
|
196818
196818
|
module.exports = {
|
|
196819
196819
|
LDD_PATH,
|
|
196820
196820
|
SELF_PATH,
|
|
196821
|
-
readFileSync:
|
|
196821
|
+
readFileSync: readFileSync80,
|
|
196822
196822
|
readFile: readFile14
|
|
196823
196823
|
};
|
|
196824
196824
|
});
|
|
@@ -196861,7 +196861,7 @@ var require_elf = __commonJS((exports, module) => {
|
|
|
196861
196861
|
var require_detect_libc = __commonJS((exports, module) => {
|
|
196862
196862
|
var childProcess3 = __require("child_process");
|
|
196863
196863
|
var { isLinux, getReport } = require_process();
|
|
196864
|
-
var { LDD_PATH, SELF_PATH, readFile: readFile14, readFileSync:
|
|
196864
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile14, readFileSync: readFileSync80 } = require_filesystem();
|
|
196865
196865
|
var { interpreterPath } = require_elf();
|
|
196866
196866
|
var cachedFamilyInterpreter;
|
|
196867
196867
|
var cachedFamilyFilesystem;
|
|
@@ -196952,7 +196952,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
196952
196952
|
}
|
|
196953
196953
|
cachedFamilyFilesystem = null;
|
|
196954
196954
|
try {
|
|
196955
|
-
const lddContent =
|
|
196955
|
+
const lddContent = readFileSync80(LDD_PATH);
|
|
196956
196956
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
196957
196957
|
} catch (e) {}
|
|
196958
196958
|
return cachedFamilyFilesystem;
|
|
@@ -196975,7 +196975,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
196975
196975
|
}
|
|
196976
196976
|
cachedFamilyInterpreter = null;
|
|
196977
196977
|
try {
|
|
196978
|
-
const selfContent =
|
|
196978
|
+
const selfContent = readFileSync80(SELF_PATH);
|
|
196979
196979
|
const path29 = interpreterPath(selfContent);
|
|
196980
196980
|
cachedFamilyInterpreter = familyFromInterpreterPath(path29);
|
|
196981
196981
|
} catch (e) {}
|
|
@@ -197037,7 +197037,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
197037
197037
|
}
|
|
197038
197038
|
cachedVersionFilesystem = null;
|
|
197039
197039
|
try {
|
|
197040
|
-
const lddContent =
|
|
197040
|
+
const lddContent = readFileSync80(LDD_PATH);
|
|
197041
197041
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
197042
197042
|
if (versionMatch) {
|
|
197043
197043
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -233077,7 +233077,7 @@ import * as Crypto from "crypto";
|
|
|
233077
233077
|
import { once } from "events";
|
|
233078
233078
|
import { createReadStream, createWriteStream, promises as fs26, WriteStream } from "fs";
|
|
233079
233079
|
import { tmpdir as tmpdir8 } from "os";
|
|
233080
|
-
import { join as
|
|
233080
|
+
import { join as join139 } from "path";
|
|
233081
233081
|
import { Readable as Readable2, Transform } from "stream";
|
|
233082
233082
|
import { URL as URL2 } from "url";
|
|
233083
233083
|
async function getMediaKeys(buffer2, mediaType) {
|
|
@@ -233155,7 +233155,7 @@ async function generateThumbnail(file2, mediaType, options) {
|
|
|
233155
233155
|
};
|
|
233156
233156
|
}
|
|
233157
233157
|
} else if (mediaType === "video") {
|
|
233158
|
-
const imgFilename =
|
|
233158
|
+
const imgFilename = join139(getTmpFilesDirectory(), generateMessageIDV2() + ".jpg");
|
|
233159
233159
|
try {
|
|
233160
233160
|
await extractVideoThumb(file2, imgFilename, "00:00:00", { width: 32, height: 32 });
|
|
233161
233161
|
const buff = await fs26.readFile(imgFilename);
|
|
@@ -233198,7 +233198,7 @@ var import_boom5, getTmpFilesDirectory = () => tmpdir8(), getImageProcessingLibr
|
|
|
233198
233198
|
const { stream: stream3 } = await getStream(media);
|
|
233199
233199
|
logger7?.debug("got stream for raw upload");
|
|
233200
233200
|
const hasher = Crypto.createHash("sha256");
|
|
233201
|
-
const filePath =
|
|
233201
|
+
const filePath = join139(tmpdir8(), mediaType + generateMessageIDV2());
|
|
233202
233202
|
const fileWriteStream = createWriteStream(filePath);
|
|
233203
233203
|
let fileLength = 0;
|
|
233204
233204
|
try {
|
|
@@ -233338,12 +233338,12 @@ var import_boom5, getTmpFilesDirectory = () => tmpdir8(), getImageProcessingLibr
|
|
|
233338
233338
|
logger7?.debug("fetched media stream");
|
|
233339
233339
|
const mediaKey = Crypto.randomBytes(32);
|
|
233340
233340
|
const { cipherKey, iv, macKey } = await getMediaKeys(mediaKey, mediaType);
|
|
233341
|
-
const encFilePath =
|
|
233341
|
+
const encFilePath = join139(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-enc");
|
|
233342
233342
|
const encFileWriteStream = createWriteStream(encFilePath);
|
|
233343
233343
|
let originalFileStream;
|
|
233344
233344
|
let originalFilePath;
|
|
233345
233345
|
if (saveOriginalFileIfRequired) {
|
|
233346
|
-
originalFilePath =
|
|
233346
|
+
originalFilePath = join139(getTmpFilesDirectory(), mediaType + generateMessageIDV2() + "-original");
|
|
233347
233347
|
originalFileStream = createWriteStream(originalFilePath);
|
|
233348
233348
|
}
|
|
233349
233349
|
let fileLength = 0;
|
|
@@ -242748,7 +242748,7 @@ var init_auth_utils = __esm(() => {
|
|
|
242748
242748
|
|
|
242749
242749
|
// node_modules/.bun/@whiskeysockets+baileys@7.0.0-rc13+13d21a63c79191a3/node_modules/@whiskeysockets/baileys/lib/Utils/use-multi-file-auth-state.js
|
|
242750
242750
|
import { mkdir as mkdir11, readFile as readFile14, stat as stat8, unlink as unlink3, writeFile as writeFile4 } from "fs/promises";
|
|
242751
|
-
import { join as
|
|
242751
|
+
import { join as join140 } from "path";
|
|
242752
242752
|
var fileLocks, getFileLock = (path29) => {
|
|
242753
242753
|
let mutex = fileLocks.get(path29);
|
|
242754
242754
|
if (!mutex) {
|
|
@@ -242758,7 +242758,7 @@ var fileLocks, getFileLock = (path29) => {
|
|
|
242758
242758
|
return mutex;
|
|
242759
242759
|
}, useMultiFileAuthState = async (folder) => {
|
|
242760
242760
|
const writeData = async (data3, file2) => {
|
|
242761
|
-
const filePath =
|
|
242761
|
+
const filePath = join140(folder, fixFileName(file2));
|
|
242762
242762
|
const mutex = getFileLock(filePath);
|
|
242763
242763
|
return mutex.acquire().then(async (release2) => {
|
|
242764
242764
|
try {
|
|
@@ -242770,7 +242770,7 @@ var fileLocks, getFileLock = (path29) => {
|
|
|
242770
242770
|
};
|
|
242771
242771
|
const readData = async (file2) => {
|
|
242772
242772
|
try {
|
|
242773
|
-
const filePath =
|
|
242773
|
+
const filePath = join140(folder, fixFileName(file2));
|
|
242774
242774
|
const mutex = getFileLock(filePath);
|
|
242775
242775
|
return await mutex.acquire().then(async (release2) => {
|
|
242776
242776
|
try {
|
|
@@ -242786,7 +242786,7 @@ var fileLocks, getFileLock = (path29) => {
|
|
|
242786
242786
|
};
|
|
242787
242787
|
const removeData = async (file2) => {
|
|
242788
242788
|
try {
|
|
242789
|
-
const filePath =
|
|
242789
|
+
const filePath = join140(folder, fixFileName(file2));
|
|
242790
242790
|
const mutex = getFileLock(filePath);
|
|
242791
242791
|
return mutex.acquire().then(async (release2) => {
|
|
242792
242792
|
try {
|
|
@@ -263757,7 +263757,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
263757
263757
|
var { version: version2 } = require_package3();
|
|
263758
263758
|
var { EventEmitter: EventEmitter4 } = __require("events");
|
|
263759
263759
|
var { Worker } = __require("worker_threads");
|
|
263760
|
-
var { join:
|
|
263760
|
+
var { join: join141 } = __require("path");
|
|
263761
263761
|
var { pathToFileURL: pathToFileURL2 } = __require("url");
|
|
263762
263762
|
var { wait: wait2 } = require_wait2();
|
|
263763
263763
|
var {
|
|
@@ -263800,7 +263800,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
263800
263800
|
function createWorker(stream3, opts) {
|
|
263801
263801
|
const { filename, workerData } = opts;
|
|
263802
263802
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
263803
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
263803
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join141(__dirname, "lib", "worker.js");
|
|
263804
263804
|
const worker = new Worker(toExecute, {
|
|
263805
263805
|
...opts.workerOpts,
|
|
263806
263806
|
trackUnmanagedFds: false,
|
|
@@ -264201,7 +264201,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
264201
264201
|
var __dirname = "/root/Projets/MaTrixOS/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
|
|
264202
264202
|
var { createRequire: createRequire4 } = __require("module");
|
|
264203
264203
|
var getCallers = require_caller();
|
|
264204
|
-
var { join:
|
|
264204
|
+
var { join: join141, isAbsolute: isAbsolute21, sep: sep3 } = __require("path");
|
|
264205
264205
|
var sleep3 = require_atomic_sleep();
|
|
264206
264206
|
var onExit = require_on_exit_leak_free();
|
|
264207
264207
|
var ThreadStream = require_thread_stream();
|
|
@@ -264264,7 +264264,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
264264
264264
|
throw new Error("only one of target or targets can be specified");
|
|
264265
264265
|
}
|
|
264266
264266
|
if (targets) {
|
|
264267
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
264267
|
+
target = bundlerOverrides["pino-worker"] || join141(__dirname, "worker.js");
|
|
264268
264268
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
264269
264269
|
return {
|
|
264270
264270
|
...dest,
|
|
@@ -264281,7 +264281,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
264281
264281
|
});
|
|
264282
264282
|
});
|
|
264283
264283
|
} else if (pipeline3) {
|
|
264284
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
264284
|
+
target = bundlerOverrides["pino-worker"] || join141(__dirname, "worker.js");
|
|
264285
264285
|
options.pipelines = [pipeline3.map((dest) => {
|
|
264286
264286
|
return {
|
|
264287
264287
|
...dest,
|
|
@@ -264303,7 +264303,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
264303
264303
|
return origin;
|
|
264304
264304
|
}
|
|
264305
264305
|
if (origin === "pino/file") {
|
|
264306
|
-
return
|
|
264306
|
+
return join141(__dirname, "..", "file.js");
|
|
264307
264307
|
}
|
|
264308
264308
|
let fixTarget2;
|
|
264309
264309
|
for (const filePath of callers) {
|
|
@@ -265241,7 +265241,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
|
|
|
265241
265241
|
return circularValue;
|
|
265242
265242
|
}
|
|
265243
265243
|
let res = "";
|
|
265244
|
-
let
|
|
265244
|
+
let join141 = ",";
|
|
265245
265245
|
const originalIndentation = indentation;
|
|
265246
265246
|
if (Array.isArray(value)) {
|
|
265247
265247
|
if (value.length === 0) {
|
|
@@ -265255,7 +265255,7 @@ var require_safe_stable_stringify = __commonJS((exports, module) => {
|
|
|
265255
265255
|
indentation += spacer;
|
|
265256
265256
|
res += `
|
|
265257
265257
|
${indentation}`;
|
|
265258
|
-
|
|
265258
|
+
join141 = `,
|
|
265259
265259
|
${indentation}`;
|
|
265260
265260
|
}
|
|
265261
265261
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -265263,13 +265263,13 @@ ${indentation}`;
|
|
|
265263
265263
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
265264
265264
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
265265
265265
|
res += tmp2 !== undefined ? tmp2 : "null";
|
|
265266
|
-
res +=
|
|
265266
|
+
res += join141;
|
|
265267
265267
|
}
|
|
265268
265268
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
265269
265269
|
res += tmp !== undefined ? tmp : "null";
|
|
265270
265270
|
if (value.length - 1 > maximumBreadth) {
|
|
265271
265271
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
265272
|
-
res += `${
|
|
265272
|
+
res += `${join141}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
265273
265273
|
}
|
|
265274
265274
|
if (spacer !== "") {
|
|
265275
265275
|
res += `
|
|
@@ -265290,7 +265290,7 @@ ${originalIndentation}`;
|
|
|
265290
265290
|
let separator = "";
|
|
265291
265291
|
if (spacer !== "") {
|
|
265292
265292
|
indentation += spacer;
|
|
265293
|
-
|
|
265293
|
+
join141 = `,
|
|
265294
265294
|
${indentation}`;
|
|
265295
265295
|
whitespace = " ";
|
|
265296
265296
|
}
|
|
@@ -265304,13 +265304,13 @@ ${indentation}`;
|
|
|
265304
265304
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
265305
265305
|
if (tmp !== undefined) {
|
|
265306
265306
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
265307
|
-
separator =
|
|
265307
|
+
separator = join141;
|
|
265308
265308
|
}
|
|
265309
265309
|
}
|
|
265310
265310
|
if (keyLength > maximumBreadth) {
|
|
265311
265311
|
const removedKeys = keyLength - maximumBreadth;
|
|
265312
265312
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
265313
|
-
separator =
|
|
265313
|
+
separator = join141;
|
|
265314
265314
|
}
|
|
265315
265315
|
if (spacer !== "" && separator.length > 1) {
|
|
265316
265316
|
res = `
|
|
@@ -265350,7 +265350,7 @@ ${originalIndentation}`;
|
|
|
265350
265350
|
}
|
|
265351
265351
|
const originalIndentation = indentation;
|
|
265352
265352
|
let res = "";
|
|
265353
|
-
let
|
|
265353
|
+
let join141 = ",";
|
|
265354
265354
|
if (Array.isArray(value)) {
|
|
265355
265355
|
if (value.length === 0) {
|
|
265356
265356
|
return "[]";
|
|
@@ -265363,7 +265363,7 @@ ${originalIndentation}`;
|
|
|
265363
265363
|
indentation += spacer;
|
|
265364
265364
|
res += `
|
|
265365
265365
|
${indentation}`;
|
|
265366
|
-
|
|
265366
|
+
join141 = `,
|
|
265367
265367
|
${indentation}`;
|
|
265368
265368
|
}
|
|
265369
265369
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -265371,13 +265371,13 @@ ${indentation}`;
|
|
|
265371
265371
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
265372
265372
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
265373
265373
|
res += tmp2 !== undefined ? tmp2 : "null";
|
|
265374
|
-
res +=
|
|
265374
|
+
res += join141;
|
|
265375
265375
|
}
|
|
265376
265376
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
265377
265377
|
res += tmp !== undefined ? tmp : "null";
|
|
265378
265378
|
if (value.length - 1 > maximumBreadth) {
|
|
265379
265379
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
265380
|
-
res += `${
|
|
265380
|
+
res += `${join141}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
265381
265381
|
}
|
|
265382
265382
|
if (spacer !== "") {
|
|
265383
265383
|
res += `
|
|
@@ -265390,7 +265390,7 @@ ${originalIndentation}`;
|
|
|
265390
265390
|
let whitespace = "";
|
|
265391
265391
|
if (spacer !== "") {
|
|
265392
265392
|
indentation += spacer;
|
|
265393
|
-
|
|
265393
|
+
join141 = `,
|
|
265394
265394
|
${indentation}`;
|
|
265395
265395
|
whitespace = " ";
|
|
265396
265396
|
}
|
|
@@ -265399,7 +265399,7 @@ ${indentation}`;
|
|
|
265399
265399
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
265400
265400
|
if (tmp !== undefined) {
|
|
265401
265401
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
265402
|
-
separator =
|
|
265402
|
+
separator = join141;
|
|
265403
265403
|
}
|
|
265404
265404
|
}
|
|
265405
265405
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -265456,20 +265456,20 @@ ${originalIndentation}`;
|
|
|
265456
265456
|
indentation += spacer;
|
|
265457
265457
|
let res2 = `
|
|
265458
265458
|
${indentation}`;
|
|
265459
|
-
const
|
|
265459
|
+
const join142 = `,
|
|
265460
265460
|
${indentation}`;
|
|
265461
265461
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
265462
265462
|
let i = 0;
|
|
265463
265463
|
for (;i < maximumValuesToStringify - 1; i++) {
|
|
265464
265464
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
265465
265465
|
res2 += tmp2 !== undefined ? tmp2 : "null";
|
|
265466
|
-
res2 +=
|
|
265466
|
+
res2 += join142;
|
|
265467
265467
|
}
|
|
265468
265468
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
265469
265469
|
res2 += tmp !== undefined ? tmp : "null";
|
|
265470
265470
|
if (value.length - 1 > maximumBreadth) {
|
|
265471
265471
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
265472
|
-
res2 += `${
|
|
265472
|
+
res2 += `${join142}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
265473
265473
|
}
|
|
265474
265474
|
res2 += `
|
|
265475
265475
|
${originalIndentation}`;
|
|
@@ -265485,16 +265485,16 @@ ${originalIndentation}`;
|
|
|
265485
265485
|
return '"[Object]"';
|
|
265486
265486
|
}
|
|
265487
265487
|
indentation += spacer;
|
|
265488
|
-
const
|
|
265488
|
+
const join141 = `,
|
|
265489
265489
|
${indentation}`;
|
|
265490
265490
|
let res = "";
|
|
265491
265491
|
let separator = "";
|
|
265492
265492
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
265493
265493
|
if (isTypedArrayWithEntries(value)) {
|
|
265494
|
-
res += stringifyTypedArray(value,
|
|
265494
|
+
res += stringifyTypedArray(value, join141, maximumBreadth);
|
|
265495
265495
|
keys = keys.slice(value.length);
|
|
265496
265496
|
maximumPropertiesToStringify -= value.length;
|
|
265497
|
-
separator =
|
|
265497
|
+
separator = join141;
|
|
265498
265498
|
}
|
|
265499
265499
|
if (deterministic) {
|
|
265500
265500
|
keys = sort(keys, comparator);
|
|
@@ -265505,13 +265505,13 @@ ${indentation}`;
|
|
|
265505
265505
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
265506
265506
|
if (tmp !== undefined) {
|
|
265507
265507
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
265508
|
-
separator =
|
|
265508
|
+
separator = join141;
|
|
265509
265509
|
}
|
|
265510
265510
|
}
|
|
265511
265511
|
if (keyLength > maximumBreadth) {
|
|
265512
265512
|
const removedKeys = keyLength - maximumBreadth;
|
|
265513
265513
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
265514
|
-
separator =
|
|
265514
|
+
separator = join141;
|
|
265515
265515
|
}
|
|
265516
265516
|
if (separator !== "") {
|
|
265517
265517
|
res = `
|
|
@@ -266161,7 +266161,7 @@ var init_Defaults = __esm(() => {
|
|
|
266161
266161
|
import { createHash as createHash13 } from "crypto";
|
|
266162
266162
|
import { createWriteStream as createWriteStream2, promises as fs28 } from "fs";
|
|
266163
266163
|
import { tmpdir as tmpdir9 } from "os";
|
|
266164
|
-
import { join as
|
|
266164
|
+
import { join as join141 } from "path";
|
|
266165
266165
|
async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 30000) {
|
|
266166
266166
|
product = {
|
|
266167
266167
|
...product,
|
|
@@ -266339,7 +266339,7 @@ var import_boom12, parseCatalogNode = (node) => {
|
|
|
266339
266339
|
}
|
|
266340
266340
|
const { stream: stream3 } = await getStream(img);
|
|
266341
266341
|
const hasher = createHash13("sha256");
|
|
266342
|
-
const filePath =
|
|
266342
|
+
const filePath = join141(tmpdir9(), "img" + generateMessageIDV2());
|
|
266343
266343
|
const encFileWriteStream = createWriteStream2(filePath);
|
|
266344
266344
|
for await (const block2 of stream3) {
|
|
266345
266345
|
hasher.update(block2);
|
|
@@ -296937,127 +296937,127 @@ var init_lib6 = __esm(() => {
|
|
|
296937
296937
|
});
|
|
296938
296938
|
|
|
296939
296939
|
// packages/omo-config-core/src/schema/agent.ts
|
|
296940
|
-
import * as
|
|
296940
|
+
import * as z57 from "zod";
|
|
296941
296941
|
var OmoAgentDefSchema, MatrixosAgentsConfigSchema;
|
|
296942
296942
|
var init_agent = __esm(() => {
|
|
296943
|
-
OmoAgentDefSchema =
|
|
296944
|
-
description:
|
|
296945
|
-
prompt:
|
|
296946
|
-
model:
|
|
296947
|
-
models:
|
|
296948
|
-
tools:
|
|
296949
|
-
execution_mode:
|
|
296950
|
-
background:
|
|
296951
|
-
max_depth:
|
|
296952
|
-
allowed_subagents:
|
|
296953
|
-
temperature:
|
|
296954
|
-
disable:
|
|
296943
|
+
OmoAgentDefSchema = z57.object({
|
|
296944
|
+
description: z57.string().optional(),
|
|
296945
|
+
prompt: z57.string().optional(),
|
|
296946
|
+
model: z57.string().optional(),
|
|
296947
|
+
models: z57.array(z57.string()).optional(),
|
|
296948
|
+
tools: z57.record(z57.string(), z57.boolean()).optional(),
|
|
296949
|
+
execution_mode: z57.enum(["in-process", "process"]).optional(),
|
|
296950
|
+
background: z57.boolean().optional(),
|
|
296951
|
+
max_depth: z57.number().int().nonnegative().optional(),
|
|
296952
|
+
allowed_subagents: z57.array(z57.string()).optional(),
|
|
296953
|
+
temperature: z57.number().min(0).max(2).optional(),
|
|
296954
|
+
disable: z57.boolean().optional()
|
|
296955
296955
|
}).strict();
|
|
296956
|
-
MatrixosAgentsConfigSchema =
|
|
296956
|
+
MatrixosAgentsConfigSchema = z57.record(z57.string(), OmoAgentDefSchema);
|
|
296957
296957
|
});
|
|
296958
296958
|
|
|
296959
296959
|
// packages/omo-config-core/src/schema/fallback-models.ts
|
|
296960
|
-
import * as
|
|
296960
|
+
import * as z58 from "zod";
|
|
296961
296961
|
var OmoThinkingConfigSchema, OmoFallbackModelObjectSchema, OmoFallbackModelsSchema;
|
|
296962
296962
|
var init_fallback_models = __esm(() => {
|
|
296963
|
-
OmoThinkingConfigSchema =
|
|
296964
|
-
type:
|
|
296965
|
-
budgetTokens:
|
|
296963
|
+
OmoThinkingConfigSchema = z58.object({
|
|
296964
|
+
type: z58.enum(["enabled", "disabled"]),
|
|
296965
|
+
budgetTokens: z58.number().optional()
|
|
296966
296966
|
}).strict();
|
|
296967
|
-
OmoFallbackModelObjectSchema =
|
|
296968
|
-
model:
|
|
296969
|
-
variant:
|
|
296970
|
-
reasoningEffort:
|
|
296971
|
-
temperature:
|
|
296972
|
-
top_p:
|
|
296973
|
-
maxTokens:
|
|
296967
|
+
OmoFallbackModelObjectSchema = z58.object({
|
|
296968
|
+
model: z58.string(),
|
|
296969
|
+
variant: z58.string().optional(),
|
|
296970
|
+
reasoningEffort: z58.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional(),
|
|
296971
|
+
temperature: z58.number().min(0).max(2).optional(),
|
|
296972
|
+
top_p: z58.number().min(0).max(1).optional(),
|
|
296973
|
+
maxTokens: z58.number().optional(),
|
|
296974
296974
|
thinking: OmoThinkingConfigSchema.optional()
|
|
296975
296975
|
}).strict();
|
|
296976
|
-
OmoFallbackModelsSchema =
|
|
296977
|
-
|
|
296978
|
-
|
|
296979
|
-
|
|
296980
|
-
|
|
296976
|
+
OmoFallbackModelsSchema = z58.union([
|
|
296977
|
+
z58.string(),
|
|
296978
|
+
z58.array(z58.string()),
|
|
296979
|
+
z58.array(OmoFallbackModelObjectSchema),
|
|
296980
|
+
z58.array(z58.union([z58.string(), OmoFallbackModelObjectSchema]))
|
|
296981
296981
|
]);
|
|
296982
296982
|
});
|
|
296983
296983
|
|
|
296984
296984
|
// packages/omo-config-core/src/schema/category.ts
|
|
296985
|
-
import * as
|
|
296985
|
+
import * as z59 from "zod";
|
|
296986
296986
|
var OmoCategoryConfigSchema, MatrixosCategoriesConfigSchema;
|
|
296987
296987
|
var init_category = __esm(() => {
|
|
296988
296988
|
init_fallback_models();
|
|
296989
|
-
OmoCategoryConfigSchema =
|
|
296990
|
-
description:
|
|
296991
|
-
model:
|
|
296989
|
+
OmoCategoryConfigSchema = z59.object({
|
|
296990
|
+
description: z59.string().optional(),
|
|
296991
|
+
model: z59.string().optional(),
|
|
296992
296992
|
fallback_models: OmoFallbackModelsSchema.optional(),
|
|
296993
|
-
variant:
|
|
296994
|
-
temperature:
|
|
296995
|
-
top_p:
|
|
296996
|
-
maxTokens:
|
|
296993
|
+
variant: z59.string().optional(),
|
|
296994
|
+
temperature: z59.number().min(0).max(2).optional(),
|
|
296995
|
+
top_p: z59.number().min(0).max(1).optional(),
|
|
296996
|
+
maxTokens: z59.number().optional(),
|
|
296997
296997
|
thinking: OmoThinkingConfigSchema.optional(),
|
|
296998
|
-
reasoningEffort:
|
|
296999
|
-
textVerbosity:
|
|
297000
|
-
tools:
|
|
297001
|
-
prompt_append:
|
|
297002
|
-
max_prompt_tokens:
|
|
297003
|
-
is_unstable_agent:
|
|
297004
|
-
disable:
|
|
296998
|
+
reasoningEffort: z59.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional(),
|
|
296999
|
+
textVerbosity: z59.enum(["low", "medium", "high"]).optional(),
|
|
297000
|
+
tools: z59.record(z59.string(), z59.boolean()).optional(),
|
|
297001
|
+
prompt_append: z59.string().optional(),
|
|
297002
|
+
max_prompt_tokens: z59.number().int().positive().optional(),
|
|
297003
|
+
is_unstable_agent: z59.boolean().optional(),
|
|
297004
|
+
disable: z59.boolean().optional()
|
|
297005
297005
|
}).strict();
|
|
297006
|
-
MatrixosCategoriesConfigSchema =
|
|
297006
|
+
MatrixosCategoriesConfigSchema = z59.record(z59.string(), OmoCategoryConfigSchema);
|
|
297007
297007
|
});
|
|
297008
297008
|
|
|
297009
297009
|
// packages/omo-config-core/src/schema/profile.ts
|
|
297010
|
-
import * as
|
|
297010
|
+
import * as z60 from "zod";
|
|
297011
297011
|
var ProfileSchema, ProfileRegistrySchema, ProfileReferenceSchema, ProfileReferencesSchema;
|
|
297012
297012
|
var init_profile = __esm(() => {
|
|
297013
297013
|
init_agent();
|
|
297014
|
-
ProfileSchema =
|
|
297015
|
-
name:
|
|
297016
|
-
displayName:
|
|
297017
|
-
description:
|
|
297018
|
-
version:
|
|
297019
|
-
baseAgent:
|
|
297020
|
-
extends:
|
|
297021
|
-
agents:
|
|
297022
|
-
skills:
|
|
297023
|
-
hooks:
|
|
297024
|
-
tools:
|
|
297025
|
-
mcp:
|
|
297026
|
-
modelPreferences:
|
|
297027
|
-
systemPrompt:
|
|
297014
|
+
ProfileSchema = z60.object({
|
|
297015
|
+
name: z60.string().regex(/^[a-z][a-z0-9-]*$/, "name must be kebab-case (lowercase, digits, hyphens)"),
|
|
297016
|
+
displayName: z60.string().min(1),
|
|
297017
|
+
description: z60.string().min(1),
|
|
297018
|
+
version: z60.string().regex(/^\d+\.\d+\.\d+$/, "version must be semver (e.g. 1.0.0)").default("0.1.0"),
|
|
297019
|
+
baseAgent: z60.string().default("morpheus"),
|
|
297020
|
+
extends: z60.array(z60.string()).default([]),
|
|
297021
|
+
agents: z60.record(z60.string(), OmoAgentDefSchema).default({}),
|
|
297022
|
+
skills: z60.array(z60.string()).default([]),
|
|
297023
|
+
hooks: z60.array(z60.string()).default([]),
|
|
297024
|
+
tools: z60.array(z60.string()).default([]),
|
|
297025
|
+
mcp: z60.array(z60.string()).default([]),
|
|
297026
|
+
modelPreferences: z60.record(z60.string(), z60.string()).default({}),
|
|
297027
|
+
systemPrompt: z60.string().optional()
|
|
297028
297028
|
}).strict();
|
|
297029
|
-
ProfileRegistrySchema =
|
|
297030
|
-
$schema:
|
|
297031
|
-
profiles:
|
|
297029
|
+
ProfileRegistrySchema = z60.object({
|
|
297030
|
+
$schema: z60.string().optional(),
|
|
297031
|
+
profiles: z60.record(z60.string(), ProfileSchema)
|
|
297032
297032
|
}).strict();
|
|
297033
|
-
ProfileReferenceSchema =
|
|
297034
|
-
ProfileReferencesSchema =
|
|
297033
|
+
ProfileReferenceSchema = z60.string().regex(/^[a-z][a-z0-9-]*$/, "profile ref must be kebab-case");
|
|
297034
|
+
ProfileReferencesSchema = z60.array(ProfileReferenceSchema).default([]);
|
|
297035
297035
|
});
|
|
297036
297036
|
|
|
297037
297037
|
// packages/omo-config-core/src/schema/task.ts
|
|
297038
|
-
import * as
|
|
297038
|
+
import * as z61 from "zod";
|
|
297039
297039
|
var OmoTaskWaitSchema, OmoTaskTeamSettingsSchema, MatrixosTaskSettingsSchema;
|
|
297040
297040
|
var init_task = __esm(() => {
|
|
297041
|
-
OmoTaskWaitSchema =
|
|
297042
|
-
min_ms:
|
|
297043
|
-
default_ms:
|
|
297044
|
-
max_ms:
|
|
297041
|
+
OmoTaskWaitSchema = z61.object({
|
|
297042
|
+
min_ms: z61.number().int().positive().default(5000),
|
|
297043
|
+
default_ms: z61.number().int().positive().default(60000),
|
|
297044
|
+
max_ms: z61.number().int().positive().default(600000)
|
|
297045
297045
|
}).strict();
|
|
297046
|
-
OmoTaskTeamSettingsSchema =
|
|
297047
|
-
max_members:
|
|
297048
|
-
max_parallel_members:
|
|
297049
|
-
max_wall_clock_minutes:
|
|
297046
|
+
OmoTaskTeamSettingsSchema = z61.object({
|
|
297047
|
+
max_members: z61.number().int().min(1).max(8).default(8),
|
|
297048
|
+
max_parallel_members: z61.number().int().min(1).max(8).default(4),
|
|
297049
|
+
max_wall_clock_minutes: z61.number().int().positive().default(120)
|
|
297050
297050
|
}).strict();
|
|
297051
|
-
MatrixosTaskSettingsSchema =
|
|
297052
|
-
default_execution_mode:
|
|
297053
|
-
default_concurrency:
|
|
297054
|
-
provider_concurrency:
|
|
297055
|
-
model_concurrency:
|
|
297056
|
-
max_depth:
|
|
297057
|
-
residency_max_children:
|
|
297058
|
-
ttl_ms:
|
|
297059
|
-
state_dir:
|
|
297060
|
-
reattach_on_reconcile:
|
|
297051
|
+
MatrixosTaskSettingsSchema = z61.object({
|
|
297052
|
+
default_execution_mode: z61.enum(["in-process", "process"]).default("in-process"),
|
|
297053
|
+
default_concurrency: z61.number().int().positive().default(5),
|
|
297054
|
+
provider_concurrency: z61.record(z61.string(), z61.number().int().positive()).optional(),
|
|
297055
|
+
model_concurrency: z61.record(z61.string(), z61.number().int().positive()).optional(),
|
|
297056
|
+
max_depth: z61.number().int().nonnegative().default(1),
|
|
297057
|
+
residency_max_children: z61.number().int().positive().default(8),
|
|
297058
|
+
ttl_ms: z61.number().int().positive().default(86400000),
|
|
297059
|
+
state_dir: z61.string().optional(),
|
|
297060
|
+
reattach_on_reconcile: z61.boolean().optional(),
|
|
297061
297061
|
wait: OmoTaskWaitSchema.default({ min_ms: 5000, default_ms: 60000, max_ms: 600000 }),
|
|
297062
297062
|
team: OmoTaskTeamSettingsSchema.default({
|
|
297063
297063
|
max_members: 8,
|
|
@@ -297068,41 +297068,41 @@ var init_task = __esm(() => {
|
|
|
297068
297068
|
});
|
|
297069
297069
|
|
|
297070
297070
|
// packages/omo-config-core/src/schema/team.ts
|
|
297071
|
-
import * as
|
|
297071
|
+
import * as z62 from "zod";
|
|
297072
297072
|
var OmoTeamMemberBaseSchema, OmoTeamCategoryMemberSchema, OmoTeamSubagentMemberSchema, OmoTeamMemberSchema, OmoTeamSpecBaseSchema, OmoTeamSpecSchema, OmoTeamSpecLayerSchema, MatrixosTeamsConfigSchema, MatrixosTeamsConfigLayerSchema;
|
|
297073
297073
|
var init_team = __esm(() => {
|
|
297074
|
-
OmoTeamMemberBaseSchema =
|
|
297075
|
-
name:
|
|
297076
|
-
cwd:
|
|
297077
|
-
worktreePath:
|
|
297078
|
-
subscriptions:
|
|
297079
|
-
backendType:
|
|
297080
|
-
color:
|
|
297081
|
-
isActive:
|
|
297074
|
+
OmoTeamMemberBaseSchema = z62.object({
|
|
297075
|
+
name: z62.string().min(1).regex(/^[a-z0-9-]+$/),
|
|
297076
|
+
cwd: z62.string().optional(),
|
|
297077
|
+
worktreePath: z62.string().optional(),
|
|
297078
|
+
subscriptions: z62.array(z62.string()).optional(),
|
|
297079
|
+
backendType: z62.enum(["in-process", "tmux"]).default("in-process"),
|
|
297080
|
+
color: z62.string().optional(),
|
|
297081
|
+
isActive: z62.boolean().default(true)
|
|
297082
297082
|
}).strict();
|
|
297083
297083
|
OmoTeamCategoryMemberSchema = OmoTeamMemberBaseSchema.extend({
|
|
297084
|
-
kind:
|
|
297085
|
-
category:
|
|
297086
|
-
prompt:
|
|
297084
|
+
kind: z62.literal("category"),
|
|
297085
|
+
category: z62.string().min(1),
|
|
297086
|
+
prompt: z62.string().min(1)
|
|
297087
297087
|
});
|
|
297088
297088
|
OmoTeamSubagentMemberSchema = OmoTeamMemberBaseSchema.extend({
|
|
297089
|
-
kind:
|
|
297090
|
-
subagent_type:
|
|
297091
|
-
prompt:
|
|
297089
|
+
kind: z62.literal("subagent_type"),
|
|
297090
|
+
subagent_type: z62.string().min(1),
|
|
297091
|
+
prompt: z62.string().optional()
|
|
297092
297092
|
});
|
|
297093
|
-
OmoTeamMemberSchema =
|
|
297093
|
+
OmoTeamMemberSchema = z62.discriminatedUnion("kind", [
|
|
297094
297094
|
OmoTeamCategoryMemberSchema,
|
|
297095
297095
|
OmoTeamSubagentMemberSchema
|
|
297096
297096
|
]);
|
|
297097
|
-
OmoTeamSpecBaseSchema =
|
|
297098
|
-
version:
|
|
297099
|
-
name:
|
|
297100
|
-
description:
|
|
297101
|
-
createdAt:
|
|
297102
|
-
leadAgentId:
|
|
297103
|
-
teamAllowedPaths:
|
|
297104
|
-
sessionPermission:
|
|
297105
|
-
members:
|
|
297097
|
+
OmoTeamSpecBaseSchema = z62.object({
|
|
297098
|
+
version: z62.literal(1).default(1),
|
|
297099
|
+
name: z62.string().min(1).regex(/^[a-z0-9-]+$/).optional(),
|
|
297100
|
+
description: z62.string().optional(),
|
|
297101
|
+
createdAt: z62.number().int().positive().optional(),
|
|
297102
|
+
leadAgentId: z62.string().optional(),
|
|
297103
|
+
teamAllowedPaths: z62.array(z62.string()).optional(),
|
|
297104
|
+
sessionPermission: z62.string().optional(),
|
|
297105
|
+
members: z62.array(OmoTeamMemberSchema).min(1).max(8)
|
|
297106
297106
|
}).strict();
|
|
297107
297107
|
OmoTeamSpecSchema = OmoTeamSpecBaseSchema.superRefine((teamSpec, ctx) => {
|
|
297108
297108
|
if (teamSpec.leadAgentId === undefined && teamSpec.members.length > 1) {
|
|
@@ -297114,12 +297114,12 @@ var init_team = __esm(() => {
|
|
|
297114
297114
|
}
|
|
297115
297115
|
});
|
|
297116
297116
|
OmoTeamSpecLayerSchema = OmoTeamSpecBaseSchema.partial();
|
|
297117
|
-
MatrixosTeamsConfigSchema =
|
|
297118
|
-
MatrixosTeamsConfigLayerSchema =
|
|
297117
|
+
MatrixosTeamsConfigSchema = z62.record(z62.string(), OmoTeamSpecSchema);
|
|
297118
|
+
MatrixosTeamsConfigLayerSchema = z62.record(z62.string(), OmoTeamSpecLayerSchema);
|
|
297119
297119
|
});
|
|
297120
297120
|
|
|
297121
297121
|
// packages/omo-config-core/src/schema/config.ts
|
|
297122
|
-
import * as
|
|
297122
|
+
import * as z63 from "zod";
|
|
297123
297123
|
var MatrixosConfigSchema, MatrixosConfigLayerSchema;
|
|
297124
297124
|
var init_config = __esm(() => {
|
|
297125
297125
|
init_agent();
|
|
@@ -297127,8 +297127,8 @@ var init_config = __esm(() => {
|
|
|
297127
297127
|
init_profile();
|
|
297128
297128
|
init_task();
|
|
297129
297129
|
init_team();
|
|
297130
|
-
MatrixosConfigSchema =
|
|
297131
|
-
$schema:
|
|
297130
|
+
MatrixosConfigSchema = z63.object({
|
|
297131
|
+
$schema: z63.string().optional(),
|
|
297132
297132
|
categories: MatrixosCategoriesConfigSchema.optional(),
|
|
297133
297133
|
agents: MatrixosAgentsConfigSchema.optional(),
|
|
297134
297134
|
task: MatrixosTaskSettingsSchema.optional(),
|
|
@@ -297136,8 +297136,8 @@ var init_config = __esm(() => {
|
|
|
297136
297136
|
profiles: ProfileReferencesSchema.optional(),
|
|
297137
297137
|
profileRegistry: ProfileRegistrySchema.optional()
|
|
297138
297138
|
}).strict();
|
|
297139
|
-
MatrixosConfigLayerSchema =
|
|
297140
|
-
$schema:
|
|
297139
|
+
MatrixosConfigLayerSchema = z63.object({
|
|
297140
|
+
$schema: z63.string().optional(),
|
|
297141
297141
|
categories: MatrixosCategoriesConfigSchema.optional(),
|
|
297142
297142
|
agents: MatrixosAgentsConfigSchema.optional(),
|
|
297143
297143
|
task: MatrixosTaskSettingsSchema.optional(),
|
|
@@ -297187,18 +297187,18 @@ var init_merge = __esm(() => {
|
|
|
297187
297187
|
});
|
|
297188
297188
|
|
|
297189
297189
|
// packages/omo-config-core/src/loader/types.ts
|
|
297190
|
-
import { existsSync as
|
|
297190
|
+
import { existsSync as existsSync117, lstatSync as lstatSync5, readFileSync as readFileSync80 } from "fs";
|
|
297191
297191
|
var DEFAULT_READ_FILE_SYSTEM;
|
|
297192
297192
|
var init_types7 = __esm(() => {
|
|
297193
297193
|
DEFAULT_READ_FILE_SYSTEM = {
|
|
297194
|
-
existsSync:
|
|
297194
|
+
existsSync: existsSync117,
|
|
297195
297195
|
lstatSync: lstatSync5,
|
|
297196
|
-
readFileSync:
|
|
297196
|
+
readFileSync: readFileSync80
|
|
297197
297197
|
};
|
|
297198
297198
|
});
|
|
297199
297199
|
|
|
297200
297200
|
// packages/omo-config-core/src/loader/paths.ts
|
|
297201
|
-
import { dirname as
|
|
297201
|
+
import { dirname as dirname46, isAbsolute as isAbsolute21, join as join142, relative as relative15, resolve as resolve43 } from "path";
|
|
297202
297202
|
function containsPath2(parent, child) {
|
|
297203
297203
|
const pathToChild = relative15(parent, child);
|
|
297204
297204
|
return pathToChild === "" || !pathToChild.startsWith("..") && !isAbsolute21(pathToChild);
|
|
@@ -297207,23 +297207,23 @@ function resolveHomeDir(env2 = process.env) {
|
|
|
297207
297207
|
return resolve43(env2.HOME ?? env2.USERPROFILE ?? process.cwd());
|
|
297208
297208
|
}
|
|
297209
297209
|
function resolveUserMatrixosConfigPath(env2 = process.env, platform4 = process.platform) {
|
|
297210
|
-
return
|
|
297210
|
+
return join142(resolveUserMatrixosConfigDirectory(env2, platform4), "omo.jsonc");
|
|
297211
297211
|
}
|
|
297212
297212
|
function resolveUserMatrixosConfigDirectory(env2 = process.env, platform4 = process.platform) {
|
|
297213
297213
|
if (platform4 === "win32" && env2.APPDATA !== undefined && env2.APPDATA.length > 0) {
|
|
297214
|
-
return
|
|
297214
|
+
return join142(env2.APPDATA, "omo");
|
|
297215
297215
|
}
|
|
297216
297216
|
if (env2.XDG_CONFIG_HOME !== undefined && env2.XDG_CONFIG_HOME.length > 0) {
|
|
297217
|
-
return
|
|
297217
|
+
return join142(env2.XDG_CONFIG_HOME, "omo");
|
|
297218
297218
|
}
|
|
297219
|
-
return
|
|
297219
|
+
return join142(resolveHomeDir(env2), ".config", "omo");
|
|
297220
297220
|
}
|
|
297221
297221
|
function detectUserOmoJsonPath(env2, platform4, fileSystem) {
|
|
297222
297222
|
const configDir = resolveUserMatrixosConfigDirectory(env2, platform4);
|
|
297223
|
-
const jsoncPath =
|
|
297223
|
+
const jsoncPath = join142(configDir, "omo.jsonc");
|
|
297224
297224
|
if (fileSystem.existsSync(jsoncPath))
|
|
297225
297225
|
return jsoncPath;
|
|
297226
|
-
const jsonPath =
|
|
297226
|
+
const jsonPath = join142(configDir, "omo.json");
|
|
297227
297227
|
return fileSystem.existsSync(jsonPath) ? jsonPath : jsoncPath;
|
|
297228
297228
|
}
|
|
297229
297229
|
function isSymlinkedProjectPath(path29, fileSystem) {
|
|
@@ -297241,13 +297241,13 @@ function isLoadableProjectConfigFile(path29, fileSystem) {
|
|
|
297241
297241
|
return fileSystem.existsSync(path29) && !isSymlinkedProjectPath(path29, fileSystem);
|
|
297242
297242
|
}
|
|
297243
297243
|
function detectOmoJsonPath(dir2, fileSystem) {
|
|
297244
|
-
const omoDir =
|
|
297244
|
+
const omoDir = join142(dir2, ".omo");
|
|
297245
297245
|
if (isSymlinkedProjectPath(omoDir, fileSystem))
|
|
297246
297246
|
return null;
|
|
297247
|
-
const jsoncPath =
|
|
297247
|
+
const jsoncPath = join142(omoDir, "omo.jsonc");
|
|
297248
297248
|
if (isLoadableProjectConfigFile(jsoncPath, fileSystem))
|
|
297249
297249
|
return jsoncPath;
|
|
297250
|
-
const jsonPath =
|
|
297250
|
+
const jsonPath = join142(omoDir, "omo.json");
|
|
297251
297251
|
return isLoadableProjectConfigFile(jsonPath, fileSystem) ? jsonPath : null;
|
|
297252
297252
|
}
|
|
297253
297253
|
function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem) {
|
|
@@ -297261,7 +297261,7 @@ function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem) {
|
|
|
297261
297261
|
nearestFirst.push(configPath);
|
|
297262
297262
|
if (stopDir !== null && currentDir === stopDir)
|
|
297263
297263
|
break;
|
|
297264
|
-
const parentDir =
|
|
297264
|
+
const parentDir = dirname46(currentDir);
|
|
297265
297265
|
if (parentDir === currentDir)
|
|
297266
297266
|
break;
|
|
297267
297267
|
currentDir = parentDir;
|
|
@@ -297508,30 +297508,30 @@ var init_loader3 = __esm(() => {
|
|
|
297508
297508
|
// packages/omo-config-core/src/writer/types.ts
|
|
297509
297509
|
import {
|
|
297510
297510
|
copyFileSync as copyFileSync3,
|
|
297511
|
-
existsSync as
|
|
297511
|
+
existsSync as existsSync118,
|
|
297512
297512
|
lstatSync as lstatSync6,
|
|
297513
|
-
mkdirSync as
|
|
297514
|
-
readFileSync as
|
|
297513
|
+
mkdirSync as mkdirSync26,
|
|
297514
|
+
readFileSync as readFileSync81,
|
|
297515
297515
|
readdirSync as readdirSync29,
|
|
297516
297516
|
renameSync as renameSync10,
|
|
297517
297517
|
unlinkSync as unlinkSync17,
|
|
297518
|
-
writeFileSync as
|
|
297518
|
+
writeFileSync as writeFileSync26
|
|
297519
297519
|
} from "fs";
|
|
297520
297520
|
var DEFAULT_WRITE_FILE_SYSTEM, MatrixosConfigWriteError;
|
|
297521
297521
|
var init_types8 = __esm(() => {
|
|
297522
297522
|
DEFAULT_WRITE_FILE_SYSTEM = {
|
|
297523
297523
|
copyFileSync: copyFileSync3,
|
|
297524
|
-
existsSync:
|
|
297524
|
+
existsSync: existsSync118,
|
|
297525
297525
|
lstatSync: lstatSync6,
|
|
297526
|
-
mkdirSync:
|
|
297527
|
-
readFileSync:
|
|
297526
|
+
mkdirSync: mkdirSync26,
|
|
297527
|
+
readFileSync: readFileSync81,
|
|
297528
297528
|
readdirSync: readdirSync29,
|
|
297529
297529
|
renameSync: renameSync10,
|
|
297530
297530
|
unlinkSync: unlinkSync17,
|
|
297531
297531
|
writeFileExclusiveSync: (path29, content) => {
|
|
297532
|
-
|
|
297532
|
+
writeFileSync26(path29, content, { encoding: "utf-8", flag: "wx" });
|
|
297533
297533
|
},
|
|
297534
|
-
writeFileSync:
|
|
297534
|
+
writeFileSync: writeFileSync26
|
|
297535
297535
|
};
|
|
297536
297536
|
MatrixosConfigWriteError = class MatrixosConfigWriteError extends Error {
|
|
297537
297537
|
path;
|
|
@@ -297548,7 +297548,7 @@ var init_types8 = __esm(() => {
|
|
|
297548
297548
|
|
|
297549
297549
|
// packages/omo-config-core/src/writer/writer.ts
|
|
297550
297550
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
297551
|
-
import { dirname as
|
|
297551
|
+
import { dirname as dirname47, join as join143 } from "path";
|
|
297552
297552
|
function backupSuffix() {
|
|
297553
297553
|
return new Date().toISOString().replace(/[:.]/g, "-");
|
|
297554
297554
|
}
|
|
@@ -297579,13 +297579,13 @@ function resolveWritePath(options) {
|
|
|
297579
297579
|
const jsoncPath2 = resolveUserMatrixosConfigPath(options.env, options.platform ?? process.platform);
|
|
297580
297580
|
if (fileSystem.existsSync(jsoncPath2))
|
|
297581
297581
|
return jsoncPath2;
|
|
297582
|
-
const jsonPath2 =
|
|
297582
|
+
const jsonPath2 = join143(dirname47(jsoncPath2), "omo.json");
|
|
297583
297583
|
return fileSystem.existsSync(jsonPath2) ? jsonPath2 : jsoncPath2;
|
|
297584
297584
|
}
|
|
297585
|
-
const jsoncPath =
|
|
297585
|
+
const jsoncPath = join143(options.projectDir ?? process.cwd(), ".omo", "omo.jsonc");
|
|
297586
297586
|
if (fileSystem.existsSync(jsoncPath))
|
|
297587
297587
|
return jsoncPath;
|
|
297588
|
-
const jsonPath =
|
|
297588
|
+
const jsonPath = join143(dirname47(jsoncPath), "omo.json");
|
|
297589
297589
|
return fileSystem.existsSync(jsonPath) ? jsonPath : jsoncPath;
|
|
297590
297590
|
}
|
|
297591
297591
|
function writeAtomically(path29, content, fileSystem) {
|
|
@@ -297638,7 +297638,7 @@ function assertJsoncCanBeModified(path29, content) {
|
|
|
297638
297638
|
function updateMatrixosConfig(options) {
|
|
297639
297639
|
const fileSystem = options.fileSystem ?? DEFAULT_WRITE_FILE_SYSTEM;
|
|
297640
297640
|
const path29 = resolveWritePath(options);
|
|
297641
|
-
const directory =
|
|
297641
|
+
const directory = dirname47(path29);
|
|
297642
297642
|
const existed = fileSystem.existsSync(path29);
|
|
297643
297643
|
let content = EMPTY_OMO_CONFIG;
|
|
297644
297644
|
try {
|
|
@@ -297697,8 +297697,8 @@ var init_writer2 = __esm(() => {
|
|
|
297697
297697
|
});
|
|
297698
297698
|
|
|
297699
297699
|
// packages/omo-config-core/src/generator/mini-os-generator.ts
|
|
297700
|
-
import { existsSync as
|
|
297701
|
-
import { dirname as
|
|
297700
|
+
import { existsSync as existsSync119, mkdirSync as mkdirSync27, writeFileSync as writeFileSync27 } from "fs";
|
|
297701
|
+
import { dirname as dirname48, join as join144 } from "path";
|
|
297702
297702
|
function generateMiniOS(options) {
|
|
297703
297703
|
const fs29 = options.fs ?? defaultFS;
|
|
297704
297704
|
const profile3 = options.profile;
|
|
@@ -297709,29 +297709,29 @@ function generateMiniOS(options) {
|
|
|
297709
297709
|
if (!fs29.existsSync(targetDir)) {
|
|
297710
297710
|
fs29.mkdirSync(targetDir, { recursive: true });
|
|
297711
297711
|
}
|
|
297712
|
-
const pkgPath =
|
|
297712
|
+
const pkgPath = join144(targetDir, "package.json");
|
|
297713
297713
|
writeIfMissing(fs29, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile3.version, profile3.description, profile3.extends, profile3.baseAgent));
|
|
297714
297714
|
filesWritten.push(pkgPath);
|
|
297715
|
-
const srcDir =
|
|
297715
|
+
const srcDir = join144(targetDir, "src");
|
|
297716
297716
|
fs29.mkdirSync(srcDir, { recursive: true });
|
|
297717
|
-
const indexPath =
|
|
297717
|
+
const indexPath = join144(srcDir, "index.ts");
|
|
297718
297718
|
writeIfMissing(fs29, indexPath, TPL_INDEX_TS(profile3.name, displayName, profile3.description));
|
|
297719
297719
|
filesWritten.push(indexPath);
|
|
297720
|
-
const binDir =
|
|
297720
|
+
const binDir = join144(targetDir, "bin");
|
|
297721
297721
|
fs29.mkdirSync(binDir, { recursive: true });
|
|
297722
|
-
const binPath =
|
|
297722
|
+
const binPath = join144(binDir, "matrixos-mini.js");
|
|
297723
297723
|
writeIfMissing(fs29, binPath, TPL_BIN);
|
|
297724
297724
|
filesWritten.push(binPath);
|
|
297725
|
-
const scriptDir =
|
|
297725
|
+
const scriptDir = join144(targetDir, "script");
|
|
297726
297726
|
fs29.mkdirSync(scriptDir, { recursive: true });
|
|
297727
|
-
const buildPath =
|
|
297727
|
+
const buildPath = join144(scriptDir, "build.ts");
|
|
297728
297728
|
writeIfMissing(fs29, buildPath, TPL_BUILD_TS);
|
|
297729
297729
|
filesWritten.push(buildPath);
|
|
297730
297730
|
if (Object.keys(profile3.agents).length > 0) {
|
|
297731
|
-
const agentsDir =
|
|
297731
|
+
const agentsDir = join144(targetDir, "agents");
|
|
297732
297732
|
fs29.mkdirSync(agentsDir, { recursive: true });
|
|
297733
297733
|
for (const [agentName, agentDef] of Object.entries(profile3.agents)) {
|
|
297734
|
-
const agentFile =
|
|
297734
|
+
const agentFile = join144(agentsDir, `${agentName}.ts`);
|
|
297735
297735
|
const description2 = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
|
|
297736
297736
|
writeIfMissing(fs29, agentFile, `// ${description2}
|
|
297737
297737
|
// Generated by MaTrixOS Mini-OS Profile Generator.
|
|
@@ -297742,10 +297742,10 @@ export const description = ${JSON.stringify(description2)}
|
|
|
297742
297742
|
}
|
|
297743
297743
|
}
|
|
297744
297744
|
if (profile3.skills.length > 0) {
|
|
297745
|
-
const skillsDir =
|
|
297745
|
+
const skillsDir = join144(targetDir, "skills");
|
|
297746
297746
|
fs29.mkdirSync(skillsDir, { recursive: true });
|
|
297747
297747
|
for (const skill2 of profile3.skills) {
|
|
297748
|
-
const skillFile =
|
|
297748
|
+
const skillFile = join144(skillsDir, `${skill2}.md`);
|
|
297749
297749
|
writeIfMissing(fs29, skillFile, `# ${skill2}
|
|
297750
297750
|
|
|
297751
297751
|
_Skill required by the ${displayName} profile. Implementation goes here._
|
|
@@ -297753,12 +297753,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
297753
297753
|
filesWritten.push(skillFile);
|
|
297754
297754
|
}
|
|
297755
297755
|
}
|
|
297756
|
-
const readmePath =
|
|
297756
|
+
const readmePath = join144(targetDir, "README.md");
|
|
297757
297757
|
const agentsList = Object.keys(profile3.agents);
|
|
297758
297758
|
const skillsList = profile3.skills;
|
|
297759
297759
|
writeIfMissing(fs29, readmePath, TPL_README(packageName, displayName, profile3.description, profile3.version, profile3.baseAgent, profile3.extends, agentsList, skillsList));
|
|
297760
297760
|
filesWritten.push(readmePath);
|
|
297761
|
-
const agentsMdPath =
|
|
297761
|
+
const agentsMdPath = join144(targetDir, "AGENTS.md");
|
|
297762
297762
|
writeIfMissing(fs29, agentsMdPath, TPL_AGENT_MD(displayName, profile3.description));
|
|
297763
297763
|
filesWritten.push(agentsMdPath);
|
|
297764
297764
|
return { packageName, packageDir: targetDir, filesWritten };
|
|
@@ -297766,7 +297766,7 @@ _Skill required by the ${displayName} profile. Implementation goes here._
|
|
|
297766
297766
|
function writeIfMissing(fs29, path29, content) {
|
|
297767
297767
|
if (fs29.existsSync(path29))
|
|
297768
297768
|
return;
|
|
297769
|
-
const dir2 =
|
|
297769
|
+
const dir2 = dirname48(path29);
|
|
297770
297770
|
if (!fs29.existsSync(dir2)) {
|
|
297771
297771
|
fs29.mkdirSync(dir2, { recursive: true });
|
|
297772
297772
|
}
|
|
@@ -297910,7 +297910,7 @@ This profile is activated when the user mentions the profile name in their reque
|
|
|
297910
297910
|
- Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
|
|
297911
297911
|
`;
|
|
297912
297912
|
var init_mini_os_generator = __esm(() => {
|
|
297913
|
-
defaultFS = { existsSync:
|
|
297913
|
+
defaultFS = { existsSync: existsSync119, mkdirSync: mkdirSync27, writeFileSync: writeFileSync27 };
|
|
297914
297914
|
});
|
|
297915
297915
|
|
|
297916
297916
|
// packages/omo-config-core/src/generator/index.ts
|
|
@@ -368086,7 +368086,7 @@ function getCachedVersion(options = {}) {
|
|
|
368086
368086
|
// package.json
|
|
368087
368087
|
var package_default = {
|
|
368088
368088
|
name: "@kl-c/matrixos",
|
|
368089
|
-
version: "0.3.
|
|
368089
|
+
version: "0.3.59",
|
|
368090
368090
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368091
368091
|
main: "./dist/index.js",
|
|
368092
368092
|
types: "dist/index.d.ts",
|
|
@@ -394454,6 +394454,48 @@ function createContextInjectorMessagesTransformHook(collector) {
|
|
|
394454
394454
|
}
|
|
394455
394455
|
};
|
|
394456
394456
|
}
|
|
394457
|
+
// packages/rgpd-compliance-core/src/consent.ts
|
|
394458
|
+
import * as nodeFs from "fs";
|
|
394459
|
+
import * as nodePath from "path";
|
|
394460
|
+
import * as nodeOs from "os";
|
|
394461
|
+
var DEFAULT_CONSENT_PATH = nodePath.join(nodeOs.homedir(), ".matrixos", "consent.json");
|
|
394462
|
+
function createDefaultFs() {
|
|
394463
|
+
return {
|
|
394464
|
+
existsSync: (p) => nodeFs.existsSync(p),
|
|
394465
|
+
readFileSync: (p) => nodeFs.readFileSync(p, "utf-8"),
|
|
394466
|
+
writeFileSync: (p, content) => nodeFs.writeFileSync(p, content, "utf-8"),
|
|
394467
|
+
mkdirSync: (p, opts) => nodeFs.mkdirSync(p, opts)
|
|
394468
|
+
};
|
|
394469
|
+
}
|
|
394470
|
+
function getDefaultConsent() {
|
|
394471
|
+
return {
|
|
394472
|
+
memoryRecording: true,
|
|
394473
|
+
gatewayLogging: false,
|
|
394474
|
+
telemetry: false,
|
|
394475
|
+
consentVersion: 1,
|
|
394476
|
+
updatedAt: new Date().toISOString()
|
|
394477
|
+
};
|
|
394478
|
+
}
|
|
394479
|
+
function loadConsent(path18, fs22) {
|
|
394480
|
+
const fsPort = fs22 ?? createDefaultFs();
|
|
394481
|
+
const consentPath = path18 ?? DEFAULT_CONSENT_PATH;
|
|
394482
|
+
if (!fsPort.existsSync(consentPath)) {
|
|
394483
|
+
return getDefaultConsent();
|
|
394484
|
+
}
|
|
394485
|
+
try {
|
|
394486
|
+
const raw = fsPort.readFileSync(consentPath);
|
|
394487
|
+
const parsed = JSON.parse(raw);
|
|
394488
|
+
return {
|
|
394489
|
+
memoryRecording: parsed.memoryRecording ?? false,
|
|
394490
|
+
gatewayLogging: parsed.gatewayLogging ?? false,
|
|
394491
|
+
telemetry: parsed.telemetry ?? false,
|
|
394492
|
+
consentVersion: parsed.consentVersion ?? 1,
|
|
394493
|
+
updatedAt: parsed.updatedAt ?? new Date().toISOString()
|
|
394494
|
+
};
|
|
394495
|
+
} catch {
|
|
394496
|
+
return getDefaultConsent();
|
|
394497
|
+
}
|
|
394498
|
+
}
|
|
394457
394499
|
// packages/omo-opencode/src/hooks/session-memory-loader/index.ts
|
|
394458
394500
|
var HOOK_NAME12 = "session-memory-loader";
|
|
394459
394501
|
function readMemory(limit = 20) {
|
|
@@ -394483,6 +394525,9 @@ function createSessionMemoryLoaderHook(_ctx) {
|
|
|
394483
394525
|
handler: (input) => {
|
|
394484
394526
|
if (!input.sessionID)
|
|
394485
394527
|
return;
|
|
394528
|
+
const consent = loadConsent();
|
|
394529
|
+
if (!consent.memoryRecording)
|
|
394530
|
+
return;
|
|
394486
394531
|
const rows = readMemory();
|
|
394487
394532
|
if (rows.length === 0)
|
|
394488
394533
|
return;
|
|
@@ -394515,19 +394560,19 @@ tool.schema = z3;
|
|
|
394515
394560
|
|
|
394516
394561
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
394517
394562
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
394518
|
-
import { existsSync as
|
|
394519
|
-
import { dirname as
|
|
394563
|
+
import { existsSync as existsSync93 } from "fs";
|
|
394564
|
+
import { dirname as dirname34, join as join106 } from "path";
|
|
394520
394565
|
|
|
394521
394566
|
// packages/omo-opencode/src/tools/grep/downloader.ts
|
|
394522
|
-
import { existsSync as
|
|
394523
|
-
import { join as
|
|
394567
|
+
import { existsSync as existsSync92, readdirSync as readdirSync22 } from "fs";
|
|
394568
|
+
import { join as join105 } from "path";
|
|
394524
394569
|
init_plugin_identity();
|
|
394525
394570
|
function findFileRecursive(dir, filename) {
|
|
394526
394571
|
try {
|
|
394527
394572
|
const entries = readdirSync22(dir, { withFileTypes: true, recursive: true });
|
|
394528
394573
|
for (const entry of entries) {
|
|
394529
394574
|
if (entry.isFile() && entry.name === filename) {
|
|
394530
|
-
return
|
|
394575
|
+
return join105(entry.parentPath ?? dir, entry.name);
|
|
394531
394576
|
}
|
|
394532
394577
|
}
|
|
394533
394578
|
} catch (error) {
|
|
@@ -394551,11 +394596,11 @@ function getPlatformKey() {
|
|
|
394551
394596
|
}
|
|
394552
394597
|
function getInstallDir() {
|
|
394553
394598
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
394554
|
-
return
|
|
394599
|
+
return join105(homeDir, ".cache", CACHE_DIR_NAME, "bin");
|
|
394555
394600
|
}
|
|
394556
394601
|
function getRgPath() {
|
|
394557
394602
|
const isWindows2 = process.platform === "win32";
|
|
394558
|
-
return
|
|
394603
|
+
return join105(getInstallDir(), isWindows2 ? "rg.exe" : "rg");
|
|
394559
394604
|
}
|
|
394560
394605
|
async function extractTarGz3(archivePath, destDir) {
|
|
394561
394606
|
const platformKey2 = getPlatformKey();
|
|
@@ -394572,7 +394617,7 @@ async function extractZip2(archivePath, destDir) {
|
|
|
394572
394617
|
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
394573
394618
|
const foundPath = findFileRecursive(destDir, binaryName);
|
|
394574
394619
|
if (foundPath) {
|
|
394575
|
-
const destPath =
|
|
394620
|
+
const destPath = join105(destDir, binaryName);
|
|
394576
394621
|
if (foundPath !== destPath) {
|
|
394577
394622
|
const { renameSync: renameSync7 } = await import("fs");
|
|
394578
394623
|
renameSync7(foundPath, destPath);
|
|
@@ -394587,13 +394632,13 @@ async function downloadAndInstallRipgrep() {
|
|
|
394587
394632
|
}
|
|
394588
394633
|
const installDir = getInstallDir();
|
|
394589
394634
|
const rgPath = getRgPath();
|
|
394590
|
-
if (
|
|
394635
|
+
if (existsSync92(rgPath)) {
|
|
394591
394636
|
return rgPath;
|
|
394592
394637
|
}
|
|
394593
394638
|
ensureCacheDir(installDir);
|
|
394594
394639
|
const filename = `ripgrep-${RG_VERSION}-${config.platform}.${config.extension}`;
|
|
394595
394640
|
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
|
|
394596
|
-
const archivePath =
|
|
394641
|
+
const archivePath = join105(installDir, filename);
|
|
394597
394642
|
try {
|
|
394598
394643
|
await downloadArchive(url, archivePath);
|
|
394599
394644
|
if (config.extension === "tar.gz") {
|
|
@@ -394602,7 +394647,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
394602
394647
|
await extractZip2(archivePath, installDir);
|
|
394603
394648
|
}
|
|
394604
394649
|
ensureExecutable(rgPath);
|
|
394605
|
-
if (!
|
|
394650
|
+
if (!existsSync92(rgPath)) {
|
|
394606
394651
|
throw new Error("ripgrep binary not found after extraction");
|
|
394607
394652
|
}
|
|
394608
394653
|
return rgPath;
|
|
@@ -394618,7 +394663,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
394618
394663
|
}
|
|
394619
394664
|
function getInstalledRipgrepPath() {
|
|
394620
394665
|
const rgPath = getRgPath();
|
|
394621
|
-
return
|
|
394666
|
+
return existsSync92(rgPath) ? rgPath : null;
|
|
394622
394667
|
}
|
|
394623
394668
|
|
|
394624
394669
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
@@ -394654,19 +394699,19 @@ function findExecutable(name) {
|
|
|
394654
394699
|
}
|
|
394655
394700
|
function getOpenCodeBundledRg() {
|
|
394656
394701
|
const execPath = process.execPath;
|
|
394657
|
-
const execDir =
|
|
394702
|
+
const execDir = dirname34(execPath);
|
|
394658
394703
|
const isWindows2 = process.platform === "win32";
|
|
394659
394704
|
const rgName = isWindows2 ? "rg.exe" : "rg";
|
|
394660
394705
|
const candidates = [
|
|
394661
|
-
|
|
394662
|
-
|
|
394663
|
-
|
|
394664
|
-
|
|
394665
|
-
|
|
394666
|
-
|
|
394706
|
+
join106(getOpenCodeCacheDir(), "bin", rgName),
|
|
394707
|
+
join106(getDataDir(), "opencode", "bin", rgName),
|
|
394708
|
+
join106(execDir, rgName),
|
|
394709
|
+
join106(execDir, "bin", rgName),
|
|
394710
|
+
join106(execDir, "..", "bin", rgName),
|
|
394711
|
+
join106(execDir, "..", "libexec", rgName)
|
|
394667
394712
|
];
|
|
394668
394713
|
for (const candidate of candidates) {
|
|
394669
|
-
if (
|
|
394714
|
+
if (existsSync93(candidate)) {
|
|
394670
394715
|
return candidate;
|
|
394671
394716
|
}
|
|
394672
394717
|
}
|
|
@@ -395318,7 +395363,7 @@ Use this when a task matches an available skill's or command's description.
|
|
|
395318
395363
|
- The tool will return detailed instructions with your context applied.
|
|
395319
395364
|
`;
|
|
395320
395365
|
// packages/omo-opencode/src/tools/skill/tools.ts
|
|
395321
|
-
import { dirname as
|
|
395366
|
+
import { dirname as dirname36 } from "path";
|
|
395322
395367
|
// packages/omo-opencode/src/tools/skill/session-skill-cache.ts
|
|
395323
395368
|
var seenSessionIDs = new Set;
|
|
395324
395369
|
function shouldInvalidateSkillCacheForSession(sessionID) {
|
|
@@ -395329,7 +395374,7 @@ function shouldInvalidateSkillCacheForSession(sessionID) {
|
|
|
395329
395374
|
return true;
|
|
395330
395375
|
}
|
|
395331
395376
|
// packages/omo-opencode/src/tools/slashcommand/command-output-formatter.ts
|
|
395332
|
-
import { dirname as
|
|
395377
|
+
import { dirname as dirname35 } from "path";
|
|
395333
395378
|
async function formatLoadedCommand(command, userMessage) {
|
|
395334
395379
|
const sections = [];
|
|
395335
395380
|
sections.push(`# /${command.name} Command
|
|
@@ -395368,7 +395413,7 @@ async function formatLoadedCommand(command, userMessage) {
|
|
|
395368
395413
|
if (!content && command.lazyContentLoader) {
|
|
395369
395414
|
content = await command.lazyContentLoader.load();
|
|
395370
395415
|
}
|
|
395371
|
-
const commandDir = command.path ?
|
|
395416
|
+
const commandDir = command.path ? dirname35(command.path) : process.cwd();
|
|
395372
395417
|
const withFileReferences = await resolveFileReferencesInText(content, commandDir);
|
|
395373
395418
|
const resolvedContent = await resolveCommandsInText(withFileReferences);
|
|
395374
395419
|
let finalContent = resolvedContent.trim();
|
|
@@ -395876,7 +395921,7 @@ function createSkillTool(options) {
|
|
|
395876
395921
|
if (matchedSkill.name === "git-master") {
|
|
395877
395922
|
body = injectGitMasterConfig(body, options.gitMasterConfig);
|
|
395878
395923
|
}
|
|
395879
|
-
const dir = matchedSkill.path ?
|
|
395924
|
+
const dir = matchedSkill.path ? dirname36(matchedSkill.path) : matchedSkill.resolvedPath || process.cwd();
|
|
395880
395925
|
const output = [
|
|
395881
395926
|
`## Skill: ${matchedSkill.name}`,
|
|
395882
395927
|
"",
|
|
@@ -395916,9 +395961,9 @@ function createSkillTool(options) {
|
|
|
395916
395961
|
}
|
|
395917
395962
|
var skill = createSkillTool({ directory: process.cwd() });
|
|
395918
395963
|
// packages/omo-opencode/src/tools/session-manager/constants.ts
|
|
395919
|
-
import { join as
|
|
395920
|
-
var TODO_DIR2 =
|
|
395921
|
-
var TRANSCRIPT_DIR2 =
|
|
395964
|
+
import { join as join107 } from "path";
|
|
395965
|
+
var TODO_DIR2 = join107(getClaudeConfigDir(), "todos");
|
|
395966
|
+
var TRANSCRIPT_DIR2 = join107(getClaudeConfigDir(), "transcripts");
|
|
395922
395967
|
var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
|
|
395923
395968
|
|
|
395924
395969
|
Returns a list of available session IDs with metadata including message count, date range, and agents used.
|
|
@@ -395991,16 +396036,16 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
395991
396036
|
Has Transcript: Yes (234 entries)`;
|
|
395992
396037
|
|
|
395993
396038
|
// packages/omo-opencode/src/tools/session-manager/file-storage.ts
|
|
395994
|
-
import { existsSync as
|
|
396039
|
+
import { existsSync as existsSync94 } from "fs";
|
|
395995
396040
|
import { readdir as readdir6, readFile as readFile9 } from "fs/promises";
|
|
395996
|
-
import { join as
|
|
396041
|
+
import { join as join108 } from "path";
|
|
395997
396042
|
function ignoreFileStorageError(error) {
|
|
395998
396043
|
if (error instanceof Error)
|
|
395999
396044
|
return;
|
|
396000
396045
|
throw error;
|
|
396001
396046
|
}
|
|
396002
396047
|
async function getFileMainSessions(directory) {
|
|
396003
|
-
if (!
|
|
396048
|
+
if (!existsSync94(SESSION_STORAGE))
|
|
396004
396049
|
return [];
|
|
396005
396050
|
const sessions = [];
|
|
396006
396051
|
try {
|
|
@@ -396008,13 +396053,13 @@ async function getFileMainSessions(directory) {
|
|
|
396008
396053
|
for (const projectDir of projectDirs) {
|
|
396009
396054
|
if (!projectDir.isDirectory())
|
|
396010
396055
|
continue;
|
|
396011
|
-
const projectPath =
|
|
396056
|
+
const projectPath = join108(SESSION_STORAGE, projectDir.name);
|
|
396012
396057
|
const sessionFiles = await readdir6(projectPath);
|
|
396013
396058
|
for (const file2 of sessionFiles) {
|
|
396014
396059
|
if (!file2.endsWith(".json"))
|
|
396015
396060
|
continue;
|
|
396016
396061
|
try {
|
|
396017
|
-
const content = await readFile9(
|
|
396062
|
+
const content = await readFile9(join108(projectPath, file2), "utf-8");
|
|
396018
396063
|
const meta = JSON.parse(content);
|
|
396019
396064
|
if (meta.parentID)
|
|
396020
396065
|
continue;
|
|
@@ -396034,7 +396079,7 @@ async function getFileMainSessions(directory) {
|
|
|
396034
396079
|
return sessions.sort((a, b) => b.time.updated - a.time.updated);
|
|
396035
396080
|
}
|
|
396036
396081
|
async function getFileAllSessions() {
|
|
396037
|
-
if (!
|
|
396082
|
+
if (!existsSync94(MESSAGE_STORAGE))
|
|
396038
396083
|
return [];
|
|
396039
396084
|
const sessions = [];
|
|
396040
396085
|
async function scanDirectory(dir) {
|
|
@@ -396043,7 +396088,7 @@ async function getFileAllSessions() {
|
|
|
396043
396088
|
for (const entry of entries) {
|
|
396044
396089
|
if (!entry.isDirectory())
|
|
396045
396090
|
continue;
|
|
396046
|
-
const sessionPath =
|
|
396091
|
+
const sessionPath = join108(dir, entry.name);
|
|
396047
396092
|
const files = await readdir6(sessionPath);
|
|
396048
396093
|
if (files.some((file2) => file2.endsWith(".json"))) {
|
|
396049
396094
|
sessions.push(entry.name);
|
|
@@ -396064,7 +396109,7 @@ async function fileSessionExists(sessionID) {
|
|
|
396064
396109
|
}
|
|
396065
396110
|
async function getFileSessionMessages(sessionID) {
|
|
396066
396111
|
const messageDir = getMessageDir(sessionID);
|
|
396067
|
-
if (!messageDir || !
|
|
396112
|
+
if (!messageDir || !existsSync94(messageDir))
|
|
396068
396113
|
return [];
|
|
396069
396114
|
const messages = [];
|
|
396070
396115
|
try {
|
|
@@ -396073,7 +396118,7 @@ async function getFileSessionMessages(sessionID) {
|
|
|
396073
396118
|
if (!file2.endsWith(".json"))
|
|
396074
396119
|
continue;
|
|
396075
396120
|
try {
|
|
396076
|
-
const content = await readFile9(
|
|
396121
|
+
const content = await readFile9(join108(messageDir, file2), "utf-8");
|
|
396077
396122
|
const meta = JSON.parse(content);
|
|
396078
396123
|
const parts = await readParts2(meta.id);
|
|
396079
396124
|
messages.push({
|
|
@@ -396101,8 +396146,8 @@ async function getFileSessionMessages(sessionID) {
|
|
|
396101
396146
|
});
|
|
396102
396147
|
}
|
|
396103
396148
|
async function readParts2(messageID) {
|
|
396104
|
-
const partDir =
|
|
396105
|
-
if (!
|
|
396149
|
+
const partDir = join108(PART_STORAGE, messageID);
|
|
396150
|
+
if (!existsSync94(partDir))
|
|
396106
396151
|
return [];
|
|
396107
396152
|
const parts = [];
|
|
396108
396153
|
try {
|
|
@@ -396111,7 +396156,7 @@ async function readParts2(messageID) {
|
|
|
396111
396156
|
if (!file2.endsWith(".json"))
|
|
396112
396157
|
continue;
|
|
396113
396158
|
try {
|
|
396114
|
-
const content = await readFile9(
|
|
396159
|
+
const content = await readFile9(join108(partDir, file2), "utf-8");
|
|
396115
396160
|
parts.push(JSON.parse(content));
|
|
396116
396161
|
} catch (error) {
|
|
396117
396162
|
ignoreFileStorageError(error);
|
|
@@ -396125,14 +396170,14 @@ async function readParts2(messageID) {
|
|
|
396125
396170
|
return parts.sort((a, b) => a.id.localeCompare(b.id));
|
|
396126
396171
|
}
|
|
396127
396172
|
async function getFileSessionTodos(sessionID) {
|
|
396128
|
-
if (!
|
|
396173
|
+
if (!existsSync94(TODO_DIR2))
|
|
396129
396174
|
return [];
|
|
396130
396175
|
try {
|
|
396131
396176
|
const allFiles = await readdir6(TODO_DIR2);
|
|
396132
396177
|
const todoFiles = allFiles.filter((file2) => file2 === `${sessionID}.json`);
|
|
396133
396178
|
for (const file2 of todoFiles) {
|
|
396134
396179
|
try {
|
|
396135
|
-
const content = await readFile9(
|
|
396180
|
+
const content = await readFile9(join108(TODO_DIR2, file2), "utf-8");
|
|
396136
396181
|
const data = JSON.parse(content);
|
|
396137
396182
|
if (!Array.isArray(data))
|
|
396138
396183
|
continue;
|
|
@@ -396154,10 +396199,10 @@ async function getFileSessionTodos(sessionID) {
|
|
|
396154
396199
|
return [];
|
|
396155
396200
|
}
|
|
396156
396201
|
async function getFileSessionTranscript(sessionID) {
|
|
396157
|
-
if (!
|
|
396202
|
+
if (!existsSync94(TRANSCRIPT_DIR2))
|
|
396158
396203
|
return 0;
|
|
396159
|
-
const transcriptFile =
|
|
396160
|
-
if (!
|
|
396204
|
+
const transcriptFile = join108(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
396205
|
+
if (!existsSync94(transcriptFile))
|
|
396161
396206
|
return 0;
|
|
396162
396207
|
try {
|
|
396163
396208
|
const content = await readFile9(transcriptFile, "utf-8");
|
|
@@ -398200,23 +398245,23 @@ Pass \`session_id=<id>\` to continue previous agent with full context. Nested su
|
|
|
398200
398245
|
// packages/omo-opencode/src/tools/call-omo-agent/tools.ts
|
|
398201
398246
|
init_plugin_identity();
|
|
398202
398247
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
398203
|
-
import { existsSync as
|
|
398204
|
-
import { join as
|
|
398248
|
+
import { existsSync as existsSync99, readdirSync as readdirSync23 } from "fs";
|
|
398249
|
+
import { join as join114 } from "path";
|
|
398205
398250
|
|
|
398206
398251
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
398207
|
-
import { homedir as
|
|
398208
|
-
import { join as
|
|
398252
|
+
import { homedir as homedir30 } from "os";
|
|
398253
|
+
import { join as join109 } from "path";
|
|
398209
398254
|
function getClaudeConfigDir3() {
|
|
398210
398255
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
398211
398256
|
if (envConfigDir) {
|
|
398212
398257
|
return envConfigDir;
|
|
398213
398258
|
}
|
|
398214
|
-
return
|
|
398259
|
+
return join109(process.env.HOME || process.env.USERPROFILE || homedir30(), ".claude");
|
|
398215
398260
|
}
|
|
398216
398261
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
398217
|
-
import { existsSync as
|
|
398218
|
-
import { homedir as
|
|
398219
|
-
import { join as
|
|
398262
|
+
import { existsSync as existsSync95, realpathSync as realpathSync16 } from "fs";
|
|
398263
|
+
import { homedir as homedir31 } from "os";
|
|
398264
|
+
import { join as join110, posix as posix6, resolve as resolve34, win32 as win329 } from "path";
|
|
398220
398265
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
398221
398266
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
398222
398267
|
function isDevBuild3(version) {
|
|
@@ -398228,15 +398273,15 @@ function getTauriConfigDir3(identifier) {
|
|
|
398228
398273
|
const platform3 = process.platform;
|
|
398229
398274
|
switch (platform3) {
|
|
398230
398275
|
case "darwin":
|
|
398231
|
-
return
|
|
398276
|
+
return join110(homedir31(), "Library", "Application Support", identifier);
|
|
398232
398277
|
case "win32": {
|
|
398233
|
-
const appData = process.env.APPDATA ||
|
|
398278
|
+
const appData = process.env.APPDATA || join110(homedir31(), "AppData", "Roaming");
|
|
398234
398279
|
return win329.join(appData, identifier);
|
|
398235
398280
|
}
|
|
398236
398281
|
case "linux":
|
|
398237
398282
|
default: {
|
|
398238
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
398239
|
-
return
|
|
398283
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join110(homedir31(), ".config");
|
|
398284
|
+
return join110(xdgConfig, identifier);
|
|
398240
398285
|
}
|
|
398241
398286
|
}
|
|
398242
398287
|
}
|
|
@@ -398245,7 +398290,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
398245
398290
|
return posix6.normalize(pathValue);
|
|
398246
398291
|
}
|
|
398247
398292
|
const resolvedPath = resolve34(pathValue);
|
|
398248
|
-
if (!
|
|
398293
|
+
if (!existsSync95(resolvedPath))
|
|
398249
398294
|
return resolvedPath;
|
|
398250
398295
|
try {
|
|
398251
398296
|
return realpathSync16(resolvedPath);
|
|
@@ -398279,8 +398324,8 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
398279
398324
|
function getCliDefaultConfigDir3() {
|
|
398280
398325
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
398281
398326
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
398282
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix6.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
398283
|
-
const configDir = isWslEnvironment3() ? posix6.join(xdgConfig, "opencode") :
|
|
398327
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix6.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join110(homedir31(), ".config");
|
|
398328
|
+
const configDir = isWslEnvironment3() ? posix6.join(xdgConfig, "opencode") : join110(xdgConfig, "opencode");
|
|
398284
398329
|
return resolveConfigPath3(configDir);
|
|
398285
398330
|
}
|
|
398286
398331
|
function getCliCustomConfigDir3() {
|
|
@@ -398313,9 +398358,9 @@ function getOpenCodeConfigDir3(options) {
|
|
|
398313
398358
|
const tauriDir = process.platform === "win32" ? win329.isAbsolute(tauriDirBase) ? win329.normalize(tauriDirBase) : win329.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
398314
398359
|
if (checkExisting) {
|
|
398315
398360
|
const legacyDir = getCliConfigDir3();
|
|
398316
|
-
const legacyConfig =
|
|
398317
|
-
const legacyConfigC =
|
|
398318
|
-
if (
|
|
398361
|
+
const legacyConfig = join110(legacyDir, "opencode.json");
|
|
398362
|
+
const legacyConfigC = join110(legacyDir, "opencode.jsonc");
|
|
398363
|
+
if (existsSync95(legacyConfig) || existsSync95(legacyConfigC)) {
|
|
398319
398364
|
return legacyDir;
|
|
398320
398365
|
}
|
|
398321
398366
|
}
|
|
@@ -398324,11 +398369,11 @@ function getOpenCodeConfigDir3(options) {
|
|
|
398324
398369
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
398325
398370
|
init_src();
|
|
398326
398371
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
398327
|
-
import { homedir as
|
|
398328
|
-
import { isAbsolute as isAbsolute17, join as
|
|
398372
|
+
import { homedir as homedir32 } from "os";
|
|
398373
|
+
import { isAbsolute as isAbsolute17, join as join111, resolve as resolve35 } from "path";
|
|
398329
398374
|
function resolveAgentDefinitionPaths2(paths, baseDir, containmentDir) {
|
|
398330
398375
|
return paths.flatMap((p) => {
|
|
398331
|
-
const expanded = p.startsWith("~/") ?
|
|
398376
|
+
const expanded = p.startsWith("~/") ? join111(homedir32(), p.slice(2)) : p;
|
|
398332
398377
|
const resolved = isAbsolute17(expanded) ? expanded : resolve35(baseDir, expanded);
|
|
398333
398378
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
398334
398379
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -398356,13 +398401,13 @@ var EXCLUDED_DIR_NAMES2 = [
|
|
|
398356
398401
|
];
|
|
398357
398402
|
var EXCLUDED_DIRS3 = Object.freeze(new Set(EXCLUDED_DIR_NAMES2));
|
|
398358
398403
|
// packages/claude-code-compat-core/src/shared/opencode-command-dirs.ts
|
|
398359
|
-
import { basename as basename18, dirname as
|
|
398404
|
+
import { basename as basename18, dirname as dirname37, join as join112 } from "path";
|
|
398360
398405
|
function getParentOpencodeConfigDir3(configDir) {
|
|
398361
|
-
const parentDir =
|
|
398406
|
+
const parentDir = dirname37(configDir);
|
|
398362
398407
|
if (basename18(parentDir) !== "profiles") {
|
|
398363
398408
|
return null;
|
|
398364
398409
|
}
|
|
398365
|
-
return
|
|
398410
|
+
return dirname37(parentDir);
|
|
398366
398411
|
}
|
|
398367
398412
|
function getOpenCodeCommandDirs2(options) {
|
|
398368
398413
|
const configDirs = getOpenCodeConfigDirs3(options);
|
|
@@ -398370,21 +398415,21 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
398370
398415
|
...configDirs.flatMap((configDir) => {
|
|
398371
398416
|
const parentConfigDir = getParentOpencodeConfigDir3(configDir);
|
|
398372
398417
|
return [
|
|
398373
|
-
|
|
398374
|
-
|
|
398375
|
-
...parentConfigDir ? [
|
|
398418
|
+
join112(configDir, "commands"),
|
|
398419
|
+
join112(configDir, "command"),
|
|
398420
|
+
...parentConfigDir ? [join112(parentConfigDir, "commands"), join112(parentConfigDir, "command")] : []
|
|
398376
398421
|
];
|
|
398377
398422
|
})
|
|
398378
398423
|
]));
|
|
398379
398424
|
}
|
|
398380
398425
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
398381
398426
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
398382
|
-
import { existsSync as
|
|
398383
|
-
import { dirname as
|
|
398427
|
+
import { existsSync as existsSync96, realpathSync as realpathSync17 } from "fs";
|
|
398428
|
+
import { dirname as dirname38, join as join113, resolve as resolve36, win32 as win3210 } from "path";
|
|
398384
398429
|
var worktreePathCache3 = new Map;
|
|
398385
398430
|
function normalizePath6(path19) {
|
|
398386
398431
|
const resolvedPath = process.platform !== "win32" && win3210.isAbsolute(path19) ? path19 : resolve36(path19);
|
|
398387
|
-
if (!
|
|
398432
|
+
if (!existsSync96(resolvedPath)) {
|
|
398388
398433
|
return resolvedPath;
|
|
398389
398434
|
}
|
|
398390
398435
|
try {
|
|
@@ -398439,10 +398484,10 @@ function detectWorktreePath4(directory) {
|
|
|
398439
398484
|
function findGitMarkerAncestor(directory) {
|
|
398440
398485
|
let currentDirectory = normalizePath6(directory);
|
|
398441
398486
|
while (true) {
|
|
398442
|
-
if (
|
|
398487
|
+
if (existsSync96(join113(currentDirectory, ".git"))) {
|
|
398443
398488
|
return currentDirectory;
|
|
398444
398489
|
}
|
|
398445
|
-
const parentDirectory =
|
|
398490
|
+
const parentDirectory = dirname38(currentDirectory);
|
|
398446
398491
|
if (parentDirectory === currentDirectory) {
|
|
398447
398492
|
return;
|
|
398448
398493
|
}
|
|
@@ -398457,8 +398502,8 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
398457
398502
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey3(resolvedStopDirectory) : undefined;
|
|
398458
398503
|
while (true) {
|
|
398459
398504
|
for (const targetPath of targetPaths) {
|
|
398460
|
-
const candidateDirectory =
|
|
398461
|
-
if (!
|
|
398505
|
+
const candidateDirectory = join113(currentDirectory, ...targetPath);
|
|
398506
|
+
if (!existsSync96(candidateDirectory)) {
|
|
398462
398507
|
continue;
|
|
398463
398508
|
}
|
|
398464
398509
|
const normalizedCandidateDirectory = normalizePath6(candidateDirectory);
|
|
@@ -398472,7 +398517,7 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
398472
398517
|
if (stopDirectoryKey === pathKey3(currentDirectory)) {
|
|
398473
398518
|
return directories;
|
|
398474
398519
|
}
|
|
398475
|
-
const parentDirectory =
|
|
398520
|
+
const parentDirectory = dirname38(currentDirectory);
|
|
398476
398521
|
if (parentDirectory === currentDirectory) {
|
|
398477
398522
|
return directories;
|
|
398478
398523
|
}
|
|
@@ -398487,17 +398532,17 @@ function findProjectOpencodeCommandDirs2(startDirectory, stopDirectory) {
|
|
|
398487
398532
|
], detectedStopDirectory);
|
|
398488
398533
|
}
|
|
398489
398534
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
398490
|
-
import { existsSync as
|
|
398535
|
+
import { existsSync as existsSync98, readFileSync as readFileSync64 } from "fs";
|
|
398491
398536
|
import { basename as basename19, extname as extname4 } from "path";
|
|
398492
398537
|
|
|
398493
398538
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/json-agent-loader.ts
|
|
398494
|
-
import { existsSync as
|
|
398539
|
+
import { existsSync as existsSync97, readFileSync as readFileSync63 } from "fs";
|
|
398495
398540
|
function parseJsonAgentFile(filePath, scope) {
|
|
398496
398541
|
try {
|
|
398497
|
-
if (!
|
|
398542
|
+
if (!existsSync97(filePath)) {
|
|
398498
398543
|
return null;
|
|
398499
398544
|
}
|
|
398500
|
-
const content =
|
|
398545
|
+
const content = readFileSync63(filePath, "utf-8");
|
|
398501
398546
|
const { data } = parseJsoncSafe(content);
|
|
398502
398547
|
if (!data) {
|
|
398503
398548
|
return null;
|
|
@@ -398535,10 +398580,10 @@ function parseJsonAgentFile(filePath, scope) {
|
|
|
398535
398580
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
398536
398581
|
function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
398537
398582
|
try {
|
|
398538
|
-
if (!
|
|
398583
|
+
if (!existsSync98(filePath)) {
|
|
398539
398584
|
return null;
|
|
398540
398585
|
}
|
|
398541
|
-
const content =
|
|
398586
|
+
const content = readFileSync64(filePath, "utf-8");
|
|
398542
398587
|
const { data, body } = parseFrontmatter(content);
|
|
398543
398588
|
const fileName = basename19(filePath);
|
|
398544
398589
|
const agentName = fileName.replace(/\.md$/i, "");
|
|
@@ -398572,7 +398617,7 @@ function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
|
398572
398617
|
function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
398573
398618
|
const result = Object.create(null);
|
|
398574
398619
|
for (const filePath of paths) {
|
|
398575
|
-
if (!
|
|
398620
|
+
if (!existsSync98(filePath)) {
|
|
398576
398621
|
log4(`[agent-definitions-loader] File not found, skipping: ${filePath}`);
|
|
398577
398622
|
continue;
|
|
398578
398623
|
}
|
|
@@ -398597,7 +398642,7 @@ function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
|
398597
398642
|
|
|
398598
398643
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
398599
398644
|
function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
398600
|
-
if (!
|
|
398645
|
+
if (!existsSync99(agentsDir)) {
|
|
398601
398646
|
return [];
|
|
398602
398647
|
}
|
|
398603
398648
|
const entries = readdirSync23(agentsDir, { withFileTypes: true });
|
|
@@ -398605,7 +398650,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
398605
398650
|
for (const entry of entries) {
|
|
398606
398651
|
if (!isMarkdownFile(entry))
|
|
398607
398652
|
continue;
|
|
398608
|
-
const agentPath =
|
|
398653
|
+
const agentPath = join114(agentsDir, entry.name);
|
|
398609
398654
|
const agent = parseMarkdownAgentFile(agentPath, scope, anthropicProvider);
|
|
398610
398655
|
if (agent) {
|
|
398611
398656
|
agents.push(agent);
|
|
@@ -398614,7 +398659,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
398614
398659
|
return agents;
|
|
398615
398660
|
}
|
|
398616
398661
|
function loadUserAgents(anthropicProvider) {
|
|
398617
|
-
const userAgentsDir =
|
|
398662
|
+
const userAgentsDir = join114(getClaudeConfigDir3(), "agents");
|
|
398618
398663
|
const agents = loadAgentsFromDir(userAgentsDir, "user", anthropicProvider);
|
|
398619
398664
|
const result = Object.create(null);
|
|
398620
398665
|
for (const agent of agents) {
|
|
@@ -398623,7 +398668,7 @@ function loadUserAgents(anthropicProvider) {
|
|
|
398623
398668
|
return result;
|
|
398624
398669
|
}
|
|
398625
398670
|
function loadProjectAgents(directory, anthropicProvider) {
|
|
398626
|
-
const projectAgentsDir =
|
|
398671
|
+
const projectAgentsDir = join114(directory ?? process.cwd(), ".claude", "agents");
|
|
398627
398672
|
const agents = loadAgentsFromDir(projectAgentsDir, "project", anthropicProvider);
|
|
398628
398673
|
const result = Object.create(null);
|
|
398629
398674
|
for (const agent of agents) {
|
|
@@ -398635,7 +398680,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
398635
398680
|
const result = Object.create(null);
|
|
398636
398681
|
const configDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
398637
398682
|
for (const configDir of configDirs) {
|
|
398638
|
-
const opencodeAgentsDir =
|
|
398683
|
+
const opencodeAgentsDir = join114(configDir, "agents");
|
|
398639
398684
|
const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
|
|
398640
398685
|
for (const agent of agents) {
|
|
398641
398686
|
if (!(agent.name in result)) {
|
|
@@ -398646,7 +398691,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
398646
398691
|
return result;
|
|
398647
398692
|
}
|
|
398648
398693
|
function loadOpencodeProjectAgents(directory) {
|
|
398649
|
-
const opencodeProjectDir =
|
|
398694
|
+
const opencodeProjectDir = join114(directory ?? process.cwd(), ".opencode", "agents");
|
|
398650
398695
|
const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
|
|
398651
398696
|
const result = Object.create(null);
|
|
398652
398697
|
for (const agent of agents) {
|
|
@@ -399460,15 +399505,15 @@ function validateArgs(args) {
|
|
|
399460
399505
|
}
|
|
399461
399506
|
|
|
399462
399507
|
// packages/omo-opencode/src/tools/look-at/look-at-input-preparer.ts
|
|
399463
|
-
import { readFileSync as
|
|
399508
|
+
import { readFileSync as readFileSync67 } from "fs";
|
|
399464
399509
|
import { basename as basename20 } from "path";
|
|
399465
399510
|
import { pathToFileURL } from "url";
|
|
399466
399511
|
|
|
399467
399512
|
// packages/omo-opencode/src/tools/look-at/image-converter.ts
|
|
399468
399513
|
import * as childProcess2 from "child_process";
|
|
399469
|
-
import { existsSync as
|
|
399514
|
+
import { existsSync as existsSync101, mkdtempSync, readFileSync as readFileSync66, rmSync as rmSync5, unlinkSync as unlinkSync14, writeFileSync as writeFileSync20 } from "fs";
|
|
399470
399515
|
import { tmpdir as tmpdir7 } from "os";
|
|
399471
|
-
import { dirname as
|
|
399516
|
+
import { dirname as dirname40, join as join116 } from "path";
|
|
399472
399517
|
var SUPPORTED_FORMATS = new Set([
|
|
399473
399518
|
"image/jpeg",
|
|
399474
399519
|
"image/png",
|
|
@@ -399498,7 +399543,7 @@ var UNSUPPORTED_FORMATS = new Set([
|
|
|
399498
399543
|
var CONVERSION_TIMEOUT_MS = 30000;
|
|
399499
399544
|
function cleanupTemporaryFileAfterFailure(filePath) {
|
|
399500
399545
|
try {
|
|
399501
|
-
if (
|
|
399546
|
+
if (existsSync101(filePath)) {
|
|
399502
399547
|
unlinkSync14(filePath);
|
|
399503
399548
|
}
|
|
399504
399549
|
} catch (cleanupError) {
|
|
@@ -399516,11 +399561,11 @@ function needsConversion(mimeType2) {
|
|
|
399516
399561
|
return mimeType2.startsWith("image/");
|
|
399517
399562
|
}
|
|
399518
399563
|
function convertImageToJpeg(inputPath, mimeType2) {
|
|
399519
|
-
if (!
|
|
399564
|
+
if (!existsSync101(inputPath)) {
|
|
399520
399565
|
throw new Error(`File not found: ${inputPath}`);
|
|
399521
399566
|
}
|
|
399522
|
-
const tempDir = mkdtempSync(
|
|
399523
|
-
const outputPath =
|
|
399567
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-img-"));
|
|
399568
|
+
const outputPath = join116(tempDir, "converted.jpg");
|
|
399524
399569
|
log2(`[image-converter] Converting ${mimeType2} to JPEG: ${inputPath}`);
|
|
399525
399570
|
try {
|
|
399526
399571
|
if (process.platform === "darwin") {
|
|
@@ -399530,7 +399575,7 @@ function convertImageToJpeg(inputPath, mimeType2) {
|
|
|
399530
399575
|
encoding: "utf-8",
|
|
399531
399576
|
timeout: CONVERSION_TIMEOUT_MS
|
|
399532
399577
|
});
|
|
399533
|
-
if (
|
|
399578
|
+
if (existsSync101(outputPath)) {
|
|
399534
399579
|
log2(`[image-converter] Converted using sips: ${outputPath}`);
|
|
399535
399580
|
return outputPath;
|
|
399536
399581
|
}
|
|
@@ -399546,7 +399591,7 @@ function convertImageToJpeg(inputPath, mimeType2) {
|
|
|
399546
399591
|
encoding: "utf-8",
|
|
399547
399592
|
timeout: CONVERSION_TIMEOUT_MS
|
|
399548
399593
|
});
|
|
399549
|
-
if (
|
|
399594
|
+
if (existsSync101(outputPath)) {
|
|
399550
399595
|
log2(`[image-converter] Converted using ImageMagick: ${outputPath}`);
|
|
399551
399596
|
return outputPath;
|
|
399552
399597
|
}
|
|
@@ -399569,12 +399614,12 @@ function convertImageToJpeg(inputPath, mimeType2) {
|
|
|
399569
399614
|
}
|
|
399570
399615
|
function cleanupConvertedImage(filePath) {
|
|
399571
399616
|
try {
|
|
399572
|
-
const tempDirectory =
|
|
399573
|
-
if (
|
|
399617
|
+
const tempDirectory = dirname40(filePath);
|
|
399618
|
+
if (existsSync101(filePath)) {
|
|
399574
399619
|
unlinkSync14(filePath);
|
|
399575
399620
|
log2(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
399576
399621
|
}
|
|
399577
|
-
if (
|
|
399622
|
+
if (existsSync101(tempDirectory)) {
|
|
399578
399623
|
rmSync5(tempDirectory, { recursive: true, force: true });
|
|
399579
399624
|
log2(`[image-converter] Cleaned up temporary directory: ${tempDirectory}`);
|
|
399580
399625
|
}
|
|
@@ -399584,18 +399629,18 @@ function cleanupConvertedImage(filePath) {
|
|
|
399584
399629
|
}
|
|
399585
399630
|
}
|
|
399586
399631
|
function convertBase64ImageToJpeg(base64Data, mimeType2) {
|
|
399587
|
-
const tempDir = mkdtempSync(
|
|
399632
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-b64-"));
|
|
399588
399633
|
const inputExt = mimeType2.split("/")[1] || "bin";
|
|
399589
|
-
const inputPath =
|
|
399634
|
+
const inputPath = join116(tempDir, `input.${inputExt}`);
|
|
399590
399635
|
const tempFiles = [inputPath];
|
|
399591
399636
|
try {
|
|
399592
399637
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
399593
399638
|
const buffer = Buffer.from(cleanBase64, "base64");
|
|
399594
|
-
|
|
399639
|
+
writeFileSync20(inputPath, buffer);
|
|
399595
399640
|
log2(`[image-converter] Converting Base64 ${mimeType2} to JPEG`);
|
|
399596
399641
|
const outputPath = convertImageToJpeg(inputPath, mimeType2);
|
|
399597
399642
|
tempFiles.push(outputPath);
|
|
399598
|
-
const convertedBuffer =
|
|
399643
|
+
const convertedBuffer = readFileSync66(outputPath);
|
|
399599
399644
|
const convertedBase64 = convertedBuffer.toString("base64");
|
|
399600
399645
|
log2(`[image-converter] Base64 conversion successful`);
|
|
399601
399646
|
return { base64: convertedBase64, tempFiles };
|
|
@@ -399625,7 +399670,7 @@ function getTemporaryConversionPath(error) {
|
|
|
399625
399670
|
function readJsonTextPart(filePath) {
|
|
399626
399671
|
let fileContent;
|
|
399627
399672
|
try {
|
|
399628
|
-
fileContent =
|
|
399673
|
+
fileContent = readFileSync67(filePath, "utf-8");
|
|
399629
399674
|
} catch (error) {
|
|
399630
399675
|
const code = error instanceof Error ? Reflect.get(error, "code") : undefined;
|
|
399631
399676
|
if (code === "ENOENT") {
|
|
@@ -403731,7 +403776,7 @@ function isExplicitSyncRun(runInBackground) {
|
|
|
403731
403776
|
return runInBackground === false || runInBackground === "false";
|
|
403732
403777
|
}
|
|
403733
403778
|
// packages/omo-opencode/src/tools/task/task-create.ts
|
|
403734
|
-
import { join as
|
|
403779
|
+
import { join as join118 } from "path";
|
|
403735
403780
|
|
|
403736
403781
|
// packages/omo-opencode/src/tools/task/types.ts
|
|
403737
403782
|
import { z as z4 } from "zod";
|
|
@@ -403786,8 +403831,8 @@ var TaskDeleteInputSchema = z4.object({
|
|
|
403786
403831
|
});
|
|
403787
403832
|
|
|
403788
403833
|
// packages/omo-opencode/src/features/claude-tasks/storage.ts
|
|
403789
|
-
import { join as
|
|
403790
|
-
import { existsSync as
|
|
403834
|
+
import { join as join117, dirname as dirname41, basename as basename21, isAbsolute as isAbsolute18 } from "path";
|
|
403835
|
+
import { existsSync as existsSync102, mkdirSync as mkdirSync20, readFileSync as readFileSync68, writeFileSync as writeFileSync21, renameSync as renameSync7, unlinkSync as unlinkSync15, readdirSync as readdirSync24 } from "fs";
|
|
403791
403836
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
403792
403837
|
function ignoreClaudeTaskStorageError(error) {
|
|
403793
403838
|
if (error instanceof Error)
|
|
@@ -403798,11 +403843,11 @@ function getTaskDir(config = {}) {
|
|
|
403798
403843
|
const tasksConfig = config.morpheus?.tasks;
|
|
403799
403844
|
const storagePath = tasksConfig?.storage_path;
|
|
403800
403845
|
if (storagePath) {
|
|
403801
|
-
return isAbsolute18(storagePath) ? storagePath :
|
|
403846
|
+
return isAbsolute18(storagePath) ? storagePath : join117(process.cwd(), storagePath);
|
|
403802
403847
|
}
|
|
403803
403848
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
403804
403849
|
const listId = resolveTaskListId(config);
|
|
403805
|
-
return
|
|
403850
|
+
return join117(configDir, "tasks", listId);
|
|
403806
403851
|
}
|
|
403807
403852
|
function sanitizePathSegment(value) {
|
|
403808
403853
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -403820,16 +403865,16 @@ function resolveTaskListId(config = {}) {
|
|
|
403820
403865
|
return sanitizePathSegment(basename21(process.cwd()));
|
|
403821
403866
|
}
|
|
403822
403867
|
function ensureDir(dirPath) {
|
|
403823
|
-
if (!
|
|
403824
|
-
|
|
403868
|
+
if (!existsSync102(dirPath)) {
|
|
403869
|
+
mkdirSync20(dirPath, { recursive: true });
|
|
403825
403870
|
}
|
|
403826
403871
|
}
|
|
403827
403872
|
function readJsonSafe(filePath, schema2) {
|
|
403828
403873
|
try {
|
|
403829
|
-
if (!
|
|
403874
|
+
if (!existsSync102(filePath)) {
|
|
403830
403875
|
return null;
|
|
403831
403876
|
}
|
|
403832
|
-
const content =
|
|
403877
|
+
const content = readFileSync68(filePath, "utf-8");
|
|
403833
403878
|
const parsed = JSON.parse(content);
|
|
403834
403879
|
const result = schema2.safeParse(parsed);
|
|
403835
403880
|
if (!result.success) {
|
|
@@ -403842,15 +403887,15 @@ function readJsonSafe(filePath, schema2) {
|
|
|
403842
403887
|
}
|
|
403843
403888
|
}
|
|
403844
403889
|
function writeJsonAtomic(filePath, data) {
|
|
403845
|
-
const dir =
|
|
403890
|
+
const dir = dirname41(filePath);
|
|
403846
403891
|
ensureDir(dir);
|
|
403847
403892
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
403848
403893
|
try {
|
|
403849
|
-
|
|
403894
|
+
writeFileSync21(tempPath, JSON.stringify(data, null, 2), "utf-8");
|
|
403850
403895
|
renameSync7(tempPath, filePath);
|
|
403851
403896
|
} catch (error) {
|
|
403852
403897
|
try {
|
|
403853
|
-
if (
|
|
403898
|
+
if (existsSync102(tempPath)) {
|
|
403854
403899
|
unlinkSync15(tempPath);
|
|
403855
403900
|
}
|
|
403856
403901
|
} catch (cleanupError) {
|
|
@@ -403864,17 +403909,17 @@ function generateTaskId() {
|
|
|
403864
403909
|
return `T-${randomUUID7()}`;
|
|
403865
403910
|
}
|
|
403866
403911
|
function acquireLock3(dirPath) {
|
|
403867
|
-
const lockPath =
|
|
403912
|
+
const lockPath = join117(dirPath, ".lock");
|
|
403868
403913
|
const lockId = randomUUID7();
|
|
403869
403914
|
const createLock = (timestamp2) => {
|
|
403870
|
-
|
|
403915
|
+
writeFileSync21(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
|
|
403871
403916
|
encoding: "utf-8",
|
|
403872
403917
|
flag: "wx"
|
|
403873
403918
|
});
|
|
403874
403919
|
};
|
|
403875
403920
|
const isStale = () => {
|
|
403876
403921
|
try {
|
|
403877
|
-
const lockContent =
|
|
403922
|
+
const lockContent = readFileSync68(lockPath, "utf-8");
|
|
403878
403923
|
const lockData = JSON.parse(lockContent);
|
|
403879
403924
|
const lockAge = Date.now() - lockData.timestamp;
|
|
403880
403925
|
return lockAge > STALE_LOCK_THRESHOLD_MS;
|
|
@@ -403915,9 +403960,9 @@ function acquireLock3(dirPath) {
|
|
|
403915
403960
|
acquired: true,
|
|
403916
403961
|
release: () => {
|
|
403917
403962
|
try {
|
|
403918
|
-
if (!
|
|
403963
|
+
if (!existsSync102(lockPath))
|
|
403919
403964
|
return;
|
|
403920
|
-
const lockContent =
|
|
403965
|
+
const lockContent = readFileSync68(lockPath, "utf-8");
|
|
403921
403966
|
const lockData = JSON.parse(lockContent);
|
|
403922
403967
|
if (lockData.id !== lockId)
|
|
403923
403968
|
return;
|
|
@@ -404082,7 +404127,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
404082
404127
|
threadID: context.sessionID
|
|
404083
404128
|
};
|
|
404084
404129
|
const validatedTask = TaskObjectSchema.parse(task);
|
|
404085
|
-
writeJsonAtomic(
|
|
404130
|
+
writeJsonAtomic(join118(taskDir, `${taskId}.json`), validatedTask);
|
|
404086
404131
|
await syncTaskTodoUpdate(ctx, validatedTask, context.sessionID);
|
|
404087
404132
|
return JSON.stringify({
|
|
404088
404133
|
task: {
|
|
@@ -404104,7 +404149,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
404104
404149
|
}
|
|
404105
404150
|
}
|
|
404106
404151
|
// packages/omo-opencode/src/tools/task/task-get.ts
|
|
404107
|
-
import { join as
|
|
404152
|
+
import { join as join119 } from "path";
|
|
404108
404153
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
404109
404154
|
function parseTaskId(id) {
|
|
404110
404155
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -404129,7 +404174,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
404129
404174
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
404130
404175
|
}
|
|
404131
404176
|
const taskDir = getTaskDir(config);
|
|
404132
|
-
const taskPath =
|
|
404177
|
+
const taskPath = join119(taskDir, `${taskId}.json`);
|
|
404133
404178
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
404134
404179
|
return JSON.stringify({ task: task ?? null });
|
|
404135
404180
|
} catch (error) {
|
|
@@ -404142,8 +404187,8 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
404142
404187
|
});
|
|
404143
404188
|
}
|
|
404144
404189
|
// packages/omo-opencode/src/tools/task/task-list.ts
|
|
404145
|
-
import { join as
|
|
404146
|
-
import { existsSync as
|
|
404190
|
+
import { join as join120 } from "path";
|
|
404191
|
+
import { existsSync as existsSync103, readdirSync as readdirSync25 } from "fs";
|
|
404147
404192
|
function createTaskList(config) {
|
|
404148
404193
|
return tool({
|
|
404149
404194
|
description: `List all active tasks with summary information.
|
|
@@ -404154,7 +404199,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
404154
404199
|
args: {},
|
|
404155
404200
|
execute: async () => {
|
|
404156
404201
|
const taskDir = getTaskDir(config);
|
|
404157
|
-
if (!
|
|
404202
|
+
if (!existsSync103(taskDir)) {
|
|
404158
404203
|
return JSON.stringify({ tasks: [] });
|
|
404159
404204
|
}
|
|
404160
404205
|
const files = readdirSync25(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
@@ -404163,7 +404208,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
404163
404208
|
}
|
|
404164
404209
|
const allTasks = [];
|
|
404165
404210
|
for (const fileId of files) {
|
|
404166
|
-
const task = readJsonSafe(
|
|
404211
|
+
const task = readJsonSafe(join120(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
404167
404212
|
if (task) {
|
|
404168
404213
|
allTasks.push(task);
|
|
404169
404214
|
}
|
|
@@ -404191,7 +404236,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
404191
404236
|
});
|
|
404192
404237
|
}
|
|
404193
404238
|
// packages/omo-opencode/src/tools/task/task-update.ts
|
|
404194
|
-
import { join as
|
|
404239
|
+
import { join as join121 } from "path";
|
|
404195
404240
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
404196
404241
|
function parseTaskId2(id) {
|
|
404197
404242
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -404239,7 +404284,7 @@ async function handleUpdate(args, config, ctx, context) {
|
|
|
404239
404284
|
return JSON.stringify({ error: "task_lock_unavailable" });
|
|
404240
404285
|
}
|
|
404241
404286
|
try {
|
|
404242
|
-
const taskPath =
|
|
404287
|
+
const taskPath = join121(taskDir, `${taskId}.json`);
|
|
404243
404288
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
404244
404289
|
if (!task) {
|
|
404245
404290
|
return JSON.stringify({ error: "task_not_found" });
|
|
@@ -405371,7 +405416,7 @@ function createSessionHooks(args) {
|
|
|
405371
405416
|
pluginConfig
|
|
405372
405417
|
})) : null;
|
|
405373
405418
|
const legacyPluginToast = isHookEnabled("legacy-plugin-toast") ? safeHook("legacy-plugin-toast", () => createLegacyPluginToastHook(ctx)) : null;
|
|
405374
|
-
const sessionMemoryLoader =
|
|
405419
|
+
const sessionMemoryLoader = isHookEnabled("session-memory-loader") ? safeHook("session-memory-loader", () => createSessionMemoryLoaderHook(ctx)) : null;
|
|
405375
405420
|
return {
|
|
405376
405421
|
preemptiveCompaction,
|
|
405377
405422
|
sessionNotification,
|
|
@@ -405684,13 +405729,13 @@ var LearningSchema = z7.object({
|
|
|
405684
405729
|
}).strict();
|
|
405685
405730
|
|
|
405686
405731
|
// packages/learning-loop/src/store.ts
|
|
405687
|
-
import * as
|
|
405732
|
+
import * as nodeFs2 from "fs";
|
|
405688
405733
|
var NodeFs = {
|
|
405689
|
-
appendFileSync:
|
|
405690
|
-
readFileSync: (p) =>
|
|
405691
|
-
writeFileSync:
|
|
405692
|
-
existsSync:
|
|
405693
|
-
mkdirSync: (p, o) =>
|
|
405734
|
+
appendFileSync: nodeFs2.appendFileSync,
|
|
405735
|
+
readFileSync: (p) => nodeFs2.readFileSync(p, "utf8"),
|
|
405736
|
+
writeFileSync: nodeFs2.writeFileSync,
|
|
405737
|
+
existsSync: nodeFs2.existsSync,
|
|
405738
|
+
mkdirSync: (p, o) => nodeFs2.mkdirSync(p, o)
|
|
405694
405739
|
};
|
|
405695
405740
|
function readLearnings(path23, fs23 = NodeFs) {
|
|
405696
405741
|
if (!fs23.existsSync(path23))
|
|
@@ -405817,9 +405862,9 @@ function createMemoryStore() {
|
|
|
405817
405862
|
|
|
405818
405863
|
// packages/learning-loop/src/memory-sqlite.ts
|
|
405819
405864
|
import { Database as Database2 } from "bun:sqlite";
|
|
405820
|
-
import * as
|
|
405821
|
-
import * as
|
|
405822
|
-
import * as
|
|
405865
|
+
import * as nodeFs3 from "fs";
|
|
405866
|
+
import * as nodePath2 from "path";
|
|
405867
|
+
import * as nodeOs2 from "os";
|
|
405823
405868
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
405824
405869
|
var CREATE_EPISODES_TABLE = `
|
|
405825
405870
|
CREATE TABLE IF NOT EXISTS episodes (
|
|
@@ -405913,16 +405958,16 @@ function rowToEpisode(row) {
|
|
|
405913
405958
|
function escapeFts5Quotes(text) {
|
|
405914
405959
|
return text.replace(/"/g, '""');
|
|
405915
405960
|
}
|
|
405916
|
-
var DEFAULT_DB_PATH =
|
|
405961
|
+
var DEFAULT_DB_PATH = nodePath2.join(nodeOs2.homedir(), ".matrixos", "memory", "episodic.db");
|
|
405917
405962
|
function ensureDbPath(dbPath) {
|
|
405918
|
-
const dir =
|
|
405919
|
-
if (!
|
|
405920
|
-
|
|
405963
|
+
const dir = nodePath2.dirname(dbPath);
|
|
405964
|
+
if (!nodeFs3.existsSync(dir)) {
|
|
405965
|
+
nodeFs3.mkdirSync(dir, { recursive: true });
|
|
405921
405966
|
}
|
|
405922
405967
|
}
|
|
405923
405968
|
function setPermissions(dbPath) {
|
|
405924
405969
|
try {
|
|
405925
|
-
|
|
405970
|
+
nodeFs3.chmodSync(dbPath, 384);
|
|
405926
405971
|
} catch {}
|
|
405927
405972
|
}
|
|
405928
405973
|
function tryEnableVectorIndex(db) {
|
|
@@ -406336,7 +406381,7 @@ function createScannerDaemon(options) {
|
|
|
406336
406381
|
};
|
|
406337
406382
|
}
|
|
406338
406383
|
// packages/omo-opencode/src/features/background-agent/manager.ts
|
|
406339
|
-
import { join as
|
|
406384
|
+
import { join as join124 } from "path";
|
|
406340
406385
|
init_tmux();
|
|
406341
406386
|
|
|
406342
406387
|
// packages/omo-opencode/src/features/background-agent/abort-with-timeout.ts
|
|
@@ -406624,8 +406669,8 @@ function writeBackgroundTaskMarker(input) {
|
|
|
406624
406669
|
}
|
|
406625
406670
|
|
|
406626
406671
|
// packages/omo-opencode/src/features/background-agent/compaction-aware-message-resolver.ts
|
|
406627
|
-
import { readdirSync as readdirSync26, readFileSync as
|
|
406628
|
-
import { join as
|
|
406672
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync70 } from "fs";
|
|
406673
|
+
import { join as join123 } from "path";
|
|
406629
406674
|
function hasFullAgentAndModel(message) {
|
|
406630
406675
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
406631
406676
|
}
|
|
@@ -406704,7 +406749,7 @@ function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
|
406704
406749
|
const messages = [];
|
|
406705
406750
|
for (const file2 of files) {
|
|
406706
406751
|
try {
|
|
406707
|
-
const content =
|
|
406752
|
+
const content = readFileSync70(join123(messageDir, file2), "utf-8");
|
|
406708
406753
|
const parsed = JSON.parse(content);
|
|
406709
406754
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
406710
406755
|
continue;
|
|
@@ -411461,7 +411506,7 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
411461
411506
|
parentSessionID: task.parentSessionId
|
|
411462
411507
|
});
|
|
411463
411508
|
}
|
|
411464
|
-
const messageDir =
|
|
411509
|
+
const messageDir = join124(MESSAGE_STORAGE, task.parentSessionId);
|
|
411465
411510
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionId) : null;
|
|
411466
411511
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
411467
411512
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -413083,23 +413128,23 @@ function createMonitorManager(options) {
|
|
|
413083
413128
|
import { createHash as createHash6 } from "crypto";
|
|
413084
413129
|
import {
|
|
413085
413130
|
chmodSync as chmodSync5,
|
|
413086
|
-
existsSync as
|
|
413087
|
-
mkdirSync as
|
|
413131
|
+
existsSync as existsSync108,
|
|
413132
|
+
mkdirSync as mkdirSync23,
|
|
413088
413133
|
readdirSync as readdirSync27,
|
|
413089
|
-
readFileSync as
|
|
413134
|
+
readFileSync as readFileSync72,
|
|
413090
413135
|
renameSync as renameSync9,
|
|
413091
413136
|
unlinkSync as unlinkSync16,
|
|
413092
|
-
writeFileSync as
|
|
413137
|
+
writeFileSync as writeFileSync24
|
|
413093
413138
|
} from "fs";
|
|
413094
|
-
import { basename as basename22, dirname as
|
|
413139
|
+
import { basename as basename22, dirname as dirname43, join as join127 } from "path";
|
|
413095
413140
|
|
|
413096
413141
|
// packages/mcp-client-core/src/config-dir.ts
|
|
413097
|
-
import { existsSync as
|
|
413098
|
-
import { homedir as
|
|
413099
|
-
import { join as
|
|
413142
|
+
import { existsSync as existsSync106, realpathSync as realpathSync18 } from "fs";
|
|
413143
|
+
import { homedir as homedir34 } from "os";
|
|
413144
|
+
import { join as join125, resolve as resolve37 } from "path";
|
|
413100
413145
|
function resolveConfigPath4(pathValue) {
|
|
413101
413146
|
const resolvedPath = resolve37(pathValue);
|
|
413102
|
-
if (!
|
|
413147
|
+
if (!existsSync106(resolvedPath))
|
|
413103
413148
|
return resolvedPath;
|
|
413104
413149
|
try {
|
|
413105
413150
|
return realpathSync18(resolvedPath);
|
|
@@ -413114,13 +413159,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
413114
413159
|
if (customConfigDir) {
|
|
413115
413160
|
return resolveConfigPath4(customConfigDir);
|
|
413116
413161
|
}
|
|
413117
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() ||
|
|
413118
|
-
return resolveConfigPath4(
|
|
413162
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join125(homedir34(), ".config");
|
|
413163
|
+
return resolveConfigPath4(join125(xdgConfigDir, "opencode"));
|
|
413119
413164
|
}
|
|
413120
413165
|
|
|
413121
413166
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
413122
|
-
import { chmodSync as chmodSync4, existsSync as
|
|
413123
|
-
import { join as
|
|
413167
|
+
import { chmodSync as chmodSync4, existsSync as existsSync107, readFileSync as readFileSync71, renameSync as renameSync8, writeFileSync as writeFileSync23 } from "fs";
|
|
413168
|
+
import { join as join126 } from "path";
|
|
413124
413169
|
var INDEX_FILE_NAME = "index.json";
|
|
413125
413170
|
function isTokenIndex(value) {
|
|
413126
413171
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -413128,14 +413173,14 @@ function isTokenIndex(value) {
|
|
|
413128
413173
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
413129
413174
|
}
|
|
413130
413175
|
function getIndexPath(storageDir) {
|
|
413131
|
-
return
|
|
413176
|
+
return join126(storageDir, INDEX_FILE_NAME);
|
|
413132
413177
|
}
|
|
413133
413178
|
function readTokenIndex(storageDir) {
|
|
413134
413179
|
const indexPath = getIndexPath(storageDir);
|
|
413135
|
-
if (!
|
|
413180
|
+
if (!existsSync107(indexPath))
|
|
413136
413181
|
return {};
|
|
413137
413182
|
try {
|
|
413138
|
-
const parsed = JSON.parse(
|
|
413183
|
+
const parsed = JSON.parse(readFileSync71(indexPath, "utf-8"));
|
|
413139
413184
|
return isTokenIndex(parsed) ? parsed : {};
|
|
413140
413185
|
} catch (readError) {
|
|
413141
413186
|
if (!(readError instanceof Error))
|
|
@@ -413147,7 +413192,7 @@ function writeTokenIndex(storageDir, index) {
|
|
|
413147
413192
|
try {
|
|
413148
413193
|
const indexPath = getIndexPath(storageDir);
|
|
413149
413194
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
413150
|
-
|
|
413195
|
+
writeFileSync23(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
413151
413196
|
chmodSync4(tempPath, 384);
|
|
413152
413197
|
renameSync8(tempPath, indexPath);
|
|
413153
413198
|
return true;
|
|
@@ -413165,16 +413210,16 @@ function saveTokenIndexEntry(storageDir, hash, key) {
|
|
|
413165
413210
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
413166
413211
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
413167
413212
|
function getMcpOauthStorageDir() {
|
|
413168
|
-
return
|
|
413213
|
+
return join127(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
413169
413214
|
}
|
|
413170
413215
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
413171
413216
|
return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
413172
413217
|
}
|
|
413173
413218
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
413174
|
-
return
|
|
413219
|
+
return join127(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
413175
413220
|
}
|
|
413176
413221
|
function getLegacyStoragePath() {
|
|
413177
|
-
return
|
|
413222
|
+
return join127(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
413178
413223
|
}
|
|
413179
413224
|
function normalizeHost(serverHost) {
|
|
413180
413225
|
let host = serverHost.trim();
|
|
@@ -413235,10 +413280,10 @@ function isOAuthTokenData(value) {
|
|
|
413235
413280
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
413236
413281
|
}
|
|
413237
413282
|
function readTokenFile(filePath) {
|
|
413238
|
-
if (!
|
|
413283
|
+
if (!existsSync108(filePath))
|
|
413239
413284
|
return null;
|
|
413240
413285
|
try {
|
|
413241
|
-
const parsed = JSON.parse(
|
|
413286
|
+
const parsed = JSON.parse(readFileSync72(filePath, "utf-8"));
|
|
413242
413287
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
413243
413288
|
} catch (readError) {
|
|
413244
413289
|
if (!(readError instanceof Error))
|
|
@@ -413248,10 +413293,10 @@ function readTokenFile(filePath) {
|
|
|
413248
413293
|
}
|
|
413249
413294
|
function readLegacyStore() {
|
|
413250
413295
|
const filePath = getLegacyStoragePath();
|
|
413251
|
-
if (!
|
|
413296
|
+
if (!existsSync108(filePath))
|
|
413252
413297
|
return null;
|
|
413253
413298
|
try {
|
|
413254
|
-
const parsed = JSON.parse(
|
|
413299
|
+
const parsed = JSON.parse(readFileSync72(filePath, "utf-8"));
|
|
413255
413300
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
413256
413301
|
return null;
|
|
413257
413302
|
const result = {};
|
|
@@ -413268,12 +413313,12 @@ function readLegacyStore() {
|
|
|
413268
413313
|
}
|
|
413269
413314
|
function writeTokenFile(filePath, token) {
|
|
413270
413315
|
try {
|
|
413271
|
-
const dir =
|
|
413272
|
-
if (!
|
|
413273
|
-
|
|
413316
|
+
const dir = dirname43(filePath);
|
|
413317
|
+
if (!existsSync108(dir)) {
|
|
413318
|
+
mkdirSync23(dir, { recursive: true });
|
|
413274
413319
|
}
|
|
413275
413320
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
413276
|
-
|
|
413321
|
+
writeFileSync24(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
413277
413322
|
chmodSync5(tempPath, 384);
|
|
413278
413323
|
renameSync9(tempPath, filePath);
|
|
413279
413324
|
return true;
|
|
@@ -418661,16 +418706,16 @@ var WRITE_DEBOUNCE_MS = 250;
|
|
|
418661
418706
|
init_logger2();
|
|
418662
418707
|
|
|
418663
418708
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-io.ts
|
|
418664
|
-
import { mkdirSync as
|
|
418665
|
-
import { dirname as
|
|
418709
|
+
import { mkdirSync as mkdirSync24, readFileSync as readFileSync73 } from "fs";
|
|
418710
|
+
import { dirname as dirname44 } from "path";
|
|
418666
418711
|
|
|
418667
418712
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
418668
418713
|
import { createHash as createHash8 } from "crypto";
|
|
418669
418714
|
import { realpathSync as realpathSync19 } from "fs";
|
|
418670
|
-
import { homedir as
|
|
418671
|
-
import { join as
|
|
418715
|
+
import { homedir as homedir35 } from "os";
|
|
418716
|
+
import { join as join128, resolve as resolve38 } from "path";
|
|
418672
418717
|
function mirrorStorageDir() {
|
|
418673
|
-
return
|
|
418718
|
+
return join128(process.env.XDG_DATA_HOME ?? join128(homedir35(), ".local", "share"), "opencode", "storage", "matrixos", MIRROR_DIR_NAME);
|
|
418674
418719
|
}
|
|
418675
418720
|
function canonicalProjectDir(projectDir) {
|
|
418676
418721
|
try {
|
|
@@ -418684,7 +418729,7 @@ function canonicalProjectDir(projectDir) {
|
|
|
418684
418729
|
}
|
|
418685
418730
|
function mirrorFilePath(projectDir) {
|
|
418686
418731
|
const projectHash = createHash8("sha1").update(canonicalProjectDir(projectDir)).digest("hex").slice(0, 16);
|
|
418687
|
-
return
|
|
418732
|
+
return join128(mirrorStorageDir(), `${projectHash}.json`);
|
|
418688
418733
|
}
|
|
418689
418734
|
|
|
418690
418735
|
// packages/omo-opencode/src/features/tui-sidebar/snapshot-schema.ts
|
|
@@ -418737,13 +418782,13 @@ var TuiRuntimeSnapshotSchema = z11.object({
|
|
|
418737
418782
|
function writeMirror(projectDir, snapshot) {
|
|
418738
418783
|
const filePath = mirrorFilePath(projectDir);
|
|
418739
418784
|
const content = JSON.stringify(snapshot);
|
|
418740
|
-
|
|
418785
|
+
mkdirSync24(dirname44(filePath), { recursive: true });
|
|
418741
418786
|
writeFileAtomically2(filePath, content, { mode: 384 });
|
|
418742
418787
|
}
|
|
418743
418788
|
|
|
418744
418789
|
// packages/omo-opencode/src/features/tui-sidebar/loop-reader.ts
|
|
418745
|
-
import { readdirSync as readdirSync28, readFileSync as
|
|
418746
|
-
import { join as
|
|
418790
|
+
import { readdirSync as readdirSync28, readFileSync as readFileSync74, statSync as statSync13 } from "fs";
|
|
418791
|
+
import { join as join129 } from "path";
|
|
418747
418792
|
import { z as z12 } from "zod";
|
|
418748
418793
|
var CriterionSchema = z12.object({
|
|
418749
418794
|
status: z12.string()
|
|
@@ -418773,7 +418818,7 @@ function enumerateCandidates(projectDir) {
|
|
|
418773
418818
|
return [...currentLoopCandidates(projectDir), legacyLoopCandidate(projectDir)].filter((candidate) => candidate !== null);
|
|
418774
418819
|
}
|
|
418775
418820
|
function currentLoopCandidates(projectDir) {
|
|
418776
|
-
const loopRoot =
|
|
418821
|
+
const loopRoot = join129(projectDir, ".omo", "ulw-loop");
|
|
418777
418822
|
let entries;
|
|
418778
418823
|
try {
|
|
418779
418824
|
entries = readdirSync28(loopRoot, { withFileTypes: true });
|
|
@@ -418783,10 +418828,10 @@ function currentLoopCandidates(projectDir) {
|
|
|
418783
418828
|
}
|
|
418784
418829
|
throw error;
|
|
418785
418830
|
}
|
|
418786
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(
|
|
418831
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(join129(loopRoot, entry.name, "goals.json"))).filter((candidate) => candidate !== null);
|
|
418787
418832
|
}
|
|
418788
418833
|
function legacyLoopCandidate(projectDir) {
|
|
418789
|
-
return statCandidate(
|
|
418834
|
+
return statCandidate(join129(projectDir, ".omo", "loop", "goals.json"));
|
|
418790
418835
|
}
|
|
418791
418836
|
function statCandidate(path23) {
|
|
418792
418837
|
try {
|
|
@@ -418811,7 +418856,7 @@ function readLiveCandidate(candidate) {
|
|
|
418811
418856
|
function readParsedLoop(path23) {
|
|
418812
418857
|
let raw;
|
|
418813
418858
|
try {
|
|
418814
|
-
raw = JSON.parse(
|
|
418859
|
+
raw = JSON.parse(readFileSync74(path23, "utf8"));
|
|
418815
418860
|
} catch (error) {
|
|
418816
418861
|
if (error instanceof Error) {
|
|
418817
418862
|
return null;
|
|
@@ -421272,25 +421317,25 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
421272
421317
|
};
|
|
421273
421318
|
}
|
|
421274
421319
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
421275
|
-
import { existsSync as
|
|
421276
|
-
import { join as
|
|
421277
|
-
import { homedir as
|
|
421320
|
+
import { existsSync as existsSync109, readFileSync as readFileSync75 } from "fs";
|
|
421321
|
+
import { join as join130 } from "path";
|
|
421322
|
+
import { homedir as homedir36 } from "os";
|
|
421278
421323
|
function getMcpConfigPaths() {
|
|
421279
421324
|
const claudeConfigDir = getClaudeConfigDir3();
|
|
421280
421325
|
const homeDir = getHomeDir();
|
|
421281
421326
|
const cwd = process.cwd();
|
|
421282
421327
|
return [
|
|
421283
|
-
{ path:
|
|
421284
|
-
{ path:
|
|
421285
|
-
{ path:
|
|
421286
|
-
{ path:
|
|
421328
|
+
{ path: join130(homeDir, ".claude.json"), scope: "user" },
|
|
421329
|
+
{ path: join130(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
421330
|
+
{ path: join130(cwd, ".mcp.json"), scope: "project" },
|
|
421331
|
+
{ path: join130(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
421287
421332
|
];
|
|
421288
421333
|
}
|
|
421289
421334
|
function getHomeDir() {
|
|
421290
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
421335
|
+
return process.env.HOME || process.env.USERPROFILE || homedir36();
|
|
421291
421336
|
}
|
|
421292
421337
|
async function loadMcpConfigFile(filePath) {
|
|
421293
|
-
if (!
|
|
421338
|
+
if (!existsSync109(filePath)) {
|
|
421294
421339
|
return null;
|
|
421295
421340
|
}
|
|
421296
421341
|
try {
|
|
@@ -421310,10 +421355,10 @@ function getSystemMcpServerNames() {
|
|
|
421310
421355
|
const paths2 = getMcpConfigPaths();
|
|
421311
421356
|
const cwd = process.cwd();
|
|
421312
421357
|
for (const { path: path23 } of paths2) {
|
|
421313
|
-
if (!
|
|
421358
|
+
if (!existsSync109(path23))
|
|
421314
421359
|
continue;
|
|
421315
421360
|
try {
|
|
421316
|
-
const content =
|
|
421361
|
+
const content = readFileSync75(path23, "utf-8");
|
|
421317
421362
|
const config = JSON.parse(content);
|
|
421318
421363
|
if (!config?.mcpServers)
|
|
421319
421364
|
continue;
|
|
@@ -428506,15 +428551,15 @@ function createTankAgent(model, availableAgents, availableToolNames, availableSk
|
|
|
428506
428551
|
}
|
|
428507
428552
|
createTankAgent.mode = MODE9;
|
|
428508
428553
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
428509
|
-
import { existsSync as
|
|
428510
|
-
import { homedir as
|
|
428511
|
-
import { isAbsolute as isAbsolute19, join as
|
|
428554
|
+
import { existsSync as existsSync110, readFileSync as readFileSync76 } from "fs";
|
|
428555
|
+
import { homedir as homedir37 } from "os";
|
|
428556
|
+
import { isAbsolute as isAbsolute19, join as join131, resolve as resolve39 } from "path";
|
|
428512
428557
|
init_logger2();
|
|
428513
428558
|
var ALLOWED_HOME_SUBDIRS = [
|
|
428514
|
-
|
|
428515
|
-
|
|
428516
|
-
|
|
428517
|
-
|
|
428559
|
+
join131(homedir37(), ".config", "opencode"),
|
|
428560
|
+
join131(homedir37(), ".config", "MaTrixOS"),
|
|
428561
|
+
join131(homedir37(), ".omo"),
|
|
428562
|
+
join131(homedir37(), ".opencode")
|
|
428518
428563
|
];
|
|
428519
428564
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
428520
428565
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -428532,7 +428577,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
428532
428577
|
let filePath;
|
|
428533
428578
|
try {
|
|
428534
428579
|
const decoded = decodeURIComponent(encoded);
|
|
428535
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
428580
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir37()}/`) : decoded;
|
|
428536
428581
|
filePath = isAbsolute19(expanded) ? expanded : resolve39(configDir ?? process.cwd(), expanded);
|
|
428537
428582
|
} catch (error) {
|
|
428538
428583
|
if (!(error instanceof Error)) {
|
|
@@ -428550,11 +428595,11 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
428550
428595
|
});
|
|
428551
428596
|
return `[WARNING: Path rejected: ${promptAppend} (resolved outside project root ${projectRoot} and allowed home directories; file:// prompts must reside within the project directory, ~/.config/opencode/, ~/.config/MaTrixOS/, ~/.omo/, or ~/.opencode/)]`;
|
|
428552
428597
|
}
|
|
428553
|
-
if (!
|
|
428598
|
+
if (!existsSync110(filePath)) {
|
|
428554
428599
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
428555
428600
|
}
|
|
428556
428601
|
try {
|
|
428557
|
-
return
|
|
428602
|
+
return readFileSync76(filePath, "utf8");
|
|
428558
428603
|
} catch (error) {
|
|
428559
428604
|
if (!(error instanceof Error)) {
|
|
428560
428605
|
throw error;
|
|
@@ -431736,7 +431781,7 @@ async function applyAgentConfig(params) {
|
|
|
431736
431781
|
}
|
|
431737
431782
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader.ts
|
|
431738
431783
|
import { promises as fs23 } from "fs";
|
|
431739
|
-
import { join as
|
|
431784
|
+
import { join as join132, basename as basename23 } from "path";
|
|
431740
431785
|
|
|
431741
431786
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader-cache.ts
|
|
431742
431787
|
var commandLoaderCache = new Map;
|
|
@@ -431784,7 +431829,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
431784
431829
|
continue;
|
|
431785
431830
|
if (entry.name.startsWith("."))
|
|
431786
431831
|
continue;
|
|
431787
|
-
const subDirPath =
|
|
431832
|
+
const subDirPath = join132(commandsDir, entry.name);
|
|
431788
431833
|
const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
431789
431834
|
const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
|
|
431790
431835
|
commands.push(...subCommands);
|
|
@@ -431792,7 +431837,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
431792
431837
|
}
|
|
431793
431838
|
if (!isMarkdownFile(entry))
|
|
431794
431839
|
continue;
|
|
431795
|
-
const commandPath =
|
|
431840
|
+
const commandPath = join132(commandsDir, entry.name);
|
|
431796
431841
|
const baseCommandName = basename23(entry.name, ".md");
|
|
431797
431842
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
431798
431843
|
try {
|
|
@@ -431855,12 +431900,12 @@ function commandsToRecord(commands) {
|
|
|
431855
431900
|
return result;
|
|
431856
431901
|
}
|
|
431857
431902
|
async function loadUserCommands() {
|
|
431858
|
-
const userCommandsDir =
|
|
431903
|
+
const userCommandsDir = join132(getClaudeConfigDir3(), "commands");
|
|
431859
431904
|
const commands = await loadCommandsFromDir(userCommandsDir, "user");
|
|
431860
431905
|
return commandsToRecord(commands);
|
|
431861
431906
|
}
|
|
431862
431907
|
async function loadProjectCommands(directory) {
|
|
431863
|
-
const projectCommandsDir =
|
|
431908
|
+
const projectCommandsDir = join132(directory ?? process.cwd(), ".claude", "commands");
|
|
431864
431909
|
const commands = await loadCommandsFromDir(projectCommandsDir, "project");
|
|
431865
431910
|
return commandsToRecord(commands);
|
|
431866
431911
|
}
|
|
@@ -432050,8 +432095,8 @@ var grep_app = {
|
|
|
432050
432095
|
|
|
432051
432096
|
// packages/omo-opencode/src/mcp/codegraph.ts
|
|
432052
432097
|
init_src();
|
|
432053
|
-
import { existsSync as
|
|
432054
|
-
import { join as
|
|
432098
|
+
import { existsSync as existsSync111 } from "fs";
|
|
432099
|
+
import { join as join133 } from "path";
|
|
432055
432100
|
|
|
432056
432101
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
432057
432102
|
init_bun_which_shim();
|
|
@@ -432098,7 +432143,7 @@ function createWhichResolver(resolveExecutable) {
|
|
|
432098
432143
|
function provisionedBinFromInstallDir2(installDir, fileExists2) {
|
|
432099
432144
|
if (installDir === undefined)
|
|
432100
432145
|
return null;
|
|
432101
|
-
const candidate =
|
|
432146
|
+
const candidate = join133(installDir, "bin", process.platform === "win32" ? "codegraph.cmd" : "codegraph");
|
|
432102
432147
|
return fileExists2(candidate) ? candidate : null;
|
|
432103
432148
|
}
|
|
432104
432149
|
function codegraphEnvForConfig(config, homeDir) {
|
|
@@ -432109,7 +432154,7 @@ function createCodegraphMcpConfig(options = {}) {
|
|
|
432109
432154
|
const env2 = options.env ?? process.env;
|
|
432110
432155
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
432111
432156
|
const which2 = createWhichResolver(resolveExecutable);
|
|
432112
|
-
const fileExists2 = options.fileExists ??
|
|
432157
|
+
const fileExists2 = options.fileExists ?? existsSync111;
|
|
432113
432158
|
const resolvedCommand = resolveCodegraphCommand({
|
|
432114
432159
|
env: env2,
|
|
432115
432160
|
fileExists: fileExists2,
|
|
@@ -432135,8 +432180,8 @@ function createCodegraphMcpConfig(options = {}) {
|
|
|
432135
432180
|
}
|
|
432136
432181
|
|
|
432137
432182
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
432138
|
-
import { existsSync as
|
|
432139
|
-
import { delimiter as delimiter2, dirname as
|
|
432183
|
+
import { existsSync as existsSync112, readFileSync as readFileSync77 } from "fs";
|
|
432184
|
+
import { delimiter as delimiter2, dirname as dirname45, resolve as resolve41 } from "path";
|
|
432140
432185
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
432141
432186
|
import { z as z13 } from "zod";
|
|
432142
432187
|
|
|
@@ -432233,7 +432278,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
432233
432278
|
].join(";");
|
|
432234
432279
|
function getModuleDirectory(moduleUrl) {
|
|
432235
432280
|
try {
|
|
432236
|
-
return
|
|
432281
|
+
return dirname45(fileURLToPath7(moduleUrl));
|
|
432237
432282
|
} catch (error) {
|
|
432238
432283
|
if (!(error instanceof Error))
|
|
432239
432284
|
throw error;
|
|
@@ -432245,7 +432290,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
432245
432290
|
}
|
|
432246
432291
|
function readDaemonPackageVersion(root) {
|
|
432247
432292
|
try {
|
|
432248
|
-
const packageJson = JSON.parse(
|
|
432293
|
+
const packageJson = JSON.parse(readFileSync77(resolve41(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
432249
432294
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
432250
432295
|
} catch (error) {
|
|
432251
432296
|
if (!(error instanceof Error))
|
|
@@ -432267,7 +432312,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
432267
432312
|
};
|
|
432268
432313
|
}
|
|
432269
432314
|
function resolveLspCommand(options = {}) {
|
|
432270
|
-
const pathExists = options.exists ??
|
|
432315
|
+
const pathExists = options.exists ?? existsSync112;
|
|
432271
432316
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
432272
432317
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
432273
432318
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -432717,7 +432762,7 @@ function createConfigHandler(deps) {
|
|
|
432717
432762
|
}
|
|
432718
432763
|
// packages/omo-opencode/src/create-managers.ts
|
|
432719
432764
|
init_server_health2();
|
|
432720
|
-
import { join as
|
|
432765
|
+
import { join as join134 } from "path";
|
|
432721
432766
|
var defaultCreateManagersDeps = {
|
|
432722
432767
|
BackgroundManagerClass: BackgroundManager,
|
|
432723
432768
|
SkillMcpManagerClass: SkillMcpManager,
|
|
@@ -432774,9 +432819,9 @@ function createManagers(args) {
|
|
|
432774
432819
|
}
|
|
432775
432820
|
});
|
|
432776
432821
|
const scannerDaemon = createScannerDaemon({
|
|
432777
|
-
auditLogPath:
|
|
432822
|
+
auditLogPath: join134(getDataDir(), "opencode", "matrix-gateway-audit.jsonl"),
|
|
432778
432823
|
projectDir: ctx.directory,
|
|
432779
|
-
learningsPath:
|
|
432824
|
+
learningsPath: join134(ctx.directory, ".matrix", "learnings.jsonl"),
|
|
432780
432825
|
intervalMs: 14400000,
|
|
432781
432826
|
onScanComplete(result) {
|
|
432782
432827
|
log2("[scanner-daemon] scan complete", result);
|
|
@@ -438780,24 +438825,24 @@ function createChatHeadersHandler(args) {
|
|
|
438780
438825
|
}
|
|
438781
438826
|
|
|
438782
438827
|
// packages/omo-opencode/src/plugin/auto-adoption.ts
|
|
438783
|
-
import { existsSync as
|
|
438784
|
-
import { join as
|
|
438785
|
-
import { homedir as
|
|
438786
|
-
var ADOPTION_CONTEXT_RELATIVE =
|
|
438828
|
+
import { existsSync as existsSync113, readFileSync as readFileSync78 } from "fs";
|
|
438829
|
+
import { join as join135 } from "path";
|
|
438830
|
+
import { homedir as homedir38 } from "os";
|
|
438831
|
+
var ADOPTION_CONTEXT_RELATIVE = join135("MOS_Vault", "04-Areas", "user-context.md");
|
|
438787
438832
|
function resolveUserContextPath() {
|
|
438788
|
-
const base = process.env.MOS_VAULT_DIR ??
|
|
438789
|
-
return
|
|
438833
|
+
const base = process.env.MOS_VAULT_DIR ?? join135(homedir38(), "MOS_Vault");
|
|
438834
|
+
return join135(base, "04-Areas", "user-context.md");
|
|
438790
438835
|
}
|
|
438791
438836
|
function isAutoAdoptionEnabled() {
|
|
438792
438837
|
const candidates = [
|
|
438793
|
-
|
|
438794
|
-
|
|
438838
|
+
join135(homedir38(), ".config", "opencode", "matrixos.json"),
|
|
438839
|
+
join135(homedir38(), ".config", "opencode", "matrixos.jsonc")
|
|
438795
438840
|
];
|
|
438796
438841
|
for (const cfgPath of candidates) {
|
|
438797
438842
|
try {
|
|
438798
|
-
if (!
|
|
438843
|
+
if (!existsSync113(cfgPath))
|
|
438799
438844
|
continue;
|
|
438800
|
-
const raw =
|
|
438845
|
+
const raw = readFileSync78(cfgPath, "utf8");
|
|
438801
438846
|
const json2 = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[^]*?\*\//g, "");
|
|
438802
438847
|
const parsed = JSON.parse(json2);
|
|
438803
438848
|
return parsed.autoAdoption === true;
|
|
@@ -438811,10 +438856,10 @@ function isAdoptionNeeded() {
|
|
|
438811
438856
|
if (!isAutoAdoptionEnabled())
|
|
438812
438857
|
return false;
|
|
438813
438858
|
const path27 = resolveUserContextPath();
|
|
438814
|
-
if (!
|
|
438859
|
+
if (!existsSync113(path27))
|
|
438815
438860
|
return true;
|
|
438816
438861
|
try {
|
|
438817
|
-
const content =
|
|
438862
|
+
const content = readFileSync78(path27, "utf8");
|
|
438818
438863
|
return !/features/i.test(content);
|
|
438819
438864
|
} catch {
|
|
438820
438865
|
return true;
|
|
@@ -438823,8 +438868,8 @@ function isAdoptionNeeded() {
|
|
|
438823
438868
|
var ADOPTION_TRIGGER_INSTRUCTION = `SYST\xC8ME \u2014 Rituel d'adoption automatique : lance imm\xE9diatement le rituel d'adoption comme si l'utilisateur avait tap\xE9 /adopt. M\xEAme si un contexte utilisateur (user-context.md) existe d\xE9j\xE0, tu DOIS proposer les fonctionnalit\xE9s opt-in (especially Dashboard Mission Control sur 127.0.0.1:9123) \u2014 ne saute jamais cette \xE9tape. Pose les 5 questions (identit\xE9, projet, contraintes, style de collaboration, reporting), puis pr\xE9sente la checklist des fonctionnalit\xE9s opt-in depuis l'inventaire (OPT_IN_FEATURES). Utilise l'outil question pour les questions. Ne r\xE9ponds pas encore \xE0 la demande de l'utilisateur \u2014 l'adoption prime.`;
|
|
438824
438869
|
|
|
438825
438870
|
// packages/omo-opencode/src/plugin/ultrawork-db-model-override.ts
|
|
438826
|
-
import { join as
|
|
438827
|
-
import { existsSync as
|
|
438871
|
+
import { join as join136 } from "path";
|
|
438872
|
+
import { existsSync as existsSync114 } from "fs";
|
|
438828
438873
|
async function importBunSqlite() {
|
|
438829
438874
|
if (typeof globalThis.Bun === "undefined") {
|
|
438830
438875
|
return null;
|
|
@@ -438840,7 +438885,7 @@ async function importBunSqlite() {
|
|
|
438840
438885
|
}
|
|
438841
438886
|
}
|
|
438842
438887
|
function getDbPath() {
|
|
438843
|
-
return
|
|
438888
|
+
return join136(getDataDir(), "opencode", "opencode.db");
|
|
438844
438889
|
}
|
|
438845
438890
|
var MAX_MICROTASK_RETRIES = 10;
|
|
438846
438891
|
function logCaughtDbError(message, metadata, error) {
|
|
@@ -438943,7 +438988,7 @@ async function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
|
438943
438988
|
return;
|
|
438944
438989
|
}
|
|
438945
438990
|
const dbPath = getDbPath();
|
|
438946
|
-
if (!
|
|
438991
|
+
if (!existsSync114(dbPath)) {
|
|
438947
438992
|
log2("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
438948
438993
|
return;
|
|
438949
438994
|
}
|
|
@@ -440197,7 +440242,8 @@ function createSessionMemoryRecorder(options = {}) {
|
|
|
440197
440242
|
var defaultRecorder;
|
|
440198
440243
|
function getDefaultSessionMemoryRecorder() {
|
|
440199
440244
|
if (!defaultRecorder) {
|
|
440200
|
-
const
|
|
440245
|
+
const consented = loadConsent().memoryRecording;
|
|
440246
|
+
const persistentStore = consented ? createSqliteMemoryStore() : createMemoryStore();
|
|
440201
440247
|
defaultRecorder = createSessionMemoryRecorder({ memoryStore: persistentStore });
|
|
440202
440248
|
}
|
|
440203
440249
|
return defaultRecorder;
|
|
@@ -441899,13 +441945,13 @@ function createAgentAntiLoopHooks(config) {
|
|
|
441899
441945
|
}
|
|
441900
441946
|
|
|
441901
441947
|
// packages/omo-opencode/src/features/anti-loop/logger.ts
|
|
441902
|
-
import { existsSync as
|
|
441903
|
-
import { join as
|
|
441948
|
+
import { existsSync as existsSync115, mkdirSync as mkdirSync25, appendFileSync as appendFileSync8 } from "fs";
|
|
441949
|
+
import { join as join137 } from "path";
|
|
441904
441950
|
function createAntiLoopLogger(logsDir) {
|
|
441905
|
-
const logFile =
|
|
441906
|
-
const parentDir =
|
|
441907
|
-
if (!
|
|
441908
|
-
|
|
441951
|
+
const logFile = join137(logsDir, "anti-loop.jsonl");
|
|
441952
|
+
const parentDir = join137(logsDir, "..");
|
|
441953
|
+
if (!existsSync115(logsDir)) {
|
|
441954
|
+
mkdirSync25(logsDir, { recursive: true });
|
|
441909
441955
|
}
|
|
441910
441956
|
return {
|
|
441911
441957
|
log(event) {
|
|
@@ -441928,10 +441974,10 @@ function getRunningTasks() {
|
|
|
441928
441974
|
}
|
|
441929
441975
|
|
|
441930
441976
|
// packages/omo-opencode/src/plugin/agent-anti-loop.ts
|
|
441931
|
-
import { join as
|
|
441977
|
+
import { join as join138 } from "path";
|
|
441932
441978
|
function createAgentAntiLoopWiring(config, deps) {
|
|
441933
441979
|
const hooks = createAgentAntiLoopHooks(config);
|
|
441934
|
-
const logDir = deps.projectDir ?
|
|
441980
|
+
const logDir = deps.projectDir ? join138(deps.projectDir, ".matrixos", "logs") : process.cwd();
|
|
441935
441981
|
const antiLoopLog = createAntiLoopLogger(logDir);
|
|
441936
441982
|
return {
|
|
441937
441983
|
toolExecuteAfter(input) {
|
|
@@ -442424,7 +442470,7 @@ function createRealProcessInfoProvider() {
|
|
|
442424
442470
|
|
|
442425
442471
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
442426
442472
|
import * as fs30 from "fs";
|
|
442427
|
-
import { homedir as
|
|
442473
|
+
import { homedir as homedir39 } from "os";
|
|
442428
442474
|
import * as path29 from "path";
|
|
442429
442475
|
|
|
442430
442476
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -443204,7 +443250,7 @@ var NotificationConfigSchema = z41.object({
|
|
|
443204
443250
|
force_enable: z41.boolean().optional()
|
|
443205
443251
|
});
|
|
443206
443252
|
// packages/omo-opencode/src/config/schema/oh-my-opencode-config.ts
|
|
443207
|
-
import { z as
|
|
443253
|
+
import { z as z64 } from "zod";
|
|
443208
443254
|
|
|
443209
443255
|
// packages/omo-opencode/src/config/schema/agent-definitions.ts
|
|
443210
443256
|
import { z as z42 } from "zod";
|
|
@@ -444060,199 +444106,192 @@ class WhatsAppAdapter {
|
|
|
444060
444106
|
// packages/omo-opencode/src/config/schema/gateway.ts
|
|
444061
444107
|
var GatewayConfigSectionSchema = GatewayConfigSchema.optional();
|
|
444062
444108
|
|
|
444063
|
-
// packages/omo-opencode/src/config/schema/
|
|
444109
|
+
// packages/omo-opencode/src/config/schema/monitor.ts
|
|
444064
444110
|
import { z as z46 } from "zod";
|
|
444065
|
-
var
|
|
444066
|
-
enabled: z46.boolean().
|
|
444067
|
-
|
|
444111
|
+
var MonitorConfigSchema = z46.object({
|
|
444112
|
+
enabled: z46.boolean().default(false),
|
|
444113
|
+
live_mode_enabled: z46.boolean().default(false),
|
|
444114
|
+
allowed_commands: z46.array(z46.string()).optional(),
|
|
444115
|
+
max_monitors_per_session: z46.number().int().min(1).max(16).default(3),
|
|
444116
|
+
max_runtime_ms: z46.number().int().min(1000).default(1800000),
|
|
444117
|
+
batch_max_lines: z46.number().int().min(1).default(50),
|
|
444118
|
+
batch_max_bytes: z46.number().int().min(1024).default(16384),
|
|
444119
|
+
flush_interval_ms: z46.number().int().min(250).default(1000),
|
|
444120
|
+
ring_max_lines: z46.number().int().min(1).default(1000),
|
|
444121
|
+
line_max_bytes: z46.number().int().min(256).default(8192),
|
|
444122
|
+
pattern_max_length: z46.number().int().min(1).default(512)
|
|
444068
444123
|
});
|
|
444069
444124
|
|
|
444070
|
-
// packages/omo-opencode/src/config/schema/
|
|
444125
|
+
// packages/omo-opencode/src/config/schema/ralph-loop.ts
|
|
444071
444126
|
import { z as z47 } from "zod";
|
|
444072
|
-
var
|
|
444127
|
+
var RalphLoopConfigSchema = z47.object({
|
|
444073
444128
|
enabled: z47.boolean().default(false),
|
|
444074
|
-
|
|
444075
|
-
|
|
444076
|
-
|
|
444077
|
-
max_runtime_ms: z47.number().int().min(1000).default(1800000),
|
|
444078
|
-
batch_max_lines: z47.number().int().min(1).default(50),
|
|
444079
|
-
batch_max_bytes: z47.number().int().min(1024).default(16384),
|
|
444080
|
-
flush_interval_ms: z47.number().int().min(250).default(1000),
|
|
444081
|
-
ring_max_lines: z47.number().int().min(1).default(1000),
|
|
444082
|
-
line_max_bytes: z47.number().int().min(256).default(8192),
|
|
444083
|
-
pattern_max_length: z47.number().int().min(1).default(512)
|
|
444084
|
-
});
|
|
444085
|
-
|
|
444086
|
-
// packages/omo-opencode/src/config/schema/ralph-loop.ts
|
|
444087
|
-
import { z as z48 } from "zod";
|
|
444088
|
-
var RalphLoopConfigSchema = z48.object({
|
|
444089
|
-
enabled: z48.boolean().default(false),
|
|
444090
|
-
default_max_iterations: z48.number().min(1).max(1000).default(100),
|
|
444091
|
-
state_dir: z48.string().optional(),
|
|
444092
|
-
default_strategy: z48.enum(["reset", "continue"]).default("continue")
|
|
444129
|
+
default_max_iterations: z47.number().min(1).max(1000).default(100),
|
|
444130
|
+
state_dir: z47.string().optional(),
|
|
444131
|
+
default_strategy: z47.enum(["reset", "continue"]).default("continue")
|
|
444093
444132
|
});
|
|
444094
444133
|
|
|
444095
444134
|
// packages/omo-opencode/src/config/schema/runtime-fallback.ts
|
|
444096
|
-
import { z as
|
|
444097
|
-
var RuntimeFallbackConfigSchema =
|
|
444098
|
-
enabled:
|
|
444099
|
-
retry_on_errors:
|
|
444100
|
-
max_fallback_attempts:
|
|
444101
|
-
cooldown_seconds:
|
|
444102
|
-
timeout_seconds:
|
|
444103
|
-
notify_on_fallback:
|
|
444104
|
-
restore_primary_after_cooldown:
|
|
444135
|
+
import { z as z48 } from "zod";
|
|
444136
|
+
var RuntimeFallbackConfigSchema = z48.object({
|
|
444137
|
+
enabled: z48.boolean().optional(),
|
|
444138
|
+
retry_on_errors: z48.array(z48.number()).optional(),
|
|
444139
|
+
max_fallback_attempts: z48.number().min(1).max(20).optional(),
|
|
444140
|
+
cooldown_seconds: z48.number().min(0).optional(),
|
|
444141
|
+
timeout_seconds: z48.number().min(0).optional(),
|
|
444142
|
+
notify_on_fallback: z48.boolean().optional(),
|
|
444143
|
+
restore_primary_after_cooldown: z48.boolean().optional()
|
|
444105
444144
|
});
|
|
444106
444145
|
|
|
444107
444146
|
// packages/team-core/src/config.ts
|
|
444108
|
-
import * as
|
|
444109
|
-
var TeamModeConfigSchema =
|
|
444110
|
-
enabled:
|
|
444111
|
-
tmux_visualization:
|
|
444112
|
-
max_parallel_members:
|
|
444113
|
-
max_members:
|
|
444114
|
-
max_messages_per_run:
|
|
444115
|
-
max_wall_clock_minutes:
|
|
444116
|
-
max_member_turns:
|
|
444117
|
-
base_dir:
|
|
444118
|
-
message_payload_max_bytes:
|
|
444119
|
-
recipient_unread_max_bytes:
|
|
444120
|
-
mailbox_poll_interval_ms:
|
|
444147
|
+
import * as z49 from "zod";
|
|
444148
|
+
var TeamModeConfigSchema = z49.object({
|
|
444149
|
+
enabled: z49.boolean().default(false),
|
|
444150
|
+
tmux_visualization: z49.boolean().default(false),
|
|
444151
|
+
max_parallel_members: z49.number().int().min(1).max(8).default(4),
|
|
444152
|
+
max_members: z49.number().int().min(1).max(8).default(8),
|
|
444153
|
+
max_messages_per_run: z49.number().int().min(1).default(1e4),
|
|
444154
|
+
max_wall_clock_minutes: z49.number().int().min(1).default(120),
|
|
444155
|
+
max_member_turns: z49.number().int().min(1).default(500),
|
|
444156
|
+
base_dir: z49.string().optional(),
|
|
444157
|
+
message_payload_max_bytes: z49.number().int().min(1024).default(32768),
|
|
444158
|
+
recipient_unread_max_bytes: z49.number().int().min(1024).default(262144),
|
|
444159
|
+
mailbox_poll_interval_ms: z49.number().int().min(500).default(3000)
|
|
444121
444160
|
});
|
|
444122
444161
|
// packages/omo-opencode/src/config/schema/skills.ts
|
|
444123
|
-
import { z as
|
|
444124
|
-
var SkillSourceSchema =
|
|
444125
|
-
|
|
444126
|
-
|
|
444127
|
-
path:
|
|
444128
|
-
recursive:
|
|
444129
|
-
glob:
|
|
444162
|
+
import { z as z50 } from "zod";
|
|
444163
|
+
var SkillSourceSchema = z50.union([
|
|
444164
|
+
z50.string(),
|
|
444165
|
+
z50.object({
|
|
444166
|
+
path: z50.string(),
|
|
444167
|
+
recursive: z50.boolean().optional(),
|
|
444168
|
+
glob: z50.string().optional()
|
|
444130
444169
|
})
|
|
444131
444170
|
]);
|
|
444132
|
-
var SkillDefinitionSchema =
|
|
444133
|
-
description:
|
|
444134
|
-
template:
|
|
444135
|
-
from:
|
|
444136
|
-
model:
|
|
444137
|
-
agent:
|
|
444138
|
-
subtask:
|
|
444139
|
-
"argument-hint":
|
|
444140
|
-
license:
|
|
444141
|
-
compatibility:
|
|
444142
|
-
metadata:
|
|
444143
|
-
"allowed-tools":
|
|
444144
|
-
disable:
|
|
444145
|
-
});
|
|
444146
|
-
var SkillEntrySchema =
|
|
444147
|
-
var SkillsConfigSchema =
|
|
444148
|
-
|
|
444149
|
-
|
|
444150
|
-
sources:
|
|
444151
|
-
enable:
|
|
444152
|
-
disable:
|
|
444171
|
+
var SkillDefinitionSchema = z50.object({
|
|
444172
|
+
description: z50.string().optional(),
|
|
444173
|
+
template: z50.string().optional(),
|
|
444174
|
+
from: z50.string().optional(),
|
|
444175
|
+
model: z50.string().optional(),
|
|
444176
|
+
agent: z50.string().optional(),
|
|
444177
|
+
subtask: z50.boolean().optional(),
|
|
444178
|
+
"argument-hint": z50.string().optional(),
|
|
444179
|
+
license: z50.string().optional(),
|
|
444180
|
+
compatibility: z50.string().optional(),
|
|
444181
|
+
metadata: z50.record(z50.string(), z50.unknown()).optional(),
|
|
444182
|
+
"allowed-tools": z50.array(z50.string()).optional(),
|
|
444183
|
+
disable: z50.boolean().optional()
|
|
444184
|
+
});
|
|
444185
|
+
var SkillEntrySchema = z50.union([z50.boolean(), SkillDefinitionSchema]);
|
|
444186
|
+
var SkillsConfigSchema = z50.union([
|
|
444187
|
+
z50.array(z50.string()),
|
|
444188
|
+
z50.object({
|
|
444189
|
+
sources: z50.array(SkillSourceSchema).optional(),
|
|
444190
|
+
enable: z50.array(z50.string()).optional(),
|
|
444191
|
+
disable: z50.array(z50.string()).optional()
|
|
444153
444192
|
}).catchall(SkillEntrySchema)
|
|
444154
444193
|
]);
|
|
444155
444194
|
|
|
444156
444195
|
// packages/omo-opencode/src/config/schema/morpheus.ts
|
|
444157
|
-
import { z as
|
|
444158
|
-
var MorpheusTasksConfigSchema =
|
|
444159
|
-
storage_path:
|
|
444160
|
-
task_list_id:
|
|
444161
|
-
claude_code_compat:
|
|
444196
|
+
import { z as z51 } from "zod";
|
|
444197
|
+
var MorpheusTasksConfigSchema = z51.object({
|
|
444198
|
+
storage_path: z51.string().optional(),
|
|
444199
|
+
task_list_id: z51.string().optional(),
|
|
444200
|
+
claude_code_compat: z51.boolean().default(false)
|
|
444162
444201
|
});
|
|
444163
|
-
var MorpheusConfigSchema =
|
|
444202
|
+
var MorpheusConfigSchema = z51.object({
|
|
444164
444203
|
tasks: MorpheusTasksConfigSchema.optional()
|
|
444165
444204
|
});
|
|
444166
444205
|
|
|
444167
444206
|
// packages/omo-opencode/src/config/schema/morpheus-agent.ts
|
|
444168
|
-
import { z as
|
|
444169
|
-
var MorpheusAgentConfigSchema =
|
|
444170
|
-
disabled:
|
|
444171
|
-
default_builder_enabled:
|
|
444172
|
-
planner_enabled:
|
|
444173
|
-
replace_plan:
|
|
444174
|
-
tdd:
|
|
444207
|
+
import { z as z52 } from "zod";
|
|
444208
|
+
var MorpheusAgentConfigSchema = z52.object({
|
|
444209
|
+
disabled: z52.boolean().optional(),
|
|
444210
|
+
default_builder_enabled: z52.boolean().optional(),
|
|
444211
|
+
planner_enabled: z52.boolean().optional(),
|
|
444212
|
+
replace_plan: z52.boolean().optional(),
|
|
444213
|
+
tdd: z52.boolean().default(true).optional()
|
|
444175
444214
|
});
|
|
444176
444215
|
|
|
444177
444216
|
// packages/omo-opencode/src/config/schema/tui.ts
|
|
444178
|
-
import { z as
|
|
444179
|
-
var TuiSidebarConfigSchema =
|
|
444180
|
-
enabled:
|
|
444217
|
+
import { z as z53 } from "zod";
|
|
444218
|
+
var TuiSidebarConfigSchema = z53.object({
|
|
444219
|
+
enabled: z53.boolean().default(true)
|
|
444181
444220
|
});
|
|
444182
|
-
var TuiConfigSchema =
|
|
444221
|
+
var TuiConfigSchema = z53.object({
|
|
444183
444222
|
sidebar: TuiSidebarConfigSchema.default({ enabled: true })
|
|
444184
444223
|
});
|
|
444185
444224
|
|
|
444186
444225
|
// packages/omo-opencode/src/config/schema/start-work.ts
|
|
444187
|
-
import { z as
|
|
444188
|
-
var StartWorkConfigSchema =
|
|
444189
|
-
auto_commit:
|
|
444226
|
+
import { z as z54 } from "zod";
|
|
444227
|
+
var StartWorkConfigSchema = z54.object({
|
|
444228
|
+
auto_commit: z54.boolean().default(true)
|
|
444190
444229
|
});
|
|
444191
444230
|
|
|
444192
444231
|
// packages/omo-opencode/src/config/schema/watchdog.ts
|
|
444193
|
-
import * as
|
|
444194
|
-
var WatchdogConfigSchema =
|
|
444195
|
-
enabled:
|
|
444196
|
-
doomLoopThreshold:
|
|
444197
|
-
softDoomLoopThreshold:
|
|
444198
|
-
stuckTimeoutSec:
|
|
444199
|
-
auditLogPath:
|
|
444200
|
-
recoveryStrategy:
|
|
444201
|
-
hookRecursionWindowMs:
|
|
444202
|
-
hookRecursionThreshold:
|
|
444203
|
-
contextBloatMaxTokens:
|
|
444204
|
-
contextBloatStuckSec:
|
|
444205
|
-
zombieSessionIdleSec:
|
|
444206
|
-
runawayTaskTimeoutSec:
|
|
444207
|
-
heartbeatIntervalSec:
|
|
444208
|
-
heartbeatFilePath:
|
|
444209
|
-
fatalMarkerPath:
|
|
444210
|
-
lossThreshold:
|
|
444211
|
-
checkIntervalMs:
|
|
444212
|
-
maxMemoryPercent:
|
|
444213
|
-
maxCpuPercent:
|
|
444214
|
-
samplingWindowSec:
|
|
444215
|
-
cooldownSec:
|
|
444216
|
-
maxConsecutiveRestarts:
|
|
444217
|
-
restartCircuitSec:
|
|
444232
|
+
import * as z55 from "zod";
|
|
444233
|
+
var WatchdogConfigSchema = z55.object({
|
|
444234
|
+
enabled: z55.boolean().default(true),
|
|
444235
|
+
doomLoopThreshold: z55.number().int().positive().max(20).default(3),
|
|
444236
|
+
softDoomLoopThreshold: z55.number().int().positive().max(20).default(5),
|
|
444237
|
+
stuckTimeoutSec: z55.number().int().positive().max(600).default(90),
|
|
444238
|
+
auditLogPath: z55.string().optional(),
|
|
444239
|
+
recoveryStrategy: z55.enum(["nudge", "fallback", "restart", "notify", "safe"]).default("nudge"),
|
|
444240
|
+
hookRecursionWindowMs: z55.number().int().positive().max(60000).default(5000),
|
|
444241
|
+
hookRecursionThreshold: z55.number().int().positive().max(100).default(10),
|
|
444242
|
+
contextBloatMaxTokens: z55.number().int().positive().default(200000),
|
|
444243
|
+
contextBloatStuckSec: z55.number().int().positive().max(600).default(120),
|
|
444244
|
+
zombieSessionIdleSec: z55.number().int().positive().max(600).default(90),
|
|
444245
|
+
runawayTaskTimeoutSec: z55.number().int().positive().max(86400).default(600),
|
|
444246
|
+
heartbeatIntervalSec: z55.number().positive().max(300).default(30),
|
|
444247
|
+
heartbeatFilePath: z55.string().default(".matrixos/tmp/heartbeat"),
|
|
444248
|
+
fatalMarkerPath: z55.string().default(".matrixos/tmp/watchdog-fatal.json"),
|
|
444249
|
+
lossThreshold: z55.number().int().positive().max(20).default(3),
|
|
444250
|
+
checkIntervalMs: z55.number().int().positive().default(1e4),
|
|
444251
|
+
maxMemoryPercent: z55.number().min(1).max(100).default(80),
|
|
444252
|
+
maxCpuPercent: z55.number().min(1).max(100).default(90),
|
|
444253
|
+
samplingWindowSec: z55.number().positive().max(600).default(30),
|
|
444254
|
+
cooldownSec: z55.number().positive().max(3600).default(60),
|
|
444255
|
+
maxConsecutiveRestarts: z55.number().int().positive().max(20).default(3),
|
|
444256
|
+
restartCircuitSec: z55.number().positive().max(3600).default(300)
|
|
444218
444257
|
}).strict();
|
|
444219
444258
|
|
|
444220
444259
|
// packages/omo-opencode/src/config/schema/websearch.ts
|
|
444221
|
-
import { z as
|
|
444222
|
-
var WebsearchProviderSchema =
|
|
444223
|
-
var WebsearchConfigSchema =
|
|
444260
|
+
import { z as z56 } from "zod";
|
|
444261
|
+
var WebsearchProviderSchema = z56.enum(["exa", "tavily"]);
|
|
444262
|
+
var WebsearchConfigSchema = z56.object({
|
|
444224
444263
|
provider: WebsearchProviderSchema.optional()
|
|
444225
444264
|
});
|
|
444226
444265
|
|
|
444227
444266
|
// packages/omo-opencode/src/config/schema/oh-my-opencode-config.ts
|
|
444228
444267
|
init_src3();
|
|
444229
|
-
var OhMyOpenCodeConfigSchema =
|
|
444230
|
-
$schema:
|
|
444231
|
-
new_task_system_enabled:
|
|
444232
|
-
default_run_agent:
|
|
444233
|
-
agent_order:
|
|
444268
|
+
var OhMyOpenCodeConfigSchema = z64.object({
|
|
444269
|
+
$schema: z64.string().optional(),
|
|
444270
|
+
new_task_system_enabled: z64.boolean().optional(),
|
|
444271
|
+
default_run_agent: z64.string().optional(),
|
|
444272
|
+
agent_order: z64.array(z64.string().max(128)).max(64).optional(),
|
|
444234
444273
|
agent_definitions: AgentDefinitionsConfigSchema,
|
|
444235
|
-
disabled_mcps:
|
|
444236
|
-
disabled_agents:
|
|
444237
|
-
disabled_skills:
|
|
444238
|
-
disabled_hooks:
|
|
444239
|
-
disabled_commands:
|
|
444240
|
-
disabled_tools:
|
|
444241
|
-
disabled_providers:
|
|
444242
|
-
mcp_env_allowlist:
|
|
444243
|
-
hashline_edit:
|
|
444244
|
-
telemetry:
|
|
444245
|
-
model_fallback:
|
|
444274
|
+
disabled_mcps: z64.array(AnyMcpNameSchema).optional(),
|
|
444275
|
+
disabled_agents: z64.array(z64.string()).optional(),
|
|
444276
|
+
disabled_skills: z64.array(z64.string()).optional(),
|
|
444277
|
+
disabled_hooks: z64.array(z64.string()).optional(),
|
|
444278
|
+
disabled_commands: z64.array(BuiltinCommandNameSchema).optional(),
|
|
444279
|
+
disabled_tools: z64.array(z64.string()).optional(),
|
|
444280
|
+
disabled_providers: z64.array(z64.string()).optional(),
|
|
444281
|
+
mcp_env_allowlist: z64.array(z64.string()).optional(),
|
|
444282
|
+
hashline_edit: z64.boolean().optional(),
|
|
444283
|
+
telemetry: z64.boolean().optional().describe("Enable or disable anonymous telemetry. Default: enabled when omitted. Set to false to disable. Independent of codegraph.telemetry."),
|
|
444284
|
+
model_fallback: z64.boolean().optional(),
|
|
444246
444285
|
agents: AgentOverridesSchema.optional(),
|
|
444247
444286
|
categories: CategoriesConfigSchema.optional(),
|
|
444248
444287
|
claude_code: ClaudeCodeConfigSchema.optional(),
|
|
444249
444288
|
morpheus_agent: MorpheusAgentConfigSchema.optional(),
|
|
444250
444289
|
comment_checker: CommentCheckerConfigSchema.optional(),
|
|
444251
444290
|
experimental: ExperimentalConfigSchema.optional(),
|
|
444252
|
-
auto_update:
|
|
444291
|
+
auto_update: z64.boolean().optional(),
|
|
444253
444292
|
skills: SkillsConfigSchema.optional(),
|
|
444254
444293
|
ralph_loop: RalphLoopConfigSchema.optional(),
|
|
444255
|
-
runtime_fallback:
|
|
444294
|
+
runtime_fallback: z64.union([z64.boolean(), RuntimeFallbackConfigSchema]).optional(),
|
|
444256
444295
|
background_task: BackgroundTaskConfigSchema.optional(),
|
|
444257
444296
|
notification: NotificationConfigSchema.optional(),
|
|
444258
444297
|
model_capabilities: ModelCapabilitiesConfigSchema.optional(),
|
|
@@ -444280,19 +444319,18 @@ var OhMyOpenCodeConfigSchema = z65.object({
|
|
|
444280
444319
|
egress: EgressConfigSectionSchema,
|
|
444281
444320
|
cron: CronConfigSchema.optional(),
|
|
444282
444321
|
default_mode: DefaultModeConfigSchema.optional(),
|
|
444283
|
-
memory: MemoryConfigSchema.optional(),
|
|
444284
444322
|
dreamer: DreamerConfigSchema.optional(),
|
|
444285
444323
|
profiles: ProfileReferencesSchema.optional(),
|
|
444286
444324
|
profileRegistry: ProfileRegistrySchema.optional(),
|
|
444287
|
-
profile_agent_defs:
|
|
444288
|
-
_migrations:
|
|
444289
|
-
cost_management:
|
|
444290
|
-
enabled:
|
|
444291
|
-
session_budget_usd:
|
|
444292
|
-
daily_budget_usd:
|
|
444293
|
-
monthly_budget_usd:
|
|
444294
|
-
alert_threshold_pct:
|
|
444295
|
-
auto_downgrade_at_pct:
|
|
444325
|
+
profile_agent_defs: z64.record(z64.string(), z64.any()).optional(),
|
|
444326
|
+
_migrations: z64.array(z64.string()).optional(),
|
|
444327
|
+
cost_management: z64.object({
|
|
444328
|
+
enabled: z64.boolean().default(true),
|
|
444329
|
+
session_budget_usd: z64.number().nonnegative().default(5),
|
|
444330
|
+
daily_budget_usd: z64.number().nonnegative().default(20),
|
|
444331
|
+
monthly_budget_usd: z64.number().nonnegative().default(500),
|
|
444332
|
+
alert_threshold_pct: z64.array(z64.number().min(0).max(1)).default([0.5, 0.8, 1]),
|
|
444333
|
+
auto_downgrade_at_pct: z64.number().min(0).max(100).default(80)
|
|
444296
444334
|
}).optional()
|
|
444297
444335
|
});
|
|
444298
444336
|
// packages/omo-opencode/src/shared/disabled-providers.ts
|
|
@@ -444515,7 +444553,7 @@ function loadConfigFromPath2(configPath, _ctx) {
|
|
|
444515
444553
|
|
|
444516
444554
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
444517
444555
|
function resolveHomeDirectory() {
|
|
444518
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
444556
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir39();
|
|
444519
444557
|
}
|
|
444520
444558
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
444521
444559
|
if (!path29.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -444980,22 +445018,22 @@ init_plugin_identity();
|
|
|
444980
445018
|
// packages/telemetry-core/src/activity-state.ts
|
|
444981
445019
|
init_atomic_write();
|
|
444982
445020
|
init_xdg_data_dir();
|
|
444983
|
-
import { existsSync as
|
|
444984
|
-
import { basename as basename26, join as
|
|
445021
|
+
import { existsSync as existsSync122, mkdirSync as mkdirSync28, readFileSync as readFileSync83 } from "fs";
|
|
445022
|
+
import { basename as basename26, join as join146 } from "path";
|
|
444985
445023
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
444986
445024
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
444987
445025
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
444988
445026
|
env: options.env,
|
|
444989
445027
|
osProvider: options.osProvider
|
|
444990
445028
|
});
|
|
444991
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
445029
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join146(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
444992
445030
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename26(dataDir) === product.cacheDirName) {
|
|
444993
445031
|
return dataDir;
|
|
444994
445032
|
}
|
|
444995
|
-
return
|
|
445033
|
+
return join146(dataDir, product.cacheDirName);
|
|
444996
445034
|
}
|
|
444997
445035
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
444998
|
-
return
|
|
445036
|
+
return join146(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
444999
445037
|
}
|
|
445000
445038
|
function getDailyActiveCaptureState(input2) {
|
|
445001
445039
|
const state3 = readPostHogActivityState(input2.stateDir, input2.diagnostics);
|
|
@@ -445020,11 +445058,11 @@ function isPostHogActivityState(value) {
|
|
|
445020
445058
|
}
|
|
445021
445059
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
445022
445060
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
445023
|
-
if (!
|
|
445061
|
+
if (!existsSync122(stateFilePath)) {
|
|
445024
445062
|
return {};
|
|
445025
445063
|
}
|
|
445026
445064
|
try {
|
|
445027
|
-
const stateContent =
|
|
445065
|
+
const stateContent = readFileSync83(stateFilePath, "utf-8");
|
|
445028
445066
|
const stateJson = JSON.parse(stateContent);
|
|
445029
445067
|
if (!isPostHogActivityState(stateJson)) {
|
|
445030
445068
|
return {};
|
|
@@ -445043,7 +445081,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
445043
445081
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
445044
445082
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
445045
445083
|
try {
|
|
445046
|
-
|
|
445084
|
+
mkdirSync28(stateDir, { recursive: true });
|
|
445047
445085
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
445048
445086
|
`);
|
|
445049
445087
|
} catch (error) {
|
|
@@ -445108,7 +445146,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
445108
445146
|
}
|
|
445109
445147
|
|
|
445110
445148
|
// node_modules/.bun/posthog-node@5.45.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
445111
|
-
import { dirname as
|
|
445149
|
+
import { dirname as dirname50, posix as posix7, sep as sep3 } from "path";
|
|
445112
445150
|
function createModulerModifier() {
|
|
445113
445151
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
445114
445152
|
return async (frames) => {
|
|
@@ -445117,7 +445155,7 @@ function createModulerModifier() {
|
|
|
445117
445155
|
return frames;
|
|
445118
445156
|
};
|
|
445119
445157
|
}
|
|
445120
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
445158
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname50(process.argv[1]) : process.cwd(), isWindows2 = sep3 === "\\") {
|
|
445121
445159
|
const normalizedBase = isWindows2 ? normalizeWindowsPath(basePath) : basePath;
|
|
445122
445160
|
return (filename) => {
|
|
445123
445161
|
if (!filename)
|
|
@@ -451853,13 +451891,13 @@ function createGatewayRelayHandler(deps) {
|
|
|
451853
451891
|
}
|
|
451854
451892
|
|
|
451855
451893
|
// packages/daily-brief-core/src/schema.ts
|
|
451856
|
-
import * as
|
|
451857
|
-
var DailyBriefConfigSchema =
|
|
451858
|
-
hour:
|
|
451859
|
-
minute:
|
|
451860
|
-
channel:
|
|
451861
|
-
recipient_id:
|
|
451862
|
-
max_tasks:
|
|
451894
|
+
import * as z65 from "zod";
|
|
451895
|
+
var DailyBriefConfigSchema = z65.object({
|
|
451896
|
+
hour: z65.number().int().min(0).max(23).default(7),
|
|
451897
|
+
minute: z65.number().int().min(0).max(59).default(0),
|
|
451898
|
+
channel: z65.enum(["telegram", "discord", "whatsapp"]).default("telegram"),
|
|
451899
|
+
recipient_id: z65.string().min(1),
|
|
451900
|
+
max_tasks: z65.number().int().positive().default(20)
|
|
451863
451901
|
}).strict();
|
|
451864
451902
|
|
|
451865
451903
|
// packages/daily-brief-core/src/formatter.ts
|
|
@@ -451988,61 +452026,61 @@ function createTelegramBriefSender(config3, bot) {
|
|
|
451988
452026
|
}
|
|
451989
452027
|
|
|
451990
452028
|
// packages/task-ledger-core/src/schema.ts
|
|
451991
|
-
import * as
|
|
451992
|
-
var TaskSourceSchema =
|
|
451993
|
-
var TaskStatusSchema3 =
|
|
452029
|
+
import * as z66 from "zod";
|
|
452030
|
+
var TaskSourceSchema = z66.enum(["webhook", "cron", "user", "kanban"]);
|
|
452031
|
+
var TaskStatusSchema3 = z66.enum([
|
|
451994
452032
|
"pending",
|
|
451995
452033
|
"running",
|
|
451996
452034
|
"done",
|
|
451997
452035
|
"failed",
|
|
451998
452036
|
"cancelled"
|
|
451999
452037
|
]);
|
|
452000
|
-
var TaskPrioritySchema =
|
|
452001
|
-
var TaskSchema3 =
|
|
452002
|
-
id:
|
|
452038
|
+
var TaskPrioritySchema = z66.enum(["high", "medium", "low"]);
|
|
452039
|
+
var TaskSchema3 = z66.object({
|
|
452040
|
+
id: z66.string().min(1),
|
|
452003
452041
|
source: TaskSourceSchema,
|
|
452004
|
-
context:
|
|
452042
|
+
context: z66.string().nullable(),
|
|
452005
452043
|
status: TaskStatusSchema3,
|
|
452006
452044
|
priority: TaskPrioritySchema.nullable(),
|
|
452007
|
-
payload:
|
|
452008
|
-
agent_assigned:
|
|
452009
|
-
session_id:
|
|
452010
|
-
result:
|
|
452011
|
-
cost_tokens:
|
|
452012
|
-
cost_usd:
|
|
452013
|
-
created_at:
|
|
452014
|
-
started_at:
|
|
452015
|
-
completed_at:
|
|
452045
|
+
payload: z66.string(),
|
|
452046
|
+
agent_assigned: z66.string().nullable(),
|
|
452047
|
+
session_id: z66.string().nullable(),
|
|
452048
|
+
result: z66.string().nullable(),
|
|
452049
|
+
cost_tokens: z66.number().int().nonnegative().default(0),
|
|
452050
|
+
cost_usd: z66.number().nonnegative().default(0),
|
|
452051
|
+
created_at: z66.number().int(),
|
|
452052
|
+
started_at: z66.number().int().nullable(),
|
|
452053
|
+
completed_at: z66.number().int().nullable()
|
|
452016
452054
|
}).strict();
|
|
452017
|
-
var TaskInsertSchema =
|
|
452018
|
-
id:
|
|
452055
|
+
var TaskInsertSchema = z66.object({
|
|
452056
|
+
id: z66.string().min(1).optional(),
|
|
452019
452057
|
source: TaskSourceSchema,
|
|
452020
|
-
context:
|
|
452058
|
+
context: z66.string().nullable().optional(),
|
|
452021
452059
|
status: TaskStatusSchema3.optional(),
|
|
452022
452060
|
priority: TaskPrioritySchema.nullable().optional(),
|
|
452023
|
-
payload:
|
|
452024
|
-
agent_assigned:
|
|
452025
|
-
session_id:
|
|
452026
|
-
cost_tokens:
|
|
452027
|
-
cost_usd:
|
|
452061
|
+
payload: z66.string(),
|
|
452062
|
+
agent_assigned: z66.string().nullable().optional(),
|
|
452063
|
+
session_id: z66.string().nullable().optional(),
|
|
452064
|
+
cost_tokens: z66.number().int().nonnegative().optional(),
|
|
452065
|
+
cost_usd: z66.number().nonnegative().optional()
|
|
452028
452066
|
}).strict();
|
|
452029
|
-
var TaskPatchSchema =
|
|
452067
|
+
var TaskPatchSchema = z66.object({
|
|
452030
452068
|
status: TaskStatusSchema3.optional(),
|
|
452031
452069
|
priority: TaskPrioritySchema.nullable().optional(),
|
|
452032
|
-
agent_assigned:
|
|
452033
|
-
session_id:
|
|
452034
|
-
result:
|
|
452035
|
-
cost_tokens:
|
|
452036
|
-
cost_usd:
|
|
452037
|
-
started_at:
|
|
452038
|
-
completed_at:
|
|
452070
|
+
agent_assigned: z66.string().nullable().optional(),
|
|
452071
|
+
session_id: z66.string().nullable().optional(),
|
|
452072
|
+
result: z66.string().nullable().optional(),
|
|
452073
|
+
cost_tokens: z66.number().int().nonnegative().optional(),
|
|
452074
|
+
cost_usd: z66.number().nonnegative().optional(),
|
|
452075
|
+
started_at: z66.number().int().nullable().optional(),
|
|
452076
|
+
completed_at: z66.number().int().nullable().optional()
|
|
452039
452077
|
}).strict();
|
|
452040
|
-
var TaskFilterSchema =
|
|
452078
|
+
var TaskFilterSchema = z66.object({
|
|
452041
452079
|
source: TaskSourceSchema.optional(),
|
|
452042
|
-
context:
|
|
452080
|
+
context: z66.string().optional(),
|
|
452043
452081
|
status: TaskStatusSchema3.optional(),
|
|
452044
|
-
agent_assigned:
|
|
452045
|
-
session_id:
|
|
452082
|
+
agent_assigned: z66.string().optional(),
|
|
452083
|
+
session_id: z66.string().optional(),
|
|
452046
452084
|
priority: TaskPrioritySchema.optional()
|
|
452047
452085
|
}).strict();
|
|
452048
452086
|
|
|
@@ -452296,22 +452334,22 @@ class CronRunner {
|
|
|
452296
452334
|
}
|
|
452297
452335
|
|
|
452298
452336
|
// packages/omo-opencode/src/features/cron/store.ts
|
|
452299
|
-
import * as
|
|
452337
|
+
import * as z67 from "zod";
|
|
452300
452338
|
import { Database as Database4 } from "bun:sqlite";
|
|
452301
|
-
import { homedir as
|
|
452339
|
+
import { homedir as homedir40 } from "os";
|
|
452302
452340
|
import { resolve as resolve44 } from "path";
|
|
452303
|
-
var CronJobSchema =
|
|
452304
|
-
id:
|
|
452305
|
-
name:
|
|
452306
|
-
schedule:
|
|
452307
|
-
command:
|
|
452308
|
-
channel:
|
|
452309
|
-
recipient:
|
|
452310
|
-
enabled:
|
|
452311
|
-
createdAt:
|
|
452312
|
-
updatedAt:
|
|
452341
|
+
var CronJobSchema = z67.object({
|
|
452342
|
+
id: z67.string().min(1),
|
|
452343
|
+
name: z67.string().min(1).max(100),
|
|
452344
|
+
schedule: z67.string().min(1).max(100),
|
|
452345
|
+
command: z67.string().min(1),
|
|
452346
|
+
channel: z67.enum(["telegram", "discord", "whatsapp"]).optional(),
|
|
452347
|
+
recipient: z67.string().optional(),
|
|
452348
|
+
enabled: z67.boolean().default(true),
|
|
452349
|
+
createdAt: z67.string(),
|
|
452350
|
+
updatedAt: z67.string()
|
|
452313
452351
|
}).strict();
|
|
452314
|
-
var DB_PATH = resolve44(
|
|
452352
|
+
var DB_PATH = resolve44(homedir40(), ".local", "share", "opencode", "opencode.db");
|
|
452315
452353
|
function openDb() {
|
|
452316
452354
|
const db = new Database4(DB_PATH);
|
|
452317
452355
|
db.run(`CREATE TABLE IF NOT EXISTS matrixos_cron (
|