Derive tmux runtime fallback from schema defaults
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
/// <reference types="bun-types" />
|
||||||
|
|
||||||
|
import { describe, expect, test } from "bun:test"
|
||||||
|
|
||||||
|
import { TmuxConfigSchema } from "./config/schema/tmux"
|
||||||
|
import { createRuntimeTmuxConfig } from "./create-runtime-tmux-config"
|
||||||
|
|
||||||
|
describe("createRuntimeTmuxConfig", () => {
|
||||||
|
describe("#given tmux isolation is omitted from plugin config", () => {
|
||||||
|
test("#when runtime tmux config is created #then it matches the schema default", () => {
|
||||||
|
const runtimeTmuxConfig = createRuntimeTmuxConfig({})
|
||||||
|
const schemaDefault = TmuxConfigSchema.parse({}).isolation
|
||||||
|
|
||||||
|
expect(runtimeTmuxConfig.isolation).toBe(schemaDefault)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import type { OhMyOpenCodeConfig, TmuxConfig } from "./config"
|
||||||
|
import { TmuxConfigSchema } from "./config/schema/tmux"
|
||||||
|
|
||||||
|
export function createRuntimeTmuxConfig(pluginConfig: { tmux?: OhMyOpenCodeConfig["tmux"] }): TmuxConfig {
|
||||||
|
return TmuxConfigSchema.parse(pluginConfig.tmux ?? {})
|
||||||
|
}
|
||||||
+2
-8
@@ -5,6 +5,7 @@ import type { HookName } from "./config"
|
|||||||
|
|
||||||
import { createHooks } from "./create-hooks"
|
import { createHooks } from "./create-hooks"
|
||||||
import { createManagers } from "./create-managers"
|
import { createManagers } from "./create-managers"
|
||||||
|
import { createRuntimeTmuxConfig } from "./create-runtime-tmux-config"
|
||||||
import { createTools } from "./create-tools"
|
import { createTools } from "./create-tools"
|
||||||
import { createPluginInterface } from "./plugin-interface"
|
import { createPluginInterface } from "./plugin-interface"
|
||||||
import { createPluginDispose, type PluginDispose } from "./plugin-dispose"
|
import { createPluginDispose, type PluginDispose } from "./plugin-dispose"
|
||||||
@@ -45,14 +46,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
|
|
||||||
const firstMessageVariantGate = createFirstMessageVariantGate()
|
const firstMessageVariantGate = createFirstMessageVariantGate()
|
||||||
|
|
||||||
const tmuxConfig = {
|
const tmuxConfig = createRuntimeTmuxConfig(pluginConfig)
|
||||||
enabled: pluginConfig.tmux?.enabled ?? false,
|
|
||||||
layout: pluginConfig.tmux?.layout ?? "main-vertical",
|
|
||||||
main_pane_size: pluginConfig.tmux?.main_pane_size ?? 60,
|
|
||||||
main_pane_min_width: pluginConfig.tmux?.main_pane_min_width ?? 120,
|
|
||||||
agent_pane_min_width: pluginConfig.tmux?.agent_pane_min_width ?? 40,
|
|
||||||
isolation: pluginConfig.tmux?.isolation ?? "inline",
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelCacheState = createModelCacheState()
|
const modelCacheState = createModelCacheState()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user