@kl-c/matrixos 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -2163,7 +2163,7 @@ var package_default;
2163
2163
  var init_package = __esm(() => {
2164
2164
  package_default = {
2165
2165
  name: "@kl-c/matrixos",
2166
- version: "0.2.7",
2166
+ version: "0.2.9",
2167
2167
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2168
2168
  main: "./dist/index.js",
2169
2169
  types: "dist/index.d.ts",
@@ -67682,6 +67682,83 @@ var init_add_tui_plugin_to_tui_config = __esm(() => {
67682
67682
  init_write_file_atomically2();
67683
67683
  });
67684
67684
 
67685
+ // packages/omo-opencode/src/cli/slash-command-installer.ts
67686
+ import { existsSync as existsSync26, mkdirSync as mkdirSync9, copyFileSync as copyFileSync3, symlinkSync, readlinkSync } from "fs";
67687
+ import { join as join25 } from "path";
67688
+ import { homedir as homedir6 } from "os";
67689
+ function copySlashCommandsTo(dir) {
67690
+ try {
67691
+ if (!existsSync26(dir))
67692
+ mkdirSync9(dir, { recursive: true });
67693
+ let copied = 0;
67694
+ for (const name2 of SLASH_COMMAND_NAMES) {
67695
+ const src = join25(import.meta.dir, "slash-commands", name2);
67696
+ if (!existsSync26(src))
67697
+ continue;
67698
+ copyFileSync3(src, join25(dir, name2));
67699
+ copied++;
67700
+ }
67701
+ return copied;
67702
+ } catch {
67703
+ return 0;
67704
+ }
67705
+ }
67706
+ function resolveMatrixosBin() {
67707
+ const candidates = [
67708
+ join25(import.meta.dir, "..", "..", "bin", "matrixos.js"),
67709
+ join25(import.meta.dir, "..", "bin", "matrixos.js")
67710
+ ];
67711
+ for (const c of candidates) {
67712
+ if (existsSync26(c))
67713
+ return c;
67714
+ }
67715
+ return null;
67716
+ }
67717
+ function installSlashCommandsAndPath() {
67718
+ const home = homedir6();
67719
+ const targets = [
67720
+ join25(home, ".config", "opencode", "commands"),
67721
+ join25(home, ".claude", "commands")
67722
+ ];
67723
+ let total = 0;
67724
+ for (const t of targets)
67725
+ total += copySlashCommandsTo(t);
67726
+ let pathLinked = false;
67727
+ const bin = resolveMatrixosBin();
67728
+ const linkPath = "/usr/local/bin/matrixos";
67729
+ if (bin) {
67730
+ try {
67731
+ if (existsSync26(linkPath)) {
67732
+ try {
67733
+ const cur = readlinkSync(linkPath);
67734
+ if (cur !== bin) {
67735
+ symlinkSync(bin, linkPath + ".new");
67736
+ copyFileSync3(bin, linkPath);
67737
+ }
67738
+ } catch {
67739
+ copyFileSync3(bin, linkPath);
67740
+ }
67741
+ } else {
67742
+ symlinkSync(bin, linkPath);
67743
+ }
67744
+ pathLinked = true;
67745
+ } catch {
67746
+ pathLinked = false;
67747
+ }
67748
+ }
67749
+ return { commands: total, pathLinked };
67750
+ }
67751
+ var SLASH_COMMAND_NAMES;
67752
+ var init_slash_command_installer = __esm(() => {
67753
+ SLASH_COMMAND_NAMES = [
67754
+ "adopt.md",
67755
+ "readopt.md",
67756
+ "matrix-gateway-adopt-telegram.md",
67757
+ "matrix.md",
67758
+ "features.md"
67759
+ ];
67760
+ });
67761
+
67685
67762
  // packages/shared-skills/index.mjs
67686
67763
  import { fileURLToPath } from "url";
67687
67764
  function sharedSkillsRootPath() {
@@ -67690,8 +67767,8 @@ function sharedSkillsRootPath() {
67690
67767
  var init_shared_skills = () => {};
67691
67768
 
67692
67769
  // packages/omo-opencode/src/cli/install-ast-grep-sg.ts
67693
- import { homedir as homedir6 } from "os";
67694
- import { join as join25 } from "path";
67770
+ import { homedir as homedir7 } from "os";
67771
+ import { join as join26 } from "path";
67695
67772
  function describeResult(result) {
67696
67773
  if (result.kind === "succeeded")
67697
67774
  return null;
@@ -67701,9 +67778,9 @@ function describeResult(result) {
67701
67778
  }
67702
67779
  async function installAstGrepForOpenCode(options = {}) {
67703
67780
  const platform = options.platform ?? process.platform;
67704
- const baseDir = join25(options.homeDir ?? homedir6(), ".omo");
67781
+ const baseDir = join26(options.homeDir ?? homedir7(), ".omo");
67705
67782
  const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
67706
- const skillDir = join25(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
67783
+ const skillDir = join26(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
67707
67784
  const installer = options.installer ?? runAstGrepSkillInstall;
67708
67785
  try {
67709
67786
  const result = await installer({ platform, skillDir, targetDir });
@@ -67811,6 +67888,15 @@ async function runCliInstaller(args, version) {
67811
67888
  if (config.hasOpenCode && !hasAnyConfiguredProvider(config)) {
67812
67889
  printWarning(getNoModelProvidersWarning());
67813
67890
  }
67891
+ try {
67892
+ const slash = installSlashCommandsAndPath();
67893
+ if (slash.commands > 0)
67894
+ printSuccess(`Slash commands installed (${slash.commands} files)`);
67895
+ if (slash.pathLinked)
67896
+ printSuccess("matrixos available on PATH (/usr/local/bin/matrixos)");
67897
+ } catch (error) {
67898
+ printWarning(`Slash-command setup skipped: ${error instanceof Error ? error.message : String(error)}`);
67899
+ }
67814
67900
  console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
67815
67901
  if (hasOpenCode) {
67816
67902
  console.log(` Run ${import_picocolors3.default.cyan("opencode")} to start!`);
@@ -67872,6 +67958,7 @@ var init_cli_installer = __esm(() => {
67872
67958
  init_star_request();
67873
67959
  init_provider_availability();
67874
67960
  init_add_tui_plugin_to_tui_config();
67961
+ init_slash_command_installer();
67875
67962
  init_install_ast_grep_sg();
67876
67963
  import_picocolors3 = __toESM(require_picocolors(), 1);
67877
67964
  });
@@ -69511,15 +69598,16 @@ var init_dist5 = __esm(() => {
69511
69598
  });
69512
69599
 
69513
69600
  // packages/omo-opencode/src/cli/config-manager/write-gateway-env.ts
69514
- import { existsSync as existsSync26, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
69515
- import { join as join26 } from "path";
69601
+ import { homedir as homedir8 } from "os";
69602
+ import { existsSync as existsSync27, mkdirSync as mkdirSync10, readFileSync as readFileSync15, writeFileSync as writeFileSync6, chmodSync as chmodSync3 } from "fs";
69603
+ import { join as join27 } from "path";
69516
69604
  function writeGatewayEnvToken(key, token) {
69517
- const configDir = getConfigDir();
69518
- if (!existsSync26(configDir))
69519
- mkdirSync9(configDir, { recursive: true });
69520
- const envPath = join26(configDir, GATEWAY_ENV_FILENAME);
69605
+ const configDir = homedir8();
69606
+ if (!existsSync27(configDir))
69607
+ mkdirSync10(configDir, { recursive: true });
69608
+ const envPath = join27(configDir, GATEWAY_ENV_FILENAME);
69521
69609
  const entries = new Map;
69522
- if (existsSync26(envPath)) {
69610
+ if (existsSync27(envPath)) {
69523
69611
  const existing = readFileSync15(envPath, "utf-8");
69524
69612
  for (const rawLine of existing.split(`
69525
69613
  `)) {
@@ -69548,9 +69636,7 @@ function writeGatewayEnv(token) {
69548
69636
  return writeGatewayEnvToken("TELEGRAM_BOT_TOKEN", token);
69549
69637
  }
69550
69638
  var GATEWAY_ENV_FILENAME = ".klc-gateway.env";
69551
- var init_write_gateway_env = __esm(() => {
69552
- init_config_context();
69553
- });
69639
+ var init_write_gateway_env = () => {};
69554
69640
 
69555
69641
  // packages/omo-opencode/src/cli/senpi-platform-flag.ts
69556
69642
  function isSenpiPlatformEnabled(env2 = process.env) {
@@ -121213,7 +121299,7 @@ var require_dist9 = __commonJS((exports, module2) => {
121213
121299
  var import_node_worker_threads2 = __require("worker_threads");
121214
121300
  var import_collection2 = require_dist2();
121215
121301
  var import_node_events = __require("events");
121216
- var import_node_path24 = __require("path");
121302
+ var import_node_path25 = __require("path");
121217
121303
  var import_node_worker_threads = __require("worker_threads");
121218
121304
  var import_collection = require_dist2();
121219
121305
  var WorkerSendPayloadOp = /* @__PURE__ */ ((WorkerSendPayloadOp2) => {
@@ -121348,18 +121434,18 @@ var require_dist9 = __commonJS((exports, module2) => {
121348
121434
  resolveWorkerPath() {
121349
121435
  const path7 = this.options.workerPath;
121350
121436
  if (!path7) {
121351
- return (0, import_node_path24.join)(__dirname, "defaultWorker.js");
121437
+ return (0, import_node_path25.join)(__dirname, "defaultWorker.js");
121352
121438
  }
121353
- if ((0, import_node_path24.isAbsolute)(path7)) {
121439
+ if ((0, import_node_path25.isAbsolute)(path7)) {
121354
121440
  return path7;
121355
121441
  }
121356
121442
  if (/^\.\.?[/\\]/.test(path7)) {
121357
- return (0, import_node_path24.resolve)(path7);
121443
+ return (0, import_node_path25.resolve)(path7);
121358
121444
  }
121359
121445
  try {
121360
121446
  return __require.resolve(path7);
121361
121447
  } catch {
121362
- return (0, import_node_path24.resolve)(path7);
121448
+ return (0, import_node_path25.resolve)(path7);
121363
121449
  }
121364
121450
  }
121365
121451
  async waitForWorkerReady(worker) {
@@ -128876,8 +128962,8 @@ var init_writer2 = __esm(() => {
128876
128962
  });
128877
128963
 
128878
128964
  // packages/omo-config-core/src/generator/mini-os-generator.ts
128879
- import { existsSync as existsSync28, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8 } from "fs";
128880
- import { dirname as dirname9, join as join27 } from "path";
128965
+ import { existsSync as existsSync29, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8 } from "fs";
128966
+ import { dirname as dirname9, join as join28 } from "path";
128881
128967
  function generateMiniOS(options) {
128882
128968
  const fs6 = options.fs ?? defaultFS;
128883
128969
  const profile2 = options.profile;
@@ -128888,29 +128974,29 @@ function generateMiniOS(options) {
128888
128974
  if (!fs6.existsSync(targetDir)) {
128889
128975
  fs6.mkdirSync(targetDir, { recursive: true });
128890
128976
  }
128891
- const pkgPath = join27(targetDir, "package.json");
128977
+ const pkgPath = join28(targetDir, "package.json");
128892
128978
  writeIfMissing(fs6, pkgPath, TPL_PACKAGE_JSON(packageName, displayName, profile2.version, profile2.description, profile2.extends, profile2.baseAgent));
128893
128979
  filesWritten.push(pkgPath);
128894
- const srcDir = join27(targetDir, "src");
128980
+ const srcDir = join28(targetDir, "src");
128895
128981
  fs6.mkdirSync(srcDir, { recursive: true });
128896
- const indexPath = join27(srcDir, "index.ts");
128982
+ const indexPath = join28(srcDir, "index.ts");
128897
128983
  writeIfMissing(fs6, indexPath, TPL_INDEX_TS(profile2.name, displayName, profile2.description));
128898
128984
  filesWritten.push(indexPath);
128899
- const binDir = join27(targetDir, "bin");
128985
+ const binDir = join28(targetDir, "bin");
128900
128986
  fs6.mkdirSync(binDir, { recursive: true });
128901
- const binPath = join27(binDir, "matrixos-mini.js");
128987
+ const binPath = join28(binDir, "matrixos-mini.js");
128902
128988
  writeIfMissing(fs6, binPath, TPL_BIN);
128903
128989
  filesWritten.push(binPath);
128904
- const scriptDir = join27(targetDir, "script");
128990
+ const scriptDir = join28(targetDir, "script");
128905
128991
  fs6.mkdirSync(scriptDir, { recursive: true });
128906
- const buildPath = join27(scriptDir, "build.ts");
128992
+ const buildPath = join28(scriptDir, "build.ts");
128907
128993
  writeIfMissing(fs6, buildPath, TPL_BUILD_TS);
128908
128994
  filesWritten.push(buildPath);
128909
128995
  if (Object.keys(profile2.agents).length > 0) {
128910
- const agentsDir = join27(targetDir, "agents");
128996
+ const agentsDir = join28(targetDir, "agents");
128911
128997
  fs6.mkdirSync(agentsDir, { recursive: true });
128912
128998
  for (const [agentName, agentDef] of Object.entries(profile2.agents)) {
128913
- const agentFile = join27(agentsDir, `${agentName}.ts`);
128999
+ const agentFile = join28(agentsDir, `${agentName}.ts`);
128914
129000
  const description = agentDef.description ?? `Custom ${displayName} agent: ${agentName}`;
128915
129001
  writeIfMissing(fs6, agentFile, `// ${description}
128916
129002
  // Generated by MaTrixOS Mini-OS Profile Generator.
@@ -128921,10 +129007,10 @@ export const description = ${JSON.stringify(description)}
128921
129007
  }
128922
129008
  }
128923
129009
  if (profile2.skills.length > 0) {
128924
- const skillsDir = join27(targetDir, "skills");
129010
+ const skillsDir = join28(targetDir, "skills");
128925
129011
  fs6.mkdirSync(skillsDir, { recursive: true });
128926
129012
  for (const skill of profile2.skills) {
128927
- const skillFile = join27(skillsDir, `${skill}.md`);
129013
+ const skillFile = join28(skillsDir, `${skill}.md`);
128928
129014
  writeIfMissing(fs6, skillFile, `# ${skill}
128929
129015
 
128930
129016
  _Skill required by the ${displayName} profile. Implementation goes here._
@@ -128932,12 +129018,12 @@ _Skill required by the ${displayName} profile. Implementation goes here._
128932
129018
  filesWritten.push(skillFile);
128933
129019
  }
128934
129020
  }
128935
- const readmePath = join27(targetDir, "README.md");
129021
+ const readmePath = join28(targetDir, "README.md");
128936
129022
  const agentsList = Object.keys(profile2.agents);
128937
129023
  const skillsList = profile2.skills;
128938
129024
  writeIfMissing(fs6, readmePath, TPL_README(packageName, displayName, profile2.description, profile2.version, profile2.baseAgent, profile2.extends, agentsList, skillsList));
128939
129025
  filesWritten.push(readmePath);
128940
- const agentsMdPath = join27(targetDir, "AGENTS.md");
129026
+ const agentsMdPath = join28(targetDir, "AGENTS.md");
128941
129027
  writeIfMissing(fs6, agentsMdPath, TPL_AGENT_MD(displayName, profile2.description));
128942
129028
  filesWritten.push(agentsMdPath);
128943
129029
  return { packageName, packageDir: targetDir, filesWritten };
@@ -129089,7 +129175,7 @@ This profile is activated when the user mentions the profile name in their reque
129089
129175
  - Profiles can be composed: multiple profiles in \`profiles: [...]\` are merged in order.
129090
129176
  `;
129091
129177
  var init_mini_os_generator = __esm(() => {
129092
- defaultFS = { existsSync: existsSync28, mkdirSync: mkdirSync10, writeFileSync: writeFileSync8 };
129178
+ defaultFS = { existsSync: existsSync29, mkdirSync: mkdirSync11, writeFileSync: writeFileSync8 };
129093
129179
  });
129094
129180
 
129095
129181
  // packages/omo-config-core/src/generator/index.ts
@@ -129798,8 +129884,8 @@ var init_update_toasts = __esm(() => {
129798
129884
  });
129799
129885
 
129800
129886
  // packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
129801
- import { existsSync as existsSync44 } from "fs";
129802
- import { dirname as dirname17, join as join39 } from "path";
129887
+ import { existsSync as existsSync45 } from "fs";
129888
+ import { dirname as dirname17, join as join40 } from "path";
129803
129889
  import { fileURLToPath as fileURLToPath4 } from "url";
129804
129890
  function defaultGetModuleHostingWorkspace() {
129805
129891
  try {
@@ -129952,8 +130038,8 @@ var init_background_update_check = __esm(() => {
129952
130038
  init_package_json_locator();
129953
130039
  init_update_toasts();
129954
130040
  defaultDeps4 = {
129955
- existsSync: existsSync44,
129956
- join: join39,
130041
+ existsSync: existsSync45,
130042
+ join: join40,
129957
130043
  runBunInstallWithDetails,
129958
130044
  log: log2,
129959
130045
  getOpenCodeCacheDir,
@@ -154937,7 +155023,7 @@ var require_libvips = __commonJS((exports2, module2) => {
154937
155023
  shell: true
154938
155024
  };
154939
155025
  var vendorPath = path18.join(__dirname, "..", "vendor", minimumLibvipsVersion, platform());
154940
- var mkdirSync17 = function(dirPath) {
155026
+ var mkdirSync18 = function(dirPath) {
154941
155027
  try {
154942
155028
  fs18.mkdirSync(dirPath, { recursive: true });
154943
155029
  } catch (err) {
@@ -154948,9 +155034,9 @@ var require_libvips = __commonJS((exports2, module2) => {
154948
155034
  };
154949
155035
  var cachePath = function() {
154950
155036
  const npmCachePath = env4.npm_config_cache || (env4.APPDATA ? path18.join(env4.APPDATA, "npm-cache") : path18.join(os7.homedir(), ".npm"));
154951
- mkdirSync17(npmCachePath);
155037
+ mkdirSync18(npmCachePath);
154952
155038
  const libvipsCachePath = path18.join(npmCachePath, "_libvips");
154953
- mkdirSync17(libvipsCachePath);
155039
+ mkdirSync18(libvipsCachePath);
154954
155040
  return libvipsCachePath;
154955
155041
  };
154956
155042
  var integrity = function(platformAndArch) {
@@ -155027,7 +155113,7 @@ var require_libvips = __commonJS((exports2, module2) => {
155027
155113
  removeVendoredLibvips,
155028
155114
  pkgConfigPath,
155029
155115
  useGlobalLibvips,
155030
- mkdirSync: mkdirSync17
155116
+ mkdirSync: mkdirSync18
155031
155117
  };
155032
155118
  });
155033
155119
 
@@ -164783,19 +164869,19 @@ __export(exports_generate, {
164783
164869
  executeGenerateCommand: () => executeGenerateCommand,
164784
164870
  ProfileNotFoundError: () => ProfileNotFoundError
164785
164871
  });
164786
- import { existsSync as existsSync71, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
164787
- import { dirname as dirname28, isAbsolute as isAbsolute6, join as join76, resolve as resolve16 } from "path";
164872
+ import { existsSync as existsSync72, readFileSync as readFileSync57, realpathSync as realpathSync10 } from "fs";
164873
+ import { dirname as dirname28, isAbsolute as isAbsolute6, join as join77, resolve as resolve16 } from "path";
164788
164874
  function profilesDirFor(opts) {
164789
164875
  if (opts.profilesDir)
164790
164876
  return opts.profilesDir;
164791
164877
  if (opts.cwd)
164792
- return join76(opts.cwd, PROFILES_RELATIVE);
164793
- return join76(REPO_ROOT, PROFILES_RELATIVE);
164878
+ return join77(opts.cwd, PROFILES_RELATIVE);
164879
+ return join77(REPO_ROOT, PROFILES_RELATIVE);
164794
164880
  }
164795
164881
  function loadProfile(name2, options = {}) {
164796
164882
  const fs22 = options.fs ?? defaultFS2;
164797
164883
  const dir = profilesDirFor(options);
164798
- const path27 = join76(dir, `${name2}.json`);
164884
+ const path27 = join77(dir, `${name2}.json`);
164799
164885
  if (!fs22.existsSync(path27)) {
164800
164886
  throw new ProfileNotFoundError(name2);
164801
164887
  }
@@ -164808,7 +164894,7 @@ function listProfiles(options = {}) {
164808
164894
  const known = options.knownNames ?? ["trader", "plumber"];
164809
164895
  const out = [];
164810
164896
  for (const name2 of known) {
164811
- const path27 = join76(dir, `${name2}.json`);
164897
+ const path27 = join77(dir, `${name2}.json`);
164812
164898
  if (fs22.existsSync(path27)) {
164813
164899
  try {
164814
164900
  const raw = JSON.parse(fs22.readFileSync(path27, "utf-8"));
@@ -164881,7 +164967,7 @@ var init_generate = __esm(() => {
164881
164967
  init_src5();
164882
164968
  init_src5();
164883
164969
  REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
164884
- defaultFS2 = { existsSync: existsSync71, readFileSync: readFileSync57, realpathSync: realpathSync10 };
164970
+ defaultFS2 = { existsSync: existsSync72, readFileSync: readFileSync57, realpathSync: realpathSync10 };
164885
164971
  ProfileNotFoundError = class ProfileNotFoundError extends Error {
164886
164972
  profileName;
164887
164973
  constructor(profileName) {
@@ -165000,12 +165086,12 @@ __export(exports_cost_report, {
165000
165086
  executeCostReportCommand: () => executeCostReportCommand
165001
165087
  });
165002
165088
  import { Database as Database6 } from "bun:sqlite";
165003
- import { existsSync as existsSync72 } from "fs";
165089
+ import { existsSync as existsSync73 } from "fs";
165004
165090
  import * as path28 from "path";
165005
165091
  import * as os14 from "os";
165006
165092
  function executeCostReportCommand(args) {
165007
165093
  const dbPath = path28.join(os14.homedir(), ".matrixos", "cost.db");
165008
- if (!existsSync72(dbPath)) {
165094
+ if (!existsSync73(dbPath)) {
165009
165095
  return { exitCode: 1, stdout: `No cost data available
165010
165096
  ` };
165011
165097
  }
@@ -165135,8 +165221,8 @@ var exports_profile_resolve = {};
165135
165221
  __export(exports_profile_resolve, {
165136
165222
  executeProfileResolveCommand: () => executeProfileResolveCommand
165137
165223
  });
165138
- import { existsSync as existsSync73, readdirSync as readdirSync15, readFileSync as readFileSync58 } from "fs";
165139
- import { join as join79, resolve as resolve17, dirname as dirname29 } from "path";
165224
+ import { existsSync as existsSync74, readdirSync as readdirSync15, readFileSync as readFileSync58 } from "fs";
165225
+ import { join as join80, resolve as resolve17, dirname as dirname29 } from "path";
165140
165226
  function executeProfileResolveCommand(args) {
165141
165227
  if (args.options.help) {
165142
165228
  return {
@@ -165161,8 +165247,8 @@ function executeProfileResolveCommand(args) {
165161
165247
  ` };
165162
165248
  }
165163
165249
  const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
165164
- const profilesDir = join79(REPO_ROOT2, PROFILES_RELATIVE2);
165165
- if (!existsSync73(profilesDir)) {
165250
+ const profilesDir = join80(REPO_ROOT2, PROFILES_RELATIVE2);
165251
+ if (!existsSync74(profilesDir)) {
165166
165252
  return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
165167
165253
  ` };
165168
165254
  }
@@ -165181,7 +165267,7 @@ function executeProfileResolveCommand(args) {
165181
165267
  const registry2 = {};
165182
165268
  for (const file3 of profileFiles) {
165183
165269
  try {
165184
- const filePath = join79(profilesDir, file3);
165270
+ const filePath = join80(profilesDir, file3);
165185
165271
  const raw = JSON.parse(readFileSync58(filePath, "utf-8"));
165186
165272
  const profile2 = ProfileSchema.parse(raw);
165187
165273
  registry2[profile2.name] = profile2;
@@ -165244,8 +165330,8 @@ __export(exports_export, {
165244
165330
  getShell: () => getShell,
165245
165331
  executeExportCommand: () => executeExportCommand
165246
165332
  });
165247
- import { existsSync as existsSync74, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync7, realpathSync as realpathSync11, mkdirSync as mkdirSync26 } from "fs";
165248
- import { isAbsolute as isAbsolute7, join as join80, resolve as resolve18, dirname as dirname30 } from "path";
165333
+ import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync26, copyFileSync as copyFileSync8, realpathSync as realpathSync11, mkdirSync as mkdirSync27 } from "fs";
165334
+ import { isAbsolute as isAbsolute7, join as join81, resolve as resolve18, dirname as dirname30 } from "path";
165249
165335
  import { spawnSync as spawnSync3 } from "child_process";
165250
165336
  function setShell(shell) {
165251
165337
  activeShell = shell;
@@ -165286,7 +165372,7 @@ function executeExportCommand(args) {
165286
165372
  return { exitCode: 1, stdout: `error: generate failed: ${message}
165287
165373
  ` };
165288
165374
  }
165289
- const pkgPath = join80(absoluteTargetDir, "package.json");
165375
+ const pkgPath = join81(absoluteTargetDir, "package.json");
165290
165376
  let pkg;
165291
165377
  try {
165292
165378
  pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf-8"));
@@ -165326,7 +165412,7 @@ ${packResult.stdout}
165326
165412
  return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
165327
165413
  ` };
165328
165414
  }
165329
- let tgzPath = join80(absoluteTargetDir, tgzName);
165415
+ let tgzPath = join81(absoluteTargetDir, tgzName);
165330
165416
  if (args.options.output) {
165331
165417
  const outputPath = args.options.output;
165332
165418
  const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
@@ -165367,12 +165453,12 @@ var init_export = __esm(() => {
165367
165453
  };
165368
165454
  activeShell = defaultShell;
165369
165455
  defaultExportFS = {
165370
- existsSync: existsSync74,
165456
+ existsSync: existsSync75,
165371
165457
  readFileSync: readFileSync59,
165372
165458
  writeFileSync: writeFileSync26,
165373
- copyFileSync: copyFileSync7,
165459
+ copyFileSync: copyFileSync8,
165374
165460
  realpathSync: realpathSync11,
165375
- mkdirSync: mkdirSync26
165461
+ mkdirSync: mkdirSync27
165376
165462
  };
165377
165463
  });
165378
165464
 
@@ -165396,23 +165482,23 @@ __export(exports_project_context, {
165396
165482
  createProject: () => createProject,
165397
165483
  archiveProject: () => archiveProject
165398
165484
  });
165399
- import { existsSync as existsSync75, mkdirSync as mkdirSync27, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
165400
- import { join as join81 } from "path";
165485
+ import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync60, writeFileSync as writeFileSync27, rmSync as rmSync8 } from "fs";
165486
+ import { join as join82 } from "path";
165401
165487
  function getMatrixOsDir(cwd = process.cwd()) {
165402
- return join81(cwd, ".matrixos");
165488
+ return join82(cwd, ".matrixos");
165403
165489
  }
165404
165490
  function getProjectsDir(cwd) {
165405
- return join81(getMatrixOsDir(cwd), "projects");
165491
+ return join82(getMatrixOsDir(cwd), "projects");
165406
165492
  }
165407
165493
  function getProjectDir(slug, cwd) {
165408
- return join81(getProjectsDir(cwd), slug);
165494
+ return join82(getProjectsDir(cwd), slug);
165409
165495
  }
165410
165496
  function getStatePath(cwd) {
165411
- return join81(getMatrixOsDir(cwd), "state.json");
165497
+ return join82(getMatrixOsDir(cwd), "state.json");
165412
165498
  }
165413
165499
  function loadState(cwd) {
165414
165500
  const path29 = getStatePath(cwd);
165415
- if (!existsSync75(path29))
165501
+ if (!existsSync76(path29))
165416
165502
  return {};
165417
165503
  try {
165418
165504
  return JSON.parse(readFileSync60(path29, "utf-8"));
@@ -165422,13 +165508,13 @@ function loadState(cwd) {
165422
165508
  }
165423
165509
  function saveState(state2, cwd) {
165424
165510
  const path29 = getStatePath(cwd);
165425
- mkdirSync27(getMatrixOsDir(cwd), { recursive: true });
165511
+ mkdirSync28(getMatrixOsDir(cwd), { recursive: true });
165426
165512
  writeFileSync27(path29, JSON.stringify(state2, null, 2) + `
165427
165513
  `);
165428
165514
  }
165429
165515
  function loadProjectMeta(slug, cwd) {
165430
- const path29 = join81(getProjectDir(slug, cwd), "meta.json");
165431
- if (!existsSync75(path29))
165516
+ const path29 = join82(getProjectDir(slug, cwd), "meta.json");
165517
+ if (!existsSync76(path29))
165432
165518
  return null;
165433
165519
  try {
165434
165520
  return JSON.parse(readFileSync60(path29, "utf-8"));
@@ -165438,16 +165524,16 @@ function loadProjectMeta(slug, cwd) {
165438
165524
  }
165439
165525
  function saveProjectMeta(slug, meta3, cwd) {
165440
165526
  const dir = getProjectDir(slug, cwd);
165441
- mkdirSync27(dir, { recursive: true });
165442
- const path29 = join81(dir, "meta.json");
165527
+ mkdirSync28(dir, { recursive: true });
165528
+ const path29 = join82(dir, "meta.json");
165443
165529
  writeFileSync27(path29, JSON.stringify(meta3, null, 2) + `
165444
165530
  `);
165445
165531
  }
165446
165532
  function initProjectFiles(slug, cwd) {
165447
165533
  const dir = getProjectDir(slug, cwd);
165448
- mkdirSync27(join81(dir, "kb"), { recursive: true });
165449
- const kanbanPath = join81(dir, "kanban.json");
165450
- if (!existsSync75(kanbanPath)) {
165534
+ mkdirSync28(join82(dir, "kb"), { recursive: true });
165535
+ const kanbanPath = join82(dir, "kanban.json");
165536
+ if (!existsSync76(kanbanPath)) {
165451
165537
  writeFileSync27(kanbanPath, JSON.stringify({ columns: ["todo", "in-progress", "review", "done"], tasks: [] }, null, 2) + `
165452
165538
  `);
165453
165539
  }
@@ -165457,7 +165543,7 @@ function createProject(slug, options = {}) {
165457
165543
  throw new Error(`Invalid project slug "${slug}": only lowercase letters, numbers, - and _ are allowed.`);
165458
165544
  }
165459
165545
  const dir = getProjectDir(slug, options.cwd);
165460
- if (existsSync75(dir)) {
165546
+ if (existsSync76(dir)) {
165461
165547
  throw new Error(`Project "${slug}" already exists.`);
165462
165548
  }
165463
165549
  const now = new Date().toISOString();
@@ -165478,7 +165564,7 @@ function createProject(slug, options = {}) {
165478
165564
  function listProjects(cwd) {
165479
165565
  const state2 = loadState(cwd);
165480
165566
  const root = getProjectsDir(cwd);
165481
- if (!existsSync75(root))
165567
+ if (!existsSync76(root))
165482
165568
  return [];
165483
165569
  const fs24 = __require("fs");
165484
165570
  const items = [];
@@ -165526,7 +165612,7 @@ function unarchiveProject(slug, cwd) {
165526
165612
  }
165527
165613
  function deleteProject(slug, cwd) {
165528
165614
  const dir = getProjectDir(slug, cwd);
165529
- if (!existsSync75(dir))
165615
+ if (!existsSync76(dir))
165530
165616
  throw new Error(`Project "${slug}" does not exist.`);
165531
165617
  rmSync8(dir, { recursive: true, force: true });
165532
165618
  const state2 = loadState(cwd);
@@ -165557,8 +165643,8 @@ __export(exports_project_memory, {
165557
165643
  isProjectEpisode: () => isProjectEpisode,
165558
165644
  addKbDocument: () => addKbDocument
165559
165645
  });
165560
- import { existsSync as existsSync76, mkdirSync as mkdirSync28, readFileSync as readFileSync61, readdirSync as readdirSync16, writeFileSync as writeFileSync28 } from "fs";
165561
- import { join as join82 } from "path";
165646
+ import { existsSync as existsSync77, mkdirSync as mkdirSync29, readFileSync as readFileSync61, readdirSync as readdirSync16, writeFileSync as writeFileSync28 } from "fs";
165647
+ import { join as join83 } from "path";
165562
165648
  function tagWithProject(metadata = {}, projectSlug, cwd) {
165563
165649
  const active = projectSlug ?? getActiveProject(cwd)?.slug;
165564
165650
  if (!active)
@@ -165572,14 +165658,14 @@ function isProjectEpisode(ep, projectSlug, cwd) {
165572
165658
  return ep.metadata?.project === target;
165573
165659
  }
165574
165660
  function listKbDocuments(projectSlug, cwd) {
165575
- const kbDir = join82(getProjectDir(projectSlug, cwd), "kb");
165576
- if (!existsSync76(kbDir))
165661
+ const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
165662
+ if (!existsSync77(kbDir))
165577
165663
  return [];
165578
165664
  const docs = [];
165579
165665
  for (const entry of readdirSync16(kbDir, { withFileTypes: true })) {
165580
165666
  if (!entry.isFile())
165581
165667
  continue;
165582
- const path29 = join82(kbDir, entry.name);
165668
+ const path29 = join83(kbDir, entry.name);
165583
165669
  try {
165584
165670
  docs.push({ path: path29, content: readFileSync61(path29, "utf-8") });
165585
165671
  } catch {}
@@ -165623,10 +165709,10 @@ async function searchProject(query, options = {}) {
165623
165709
  return [...kbHits, ...memoryHits].sort((a2, b2) => b2.score - a2.score);
165624
165710
  }
165625
165711
  function addKbDocument(projectSlug, filename, content, cwd) {
165626
- const kbDir = join82(getProjectDir(projectSlug, cwd), "kb");
165627
- mkdirSync28(kbDir, { recursive: true });
165712
+ const kbDir = join83(getProjectDir(projectSlug, cwd), "kb");
165713
+ mkdirSync29(kbDir, { recursive: true });
165628
165714
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_");
165629
- const path29 = join82(kbDir, safeName);
165715
+ const path29 = join83(kbDir, safeName);
165630
165716
  writeFileSync28(path29, content, "utf-8");
165631
165717
  return path29;
165632
165718
  }
@@ -165884,8 +165970,42 @@ import { spawn as spawn5 } from "child_process";
165884
165970
  function maskSecrets(s) {
165885
165971
  return s.replace(/[0-9]{6,}:[A-Za-z0-9_-]{30,}/g, "<telegram-token>").replace(/Bearer\s+[A-Za-z0-9_.-]{20,}/gi, "Bearer <redacted>").replace(/sk-[A-Za-z0-9]{20,}/g, "sk-<redacted>");
165886
165972
  }
165973
+ function isReadoptCommand(env5) {
165974
+ const t2 = env5.content.text?.trim() ?? "";
165975
+ return t2 === READOPT_COMMAND || t2.startsWith(READOPT_COMMAND + " ");
165976
+ }
165977
+ function isTelegramAdoptCommand(env5) {
165978
+ const t2 = env5.content.text?.trim() ?? "";
165979
+ return t2 === TELEGRAM_ADOPT_COMMAND || t2.startsWith(TELEGRAM_ADOPT_COMMAND + " ");
165980
+ }
165981
+ async function runCliCommand(args, replyMsg) {
165982
+ const started = Date.now();
165983
+ return new Promise((resolve19) => {
165984
+ let settled = false;
165985
+ const finish = (result) => {
165986
+ if (settled)
165987
+ return;
165988
+ settled = true;
165989
+ resolve19({ ...result, durationMs: Date.now() - started });
165990
+ };
165991
+ let child;
165992
+ try {
165993
+ child = spawn5("matrixos", args, { cwd: process.cwd(), timeout: 30000 });
165994
+ } catch (e) {
165995
+ return finish({ ok: true, reply: replyMsg, exitCode: 0 });
165996
+ }
165997
+ child.on("error", () => finish({ ok: true, reply: replyMsg, exitCode: 0 }));
165998
+ child.on("exit", () => finish({ ok: true, reply: replyMsg, exitCode: 0 }));
165999
+ });
166000
+ }
165887
166001
  async function handleGatewayMessage(env5, opts = {}) {
165888
166002
  const text = env5.content.text ?? "";
166003
+ if (isReadoptCommand(env5)) {
166004
+ return runCliCommand(["adopt"], "Re-adoption MaTrixOS lancee. Suis le wizard localement.");
166005
+ }
166006
+ if (isTelegramAdoptCommand(env5)) {
166007
+ return runCliCommand(["gateway", "adopt", "telegram"], "Configuration Telegram lancee. Colle ton bot token quand demande (jamais par chat).");
166008
+ }
165889
166009
  const command = opts.command ?? "matrixos";
165890
166010
  const argsTemplate = opts.args ?? ["run", text];
165891
166011
  const args = argsTemplate.map((a2) => a2 === "{text}" ? text : a2);
@@ -165958,6 +166078,7 @@ ${maskSecrets(stderr.trim())}`,
165958
166078
  });
165959
166079
  });
165960
166080
  }
166081
+ var READOPT_COMMAND = "/readopt", TELEGRAM_ADOPT_COMMAND = "/matrix-gateway-adopt-telegram";
165961
166082
  var init_gateway_handler = () => {};
165962
166083
 
165963
166084
  // packages/omo-opencode/src/cli/gateway-start.ts
@@ -165968,10 +166089,10 @@ __export(exports_gateway_start, {
165968
166089
  buildTelegramConfig: () => buildTelegramConfig,
165969
166090
  buildGatewayConfig: () => buildGatewayConfig
165970
166091
  });
165971
- import { readFileSync as readFileSync62, existsSync as existsSync77 } from "fs";
166092
+ import { readFileSync as readFileSync62, existsSync as existsSync78 } from "fs";
165972
166093
  import { resolve as resolve19 } from "path";
165973
166094
  function loadGatewayEnv(path29 = ENV_PATH) {
165974
- if (!existsSync77(path29))
166095
+ if (!existsSync78(path29))
165975
166096
  return {};
165976
166097
  const text = readFileSync62(path29, "utf8");
165977
166098
  const out = {};
@@ -166110,7 +166231,7 @@ var init_deployment_core = __esm(() => {
166110
166231
 
166111
166232
  // packages/omo-opencode/src/deployment/deploy-static.ts
166112
166233
  import { spawn as spawn6 } from "child_process";
166113
- import { existsSync as existsSync78 } from "fs";
166234
+ import { existsSync as existsSync79 } from "fs";
166114
166235
  import { resolve as resolve20 } from "path";
166115
166236
  function pushStage(stage, message, ok = true) {
166116
166237
  return { stage, message, ok };
@@ -166167,7 +166288,7 @@ var init_deploy_static = __esm(() => {
166167
166288
  }
166168
166289
  stages.push(pushStage("build", "build succeeded"));
166169
166290
  }
166170
- if (!existsSync78(buildDir)) {
166291
+ if (!existsSync79(buildDir)) {
166171
166292
  stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
166172
166293
  return { target: "static", ok: false, stages, error: "build directory missing" };
166173
166294
  }
@@ -166443,10 +166564,10 @@ var init_deployment = __esm(() => {
166443
166564
  });
166444
166565
 
166445
166566
  // packages/omo-opencode/src/audit/self-audit.ts
166446
- import { existsSync as existsSync79, mkdirSync as mkdirSync29, readdirSync as readdirSync17, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
166447
- import { join as join83 } from "path";
166567
+ import { existsSync as existsSync80, mkdirSync as mkdirSync30, readdirSync as readdirSync17, readFileSync as readFileSync63, writeFileSync as writeFileSync29 } from "fs";
166568
+ import { join as join84 } from "path";
166448
166569
  function getAuditDir(cwd = process.cwd()) {
166449
- return join83(cwd, ".matrixos", "audits");
166570
+ return join84(cwd, ".matrixos", "audits");
166450
166571
  }
166451
166572
  function getWeekString(date5 = new Date) {
166452
166573
  const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
@@ -166553,8 +166674,8 @@ function formatAuditReport(report) {
166553
166674
  }
166554
166675
  function writeAuditReport(report, cwd) {
166555
166676
  const dir = getAuditDir(cwd);
166556
- mkdirSync29(dir, { recursive: true });
166557
- const path29 = join83(dir, `${report.week}.md`);
166677
+ mkdirSync30(dir, { recursive: true });
166678
+ const path29 = join84(dir, `${report.week}.md`);
166558
166679
  writeFileSync29(path29, formatAuditReport(report), "utf-8");
166559
166680
  return path29;
166560
166681
  }
@@ -167521,7 +167642,7 @@ async function processEvents(ctx, stream, state) {
167521
167642
  }
167522
167643
  // packages/omo-opencode/src/plugin-config/layered-config-loader.ts
167523
167644
  import * as fs7 from "fs";
167524
- import { homedir as homedir7 } from "os";
167645
+ import { homedir as homedir9 } from "os";
167525
167646
  import * as path7 from "path";
167526
167647
 
167527
167648
  // packages/omo-opencode/src/config/schema/agent-names.ts
@@ -168505,7 +168626,7 @@ function loadConfigFromPath(configPath, _ctx) {
168505
168626
 
168506
168627
  // packages/omo-opencode/src/plugin-config/layered-config-loader.ts
168507
168628
  function resolveHomeDirectory() {
168508
- return process.env.HOME ?? process.env.USERPROFILE ?? homedir7();
168629
+ return process.env.HOME ?? process.env.USERPROFILE ?? homedir9();
168509
168630
  }
168510
168631
  function resolveConfigPathAfterLegacyMigration(detectedPath) {
168511
168632
  if (!path7.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
@@ -169097,7 +169218,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
169097
169218
  var NOTEPAD_DIR = "notepads";
169098
169219
  var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
169099
169220
  // packages/boulder-state/src/top-level-task.ts
169100
- import { existsSync as existsSync31, readFileSync as readFileSync18 } from "fs";
169221
+ import { existsSync as existsSync32, readFileSync as readFileSync18 } from "fs";
169101
169222
  var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
169102
169223
  var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
169103
169224
  var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
@@ -169120,7 +169241,7 @@ function buildTaskRef(section, taskLabel) {
169120
169241
  };
169121
169242
  }
169122
169243
  function readCurrentTopLevelTask(planPath) {
169123
- if (!existsSync31(planPath)) {
169244
+ if (!existsSync32(planPath)) {
169124
169245
  return null;
169125
169246
  }
169126
169247
  try {
@@ -169149,10 +169270,10 @@ function readCurrentTopLevelTask(planPath) {
169149
169270
  }
169150
169271
  }
169151
169272
  // packages/boulder-state/src/storage/path.ts
169152
- import { existsSync as existsSync32 } from "fs";
169153
- import { isAbsolute as isAbsolute4, join as join29, relative as relative3, resolve as resolve8 } from "path";
169273
+ import { existsSync as existsSync33 } from "fs";
169274
+ import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve8 } from "path";
169154
169275
  function getBoulderFilePath(directory) {
169155
- return join29(directory, BOULDER_DIR, BOULDER_FILE);
169276
+ return join30(directory, BOULDER_DIR, BOULDER_FILE);
169156
169277
  }
169157
169278
  function resolveTrackedPath(baseDirectory, trackedPath) {
169158
169279
  return isAbsolute4(trackedPath) ? resolve8(trackedPath) : resolve8(baseDirectory, trackedPath);
@@ -169170,13 +169291,13 @@ function resolveBoulderPlanPath(directory, state) {
169170
169291
  }
169171
169292
  const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
169172
169293
  const worktreePlanPath = resolve8(absoluteWorktreePath, relativePlanPath);
169173
- return existsSync32(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
169294
+ return existsSync33(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
169174
169295
  }
169175
169296
  function resolveBoulderPlanPathForWork(directory, work) {
169176
169297
  return resolveBoulderPlanPath(directory, work);
169177
169298
  }
169178
169299
  // packages/boulder-state/src/storage/plan-progress.ts
169179
- import { existsSync as existsSync33, readFileSync as readFileSync19, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
169300
+ import { existsSync as existsSync34, readFileSync as readFileSync19, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
169180
169301
  var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
169181
169302
  var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
169182
169303
  var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
@@ -169185,7 +169306,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
169185
169306
  var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
169186
169307
  var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
169187
169308
  function getPlanProgress(planPath) {
169188
- if (!existsSync33(planPath)) {
169309
+ if (!existsSync34(planPath)) {
169189
169310
  return { total: 0, completed: 0, isComplete: false };
169190
169311
  }
169191
169312
  try {
@@ -169305,10 +169426,10 @@ function selectMirrorWork(state) {
169305
169426
  return sorted[0] ?? null;
169306
169427
  }
169307
169428
  // packages/boulder-state/src/storage/read-state.ts
169308
- import { existsSync as existsSync34, readFileSync as readFileSync20 } from "fs";
169429
+ import { existsSync as existsSync35, readFileSync as readFileSync20 } from "fs";
169309
169430
  function readBoulderState(directory) {
169310
169431
  const filePath = getBoulderFilePath(directory);
169311
- if (!existsSync34(filePath)) {
169432
+ if (!existsSync35(filePath)) {
169312
169433
  return null;
169313
169434
  }
169314
169435
  try {
@@ -169378,14 +169499,14 @@ init_state();
169378
169499
  // packages/omo-opencode/src/features/run-continuation-state/constants.ts
169379
169500
  var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
169380
169501
  // packages/omo-opencode/src/features/run-continuation-state/storage.ts
169381
- import { existsSync as existsSync35, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
169382
- import { join as join30 } from "path";
169502
+ import { existsSync as existsSync36, mkdirSync as mkdirSync12, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "fs";
169503
+ import { join as join31 } from "path";
169383
169504
  function getMarkerPath(directory, sessionID) {
169384
- return join30(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
169505
+ return join31(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
169385
169506
  }
169386
169507
  function readContinuationMarker(directory, sessionID) {
169387
169508
  const markerPath = getMarkerPath(directory, sessionID);
169388
- if (!existsSync35(markerPath))
169509
+ if (!existsSync36(markerPath))
169389
169510
  return null;
169390
169511
  try {
169391
169512
  const raw = readFileSync21(markerPath, "utf-8");
@@ -169454,7 +169575,7 @@ async function isSessionInBoulderLineage(input) {
169454
169575
  init_shared();
169455
169576
  init_compaction_marker();
169456
169577
  import { readFileSync as readFileSync22, readdirSync as readdirSync5 } from "fs";
169457
- import { join as join31 } from "path";
169578
+ import { join as join32 } from "path";
169458
169579
  var defaultSessionLastAgentDeps = {
169459
169580
  getMessageDir,
169460
169581
  isSqliteBackend,
@@ -169514,7 +169635,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
169514
169635
  try {
169515
169636
  const messages = readdirSync5(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
169516
169637
  try {
169517
- const content = readFileSync22(join31(messageDir, fileName), "utf-8");
169638
+ const content = readFileSync22(join32(messageDir, fileName), "utf-8");
169518
169639
  const parsed = JSON.parse(content);
169519
169640
  return {
169520
169641
  fileName,
@@ -169557,8 +169678,8 @@ init_agent_display_names();
169557
169678
 
169558
169679
  // packages/omo-opencode/src/hooks/ralph-loop/storage.ts
169559
169680
  init_frontmatter2();
169560
- import { existsSync as existsSync36, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
169561
- import { dirname as dirname12, join as join32 } from "path";
169681
+ import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync13 } from "fs";
169682
+ import { dirname as dirname12, join as join33 } from "path";
169562
169683
 
169563
169684
  // packages/omo-opencode/src/hooks/ralph-loop/constants.ts
169564
169685
  var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
@@ -169567,11 +169688,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
169567
169688
 
169568
169689
  // packages/omo-opencode/src/hooks/ralph-loop/storage.ts
169569
169690
  function getStateFilePath(directory, customPath) {
169570
- return customPath ? join32(directory, customPath) : join32(directory, DEFAULT_STATE_FILE);
169691
+ return customPath ? join33(directory, customPath) : join33(directory, DEFAULT_STATE_FILE);
169571
169692
  }
169572
169693
  function readState(directory, customPath) {
169573
169694
  const filePath = getStateFilePath(directory, customPath);
169574
- if (!existsSync36(filePath)) {
169695
+ if (!existsSync37(filePath)) {
169575
169696
  return null;
169576
169697
  }
169577
169698
  try {
@@ -170150,22 +170271,22 @@ function createTimestampedStdoutController(stdout2 = process.stdout) {
170150
170271
  // packages/telemetry-core/src/activity-state.ts
170151
170272
  init_atomic_write();
170152
170273
  init_xdg_data_dir();
170153
- import { existsSync as existsSync37, mkdirSync as mkdirSync13, readFileSync as readFileSync24 } from "fs";
170154
- import { basename as basename6, join as join33 } from "path";
170274
+ import { existsSync as existsSync38, mkdirSync as mkdirSync14, readFileSync as readFileSync24 } from "fs";
170275
+ import { basename as basename6, join as join34 } from "path";
170155
170276
  var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
170156
170277
  function resolveTelemetryStateDir(product, options = {}) {
170157
170278
  const dataDir = resolveXdgDataDir(product.cacheDirName, {
170158
170279
  env: options.env,
170159
170280
  osProvider: options.osProvider
170160
170281
  });
170161
- const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join33(options.env.XDG_DATA_HOME, product.cacheDirName);
170282
+ const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join34(options.env.XDG_DATA_HOME, product.cacheDirName);
170162
170283
  if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
170163
170284
  return dataDir;
170164
170285
  }
170165
- return join33(dataDir, product.cacheDirName);
170286
+ return join34(dataDir, product.cacheDirName);
170166
170287
  }
170167
170288
  function getTelemetryActivityStateFilePath(stateDir) {
170168
- return join33(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
170289
+ return join34(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
170169
170290
  }
170170
170291
  function getDailyActiveCaptureState(input) {
170171
170292
  const state2 = readPostHogActivityState(input.stateDir, input.diagnostics);
@@ -170190,7 +170311,7 @@ function isPostHogActivityState(value) {
170190
170311
  }
170191
170312
  function readPostHogActivityState(stateDir, diagnostics) {
170192
170313
  const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
170193
- if (!existsSync37(stateFilePath)) {
170314
+ if (!existsSync38(stateFilePath)) {
170194
170315
  return {};
170195
170316
  }
170196
170317
  try {
@@ -170213,7 +170334,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
170213
170334
  function writePostHogActivityState(stateDir, nextState, diagnostics) {
170214
170335
  const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
170215
170336
  try {
170216
- mkdirSync13(stateDir, { recursive: true });
170337
+ mkdirSync14(stateDir, { recursive: true });
170217
170338
  writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
170218
170339
  `);
170219
170340
  } catch (error51) {
@@ -177317,14 +177438,14 @@ init_constants5();
177317
177438
 
177318
177439
  // packages/omo-opencode/src/cli/doctor/checks/system.ts
177319
177440
  init_constants5();
177320
- import { existsSync as existsSync48, readFileSync as readFileSync34 } from "fs";
177441
+ import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
177321
177442
 
177322
177443
  // packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
177323
177444
  init_extract_semver();
177324
177445
  init_bun_which_shim();
177325
- import { existsSync as existsSync45, accessSync as accessSync4, constants as constants8 } from "fs";
177326
- import { homedir as homedir10 } from "os";
177327
- import { join as join40 } from "path";
177446
+ import { existsSync as existsSync46, accessSync as accessSync4, constants as constants8 } from "fs";
177447
+ import { homedir as homedir12 } from "os";
177448
+ import { join as join41 } from "path";
177328
177449
 
177329
177450
  // packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
177330
177451
  init_spawn_with_windows_hide();
@@ -177412,22 +177533,22 @@ function isExecutable2(path14) {
177412
177533
  }
177413
177534
  }
177414
177535
  function getDesktopAppPaths(platform) {
177415
- const home = homedir10();
177536
+ const home = homedir12();
177416
177537
  switch (platform) {
177417
177538
  case "darwin":
177418
177539
  return [
177419
177540
  "/Applications/OpenCode.app/Contents/MacOS/OpenCode",
177420
- join40(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
177541
+ join41(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
177421
177542
  ];
177422
177543
  case "win32": {
177423
177544
  const programFiles = process.env.ProgramFiles;
177424
177545
  const localAppData = process.env.LOCALAPPDATA;
177425
177546
  const paths2 = [];
177426
177547
  if (programFiles) {
177427
- paths2.push(join40(programFiles, "OpenCode", "OpenCode.exe"));
177548
+ paths2.push(join41(programFiles, "OpenCode", "OpenCode.exe"));
177428
177549
  }
177429
177550
  if (localAppData) {
177430
- paths2.push(join40(localAppData, "OpenCode", "OpenCode.exe"));
177551
+ paths2.push(join41(localAppData, "OpenCode", "OpenCode.exe"));
177431
177552
  }
177432
177553
  return paths2;
177433
177554
  }
@@ -177435,8 +177556,8 @@ function getDesktopAppPaths(platform) {
177435
177556
  return [
177436
177557
  "/usr/bin/opencode",
177437
177558
  "/usr/lib/opencode/opencode",
177438
- join40(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
177439
- join40(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
177559
+ join41(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
177560
+ join41(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
177440
177561
  ];
177441
177562
  default:
177442
177563
  return [];
@@ -177448,7 +177569,7 @@ function buildVersionCommand(binaryPath, platform) {
177448
177569
  }
177449
177570
  return [binaryPath, "--version"];
177450
177571
  }
177451
- function findDesktopBinary(platform = process.platform, checkExists = existsSync45) {
177572
+ function findDesktopBinary(platform = process.platform, checkExists = existsSync46) {
177452
177573
  for (const desktopPath of getDesktopAppPaths(platform)) {
177453
177574
  if (checkExists(desktopPath)) {
177454
177575
  return { binary: "opencode", path: desktopPath };
@@ -177456,7 +177577,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
177456
177577
  }
177457
177578
  return null;
177458
177579
  }
177459
- async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync45) {
177580
+ async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync46) {
177460
177581
  for (const binary2 of OPENCODE_BINARIES2) {
177461
177582
  const path14 = bunWhich(binary2);
177462
177583
  if (path14 && checkExists(path14)) {
@@ -177468,7 +177589,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
177468
177589
  const candidates = getCommandCandidates2(platform);
177469
177590
  for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
177470
177591
  for (const command of candidates) {
177471
- const fullPath = join40(entry, command);
177592
+ const fullPath = join41(entry, command);
177472
177593
  if (checkExists(fullPath) && isExecutable2(fullPath)) {
177473
177594
  return { binary: command, path: fullPath };
177474
177595
  }
@@ -177514,12 +177635,12 @@ function compareVersions3(current, minimum) {
177514
177635
 
177515
177636
  // packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
177516
177637
  init_shared();
177517
- import { existsSync as existsSync46, readFileSync as readFileSync32 } from "fs";
177638
+ import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
177518
177639
  function detectConfigPath() {
177519
177640
  const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
177520
- if (existsSync46(paths2.configJsonc))
177641
+ if (existsSync47(paths2.configJsonc))
177521
177642
  return paths2.configJsonc;
177522
- if (existsSync46(paths2.configJson))
177643
+ if (existsSync47(paths2.configJson))
177523
177644
  return paths2.configJson;
177524
177645
  return null;
177525
177646
  }
@@ -177609,35 +177730,35 @@ init_auto_update_checker();
177609
177730
  init_package_json_locator();
177610
177731
  init_constants5();
177611
177732
  init_shared();
177612
- import { existsSync as existsSync47, readFileSync as readFileSync33, readdirSync as readdirSync7 } from "fs";
177733
+ import { existsSync as existsSync48, readFileSync as readFileSync33, readdirSync as readdirSync7 } from "fs";
177613
177734
  import { createRequire as createRequire2 } from "module";
177614
- import { homedir as homedir11 } from "os";
177615
- import { join as join41 } from "path";
177735
+ import { homedir as homedir13 } from "os";
177736
+ import { join as join42 } from "path";
177616
177737
  import { fileURLToPath as fileURLToPath5 } from "url";
177617
177738
  function getPlatformDefaultCacheDir(platform = process.platform) {
177618
177739
  if (platform === "darwin")
177619
- return join41(homedir11(), "Library", "Caches");
177740
+ return join42(homedir13(), "Library", "Caches");
177620
177741
  if (platform === "win32")
177621
- return process.env.LOCALAPPDATA ?? join41(homedir11(), "AppData", "Local");
177622
- return join41(homedir11(), ".cache");
177742
+ return process.env.LOCALAPPDATA ?? join42(homedir13(), "AppData", "Local");
177743
+ return join42(homedir13(), ".cache");
177623
177744
  }
177624
177745
  function resolveOpenCodeCacheDir() {
177625
177746
  const xdgCacheHome = process.env.XDG_CACHE_HOME;
177626
177747
  if (xdgCacheHome)
177627
- return join41(xdgCacheHome, "opencode");
177748
+ return join42(xdgCacheHome, "opencode");
177628
177749
  const fromShared = getOpenCodeCacheDir();
177629
- const platformDefault = join41(getPlatformDefaultCacheDir(), "opencode");
177630
- if (existsSync47(fromShared) || !existsSync47(platformDefault))
177750
+ const platformDefault = join42(getPlatformDefaultCacheDir(), "opencode");
177751
+ if (existsSync48(fromShared) || !existsSync48(platformDefault))
177631
177752
  return fromShared;
177632
177753
  return platformDefault;
177633
177754
  }
177634
177755
  function resolveExistingDir(dirPath) {
177635
- if (!existsSync47(dirPath))
177756
+ if (!existsSync48(dirPath))
177636
177757
  return dirPath;
177637
177758
  return resolveSymlink(dirPath);
177638
177759
  }
177639
177760
  function readPackageJson(filePath) {
177640
- if (!existsSync47(filePath))
177761
+ if (!existsSync48(filePath))
177641
177762
  return null;
177642
177763
  try {
177643
177764
  const content = readFileSync33(filePath, "utf-8");
@@ -177658,26 +177779,26 @@ function normalizeVersion(value) {
177658
177779
  function createPackageCandidates(rootDir) {
177659
177780
  return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
177660
177781
  packageName,
177661
- installedPackagePath: join41(rootDir, "node_modules", packageName, "package.json")
177782
+ installedPackagePath: join42(rootDir, "node_modules", packageName, "package.json")
177662
177783
  }));
177663
177784
  }
177664
177785
  function createTaggedInstallCandidates(rootDir) {
177665
- const packagesDir = join41(rootDir, "packages");
177666
- if (!existsSync47(packagesDir))
177786
+ const packagesDir = join42(rootDir, "packages");
177787
+ if (!existsSync48(packagesDir))
177667
177788
  return [];
177668
177789
  const candidates = [];
177669
177790
  for (const entryName of readdirSync7(packagesDir).sort()) {
177670
177791
  const packageName = ACCEPTED_PACKAGE_NAMES.find((name2) => entryName.startsWith(`${name2}@`));
177671
177792
  if (packageName === undefined)
177672
177793
  continue;
177673
- const installDir = join41(packagesDir, entryName);
177794
+ const installDir = join42(packagesDir, entryName);
177674
177795
  candidates.push({
177675
177796
  cacheDir: installDir,
177676
- cachePackagePath: join41(installDir, "package.json"),
177797
+ cachePackagePath: join42(installDir, "package.json"),
177677
177798
  packageCandidates: [
177678
177799
  {
177679
177800
  packageName,
177680
- installedPackagePath: join41(installDir, "node_modules", packageName, "package.json")
177801
+ installedPackagePath: join42(installDir, "node_modules", packageName, "package.json")
177681
177802
  }
177682
177803
  ]
177683
177804
  });
@@ -177685,7 +177806,7 @@ function createTaggedInstallCandidates(rootDir) {
177685
177806
  return candidates;
177686
177807
  }
177687
177808
  function selectInstalledPackage(candidate) {
177688
- return candidate.packageCandidates.find((packageCandidate) => existsSync47(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
177809
+ return candidate.packageCandidates.find((packageCandidate) => existsSync48(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
177689
177810
  }
177690
177811
  function getExpectedVersion(cachePackage, packageName) {
177691
177812
  return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
@@ -177696,7 +177817,7 @@ function resolveInstalledPackageJsonPath() {
177696
177817
  for (const packageName of ACCEPTED_PACKAGE_NAMES) {
177697
177818
  try {
177698
177819
  const packageJsonPath = require2.resolve(`${packageName}/package.json`);
177699
- if (existsSync47(packageJsonPath)) {
177820
+ if (existsSync48(packageJsonPath)) {
177700
177821
  return { packageName, packageJsonPath };
177701
177822
  }
177702
177823
  } catch {
@@ -177722,22 +177843,22 @@ function getLoadedPluginVersion() {
177722
177843
  const candidates = [
177723
177844
  {
177724
177845
  cacheDir: configDir,
177725
- cachePackagePath: join41(configDir, "package.json"),
177846
+ cachePackagePath: join42(configDir, "package.json"),
177726
177847
  packageCandidates: createPackageCandidates(configDir)
177727
177848
  },
177728
177849
  ...createTaggedInstallCandidates(configDir),
177729
177850
  {
177730
177851
  cacheDir,
177731
- cachePackagePath: join41(cacheDir, "package.json"),
177852
+ cachePackagePath: join42(cacheDir, "package.json"),
177732
177853
  packageCandidates: createPackageCandidates(cacheDir)
177733
177854
  },
177734
177855
  ...createTaggedInstallCandidates(cacheDir)
177735
177856
  ];
177736
- const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync47(packageCandidate.installedPackagePath))) ?? candidates[0];
177857
+ const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync48(packageCandidate.installedPackagePath))) ?? candidates[0];
177737
177858
  const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
177738
177859
  const selectedPackage = selectInstalledPackage(selectedCandidate);
177739
177860
  const candidateInstalledPath = selectedPackage.installedPackagePath;
177740
- const candidateExists = existsSync47(candidateInstalledPath);
177861
+ const candidateExists = existsSync48(candidateInstalledPath);
177741
177862
  const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
177742
177863
  const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
177743
177864
  const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
@@ -177773,7 +177894,7 @@ var defaultDeps6 = {
177773
177894
  getLoadedPluginVersion,
177774
177895
  getLatestPluginVersion,
177775
177896
  getSuggestedInstallTag,
177776
- configExists: existsSync48,
177897
+ configExists: existsSync49,
177777
177898
  readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
177778
177899
  parseConfigContent: (content) => parseJsonc(content)
177779
177900
  };
@@ -177920,12 +178041,12 @@ async function checkSystem(deps = defaultDeps6) {
177920
178041
  // packages/omo-opencode/src/config/validate.ts
177921
178042
  init_src();
177922
178043
  import { readFileSync as readFileSync35 } from "fs";
177923
- import { homedir as homedir12 } from "os";
178044
+ import { homedir as homedir14 } from "os";
177924
178045
  import { dirname as dirname18, relative as relative5 } from "path";
177925
178046
  init_shared();
177926
178047
  init_plugin_identity();
177927
178048
  function resolveHomeDirectory2() {
177928
- return process.env.HOME ?? process.env.USERPROFILE ?? homedir12();
178049
+ return process.env.HOME ?? process.env.USERPROFILE ?? homedir14();
177929
178050
  }
177930
178051
  function discoverConfigInDirectory(configDir) {
177931
178052
  const detected = detectPluginConfigFile(configDir, {
@@ -178036,23 +178157,23 @@ init_constants5();
178036
178157
 
178037
178158
  // packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
178038
178159
  init_shared();
178039
- import { existsSync as existsSync49, readFileSync as readFileSync36 } from "fs";
178040
- import { homedir as homedir13 } from "os";
178041
- import { join as join42 } from "path";
178160
+ import { existsSync as existsSync50, readFileSync as readFileSync36 } from "fs";
178161
+ import { homedir as homedir15 } from "os";
178162
+ import { join as join43 } from "path";
178042
178163
  function getUserConfigDir2() {
178043
178164
  const xdgConfig = process.env.XDG_CONFIG_HOME;
178044
178165
  if (xdgConfig)
178045
- return join42(xdgConfig, "opencode");
178046
- return join42(homedir13(), ".config", "opencode");
178166
+ return join43(xdgConfig, "opencode");
178167
+ return join43(homedir15(), ".config", "opencode");
178047
178168
  }
178048
178169
  function loadCustomProviderNames() {
178049
178170
  const configDir = getUserConfigDir2();
178050
178171
  const candidatePaths = [
178051
- join42(configDir, "opencode.json"),
178052
- join42(configDir, "opencode.jsonc")
178172
+ join43(configDir, "opencode.json"),
178173
+ join43(configDir, "opencode.jsonc")
178053
178174
  ];
178054
178175
  for (const configPath of candidatePaths) {
178055
- if (!existsSync49(configPath))
178176
+ if (!existsSync50(configPath))
178056
178177
  continue;
178057
178178
  try {
178058
178179
  const content = readFileSync36(configPath, "utf-8");
@@ -178070,9 +178191,9 @@ function loadCustomProviderNames() {
178070
178191
  return [];
178071
178192
  }
178072
178193
  function loadAvailableModelsFromCache() {
178073
- const cacheFile = join42(getOpenCodeCacheDir(), "models.json");
178194
+ const cacheFile = join43(getOpenCodeCacheDir(), "models.json");
178074
178195
  const customProviders = loadCustomProviderNames();
178075
- if (!existsSync49(cacheFile)) {
178196
+ if (!existsSync50(cacheFile)) {
178076
178197
  if (customProviders.length > 0) {
178077
178198
  return { providers: customProviders, modelCount: 0, cacheExists: true };
178078
178199
  }
@@ -178108,8 +178229,8 @@ init_constants5();
178108
178229
  init_shared();
178109
178230
  init_plugin_identity();
178110
178231
  import { readFileSync as readFileSync37 } from "fs";
178111
- import { join as join43 } from "path";
178112
- var PROJECT_CONFIG_DIR = join43(process.cwd(), ".opencode");
178232
+ import { join as join44 } from "path";
178233
+ var PROJECT_CONFIG_DIR = join44(process.cwd(), ".opencode");
178113
178234
  function loadOmoConfig() {
178114
178235
  const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
178115
178236
  basenames: [CONFIG_BASENAME],
@@ -178147,7 +178268,7 @@ function loadOmoConfig() {
178147
178268
 
178148
178269
  // packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
178149
178270
  init_shared();
178150
- import { join as join44 } from "path";
178271
+ import { join as join45 } from "path";
178151
178272
 
178152
178273
  // packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
178153
178274
  function formatModelWithVariant(model, variant) {
@@ -178189,7 +178310,7 @@ function formatCapabilityResolutionLabel(mode) {
178189
178310
  }
178190
178311
  function buildModelResolutionDetails(options) {
178191
178312
  const details = [];
178192
- const cacheFile = join44(getOpenCodeCacheDir(), "models.json");
178313
+ const cacheFile = join45(getOpenCodeCacheDir(), "models.json");
178193
178314
  details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
178194
178315
  details.push("");
178195
178316
  if (options.available.cacheExists) {
@@ -178465,28 +178586,28 @@ async function checkConfig() {
178465
178586
 
178466
178587
  // packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
178467
178588
  init_src();
178468
- import { existsSync as existsSync50 } from "fs";
178589
+ import { existsSync as existsSync51 } from "fs";
178469
178590
  import { createRequire as createRequire3 } from "module";
178470
- import { homedir as homedir15 } from "os";
178471
- import { dirname as dirname19, join as join46 } from "path";
178591
+ import { homedir as homedir17 } from "os";
178592
+ import { dirname as dirname19, join as join47 } from "path";
178472
178593
 
178473
178594
  // packages/omo-opencode/src/hooks/comment-checker/downloader.ts
178474
- import { join as join45 } from "path";
178475
- import { homedir as homedir14, tmpdir as tmpdir3 } from "os";
178595
+ import { join as join46 } from "path";
178596
+ import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
178476
178597
  init_binary_downloader();
178477
178598
  init_logger2();
178478
178599
  init_plugin_identity();
178479
178600
  var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
178480
- var DEBUG_FILE = join45(tmpdir3(), "comment-checker-debug.log");
178601
+ var DEBUG_FILE = join46(tmpdir3(), "comment-checker-debug.log");
178481
178602
  function getCacheDir2() {
178482
178603
  if (process.platform === "win32") {
178483
178604
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
178484
- const base2 = localAppData || join45(homedir14(), "AppData", "Local");
178485
- return join45(base2, CACHE_DIR_NAME, "bin");
178605
+ const base2 = localAppData || join46(homedir16(), "AppData", "Local");
178606
+ return join46(base2, CACHE_DIR_NAME, "bin");
178486
178607
  }
178487
178608
  const xdgCache = process.env.XDG_CACHE_HOME;
178488
- const base = xdgCache || join45(homedir14(), ".cache");
178489
- return join45(base, CACHE_DIR_NAME, "bin");
178609
+ const base = xdgCache || join46(homedir16(), ".cache");
178610
+ return join46(base, CACHE_DIR_NAME, "bin");
178490
178611
  }
178491
178612
  function getBinaryName() {
178492
178613
  return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
@@ -178536,7 +178657,7 @@ async function getBinaryVersion(binary2) {
178536
178657
  }
178537
178658
  }
178538
178659
  async function checkAstGrepCli() {
178539
- const runtimeDir = astGrepRuntimeDir(join46(homedir15(), ".omo"));
178660
+ const runtimeDir = astGrepRuntimeDir(join47(homedir17(), ".omo"));
178540
178661
  const sgPath = findSgBinarySync({ runtimeDir });
178541
178662
  if (sgPath === null) {
178542
178663
  return {
@@ -178566,11 +178687,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
178566
178687
  const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
178567
178688
  try {
178568
178689
  const packageDir = baseDirOverride ?? dirname19(resolvePackageJsonPath());
178569
- const vendorPath = join46(packageDir, "vendor", platformKey, binaryName);
178570
- if (existsSync50(vendorPath))
178690
+ const vendorPath = join47(packageDir, "vendor", platformKey, binaryName);
178691
+ if (existsSync51(vendorPath))
178571
178692
  return vendorPath;
178572
- const binPath = join46(packageDir, "bin", binaryName);
178573
- if (existsSync50(binPath))
178693
+ const binPath = join47(packageDir, "bin", binaryName);
178694
+ if (existsSync51(binPath))
178574
178695
  return binPath;
178575
178696
  } catch (error51) {
178576
178697
  if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
@@ -178715,12 +178836,12 @@ async function getGhCliInfo(dependencies = {}) {
178715
178836
 
178716
178837
  // packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
178717
178838
  import { readFileSync as readFileSync39 } from "fs";
178718
- import { join as join47 } from "path";
178839
+ import { join as join48 } from "path";
178719
178840
 
178720
178841
  // packages/omo-opencode/src/mcp/lsp.ts
178721
178842
  init_zod();
178722
178843
  init_opencode_config_dir();
178723
- import { existsSync as existsSync51, readFileSync as readFileSync38 } from "fs";
178844
+ import { existsSync as existsSync52, readFileSync as readFileSync38 } from "fs";
178724
178845
  import { delimiter as delimiter3, dirname as dirname20, resolve as resolve10 } from "path";
178725
178846
  import { fileURLToPath as fileURLToPath6 } from "url";
178726
178847
 
@@ -178886,7 +179007,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
178886
179007
  };
178887
179008
  }
178888
179009
  function resolveLspCommand(options = {}) {
178889
- const pathExists = options.exists ?? existsSync51;
179010
+ const pathExists = options.exists ?? existsSync52;
178890
179011
  const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
178891
179012
  const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
178892
179013
  const candidates = moduleDirectory ? createAncestorCliCandidates({
@@ -178952,7 +179073,7 @@ function readOmoConfig(configDirectory) {
178952
179073
  }
178953
179074
  function isLspMcpDisabled(options) {
178954
179075
  const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
178955
- const projectConfigDirectory = join47(options.cwd ?? process.cwd(), ".opencode");
179076
+ const projectConfigDirectory = join48(options.cwd ?? process.cwd(), ".opencode");
178956
179077
  const userConfig = readOmoConfig(userConfigDirectory);
178957
179078
  const projectConfig = readOmoConfig(projectConfigDirectory);
178958
179079
  const disabledMcps = new Set([
@@ -178971,21 +179092,21 @@ function getInstalledLspServers(options = {}) {
178971
179092
 
178972
179093
  // packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
178973
179094
  init_shared();
178974
- import { existsSync as existsSync52, readFileSync as readFileSync40 } from "fs";
178975
- import { homedir as homedir16 } from "os";
178976
- import { join as join48 } from "path";
179095
+ import { existsSync as existsSync53, readFileSync as readFileSync40 } from "fs";
179096
+ import { homedir as homedir18 } from "os";
179097
+ import { join as join49 } from "path";
178977
179098
  var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
178978
179099
  function getMcpConfigPaths() {
178979
179100
  return [
178980
- join48(homedir16(), ".claude", ".mcp.json"),
178981
- join48(process.cwd(), ".mcp.json"),
178982
- join48(process.cwd(), ".claude", ".mcp.json")
179101
+ join49(homedir18(), ".claude", ".mcp.json"),
179102
+ join49(process.cwd(), ".mcp.json"),
179103
+ join49(process.cwd(), ".claude", ".mcp.json")
178983
179104
  ];
178984
179105
  }
178985
179106
  function loadUserMcpConfig() {
178986
179107
  const servers = {};
178987
179108
  for (const configPath of getMcpConfigPaths()) {
178988
- if (!existsSync52(configPath))
179109
+ if (!existsSync53(configPath))
178989
179110
  continue;
178990
179111
  try {
178991
179112
  const content = readFileSync40(configPath, "utf-8");
@@ -179123,13 +179244,13 @@ async function checkTools() {
179123
179244
  }
179124
179245
 
179125
179246
  // packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
179126
- import { existsSync as existsSync53, readFileSync as readFileSync41 } from "fs";
179247
+ import { existsSync as existsSync54, readFileSync as readFileSync41 } from "fs";
179127
179248
  init_constants5();
179128
179249
  function isTelemetryState(value) {
179129
179250
  return value !== null && typeof value === "object" && !Array.isArray(value);
179130
179251
  }
179131
179252
  function readLastActiveDay(stateFilePath) {
179132
- if (!existsSync53(stateFilePath)) {
179253
+ if (!existsSync54(stateFilePath)) {
179133
179254
  return "never";
179134
179255
  }
179135
179256
  let parsed;
@@ -179192,17 +179313,17 @@ async function probeBinary(cmd, args, spawnImpl) {
179192
179313
  }
179193
179314
 
179194
179315
  // packages/team-core/src/team-registry/paths.ts
179195
- import { homedir as homedir17 } from "os";
179316
+ import { homedir as homedir19 } from "os";
179196
179317
  import path14 from "path";
179197
179318
  function resolveBaseDir(config5) {
179198
- return expandHomeDirectory(config5.base_dir ?? path14.join(homedir17(), ".omo"));
179319
+ return expandHomeDirectory(config5.base_dir ?? path14.join(homedir19(), ".omo"));
179199
179320
  }
179200
179321
  function expandHomeDirectory(directoryPath) {
179201
179322
  if (directoryPath === "~") {
179202
- return homedir17();
179323
+ return homedir19();
179203
179324
  }
179204
179325
  if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
179205
- return path14.join(homedir17(), directoryPath.slice(2));
179326
+ return path14.join(homedir19(), directoryPath.slice(2));
179206
179327
  }
179207
179328
  return directoryPath;
179208
179329
  }
@@ -179685,23 +179806,23 @@ Doctor failed unexpectedly: ${message}`];
179685
179806
  import { createHash as createHash3 } from "crypto";
179686
179807
  import {
179687
179808
  chmodSync as chmodSync6,
179688
- existsSync as existsSync56,
179689
- mkdirSync as mkdirSync15,
179809
+ existsSync as existsSync57,
179810
+ mkdirSync as mkdirSync16,
179690
179811
  readdirSync as readdirSync8,
179691
179812
  readFileSync as readFileSync44,
179692
179813
  renameSync as renameSync7,
179693
179814
  unlinkSync as unlinkSync8,
179694
179815
  writeFileSync as writeFileSync14
179695
179816
  } from "fs";
179696
- import { basename as basename8, dirname as dirname21, join as join51 } from "path";
179817
+ import { basename as basename8, dirname as dirname21, join as join52 } from "path";
179697
179818
 
179698
179819
  // packages/mcp-client-core/src/config-dir.ts
179699
- import { existsSync as existsSync54, realpathSync as realpathSync7 } from "fs";
179700
- import { homedir as homedir18 } from "os";
179701
- import { join as join49, resolve as resolve11 } from "path";
179820
+ import { existsSync as existsSync55, realpathSync as realpathSync7 } from "fs";
179821
+ import { homedir as homedir20 } from "os";
179822
+ import { join as join50, resolve as resolve11 } from "path";
179702
179823
  function resolveConfigPath2(pathValue) {
179703
179824
  const resolvedPath = resolve11(pathValue);
179704
- if (!existsSync54(resolvedPath))
179825
+ if (!existsSync55(resolvedPath))
179705
179826
  return resolvedPath;
179706
179827
  try {
179707
179828
  return realpathSync7(resolvedPath);
@@ -179716,13 +179837,13 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
179716
179837
  if (customConfigDir) {
179717
179838
  return resolveConfigPath2(customConfigDir);
179718
179839
  }
179719
- const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join49(homedir18(), ".config");
179720
- return resolveConfigPath2(join49(xdgConfigDir, "opencode"));
179840
+ const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join50(homedir20(), ".config");
179841
+ return resolveConfigPath2(join50(xdgConfigDir, "opencode"));
179721
179842
  }
179722
179843
 
179723
179844
  // packages/mcp-client-core/src/mcp-oauth/storage-index.ts
179724
- import { chmodSync as chmodSync5, existsSync as existsSync55, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
179725
- import { join as join50 } from "path";
179845
+ import { chmodSync as chmodSync5, existsSync as existsSync56, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync13 } from "fs";
179846
+ import { join as join51 } from "path";
179726
179847
  var INDEX_FILE_NAME = "index.json";
179727
179848
  function isTokenIndex(value) {
179728
179849
  if (typeof value !== "object" || value === null || Array.isArray(value))
@@ -179730,11 +179851,11 @@ function isTokenIndex(value) {
179730
179851
  return Object.values(value).every((entry) => typeof entry === "string");
179731
179852
  }
179732
179853
  function getIndexPath(storageDir) {
179733
- return join50(storageDir, INDEX_FILE_NAME);
179854
+ return join51(storageDir, INDEX_FILE_NAME);
179734
179855
  }
179735
179856
  function readTokenIndex(storageDir) {
179736
179857
  const indexPath = getIndexPath(storageDir);
179737
- if (!existsSync55(indexPath))
179858
+ if (!existsSync56(indexPath))
179738
179859
  return {};
179739
179860
  try {
179740
179861
  const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
@@ -179774,16 +179895,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
179774
179895
  var STORAGE_DIR_NAME = "mcp-oauth";
179775
179896
  var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
179776
179897
  function getMcpOauthStorageDir() {
179777
- return join51(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
179898
+ return join52(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
179778
179899
  }
179779
179900
  function getMcpOauthServerHash(serverHost, resource) {
179780
179901
  return createHash3("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
179781
179902
  }
179782
179903
  function getMcpOauthStoragePath(serverHost, resource) {
179783
- return join51(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
179904
+ return join52(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
179784
179905
  }
179785
179906
  function getLegacyStoragePath() {
179786
- return join51(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
179907
+ return join52(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
179787
179908
  }
179788
179909
  function normalizeHost2(serverHost) {
179789
179910
  let host = serverHost.trim();
@@ -179844,7 +179965,7 @@ function isOAuthTokenData(value) {
179844
179965
  return clientSecret === undefined || typeof clientSecret === "string";
179845
179966
  }
179846
179967
  function readTokenFile(filePath) {
179847
- if (!existsSync56(filePath))
179968
+ if (!existsSync57(filePath))
179848
179969
  return null;
179849
179970
  try {
179850
179971
  const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
@@ -179857,7 +179978,7 @@ function readTokenFile(filePath) {
179857
179978
  }
179858
179979
  function readLegacyStore() {
179859
179980
  const filePath = getLegacyStoragePath();
179860
- if (!existsSync56(filePath))
179981
+ if (!existsSync57(filePath))
179861
179982
  return null;
179862
179983
  try {
179863
179984
  const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
@@ -179878,8 +179999,8 @@ function readLegacyStore() {
179878
179999
  function writeTokenFile(filePath, token) {
179879
180000
  try {
179880
180001
  const dir = dirname21(filePath);
179881
- if (!existsSync56(dir)) {
179882
- mkdirSync15(dir, { recursive: true });
180002
+ if (!existsSync57(dir)) {
180003
+ mkdirSync16(dir, { recursive: true });
179883
180004
  }
179884
180005
  const tempPath = `${filePath}.tmp.${Date.now()}`;
179885
180006
  writeFileSync14(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
@@ -179902,7 +180023,7 @@ function saveToken(serverHost, resource, token) {
179902
180023
  }
179903
180024
  function deleteToken(serverHost, resource) {
179904
180025
  const filePath = getMcpOauthStoragePath(serverHost, resource);
179905
- if (!existsSync56(filePath))
180026
+ if (!existsSync57(filePath))
179906
180027
  return deleteLegacyToken(serverHost, resource);
179907
180028
  try {
179908
180029
  unlinkSync8(filePath);
@@ -179924,7 +180045,7 @@ function deleteLegacyToken(serverHost, resource) {
179924
180045
  if (Object.keys(store2).length === 0) {
179925
180046
  try {
179926
180047
  const filePath = getLegacyStoragePath();
179927
- if (existsSync56(filePath))
180048
+ if (existsSync57(filePath))
179928
180049
  unlinkSync8(filePath);
179929
180050
  return true;
179930
180051
  } catch (deleteError) {
@@ -179962,7 +180083,7 @@ function listTokensByHost(serverHost) {
179962
180083
  for (const [hash2, indexedKey] of Object.entries(index)) {
179963
180084
  if (!indexedKey.startsWith(prefix))
179964
180085
  continue;
179965
- const indexedToken = readTokenFile(join51(getMcpOauthStorageDir(), `${hash2}.json`));
180086
+ const indexedToken = readTokenFile(join52(getMcpOauthStorageDir(), `${hash2}.json`));
179966
180087
  if (indexedToken)
179967
180088
  result[indexedKey] = indexedToken;
179968
180089
  }
@@ -179971,13 +180092,13 @@ function listTokensByHost(serverHost) {
179971
180092
  function listAllTokens() {
179972
180093
  const result = { ...readLegacyStore() ?? {} };
179973
180094
  const dir = getMcpOauthStorageDir();
179974
- if (!existsSync56(dir))
180095
+ if (!existsSync57(dir))
179975
180096
  return result;
179976
180097
  const index = readTokenIndex(dir);
179977
180098
  for (const entry of readdirSync8(dir, { withFileTypes: true })) {
179978
180099
  if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
179979
180100
  continue;
179980
- const token = readTokenFile(join51(dir, entry.name));
180101
+ const token = readTokenFile(join52(dir, entry.name));
179981
180102
  const hash2 = basename8(entry.name, ".json");
179982
180103
  if (token)
179983
180104
  result[index[hash2] ?? hash2] = token;
@@ -180673,8 +180794,8 @@ function createEmbeddingPort() {
180673
180794
  // packages/learning-loop/src/codebase-scanner.ts
180674
180795
  var import_picomatch = __toESM(require_picomatch2(), 1);
180675
180796
  import { createHash as createHash5 } from "crypto";
180676
- import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync58 } from "fs";
180677
- import { join as join52, relative as relative6, extname as extname3 } from "path";
180797
+ import { readdirSync as readdirSync9, readFileSync as readFileSync46, statSync as statSync7, existsSync as existsSync59 } from "fs";
180798
+ import { join as join53, relative as relative6, extname as extname3 } from "path";
180678
180799
  var EXT_TO_LANG = {
180679
180800
  ts: "typescript",
180680
180801
  tsx: "typescript",
@@ -180728,7 +180849,7 @@ function detectLanguage(filePath) {
180728
180849
  return EXT_TO_LANG[ext] ?? "text";
180729
180850
  }
180730
180851
  function loadGitignore(rootDir, fs18) {
180731
- const gitignorePath = join52(rootDir, ".gitignore");
180852
+ const gitignorePath = join53(rootDir, ".gitignore");
180732
180853
  if (!fs18.exists(gitignorePath))
180733
180854
  return [];
180734
180855
  const content = fs18.readFile(gitignorePath);
@@ -180748,7 +180869,7 @@ function defaultFs() {
180748
180869
  return { size: s.size, mtimeMs: s.mtimeMs, isDirectory: () => s.isDirectory(), isFile: () => s.isFile() };
180749
180870
  },
180750
180871
  exists(path18) {
180751
- return existsSync58(path18);
180872
+ return existsSync59(path18);
180752
180873
  }
180753
180874
  };
180754
180875
  }
@@ -180819,7 +180940,7 @@ function createCodebaseScanner(options = {}) {
180819
180940
  return;
180820
180941
  }
180821
180942
  for (const entry of entries) {
180822
- const fullPath = join52(dir, entry);
180943
+ const fullPath = join53(dir, entry);
180823
180944
  let stat;
180824
180945
  try {
180825
180946
  stat = fs18.stat(fullPath);
@@ -181094,14 +181215,14 @@ function formatSearchResults(result) {
181094
181215
  }
181095
181216
 
181096
181217
  // packages/learning-loop/src/improvement.ts
181097
- import { existsSync as existsSync59, mkdirSync as mkdirSync17, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
181098
- import { join as join53, basename as basename10 } from "path";
181218
+ import { existsSync as existsSync60, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16 } from "fs";
181219
+ import { join as join54, basename as basename10 } from "path";
181099
181220
  function createImprovementStore(improvementsDir) {
181100
- if (!existsSync59(improvementsDir)) {
181101
- mkdirSync17(improvementsDir, { recursive: true });
181221
+ if (!existsSync60(improvementsDir)) {
181222
+ mkdirSync18(improvementsDir, { recursive: true });
181102
181223
  }
181103
181224
  function save(improvement) {
181104
- const filePath = join53(improvementsDir, `${improvement.id}.json`);
181225
+ const filePath = join54(improvementsDir, `${improvement.id}.json`);
181105
181226
  writeFileSync16(filePath, JSON.stringify(improvement, null, 2), "utf-8");
181106
181227
  }
181107
181228
  function list() {
@@ -181119,7 +181240,7 @@ function createImprovementStore(improvementsDir) {
181119
181240
  return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
181120
181241
  }
181121
181242
  function get(id) {
181122
- const filePath = join53(improvementsDir, `${id}.json`);
181243
+ const filePath = join54(improvementsDir, `${id}.json`);
181123
181244
  try {
181124
181245
  const raw = readFileSync47(filePath, "utf-8");
181125
181246
  return JSON.parse(raw);
@@ -181192,7 +181313,7 @@ async function applyLearningsCli(options = {}) {
181192
181313
  }
181193
181314
 
181194
181315
  // packages/omo-opencode/src/cli/boulder/boulder.ts
181195
- import { existsSync as existsSync61 } from "fs";
181316
+ import { existsSync as existsSync62 } from "fs";
181196
181317
 
181197
181318
  // packages/omo-opencode/src/cli/boulder/formatter.ts
181198
181319
  var import_picocolors22 = __toESM(require_picocolors(), 1);
@@ -181329,10 +181450,10 @@ async function boulder(options) {
181329
181450
  const boulderFilePath = getBoulderFilePath(directory);
181330
181451
  const state2 = readBoulderState(directory);
181331
181452
  if (!state2) {
181332
- const message = existsSync61(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
181453
+ const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
181333
181454
  process.stderr.write(`${message}
181334
181455
  `);
181335
- return existsSync61(boulderFilePath) ? 2 : 1;
181456
+ return existsSync62(boulderFilePath) ? 2 : 1;
181336
181457
  }
181337
181458
  const works = getBoulderWorks(state2);
181338
181459
  const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
@@ -181927,25 +182048,25 @@ async function refreshModelCapabilities(options, deps = {}) {
181927
182048
  // packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
181928
182049
  init_src();
181929
182050
  init_shared_skills();
181930
- import { join as join62 } from "path";
182051
+ import { join as join63 } from "path";
181931
182052
 
181932
182053
  // packages/skills-loader-core/src/shared/claude-config-dir.ts
181933
182054
  init_src();
181934
- import { join as join56 } from "path";
182055
+ import { join as join57 } from "path";
181935
182056
  function getClaudeConfigDir() {
181936
182057
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
181937
182058
  if (envConfigDir) {
181938
182059
  return envConfigDir;
181939
182060
  }
181940
- return join56(getHomeDirectory(), ".claude");
182061
+ return join57(getHomeDirectory(), ".claude");
181941
182062
  }
181942
182063
  // packages/skills-loader-core/src/shared/opencode-command-dirs.ts
181943
- import { basename as basename11, dirname as dirname22, join as join58 } from "path";
182064
+ import { basename as basename11, dirname as dirname22, join as join59 } from "path";
181944
182065
 
181945
182066
  // packages/skills-loader-core/src/shared/opencode-config-dir.ts
181946
- import { existsSync as existsSync63, realpathSync as realpathSync8 } from "fs";
181947
- import { homedir as homedir20 } from "os";
181948
- import { join as join57, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
182067
+ import { existsSync as existsSync64, realpathSync as realpathSync8 } from "fs";
182068
+ import { homedir as homedir22 } from "os";
182069
+ import { join as join58, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
181949
182070
 
181950
182071
  // packages/skills-loader-core/src/shared/plugin-identity.ts
181951
182072
  init_src();
@@ -181978,15 +182099,15 @@ function getTauriConfigDir2(identifier) {
181978
182099
  const platform2 = process.platform;
181979
182100
  switch (platform2) {
181980
182101
  case "darwin":
181981
- return join57(homedir20(), "Library", "Application Support", identifier);
182102
+ return join58(homedir22(), "Library", "Application Support", identifier);
181982
182103
  case "win32": {
181983
- const appData = process.env.APPDATA || join57(homedir20(), "AppData", "Roaming");
182104
+ const appData = process.env.APPDATA || join58(homedir22(), "AppData", "Roaming");
181984
182105
  return win325.join(appData, identifier);
181985
182106
  }
181986
182107
  case "linux":
181987
182108
  default: {
181988
- const xdgConfig = process.env.XDG_CONFIG_HOME || join57(homedir20(), ".config");
181989
- return join57(xdgConfig, identifier);
182109
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join58(homedir22(), ".config");
182110
+ return join58(xdgConfig, identifier);
181990
182111
  }
181991
182112
  }
181992
182113
  }
@@ -181995,7 +182116,7 @@ function resolveConfigPath3(pathValue) {
181995
182116
  return posix5.normalize(pathValue);
181996
182117
  }
181997
182118
  const resolvedPath = resolve12(pathValue);
181998
- if (!existsSync63(resolvedPath))
182119
+ if (!existsSync64(resolvedPath))
181999
182120
  return resolvedPath;
182000
182121
  try {
182001
182122
  return realpathSync8(resolvedPath);
@@ -182029,8 +182150,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
182029
182150
  function getCliDefaultConfigDir2() {
182030
182151
  const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
182031
182152
  const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
182032
- const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join57(homedir20(), ".config");
182033
- const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join57(xdgConfig, "opencode");
182153
+ const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join58(homedir22(), ".config");
182154
+ const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join58(xdgConfig, "opencode");
182034
182155
  return resolveConfigPath3(configDir);
182035
182156
  }
182036
182157
  function getCliCustomConfigDir2() {
@@ -182063,9 +182184,9 @@ function getOpenCodeConfigDir2(options) {
182063
182184
  const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
182064
182185
  if (checkExisting) {
182065
182186
  const legacyDir = getCliConfigDir2();
182066
- const legacyConfig = join57(legacyDir, "opencode.json");
182067
- const legacyConfigC = join57(legacyDir, "opencode.jsonc");
182068
- if (existsSync63(legacyConfig) || existsSync63(legacyConfigC)) {
182187
+ const legacyConfig = join58(legacyDir, "opencode.json");
182188
+ const legacyConfigC = join58(legacyDir, "opencode.jsonc");
182189
+ if (existsSync64(legacyConfig) || existsSync64(legacyConfigC)) {
182069
182190
  return legacyDir;
182070
182191
  }
182071
182192
  }
@@ -182086,21 +182207,21 @@ function getOpenCodeSkillDirs(options) {
182086
182207
  ...configDirs.flatMap((configDir) => {
182087
182208
  const parentConfigDir = getParentOpencodeConfigDir(configDir);
182088
182209
  return [
182089
- join58(configDir, "skills"),
182090
- join58(configDir, "skill"),
182091
- ...parentConfigDir ? [join58(parentConfigDir, "skills"), join58(parentConfigDir, "skill")] : []
182210
+ join59(configDir, "skills"),
182211
+ join59(configDir, "skill"),
182212
+ ...parentConfigDir ? [join59(parentConfigDir, "skills"), join59(parentConfigDir, "skill")] : []
182092
182213
  ];
182093
182214
  })
182094
182215
  ]));
182095
182216
  }
182096
182217
  // packages/skills-loader-core/src/shared/project-discovery-dirs.ts
182097
182218
  import { execFileSync as execFileSync2 } from "child_process";
182098
- import { existsSync as existsSync64, realpathSync as realpathSync9 } from "fs";
182099
- import { dirname as dirname23, join as join59, resolve as resolve13, win32 as win326 } from "path";
182219
+ import { existsSync as existsSync65, realpathSync as realpathSync9 } from "fs";
182220
+ import { dirname as dirname23, join as join60, resolve as resolve13, win32 as win326 } from "path";
182100
182221
  var worktreePathCache2 = new Map;
182101
182222
  function normalizePath2(path18) {
182102
182223
  const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
182103
- if (!existsSync64(resolvedPath)) {
182224
+ if (!existsSync65(resolvedPath)) {
182104
182225
  return resolvedPath;
182105
182226
  }
182106
182227
  try {
@@ -182131,8 +182252,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
182131
182252
  const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
182132
182253
  while (true) {
182133
182254
  for (const targetPath of targetPaths) {
182134
- const candidateDirectory = join59(currentDirectory, ...targetPath);
182135
- if (!existsSync64(candidateDirectory)) {
182255
+ const candidateDirectory = join60(currentDirectory, ...targetPath);
182256
+ if (!existsSync65(candidateDirectory)) {
182136
182257
  continue;
182137
182258
  }
182138
182259
  const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
@@ -182214,7 +182335,7 @@ function deduplicateSkillsByName(skills2) {
182214
182335
  // packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
182215
182336
  init_src();
182216
182337
  import * as fs20 from "fs/promises";
182217
- import { join as join61 } from "path";
182338
+ import { join as join62 } from "path";
182218
182339
 
182219
182340
  // packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
182220
182341
  init_src();
@@ -182235,7 +182356,7 @@ function parseAllowedTools(allowedTools) {
182235
182356
  // packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
182236
182357
  init_js_yaml();
182237
182358
  import * as fs18 from "fs/promises";
182238
- import { join as join60 } from "path";
182359
+ import { join as join61 } from "path";
182239
182360
  function parseSkillMcpConfigFromFrontmatter(content) {
182240
182361
  const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
182241
182362
  if (!frontmatterMatch)
@@ -182254,7 +182375,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
182254
182375
  return;
182255
182376
  }
182256
182377
  async function loadMcpJsonFromDir(skillDir) {
182257
- const mcpJsonPath = join60(skillDir, "mcp.json");
182378
+ const mcpJsonPath = join61(skillDir, "mcp.json");
182258
182379
  try {
182259
182380
  const content = await fs18.readFile(mcpJsonPath, "utf-8");
182260
182381
  const parsed = JSON.parse(content);
@@ -182370,10 +182491,10 @@ async function loadSkillsFromDir(options) {
182370
182491
  const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
182371
182492
  const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
182372
182493
  for (const entry of directories) {
182373
- const entryPath = join61(options.skillsDir, entry.name);
182494
+ const entryPath = join62(options.skillsDir, entry.name);
182374
182495
  const resolvedPath = await resolveSymlinkAsync(entryPath);
182375
182496
  const dirName = entry.name;
182376
- const skillMdPath = join61(resolvedPath, "SKILL.md");
182497
+ const skillMdPath = join62(resolvedPath, "SKILL.md");
182377
182498
  if (await canAccessFile(skillMdPath)) {
182378
182499
  const skill = await loadSkillFromPath({
182379
182500
  skillPath: skillMdPath,
@@ -182387,7 +182508,7 @@ async function loadSkillsFromDir(options) {
182387
182508
  }
182388
182509
  continue;
182389
182510
  }
182390
- const namedSkillMdPath = join61(resolvedPath, `${dirName}.md`);
182511
+ const namedSkillMdPath = join62(resolvedPath, `${dirName}.md`);
182391
182512
  if (await canAccessFile(namedSkillMdPath)) {
182392
182513
  const skill = await loadSkillFromPath({
182393
182514
  skillPath: namedSkillMdPath,
@@ -182418,7 +182539,7 @@ async function loadSkillsFromDir(options) {
182418
182539
  }
182419
182540
  }
182420
182541
  for (const entry of files) {
182421
- const entryPath = join61(options.skillsDir, entry.name);
182542
+ const entryPath = join62(options.skillsDir, entry.name);
182422
182543
  const baseName = inferSkillNameFromFileName(entryPath);
182423
182544
  const skill = await loadSkillFromPath({
182424
182545
  skillPath: entryPath,
@@ -182470,7 +182591,7 @@ async function discoverAllSkills(directory) {
182470
182591
  ]);
182471
182592
  }
182472
182593
  async function discoverUserClaudeSkills() {
182473
- const userSkillsDir = join62(getClaudeConfigDir(), "skills");
182594
+ const userSkillsDir = join63(getClaudeConfigDir(), "skills");
182474
182595
  return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
182475
182596
  }
182476
182597
  async function discoverProjectClaudeSkills(directory) {
@@ -182497,7 +182618,7 @@ async function discoverProjectAgentsSkills(directory) {
182497
182618
  return deduplicateSkillsByName(allSkills.flat());
182498
182619
  }
182499
182620
  async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
182500
- const agentsGlobalDir = join62(homeDirectory, ".agents", "skills");
182621
+ const agentsGlobalDir = join63(homeDirectory, ".agents", "skills");
182501
182622
  return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
182502
182623
  }
182503
182624
  // packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
@@ -183249,7 +183370,7 @@ playwright-cli close
183249
183370
  init_shared_skills();
183250
183371
  init_src();
183251
183372
  import { readFileSync as readFileSync50 } from "fs";
183252
- import { join as join63 } from "path";
183373
+ import { join as join64 } from "path";
183253
183374
  function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootPath = sharedSkillsRootPath()) {
183254
183375
  const cache = new Map;
183255
183376
  return (skillName) => {
@@ -183257,7 +183378,7 @@ function createSharedSkillTemplateLoader(readFile3 = readFileSync50, skillsRootP
183257
183378
  if (cached2 !== undefined)
183258
183379
  return cached2;
183259
183380
  try {
183260
- const { body } = parseFrontmatter(readFile3(join63(skillsRootPath, skillName, "SKILL.md"), "utf8"));
183381
+ const { body } = parseFrontmatter(readFile3(join64(skillsRootPath, skillName, "SKILL.md"), "utf8"));
183261
183382
  cache.set(skillName, body);
183262
183383
  return body;
183263
183384
  } catch (error51) {
@@ -184394,7 +184515,7 @@ var gitMasterSkill = {
184394
184515
  template: GIT_MASTER_TEMPLATE
184395
184516
  };
184396
184517
  // packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
184397
- import { dirname as dirname24, join as join64 } from "path";
184518
+ import { dirname as dirname24, join as join65 } from "path";
184398
184519
  import { fileURLToPath as fileURLToPath8 } from "url";
184399
184520
  var CURRENT_DIR = dirname24(fileURLToPath8(import.meta.url));
184400
184521
  var devBrowserSkill = {
@@ -184614,7 +184735,7 @@ console.log({
184614
184735
  await client.disconnect();
184615
184736
  EOF
184616
184737
  \`\`\``,
184617
- resolvedPath: join64(CURRENT_DIR, "..", "dev-browser")
184738
+ resolvedPath: join65(CURRENT_DIR, "..", "dev-browser")
184618
184739
  };
184619
184740
  // packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
184620
184741
  var reviewWorkSkill = {
@@ -185607,9 +185728,9 @@ function applySnapshotRetention(options) {
185607
185728
  // packages/omo-opencode/src/cli/snapshot/snapshot.ts
185608
185729
  import { Database as Database3 } from "bun:sqlite";
185609
185730
  import {
185610
- existsSync as existsSync66,
185611
- mkdirSync as mkdirSync20,
185612
- copyFileSync as copyFileSync3,
185731
+ existsSync as existsSync67,
185732
+ mkdirSync as mkdirSync21,
185733
+ copyFileSync as copyFileSync4,
185613
185734
  readFileSync as readFileSync51,
185614
185735
  writeFileSync as writeFileSync19,
185615
185736
  readdirSync as readdirSync10,
@@ -185623,13 +185744,13 @@ async function snapshotCli(options = {}) {
185623
185744
  const homeDir = os7.homedir();
185624
185745
  const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
185625
185746
  const allPaths = getAllSnapshotPaths(homeDir);
185626
- const files = allPaths.files.filter((f2) => existsSync66(f2.sourcePath));
185747
+ const files = allPaths.files.filter((f2) => existsSync67(f2.sourcePath));
185627
185748
  const realFs = {
185628
- existsSync: existsSync66,
185629
- mkdirSync: mkdirSync20,
185749
+ existsSync: existsSync67,
185750
+ mkdirSync: mkdirSync21,
185630
185751
  readFileSync: readFileSync51,
185631
185752
  writeFileSync: writeFileSync19,
185632
- copyFileSync: copyFileSync3,
185753
+ copyFileSync: copyFileSync4,
185633
185754
  readdirSync: readdirSync10,
185634
185755
  statSync: statSync8,
185635
185756
  rmSync: rmSync4
@@ -185690,9 +185811,9 @@ async function snapshotCli(options = {}) {
185690
185811
 
185691
185812
  // packages/omo-opencode/src/cli/snapshot/restore.ts
185692
185813
  import {
185693
- existsSync as existsSync67,
185694
- mkdirSync as mkdirSync21,
185695
- copyFileSync as copyFileSync4,
185814
+ existsSync as existsSync68,
185815
+ mkdirSync as mkdirSync22,
185816
+ copyFileSync as copyFileSync5,
185696
185817
  readFileSync as readFileSync52,
185697
185818
  writeFileSync as writeFileSync20,
185698
185819
  readdirSync as readdirSync11,
@@ -185704,11 +185825,11 @@ import * as os8 from "os";
185704
185825
  async function restoreCli(options) {
185705
185826
  const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
185706
185827
  const realFs = {
185707
- existsSync: existsSync67,
185708
- mkdirSync: mkdirSync21,
185828
+ existsSync: existsSync68,
185829
+ mkdirSync: mkdirSync22,
185709
185830
  readFileSync: readFileSync52,
185710
185831
  writeFileSync: writeFileSync20,
185711
- copyFileSync: copyFileSync4,
185832
+ copyFileSync: copyFileSync5,
185712
185833
  readdirSync: readdirSync11,
185713
185834
  statSync: statSync9,
185714
185835
  rmSync: rmSync5
@@ -185742,9 +185863,9 @@ async function restoreCli(options) {
185742
185863
 
185743
185864
  // packages/omo-opencode/src/cli/snapshot/list.ts
185744
185865
  import {
185745
- existsSync as existsSync68,
185746
- mkdirSync as mkdirSync22,
185747
- copyFileSync as copyFileSync5,
185866
+ existsSync as existsSync69,
185867
+ mkdirSync as mkdirSync23,
185868
+ copyFileSync as copyFileSync6,
185748
185869
  readFileSync as readFileSync53,
185749
185870
  writeFileSync as writeFileSync21,
185750
185871
  readdirSync as readdirSync12,
@@ -185766,11 +185887,11 @@ function formatBytes(bytes) {
185766
185887
  async function snapshotListCli(options) {
185767
185888
  const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
185768
185889
  const realFs = {
185769
- existsSync: existsSync68,
185770
- mkdirSync: mkdirSync22,
185890
+ existsSync: existsSync69,
185891
+ mkdirSync: mkdirSync23,
185771
185892
  readFileSync: readFileSync53,
185772
185893
  writeFileSync: writeFileSync21,
185773
- copyFileSync: copyFileSync5,
185894
+ copyFileSync: copyFileSync6,
185774
185895
  readdirSync: readdirSync12,
185775
185896
  statSync: statSync10,
185776
185897
  rmSync: rmSync6
@@ -185796,9 +185917,9 @@ async function snapshotListCli(options) {
185796
185917
 
185797
185918
  // packages/omo-opencode/src/cli/snapshot/prune.ts
185798
185919
  import {
185799
- existsSync as existsSync69,
185800
- mkdirSync as mkdirSync23,
185801
- copyFileSync as copyFileSync6,
185920
+ existsSync as existsSync70,
185921
+ mkdirSync as mkdirSync24,
185922
+ copyFileSync as copyFileSync7,
185802
185923
  readFileSync as readFileSync54,
185803
185924
  writeFileSync as writeFileSync22,
185804
185925
  readdirSync as readdirSync13,
@@ -185810,11 +185931,11 @@ import * as os10 from "os";
185810
185931
  async function snapshotPruneCli(options = {}) {
185811
185932
  const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
185812
185933
  const realFs = {
185813
- existsSync: existsSync69,
185814
- mkdirSync: mkdirSync23,
185934
+ existsSync: existsSync70,
185935
+ mkdirSync: mkdirSync24,
185815
185936
  readFileSync: readFileSync54,
185816
185937
  writeFileSync: writeFileSync22,
185817
- copyFileSync: copyFileSync6,
185938
+ copyFileSync: copyFileSync7,
185818
185939
  readdirSync: readdirSync13,
185819
185940
  statSync: statSync11,
185820
185941
  rmSync: rmSync7
@@ -185860,8 +185981,8 @@ function codebaseCli(rootProgram) {
185860
185981
  try {
185861
185982
  const dimension = Number.parseInt(options.dimension, 10) || 384;
185862
185983
  const dbDir = path22.dirname(options.db);
185863
- const { mkdirSync: mkdirSync24 } = await import("fs");
185864
- mkdirSync24(dbDir, { recursive: true });
185984
+ const { mkdirSync: mkdirSync25 } = await import("fs");
185985
+ mkdirSync25(dbDir, { recursive: true });
185865
185986
  const store4 = createSqliteVectorStore({ path: options.db, dimension });
185866
185987
  if (options.reset) {
185867
185988
  store4.clear();
@@ -187078,7 +187199,7 @@ function loadGatewayPassphrase() {
187078
187199
  }
187079
187200
  async function dashboardCli(options) {
187080
187201
  const port3 = options.port ?? 9123;
187081
- const host = options.host ?? "127.0.0.1";
187202
+ const host = options.host ?? "0.0.0.0";
187082
187203
  const frontendDir = path25.resolve(import.meta.dir, "../features/dashboard/frontend");
187083
187204
  const gatewayPassphrase = loadGatewayPassphrase();
187084
187205
  console.log(`[dashboard] starting MaTrixOS dashboard on http://${host}:${port3}`);
@@ -187112,11 +187233,11 @@ async function dashboardCli(options) {
187112
187233
  }
187113
187234
 
187114
187235
  // packages/omo-opencode/src/cli/architect.ts
187115
- import { join as join74 } from "path";
187236
+ import { join as join75 } from "path";
187116
187237
  var IMPROVEMENTS_DIR = ".matrixos/improvements";
187117
187238
  function getStore(directory) {
187118
187239
  const baseDir = directory ?? process.cwd();
187119
- return createImprovementStore(join74(baseDir, IMPROVEMENTS_DIR));
187240
+ return createImprovementStore(join75(baseDir, IMPROVEMENTS_DIR));
187120
187241
  }
187121
187242
  async function architectReview(options) {
187122
187243
  const store4 = getStore(options.directory);