From 6af0472601044f9e56d899ac3d5974e6cd50759f Mon Sep 17 00:00:00 2001 From: Younes Abouelnagah Date: Sat, 2 May 2026 16:49:30 -0400 Subject: [PATCH] fix(agents): extend onAgentEvent callback type with sessionKey The lifecycle backstop cherry-pick (`fix(agents): finalize embedded lifecycle backstop`) accesses `evt.sessionKey` inside the `onAgentEvent` callback in `agent-runner-execution.ts`, but the callback type declared in `pi-embedded-subscribe.types.ts` and `pi-embedded-runner/ run/params.ts` does not include `sessionKey`. This is the type-only piece of upstream `1184925572` (a CI-perf commit that bundled an unrelated type extension); we excluded that cherry-pick under D8 but need the type-extension subset to keep the build green. Without this, `pnpm build` (specifically `build:plugin-sdk:dts`) fails with TS2339 in agent-runner-execution.ts:1109 and the release tarball never builds. Triage commit: type-only extension, no runtime change, narrowly scoped to the two callback declarations. --- src/agents/pi-embedded-runner/run/params.ts | 6 +++++- src/agents/pi-embedded-subscribe.types.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/agents/pi-embedded-runner/run/params.ts b/src/agents/pi-embedded-runner/run/params.ts index 997f23af15..27411cc2db 100644 --- a/src/agents/pi-embedded-runner/run/params.ts +++ b/src/agents/pi-embedded-runner/run/params.ts @@ -118,7 +118,11 @@ export type RunEmbeddedPiAgentParams = { onReasoningStream?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onReasoningEnd?: () => void | Promise; onToolResult?: (payload: ReplyPayload) => void | Promise; - onAgentEvent?: (evt: { stream: string; data: Record }) => void; + onAgentEvent?: (evt: { + stream: string; + data: Record; + sessionKey?: string; + }) => void; lane?: string; enqueue?: CommandQueueEnqueueFn; extraSystemPrompt?: string; diff --git a/src/agents/pi-embedded-subscribe.types.ts b/src/agents/pi-embedded-subscribe.types.ts index 2f49a37759..cab7cd399b 100644 --- a/src/agents/pi-embedded-subscribe.types.ts +++ b/src/agents/pi-embedded-subscribe.types.ts @@ -30,7 +30,11 @@ export type SubscribeEmbeddedPiSessionParams = { blockReplyChunking?: BlockReplyChunking; onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onAssistantMessageStart?: () => void | Promise; - onAgentEvent?: (evt: { stream: string; data: Record }) => void | Promise; + onAgentEvent?: (evt: { + stream: string; + data: Record; + sessionKey?: string; + }) => void | Promise; enforceFinalTag?: boolean; silentExpected?: boolean; config?: OpenClawConfig;