fix(interaction): type Agent-scoped request events

This commit is contained in:
imccyu committed 2026-08-23 16:16:03 +08:00
1 parent 9ff067dfbd
commit 016be7d533
4 files changed
+10 -8

No files matched your search

@@ -281,7 +281,7 @@ export class ApprovalService extends Service {
// the containment into the caller.
const answer: Promise<ApprovalOutcome> = Promise.resolve().then(
() => this.ctx.waterfall(
scopeTarget(this, req.agent), 'approval/request', req,
scopeTarget(req.agent, req.agent), 'approval/request', req,
() => Promise.resolve<ApprovalOutcome>('unavailable'),
),
).then(
@@ -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<object>,
this: Scoped<Agent>,
req: ApprovalRequestEvent,
next: () => Promise<ApprovalOutcome>,
): Promise<ApprovalOutcome>
@@ -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. */
@@ -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<object>,
this: Scoped<Agent>,
request: AskUserQuestionRequestEvent,
next: () => Promise<AskUserQuestionAnswer>,
): Promise<AskUserQuestionAnswer>