@plexuslabs/simmail 0.1.0 → 0.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 (2026-10-14)
4
+
5
+ Covers the whole customer API, and adds an object layer on top of the plain calls.
6
+
7
+ - **Every endpoint**: mailboxes and folders, reading, raw messages and attachments, marking and moving,
8
+ threads, injecting, signatures, rescue and retry; logins; people (memory, relations, learning from
9
+ mail, temperaments); cases (people, initiate, regenerate, the story); jobs; the event log and the
10
+ live event stream (`events()`, an async iterator); AI, pace, recipients, links, retention and Spam &
11
+ Junk settings; faults and scenarios; inspection and insights; webhooks; the World; `universes`,
12
+ `status` and connection details.
13
+ - **Objects**: `Message`, `Mailbox`, `Persona`, `Case`, `Job` and `Account`, with the API's fields,
14
+ camelCase getters and methods (`msg.reply()`, `msg.waitForReply()`, `mailbox.waitForEmail()`,
15
+ `persona.runDue()`, `deal.initiate()`, …). Waits and lists return them. They are supersets of the
16
+ 0.1.0 answers, so code reading `msg.magic_links` keeps working.
17
+ - **Groups**: `mail.personas`, `mail.cases`, `mail.clock`, `mail.jobs`, `mail.world`, `mail.faults`,
18
+ `mail.recipients`, `mail.webhooks`, `mail.insights`, `mail.events`, `mail.accounts`, `mail.inspect`,
19
+ `mail.behaviour`. Each is also callable as the 0.1.0 method of the same name.
20
+ - **Test addresses**: `mail.testAddress({ tag })` makes a fresh address (a `TestAddress` with
21
+ `waitForEmail()`, `expectNoEmail()`, `list()` and `cleanup()`); `mail.tag(name)` works on every
22
+ address with a tag; `listMessages` and `deleteMessages` across addresses.
23
+ - **Waits**: `waitForEmail` takes several addresses or `*@domain`, `tag`, `count` (waits for n),
24
+ `since`, `exclude`, `subjectRegex`/`bodyRegex` (a RegExp works), `header`, `hasAttachment`,
25
+ `attachmentName` and `linkDomain`; a timeout says what almost matched (`nearMisses`).
26
+ `expectNoEmail` passes when nothing comes. `waitForEvent` (`persona.waitFor("replied")`) waits for
27
+ something a person does; `waitForThread` (`msg.waitUntilQuiet()`) for a conversation to go quiet,
28
+ as a `Conversation`.
29
+ - **Jobs**: filters (`persona`, `kind`, `dueBefore`, `limit`) and `runDue` (`mail.jobs.runDue()`,
30
+ `persona.runDue()`), on the server.
31
+ - **Named values** for every setting with fixed choices (`Temperament`, `FaultScenario`,
32
+ `MailboxStatus`, `EventType`, `EventAlias`, `ErrorCode`, …), each the API's plain string, generated
33
+ from `GET /api/schema` (`sdk/tools/gen_enums.py`); `EnumInfo` and `describe()` give each value's
34
+ label and description. `mail.schema()` returns the schema itself.
35
+ - **Errors by kind**, chosen by the server's error code: `ValidationError`, `AuthError`,
36
+ `PlanLimitError`, `ForbiddenError`, `NotFoundError`, `WaitTimeoutError`, `ConflictError`,
37
+ `UnexpectedEmailError`, `IdempotencyError`, `RateLimitedError`, all `SimmailError`, which carries
38
+ `code`, `requestId`, `field`, `allowed` and `nearMisses`.
39
+ - **Safe retries**: every `send` and `inject` has its own Idempotency-Key (yours with
40
+ `idempotencyKey`, none with `false`), and answers say `replayed`. GETs and keyed writes are tried
41
+ again after a network error, 502 or 503 (`retries`, default 2). `mail.withRequestId(id)` sends your
42
+ own request id; answers and errors carry `requestId`.
43
+
3
44
  ## 0.1.0
4
45
 
5
46
  First release.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # @plexuslabs/simmail
2
2
 
