Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0

This commit is contained in:
mingholy.lmh
2025-09-10 21:01:40 +08:00
583 changed files with 30160 additions and 10770 deletions

View File

@@ -4,37 +4,41 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { ReadableStream, WritableStream } from 'node:stream/web';
import type { ReadableStream, WritableStream } from 'node:stream/web';
import type { Content, FunctionCall, Part } from '@google/genai';
import type {
Config,
GeminiChat,
ToolCallConfirmationDetails,
ToolResult,
} from '@qwen-code/qwen-code-core';
import {
AuthType,
clearCachedCredentialFile,
Config,
GeminiChat,
logToolCall,
ToolResult,
convertToFunctionResponse,
DiscoveredMCPTool,
getErrorMessage,
getErrorStatus,
isNodeError,
isWithinRoot,
logToolCall,
MCPServerConfig,
ToolCallConfirmationDetails,
ToolConfirmationOutcome,
DiscoveredMCPTool,
} from '@qwen-code/qwen-code-core';
import { AcpFileSystemService } from './fileSystemService.js';
import { Content, Part, FunctionCall, PartListUnion } from '@google/genai';
import * as fs from 'fs/promises';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { Readable, Writable } from 'node:stream';
import * as path from 'path';
import { z } from 'zod';
import { LoadedSettings, SettingScope } from '../config/settings.js';
import type { LoadedSettings } from '../config/settings.js';
import { SettingScope } from '../config/settings.js';
import * as acp from './acp.js';
import { AcpFileSystemService } from './fileSystemService.js';
import { randomUUID } from 'crypto';
import { CliArgs, loadCliConfig } from '../config/config.js';
import { Extension } from '../config/extension.js';
import { randomUUID } from 'node:crypto';
import type { CliArgs } from '../config/config.js';
import { loadCliConfig } from '../config/config.js';
import type { Extension } from '../config/extension.js';
export async function runZedIntegration(
config: Config,
@@ -113,7 +117,11 @@ class GeminiAgent {
await clearCachedCredentialFile();
await this.config.refreshAuth(method);
this.settings.setValue(SettingScope.User, 'selectedAuthType', method);
this.settings.setValue(
SettingScope.User,
'security.auth.selectedType',
method,
);
}
async newSession({
@@ -124,9 +132,11 @@ class GeminiAgent {
const config = await this.newSessionConfig(sessionId, cwd, mcpServers);
let isAuthenticated = false;
if (this.settings.merged.selectedAuthType) {
if (this.settings.merged.security?.auth?.selectedType) {
try {
await config.refreshAuth(this.settings.merged.selectedAuthType);
await config.refreshAuth(
this.settings.merged.security.auth.selectedType,
);
isAuthenticated = true;
} catch (e) {
console.error(`Authentication failed: ${e}`);
@@ -300,16 +310,7 @@ class Session {
for (const fc of functionCalls) {
const response = await this.runTool(pendingSend.signal, promptId, fc);
const parts = Array.isArray(response) ? response : [response];
for (const part of parts) {
if (typeof part === 'string') {
toolResponseParts.push({ text: part });
} else if (part) {
toolResponseParts.push(part);
}
}
toolResponseParts.push(...response);
}
nextMessage = { role: 'user', parts: toolResponseParts };
@@ -332,7 +333,7 @@ class Session {
abortSignal: AbortSignal,
promptId: string,
fc: FunctionCall,
): Promise<PartListUnion> {
): Promise<Part[]> {
const callId = fc.id ?? `${fc.name}-${Date.now()}`;
const args = (fc.args ?? {}) as Record<string, unknown>;