@kl-c/matrixos 0.1.22 → 0.1.24
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/config-manager/load-gateway-env.d.ts +11 -0
- package/dist/cli/config-manager/write-gateway-env.d.ts +7 -2
- package/dist/cli/gateway-set-token.d.ts +12 -0
- package/dist/cli/index.js +295 -104
- package/dist/cli-node/index.js +295 -104
- package/dist/config/schema/dashboard.d.ts +7 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +5 -0
- package/dist/config/schema.d.ts +1 -0
- package/dist/features/dashboard/frontend/css/style.css +12 -0
- package/dist/features/dashboard/frontend/index.html +1 -0
- package/dist/features/dashboard/frontend/js/api.js +2 -2
- package/dist/features/dashboard/frontend/js/app.js +60 -0
- package/dist/features/dashboard/gateway-token-handler.d.ts +10 -0
- package/dist/features/dashboard/server.d.ts +2 -0
- package/dist/index.js +1298 -1169
- package/dist/matrixos.schema.json +17 -0
- package/dist/shared/gateway-token-resolver.d.ts +1 -0
- package/dist/tui.js +14 -0
- package/package.json +1 -1
package/dist/cli-node/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "@kl-c/matrixos",
|
|
2148
|
-
version: "0.1.
|
|
2148
|
+
version: "0.1.24",
|
|
2149
2149
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -67078,6 +67078,48 @@ var require_src = __commonJS((exports, module2) => {
|
|
|
67078
67078
|
module2.exports = { cursor, scroll, erase, beep };
|
|
67079
67079
|
});
|
|
67080
67080
|
|
|
67081
|
+
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
67082
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
67083
|
+
import { join as join26 } from "path";
|
|
67084
|
+
function writeGatewayEnvToken(key, token) {
|
|
67085
|
+
const configDir = getConfigDir();
|
|
67086
|
+
if (!existsSync26(configDir))
|
|
67087
|
+
mkdirSync9(configDir, { recursive: true });
|
|
67088
|
+
const envPath = join26(configDir, GATEWAY_ENV_FILENAME);
|
|
67089
|
+
const entries = new Map;
|
|
67090
|
+
if (existsSync26(envPath)) {
|
|
67091
|
+
const existing = readFileSync15(envPath, "utf-8");
|
|
67092
|
+
for (const rawLine of existing.split(`
|
|
67093
|
+
`)) {
|
|
67094
|
+
const line = rawLine.trim();
|
|
67095
|
+
if (line.length === 0 || line.startsWith("#"))
|
|
67096
|
+
continue;
|
|
67097
|
+
const withoutExport = line.replace(/^(export\s+)/i, "");
|
|
67098
|
+
const eqIndex = withoutExport.indexOf("=");
|
|
67099
|
+
if (eqIndex === -1)
|
|
67100
|
+
continue;
|
|
67101
|
+
const k = withoutExport.slice(0, eqIndex).trim();
|
|
67102
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k))
|
|
67103
|
+
continue;
|
|
67104
|
+
entries.set(k, withoutExport.slice(eqIndex + 1).trim());
|
|
67105
|
+
}
|
|
67106
|
+
}
|
|
67107
|
+
entries.set(key, token);
|
|
67108
|
+
const next = [...entries.entries()].map(([k, v]) => `${k}=${v}`).join(`
|
|
67109
|
+
`) + `
|
|
67110
|
+
`;
|
|
67111
|
+
writeFileSync6(envPath, next, { mode: 384 });
|
|
67112
|
+
chmodSync3(envPath, 384);
|
|
67113
|
+
return envPath;
|
|
67114
|
+
}
|
|
67115
|
+
function writeGatewayEnv(token) {
|
|
67116
|
+
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
67117
|
+
}
|
|
67118
|
+
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
67119
|
+
var init_write_gateway_env = __esm(() => {
|
|
67120
|
+
init_config_context();
|
|
67121
|
+
});
|
|
67122
|
+
|
|
67081
67123
|
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
67082
67124
|
function $constructor(name2, initializer, params) {
|
|
67083
67125
|
function init(inst, def) {
|
|
@@ -107576,7 +107618,7 @@ var require_filesystem = __commonJS((exports2, module2) => {
|
|
|
107576
107618
|
var LDD_PATH = "/usr/bin/ldd";
|
|
107577
107619
|
var SELF_PATH = "/proc/self/exe";
|
|
107578
107620
|
var MAX_LENGTH = 2048;
|
|
107579
|
-
var
|
|
107621
|
+
var readFileSync45 = (path18) => {
|
|
107580
107622
|
const fd = fs17.openSync(path18, "r");
|
|
107581
107623
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
107582
107624
|
const bytesRead = fs17.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -107599,7 +107641,7 @@ var require_filesystem = __commonJS((exports2, module2) => {
|
|
|
107599
107641
|
module2.exports = {
|
|
107600
107642
|
LDD_PATH,
|
|
107601
107643
|
SELF_PATH,
|
|
107602
|
-
readFileSync:
|
|
107644
|
+
readFileSync: readFileSync45,
|
|
107603
107645
|
readFile
|
|
107604
107646
|
};
|
|
107605
107647
|
});
|
|
@@ -107642,7 +107684,7 @@ var require_elf = __commonJS((exports2, module2) => {
|
|
|
107642
107684
|
var require_detect_libc = __commonJS((exports2, module2) => {
|
|
107643
107685
|
var childProcess = __require("child_process");
|
|
107644
107686
|
var { isLinux, getReport } = require_process();
|
|
107645
|
-
var { LDD_PATH, SELF_PATH, readFile, readFileSync:
|
|
107687
|
+
var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync45 } = require_filesystem();
|
|
107646
107688
|
var { interpreterPath } = require_elf();
|
|
107647
107689
|
var cachedFamilyInterpreter;
|
|
107648
107690
|
var cachedFamilyFilesystem;
|
|
@@ -107733,7 +107775,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107733
107775
|
}
|
|
107734
107776
|
cachedFamilyFilesystem = null;
|
|
107735
107777
|
try {
|
|
107736
|
-
const lddContent =
|
|
107778
|
+
const lddContent = readFileSync45(LDD_PATH);
|
|
107737
107779
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
107738
107780
|
} catch (e) {}
|
|
107739
107781
|
return cachedFamilyFilesystem;
|
|
@@ -107756,7 +107798,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107756
107798
|
}
|
|
107757
107799
|
cachedFamilyInterpreter = null;
|
|
107758
107800
|
try {
|
|
107759
|
-
const selfContent =
|
|
107801
|
+
const selfContent = readFileSync45(SELF_PATH);
|
|
107760
107802
|
const path18 = interpreterPath(selfContent);
|
|
107761
107803
|
cachedFamilyInterpreter = familyFromInterpreterPath(path18);
|
|
107762
107804
|
} catch (e) {}
|
|
@@ -107818,7 +107860,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107818
107860
|
}
|
|
107819
107861
|
cachedVersionFilesystem = null;
|
|
107820
107862
|
try {
|
|
107821
|
-
const lddContent =
|
|
107863
|
+
const lddContent = readFileSync45(LDD_PATH);
|
|
107822
107864
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
107823
107865
|
if (versionMatch) {
|
|
107824
107866
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -117634,19 +117676,19 @@ __export(exports_generate, {
|
|
|
117634
117676
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
117635
117677
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
117636
117678
|
});
|
|
117637
|
-
import { existsSync as existsSync70, readFileSync as
|
|
117638
|
-
import { dirname as dirname28, isAbsolute as isAbsolute6, join as
|
|
117679
|
+
import { existsSync as existsSync70, readFileSync as readFileSync56, realpathSync as realpathSync10 } from "fs";
|
|
117680
|
+
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join76, resolve as resolve16 } from "path";
|
|
117639
117681
|
function profilesDirFor(opts) {
|
|
117640
117682
|
if (opts.profilesDir)
|
|
117641
117683
|
return opts.profilesDir;
|
|
117642
117684
|
if (opts.cwd)
|
|
117643
|
-
return
|
|
117644
|
-
return
|
|
117685
|
+
return join76(opts.cwd, PROFILES_RELATIVE);
|
|
117686
|
+
return join76(REPO_ROOT, PROFILES_RELATIVE);
|
|
117645
117687
|
}
|
|
117646
117688
|
function loadProfile(name2, options = {}) {
|
|
117647
117689
|
const fs21 = options.fs ?? defaultFS2;
|
|
117648
117690
|
const dir = profilesDirFor(options);
|
|
117649
|
-
const path27 =
|
|
117691
|
+
const path27 = join76(dir, `${name2}.json`);
|
|
117650
117692
|
if (!fs21.existsSync(path27)) {
|
|
117651
117693
|
throw new ProfileNotFoundError(name2);
|
|
117652
117694
|
}
|
|
@@ -117659,7 +117701,7 @@ function listProfiles(options = {}) {
|
|
|
117659
117701
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
117660
117702
|
const out = [];
|
|
117661
117703
|
for (const name2 of known) {
|
|
117662
|
-
const path27 =
|
|
117704
|
+
const path27 = join76(dir, `${name2}.json`);
|
|
117663
117705
|
if (fs21.existsSync(path27)) {
|
|
117664
117706
|
try {
|
|
117665
117707
|
const raw = JSON.parse(fs21.readFileSync(path27, "utf-8"));
|
|
@@ -117732,7 +117774,7 @@ var init_generate = __esm(() => {
|
|
|
117732
117774
|
init_src4();
|
|
117733
117775
|
init_src4();
|
|
117734
117776
|
REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
117735
|
-
defaultFS2 = { existsSync: existsSync70, readFileSync:
|
|
117777
|
+
defaultFS2 = { existsSync: existsSync70, readFileSync: readFileSync56, realpathSync: realpathSync10 };
|
|
117736
117778
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
117737
117779
|
profileName;
|
|
117738
117780
|
constructor(profileName) {
|
|
@@ -117884,8 +117926,8 @@ var exports_profile_resolve = {};
|
|
|
117884
117926
|
__export(exports_profile_resolve, {
|
|
117885
117927
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
117886
117928
|
});
|
|
117887
|
-
import { existsSync as existsSync72, readdirSync as readdirSync15, readFileSync as
|
|
117888
|
-
import { join as
|
|
117929
|
+
import { existsSync as existsSync72, readdirSync as readdirSync15, readFileSync as readFileSync57 } from "fs";
|
|
117930
|
+
import { join as join78, resolve as resolve17, dirname as dirname29 } from "path";
|
|
117889
117931
|
function executeProfileResolveCommand(args) {
|
|
117890
117932
|
if (args.options.help) {
|
|
117891
117933
|
return {
|
|
@@ -117910,7 +117952,7 @@ function executeProfileResolveCommand(args) {
|
|
|
117910
117952
|
` };
|
|
117911
117953
|
}
|
|
117912
117954
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
117913
|
-
const profilesDir =
|
|
117955
|
+
const profilesDir = join78(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
117914
117956
|
if (!existsSync72(profilesDir)) {
|
|
117915
117957
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
117916
117958
|
` };
|
|
@@ -117930,8 +117972,8 @@ function executeProfileResolveCommand(args) {
|
|
|
117930
117972
|
const registry2 = {};
|
|
117931
117973
|
for (const file3 of profileFiles) {
|
|
117932
117974
|
try {
|
|
117933
|
-
const filePath =
|
|
117934
|
-
const raw = JSON.parse(
|
|
117975
|
+
const filePath = join78(profilesDir, file3);
|
|
117976
|
+
const raw = JSON.parse(readFileSync57(filePath, "utf-8"));
|
|
117935
117977
|
const profile2 = ProfileSchema.parse(raw);
|
|
117936
117978
|
registry2[profile2.name] = profile2;
|
|
117937
117979
|
} catch {}
|
|
@@ -117993,8 +118035,8 @@ __export(exports_export, {
|
|
|
117993
118035
|
getShell: () => getShell,
|
|
117994
118036
|
executeExportCommand: () => executeExportCommand
|
|
117995
118037
|
});
|
|
117996
|
-
import { existsSync as existsSync73, readFileSync as
|
|
117997
|
-
import { isAbsolute as isAbsolute7, join as
|
|
118038
|
+
import { existsSync as existsSync73, readFileSync as readFileSync58, writeFileSync as writeFileSync25, copyFileSync as copyFileSync7, realpathSync as realpathSync11, mkdirSync as mkdirSync26 } from "fs";
|
|
118039
|
+
import { isAbsolute as isAbsolute7, join as join79, resolve as resolve18, dirname as dirname30 } from "path";
|
|
117998
118040
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
117999
118041
|
function setShell(shell) {
|
|
118000
118042
|
activeShell = shell;
|
|
@@ -118035,7 +118077,7 @@ function executeExportCommand(args) {
|
|
|
118035
118077
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
118036
118078
|
` };
|
|
118037
118079
|
}
|
|
118038
|
-
const pkgPath =
|
|
118080
|
+
const pkgPath = join79(absoluteTargetDir, "package.json");
|
|
118039
118081
|
let pkg;
|
|
118040
118082
|
try {
|
|
118041
118083
|
pkg = JSON.parse(fs21.readFileSync(pkgPath, "utf-8"));
|
|
@@ -118075,7 +118117,7 @@ ${packResult.stdout}
|
|
|
118075
118117
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
118076
118118
|
` };
|
|
118077
118119
|
}
|
|
118078
|
-
let tgzPath =
|
|
118120
|
+
let tgzPath = join79(absoluteTargetDir, tgzName);
|
|
118079
118121
|
if (args.options.output) {
|
|
118080
118122
|
const outputPath = args.options.output;
|
|
118081
118123
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
@@ -118117,7 +118159,7 @@ var init_export = __esm(() => {
|
|
|
118117
118159
|
activeShell = defaultShell;
|
|
118118
118160
|
defaultExportFS = {
|
|
118119
118161
|
existsSync: existsSync73,
|
|
118120
|
-
readFileSync:
|
|
118162
|
+
readFileSync: readFileSync58,
|
|
118121
118163
|
writeFileSync: writeFileSync25,
|
|
118122
118164
|
copyFileSync: copyFileSync7,
|
|
118123
118165
|
realpathSync: realpathSync11,
|
|
@@ -118125,6 +118167,107 @@ var init_export = __esm(() => {
|
|
|
118125
118167
|
};
|
|
118126
118168
|
});
|
|
118127
118169
|
|
|
118170
|
+
// packages/omo-opencode/src/cli/gateway-set-token.ts
|
|
118171
|
+
var exports_gateway_set_token = {};
|
|
118172
|
+
__export(exports_gateway_set_token, {
|
|
118173
|
+
executeGatewaySetTokenCommand: () => executeGatewaySetTokenCommand
|
|
118174
|
+
});
|
|
118175
|
+
function isValidType(type2) {
|
|
118176
|
+
return VALID_TYPES.includes(type2);
|
|
118177
|
+
}
|
|
118178
|
+
async function readMaskedToken(prompt) {
|
|
118179
|
+
return new Promise((resolve19, reject) => {
|
|
118180
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
118181
|
+
reject(new Error("Interactive mode requires a TTY. Use --token <value> instead."));
|
|
118182
|
+
return;
|
|
118183
|
+
}
|
|
118184
|
+
process.stdout.write(prompt);
|
|
118185
|
+
process.stdin.setRawMode(true);
|
|
118186
|
+
process.stdin.resume();
|
|
118187
|
+
process.stdin.setEncoding("utf8");
|
|
118188
|
+
let token = "";
|
|
118189
|
+
const onData = (data) => {
|
|
118190
|
+
const chunk = typeof data === "string" ? data : data.toString("utf8");
|
|
118191
|
+
for (const char of chunk) {
|
|
118192
|
+
const code = char.charCodeAt(0);
|
|
118193
|
+
if (code === 13 || code === 10) {
|
|
118194
|
+
process.stdout.write(`
|
|
118195
|
+
`);
|
|
118196
|
+
process.stdin.setRawMode(false);
|
|
118197
|
+
process.stdin.pause();
|
|
118198
|
+
process.stdin.off("data", onData);
|
|
118199
|
+
resolve19(token);
|
|
118200
|
+
return;
|
|
118201
|
+
}
|
|
118202
|
+
if (code === 127 || code === 8) {
|
|
118203
|
+
if (token.length > 0) {
|
|
118204
|
+
token = token.slice(0, -1);
|
|
118205
|
+
process.stdout.write("\b \b");
|
|
118206
|
+
}
|
|
118207
|
+
continue;
|
|
118208
|
+
}
|
|
118209
|
+
if (code === 3) {
|
|
118210
|
+
process.stdin.setRawMode(false);
|
|
118211
|
+
process.stdin.pause();
|
|
118212
|
+
process.stdin.off("data", onData);
|
|
118213
|
+
process.stdout.write(`
|
|
118214
|
+
`);
|
|
118215
|
+
reject(new Error("Cancelled."));
|
|
118216
|
+
return;
|
|
118217
|
+
}
|
|
118218
|
+
if (code >= 32) {
|
|
118219
|
+
token += char;
|
|
118220
|
+
}
|
|
118221
|
+
}
|
|
118222
|
+
};
|
|
118223
|
+
process.stdin.on("data", onData);
|
|
118224
|
+
});
|
|
118225
|
+
}
|
|
118226
|
+
async function executeGatewaySetTokenCommand(args) {
|
|
118227
|
+
const type2 = args.options.type;
|
|
118228
|
+
if (!isValidType(type2)) {
|
|
118229
|
+
return {
|
|
118230
|
+
exitCode: 1,
|
|
118231
|
+
stdout: `error: invalid type "${type2}". Valid types: ${VALID_TYPES.join(", ")}
|
|
118232
|
+
`
|
|
118233
|
+
};
|
|
118234
|
+
}
|
|
118235
|
+
let token;
|
|
118236
|
+
if (args.options.interactive || !args.options.token) {
|
|
118237
|
+
try {
|
|
118238
|
+
token = await readMaskedToken(`Token ${type2} bot: `);
|
|
118239
|
+
} catch (err) {
|
|
118240
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
118241
|
+
return { exitCode: 1, stdout: `error: ${message}
|
|
118242
|
+
` };
|
|
118243
|
+
}
|
|
118244
|
+
} else {
|
|
118245
|
+
token = args.options.token;
|
|
118246
|
+
}
|
|
118247
|
+
if (!token || token.length === 0) {
|
|
118248
|
+
return { exitCode: 1, stdout: `error: token is required
|
|
118249
|
+
` };
|
|
118250
|
+
}
|
|
118251
|
+
try {
|
|
118252
|
+
const envPath = writeGatewayEnvToken(TYPE_TO_KEY[type2], token);
|
|
118253
|
+
return { exitCode: 0, stdout: `${envPath}
|
|
118254
|
+
` };
|
|
118255
|
+
} catch (err) {
|
|
118256
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
118257
|
+
return { exitCode: 1, stdout: `error: ${message}
|
|
118258
|
+
` };
|
|
118259
|
+
}
|
|
118260
|
+
}
|
|
118261
|
+
var VALID_TYPES, TYPE_TO_KEY;
|
|
118262
|
+
var init_gateway_set_token = __esm(() => {
|
|
118263
|
+
init_write_gateway_env();
|
|
118264
|
+
VALID_TYPES = ["telegram", "discord"];
|
|
118265
|
+
TYPE_TO_KEY = {
|
|
118266
|
+
telegram: "TELEGRAM_BOT_TOKEN",
|
|
118267
|
+
discord: "DISCORD_BOT_TOKEN"
|
|
118268
|
+
};
|
|
118269
|
+
});
|
|
118270
|
+
|
|
118128
118271
|
// packages/omo-opencode/src/cli/rgpd-command.ts
|
|
118129
118272
|
var exports_rgpd_command = {};
|
|
118130
118273
|
__export(exports_rgpd_command, {
|
|
@@ -120724,24 +120867,9 @@ var i2 = `${styleText2("gray", S_BAR)} `;
|
|
|
120724
120867
|
// packages/omo-opencode/src/cli/tui-installer.ts
|
|
120725
120868
|
init_shared();
|
|
120726
120869
|
init_config_manager();
|
|
120870
|
+
init_write_gateway_env();
|
|
120727
120871
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
120728
120872
|
|
|
120729
|
-
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
120730
|
-
init_config_context();
|
|
120731
|
-
import { existsSync as existsSync26, mkdirSync as mkdirSync9, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
120732
|
-
import { join as join26 } from "path";
|
|
120733
|
-
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
120734
|
-
function writeGatewayEnv(token) {
|
|
120735
|
-
const configDir = getConfigDir();
|
|
120736
|
-
if (!existsSync26(configDir))
|
|
120737
|
-
mkdirSync9(configDir, { recursive: true });
|
|
120738
|
-
const envPath = join26(configDir, GATEWAY_ENV_FILENAME);
|
|
120739
|
-
writeFileSync6(envPath, `TELEGRAM_BOT_TOKEN=${token}
|
|
120740
|
-
`, { mode: 384 });
|
|
120741
|
-
chmodSync3(envPath, 384);
|
|
120742
|
-
return envPath;
|
|
120743
|
-
}
|
|
120744
|
-
|
|
120745
120873
|
// packages/omo-opencode/src/cli/tui-install-prompts.ts
|
|
120746
120874
|
init_model_fallback();
|
|
120747
120875
|
|
|
@@ -122143,6 +122271,13 @@ init_zod();
|
|
|
122143
122271
|
var CronConfigSchema = exports_external.object({
|
|
122144
122272
|
enabled: exports_external.boolean().default(true)
|
|
122145
122273
|
}).strict();
|
|
122274
|
+
// packages/omo-opencode/src/config/schema/dashboard.ts
|
|
122275
|
+
init_zod();
|
|
122276
|
+
var DashboardConfigSchema = exports_external.object({
|
|
122277
|
+
enabled: exports_external.boolean().optional(),
|
|
122278
|
+
port: exports_external.number().int().min(1).max(65535).optional(),
|
|
122279
|
+
gateway_passphrase: exports_external.string().optional()
|
|
122280
|
+
});
|
|
122146
122281
|
// packages/omo-opencode/src/config/schema/default-mode.ts
|
|
122147
122282
|
init_zod();
|
|
122148
122283
|
var DefaultModeConfigSchema = exports_external.object({
|
|
@@ -122650,6 +122785,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
|
122650
122785
|
morpheus: MorpheusConfigSchema.optional(),
|
|
122651
122786
|
start_work: StartWorkConfigSchema.optional(),
|
|
122652
122787
|
gateway: GatewayConfigSectionSchema,
|
|
122788
|
+
dashboard: DashboardConfigSchema.optional(),
|
|
122653
122789
|
watchdog: WatchdogConfigSchema.optional(),
|
|
122654
122790
|
egress: EgressConfigSectionSchema,
|
|
122655
122791
|
cron: CronConfigSchema.optional(),
|
|
@@ -123529,7 +123665,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
123529
123665
|
var NOTEPAD_DIR = "notepads";
|
|
123530
123666
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
123531
123667
|
// packages/boulder-state/src/top-level-task.ts
|
|
123532
|
-
import { existsSync as existsSync30, readFileSync as
|
|
123668
|
+
import { existsSync as existsSync30, readFileSync as readFileSync17 } from "fs";
|
|
123533
123669
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
123534
123670
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
123535
123671
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -123556,7 +123692,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
123556
123692
|
return null;
|
|
123557
123693
|
}
|
|
123558
123694
|
try {
|
|
123559
|
-
const content =
|
|
123695
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
123560
123696
|
const lines = content.split(/\r?\n/);
|
|
123561
123697
|
let section = "other";
|
|
123562
123698
|
for (const line of lines) {
|
|
@@ -123608,7 +123744,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
123608
123744
|
return resolveBoulderPlanPath(directory, work);
|
|
123609
123745
|
}
|
|
123610
123746
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
123611
|
-
import { existsSync as existsSync32, readFileSync as
|
|
123747
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
123612
123748
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
123613
123749
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
123614
123750
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -123621,7 +123757,7 @@ function getPlanProgress(planPath) {
|
|
|
123621
123757
|
return { total: 0, completed: 0, isComplete: false };
|
|
123622
123758
|
}
|
|
123623
123759
|
try {
|
|
123624
|
-
const content =
|
|
123760
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
123625
123761
|
const lines = content.split(/\r?\n/);
|
|
123626
123762
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
123627
123763
|
if (hasStructuredSections) {
|
|
@@ -123737,14 +123873,14 @@ function selectMirrorWork(state) {
|
|
|
123737
123873
|
return sorted[0] ?? null;
|
|
123738
123874
|
}
|
|
123739
123875
|
// packages/boulder-state/src/storage/read-state.ts
|
|
123740
|
-
import { existsSync as existsSync33, readFileSync as
|
|
123876
|
+
import { existsSync as existsSync33, readFileSync as readFileSync19 } from "fs";
|
|
123741
123877
|
function readBoulderState(directory) {
|
|
123742
123878
|
const filePath = getBoulderFilePath(directory);
|
|
123743
123879
|
if (!existsSync33(filePath)) {
|
|
123744
123880
|
return null;
|
|
123745
123881
|
}
|
|
123746
123882
|
try {
|
|
123747
|
-
const content =
|
|
123883
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
123748
123884
|
const parsed = JSON.parse(content);
|
|
123749
123885
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
123750
123886
|
return null;
|
|
@@ -123810,7 +123946,7 @@ init_state();
|
|
|
123810
123946
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
123811
123947
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
123812
123948
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
123813
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as
|
|
123949
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
123814
123950
|
import { join as join30 } from "path";
|
|
123815
123951
|
function getMarkerPath(directory, sessionID) {
|
|
123816
123952
|
return join30(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
@@ -123820,7 +123956,7 @@ function readContinuationMarker(directory, sessionID) {
|
|
|
123820
123956
|
if (!existsSync34(markerPath))
|
|
123821
123957
|
return null;
|
|
123822
123958
|
try {
|
|
123823
|
-
const raw =
|
|
123959
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
123824
123960
|
const parsed = JSON.parse(raw);
|
|
123825
123961
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
123826
123962
|
return null;
|
|
@@ -123885,7 +124021,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
123885
124021
|
// packages/omo-opencode/src/hooks/the-operator/session-last-agent.ts
|
|
123886
124022
|
init_shared();
|
|
123887
124023
|
init_compaction_marker();
|
|
123888
|
-
import { readFileSync as
|
|
124024
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync5 } from "fs";
|
|
123889
124025
|
import { join as join31 } from "path";
|
|
123890
124026
|
var defaultSessionLastAgentDeps = {
|
|
123891
124027
|
getMessageDir,
|
|
@@ -123946,7 +124082,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
123946
124082
|
try {
|
|
123947
124083
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
123948
124084
|
try {
|
|
123949
|
-
const content =
|
|
124085
|
+
const content = readFileSync21(join31(messageDir, fileName), "utf-8");
|
|
123950
124086
|
const parsed = JSON.parse(content);
|
|
123951
124087
|
return {
|
|
123952
124088
|
fileName,
|
|
@@ -123989,7 +124125,7 @@ init_agent_display_names();
|
|
|
123989
124125
|
|
|
123990
124126
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
123991
124127
|
init_frontmatter2();
|
|
123992
|
-
import { existsSync as existsSync35, readFileSync as
|
|
124128
|
+
import { existsSync as existsSync35, readFileSync as readFileSync22, writeFileSync as writeFileSync9, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
123993
124129
|
import { dirname as dirname12, join as join32 } from "path";
|
|
123994
124130
|
|
|
123995
124131
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
@@ -124007,7 +124143,7 @@ function readState(directory, customPath) {
|
|
|
124007
124143
|
return null;
|
|
124008
124144
|
}
|
|
124009
124145
|
try {
|
|
124010
|
-
const content =
|
|
124146
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
124011
124147
|
const { data, body } = parseFrontmatter(content);
|
|
124012
124148
|
const active = data.active;
|
|
124013
124149
|
const iteration = data.iteration;
|
|
@@ -124582,7 +124718,7 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
124582
124718
|
// packages/telemetry-core/src/activity-state.ts
|
|
124583
124719
|
init_atomic_write();
|
|
124584
124720
|
init_xdg_data_dir();
|
|
124585
|
-
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as
|
|
124721
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync23 } from "fs";
|
|
124586
124722
|
import { basename as basename6, join as join33 } from "path";
|
|
124587
124723
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
124588
124724
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
@@ -124626,7 +124762,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
124626
124762
|
return {};
|
|
124627
124763
|
}
|
|
124628
124764
|
try {
|
|
124629
|
-
const stateContent =
|
|
124765
|
+
const stateContent = readFileSync23(stateFilePath, "utf-8");
|
|
124630
124766
|
const stateJson = JSON.parse(stateContent);
|
|
124631
124767
|
if (!isPostHogActivityState(stateJson)) {
|
|
124632
124768
|
return {};
|
|
@@ -131745,7 +131881,7 @@ async function getLocalVersion(options = {}) {
|
|
|
131745
131881
|
}
|
|
131746
131882
|
}
|
|
131747
131883
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
131748
|
-
import { existsSync as existsSync47, readFileSync as
|
|
131884
|
+
import { existsSync as existsSync47, readFileSync as readFileSync33 } from "fs";
|
|
131749
131885
|
|
|
131750
131886
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
131751
131887
|
init_extract_semver();
|
|
@@ -131941,7 +132077,7 @@ function compareVersions3(current, minimum) {
|
|
|
131941
132077
|
|
|
131942
132078
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
131943
132079
|
init_shared();
|
|
131944
|
-
import { existsSync as existsSync45, readFileSync as
|
|
132080
|
+
import { existsSync as existsSync45, readFileSync as readFileSync31 } from "fs";
|
|
131945
132081
|
function detectConfigPath() {
|
|
131946
132082
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
131947
132083
|
if (existsSync45(paths2.configJsonc))
|
|
@@ -131992,7 +132128,7 @@ function getPluginInfo() {
|
|
|
131992
132128
|
};
|
|
131993
132129
|
}
|
|
131994
132130
|
try {
|
|
131995
|
-
const content =
|
|
132131
|
+
const content = readFileSync31(configPath, "utf-8");
|
|
131996
132132
|
const parsedConfig = parseJsonc(content);
|
|
131997
132133
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
131998
132134
|
if (!pluginEntry) {
|
|
@@ -132034,7 +132170,7 @@ init_file_utils2();
|
|
|
132034
132170
|
init_checker();
|
|
132035
132171
|
init_auto_update_checker();
|
|
132036
132172
|
init_package_json_locator();
|
|
132037
|
-
import { existsSync as existsSync46, readFileSync as
|
|
132173
|
+
import { existsSync as existsSync46, readFileSync as readFileSync32, readdirSync as readdirSync7 } from "fs";
|
|
132038
132174
|
import { createRequire as createRequire2 } from "module";
|
|
132039
132175
|
import { homedir as homedir11 } from "os";
|
|
132040
132176
|
import { join as join41 } from "path";
|
|
@@ -132066,7 +132202,7 @@ function readPackageJson(filePath) {
|
|
|
132066
132202
|
if (!existsSync46(filePath))
|
|
132067
132203
|
return null;
|
|
132068
132204
|
try {
|
|
132069
|
-
const content =
|
|
132205
|
+
const content = readFileSync32(filePath, "utf-8");
|
|
132070
132206
|
return parseJsonc(content);
|
|
132071
132207
|
} catch (error51) {
|
|
132072
132208
|
if (!(error51 instanceof Error)) {
|
|
@@ -132200,7 +132336,7 @@ var defaultDeps6 = {
|
|
|
132200
132336
|
getLatestPluginVersion,
|
|
132201
132337
|
getSuggestedInstallTag,
|
|
132202
132338
|
configExists: existsSync47,
|
|
132203
|
-
readConfigFile: (path14) =>
|
|
132339
|
+
readConfigFile: (path14) => readFileSync33(path14, "utf-8"),
|
|
132204
132340
|
parseConfigContent: (content) => parseJsonc(content)
|
|
132205
132341
|
};
|
|
132206
132342
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -132345,7 +132481,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
132345
132481
|
|
|
132346
132482
|
// packages/omo-opencode/src/config/validate.ts
|
|
132347
132483
|
init_src();
|
|
132348
|
-
import { readFileSync as
|
|
132484
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
132349
132485
|
import { homedir as homedir12 } from "os";
|
|
132350
132486
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
132351
132487
|
init_shared();
|
|
@@ -132390,7 +132526,7 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
132390
132526
|
}
|
|
132391
132527
|
function parseLayerConfig(configPath) {
|
|
132392
132528
|
try {
|
|
132393
|
-
const content =
|
|
132529
|
+
const content = readFileSync34(configPath, "utf-8");
|
|
132394
132530
|
const rawConfig = parseJsonc(content);
|
|
132395
132531
|
if (!isPlainRecord(rawConfig)) {
|
|
132396
132532
|
return {
|
|
@@ -132459,7 +132595,7 @@ function validatePluginConfig(directory) {
|
|
|
132459
132595
|
|
|
132460
132596
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
132461
132597
|
init_shared();
|
|
132462
|
-
import { existsSync as existsSync48, readFileSync as
|
|
132598
|
+
import { existsSync as existsSync48, readFileSync as readFileSync35 } from "fs";
|
|
132463
132599
|
import { homedir as homedir13 } from "os";
|
|
132464
132600
|
import { join as join42 } from "path";
|
|
132465
132601
|
function getUserConfigDir2() {
|
|
@@ -132478,7 +132614,7 @@ function loadCustomProviderNames() {
|
|
|
132478
132614
|
if (!existsSync48(configPath))
|
|
132479
132615
|
continue;
|
|
132480
132616
|
try {
|
|
132481
|
-
const content =
|
|
132617
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
132482
132618
|
const data = parseJsonc(content);
|
|
132483
132619
|
if (data?.provider && typeof data.provider === "object") {
|
|
132484
132620
|
return Object.keys(data.provider);
|
|
@@ -132502,7 +132638,7 @@ function loadAvailableModelsFromCache() {
|
|
|
132502
132638
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
132503
132639
|
}
|
|
132504
132640
|
try {
|
|
132505
|
-
const content =
|
|
132641
|
+
const content = readFileSync35(cacheFile, "utf-8");
|
|
132506
132642
|
const data = parseJsonc(content);
|
|
132507
132643
|
const cacheProviders = Object.keys(data);
|
|
132508
132644
|
let modelCount = 0;
|
|
@@ -132529,7 +132665,7 @@ init_model_capabilities2();
|
|
|
132529
132665
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
132530
132666
|
init_shared();
|
|
132531
132667
|
init_plugin_identity();
|
|
132532
|
-
import { readFileSync as
|
|
132668
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
132533
132669
|
import { join as join43 } from "path";
|
|
132534
132670
|
var PROJECT_CONFIG_DIR = join43(process.cwd(), ".opencode");
|
|
132535
132671
|
function loadOmoConfig() {
|
|
@@ -132539,7 +132675,7 @@ function loadOmoConfig() {
|
|
|
132539
132675
|
});
|
|
132540
132676
|
if (projectDetected.format !== "none") {
|
|
132541
132677
|
try {
|
|
132542
|
-
const content =
|
|
132678
|
+
const content = readFileSync36(projectDetected.path, "utf-8");
|
|
132543
132679
|
return parseJsonc(content);
|
|
132544
132680
|
} catch (error51) {
|
|
132545
132681
|
if (error51 instanceof Error) {
|
|
@@ -132555,7 +132691,7 @@ function loadOmoConfig() {
|
|
|
132555
132691
|
});
|
|
132556
132692
|
if (userDetected.format !== "none") {
|
|
132557
132693
|
try {
|
|
132558
|
-
const content =
|
|
132694
|
+
const content = readFileSync36(userDetected.path, "utf-8");
|
|
132559
132695
|
return parseJsonc(content);
|
|
132560
132696
|
} catch (error51) {
|
|
132561
132697
|
if (error51 instanceof Error) {
|
|
@@ -133136,13 +133272,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
133136
133272
|
}
|
|
133137
133273
|
|
|
133138
133274
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
133139
|
-
import { readFileSync as
|
|
133275
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
133140
133276
|
import { join as join47 } from "path";
|
|
133141
133277
|
|
|
133142
133278
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
133143
133279
|
init_zod();
|
|
133144
133280
|
init_opencode_config_dir();
|
|
133145
|
-
import { existsSync as existsSync50, readFileSync as
|
|
133281
|
+
import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
|
|
133146
133282
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
133147
133283
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
133148
133284
|
|
|
@@ -133286,7 +133422,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
133286
133422
|
}
|
|
133287
133423
|
function readDaemonPackageVersion(root) {
|
|
133288
133424
|
try {
|
|
133289
|
-
const packageJson = JSON.parse(
|
|
133425
|
+
const packageJson = JSON.parse(readFileSync37(resolve10(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
133290
133426
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
133291
133427
|
} catch (error51) {
|
|
133292
133428
|
if (!(error51 instanceof Error))
|
|
@@ -133363,7 +133499,7 @@ function readOmoConfig(configDirectory) {
|
|
|
133363
133499
|
return null;
|
|
133364
133500
|
}
|
|
133365
133501
|
try {
|
|
133366
|
-
const content =
|
|
133502
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
133367
133503
|
return parseJsonc(content);
|
|
133368
133504
|
} catch (error51) {
|
|
133369
133505
|
if (!(error51 instanceof Error)) {
|
|
@@ -133393,7 +133529,7 @@ function getInstalledLspServers(options = {}) {
|
|
|
133393
133529
|
|
|
133394
133530
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
133395
133531
|
init_shared();
|
|
133396
|
-
import { existsSync as existsSync51, readFileSync as
|
|
133532
|
+
import { existsSync as existsSync51, readFileSync as readFileSync39 } from "fs";
|
|
133397
133533
|
import { homedir as homedir16 } from "os";
|
|
133398
133534
|
import { join as join48 } from "path";
|
|
133399
133535
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
@@ -133410,7 +133546,7 @@ function loadUserMcpConfig() {
|
|
|
133410
133546
|
if (!existsSync51(configPath))
|
|
133411
133547
|
continue;
|
|
133412
133548
|
try {
|
|
133413
|
-
const content =
|
|
133549
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
133414
133550
|
const config4 = parseJsonc(content);
|
|
133415
133551
|
if (config4.mcpServers) {
|
|
133416
133552
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -133544,7 +133680,7 @@ async function checkTools() {
|
|
|
133544
133680
|
}
|
|
133545
133681
|
|
|
133546
133682
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
133547
|
-
import { existsSync as existsSync52, readFileSync as
|
|
133683
|
+
import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
|
|
133548
133684
|
function isTelemetryState(value) {
|
|
133549
133685
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
133550
133686
|
}
|
|
@@ -133554,7 +133690,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
133554
133690
|
}
|
|
133555
133691
|
let parsed;
|
|
133556
133692
|
try {
|
|
133557
|
-
parsed = JSON.parse(
|
|
133693
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
133558
133694
|
} catch (error51) {
|
|
133559
133695
|
if (error51 instanceof Error) {
|
|
133560
133696
|
return "unreadable";
|
|
@@ -133629,7 +133765,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
133629
133765
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
133630
133766
|
init_shared();
|
|
133631
133767
|
init_plugin_identity();
|
|
133632
|
-
import { readFileSync as
|
|
133768
|
+
import { readFileSync as readFileSync41, promises as fs14 } from "fs";
|
|
133633
133769
|
import path15 from "path";
|
|
133634
133770
|
async function checkTeamMode() {
|
|
133635
133771
|
const config4 = loadTeamModeConfig();
|
|
@@ -133666,7 +133802,7 @@ function loadTeamModeConfig() {
|
|
|
133666
133802
|
if (!configPath)
|
|
133667
133803
|
return { team_mode: undefined };
|
|
133668
133804
|
try {
|
|
133669
|
-
return parseJsonc(
|
|
133805
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
133670
133806
|
} catch (error51) {
|
|
133671
133807
|
if (error51 instanceof Error) {
|
|
133672
133808
|
return { team_mode: undefined };
|
|
@@ -134098,7 +134234,7 @@ import {
|
|
|
134098
134234
|
existsSync as existsSync55,
|
|
134099
134235
|
mkdirSync as mkdirSync15,
|
|
134100
134236
|
readdirSync as readdirSync8,
|
|
134101
|
-
readFileSync as
|
|
134237
|
+
readFileSync as readFileSync43,
|
|
134102
134238
|
renameSync as renameSync7,
|
|
134103
134239
|
unlinkSync as unlinkSync8,
|
|
134104
134240
|
writeFileSync as writeFileSync13
|
|
@@ -134131,7 +134267,7 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
134131
134267
|
}
|
|
134132
134268
|
|
|
134133
134269
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
134134
|
-
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as
|
|
134270
|
+
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync12 } from "fs";
|
|
134135
134271
|
import { join as join50 } from "path";
|
|
134136
134272
|
var INDEX_FILE_NAME = "index.json";
|
|
134137
134273
|
function isTokenIndex(value) {
|
|
@@ -134147,7 +134283,7 @@ function readTokenIndex(storageDir) {
|
|
|
134147
134283
|
if (!existsSync54(indexPath))
|
|
134148
134284
|
return {};
|
|
134149
134285
|
try {
|
|
134150
|
-
const parsed = JSON.parse(
|
|
134286
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
134151
134287
|
return isTokenIndex(parsed) ? parsed : {};
|
|
134152
134288
|
} catch (readError) {
|
|
134153
134289
|
if (!(readError instanceof Error))
|
|
@@ -134257,7 +134393,7 @@ function readTokenFile(filePath) {
|
|
|
134257
134393
|
if (!existsSync55(filePath))
|
|
134258
134394
|
return null;
|
|
134259
134395
|
try {
|
|
134260
|
-
const parsed = JSON.parse(
|
|
134396
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134261
134397
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
134262
134398
|
} catch (readError) {
|
|
134263
134399
|
if (!(readError instanceof Error))
|
|
@@ -134270,7 +134406,7 @@ function readLegacyStore() {
|
|
|
134270
134406
|
if (!existsSync55(filePath))
|
|
134271
134407
|
return null;
|
|
134272
134408
|
try {
|
|
134273
|
-
const parsed = JSON.parse(
|
|
134409
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134274
134410
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
134275
134411
|
return null;
|
|
134276
134412
|
const result = {};
|
|
@@ -135083,7 +135219,7 @@ function createEmbeddingPort() {
|
|
|
135083
135219
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
135084
135220
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
135085
135221
|
import { createHash as createHash5 } from "crypto";
|
|
135086
|
-
import { readdirSync as readdirSync9, readFileSync as
|
|
135222
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync45, statSync as statSync7, existsSync as existsSync57 } from "fs";
|
|
135087
135223
|
import { join as join52, relative as relative6, extname as extname3 } from "path";
|
|
135088
135224
|
var EXT_TO_LANG = {
|
|
135089
135225
|
ts: "typescript",
|
|
@@ -135151,7 +135287,7 @@ function defaultFs() {
|
|
|
135151
135287
|
return readdirSync9(path18);
|
|
135152
135288
|
},
|
|
135153
135289
|
readFile(path18) {
|
|
135154
|
-
return
|
|
135290
|
+
return readFileSync45(path18, "utf-8");
|
|
135155
135291
|
},
|
|
135156
135292
|
stat(path18) {
|
|
135157
135293
|
const s = statSync7(path18);
|
|
@@ -135504,7 +135640,7 @@ function formatSearchResults(result) {
|
|
|
135504
135640
|
}
|
|
135505
135641
|
|
|
135506
135642
|
// packages/learning-loop/src/improvement.ts
|
|
135507
|
-
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as
|
|
135643
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as readFileSync46, writeFileSync as writeFileSync15 } from "fs";
|
|
135508
135644
|
import { join as join53, basename as basename10 } from "path";
|
|
135509
135645
|
function createImprovementStore(improvementsDir) {
|
|
135510
135646
|
if (!existsSync58(improvementsDir)) {
|
|
@@ -135531,7 +135667,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
135531
135667
|
function get(id) {
|
|
135532
135668
|
const filePath = join53(improvementsDir, `${id}.json`);
|
|
135533
135669
|
try {
|
|
135534
|
-
const raw =
|
|
135670
|
+
const raw = readFileSync46(filePath, "utf-8");
|
|
135535
135671
|
return JSON.parse(raw);
|
|
135536
135672
|
} catch {
|
|
135537
135673
|
return null;
|
|
@@ -137985,10 +138121,10 @@ playwright-cli close
|
|
|
137985
138121
|
allowedTools: ["Bash(playwright-cli:*)"]
|
|
137986
138122
|
};
|
|
137987
138123
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
137988
|
-
import { readFileSync as
|
|
138124
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
137989
138125
|
import { join as join63 } from "path";
|
|
137990
138126
|
init_src();
|
|
137991
|
-
function createSharedSkillTemplateLoader(readFile3 =
|
|
138127
|
+
function createSharedSkillTemplateLoader(readFile3 = readFileSync49, skillsRootPath = sharedSkillsRootPath()) {
|
|
137992
138128
|
const cache = new Map;
|
|
137993
138129
|
return (skillName) => {
|
|
137994
138130
|
const cached2 = cache.get(skillName);
|
|
@@ -140348,7 +140484,7 @@ import {
|
|
|
140348
140484
|
existsSync as existsSync65,
|
|
140349
140485
|
mkdirSync as mkdirSync20,
|
|
140350
140486
|
copyFileSync as copyFileSync3,
|
|
140351
|
-
readFileSync as
|
|
140487
|
+
readFileSync as readFileSync50,
|
|
140352
140488
|
writeFileSync as writeFileSync18,
|
|
140353
140489
|
readdirSync as readdirSync10,
|
|
140354
140490
|
statSync as statSync8,
|
|
@@ -140365,7 +140501,7 @@ async function snapshotCli(options = {}) {
|
|
|
140365
140501
|
const realFs = {
|
|
140366
140502
|
existsSync: existsSync65,
|
|
140367
140503
|
mkdirSync: mkdirSync20,
|
|
140368
|
-
readFileSync:
|
|
140504
|
+
readFileSync: readFileSync50,
|
|
140369
140505
|
writeFileSync: writeFileSync18,
|
|
140370
140506
|
copyFileSync: copyFileSync3,
|
|
140371
140507
|
readdirSync: readdirSync10,
|
|
@@ -140431,7 +140567,7 @@ import {
|
|
|
140431
140567
|
existsSync as existsSync66,
|
|
140432
140568
|
mkdirSync as mkdirSync21,
|
|
140433
140569
|
copyFileSync as copyFileSync4,
|
|
140434
|
-
readFileSync as
|
|
140570
|
+
readFileSync as readFileSync51,
|
|
140435
140571
|
writeFileSync as writeFileSync19,
|
|
140436
140572
|
readdirSync as readdirSync11,
|
|
140437
140573
|
statSync as statSync9,
|
|
@@ -140444,7 +140580,7 @@ async function restoreCli(options) {
|
|
|
140444
140580
|
const realFs = {
|
|
140445
140581
|
existsSync: existsSync66,
|
|
140446
140582
|
mkdirSync: mkdirSync21,
|
|
140447
|
-
readFileSync:
|
|
140583
|
+
readFileSync: readFileSync51,
|
|
140448
140584
|
writeFileSync: writeFileSync19,
|
|
140449
140585
|
copyFileSync: copyFileSync4,
|
|
140450
140586
|
readdirSync: readdirSync11,
|
|
@@ -140459,7 +140595,7 @@ async function restoreCli(options) {
|
|
|
140459
140595
|
try {
|
|
140460
140596
|
restoreSnapshot(options.state, { snapshotDir, fs: realFs });
|
|
140461
140597
|
const manifestPath = path19.join(snapshotDir, options.state, "manifest.json");
|
|
140462
|
-
const raw =
|
|
140598
|
+
const raw = readFileSync51(manifestPath).toString("utf-8");
|
|
140463
140599
|
const parsed = JSON.parse(raw);
|
|
140464
140600
|
const fileCount = typeof parsed === "object" && parsed !== null && "files" in parsed && Array.isArray(parsed.files) ? parsed.files.length : 0;
|
|
140465
140601
|
if (options.json) {
|
|
@@ -140483,7 +140619,7 @@ import {
|
|
|
140483
140619
|
existsSync as existsSync67,
|
|
140484
140620
|
mkdirSync as mkdirSync22,
|
|
140485
140621
|
copyFileSync as copyFileSync5,
|
|
140486
|
-
readFileSync as
|
|
140622
|
+
readFileSync as readFileSync52,
|
|
140487
140623
|
writeFileSync as writeFileSync20,
|
|
140488
140624
|
readdirSync as readdirSync12,
|
|
140489
140625
|
statSync as statSync10,
|
|
@@ -140506,7 +140642,7 @@ async function snapshotListCli(options) {
|
|
|
140506
140642
|
const realFs = {
|
|
140507
140643
|
existsSync: existsSync67,
|
|
140508
140644
|
mkdirSync: mkdirSync22,
|
|
140509
|
-
readFileSync:
|
|
140645
|
+
readFileSync: readFileSync52,
|
|
140510
140646
|
writeFileSync: writeFileSync20,
|
|
140511
140647
|
copyFileSync: copyFileSync5,
|
|
140512
140648
|
readdirSync: readdirSync12,
|
|
@@ -140537,7 +140673,7 @@ import {
|
|
|
140537
140673
|
existsSync as existsSync68,
|
|
140538
140674
|
mkdirSync as mkdirSync23,
|
|
140539
140675
|
copyFileSync as copyFileSync6,
|
|
140540
|
-
readFileSync as
|
|
140676
|
+
readFileSync as readFileSync53,
|
|
140541
140677
|
writeFileSync as writeFileSync21,
|
|
140542
140678
|
readdirSync as readdirSync13,
|
|
140543
140679
|
statSync as statSync11,
|
|
@@ -140550,7 +140686,7 @@ async function snapshotPruneCli(options = {}) {
|
|
|
140550
140686
|
const realFs = {
|
|
140551
140687
|
existsSync: existsSync68,
|
|
140552
140688
|
mkdirSync: mkdirSync23,
|
|
140553
|
-
readFileSync:
|
|
140689
|
+
readFileSync: readFileSync53,
|
|
140554
140690
|
writeFileSync: writeFileSync21,
|
|
140555
140691
|
copyFileSync: copyFileSync6,
|
|
140556
140692
|
readdirSync: readdirSync13,
|
|
@@ -141071,6 +141207,7 @@ async function traceCli(sessionId, options = {}) {
|
|
|
141071
141207
|
|
|
141072
141208
|
// packages/omo-opencode/src/cli/dashboard.ts
|
|
141073
141209
|
import * as path25 from "path";
|
|
141210
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
141074
141211
|
|
|
141075
141212
|
// packages/omo-opencode/src/features/dashboard/data-provider.ts
|
|
141076
141213
|
import * as os12 from "os";
|
|
@@ -141630,6 +141767,7 @@ function createDataProvider(config4) {
|
|
|
141630
141767
|
}
|
|
141631
141768
|
|
|
141632
141769
|
// packages/omo-opencode/src/features/dashboard/server.ts
|
|
141770
|
+
init_write_gateway_env();
|
|
141633
141771
|
var MIME = {
|
|
141634
141772
|
".html": "text/html; charset=utf-8",
|
|
141635
141773
|
".css": "text/css; charset=utf-8",
|
|
@@ -141653,8 +141791,8 @@ function createDashboardServer(dataProvider, config4) {
|
|
|
141653
141791
|
const path25 = url3.pathname;
|
|
141654
141792
|
const corsHeaders = {
|
|
141655
141793
|
"Access-Control-Allow-Origin": "*",
|
|
141656
|
-
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
141657
|
-
"Access-Control-Allow-Headers": "Content-Type"
|
|
141794
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, OPTIONS",
|
|
141795
|
+
"Access-Control-Allow-Headers": "Content-Type, x-passphrase"
|
|
141658
141796
|
};
|
|
141659
141797
|
if (req.method === "OPTIONS") {
|
|
141660
141798
|
return new Response(null, { headers: corsHeaders });
|
|
@@ -141726,6 +141864,30 @@ function createDashboardServer(dataProvider, config4) {
|
|
|
141726
141864
|
return Response.json(dataProvider.getMemory(), { headers: jsonHeaders });
|
|
141727
141865
|
case "/api/skills":
|
|
141728
141866
|
return Response.json(dataProvider.getSkills(), { headers: jsonHeaders });
|
|
141867
|
+
case "/api/gateway/token": {
|
|
141868
|
+
if (req.method !== "POST") {
|
|
141869
|
+
return new Response("Method Not Allowed", { status: 405, headers: corsHeaders });
|
|
141870
|
+
}
|
|
141871
|
+
const body = await req.json();
|
|
141872
|
+
const type2 = body.type;
|
|
141873
|
+
const token = body.token;
|
|
141874
|
+
const passphrase = body.passphrase;
|
|
141875
|
+
if (type2 !== "telegram" && type2 !== "discord") {
|
|
141876
|
+
return Response.json({ error: "Invalid type. Must be 'telegram' or 'discord'" }, { status: 400, headers: jsonHeaders });
|
|
141877
|
+
}
|
|
141878
|
+
if (typeof token !== "string" || token.length === 0) {
|
|
141879
|
+
return Response.json({ error: "Missing or empty token" }, { status: 400, headers: jsonHeaders });
|
|
141880
|
+
}
|
|
141881
|
+
if (!config4.gatewayPassphrase) {
|
|
141882
|
+
return Response.json({ error: "Passphrase not configured" }, { status: 400, headers: jsonHeaders });
|
|
141883
|
+
}
|
|
141884
|
+
if (passphrase !== config4.gatewayPassphrase) {
|
|
141885
|
+
return Response.json({ error: "Invalid passphrase" }, { status: 401, headers: jsonHeaders });
|
|
141886
|
+
}
|
|
141887
|
+
const key = type2 === "telegram" ? "TELEGRAM_BOT_TOKEN" : "DISCORD_BOT_TOKEN";
|
|
141888
|
+
const envPath = writeGatewayEnvToken(key, token);
|
|
141889
|
+
return Response.json({ ok: true, path: envPath }, { headers: jsonHeaders });
|
|
141890
|
+
}
|
|
141729
141891
|
default:
|
|
141730
141892
|
return new Response("Not Found", { status: 404, headers: corsHeaders });
|
|
141731
141893
|
}
|
|
@@ -141761,21 +141923,36 @@ function createDashboardServer(dataProvider, config4) {
|
|
|
141761
141923
|
server2 = null;
|
|
141762
141924
|
},
|
|
141763
141925
|
get port() {
|
|
141764
|
-
return config4.port;
|
|
141926
|
+
return server2?.port ?? config4.port;
|
|
141765
141927
|
}
|
|
141766
141928
|
};
|
|
141767
141929
|
}
|
|
141768
141930
|
|
|
141769
141931
|
// packages/omo-opencode/src/cli/dashboard.ts
|
|
141932
|
+
init_config_context();
|
|
141933
|
+
init_jsonc_parser2();
|
|
141934
|
+
function loadGatewayPassphrase() {
|
|
141935
|
+
try {
|
|
141936
|
+
const configDir = getConfigDir();
|
|
141937
|
+
const configPath = path25.join(configDir, "matrixos.jsonc");
|
|
141938
|
+
const raw = readFileSync55(configPath, "utf-8");
|
|
141939
|
+
const config4 = parseJsonc(raw);
|
|
141940
|
+
const dashboard2 = config4.dashboard;
|
|
141941
|
+
return typeof dashboard2?.gateway_passphrase === "string" ? dashboard2.gateway_passphrase : undefined;
|
|
141942
|
+
} catch {
|
|
141943
|
+
return;
|
|
141944
|
+
}
|
|
141945
|
+
}
|
|
141770
141946
|
async function dashboardCli(options) {
|
|
141771
141947
|
const port = options.port ?? 9123;
|
|
141772
141948
|
const host = options.host ?? "0.0.0.0";
|
|
141773
141949
|
const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
|
|
141950
|
+
const gatewayPassphrase = loadGatewayPassphrase();
|
|
141774
141951
|
console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port}`);
|
|
141775
141952
|
console.log(`[dashboard] frontend: ${frontendDir}`);
|
|
141776
141953
|
try {
|
|
141777
141954
|
const dataProvider = createDataProvider();
|
|
141778
|
-
const server2 = createDashboardServer(dataProvider, { port, host, frontendDir });
|
|
141955
|
+
const server2 = createDashboardServer(dataProvider, { port, host, frontendDir, gatewayPassphrase });
|
|
141779
141956
|
server2.start();
|
|
141780
141957
|
console.log(`[dashboard] ready \u2014 http://${host}:${port}`);
|
|
141781
141958
|
if (!options.daemon) {
|
|
@@ -141802,11 +141979,11 @@ async function dashboardCli(options) {
|
|
|
141802
141979
|
}
|
|
141803
141980
|
|
|
141804
141981
|
// packages/omo-opencode/src/cli/architect.ts
|
|
141805
|
-
import { join as
|
|
141982
|
+
import { join as join74 } from "path";
|
|
141806
141983
|
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
141807
141984
|
function getStore(directory) {
|
|
141808
141985
|
const baseDir = directory ?? process.cwd();
|
|
141809
|
-
return createImprovementStore(
|
|
141986
|
+
return createImprovementStore(join74(baseDir, IMPROVEMENTS_DIR));
|
|
141810
141987
|
}
|
|
141811
141988
|
async function architectReview(options) {
|
|
141812
141989
|
const store4 = getStore(options.directory);
|
|
@@ -142280,6 +142457,20 @@ program2.command("export [name]").description("Export a mini-OS profile as a sta
|
|
|
142280
142457
|
process.exit(result.exitCode);
|
|
142281
142458
|
});
|
|
142282
142459
|
program2.addCommand(createMcpOAuthCommand());
|
|
142460
|
+
var gateway = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
|
|
142461
|
+
gateway.command("set-token <type>").description("Securely write a bot token to .klc-gateway.env (chmod 600). Valid types: telegram, discord").option("-t, --token <value>", "Token value (non-interactive)").option("-i, --interactive", "Prompt for token with masked input").addHelpText("after", `
|
|
142462
|
+
Examples:
|
|
142463
|
+
$ matrixos gateway set-token telegram --token "123:ABC"
|
|
142464
|
+
$ matrixos gateway set-token discord -i
|
|
142465
|
+
`).action(async (type2, options) => {
|
|
142466
|
+
const { executeGatewaySetTokenCommand: executeGatewaySetTokenCommand2 } = await Promise.resolve().then(() => (init_gateway_set_token(), exports_gateway_set_token));
|
|
142467
|
+
const result = await executeGatewaySetTokenCommand2({
|
|
142468
|
+
positional: [type2],
|
|
142469
|
+
options: { type: type2, token: options.token, interactive: options.interactive ?? false }
|
|
142470
|
+
});
|
|
142471
|
+
process.stdout.write(result.stdout);
|
|
142472
|
+
process.exit(result.exitCode);
|
|
142473
|
+
});
|
|
142283
142474
|
function runCli() {
|
|
142284
142475
|
program2.parse();
|
|
142285
142476
|
}
|