3
- The official JavaScript client for [simmail](https://www.simmail.dev): a simulated email
4
- world for testing apps and email agents. Wait for the email your app sends, pull out the
5
- code or link, and get replies from simulated people, in a few lines of test code.
3
+ The official JavaScript and TypeScript client for [simmail](https://www.simmail.dev): a simulated email
4
+ world for testing apps and email agents. Wait for the email your app sends, pull out the code or
5
+ link, get replies from simulated people, and drive the whole world: people, cases, the clock, the
6
+ World's inbound mail, faults, recipients and webhooks.
6
7
 
7
- No dependencies; Node 18 or newer (it uses `fetch`). Full docs: https://www.simmail.dev/docs/
8
+ No dependencies; Node 18 or newer. Full docs: https://www.simmail.dev/docs/
8
9
 
9
10
  ```sh
10
11
  npm install --save-dev @plexuslabs/simmail
@@ -12,16 +13,16 @@ npm install --save-dev @plexuslabs/simmail
12
13
 
13
14
  ## Setup
14
15
 
15
- The client reads its settings from the environment (or pass them to `new Simmail({...})`):
16
+ The client reads its settings from the environment, or takes them in `new Simmail({...})`:
16
17
 
17
18
  | Variable | Meaning |
18
19
  | --- | --- |
19
20
  | `SIMMAIL_URL` | Your universe's server, such as `https://c1.simmail.dev` (shown on your account page). |
20
21
  | `SIMMAIL_API_KEY` | An API key, `smk_…` (Organization → API keys). |
21
- | `SIMMAIL_UNIVERSE` | Optional: only needed when the key could reach more than one universe. |
22
+ | `SIMMAIL_UNIVERSE` | Optional: only needed when the key can reach more than one universe. |
22
23
 
23
- Your app sends through simmail's SMTP as usual (the dashboard's *Get started* shows the
24
- settings); this client is for your tests.
24
+ Your app sends through simmail's SMTP as usual (the dashboard's *Get started* shows the settings);
25
+ this client is for your tests and tools.
25
26
 
26
27
  ## Wait for an email and use its code (Playwright)
27
28
 
@@ -36,44 +37,172 @@ test("new users can verify their email", async ({ page }) => {
36
37
  await page.goto("/signup");
37
38
  await page.fill("#email", email);
38
39
 
39
- const waiting = mail.waitForEmail({ to: email, subject: "verify", timeout: "20s" });
40
+ const waiting = mail.mailbox(email).waitForEmail({ subject: "verify", timeout: "20s" });
40
41
  await page.click("text=Create account");
41
42
  const msg = await waiting;
42
43
 
43
44
  expect(msg.codes).toHaveLength(1);
44
- await page.fill("#code", msg.codes[0]); // or: await page.goto(msg.magic_links[0])
45
+ await page.fill("#code", msg.codes[0]); // or: await page.goto(msg.magicLinks[0])
45
46
  });
46
47
  ```
47
48
 
48
- Start the wait before the click: a wait only sees mail that arrives after it starts, unless
49
- you pass `existing: true`.
49
+ Start the wait before the click: a wait only sees mail that arrives after it starts, unless you
50
+ pass `existing: true`.
50
51
 
51
- ## Read what is there
52
+ ## A fresh address per test
52
53
 
53
54
  ```js
