Main entry point: - create-hooks.ts, create-tools.ts, create-managers.ts - plugin-interface.ts: plugin interface types - plugin/ directory: plugin lifecycle modules Config handler: - agent-config-handler.ts, command-config-handler.ts - tool-config-handler.ts, mcp-config-handler.ts - provider-config-handler.ts, category-config-resolver.ts - agent-priority-order.ts, prometheus-agent-config-builder.ts - plugin-components-loader.ts
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { OhMyOpenCodeConfig } from "../config"
|
|
import type { PluginContext } from "./types"
|
|
|
|
import { createUnstableAgentBabysitterHook } from "../hooks"
|
|
import type { BackgroundManager } from "../features/background-agent"
|
|
|
|
export function createUnstableAgentBabysitter(args: {
|
|
ctx: PluginContext
|
|
backgroundManager: BackgroundManager
|
|
pluginConfig: OhMyOpenCodeConfig
|
|
}) {
|
|
const { ctx, backgroundManager, pluginConfig } = args
|
|
|
|
return createUnstableAgentBabysitterHook(
|
|
{
|
|
directory: ctx.directory,
|
|
client: {
|
|
session: {
|
|
messages: async ({ path }) => {
|
|
const result = await ctx.client.session.messages({ path })
|
|
if (Array.isArray(result)) return result
|
|
if (typeof result === "object" && result !== null) {
|
|
return result
|
|
}
|
|
return []
|
|
},
|
|
prompt: async (promptArgs) => {
|
|
await ctx.client.session.promptAsync(promptArgs)
|
|
},
|
|
promptAsync: async (promptArgs) => {
|
|
await ctx.client.session.promptAsync(promptArgs)
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
backgroundManager,
|
|
config: pluginConfig.babysitting,
|
|
},
|
|
)
|
|
}
|