refactor(model-fallback): fully encapsulate session state in factory closure
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -5,6 +5,7 @@ import type { PluginContext, TmuxConfig } from "./plugin/types"
|
||||
import type { SubagentSessionCreatedEvent } from "./features/background-agent"
|
||||
import { BackgroundManager } from "./features/background-agent"
|
||||
import { SkillMcpManager } from "./features/skill-mcp-manager"
|
||||
import { createModelFallbackControllerAccessor } from "./hooks/model-fallback"
|
||||
import { initTaskToastManager } from "./features/task-toast-manager"
|
||||
import { TmuxSessionManager } from "./features/tmux-subagent"
|
||||
import * as openclawRuntimeDispatch from "./openclaw/runtime-dispatch"
|
||||
@@ -12,6 +13,7 @@ import { registerManagerForCleanup } from "./features/background-agent/process-c
|
||||
import { createConfigHandler } from "./plugin-handlers"
|
||||
import { log } from "./shared"
|
||||
import { markServerRunningInProcess } from "./shared/tmux/tmux-utils/server-health"
|
||||
import type { ModelFallbackControllerAccessor } from "./hooks/model-fallback"
|
||||
|
||||
type CreateManagersDeps = {
|
||||
BackgroundManagerClass: typeof BackgroundManager
|
||||
@@ -38,6 +40,7 @@ export type Managers = {
|
||||
backgroundManager: BackgroundManager
|
||||
skillMcpManager: SkillMcpManager
|
||||
configHandler: ReturnType<typeof createConfigHandler>
|
||||
modelFallbackControllerAccessor: ModelFallbackControllerAccessor
|
||||
}
|
||||
|
||||
export function createManagers(args: {
|
||||
@@ -119,11 +122,13 @@ export function createManagers(args: {
|
||||
pluginConfig,
|
||||
modelCacheState,
|
||||
})
|
||||
const modelFallbackControllerAccessor = createModelFallbackControllerAccessor()
|
||||
|
||||
return {
|
||||
tmuxSessionManager,
|
||||
backgroundManager,
|
||||
skillMcpManager,
|
||||
configHandler,
|
||||
modelFallbackControllerAccessor,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user