refactor(core): split index.ts and config-handler.ts into focused modules
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
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { Message, Part } from "@opencode-ai/sdk"
|
||||
|
||||
import type { CreatedHooks } from "../create-hooks"
|
||||
|
||||
type MessageWithParts = {
|
||||
info: Message
|
||||
parts: Part[]
|
||||
}
|
||||
|
||||
type MessagesTransformOutput = { messages: MessageWithParts[] }
|
||||
|
||||
export function createMessagesTransformHandler(args: {
|
||||
hooks: CreatedHooks
|
||||
}): (input: Record<string, never>, output: MessagesTransformOutput) => Promise<void> {
|
||||
return async (input, output): Promise<void> => {
|
||||
await args.hooks.contextInjectorMessagesTransform?.[
|
||||
"experimental.chat.messages.transform"
|
||||
]?.(input, output)
|
||||
|
||||
await args.hooks.thinkingBlockValidator?.[
|
||||
"experimental.chat.messages.transform"
|
||||
]?.(input, output)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user