oh-my-opencode 3.17.1 → 3.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.ja.md +4 -0
  2. package/README.ko.md +4 -0
  3. package/README.ru.md +4 -0
  4. package/README.zh-cn.md +4 -0
  5. package/dist/cli/index.js +888 -614
  6. package/dist/cli/install-validators.d.ts +1 -0
  7. package/dist/cli/model-fallback-types.d.ts +1 -0
  8. package/dist/cli/provider-model-id-transform.d.ts +1 -1
  9. package/dist/cli/types.d.ts +3 -0
  10. package/dist/config/schema/agent-definitions.d.ts +3 -0
  11. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
  12. package/dist/features/background-agent/session-existence.d.ts +1 -1
  13. package/dist/features/background-agent/subagent-spawn-limits.d.ts +1 -1
  14. package/dist/features/background-agent/task-poller.d.ts +1 -0
  15. package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +3 -0
  16. package/dist/features/claude-code-agent-loader/index.d.ts +3 -0
  17. package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +2 -0
  18. package/dist/features/claude-code-agent-loader/loader.d.ts +2 -0
  19. package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +2 -0
  20. package/dist/features/claude-code-agent-loader/types.d.ts +9 -1
  21. package/dist/hooks/atlas/system-reminder-templates.d.ts +2 -2
  22. package/dist/hooks/directory-agents-injector/hook.d.ts +7 -7
  23. package/dist/hooks/directory-readme-injector/hook.d.ts +7 -7
  24. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
  25. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
  26. package/dist/hooks/keyword-detector/ultrawork/gpt.d.ts +1 -1
  27. package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
  28. package/dist/hooks/model-fallback/next-fallback.d.ts +8 -0
  29. package/dist/index.js +1455 -842
  30. package/dist/oh-my-opencode.schema.json +7 -0
  31. package/dist/shared/agent-tool-restrictions.d.ts +0 -5
  32. package/dist/shared/index.d.ts +2 -0
  33. package/dist/shared/parse-tools-config.d.ts +6 -0
  34. package/dist/shared/resolve-agent-definition-paths.d.ts +1 -0
  35. package/dist/tools/call-omo-agent/agent-resolver.d.ts +17 -0
  36. package/dist/tools/call-omo-agent/constants.d.ts +1 -1
  37. package/dist/tools/delegate-task/delegated-model-config.d.ts +3 -0
  38. package/dist/tools/delegate-task/fallback-entry-resolution.d.ts +12 -0
  39. package/dist/tools/delegate-task/fallback-entry-settings.d.ts +7 -0
  40. package/dist/tools/delegate-task/subagent-discovery.d.ts +15 -0
  41. package/dist/tools/delegate-task/sync-task-fallback.d.ts +12 -0
  42. package/dist/tools/skill/constants.d.ts +1 -1
  43. package/package.json +12 -12
package/dist/cli/index.js CHANGED
@@ -4915,6 +4915,42 @@ var init_command_executor = __esm(() => {
4915
4915
  });
4916
4916
 
4917
4917
  // src/shared/contains-path.ts
4918
+ import { existsSync, realpathSync } from "fs";
4919
+ import { basename, dirname, isAbsolute, join, normalize, relative, resolve } from "path";
4920
+ function findNearestExistingAncestor(resolvedPath) {
4921
+ let candidatePath = resolvedPath;
4922
+ while (!existsSync(candidatePath)) {
4923
+ const parentPath = dirname(candidatePath);
4924
+ if (parentPath === candidatePath) {
4925
+ return candidatePath;
4926
+ }
4927
+ candidatePath = parentPath;
4928
+ }
4929
+ return candidatePath;
4930
+ }
4931
+ function toCanonicalPath(pathToNormalize) {
4932
+ const resolvedPath = resolve(pathToNormalize);
4933
+ if (existsSync(resolvedPath)) {
4934
+ try {
4935
+ return normalize(realpathSync.native(resolvedPath));
4936
+ } catch {
4937
+ return normalize(resolvedPath);
4938
+ }
4939
+ }
4940
+ const nearestExistingAncestor = findNearestExistingAncestor(resolvedPath);
4941
+ const canonicalAncestor = existsSync(nearestExistingAncestor) ? realpathSync.native(nearestExistingAncestor) : nearestExistingAncestor;
4942
+ const relativePathFromAncestor = relative(nearestExistingAncestor, resolvedPath);
4943
+ return normalize(join(canonicalAncestor, relativePathFromAncestor || basename(resolvedPath)));
4944
+ }
4945
+ function containsPath(rootPath, candidatePath) {
4946
+ const canonicalRootPath = toCanonicalPath(rootPath);
4947
+ const canonicalCandidatePath = toCanonicalPath(candidatePath);
4948
+ const relativePath = relative(canonicalRootPath, canonicalCandidatePath);
4949
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute(relativePath);
4950
+ }
4951
+ function isWithinProject(candidatePath, projectRoot) {
4952
+ return containsPath(projectRoot, candidatePath);
4953
+ }
4918
4954
  var init_contains_path = () => {};
4919
4955
 
4920
4956
  // src/shared/plugin-identity.ts
@@ -5018,13 +5054,13 @@ var init_pattern_matcher = __esm(() => {
5018
5054
  regexCache = new Map;
5019
5055
  });
5020
5056
  // src/shared/file-utils.ts
5021
- import { lstatSync, realpathSync } from "fs";
5057
+ import { lstatSync, realpathSync as realpathSync2 } from "fs";
5022
5058
  function normalizeDarwinRealpath(filePath) {
5023
5059
  return filePath.startsWith("/private/var/") ? filePath.slice("/private".length) : filePath;
5024
5060
  }
