Uh oh!
There was an error while loading. Please reload this page.
[codex] Add Qwen runtime source options to desktop release - #8
Conversation
Uh oh!
There was an error while loading. Please reload this page.
') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })();
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
What this PR does
Adds an explicit Qwen Code runtime source selector to the Desktop Release workflow. Release operators can now choose
npm_latest,source_branch, orpinned_package_version; source-branch builds check outQwenLM/qwen-codeat the requested ref and setQWEN_CODE_ROOT, npm-latest builds setQWEN_CODE_VERSION=latest, and pinned builds continue to usepackage.json'sqwenCodeRuntime.versionunless an exact npm version is entered.The vendoring script now resolves npm dist-tags through package metadata before downloading the tarball, so
QWEN_CODE_VERSION=latestresolves to the current npmlatestversion instead of trying to download a nonexistentqwen-code-latest.tgzfile.Why it's needed
The release UI previously had an optional
qwen_code_versiontext field, but leaving it empty silently packaged the pinned0.15.11runtime. That made it too easy to think a desktop release was using the current Qwen Code runtime when it was actually using the package-pinned fallback. The workflow now makes that choice visible and supports the three intended release modes: current npm latest, a Qwen Code source ref, or the pinned runtime version.Reviewer Test Plan
How to verify
Open the Desktop Release workflow dispatch form and confirm the new
qwen_code_sourcechoice containsnpm_latest,source_branch, andpinned_package_version. Forsource_branch, confirmqwen_code_refcontrols theQwenLM/qwen-codecheckout. Fornpm_latest, confirm the build logs show the real npm version resolved from thelatestdist-tag.Evidence (Before & After)
Before: running the old vendoring script with
QWEN_CODE_VERSION=latestattempted to downloadhttps://registry.npmjs.org/@qwen-code/qwen-code/-/qwen-code-latest.tgzand failed with HTTP 404.After:
QWEN_CODE_VERSION=latest bun run scripts/vendor-qwen-code.tsresolved npmlatestto0.17.1at test time and vendored@qwen-code/qwen-code@0.17.1; the default pinned path vendored0.15.11; a fakeQWEN_CODE_ROOTsource checkout smoke test built and vendored a localdist/cli.js.Tested on
Environment (optional)
Local macOS shell in
/Users/dragon/Documents/openwork; Bun 1.3.8, Node 26.0.0, npm 11.12.1.Risk & Scope
source_branchbuilds clone and install Qwen Code source dependencies in every platform job, which is straightforward but slower than prebuilding the runtime once and sharing it across the matrix.source_branchhas not completed yet.qwen_code_versionbehavior is preserved underpinned_package_version, which remains the default.Linked Issues
References the desktop release workflow follow-up from #5, #6, and #7.
中文说明
What this PR does
这个 PR 给 Desktop Release workflow 加了明确的 Qwen Code runtime source 选择。发版时现在可以选择
npm_latest、source_branch或pinned_package_version;source-branch 会 checkout 指定 ref 的QwenLM/qwen-code并设置QWEN_CODE_ROOT,npm-latest 会设置QWEN_CODE_VERSION=latest,pinned 则继续使用package.json里的qwenCodeRuntime.version,除非额外填写一个精确 npm version。vendoring 脚本现在会先通过 npm package metadata 解析 dist-tag,再下载 tarball,所以
QWEN_CODE_VERSION=latest会解析成当前 npmlatest对应的真实版本,而不是去下载不存在的qwen-code-latest.tgz。Why it's needed
之前发版 UI 只有一个可选的
qwen_code_version文本框,不填就会静默打包 package 里 pinned 的0.15.11runtime。这样很容易以为桌面版用了当前 Qwen Code runtime,但实际用了固定 fallback。现在 workflow 把这个选择显式暴露出来,并支持三种预期模式:当前 npm latest、某个 Qwen Code 源码 ref、或者 pinned runtime version。Reviewer Test Plan
How to verify
打开 Desktop Release workflow 的手动触发表单,确认新的
qwen_code_source选项包含npm_latest、source_branch和pinned_package_version。选择source_branch时,确认qwen_code_ref控制QwenLM/qwen-codecheckout。选择npm_latest时,确认 build log 会显示从latestdist-tag 解析出的真实 npm 版本。Evidence (Before & After)
Before: 旧脚本在
QWEN_CODE_VERSION=latest时会尝试下载https://registry.npmjs.org/@qwen-code/qwen-code/-/qwen-code-latest.tgz,并因 HTTP 404 失败。After:
QWEN_CODE_VERSION=latest bun run scripts/vendor-qwen-code.ts在测试时把 npmlatest解析为0.17.1,并成功 vendor@qwen-code/qwen-code@0.17.1;默认 pinned 路径 vendor 了0.15.11;fakeQWEN_CODE_ROOTsource checkout smoke test 也能 build 并 vendor 本地dist/cli.js。Tested on
Environment (optional)
本地 macOS shell,目录
/Users/dragon/Documents/openwork;Bun 1.3.8,Node 26.0.0,npm 11.12.1。Risk & Scope
source_branch会在每个平台 job 里 clone 并安装 Qwen Code 源码依赖,逻辑直接但比预先构建一次 runtime 再分发给 matrix 更慢。source_branch模式。qwen_code_version行为保留在默认的pinned_package_version下。Linked Issues
References desktop release workflow 从 #5、#6、#7 延续下来的后续改进。