refactor: rename project to MessageWeave

This commit is contained in:
anonsaber 2026-09-25 10:29:18 +08:00
parent 8c32892206
commit c75858fda0
12 changed files with 50 additions and 50 deletions

View File

@ -1,4 +1,4 @@
# stalwart-bot production bootstrap (C-REDIS-ONLY-STATE)
# MessageWeave production bootstrap (C-REDIS-ONLY-STATE)
#
# The process requires only this environment variable. Redis ACL credentials are
# both the application connection credential and the one-shot bootstrap trust root.

44
Cargo.lock generated
View File

@ -895,6 +895,28 @@ version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]]
name = "message-weave"
version = "0.1.0"
dependencies = [
"async-trait",
"axum",
"jmap-client",
"redis",
"reqwest",
"ring",
"secrecy",
"serde",
"serde_json",
"subtle",
"thiserror 1.0.69",
"tokio",
"tower",
"tracing",
"tracing-subscriber",
"url",
]
[[package]]
name = "mime"
version = "0.3.17"
@ -1523,28 +1545,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "stalwart-bot"
version = "0.1.0"
dependencies = [
"async-trait",
"axum",
"jmap-client",
"redis",
"reqwest",
"ring",
"secrecy",
"serde",
"serde_json",
"subtle",
"thiserror 1.0.69",
"tokio",
"tower",
"tracing",
"tracing-subscriber",
"url",
]
[[package]]
name = "subtle"
version = "2.6.1"

View File

@ -1,5 +1,5 @@
[package]
name = "stalwart-bot"
name = "message-weave"
version = "0.1.0"
edition = "2021"

View File

@ -11,10 +11,10 @@ FROM debian:bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install --no-install-recommends -y ca-certificates tini \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --create-home --home-dir /nonroot --shell /usr/sbin/nologin stalwart-bot
COPY --from=builder /build/target/release/stalwart-bot /usr/local/bin/stalwart-bot
USER stalwart-bot
&& useradd --system --create-home --home-dir /nonroot --shell /usr/sbin/nologin messageweave
COPY --from=builder /build/target/release/message-weave /usr/local/bin/message-weave
USER messageweave
ENV PORT=8080 \
RUN_MODE=webhook
EXPOSE 8080
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/stalwart-bot"]
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/message-weave"]

View File

@ -1,4 +1,4 @@
# stalwart-bot
# MessageWeave
一个把 **Stalwart 邮箱**接入 **Telegram** 的个人邮件助手:新邮件来了在 Telegram 提醒你,还能按需查看/总结邮件内容。

View File

@ -1,4 +1,4 @@
# Stalwart-bot Cloudflare Worker(ARCH-LB-WORKER)
# MessageWeave Cloudflare Worker(ARCH-LB-WORKER)
统一 HTTPS 入口 + 多后端 origin 故障转移(HA/LB 子项目)。
**透传模型**:Worker 不感知业务,原样转发请求到多个 https 后端 origin;仅「超时 / 5xx」做有界故障转移。
@ -96,6 +96,6 @@ npx wrangler deploy
健康探针:
```bash
curl https://lb.stalwart-bot.example/healthz
curl https://lb.messageweave.example/healthz
# => {"status":"ok","available":2,"total":2,"backends":[{"origin":"https://a.example","up":true,"status":200},...]}
```

View File