54
- const inbox = await mail.messages("user@yourcompany.test"); // newest first
55
- const latest = await mail.message("user@yourcompany.test", "INBOX", inbox[0].uid);
56
- const report = await mail.health(latest.message_id); // spam score, links, compatibility
55
+ const addr = await mail.testAddress({ tag: "signup" }); // such as t-k3x9q@inbox.test
56
+ await page.fill("#email", addr.address);
57
+ await page.click("text=Create account");
58
+
59
+ const welcome = await addr.waitForEmail({ subjectRegex: /welcome/i, timeout: "20s" });
60
+ await addr.expectNoEmail({ within: "5s", subject: "verify" }); // no second email
61
+ await addr.cleanup(); // or mail.tag("signup").cleanup()
62
+ ```
63
+
64
+ `waitForEmail` also takes several addresses or `*@domain`, `count` (wait for n emails), `since`,
65
+ `exclude`, `bodyRegex`, `header`, `hasAttachment`, `attachmentName` and `linkDomain`. When nothing
66
+ matches, the `WaitTimeoutError` lists what almost did and why (`nearMisses`).
67
+
68
+ ## Objects you can act on
69
+
70
+ Answers come back as objects with the API's fields and methods for what you do next:
71
+
72
+ ```js
73
+ import { Simmail, Folder } from "@plexuslabs/simmail";
74
+
75
+ const msg = await mail.mailbox("app@yourcompany.test").waitForEmail({ from: "dana@harbor.test" });
76
+ await msg.reply({ text: "Thanks, Dana. Tuesday works." }); // threaded, from the mailbox it is in
77
+ const answer = await msg.waitForReply(); // Dana's next email in this thread
78
+ await msg.markRead();
79
+ await msg.move(Folder.Archive);
80
+ const report = await msg.health(); // for mail your app sent: spam score, links
81
+
82
+ for await (const m of mail.mailbox("dana@harbor.test").messages({ folder: Folder.Junk })) {
83
+ console.log(m.subject, m.isRead);
84
+ }
85
+ ```
86
+
87
+ | Object | What it has |
88
+ | --- | --- |
89
+ | `Message` | `messageId`, `from`, `to`, `subject`, `text`, `html`, `codes`, `magicLinks`, `attachments`; `full()`, `reply()`, `waitForReply()`, `waitUntilQuiet()`, `health()`, `source()`, `attachment(n)`, `markRead()`, `move()` |
90
+ | `Mailbox` | `address`, counts; `waitForEmail()`, `messages()` (async iterator), `list()`, `send()`, `inject()`, `folders()`, `threads()`, `setStatus()` |
91
+ | `Persona` | the person's fields; `update()`, `pause()`, `remember()`, `memory()`, `relations()`, `jobs()`, `runDue()`, `waitFor()`, `waitForReply()`, `mailbox()` |
92
+ | `Case` | `people`, `story`; `push()`, `addPeople()`, `initiate()`, `regenerate()`, `editStory()` |
93
+ | `Job` | `kind`, `state`, `due`; `run()`, `skip()`, `bounce()`, `reschedule()` |
94
+ | `TestAddress` | a fresh address (a `Mailbox`); `waitForEmail()`, `expectNoEmail()`, `list()`, `cleanup()` |
95
+ | `Conversation` | `messages`, `latest`; `waitUntilQuiet()`, `reply()` |
96
+ | `SimEvent` | `kind`, `data`, `personaId`, `messageId`; `persona()` |
97
+ | `Account` | a login; `update()`, `test()`, `delete()` |
98
+
99
+ Every object still has the API's own field names (`msg.message_id`, `msg.magic_links`), `.raw`
100
+ for the answer as it came, and serialises to it with `JSON.stringify`.
101
+
102
+ ## People, cases and the clock
103
+
104
+ ```js
105
+ import { Simmail, Temperament, LinkHabit, JobKind, EventAlias } from "@plexuslabs/simmail";
106
+
107
+ const dana = await mail.personas.create({
108
+ name: "Dana Reyes",
109
+ addresses: ["dana@harbor.test"],
110
+ temperament: Temperament.Skeptical,
111
+ style: { links: LinkHabit.Wary },
112
+ });
113
+
114
+ const deal = await mail.cases.push("deal-1701", {
115
+ title: "Sale of 1701 Clark Street",
116
+ people: [{ ref: "seller", name: "Dana Reyes", addresses: ["dana@harbor.test"] }],
117
+ });
118
+ await deal.initiate({ persona: dana.id, to: "agent@yourcompany.test", intent: "ask about the offer" });
119
+
120
+ await mail.clock.advance("2d"); // follow-ups and nudges that were due happen
121
+ await dana.runDue({ kind: JobKind.Reply }); // or run her pending replies now
122
+
123
+ const sent = await dana.waitFor(EventAlias.Replied, { fast: true }); // or "declined", "clicked", "bounced"
124
+ const talk = await msg.waitUntilQuiet({ quiet: "10s" }); // the whole conversation, once it settles
125
+ console.log(talk.messages.length, talk.latest.subject);
57
126
  ```
58
127
 
59
- ## A conversation with a simulated person
128
+ ## Chaos, recipients, webhooks and the World
60
129
 
61
130
  ```js
