@aimail/mail-core (中文(简体) )
TypeScript 的框架不可知AIMail核心:网关客户端,工具,完整
输入预处理链,以及 agentmail.json 读/写。 直接导入
从任何 TS 代理运行时间( dsh, OpenClaw, pi, 或您自己的) .
安装
pnpm add @aimail/mail-core
点 AIMAIL_HOME (默认) ~/.aimail),按地址排列
agentmail.json 捆绑现场.
它会做什么
GatewayClient——认证的网关 HTTP 客户端(发送/上传/下载/) 白列表 / 联系人 / 代理状态 / 线程 / 板 ; 外出请求 页:1X-AIMail-Agent头和 V1 HMAC 签名 .- 工具 - 发送、联系人、联系人简介、电子邮件摘要、搜索和董事会
API, 通过曝光
MAIL_TOOLS: 名称、描述、类型框参数 形状和处理器在一个阵列中. - 入境——
processInboundMail运行共享预处理链(接收和 发送器浓缩、人员正常化、DM/minion检测、附件 a. 下载、入境记录和拦截乒乓球探测器;verifySignature检查Webhook HMAC. - 配置 -
loadConfigByEmail编号 :loadConfigByAgentId编号 :loadConfigBySessionId, (中文(简体) ),saveAgentConfig, (中文(简体) ),updateAgentConfig。每个地址agentmail.json这是 只有身份来源. - 身份 -
setAgentIdentity编号 :setAgentModel设定X-AIMail-Agent(单位:千美元){platform}/{version}+{model}) (中文(简体) ).
使用量
import { sendMail, processInboundMail, verifySignature, MAIL_TOOLS } from '@aimail/mail-core'
const result = await sendMail({ systemId, email }, { to, subject, body })
if (verifySignature(rawBody, sig, webhookSecret)) {
const enriched = await processInboundMail(payload, headers, { systemId, email })
// null = ping/pong already answered in place; otherwise hand it to the agent
}
for (const tool of MAIL_TOOLS) { /* bind name / description / params / handler */ }
相关
- @aimail/邮件 ——配置解析帮助.
- 双管单管 ——CLI,Python SDK,适配器.