| 151 | ) |
| 152 | |
| 153 | export interface Hooks { |
| 154 | event?: (input: { event: Event }) => Promise<void> |
| 155 | config?: (input: Config) => Promise<void> |
| 156 | tool?: { |
| 157 | [key: string]: ToolDefinition |
| 158 | } |
| 159 | auth?: AuthHook |
| 160 | /** |
| 161 | * Called when a new message is received |
| 162 | */ |
| 163 | "chat.message"?: ( |
| 164 | input: { sessionID: string; agent?: string; model?: { providerID: string; modelID: string }; messageID?: string }, |
| 165 | output: { message: UserMessage; parts: Part[] }, |
| 166 | ) => Promise<void> |
| 167 | /** |
| 168 | * Modify parameters sent to LLM |
| 169 | */ |
| 170 | "chat.params"?: ( |
| 171 | input: { sessionID: string; agent: string; model: Model; provider: ProviderContext; message: UserMessage }, |
| 172 | output: { temperature: number; topP: number; options: Record<string, any> }, |
| 173 | ) => Promise<void> |
| 174 | "permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void> |
| 175 | "tool.execute.before"?: ( |
| 176 | input: { tool: string; sessionID: string; callID: string }, |
| 177 | output: { args: any }, |
| 178 | ) => Promise<void> |
| 179 | "tool.execute.after"?: ( |
| 180 | input: { tool: string; sessionID: string; callID: string }, |
| 181 | output: { |
| 182 | title: string |
| 183 | output: string |
| 184 | metadata: any |
| 185 | }, |
| 186 | ) => Promise<void> |
| 187 | "experimental.chat.messages.transform"?: ( |
| 188 | input: {}, |
| 189 | output: { |
| 190 | messages: { |
| 191 | info: Message |
| 192 | parts: Part[] |
| 193 | }[] |
| 194 | }, |
| 195 | ) => Promise<void> |
| 196 | "experimental.text.complete"?: ( |
| 197 | input: { sessionID: string; messageID: string; partID: string }, |
| 198 | output: { text: string }, |
| 199 | ) => Promise<void> |
| 200 | } |
nothing calls this directly
no outgoing calls
no test coverage detected