{"record":{"id":"e15565661af1ccd5","repo":"BigPizzaV3/CodexPlusPlus","slug":"discovered-some-url-nativebuilds-url-split-pop-codex-codex","errorCode":null,"errorMessage":"discovered.some(url=>!nativeBuilds[url.split('/').pop()])?'当前 Codex 版本尚未适配对话脉络，请更新插件；已有整理结果仍保留':'Codex 原生模块加载失败，请重新加载应用后重试；已有整理结果仍保留'","messagePattern":"discovered\\.some\\(url=>!nativeBuilds\\[url\\.split\\('/'\\)\\.pop\\(\\)\\]\\)\\?'当前 Codex 版本尚未适配对话脉络，请更新插件；已有整理结果仍保留':'Codex 原生模块加载失败，请重新加载应用后重试；已有整理结果仍保留'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/conversation-canvas/public/canvas.user.js","lineNumber":382,"sourceCode":"  // Keep live bindings: initialization populates the HTTP class and services.\n  for(const [key,value] of Object.entries(mapping))Object.defineProperty(adapter,key,{get:()=>module[value]});\n  return adapter;\n}\nfunction createNativeLoader({discover=nativeAssetCandidates,importModule=url=>import(url)}={}){\n  let pending;\n  return function load(){\n    if(!pending)pending=(async()=>{\n      const discovered=discover();\n      // Without resource timing (e.g. after a reload), try reviewed builds only.\n      const candidates=discovered.length?discovered:Object.keys(nativeBuilds).reverse().map(name=>'app://-/assets/'+name);\n      for(const url of candidates){\n        const filename=url.split('/').pop();\n        if(!nativeBuilds[filename])continue;\n        let module;\n        try{module=await importModule(url);}catch{continue;}\n        return bindNativeRuntime(module,filename);\n      }\n      throw Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])\n        ?'当前 Codex 版本尚未适配对话脉络，请更新插件；已有整理结果仍保留'\n        :'Codex 原生模块加载失败，请重新加载应用后重试；已有整理结果仍保留');\n    })().catch(error=>{pending=null;throw error;});\n    return pending;\n  };\n}\nconst loadNativeRuntime=createNativeLoader();\n\n\nfunction isExportSizeError(message){\n  return /超过.*(?:大小|限制)|too (?:large|big)|size.{0,30}limit|maximum.{0,20}size/i.test(String(message));\n}\n\n// Wire contracts verified in the installed Desktop's history loader:\n// thread/turns/list(itemsView=notLoaded), then thread/items/list per turn.\nasync function readNativeHistory(send,threadId,cache=new Map(),onProgress=()=>{},signal){\n  const turns=[],turnIds=new Set(),turnCursors=new Set();\n  let cursor=null;","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/conversation-canvas/public/canvas.user.js#L364-L400","documentation":"createNativeLoader iterates discovered app-initial asset URLs, skipping unmapped filenames and import failures. If no module loads, it distinguishes two cases: if any discovered URL's filename is absent from nativeBuilds, the Codex version is unsupported (update plugin); otherwise imports themselves failed (reload the app). Both preserve existing organize results.","triggerScenarios":"nativeGetRuntime called when (a) discovered assets include an unmapped app-initial-*.js filename → version-mismatch message, or (b) all mapped assets exist but every import(url) threw (app shell broken/cached assets missing) → reload message.","commonSituations":"Codex updated beyond plugin support (case a), or a corrupted/partially-updated app install where assets are discoverable via performance entries but fail to import (case b).","solutions":["For the version message: update the plugin (or pin Codex) so nativeBuilds covers the discovered asset","For the load-failure message: fully reload/restart the Codex application to restore importable assets","Clear app caches if a partial update left stale app-initial assets","Confirm network/app-shell health: asset URLs came from perf entries but import() failed — reinstall if it persists"],"exampleFix":"// before\nthrow Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])?'版本未适配':'加载失败');\n// after (surface the underlying import error for diagnosis)\nconst lastError=errors[errors.length-1];\nthrow Object.assign(Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])\n  ?'当前 Codex 版本尚未适配对话脉络，请更新插件；已有整理结果仍保留'\n  :'Codex 原生模块加载失败，请重新加载应用后重试；已有整理结果仍保留'),{cause:lastError});","handlingStrategy":"try-catch","validationCode":"const candidates=await nativeAssetCandidates();\nif(candidates.length===0) throw new Error('no native assets discovered');\nconst mapped=candidates.filter(u=>nativeBuilds[u.split('/').pop()]);\nif(mapped.length===0) throw new Error('plugin does not support this Codex build');","typeGuard":"function canBind(module,filename){ return !!nativeBuilds[filename] && !!module; }","tryCatchPattern":"try { runtime=await nativeGetRuntime() } catch(e){ if(String(e.message).includes('尚未适配')) promptPluginUpdate(); else if(String(e.message).includes('加载失败')) promptAppReload(); else throw e; }","preventionTips":["Restart the app fully after Codex updates to avoid stale asset imports","Map every supported app-initial hash in nativeBuilds","Attach the underlying import error as cause for easier diagnosis"],"tags":["native-module","version-incompatibility","asset-loading"],"backgroundTag":"module-init-failed","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"}