mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-08 08:15:38 +00:00
* feat(desktop): add Web Shell Tauri proof of concept * feat(desktop): prepare Web Shell shell for release * fix(desktop): make release dry runs portable * fix(desktop): harden cross-platform release smoke * fix(desktop): stabilize Windows and Linux CI * fix(desktop): scope bootstrap env to daemon * fix(desktop): stabilize packaged app smoke * fix(desktop): diagnose Linux packaged startup * fix(desktop): address release readiness review * fix(desktop): address follow-up review findings * fix(desktop): address runtime review blockers * fix(desktop): gate cookie auth acceptance behind desktop bootstrap flag - Cookie→Bearer translation middleware now only active when desktopShellBootstrap is enabled - Use timing-safe comparison for bootstrap token validation * fix(desktop): replace cookie handshake with URL fragment auth - Navigate the desktop WebView to /#token=<token>; the fragment never reaches the server, so drop the desktop cookie bootstrap middleware, its cookie->bearer translation, and the related serve tests - Skip the deferred-runtime auth gate for pre-auth Web Shell routes (GET|HEAD / and /assets/*): a document navigation cannot carry an Authorization header, so the fast-path window used to answer the first desktop navigation with 401 Unauthorized until a manual reload - Poll /health?deep=true before navigating: deep health stays 503 (reason: bootstrap) until the runtime app that mounts the Web Shell is ready, so readiness can no longer race the deferred window - Run the folder picker off the main thread and only store the runtime after the WebView navigation succeeds - Enable withGlobalTauri plus a bootstrap capability so the bootstrap page can subscribe to desktop lifecycle events - Update smoke-packaged to assert the fragment contract (unauthenticated root navigation 200, no cookies minted, API routes still 401) and sync the release design doc * fix(desktop): fix Linux smoke log path, add runtime .gitkeep, correct README (#8132) * fix(desktop): close release readiness gaps * fix(cli): keep deferred serve auth gate closed when web shell unmounted (#8132) * fix(desktop): address review feedback on auth gates and runtime bundle (#8132) - Cover the method guard in isPreAuthWebShellRequest: assert unauthenticated POST to / and /assets/* is still 401 during the deferred runtime window. - Add unit tests for is_allowed_navigation covering the unset origin, set origin, and bootstrap-after-origin cases. - Drop DEV:'true' from the release bundle step so the esbuild metafile is no longer shipped as dead weight in the desktop runtime. * fix(desktop): address review feedback on runtime extraction and release workflow (#8132) - Extract .zip Node archives with unzip so Linux cross-builds for win32-x64 no longer crash on GNU tar. - Build the Windows signing config with ConvertTo-Json instead of backslash escapes, which PowerShell treats as a parse error. - Fetch the runtime Web Shell without a bearer token so the smoke test exercises the pre-auth navigation path the shell relies on. - Make GitHub release creation idempotent so a re-run after a partial publish uploads assets instead of failing on the existing tag. * fix(desktop): normalize artifact filenames to prevent updater 404s (#8132) GitHub rewrites spaces to dots when release assets are uploaded, but the updater manifest encoded spaces as %20 via encodeURIComponent. This caused every platform's auto-update URL to 404 on published releases. Replace spaces with hyphens in the Collect artifacts step for all platforms so the local filename, the manifest URL, and the published asset name agree by construction. Update test-release.js fixtures to match and assert no artifact name contains a space. * fix(desktop): address review feedback on security, lint, and code quality (#8132) * fix(desktop): address review feedback on smoke test, error UX, and window state (#8132) * fix(desktop): address review feedback on crate build, recovery UX, auth gate, and CI (#8132) * fix(desktop): address review feedback on settings race, version script, and log growth (#8132) * fix(desktop): address review feedback on retry, auth gate, and release clobber (#8132) * fix(desktop): gate commands to bootstrap origin and show native update dialog (#8132) * fix(desktop): use matches! instead of PartialEq on JoinError result (#8132) * fix(desktop): wait for deferred runtime in smoke tests and sync release flags on clobber (#8132) --------- Co-authored-by: Qwen Code Bot <qwen-code-bot@users.noreply.github.com> Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com> Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com> Co-authored-by: Qwen Code Autofix <qwen-code-autofix@users.noreply.github.com>
191 lines
4.9 KiB
JavaScript
191 lines
4.9 KiB
JavaScript
const tauri = window.__TAURI__;
|
|
const invoke = tauri?.core?.invoke;
|
|
const listen = tauri?.event?.listen;
|
|
|
|
const title = document.querySelector('#title');
|
|
const detail = document.querySelector('#detail');
|
|
const pulse = document.querySelector('#pulse');
|
|
const workspace = document.querySelector('#workspace');
|
|
const error = document.querySelector('#error');
|
|
const choose = document.querySelector('#choose');
|
|
const retry = document.querySelector('#retry');
|
|
const logs = document.querySelector('#logs');
|
|
const update = document.querySelector('#update');
|
|
const version = document.querySelector('#version');
|
|
|
|
let updateVersion;
|
|
|
|
function setWorkspace(path) {
|
|
workspace.hidden = !path;
|
|
workspace.textContent = path || '';
|
|
}
|
|
|
|
function setStatus(kind, heading, message, failure = '') {
|
|
title.textContent = heading;
|
|
detail.textContent = message;
|
|
pulse.className = `pulse ${kind === 'starting' ? '' : kind}`;
|
|
error.style.display = failure ? 'block' : 'none';
|
|
error.textContent = failure;
|
|
retry.hidden = kind !== 'error';
|
|
choose.disabled = kind === 'starting';
|
|
}
|
|
|
|
async function chooseWorkspace() {
|
|
if (!invoke) return;
|
|
setStatus(
|
|
'starting',
|
|
'Opening workspace',
|
|
'Starting the bundled Qwen Code runtime…',
|
|
);
|
|
try {
|
|
const path = await invoke('choose_workspace');
|
|
if (path) setWorkspace(path);
|
|
else setStatus('idle', 'Choose where to work', 'No folder was selected.');
|
|
} catch (failure) {
|
|
setStatus(
|
|
'error',
|
|
'Workspace could not start',
|
|
'Review the details or open the desktop log.',
|
|
String(failure),
|
|
);
|
|
}
|
|
}
|
|
|
|
async function retryRuntime() {
|
|
if (!invoke) return;
|
|
setStatus(
|
|
'starting',
|
|
'Restarting Qwen Code',
|
|
'Checking the bundled runtime and workspace…',
|
|
);
|
|
try {
|
|
await invoke('restart_runtime');
|
|
} catch (failure) {
|
|
setStatus(
|
|
'error',
|
|
'Qwen Code could not restart',
|
|
'Review the details or choose another workspace.',
|
|
String(failure),
|
|
);
|
|
}
|
|
}
|
|
|
|
async function installUpdate() {
|
|
if (!invoke) return;
|
|
update.disabled = true;
|
|
update.textContent = `Installing ${updateVersion || 'update'}…`;
|
|
try {
|
|
await invoke('install_update');
|
|
} catch (failure) {
|
|
setStatus(
|
|
'error',
|
|
'Update failed',
|
|
'Qwen Code remains usable. Try again or update manually.',
|
|
String(failure),
|
|
);
|
|
} finally {
|
|
update.disabled = false;
|
|
update.textContent = 'Install update';
|
|
}
|
|
}
|
|
|
|
async function openLogs() {
|
|
if (!invoke) return;
|
|
try {
|
|
await invoke('open_logs');
|
|
} catch (failure) {
|
|
setStatus(
|
|
'error',
|
|
'Logs could not open',
|
|
'Review the details or try again.',
|
|
String(failure),
|
|
);
|
|
}
|
|
}
|
|
|
|
choose.addEventListener('click', chooseWorkspace);
|
|
retry.addEventListener('click', retryRuntime);
|
|
logs.addEventListener('click', openLogs);
|
|
update.addEventListener('click', installUpdate);
|
|
|
|
async function initialize() {
|
|
if (!invoke || !listen) {
|
|
setStatus(
|
|
'error',
|
|
'Desktop bridge unavailable',
|
|
'The packaged desktop bridge did not initialize.',
|
|
'Restart Qwen Code.',
|
|
);
|
|
return;
|
|
}
|
|
|
|
await Promise.all([
|
|
listen('workspace-required', () => {
|
|
setStatus(
|
|
'idle',
|
|
'Choose where to work',
|
|
'Qwen Code runs locally and keeps the existing Web Shell as the only interface.',
|
|
);
|
|
}),
|
|
listen('runtime-starting', ({ payload }) => {
|
|
setWorkspace(payload);
|
|
setStatus(
|
|
'starting',
|
|
'Starting Qwen Code',
|
|
'Launching the bundled runtime and checking its health…',
|
|
);
|
|
}),
|
|
listen('runtime-failed', ({ payload }) => {
|
|
setStatus(
|
|
'error',
|
|
'Qwen Code could not start',
|
|
'Review the details, open the log, or choose another workspace.',
|
|
String(payload),
|
|
);
|
|
}),
|
|
listen('update-available', ({ payload }) => {
|
|
updateVersion = String(payload);
|
|
update.hidden = false;
|
|
update.textContent = `Install ${updateVersion}`;
|
|
}),
|
|
]);
|
|
|
|
const state = await invoke('bootstrap_state');
|
|
version.textContent = `Desktop ${state.desktopVersion}`;
|
|
setWorkspace(state.workspace);
|
|
if (state.status === 'starting') {
|
|
setStatus(
|
|
'starting',
|
|
'Starting Qwen Code',
|
|
'Launching the bundled runtime and checking its health…',
|
|
);
|
|
} else if (state.status === 'ready') {
|
|
setStatus(
|
|
'starting',
|
|
'Loading Qwen Code',
|
|
'Connecting to the local Web Shell…',
|
|
);
|
|
} else if (state.error) {
|
|
setStatus(
|
|
'error',
|
|
'Qwen Code could not start',
|
|
'Review the details, open the log, or choose another workspace.',
|
|
state.error,
|
|
);
|
|
} else {
|
|
setStatus(
|
|
'idle',
|
|
'Choose where to work',
|
|
'Qwen Code runs locally and keeps the existing Web Shell as the only interface.',
|
|
);
|
|
}
|
|
}
|
|
|
|
initialize().catch((failure) => {
|
|
setStatus(
|
|
'error',
|
|
'Desktop initialization failed',
|
|
'Restart Qwen Code or inspect the desktop log.',
|
|
String(failure),
|
|
);
|
|
});
|