@kivel.io/sdk 0.10.0 → 0.11.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/CHANGELOG.md +12 -0
- package/README.md +2 -4
- package/dist/index.d.ts +11 -3
- package/dist/index.js +15 -3
- package/dist/types.d.ts +38 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @kivel.io/sdk
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e137d14: Add email search filters, resumable wait cursors and checkpoints before triggering new mail. Add message inspection, triage and email forwarding history.
|
|
8
|
+
|
|
9
|
+
## 0.10.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 10de14b: Publish releases to the npm latest tag, so `npm install @kivel.io/sdk` and `npm install --global @kivel.io/cli` install the newest version. Install instructions no longer need `@beta`.
|
|
14
|
+
|
|
3
15
|
## 0.10.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,11 +6,10 @@ for coding agents. Requires Node.js 22.13+ or a compatible fetch-based runtime.
|
|
|
6
6
|
The published package is ESM; use `import`, not CommonJS `require`.
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install @kivel.io/sdk
|
|
9
|
+
npm install @kivel.io/sdk
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
when you need reproducible application builds.
|
|
12
|
+
Pin an exact version when you need reproducible application builds.
|
|
14
13
|
|
|
15
14
|
```ts
|
|
16
15
|
import { Kivel, KivelError } from '@kivel.io/sdk';
|
|
@@ -24,7 +23,6 @@ await kivel.remove('inboxes', inbox.id);
|
|
|
24
23
|
|
|
25
24
|
`createInbox()` returns a `webhookUrl` that accepts senders without credentials. Reading and waiting still require your workspace key or the private `inspectionToken`. For token-required receiving, pass `{ visibility: 'private' }` and give the sender the returned `accessToken` for its `X-Access-Token` header.
|
|
26
25
|
|
|
27
|
-
|
|
28
26
|
Use `stream(['webhook:' + inbox.id], { token, signal })` to receive change notices
|
|
29
27
|
when live updates are available. Fetch the request bodies with the normal inbox
|
|
30
28
|
methods. Pass the last notice's `cursor` as `lastEventId` when reconnecting.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
-
import type { Authenticator, AuthenticatorInput, TotpCode, EmailAttachmentLink, OAuthProviderInput, OAuthProvider, CreatedOAuthProvider, AgentLogin, AgentToken, AgentTrial, Approval, ApprovalInput, EmailInbox, EmailMessage, EmailContent, EmailThread, EmailThreadsPage, EmailDraft, EmailRules, MemoryEntry, Monitor, MonitorInput
|
|
2
|
+
import type { Authenticator, AuthenticatorInput, TotpCode, EmailAttachmentLink, OAuthProviderInput, OAuthProvider, CreatedOAuthProvider, AgentLogin, AgentToken, AgentTrial, Approval, ApprovalInput, EmailInbox, EmailMessage, EmailSearchOptions, EmailWaitOptions, EmailContent, EmailThread, EmailThreadsPage, EmailDraft, EmailRules, MemoryEntry, Monitor, MonitorInput } from './types.js';
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
baseUrl?: string | undefined;
|
|
5
5
|
apiKey?: string | undefined;
|
|
@@ -257,14 +257,22 @@ export declare class Kivel {
|
|
|
257
257
|
}>;
|
|
258
258
|
emailForwarding(id: string, url: string | null, token?: string): Promise<{
|
|
259
259
|
forwardingUrl: string | null;
|
|
260
|
+
signingSecret?: string;
|
|
261
|
+
}>;
|
|
262
|
+
emailDeliveries(id: string): Promise<{
|
|
263
|
+
deliveries: import('./types.js').EmailDelivery[];
|
|
260
264
|
}>;
|
|
261
265
|
emailInbox(id: string, token?: string): Promise<EmailInbox>;
|
|
262
|
-
emails(id: string,
|
|
266
|
+
emails(id: string, tokenOrOptions?: string | EmailSearchOptions): Promise<{
|
|
263
267
|
messages: EmailMessage[];
|
|
268
|
+
nextCursor?: string | null;
|
|
264
269
|
}>;
|
|
265
|
-
|
|
270
|
+
emailMessage(id: string, messageId: string, token?: string): Promise<EmailMessage>;
|
|
271
|
+
updateEmailMessage(id: string, messageId: string, update: import('./types.js').EmailMessageUpdate): Promise<EmailMessage>;
|
|
272
|
+
waitForEmail(id: string, options?: EmailWaitOptions): Promise<{
|
|
266
273
|
timedOut: boolean;
|
|
267
274
|
messages: EmailMessage[];
|
|
275
|
+
nextCursor?: string;
|
|
268
276
|
}>;
|
|
269
277
|
memorySet<T>(namespace: string, key: string, value: T, ttlSeconds?: number): Promise<Omit<MemoryEntry<T>, "value">>;
|
|
270
278
|
memoryGet<T = unknown>(namespace: string, key: string): Promise<MemoryEntry<T>>;
|
package/dist/index.js
CHANGED
|
@@ -371,14 +371,26 @@ export class Kivel {
|
|
|
371
371
|
emailForwarding(id, url, token) {
|
|
372
372
|
return this.request('PUT', `/api/email-inboxes/${encodeURIComponent(id)}/forwarding`, { url }, token);
|
|
373
373
|
}
|
|
374
|
+
emailDeliveries(id) {
|
|
375
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/deliveries`);
|
|
376
|
+
}
|
|
374
377
|
emailInbox(id, token) {
|
|
375
378
|
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}`, undefined, token);
|
|
376
379
|
}
|
|
377
|
-
emails(id,
|
|
378
|
-
|
|
380
|
+
emails(id, tokenOrOptions) {
|
|
381
|
+
const settings = typeof tokenOrOptions === 'string' ? { token: tokenOrOptions } : (tokenOrOptions ?? {});
|
|
382
|
+
const { token, ...filters } = settings;
|
|
383
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/messages${query(filters)}`, undefined, token);
|
|
384
|
+
}
|
|
385
|
+
emailMessage(id, messageId, token) {
|
|
386
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/messages/${encodeURIComponent(messageId)}`, undefined, token);
|
|
387
|
+
}
|
|
388
|
+
updateEmailMessage(id, messageId, update) {
|
|
389
|
+
return this.request('PATCH', `/api/email-inboxes/${encodeURIComponent(id)}/messages/${encodeURIComponent(messageId)}`, update);
|
|
379
390
|
}
|
|
380
391
|
waitForEmail(id, options = {}) {
|
|
381
|
-
|
|
392
|
+
const { token, ...filters } = options;
|
|
393
|
+
return this.request('GET', `/api/email-inboxes/${encodeURIComponent(id)}/wait${query({ ...filters, timeoutSeconds: this.waitTimeout(options.timeoutSeconds) })}`, undefined, token);
|
|
382
394
|
}
|
|
383
395
|
memorySet(namespace, key, value, ttlSeconds) {
|
|
384
396
|
return this.request('PUT', memoryPath(namespace, key), {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
export interface EmailFilters {
|
|
2
|
+
from?: string | undefined;
|
|
3
|
+
mailFrom?: string | undefined;
|
|
4
|
+
subject?: string | undefined;
|
|
5
|
+
text?: string | undefined;
|
|
6
|
+
hasCode?: boolean | undefined;
|
|
7
|
+
hasLink?: boolean | undefined;
|
|
8
|
+
hasAttachment?: boolean | undefined;
|
|
9
|
+
read?: boolean | undefined;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface EmailSearchOptions extends EmailFilters {
|
|
13
|
+
token?: string | undefined;
|
|
14
|
+
cursor?: string | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface EmailWaitOptions extends WaitOptions, EmailFilters {
|
|
18
|
+
cursor?: string | undefined;
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
checkpoint?: boolean | undefined;
|
|
21
|
+
}
|
|
1
22
|
export interface WaitOptions {
|
|
2
23
|
token?: string;
|
|
3
24
|
after?: string;
|
|
@@ -35,6 +56,15 @@ export interface AgentTrial {
|
|
|
35
56
|
};
|
|
36
57
|
instructions: string;
|
|
37
58
|
}
|
|
59
|
+
export interface EmailDelivery {
|
|
60
|
+
messageId: string;
|
|
61
|
+
pending: boolean;
|
|
62
|
+
attempts: {
|
|
63
|
+
at: string;
|
|
64
|
+
status?: number;
|
|
65
|
+
error?: string;
|
|
66
|
+
}[];
|
|
67
|
+
}
|
|
38
68
|
export interface EmailInbox {
|
|
39
69
|
id: string;
|
|
40
70
|
address: string;
|
|
@@ -95,10 +125,13 @@ export interface EmailMessage {
|
|
|
95
125
|
}[];
|
|
96
126
|
direction?: 'inbound' | 'outbound';
|
|
97
127
|
deliveryStatus?: 'pending' | 'sent';
|
|
128
|
+
read?: boolean;
|
|
129
|
+
labels?: string[];
|
|
98
130
|
messageId?: string;
|
|
99
131
|
inReplyTo?: string;
|
|
100
132
|
references?: string[];
|
|
101
133
|
}
|
|
134
|
+
export type EmailMessageUpdate = Pick<EmailMessage, 'read' | 'labels'>;
|
|
102
135
|
export interface EmailContent {
|
|
103
136
|
to: string[];
|
|
104
137
|
cc?: string[];
|
|
@@ -117,6 +150,11 @@ export interface EmailThreadSummary {
|
|
|
117
150
|
lastAt: string;
|
|
118
151
|
from: string;
|
|
119
152
|
messageCount: number;
|
|
153
|
+
unread?: boolean;
|
|
154
|
+
hasCode?: boolean;
|
|
155
|
+
hasLink?: boolean;
|
|
156
|
+
hasAttachment?: boolean;
|
|
157
|
+
labels?: string[];
|
|
120
158
|
}
|
|
121
159
|
export interface EmailThread extends EmailThreadSummary {
|
|
122
160
|
messages: EmailMessage[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kivel.io/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public",
|
|
36
36
|
"registry": "https://registry.npmjs.org/",
|
|
37
|
-
"tag": "
|
|
37
|
+
"tag": "latest"
|
|
38
38
|
},
|
|
39
39
|
"main": "./dist/index.js",
|
|
40
40
|
"types": "./dist/index.d.ts",
|