mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Session-Level Conversation History Management (#1113)
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
import { Config } from '@qwen-code/qwen-code-core';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import type { Settings } from './settings.js';
|
||||
|
||||
export const server = setupServer();
|
||||
|
||||
@@ -73,12 +74,10 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should load default file filtering settings', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFilteringRespectGitIgnore: undefined, // Should default to true
|
||||
};
|
||||
|
||||
const config = new Config(configParams);
|
||||
@@ -89,9 +88,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should load custom file filtering settings from configuration', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFiltering: {
|
||||
@@ -107,12 +105,10 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should merge user and workspace file filtering settings', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFilteringRespectGitIgnore: true,
|
||||
};
|
||||
|
||||
const config = new Config(configParams);
|
||||
@@ -125,9 +121,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should handle partial configuration objects gracefully', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFiltering: {
|
||||
@@ -144,12 +139,10 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should handle empty configuration objects gracefully', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFilteringRespectGitIgnore: undefined,
|
||||
};
|
||||
|
||||
const config = new Config(configParams);
|
||||
@@ -161,9 +154,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should handle missing configuration sections gracefully', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
// Missing fileFiltering configuration
|
||||
@@ -180,12 +172,10 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should handle a security-focused configuration', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFilteringRespectGitIgnore: true,
|
||||
};
|
||||
|
||||
const config = new Config(configParams);
|
||||
@@ -196,9 +186,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should handle a CI/CD environment configuration', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
fileFiltering: {
|
||||
@@ -216,9 +205,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should enable checkpointing when the setting is true', async () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
checkpointing: true,
|
||||
@@ -234,9 +222,8 @@ describe('Configuration Integration Tests', () => {
|
||||
it('should have an empty array for extension context files by default', () => {
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
};
|
||||
@@ -248,9 +235,8 @@ describe('Configuration Integration Tests', () => {
|
||||
const contextFiles = ['/path/to/file1.txt', '/path/to/file2.js'];
|
||||
const configParams: ConfigParameters = {
|
||||
cwd: '/tmp',
|
||||
contentGeneratorConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
generationConfig: TEST_CONTENT_GENERATOR_CONFIG,
|
||||
embeddingModel: 'test-embedding-model',
|
||||
sandbox: false,
|
||||
targetDir: tempDir,
|
||||
debugMode: false,
|
||||
extensionContextFilePaths: contextFiles,
|
||||
@@ -261,11 +247,11 @@ describe('Configuration Integration Tests', () => {
|
||||
});
|
||||
|
||||
describe('Approval Mode Integration Tests', () => {
|
||||
let parseArguments: typeof import('./config').parseArguments;
|
||||
let parseArguments: typeof import('./config.js').parseArguments;
|
||||
|
||||
beforeEach(async () => {
|
||||
// Import the argument parsing function for integration testing
|
||||
const { parseArguments: parseArgs } = await import('./config');
|
||||
const { parseArguments: parseArgs } = await import('./config.js');
|
||||
parseArguments = parseArgs;
|
||||
});
|
||||
|
||||
|
||||
@@ -535,7 +535,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -555,7 +554,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getShowMemoryUsage()).toBe(true);
|
||||
@@ -572,7 +570,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getShowMemoryUsage()).toBe(false);
|
||||
@@ -589,7 +586,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getShowMemoryUsage()).toBe(false);
|
||||
@@ -606,7 +602,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getShowMemoryUsage()).toBe(true);
|
||||
@@ -649,7 +644,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getProxy()).toBeFalsy();
|
||||
@@ -699,7 +693,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getProxy()).toBe(expected);
|
||||
@@ -717,7 +710,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getProxy()).toBe('http://localhost:7890');
|
||||
@@ -735,7 +727,6 @@ describe('loadCliConfig', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getProxy()).toBe('http://localhost:7890');
|
||||
@@ -769,7 +760,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(false);
|
||||
@@ -786,7 +776,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -803,7 +792,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(false);
|
||||
@@ -820,7 +808,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -837,7 +824,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(false);
|
||||
@@ -854,7 +840,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -871,7 +856,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(false);
|
||||
@@ -890,7 +874,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpEndpoint()).toBe(
|
||||
@@ -916,7 +899,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpEndpoint()).toBe('http://cli.example.com');
|
||||
@@ -933,7 +915,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpEndpoint()).toBe('http://localhost:4317');
|
||||
@@ -952,7 +933,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryTarget()).toBe(
|
||||
@@ -973,7 +953,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryTarget()).toBe('gcp');
|
||||
@@ -990,7 +969,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryTarget()).toBe(
|
||||
@@ -1009,7 +987,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
||||
@@ -1026,7 +1003,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
||||
@@ -1043,7 +1019,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
||||
@@ -1060,7 +1035,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
||||
@@ -1079,7 +1053,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpProtocol()).toBe('http');
|
||||
@@ -1098,7 +1071,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpProtocol()).toBe('http');
|
||||
@@ -1115,7 +1087,6 @@ describe('loadCliConfig telemetry', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpProtocol()).toBe('grpc');
|
||||
@@ -1197,12 +1168,10 @@ describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
|
||||
await loadCliConfig(
|
||||
settings,
|
||||
extensions,
|
||||
|
||||
new ExtensionEnablementManager(
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'session-id',
|
||||
argv,
|
||||
);
|
||||
expect(ServerConfig.loadServerHierarchicalMemory).toHaveBeenCalledWith(
|
||||
@@ -1283,7 +1252,6 @@ describe('mergeMcpServers', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(settings).toEqual(originalSettings);
|
||||
@@ -1333,7 +1301,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(
|
||||
@@ -1364,7 +1331,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(
|
||||
@@ -1404,7 +1370,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(
|
||||
@@ -1426,7 +1391,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual([]);
|
||||
@@ -1445,7 +1409,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(defaultExcludes);
|
||||
@@ -1463,7 +1426,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(
|
||||
@@ -1494,7 +1456,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toEqual(
|
||||
@@ -1526,7 +1487,6 @@ describe('mergeExcludeTools', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(settings).toEqual(originalSettings);
|
||||
@@ -1558,7 +1518,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1588,7 +1547,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1618,7 +1576,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1648,7 +1605,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1678,7 +1634,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1701,7 +1656,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1736,7 +1690,7 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1767,7 +1721,6 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -1797,7 +1750,7 @@ describe('Approval mode tool exclusion logic', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
invalidArgv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
invalidArgv as CliArgs,
|
||||
),
|
||||
).rejects.toThrow(
|
||||
@@ -1839,7 +1792,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual(baseSettings.mcpServers);
|
||||
@@ -1860,7 +1812,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -1885,7 +1836,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -1911,7 +1861,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -1929,7 +1878,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({});
|
||||
@@ -1949,7 +1897,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -1972,7 +1919,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -1997,7 +1943,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -2027,7 +1972,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -2059,7 +2003,6 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getMcpServers()).toEqual({
|
||||
@@ -2094,7 +2037,6 @@ describe('loadCliConfig extensions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExtensionContextFilePaths()).toEqual([
|
||||
@@ -2114,7 +2056,6 @@ describe('loadCliConfig extensions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExtensionContextFilePaths()).toEqual(['/path/to/ext1.md']);
|
||||
@@ -2136,7 +2077,6 @@ describe('loadCliConfig model selection', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -2155,7 +2095,6 @@ describe('loadCliConfig model selection', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -2176,7 +2115,6 @@ describe('loadCliConfig model selection', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -2195,7 +2133,6 @@ describe('loadCliConfig model selection', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
|
||||
@@ -2235,7 +2172,6 @@ describe('loadCliConfig folderTrust', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getFolderTrust()).toBe(false);
|
||||
@@ -2258,7 +2194,6 @@ describe('loadCliConfig folderTrust', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getFolderTrust()).toBe(true);
|
||||
@@ -2275,7 +2210,6 @@ describe('loadCliConfig folderTrust', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getFolderTrust()).toBe(false);
|
||||
@@ -2325,7 +2259,6 @@ describe('loadCliConfig with includeDirectories', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
const expected = [
|
||||
@@ -2377,7 +2310,6 @@ describe('loadCliConfig chatCompression', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getChatCompression()).toEqual({
|
||||
@@ -2396,7 +2328,6 @@ describe('loadCliConfig chatCompression', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getChatCompression()).toBeUndefined();
|
||||
@@ -2429,7 +2360,6 @@ describe('loadCliConfig useRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseRipgrep()).toBe(true);
|
||||
@@ -2446,7 +2376,6 @@ describe('loadCliConfig useRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseRipgrep()).toBe(false);
|
||||
@@ -2463,7 +2392,6 @@ describe('loadCliConfig useRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseRipgrep()).toBe(true);
|
||||
@@ -2496,7 +2424,6 @@ describe('loadCliConfig useBuiltinRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseBuiltinRipgrep()).toBe(true);
|
||||
@@ -2513,7 +2440,6 @@ describe('loadCliConfig useBuiltinRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseBuiltinRipgrep()).toBe(false);
|
||||
@@ -2530,7 +2456,6 @@ describe('loadCliConfig useBuiltinRipgrep', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getUseBuiltinRipgrep()).toBe(true);
|
||||
@@ -2565,7 +2490,6 @@ describe('screenReader configuration', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getScreenReader()).toBe(true);
|
||||
@@ -2584,7 +2508,6 @@ describe('screenReader configuration', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getScreenReader()).toBe(false);
|
||||
@@ -2603,7 +2526,6 @@ describe('screenReader configuration', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getScreenReader()).toBe(true);
|
||||
@@ -2620,7 +2542,6 @@ describe('screenReader configuration', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getScreenReader()).toBe(false);
|
||||
@@ -2657,7 +2578,6 @@ describe('loadCliConfig tool exclusions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
||||
@@ -2676,7 +2596,6 @@ describe('loadCliConfig tool exclusions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
||||
@@ -2695,7 +2614,6 @@ describe('loadCliConfig tool exclusions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).toContain('run_shell_command');
|
||||
@@ -2714,7 +2632,6 @@ describe('loadCliConfig tool exclusions', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
||||
@@ -2752,7 +2669,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(true);
|
||||
@@ -2769,7 +2685,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(true);
|
||||
@@ -2786,7 +2701,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(false);
|
||||
@@ -2803,7 +2717,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(false);
|
||||
@@ -2820,7 +2733,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(false);
|
||||
@@ -2844,7 +2756,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(false);
|
||||
@@ -2864,7 +2775,6 @@ describe('loadCliConfig interactive', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.isInteractive()).toBe(true);
|
||||
@@ -2898,7 +2808,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -2914,7 +2823,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.PLAN);
|
||||
@@ -2930,7 +2838,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
||||
@@ -2946,7 +2853,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
||||
@@ -2962,7 +2868,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -2978,7 +2883,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.AUTO_EDIT);
|
||||
@@ -2994,7 +2898,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
||||
@@ -3011,7 +2914,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.PLAN);
|
||||
@@ -3028,7 +2930,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.AUTO_EDIT);
|
||||
@@ -3046,7 +2947,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
),
|
||||
).rejects.toThrow(
|
||||
@@ -3068,7 +2969,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -3084,7 +2984,6 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
||||
@@ -3109,7 +3008,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -3125,7 +3024,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -3141,7 +3040,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -3157,7 +3056,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
||||
@@ -3173,7 +3072,7 @@ describe('loadCliConfig approval mode', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.PLAN);
|
||||
@@ -3260,7 +3159,7 @@ describe('loadCliConfig fileFiltering', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
);
|
||||
expect(getter(config)).toBe(value);
|
||||
@@ -3279,7 +3178,6 @@ describe('Output format', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getOutputFormat()).toBe(OutputFormat.TEXT);
|
||||
@@ -3295,7 +3193,6 @@ describe('Output format', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getOutputFormat()).toBe(OutputFormat.JSON);
|
||||
@@ -3311,7 +3208,6 @@ describe('Output format', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getOutputFormat()).toBe(OutputFormat.JSON);
|
||||
@@ -3404,7 +3300,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -3422,7 +3317,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryTarget()).toBe('gcp');
|
||||
@@ -3441,7 +3335,7 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
|
||||
argv,
|
||||
),
|
||||
).rejects.toThrow(
|
||||
@@ -3465,7 +3359,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpEndpoint()).toBe('http://gemini.env.com');
|
||||
@@ -3483,7 +3376,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOtlpProtocol()).toBe('http');
|
||||
@@ -3501,7 +3393,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
||||
@@ -3521,7 +3412,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryOutfile()).toBe('/gemini/env/telemetry.log');
|
||||
@@ -3539,7 +3429,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryUseCollector()).toBe(true);
|
||||
@@ -3557,7 +3446,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -3575,7 +3463,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryTarget()).toBe('local');
|
||||
@@ -3592,7 +3479,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(true);
|
||||
@@ -3609,7 +3495,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryEnabled()).toBe(false);
|
||||
@@ -3626,7 +3511,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
||||
@@ -3643,7 +3527,6 @@ describe('Telemetry configuration via environment variables', () => {
|
||||
ExtensionStorage.getUserExtensionsDir(),
|
||||
argv.extensions,
|
||||
),
|
||||
'test-session',
|
||||
argv,
|
||||
);
|
||||
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type {
|
||||
FileFilteringOptions,
|
||||
MCPServerConfig,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { extensionsCommand } from '../commands/extensions.js';
|
||||
import {
|
||||
ApprovalMode,
|
||||
Config,
|
||||
@@ -26,7 +21,12 @@ import {
|
||||
Storage,
|
||||
InputFormat,
|
||||
OutputFormat,
|
||||
SessionService,
|
||||
type ResumedSessionData,
|
||||
type FileFilteringOptions,
|
||||
type MCPServerConfig,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { extensionsCommand } from '../commands/extensions.js';
|
||||
import type { Settings } from './settings.js';
|
||||
import yargs, { type Argv } from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
@@ -129,6 +129,10 @@ export interface CliArgs {
|
||||
inputFormat?: string | undefined;
|
||||
outputFormat: string | undefined;
|
||||
includePartialMessages?: boolean;
|
||||
/** Resume the most recent session for the current project */
|
||||
continue: boolean | undefined;
|
||||
/** Resume a specific session by its ID */
|
||||
resume: string | undefined;
|
||||
}
|
||||
|
||||
function normalizeOutputFormat(
|
||||
@@ -396,6 +400,17 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
'Include partial assistant messages when using stream-json output.',
|
||||
default: false,
|
||||
})
|
||||
.option('continue', {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Resume the most recent session for the current project.',
|
||||
default: false,
|
||||
})
|
||||
.option('resume', {
|
||||
type: 'string',
|
||||
description:
|
||||
'Resume a specific session by its ID. Use without an ID to show session picker.',
|
||||
})
|
||||
.deprecateOption(
|
||||
'show-memory-usage',
|
||||
'Use the "ui.showMemoryUsage" setting in settings.json instead. This flag will be removed in a future version.',
|
||||
@@ -451,6 +466,9 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
) {
|
||||
return '--input-format stream-json requires --output-format stream-json';
|
||||
}
|
||||
if (argv['continue'] && argv['resume']) {
|
||||
return 'Cannot use both --continue and --resume together. Use --continue to resume the latest session, or --resume <sessionId> to resume a specific session.';
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
)
|
||||
@@ -565,7 +583,6 @@ export async function loadCliConfig(
|
||||
settings: Settings,
|
||||
extensions: Extension[],
|
||||
extensionEnablementManager: ExtensionEnablementManager,
|
||||
sessionId: string,
|
||||
argv: CliArgs,
|
||||
cwd: string = process.cwd(),
|
||||
): Promise<Config> {
|
||||
@@ -797,8 +814,33 @@ export async function loadCliConfig(
|
||||
|
||||
const vlmSwitchMode =
|
||||
argv.vlmSwitchMode || settings.experimental?.vlmSwitchMode;
|
||||
|
||||
let sessionId: string | undefined;
|
||||
let sessionData: ResumedSessionData | undefined;
|
||||
|
||||
if (argv.continue || argv.resume) {
|
||||
const sessionService = new SessionService(cwd);
|
||||
if (argv.continue) {
|
||||
sessionData = await sessionService.loadLastSession();
|
||||
if (sessionData) {
|
||||
sessionId = sessionData.conversation.sessionId;
|
||||
}
|
||||
}
|
||||
|
||||
if (argv.resume) {
|
||||
sessionId = argv.resume;
|
||||
sessionData = await sessionService.loadSession(argv.resume);
|
||||
if (!sessionData) {
|
||||
const message = `No saved session found with ID ${argv.resume}. Run \`qwen --resume\` without an ID to choose from existing sessions.`;
|
||||
console.log(message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Config({
|
||||
sessionId,
|
||||
sessionData,
|
||||
embeddingModel: DEFAULT_QWEN_EMBEDDING_MODEL,
|
||||
sandbox: sandboxConfig,
|
||||
targetDir: cwd,
|
||||
|
||||
@@ -30,7 +30,6 @@ import { getErrorMessage } from '../utils/errors.js';
|
||||
import { recursivelyHydrateStrings } from './extensions/variables.js';
|
||||
import { isWorkspaceTrusted } from './trustedFolders.js';
|
||||
import { resolveEnvVarsInObject } from '../utils/envVarResolver.js';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import {
|
||||
cloneFromGit,
|
||||
downloadFromGitHubRelease,
|
||||
@@ -134,7 +133,6 @@ function getTelemetryConfig(cwd: string) {
|
||||
const config = new Config({
|
||||
telemetry: settings.merged.telemetry,
|
||||
interactive: false,
|
||||
sessionId: randomUUID(),
|
||||
targetDir: cwd,
|
||||
cwd,
|
||||
model: '',
|
||||
|
||||
Reference in New Issue
Block a user