mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 03:30:40 +00:00
Merge branch 'main' into feat/shell-pty-default-and-enhancements
This commit is contained in:
commit
648d48edbc
24 changed files with 170 additions and 149 deletions
|
|
@ -135,7 +135,7 @@ function buildImage(imageName, dockerfile) {
|
|||
).version;
|
||||
|
||||
const imageTag =
|
||||
process.env.GEMINI_SANDBOX_IMAGE_TAG || imageName.split(':')[1];
|
||||
process.env.QWEN_SANDBOX_IMAGE_TAG || imageName.split(':')[1];
|
||||
const finalImageName = `${imageName.split(':')[0]}:${imageTag}`;
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -32,27 +32,27 @@ const argv = yargs(hideBin(process.argv)).option('q', {
|
|||
default: false,
|
||||
}).argv;
|
||||
|
||||
let geminiSandbox = process.env.GEMINI_SANDBOX;
|
||||
let qwenSandbox = process.env.QWEN_SANDBOX;
|
||||
|
||||
if (!geminiSandbox) {
|
||||
if (!qwenSandbox) {
|
||||
const userSettingsFile = join(os.homedir(), '.qwen', 'settings.json');
|
||||
if (existsSync(userSettingsFile)) {
|
||||
const settings = JSON.parse(
|
||||
stripJsonComments(readFileSync(userSettingsFile, 'utf-8')),
|
||||
);
|
||||
if (settings.sandbox) {
|
||||
geminiSandbox = settings.sandbox;
|
||||
qwenSandbox = settings.sandbox;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!geminiSandbox) {
|
||||
if (!qwenSandbox) {
|
||||
let currentDir = process.cwd();
|
||||
while (true) {
|
||||
const geminiEnv = join(currentDir, '.qwen', '.env');
|
||||
const qwenEnv = join(currentDir, '.qwen', '.env');
|
||||
const regularEnv = join(currentDir, '.env');
|
||||
if (existsSync(geminiEnv)) {
|
||||
dotenv.config({ path: geminiEnv, quiet: true });
|
||||
if (existsSync(qwenEnv)) {
|
||||
dotenv.config({ path: qwenEnv, quiet: true });
|
||||
break;
|
||||
} else if (existsSync(regularEnv)) {
|
||||
dotenv.config({ path: regularEnv, quiet: true });
|
||||
|
|
@ -64,10 +64,10 @@ if (!geminiSandbox) {
|
|||
}
|
||||
currentDir = parentDir;
|
||||
}
|
||||
geminiSandbox = process.env.GEMINI_SANDBOX;
|
||||
qwenSandbox = process.env.QWEN_SANDBOX;
|
||||
}
|
||||
|
||||
geminiSandbox = (geminiSandbox || '').toLowerCase();
|
||||
qwenSandbox = (qwenSandbox || '').toLowerCase();
|
||||
|
||||
const commandExists = (cmd) => {
|
||||
// Use 'where.exe' (not 'where') on Windows because PowerShell aliases
|
||||
|
|
@ -90,23 +90,23 @@ const commandExists = (cmd) => {
|
|||
};
|
||||
|
||||
let command = '';
|
||||
if (['1', 'true'].includes(geminiSandbox)) {
|
||||
if (['1', 'true'].includes(qwenSandbox)) {
|
||||
if (commandExists('docker')) {
|
||||
command = 'docker';
|
||||
} else if (commandExists('podman')) {
|
||||
command = 'podman';
|
||||
} else {
|
||||
console.error(
|
||||
'ERROR: install docker or podman or specify command in GEMINI_SANDBOX',
|
||||
'ERROR: install docker or podman or specify command in QWEN_SANDBOX',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (geminiSandbox && !['0', 'false'].includes(geminiSandbox)) {
|
||||
if (commandExists(geminiSandbox)) {
|
||||
command = geminiSandbox;
|
||||
} else if (qwenSandbox && !['0', 'false'].includes(qwenSandbox)) {
|
||||
if (commandExists(qwenSandbox)) {
|
||||
command = qwenSandbox;
|
||||
} else {
|
||||
console.error(
|
||||
`ERROR: missing sandbox command '${geminiSandbox}' (from GEMINI_SANDBOX)`,
|
||||
`ERROR: missing sandbox command '${qwenSandbox}' (from QWEN_SANDBOX)`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ const projectHash = getProjectHash(projectRoot);
|
|||
// User-level .gemini directory in home
|
||||
const USER_GEMINI_DIR = path.join(os.homedir(), '.qwen');
|
||||
// Project-level .gemini directory in the workspace
|
||||
const WORKSPACE_GEMINI_DIR = path.join(projectRoot, '.qwen');
|
||||
const WORKSPACE_QWEN_DIR = path.join(projectRoot, '.qwen');
|
||||
|
||||
// Telemetry artifacts are stored in a hashed directory under the user's ~/.qwen/tmp
|
||||
export const OTEL_DIR = path.join(USER_GEMINI_DIR, 'tmp', projectHash, 'otel');
|
||||
|
|
@ -45,7 +45,7 @@ export const BIN_DIR = path.join(OTEL_DIR, 'bin');
|
|||
|
||||
// Workspace settings remain in the project's .gemini directory
|
||||
export const WORKSPACE_SETTINGS_FILE = path.join(
|
||||
WORKSPACE_GEMINI_DIR,
|
||||
WORKSPACE_QWEN_DIR,
|
||||
'settings.json',
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue