* fix(vscode-ide-companion/session): force fresh sessions for new chats
Ensure explicit new-session actions bypass active ACP session reuse so the VS Code sidebar clears context correctly.
Add regression coverage for the agent manager and webview new-session entry points.
* fix(vscode): remove core runtime imports from webview bundle
Replace the runtime import of `isSupportedImageMimeType` from
`@qwen-code/qwen-code-core` with a local `SUPPORTED_PASTED_IMAGE_MIME_TYPES`
set in the vscode-ide-companion package. The webview is bundled for a
browser environment where Node.js-only core modules are unavailable,
so keeping the MIME list local avoids esbuild failures during development.
Added tests to verify the local list stays aligned with core and that
the webview bundle does not contain core runtime imports.
* fix(vscode): reset context usage display on new session (#2847)
The webview context-usage bar did not clear when the user started a new
session because the old code always fell back to DEFAULT_TOKEN_LIMIT,
producing a stale percentage even after usageStats and modelInfo were
both cleared.
Key changes:
- Extract `knownTokenLimit()` in core/tokenLimits.ts that returns
`undefined` for unrecognized models instead of a default, keeping
`tokenLimit()` behavior unchanged.
- In acpModelInfo.ts, derive `_meta.contextLimit` from the known-model
table when the ACP payload omits a numeric limit.
- Extract `computeContextUsage()` into its own module, which returns
`null` when no trusted numeric limit is available — the UI then
correctly hides the context bar.
- Remove the `@qwen-code/qwen-code-core` runtime import from App.tsx
so the webview bundle stays free of Node-only dependencies.
Closes#2847
* fix(vscode-ide-companion/webview): reset state on new session
* test(vscode-ide-companion/webview): cover stale conversation reset
* fix(vscode): remove webview token limit runtime import
* fix(vscode): fully reset state for explicit new session
* fix(vscode-ide-companion/webview): clear residual state on new session
---------
Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
Adopt Claude Code's approach for webview view registration:
- Use mutual-exclusive sidebar/secondary sidebar with `when` conditions
- Detect secondary sidebar support via VS Code version >= 1.106
- Share single ChatWebviewViewProvider instance across both view IDs
- Only set context key when secondary sidebar is NOT supported
- Pass supportsSecondarySidebar as closure variable to commands
Additional fixes:
- Fix WebViewContent.generate() to accept both Webview and WebviewPanel
- Fix permission handler leak (cancel old promise before new)
- Fix double diff command execution in resolve callback
- Add initializationPromise dedup for auth-restore races
- Add attachToView() for sidebar/secondary sidebar hosting
- Add missing AskUserQuestionResponseMessage import
Co-authored-by: buaoyezz <buaoyezz@users.noreply.github.com>
- Add extractSessionListItems() utility for robust ACP response parsing
- Refactor getSessionList() and getSessionListPaged() to use the new utility
- Add openNewChatTabCommand to create new session when opening chat tab
- Add comprehensive test coverage for session list extraction
Co-authored-by: ZZAoYe <zzbuaoye@gmail.com>