mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 09:19:42 +02:00
fix(cli-registry): codex launch defaults as registry data, ultra footer, schema doc defaults
- Codex footer model detection (c28): the modelDetect.screenLine effort alternation is now built from CODEX_REASONING_EFFORTS plus 'default', so 'ultra' (offered by the codexReasoningEffort App Setting and codex's own /model picker) is read and the launch enum and the footer reader cannot drift again. Still one capture group, 125 characters, no new quantifier. New session-display-model case loops every effort level, ultra included. - No CLI-id branching for launch defaults (c27): the two mode === 'codex' branches the synced codex model/effort defaults added to the create and quick-start routes are replaced by a registry capability, capabilities.launchDefaults (launch param -> settings key, values from a closed enum), declared on the codex entry only. The resolver moved from web/codex-launch-defaults.ts to web/launch-defaults.ts as applyLaunchDefaults(mode, configs, customEndpoint), filling the entry's legacyConfigField object through legacyConfigAliases, still re-validating with SettingsUpdateSchema and never overwriting a caller's value. The route exclusions are unchanged (create: not remote; quick-start: not remote, not Docker, not a custom model endpoint), and quick-start still derives the session model from a bag without ompConfig, as before. schema.ts refuses an undeclared param, an unknown settings key, an empty map, and launchDefaults on an entry with no legacyConfigField. - The no-id-branching guard now carries an exact occurrence count per allowlisted key, so a new copy of an already approved expression fails instead of riding the old approval, with a synthetic anti-vacuity case. - SettingsUpdateSchema JSDoc (c21/c29): 'classic' is the tabArrangement default and 'compact' the headerStatsStyle default, matching the resolvers and the pre-paint script; state/case/ledger are marked opt-in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
import { z } from 'zod';
|
||||
import { compileVersionRegex, countCaptureGroups, TOKEN_PATTERNS } from './patterns.js';
|
||||
import { isKnownLauncherProfile, isKnownSetenvProfile } from './profiles.js';
|
||||
import type { McpConfigFormat, ModelConfigResolverName } from './types.js';
|
||||
import type { LaunchDefaultSettingKey, McpConfigFormat, ModelConfigResolverName } from './types.js';
|
||||
|
||||
/** A bare CLI id: lowercase, starts with a letter, at most 24 chars. Also used as a CSS/URL token. */
|
||||
const cliId = z
|
||||
@@ -409,6 +409,17 @@ const capabilitiesSchema = z
|
||||
'rejectWords has nothing to filter without a screenLine'
|
||||
)
|
||||
.optional(),
|
||||
// Launch param -> synced App Settings key. The values are a closed enum, like
|
||||
// configResolver: a clis.json override names one of the settings this build knows
|
||||
// how to validate, never an arbitrary key. Params are checked against the declared
|
||||
// ones in the superRefine below.
|
||||
launchDefaults: z
|
||||
.record(
|
||||
z.string(),
|
||||
z.enum(['codexModel', 'codexReasoningEffort'] as const satisfies readonly LaunchDefaultSettingKey[])
|
||||
)
|
||||
.refine((v) => Object.keys(v).length >= 1 && Object.keys(v).length <= 8, 'launchDefaults takes 1 to 8 params')
|
||||
.optional(),
|
||||
privilegedParams: z
|
||||
.array(
|
||||
z
|
||||
@@ -627,6 +638,30 @@ export const CliEntrySchema = z
|
||||
}
|
||||
});
|
||||
|
||||
// Same silent-no-op class again: a launch default for a param the entry never declared
|
||||
// would be filled into the config object and then read by nothing. And without a
|
||||
// `legacyConfigField` the entry's params are read off the request body itself, where a
|
||||
// filled `model` would be a different field (claude's per-session one), so refuse it.
|
||||
const { launchDefaults } = entry.capabilities;
|
||||
if (launchDefaults !== undefined) {
|
||||
if (entry.launch.legacyConfigField === undefined) {
|
||||
ctx.addIssue({
|
||||
code: 'custom',
|
||||
message: 'launchDefaults needs launch.legacyConfigField to fill',
|
||||
path: ['capabilities', 'launchDefaults'],
|
||||
});
|
||||
}
|
||||
for (const param of Object.keys(launchDefaults)) {
|
||||
if (!declaredParams.has(param)) {
|
||||
ctx.addIssue({
|
||||
code: 'custom',
|
||||
message: `launchDefaults param "${param}" is not a declared launch param`,
|
||||
path: ['capabilities', 'launchDefaults', param],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { setenvProfile } = entry.env;
|
||||
if (setenvProfile !== undefined && !isKnownSetenvProfile(setenvProfile)) {
|
||||
ctx.addIssue({
|
||||
|
||||
Reference in New Issue
Block a user