@litfamily/litcodex 1.0.4 → 1.0.6

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 (83) hide show
  1. package/README.md +112 -75
  2. package/dist/cli-model-route.js +27 -27
  3. package/dist/cli.js +6 -4
  4. package/dist/config-migration/catalog.d.ts +40 -1
  5. package/dist/config-migration/catalog.js +202 -57
  6. package/dist/config-migration/cli.d.ts +2 -1
  7. package/dist/config-migration/cli.js +34 -32
  8. package/dist/config-migration/gpt56-policy.d.ts +19 -10
  9. package/dist/config-migration/gpt56-policy.js +92 -50
  10. package/dist/config-migration/index.d.ts +2 -0
  11. package/dist/config-migration/index.js +28 -10
  12. package/dist/install/doctor-config.js +5 -5
  13. package/dist/install/doctor-render.js +16 -16
  14. package/dist/install/doctor.js +2 -2
  15. package/dist/install/execute.js +5 -4
  16. package/dist/install/generated-skill-payload-hashes.d.ts +30 -3
  17. package/dist/install/generated-skill-payload-hashes.js +30 -3
  18. package/dist/install/host-capabilities.d.ts +3 -4
  19. package/dist/install/host-capabilities.js +17 -19
  20. package/dist/install/install-model-prompt.js +44 -26
  21. package/dist/install/install-options.js +41 -46
  22. package/dist/install/install-presentation.js +2 -1
  23. package/dist/install/skill-catalog.d.ts +1 -1
  24. package/dist/install/skill-catalog.js +6 -1
  25. package/dist/install/skill-resource-hashes.d.ts +1 -1
  26. package/dist/install/skill-resource-hashes.js +1 -1
  27. package/dist/install/uninstall.js +6 -7
  28. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  29. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  30. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  31. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  32. package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-default.toml +1 -1
  33. package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-explorer.toml +1 -1
  34. package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-librarian.toml +1 -1
  35. package/marketplace/plugins/litcodex/components/lit-loop/agents/litcodex-metis.toml +1 -1
  36. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +1 -1
  37. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  38. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  39. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.d.ts +2 -1
  40. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.js +9 -1
  41. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  42. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  43. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  44. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  45. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +22 -19
  46. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/canonical-library.md +7 -1
  47. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +17 -11
  48. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +64 -0
  49. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +25 -0
  50. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +94 -0
  51. package/marketplace/plugins/litcodex/skills/readme-studio/references/decoration-patterns.md +36 -0
  52. package/marketplace/plugins/litcodex/skills/readme-studio/references/facts-and-assembly.md +36 -0
  53. package/marketplace/plugins/litcodex/skills/readme-studio/references/motion-and-delivery.md +47 -0
  54. package/marketplace/plugins/litcodex/skills/readme-studio/references/typography-and-imagery.md +34 -0
  55. package/marketplace/plugins/litcodex/skills/readme-studio/scripts/validate-readme-facts.mjs +130 -0
  56. package/marketplace/plugins/litcodex/skills/readme-studio/templates/cover-source.json +35 -0
  57. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/index.html +61 -0
  58. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/index.motion.json +6 -0
  59. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package-lock.json +1969 -0
  60. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package.json +14 -0
  61. package/marketplace/plugins/litcodex/skills/readme-studio/templates/readme-cover-section.md +85 -0
  62. package/marketplace/plugins/litcodex/skills/readme-studio/templates/readme-facts.json +11 -0
  63. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package-lock.json +3783 -0
  64. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package.json +15 -0
  65. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/ReadmeCover.tsx +102 -0
  66. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/Root.tsx +48 -0
  67. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/index.tsx +4 -0
  68. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/layout.ts +35 -0
  69. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/motion.ts +25 -0
  70. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/package-lock.json +133 -0
  71. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/package.json +8 -0
  72. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/shape-text-to-svg.mjs +238 -0
  73. package/model-catalog.json +163 -4
  74. package/node_modules/@litcodex/lit-loop/agents/litcodex-default.toml +1 -1
  75. package/node_modules/@litcodex/lit-loop/agents/litcodex-explorer.toml +1 -1
  76. package/node_modules/@litcodex/lit-loop/agents/litcodex-librarian.toml +1 -1
  77. package/node_modules/@litcodex/lit-loop/agents/litcodex-metis.toml +1 -1
  78. package/node_modules/@litcodex/lit-loop/directives/litwork.md +1 -1
  79. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  80. package/package.json +2 -2
  81. package/readme-assets/badge-version.svg +1 -1
  82. package/readme-assets/cover-motion-still.webp +0 -0
  83. package/readme-assets/litfamily-machines.png +0 -0
