mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(sse): harden SSE with queue-based writer, backpressure, and directory-aware batching
- Replace promise-chaining SSE writer with queue-based pump with MAX_QUEUED_FRAMES backpressure - Make frontend parts batcher directory-aware with (sessionID, directory) composite key - Add session content versioning for reliable content change detection - Add TOOLS_CACHEBUST arg for selective Docker cache invalidation - Add docker-upgrade.sh modes (cached/tools/full) - Fix plugin install timeout and spawn error handling - Fix assistant session endpoint path and ordering params
This commit is contained in:
1 parent
fdeffeaab7
commit
12b7387e11
25 files changed
+1632
-181
No files matched your search
@@ -29,6 +29,7 @@ import { writeFileContent } from './file-operations'
|
||||
const MIN_OPENCODE_VERSION = '1.0.137'
|
||||
const MAX_STDERR_SIZE = 10240
|
||||
const HEALTH_CHECK_TIMEOUT_MS = 3000
|
||||
const PLUGIN_INSTALL_TIMEOUT_MS = 120000
|
||||
const DEPRECATED_PLUGIN_PACKAGES = ['opencode-openai-codex-auth', 'opencode-copilot-auth']
|
||||
|
||||
type StartupValidationIssue = {
|
||||
@@ -585,19 +586,24 @@ class OpenCodeServerManager {
|
||||
|
||||
await fs.mkdir(installDir, { recursive: true })
|
||||
if (!await fs.access(path.join(installDir, 'package.json')).then(() => true).catch(() => false)) {
|
||||
const init = spawnSync('bun', ['init', '-y'], { cwd: installDir, encoding: 'utf8' })
|
||||
const init = spawnSync('bun', ['init', '-y'], { cwd: installDir, encoding: 'utf8', timeout: 30000 })
|
||||
if (init.status !== 0) {
|
||||
logger.warn(`Failed to initialize OpenCode plugin cache for ${plugin}: ${init.stderr || init.stdout}`)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
const result = spawnSync('bun', ['add', '--ignore-scripts', installSpec], { cwd: installDir, encoding: 'utf8' })
|
||||
const result = spawnSync('bun', ['add', '--ignore-scripts', installSpec], { cwd: installDir, encoding: 'utf8', timeout: PLUGIN_INSTALL_TIMEOUT_MS })
|
||||
if (result.status === 0) {
|
||||
logger.info(`Installed OpenCode plugin: ${plugin}`)
|
||||
continue
|
||||
}
|
||||
|
||||
if (result.error) {
|
||||
logger.warn(`Failed to install OpenCode plugin ${plugin}: ${result.error.message}`)
|
||||
continue
|
||||
}
|
||||
|
||||
logger.warn(`Failed to install OpenCode plugin ${plugin}: ${result.stderr || result.stdout}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user