@ -1,9 +1,9 @@
{
"name": "@stalwart-bot/lb-worker",
"name": "@messageweave/lb-worker",
"version": "0.1.0",
"private": true,
"type": "module",
"description": "Stalwart-bot Cloudflare Worker: 统一 HTTPS 入口 + 多后端 origin 故障转移(透传模型,SAF-LB-PASSTHRU)。零运行时依赖(仅 ES2022 + Fetch API),可直接 node --test。",
"description": "MessageWeave Cloudflare Worker: 统一 HTTPS 入口 + 多后端 origin 故障转移(透传模型,SAF-LB-PASSTHRU)。零运行时依赖(仅 ES2022 + Fetch API),可直接 node --test。",
"scripts": {
"test": "node --test test/",
"check": "node --check src/*.js && node --check test/*.test.js && wrangler deploy --dry-run --outdir=.build-check",

View File

@ -1,5 +1,5 @@
/**
* Cloudflare Worker 入口 — Stalwart-bot 多实例 LB/HA(ARCH-LB-WORKER / deployment.md §10)。
* Cloudflare Worker 入口 — MessageWeave 多实例 LB/HA(ARCH-LB-WORKER / deployment.md §10)。
*
* 稳定 ID(AGENTS.md §5/§7):
* - SAF-LB-PASSTHRU:透传 headers/body(含鉴权头),不做鉴权改写。

View File

@ -1,5 +1,5 @@
/**
* Wrangler 示例配置 — Stalwart-bot 多实例 LB/HA(ARCH-LB-WORKER / deployment.md §10)。
* Wrangler 示例配置 — MessageWeave 多实例 LB/HA(ARCH-LB-WORKER / deployment.md §10)。
*
* 安全约束(AGENTS.md §2/§4,稳定 ID):
* - 后端 origin 仅允许 https(C-HTTPS-INBOUND / C-HTTPS-URL);env 校验时拒绝
@ -16,7 +16,7 @@
* npx wrangler secret put BACKEND_ORIGINS_JSON # 见下方示例格式
* npx wrangler deploy
*/
name = "stalwart-bot-lb"
name = "messageweave-lb"
main = "src/index.js"
compatibility_date = "2025-01-01"
compatibility_flags = ["nodejs_compat_v2"]

View File

@ -1,4 +1,4 @@
# Stalwart-bot 部署方案(通用 HTTPS-only Docker)
# MessageWeave 部署方案(通用 HTTPS-only Docker)
> 部署目标:**通用 Docker 容器平台**(任何能跑 Docker 的 VPS / 云主机 / k8s / 自托管容器平台),
> **不绑定** Cloud Run / Lambda / CF Workers / Deno Deploy 等任何具体平台(`NG-SERVERLESS-BIND`)。
@ -58,7 +58,7 @@
## 3. Rust 多阶段构建与运行
### 3.1 构建阶段
(保留既有 rust:bookworm 构建 + 缓存分层约定;产物为单个静态编译二进制 `stalwart-bot`)
(保留既有 rust:bookworm 构建 + 缓存分层约定;产物为单个静态编译二进制 `message-weave`)
> **实现现状**(阶段0 + 阶段1,`ARCH-STAGE0`/`ARCH-DEPS-STAGE0`/`ARCH-DEPS-STAGE1`):自动依赖含 `axum 0.8`(单端口入口)/`serde`/`serde_json`/`thiserror`/`secrecy`/`subtle`(常数时间比较)/`url`/`tokio`/`tracing` 等;**`jmap-client =0.4.2` 已引入**(阶段1,`default-features=false, features=["async","rustls"]`,**禁用 WebSocket feature**,`C-NO-LONG-CONN`);三条入口路由的鉴权已 fail-closed 落地(`R1`/`SAF-AUTH-*`),**JMAP 只读 adapter(G1/D-G1-1)代码已实现、待真实 `cargo test -- --ignored jmap::` 验证**,其余业务体仍为**占位**;`teloxide`(阶段2)/`redis`(阶段3/4)/`reqwest`(阶段3.5) 尚未引入;配置为环境变量手工解析(`ARCH-CONFIG-ENV`,无 figment/TOML)。CI 门禁见 §8(`cargo fmt --check`、`cargo clippy --all-targets -- -D warnings`、`cargo test`,在 Debian 容器内,`GATE-P0`)。
@ -150,8 +150,8 @@ TLS 必须由 Cloudflare 或受信任反向代理终结;代理到容器的链
| RUN_MODE | 命令 | 说明 |
|---|---|---|
| `webhook`(默认) | `stalwart-bot webhook`(或单一入口按 env 分派) | 单进程:TG Webhook handler + JMAP Push 回调 handler + Redis Streams worker + `/reconcile` + health |
| `reconcile` | `stalwart-bot reconcile` | 一次性对账补差后 exit,由外部调度器/容器任务触发 |
| `webhook`(默认) | `message-weave webhook`(或单一入口按 env 分派) | 单进程:TG Webhook handler + JMAP Push 回调 handler + Redis Streams worker + `/reconcile` + health |
| `reconcile` | `message-weave reconcile` | 一次性对账补差后 exit,由外部调度器/容器任务触发 |
### 6.1 入口路由(单端口 `PORT`,全部经平台 HTTPS URL 入站)
```
@ -237,7 +237,7 @@ GET /ready ⚠️ 阶段0 为**占位 200**(ARCH-READY-PLACEHOLDER
```yaml
services:
bot:
image: stalwart-bot:latest
image: messageweave:latest
ports:
- "8080:8080" # 平台 ingress/反代映射 HTTPS → 8080(C-HTTPS-INBOUND)
environment:
@ -245,7 +245,7 @@ services:
RUN_MODE: webhook
# BOT_TOKEN / JMAP_* / CHAT_ALLOWLIST / REDIS_URL
# RECONCILE_TOKEN / TG_WEBHOOK_SECRET / JMAP_PUSH_VERIFICATION(三入口鉴权,均为必填 SAF-AUTH-*)
healthcheck: { test: ["CMD", "stalwart-bot", "health", "--addr", "127.0.0.1:8080"], interval: 30s }
healthcheck: { test: ["CMD", "message-weave", "health", "--addr", "127.0.0.1:8080"], interval: 30s }
# REDIS_URL 指向外部、已认证的 Redis;不在此 compose 中运行 Redis。
```
@ -393,8 +393,8 @@ npx wrangler secret put LB_HEALTH_TTL_MS # 默认 30000ms
```json
[
{"url":"https://stalwart-bot-a.example.com","weight":100},
{"url":"https://stalwart-bot-b.example.com","weight":100}
{"url":"https://messageweave-a.example.com","weight":100},
{"url":"https://messageweave-b.example.com","weight":100}
]
```

View File

@ -1,7 +1,7 @@
# Stalwart JMAP ↔ Telegram Bot — Rust 方案设计
> 状态:**调研与方案设计**(未写代码)
> 作者:Cowork(team: stalwart-bot)
> 作者:Cowork(team: MessageWeave)
> 日期:2026-09-21
> 目标读者:Codex CLI(lead)、后续 AI coding agent、最终用户评审
>
@ -258,7 +258,7 @@ teloxide = { version = "0.17", features = [
- **不做什么**:不定义多态配置注册表、不预先抽象"渠道能力矩阵"、不建 plugins 机制;按需再演进(YAGNI)。
### 5.3 运行模型(短请求,无长连接)
- 单一二进制 `stalwart-bot`,`#[tokio::main]`。
- 单一二进制 `message-weave`,`#[tokio::main]`。
- 启动时:
1. 加载配置(`config::Config`)。
2. 构造 `JmapService`(`Client::connect` 完成 session 解析、account_id 缓存、mailbox role→id 映射预热);sinceState 从外部 Redis 恢复(`MOD-SINCESTATE`)。

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light" />
<meta name="referrer" content="no-referrer" />
<title>业务配置 · Stalwart Bot</title>
<title>业务配置 · MessageWeave</title>
<link rel="stylesheet" href="/assets/styles.css" />
<script src="/assets/config.js" defer></script>
</head>
@ -14,9 +14,9 @@
<div class="ambient ambient-two" aria-hidden="true"></div>
<header class="topbar">
<a class="brand" href="/" aria-label="Stalwart Bot 配置首页">
<a class="brand" href="/" aria-label="MessageWeave 配置首页">
<span class="brand-mark" aria-hidden="true">S</span>
<span class="brand-copy"><strong>stalwart bot</strong><span>业务配置</span></span>
<span class="brand-copy"><strong>MessageWeave</strong><span>业务配置</span></span>
</a>
<span class="topbar-note"><span class="secure-dot"></span>安全配置通道</span>
</header>
@ -156,6 +156,6 @@
<aside id="privacy-note" class="privacy-note" hidden><span class="privacy-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 3 5 6v5c0 4.5 2.8 8 7 10 4.2-2 7-5.5 7-10V6l-7-3Z"/><path d="m9 12 2 2 4-4"/></svg></span><p><strong>密钥不会回显或持久化到浏览器。</strong>业务配置只提交至同源 API,并由后端加密写入 Redis;本页面不读取邮箱内容、不使用本地文件或数据库。</p></aside>
</main>
<footer class="footer"><span>STALWART BOT</span><span>配置由你的服务端管理</span></footer>
<footer class="footer"><span>MessageWeave</span><span>配置由你的服务端管理</span></footer>
</body>
</html>