fix(hooks): add missing trigger and channelId to agent_end, llm_input, and llm_output hook contexts

PR #28623 added trigger and channelId to PluginHookAgentContext and
threaded them through hookCtx for before_prompt_build, but missed the
separate context objects constructed for agent_end (line ~1974),
llm_input (line ~1766), and llm_output (line ~2034).

This caused ctx.trigger and ctx.channelId to always be undefined in
those hook handlers, breaking plugins that rely on trigger to
distinguish user-initiated vs memory/cron/heartbeat runs.

Aligns all hook context objects with hookCtx (line ~1636) so every
hook phase receives identical context fields.

🤖 AI-assisted
This commit is contained in:
zhoulf1006
2026-03-11 00:45:32 +08:00
committed by Robin Waslander
parent d79ca52960
commit 06c13c266e

View File

@@ -1774,6 +1774,8 @@ export async function runEmbeddedAttempt(
sessionId: params.sessionId,
workspaceDir: params.workspaceDir,
messageProvider: params.messageProvider ?? undefined,
trigger: params.trigger,
channelId: params.messageChannel ?? params.messageProvider ?? undefined,
},
)
.catch((err) => {
@@ -1982,6 +1984,8 @@ export async function runEmbeddedAttempt(
sessionId: params.sessionId,
workspaceDir: params.workspaceDir,
messageProvider: params.messageProvider ?? undefined,
trigger: params.trigger,
channelId: params.messageChannel ?? params.messageProvider ?? undefined,
},
)
.catch((err) => {
@@ -2042,6 +2046,8 @@ export async function runEmbeddedAttempt(
sessionId: params.sessionId,
workspaceDir: params.workspaceDir,
messageProvider: params.messageProvider ?? undefined,
trigger: params.trigger,
channelId: params.messageChannel ?? params.messageProvider ?? undefined,
},
)
.catch((err) => {