@@ -1,46 +1,20 @@
1
1
  // M13 — model catalog reader (S13 catalog.ts).
2
2
  //
3
- // Loads the reasoning catalog. NEVER throws: on a missing file, malformed JSON,
4
- // or a schema failure it returns FALLBACK_CATALOG. The catalog ships as the
5
- // authored data file `model-catalog.json` at the package root, resolved at
6
- // runtime through Node's `createRequire(import.meta.url)` (NOT baked into dist/
7
- // by tsc). The package `files` array MUST therefore include `model-catalog.json`
8
- // (A3 G7 option (a): ["bin","dist","model-catalog.json","README.md","LICENSE"])
9
- // or a stripped tarball install crashes here at module load. An explicit
10
- // LITCODEX_MODEL_CATALOG_PATH env var overrides the bundled copy for testing.
11
- //
12
- // The authored catalog selects Luna with max effort for ordinary helper roles and
13
- // Astra with xhigh effort for the lead/planning/review routes. The historical `managedProfiles`
14
- // entries exist only for exact recognition; they are never fallback dispatch targets.
15
- // Host metadata is probed separately.
3
+ // The packaged model-catalog.json is the single source for selectable models,
4
+ // effort bounds, defaults, role routes, and installer menu entries.
16
5
  import { readFile } from "node:fs/promises";
17
6
  import { createRequire } from "node:module";
18
7
  const bundledCatalog = createRequire(import.meta.url)("../../model-catalog.json");
19
- /** Used whenever the on-disk catalog is missing, malformed, or schema-invalid. */
20
- export const FALLBACK_CATALOG = parseCatalog(bundledCatalog) ?? {
21
- version: "fallback.gpt-6-astra-xhigh",
22
- current: {
23
- model: "gpt-6-astra",
24
- model_reasoning_effort: "xhigh",
25
- },
26
- roles: {
27
- default: {
28
- model: "gpt-5.6-luna",
29
- model_reasoning_effort: "max",
30
- },
31
- },
32
- managedProfiles: [
33
- {
34
- version: "legacy.gpt-5.5-272k",
35
- match: {
36
- model: "gpt-5.5",
37
- model_context_window: 272_000,
38
- model_reasoning_effort: "high",
39
- plan_mode_reasoning_effort: "xhigh",
40
- },
41
- },
42
- ],
43
- };
8
+ export const REASONING_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
9
+ export const MODEL_CONFIG_PROFILES = ["astra", "sol", "terra", "luna"];
10
+ /** The bundle must ship one valid catalog; do not silently invent a second model table. */
11
+ function loadBundledCatalog() {
12
+ const parsed = parseCatalog(bundledCatalog);
13
+ if (parsed === null)
14
+ throw new Error("The bundled model-catalog.json is missing or invalid.");
15
+ return parsed;
16
+ }
17
+ export const FALLBACK_CATALOG = loadBundledCatalog();
44
18
  /** Read the catalog. Never throws — returns FALLBACK_CATALOG on any failure. */
