feat: opencode serve — постоянный сервер вместо разовых subprocess (вариант A)
Супервайзер Server spawn'ит opencode serve (или ходит на внешний URL),
Runner ходит к нему через 'opencode run --attach <url>'. По умолчанию
serve.enabled=false — историческая spawn-модель сохранена; наличие
serve.url переключает на внешний сервер.
- config: ServeCfg (enabled/hostname/port/url/password) + дефолты; лоадер
научился int/bool (раньше только string/Duration/struct).
- opencode: Server (Start/Run/Close, /global/health, рестарт упавшего,
reaper-горутина владеет Wait; .Exited() непригоден для SIGKILL).
- Runner.AttachURL: run --attach <url> при заданном URL, иначе как раньше.
- app: composition root — при включённом serve запускает супервайзер.
- тесты: TestRun_AttachMode, TestServer_{ExternalURL,OwnProcess,Restart}.
This commit is contained in:
@@ -76,6 +76,15 @@ telegram:
|
||||
if cfg.OpenCode.IdleTimeout.Duration() != 5*time.Minute {
|
||||
t.Errorf("idle timeout = %v", cfg.OpenCode.IdleTimeout)
|
||||
}
|
||||
if cfg.OpenCode.Serve.Enabled {
|
||||
t.Errorf("serve.enabled = true, want false (дефолт)")
|
||||
}
|
||||
if cfg.OpenCode.Serve.Hostname != "127.0.0.1" {
|
||||
t.Errorf("serve.hostname = %q, want 127.0.0.1", cfg.OpenCode.Serve.Hostname)
|
||||
}
|
||||
if cfg.OpenCode.Serve.Port != 4096 {
|
||||
t.Errorf("serve.port = %d, want 4096", cfg.OpenCode.Serve.Port)
|
||||
}
|
||||
if cfg.Paths.Worktree != "./worktrees" {
|
||||
t.Errorf("worktree = %q, want ./worktrees", cfg.Paths.Worktree)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user