@kl-c/matrixos 0.1.22 → 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 +664 -608
- package/package.json +1 -1
package/dist/cli/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",
|
|
@@ -67023,6 +67023,48 @@ var require_src = __commonJS((exports, module2) => {
|
|
|
67023
67023
|
module2.exports = { cursor, scroll, erase, beep };
|
|
67024
67024
|
});
|
|
67025
67025
|
|
|
67026
|
+
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
67027
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
67028
|
+
import { join as join26 } from "path";
|
|
67029
|
+
function writeGatewayEnvToken(key, token) {
|
|
67030
|
+
const configDir = getConfigDir();
|
|
67031
|
+
if (!existsSync26(configDir))
|
|
67032
|
+
mkdirSync9(configDir, { recursive: true });
|
|
67033
|
+
const envPath = join26(configDir, GATEWAY_ENV_FILENAME);
|
|
67034
|
+
const entries = new Map;
|
|
67035
|
+
if (existsSync26(envPath)) {
|
|
67036
|
+
const existing = readFileSync15(envPath, "utf-8");
|
|
67037
|
+
for (const rawLine of existing.split(`
|
|
67038
|
+
`)) {
|
|
67039
|
+
const line = rawLine.trim();
|
|
67040
|
+
if (line.length === 0 || line.startsWith("#"))
|
|
67041
|
+
continue;
|
|
67042
|
+
const withoutExport = line.replace(/^(export\s+)/i, "");
|
|
67043
|
+
const eqIndex = withoutExport.indexOf("=");
|
|
67044
|
+
if (eqIndex === -1)
|
|
67045
|
+
continue;
|
|
67046
|
+
const k = withoutExport.slice(0, eqIndex).trim();
|
|
67047
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k))
|
|
67048
|
+
continue;
|
|
67049
|
+
entries.set(k, withoutExport.slice(eqIndex + 1).trim());
|
|
67050
|
+
}
|
|
67051
|
+
}
|
|
67052
|
+
entries.set(key, token);
|
|
67053
|
+
const next = [...entries.entries()].map(([k, v]) => `${k}=${v}`).join(`
|
|
67054
|
+
`) + `
|
|
67055
|
+
`;
|
|
67056
|
+
writeFileSync6(envPath, next, { mode: 384 });
|
|
67057
|
+
chmodSync3(envPath, 384);
|
|
67058
|
+
return envPath;
|
|
67059
|
+
}
|
|
67060
|
+
function writeGatewayEnv(token) {
|
|
67061
|
+
return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
|
|
67062
|
+
}
|
|
67063
|
+
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
67064
|
+
var init_write_gateway_env = __esm(() => {
|
|
67065
|
+
init_config_context();
|
|
67066
|
+
});
|
|
67067
|
+
|
|
67026
67068
|
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
67027
67069
|
function $constructor(name2, initializer, params) {
|
|
67028
67070
|
function init(inst, def) {
|
|
@@ -107521,7 +107563,7 @@ var require_filesystem = __commonJS((exports2, module2) => {
|
|
|
107521
107563
|
var LDD_PATH = "/usr/bin/ldd";
|
|
107522
107564
|
var SELF_PATH = "/proc/self/exe";
|
|
107523
107565
|
var MAX_LENGTH = 2048;
|
|
107524
|
-
var
|
|
107566
|
+
var readFileSync45 = (path18) => {
|
|
107525
107567
|
const fd = fs17.openSync(path18, "r");
|
|
107526
107568
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
107527
107569
|
const bytesRead = fs17.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -107544,7 +107586,7 @@ var require_filesystem = __commonJS((exports2, module2) => {
|
|
|
107544
107586
|
module2.exports = {
|
|
107545
107587
|
LDD_PATH,
|
|
107546
107588
|
SELF_PATH,
|
|
107547
|
-
readFileSync:
|
|
107589
|
+
readFileSync: readFileSync45,
|
|
107548
107590
|
readFile
|
|
107549
107591
|
};
|
|
107550
107592
|
});
|
|
@@ -107587,7 +107629,7 @@ var require_elf = __commonJS((exports2, module2) => {
|
|
|
107587
107629
|
var require_detect_libc = __commonJS((exports2, module2) => {
|
|
107588
107630
|
var childProcess = __require("child_process");
|
|
107589
107631
|
var { isLinux, getReport } = require_process();
|
|
107590
|
-
var { LDD_PATH, SELF_PATH, readFile, readFileSync:
|
|
107632
|
+
var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync45 } = require_filesystem();
|
|
107591
107633
|
var { interpreterPath } = require_elf();
|
|
107592
107634
|
var cachedFamilyInterpreter;
|
|
107593
107635
|
var cachedFamilyFilesystem;
|
|
@@ -107678,7 +107720,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107678
107720
|
}
|
|
107679
107721
|
cachedFamilyFilesystem = null;
|
|
107680
107722
|
try {
|
|
107681
|
-
const lddContent =
|
|
107723
|
+
const lddContent = readFileSync45(LDD_PATH);
|
|
107682
107724
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
107683
107725
|
} catch (e) {}
|
|
107684
107726
|
return cachedFamilyFilesystem;
|
|
@@ -107701,7 +107743,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107701
107743
|
}
|
|
107702
107744
|
cachedFamilyInterpreter = null;
|
|
107703
107745
|
try {
|
|
107704
|
-
const selfContent =
|
|
107746
|
+
const selfContent = readFileSync45(SELF_PATH);
|
|
107705
107747
|
const path18 = interpreterPath(selfContent);
|
|
107706
107748
|
cachedFamilyInterpreter = familyFromInterpreterPath(path18);
|
|
107707
107749
|
} catch (e) {}
|
|
@@ -107763,7 +107805,7 @@ var require_detect_libc = __commonJS((exports2, module2) => {
|
|
|
107763
107805
|
}
|
|
107764
107806
|
cachedVersionFilesystem = null;
|
|
107765
107807
|
try {
|
|
107766
|
-
const lddContent =
|
|
107808
|
+
const lddContent = readFileSync45(LDD_PATH);
|
|
107767
107809
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
107768
107810
|
if (versionMatch) {
|
|
107769
107811
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -117579,7 +117621,7 @@ __export(exports_generate, {
|
|
|
117579
117621
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
117580
117622
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
117581
117623
|
});
|
|
117582
|
-
import { existsSync as existsSync70, readFileSync as
|
|
117624
|
+
import { existsSync as existsSync70, readFileSync as readFileSync55, realpathSync as realpathSync10 } from "fs";
|
|
117583
117625
|
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join75, resolve as resolve16 } from "path";
|
|
117584
117626
|
function profilesDirFor(opts) {
|
|
117585
117627
|
if (opts.profilesDir)
|
|
@@ -117677,7 +117719,7 @@ var init_generate = __esm(() => {
|
|
|
117677
117719
|
init_src4();
|
|
117678
117720
|
init_src4();
|
|
117679
117721
|
REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
117680
|
-
defaultFS2 = { existsSync: existsSync70, readFileSync:
|
|
117722
|
+
defaultFS2 = { existsSync: existsSync70, readFileSync: readFileSync55, realpathSync: realpathSync10 };
|
|
117681
117723
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
117682
117724
|
profileName;
|
|
117683
117725
|
constructor(profileName) {
|
|
@@ -117829,7 +117871,7 @@ var exports_profile_resolve = {};
|
|
|
117829
117871
|
__export(exports_profile_resolve, {
|
|
117830
117872
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
117831
117873
|
});
|
|
117832
|
-
import { existsSync as existsSync72, readdirSync as readdirSync15, readFileSync as
|
|
117874
|
+
import { existsSync as existsSync72, readdirSync as readdirSync15, readFileSync as readFileSync56 } from "fs";
|
|
117833
117875
|
import { join as join77, resolve as resolve17, dirname as dirname29 } from "path";
|
|
117834
117876
|
function executeProfileResolveCommand(args) {
|
|
117835
117877
|
if (args.options.help) {
|
|
@@ -117876,7 +117918,7 @@ function executeProfileResolveCommand(args) {
|
|
|
117876
117918
|
for (const file3 of profileFiles) {
|
|
117877
117919
|
try {
|
|
117878
117920
|
const filePath = join77(profilesDir, file3);
|
|
117879
|
-
const raw = JSON.parse(
|
|
117921
|
+
const raw = JSON.parse(readFileSync56(filePath, "utf-8"));
|
|
117880
117922
|
const profile2 = ProfileSchema.parse(raw);
|
|
117881
117923
|
registry2[profile2.name] = profile2;
|
|
117882
117924
|
} catch {}
|
|
@@ -117938,7 +117980,7 @@ __export(exports_export, {
|
|
|
117938
117980
|
getShell: () => getShell,
|
|
117939
117981
|
executeExportCommand: () => executeExportCommand
|
|
117940
117982
|
});
|
|
117941
|
-
import { existsSync as existsSync73, readFileSync as
|
|
117983
|
+
import { existsSync as existsSync73, readFileSync as readFileSync57, writeFileSync as writeFileSync25, copyFileSync as copyFileSync7, realpathSync as realpathSync11, mkdirSync as mkdirSync26 } from "fs";
|
|
117942
117984
|
import { isAbsolute as isAbsolute7, join as join78, resolve as resolve18, dirname as dirname30 } from "path";
|
|
117943
117985
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
117944
117986
|
function setShell(shell) {
|
|
@@ -118062,7 +118104,7 @@ var init_export = __esm(() => {
|
|
|
118062
118104
|
activeShell = defaultShell;
|
|
118063
118105
|
defaultExportFS = {
|
|
118064
118106
|
existsSync: existsSync73,
|
|
118065
|
-
readFileSync:
|
|
118107
|
+
readFileSync: readFileSync57,
|
|
118066
118108
|
writeFileSync: writeFileSync25,
|
|
118067
118109
|
copyFileSync: copyFileSync7,
|
|
118068
118110
|
realpathSync: realpathSync11,
|
|
@@ -118070,6 +118112,107 @@ var init_export = __esm(() => {
|
|
|
118070
118112
|
};
|
|
118071
118113
|
});
|
|
118072
118114
|
|
|
118115
|
+
// packages/omo-opencode/src/cli/gateway-set-token.ts
|
|
118116
|
+
var exports_gateway_set_token = {};
|
|
118117
|
+
__export(exports_gateway_set_token, {
|
|
118118
|
+
executeGatewaySetTokenCommand: () => executeGatewaySetTokenCommand
|
|
118119
|
+
});
|
|
118120
|
+
function isValidType(type2) {
|
|
118121
|
+
return VALID_TYPES.includes(type2);
|
|
118122
|
+
}
|
|
118123
|
+
async function readMaskedToken(prompt) {
|
|
118124
|
+
return new Promise((resolve19, reject) => {
|
|
118125
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
118126
|
+
reject(new Error("Interactive mode requires a TTY. Use --token <value> instead."));
|
|
118127
|
+
return;
|
|
118128
|
+
}
|
|
118129
|
+
process.stdout.write(prompt);
|
|
118130
|
+
process.stdin.setRawMode(true);
|
|
118131
|
+
process.stdin.resume();
|
|
118132
|
+
process.stdin.setEncoding("utf8");
|
|
118133
|
+
let token = "";
|
|
118134
|
+
const onData = (data) => {
|
|
118135
|
+
const chunk = typeof data === "string" ? data : data.toString("utf8");
|
|
118136
|
+
for (const char of chunk) {
|
|
118137
|
+
const code = char.charCodeAt(0);
|
|
118138
|
+
if (code === 13 || code === 10) {
|
|
118139
|
+
process.stdout.write(`
|
|
118140
|
+
`);
|
|
118141
|
+
process.stdin.setRawMode(false);
|
|
118142
|
+
process.stdin.pause();
|
|
118143
|
+
process.stdin.off("data", onData);
|
|
118144
|
+
resolve19(token);
|
|
118145
|
+
return;
|
|
118146
|
+
}
|
|
118147
|
+
if (code === 127 || code === 8) {
|
|
118148
|
+
if (token.length > 0) {
|
|
118149
|
+
token = token.slice(0, -1);
|
|
118150
|
+
process.stdout.write("\b \b");
|
|
118151
|
+
}
|
|
118152
|
+
continue;
|
|
118153
|
+
}
|
|
118154
|
+
if (code === 3) {
|
|
118155
|
+
process.stdin.setRawMode(false);
|
|
118156
|
+
process.stdin.pause();
|
|
118157
|
+
process.stdin.off("data", onData);
|
|
118158
|
+
process.stdout.write(`
|
|
118159
|
+
`);
|
|
118160
|
+
reject(new Error("Cancelled."));
|
|
118161
|
+
return;
|
|
118162
|
+
}
|
|
118163
|
+
if (code >= 32) {
|
|
118164
|
+
token += char;
|
|
118165
|
+
}
|
|
118166
|
+
}
|
|
118167
|
+
};
|
|
118168
|
+
process.stdin.on("data", onData);
|
|
118169
|
+
});
|
|
118170
|
+
}
|
|
118171
|
+
async function executeGatewaySetTokenCommand(args) {
|
|
118172
|
+
const type2 = args.options.type;
|
|
118173
|
+
if (!isValidType(type2)) {
|
|
118174
|
+
return {
|
|
118175
|
+
exitCode: 1,
|
|
118176
|
+
stdout: `error: invalid type "${type2}". Valid types: ${VALID_TYPES.join(", ")}
|
|
118177
|
+
`
|
|
118178
|
+
};
|
|
118179
|
+
}
|
|
118180
|
+
let token;
|
|
118181
|
+
if (args.options.interactive || !args.options.token) {
|
|
118182
|
+
try {
|
|
118183
|
+
token = await readMaskedToken(`Token ${type2} bot: `);
|
|
118184
|
+
} catch (err) {
|
|
118185
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
118186
|
+
return { exitCode: 1, stdout: `error: ${message}
|
|
118187
|
+
` };
|
|
118188
|
+
}
|
|
118189
|
+
} else {
|
|
118190
|
+
token = args.options.token;
|
|
118191
|
+
}
|
|
118192
|
+
if (!token || token.length === 0) {
|
|
118193
|
+
return { exitCode: 1, stdout: `error: token is required
|
|
118194
|
+
` };
|
|
118195
|
+
}
|
|
118196
|
+
try {
|
|
118197
|
+
const envPath = writeGatewayEnvToken(TYPE_TO_KEY[type2], token);
|
|
118198
|
+
return { exitCode: 0, stdout: `${envPath}
|
|
118199
|
+
` };
|
|
118200
|
+
} catch (err) {
|
|
118201
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
118202
|
+
return { exitCode: 1, stdout: `error: ${message}
|
|
118203
|
+
` };
|
|
118204
|
+
}
|
|
118205
|
+
}
|
|
118206
|
+
var VALID_TYPES, TYPE_TO_KEY;
|
|
118207
|
+
var init_gateway_set_token = __esm(() => {
|
|
118208
|
+
init_write_gateway_env();
|
|
118209
|
+
VALID_TYPES = ["telegram", "discord"];
|
|
118210
|
+
TYPE_TO_KEY = {
|
|
118211
|
+
telegram: "TELEGRAM_BOT_TOKEN",
|
|
118212
|
+
discord: "DISCORD_BOT_TOKEN"
|
|
118213
|
+
};
|
|
118214
|
+
});
|
|
118215
|
+
|
|
118073
118216
|
// packages/omo-opencode/src/cli/rgpd-command.ts
|
|
118074
118217
|
var exports_rgpd_command = {};
|
|
118075
118218
|
__export(exports_rgpd_command, {
|
|
@@ -120669,24 +120812,9 @@ var i2 = `${styleText2("gray", S_BAR)} `;
|
|
|
120669
120812
|
// packages/omo-opencode/src/cli/tui-installer.ts
|
|
120670
120813
|
init_shared();
|
|
120671
120814
|
init_config_manager();
|
|
120815
|
+
init_write_gateway_env();
|
|
120672
120816
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
120673
120817
|
|
|
120674
|
-
// packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
|
|
120675
|
-
init_config_context();
|
|
120676
|
-
import { existsSync as existsSync26, mkdirSync as mkdirSync9, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
|
|
120677
|
-
import { join as join26 } from "path";
|
|
120678
|
-
var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
|
|
120679
|
-
function writeGatewayEnv(token) {
|
|
120680
|
-
const configDir = getConfigDir();
|
|
120681
|
-
if (!existsSync26(configDir))
|
|
120682
|
-
mkdirSync9(configDir, { recursive: true });
|
|
120683
|
-
const envPath = join26(configDir, GATEWAY_ENV_FILENAME);
|
|
120684
|
-
writeFileSync6(envPath, `TELEGRAM_BOT_TOKEN=${token}
|
|
120685
|
-
`, { mode: 384 });
|
|
120686
|
-
chmodSync3(envPath, 384);
|
|
120687
|
-
return envPath;
|
|
120688
|
-
}
|
|
120689
|
-
|
|
120690
120818
|
// packages/omo-opencode/src/cli/tui-install-prompts.ts
|
|
120691
120819
|
init_model_fallback();
|
|
120692
120820
|
|
|
@@ -123474,7 +123602,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
123474
123602
|
var NOTEPAD_DIR = "notepads";
|
|
123475
123603
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
123476
123604
|
// packages/boulder-state/src/top-level-task.ts
|
|
123477
|
-
import { existsSync as existsSync30, readFileSync as
|
|
123605
|
+
import { existsSync as existsSync30, readFileSync as readFileSync17 } from "fs";
|
|
123478
123606
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
123479
123607
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
123480
123608
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -123501,7 +123629,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
123501
123629
|
return null;
|
|
123502
123630
|
}
|
|
123503
123631
|
try {
|
|
123504
|
-
const content =
|
|
123632
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
123505
123633
|
const lines = content.split(/\r?\n/);
|
|
123506
123634
|
let section = "other";
|
|
123507
123635
|
for (const line of lines) {
|
|
@@ -123553,7 +123681,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
123553
123681
|
return resolveBoulderPlanPath(directory, work);
|
|
123554
123682
|
}
|
|
123555
123683
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
123556
|
-
import { existsSync as existsSync32, readFileSync as
|
|
123684
|
+
import { existsSync as existsSync32, readFileSync as readFileSync18, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
123557
123685
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
123558
123686
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
123559
123687
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -123566,7 +123694,7 @@ function getPlanProgress(planPath) {
|
|
|
123566
123694
|
return { total: 0, completed: 0, isComplete: false };
|
|
123567
123695
|
}
|
|
123568
123696
|
try {
|
|
123569
|
-
const content =
|
|
123697
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
123570
123698
|
const lines = content.split(/\r?\n/);
|
|
123571
123699
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
123572
123700
|
if (hasStructuredSections) {
|
|
@@ -123682,14 +123810,14 @@ function selectMirrorWork(state) {
|
|
|
123682
123810
|
return sorted[0] ?? null;
|
|
123683
123811
|
}
|
|
123684
123812
|
// packages/boulder-state/src/storage/read-state.ts
|
|
123685
|
-
import { existsSync as existsSync33, readFileSync as
|
|
123813
|
+
import { existsSync as existsSync33, readFileSync as readFileSync19 } from "fs";
|
|
123686
123814
|
function readBoulderState(directory) {
|
|
123687
123815
|
const filePath = getBoulderFilePath(directory);
|
|
123688
123816
|
if (!existsSync33(filePath)) {
|
|
123689
123817
|
return null;
|
|
123690
123818
|
}
|
|
123691
123819
|
try {
|
|
123692
|
-
const content =
|
|
123820
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
123693
123821
|
const parsed = JSON.parse(content);
|
|
123694
123822
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
123695
123823
|
return null;
|
|
@@ -123755,7 +123883,7 @@ init_state();
|
|
|
123755
123883
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
123756
123884
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
123757
123885
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
123758
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as
|
|
123886
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync11, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
123759
123887
|
import { join as join30 } from "path";
|
|
123760
123888
|
function getMarkerPath(directory, sessionID) {
|
|
123761
123889
|
return join30(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
@@ -123765,7 +123893,7 @@ function readContinuationMarker(directory, sessionID) {
|
|
|
123765
123893
|
if (!existsSync34(markerPath))
|
|
123766
123894
|
return null;
|
|
123767
123895
|
try {
|
|
123768
|
-
const raw =
|
|
123896
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
123769
123897
|
const parsed = JSON.parse(raw);
|
|
123770
123898
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
123771
123899
|
return null;
|
|
@@ -123830,7 +123958,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
123830
123958
|
// packages/omo-opencode/src/hooks/the-operator/session-last-agent.ts
|
|
123831
123959
|
init_shared();
|
|
123832
123960
|
init_compaction_marker();
|
|
123833
|
-
import { readFileSync as
|
|
123961
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync5 } from "fs";
|
|
123834
123962
|
import { join as join31 } from "path";
|
|
123835
123963
|
var defaultSessionLastAgentDeps = {
|
|
123836
123964
|
getMessageDir,
|
|
@@ -123891,7 +124019,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
123891
124019
|
try {
|
|
123892
124020
|
const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
123893
124021
|
try {
|
|
123894
|
-
const content =
|
|
124022
|
+
const content = readFileSync21(join31(messageDir, fileName), "utf-8");
|
|
123895
124023
|
const parsed = JSON.parse(content);
|
|
123896
124024
|
return {
|
|
123897
124025
|
fileName,
|
|
@@ -123934,7 +124062,7 @@ init_agent_display_names();
|
|
|
123934
124062
|
|
|
123935
124063
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
123936
124064
|
init_frontmatter2();
|
|
123937
|
-
import { existsSync as existsSync35, readFileSync as
|
|
124065
|
+
import { existsSync as existsSync35, readFileSync as readFileSync22, writeFileSync as writeFileSync9, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
123938
124066
|
import { dirname as dirname12, join as join32 } from "path";
|
|
123939
124067
|
|
|
123940
124068
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
@@ -123952,7 +124080,7 @@ function readState(directory, customPath) {
|
|
|
123952
124080
|
return null;
|
|
123953
124081
|
}
|
|
123954
124082
|
try {
|
|
123955
|
-
const content =
|
|
124083
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
123956
124084
|
const { data, body } = parseFrontmatter(content);
|
|
123957
124085
|
const active = data.active;
|
|
123958
124086
|
const iteration = data.iteration;
|
|
@@ -124527,7 +124655,7 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
|
|
|
124527
124655
|
// packages/telemetry-core/src/activity-state.ts
|
|
124528
124656
|
init_atomic_write();
|
|
124529
124657
|
init_xdg_data_dir();
|
|
124530
|
-
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as
|
|
124658
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync23 } from "fs";
|
|
124531
124659
|
import { basename as basename6, join as join33 } from "path";
|
|
124532
124660
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
124533
124661
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
@@ -124571,7 +124699,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
124571
124699
|
return {};
|
|
124572
124700
|
}
|
|
124573
124701
|
try {
|
|
124574
|
-
const stateContent =
|
|
124702
|
+
const stateContent = readFileSync23(stateFilePath, "utf-8");
|
|
124575
124703
|
const stateJson = JSON.parse(stateContent);
|
|
124576
124704
|
if (!isPostHogActivityState(stateJson)) {
|
|
124577
124705
|
return {};
|
|
@@ -131690,7 +131818,7 @@ async function getLocalVersion(options = {}) {
|
|
|
131690
131818
|
}
|
|
131691
131819
|
}
|
|
131692
131820
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
131693
|
-
import { existsSync as existsSync47, readFileSync as
|
|
131821
|
+
import { existsSync as existsSync47, readFileSync as readFileSync33 } from "fs";
|
|
131694
131822
|
|
|
131695
131823
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
131696
131824
|
init_extract_semver();
|
|
@@ -131886,7 +132014,7 @@ function compareVersions3(current, minimum) {
|
|
|
131886
132014
|
|
|
131887
132015
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
131888
132016
|
init_shared();
|
|
131889
|
-
import { existsSync as existsSync45, readFileSync as
|
|
132017
|
+
import { existsSync as existsSync45, readFileSync as readFileSync31 } from "fs";
|
|
131890
132018
|
function detectConfigPath() {
|
|
131891
132019
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
131892
132020
|
if (existsSync45(paths2.configJsonc))
|
|
@@ -131937,7 +132065,7 @@ function getPluginInfo() {
|
|
|
131937
132065
|
};
|
|
131938
132066
|
}
|
|
131939
132067
|
try {
|
|
131940
|
-
const content =
|
|
132068
|
+
const content = readFileSync31(configPath, "utf-8");
|
|
131941
132069
|
const parsedConfig = parseJsonc(content);
|
|
131942
132070
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
131943
132071
|
if (!pluginEntry) {
|
|
@@ -131979,7 +132107,7 @@ init_file_utils2();
|
|
|
131979
132107
|
init_checker();
|
|
131980
132108
|
init_auto_update_checker();
|
|
131981
132109
|
init_package_json_locator();
|
|
131982
|
-
import { existsSync as existsSync46, readFileSync as
|
|
132110
|
+
import { existsSync as existsSync46, readFileSync as readFileSync32, readdirSync as readdirSync7 } from "fs";
|
|
131983
132111
|
import { createRequire as createRequire2 } from "module";
|
|
131984
132112
|
import { homedir as homedir11 } from "os";
|
|
131985
132113
|
import { join as join41 } from "path";
|
|
@@ -132011,7 +132139,7 @@ function readPackageJson(filePath) {
|
|
|
132011
132139
|
if (!existsSync46(filePath))
|
|
132012
132140
|
return null;
|
|
132013
132141
|
try {
|
|
132014
|
-
const content =
|
|
132142
|
+
const content = readFileSync32(filePath, "utf-8");
|
|
132015
132143
|
return parseJsonc(content);
|
|
132016
132144
|
} catch (error51) {
|
|
132017
132145
|
if (!(error51 instanceof Error)) {
|
|
@@ -132145,7 +132273,7 @@ var defaultDeps6 = {
|
|
|
132145
132273
|
getLatestPluginVersion,
|
|
132146
132274
|
getSuggestedInstallTag,
|
|
132147
132275
|
configExists: existsSync47,
|
|
132148
|
-
readConfigFile: (path14) =>
|
|
132276
|
+
readConfigFile: (path14) => readFileSync33(path14, "utf-8"),
|
|
132149
132277
|
parseConfigContent: (content) => parseJsonc(content)
|
|
132150
132278
|
};
|
|
132151
132279
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -132290,7 +132418,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
132290
132418
|
|
|
132291
132419
|
// packages/omo-opencode/src/config/validate.ts
|
|
132292
132420
|
init_src();
|
|
132293
|
-
import { readFileSync as
|
|
132421
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
132294
132422
|
import { homedir as homedir12 } from "os";
|
|
132295
132423
|
import { dirname as dirname18, relative as relative5 } from "path";
|
|
132296
132424
|
init_shared();
|
|
@@ -132335,7 +132463,7 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
132335
132463
|
}
|
|
132336
132464
|
function parseLayerConfig(configPath) {
|
|
132337
132465
|
try {
|
|
132338
|
-
const content =
|
|
132466
|
+
const content = readFileSync34(configPath, "utf-8");
|
|
132339
132467
|
const rawConfig = parseJsonc(content);
|
|
132340
132468
|
if (!isPlainRecord(rawConfig)) {
|
|
132341
132469
|
return {
|
|
@@ -132404,7 +132532,7 @@ function validatePluginConfig(directory) {
|
|
|
132404
132532
|
|
|
132405
132533
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
132406
132534
|
init_shared();
|
|
132407
|
-
import { existsSync as existsSync48, readFileSync as
|
|
132535
|
+
import { existsSync as existsSync48, readFileSync as readFileSync35 } from "fs";
|
|
132408
132536
|
import { homedir as homedir13 } from "os";
|
|
132409
132537
|
import { join as join42 } from "path";
|
|
132410
132538
|
function getUserConfigDir2() {
|
|
@@ -132423,7 +132551,7 @@ function loadCustomProviderNames() {
|
|
|
132423
132551
|
if (!existsSync48(configPath))
|
|
132424
132552
|
continue;
|
|
132425
132553
|
try {
|
|
132426
|
-
const content =
|
|
132554
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
132427
132555
|
const data = parseJsonc(content);
|
|
132428
132556
|
if (data?.provider && typeof data.provider === "object") {
|
|
132429
132557
|
return Object.keys(data.provider);
|
|
@@ -132447,7 +132575,7 @@ function loadAvailableModelsFromCache() {
|
|
|
132447
132575
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
132448
132576
|
}
|
|
132449
132577
|
try {
|
|
132450
|
-
const content =
|
|
132578
|
+
const content = readFileSync35(cacheFile, "utf-8");
|
|
132451
132579
|
const data = parseJsonc(content);
|
|
132452
132580
|
const cacheProviders = Object.keys(data);
|
|
132453
132581
|
let modelCount = 0;
|
|
@@ -132474,7 +132602,7 @@ init_model_capabilities2();
|
|
|
132474
132602
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
132475
132603
|
init_shared();
|
|
132476
132604
|
init_plugin_identity();
|
|
132477
|
-
import { readFileSync as
|
|
132605
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
132478
132606
|
import { join as join43 } from "path";
|
|
132479
132607
|
var PROJECT_CONFIG_DIR = join43(process.cwd(), ".opencode");
|
|
132480
132608
|
function loadOmoConfig() {
|
|
@@ -132484,7 +132612,7 @@ function loadOmoConfig() {
|
|
|
132484
132612
|
});
|
|
132485
132613
|
if (projectDetected.format !== "none") {
|
|
132486
132614
|
try {
|
|
132487
|
-
const content =
|
|
132615
|
+
const content = readFileSync36(projectDetected.path, "utf-8");
|
|
132488
132616
|
return parseJsonc(content);
|
|
132489
132617
|
} catch (error51) {
|
|
132490
132618
|
if (error51 instanceof Error) {
|
|
@@ -132500,7 +132628,7 @@ function loadOmoConfig() {
|
|
|
132500
132628
|
});
|
|
132501
132629
|
if (userDetected.format !== "none") {
|
|
132502
132630
|
try {
|
|
132503
|
-
const content =
|
|
132631
|
+
const content = readFileSync36(userDetected.path, "utf-8");
|
|
132504
132632
|
return parseJsonc(content);
|
|
132505
132633
|
} catch (error51) {
|
|
132506
132634
|
if (error51 instanceof Error) {
|
|
@@ -133081,13 +133209,13 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
133081
133209
|
}
|
|
133082
133210
|
|
|
133083
133211
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
133084
|
-
import { readFileSync as
|
|
133212
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
133085
133213
|
import { join as join47 } from "path";
|
|
133086
133214
|
|
|
133087
133215
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
133088
133216
|
init_zod();
|
|
133089
133217
|
init_opencode_config_dir();
|
|
133090
|
-
import { existsSync as existsSync50, readFileSync as
|
|
133218
|
+
import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
|
|
133091
133219
|
import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
|
|
133092
133220
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
133093
133221
|
|
|
@@ -133231,7 +133359,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
133231
133359
|
}
|
|
133232
133360
|
function readDaemonPackageVersion(root) {
|
|
133233
133361
|
try {
|
|
133234
|
-
const packageJson = JSON.parse(
|
|
133362
|
+
const packageJson = JSON.parse(readFileSync37(resolve10(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
133235
133363
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
133236
133364
|
} catch (error51) {
|
|
133237
133365
|
if (!(error51 instanceof Error))
|
|
@@ -133308,7 +133436,7 @@ function readOmoConfig(configDirectory) {
|
|
|
133308
133436
|
return null;
|
|
133309
133437
|
}
|
|
133310
133438
|
try {
|
|
133311
|
-
const content =
|
|
133439
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
133312
133440
|
return parseJsonc(content);
|
|
133313
133441
|
} catch (error51) {
|
|
133314
133442
|
if (!(error51 instanceof Error)) {
|
|
@@ -133338,7 +133466,7 @@ function getInstalledLspServers(options = {}) {
|
|
|
133338
133466
|
|
|
133339
133467
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
133340
133468
|
init_shared();
|
|
133341
|
-
import { existsSync as existsSync51, readFileSync as
|
|
133469
|
+
import { existsSync as existsSync51, readFileSync as readFileSync39 } from "fs";
|
|
133342
133470
|
import { homedir as homedir16 } from "os";
|
|
133343
133471
|
import { join as join48 } from "path";
|
|
133344
133472
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
@@ -133355,7 +133483,7 @@ function loadUserMcpConfig() {
|
|
|
133355
133483
|
if (!existsSync51(configPath))
|
|
133356
133484
|
continue;
|
|
133357
133485
|
try {
|
|
133358
|
-
const content =
|
|
133486
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
133359
133487
|
const config4 = parseJsonc(content);
|
|
133360
133488
|
if (config4.mcpServers) {
|
|
133361
133489
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -133489,7 +133617,7 @@ async function checkTools() {
|
|
|
133489
133617
|
}
|
|
133490
133618
|
|
|
133491
133619
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
133492
|
-
import { existsSync as existsSync52, readFileSync as
|
|
133620
|
+
import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
|
|
133493
133621
|
function isTelemetryState(value) {
|
|
133494
133622
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
133495
133623
|
}
|
|
@@ -133499,7 +133627,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
133499
133627
|
}
|
|
133500
133628
|
let parsed;
|
|
133501
133629
|
try {
|
|
133502
|
-
parsed = JSON.parse(
|
|
133630
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
133503
133631
|
} catch (error51) {
|
|
133504
133632
|
if (error51 instanceof Error) {
|
|
133505
133633
|
return "unreadable";
|
|
@@ -133574,7 +133702,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
133574
133702
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
133575
133703
|
init_shared();
|
|
133576
133704
|
init_plugin_identity();
|
|
133577
|
-
import { readFileSync as
|
|
133705
|
+
import { readFileSync as readFileSync41, promises as fs14 } from "fs";
|
|
133578
133706
|
import path15 from "path";
|
|
133579
133707
|
async function checkTeamMode() {
|
|
133580
133708
|
const config4 = loadTeamModeConfig();
|
|
@@ -133611,7 +133739,7 @@ function loadTeamModeConfig() {
|
|
|
133611
133739
|
if (!configPath)
|
|
133612
133740
|
return { team_mode: undefined };
|
|
133613
133741
|
try {
|
|
133614
|
-
return parseJsonc(
|
|
133742
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
133615
133743
|
} catch (error51) {
|
|
133616
133744
|
if (error51 instanceof Error) {
|
|
133617
133745
|
return { team_mode: undefined };
|
|
@@ -134043,7 +134171,7 @@ import {
|
|
|
134043
134171
|
existsSync as existsSync55,
|
|
134044
134172
|
mkdirSync as mkdirSync15,
|
|
134045
134173
|
readdirSync as readdirSync8,
|
|
134046
|
-
readFileSync as
|
|
134174
|
+
readFileSync as readFileSync43,
|
|
134047
134175
|
renameSync as renameSync7,
|
|
134048
134176
|
unlinkSync as unlinkSync8,
|
|
134049
134177
|
writeFileSync as writeFileSync13
|
|
@@ -134076,7 +134204,7 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
134076
134204
|
}
|
|
134077
134205
|
|
|
134078
134206
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
134079
|
-
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as
|
|
134207
|
+
import { chmodSync as chmodSync4, existsSync as existsSync54, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync12 } from "fs";
|
|
134080
134208
|
import { join as join50 } from "path";
|
|
134081
134209
|
var INDEX_FILE_NAME = "index.json";
|
|
134082
134210
|
function isTokenIndex(value) {
|
|
@@ -134092,7 +134220,7 @@ function readTokenIndex(storageDir) {
|
|
|
134092
134220
|
if (!existsSync54(indexPath))
|
|
134093
134221
|
return {};
|
|
134094
134222
|
try {
|
|
134095
|
-
const parsed = JSON.parse(
|
|
134223
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
134096
134224
|
return isTokenIndex(parsed) ? parsed : {};
|
|
134097
134225
|
} catch (readError) {
|
|
134098
134226
|
if (!(readError instanceof Error))
|
|
@@ -134202,7 +134330,7 @@ function readTokenFile(filePath) {
|
|
|
134202
134330
|
if (!existsSync55(filePath))
|
|
134203
134331
|
return null;
|
|
134204
134332
|
try {
|
|
134205
|
-
const parsed = JSON.parse(
|
|
134333
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134206
134334
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
134207
134335
|
} catch (readError) {
|
|
134208
134336
|
if (!(readError instanceof Error))
|
|
@@ -134215,7 +134343,7 @@ function readLegacyStore() {
|
|
|
134215
134343
|
if (!existsSync55(filePath))
|
|
134216
134344
|
return null;
|
|
134217
134345
|
try {
|
|
134218
|
-
const parsed = JSON.parse(
|
|
134346
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
134219
134347
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
134220
134348
|
return null;
|
|
134221
134349
|
const result = {};
|
|
@@ -135028,7 +135156,7 @@ function createEmbeddingPort() {
|
|
|
135028
135156
|
// packages/learning-loop/src/codebase-scanner.ts
|
|
135029
135157
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
135030
135158
|
import { createHash as createHash5 } from "crypto";
|
|
135031
|
-
import { readdirSync as readdirSync9, readFileSync as
|
|
135159
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync45, statSync as statSync7, existsSync as existsSync57 } from "fs";
|
|
135032
135160
|
import { join as join52, relative as relative6, extname as extname3 } from "path";
|
|
135033
135161
|
var EXT_TO_LANG = {
|
|
135034
135162
|
ts: "typescript",
|
|
@@ -135096,7 +135224,7 @@ function defaultFs() {
|
|
|
135096
135224
|
return readdirSync9(path18);
|
|
135097
135225
|
},
|
|
135098
135226
|
readFile(path18) {
|
|
135099
|
-
return
|
|
135227
|
+
return readFileSync45(path18, "utf-8");
|
|
135100
135228
|
},
|
|
135101
135229
|
stat(path18) {
|
|
135102
135230
|
const s = statSync7(path18);
|
|
@@ -135449,7 +135577,7 @@ function formatSearchResults(result) {
|
|
|
135449
135577
|
}
|
|
135450
135578
|
|
|
135451
135579
|
// packages/learning-loop/src/improvement.ts
|
|
135452
|
-
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as
|
|
135580
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync17, readFileSync as readFileSync46, writeFileSync as writeFileSync15 } from "fs";
|
|
135453
135581
|
import { join as join53, basename as basename10 } from "path";
|
|
135454
135582
|
function createImprovementStore(improvementsDir) {
|
|
135455
135583
|
if (!existsSync58(improvementsDir)) {
|
|
@@ -135476,7 +135604,7 @@ function createImprovementStore(improvementsDir) {
|
|
|
135476
135604
|
function get(id) {
|
|
135477
135605
|
const filePath = join53(improvementsDir, `${id}.json`);
|
|
135478
135606
|
try {
|
|
135479
|
-
const raw =
|
|
135607
|
+
const raw = readFileSync46(filePath, "utf-8");
|
|
135480
135608
|
return JSON.parse(raw);
|
|
135481
135609
|
} catch {
|
|
135482
135610
|
return null;
|
|
@@ -137930,10 +138058,10 @@ playwright-cli close
|
|
|
137930
138058
|
allowedTools: ["Bash(playwright-cli:*)"]
|
|
137931
138059
|
};
|
|
137932
138060
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
137933
|
-
import { readFileSync as
|
|
138061
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
137934
138062
|
import { join as join63 } from "path";
|
|
137935
138063
|
init_src();
|
|
137936
|
-
function createSharedSkillTemplateLoader(readFile3 =
|
|
138064
|
+
function createSharedSkillTemplateLoader(readFile3 = readFileSync49, skillsRootPath = sharedSkillsRootPath()) {
|
|
137937
138065
|
const cache = new Map;
|
|
137938
138066
|
return (skillName) => {
|
|
137939
138067
|
const cached2 = cache.get(skillName);
|
|
@@ -140293,7 +140421,7 @@ import {
|
|
|
140293
140421
|
existsSync as existsSync65,
|
|
140294
140422
|
mkdirSync as mkdirSync20,
|
|
140295
140423
|
copyFileSync as copyFileSync3,
|
|
140296
|
-
readFileSync as
|
|
140424
|
+
readFileSync as readFileSync50,
|
|
140297
140425
|
writeFileSync as writeFileSync18,
|
|
140298
140426
|
readdirSync as readdirSync10,
|
|
140299
140427
|
statSync as statSync8,
|
|
@@ -140310,7 +140438,7 @@ async function snapshotCli(options = {}) {
|
|
|
140310
140438
|
const realFs = {
|
|
140311
140439
|
existsSync: existsSync65,
|
|
140312
140440
|
mkdirSync: mkdirSync20,
|
|
140313
|
-
readFileSync:
|
|
140441
|
+
readFileSync: readFileSync50,
|
|
140314
140442
|
writeFileSync: writeFileSync18,
|
|
140315
140443
|
copyFileSync: copyFileSync3,
|
|
140316
140444
|
readdirSync: readdirSync10,
|
|
@@ -140376,7 +140504,7 @@ import {
|
|
|
140376
140504
|
existsSync as existsSync66,
|
|
140377
140505
|
mkdirSync as mkdirSync21,
|
|
140378
140506
|
copyFileSync as copyFileSync4,
|
|
140379
|
-
readFileSync as
|
|
140507
|
+
readFileSync as readFileSync51,
|
|
140380
140508
|
writeFileSync as writeFileSync19,
|
|
140381
140509
|
readdirSync as readdirSync11,
|
|
140382
140510
|
statSync as statSync9,
|
|
@@ -140389,7 +140517,7 @@ async function restoreCli(options) {
|
|
|
140389
140517
|
const realFs = {
|
|
140390
140518
|
existsSync: existsSync66,
|
|
140391
140519
|
mkdirSync: mkdirSync21,
|
|
140392
|
-
readFileSync:
|
|
140520
|
+
readFileSync: readFileSync51,
|
|
140393
140521
|
writeFileSync: writeFileSync19,
|
|
140394
140522
|
copyFileSync: copyFileSync4,
|
|
140395
140523
|
readdirSync: readdirSync11,
|
|
@@ -140404,7 +140532,7 @@ async function restoreCli(options) {
|
|
|
140404
140532
|
try {
|
|
140405
140533
|
restoreSnapshot(options.state, { snapshotDir, fs: realFs });
|
|
140406
140534
|
const manifestPath = path19.join(snapshotDir, options.state, "manifest.json");
|
|
140407
|
-
const raw =
|
|
140535
|
+
const raw = readFileSync51(manifestPath).toString("utf-8");
|
|
140408
140536
|
const parsed = JSON.parse(raw);
|
|
140409
140537
|
const fileCount = typeof parsed === "object" && parsed !== null && "files" in parsed && Array.isArray(parsed.files) ? parsed.files.length : 0;
|
|
140410
140538
|
if (options.json) {
|
|
@@ -140428,7 +140556,7 @@ import {
|
|
|
140428
140556
|
existsSync as existsSync67,
|
|
140429
140557
|
mkdirSync as mkdirSync22,
|
|
140430
140558
|
copyFileSync as copyFileSync5,
|
|
140431
|
-
readFileSync as
|
|
140559
|
+
readFileSync as readFileSync52,
|
|
140432
140560
|
writeFileSync as writeFileSync20,
|
|
140433
140561
|
readdirSync as readdirSync12,
|
|
140434
140562
|
statSync as statSync10,
|
|
@@ -140451,7 +140579,7 @@ async function snapshotListCli(options) {
|
|
|
140451
140579
|
const realFs = {
|
|
140452
140580
|
existsSync: existsSync67,
|
|
140453
140581
|
mkdirSync: mkdirSync22,
|
|
140454
|
-
readFileSync:
|
|
140582
|
+
readFileSync: readFileSync52,
|
|
140455
140583
|
writeFileSync: writeFileSync20,
|
|
140456
140584
|
copyFileSync: copyFileSync5,
|
|
140457
140585
|
readdirSync: readdirSync12,
|
|
@@ -140482,7 +140610,7 @@ import {
|
|
|
140482
140610
|
existsSync as existsSync68,
|
|
140483
140611
|
mkdirSync as mkdirSync23,
|
|
140484
140612
|
copyFileSync as copyFileSync6,
|
|
140485
|
-
readFileSync as
|
|
140613
|
+
readFileSync as readFileSync53,
|
|
140486
140614
|
writeFileSync as writeFileSync21,
|
|
140487
140615
|
readdirSync as readdirSync13,
|
|
140488
140616
|
statSync as statSync11,
|
|
@@ -140495,7 +140623,7 @@ async function snapshotPruneCli(options = {}) {
|
|
|
140495
140623
|
const realFs = {
|
|
140496
140624
|
existsSync: existsSync68,
|
|
140497
140625
|
mkdirSync: mkdirSync23,
|
|
140498
|
-
readFileSync:
|
|
140626
|
+
readFileSync: readFileSync53,
|
|
140499
140627
|
writeFileSync: writeFileSync21,
|
|
140500
140628
|
copyFileSync: copyFileSync6,
|
|
140501
140629
|
readdirSync: readdirSync13,
|
|
@@ -142225,6 +142353,20 @@ program2.command("export [name]").description("Export a mini-OS profile as a sta
|
|
|
142225
142353
|
process.exit(result.exitCode);
|
|
142226
142354
|
});
|
|
142227
142355
|
program2.addCommand(createMcpOAuthCommand());
|
|
142356
|
+
var gateway = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
|
|
142357
|
+
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", `
|
|
142358
|
+
Examples:
|
|
142359
|
+
$ matrixos gateway set-token telegram --token "123:ABC"
|
|
142360
|
+
$ matrixos gateway set-token discord -i
|
|
142361
|
+
`).action(async (type2, options) => {
|
|
142362
|
+
const { executeGatewaySetTokenCommand: executeGatewaySetTokenCommand2 } = await Promise.resolve().then(() => (init_gateway_set_token(), exports_gateway_set_token));
|
|
142363
|
+
const result = await executeGatewaySetTokenCommand2({
|
|
142364
|
+
positional: [type2],
|
|
142365
|
+
options: { type: type2, token: options.token, interactive: options.interactive ?? false }
|
|
142366
|
+
});
|
|
142367
|
+
process.stdout.write(result.stdout);
|
|
142368
|
+
process.exit(result.exitCode);
|
|
142369
|
+
});
|
|
142228
142370
|
function runCli() {
|
|
142229
142371
|
program2.parse();
|
|
142230
142372
|
}
|