oh-my-opencode 3.17.2 → 3.17.3

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/index.js CHANGED
@@ -2649,8 +2649,8 @@ var require_semaphore = __commonJS((exports) => {
2649
2649
  this._waiting = [];
2650
2650
  }
2651
2651
  lock(thunk) {
2652
- return new Promise((resolve13, reject) => {
2653
- this._waiting.push({ thunk, resolve: resolve13, reject });
2652
+ return new Promise((resolve14, reject) => {
2653
+ this._waiting.push({ thunk, resolve: resolve14, reject });
2654
2654
  this.runNext();
2655
2655
  });
2656
2656
  }
@@ -4141,9 +4141,9 @@ ${JSON.stringify(message, null, 4)}`);
4141
4141
  if (typeof cancellationStrategy.sender.enableCancellation === "function") {
4142
4142
  cancellationStrategy.sender.enableCancellation(requestMessage);
4143
4143
  }
4144
- return new Promise(async (resolve13, reject) => {
4144
+ return new Promise(async (resolve14, reject) => {
4145
4145
  const resolveWithCleanup = (r) => {
4146
- resolve13(r);
4146
+ resolve14(r);
4147
4147
  cancellationStrategy.sender.cleanup(id);
4148
4148
  disposable?.dispose();
4149
4149
  };
@@ -4552,10 +4552,10 @@ var require_ril = __commonJS((exports) => {
4552
4552
  return api_1.Disposable.create(() => this.stream.off("end", listener));
4553
4553
  }
4554
4554
  write(data, encoding) {
4555
- return new Promise((resolve13, reject) => {
4555
+ return new Promise((resolve14, reject) => {
4556
4556
  const callback = (error48) => {
4557
4557
  if (error48 === undefined || error48 === null) {
4558
- resolve13();
4558
+ resolve14();
4559
4559
  } else {
4560
4560
  reject(error48);
4561
4561
  }
@@ -4814,10 +4814,10 @@ var require_main = __commonJS((exports) => {
4814
4814
  exports.generateRandomPipeName = generateRandomPipeName;
4815
4815
  function createClientPipeTransport(pipeName, encoding = "utf-8") {
4816
4816
  let connectResolve;
4817
- const connected = new Promise((resolve13, _reject) => {
4818
- connectResolve = resolve13;
4817
+ const connected = new Promise((resolve14, _reject) => {
4818
+ connectResolve = resolve14;
4819
4819
  });
4820
- return new Promise((resolve13, reject) => {
4820
+ return new Promise((resolve14, reject) => {
4821
4821
  let server = (0, net_1.createServer)((socket) => {
4822
4822
  server.close();
4823
4823
  connectResolve([
@@ -4828,7 +4828,7 @@ var require_main = __commonJS((exports) => {
4828
4828
  server.on("error", reject);
4829
4829
  server.listen(pipeName, () => {
4830
4830
  server.removeListener("error", reject);
4831
- resolve13({
4831
+ resolve14({
4832
4832
  onConnected: () => {
4833
4833
  return connected;
4834
4834
  }
@@ -4847,10 +4847,10 @@ var require_main = __commonJS((exports) => {
4847
4847
  exports.createServerPipeTransport = createServerPipeTransport;
4848
4848
  function createClientSocketTransport(port, encoding = "utf-8") {
4849
4849
  let connectResolve;
4850
- const connected = new Promise((resolve13, _reject) => {
4851
- connectResolve = resolve13;
4850
+ const connected = new Promise((resolve14, _reject) => {
4851
+ connectResolve = resolve14;
4852
4852
  });
4853
- return new Promise((resolve13, reject) => {
4853
+ return new Promise((resolve14, reject) => {
4854
4854
  const server = (0, net_1.createServer)((socket) => {
4855
4855
  server.close();
4856
4856
  connectResolve([
@@ -4861,7 +4861,7 @@ var require_main = __commonJS((exports) => {
4861
4861
  server.on("error", reject);
4862
4862
  server.listen(port, "127.0.0.1", () => {
4863
4863
  server.removeListener("error", reject);
4864
- resolve13({
4864
+ resolve14({
4865
4865
  onConnected: () => {
4866
4866
  return connected;
4867
4867
  }
@@ -8439,7 +8439,7 @@ var require_compile = __commonJS((exports) => {
8439
8439
  const schOrFunc = root.refs[ref];
8440
8440
  if (schOrFunc)
8441
8441
  return schOrFunc;
8442
- let _sch = resolve20.call(this, root, ref);
8442
+ let _sch = resolve21.call(this, root, ref);
8443
8443
  if (_sch === undefined) {
8444
8444
  const schema2 = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
8445
8445
  const { schemaId } = this.opts;
@@ -8466,7 +8466,7 @@ var require_compile = __commonJS((exports) => {
8466
8466
  function sameSchemaEnv(s1, s2) {
8467
8467
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
8468
8468
  }
8469
- function resolve20(root, ref) {
8469
+ function resolve21(root, ref) {
8470
8470
  let sch;
8471
8471
  while (typeof (sch = this.refs[ref]) == "string")
8472
8472
  ref = sch;
@@ -8677,8 +8677,8 @@ var require_utils2 = __commonJS((exports, module) => {
8677
8677
  }
8678
8678
  return ind;
8679
8679
  }
8680
- function removeDotSegments(path14) {
8681
- let input = path14;
8680
+ function removeDotSegments(path15) {
8681
+ let input = path15;
8682
8682
  const output = [];
8683
8683
  let nextSlash = -1;
8684
8684
  let len = 0;
@@ -8868,8 +8868,8 @@ var require_schemes = __commonJS((exports, module) => {
8868
8868
  wsComponent.secure = undefined;
8869
8869
  }
8870
8870
  if (wsComponent.resourceName) {
8871
- const [path14, query] = wsComponent.resourceName.split("?");
8872
- wsComponent.path = path14 && path14 !== "/" ? path14 : undefined;
8871
+ const [path15, query] = wsComponent.resourceName.split("?");
8872
+ wsComponent.path = path15 && path15 !== "/" ? path15 : undefined;
8873
8873
  wsComponent.query = query;
8874
8874
  wsComponent.resourceName = undefined;
8875
8875
  }
@@ -8996,7 +8996,7 @@ var require_fast_uri = __commonJS((exports, module) => {
8996
8996
  }
8997
8997
  return uri;
8998
8998
  }
8999
- function resolve20(baseURI, relativeURI, options) {
8999
+ function resolve21(baseURI, relativeURI, options) {
9000
9000
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
9001
9001
  const resolved = resolveComponent(parse11(baseURI, schemelessOptions), parse11(relativeURI, schemelessOptions), schemelessOptions, true);
9002
9002
  schemelessOptions.skipEscape = true;
@@ -9224,7 +9224,7 @@ var require_fast_uri = __commonJS((exports, module) => {
9224
9224
  var fastUri = {
9225
9225
  SCHEMES,
9226
9226
  normalize: normalize3,
9227
- resolve: resolve20,
9227
+ resolve: resolve21,
9228
9228
  resolveComponent,
9229
9229
  equal,
9230
9230
  serialize,
@@ -12013,12 +12013,12 @@ var require_dist = __commonJS((exports, module) => {
12013
12013
  throw new Error(`Unknown format "${name}"`);
12014
12014
  return f;
12015
12015
  };
12016
- function addFormats(ajv, list, fs20, exportName) {
12016
+ function addFormats(ajv, list, fs21, exportName) {
12017
12017
  var _a2;
12018
12018
  var _b;
12019
12019
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
12020
12020
  for (const f of list)
12021
- ajv.addFormat(f, fs20[f]);
12021
+ ajv.addFormat(f, fs21[f]);
12022
12022
  }
12023
12023
  module.exports = exports = formatsPlugin;
12024
12024
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -12029,8 +12029,8 @@ var require_dist = __commonJS((exports, module) => {
12029
12029
  var require_windows = __commonJS((exports, module) => {
12030
12030
  module.exports = isexe;
12031
12031
  isexe.sync = sync;
12032
- var fs20 = __require("fs");
12033
- function checkPathExt(path14, options) {
12032
+ var fs21 = __require("fs");
12033
+ function checkPathExt(path15, options) {
12034
12034
  var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
12035
12035
  if (!pathext) {
12036
12036
  return true;
@@ -12041,25 +12041,25 @@ var require_windows = __commonJS((exports, module) => {
12041
12041
  }
12042
12042
  for (var i2 = 0;i2 < pathext.length; i2++) {
12043
12043
  var p = pathext[i2].toLowerCase();
12044
- if (p && path14.substr(-p.length).toLowerCase() === p) {
12044
+ if (p && path15.substr(-p.length).toLowerCase() === p) {
12045
12045
  return true;
12046
12046
  }
12047
12047
  }
12048
12048
  return false;
12049
12049
  }
12050
- function checkStat(stat2, path14, options) {
12050
+ function checkStat(stat2, path15, options) {
12051
12051
  if (!stat2.isSymbolicLink() && !stat2.isFile()) {
12052
12052
  return false;
12053
12053
  }
12054
- return checkPathExt(path14, options);
12054
+ return checkPathExt(path15, options);
12055
12055
  }
12056
- function isexe(path14, options, cb) {
12057
- fs20.stat(path14, function(er, stat2) {
12058
- cb(er, er ? false : checkStat(stat2, path14, options));
12056
+ function isexe(path15, options, cb) {
12057
+ fs21.stat(path15, function(er, stat2) {
12058
+ cb(er, er ? false : checkStat(stat2, path15, options));
12059
12059
  });
12060
12060
  }
12061
- function sync(path14, options) {
12062
- return checkStat(fs20.statSync(path14), path14, options);
12061
+ function sync(path15, options) {
12062
+ return checkStat(fs21.statSync(path15), path15, options);
12063
12063
  }
12064
12064
  });
12065
12065
 
@@ -12067,14 +12067,14 @@ var require_windows = __commonJS((exports, module) => {
12067
12067
  var require_mode = __commonJS((exports, module) => {
12068
12068
  module.exports = isexe;
12069
12069
  isexe.sync = sync;
12070
- var fs20 = __require("fs");
12071
- function isexe(path14, options, cb) {
12072
- fs20.stat(path14, function(er, stat2) {
12070
+ var fs21 = __require("fs");
12071
+ function isexe(path15, options, cb) {
12072
+ fs21.stat(path15, function(er, stat2) {
12073
12073
  cb(er, er ? false : checkStat(stat2, options));
12074
12074
  });
12075
12075
  }
12076
- function sync(path14, options) {
12077
- return checkStat(fs20.statSync(path14), options);
12076
+ function sync(path15, options) {
12077
+ return checkStat(fs21.statSync(path15), options);
12078
12078
  }
12079
12079
  function checkStat(stat2, options) {
12080
12080
  return stat2.isFile() && checkMode(stat2, options);
@@ -12096,7 +12096,7 @@ var require_mode = __commonJS((exports, module) => {
12096
12096
 
12097
12097
  // node_modules/isexe/index.js
12098
12098
  var require_isexe = __commonJS((exports, module) => {
12099
- var fs20 = __require("fs");
12099
+ var fs21 = __require("fs");
12100
12100
  var core4;
12101
12101
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
12102
12102
  core4 = require_windows();
@@ -12105,7 +12105,7 @@ var require_isexe = __commonJS((exports, module) => {
12105
12105
  }
12106
12106
  module.exports = isexe;
12107
12107
  isexe.sync = sync;
12108
- function isexe(path14, options, cb) {
12108
+ function isexe(path15, options, cb) {
12109
12109
  if (typeof options === "function") {
12110
12110
  cb = options;
12111
12111
  options = {};
@@ -12114,17 +12114,17 @@ var require_isexe = __commonJS((exports, module) => {
12114
12114
  if (typeof Promise !== "function") {
12115
12115
  throw new TypeError("callback not provided");
12116
12116
  }
12117
- return new Promise(function(resolve20, reject) {
12118
- isexe(path14, options || {}, function(er, is) {
12117
+ return new Promise(function(resolve21, reject) {
12118
+ isexe(path15, options || {}, function(er, is) {
12119
12119
  if (er) {
12120
12120
  reject(er);
12121
12121
  } else {
12122
- resolve20(is);
12122
+ resolve21(is);
12123
12123
  }
12124
12124
  });
12125
12125
  });
12126
12126
  }
12127
- core4(path14, options || {}, function(er, is) {
12127
+ core4(path15, options || {}, function(er, is) {
12128
12128
  if (er) {
12129
12129
  if (er.code === "EACCES" || options && options.ignoreErrors) {
12130
12130
  er = null;
@@ -12134,9 +12134,9 @@ var require_isexe = __commonJS((exports, module) => {
12134
12134
  cb(er, is);
12135
12135
  });
12136
12136
  }
12137
- function sync(path14, options) {
12137
+ function sync(path15, options) {
12138
12138
  try {
12139
- return core4.sync(path14, options || {});
12139
+ return core4.sync(path15, options || {});
12140
12140
  } catch (er) {
12141
12141
  if (options && options.ignoreErrors || er.code === "EACCES") {
12142
12142
  return false;
@@ -12150,7 +12150,7 @@ var require_isexe = __commonJS((exports, module) => {
12150
12150
  // node_modules/which/which.js
12151
12151
  var require_which = __commonJS((exports, module) => {
12152
12152
  var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
12153
- var path14 = __require("path");
12153
+ var path15 = __require("path");
12154
12154
  var COLON = isWindows2 ? ";" : ":";
12155
12155
  var isexe = require_isexe();
12156
12156
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -12181,27 +12181,27 @@ var require_which = __commonJS((exports, module) => {
12181
12181
  opt = {};
12182
12182
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
12183
12183
  const found = [];
12184
- const step = (i2) => new Promise((resolve20, reject) => {
12184
+ const step = (i2) => new Promise((resolve21, reject) => {
12185
12185
  if (i2 === pathEnv.length)
12186
- return opt.all && found.length ? resolve20(found) : reject(getNotFoundError(cmd));
12186
+ return opt.all && found.length ? resolve21(found) : reject(getNotFoundError(cmd));
12187
12187
  const ppRaw = pathEnv[i2];
12188
12188
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
12189
- const pCmd = path14.join(pathPart, cmd);
12189
+ const pCmd = path15.join(pathPart, cmd);
12190
12190
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
12191
- resolve20(subStep(p, i2, 0));
12191
+ resolve21(subStep(p, i2, 0));
12192
12192
  });
12193
- const subStep = (p, i2, ii) => new Promise((resolve20, reject) => {
12193
+ const subStep = (p, i2, ii) => new Promise((resolve21, reject) => {
12194
12194
  if (ii === pathExt.length)
12195
- return resolve20(step(i2 + 1));
12195
+ return resolve21(step(i2 + 1));
12196
12196
  const ext = pathExt[ii];
12197
12197
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
12198
12198
  if (!er && is) {
12199
12199
  if (opt.all)
12200
12200
  found.push(p + ext);
12201
12201
  else
12202
- return resolve20(p + ext);
12202
+ return resolve21(p + ext);
12203
12203
  }
12204
- return resolve20(subStep(p, i2, ii + 1));
12204
+ return resolve21(subStep(p, i2, ii + 1));
12205
12205
  });
12206
12206
  });
12207
12207
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -12213,7 +12213,7 @@ var require_which = __commonJS((exports, module) => {
12213
12213
  for (let i2 = 0;i2 < pathEnv.length; i2++) {
12214
12214
  const ppRaw = pathEnv[i2];
12215
12215
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
12216
- const pCmd = path14.join(pathPart, cmd);
12216
+ const pCmd = path15.join(pathPart, cmd);
12217
12217
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
12218
12218
  for (let j = 0;j < pathExt.length; j++) {
12219
12219
  const cur = p + pathExt[j];
@@ -12254,7 +12254,7 @@ var require_path_key = __commonJS((exports, module) => {
12254
12254
 
12255
12255
  // node_modules/cross-spawn/lib/util/resolveCommand.js
12256
12256
  var require_resolveCommand = __commonJS((exports, module) => {
12257
- var path14 = __require("path");
12257
+ var path15 = __require("path");
12258
12258
  var which = require_which();
12259
12259
  var getPathKey = require_path_key();
12260
12260
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -12271,7 +12271,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
12271
12271
  try {
12272
12272
  resolved = which.sync(parsed.command, {
12273
12273
  path: env[getPathKey({ env })],
12274
- pathExt: withoutPathExt ? path14.delimiter : undefined
12274
+ pathExt: withoutPathExt ? path15.delimiter : undefined
12275
12275
  });
12276
12276
  } catch (e) {} finally {
12277
12277
  if (shouldSwitchCwd) {
@@ -12279,7 +12279,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
12279
12279
  }
12280
12280
  }
12281
12281
  if (resolved) {
12282
- resolved = path14.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12282
+ resolved = path15.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12283
12283
  }
12284
12284
  return resolved;
12285
12285
  }
@@ -12324,8 +12324,8 @@ var require_shebang_command = __commonJS((exports, module) => {
12324
12324
  if (!match) {
12325
12325
  return null;
12326
12326
  }
12327
- const [path14, argument] = match[0].replace(/#! ?/, "").split(" ");
12328
- const binary2 = path14.split("/").pop();
12327
+ const [path15, argument] = match[0].replace(/#! ?/, "").split(" ");
12328
+ const binary2 = path15.split("/").pop();
12329
12329
  if (binary2 === "env") {
12330
12330
  return argument;
12331
12331
  }
@@ -12335,16 +12335,16 @@ var require_shebang_command = __commonJS((exports, module) => {
12335
12335
 
12336
12336
  // node_modules/cross-spawn/lib/util/readShebang.js
12337
12337
  var require_readShebang = __commonJS((exports, module) => {
12338
- var fs20 = __require("fs");
12338
+ var fs21 = __require("fs");
12339
12339
  var shebangCommand = require_shebang_command();
12340
12340
  function readShebang(command) {
12341
12341
  const size = 150;
12342
12342
  const buffer2 = Buffer.alloc(size);
12343
12343
  let fd;
12344
12344
  try {
12345
- fd = fs20.openSync(command, "r");
12346
- fs20.readSync(fd, buffer2, 0, size, 0);
12347
- fs20.closeSync(fd);
12345
+ fd = fs21.openSync(command, "r");
12346
+ fs21.readSync(fd, buffer2, 0, size, 0);
12347
+ fs21.closeSync(fd);
12348
12348
  } catch (e) {}
12349
12349
  return shebangCommand(buffer2.toString());
12350
12350
  }
@@ -12353,7 +12353,7 @@ var require_readShebang = __commonJS((exports, module) => {
12353
12353
 
12354
12354
  // node_modules/cross-spawn/lib/parse.js
12355
12355
  var require_parse2 = __commonJS((exports, module) => {
12356
- var path14 = __require("path");
12356
+ var path15 = __require("path");
12357
12357
  var resolveCommand = require_resolveCommand();
12358
12358
  var escape2 = require_escape();
12359
12359
  var readShebang = require_readShebang();
@@ -12378,7 +12378,7 @@ var require_parse2 = __commonJS((exports, module) => {
12378
12378
  const needsShell = !isExecutableRegExp.test(commandFile);
12379
12379
  if (parsed.options.forceShell || needsShell) {
12380
12380
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
12381
- parsed.command = path14.normalize(parsed.command);
12381
+ parsed.command = path15.normalize(parsed.command);
12382
12382
  parsed.command = escape2.command(parsed.command);
12383
12383
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
12384
12384
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -17570,20 +17570,28 @@ function migrateConfigFile(configPath, rawConfig) {
17570
17570
  }
17571
17571
  }
17572
17572
  if (needsWrite) {
17573
+ let finalConfig = JSON.parse(JSON.stringify(copy));
17574
+ const newContent = JSON.stringify(finalConfig, null, 2) + `
17575
+ `;
17576
+ let existingContent;
17577
+ try {
17578
+ existingContent = fs4.readFileSync(configPath, "utf-8");
17579
+ } catch {}
17580
+ const contentChanged = existingContent !== newContent;
17573
17581
  const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
17574
17582
  const backupPath = `${configPath}.bak.${timestamp2}`;
17575
17583
  let backupSucceeded = false;
17576
- try {
17577
- fs4.copyFileSync(configPath, backupPath);
17578
- backupSucceeded = true;
17579
- } catch {
17580
- backupSucceeded = false;
17584
+ if (contentChanged) {
17585
+ try {
17586
+ fs4.copyFileSync(configPath, backupPath);
17587
+ backupSucceeded = true;
17588
+ } catch {
17589
+ backupSucceeded = false;
17590
+ }
17581
17591
  }
17582
17592
  let writeSucceeded = false;
17583
- let finalConfig = JSON.parse(JSON.stringify(copy));
17584
17593
  try {
17585
- writeFileAtomically(configPath, JSON.stringify(finalConfig, null, 2) + `
17586
- `);
17594
+ writeFileAtomically(configPath, newContent);
17587
17595
  writeSucceeded = true;
17588
17596
  } catch (err) {
17589
17597
  log(`Failed to write migrated config to ${configPath}:`, err);
@@ -17690,6 +17698,21 @@ function getOpenCodeConfigPaths(options) {
17690
17698
  omoConfig: join6(configDir, `${CONFIG_BASENAME}.json`)
17691
17699
  };
17692
17700
  }
17701
+ // src/shared/resolve-agent-definition-paths.ts
17702
+ import { homedir as homedir5 } from "os";
17703
+ import { isAbsolute as isAbsolute3, resolve as resolve4 } from "path";
17704
+ init_logger();
17705
+ function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
17706
+ return paths.flatMap((p) => {
17707
+ const expanded = p.startsWith("~/") ? p.replace(/^~\//, `${homedir5()}/`) : p;
17708
+ const resolved = isAbsolute3(expanded) ? expanded : resolve4(baseDir, expanded);
17709
+ if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
17710
+ log(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
17711
+ return [];
17712
+ }
17713
+ return [resolved];
17714
+ });
17715
+ }
17693
17716
  // src/shared/opencode-version.ts
17694
17717
  import { execSync } from "child_process";
17695
17718
  var OPENCODE_NATIVE_AGENTS_INJECTION_VERSION = "1.1.37";
@@ -17947,7 +17970,7 @@ var {spawn: spawn7, spawnSync: spawnSync3 } = globalThis.Bun;
17947
17970
  import { release } from "os";
17948
17971
 
17949
17972
  // src/shared/archive-entry-validator.ts
17950
- import { dirname as dirname3, isAbsolute as isAbsolute3, relative as relative2, resolve as resolve4, sep } from "path";
17973
+ import { dirname as dirname3, isAbsolute as isAbsolute4, relative as relative2, resolve as resolve5, sep } from "path";
17951
17974
  function normalizeArchivePath(filePath) {
17952
17975
  return filePath.replaceAll("\\", "/");
17953
17976
  }
@@ -17956,11 +17979,11 @@ function containsTraversalSegment(filePath) {
17956
17979
  }
17957
17980
  function isArchiveAbsolutePath(filePath) {
17958
17981
  const normalizedPath = normalizeArchivePath(filePath);
17959
- return isAbsolute3(normalizedPath) || /^[A-Za-z]:\//.test(normalizedPath) || normalizedPath.startsWith("//");
17982
+ return isAbsolute4(normalizedPath) || /^[A-Za-z]:\//.test(normalizedPath) || normalizedPath.startsWith("//");
17960
17983
  }
17961
17984
  function escapesDirectory(rootDir, candidatePath) {
17962
17985
  const relativePath = relative2(rootDir, candidatePath);
17963
- return relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute3(relativePath);
17986
+ return relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute4(relativePath);
17964
17987
  }
17965
17988
  function resolveContainedPath(rootDir, filePath, errorLabel) {
17966
17989
  const normalizedPath = normalizeArchivePath(filePath);
@@ -17970,14 +17993,14 @@ function resolveContainedPath(rootDir, filePath, errorLabel) {
17970
17993
  if (containsTraversalSegment(normalizedPath)) {
17971
17994
  throw new Error(`Unsafe archive entry: ${errorLabel} contains path traversal (${filePath})`);
17972
17995
  }
17973
- const resolvedPath = resolve4(rootDir, normalizedPath);
17996
+ const resolvedPath = resolve5(rootDir, normalizedPath);
17974
17997
  if (escapesDirectory(rootDir, resolvedPath)) {
17975
17998
  throw new Error(`Unsafe archive entry: ${errorLabel} contains path traversal (${filePath})`);
17976
17999
  }
17977
18000
  return resolvedPath;
17978
18001
  }
17979
18002
  function validateArchiveEntries(entries, destDir) {
17980
- const resolvedDestDir = resolve4(destDir);
18003
+ const resolvedDestDir = resolve5(destDir);
17981
18004
  for (const entry of entries) {
17982
18005
  const resolvedEntryPath = resolveContainedPath(resolvedDestDir, entry.path, "path");
17983
18006
  if (entry.type !== "symlink" && entry.type !== "hardlink") {
@@ -17994,7 +18017,7 @@ function validateArchiveEntries(entries, destDir) {
17994
18017
  if (containsTraversalSegment(normalizedLinkPath)) {
17995
18018
  throw new Error(`Unsafe archive entry: ${linkTypeLabel} contains path traversal (${entry.linkPath})`);
17996
18019
  }
17997
- const resolvedLinkPath = resolve4(dirname3(resolvedEntryPath), normalizedLinkPath);
18020
+ const resolvedLinkPath = resolve5(dirname3(resolvedEntryPath), normalizedLinkPath);
17998
18021
  if (escapesDirectory(resolvedDestDir, resolvedLinkPath)) {
17999
18022
  throw new Error(`Unsafe archive entry: ${linkTypeLabel} escapes extraction directory (${entry.linkPath})`);
18000
18023
  }
@@ -18427,6 +18450,9 @@ async function listTarEntries(archivePath, cwd) {
18427
18450
  }
18428
18451
  return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((line) => parseTarEntry(line)).filter((entry) => entry !== null);
18429
18452
  }
18453
+ // src/shared/agent-variant.ts
18454
+ init_agent_display_names();
18455
+
18430
18456
  // src/shared/model-requirements.ts
18431
18457
  var AGENT_MODEL_REQUIREMENTS = {
18432
18458
  sisyphus: {
@@ -18832,6 +18858,9 @@ function detectShellType() {
18832
18858
  }
18833
18859
  return "unix";
18834
18860
  }
18861
+ if (process.env.MSYSTEM) {
18862
+ return "unix";
18863
+ }
18835
18864
  if (process.env.PSModulePath) {
18836
18865
  return "powershell";
18837
18866
  }
@@ -18913,6 +18942,7 @@ var SystemDirectiveTypes = {
18913
18942
  PROMETHEUS_READ_ONLY: "PROMETHEUS READ-ONLY"
18914
18943
  };
18915
18944
  // src/shared/agent-tool-restrictions.ts
18945
+ init_agent_display_names();
18916
18946
  var EXPLORATION_AGENT_DENYLIST = {
18917
18947
  write: false,
18918
18948
  edit: false,
@@ -18946,7 +18976,8 @@ var AGENT_RESTRICTIONS = {
18946
18976
  }
18947
18977
  };
18948
18978
  function getAgentToolRestrictions(agentName) {
18949
- return AGENT_RESTRICTIONS[agentName] ?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1] ?? {};
18979
+ const stripped = stripInvisibleAgentCharacters(agentName);
18980
+ return AGENT_RESTRICTIONS[stripped] ?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === stripped.toLowerCase())?.[1] ?? {};
18950
18981
  }
18951
18982
  // src/shared/model-normalization.ts
18952
18983
  function normalizeModel(model) {
@@ -18965,7 +18996,7 @@ init_logger();
18965
18996
 
18966
18997
  // src/shared/json-file-cache-store.ts
18967
18998
  init_logger();
18968
- import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
18999
+ import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "fs";
18969
19000
  import { join as join10 } from "path";
18970
19001
  function toLogLabel(cacheLabel) {
18971
19002
  return cacheLabel.toLowerCase();
@@ -18992,7 +19023,7 @@ function createJsonFileCacheStore(options) {
18992
19023
  return null;
18993
19024
  }
18994
19025
  try {
18995
- const content = readFileSync5(cacheFile, "utf-8");
19026
+ const content = readFileSync6(cacheFile, "utf-8");
18996
19027
  const value = JSON.parse(content);
18997
19028
  memoryValue = value;
18998
19029
  log(`[${options.logPrefix}] Read ${toLogLabel(options.cacheLabel)}`, options.describe(value));
@@ -19169,7 +19200,7 @@ var {
19169
19200
 
19170
19201
  // src/shared/model-availability.ts
19171
19202
  init_logger();
19172
- import { existsSync as existsSync11, readFileSync as readFileSync6 } from "fs";
19203
+ import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
19173
19204
  import { join as join11 } from "path";
19174
19205
  function normalizeModelName(name) {
19175
19206
  return name.toLowerCase().replace(/claude-(opus|sonnet|haiku)-(\d+)[.-](\d+)/g, "claude-$1-$2.$3");
@@ -19311,7 +19342,7 @@ async function fetchAvailableModels(client, options) {
19311
19342
  log("[fetchAvailableModels] models.json cache file not found, falling back to client");
19312
19343
  } else {
19313
19344
  try {
19314
- const content = readFileSync6(cacheFile, "utf-8");
19345
+ const content = readFileSync7(cacheFile, "utf-8");
19315
19346
  const data = JSON.parse(content);
19316
19347
  const providerIds = Object.keys(data);
19317
19348
  log("[fetchAvailableModels] providers found in models.json", { count: providerIds.length, providers: providerIds.slice(0, 10) });
@@ -61020,13 +61051,13 @@ function isAnyProviderConnected(providers, availableModels) {
61020
61051
  return false;
61021
61052
  }
61022
61053
  // src/features/hook-message-injector/injector.ts
61023
- import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync8, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
61054
+ import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
61024
61055
  import { randomBytes } from "crypto";
61025
61056
  import { join as join14 } from "path";
61026
61057
  init_logger();
61027
61058
 
61028
61059
  // src/shared/compaction-marker.ts
61029
- import { existsSync as existsSync12, readdirSync, readFileSync as readFileSync7 } from "fs";
61060
+ import { existsSync as existsSync12, readdirSync, readFileSync as readFileSync8 } from "fs";
61030
61061
  import { join as join13 } from "path";
61031
61062
 
61032
61063
  // src/shared/opencode-storage-paths.ts
@@ -61063,7 +61094,7 @@ function hasCompactionPartInStorage(messageID) {
61063
61094
  try {
61064
61095
  return readdirSync(partDir).filter((fileName) => fileName.endsWith(".json")).some((fileName) => {
61065
61096
  try {
61066
- const content = readFileSync7(join13(partDir, fileName), "utf-8");
61097
+ const content = readFileSync8(join13(partDir, fileName), "utf-8");
61067
61098
  return isCompactionPart(JSON.parse(content));
61068
61099
  } catch {
61069
61100
  return false;
@@ -61156,7 +61187,7 @@ function findNearestMessageWithFields(messageDir) {
61156
61187
  try {
61157
61188
  const messages = readdirSync2(messageDir).filter((f) => f.endsWith(".json")).map((fileName) => {
61158
61189
  try {
61159
- const content = readFileSync8(join14(messageDir, fileName), "utf-8");
61190
+ const content = readFileSync9(join14(messageDir, fileName), "utf-8");
61160
61191
  const msg = JSON.parse(content);
61161
61192
  return {
61162
61193
  fileName,
@@ -61196,7 +61227,7 @@ function findFirstMessageWithAgent(messageDir) {
61196
61227
  try {
61197
61228
  const messages = readdirSync2(messageDir).filter((f) => f.endsWith(".json")).map((fileName) => {
61198
61229
  try {
61199
- const content = readFileSync8(join14(messageDir, fileName), "utf-8");
61230
+ const content = readFileSync9(join14(messageDir, fileName), "utf-8");
61200
61231
  const msg = JSON.parse(content);
61201
61232
  return {
61202
61233
  fileName,
@@ -61302,7 +61333,7 @@ var serverAvailable = null;
61302
61333
  var serverCheckUrl = null;
61303
61334
  var SERVER_RUNNING_KEY = Symbol.for("oh-my-opencode:server-running-in-process");
61304
61335
  function delay(milliseconds) {
61305
- return new Promise((resolve5) => setTimeout(resolve5, milliseconds));
61336
+ return new Promise((resolve6) => setTimeout(resolve6, milliseconds));
61306
61337
  }
61307
61338
  function markServerRunningInProcess() {
61308
61339
  globalThis[SERVER_RUNNING_KEY] = true;
@@ -61472,7 +61503,7 @@ async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPa
61472
61503
  // src/shared/tmux/tmux-utils/pane-close.ts
61473
61504
  var {spawn: spawn11 } = globalThis.Bun;
61474
61505
  function delay2(milliseconds) {
61475
- return new Promise((resolve5) => setTimeout(resolve5, milliseconds));
61506
+ return new Promise((resolve6) => setTimeout(resolve6, milliseconds));
61476
61507
  }
61477
61508
  async function closeTmuxPane(paneId) {
61478
61509
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
@@ -62296,7 +62327,7 @@ function parseGitDiffNumstat(output, statusMap) {
62296
62327
  }
62297
62328
  // src/shared/git-worktree/collect-git-diff-stats.ts
62298
62329
  import { execFileSync } from "child_process";
62299
- import { readFileSync as readFileSync9 } from "fs";
62330
+ import { readFileSync as readFileSync10 } from "fs";
62300
62331
  import { join as join16 } from "path";
62301
62332
  function collectGitDiffStats(directory) {
62302
62333
  try {
@@ -62321,7 +62352,7 @@ function collectGitDiffStats(directory) {
62321
62352
  const untrackedNumstat = untrackedOutput ? untrackedOutput.split(`
62322
62353
  `).filter(Boolean).map((filePath) => {
62323
62354
  try {
62324
- const content = readFileSync9(join16(directory, filePath), "utf-8");
62355
+ const content = readFileSync10(join16(directory, filePath), "utf-8");
62325
62356
  const lineCount = content.split(`
62326
62357
  `).length - (content.endsWith(`
62327
62358
  `) ? 1 : 0);
@@ -62427,9 +62458,9 @@ function getOpenCodeSkillDirs(options) {
62427
62458
  // src/shared/project-discovery-dirs.ts
62428
62459
  import { execFileSync as execFileSync2 } from "child_process";
62429
62460
  import { existsSync as existsSync15, realpathSync as realpathSync4 } from "fs";
62430
- import { dirname as dirname5, join as join18, resolve as resolve5 } from "path";
62461
+ import { dirname as dirname5, join as join18, resolve as resolve6 } from "path";
62431
62462
  function normalizePath(path6) {
62432
- const resolvedPath = resolve5(path6);
62463
+ const resolvedPath = resolve6(path6);
62433
62464
  if (!existsSync15(resolvedPath)) {
62434
62465
  return resolvedPath;
62435
62466
  }
@@ -62549,20 +62580,20 @@ init_logger();
62549
62580
 
62550
62581
  // src/features/claude-code-plugin-loader/discovery.ts
62551
62582
  init_logger();
62552
- import { existsSync as existsSync16, readFileSync as readFileSync10 } from "fs";
62553
- import { homedir as homedir7 } from "os";
62583
+ import { existsSync as existsSync16, readFileSync as readFileSync11 } from "fs";
62584
+ import { homedir as homedir8 } from "os";
62554
62585
  import { basename as basename3, join as join20 } from "path";
62555
62586
  import { fileURLToPath } from "url";
62556
62587
 
62557
62588
  // src/features/claude-code-plugin-loader/scope-filter.ts
62558
- import { homedir as homedir6 } from "os";
62589
+ import { homedir as homedir7 } from "os";
62559
62590
  import { join as join19 } from "path";
62560
62591
  function expandTilde(inputPath) {
62561
62592
  if (inputPath === "~") {
62562
- return homedir6();
62593
+ return homedir7();
62563
62594
  }
62564
62595
  if (inputPath.startsWith("~/") || inputPath.startsWith("~\\")) {
62565
- return join19(homedir6(), inputPath.slice(2));
62596
+ return join19(homedir7(), inputPath.slice(2));
62566
62597
  }
62567
62598
  return inputPath;
62568
62599
  }
@@ -62581,7 +62612,7 @@ function getPluginsBaseDir() {
62581
62612
  if (process.env.CLAUDE_PLUGINS_HOME) {
62582
62613
  return process.env.CLAUDE_PLUGINS_HOME;
62583
62614
  }
62584
- return join20(homedir7(), ".claude", "plugins");
62615
+ return join20(homedir8(), ".claude", "plugins");
62585
62616
  }
62586
62617
  function getInstalledPluginsPath(pluginsBaseDir) {
62587
62618
  return join20(pluginsBaseDir ?? getPluginsBaseDir(), "installed_plugins.json");
@@ -62592,7 +62623,7 @@ function loadInstalledPlugins(pluginsBaseDir) {
62592
62623
  return null;
62593
62624
  }
62594
62625
  try {
62595
- const content = readFileSync10(dbPath, "utf-8");
62626
+ const content = readFileSync11(dbPath, "utf-8");
62596
62627
  return JSON.parse(content);
62597
62628
  } catch (error) {
62598
62629
  log("Failed to load installed plugins database", error);
@@ -62603,7 +62634,7 @@ function getClaudeSettingsPath() {
62603
62634
  if (process.env.CLAUDE_SETTINGS_PATH) {
62604
62635
  return process.env.CLAUDE_SETTINGS_PATH;
62605
62636
  }
62606
- return join20(homedir7(), ".claude", "settings.json");
62637
+ return join20(homedir8(), ".claude", "settings.json");
62607
62638
  }
62608
62639
  function loadClaudeSettings() {
62609
62640
  const settingsPath = getClaudeSettingsPath();
@@ -62611,7 +62642,7 @@ function loadClaudeSettings() {
62611
62642
  return null;
62612
62643
  }
62613
62644
  try {
62614
- const content = readFileSync10(settingsPath, "utf-8");
62645
+ const content = readFileSync11(settingsPath, "utf-8");
62615
62646
  return JSON.parse(content);
62616
62647
  } catch (error) {
62617
62648
  log("Failed to load Claude settings", error);
@@ -62624,7 +62655,7 @@ function loadPluginManifest(installPath) {
62624
62655
  return null;
62625
62656
  }
62626
62657
  try {
62627
- const content = readFileSync10(manifestPath, "utf-8");
62658
+ const content = readFileSync11(manifestPath, "utf-8");
62628
62659
  return JSON.parse(content);
62629
62660
  } catch (error) {
62630
62661
  log(`Failed to load plugin manifest from ${manifestPath}`, error);
@@ -62764,7 +62795,7 @@ function discoverInstalledPlugins(options) {
62764
62795
  }
62765
62796
 
62766
62797
  // src/features/claude-code-plugin-loader/command-loader.ts
62767
- import { existsSync as existsSync17, readdirSync as readdirSync4, readFileSync as readFileSync11 } from "fs";
62798
+ import { existsSync as existsSync17, readdirSync as readdirSync4, readFileSync as readFileSync12 } from "fs";
62768
62799
  import { basename as basename4, join as join21 } from "path";
62769
62800
  init_logger();
62770
62801
  function loadPluginCommands(plugins) {
@@ -62780,7 +62811,7 @@ function loadPluginCommands(plugins) {
62780
62811
  const commandName = basename4(entry.name, ".md");
62781
62812
  const namespacedName = `${plugin.name}:${commandName}`;
62782
62813
  try {
62783
- const content = readFileSync11(commandPath, "utf-8");
62814
+ const content = readFileSync12(commandPath, "utf-8");
62784
62815
  const { data, body } = parseFrontmatter(content);
62785
62816
  const wrappedTemplate = `<command-instruction>
62786
62817
  ${body.trim()}
@@ -62811,11 +62842,11 @@ $ARGUMENTS
62811
62842
  }
62812
62843
 
62813
62844
  // src/features/claude-code-plugin-loader/skill-loader.ts
62814
- import { existsSync as existsSync18, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
62845
+ import { existsSync as existsSync18, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
62815
62846
  import { join as join22 } from "path";
62816
62847
 
62817
62848
  // src/shared/skill-path-resolver.ts
62818
- import { isAbsolute as isAbsolute4, relative as relative3, resolve as resolve6, sep as sep2 } from "path";
62849
+ import { isAbsolute as isAbsolute5, relative as relative3, resolve as resolve7, sep as sep2 } from "path";
62819
62850
  function looksLikeFilePath(path6) {
62820
62851
  if (path6.endsWith("/"))
62821
62852
  return true;
@@ -62827,9 +62858,9 @@ function resolveSkillPathReferences(content, basePath) {
62827
62858
  return content.replace(/(?<![a-zA-Z0-9="\(])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (match, relativePath) => {
62828
62859
  if (!looksLikeFilePath(relativePath))
62829
62860
  return match;
62830
- const resolvedPath = resolve6(normalizedBase, relativePath);
62861
+ const resolvedPath = resolve7(normalizedBase, relativePath);
62831
62862
  const relativePathFromBase = relative3(normalizedBase, resolvedPath);
62832
- if (relativePathFromBase.startsWith("..") || isAbsolute4(relativePathFromBase)) {
62863
+ if (relativePathFromBase.startsWith("..") || isAbsolute5(relativePathFromBase)) {
62833
62864
  return match;
62834
62865
  }
62835
62866
  if (relativePath.endsWith("/") && !resolvedPath.endsWith(sep2)) {
@@ -62858,7 +62889,7 @@ function loadPluginSkillsAsCommands(plugins) {
62858
62889
  if (!existsSync18(skillMdPath))
62859
62890
  continue;
62860
62891
  try {
62861
- const content = readFileSync12(skillMdPath, "utf-8");
62892
+ const content = readFileSync13(skillMdPath, "utf-8");
62862
62893
  const { data, body } = parseFrontmatter(content);
62863
62894
  const skillName = data.name || entry.name;
62864
62895
  const namespacedName = `${plugin.name}:${skillName}`;
@@ -62893,10 +62924,31 @@ $ARGUMENTS
62893
62924
  }
62894
62925
 
62895
62926
  // src/features/claude-code-plugin-loader/agent-loader.ts
62896
- import { existsSync as existsSync19, readdirSync as readdirSync6, readFileSync as readFileSync13 } from "fs";
62927
+ import { existsSync as existsSync19, readdirSync as readdirSync6, readFileSync as readFileSync14 } from "fs";
62897
62928
  import { basename as basename5, join as join23 } from "path";
62898
62929
  init_logger();
62899
62930
 
62931
+ // src/shared/parse-tools-config.ts
62932
+ function parseToolsConfig(toolsValue) {
62933
+ if (!toolsValue)
62934
+ return;
62935
+ let items;
62936
+ if (typeof toolsValue === "string") {
62937
+ items = toolsValue.split(",").map((t) => t.trim()).filter(Boolean);
62938
+ } else if (Array.isArray(toolsValue)) {
62939
+ items = toolsValue.filter((t) => typeof t === "string" && t.trim().length > 0).map((t) => t.trim());
62940
+ } else {
62941
+ return;
62942
+ }
62943
+ if (items.length === 0)
62944
+ return;
62945
+ const result = {};
62946
+ for (const tool of items) {
62947
+ result[tool.toLowerCase()] = true;
62948
+ }
62949
+ return result;
62950
+ }
62951
+
62900
62952
  // src/shared/model-format-normalizer.ts
62901
62953
  function normalizeModelFormat(model) {
62902
62954
  if (!model) {
@@ -62951,18 +63003,6 @@ function mapClaudeModelToOpenCode(model) {
62951
63003
  }
62952
63004
 
62953
63005
  // src/features/claude-code-plugin-loader/agent-loader.ts
62954
- function parseToolsConfig(toolsStr) {
62955
- if (!toolsStr)
62956
- return;
62957
- const tools = toolsStr.split(",").map((tool) => tool.trim()).filter(Boolean);
62958
- if (tools.length === 0)
62959
- return;
62960
- const result = {};
62961
- for (const tool of tools) {
62962
- result[tool.toLowerCase()] = true;
62963
- }
62964
- return result;
62965
- }
62966
63006
  function loadPluginAgents(plugins) {
62967
63007
  const agents = {};
62968
63008
  for (const plugin of plugins) {
@@ -62976,7 +63016,7 @@ function loadPluginAgents(plugins) {
62976
63016
  const agentName = basename5(entry.name, ".md");
62977
63017
  const namespacedName = `${plugin.name}:${agentName}`;
62978
63018
  try {
62979
- const content = readFileSync13(agentPath, "utf-8");
63019
+ const content = readFileSync14(agentPath, "utf-8");
62980
63020
  const { data, body } = parseFrontmatter(content);
62981
63021
  const originalDescription = data.description || "";
62982
63022
  const formattedDescription = `(plugin: ${plugin.name}) ${originalDescription}`;
@@ -63209,14 +63249,14 @@ async function loadPluginMcpServers(plugins) {
63209
63249
 
63210
63250
  // src/features/claude-code-plugin-loader/hook-loader.ts
63211
63251
  init_logger();
63212
- import { existsSync as existsSync21, readFileSync as readFileSync14 } from "fs";
63252
+ import { existsSync as existsSync21, readFileSync as readFileSync15 } from "fs";
63213
63253
  function loadPluginHooksConfigs(plugins) {
63214
63254
  const configs = [];
63215
63255
  for (const plugin of plugins) {
63216
63256
  if (!plugin.hooksPath || !existsSync21(plugin.hooksPath))
63217
63257
  continue;
63218
63258
  try {
63219
- const content = readFileSync14(plugin.hooksPath, "utf-8");
63259
+ const content = readFileSync15(plugin.hooksPath, "utf-8");
63220
63260
  let config = JSON.parse(content);
63221
63261
  config = resolvePluginPaths(config, plugin.installPath);
63222
63262
  configs.push(config);
@@ -63334,7 +63374,7 @@ var SessionCategoryRegistry = {
63334
63374
  init_plugin_identity();
63335
63375
 
63336
63376
  // src/shared/legacy-plugin-warning.ts
63337
- import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
63377
+ import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
63338
63378
  import { join as join24 } from "path";
63339
63379
  init_plugin_identity();
63340
63380
  function getOpenCodeConfigPath(overrideConfigDir) {
@@ -63366,7 +63406,7 @@ function checkForLegacyPluginEntry(overrideConfigDir) {
63366
63406
  return { hasLegacyEntry: false, hasCanonicalEntry: false, legacyEntries: [], configPath: null };
63367
63407
  }
63368
63408
  try {
63369
- const content = readFileSync15(configPath, "utf-8");
63409
+ const content = readFileSync16(configPath, "utf-8");
63370
63410
  const parseResult = parseJsoncSafe(content);
63371
63411
  if (!parseResult.data) {
63372
63412
  return { hasLegacyEntry: false, hasCanonicalEntry: false, legacyEntries: [], configPath };
@@ -63388,7 +63428,7 @@ function checkForLegacyPluginEntry(overrideConfigDir) {
63388
63428
  init_logger();
63389
63429
 
63390
63430
  // src/shared/migrate-legacy-plugin-entry.ts
63391
- import { closeSync as closeSync2, existsSync as existsSync23, fsyncSync as fsyncSync2, openSync as openSync2, readFileSync as readFileSync16, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "fs";
63431
+ import { closeSync as closeSync2, existsSync as existsSync23, fsyncSync as fsyncSync2, openSync as openSync2, readFileSync as readFileSync17, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "fs";
63392
63432
  init_logger();
63393
63433
  init_plugin_identity();
63394
63434
 
@@ -63436,7 +63476,7 @@ function migrateLegacyPluginEntry(configPath) {
63436
63476
  if (!existsSync23(configPath))
63437
63477
  return false;
63438
63478
  try {
63439
- const content = readFileSync16(configPath, "utf-8");
63479
+ const content = readFileSync17(configPath, "utf-8");
63440
63480
  if (!content.includes(LEGACY_PLUGIN_NAME))
63441
63481
  return false;
63442
63482
  const parseResult = parseJsoncSafe(content);
@@ -63530,7 +63570,7 @@ var FAILURE_RESET_WINDOW_MS = 5 * 60 * 1000;
63530
63570
  // src/features/run-continuation-state/constants.ts
63531
63571
  var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
63532
63572
  // src/features/run-continuation-state/storage.ts
63533
- import { existsSync as existsSync24, mkdirSync as mkdirSync6, readFileSync as readFileSync17, rmSync, writeFileSync as writeFileSync5 } from "fs";
63573
+ import { existsSync as existsSync24, mkdirSync as mkdirSync6, readFileSync as readFileSync18, rmSync, writeFileSync as writeFileSync5 } from "fs";
63534
63574
  import { join as join25 } from "path";
63535
63575
  function getMarkerPath(directory, sessionID) {
63536
63576
  return join25(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
@@ -63540,7 +63580,7 @@ function readContinuationMarker(directory, sessionID) {
63540
63580
  if (!existsSync24(markerPath))
63541
63581
  return null;
63542
63582
  try {
63543
- const raw = readFileSync17(markerPath, "utf-8");
63583
+ const raw = readFileSync18(markerPath, "utf-8");
63544
63584
  const parsed = JSON.parse(raw);
63545
63585
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
63546
63586
  return null;
@@ -63649,7 +63689,17 @@ function resolveRegisteredAgentName(name) {
63649
63689
  return;
63650
63690
  }
63651
63691
  const normalizedName = normalizeRegisteredAgentName(name);
63652
- return registeredAgentAliases.get(normalizedName) ?? normalizeStoredAgentName(name);
63692
+ const directMatch = registeredAgentAliases.get(normalizedName);
63693
+ if (directMatch !== undefined)
63694
+ return directMatch;
63695
+ const configKey = getAgentConfigKey(name);
63696
+ const normalizedConfigKey = normalizeRegisteredAgentName(configKey);
63697
+ if (normalizedConfigKey !== normalizedName) {
63698
+ const aliasMatch = registeredAgentAliases.get(normalizedConfigKey);
63699
+ if (aliasMatch !== undefined)
63700
+ return aliasMatch;
63701
+ }
63702
+ return normalizeStoredAgentName(name);
63653
63703
  }
63654
63704
  var sessionAgentMap = new Map;
63655
63705
  function setSessionAgent(sessionID, agent) {
@@ -65426,7 +65476,7 @@ function generatePartId() {
65426
65476
  return `prt_${timestamp2}${random}`;
65427
65477
  }
65428
65478
  // src/hooks/session-recovery/storage/messages-reader.ts
65429
- import { existsSync as existsSync25, readdirSync as readdirSync7, readFileSync as readFileSync18 } from "fs";
65479
+ import { existsSync as existsSync25, readdirSync as readdirSync7, readFileSync as readFileSync19 } from "fs";
65430
65480
  import { join as join26 } from "path";
65431
65481
  function readMessages(sessionID) {
65432
65482
  if (isSqliteBackend())
@@ -65439,7 +65489,7 @@ function readMessages(sessionID) {
65439
65489
  if (!file.endsWith(".json"))
65440
65490
  continue;
65441
65491
  try {
65442
- const content = readFileSync18(join26(messageDir, file), "utf-8");
65492
+ const content = readFileSync19(join26(messageDir, file), "utf-8");
65443
65493
  messages.push(JSON.parse(content));
65444
65494
  } catch {
65445
65495
  continue;
@@ -65454,7 +65504,7 @@ function readMessages(sessionID) {
65454
65504
  });
65455
65505
  }
65456
65506
  // src/hooks/session-recovery/storage/parts-reader.ts
65457
- import { existsSync as existsSync26, readdirSync as readdirSync8, readFileSync as readFileSync19 } from "fs";
65507
+ import { existsSync as existsSync26, readdirSync as readdirSync8, readFileSync as readFileSync20 } from "fs";
65458
65508
  import { join as join27 } from "path";
65459
65509
 
65460
65510
  // src/hooks/session-recovery/constants.ts
@@ -65474,7 +65524,7 @@ function readParts(messageID) {
65474
65524
  if (!file.endsWith(".json"))
65475
65525
  continue;
65476
65526
  try {
65477
- const content = readFileSync19(join27(partDir, file), "utf-8");
65527
+ const content = readFileSync20(join27(partDir, file), "utf-8");
65478
65528
  parts.push(JSON.parse(content));
65479
65529
  } catch {
65480
65530
  continue;
@@ -65583,7 +65633,7 @@ function findEmptyMessageByIndex(sessionID, targetIndex) {
65583
65633
  return null;
65584
65634
  }
65585
65635
  // src/hooks/session-recovery/storage/empty-text.ts
65586
- import { existsSync as existsSync28, readdirSync as readdirSync9, readFileSync as readFileSync20, writeFileSync as writeFileSync7 } from "fs";
65636
+ import { existsSync as existsSync28, readdirSync as readdirSync9, readFileSync as readFileSync21, writeFileSync as writeFileSync7 } from "fs";
65587
65637
  import { join as join29 } from "path";
65588
65638
  function replaceEmptyTextParts(messageID, replacementText) {
65589
65639
  if (isSqliteBackend()) {
@@ -65599,7 +65649,7 @@ function replaceEmptyTextParts(messageID, replacementText) {
65599
65649
  continue;
65600
65650
  try {
65601
65651
  const filePath = join29(partDir, file);
65602
- const content = readFileSync20(filePath, "utf-8");
65652
+ const content = readFileSync21(filePath, "utf-8");
65603
65653
  const part = JSON.parse(content);
65604
65654
  if (part.type === "text") {
65605
65655
  const textPart = part;
@@ -65860,7 +65910,7 @@ async function prependThinkingPartAsync(client, sessionID, messageID, deps = thi
65860
65910
  }
65861
65911
  }
65862
65912
  // src/hooks/session-recovery/storage/thinking-strip.ts
65863
- import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync21, unlinkSync as unlinkSync3 } from "fs";
65913
+ import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync22, unlinkSync as unlinkSync3 } from "fs";
65864
65914
  import { join as join31 } from "path";
65865
65915
  function stripThinkingParts(messageID) {
65866
65916
  if (isSqliteBackend()) {
@@ -65876,7 +65926,7 @@ function stripThinkingParts(messageID) {
65876
65926
  continue;
65877
65927
  try {
65878
65928
  const filePath = join31(partDir, file);
65879
- const content = readFileSync21(filePath, "utf-8");
65929
+ const content = readFileSync22(filePath, "utf-8");
65880
65930
  const part = JSON.parse(content);
65881
65931
  if (THINKING_TYPES.has(part.type)) {
65882
65932
  unlinkSync3(filePath);
@@ -79894,7 +79944,7 @@ import { tmpdir as tmpdir4 } from "os";
79894
79944
  // src/hooks/comment-checker/downloader.ts
79895
79945
  import { existsSync as existsSync31, appendFileSync as appendFileSync2 } from "fs";
79896
79946
  import { join as join32 } from "path";
79897
- import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
79947
+ import { homedir as homedir9, tmpdir as tmpdir3 } from "os";
79898
79948
  import { createRequire } from "module";
79899
79949
  init_logger();
79900
79950
  init_plugin_identity();
@@ -79918,11 +79968,11 @@ var PLATFORM_MAP = {
79918
79968
  function getCacheDir2() {
79919
79969
  if (process.platform === "win32") {
79920
79970
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
79921
- const base2 = localAppData || join32(homedir8(), "AppData", "Local");
79971
+ const base2 = localAppData || join32(homedir9(), "AppData", "Local");
79922
79972
  return join32(base2, CACHE_DIR_NAME, "bin");
79923
79973
  }
79924
79974
  const xdgCache = process.env.XDG_CACHE_HOME;
79925
- const base = xdgCache || join32(homedir8(), ".cache");
79975
+ const base = xdgCache || join32(homedir9(), ".cache");
79926
79976
  return join32(base, CACHE_DIR_NAME, "bin");
79927
79977
  }
79928
79978
  function getBinaryName() {
@@ -80096,7 +80146,7 @@ async function runCommentChecker(input, cliPath, customPrompt) {
80096
80146
  stderr: "pipe"
80097
80147
  });
80098
80148
  let timeoutId = null;
80099
- const timeoutPromise = new Promise((resolve7) => {
80149
+ const timeoutPromise = new Promise((resolve8) => {
80100
80150
  timeoutId = setTimeout(async () => {
80101
80151
  didTimeout = true;
80102
80152
  debugLog2("comment-checker timed out after 30s; sending SIGTERM");
@@ -80115,7 +80165,7 @@ async function runCommentChecker(input, cliPath, customPrompt) {
80115
80165
  await proc.exited;
80116
80166
  } catch {}
80117
80167
  clearTimeout(graceTimer);
80118
- resolve7("timeout");
80168
+ resolve8("timeout");
80119
80169
  }, 30000);
80120
80170
  });
80121
80171
  try {
@@ -80448,12 +80498,12 @@ function createToolOutputTruncatorHook(ctx, options) {
80448
80498
  };
80449
80499
  }
80450
80500
  // src/hooks/directory-agents-injector/injector.ts
80451
- import { readFileSync as readFileSync23 } from "fs";
80501
+ import { readFileSync as readFileSync24 } from "fs";
80452
80502
  import { dirname as dirname8 } from "path";
80453
80503
 
80454
80504
  // src/hooks/directory-agents-injector/finder.ts
80455
80505
  import { existsSync as existsSync34 } from "fs";
80456
- import { dirname as dirname7, isAbsolute as isAbsolute5, join as join36, resolve as resolve7 } from "path";
80506
+ import { dirname as dirname7, isAbsolute as isAbsolute6, join as join36, resolve as resolve8 } from "path";
80457
80507
 
80458
80508
  // src/hooks/directory-agents-injector/constants.ts
80459
80509
  import { join as join35 } from "path";
@@ -80464,9 +80514,9 @@ var AGENTS_FILENAME = "AGENTS.md";
80464
80514
  function resolveFilePath2(rootDirectory, path6) {
80465
80515
  if (!path6)
80466
80516
  return null;
80467
- if (isAbsolute5(path6))
80517
+ if (isAbsolute6(path6))
80468
80518
  return path6;
80469
- return resolve7(rootDirectory, path6);
80519
+ return resolve8(rootDirectory, path6);
80470
80520
  }
80471
80521
  function findAgentsMdUp(input) {
80472
80522
  const found = [];
@@ -80495,7 +80545,7 @@ function findAgentsMdUp(input) {
80495
80545
  import {
80496
80546
  existsSync as existsSync35,
80497
80547
  mkdirSync as mkdirSync9,
80498
- readFileSync as readFileSync22,
80548
+ readFileSync as readFileSync23,
80499
80549
  unlinkSync as unlinkSync4,
80500
80550
  writeFileSync as writeFileSync9
80501
80551
  } from "fs";
@@ -80507,7 +80557,7 @@ function createInjectedPathsStorage(storageDir) {
80507
80557
  if (!existsSync35(filePath))
80508
80558
  return new Set;
80509
80559
  try {
80510
- const content = readFileSync22(filePath, "utf-8");
80560
+ const content = readFileSync23(filePath, "utf-8");
80511
80561
  const data = JSON.parse(content);
80512
80562
  return new Set(data.injectedPaths);
80513
80563
  } catch {
@@ -80565,7 +80615,7 @@ async function processFilePathForAgentsInjection(input) {
80565
80615
  if (cache.has(agentsDir))
80566
80616
  continue;
80567
80617
  try {
80568
- const content = readFileSync23(agentsPath, "utf-8");
80618
+ const content = readFileSync24(agentsPath, "utf-8");
80569
80619
  const { result, truncated } = await input.truncator.truncate(input.sessionID, content);
80570
80620
  const truncationNotice = truncated ? `
80571
80621
 
@@ -80624,12 +80674,12 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
80624
80674
  };
80625
80675
  }
80626
80676
  // src/hooks/directory-readme-injector/injector.ts
80627
- import { readFileSync as readFileSync24 } from "fs";
80677
+ import { readFileSync as readFileSync25 } from "fs";
80628
80678
  import { dirname as dirname10 } from "path";
80629
80679
 
80630
80680
  // src/hooks/directory-readme-injector/finder.ts
80631
80681
  import { existsSync as existsSync36 } from "fs";
80632
- import { dirname as dirname9, isAbsolute as isAbsolute6, join as join39, resolve as resolve8 } from "path";
80682
+ import { dirname as dirname9, isAbsolute as isAbsolute7, join as join39, resolve as resolve9 } from "path";
80633
80683
 
80634
80684
  // src/hooks/directory-readme-injector/constants.ts
80635
80685
  import { join as join38 } from "path";
@@ -80640,9 +80690,9 @@ var README_FILENAME = "README.md";
80640
80690
  function resolveFilePath3(rootDirectory, path6) {
80641
80691
  if (!path6)
80642
80692
  return null;
80643
- if (isAbsolute6(path6))
80693
+ if (isAbsolute7(path6))
80644
80694
  return path6;
80645
- return resolve8(rootDirectory, path6);
80695
+ return resolve9(rootDirectory, path6);
80646
80696
  }
80647
80697
  function findReadmeMdUp(input) {
80648
80698
  const found = [];
@@ -80691,7 +80741,7 @@ async function processFilePathForReadmeInjection(input) {
80691
80741
  if (cache.has(readmeDir))
80692
80742
  continue;
80693
80743
  try {
80694
- const content = readFileSync24(readmePath, "utf-8");
80744
+ const content = readFileSync25(readmePath, "utf-8");
80695
80745
  const { result, truncated } = await input.truncator.truncate(input.sessionID, content);
80696
80746
  const truncationNotice = truncated ? `
80697
80747
 
@@ -81023,7 +81073,7 @@ function incrementEmptyContentAttempt(autoCompactState, sessionID) {
81023
81073
  }
81024
81074
 
81025
81075
  // src/hooks/anthropic-context-window-limit-recovery/tool-result-storage.ts
81026
- import { existsSync as existsSync38, readdirSync as readdirSync12, readFileSync as readFileSync25, writeFileSync as writeFileSync10 } from "fs";
81076
+ import { existsSync as existsSync38, readdirSync as readdirSync12, readFileSync as readFileSync26, writeFileSync as writeFileSync10 } from "fs";
81027
81077
  import { join as join40 } from "path";
81028
81078
 
81029
81079
  // src/hooks/anthropic-context-window-limit-recovery/message-storage-directory.ts
@@ -81060,7 +81110,7 @@ function findToolResultsBySize(sessionID) {
81060
81110
  continue;
81061
81111
  try {
81062
81112
  const partPath = join40(partDir, file2);
81063
- const content = readFileSync25(partPath, "utf-8");
81113
+ const content = readFileSync26(partPath, "utf-8");
81064
81114
  const part = JSON.parse(content);
81065
81115
  if (part.type === "tool" && part.state?.output && !part.truncated) {
81066
81116
  results.push({
@@ -81087,7 +81137,7 @@ function truncateToolResult(partPath) {
81087
81137
  return { success: false };
81088
81138
  }
81089
81139
  try {
81090
- const content = readFileSync25(partPath, "utf-8");
81140
+ const content = readFileSync26(partPath, "utf-8");
81091
81141
  const part = JSON.parse(content);
81092
81142
  if (!part.state?.output) {
81093
81143
  return { success: false };
@@ -81889,7 +81939,7 @@ async function executeCompact(sessionID, msg, autoCompactState, client, director
81889
81939
  }
81890
81940
 
81891
81941
  // src/hooks/anthropic-context-window-limit-recovery/pruning-deduplication.ts
81892
- import { readdirSync as readdirSync13, readFileSync as readFileSync26 } from "fs";
81942
+ import { readdirSync as readdirSync13, readFileSync as readFileSync27 } from "fs";
81893
81943
  import { join as join41 } from "path";
81894
81944
 
81895
81945
  // src/hooks/anthropic-context-window-limit-recovery/pruning-types.ts
@@ -81926,7 +81976,7 @@ function readMessages2(sessionID) {
81926
81976
  try {
81927
81977
  const files = readdirSync13(messageDir).filter((f) => f.endsWith(".json"));
81928
81978
  for (const file2 of files) {
81929
- const content = readFileSync26(join41(messageDir, file2), "utf-8");
81979
+ const content = readFileSync27(join41(messageDir, file2), "utf-8");
81930
81980
  const data = JSON.parse(content);
81931
81981
  if (data.parts) {
81932
81982
  messages.push(data);
@@ -82031,7 +82081,7 @@ function findToolOutput(messages, callID) {
82031
82081
  }
82032
82082
 
82033
82083
  // src/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.ts
82034
- import { existsSync as existsSync39, readdirSync as readdirSync14, readFileSync as readFileSync27 } from "fs";
82084
+ import { existsSync as existsSync39, readdirSync as readdirSync14, readFileSync as readFileSync28 } from "fs";
82035
82085
  import { join as join42 } from "path";
82036
82086
  init_logger();
82037
82087
  function getPartStorage() {
@@ -82068,7 +82118,7 @@ async function truncateToolOutputsByCallId(sessionID, callIds, client) {
82068
82118
  continue;
82069
82119
  const partPath = join42(partDir, file2);
82070
82120
  try {
82071
- const content = readFileSync27(partPath, "utf-8");
82121
+ const content = readFileSync28(partPath, "utf-8");
82072
82122
  const part = JSON.parse(content);
82073
82123
  if (part.type !== "tool" || !part.callID)
82074
82124
  continue;
@@ -84299,7 +84349,7 @@ function getRuleInjectionFilePath(output) {
84299
84349
  import {
84300
84350
  existsSync as existsSync43,
84301
84351
  mkdirSync as mkdirSync11,
84302
- readFileSync as readFileSync28,
84352
+ readFileSync as readFileSync29,
84303
84353
  writeFileSync as writeFileSync12,
84304
84354
  unlinkSync as unlinkSync6
84305
84355
  } from "fs";
@@ -84339,7 +84389,7 @@ function loadInjectedRules(sessionID) {
84339
84389
  if (!existsSync43(filePath))
84340
84390
  return { contentHashes: new Set, realPaths: new Set };
84341
84391
  try {
84342
- const content = readFileSync28(filePath, "utf-8");
84392
+ const content = readFileSync29(filePath, "utf-8");
84343
84393
  const data = JSON.parse(content);
84344
84394
  return {
84345
84395
  contentHashes: new Set(data.injectedHashes),
@@ -84385,9 +84435,9 @@ function createSessionCacheStore() {
84385
84435
  }
84386
84436
 
84387
84437
  // src/hooks/rules-injector/injector.ts
84388
- import { readFileSync as readFileSync29, statSync as statSync4 } from "fs";
84389
- import { homedir as homedir9 } from "os";
84390
- import { relative as relative5, resolve as resolve9 } from "path";
84438
+ import { readFileSync as readFileSync30, statSync as statSync4 } from "fs";
84439
+ import { homedir as homedir10 } from "os";
84440
+ import { relative as relative5, resolve as resolve10 } from "path";
84391
84441
 
84392
84442
  // src/hooks/rules-injector/project-root-finder.ts
84393
84443
  import { existsSync as existsSync44, statSync as statSync2 } from "fs";
@@ -84708,7 +84758,7 @@ function resolveFilePath4(workspaceDirectory, path6) {
84708
84758
  return null;
84709
84759
  if (path6.startsWith("/"))
84710
84760
  return path6;
84711
- return resolve9(workspaceDirectory, path6);
84761
+ return resolve10(workspaceDirectory, path6);
84712
84762
  }
84713
84763
  function createRuleInjectionProcessor(deps) {
84714
84764
  const {
@@ -84716,9 +84766,9 @@ function createRuleInjectionProcessor(deps) {
84716
84766
  truncator,
84717
84767
  getSessionCache: getSessionCache3,
84718
84768
  ruleFinderOptions,
84719
- readFileSync: readRuleFileSync = readFileSync29,
84769
+ readFileSync: readRuleFileSync = readFileSync30,
84720
84770
  statSync: statRuleSync = statSync4,
84721
- homedir: getHomeDir = homedir9,
84771
+ homedir: getHomeDir = homedir10,
84722
84772
  shouldApplyRule: shouldApplyRuleImpl = shouldApplyRule,
84723
84773
  isDuplicateByRealPath: isDuplicateByRealPathImpl = isDuplicateByRealPath,
84724
84774
  createContentHash: createContentHashImpl = createContentHash,
@@ -85227,7 +85277,7 @@ import { join as join59 } from "path";
85227
85277
  // src/shared/migrate-legacy-config-file.ts
85228
85278
  init_logger();
85229
85279
  init_plugin_identity();
85230
- import { existsSync as existsSync52, readFileSync as readFileSync36, renameSync as renameSync4, rmSync as rmSync2 } from "fs";
85280
+ import { existsSync as existsSync52, readFileSync as readFileSync37, renameSync as renameSync4, rmSync as rmSync2 } from "fs";
85231
85281
  import { join as join56, dirname as dirname16, basename as basename6 } from "path";
85232
85282
  function buildCanonicalPath(legacyPath) {
85233
85283
  const dir = dirname16(legacyPath);
@@ -85272,7 +85322,7 @@ function migrateLegacyConfigFile(legacyPath) {
85272
85322
  if (existsSync52(canonicalPath))
85273
85323
  return false;
85274
85324
  try {
85275
- const content = readFileSync36(legacyPath, "utf-8");
85325
+ const content = readFileSync37(legacyPath, "utf-8");
85276
85326
  writeFileAtomically(canonicalPath, content);
85277
85327
  const archivedLegacyConfig = archiveLegacyConfigFile(legacyPath);
85278
85328
  log("[migrateLegacyConfigFile] Migrated legacy config to canonical path", {
@@ -85302,8 +85352,8 @@ function toReadableStream(stream) {
85302
85352
  function wrapNodeProcess(proc) {
85303
85353
  let resolveExited;
85304
85354
  let exitCode = null;
85305
- const exited = new Promise((resolve10) => {
85306
- resolveExited = resolve10;
85355
+ const exited = new Promise((resolve11) => {
85356
+ resolveExited = resolve11;
85307
85357
  });
85308
85358
  proc.on("exit", (code) => {
85309
85359
  exitCode = code ?? 1;
@@ -85394,8 +85444,8 @@ async function runBunInstallWithDetails(options) {
85394
85444
  });
85395
85445
  const outputPromise = Promise.all([readProcessOutput(proc.stdout), readProcessOutput(proc.stderr)]).then(([stdout, stderr]) => ({ stdout, stderr }));
85396
85446
  let timeoutId;
85397
- const timeoutPromise = new Promise((resolve10) => {
85398
- timeoutId = setTimeout(() => resolve10("timeout"), BUN_INSTALL_TIMEOUT_MS);
85447
+ const timeoutPromise = new Promise((resolve11) => {
85448
+ timeoutId = setTimeout(() => resolve11("timeout"), BUN_INSTALL_TIMEOUT_MS);
85399
85449
  });
85400
85450
  const exitPromise = proc.exited.then(() => "completed");
85401
85451
  const result = await Promise.race([exitPromise, timeoutPromise]);
@@ -85790,7 +85840,7 @@ async function showSpinnerToast(ctx, version2, message) {
85790
85840
  duration: frameInterval + 50
85791
85841
  }
85792
85842
  }).catch(() => {});
85793
- await new Promise((resolve10) => setTimeout(resolve10, frameInterval));
85843
+ await new Promise((resolve11) => setTimeout(resolve11, frameInterval));
85794
85844
  }
85795
85845
  }
85796
85846
 
@@ -85878,7 +85928,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
85878
85928
  import {
85879
85929
  existsSync as existsSync56,
85880
85930
  mkdirSync as mkdirSync13,
85881
- readFileSync as readFileSync38,
85931
+ readFileSync as readFileSync39,
85882
85932
  writeFileSync as writeFileSync15,
85883
85933
  unlinkSync as unlinkSync9
85884
85934
  } from "fs";
@@ -85939,7 +85989,7 @@ function loadAgentUsageState(sessionID) {
85939
85989
  if (!existsSync56(filePath))
85940
85990
  return null;
85941
85991
  try {
85942
- const content = readFileSync38(filePath, "utf-8");
85992
+ const content = readFileSync39(filePath, "utf-8");
85943
85993
  return JSON.parse(content);
85944
85994
  } catch {
85945
85995
  return null;
@@ -86212,7 +86262,7 @@ Each TODO item MUST include:
86212
86262
 
86213
86263
  | Wave | Tasks | Dispatch Command |
86214
86264
  |------|-------|------------------|
86215
- | 1 | 1, 4 | \`task(category="...", load_skills=[...], run_in_background=false)\` \xD7 2 |
86265
+ | 1 | 1, 4 | \`task(category="...", load_skills=[...], run_in_background=true)\` \xD7 2 |
86216
86266
  | 2 | 2, 3, 5 | \`task(...)\` \xD7 3 after Wave 1 completes |
86217
86267
  | 3 | 6 | \`task(...)\` final integration |
86218
86268
 
@@ -86296,9 +86346,9 @@ Use these when they provide clear value based on the decision framework above:
86296
86346
  |----------|-------------|------------|
86297
86347
  | explore agent | Need codebase patterns you don't have | \`task(subagent_type="explore", load_skills=[], run_in_background=true, ...)\` |
86298
86348
  | librarian agent | External library docs, OSS examples | \`task(subagent_type="librarian", load_skills=[], run_in_background=true, ...)\` |
86299
- | oracle agent | Stuck on architecture/debugging after 2+ attempts | \`task(subagent_type="oracle", load_skills=[], ...)\` |
86300
- | plan agent | Complex multi-step with dependencies (5+ steps) | \`task(subagent_type="plan", load_skills=[], ...)\` |
86301
- | task category | Specialized work matching a category | \`task(category="...", load_skills=[...])\` |
86349
+ | oracle agent | Stuck on architecture/debugging after 2+ attempts | \`task(subagent_type="oracle", load_skills=[], run_in_background=false, ...)\` |
86350
+ | plan agent | Complex multi-step with dependencies (5+ steps) | \`task(subagent_type="plan", load_skills=[], run_in_background=false, ...)\` |
86351
+ | task category | Specialized work matching a category | \`task(category="...", load_skills=[...], run_in_background=true)\` |
86302
86352
 
86303
86353
  <tool_usage_rules>
86304
86354
  - Prefer tools over internal knowledge for fresh or user-specific data
@@ -86538,7 +86588,7 @@ TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
86538
86588
  | Architecture decision needed | MUST call plan agent |
86539
86589
 
86540
86590
  \`\`\`
86541
- task(subagent_type="plan", load_skills=[], prompt="<gathered context + user request>")
86591
+ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="<gathered context + user request>")
86542
86592
  \`\`\`
86543
86593
 
86544
86594
  ### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)
@@ -86547,9 +86597,9 @@ task(subagent_type="plan", load_skills=[], prompt="<gathered context + user requ
86547
86597
 
86548
86598
  | Scenario | Action |
86549
86599
  |----------|--------|
86550
- | Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], prompt="<your answer>")\` |
86551
- | Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], prompt="Please adjust: <feedback>")\` |
86552
- | Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], prompt="Add more detail to Task N")\` |
86600
+ | Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
86601
+ | Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
86602
+ | Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
86553
86603
 
86554
86604
  **FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**
86555
86605
 
@@ -86565,10 +86615,10 @@ task(subagent_type="plan", load_skills=[], prompt="<gathered context + user requ
86565
86615
  |-----------|--------|-----|
86566
86616
  | Codebase exploration | task(subagent_type="explore", load_skills=[], run_in_background=true) | Parallel, context-efficient |
86567
86617
  | Documentation lookup | task(subagent_type="librarian", load_skills=[], run_in_background=true) | Specialized knowledge |
86568
- | Planning | task(subagent_type="plan", load_skills=[]) | Parallel task graph + structured TODO list |
86569
- | Hard problem (conventional) | task(subagent_type="oracle", load_skills=[]) | Architecture, debugging, complex logic |
86570
- | Hard problem (non-conventional) | task(category="artistry", load_skills=[...]) | Different approach needed |
86571
- | Implementation | task(category="...", load_skills=[...]) | Domain-optimized models |
86618
+ | Planning | task(subagent_type="plan", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |
86619
+ | Hard problem (conventional) | task(subagent_type="oracle", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |
86620
+ | Hard problem (non-conventional) | task(category="artistry", load_skills=[...], run_in_background=true) | Different approach needed |
86621
+ | Implementation | task(category="...", load_skills=[...], run_in_background=true) | Domain-optimized models |
86572
86622
 
86573
86623
  **YOU SHOULD ONLY DO IT YOURSELF WHEN:**
86574
86624
  - Task is trivially simple (1-2 lines, obvious change)
@@ -86767,7 +86817,7 @@ TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
86767
86817
  | Architecture decision needed | MUST call plan agent |
86768
86818
 
86769
86819
  \`\`\`
86770
- task(subagent_type="plan", load_skills=[], prompt="<gathered context + user request>")
86820
+ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="<gathered context + user request>")
86771
86821
  \`\`\`
86772
86822
 
86773
86823
  **WHY PLAN AGENT IS MANDATORY:**
@@ -86782,9 +86832,9 @@ task(subagent_type="plan", load_skills=[], prompt="<gathered context + user requ
86782
86832
 
86783
86833
  | Scenario | Action |
86784
86834
  |----------|--------|
86785
- | Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], prompt="<your answer>")\` |
86786
- | Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], prompt="Please adjust: <feedback>")\` |
86787
- | Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], prompt="Add more detail to Task N")\` |
86835
+ | Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="<your answer>")\` |
86836
+ | Need to refine the plan | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Please adjust: <feedback>")\` |
86837
+ | Plan needs more detail | \`task(session_id="{returned_session_id}", load_skills=[], run_in_background=false, prompt="Add more detail to Task N")\` |
86788
86838
 
86789
86839
  **WHY SESSION_ID IS CRITICAL:**
86790
86840
  - Plan agent retains FULL conversation context
@@ -86794,10 +86844,10 @@ task(subagent_type="plan", load_skills=[], prompt="<gathered context + user requ
86794
86844
 
86795
86845
  \`\`\`
86796
86846
  // WRONG: Starting fresh loses all context
86797
- task(subagent_type="plan", load_skills=[], prompt="Here's more info...")
86847
+ task(subagent_type="plan", load_skills=[], run_in_background=false, prompt="Here's more info...")
86798
86848
 
86799
86849
  // CORRECT: Resume preserves everything
86800
- task(session_id="ses_abc123", load_skills=[], prompt="Here's my answer to your question: ...")
86850
+ task(session_id="ses_abc123", load_skills=[], run_in_background=false, prompt="Here's my answer to your question: ...")
86801
86851
  \`\`\`
86802
86852
 
86803
86853
  **FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**
@@ -86812,21 +86862,21 @@ task(session_id="ses_abc123", load_skills=[], prompt="Here's my answer to your q
86812
86862
  |-----------|--------|-----|
86813
86863
  | Codebase exploration | task(subagent_type="explore", load_skills=[], run_in_background=true) | Parallel, context-efficient |
86814
86864
  | Documentation lookup | task(subagent_type="librarian", load_skills=[], run_in_background=true) | Specialized knowledge |
86815
- | Planning | task(subagent_type="plan", load_skills=[]) | Parallel task graph + structured TODO list |
86816
- | Hard problem (conventional) | task(subagent_type="oracle", load_skills=[]) | Architecture, debugging, complex logic |
86817
- | Hard problem (non-conventional) | task(category="artistry", load_skills=[...]) | Different approach needed |
86818
- | Implementation | task(category="...", load_skills=[...]) | Domain-optimized models |
86865
+ | Planning | task(subagent_type="plan", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |
86866
+ | Hard problem (conventional) | task(subagent_type="oracle", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |
86867
+ | Hard problem (non-conventional) | task(category="artistry", load_skills=[...], run_in_background=true) | Different approach needed |
86868
+ | Implementation | task(category="...", load_skills=[...], run_in_background=true) | Domain-optimized models |
86819
86869
 
86820
86870
  **CATEGORY + SKILL DELEGATION:**
86821
86871
  \`\`\`
86822
86872
  // Frontend work
86823
- task(category="visual-engineering", load_skills=["frontend-ui-ux"])
86873
+ task(category="visual-engineering", load_skills=["frontend-ui-ux"], run_in_background=true)
86824
86874
 
86825
86875
  // Complex logic
86826
- task(category="ultrabrain", load_skills=["typescript-programmer"])
86876
+ task(category="ultrabrain", load_skills=["typescript-programmer"], run_in_background=true)
86827
86877
 
86828
86878
  // Quick fixes
86829
- task(category="quick", load_skills=["git-master"])
86879
+ task(category="quick", load_skills=["git-master"], run_in_background=true)
86830
86880
  \`\`\`
86831
86881
 
86832
86882
  **YOU SHOULD ONLY DO IT YOURSELF WHEN:**
@@ -87232,7 +87282,7 @@ function createNonInteractiveEnvHook(_ctx) {
87232
87282
  import {
87233
87283
  existsSync as existsSync57,
87234
87284
  mkdirSync as mkdirSync14,
87235
- readFileSync as readFileSync39,
87285
+ readFileSync as readFileSync40,
87236
87286
  writeFileSync as writeFileSync16,
87237
87287
  unlinkSync as unlinkSync10
87238
87288
  } from "fs";
@@ -87259,7 +87309,7 @@ function loadInteractiveBashSessionState(sessionID) {
87259
87309
  if (!existsSync57(filePath))
87260
87310
  return null;
87261
87311
  try {
87262
- const content = readFileSync39(filePath, "utf-8");
87312
+ const content = readFileSync40(filePath, "utf-8");
87263
87313
  const serialized = JSON.parse(content);
87264
87314
  return {
87265
87315
  sessionID: serialized.sessionID,
@@ -87794,7 +87844,7 @@ var ULTRAWORK_MAX_ITERATIONS = 500;
87794
87844
  var DEFAULT_COMPLETION_PROMISE = "DONE";
87795
87845
  var ULTRAWORK_VERIFICATION_PROMISE = "VERIFIED";
87796
87846
  // src/hooks/ralph-loop/storage.ts
87797
- import { existsSync as existsSync58, readFileSync as readFileSync40, writeFileSync as writeFileSync17, unlinkSync as unlinkSync11, mkdirSync as mkdirSync15 } from "fs";
87847
+ import { existsSync as existsSync58, readFileSync as readFileSync41, writeFileSync as writeFileSync17, unlinkSync as unlinkSync11, mkdirSync as mkdirSync15 } from "fs";
87798
87848
  import { dirname as dirname17, join as join64 } from "path";
87799
87849
  function getStateFilePath(directory, customPath) {
87800
87850
  return customPath ? join64(directory, customPath) : join64(directory, DEFAULT_STATE_FILE);
@@ -87805,7 +87855,7 @@ function readState(directory, customPath) {
87805
87855
  return null;
87806
87856
  }
87807
87857
  try {
87808
- const content = readFileSync40(filePath, "utf-8");
87858
+ const content = readFileSync41(filePath, "utf-8");
87809
87859
  const { data, body } = parseFrontmatter(content);
87810
87860
  const active = data.active;
87811
87861
  const iteration = data.iteration;
@@ -88224,9 +88274,10 @@ async function handleDetectedCompletion(ctx, input) {
88224
88274
 
88225
88275
  // src/hooks/ralph-loop/completion-promise-detector.ts
88226
88276
  init_logger();
88227
- import { existsSync as existsSync59, readFileSync as readFileSync41 } from "fs";
88277
+ import { existsSync as existsSync59, readFileSync as readFileSync42 } from "fs";
88228
88278
 
88229
88279
  // src/hooks/ralph-loop/oracle-verification-detector.ts
88280
+ init_agent_display_names();
88230
88281
  var AGENT_LINE_PATTERN = /^Agent:[ \t]*(\S+)$/im;
88231
88282
  var PROMISE_TAG_PATTERN = /<promise>[ \t]*(\S+?)[ \t]*<\/promise>/is;
88232
88283
  var TASK_METADATA_PATTERN = /<task_metadata>[ \t]*([\s\S]*?)[ \t]*<\/task_metadata>/is;
@@ -88268,13 +88319,13 @@ function isOracleVerified(text) {
88268
88319
  if (!evidence) {
88269
88320
  return false;
88270
88321
  }
88271
- const isOracleAgent = evidence.agent.toLowerCase() === "oracle";
88322
+ const isOracleAgent = stripInvisibleAgentCharacters(evidence.agent).toLowerCase() === "oracle";
88272
88323
  const isVerifiedPromise = evidence.promise === ULTRAWORK_VERIFICATION_PROMISE;
88273
88324
  return isOracleAgent && isVerifiedPromise;
88274
88325
  }
88275
88326
  function extractOracleSessionID(text) {
88276
88327
  const evidence = parseOracleVerificationEvidence(text);
88277
- if (!evidence || evidence.agent.toLowerCase() !== "oracle") {
88328
+ if (!evidence || stripInvisibleAgentCharacters(evidence.agent).toLowerCase() !== "oracle") {
88278
88329
  return;
88279
88330
  }
88280
88331
  return evidence.sessionID;
@@ -88320,7 +88371,7 @@ function detectCompletionInTranscript(transcriptPath, promise2, startedAt) {
88320
88371
  try {
88321
88372
  if (!existsSync59(transcriptPath))
88322
88373
  return false;
88323
- const content = readFileSync41(transcriptPath, "utf-8");
88374
+ const content = readFileSync42(transcriptPath, "utf-8");
88324
88375
  const pattern = buildPromisePattern(promise2);
88325
88376
  const lines = content.split(`
88326
88377
  `).filter((line) => line.trim());
@@ -89042,7 +89093,7 @@ function findSlashCommandPartIndex(parts) {
89042
89093
  import { dirname as dirname20 } from "path";
89043
89094
  // src/features/opencode-skill-loader/loader.ts
89044
89095
  import { join as join67 } from "path";
89045
- import { homedir as homedir12 } from "os";
89096
+ import { homedir as homedir13 } from "os";
89046
89097
 
89047
89098
  // src/features/opencode-skill-loader/skill-definition-record.ts
89048
89099
  function skillsToCommandDefinitionRecord(skills) {
@@ -89131,7 +89182,7 @@ async function loadSkillFromPath(options) {
89131
89182
  const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content);
89132
89183
  const mcpJsonMcp = await loadMcpJsonFromDir(options.resolvedPath);
89133
89184
  const mcpConfig = mcpJsonMcp || frontmatterMcp;
89134
- const baseName = data.name || options.defaultName;
89185
+ const baseName = String(data.name || options.defaultName);
89135
89186
  const skillName = namePrefix ? `${namePrefix}/${baseName}` : baseName;
89136
89187
  const originalDescription = data.description || "";
89137
89188
  const isOpencodeSource = options.scope === "opencode" || options.scope === "opencode-project";
@@ -89285,7 +89336,7 @@ async function loadProjectAgentsSkills(directory) {
89285
89336
  return skillsToCommandDefinitionRecord(deduplicateSkillsByName(allSkills.flat()));
89286
89337
  }
89287
89338
  async function loadGlobalAgentsSkills() {
89288
- const agentsGlobalDir = join67(homedir12(), ".agents", "skills");
89339
+ const agentsGlobalDir = join67(homedir13(), ".agents", "skills");
89289
89340
  const skills = await loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
89290
89341
  return skillsToCommandDefinitionRecord(skills);
89291
89342
  }
@@ -89356,7 +89407,7 @@ async function discoverProjectAgentsSkills(directory) {
89356
89407
  return deduplicateSkillsByName(allSkills.flat());
89357
89408
  }
89358
89409
  async function discoverGlobalAgentsSkills() {
89359
- const agentsGlobalDir = join67(homedir12(), ".agents", "skills");
89410
+ const agentsGlobalDir = join67(homedir13(), ".agents", "skills");
89360
89411
  return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
89361
89412
  }
89362
89413
  // src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
@@ -89383,9 +89434,9 @@ function builtinToLoadedSkill(builtin) {
89383
89434
  }
89384
89435
 
89385
89436
  // src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
89386
- import { existsSync as existsSync60, readFileSync as readFileSync42 } from "fs";
89387
- import { dirname as dirname18, isAbsolute as isAbsolute7, resolve as resolve10 } from "path";
89388
- import { homedir as homedir13 } from "os";
89437
+ import { existsSync as existsSync60, readFileSync as readFileSync43 } from "fs";
89438
+ import { dirname as dirname18, isAbsolute as isAbsolute8, resolve as resolve11 } from "path";
89439
+ import { homedir as homedir14 } from "os";
89389
89440
  init_logger();
89390
89441
  function resolveFilePath5(from, configDir) {
89391
89442
  let filePath = from;
@@ -89393,19 +89444,19 @@ function resolveFilePath5(from, configDir) {
89393
89444
  filePath = filePath.slice(6, -1);
89394
89445
  }
89395
89446
  if (filePath.startsWith("~/")) {
89396
- return resolve10(homedir13(), filePath.slice(2));
89447
+ return resolve11(homedir14(), filePath.slice(2));
89397
89448
  }
89398
- if (isAbsolute7(filePath)) {
89449
+ if (isAbsolute8(filePath)) {
89399
89450
  return filePath;
89400
89451
  }
89401
89452
  const baseDir = configDir || process.cwd();
89402
- return resolve10(baseDir, filePath);
89453
+ return resolve11(baseDir, filePath);
89403
89454
  }
89404
89455
  function loadSkillFromFile(filePath) {
89405
89456
  try {
89406
89457
  if (!existsSync60(filePath))
89407
89458
  return null;
89408
- const content = readFileSync42(filePath, "utf-8");
89459
+ const content = readFileSync43(filePath, "utf-8");
89409
89460
  const { data, body } = parseFrontmatter(content);
89410
89461
  return { template: body, metadata: data };
89411
89462
  } catch {
@@ -92459,13 +92510,13 @@ async function getAllSkills(options) {
92459
92510
  return allSkills;
92460
92511
  }
92461
92512
  // src/features/opencode-skill-loader/loaded-skill-template-extractor.ts
92462
- import { readFileSync as readFileSync43 } from "fs";
92513
+ import { readFileSync as readFileSync44 } from "fs";
92463
92514
  function extractSkillTemplate(skill) {
92464
92515
  if (skill.scope === "config" && skill.definition.template) {
92465
92516
  return skill.definition.template;
92466
92517
  }
92467
92518
  if (skill.path) {
92468
- const content = readFileSync43(skill.path, "utf-8");
92519
+ const content = readFileSync44(skill.path, "utf-8");
92469
92520
  const { body } = parseFrontmatter(content);
92470
92521
  return body.trim();
92471
92522
  }
@@ -92829,6 +92880,10 @@ var NotificationConfigSchema = exports_external.object({
92829
92880
  var McpNameSchema = exports_external.enum(["websearch", "context7", "grep_app"]);
92830
92881
  var AnyMcpNameSchema = exports_external.string().min(1);
92831
92882
 
92883
+ // src/config/schema/agent-definitions.ts
92884
+ var AgentDefinitionPathSchema = exports_external.string().min(1);
92885
+ var AgentDefinitionsConfigSchema = exports_external.array(AgentDefinitionPathSchema).optional();
92886
+
92832
92887
  // src/config/schema/openclaw.ts
92833
92888
  var OpenClawGatewaySchema = exports_external.object({
92834
92889
  type: exports_external.enum(["http", "command"]).default("http"),
@@ -92970,6 +93025,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
92970
93025
  $schema: exports_external.string().optional(),
92971
93026
  new_task_system_enabled: exports_external.boolean().optional(),
92972
93027
  default_run_agent: exports_external.string().optional(),
93028
+ agent_definitions: AgentDefinitionsConfigSchema,
92973
93029
  disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
92974
93030
  disabled_agents: exports_external.array(exports_external.string()).optional(),
92975
93031
  disabled_skills: exports_external.array(BuiltinSkillNameSchema).optional(),
@@ -93169,20 +93225,20 @@ async function resolveMultipleSkillsAsync(skillNames, options) {
93169
93225
  // src/features/opencode-skill-loader/config-source-discovery.ts
93170
93226
  var import_picomatch2 = __toESM(require_picomatch2(), 1);
93171
93227
  import { promises as fs18 } from "fs";
93172
- import { homedir as homedir14 } from "os";
93173
- import { dirname as dirname19, extname, isAbsolute as isAbsolute8, join as join68, relative as relative6 } from "path";
93228
+ import { homedir as homedir15 } from "os";
93229
+ import { dirname as dirname19, extname, isAbsolute as isAbsolute9, join as join68, relative as relative6 } from "path";
93174
93230
  var MAX_RECURSIVE_DEPTH = 10;
93175
93231
  function isHttpUrl(path12) {
93176
93232
  return path12.startsWith("http://") || path12.startsWith("https://");
93177
93233
  }
93178
93234
  function toAbsolutePath(path12, configDir) {
93179
93235
  if (path12 === "~") {
93180
- return homedir14();
93236
+ return homedir15();
93181
93237
  }
93182
93238
  if (path12.startsWith("~/")) {
93183
- return join68(homedir14(), path12.slice(2));
93239
+ return join68(homedir15(), path12.slice(2));
93184
93240
  }
93185
- if (isAbsolute8(path12)) {
93241
+ if (isAbsolute9(path12)) {
93186
93242
  return path12;
93187
93243
  }
93188
93244
  return join68(configDir, path12);
@@ -93255,7 +93311,7 @@ async function discoverConfigSourceSkills(options) {
93255
93311
  return deduplicateSkillsByName(loadedBySource.flat());
93256
93312
  }
93257
93313
  // src/tools/slashcommand/command-discovery.ts
93258
- import { existsSync as existsSync61, readdirSync as readdirSync16, readFileSync as readFileSync44, statSync as statSync6 } from "fs";
93314
+ import { existsSync as existsSync61, readdirSync as readdirSync16, readFileSync as readFileSync45, statSync as statSync6 } from "fs";
93259
93315
  import { basename as basename8, join as join69 } from "path";
93260
93316
  // src/features/builtin-commands/templates/init-deep.ts
93261
93317
  var INIT_DEEP_TEMPLATE = `# /init-deep
@@ -94816,7 +94872,7 @@ function discoverCommandsFromDir(commandsDir, scope, prefix = "") {
94816
94872
  const baseCommandName = basename8(entry.name, ".md");
94817
94873
  const commandName = prefix ? `${prefix}${NESTED_COMMAND_SEPARATOR}${baseCommandName}` : baseCommandName;
94818
94874
  try {
94819
- const content = readFileSync44(commandPath, "utf-8");
94875
+ const content = readFileSync45(commandPath, "utf-8");
94820
94876
  const { data, body } = parseFrontmatter(content);
94821
94877
  const isOpencodeSource = scope === "opencode" || scope === "opencode-project";
94822
94878
  const metadata = {
@@ -95355,7 +95411,7 @@ var NOTEPAD_DIR = "notepads";
95355
95411
  var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
95356
95412
  var PROMETHEUS_PLANS_DIR = ".sisyphus/plans";
95357
95413
  // src/features/boulder-state/storage.ts
95358
- import { existsSync as existsSync62, readFileSync as readFileSync45, writeFileSync as writeFileSync18, mkdirSync as mkdirSync16, readdirSync as readdirSync17 } from "fs";
95414
+ import { existsSync as existsSync62, readFileSync as readFileSync46, writeFileSync as writeFileSync18, mkdirSync as mkdirSync16, readdirSync as readdirSync17 } from "fs";
95359
95415
  import { dirname as dirname21, join as join70, basename as basename9 } from "path";
95360
95416
  var RESERVED_KEYS = new Set(["__proto__", "prototype", "constructor"]);
95361
95417
  function getBoulderFilePath(directory) {
@@ -95367,7 +95423,7 @@ function readBoulderState(directory) {
95367
95423
  return null;
95368
95424
  }
95369
95425
  try {
95370
- const content = readFileSync45(filePath, "utf-8");
95426
+ const content = readFileSync46(filePath, "utf-8");
95371
95427
  const parsed = JSON.parse(content);
95372
95428
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
95373
95429
  return null;
@@ -95506,7 +95562,7 @@ function getPlanProgress(planPath) {
95506
95562
  return { total: 0, completed: 0, isComplete: true };
95507
95563
  }
95508
95564
  try {
95509
- const content = readFileSync45(planPath, "utf-8");
95565
+ const content = readFileSync46(planPath, "utf-8");
95510
95566
  const lines = content.split(/\r?\n/);
95511
95567
  const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN.test(line) || FINAL_VERIFICATION_HEADING_PATTERN.test(line));
95512
95568
  if (hasStructuredSections) {
@@ -95582,7 +95638,7 @@ function createBoulderState(planPath, sessionId, agent, worktreePath) {
95582
95638
  };
95583
95639
  }
95584
95640
  // src/features/boulder-state/top-level-task.ts
95585
- import { existsSync as existsSync63, readFileSync as readFileSync46 } from "fs";
95641
+ import { existsSync as existsSync63, readFileSync as readFileSync47 } from "fs";
95586
95642
  var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
95587
95643
  var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
95588
95644
  var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
@@ -95609,7 +95665,7 @@ function readCurrentTopLevelTask(planPath) {
95609
95665
  return null;
95610
95666
  }
95611
95667
  try {
95612
- const content = readFileSync46(planPath, "utf-8");
95668
+ const content = readFileSync47(planPath, "utf-8");
95613
95669
  const lines = content.split(/\r?\n/);
95614
95670
  let section = "other";
95615
95671
  for (const line of lines) {
@@ -95678,11 +95734,11 @@ function isPrometheusAgent(agentName) {
95678
95734
  }
95679
95735
 
95680
95736
  // src/hooks/prometheus-md-only/path-policy.ts
95681
- import { relative as relative7, resolve as resolve11, isAbsolute as isAbsolute9 } from "path";
95737
+ import { relative as relative7, resolve as resolve12, isAbsolute as isAbsolute10 } from "path";
95682
95738
  function isAllowedFile(filePath, workspaceRoot) {
95683
- const resolved = resolve11(workspaceRoot, filePath);
95739
+ const resolved = resolve12(workspaceRoot, filePath);
95684
95740
  const rel = relative7(workspaceRoot, resolved);
95685
- if (rel.startsWith("..") || isAbsolute9(rel)) {
95741
+ if (rel.startsWith("..") || isAbsolute10(rel)) {
95686
95742
  return false;
95687
95743
  }
95688
95744
  if (!/\.sisyphus[/\\]/i.test(rel)) {
@@ -96218,7 +96274,7 @@ function isAbortError(error48) {
96218
96274
  }
96219
96275
 
96220
96276
  // src/hooks/atlas/session-last-agent.ts
96221
- import { readFileSync as readFileSync47, readdirSync as readdirSync18 } from "fs";
96277
+ import { readFileSync as readFileSync48, readdirSync as readdirSync18 } from "fs";
96222
96278
  import { join as join71 } from "path";
96223
96279
  var defaultSessionLastAgentDeps = {
96224
96280
  getMessageDir,
@@ -96267,7 +96323,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
96267
96323
  try {
96268
96324
  const messages = readdirSync18(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
96269
96325
  try {
96270
- const content = readFileSync47(join71(messageDir, fileName), "utf-8");
96326
+ const content = readFileSync48(join71(messageDir, fileName), "utf-8");
96271
96327
  const parsed = JSON.parse(content);
96272
96328
  return {
96273
96329
  fileName,
@@ -97138,7 +97194,7 @@ async function resolveFallbackTrackedSessionId(input) {
97138
97194
  }
97139
97195
 
97140
97196
  // src/hooks/atlas/final-wave-plan-state.ts
97141
- import { existsSync as existsSync64, readFileSync as readFileSync48 } from "fs";
97197
+ import { existsSync as existsSync64, readFileSync as readFileSync49 } from "fs";
97142
97198
  var TODO_HEADING_PATTERN3 = /^##\s+TODOs\b/i;
97143
97199
  var FINAL_VERIFICATION_HEADING_PATTERN3 = /^##\s+Final Verification Wave\b/i;
97144
97200
  var SECOND_LEVEL_HEADING_PATTERN3 = /^##\s+/;
@@ -97150,7 +97206,7 @@ function readFinalWavePlanState(planPath) {
97150
97206
  return null;
97151
97207
  }
97152
97208
  try {
97153
- const content = readFileSync48(planPath, "utf-8");
97209
+ const content = readFileSync49(planPath, "utf-8");
97154
97210
  const lines = content.split(/\r?\n/);
97155
97211
  let section = "other";
97156
97212
  let pendingImplementationTaskCount = 0;
@@ -98086,6 +98142,7 @@ function trackAssistantOutput(state3, messageID) {
98086
98142
  init_logger();
98087
98143
 
98088
98144
  // src/hooks/compaction-context-injector/recovery-prompt-config.ts
98145
+ init_agent_display_names();
98089
98146
  function isCompactionAgent4(agent) {
98090
98147
  return agent?.trim().toLowerCase() === "compaction";
98091
98148
  }
@@ -98119,7 +98176,7 @@ function createExpectedRecoveryPromptConfig(checkpoint, currentPromptConfig) {
98119
98176
  }
98120
98177
  function isPromptConfigRecovered(actualPromptConfig, expectedPromptConfig) {
98121
98178
  const actualAgent = actualPromptConfig.agent;
98122
- const agentMatches = typeof actualAgent === "string" && !isCompactionAgent4(actualAgent) && actualAgent.toLowerCase() === expectedPromptConfig.agent.toLowerCase();
98179
+ const agentMatches = typeof actualAgent === "string" && !isCompactionAgent4(actualAgent) && stripInvisibleAgentCharacters(actualAgent).toLowerCase() === stripInvisibleAgentCharacters(expectedPromptConfig.agent).toLowerCase();
98123
98180
  return agentMatches && matchesExpectedModel(actualPromptConfig.model, expectedPromptConfig.model) && matchesExpectedTools(actualPromptConfig.tools, expectedPromptConfig.tools);
98124
98181
  }
98125
98182
 
@@ -99133,7 +99190,8 @@ var PARTIAL_STRING_ARRAY_KEYS = new Set([
99133
99190
  "disabled_hooks",
99134
99191
  "disabled_commands",
99135
99192
  "disabled_tools",
99136
- "mcp_env_allowlist"
99193
+ "mcp_env_allowlist",
99194
+ "agent_definitions"
99137
99195
  ]);
99138
99196
  function parseConfigPartially(rawConfig) {
99139
99197
  const fullResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
@@ -99205,6 +99263,12 @@ function mergeConfigs(base, override) {
99205
99263
  ...override,
99206
99264
  agents: deepMerge(base.agents, override.agents),
99207
99265
  categories: deepMerge(base.categories, override.categories),
99266
+ agent_definitions: [
99267
+ ...new Set([
99268
+ ...base.agent_definitions ?? [],
99269
+ ...override.agent_definitions ?? []
99270
+ ])
99271
+ ],
99208
99272
  disabled_agents: [
99209
99273
  ...new Set([
99210
99274
  ...base.disabled_agents ?? [],
@@ -99285,10 +99349,16 @@ function loadPluginConfig(directory, ctx) {
99285
99349
  }
99286
99350
  const userConfig = loadConfigFromPath2(userConfigPath, ctx);
99287
99351
  const userGitMasterOverrides = loadExplicitGitMasterOverrides(userConfigPath);
99352
+ if (userConfig?.agent_definitions) {
99353
+ userConfig.agent_definitions = resolveAgentDefinitionPaths(userConfig.agent_definitions, configDir, null);
99354
+ }
99288
99355
  let config2 = userConfig ?? OhMyOpenCodeConfigSchema.parse({});
99289
99356
  const defaultGitMaster = OhMyOpenCodeConfigSchema.parse({}).git_master;
99290
99357
  const projectConfig = loadConfigFromPath2(projectConfigPath, ctx);
99291
99358
  const projectGitMasterOverrides = loadExplicitGitMasterOverrides(projectConfigPath);
99359
+ if (projectConfig?.agent_definitions) {
99360
+ projectConfig.agent_definitions = resolveAgentDefinitionPaths(projectConfig.agent_definitions, projectBasePath, directory);
99361
+ }
99292
99362
  if (projectConfig) {
99293
99363
  config2 = mergeConfigs(config2, projectConfig);
99294
99364
  }
@@ -100605,7 +100675,7 @@ function createRuntimeFallbackHook(ctx, options) {
100605
100675
  }
100606
100676
  // src/hooks/write-existing-file-guard/hook.ts
100607
100677
  import { existsSync as existsSync67, realpathSync as realpathSync7 } from "fs";
100608
- import { basename as basename11, dirname as dirname23, isAbsolute as isAbsolute10, join as join73, normalize as normalize2, relative as relative8, resolve as resolve12 } from "path";
100678
+ import { basename as basename11, dirname as dirname23, isAbsolute as isAbsolute11, join as join73, normalize as normalize2, relative as relative8, resolve as resolve13 } from "path";
100609
100679
 
100610
100680
  // src/hooks/write-existing-file-guard/tool-execute-before-handler.ts
100611
100681
  import { existsSync as existsSync66 } from "fs";
@@ -100763,11 +100833,11 @@ function getPathFromArgs(args) {
100763
100833
  return args?.filePath ?? args?.path ?? args?.file_path;
100764
100834
  }
100765
100835
  function resolveInputPath(ctx, inputPath) {
100766
- return normalize2(isAbsolute10(inputPath) ? inputPath : resolve12(ctx.directory, inputPath));
100836
+ return normalize2(isAbsolute11(inputPath) ? inputPath : resolve13(ctx.directory, inputPath));
100767
100837
  }
100768
100838
  function isPathInsideDirectory(pathToCheck, directory) {
100769
100839
  const relativePath = relative8(directory, pathToCheck);
100770
- return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute10(relativePath);
100840
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute11(relativePath);
100771
100841
  }
100772
100842
  function toCanonicalPath2(absolutePath) {
100773
100843
  let canonicalPath = absolutePath;
@@ -102056,7 +102126,7 @@ init_logger();
102056
102126
  init_plugin_identity();
102057
102127
 
102058
102128
  // src/hooks/legacy-plugin-toast/auto-migrate.ts
102059
- import { existsSync as existsSync68, readFileSync as readFileSync50 } from "fs";
102129
+ import { existsSync as existsSync68, readFileSync as readFileSync51 } from "fs";
102060
102130
  import { join as join74 } from "path";
102061
102131
  init_plugin_identity();
102062
102132
  function detectOpenCodeConfigPath(overrideConfigDir) {
@@ -102081,7 +102151,7 @@ function autoMigrateLegacyPluginEntry(overrideConfigDir) {
102081
102151
  if (!configPath)
102082
102152
  return { migrated: false, from: null, to: null, configPath: null };
102083
102153
  try {
102084
- const content = readFileSync50(configPath, "utf-8");
102154
+ const content = readFileSync51(configPath, "utf-8");
102085
102155
  const parseResult = parseJsoncSafe(content);
102086
102156
  if (!parseResult.data?.plugin)
102087
102157
  return { migrated: false, from: null, to: null, configPath };
@@ -102484,13 +102554,13 @@ var DEFAULT_MAX_SYMBOLS = 200;
102484
102554
  var DEFAULT_MAX_DIAGNOSTICS = 200;
102485
102555
  var DEFAULT_MAX_DIRECTORY_FILES = 50;
102486
102556
  // src/tools/lsp/server-config-loader.ts
102487
- import { existsSync as existsSync69, readFileSync as readFileSync51 } from "fs";
102557
+ import { existsSync as existsSync69, readFileSync as readFileSync52 } from "fs";
102488
102558
  import { join as join75 } from "path";
102489
102559
  function loadJsonFile(path13) {
102490
102560
  if (!existsSync69(path13))
102491
102561
  return null;
102492
102562
  try {
102493
- return parseJsonc(readFileSync51(path13, "utf-8"));
102563
+ return parseJsonc(readFileSync52(path13, "utf-8"));
102494
102564
  } catch {
102495
102565
  return null;
102496
102566
  }
@@ -102700,8 +102770,8 @@ function validateCwd(cwd) {
102700
102770
  function wrapNodeProcess2(proc) {
102701
102771
  let resolveExited;
102702
102772
  let exitCode = null;
102703
- const exitedPromise = new Promise((resolve13) => {
102704
- resolveExited = resolve13;
102773
+ const exitedPromise = new Promise((resolve14) => {
102774
+ resolveExited = resolve14;
102705
102775
  });
102706
102776
  proc.on("exit", (code) => {
102707
102777
  exitCode = code ?? 1;
@@ -102721,9 +102791,9 @@ function wrapNodeProcess2(proc) {
102721
102791
  nodeStream.on("data", (chunk) => {
102722
102792
  const uint8 = new Uint8Array(chunk);
102723
102793
  if (waitingResolve) {
102724
- const resolve13 = waitingResolve;
102794
+ const resolve14 = waitingResolve;
102725
102795
  waitingResolve = null;
102726
- resolve13({ done: false, value: uint8 });
102796
+ resolve14({ done: false, value: uint8 });
102727
102797
  } else {
102728
102798
  chunks.push(uint8);
102729
102799
  }
@@ -102731,17 +102801,17 @@ function wrapNodeProcess2(proc) {
102731
102801
  nodeStream.on("end", () => {
102732
102802
  streamEnded = true;
102733
102803
  if (waitingResolve) {
102734
- const resolve13 = waitingResolve;
102804
+ const resolve14 = waitingResolve;
102735
102805
  waitingResolve = null;
102736
- resolve13({ done: true, value: undefined });
102806
+ resolve14({ done: true, value: undefined });
102737
102807
  }
102738
102808
  });
102739
102809
  nodeStream.on("error", () => {
102740
102810
  streamEnded = true;
102741
102811
  if (waitingResolve) {
102742
- const resolve13 = waitingResolve;
102812
+ const resolve14 = waitingResolve;
102743
102813
  waitingResolve = null;
102744
- resolve13({ done: true, value: undefined });
102814
+ resolve14({ done: true, value: undefined });
102745
102815
  }
102746
102816
  });
102747
102817
  } else {
@@ -102749,13 +102819,13 @@ function wrapNodeProcess2(proc) {
102749
102819
  }
102750
102820
  return {
102751
102821
  read() {
102752
- return new Promise((resolve13) => {
102822
+ return new Promise((resolve14) => {
102753
102823
  if (chunks.length > 0) {
102754
- resolve13({ done: false, value: chunks.shift() });
102824
+ resolve14({ done: false, value: chunks.shift() });
102755
102825
  } else if (streamEnded) {
102756
- resolve13({ done: true, value: undefined });
102826
+ resolve14({ done: true, value: undefined });
102757
102827
  } else {
102758
- waitingResolve = resolve13;
102828
+ waitingResolve = resolve14;
102759
102829
  }
102760
102830
  });
102761
102831
  }
@@ -102817,8 +102887,8 @@ function spawnProcess(command, options) {
102817
102887
  return proc;
102818
102888
  }
102819
102889
  // src/tools/lsp/lsp-client.ts
102820
- import { readFileSync as readFileSync52 } from "fs";
102821
- import { extname as extname4, resolve as resolve13 } from "path";
102890
+ import { readFileSync as readFileSync53 } from "fs";
102891
+ import { extname as extname4, resolve as resolve14 } from "path";
102822
102892
  import { pathToFileURL as pathToFileURL2 } from "url";
102823
102893
 
102824
102894
  // src/tools/lsp/lsp-client-connection.ts
@@ -102862,7 +102932,7 @@ class LSPClientTransport {
102862
102932
  throw new Error(`Failed to spawn LSP server: ${this.server.command.join(" ")}`);
102863
102933
  }
102864
102934
  this.startStderrReading();
102865
- await new Promise((resolve13) => setTimeout(resolve13, 100));
102935
+ await new Promise((resolve14) => setTimeout(resolve14, 100));
102866
102936
  if (this.proc.exitCode !== null) {
102867
102937
  const stderr = this.stderrBuffer.join(`
102868
102938
  `);
@@ -102994,8 +103064,8 @@ recent stderr: ${stderr}` : "")));
102994
103064
  try {
102995
103065
  proc.kill();
102996
103066
  let timeoutId;
102997
- const timeoutPromise = new Promise((resolve13) => {
102998
- timeoutId = setTimeout(resolve13, 5000);
103067
+ const timeoutPromise = new Promise((resolve14) => {
103068
+ timeoutId = setTimeout(resolve14, 5000);
102999
103069
  });
103000
103070
  await Promise.race([
103001
103071
  proc.exited.then(() => {
@@ -103007,7 +103077,7 @@ recent stderr: ${stderr}` : "")));
103007
103077
  log("[LSPClient] Process did not exit within timeout, escalating to SIGKILL");
103008
103078
  try {
103009
103079
  proc.kill("SIGKILL");
103010
- await Promise.race([proc.exited, new Promise((resolve13) => setTimeout(resolve13, 1000))]);
103080
+ await Promise.race([proc.exited, new Promise((resolve14) => setTimeout(resolve14, 1000))]);
103011
103081
  } catch {}
103012
103082
  }
103013
103083
  } catch {}
@@ -103087,9 +103157,9 @@ class LSPClient extends LSPClientConnection {
103087
103157
  documentVersions = new Map;
103088
103158
  lastSyncedText = new Map;
103089
103159
  async openFile(filePath) {
103090
- const absPath = resolve13(filePath);
103160
+ const absPath = resolve14(filePath);
103091
103161
  const uri = pathToFileURL2(absPath).href;
103092
- const text = readFileSync52(absPath, "utf-8");
103162
+ const text = readFileSync53(absPath, "utf-8");
103093
103163
  if (!this.openedFiles.has(absPath)) {
103094
103164
  const ext = extname4(absPath);
103095
103165
  const languageId = getLanguageId(ext);
@@ -103125,7 +103195,7 @@ class LSPClient extends LSPClientConnection {
103125
103195
  });
103126
103196
  }
103127
103197
  async definition(filePath, line, character) {
103128
- const absPath = resolve13(filePath);
103198
+ const absPath = resolve14(filePath);
103129
103199
  await this.openFile(absPath);
103130
103200
  return this.sendRequest("textDocument/definition", {
103131
103201
  textDocument: { uri: pathToFileURL2(absPath).href },
@@ -103133,7 +103203,7 @@ class LSPClient extends LSPClientConnection {
103133
103203
  });
103134
103204
  }
103135
103205
  async references(filePath, line, character, includeDeclaration = true) {
103136
- const absPath = resolve13(filePath);
103206
+ const absPath = resolve14(filePath);
103137
103207
  await this.openFile(absPath);
103138
103208
  return this.sendRequest("textDocument/references", {
103139
103209
  textDocument: { uri: pathToFileURL2(absPath).href },
@@ -103142,7 +103212,7 @@ class LSPClient extends LSPClientConnection {
103142
103212
  });
103143
103213
  }
103144
103214
  async documentSymbols(filePath) {
103145
- const absPath = resolve13(filePath);
103215
+ const absPath = resolve14(filePath);
103146
103216
  await this.openFile(absPath);
103147
103217
  return this.sendRequest("textDocument/documentSymbol", {
103148
103218
  textDocument: { uri: pathToFileURL2(absPath).href }
@@ -103152,7 +103222,7 @@ class LSPClient extends LSPClientConnection {
103152
103222
  return this.sendRequest("workspace/symbol", { query });
103153
103223
  }
103154
103224
  async diagnostics(filePath) {
103155
- const absPath = resolve13(filePath);
103225
+ const absPath = resolve14(filePath);
103156
103226
  const uri = pathToFileURL2(absPath).href;
103157
103227
  await this.openFile(absPath);
103158
103228
  await new Promise((r) => setTimeout(r, 500));
@@ -103167,7 +103237,7 @@ class LSPClient extends LSPClientConnection {
103167
103237
  return { items: this.diagnosticsStore.get(uri) ?? [] };
103168
103238
  }
103169
103239
  async prepareRename(filePath, line, character) {
103170
- const absPath = resolve13(filePath);
103240
+ const absPath = resolve14(filePath);
103171
103241
  await this.openFile(absPath);
103172
103242
  return this.sendRequest("textDocument/prepareRename", {
103173
103243
  textDocument: { uri: pathToFileURL2(absPath).href },
@@ -103175,7 +103245,7 @@ class LSPClient extends LSPClientConnection {
103175
103245
  });
103176
103246
  }
103177
103247
  async rename(filePath, line, character, newName) {
103178
- const absPath = resolve13(filePath);
103248
+ const absPath = resolve14(filePath);
103179
103249
  await this.openFile(absPath);
103180
103250
  return this.sendRequest("textDocument/rename", {
103181
103251
  textDocument: { uri: pathToFileURL2(absPath).href },
@@ -103445,7 +103515,7 @@ class LSPServerManager {
103445
103515
  }
103446
103516
  var lspManager = LSPServerManager.getInstance();
103447
103517
  // src/tools/lsp/lsp-client-wrapper.ts
103448
- import { extname as extname5, resolve as resolve14 } from "path";
103518
+ import { extname as extname5, resolve as resolve15 } from "path";
103449
103519
  import { fileURLToPath as fileURLToPath4 } from "url";
103450
103520
  import { existsSync as existsSync72, statSync as statSync9 } from "fs";
103451
103521
  init_plugin_identity();
@@ -103459,7 +103529,7 @@ function uriToPath(uri) {
103459
103529
  return fileURLToPath4(uri);
103460
103530
  }
103461
103531
  function findWorkspaceRoot(filePath) {
103462
- let dir = resolve14(filePath);
103532
+ let dir = resolve15(filePath);
103463
103533
  if (!existsSync72(dir) || !isDirectoryPath(dir)) {
103464
103534
  dir = __require("path").dirname(dir);
103465
103535
  }
@@ -103474,7 +103544,7 @@ function findWorkspaceRoot(filePath) {
103474
103544
  prevDir = dir;
103475
103545
  dir = __require("path").dirname(dir);
103476
103546
  }
103477
- return __require("path").dirname(resolve14(filePath));
103547
+ return __require("path").dirname(resolve15(filePath));
103478
103548
  }
103479
103549
  function formatServerLookupError(result) {
103480
103550
  if (result.status === "not_installed") {
@@ -103512,7 +103582,7 @@ function formatServerLookupError(result) {
103512
103582
  `);
103513
103583
  }
103514
103584
  async function withLspClient(filePath, fn) {
103515
- const absPath = resolve14(filePath);
103585
+ const absPath = resolve15(filePath);
103516
103586
  if (isDirectoryPath(absPath)) {
103517
103587
  throw new Error(`Directory paths are not supported by this LSP tool. ` + `Use lsp_diagnostics with the 'extension' parameter for directory diagnostics.`);
103518
103588
  }
@@ -103642,10 +103712,10 @@ function formatApplyResult(result) {
103642
103712
  `);
103643
103713
  }
103644
103714
  // src/tools/lsp/workspace-edit.ts
103645
- import { readFileSync as readFileSync53, writeFileSync as writeFileSync19 } from "fs";
103715
+ import { readFileSync as readFileSync54, writeFileSync as writeFileSync19 } from "fs";
103646
103716
  function applyTextEditsToFile(filePath, edits) {
103647
103717
  try {
103648
- let content = readFileSync53(filePath, "utf-8");
103718
+ let content = readFileSync54(filePath, "utf-8");
103649
103719
  const lines = content.split(`
103650
103720
  `);
103651
103721
  const sortedEdits = [...edits].sort((a, b) => {
@@ -103711,7 +103781,7 @@ function applyWorkspaceEdit(edit) {
103711
103781
  try {
103712
103782
  const oldPath = uriToPath(change.oldUri);
103713
103783
  const newPath = uriToPath(change.newUri);
103714
- const content = readFileSync53(oldPath, "utf-8");
103784
+ const content = readFileSync54(oldPath, "utf-8");
103715
103785
  writeFileSync19(newPath, content, "utf-8");
103716
103786
  __require("fs").unlinkSync(oldPath);
103717
103787
  result.filesModified.push(newPath);
@@ -116191,11 +116261,11 @@ var lsp_symbols = tool({
116191
116261
  }
116192
116262
  });
116193
116263
  // src/tools/lsp/diagnostics-tool.ts
116194
- import { resolve as resolve16 } from "path";
116264
+ import { resolve as resolve17 } from "path";
116195
116265
 
116196
116266
  // src/tools/lsp/directory-diagnostics.ts
116197
116267
  import { existsSync as existsSync73, lstatSync as lstatSync2, readdirSync as readdirSync19 } from "fs";
116198
- import { extname as extname6, join as join78, resolve as resolve15 } from "path";
116268
+ import { extname as extname6, join as join78, resolve as resolve16 } from "path";
116199
116269
  var SKIP_DIRECTORIES = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
116200
116270
  function collectFilesWithExtension(dir, extension, maxFiles) {
116201
116271
  const files = [];
@@ -116239,7 +116309,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
116239
116309
  if (!extension.startsWith(".")) {
116240
116310
  throw new Error(`Extension must start with a dot (e.g., ".ts", not "${extension}"). ` + `Use ".${extension}" instead.`);
116241
116311
  }
116242
- const absDir = resolve15(directory);
116312
+ const absDir = resolve16(directory);
116243
116313
  if (!existsSync73(absDir)) {
116244
116314
  throw new Error(`Directory does not exist: ${absDir}`);
116245
116315
  }
@@ -116380,7 +116450,7 @@ var lsp_diagnostics = tool({
116380
116450
  if (!args.filePath) {
116381
116451
  throw new Error("'filePath' parameter is required.");
116382
116452
  }
116383
- const absPath = resolve16(args.filePath);
116453
+ const absPath = resolve17(args.filePath);
116384
116454
  if (isDirectoryPath(absPath)) {
116385
116455
  const extension = inferExtensionFromDirectory(absPath);
116386
116456
  if (!extension) {
@@ -116503,7 +116573,7 @@ import { existsSync as existsSync75, statSync as statSync10 } from "fs";
116503
116573
  // src/tools/ast-grep/downloader.ts
116504
116574
  import { existsSync as existsSync74 } from "fs";
116505
116575
  import { join as join80 } from "path";
116506
- import { homedir as homedir15 } from "os";
116576
+ import { homedir as homedir16 } from "os";
116507
116577
  import { createRequire as createRequire3 } from "module";
116508
116578
  init_logger();
116509
116579
  init_plugin_identity();
@@ -116530,11 +116600,11 @@ var PLATFORM_MAP2 = {
116530
116600
  function getCacheDir3() {
116531
116601
  if (process.platform === "win32") {
116532
116602
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
116533
- const base2 = localAppData || join80(homedir15(), "AppData", "Local");
116603
+ const base2 = localAppData || join80(homedir16(), "AppData", "Local");
116534
116604
  return join80(base2, CACHE_DIR_NAME, "bin");
116535
116605
  }
116536
116606
  const xdgCache = process.env.XDG_CACHE_HOME;
116537
- const base = xdgCache || join80(homedir15(), ".cache");
116607
+ const base = xdgCache || join80(homedir16(), ".cache");
116538
116608
  return join80(base, CACHE_DIR_NAME, "bin");
116539
116609
  }
116540
116610
  function getBinaryName3() {
@@ -117022,7 +117092,7 @@ ${hint}`;
117022
117092
  return { ast_grep_search, ast_grep_replace };
117023
117093
  }
117024
117094
  // src/tools/grep/tools.ts
117025
- import { resolve as resolve17 } from "path";
117095
+ import { resolve as resolve18 } from "path";
117026
117096
 
117027
117097
  // src/tools/grep/cli.ts
117028
117098
  var {spawn: spawn18 } = globalThis.Bun;
@@ -117246,10 +117316,10 @@ class Semaphore {
117246
117316
  this.running++;
117247
117317
  return;
117248
117318
  }
117249
- return new Promise((resolve17) => {
117319
+ return new Promise((resolve18) => {
117250
117320
  this.queue.push(() => {
117251
117321
  this.running++;
117252
- resolve17();
117322
+ resolve18();
117253
117323
  });
117254
117324
  });
117255
117325
  }
@@ -117342,7 +117412,8 @@ function parseOutput(output, filesOnly = false) {
117342
117412
  const matches = [];
117343
117413
  const lines = output.split(`
117344
117414
  `);
117345
- for (const line of lines) {
117415
+ for (let line of lines) {
117416
+ line = line.replace(/\r$/, "");
117346
117417
  if (!line.trim())
117347
117418
  continue;
117348
117419
  if (filesOnly) {
@@ -117353,7 +117424,7 @@ function parseOutput(output, filesOnly = false) {
117353
117424
  });
117354
117425
  continue;
117355
117426
  }
117356
- const match = line.match(/^(.+?):(\d+):(.*)$/);
117427
+ const match = line.match(/^([A-Za-z]:[\\\/].*?|.+?):(\d+):(.*)$/);
117357
117428
  if (match) {
117358
117429
  matches.push({
117359
117430
  file: match[1],
@@ -117370,10 +117441,11 @@ function parseCountOutput(output) {
117370
117441
  const results = [];
117371
117442
  const lines = output.split(`
117372
117443
  `);
117373
- for (const line of lines) {
117444
+ for (let line of lines) {
117445
+ line = line.replace(/\r$/, "");
117374
117446
  if (!line.trim())
117375
117447
  continue;
117376
- const match = line.match(/^(.+?):(\d+)$/);
117448
+ const match = line.match(/^([A-Za-z]:[\\\/].*?|.+?):(\d+)$/);
117377
117449
  if (match) {
117378
117450
  results.push({
117379
117451
  file: match[1],
@@ -117552,7 +117624,7 @@ function createGrepTools(ctx) {
117552
117624
  const globs = args.include ? [args.include] : undefined;
117553
117625
  const runtimeCtx = context;
117554
117626
  const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
117555
- const searchPath = args.path ? resolve17(dir, args.path) : dir;
117627
+ const searchPath = args.path ? resolve18(dir, args.path) : dir;
117556
117628
  const paths = [searchPath];
117557
117629
  const outputMode = args.output_mode ?? "files_with_matches";
117558
117630
  const headLimit = args.head_limit ?? 0;
@@ -117583,10 +117655,10 @@ function createGrepTools(ctx) {
117583
117655
  return { grep };
117584
117656
  }
117585
117657
  // src/tools/glob/tools.ts
117586
- import { resolve as resolve19 } from "path";
117658
+ import { resolve as resolve20 } from "path";
117587
117659
 
117588
117660
  // src/tools/glob/cli.ts
117589
- import { resolve as resolve18 } from "path";
117661
+ import { resolve as resolve19 } from "path";
117590
117662
  var {spawn: spawn19 } = globalThis.Bun;
117591
117663
 
117592
117664
  // src/tools/glob/constants.ts
@@ -117720,7 +117792,7 @@ async function runRgFilesInternal(options, resolvedCli) {
117720
117792
  }
117721
117793
  let filePath;
117722
117794
  if (isRg) {
117723
- filePath = cwd ? resolve18(cwd, line) : line;
117795
+ filePath = cwd ? resolve19(cwd, line) : line;
117724
117796
  } else if (isWindows2) {
117725
117797
  filePath = line.trim();
117726
117798
  } else {
@@ -117780,7 +117852,7 @@ function createGlobTools(ctx) {
117780
117852
  const cli = await resolveGrepCliWithAutoInstall();
117781
117853
  const runtimeCtx = context;
117782
117854
  const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
117783
- const searchPath = args.path ? resolve19(dir, args.path) : dir;
117855
+ const searchPath = args.path ? resolve20(dir, args.path) : dir;
117784
117856
  const result = await runRgFiles({
117785
117857
  pattern: args.pattern,
117786
117858
  paths: [searchPath]
@@ -119428,7 +119500,7 @@ init_logger();
119428
119500
 
119429
119501
  // src/tools/background-task/delay.ts
119430
119502
  function delay3(ms) {
119431
- return new Promise((resolve20) => setTimeout(resolve20, ms));
119503
+ return new Promise((resolve21) => setTimeout(resolve21, ms));
119432
119504
  }
119433
119505
  // src/tools/background-task/session-messages.ts
119434
119506
  function getErrorMessage4(value) {
@@ -120041,9 +120113,12 @@ var ALLOWED_AGENTS = [
120041
120113
  "momus",
120042
120114
  "multimodal-looker"
120043
120115
  ];
120044
- var CALL_OMO_AGENT_DESCRIPTION = `Spawn explore/librarian agent. run_in_background REQUIRED (true=async with task_id, false=sync).
120116
+ var CALL_OMO_AGENT_DESCRIPTION = `Spawn explore/librarian agent or custom agents. run_in_background REQUIRED (true=async with task_id, false=sync).
120045
120117
 
120046
- Available: {agents}
120118
+ Built-in agents:
120119
+ {agents}
120120
+
120121
+ Custom agents registered via user or project agent directories are also supported.
120047
120122
 
120048
120123
  Pass \`session_id=<id>\` to continue previous agent with full context. Nested subagent depth is tracked automatically and blocked past the configured limit. Prompts MUST be in English. Use \`background_output\` for async results.`;
120049
120124
  // src/tools/call-omo-agent/tools.ts
@@ -120182,7 +120257,7 @@ Task ID: ${task.id}`;
120182
120257
  if (toolContext.abort?.aborted) {
120183
120258
  break;
120184
120259
  }
120185
- await new Promise((resolve20) => setTimeout(resolve20, WAIT_FOR_SESSION_INTERVAL_MS));
120260
+ await new Promise((resolve21) => setTimeout(resolve21, WAIT_FOR_SESSION_INTERVAL_MS));
120186
120261
  }
120187
120262
  await toolContext.metadata?.({
120188
120263
  title: args.description,
@@ -120265,7 +120340,7 @@ async function waitForCompletion(sessionID, toolContext, ctx) {
120265
120340
  log(`[call_omo_agent] Aborted by user`);
120266
120341
  throw new Error("Task aborted.");
120267
120342
  }
120268
- await new Promise((resolve20) => setTimeout(resolve20, POLL_INTERVAL_MS));
120343
+ await new Promise((resolve21) => setTimeout(resolve21, POLL_INTERVAL_MS));
120269
120344
  const statusResult = await ctx.client.session.status();
120270
120345
  const allStatuses = normalizeSDKResponse(statusResult, {});
120271
120346
  const sessionStatus = allStatuses[sessionID];
@@ -120503,6 +120578,33 @@ session_id: ${sessionID}
120503
120578
  }
120504
120579
  }
120505
120580
 
120581
+ // src/tools/call-omo-agent/agent-resolver.ts
120582
+ init_logger();
120583
+ var callableAgentsCache = new Map;
120584
+ var CACHE_TTL_MS = 30000;
120585
+ async function resolveCallableAgents(client2, sessionId) {
120586
+ const cacheKey = sessionId ?? "__default__";
120587
+ const cached3 = callableAgentsCache.get(cacheKey);
120588
+ if (cached3 && Date.now() - cached3.timestamp < CACHE_TTL_MS) {
120589
+ return cached3.agents;
120590
+ }
120591
+ try {
120592
+ const agentsResult = await client2.app.agents();
120593
+ const agents = normalizeSDKResponse(agentsResult, [], {
120594
+ preferResponseOnMissingData: true
120595
+ });
120596
+ const dynamicAgents = agents.filter((a) => a && typeof a.name === "string" && a.name.trim().length > 0 && a.mode !== "primary").map((a) => a.name.trim().toLowerCase());
120597
+ const merged = new Set([...ALLOWED_AGENTS, ...dynamicAgents]);
120598
+ const result = [...merged];
120599
+ callableAgentsCache.set(cacheKey, { agents: result, timestamp: Date.now() });
120600
+ return result;
120601
+ } catch (error92) {
120602
+ const message = error92 instanceof Error ? error92.message : String(error92);
120603
+ log("[call_omo_agent] Failed to resolve dynamic agents, falling back to built-in list", { error: message });
120604
+ return [...ALLOWED_AGENTS];
120605
+ }
120606
+ }
120607
+
120506
120608
  // src/tools/call-omo-agent/tools.ts
120507
120609
  function resolveModelAndFallbackChain(args) {
120508
120610
  const { subagentType, agentOverrides, userCategories } = args;
@@ -120552,19 +120654,21 @@ function createCallOmoAgent(ctx, backgroundManager, disabledAgents = [], agentOv
120552
120654
  args: {
120553
120655
  description: tool.schema.string().describe("A short (3-5 words) description of the task"),
120554
120656
  prompt: tool.schema.string().describe("The task for the agent to perform"),
120555
- subagent_type: tool.schema.string().describe("The type of specialized agent to use for this task (explore or librarian only)"),
120657
+ subagent_type: tool.schema.string().describe("The agent to invoke. Supports built-in agents and any custom agents registered at runtime."),
120556
120658
  run_in_background: tool.schema.boolean().describe("REQUIRED. true: run asynchronously (use background_output to get results), false: run synchronously and wait for completion"),
120557
120659
  session_id: tool.schema.string().describe("Existing Task session to continue").optional()
120558
120660
  },
120559
120661
  async execute(args, toolContext) {
120560
120662
  const toolCtx = toolContext;
120561
120663
  log(`[call_omo_agent] Starting with agent: ${args.subagent_type}, background: ${args.run_in_background}`);
120562
- if (!ALLOWED_AGENTS.some((name) => name.toLowerCase() === args.subagent_type.toLowerCase())) {
120563
- return `Error: Invalid agent type "${args.subagent_type}". Only ${ALLOWED_AGENTS.join(", ")} are allowed.`;
120664
+ const callableAgents = await resolveCallableAgents(ctx.client);
120665
+ const strippedAgentType = stripInvisibleAgentCharacters(args.subagent_type);
120666
+ if (!callableAgents.some((name) => name.toLowerCase() === strippedAgentType.toLowerCase())) {
120667
+ return `Error: Invalid agent type "${args.subagent_type}". Only ${callableAgents.join(", ")} are allowed.`;
120564
120668
  }
120565
- const normalizedAgent = args.subagent_type.toLowerCase();
120669
+ const normalizedAgent = strippedAgentType.toLowerCase();
120566
120670
  args = { ...args, subagent_type: normalizedAgent };
120567
- if (disabledAgents.some((disabled) => disabled.toLowerCase() === normalizedAgent)) {
120671
+ if (disabledAgents.some((disabled) => stripInvisibleAgentCharacters(disabled).toLowerCase() === normalizedAgent)) {
120568
120672
  return `Error: Agent "${normalizedAgent}" is disabled via disabled_agents configuration. Remove it from disabled_agents in your ${CONFIG_BASENAME}.json to use it.`;
120569
120673
  }
120570
120674
  const { model: resolvedModel, fallbackChain } = resolveModelAndFallbackChain({
@@ -120813,7 +120917,7 @@ async function resolveMultimodalLookerAgentMetadata(ctx) {
120813
120917
 
120814
120918
  // src/tools/look-at/image-converter.ts
120815
120919
  import * as childProcess from "child_process";
120816
- import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync54, rmSync as rmSync4, unlinkSync as unlinkSync12, writeFileSync as writeFileSync20 } from "fs";
120920
+ import { existsSync as existsSync81, mkdtempSync, readFileSync as readFileSync55, rmSync as rmSync4, unlinkSync as unlinkSync12, writeFileSync as writeFileSync20 } from "fs";
120817
120921
  import { tmpdir as tmpdir7 } from "os";
120818
120922
  import { dirname as dirname28, join as join86 } from "path";
120819
120923
  var SUPPORTED_FORMATS = new Set([
@@ -120933,7 +121037,7 @@ function convertBase64ImageToJpeg(base64Data, mimeType) {
120933
121037
  log(`[image-converter] Converting Base64 ${mimeType} to JPEG`);
120934
121038
  const outputPath = convertImageToJpeg(inputPath, mimeType);
120935
121039
  tempFiles.push(outputPath);
120936
- const convertedBuffer = readFileSync54(outputPath);
121040
+ const convertedBuffer = readFileSync55(outputPath);
120937
121041
  const convertedBase64 = convertedBuffer.toString("base64");
120938
121042
  log(`[image-converter] Base64 conversion successful`);
120939
121043
  return { base64: convertedBase64, tempFiles };
@@ -121898,7 +122002,7 @@ async function executeUnstableAgentTask(args, ctx, executorCtx, parentContext, a
121898
122002
 
121899
122003
  Task ID: ${task.id}`;
121900
122004
  }
121901
- await new Promise((resolve20) => setTimeout(resolve20, timing.WAIT_FOR_SESSION_INTERVAL_MS));
122005
+ await new Promise((resolve21) => setTimeout(resolve21, timing.WAIT_FOR_SESSION_INTERVAL_MS));
121902
122006
  const updated = manager.getTask(task.id);
121903
122007
  sessionID = updated?.sessionID;
121904
122008
  }
@@ -121944,7 +122048,7 @@ Task ID: ${task.id}`;
121944
122048
 
121945
122049
  Session ID: ${sessionID}`;
121946
122050
  }
121947
- await new Promise((resolve20) => setTimeout(resolve20, timingCfg.POLL_INTERVAL_MS));
122051
+ await new Promise((resolve21) => setTimeout(resolve21, timingCfg.POLL_INTERVAL_MS));
121948
122052
  const currentTask = manager.getTask(task.id);
121949
122053
  if (currentTask && (currentTask.status === "interrupt" || currentTask.status === "error" || currentTask.status === "cancelled")) {
121950
122054
  terminalStatus = { status: currentTask.status, error: currentTask.error };
@@ -122082,7 +122186,7 @@ function continueSessionSetup(args) {
122082
122186
  (async () => {
122083
122187
  const waitStart = Date.now();
122084
122188
  while (Date.now() - waitStart < args.timing.WAIT_FOR_SESSION_TIMEOUT_MS) {
122085
- await new Promise((resolve20) => setTimeout(resolve20, args.timing.WAIT_FOR_SESSION_INTERVAL_MS));
122189
+ await new Promise((resolve21) => setTimeout(resolve21, args.timing.WAIT_FOR_SESSION_INTERVAL_MS));
122086
122190
  const updated = args.manager.getTask(args.taskID);
122087
122191
  if (!updated) {
122088
122192
  return;
@@ -122148,7 +122252,7 @@ Task ID: ${task.id}`;
122148
122252
  });
122149
122253
  break;
122150
122254
  }
122151
- await new Promise((resolve20) => setTimeout(resolve20, timing.WAIT_FOR_SESSION_INTERVAL_MS));
122255
+ await new Promise((resolve21) => setTimeout(resolve21, timing.WAIT_FOR_SESSION_INTERVAL_MS));
122152
122256
  }
122153
122257
  if (sessionId) {
122154
122258
  setSessionFallbackChain(sessionId, fallbackChain);
@@ -122227,6 +122331,7 @@ async function createSyncSession(client2, input) {
122227
122331
 
122228
122332
  // src/tools/delegate-task/sync-prompt-sender.ts
122229
122333
  init_constants();
122334
+ init_agent_display_names();
122230
122335
  var sendSyncPromptDeps = {
122231
122336
  promptWithModelSuggestionRetry,
122232
122337
  promptSyncWithModelSuggestionRetry
@@ -122247,7 +122352,7 @@ function buildPromptGenerationParams2(model) {
122247
122352
  };
122248
122353
  }
122249
122354
  function isOracleAgent(agentToUse) {
122250
- return agentToUse.toLowerCase() === "oracle";
122355
+ return stripInvisibleAgentCharacters(agentToUse).toLowerCase() === "oracle";
122251
122356
  }
122252
122357
  function isUnexpectedEofError(error92) {
122253
122358
  const message = error92 instanceof Error ? error92.message : String(error92);
@@ -122269,7 +122374,7 @@ async function sendSyncPrompt(client2, input, deps = sendSyncPromptDeps) {
122269
122374
  const promptArgs = {
122270
122375
  path: { id: input.sessionID },
122271
122376
  body: {
122272
- agent: input.agentToUse.replace(/^\u200B+/, ""),
122377
+ agent: stripInvisibleAgentCharacters(input.agentToUse),
122273
122378
  system: input.systemContent,
122274
122379
  tools,
122275
122380
  parts: [createInternalAgentTextPart(effectivePrompt)],
@@ -123051,22 +123156,118 @@ function applyFallbackEntrySettings(input) {
123051
123156
  // src/tools/delegate-task/subagent-discovery.ts
123052
123157
  init_agent_display_names();
123053
123158
  // src/features/claude-code-agent-loader/loader.ts
123054
- import { existsSync as existsSync82, readdirSync as readdirSync22, readFileSync as readFileSync55 } from "fs";
123055
- import { join as join87, basename as basename13 } from "path";
123056
- function parseToolsConfig2(toolsStr) {
123057
- if (!toolsStr)
123058
- return;
123059
- const tools = toolsStr.split(",").map((t) => t.trim()).filter(Boolean);
123060
- if (tools.length === 0)
123061
- return;
123062
- const result = {};
123063
- for (const tool3 of tools) {
123064
- result[tool3.toLowerCase()] = true;
123159
+ import { existsSync as existsSync84, readdirSync as readdirSync22 } from "fs";
123160
+ import { join as join87 } from "path";
123161
+
123162
+ // src/features/claude-code-agent-loader/agent-definitions-loader.ts
123163
+ import { existsSync as existsSync83, readFileSync as readFileSync57 } from "fs";
123164
+ import { basename as basename13, extname as extname8 } from "path";
123165
+ init_logger();
123166
+
123167
+ // src/features/claude-code-agent-loader/json-agent-loader.ts
123168
+ import { existsSync as existsSync82, readFileSync as readFileSync56 } from "fs";
123169
+ function parseJsonAgentFile(filePath, scope) {
123170
+ try {
123171
+ if (!existsSync82(filePath)) {
123172
+ return null;
123173
+ }
123174
+ const content = readFileSync56(filePath, "utf-8");
123175
+ const { data } = parseJsoncSafe(content);
123176
+ if (!data) {
123177
+ return null;
123178
+ }
123179
+ if (!data.name || !data.prompt) {
123180
+ return null;
123181
+ }
123182
+ const originalDescription = data.description ?? "";
123183
+ const formattedDescription = `(${scope}) ${originalDescription}`;
123184
+ const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
123185
+ const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
123186
+ const config4 = {
123187
+ description: formattedDescription,
123188
+ mode: data.mode ?? "subagent",
123189
+ prompt: data.prompt.trim(),
123190
+ ...modelString ? { model: modelString } : {}
123191
+ };
123192
+ const toolsConfig = parseToolsConfig(data.tools);
123193
+ if (toolsConfig) {
123194
+ config4.tools = toolsConfig;
123195
+ }
123196
+ return {
123197
+ name: data.name,
123198
+ path: filePath,
123199
+ config: config4,
123200
+ scope
123201
+ };
123202
+ } catch {
123203
+ return null;
123204
+ }
123205
+ }
123206
+
123207
+ // src/features/claude-code-agent-loader/agent-definitions-loader.ts
123208
+ function parseMarkdownAgentFile(filePath, scope) {
123209
+ try {
123210
+ if (!existsSync83(filePath)) {
123211
+ return null;
123212
+ }
123213
+ const content = readFileSync57(filePath, "utf-8");
123214
+ const { data, body } = parseFrontmatter(content);
123215
+ const fileName = basename13(filePath);
123216
+ const agentName = fileName.replace(/\.md$/i, "");
123217
+ const name = data.name || agentName;
123218
+ const originalDescription = data.description || "";
123219
+ const formattedDescription = `(${scope}) ${originalDescription}`;
123220
+ const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
123221
+ const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
123222
+ const config4 = {
123223
+ description: formattedDescription,
123224
+ mode: data.mode || "subagent",
123225
+ prompt: body.trim(),
123226
+ ...modelString ? { model: modelString } : {}
123227
+ };
123228
+ const toolsConfig = parseToolsConfig(data.tools);
123229
+ if (toolsConfig) {
123230
+ config4.tools = toolsConfig;
123231
+ }
123232
+ return {
123233
+ name,
123234
+ path: filePath,
123235
+ config: config4,
123236
+ scope
123237
+ };
123238
+ } catch {
123239
+ return null;
123240
+ }
123241
+ }
123242
+ function loadAgentDefinitions(paths, scope) {
123243
+ const result = Object.create(null);
123244
+ for (const filePath of paths) {
123245
+ if (!existsSync83(filePath)) {
123246
+ log(`[agent-definitions-loader] File not found, skipping: ${filePath}`);
123247
+ continue;
123248
+ }
123249
+ const ext = extname8(filePath).toLowerCase();
123250
+ let agent = null;
123251
+ if (ext === ".md") {
123252
+ agent = parseMarkdownAgentFile(filePath, scope);
123253
+ } else if (ext === ".json" || ext === ".jsonc") {
123254
+ agent = parseJsonAgentFile(filePath, scope);
123255
+ } else {
123256
+ log(`[agent-definitions-loader] Unsupported file extension: ${ext} for ${filePath}`);
123257
+ continue;
123258
+ }
123259
+ if (!agent) {
123260
+ log(`[agent-definitions-loader] Failed to parse agent file: ${filePath}`);
123261
+ continue;
123262
+ }
123263
+ result[agent.name] = agent.config;
123065
123264
  }
123066
123265
  return result;
123067
123266
  }
123267
+
123268
+ // src/features/claude-code-agent-loader/loader.ts
123068
123269
  function loadAgentsFromDir(agentsDir, scope) {
123069
- if (!existsSync82(agentsDir)) {
123270
+ if (!existsSync84(agentsDir)) {
123070
123271
  return [];
123071
123272
  }
123072
123273
  const entries = readdirSync22(agentsDir, { withFileTypes: true });
@@ -123075,33 +123276,9 @@ function loadAgentsFromDir(agentsDir, scope) {
123075
123276
  if (!isMarkdownFile(entry))
123076
123277
  continue;
123077
123278
  const agentPath = join87(agentsDir, entry.name);
123078
- const agentName = basename13(entry.name, ".md");
123079
- try {
123080
- const content = readFileSync55(agentPath, "utf-8");
123081
- const { data, body } = parseFrontmatter(content);
123082
- const name = data.name || agentName;
123083
- const originalDescription = data.description || "";
123084
- const formattedDescription = `(${scope}) ${originalDescription}`;
123085
- const mappedModelOverride = mapClaudeModelToOpenCode(data.model);
123086
- const modelString = mappedModelOverride ? `${mappedModelOverride.providerID}/${mappedModelOverride.modelID}` : undefined;
123087
- const config4 = {
123088
- description: formattedDescription,
123089
- mode: data.mode || "subagent",
123090
- prompt: body.trim(),
123091
- ...modelString ? { model: modelString } : {}
123092
- };
123093
- const toolsConfig = parseToolsConfig2(data.tools);
123094
- if (toolsConfig) {
123095
- config4.tools = toolsConfig;
123096
- }
123097
- agents.push({
123098
- name,
123099
- path: agentPath,
123100
- config: config4,
123101
- scope
123102
- });
123103
- } catch {
123104
- continue;
123279
+ const agent = parseMarkdownAgentFile(agentPath, scope);
123280
+ if (agent) {
123281
+ agents.push(agent);
123105
123282
  }
123106
123283
  }
123107
123284
  return agents;
@@ -123109,7 +123286,7 @@ function loadAgentsFromDir(agentsDir, scope) {
123109
123286
  function loadUserAgents() {
123110
123287
  const userAgentsDir = join87(getClaudeConfigDir(), "agents");
123111
123288
  const agents = loadAgentsFromDir(userAgentsDir, "user");
123112
- const result = {};
123289
+ const result = Object.create(null);
123113
123290
  for (const agent of agents) {
123114
123291
  result[agent.name] = agent.config;
123115
123292
  }
@@ -123118,12 +123295,114 @@ function loadUserAgents() {
123118
123295
  function loadProjectAgents(directory) {
123119
123296
  const projectAgentsDir = join87(directory ?? process.cwd(), ".claude", "agents");
123120
123297
  const agents = loadAgentsFromDir(projectAgentsDir, "project");
123121
- const result = {};
123298
+ const result = Object.create(null);
123299
+ for (const agent of agents) {
123300
+ result[agent.name] = agent.config;
123301
+ }
123302
+ return result;
123303
+ }
123304
+ function loadOpencodeGlobalAgents() {
123305
+ const configDir = getOpenCodeConfigDir({ binary: "opencode" });
123306
+ const opencodeAgentsDir = join87(configDir, "agents");
123307
+ const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
123308
+ const result = Object.create(null);
123122
123309
  for (const agent of agents) {
123123
123310
  result[agent.name] = agent.config;
123124
123311
  }
123125
123312
  return result;
123126
123313
  }
123314
+ function loadOpencodeProjectAgents(directory) {
123315
+ const opencodeProjectDir = join87(directory ?? process.cwd(), ".opencode", "agents");
123316
+ const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
123317
+ const result = Object.create(null);
123318
+ for (const agent of agents) {
123319
+ result[agent.name] = agent.config;
123320
+ }
123321
+ return result;
123322
+ }
123323
+ // src/features/claude-code-agent-loader/opencode-config-agents-reader.ts
123324
+ import * as fs20 from "fs";
123325
+ import * as path13 from "path";
123326
+ function getConfigPaths4(directory) {
123327
+ const globalConfigDir = getOpenCodeConfigDir({ binary: "opencode" });
123328
+ const paths = [
123329
+ path13.join(directory, ".opencode", "opencode.json"),
123330
+ path13.join(directory, ".opencode", "opencode.jsonc"),
123331
+ path13.join(globalConfigDir, "opencode.json"),
123332
+ path13.join(globalConfigDir, "opencode.jsonc")
123333
+ ];
123334
+ return paths;
123335
+ }
123336
+ function convertInlineAgent(agentData) {
123337
+ if (!agentData || typeof agentData !== "object") {
123338
+ return null;
123339
+ }
123340
+ const agent = agentData;
123341
+ const description = agent.description ? `(opencode-config) ${String(agent.description)}` : "(opencode-config) ";
123342
+ const mappedModel = mapClaudeModelToOpenCode(agent.model ? String(agent.model) : undefined);
123343
+ const modelString = mappedModel ? `${mappedModel.providerID}/${mappedModel.modelID}` : undefined;
123344
+ const VALID_MODES = ["subagent", "primary", "all"];
123345
+ const rawMode = typeof agent.mode === "string" ? agent.mode : undefined;
123346
+ const mode = rawMode && VALID_MODES.includes(rawMode) ? rawMode : "subagent";
123347
+ const config4 = {
123348
+ description,
123349
+ mode,
123350
+ prompt: agent.prompt ? String(agent.prompt) : "",
123351
+ ...modelString ? { model: modelString } : {}
123352
+ };
123353
+ const toolsConfig = parseToolsConfig(agent.tools);
123354
+ if (toolsConfig) {
123355
+ config4.tools = toolsConfig;
123356
+ }
123357
+ return config4;
123358
+ }
123359
+ function readOpencodeConfigAgents(directory) {
123360
+ const result = Object.create(null);
123361
+ for (const configPath of getConfigPaths4(directory)) {
123362
+ try {
123363
+ if (!fs20.existsSync(configPath))
123364
+ continue;
123365
+ const content = fs20.readFileSync(configPath, "utf-8");
123366
+ const parseResult = parseJsoncSafe(content);
123367
+ if (!parseResult.data)
123368
+ continue;
123369
+ const configDir = path13.dirname(configPath);
123370
+ const agentsToLoad = parseResult.data.agents || parseResult.data.agent;
123371
+ if (agentsToLoad && typeof agentsToLoad === "object") {
123372
+ for (const [agentName, agentData] of Object.entries(agentsToLoad)) {
123373
+ if (Object.hasOwn(result, agentName))
123374
+ continue;
123375
+ const converted = convertInlineAgent(agentData);
123376
+ if (converted) {
123377
+ result[agentName] = converted;
123378
+ }
123379
+ }
123380
+ }
123381
+ if (parseResult.data.agent_definitions) {
123382
+ const definitionPaths = extractDefinitionPaths(parseResult.data.agent_definitions);
123383
+ const resolvedPaths = resolveAgentDefinitionPaths(definitionPaths, configDir, directory);
123384
+ const definitionAgents = loadAgentDefinitions(resolvedPaths, "opencode-config");
123385
+ for (const [name, config4] of Object.entries(definitionAgents)) {
123386
+ if (!Object.hasOwn(result, name)) {
123387
+ result[name] = config4;
123388
+ }
123389
+ }
123390
+ }
123391
+ } catch {
123392
+ continue;
123393
+ }
123394
+ }
123395
+ return result;
123396
+ }
123397
+ function extractDefinitionPaths(definitionPaths) {
123398
+ if (typeof definitionPaths === "string") {
123399
+ return [definitionPaths];
123400
+ }
123401
+ if (Array.isArray(definitionPaths)) {
123402
+ return definitionPaths.filter((p) => typeof p === "string").map((p) => p);
123403
+ }
123404
+ return [];
123405
+ }
123127
123406
  // src/tools/delegate-task/subagent-discovery.ts
123128
123407
  function sanitizeSubagentType(subagentType) {
123129
123408
  return subagentType.trim().replace(/^[\\\/"']+|[\\\/"']+$/g, "").trim();
@@ -123526,7 +123805,7 @@ function createDelegateTask(options) {
123526
123805
  // src/tools/delegate-task/index.ts
123527
123806
  init_constants();
123528
123807
  // src/tools/task/task-create.ts
123529
- import { join as join89 } from "path";
123808
+ import { join as join90 } from "path";
123530
123809
 
123531
123810
  // src/tools/task/types.ts
123532
123811
  var TaskStatusSchema = exports_external.enum(["pending", "in_progress", "completed", "deleted"]);
@@ -123580,18 +123859,18 @@ var TaskDeleteInputSchema = exports_external.object({
123580
123859
  });
123581
123860
 
123582
123861
  // src/features/claude-tasks/storage.ts
123583
- import { join as join88, dirname as dirname29, basename as basename14, isAbsolute as isAbsolute11 } from "path";
123584
- import { existsSync as existsSync83, mkdirSync as mkdirSync17, readFileSync as readFileSync56, writeFileSync as writeFileSync21, renameSync as renameSync5, unlinkSync as unlinkSync13, readdirSync as readdirSync23 } from "fs";
123862
+ import { join as join89, dirname as dirname30, basename as basename14, isAbsolute as isAbsolute12 } from "path";
123863
+ import { existsSync as existsSync86, mkdirSync as mkdirSync17, readFileSync as readFileSync59, writeFileSync as writeFileSync21, renameSync as renameSync5, unlinkSync as unlinkSync13, readdirSync as readdirSync23 } from "fs";
123585
123864
  import { randomUUID as randomUUID3 } from "crypto";
123586
123865
  function getTaskDir(config4 = {}) {
123587
123866
  const tasksConfig = config4.sisyphus?.tasks;
123588
123867
  const storagePath = tasksConfig?.storage_path;
123589
123868
  if (storagePath) {
123590
- return isAbsolute11(storagePath) ? storagePath : join88(process.cwd(), storagePath);
123869
+ return isAbsolute12(storagePath) ? storagePath : join89(process.cwd(), storagePath);
123591
123870
  }
123592
123871
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
123593
123872
  const listId = resolveTaskListId(config4);
123594
- return join88(configDir, "tasks", listId);
123873
+ return join89(configDir, "tasks", listId);
123595
123874
  }
123596
123875
  function sanitizePathSegment(value) {
123597
123876
  return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
@@ -123609,16 +123888,16 @@ function resolveTaskListId(config4 = {}) {
123609
123888
  return sanitizePathSegment(basename14(process.cwd()));
123610
123889
  }
123611
123890
  function ensureDir(dirPath) {
123612
- if (!existsSync83(dirPath)) {
123891
+ if (!existsSync86(dirPath)) {
123613
123892
  mkdirSync17(dirPath, { recursive: true });
123614
123893
  }
123615
123894
  }
123616
123895
  function readJsonSafe(filePath, schema2) {
123617
123896
  try {
123618
- if (!existsSync83(filePath)) {
123897
+ if (!existsSync86(filePath)) {
123619
123898
  return null;
123620
123899
  }
123621
- const content = readFileSync56(filePath, "utf-8");
123900
+ const content = readFileSync59(filePath, "utf-8");
123622
123901
  const parsed = JSON.parse(content);
123623
123902
  const result = schema2.safeParse(parsed);
123624
123903
  if (!result.success) {
@@ -123630,7 +123909,7 @@ function readJsonSafe(filePath, schema2) {
123630
123909
  }
123631
123910
  }
123632
123911
  function writeJsonAtomic(filePath, data) {
123633
- const dir = dirname29(filePath);
123912
+ const dir = dirname30(filePath);
123634
123913
  ensureDir(dir);
123635
123914
  const tempPath = `${filePath}.tmp.${Date.now()}`;
123636
123915
  try {
@@ -123638,7 +123917,7 @@ function writeJsonAtomic(filePath, data) {
123638
123917
  renameSync5(tempPath, filePath);
123639
123918
  } catch (error92) {
123640
123919
  try {
123641
- if (existsSync83(tempPath)) {
123920
+ if (existsSync86(tempPath)) {
123642
123921
  unlinkSync13(tempPath);
123643
123922
  }
123644
123923
  } catch {}
@@ -123650,7 +123929,7 @@ function generateTaskId() {
123650
123929
  return `T-${randomUUID3()}`;
123651
123930
  }
123652
123931
  function acquireLock(dirPath) {
123653
- const lockPath = join88(dirPath, ".lock");
123932
+ const lockPath = join89(dirPath, ".lock");
123654
123933
  const lockId = randomUUID3();
123655
123934
  const createLock = (timestamp2) => {
123656
123935
  writeFileSync21(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
@@ -123660,7 +123939,7 @@ function acquireLock(dirPath) {
123660
123939
  };
123661
123940
  const isStale = () => {
123662
123941
  try {
123663
- const lockContent = readFileSync56(lockPath, "utf-8");
123942
+ const lockContent = readFileSync59(lockPath, "utf-8");
123664
123943
  const lockData = JSON.parse(lockContent);
123665
123944
  const lockAge = Date.now() - lockData.timestamp;
123666
123945
  return lockAge > STALE_LOCK_THRESHOLD_MS;
@@ -123698,9 +123977,9 @@ function acquireLock(dirPath) {
123698
123977
  acquired: true,
123699
123978
  release: () => {
123700
123979
  try {
123701
- if (!existsSync83(lockPath))
123980
+ if (!existsSync86(lockPath))
123702
123981
  return;
123703
- const lockContent = readFileSync56(lockPath, "utf-8");
123982
+ const lockContent = readFileSync59(lockPath, "utf-8");
123704
123983
  const lockData = JSON.parse(lockContent);
123705
123984
  if (lockData.id !== lockId)
123706
123985
  return;
@@ -123863,7 +124142,7 @@ async function handleCreate(args, config4, ctx, context) {
123863
124142
  threadID: context.sessionID
123864
124143
  };
123865
124144
  const validatedTask = TaskObjectSchema.parse(task);
123866
- writeJsonAtomic(join89(taskDir, `${taskId}.json`), validatedTask);
124145
+ writeJsonAtomic(join90(taskDir, `${taskId}.json`), validatedTask);
123867
124146
  await syncTaskTodoUpdate(ctx, validatedTask, context.sessionID);
123868
124147
  return JSON.stringify({
123869
124148
  task: {
@@ -123885,7 +124164,7 @@ async function handleCreate(args, config4, ctx, context) {
123885
124164
  }
123886
124165
  }
123887
124166
  // src/tools/task/task-get.ts
123888
- import { join as join90 } from "path";
124167
+ import { join as join91 } from "path";
123889
124168
  var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
123890
124169
  function parseTaskId(id) {
123891
124170
  if (!TASK_ID_PATTERN.test(id))
@@ -123910,7 +124189,7 @@ Returns null if the task does not exist or the file is invalid.`,
123910
124189
  return JSON.stringify({ error: "invalid_task_id" });
123911
124190
  }
123912
124191
  const taskDir = getTaskDir(config4);
123913
- const taskPath = join90(taskDir, `${taskId}.json`);
124192
+ const taskPath = join91(taskDir, `${taskId}.json`);
123914
124193
  const task = readJsonSafe(taskPath, TaskObjectSchema);
123915
124194
  return JSON.stringify({ task: task ?? null });
123916
124195
  } catch (error92) {
@@ -123923,8 +124202,8 @@ Returns null if the task does not exist or the file is invalid.`,
123923
124202
  });
123924
124203
  }
123925
124204
  // src/tools/task/task-list.ts
123926
- import { join as join91 } from "path";
123927
- import { existsSync as existsSync84, readdirSync as readdirSync24 } from "fs";
124205
+ import { join as join92 } from "path";
124206
+ import { existsSync as existsSync87, readdirSync as readdirSync24 } from "fs";
123928
124207
  function createTaskList(config4) {
123929
124208
  return tool({
123930
124209
  description: `List all active tasks with summary information.
@@ -123935,7 +124214,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
123935
124214
  args: {},
123936
124215
  execute: async () => {
123937
124216
  const taskDir = getTaskDir(config4);
123938
- if (!existsSync84(taskDir)) {
124217
+ if (!existsSync87(taskDir)) {
123939
124218
  return JSON.stringify({ tasks: [] });
123940
124219
  }
123941
124220
  const files = readdirSync24(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
@@ -123944,7 +124223,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
123944
124223
  }
123945
124224
  const allTasks = [];
123946
124225
  for (const fileId of files) {
123947
- const task = readJsonSafe(join91(taskDir, `${fileId}.json`), TaskObjectSchema);
124226
+ const task = readJsonSafe(join92(taskDir, `${fileId}.json`), TaskObjectSchema);
123948
124227
  if (task) {
123949
124228
  allTasks.push(task);
123950
124229
  }
@@ -123972,7 +124251,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
123972
124251
  });
123973
124252
  }
123974
124253
  // src/tools/task/task-update.ts
123975
- import { join as join92 } from "path";
124254
+ import { join as join93 } from "path";
123976
124255
  var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
123977
124256
  function parseTaskId2(id) {
123978
124257
  if (!TASK_ID_PATTERN2.test(id))
@@ -124020,7 +124299,7 @@ async function handleUpdate(args, config4, ctx, context) {
124020
124299
  return JSON.stringify({ error: "task_lock_unavailable" });
124021
124300
  }
124022
124301
  try {
124023
- const taskPath = join92(taskDir, `${taskId}.json`);
124302
+ const taskPath = join93(taskDir, `${taskId}.json`);
124024
124303
  const task = readJsonSafe(taskPath, TaskObjectSchema);
124025
124304
  if (!task) {
124026
124305
  return JSON.stringify({ error: "task_not_found" });
@@ -124814,16 +125093,16 @@ class Diff {
124814
125093
  }
124815
125094
  }
124816
125095
  }
124817
- addToPath(path13, added, removed, oldPosInc, options) {
124818
- const last = path13.lastComponent;
125096
+ addToPath(path14, added, removed, oldPosInc, options) {
125097
+ const last = path14.lastComponent;
124819
125098
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
124820
125099
  return {
124821
- oldPos: path13.oldPos + oldPosInc,
125100
+ oldPos: path14.oldPos + oldPosInc,
124822
125101
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
124823
125102
  };
124824
125103
  } else {
124825
125104
  return {
124826
- oldPos: path13.oldPos + oldPosInc,
125105
+ oldPos: path14.oldPos + oldPosInc,
124827
125106
  lastComponent: { count: 1, added, removed, previousComponent: last }
124828
125107
  };
124829
125108
  }
@@ -125315,10 +125594,10 @@ function normalizeHashlineEdits(rawEdits) {
125315
125594
  }
125316
125595
 
125317
125596
  // src/tools/hashline-edit/formatter-trigger.ts
125318
- import path13 from "path";
125597
+ import path14 from "path";
125319
125598
  var cachedFormattersByDirectory = new Map;
125320
125599
  function getFormatterCacheKey(directory) {
125321
- return path13.resolve(directory);
125600
+ return path14.resolve(directory);
125322
125601
  }
125323
125602
  async function resolveFormatters(client2, directory) {
125324
125603
  const cacheKey = getFormatterCacheKey(directory);
@@ -125369,7 +125648,7 @@ function buildFormatterCommand(command, filePath) {
125369
125648
  return command.map((arg) => arg.replace(/\$FILE/g, filePath));
125370
125649
  }
125371
125650
  async function runFormattersForFile(client2, directory, filePath) {
125372
- const ext = path13.extname(filePath);
125651
+ const ext = path14.extname(filePath);
125373
125652
  if (!ext)
125374
125653
  return;
125375
125654
  const formatters = await resolveFormatters(client2, directory);
@@ -126077,8 +126356,8 @@ function createUnstableAgentBabysitter(args) {
126077
126356
  directory: ctx.directory,
126078
126357
  client: {
126079
126358
  session: {
126080
- messages: async ({ path: path14 }) => {
126081
- const result = await ctx.client.session.messages({ path: path14 });
126359
+ messages: async ({ path: path15 }) => {
126360
+ const result = await ctx.client.session.messages({ path: path15 });
126082
126361
  if (Array.isArray(result))
126083
126362
  return result;
126084
126363
  if (typeof result === "object" && result !== null) {
@@ -126367,14 +126646,14 @@ class ConcurrencyManager {
126367
126646
  this.counts.set(model, current + 1);
126368
126647
  return;
126369
126648
  }
126370
- return new Promise((resolve20, reject) => {
126649
+ return new Promise((resolve21, reject) => {
126371
126650
  const queue = this.queues.get(model) ?? [];
126372
126651
  const entry = {
126373
126652
  resolve: () => {
126374
126653
  if (entry.settled)
126375
126654
  return;
126376
126655
  entry.settled = true;
126377
- resolve20();
126656
+ resolve21();
126378
126657
  },
126379
126658
  rawReject: reject,
126380
126659
  settled: false
@@ -126581,9 +126860,9 @@ async function abortWithTimeout(client2, sessionID, timeoutMs = 1e4) {
126581
126860
  try {
126582
126861
  const result = await Promise.race([
126583
126862
  client2.session.abort({ path: { id: sessionID } }).then(() => "aborted"),
126584
- new Promise((resolve20) => {
126863
+ new Promise((resolve21) => {
126585
126864
  timeoutHandle = setTimeout(() => {
126586
- resolve20("timed_out");
126865
+ resolve21("timed_out");
126587
126866
  }, timeoutMs);
126588
126867
  })
126589
126868
  ]);
@@ -126766,8 +127045,8 @@ function unregisterManagerForCleanup(manager) {
126766
127045
  }
126767
127046
 
126768
127047
  // src/features/background-agent/compaction-aware-message-resolver.ts
126769
- import { readdirSync as readdirSync25, readFileSync as readFileSync57 } from "fs";
126770
- import { join as join93 } from "path";
127048
+ import { readdirSync as readdirSync25, readFileSync as readFileSync60 } from "fs";
127049
+ import { join as join94 } from "path";
126771
127050
  function hasFullAgentAndModel(message) {
126772
127051
  return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
126773
127052
  }
@@ -126846,7 +127125,7 @@ function findNearestMessageExcludingCompaction(messageDir, sessionID) {
126846
127125
  const messages = [];
126847
127126
  for (const file3 of files) {
126848
127127
  try {
126849
- const content = readFileSync57(join93(messageDir, file3), "utf-8");
127128
+ const content = readFileSync60(join94(messageDir, file3), "utf-8");
126850
127129
  const parsed = JSON.parse(content);
126851
127130
  if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
126852
127131
  continue;
@@ -126936,7 +127215,7 @@ function handleSessionIdleBackgroundEvent(args) {
126936
127215
  }
126937
127216
 
126938
127217
  // src/features/background-agent/manager.ts
126939
- import { join as join94 } from "path";
127218
+ import { join as join95 } from "path";
126940
127219
 
126941
127220
  // src/features/background-agent/task-poller.ts
126942
127221
  init_plugin_identity();
@@ -128612,7 +128891,7 @@ ${originalText}`;
128612
128891
  parentSessionID: task.parentSessionID
128613
128892
  });
128614
128893
  }
128615
- const messageDir = join94(MESSAGE_STORAGE, task.parentSessionID);
128894
+ const messageDir = join95(MESSAGE_STORAGE, task.parentSessionID);
128616
128895
  const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionID) : null;
128617
128896
  agent = currentMessage?.agent ?? task.parentAgent;
128618
128897
  model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
@@ -128943,11 +129222,11 @@ ${originalText}`;
128943
129222
  }
128944
129223
  }
128945
129224
  // src/features/mcp-oauth/storage.ts
128946
- import { chmodSync as chmodSync2, existsSync as existsSync85, mkdirSync as mkdirSync18, readFileSync as readFileSync58, renameSync as renameSync6, unlinkSync as unlinkSync14, writeFileSync as writeFileSync22 } from "fs";
128947
- import { dirname as dirname30, join as join95 } from "path";
129225
+ import { chmodSync as chmodSync2, existsSync as existsSync88, mkdirSync as mkdirSync18, readFileSync as readFileSync61, renameSync as renameSync6, unlinkSync as unlinkSync14, writeFileSync as writeFileSync22 } from "fs";
129226
+ import { dirname as dirname31, join as join96 } from "path";
128948
129227
  var STORAGE_FILE_NAME = "mcp-oauth.json";
128949
129228
  function getMcpOauthStoragePath() {
128950
- return join95(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
129229
+ return join96(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
128951
129230
  }
128952
129231
  function normalizeHost(serverHost) {
128953
129232
  let host = serverHost.trim();
@@ -128984,11 +129263,11 @@ function buildKey(serverHost, resource) {
128984
129263
  }
128985
129264
  function readStore() {
128986
129265
  const filePath = getMcpOauthStoragePath();
128987
- if (!existsSync85(filePath)) {
129266
+ if (!existsSync88(filePath)) {
128988
129267
  return null;
128989
129268
  }
128990
129269
  try {
128991
- const content = readFileSync58(filePath, "utf-8");
129270
+ const content = readFileSync61(filePath, "utf-8");
128992
129271
  return JSON.parse(content);
128993
129272
  } catch {
128994
129273
  return null;
@@ -128997,8 +129276,8 @@ function readStore() {
128997
129276
  function writeStore(store2) {
128998
129277
  const filePath = getMcpOauthStoragePath();
128999
129278
  try {
129000
- const dir = dirname30(filePath);
129001
- if (!existsSync85(dir)) {
129279
+ const dir = dirname31(filePath);
129280
+ if (!existsSync88(dir)) {
129002
129281
  mkdirSync18(dir, { recursive: true });
129003
129282
  }
129004
129283
  const tempPath = `${filePath}.tmp.${Date.now()}`;
@@ -129215,7 +129494,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
129215
129494
  }
129216
129495
  var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
129217
129496
  function startCallbackServer(port) {
129218
- return new Promise((resolve20, reject) => {
129497
+ return new Promise((resolve21, reject) => {
129219
129498
  let timeoutId;
129220
129499
  const server = createServer((request, response) => {
129221
129500
  clearTimeout(timeoutId);
@@ -129241,7 +129520,7 @@ function startCallbackServer(port) {
129241
129520
  response.writeHead(200, { "content-type": "text/html" });
129242
129521
  response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
129243
129522
  server.close();
129244
- resolve20({ code, state: state3 });
129523
+ resolve21({ code, state: state3 });
129245
129524
  });
129246
129525
  timeoutId = setTimeout(() => {
129247
129526
  server.close();
@@ -130978,7 +131257,7 @@ class Protocol {
130978
131257
  return;
130979
131258
  }
130980
131259
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
130981
- await new Promise((resolve20) => setTimeout(resolve20, pollInterval));
131260
+ await new Promise((resolve21) => setTimeout(resolve21, pollInterval));
130982
131261
  options?.signal?.throwIfAborted();
130983
131262
  }
130984
131263
  } catch (error92) {
@@ -130990,7 +131269,7 @@ class Protocol {
130990
131269
  }
130991
131270
  request(request, resultSchema, options) {
130992
131271
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
130993
- return new Promise((resolve20, reject) => {
131272
+ return new Promise((resolve21, reject) => {
130994
131273
  const earlyReject = (error92) => {
130995
131274
  reject(error92);
130996
131275
  };
@@ -131068,7 +131347,7 @@ class Protocol {
131068
131347
  if (!parseResult.success) {
131069
131348
  reject(parseResult.error);
131070
131349
  } else {
131071
- resolve20(parseResult.data);
131350
+ resolve21(parseResult.data);
131072
131351
  }
131073
131352
  } catch (error92) {
131074
131353
  reject(error92);
@@ -131259,12 +131538,12 @@ class Protocol {
131259
131538
  interval = task.pollInterval;
131260
131539
  }
131261
131540
  } catch {}
131262
- return new Promise((resolve20, reject) => {
131541
+ return new Promise((resolve21, reject) => {
131263
131542
  if (signal.aborted) {
131264
131543
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
131265
131544
  return;
131266
131545
  }
131267
- const timeoutId = setTimeout(resolve20, interval);
131546
+ const timeoutId = setTimeout(resolve21, interval);
131268
131547
  signal.addEventListener("abort", () => {
131269
131548
  clearTimeout(timeoutId);
131270
131549
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -133656,7 +133935,7 @@ class StdioClientTransport {
133656
133935
  if (this._process) {
133657
133936
  throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
133658
133937
  }
133659
- return new Promise((resolve20, reject) => {
133938
+ return new Promise((resolve21, reject) => {
133660
133939
  this._process = import_cross_spawn.default(this._serverParams.command, this._serverParams.args ?? [], {
133661
133940
  env: {
133662
133941
  ...getDefaultEnvironment(),
@@ -133672,7 +133951,7 @@ class StdioClientTransport {
133672
133951
  this.onerror?.(error92);
133673
133952
  });
133674
133953
  this._process.on("spawn", () => {
133675
- resolve20();
133954
+ resolve21();
133676
133955
  });
133677
133956
  this._process.on("close", (_code) => {
133678
133957
  this._process = undefined;
@@ -133719,20 +133998,20 @@ class StdioClientTransport {
133719
133998
  if (this._process) {
133720
133999
  const processToClose = this._process;
133721
134000
  this._process = undefined;
133722
- const closePromise = new Promise((resolve20) => {
134001
+ const closePromise = new Promise((resolve21) => {
133723
134002
  processToClose.once("close", () => {
133724
- resolve20();
134003
+ resolve21();
133725
134004
  });
133726
134005
  });
133727
134006
  try {
133728
134007
  processToClose.stdin?.end();
133729
134008
  } catch {}
133730
- await Promise.race([closePromise, new Promise((resolve20) => setTimeout(resolve20, 2000).unref())]);
134009
+ await Promise.race([closePromise, new Promise((resolve21) => setTimeout(resolve21, 2000).unref())]);
133731
134010
  if (processToClose.exitCode === null) {
133732
134011
  try {
133733
134012
  processToClose.kill("SIGTERM");
133734
134013
  } catch {}
133735
- await Promise.race([closePromise, new Promise((resolve20) => setTimeout(resolve20, 2000).unref())]);
134014
+ await Promise.race([closePromise, new Promise((resolve21) => setTimeout(resolve21, 2000).unref())]);
133736
134015
  }
133737
134016
  if (processToClose.exitCode === null) {
133738
134017
  try {
@@ -133743,15 +134022,15 @@ class StdioClientTransport {
133743
134022
  this._readBuffer.clear();
133744
134023
  }
133745
134024
  send(message) {
133746
- return new Promise((resolve20) => {
134025
+ return new Promise((resolve21) => {
133747
134026
  if (!this._process?.stdin) {
133748
134027
  throw new Error("Not connected");
133749
134028
  }
133750
134029
  const json4 = serializeMessage(message);
133751
134030
  if (this._process.stdin.write(json4)) {
133752
- resolve20();
134031
+ resolve21();
133753
134032
  } else {
133754
- this._process.stdin.once("drain", resolve20);
134033
+ this._process.stdin.once("drain", resolve21);
133755
134034
  }
133756
134035
  });
133757
134036
  }
@@ -135357,7 +135636,7 @@ class TmuxSessionManager {
135357
135636
  } catch (err) {
135358
135637
  log("[tmux-session-manager] session status check error", { error: String(err) });
135359
135638
  }
135360
- await new Promise((resolve20) => setTimeout(resolve20, SESSION_READY_POLL_INTERVAL_MS));
135639
+ await new Promise((resolve21) => setTimeout(resolve21, SESSION_READY_POLL_INTERVAL_MS));
135361
135640
  }
135362
135641
  log("[tmux-session-manager] session ready timeout", {
135363
135642
  sessionId,
@@ -135935,13 +136214,13 @@ async function isTmuxAvailable() {
135935
136214
  }
135936
136215
 
135937
136216
  // src/openclaw/reply-listener.ts
135938
- import { dirname as dirname32, join as join98 } from "path";
136217
+ import { dirname as dirname33, join as join99 } from "path";
135939
136218
 
135940
136219
  // src/openclaw/session-registry.ts
135941
136220
  import {
135942
- existsSync as existsSync86,
136221
+ existsSync as existsSync89,
135943
136222
  mkdirSync as mkdirSync19,
135944
- readFileSync as readFileSync59,
136223
+ readFileSync as readFileSync62,
135945
136224
  writeFileSync as writeFileSync23,
135946
136225
  openSync as openSync3,
135947
136226
  closeSync as closeSync3,
@@ -135950,11 +136229,11 @@ import {
135950
136229
  statSync as statSync11,
135951
136230
  constants as constants20
135952
136231
  } from "fs";
135953
- import { join as join96, dirname as dirname31 } from "path";
136232
+ import { join as join97, dirname as dirname32 } from "path";
135954
136233
  import { randomUUID as randomUUID4 } from "crypto";
135955
- var OPENCLAW_STORAGE_DIR = join96(getOpenCodeStorageDir(), "openclaw");
135956
- var REGISTRY_PATH = join96(OPENCLAW_STORAGE_DIR, "reply-session-registry.jsonl");
135957
- var REGISTRY_LOCK_PATH = join96(OPENCLAW_STORAGE_DIR, "reply-session-registry.lock");
136234
+ var OPENCLAW_STORAGE_DIR = join97(getOpenCodeStorageDir(), "openclaw");
136235
+ var REGISTRY_PATH = join97(OPENCLAW_STORAGE_DIR, "reply-session-registry.jsonl");
136236
+ var REGISTRY_LOCK_PATH = join97(OPENCLAW_STORAGE_DIR, "reply-session-registry.lock");
135958
136237
  var SECURE_FILE_MODE = 384;
135959
136238
  var MAX_AGE_MS = 24 * 60 * 60 * 1000;
135960
136239
  var LOCK_TIMEOUT_MS = 2000;
@@ -135962,8 +136241,8 @@ var LOCK_WAIT_TIMEOUT_MS = 4000;
135962
136241
  var LOCK_RETRY_MS = 20;
135963
136242
  var LOCK_STALE_MS = 1e4;
135964
136243
  function ensureRegistryDir() {
135965
- const registryDir = dirname31(REGISTRY_PATH);
135966
- if (!existsSync86(registryDir)) {
136244
+ const registryDir = dirname32(REGISTRY_PATH);
136245
+ if (!existsSync89(registryDir)) {
135967
136246
  mkdirSync19(registryDir, { recursive: true, mode: 448 });
135968
136247
  }
135969
136248
  }
@@ -135982,9 +136261,9 @@ function isPidAlive(pid) {
135982
136261
  }
135983
136262
  function readLockSnapshot() {
135984
136263
  try {
135985
- if (!existsSync86(REGISTRY_LOCK_PATH))
136264
+ if (!existsSync89(REGISTRY_LOCK_PATH))
135986
136265
  return null;
135987
- const raw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
136266
+ const raw = readFileSync62(REGISTRY_LOCK_PATH, "utf-8");
135988
136267
  const trimmed = raw.trim();
135989
136268
  if (!trimmed)
135990
136269
  return { raw, pid: null, token: null };
@@ -136008,9 +136287,9 @@ function readLockSnapshot() {
136008
136287
  }
136009
136288
  function removeLockIfUnchanged(snapshot) {
136010
136289
  try {
136011
- if (!existsSync86(REGISTRY_LOCK_PATH))
136290
+ if (!existsSync89(REGISTRY_LOCK_PATH))
136012
136291
  return false;
136013
- const currentRaw = readFileSync59(REGISTRY_LOCK_PATH, "utf-8");
136292
+ const currentRaw = readFileSync62(REGISTRY_LOCK_PATH, "utf-8");
136014
136293
  if (currentRaw !== snapshot.raw)
136015
136294
  return false;
136016
136295
  unlinkSync15(REGISTRY_LOCK_PATH);
@@ -136114,10 +136393,10 @@ function withRegistryLock(onLocked, onLockUnavailable) {
136114
136393
  }
136115
136394
  }
136116
136395
  function readAllMappingsUnsafe() {
136117
- if (!existsSync86(REGISTRY_PATH))
136396
+ if (!existsSync89(REGISTRY_PATH))
136118
136397
  return [];
136119
136398
  try {
136120
- const content = readFileSync59(REGISTRY_PATH, "utf-8");
136399
+ const content = readFileSync62(REGISTRY_PATH, "utf-8");
136121
136400
  return content.split(`
136122
136401
  `).filter((line) => line.trim()).map((line) => {
136123
136402
  try {
@@ -136172,7 +136451,7 @@ function removeSession(sessionId) {
136172
136451
  import {
136173
136452
  appendFileSync as appendFileSync6,
136174
136453
  chmodSync as chmodSync3,
136175
- existsSync as existsSync88,
136454
+ existsSync as existsSync91,
136176
136455
  renameSync as renameSync7,
136177
136456
  statSync as statSync12,
136178
136457
  unlinkSync as unlinkSync16,
@@ -136180,31 +136459,31 @@ import {
136180
136459
  } from "fs";
136181
136460
 
136182
136461
  // src/openclaw/reply-listener-paths.ts
136183
- import { existsSync as existsSync87, mkdirSync as mkdirSync20 } from "fs";
136184
- import { homedir as homedir16 } from "os";
136185
- import { join as join97 } from "path";
136462
+ import { existsSync as existsSync90, mkdirSync as mkdirSync20 } from "fs";
136463
+ import { homedir as homedir17 } from "os";
136464
+ import { join as join98 } from "path";
136186
136465
  var REPLY_LISTENER_SECURE_FILE_MODE = 384;
136187
136466
  function resolveReplyListenerHomeDir() {
136188
- return process.env.HOME ?? process.env.USERPROFILE ?? homedir16();
136467
+ return process.env.HOME ?? process.env.USERPROFILE ?? homedir17();
136189
136468
  }
136190
136469
  function getReplyListenerStateDir() {
136191
- return join97(resolveReplyListenerHomeDir(), ".omx", "state");
136470
+ return join98(resolveReplyListenerHomeDir(), ".omx", "state");
136192
136471
  }
136193
136472
  function getReplyListenerPidFilePath() {
136194
- return join97(getReplyListenerStateDir(), "reply-listener.pid");
136473
+ return join98(getReplyListenerStateDir(), "reply-listener.pid");
136195
136474
  }
136196
136475
  function getReplyListenerStateFilePath() {
136197
- return join97(getReplyListenerStateDir(), "reply-listener-state.json");
136476
+ return join98(getReplyListenerStateDir(), "reply-listener-state.json");
136198
136477
  }
136199
136478
  function getReplyListenerConfigFilePath() {
136200
- return join97(getReplyListenerStateDir(), "reply-listener-config.json");
136479
+ return join98(getReplyListenerStateDir(), "reply-listener-config.json");
136201
136480
  }
136202
136481
  function getReplyListenerLogFilePath() {
136203
- return join97(getReplyListenerStateDir(), "reply-listener.log");
136482
+ return join98(getReplyListenerStateDir(), "reply-listener.log");
136204
136483
  }
136205
136484
  function ensureReplyListenerStateDir() {
136206
136485
  const stateDir = getReplyListenerStateDir();
136207
- if (!existsSync87(stateDir)) {
136486
+ if (!existsSync90(stateDir)) {
136208
136487
  mkdirSync20(stateDir, { recursive: true, mode: 448 });
136209
136488
  }
136210
136489
  }
@@ -136220,13 +136499,13 @@ function writeSecureReplyListenerFile(filePath, content) {
136220
136499
  }
136221
136500
  function rotateReplyListenerLogIfNeeded(logPath) {
136222
136501
  try {
136223
- if (!existsSync88(logPath))
136502
+ if (!existsSync91(logPath))
136224
136503
  return;
136225
136504
  const stats = statSync12(logPath);
136226
136505
  if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
136227
136506
  return;
136228
136507
  const backupPath = `${logPath}.old`;
136229
- if (existsSync88(backupPath)) {
136508
+ if (existsSync91(backupPath)) {
136230
136509
  unlinkSync16(backupPath);
136231
136510
  }
136232
136511
  renameSync7(logPath, backupPath);
@@ -136267,7 +136546,7 @@ class ReplyListenerRateLimiter {
136267
136546
  }
136268
136547
 
136269
136548
  // src/openclaw/reply-listener-state.ts
136270
- import { existsSync as existsSync89, readFileSync as readFileSync60, unlinkSync as unlinkSync17 } from "fs";
136549
+ import { existsSync as existsSync92, readFileSync as readFileSync63, unlinkSync as unlinkSync17 } from "fs";
136271
136550
  var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
136272
136551
  function createDefaultReplyListenerState() {
136273
136552
  return {
@@ -136329,9 +136608,9 @@ function createPendingReplyListenerState(startupToken) {
136329
136608
  function readReplyListenerDaemonState() {
136330
136609
  try {
136331
136610
  const stateFilePath = getReplyListenerStateFilePath();
136332
- if (!existsSync89(stateFilePath))
136611
+ if (!existsSync92(stateFilePath))
136333
136612
  return null;
136334
- return normalizeReplyListenerState(JSON.parse(readFileSync60(stateFilePath, "utf-8")));
136613
+ return normalizeReplyListenerState(JSON.parse(readFileSync63(stateFilePath, "utf-8")));
136335
136614
  } catch {
136336
136615
  return null;
136337
136616
  }
@@ -136346,9 +136625,9 @@ function writeReplyListenerDaemonState(state3) {
136346
136625
  function readReplyListenerDaemonConfig() {
136347
136626
  try {
136348
136627
  const configFilePath = getReplyListenerConfigFilePath();
136349
- if (!existsSync89(configFilePath))
136628
+ if (!existsSync92(configFilePath))
136350
136629
  return null;
136351
- return JSON.parse(readFileSync60(configFilePath, "utf-8"));
136630
+ return JSON.parse(readFileSync63(configFilePath, "utf-8"));
136352
136631
  } catch {
136353
136632
  return null;
136354
136633
  }
@@ -136359,9 +136638,9 @@ function writeReplyListenerDaemonConfig(config4) {
136359
136638
  function readReplyListenerPid() {
136360
136639
  try {
136361
136640
  const pidFilePath = getReplyListenerPidFilePath();
136362
- if (!existsSync89(pidFilePath))
136641
+ if (!existsSync92(pidFilePath))
136363
136642
  return null;
136364
- const pid = Number.parseInt(readFileSync60(pidFilePath, "utf-8").trim(), 10);
136643
+ const pid = Number.parseInt(readFileSync63(pidFilePath, "utf-8").trim(), 10);
136365
136644
  return Number.isNaN(pid) ? null : pid;
136366
136645
  } catch {
136367
136646
  return null;
@@ -136372,7 +136651,7 @@ function writeReplyListenerPid(pid) {
136372
136651
  }
136373
136652
  function removeReplyListenerPid() {
136374
136653
  const pidFilePath = getReplyListenerPidFilePath();
136375
- if (existsSync89(pidFilePath)) {
136654
+ if (existsSync92(pidFilePath)) {
136376
136655
  unlinkSync17(pidFilePath);
136377
136656
  }
136378
136657
  }
@@ -136388,7 +136667,7 @@ function markReplyListenerStopped(state3, error92) {
136388
136667
  }
136389
136668
 
136390
136669
  // src/openclaw/reply-listener-process.ts
136391
- import { readFileSync as readFileSync61 } from "fs";
136670
+ import { readFileSync as readFileSync64 } from "fs";
136392
136671
  var {spawn: spawn25 } = globalThis.Bun;
136393
136672
  var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
136394
136673
  var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
@@ -136444,7 +136723,7 @@ function isReplyListenerProcessRunning(pid) {
136444
136723
  async function isReplyListenerDaemonProcess(pid) {
136445
136724
  try {
136446
136725
  if (process.platform === "linux") {
136447
- const cmdline = readFileSync61(`/proc/${pid}/cmdline`, "utf-8");
136726
+ const cmdline = readFileSync64(`/proc/${pid}/cmdline`, "utf-8");
136448
136727
  return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
136449
136728
  }
136450
136729
  const processInfo = spawn25(["ps", "-p", String(pid), "-o", "args="], {
@@ -136509,7 +136788,7 @@ async function waitForReplyListenerReady(options) {
136509
136788
  var PRUNE_INTERVAL_MS = 60 * 60 * 1000;
136510
136789
  var REPLY_LISTENER_STOP_TIMEOUT_MS = 1000;
136511
136790
  function sleep(ms) {
136512
- return new Promise((resolve20) => setTimeout(resolve20, ms));
136791
+ return new Promise((resolve21) => setTimeout(resolve21, ms));
136513
136792
  }
136514
136793
  async function terminateReplyListenerProcess(pid) {
136515
136794
  if (!isReplyListenerProcessRunning(pid))
@@ -136606,7 +136885,7 @@ async function startReplyListener(config4) {
136606
136885
  pendingState.configSignature = getReplyListenerRuntimeSignature(normalizedConfig);
136607
136886
  writeReplyListenerDaemonState(pendingState);
136608
136887
  const currentFile = import.meta.url;
136609
- const daemonScript = currentFile.endsWith(".ts") ? join98(dirname32(new URL(currentFile).pathname), "daemon.ts") : join98(dirname32(new URL(currentFile).pathname), "daemon.js");
136888
+ const daemonScript = currentFile.endsWith(".ts") ? join99(dirname33(new URL(currentFile).pathname), "daemon.ts") : join99(dirname33(new URL(currentFile).pathname), "daemon.js");
136610
136889
  try {
136611
136890
  const processInfo = spawnReplyListenerDaemon(daemonScript, startupToken);
136612
136891
  processInfo.unref();
@@ -136877,22 +137156,22 @@ async function dispatchOpenClawEvent(params) {
136877
137156
  return result;
136878
137157
  }
136879
137158
  // src/features/claude-code-mcp-loader/loader.ts
136880
- import { existsSync as existsSync90, readFileSync as readFileSync62 } from "fs";
136881
- import { join as join99 } from "path";
136882
- import { homedir as homedir17 } from "os";
137159
+ import { existsSync as existsSync93, readFileSync as readFileSync65 } from "fs";
137160
+ import { join as join100 } from "path";
137161
+ import { homedir as homedir18 } from "os";
136883
137162
  init_logger();
136884
137163
  function getMcpConfigPaths() {
136885
137164
  const claudeConfigDir = getClaudeConfigDir();
136886
137165
  const cwd = process.cwd();
136887
137166
  return [
136888
- { path: join99(homedir17(), ".claude.json"), scope: "user" },
136889
- { path: join99(claudeConfigDir, ".mcp.json"), scope: "user" },
136890
- { path: join99(cwd, ".mcp.json"), scope: "project" },
136891
- { path: join99(cwd, ".claude", ".mcp.json"), scope: "local" }
137167
+ { path: join100(homedir18(), ".claude.json"), scope: "user" },
137168
+ { path: join100(claudeConfigDir, ".mcp.json"), scope: "user" },
137169
+ { path: join100(cwd, ".mcp.json"), scope: "project" },
137170
+ { path: join100(cwd, ".claude", ".mcp.json"), scope: "local" }
136892
137171
  ];
136893
137172
  }
136894
137173
  async function loadMcpConfigFile(filePath) {
136895
- if (!existsSync90(filePath)) {
137174
+ if (!existsSync93(filePath)) {
136896
137175
  return null;
136897
137176
  }
136898
137177
  try {
@@ -136907,11 +137186,11 @@ function getSystemMcpServerNames() {
136907
137186
  const names = new Set;
136908
137187
  const paths = getMcpConfigPaths();
136909
137188
  const cwd = process.cwd();
136910
- for (const { path: path14 } of paths) {
136911
- if (!existsSync90(path14))
137189
+ for (const { path: path15 } of paths) {
137190
+ if (!existsSync93(path15))
136912
137191
  continue;
136913
137192
  try {
136914
- const content = readFileSync62(path14, "utf-8");
137193
+ const content = readFileSync65(path15, "utf-8");
136915
137194
  const config4 = JSON.parse(content);
136916
137195
  if (!config4?.mcpServers)
136917
137196
  continue;
@@ -136936,30 +137215,30 @@ async function loadMcpConfigs(disabledMcps = []) {
136936
137215
  const paths = getMcpConfigPaths();
136937
137216
  const disabledSet = new Set(disabledMcps);
136938
137217
  const cwd = process.cwd();
136939
- for (const { path: path14, scope } of paths) {
136940
- const config4 = await loadMcpConfigFile(path14);
137218
+ for (const { path: path15, scope } of paths) {
137219
+ const config4 = await loadMcpConfigFile(path15);
136941
137220
  if (!config4?.mcpServers)
136942
137221
  continue;
136943
137222
  for (const [name, serverConfig] of Object.entries(config4.mcpServers)) {
136944
137223
  if (disabledSet.has(name)) {
136945
- log(`Skipping MCP "${name}" (in disabled_mcps)`, { path: path14 });
137224
+ log(`Skipping MCP "${name}" (in disabled_mcps)`, { path: path15 });
136946
137225
  continue;
136947
137226
  }
136948
137227
  if (!shouldLoadMcpServer(serverConfig, cwd)) {
136949
137228
  log(`Skipping MCP server "${name}" because local scope does not match cwd`, {
136950
- path: path14,
137229
+ path: path15,
136951
137230
  projectPath: serverConfig.projectPath,
136952
137231
  cwd
136953
137232
  });
136954
137233
  continue;
136955
137234
  }
136956
137235
  if (serverConfig.disabled) {
136957
- log(`Disabling MCP server "${name}"`, { path: path14 });
137236
+ log(`Disabling MCP server "${name}"`, { path: path15 });
136958
137237
  delete servers[name];
136959
137238
  const existingIndex = loadedServers.findIndex((s) => s.name === name);
136960
137239
  if (existingIndex !== -1) {
136961
137240
  loadedServers.splice(existingIndex, 1);
136962
- log(`Removed previously loaded MCP server "${name}"`, { path: path14 });
137241
+ log(`Removed previously loaded MCP server "${name}"`, { path: path15 });
136963
137242
  }
136964
137243
  continue;
136965
137244
  }
@@ -136971,7 +137250,7 @@ async function loadMcpConfigs(disabledMcps = []) {
136971
137250
  loadedServers.splice(existingIndex, 1);
136972
137251
  }
136973
137252
  loadedServers.push({ name, scope, config: transformed });
136974
- log(`Loaded MCP server "${name}" from ${scope}`, { path: path14 });
137253
+ log(`Loaded MCP server "${name}" from ${scope}`, { path: path15 });
136975
137254
  } catch (error92) {
136976
137255
  log(`Failed to transform MCP server "${name}"`, error92);
136977
137256
  }
@@ -142306,9 +142585,9 @@ function createHephaestusAgent2(model, availableAgents, availableToolNames, avai
142306
142585
  }
142307
142586
  createHephaestusAgent2.mode = MODE10;
142308
142587
  // src/agents/builtin-agents/resolve-file-uri.ts
142309
- import { existsSync as existsSync91, readFileSync as readFileSync63 } from "fs";
142310
- import { homedir as homedir18 } from "os";
142311
- import { isAbsolute as isAbsolute12, resolve as resolve20 } from "path";
142588
+ import { existsSync as existsSync94, readFileSync as readFileSync66 } from "fs";
142589
+ import { homedir as homedir19 } from "os";
142590
+ import { isAbsolute as isAbsolute13, resolve as resolve21 } from "path";
142312
142591
  init_logger();
142313
142592
  function resolvePromptAppend(promptAppend, configDir) {
142314
142593
  if (!promptAppend.startsWith("file://"))
@@ -142317,8 +142596,8 @@ function resolvePromptAppend(promptAppend, configDir) {
142317
142596
  let filePath;
142318
142597
  try {
142319
142598
  const decoded = decodeURIComponent(encoded);
142320
- const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir18()}/`) : decoded;
142321
- filePath = isAbsolute12(expanded) ? expanded : resolve20(configDir ?? process.cwd(), expanded);
142599
+ const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir19()}/`) : decoded;
142600
+ filePath = isAbsolute13(expanded) ? expanded : resolve21(configDir ?? process.cwd(), expanded);
142322
142601
  } catch {
142323
142602
  return `[WARNING: Malformed file URI (invalid percent-encoding): ${promptAppend}]`;
142324
142603
  }
@@ -142331,11 +142610,11 @@ function resolvePromptAppend(promptAppend, configDir) {
142331
142610
  });
142332
142611
  return `[WARNING: Path rejected: ${promptAppend}]`;
142333
142612
  }
142334
- if (!existsSync91(filePath)) {
142613
+ if (!existsSync94(filePath)) {
142335
142614
  return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
142336
142615
  }
142337
142616
  try {
142338
- return readFileSync63(filePath, "utf8");
142617
+ return readFileSync66(filePath, "utf8");
142339
142618
  } catch {
142340
142619
  return `[WARNING: Could not read file: ${promptAppend}]`;
142341
142620
  }
@@ -145968,7 +146247,11 @@ async function applyAgentConfig(params) {
145968
146247
  const includeClaudeAgents = params.pluginConfig.claude_code?.agents ?? true;
145969
146248
  const userAgents = includeClaudeAgents ? loadUserAgents() : {};
145970
146249
  const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {};
146250
+ const opencodeGlobalAgents = loadOpencodeGlobalAgents();
146251
+ const opencodeProjectAgents = loadOpencodeProjectAgents(params.ctx.directory);
145971
146252
  const rawPluginAgents = params.pluginComponents.agents;
146253
+ const agentDefinitionAgents = params.pluginConfig.agent_definitions ? loadAgentDefinitions(params.pluginConfig.agent_definitions, "definition-file") : {};
146254
+ const opencodeConfigAgents = readOpencodeConfigAgents(params.ctx.directory);
145972
146255
  const pluginAgents = Object.fromEntries(Object.entries(rawPluginAgents).map(([key, value]) => {
145973
146256
  if (!value)
145974
146257
  return [key, value];
@@ -145982,11 +146265,25 @@ async function applyAgentConfig(params) {
145982
146265
  ...Object.entries(configAgent ?? {}),
145983
146266
  ...Object.entries(userAgents),
145984
146267
  ...Object.entries(projectAgents),
145985
- ...Object.entries(pluginAgents).filter(([, config4]) => config4 !== undefined)
146268
+ ...Object.entries(opencodeGlobalAgents),
146269
+ ...Object.entries(opencodeProjectAgents),
146270
+ ...Object.entries(pluginAgents).filter(([, config4]) => config4 !== undefined),
146271
+ ...Object.entries(agentDefinitionAgents),
146272
+ ...Object.entries(opencodeConfigAgents)
145986
146273
  ].filter(([, config4]) => config4 != null).map(([name, config4]) => ({
145987
146274
  name,
145988
146275
  description: typeof config4?.description === "string" ? config4.description : ""
145989
146276
  }));
146277
+ log("[agent-config-handler] Agent sources loaded", {
146278
+ user: Object.keys(userAgents).length,
146279
+ project: Object.keys(projectAgents).length,
146280
+ opencodeGlobal: Object.keys(opencodeGlobalAgents).length,
146281
+ opencodeProject: Object.keys(opencodeProjectAgents).length,
146282
+ plugin: Object.keys(pluginAgents).length,
146283
+ agentDefinitions: Object.keys(agentDefinitionAgents).length,
146284
+ opencodeConfig: Object.keys(opencodeConfigAgents).length,
146285
+ config: Object.keys(configAgent ?? {}).length
146286
+ });
145990
146287
  const builtinAgents = await createBuiltinAgents(migratedDisabledAgents, params.pluginConfig.agents, params.ctx.directory, currentModel, params.pluginConfig.categories, params.pluginConfig.git_master, allDiscoveredSkills, customAgentSummaries, browserProvider, currentModel, disabledSkills, useTaskSystem, disableOmoEnv);
145991
146288
  const disabledAgentNames = new Set((migratedDisabledAgents ?? []).map((a) => a.toLowerCase()));
145992
146289
  const filterDisabledAgents = (agents) => Object.fromEntries(Object.entries(agents).filter(([name]) => !disabledAgentNames.has(name.toLowerCase())));
@@ -146057,12 +146354,20 @@ async function applyAgentConfig(params) {
146057
146354
  const filteredUserAgents = filterProtectedAgentOverrides(userAgents, protectedBuiltinAgentNames);
146058
146355
  const filteredProjectAgents = filterProtectedAgentOverrides(projectAgents, protectedBuiltinAgentNames);
146059
146356
  const filteredPluginAgents = filterProtectedAgentOverrides(pluginAgents, protectedBuiltinAgentNames);
146357
+ const filteredOpencodeGlobalAgents = filterProtectedAgentOverrides(opencodeGlobalAgents, protectedBuiltinAgentNames);
146358
+ const filteredOpencodeProjectAgents = filterProtectedAgentOverrides(opencodeProjectAgents, protectedBuiltinAgentNames);
146359
+ const filteredAgentDefinitionAgents = filterProtectedAgentOverrides(agentDefinitionAgents, protectedBuiltinAgentNames);
146360
+ const filteredOpencodeConfigAgents = filterProtectedAgentOverrides(opencodeConfigAgents, protectedBuiltinAgentNames);
146060
146361
  params.config.agent = {
146061
146362
  ...agentConfig,
146062
146363
  ...Object.fromEntries(Object.entries(builtinAgents).filter(([key]) => key !== "sisyphus" && key !== "hephaestus" && key !== "atlas")),
146364
+ ...filterDisabledAgents(filteredPluginAgents),
146063
146365
  ...filterDisabledAgents(filteredUserAgents),
146366
+ ...filterDisabledAgents(filteredOpencodeGlobalAgents),
146064
146367
  ...filterDisabledAgents(filteredProjectAgents),
146065
- ...filterDisabledAgents(filteredPluginAgents),
146368
+ ...filterDisabledAgents(filteredOpencodeProjectAgents),
146369
+ ...filterDisabledAgents(filteredAgentDefinitionAgents),
146370
+ ...filterDisabledAgents(filteredOpencodeConfigAgents),
146066
146371
  ...filteredConfigAgents,
146067
146372
  build: { ...migratedBuild, mode: "subagent", hidden: true },
146068
146373
  ...planDemoteConfig ? { plan: planDemoteConfig } : {}
@@ -146072,6 +146377,10 @@ async function applyAgentConfig(params) {
146072
146377
  const filteredUserAgents = filterProtectedAgentOverrides(userAgents, protectedBuiltinAgentNames);
146073
146378
  const filteredProjectAgents = filterProtectedAgentOverrides(projectAgents, protectedBuiltinAgentNames);
146074
146379
  const filteredPluginAgents = filterProtectedAgentOverrides(pluginAgents, protectedBuiltinAgentNames);
146380
+ const filteredOpencodeGlobalAgents = filterProtectedAgentOverrides(opencodeGlobalAgents, protectedBuiltinAgentNames);
146381
+ const filteredOpencodeProjectAgents = filterProtectedAgentOverrides(opencodeProjectAgents, protectedBuiltinAgentNames);
146382
+ const filteredAgentDefinitionAgents = filterProtectedAgentOverrides(agentDefinitionAgents, protectedBuiltinAgentNames);
146383
+ const filteredOpencodeConfigAgents = filterProtectedAgentOverrides(opencodeConfigAgents, protectedBuiltinAgentNames);
146075
146384
  const defaultedConfigAgents = configAgent ? Object.fromEntries(Object.entries(configAgent).map(([key, value]) => {
146076
146385
  if (!value)
146077
146386
  return [key, value];
@@ -146082,9 +146391,13 @@ async function applyAgentConfig(params) {
146082
146391
  })) : {};
146083
146392
  params.config.agent = {
146084
146393
  ...builtinAgents,
146394
+ ...filterDisabledAgents(filteredPluginAgents),
146085
146395
  ...filterDisabledAgents(filteredUserAgents),
146396
+ ...filterDisabledAgents(filteredOpencodeGlobalAgents),
146086
146397
  ...filterDisabledAgents(filteredProjectAgents),
146087
- ...filterDisabledAgents(filteredPluginAgents),
146398
+ ...filterDisabledAgents(filteredOpencodeProjectAgents),
146399
+ ...filterDisabledAgents(filteredAgentDefinitionAgents),
146400
+ ...filterDisabledAgents(filteredOpencodeConfigAgents),
146088
146401
  ...defaultedConfigAgents
146089
146402
  };
146090
146403
  }
@@ -146103,18 +146416,18 @@ async function applyAgentConfig(params) {
146103
146416
  // src/plugin-handlers/command-config-handler.ts
146104
146417
  init_agent_display_names();
146105
146418
  // src/features/claude-code-command-loader/loader.ts
146106
- import { promises as fs20 } from "fs";
146107
- import { join as join100, basename as basename16 } from "path";
146419
+ import { promises as fs21 } from "fs";
146420
+ import { join as join101, basename as basename16 } from "path";
146108
146421
  init_logger();
146109
146422
  async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix = "") {
146110
146423
  try {
146111
- await fs20.access(commandsDir);
146424
+ await fs21.access(commandsDir);
146112
146425
  } catch {
146113
146426
  return [];
146114
146427
  }
146115
146428
  let realPath;
146116
146429
  try {
146117
- realPath = await fs20.realpath(commandsDir);
146430
+ realPath = await fs21.realpath(commandsDir);
146118
146431
  } catch (error92) {
146119
146432
  log(`Failed to resolve command directory: ${commandsDir}`, error92);
146120
146433
  return [];
@@ -146125,7 +146438,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
146125
146438
  visited.add(realPath);
146126
146439
  let entries;
146127
146440
  try {
146128
- entries = await fs20.readdir(commandsDir, { withFileTypes: true });
146441
+ entries = await fs21.readdir(commandsDir, { withFileTypes: true });
146129
146442
  } catch (error92) {
146130
146443
  log(`Failed to read command directory: ${commandsDir}`, error92);
146131
146444
  return [];
@@ -146135,7 +146448,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
146135
146448
  if (entry.isDirectory()) {
146136
146449
  if (entry.name.startsWith("."))
146137
146450
  continue;
146138
- const subDirPath = join100(commandsDir, entry.name);
146451
+ const subDirPath = join101(commandsDir, entry.name);
146139
146452
  const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
146140
146453
  const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
146141
146454
  commands3.push(...subCommands);
@@ -146143,11 +146456,11 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
146143
146456
  }
146144
146457
  if (!isMarkdownFile(entry))
146145
146458
  continue;
146146
- const commandPath = join100(commandsDir, entry.name);
146459
+ const commandPath = join101(commandsDir, entry.name);
146147
146460
  const baseCommandName = basename16(entry.name, ".md");
146148
146461
  const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
146149
146462
  try {
146150
- const content = await fs20.readFile(commandPath, "utf-8");
146463
+ const content = await fs21.readFile(commandPath, "utf-8");
146151
146464
  const { data, body } = parseFrontmatter(content);
146152
146465
  const wrappedTemplate = `<command-instruction>
146153
146466
  ${body.trim()}
@@ -146202,12 +146515,12 @@ function commandsToRecord(commands3) {
146202
146515
  return result;
146203
146516
  }
146204
146517
  async function loadUserCommands() {
146205
- const userCommandsDir = join100(getClaudeConfigDir(), "commands");
146518
+ const userCommandsDir = join101(getClaudeConfigDir(), "commands");
146206
146519
  const commands3 = await loadCommandsFromDir(userCommandsDir, "user");
146207
146520
  return commandsToRecord(commands3);
146208
146521
  }
146209
146522
  async function loadProjectCommands(directory) {
146210
- const projectCommandsDir = join100(directory ?? process.cwd(), ".claude", "commands");
146523
+ const projectCommandsDir = join101(directory ?? process.cwd(), ".claude", "commands");
146211
146524
  const commands3 = await loadCommandsFromDir(projectCommandsDir, "project");
146212
146525
  return commandsToRecord(commands3);
146213
146526
  }
@@ -147258,10 +147571,10 @@ init_agent_display_names();
147258
147571
 
147259
147572
  // src/plugin/ultrawork-db-model-override.ts
147260
147573
  import { Database } from "bun:sqlite";
147261
- import { join as join101 } from "path";
147262
- import { existsSync as existsSync92 } from "fs";
147574
+ import { join as join102 } from "path";
147575
+ import { existsSync as existsSync95 } from "fs";
147263
147576
  function getDbPath() {
147264
- return join101(getDataDir(), "opencode", "opencode.db");
147577
+ return join102(getDataDir(), "opencode", "opencode.db");
147265
147578
  }
147266
147579
  var MAX_MICROTASK_RETRIES = 10;
147267
147580
  function tryUpdateMessageModel(db, messageId, targetModel, variant) {
@@ -147338,7 +147651,7 @@ function retryViaMicrotask(db, messageId, targetModel, variant, attempt) {
147338
147651
  function scheduleDeferredModelOverride(messageId, targetModel, variant) {
147339
147652
  queueMicrotask(() => {
147340
147653
  const dbPath = getDbPath();
147341
- if (!existsSync92(dbPath)) {
147654
+ if (!existsSync95(dbPath)) {
147342
147655
  log("[ultrawork-db-override] DB not found, skipping deferred override");
147343
147656
  return;
147344
147657
  }
@@ -148282,6 +148595,7 @@ function createEventHandler2(args) {
148282
148595
  }
148283
148596
 
148284
148597
  // src/plugin/tool-execute-after.ts
148598
+ init_agent_display_names();
148285
148599
  var VERIFICATION_ATTEMPT_PATTERN = /<ulw_verification_attempt_id>(.*?)<\/ulw_verification_attempt_id>/i;
148286
148600
  function getMetadataString(metadata, keys) {
148287
148601
  for (const key of keys) {
@@ -148319,7 +148633,7 @@ function createToolExecuteAfterHandler3(args) {
148319
148633
  const prompt = getMetadataString(output.metadata, ["prompt"]);
148320
148634
  const verificationAttemptId = prompt?.match(VERIFICATION_ATTEMPT_PATTERN)?.[1]?.trim();
148321
148635
  const loopState = directory ? readState(directory) : null;
148322
- const isVerificationContext = agent === "oracle" && !!sessionId && !!directory && loopState?.active === true && loopState.ultrawork === true && loopState.verification_pending === true && loopState.session_id === input.sessionID;
148636
+ const isVerificationContext = (agent ? stripInvisibleAgentCharacters(agent) : agent) === "oracle" && !!sessionId && !!directory && loopState?.active === true && loopState.ultrawork === true && loopState.verification_pending === true && loopState.session_id === input.sessionID;
148323
148637
  log("[tool-execute-after] ULW verification tracking check", {
148324
148638
  tool: input.tool,
148325
148639
  agent,
@@ -148401,6 +148715,7 @@ function createToolExecuteAfterHandler3(args) {
148401
148715
 
148402
148716
  // src/plugin/tool-execute-before.ts
148403
148717
  import { randomUUID as randomUUID6 } from "crypto";
148718
+ init_agent_display_names();
148404
148719
 
148405
148720
  // src/plugin/session-agent-resolver.ts
148406
148721
  async function resolveSessionAgent(client2, sessionId) {
@@ -148502,7 +148817,7 @@ function createToolExecuteBeforeHandler3(args) {
148502
148817
  const resolvedAgent = await resolveSessionAgent(ctx.client, sessionId);
148503
148818
  argsObject.subagent_type = resolvedAgent ?? "continue";
148504
148819
  }
148505
- const normalizedSubagentType = typeof argsObject.subagent_type === "string" ? argsObject.subagent_type : undefined;
148820
+ const normalizedSubagentType = typeof argsObject.subagent_type === "string" ? stripInvisibleAgentCharacters(argsObject.subagent_type) : undefined;
148506
148821
  const prompt = typeof argsObject.prompt === "string" ? argsObject.prompt : "";
148507
148822
  const loopState = typeof ctx.directory === "string" ? readState(ctx.directory) : null;
148508
148823
  const shouldInjectOracleVerification = normalizedSubagentType === "oracle" && loopState?.active === true && loopState.ultrawork === true && loopState.verification_pending === true && loopState.session_id === input.sessionID;
@@ -148696,7 +149011,7 @@ import os6 from "os";
148696
149011
  import { createHash as createHash3 } from "crypto";
148697
149012
 
148698
149013
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
148699
- import { dirname as dirname33, posix, sep as sep3 } from "path";
149014
+ import { dirname as dirname34, posix, sep as sep3 } from "path";
148700
149015
  function createModulerModifier() {
148701
149016
  const getModuleFromFileName = createGetModuleFromFilename();
148702
149017
  return async (frames) => {
@@ -148705,7 +149020,7 @@ function createModulerModifier() {
148705
149020
  return frames;
148706
149021
  };
148707
149022
  }
148708
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname33(process.argv[1]) : process.cwd(), isWindows2 = sep3 === "\\") {
149023
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname34(process.argv[1]) : process.cwd(), isWindows2 = sep3 === "\\") {
148709
149024
  const normalizedBase = isWindows2 ? normalizeWindowsPath(basePath) : basePath;
148710
149025
  return (filename) => {
148711
149026
  if (!filename)
@@ -148727,8 +149042,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname33(proc
148727
149042
  return decodedFile;
148728
149043
  };
148729
149044
  }
148730
- function normalizeWindowsPath(path14) {
148731
- return path14.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
149045
+ function normalizeWindowsPath(path15) {
149046
+ return path15.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
148732
149047
  }
148733
149048
 
148734
149049
  // node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -151043,15 +151358,15 @@ async function addSourceContext(frames) {
151043
151358
  LRU_FILE_CONTENTS_CACHE.reduce();
151044
151359
  return frames;
151045
151360
  }
151046
- function getContextLinesFromFile(path14, ranges, output) {
151047
- return new Promise((resolve21) => {
151048
- const stream = createReadStream(path14);
151361
+ function getContextLinesFromFile(path15, ranges, output) {
151362
+ return new Promise((resolve22) => {
151363
+ const stream = createReadStream(path15);
151049
151364
  const lineReaded = createInterface({
151050
151365
  input: stream
151051
151366
  });
151052
151367
  function destroyStreamAndResolve() {
151053
151368
  stream.destroy();
151054
- resolve21();
151369
+ resolve22();
151055
151370
  }
151056
151371
  let lineNumber = 0;
151057
151372
  let currentRangeIndex = 0;
@@ -151061,7 +151376,7 @@ function getContextLinesFromFile(path14, ranges, output) {
151061
151376
  let rangeStart = range[0];
151062
151377
  let rangeEnd = range[1];
151063
151378
  function onStreamError() {
151064
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path14, 1);
151379
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path15, 1);
151065
151380
  lineReaded.close();
151066
151381
  lineReaded.removeAllListeners();
151067
151382
  destroyStreamAndResolve();
@@ -151129,8 +151444,8 @@ function clearLineContext(frame) {
151129
151444
  delete frame.context_line;
151130
151445
  delete frame.post_context;
151131
151446
  }
151132
- function shouldSkipContextLinesForFile(path14) {
151133
- return path14.startsWith("node:") || path14.endsWith(".min.js") || path14.endsWith(".min.cjs") || path14.endsWith(".min.mjs") || path14.startsWith("data:");
151447
+ function shouldSkipContextLinesForFile(path15) {
151448
+ return path15.startsWith("node:") || path15.endsWith(".min.js") || path15.endsWith(".min.cjs") || path15.endsWith(".min.mjs") || path15.startsWith("data:");
151134
151449
  }
151135
151450
  function shouldSkipContextLinesForFrame(frame) {
151136
151451
  if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO)
@@ -152291,9 +152606,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
152291
152606
  if (this.disabled || this.optedOut)
152292
152607
  return;
152293
152608
  if (!this._waitUntilCycle) {
152294
- let resolve21;
152609
+ let resolve22;
152295
152610
  const promise4 = new Promise((r) => {
152296
- resolve21 = r;
152611
+ resolve22 = r;
152297
152612
  });
152298
152613
  try {
152299
152614
  waitUntil(promise4);
@@ -152301,7 +152616,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
152301
152616
  return;
152302
152617
  }
152303
152618
  this._waitUntilCycle = {
152304
- resolve: resolve21,
152619
+ resolve: resolve22,
152305
152620
  startedAt: Date.now(),
152306
152621
  timer: undefined
152307
152622
  };
@@ -152327,11 +152642,11 @@ class PostHogBackendClient extends PostHogCoreStateless {
152327
152642
  return cycle?.resolve;
152328
152643
  }
152329
152644
  async resolveWaitUntilFlush() {
152330
- const resolve21 = this._consumeWaitUntilCycle();
152645
+ const resolve22 = this._consumeWaitUntilCycle();
152331
152646
  try {
152332
152647
  await super.flush();
152333
152648
  } catch {} finally {
152334
- resolve21?.();
152649
+ resolve22?.();
152335
152650
  }
152336
152651
  }
152337
152652
  getPersistedProperty(key) {
@@ -152431,15 +152746,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
152431
152746
  return true;
152432
152747
  if (this.featureFlagsPoller === undefined)
152433
152748
  return false;
152434
- return new Promise((resolve21) => {
152749
+ return new Promise((resolve22) => {
152435
152750
  const timeout = setTimeout(() => {
152436
152751
  cleanup2();
152437
- resolve21(false);
152752
+ resolve22(false);
152438
152753
  }, timeoutMs);
152439
152754
  const cleanup2 = this._events.on("localEvaluationFlagsLoaded", (count) => {
152440
152755
  clearTimeout(timeout);
152441
152756
  cleanup2();
152442
- resolve21(count > 0);
152757
+ resolve22(count > 0);
152443
152758
  });
152444
152759
  });
152445
152760
  }
@@ -152783,13 +153098,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
152783
153098
  this.context?.enter(data, options);
152784
153099
  }
152785
153100
  async _shutdown(shutdownTimeoutMs) {
152786
- const resolve21 = this._consumeWaitUntilCycle();
153101
+ const resolve22 = this._consumeWaitUntilCycle();
152787
153102
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
152788
153103
  this.errorTracking.shutdown();
152789
153104
  try {
152790
153105
  return await super._shutdown(shutdownTimeoutMs);
152791
153106
  } finally {
152792
- resolve21?.();
153107
+ resolve22?.();
152793
153108
  }
152794
153109
  }
152795
153110
  async _requestRemoteConfigPayload(flagKey) {
@@ -153137,7 +153452,7 @@ class PostHog extends PostHogBackendClient {
153137
153452
  // package.json
153138
153453
  var package_default = {
153139
153454
  name: "oh-my-opencode",
153140
- version: "3.17.2",
153455
+ version: "3.17.3",
153141
153456
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
153142
153457
  main: "./dist/index.js",
153143
153458
  types: "dist/index.d.ts",
@@ -153216,17 +153531,17 @@ var package_default = {
153216
153531
  typescript: "^5.7.3"
153217
153532
  },
153218
153533
  optionalDependencies: {
153219
- "oh-my-opencode-darwin-arm64": "3.17.2",
153220
- "oh-my-opencode-darwin-x64": "3.17.2",
153221
- "oh-my-opencode-darwin-x64-baseline": "3.17.2",
153222
- "oh-my-opencode-linux-arm64": "3.17.2",
153223
- "oh-my-opencode-linux-arm64-musl": "3.17.2",
153224
- "oh-my-opencode-linux-x64": "3.17.2",
153225
- "oh-my-opencode-linux-x64-baseline": "3.17.2",
153226
- "oh-my-opencode-linux-x64-musl": "3.17.2",
153227
- "oh-my-opencode-linux-x64-musl-baseline": "3.17.2",
153228
- "oh-my-opencode-windows-x64": "3.17.2",
153229
- "oh-my-opencode-windows-x64-baseline": "3.17.2"
153534
+ "oh-my-opencode-darwin-arm64": "3.17.3",
153535
+ "oh-my-opencode-darwin-x64": "3.17.3",
153536
+ "oh-my-opencode-darwin-x64-baseline": "3.17.3",
153537
+ "oh-my-opencode-linux-arm64": "3.17.3",
153538
+ "oh-my-opencode-linux-arm64-musl": "3.17.3",
153539
+ "oh-my-opencode-linux-x64": "3.17.3",
153540
+ "oh-my-opencode-linux-x64-baseline": "3.17.3",
153541
+ "oh-my-opencode-linux-x64-musl": "3.17.3",
153542
+ "oh-my-opencode-linux-x64-musl-baseline": "3.17.3",
153543
+ "oh-my-opencode-windows-x64": "3.17.3",
153544
+ "oh-my-opencode-windows-x64-baseline": "3.17.3"
153230
153545
  },
153231
153546
  overrides: {},
153232
153547
  trustedDependencies: [
@@ -153240,13 +153555,13 @@ var package_default = {
153240
153555
  init_plugin_identity();
153241
153556
 
153242
153557
  // src/shared/posthog-activity-state.ts
153243
- import { existsSync as existsSync93, mkdirSync as mkdirSync21, readFileSync as readFileSync64 } from "fs";
153244
- import { join as join102 } from "path";
153558
+ import { existsSync as existsSync96, mkdirSync as mkdirSync21, readFileSync as readFileSync67 } from "fs";
153559
+ import { join as join103 } from "path";
153245
153560
  init_logger();
153246
153561
  init_plugin_identity();
153247
153562
  var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
153248
153563
  function getPostHogActivityStateFilePath() {
153249
- return join102(getDataDir(), CACHE_DIR_NAME, POSTHOG_ACTIVITY_STATE_FILE);
153564
+ return join103(getDataDir(), CACHE_DIR_NAME, POSTHOG_ACTIVITY_STATE_FILE);
153250
153565
  }
153251
153566
  function getUtcDayString(date10) {
153252
153567
  return date10.toISOString().slice(0, 10);
@@ -153259,11 +153574,11 @@ function isPostHogActivityState(value) {
153259
153574
  }
153260
153575
  function readPostHogActivityState() {
153261
153576
  const stateFilePath = getPostHogActivityStateFilePath();
153262
- if (!existsSync93(stateFilePath)) {
153577
+ if (!existsSync96(stateFilePath)) {
153263
153578
  return {};
153264
153579
  }
153265
153580
  try {
153266
- const content = readFileSync64(stateFilePath, "utf-8");
153581
+ const content = readFileSync67(stateFilePath, "utf-8");
153267
153582
  const parsed = JSON.parse(content);
153268
153583
  if (!isPostHogActivityState(parsed)) {
153269
153584
  return {};
@@ -153280,7 +153595,7 @@ function readPostHogActivityState() {
153280
153595
  function writePostHogActivityState(nextState) {
153281
153596
  const stateFilePath = getPostHogActivityStateFilePath();
153282
153597
  try {
153283
- mkdirSync21(join102(getDataDir(), CACHE_DIR_NAME), { recursive: true });
153598
+ mkdirSync21(join103(getDataDir(), CACHE_DIR_NAME), { recursive: true });
153284
153599
  writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
153285
153600
  `);
153286
153601
  } catch (error92) {
@@ -153432,7 +153747,7 @@ function getPostHogDistinctId() {
153432
153747
  }
153433
153748
  function createPluginPostHog() {
153434
153749
  return createPostHogClient("plugin", {
153435
- enableExceptionAutocapture: true,
153750
+ enableExceptionAutocapture: false,
153436
153751
  flushAt: 1,
153437
153752
  flushInterval: 0
153438
153753
  });