62
- const sent = await mail.send({
63
- from: "sales@yourcompany.test",
64
- to: ["dana@harbor.test"],
65
- subject: "Offer",
66
- text: "Would you take 165k?",
131
+ import { FaultScenario, MailboxStatus, StreamKind, EventType } from "@plexuslabs/simmail";
132
+
133
+ await mail.faults.add(FaultScenario.GmailRate, { match: "@gmail.com" }); // Gmail rate-limits you
134
+ await mail.recipients.setStatus("old-client@harbor.test", MailboxStatus.Disabled);
135
+ await mail.webhooks.set([{ url: "https://hooks.yourcompany.test/simmail", events: [EventType.PersonaSent, "link.*"] }]);
136
+ await mail.world.set({
137
+ company: { name: "Acme Realty", domain: "acme-realty.test" },
138
+ streams: [{ name: "Website leads", kind: StreamKind.Lead, to: ["sales@acme-realty.test"], per_day: 6, enabled: true }],
67
139
  });
68
- const reply = await mail.waitForReply({ from: "dana@harbor.test", inReplyTo: sent.message_id });
69
- console.log(reply.text);
70
140
 
71
- await mail.advance("2d"); // move the simulated clock: follow-ups and nudges that were due happen
141
+ for await (const event of mail.events({ since: 0 })) { // the live stream
142
+ if (event.kind === EventType.PersonaSent) break;
143
+ }
72
144
  ```
73
145
 
146
+ Each group (`mail.personas`, `mail.cases`, `mail.clock`, `mail.jobs`, `mail.world`, `mail.faults`,
147
+ `mail.recipients`, `mail.webhooks`, `mail.insights`, `mail.events`, `mail.accounts`, `mail.inspect`,
148
+ `mail.behaviour`) has the calls for that part of the API. The 0.1.0 methods (`mail.clock()`,
149
+ `mail.advance("2d")`, `mail.waitForEmail({ to })`, …) still work as before.
150
+
151
+ ## Named values
152
+
153
+ Every setting with fixed choices has named constants: `Temperament`, `Knows`, `Life`, `Length`,
154
+ `Formality`, `MailClient`, `LinkHabit`, `SpamFilter`, `Access`, `Stance`, `MailboxStatus`, `BadKind`,
155
+ `FailAt`, `Stranger`, `Folder`, `AiMode`, `MissingSite`, `LocalLinks`, `Protocol`, `Role`,
156
+ `PersonaSource`, `StreamKind`, `FaultKind`, `FaultStage`, `FaultScenario`, `JobKind`, `JobState`,
157
+ `StoryBy`, `EventType`, `EventAlias`, `ErrorCode`. Each is the API's plain string
158
+ (`Temperament.Skeptical === "skeptical"`), so the string works too. They are generated from the
159
+ server's `GET /api/schema`; `EnumInfo.Temperament.skeptical.description` and
160
+ `describe("Temperament", value)` give the words the dashboard shows.
161
+
162
+ ## What's covered
163
+
164
+ | Area | Calls |
165
+ | --- | --- |
166
+ | Waiting | `waitForEmail`, `expectNoEmail`, `waitForReply`, `waitForEvent`, `waitForThread`, `extract` |
167
+ | Test addresses | `testAddress`, `createAddress`, `tag`, `listMessages`, `deleteMessages` |
168
+ | Mail | `mailboxes`, `mailbox`, `folders`, `messages`, `message`, `rawMessage`, `attachment`, `updateMessage`, `threads`, `setMailboxStatus`, `send`, `inject`, `signature`, `setSignature`, `rescue`, `retry` |
169
+ | Logins | `accounts`, `createAccount`, `updateAccount`, `deleteAccount`, `testAccount` |
170
+ | People | `personas`, `persona`, `createPersona`, `updatePersona`, `deletePersona`, `personaFromMail`, `temperaments`, `memory`, `addMemory`, `clearMemory`, `addMemoryByExternal`, `relations`, `forgetRelations` |
171
+ | Cases | `cases`, `getCase`, `pushCase`, `addCasePeople`, `initiateCase`, `regenerateCase`, `editCaseStory`, `deleteCase` |
172
+ | Clock and jobs | `clock`, `advance`, `freeze`, `speed`, `live`, `jobs`, `runDue`, `runJob`, `skipJob`, `bounceJob`, `rescheduleJob` |
173
+ | Events | `events` (live stream), `log` |
174
+ | Behaviour | `ai`, `setAi`, `aiBudget`, `pace`, `setPace`, `recipients`, `setRecipients`, `links`, `setLinks`, `retention`, `setRetention`, `pruneRetention`, `junkSettings`, `setJunkSettings` |
175
+ | Chaos | `faults`, `setFaults`, `faultScenarios`, `addFaultScenario` |
176
+ | Inspection | `health`, `insights`, `insightShares`, `shareInsights`, `revokeInsightShare` |
177
+ | Webhooks and the World | `webhooks`, `setWebhooks`, `world`, `setWorld`, `sendFromStream` |
178
+ | Who and where | `me`, `universes`, `status`, `connection`, `connectionCert`, `schema` |
179
+
180
+ Anything else is one `mail.request(method, path, body, query)` call.
181
+
74
182
  ## Errors
75
183
 
76
- A failed call throws `SimmailError` with the HTTP `status` and the server's message.
184
+ A failed call throws a `SimmailError` with the HTTP `status`, the server's message, its `code` (an
185
+ `ErrorCode`) and `requestId`. The subclasses say which kind: `ValidationError` (400, with `field` and
186
+ `allowed`), `AuthError` (401), `PlanLimitError` (402), `ForbiddenError` (403), `NotFoundError` (404),
187
+ `WaitTimeoutError` (408, with `nearMisses`), `ConflictError` (409, such as a person who decided not
188
+ to reply), `UnexpectedEmailError` (409, from `expectNoEmail`, with the `email`), `IdempotencyError`
189
+ (422) and `RateLimitedError` (429, with `retryAfter`).
190
+
191
+ Every `send` and `inject` carries its own Idempotency-Key, so the client can safely try a write
192
+ again: GETs and keyed writes are retried after a network error, 502 or 503 (`retries`, default 2),
193
+ and an answer the server had already given says `replayed: true`. To follow a request in the
194
+ server's logs, use `mail.withRequestId("ci-1234")`.
195
+
196
+ ```js
197
+ import { WaitTimeoutError } from "@plexuslabs/simmail";
198
+
199
+ try {
200
+ await mail.mailbox(email).waitForEmail({ subject: "verify", timeout: "10s" });
201
+ } catch (e) {
202
+ if (e instanceof WaitTimeoutError) console.log("nothing arrived", e.nearMisses);
203
+ else throw e;
204
+ }
205
+ ```
77
206
 
78
207
  ## License
79
208
 
package/enums.d.ts ADDED
@@ -0,0 +1,103 @@
1
+ // Generated by sdk/tools/gen_enums.py from GET /api/schema (version 1). Do not edit by hand.
2
+
3
+ type OneOf<T> = T[keyof T];
4
+
5
+ /** How a person tends to answer. */
6
+ export declare const Temperament: { readonly Responsive: "responsive"; readonly Busy: "busy"; readonly Procedural: "procedural"; readonly Skeptical: "skeptical"; readonly Flaky: "flaky"; readonly Difficult: "difficult"; readonly Ghost: "ghost" };
7
+ export type Temperament = OneOf<typeof Temperament>;
8
+ /** How much a person knows about their case. */
9
+ export declare const Knows: { readonly All: "all"; readonly Some: "some"; readonly Little: "little" };
10
+ export type Knows = OneOf<typeof Knows>;
11
+ /** Whose hours a person's replies keep. */
12
+ export declare const Life: { readonly Work: "work"; readonly Personal: "personal"; readonly Both: "both" };
13
+ export type Life = OneOf<typeof Life>;
14
+ /** How long a person writes. */
15
+ export declare const Length: { readonly Short: "short"; readonly Medium: "medium"; readonly Long: "long" };
16
+ export type Length = OneOf<typeof Length>;
17
+ /** How formally a person writes. */
18
+ export declare const Formality: { readonly Casual: "casual"; readonly Neutral: "neutral"; readonly Formal: "formal" };
19
+ export type Formality = OneOf<typeof Formality>;
20
+ /** A person's mail program: how their mail looks. */
21
+ export declare const MailClient: { readonly Gmail: "gmail"; readonly Outlook: "outlook"; readonly Apple: "apple"; readonly IPhone: "iphone"; readonly Android: "android"; readonly Plain: "plain" };
22
+ export type MailClient = OneOf<typeof MailClient>;
23
+ /** Whether a person clicks links in mail. */
24
+ export declare const LinkHabit: { readonly Usual: "usual"; readonly Curious: "curious"; readonly Wary: "wary"; readonly Never: "never" };
25
+ export type LinkHabit = OneOf<typeof LinkHabit>;
26
+ /** A person's provider's spam filter. */
27
+ export declare const SpamFilter: { readonly Strict: "strict"; readonly Normal: "normal"; readonly Lenient: "lenient"; readonly None: "none" };
28
+ export type SpamFilter = OneOf<typeof SpamFilter>;
29
+ /** How a person takes in mail. */
30
+ export declare const Access: { readonly ScreenReader: "screen_reader"; readonly LowVision: "low_vision" };
31
+ export type Access = OneOf<typeof Access>;
32
+ /** How a person feels about a sender (it follows the conversation). */
33
+ export declare const Stance: { readonly Warm: "warm"; readonly Neutral: "neutral"; readonly Wary: "wary"; readonly Annoyed: "annoyed"; readonly Done: "done" };
34
+ export type Stance = OneOf<typeof Stance>;
35
+ /** What a bad address does. */
36
+ export declare const BadKind: { readonly Blocked: "blocked"; readonly Disabled: "disabled"; readonly Domain: "domain"; readonly Full: "full"; readonly Unknown: "unknown" };
37
+ export type BadKind = OneOf<typeof BadKind>;
38
+ /** When a bad address fails. */
39
+ export declare const FailAt: { readonly Dsn: "dsn"; readonly Rcpt: "rcpt" };
40
+ export type FailAt = OneOf<typeof FailAt>;
41
+ /** Who is behind a never-seen address. */
42
+ export declare const Stranger: { readonly Off: "off"; readonly Basic: "basic"; readonly Ai: "ai" };
43
+ export type Stranger = OneOf<typeof Stranger>;
44
+ /** A fixed outcome for one address as a recipient (ok clears it). */
45
+ export declare const MailboxStatus: { readonly Ok: "ok"; readonly Blocked: "blocked"; readonly Disabled: "disabled"; readonly Domain: "domain"; readonly Full: "full"; readonly Unknown: "unknown" };
46
+ export type MailboxStatus = OneOf<typeof MailboxStatus>;
47
+ /** What a fault rule does. */
48
+ export declare const FaultKind: { readonly Error: "error"; readonly Greylist: "greylist"; readonly Rate: "rate"; readonly Drop: "drop" };
49
+ export type FaultKind = OneOf<typeof FaultKind>;
50
+ /** When in the SMTP conversation a fault rule acts. */
51
+ export declare const FaultStage: { readonly Mail: "mail"; readonly Rcpt: "rcpt"; readonly Data: "data" };
52
+ export type FaultStage = OneOf<typeof FaultStage>;
53
+ /** Real providers' failures, ready made. */
54
+ export declare const FaultScenario: { readonly GmailUnauthenticated: "gmail-unauthenticated"; readonly GmailRate: "gmail-rate"; readonly GmailNoUser: "gmail-no-user"; readonly GmailOverQuota: "gmail-over-quota"; readonly MicrosoftBusy: "microsoft-busy"; readonly MicrosoftBlocked: "microsoft-blocked"; readonly MicrosoftAccessDenied: "microsoft-access-denied"; readonly YahooDeferred: "yahoo-deferred"; readonly YahooPolicy: "yahoo-policy"; readonly Greylisting: "greylisting"; readonly RateLimit: "rate-limit"; readonly Drop: "drop"; readonly Slow: "slow"; readonly MailboxFull: "mailbox-full" };
55
+ export type FaultScenario = OneOf<typeof FaultScenario>;
56
+ /** When a sender's website does not exist. */
57
+ export declare const MissingSite: { readonly Imagine: "imagine"; readonly Notice: "notice" };
58
+ export type MissingSite = OneOf<typeof MissingSite>;
59
+ /** Links to your own machine or network. */
60
+ export declare const LocalLinks: { readonly Ignore: "ignore"; readonly Broken: "broken" };
61
+ export type LocalLinks = OneOf<typeof LocalLinks>;
62
+ /** What an inbound stream of the World sends. */
63
+ export declare const StreamKind: { readonly Lead: "lead"; readonly Support: "support"; readonly Vendor: "vendor"; readonly Partner: "partner"; readonly Customer: "customer"; readonly Newsletter: "newsletter"; readonly Spam: "spam"; readonly Phishing: "phishing"; readonly Custom: "custom" };
64
+ export type StreamKind = OneOf<typeof StreamKind>;
65
+ /** AI writing on or off. */
66
+ export declare const AiMode: { readonly On: "on"; readonly Off: "off" };
67
+ export type AiMode = OneOf<typeof AiMode>;
68
+ /** Event types, for waits, the event stream and webhooks (a name ending in * matches a prefix). */
69
+ export declare const EventType: { readonly MailDelivered: "mail.delivered"; readonly MailRetried: "mail.retried"; readonly MailDeleted: "mail.deleted"; readonly PersonaReceived: "persona.received"; readonly PersonaSent: "persona.sent"; readonly PersonaIgnored: "persona.ignored"; readonly PersonaBatched: "persona.batched"; readonly PersonaJunked: "persona.junked"; readonly PersonaRescued: "persona.rescued"; readonly PersonaBounced: "persona.bounced"; readonly PersonaPromised: "persona.promised"; readonly PersonaWaiting: "persona.waiting"; readonly PersonaCreated: "persona.created"; readonly PersonaUpdated: "persona.updated"; readonly PersonaMemory: "persona.memory"; readonly LinkOpened: "link.opened"; readonly LinkSkipped: "link.skipped"; readonly LinkFailed: "link.failed"; readonly LinkSender: "link.sender"; readonly InspectScored: "inspect.scored"; readonly InspectLinks: "inspect.links"; readonly WorldMail: "world.mail"; readonly WorldUpdated: "world.updated"; readonly JobScheduled: "job.scheduled"; readonly JobUpdated: "job.updated"; readonly JobDone: "job.done"; readonly JobSkipped: "job.skipped"; readonly JobFailed: "job.failed"; readonly CaseUpdated: "case.updated"; readonly Clock: "clock"; readonly Pace: "pace"; readonly FaultsUpdated: "faults.updated"; readonly JunkSettings: "junk.settings"; readonly NetworkUpdated: "network.updated"; readonly RetentionPruned: "retention.pruned"; readonly WebhookFailed: "webhook.failed"; readonly WriterFallback: "writer.fallback"; readonly AiMode: "ai.mode"; readonly AuthOk: "auth.ok"; readonly AuthFailed: "auth.failed"; readonly CheckReceived: "check.received"; readonly CheckDone: "check.done"; readonly CheckRefused: "check.refused" };
70
+ export type EventType = OneOf<typeof EventType> | (string & {});
71
+ /** What a planned job is. */
72
+ export declare const JobKind: { readonly Reply: "reply"; readonly Followup: "followup"; readonly Correction: "correction"; readonly OutOfOffice: "ooo"; readonly Bounce: "bounce"; readonly Initiate: "initiate"; readonly Deliver: "deliver"; readonly Nudge: "nudge"; readonly Dsn: "dsn"; readonly World: "world"; readonly Visit: "visit" };
73
+ export type JobKind = OneOf<typeof JobKind>;
74
+ /** Where a job stands. */
75
+ export declare const JobState: { readonly Pending: "pending"; readonly Done: "done"; readonly Skipped: "skipped"; readonly Failed: "failed" };
76
+ export type JobState = OneOf<typeof JobState>;
77
+ /** Common folders (any folder name works too). */
78
+ export declare const Folder: { readonly Inbox: "INBOX"; readonly Sent: "Sent"; readonly Drafts: "Drafts"; readonly Archive: "Archive"; readonly Trash: "Trash"; readonly Junk: "Junk" };
79
+ export type Folder = OneOf<typeof Folder> | (string & {});
80
+ /** Which protocol a login test tries. */
81
+ export declare const Protocol: { readonly Smtp: "smtp"; readonly Imap: "imap" };
82
+ export type Protocol = OneOf<typeof Protocol>;
83
+ /** A role in a universe. */
84
+ export declare const Role: { readonly Viewer: "viewer"; readonly Member: "member"; readonly Admin: "admin"; readonly Owner: "owner" };
85
+ export type Role = OneOf<typeof Role>;
86
+ /** Where a persona came from. */
87
+ export declare const PersonaSource: { readonly Api: "api"; readonly Case: "case"; readonly Stranger: "stranger"; readonly World: "world"; readonly Mail: "mail"; readonly Config: "config" };
88
+ export type PersonaSource = OneOf<typeof PersonaSource>;
89
+ /** Who wrote a case's story. */
90
+ export declare const StoryBy: { readonly Ai: "ai"; readonly Template: "template"; readonly Edited: "edited" };
91
+ export type StoryBy = OneOf<typeof StoryBy>;
92
+ /** Friendlier names the event wait accepts for common events. */
93
+ export declare const EventAlias: { readonly Delivered: "delivered"; readonly Received: "received"; readonly Replied: "replied"; readonly Sent: "sent"; readonly Declined: "declined"; readonly Ignored: "ignored"; readonly Junked: "junked"; readonly Bounced: "bounced"; readonly Clicked: "clicked"; readonly OpenedLink: "opened_link"; readonly Promised: "promised"; readonly Rescued: "rescued" };
94
+ export type EventAlias = OneOf<typeof EventAlias>;
95
+ /** The code every error answer carries. */
96
+ export declare const ErrorCode: { readonly BadRequest: "bad_request"; readonly InvalidValue: "invalid_value"; readonly InvalidRegex: "invalid_regex"; readonly Unauthorized: "unauthorized"; readonly NotInPlan: "not_in_plan"; readonly Forbidden: "forbidden"; readonly NotFound: "not_found"; readonly MethodNotAllowed: "method_not_allowed"; readonly Timeout: "timeout"; readonly WaitTimeout: "wait_timeout"; readonly Conflict: "conflict"; readonly UnexpectedEmail: "unexpected_email"; readonly TooLarge: "too_large"; readonly Unprocessable: "unprocessable"; readonly IdempotencyMismatch: "idempotency_mismatch"; readonly RateLimited: "rate_limited"; readonly InternalError: "internal_error"; readonly BadGateway: "bad_gateway"; readonly Unavailable: "unavailable" };
97
+ export type ErrorCode = OneOf<typeof ErrorCode>;
98
+
99
+ export interface EnumValueInfo { label?: string; description?: string; feature?: string }
100
+ /** Each enum value's label, description and plan feature. */
101
+ export declare const EnumInfo: { readonly [enumName: string]: { readonly [value: string]: EnumValueInfo } };
102
+ /** The label of a value, such as describe("Temperament", "skeptical"). */
103
+ export declare function describe(enumName: string, value: string): string;