@kl-c/matrixos 0.1.21 → 0.1.23
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 +10 -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 +229 -87
- package/dist/cli-node/index.js +229 -87
- package/dist/index.js +678 -609
- 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.23",
|
|
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,7 +117676,7 @@ __export(exports_generate, {
|
|
|
117634
117676
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
117635
117677
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
117636
117678
|
});
|
|
117637
|
-
import { existsSync as existsSync70, readFileSync as
|
|
117679
|
+
import { existsSync as existsSync70, readFileSync as readFileSync55, realpathSync as realpathSync10 } from "fs";
|
|
117638
117680
|
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join75, resolve as resolve16 } from "path";
|
|
117639
117681
|
function profilesDirFor(opts) {
|
|
117640
117682
|
if (opts.profilesDir)
|
|
@@ -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: readFileSync55, realpathSync: realpathSync10 };
|
|
117736
117778
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
117737
117779
|
profileName;
|
|
117738
117780
|
constructor(profileName) {
|
|
@@ -117884,7 +117926,7 @@ 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
|
|
117929
|
+
import { existsSync as existsSync72, readdirSync as readdirSync15, readFileSync as readFileSync56 } from "fs";
|
|
117888
117930
|
import { join as join77, resolve as resolve17, dirname as dirname29 } from "path";
|
|
117889
117931
|
function executeProfileResolveCommand(args) {
|
|
117890
117932
|
if (args.options.help) {
|
|
@@ -117931,7 +117973,7 @@ function executeProfileResolveCommand(args) {
|
|
|
117931
117973
|
for (const file3 of profileFiles) {
|
|
117932
117974
|
try {
|
|
117933
117975
|
const filePath = join77(profilesDir, file3);
|
|
117934
|
-
const raw = JSON.parse(
|
|
117976
|
+
const raw = JSON.parse(readFileSync56(filePath, "utf-8"));
|
|
117935
117977
|
const profile2 = ProfileSchema.parse(raw);
|
|
117936
117978
|
registry2[profile2.name] = profile2;
|
|
117937
117979
|
} catch {}
|
|
@@ -117993,7 +118035,7 @@ __export(exports_export, {
|
|
|
117993
118035
|
getShell: () => getShell,
|
|
117994
118036
|
executeExportCommand: () => executeExportCommand
|
|
117995
118037
|
});
|
|
117996
|
-
import { existsSync as existsSync73, readFileSync as
|
|
118038
|
+
import { existsSync as existsSync73, readFileSync as readFileSync57, writeFileSync as writeFileSync25, copyFileSync as copyFileSync7, realpathSync as realpathSync11, mkdirSync as mkdirSync26 } from "fs";
|
|
117997
118039
|
import { isAbsolute as isAbsolute7, join as join78, resolve as resolve18, dirname as dirname30 } from "path";
|
|
117998
118040
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
117999
118041
|
function setShell(shell) {
|
|
@@ -118117,7 +118159,7 @@ var init_export = __esm(() => {
|
|
|
118117
118159
|
activeShell = defaultShell;
|
|
118118
118160
|
defaultExportFS = {
|
|
118119
118161
|
existsSync: existsSync73,
|
|
118120
|
-
readFileSync:
|
|
118162
|
+
readFileSync: readFileSync57,
|
|
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
|
|
|
@@ -123529,7 +123657,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
123529
123657
|
var NOTEPAD_DIR = "notepads";
|
|
123530
123658
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
123531
123659
|
// packages/boulder-state/src/top-level-task.ts
|
|
123532
|
-
import { existsSync as existsSync30, readFileSync as
|
|
123660
|
+
import { existsSync as existsSync30, readFileSync as readFileSync17 } from "fs";
|
|
123533
123661
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
123534
123662
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
123535
123663
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -123556,7 +123684,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
123556
123684
|
return null;
|
|
123557
123685
|
}
|
|
123558
123686
|
try {
|
|
123559
|
-
const content =
|
|
123687
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
123560
123688
|
const lines = content.split(/\r?\n/);
|
|
123561
123689
|
let section = "other";
|
|
123562
123690
|
for (const line of lines) {
|
|
@@ -123608,7 +123736,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
123608
123736
|
return resolveBoulderPlanPath(directory, work);
|
|
123609
123737
|
}
|
|
123610
123738
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
123611
|
-
import { existsSync as existsSync32, readFileSync as
|
|
123739
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
123612
123740
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
123613
123741
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
123614
123742
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -123621,7 +123749,7 @@ function getPlanProgress(planPath) {
|
|
|
123621
123749
|
return { total: 0, completed: 0, isComplete: false };
|
|
123622
123750
|
}
|
|
123623
123751
|
try {
|
|
123624
|
-
const content =
|
|
123752
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
123625
123753
|
const lines = content.split(/\r?\n/);
|
|
123626
123754
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
123627
123755
|
if (hasStructuredSections) {
|
|
@@ -123737,14 +123865,14 @@ function selectMirrorWork(state) {
|
|
|
123737
123865
|
return sorted[0] ?? null;
|
|
123738
123866
|
}
|
|
123739
123867
|
// packages/boulder-state/src/storage/read-state.ts
|
|
123740
|
-
import { existsSync as existsSync33, readFileSync as
|
|
123868
|
+
import { existsSync as existsSync33, readFileSync as readFileSync19 } from "fs";
|
|
123741
123869
|
function readBoulderState(directory) {
|
|
123742
123870
|
const filePath = getBoulderFilePath(directory);
|
|
123743
123871
|
if (!existsSync33(filePath)) {
|
|
123744
123872
|
return null;
|
|
123745
123873
|
}
|
|
123746
123874
|
try {
|
|
123747
|
-
const content =
|
|
123875
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
123748
123876
|
const parsed = JSON.parse(content);
|
|
123749
123877
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
123750
123878
|
return null;
|
|
@@ -123810,7 +123938,7 @@ init_state();
|
|
|
123810
123938
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
123811
123939
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
123812
123940
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
123813
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as
|
|
123941
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
123814
123942
|
import { join as join30 } from "path";
|
|
123815
123943
|
function getMarkerPath(directory, sessionID) {
|
|
123816
123944
|
return join30(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
@@ -123820,7 +123948,7 @@ function readContinuationMarker(directory, sessionID) {
|
|
|
123820
123948
|
if (!existsSync34(markerPath))
|
|
123821
123949
|
return null;
|
|
123822
123950
|
try {
|
|
123823
|
-
const raw =
|
|
123951
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
123824
123952
|
const parsed = JSON.parse(raw);
|
|
123825
123953
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
123826
123954
|
return null;
|
|
@@ -123885,7 +124013,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
123885
124013
|
// packages/omo-opencode/src/hooks/the-operator/session-last-agent.ts
|
|
123886
124014
|
init_shared();
|
|
123887
124015
|
init_compaction_marker();
|
|
123888
|
-
import { readFileSync as
|
|
124016
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync5 } from "fs";
|
|
123889
124017
|
import { join as join31 } from "path";
|
|
123890
124018
|
var defaultSessionLastAgentDeps = {
|
|
123891
124019
|
getMessageDir,
|
|
@@ -123946,7 +124074,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
123946
124074
|
try {
|
|
123947
124075
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
123948
124076
|
try {
|
|
123949
|
-
const content =
|
|
124077
|
+
const content = readFileSync21(join31(messageDir, fileName), "utf-8");
|
|
123950
124078
|
const parsed = JSON.parse(content);
|
|
123951
124079
|
return {
|
|
123952
124080
|
fileName,
|
|
@@ -123989,7 +124117,7 @@ init_agent_display_names();
|
|
|
123989
124117
|
|
|
123990
124118
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
123991
124119
|
init_frontmatter2();
|
|
123992
|
-
import { existsSync as existsSync35, readFileSync as
|
|
124120
|
+
import { existsSync as existsSync35, readFileSync as readFileSync22, writeFileSync as writeFileSync9, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
123993
124121
|
import { dirname as dirname12, join as join32 } from "path";
|
|
123994
124122
|
|
|
123995
124123
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
@@ -124007,7 +124135,7 @@ function readState(directory, customPath) {
|
|
|
124007
124135
|
return null;
|
|
124008
124136
|
}
|
|
124009
124137
|
try {
|
|
124010
|
-
const content =
|
|
124138
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
124011
124139
|
const { data, body } = parseFrontmatter(content);
|
|
124012
124140
|
const active = data.active;
|
|
124013
124141
|
const iteration = data.iteration;
|
|
@@ -124582,7 +124710,7 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
124582
124710
|
// packages/telemetry-core/src/activity-state.ts
|
|
124583
124711
|
init_atomic_write();
|
|
124584
124712
|
init_xdg_data_dir();
|
|
124585
|
-
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as
|
|
124713
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync23 } from "fs";
|
|
124586
124714
|
import { basename as basename6, join as join33 } from "path";
|
|
124587
124715
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
124588
124716
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
@@ -124626,7 +124754,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
124626
124754
|
return {};
|
|
124627
124755
|
}
|
|
124628
124756
|
try {
|
|
124629
|
-
const stateContent =
|
|
124757
|
+
const stateContent = readFileSync23(stateFilePath, "utf-8");
|
|
124630
124758
|
const stateJson = JSON.parse(stateContent);
|
|
124631
124759
|
if (!isPostHogActivityState(stateJson)) {
|
|
124632
124760
|
return {};
|
|
@@ -131745,7 +131873,7 @@ async function getLocalVersion(options = {}) {
|
|
|
131745
131873
|
}
|
|
131746
131874
|
}
|
|
131747
131875
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
131748
|
-
import { existsSync as existsSync47, readFileSync as
|
|
131876
|
+
import { existsSync as existsSync47, readFileSync as readFileSync33 } from "fs";
|
|
131749
131877
|
|
|
131750
131878
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
131751
131879
|
init_extract_semver();
|
|
@@ -131941,7 +132069,7 @@ function compareVersions3(current, minimum) {
|
|
|
131941
132069
|
|
|
131942
132070
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
131943
132071
|
init_shared();
|
|
131944
|
-
import { existsSync as existsSync45, readFileSync as
|
|
132072
|
+
import { existsSync as existsSync45, readFileSync as readFileSync31 } from "fs";
|
|
131945
132073
|
function detectConfigPath() {
|
|
131946
132074
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
131947
132075
|
if (existsSync45(paths2.configJsonc))
|
|
@@ -131992,7 +132120,7 @@ function getPluginInfo() {
|
|
|
131992
132120
|
};
|
|
131993
132121
|
}
|
|
131994
132122
|
try {
|
|
131995
|
-
const content =
|
|
132123
|
+
const content = readFileSync31(configPath, "utf-8");
|
|
131996
132124
|
const parsedConfig = parseJsonc(content);
|
|
131997
132125
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
131998
132126
|
if (!pluginEntry) {
|
|
@@ -132034,7 +132162,7 @@ init_file_utils2();
|
|
|
132034
132162
|
init_checker();
|
|
132035
132163
|
init_auto_update_checker();
|
|
132036
132164
|
init_package_json_locator();
|
|
132037
|
-
import { existsSync as existsSync46, readFileSync as
|
|
132165
|
+
import { existsSync as existsSync46, readFileSync as readFileSync32, readdirSync as readdirSync7 } from "fs";
|
|
132038
132166
|
import { createRequire as createRequire2 } from "module";
|
|
132039
132167
|
import { homedir as homedir11 } from "os";
|
|
132040
132168
|
import { join as join41 } from "path";
|
|
@@ -132066,7 +132194,7 @@ function readPackageJson(filePath) {
|
|
|
132066
132194
|
if (!existsSync46(filePath))
|
|
132067
132195
|
return null;
|
|
132068
132196
|
try {
|
|
132069
|
-
const content =
|
|
132197
|
+
const content = readFileSync32(filePath, "utf-8");
|
|
132070
132198
|
return parseJsonc(content);
|
|
132071
132199
|
} catch (error51) {
|
|
132072
132200
|
if (!(error51 instanceof Error)) {
|
|
@@ -132200,7 +132328,7 @@ var defaultDeps6 = {
|
|
|
132200
132328
|
getLatestPluginVersion,
|
|
132201
132329
|
getSuggestedInstallTag,
|
|
132202
132330
|
configExists: existsSync47,
|
|
132203
|
-
readConfigFile: (path14) =>
|
|
132331
|
+
readConfigFile: (path14) => readFileSync33(path14, "utf-8"),
|
|
132204
132332
|
parseConfigContent: (content) => parseJsonc(content)
|
|
132205
132333
|
};
|
|
132206
132334
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -132345,7 +132473,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
132345
132473
|
|
|
132346
132474
|
// packages/omo-opencode/src/config/validate.ts
|
|
132347
132475
|
init_src();
|
|
132348
|
-
import { readFileSync as
|
|
132476
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
132349
132477
|
import { homedir as homedir12 } from "os";
|
|
132350
132478
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
132351
132479
|
init_shared();
|
|
@@ -132390,7 +132518,7 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
132390
132518
|
}
|
|
132391
132519
|
function parseLayerConfig(configPath) {
|
|
132392
132520
|
try {
|
|
132393
|
-
const content =
|
|
132521
|
+
const content = readFileSync34(configPath, "utf-8");
|
|
132394
132522
|
const rawConfig = parseJsonc(content);
|
|
132395
132523
|
if (!isPlainRecord(rawConfig)) {
|
|
132396
132524
|
return {
|
|
@@ -132459,7 +132587,7 @@ function validatePluginConfig(directory) {
|
|
|
132459
132587
|
|
|
132460
132588
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
132461
132589
|
init_shared();
|
|
132462
|
-
import { existsSync as existsSync48, readFileSync as
|
|
132590
|
+
import { existsSync as existsSync48, readFileSync as readFileSync35 } from "fs";
|
|
132463
132591
|
import { homedir as homedir13 } from "os";
|
|
132464
132592
|
import { join as join42 } from "path";
|
|
132465
132593
|
function getUserConfigDir2() {
|
|
@@ -132478,7 +132606,7 @@ function loadCustomProviderNames() {
|
|
|
132478
132606
|
if (!existsSync48(configPath))
|
|
132479
132607
|
continue;
|
|
132480
132608
|
try {
|
|
132481
|
-
const content =
|
|
132609
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
132482
132610
|
const data = parseJsonc(content);
|
|
132483
132611
|
if (data?.provider && typeof data.provider === "object") {
|
|
132484
132612
|
return Object.keys(data.provider);
|
|
@@ -132502,7 +132630,7 @@ function loadAvailableModelsFromCache() {
|
|
|
132502
132630
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
132503
132631
|
}
|
|
132504
132632
|
try {
|
|
132505
|
-
const content =
|
|
132633
|
+
const content = readFileSync35(cacheFile, "utf-8");
|
|
132506
132634
|
const data = parseJsonc(content);
|
|
132507
132635
|
const cacheProviders = Object.keys(data);
|
|
132508
132636
|
let modelCount = 0;
|
|
@@ -132529,7 +132657,7 @@ init_model_capabilities2();
|
|
|
132529
132657
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
132530
132658
|
init_shared();
|
|
132531
132659
|
init_plugin_identity();
|
|
132532
|
-
import { readFileSync as
|
|
132660
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
132533
132661
|
import { join as join43 } from "path";
|
|
132534
132662
|
var PROJECT_CONFIG_DIR = join43(process.cwd(), ".opencode");
|
|
132535
132663
|
function loadOmoConfig() {
|
|
@@ -132539,7 +132667,7 @@ function loadOmoConfig() {
|
|
|
132539
132667
|
});
|
|
132540
132668
|
if (projectDetected.format !== "none") {
|
|
132541
132669
|
try {
|
|
132542
|
-
const content =
|
|
132670
|
+
const content = readFileSync36(projectDetected.path, "utf-8");
|
|
132543
132671
|
return parseJsonc(content);
|
|
132544
132672
|
} catch (error51) {
|
|
132545
132673
|
if (error51 instanceof Error) {
|
|
@@ -132555,7 +132683,7 @@ function loadOmoConfig() {
|
|
|
132555
132683
|
});
|
|
132556
132684
|
if (userDetected.format !== "none") {
|
|
132557
132685
|
try {
|
|
132558
|
-
const content =
|
|
132686
|
+
const content = readFileSync36(userDetected.path, "utf-8");
|
|
132559
132687
|
return parseJsonc(content);
|
|
132560
132688
|
} catch (error51) {
|
|
132561
132689
|
if (error51 instanceof Error) {
|
|
@@ -133136,13 +133264,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
133136
133264
|
}
|
|
133137
133265
|
|
|
133138
133266
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
133139
|
-
import { readFileSync as
|
|
133267
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
133140
133268
|
import { join as join47 } from "path";
|
|
133141
133269
|
|
|
133142
133270
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
133143
133271
|
init_zod();
|
|
133144
133272
|
init_opencode_config_dir();
|
|
133145
|
-
import { existsSync as existsSync50, readFileSync as
|
|
133273
|
+
import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
|
|
133146
133274
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
133147
133275
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
133148
133276
|
|
|
@@ -133286,7 +133414,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
133286
133414
|
}
|
|
133287
133415
|
function readDaemonPackageVersion(root) {
|
|
133288
133416
|
try {
|
|
133289
|
-
const packageJson = JSON.parse(
|
|
133417
|
+
const packageJson = JSON.parse(readFileSync37(resolve10(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
133290
133418
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
133291
133419
|
} catch (error51) {
|
|
133292
133420
|
if (!(error51 instanceof Error))
|
|
@@ -133363,7 +133491,7 @@ function readOmoConfig(configDirectory) {
|
|
|
133363
133491
|
return null;
|
|
133364
133492
|
}
|
|
133365
133493
|
try {
|
|
133366
|
-
const content =
|
|
133494
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
133367
133495
|
return parseJsonc(content);
|
|
133368
133496
|
} catch (error51) {
|
|
133369
133497
|
if (!(error51 instanceof Error)) {
|
|
@@ -133393,7 +133521,7 @@ function getInstalledLspServers(options = {}) {
|
|
|
133393
133521
|
|
|
133394
133522
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
133395
133523
|
init_shared();
|
|
133396
|
-
import { existsSync as existsSync51, readFileSync as
|
|
133524
|
+
import { existsSync as existsSync51, readFileSync as readFileSync39 } from "fs";
|
|
133397
133525
|
import { homedir as homedir16 } from "os";
|
|
133398
133526
|
import { join as join48 } from "path";
|
|
133399
133527
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
@@ -133410,7 +133538,7 @@ function loadUserMcpConfig() {
|
|
|
133410
133538
|
if (!existsSync51(configPath))
|
|
133411
133539
|
continue;
|
|
133412
133540
|
try {
|
|
133413
|
-
const content =
|
|
133541
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
133414
133542
|
const config4 = parseJsonc(content);
|
|
133415
133543
|
if (config4.mcpServers) {
|
|
133416
133544
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -133544,7 +133672,7 @@ async function checkTools() {
|
|
|
133544
133672
|
}
|
|
133545
133673
|
|
|
133546
133674
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
133547
|
-
import { existsSync as existsSync52, readFileSync as
|
|
133675
|
+
import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
|
|
133548
133676
|
function isTelemetryState(value) {
|
|
133549
133677
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
133550
133678
|
}
|
|
@@ -133554,7 +133682,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
133554
133682
|
}
|
|
133555
133683
|
let parsed;
|
|
133556
133684
|
try {
|
|
133557
|
-
parsed = JSON.parse(
|
|
133685
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
133558
133686
|
} catch (error51) {
|
|
133559
133687
|
if (error51 instanceof Error) {
|
|
133560
133688
|
return "unreadable";
|
|
@@ -133629,7 +133757,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
133629
133757
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
133630
133758
|
init_shared();
|
|
133631
133759
|
init_plugin_identity();
|
|
133632
|
-
import { readFileSync as
|
|
133760
|
+
import { readFileSync as readFileSync41, promises as fs14 } from "fs";
|
|
133633
133761
|
import path15 from "path";
|
|
133634
133762
|
async function checkTeamMode() {
|
|
133635
133763
|
const config4 = loadTeamModeConfig();
|
|
@@ -133666,7 +133794,7 @@ function loadTeamModeConfig() {
|
|
|
133666
133794
|
if (!configPath)
|
|
133667
133795
|
return { team_mode: undefined };
|
|
133668
133796
|
try {
|
|
133669
|
-
return parseJsonc(
|
|
133797
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
133670
133798
|
} catch (error51) {
|
|
133671
133799
|
if (error51 instanceof Error) {
|
|
133672
133800
|
return { team_mode: undefined };
|
|
@@ -134098,7 +134226,7 @@ import {
|
|
|
134098
134226
|
existsSync as existsSync55,
|
|
134099
134227
|
mkdirSync as mkdirSync15,
|
|
134100
134228
|
readdirSync as readdirSync8,
|
|
134101
|
-
readFileSync as
|
|
134229
|
+
readFileSync as readFileSync43,
|
|
134102
134230
|
renameSync as renameSync7,
|
|
134103
134231
|
unlinkSync as unlinkSync8,
|
|
134104
134232
|
writeFileSync as writeFileSync13
|
|
@@ -134131,7 +134259,7 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
134131
134259
|
}
|
|
134132
134260
|
|
|
134133
134261
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
134134
|
-
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as
|
|
134262
|
+
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync12 } from "fs";
|
|
134135
134263
|
import { join as join50 } from "path";
|
|
134136
134264
|
var INDEX_FILE_NAME = "index.json";
|
|
134137
134265
|
function isTokenIndex(value) {
|
|
@@ -134147,7 +134275,7 @@ function readTokenIndex(storageDir) {
|
|
|
134147
134275
|
if (!existsSync54(indexPath))
|
|
134148
134276
|
return {};
|
|
134149
134277
|
try {
|
|
134150
|
-
const parsed = JSON.parse(
|
|
134278
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
134151
134279
|
return isTokenIndex(parsed) ? parsed : {};
|
|
134152
134280
|
} catch (readError) {
|
|
134153
134281
|
if (!(readError instanceof Error))
|
|
@@ -134257,7 +134385,7 @@ function readTokenFile(filePath) {
|
|
|
134257
134385
|
if (!existsSync55(filePath))
|
|
134258
134386
|
return null;
|
|
134259
134387
|
try {
|
|
134260
|
-
const parsed = JSON.parse(
|
|
134388
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134261
134389
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
134262
134390
|
} catch (readError) {
|
|
134263
134391
|
if (!(readError instanceof Error))
|
|
@@ -134270,7 +134398,7 @@ function readLegacyStore() {
|
|
|
134270
134398
|
if (!existsSync55(filePath))
|
|
134271
134399
|
return null;
|
|
134272
134400
|
try {
|
|
134273
|
-
const parsed = JSON.parse(
|
|
134401
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134274
134402
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
134275
134403
|
return null;
|
|
134276
134404
|
const result = {};
|
|
@@ -135083,7 +135211,7 @@ function createEmbeddingPort() {
|
|
|
135083
135211
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
135084
135212
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
135085
135213
|
import { createHash as createHash5 } from "crypto";
|
|
135086
|
-
import { readdirSync as readdirSync9, readFileSync as
|
|
135214
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync45, statSync as statSync7, existsSync as existsSync57 } from "fs";
|
|
135087
135215
|
import { join as join52, relative as relative6, extname as extname3 } from "path";
|
|
135088
135216
|
var EXT_TO_LANG = {
|
|
135089
135217
|
ts: "typescript",
|
|
@@ -135151,7 +135279,7 @@ function defaultFs() {
|
|
|
135151
135279
|
return readdirSync9(path18);
|
|
135152
135280
|
},
|
|
135153
135281
|
readFile(path18) {
|
|
135154
|
-
return
|
|
135282
|
+
return readFileSync45(path18, "utf-8");
|
|
135155
135283
|
},
|
|
135156
135284
|
stat(path18) {
|
|
135157
135285
|
const s = statSync7(path18);
|
|
@@ -135504,7 +135632,7 @@ function formatSearchResults(result) {
|
|
|
135504
135632
|
}
|
|
135505
135633
|
|
|
135506
135634
|
// packages/learning-loop/src/improvement.ts
|
|
135507
|
-
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as
|
|
135635
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as readFileSync46, writeFileSync as writeFileSync15 } from "fs";
|
|
135508
135636
|
import { join as join53, basename as basename10 } from "path";
|
|
135509
135637
|
function createImprovementStore(improvementsDir) {
|
|
135510
135638
|
if (!existsSync58(improvementsDir)) {
|
|
@@ -135531,7 +135659,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
135531
135659
|
function get(id) {
|
|
135532
135660
|
const filePath = join53(improvementsDir, `${id}.json`);
|
|
135533
135661
|
try {
|
|
135534
|
-
const raw =
|
|
135662
|
+
const raw = readFileSync46(filePath, "utf-8");
|
|
135535
135663
|
return JSON.parse(raw);
|
|
135536
135664
|
} catch {
|
|
135537
135665
|
return null;
|
|
@@ -137985,10 +138113,10 @@ playwright-cli close
|
|
|
137985
138113
|
allowedTools: ["Bash(playwright-cli:*)"]
|
|
137986
138114
|
};
|
|
137987
138115
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
137988
|
-
import { readFileSync as
|
|
138116
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
137989
138117
|
import { join as join63 } from "path";
|
|
137990
138118
|
init_src();
|
|
137991
|
-
function createSharedSkillTemplateLoader(readFile3 =
|
|
138119
|
+
function createSharedSkillTemplateLoader(readFile3 = readFileSync49, skillsRootPath = sharedSkillsRootPath()) {
|
|
137992
138120
|
const cache = new Map;
|
|
137993
138121
|
return (skillName) => {
|
|
137994
138122
|
const cached2 = cache.get(skillName);
|
|
@@ -140348,7 +140476,7 @@ import {
|
|
|
140348
140476
|
existsSync as existsSync65,
|
|
140349
140477
|
mkdirSync as mkdirSync20,
|
|
140350
140478
|
copyFileSync as copyFileSync3,
|
|
140351
|
-
readFileSync as
|
|
140479
|
+
readFileSync as readFileSync50,
|
|
140352
140480
|
writeFileSync as writeFileSync18,
|
|
140353
140481
|
readdirSync as readdirSync10,
|
|
140354
140482
|
statSync as statSync8,
|
|
@@ -140365,7 +140493,7 @@ async function snapshotCli(options = {}) {
|
|
|
140365
140493
|
const realFs = {
|
|
140366
140494
|
existsSync: existsSync65,
|
|
140367
140495
|
mkdirSync: mkdirSync20,
|
|
140368
|
-
readFileSync:
|
|
140496
|
+
readFileSync: readFileSync50,
|
|
140369
140497
|
writeFileSync: writeFileSync18,
|
|
140370
140498
|
copyFileSync: copyFileSync3,
|
|
140371
140499
|
readdirSync: readdirSync10,
|
|
@@ -140431,7 +140559,7 @@ import {
|
|
|
140431
140559
|
existsSync as existsSync66,
|
|
140432
140560
|
mkdirSync as mkdirSync21,
|
|
140433
140561
|
copyFileSync as copyFileSync4,
|
|
140434
|
-
readFileSync as
|
|
140562
|
+
readFileSync as readFileSync51,
|
|
140435
140563
|
writeFileSync as writeFileSync19,
|
|
140436
140564
|
readdirSync as readdirSync11,
|
|
140437
140565
|
statSync as statSync9,
|
|
@@ -140444,7 +140572,7 @@ async function restoreCli(options) {
|
|
|
140444
140572
|
const realFs = {
|
|
140445
140573
|
existsSync: existsSync66,
|
|
140446
140574
|
mkdirSync: mkdirSync21,
|
|
140447
|
-
readFileSync:
|
|
140575
|
+
readFileSync: readFileSync51,
|
|
140448
140576
|
writeFileSync: writeFileSync19,
|
|
140449
140577
|
copyFileSync: copyFileSync4,
|
|
140450
140578
|
readdirSync: readdirSync11,
|
|
@@ -140459,7 +140587,7 @@ async function restoreCli(options) {
|
|
|
140459
140587
|
try {
|
|
140460
140588
|
restoreSnapshot(options.state, { snapshotDir, fs: realFs });
|
|
140461
140589
|
const manifestPath = path19.join(snapshotDir, options.state, "manifest.json");
|
|
140462
|
-
const raw =
|
|
140590
|
+
const raw = readFileSync51(manifestPath).toString("utf-8");
|
|
140463
140591
|
const parsed = JSON.parse(raw);
|
|
140464
140592
|
const fileCount = typeof parsed === "object" && parsed !== null && "files" in parsed && Array.isArray(parsed.files) ? parsed.files.length : 0;
|
|
140465
140593
|
if (options.json) {
|
|
@@ -140483,7 +140611,7 @@ import {
|
|
|
140483
140611
|
existsSync as existsSync67,
|
|
140484
140612
|
mkdirSync as mkdirSync22,
|
|
140485
140613
|
copyFileSync as copyFileSync5,
|
|
140486
|
-
readFileSync as
|
|
140614
|
+
readFileSync as readFileSync52,
|
|
140487
140615
|
writeFileSync as writeFileSync20,
|
|
140488
140616
|
readdirSync as readdirSync12,
|
|
140489
140617
|
statSync as statSync10,
|
|
@@ -140506,7 +140634,7 @@ async function snapshotListCli(options) {
|
|
|
140506
140634
|
const realFs = {
|
|
140507
140635
|
existsSync: existsSync67,
|
|
140508
140636
|
mkdirSync: mkdirSync22,
|
|
140509
|
-
readFileSync:
|
|
140637
|
+
readFileSync: readFileSync52,
|
|
140510
140638
|
writeFileSync: writeFileSync20,
|
|
140511
140639
|
copyFileSync: copyFileSync5,
|
|
140512
140640
|
readdirSync: readdirSync12,
|
|
@@ -140537,7 +140665,7 @@ import {
|
|
|
140537
140665
|
existsSync as existsSync68,
|
|
140538
140666
|
mkdirSync as mkdirSync23,
|
|
140539
140667
|
copyFileSync as copyFileSync6,
|
|
140540
|
-
readFileSync as
|
|
140668
|
+
readFileSync as readFileSync53,
|
|
140541
140669
|
writeFileSync as writeFileSync21,
|
|
140542
140670
|
readdirSync as readdirSync13,
|
|
140543
140671
|
statSync as statSync11,
|
|
@@ -140550,7 +140678,7 @@ async function snapshotPruneCli(options = {}) {
|
|
|
140550
140678
|
const realFs = {
|
|
140551
140679
|
existsSync: existsSync68,
|
|
140552
140680
|
mkdirSync: mkdirSync23,
|
|
140553
|
-
readFileSync:
|
|
140681
|
+
readFileSync: readFileSync53,
|
|
140554
140682
|
writeFileSync: writeFileSync21,
|
|
140555
140683
|
copyFileSync: copyFileSync6,
|
|
140556
140684
|
readdirSync: readdirSync13,
|
|
@@ -142280,6 +142408,20 @@ program2.command("export [name]").description("Export a mini-OS profile as a sta
|
|
|
142280
142408
|
process.exit(result.exitCode);
|
|
142281
142409
|
});
|
|
142282
142410
|
program2.addCommand(createMcpOAuthCommand());
|
|
142411
|
+
var gateway = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
|
|
142412
|
+
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", `
|
|
142413
|
+
Examples:
|
|
142414
|
+
$ matrixos gateway set-token telegram --token "123:ABC"
|
|
142415
|
+
$ matrixos gateway set-token discord -i
|
|
142416
|
+
`).action(async (type2, options) => {
|
|
142417
|
+
const { executeGatewaySetTokenCommand: executeGatewaySetTokenCommand2 } = await Promise.resolve().then(() => (init_gateway_set_token(), exports_gateway_set_token));
|
|
142418
|
+
const result = await executeGatewaySetTokenCommand2({
|
|
142419
|
+
positional: [type2],
|
|
142420
|
+
options: { type: type2, token: options.token, interactive: options.interactive ?? false }
|
|
142421
|
+
});
|
|
142422
|
+
process.stdout.write(result.stdout);
|
|
142423
|
+
process.exit(result.exitCode);
|
|
142424
|
+
});
|
|
142283
142425
|
function runCli() {
|
|
142284
142426
|
program2.parse();
|
|
142285
142427
|
}
|