ddc2edfa0a
- Added a new configuration option `disable_omo_env` to control the injection of the `<omo-env>` block in agent prompts. - Updated relevant functions and tests to support this feature, ensuring that the environment context can be toggled on or off as needed. - Enhanced documentation to reflect the new option and its implications for API cost and cache hit rates.
17 lines
498 B
TypeScript
17 lines
498 B
TypeScript
import type { AgentConfig } from "@opencode-ai/sdk"
|
|
import { createEnvContext } from "../env-context"
|
|
|
|
type ApplyEnvironmentContextOptions = {
|
|
disableOmoEnv?: boolean
|
|
}
|
|
|
|
export function applyEnvironmentContext(
|
|
config: AgentConfig,
|
|
directory?: string,
|
|
options: ApplyEnvironmentContextOptions = {}
|
|
): AgentConfig {
|
|
if (options.disableOmoEnv || !directory || !config.prompt) return config
|
|
const envContext = createEnvContext()
|
|
return { ...config, prompt: config.prompt + envContext }
|
|
}
|