Files
MailUI4Agents/plugins/dsh-mail-bridge/lib/catchup.d.ts
JianFeeeee 79c4171c9d feat: L0 线协议冻结 + 附件链路修复 + 人/Agent 区分
L0 核心:
- 严格解码 Decode(DisallowUnknownFields) 全覆盖 29 个 DecodeBody 调用点
- DecodeLenient 心跳专用:容忍新字段但回报 unknown_fields
- 400 消息列出本端点接受的全部字段(jsonFieldNames 反射 tag)
- 日历 status 校验(create 补字段 + update 拦非法值)
- 新增 strictdecode_test.go 10 例 + blob/list_test.go 6 例

A-4 附件挂载回滚:checkAttachable 在 CreateMail 前校验,失败按
解挂→释放 relay→删邮件→退预算回滚,幽灵邮件这条路堵住了

A-5 反向 GC:blob.Store.List() 枚举磁盘(跳 .upload-*),
SweepUnreferencedBlobs 按 attachments + calendar_attachments 反查,
48h 年龄下限兜上传窗口。已接进每小时 sweep 循环

C 人/Agent 区分:四个读路径 + threadCols 补 from_human / to_human
(EXISTS users 判定),models.Mail 加 ToHuman。前端判据从
workspace 启发式改成显式布尔,mailCounterpart/sessionCounterpart
从 session_workspace 取 path(修 dsh@dsh 拼接 bug)

契约文档:SSE new_mail 补 4 字段(in_reply_to/from_human/
permission_mode/permission_enforcement),B-5 加 B-5.6
(Agent→Agent 不转发),B-3.4 MUST 改条件式,心跳补 mode_enforcement
+ unknown_fields,demo 死链修复 + from_human 检查
验收清单加 Agent→Agent 负向对照项
2026-09-06 15:18:06 +08:00

29 lines
916 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export declare const MAX_CATCHUP: number;
export interface CatchupEvent {
mail_id: string;
session_id: string;
from_name: string;
subject: string;
mail_type: string;
role: string;
to_workspace: string;
catchup: true;
}
export declare function mailToEvent(mail: any): CatchupEvent;
/**
* `seen` 只被用来做 `has()` 去重查询(见 lib/catchup.js
*
* 声明成结构类型而不是 `Set<string>`:调用方传的是 `BoundedSet`(有界去重表,
* 见 lib/bounded.js它故意只实现桥真正用到的方法 —— 不做 Set 的完整替身,
* 那样会掩盖「这张表是有界的」这个必须被看见的事实。把这里写成 `Set` 会逼着
* BoundedSet 去补 forEach/entries/keys 一堆没人调的成员。
*/
export declare function selectCatchup(
mails: any,
seen: { has(value: string): boolean } | undefined,
max?: number,
): CatchupEvent[];