run preflight (#55)

This commit is contained in:
Fan 2025-07-23 16:18:31 +08:00 committed by GitHub
parent 173246723e
commit 40ee936453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 62 additions and 40 deletions

View File

@ -109,7 +109,7 @@ qwen
### Terminal-Bench
| Agent | Model | Accuracy |
|-----------|--------------------|----------|
| --------- | ------------------ | -------- |
| Qwen Code | Qwen3-Coder-480A35 | 37.5 |
## Project Structure

13
package-lock.json generated
View File

@ -1,15 +1,18 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"workspaces": [
"packages/*"
],
"dependencies": {
"@qwen-code/qwen-code": "^0.0.1-alpha.8"
},
"bin": {
"qwen": "bundle/gemini.js"
},
@ -11936,7 +11939,7 @@
},
"packages/cli": {
"name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"dependencies": {
"@qwen-code/qwen-code-core": "file:../core",
"@types/update-notifier": "^6.0.8",
@ -12114,7 +12117,7 @@
},
"packages/core": {
"name": "@qwen-code/qwen-code-core",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"dependencies": {
"@google/genai": "1.8.0",
"@modelcontextprotocol/sdk": "^1.11.0",
@ -12187,7 +12190,7 @@
},
"packages/vscode-ide-companion": {
"name": "@qwen-code/qwen-code-vscode-ide-companion",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",
"cors": "^2.8.5",

View File

@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"engines": {
"node": ">=20"
},
@ -8,13 +8,12 @@
"workspaces": [
"packages/*"
],
"private": "true",
"repository": {
"type": "git",
"url": "git+http://gitlab.alibaba-inc.com/Qwen-Coder/qwen-code.git"
},
"config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.7"
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.8"
},
"scripts": {
"start": "node scripts/start.js",
@ -82,5 +81,8 @@
"typescript-eslint": "^8.30.1",
"vitest": "^3.2.4",
"yargs": "^18.0.0"
},
"dependencies": {
"@qwen-code/qwen-code": "^0.0.1-alpha.8"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"description": "Gemini CLI",
"repository": {
"type": "git",
@ -25,7 +25,7 @@
"dist"
],
"config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.7"
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.8"
},
"dependencies": {
"@qwen-code/qwen-code-core": "file:../core",

View File

@ -165,7 +165,7 @@ describe('AuthDialog', () => {
);
// Since only OpenAI is available, it should be selected by default
expect(lastFrame()).toContain(' OpenAI');
expect(lastFrame()).toContain(' OpenAI');
});
it('should fall back to default if GEMINI_DEFAULT_AUTH_TYPE is not set', () => {
@ -188,7 +188,7 @@ describe('AuthDialog', () => {
);
// Default is OpenAI (the only option)
expect(lastFrame()).toContain(' OpenAI');
expect(lastFrame()).toContain(' OpenAI');
});
it('should show an error and fall back to default if GEMINI_DEFAULT_AUTH_TYPE is invalid', () => {
@ -214,7 +214,7 @@ describe('AuthDialog', () => {
// Since the auth dialog doesn't show GEMINI_DEFAULT_AUTH_TYPE errors anymore,
// it will just show the default OpenAI option
expect(lastFrame()).toContain(' OpenAI');
expect(lastFrame()).toContain(' OpenAI');
});
});

View File

@ -47,24 +47,27 @@ export function AuthDialog({
const [showOpenAIKeyPrompt, setShowOpenAIKeyPrompt] = useState(false);
const items = [{ label: 'OpenAI', value: AuthType.USE_OPENAI }];
const initialAuthIndex = Math.max(0, items.findIndex((item) => {
if (settings.merged.selectedAuthType) {
return item.value === settings.merged.selectedAuthType;
}
const initialAuthIndex = Math.max(
0,
items.findIndex((item) => {
if (settings.merged.selectedAuthType) {
return item.value === settings.merged.selectedAuthType;
}
const defaultAuthType = parseDefaultAuthType(
process.env.GEMINI_DEFAULT_AUTH_TYPE,
);
if (defaultAuthType) {
return item.value === defaultAuthType;
}
const defaultAuthType = parseDefaultAuthType(
process.env.GEMINI_DEFAULT_AUTH_TYPE,
);
if (defaultAuthType) {
return item.value === defaultAuthType;
}
if (process.env.GEMINI_API_KEY) {
return item.value === AuthType.USE_GEMINI;
}
if (process.env.GEMINI_API_KEY) {
return item.value === AuthType.USE_GEMINI;
}
return item.value === AuthType.LOGIN_WITH_GOOGLE;
}));
return item.value === AuthType.LOGIN_WITH_GOOGLE;
}),
);
const handleAuthSelect = (authMethod: AuthType) => {
const error = validateAuthMethod(authMethod);

View File

@ -56,7 +56,12 @@ export function RadioButtonSelect<T>({
showScrollArrows = false,
maxItemsToShow = 10,
}: RadioButtonSelectProps<T>): React.JSX.Element {
const [activeIndex, setActiveIndex] = useState(initialIndex);
// Ensure initialIndex is within bounds
const safeInitialIndex =
items.length > 0
? Math.max(0, Math.min(initialIndex, items.length - 1))
: 0;
const [activeIndex, setActiveIndex] = useState(safeInitialIndex);
const [scrollOffset, setScrollOffset] = useState(0);
// Ensure activeIndex is always within bounds when items change
@ -102,7 +107,11 @@ export function RadioButtonSelect<T>({
}
if (key.return) {
// Add bounds check before accessing items[activeIndex]
if (activeIndex >= 0 && activeIndex < items.length && items[activeIndex]) {
if (
activeIndex >= 0 &&
activeIndex < items.length &&
items[activeIndex]
) {
onSelect(items[activeIndex].value);
}
}
@ -118,7 +127,13 @@ export function RadioButtonSelect<T>({
}
}
},
{ isActive: isFocused && items.length > 0 && activeIndex >= 0 && activeIndex < items.length },
{
isActive:
isFocused &&
items.length > 0 &&
activeIndex >= 0 &&
activeIndex < items.length,
},
);
const visibleItems = items.slice(scrollOffset, scrollOffset + maxItemsToShow);

View File

@ -1,12 +1,12 @@
{
"name": "@google/gemini-cli-core",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@google/gemini-cli-core",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"dependencies": {
"@google/genai": "^1.4.0",
"@modelcontextprotocol/sdk": "^1.11.0",

View File

@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-core",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"description": "Qwen Code Core",
"repository": {
"type": "git",

View File

@ -27,7 +27,6 @@ import {
setGeminiMdFilename,
GEMINI_CONFIG_DIR as GEMINI_DIR,
} from '../tools/memoryTool.js';
import { WebSearchTool } from '../tools/web-search.js';
import { GeminiClient } from '../core/client.js';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { GitService } from '../services/gitService.js';
@ -601,7 +600,7 @@ export class Config {
registerCoreTool(ReadManyFilesTool, this);
registerCoreTool(ShellTool, this);
registerCoreTool(MemoryTool);
registerCoreTool(WebSearchTool, this);
// registerCoreTool(WebSearchTool, this); // Temporarily disabled
await registry.discoverTools();
return registry;

View File

@ -1,12 +1,12 @@
{
"name": "qwen-code-vscode",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "qwen-code-vscode",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",
"cors": "^2.8.5",

View File

@ -2,7 +2,7 @@
"name": "@qwen-code/qwen-code-vscode-ide-companion",
"displayName": "Qwen Code VSCode IDE Companion",
"description": "",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"engines": {
"vscode": "^1.101.0"
},