codex-to-im 1.0.58 → 1.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/daemon.mjs CHANGED
@@ -12934,6 +12934,52 @@ import os3 from "node:os";
12934
12934
  import path9 from "node:path";
12935
12935
  var DEFAULT_CODEX_CONFIG_PATH = path9.join(os3.homedir(), ".codex", "config.toml");
12936
12936
  var DEFAULT_CODEX_MODELS_CACHE_PATH = path9.join(os3.homedir(), ".codex", "models_cache.json");
12937
+ var REASONING_LEVEL_DESCRIPTIONS = {
12938
+ low: "Fast responses with lighter reasoning",
12939
+ medium: "Balances speed and reasoning depth for everyday tasks",
12940
+ high: "Greater reasoning depth for complex problems",
12941
+ xhigh: "Extra high reasoning depth for complex problems",
12942
+ max: "Maximum reasoning depth for very hard problems",
12943
+ ultra: "Ultra reasoning depth for the hardest problems"
12944
+ };
12945
+ function buildReasoningLevels(efforts) {
12946
+ return efforts.map((effort) => ({
12947
+ effort,
12948
+ description: REASONING_LEVEL_DESCRIPTIONS[effort] || ""
12949
+ }));
12950
+ }
12951
+ function cloneCodexModel(model) {
12952
+ return {
12953
+ ...model,
12954
+ supportedReasoningLevels: model.supportedReasoningLevels.map((level) => ({ ...level }))
12955
+ };
12956
+ }
12957
+ var KNOWN_CODEX_MODEL_FALLBACKS = [
12958
+ {
12959
+ slug: "gpt-5.6-sol",
12960
+ displayName: "GPT-5.6-Sol",
12961
+ visibility: "list",
12962
+ supportedInApi: true,
12963
+ defaultReasoningLevel: "low",
12964
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max", "ultra"])
12965
+ },
12966
+ {
12967
+ slug: "gpt-5.6-terra",
12968
+ displayName: "GPT-5.6-Terra",
12969
+ visibility: "list",
12970
+ supportedInApi: true,
12971
+ defaultReasoningLevel: "medium",
12972
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max", "ultra"])
12973
+ },
12974
+ {
12975
+ slug: "gpt-5.6-luna",
12976
+ displayName: "GPT-5.6-Luna",
12977
+ visibility: "list",
12978
+ supportedInApi: true,
12979
+ defaultReasoningLevel: "medium",
12980
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max"])
12981
+ }
12982
+ ];
12937
12983
  function readConfiguredCodexModel(configPath = DEFAULT_CODEX_CONFIG_PATH) {
12938
12984
  try {
12939
12985
  const raw = fs6.readFileSync(configPath, "utf-8");
@@ -13005,13 +13051,50 @@ function listCachedCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH) {
13005
13051
  return [];
13006
13052
  }
13007
13053
  }
13008
- function listSelectableCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH) {
13009
- return listCachedCodexModels(cachePath).filter((model) => model.visibility !== "hide");
13054
+ function buildSyntheticCodexModel(slug) {
13055
+ const normalized = slug.trim();
13056
+ if (!normalized) return null;
13057
+ return {
13058
+ slug: normalized,
13059
+ displayName: normalized,
13060
+ visibility: "list",
13061
+ supportedInApi: true,
13062
+ supportedReasoningLevels: []
13063
+ };
13064
+ }
13065
+ function listAvailableCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH, additionalModelSlugs = []) {
13066
+ const cachedModels = listCachedCodexModels(cachePath);
13067
+ const hiddenCachedSlugs = new Set(
13068
+ cachedModels.filter((model) => model.visibility === "hide").map((model) => model.slug)
13069
+ );
13070
+ const merged = [];
13071
+ const seen = /* @__PURE__ */ new Set();
13072
+ const addModel = (model, force = false) => {
13073
+ if (!force && hiddenCachedSlugs.has(model.slug)) return;
13074
+ if (seen.has(model.slug)) return;
13075
+ seen.add(model.slug);
13076
+ merged.push(cloneCodexModel(model));
13077
+ };
13078
+ for (const model of cachedModels) {
13079
+ if (model.visibility !== "hide") {
13080
+ addModel(model, true);
13081
+ }
13082
+ }
13083
+ for (const model of KNOWN_CODEX_MODEL_FALLBACKS) {
13084
+ addModel(model);
13085
+ }
13086
+ for (const slug of additionalModelSlugs) {
13087
+ const syntheticModel = buildSyntheticCodexModel(slug);
13088
+ if (syntheticModel) {
13089
+ addModel(syntheticModel, true);
13090
+ }
13091
+ }
13092
+ return merged;
13010
13093
  }
