2026-02-08 13:57:26 +09:00
|
|
|
import type { AgentConfig } from "@opencode-ai/sdk"
|
|
|
|
|
import { createEnvContext } from "../env-context"
|
|
|
|
|
|
2026-02-20 02:31:18 +11:00
|
|
|
type ApplyEnvironmentContextOptions = {
|
|
|
|
|
disableOmoEnv?: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function applyEnvironmentContext(
|
|
|
|
|
config: AgentConfig,
|
|
|
|
|
directory?: string,
|
|
|
|
|
options: ApplyEnvironmentContextOptions = {}
|
|
|
|
|
): AgentConfig {
|
|
|
|
|
if (options.disableOmoEnv || !directory || !config.prompt) return config
|
2026-02-08 13:57:26 +09:00
|
|
|
const envContext = createEnvContext()
|
|
|
|
|
return { ...config, prompt: config.prompt + envContext }
|
|
|
|
|
}
|