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:
@@ -741,6 +741,59 @@ describe("ExperimentalConfigSchema feature flags", () => {
|
||||
}
|
||||
})
|
||||
|
||||
test("accepts disable_omo_env as true", () => {
|
||||
//#given
|
||||
const config = { disable_omo_env: true }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.disable_omo_env).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
test("accepts disable_omo_env as false", () => {
|
||||
//#given
|
||||
const config = { disable_omo_env: false }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.disable_omo_env).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
test("disable_omo_env is optional", () => {
|
||||
//#given
|
||||
const config = { safe_hook_creation: true }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.disable_omo_env).toBeUndefined()
|
||||
}
|
||||
})
|
||||
|
||||
test("rejects non-boolean disable_omo_env", () => {
|
||||
//#given
|
||||
const config = { disable_omo_env: "true" }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
test("rejects non-boolean hashline_edit", () => {
|
||||
//#given
|
||||
const config = { hashline_edit: "true" }
|
||||
|
||||
@@ -15,6 +15,8 @@ export const ExperimentalConfigSchema = z.object({
|
||||
plugin_load_timeout_ms: z.number().min(1000).optional(),
|
||||
/** Wrap hook creation in try/catch to prevent one failing hook from crashing the plugin (default: true at call site) */
|
||||
safe_hook_creation: z.boolean().optional(),
|
||||
/** Disable the OhMyOpenCode environment setup (experimental) */
|
||||
disable_omo_env: z.boolean().optional(),
|
||||
/** Enable hashline_edit tool for improved file editing with hash-based line anchors */
|
||||
hashline_edit: z.boolean().optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user