13011
- function findSelectableCodexModel(slug, cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH) {
13094
+ function findAvailableCodexModel(slug, cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH, additionalModelSlugs = []) {
13012
13095
  const normalized = slug.trim();
13013
13096
  if (!normalized) return null;
13014
- return listSelectableCodexModels(cachePath).find((model) => model.slug === normalized) || null;
13097
+ return listAvailableCodexModels(cachePath, additionalModelSlugs).find((model) => model.slug === normalized) || null;
13015
13098
  }
13016
13099
  function isCliOnlyCodexModel(model) {
13017
13100
  return !!model && model.supportedInApi === false;
@@ -13019,7 +13102,7 @@ function isCliOnlyCodexModel(model) {
13019
13102
 
13020
13103
  // src/lib/bridge/bridge-session-support.ts
13021
13104
  init_runtime_options();
13022
- var AVAILABLE_CODEX_MODELS = listSelectableCodexModels();
13105
+ var AVAILABLE_CODEX_MODELS = listAvailableCodexModels();
13023
13106
  var AVAILABLE_CODEX_MODEL_MAP = new Map(AVAILABLE_CODEX_MODELS.map((model) => [model.slug, model]));
13024
13107
  function getDisplayedDesktopThreads(limit) {
13025
13108
  try {
@@ -13068,7 +13151,7 @@ function getAvailableModelChoicesText() {
13068
13151
  return `\u53EF\u9009\u6A21\u578B\uFF1A${AVAILABLE_CODEX_MODELS.map((model) => formatDisplayedModel(model.slug)).join("\u3001")}`;
13069
13152
  }
13070
13153
  function getSelectableCodexModel(slug) {
13071
- return AVAILABLE_CODEX_MODEL_MAP.get(slug) || findSelectableCodexModel(slug);
13154
+ return AVAILABLE_CODEX_MODEL_MAP.get(slug) || findAvailableCodexModel(slug);
13072
13155
  }
13073
13156
  function resolveNewWorkingDirectory(rawArgs) {
13074
13157
  const trimmed = rawArgs.trim();
@@ -7538,6 +7538,52 @@ import os4 from "node:os";
7538
7538
  import path9 from "node:path";
7539
7539
  var DEFAULT_CODEX_CONFIG_PATH = path9.join(os4.homedir(), ".codex", "config.toml");
7540
7540
  var DEFAULT_CODEX_MODELS_CACHE_PATH = path9.join(os4.homedir(), ".codex", "models_cache.json");
7541
+ var REASONING_LEVEL_DESCRIPTIONS = {
7542
+ low: "Fast responses with lighter reasoning",
7543
+ medium: "Balances speed and reasoning depth for everyday tasks",
7544
+ high: "Greater reasoning depth for complex problems",
7545
+ xhigh: "Extra high reasoning depth for complex problems",
7546
+ max: "Maximum reasoning depth for very hard problems",
7547
+ ultra: "Ultra reasoning depth for the hardest problems"
7548
+ };
7549
+ function buildReasoningLevels(efforts) {
7550
+ return efforts.map((effort) => ({
7551
+ effort,
7552
+ description: REASONING_LEVEL_DESCRIPTIONS[effort] || ""
7553
+ }));
7554
+ }
7555
+ function cloneCodexModel(model) {
7556
+ return {
7557
+ ...model,
7558
+ supportedReasoningLevels: model.supportedReasoningLevels.map((level) => ({ ...level }))
7559
+ };
7560
+ }
7561
+ var KNOWN_CODEX_MODEL_FALLBACKS = [
7562
+ {
7563
+ slug: "gpt-5.6-sol",
7564
+ displayName: "GPT-5.6-Sol",
7565
+ visibility: "list",
7566
+ supportedInApi: true,
7567
+ defaultReasoningLevel: "low",
7568
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max", "ultra"])
7569
+ },
7570
+ {
7571
+ slug: "gpt-5.6-terra",
7572
+ displayName: "GPT-5.6-Terra",
7573
+ visibility: "list",
7574
+ supportedInApi: true,
7575
+ defaultReasoningLevel: "medium",
7576
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max", "ultra"])
7577
+ },
7578
+ {
7579
+ slug: "gpt-5.6-luna",
7580
+ displayName: "GPT-5.6-Luna",
7581
+ visibility: "list",
7582
+ supportedInApi: true,
7583
+ defaultReasoningLevel: "medium",
7584
+ supportedReasoningLevels: buildReasoningLevels(["low", "medium", "high", "xhigh", "max"])
7585
+ }
7586
+ ];
7541
7587
  function readConfiguredCodexModel(configPath = DEFAULT_CODEX_CONFIG_PATH) {
7542
7588
  try {
7543
7589
  const raw = fs8.readFileSync(configPath, "utf-8");
@@ -7609,8 +7655,45 @@ function listCachedCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH) {
7609
7655
  return [];
7610
7656
  }
7611
7657
  }
7612
- function listSelectableCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH) {
7613
- return listCachedCodexModels(cachePath).filter((model) => model.visibility !== "hide");
7658
+ function buildSyntheticCodexModel(slug) {
7659
+ const normalized = slug.trim();
7660
+ if (!normalized) return null;
7661
+ return {
7662
+ slug: normalized,
7663
+ displayName: normalized,
7664
+ visibility: "list",
7665
+ supportedInApi: true,
7666
+ supportedReasoningLevels: []
7667
+ };
7668
+ }
7669
+ function listAvailableCodexModels(cachePath = DEFAULT_CODEX_MODELS_CACHE_PATH, additionalModelSlugs = []) {
7670
+ const cachedModels = listCachedCodexModels(cachePath);
7671
+ const hiddenCachedSlugs = new Set(
7672
+ cachedModels.filter((model) => model.visibility === "hide").map((model) => model.slug)
7673
+ );
7674
+ const merged = [];
7675
+ const seen = /* @__PURE__ */ new Set();
7676
+ const addModel = (model, force = false) => {
7677
+ if (!force && hiddenCachedSlugs.has(model.slug)) return;
7678
+ if (seen.has(model.slug)) return;
7679
+ seen.add(model.slug);
7680
+ merged.push(cloneCodexModel(model));
7681
+ };
7682
+ for (const model of cachedModels) {
7683
+ if (model.visibility !== "hide") {
7684
+ addModel(model, true);
7685
+ }
7686
+ }
7687
+ for (const model of KNOWN_CODEX_MODEL_FALLBACKS) {
7688
+ addModel(model);
7689
+ }
7690
+ for (const slug of additionalModelSlugs) {
7691
+ const syntheticModel = buildSyntheticCodexModel(slug);
7692
+ if (syntheticModel) {
7693
+ addModel(syntheticModel, true);
7694
+ }
7695
+ }
7696
+ return merged;
7614
7697
  }
7615
7698
 
7616
7699
  // src/ui-server.ts
@@ -7626,8 +7709,8 @@ function parsePreferredPort() {
7626
7709
  if (!Number.isInteger(raw) || raw <= 0 || raw > 65535) return 4781;
7627
7710
  return raw;
7628
7711
  }
7629
- function getAvailableCodexModels() {
7630
- return listSelectableCodexModels();
7712
+ function getAvailableCodexModels(additionalModelSlugs = []) {
7713
+ return listAvailableCodexModels(void 0, additionalModelSlugs);
7631
7714
  }
7632
7715
  function getAvailableCodexModelSlugs(models = getAvailableCodexModels()) {
7633
7716
  return new Set(models.map((model) => model.slug));
@@ -7854,8 +7937,8 @@ function isRemoteAuthenticated(request, config) {
7854
7937
  return timingSafeMatch(parseCookies(request).get(AUTH_COOKIE_NAME), config.uiAccessToken);
7855
7938
  }
7856
7939
  function configToPayload(config) {
7857
- const availableModels = getAvailableCodexModels();
7858
7940
  const codexDefaultModel = readConfiguredCodexModel() || "";
7941
+ const availableModels = getAvailableCodexModels([config.defaultModel || "", codexDefaultModel]);
7859
7942
  const effectiveModel = config.defaultModel || codexDefaultModel;
7860
7943
  return {
7861
7944
  runtime: config.runtime,
@@ -7878,10 +7961,14 @@ function configToPayload(config) {
7878
7961
  }
7879
7962
  function mergeConfig(payload) {
7880
7963
  const current = loadConfig();
7881
- const availableCodexModels = getAvailableCodexModels();
7882
- const availableCodexModelSlugs = getAvailableCodexModelSlugs(availableCodexModels);
7883
7964
  const codexDefaultModel = readConfiguredCodexModel() || "";
7884
7965
  const rawDefaultModel = typeof payload.defaultModel === "string" ? payload.defaultModel.trim() : void 0;
7966
+ const availableCodexModels = getAvailableCodexModels([
7967
+ current.defaultModel || "",
7968
+ codexDefaultModel,
7969
+ rawDefaultModel || ""
7970
+ ]);
7971
+ const availableCodexModelSlugs = getAvailableCodexModelSlugs(availableCodexModels);
7885
7972
  const nextDefaultModel = rawDefaultModel === void 0 ? current.defaultModel : rawDefaultModel === "" ? void 0 : availableCodexModelSlugs.has(rawDefaultModel) ? rawDefaultModel : current.defaultModel;
7886
7973
  const currentEffectiveModel = current.defaultModel || codexDefaultModel;
7887
7974
  const nextEffectiveModel = nextDefaultModel || codexDefaultModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-to-im",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "description": "Installable Codex-to-IM bridge with local setup UI and background service",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/zhangle1987/codex-to-im#readme",