From 016be7d533c3fd40541b5f2a933c2d12be22a026 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Sun, 23 Aug 2026 03:42:02 +0800 Subject: [PATCH] fix(interaction): type Agent-scoped request events --- packages/interaction/user-approval/src/index.ts | 2 +- packages/interaction/user-approval/src/types.ts | 5 +++-- packages/interaction/user-questions/src/index.ts | 4 ++-- packages/interaction/user-questions/src/types.ts | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/interaction/user-approval/src/index.ts b/packages/interaction/user-approval/src/index.ts index ee4f087d5e..5d03b3186c 100644 --- a/packages/interaction/user-approval/src/index.ts +++ b/packages/interaction/user-approval/src/index.ts @@ -281,7 +281,7 @@ export class ApprovalService extends Service { // the containment into the caller. const answer: Promise = Promise.resolve().then( () => this.ctx.waterfall( - scopeTarget(this, req.agent), 'approval/request', req, + scopeTarget(req.agent, req.agent), 'approval/request', req, () => Promise.resolve('unavailable'), ), ).then( diff --git a/packages/interaction/user-approval/src/types.ts b/packages/interaction/user-approval/src/types.ts index a04ef15db2..9a4185601d 100644 --- a/packages/interaction/user-approval/src/types.ts +++ b/packages/interaction/user-approval/src/types.ts @@ -77,12 +77,13 @@ declare module '@deepseek-ai/cordis' { interface Events { /** * Ask composed answerers for one decision. Return an outcome to claim the - * request or call `next()` to delegate. + * request or call `next()` to delegate. Scope-filtered dispatch + * (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent. * @param req - pending approval request. * @mode waterfall */ 'approval/request'( - this: Scoped, + this: Scoped, req: ApprovalRequestEvent, next: () => Promise, ): Promise diff --git a/packages/interaction/user-questions/src/index.ts b/packages/interaction/user-questions/src/index.ts index a9ddc147af..803f831826 100644 --- a/packages/interaction/user-questions/src/index.ts +++ b/packages/interaction/user-questions/src/index.ts @@ -18,7 +18,7 @@ declare module '@deepseek-ai/cordis' { } import type { - AskUserQuestionAnswer, AskUserQuestionItem, AskUserQuestionRequestEvent, + AskUserQuestionAnswer, AskUserQuestionItem, } from './types.ts' export type { @@ -27,7 +27,7 @@ export type { } from './types.ts' /** Request for a human answer. */ -export interface AskUserQuestionRequest extends AskUserQuestionRequestEvent { +export interface AskUserQuestionRequest { /** Questions to display. */ questions: AskUserQuestionItem[] /** Exact live calling agent, when the request came from an agent tool call. */ diff --git a/packages/interaction/user-questions/src/types.ts b/packages/interaction/user-questions/src/types.ts index fbca8f5e3b..64acfae089 100644 --- a/packages/interaction/user-questions/src/types.ts +++ b/packages/interaction/user-questions/src/types.ts @@ -68,7 +68,7 @@ export interface AskUserQuestionRequestEvent { /** Questions to display. */ questions: AskUserQuestionItem[] /** Agent identity projected to the corresponding Client Context in transit. */ - agent?: Agent + agent: Agent /** Cancellation lifetime of the pending request. */ signal?: AbortSignal } @@ -77,12 +77,13 @@ declare module '@deepseek-ai/cordis' { interface Events { /** * Ask composed answerers for structured user input. Return an answer to - * claim the request or call `next()` to delegate. + * claim the request or call `next()` to delegate. Scope-filtered dispatch + * (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent. * @param request - pending user-question request. * @mode waterfall */ 'user-questions/request'( - this: Scoped, + this: Scoped, request: AskUserQuestionRequestEvent, next: () => Promise, ): Promise