Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ test('platform-coupled subsystems match on segments, not substrings', () => {
'packages/cli/src/ui/emptyState.ts',
'packages/core/src/telemetry/uploader.ts',
'packages/cli/src/services/plateauDetector.ts',
'packages/cli/src/ui/hooks/shellCommandProcessor.ts',
]) {
assert.equal(classifyChangedFiles([file]), PLATFORM_INSENSITIVE, file);
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ env:
# BOTH the github_ci_only helper step and the full-profile helper step,
# both in `lint_and_static`, so a new helper test can't be added to one
# path and silently dropped from the other.
HELPER_TESTS: '.github/scripts/pr-safety-precheck.test.mjs .github/scripts/cap-release-notes.test.mjs .github/scripts/ci/classify-profile.test.mjs .github/scripts/ci/classify-platform-sensitivity.test.mjs .github/scripts/ci/classify-pr-profile.test.mjs .github/scripts/upsert-bot-comment.test.mjs .github/scripts/ci/main-failure-signature.test.mjs .github/scripts/classify-release-notes.test.mjs .github/scripts/dsw-swe-verified/make-manifest.test.mjs .github/scripts/dsw-swe-verified/make-terminal-bench-manifest.test.mjs .github/scripts/resolve-sandbox-image.test.mjs .github/scripts/web-shell-visuals-publish.test.mjs .github/scripts/web-shell-visuals-compose.test.mjs .github/scripts/serve-ab-diff.test.mjs .github/scripts/serve-ab-drive.test.mjs .github/scripts/qwen-triage-workflow.test.mjs .github/scripts/assign-issue-owner.test.mjs .github/scripts/auto-minimize-spam.test.mjs .github/scripts/ci-runner-routing.test.mjs .github/scripts/autofix-status-heartbeat.test.mjs .github/scripts/assign-pr-owner.test.mjs .github/scripts/check-disk-floor.test.mjs .github/scripts/ci-disk-pressure.test.mjs .github/scripts/e2e-build.test.mjs'
HELPER_TESTS: '.github/scripts/pr-safety-precheck.test.mjs .github/scripts/cap-release-notes.test.mjs .github/scripts/ci/classify-profile.test.mjs .github/scripts/ci/classify-platform-sensitivity.test.mjs .github/scripts/ci/classify-pr-profile.test.mjs .github/scripts/upsert-bot-comment.test.mjs .github/scripts/ci/main-failure-signature.test.mjs .github/scripts/classify-release-notes.test.mjs .github/scripts/dsw-swe-verified/make-manifest.test.mjs .github/scripts/dsw-swe-verified/make-terminal-bench-manifest.test.mjs .github/scripts/resolve-sandbox-image.test.mjs .github/scripts/web-shell-visuals-publish.test.mjs .github/scripts/web-shell-visuals-compose.test.mjs .github/scripts/serve-ab-diff.test.mjs .github/scripts/serve-ab-drive.test.mjs .github/scripts/qwen-triage-workflow.test.mjs .github/scripts/assign-issue-owner.test.mjs .github/scripts/auto-minimize-spam.test.mjs .github/scripts/ci-runner-routing.test.mjs .github/scripts/autofix-status-heartbeat.test.mjs .github/scripts/assign-pr-owner.test.mjs .github/scripts/check-disk-floor.test.mjs .github/scripts/ci-disk-pressure.test.mjs .github/scripts/e2e-build.test.mjs integration-tests/concurrent-runner/export-html-from-chatrecord-jsonl.test.mjs'
# The growth ratchet and its vitest mirror compare each workflow against
# the PR's base commit to tell "this PR grew the file" apart from "the
# baseline went stale on main" (#9904). Wired once here so every lane
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/daemon/01-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ flowchart TB
end

subgraph adapters["Adapters"]
WUIP["web-shell/client/daemon/<br/>DaemonSessionProvider.tsx"]
WUIP["web-shell/client/daemon/session/<br/>DaemonSessionProvider.tsx"]
TUIA["cli/src/ui/daemon/<br/>daemon-tui-adapter.ts"]
CHB["channels/base/<br/>DaemonChannelBridge.ts"]
DT["channels/dingtalk"]
Expand Down
4 changes: 2 additions & 2 deletions docs/users/features/followup-suggestions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Qwen Code can predict what you want to type next and show it as placeholder text in the input area. This feature uses an LLM call to analyze the conversation context and generate a natural next step suggestion.

This feature works end-to-end in both the CLI and Web Shell. Generation is automatic and server-side: after each completed turn the daemon emits the suggestion on the session stream (on by default; set `ui.enableFollowupSuggestions` to `false` to opt out), and Web Shell's composer already wires the `useDaemonFollowupSuggestion` hook, so suggestions render and accept with no additional host wiring.
This feature works end-to-end in both the CLI and Web Shell. Generation is automatic and server-side: after each cleanly completed turn (the daemon's `end_turn` stop reason — not `interrupted`, `max_tokens`, or an error) the daemon emits the suggestion on the session stream (on by default; set `ui.enableFollowupSuggestions` to `false` to opt out), and Web Shell's composer already wires the `useDaemonFollowupSuggestion` hook, so suggestions render and accept with no additional host wiring.
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved

## How It Works

Expand Down Expand Up @@ -36,7 +36,7 @@ Suggestions are generated when all of the following conditions are met:
- The approval mode is not set to `plan`
- The feature is enabled (on by default — set `ui.enableFollowupSuggestions` to `false` to turn it off)

Suggestions will not appear in non-interactive mode (e.g., headless/SDK mode).
Suggestions will not appear in the CLI's non-interactive mode (e.g., headless/SDK mode). In the daemon, generation is server-side and unconditional, so a headless or SDK client that cannot render the suggestion should set `ui.enableFollowupSuggestions` to `false` to avoid the per-turn LLM cost.
Comment thread
yiliang114 marked this conversation as resolved.
Resolved

Suggestions are automatically dismissed when:

Expand Down
27 changes: 26 additions & 1 deletion integration-tests/chat-transcript-document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ describe('ExportTranscriptDocument browser gate', () => {
await expandAll.click();
expect(await expandAll.isDisabled()).toBe(true);
await themeToggle.click();
expect(await page.locator('html').getAttribute('class')).toContain('light');
await expect(page.locator('html')).toHaveClass(/light/);
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
await expect
.poll(() => page.locator('div[class*="mermaidInline"] svg').count())
.toBeGreaterThan(0);
Expand Down Expand Up @@ -663,6 +663,31 @@ describe('ExportTranscriptDocument browser gate', () => {
);
await page.close();
}

// The `unhandledrejection` fail-closed handler is wired to showLoadError but
// no servable body passes SRI, so exercise it with a synthetic rejection.
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
{
const page = await browser.newPage();
await page.route('**/*', (route) => route.abort('blockedbyclient'));
await page.setContent(renderExportTranscriptDocumentToHtml(document), {
waitUntil: 'load',
});
await page.evaluate(() => {
window.dispatchEvent(
new PromiseRejectionEvent('unhandledrejection', {
promise: Promise.reject(new Error('boot failed')),
reason: new Error('boot failed'),
}),
);
});
await expect
.poll(() => page.locator('body').getAttribute('data-render-complete'))
.toBe('error');
expect(await page.getByRole('alert').textContent()).toContain(
'Unable to load this chat export',
);
await page.close();
}
});

it('runs the real HTML export entry point with its pinned npm runtime', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import fs from 'node:fs';
import fsp from 'node:fs/promises';
import path from 'node:path';
import readline from 'node:readline';
import { pathToFileURL } from 'node:url';

async function loadExportApi() {
try {
Expand Down Expand Up @@ -75,7 +76,7 @@ async function readJsonlObjects(inputPath) {
return objects;
}

function looksLikeChatRecord(value) {
export function looksLikeChatRecord(value) {
return (
value !== null &&
typeof value === 'object' &&
Expand All @@ -89,7 +90,7 @@ function looksLikeChatRecord(value) {
);
}

function looksLikeExportJsonl(objects) {
export function looksLikeExportJsonl(objects) {
const first = objects[0];
return (
first !== null &&
Expand Down Expand Up @@ -163,7 +164,13 @@ async function main() {
console.log(`Wrote HTML export to: ${outputPath}`);
}

main().catch((error) => {
console.error(error instanceof Error ? error.message : String(error));
process.exitCode = 1;
});
const isMain =
process.argv[1] !== undefined &&
import.meta.url === pathToFileURL(process.argv[1]).href;
Comment thread
yiliang114 marked this conversation as resolved.
Resolved

if (isMain) {
main().catch((error) => {
console.error(error instanceof Error ? error.message : String(error));
process.exitCode = 1;
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/

import assert from 'node:assert/strict';
import test from 'node:test';

import {
looksLikeChatRecord,
looksLikeExportJsonl,
} from './export-html-from-chatrecord-jsonl.js';
Comment thread
yiliang114 marked this conversation as resolved.
Resolved

function chatRecord(overrides = {}) {
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
return {
uuid: 'uuid-1',
parentUuid: null,
sessionId: 'session-1',
timestamp: '2026-09-05T00:00:00.000Z',
type: 'user',
cwd: '/workspace',
version: '1',
...overrides,
};
}

test('rejects legacy exported JSONL (session_metadata-first envelope)', () => {
const legacy = [
{
type: 'session_metadata',
sessionId: 'session-1',
startTime: '2026-09-05T00:00:00.000Z',
},
];

assert.equal(looksLikeExportJsonl(legacy), true);
// A legacy envelope is not a ChatRecord, so it can never take the happy path.
assert.equal(looksLikeChatRecord(legacy[0]), false);
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
});

test('accepts source ChatRecord JSONL', () => {
const records = [chatRecord()];

assert.equal(looksLikeExportJsonl(records), false);
assert.equal(looksLikeChatRecord(records[0]), true);
});
104 changes: 52 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"msw": "^2.10.4",
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.1",
"playwright": "^1.57.0",
"playwright": "1.61.1",
"prettier": "^3.5.3",
"react-devtools-core": "^6.1.5",
"semver": "^7.7.2",
Expand Down
10 changes: 10 additions & 0 deletions packages/web-shell/client/components/messages/Markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ describe('isSafeHref', () => {
expect(isSafeHref('javascript:alert(1)')).toBe(false);
});

it('blocks file: scheme', () => {
expect(isSafeHref('file://attacker.example/share/file.md')).toBe(false);
expect(isSafeHref('file:///etc/passwd')).toBe(false);
});

it('blocks data: URIs', () => {
expect(isSafeHref('data:text/html,<script>alert(1)</script>')).toBe(false);
});
Expand Down Expand Up @@ -145,6 +150,11 @@ describe('isSafeImageSrc', () => {
expect(isSafeImageSrc('javascript:alert(1)')).toBe(false);
});

it('blocks file: scheme', () => {
expect(isSafeImageSrc('file:///tmp/private.png')).toBe(false);
expect(isSafeImageSrc('file://attacker.example/share/img.png')).toBe(false);
});

it('allows relative paths', () => {
expect(isSafeImageSrc('/images/logo.png')).toBe(true);
});
Expand Down
13 changes: 13 additions & 0 deletions packages/web-shell/client/daemon/session/clientLifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ describe('persistStableClientId', () => {
expect(getStableClientId(undefined)).toMatch(/^webui_/);
});

it('persists under the literal historical key prefix', () => {
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
persistStableClientId('client-a', 'session-a');

// The exact key string is a compatibility contract with sessions persisted
// before the WebUI-to-Web-Shell rename. Renaming the constant must break
// this assertion, not silently pass via a shared read/write helper.
expect(
window.sessionStorage.getItem(
'qwen-code-webui-client-id:session:session-a',
),
).toBe('client-a');
});

it('ignores missing client ID', () => {
persistStableClientId(undefined);
expect(
Expand Down
Loading
Loading