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