{"record":{"id":"176d14e8f8a710ae","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-api-native","errorCode":null,"errorMessage":"当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本","messagePattern":"当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/conversation-canvas/src/native-api.js","lineNumber":5,"sourceCode":"// HTTP uses the app host, with versioned runtime bindings, not renderer fetch/CSP.\nasync function nativeApiRequest(url,options){\n  const localError=message=>Object.assign(Error(message),{canvasApiLocal:true});\n  let native;\n  try{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本');}\n  if(typeof native.lGt!=='function')throw localError('当前 Codex 版本未提供兼容的 HTTP 服务');\n  native.lGt();\n  const client=native.cGt?.getInstance?.();\n  if(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪，请稍后重试');\n  const {onProgress,...fetchOptions}=options;\n  const response=await client.fetch(url,fetchOptions);\n  return readApiResponse(response,options.signal,onProgress);\n}\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/conversation-canvas/src/native-api.js#L1-L14","documentation":"nativeApiRequest depends on loadNativeRuntime() to bind to the host app's versioned runtime. If loading the native runtime throws (bindings missing for this Codex build), the function raises this local error telling the user the current Codex version's API adapter is incompatible and the canvas script needs updating.","triggerScenarios":"Any nativeApiRequest call where loadNativeRuntime() rejects/throws — the Codex app version has no matching runtime binding map for the canvas script's expected exports.","commonSituations":"Codex desktop app auto-updated to a version the canvas script doesn't support; obfuscated binding names (lGt, cGt, jR) changed between Codex releases; script not updated after a Codex upgrade.","solutions":["Update the 对话脉络 (conversation canvas) script to the latest version supporting the installed Codex build","Check the script's release notes for the minimum supported Codex version","Pin/downgrade Codex to a supported version if the script update is unavailable","Report/extend the runtime binding map in native-api.js for the new Codex version"],"exampleFix":"// before\ntry{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本');}\n// after\ntry{native=await loadNativeRuntime();}catch(e){console.warn('native runtime load failed',e);throw localError('当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本');}","handlingStrategy":"fallback","validationCode":"async function runtimeCompatible(){try{const n=await loadNativeRuntime();return !!n;}catch{return false;}}","typeGuard":"const hasRuntime=(n)=>n!=null&&typeof n==='object';","tryCatchPattern":"try{await nativeApiRequest(url,opts);}catch(e){if(e.canvasApiLocal&&/适配器不兼容/.test(e.message)){notifyUpdateRequired();}else throw e;}","preventionTips":["Check the script version against the Codex app version after every app update","Subscribe to script update channels","Wrap runtime loading so incompatibility shows an update prompt, not a crash"],"tags":["version-incompatibility","runtime-binding","codex-api"],"backgroundTag":"incompatible-source-type","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}