@openmail/openclaw 0.1.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/LICENSE +9 -0
- package/README.md +217 -0
- package/dist/accounts.js +87 -0
- package/dist/accounts.js.map +1 -0
- package/dist/channel.js +147 -0
- package/dist/channel.js.map +1 -0
- package/dist/cli.js +89 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-schema.js +52 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/gateway.js +258 -0
- package/dist/gateway.js.map +1 -0
- package/dist/inbound.js +298 -0
- package/dist/inbound.js.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/ingress.js +189 -0
- package/dist/ingress.js.map +1 -0
- package/dist/media.js +63 -0
- package/dist/media.js.map +1 -0
- package/dist/openmail-api.js +215 -0
- package/dist/openmail-api.js.map +1 -0
- package/dist/runtime.js +11 -0
- package/dist/runtime.js.map +1 -0
- package/dist/secret-contract.js +28 -0
- package/dist/secret-contract.js.map +1 -0
- package/dist/setup-entry.js +6 -0
- package/dist/setup-entry.js.map +1 -0
- package/dist/setup.js +315 -0
- package/dist/setup.js.map +1 -0
- package/openclaw.plugin.json +412 -0
- package/package.json +143 -0
- package/skills/openmail/SKILL.md +143 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenMail
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# @openmail/openclaw
|
|
2
|
+
|
|
3
|
+
An email address for your [OpenClaw](https://openclaw.ai) agent.
|
|
4
|
+
|
|
5
|
+
Mail to `sales@omail.sh` reaches the agent as a conversation with the sender,
|
|
6
|
+
and whatever it writes back goes out in the same thread. Notifications and
|
|
7
|
+
newsletters are announced rather than answered. The agent can also read
|
|
8
|
+
attachments, start new threads, and create more inboxes, all through the
|
|
9
|
+
gateway you already run.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
openclaw plugins install @openmail/openclaw
|
|
15
|
+
openclaw channels add --channel openmail --api-key <key>
|
|
16
|
+
openclaw gateway restart
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Keys come from the [console](https://console.openmail.sh/api-keys) or the
|
|
20
|
+
[OpenMail CLI](https://github.com/openmailsh/cli) (`openmail inbox keys create`).
|
|
21
|
+
|
|
22
|
+
Reinstalling after an uninstall? OpenClaw keeps the plugin disabled; run
|
|
23
|
+
`openclaw plugins enable openmail` first or `channels add` reports
|
|
24
|
+
`Unknown channel "openmail"`.
|
|
25
|
+
|
|
26
|
+
## What `channels add` does with the key
|
|
27
|
+
|
|
28
|
+
| You pass | Result |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| an inbox-scoped key | stored as-is; that inbox is the channel |
|
|
31
|
+
| an account or pod key | picks your inbox (creates one if you have none), mints an inbox-scoped key for it and stores only that. The broad key never touches `openclaw.json`. |
|
|
32
|
+
| `--mailbox-name sales` | creates `sales@omail.sh`; `--display-name "Sales bot"` sets the sender name |
|
|
33
|
+
| `--inbox-id <id>` | uses that inbox; needed when the key can see several |
|
|
34
|
+
| `--pod <id\|name>` | one account for a whole pod, see [Several inboxes](#several-inboxes) |
|
|
35
|
+
| `--mode notify` / `--mode tool` | how inbound mail reaches the agent, see [Modes](#modes) |
|
|
36
|
+
|
|
37
|
+
## Several inboxes
|
|
38
|
+
|
|
39
|
+
**One account per inbox.** Each has its own key, websocket and status line,
|
|
40
|
+
and can be bound to a different agent:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
openclaw channels add --channel openmail --account support --api-key <key> --mailbox-name support
|
|
44
|
+
openclaw channels add --channel openmail --account sales --api-key <key> --mailbox-name sales
|
|
45
|
+
openclaw channels status
|
|
46
|
+
# - OpenMail support: enabled, configured, running, connected
|
|
47
|
+
# - OpenMail sales: enabled, configured, running, connected
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**One account per pod.** A [pod](https://console.openmail.sh/pods) is an
|
|
51
|
+
OpenMail group of inboxes. The account holds a pod-scoped key and covers every
|
|
52
|
+
inbox in the pod, including ones the agent creates later:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
openclaw channels add --channel openmail --account outreach --api-key <account key> --pod outreach
|
|
56
|
+
# Minted a pod-scoped API key for outreach (pod_…), 2 inbox(es); the account key you passed is not stored.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
At runtime the agent, or a subagent it hands an inbox id to, can:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
openclaw openmail --account outreach -- inbox create --mailbox-name outreach-3
|
|
63
|
+
openclaw openmail --account outreach -- send --inbox-id <id> --thread-id <thr> --to … --body …
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A new inbox streams mail within a minute; the gateway re-subscribes on a
|
|
67
|
+
timer. Each `(inbox, sender)` pair is its own conversation and replies leave
|
|
68
|
+
from the inbox that received the mail. Inboxes inherit the account's `mode`
|
|
69
|
+
unless overridden by address or id:
|
|
70
|
+
|
|
71
|
+
```json5
|
|
72
|
+
"inboxes": {
|
|
73
|
+
"support@omail.sh": { "mode": "channel" },
|
|
74
|
+
"me@omail.sh": { "mode": "notify" },
|
|
75
|
+
"signups@omail.sh": { "mode": "tool" } // inbound ignored; CLI only
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The trade-off: a pod key reads every inbox in the pod, not one.
|
|
80
|
+
|
|
81
|
+
## Modes
|
|
82
|
+
|
|
83
|
+
Set per account with `--mode` or `channels.openmail.mode`.
|
|
84
|
+
|
|
85
|
+
| Mode | Inbound mail | Who replies |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `channel` (default) | wakes the agent as a conversation with the sender | the agent, in-thread |
|
|
88
|
+
| `notify` | the agent tells you on your usual chat (WhatsApp, Telegram…) | you, by asking the agent |
|
|
89
|
+
| `tool` | ignored; no websocket | nobody unless you ask; email is a skill the agent has |
|
|
90
|
+
|
|
91
|
+
`channel` is for an inbox that *is* the agent (support@, sales@). `notify` is
|
|
92
|
+
for your own inbox: "Stripe says your card expires Friday", and the agent only
|
|
93
|
+
writes to Stripe if you tell it to. `tool` is for "sign up for X and tell me
|
|
94
|
+
the code", where the agent polls the inbox itself via the CLI.
|
|
95
|
+
|
|
96
|
+
### Only people get an automatic reply
|
|
97
|
+
|
|
98
|
+
OpenMail classifies each inbound mail on the server: `personal`, `automated`,
|
|
99
|
+
`marketing`, `bounce`, `spam` or `malicious`. In `channel` mode only
|
|
100
|
+
`personal` mail opens a reply turn. A GitHub notification, a verification
|
|
101
|
+
code or a newsletter is handed to the agent as information, the way `notify`
|
|
102
|
+
delivers everything; the agent learns the code arrived and doesn't email
|
|
103
|
+
`noreply@` back. Spam and malicious mail is dropped in every mode with one log
|
|
104
|
+
line. Mail the classifier predates keeps the plain `channel` behaviour.
|
|
105
|
+
|
|
106
|
+
In production this is 70% of inbound.
|
|
107
|
+
|
|
108
|
+
## Security defaults
|
|
109
|
+
|
|
110
|
+
Email is the widest prompt-injection surface an agent has, and the inbox has
|
|
111
|
+
to stay open because an agent that signs up for things must receive mail from
|
|
112
|
+
strangers. So the defences are on what the agent can do, not on who can write.
|
|
113
|
+
|
|
114
|
+
- **Sender rules live in OpenMail.** Who may email an inbox is decided by
|
|
115
|
+
OpenMail's allow/block policy
|
|
116
|
+
([console](https://console.openmail.sh/sender-rules) or `openmail policy …`)
|
|
117
|
+
before delivery. The plugin keeps no second list.
|
|
118
|
+
- **Narrow key.** An inbox account stores an inbox-scoped key; it can't list
|
|
119
|
+
other inboxes, mint keys or change policy. A pod account stores a pod key.
|
|
120
|
+
- **Re-authorized replies.** The websocket frame is a hint. Before the agent
|
|
121
|
+
sees anything, the message is fetched again from the API and the reply goes
|
|
122
|
+
to the API's `From`, so a forged frame can't redirect it.
|
|
123
|
+
- **Nothing dropped silently.** Installed from npm, events pass through
|
|
124
|
+
OpenClaw's durable ingress queue: deduped by `event_id`, written to disk
|
|
125
|
+
before the agent runs, retried with backoff, dead-lettered instead of lost.
|
|
126
|
+
A path-linked dev install retries in memory (2s, 10s, 30s). Both persist
|
|
127
|
+
the cursor, so a gateway restart replays whatever arrived while it was down.
|
|
128
|
+
|
|
129
|
+
## The bundled CLI skill
|
|
130
|
+
|
|
131
|
+
The plugin ships the OpenMail CLI plus a skill that teaches the agent to use
|
|
132
|
+
it with the channel's credentials:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
openclaw openmail -- threads get --thread-id <id> --json
|
|
136
|
+
openclaw openmail -- attachments text --message-id <id> --filename report.pdf
|
|
137
|
+
openclaw openmail --account sales -- send --to a@b.com --thread-id <id> --body "..."
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Credentials come from the channel config only. `--api-key`, `--base-url` and
|
|
141
|
+
`--state-path` are rejected; proxy env vars are stripped.
|
|
142
|
+
|
|
143
|
+
## Attachments
|
|
144
|
+
|
|
145
|
+
1. **Extracted text, inline.** OpenMail parses PDF, DOCX, XLSX, PPTX, CSV and
|
|
146
|
+
images (OCR) server-side. That text is appended to the notification, capped
|
|
147
|
+
at 8k chars per file and 24k in total.
|
|
148
|
+
2. **Staged files.** Anything without extracted text is downloaded into
|
|
149
|
+
OpenClaw's media store and passed as `MediaPaths`, so a vision model sees
|
|
150
|
+
the picture. `mediaMaxMb` caps the total per email (default 20, `0`
|
|
151
|
+
disables); oversized files are skipped and named.
|
|
152
|
+
3. **The CLI.** For the rest, the notification says exactly what to run.
|
|
153
|
+
|
|
154
|
+
## Behaviour
|
|
155
|
+
|
|
156
|
+
- One conversation per sender address, like a WhatsApp contact, so the agent
|
|
157
|
+
keeps history per correspondent.
|
|
158
|
+
- The agent sees `From / To / Subject / Thread / Attachments` then the
|
|
159
|
+
plain-text body. Email is untrusted input; say so in the system prompt.
|
|
160
|
+
- Replies use `POST /v1/inboxes/{id}/send` with the thread id and land
|
|
161
|
+
in-thread with a `Re:` subject and the original quoted.
|
|
162
|
+
- New threads: `openclaw message send --channel openmail --to a@b.com "…"`
|
|
163
|
+
(first line becomes the subject) or the CLI `send`. Outbound allow/block
|
|
164
|
+
rules, if you want them, live in OpenMail (`openmail policy … --direction outbound`).
|
|
165
|
+
- Mail from one sender is processed in order; different senders run in parallel.
|
|
166
|
+
|
|
167
|
+
## Config
|
|
168
|
+
|
|
169
|
+
```json5
|
|
170
|
+
{
|
|
171
|
+
"channels": {
|
|
172
|
+
"openmail": {
|
|
173
|
+
"apiKey": "om_…", // inbox-scoped, or a SecretRef (below)
|
|
174
|
+
"inboxId": "…", // or "podId" for a whole pod
|
|
175
|
+
"mode": "channel", // "notify" | "tool"; pod accounts may override per inbox (above)
|
|
176
|
+
"mediaMaxMb": 20,
|
|
177
|
+
"accounts": {
|
|
178
|
+
"sales": {
|
|
179
|
+
"apiKey": { "source": "env", "provider": "default", "id": "OPENMAIL_SALES_KEY" },
|
|
180
|
+
"inboxId": "…"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`apiKey` accepts OpenClaw SecretRefs (`env`, `file`, `exec`, `store`); the
|
|
189
|
+
host resolves them before the channel starts, so the key never sits in
|
|
190
|
+
`openclaw.json`. There are no `OPENMAIL_*` env fallbacks.
|
|
191
|
+
|
|
192
|
+
## Known gaps
|
|
193
|
+
|
|
194
|
+
- No pairing flow for unknown senders; use OpenMail's policy instead.
|
|
195
|
+
- If the config write fails after a key was minted, the key is left behind.
|
|
196
|
+
Harmless (10-key cap per inbox) and visible under
|
|
197
|
+
[API keys](https://console.openmail.sh/api-keys).
|
|
198
|
+
|
|
199
|
+
## Develop
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pnpm install
|
|
203
|
+
pnpm build # tsc; needs NODE_OPTIONS=--max-old-space-size=12288 (SDK types are large)
|
|
204
|
+
pnpm test # vitest: provisioning, re-auth, classification, ingress, CLI guards
|
|
205
|
+
pnpm manifest # regenerate openclaw.plugin.json + package.json#openclaw from src
|
|
206
|
+
pnpm validate-plugin # install into a throwaway OpenClaw host and assert it loads
|
|
207
|
+
pnpm check # all of the above; runs on publish and in CI
|
|
208
|
+
openclaw plugins install --link --force --accept-capabilities .
|
|
209
|
+
openclaw gateway restart
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
`openclaw.plugin.json` and the `openclaw` block of `package.json` are
|
|
213
|
+
generated from `src/config-schema.ts` and `src/setup.ts`. Edit those, then run
|
|
214
|
+
`pnpm manifest`; CI fails on a stale manifest.
|
|
215
|
+
|
|
216
|
+
Compiles against `openclaw@2026.9.2` (pinned in `devDependencies`); the
|
|
217
|
+
generated `compat` and `install.minHostVersion` follow that pin.
|
package/dist/accounts.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Account resolution. An OpenClaw "account" is either one OpenMail inbox
|
|
2
|
+
// (inboxId + inbox-scoped key) or a whole pod (podId + pod-scoped key): every
|
|
3
|
+
// inbox in the pod, including ones created later, flows through one account.
|
|
4
|
+
import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
|
|
5
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
|
+
import { hasConfiguredSecretInput, normalizeResolvedSecretInputString, } from "openclaw/plugin-sdk/secret-input";
|
|
7
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
+
export const OPENMAIL_CHANNEL_ID = "openmail";
|
|
9
|
+
export const DEFAULT_BASE_URL = "https://api.openmail.sh";
|
|
10
|
+
/** Aggregate size of inbound attachments staged for the agent per message. */
|
|
11
|
+
export const DEFAULT_MEDIA_MAX_MB = 20;
|
|
12
|
+
/**
|
|
13
|
+
* channel inbound mail wakes the agent, it replies in-thread (default)
|
|
14
|
+
* notify inbound mail is summarised to you on your main chat; no auto-reply
|
|
15
|
+
* tool nothing inbound; the agent only uses email when you ask (CLI skill)
|
|
16
|
+
*/
|
|
17
|
+
export const OPENMAIL_MODES = ["channel", "notify", "tool"];
|
|
18
|
+
function normalizeMode(value) {
|
|
19
|
+
return OPENMAIL_MODES.includes(value) ? value : undefined;
|
|
20
|
+
}
|
|
21
|
+
/** The mode governing one inbox: an override by id, then by address, else the account's. */
|
|
22
|
+
export function resolveInboxMode(account, inbox) {
|
|
23
|
+
const override = account.inboxes[inbox.id] ??
|
|
24
|
+
(inbox.address ? account.inboxes[inbox.address.trim().toLowerCase()] : undefined);
|
|
25
|
+
return normalizeMode(override?.mode) ?? account.mode;
|
|
26
|
+
}
|
|
27
|
+
const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMergedAccountConfig, } = createAccountListHelpers(OPENMAIL_CHANNEL_ID, {
|
|
28
|
+
normalizeAccountId,
|
|
29
|
+
omitKeys: ["defaultAccount"],
|
|
30
|
+
implicitDefaultAccount: {
|
|
31
|
+
channelKeys: ["apiKey", "inboxId", "podId"],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const listOpenMailAccountIds = listAccountIds;
|
|
35
|
+
export const resolveDefaultOpenMailAccountId = resolveDefaultAccountId;
|
|
36
|
+
function channelConfig(cfg) {
|
|
37
|
+
return cfg.channels?.[OPENMAIL_CHANNEL_ID];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Literal string, or a SecretRef the host has already materialised. A ref
|
|
41
|
+
* that is still unresolved throws with the config path, which is what we want
|
|
42
|
+
* at gateway start: a loud "secret not available" beats a silent 401.
|
|
43
|
+
* No env fallback: `{ source: "env", id: "..." }` is the supported way.
|
|
44
|
+
*/
|
|
45
|
+
function resolveApiKey(value, path) {
|
|
46
|
+
const present = value !== undefined && value !== null && !(typeof value === "string" && value.trim() === "");
|
|
47
|
+
return present ? (normalizeResolvedSecretInputString({ value, path }) ?? null) : null;
|
|
48
|
+
}
|
|
49
|
+
export function resolveOpenMailAccount(params) {
|
|
50
|
+
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultOpenMailAccountId(params.cfg));
|
|
51
|
+
const channel = channelConfig(params.cfg);
|
|
52
|
+
const merged = resolveMergedAccountConfig(params.cfg, accountId);
|
|
53
|
+
const isDefault = accountId === DEFAULT_ACCOUNT_ID;
|
|
54
|
+
const apiKeyPath = isDefault && !channel?.accounts?.[accountId]
|
|
55
|
+
? "channels.openmail.apiKey"
|
|
56
|
+
: `channels.openmail.accounts.${accountId}.apiKey`;
|
|
57
|
+
const apiKey = resolveApiKey(merged.apiKey, apiKeyPath);
|
|
58
|
+
const inboxId = normalizeOptionalString(merged.inboxId) ?? null;
|
|
59
|
+
const podId = normalizeOptionalString(merged.podId) ?? null;
|
|
60
|
+
// Named accounts inherit root fields, so a pod account under a root inbox
|
|
61
|
+
// (or vice versa) sees both ids. The account's own entry decides; the
|
|
62
|
+
// narrower inbox claim wins only when the account itself set neither.
|
|
63
|
+
const own = (channel?.accounts?.[accountId] ?? (isDefault ? channel : undefined)) ?? {};
|
|
64
|
+
const ownInbox = normalizeOptionalString(own.inboxId);
|
|
65
|
+
const ownPod = normalizeOptionalString(own.podId);
|
|
66
|
+
const scope = ownInbox ? "inbox" : ownPod ? "pod" : inboxId ? "inbox" : podId ? "pod" : "inbox";
|
|
67
|
+
const baseUrl = (normalizeOptionalString(merged.baseUrl) ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
68
|
+
const mediaMaxMb = typeof merged.mediaMaxMb === "number" && Number.isFinite(merged.mediaMaxMb) && merged.mediaMaxMb >= 0
|
|
69
|
+
? merged.mediaMaxMb
|
|
70
|
+
: DEFAULT_MEDIA_MAX_MB;
|
|
71
|
+
return {
|
|
72
|
+
accountId,
|
|
73
|
+
name: normalizeOptionalString(merged.name),
|
|
74
|
+
enabled: channel?.enabled !== false && merged.enabled !== false,
|
|
75
|
+
// A SecretRef counts as configured even before the host resolves it.
|
|
76
|
+
configured: Boolean((apiKey || hasConfiguredSecretInput(merged.apiKey)) && (inboxId || podId)),
|
|
77
|
+
apiKey,
|
|
78
|
+
scope,
|
|
79
|
+
inboxId: scope === "inbox" ? inboxId : null,
|
|
80
|
+
podId: scope === "pod" ? podId : null,
|
|
81
|
+
baseUrl,
|
|
82
|
+
mode: normalizeMode(merged.mode) ?? "channel",
|
|
83
|
+
mediaMaxMb,
|
|
84
|
+
inboxes: Object.fromEntries(Object.entries(merged.inboxes ?? {}).map(([k, v]) => [k.includes("@") ? k.trim().toLowerCase() : k, v])),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,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O,KAAK,KAAK;QAC/D,qEAAqE;QACrE,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,IAAI,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC;QAC9F,MAAM;QACN,KAAK;QACL,OAAO,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QAC3C,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QACrC,OAAO;QACP,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,SAAS;QAC7C,UAAU;QACV,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACxG;KACF,CAAC;AACJ,CAAC"}
|
package/dist/channel.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Full channel plugin: setup surface + status + gateway lifecycle + outbound.
|
|
2
|
+
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
3
|
+
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
4
|
+
import { buildBaseChannelStatusSummary, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, } from "openclaw/plugin-sdk/status-helpers";
|
|
5
|
+
import { listOpenMailAccountIds, OPENMAIL_CHANNEL_ID, resolveDefaultOpenMailAccountId, resolveOpenMailAccount, } from "./accounts.js";
|
|
6
|
+
import { openmailChannelConfigSchema } from "./config-schema.js";
|
|
7
|
+
import { startOpenMailGatewayAccount } from "./gateway.js";
|
|
8
|
+
import { OpenMailApi } from "./openmail-api.js";
|
|
9
|
+
import { collectRuntimeConfigAssignments, secretTargetRegistryEntries } from "./secret-contract.js";
|
|
10
|
+
import { OPENMAIL_META, openmailSetupPlugin } from "./setup.js";
|
|
11
|
+
function stripPrefix(to) {
|
|
12
|
+
return to.replace(/^(openmail|email|mail):/i, "").trim();
|
|
13
|
+
}
|
|
14
|
+
export const openmailPlugin = createChatChannelPlugin({
|
|
15
|
+
base: {
|
|
16
|
+
id: OPENMAIL_CHANNEL_ID,
|
|
17
|
+
meta: OPENMAIL_META,
|
|
18
|
+
capabilities: { chatTypes: ["direct"], threads: true },
|
|
19
|
+
setupContract: openmailSetupPlugin.setupContract,
|
|
20
|
+
setupWizard: openmailSetupPlugin.setupWizard,
|
|
21
|
+
reload: { configPrefixes: ["channels.openmail"] },
|
|
22
|
+
configSchema: openmailChannelConfigSchema,
|
|
23
|
+
config: {
|
|
24
|
+
listAccountIds: listOpenMailAccountIds,
|
|
25
|
+
resolveAccount: (cfg, accountId) => resolveOpenMailAccount({ cfg, accountId }),
|
|
26
|
+
defaultAccountId: resolveDefaultOpenMailAccountId,
|
|
27
|
+
isConfigured: (account) => account.configured,
|
|
28
|
+
isEnabled: (account) => account.enabled,
|
|
29
|
+
describeAccount: (account) => describeAccountSnapshot({
|
|
30
|
+
account,
|
|
31
|
+
configured: account.configured,
|
|
32
|
+
extra: { scope: account.scope, inboxId: account.inboxId, podId: account.podId, baseUrl: account.baseUrl },
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
status: createComputedAccountStatusAdapter({
|
|
36
|
+
defaultRuntime: createDefaultChannelRuntimeState("default"),
|
|
37
|
+
buildChannelSummary: ({ snapshot }) => buildBaseChannelStatusSummary(snapshot),
|
|
38
|
+
probeAccount: async ({ account }) => {
|
|
39
|
+
if (!account.apiKey || !(account.inboxId || account.podId)) {
|
|
40
|
+
return { ok: false, address: null, error: "missing apiKey or inboxId/podId" };
|
|
41
|
+
}
|
|
42
|
+
const api = new OpenMailApi(account.baseUrl, account.apiKey);
|
|
43
|
+
try {
|
|
44
|
+
if (account.scope === "pod" && account.podId) {
|
|
45
|
+
const pod = await api.getPod(account.podId);
|
|
46
|
+
const inboxes = (await api.listInboxes()).filter((i) => i.podId === pod.id);
|
|
47
|
+
return {
|
|
48
|
+
ok: true,
|
|
49
|
+
address: `pod ${pod.name ?? pod.id}, ${inboxes.length} inbox(es)`,
|
|
50
|
+
error: null,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const inbox = await api.getInbox(account.inboxId);
|
|
54
|
+
return { ok: true, address: inbox.address, error: null };
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return { ok: false, address: null, error: String(err) };
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
formatCapabilitiesProbe: ({ probe }) => [
|
|
61
|
+
probe.ok
|
|
62
|
+
? { text: `OpenMail: ${probe.address}` }
|
|
63
|
+
: { text: `OpenMail: unreachable (${probe.error})`, tone: "error" },
|
|
64
|
+
],
|
|
65
|
+
collectStatusIssues: (accounts) => accounts.flatMap((account) => account.configured
|
|
66
|
+
? []
|
|
67
|
+
: [
|
|
68
|
+
{
|
|
69
|
+
channel: OPENMAIL_CHANNEL_ID,
|
|
70
|
+
accountId: account.accountId,
|
|
71
|
+
kind: "config",
|
|
72
|
+
message: "OpenMail account is missing apiKey or inboxId/podId",
|
|
73
|
+
fix: "Run `openclaw channels add openmail --api-key <key>` (add --pod <id> for a whole pod).",
|
|
74
|
+
},
|
|
75
|
+
]),
|
|
76
|
+
resolveAccountSnapshot: ({ account }) => ({
|
|
77
|
+
accountId: account.accountId,
|
|
78
|
+
name: account.name ?? undefined,
|
|
79
|
+
enabled: account.enabled,
|
|
80
|
+
configured: account.configured,
|
|
81
|
+
extra: { scope: account.scope, inboxId: account.inboxId, podId: account.podId },
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
gateway: {
|
|
85
|
+
startAccount: async (ctx) => await startOpenMailGatewayAccount(ctx),
|
|
86
|
+
},
|
|
87
|
+
secrets: { secretTargetRegistryEntries, collectRuntimeConfigAssignments },
|
|
88
|
+
messaging: {
|
|
89
|
+
targetPrefixes: ["openmail", "email", "mail"],
|
|
90
|
+
targetIdComparison: "lowercase",
|
|
91
|
+
// A target is an email address, optionally prefixed.
|
|
92
|
+
normalizeTarget: (raw) => {
|
|
93
|
+
const address = stripPrefix(raw).toLowerCase();
|
|
94
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(address) ? address : undefined;
|
|
95
|
+
},
|
|
96
|
+
inferTargetChatType: () => "direct",
|
|
97
|
+
targetResolver: {
|
|
98
|
+
looksLikeId: (raw) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(stripPrefix(raw)),
|
|
99
|
+
hint: "an email address, e.g. person@example.com",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
// Proactive sends (agent-initiated, cron, `openclaw message send`). In-thread
|
|
104
|
+
// replies to inbound mail go through the turn's delivery adapter instead.
|
|
105
|
+
outbound: {
|
|
106
|
+
base: {
|
|
107
|
+
deliveryMode: "direct",
|
|
108
|
+
textChunkLimit: 100_000,
|
|
109
|
+
},
|
|
110
|
+
attachedResults: {
|
|
111
|
+
channel: OPENMAIL_CHANNEL_ID,
|
|
112
|
+
sendText: async ({ cfg, to, text, accountId, threadId }) => {
|
|
113
|
+
const account = resolveOpenMailAccount({ cfg, accountId });
|
|
114
|
+
if (!account.apiKey || !(account.inboxId || account.podId)) {
|
|
115
|
+
throw new Error("OpenMail account is not configured");
|
|
116
|
+
}
|
|
117
|
+
const api = new OpenMailApi(account.baseUrl, account.apiKey);
|
|
118
|
+
const address = stripPrefix(to);
|
|
119
|
+
const thread = threadId ? String(threadId) : undefined;
|
|
120
|
+
if (thread) {
|
|
121
|
+
// Pod scope: answer from whichever inbox owns the thread.
|
|
122
|
+
const inboxId = account.inboxId ?? (await api.listThreadMessages(thread))[0]?.inboxId;
|
|
123
|
+
if (!inboxId)
|
|
124
|
+
throw new Error(`OpenMail thread ${thread} is not visible to this account`);
|
|
125
|
+
const result = await api.sendReply({ inboxId, to: address, threadId: thread, body: text });
|
|
126
|
+
return { messageId: String(result.id ?? result.messageId ?? "") };
|
|
127
|
+
}
|
|
128
|
+
if (!account.inboxId) {
|
|
129
|
+
// A pod has many possible senders; a bare address does not say which.
|
|
130
|
+
throw new Error(`OpenMail account "${account.accountId}" covers a whole pod; a new thread needs the sending inbox. Use: openclaw openmail -- send --inbox-id <id> --to ${address} --subject ... --body ...`);
|
|
131
|
+
}
|
|
132
|
+
const result = await api.sendNew({
|
|
133
|
+
inboxId: account.inboxId,
|
|
134
|
+
to: address,
|
|
135
|
+
subject: firstLineAsSubject(text),
|
|
136
|
+
body: text,
|
|
137
|
+
});
|
|
138
|
+
return { messageId: String(result.id ?? result.messageId ?? "") };
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
function firstLineAsSubject(text) {
|
|
144
|
+
const line = text.split("\n").find((l) => l.trim())?.trim() ?? "Message from your agent";
|
|
145
|
+
return line.length > 78 ? `${line.slice(0, 75)}...` : line;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAsB,MAAM,kCAAkC,CAAC;AAE/F,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,gCAAgC,GACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,+BAA+B,EAC/B,sBAAsB,GAEvB,M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BACJ,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC;oBAC/B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,EAAE,EAAE,OAAO;oBACX,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC;oBACjC,IAAI,EAAE,IAAI;iBACX,CAAC,CAAC;gBACH,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC;YACpE,CAAC;SACF;KACF;CACF,CAAC,CAAC;AAEL,SAAS,kBAAkB,CAAC,IAAY;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,yBAAyB,CAAC;IACzF,OAAO,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// `openclaw openmail -- <args>`: run the bundled OpenMail CLI with the
|
|
2
|
+
// channel's credentials. This is what the skill tells the agent to call, so
|
|
3
|
+
// the agent never sees the key and the CLI never needs its own setup.
|
|
4
|
+
//
|
|
5
|
+
// Credentials come only from the resolved account config (inbox-scoped key
|
|
6
|
+
// minted at `channels add`); argument flags cannot override them, and proxy
|
|
7
|
+
// env is stripped so a poisoned environment cannot redirect requests.
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { resolveDefaultOpenMailAccountId, resolveOpenMailAccount } from "./accounts.js";
|
|
12
|
+
const BLOCKED_FLAGS = new Set(["--api-key", "--base-url", "--state-path"]);
|
|
13
|
+
const STRIPPED_ENV = /^(https?_proxy|all_proxy|no_proxy)$/i;
|
|
14
|
+
export function resolveBundledCliPath() {
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const pkg = require.resolve("@openmail/cli/package.json");
|
|
17
|
+
return path.join(path.dirname(pkg), "dist", "index.js");
|
|
18
|
+
}
|
|
19
|
+
/** Reject attempts to swap credentials or endpoint from the argument list. */
|
|
20
|
+
export function findBlockedFlag(args) {
|
|
21
|
+
return args.find((a) => BLOCKED_FLAGS.has(a) || [...BLOCKED_FLAGS].some((f) => a.startsWith(`${f}=`)));
|
|
22
|
+
}
|
|
23
|
+
export function buildCliEnv(base, account) {
|
|
24
|
+
const env = {};
|
|
25
|
+
for (const [k, v] of Object.entries(base)) {
|
|
26
|
+
if (!STRIPPED_ENV.test(k) && k !== "OPENMAIL_INBOX_ID")
|
|
27
|
+
env[k] = v;
|
|
28
|
+
}
|
|
29
|
+
env.OPENMAIL_API_KEY = account.apiKey;
|
|
30
|
+
// Pod scope has no single inbox: commands take --inbox-id, or the CLI
|
|
31
|
+
// picks the first one the key sees.
|
|
32
|
+
if (account.inboxId)
|
|
33
|
+
env.OPENMAIL_INBOX_ID = account.inboxId;
|
|
34
|
+
env.OPENMAIL_BASE_URL = account.baseUrl;
|
|
35
|
+
// Keep the CLI's own state file away from any user install.
|
|
36
|
+
env.OPENMAIL_STATE_PATH = path.join(base.HOME ?? "", ".openclaw", "openmail", "cli-state.json");
|
|
37
|
+
return env;
|
|
38
|
+
}
|
|
39
|
+
export function registerOpenMailCli(api) {
|
|
40
|
+
api.registerCli(({ program, config }) => {
|
|
41
|
+
program
|
|
42
|
+
.command("openmail")
|
|
43
|
+
.description("Run the OpenMail CLI with this channel's inbox credentials")
|
|
44
|
+
.option("--account <id>", "OpenMail channel account to use")
|
|
45
|
+
.allowUnknownOption(true)
|
|
46
|
+
.allowExcessArguments(true)
|
|
47
|
+
.argument("[args...]", "arguments passed to the openmail CLI (after --)")
|
|
48
|
+
.action(async (args, opts) => {
|
|
49
|
+
const accountId = opts.account ?? resolveDefaultOpenMailAccountId(config);
|
|
50
|
+
const account = resolveOpenMailAccount({ cfg: config, accountId });
|
|
51
|
+
if (!account.apiKey || !(account.inboxId || account.podId)) {
|
|
52
|
+
console.error(`OpenMail account "${accountId}" is not configured. Run: openclaw channels add --channel openmail --api-key <key>`);
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const blocked = findBlockedFlag(args);
|
|
57
|
+
if (blocked) {
|
|
58
|
+
console.error(`${blocked} is managed by the channel config and cannot be passed here.`);
|
|
59
|
+
process.exitCode = 1;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const child = spawn(process.execPath, [resolveBundledCliPath(), ...args], {
|
|
63
|
+
stdio: "inherit",
|
|
64
|
+
env: buildCliEnv(process.env, {
|
|
65
|
+
apiKey: account.apiKey,
|
|
66
|
+
inboxId: account.inboxId,
|
|
67
|
+
baseUrl: account.baseUrl,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
await new Promise((resolve) => {
|
|
71
|
+
child.on("exit", (code) => {
|
|
72
|
+
process.exitCode = code ?? 1;
|
|
73
|
+
resolve();
|
|
74
|
+
});
|
|
75
|
+
child.on("error", (err) => {
|
|
76
|
+
console.error(`failed to start openmail CLI: ${String(err)}`);
|
|
77
|
+
process.exitCode = 1;
|
|
78
|
+
resolve();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}, {
|
|
83
|
+
commands: ["openmail"],
|
|
84
|
+
descriptors: [
|
|
85
|
+
{ name: "openmail", description: "OpenMail CLI with the channel's credentials", hasSubcommands: false },
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,EACD;QACE,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,WAAW,EAAE;YACX,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,6CAA6C,EAAE,cAAc,EAAE,KAAK,EAAE;SACxG;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { buildChannelConfigSchema, buildMultiAccountChannelSchema, } from "openclaw/plugin-sdk/channel-config-schema";
|
|
2
|
+
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { OPENMAIL_MODES } from "./accounts.js";
|
|
5
|
+
// Literal string or SecretRef object; the host materialises refs before we read them.
|
|
6
|
+
const SecretInputSchema = buildSecretInputSchema();
|
|
7
|
+
const OpenMailInboxSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
mode: z.enum(OPENMAIL_MODES).optional(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
const OpenMailAccountSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
enabled: z.boolean().optional(),
|
|
16
|
+
configWrites: z.boolean().optional(),
|
|
17
|
+
apiKey: SecretInputSchema.optional(),
|
|
18
|
+
inboxId: z.string().min(1).optional(),
|
|
19
|
+
podId: z.string().min(1).optional(),
|
|
20
|
+
baseUrl: z.string().url().optional(),
|
|
21
|
+
mode: z.enum(OPENMAIL_MODES).optional(),
|
|
22
|
+
mediaMaxMb: z.number().min(0).max(100).optional(),
|
|
23
|
+
inboxes: z.record(z.string().min(1), OpenMailInboxSchema).optional(),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
export const openmailChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannelSchema(OpenMailAccountSchema), {
|
|
27
|
+
uiHints: {
|
|
28
|
+
apiKey: { label: "API key", sensitive: true },
|
|
29
|
+
inboxId: { label: "Inbox id", help: "One inbox. Leave empty when podId is set." },
|
|
30
|
+
podId: {
|
|
31
|
+
label: "Pod id",
|
|
32
|
+
help: "Whole pod: every inbox in it, including ones the agent creates later. Needs a pod-scoped key.",
|
|
33
|
+
advanced: true,
|
|
34
|
+
},
|
|
35
|
+
baseUrl: { label: "API base URL", advanced: true },
|
|
36
|
+
mode: {
|
|
37
|
+
label: "Mode",
|
|
38
|
+
help: "channel (default): mail from people wakes the agent and it replies in-thread; automated mail is only announced. notify: the agent tells you about new mail on your main chat, no auto-reply. tool: nothing inbound; email only when you ask.",
|
|
39
|
+
},
|
|
40
|
+
inboxes: {
|
|
41
|
+
label: "Per-inbox overrides",
|
|
42
|
+
help: "Pod accounts only. Keyed by inbox address or id; each entry may set the mode for that inbox; otherwise it inherits the account's.",
|
|
43
|
+
advanced: true,
|
|
44
|
+
},
|
|
45
|
+
mediaMaxMb: {
|
|
46
|
+
label: "Attachment budget (MB)",
|
|
47
|
+
help: "Total size of inbound attachments handed to the agent as files per email. 0 disables.",
|
|
48
|
+
advanced: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../src/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,sFAAsF;AACtF,MAAM,iBAAiB,GAAG,sBAAsB,EAAE,CAAC;AAEnD,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAA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