aamp-sdk 0.1.12 → 0.1.14
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 +22 -1
- package/dist/client.d.ts +14 -3
- package/dist/client.js +105 -20
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jmap-push.d.ts +8 -5
- package/dist/jmap-push.js +16 -6
- package/dist/jmap-push.js.map +1 -1
- package/dist/parser.d.ts +14 -4
- package/dist/parser.js +127 -17
- package/dist/parser.js.map +1 -1
- package/dist/smtp-sender.d.ts +12 -2
- package/dist/smtp-sender.js +118 -6
- package/dist/smtp-sender.js.map +1 -1
- package/dist/tiny-emitter.d.ts +0 -1
- package/dist/types.d.ts +91 -17
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* AAMP SDK Type Definitions
|
|
3
3
|
*/
|
|
4
4
|
export declare const AAMP_PROTOCOL_VERSION = "1.0";
|
|
5
|
-
export type AampIntent = 'task.dispatch' | 'task.result' | 'task.help_needed' | 'task.ack';
|
|
6
|
-
export type
|
|
5
|
+
export type AampIntent = 'task.dispatch' | 'task.cancel' | 'task.result' | 'task.help_needed' | 'task.ack' | 'card.query' | 'card.response';
|
|
6
|
+
export type TaskPriority = 'urgent' | 'high' | 'normal';
|
|
7
|
+
export type TaskStatus = 'pending' | 'running' | 'completed' | 'rejected' | 'failed' | 'help_needed' | 'cancelled' | 'expired';
|
|
7
8
|
export declare const AAMP_HEADER: {
|
|
8
9
|
readonly VERSION: "X-AAMP-Version";
|
|
9
10
|
readonly INTENT: "X-AAMP-Intent";
|
|
10
11
|
readonly TASK_ID: "X-AAMP-TaskId";
|
|
11
|
-
readonly TIMEOUT: "X-AAMP-Timeout";
|
|
12
12
|
readonly CONTEXT_LINKS: "X-AAMP-ContextLinks";
|
|
13
13
|
readonly DISPATCH_CONTEXT: "X-AAMP-Dispatch-Context";
|
|
14
|
+
readonly PRIORITY: "X-AAMP-Priority";
|
|
15
|
+
readonly EXPIRES_AT: "X-AAMP-Expires-At";
|
|
14
16
|
readonly STATUS: "X-AAMP-Status";
|
|
15
17
|
readonly OUTPUT: "X-AAMP-Output";
|
|
16
18
|
readonly ERROR_MSG: "X-AAMP-ErrorMsg";
|
|
@@ -19,6 +21,7 @@ export declare const AAMP_HEADER: {
|
|
|
19
21
|
readonly BLOCKED_REASON: "X-AAMP-BlockedReason";
|
|
20
22
|
readonly SUGGESTED_OPTIONS: "X-AAMP-SuggestedOptions";
|
|
21
23
|
readonly PARENT_TASK_ID: "X-AAMP-ParentTaskId";
|
|
24
|
+
readonly CARD_SUMMARY: "X-AAMP-Card-Summary";
|
|
22
25
|
};
|
|
23
26
|
export interface StructuredResultField {
|
|
24
27
|
fieldKey: string;
|
|
@@ -33,7 +36,8 @@ export interface TaskDispatch {
|
|
|
33
36
|
intent: 'task.dispatch';
|
|
34
37
|
taskId: string;
|
|
35
38
|
title: string;
|
|
36
|
-
|
|
39
|
+
priority: TaskPriority;
|
|
40
|
+
expiresAt?: string;
|
|
37
41
|
contextLinks: string[];
|
|
38
42
|
dispatchContext?: Record<string, string>;
|
|
39
43
|
parentTaskId?: string;
|
|
@@ -46,6 +50,16 @@ export interface TaskDispatch {
|
|
|
46
50
|
/** Attachments received with this dispatch (use blobId to download) */
|
|
47
51
|
attachments?: ReceivedAttachment[];
|
|
48
52
|
}
|
|
53
|
+
export interface TaskCancel {
|
|
54
|
+
protocolVersion: string;
|
|
55
|
+
intent: 'task.cancel';
|
|
56
|
+
taskId: string;
|
|
57
|
+
from: string;
|
|
58
|
+
to: string;
|
|
59
|
+
messageId?: string;
|
|
60
|
+
subject: string;
|
|
61
|
+
bodyText: string;
|
|
62
|
+
}
|
|
49
63
|
export interface TaskResult {
|
|
50
64
|
protocolVersion: string;
|
|
51
65
|
intent: 'task.result';
|
|
@@ -93,6 +107,27 @@ export interface TaskAck {
|
|
|
93
107
|
to: string;
|
|
94
108
|
messageId?: string;
|
|
95
109
|
}
|
|
110
|
+
export interface CardQuery {
|
|
111
|
+
protocolVersion: string;
|
|
112
|
+
intent: 'card.query';
|
|
113
|
+
taskId: string;
|
|
114
|
+
from: string;
|
|
115
|
+
to: string;
|
|
116
|
+
messageId?: string;
|
|
117
|
+
subject: string;
|
|
118
|
+
bodyText: string;
|
|
119
|
+
}
|
|
120
|
+
export interface CardResponse {
|
|
121
|
+
protocolVersion: string;
|
|
122
|
+
intent: 'card.response';
|
|
123
|
+
taskId: string;
|
|
124
|
+
summary: string;
|
|
125
|
+
from: string;
|
|
126
|
+
to: string;
|
|
127
|
+
messageId?: string;
|
|
128
|
+
subject: string;
|
|
129
|
+
bodyText: string;
|
|
130
|
+
}
|
|
96
131
|
/** Attachment for sending (binary content) */
|
|
97
132
|
export interface AampAttachment {
|
|
98
133
|
filename: string;
|
|
@@ -107,19 +142,15 @@ export interface ReceivedAttachment {
|
|
|
107
142
|
size: number;
|
|
108
143
|
blobId: string;
|
|
109
144
|
}
|
|
110
|
-
export type AampMessage = TaskDispatch | TaskResult | TaskHelp | TaskAck | HumanReply;
|
|
145
|
+
export type AampMessage = TaskDispatch | TaskCancel | TaskResult | TaskHelp | TaskAck | CardQuery | CardResponse | HumanReply;
|
|
111
146
|
export interface AampClientConfig {
|
|
112
147
|
/** Node email address, e.g. codereviewer-abc123@aamp.yourdomain.com */
|
|
113
148
|
email: string;
|
|
114
149
|
/** Mailbox token for HTTP Basic Auth. Equivalent to base64(email:smtpPassword). */
|
|
115
|
-
mailboxToken
|
|
116
|
-
/** @deprecated legacy alias for mailboxToken */
|
|
117
|
-
jmapToken?: string;
|
|
150
|
+
mailboxToken: string;
|
|
118
151
|
/** Base URL for this mailbox service, e.g. https://meshmail.ai */
|
|
119
|
-
baseUrl
|
|
120
|
-
/**
|
|
121
|
-
jmapUrl?: string;
|
|
122
|
-
/** Optional HTTP send base URL. Defaults to baseUrl and is used for same-domain send fallback via /api/send. */
|
|
152
|
+
baseUrl: string;
|
|
153
|
+
/** Optional AAMP discovery base URL. Defaults to baseUrl and is used for same-domain send fallback via /.well-known/aamp + aamp.mailbox.send. */
|
|
123
154
|
httpSendBaseUrl?: string;
|
|
124
155
|
/** SMTP submission host. If omitted, derived from baseUrl. */
|
|
125
156
|
smtpHost?: string;
|
|
@@ -138,7 +169,7 @@ export interface AampMailboxIdentityConfig {
|
|
|
138
169
|
email: string;
|
|
139
170
|
/** Mailbox SMTP/JMAP password */
|
|
140
171
|
smtpPassword: string;
|
|
141
|
-
/** Optional base URL for JMAP and same-domain HTTP send fallback.
|
|
172
|
+
/** Optional base URL for JMAP and same-domain AAMP HTTP send fallback.
|
|
142
173
|
* Defaults to https://<email-domain>. */
|
|
143
174
|
baseUrl?: string;
|
|
144
175
|
/** SMTP submission port (default: 587) */
|
|
@@ -170,19 +201,37 @@ export interface RegisteredMailboxIdentity {
|
|
|
170
201
|
smtpPassword: string;
|
|
171
202
|
baseUrl: string;
|
|
172
203
|
}
|
|
204
|
+
export interface AgentDirectoryEntry {
|
|
205
|
+
email: string;
|
|
206
|
+
summary: string | null;
|
|
207
|
+
}
|
|
208
|
+
export interface AgentDirectorySearchEntry extends AgentDirectoryEntry {
|
|
209
|
+
score: number;
|
|
210
|
+
}
|
|
211
|
+
export interface AgentDirectoryProfile extends AgentDirectoryEntry {
|
|
212
|
+
cardText: string | null;
|
|
213
|
+
}
|
|
173
214
|
export interface SendTaskOptions {
|
|
174
215
|
/** Target node email */
|
|
175
216
|
to: string;
|
|
176
217
|
taskId?: string;
|
|
177
218
|
title: string;
|
|
178
219
|
bodyText?: string;
|
|
179
|
-
|
|
220
|
+
priority?: TaskPriority;
|
|
221
|
+
/** Absolute expiry timestamp. */
|
|
222
|
+
expiresAt?: string;
|
|
180
223
|
contextLinks?: string[];
|
|
181
224
|
dispatchContext?: Record<string, string>;
|
|
182
225
|
parentTaskId?: string;
|
|
183
226
|
/** Attachments to include with the dispatch email */
|
|
184
227
|
attachments?: AampAttachment[];
|
|
185
228
|
}
|
|
229
|
+
export interface SendCancelOptions {
|
|
230
|
+
to: string;
|
|
231
|
+
taskId: string;
|
|
232
|
+
bodyText?: string;
|
|
233
|
+
inReplyTo?: string;
|
|
234
|
+
}
|
|
186
235
|
export interface SendResultOptions {
|
|
187
236
|
/** Send to: the original from address of the dispatch email */
|
|
188
237
|
to: string;
|
|
@@ -208,13 +257,39 @@ export interface SendHelpOptions {
|
|
|
208
257
|
/** Attachments to include with the help email */
|
|
209
258
|
attachments?: AampAttachment[];
|
|
210
259
|
}
|
|
260
|
+
export interface SendCardQueryOptions {
|
|
261
|
+
to: string;
|
|
262
|
+
taskId?: string;
|
|
263
|
+
bodyText?: string;
|
|
264
|
+
inReplyTo?: string;
|
|
265
|
+
}
|
|
266
|
+
export interface SendCardResponseOptions {
|
|
267
|
+
to: string;
|
|
268
|
+
taskId: string;
|
|
269
|
+
summary: string;
|
|
270
|
+
bodyText: string;
|
|
271
|
+
inReplyTo?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface DirectoryListOptions {
|
|
274
|
+
scope?: string;
|
|
275
|
+
includeSelf?: boolean;
|
|
276
|
+
limit?: number;
|
|
277
|
+
}
|
|
278
|
+
export interface DirectorySearchOptions extends DirectoryListOptions {
|
|
279
|
+
query: string;
|
|
280
|
+
}
|
|
281
|
+
export interface UpdateDirectoryProfileOptions {
|
|
282
|
+
summary?: string | null;
|
|
283
|
+
cardText?: string | null;
|
|
284
|
+
}
|
|
211
285
|
export interface AampClientEvents {
|
|
212
286
|
'task.dispatch': (task: TaskDispatch) => void;
|
|
287
|
+
'task.cancel': (task: TaskCancel) => void;
|
|
213
288
|
'task.result': (result: TaskResult) => void;
|
|
214
289
|
'task.help_needed': (help: TaskHelp) => void;
|
|
215
|
-
/** @deprecated compatibility alias for task.help_needed */
|
|
216
|
-
'task.help': (help: TaskHelp) => void;
|
|
217
290
|
'task.ack': (ack: TaskAck) => void;
|
|
291
|
+
'card.query': (query: CardQuery) => void;
|
|
292
|
+
'card.response': (response: CardResponse) => void;
|
|
218
293
|
/** Emitted when a standard email reply (no X-AAMP headers) is received for a known thread.
|
|
219
294
|
* Use inReplyTo to look up the taskId in your own store (Redis / DB). */
|
|
220
295
|
'reply': (reply: HumanReply) => void;
|
|
@@ -222,4 +297,3 @@ export interface AampClientEvents {
|
|
|
222
297
|
disconnected: (reason: string) => void;
|
|
223
298
|
error: (err: Error) => void;
|
|
224
299
|
}
|
|
225
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -9,9 +9,10 @@ export const AAMP_HEADER = {
|
|
|
9
9
|
VERSION: 'X-AAMP-Version',
|
|
10
10
|
INTENT: 'X-AAMP-Intent',
|
|
11
11
|
TASK_ID: 'X-AAMP-TaskId',
|
|
12
|
-
TIMEOUT: 'X-AAMP-Timeout',
|
|
13
12
|
CONTEXT_LINKS: 'X-AAMP-ContextLinks',
|
|
14
13
|
DISPATCH_CONTEXT: 'X-AAMP-Dispatch-Context',
|
|
14
|
+
PRIORITY: 'X-AAMP-Priority',
|
|
15
|
+
EXPIRES_AT: 'X-AAMP-Expires-At',
|
|
15
16
|
STATUS: 'X-AAMP-Status',
|
|
16
17
|
OUTPUT: 'X-AAMP-Output',
|
|
17
18
|
ERROR_MSG: 'X-AAMP-ErrorMsg',
|
|
@@ -20,5 +21,6 @@ export const AAMP_HEADER = {
|
|
|
20
21
|
BLOCKED_REASON: 'X-AAMP-BlockedReason',
|
|
21
22
|
SUGGESTED_OPTIONS: 'X-AAMP-SuggestedOptions',
|
|
22
23
|
PARENT_TASK_ID: 'X-AAMP-ParentTaskId',
|
|
24
|
+
CARD_SUMMARY: 'X-AAMP-Card-Summary',
|
|
23
25
|
};
|
|
24
26
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAuB1C,wDAAwD;AACxD,wBAAwB;AACxB,wDAAwD;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,eAAe;IACxB,aAAa,EAAE,qBAAqB;IACpC,gBAAgB,EAAE,yBAAyB;IAC3C,QAAQ,EAAE,iBAAiB;IAC3B,UAAU,EAAE,mBAAmB;IAC/B,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,SAAS,EAAE,iBAAiB;IAC5B,iBAAiB,EAAE,yBAAyB;IAC5C,QAAQ,EAAE,iBAAiB;IAC3B,cAAc,EAAE,sBAAsB;IACtC,iBAAiB,EAAE,yBAAyB;IAC5C,cAAc,EAAE,qBAAqB;IACrC,YAAY,EAAE,qBAAqB;CAC3B,CAAA"}
|