Files
dsh-mail-sender/lib/deliver.d.ts
T

28 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-11-16 13:52:14 +08:00
import type { Context } from '@deepseek-ai/cordis';
import type { MailJob } from './types.js';
/**
* 邮件会话适配层:ctx.agents / session/event 的全部调用都收在这里,
* Agent API 变化时只需改这一个文件。
*/
export declare class MailDeliverer {
private readonly ctx;
private readonly onReply;
private readonly onLog?;
private readonly handles;
private readonly turnBuffers;
/** 每个会话按投递顺序排队,一轮回复对应队首的一封来信。 */
private readonly pending;
2026-11-17 07:33:51 +08:00
/** 每个会话已处理的最大事件序号,用于根/Agent 两处订阅的去重。 */
private readonly seen;
private readonly offRoot;
2026-11-16 13:52:14 +08:00
constructor(ctx: Context, onReply: (job: MailJob, text: string) => Promise<void>, onLog?: ((message: string) => void) | undefined);
deliver(job: MailJob): Promise<void>;
dispose(): void;
private ensure;
2026-11-16 14:53:37 +08:00
/**
* 在 Agent 作用域内订阅会话事件。作用域过滤下,只有进入该 Agent 上下文的监听
* 才能稳定收到本会话的 durable 事件,因此不能挂在插件根上下文上。
*/
private watch;
2026-11-16 13:52:14 +08:00
private handleEvent;
}