aamp-sdk 0.1.13 → 0.1.15
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 +50 -1
- package/dist/client.d.ts +39 -3
- package/dist/client.js +306 -20
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/jmap-push.d.ts +9 -5
- package/dist/jmap-push.js +19 -6
- package/dist/jmap-push.js.map +1 -1
- package/dist/parser.d.ts +18 -4
- package/dist/parser.js +150 -17
- package/dist/parser.js.map +1 -1
- package/dist/smtp-sender.d.ts +27 -2
- package/dist/smtp-sender.js +442 -12
- package/dist/smtp-sender.js.map +1 -1
- package/dist/thread.d.ts +5 -0
- package/dist/thread.js +53 -0
- package/dist/thread.js.map +1 -0
- package/dist/tiny-emitter.d.ts +0 -1
- package/dist/types.d.ts +179 -18
- package/dist/types.js +5 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/thread.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function singleLine(value, maxLength = 220) {
|
|
2
|
+
const normalized = (value ?? '').replace(/\s+/g, ' ').trim();
|
|
3
|
+
if (!normalized)
|
|
4
|
+
return '';
|
|
5
|
+
if (normalized.length <= maxLength)
|
|
6
|
+
return normalized;
|
|
7
|
+
return `${normalized.slice(0, maxLength - 1)}…`;
|
|
8
|
+
}
|
|
9
|
+
function formatTimestamp(value) {
|
|
10
|
+
const date = new Date(value);
|
|
11
|
+
if (Number.isNaN(date.getTime()))
|
|
12
|
+
return value;
|
|
13
|
+
return date.toISOString().slice(0, 16).replace('T', ' ');
|
|
14
|
+
}
|
|
15
|
+
function renderEventLine(event) {
|
|
16
|
+
const from = event.from.split('@')[0] || event.from;
|
|
17
|
+
const timestamp = formatTimestamp(event.createdAt);
|
|
18
|
+
if (event.intent === 'task.dispatch') {
|
|
19
|
+
const summary = singleLine(event.bodyText) || singleLine(event.title) || 'Task dispatched';
|
|
20
|
+
return `[${timestamp}] ${from} dispatched: ${summary}`;
|
|
21
|
+
}
|
|
22
|
+
if (event.intent === 'task.help_needed') {
|
|
23
|
+
const question = singleLine(event.question) || 'Asked for help';
|
|
24
|
+
const reason = singleLine(event.blockedReason);
|
|
25
|
+
return `[${timestamp}] ${from} asked for help: ${question}${reason ? ` (reason: ${reason})` : ''}`;
|
|
26
|
+
}
|
|
27
|
+
if (event.intent === 'task.result') {
|
|
28
|
+
const output = singleLine(event.output) || singleLine(event.bodyText) || 'Sent a result';
|
|
29
|
+
return `[${timestamp}] ${from} replied: ${output}`;
|
|
30
|
+
}
|
|
31
|
+
if (event.intent === 'task.cancel') {
|
|
32
|
+
const body = singleLine(event.bodyText) || 'Cancelled the task';
|
|
33
|
+
return `[${timestamp}] ${from} cancelled the task: ${body}`;
|
|
34
|
+
}
|
|
35
|
+
if (event.intent === 'task.ack') {
|
|
36
|
+
return `[${timestamp}] ${from} acknowledged the task`;
|
|
37
|
+
}
|
|
38
|
+
return `[${timestamp}] ${from}: ${singleLine(event.bodyText) || event.intent}`;
|
|
39
|
+
}
|
|
40
|
+
export function renderThreadHistoryForAgent(events, options = {}) {
|
|
41
|
+
const filtered = events.filter((event) => event.intent !== 'task.stream.opened');
|
|
42
|
+
if (filtered.length === 0)
|
|
43
|
+
return '';
|
|
44
|
+
const maxEvents = Math.max(1, options.maxEvents ?? 8);
|
|
45
|
+
const visible = filtered.slice(-maxEvents);
|
|
46
|
+
const omitted = filtered.length - visible.length;
|
|
47
|
+
return [
|
|
48
|
+
'Prior thread context:',
|
|
49
|
+
...(omitted > 0 ? [`(${omitted} earlier event(s) omitted)`] : []),
|
|
50
|
+
...visible.map((event) => `- ${renderEventLine(event)}`),
|
|
51
|
+
].join('\n');
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread.js","sourceRoot":"","sources":["../src/thread.ts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,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAA;IACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAEhD,OAAO;QACL,uBAAuB;QACvB,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,4BAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;KACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC"}
|
package/dist/tiny-emitter.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AAMP SDK Type Definitions
|
|
3
3
|
*/
|
|
4
|
-
export declare const AAMP_PROTOCOL_VERSION = "1.
|
|
5
|
-
export type AampIntent = 'task.dispatch' | 'task.result' | 'task.help_needed' | 'task.ack';
|
|
6
|
-
export type
|
|
4
|
+
export declare const AAMP_PROTOCOL_VERSION = "1.1";
|
|
5
|
+
export type AampIntent = 'task.dispatch' | 'task.cancel' | 'task.result' | 'task.help_needed' | 'task.ack' | 'task.stream.opened' | '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";
|
|
@@ -18,7 +20,9 @@ export declare const AAMP_HEADER: {
|
|
|
18
20
|
readonly QUESTION: "X-AAMP-Question";
|
|
19
21
|
readonly BLOCKED_REASON: "X-AAMP-BlockedReason";
|
|
20
22
|
readonly SUGGESTED_OPTIONS: "X-AAMP-SuggestedOptions";
|
|
23
|
+
readonly STREAM_ID: "X-AAMP-Stream-Id";
|
|
21
24
|
readonly PARENT_TASK_ID: "X-AAMP-ParentTaskId";
|
|
25
|
+
readonly CARD_SUMMARY: "X-AAMP-Card-Summary";
|
|
22
26
|
};
|
|
23
27
|
export interface StructuredResultField {
|
|
24
28
|
fieldKey: string;
|
|
@@ -33,7 +37,8 @@ export interface TaskDispatch {
|
|
|
33
37
|
intent: 'task.dispatch';
|
|
34
38
|
taskId: string;
|
|
35
39
|
title: string;
|
|
36
|
-
|
|
40
|
+
priority: TaskPriority;
|
|
41
|
+
expiresAt?: string;
|
|
37
42
|
contextLinks: string[];
|
|
38
43
|
dispatchContext?: Record<string, string>;
|
|
39
44
|
parentTaskId?: string;
|
|
@@ -46,6 +51,16 @@ export interface TaskDispatch {
|
|
|
46
51
|
/** Attachments received with this dispatch (use blobId to download) */
|
|
47
52
|
attachments?: ReceivedAttachment[];
|
|
48
53
|
}
|
|
54
|
+
export interface TaskCancel {
|
|
55
|
+
protocolVersion: string;
|
|
56
|
+
intent: 'task.cancel';
|
|
57
|
+
taskId: string;
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
messageId?: string;
|
|
61
|
+
subject: string;
|
|
62
|
+
bodyText: string;
|
|
63
|
+
}
|
|
49
64
|
export interface TaskResult {
|
|
50
65
|
protocolVersion: string;
|
|
51
66
|
intent: 'task.result';
|
|
@@ -93,6 +108,36 @@ export interface TaskAck {
|
|
|
93
108
|
to: string;
|
|
94
109
|
messageId?: string;
|
|
95
110
|
}
|
|
111
|
+
export interface TaskStreamOpened {
|
|
112
|
+
protocolVersion: string;
|
|
113
|
+
intent: 'task.stream.opened';
|
|
114
|
+
taskId: string;
|
|
115
|
+
streamId: string;
|
|
116
|
+
from: string;
|
|
117
|
+
to: string;
|
|
118
|
+
messageId?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface CardQuery {
|
|
121
|
+
protocolVersion: string;
|
|
122
|
+
intent: 'card.query';
|
|
123
|
+
taskId: string;
|
|
124
|
+
from: string;
|
|
125
|
+
to: string;
|
|
126
|
+
messageId?: string;
|
|
127
|
+
subject: string;
|
|
128
|
+
bodyText: string;
|
|
129
|
+
}
|
|
130
|
+
export interface CardResponse {
|
|
131
|
+
protocolVersion: string;
|
|
132
|
+
intent: 'card.response';
|
|
133
|
+
taskId: string;
|
|
134
|
+
summary: string;
|
|
135
|
+
from: string;
|
|
136
|
+
to: string;
|
|
137
|
+
messageId?: string;
|
|
138
|
+
subject: string;
|
|
139
|
+
bodyText: string;
|
|
140
|
+
}
|
|
96
141
|
/** Attachment for sending (binary content) */
|
|
97
142
|
export interface AampAttachment {
|
|
98
143
|
filename: string;
|
|
@@ -107,19 +152,15 @@ export interface ReceivedAttachment {
|
|
|
107
152
|
size: number;
|
|
108
153
|
blobId: string;
|
|
109
154
|
}
|
|
110
|
-
export type AampMessage = TaskDispatch | TaskResult | TaskHelp | TaskAck | HumanReply;
|
|
155
|
+
export type AampMessage = TaskDispatch | TaskCancel | TaskResult | TaskHelp | TaskAck | TaskStreamOpened | CardQuery | CardResponse | HumanReply;
|
|
111
156
|
export interface AampClientConfig {
|
|
112
157
|
/** Node email address, e.g. codereviewer-abc123@aamp.yourdomain.com */
|
|
113
158
|
email: string;
|
|
114
159
|
/** Mailbox token for HTTP Basic Auth. Equivalent to base64(email:smtpPassword). */
|
|
115
|
-
mailboxToken
|
|
116
|
-
/** @deprecated legacy alias for mailboxToken */
|
|
117
|
-
jmapToken?: string;
|
|
160
|
+
mailboxToken: string;
|
|
118
161
|
/** 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. */
|
|
162
|
+
baseUrl: string;
|
|
163
|
+
/** Optional AAMP discovery base URL. Defaults to baseUrl and is used for same-domain send fallback via /.well-known/aamp + aamp.mailbox.send. */
|
|
123
164
|
httpSendBaseUrl?: string;
|
|
124
165
|
/** SMTP submission host. If omitted, derived from baseUrl. */
|
|
125
166
|
smtpHost?: string;
|
|
@@ -138,7 +179,7 @@ export interface AampMailboxIdentityConfig {
|
|
|
138
179
|
email: string;
|
|
139
180
|
/** Mailbox SMTP/JMAP password */
|
|
140
181
|
smtpPassword: string;
|
|
141
|
-
/** Optional base URL for JMAP and same-domain HTTP send fallback.
|
|
182
|
+
/** Optional base URL for JMAP and same-domain AAMP HTTP send fallback.
|
|
142
183
|
* Defaults to https://<email-domain>. */
|
|
143
184
|
baseUrl?: string;
|
|
144
185
|
/** SMTP submission port (default: 587) */
|
|
@@ -157,6 +198,16 @@ export interface AampDiscoveryDocument {
|
|
|
157
198
|
actions?: string[];
|
|
158
199
|
};
|
|
159
200
|
endpoints?: Record<string, string>;
|
|
201
|
+
capabilities?: {
|
|
202
|
+
stream?: {
|
|
203
|
+
transport: 'sse';
|
|
204
|
+
createAction?: string;
|
|
205
|
+
appendAction?: string;
|
|
206
|
+
closeAction?: string;
|
|
207
|
+
getAction?: string;
|
|
208
|
+
subscribeUrlTemplate?: string;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
160
211
|
}
|
|
161
212
|
export interface RegisterMailboxOptions {
|
|
162
213
|
/** AAMP service root, e.g. https://meshmail.ai */
|
|
@@ -170,19 +221,60 @@ export interface RegisteredMailboxIdentity {
|
|
|
170
221
|
smtpPassword: string;
|
|
171
222
|
baseUrl: string;
|
|
172
223
|
}
|
|
224
|
+
export interface AgentDirectoryEntry {
|
|
225
|
+
email: string;
|
|
226
|
+
summary: string | null;
|
|
227
|
+
}
|
|
228
|
+
export interface AgentDirectorySearchEntry extends AgentDirectoryEntry {
|
|
229
|
+
score: number;
|
|
230
|
+
}
|
|
231
|
+
export interface AgentDirectoryProfile extends AgentDirectoryEntry {
|
|
232
|
+
cardText: string | null;
|
|
233
|
+
}
|
|
234
|
+
export interface AampThreadEvent {
|
|
235
|
+
intent: AampIntent;
|
|
236
|
+
from: string;
|
|
237
|
+
to: string;
|
|
238
|
+
title?: string | null;
|
|
239
|
+
bodyText?: string | null;
|
|
240
|
+
output?: string | null;
|
|
241
|
+
question?: string | null;
|
|
242
|
+
blockedReason?: string | null;
|
|
243
|
+
messageId?: string | null;
|
|
244
|
+
createdAt: string;
|
|
245
|
+
}
|
|
246
|
+
export interface GetThreadHistoryOptions {
|
|
247
|
+
includeStreamOpened?: boolean;
|
|
248
|
+
}
|
|
249
|
+
export interface TaskThreadHistory {
|
|
250
|
+
taskId: string;
|
|
251
|
+
events: AampThreadEvent[];
|
|
252
|
+
}
|
|
253
|
+
export interface HydratedTaskDispatch extends TaskDispatch {
|
|
254
|
+
threadHistory: AampThreadEvent[];
|
|
255
|
+
threadContextText: string;
|
|
256
|
+
}
|
|
173
257
|
export interface SendTaskOptions {
|
|
174
258
|
/** Target node email */
|
|
175
259
|
to: string;
|
|
176
260
|
taskId?: string;
|
|
177
261
|
title: string;
|
|
178
262
|
bodyText?: string;
|
|
179
|
-
|
|
263
|
+
priority?: TaskPriority;
|
|
264
|
+
/** Absolute expiry timestamp. */
|
|
265
|
+
expiresAt?: string;
|
|
180
266
|
contextLinks?: string[];
|
|
181
267
|
dispatchContext?: Record<string, string>;
|
|
182
268
|
parentTaskId?: string;
|
|
183
269
|
/** Attachments to include with the dispatch email */
|
|
184
270
|
attachments?: AampAttachment[];
|
|
185
271
|
}
|
|
272
|
+
export interface SendCancelOptions {
|
|
273
|
+
to: string;
|
|
274
|
+
taskId: string;
|
|
275
|
+
bodyText?: string;
|
|
276
|
+
inReplyTo?: string;
|
|
277
|
+
}
|
|
186
278
|
export interface SendResultOptions {
|
|
187
279
|
/** Send to: the original from address of the dispatch email */
|
|
188
280
|
to: string;
|
|
@@ -208,13 +300,83 @@ export interface SendHelpOptions {
|
|
|
208
300
|
/** Attachments to include with the help email */
|
|
209
301
|
attachments?: AampAttachment[];
|
|
210
302
|
}
|
|
303
|
+
export interface SendCardQueryOptions {
|
|
304
|
+
to: string;
|
|
305
|
+
taskId?: string;
|
|
306
|
+
bodyText?: string;
|
|
307
|
+
inReplyTo?: string;
|
|
308
|
+
}
|
|
309
|
+
export interface SendCardResponseOptions {
|
|
310
|
+
to: string;
|
|
311
|
+
taskId: string;
|
|
312
|
+
summary: string;
|
|
313
|
+
bodyText: string;
|
|
314
|
+
inReplyTo?: string;
|
|
315
|
+
}
|
|
316
|
+
export interface CreateStreamOptions {
|
|
317
|
+
taskId: string;
|
|
318
|
+
peerEmail: string;
|
|
319
|
+
}
|
|
320
|
+
export interface CreateStreamResult {
|
|
321
|
+
streamId: string;
|
|
322
|
+
taskId: string;
|
|
323
|
+
status: 'created' | 'opened' | 'closed';
|
|
324
|
+
ownerEmail: string;
|
|
325
|
+
peerEmail: string;
|
|
326
|
+
createdAt: string;
|
|
327
|
+
openedAt?: string;
|
|
328
|
+
closedAt?: string;
|
|
329
|
+
}
|
|
330
|
+
export type AampStreamEventType = 'text.delta' | 'progress' | 'status' | 'artifact' | 'error' | 'done';
|
|
331
|
+
export interface AampStreamEvent {
|
|
332
|
+
id?: string;
|
|
333
|
+
streamId: string;
|
|
334
|
+
taskId: string;
|
|
335
|
+
seq: number;
|
|
336
|
+
timestamp: string;
|
|
337
|
+
type: AampStreamEventType;
|
|
338
|
+
payload: Record<string, unknown>;
|
|
339
|
+
}
|
|
340
|
+
export interface AppendStreamEventOptions {
|
|
341
|
+
streamId: string;
|
|
342
|
+
type: AampStreamEventType;
|
|
343
|
+
payload: Record<string, unknown>;
|
|
344
|
+
}
|
|
345
|
+
export interface CloseStreamOptions {
|
|
346
|
+
streamId: string;
|
|
347
|
+
payload?: Record<string, unknown>;
|
|
348
|
+
}
|
|
349
|
+
export interface GetTaskStreamOptions {
|
|
350
|
+
taskId?: string;
|
|
351
|
+
streamId?: string;
|
|
352
|
+
}
|
|
353
|
+
export interface TaskStreamState extends CreateStreamResult {
|
|
354
|
+
latestEvent?: AampStreamEvent;
|
|
355
|
+
}
|
|
356
|
+
export interface StreamSubscription {
|
|
357
|
+
close(): void;
|
|
358
|
+
}
|
|
359
|
+
export interface DirectoryListOptions {
|
|
360
|
+
scope?: string;
|
|
361
|
+
includeSelf?: boolean;
|
|
362
|
+
limit?: number;
|
|
363
|
+
}
|
|
364
|
+
export interface DirectorySearchOptions extends DirectoryListOptions {
|
|
365
|
+
query: string;
|
|
366
|
+
}
|
|
367
|
+
export interface UpdateDirectoryProfileOptions {
|
|
368
|
+
summary?: string | null;
|
|
369
|
+
cardText?: string | null;
|
|
370
|
+
}
|
|
211
371
|
export interface AampClientEvents {
|
|
212
372
|
'task.dispatch': (task: TaskDispatch) => void;
|
|
373
|
+
'task.cancel': (task: TaskCancel) => void;
|
|
213
374
|
'task.result': (result: TaskResult) => void;
|
|
214
375
|
'task.help_needed': (help: TaskHelp) => void;
|
|
215
|
-
/** @deprecated compatibility alias for task.help_needed */
|
|
216
|
-
'task.help': (help: TaskHelp) => void;
|
|
217
376
|
'task.ack': (ack: TaskAck) => void;
|
|
377
|
+
'task.stream.opened': (stream: TaskStreamOpened) => void;
|
|
378
|
+
'card.query': (query: CardQuery) => void;
|
|
379
|
+
'card.response': (response: CardResponse) => void;
|
|
218
380
|
/** Emitted when a standard email reply (no X-AAMP headers) is received for a known thread.
|
|
219
381
|
* Use inReplyTo to look up the taskId in your own store (Redis / DB). */
|
|
220
382
|
'reply': (reply: HumanReply) => void;
|
|
@@ -222,4 +384,3 @@ export interface AampClientEvents {
|
|
|
222
384
|
disconnected: (reason: string) => void;
|
|
223
385
|
error: (err: Error) => void;
|
|
224
386
|
}
|
|
225
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AAMP SDK Type Definitions
|
|
3
3
|
*/
|
|
4
|
-
export const AAMP_PROTOCOL_VERSION = '1.
|
|
4
|
+
export const AAMP_PROTOCOL_VERSION = '1.1';
|
|
5
5
|
// =====================================================
|
|
6
6
|
// AAMP Header constants
|
|
7
7
|
// =====================================================
|
|
@@ -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',
|
|
@@ -19,6 +20,8 @@ export const AAMP_HEADER = {
|
|
|
19
20
|
QUESTION: 'X-AAMP-Question',
|
|
20
21
|
BLOCKED_REASON: 'X-AAMP-BlockedReason',
|
|
21
22
|
SUGGESTED_OPTIONS: 'X-AAMP-SuggestedOptions',
|
|
23
|
+
STREAM_ID: 'X-AAMP-Stream-Id',
|
|
22
24
|
PARENT_TASK_ID: 'X-AAMP-ParentTaskId',
|
|
25
|
+
CARD_SUMMARY: 'X-AAMP-Card-Summary',
|
|
23
26
|
};
|
|
24
27
|
//# 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;AAwB1C,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,SAAS,EAAE,kBAAkB;IAC7B,cAAc,EAAE,qBAAqB;IACrC,YAAY,EAAE,qBAAqB;CAC3B,CAAA"}
|