feat(environment): introduce disable_omo_env configuration option
- 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.
This commit is contained in:
@@ -1275,3 +1275,65 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
|
||||
expect(agentResult[getAgentDisplayName("sisyphus")]?.permission?.todoread).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
describe("disable_omo_env pass-through", () => {
|
||||
test("passes disable_omo_env=true to createBuiltinAgents", async () => {
|
||||
//#given
|
||||
const pluginConfig: OhMyOpenCodeConfig = {
|
||||
experimental: { disable_omo_env: true },
|
||||
}
|
||||
const config: Record<string, unknown> = {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
agent: {},
|
||||
}
|
||||
const handler = createConfigHandler({
|
||||
ctx: { directory: "/tmp" },
|
||||
pluginConfig,
|
||||
modelCacheState: {
|
||||
anthropicContext1MEnabled: false,
|
||||
modelContextLimitsCache: new Map(),
|
||||
},
|
||||
})
|
||||
|
||||
//#when
|
||||
await handler(config)
|
||||
|
||||
//#then
|
||||
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as {
|
||||
mock: { calls: unknown[][] }
|
||||
}
|
||||
const callArgs =
|
||||
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
|
||||
expect(callArgs).toBeDefined()
|
||||
expect(callArgs?.[12]).toBe(true)
|
||||
})
|
||||
|
||||
test("passes disable_omo_env=false when config field is omitted", async () => {
|
||||
//#given
|
||||
const pluginConfig: OhMyOpenCodeConfig = {}
|
||||
const config: Record<string, unknown> = {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
agent: {},
|
||||
}
|
||||
const handler = createConfigHandler({
|
||||
ctx: { directory: "/tmp" },
|
||||
pluginConfig,
|
||||
modelCacheState: {
|
||||
anthropicContext1MEnabled: false,
|
||||
modelContextLimitsCache: new Map(),
|
||||
},
|
||||
})
|
||||
|
||||
//#when
|
||||
await handler(config)
|
||||
|
||||
//#then
|
||||
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as {
|
||||
mock: { calls: unknown[][] }
|
||||
}
|
||||
const callArgs =
|
||||
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
|
||||
expect(callArgs).toBeDefined()
|
||||
expect(callArgs?.[12]).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user