@heidi-dang/oh-my-opencode 3.10.1 → 3.12.0

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
@@ -277,8 +277,8 @@ var require_utils = __commonJS((exports) => {
277
277
  }
278
278
  return output;
279
279
  };
280
- exports.basename = (path5, { windows } = {}) => {
281
- const segs = path5.split(windows ? /[\\/]/ : "/");
280
+ exports.basename = (path6, { windows } = {}) => {
281
+ const segs = path6.split(windows ? /[\\/]/ : "/");
282
282
  const last = segs[segs.length - 1];
283
283
  if (last === "") {
284
284
  return segs[segs.length - 2];
@@ -4538,8 +4538,8 @@ var require_main = __commonJS((exports) => {
4538
4538
  exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.PortMessageWriter = exports.PortMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = undefined;
4539
4539
  var ril_1 = require_ril();
4540
4540
  ril_1.default.install();
4541
- var path11 = __require("path");
4542
- var os6 = __require("os");
4541
+ var path12 = __require("path");
4542
+ var os7 = __require("os");
4543
4543
  var crypto_1 = __require("crypto");
4544
4544
  var net_1 = __require("net");
4545
4545
  var api_1 = require_api();
@@ -4680,9 +4680,9 @@ var require_main = __commonJS((exports) => {
4680
4680
  }
4681
4681
  let result;
4682
4682
  if (XDG_RUNTIME_DIR) {
4683
- result = path11.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
4683
+ result = path12.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
4684
4684
  } else {
4685
- result = path11.join(os6.tmpdir(), `vscode-${randomSuffix}.sock`);
4685
+ result = path12.join(os7.tmpdir(), `vscode-${randomSuffix}.sock`);
4686
4686
  }
4687
4687
  const limit = safeIpcPathLengths.get(process.platform);
4688
4688
  if (limit !== undefined && result.length > limit) {
@@ -8423,8 +8423,8 @@ var require_utils2 = __commonJS((exports, module) => {
8423
8423
  }
8424
8424
  return ind;
8425
8425
  }
8426
- function removeDotSegments(path11) {
8427
- let input = path11;
8426
+ function removeDotSegments(path12) {
8427
+ let input = path12;
8428
8428
  const output = [];
8429
8429
  let nextSlash = -1;
8430
8430
  let len = 0;
@@ -8614,8 +8614,8 @@ var require_schemes = __commonJS((exports, module) => {
8614
8614
  wsComponent.secure = undefined;
8615
8615
  }
8616
8616
  if (wsComponent.resourceName) {
8617
- const [path11, query] = wsComponent.resourceName.split("?");
8618
- wsComponent.path = path11 && path11 !== "/" ? path11 : undefined;
8617
+ const [path12, query] = wsComponent.resourceName.split("?");
8618
+ wsComponent.path = path12 && path12 !== "/" ? path12 : undefined;
8619
8619
  wsComponent.query = query;
8620
8620
  wsComponent.resourceName = undefined;
8621
8621
  }
@@ -11759,12 +11759,12 @@ var require_dist = __commonJS((exports, module) => {
11759
11759
  throw new Error(`Unknown format "${name}"`);
11760
11760
  return f;
11761
11761
  };
11762
- function addFormats(ajv, list, fs19, exportName) {
11762
+ function addFormats(ajv, list, fs20, exportName) {
11763
11763
  var _a2;
11764
11764
  var _b;
11765
11765
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
11766
11766
  for (const f of list)
11767
- ajv.addFormat(f, fs19[f]);
11767
+ ajv.addFormat(f, fs20[f]);
11768
11768
  }
11769
11769
  module.exports = exports = formatsPlugin;
11770
11770
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -11775,8 +11775,8 @@ var require_dist = __commonJS((exports, module) => {
11775
11775
  var require_windows = __commonJS((exports, module) => {
11776
11776
  module.exports = isexe;
11777
11777
  isexe.sync = sync;
11778
- var fs19 = __require("fs");
11779
- function checkPathExt(path11, options) {
11778
+ var fs20 = __require("fs");
11779
+ function checkPathExt(path12, options) {
11780
11780
  var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
11781
11781
  if (!pathext) {
11782
11782
  return true;
@@ -11787,25 +11787,25 @@ var require_windows = __commonJS((exports, module) => {
11787
11787
  }
11788
11788
  for (var i2 = 0;i2 < pathext.length; i2++) {
11789
11789
  var p = pathext[i2].toLowerCase();
11790
- if (p && path11.substr(-p.length).toLowerCase() === p) {
11790
+ if (p && path12.substr(-p.length).toLowerCase() === p) {
11791
11791
  return true;
11792
11792
  }
11793
11793
  }
11794
11794
  return false;
11795
11795
  }
11796
- function checkStat(stat2, path11, options) {
11796
+ function checkStat(stat2, path12, options) {
11797
11797
  if (!stat2.isSymbolicLink() && !stat2.isFile()) {
11798
11798
  return false;
11799
11799
  }
11800
- return checkPathExt(path11, options);
11800
+ return checkPathExt(path12, options);
11801
11801
  }
11802
- function isexe(path11, options, cb) {
11803
- fs19.stat(path11, function(er, stat2) {
11804
- cb(er, er ? false : checkStat(stat2, path11, options));
11802
+ function isexe(path12, options, cb) {
11803
+ fs20.stat(path12, function(er, stat2) {
11804
+ cb(er, er ? false : checkStat(stat2, path12, options));
11805
11805
  });
11806
11806
  }
11807
- function sync(path11, options) {
11808
- return checkStat(fs19.statSync(path11), path11, options);
11807
+ function sync(path12, options) {
11808
+ return checkStat(fs20.statSync(path12), path12, options);
11809
11809
  }
11810
11810
  });
11811
11811
 
@@ -11813,14 +11813,14 @@ var require_windows = __commonJS((exports, module) => {
11813
11813
  var require_mode = __commonJS((exports, module) => {
11814
11814
  module.exports = isexe;
11815
11815
  isexe.sync = sync;
11816
- var fs19 = __require("fs");
11817
- function isexe(path11, options, cb) {
11818
- fs19.stat(path11, function(er, stat2) {
11816
+ var fs20 = __require("fs");
11817
+ function isexe(path12, options, cb) {
11818
+ fs20.stat(path12, function(er, stat2) {
11819
11819
  cb(er, er ? false : checkStat(stat2, options));
11820
11820
  });
11821
11821
  }
11822
- function sync(path11, options) {
11823
- return checkStat(fs19.statSync(path11), options);
11822
+ function sync(path12, options) {
11823
+ return checkStat(fs20.statSync(path12), options);
11824
11824
  }
11825
11825
  function checkStat(stat2, options) {
11826
11826
  return stat2.isFile() && checkMode(stat2, options);
@@ -11842,7 +11842,7 @@ var require_mode = __commonJS((exports, module) => {
11842
11842
 
11843
11843
  // node_modules/isexe/index.js
11844
11844
  var require_isexe = __commonJS((exports, module) => {
11845
- var fs19 = __require("fs");
11845
+ var fs20 = __require("fs");
11846
11846
  var core4;
11847
11847
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
11848
11848
  core4 = require_windows();
@@ -11851,7 +11851,7 @@ var require_isexe = __commonJS((exports, module) => {
11851
11851
  }
11852
11852
  module.exports = isexe;
11853
11853
  isexe.sync = sync;
11854
- function isexe(path11, options, cb) {
11854
+ function isexe(path12, options, cb) {
11855
11855
  if (typeof options === "function") {
11856
11856
  cb = options;
11857
11857
  options = {};
@@ -11861,7 +11861,7 @@ var require_isexe = __commonJS((exports, module) => {
11861
11861
  throw new TypeError("callback not provided");
11862
11862
  }
11863
11863
  return new Promise(function(resolve13, reject) {
11864
- isexe(path11, options || {}, function(er, is) {
11864
+ isexe(path12, options || {}, function(er, is) {
11865
11865
  if (er) {
11866
11866
  reject(er);
11867
11867
  } else {
@@ -11870,7 +11870,7 @@ var require_isexe = __commonJS((exports, module) => {
11870
11870
  });
11871
11871
  });
11872
11872
  }
11873
- core4(path11, options || {}, function(er, is) {
11873
+ core4(path12, options || {}, function(er, is) {
11874
11874
  if (er) {
11875
11875
  if (er.code === "EACCES" || options && options.ignoreErrors) {
11876
11876
  er = null;
@@ -11880,9 +11880,9 @@ var require_isexe = __commonJS((exports, module) => {
11880
11880
  cb(er, is);
11881
11881
  });
11882
11882
  }
11883
- function sync(path11, options) {
11883
+ function sync(path12, options) {
11884
11884
  try {
11885
- return core4.sync(path11, options || {});
11885
+ return core4.sync(path12, options || {});
11886
11886
  } catch (er) {
11887
11887
  if (options && options.ignoreErrors || er.code === "EACCES") {
11888
11888
  return false;
@@ -11896,7 +11896,7 @@ var require_isexe = __commonJS((exports, module) => {
11896
11896
  // node_modules/which/which.js
11897
11897
  var require_which = __commonJS((exports, module) => {
11898
11898
  var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
11899
- var path11 = __require("path");
11899
+ var path12 = __require("path");
11900
11900
  var COLON = isWindows2 ? ";" : ":";
11901
11901
  var isexe = require_isexe();
11902
11902
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -11932,7 +11932,7 @@ var require_which = __commonJS((exports, module) => {
11932
11932
  return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
11933
11933
  const ppRaw = pathEnv[i2];
11934
11934
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
11935
- const pCmd = path11.join(pathPart, cmd);
11935
+ const pCmd = path12.join(pathPart, cmd);
11936
11936
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
11937
11937
  resolve13(subStep(p, i2, 0));
11938
11938
  });
@@ -11959,7 +11959,7 @@ var require_which = __commonJS((exports, module) => {
11959
11959
  for (let i2 = 0;i2 < pathEnv.length; i2++) {
11960
11960
  const ppRaw = pathEnv[i2];
11961
11961
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
11962
- const pCmd = path11.join(pathPart, cmd);
11962
+ const pCmd = path12.join(pathPart, cmd);
11963
11963
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
11964
11964
  for (let j = 0;j < pathExt.length; j++) {
11965
11965
  const cur = p + pathExt[j];
@@ -12000,7 +12000,7 @@ var require_path_key = __commonJS((exports, module) => {
12000
12000
 
12001
12001
  // node_modules/cross-spawn/lib/util/resolveCommand.js
12002
12002
  var require_resolveCommand = __commonJS((exports, module) => {
12003
- var path11 = __require("path");
12003
+ var path12 = __require("path");
12004
12004
  var which = require_which();
12005
12005
  var getPathKey = require_path_key();
12006
12006
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -12017,7 +12017,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
12017
12017
  try {
12018
12018
  resolved = which.sync(parsed.command, {
12019
12019
  path: env[getPathKey({ env })],
12020
- pathExt: withoutPathExt ? path11.delimiter : undefined
12020
+ pathExt: withoutPathExt ? path12.delimiter : undefined
12021
12021
  });
12022
12022
  } catch (e) {} finally {
12023
12023
  if (shouldSwitchCwd) {
@@ -12025,7 +12025,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
12025
12025
  }
12026
12026
  }
12027
12027
  if (resolved) {
12028
- resolved = path11.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12028
+ resolved = path12.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12029
12029
  }
12030
12030
  return resolved;
12031
12031
  }
@@ -12070,8 +12070,8 @@ var require_shebang_command = __commonJS((exports, module) => {
12070
12070
  if (!match) {
12071
12071
  return null;
12072
12072
  }
12073
- const [path11, argument] = match[0].replace(/#! ?/, "").split(" ");
12074
- const binary2 = path11.split("/").pop();
12073
+ const [path12, argument] = match[0].replace(/#! ?/, "").split(" ");
12074
+ const binary2 = path12.split("/").pop();
12075
12075
  if (binary2 === "env") {
12076
12076
  return argument;
12077
12077
  }
@@ -12081,16 +12081,16 @@ var require_shebang_command = __commonJS((exports, module) => {
12081
12081
 
12082
12082
  // node_modules/cross-spawn/lib/util/readShebang.js
12083
12083
  var require_readShebang = __commonJS((exports, module) => {
12084
- var fs19 = __require("fs");
12084
+ var fs20 = __require("fs");
12085
12085
  var shebangCommand = require_shebang_command();
12086
12086
  function readShebang(command) {
12087
12087
  const size = 150;
12088
12088
  const buffer = Buffer.alloc(size);
12089
12089
  let fd;
12090
12090
  try {
12091
- fd = fs19.openSync(command, "r");
12092
- fs19.readSync(fd, buffer, 0, size, 0);
12093
- fs19.closeSync(fd);
12091
+ fd = fs20.openSync(command, "r");
12092
+ fs20.readSync(fd, buffer, 0, size, 0);
12093
+ fs20.closeSync(fd);
12094
12094
  } catch (e) {}
12095
12095
  return shebangCommand(buffer.toString());
12096
12096
  }
@@ -12099,7 +12099,7 @@ var require_readShebang = __commonJS((exports, module) => {
12099
12099
 
12100
12100
  // node_modules/cross-spawn/lib/parse.js
12101
12101
  var require_parse2 = __commonJS((exports, module) => {
12102
- var path11 = __require("path");
12102
+ var path12 = __require("path");
12103
12103
  var resolveCommand = require_resolveCommand();
12104
12104
  var escape2 = require_escape();
12105
12105
  var readShebang = require_readShebang();
@@ -12124,7 +12124,7 @@ var require_parse2 = __commonJS((exports, module) => {
12124
12124
  const needsShell = !isExecutableRegExp.test(commandFile);
12125
12125
  if (parsed.options.forceShell || needsShell) {
12126
12126
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
12127
- parsed.command = path11.normalize(parsed.command);
12127
+ parsed.command = path12.normalize(parsed.command);
12128
12128
  parsed.command = escape2.command(parsed.command);
12129
12129
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
12130
12130
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -18744,29 +18744,244 @@ function injectServerAuthIntoClient(client) {
18744
18744
  log("[opencode-server-auth] Failed to inject server auth", { message });
18745
18745
  }
18746
18746
  }
18747
+ // src/shared/ygka-transport.ts
18748
+ import * as fs5 from "fs";
18749
+ import * as path5 from "path";
18750
+ import * as os4 from "os";
18751
+
18752
+ class YGKATransport {
18753
+ config = null;
18754
+ configPath;
18755
+ constructor() {
18756
+ this.configPath = path5.join(os4.homedir(), ".ygka_config.json");
18757
+ this.loadConfig();
18758
+ }
18759
+ loadConfig() {
18760
+ if (fs5.existsSync(this.configPath)) {
18761
+ try {
18762
+ const data = fs5.readFileSync(this.configPath, "utf-8");
18763
+ this.config = JSON.parse(data);
18764
+ } catch (error) {
18765
+ console.error("Error loading YGKA config:", error);
18766
+ }
18767
+ }
18768
+ }
18769
+ isConfigured() {
18770
+ return !!(this.config?.access_token || this.config?.session_token);
18771
+ }
18772
+ async queryStream(prompt) {
18773
+ if (!this.isConfigured()) {
18774
+ throw new Error("YGKA is not configured. Please run `oh-my-opencode master-login` first.");
18775
+ }
18776
+ const accessToken = this.config?.access_token || await this.refreshAccessToken();
18777
+ if (!accessToken) {
18778
+ throw new Error("Failed to retrieve or refresh ChatGPT access token.");
18779
+ }
18780
+ try {
18781
+ const response = await fetch("https://chatgpt.com/backend-api/conversation", {
18782
+ method: "POST",
18783
+ headers: {
18784
+ "Content-Type": "application/json",
18785
+ Authorization: `Bearer ${accessToken}`,
18786
+ Accept: "text/event-stream",
18787
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
18788
+ "chatgpt-account-id": ""
18789
+ },
18790
+ body: JSON.stringify({
18791
+ action: "next",
18792
+ messages: [
18793
+ {
18794
+ id: crypto.randomUUID(),
18795
+ author: { role: "user" },
18796
+ content: { content_type: "text", parts: [prompt] },
18797
+ metadata: {}
18798
+ }
18799
+ ],
18800
+ model: "auto",
18801
+ parent_message_id: crypto.randomUUID(),
18802
+ timezone_offset_min: -600,
18803
+ history_and_training_disabled: false,
18804
+ force_paragen: false,
18805
+ force_paragen_model_slug: "",
18806
+ force_null_assistant: false,
18807
+ force_offline: false
18808
+ })
18809
+ });
18810
+ if (!response.ok) {
18811
+ const errorBody = await response.text();
18812
+ throw new Error(`ChatGPT API responded with ${response.status}: ${errorBody}`);
18813
+ }
18814
+ return response;
18815
+ } catch (error) {
18816
+ if (error instanceof Error) {
18817
+ throw new Error(`YGKA Stream Failed: ${error.message}`);
18818
+ }
18819
+ throw error;
18820
+ }
18821
+ }
18822
+ async query(prompt) {
18823
+ const response = await this.queryStream(prompt);
18824
+ const reader = response.body?.getReader();
18825
+ if (!reader)
18826
+ throw new Error("Failed to read response body stream.");
18827
+ let lastMessage = "";
18828
+ const decoder = new TextDecoder;
18829
+ while (true) {
18830
+ const { done, value } = await reader.read();
18831
+ if (done)
18832
+ break;
18833
+ const chunk = decoder.decode(value);
18834
+ const lines = chunk.split(`
18835
+ `);
18836
+ for (const line of lines) {
18837
+ if (line.startsWith("data: ")) {
18838
+ const dataStr = line.slice(6).trim();
18839
+ if (dataStr === "[DONE]")
18840
+ break;
18841
+ try {
18842
+ const data = JSON.parse(dataStr);
18843
+ if (data.message?.content?.parts?.[0]) {
18844
+ lastMessage = data.message.content.parts[0];
18845
+ }
18846
+ } catch (e) {}
18847
+ }
18848
+ }
18849
+ }
18850
+ return lastMessage || "No response received from ChatGPT.";
18851
+ }
18852
+ async refreshAccessToken() {
18853
+ if (!this.config?.session_token)
18854
+ return null;
18855
+ try {
18856
+ const response = await fetch("https://chatgpt.com/api/auth/session", {
18857
+ headers: {
18858
+ Cookie: `__Secure-next-auth.session-token=${this.config.session_token}`,
18859
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
18860
+ }
18861
+ });
18862
+ if (!response.ok)
18863
+ return null;
18864
+ const data = await response.json();
18865
+ if (data.accessToken) {
18866
+ if (this.config) {
18867
+ this.config.access_token = data.accessToken;
18868
+ fs5.writeFileSync(this.configPath, JSON.stringify(this.config, null, 2));
18869
+ }
18870
+ }
18871
+ return data.accessToken || null;
18872
+ } catch (error) {
18873
+ return null;
18874
+ }
18875
+ }
18876
+ }
18877
+
18878
+ // src/shared/ygka-interceptor.ts
18879
+ init_logger();
18880
+ function isRecord2(value) {
18881
+ return typeof value === "object" && value !== null;
18882
+ }
18883
+ function isRequestFetch2(value) {
18884
+ return typeof value === "function";
18885
+ }
18886
+ function wrapFetchWithYGKA(baseFetch, ygka) {
18887
+ return async (request) => {
18888
+ if (request.method !== "POST") {
18889
+ return baseFetch(request);
18890
+ }
18891
+ try {
18892
+ const clonedRequest = request.clone();
18893
+ const body = await clonedRequest.json();
18894
+ if (body.agent === "Master" || body.agent === "master") {
18895
+ log("[ygka-interceptor] Intercepting request for Master agent");
18896
+ const prompt = extractPromptFromBody(body);
18897
+ if (!prompt) {
18898
+ log("[ygka-interceptor] Could not extract prompt from request body, falling back to base fetch");
18899
+ return baseFetch(request);
18900
+ }
18901
+ log(`[ygka-interceptor] Querying YGKA with prompt: ${prompt.substring(0, 50)}...`);
18902
+ return await ygka.queryStream(prompt);
18903
+ }
18904
+ } catch (e) {
18905
+ log("[ygka-interceptor] Error parsing request body, falling back", { error: e });
18906
+ }
18907
+ return baseFetch(request);
18908
+ };
18909
+ }
18910
+ function extractPromptFromBody(body) {
18911
+ if (body.messages && Array.isArray(body.messages)) {
18912
+ const lastUserMessage = [...body.messages].reverse().find((m) => m.role === "user");
18913
+ if (lastUserMessage && lastUserMessage.content) {
18914
+ if (typeof lastUserMessage.content === "string")
18915
+ return lastUserMessage.content;
18916
+ if (Array.isArray(lastUserMessage.content)) {
18917
+ return lastUserMessage.content.filter((c) => c.type === "text").map((c) => c.text).join(`
18918
+ `);
18919
+ }
18920
+ }
18921
+ }
18922
+ if (body.prompt)
18923
+ return body.prompt;
18924
+ if (body.input)
18925
+ return body.input;
18926
+ return null;
18927
+ }
18928
+ function getInternalClient2(client) {
18929
+ if (!isRecord2(client))
18930
+ return null;
18931
+ const internal = client["_client"];
18932
+ return isRecord2(internal) ? internal : null;
18933
+ }
18934
+ function injectYGKAInterceptor(client) {
18935
+ const ygka = new YGKATransport;
18936
+ if (!ygka.isConfigured()) {
18937
+ log("[ygka-interceptor] YGKA is not configured, skipping interceptor injection");
18938
+ return;
18939
+ }
18940
+ try {
18941
+ const internal = getInternalClient2(client);
18942
+ if (!internal) {
18943
+ log("[ygka-interceptor] SDK client structure is incompatible, could not find internal client");
18944
+ return;
18945
+ }
18946
+ const setConfig = internal["setConfig"];
18947
+ const getConfig = internal["getConfig"];
18948
+ if (typeof setConfig === "function" && typeof getConfig === "function") {
18949
+ const config = getConfig();
18950
+ if (config && isRequestFetch2(config.fetch)) {
18951
+ log("[ygka-interceptor] Injecting YGKA fetch wrapper");
18952
+ setConfig({
18953
+ fetch: wrapFetchWithYGKA(config.fetch, ygka)
18954
+ });
18955
+ }
18956
+ }
18957
+ } catch (error) {
18958
+ const message = error instanceof Error ? error.message : String(error);
18959
+ log("[ygka-interceptor] Failed to inject YGKA interceptor", { message });
18960
+ }
18961
+ }
18747
18962
  // src/shared/opencode-http-api.ts
18748
18963
  init_logger();
18749
18964
 
18750
18965
  // src/shared/record-type-guard.ts
18751
- function isRecord2(value) {
18966
+ function isRecord3(value) {
18752
18967
  return typeof value === "object" && value !== null;
18753
18968
  }
18754
18969
 
18755
18970
  // src/shared/opencode-http-api.ts
18756
- function getInternalClient2(client) {
18757
- if (!isRecord2(client)) {
18971
+ function getInternalClient3(client) {
18972
+ if (!isRecord3(client)) {
18758
18973
  return null;
18759
18974
  }
18760
18975
  const internal = client["_client"];
18761
- return isRecord2(internal) ? internal : null;
18976
+ return isRecord3(internal) ? internal : null;
18762
18977
  }
18763
18978
  function getServerBaseUrl(client) {
18764
- const internal = getInternalClient2(client);
18979
+ const internal = getInternalClient3(client);
18765
18980
  if (internal) {
18766
18981
  const getConfig = internal["getConfig"];
18767
18982
  if (typeof getConfig === "function") {
18768
18983
  const config = getConfig();
18769
- if (isRecord2(config)) {
18984
+ if (isRecord3(config)) {
18770
18985
  const baseUrl = config["baseUrl"];
18771
18986
  if (typeof baseUrl === "string") {
18772
18987
  return baseUrl;
@@ -18774,15 +18989,15 @@ function getServerBaseUrl(client) {
18774
18989
  }
18775
18990
  }
18776
18991
  }
18777
- if (isRecord2(client)) {
18992
+ if (isRecord3(client)) {
18778
18993
  const session = client["session"];
18779
- if (isRecord2(session)) {
18994
+ if (isRecord3(session)) {
18780
18995
  const internal2 = session["_client"];
18781
- if (isRecord2(internal2)) {
18996
+ if (isRecord3(internal2)) {
18782
18997
  const getConfig = internal2["getConfig"];
18783
18998
  if (typeof getConfig === "function") {
18784
18999
  const config = getConfig();
18785
- if (isRecord2(config)) {
19000
+ if (isRecord3(config)) {
18786
19001
  const baseUrl = config["baseUrl"];
18787
19002
  if (typeof baseUrl === "string") {
18788
19003
  return baseUrl;
@@ -18927,22 +19142,22 @@ function parseGitDiffNumstat(output, statusMap) {
18927
19142
  const parts = line.split("\t");
18928
19143
  if (parts.length < 3)
18929
19144
  continue;
18930
- const [addedStr, removedStr, path5] = parts;
19145
+ const [addedStr, removedStr, path6] = parts;
18931
19146
  const added = addedStr === "-" ? 0 : parseInt(addedStr, 10);
18932
19147
  const removed = removedStr === "-" ? 0 : parseInt(removedStr, 10);
18933
19148
  stats.push({
18934
- path: path5,
19149
+ path: path6,
18935
19150
  added,
18936
19151
  removed,
18937
- status: statusMap.get(path5) ?? "modified"
19152
+ status: statusMap.get(path6) ?? "modified"
18938
19153
  });
18939
19154
  }
18940
19155
  return stats;
18941
19156
  }
18942
19157
  // src/shared/git-worktree/collect-git-diff-stats.ts
18943
19158
  import { execFileSync } from "child_process";
18944
- import { readFileSync as readFileSync7 } from "fs";
18945
- import { join as join14 } from "path";
19159
+ import { readFileSync as readFileSync8 } from "fs";
19160
+ import { join as join15 } from "path";
18946
19161
  function collectGitDiffStats(directory) {
18947
19162
  try {
18948
19163
  const diffOutput = execFileSync("git", ["diff", "--numstat", "HEAD"], {
@@ -18966,7 +19181,7 @@ function collectGitDiffStats(directory) {
18966
19181
  const untrackedNumstat = untrackedOutput ? untrackedOutput.split(`
18967
19182
  `).filter(Boolean).map((filePath) => {
18968
19183
  try {
18969
- const content = readFileSync7(join14(directory, filePath), "utf-8");
19184
+ const content = readFileSync8(join15(directory, filePath), "utf-8");
18970
19185
  const lineCount = content.split(`
18971
19186
  `).length - (content.endsWith(`
18972
19187
  `) ? 1 : 0);
@@ -19093,25 +19308,25 @@ init_logger();
19093
19308
 
19094
19309
  // src/features/claude-code-plugin-loader/discovery.ts
19095
19310
  init_logger();
19096
- import { existsSync as existsSync12, readFileSync as readFileSync8 } from "fs";
19097
- import { homedir as homedir6 } from "os";
19098
- import { join as join15 } from "path";
19311
+ import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
19312
+ import { homedir as homedir7 } from "os";
19313
+ import { join as join16 } from "path";
19099
19314
  function getPluginsBaseDir() {
19100
19315
  if (process.env.CLAUDE_PLUGINS_HOME) {
19101
19316
  return process.env.CLAUDE_PLUGINS_HOME;
19102
19317
  }
19103
- return join15(homedir6(), ".claude", "plugins");
19318
+ return join16(homedir7(), ".claude", "plugins");
19104
19319
  }
19105
19320
  function getInstalledPluginsPath() {
19106
- return join15(getPluginsBaseDir(), "installed_plugins.json");
19321
+ return join16(getPluginsBaseDir(), "installed_plugins.json");
19107
19322
  }
19108
19323
  function loadInstalledPlugins() {
19109
19324
  const dbPath = getInstalledPluginsPath();
19110
- if (!existsSync12(dbPath)) {
19325
+ if (!existsSync13(dbPath)) {
19111
19326
  return null;
19112
19327
  }
19113
19328
  try {
19114
- const content = readFileSync8(dbPath, "utf-8");
19329
+ const content = readFileSync9(dbPath, "utf-8");
19115
19330
  return JSON.parse(content);
19116
19331
  } catch (error) {
19117
19332
  log("Failed to load installed plugins database", error);
@@ -19122,15 +19337,15 @@ function getClaudeSettingsPath() {
19122
19337
  if (process.env.CLAUDE_SETTINGS_PATH) {
19123
19338
  return process.env.CLAUDE_SETTINGS_PATH;
19124
19339
  }
19125
- return join15(homedir6(), ".claude", "settings.json");
19340
+ return join16(homedir7(), ".claude", "settings.json");
19126
19341
  }
19127
19342
  function loadClaudeSettings() {
19128
19343
  const settingsPath = getClaudeSettingsPath();
19129
- if (!existsSync12(settingsPath)) {
19344
+ if (!existsSync13(settingsPath)) {
19130
19345
  return null;
19131
19346
  }
19132
19347
  try {
19133
- const content = readFileSync8(settingsPath, "utf-8");
19348
+ const content = readFileSync9(settingsPath, "utf-8");
19134
19349
  return JSON.parse(content);
19135
19350
  } catch (error) {
19136
19351
  log("Failed to load Claude settings", error);
@@ -19138,12 +19353,12 @@ function loadClaudeSettings() {
19138
19353
  }
19139
19354
  }
19140
19355
  function loadPluginManifest(installPath) {
19141
- const manifestPath = join15(installPath, ".claude-plugin", "plugin.json");
19142
- if (!existsSync12(manifestPath)) {
19356
+ const manifestPath = join16(installPath, ".claude-plugin", "plugin.json");
19357
+ if (!existsSync13(manifestPath)) {
19143
19358
  return null;
19144
19359
  }
19145
19360
  try {
19146
- const content = readFileSync8(manifestPath, "utf-8");
19361
+ const content = readFileSync9(manifestPath, "utf-8");
19147
19362
  return JSON.parse(content);
19148
19363
  } catch (error) {
19149
19364
  log(`Failed to load plugin manifest from ${manifestPath}`, error);
@@ -19187,7 +19402,7 @@ function discoverInstalledPlugins(options) {
19187
19402
  continue;
19188
19403
  }
19189
19404
  const { installPath, scope, version } = installation;
19190
- if (!existsSync12(installPath)) {
19405
+ if (!existsSync13(installPath)) {
19191
19406
  errors.push({
19192
19407
  pluginKey,
19193
19408
  installPath,
@@ -19205,21 +19420,21 @@ function discoverInstalledPlugins(options) {
19205
19420
  pluginKey,
19206
19421
  manifest: manifest ?? undefined
19207
19422
  };
19208
- if (existsSync12(join15(installPath, "commands"))) {
19209
- loadedPlugin.commandsDir = join15(installPath, "commands");
19423
+ if (existsSync13(join16(installPath, "commands"))) {
19424
+ loadedPlugin.commandsDir = join16(installPath, "commands");
19210
19425
  }
19211
- if (existsSync12(join15(installPath, "agents"))) {
19212
- loadedPlugin.agentsDir = join15(installPath, "agents");
19426
+ if (existsSync13(join16(installPath, "agents"))) {
19427
+ loadedPlugin.agentsDir = join16(installPath, "agents");
19213
19428
  }
19214
- if (existsSync12(join15(installPath, "skills"))) {
19215
- loadedPlugin.skillsDir = join15(installPath, "skills");
19429
+ if (existsSync13(join16(installPath, "skills"))) {
19430
+ loadedPlugin.skillsDir = join16(installPath, "skills");
19216
19431
  }
19217
- const hooksPath = join15(installPath, "hooks", "hooks.json");
19218
- if (existsSync12(hooksPath)) {
19432
+ const hooksPath = join16(installPath, "hooks", "hooks.json");
19433
+ if (existsSync13(hooksPath)) {
19219
19434
  loadedPlugin.hooksPath = hooksPath;
19220
19435
  }
19221
- const mcpPath = join15(installPath, ".mcp.json");
19222
- if (existsSync12(mcpPath)) {
19436
+ const mcpPath = join16(installPath, ".mcp.json");
19437
+ if (existsSync13(mcpPath)) {
19223
19438
  loadedPlugin.mcpPath = mcpPath;
19224
19439
  }
19225
19440
  plugins.push(loadedPlugin);
@@ -19232,23 +19447,23 @@ function discoverInstalledPlugins(options) {
19232
19447
  }
19233
19448
 
19234
19449
  // src/features/claude-code-plugin-loader/command-loader.ts
19235
- import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as readFileSync9 } from "fs";
19236
- import { basename, join as join16 } from "path";
19450
+ import { existsSync as existsSync14, readdirSync as readdirSync3, readFileSync as readFileSync10 } from "fs";
19451
+ import { basename, join as join17 } from "path";
19237
19452
  init_logger();
19238
19453
  function loadPluginCommands(plugins) {
19239
19454
  const commands = {};
19240
19455
  for (const plugin of plugins) {
19241
- if (!plugin.commandsDir || !existsSync13(plugin.commandsDir))
19456
+ if (!plugin.commandsDir || !existsSync14(plugin.commandsDir))
19242
19457
  continue;
19243
19458
  const entries = readdirSync3(plugin.commandsDir, { withFileTypes: true });
19244
19459
  for (const entry of entries) {
19245
19460
  if (!isMarkdownFile(entry))
19246
19461
  continue;
19247
- const commandPath = join16(plugin.commandsDir, entry.name);
19462
+ const commandPath = join17(plugin.commandsDir, entry.name);
19248
19463
  const commandName = basename(entry.name, ".md");
19249
19464
  const namespacedName = `${plugin.name}:${commandName}`;
19250
19465
  try {
19251
- const content = readFileSync9(commandPath, "utf-8");
19466
+ const content = readFileSync10(commandPath, "utf-8");
19252
19467
  const { data, body } = parseFrontmatter(content);
19253
19468
  const wrappedTemplate = `<command-instruction>
19254
19469
  ${body.trim()}
@@ -19279,14 +19494,14 @@ $ARGUMENTS
19279
19494
  }
19280
19495
 
19281
19496
  // src/features/claude-code-plugin-loader/skill-loader.ts
19282
- import { existsSync as existsSync14, readdirSync as readdirSync4, readFileSync as readFileSync10 } from "fs";
19283
- import { join as join18 } from "path";
19497
+ import { existsSync as existsSync15, readdirSync as readdirSync4, readFileSync as readFileSync11 } from "fs";
19498
+ import { join as join19 } from "path";
19284
19499
 
19285
19500
  // src/shared/skill-path-resolver.ts
19286
- import { join as join17 } from "path";
19501
+ import { join as join18 } from "path";
19287
19502
  function resolveSkillPathReferences(content, basePath) {
19288
19503
  const normalizedBase = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
19289
- return content.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (_, relativePath) => join17(normalizedBase, relativePath));
19504
+ return content.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (_, relativePath) => join18(normalizedBase, relativePath));
19290
19505
  }
19291
19506
 
19292
19507
  // src/features/claude-code-plugin-loader/skill-loader.ts
@@ -19294,21 +19509,21 @@ init_logger();
19294
19509
  function loadPluginSkillsAsCommands(plugins) {
19295
19510
  const skills = {};
19296
19511
  for (const plugin of plugins) {
19297
- if (!plugin.skillsDir || !existsSync14(plugin.skillsDir))
19512
+ if (!plugin.skillsDir || !existsSync15(plugin.skillsDir))
19298
19513
  continue;
19299
19514
  const entries = readdirSync4(plugin.skillsDir, { withFileTypes: true });
19300
19515
  for (const entry of entries) {
19301
19516
  if (entry.name.startsWith("."))
19302
19517
  continue;
19303
- const skillPath = join18(plugin.skillsDir, entry.name);
19518
+ const skillPath = join19(plugin.skillsDir, entry.name);
19304
19519
  if (!entry.isDirectory() && !entry.isSymbolicLink())
19305
19520
  continue;
19306
19521
  const resolvedPath = resolveSymlink(skillPath);
19307
- const skillMdPath = join18(resolvedPath, "SKILL.md");
19308
- if (!existsSync14(skillMdPath))
19522
+ const skillMdPath = join19(resolvedPath, "SKILL.md");
19523
+ if (!existsSync15(skillMdPath))
19309
19524
  continue;
19310
19525
  try {
19311
- const content = readFileSync10(skillMdPath, "utf-8");
19526
+ const content = readFileSync11(skillMdPath, "utf-8");
19312
19527
  const { data, body } = parseFrontmatter(content);
19313
19528
  const skillName = data.name || entry.name;
19314
19529
  const namespacedName = `${plugin.name}:${skillName}`;
@@ -19343,8 +19558,8 @@ $ARGUMENTS
19343
19558
  }
19344
19559
 
19345
19560
  // src/features/claude-code-plugin-loader/agent-loader.ts
19346
- import { existsSync as existsSync15, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "fs";
19347
- import { basename as basename2, join as join19 } from "path";
19561
+ import { existsSync as existsSync16, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
19562
+ import { basename as basename2, join as join20 } from "path";
19348
19563
  init_logger();
19349
19564
  function parseToolsConfig(toolsStr) {
19350
19565
  if (!toolsStr)
@@ -19361,17 +19576,17 @@ function parseToolsConfig(toolsStr) {
19361
19576
  function loadPluginAgents(plugins) {
19362
19577
  const agents = {};
19363
19578
  for (const plugin of plugins) {
19364
- if (!plugin.agentsDir || !existsSync15(plugin.agentsDir))
19579
+ if (!plugin.agentsDir || !existsSync16(plugin.agentsDir))
19365
19580
  continue;
19366
19581
  const entries = readdirSync5(plugin.agentsDir, { withFileTypes: true });
19367
19582
  for (const entry of entries) {
19368
19583
  if (!isMarkdownFile(entry))
19369
19584
  continue;
19370
- const agentPath = join19(plugin.agentsDir, entry.name);
19585
+ const agentPath = join20(plugin.agentsDir, entry.name);
19371
19586
  const agentName = basename2(entry.name, ".md");
19372
19587
  const namespacedName = `${plugin.name}:${agentName}`;
19373
19588
  try {
19374
- const content = readFileSync11(agentPath, "utf-8");
19589
+ const content = readFileSync12(agentPath, "utf-8");
19375
19590
  const { data, body } = parseFrontmatter(content);
19376
19591
  const originalDescription = data.description || "";
19377
19592
  const formattedDescription = `(plugin: ${plugin.name}) ${originalDescription}`;
@@ -19395,7 +19610,7 @@ function loadPluginAgents(plugins) {
19395
19610
  }
19396
19611
 
19397
19612
  // src/features/claude-code-plugin-loader/mcp-server-loader.ts
19398
- import { existsSync as existsSync16 } from "fs";
19613
+ import { existsSync as existsSync17 } from "fs";
19399
19614
 
19400
19615
  // src/features/claude-code-mcp-loader/env-expander.ts
19401
19616
  function expandEnvVars(value) {
@@ -19464,8 +19679,8 @@ init_logger();
19464
19679
 
19465
19680
  // src/features/claude-code-plugin-loader/plugin-path-resolver.ts
19466
19681
  var CLAUDE_PLUGIN_ROOT_VAR = "${CLAUDE_PLUGIN_ROOT}";
19467
- function resolvePluginPath(path5, pluginRoot) {
19468
- return path5.replace(CLAUDE_PLUGIN_ROOT_VAR, pluginRoot);
19682
+ function resolvePluginPath(path6, pluginRoot) {
19683
+ return path6.replace(CLAUDE_PLUGIN_ROOT_VAR, pluginRoot);
19469
19684
  }
19470
19685
  function resolvePluginPaths(obj, pluginRoot) {
19471
19686
  if (obj === null || obj === undefined)
@@ -19490,7 +19705,7 @@ function resolvePluginPaths(obj, pluginRoot) {
19490
19705
  async function loadPluginMcpServers(plugins) {
19491
19706
  const servers = {};
19492
19707
  for (const plugin of plugins) {
19493
- if (!plugin.mcpPath || !existsSync16(plugin.mcpPath))
19708
+ if (!plugin.mcpPath || !existsSync17(plugin.mcpPath))
19494
19709
  continue;
19495
19710
  try {
19496
19711
  const content = await Bun.file(plugin.mcpPath).text();
@@ -19522,14 +19737,14 @@ async function loadPluginMcpServers(plugins) {
19522
19737
 
19523
19738
  // src/features/claude-code-plugin-loader/hook-loader.ts
19524
19739
  init_logger();
19525
- import { existsSync as existsSync17, readFileSync as readFileSync12 } from "fs";
19740
+ import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
19526
19741
  function loadPluginHooksConfigs(plugins) {
19527
19742
  const configs = [];
19528
19743
  for (const plugin of plugins) {
19529
- if (!plugin.hooksPath || !existsSync17(plugin.hooksPath))
19744
+ if (!plugin.hooksPath || !existsSync18(plugin.hooksPath))
19530
19745
  continue;
19531
19746
  try {
19532
- const content = readFileSync12(plugin.hooksPath, "utf-8");
19747
+ const content = readFileSync13(plugin.hooksPath, "utf-8");
19533
19748
  let config = JSON.parse(content);
19534
19749
  config = resolvePluginPaths(config, plugin.installPath);
19535
19750
  configs.push(config);
@@ -19637,17 +19852,17 @@ var FAILURE_RESET_WINDOW_MS = 5 * 60 * 1000;
19637
19852
  // src/features/run-continuation-state/constants.ts
19638
19853
  var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
19639
19854
  // src/features/run-continuation-state/storage.ts
19640
- import { existsSync as existsSync18, mkdirSync as mkdirSync4, readFileSync as readFileSync13, rmSync, writeFileSync as writeFileSync4 } from "fs";
19641
- import { join as join20 } from "path";
19855
+ import { existsSync as existsSync19, mkdirSync as mkdirSync4, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync5 } from "fs";
19856
+ import { join as join21 } from "path";
19642
19857
  function getMarkerPath(directory, sessionID) {
19643
- return join20(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
19858
+ return join21(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
19644
19859
  }
19645
19860
  function readContinuationMarker(directory, sessionID) {
19646
19861
  const markerPath = getMarkerPath(directory, sessionID);
19647
- if (!existsSync18(markerPath))
19862
+ if (!existsSync19(markerPath))
19648
19863
  return null;
19649
19864
  try {
19650
- const raw = readFileSync13(markerPath, "utf-8");
19865
+ const raw = readFileSync14(markerPath, "utf-8");
19651
19866
  const parsed = JSON.parse(raw);
19652
19867
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
19653
19868
  return null;
@@ -19672,13 +19887,13 @@ function setContinuationMarkerSource(directory, sessionID, source, state, reason
19672
19887
  }
19673
19888
  };
19674
19889
  const markerPath = getMarkerPath(directory, sessionID);
19675
- mkdirSync4(join20(directory, CONTINUATION_MARKER_DIR), { recursive: true });
19676
- writeFileSync4(markerPath, JSON.stringify(next, null, 2), "utf-8");
19890
+ mkdirSync4(join21(directory, CONTINUATION_MARKER_DIR), { recursive: true });
19891
+ writeFileSync5(markerPath, JSON.stringify(next, null, 2), "utf-8");
19677
19892
  return next;
19678
19893
  }
19679
19894
  function clearContinuationMarker(directory, sessionID) {
19680
19895
  const markerPath = getMarkerPath(directory, sessionID);
19681
- if (!existsSync18(markerPath))
19896
+ if (!existsSync19(markerPath))
19682
19897
  return;
19683
19898
  try {
19684
19899
  rmSync(markerPath);
@@ -20394,9 +20609,9 @@ function createCommandFinder(commandName) {
20394
20609
  if (pending)
20395
20610
  return pending;
20396
20611
  pending = (async () => {
20397
- const path5 = await findCommand(commandName);
20398
- cachedPath = path5;
20399
- return path5;
20612
+ const path6 = await findCommand(commandName);
20613
+ cachedPath = path6;
20614
+ return path6;
20400
20615
  })();
20401
20616
  return pending;
20402
20617
  };
@@ -20895,20 +21110,20 @@ function generatePartId() {
20895
21110
  return `prt_${timestamp2}${random}`;
20896
21111
  }
20897
21112
  // src/hooks/session-recovery/storage/messages-reader.ts
20898
- import { existsSync as existsSync19, readdirSync as readdirSync6, readFileSync as readFileSync14 } from "fs";
20899
- import { join as join21 } from "path";
21113
+ import { existsSync as existsSync20, readdirSync as readdirSync6, readFileSync as readFileSync15 } from "fs";
21114
+ import { join as join22 } from "path";
20900
21115
  function readMessages(sessionID) {
20901
21116
  if (isSqliteBackend())
20902
21117
  return [];
20903
21118
  const messageDir = getMessageDir(sessionID);
20904
- if (!messageDir || !existsSync19(messageDir))
21119
+ if (!messageDir || !existsSync20(messageDir))
20905
21120
  return [];
20906
21121
  const messages = [];
20907
21122
  for (const file of readdirSync6(messageDir)) {
20908
21123
  if (!file.endsWith(".json"))
20909
21124
  continue;
20910
21125
  try {
20911
- const content = readFileSync14(join21(messageDir, file), "utf-8");
21126
+ const content = readFileSync15(join22(messageDir, file), "utf-8");
20912
21127
  messages.push(JSON.parse(content));
20913
21128
  } catch {
20914
21129
  continue;
@@ -20923,8 +21138,8 @@ function readMessages(sessionID) {
20923
21138
  });
20924
21139
  }
20925
21140
  // src/hooks/session-recovery/storage/parts-reader.ts
20926
- import { existsSync as existsSync20, readdirSync as readdirSync7, readFileSync as readFileSync15 } from "fs";
20927
- import { join as join22 } from "path";
21141
+ import { existsSync as existsSync21, readdirSync as readdirSync7, readFileSync as readFileSync16 } from "fs";
21142
+ import { join as join23 } from "path";
20928
21143
 
20929
21144
  // src/hooks/session-recovery/constants.ts
20930
21145
  var THINKING_TYPES = new Set(["thinking", "redacted_thinking", "reasoning"]);
@@ -20935,15 +21150,15 @@ var CONTENT_TYPES = new Set(["text", "tool", "tool_use", "tool_result"]);
20935
21150
  function readParts(messageID) {
20936
21151
  if (isSqliteBackend())
20937
21152
  return [];
20938
- const partDir = join22(PART_STORAGE, messageID);
20939
- if (!existsSync20(partDir))
21153
+ const partDir = join23(PART_STORAGE, messageID);
21154
+ if (!existsSync21(partDir))
20940
21155
  return [];
20941
21156
  const parts = [];
20942
21157
  for (const file of readdirSync7(partDir)) {
20943
21158
  if (!file.endsWith(".json"))
20944
21159
  continue;
20945
21160
  try {
20946
- const content = readFileSync15(join22(partDir, file), "utf-8");
21161
+ const content = readFileSync16(join23(partDir, file), "utf-8");
20947
21162
  parts.push(JSON.parse(content));
20948
21163
  } catch {
20949
21164
  continue;
@@ -20974,15 +21189,15 @@ function messageHasContent(messageID) {
20974
21189
  return parts.some(hasContent);
20975
21190
  }
20976
21191
  // src/hooks/session-recovery/storage/text-part-injector.ts
20977
- import { existsSync as existsSync21, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
20978
- import { join as join23 } from "path";
21192
+ import { existsSync as existsSync22, mkdirSync as mkdirSync5, writeFileSync as writeFileSync6 } from "fs";
21193
+ import { join as join24 } from "path";
20979
21194
  function injectTextPart(sessionID, messageID, text) {
20980
21195
  if (isSqliteBackend()) {
20981
21196
  log("[session-recovery] Disabled on SQLite backend: injectTextPart (use async variant)");
20982
21197
  return false;
20983
21198
  }
20984
- const partDir = join23(PART_STORAGE, messageID);
20985
- if (!existsSync21(partDir)) {
21199
+ const partDir = join24(PART_STORAGE, messageID);
21200
+ if (!existsSync22(partDir)) {
20986
21201
  mkdirSync5(partDir, { recursive: true });
20987
21202
  }
20988
21203
  const partId = generatePartId();
@@ -20995,7 +21210,7 @@ function injectTextPart(sessionID, messageID, text) {
20995
21210
  synthetic: true
20996
21211
  };
20997
21212
  try {
20998
- writeFileSync5(join23(partDir, `${partId}.json`), JSON.stringify(part, null, 2));
21213
+ writeFileSync6(join24(partDir, `${partId}.json`), JSON.stringify(part, null, 2));
20999
21214
  return true;
21000
21215
  } catch {
21001
21216
  return false;
@@ -21052,30 +21267,30 @@ function findEmptyMessageByIndex(sessionID, targetIndex) {
21052
21267
  return null;
21053
21268
  }
21054
21269
  // src/hooks/session-recovery/storage/empty-text.ts
21055
- import { existsSync as existsSync22, readdirSync as readdirSync8, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
21056
- import { join as join24 } from "path";
21270
+ import { existsSync as existsSync23, readdirSync as readdirSync8, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
21271
+ import { join as join25 } from "path";
21057
21272
  function replaceEmptyTextParts(messageID, replacementText) {
21058
21273
  if (isSqliteBackend()) {
21059
21274
  log("[session-recovery] Disabled on SQLite backend: replaceEmptyTextParts (use async variant)");
21060
21275
  return false;
21061
21276
  }
21062
- const partDir = join24(PART_STORAGE, messageID);
21063
- if (!existsSync22(partDir))
21277
+ const partDir = join25(PART_STORAGE, messageID);
21278
+ if (!existsSync23(partDir))
21064
21279
  return false;
21065
21280
  let anyReplaced = false;
21066
21281
  for (const file of readdirSync8(partDir)) {
21067
21282
  if (!file.endsWith(".json"))
21068
21283
  continue;
21069
21284
  try {
21070
- const filePath = join24(partDir, file);
21071
- const content = readFileSync16(filePath, "utf-8");
21285
+ const filePath = join25(partDir, file);
21286
+ const content = readFileSync17(filePath, "utf-8");
21072
21287
  const part = JSON.parse(content);
21073
21288
  if (part.type === "text") {
21074
21289
  const textPart = part;
21075
21290
  if (!textPart.text?.trim()) {
21076
21291
  textPart.text = replacementText;
21077
21292
  textPart.synthetic = true;
21078
- writeFileSync6(filePath, JSON.stringify(textPart, null, 2));
21293
+ writeFileSync7(filePath, JSON.stringify(textPart, null, 2));
21079
21294
  anyReplaced = true;
21080
21295
  }
21081
21296
  }
@@ -21160,8 +21375,8 @@ function findMessageByIndexNeedingThinking(sessionID, targetIndex) {
21160
21375
  return firstIsThinking ? null : targetMessage.id;
21161
21376
  }
21162
21377
  // src/hooks/session-recovery/storage/thinking-prepend.ts
21163
- import { existsSync as existsSync23, mkdirSync as mkdirSync6, writeFileSync as writeFileSync7 } from "fs";
21164
- import { join as join25 } from "path";
21378
+ import { existsSync as existsSync24, mkdirSync as mkdirSync6, writeFileSync as writeFileSync8 } from "fs";
21379
+ import { join as join26 } from "path";
21165
21380
  function findLastThinkingContent(sessionID, beforeMessageID) {
21166
21381
  const messages = readMessages(sessionID);
21167
21382
  const currentIndex = messages.findIndex((message) => message.id === beforeMessageID);
@@ -21190,8 +21405,8 @@ function prependThinkingPart(sessionID, messageID) {
21190
21405
  log("[session-recovery] Disabled on SQLite backend: prependThinkingPart (use async variant)");
21191
21406
  return false;
21192
21407
  }
21193
- const partDir = join25(PART_STORAGE, messageID);
21194
- if (!existsSync23(partDir)) {
21408
+ const partDir = join26(PART_STORAGE, messageID);
21409
+ if (!existsSync24(partDir)) {
21195
21410
  mkdirSync6(partDir, { recursive: true });
21196
21411
  }
21197
21412
  const previousThinking = findLastThinkingContent(sessionID, messageID);
@@ -21205,7 +21420,7 @@ function prependThinkingPart(sessionID, messageID) {
21205
21420
  synthetic: true
21206
21421
  };
21207
21422
  try {
21208
- writeFileSync7(join25(partDir, `${partId}.json`), JSON.stringify(part, null, 2));
21423
+ writeFileSync8(join26(partDir, `${partId}.json`), JSON.stringify(part, null, 2));
21209
21424
  return true;
21210
21425
  } catch {
21211
21426
  return false;
@@ -21256,23 +21471,23 @@ async function prependThinkingPartAsync(client, sessionID, messageID) {
21256
21471
  }
21257
21472
  }
21258
21473
  // src/hooks/session-recovery/storage/thinking-strip.ts
21259
- import { existsSync as existsSync24, readdirSync as readdirSync9, readFileSync as readFileSync17, unlinkSync as unlinkSync2 } from "fs";
21260
- import { join as join26 } from "path";
21474
+ import { existsSync as existsSync25, readdirSync as readdirSync9, readFileSync as readFileSync18, unlinkSync as unlinkSync2 } from "fs";
21475
+ import { join as join27 } from "path";
21261
21476
  function stripThinkingParts(messageID) {
21262
21477
  if (isSqliteBackend()) {
21263
21478
  log("[session-recovery] Disabled on SQLite backend: stripThinkingParts (use async variant)");
21264
21479
  return false;
21265
21480
  }
21266
- const partDir = join26(PART_STORAGE, messageID);
21267
- if (!existsSync24(partDir))
21481
+ const partDir = join27(PART_STORAGE, messageID);
21482
+ if (!existsSync25(partDir))
21268
21483
  return false;
21269
21484
  let anyRemoved = false;
21270
21485
  for (const file of readdirSync9(partDir)) {
21271
21486
  if (!file.endsWith(".json"))
21272
21487
  continue;
21273
21488
  try {
21274
- const filePath = join26(partDir, file);
21275
- const content = readFileSync17(filePath, "utf-8");
21489
+ const filePath = join27(partDir, file);
21490
+ const content = readFileSync18(filePath, "utf-8");
21276
21491
  const part = JSON.parse(content);
21277
21492
  if (THINKING_TYPES.has(part.type)) {
21278
21493
  unlinkSync2(filePath);
@@ -22476,10 +22691,10 @@ function mergeDefs(...defs) {
22476
22691
  function cloneDef(schema2) {
22477
22692
  return mergeDefs(schema2._zod.def);
22478
22693
  }
22479
- function getElementAtPath(obj, path5) {
22480
- if (!path5)
22694
+ function getElementAtPath(obj, path6) {
22695
+ if (!path6)
22481
22696
  return obj;
22482
- return path5.reduce((acc, key) => acc?.[key], obj);
22697
+ return path6.reduce((acc, key) => acc?.[key], obj);
22483
22698
  }
22484
22699
  function promiseAllObject(promisesObj) {
22485
22700
  const keys = Object.keys(promisesObj);
@@ -22860,11 +23075,11 @@ function aborted(x, startIndex = 0) {
22860
23075
  }
22861
23076
  return false;
22862
23077
  }
22863
- function prefixIssues(path5, issues) {
23078
+ function prefixIssues(path6, issues) {
22864
23079
  return issues.map((iss) => {
22865
23080
  var _a;
22866
23081
  (_a = iss).path ?? (_a.path = []);
22867
- iss.path.unshift(path5);
23082
+ iss.path.unshift(path6);
22868
23083
  return iss;
22869
23084
  });
22870
23085
  }
@@ -23047,7 +23262,7 @@ function formatError2(error, mapper = (issue2) => issue2.message) {
23047
23262
  }
23048
23263
  function treeifyError(error, mapper = (issue2) => issue2.message) {
23049
23264
  const result = { errors: [] };
23050
- const processError = (error2, path5 = []) => {
23265
+ const processError = (error2, path6 = []) => {
23051
23266
  var _a, _b;
23052
23267
  for (const issue2 of error2.issues) {
23053
23268
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -23057,7 +23272,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
23057
23272
  } else if (issue2.code === "invalid_element") {
23058
23273
  processError({ issues: issue2.issues }, issue2.path);
23059
23274
  } else {
23060
- const fullpath = [...path5, ...issue2.path];
23275
+ const fullpath = [...path6, ...issue2.path];
23061
23276
  if (fullpath.length === 0) {
23062
23277
  result.errors.push(mapper(issue2));
23063
23278
  continue;
@@ -23089,8 +23304,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
23089
23304
  }
23090
23305
  function toDotPath(_path) {
23091
23306
  const segs = [];
23092
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23093
- for (const seg of path5) {
23307
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23308
+ for (const seg of path6) {
23094
23309
  if (typeof seg === "number")
23095
23310
  segs.push(`[${seg}]`);
23096
23311
  else if (typeof seg === "symbol")
@@ -34837,13 +35052,13 @@ function resolveRef(ref, ctx) {
34837
35052
  if (!ref.startsWith("#")) {
34838
35053
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
34839
35054
  }
34840
- const path5 = ref.slice(1).split("/").filter(Boolean);
34841
- if (path5.length === 0) {
35055
+ const path6 = ref.slice(1).split("/").filter(Boolean);
35056
+ if (path6.length === 0) {
34842
35057
  return ctx.rootSchema;
34843
35058
  }
34844
35059
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
34845
- if (path5[0] === defsKey) {
34846
- const key = path5[1];
35060
+ if (path6[0] === defsKey) {
35061
+ const key = path6[1];
34847
35062
  if (!key || !ctx.defs[key]) {
34848
35063
  throw new Error(`Reference not found: ${ref}`);
34849
35064
  }
@@ -35247,24 +35462,24 @@ config(en_default());
35247
35462
  var zod_default = exports_external;
35248
35463
 
35249
35464
  // src/hooks/comment-checker/cli-runner.ts
35250
- import { existsSync as existsSync27 } from "fs";
35465
+ import { existsSync as existsSync28 } from "fs";
35251
35466
 
35252
35467
  // src/hooks/comment-checker/cli.ts
35253
35468
  var {spawn: spawn9 } = globalThis.Bun;
35254
35469
  import { createRequire as createRequire2 } from "module";
35255
- import { dirname, join as join28 } from "path";
35256
- import { existsSync as existsSync26 } from "fs";
35257
- import * as fs5 from "fs";
35470
+ import { dirname, join as join29 } from "path";
35471
+ import { existsSync as existsSync27 } from "fs";
35472
+ import * as fs6 from "fs";
35258
35473
  import { tmpdir as tmpdir3 } from "os";
35259
35474
 
35260
35475
  // src/hooks/comment-checker/downloader.ts
35261
- import { existsSync as existsSync25, appendFileSync as appendFileSync2 } from "fs";
35262
- import { join as join27 } from "path";
35263
- import { homedir as homedir7, tmpdir as tmpdir2 } from "os";
35476
+ import { existsSync as existsSync26, appendFileSync as appendFileSync2 } from "fs";
35477
+ import { join as join28 } from "path";
35478
+ import { homedir as homedir8, tmpdir as tmpdir2 } from "os";
35264
35479
  import { createRequire } from "module";
35265
35480
  init_logger();
35266
35481
  var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
35267
- var DEBUG_FILE = join27(tmpdir2(), "comment-checker-debug.log");
35482
+ var DEBUG_FILE = join28(tmpdir2(), "comment-checker-debug.log");
35268
35483
  function debugLog(...args) {
35269
35484
  if (DEBUG) {
35270
35485
  const msg = `[${new Date().toISOString()}] [comment-checker:downloader] ${args.map((a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)).join(" ")}
@@ -35283,12 +35498,12 @@ var PLATFORM_MAP = {
35283
35498
  function getCacheDir2() {
35284
35499
  if (process.platform === "win32") {
35285
35500
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
35286
- const base2 = localAppData || join27(homedir7(), "AppData", "Local");
35287
- return join27(base2, "oh-my-opencode", "bin");
35501
+ const base2 = localAppData || join28(homedir8(), "AppData", "Local");
35502
+ return join28(base2, "oh-my-opencode", "bin");
35288
35503
  }
35289
35504
  const xdgCache = process.env.XDG_CACHE_HOME;
35290
- const base = xdgCache || join27(homedir7(), ".cache");
35291
- return join27(base, "oh-my-opencode", "bin");
35505
+ const base = xdgCache || join28(homedir8(), ".cache");
35506
+ return join28(base, "oh-my-opencode", "bin");
35292
35507
  }
35293
35508
  function getBinaryName() {
35294
35509
  return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
@@ -35314,20 +35529,20 @@ async function downloadCommentChecker() {
35314
35529
  }
35315
35530
  const cacheDir = getCacheDir2();
35316
35531
  const binaryName = getBinaryName();
35317
- const binaryPath = join27(cacheDir, binaryName);
35318
- if (existsSync25(binaryPath)) {
35532
+ const binaryPath = join28(cacheDir, binaryName);
35533
+ if (existsSync26(binaryPath)) {
35319
35534
  debugLog("Binary already cached at:", binaryPath);
35320
35535
  return binaryPath;
35321
35536
  }
35322
35537
  const version2 = getPackageVersion();
35323
- const { os: os4, arch, ext } = platformInfo;
35324
- const assetName = `comment-checker_v${version2}_${os4}_${arch}.${ext}`;
35538
+ const { os: os5, arch, ext } = platformInfo;
35539
+ const assetName = `comment-checker_v${version2}_${os5}_${arch}.${ext}`;
35325
35540
  const downloadUrl = `https://github.com/${REPO}/releases/download/v${version2}/${assetName}`;
35326
35541
  debugLog(`Downloading from: ${downloadUrl}`);
35327
35542
  log(`[oh-my-opencode] Downloading comment-checker binary...`);
35328
35543
  try {
35329
35544
  ensureCacheDir(cacheDir);
35330
- const archivePath = join27(cacheDir, assetName);
35545
+ const archivePath = join28(cacheDir, assetName);
35331
35546
  await downloadArchive(downloadUrl, archivePath);
35332
35547
  debugLog(`Downloaded archive to: ${archivePath}`);
35333
35548
  if (ext === "tar.gz") {
@@ -35359,12 +35574,12 @@ async function ensureCommentCheckerBinary() {
35359
35574
 
35360
35575
  // src/hooks/comment-checker/cli.ts
35361
35576
  var DEBUG2 = process.env.COMMENT_CHECKER_DEBUG === "1";
35362
- var DEBUG_FILE2 = join28(tmpdir3(), "comment-checker-debug.log");
35577
+ var DEBUG_FILE2 = join29(tmpdir3(), "comment-checker-debug.log");
35363
35578
  function debugLog2(...args) {
35364
35579
  if (DEBUG2) {
35365
35580
  const msg = `[${new Date().toISOString()}] [comment-checker:cli] ${args.map((a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)).join(" ")}
35366
35581
  `;
35367
- fs5.appendFileSync(DEBUG_FILE2, msg);
35582
+ fs6.appendFileSync(DEBUG_FILE2, msg);
35368
35583
  }
35369
35584
  }
35370
35585
  function getBinaryName2() {
@@ -35385,8 +35600,8 @@ function findCommentCheckerPathSync() {
35385
35600
  const require2 = createRequire2(import.meta.url);
35386
35601
  const cliPkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
35387
35602
  const cliDir = dirname(cliPkgPath);
35388
- const binaryPath = join28(cliDir, "bin", binaryName);
35389
- if (existsSync26(binaryPath)) {
35603
+ const binaryPath = join29(cliDir, "bin", binaryName);
35604
+ if (existsSync27(binaryPath)) {
35390
35605
  debugLog2("found binary in main package:", binaryPath);
35391
35606
  return binaryPath;
35392
35607
  }
@@ -35407,7 +35622,7 @@ async function getCommentCheckerPath() {
35407
35622
  }
35408
35623
  initPromise2 = (async () => {
35409
35624
  const syncPath = findCommentCheckerPathSync();
35410
- if (syncPath && existsSync26(syncPath)) {
35625
+ if (syncPath && existsSync27(syncPath)) {
35411
35626
  resolvedCliPath = syncPath;
35412
35627
  debugLog2("using sync-resolved path:", syncPath);
35413
35628
  return syncPath;
@@ -35430,8 +35645,8 @@ function getCommentCheckerPathSync() {
35430
35645
  function startBackgroundInit() {
35431
35646
  if (!initPromise2) {
35432
35647
  initPromise2 = getCommentCheckerPath();
35433
- initPromise2.then((path5) => {
35434
- debugLog2("background init complete:", path5 || "no binary");
35648
+ initPromise2.then((path6) => {
35649
+ debugLog2("background init complete:", path6 || "no binary");
35435
35650
  }).catch((err) => {
35436
35651
  debugLog2("background init error:", err);
35437
35652
  });
@@ -35443,7 +35658,7 @@ async function runCommentChecker(input, cliPath, customPrompt) {
35443
35658
  debugLog2("comment-checker binary not found");
35444
35659
  return { hasComments: false, message: "" };
35445
35660
  }
35446
- if (!existsSync26(binaryPath)) {
35661
+ if (!existsSync27(binaryPath)) {
35447
35662
  debugLog2("comment-checker binary does not exist:", binaryPath);
35448
35663
  return { hasComments: false, message: "" };
35449
35664
  }
@@ -35538,8 +35753,8 @@ async function withCommentCheckerLock(fn, fallback, debugLog3) {
35538
35753
  function initializeCommentCheckerCli(debugLog3) {
35539
35754
  startBackgroundInit();
35540
35755
  cliPathPromise = getCommentCheckerPath();
35541
- cliPathPromise.then((path5) => {
35542
- debugLog3("CLI path resolved:", path5 || "disabled (no binary)");
35756
+ cliPathPromise.then((path6) => {
35757
+ debugLog3("CLI path resolved:", path6 || "disabled (no binary)");
35543
35758
  }).catch((err) => {
35544
35759
  debugLog3("CLI path resolution error:", err);
35545
35760
  });
@@ -35602,7 +35817,7 @@ ${result.message}`;
35602
35817
  }
35603
35818
  }
35604
35819
  function isCliPathUsable(cliPath) {
35605
- return Boolean(cliPath && existsSync27(cliPath));
35820
+ return Boolean(cliPath && existsSync28(cliPath));
35606
35821
  }
35607
35822
 
35608
35823
  // src/hooks/comment-checker/pending-calls.ts
@@ -35639,16 +35854,16 @@ function takePendingCall(callID) {
35639
35854
  }
35640
35855
 
35641
35856
  // src/hooks/comment-checker/hook.ts
35642
- import * as fs6 from "fs";
35857
+ import * as fs7 from "fs";
35643
35858
  import { tmpdir as tmpdir4 } from "os";
35644
- import { join as join29 } from "path";
35859
+ import { join as join30 } from "path";
35645
35860
  var DEBUG3 = process.env.COMMENT_CHECKER_DEBUG === "1";
35646
- var DEBUG_FILE3 = join29(tmpdir4(), "comment-checker-debug.log");
35861
+ var DEBUG_FILE3 = join30(tmpdir4(), "comment-checker-debug.log");
35647
35862
  function debugLog3(...args) {
35648
35863
  if (DEBUG3) {
35649
35864
  const msg = `[${new Date().toISOString()}] [comment-checker:hook] ${args.map((a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)).join(" ")}
35650
35865
  `;
35651
- fs6.appendFileSync(DEBUG_FILE3, msg);
35866
+ fs7.appendFileSync(DEBUG_FILE3, msg);
35652
35867
  }
35653
35868
  }
35654
35869
  function createCommentCheckerHooks(config2) {
@@ -35802,25 +36017,25 @@ function createToolOutputTruncatorHook(ctx, options) {
35802
36017
  };
35803
36018
  }
35804
36019
  // src/hooks/directory-agents-injector/injector.ts
35805
- import { readFileSync as readFileSync19 } from "fs";
36020
+ import { readFileSync as readFileSync20 } from "fs";
35806
36021
  import { dirname as dirname3 } from "path";
35807
36022
 
35808
36023
  // src/hooks/directory-agents-injector/finder.ts
35809
- import { existsSync as existsSync28 } from "fs";
35810
- import { dirname as dirname2, isAbsolute as isAbsolute2, join as join31, resolve as resolve2 } from "path";
36024
+ import { existsSync as existsSync29 } from "fs";
36025
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join32, resolve as resolve2 } from "path";
35811
36026
 
35812
36027
  // src/hooks/directory-agents-injector/constants.ts
35813
- import { join as join30 } from "path";
35814
- var AGENTS_INJECTOR_STORAGE = join30(OPENCODE_STORAGE, "directory-agents");
36028
+ import { join as join31 } from "path";
36029
+ var AGENTS_INJECTOR_STORAGE = join31(OPENCODE_STORAGE, "directory-agents");
35815
36030
  var AGENTS_FILENAME = "AGENTS.md";
35816
36031
 
35817
36032
  // src/hooks/directory-agents-injector/finder.ts
35818
- function resolveFilePath2(rootDirectory, path5) {
35819
- if (!path5)
36033
+ function resolveFilePath2(rootDirectory, path6) {
36034
+ if (!path6)
35820
36035
  return null;
35821
- if (isAbsolute2(path5))
35822
- return path5;
35823
- return resolve2(rootDirectory, path5);
36036
+ if (isAbsolute2(path6))
36037
+ return path6;
36038
+ return resolve2(rootDirectory, path6);
35824
36039
  }
35825
36040
  function findAgentsMdUp(input) {
35826
36041
  const found = [];
@@ -35828,8 +36043,8 @@ function findAgentsMdUp(input) {
35828
36043
  while (true) {
35829
36044
  const isRootDir = current === input.rootDir;
35830
36045
  if (!isRootDir) {
35831
- const agentsPath = join31(current, AGENTS_FILENAME);
35832
- if (existsSync28(agentsPath)) {
36046
+ const agentsPath = join32(current, AGENTS_FILENAME);
36047
+ if (existsSync29(agentsPath)) {
35833
36048
  found.push(agentsPath);
35834
36049
  }
35835
36050
  }
@@ -35847,21 +36062,21 @@ function findAgentsMdUp(input) {
35847
36062
 
35848
36063
  // src/shared/session-injected-paths.ts
35849
36064
  import {
35850
- existsSync as existsSync29,
36065
+ existsSync as existsSync30,
35851
36066
  mkdirSync as mkdirSync7,
35852
- readFileSync as readFileSync18,
36067
+ readFileSync as readFileSync19,
35853
36068
  unlinkSync as unlinkSync3,
35854
- writeFileSync as writeFileSync8
36069
+ writeFileSync as writeFileSync9
35855
36070
  } from "fs";
35856
- import { join as join32 } from "path";
36071
+ import { join as join33 } from "path";
35857
36072
  function createInjectedPathsStorage(storageDir) {
35858
- const getStoragePath = (sessionID) => join32(storageDir, `${sessionID}.json`);
36073
+ const getStoragePath = (sessionID) => join33(storageDir, `${sessionID}.json`);
35859
36074
  const loadInjectedPaths = (sessionID) => {
35860
36075
  const filePath = getStoragePath(sessionID);
35861
- if (!existsSync29(filePath))
36076
+ if (!existsSync30(filePath))
35862
36077
  return new Set;
35863
36078
  try {
35864
- const content = readFileSync18(filePath, "utf-8");
36079
+ const content = readFileSync19(filePath, "utf-8");
35865
36080
  const data = JSON.parse(content);
35866
36081
  return new Set(data.injectedPaths);
35867
36082
  } catch {
@@ -35869,7 +36084,7 @@ function createInjectedPathsStorage(storageDir) {
35869
36084
  }
35870
36085
  };
35871
36086
  const saveInjectedPaths = (sessionID, paths) => {
35872
- if (!existsSync29(storageDir)) {
36087
+ if (!existsSync30(storageDir)) {
35873
36088
  mkdirSync7(storageDir, { recursive: true });
35874
36089
  }
35875
36090
  const data = {
@@ -35877,11 +36092,11 @@ function createInjectedPathsStorage(storageDir) {
35877
36092
  injectedPaths: [...paths],
35878
36093
  updatedAt: Date.now()
35879
36094
  };
35880
- writeFileSync8(getStoragePath(sessionID), JSON.stringify(data, null, 2));
36095
+ writeFileSync9(getStoragePath(sessionID), JSON.stringify(data, null, 2));
35881
36096
  };
35882
36097
  const clearInjectedPaths = (sessionID) => {
35883
36098
  const filePath = getStoragePath(sessionID);
35884
- if (existsSync29(filePath)) {
36099
+ if (existsSync30(filePath)) {
35885
36100
  unlinkSync3(filePath);
35886
36101
  }
35887
36102
  };
@@ -35919,7 +36134,7 @@ async function processFilePathForAgentsInjection(input) {
35919
36134
  if (cache.has(agentsDir))
35920
36135
  continue;
35921
36136
  try {
35922
- const content = readFileSync19(agentsPath, "utf-8");
36137
+ const content = readFileSync20(agentsPath, "utf-8");
35923
36138
  const { result, truncated } = await input.truncator.truncate(input.sessionID, content);
35924
36139
  const truncationNotice = truncated ? `
35925
36140
 
@@ -35980,32 +36195,32 @@ function createDirectoryAgentsInjectorHook(ctx, modelCacheState) {
35980
36195
  };
35981
36196
  }
35982
36197
  // src/hooks/directory-readme-injector/injector.ts
35983
- import { readFileSync as readFileSync20 } from "fs";
36198
+ import { readFileSync as readFileSync21 } from "fs";
35984
36199
  import { dirname as dirname5 } from "path";
35985
36200
 
35986
36201
  // src/hooks/directory-readme-injector/finder.ts
35987
- import { existsSync as existsSync30 } from "fs";
35988
- import { dirname as dirname4, isAbsolute as isAbsolute3, join as join34, resolve as resolve3 } from "path";
36202
+ import { existsSync as existsSync31 } from "fs";
36203
+ import { dirname as dirname4, isAbsolute as isAbsolute3, join as join35, resolve as resolve3 } from "path";
35989
36204
 
35990
36205
  // src/hooks/directory-readme-injector/constants.ts
35991
- import { join as join33 } from "path";
35992
- var README_INJECTOR_STORAGE = join33(OPENCODE_STORAGE, "directory-readme");
36206
+ import { join as join34 } from "path";
36207
+ var README_INJECTOR_STORAGE = join34(OPENCODE_STORAGE, "directory-readme");
35993
36208
  var README_FILENAME = "README.md";
35994
36209
 
35995
36210
  // src/hooks/directory-readme-injector/finder.ts
35996
- function resolveFilePath3(rootDirectory, path5) {
35997
- if (!path5)
36211
+ function resolveFilePath3(rootDirectory, path6) {
36212
+ if (!path6)
35998
36213
  return null;
35999
- if (isAbsolute3(path5))
36000
- return path5;
36001
- return resolve3(rootDirectory, path5);
36214
+ if (isAbsolute3(path6))
36215
+ return path6;
36216
+ return resolve3(rootDirectory, path6);
36002
36217
  }
36003
36218
  function findReadmeMdUp(input) {
36004
36219
  const found = [];
36005
36220
  let current = input.startDir;
36006
36221
  while (true) {
36007
- const readmePath = join34(current, README_FILENAME);
36008
- if (existsSync30(readmePath)) {
36222
+ const readmePath = join35(current, README_FILENAME);
36223
+ if (existsSync31(readmePath)) {
36009
36224
  found.push(readmePath);
36010
36225
  }
36011
36226
  if (current === input.rootDir)
@@ -36047,7 +36262,7 @@ async function processFilePathForReadmeInjection(input) {
36047
36262
  if (cache.has(readmeDir))
36048
36263
  continue;
36049
36264
  try {
36050
- const content = readFileSync20(readmePath, "utf-8");
36265
+ const content = readFileSync21(readmePath, "utf-8");
36051
36266
  const { result, truncated } = await input.truncator.truncate(input.sessionID, content);
36052
36267
  const truncationNotice = truncated ? `
36053
36268
 
@@ -36362,14 +36577,14 @@ function incrementEmptyContentAttempt(autoCompactState, sessionID) {
36362
36577
  }
36363
36578
 
36364
36579
  // src/hooks/anthropic-context-window-limit-recovery/tool-result-storage.ts
36365
- import { existsSync as existsSync32, readdirSync as readdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
36366
- import { join as join35 } from "path";
36580
+ import { existsSync as existsSync33, readdirSync as readdirSync11, readFileSync as readFileSync22, writeFileSync as writeFileSync10 } from "fs";
36581
+ import { join as join36 } from "path";
36367
36582
 
36368
36583
  // src/hooks/anthropic-context-window-limit-recovery/message-storage-directory.ts
36369
- import { existsSync as existsSync31, readdirSync as readdirSync10 } from "fs";
36584
+ import { existsSync as existsSync32, readdirSync as readdirSync10 } from "fs";
36370
36585
  function getMessageIds(sessionID) {
36371
36586
  const messageDir = getMessageDir(sessionID);
36372
- if (!messageDir || !existsSync31(messageDir))
36587
+ if (!messageDir || !existsSync32(messageDir))
36373
36588
  return [];
36374
36589
  const messageIds = [];
36375
36590
  for (const file2 of readdirSync10(messageDir)) {
@@ -36391,15 +36606,15 @@ function findToolResultsBySize(sessionID) {
36391
36606
  const messageIds = getMessageIds(sessionID);
36392
36607
  const results = [];
36393
36608
  for (const messageID of messageIds) {
36394
- const partDir = join35(PART_STORAGE, messageID);
36395
- if (!existsSync32(partDir))
36609
+ const partDir = join36(PART_STORAGE, messageID);
36610
+ if (!existsSync33(partDir))
36396
36611
  continue;
36397
36612
  for (const file2 of readdirSync11(partDir)) {
36398
36613
  if (!file2.endsWith(".json"))
36399
36614
  continue;
36400
36615
  try {
36401
- const partPath = join35(partDir, file2);
36402
- const content = readFileSync21(partPath, "utf-8");
36616
+ const partPath = join36(partDir, file2);
36617
+ const content = readFileSync22(partPath, "utf-8");
36403
36618
  const part = JSON.parse(content);
36404
36619
  if (part.type === "tool" && part.state?.output && !part.truncated) {
36405
36620
  results.push({
@@ -36426,7 +36641,7 @@ function truncateToolResult(partPath) {
36426
36641
  return { success: false };
36427
36642
  }
36428
36643
  try {
36429
- const content = readFileSync21(partPath, "utf-8");
36644
+ const content = readFileSync22(partPath, "utf-8");
36430
36645
  const part = JSON.parse(content);
36431
36646
  if (!part.state?.output) {
36432
36647
  return { success: false };
@@ -36440,7 +36655,7 @@ function truncateToolResult(partPath) {
36440
36655
  part.state.time = { start: Date.now() };
36441
36656
  }
36442
36657
  part.state.time.compacted = Date.now();
36443
- writeFileSync9(partPath, JSON.stringify(part, null, 2));
36658
+ writeFileSync10(partPath, JSON.stringify(part, null, 2));
36444
36659
  return { success: true, toolName, originalSize };
36445
36660
  } catch {
36446
36661
  return { success: false };
@@ -37193,8 +37408,8 @@ async function executeCompact(sessionID, msg, autoCompactState, client, director
37193
37408
  }
37194
37409
 
37195
37410
  // src/hooks/anthropic-context-window-limit-recovery/pruning-deduplication.ts
37196
- import { readdirSync as readdirSync12, readFileSync as readFileSync22 } from "fs";
37197
- import { join as join36 } from "path";
37411
+ import { readdirSync as readdirSync12, readFileSync as readFileSync23 } from "fs";
37412
+ import { join as join37 } from "path";
37198
37413
 
37199
37414
  // src/hooks/anthropic-context-window-limit-recovery/pruning-types.ts
37200
37415
  var CHARS_PER_TOKEN = 4;
@@ -37230,7 +37445,7 @@ function readMessages2(sessionID) {
37230
37445
  try {
37231
37446
  const files = readdirSync12(messageDir).filter((f) => f.endsWith(".json"));
37232
37447
  for (const file2 of files) {
37233
- const content = readFileSync22(join36(messageDir, file2), "utf-8");
37448
+ const content = readFileSync23(join37(messageDir, file2), "utf-8");
37234
37449
  const data = JSON.parse(content);
37235
37450
  if (data.parts) {
37236
37451
  messages.push(data);
@@ -37335,11 +37550,11 @@ function findToolOutput(messages, callID) {
37335
37550
  }
37336
37551
 
37337
37552
  // src/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.ts
37338
- import { existsSync as existsSync33, readdirSync as readdirSync13, readFileSync as readFileSync23 } from "fs";
37339
- import { join as join37 } from "path";
37553
+ import { existsSync as existsSync34, readdirSync as readdirSync13, readFileSync as readFileSync24 } from "fs";
37554
+ import { join as join38 } from "path";
37340
37555
  init_logger();
37341
37556
  function getPartStorage() {
37342
- return join37(getOpenCodeStorageDir(), "part");
37557
+ return join38(getOpenCodeStorageDir(), "part");
37343
37558
  }
37344
37559
  function getMessageIds2(sessionID) {
37345
37560
  const messageDir = getMessageDir(sessionID);
@@ -37364,15 +37579,15 @@ async function truncateToolOutputsByCallId(sessionID, callIds, client) {
37364
37579
  return { truncatedCount: 0 };
37365
37580
  let truncatedCount = 0;
37366
37581
  for (const messageID of messageIds) {
37367
- const partDir = join37(getPartStorage(), messageID);
37368
- if (!existsSync33(partDir))
37582
+ const partDir = join38(getPartStorage(), messageID);
37583
+ if (!existsSync34(partDir))
37369
37584
  continue;
37370
37585
  for (const file2 of readdirSync13(partDir)) {
37371
37586
  if (!file2.endsWith(".json"))
37372
37587
  continue;
37373
- const partPath = join37(partDir, file2);
37588
+ const partPath = join38(partDir, file2);
37374
37589
  try {
37375
- const content = readFileSync23(partPath, "utf-8");
37590
+ const content = readFileSync24(partPath, "utf-8");
37376
37591
  const part = JSON.parse(content);
37377
37592
  if (part.type !== "tool" || !part.callID)
37378
37593
  continue;
@@ -38196,8 +38411,8 @@ function createModelFallbackHook(args) {
38196
38411
  };
38197
38412
  }
38198
38413
  // src/hooks/claude-code-hooks/config.ts
38199
- import { join as join38 } from "path";
38200
- import { existsSync as existsSync34 } from "fs";
38414
+ import { join as join39 } from "path";
38415
+ import { existsSync as existsSync35 } from "fs";
38201
38416
  function normalizeHookMatcher(raw) {
38202
38417
  return {
38203
38418
  matcher: raw.matcher ?? raw.pattern ?? "*",
@@ -38223,11 +38438,11 @@ function normalizeHooksConfig(raw) {
38223
38438
  function getClaudeSettingsPaths(customPath) {
38224
38439
  const claudeConfigDir = getClaudeConfigDir();
38225
38440
  const paths = [
38226
- join38(claudeConfigDir, "settings.json"),
38227
- join38(process.cwd(), ".claude", "settings.json"),
38228
- join38(process.cwd(), ".claude", "settings.local.json")
38441
+ join39(claudeConfigDir, "settings.json"),
38442
+ join39(process.cwd(), ".claude", "settings.json"),
38443
+ join39(process.cwd(), ".claude", "settings.local.json")
38229
38444
  ];
38230
- if (customPath && existsSync34(customPath)) {
38445
+ if (customPath && existsSync35(customPath)) {
38231
38446
  paths.unshift(customPath);
38232
38447
  }
38233
38448
  return [...new Set(paths)];
@@ -38252,7 +38467,7 @@ async function loadClaudeHooksConfig(customSettingsPath) {
38252
38467
  const paths = getClaudeSettingsPaths(customSettingsPath);
38253
38468
  let mergedConfig = {};
38254
38469
  for (const settingsPath of paths) {
38255
- if (existsSync34(settingsPath)) {
38470
+ if (existsSync35(settingsPath)) {
38256
38471
  try {
38257
38472
  const content = await Bun.file(settingsPath).text();
38258
38473
  const settings = JSON.parse(content);
@@ -38270,21 +38485,21 @@ async function loadClaudeHooksConfig(customSettingsPath) {
38270
38485
 
38271
38486
  // src/hooks/claude-code-hooks/config-loader.ts
38272
38487
  init_logger();
38273
- import { existsSync as existsSync35 } from "fs";
38274
- import { join as join39 } from "path";
38275
- var USER_CONFIG_PATH = join39(getOpenCodeConfigDir({ binary: "opencode" }), "opencode-cc-plugin.json");
38488
+ import { existsSync as existsSync36 } from "fs";
38489
+ import { join as join40 } from "path";
38490
+ var USER_CONFIG_PATH = join40(getOpenCodeConfigDir({ binary: "opencode" }), "opencode-cc-plugin.json");
38276
38491
  function getProjectConfigPath() {
38277
- return join39(process.cwd(), ".opencode", "opencode-cc-plugin.json");
38492
+ return join40(process.cwd(), ".opencode", "opencode-cc-plugin.json");
38278
38493
  }
38279
- async function loadConfigFromPath(path5) {
38280
- if (!existsSync35(path5)) {
38494
+ async function loadConfigFromPath(path6) {
38495
+ if (!existsSync36(path6)) {
38281
38496
  return null;
38282
38497
  }
38283
38498
  try {
38284
- const content = await Bun.file(path5).text();
38499
+ const content = await Bun.file(path6).text();
38285
38500
  return JSON.parse(content);
38286
38501
  } catch (error48) {
38287
- log("Failed to load config", { path: path5, error: error48 });
38502
+ log("Failed to load config", { path: path6, error: error48 });
38288
38503
  return null;
38289
38504
  }
38290
38505
  }
@@ -38503,25 +38718,25 @@ ${USER_PROMPT_SUBMIT_TAG_CLOSE}`);
38503
38718
  }
38504
38719
 
38505
38720
  // src/hooks/claude-code-hooks/transcript.ts
38506
- import { join as join40 } from "path";
38507
- import { mkdirSync as mkdirSync8, appendFileSync as appendFileSync5, existsSync as existsSync36, writeFileSync as writeFileSync10, unlinkSync as unlinkSync4 } from "fs";
38721
+ import { join as join41 } from "path";
38722
+ import { mkdirSync as mkdirSync8, appendFileSync as appendFileSync5, existsSync as existsSync37, writeFileSync as writeFileSync11, unlinkSync as unlinkSync4 } from "fs";
38508
38723
  import { tmpdir as tmpdir5 } from "os";
38509
38724
  import { randomUUID } from "crypto";
38510
- var TRANSCRIPT_DIR = join40(getClaudeConfigDir(), "transcripts");
38725
+ var TRANSCRIPT_DIR = join41(getClaudeConfigDir(), "transcripts");
38511
38726
  function getTranscriptPath(sessionId) {
38512
- return join40(TRANSCRIPT_DIR, `${sessionId}.jsonl`);
38727
+ return join41(TRANSCRIPT_DIR, `${sessionId}.jsonl`);
38513
38728
  }
38514
38729
  function ensureTranscriptDir() {
38515
- if (!existsSync36(TRANSCRIPT_DIR)) {
38730
+ if (!existsSync37(TRANSCRIPT_DIR)) {
38516
38731
  mkdirSync8(TRANSCRIPT_DIR, { recursive: true });
38517
38732
  }
38518
38733
  }
38519
38734
  function appendTranscriptEntry(sessionId, entry) {
38520
38735
  ensureTranscriptDir();
38521
- const path5 = getTranscriptPath(sessionId);
38736
+ const path6 = getTranscriptPath(sessionId);
38522
38737
  const line = JSON.stringify(entry) + `
38523
38738
  `;
38524
- appendFileSync5(path5, line);
38739
+ appendFileSync5(path6, line);
38525
38740
  }
38526
38741
  var TRANSCRIPT_CACHE_TTL_MS = 5 * 60 * 1000;
38527
38742
  var transcriptCache = new Map;
@@ -38595,8 +38810,8 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
38595
38810
  });
38596
38811
  }
38597
38812
  const allEntries = [...baseEntries, buildCurrentEntry(currentToolName, currentToolInput)];
38598
- const tempPath = join40(tmpdir5(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
38599
- writeFileSync10(tempPath, allEntries.join(`
38813
+ const tempPath = join41(tmpdir5(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
38814
+ writeFileSync11(tempPath, allEntries.join(`
38600
38815
  `) + `
38601
38816
  `);
38602
38817
  const cacheEntry = transcriptCache.get(sessionId);
@@ -38606,8 +38821,8 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
38606
38821
  return tempPath;
38607
38822
  } catch {
38608
38823
  try {
38609
- const tempPath = join40(tmpdir5(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
38610
- writeFileSync10(tempPath, buildCurrentEntry(currentToolName, currentToolInput) + `
38824
+ const tempPath = join41(tmpdir5(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
38825
+ writeFileSync11(tempPath, buildCurrentEntry(currentToolName, currentToolInput) + `
38611
38826
  `);
38612
38827
  return tempPath;
38613
38828
  } catch {
@@ -38615,11 +38830,11 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
38615
38830
  }
38616
38831
  }
38617
38832
  }
38618
- function deleteTempTranscript(path5) {
38619
- if (!path5)
38833
+ function deleteTempTranscript(path6) {
38834
+ if (!path6)
38620
38835
  return;
38621
38836
  try {
38622
- unlinkSync4(path5);
38837
+ unlinkSync4(path6);
38623
38838
  } catch {}
38624
38839
  }
38625
38840
 
@@ -38824,10 +39039,10 @@ function createPreCompactHandler(ctx, config2) {
38824
39039
  }
38825
39040
 
38826
39041
  // src/hooks/claude-code-hooks/todo.ts
38827
- import { join as join41 } from "path";
38828
- var TODO_DIR = join41(getClaudeConfigDir(), "todos");
39042
+ import { join as join42 } from "path";
39043
+ var TODO_DIR = join42(getClaudeConfigDir(), "todos");
38829
39044
  function getTodoPath(sessionId) {
38830
- return join41(TODO_DIR, `${sessionId}-agent-${sessionId}.json`);
39045
+ return join42(TODO_DIR, `${sessionId}-agent-${sessionId}.json`);
38831
39046
  }
38832
39047
 
38833
39048
  // src/hooks/claude-code-hooks/stop.ts
@@ -39403,17 +39618,17 @@ function getRuleInjectionFilePath(output) {
39403
39618
 
39404
39619
  // src/hooks/rules-injector/storage.ts
39405
39620
  import {
39406
- existsSync as existsSync37,
39621
+ existsSync as existsSync38,
39407
39622
  mkdirSync as mkdirSync9,
39408
- readFileSync as readFileSync24,
39409
- writeFileSync as writeFileSync11,
39623
+ readFileSync as readFileSync25,
39624
+ writeFileSync as writeFileSync12,
39410
39625
  unlinkSync as unlinkSync5
39411
39626
  } from "fs";
39412
- import { join as join43 } from "path";
39627
+ import { join as join44 } from "path";
39413
39628
 
39414
39629
  // src/hooks/rules-injector/constants.ts
39415
- import { join as join42 } from "path";
39416
- var RULES_INJECTOR_STORAGE = join42(OPENCODE_STORAGE, "rules-injector");
39630
+ import { join as join43 } from "path";
39631
+ var RULES_INJECTOR_STORAGE = join43(OPENCODE_STORAGE, "rules-injector");
39417
39632
  var PROJECT_MARKERS = [
39418
39633
  ".git",
39419
39634
  "pyproject.toml",
@@ -39437,14 +39652,14 @@ var RULE_EXTENSIONS = [".md", ".mdc"];
39437
39652
 
39438
39653
  // src/hooks/rules-injector/storage.ts
39439
39654
  function getStoragePath(sessionID) {
39440
- return join43(RULES_INJECTOR_STORAGE, `${sessionID}.json`);
39655
+ return join44(RULES_INJECTOR_STORAGE, `${sessionID}.json`);
39441
39656
  }
39442
39657
  function loadInjectedRules(sessionID) {
39443
39658
  const filePath = getStoragePath(sessionID);
39444
- if (!existsSync37(filePath))
39659
+ if (!existsSync38(filePath))
39445
39660
  return { contentHashes: new Set, realPaths: new Set };
39446
39661
  try {
39447
- const content = readFileSync24(filePath, "utf-8");
39662
+ const content = readFileSync25(filePath, "utf-8");
39448
39663
  const data = JSON.parse(content);
39449
39664
  return {
39450
39665
  contentHashes: new Set(data.injectedHashes),
@@ -39455,7 +39670,7 @@ function loadInjectedRules(sessionID) {
39455
39670
  }
39456
39671
  }
39457
39672
  function saveInjectedRules(sessionID, data) {
39458
- if (!existsSync37(RULES_INJECTOR_STORAGE)) {
39673
+ if (!existsSync38(RULES_INJECTOR_STORAGE)) {
39459
39674
  mkdirSync9(RULES_INJECTOR_STORAGE, { recursive: true });
39460
39675
  }
39461
39676
  const storageData = {
@@ -39464,11 +39679,11 @@ function saveInjectedRules(sessionID, data) {
39464
39679
  injectedRealPaths: [...data.realPaths],
39465
39680
  updatedAt: Date.now()
39466
39681
  };
39467
- writeFileSync11(getStoragePath(sessionID), JSON.stringify(storageData, null, 2));
39682
+ writeFileSync12(getStoragePath(sessionID), JSON.stringify(storageData, null, 2));
39468
39683
  }
39469
39684
  function clearInjectedRules(sessionID) {
39470
39685
  const filePath = getStoragePath(sessionID);
39471
- if (existsSync37(filePath)) {
39686
+ if (existsSync38(filePath)) {
39472
39687
  unlinkSync5(filePath);
39473
39688
  }
39474
39689
  }
@@ -39490,13 +39705,13 @@ function createSessionCacheStore() {
39490
39705
  }
39491
39706
 
39492
39707
  // src/hooks/rules-injector/injector.ts
39493
- import { readFileSync as readFileSync25, statSync as statSync4 } from "fs";
39494
- import { homedir as homedir8 } from "os";
39708
+ import { readFileSync as readFileSync26, statSync as statSync4 } from "fs";
39709
+ import { homedir as homedir9 } from "os";
39495
39710
  import { relative as relative2, resolve as resolve4 } from "path";
39496
39711
 
39497
39712
  // src/hooks/rules-injector/project-root-finder.ts
39498
- import { existsSync as existsSync38, statSync as statSync2 } from "fs";
39499
- import { dirname as dirname6, join as join44 } from "path";
39713
+ import { existsSync as existsSync39, statSync as statSync2 } from "fs";
39714
+ import { dirname as dirname6, join as join45 } from "path";
39500
39715
  function findProjectRoot(startPath) {
39501
39716
  let current;
39502
39717
  try {
@@ -39507,8 +39722,8 @@ function findProjectRoot(startPath) {
39507
39722
  }
39508
39723
  while (true) {
39509
39724
  for (const marker of PROJECT_MARKERS) {
39510
- const markerPath = join44(current, marker);
39511
- if (existsSync38(markerPath)) {
39725
+ const markerPath = join45(current, marker);
39726
+ if (existsSync39(markerPath)) {
39512
39727
  return current;
39513
39728
  }
39514
39729
  }
@@ -39520,12 +39735,12 @@ function findProjectRoot(startPath) {
39520
39735
  }
39521
39736
  }
39522
39737
  // src/hooks/rules-injector/rule-file-finder.ts
39523
- import { existsSync as existsSync40, statSync as statSync3 } from "fs";
39524
- import { dirname as dirname7, join as join46 } from "path";
39738
+ import { existsSync as existsSync41, statSync as statSync3 } from "fs";
39739
+ import { dirname as dirname7, join as join47 } from "path";
39525
39740
 
39526
39741
  // src/hooks/rules-injector/rule-file-scanner.ts
39527
- import { existsSync as existsSync39, readdirSync as readdirSync14, realpathSync as realpathSync2 } from "fs";
39528
- import { join as join45 } from "path";
39742
+ import { existsSync as existsSync40, readdirSync as readdirSync14, realpathSync as realpathSync2 } from "fs";
39743
+ import { join as join46 } from "path";
39529
39744
  function isGitHubInstructionsDir(dir) {
39530
39745
  return dir.includes(".github/instructions") || dir.endsWith(".github/instructions");
39531
39746
  }
@@ -39536,12 +39751,12 @@ function isValidRuleFile(fileName, dir) {
39536
39751
  return RULE_EXTENSIONS.some((ext) => fileName.endsWith(ext));
39537
39752
  }
39538
39753
  function findRuleFilesRecursive(dir, results) {
39539
- if (!existsSync39(dir))
39754
+ if (!existsSync40(dir))
39540
39755
  return;
39541
39756
  try {
39542
39757
  const entries = readdirSync14(dir, { withFileTypes: true });
39543
39758
  for (const entry of entries) {
39544
- const fullPath = join45(dir, entry.name);
39759
+ const fullPath = join46(dir, entry.name);
39545
39760
  if (entry.isDirectory()) {
39546
39761
  findRuleFilesRecursive(fullPath, results);
39547
39762
  } else if (entry.isFile()) {
@@ -39568,7 +39783,7 @@ function findRuleFiles(projectRoot, homeDir, currentFile) {
39568
39783
  let distance = 0;
39569
39784
  while (true) {
39570
39785
  for (const [parent, subdir] of PROJECT_RULE_SUBDIRS) {
39571
- const ruleDir = join46(currentDir, parent, subdir);
39786
+ const ruleDir = join47(currentDir, parent, subdir);
39572
39787
  const files = [];
39573
39788
  findRuleFilesRecursive(ruleDir, files);
39574
39789
  for (const filePath of files) {
@@ -39594,8 +39809,8 @@ function findRuleFiles(projectRoot, homeDir, currentFile) {
39594
39809
  }
39595
39810
  if (projectRoot) {
39596
39811
  for (const ruleFile of PROJECT_RULE_FILES) {
39597
- const filePath = join46(projectRoot, ruleFile);
39598
- if (existsSync40(filePath)) {
39812
+ const filePath = join47(projectRoot, ruleFile);
39813
+ if (existsSync41(filePath)) {
39599
39814
  try {
39600
39815
  const stat = statSync3(filePath);
39601
39816
  if (stat.isFile()) {
@@ -39615,7 +39830,7 @@ function findRuleFiles(projectRoot, homeDir, currentFile) {
39615
39830
  }
39616
39831
  }
39617
39832
  }
39618
- const userRuleDir = join46(homeDir, USER_RULE_DIR);
39833
+ const userRuleDir = join47(homeDir, USER_RULE_DIR);
39619
39834
  const userFiles = [];
39620
39835
  findRuleFilesRecursive(userRuleDir, userFiles);
39621
39836
  for (const filePath of userFiles) {
@@ -39810,7 +40025,7 @@ function getCachedParsedRule(filePath, realPath) {
39810
40025
  if (cached2 && cached2.mtimeMs === stat.mtimeMs && cached2.size === stat.size) {
39811
40026
  return { metadata: cached2.metadata, body: cached2.body };
39812
40027
  }
39813
- const rawContent = readFileSync25(filePath, "utf-8");
40028
+ const rawContent = readFileSync26(filePath, "utf-8");
39814
40029
  const { metadata, body } = parseRuleFrontmatter(rawContent);
39815
40030
  parsedRuleCache.set(realPath, {
39816
40031
  mtimeMs: stat.mtimeMs,
@@ -39820,16 +40035,16 @@ function getCachedParsedRule(filePath, realPath) {
39820
40035
  });
39821
40036
  return { metadata, body };
39822
40037
  } catch {
39823
- const rawContent = readFileSync25(filePath, "utf-8");
40038
+ const rawContent = readFileSync26(filePath, "utf-8");
39824
40039
  return parseRuleFrontmatter(rawContent);
39825
40040
  }
39826
40041
  }
39827
- function resolveFilePath4(workspaceDirectory, path5) {
39828
- if (!path5)
40042
+ function resolveFilePath4(workspaceDirectory, path6) {
40043
+ if (!path6)
39829
40044
  return null;
39830
- if (path5.startsWith("/"))
39831
- return path5;
39832
- return resolve4(workspaceDirectory, path5);
40045
+ if (path6.startsWith("/"))
40046
+ return path6;
40047
+ return resolve4(workspaceDirectory, path6);
39833
40048
  }
39834
40049
  function createRuleInjectionProcessor(deps) {
39835
40050
  const { workspaceDirectory, truncator, getSessionCache: getSessionCache3 } = deps;
@@ -39839,7 +40054,7 @@ function createRuleInjectionProcessor(deps) {
39839
40054
  return;
39840
40055
  const projectRoot = findProjectRoot(resolved);
39841
40056
  const cache2 = getSessionCache3(sessionID);
39842
- const home = homedir8();
40057
+ const home = homedir9();
39843
40058
  const ruleFileCandidates = findRuleFiles(projectRoot, home, resolved);
39844
40059
  const toInject = [];
39845
40060
  let dirty = false;
@@ -39952,50 +40167,50 @@ function createBackgroundNotificationHook(manager) {
39952
40167
  init_logger();
39953
40168
 
39954
40169
  // src/hooks/auto-update-checker/checker/local-dev-path.ts
39955
- import * as fs7 from "fs";
40170
+ import * as fs8 from "fs";
39956
40171
  import { fileURLToPath } from "url";
39957
40172
 
39958
40173
  // src/hooks/auto-update-checker/constants.ts
39959
- import * as path5 from "path";
39960
- import * as os4 from "os";
40174
+ import * as path6 from "path";
40175
+ import * as os5 from "os";
39961
40176
  var PACKAGE_NAME = "oh-my-opencode";
39962
40177
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`;
39963
40178
  var NPM_FETCH_TIMEOUT = 5000;
39964
40179
  function getCacheDir3() {
39965
40180
  if (process.platform === "win32") {
39966
- return path5.join(process.env.LOCALAPPDATA ?? os4.homedir(), "opencode");
40181
+ return path6.join(process.env.LOCALAPPDATA ?? os5.homedir(), "opencode");
39967
40182
  }
39968
- return path5.join(os4.homedir(), ".cache", "opencode");
40183
+ return path6.join(os5.homedir(), ".cache", "opencode");
39969
40184
  }
39970
40185
  var CACHE_DIR = getCacheDir3();
39971
- var VERSION_FILE = path5.join(CACHE_DIR, "version");
40186
+ var VERSION_FILE = path6.join(CACHE_DIR, "version");
39972
40187
  function getWindowsAppdataDir2() {
39973
40188
  if (process.platform !== "win32")
39974
40189
  return null;
39975
- return process.env.APPDATA ?? path5.join(os4.homedir(), "AppData", "Roaming");
40190
+ return process.env.APPDATA ?? path6.join(os5.homedir(), "AppData", "Roaming");
39976
40191
  }
39977
40192
  var USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
39978
- var USER_OPENCODE_CONFIG = path5.join(USER_CONFIG_DIR, "opencode.json");
39979
- var USER_OPENCODE_CONFIG_JSONC = path5.join(USER_CONFIG_DIR, "opencode.jsonc");
39980
- var INSTALLED_PACKAGE_JSON = path5.join(USER_CONFIG_DIR, "node_modules", PACKAGE_NAME, "package.json");
40193
+ var USER_OPENCODE_CONFIG = path6.join(USER_CONFIG_DIR, "opencode.json");
40194
+ var USER_OPENCODE_CONFIG_JSONC = path6.join(USER_CONFIG_DIR, "opencode.jsonc");
40195
+ var INSTALLED_PACKAGE_JSON = path6.join(USER_CONFIG_DIR, "node_modules", PACKAGE_NAME, "package.json");
39981
40196
 
39982
40197
  // src/hooks/auto-update-checker/checker/config-paths.ts
39983
- import * as os5 from "os";
39984
- import * as path6 from "path";
40198
+ import * as os6 from "os";
40199
+ import * as path7 from "path";
39985
40200
  function getConfigPaths2(directory) {
39986
40201
  const paths = [
39987
- path6.join(directory, ".opencode", "opencode.json"),
39988
- path6.join(directory, ".opencode", "opencode.jsonc"),
40202
+ path7.join(directory, ".opencode", "opencode.json"),
40203
+ path7.join(directory, ".opencode", "opencode.jsonc"),
39989
40204
  USER_OPENCODE_CONFIG,
39990
40205
  USER_OPENCODE_CONFIG_JSONC
39991
40206
  ];
39992
40207
  if (process.platform === "win32") {
39993
- const crossPlatformDir = path6.join(os5.homedir(), ".config");
40208
+ const crossPlatformDir = path7.join(os6.homedir(), ".config");
39994
40209
  const appdataDir = getWindowsAppdataDir2();
39995
40210
  if (appdataDir) {
39996
40211
  const alternateDir = USER_CONFIG_DIR === crossPlatformDir ? appdataDir : crossPlatformDir;
39997
- const alternateConfig = path6.join(alternateDir, "opencode", "opencode.json");
39998
- const alternateConfigJsonc = path6.join(alternateDir, "opencode", "opencode.jsonc");
40212
+ const alternateConfig = path7.join(alternateDir, "opencode", "opencode.json");
40213
+ const alternateConfigJsonc = path7.join(alternateDir, "opencode", "opencode.jsonc");
39999
40214
  if (!paths.includes(alternateConfig)) {
40000
40215
  paths.push(alternateConfig);
40001
40216
  }
@@ -40016,9 +40231,9 @@ function stripJsonComments(json3) {
40016
40231
  function getLocalDevPath(directory) {
40017
40232
  for (const configPath of getConfigPaths2(directory)) {
40018
40233
  try {
40019
- if (!fs7.existsSync(configPath))
40234
+ if (!fs8.existsSync(configPath))
40020
40235
  continue;
40021
- const content = fs7.readFileSync(configPath, "utf-8");
40236
+ const content = fs8.readFileSync(configPath, "utf-8");
40022
40237
  const config2 = JSON.parse(stripJsonComments(content));
40023
40238
  const plugins = config2.plugin ?? [];
40024
40239
  for (const entry of plugins) {
@@ -40037,26 +40252,26 @@ function getLocalDevPath(directory) {
40037
40252
  return null;
40038
40253
  }
40039
40254
  // src/hooks/auto-update-checker/checker/local-dev-version.ts
40040
- import * as fs9 from "fs";
40255
+ import * as fs10 from "fs";
40041
40256
 
40042
40257
  // src/hooks/auto-update-checker/checker/package-json-locator.ts
40043
- import * as fs8 from "fs";
40044
- import * as path7 from "path";
40258
+ import * as fs9 from "fs";
40259
+ import * as path8 from "path";
40045
40260
  function findPackageJsonUp(startPath) {
40046
40261
  try {
40047
- const stat = fs8.statSync(startPath);
40048
- let dir = stat.isDirectory() ? startPath : path7.dirname(startPath);
40262
+ const stat = fs9.statSync(startPath);
40263
+ let dir = stat.isDirectory() ? startPath : path8.dirname(startPath);
40049
40264
  for (let i2 = 0;i2 < 10; i2++) {
40050
- const pkgPath = path7.join(dir, "package.json");
40051
- if (fs8.existsSync(pkgPath)) {
40265
+ const pkgPath = path8.join(dir, "package.json");
40266
+ if (fs9.existsSync(pkgPath)) {
40052
40267
  try {
40053
- const content = fs8.readFileSync(pkgPath, "utf-8");
40268
+ const content = fs9.readFileSync(pkgPath, "utf-8");
40054
40269
  const pkg = JSON.parse(content);
40055
40270
  if (pkg.name === PACKAGE_NAME)
40056
40271
  return pkgPath;
40057
40272
  } catch {}
40058
40273
  }
40059
- const parent = path7.dirname(dir);
40274
+ const parent = path8.dirname(dir);
40060
40275
  if (parent === dir)
40061
40276
  break;
40062
40277
  dir = parent;
@@ -40074,7 +40289,7 @@ function getLocalDevVersion(directory) {
40074
40289
  const pkgPath = findPackageJsonUp(localPath);
40075
40290
  if (!pkgPath)
40076
40291
  return null;
40077
- const content = fs9.readFileSync(pkgPath, "utf-8");
40292
+ const content = fs10.readFileSync(pkgPath, "utf-8");
40078
40293
  const pkg = JSON.parse(content);
40079
40294
  return pkg.version ?? null;
40080
40295
  } catch {
@@ -40082,16 +40297,16 @@ function getLocalDevVersion(directory) {
40082
40297
  }
40083
40298
  }
40084
40299
  // src/hooks/auto-update-checker/checker/plugin-entry.ts
40085
- import * as fs10 from "fs";
40300
+ import * as fs11 from "fs";
40086
40301
  function isExplicitVersionPin(pinnedVersion) {
40087
40302
  return /^\d+\.\d+\.\d+/.test(pinnedVersion);
40088
40303
  }
40089
40304
  function findPluginEntry(directory) {
40090
40305
  for (const configPath of getConfigPaths2(directory)) {
40091
40306
  try {
40092
- if (!fs10.existsSync(configPath))
40307
+ if (!fs11.existsSync(configPath))
40093
40308
  continue;
40094
- const content = fs10.readFileSync(configPath, "utf-8");
40309
+ const content = fs11.readFileSync(configPath, "utf-8");
40095
40310
  const config2 = JSON.parse(stripJsonComments(content));
40096
40311
  const plugins = config2.plugin ?? [];
40097
40312
  for (const entry of plugins) {
@@ -40112,23 +40327,23 @@ function findPluginEntry(directory) {
40112
40327
  }
40113
40328
  // src/hooks/auto-update-checker/checker/cached-version.ts
40114
40329
  init_logger();
40115
- import * as fs11 from "fs";
40116
- import * as path8 from "path";
40330
+ import * as fs12 from "fs";
40331
+ import * as path9 from "path";
40117
40332
  import { fileURLToPath as fileURLToPath2 } from "url";
40118
40333
  function getCachedVersion() {
40119
40334
  try {
40120
- if (fs11.existsSync(INSTALLED_PACKAGE_JSON)) {
40121
- const content = fs11.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
40335
+ if (fs12.existsSync(INSTALLED_PACKAGE_JSON)) {
40336
+ const content = fs12.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
40122
40337
  const pkg = JSON.parse(content);
40123
40338
  if (pkg.version)
40124
40339
  return pkg.version;
40125
40340
  }
40126
40341
  } catch {}
40127
40342
  try {
40128
- const currentDir = path8.dirname(fileURLToPath2(import.meta.url));
40343
+ const currentDir = path9.dirname(fileURLToPath2(import.meta.url));
40129
40344
  const pkgPath = findPackageJsonUp(currentDir);
40130
40345
  if (pkgPath) {
40131
- const content = fs11.readFileSync(pkgPath, "utf-8");
40346
+ const content = fs12.readFileSync(pkgPath, "utf-8");
40132
40347
  const pkg = JSON.parse(content);
40133
40348
  if (pkg.version)
40134
40349
  return pkg.version;
@@ -40137,10 +40352,10 @@ function getCachedVersion() {
40137
40352
  log("[auto-update-checker] Failed to resolve version from current directory:", err);
40138
40353
  }
40139
40354
  try {
40140
- const execDir = path8.dirname(fs11.realpathSync(process.execPath));
40355
+ const execDir = path9.dirname(fs12.realpathSync(process.execPath));
40141
40356
  const pkgPath = findPackageJsonUp(execDir);
40142
40357
  if (pkgPath) {
40143
- const content = fs11.readFileSync(pkgPath, "utf-8");
40358
+ const content = fs12.readFileSync(pkgPath, "utf-8");
40144
40359
  const pkg = JSON.parse(content);
40145
40360
  if (pkg.version)
40146
40361
  return pkg.version;
@@ -40152,10 +40367,10 @@ function getCachedVersion() {
40152
40367
  }
40153
40368
  // src/hooks/auto-update-checker/checker/pinned-version-updater.ts
40154
40369
  init_logger();
40155
- import * as fs12 from "fs";
40370
+ import * as fs13 from "fs";
40156
40371
  function replacePluginEntry(configPath, oldEntry, newEntry) {
40157
40372
  try {
40158
- const content = fs12.readFileSync(configPath, "utf-8");
40373
+ const content = fs13.readFileSync(configPath, "utf-8");
40159
40374
  const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
40160
40375
  if (!pluginMatch || pluginMatch.index === undefined) {
40161
40376
  log(`[auto-update-checker] No "plugin" array found in ${configPath}`);
@@ -40186,7 +40401,7 @@ function replacePluginEntry(configPath, oldEntry, newEntry) {
40186
40401
  log(`[auto-update-checker] No changes made to ${configPath}`);
40187
40402
  return false;
40188
40403
  }
40189
- fs12.writeFileSync(configPath, updatedContent, "utf-8");
40404
+ fs13.writeFileSync(configPath, updatedContent, "utf-8");
40190
40405
  log(`[auto-update-checker] Updated ${configPath}: ${oldEntry} \u2192 ${newEntry}`);
40191
40406
  return true;
40192
40407
  } catch (err) {
@@ -40353,18 +40568,18 @@ async function runBunInstallWithDetails() {
40353
40568
  init_logger();
40354
40569
 
40355
40570
  // src/hooks/auto-update-checker/cache.ts
40356
- import * as fs13 from "fs";
40357
- import * as path9 from "path";
40571
+ import * as fs14 from "fs";
40572
+ import * as path10 from "path";
40358
40573
  init_logger();
40359
40574
  function stripTrailingCommas(json3) {
40360
40575
  return json3.replace(/,(\s*[}\]])/g, "$1");
40361
40576
  }
40362
40577
  function removeFromBunLock(packageName) {
40363
- const lockPath = path9.join(USER_CONFIG_DIR, "bun.lock");
40364
- if (!fs13.existsSync(lockPath))
40578
+ const lockPath = path10.join(USER_CONFIG_DIR, "bun.lock");
40579
+ if (!fs14.existsSync(lockPath))
40365
40580
  return false;
40366
40581
  try {
40367
- const content = fs13.readFileSync(lockPath, "utf-8");
40582
+ const content = fs14.readFileSync(lockPath, "utf-8");
40368
40583
  const lock = JSON.parse(stripTrailingCommas(content));
40369
40584
  let modified = false;
40370
40585
  if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
@@ -40376,7 +40591,7 @@ function removeFromBunLock(packageName) {
40376
40591
  modified = true;
40377
40592
  }
40378
40593
  if (modified) {
40379
- fs13.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
40594
+ fs14.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
40380
40595
  log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
40381
40596
  }
40382
40597
  return modified;
@@ -40386,22 +40601,22 @@ function removeFromBunLock(packageName) {
40386
40601
  }
40387
40602
  function invalidatePackage(packageName = PACKAGE_NAME) {
40388
40603
  try {
40389
- const pkgDir = path9.join(USER_CONFIG_DIR, "node_modules", packageName);
40390
- const pkgJsonPath = path9.join(USER_CONFIG_DIR, "package.json");
40604
+ const pkgDir = path10.join(USER_CONFIG_DIR, "node_modules", packageName);
40605
+ const pkgJsonPath = path10.join(USER_CONFIG_DIR, "package.json");
40391
40606
  let packageRemoved = false;
40392
40607
  let dependencyRemoved = false;
40393
40608
  let lockRemoved = false;
40394
- if (fs13.existsSync(pkgDir)) {
40395
- fs13.rmSync(pkgDir, { recursive: true, force: true });
40609
+ if (fs14.existsSync(pkgDir)) {
40610
+ fs14.rmSync(pkgDir, { recursive: true, force: true });
40396
40611
  log(`[auto-update-checker] Package removed: ${pkgDir}`);
40397
40612
  packageRemoved = true;
40398
40613
  }
40399
- if (fs13.existsSync(pkgJsonPath)) {
40400
- const content = fs13.readFileSync(pkgJsonPath, "utf-8");
40614
+ if (fs14.existsSync(pkgJsonPath)) {
40615
+ const content = fs14.readFileSync(pkgJsonPath, "utf-8");
40401
40616
  const pkgJson = JSON.parse(content);
40402
40617
  if (pkgJson.dependencies?.[packageName]) {
40403
40618
  delete pkgJson.dependencies[packageName];
40404
- fs13.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
40619
+ fs14.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
40405
40620
  log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
40406
40621
  dependencyRemoved = true;
40407
40622
  }
@@ -40670,17 +40885,17 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
40670
40885
  }
40671
40886
  // src/hooks/agent-usage-reminder/storage.ts
40672
40887
  import {
40673
- existsSync as existsSync46,
40888
+ existsSync as existsSync47,
40674
40889
  mkdirSync as mkdirSync10,
40675
- readFileSync as readFileSync33,
40676
- writeFileSync as writeFileSync14,
40890
+ readFileSync as readFileSync34,
40891
+ writeFileSync as writeFileSync15,
40677
40892
  unlinkSync as unlinkSync6
40678
40893
  } from "fs";
40679
- import { join as join52 } from "path";
40894
+ import { join as join53 } from "path";
40680
40895
 
40681
40896
  // src/hooks/agent-usage-reminder/constants.ts
40682
- import { join as join51 } from "path";
40683
- var AGENT_USAGE_REMINDER_STORAGE = join51(OPENCODE_STORAGE, "agent-usage-reminder");
40897
+ import { join as join52 } from "path";
40898
+ var AGENT_USAGE_REMINDER_STORAGE = join52(OPENCODE_STORAGE, "agent-usage-reminder");
40684
40899
  var TARGET_TOOLS = new Set([
40685
40900
  "grep",
40686
40901
  "safe_grep",
@@ -40726,29 +40941,29 @@ ALWAYS prefer: Multiple parallel task calls > Direct tool calls
40726
40941
 
40727
40942
  // src/hooks/agent-usage-reminder/storage.ts
40728
40943
  function getStoragePath2(sessionID) {
40729
- return join52(AGENT_USAGE_REMINDER_STORAGE, `${sessionID}.json`);
40944
+ return join53(AGENT_USAGE_REMINDER_STORAGE, `${sessionID}.json`);
40730
40945
  }
40731
40946
  function loadAgentUsageState(sessionID) {
40732
40947
  const filePath = getStoragePath2(sessionID);
40733
- if (!existsSync46(filePath))
40948
+ if (!existsSync47(filePath))
40734
40949
  return null;
40735
40950
  try {
40736
- const content = readFileSync33(filePath, "utf-8");
40951
+ const content = readFileSync34(filePath, "utf-8");
40737
40952
  return JSON.parse(content);
40738
40953
  } catch {
40739
40954
  return null;
40740
40955
  }
40741
40956
  }
40742
40957
  function saveAgentUsageState(state3) {
40743
- if (!existsSync46(AGENT_USAGE_REMINDER_STORAGE)) {
40958
+ if (!existsSync47(AGENT_USAGE_REMINDER_STORAGE)) {
40744
40959
  mkdirSync10(AGENT_USAGE_REMINDER_STORAGE, { recursive: true });
40745
40960
  }
40746
40961
  const filePath = getStoragePath2(state3.sessionID);
40747
- writeFileSync14(filePath, JSON.stringify(state3, null, 2));
40962
+ writeFileSync15(filePath, JSON.stringify(state3, null, 2));
40748
40963
  }
40749
40964
  function clearAgentUsageState(sessionID) {
40750
40965
  const filePath = getStoragePath2(sessionID);
40751
- if (existsSync46(filePath)) {
40966
+ if (existsSync47(filePath)) {
40752
40967
  unlinkSync6(filePath);
40753
40968
  }
40754
40969
  }
@@ -41913,17 +42128,17 @@ function createNonInteractiveEnvHook(_ctx) {
41913
42128
  }
41914
42129
  // src/hooks/interactive-bash-session/storage.ts
41915
42130
  import {
41916
- existsSync as existsSync47,
42131
+ existsSync as existsSync48,
41917
42132
  mkdirSync as mkdirSync11,
41918
- readFileSync as readFileSync34,
41919
- writeFileSync as writeFileSync15,
42133
+ readFileSync as readFileSync35,
42134
+ writeFileSync as writeFileSync16,
41920
42135
  unlinkSync as unlinkSync7
41921
42136
  } from "fs";
41922
- import { join as join54 } from "path";
42137
+ import { join as join55 } from "path";
41923
42138
 
41924
42139
  // src/hooks/interactive-bash-session/constants.ts
41925
- import { join as join53 } from "path";
41926
- var INTERACTIVE_BASH_SESSION_STORAGE = join53(OPENCODE_STORAGE, "interactive-bash-session");
42140
+ import { join as join54 } from "path";
42141
+ var INTERACTIVE_BASH_SESSION_STORAGE = join54(OPENCODE_STORAGE, "interactive-bash-session");
41927
42142
  var OMO_SESSION_PREFIX = "omo-";
41928
42143
  function buildSessionReminderMessage(sessions) {
41929
42144
  if (sessions.length === 0)
@@ -41935,14 +42150,14 @@ function buildSessionReminderMessage(sessions) {
41935
42150
 
41936
42151
  // src/hooks/interactive-bash-session/storage.ts
41937
42152
  function getStoragePath3(sessionID) {
41938
- return join54(INTERACTIVE_BASH_SESSION_STORAGE, `${sessionID}.json`);
42153
+ return join55(INTERACTIVE_BASH_SESSION_STORAGE, `${sessionID}.json`);
41939
42154
  }
41940
42155
  function loadInteractiveBashSessionState(sessionID) {
41941
42156
  const filePath = getStoragePath3(sessionID);
41942
- if (!existsSync47(filePath))
42157
+ if (!existsSync48(filePath))
41943
42158
  return null;
41944
42159
  try {
41945
- const content = readFileSync34(filePath, "utf-8");
42160
+ const content = readFileSync35(filePath, "utf-8");
41946
42161
  const serialized = JSON.parse(content);
41947
42162
  return {
41948
42163
  sessionID: serialized.sessionID,
@@ -41954,7 +42169,7 @@ function loadInteractiveBashSessionState(sessionID) {
41954
42169
  }
41955
42170
  }
41956
42171
  function saveInteractiveBashSessionState(state3) {
41957
- if (!existsSync47(INTERACTIVE_BASH_SESSION_STORAGE)) {
42172
+ if (!existsSync48(INTERACTIVE_BASH_SESSION_STORAGE)) {
41958
42173
  mkdirSync11(INTERACTIVE_BASH_SESSION_STORAGE, { recursive: true });
41959
42174
  }
41960
42175
  const filePath = getStoragePath3(state3.sessionID);
@@ -41963,11 +42178,11 @@ function saveInteractiveBashSessionState(state3) {
41963
42178
  tmuxSessions: Array.from(state3.tmuxSessions),
41964
42179
  updatedAt: state3.updatedAt
41965
42180
  };
41966
- writeFileSync15(filePath, JSON.stringify(serialized, null, 2));
42181
+ writeFileSync16(filePath, JSON.stringify(serialized, null, 2));
41967
42182
  }
41968
42183
  function clearInteractiveBashSessionState(sessionID) {
41969
42184
  const filePath = getStoragePath3(sessionID);
41970
- if (existsSync47(filePath)) {
42185
+ if (existsSync48(filePath)) {
41971
42186
  unlinkSync7(filePath);
41972
42187
  }
41973
42188
  }
@@ -42363,18 +42578,18 @@ var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
42363
42578
  var DEFAULT_MAX_ITERATIONS = 100;
42364
42579
  var DEFAULT_COMPLETION_PROMISE = "DONE";
42365
42580
  // src/hooks/ralph-loop/storage.ts
42366
- import { existsSync as existsSync48, readFileSync as readFileSync35, writeFileSync as writeFileSync16, unlinkSync as unlinkSync8, mkdirSync as mkdirSync12 } from "fs";
42367
- import { dirname as dirname10, join as join55 } from "path";
42581
+ import { existsSync as existsSync49, readFileSync as readFileSync36, writeFileSync as writeFileSync17, unlinkSync as unlinkSync8, mkdirSync as mkdirSync12 } from "fs";
42582
+ import { dirname as dirname10, join as join56 } from "path";
42368
42583
  function getStateFilePath(directory, customPath) {
42369
- return customPath ? join55(directory, customPath) : join55(directory, DEFAULT_STATE_FILE);
42584
+ return customPath ? join56(directory, customPath) : join56(directory, DEFAULT_STATE_FILE);
42370
42585
  }
42371
42586
  function readState(directory, customPath) {
42372
42587
  const filePath = getStateFilePath(directory, customPath);
42373
- if (!existsSync48(filePath)) {
42588
+ if (!existsSync49(filePath)) {
42374
42589
  return null;
42375
42590
  }
42376
42591
  try {
42377
- const content = readFileSync35(filePath, "utf-8");
42592
+ const content = readFileSync36(filePath, "utf-8");
42378
42593
  const { data, body } = parseFrontmatter(content);
42379
42594
  const active = data.active;
42380
42595
  const iteration = data.iteration;
@@ -42410,7 +42625,7 @@ function writeState(directory, state3, customPath) {
42410
42625
  const filePath = getStateFilePath(directory, customPath);
42411
42626
  try {
42412
42627
  const dir = dirname10(filePath);
42413
- if (!existsSync48(dir)) {
42628
+ if (!existsSync49(dir)) {
42414
42629
  mkdirSync12(dir, { recursive: true });
42415
42630
  }
42416
42631
  const sessionIdLine = state3.session_id ? `session_id: "${state3.session_id}"
@@ -42430,7 +42645,7 @@ started_at: "${state3.started_at}"
42430
42645
  ${sessionIdLine}${ultraworkLine}${strategyLine}${messageCountAtStartLine}---
42431
42646
  ${state3.prompt}
42432
42647
  `;
42433
- writeFileSync16(filePath, content, "utf-8");
42648
+ writeFileSync17(filePath, content, "utf-8");
42434
42649
  return true;
42435
42650
  } catch {
42436
42651
  return false;
@@ -42439,7 +42654,7 @@ ${state3.prompt}
42439
42654
  function clearState(directory, customPath) {
42440
42655
  const filePath = getStateFilePath(directory, customPath);
42441
42656
  try {
42442
- if (existsSync48(filePath)) {
42657
+ if (existsSync49(filePath)) {
42443
42658
  unlinkSync8(filePath);
42444
42659
  }
42445
42660
  return true;
@@ -42566,7 +42781,7 @@ init_logger();
42566
42781
 
42567
42782
  // src/hooks/ralph-loop/completion-promise-detector.ts
42568
42783
  init_logger();
42569
- import { existsSync as existsSync49, readFileSync as readFileSync36 } from "fs";
42784
+ import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
42570
42785
 
42571
42786
  // src/hooks/ralph-loop/with-timeout.ts
42572
42787
  async function withTimeout(promise2, timeoutMs) {
@@ -42596,9 +42811,9 @@ function detectCompletionInTranscript(transcriptPath, promise2) {
42596
42811
  if (!transcriptPath)
42597
42812
  return false;
42598
42813
  try {
42599
- if (!existsSync49(transcriptPath))
42814
+ if (!existsSync50(transcriptPath))
42600
42815
  return false;
42601
- const content = readFileSync36(transcriptPath, "utf-8");
42816
+ const content = readFileSync37(transcriptPath, "utf-8");
42602
42817
  const pattern = buildPromisePattern(promise2);
42603
42818
  const lines = content.split(`
42604
42819
  `).filter((line) => line.trim());
@@ -42761,12 +42976,12 @@ async function selectSessionInTui(client, sessionID) {
42761
42976
  }
42762
42977
  }
42763
42978
  function getSelectSessionApi(client) {
42764
- if (!isRecord2(client)) {
42979
+ if (!isRecord3(client)) {
42765
42980
  return null;
42766
42981
  }
42767
42982
  const clientRecord = client;
42768
42983
  const tuiValue = clientRecord.tui;
42769
- if (!isRecord2(tuiValue)) {
42984
+ if (!isRecord3(tuiValue)) {
42770
42985
  return null;
42771
42986
  }
42772
42987
  const selectSessionValue = tuiValue.selectSession;
@@ -43169,8 +43384,8 @@ function findSlashCommandPartIndex(parts) {
43169
43384
  return -1;
43170
43385
  }
43171
43386
  // src/hooks/auto-slash-command/executor.ts
43172
- import { existsSync as existsSync51, readdirSync as readdirSync15, readFileSync as readFileSync39 } from "fs";
43173
- import { join as join60, basename as basename4, dirname as dirname13 } from "path";
43387
+ import { existsSync as existsSync52, readdirSync as readdirSync15, readFileSync as readFileSync40 } from "fs";
43388
+ import { join as join61, basename as basename4, dirname as dirname13 } from "path";
43174
43389
  // src/features/builtin-commands/templates/init-deep.ts
43175
43390
  var INIT_DEEP_TEMPLATE = `# /init-deep
43176
43391
 
@@ -44525,8 +44740,8 @@ function loadBuiltinCommands(disabledCommands) {
44525
44740
  return commands;
44526
44741
  }
44527
44742
  // src/features/opencode-skill-loader/loader.ts
44528
- import { join as join58 } from "path";
44529
- import { homedir as homedir11 } from "os";
44743
+ import { join as join59 } from "path";
44744
+ import { homedir as homedir12 } from "os";
44530
44745
 
44531
44746
  // src/features/opencode-skill-loader/skill-definition-record.ts
44532
44747
  function skillsToCommandDefinitionRecord(skills) {
@@ -44552,11 +44767,11 @@ function deduplicateSkillsByName(skills) {
44552
44767
  }
44553
44768
 
44554
44769
  // src/features/opencode-skill-loader/skill-directory-loader.ts
44555
- import { promises as fs16 } from "fs";
44556
- import { join as join57 } from "path";
44770
+ import { promises as fs17 } from "fs";
44771
+ import { join as join58 } from "path";
44557
44772
 
44558
44773
  // src/features/opencode-skill-loader/loaded-skill-from-path.ts
44559
- import { promises as fs15 } from "fs";
44774
+ import { promises as fs16 } from "fs";
44560
44775
  import { basename as basename3 } from "path";
44561
44776
 
44562
44777
  // src/features/opencode-skill-loader/allowed-tools-parser.ts
@@ -44570,8 +44785,8 @@ function parseAllowedTools(allowedTools) {
44570
44785
  }
44571
44786
 
44572
44787
  // src/features/opencode-skill-loader/skill-mcp-config.ts
44573
- import { promises as fs14 } from "fs";
44574
- import { join as join56 } from "path";
44788
+ import { promises as fs15 } from "fs";
44789
+ import { join as join57 } from "path";
44575
44790
  function parseSkillMcpConfigFromFrontmatter(content) {
44576
44791
  const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
44577
44792
  if (!frontmatterMatch)
@@ -44587,9 +44802,9 @@ function parseSkillMcpConfigFromFrontmatter(content) {
44587
44802
  return;
44588
44803
  }
44589
44804
  async function loadMcpJsonFromDir(skillDir) {
44590
- const mcpJsonPath = join56(skillDir, "mcp.json");
44805
+ const mcpJsonPath = join57(skillDir, "mcp.json");
44591
44806
  try {
44592
- const content = await fs14.readFile(mcpJsonPath, "utf-8");
44807
+ const content = await fs15.readFile(mcpJsonPath, "utf-8");
44593
44808
  const parsed = JSON.parse(content);
44594
44809
  if (parsed && typeof parsed === "object" && "mcpServers" in parsed && parsed.mcpServers) {
44595
44810
  return parsed.mcpServers;
@@ -44610,7 +44825,7 @@ async function loadMcpJsonFromDir(skillDir) {
44610
44825
  async function loadSkillFromPath(options) {
44611
44826
  const namePrefix = options.namePrefix ?? "";
44612
44827
  try {
44613
- const content = await fs15.readFile(options.skillPath, "utf-8");
44828
+ const content = await fs16.readFile(options.skillPath, "utf-8");
44614
44829
  const { data, body } = parseFrontmatter(content);
44615
44830
  const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content);
44616
44831
  const mcpJsonMcp = await loadMcpJsonFromDir(options.resolvedPath);
@@ -44671,17 +44886,17 @@ async function loadSkillsFromDir(options) {
44671
44886
  const namePrefix = options.namePrefix ?? "";
44672
44887
  const depth = options.depth ?? 0;
44673
44888
  const maxDepth = options.maxDepth ?? 2;
44674
- const entries = await fs16.readdir(options.skillsDir, { withFileTypes: true }).catch(() => []);
44889
+ const entries = await fs17.readdir(options.skillsDir, { withFileTypes: true }).catch(() => []);
44675
44890
  const skillMap = new Map;
44676
44891
  const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
44677
44892
  const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
44678
44893
  for (const entry of directories) {
44679
- const entryPath = join57(options.skillsDir, entry.name);
44894
+ const entryPath = join58(options.skillsDir, entry.name);
44680
44895
  const resolvedPath = await resolveSymlinkAsync(entryPath);
44681
44896
  const dirName = entry.name;
44682
- const skillMdPath = join57(resolvedPath, "SKILL.md");
44897
+ const skillMdPath = join58(resolvedPath, "SKILL.md");
44683
44898
  try {
44684
- await fs16.access(skillMdPath);
44899
+ await fs17.access(skillMdPath);
44685
44900
  const skill = await loadSkillFromPath({
44686
44901
  skillPath: skillMdPath,
44687
44902
  resolvedPath,
@@ -44694,9 +44909,9 @@ async function loadSkillsFromDir(options) {
44694
44909
  }
44695
44910
  continue;
44696
44911
  } catch {}
44697
- const namedSkillMdPath = join57(resolvedPath, `${dirName}.md`);
44912
+ const namedSkillMdPath = join58(resolvedPath, `${dirName}.md`);
44698
44913
  try {
44699
- await fs16.access(namedSkillMdPath);
44914
+ await fs17.access(namedSkillMdPath);
44700
44915
  const skill = await loadSkillFromPath({
44701
44916
  skillPath: namedSkillMdPath,
44702
44917
  resolvedPath,
@@ -44726,7 +44941,7 @@ async function loadSkillsFromDir(options) {
44726
44941
  }
44727
44942
  }
44728
44943
  for (const entry of files) {
44729
- const entryPath = join57(options.skillsDir, entry.name);
44944
+ const entryPath = join58(options.skillsDir, entry.name);
44730
44945
  const baseName = inferSkillNameFromFileName(entryPath);
44731
44946
  const skill = await loadSkillFromPath({
44732
44947
  skillPath: entryPath,
@@ -44744,23 +44959,23 @@ async function loadSkillsFromDir(options) {
44744
44959
 
44745
44960
  // src/features/opencode-skill-loader/loader.ts
44746
44961
  async function loadUserSkills() {
44747
- const userSkillsDir = join58(getClaudeConfigDir(), "skills");
44962
+ const userSkillsDir = join59(getClaudeConfigDir(), "skills");
44748
44963
  const skills = await loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
44749
44964
  return skillsToCommandDefinitionRecord(skills);
44750
44965
  }
44751
44966
  async function loadProjectSkills(directory) {
44752
- const projectSkillsDir = join58(directory ?? process.cwd(), ".claude", "skills");
44967
+ const projectSkillsDir = join59(directory ?? process.cwd(), ".claude", "skills");
44753
44968
  const skills = await loadSkillsFromDir({ skillsDir: projectSkillsDir, scope: "project" });
44754
44969
  return skillsToCommandDefinitionRecord(skills);
44755
44970
  }
44756
44971
  async function loadOpencodeGlobalSkills() {
44757
44972
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
44758
- const opencodeSkillsDir = join58(configDir, "skills");
44973
+ const opencodeSkillsDir = join59(configDir, "skills");
44759
44974
  const skills = await loadSkillsFromDir({ skillsDir: opencodeSkillsDir, scope: "opencode" });
44760
44975
  return skillsToCommandDefinitionRecord(skills);
44761
44976
  }
44762
44977
  async function loadOpencodeProjectSkills(directory) {
44763
- const opencodeProjectDir = join58(directory ?? process.cwd(), ".opencode", "skills");
44978
+ const opencodeProjectDir = join59(directory ?? process.cwd(), ".opencode", "skills");
44764
44979
  const skills = await loadSkillsFromDir({ skillsDir: opencodeProjectDir, scope: "opencode-project" });
44765
44980
  return skillsToCommandDefinitionRecord(skills);
44766
44981
  }
@@ -44807,28 +45022,28 @@ async function discoverSkills(options = {}) {
44807
45022
  ]);
44808
45023
  }
44809
45024
  async function discoverUserClaudeSkills() {
44810
- const userSkillsDir = join58(getClaudeConfigDir(), "skills");
45025
+ const userSkillsDir = join59(getClaudeConfigDir(), "skills");
44811
45026
  return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
44812
45027
  }
44813
45028
  async function discoverProjectClaudeSkills(directory) {
44814
- const projectSkillsDir = join58(directory ?? process.cwd(), ".claude", "skills");
45029
+ const projectSkillsDir = join59(directory ?? process.cwd(), ".claude", "skills");
44815
45030
  return loadSkillsFromDir({ skillsDir: projectSkillsDir, scope: "project" });
44816
45031
  }
44817
45032
  async function discoverOpencodeGlobalSkills() {
44818
45033
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
44819
- const opencodeSkillsDir = join58(configDir, "skills");
45034
+ const opencodeSkillsDir = join59(configDir, "skills");
44820
45035
  return loadSkillsFromDir({ skillsDir: opencodeSkillsDir, scope: "opencode" });
44821
45036
  }
44822
45037
  async function discoverOpencodeProjectSkills(directory) {
44823
- const opencodeProjectDir = join58(directory ?? process.cwd(), ".opencode", "skills");
45038
+ const opencodeProjectDir = join59(directory ?? process.cwd(), ".opencode", "skills");
44824
45039
  return loadSkillsFromDir({ skillsDir: opencodeProjectDir, scope: "opencode-project" });
44825
45040
  }
44826
45041
  async function discoverProjectAgentsSkills(directory) {
44827
- const agentsProjectDir = join58(directory ?? process.cwd(), ".agents", "skills");
45042
+ const agentsProjectDir = join59(directory ?? process.cwd(), ".agents", "skills");
44828
45043
  return loadSkillsFromDir({ skillsDir: agentsProjectDir, scope: "project" });
44829
45044
  }
44830
45045
  async function discoverGlobalAgentsSkills() {
44831
- const agentsGlobalDir = join58(homedir11(), ".agents", "skills");
45046
+ const agentsGlobalDir = join59(homedir12(), ".agents", "skills");
44832
45047
  return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
44833
45048
  }
44834
45049
  // src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
@@ -44855,16 +45070,16 @@ function builtinToLoadedSkill(builtin) {
44855
45070
  }
44856
45071
 
44857
45072
  // src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
44858
- import { existsSync as existsSync50, readFileSync as readFileSync37 } from "fs";
45073
+ import { existsSync as existsSync51, readFileSync as readFileSync38 } from "fs";
44859
45074
  import { dirname as dirname11, isAbsolute as isAbsolute4, resolve as resolve5 } from "path";
44860
- import { homedir as homedir12 } from "os";
45075
+ import { homedir as homedir13 } from "os";
44861
45076
  function resolveFilePath5(from, configDir) {
44862
45077
  let filePath = from;
44863
45078
  if (filePath.startsWith("{file:") && filePath.endsWith("}")) {
44864
45079
  filePath = filePath.slice(6, -1);
44865
45080
  }
44866
45081
  if (filePath.startsWith("~/")) {
44867
- return resolve5(homedir12(), filePath.slice(2));
45082
+ return resolve5(homedir13(), filePath.slice(2));
44868
45083
  }
44869
45084
  if (isAbsolute4(filePath)) {
44870
45085
  return filePath;
@@ -44874,9 +45089,9 @@ function resolveFilePath5(from, configDir) {
44874
45089
  }
44875
45090
  function loadSkillFromFile(filePath) {
44876
45091
  try {
44877
- if (!existsSync50(filePath))
45092
+ if (!existsSync51(filePath))
44878
45093
  return null;
44879
- const content = readFileSync37(filePath, "utf-8");
45094
+ const content = readFileSync38(filePath, "utf-8");
44880
45095
  const { data, body } = parseFrontmatter(content);
44881
45096
  return { template: body, metadata: data };
44882
45097
  } catch {
@@ -47246,10 +47461,10 @@ async function getAllSkills(options) {
47246
47461
  return allSkills;
47247
47462
  }
47248
47463
  // src/features/opencode-skill-loader/loaded-skill-template-extractor.ts
47249
- import { readFileSync as readFileSync38 } from "fs";
47464
+ import { readFileSync as readFileSync39 } from "fs";
47250
47465
  function extractSkillTemplate(skill) {
47251
47466
  if (skill.path) {
47252
- const content = readFileSync38(skill.path, "utf-8");
47467
+ const content = readFileSync39(skill.path, "utf-8");
47253
47468
  const { body } = parseFrontmatter(content);
47254
47469
  return body.trim();
47255
47470
  }
@@ -47359,23 +47574,23 @@ async function resolveMultipleSkillsAsync(skillNames, options) {
47359
47574
  }
47360
47575
  // src/features/opencode-skill-loader/config-source-discovery.ts
47361
47576
  var import_picomatch2 = __toESM(require_picomatch2(), 1);
47362
- import { promises as fs17 } from "fs";
47363
- import { dirname as dirname12, extname, isAbsolute as isAbsolute5, join as join59, relative as relative3 } from "path";
47577
+ import { promises as fs18 } from "fs";
47578
+ import { dirname as dirname12, extname, isAbsolute as isAbsolute5, join as join60, relative as relative3 } from "path";
47364
47579
  var MAX_RECURSIVE_DEPTH = 10;
47365
- function isHttpUrl(path10) {
47366
- return path10.startsWith("http://") || path10.startsWith("https://");
47580
+ function isHttpUrl(path11) {
47581
+ return path11.startsWith("http://") || path11.startsWith("https://");
47367
47582
  }
47368
- function toAbsolutePath(path10, configDir) {
47369
- if (isAbsolute5(path10)) {
47370
- return path10;
47583
+ function toAbsolutePath(path11, configDir) {
47584
+ if (isAbsolute5(path11)) {
47585
+ return path11;
47371
47586
  }
47372
- return join59(configDir, path10);
47587
+ return join60(configDir, path11);
47373
47588
  }
47374
- function isMarkdownPath(path10) {
47375
- return extname(path10).toLowerCase() === ".md";
47589
+ function isMarkdownPath(path11) {
47590
+ return extname(path11).toLowerCase() === ".md";
47376
47591
  }
47377
- function normalizePathForGlob(path10) {
47378
- return path10.split("\\").join("/");
47592
+ function normalizePathForGlob(path11) {
47593
+ return path11.split("\\").join("/");
47379
47594
  }
47380
47595
  function filterByGlob(skills, sourceBaseDir, globPattern) {
47381
47596
  if (!globPattern)
@@ -47392,7 +47607,7 @@ async function loadSourcePath(options) {
47392
47607
  return [];
47393
47608
  }
47394
47609
  const absolutePath = toAbsolutePath(options.sourcePath, options.configDir);
47395
- const stat = await fs17.stat(absolutePath).catch(() => null);
47610
+ const stat = await fs18.stat(absolutePath).catch(() => null);
47396
47611
  if (!stat)
47397
47612
  return [];
47398
47613
  if (stat.isFile()) {
@@ -47440,7 +47655,7 @@ async function discoverConfigSourceSkills(options) {
47440
47655
  }
47441
47656
  // src/hooks/auto-slash-command/executor.ts
47442
47657
  function discoverCommandsFromDir(commandsDir, scope) {
47443
- if (!existsSync51(commandsDir)) {
47658
+ if (!existsSync52(commandsDir)) {
47444
47659
  return [];
47445
47660
  }
47446
47661
  const entries = readdirSync15(commandsDir, { withFileTypes: true });
@@ -47448,10 +47663,10 @@ function discoverCommandsFromDir(commandsDir, scope) {
47448
47663
  for (const entry of entries) {
47449
47664
  if (!isMarkdownFile(entry))
47450
47665
  continue;
47451
- const commandPath = join60(commandsDir, entry.name);
47666
+ const commandPath = join61(commandsDir, entry.name);
47452
47667
  const commandName = basename4(entry.name, ".md");
47453
47668
  try {
47454
- const content = readFileSync39(commandPath, "utf-8");
47669
+ const content = readFileSync40(commandPath, "utf-8");
47455
47670
  const { data, body } = parseFrontmatter(content);
47456
47671
  const isOpencodeSource = scope === "opencode" || scope === "opencode-project";
47457
47672
  const metadata = {
@@ -47509,10 +47724,10 @@ function discoverPluginCommands(options) {
47509
47724
  }
47510
47725
  async function discoverAllCommands(options) {
47511
47726
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
47512
- const userCommandsDir = join60(getClaudeConfigDir(), "commands");
47513
- const projectCommandsDir = join60(process.cwd(), ".claude", "commands");
47514
- const opencodeGlobalDir = join60(configDir, "command");
47515
- const opencodeProjectDir = join60(process.cwd(), ".opencode", "command");
47727
+ const userCommandsDir = join61(getClaudeConfigDir(), "commands");
47728
+ const projectCommandsDir = join61(process.cwd(), ".claude", "commands");
47729
+ const opencodeGlobalDir = join61(configDir, "command");
47730
+ const opencodeProjectDir = join61(process.cwd(), ".opencode", "command");
47516
47731
  const userCommands = discoverCommandsFromDir(userCommandsDir, "user");
47517
47732
  const opencodeGlobalCommands = discoverCommandsFromDir(opencodeGlobalDir, "opencode");
47518
47733
  const projectCommands = discoverCommandsFromDir(projectCommandsDir, "project");
@@ -47826,18 +48041,18 @@ var NOTEPAD_DIR = "notepads";
47826
48041
  var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
47827
48042
  var PROMETHEUS_PLANS_DIR = ".sisyphus/plans";
47828
48043
  // src/features/boulder-state/storage.ts
47829
- import { existsSync as existsSync52, readFileSync as readFileSync40, writeFileSync as writeFileSync17, mkdirSync as mkdirSync13, readdirSync as readdirSync16 } from "fs";
47830
- import { dirname as dirname14, join as join61, basename as basename5 } from "path";
48044
+ import { existsSync as existsSync53, readFileSync as readFileSync41, writeFileSync as writeFileSync18, mkdirSync as mkdirSync13, readdirSync as readdirSync16 } from "fs";
48045
+ import { dirname as dirname14, join as join62, basename as basename5 } from "path";
47831
48046
  function getBoulderFilePath(directory) {
47832
- return join61(directory, BOULDER_DIR, BOULDER_FILE);
48047
+ return join62(directory, BOULDER_DIR, BOULDER_FILE);
47833
48048
  }
47834
48049
  function readBoulderState(directory) {
47835
48050
  const filePath = getBoulderFilePath(directory);
47836
- if (!existsSync52(filePath)) {
48051
+ if (!existsSync53(filePath)) {
47837
48052
  return null;
47838
48053
  }
47839
48054
  try {
47840
- const content = readFileSync40(filePath, "utf-8");
48055
+ const content = readFileSync41(filePath, "utf-8");
47841
48056
  const parsed = JSON.parse(content);
47842
48057
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
47843
48058
  return null;
@@ -47854,10 +48069,10 @@ function writeBoulderState(directory, state3) {
47854
48069
  const filePath = getBoulderFilePath(directory);
47855
48070
  try {
47856
48071
  const dir = dirname14(filePath);
47857
- if (!existsSync52(dir)) {
48072
+ if (!existsSync53(dir)) {
47858
48073
  mkdirSync13(dir, { recursive: true });
47859
48074
  }
47860
- writeFileSync17(filePath, JSON.stringify(state3, null, 2), "utf-8");
48075
+ writeFileSync18(filePath, JSON.stringify(state3, null, 2), "utf-8");
47861
48076
  return true;
47862
48077
  } catch {
47863
48078
  return false;
@@ -47881,7 +48096,7 @@ function appendSessionId(directory, sessionId) {
47881
48096
  function clearBoulderState(directory) {
47882
48097
  const filePath = getBoulderFilePath(directory);
47883
48098
  try {
47884
- if (existsSync52(filePath)) {
48099
+ if (existsSync53(filePath)) {
47885
48100
  const { unlinkSync: unlinkSync9 } = __require("fs");
47886
48101
  unlinkSync9(filePath);
47887
48102
  }
@@ -47891,13 +48106,13 @@ function clearBoulderState(directory) {
47891
48106
  }
47892
48107
  }
47893
48108
  function findPrometheusPlans(directory) {
47894
- const plansDir = join61(directory, PROMETHEUS_PLANS_DIR);
47895
- if (!existsSync52(plansDir)) {
48109
+ const plansDir = join62(directory, PROMETHEUS_PLANS_DIR);
48110
+ if (!existsSync53(plansDir)) {
47896
48111
  return [];
47897
48112
  }
47898
48113
  try {
47899
48114
  const files = readdirSync16(plansDir);
47900
- return files.filter((f) => f.endsWith(".md")).map((f) => join61(plansDir, f)).sort((a, b) => {
48115
+ return files.filter((f) => f.endsWith(".md")).map((f) => join62(plansDir, f)).sort((a, b) => {
47901
48116
  const aStat = __require("fs").statSync(a);
47902
48117
  const bStat = __require("fs").statSync(b);
47903
48118
  return bStat.mtimeMs - aStat.mtimeMs;
@@ -47907,11 +48122,11 @@ function findPrometheusPlans(directory) {
47907
48122
  }
47908
48123
  }
47909
48124
  function getPlanProgress(planPath) {
47910
- if (!existsSync52(planPath)) {
48125
+ if (!existsSync53(planPath)) {
47911
48126
  return { total: 0, completed: 0, isComplete: true };
47912
48127
  }
47913
48128
  try {
47914
- const content = readFileSync40(planPath, "utf-8");
48129
+ const content = readFileSync41(planPath, "utf-8");
47915
48130
  const uncheckedMatches = content.match(/^\s*[-*]\s*\[\s*\]/gm) || [];
47916
48131
  const checkedMatches = content.match(/^\s*[-*]\s*\[[xX]\]/gm) || [];
47917
48132
  const total = uncheckedMatches.length + checkedMatches.length;
@@ -49517,16 +49732,16 @@ var THINKING_SUMMARY_MAX_CHARS = 500;
49517
49732
  function hasData(value) {
49518
49733
  return typeof value === "object" && value !== null && "data" in value;
49519
49734
  }
49520
- function isRecord3(value) {
49735
+ function isRecord4(value) {
49521
49736
  return typeof value === "object" && value !== null;
49522
49737
  }
49523
49738
  function getMessageInfo(value) {
49524
- if (!isRecord3(value))
49739
+ if (!isRecord4(value))
49525
49740
  return;
49526
- if (!isRecord3(value.info))
49741
+ if (!isRecord4(value.info))
49527
49742
  return;
49528
49743
  const info = value.info;
49529
- const modelValue = isRecord3(info.model) ? info.model : undefined;
49744
+ const modelValue = isRecord4(info.model) ? info.model : undefined;
49530
49745
  const model = modelValue && typeof modelValue.providerID === "string" && typeof modelValue.modelID === "string" ? { providerID: modelValue.providerID, modelID: modelValue.modelID } : undefined;
49531
49746
  return {
49532
49747
  role: typeof info.role === "string" ? info.role : undefined,
@@ -49534,7 +49749,7 @@ function getMessageInfo(value) {
49534
49749
  model,
49535
49750
  providerID: typeof info.providerID === "string" ? info.providerID : undefined,
49536
49751
  modelID: typeof info.modelID === "string" ? info.modelID : undefined,
49537
- tools: isRecord3(info.tools) ? Object.entries(info.tools).reduce((acc, [key, value2]) => {
49752
+ tools: isRecord4(info.tools) ? Object.entries(info.tools).reduce((acc, [key, value2]) => {
49538
49753
  if (value2 === true || value2 === false || value2 === "allow" || value2 === "deny" || value2 === "ask") {
49539
49754
  acc[key] = value2;
49540
49755
  }
@@ -49543,11 +49758,11 @@ function getMessageInfo(value) {
49543
49758
  };
49544
49759
  }
49545
49760
  function getMessageParts(value) {
49546
- if (!isRecord3(value))
49761
+ if (!isRecord4(value))
49547
49762
  return [];
49548
49763
  if (!Array.isArray(value.parts))
49549
49764
  return [];
49550
- return value.parts.filter(isRecord3).map((part) => ({
49765
+ return value.parts.filter(isRecord4).map((part) => ({
49551
49766
  type: typeof part.type === "string" ? part.type : undefined,
49552
49767
  text: typeof part.text === "string" ? part.text : undefined,
49553
49768
  thinking: typeof part.thinking === "string" ? part.thinking : undefined
@@ -49871,8 +50086,8 @@ var HOOK_NAME11 = "runtime-fallback";
49871
50086
  init_logger();
49872
50087
 
49873
50088
  // src/plugin-config.ts
49874
- import * as fs18 from "fs";
49875
- import * as path10 from "path";
50089
+ import * as fs19 from "fs";
50090
+ import * as path11 from "path";
49876
50091
 
49877
50092
  // src/config/schema/agent-names.ts
49878
50093
  var BuiltinAgentNameSchema = exports_external.enum([
@@ -50326,8 +50541,8 @@ function parseConfigPartially(rawConfig) {
50326
50541
  }
50327
50542
  function loadConfigFromPath2(configPath, _ctx) {
50328
50543
  try {
50329
- if (fs18.existsSync(configPath)) {
50330
- const content = fs18.readFileSync(configPath, "utf-8");
50544
+ if (fs19.existsSync(configPath)) {
50545
+ const content = fs19.readFileSync(configPath, "utf-8");
50331
50546
  const rawConfig = parseJsonc(content);
50332
50547
  migrateConfigFile(configPath, rawConfig);
50333
50548
  const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
@@ -50396,10 +50611,10 @@ function mergeConfigs(base, override) {
50396
50611
  }
50397
50612
  function loadPluginConfig(directory, ctx) {
50398
50613
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
50399
- const userBasePath = path10.join(configDir, "oh-my-opencode");
50614
+ const userBasePath = path11.join(configDir, "oh-my-opencode");
50400
50615
  const userDetected = detectConfigFile(userBasePath);
50401
50616
  const userConfigPath = userDetected.format !== "none" ? userDetected.path : userBasePath + ".json";
50402
- const projectBasePath = path10.join(directory, ".opencode", "oh-my-opencode");
50617
+ const projectBasePath = path11.join(directory, ".opencode", "oh-my-opencode");
50403
50618
  const projectDetected = detectConfigFile(projectBasePath);
50404
50619
  const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
50405
50620
  let config2 = loadConfigFromPath2(userConfigPath, ctx) ?? {};
@@ -51326,8 +51541,8 @@ function createRuntimeFallbackHook(ctx, options) {
51326
51541
  };
51327
51542
  }
51328
51543
  // src/hooks/write-existing-file-guard/hook.ts
51329
- import { existsSync as existsSync54, realpathSync as realpathSync4 } from "fs";
51330
- import { basename as basename6, dirname as dirname15, isAbsolute as isAbsolute7, join as join63, normalize, relative as relative5, resolve as resolve7 } from "path";
51544
+ import { existsSync as existsSync55, realpathSync as realpathSync4 } from "fs";
51545
+ import { basename as basename6, dirname as dirname15, isAbsolute as isAbsolute7, join as join64, normalize, relative as relative5, resolve as resolve7 } from "path";
51331
51546
  var MAX_TRACKED_SESSIONS = 256;
51332
51547
  var MAX_TRACKED_PATHS_PER_SESSION = 1024;
51333
51548
  function asRecord(value) {
@@ -51348,7 +51563,7 @@ function isPathInsideDirectory(pathToCheck, directory) {
51348
51563
  }
51349
51564
  function toCanonicalPath(absolutePath) {
51350
51565
  let canonicalPath = absolutePath;
51351
- if (existsSync54(absolutePath)) {
51566
+ if (existsSync55(absolutePath)) {
51352
51567
  try {
51353
51568
  canonicalPath = realpathSync4.native(absolutePath);
51354
51569
  } catch {
@@ -51356,8 +51571,8 @@ function toCanonicalPath(absolutePath) {
51356
51571
  }
51357
51572
  } else {
51358
51573
  const absoluteDir = dirname15(absolutePath);
51359
- const resolvedDir = existsSync54(absoluteDir) ? realpathSync4.native(absoluteDir) : absoluteDir;
51360
- canonicalPath = join63(resolvedDir, basename6(absolutePath));
51574
+ const resolvedDir = existsSync55(absoluteDir) ? realpathSync4.native(absoluteDir) : absoluteDir;
51575
+ canonicalPath = join64(resolvedDir, basename6(absolutePath));
51361
51576
  }
51362
51577
  return normalize(canonicalPath);
51363
51578
  }
@@ -51457,7 +51672,7 @@ function createWriteExistingFileGuardHook(ctx) {
51457
51672
  return;
51458
51673
  }
51459
51674
  if (toolName === "read") {
51460
- if (!existsSync54(resolvedPath) || !input.sessionID) {
51675
+ if (!existsSync55(resolvedPath) || !input.sessionID) {
51461
51676
  return;
51462
51677
  }
51463
51678
  registerReadPermission(input.sessionID, canonicalPath);
@@ -51467,7 +51682,7 @@ function createWriteExistingFileGuardHook(ctx) {
51467
51682
  if (argsRecord && "overwrite" in argsRecord) {
51468
51683
  delete argsRecord.overwrite;
51469
51684
  }
51470
- if (!existsSync54(resolvedPath)) {
51685
+ if (!existsSync55(resolvedPath)) {
51471
51686
  return;
51472
51687
  }
51473
51688
  const isSisyphusPath2 = canonicalPath.includes("/.sisyphus/");
@@ -52561,13 +52776,13 @@ var DEFAULT_MAX_REFERENCES = 200;
52561
52776
  var DEFAULT_MAX_SYMBOLS = 200;
52562
52777
  var DEFAULT_MAX_DIAGNOSTICS = 200;
52563
52778
  // src/tools/lsp/server-config-loader.ts
52564
- import { existsSync as existsSync55, readFileSync as readFileSync42 } from "fs";
52565
- import { join as join64 } from "path";
52566
- function loadJsonFile(path11) {
52567
- if (!existsSync55(path11))
52779
+ import { existsSync as existsSync56, readFileSync as readFileSync43 } from "fs";
52780
+ import { join as join65 } from "path";
52781
+ function loadJsonFile(path12) {
52782
+ if (!existsSync56(path12))
52568
52783
  return null;
52569
52784
  try {
52570
- return parseJsonc(readFileSync42(path11, "utf-8"));
52785
+ return parseJsonc(readFileSync43(path12, "utf-8"));
52571
52786
  } catch {
52572
52787
  return null;
52573
52788
  }
@@ -52576,9 +52791,9 @@ function getConfigPaths3() {
52576
52791
  const cwd = process.cwd();
52577
52792
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
52578
52793
  return {
52579
- project: detectConfigFile(join64(cwd, ".opencode", "oh-my-opencode")).path,
52580
- user: detectConfigFile(join64(configDir, "oh-my-opencode")).path,
52581
- opencode: detectConfigFile(join64(configDir, "opencode")).path
52794
+ project: detectConfigFile(join65(cwd, ".opencode", "oh-my-opencode")).path,
52795
+ user: detectConfigFile(join65(configDir, "oh-my-opencode")).path,
52796
+ opencode: detectConfigFile(join65(configDir, "opencode")).path
52582
52797
  };
52583
52798
  }
52584
52799
  function loadAllConfigs() {
@@ -52647,14 +52862,14 @@ function getMergedServers() {
52647
52862
  }
52648
52863
 
52649
52864
  // src/tools/lsp/server-installation.ts
52650
- import { existsSync as existsSync56 } from "fs";
52651
- import { join as join65 } from "path";
52865
+ import { existsSync as existsSync57 } from "fs";
52866
+ import { join as join66 } from "path";
52652
52867
  function isServerInstalled(command) {
52653
52868
  if (command.length === 0)
52654
52869
  return false;
52655
52870
  const cmd = command[0];
52656
52871
  if (cmd.includes("/") || cmd.includes("\\")) {
52657
- if (existsSync56(cmd))
52872
+ if (existsSync57(cmd))
52658
52873
  return true;
52659
52874
  }
52660
52875
  const isWindows2 = process.platform === "win32";
@@ -52676,23 +52891,23 @@ function isServerInstalled(command) {
52676
52891
  const paths = pathEnv.split(pathSeparator);
52677
52892
  for (const p of paths) {
52678
52893
  for (const suffix of exts) {
52679
- if (existsSync56(join65(p, cmd + suffix))) {
52894
+ if (existsSync57(join66(p, cmd + suffix))) {
52680
52895
  return true;
52681
52896
  }
52682
52897
  }
52683
52898
  }
52684
52899
  const cwd = process.cwd();
52685
52900
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
52686
- const dataDir = join65(getDataDir(), "opencode");
52901
+ const dataDir = join66(getDataDir(), "opencode");
52687
52902
  const additionalBases = [
52688
- join65(cwd, "node_modules", ".bin"),
52689
- join65(configDir, "bin"),
52690
- join65(configDir, "node_modules", ".bin"),
52691
- join65(dataDir, "bin")
52903
+ join66(cwd, "node_modules", ".bin"),
52904
+ join66(configDir, "bin"),
52905
+ join66(configDir, "node_modules", ".bin"),
52906
+ join66(dataDir, "bin")
52692
52907
  ];
52693
52908
  for (const base of additionalBases) {
52694
52909
  for (const suffix of exts) {
52695
- if (existsSync56(join65(base, cmd + suffix))) {
52910
+ if (existsSync57(join66(base, cmd + suffix))) {
52696
52911
  return true;
52697
52912
  }
52698
52913
  }
@@ -52750,13 +52965,13 @@ function getLanguageId(ext) {
52750
52965
  init_logger();
52751
52966
  var {spawn: bunSpawn2 } = globalThis.Bun;
52752
52967
  import { spawn as nodeSpawn2 } from "child_process";
52753
- import { existsSync as existsSync57, statSync as statSync7 } from "fs";
52968
+ import { existsSync as existsSync58, statSync as statSync7 } from "fs";
52754
52969
  function shouldUseNodeSpawn() {
52755
52970
  return process.platform === "win32";
52756
52971
  }
52757
52972
  function validateCwd(cwd) {
52758
52973
  try {
52759
- if (!existsSync57(cwd)) {
52974
+ if (!existsSync58(cwd)) {
52760
52975
  return { valid: false, error: `Working directory does not exist: ${cwd}` };
52761
52976
  }
52762
52977
  const stats = statSync7(cwd);
@@ -52888,7 +53103,7 @@ function spawnProcess(command, options) {
52888
53103
  return proc;
52889
53104
  }
52890
53105
  // src/tools/lsp/lsp-client.ts
52891
- import { readFileSync as readFileSync43 } from "fs";
53106
+ import { readFileSync as readFileSync44 } from "fs";
52892
53107
  import { extname as extname3, resolve as resolve8 } from "path";
52893
53108
  import { pathToFileURL as pathToFileURL2 } from "url";
52894
53109
 
@@ -53152,7 +53367,7 @@ class LSPClient extends LSPClientConnection {
53152
53367
  async openFile(filePath) {
53153
53368
  const absPath = resolve8(filePath);
53154
53369
  const uri = pathToFileURL2(absPath).href;
53155
- const text = readFileSync43(absPath, "utf-8");
53370
+ const text = readFileSync44(absPath, "utf-8");
53156
53371
  if (!this.openedFiles.has(absPath)) {
53157
53372
  const ext = extname3(absPath);
53158
53373
  const languageId = getLanguageId(ext);
@@ -53493,17 +53708,17 @@ var lspManager = LSPServerManager.getInstance();
53493
53708
  // src/tools/lsp/lsp-client-wrapper.ts
53494
53709
  import { extname as extname4, resolve as resolve9 } from "path";
53495
53710
  import { fileURLToPath as fileURLToPath3 } from "url";
53496
- import { existsSync as existsSync58 } from "fs";
53711
+ import { existsSync as existsSync59 } from "fs";
53497
53712
  function findWorkspaceRoot(filePath) {
53498
53713
  let dir = resolve9(filePath);
53499
- if (!existsSync58(dir) || !__require("fs").statSync(dir).isDirectory()) {
53714
+ if (!existsSync59(dir) || !__require("fs").statSync(dir).isDirectory()) {
53500
53715
  dir = __require("path").dirname(dir);
53501
53716
  }
53502
53717
  const markers = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
53503
53718
  let prevDir = "";
53504
53719
  while (dir !== prevDir) {
53505
53720
  for (const marker of markers) {
53506
- if (existsSync58(__require("path").join(dir, marker))) {
53721
+ if (existsSync59(__require("path").join(dir, marker))) {
53507
53722
  return dir;
53508
53723
  }
53509
53724
  }
@@ -53678,10 +53893,10 @@ function formatApplyResult(result) {
53678
53893
  `);
53679
53894
  }
53680
53895
  // src/tools/lsp/workspace-edit.ts
53681
- import { readFileSync as readFileSync44, writeFileSync as writeFileSync18 } from "fs";
53896
+ import { readFileSync as readFileSync45, writeFileSync as writeFileSync19 } from "fs";
53682
53897
  function applyTextEditsToFile(filePath, edits) {
53683
53898
  try {
53684
- let content = readFileSync44(filePath, "utf-8");
53899
+ let content = readFileSync45(filePath, "utf-8");
53685
53900
  const lines = content.split(`
53686
53901
  `);
53687
53902
  const sortedEdits = [...edits].sort((a, b) => {
@@ -53706,7 +53921,7 @@ function applyTextEditsToFile(filePath, edits) {
53706
53921
  `));
53707
53922
  }
53708
53923
  }
53709
- writeFileSync18(filePath, lines.join(`
53924
+ writeFileSync19(filePath, lines.join(`
53710
53925
  `), "utf-8");
53711
53926
  return { success: true, editCount: edits.length };
53712
53927
  } catch (err) {
@@ -53737,7 +53952,7 @@ function applyWorkspaceEdit(edit) {
53737
53952
  if (change.kind === "create") {
53738
53953
  try {
53739
53954
  const filePath = uriToPath(change.uri);
53740
- writeFileSync18(filePath, "", "utf-8");
53955
+ writeFileSync19(filePath, "", "utf-8");
53741
53956
  result.filesModified.push(filePath);
53742
53957
  } catch (err) {
53743
53958
  result.success = false;
@@ -53747,8 +53962,8 @@ function applyWorkspaceEdit(edit) {
53747
53962
  try {
53748
53963
  const oldPath = uriToPath(change.oldUri);
53749
53964
  const newPath = uriToPath(change.newUri);
53750
- const content = readFileSync44(oldPath, "utf-8");
53751
- writeFileSync18(newPath, content, "utf-8");
53965
+ const content = readFileSync45(oldPath, "utf-8");
53966
+ writeFileSync19(newPath, content, "utf-8");
53752
53967
  __require("fs").unlinkSync(oldPath);
53753
53968
  result.filesModified.push(newPath);
53754
53969
  } catch (err) {
@@ -54509,10 +54724,10 @@ function mergeDefs2(...defs) {
54509
54724
  function cloneDef2(schema2) {
54510
54725
  return mergeDefs2(schema2._zod.def);
54511
54726
  }
54512
- function getElementAtPath2(obj, path11) {
54513
- if (!path11)
54727
+ function getElementAtPath2(obj, path12) {
54728
+ if (!path12)
54514
54729
  return obj;
54515
- return path11.reduce((acc, key) => acc?.[key], obj);
54730
+ return path12.reduce((acc, key) => acc?.[key], obj);
54516
54731
  }
54517
54732
  function promiseAllObject2(promisesObj) {
54518
54733
  const keys = Object.keys(promisesObj);
@@ -54871,11 +55086,11 @@ function aborted2(x, startIndex = 0) {
54871
55086
  }
54872
55087
  return false;
54873
55088
  }
54874
- function prefixIssues2(path11, issues) {
55089
+ function prefixIssues2(path12, issues) {
54875
55090
  return issues.map((iss) => {
54876
55091
  var _a2;
54877
55092
  (_a2 = iss).path ?? (_a2.path = []);
54878
- iss.path.unshift(path11);
55093
+ iss.path.unshift(path12);
54879
55094
  return iss;
54880
55095
  });
54881
55096
  }
@@ -55043,7 +55258,7 @@ function treeifyError2(error48, _mapper) {
55043
55258
  return issue3.message;
55044
55259
  };
55045
55260
  const result = { errors: [] };
55046
- const processError = (error49, path11 = []) => {
55261
+ const processError = (error49, path12 = []) => {
55047
55262
  var _a2, _b;
55048
55263
  for (const issue3 of error49.issues) {
55049
55264
  if (issue3.code === "invalid_union" && issue3.errors.length) {
@@ -55053,7 +55268,7 @@ function treeifyError2(error48, _mapper) {
55053
55268
  } else if (issue3.code === "invalid_element") {
55054
55269
  processError({ issues: issue3.issues }, issue3.path);
55055
55270
  } else {
55056
- const fullpath = [...path11, ...issue3.path];
55271
+ const fullpath = [...path12, ...issue3.path];
55057
55272
  if (fullpath.length === 0) {
55058
55273
  result.errors.push(mapper(issue3));
55059
55274
  continue;
@@ -55085,8 +55300,8 @@ function treeifyError2(error48, _mapper) {
55085
55300
  }
55086
55301
  function toDotPath2(_path) {
55087
55302
  const segs = [];
55088
- const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
55089
- for (const seg of path11) {
55303
+ const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
55304
+ for (const seg of path12) {
55090
55305
  if (typeof seg === "number")
55091
55306
  segs.push(`[${seg}]`);
55092
55307
  else if (typeof seg === "symbol")
@@ -66344,13 +66559,13 @@ var DEFAULT_MAX_MATCHES = 500;
66344
66559
 
66345
66560
  // src/tools/ast-grep/sg-cli-path.ts
66346
66561
  import { createRequire as createRequire4 } from "module";
66347
- import { dirname as dirname16, join as join67 } from "path";
66348
- import { existsSync as existsSync60, statSync as statSync8 } from "fs";
66562
+ import { dirname as dirname16, join as join68 } from "path";
66563
+ import { existsSync as existsSync61, statSync as statSync8 } from "fs";
66349
66564
 
66350
66565
  // src/tools/ast-grep/downloader.ts
66351
- import { existsSync as existsSync59 } from "fs";
66352
- import { join as join66 } from "path";
66353
- import { homedir as homedir13 } from "os";
66566
+ import { existsSync as existsSync60 } from "fs";
66567
+ import { join as join67 } from "path";
66568
+ import { homedir as homedir14 } from "os";
66354
66569
  import { createRequire as createRequire3 } from "module";
66355
66570
  init_logger();
66356
66571
  var REPO2 = "ast-grep/ast-grep";
@@ -66376,12 +66591,12 @@ var PLATFORM_MAP2 = {
66376
66591
  function getCacheDir4() {
66377
66592
  if (process.platform === "win32") {
66378
66593
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
66379
- const base2 = localAppData || join66(homedir13(), "AppData", "Local");
66380
- return join66(base2, "oh-my-opencode", "bin");
66594
+ const base2 = localAppData || join67(homedir14(), "AppData", "Local");
66595
+ return join67(base2, "oh-my-opencode", "bin");
66381
66596
  }
66382
66597
  const xdgCache = process.env.XDG_CACHE_HOME;
66383
- const base = xdgCache || join66(homedir13(), ".cache");
66384
- return join66(base, "oh-my-opencode", "bin");
66598
+ const base = xdgCache || join67(homedir14(), ".cache");
66599
+ return join67(base, "oh-my-opencode", "bin");
66385
66600
  }
66386
66601
  function getBinaryName3() {
66387
66602
  return process.platform === "win32" ? "sg.exe" : "sg";
@@ -66398,16 +66613,16 @@ async function downloadAstGrep(version3 = DEFAULT_VERSION) {
66398
66613
  }
66399
66614
  const cacheDir = getCacheDir4();
66400
66615
  const binaryName = getBinaryName3();
66401
- const binaryPath = join66(cacheDir, binaryName);
66402
- if (existsSync59(binaryPath)) {
66616
+ const binaryPath = join67(cacheDir, binaryName);
66617
+ if (existsSync60(binaryPath)) {
66403
66618
  return binaryPath;
66404
66619
  }
66405
- const { arch, os: os6 } = platformInfo;
66406
- const assetName = `app-${arch}-${os6}.zip`;
66620
+ const { arch, os: os7 } = platformInfo;
66621
+ const assetName = `app-${arch}-${os7}.zip`;
66407
66622
  const downloadUrl = `https://github.com/${REPO2}/releases/download/${version3}/${assetName}`;
66408
66623
  log(`[oh-my-opencode] Downloading ast-grep binary...`);
66409
66624
  try {
66410
- const archivePath = join66(cacheDir, assetName);
66625
+ const archivePath = join67(cacheDir, assetName);
66411
66626
  ensureCacheDir(cacheDir);
66412
66627
  await downloadArchive(downloadUrl, archivePath);
66413
66628
  await extractZipArchive(archivePath, cacheDir);
@@ -66461,8 +66676,8 @@ function findSgCliPathSync() {
66461
66676
  const require2 = createRequire4(import.meta.url);
66462
66677
  const cliPackageJsonPath = require2.resolve("@ast-grep/cli/package.json");
66463
66678
  const cliDirectory = dirname16(cliPackageJsonPath);
66464
- const sgPath = join67(cliDirectory, binaryName);
66465
- if (existsSync60(sgPath) && isValidBinary(sgPath)) {
66679
+ const sgPath = join68(cliDirectory, binaryName);
66680
+ if (existsSync61(sgPath) && isValidBinary(sgPath)) {
66466
66681
  return sgPath;
66467
66682
  }
66468
66683
  } catch {}
@@ -66473,17 +66688,17 @@ function findSgCliPathSync() {
66473
66688
  const packageJsonPath = require2.resolve(`${platformPackage}/package.json`);
66474
66689
  const packageDirectory = dirname16(packageJsonPath);
66475
66690
  const astGrepBinaryName = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
66476
- const binaryPath = join67(packageDirectory, astGrepBinaryName);
66477
- if (existsSync60(binaryPath) && isValidBinary(binaryPath)) {
66691
+ const binaryPath = join68(packageDirectory, astGrepBinaryName);
66692
+ if (existsSync61(binaryPath) && isValidBinary(binaryPath)) {
66478
66693
  return binaryPath;
66479
66694
  }
66480
66695
  } catch {}
66481
66696
  }
66482
66697
  if (process.platform === "darwin") {
66483
66698
  const homebrewPaths = ["/opt/homebrew/bin/sg", "/usr/local/bin/sg"];
66484
- for (const path11 of homebrewPaths) {
66485
- if (existsSync60(path11) && isValidBinary(path11)) {
66486
- return path11;
66699
+ for (const path12 of homebrewPaths) {
66700
+ if (existsSync61(path12) && isValidBinary(path12)) {
66701
+ return path12;
66487
66702
  }
66488
66703
  }
66489
66704
  }
@@ -66501,19 +66716,19 @@ function getSgCliPath() {
66501
66716
  }
66502
66717
  return null;
66503
66718
  }
66504
- function setSgCliPath(path11) {
66505
- resolvedCliPath2 = path11;
66719
+ function setSgCliPath(path12) {
66720
+ resolvedCliPath2 = path12;
66506
66721
  }
66507
66722
  // src/tools/ast-grep/cli.ts
66508
66723
  var {spawn: spawn10 } = globalThis.Bun;
66509
- import { existsSync as existsSync62 } from "fs";
66724
+ import { existsSync as existsSync63 } from "fs";
66510
66725
 
66511
66726
  // src/tools/ast-grep/cli-binary-path-resolution.ts
66512
- import { existsSync as existsSync61 } from "fs";
66727
+ import { existsSync as existsSync62 } from "fs";
66513
66728
  var resolvedCliPath3 = null;
66514
66729
  var initPromise3 = null;
66515
66730
  async function getAstGrepPath() {
66516
- if (resolvedCliPath3 !== null && existsSync61(resolvedCliPath3)) {
66731
+ if (resolvedCliPath3 !== null && existsSync62(resolvedCliPath3)) {
66517
66732
  return resolvedCliPath3;
66518
66733
  }
66519
66734
  if (initPromise3) {
@@ -66521,7 +66736,7 @@ async function getAstGrepPath() {
66521
66736
  }
66522
66737
  initPromise3 = (async () => {
66523
66738
  const syncPath = findSgCliPathSync();
66524
- if (syncPath && existsSync61(syncPath)) {
66739
+ if (syncPath && existsSync62(syncPath)) {
66525
66740
  resolvedCliPath3 = syncPath;
66526
66741
  setSgCliPath(syncPath);
66527
66742
  return syncPath;
@@ -66620,7 +66835,7 @@ async function runSg(options) {
66620
66835
  const paths = options.paths && options.paths.length > 0 ? options.paths : ["."];
66621
66836
  args.push(...paths);
66622
66837
  let cliPath = getSgCliPath();
66623
- if (!cliPath || !existsSync62(cliPath)) {
66838
+ if (!cliPath || !existsSync63(cliPath)) {
66624
66839
  const downloadedPath = await getAstGrepPath();
66625
66840
  if (downloadedPath) {
66626
66841
  cliPath = downloadedPath;
@@ -66874,19 +67089,19 @@ import { resolve as resolve10 } from "path";
66874
67089
  var {spawn: spawn11 } = globalThis.Bun;
66875
67090
 
66876
67091
  // src/tools/grep/constants.ts
66877
- import { existsSync as existsSync64 } from "fs";
66878
- import { join as join69, dirname as dirname17 } from "path";
67092
+ import { existsSync as existsSync65 } from "fs";
67093
+ import { join as join70, dirname as dirname17 } from "path";
66879
67094
  import { spawnSync as spawnSync2 } from "child_process";
66880
67095
 
66881
67096
  // src/tools/grep/downloader.ts
66882
- import { existsSync as existsSync63, readdirSync as readdirSync17 } from "fs";
66883
- import { join as join68 } from "path";
67097
+ import { existsSync as existsSync64, readdirSync as readdirSync17 } from "fs";
67098
+ import { join as join69 } from "path";
66884
67099
  function findFileRecursive(dir, filename) {
66885
67100
  try {
66886
67101
  const entries = readdirSync17(dir, { withFileTypes: true, recursive: true });
66887
67102
  for (const entry of entries) {
66888
67103
  if (entry.isFile() && entry.name === filename) {
66889
- return join68(entry.parentPath ?? dir, entry.name);
67104
+ return join69(entry.parentPath ?? dir, entry.name);
66890
67105
  }
66891
67106
  }
66892
67107
  } catch {
@@ -66907,11 +67122,11 @@ function getPlatformKey() {
66907
67122
  }
66908
67123
  function getInstallDir() {
66909
67124
  const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
66910
- return join68(homeDir, ".cache", "oh-my-opencode", "bin");
67125
+ return join69(homeDir, ".cache", "oh-my-opencode", "bin");
66911
67126
  }
66912
67127
  function getRgPath() {
66913
67128
  const isWindows2 = process.platform === "win32";
66914
- return join68(getInstallDir(), isWindows2 ? "rg.exe" : "rg");
67129
+ return join69(getInstallDir(), isWindows2 ? "rg.exe" : "rg");
66915
67130
  }
66916
67131
  async function extractTarGz2(archivePath, destDir) {
66917
67132
  const platformKey = getPlatformKey();
@@ -66928,7 +67143,7 @@ async function extractZip2(archivePath, destDir) {
66928
67143
  const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
66929
67144
  const foundPath = findFileRecursive(destDir, binaryName);
66930
67145
  if (foundPath) {
66931
- const destPath = join68(destDir, binaryName);
67146
+ const destPath = join69(destDir, binaryName);
66932
67147
  if (foundPath !== destPath) {
66933
67148
  const { renameSync } = await import("fs");
66934
67149
  renameSync(foundPath, destPath);
@@ -66943,13 +67158,13 @@ async function downloadAndInstallRipgrep() {
66943
67158
  }
66944
67159
  const installDir = getInstallDir();
66945
67160
  const rgPath = getRgPath();
66946
- if (existsSync63(rgPath)) {
67161
+ if (existsSync64(rgPath)) {
66947
67162
  return rgPath;
66948
67163
  }
66949
67164
  ensureCacheDir(installDir);
66950
67165
  const filename = `ripgrep-${RG_VERSION}-${config4.platform}.${config4.extension}`;
66951
67166
  const url3 = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
66952
- const archivePath = join68(installDir, filename);
67167
+ const archivePath = join69(installDir, filename);
66953
67168
  try {
66954
67169
  await downloadArchive(url3, archivePath);
66955
67170
  if (config4.extension === "tar.gz") {
@@ -66958,7 +67173,7 @@ async function downloadAndInstallRipgrep() {
66958
67173
  await extractZip2(archivePath, installDir);
66959
67174
  }
66960
67175
  ensureExecutable(rgPath);
66961
- if (!existsSync63(rgPath)) {
67176
+ if (!existsSync64(rgPath)) {
66962
67177
  throw new Error("ripgrep binary not found after extraction");
66963
67178
  }
66964
67179
  return rgPath;
@@ -66970,7 +67185,7 @@ async function downloadAndInstallRipgrep() {
66970
67185
  }
66971
67186
  function getInstalledRipgrepPath() {
66972
67187
  const rgPath = getRgPath();
66973
- return existsSync63(rgPath) ? rgPath : null;
67188
+ return existsSync64(rgPath) ? rgPath : null;
66974
67189
  }
66975
67190
 
66976
67191
  // src/tools/grep/constants.ts
@@ -66994,14 +67209,14 @@ function getOpenCodeBundledRg() {
66994
67209
  const isWindows2 = process.platform === "win32";
66995
67210
  const rgName = isWindows2 ? "rg.exe" : "rg";
66996
67211
  const candidates = [
66997
- join69(getDataDir(), "opencode", "bin", rgName),
66998
- join69(execDir, rgName),
66999
- join69(execDir, "bin", rgName),
67000
- join69(execDir, "..", "bin", rgName),
67001
- join69(execDir, "..", "libexec", rgName)
67212
+ join70(getDataDir(), "opencode", "bin", rgName),
67213
+ join70(execDir, rgName),
67214
+ join70(execDir, "bin", rgName),
67215
+ join70(execDir, "..", "bin", rgName),
67216
+ join70(execDir, "..", "libexec", rgName)
67002
67217
  ];
67003
67218
  for (const candidate of candidates) {
67004
- if (existsSync64(candidate)) {
67219
+ if (existsSync65(candidate)) {
67005
67220
  return candidate;
67006
67221
  }
67007
67222
  }
@@ -67640,20 +67855,20 @@ Use this when a task matches an available skill's or command's description.
67640
67855
  // src/tools/skill/tools.ts
67641
67856
  import { dirname as dirname19 } from "path";
67642
67857
  // src/tools/slashcommand/command-discovery.ts
67643
- import { existsSync as existsSync65, readdirSync as readdirSync18, readFileSync as readFileSync45 } from "fs";
67644
- import { basename as basename7, join as join70 } from "path";
67858
+ import { existsSync as existsSync66, readdirSync as readdirSync18, readFileSync as readFileSync46 } from "fs";
67859
+ import { basename as basename7, join as join71 } from "path";
67645
67860
  function discoverCommandsFromDir2(commandsDir, scope) {
67646
- if (!existsSync65(commandsDir))
67861
+ if (!existsSync66(commandsDir))
67647
67862
  return [];
67648
67863
  const entries = readdirSync18(commandsDir, { withFileTypes: true });
67649
67864
  const commands3 = [];
67650
67865
  for (const entry of entries) {
67651
67866
  if (!isMarkdownFile(entry))
67652
67867
  continue;
67653
- const commandPath = join70(commandsDir, entry.name);
67868
+ const commandPath = join71(commandsDir, entry.name);
67654
67869
  const commandName = basename7(entry.name, ".md");
67655
67870
  try {
67656
- const content = readFileSync45(commandPath, "utf-8");
67871
+ const content = readFileSync46(commandPath, "utf-8");
67657
67872
  const { data, body } = parseFrontmatter(content);
67658
67873
  const isOpencodeSource = scope === "opencode" || scope === "opencode-project";
67659
67874
  const metadata = {
@@ -67694,10 +67909,10 @@ function discoverPluginCommands2(options) {
67694
67909
  }
67695
67910
  function discoverCommandsSync(directory, options) {
67696
67911
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
67697
- const userCommandsDir = join70(getClaudeConfigDir(), "commands");
67698
- const projectCommandsDir = join70(directory ?? process.cwd(), ".claude", "commands");
67699
- const opencodeGlobalDir = join70(configDir, "command");
67700
- const opencodeProjectDir = join70(directory ?? process.cwd(), ".opencode", "command");
67912
+ const userCommandsDir = join71(getClaudeConfigDir(), "commands");
67913
+ const projectCommandsDir = join71(directory ?? process.cwd(), ".claude", "commands");
67914
+ const opencodeGlobalDir = join71(configDir, "command");
67915
+ const opencodeProjectDir = join71(directory ?? process.cwd(), ".opencode", "command");
67701
67916
  const userCommands = discoverCommandsFromDir2(userCommandsDir, "user");
67702
67917
  const opencodeGlobalCommands = discoverCommandsFromDir2(opencodeGlobalDir, "opencode");
67703
67918
  const projectCommands = discoverCommandsFromDir2(projectCommandsDir, "project");
@@ -68033,9 +68248,9 @@ function createSkillTool(options = {}) {
68033
68248
  }
68034
68249
  var skill = createSkillTool();
68035
68250
  // src/tools/session-manager/constants.ts
68036
- import { join as join71 } from "path";
68037
- var TODO_DIR2 = join71(getClaudeConfigDir(), "todos");
68038
- var TRANSCRIPT_DIR2 = join71(getClaudeConfigDir(), "transcripts");
68251
+ import { join as join72 } from "path";
68252
+ var TODO_DIR2 = join72(getClaudeConfigDir(), "todos");
68253
+ var TRANSCRIPT_DIR2 = join72(getClaudeConfigDir(), "transcripts");
68039
68254
  var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
68040
68255
 
68041
68256
  Returns a list of available session IDs with metadata including message count, date range, and agents used.
@@ -68108,9 +68323,9 @@ Has Todos: Yes (12 items, 8 completed)
68108
68323
  Has Transcript: Yes (234 entries)`;
68109
68324
 
68110
68325
  // src/tools/session-manager/storage.ts
68111
- import { existsSync as existsSync66 } from "fs";
68326
+ import { existsSync as existsSync67 } from "fs";
68112
68327
  import { readdir, readFile } from "fs/promises";
68113
- import { join as join72 } from "path";
68328
+ import { join as join73 } from "path";
68114
68329
  var sdkClient = null;
68115
68330
  function setStorageClient(client2) {
68116
68331
  sdkClient = client2;
@@ -68129,7 +68344,7 @@ async function getMainSessions(options) {
68129
68344
  return [];
68130
68345
  }
68131
68346
  }
68132
- if (!existsSync66(SESSION_STORAGE))
68347
+ if (!existsSync67(SESSION_STORAGE))
68133
68348
  return [];
68134
68349
  const sessions = [];
68135
68350
  try {
@@ -68137,13 +68352,13 @@ async function getMainSessions(options) {
68137
68352
  for (const projectDir of projectDirs) {
68138
68353
  if (!projectDir.isDirectory())
68139
68354
  continue;
68140
- const projectPath = join72(SESSION_STORAGE, projectDir.name);
68355
+ const projectPath = join73(SESSION_STORAGE, projectDir.name);
68141
68356
  const sessionFiles = await readdir(projectPath);
68142
68357
  for (const file3 of sessionFiles) {
68143
68358
  if (!file3.endsWith(".json"))
68144
68359
  continue;
68145
68360
  try {
68146
- const content = await readFile(join72(projectPath, file3), "utf-8");
68361
+ const content = await readFile(join73(projectPath, file3), "utf-8");
68147
68362
  const meta3 = JSON.parse(content);
68148
68363
  if (meta3.parentID)
68149
68364
  continue;
@@ -68170,7 +68385,7 @@ async function getAllSessions() {
68170
68385
  return [];
68171
68386
  }
68172
68387
  }
68173
- if (!existsSync66(MESSAGE_STORAGE))
68388
+ if (!existsSync67(MESSAGE_STORAGE))
68174
68389
  return [];
68175
68390
  const sessions = [];
68176
68391
  async function scanDirectory(dir) {
@@ -68178,7 +68393,7 @@ async function getAllSessions() {
68178
68393
  const entries = await readdir(dir, { withFileTypes: true });
68179
68394
  for (const entry of entries) {
68180
68395
  if (entry.isDirectory()) {
68181
- const sessionPath = join72(dir, entry.name);
68396
+ const sessionPath = join73(dir, entry.name);
68182
68397
  const files = await readdir(sessionPath);
68183
68398
  if (files.some((f) => f.endsWith(".json"))) {
68184
68399
  sessions.push(entry.name);
@@ -68239,7 +68454,7 @@ async function readSessionMessages(sessionID) {
68239
68454
  }
68240
68455
  }
68241
68456
  const messageDir = getMessageDir(sessionID);
68242
- if (!messageDir || !existsSync66(messageDir))
68457
+ if (!messageDir || !existsSync67(messageDir))
68243
68458
  return [];
68244
68459
  const messages = [];
68245
68460
  try {
@@ -68248,7 +68463,7 @@ async function readSessionMessages(sessionID) {
68248
68463
  if (!file3.endsWith(".json"))
68249
68464
  continue;
68250
68465
  try {
68251
- const content = await readFile(join72(messageDir, file3), "utf-8");
68466
+ const content = await readFile(join73(messageDir, file3), "utf-8");
68252
68467
  const meta3 = JSON.parse(content);
68253
68468
  const parts = await readParts2(meta3.id);
68254
68469
  messages.push({
@@ -68274,8 +68489,8 @@ async function readSessionMessages(sessionID) {
68274
68489
  });
68275
68490
  }
68276
68491
  async function readParts2(messageID) {
68277
- const partDir = join72(PART_STORAGE, messageID);
68278
- if (!existsSync66(partDir))
68492
+ const partDir = join73(PART_STORAGE, messageID);
68493
+ if (!existsSync67(partDir))
68279
68494
  return [];
68280
68495
  const parts = [];
68281
68496
  try {
@@ -68284,7 +68499,7 @@ async function readParts2(messageID) {
68284
68499
  if (!file3.endsWith(".json"))
68285
68500
  continue;
68286
68501
  try {
68287
- const content = await readFile(join72(partDir, file3), "utf-8");
68502
+ const content = await readFile(join73(partDir, file3), "utf-8");
68288
68503
  parts.push(JSON.parse(content));
68289
68504
  } catch {
68290
68505
  continue;
@@ -68310,14 +68525,14 @@ async function readSessionTodos(sessionID) {
68310
68525
  return [];
68311
68526
  }
68312
68527
  }
68313
- if (!existsSync66(TODO_DIR2))
68528
+ if (!existsSync67(TODO_DIR2))
68314
68529
  return [];
68315
68530
  try {
68316
68531
  const allFiles = await readdir(TODO_DIR2);
68317
68532
  const todoFiles = allFiles.filter((f) => f.includes(sessionID) && f.endsWith(".json"));
68318
68533
  for (const file3 of todoFiles) {
68319
68534
  try {
68320
- const content = await readFile(join72(TODO_DIR2, file3), "utf-8");
68535
+ const content = await readFile(join73(TODO_DIR2, file3), "utf-8");
68321
68536
  const data = JSON.parse(content);
68322
68537
  if (Array.isArray(data)) {
68323
68538
  return data.map((item) => ({
@@ -68337,10 +68552,10 @@ async function readSessionTodos(sessionID) {
68337
68552
  return [];
68338
68553
  }
68339
68554
  async function readSessionTranscript(sessionID) {
68340
- if (!existsSync66(TRANSCRIPT_DIR2))
68555
+ if (!existsSync67(TRANSCRIPT_DIR2))
68341
68556
  return 0;
68342
- const transcriptFile = join72(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
68343
- if (!existsSync66(transcriptFile))
68557
+ const transcriptFile = join73(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
68558
+ if (!existsSync67(transcriptFile))
68344
68559
  return 0;
68345
68560
  try {
68346
68561
  const content = await readFile(transcriptFile, "utf-8");
@@ -69961,9 +70176,9 @@ async function resolveMultimodalLookerAgentMetadata(ctx) {
69961
70176
 
69962
70177
  // src/tools/look-at/image-converter.ts
69963
70178
  import { execFileSync as execFileSync3 } from "child_process";
69964
- import { existsSync as existsSync67, mkdtempSync, readFileSync as readFileSync46, rmSync as rmSync3, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "fs";
70179
+ import { existsSync as existsSync68, mkdtempSync, readFileSync as readFileSync47, rmSync as rmSync3, unlinkSync as unlinkSync9, writeFileSync as writeFileSync20 } from "fs";
69965
70180
  import { tmpdir as tmpdir6 } from "os";
69966
- import { dirname as dirname20, join as join73 } from "path";
70181
+ import { dirname as dirname20, join as join74 } from "path";
69967
70182
  var SUPPORTED_FORMATS = new Set([
69968
70183
  "image/jpeg",
69969
70184
  "image/png",
@@ -70001,11 +70216,11 @@ function needsConversion(mimeType) {
70001
70216
  return mimeType.startsWith("image/");
70002
70217
  }
70003
70218
  function convertImageToJpeg(inputPath, mimeType) {
70004
- if (!existsSync67(inputPath)) {
70219
+ if (!existsSync68(inputPath)) {
70005
70220
  throw new Error(`File not found: ${inputPath}`);
70006
70221
  }
70007
- const tempDir = mkdtempSync(join73(tmpdir6(), "opencode-img-"));
70008
- const outputPath = join73(tempDir, "converted.jpg");
70222
+ const tempDir = mkdtempSync(join74(tmpdir6(), "opencode-img-"));
70223
+ const outputPath = join74(tempDir, "converted.jpg");
70009
70224
  log(`[image-converter] Converting ${mimeType} to JPEG: ${inputPath}`);
70010
70225
  try {
70011
70226
  if (process.platform === "darwin") {
@@ -70015,7 +70230,7 @@ function convertImageToJpeg(inputPath, mimeType) {
70015
70230
  encoding: "utf-8",
70016
70231
  timeout: CONVERSION_TIMEOUT_MS
70017
70232
  });
70018
- if (existsSync67(outputPath)) {
70233
+ if (existsSync68(outputPath)) {
70019
70234
  log(`[image-converter] Converted using sips: ${outputPath}`);
70020
70235
  return outputPath;
70021
70236
  }
@@ -70030,7 +70245,7 @@ function convertImageToJpeg(inputPath, mimeType) {
70030
70245
  encoding: "utf-8",
70031
70246
  timeout: CONVERSION_TIMEOUT_MS
70032
70247
  });
70033
- if (existsSync67(outputPath)) {
70248
+ if (existsSync68(outputPath)) {
70034
70249
  log(`[image-converter] Converted using ImageMagick: ${outputPath}`);
70035
70250
  return outputPath;
70036
70251
  }
@@ -70043,7 +70258,7 @@ function convertImageToJpeg(inputPath, mimeType) {
70043
70258
  ` + ` RHEL/CentOS: sudo yum install ImageMagick`);
70044
70259
  } catch (error92) {
70045
70260
  try {
70046
- if (existsSync67(outputPath)) {
70261
+ if (existsSync68(outputPath)) {
70047
70262
  unlinkSync9(outputPath);
70048
70263
  }
70049
70264
  } catch {}
@@ -70057,11 +70272,11 @@ function convertImageToJpeg(inputPath, mimeType) {
70057
70272
  function cleanupConvertedImage(filePath) {
70058
70273
  try {
70059
70274
  const tempDirectory = dirname20(filePath);
70060
- if (existsSync67(filePath)) {
70275
+ if (existsSync68(filePath)) {
70061
70276
  unlinkSync9(filePath);
70062
70277
  log(`[image-converter] Cleaned up temporary file: ${filePath}`);
70063
70278
  }
70064
- if (existsSync67(tempDirectory)) {
70279
+ if (existsSync68(tempDirectory)) {
70065
70280
  rmSync3(tempDirectory, { recursive: true, force: true });
70066
70281
  log(`[image-converter] Cleaned up temporary directory: ${tempDirectory}`);
70067
70282
  }
@@ -70070,25 +70285,25 @@ function cleanupConvertedImage(filePath) {
70070
70285
  }
70071
70286
  }
70072
70287
  function convertBase64ImageToJpeg(base64Data, mimeType) {
70073
- const tempDir = mkdtempSync(join73(tmpdir6(), "opencode-b64-"));
70288
+ const tempDir = mkdtempSync(join74(tmpdir6(), "opencode-b64-"));
70074
70289
  const inputExt = mimeType.split("/")[1] || "bin";
70075
- const inputPath = join73(tempDir, `input.${inputExt}`);
70290
+ const inputPath = join74(tempDir, `input.${inputExt}`);
70076
70291
  const tempFiles = [inputPath];
70077
70292
  try {
70078
70293
  const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
70079
70294
  const buffer = Buffer.from(cleanBase64, "base64");
70080
- writeFileSync19(inputPath, buffer);
70295
+ writeFileSync20(inputPath, buffer);
70081
70296
  log(`[image-converter] Converting Base64 ${mimeType} to JPEG`);
70082
70297
  const outputPath = convertImageToJpeg(inputPath, mimeType);
70083
70298
  tempFiles.push(outputPath);
70084
- const convertedBuffer = readFileSync46(outputPath);
70299
+ const convertedBuffer = readFileSync47(outputPath);
70085
70300
  const convertedBase64 = convertedBuffer.toString("base64");
70086
70301
  log(`[image-converter] Base64 conversion successful`);
70087
70302
  return { base64: convertedBase64, tempFiles };
70088
70303
  } catch (error92) {
70089
70304
  tempFiles.forEach((file3) => {
70090
70305
  try {
70091
- if (existsSync67(file3))
70306
+ if (existsSync68(file3))
70092
70307
  unlinkSync9(file3);
70093
70308
  } catch {}
70094
70309
  });
@@ -71983,7 +72198,7 @@ function createDelegateTask(options) {
71983
72198
  // src/tools/delegate-task/index.ts
71984
72199
  init_constants();
71985
72200
  // src/tools/task/task-create.ts
71986
- import { join as join75 } from "path";
72201
+ import { join as join76 } from "path";
71987
72202
 
71988
72203
  // src/tools/task/types.ts
71989
72204
  var TaskStatusSchema = exports_external.enum(["pending", "in_progress", "completed", "deleted"]);
@@ -72037,18 +72252,18 @@ var TaskDeleteInputSchema = exports_external.object({
72037
72252
  });
72038
72253
 
72039
72254
  // src/features/claude-tasks/storage.ts
72040
- import { join as join74, dirname as dirname21, basename as basename9, isAbsolute as isAbsolute8 } from "path";
72041
- import { existsSync as existsSync68, mkdirSync as mkdirSync14, readFileSync as readFileSync47, writeFileSync as writeFileSync20, renameSync, unlinkSync as unlinkSync10, readdirSync as readdirSync19 } from "fs";
72255
+ import { join as join75, dirname as dirname21, basename as basename9, isAbsolute as isAbsolute8 } from "path";
72256
+ import { existsSync as existsSync69, mkdirSync as mkdirSync14, readFileSync as readFileSync48, writeFileSync as writeFileSync21, renameSync, unlinkSync as unlinkSync10, readdirSync as readdirSync19 } from "fs";
72042
72257
  import { randomUUID as randomUUID2 } from "crypto";
72043
72258
  function getTaskDir(config4 = {}) {
72044
72259
  const tasksConfig = config4.sisyphus?.tasks;
72045
72260
  const storagePath = tasksConfig?.storage_path;
72046
72261
  if (storagePath) {
72047
- return isAbsolute8(storagePath) ? storagePath : join74(process.cwd(), storagePath);
72262
+ return isAbsolute8(storagePath) ? storagePath : join75(process.cwd(), storagePath);
72048
72263
  }
72049
72264
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
72050
72265
  const listId = resolveTaskListId(config4);
72051
- return join74(configDir, "tasks", listId);
72266
+ return join75(configDir, "tasks", listId);
72052
72267
  }
72053
72268
  function sanitizePathSegment(value) {
72054
72269
  return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
@@ -72066,16 +72281,16 @@ function resolveTaskListId(config4 = {}) {
72066
72281
  return sanitizePathSegment(basename9(process.cwd()));
72067
72282
  }
72068
72283
  function ensureDir(dirPath) {
72069
- if (!existsSync68(dirPath)) {
72284
+ if (!existsSync69(dirPath)) {
72070
72285
  mkdirSync14(dirPath, { recursive: true });
72071
72286
  }
72072
72287
  }
72073
72288
  function readJsonSafe(filePath, schema2) {
72074
72289
  try {
72075
- if (!existsSync68(filePath)) {
72290
+ if (!existsSync69(filePath)) {
72076
72291
  return null;
72077
72292
  }
72078
- const content = readFileSync47(filePath, "utf-8");
72293
+ const content = readFileSync48(filePath, "utf-8");
72079
72294
  const parsed = JSON.parse(content);
72080
72295
  const result = schema2.safeParse(parsed);
72081
72296
  if (!result.success) {
@@ -72091,11 +72306,11 @@ function writeJsonAtomic(filePath, data) {
72091
72306
  ensureDir(dir);
72092
72307
  const tempPath = `${filePath}.tmp.${Date.now()}`;
72093
72308
  try {
72094
- writeFileSync20(tempPath, JSON.stringify(data, null, 2), "utf-8");
72309
+ writeFileSync21(tempPath, JSON.stringify(data, null, 2), "utf-8");
72095
72310
  renameSync(tempPath, filePath);
72096
72311
  } catch (error92) {
72097
72312
  try {
72098
- if (existsSync68(tempPath)) {
72313
+ if (existsSync69(tempPath)) {
72099
72314
  unlinkSync10(tempPath);
72100
72315
  }
72101
72316
  } catch {}
@@ -72107,17 +72322,17 @@ function generateTaskId() {
72107
72322
  return `T-${randomUUID2()}`;
72108
72323
  }
72109
72324
  function acquireLock(dirPath) {
72110
- const lockPath = join74(dirPath, ".lock");
72325
+ const lockPath = join75(dirPath, ".lock");
72111
72326
  const lockId = randomUUID2();
72112
72327
  const createLock = (timestamp2) => {
72113
- writeFileSync20(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
72328
+ writeFileSync21(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
72114
72329
  encoding: "utf-8",
72115
72330
  flag: "wx"
72116
72331
  });
72117
72332
  };
72118
72333
  const isStale = () => {
72119
72334
  try {
72120
- const lockContent = readFileSync47(lockPath, "utf-8");
72335
+ const lockContent = readFileSync48(lockPath, "utf-8");
72121
72336
  const lockData = JSON.parse(lockContent);
72122
72337
  const lockAge = Date.now() - lockData.timestamp;
72123
72338
  return lockAge > STALE_LOCK_THRESHOLD_MS;
@@ -72155,9 +72370,9 @@ function acquireLock(dirPath) {
72155
72370
  acquired: true,
72156
72371
  release: () => {
72157
72372
  try {
72158
- if (!existsSync68(lockPath))
72373
+ if (!existsSync69(lockPath))
72159
72374
  return;
72160
- const lockContent = readFileSync47(lockPath, "utf-8");
72375
+ const lockContent = readFileSync48(lockPath, "utf-8");
72161
72376
  const lockData = JSON.parse(lockContent);
72162
72377
  if (lockData.id !== lockId)
72163
72378
  return;
@@ -72320,7 +72535,7 @@ async function handleCreate(args, config4, ctx, context) {
72320
72535
  threadID: context.sessionID
72321
72536
  };
72322
72537
  const validatedTask = TaskObjectSchema.parse(task);
72323
- writeJsonAtomic(join75(taskDir, `${taskId}.json`), validatedTask);
72538
+ writeJsonAtomic(join76(taskDir, `${taskId}.json`), validatedTask);
72324
72539
  await syncTaskTodoUpdate(ctx, validatedTask, context.sessionID);
72325
72540
  return JSON.stringify({
72326
72541
  task: {
@@ -72342,7 +72557,7 @@ async function handleCreate(args, config4, ctx, context) {
72342
72557
  }
72343
72558
  }
72344
72559
  // src/tools/task/task-get.ts
72345
- import { join as join76 } from "path";
72560
+ import { join as join77 } from "path";
72346
72561
  var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
72347
72562
  function parseTaskId(id) {
72348
72563
  if (!TASK_ID_PATTERN.test(id))
@@ -72367,7 +72582,7 @@ Returns null if the task does not exist or the file is invalid.`,
72367
72582
  return JSON.stringify({ error: "invalid_task_id" });
72368
72583
  }
72369
72584
  const taskDir = getTaskDir(config4);
72370
- const taskPath = join76(taskDir, `${taskId}.json`);
72585
+ const taskPath = join77(taskDir, `${taskId}.json`);
72371
72586
  const task = readJsonSafe(taskPath, TaskObjectSchema);
72372
72587
  return JSON.stringify({ task: task ?? null });
72373
72588
  } catch (error92) {
@@ -72380,8 +72595,8 @@ Returns null if the task does not exist or the file is invalid.`,
72380
72595
  });
72381
72596
  }
72382
72597
  // src/tools/task/task-list.ts
72383
- import { join as join77 } from "path";
72384
- import { existsSync as existsSync69, readdirSync as readdirSync20 } from "fs";
72598
+ import { join as join78 } from "path";
72599
+ import { existsSync as existsSync70, readdirSync as readdirSync20 } from "fs";
72385
72600
  function createTaskList(config4) {
72386
72601
  return tool({
72387
72602
  description: `List all active tasks with summary information.
@@ -72392,7 +72607,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
72392
72607
  args: {},
72393
72608
  execute: async () => {
72394
72609
  const taskDir = getTaskDir(config4);
72395
- if (!existsSync69(taskDir)) {
72610
+ if (!existsSync70(taskDir)) {
72396
72611
  return JSON.stringify({ tasks: [] });
72397
72612
  }
72398
72613
  const files = readdirSync20(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
@@ -72401,7 +72616,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
72401
72616
  }
72402
72617
  const allTasks = [];
72403
72618
  for (const fileId of files) {
72404
- const task = readJsonSafe(join77(taskDir, `${fileId}.json`), TaskObjectSchema);
72619
+ const task = readJsonSafe(join78(taskDir, `${fileId}.json`), TaskObjectSchema);
72405
72620
  if (task) {
72406
72621
  allTasks.push(task);
72407
72622
  }
@@ -72428,7 +72643,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
72428
72643
  });
72429
72644
  }
72430
72645
  // src/tools/task/task-update.ts
72431
- import { join as join78 } from "path";
72646
+ import { join as join79 } from "path";
72432
72647
  var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
72433
72648
  function parseTaskId2(id) {
72434
72649
  if (!TASK_ID_PATTERN2.test(id))
@@ -72476,7 +72691,7 @@ async function handleUpdate(args, config4, ctx, context) {
72476
72691
  return JSON.stringify({ error: "task_lock_unavailable" });
72477
72692
  }
72478
72693
  try {
72479
- const taskPath = join78(taskDir, `${taskId}.json`);
72694
+ const taskPath = join79(taskDir, `${taskId}.json`);
72480
72695
  const task = readJsonSafe(taskPath, TaskObjectSchema);
72481
72696
  if (!task) {
72482
72697
  return JSON.stringify({ error: "task_not_found" });
@@ -73266,16 +73481,16 @@ class Diff {
73266
73481
  }
73267
73482
  }
73268
73483
  }
73269
- addToPath(path11, added, removed, oldPosInc, options) {
73270
- const last = path11.lastComponent;
73484
+ addToPath(path12, added, removed, oldPosInc, options) {
73485
+ const last = path12.lastComponent;
73271
73486
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
73272
73487
  return {
73273
- oldPos: path11.oldPos + oldPosInc,
73488
+ oldPos: path12.oldPos + oldPosInc,
73274
73489
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
73275
73490
  };
73276
73491
  } else {
73277
73492
  return {
73278
- oldPos: path11.oldPos + oldPosInc,
73493
+ oldPos: path12.oldPos + oldPosInc,
73279
73494
  lastComponent: { count: 1, added, removed, previousComponent: last }
73280
73495
  };
73281
73496
  }
@@ -74362,8 +74577,8 @@ function createUnstableAgentBabysitter(args) {
74362
74577
  directory: ctx.directory,
74363
74578
  client: {
74364
74579
  session: {
74365
- messages: async ({ path: path11 }) => {
74366
- const result = await ctx.client.session.messages({ path: path11 });
74580
+ messages: async ({ path: path12 }) => {
74581
+ const result = await ctx.client.session.messages({ path: path12 });
74367
74582
  if (Array.isArray(result))
74368
74583
  return result;
74369
74584
  if (typeof result === "object" && result !== null) {
@@ -74686,7 +74901,7 @@ function formatDuration3(start, end) {
74686
74901
  }
74687
74902
 
74688
74903
  // src/features/background-agent/error-classifier.ts
74689
- function isRecord4(value) {
74904
+ function isRecord5(value) {
74690
74905
  return typeof value === "object" && value !== null;
74691
74906
  }
74692
74907
  function isAbortedSessionError(error92) {
@@ -74712,7 +74927,7 @@ function getErrorText(error92) {
74712
74927
  return "";
74713
74928
  }
74714
74929
  function extractErrorName2(error92) {
74715
- if (isRecord4(error92) && typeof error92["name"] === "string")
74930
+ if (isRecord5(error92) && typeof error92["name"] === "string")
74716
74931
  return error92["name"];
74717
74932
  if (error92 instanceof Error)
74718
74933
  return error92.name;
@@ -74725,19 +74940,19 @@ function extractErrorMessage(error92) {
74725
74940
  return error92;
74726
74941
  if (error92 instanceof Error)
74727
74942
  return error92.message;
74728
- if (isRecord4(error92)) {
74943
+ if (isRecord5(error92)) {
74729
74944
  const dataRaw = error92["data"];
74730
74945
  const candidates = [
74731
74946
  error92,
74732
74947
  dataRaw,
74733
74948
  error92["error"],
74734
- isRecord4(dataRaw) ? dataRaw["error"] : undefined,
74949
+ isRecord5(dataRaw) ? dataRaw["error"] : undefined,
74735
74950
  error92["cause"]
74736
74951
  ];
74737
74952
  for (const candidate of candidates) {
74738
74953
  if (typeof candidate === "string" && candidate.length > 0)
74739
74954
  return candidate;
74740
- if (isRecord4(candidate) && typeof candidate["message"] === "string" && candidate["message"].length > 0) {
74955
+ if (isRecord5(candidate) && typeof candidate["message"] === "string" && candidate["message"].length > 0) {
74741
74956
  return candidate["message"];
74742
74957
  }
74743
74958
  }
@@ -74750,10 +74965,10 @@ function extractErrorMessage(error92) {
74750
74965
  }
74751
74966
  function getSessionErrorMessage(properties) {
74752
74967
  const errorRaw = properties["error"];
74753
- if (!isRecord4(errorRaw))
74968
+ if (!isRecord5(errorRaw))
74754
74969
  return;
74755
74970
  const dataRaw = errorRaw["data"];
74756
- if (isRecord4(dataRaw)) {
74971
+ if (isRecord5(dataRaw)) {
74757
74972
  const message2 = dataRaw["message"];
74758
74973
  if (typeof message2 === "string")
74759
74974
  return message2;
@@ -74907,8 +75122,8 @@ function unregisterManagerForCleanup(manager) {
74907
75122
  }
74908
75123
 
74909
75124
  // src/features/background-agent/compaction-aware-message-resolver.ts
74910
- import { readdirSync as readdirSync21, readFileSync as readFileSync48 } from "fs";
74911
- import { join as join79 } from "path";
75125
+ import { readdirSync as readdirSync21, readFileSync as readFileSync49 } from "fs";
75126
+ import { join as join80 } from "path";
74912
75127
  function isCompactionAgent(agent) {
74913
75128
  return agent?.trim().toLowerCase() === "compaction";
74914
75129
  }
@@ -74925,7 +75140,7 @@ function findNearestMessageExcludingCompaction(messageDir) {
74925
75140
  const files = readdirSync21(messageDir).filter((name) => name.endsWith(".json")).sort().reverse();
74926
75141
  for (const file3 of files) {
74927
75142
  try {
74928
- const content = readFileSync48(join79(messageDir, file3), "utf-8");
75143
+ const content = readFileSync49(join80(messageDir, file3), "utf-8");
74929
75144
  const parsed = JSON.parse(content);
74930
75145
  if (hasFullAgentAndModel(parsed)) {
74931
75146
  return parsed;
@@ -74936,7 +75151,7 @@ function findNearestMessageExcludingCompaction(messageDir) {
74936
75151
  }
74937
75152
  for (const file3 of files) {
74938
75153
  try {
74939
- const content = readFileSync48(join79(messageDir, file3), "utf-8");
75154
+ const content = readFileSync49(join80(messageDir, file3), "utf-8");
74940
75155
  const parsed = JSON.parse(content);
74941
75156
  if (hasPartialAgentOrModel(parsed)) {
74942
75157
  return parsed;
@@ -75025,7 +75240,7 @@ function handleSessionIdleBackgroundEvent(args) {
75025
75240
  }
75026
75241
 
75027
75242
  // src/features/background-agent/manager.ts
75028
- import { join as join80 } from "path";
75243
+ import { join as join81 } from "path";
75029
75244
 
75030
75245
  // src/features/background-agent/task-poller.ts
75031
75246
  function pruneStaleTasksAndNotifications(args) {
@@ -76071,7 +76286,7 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
76071
76286
  if (isCompactionAgent(info?.agent)) {
76072
76287
  continue;
76073
76288
  }
76074
- const normalizedTools = isRecord4(info?.tools) ? normalizePromptTools(info.tools) : undefined;
76289
+ const normalizedTools = isRecord5(info?.tools) ? normalizePromptTools(info.tools) : undefined;
76075
76290
  if (info?.agent || info?.model || info?.modelID && info?.providerID || normalizedTools) {
76076
76291
  agent = info?.agent ?? task.parentAgent;
76077
76292
  model = info?.model ?? (info?.providerID && info?.modelID ? { providerID: info.providerID, modelID: info.modelID } : undefined);
@@ -76086,7 +76301,7 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
76086
76301
  parentSessionID: task.parentSessionID
76087
76302
  });
76088
76303
  }
76089
- const messageDir = join80(MESSAGE_STORAGE, task.parentSessionID);
76304
+ const messageDir = join81(MESSAGE_STORAGE, task.parentSessionID);
76090
76305
  const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir) : null;
76091
76306
  agent = currentMessage?.agent ?? task.parentAgent;
76092
76307
  model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
@@ -80173,11 +80388,11 @@ class StreamableHTTPClientTransport {
80173
80388
  }
80174
80389
 
80175
80390
  // src/features/mcp-oauth/storage.ts
80176
- import { chmodSync as chmodSync2, existsSync as existsSync70, mkdirSync as mkdirSync15, readFileSync as readFileSync49, unlinkSync as unlinkSync11, writeFileSync as writeFileSync21 } from "fs";
80177
- import { dirname as dirname22, join as join81 } from "path";
80391
+ import { chmodSync as chmodSync2, existsSync as existsSync71, mkdirSync as mkdirSync15, readFileSync as readFileSync50, unlinkSync as unlinkSync11, writeFileSync as writeFileSync22 } from "fs";
80392
+ import { dirname as dirname22, join as join82 } from "path";
80178
80393
  var STORAGE_FILE_NAME = "mcp-oauth.json";
80179
80394
  function getMcpOauthStoragePath() {
80180
- return join81(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
80395
+ return join82(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
80181
80396
  }
80182
80397
  function normalizeHost(serverHost) {
80183
80398
  let host = serverHost.trim();
@@ -80214,11 +80429,11 @@ function buildKey(serverHost, resource) {
80214
80429
  }
80215
80430
  function readStore() {
80216
80431
  const filePath = getMcpOauthStoragePath();
80217
- if (!existsSync70(filePath)) {
80432
+ if (!existsSync71(filePath)) {
80218
80433
  return null;
80219
80434
  }
80220
80435
  try {
80221
- const content = readFileSync49(filePath, "utf-8");
80436
+ const content = readFileSync50(filePath, "utf-8");
80222
80437
  return JSON.parse(content);
80223
80438
  } catch {
80224
80439
  return null;
@@ -80228,10 +80443,10 @@ function writeStore(store2) {
80228
80443
  const filePath = getMcpOauthStoragePath();
80229
80444
  try {
80230
80445
  const dir = dirname22(filePath);
80231
- if (!existsSync70(dir)) {
80446
+ if (!existsSync71(dir)) {
80232
80447
  mkdirSync15(dir, { recursive: true });
80233
80448
  }
80234
- writeFileSync21(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
80449
+ writeFileSync22(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
80235
80450
  chmodSync2(filePath, 384);
80236
80451
  return true;
80237
80452
  } catch {
@@ -80380,7 +80595,7 @@ async function getOrRegisterClient(options) {
80380
80595
  }
80381
80596
  }
80382
80597
  function parseRegistrationResponse(data) {
80383
- if (!isRecord5(data))
80598
+ if (!isRecord6(data))
80384
80599
  return null;
80385
80600
  const clientId = data.client_id;
80386
80601
  if (typeof clientId !== "string" || clientId.length === 0)
@@ -80391,7 +80606,7 @@ function parseRegistrationResponse(data) {
80391
80606
  }
80392
80607
  return { clientId };
80393
80608
  }
80394
- function isRecord5(value) {
80609
+ function isRecord6(value) {
80395
80610
  return typeof value === "object" && value !== null;
80396
80611
  }
80397
80612
 
@@ -83380,8 +83595,69 @@ ${buildGeminiVerificationOverride()}
83380
83595
  }
83381
83596
  createSisyphusAgent.mode = MODE;
83382
83597
 
83598
+ // src/agents/master.ts
83599
+ var MODE2 = "primary";
83600
+ var MASTER_PROMPT_METADATA = {
83601
+ category: "advisor",
83602
+ cost: "EXPENSIVE",
83603
+ promptAlias: "Master",
83604
+ triggers: [],
83605
+ keyTrigger: "Architectural brainstorming or high-level strategic planning needed."
83606
+ };
83607
+ function createMasterAgent(model) {
83608
+ const prompt = `
83609
+ <Role>
83610
+ You are "Master" (YGKA - Your Genius, Knowledgeable assistant) - The Strategic Architect and Brilliant Brainstormer of OhMyOpenCode.
83611
+
83612
+ **Identity**: You are a world-class software architect and technical lead. Your goal is to help the user refine their ideas, design robust systems, and create high-level implementation plans BEFORE any code is written.
83613
+
83614
+ **Core Philosophy**: Brainstorm first, implement later. You are the "Thinker" that precedes the "Doer".
83615
+ </Role>
83616
+
83617
+ <Behavior_Instructions>
83618
+ 1. **Brainstorm & Consult**: When the user has an idea, discuss it deeply. Explore edge cases, trade-offs, and architectural patterns.
83619
+ 2. **Do NOT Implement**: You do not have implementation tools like file editors. Your job is to plan, not to code.
83620
+ 3. **Handoff Protocol (CRITICAL)**:
83621
+ - Your primary goal is to reach a consensus on a "Plan".
83622
+ - When the user indicates they are ready to proceed (e.g., "executed plan", "do it", "start implementation"), you MUST delegate the execution to Sisyphus.
83623
+ - Use the \`task\` tool with \`subagent_type="sisyphus"\`.
83624
+ - **Mandatory Handoff Content**: Your delegation prompt MUST contain the full summary of the discussion and the finalized implementation plan.
83625
+
83626
+ Example Handoff:
83627
+ \`\`\`typescript
83628
+ task(
83629
+ subagent_type="sisyphus",
83630
+ description="Implement the architecture we discussed",
83631
+ prompt="Based on my discussion with the user about [Feature X], here is the finalized plan: [Step 1, Step 2, Step 3]. Please execute this plan following the codebase's existing patterns."
83632
+ )
83633
+ \`\`\`
83634
+
83635
+ 4. **Tone**: Helpful, visionary, yet pragmatic. You are the user's peer in high-level technical discussion.
83636
+ </Behavior_Instructions>
83637
+
83638
+ <Constraints>
83639
+ - Never attempt to edit files directly.
83640
+ - Always use Sisyphus for implementation tasks.
83641
+ </Constraints>
83642
+ `.trim();
83643
+ return {
83644
+ description: "Your Genius, Knowledgeable assistant. Strategic architect for brainstorming and planning. Handoffs to Sisyphus for execution via 'executed plan'. (Master - YGKA)",
83645
+ mode: MODE2,
83646
+ model,
83647
+ maxTokens: 64000,
83648
+ prompt,
83649
+ color: "#FFD700",
83650
+ permission: {
83651
+ edit: "deny",
83652
+ bash: "deny"
83653
+ },
83654
+ thinking: { type: "enabled", budgetTokens: 32000 }
83655
+ };
83656
+ }
83657
+ createMasterAgent.mode = MODE2;
83658
+
83383
83659
  // src/agents/oracle.ts
83384
- var MODE2 = "subagent";
83660
+ var MODE3 = "subagent";
83385
83661
  var ORACLE_PROMPT_METADATA = {
83386
83662
  category: "advisor",
83387
83663
  cost: "EXPENSIVE",
@@ -83526,7 +83802,7 @@ function createOracleAgent(model) {
83526
83802
  ]);
83527
83803
  const base = {
83528
83804
  description: "Read-only consultation agent. High-IQ reasoning specialist for debugging hard problems and high-difficulty architecture design. (Oracle - OhMyOpenCode)",
83529
- mode: MODE2,
83805
+ mode: MODE3,
83530
83806
  model,
83531
83807
  temperature: 0.1,
83532
83808
  ...restrictions,
@@ -83537,10 +83813,10 @@ function createOracleAgent(model) {
83537
83813
  }
83538
83814
  return { ...base, thinking: { type: "enabled", budgetTokens: 32000 } };
83539
83815
  }
83540
- createOracleAgent.mode = MODE2;
83816
+ createOracleAgent.mode = MODE3;
83541
83817
 
83542
83818
  // src/agents/librarian.ts
83543
- var MODE3 = "subagent";
83819
+ var MODE4 = "subagent";
83544
83820
  var LIBRARIAN_PROMPT_METADATA = {
83545
83821
  category: "exploration",
83546
83822
  cost: "CHEAP",
@@ -83567,7 +83843,7 @@ function createLibrarianAgent(model) {
83567
83843
  ]);
83568
83844
  return {
83569
83845
  description: "Specialized codebase understanding agent for multi-repository analysis, searching remote codebases, retrieving official documentation, and finding implementation examples using GitHub CLI, Context7, and Web Search. MUST BE USED when users ask to look up code in remote repositories, explain library internals, or find usage examples in open source. (Librarian - OhMyOpenCode)",
83570
- mode: MODE3,
83846
+ mode: MODE4,
83571
83847
  model,
83572
83848
  temperature: 0.1,
83573
83849
  ...restrictions,
@@ -83851,10 +84127,10 @@ grep_app_searchGitHub(query: "useQuery")
83851
84127
  `
83852
84128
  };
83853
84129
  }
83854
- createLibrarianAgent.mode = MODE3;
84130
+ createLibrarianAgent.mode = MODE4;
83855
84131
 
83856
84132
  // src/agents/explore.ts
83857
- var MODE4 = "subagent";
84133
+ var MODE5 = "subagent";
83858
84134
  var EXPLORE_PROMPT_METADATA = {
83859
84135
  category: "exploration",
83860
84136
  cost: "FREE",
@@ -83884,7 +84160,7 @@ function createExploreAgent(model) {
83884
84160
  ]);
83885
84161
  return {
83886
84162
  description: 'Contextual grep for codebases. Answers "Where is X?", "Which file has Y?", "Find the code that does Z". Fire multiple in parallel for broad searches. Specify thoroughness: "quick" for basic, "medium" for moderate, "very thorough" for comprehensive analysis. (Explore - OhMyOpenCode)',
83887
- mode: MODE4,
84163
+ mode: MODE5,
83888
84164
  model,
83889
84165
  temperature: 0.1,
83890
84166
  ...restrictions,
@@ -83967,10 +84243,10 @@ Use the right tool for the job:
83967
84243
  Flood with parallel calls. Cross-validate findings across multiple tools.`
83968
84244
  };
83969
84245
  }
83970
- createExploreAgent.mode = MODE4;
84246
+ createExploreAgent.mode = MODE5;
83971
84247
 
83972
84248
  // src/agents/multimodal-looker.ts
83973
- var MODE5 = "subagent";
84249
+ var MODE6 = "subagent";
83974
84250
  var MULTIMODAL_LOOKER_PROMPT_METADATA = {
83975
84251
  category: "utility",
83976
84252
  cost: "CHEAP",
@@ -83981,7 +84257,7 @@ function createMultimodalLookerAgent(model) {
83981
84257
  const restrictions = createAgentToolAllowlist(["read"]);
83982
84258
  return {
83983
84259
  description: "Analyze media files (PDFs, images, diagrams) that require interpretation beyond raw text. Extracts specific information or summaries from documents, describes visual content. Use when you need analyzed/extracted data rather than literal file contents. (Multimodal-Looker - OhMyOpenCode)",
83984
- mode: MODE5,
84260
+ mode: MODE6,
83985
84261
  model,
83986
84262
  temperature: 0.1,
83987
84263
  ...restrictions,
@@ -84019,10 +84295,10 @@ Response rules:
84019
84295
  Your output goes straight to the main agent for continued work.`
84020
84296
  };
84021
84297
  }
84022
- createMultimodalLookerAgent.mode = MODE5;
84298
+ createMultimodalLookerAgent.mode = MODE6;
84023
84299
 
84024
84300
  // src/agents/metis.ts
84025
- var MODE6 = "subagent";
84301
+ var MODE7 = "subagent";
84026
84302
  var METIS_SYSTEM_PROMPT = `# Metis - Pre-Planning Consultant
84027
84303
 
84028
84304
  ## CONSTRAINTS
@@ -84310,7 +84586,7 @@ var metisRestrictions = createAgentToolRestrictions([
84310
84586
  function createMetisAgent(model) {
84311
84587
  return {
84312
84588
  description: "Pre-planning consultant that analyzes requests to identify hidden intentions, ambiguities, and AI failure points. (Metis - OhMyOpenCode)",
84313
- mode: MODE6,
84589
+ mode: MODE7,
84314
84590
  model,
84315
84591
  temperature: 0.3,
84316
84592
  ...metisRestrictions,
@@ -84318,7 +84594,7 @@ function createMetisAgent(model) {
84318
84594
  thinking: { type: "enabled", budgetTokens: 32000 }
84319
84595
  };
84320
84596
  }
84321
- createMetisAgent.mode = MODE6;
84597
+ createMetisAgent.mode = MODE7;
84322
84598
  var metisPromptMetadata = {
84323
84599
  category: "advisor",
84324
84600
  cost: "EXPENSIVE",
@@ -85566,7 +85842,7 @@ ${agentRows.join(`
85566
85842
  }
85567
85843
 
85568
85844
  // src/agents/atlas/agent.ts
85569
- var MODE7 = "all";
85845
+ var MODE8 = "all";
85570
85846
  function getAtlasPromptSource(model) {
85571
85847
  if (model && isGptModel(model)) {
85572
85848
  return "gpt";
@@ -85609,7 +85885,7 @@ function buildDynamicOrchestratorPrompt(ctx) {
85609
85885
  function createAtlasAgent(ctx) {
85610
85886
  const baseConfig = {
85611
85887
  description: "Orchestrates work via task() to complete ALL tasks in a todo list until fully done. (Atlas - OhMyOpenCode)",
85612
- mode: MODE7,
85888
+ mode: MODE8,
85613
85889
  ...ctx.model ? { model: ctx.model } : {},
85614
85890
  temperature: 0.1,
85615
85891
  prompt: buildDynamicOrchestratorPrompt(ctx),
@@ -85617,7 +85893,7 @@ function createAtlasAgent(ctx) {
85617
85893
  };
85618
85894
  return baseConfig;
85619
85895
  }
85620
- createAtlasAgent.mode = MODE7;
85896
+ createAtlasAgent.mode = MODE8;
85621
85897
  var atlasPromptMetadata = {
85622
85898
  category: "advisor",
85623
85899
  cost: "EXPENSIVE",
@@ -85645,7 +85921,7 @@ var atlasPromptMetadata = {
85645
85921
  keyTrigger: "Todo list path provided OR multiple tasks requiring multi-agent orchestration"
85646
85922
  };
85647
85923
  // src/agents/momus.ts
85648
- var MODE8 = "subagent";
85924
+ var MODE9 = "subagent";
85649
85925
  var MOMUS_SYSTEM_PROMPT = `You are a **practical** work plan reviewer. Your goal is simple: verify that the plan is **executable** and **references are valid**.
85650
85926
 
85651
85927
  **CRITICAL FIRST RULE**:
@@ -85823,7 +86099,7 @@ function createMomusAgent(model) {
85823
86099
  ]);
85824
86100
  const base = {
85825
86101
  description: "Expert reviewer for evaluating work plans against rigorous clarity, verifiability, and completeness standards. (Momus - OhMyOpenCode)",
85826
- mode: MODE8,
86102
+ mode: MODE9,
85827
86103
  model,
85828
86104
  temperature: 0.1,
85829
86105
  ...restrictions,
@@ -85834,7 +86110,7 @@ function createMomusAgent(model) {
85834
86110
  }
85835
86111
  return { ...base, thinking: { type: "enabled", budgetTokens: 32000 } };
85836
86112
  }
85837
- createMomusAgent.mode = MODE8;
86113
+ createMomusAgent.mode = MODE9;
85838
86114
  var momusPromptMetadata = {
85839
86115
  category: "advisor",
85840
86116
  cost: "EXPENSIVE",
@@ -85864,7 +86140,7 @@ var momusPromptMetadata = {
85864
86140
  };
85865
86141
 
85866
86142
  // src/agents/hephaestus.ts
85867
- var MODE9 = "all";
86143
+ var MODE10 = "all";
85868
86144
  function buildTodoDisciplineSection(useTaskSystem) {
85869
86145
  if (useTaskSystem) {
85870
86146
  return `## Task Discipline (NON-NEGOTIABLE)
@@ -86315,7 +86591,7 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
86315
86591
  const prompt = availableAgents ? buildHephaestusPrompt(availableAgents, tools, skills2, categories2, useTaskSystem) : buildHephaestusPrompt([], tools, skills2, categories2, useTaskSystem);
86316
86592
  return {
86317
86593
  description: "Autonomous Deep Worker - goal-oriented execution with GPT 5.2 Codex. Explores thoroughly before acting, uses explore/librarian agents for comprehensive context, completes tasks end-to-end. Inspired by AmpCode deep mode. (Hephaestus - OhMyOpenCode)",
86318
- mode: MODE9,
86594
+ mode: MODE10,
86319
86595
  model,
86320
86596
  maxTokens: 32000,
86321
86597
  prompt,
@@ -86327,7 +86603,7 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
86327
86603
  reasoningEffort: "medium"
86328
86604
  };
86329
86605
  }
86330
- createHephaestusAgent.mode = MODE9;
86606
+ createHephaestusAgent.mode = MODE10;
86331
86607
 
86332
86608
  // src/agents/builtin-agents.ts
86333
86609
  init_constants();
@@ -86392,8 +86668,8 @@ function buildAgent(source, model, categories2, gitMasterConfig, browserProvider
86392
86668
  }
86393
86669
 
86394
86670
  // src/agents/builtin-agents/resolve-file-uri.ts
86395
- import { existsSync as existsSync71, readFileSync as readFileSync50 } from "fs";
86396
- import { homedir as homedir14 } from "os";
86671
+ import { existsSync as existsSync72, readFileSync as readFileSync51 } from "fs";
86672
+ import { homedir as homedir15 } from "os";
86397
86673
  import { isAbsolute as isAbsolute9, resolve as resolve13 } from "path";
86398
86674
  function resolvePromptAppend(promptAppend, configDir) {
86399
86675
  if (!promptAppend.startsWith("file://"))
@@ -86402,16 +86678,16 @@ function resolvePromptAppend(promptAppend, configDir) {
86402
86678
  let filePath;
86403
86679
  try {
86404
86680
  const decoded = decodeURIComponent(encoded);
86405
- const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir14()}/`) : decoded;
86681
+ const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir15()}/`) : decoded;
86406
86682
  filePath = isAbsolute9(expanded) ? expanded : resolve13(configDir ?? process.cwd(), expanded);
86407
86683
  } catch {
86408
86684
  return `[WARNING: Malformed file URI (invalid percent-encoding): ${promptAppend}]`;
86409
86685
  }
86410
- if (!existsSync71(filePath)) {
86686
+ if (!existsSync72(filePath)) {
86411
86687
  return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
86412
86688
  }
86413
86689
  try {
86414
- return readFileSync50(filePath, "utf8");
86690
+ return readFileSync51(filePath, "utf8");
86415
86691
  } catch {
86416
86692
  return `[WARNING: Could not read file: ${promptAppend}]`;
86417
86693
  }
@@ -86577,8 +86853,10 @@ function collectPendingBuiltinAgents(input) {
86577
86853
  }
86578
86854
 
86579
86855
  // src/agents/builtin-agents/sisyphus-agent.ts
86580
- function maybeCreateSisyphusConfig(input) {
86856
+ function maybeCreatePrimaryAgentConfig(input) {
86581
86857
  const {
86858
+ agentName,
86859
+ factory,
86582
86860
  disabledAgents,
86583
86861
  agentOverrides,
86584
86862
  uiSelectedModel,
@@ -86593,34 +86871,39 @@ function maybeCreateSisyphusConfig(input) {
86593
86871
  useTaskSystem,
86594
86872
  disableOmoEnv = false
86595
86873
  } = input;
86596
- const sisyphusOverride = agentOverrides["sisyphus"];
86597
- const sisyphusRequirement = AGENT_MODEL_REQUIREMENTS["sisyphus"];
86598
- const hasSisyphusExplicitConfig = sisyphusOverride !== undefined;
86599
- const meetsSisyphusAnyModelRequirement = !sisyphusRequirement?.requiresAnyModel || hasSisyphusExplicitConfig || isFirstRunNoCache || isAnyFallbackModelAvailable(sisyphusRequirement.fallbackChain, availableModels);
86600
- if (disabledAgents.includes("sisyphus") || !meetsSisyphusAnyModelRequirement)
86874
+ const override = agentOverrides[agentName];
86875
+ const requirement = AGENT_MODEL_REQUIREMENTS[agentName];
86876
+ const hasExplicitConfig = override !== undefined;
86877
+ const meetsAnyModelRequirement = !requirement?.requiresAnyModel || hasExplicitConfig || isFirstRunNoCache || isAnyFallbackModelAvailable(requirement.fallbackChain, availableModels);
86878
+ if (disabledAgents.includes(agentName) || !meetsAnyModelRequirement)
86601
86879
  return;
86602
- let sisyphusResolution = applyModelResolution({
86603
- uiSelectedModel: sisyphusOverride?.model ? undefined : uiSelectedModel,
86604
- userModel: sisyphusOverride?.model,
86605
- requirement: sisyphusRequirement,
86880
+ let resolution = applyModelResolution({
86881
+ uiSelectedModel: override?.model ? undefined : uiSelectedModel,
86882
+ userModel: override?.model,
86883
+ requirement,
86606
86884
  availableModels,
86607
86885
  systemDefaultModel
86608
86886
  });
86609
- if (isFirstRunNoCache && !sisyphusOverride?.model && !uiSelectedModel) {
86610
- sisyphusResolution = getFirstFallbackModel(sisyphusRequirement);
86887
+ if (isFirstRunNoCache && !override?.model && !uiSelectedModel) {
86888
+ resolution = getFirstFallbackModel(requirement);
86611
86889
  }
86612
- if (!sisyphusResolution)
86890
+ if (!resolution)
86613
86891
  return;
86614
- const { model: sisyphusModel, variant: sisyphusResolvedVariant } = sisyphusResolution;
86615
- let sisyphusConfig = createSisyphusAgent(sisyphusModel, availableAgents, undefined, availableSkills, availableCategories, useTaskSystem);
86616
- if (sisyphusResolvedVariant) {
86617
- sisyphusConfig = { ...sisyphusConfig, variant: sisyphusResolvedVariant };
86892
+ const { model, variant: resolvedVariant } = resolution;
86893
+ let config4;
86894
+ if (agentName === "sisyphus") {
86895
+ config4 = factory(model, availableAgents, undefined, availableSkills, availableCategories, useTaskSystem);
86896
+ } else {
86897
+ config4 = factory(model);
86898
+ }
86899
+ if (resolvedVariant) {
86900
+ config4 = { ...config4, variant: resolvedVariant };
86618
86901
  }
86619
- sisyphusConfig = applyOverrides(sisyphusConfig, sisyphusOverride, mergedCategories, directory);
86620
- sisyphusConfig = applyEnvironmentContext(sisyphusConfig, directory, {
86902
+ config4 = applyOverrides(config4, override, mergedCategories, directory);
86903
+ config4 = applyEnvironmentContext(config4, directory, {
86621
86904
  disableOmoEnv
86622
86905
  });
86623
- return sisyphusConfig;
86906
+ return config4;
86624
86907
  }
86625
86908
 
86626
86909
  // src/agents/builtin-agents/hephaestus-agent.ts
@@ -86717,7 +87000,7 @@ function maybeCreateAtlasConfig(input) {
86717
87000
  function sanitizeMarkdownTableCell(value) {
86718
87001
  return value.replace(/\r?\n/g, " ").replace(/\|/g, "\\|").replace(/\s+/g, " ").trim();
86719
87002
  }
86720
- function isRecord6(value) {
87003
+ function isRecord7(value) {
86721
87004
  return typeof value === "object" && value !== null;
86722
87005
  }
86723
87006
  function parseRegisteredAgentSummaries(input) {
@@ -86725,7 +87008,7 @@ function parseRegisteredAgentSummaries(input) {
86725
87008
  return [];
86726
87009
  const result = [];
86727
87010
  for (const item of input) {
86728
- if (!isRecord6(item))
87011
+ if (!isRecord7(item))
86729
87012
  continue;
86730
87013
  const name = typeof item.name === "string" ? item.name : undefined;
86731
87014
  if (!name)
@@ -86761,6 +87044,7 @@ function buildCustomAgentMetadata(agentName, description) {
86761
87044
 
86762
87045
  // src/agents/builtin-agents.ts
86763
87046
  var agentSources = {
87047
+ master: createMasterAgent,
86764
87048
  sisyphus: createSisyphusAgent,
86765
87049
  hephaestus: createHephaestusAgent,
86766
87050
  oracle: createOracleAgent,
@@ -86772,6 +87056,7 @@ var agentSources = {
86772
87056
  atlas: createAtlasAgent
86773
87057
  };
86774
87058
  var agentMetadata = {
87059
+ master: MASTER_PROMPT_METADATA,
86775
87060
  oracle: ORACLE_PROMPT_METADATA,
86776
87061
  librarian: LIBRARIAN_PROMPT_METADATA,
86777
87062
  explore: EXPLORE_PROMPT_METADATA,
@@ -86827,7 +87112,30 @@ async function createBuiltinAgents(disabledAgents = [], agentOverrides = {}, dir
86827
87112
  metadata: buildCustomAgentMetadata(agent.name, agent.description)
86828
87113
  });
86829
87114
  }
86830
- const sisyphusConfig = maybeCreateSisyphusConfig({
87115
+ const masterConfig = maybeCreatePrimaryAgentConfig({
87116
+ agentName: "master",
87117
+ factory: createMasterAgent,
87118
+ disabledAgents,
87119
+ agentOverrides,
87120
+ uiSelectedModel,
87121
+ availableModels,
87122
+ systemDefaultModel,
87123
+ isFirstRunNoCache,
87124
+ availableAgents,
87125
+ availableSkills,
87126
+ availableCategories,
87127
+ mergedCategories,
87128
+ directory,
87129
+ userCategories: categories2,
87130
+ useTaskSystem,
87131
+ disableOmoEnv
87132
+ });
87133
+ if (masterConfig) {
87134
+ result["master"] = masterConfig;
87135
+ }
87136
+ const sisyphusConfig = maybeCreatePrimaryAgentConfig({
87137
+ agentName: "sisyphus",
87138
+ factory: createSisyphusAgent,
86831
87139
  disabledAgents,
86832
87140
  agentOverrides,
86833
87141
  uiSelectedModel,
@@ -87245,7 +87553,7 @@ No tasks on multi-step work = INCOMPLETE WORK. The user tracks your progress thr
87245
87553
  No todos on multi-step work = INCOMPLETE WORK. The user tracks your progress through todos.`;
87246
87554
  }
87247
87555
  // src/agents/sisyphus-junior/agent.ts
87248
- var MODE10 = "subagent";
87556
+ var MODE11 = "subagent";
87249
87557
  var BLOCKED_TOOLS3 = ["task"];
87250
87558
  var SISYPHUS_JUNIOR_DEFAULTS = {
87251
87559
  model: "anthropic/claude-sonnet-4-6",
@@ -87292,7 +87600,7 @@ function createSisyphusJuniorAgentWithOverrides(override, systemDefaultModel, us
87292
87600
  const toolsConfig = { permission: { ...merged, ...basePermission } };
87293
87601
  const base = {
87294
87602
  description: override?.description ?? "Focused task executor. Same discipline, no delegation. (Sisyphus-Junior - OhMyOpenCode)",
87295
- mode: MODE10,
87603
+ mode: MODE11,
87296
87604
  model,
87297
87605
  temperature,
87298
87606
  maxTokens: 64000,
@@ -87311,7 +87619,7 @@ function createSisyphusJuniorAgentWithOverrides(override, systemDefaultModel, us
87311
87619
  thinking: { type: "enabled", budgetTokens: 32000 }
87312
87620
  };
87313
87621
  }
87314
- createSisyphusJuniorAgentWithOverrides.mode = MODE10;
87622
+ createSisyphusJuniorAgentWithOverrides.mode = MODE11;
87315
87623
  // src/agents/builtin-agents/junior-inheritance.ts
87316
87624
  var JUNIOR_SUFFIX = "-junior";
87317
87625
  function getParentAgentName(agentName) {
@@ -87344,8 +87652,8 @@ function resolveJuniorInheritance(agentName, agentOverrides) {
87344
87652
  };
87345
87653
  }
87346
87654
  // src/features/claude-code-agent-loader/loader.ts
87347
- import { existsSync as existsSync72, readdirSync as readdirSync22, readFileSync as readFileSync51 } from "fs";
87348
- import { join as join82, basename as basename10 } from "path";
87655
+ import { existsSync as existsSync73, readdirSync as readdirSync22, readFileSync as readFileSync52 } from "fs";
87656
+ import { join as join83, basename as basename10 } from "path";
87349
87657
  function parseToolsConfig2(toolsStr) {
87350
87658
  if (!toolsStr)
87351
87659
  return;
@@ -87359,7 +87667,7 @@ function parseToolsConfig2(toolsStr) {
87359
87667
  return result;
87360
87668
  }
87361
87669
  function loadAgentsFromDir(agentsDir, scope) {
87362
- if (!existsSync72(agentsDir)) {
87670
+ if (!existsSync73(agentsDir)) {
87363
87671
  return [];
87364
87672
  }
87365
87673
  const entries = readdirSync22(agentsDir, { withFileTypes: true });
@@ -87367,10 +87675,10 @@ function loadAgentsFromDir(agentsDir, scope) {
87367
87675
  for (const entry of entries) {
87368
87676
  if (!isMarkdownFile(entry))
87369
87677
  continue;
87370
- const agentPath = join82(agentsDir, entry.name);
87678
+ const agentPath = join83(agentsDir, entry.name);
87371
87679
  const agentName = basename10(entry.name, ".md");
87372
87680
  try {
87373
- const content = readFileSync51(agentPath, "utf-8");
87681
+ const content = readFileSync52(agentPath, "utf-8");
87374
87682
  const { data, body } = parseFrontmatter(content);
87375
87683
  const name = data.name || agentName;
87376
87684
  const originalDescription = data.description || "";
@@ -87397,7 +87705,7 @@ function loadAgentsFromDir(agentsDir, scope) {
87397
87705
  return agents;
87398
87706
  }
87399
87707
  function loadUserAgents() {
87400
- const userAgentsDir = join82(getClaudeConfigDir(), "agents");
87708
+ const userAgentsDir = join83(getClaudeConfigDir(), "agents");
87401
87709
  const agents = loadAgentsFromDir(userAgentsDir, "user");
87402
87710
  const result = {};
87403
87711
  for (const agent of agents) {
@@ -87406,7 +87714,7 @@ function loadUserAgents() {
87406
87714
  return result;
87407
87715
  }
87408
87716
  function loadProjectAgents(directory) {
87409
- const projectAgentsDir = join82(directory ?? process.cwd(), ".claude", "agents");
87717
+ const projectAgentsDir = join83(directory ?? process.cwd(), ".claude", "agents");
87410
87718
  const agents = loadAgentsFromDir(projectAgentsDir, "project");
87411
87719
  const result = {};
87412
87720
  for (const agent of agents) {
@@ -89815,18 +90123,18 @@ async function applyAgentConfig(params) {
89815
90123
  return agentResult;
89816
90124
  }
89817
90125
  // src/features/claude-code-command-loader/loader.ts
89818
- import { promises as fs19 } from "fs";
89819
- import { join as join83, basename as basename11 } from "path";
90126
+ import { promises as fs20 } from "fs";
90127
+ import { join as join84, basename as basename11 } from "path";
89820
90128
  init_logger();
89821
90129
  async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix = "") {
89822
90130
  try {
89823
- await fs19.access(commandsDir);
90131
+ await fs20.access(commandsDir);
89824
90132
  } catch {
89825
90133
  return [];
89826
90134
  }
89827
90135
  let realPath;
89828
90136
  try {
89829
- realPath = await fs19.realpath(commandsDir);
90137
+ realPath = await fs20.realpath(commandsDir);
89830
90138
  } catch (error92) {
89831
90139
  log(`Failed to resolve command directory: ${commandsDir}`, error92);
89832
90140
  return [];
@@ -89837,7 +90145,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
89837
90145
  visited.add(realPath);
89838
90146
  let entries;
89839
90147
  try {
89840
- entries = await fs19.readdir(commandsDir, { withFileTypes: true });
90148
+ entries = await fs20.readdir(commandsDir, { withFileTypes: true });
89841
90149
  } catch (error92) {
89842
90150
  log(`Failed to read command directory: ${commandsDir}`, error92);
89843
90151
  return [];
@@ -89847,7 +90155,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
89847
90155
  if (entry.isDirectory()) {
89848
90156
  if (entry.name.startsWith("."))
89849
90157
  continue;
89850
- const subDirPath = join83(commandsDir, entry.name);
90158
+ const subDirPath = join84(commandsDir, entry.name);
89851
90159
  const subPrefix = prefix ? `${prefix}:${entry.name}` : entry.name;
89852
90160
  const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
89853
90161
  commands3.push(...subCommands);
@@ -89855,11 +90163,11 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
89855
90163
  }
89856
90164
  if (!isMarkdownFile(entry))
89857
90165
  continue;
89858
- const commandPath = join83(commandsDir, entry.name);
90166
+ const commandPath = join84(commandsDir, entry.name);
89859
90167
  const baseCommandName = basename11(entry.name, ".md");
89860
90168
  const commandName = prefix ? `${prefix}:${baseCommandName}` : baseCommandName;
89861
90169
  try {
89862
- const content = await fs19.readFile(commandPath, "utf-8");
90170
+ const content = await fs20.readFile(commandPath, "utf-8");
89863
90171
  const { data, body } = parseFrontmatter(content);
89864
90172
  const wrappedTemplate = `<command-instruction>
89865
90173
  ${body.trim()}
@@ -89902,23 +90210,23 @@ function commandsToRecord(commands3) {
89902
90210
  return result;
89903
90211
  }
89904
90212
  async function loadUserCommands() {
89905
- const userCommandsDir = join83(getClaudeConfigDir(), "commands");
90213
+ const userCommandsDir = join84(getClaudeConfigDir(), "commands");
89906
90214
  const commands3 = await loadCommandsFromDir(userCommandsDir, "user");
89907
90215
  return commandsToRecord(commands3);
89908
90216
  }
89909
90217
  async function loadProjectCommands(directory) {
89910
- const projectCommandsDir = join83(directory ?? process.cwd(), ".claude", "commands");
90218
+ const projectCommandsDir = join84(directory ?? process.cwd(), ".claude", "commands");
89911
90219
  const commands3 = await loadCommandsFromDir(projectCommandsDir, "project");
89912
90220
  return commandsToRecord(commands3);
89913
90221
  }
89914
90222
  async function loadOpencodeGlobalCommands() {
89915
90223
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
89916
- const opencodeCommandsDir = join83(configDir, "command");
90224
+ const opencodeCommandsDir = join84(configDir, "command");
89917
90225
  const commands3 = await loadCommandsFromDir(opencodeCommandsDir, "opencode");
89918
90226
  return commandsToRecord(commands3);
89919
90227
  }
89920
90228
  async function loadOpencodeProjectCommands(directory) {
89921
- const opencodeProjectDir = join83(directory ?? process.cwd(), ".opencode", "command");
90229
+ const opencodeProjectDir = join84(directory ?? process.cwd(), ".opencode", "command");
89922
90230
  const commands3 = await loadCommandsFromDir(opencodeProjectDir, "opencode-project");
89923
90231
  return commandsToRecord(commands3);
89924
90232
  }
@@ -89977,22 +90285,22 @@ function remapCommandAgentFields(commands3) {
89977
90285
  }
89978
90286
  }
89979
90287
  // src/features/claude-code-mcp-loader/loader.ts
89980
- import { existsSync as existsSync73, readFileSync as readFileSync52 } from "fs";
89981
- import { join as join84 } from "path";
89982
- import { homedir as homedir15 } from "os";
90288
+ import { existsSync as existsSync74, readFileSync as readFileSync53 } from "fs";
90289
+ import { join as join85 } from "path";
90290
+ import { homedir as homedir16 } from "os";
89983
90291
  init_logger();
89984
90292
  function getMcpConfigPaths() {
89985
90293
  const claudeConfigDir = getClaudeConfigDir();
89986
90294
  const cwd = process.cwd();
89987
90295
  return [
89988
- { path: join84(homedir15(), ".claude.json"), scope: "user" },
89989
- { path: join84(claudeConfigDir, ".mcp.json"), scope: "user" },
89990
- { path: join84(cwd, ".mcp.json"), scope: "project" },
89991
- { path: join84(cwd, ".claude", ".mcp.json"), scope: "local" }
90296
+ { path: join85(homedir16(), ".claude.json"), scope: "user" },
90297
+ { path: join85(claudeConfigDir, ".mcp.json"), scope: "user" },
90298
+ { path: join85(cwd, ".mcp.json"), scope: "project" },
90299
+ { path: join85(cwd, ".claude", ".mcp.json"), scope: "local" }
89992
90300
  ];
89993
90301
  }
89994
90302
  async function loadMcpConfigFile(filePath) {
89995
- if (!existsSync73(filePath)) {
90303
+ if (!existsSync74(filePath)) {
89996
90304
  return null;
89997
90305
  }
89998
90306
  try {
@@ -90006,11 +90314,11 @@ async function loadMcpConfigFile(filePath) {
90006
90314
  function getSystemMcpServerNames() {
90007
90315
  const names = new Set;
90008
90316
  const paths = getMcpConfigPaths();
90009
- for (const { path: path11 } of paths) {
90010
- if (!existsSync73(path11))
90317
+ for (const { path: path12 } of paths) {
90318
+ if (!existsSync74(path12))
90011
90319
  continue;
90012
90320
  try {
90013
- const content = readFileSync52(path11, "utf-8");
90321
+ const content = readFileSync53(path12, "utf-8");
90014
90322
  const config4 = JSON.parse(content);
90015
90323
  if (!config4?.mcpServers)
90016
90324
  continue;
@@ -90030,22 +90338,22 @@ async function loadMcpConfigs(disabledMcps = []) {
90030
90338
  const loadedServers = [];
90031
90339
  const paths = getMcpConfigPaths();
90032
90340
  const disabledSet = new Set(disabledMcps);
90033
- for (const { path: path11, scope } of paths) {
90034
- const config4 = await loadMcpConfigFile(path11);
90341
+ for (const { path: path12, scope } of paths) {
90342
+ const config4 = await loadMcpConfigFile(path12);
90035
90343
  if (!config4?.mcpServers)
90036
90344
  continue;
90037
90345
  for (const [name, serverConfig] of Object.entries(config4.mcpServers)) {
90038
90346
  if (disabledSet.has(name)) {
90039
- log(`Skipping MCP "${name}" (in disabled_mcps)`, { path: path11 });
90347
+ log(`Skipping MCP "${name}" (in disabled_mcps)`, { path: path12 });
90040
90348
  continue;
90041
90349
  }
90042
90350
  if (serverConfig.disabled) {
90043
- log(`Disabling MCP server "${name}"`, { path: path11 });
90351
+ log(`Disabling MCP server "${name}"`, { path: path12 });
90044
90352
  delete servers[name];
90045
90353
  const existingIndex = loadedServers.findIndex((s) => s.name === name);
90046
90354
  if (existingIndex !== -1) {
90047
90355
  loadedServers.splice(existingIndex, 1);
90048
- log(`Removed previously loaded MCP server "${name}"`, { path: path11 });
90356
+ log(`Removed previously loaded MCP server "${name}"`, { path: path12 });
90049
90357
  }
90050
90358
  continue;
90051
90359
  }
@@ -90057,7 +90365,7 @@ async function loadMcpConfigs(disabledMcps = []) {
90057
90365
  loadedServers.splice(existingIndex, 1);
90058
90366
  }
90059
90367
  loadedServers.push({ name, scope, config: transformed });
90060
- log(`Loaded MCP server "${name}" from ${scope}`, { path: path11 });
90368
+ log(`Loaded MCP server "${name}" from ${scope}`, { path: path12 });
90061
90369
  } catch (error92) {
90062
90370
  log(`Failed to transform MCP server "${name}"`, error92);
90063
90371
  }
@@ -90580,11 +90888,11 @@ async function createTools(args) {
90580
90888
  }
90581
90889
 
90582
90890
  // src/plugin/chat-params.ts
90583
- function isRecord7(value) {
90891
+ function isRecord8(value) {
90584
90892
  return typeof value === "object" && value !== null;
90585
90893
  }
90586
90894
  function buildChatParamsInput(raw) {
90587
- if (!isRecord7(raw))
90895
+ if (!isRecord8(raw))
90588
90896
  return null;
90589
90897
  const sessionID = raw.sessionID;
90590
90898
  const agent = raw.agent;
@@ -90593,16 +90901,16 @@ function buildChatParamsInput(raw) {
90593
90901
  const message = raw.message;
90594
90902
  if (typeof sessionID !== "string")
90595
90903
  return null;
90596
- if (!isRecord7(model))
90904
+ if (!isRecord8(model))
90597
90905
  return null;
90598
- if (!isRecord7(provider))
90906
+ if (!isRecord8(provider))
90599
90907
  return null;
90600
- if (!isRecord7(message))
90908
+ if (!isRecord8(message))
90601
90909
  return null;
90602
90910
  let agentName;
90603
90911
  if (typeof agent === "string") {
90604
90912
  agentName = agent;
90605
- } else if (isRecord7(agent)) {
90913
+ } else if (isRecord8(agent)) {
90606
90914
  const name = agent.name;
90607
90915
  if (typeof name === "string") {
90608
90916
  agentName = name;
@@ -90629,12 +90937,12 @@ function buildChatParamsInput(raw) {
90629
90937
  };
90630
90938
  }
90631
90939
  function isChatParamsOutput(raw) {
90632
- if (!isRecord7(raw))
90940
+ if (!isRecord8(raw))
90633
90941
  return false;
90634
- if (!isRecord7(raw.options)) {
90942
+ if (!isRecord8(raw.options)) {
90635
90943
  raw.options = {};
90636
90944
  }
90637
- return isRecord7(raw.options);
90945
+ return isRecord8(raw.options);
90638
90946
  }
90639
90947
  function createChatParamsHandler(args) {
90640
90948
  return async (input, output) => {
@@ -90650,20 +90958,20 @@ function createChatParamsHandler(args) {
90650
90958
  // src/plugin/chat-headers.ts
90651
90959
  var INTERNAL_MARKER_CACHE_LIMIT = 1000;
90652
90960
  var internalMarkerCache = new Map;
90653
- function isRecord8(value) {
90961
+ function isRecord9(value) {
90654
90962
  return typeof value === "object" && value !== null;
90655
90963
  }
90656
90964
  function buildChatHeadersInput(raw) {
90657
- if (!isRecord8(raw))
90965
+ if (!isRecord9(raw))
90658
90966
  return null;
90659
90967
  const sessionID = raw.sessionID;
90660
90968
  const provider = raw.provider;
90661
90969
  const message = raw.message;
90662
90970
  if (typeof sessionID !== "string")
90663
90971
  return null;
90664
- if (!isRecord8(provider) || typeof provider.id !== "string")
90972
+ if (!isRecord9(provider) || typeof provider.id !== "string")
90665
90973
  return null;
90666
- if (!isRecord8(message))
90974
+ if (!isRecord9(message))
90667
90975
  return null;
90668
90976
  return {
90669
90977
  sessionID,
@@ -90675,12 +90983,12 @@ function buildChatHeadersInput(raw) {
90675
90983
  };
90676
90984
  }
90677
90985
  function isChatHeadersOutput(raw) {
90678
- if (!isRecord8(raw))
90986
+ if (!isRecord9(raw))
90679
90987
  return false;
90680
- if (!isRecord8(raw.headers)) {
90988
+ if (!isRecord9(raw.headers)) {
90681
90989
  raw.headers = {};
90682
90990
  }
90683
- return isRecord8(raw.headers);
90991
+ return isRecord9(raw.headers);
90684
90992
  }
90685
90993
  function isCopilotProvider(providerID) {
90686
90994
  return providerID === "github-copilot" || providerID === "github-copilot-enterprise";
@@ -90696,7 +91004,7 @@ async function hasInternalMarker(client2, sessionID, messageID) {
90696
91004
  path: { id: sessionID, messageID }
90697
91005
  });
90698
91006
  const data = response.data;
90699
- if (!isRecord8(data) || !Array.isArray(data.parts)) {
91007
+ if (!isRecord9(data) || !Array.isArray(data.parts)) {
90700
91008
  internalMarkerCache.set(cacheKey, false);
90701
91009
  if (internalMarkerCache.size > INTERNAL_MARKER_CACHE_LIMIT) {
90702
91010
  internalMarkerCache.clear();
@@ -90704,7 +91012,7 @@ async function hasInternalMarker(client2, sessionID, messageID) {
90704
91012
  return false;
90705
91013
  }
90706
91014
  const hasMarker = data.parts.some((part) => {
90707
- if (!isRecord8(part) || part.type !== "text" || typeof part.text !== "string") {
91015
+ if (!isRecord9(part) || part.type !== "text" || typeof part.text !== "string") {
90708
91016
  return false;
90709
91017
  }
90710
91018
  return part.text.includes(OMO_INTERNAL_INITIATOR_MARKER);
@@ -90741,8 +91049,8 @@ function createChatHeadersHandler(args) {
90741
91049
  return;
90742
91050
  if (!isCopilotProvider(normalizedInput.provider.id))
90743
91051
  return;
90744
- const model = isRecord8(input) && isRecord8(input.model) ? input.model : undefined;
90745
- const api3 = model && isRecord8(model.api) ? model.api : undefined;
91052
+ const model = isRecord9(input) && isRecord9(input.model) ? input.model : undefined;
91053
+ const api3 = model && isRecord9(model.api) ? model.api : undefined;
90746
91054
  if (api3?.npm === "@ai-sdk/github-copilot")
90747
91055
  return;
90748
91056
  if (!await isOmoInternalMessage(normalizedInput, ctx.client))
@@ -90753,10 +91061,10 @@ function createChatHeadersHandler(args) {
90753
91061
 
90754
91062
  // src/plugin/ultrawork-db-model-override.ts
90755
91063
  import { Database } from "bun:sqlite";
90756
- import { join as join85 } from "path";
90757
- import { existsSync as existsSync74 } from "fs";
91064
+ import { join as join86 } from "path";
91065
+ import { existsSync as existsSync75 } from "fs";
90758
91066
  function getDbPath() {
90759
- return join85(getDataDir(), "opencode", "opencode.db");
91067
+ return join86(getDataDir(), "opencode", "opencode.db");
90760
91068
  }
90761
91069
  var MAX_MICROTASK_RETRIES = 10;
90762
91070
  function tryUpdateMessageModel(db, messageId, targetModel, variant) {
@@ -90833,7 +91141,7 @@ function retryViaMicrotask(db, messageId, targetModel, variant, attempt) {
90833
91141
  function scheduleDeferredModelOverride(messageId, targetModel, variant) {
90834
91142
  queueMicrotask(() => {
90835
91143
  const dbPath = getDbPath();
90836
- if (!existsSync74(dbPath)) {
91144
+ if (!existsSync75(dbPath)) {
90837
91145
  log("[ultrawork-db-override] DB not found, skipping deferred override");
90838
91146
  return;
90839
91147
  }
@@ -91099,14 +91407,14 @@ function normalizeSessionStatusToIdle(input) {
91099
91407
  }
91100
91408
 
91101
91409
  // src/plugin/event.ts
91102
- function isRecord9(value) {
91410
+ function isRecord10(value) {
91103
91411
  return typeof value === "object" && value !== null;
91104
91412
  }
91105
91413
  function normalizeFallbackModelID(modelID) {
91106
91414
  return modelID.replace(/-thinking$/i, "").replace(/-max$/i, "").replace(/-high$/i, "");
91107
91415
  }
91108
91416
  function extractErrorName3(error92) {
91109
- if (isRecord9(error92) && typeof error92.name === "string")
91417
+ if (isRecord10(error92) && typeof error92.name === "string")
91110
91418
  return error92.name;
91111
91419
  if (error92 instanceof Error)
91112
91420
  return error92.name;
@@ -91119,16 +91427,16 @@ function extractErrorMessage2(error92) {
91119
91427
  return error92;
91120
91428
  if (error92 instanceof Error)
91121
91429
  return error92.message;
91122
- if (isRecord9(error92)) {
91430
+ if (isRecord10(error92)) {
91123
91431
  const candidates = [
91124
91432
  error92,
91125
91433
  error92.data,
91126
91434
  error92.error,
91127
- isRecord9(error92.data) ? error92.data.error : undefined,
91435
+ isRecord10(error92.data) ? error92.data.error : undefined,
91128
91436
  error92.cause
91129
91437
  ];
91130
91438
  for (const candidate of candidates) {
91131
- if (isRecord9(candidate) && typeof candidate.message === "string" && candidate.message.length > 0) {
91439
+ if (isRecord10(candidate) && typeof candidate.message === "string" && candidate.message.length > 0) {
91132
91440
  return candidate.message;
91133
91441
  }
91134
91442
  }
@@ -91645,6 +91953,7 @@ var OhMyOpenCodePlugin = async (ctx) => {
91645
91953
  directory: ctx.directory
91646
91954
  });
91647
91955
  injectServerAuthIntoClient(ctx.client);
91956
+ injectYGKAInterceptor(ctx.client);
91648
91957
  startBackgroundCheck();
91649
91958
  const pluginConfig = loadPluginConfig(ctx.directory, ctx);
91650
91959
  const disabledHooks = new Set(pluginConfig.disabled_hooks ?? []);