codex-copilot-dx 1.2.29 → 1.2.31

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.
@@ -1,7 +1,7 @@
1
1
  import { spawn, execFileSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
- import { downloadRelease, protectInstallation, verifyPackageRuntime, writePrivateLaunchers, createNpmReleaseFetch } from "./release-install.mjs";
4
+ import { downloadRelease, protectInstallation, verifyPackageRuntime, writePrivateLaunchers, createNpmReleaseFetch, remoteDownloadDenied } from "./release-install.mjs";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { createInterface } from "node:readline/promises";
@@ -77,16 +77,20 @@ export function inspectNpmDownloadPolicy({ env = process.env, platform = process
77
77
  return result;
78
78
  }
79
79
 
80
- export function globalUpdateCommand(source, { platform = process.platform, releaseTag, releaseFile, allowRemote = false } = {}) {
80
+ export function globalUpdateCommand(source, { platform = process.platform, releaseTag, releaseFile, allowRemote = false, complete = false } = {}) {
81
81
  if (typeof allowRemote !== "boolean") throw new Error("Remote download permission must be a boolean");
82
+ if (typeof complete !== "boolean") throw new Error("Complete-package selection must be a boolean");
82
83
  const normalized = normalizeUpdateSource(source);
83
84
  if (!normalized) throw new Error(`Choose npm or github. Received: ${source}`);
84
85
  const args = ["install", "--global"];
85
86
  if (allowRemote) args.push("--allow-remote=all");
87
+ if (complete) args.push("--offline", "--ignore-scripts", "--no-audit", "--no-fund");
86
88
  if (normalized === "github") {
87
89
  if (!githubReleaseVersion(releaseTag)) throw new Error("A valid stable GitHub release tag is required");
88
90
  const version = githubReleaseVersion(releaseTag), name = `codex-copilot-dx-${version}.tgz`;
89
- if (releaseFile !== undefined && releaseFile !== `./${name}`) throw new Error("Invalid verified release filename");
91
+ const runtimeNames = ["darwin-x64", "darwin-arm64", "win32-x64", "win32-arm64", "linux-x64-glibc", "linux-arm64-glibc", "linux-x64-musl", "linux-arm64-musl"]
92
+ .map(target => `./codex-copilot-dx-${version}-${target}.tgz`);
93
+ if (releaseFile !== undefined && releaseFile !== `./${name}` && !(complete && runtimeNames.includes(releaseFile))) throw new Error("Invalid verified release filename");
90
94
  args.push(releaseFile || `${UPDATE_SPECS.github}/v${version}/${name}`);
91
95
  } else {
92
96
  args.push(UPDATE_SPECS[normalized]);
@@ -100,17 +104,29 @@ export function globalUpdateCommand(source, { platform = process.platform, relea
100
104
 
101
105
  function waitForExit(child) {
102
106
  return new Promise((resolve, reject) => {
103
- let settled = false;
107
+ let settled = false, exited = false, ended = !child.stderr, failure, tail = "", denied = false;
104
108
  const finish = (handler, value) => {
105
109
  if (settled) return;
106
110
  settled = true;
107
111
  handler(value);
108
112
  };
113
+ const complete = () => { if (exited && ended) {
114
+ if (failure) { if (denied) failure.npmCode = "EALLOWREMOTE";finish(reject, failure); }
115
+ else finish(resolve);
116
+ } };
117
+ child.stderr?.on("data", bytes => {
118
+ process.stderr.write(bytes);const text = tail + bytes.toString();
119
+ if (/npm (?:error|ERR!) code EALLOWREMOTE\b/.test(text)) denied = true;
120
+ tail = text.slice(-64);
121
+ });
122
+ const end = () => { ended = true;complete(); };
123
+ child.stderr?.once("end", end);child.stderr?.once("close", end);child.stderr?.once("error", end);
109
124
  child.once("error", (error) => finish(reject, error));
110
125
  child.once("exit", (code, signal) => {
111
- if (signal) finish(reject, new Error(`npm update was interrupted by ${signal}`));
112
- else if (code !== 0) finish(reject, Object.assign(new Error(`npm update exited with status ${code}`), { npmExitCode: code }));
113
- else finish(resolve);
126
+ exited = true;
127
+ if (signal) failure = new Error(`npm update was interrupted by ${signal}`);
128
+ else if (code !== 0) failure = Object.assign(new Error(`npm update exited with status ${code}`), { npmExitCode: code });
129
+ complete();
114
130
  });
115
131
  });
116
132
  }
@@ -203,7 +219,6 @@ export async function runPackageUpdateCommand({
203
219
  output.write("Release package verified; Git is not required. Dependencies use the configured npm registry.\n");
204
220
  }
205
221
  try {
206
- const update = globalUpdateCommand(selectedSource, { platform, releaseTag: release?.tagName, releaseFile: artifact ? `./${artifact.name}` : undefined, allowRemote: permitRemote });
207
222
  const sourceLabel = selectedSource === "npm" ? "npm registry" : `GitHub release ${release.tagName}`;
208
223
  output.write(`Updating ${PACKAGE_NAME} from ${sourceLabel}...\n`);
209
224
  if (policy.allowRemote) output.write(`npm ${terminalCell(policy.version)}: saved allow-remote=${policy.allowRemote}${policy.registryOrigin ? `; registry ${terminalCell(policy.registryOrigin)}` : ""}.\n`);
@@ -214,30 +229,46 @@ export async function runPackageUpdateCommand({
214
229
  }
215
230
  // The verified tarball basename is fixed and safe for cmd.exe. Its directory
216
231
  // is passed as cwd, never interpolated into the Windows command string.
217
- const launch = npmLaunch(update.args, { platform, env });
218
232
  const brokerRequired = Boolean(environment?.target && fs.existsSync(path.join(environment.target, "node_modules", "@azure", "msal-node-runtime")));
233
+ const install = async item => {
234
+ const update = globalUpdateCommand(selectedSource, { platform, releaseTag: release?.tagName,
235
+ releaseFile: item ? `./${item.name}` : undefined, allowRemote: permitRemote && !item?.complete, complete: item?.complete === true });
236
+ const launch = npmLaunch(update.args, { platform, env });
219
237
  const transaction = protectInstallationFn({ ...environment, platform });
220
- let installedVersion;
238
+ let version;
221
239
  try {
222
240
  const child = spawnImpl(launch.command, launch.args, {
223
241
  env,
224
242
  ...(directory ? { cwd: directory } : {}),
225
243
  shell: false,
226
- stdio: "inherit",
244
+ stdio: ["inherit", "inherit", "pipe"],
227
245
  ...launch.options,
228
246
  });
229
247
  try { await waitForExit(child); }
230
248
  catch (error) {
231
249
  if (Number.isInteger(error.npmExitCode) && !allowRemote && ["none", "root"].includes(policy.allowRemote)) {
232
- error.message += `. npm allow-remote=${policy.allowRemote} was preserved. If npm reported EALLOWREMOTE, its registry/mirror tarball URL was refused; only if you trust this update and policy permits it, retry explicitly with ${terminalCell(commandName)} update ${selectedSource} --allow-remote. This grants URL downloads to this installation's dependency tree, not just one hostname. No automatic retry or config change was made.`;
250
+ error.message += `. npm allow-remote=${policy.allowRemote} was preserved. If npm reported EALLOWREMOTE, its registry/mirror tarball URL was refused; only if you trust this update and policy permits it, retry explicitly with ${terminalCell(commandName)} update ${selectedSource} --allow-remote. This grants URL downloads to this installation's dependency tree, not just one hostname. No permission or config change was made.`;
233
251
  }
234
252
  throw error;
235
253
  }
236
- installedVersion = verifyInstalledFn(environment?.target, { expectedVersion: release?.version });
237
- if (environment?.target && installedVersion) verifyRuntimeFn(environment.target, installedVersion, { brokerRequired });
254
+ version = verifyInstalledFn(environment?.target, { expectedVersion: release?.version });
255
+ if (environment?.target && version) verifyRuntimeFn(environment.target, version, { brokerRequired });
238
256
  if (env.CCDX_PRIVATE_INSTALL_PREFIX && environment?.prefix && (platform === "win32" ? path.win32.resolve(env.CCDX_PRIVATE_INSTALL_PREFIX).toLowerCase() === path.win32.resolve(environment.prefix).toLowerCase() : path.resolve(env.CCDX_PRIVATE_INSTALL_PREFIX) === path.resolve(environment.prefix))) await writePrivateLaunchers(environment);
239
257
  transaction.commit();
258
+ return version;
240
259
  } catch (error) { transaction.rollback();throw error; }
260
+ };
261
+ let installedVersion;
262
+ try { installedVersion = await install(artifact); }
263
+ catch (error) {
264
+ if (selectedSource !== "github" || allowRemote || !remoteDownloadDenied(error)) throw error;
265
+ output.write("npm refused a remote dependency. Previous installation restored; checking the same version's complete platform package.\n");
266
+ try { artifact = await downloadReleaseFn(release.tagName, { fetchImpl, directory, complete: true, platform }); }
267
+ catch (fallbackError) { error.message += ` Complete platform package unavailable: ${fallbackError.message}`;throw error; }
268
+ if (!artifact.complete) throw new Error("The fallback is not a verified complete platform package; no second installation was started");
269
+ output.write("Complete platform package verified; installing offline with the saved npm policy.\n");
270
+ installedVersion = await install(artifact);
271
+ }
241
272
  if (installedVersion) {
242
273
  output.write(`Updated ${PACKAGE_NAME}: installed v${terminalCell(installedVersion)} at ${terminalCell(environment.target)}.\n`);
243
274
  if (platform === "win32") {
@@ -148,9 +148,11 @@ export function createProfileModelRuntime({
148
148
  }
149
149
 
150
150
  async function performRefresh(generation) {
151
+ const fingerprint = credentialFingerprint();
151
152
  try {
152
153
  const models = await requestCatalog();
153
154
  if (refreshGeneration !== generation) return codexRegistry.models;
155
+ if (fingerprint !== credentialFingerprint()) throw new Error("GitHub account changed during model refresh; the previous catalog was preserved");
154
156
  checkCatalog(models);
155
157
  applyCatalog(models, "live");
156
158
  persist(models, generation);
@@ -173,8 +175,12 @@ export function createProfileModelRuntime({
173
175
  }
174
176
  }
175
177
 
176
- function refreshCodex() {
177
- if (refreshFlight) return refreshFlight;
178
+ function refreshCodex({ strict = false } = {}) {
179
+ const result = flight => strict ? flight.then(models => {
180
+ if (codexRegistry.lastError || !isValidModelList(models)) throw new Error(codexRegistry.lastError || "GitHub model catalog is unavailable");
181
+ return models;
182
+ }) : flight;
183
+ if (refreshFlight) return result(refreshFlight);
178
184
  const generation = refreshGeneration + 1;
179
185
  refreshGeneration = generation;
180
186
  codexRegistry.generation = generation;
@@ -184,7 +190,7 @@ export function createProfileModelRuntime({
184
190
  if (refreshGeneration === generation) codexRegistry.refreshInFlight = false;
185
191
  });
186
192
  refreshFlight = flight;
187
- return flight;
193
+ return result(flight);
188
194
  }
189
195
 
190
196
  async function initialize() {
@@ -1,4 +1,5 @@
1
1
  import { autoReviewReasoningEfforts } from "./models.mjs";
2
+ import { modelDisplayName } from "./model-display.mjs";
2
3
  // Public metadata only. Credentials and provider transport never enter this layer.
3
4
  export const isProviderId = value => typeof value === "string" && /^[a-z][a-z0-9_-]{0,63}$/.test(value)
4
5
  && !["constructor", "prototype"].includes(value);
@@ -10,7 +11,7 @@ export function modelReasoningEfforts(model) {
10
11
 
11
12
  export function publicModelCatalog(models, { clients = () => [], selectable = () => false, maker = model => model.publisher || model.vendor || model.owned_by || "Unknown" } = {}) {
12
13
  return models.slice(0, 1000).filter(model => typeof model?.id === "string").map(model => ({
13
- id: model.id, vendor: maker(model), ...(model.owned_by ? { owned_by: model.owned_by } : {}),
14
+ id: model.id, display_name: modelDisplayName(model), vendor: maker(model), ...(model.owned_by ? { owned_by: model.owned_by } : {}),
14
15
  endpoints: [["responses", ["/responses", "/v1/responses"]], ["chat", ["/chat/completions", "/v1/chat/completions"]],
15
16
  ["messages", ["/v1/messages"]]].filter(([, paths]) => paths.some(path => model.supported_endpoints?.includes(path))).map(([label]) => label),
16
17
  preview: model.preview === true, selectable: selectable(model), clients: clients(model),
@@ -3,6 +3,7 @@ import { providerDescriptors } from "./provider-descriptors.mjs";
3
3
  import { autoReviewPreference, writeAutoReviewModel } from "./user-settings.mjs";
4
4
  import { autoReviewReasoningEfforts, DEFAULT_CODEX_AUTO_REVIEW_MODEL, responsesModelIdsFromCopilotModels } from "./models.mjs";
5
5
  import { publicModelCatalog } from "./provider-metadata.mjs";
6
+ import { selectableCopilotModels } from "./live-models.mjs";
6
7
  import { createGithubProvider } from "./providers/github.mjs";
7
8
  import { readProviderSettings, writeProviderSettings } from "./provider-settings.mjs";
8
9
  import { readM365Settings, updateM365Settings, m365Paths, ensureM365GatewayKey, readM365Account, m365AccountKey } from "./m365-settings.mjs";
@@ -30,7 +31,7 @@ export function createProviderRuntime(options = {}) {
30
31
  connections = createConnectionRuntime({ ...options, legacy });return connections;
31
32
  }
32
33
 
33
- function createBuiltinProviderRuntime({ githubClient, githubRegistry, githubCredentialFingerprint = "", githubClientConfigured = true, home, env = process.env, platform = process.platform,
34
+ function createBuiltinProviderRuntime({ githubClient, githubRegistry, refreshGithubCatalog, githubCredentialFingerprint = "", githubClientConfigured = true, home, env = process.env, platform = process.platform,
34
35
  corePort = Number(env.ADAPTER_PORT || 2026), log = () => {}, createM365, startGateway, configureClients, restoreClients,
35
36
  discoverM365 = requestM365Accounts, managedClaude, onClaudeReady, preserveClientConfiguration } = {}) {
36
37
  const options = { home, env, platform }, github = { ...createGithubProvider({ client: githubClient,
@@ -243,7 +244,14 @@ function createBuiltinProviderRuntime({ githubClient, githubRegistry, githubCred
243
244
  definitions: providerRegistry.list() });
244
245
  },
245
246
  async dashboardCatalog({ provider = selection.codex } = {}) {
246
- if (provider === "github") return null;
247
+ if (provider === "github") {
248
+ if (!refreshGithubCatalog) return null;
249
+ const catalog = await refreshGithubCatalog();
250
+ const selected = new Set(selectableCopilotModels(catalog).models.map(model => model.id));
251
+ const upstreamHost = githubClient.runtimeStatus?.().upstream_host;
252
+ return { source: "live", checkedAt: new Date().toISOString(), upstreamHost: upstreamHost && upstreamHost !== "unknown" ? upstreamHost : "GitHub Copilot", advertised: catalog.data.length,
253
+ models: publicModelCatalog(catalog.data, { selectable: model => selected.has(model.id), clients: model => selected.has(model.id) ? ["codex"] : [] }) };
254
+ }
247
255
  if (provider !== "m365") throw Object.assign(new Error("Unknown provider"), { statusCode: 400 });
248
256
  if (!enabled || !["darwin", "win32"].includes(platform)) throw unavailable(!enabled ? "m365_disabled" : "m365_unsupported");
249
257
  if (!m365) throw unavailable(reason || "m365_not_ready");
@@ -124,7 +124,7 @@ export function createApiProvider({ config, secrets, env = process.env, platform
124
124
  return {
125
125
  id: config.id, name: config.name, client, registry, configuredModels: true, defaultReviewEffort: null, profileId: (protocol = "responses") => profiles[protocol] || profile,
126
126
  models: family => catalog.filter(model => model.supported_endpoints.includes(family === "claude" ? paths.messages : paths.responses))
127
- .map(model => ({ ...model, capability: model.protocol_capabilities[family === "claude" ? "messages" : "responses"] })),
127
+ .map(model => ({ ...model, ...modelDisplay(model.id), capability: model.protocol_capabilities[family === "claude" ? "messages" : "responses"] })),
128
128
  catalog: () => catalog,
129
129
  publicCatalog(allowed = []) { return { source: "configured", checkedAt: config.checked_at || null, upstreamHost: new URL(config.base_url).hostname,
130
130
  advertised: catalog.length, models: publicModelCatalog(catalog.map(model => ({ ...model, ...modelDisplay(model.id) })), { maker: model => model.publisher || model.vendor || null,
@@ -66,8 +66,8 @@ export function releaseChecksum(manifest, name) {
66
66
  if (lines.length !== 1 || !/^[a-f0-9]{64} [\w.-]+$/.test(lines[0])) throw new Error("Release checksum is missing or invalid");
67
67
  return lines[0].slice(0, 64);
68
68
  }
69
- export function packageMetadata(bytes) {
70
- const tar = gunzipSync(bytes, { maxOutputLength: 64 * 1024 * 1024 });
69
+ export function packageMetadata(bytes, { complete = false } = {}) {
70
+ const tar = gunzipSync(bytes, { maxOutputLength: (complete ? 256 : 64) * 1024 * 1024 });
71
71
  let metadata;
72
72
  for (let offset = 0; offset + 512 <= tar.length;) {
73
73
  const header = tar.subarray(offset, offset + 512), name = header.subarray(0, 100).toString().replace(/\0.*$/s, "");
@@ -85,15 +85,41 @@ export function packageMetadata(bytes) {
85
85
  if (metadata?.name !== "codex-copilot-dx" || !stableVersion(metadata.version)) throw new Error("Release package identity is invalid");
86
86
  return metadata;
87
87
  }
88
- export async function downloadRelease(tag, { fetchImpl = fetch, directory, signal } = {}) {
88
+ export function runtimeReleaseTarget({ platform = process.platform, arch = process.arch, libc } = {}) {
89
+ if (!["darwin", "win32", "linux"].includes(platform) || !["x64", "arm64"].includes(arch)) throw new Error("No complete Release package is available for this platform");
90
+ if (platform !== "linux") return `${platform}-${arch}`;
91
+ libc ||= process.report?.getReport().header.glibcVersionRuntime ? "glibc" : "musl";
92
+ if (!["glibc", "musl"].includes(libc)) throw new Error("Unsupported Linux runtime");
93
+ return `${platform}-${arch}-${libc}`;
94
+ }
95
+ export function remoteDownloadDenied(error) {
96
+ return error?.npmCode === "EALLOWREMOTE" || /(?:^|\n)npm (?:error|ERR!) code EALLOWREMOTE(?:\r?\n|$)/.test(String(error?.stderr || ""));
97
+ }
98
+ export async function downloadRelease(tag, { fetchImpl = fetch, directory, signal, complete = false, preferComplete = false, platform, arch, libc } = {}) {
89
99
  const version = stableVersion(tag);if (!version) throw new Error("A valid stable GitHub release tag is required");
90
- const name = `codex-copilot-dx-${version}.tgz`, base = `${RELEASE_BASE}/v${version}`;
100
+ const base = `${RELEASE_BASE}/v${version}`;
91
101
  const manifest = await releaseBytes(`${base}/SHA256SUMS`, { fetchImpl, maxBytes: 65536, signal });
102
+ let name = `codex-copilot-dx-${version}.tgz`, target;
103
+ if (complete || preferComplete) {
104
+ if (complete) target = runtimeReleaseTarget({ platform, arch, libc });
105
+ else {
106
+ try { target = runtimeReleaseTarget({ platform, arch, libc }); } catch { /* Other platforms retain the source-only bootstrap path. */ }
107
+ }
108
+ if (target) {
109
+ const runtimeName = `codex-copilot-dx-${version}-${target}.tgz`;
110
+ if (complete || manifest.toString("utf8").split(/\r?\n/).some(line => line.endsWith(` ${runtimeName}`))) { name = runtimeName;complete = true; }
111
+ }
112
+ }
92
113
  const expected = releaseChecksum(manifest, name);
93
- const bytes = await releaseBytes(`${base}/${name}`, { fetchImpl, maxBytes: 16 * 1024 * 1024, signal });
114
+ const bytes = await releaseBytes(`${base}/${name}`, { fetchImpl, maxBytes: (complete ? 64 : 16) * 1024 * 1024, signal });
94
115
  if (createHash("sha256").update(bytes).digest("hex") !== expected) throw new Error("Release checksum mismatch; no installation was started");
95
- if (packageMetadata(bytes).version !== version) throw new Error("Release package version does not match its tag");
96
- const file = path.join(directory, name);fs.writeFileSync(file, bytes, { flag: "wx", mode: 0o600 });return { file, name, version };
116
+ const metadata = packageMetadata(bytes, { complete });
117
+ if (metadata.version !== version) throw new Error("Release package version does not match its tag");
118
+ if (complete && (metadata.ccdx_runtime?.schema !== 1 || metadata.ccdx_runtime.target !== target
119
+ || !Array.isArray(metadata.bundleDependencies) || !["sharp", "smol-toml", "@azure/msal-node-runtime"].every(name => metadata.bundleDependencies.includes(name)))) {
120
+ throw new Error("Complete Release package does not match this runtime or lacks bundled dependencies");
121
+ }
122
+ const file = path.join(directory, name);fs.writeFileSync(file, bytes, { flag: "wx", mode: 0o600 });return { file, name, version, complete };
97
123
  }
98
124
 
99
125
  // Preserve only this package and its command entries. Never snapshot credentials
@@ -190,11 +216,12 @@ async function bootstrap() {
190
216
  const target = path.join(prefix, ...(process.platform === "win32" ? [] : ["lib"]), "node_modules", "codex-copilot-dx");
191
217
  const directory = fs.mkdtempSync(path.join(os.tmpdir(), "ccdx-install-"));let transaction;
192
218
  try {
193
- const release = await downloadRelease(tag, { directory, fetchImpl: createNpmReleaseFetch(npmCli) });
219
+ const release = await downloadRelease(tag, { directory, fetchImpl: createNpmReleaseFetch(npmCli), preferComplete: true });
194
220
  transaction = protectInstallation({ target, prefix });
195
221
  const npmVersion = execFileSync(process.execPath, [npmCli, "--version"], { encoding: "utf8", timeout: 10000 }).trim();
196
222
  const args = [npmCli, "install", "--global", "--prefix", prefix, "--ignore-scripts", "--no-audit", "--no-fund"];
197
- if (permission && Number(npmVersion.split(".")[0]) >= 12) args.push("--allow-remote=all");
223
+ if (release.complete) args.push("--offline");
224
+ else if (permission && Number(npmVersion.split(".")[0]) >= 12) args.push("--allow-remote=all");
198
225
  args.push(release.file);
199
226
  execFileSync(process.execPath, args, { stdio: "inherit", timeout: 300000 });
200
227
  verifyPackageRuntime(target, release.version, { brokerRequired: ["darwin", "win32"].includes(process.platform) });
@@ -202,7 +229,7 @@ async function bootstrap() {
202
229
  transaction.commit();transaction = null;
203
230
  console.log(`Installed CCDX ${release.version}. Existing services keep running until restarted.`);
204
231
  } catch (error) {
205
- transaction?.rollback();throw new Error("Installation failed. Previous CCDX package and commands were restored. Check approved registry, proxy, certificates and npm policy; dependencies still need registry access.", { cause: error });
232
+ transaction?.rollback();throw new Error("Installation failed. Previous CCDX package and commands were restored. Check the Release package, platform, proxy, certificates and npm policy. Older source-only releases still need registry access.", { cause: error });
206
233
  } finally { fs.rmSync(directory, { recursive: true, force: true }); }
207
234
  }
208
235
  if (process.argv[1] && path.basename(process.argv[1]) === "ccdx-install.mjs" && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
@@ -166,7 +166,7 @@ export function createHttpFailureDiagnostics({ maxEntries = 20, now } = {}) {
166
166
  };
167
167
  }
168
168
 
169
- export function buildHttpFailureDetails({ statusCode, route, requestId, model, code, origin, headers,
169
+ export function buildHttpFailureDetails({ statusCode, route, requestId, model, code, origin, headers, model_error,
170
170
  error_body, error_type, parameter, diagnostic_message, method, target, request_options, upstream_attempts, attempt_timings, requested_model, provider,
171
171
  application, reason, capability_cached, shared_upstream, transport }) {
172
172
  if (!reason && code === "ccdx_client_source_disabled" && upstream_attempts === 0 && origin !== "upstream_http") {
@@ -188,7 +188,7 @@ export function buildHttpFailureDetails({ statusCode, route, requestId, model, c
188
188
  : origin === "client_validation" ? "The request was rejected locally before an upstream call."
189
189
  : error_body === "empty" ? "Upstream returned no error details." : "HTTP request failed; original response was preserved.");
190
190
  const details = responseFailureDetails({ model, error: { code: typeof code === "string" && /^[a-z\d_.:-]{1,80}$/i.test(code) ? code : `http_${statusCode}`,
191
- message } }, "http.error", { headers, provider });
191
+ message: model_error ? "The model source reported an error; the original HTTP response was preserved." : message } }, model_error ? "model.error" : "http.error", { headers, provider });
192
192
  return { ...details, request_id: requestId, http_status: statusCode, route,
193
193
  origin: origin || (route === "not_found" ? "route" : "unclassified"), local_message: true,
194
194
  ...(error_body ? { error_body } : {}), ...(error_type ? { error_type } : {}), ...(parameter ? { parameter } : {}),