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
1 change: 1 addition & 0 deletions packages/channels/base/src/AcpBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface AcpBridgeOptions {
export interface AvailableCommand {
name: string;
description: string;
input?: { hint: string } | null;
}

export interface ToolCallEvent {
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/acp-integration/session/Session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ describe('Session', () => {
{
name: 'init',
description: 'Initialize project context',
kind: 'built-in',
},
]);

Expand Down Expand Up @@ -251,6 +252,7 @@ describe('Session', () => {
{
name: 'init',
description: 'Initialize project context',
kind: 'built-in',
},
]);
mockConfig.getSkillManager = vi.fn().mockReturnValue({
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/src/acp-integration/session/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import {
type NonInteractiveSlashCommandResult,
} from '../../nonInteractiveCliCommands.js';
import { isSlashCommand } from '../../ui/utils/commandUtils.js';
import { CommandKind } from '../../ui/commands/types.js';
import { parseAcpModelOption } from '../../utils/acpModelUtils.js';
import { classifyApiError } from '../../ui/hooks/useGeminiStream.js';

Expand Down Expand Up @@ -976,12 +977,19 @@ export class Session implements SessionContext {
'acp',
);

// Convert SlashCommand[] to AvailableCommand[] format for ACP protocol
// Convert SlashCommand[] to AvailableCommand[] format for ACP protocol.
// Commands that accept arguments (skills, commands with completion) get
// input: { hint } so the client can let users type arguments before
// submitting. Built-in commands without completion get input: null so the
// client auto-submits them immediately on selection.
const availableCommands: AvailableCommand[] = slashCommands.map(
(cmd) => ({
name: cmd.name,
description: cmd.description,
input: null,
input:
cmd.kind !== CommandKind.BUILT_IN || cmd.completion != null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Critical] This now marks every built-in command without a completion function as input: null, so the webview auto-submits it on Enter. Some ACP-supported built-ins still accept meaningful arguments without exposing completion—for example /bug uses its args as the issue title and /context detail enables the detailed view. After this change, selecting those commands from the completion menu sends only /<command> immediately, preventing users from filling the arguments that the command supports. Please derive this from explicit input metadata (or preserve argumentHint/subcommand-aware input support for these built-ins) instead of defaulting all built-ins without completion to no-input.

— gpt-5.5 via Qwen Code /review

? { hint: cmd.argumentHint ?? '' }
: null,
}),
);

Expand Down
98 changes: 95 additions & 3 deletions packages/vscode-ide-companion/src/webview/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ const secondarySkillItem: CompletionItem = {
value: 'skills code-review',
};

const commitCommandItem: CompletionItem = {
id: 'commit',
label: '/commit',
type: 'command',
value: 'commit',
};

const clearCommandItem: CompletionItem = {
id: 'clear',
label: '/clear',
type: 'command',
value: 'clear',
};

vi.mock('./hooks/useVSCode.js', () => ({
useVSCode: () => ({
postMessage: mockPostMessage,
Expand Down Expand Up @@ -101,7 +115,11 @@ vi.mock('./hooks/useWebViewMessages.js', async () => {
}: {
setIsAuthenticated: (value: boolean) => void;
setAvailableCommands: (
value: Array<{ name: string; description?: string }>,
value: Array<{
name: string;
description: string;
input?: { hint: string } | null;
}>,
) => void;
setAvailableSkills: (value: string[]) => void;
}) => {
Expand All @@ -114,7 +132,21 @@ vi.mock('./hooks/useWebViewMessages.js', async () => {
initializedRef.current = true;
setIsAuthenticated(true);
setAvailableCommands([
{ name: 'skills', description: 'List available skills' },
{
name: 'skills',
description: 'List available skills',
input: null,
},
{
name: 'commit',
description: 'Commit current changes',
input: { hint: '' },
},
{
name: 'clear',
description: 'Clear the chat',
input: null,
},
]);
setAvailableSkills(['code-review']);
}, [setAvailableCommands, setAvailableSkills, setIsAuthenticated]);
Expand Down Expand Up @@ -143,7 +175,12 @@ vi.mock('./hooks/useCompletionTrigger.js', () => ({
isOpen: true,
triggerChar: '/',
query: 'skills ',
items: [slashSkillsItem, secondarySkillItem],
items: [
slashSkillsItem,
secondarySkillItem,
commitCommandItem,
clearCommandItem,
],
closeCompletion: mockCloseCompletion,
openCompletion: mockOpenCompletion,
refreshCompletion: vi.fn(),
Expand Down Expand Up @@ -217,6 +254,15 @@ vi.mock('./components/layout/InputForm.js', () => ({
<button onClick={() => onCompletionFill?.(secondarySkillItem)}>
select-skill-tab
</button>
<button onClick={() => onCompletionSelect(commitCommandItem)}>
select-commit-enter
</button>
<button onClick={() => onCompletionSelect(clearCommandItem)}>
select-clear-enter
</button>
<button onClick={() => onCompletionFill?.(clearCommandItem)}>
select-clear-tab
</button>
</div>
),
}));
Expand Down Expand Up @@ -410,4 +456,50 @@ describe('App /skills secondary picker', () => {
'/skills code-review ',
);
});

it('fills slash commands that declare input when pressing Enter', async () => {
const rendered = renderApp();
root = rendered.root;
container = rendered.container;

await act(async () => {});
setInputSelection(rendered.container, '/');

clickButton(rendered.container, 'select-commit-enter');

expect(mockPostMessage).not.toHaveBeenCalled();
expect(getRenderedInputText(rendered.container)).toBe('/commit ');
expect(mockCloseCompletion).toHaveBeenCalled();
});

it('auto-submits slash commands without input when pressing Enter', async () => {
const rendered = renderApp();
root = rendered.root;
container = rendered.container;

await act(async () => {});
setInputSelection(rendered.container, '/');

clickButton(rendered.container, 'select-clear-enter');

expect(mockPostMessage).toHaveBeenCalledWith({
type: 'sendMessage',
data: { text: '/clear' },
});
expect(mockCloseCompletion).toHaveBeenCalled();
});

it('fills slash commands without input when pressing Tab', async () => {
const rendered = renderApp();
root = rendered.root;
container = rendered.container;

await act(async () => {});
setInputSelection(rendered.container, '/');

clickButton(rendered.container, 'select-clear-tab');

expect(mockPostMessage).not.toHaveBeenCalled();
expect(getRenderedInputText(rendered.container)).toBe('/clear ');
});
});
57 changes: 27 additions & 30 deletions packages/vscode-ide-companion/src/webview/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
}
// No wrapper div — message components render directly as children
// of the scroll container, preserving the original CSS layout.
if (child == null) return null;

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected '===' and instead saw '=='

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 179 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected '===' and instead saw '=='
mapping.push(index);
return <React.Fragment key={`msg-${index}`}>{child}</React.Fragment>;
});
Expand Down Expand Up @@ -212,7 +212,7 @@
while (directChild && directChild.parentElement !== container) {
directChild = directChild.parentElement;
}
if (!directChild) return -1;

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 215 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

// Find DOM child position among container's children
const children = container.children;
Expand Down Expand Up @@ -796,52 +796,49 @@
}
};

if (itemId === 'auth') {
clearTriggerText();
vscode.postMessage({ type: 'auth', data: {} });
closeCompletion();
return;
}

if (itemId === 'account') {
clearTriggerText();
vscode.postMessage({ type: 'getAccountInfo', data: {} });
closeCompletion();
return;
}
// Client-side commands that trigger extension actions directly
// instead of being sent to the agent as messages.
const clientActions: Record<string, () => void> = {
auth: () => vscode.postMessage({ type: 'auth', data: {} }),
account: () =>
vscode.postMessage({ type: 'getAccountInfo', data: {} }),
model: () => setShowModelSelector(true),
};

if (itemId === 'model') {
const clientAction = clientActions[itemId];
if (clientAction) {
clearTriggerText();
setShowModelSelector(true);
clientAction();
closeCompletion();
return;
}

// Handle server-provided slash commands by sending them as messages.
// Skip when fillOnly (Tab) — let the generic insertion path fill the
// command text so the user can keep typing arguments.
// Special case: /skills always uses fill behavior (Enter = Tab) to
// allow the secondary skill picker to appear.
// For server-provided slash commands, decide based on the `input`
// field: commands without input (input == null) auto-submit
// immediately; commands that accept input fall through to the generic
// insertion path so users can type arguments before submitting.
// Special case: /skills always uses fill behavior to allow the
// secondary skill picker to appear.
const serverCmd = availableCommands.find((c) => c.name === itemId);
const isSkillsCmd = shouldOpenSkillsSecondaryPicker(
item,
availableSkills,
);
if (
serverCmd &&
!fillOnly &&
!isSkillsCmd &&
!isExpandableSlashCommand(serverCmd.name)
) {
// Clear the trigger text since we're sending the command
clearTriggerText();
// Send the slash command as a user message
vscode.postMessage({
type: 'sendMessage',
data: { text: `/${serverCmd.name}` },
});
closeCompletion();
return;
if (!serverCmd.input && !fillOnly) {
clearTriggerText();
vscode.postMessage({
type: 'sendMessage',
data: { text: `/${serverCmd.name}` },
});
closeCompletion();
return;
}
// Command accepts input — fall through to fill the input box.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Critical] Falling through here uses the generic insertion path, which reads inputElement.textContent directly. If the empty editor contains the U+200B height placeholder, filling a slash command can preserve that hidden character and produce text like \u200B/commit . shouldSendMessage strips the placeholder only for the emptiness check, but the actual sendMessage payload still uses the raw text, so downstream slash-command handling may not recognize the command.

Please normalize the text used for completion insertion, for example by stripping U+200B before computing textBeforeCursor/newText, and ensure the value passed to setInputText is placeholder-free. Be careful to adjust cursor offsets after normalization.

— gpt-5.5 via Qwen Code /review

}

// Handle secondary skill selection — send `/skills <name>` with
Expand Down Expand Up @@ -1203,7 +1200,7 @@
useEffect(() => {
const handler = (event: MessageEvent) => {
const message = event.data;
if (message?.type !== 'copyCommand') return;

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1203 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

const { action } = message.data as { action: string };

Expand Down Expand Up @@ -1234,7 +1231,7 @@
msg.kind === 'image' && msg.imagePath
? `![image](${msg.imagePath})`
: (msg.content || '').trim();
if (!content) continue;

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1234 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition
if (msg.role === 'user') {
parts.push(`**User:** ${content}`);
} else if (msg.role === 'thinking') {
Expand All @@ -1247,7 +1244,7 @@
item.type === 'in-progress-tool-call'
) {
const tc = item.data as ToolCallData;
if (!shouldShowToolCall(tc.kind)) continue;

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1247 in packages/vscode-ide-companion/src/webview/App.tsx

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition
const text = formatToolCallForCopy(tc, true);
if (text) {
parts.push(`**[Tool: ${tc.kind}]**\n\n${text}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ export const useMessageSubmit = ({
return;
}

// Handle /login command - show inline loading while extension authenticates
if (textToSend.trim() === '/login') {
// Handle /auth (and its legacy alias /login) — trigger interactive
// auth flow directly in the extension instead of sending the command
// to the agent.
const trimmedInput = textToSend.trim();
if (trimmedInput === '/auth' || trimmedInput === '/login') {
setInputText('');
if (inputFieldRef.current) {
inputFieldRef.current.textContent = ZERO_WIDTH_SPACE;
Expand All @@ -112,7 +115,6 @@ export const useMessageSubmit = ({
type: 'auth',
data: {},
});
// Show a friendly loading message in the chat while authenticating
try {
messageHandling.setWaitingForResponse('Authenticating Qwen Code...');
} catch (_err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,24 @@ describe('useWebViewMessages', () => {
expect(rendered.clearWaitingForResponse).toHaveBeenCalled();
});

it('clears waiting state when authCancelled is received', () => {
const rendered = renderHookHarness();
root = rendered.root;
container = rendered.container;

act(() => {
window.dispatchEvent(
new MessageEvent('message', {
data: {
type: 'authCancelled',
},
}),
);
});

expect(rendered.clearWaitingForResponse).toHaveBeenCalled();
});

it('stores the latest insight report path when the ready event arrives', () => {
const rendered = renderHookHarness();
root = rendered.root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ export const useWebViewMessages = ({
break;
}

case 'authCancelled': {
// User dismissed the auth picker — clear loading state so the
// input is not left disabled.
handlers.messageHandling.clearWaitingForResponse();
break;
}

case 'authState': {
const state = (
message?.data as { authenticated?: boolean | null } | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@

/**
* Initialize agent connection and session
* Can be called from show() or via /login command
* Can be called from show() or via /auth command
*/
async initializeAgentConnection(options?: {
autoAuthenticate?: boolean;
Expand Down Expand Up @@ -1667,9 +1667,9 @@
* The webview resolves the content and posts back a 'copyToClipboard' message.
*/
sendCopyCommand(action: string): boolean {
if (WebViewProvider.lastContextMenuProvider !== this) return false;

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1670 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition
const webview = this.getActiveWebview();
if (!webview) return false;

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 24.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition

Check warning on line 1672 in packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 22.x)

Expected { after 'if' condition
webview.postMessage({ type: 'copyCommand', data: { action } });
return true;
}
Expand Down
Loading