feat: add input context to chat.params and chat.message (#4085)

This commit is contained in:
Mathias Beugnon
2025-11-09 06:29:27 +01:00
committed by GitHub
parent 9637d70407
commit d85eb1b880
2 changed files with 13 additions and 3 deletions

View File

@@ -206,6 +206,8 @@ export namespace SessionPrompt {
const params = await Plugin.trigger(
"chat.params",
{
sessionID: input.sessionID,
agent: agent.name,
model: model.info,
provider: await Provider.getProvider(model.providerID),
message: userMsg,
@@ -882,7 +884,12 @@ export namespace SessionPrompt {
await Plugin.trigger(
"chat.message",
{},
{
sessionID: input.sessionID,
agent: input.agent,
model: input.model,
messageID: input.messageID,
},
{
message: info,
parts,

View File

@@ -143,12 +143,15 @@ export interface Hooks {
/**
* Called when a new message is received
*/
"chat.message"?: (input: {}, output: { message: UserMessage; parts: Part[] }) => Promise<void>
"chat.message"?: (
input: { sessionID: string; agent?: string; model?: { providerID: string; modelID: string; messageID?: string } },
output: { message: UserMessage; parts: Part[] },
) => Promise<void>
/**
* Modify parameters sent to LLM
*/
"chat.params"?: (
input: { model: Model; provider: Provider; message: UserMessage },
input: { sessionID: string; agent: string; model: Model; provider: Provider; message: UserMessage },
output: { temperature: number; topP: number; options: Record<string, any> },
) => Promise<void>
"permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void>