fix(remote): 移除默认端口配置,使用 opencode 默认端口 4096

This commit is contained in:
2026-03-14 15:27:37 +08:00
parent ba02eb10a7
commit 50cd1e29c9

View File

@@ -7,7 +7,7 @@ class OpenCodeService {
constructor(options = {}) {
this.process = null;
this.isRunning = false;
this.port = options.port || 3002;
this.port = options.port;
this.enabled = options.enabled !== false;
try {
@@ -42,17 +42,18 @@ class OpenCodeService {
}
try {
logger.info('Starting OpenCode service', { port: this.port, opencodePath: this.opencodePath });
logger.info('Starting OpenCode service', { port: this.port || 'default', opencodePath: this.opencodePath });
const env = {
...process.env,
OPENCODE_SERVER_PASSWORD: password
};
const portArg = this.port ? ` --port ${this.port}` : '';
this.process = spawn('powershell.exe', [
'-NoProfile',
'-Command',
`& '${this.opencodePath}' serve --port ${this.port}`
`& '${this.opencodePath}' serve${portArg}`
], {
stdio: ['ignore', 'pipe', 'pipe'],
env,
@@ -113,7 +114,7 @@ class OpenCodeService {
getStatus() {
return {
running: this.isRunning,
port: this.port
port: this.port || null
};
}
}