feat(config): add Env field to RuntimeConfig and AgentPresetInfo (#860)
Add support for agent presets to specify environment variables that
get exported when starting sessions. This enables agents to use
environment-based configuration.
Changes:
- Add Env field to RuntimeConfig struct in types.go
- Add Env field to AgentPresetInfo struct in agents.go
- Update RuntimeConfigFromPreset to copy Env from preset
- Update fillRuntimeDefaults to preserve Env field
- Merge agent Env vars in BuildStartupCommand functions
- Add comprehensive tests for Env preservation and copy semantics
This is a prerequisite for the OpenCode agent preset which uses
OPENCODE_PERMISSION='{"*":"allow"}' for auto-approve mode.
Co-authored-by: Avyukth <subhrajit.makur@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -263,6 +263,11 @@ type RuntimeConfig struct {
|
||||
// Empty array [] means no args (not "use defaults").
|
||||
Args []string `json:"args"`
|
||||
|
||||
// Env are environment variables to set when starting the agent.
|
||||
// These are merged with the standard GT_* variables.
|
||||
// Used for agent-specific configuration like OPENCODE_PERMISSION.
|
||||
Env map[string]string `json:"env,omitempty"`
|
||||
|
||||
// InitialPrompt is an optional first message to send after startup.
|
||||
// For claude, this is passed as the prompt argument.
|
||||
// Empty by default (hooks handle context).
|
||||
|
||||
Reference in New Issue
Block a user