shalomail 0.1.0 → 0.2.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 +21 -4
- package/dist/index.d.ts +82 -0
- package/dist/index.mjs +64 -0
- package/dist/shalom.mjs +64 -58
- package/package.json +35 -7
package/README.md
CHANGED
|
@@ -8,10 +8,27 @@ Give your AI agents a real, end-to-end encrypted email address.
|
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install -g shalomail # Node.js 20 or newer
|
|
11
|
-
shalom login #
|
|
11
|
+
shalom login # opens shalomail.com to connect this terminal
|
|
12
12
|
shalom agents create support # creates support@shalomail.com
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
No global install? `npx shalomail <command>` works anywhere, for example `npx shalomail login`. The command answers to both `shalom` and `shalomail`.
|
|
16
|
+
|
|
17
|
+
On a machine without a browser (SSH, server), `shalom login --no-browser` prints the link and the code: open it on any device where you are signed in to Shalom and confirm. For CI, `shalom login --key shalom_sk_...` uses an API key created on the AI agents page.
|
|
18
|
+
|
|
19
|
+
## Use it from code
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { Agent } from 'shalomail';
|
|
23
|
+
|
|
24
|
+
const agent = Agent.fromToken(process.env.SHALOM_AGENT_TOKEN);
|
|
25
|
+
for await (const msg of agent.watch()) {
|
|
26
|
+
await agent.reply(msg.id, { text: `Got it: ${msg.subject}` });
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Full SDK and HTTP API reference: https://shalomail.com/developers/
|
|
31
|
+
|
|
15
32
|
## Read, reply and send
|
|
16
33
|
|
|
17
34
|
```sh
|
|
@@ -53,14 +70,14 @@ Store the token as a secret: it contains the mailbox's private key.
|
|
|
53
70
|
|
|
54
71
|
| Command | What it does |
|
|
55
72
|
| --- | --- |
|
|
56
|
-
| `shalom login` |
|
|
73
|
+
| `shalom login` | Connects this terminal to your account in the browser (`--no-browser`, `--key`) |
|
|
57
74
|
| `shalom agents list` | Lists your agent mailboxes and your plan |
|
|
58
75
|
| `shalom agents create <name>` | Creates `<name>@shalomail.com`, with the private key on this machine |
|
|
59
76
|
| `shalom agents delete <address>` | Deletes the mailbox and all its mail; the address stays reserved for you |
|
|
60
77
|
| `shalom agents rotate <address>` | Issues a new API key for the mailbox |
|
|
61
78
|
| `shalom agents export <address>` | Prints `SHALOM_AGENT_TOKEN` |
|
|
62
79
|
| `shalom agents import <token>` | Saves an exported mailbox on this machine |
|
|
63
|
-
| `shalom plan` / `shalom upgrade <5\|12>` | Shows your plan, or opens checkout |
|
|
80
|
+
| `shalom plan` / `shalom upgrade <5\|12\|unlimited>` | Shows your plan, or opens checkout |
|
|
64
81
|
| `shalom inbox` | Lists messages (`--folder`, `--limit`, `--unread`) |
|
|
65
82
|
| `shalom read <id>` | Opens a message (`--save-attachments <dir>`) |
|
|
66
83
|
| `shalom send` | Sends a message (`--to`, `--cc`, `--bcc`, `--subject`, `--text`, `--text-file`, `--html-file`, `--attach`) |
|
|
@@ -80,6 +97,6 @@ Every command accepts `--json`, `--as <address>` to pick the mailbox, and `--api
|
|
|
80
97
|
|
|
81
98
|
## Plans
|
|
82
99
|
|
|
83
|
-
Free: 2 agent mailboxes. Agents 5: up to 5 for US$ 4.99 a month. Agents 12: up to 12 for US$ 9.99 a month. Subscribe
|
|
100
|
+
Free: 2 agent mailboxes. Agents 5: up to 5 for US$ 4.99 a month. Agents 12: up to 12 for US$ 9.99 a month. Unlimited: no mailbox limit, up to 250 new mailboxes a day, for US$ 49.90 a month. Subscribe on the AI agents page of the app or with `shalom upgrade`.
|
|
84
101
|
|
|
85
102
|
Docs: https://shalomail.com/en/agents/
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Types for the shalomail Node SDK: import { Agent, Account } from 'shalomail'.
|
|
2
|
+
|
|
3
|
+
export type Folder = 'inbox' | 'starred' | 'sent' | 'drafts' | 'archive' | 'spam' | 'trash';
|
|
4
|
+
export type Person = { name: string; address: string };
|
|
5
|
+
|
|
6
|
+
export type Summary = {
|
|
7
|
+
id: string;
|
|
8
|
+
folder: string;
|
|
9
|
+
from: Person | null;
|
|
10
|
+
to: Person[];
|
|
11
|
+
subject: string;
|
|
12
|
+
date: string;
|
|
13
|
+
receivedAt: number;
|
|
14
|
+
snippet: string;
|
|
15
|
+
attachments: number;
|
|
16
|
+
unread: boolean;
|
|
17
|
+
starred: boolean;
|
|
18
|
+
/** Shalom to Shalom: sender verified by the server certificate and sealed end to end. */
|
|
19
|
+
verifiedSender: boolean;
|
|
20
|
+
/** Mail from other providers: DMARC result seen on arrival. */
|
|
21
|
+
auth: 'pass' | 'fail' | 'unknown';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type Message = Omit<Summary, 'attachments'> & {
|
|
25
|
+
messageId: string | null;
|
|
26
|
+
inReplyTo: string | null;
|
|
27
|
+
references: string | null;
|
|
28
|
+
replyTo: Person[];
|
|
29
|
+
cc: Person[];
|
|
30
|
+
text: string;
|
|
31
|
+
html: string | null;
|
|
32
|
+
attachments: { filename: string; mimeType: string; size: number; content: Uint8Array }[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type Attachment = { filename: string; content: Uint8Array; type?: string };
|
|
36
|
+
|
|
37
|
+
export type SendInput = {
|
|
38
|
+
to: string | string[];
|
|
39
|
+
cc?: string | string[];
|
|
40
|
+
bcc?: string | string[];
|
|
41
|
+
subject: string;
|
|
42
|
+
text: string;
|
|
43
|
+
html?: string;
|
|
44
|
+
attachments?: Attachment[];
|
|
45
|
+
inReplyTo?: string;
|
|
46
|
+
references?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type SendResult = { id: string; external: number; internal: number };
|
|
50
|
+
|
|
51
|
+
export declare class ApiError extends Error {
|
|
52
|
+
status: number;
|
|
53
|
+
code: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** One agent mailbox. Opening, sealing and sending happen on your machine. */
|
|
57
|
+
export declare class Agent {
|
|
58
|
+
/** From SHALOM_AGENT_TOKEN (see `shalom agents export`). */
|
|
59
|
+
static fromToken(token?: string, opts?: { api?: string }): Agent;
|
|
60
|
+
/** From the file the CLI saved in ~/.config/shalom/agents. */
|
|
61
|
+
static fromFile(address: string, opts?: { api?: string }): Agent;
|
|
62
|
+
readonly address: string;
|
|
63
|
+
inbox(opts?: { folder?: Folder; limit?: number; unread?: boolean }): Promise<Summary[]>;
|
|
64
|
+
/** Marks the message as read unless markRead is false. Ids can be shortened to 8 characters. */
|
|
65
|
+
read(id: string, opts?: { markRead?: boolean }): Promise<Message>;
|
|
66
|
+
send(msg: SendInput, opts?: { trustNewKey?: boolean }): Promise<SendResult>;
|
|
67
|
+
reply(id: string, msg: { text: string; html?: string; all?: boolean; quote?: boolean; attachments?: Attachment[] }, opts?: { trustNewKey?: boolean }): Promise<SendResult>;
|
|
68
|
+
move(ids: string | string[], folder: 'inbox' | 'archive' | 'spam' | 'trash'): Promise<void>;
|
|
69
|
+
mark(ids: string | string[], change: { read?: boolean; starred?: boolean }): Promise<void>;
|
|
70
|
+
/** New inbox messages, one at a time, until the loop breaks or the signal aborts. */
|
|
71
|
+
watch(opts?: { interval?: number; signal?: AbortSignal; includeExisting?: boolean }): AsyncGenerator<Message>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Your account: creates and deletes agent mailboxes with the account API key. */
|
|
75
|
+
export declare class Account {
|
|
76
|
+
constructor(apiKey?: string, opts?: { api?: string });
|
|
77
|
+
/** plan.limit is null on the Unlimited plan. */
|
|
78
|
+
listAgents(): Promise<{ agents: { id: string; address: string; name: string; createdAt: number; paused: boolean }[]; plan: { plan: string; limit: number | null; used: number } }>;
|
|
79
|
+
/** The mailbox private key is created here. The returned token is the full credential: store it as a secret. */
|
|
80
|
+
createAgent(name: string, opts?: { displayName?: string; save?: boolean }): Promise<{ id: string; address: string; name: string; token: string }>;
|
|
81
|
+
deleteAgent(address: string): Promise<void>;
|
|
82
|
+
}
|