@pidgeon-ai/sdk 1.13.0 → 1.14.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 +16 -0
- package/README.md +80 -19
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,22 @@ call shapes, the result shape — not to the API behind it.
|
|
|
9
9
|
|
|
10
10
|
## Unreleased
|
|
11
11
|
|
|
12
|
+
## 1.14.1 — the README leads with the job
|
|
13
|
+
|
|
14
|
+
No change to the API or the exported surface. The README opens with
|
|
15
|
+
creating an address, sending, waiting for the answer and replying with
|
|
16
|
+
`messagesReply`, and the package's description and keywords say what it is
|
|
17
|
+
for: email inboxes for AI agents.
|
|
18
|
+
|
|
19
|
+
## 1.14.0 — clean bodies in a conversation
|
|
20
|
+
|
|
21
|
+
`body=clean` on `GET /messages`, as on `GET /messages/{id}` and
|
|
22
|
+
`/messages/await`: every message in the conversation comes back with
|
|
23
|
+
Pidgeon Firewall's `clean_text` as its text and empty HTML. The MCP
|
|
24
|
+
`list_messages` tool asks for it by default. And a message the Firewall
|
|
25
|
+
calls suspicious is stored with a preview cut from its cleaned text, so a
|
|
26
|
+
hidden instruction no longer shows in search results or folder listings.
|
|
27
|
+
|
|
12
28
|
## 1.13.0 — what the agent reads
|
|
13
29
|
|
|
14
30
|
`firewall.clean_text` on every inbound message: the new text with hidden
|
package/README.md
CHANGED
|
@@ -1,17 +1,74 @@
|
|
|
1
1
|
# @pidgeon-ai/sdk
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
webhook verifier.
|
|
6
|
-
|
|
7
|
-
**Zero dependencies.** Needs `fetch` and `crypto.subtle`, so it runs on
|
|
8
|
-
Node 18+, Bun, Deno, Cloudflare Workers and Vercel functions. ESM and
|
|
9
|
-
CommonJS.
|
|
3
|
+
Pidgeon is the email inbox API for AI agents. It gives agents their own inboxes
|
|
4
|
+
so they can work with emails just like a human. This is its TypeScript client:
|
|
5
|
+
one typed function per operation, plus a webhook verifier.
|
|
10
6
|
|
|
11
7
|
```bash
|
|
12
|
-
|
|
8
|
+
npm install @pidgeon-ai/sdk
|
|
13
9
|
```
|
|
14
10
|
|
|
11
|
+
Or `pnpm add @pidgeon-ai/sdk`. **Zero dependencies.** Needs `fetch` and
|
|
12
|
+
`crypto.subtle`, so it runs on Node 18+, Bun, Deno, Cloudflare Workers and
|
|
13
|
+
Vercel functions. ESM and CommonJS.
|
|
14
|
+
|
|
15
|
+
## Create an address, send, receive, reply
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {
|
|
19
|
+
client,
|
|
20
|
+
identitiesCreate,
|
|
21
|
+
messagesAwait,
|
|
22
|
+
messagesReply,
|
|
23
|
+
messagesSend,
|
|
24
|
+
} from '@pidgeon-ai/sdk';
|
|
25
|
+
|
|
26
|
+
client.setConfig({ auth: () => process.env.PIDGEON_API_KEY! });
|
|
27
|
+
|
|
28
|
+
// 1. An address of its own. Any free name on pidgeon.email works with no DNS.
|
|
29
|
+
const { data: address } = await identitiesCreate({
|
|
30
|
+
body: { address: 'scout@pidgeon.email', type: 'agent' },
|
|
31
|
+
throwOnError: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 2. Send from it.
|
|
35
|
+
await messagesSend({
|
|
36
|
+
body: {
|
|
37
|
+
from: address.data.email,
|
|
38
|
+
to: 'ops@example.com',
|
|
39
|
+
subject: 'Staging access',
|
|
40
|
+
text: 'Could you send me the access code?',
|
|
41
|
+
},
|
|
42
|
+
throwOnError: true,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// 3. Receive: one held-open request until the answer arrives, up to 60 seconds.
|
|
46
|
+
const { data: awaited } = await messagesAwait({
|
|
47
|
+
query: { identity_id: address.data.id, timeout: 60 },
|
|
48
|
+
throwOnError: true,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 4. Reply into the same conversation. Recipients and subject come off the original.
|
|
52
|
+
if (awaited.data.message) {
|
|
53
|
+
console.log(awaited.data.message.extracted.codes);
|
|
54
|
+
await messagesReply({
|
|
55
|
+
path: { id: awaited.data.message.id },
|
|
56
|
+
body: { text: 'Thanks, that worked.' },
|
|
57
|
+
throwOnError: true,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`PIDGEON_API_KEY` is a `pgn_live_…` key. Make one at
|
|
63
|
+
[pidgeon.ai/app/developers/keys](https://pidgeon.ai/app/developers/keys), or
|
|
64
|
+
let your agent sign itself up: [pidgeon.ai/skill.md](https://pidgeon.ai/skill.md)
|
|
65
|
+
is two calls, and the only thing it needs from a person is a six-digit code.
|
|
66
|
+
|
|
67
|
+
In production, take a [signed webhook](#receiving-mail) rather than holding a
|
|
68
|
+
request open. Documentation: [pidgeon.ai/docs](https://pidgeon.ai/docs) ·
|
|
69
|
+
[API reference](https://pidgeon.ai/docs/reference) ·
|
|
70
|
+
[OpenAPI](https://pidgeon.ai/openapi.json).
|
|
71
|
+
|
|
15
72
|
## The shape
|
|
16
73
|
|
|
17
74
|
**There is no `Pidgeon` class.** Every operation is a function named for its
|
|
@@ -38,7 +95,7 @@ Mail arriving at an address your code owns becomes an event, and your
|
|
|
38
95
|
endpoint is called with a signed payload.
|
|
39
96
|
|
|
40
97
|
```ts
|
|
41
|
-
import { client, messagesGet,
|
|
98
|
+
import { client, messagesGet, messagesReply, verifyWebhook } from '@pidgeon-ai/sdk';
|
|
42
99
|
|
|
43
100
|
client.setConfig({ auth: () => process.env.PIDGEON_API_KEY! });
|
|
44
101
|
|
|
@@ -59,15 +116,10 @@ export async function POST(request: Request) {
|
|
|
59
116
|
throwOnError: true,
|
|
60
117
|
});
|
|
61
118
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
subject: `Re: ${mail.data.subject}`,
|
|
67
|
-
text: 'Got it — someone will be in touch.',
|
|
68
|
-
// Keeps the conversation together in the recipient's client too.
|
|
69
|
-
in_reply_to: mail.data.id,
|
|
70
|
-
},
|
|
119
|
+
// Into the same conversation, threaded in the recipient's client too.
|
|
120
|
+
await messagesReply({
|
|
121
|
+
path: { id: mail.data.id },
|
|
122
|
+
body: { text: 'Got it — someone will be in touch.' },
|
|
71
123
|
throwOnError: true,
|
|
72
124
|
});
|
|
73
125
|
|
|
@@ -174,4 +226,13 @@ Versioned independently of the API. The API is `/v1`; this package is
|
|
|
174
226
|
`1.x`, and semver applies to its own surface — the exported types, the
|
|
175
227
|
method signatures, the error shape. See `CHANGELOG.md`.
|
|
176
228
|
|
|
177
|
-
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
This package is generated from [`openapi.json`](https://pidgeon.ai/openapi.json),
|
|
232
|
+
the contract the API validates against, and published from
|
|
233
|
+
[pidgeon-ai/pidgeon-js](https://github.com/pidgeon-ai/pidgeon-js). A pull
|
|
234
|
+
request against generated code cannot be merged as written — the fix belongs
|
|
235
|
+
in the schema. [Open an issue](https://github.com/pidgeon-ai/pidgeon-js/issues)
|
|
236
|
+
and say what is wrong, or email [support@pidgeon.ai](mailto:support@pidgeon.ai).
|
|
237
|
+
|
|
238
|
+
MIT licensed.
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pidgeon-ai/sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.14.1",
|
|
4
|
+
"description": "Email inboxes for AI agents — TypeScript SDK for Pidgeon: create addresses, send, receive and reply.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"pidgeon",
|
|
7
6
|
"email",
|
|
7
|
+
"email-api",
|
|
8
|
+
"inbox",
|
|
9
|
+
"ai-agents",
|
|
10
|
+
"agent",
|
|
11
|
+
"llm",
|
|
12
|
+
"mcp",
|
|
13
|
+
"otp",
|
|
14
|
+
"verification-code",
|
|
15
|
+
"pidgeon",
|
|
8
16
|
"webhooks",
|
|
9
17
|
"api-client"
|
|
10
18
|
],
|