fix(opencode): агенты — в <worktree>/.opencode/agent, OPENCODE_CONFIG_DIR больше не выставляем
OPENCODE_CONFIG_DIR в opencode v1.18.18 перенаправляет Global.Path.config (global.ts: config = OPENCODE_CONFIG_DIR ?? ~/.config/opencode), из-за чего глобальный конфиг (модель/провайдеры, напр. tokentool) не загружался и opencode уходил в fallback-модель. Агенты открывались, т.к. OPENCODE_CONFIG_DIR дополнительно сканируется как каталог для agent/*.md. Теперь агенты распаковываются в <worktree>/.opencode/agent/*.md, где opencode находит их через project-каталог .opencode (paths.ts, cwd=worktree). Глобальный конфиг не трогаем вовсе. - internal/opencode: удалены Server.ConfigDir/Pool.ConfigDir и env OPENCODE_CONFIG_DIR - internal/config: удалено поле OpenCodeCfg.ConfigDir (config_dir) - internal/app: ensureAgentsDir пишет в <worktree>/.opencode/agent - internal/agents: WriteTo(dir) → dir/agent/*.md - README/config.yaml.example/memory обновлены
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
type Pool struct {
|
||||
Bin string
|
||||
Config string
|
||||
ConfigDir string
|
||||
DBPath string
|
||||
Host string
|
||||
BasePort int
|
||||
@@ -72,13 +71,12 @@ func (p *Pool) EnsureRoot(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
s := &Server{
|
||||
Bin: p.Bin,
|
||||
Config: p.Config,
|
||||
ConfigDir: p.ConfigDir,
|
||||
DBPath: p.DBPath,
|
||||
Host: p.Host,
|
||||
Password: p.Password,
|
||||
Dir: p.rootDir,
|
||||
Bin: p.Bin,
|
||||
Config: p.Config,
|
||||
DBPath: p.DBPath,
|
||||
Host: p.Host,
|
||||
Password: p.Password,
|
||||
Dir: p.rootDir,
|
||||
}
|
||||
if err := p.assign(s); err != nil {
|
||||
return err
|
||||
@@ -102,13 +100,12 @@ func (p *Pool) Ensure(ctx context.Context, dir string) (*Server, error) {
|
||||
}
|
||||
abs := filepath.Clean(dir)
|
||||
s := &Server{
|
||||
Bin: p.Bin,
|
||||
Config: p.Config,
|
||||
ConfigDir: p.ConfigDir,
|
||||
DBPath: p.DBPath,
|
||||
Host: p.Host,
|
||||
Password: p.Password,
|
||||
Dir: abs,
|
||||
Bin: p.Bin,
|
||||
Config: p.Config,
|
||||
DBPath: p.DBPath,
|
||||
Host: p.Host,
|
||||
Password: p.Password,
|
||||
Dir: abs,
|
||||
}
|
||||
if err := p.assign(s); err != nil {
|
||||
p.mu.Unlock()
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
type Server struct {
|
||||
Bin string // путь к opencode (по умолчанию "opencode")
|
||||
Config string // OPENCODE_CONFIG
|
||||
ConfigDir string // OPENCODE_CONFIG_DIR
|
||||
DBPath string // рабочая БД сервера (передам env, если задана)
|
||||
|
||||
Host string // hostname для прослушивания
|
||||
@@ -127,12 +126,13 @@ func (s *Server) serveCmd(ctx context.Context) *exec.Cmd {
|
||||
env := append(os.Environ(),
|
||||
"OPENCODE_DISABLE_AUTOUPDATE=1",
|
||||
"OPENCODE_DISABLE_MODELS_FETCH=1")
|
||||
// Агенты (analyst/dev/...) opencode находит сам через project-каталог
|
||||
// .opencode (см. internal/agents); OPENCODE_CONFIG_DIR не выставляем,
|
||||
// чтобы не перенаправлять Global.Path.config и сохранить глобальный
|
||||
// конфиг opencode (модель/провайдеры).
|
||||
if s.Config != "" {
|
||||
env = append(env, "OPENCODE_CONFIG="+s.Config)
|
||||
}
|
||||
if s.ConfigDir != "" {
|
||||
env = append(env, "OPENCODE_CONFIG_DIR="+s.ConfigDir)
|
||||
}
|
||||
if s.DBPath != "" {
|
||||
env = append(env, "OPENCODE_DB="+s.DBPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user