5025
5061
  function resolveSymlink(filePath) {
5026
5062
  try {
5027
- return normalizeDarwinRealpath(realpathSync(filePath));
5063
+ return normalizeDarwinRealpath(realpathSync2(filePath));
5028
5064
  } catch {
5029
5065
  return filePath;
5030
5066
  }
@@ -5036,7 +5072,7 @@ var init_context_limit_resolver = () => {};
5036
5072
 
5037
5073
  // src/shared/normalize-sdk-response.ts
5038
5074
  function normalizeSDKResponse(response, fallback, options) {
5039
- if (response === null || response === undefined) {
5075
+ if (response == null) {
5040
5076
  return fallback;
5041
5077
  }
5042
5078
  if (Array.isArray(response)) {
@@ -5044,7 +5080,7 @@ function normalizeSDKResponse(response, fallback, options) {
5044
5080
  }
5045
5081
  if (typeof response === "object" && "data" in response) {
5046
5082
  const data = response.data;
5047
- if (data !== null && data !== undefined) {
5083
+ if (data != null) {
5048
5084
  return data;
5049
5085
  }
5050
5086
  if (options?.preferResponseOnMissingData === true) {
@@ -5982,8 +6018,8 @@ var init_main = __esm(() => {
5982
6018
  });
5983
6019
 
5984
6020
  // src/shared/jsonc-parser.ts
5985
- import { existsSync, readFileSync } from "fs";
5986
- import { join as join3 } from "path";
6021
+ import { existsSync as existsSync2, readFileSync } from "fs";
6022
+ import { join as join4 } from "path";
5987
6023
  function stripBom(content) {
5988
6024
  return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
5989
6025
  }
@@ -6003,17 +6039,17 @@ function parseJsonc(content) {
6003
6039
  function detectConfigFile(basePath) {
6004
6040
  const jsoncPath = `${basePath}.jsonc`;
6005
6041
  const jsonPath = `${basePath}.json`;
6006
- if (existsSync(jsoncPath)) {
6042
+ if (existsSync2(jsoncPath)) {
6007
6043
  return { format: "jsonc", path: jsoncPath };
6008
6044
  }
6009
- if (existsSync(jsonPath)) {
6045
+ if (existsSync2(jsonPath)) {
6010
6046
  return { format: "json", path: jsonPath };
6011
6047
  }
6012
6048
  return { format: "none", path: jsonPath };
6013
6049
  }
6014
6050
  function detectPluginConfigFile(dir) {
6015
- const canonicalResult = detectConfigFile(join3(dir, CONFIG_BASENAME));
6016
- const legacyResult = detectConfigFile(join3(dir, LEGACY_CONFIG_BASENAME));
6051
+ const canonicalResult = detectConfigFile(join4(dir, CONFIG_BASENAME));
6052
+ const legacyResult = detectConfigFile(join4(dir, LEGACY_CONFIG_BASENAME));
6017
6053
  if (canonicalResult.format !== "none") {
6018
6054
  return {
6019
6055
  ...canonicalResult,
@@ -6023,7 +6059,7 @@ function detectPluginConfigFile(dir) {
6023
6059
  if (legacyResult.format !== "none") {
6024
6060
  return legacyResult;
6025
6061
  }
6026
- return { format: "none", path: join3(dir, `${CONFIG_BASENAME}.json`) };
6062
+ return { format: "none", path: join4(dir, `${CONFIG_BASENAME}.json`) };
6027
6063
  }
6028
6064
  var init_jsonc_parser = __esm(() => {
6029
6065
  init_main();
@@ -6049,20 +6085,26 @@ var init_agent_names = __esm(() => {
6049
6085
  omo: "sisyphus",
6050
6086
  OmO: "sisyphus",
6051
6087
  Sisyphus: "sisyphus",
6088
+ "Sisyphus (Ultraworker)": "sisyphus",
6052
6089
  sisyphus: "sisyphus",
6090
+ "Hephaestus (Deep Agent)": "hephaestus",
6053
6091
  "OmO-Plan": "prometheus",
6054
6092
  "omo-plan": "prometheus",
6055
6093
  "Planner-Sisyphus": "prometheus",
6056
6094
  "planner-sisyphus": "prometheus",
6057
6095
  "Prometheus - Plan Builder": "prometheus",
6096
+ "Prometheus (Plan Builder)": "prometheus",
6058
6097
  prometheus: "prometheus",
6059
6098
  "orchestrator-sisyphus": "atlas",
6060
6099
  Atlas: "atlas",
6100
+ "Atlas (Plan Executor)": "atlas",
6061
6101
  atlas: "atlas",
6062
6102
  "plan-consultant": "metis",
6063
6103
  "Metis - Plan Consultant": "metis",
6104
+ "Metis (Plan Consultant)": "metis",
6064
6105
  metis: "metis",
6065
6106
  "Momus - Plan Critic": "momus",
6107
+ "Momus (Plan Critic)": "momus",
6066
6108
  momus: "momus",
6067
6109
  "Sisyphus-Junior": "sisyphus-junior",
6068
6110
  "sisyphus-junior": "sisyphus-junior",
@@ -6160,7 +6202,7 @@ var init_model_versions = __esm(() => {
6160
6202
  var init_agent_category = () => {};
6161
6203
 
6162
6204
  // src/shared/write-file-atomically.ts
6163
- import { closeSync, fsyncSync, openSync, renameSync, writeFileSync } from "fs";
6205
+ import { closeSync, fsyncSync, openSync, renameSync, unlinkSync, writeFileSync } from "fs";
6164
6206
  function writeFileAtomically(filePath, content) {
6165
6207
  const tempPath = `${filePath}.tmp`;
6166
6208
  writeFileSync(tempPath, content, "utf-8");
@@ -6170,7 +6212,18 @@ function writeFileAtomically(filePath, content) {
6170
6212
  } finally {
6171
6213
  closeSync(tempFileDescriptor);
6172
6214
  }
6173
- renameSync(tempPath, filePath);
6215
+ try {
6216
+ renameSync(tempPath, filePath);
6217
+ } catch (error) {
6218
+ const isWindows = process.platform === "win32";
6219
+ const isPermissionError = error instanceof Error && (error.message.includes("EPERM") || error.message.includes("EACCES"));
6220
+ if (isWindows && isPermissionError) {
6221
+ unlinkSync(filePath);
6222
+ renameSync(tempPath, filePath);
6223
+ } else {
6224
+ throw error;
6225
+ }
6226
+ }
6174
6227
  }
6175
6228
  var init_write_file_atomically = () => {};
6176
6229
 
@@ -6318,20 +6371,28 @@ function migrateConfigFile(configPath, rawConfig) {
6318
6371
  }
6319
6372
  }
6320
6373
  if (needsWrite) {
6374
+ let finalConfig = JSON.parse(JSON.stringify(copy));
6375
+ const newContent = JSON.stringify(finalConfig, null, 2) + `
6376
+ `;
6377
+ let existingContent;
6378
+ try {
6379
+ existingContent = fs3.readFileSync(configPath, "utf-8");
6380
+ } catch {}
6381
+ const contentChanged = existingContent !== newContent;
6321
6382
  const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
6322
6383
  const backupPath = `${configPath}.bak.${timestamp2}`;
6323
6384
  let backupSucceeded = false;
6324
- try {
6325
- fs3.copyFileSync(configPath, backupPath);
6326
- backupSucceeded = true;
6327
- } catch {
6328
- backupSucceeded = false;
6385
+ if (contentChanged) {
6386
+ try {
6387
+ fs3.copyFileSync(configPath, backupPath);
6388
+ backupSucceeded = true;
6389
+ } catch {
6390
+ backupSucceeded = false;
6391
+ }
6329
6392
  }
6330
6393
  let writeSucceeded = false;
6331
- let finalConfig = JSON.parse(JSON.stringify(copy));
6332
6394
  try {
6333
- writeFileAtomically(configPath, JSON.stringify(finalConfig, null, 2) + `
6334
- `);
6395
+ writeFileAtomically(configPath, newContent);
6335
6396
  writeSucceeded = true;
6336
6397
  } catch (err) {
6337
6398
  log(`Failed to write migrated config to ${configPath}:`, err);
@@ -6383,9 +6444,9 @@ var init_migration = __esm(() => {
6383
6444
  });
6384
6445
 
6385
6446
  // src/shared/opencode-config-dir.ts
6386
- import { existsSync as existsSync3, realpathSync as realpathSync2 } from "fs";
6447
+ import { existsSync as existsSync4, realpathSync as realpathSync3 } from "fs";
6387
6448
  import { homedir as homedir2 } from "os";
6388
- import { join as join4, resolve, win32 } from "path";
6449
+ import { join as join5, resolve as resolve2, win32 } from "path";
6389
6450
  function isDevBuild(version) {
6390
6451
  if (!version)
6391
6452
  return false;
@@ -6395,24 +6456,24 @@ function getTauriConfigDir(identifier) {
6395
6456
  const platform = process.platform;
6396
6457
  switch (platform) {
6397
6458
  case "darwin":
6398
- return join4(homedir2(), "Library", "Application Support", identifier);
6459
+ return join5(homedir2(), "Library", "Application Support", identifier);
6399
6460
  case "win32": {
6400
- const appData = process.env.APPDATA || join4(homedir2(), "AppData", "Roaming");
6461
+ const appData = process.env.APPDATA || join5(homedir2(), "AppData", "Roaming");
6401
6462
  return win32.join(appData, identifier);
6402
6463
  }
6403
6464
  case "linux":
6404
6465
  default: {
6405
- const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir2(), ".config");
6406
- return join4(xdgConfig, identifier);
6466
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir2(), ".config");
6467
+ return join5(xdgConfig, identifier);
6407
6468
  }
6408
6469
  }
6409
6470
  }
6410
6471
  function resolveConfigPath(pathValue) {
6411
- const resolvedPath = resolve(pathValue);
6412
- if (!existsSync3(resolvedPath))
6472
+ const resolvedPath = resolve2(pathValue);
6473
+ if (!existsSync4(resolvedPath))
6413
6474
  return resolvedPath;
6414
6475
  try {
6415
- return realpathSync2(resolvedPath);
6476
+ return realpathSync3(resolvedPath);
6416
6477
  } catch {
6417
6478
  return resolvedPath;
6418
6479
  }
@@ -6422,8 +6483,8 @@ function getCliConfigDir() {
6422
6483
  if (envConfigDir) {
6423
6484
  return resolveConfigPath(envConfigDir);
6424
6485
  }
6425
- const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir2(), ".config");
6426
- return resolveConfigPath(join4(xdgConfig, "opencode"));
6486
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir2(), ".config");
6487
+ return resolveConfigPath(join5(xdgConfig, "opencode"));
6427
6488
  }
6428
6489
  function getOpenCodeConfigDir(options) {
6429
6490
  const { binary: binary2, version, checkExisting = true } = options;
@@ -6435,9 +6496,9 @@ function getOpenCodeConfigDir(options) {
6435
6496
  const tauriDir = process.platform === "win32" ? win32.isAbsolute(tauriDirBase) ? win32.normalize(tauriDirBase) : win32.resolve(tauriDirBase) : resolveConfigPath(tauriDirBase);
6436
6497
  if (checkExisting) {
6437
6498
  const legacyDir = getCliConfigDir();
6438
- const legacyConfig = join4(legacyDir, "opencode.json");
6439
- const legacyConfigC = join4(legacyDir, "opencode.jsonc");
6440
- if (existsSync3(legacyConfig) || existsSync3(legacyConfigC)) {
6499
+ const legacyConfig = join5(legacyDir, "opencode.json");
6500
+ const legacyConfigC = join5(legacyDir, "opencode.jsonc");
6501
+ if (existsSync4(legacyConfig) || existsSync4(legacyConfigC)) {
6441
6502
  return legacyDir;
6442
6503
  }
6443
6504
  }
@@ -6447,10 +6508,10 @@ function getOpenCodeConfigPaths(options) {
6447
6508
  const configDir = getOpenCodeConfigDir(options);
6448
6509
  return {
6449
6510
  configDir,
6450
- configJson: join4(configDir, "opencode.json"),
6451
- configJsonc: join4(configDir, "opencode.jsonc"),
6452
- packageJson: join4(configDir, "package.json"),
6453
- omoConfig: join4(configDir, `${CONFIG_BASENAME}.json`)
6511
+ configJson: join5(configDir, "opencode.json"),
6512
+ configJsonc: join5(configDir, "opencode.jsonc"),
6513
+ packageJson: join5(configDir, "package.json"),
6514
+ omoConfig: join5(configDir, `${CONFIG_BASENAME}.json`)
6454
6515
  };
6455
6516
  }
6456
6517
  var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
@@ -6458,6 +6519,25 @@ var init_opencode_config_dir = __esm(() => {
6458
6519
  init_plugin_identity();
6459
6520
  });
6460
6521
 
6522
+ // src/shared/resolve-agent-definition-paths.ts
6523
+ import { homedir as homedir3 } from "os";
6524
+ import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
6525
+ function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
6526
+ return paths.flatMap((p) => {
6527
+ const expanded = p.startsWith("~/") ? p.replace(/^~\//, `${homedir3()}/`) : p;
6528
+ const resolved = isAbsolute2(expanded) ? expanded : resolve3(baseDir, expanded);
6529
+ if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
6530
+ log(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
6531
+ return [];
6532
+ }
6533
+ return [resolved];
6534
+ });
6535
+ }
6536
+ var init_resolve_agent_definition_paths = __esm(() => {
6537
+ init_contains_path();
6538
+ init_logger();
6539
+ });
6540
+
6461
6541
  // src/shared/opencode-version.ts
6462
6542
  import { execSync } from "child_process";
6463
6543
  function parseVersion(version) {
@@ -6509,8 +6589,8 @@ var init_opencode_version = __esm(() => {
6509
6589
  });
6510
6590
 
6511
6591
  // src/shared/opencode-storage-detection.ts
6512
- import { existsSync as existsSync4 } from "fs";
6513
- import { join as join5 } from "path";
6592
+ import { existsSync as existsSync5 } from "fs";
6593
+ import { join as join6 } from "path";
6514
6594
  function isSqliteBackend() {
6515
6595
  if (cachedResult === true)
6516
6596
  return true;
@@ -6518,8 +6598,8 @@ function isSqliteBackend() {
6518
6598
  return false;
6519
6599
  const check = () => {
6520
6600
  const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
6521
- const dbPath = join5(getDataDir(), "opencode", "opencode.db");
6522
- return versionOk && existsSync4(dbPath);
6601
+ const dbPath = join6(getDataDir(), "opencode", "opencode.db");
6602
+ return versionOk && existsSync5(dbPath);
6523
6603
  };
6524
6604
  if (cachedResult === FALSE_PENDING_RETRY) {
6525
6605
  const result2 = check();
@@ -6591,11 +6671,94 @@ var init_zip_extractor = __esm(() => {
6591
6671
  });
6592
6672
 
6593
6673
  // src/shared/binary-downloader.ts
6674
+ import { chmodSync, existsSync as existsSync6, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "fs";
6675
+ import * as path4 from "path";
6676
+ function getCachedBinaryPath(cacheDir, binaryName) {
6677
+ const binaryPath = path4.join(cacheDir, binaryName);
6678
+ return existsSync6(binaryPath) ? binaryPath : null;
6679
+ }
6594
6680
  var init_binary_downloader = __esm(() => {
6595
6681
  init_archive_entry_validator();
6596
6682
  init_zip_extractor();
6597
6683
  });
6598
6684
 
6685
+ // src/shared/agent-display-names.ts
6686
+ function stripInvisibleAgentCharacters(agentName) {
6687
+ return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
6688
+ }
6689
+ function stripAgentListSortPrefix(agentName) {
6690
+ return stripInvisibleAgentCharacters(agentName);
6691
+ }
6692
+ function getAgentRuntimeName(configKey) {
6693
+ const displayName = getAgentDisplayName(configKey);
6694
+ const prefix = AGENT_LIST_SORT_PREFIXES[configKey.toLowerCase()];
6695
+ return prefix ? `${prefix}${displayName}` : displayName;
6696
+ }
6697
+ function getAgentDisplayName(configKey) {
6698
+ const exactMatch = AGENT_DISPLAY_NAMES[configKey];
6699
+ if (exactMatch !== undefined)
6700
+ return exactMatch;
6701
+ const lowerKey = configKey.toLowerCase();
6702
+ for (const [k, v] of Object.entries(AGENT_DISPLAY_NAMES)) {
6703
+ if (k.toLowerCase() === lowerKey)
6704
+ return v;
6705
+ }
6706
+ return configKey;
6707
+ }
6708
+ function resolveKnownAgentConfigKey(agentName) {
6709
+ const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
6710
+ const reversed = REVERSE_DISPLAY_NAMES[lower];
6711
+ if (reversed !== undefined)
6712
+ return reversed;
6713
+ const legacy = LEGACY_DISPLAY_NAMES[lower];
6714
+ if (legacy !== undefined)
6715
+ return legacy;
6716
+ if (AGENT_DISPLAY_NAMES[lower] !== undefined)
6717
+ return lower;
6718
+ return;
6719
+ }
6720
+ function getAgentConfigKey(agentName) {
6721
+ const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
6722
+ return resolveKnownAgentConfigKey(agentName) ?? lower;
6723
+ }
6724
+ var AGENT_DISPLAY_NAMES, AGENT_LIST_SORT_PREFIXES, INVISIBLE_AGENT_CHARACTERS_REGEX, REVERSE_DISPLAY_NAMES, LEGACY_DISPLAY_NAMES;
6725
+ var init_agent_display_names = __esm(() => {
6726
+ AGENT_DISPLAY_NAMES = {
6727
+ sisyphus: "Sisyphus - Ultraworker",
6728
+ hephaestus: "Hephaestus - Deep Agent",
6729
+ prometheus: "Prometheus - Plan Builder",
6730
+ atlas: "Atlas - Plan Executor",
6731
+ "sisyphus-junior": "Sisyphus-Junior",
6732
+ metis: "Metis - Plan Consultant",
6733
+ momus: "Momus - Plan Critic",
6734
+ athena: "Athena - Council",
6735
+ "athena-junior": "Athena-Junior - Council",
6736
+ oracle: "oracle",
6737
+ librarian: "librarian",
6738
+ explore: "explore",
6739
+ "multimodal-looker": "multimodal-looker",
6740
+ "council-member": "council-member"
6741
+ };
6742
+ AGENT_LIST_SORT_PREFIXES = {
6743
+ sisyphus: "\u200B",
6744
+ hephaestus: "\u200B\u200B",
6745
+ prometheus: "\u200B\u200B\u200B",
6746
+ atlas: "\u200B\u200B\u200B\u200B"
6747
+ };
6748
+ INVISIBLE_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g;
6749
+ REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
6750
+ LEGACY_DISPLAY_NAMES = {
6751
+ "sisyphus (ultraworker)": "sisyphus",
6752
+ "hephaestus (deep agent)": "hephaestus",
6753
+ "prometheus (plan builder)": "prometheus",
6754
+ "atlas (plan executor)": "atlas",
6755
+ "metis (plan consultant)": "metis",
6756
+ "momus (plan critic)": "momus",
6757
+ "athena (council)": "athena",
6758
+ "athena-junior (council)": "athena-junior"
6759
+ };
6760
+ });
6761
+
6599
6762
  // src/shared/model-requirements.ts
6600
6763
  var AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS;
6601
6764
  var init_model_requirements = __esm(() => {
@@ -6603,11 +6766,11 @@ var init_model_requirements = __esm(() => {
6603
6766
  sisyphus: {
6604
6767
  fallbackChain: [
6605
6768
  {
6606
- providers: ["anthropic", "github-copilot", "opencode"],
6769
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6607
6770
  model: "claude-opus-4-6",
6608
6771
  variant: "max"
6609
6772
  },
6610
- { providers: ["opencode-go"], model: "kimi-k2.5" },
6773
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6611
6774
  { providers: ["kimi-for-coding"], model: "k2p5" },
6612
6775
  {
6613
6776
  providers: [
@@ -6616,12 +6779,13 @@ var init_model_requirements = __esm(() => {
6616
6779
  "moonshotai-cn",
6617
6780
  "firmware",
6618
6781
  "ollama-cloud",
6619
- "aihubmix"
6782
+ "aihubmix",
6783
+ "vercel"
6620
6784
  ],
6621
6785
  model: "kimi-k2.5"
6622
6786
  },
6623
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
6624
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
6787
+ { providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.4", variant: "medium" },
6788
+ { providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
6625
6789
  { providers: ["opencode"], model: "big-pickle" }
6626
6790
  ],
6627
6791
  requiresAnyModel: true
@@ -6629,73 +6793,73 @@ var init_model_requirements = __esm(() => {
6629
6793
  hephaestus: {
6630
6794
  fallbackChain: [
6631
6795
  {
6632
- providers: ["openai", "github-copilot", "venice", "opencode"],
6796
+ providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
6633
6797
  model: "gpt-5.4",
6634
6798
  variant: "medium"
6635
6799
  }
6636
6800
  ],
6637
- requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
6801
+ requiresProvider: ["openai", "github-copilot", "venice", "opencode", "vercel"]
6638
6802
  },
6639
6803
  oracle: {
6640
6804
  fallbackChain: [
6641
6805
  {
6642
- providers: ["openai", "github-copilot", "opencode"],
6806
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6643
6807
  model: "gpt-5.4",
6644
6808
  variant: "high"
6645
6809
  },
6646
6810
  {
6647
- providers: ["google", "github-copilot", "opencode"],
6811
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6648
6812
  model: "gemini-3.1-pro",
6649
6813
  variant: "high"
6650
6814
  },
6651
6815
  {
6652
- providers: ["anthropic", "github-copilot", "opencode"],
6816
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6653
6817
  model: "claude-opus-4-6",
6654
6818
  variant: "max"
6655
6819
  },
6656
- { providers: ["opencode-go"], model: "glm-5" }
6820
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
6657
6821
  ]
6658
6822
  },
6659
6823
  librarian: {
6660
6824
  fallbackChain: [
6661
- { providers: ["opencode-go"], model: "minimax-m2.7" },
6662
- { providers: ["opencode"], model: "minimax-m2.7-highspeed" },
6663
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
6664
- { providers: ["opencode"], model: "gpt-5-nano" }
6825
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
6826
+ { providers: ["opencode", "vercel"], model: "minimax-m2.7-highspeed" },
6827
+ { providers: ["anthropic", "opencode", "vercel"], model: "claude-haiku-4-5" },
6828
+ { providers: ["opencode", "vercel"], model: "gpt-5-nano" }
6665
6829
  ]
6666
6830
  },
6667
6831
  explore: {
6668
6832
  fallbackChain: [
6669
- { providers: ["github-copilot", "xai"], model: "grok-code-fast-1" },
6670
- { providers: ["opencode-go"], model: "minimax-m2.7-highspeed" },
6671
- { providers: ["opencode"], model: "minimax-m2.7" },
6672
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
6673
- { providers: ["opencode"], model: "gpt-5-nano" }
6833
+ { providers: ["github-copilot", "xai", "vercel"], model: "grok-code-fast-1" },
6834
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7-highspeed" },
6835
+ { providers: ["opencode", "vercel"], model: "minimax-m2.7" },
6836
+ { providers: ["anthropic", "opencode", "vercel"], model: "claude-haiku-4-5" },
6837
+ { providers: ["opencode", "vercel"], model: "gpt-5-nano" }
6674
6838
  ]
6675
6839
  },
6676
6840
  "multimodal-looker": {
6677
6841
  fallbackChain: [
6678
- { providers: ["openai", "opencode"], model: "gpt-5.4", variant: "medium" },
6679
- { providers: ["opencode-go"], model: "kimi-k2.5" },
6680
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
6681
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5-nano" }
6842
+ { providers: ["openai", "opencode", "vercel"], model: "gpt-5.4", variant: "medium" },
6843
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6844
+ { providers: ["zai-coding-plan", "vercel"], model: "glm-4.6v" },
6845
+ { providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5-nano" }
6682
6846
  ]
6683
6847
  },
6684
6848
  prometheus: {
6685
6849
  fallbackChain: [
6686
6850
  {
6687
- providers: ["anthropic", "github-copilot", "opencode"],
6851
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6688
6852
  model: "claude-opus-4-6",
6689
6853
  variant: "max"
6690
6854
  },
6691
6855
  {
6692
- providers: ["openai", "github-copilot", "opencode"],
6856
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6693
6857
  model: "gpt-5.4",
6694
6858
  variant: "high"
6695
6859
  },
6696
- { providers: ["opencode-go"], model: "glm-5" },
6860
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
6697
6861
  {
6698
- providers: ["google", "github-copilot", "opencode"],
6862
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6699
6863
  model: "gemini-3.1-pro"
6700
6864
  }
6701
6865
  ]
@@ -6703,61 +6867,61 @@ var init_model_requirements = __esm(() => {
6703
6867
  metis: {
6704
6868
  fallbackChain: [
6705
6869
  {
6706
- providers: ["anthropic", "github-copilot", "opencode"],
6870
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6707
6871
  model: "claude-opus-4-6",
6708
6872
  variant: "max"
6709
6873
  },
6710
6874
  {
6711
- providers: ["openai", "github-copilot", "opencode"],
6875
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6712
6876
  model: "gpt-5.4",
6713
6877
  variant: "high"
6714
6878
  },
6715
- { providers: ["opencode-go"], model: "glm-5" },
6879
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
6716
6880
  { providers: ["kimi-for-coding"], model: "k2p5" }
6717
6881
  ]
6718
6882
  },
6719
6883
  momus: {
6720
6884
  fallbackChain: [
6721
6885
  {
6722
- providers: ["openai", "github-copilot", "opencode"],
6886
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6723
6887
  model: "gpt-5.4",
6724
6888
  variant: "xhigh"
6725
6889
  },
6726
6890
  {
6727
- providers: ["anthropic", "github-copilot", "opencode"],
6891
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6728
6892
  model: "claude-opus-4-6",
6729
6893
  variant: "max"
6730
6894
  },
6731
6895
  {
6732
- providers: ["google", "github-copilot", "opencode"],
6896
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6733
6897
  model: "gemini-3.1-pro",
6734
6898
  variant: "high"
6735
6899
  },
6736
- { providers: ["opencode-go"], model: "glm-5" }
6900
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
6737
6901
  ]
6738
6902
  },
6739
6903
  atlas: {
6740
6904
  fallbackChain: [
6741
- { providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
6742
- { providers: ["opencode-go"], model: "kimi-k2.5" },
6905
+ { providers: ["anthropic", "github-copilot", "opencode", "vercel"], model: "claude-sonnet-4-6" },
6906
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6743
6907
  {
6744
- providers: ["openai", "github-copilot", "opencode"],
6908
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6745
6909
  model: "gpt-5.4",
6746
6910
  variant: "medium"
6747
6911
  },
6748
- { providers: ["opencode-go"], model: "minimax-m2.7" }
6912
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
6749
6913
  ]
6750
6914
  },
6751
6915
  "sisyphus-junior": {
6752
6916
  fallbackChain: [
6753
- { providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
6754
- { providers: ["opencode-go"], model: "kimi-k2.5" },
6917
+ { providers: ["anthropic", "github-copilot", "opencode", "vercel"], model: "claude-sonnet-4-6" },
6918
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6755
6919
  {
6756
- providers: ["openai", "github-copilot", "opencode"],
6920
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6757
6921
  model: "gpt-5.4",
6758
6922
  variant: "medium"
6759
6923
  },
6760
- { providers: ["opencode-go"], model: "minimax-m2.7" },
6924
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
6761
6925
  { providers: ["opencode"], model: "big-pickle" }
6762
6926
  ]
6763
6927
  }
@@ -6766,54 +6930,54 @@ var init_model_requirements = __esm(() => {
6766
6930
  "visual-engineering": {
6767
6931
  fallbackChain: [
6768
6932
  {
6769
- providers: ["google", "github-copilot", "opencode"],
6933
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6770
6934
  model: "gemini-3.1-pro",
6771
6935
  variant: "high"
6772
6936
  },
6773
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
6937
+ { providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
6774
6938
  {
6775
- providers: ["anthropic", "github-copilot", "opencode"],
6939
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6776
6940
  model: "claude-opus-4-6",
6777
6941
  variant: "max"
6778
6942
  },
6779
- { providers: ["opencode-go"], model: "glm-5" },
6943
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
6780
6944
  { providers: ["kimi-for-coding"], model: "k2p5" }
6781
6945
  ]
6782
6946
  },
6783
6947
  ultrabrain: {
6784
6948
  fallbackChain: [
6785
6949
  {
6786
- providers: ["openai", "opencode"],
6950
+ providers: ["openai", "opencode", "vercel"],
6787
6951
  model: "gpt-5.4",
6788
6952
  variant: "xhigh"
6789
6953
  },
6790
6954
  {
6791
- providers: ["google", "github-copilot", "opencode"],
6955
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6792
6956
  model: "gemini-3.1-pro",
6793
6957
  variant: "high"
6794
6958
  },
6795
6959
  {
6796
- providers: ["anthropic", "github-copilot", "opencode"],
6960
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6797
6961
  model: "claude-opus-4-6",
6798
6962
  variant: "max"
6799
6963
  },
6800
- { providers: ["opencode-go"], model: "glm-5" }
6964
+ { providers: ["opencode-go", "vercel"], model: "glm-5" }
6801
6965
  ]
6802
6966
  },
6803
6967
  deep: {
6804
6968
  fallbackChain: [
6805
6969
  {
6806
- providers: ["openai", "github-copilot", "venice", "opencode"],
6970
+ providers: ["openai", "github-copilot", "venice", "opencode", "vercel"],
6807
6971
  model: "gpt-5.4",
6808
6972
  variant: "medium"
6809
6973
  },
6810
6974
  {
6811
- providers: ["anthropic", "github-copilot", "opencode"],
6975
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6812
6976
  model: "claude-opus-4-6",
6813
6977
  variant: "max"
6814
6978
  },
6815
6979
  {
6816
- providers: ["google", "github-copilot", "opencode"],
6980
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6817
6981
  model: "gemini-3.1-pro",
6818
6982
  variant: "high"
6819
6983
  }
@@ -6822,72 +6986,72 @@ var init_model_requirements = __esm(() => {
6822
6986
  artistry: {
6823
6987
  fallbackChain: [
6824
6988
  {
6825
- providers: ["google", "github-copilot", "opencode"],
6989
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6826
6990
  model: "gemini-3.1-pro",
6827
6991
  variant: "high"
6828
6992
  },
6829
6993
  {
6830
- providers: ["anthropic", "github-copilot", "opencode"],
6994
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6831
6995
  model: "claude-opus-4-6",
6832
6996
  variant: "max"
6833
6997
  },
6834
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
6998
+ { providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.4" }
6835
6999
  ],
6836
7000
  requiresModel: "gemini-3.1-pro"
6837
7001
  },
6838
7002
  quick: {
6839
7003
  fallbackChain: [
6840
7004
  {
6841
- providers: ["openai", "github-copilot", "opencode"],
7005
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6842
7006
  model: "gpt-5.4-mini"
6843
7007
  },
6844
7008
  {
6845
- providers: ["anthropic", "github-copilot", "opencode"],
7009
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6846
7010
  model: "claude-haiku-4-5"
6847
7011
  },
6848
7012
  {
6849
- providers: ["google", "github-copilot", "opencode"],
7013
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6850
7014
  model: "gemini-3-flash"
6851
7015
  },
6852
- { providers: ["opencode-go"], model: "minimax-m2.7" },
6853
- { providers: ["opencode"], model: "gpt-5-nano" }
7016
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" },
7017
+ { providers: ["opencode", "vercel"], model: "gpt-5-nano" }
6854
7018
  ]
6855
7019
  },
6856
7020
  "unspecified-low": {
6857
7021
  fallbackChain: [
6858
7022
  {
6859
- providers: ["anthropic", "github-copilot", "opencode"],
7023
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6860
7024
  model: "claude-sonnet-4-6"
6861
7025
  },
6862
7026
  {
6863
- providers: ["openai", "opencode"],
7027
+ providers: ["openai", "opencode", "vercel"],
6864
7028
  model: "gpt-5.3-codex",
6865
7029
  variant: "medium"
6866
7030
  },
6867
- { providers: ["opencode-go"], model: "kimi-k2.5" },
7031
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6868
7032
  {
6869
- providers: ["google", "github-copilot", "opencode"],
7033
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6870
7034
  model: "gemini-3-flash"
6871
7035
  },
6872
- { providers: ["opencode-go"], model: "minimax-m2.7" }
7036
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
6873
7037
  ]
6874
7038
  },
6875
7039
  "unspecified-high": {
6876
7040
  fallbackChain: [
6877
7041
  {
6878
- providers: ["anthropic", "github-copilot", "opencode"],
7042
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6879
7043
  model: "claude-opus-4-6",
6880
7044
  variant: "max"
6881
7045
  },
6882
7046
  {
6883
- providers: ["openai", "github-copilot", "opencode"],
7047
+ providers: ["openai", "github-copilot", "opencode", "vercel"],
6884
7048
  model: "gpt-5.4",
6885
7049
  variant: "high"
6886
7050
  },
6887
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
7051
+ { providers: ["zai-coding-plan", "opencode", "vercel"], model: "glm-5" },
6888
7052
  { providers: ["kimi-for-coding"], model: "k2p5" },
6889
- { providers: ["opencode-go"], model: "glm-5" },
6890
- { providers: ["opencode"], model: "kimi-k2.5" },
7053
+ { providers: ["opencode-go", "vercel"], model: "glm-5" },
7054
+ { providers: ["opencode", "vercel"], model: "kimi-k2.5" },
6891
7055
  {
6892
7056
  providers: [
6893
7057
  "opencode",
@@ -6895,7 +7059,8 @@ var init_model_requirements = __esm(() => {
6895
7059
  "moonshotai-cn",
6896
7060
  "firmware",
6897
7061
  "ollama-cloud",
6898
- "aihubmix"
7062
+ "aihubmix",
7063
+ "vercel"
6899
7064
  ],
6900
7065
  model: "kimi-k2.5"
6901
7066
  }
@@ -6904,15 +7069,15 @@ var init_model_requirements = __esm(() => {
6904
7069
  writing: {
6905
7070
  fallbackChain: [
6906
7071
  {
6907
- providers: ["google", "github-copilot", "opencode"],
7072
+ providers: ["google", "github-copilot", "opencode", "vercel"],
6908
7073
  model: "gemini-3-flash"
6909
7074
  },
6910
- { providers: ["opencode-go"], model: "kimi-k2.5" },
7075
+ { providers: ["opencode-go", "vercel"], model: "kimi-k2.5" },
6911
7076
  {
6912
- providers: ["anthropic", "github-copilot", "opencode"],
7077
+ providers: ["anthropic", "github-copilot", "opencode", "vercel"],
6913
7078
  model: "claude-sonnet-4-6"
6914
7079
  },
6915
- { providers: ["opencode-go"], model: "minimax-m2.7" }
7080
+ { providers: ["opencode-go", "vercel"], model: "minimax-m2.7" }
6916
7081
  ]
6917
7082
  }
6918
7083
  };
@@ -6920,6 +7085,7 @@ var init_model_requirements = __esm(() => {
6920
7085
 
6921
7086
  // src/shared/agent-variant.ts
6922
7087
  var init_agent_variant = __esm(() => {
7088
+ init_agent_display_names();
6923
7089
  init_model_requirements();
6924
7090
  });
6925
7091
 
@@ -6938,6 +7104,9 @@ function detectShellType() {
6938
7104
  }
6939
7105
  return "unix";
6940
7106
  }
7107
+ if (process.env.MSYSTEM) {
7108
+ return "unix";
7109
+ }
6941
7110
  if (process.env.PSModulePath) {
6942
7111
  return "powershell";
6943
7112
  }
@@ -6948,7 +7117,9 @@ function detectShellType() {
6948
7117
  var init_system_directive = () => {};
6949
7118
 
6950
7119
  // src/shared/agent-tool-restrictions.ts
6951
- var init_agent_tool_restrictions = () => {};
7120
+ var init_agent_tool_restrictions = __esm(() => {
7121
+ init_agent_display_names();
7122
+ });
6952
7123
 
6953
7124
  // src/shared/model-normalization.ts
6954
7125
  function normalizeModelID(modelID) {
@@ -6956,20 +7127,20 @@ function normalizeModelID(modelID) {
6956
7127
  }
6957
7128
 
6958
7129
  // src/shared/json-file-cache-store.ts
6959
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
6960
- import { join as join6 } from "path";
7130
+ import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
7131
+ import { join as join8 } from "path";
6961
7132
  function toLogLabel(cacheLabel) {
6962
7133
  return cacheLabel.toLowerCase();
6963
7134
  }
6964
7135
  function createJsonFileCacheStore(options) {
6965
7136
  let memoryValue;
6966
7137
  function getCacheFilePath() {
6967
- return join6(options.getCacheDir(), options.filename);
7138
+ return join8(options.getCacheDir(), options.filename);
6968
7139
  }
6969
7140
  function ensureCacheDir() {
6970
7141
  const cacheDir = options.getCacheDir();
6971
- if (!existsSync5(cacheDir)) {
6972
- mkdirSync3(cacheDir, { recursive: true });
7142
+ if (!existsSync7(cacheDir)) {
7143
+ mkdirSync4(cacheDir, { recursive: true });
6973
7144
  }
6974
7145
  }
6975
7146
  function read() {
@@ -6977,13 +7148,13 @@ function createJsonFileCacheStore(options) {
6977
7148
  return memoryValue;
6978
7149
  }
6979
7150
  const cacheFile = getCacheFilePath();
6980
- if (!existsSync5(cacheFile)) {
7151
+ if (!existsSync7(cacheFile)) {
6981
7152
  memoryValue = null;
6982
7153
  log(`[${options.logPrefix}] ${options.cacheLabel} file not found`, { cacheFile });
6983
7154
  return null;
6984
7155
  }
6985
7156
  try {
6986
- const content = readFileSync3(cacheFile, "utf-8");
7157
+ const content = readFileSync4(cacheFile, "utf-8");
6987
7158
  const value = JSON.parse(content);
6988
7159
  memoryValue = value;
6989
7160
  log(`[${options.logPrefix}] Read ${toLogLabel(options.cacheLabel)}`, options.describe(value));
@@ -6997,7 +7168,7 @@ function createJsonFileCacheStore(options) {
6997
7168
  }
6998
7169
  }
6999
7170
  function has() {
7000
- return existsSync5(getCacheFilePath());
7171
+ return existsSync7(getCacheFilePath());
7001
7172
  }
7002
7173
  function write(value) {
7003
7174
  ensureCacheDir();
@@ -7166,14 +7337,14 @@ var init_connected_providers_cache = __esm(() => {
7166
7337
  });
7167
7338
 
7168
7339
  // src/shared/model-availability.ts
7169
- import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
7170
- import { join as join7 } from "path";
7340
+ import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
7341
+ import { join as join9 } from "path";
7171
7342
  function isModelCacheAvailable() {
7172
7343
  if (hasProviderModelsCache()) {
7173
7344
  return true;
7174
7345
  }
7175
- const cacheFile = join7(getOpenCodeCacheDir(), "models.json");
7176
- return existsSync6(cacheFile);
7346
+ const cacheFile = join9(getOpenCodeCacheDir(), "models.json");
7347
+ return existsSync8(cacheFile);
7177
7348
  }
7178
7349
  var init_model_availability = __esm(() => {
7179
7350
  init_logger();
@@ -7182,21 +7353,14 @@ var init_model_availability = __esm(() => {
7182
7353
  });
7183
7354
 
7184
7355
  // src/shared/provider-model-id-transform.ts
7185
- function transformModelForProvider(provider, model) {
7186
- if (provider === "github-copilot") {
7187
- return model.replace("claude-opus-4-6", "claude-opus-4.6").replace("claude-sonnet-4-6", "claude-sonnet-4.6").replace("claude-sonnet-4-5", "claude-sonnet-4.5").replace("claude-haiku-4-5", "claude-haiku-4.5").replace("claude-sonnet-4", "claude-sonnet-4").replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
7188
- }
7189
- if (provider === "google") {
7190
- return model.replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
7191
- }
7192
- return model;
7193
- }
7356
+ var init_provider_model_id_transform = () => {};
7194
7357
 
7195
7358
  // src/shared/model-resolution-pipeline.ts
7196
7359
  var init_model_resolution_pipeline = __esm(() => {
7197
7360
  init_logger();
7198
7361
  init_connected_providers_cache();
7199
7362
  init_model_availability();
7363
+ init_provider_model_id_transform();
7200
7364
  });
7201
7365
 
7202
7366
  // src/shared/known-variants.ts
@@ -48469,19 +48633,19 @@ var init_constants = __esm(() => {
48469
48633
  });
48470
48634
 
48471
48635
  // src/shared/opencode-storage-paths.ts
48472
- import { join as join8 } from "path";
48636
+ import { join as join10 } from "path";
48473
48637
  var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
48474
48638
  var init_opencode_storage_paths = __esm(() => {
48475
48639
  init_data_path();
48476
48640
  OPENCODE_STORAGE = getOpenCodeStorageDir();
48477
- MESSAGE_STORAGE = join8(OPENCODE_STORAGE, "message");
48478
- PART_STORAGE = join8(OPENCODE_STORAGE, "part");
48479
- SESSION_STORAGE = join8(OPENCODE_STORAGE, "session");
48641
+ MESSAGE_STORAGE = join10(OPENCODE_STORAGE, "message");
48642
+ PART_STORAGE = join10(OPENCODE_STORAGE, "part");
48643
+ SESSION_STORAGE = join10(OPENCODE_STORAGE, "session");
48480
48644
  });
48481
48645
 
48482
48646
  // src/shared/compaction-marker.ts
48483
- import { existsSync as existsSync7, readdirSync, readFileSync as readFileSync5 } from "fs";
48484
- import { join as join9 } from "path";
48647
+ import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync6 } from "fs";
48648
+ import { join as join11 } from "path";
48485
48649
  function isCompactionPart(part) {
48486
48650
  return typeof part === "object" && part !== null && part.type === "compaction";
48487
48651
  }
@@ -48495,20 +48659,20 @@ function isCompactionMessage(message) {
48495
48659
  return isCompactionAgent(message.info?.agent ?? message.agent) || hasCompactionPart(message.parts);
48496
48660
  }
48497
48661
  function getCompactionPartStorageDir(messageID) {
48498
- return join9(PART_STORAGE, messageID);
48662
+ return join11(PART_STORAGE, messageID);
48499
48663
  }
48500
48664
  function hasCompactionPartInStorage(messageID) {
48501
48665
  if (!messageID) {
48502
48666
  return false;
48503
48667
  }
48504
48668
  const partDir = getCompactionPartStorageDir(messageID);
48505
- if (!existsSync7(partDir)) {
48669
+ if (!existsSync9(partDir)) {
48506
48670
  return false;
48507
48671
  }
48508
48672
  try {
48509
48673
  return readdirSync(partDir).filter((fileName) => fileName.endsWith(".json")).some((fileName) => {
48510
48674
  try {
48511
- const content = readFileSync5(join9(partDir, fileName), "utf-8");
48675
+ const content = readFileSync6(join11(partDir, fileName), "utf-8");
48512
48676
  return isCompactionPart(JSON.parse(content));
48513
48677
  } catch {
48514
48678
  return false;
@@ -48541,23 +48705,23 @@ var init_hook_message_injector = __esm(() => {
48541
48705
  });
48542
48706
 
48543
48707
  // src/shared/opencode-message-dir.ts
48544
- import { existsSync as existsSync8, readdirSync as readdirSync2 } from "fs";
48545
- import { join as join10 } from "path";
48708
+ import { existsSync as existsSync10, readdirSync as readdirSync2 } from "fs";
48709
+ import { join as join12 } from "path";
48546
48710
  function getMessageDir(sessionID) {
48547
48711
  if (!sessionID.startsWith("ses_"))
48548
48712
  return null;
48549
48713
  if (/[/\\]|\.\./.test(sessionID))
48550
48714
  return null;
48551
- if (!existsSync8(MESSAGE_STORAGE))
48715
+ if (!existsSync10(MESSAGE_STORAGE))
48552
48716
  return null;
48553
- const directPath = join10(MESSAGE_STORAGE, sessionID);
48554
- if (existsSync8(directPath)) {
48717
+ const directPath = join12(MESSAGE_STORAGE, sessionID);
48718
+ if (existsSync10(directPath)) {
48555
48719
  return directPath;
48556
48720
  }
48557
48721
  try {
48558
48722
  for (const dir of readdirSync2(MESSAGE_STORAGE)) {
48559
- const sessionPath = join10(MESSAGE_STORAGE, dir, sessionID);
48560
- if (existsSync8(sessionPath)) {
48723
+ const sessionPath = join12(MESSAGE_STORAGE, dir, sessionID);
48724
+ if (existsSync10(sessionPath)) {
48561
48725
  return sessionPath;
48562
48726
  }
48563
48727
  }
@@ -48572,72 +48736,6 @@ var init_opencode_message_dir = __esm(() => {
48572
48736
  init_logger();
48573
48737
  });
48574
48738
 
48575
- // src/shared/agent-display-names.ts
48576
- function stripInvisibleAgentCharacters(agentName) {
48577
- return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
48578
- }
48579
- function stripAgentListSortPrefix(agentName) {
48580
- return stripInvisibleAgentCharacters(agentName);
48581
- }
48582
- function getAgentDisplayName(configKey) {
48583
- const exactMatch = AGENT_DISPLAY_NAMES[configKey];
48584
- if (exactMatch !== undefined)
48585
- return exactMatch;
48586
- const lowerKey = configKey.toLowerCase();
48587
- for (const [k, v] of Object.entries(AGENT_DISPLAY_NAMES)) {
48588
- if (k.toLowerCase() === lowerKey)
48589
- return v;
48590
- }
48591
- return configKey;
48592
- }
48593
- function resolveKnownAgentConfigKey(agentName) {
48594
- const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
48595
- const reversed = REVERSE_DISPLAY_NAMES[lower];
48596
- if (reversed !== undefined)
48597
- return reversed;
48598
- const legacy = LEGACY_DISPLAY_NAMES[lower];
48599
- if (legacy !== undefined)
48600
- return legacy;
48601
- if (AGENT_DISPLAY_NAMES[lower] !== undefined)
48602
- return lower;
48603
- return;
48604
- }
48605
- function getAgentConfigKey(agentName) {
48606
- const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
48607
- return resolveKnownAgentConfigKey(agentName) ?? lower;
48608
- }
48609
- var AGENT_DISPLAY_NAMES, INVISIBLE_AGENT_CHARACTERS_REGEX, REVERSE_DISPLAY_NAMES, LEGACY_DISPLAY_NAMES;
48610
- var init_agent_display_names = __esm(() => {
48611
- AGENT_DISPLAY_NAMES = {
48612
- sisyphus: "Sisyphus - Ultraworker",
48613
- hephaestus: "Hephaestus - Deep Agent",
48614
- prometheus: "Prometheus - Plan Builder",
48615
- atlas: "Atlas - Plan Executor",
48616
- "sisyphus-junior": "Sisyphus-Junior",
48617
- metis: "Metis - Plan Consultant",
48618
- momus: "Momus - Plan Critic",
48619
- athena: "Athena - Council",
48620
- "athena-junior": "Athena-Junior - Council",
48621
- oracle: "oracle",
48622
- librarian: "librarian",
48623
- explore: "explore",
48624
- "multimodal-looker": "multimodal-looker",
48625
- "council-member": "council-member"
48626
- };
48627
- INVISIBLE_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g;
48628
- REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
48629
- LEGACY_DISPLAY_NAMES = {
48630
- "sisyphus (ultraworker)": "sisyphus",
48631
- "hephaestus (deep agent)": "hephaestus",
48632
- "prometheus (plan builder)": "prometheus",
48633
- "atlas (plan executor)": "atlas",
48634
- "metis (plan consultant)": "metis",
48635
- "momus (plan critic)": "momus",
48636
- "athena (council)": "athena",
48637
- "athena-junior (council)": "athena-junior"
48638
- };
48639
- });
48640
-
48641
48739
  // src/shared/session-utils.ts
48642
48740
  var init_session_utils = __esm(() => {
48643
48741
  init_hook_message_injector();
@@ -48974,6 +49072,7 @@ var init_shared = __esm(() => {
48974
49072
  init_jsonc_parser();
48975
49073
  init_migration();
48976
49074
  init_opencode_config_dir();
49075
+ init_resolve_agent_definition_paths();
48977
49076
  init_opencode_version();
48978
49077
  init_opencode_storage_detection();
48979
49078
  init_external_plugin_detector();
@@ -49092,18 +49191,18 @@ var init_plugin_name_with_version = __esm(() => {
49092
49191
  });
49093
49192
 
49094
49193
  // src/cli/config-manager/backup-config.ts
49095
- import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync4 } from "fs";
49096
- import { dirname as dirname2 } from "path";
49194
+ import { copyFileSync as copyFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync5 } from "fs";
49195
+ import { dirname as dirname3 } from "path";
49097
49196
  function backupConfigFile(configPath) {
49098
- if (!existsSync9(configPath)) {
49197
+ if (!existsSync11(configPath)) {
49099
49198
  return { success: true };
49100
49199
  }
49101
49200
  const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
49102
49201
  const backupPath = `${configPath}.backup-${timestamp2}`;
49103
49202
  try {
49104
- const dir = dirname2(backupPath);
49105
- if (!existsSync9(dir)) {
49106
- mkdirSync4(dir, { recursive: true });
49203
+ const dir = dirname3(backupPath);
49204
+ if (!existsSync11(dir)) {
49205
+ mkdirSync5(dir, { recursive: true });
49107
49206
  }
49108
49207
  copyFileSync2(configPath, backupPath);
49109
49208
  return { success: true, backupPath };
@@ -49117,11 +49216,11 @@ function backupConfigFile(configPath) {
49117
49216
  var init_backup_config = () => {};
49118
49217
 
49119
49218
  // src/cli/config-manager/ensure-config-directory-exists.ts
49120
- import { existsSync as existsSync10, mkdirSync as mkdirSync5 } from "fs";
49219
+ import { existsSync as existsSync12, mkdirSync as mkdirSync6 } from "fs";
49121
49220
  function ensureConfigDirectoryExists() {
49122
49221
  const configDir = getConfigDir();
49123
- if (!existsSync10(configDir)) {
49124
- mkdirSync5(configDir, { recursive: true });
49222
+ if (!existsSync12(configDir)) {
49223
+ mkdirSync6(configDir, { recursive: true });
49125
49224
  }
49126
49225
  }
49127
49226
  var init_ensure_config_directory_exists = __esm(() => {
@@ -49158,14 +49257,14 @@ function formatErrorWithSuggestion(err, context) {
49158
49257
  }
49159
49258
 
49160
49259
  // src/cli/config-manager/opencode-config-format.ts
49161
- import { existsSync as existsSync11 } from "fs";
49260
+ import { existsSync as existsSync13 } from "fs";
49162
49261
  function detectConfigFormat() {
49163
49262
  const configJsonc = getConfigJsonc();
49164
49263
  const configJson = getConfigJson();
49165
- if (existsSync11(configJsonc)) {
49264
+ if (existsSync13(configJsonc)) {
49166
49265
  return { format: "jsonc", path: configJsonc };
49167
49266
  }
49168
- if (existsSync11(configJson)) {
49267
+ if (existsSync13(configJson)) {
49169
49268
  return { format: "json", path: configJson };
49170
49269
  }
49171
49270
  return { format: "none", path: configJson };
@@ -49175,33 +49274,33 @@ var init_opencode_config_format = __esm(() => {
49175
49274
  });
49176
49275
 
49177
49276
  // src/cli/config-manager/parse-opencode-config-file.ts
49178
- import { readFileSync as readFileSync6, statSync } from "fs";
49277
+ import { readFileSync as readFileSync7, statSync } from "fs";
49179
49278
  function isEmptyOrWhitespace(content) {
49180
49279
  return content.trim().length === 0;
49181
49280
  }
49182
- function parseOpenCodeConfigFileWithError(path4) {
49281
+ function parseOpenCodeConfigFileWithError(path5) {
49183
49282
  try {
49184
- const stat = statSync(path4);
49283
+ const stat = statSync(path5);
49185
49284
  if (stat.size === 0) {
49186
- return { config: null, error: `Config file is empty: ${path4}. Delete it or add valid JSON content.` };
49285
+ return { config: null, error: `Config file is empty: ${path5}. Delete it or add valid JSON content.` };
49187
49286
  }
49188
- const content = readFileSync6(path4, "utf-8");
49287
+ const content = readFileSync7(path5, "utf-8");
49189
49288
  if (isEmptyOrWhitespace(content)) {
49190
- return { config: null, error: `Config file contains only whitespace: ${path4}. Delete it or add valid JSON content.` };
49289
+ return { config: null, error: `Config file contains only whitespace: ${path5}. Delete it or add valid JSON content.` };
49191
49290
  }
49192
49291
  const config = parseJsonc(content);
49193
- if (config === null || config === undefined) {
49194
- return { config: null, error: `Config file parsed to null/undefined: ${path4}. Ensure it contains valid JSON.` };
49292
+ if (config == null) {
49293
+ return { config: null, error: `Config file parsed to null/undefined: ${path5}. Ensure it contains valid JSON.` };
49195
49294
  }
49196
49295
  if (typeof config !== "object" || Array.isArray(config)) {
49197
49296
  return {
49198
49297
  config: null,
49199
- error: `Config file must contain a JSON object, not ${Array.isArray(config) ? "an array" : typeof config}: ${path4}`
49298
+ error: `Config file must contain a JSON object, not ${Array.isArray(config) ? "an array" : typeof config}: ${path5}`
49200
49299
  };
49201
49300
  }
49202
49301
  return { config };
49203
49302
  } catch (err) {
49204
- return { config: null, error: formatErrorWithSuggestion(err, `parse config file ${path4}`) };
49303
+ return { config: null, error: formatErrorWithSuggestion(err, `parse config file ${path5}`) };
49205
49304
  }
49206
49305
  }
49207
49306
  var init_parse_opencode_config_file = __esm(() => {
@@ -49291,7 +49390,7 @@ function extractVersionFromPluginEntry(entry) {
49291
49390
  }
49292
49391
 
49293
49392
  // src/cli/config-manager/add-plugin-to-opencode-config.ts
49294
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "fs";
49393
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "fs";
49295
49394
  async function addPluginToOpenCodeConfig(currentVersion) {
49296
49395
  try {
49297
49396
  ensureConfigDirectoryExists();
@@ -49302,20 +49401,20 @@ async function addPluginToOpenCodeConfig(currentVersion) {
49302
49401
  error: formatErrorWithSuggestion(err, "create config directory")
49303
49402
  };
49304
49403
  }
49305
- const { format: format2, path: path4 } = detectConfigFormat();
49404
+ const { format: format2, path: path5 } = detectConfigFormat();
49306
49405
  const pluginEntry = await getPluginNameWithVersion(currentVersion, PLUGIN_NAME);
49307
49406
  try {
49308
49407
  if (format2 === "none") {
49309
49408
  const config2 = { plugin: [pluginEntry] };
49310
- writeFileSync3(path4, JSON.stringify(config2, null, 2) + `
49409
+ writeFileSync3(path5, JSON.stringify(config2, null, 2) + `
49311
49410
  `);
49312
- return { success: true, configPath: path4 };
49411
+ return { success: true, configPath: path5 };
49313
49412
  }
49314
- const parseResult = parseOpenCodeConfigFileWithError(path4);
49413
+ const parseResult = parseOpenCodeConfigFileWithError(path5);
49315
49414
  if (!parseResult.config) {
49316
49415
  return {
49317
49416
  success: false,
49318
- configPath: path4,
49417
+ configPath: path5,
49319
49418
  error: parseResult.error ?? "Failed to parse config file"
49320
49419
  };
49321
49420
  }
@@ -49331,28 +49430,24 @@ async function addPluginToOpenCodeConfig(currentVersion) {
49331
49430
  if (!compatibility.canUpgrade) {
49332
49431
  return {
49333
49432
  success: false,
49334
- configPath: path4,
49433
+ configPath: path5,
49335
49434
  error: compatibility.reason ?? "Version compatibility check failed"
49336
49435
  };
49337
49436
  }
49338
- const backupResult = backupConfigFile(path4);
49437
+ const backupResult = backupConfigFile(path5);
49339
49438
  if (!backupResult.success) {
49340
49439
  return {
49341
49440
  success: false,
49342
- configPath: path4,
49441
+ configPath: path5,
49343
49442
  error: `Failed to create backup: ${backupResult.error}`
49344
49443
  };
49345
49444
  }
49346
49445
  }
49347
49446
  const normalizedPlugins = [...otherPlugins];
49348
- if (canonicalEntries.length > 0 || legacyEntries.length > 0) {
49349
- normalizedPlugins.push(pluginEntry);
49350
- } else {
49351
- normalizedPlugins.push(pluginEntry);
49352
- }
49447
+ normalizedPlugins.push(pluginEntry);
49353
49448
  config.plugin = normalizedPlugins;
49354
49449
  if (format2 === "jsonc") {
49355
- const content = readFileSync7(path4, "utf-8");
49450
+ const content = readFileSync8(path5, "utf-8");
49356
49451
  const pluginArrayRegex = /((?:"plugin"|plugin)\s*:\s*)\[([\s\S]*?)\]/;
49357
49452
  const match = content.match(pluginArrayRegex);
49358
49453
  if (match) {
@@ -49361,21 +49456,21 @@ async function addPluginToOpenCodeConfig(currentVersion) {
49361
49456
  const newContent = content.replace(pluginArrayRegex, `$1[
49362
49457
  ${formattedPlugins}
49363
49458
  ]`);
49364
- writeFileSync3(path4, newContent);
49459
+ writeFileSync3(path5, newContent);
49365
49460
  } else {
49366
49461
  const newContent = content.replace(/(\{)/, `$1
49367
49462
  "plugin": ["${pluginEntry}"],`);
49368
- writeFileSync3(path4, newContent);
49463
+ writeFileSync3(path5, newContent);
49369
49464
  }
49370
49465
  } else {
49371
- writeFileSync3(path4, JSON.stringify(config, null, 2) + `
49466
+ writeFileSync3(path5, JSON.stringify(config, null, 2) + `
49372
49467
  `);
49373
49468
  }
49374
- return { success: true, configPath: path4 };
49469
+ return { success: true, configPath: path5 };
49375
49470
  } catch (err) {
49376
49471
  return {
49377
49472
  success: false,
49378
- configPath: path4,
49473
+ configPath: path5,
49379
49474
  error: formatErrorWithSuggestion(err, "update opencode config")
49380
49475
  };
49381
49476
  }
@@ -49442,6 +49537,7 @@ function toProviderAvailability(config) {
49442
49537
  zai: config.hasZaiCodingPlan,
49443
49538
  kimiForCoding: config.hasKimiForCoding,
49444
49539
  opencodeGo: config.hasOpencodeGo,
49540
+ vercelAiGateway: config.hasVercelAiGateway,
49445
49541
  isMaxPlan: config.isMax20
49446
49542
  };
49447
49543
  }
@@ -49454,20 +49550,74 @@ function isProviderAvailable(provider, availability) {
49454
49550
  opencode: availability.opencodeZen,
49455
49551
  "zai-coding-plan": availability.zai,
49456
49552
  "kimi-for-coding": availability.kimiForCoding,
49457
- "opencode-go": availability.opencodeGo
49553
+ "opencode-go": availability.opencodeGo,
49554
+ vercel: availability.vercelAiGateway
49458
49555
  };
49459
49556
  return mapping[provider] ?? false;
49460
49557
  }
49461
49558
 
49462
49559
  // src/cli/provider-model-id-transform.ts
49463
- var init_provider_model_id_transform = () => {};
49560
+ function inferSubProvider(model) {
49561
+ if (model.startsWith("claude-"))
49562
+ return "anthropic";
49563
+ if (model.startsWith("gpt-"))
49564
+ return "openai";
49565
+ if (model.startsWith("gemini-"))
49566
+ return "google";
49567
+ if (model.startsWith("grok-"))
49568
+ return "xai";
49569
+ if (model.startsWith("minimax-"))
49570
+ return "minimax";
49571
+ if (model.startsWith("kimi-"))
49572
+ return "moonshotai";
49573
+ if (model.startsWith("glm-"))
49574
+ return "zai";
49575
+ return;
49576
+ }
49577
+ function claudeVersionDot(model) {
49578
+ return model.replace(CLAUDE_VERSION_DOT, "claude-$1-$2.$3");
49579
+ }
49580
+ function applyGatewayTransforms(model) {
49581
+ return claudeVersionDot(model).replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview");
49582
+ }
49583
+ function transformModelForProvider2(provider, model) {
49584
+ if (provider === "vercel") {
49585
+ const slashIndex = model.indexOf("/");
49586
+ if (slashIndex !== -1) {
49587
+ const subProvider2 = model.substring(0, slashIndex);
49588
+ const subModel = model.substring(slashIndex + 1);
49589
+ return `${subProvider2}/${applyGatewayTransforms(subModel)}`;
49590
+ }
49591
+ const subProvider = inferSubProvider(model);
49592
+ if (subProvider) {
49593
+ return `${subProvider}/${applyGatewayTransforms(model)}`;
49594
+ }
49595
+ return model;
49596
+ }
49597
+ if (provider === "github-copilot") {
49598
+ return claudeVersionDot(model).replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
49599
+ }
49600
+ if (provider === "google") {
49601
+ return model.replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
49602
+ }
49603
+ if (provider === "anthropic") {
49604
+ return claudeVersionDot(model);
49605
+ }
49606
+ return model;
49607
+ }
49608
+ var CLAUDE_VERSION_DOT, GEMINI_31_PRO_PREVIEW, GEMINI_3_FLASH_PREVIEW;
49609
+ var init_provider_model_id_transform2 = __esm(() => {
49610
+ CLAUDE_VERSION_DOT = /claude-(\w+)-(\d+)-(\d+)/g;
49611
+ GEMINI_31_PRO_PREVIEW = /gemini-3\.1-pro(?!-)/g;
49612
+ GEMINI_3_FLASH_PREVIEW = /gemini-3-flash(?!-)/g;
49613
+ });
49464
49614
 
49465
49615
  // src/cli/fallback-chain-resolution.ts
49466
49616
  function resolveModelFromChain(fallbackChain, availability) {
49467
49617
  for (const entry of fallbackChain) {
49468
49618
  for (const provider of entry.providers) {
49469
49619
  if (isProviderAvailable(provider, availability)) {
49470
- const transformedModel = transformModelForProvider(provider, entry.model);
49620
+ const transformedModel = transformModelForProvider2(provider, entry.model);
49471
49621
  return {
49472
49622
  model: `${provider}/${transformedModel}`,
49473
49623
  variant: entry.variant
@@ -49494,13 +49644,13 @@ function isRequiredProviderAvailable(requiredProviders, availability) {
49494
49644
  }
49495
49645
  var init_fallback_chain_resolution = __esm(() => {
49496
49646
  init_model_fallback_requirements();
49497
- init_provider_model_id_transform();
49647
+ init_provider_model_id_transform2();
49498
49648
  });
49499
49649
 
49500
49650
  // src/cli/model-fallback.ts
49501
49651
  function toFallbackModelObject(entry, provider) {
49502
49652
  return {
49503
- model: `${provider}/${transformModelForProvider(provider, entry.model)}`,
49653
+ model: `${provider}/${transformModelForProvider2(provider, entry.model)}`,
49504
49654
  ...entry.variant ? { variant: entry.variant } : {},
49505
49655
  ...entry.reasoningEffort ? { reasoningEffort: entry.reasoningEffort } : {},
49506
49656
  ...entry.temperature !== undefined ? { temperature: entry.temperature } : {},
@@ -49541,7 +49691,7 @@ function attachAllFallbackModels(config, fallbackChain, availability) {
49541
49691
  }
49542
49692
  function generateModelConfig(config) {
49543
49693
  const avail = toProviderAvailability(config);
49544
- const hasAnyProvider = avail.native.claude || avail.native.openai || avail.native.gemini || avail.opencodeZen || avail.copilot || avail.zai || avail.kimiForCoding || avail.opencodeGo;
49694
+ const hasAnyProvider = avail.native.claude || avail.native.openai || avail.native.gemini || avail.opencodeZen || avail.copilot || avail.zai || avail.kimiForCoding || avail.opencodeGo || avail.vercelAiGateway;
49545
49695
  if (!hasAnyProvider) {
49546
49696
  return {
49547
49697
  $schema: SCHEMA_URL,
@@ -49558,6 +49708,8 @@ function generateModelConfig(config) {
49558
49708
  agentConfig = { model: "opencode-go/minimax-m2.7" };
49559
49709
  } else if (avail.zai) {
49560
49710
  agentConfig = { model: ZAI_MODEL };
49711
+ } else if (avail.vercelAiGateway) {
49712
+ agentConfig = { model: "vercel/minimax/minimax-m2.7" };
49561
49713
  }
49562
49714
  if (agentConfig) {
49563
49715
  agents[role] = attachAllFallbackModels(agentConfig, req.fallbackChain, avail);
@@ -49574,6 +49726,8 @@ function generateModelConfig(config) {
49574
49726
  agentConfig = { model: "opencode-go/minimax-m2.7" };
49575
49727
  } else if (avail.copilot) {
49576
49728
  agentConfig = { model: "github-copilot/gpt-5-mini" };
49729
+ } else if (avail.vercelAiGateway) {
49730
+ agentConfig = { model: "vercel/minimax/minimax-m2.7-highspeed" };
49577
49731
  } else {
49578
49732
  agentConfig = { model: "opencode/gpt-5-nano" };
49579
49733
  }
@@ -49637,7 +49791,7 @@ var init_model_fallback = __esm(() => {
49637
49791
  init_model_fallback_requirements();
49638
49792
  init_openai_only_model_catalog();
49639
49793
  init_fallback_chain_resolution();
49640
- init_provider_model_id_transform();
49794
+ init_provider_model_id_transform2();
49641
49795
  });
49642
49796
 
49643
49797
  // src/cli/config-manager/generate-omo-config.ts
@@ -49649,12 +49803,12 @@ var init_generate_omo_config = __esm(() => {
49649
49803
  });
49650
49804
 
49651
49805
  // src/shared/migrate-legacy-config-file.ts
49652
- import { existsSync as existsSync12, readFileSync as readFileSync8, renameSync as renameSync2, rmSync } from "fs";
49653
- import { join as join11, dirname as dirname3, basename } from "path";
49806
+ import { existsSync as existsSync14, readFileSync as readFileSync9, renameSync as renameSync2, rmSync } from "fs";
49807
+ import { join as join13, dirname as dirname4, basename as basename2 } from "path";
49654
49808
  function buildCanonicalPath(legacyPath) {
49655
- const dir = dirname3(legacyPath);
49656
- const ext = basename(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
49657
- return join11(dir, `${CONFIG_BASENAME}${ext}`);
49809
+ const dir = dirname4(legacyPath);
49810
+ const ext = basename2(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
49811
+ return join13(dir, `${CONFIG_BASENAME}${ext}`);
49658
49812
  }
49659
49813
  function archiveLegacyConfigFile(legacyPath) {
49660
49814
  const backupPath = `${legacyPath}.bak`;
@@ -49686,15 +49840,15 @@ function archiveLegacyConfigFile(legacyPath) {
49686
49840
  }
49687
49841
  }
49688
49842
  function migrateLegacyConfigFile(legacyPath) {
49689
- if (!existsSync12(legacyPath))
49843
+ if (!existsSync14(legacyPath))
49690
49844
  return false;
49691
- if (!basename(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
49845
+ if (!basename2(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
49692
49846
  return false;
49693
49847
  const canonicalPath = buildCanonicalPath(legacyPath);
49694
- if (existsSync12(canonicalPath))
49848
+ if (existsSync14(canonicalPath))
49695
49849
  return false;
49696
49850
  try {
49697
- const content = readFileSync8(legacyPath, "utf-8");
49851
+ const content = readFileSync9(legacyPath, "utf-8");
49698
49852
  writeFileAtomically(canonicalPath, content);
49699
49853
  const archivedLegacyConfig = archiveLegacyConfigFile(legacyPath);
49700
49854
  log("[migrateLegacyConfigFile] Migrated legacy config to canonical path", {
@@ -49702,7 +49856,7 @@ function migrateLegacyConfigFile(legacyPath) {
49702
49856
  to: canonicalPath,
49703
49857
  archivedLegacyConfig
49704
49858
  });
49705
- return archivedLegacyConfig;
49859
+ return true;
49706
49860
  } catch (error) {
49707
49861
  log("[migrateLegacyConfigFile] Failed to migrate legacy config file", { legacyPath, error });
49708
49862
  return false;
@@ -49732,8 +49886,8 @@ function deepMergeRecord(target, source) {
49732
49886
  }
49733
49887
 
49734
49888
  // src/cli/config-manager/write-omo-config.ts
49735
- import { existsSync as existsSync13, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
49736
- import { basename as basename2, dirname as dirname4, extname, join as join12 } from "path";
49889
+ import { existsSync as existsSync15, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
49890
+ import { basename as basename3, dirname as dirname5, extname, join as join14 } from "path";
49737
49891
  function isEmptyOrWhitespace2(content) {
49738
49892
  return content.trim().length === 0;
49739
49893
  }
@@ -49748,12 +49902,12 @@ function writeOmoConfig(installConfig) {
49748
49902
  };
49749
49903
  }
49750
49904
  const detectedConfigPath = getOmoConfigPath();
49751
- const canonicalConfigPath = join12(dirname4(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
49752
- const shouldMigrateLegacyPath = basename2(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
49753
- const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync13(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
49905
+ const canonicalConfigPath = join14(dirname5(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
49906
+ const shouldMigrateLegacyPath = basename3(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
49907
+ const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync15(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
49754
49908
  try {
49755
49909
  const newConfig = generateOmoConfig(installConfig);
49756
- if (existsSync13(omoConfigPath)) {
49910
+ if (existsSync15(omoConfigPath)) {
49757
49911
  const backupResult = backupConfigFile(omoConfigPath);
49758
49912
  if (!backupResult.success) {
49759
49913
  return {
@@ -49764,7 +49918,7 @@ function writeOmoConfig(installConfig) {
49764
49918
  }
49765
49919
  try {
49766
49920
  const stat = statSync2(omoConfigPath);
49767
- const content = readFileSync9(omoConfigPath, "utf-8");
49921
+ const content = readFileSync10(omoConfigPath, "utf-8");
49768
49922
  if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
49769
49923
  writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
49770
49924
  `);
@@ -49823,8 +49977,8 @@ function toReadableStream(stream) {
49823
49977
  function wrapNodeProcess(proc) {
49824
49978
  let resolveExited;
49825
49979
  let exitCode = null;
49826
- const exited = new Promise((resolve2) => {
49827
- resolveExited = resolve2;
49980
+ const exited = new Promise((resolve4) => {
49981
+ resolveExited = resolve4;
49828
49982
  });
49829
49983
  proc.on("exit", (code) => {
49830
49984
  exitCode = code ?? 1;
@@ -49907,20 +50061,21 @@ var init_opencode_binary = __esm(() => {
49907
50061
  });
49908
50062
 
49909
50063
  // src/cli/config-manager/detect-current-config.ts
49910
- import { existsSync as existsSync14, readFileSync as readFileSync10 } from "fs";
50064
+ import { existsSync as existsSync16, readFileSync as readFileSync11 } from "fs";
49911
50065
  function detectProvidersFromOmoConfig() {
49912
50066
  const omoConfigPath = getOmoConfigPath();
49913
- if (!existsSync14(omoConfigPath)) {
50067
+ if (!existsSync16(omoConfigPath)) {
49914
50068
  return {
49915
50069
  hasOpenAI: true,
49916
50070
  hasOpencodeZen: true,
49917
50071
  hasZaiCodingPlan: false,
49918
50072
  hasKimiForCoding: false,
49919
- hasOpencodeGo: false
50073
+ hasOpencodeGo: false,
50074
+ hasVercelAiGateway: false
49920
50075
  };
49921
50076
  }
49922
50077
  try {
49923
- const content = readFileSync10(omoConfigPath, "utf-8");
50078
+ const content = readFileSync11(omoConfigPath, "utf-8");
49924
50079
  const omoConfig = parseJsonc(content);
49925
50080
  if (!omoConfig || typeof omoConfig !== "object") {
49926
50081
  return {
@@ -49928,7 +50083,8 @@ function detectProvidersFromOmoConfig() {
49928
50083
  hasOpencodeZen: true,
49929
50084
  hasZaiCodingPlan: false,
49930
50085
  hasKimiForCoding: false,
49931
- hasOpencodeGo: false
50086
+ hasOpencodeGo: false,
50087
+ hasVercelAiGateway: false
49932
50088
  };
49933
50089
  }
49934
50090
  const configStr = JSON.stringify(omoConfig);
@@ -49937,14 +50093,16 @@ function detectProvidersFromOmoConfig() {
49937
50093
  const hasZaiCodingPlan = configStr.includes('"zai-coding-plan/');
49938
50094
  const hasKimiForCoding = configStr.includes('"kimi-for-coding/');
49939
50095
  const hasOpencodeGo = configStr.includes('"opencode-go/');
49940
- return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo };
50096
+ const hasVercelAiGateway = configStr.includes('"vercel/');
50097
+ return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo, hasVercelAiGateway };
49941
50098
  } catch {
49942
50099
  return {
49943
50100
  hasOpenAI: true,
49944
50101
  hasOpencodeZen: true,
49945
50102
  hasZaiCodingPlan: false,
49946
50103
  hasKimiForCoding: false,
49947
- hasOpencodeGo: false
50104
+ hasOpencodeGo: false,
50105
+ hasVercelAiGateway: false
49948
50106
  };
49949
50107
  }
49950
50108
  }
@@ -49966,13 +50124,14 @@ function detectCurrentConfig() {
49966
50124
  hasOpencodeZen: true,
49967
50125
  hasZaiCodingPlan: false,
49968
50126
  hasKimiForCoding: false,
49969
- hasOpencodeGo: false
50127
+ hasOpencodeGo: false,
50128
+ hasVercelAiGateway: false
49970
50129
  };
49971
- const { format: format2, path: path4 } = detectConfigFormat();
50130
+ const { format: format2, path: path5 } = detectConfigFormat();
49972
50131
  if (format2 === "none") {
49973
50132
  return result;
49974
50133
  }
49975
- const parseResult = parseOpenCodeConfigFileWithError(path4);
50134
+ const parseResult = parseOpenCodeConfigFileWithError(path5);
49976
50135
  if (!parseResult.config) {
49977
50136
  return result;
49978
50137
  }
@@ -49988,12 +50147,13 @@ function detectCurrentConfig() {
49988
50147
  }
49989
50148
  const providers = openCodeConfig.provider;
49990
50149
  result.hasGemini = providers ? "google" in providers : false;
49991
- const { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo } = detectProvidersFromOmoConfig();
50150
+ const { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo, hasVercelAiGateway } = detectProvidersFromOmoConfig();
49992
50151
  result.hasOpenAI = hasOpenAI;
49993
50152
  result.hasOpencodeZen = hasOpencodeZen;
49994
50153
  result.hasZaiCodingPlan = hasZaiCodingPlan;
49995
50154
  result.hasKimiForCoding = hasKimiForCoding;
49996
50155
  result.hasOpencodeGo = hasOpencodeGo;
50156
+ result.hasVercelAiGateway = hasVercelAiGateway;
49997
50157
  return result;
49998
50158
  }
49999
50159
  var init_detect_current_config = __esm(() => {
@@ -50004,10 +50164,10 @@ var init_detect_current_config = __esm(() => {
50004
50164
  });
50005
50165
 
50006
50166
  // src/cli/config-manager/bun-install.ts
50007
- import { existsSync as existsSync15 } from "fs";
50008
- import { join as join13 } from "path";
50167
+ import { existsSync as existsSync17 } from "fs";
50168
+ import { join as join15 } from "path";
50009
50169
  function getDefaultWorkspaceDir() {
50010
- return join13(getOpenCodeCacheDir(), "packages");
50170
+ return join15(getOpenCodeCacheDir(), "packages");
50011
50171
  }
50012
50172
  function readProcessOutput(stream) {
50013
50173
  if (!stream) {
@@ -50033,7 +50193,7 @@ async function runBunInstallWithDetails(options) {
50033
50193
  const outputMode = options?.outputMode ?? "pipe";
50034
50194
  const cacheDir = options?.workspaceDir ?? getDefaultWorkspaceDir();
50035
50195
  const packageJsonPath = `${cacheDir}/package.json`;
50036
- if (!existsSync15(packageJsonPath)) {
50196
+ if (!existsSync17(packageJsonPath)) {
50037
50197
  return {
50038
50198
  success: false,
50039
50199
  error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
@@ -50047,8 +50207,8 @@ async function runBunInstallWithDetails(options) {
50047
50207
  });
50048
50208
  const outputPromise = Promise.all([readProcessOutput(proc.stdout), readProcessOutput(proc.stderr)]).then(([stdout, stderr]) => ({ stdout, stderr }));
50049
50209
  let timeoutId;
50050
- const timeoutPromise = new Promise((resolve2) => {
50051
- timeoutId = setTimeout(() => resolve2("timeout"), BUN_INSTALL_TIMEOUT_MS);
50210
+ const timeoutPromise = new Promise((resolve4) => {
50211
+ timeoutId = setTimeout(() => resolve4("timeout"), BUN_INSTALL_TIMEOUT_MS);
50052
50212
  });
50053
50213
  const exitPromise = proc.exited.then(() => "completed");
50054
50214
  const result = await Promise.race([exitPromise, timeoutPromise]);
@@ -50175,7 +50335,7 @@ var require_windows = __commonJS((exports2, module) => {
50175
50335
  module.exports = isexe;
50176
50336
  isexe.sync = sync;
50177
50337
  var fs5 = __require("fs");
50178
- function checkPathExt(path5, options) {
50338
+ function checkPathExt(path6, options) {
50179
50339
  var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
50180
50340
  if (!pathext) {
50181
50341
  return true;
@@ -50186,25 +50346,25 @@ var require_windows = __commonJS((exports2, module) => {
50186
50346
  }
50187
50347
  for (var i2 = 0;i2 < pathext.length; i2++) {
50188
50348
  var p2 = pathext[i2].toLowerCase();
50189
- if (p2 && path5.substr(-p2.length).toLowerCase() === p2) {
50349
+ if (p2 && path6.substr(-p2.length).toLowerCase() === p2) {
50190
50350
  return true;
50191
50351
  }
50192
50352
  }
50193
50353
  return false;
50194
50354
  }
50195
- function checkStat(stat, path5, options) {
50355
+ function checkStat(stat, path6, options) {
50196
50356
  if (!stat.isSymbolicLink() && !stat.isFile()) {
50197
50357
  return false;
50198
50358
  }
50199
- return checkPathExt(path5, options);
50359
+ return checkPathExt(path6, options);
50200
50360
  }
50201
- function isexe(path5, options, cb) {
50202
- fs5.stat(path5, function(er, stat) {
50203
- cb(er, er ? false : checkStat(stat, path5, options));
50361
+ function isexe(path6, options, cb) {
50362
+ fs5.stat(path6, function(er, stat) {
50363
+ cb(er, er ? false : checkStat(stat, path6, options));
50204
50364
  });
50205
50365
  }
50206
- function sync(path5, options) {
50207
- return checkStat(fs5.statSync(path5), path5, options);
50366
+ function sync(path6, options) {
50367
+ return checkStat(fs5.statSync(path6), path6, options);
50208
50368
  }
50209
50369
  });
50210
50370
 
@@ -50213,13 +50373,13 @@ var require_mode = __commonJS((exports2, module) => {
50213
50373
  module.exports = isexe;
50214
50374
  isexe.sync = sync;
50215
50375
  var fs5 = __require("fs");
50216
- function isexe(path5, options, cb) {
50217
- fs5.stat(path5, function(er, stat) {
50376
+ function isexe(path6, options, cb) {
50377
+ fs5.stat(path6, function(er, stat) {
50218
50378
  cb(er, er ? false : checkStat(stat, options));
50219
50379
  });
50220
50380
  }
50221
- function sync(path5, options) {
50222
- return checkStat(fs5.statSync(path5), options);
50381
+ function sync(path6, options) {
50382
+ return checkStat(fs5.statSync(path6), options);
50223
50383
  }
50224
50384
  function checkStat(stat, options) {
50225
50385
  return stat.isFile() && checkMode(stat, options);
@@ -50250,7 +50410,7 @@ var require_isexe = __commonJS((exports2, module) => {
50250
50410
  }
50251
50411
  module.exports = isexe;
50252
50412
  isexe.sync = sync;
50253
- function isexe(path5, options, cb) {
50413
+ function isexe(path6, options, cb) {
50254
50414
  if (typeof options === "function") {
50255
50415
  cb = options;
50256
50416
  options = {};
@@ -50259,17 +50419,17 @@ var require_isexe = __commonJS((exports2, module) => {
50259
50419
  if (typeof Promise !== "function") {
50260
50420
  throw new TypeError("callback not provided");
50261
50421
  }
50262
- return new Promise(function(resolve2, reject) {
50263
- isexe(path5, options || {}, function(er, is) {
50422
+ return new Promise(function(resolve4, reject) {
50423
+ isexe(path6, options || {}, function(er, is) {
50264
50424
  if (er) {
50265
50425
  reject(er);
50266
50426
  } else {
50267
- resolve2(is);
50427
+ resolve4(is);
50268
50428
  }
50269
50429
  });
50270
50430
  });
50271
50431
  }
50272
- core3(path5, options || {}, function(er, is) {
50432
+ core3(path6, options || {}, function(er, is) {
50273
50433
  if (er) {
50274
50434
  if (er.code === "EACCES" || options && options.ignoreErrors) {
50275
50435
  er = null;
@@ -50279,9 +50439,9 @@ var require_isexe = __commonJS((exports2, module) => {
50279
50439
  cb(er, is);
50280
50440
  });
50281
50441
  }
50282
- function sync(path5, options) {
50442
+ function sync(path6, options) {
50283
50443
  try {
50284
- return core3.sync(path5, options || {});
50444
+ return core3.sync(path6, options || {});
50285
50445
  } catch (er) {
50286
50446
  if (options && options.ignoreErrors || er.code === "EACCES") {
50287
50447
  return false;
@@ -50295,7 +50455,7 @@ var require_isexe = __commonJS((exports2, module) => {
50295
50455
  // node_modules/which/which.js
50296
50456
  var require_which = __commonJS((exports2, module) => {
50297
50457
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
50298
- var path5 = __require("path");
50458
+ var path6 = __require("path");
50299
50459
  var COLON = isWindows ? ";" : ":";
50300
50460
  var isexe = require_isexe();
50301
50461
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -50326,27 +50486,27 @@ var require_which = __commonJS((exports2, module) => {
50326
50486
  opt = {};
50327
50487
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
50328
50488
  const found = [];
50329
- const step = (i2) => new Promise((resolve2, reject) => {
50489
+ const step = (i2) => new Promise((resolve4, reject) => {
50330
50490
  if (i2 === pathEnv.length)
50331
- return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
50491
+ return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
50332
50492
  const ppRaw = pathEnv[i2];
50333
50493
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
50334
- const pCmd = path5.join(pathPart, cmd);
50494
+ const pCmd = path6.join(pathPart, cmd);
50335
50495
  const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
50336
- resolve2(subStep(p2, i2, 0));
50496
+ resolve4(subStep(p2, i2, 0));
50337
50497
  });
50338
- const subStep = (p2, i2, ii) => new Promise((resolve2, reject) => {
50498
+ const subStep = (p2, i2, ii) => new Promise((resolve4, reject) => {
50339
50499
  if (ii === pathExt.length)
50340
- return resolve2(step(i2 + 1));
50500
+ return resolve4(step(i2 + 1));
50341
50501
  const ext = pathExt[ii];
50342
50502
  isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
50343
50503
  if (!er && is) {
50344
50504
  if (opt.all)
50345
50505
  found.push(p2 + ext);
50346
50506
  else
50347
- return resolve2(p2 + ext);
50507
+ return resolve4(p2 + ext);
50348
50508
  }
50349
- return resolve2(subStep(p2, i2, ii + 1));
50509
+ return resolve4(subStep(p2, i2, ii + 1));
50350
50510
  });
50351
50511
  });
50352
50512
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -50358,7 +50518,7 @@ var require_which = __commonJS((exports2, module) => {
50358
50518
  for (let i2 = 0;i2 < pathEnv.length; i2++) {
50359
50519
  const ppRaw = pathEnv[i2];
50360
50520
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
50361
- const pCmd = path5.join(pathPart, cmd);
50521
+ const pCmd = path6.join(pathPart, cmd);
50362
50522
  const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
50363
50523
  for (let j2 = 0;j2 < pathExt.length; j2++) {
50364
50524
  const cur = p2 + pathExt[j2];
@@ -50399,7 +50559,7 @@ var require_path_key = __commonJS((exports2, module) => {
50399
50559
 
50400
50560
  // node_modules/cross-spawn/lib/util/resolveCommand.js
50401
50561
  var require_resolveCommand = __commonJS((exports2, module) => {
50402
- var path5 = __require("path");
50562
+ var path6 = __require("path");
50403
50563
  var which = require_which();
50404
50564
  var getPathKey = require_path_key();
50405
50565
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -50416,7 +50576,7 @@ var require_resolveCommand = __commonJS((exports2, module) => {
50416
50576
  try {
50417
50577
  resolved = which.sync(parsed.command, {
50418
50578
  path: env[getPathKey({ env })],
50419
- pathExt: withoutPathExt ? path5.delimiter : undefined
50579
+ pathExt: withoutPathExt ? path6.delimiter : undefined
50420
50580
  });
50421
50581
  } catch (e2) {} finally {
50422
50582
  if (shouldSwitchCwd) {
@@ -50424,7 +50584,7 @@ var require_resolveCommand = __commonJS((exports2, module) => {
50424
50584
  }
50425
50585
  }
50426
50586
  if (resolved) {
50427
- resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
50587
+ resolved = path6.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
50428
50588
  }
50429
50589
  return resolved;
50430
50590
  }
@@ -50469,8 +50629,8 @@ var require_shebang_command = __commonJS((exports2, module) => {
50469
50629
  if (!match) {
50470
50630
  return null;
50471
50631
  }
50472
- const [path5, argument] = match[0].replace(/#! ?/, "").split(" ");
50473
- const binary2 = path5.split("/").pop();
50632
+ const [path6, argument] = match[0].replace(/#! ?/, "").split(" ");
50633
+ const binary2 = path6.split("/").pop();
50474
50634
  if (binary2 === "env") {
50475
50635
  return argument;
50476
50636
  }
@@ -50498,7 +50658,7 @@ var require_readShebang = __commonJS((exports2, module) => {
50498
50658
 
50499
50659
  // node_modules/cross-spawn/lib/parse.js
50500
50660
  var require_parse = __commonJS((exports2, module) => {
50501
- var path5 = __require("path");
50661
+ var path6 = __require("path");
50502
50662
  var resolveCommand = require_resolveCommand();
50503
50663
  var escape = require_escape();
50504
50664
  var readShebang = require_readShebang();
@@ -50523,7 +50683,7 @@ var require_parse = __commonJS((exports2, module) => {
50523
50683
  const needsShell = !isExecutableRegExp.test(commandFile);
50524
50684
  if (parsed.options.forceShell || needsShell) {
50525
50685
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
50526
- parsed.command = path5.normalize(parsed.command);
50686
+ parsed.command = path6.normalize(parsed.command);
50527
50687
  parsed.command = escape.command(parsed.command);
50528
50688
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
50529
50689
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -50627,21 +50787,21 @@ var require_cross_spawn = __commonJS((exports2, module) => {
50627
50787
  });
50628
50788
 
50629
50789
  // src/hooks/auto-update-checker/constants.ts
50630
- import * as path5 from "path";
50790
+ import * as path6 from "path";
50631
50791
  import * as os4 from "os";
50632
50792
  function getWindowsAppdataDir() {
50633
50793
  if (process.platform !== "win32")
50634
50794
  return null;
50635
- return process.env.APPDATA ?? path5.join(os4.homedir(), "AppData", "Roaming");
50795
+ return process.env.APPDATA ?? path6.join(os4.homedir(), "AppData", "Roaming");
50636
50796
  }
50637
50797
  function getUserConfigDir() {
50638
50798
  return getOpenCodeConfigDir({ binary: "opencode" });
50639
50799
  }
50640
50800
  function getUserOpencodeConfig() {
50641
- return path5.join(getUserConfigDir(), "opencode.json");
50801
+ return path6.join(getUserConfigDir(), "opencode.json");
50642
50802
  }
50643
50803
  function getUserOpencodeConfigJsonc() {
50644
- return path5.join(getUserConfigDir(), "opencode.jsonc");
50804
+ return path6.join(getUserConfigDir(), "opencode.jsonc");
50645
50805
  }
50646
50806
  var PACKAGE_NAME2, ACCEPTED_PACKAGE_NAMES2, NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_ROOT_DIR, CACHE_DIR, VERSION_FILE, INSTALLED_PACKAGE_JSON, INSTALLED_PACKAGE_JSON_CANDIDATES;
50647
50807
  var init_constants3 = __esm(() => {
@@ -50652,30 +50812,30 @@ var init_constants3 = __esm(() => {
50652
50812
  ACCEPTED_PACKAGE_NAMES2 = ACCEPTED_PACKAGE_NAMES;
50653
50813
  NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME2}/dist-tags`;
50654
50814
  CACHE_ROOT_DIR = getOpenCodeCacheDir();
50655
- CACHE_DIR = path5.join(CACHE_ROOT_DIR, "packages");
50656
- VERSION_FILE = path5.join(CACHE_ROOT_DIR, "version");
50657
- INSTALLED_PACKAGE_JSON = path5.join(CACHE_DIR, "node_modules", PACKAGE_NAME2, "package.json");
50658
- INSTALLED_PACKAGE_JSON_CANDIDATES = ACCEPTED_PACKAGE_NAMES2.map((name) => path5.join(CACHE_DIR, "node_modules", name, "package.json"));
50815
+ CACHE_DIR = path6.join(CACHE_ROOT_DIR, "packages");
50816
+ VERSION_FILE = path6.join(CACHE_ROOT_DIR, "version");
50817
+ INSTALLED_PACKAGE_JSON = path6.join(CACHE_DIR, "node_modules", PACKAGE_NAME2, "package.json");
50818
+ INSTALLED_PACKAGE_JSON_CANDIDATES = ACCEPTED_PACKAGE_NAMES2.map((name) => path6.join(CACHE_DIR, "node_modules", name, "package.json"));
50659
50819
  });
50660
50820
 
50661
50821
  // src/hooks/auto-update-checker/checker/config-paths.ts
50662
50822
  import * as os5 from "os";
50663
- import * as path6 from "path";
50823
+ import * as path7 from "path";
50664
50824
  function getConfigPaths(directory) {
50665
50825
  const userConfigDir = getUserConfigDir();
50666
50826
  const paths = [
50667
- path6.join(directory, ".opencode", "opencode.json"),
50668
- path6.join(directory, ".opencode", "opencode.jsonc"),
50827
+ path7.join(directory, ".opencode", "opencode.json"),
50828
+ path7.join(directory, ".opencode", "opencode.jsonc"),
50669
50829
  getUserOpencodeConfig(),
50670
50830
  getUserOpencodeConfigJsonc()
50671
50831
  ];
50672
50832
  if (process.platform === "win32") {
50673
- const crossPlatformDir = path6.join(os5.homedir(), ".config");
50833
+ const crossPlatformDir = path7.join(os5.homedir(), ".config");
50674
50834
  const appdataDir = getWindowsAppdataDir();
50675
50835
  if (appdataDir) {
50676
50836
  const alternateDir = userConfigDir === crossPlatformDir ? appdataDir : crossPlatformDir;
50677
- const alternateConfig = path6.join(alternateDir, "opencode", "opencode.json");
50678
- const alternateConfigJsonc = path6.join(alternateDir, "opencode", "opencode.jsonc");
50837
+ const alternateConfig = path7.join(alternateDir, "opencode", "opencode.json");
50838
+ const alternateConfigJsonc = path7.join(alternateDir, "opencode", "opencode.jsonc");
50679
50839
  if (!paths.includes(alternateConfig)) {
50680
50840
  paths.push(alternateConfig);
50681
50841
  }
@@ -50733,13 +50893,13 @@ var init_local_dev_path = __esm(() => {
50733
50893
 
50734
50894
  // src/hooks/auto-update-checker/checker/package-json-locator.ts
50735
50895
  import * as fs6 from "fs";
50736
- import * as path7 from "path";
50896
+ import * as path8 from "path";
50737
50897
  function findPackageJsonUp(startPath) {
50738
50898
  try {
50739
50899
  const stat = fs6.statSync(startPath);
50740
- let dir = stat.isDirectory() ? startPath : path7.dirname(startPath);
50900
+ let dir = stat.isDirectory() ? startPath : path8.dirname(startPath);
50741
50901
  for (let i2 = 0;i2 < 10; i2++) {
50742
- const pkgPath = path7.join(dir, "package.json");
50902
+ const pkgPath = path8.join(dir, "package.json");
50743
50903
  if (fs6.existsSync(pkgPath)) {
50744
50904
  try {
50745
50905
  const content = fs6.readFileSync(pkgPath, "utf-8");
@@ -50748,7 +50908,7 @@ function findPackageJsonUp(startPath) {
50748
50908
  return pkgPath;
50749
50909
  } catch {}
50750
50910
  }
50751
- const parent = path7.dirname(dir);
50911
+ const parent = path8.dirname(dir);
50752
50912
  if (parent === dir)
50753
50913
  break;
50754
50914
  dir = parent;
@@ -50823,7 +50983,7 @@ var init_plugin_entry = __esm(() => {
50823
50983
 
50824
50984
  // src/hooks/auto-update-checker/checker/cached-version.ts
50825
50985
  import * as fs9 from "fs";
50826
- import * as path8 from "path";
50986
+ import * as path9 from "path";
50827
50987
  import { fileURLToPath as fileURLToPath2 } from "url";
50828
50988
  function readPackageVersion(packageJsonPath) {
50829
50989
  const content = fs9.readFileSync(packageJsonPath, "utf-8");
@@ -50839,7 +50999,7 @@ function getCachedVersion() {
50839
50999
  } catch {}
50840
51000
  }
50841
51001
  try {
50842
- const currentDir = path8.dirname(fileURLToPath2(import.meta.url));
51002
+ const currentDir = path9.dirname(fileURLToPath2(import.meta.url));
50843
51003
  const pkgPath = findPackageJsonUp(currentDir);
50844
51004
  if (pkgPath) {
50845
51005
  return readPackageVersion(pkgPath);
@@ -50848,7 +51008,7 @@ function getCachedVersion() {
50848
51008
  log("[auto-update-checker] Failed to resolve version from current directory:", err);
50849
51009
  }
50850
51010
  try {
50851
- const execDir = path8.dirname(fs9.realpathSync(process.execPath));
51011
+ const execDir = path9.dirname(fs9.realpathSync(process.execPath));
50852
51012
  const pkgPath = findPackageJsonUp(execDir);
50853
51013
  if (pkgPath) {
50854
51014
  return readPackageVersion(pkgPath);
@@ -50991,7 +51151,7 @@ var init_check_for_update = __esm(() => {
50991
51151
  // src/hooks/auto-update-checker/checker/sync-package-json.ts
50992
51152
  import * as crypto from "crypto";
50993
51153
  import * as fs10 from "fs";
50994
- import * as path9 from "path";
51154
+ import * as path10 from "path";
50995
51155
  function safeUnlink(filePath) {
50996
51156
  try {
50997
51157
  fs10.unlinkSync(filePath);
@@ -51008,7 +51168,7 @@ function getIntentVersion(pluginInfo) {
51008
51168
  function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
51009
51169
  const tmpPath = `${cachePackageJsonPath}.${crypto.randomUUID()}`;
51010
51170
  try {
51011
- fs10.mkdirSync(path9.dirname(cachePackageJsonPath), { recursive: true });
51171
+ fs10.mkdirSync(path10.dirname(cachePackageJsonPath), { recursive: true });
51012
51172
  fs10.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
51013
51173
  fs10.renameSync(tmpPath, cachePackageJsonPath);
51014
51174
  return { synced: true, error: null };
@@ -51019,7 +51179,7 @@ function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
51019
51179
  }
51020
51180
  }
51021
51181
  function syncCachePackageJsonToIntent(pluginInfo) {
51022
- const cachePackageJsonPath = path9.join(CACHE_DIR, "package.json");
51182
+ const cachePackageJsonPath = path10.join(CACHE_DIR, "package.json");
51023
51183
  const intentVersion = getIntentVersion(pluginInfo);
51024
51184
  if (!fs10.existsSync(cachePackageJsonPath)) {
51025
51185
  log("[auto-update-checker] Cache package.json missing, creating workspace package.json", { intentVersion });
@@ -51095,7 +51255,7 @@ var init_checker = __esm(() => {
51095
51255
 
51096
51256
  // src/hooks/auto-update-checker/cache.ts
51097
51257
  import * as fs11 from "fs";
51098
- import * as path10 from "path";
51258
+ import * as path11 from "path";
51099
51259
  function stripTrailingCommas(json3) {
51100
51260
  return json3.replace(/,(\s*[}\]])/g, "$1");
51101
51261
  }
@@ -51124,8 +51284,8 @@ function deleteBinaryBunLock(lockPath) {
51124
51284
  }
51125
51285
  }
51126
51286
  function removeFromBunLock(packageName) {
51127
- const textLockPath = path10.join(CACHE_DIR, "bun.lock");
51128
- const binaryLockPath = path10.join(CACHE_DIR, "bun.lockb");
51287
+ const textLockPath = path11.join(CACHE_DIR, "bun.lock");
51288
+ const binaryLockPath = path11.join(CACHE_DIR, "bun.lockb");
51129
51289
  if (fs11.existsSync(textLockPath)) {
51130
51290
  return removeFromTextBunLock(textLockPath, packageName);
51131
51291
  }
@@ -51138,8 +51298,8 @@ function invalidatePackage(packageName = PACKAGE_NAME2) {
51138
51298
  try {
51139
51299
  const userConfigDir = getUserConfigDir();
51140
51300
  const pkgDirs = [
51141
- path10.join(userConfigDir, "node_modules", packageName),
51142
- path10.join(CACHE_DIR, "node_modules", packageName)
51301
+ path11.join(userConfigDir, "node_modules", packageName),
51302
+ path11.join(CACHE_DIR, "node_modules", packageName)
51143
51303
  ];
51144
51304
  let packageRemoved = false;
51145
51305
  let lockRemoved = false;
@@ -51199,8 +51359,8 @@ var init_update_toasts = __esm(() => {
51199
51359
  });
51200
51360
 
51201
51361
  // src/hooks/auto-update-checker/hook/background-update-check.ts
51202
- import { existsSync as existsSync27 } from "fs";
51203
- import { join as join26 } from "path";
51362
+ import { existsSync as existsSync29 } from "fs";
51363
+ import { join as join28 } from "path";
51204
51364
  function getCacheWorkspaceDir(deps) {
51205
51365
  return deps.join(deps.getOpenCodeCacheDir(), "packages");
51206
51366
  }
@@ -51318,8 +51478,8 @@ var init_background_update_check = __esm(() => {
51318
51478
  init_checker();
51319
51479
  init_update_toasts();
51320
51480
  defaultDeps = {
51321
- existsSync: existsSync27,
51322
- join: join26,
51481
+ existsSync: existsSync29,
51482
+ join: join28,
51323
51483
  runBunInstallWithDetails,
51324
51484
  log,
51325
51485
  getOpenCodeCacheDir,
@@ -51472,7 +51632,7 @@ async function showSpinnerToast(ctx, version3, message) {
51472
51632
  duration: frameInterval + 50
51473
51633
  }
51474
51634
  }).catch(() => {});
51475
- await new Promise((resolve2) => setTimeout(resolve2, frameInterval));
51635
+ await new Promise((resolve4) => setTimeout(resolve4, frameInterval));
51476
51636
  }
51477
51637
  }
51478
51638
  var SISYPHUS_SPINNER;
@@ -51612,7 +51772,7 @@ var {
51612
51772
  // package.json
51613
51773
  var package_default = {
51614
51774
  name: "oh-my-opencode",
51615
- version: "3.17.1",
51775
+ version: "3.17.3",
51616
51776
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
51617
51777
  main: "./dist/index.js",
51618
51778
  types: "dist/index.d.ts",
@@ -51691,17 +51851,17 @@ var package_default = {
51691
51851
  typescript: "^5.7.3"
51692
51852
  },
51693
51853
  optionalDependencies: {
51694
- "oh-my-opencode-darwin-arm64": "3.17.1",
51695
- "oh-my-opencode-darwin-x64": "3.17.1",
51696
- "oh-my-opencode-darwin-x64-baseline": "3.17.1",
51697
- "oh-my-opencode-linux-arm64": "3.17.1",
51698
- "oh-my-opencode-linux-arm64-musl": "3.17.1",
51699
- "oh-my-opencode-linux-x64": "3.17.1",
51700
- "oh-my-opencode-linux-x64-baseline": "3.17.1",
51701
- "oh-my-opencode-linux-x64-musl": "3.17.1",
51702
- "oh-my-opencode-linux-x64-musl-baseline": "3.17.1",
51703
- "oh-my-opencode-windows-x64": "3.17.1",
51704
- "oh-my-opencode-windows-x64-baseline": "3.17.1"
51854
+ "oh-my-opencode-darwin-arm64": "3.17.3",
51855
+ "oh-my-opencode-darwin-x64": "3.17.3",
51856
+ "oh-my-opencode-darwin-x64-baseline": "3.17.3",
51857
+ "oh-my-opencode-linux-arm64": "3.17.3",
51858
+ "oh-my-opencode-linux-arm64-musl": "3.17.3",
51859
+ "oh-my-opencode-linux-x64": "3.17.3",
51860
+ "oh-my-opencode-linux-x64-baseline": "3.17.3",
51861
+ "oh-my-opencode-linux-x64-musl": "3.17.3",
51862
+ "oh-my-opencode-linux-x64-musl-baseline": "3.17.3",
51863
+ "oh-my-opencode-windows-x64": "3.17.3",
51864
+ "oh-my-opencode-windows-x64-baseline": "3.17.3"
51705
51865
  },
51706
51866
  overrides: {},
51707
51867
  trustedDependencies: [
@@ -51746,6 +51906,7 @@ function formatConfigSummary(config) {
51746
51906
  lines.push(formatProvider("OpenCode Zen", config.hasOpencodeZen, "opencode/ models"));
51747
51907
  lines.push(formatProvider("Z.ai Coding Plan", config.hasZaiCodingPlan, "Librarian/Multimodal"));
51748
51908
  lines.push(formatProvider("Kimi For Coding", config.hasKimiForCoding, "Sisyphus/Prometheus fallback"));
51909
+ lines.push(formatProvider("Vercel AI Gateway", config.hasVercelAiGateway, "universal proxy"));
51749
51910
  lines.push("");
51750
51911
  lines.push(import_picocolors.default.dim("\u2500".repeat(40)));
51751
51912
  lines.push("");
@@ -51829,6 +51990,9 @@ function validateNonTuiArgs(args) {
51829
51990
  if (args.kimiForCoding !== undefined && !["no", "yes"].includes(args.kimiForCoding)) {
51830
51991
  errors.push(`Invalid --kimi-for-coding value: ${args.kimiForCoding} (expected: no, yes)`);
51831
51992
  }
51993
+ if (args.vercelAiGateway !== undefined && !["no", "yes"].includes(args.vercelAiGateway)) {
51994
+ errors.push(`Invalid --vercel-ai-gateway value: ${args.vercelAiGateway} (expected: no, yes)`);
51995
+ }
51832
51996
  return { valid: errors.length === 0, errors };
51833
51997
  }
51834
51998
  function argsToConfig(args) {
@@ -51841,7 +52005,8 @@ function argsToConfig(args) {
51841
52005
  hasOpencodeZen: args.opencodeZen === "yes",
51842
52006
  hasZaiCodingPlan: args.zaiCodingPlan === "yes",
51843
52007
  hasKimiForCoding: args.kimiForCoding === "yes",
51844
- hasOpencodeGo: args.opencodeGo === "yes"
52008
+ hasOpencodeGo: args.opencodeGo === "yes",
52009
+ hasVercelAiGateway: args.vercelAiGateway === "yes"
51845
52010
  };
51846
52011
  }
51847
52012
  function detectedToInitialValues(detected) {
@@ -51857,7 +52022,8 @@ function detectedToInitialValues(detected) {
51857
52022
  opencodeZen: detected.hasOpencodeZen ? "yes" : "no",
51858
52023
  zaiCodingPlan: detected.hasZaiCodingPlan ? "yes" : "no",
51859
52024
  kimiForCoding: detected.hasKimiForCoding ? "yes" : "no",
51860
- opencodeGo: detected.hasOpencodeGo ? "yes" : "no"
52025
+ opencodeGo: detected.hasOpencodeGo ? "yes" : "no",
52026
+ vercelAiGateway: detected.hasVercelAiGateway ? "yes" : "no"
51861
52027
  };
51862
52028
  }
51863
52029
 
@@ -51916,7 +52082,7 @@ import os3 from "os";
51916
52082
  import { createHash } from "crypto";
51917
52083
 
51918
52084
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
51919
- import { dirname as dirname5, posix, sep } from "path";
52085
+ import { dirname as dirname6, posix, sep } from "path";
51920
52086
  function createModulerModifier() {
51921
52087
  const getModuleFromFileName = createGetModuleFromFilename();
51922
52088
  return async (frames) => {
@@ -51925,7 +52091,7 @@ function createModulerModifier() {
51925
52091
  return frames;
51926
52092
  };
51927
52093
  }
51928
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname5(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
52094
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname6(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
51929
52095
  const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
51930
52096
  return (filename) => {
51931
52097
  if (!filename)
@@ -51947,8 +52113,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname5(proce
51947
52113
  return decodedFile;
51948
52114
  };
51949
52115
  }
51950
- function normalizeWindowsPath(path4) {
51951
- return path4.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
52116
+ function normalizeWindowsPath(path5) {
52117
+ return path5.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
51952
52118
  }
51953
52119
 
51954
52120
  // node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -54263,15 +54429,15 @@ async function addSourceContext(frames) {
54263
54429
  LRU_FILE_CONTENTS_CACHE.reduce();
54264
54430
  return frames;
54265
54431
  }
54266
- function getContextLinesFromFile(path4, ranges, output) {
54267
- return new Promise((resolve2) => {
54268
- const stream = createReadStream(path4);
54432
+ function getContextLinesFromFile(path5, ranges, output) {
54433
+ return new Promise((resolve4) => {
54434
+ const stream = createReadStream(path5);
54269
54435
  const lineReaded = createInterface({
54270
54436
  input: stream
54271
54437
  });
54272
54438
  function destroyStreamAndResolve() {
54273
54439
  stream.destroy();
54274
- resolve2();
54440
+ resolve4();
54275
54441
  }
54276
54442
  let lineNumber = 0;
54277
54443
  let currentRangeIndex = 0;
@@ -54281,7 +54447,7 @@ function getContextLinesFromFile(path4, ranges, output) {
54281
54447
  let rangeStart = range[0];
54282
54448
  let rangeEnd = range[1];
54283
54449
  function onStreamError() {
54284
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path4, 1);
54450
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path5, 1);
54285
54451
  lineReaded.close();
54286
54452
  lineReaded.removeAllListeners();
54287
54453
  destroyStreamAndResolve();
@@ -54349,8 +54515,8 @@ function clearLineContext(frame) {
54349
54515
  delete frame.context_line;
54350
54516
  delete frame.post_context;
54351
54517
  }
54352
- function shouldSkipContextLinesForFile(path4) {
54353
- return path4.startsWith("node:") || path4.endsWith(".min.js") || path4.endsWith(".min.cjs") || path4.endsWith(".min.mjs") || path4.startsWith("data:");
54518
+ function shouldSkipContextLinesForFile(path5) {
54519
+ return path5.startsWith("node:") || path5.endsWith(".min.js") || path5.endsWith(".min.cjs") || path5.endsWith(".min.mjs") || path5.startsWith("data:");
54354
54520
  }
54355
54521
  function shouldSkipContextLinesForFrame(frame) {
54356
54522
  if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO)
@@ -55511,9 +55677,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
55511
55677
  if (this.disabled || this.optedOut)
55512
55678
  return;
55513
55679
  if (!this._waitUntilCycle) {
55514
- let resolve2;
55680
+ let resolve4;
55515
55681
  const promise = new Promise((r) => {
55516
- resolve2 = r;
55682
+ resolve4 = r;
55517
55683
  });
55518
55684
  try {
55519
55685
  waitUntil(promise);
@@ -55521,7 +55687,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
55521
55687
  return;
55522
55688
  }
55523
55689
  this._waitUntilCycle = {
55524
- resolve: resolve2,
55690
+ resolve: resolve4,
55525
55691
  startedAt: Date.now(),
55526
55692
  timer: undefined
55527
55693
  };
@@ -55547,11 +55713,11 @@ class PostHogBackendClient extends PostHogCoreStateless {
55547
55713
  return cycle?.resolve;
55548
55714
  }
55549
55715
  async resolveWaitUntilFlush() {
55550
- const resolve2 = this._consumeWaitUntilCycle();
55716
+ const resolve4 = this._consumeWaitUntilCycle();
55551
55717
  try {
55552
55718
  await super.flush();
55553
55719
  } catch {} finally {
55554
- resolve2?.();
55720
+ resolve4?.();
55555
55721
  }
55556
55722
  }
55557
55723
  getPersistedProperty(key) {
@@ -55651,15 +55817,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
55651
55817
  return true;
55652
55818
  if (this.featureFlagsPoller === undefined)
55653
55819
  return false;
55654
- return new Promise((resolve2) => {
55820
+ return new Promise((resolve4) => {
55655
55821
  const timeout = setTimeout(() => {
55656
55822
  cleanup();
55657
- resolve2(false);
55823
+ resolve4(false);
55658
55824
  }, timeoutMs);
55659
55825
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
55660
55826
  clearTimeout(timeout);
55661
55827
  cleanup();
55662
- resolve2(count > 0);
55828
+ resolve4(count > 0);
55663
55829
  });
55664
55830
  });
55665
55831
  }
@@ -56003,13 +56169,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
56003
56169
  this.context?.enter(data, options);
56004
56170
  }
56005
56171
  async _shutdown(shutdownTimeoutMs) {
56006
- const resolve2 = this._consumeWaitUntilCycle();
56172
+ const resolve4 = this._consumeWaitUntilCycle();
56007
56173
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
56008
56174
  this.errorTracking.shutdown();
56009
56175
  try {
56010
56176
  return await super._shutdown(shutdownTimeoutMs);
56011
56177
  } finally {
56012
- resolve2?.();
56178
+ resolve4?.();
56013
56179
  }
56014
56180
  }
56015
56181
  async _requestRemoteConfigPayload(flagKey) {
@@ -56363,11 +56529,11 @@ init_data_path();
56363
56529
  init_logger();
56364
56530
  init_plugin_identity();
56365
56531
  init_write_file_atomically();
56366
- import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as readFileSync11 } from "fs";
56367
- import { join as join14 } from "path";
56532
+ import { existsSync as existsSync18, mkdirSync as mkdirSync7, readFileSync as readFileSync12 } from "fs";
56533
+ import { join as join16 } from "path";
56368
56534
  var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
56369
56535
  function getPostHogActivityStateFilePath() {
56370
- return join14(getDataDir(), CACHE_DIR_NAME, POSTHOG_ACTIVITY_STATE_FILE);
56536
+ return join16(getDataDir(), CACHE_DIR_NAME, POSTHOG_ACTIVITY_STATE_FILE);
56371
56537
  }
56372
56538
  function getUtcDayString(date) {
56373
56539
  return date.toISOString().slice(0, 10);
@@ -56380,11 +56546,11 @@ function isPostHogActivityState(value) {
56380
56546
  }
56381
56547
  function readPostHogActivityState() {
56382
56548
  const stateFilePath = getPostHogActivityStateFilePath();
56383
- if (!existsSync16(stateFilePath)) {
56549
+ if (!existsSync18(stateFilePath)) {
56384
56550
  return {};
56385
56551
  }
56386
56552
  try {
56387
- const content = readFileSync11(stateFilePath, "utf-8");
56553
+ const content = readFileSync12(stateFilePath, "utf-8");
56388
56554
  const parsed = JSON.parse(content);
56389
56555
  if (!isPostHogActivityState(parsed)) {
56390
56556
  return {};
@@ -56401,7 +56567,7 @@ function readPostHogActivityState() {
56401
56567
  function writePostHogActivityState(nextState) {
56402
56568
  const stateFilePath = getPostHogActivityStateFilePath();
56403
56569
  try {
56404
- mkdirSync6(join14(getDataDir(), CACHE_DIR_NAME), { recursive: true });
56570
+ mkdirSync7(join16(getDataDir(), CACHE_DIR_NAME), { recursive: true });
56405
56571
  writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
56406
56572
  `);
56407
56573
  } catch (error) {
@@ -56493,11 +56659,16 @@ function createPostHogClient(source, options) {
56493
56659
  if (shouldDisablePostHog() || !hasPostHogApiKey()) {
56494
56660
  return NO_OP_POSTHOG;
56495
56661
  }
56496
- const configuredClient = new PostHog(getPostHogApiKey(), {
56497
- ...options,
56498
- host: getPostHogHost(),
56499
- disableGeoip: false
56500
- });
56662
+ let configuredClient;
56663
+ try {
56664
+ configuredClient = new PostHog(getPostHogApiKey(), {
56665
+ ...options,
56666
+ host: getPostHogHost(),
56667
+ disableGeoip: false
56668
+ });
56669
+ } catch {
56670
+ return NO_OP_POSTHOG;
56671
+ }
56501
56672
  const sharedProperties = getSharedProperties(source);
56502
56673
  return {
56503
56674
  capture: (message) => {
@@ -56548,7 +56719,7 @@ function getPostHogDistinctId() {
56548
56719
  }
56549
56720
  function createCliPostHog() {
56550
56721
  return createPostHogClient("cli", {
56551
- enableExceptionAutocapture: true,
56722
+ enableExceptionAutocapture: false,
56552
56723
  flushAt: 1,
56553
56724
  flushInterval: 0
56554
56725
  });
@@ -56630,7 +56801,7 @@ async function runCliInstaller(args, version2) {
56630
56801
  if (!config.hasClaude) {
56631
56802
  printInfo("Note: Sisyphus agent performs best with Claude Opus 4.5+. " + "Other models work but may have reduced orchestration quality.");
56632
56803
  }
56633
- if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen) {
56804
+ if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen && !config.hasVercelAiGateway) {
56634
56805
  printWarning("No model providers configured. Using opencode/big-pickle as fallback.");
56635
56806
  }
56636
56807
  console.log(`${SYMBOLS.star} ${import_picocolors3.default.bold(import_picocolors3.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
@@ -57357,6 +57528,16 @@ async function promptInstallConfig(detected) {
57357
57528
  });
57358
57529
  if (!opencodeGo)
57359
57530
  return null;
57531
+ const vercelAiGateway = await selectOrCancel({
57532
+ message: "Do you have a Vercel AI Gateway API key?",
57533
+ options: [
57534
+ { value: "no", label: "No", hint: "Will use other configured providers" },
57535
+ { value: "yes", label: "Yes", hint: "Universal proxy for OpenAI, Anthropic, Google, etc." }
57536
+ ],
57537
+ initialValue: initial.vercelAiGateway
57538
+ });
57539
+ if (!vercelAiGateway)
57540
+ return null;
57360
57541
  return {
57361
57542
  hasClaude: claude !== "no",
57362
57543
  isMax20: claude === "max20",
@@ -57366,7 +57547,8 @@ async function promptInstallConfig(detected) {
57366
57547
  hasOpencodeZen: opencodeZen === "yes",
57367
57548
  hasZaiCodingPlan: zaiCodingPlan === "yes",
57368
57549
  hasKimiForCoding: kimiForCoding === "yes",
57369
- hasOpencodeGo: opencodeGo === "yes"
57550
+ hasOpencodeGo: opencodeGo === "yes",
57551
+ hasVercelAiGateway: vercelAiGateway === "yes"
57370
57552
  };
57371
57553
  }
57372
57554
 
@@ -57423,7 +57605,7 @@ async function runTuiInstaller(args, version2) {
57423
57605
  M2.info(`${import_picocolors5.default.bold("Note:")} Sisyphus agent performs best with Claude Opus 4.5+.
57424
57606
  ` + `Other models work but may have reduced orchestration quality.`);
57425
57607
  }
57426
- if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen) {
57608
+ if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen && !config.hasVercelAiGateway) {
57427
57609
  M2.warn("No model providers configured. Using opencode/big-pickle as fallback.");
57428
57610
  }
57429
57611
  Me(formatConfigSummary(config), isUpdate ? "Updated Configuration" : "Installation Complete");
@@ -57649,10 +57831,10 @@ function formatToolHeader(toolName, input) {
57649
57831
  };
57650
57832
  }
57651
57833
  if (toolName === "list") {
57652
- const path4 = str2(input.path);
57834
+ const path5 = str2(input.path);
57653
57835
  return {
57654
57836
  icon: "\u2192",
57655
- title: path4 ? `List ${path4}` : "List"
57837
+ title: path5 ? `List ${path5}` : "List"
57656
57838
  };
57657
57839
  }
57658
57840
  if (toolName === "read") {
@@ -58161,7 +58343,7 @@ async function processEvents(ctx, stream, state) {
58161
58343
  }
58162
58344
  // src/plugin-config.ts
58163
58345
  import * as fs4 from "fs";
58164
- import * as path4 from "path";
58346
+ import * as path5 from "path";
58165
58347
 
58166
58348
  // node_modules/zod/v4/classic/external.js
58167
58349
  var exports_external = {};
@@ -58928,10 +59110,10 @@ function mergeDefs(...defs) {
58928
59110
  function cloneDef(schema2) {
58929
59111
  return mergeDefs(schema2._zod.def);
58930
59112
  }
58931
- function getElementAtPath(obj, path4) {
58932
- if (!path4)
59113
+ function getElementAtPath(obj, path5) {
59114
+ if (!path5)
58933
59115
  return obj;
58934
- return path4.reduce((acc, key) => acc?.[key], obj);
59116
+ return path5.reduce((acc, key) => acc?.[key], obj);
58935
59117
  }
58936
59118
  function promiseAllObject(promisesObj) {
58937
59119
  const keys = Object.keys(promisesObj);
@@ -59312,11 +59494,11 @@ function aborted(x2, startIndex = 0) {
59312
59494
  }
59313
59495
  return false;
59314
59496
  }
59315
- function prefixIssues(path4, issues) {
59497
+ function prefixIssues(path5, issues) {
59316
59498
  return issues.map((iss) => {
59317
59499
  var _a;
59318
59500
  (_a = iss).path ?? (_a.path = []);
59319
- iss.path.unshift(path4);
59501
+ iss.path.unshift(path5);
59320
59502
  return iss;
59321
59503
  });
59322
59504
  }
@@ -59499,7 +59681,7 @@ function formatError2(error, mapper = (issue2) => issue2.message) {
59499
59681
  }
59500
59682
  function treeifyError(error, mapper = (issue2) => issue2.message) {
59501
59683
  const result = { errors: [] };
59502
- const processError = (error2, path4 = []) => {
59684
+ const processError = (error2, path5 = []) => {
59503
59685
  var _a, _b;
59504
59686
  for (const issue2 of error2.issues) {
59505
59687
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -59509,7 +59691,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
59509
59691
  } else if (issue2.code === "invalid_element") {
59510
59692
  processError({ issues: issue2.issues }, issue2.path);
59511
59693
  } else {
59512
- const fullpath = [...path4, ...issue2.path];
59694
+ const fullpath = [...path5, ...issue2.path];
59513
59695
  if (fullpath.length === 0) {
59514
59696
  result.errors.push(mapper(issue2));
59515
59697
  continue;
@@ -59541,8 +59723,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
59541
59723
  }
59542
59724
  function toDotPath(_path) {
59543
59725
  const segs = [];
59544
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
59545
- for (const seg of path4) {
59726
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
59727
+ for (const seg of path5) {
59546
59728
  if (typeof seg === "number")
59547
59729
  segs.push(`[${seg}]`);
59548
59730
  else if (typeof seg === "symbol")
@@ -71289,13 +71471,13 @@ function resolveRef(ref, ctx) {
71289
71471
  if (!ref.startsWith("#")) {
71290
71472
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
71291
71473
  }
71292
- const path4 = ref.slice(1).split("/").filter(Boolean);
71293
- if (path4.length === 0) {
71474
+ const path5 = ref.slice(1).split("/").filter(Boolean);
71475
+ if (path5.length === 0) {
71294
71476
  return ctx.rootSchema;
71295
71477
  }
71296
71478
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
71297
- if (path4[0] === defsKey) {
71298
- const key = path4[1];
71479
+ if (path5[0] === defsKey) {
71480
+ const key = path5[1];
71299
71481
  if (!key || !ctx.defs[key]) {
71300
71482
  throw new Error(`Reference not found: ${ref}`);
71301
71483
  }
@@ -72047,6 +72229,10 @@ var NotificationConfigSchema = exports_external.object({
72047
72229
  var McpNameSchema = exports_external.enum(["websearch", "context7", "grep_app"]);
72048
72230
  var AnyMcpNameSchema = exports_external.string().min(1);
72049
72231
 
72232
+ // src/config/schema/agent-definitions.ts
72233
+ var AgentDefinitionPathSchema = exports_external.string().min(1);
72234
+ var AgentDefinitionsConfigSchema = exports_external.array(AgentDefinitionPathSchema).optional();
72235
+
72050
72236
  // src/config/schema/openclaw.ts
72051
72237
  var OpenClawGatewaySchema = exports_external.object({
72052
72238
  type: exports_external.enum(["http", "command"]).default("http"),
@@ -72188,6 +72374,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
72188
72374
  $schema: exports_external.string().optional(),
72189
72375
  new_task_system_enabled: exports_external.boolean().optional(),
72190
72376
  default_run_agent: exports_external.string().optional(),
72377
+ agent_definitions: AgentDefinitionsConfigSchema,
72191
72378
  disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
72192
72379
  disabled_agents: exports_external.array(exports_external.string()).optional(),
72193
72380
  disabled_skills: exports_external.array(BuiltinSkillNameSchema).optional(),
@@ -72228,6 +72415,22 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
72228
72415
  init_shared();
72229
72416
  init_migrate_legacy_config_file();
72230
72417
  init_plugin_identity();
72418
+ function loadExplicitGitMasterOverrides(configPath) {
72419
+ try {
72420
+ if (!fs4.existsSync(configPath)) {
72421
+ return;
72422
+ }
72423
+ const content = fs4.readFileSync(configPath, "utf-8");
72424
+ const rawConfig = parseJsonc(content);
72425
+ const gitMaster = rawConfig.git_master;
72426
+ if (gitMaster && typeof gitMaster === "object" && !Array.isArray(gitMaster)) {
72427
+ return gitMaster;
72428
+ }
72429
+ } catch {
72430
+ return;
72431
+ }
72432
+ return;
72433
+ }
72231
72434
  var PARTIAL_STRING_ARRAY_KEYS = new Set([
72232
72435
  "disabled_mcps",
72233
72436
  "disabled_agents",
@@ -72235,7 +72438,8 @@ var PARTIAL_STRING_ARRAY_KEYS = new Set([
72235
72438
  "disabled_hooks",
72236
72439
  "disabled_commands",
72237
72440
  "disabled_tools",
72238
- "mcp_env_allowlist"
72441
+ "mcp_env_allowlist",
72442
+ "agent_definitions"
72239
72443
  ]);
72240
72444
  function parseConfigPartially(rawConfig) {
72241
72445
  const fullResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
@@ -72307,6 +72511,12 @@ function mergeConfigs(base, override) {
72307
72511
  ...override,
72308
72512
  agents: deepMerge(base.agents, override.agents),
72309
72513
  categories: deepMerge(base.categories, override.categories),
72514
+ agent_definitions: [
72515
+ ...new Set([
72516
+ ...base.agent_definitions ?? [],
72517
+ ...override.agent_definitions ?? []
72518
+ ])
72519
+ ],
72310
72520
  disabled_agents: [
72311
72521
  ...new Set([
72312
72522
  ...base.disabled_agents ?? [],
@@ -72355,42 +72565,61 @@ function mergeConfigs(base, override) {
72355
72565
  function loadPluginConfig(directory, ctx) {
72356
72566
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
72357
72567
  const userDetected = detectPluginConfigFile(configDir);
72358
- let userConfigPath = userDetected.format !== "none" ? userDetected.path : path4.join(configDir, `${CONFIG_BASENAME}.json`);
72568
+ let userConfigPath = userDetected.format !== "none" ? userDetected.path : path5.join(configDir, `${CONFIG_BASENAME}.json`);
72359
72569
  if (userDetected.legacyPath) {
72360
72570
  log("Canonical plugin config detected alongside legacy config. Remove the legacy file to avoid confusion.", {
72361
72571
  canonicalPath: userDetected.path,
72362
72572
  legacyPath: userDetected.legacyPath
72363
72573
  });
72364
72574
  }
72365
- if (userDetected.format !== "none" && path4.basename(userDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
72575
+ if (userDetected.format !== "none" && path5.basename(userDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
72366
72576
  const migrated = migrateLegacyConfigFile(userDetected.path);
72367
- const canonicalPath = path4.join(path4.dirname(userDetected.path), `${CONFIG_BASENAME}${path4.extname(userDetected.path)}`);
72577
+ const canonicalPath = path5.join(path5.dirname(userDetected.path), `${CONFIG_BASENAME}${path5.extname(userDetected.path)}`);
72368
72578
  if (migrated || fs4.existsSync(canonicalPath)) {
72369
72579
  userConfigPath = canonicalPath;
72370
72580
  }
72371
72581
  }
72372
- const projectBasePath = path4.join(directory, ".opencode");
72582
+ const projectBasePath = path5.join(directory, ".opencode");
72373
72583
  const projectDetected = detectPluginConfigFile(projectBasePath);
72374
- let projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : path4.join(projectBasePath, `${CONFIG_BASENAME}.json`);
72584
+ let projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : path5.join(projectBasePath, `${CONFIG_BASENAME}.json`);
72375
72585
  if (projectDetected.legacyPath) {
72376
72586
  log("Canonical plugin config detected alongside legacy config. Remove the legacy file to avoid confusion.", {
72377
72587
  canonicalPath: projectDetected.path,
72378
72588
  legacyPath: projectDetected.legacyPath
72379
72589
  });
72380
72590
  }
72381
- if (projectDetected.format !== "none" && path4.basename(projectDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
72591
+ if (projectDetected.format !== "none" && path5.basename(projectDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
72382
72592
  const projectMigrated = migrateLegacyConfigFile(projectDetected.path);
72383
- const canonicalProjectPath = path4.join(path4.dirname(projectDetected.path), `${CONFIG_BASENAME}${path4.extname(projectDetected.path)}`);
72593
+ const canonicalProjectPath = path5.join(path5.dirname(projectDetected.path), `${CONFIG_BASENAME}${path5.extname(projectDetected.path)}`);
72384
72594
  if (projectMigrated || fs4.existsSync(canonicalProjectPath)) {
72385
72595
  projectConfigPath = canonicalProjectPath;
72386
72596
  }
72387
72597
  }
72388
72598
  const userConfig = loadConfigFromPath(userConfigPath, ctx);
72599
+ const userGitMasterOverrides = loadExplicitGitMasterOverrides(userConfigPath);
72600
+ if (userConfig?.agent_definitions) {
72601
+ userConfig.agent_definitions = resolveAgentDefinitionPaths(userConfig.agent_definitions, configDir, null);
72602
+ }
72389
72603
  let config2 = userConfig ?? OhMyOpenCodeConfigSchema.parse({});
72604
+ const defaultGitMaster = OhMyOpenCodeConfigSchema.parse({}).git_master;
72390
72605
  const projectConfig = loadConfigFromPath(projectConfigPath, ctx);
72606
+ const projectGitMasterOverrides = loadExplicitGitMasterOverrides(projectConfigPath);
72607
+ if (projectConfig?.agent_definitions) {
72608
+ projectConfig.agent_definitions = resolveAgentDefinitionPaths(projectConfig.agent_definitions, projectBasePath, directory);
72609
+ }
72391
72610
  if (projectConfig) {
72392
72611
  config2 = mergeConfigs(config2, projectConfig);
72393
72612
  }
72613
+ if (userGitMasterOverrides || projectGitMasterOverrides) {
72614
+ config2 = {
72615
+ ...config2,
72616
+ git_master: {
72617
+ ...defaultGitMaster,
72618
+ ...userGitMasterOverrides ?? {},
72619
+ ...projectGitMasterOverrides ?? {}
72620
+ }
72621
+ };
72622
+ }
72394
72623
  config2 = {
72395
72624
  ...config2,
72396
72625
  mcp_env_allowlist: userConfig?.mcp_env_allowlist ?? []
@@ -72407,7 +72636,7 @@ function loadPluginConfig(directory, ctx) {
72407
72636
  // node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
72408
72637
  var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
72409
72638
  let lastEventId;
72410
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
72639
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
72411
72640
  const createStream = async function* () {
72412
72641
  let retryDelay = sseDefaultRetryDelay ?? 3000;
72413
72642
  let attempt = 0;
@@ -72638,7 +72867,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
72638
72867
 
72639
72868
  // node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
72640
72869
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
72641
- var defaultPathSerializer = ({ path: path5, url: _url2 }) => {
72870
+ var defaultPathSerializer = ({ path: path6, url: _url2 }) => {
72642
72871
  let url2 = _url2;
72643
72872
  const matches = _url2.match(PATH_PARAM_RE);
72644
72873
  if (matches) {
@@ -72657,7 +72886,7 @@ var defaultPathSerializer = ({ path: path5, url: _url2 }) => {
72657
72886
  name = name.substring(1);
72658
72887
  style = "matrix";
72659
72888
  }
72660
- const value = path5[name];
72889
+ const value = path6[name];
72661
72890
  if (value === undefined || value === null) {
72662
72891
  continue;
72663
72892
  }
@@ -72688,11 +72917,11 @@ var defaultPathSerializer = ({ path: path5, url: _url2 }) => {
72688
72917
  }
72689
72918
  return url2;
72690
72919
  };
72691
- var getUrl = ({ baseUrl, path: path5, query, querySerializer, url: _url2 }) => {
72920
+ var getUrl = ({ baseUrl, path: path6, query, querySerializer, url: _url2 }) => {
72692
72921
  const pathUrl = _url2.startsWith("/") ? _url2 : `/${_url2}`;
72693
72922
  let url2 = (baseUrl ?? "") + pathUrl;
72694
- if (path5) {
72695
- url2 = defaultPathSerializer({ path: path5, url: url2 });
72923
+ if (path6) {
72924
+ url2 = defaultPathSerializer({ path: path6, url: url2 });
72696
72925
  }
72697
72926
  let search = query ? querySerializer(query) : "";
72698
72927
  if (search.startsWith("?")) {
@@ -73842,7 +74071,7 @@ async function createOpencodeServer(options) {
73842
74071
  }
73843
74072
  });
73844
74073
  let clear = () => {};
73845
- const url2 = await new Promise((resolve2, reject) => {
74074
+ const url2 = await new Promise((resolve4, reject) => {
73846
74075
  const id = setTimeout(() => {
73847
74076
  clear();
73848
74077
  stop(proc);
@@ -73868,7 +74097,7 @@ async function createOpencodeServer(options) {
73868
74097
  }
73869
74098
  clearTimeout(id);
73870
74099
  resolved = true;
73871
- resolve2(match[1]);
74100
+ resolve4(match[1]);
73872
74101
  return;
73873
74102
  }
73874
74103
  }
@@ -73922,7 +74151,7 @@ var import_picocolors10 = __toESM(require_picocolors(), 1);
73922
74151
 
73923
74152
  // src/cli/run/opencode-binary-resolver.ts
73924
74153
  init_spawn_with_windows_hide();
73925
- import { delimiter, dirname as dirname7, join as join16 } from "path";
74154
+ import { delimiter, dirname as dirname8, join as join18 } from "path";
73926
74155
  var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
73927
74156
  var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
73928
74157
  function getCommandCandidates(platform) {
@@ -73945,7 +74174,7 @@ function collectCandidateBinaryPaths(pathEnv, which = Bun.which, platform = proc
73945
74174
  }
73946
74175
  for (const entry of (pathEnv ?? "").split(delimiter).filter(Boolean)) {
73947
74176
  for (const command of commandCandidates) {
73948
- addCandidate(join16(entry, command));
74177
+ addCandidate(join18(entry, command));
73949
74178
  }
73950
74179
  }
73951
74180
  return candidates;
@@ -73972,7 +74201,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe = can
73972
74201
  return null;
73973
74202
  }
73974
74203
  function buildPathWithBinaryFirst(pathEnv, binaryPath) {
73975
- const preferredDir = dirname7(binaryPath);
74204
+ const preferredDir = dirname8(binaryPath);
73976
74205
  const existing = (pathEnv ?? "").split(delimiter).filter((entry) => entry.length > 0 && entry !== preferredDir);
73977
74206
  return [preferredDir, ...existing].join(delimiter);
73978
74207
  }
@@ -74110,7 +74339,7 @@ async function resolveSession(options) {
74110
74339
  if (attempt < SESSION_CREATE_MAX_RETRIES) {
74111
74340
  const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
74112
74341
  console.log(import_picocolors11.default.dim(` Retrying in ${delay}ms...`));
74113
- await new Promise((resolve2) => setTimeout(resolve2, delay));
74342
+ await new Promise((resolve4) => setTimeout(resolve4, delay));
74114
74343
  }
74115
74344
  continue;
74116
74345
  }
@@ -74121,7 +74350,7 @@ async function resolveSession(options) {
74121
74350
  if (attempt < SESSION_CREATE_MAX_RETRIES) {
74122
74351
  const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
74123
74352
  console.log(import_picocolors11.default.dim(` Retrying in ${delay}ms...`));
74124
- await new Promise((resolve2) => setTimeout(resolve2, delay));
74353
+ await new Promise((resolve4) => setTimeout(resolve4, delay));
74125
74354
  }
74126
74355
  }
74127
74356
  throw new Error("Failed to create session after all retries");
@@ -74250,10 +74479,11 @@ var normalizeAgentName = (agent) => {
74250
74479
  return;
74251
74480
  const configKey = getAgentConfigKey(trimmed);
74252
74481
  const displayName = getAgentDisplayName(configKey);
74482
+ const runtimeName = getAgentRuntimeName(configKey);
74253
74483
  const isKnownAgent = displayName !== configKey;
74254
74484
  return {
74255
74485
  configKey,
74256
- resolvedName: isKnownAgent ? displayName : trimmed
74486
+ resolvedName: isKnownAgent ? runtimeName : trimmed
74257
74487
  };
74258
74488
  };
74259
74489
  var isAgentDisabled = (agentConfigKey, config2) => {
@@ -74277,18 +74507,19 @@ var resolveRunAgent = (options, pluginConfig, env = process.env) => {
74277
74507
  const configAgent = normalizeAgentName(pluginConfig.default_run_agent);
74278
74508
  const resolved = cliAgent ?? envAgent ?? configAgent ?? {
74279
74509
  configKey: DEFAULT_AGENT,
74280
- resolvedName: getAgentDisplayName(DEFAULT_AGENT)
74510
+ resolvedName: getAgentRuntimeName(DEFAULT_AGENT)
74281
74511
  };
74282
74512
  if (isAgentDisabled(resolved.configKey, pluginConfig)) {
74283
74513
  const fallback = pickFallbackAgent(pluginConfig);
74284
- const fallbackName = getAgentDisplayName(fallback);
74514
+ const fallbackDisplayName = getAgentDisplayName(fallback);
74515
+ const fallbackRuntimeName = getAgentRuntimeName(fallback);
74285
74516
  const fallbackDisabled = isAgentDisabled(fallback, pluginConfig);
74286
74517
  if (fallbackDisabled) {
74287
- console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled and no enabled core agent was found. Proceeding with "${fallbackName}".`));
74288
- return fallbackName;
74518
+ console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled and no enabled core agent was found. Proceeding with "${fallbackDisplayName}".`));
74519
+ return fallbackRuntimeName;
74289
74520
  }
74290
- console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled. Falling back to "${fallbackName}".`));
74291
- return fallbackName;
74521
+ console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled. Falling back to "${fallbackDisplayName}".`));
74522
+ return fallbackRuntimeName;
74292
74523
  }
74293
74524
  return resolved.resolvedName;
74294
74525
  };
@@ -74330,19 +74561,19 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
74330
74561
  var NOTEPAD_DIR = "notepads";
74331
74562
  var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
74332
74563
  // src/features/boulder-state/storage.ts
74333
- import { existsSync as existsSync18, readFileSync as readFileSync13, writeFileSync as writeFileSync5, mkdirSync as mkdirSync7, readdirSync as readdirSync3 } from "fs";
74334
- import { dirname as dirname8, join as join17, basename as basename4 } from "path";
74564
+ import { existsSync as existsSync20, readFileSync as readFileSync14, writeFileSync as writeFileSync5, mkdirSync as mkdirSync8, readdirSync as readdirSync3 } from "fs";
74565
+ import { dirname as dirname9, join as join19, basename as basename5 } from "path";
74335
74566
  var RESERVED_KEYS = new Set(["__proto__", "prototype", "constructor"]);
74336
74567
  function getBoulderFilePath(directory) {
74337
- return join17(directory, BOULDER_DIR, BOULDER_FILE);
74568
+ return join19(directory, BOULDER_DIR, BOULDER_FILE);
74338
74569
  }
74339
74570
  function readBoulderState(directory) {
74340
74571
  const filePath = getBoulderFilePath(directory);
74341
- if (!existsSync18(filePath)) {
74572
+ if (!existsSync20(filePath)) {
74342
74573
  return null;
74343
74574
  }
74344
74575
  try {
74345
- const content = readFileSync13(filePath, "utf-8");
74576
+ const content = readFileSync14(filePath, "utf-8");
74346
74577
  const parsed = JSON.parse(content);
74347
74578
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
74348
74579
  return null;
@@ -74375,11 +74606,11 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
74375
74606
  var TODO_TASK_PATTERN = /^\d+\.\s+/;
74376
74607
  var FINAL_WAVE_TASK_PATTERN = /^F\d+\.\s+/i;
74377
74608
  function getPlanProgress(planPath) {
74378
- if (!existsSync18(planPath)) {
74609
+ if (!existsSync20(planPath)) {
74379
74610
  return { total: 0, completed: 0, isComplete: true };
74380
74611
  }
74381
74612
  try {
74382
- const content = readFileSync13(planPath, "utf-8");
74613
+ const content = readFileSync14(planPath, "utf-8");
74383
74614
  const lines = content.split(/\r?\n/);
74384
74615
  const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN.test(line) || FINAL_VERIFICATION_HEADING_PATTERN.test(line));
74385
74616
  if (hasStructuredSections) {
@@ -74451,17 +74682,17 @@ function getSessionAgent(sessionID) {
74451
74682
  // src/features/run-continuation-state/constants.ts
74452
74683
  var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
74453
74684
  // src/features/run-continuation-state/storage.ts
74454
- import { existsSync as existsSync19, mkdirSync as mkdirSync8, readFileSync as readFileSync14, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
74455
- import { join as join18 } from "path";
74685
+ import { existsSync as existsSync21, mkdirSync as mkdirSync9, readFileSync as readFileSync15, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
74686
+ import { join as join20 } from "path";
74456
74687
  function getMarkerPath(directory, sessionID) {
74457
- return join18(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
74688
+ return join20(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
74458
74689
  }
74459
74690
  function readContinuationMarker(directory, sessionID) {
74460
74691
  const markerPath = getMarkerPath(directory, sessionID);
74461
- if (!existsSync19(markerPath))
74692
+ if (!existsSync21(markerPath))
74462
74693
  return null;
74463
74694
  try {
74464
- const raw = readFileSync14(markerPath, "utf-8");
74695
+ const raw = readFileSync15(markerPath, "utf-8");
74465
74696
  const parsed = JSON.parse(raw);
74466
74697
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
74467
74698
  return null;
@@ -74522,8 +74753,8 @@ async function isSessionInBoulderLineage(input) {
74522
74753
  // src/hooks/atlas/session-last-agent.ts
74523
74754
  init_shared();
74524
74755
  init_compaction_marker();
74525
- import { readFileSync as readFileSync15, readdirSync as readdirSync4 } from "fs";
74526
- import { join as join19 } from "path";
74756
+ import { readFileSync as readFileSync16, readdirSync as readdirSync4 } from "fs";
74757
+ import { join as join21 } from "path";
74527
74758
  var defaultSessionLastAgentDeps = {
74528
74759
  getMessageDir,
74529
74760
  isSqliteBackend,
@@ -74571,7 +74802,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
74571
74802
  try {
74572
74803
  const messages = readdirSync4(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
74573
74804
  try {
74574
- const content = readFileSync15(join19(messageDir, fileName), "utf-8");
74805
+ const content = readFileSync16(join21(messageDir, fileName), "utf-8");
74575
74806
  const parsed = JSON.parse(content);
74576
74807
  return {
74577
74808
  fileName,
@@ -74604,8 +74835,8 @@ init_agent_display_names();
74604
74835
 
74605
74836
  // src/hooks/ralph-loop/storage.ts
74606
74837
  init_frontmatter();
74607
- import { existsSync as existsSync20, readFileSync as readFileSync16, writeFileSync as writeFileSync7, unlinkSync, mkdirSync as mkdirSync9 } from "fs";
74608
- import { dirname as dirname9, join as join20 } from "path";
74838
+ import { existsSync as existsSync22, readFileSync as readFileSync17, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as mkdirSync10 } from "fs";
74839
+ import { dirname as dirname10, join as join22 } from "path";
74609
74840
 
74610
74841
  // src/hooks/ralph-loop/constants.ts
74611
74842
  var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
@@ -74614,15 +74845,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
74614
74845
 
74615
74846
  // src/hooks/ralph-loop/storage.ts
74616
74847
  function getStateFilePath(directory, customPath) {
74617
- return customPath ? join20(directory, customPath) : join20(directory, DEFAULT_STATE_FILE);
74848
+ return customPath ? join22(directory, customPath) : join22(directory, DEFAULT_STATE_FILE);
74618
74849
  }
74619
74850
  function readState(directory, customPath) {
74620
74851
  const filePath = getStateFilePath(directory, customPath);
74621
- if (!existsSync20(filePath)) {
74852
+ if (!existsSync22(filePath)) {
74622
74853
  return null;
74623
74854
  }
74624
74855
  try {
74625
- const content = readFileSync16(filePath, "utf-8");
74856
+ const content = readFileSync17(filePath, "utf-8");
74626
74857
  const { data, body } = parseFrontmatter(content);
74627
74858
  const active = data.active;
74628
74859
  const iteration = data.iteration;
@@ -74831,7 +75062,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
74831
75062
  let secondaryTimeoutChecked = false;
74832
75063
  const pollStartTimestamp = Date.now();
74833
75064
  while (!abortController.signal.aborted) {
74834
- await new Promise((resolve2) => setTimeout(resolve2, pollIntervalMs));
75065
+ await new Promise((resolve4) => setTimeout(resolve4, pollIntervalMs));
74835
75066
  if (abortController.signal.aborted) {
74836
75067
  return 130;
74837
75068
  }
@@ -74938,6 +75169,9 @@ async function getMainSessionStatus(ctx) {
74938
75169
  query: { directory: ctx.directory }
74939
75170
  });
74940
75171
  const statuses = normalizeSDKResponse(statusesRes, {});
75172
+ if (!(ctx.sessionID in statuses)) {
75173
+ return "idle";
75174
+ }
74941
75175
  const status = statuses[ctx.sessionID]?.type;
74942
75176
  if (status === "idle" || status === "busy" || status === "retry") {
74943
75177
  return status;
@@ -75059,7 +75293,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
75059
75293
  async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
75060
75294
  const completed = await Promise.race([
75061
75295
  eventProcessor.then(() => true),
75062
- new Promise((resolve2) => setTimeout(() => resolve2(false), timeoutMs))
75296
+ new Promise((resolve4) => setTimeout(() => resolve4(false), timeoutMs))
75063
75297
  ]);
75064
75298
  }
75065
75299
  async function run(options) {
@@ -75387,12 +75621,12 @@ async function getLocalVersion(options = {}) {
75387
75621
  }
75388
75622
  }
75389
75623
  // src/cli/doctor/checks/system.ts
75390
- import { existsSync as existsSync31, readFileSync as readFileSync26 } from "fs";
75624
+ import { existsSync as existsSync33, readFileSync as readFileSync27 } from "fs";
75391
75625
 
75392
75626
  // src/cli/doctor/checks/system-binary.ts
75393
- import { existsSync as existsSync28 } from "fs";
75394
- import { homedir as homedir5 } from "os";
75395
- import { join as join27 } from "path";
75627
+ import { existsSync as existsSync30 } from "fs";
75628
+ import { homedir as homedir6 } from "os";
75629
+ import { join as join29 } from "path";
75396
75630
 
75397
75631
  // src/cli/doctor/spawn-with-timeout.ts
75398
75632
  init_spawn_with_windows_hide();
@@ -75405,8 +75639,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
75405
75639
  return { stdout: "", stderr: "", exitCode: 1, timedOut: false };
75406
75640
  }
75407
75641
  let timer;
75408
- const timeoutPromise = new Promise((resolve2) => {
75409
- timer = setTimeout(() => resolve2("timeout"), timeoutMs);
75642
+ const timeoutPromise = new Promise((resolve4) => {
75643
+ timer = setTimeout(() => resolve4("timeout"), timeoutMs);
75410
75644
  });
75411
75645
  const processPromise = (async () => {
75412
75646
  await proc.exited;
@@ -75426,22 +75660,22 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
75426
75660
 
75427
75661
  // src/cli/doctor/checks/system-binary.ts
75428
75662
  function getDesktopAppPaths(platform) {
75429
- const home = homedir5();
75663
+ const home = homedir6();
75430
75664
  switch (platform) {
75431
75665
  case "darwin":
75432
75666
  return [
75433
75667
  "/Applications/OpenCode.app/Contents/MacOS/OpenCode",
75434
- join27(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
75668
+ join29(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
75435
75669
  ];
75436
75670
  case "win32": {
75437
75671
  const programFiles = process.env.ProgramFiles;
75438
75672
  const localAppData = process.env.LOCALAPPDATA;
75439
75673
  const paths = [];
75440
75674
  if (programFiles) {
75441
- paths.push(join27(programFiles, "OpenCode", "OpenCode.exe"));
75675
+ paths.push(join29(programFiles, "OpenCode", "OpenCode.exe"));
75442
75676
  }
75443
75677
  if (localAppData) {
75444
- paths.push(join27(localAppData, "OpenCode", "OpenCode.exe"));
75678
+ paths.push(join29(localAppData, "OpenCode", "OpenCode.exe"));
75445
75679
  }
75446
75680
  return paths;
75447
75681
  }
@@ -75449,8 +75683,8 @@ function getDesktopAppPaths(platform) {
75449
75683
  return [
75450
75684
  "/usr/bin/opencode",
75451
75685
  "/usr/lib/opencode/opencode",
75452
- join27(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
75453
- join27(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
75686
+ join29(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
75687
+ join29(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
75454
75688
  ];
75455
75689
  default:
75456
75690
  return [];
@@ -75462,7 +75696,7 @@ function buildVersionCommand(binaryPath, platform) {
75462
75696
  }
75463
75697
  return [binaryPath, "--version"];
75464
75698
  }
75465
- function findDesktopBinary(platform = process.platform, checkExists = existsSync28) {
75699
+ function findDesktopBinary(platform = process.platform, checkExists = existsSync30) {
75466
75700
  for (const desktopPath of getDesktopAppPaths(platform)) {
75467
75701
  if (checkExists(desktopPath)) {
75468
75702
  return { binary: "opencode", path: desktopPath };
@@ -75472,9 +75706,9 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
75472
75706
  }
75473
75707
  async function findOpenCodeBinary() {
75474
75708
  for (const binary2 of OPENCODE_BINARIES2) {
75475
- const path11 = Bun.which(binary2);
75476
- if (path11) {
75477
- return { binary: binary2, path: path11 };
75709
+ const path12 = Bun.which(binary2);
75710
+ if (path12) {
75711
+ return { binary: binary2, path: path12 };
75478
75712
  }
75479
75713
  }
75480
75714
  return findDesktopBinary();
@@ -75508,12 +75742,12 @@ function compareVersions3(current, minimum) {
75508
75742
 
75509
75743
  // src/cli/doctor/checks/system-plugin.ts
75510
75744
  init_shared();
75511
- import { existsSync as existsSync29, readFileSync as readFileSync24 } from "fs";
75745
+ import { existsSync as existsSync31, readFileSync as readFileSync25 } from "fs";
75512
75746
  function detectConfigPath() {
75513
75747
  const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
75514
- if (existsSync29(paths.configJsonc))
75748
+ if (existsSync31(paths.configJsonc))
75515
75749
  return paths.configJsonc;
75516
- if (existsSync29(paths.configJson))
75750
+ if (existsSync31(paths.configJson))
75517
75751
  return paths.configJson;
75518
75752
  return null;
75519
75753
  }
@@ -75559,7 +75793,7 @@ function getPluginInfo() {
75559
75793
  };
75560
75794
  }
75561
75795
  try {
75562
- const content = readFileSync24(configPath, "utf-8");
75796
+ const content = readFileSync25(configPath, "utf-8");
75563
75797
  const parsedConfig = parseJsonc(content);
75564
75798
  const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
75565
75799
  if (!pluginEntry) {
@@ -75597,37 +75831,37 @@ function getPluginInfo() {
75597
75831
  init_file_utils();
75598
75832
  init_checker();
75599
75833
  init_auto_update_checker();
75600
- import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
75601
- import { homedir as homedir6 } from "os";
75602
- import { join as join28 } from "path";
75834
+ import { existsSync as existsSync32, readFileSync as readFileSync26 } from "fs";
75835
+ import { homedir as homedir7 } from "os";
75836
+ import { join as join30 } from "path";
75603
75837
  init_shared();
75604
75838
  function getPlatformDefaultCacheDir(platform = process.platform) {
75605
75839
  if (platform === "darwin")
75606
- return join28(homedir6(), "Library", "Caches");
75840
+ return join30(homedir7(), "Library", "Caches");
75607
75841
  if (platform === "win32")
75608
- return process.env.LOCALAPPDATA ?? join28(homedir6(), "AppData", "Local");
75609
- return join28(homedir6(), ".cache");
75842
+ return process.env.LOCALAPPDATA ?? join30(homedir7(), "AppData", "Local");
75843
+ return join30(homedir7(), ".cache");
75610
75844
  }
75611
75845
  function resolveOpenCodeCacheDir() {
75612
75846
  const xdgCacheHome = process.env.XDG_CACHE_HOME;
75613
75847
  if (xdgCacheHome)
75614
- return join28(xdgCacheHome, "opencode");
75848
+ return join30(xdgCacheHome, "opencode");
75615
75849
  const fromShared = getOpenCodeCacheDir();
75616
- const platformDefault = join28(getPlatformDefaultCacheDir(), "opencode");
75617
- if (existsSync30(fromShared) || !existsSync30(platformDefault))
75850
+ const platformDefault = join30(getPlatformDefaultCacheDir(), "opencode");
75851
+ if (existsSync32(fromShared) || !existsSync32(platformDefault))
75618
75852
  return fromShared;
75619
75853
  return platformDefault;
75620
75854
  }
75621
75855
  function resolveExistingDir(dirPath) {
75622
- if (!existsSync30(dirPath))
75856
+ if (!existsSync32(dirPath))
75623
75857
  return dirPath;
75624
75858
  return resolveSymlink(dirPath);
75625
75859
  }
75626
75860
  function readPackageJson(filePath) {
75627
- if (!existsSync30(filePath))
75861
+ if (!existsSync32(filePath))
75628
75862
  return null;
75629
75863
  try {
75630
- const content = readFileSync25(filePath, "utf-8");
75864
+ const content = readFileSync26(filePath, "utf-8");
75631
75865
  return parseJsonc(content);
75632
75866
  } catch {
75633
75867
  return null;
@@ -75642,11 +75876,11 @@ function normalizeVersion(value) {
75642
75876
  function createPackageCandidates(rootDir) {
75643
75877
  return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
75644
75878
  packageName,
75645
- installedPackagePath: join28(rootDir, "node_modules", packageName, "package.json")
75879
+ installedPackagePath: join30(rootDir, "node_modules", packageName, "package.json")
75646
75880
  }));
75647
75881
  }
75648
75882
  function selectInstalledPackage(candidate) {
75649
- return candidate.packageCandidates.find((packageCandidate) => existsSync30(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
75883
+ return candidate.packageCandidates.find((packageCandidate) => existsSync32(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
75650
75884
  }
75651
75885
  function getExpectedVersion(cachePackage, packageName) {
75652
75886
  return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
@@ -75658,16 +75892,16 @@ function getLoadedPluginVersion() {
75658
75892
  const candidates = [
75659
75893
  {
75660
75894
  cacheDir: configDir,
75661
- cachePackagePath: join28(configDir, "package.json"),
75895
+ cachePackagePath: join30(configDir, "package.json"),
75662
75896
  packageCandidates: createPackageCandidates(configDir)
75663
75897
  },
75664
75898
  {
75665
75899
  cacheDir,
75666
- cachePackagePath: join28(cacheDir, "package.json"),
75900
+ cachePackagePath: join30(cacheDir, "package.json"),
75667
75901
  packageCandidates: createPackageCandidates(cacheDir)
75668
75902
  }
75669
75903
  ];
75670
- const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync30(packageCandidate.installedPackagePath))) ?? candidates[0];
75904
+ const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync32(packageCandidate.installedPackagePath))) ?? candidates[0];
75671
75905
  const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
75672
75906
  const selectedPackage = selectInstalledPackage(selectedCandidate);
75673
75907
  const installedPackagePath = selectedPackage.installedPackagePath;
@@ -75706,10 +75940,10 @@ var defaultDeps3 = {
75706
75940
  function isConfigValid(configPath) {
75707
75941
  if (!configPath)
75708
75942
  return true;
75709
- if (!existsSync31(configPath))
75943
+ if (!existsSync33(configPath))
75710
75944
  return false;
75711
75945
  try {
75712
- parseJsonc(readFileSync26(configPath, "utf-8"));
75946
+ parseJsonc(readFileSync27(configPath, "utf-8"));
75713
75947
  return true;
75714
75948
  } catch {
75715
75949
  return false;
@@ -75831,32 +76065,32 @@ async function checkSystem(deps = defaultDeps3) {
75831
76065
  }
75832
76066
 
75833
76067
  // src/cli/doctor/checks/config.ts
75834
- import { readFileSync as readFileSync29 } from "fs";
75835
- import { join as join32 } from "path";
76068
+ import { readFileSync as readFileSync30 } from "fs";
76069
+ import { join as join34 } from "path";
75836
76070
  init_shared();
75837
76071
 
75838
76072
  // src/cli/doctor/checks/model-resolution-cache.ts
75839
76073
  init_shared();
75840
- import { existsSync as existsSync32, readFileSync as readFileSync27 } from "fs";
75841
- import { homedir as homedir7 } from "os";
75842
- import { join as join29 } from "path";
76074
+ import { existsSync as existsSync34, readFileSync as readFileSync28 } from "fs";
76075
+ import { homedir as homedir8 } from "os";
76076
+ import { join as join31 } from "path";
75843
76077
  function getUserConfigDir2() {
75844
76078
  const xdgConfig = process.env.XDG_CONFIG_HOME;
75845
76079
  if (xdgConfig)
75846
- return join29(xdgConfig, "opencode");
75847
- return join29(homedir7(), ".config", "opencode");
76080
+ return join31(xdgConfig, "opencode");
76081
+ return join31(homedir8(), ".config", "opencode");
75848
76082
  }
75849
76083
  function loadCustomProviderNames() {
75850
76084
  const configDir = getUserConfigDir2();
75851
76085
  const candidatePaths = [
75852
- join29(configDir, "opencode.json"),
75853
- join29(configDir, "opencode.jsonc")
76086
+ join31(configDir, "opencode.json"),
76087
+ join31(configDir, "opencode.jsonc")
75854
76088
  ];
75855
76089
  for (const configPath of candidatePaths) {
75856
- if (!existsSync32(configPath))
76090
+ if (!existsSync34(configPath))
75857
76091
  continue;
75858
76092
  try {
75859
- const content = readFileSync27(configPath, "utf-8");
76093
+ const content = readFileSync28(configPath, "utf-8");
75860
76094
  const data = parseJsonc(content);
75861
76095
  if (data?.provider && typeof data.provider === "object") {
75862
76096
  return Object.keys(data.provider);
@@ -75866,16 +76100,16 @@ function loadCustomProviderNames() {
75866
76100
  return [];
75867
76101
  }
75868
76102
  function loadAvailableModelsFromCache() {
75869
- const cacheFile = join29(getOpenCodeCacheDir(), "models.json");
76103
+ const cacheFile = join31(getOpenCodeCacheDir(), "models.json");
75870
76104
  const customProviders = loadCustomProviderNames();
75871
- if (!existsSync32(cacheFile)) {
76105
+ if (!existsSync34(cacheFile)) {
75872
76106
  if (customProviders.length > 0) {
75873
76107
  return { providers: customProviders, modelCount: 0, cacheExists: true };
75874
76108
  }
75875
76109
  return { providers: [], modelCount: 0, cacheExists: false };
75876
76110
  }
75877
76111
  try {
75878
- const content = readFileSync27(cacheFile, "utf-8");
76112
+ const content = readFileSync28(cacheFile, "utf-8");
75879
76113
  const data = parseJsonc(content);
75880
76114
  const cacheProviders = Object.keys(data);
75881
76115
  let modelCount = 0;
@@ -75898,14 +76132,14 @@ init_model_capabilities();
75898
76132
 
75899
76133
  // src/cli/doctor/checks/model-resolution-config.ts
75900
76134
  init_shared();
75901
- import { readFileSync as readFileSync28 } from "fs";
75902
- import { join as join30 } from "path";
75903
- var PROJECT_CONFIG_DIR = join30(process.cwd(), ".opencode");
76135
+ import { readFileSync as readFileSync29 } from "fs";
76136
+ import { join as join32 } from "path";
76137
+ var PROJECT_CONFIG_DIR = join32(process.cwd(), ".opencode");
75904
76138
  function loadOmoConfig() {
75905
76139
  const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR);
75906
76140
  if (projectDetected.format !== "none") {
75907
76141
  try {
75908
- const content = readFileSync28(projectDetected.path, "utf-8");
76142
+ const content = readFileSync29(projectDetected.path, "utf-8");
75909
76143
  return parseJsonc(content);
75910
76144
  } catch {
75911
76145
  return null;
@@ -75915,7 +76149,7 @@ function loadOmoConfig() {
75915
76149
  const userDetected = detectPluginConfigFile(userConfigDir);
75916
76150
  if (userDetected.format !== "none") {
75917
76151
  try {
75918
- const content = readFileSync28(userDetected.path, "utf-8");
76152
+ const content = readFileSync29(userDetected.path, "utf-8");
75919
76153
  return parseJsonc(content);
75920
76154
  } catch {
75921
76155
  return null;
@@ -75926,7 +76160,7 @@ function loadOmoConfig() {
75926
76160
 
75927
76161
  // src/cli/doctor/checks/model-resolution-details.ts
75928
76162
  init_shared();
75929
- import { join as join31 } from "path";
76163
+ import { join as join33 } from "path";
75930
76164
 
75931
76165
  // src/cli/doctor/checks/model-resolution-variant.ts
75932
76166
  function formatModelWithVariant(model, variant) {
@@ -75968,7 +76202,7 @@ function formatCapabilityResolutionLabel(mode) {
75968
76202
  }
75969
76203
  function buildModelResolutionDetails(options) {
75970
76204
  const details = [];
75971
- const cacheFile = join31(getOpenCodeCacheDir(), "models.json");
76205
+ const cacheFile = join33(getOpenCodeCacheDir(), "models.json");
75972
76206
  details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
75973
76207
  details.push("");
75974
76208
  if (options.available.cacheExists) {
@@ -76123,7 +76357,7 @@ async function checkModels() {
76123
76357
  }
76124
76358
 
76125
76359
  // src/cli/doctor/checks/config.ts
76126
- var PROJECT_CONFIG_DIR2 = join32(process.cwd(), ".opencode");
76360
+ var PROJECT_CONFIG_DIR2 = join34(process.cwd(), ".opencode");
76127
76361
  function findConfigPath() {
76128
76362
  const projectConfig = detectPluginConfigFile(PROJECT_CONFIG_DIR2);
76129
76363
  if (projectConfig.format !== "none")
@@ -76140,7 +76374,7 @@ function validateConfig() {
76140
76374
  return { exists: false, path: null, valid: true, config: null, errors: [] };
76141
76375
  }
76142
76376
  try {
76143
- const content = readFileSync29(configPath, "utf-8");
76377
+ const content = readFileSync30(configPath, "utf-8");
76144
76378
  const rawConfig = parseJsonc(content);
76145
76379
  const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
76146
76380
  if (!schemaResult.success) {
@@ -76243,14 +76477,41 @@ async function checkConfig() {
76243
76477
  }
76244
76478
 
76245
76479
  // src/cli/doctor/checks/dependencies.ts
76246
- import { existsSync as existsSync33 } from "fs";
76480
+ import { existsSync as existsSync35 } from "fs";
76247
76481
  import { createRequire } from "module";
76248
- import { dirname as dirname13, join as join33 } from "path";
76482
+ import { dirname as dirname14, join as join36 } from "path";
76483
+
76484
+ // src/hooks/comment-checker/downloader.ts
76485
+ import { join as join35 } from "path";
76486
+ import { homedir as homedir9, tmpdir as tmpdir3 } from "os";
76487
+ init_binary_downloader();
76488
+ init_logger();
76489
+ init_plugin_identity();
76490
+ var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
76491
+ var DEBUG_FILE = join35(tmpdir3(), "comment-checker-debug.log");
76492
+ function getCacheDir2() {
76493
+ if (process.platform === "win32") {
76494
+ const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
76495
+ const base2 = localAppData || join35(homedir9(), "AppData", "Local");
76496
+ return join35(base2, CACHE_DIR_NAME, "bin");
76497
+ }
76498
+ const xdgCache = process.env.XDG_CACHE_HOME;
76499
+ const base = xdgCache || join35(homedir9(), ".cache");
76500
+ return join35(base, CACHE_DIR_NAME, "bin");
76501
+ }
76502
+ function getBinaryName() {
76503
+ return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
76504
+ }
76505
+ function getCachedBinaryPath2() {
76506
+ return getCachedBinaryPath(getCacheDir2(), getBinaryName());
76507
+ }
76508
+
76509
+ // src/cli/doctor/checks/dependencies.ts
76249
76510
  async function checkBinaryExists(binary2) {
76250
76511
  try {
76251
- const path11 = Bun.which(binary2);
76252
- if (path11) {
76253
- return { exists: true, path: path11 };
76512
+ const path12 = Bun.which(binary2);
76513
+ if (path12) {
76514
+ return { exists: true, path: path12 };
76254
76515
  }
76255
76516
  } catch {}
76256
76517
  return { exists: false, path: null };
@@ -76300,15 +76561,15 @@ async function checkAstGrepNapi() {
76300
76561
  path: null
76301
76562
  };
76302
76563
  } catch {
76303
- const { existsSync: existsSync34 } = await import("fs");
76304
- const { join: join34 } = await import("path");
76305
- const { homedir: homedir8 } = await import("os");
76564
+ const { existsSync: existsSync36 } = await import("fs");
76565
+ const { join: join37 } = await import("path");
76566
+ const { homedir: homedir10 } = await import("os");
76306
76567
  const pathsToCheck = [
76307
- join34(homedir8(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
76308
- join34(process.cwd(), "node_modules", "@ast-grep", "napi")
76568
+ join37(homedir10(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
76569
+ join37(process.cwd(), "node_modules", "@ast-grep", "napi")
76309
76570
  ];
76310
76571
  for (const napiPath of pathsToCheck) {
76311
- if (existsSync34(napiPath)) {
76572
+ if (existsSync36(napiPath)) {
76312
76573
  return {
76313
76574
  name: "AST-Grep NAPI",
76314
76575
  required: false,
@@ -76333,13 +76594,24 @@ function findCommentCheckerPackageBinary() {
76333
76594
  try {
76334
76595
  const require2 = createRequire(import.meta.url);
76335
76596
  const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
76336
- const binaryPath = join33(dirname13(pkgPath), "bin", binaryName);
76337
- if (existsSync33(binaryPath))
76597
+ const binaryPath = join36(dirname14(pkgPath), "bin", binaryName);
76598
+ if (existsSync35(binaryPath))
76338
76599
  return binaryPath;
76339
76600
  } catch {}
76340
76601
  return null;
76341
76602
  }
76342
76603
  async function checkCommentChecker() {
76604
+ const cachedPath = getCachedBinaryPath2();
76605
+ if (cachedPath) {
76606
+ const version4 = await getBinaryVersion(cachedPath);
76607
+ return {
76608
+ name: "Comment Checker",
76609
+ required: false,
76610
+ installed: true,
76611
+ version: version4,
76612
+ path: cachedPath
76613
+ };
76614
+ }
76343
76615
  const binaryCheck = await checkBinaryExists("comment-checker");
76344
76616
  const resolvedPath = binaryCheck.exists ? binaryCheck.path : findCommentCheckerPackageBinary();
76345
76617
  if (!resolvedPath) {
@@ -76484,15 +76756,15 @@ var BUILTIN_SERVERS = {
76484
76756
  "kotlin-ls": { command: ["kotlin-lsp"], extensions: [".kt", ".kts"] }
76485
76757
  };
76486
76758
  // src/tools/lsp/server-config-loader.ts
76487
- import { existsSync as existsSync34, readFileSync as readFileSync30 } from "fs";
76488
- import { join as join34 } from "path";
76759
+ import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
76760
+ import { join as join37 } from "path";
76489
76761
  init_shared();
76490
76762
  init_jsonc_parser();
76491
- function loadJsonFile(path11) {
76492
- if (!existsSync34(path11))
76763
+ function loadJsonFile(path12) {
76764
+ if (!existsSync36(path12))
76493
76765
  return null;
76494
76766
  try {
76495
- return parseJsonc(readFileSync30(path11, "utf-8"));
76767
+ return parseJsonc(readFileSync31(path12, "utf-8"));
76496
76768
  } catch {
76497
76769
  return null;
76498
76770
  }
@@ -76501,9 +76773,9 @@ function getConfigPaths2() {
76501
76773
  const cwd = process.cwd();
76502
76774
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
76503
76775
  return {
76504
- project: detectPluginConfigFile(join34(cwd, ".opencode")).path,
76776
+ project: detectPluginConfigFile(join37(cwd, ".opencode")).path,
76505
76777
  user: detectPluginConfigFile(configDir).path,
76506
- opencode: detectConfigFile(join34(configDir, "opencode")).path
76778
+ opencode: detectConfigFile(join37(configDir, "opencode")).path
76507
76779
  };
76508
76780
  }
76509
76781
  function loadAllConfigs() {
@@ -76572,21 +76844,21 @@ function getMergedServers() {
76572
76844
  }
76573
76845
 
76574
76846
  // src/tools/lsp/server-installation.ts
76575
- import { existsSync as existsSync35 } from "fs";
76576
- import { delimiter as delimiter2, join as join36 } from "path";
76847
+ import { existsSync as existsSync37 } from "fs";
76848
+ import { delimiter as delimiter2, join as join39 } from "path";
76577
76849
 
76578
76850
  // src/tools/lsp/server-path-bases.ts
76579
76851
  init_shared();
76580
- import { join as join35 } from "path";
76852
+ import { join as join38 } from "path";
76581
76853
  function getLspServerAdditionalPathBases(workingDirectory) {
76582
76854
  const configDir = getOpenCodeConfigDir({ binary: "opencode" });
76583
- const dataDir = join35(getDataDir(), "opencode");
76855
+ const dataDir = join38(getDataDir(), "opencode");
76584
76856
  return [
76585
- join35(workingDirectory, "node_modules", ".bin"),
76586
- join35(configDir, "bin"),
76587
- join35(configDir, "node_modules", ".bin"),
76588
- join35(dataDir, "bin"),
76589
- join35(dataDir, "bin", "node_modules", ".bin")
76857
+ join38(workingDirectory, "node_modules", ".bin"),
76858
+ join38(configDir, "bin"),
76859
+ join38(configDir, "node_modules", ".bin"),
76860
+ join38(dataDir, "bin"),
76861
+ join38(dataDir, "bin", "node_modules", ".bin")
76590
76862
  ];
76591
76863
  }
76592
76864
 
@@ -76596,7 +76868,7 @@ function isServerInstalled(command) {
76596
76868
  return false;
76597
76869
  const cmd = command[0];
76598
76870
  if (cmd.includes("/") || cmd.includes("\\")) {
76599
- if (existsSync35(cmd))
76871
+ if (existsSync37(cmd))
76600
76872
  return true;
76601
76873
  }
76602
76874
  const isWindows = process.platform === "win32";
@@ -76617,14 +76889,14 @@ function isServerInstalled(command) {
76617
76889
  const paths = pathEnv.split(delimiter2);
76618
76890
  for (const p2 of paths) {
76619
76891
  for (const suffix of exts) {
76620
- if (existsSync35(join36(p2, cmd + suffix))) {
76892
+ if (existsSync37(join39(p2, cmd + suffix))) {
76621
76893
  return true;
76622
76894
  }
76623
76895
  }
76624
76896
  }
76625
76897
  for (const base of getLspServerAdditionalPathBases(process.cwd())) {
76626
76898
  for (const suffix of exts) {
76627
- if (existsSync35(join36(base, cmd + suffix))) {
76899
+ if (existsSync37(join39(base, cmd + suffix))) {
76628
76900
  return true;
76629
76901
  }
76630
76902
  }
@@ -76686,24 +76958,24 @@ function getInstalledLspServers() {
76686
76958
 
76687
76959
  // src/cli/doctor/checks/tools-mcp.ts
76688
76960
  init_shared();
76689
- import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
76690
- import { homedir as homedir8 } from "os";
76691
- import { join as join37 } from "path";
76961
+ import { existsSync as existsSync38, readFileSync as readFileSync32 } from "fs";
76962
+ import { homedir as homedir10 } from "os";
76963
+ import { join as join40 } from "path";
76692
76964
  var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
76693
76965
  function getMcpConfigPaths() {
76694
76966
  return [
76695
- join37(homedir8(), ".claude", ".mcp.json"),
76696
- join37(process.cwd(), ".mcp.json"),
76697
- join37(process.cwd(), ".claude", ".mcp.json")
76967
+ join40(homedir10(), ".claude", ".mcp.json"),
76968
+ join40(process.cwd(), ".mcp.json"),
76969
+ join40(process.cwd(), ".claude", ".mcp.json")
76698
76970
  ];
76699
76971
  }
76700
76972
  function loadUserMcpConfig() {
76701
76973
  const servers = {};
76702
76974
  for (const configPath of getMcpConfigPaths()) {
76703
- if (!existsSync36(configPath))
76975
+ if (!existsSync38(configPath))
76704
76976
  continue;
76705
76977
  try {
76706
- const content = readFileSync31(configPath, "utf-8");
76978
+ const content = readFileSync32(configPath, "utf-8");
76707
76979
  const config2 = parseJsonc(content);
76708
76980
  if (config2.mcpServers) {
76709
76981
  Object.assign(servers, config2.mcpServers);
@@ -77201,11 +77473,11 @@ async function refreshModelCapabilities(options, deps = {}) {
77201
77473
 
77202
77474
  // src/features/mcp-oauth/storage.ts
77203
77475
  init_shared();
77204
- import { chmodSync, existsSync as existsSync37, mkdirSync as mkdirSync11, readFileSync as readFileSync32, renameSync as renameSync4, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
77205
- import { dirname as dirname14, join as join38 } from "path";
77476
+ import { chmodSync as chmodSync2, existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync33, renameSync as renameSync4, unlinkSync as unlinkSync6, writeFileSync as writeFileSync10 } from "fs";
77477
+ import { dirname as dirname15, join as join41 } from "path";
77206
77478
  var STORAGE_FILE_NAME = "mcp-oauth.json";
77207
77479
  function getMcpOauthStoragePath() {
77208
- return join38(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
77480
+ return join41(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
77209
77481
  }
77210
77482
  function normalizeHost(serverHost) {
77211
77483
  let host = serverHost.trim();
@@ -77242,11 +77514,11 @@ function buildKey(serverHost, resource) {
77242
77514
  }
77243
77515
  function readStore() {
77244
77516
  const filePath = getMcpOauthStoragePath();
77245
- if (!existsSync37(filePath)) {
77517
+ if (!existsSync39(filePath)) {
77246
77518
  return null;
77247
77519
  }
77248
77520
  try {
77249
- const content = readFileSync32(filePath, "utf-8");
77521
+ const content = readFileSync33(filePath, "utf-8");
77250
77522
  return JSON.parse(content);
77251
77523
  } catch {
77252
77524
  return null;
@@ -77255,13 +77527,13 @@ function readStore() {
77255
77527
  function writeStore(store2) {
77256
77528
  const filePath = getMcpOauthStoragePath();
77257
77529
  try {
77258
- const dir = dirname14(filePath);
77259
- if (!existsSync37(dir)) {
77260
- mkdirSync11(dir, { recursive: true });
77530
+ const dir = dirname15(filePath);
77531
+ if (!existsSync39(dir)) {
77532
+ mkdirSync12(dir, { recursive: true });
77261
77533
  }
77262
77534
  const tempPath = `${filePath}.tmp.${Date.now()}`;
77263
77535
  writeFileSync10(tempPath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
77264
- chmodSync(tempPath, 384);
77536
+ chmodSync2(tempPath, 384);
77265
77537
  renameSync4(tempPath, filePath);
77266
77538
  return true;
77267
77539
  } catch {
@@ -77293,8 +77565,8 @@ function deleteToken(serverHost, resource) {
77293
77565
  if (Object.keys(store2).length === 0) {
77294
77566
  try {
77295
77567
  const filePath = getMcpOauthStoragePath();
77296
- if (existsSync37(filePath)) {
77297
- unlinkSync4(filePath);
77568
+ if (existsSync39(filePath)) {
77569
+ unlinkSync6(filePath);
77298
77570
  }
77299
77571
  return true;
77300
77572
  } catch {
@@ -77513,7 +77785,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
77513
77785
  }
77514
77786
  var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
77515
77787
  function startCallbackServer(port) {
77516
- return new Promise((resolve2, reject) => {
77788
+ return new Promise((resolve4, reject) => {
77517
77789
  let timeoutId;
77518
77790
  const server2 = createServer((request, response) => {
77519
77791
  clearTimeout(timeoutId);
@@ -77539,7 +77811,7 @@ function startCallbackServer(port) {
77539
77811
  response.writeHead(200, { "content-type": "text/html" });
77540
77812
  response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
77541
77813
  server2.close();
77542
- resolve2({ code, state: state2 });
77814
+ resolve4({ code, state: state2 });
77543
77815
  });
77544
77816
  timeoutId = setTimeout(() => {
77545
77817
  server2.close();
@@ -77876,20 +78148,21 @@ function createMcpOAuthCommand() {
77876
78148
  var VERSION2 = package_default.version;
77877
78149
  var program2 = new Command;
77878
78150
  program2.name("oh-my-opencode").description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more").version(VERSION2, "-v, --version", "Show version number").enablePositionalOptions();
77879
- program2.command("install").description("Install and configure oh-my-opencode with interactive setup").option("--no-tui", "Run in non-interactive mode (requires all options)").option("--claude <value>", "Claude subscription: no, yes, max20").option("--openai <value>", "OpenAI/ChatGPT subscription: no, yes (default: no)").option("--gemini <value>", "Gemini integration: no, yes").option("--copilot <value>", "GitHub Copilot subscription: no, yes").option("--opencode-zen <value>", "OpenCode Zen access: no, yes (default: no)").option("--zai-coding-plan <value>", "Z.ai Coding Plan subscription: no, yes (default: no)").option("--kimi-for-coding <value>", "Kimi For Coding subscription: no, yes (default: no)").option("--opencode-go <value>", "OpenCode Go subscription: no, yes (default: no)").option("--skip-auth", "Skip authentication setup hints").addHelpText("after", `
78151
+ program2.command("install").description("Install and configure oh-my-opencode with interactive setup").option("--no-tui", "Run in non-interactive mode (requires all options)").option("--claude <value>", "Claude subscription: no, yes, max20").option("--openai <value>", "OpenAI/ChatGPT subscription: no, yes (default: no)").option("--gemini <value>", "Gemini integration: no, yes").option("--copilot <value>", "GitHub Copilot subscription: no, yes").option("--opencode-zen <value>", "OpenCode Zen access: no, yes (default: no)").option("--zai-coding-plan <value>", "Z.ai Coding Plan subscription: no, yes (default: no)").option("--kimi-for-coding <value>", "Kimi For Coding subscription: no, yes (default: no)").option("--opencode-go <value>", "OpenCode Go subscription: no, yes (default: no)").option("--vercel-ai-gateway <value>", "Vercel AI Gateway: no, yes (default: no)").option("--skip-auth", "Skip authentication setup hints").addHelpText("after", `
77880
78152
  Examples:
77881
78153
  $ bunx oh-my-opencode install
77882
78154
  $ bunx oh-my-opencode install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no
77883
78155
  $ bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=yes --opencode-zen=yes
77884
78156
 
77885
- Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi):
78157
+ Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi > Vercel):
77886
78158
  Claude Native anthropic/ models (Opus, Sonnet, Haiku)
77887
78159
  OpenAI Native openai/ models (GPT-5.4 for Oracle)
77888
78160
  Gemini Native google/ models (Gemini 3.1 Pro, Flash)
77889
78161
  Copilot github-copilot/ models (fallback)
77890
78162
  OpenCode Zen opencode/ models (opencode/claude-opus-4-6, etc.)
77891
- Z.ai zai-coding-plan/glm-5 (visual-engineering fallback)
78163
+ Z.ai zai-coding-plan/glm-5 (visual-engineering fallback)
77892
78164
  Kimi kimi-for-coding/k2p5 (Sisyphus/Prometheus fallback)
78165
+ Vercel vercel/ models (universal proxy, always last fallback)
77893
78166
  `).action(async (options) => {
77894
78167
  const args = {
77895
78168
  tui: options.tui !== false,
@@ -77901,6 +78174,7 @@ Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi):
77901
78174
  zaiCodingPlan: options.zaiCodingPlan,
77902
78175
  kimiForCoding: options.kimiForCoding,
77903
78176
  opencodeGo: options.opencodeGo,
78177
+ vercelAiGateway: options.vercelAiGateway,
77904
78178
  skipAuth: options.skipAuth ?? false
77905
78179
  };
77906
78180
  const exitCode = await install(args);