7f846b2da3
Keep native /start-work resolvable on Sisyphus, but switch the work session back to Atlas when Atlas is registered. Stamp the outgoing agent with Atlas's actual list-display key so config→start-work execution resolves correctly and still falls back to Sisyphus when Atlas is unavailable. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
84 lines
2.4 KiB
TypeScript
84 lines
2.4 KiB
TypeScript
import type { PluginContext, PluginInterface, ToolsRecord } from "./plugin/types"
|
|
import type { OhMyOpenCodeConfig } from "./config"
|
|
|
|
import { createChatParamsHandler } from "./plugin/chat-params"
|
|
import { createChatHeadersHandler } from "./plugin/chat-headers"
|
|
import { createChatMessageHandler } from "./plugin/chat-message"
|
|
import { createCommandExecuteBeforeHandler } from "./plugin/command-execute-before"
|
|
import { createMessagesTransformHandler } from "./plugin/messages-transform"
|
|
import { createSystemTransformHandler } from "./plugin/system-transform"
|
|
import { createEventHandler } from "./plugin/event"
|
|
import { createToolExecuteAfterHandler } from "./plugin/tool-execute-after"
|
|
import { createToolExecuteBeforeHandler } from "./plugin/tool-execute-before"
|
|
|
|
import type { CreatedHooks } from "./create-hooks"
|
|
import type { Managers } from "./create-managers"
|
|
|
|
export function createPluginInterface(args: {
|
|
ctx: PluginContext
|
|
pluginConfig: OhMyOpenCodeConfig
|
|
firstMessageVariantGate: {
|
|
shouldOverride: (sessionID: string) => boolean
|
|
markApplied: (sessionID: string) => void
|
|
markSessionCreated: (sessionInfo: { id?: string; title?: string; parentID?: string } | undefined) => void
|
|
clear: (sessionID: string) => void
|
|
}
|
|
managers: Managers
|
|
hooks: CreatedHooks
|
|
tools: ToolsRecord
|
|
}): PluginInterface {
|
|
const { ctx, pluginConfig, firstMessageVariantGate, managers, hooks, tools } =
|
|
args
|
|
|
|
return {
|
|
tool: tools,
|
|
|
|
"chat.params": async (input: unknown, output: unknown) => {
|
|
const handler = createChatParamsHandler({
|
|
anthropicEffort: hooks.anthropicEffort,
|
|
client: ctx.client,
|
|
})
|
|
await handler(input, output)
|
|
},
|
|
|
|
"chat.headers": createChatHeadersHandler({ ctx }),
|
|
|
|
"command.execute.before": createCommandExecuteBeforeHandler({
|
|
hooks,
|
|
}),
|
|
|
|
"chat.message": createChatMessageHandler({
|
|
ctx,
|
|
pluginConfig,
|
|
firstMessageVariantGate,
|
|
hooks,
|
|
}),
|
|
|
|
"experimental.chat.messages.transform": createMessagesTransformHandler({
|
|
hooks,
|
|
}),
|
|
|
|
"experimental.chat.system.transform": createSystemTransformHandler(),
|
|
|
|
config: managers.configHandler,
|
|
|
|
event: createEventHandler({
|
|
ctx,
|
|
pluginConfig,
|
|
firstMessageVariantGate,
|
|
managers,
|
|
hooks,
|
|
}),
|
|
|
|
"tool.execute.before": createToolExecuteBeforeHandler({
|
|
ctx,
|
|
hooks,
|
|
}),
|
|
|
|
"tool.execute.after": createToolExecuteAfterHandler({
|
|
ctx,
|
|
hooks,
|
|
}),
|
|
}
|
|
}
|