@abraca/resend 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/abracadabra-resend.cjs +1674 -0
- package/dist/abracadabra-resend.cjs.map +1 -0
- package/dist/abracadabra-resend.esm.js +1638 -0
- package/dist/abracadabra-resend.esm.js.map +1 -0
- package/dist/index.d.ts +140 -0
- package/package.json +42 -0
- package/src/bootstrap.ts +182 -0
- package/src/crypto.ts +72 -0
- package/src/inbound-server.ts +413 -0
- package/src/index.ts +128 -0
- package/src/outbox-watcher.ts +283 -0
- package/src/render.ts +112 -0
- package/src/resend-client.ts +50 -0
- package/src/server.ts +322 -0
- package/src/utils.ts +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @abraca/resend
|
|
2
|
+
|
|
3
|
+
Resend bridge for Abracadabra. Bind it to a Space and it bootstraps two top-level
|
|
4
|
+
documents:
|
|
5
|
+
|
|
6
|
+
- **Outbox** — a kanban with `Draft → Ready → Sent → Failed`. Move a draft card
|
|
7
|
+
into **Ready** and it gets rendered to HTML and sent via Resend, then auto-moved
|
|
8
|
+
to **Sent** (or **Failed** with the error attached).
|
|
9
|
+
- **Inbox** — receives email landed by Resend Inbound. Each incoming message
|
|
10
|
+
becomes a child document whose label is the subject and whose body is the
|
|
11
|
+
email content; sender / recipients / message-id are stored in `meta`.
|
|
12
|
+
|
|
13
|
+
Identity is an Ed25519 key (auto-generated on first run; same shape as
|
|
14
|
+
`@abraca/mcp`). The process exposes a small HTTP server for the Resend Inbound
|
|
15
|
+
webhook; the operator is responsible for making the port reachable (tunnel /
|
|
16
|
+
reverse proxy) and pointing Resend at it.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add -g @abraca/resend
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Environment
|
|
25
|
+
|
|
26
|
+
| Var | Required | Default | Notes |
|
|
27
|
+
|---|---|---|---|
|
|
28
|
+
| `ABRA_URL` | yes | — | Abracadabra server URL |
|
|
29
|
+
| `ABRA_SPACE_ID` | no | first visible space | Which space to bind |
|
|
30
|
+
| `ABRA_KEY_FILE` | no | `~/.abracadabra/resend.key` | Ed25519 seed |
|
|
31
|
+
| `ABRA_INVITE_CODE` | no | — | Used only on first-run register |
|
|
32
|
+
| `ABRA_AGENT_NAME` | no | `Resend Bridge` | Presence display name |
|
|
33
|
+
| `RESEND_API_KEY` | yes | — | |
|
|
34
|
+
| `RESEND_FROM` | yes | — | Default `from` address |
|
|
35
|
+
| `RESEND_INBOUND_ENABLED` | no | `true` | Set `false` to skip the webhook server |
|
|
36
|
+
| `RESEND_INBOUND_PORT` | no | `0` (ephemeral) | Bind port for `/inbound` |
|
|
37
|
+
| `RESEND_INBOUND_HOST` | no | `0.0.0.0` | Bind host |
|
|
38
|
+
| `RESEND_INBOUND_SECRET` | required if inbound enabled | — | Svix signing secret from Resend dashboard |
|
|
39
|
+
|
|
40
|
+
## Outbox doc conventions
|
|
41
|
+
|
|
42
|
+
A doc in the Outbox carries its addressing in `meta`:
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
to: ["alice@example.com"]
|
|
46
|
+
cc: ["bob@example.com"]
|
|
47
|
+
bcc: []
|
|
48
|
+
subject: "Project kickoff" # falls back to the doc's label
|
|
49
|
+
from: "team@yours.com" # falls back to RESEND_FROM
|
|
50
|
+
replyTo: "team@yours.com"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
When the doc is moved into the `Ready` column, the watcher renders its body to
|
|
54
|
+
HTML via `@abraca/convert` and sends. On success, `meta.resendId` and
|
|
55
|
+
`meta.sentAt` are written and the doc is moved to `Sent`. On failure, `meta.error`
|
|
56
|
+
+ `meta.errorAt` are written and the doc is moved to `Failed`.
|
|
57
|
+
|
|
58
|
+
Sends are idempotent: if `meta.resendId` is already set, the doc is left alone.
|
|
59
|
+
|
|
60
|
+
## Inbox doc conventions
|
|
61
|
+
|
|
62
|
+
Each inbound message is created under Inbox with:
|
|
63
|
+
|
|
64
|
+
- `label` = subject (or `"(no subject)"`)
|
|
65
|
+
- body = email plain-text (markdown-shaped)
|
|
66
|
+
- `meta.from`, `meta.to`, `meta.cc`, `meta.subject`, `meta.receivedAt`,
|
|
67
|
+
`meta.messageId`, `meta.inReplyTo`
|
|
68
|
+
- attachments uploaded via the REST API; their handles land in `meta.attachments[]`
|
|
69
|
+
|
|
70
|
+
## Run
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
ABRA_URL=https://your-server \
|
|
74
|
+
RESEND_API_KEY=re_xxx \
|
|
75
|
+
RESEND_FROM=team@yours.com \
|
|
76
|
+
RESEND_INBOUND_SECRET=whsec_xxx \
|
|
77
|
+
RESEND_INBOUND_PORT=8787 \
|
|
78
|
+
abracadabra-resend
|
|
79
|
+
```
|