45
19
  export async function readModelCatalog(env = process.env) {
46
20
  const override = env["LITCODEX_MODEL_CATALOG_PATH"]?.trim();
@@ -51,28 +25,52 @@ export async function readModelCatalog(env = process.env) {
51
25
  const parsed = parseCatalog(JSON.parse(await readFile(override, "utf8")));
52
26
  return parsed ?? FALLBACK_CATALOG;
53
27
  }
54
- catch (error) {
55
- if (error instanceof Error) {
56
- return FALLBACK_CATALOG;
57
- }
58
- throw error;
28
+ catch {
29
+ return FALLBACK_CATALOG;
59
30
  }
60
31
  }
32
+ /** Return the catalog definition for a canonical id or one of its aliases. */
33
+ export function modelDefinition(modelId, catalog = FALLBACK_CATALOG) {
34
+ const normalized = terminalModelId(modelId);
35
+ if (normalized === null)
36
+ return undefined;
37
+ return catalog.models.find((entry) => entry.id === normalized || entry.aliases.includes(normalized));
38
+ }
39
+ /** Return the canonical id for a user-supplied id or alias. */
40
+ export function canonicalModelId(modelId, catalog = FALLBACK_CATALOG) {
41
+ return modelDefinition(modelId, catalog)?.id;
42
+ }
43
+ /** All ids accepted by installer/config-migration boundaries, canonical ids first. */
44
+ export function acceptedModelIds(catalog = FALLBACK_CATALOG) {
45
+ return [...new Set(catalog.models.flatMap((entry) => [entry.id, ...entry.aliases]))];
46
+ }
47
+ export function supportedEffortsForModel(modelId, catalog = FALLBACK_CATALOG) {
48
+ return modelDefinition(modelId, catalog)?.supportedEfforts ?? [];
49
+ }
61
50
  function parseCatalog(value) {
62
- if (!isRecord(value)) {
51
+ if (!isRecord(value) || typeof value["version"] !== "string")
63
52
  return null;
64
- }
65
- if (typeof value["version"] !== "string") {
66
- return null;
67
- }
68
53
  const current = value["current"];
69
- if (!isReasoningProfile(current)) {
54
+ if (!isReasoningProfile(current))
55
+ return null;
56
+ const models = parseModels(value["models"]);
57
+ if (models === null)
58
+ return null;
59
+ const acceptedIds = models.flatMap((entry) => [entry.id, ...entry.aliases]);
60
+ if (new Set(acceptedIds).size !== acceptedIds.length)
61
+ return null;
62
+ const legacyProfiles = models.flatMap((entry) => (entry.legacyProfile === undefined ? [] : [entry.legacyProfile]));
63
+ if (new Set(legacyProfiles).size !== legacyProfiles.length)
64
+ return null;
65
+ const currentDefinition = findModel(models, current.model);
66
+ if (currentDefinition === undefined ||
67
+ !currentDefinition.configurableEfforts.includes(current.model_reasoning_effort) ||
68
+ currentDefinition.installerMenu.lead[0] !== current.model_reasoning_effort) {
70
69
  return null;
71
70
  }
72
71
  const rawProfiles = value["managedProfiles"];
73
- if (!Array.isArray(rawProfiles)) {
72
+ if (!Array.isArray(rawProfiles))
74
73
  return null;
75
- }
76
74
  const managedProfiles = [];
77
75
  for (const profile of rawProfiles) {
78
76
  if (!isRecord(profile) || typeof profile["version"] !== "string" || !isMatchRecord(profile["match"])) {
@@ -80,8 +78,139 @@ function parseCatalog(value) {
80
78
  }
81
79
  managedProfiles.push({ version: profile["version"], match: profile["match"] });
82
80
  }
83
- const roles = isRecord(value["roles"]) ? value["roles"] : {};
84
- return { version: value["version"], current, roles, managedProfiles };
81
+ const rawRoles = value["roles"];
82
+ if (!isRecord(rawRoles))
83
+ return null;
84
+ const roles = {};
85
+ for (const [role, value] of Object.entries(rawRoles)) {
86
+ if (!isReasoningProfile(value))
87
+ return null;
88
+ const definition = findModel(models, value.model);
89
+ if (definition === undefined ||
90
+ !definition.configurableEfforts.includes(value.model_reasoning_effort)) {
91
+ return null;
92
+ }
93
+ roles[role] = value;
94
+ }
95
+ const defaultRoute = roles["default"];
96
+ if (defaultRoute?.model === undefined || defaultRoute.model_reasoning_effort === undefined)
97
+ return null;
98
+ const defaultDefinition = findModel(models, defaultRoute.model);
99
+ if (defaultDefinition === undefined ||
100
+ defaultDefinition.installerMenu.helper[0] !== defaultRoute.model_reasoning_effort) {
101
+ return null;
102
+ }
103
+ return { version: value["version"], current, models, roles, managedProfiles };
104
+ }
105
+ function parseModels(value) {
106
+ if (!Array.isArray(value) || value.length === 0)
107
+ return null;
108
+ const models = [];
109
+ for (const entry of value) {
110
+ if (!isRecord(entry))
111
+ return null;
112
+ const id = entry["id"];
113
+ const configProfile = entry["config_profile"];
114
+ const legacyProfile = entry["legacy_profile"];
115
+ const contextProbe = entry["context_probe"];
116
+ const displayName = entry["display_name"];
117
+ const generation = entry["generation"];
118
+ const priority = entry["priority"];
119
+ const visibility = entry["visibility"];
120
+ const supportedInApi = entry["supported_in_api"];
121
+ const speedTier = entry["speed_tier"];
122
+ const aliases = entry["aliases"];
123
+ const supportedEfforts = entry["supported_efforts"];
124
+ const configurableEfforts = entry["configurable_efforts"];
125
+ const safeExistingEfforts = entry["safe_existing_efforts"];
126
+ const rawInstallerMenu = entry["installer_menu"];
127
+ const defaultEffort = entry["default_effort"];
128
+ const recommendedRole = entry["recommended_role"];
129
+ const recommendedEffort = entry["recommended_effort"];
130
+ if (typeof id !== "string" ||
131
+ !isModelConfigProfile(configProfile) ||
132
+ (legacyProfile !== undefined && !isLegacyProfile(legacyProfile)) ||
133
+ (contextProbe !== undefined && typeof contextProbe !== "boolean") ||
134
+ typeof displayName !== "string" ||
135
+ typeof generation !== "string" ||
136
+ typeof priority !== "number" ||
137
+ !Number.isInteger(priority) ||
138
+ visibility !== "list" ||
139
+ supportedInApi !== true ||
140
+ typeof speedTier !== "string" ||
141
+ !isStringArray(aliases) ||
142
+ !isEffortArray(supportedEfforts) ||
143
+ !isEffortArray(configurableEfforts) ||
144
+ (safeExistingEfforts !== undefined && !isEffortArray(safeExistingEfforts)) ||
145
+ !isRecord(rawInstallerMenu) ||
146
+ !isEffortList(rawInstallerMenu["lead"]) ||
147
+ !isEffortList(rawInstallerMenu["helper"]) ||
148
+ !isReasoningEffort(defaultEffort) ||
149
+ typeof recommendedRole !== "string" ||
150
+ !isReasoningEffort(recommendedEffort)) {
151
+ return null;
152
+ }
153
+ if (!supportedEfforts.includes(defaultEffort) ||
154
+ !configurableEfforts.includes(recommendedEffort) ||
155
+ !configurableEfforts.every((effort) => supportedEfforts.includes(effort)) ||
156
+ (safeExistingEfforts !== undefined &&
157
+ !safeExistingEfforts.every((effort) => supportedEfforts.includes(effort))) ||
158
+ !rawInstallerMenu["lead"].every((effort) => configurableEfforts.includes(effort)) ||
159
+ !rawInstallerMenu["helper"].every((effort) => configurableEfforts.includes(effort)) ||
160
+ new Set(rawInstallerMenu["lead"]).size !== rawInstallerMenu["lead"].length ||
161
+ new Set(rawInstallerMenu["helper"]).size !== rawInstallerMenu["helper"].length) {
162
+ return null;
163
+ }
164
+ const retirementValue = entry["retirement"];
165
+ let retirement;
166
+ if (retirementValue !== undefined) {
167
+ if (!isRecord(retirementValue) ||
168
+ typeof retirementValue["retirement_at"] !== "string" ||
169
+ !isRecord(retirementValue["upgrade"]) ||
170
+ typeof retirementValue["upgrade"]["model"] !== "string") {
171
+ return null;
172
+ }
173
+ retirement = {
174
+ retirementAt: retirementValue["retirement_at"],
175
+ upgradeModel: retirementValue["upgrade"]["model"],
176
+ };
177
+ }
178
+ models.push({
179
+ id,
180
+ configProfile,
181
+ ...(legacyProfile === undefined ? {} : { legacyProfile }),
182
+ contextProbe: contextProbe === true,
183
+ displayName,
184
+ generation,
185
+ priority,
186
+ visibility,
187
+ supportedInApi,
188
+ speedTier,
189
+ aliases,
190
+ supportedEfforts,
191
+ configurableEfforts,
192
+ ...(safeExistingEfforts === undefined ? {} : { safeExistingEfforts }),
193
+ installerMenu: {
194
+ lead: rawInstallerMenu["lead"],
195
+ helper: rawInstallerMenu["helper"],
196
+ },
197
+ defaultEffort,
198
+ recommendedRole,
199
+ recommendedEffort,
200
+ ...(retirement === undefined ? {} : { retirement }),
201
+ });
202
+ }
203
+ return models;
204
+ }
205
+ function findModel(models, value) {
206
+ const terminal = terminalModelId(value);
207
+ return models.find((entry) => entry.id === terminal || entry.aliases.includes(terminal ?? ""));
208
+ }
209
+ function terminalModelId(modelId) {
210
+ if (modelId === undefined)
211
+ return null;
212
+ const terminal = modelId.trim().split("/").at(-1)?.trim().toLowerCase();
213
+ return terminal === undefined || terminal === "" ? null : terminal;
85
214
  }
86
215
  function isReasoningProfile(value) {
87
216
  return (isRecord(value) &&
@@ -92,14 +221,30 @@ function isReasoningProfile(value) {
92
221
  typeof value["model_auto_compact_token_limit"] === "number") &&
93
222
  (value["plan_mode_reasoning_effort"] === undefined || typeof value["plan_mode_reasoning_effort"] === "string"));
94
223
  }
224
+ function isReasoningEffort(value) {
225
+ return typeof value === "string" && REASONING_EFFORTS.includes(value);
226
+ }
227
+ function isModelConfigProfile(value) {
228
+ return typeof value === "string" && MODEL_CONFIG_PROFILES.includes(value);
229
+ }
230
+ function isLegacyProfile(value) {
231
+ return value === "sol" || value === "terra" || value === "luna";
232
+ }
233
+ function isEffortArray(value) {
234
+ return Array.isArray(value) && value.length > 0 && value.every(isReasoningEffort);
235
+ }
236
+ function isEffortList(value) {
237
+ return Array.isArray(value) && value.every(isReasoningEffort);
238
+ }
239
+ function isStringArray(value) {
240
+ return Array.isArray(value) && value.every((entry) => typeof entry === "string");
241
+ }
95
242
  function isMatchRecord(value) {
96
- if (!isRecord(value)) {
243
+ if (!isRecord(value))
97
244
  return false;
98
- }
99
245
  for (const entry of Object.values(value)) {
100
- if (typeof entry !== "string" && typeof entry !== "number") {
246
+ if (typeof entry !== "string" && typeof entry !== "number")
101
247
  return false;
102
- }
103
248
  }
104
249
  return true;
105
250
  }
@@ -7,10 +7,11 @@ export interface ConfigMigrateCliArgs {
7
7
  readonly dryRun: boolean;
8
8
  readonly reconfigure: boolean;
9
9
  readonly profile: Gpt56Profile;
10
+ readonly model: string;
10
11
  readonly effort: ReasoningEffort;
11
12
  }
12
13
  export interface ConfigMigrateCliDeps {
13
- readonly preflight?: (profile: Gpt56Profile, effort: ReasoningEffort) => HostCapabilities;
14
+ readonly preflight?: (profile: Gpt56Profile, effort: ReasoningEffort, model?: string) => HostCapabilities;
14
15
  }
15
16
  export declare function parseConfigMigrateArgs(argv: readonly string[]): ConfigMigrateCliArgs;
16
17
  export declare function runConfigMigrateCli(argv: readonly string[], out?: (text: string) => void, err?: (text: string) => void, deps?: ConfigMigrateCliDeps): Promise<number>;
@@ -1,6 +1,7 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
3
  import { modelContextsForWrites, probeHostCapabilities } from "../install/host-capabilities.js";
4
+ import { acceptedModelIds, canonicalModelId, FALLBACK_CATALOG, modelDefinition } from "./catalog.js";
4
5
  import { CodexConfigMigrationError, exitCodeForMigrationError } from "./errors.js";
5
6
  import { migrateCodexConfig } from "./index.js";
6
7
  class ConfigMigrateArgumentError extends Error {
@@ -15,8 +16,9 @@ export function parseConfigMigrateArgs(argv) {
15
16
  let json = false;
16
17
  let dryRun = false;
17
18
  let reconfigure = false;
18
- let profile = "astra";
19
- let effort = "xhigh";
19
+ let model = FALLBACK_CATALOG.current.model;
20
+ let profile = modelDefinition(model)?.configProfile ?? "astra";
21
+ let effort = FALLBACK_CATALOG.current.model_reasoning_effort;
20
22
  let effortExplicit = false;
21
23
  let cwd = null;
22
24
  for (let index = 0; index < argv.length; index += 1) {
@@ -31,12 +33,14 @@ export function parseConfigMigrateArgs(argv) {
31
33
  reconfigure = true;
32
34
  else if (arg === "--model") {
33
35
  const value = argv[index + 1];
34
- const parsed = modelProfile(value);
35
- if (parsed === undefined)
36
+ const canonical = canonicalModelId(value);
37
+ const definition = modelDefinition(canonical);
38
+ if (definition === undefined || canonical === undefined)
36
39
  throw invalidModel();
37
- profile = parsed;
40
+ profile = definition.configProfile;
41
+ model = canonical;
38
42
  if (!effortExplicit)
39
- effort = defaultEffort(parsed);
43
+ effort = definition.recommendedEffort;
40
44
  index += 1;
41
45
  }
42
46
  else if (arg === "--effort") {
@@ -62,9 +66,10 @@ export function parseConfigMigrateArgs(argv) {
62
66
  else if (arg !== undefined)
63
67
  throw invalidValue(`unknown option ${JSON.stringify(arg)}`, arg);
64
68
  }
65
- if (profile !== "astra" && (effort === "low" || effort === "medium"))
66
- throw invalidEffort();
67
- return { sessionStart, json, cwd, dryRun, reconfigure, profile, effort };
69
+ const definition = modelDefinition(model);
70
+ if (definition === undefined || !definition.configurableEfforts.includes(effort))
71
+ throw invalidEffort(model);
72
+ return { sessionStart, json, cwd, dryRun, reconfigure, profile, model, effort };
68
73
  }
69
74
  export async function runConfigMigrateCli(argv, out = (text) => process.stdout.write(text), err = (text) => process.stderr.write(text), deps = {}) {
70
75
  let args;
@@ -78,7 +83,7 @@ export async function runConfigMigrateCli(argv, out = (text) => process.stdout.w
78
83
  return 2;
79
84
  }
80
85
  const mode = args.sessionStart ? "session-start" : "install";
81
- const capabilities = (deps.preflight ?? directPreflight)(args.profile, args.effort);
86
+ const capabilities = (deps.preflight ?? directPreflight)(args.profile, args.effort, args.model);
82
87
  if (capabilities.concurrency.status === "unavailable") {
83
88
  err(`${JSON.stringify({ ok: false, code: "CONFIG_PREFLIGHT_FAILED", message: "config migrate preflight unavailable", capabilities })}\n`);
84
89
  return args.sessionStart ? 0 : 2;
@@ -88,8 +93,9 @@ export async function runConfigMigrateCli(argv, out = (text) => process.stdout.w
88
93
  cwd: args.cwd ?? process.cwd(),
89
94
  reconfigure: args.reconfigure,
90
95
  profile: args.profile,
96
+ modelOverride: args.model,
91
97
  effort: args.effort,
92
- modelContexts: modelContextsForWrites(capabilities),
98
+ modelContexts: modelContextsForWrites(),
93
99
  };
94
100
  let result;
95
101
  try {
@@ -112,7 +118,7 @@ export async function runConfigMigrateCli(argv, out = (text) => process.stdout.w
112
118
  out(renderText(result, capabilities));
113
119
  return 0;
114
120
  }
115
- function directPreflight(profile, effort) {
121
+ function directPreflight(profile, effort, model) {
116
122
  const override = process.env["CODEX_BIN"]?.trim();
117
123
  const codexBin = override !== undefined && override !== "" ? override : "codex";
118
124
  if (override !== undefined && override !== "" && !existsSync(override)) {
@@ -131,14 +137,19 @@ function directPreflight(profile, effort) {
131
137
  ...(result.error === undefined ? {} : { error: result.error }),
132
138
  };
133
139
  };
134
- return probeHostCapabilities(codexBin, spawn, { profile, effort, env: process.env });
140
+ return probeHostCapabilities(codexBin, spawn, {
141
+ profile,
142
+ effort,
143
+ ...(model === undefined ? {} : { model }),
144
+ env: process.env,
145
+ });
135
146
  }
136
147
  function unavailableCapabilities(reason, observedSource) {
137
148
  const report = { status: "unavailable", reason, observedSource };
138
149
  return {
139
150
  concurrency: report,
140
151
  autoCompaction: report,
141
- modelContexts: { "gpt-5.6": null, "gpt-5.6-terra": null, "gpt-5.6-luna": null },
152
+ modelContexts: Object.fromEntries(acceptedModelIds().map((model) => [model, null])),
142
153
  };
143
154
  }
144
155
  function renderText(result, capabilities) {
@@ -159,27 +170,18 @@ function capabilityText(report) {
159
170
  return `${report.status}; reason=${report.reason}; source=${report.observedSource}`;
160
171
  }
161
172
  function isReasoningEffort(value) {
162
- return value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "max";
173
+ return (value === "low" ||
174
+ value === "medium" ||
175
+ value === "high" ||
176
+ value === "xhigh" ||
177
+ value === "max" ||
178
+ value === "ultra");
163
179
  }
164
180
  function invalidModel() {
165
- return invalidValue("--model requires one of: gpt-6-astra, luna", "--model");
181
+ return invalidValue(`--model requires one of: ${acceptedModelIds().join(", ")}`, "--model");
166
182
  }
167
- function invalidEffort() {
168
- return invalidValue("--effort requires one of: low, medium, high, xhigh, max (Astra); high, xhigh, max (existing models)", "--effort");
169
- }
170
- function modelProfile(value) {
171
- if (value === "gpt-6-astra")
172
- return "astra";
173
- if (value === "luna")
174
- return "luna";
175
- return undefined;
176
- }
177
- function defaultEffort(profile) {
178
- if (profile === "astra")
179
- return "xhigh";
180
- if (profile === "luna")
181
- return "max";
182
- return "xhigh";
183
+ function invalidEffort(model) {
184
+ return invalidValue(`--effort requires one of: ${(modelDefinition(model)?.configurableEfforts ?? []).join(", ")}`, "--effort");
183
185
  }
184
186
  function invalidValue(message, flag) {
185
187
  return new ConfigMigrateArgumentError(message, flag);
@@ -1,17 +1,23 @@
1
- import type { ModelCatalog, ReasoningProfile } from "./catalog.js";
1
+ import { type ModelCatalog, type ReasoningEffortId, type ReasoningProfile } from "./catalog.js";
2
2
  import type { ManagedFileState } from "./state.js";
3
+ export declare const GPT6_MODELS: {
4
+ readonly astra: string;
5
+ readonly sol: string;
6
+ readonly luna: string;
7
+ };
8
+ /** Legacy profile ids are marked in model-catalog.json and keep the public selector stable. */
3
9
  export declare const GPT56_MODELS: {
4
- readonly sol: "gpt-5.6";
5
- readonly terra: "gpt-5.6-terra";
6
- readonly luna: "gpt-5.6-luna";
10
+ readonly sol: string;
11
+ readonly terra: string;
12
+ readonly luna: string;
7
13
  };
8
- export declare const ASTRA_MODEL = "gpt-6-astra";
9
- export declare const EXPLICIT_GPT56_SOL_MODEL = "gpt-5.6-sol";
14
+ export declare const ASTRA_MODEL: string;
15
+ export declare const EXPLICIT_GPT56_SOL_MODEL: string;
10
16
  export type Gpt56Profile = keyof typeof GPT56_MODELS | "astra";
11
17
  export type Gpt56Effort = "high" | "xhigh" | "max";
12
- export type AstraEffort = "low" | "medium" | "high" | "xhigh" | "max";
13
- export type ReasoningEffort = Gpt56Effort | AstraEffort;
14
- export type Gpt56ModelContexts = Readonly<Record<(typeof GPT56_MODELS)[keyof typeof GPT56_MODELS], number | null>>;
18
+ export type AstraEffort = ReasoningEffortId;
19
+ export type ReasoningEffort = ReasoningEffortId;
20
+ export type Gpt56ModelContexts = Readonly<Record<string, number | null>>;
15
21
  export type CatalogClass = "fresh" | "managed_legacy" | "existing_managed" | "explicit_sol_dispatch" | "other_gpt56" | "custom";
16
22
  export declare const GPT56_CONTEXT_WINDOW_LIMIT = 372000;
17
23
  export declare const GPT56_AUTO_COMPACT_TOKEN_LIMIT = 334800;
@@ -26,8 +32,11 @@ export interface CatalogDecision {
26
32
  readonly managed: boolean;
27
33
  readonly reason: "fresh" | "current" | "managed-state" | "managed-legacy" | "user-modified";
28
34
  }
35
+ /** Validate a model/effort pair against the authored catalog and legacy safety rules. */
29
36
  export declare function unsafeEffectiveRoute(current: Partial<ReasoningProfile>): string | null;
30
37
  export declare function isKnownGpt56Model(model: string | undefined): boolean;
38
+ /** Resolve an explicit catalog id into the config target while retaining the exact spelling. */
39
+ export declare function selectedModel(model: string, effort: ReasoningEffort): ReasoningProfile;
31
40
  /**
32
41
  * Desired-route model under ChatGPT-subscription auth: both Sol representations (the bare
33
42
  * `gpt-5.6` alias and the explicit `gpt-5.6-sol` id) dispatch as explicit Sol; other ids pass
@@ -35,7 +44,7 @@ export declare function isKnownGpt56Model(model: string | undefined): boolean;
35
44
  */
36
45
  export declare function chatgptDesiredRouteModel(model: string): string;
37
46
  type ProfileEffort<Profile extends Gpt56Profile> = Profile extends "astra" ? AstraEffort : Gpt56Effort;
38
- /** Select a profile while keeping Astra's wider effort set separate from legacy GPT-5.6. */
47
+ /** Select a legacy profile or the existing Astra lead default. */
39
48
  export declare function selectedProfile<Profile extends Gpt56Profile>(profile: Profile, effort: ProfileEffort<Profile>): ReasoningProfile;
40
49
  export declare function alignedContextLimits(context: number | null | undefined): Gpt56ContextLimits | undefined;
41
50
  export declare function decideCatalogApplication(args: {