aamp-sdk 0.1.24 → 0.1.26
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 +18 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +10 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,8 +36,11 @@ client.on('task.dispatch', async (task) => {
|
|
|
36
36
|
|
|
37
37
|
await client.appendStreamEvent({
|
|
38
38
|
streamId: stream.streamId,
|
|
39
|
-
type: '
|
|
40
|
-
payload: {
|
|
39
|
+
type: 'todo',
|
|
40
|
+
payload: {
|
|
41
|
+
items: [{ id: 'task', content: 'Processing request', status: 'in_progress' }],
|
|
42
|
+
summary: 'Processing request',
|
|
43
|
+
},
|
|
41
44
|
})
|
|
42
45
|
|
|
43
46
|
await client.sendResult({
|
|
@@ -65,7 +68,7 @@ The SDK supports the AAMP realtime stream capability announced from
|
|
|
65
68
|
|
|
66
69
|
- `createStream()` creates or reuses the active stream for a task
|
|
67
70
|
- `sendStreamOpened()` sends the mailbox notification intent
|
|
68
|
-
- `appendStreamEvent()` appends `text.delta`, `
|
|
71
|
+
- `appendStreamEvent()` appends `text.delta`, `todo`, `tool_call`, or `artifact`
|
|
69
72
|
- `closeStream()` closes the stream before the final `task.result`
|
|
70
73
|
|
|
71
74
|
Stream events use a stable AAMP envelope:
|
|
@@ -78,7 +81,7 @@ Stream events use a stable AAMP envelope:
|
|
|
78
81
|
seq: 1,
|
|
79
82
|
timestamp: '2026-06-10T10:00:00.000Z',
|
|
80
83
|
type: 'text.delta',
|
|
81
|
-
payload: { text: 'Hello'
|
|
84
|
+
payload: { text: 'Hello' },
|
|
82
85
|
}
|
|
83
86
|
```
|
|
84
87
|
|
|
@@ -87,33 +90,33 @@ and bridge cards render consistently:
|
|
|
87
90
|
|
|
88
91
|
| Type | Payload fields used by cards |
|
|
89
92
|
| --- | --- |
|
|
90
|
-
| `text.delta` | `{ text: string,
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
+
| `text.delta` | `{ text: string, messageId?: string, sourceEvent?: string }` appends visible agent text. |
|
|
94
|
+
| `todo` | `{ items: Array<{ id: string, content: string, status: "pending" | "in_progress" | "completed" }>, summary?: string }` replaces the pinned task list in agent cards. |
|
|
95
|
+
| `tool_call` | `{ toolCallId: string, label: string, status: "pending" | "running" | "completed" | "failed", input?: string, output?: string }` renders tool activity. |
|
|
93
96
|
| `artifact` | `{ label: string, artifactId?: string, filename?: string, contentType?: string, url?: string, size?: number, kind?: string }` announces a produced artifact. |
|
|
94
|
-
| `todo` | `{ items: Array<{ id: string, content: string, status: "pending" | "in_progress" | "completed" }>, kind?: "added" | "updated" | "resumed", lastChange?: object, counts?: object, summary?: string }` updates the pinned task list in agent cards. |
|
|
95
|
-
| `error` | `{ message: string, code?: string, recoverable?: boolean }` renders a stream error. |
|
|
96
|
-
| `done` | `{ status: "completed" | "rejected" | "cancelled", reason?: string, error?: string, output?: string }` marks the observation stream terminal. The authoritative completion is still `task.result`. |
|
|
97
97
|
|
|
98
98
|
Minimal custom-agent stream:
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
101
|
await client.appendStreamEvent({
|
|
102
102
|
streamId: stream.streamId,
|
|
103
|
-
type: '
|
|
104
|
-
payload: {
|
|
103
|
+
type: 'todo',
|
|
104
|
+
payload: {
|
|
105
|
+
items: [{ id: 'plan', content: 'Plan the next step', status: 'in_progress' }],
|
|
106
|
+
summary: 'Agent is planning',
|
|
107
|
+
},
|
|
105
108
|
})
|
|
106
109
|
|
|
107
110
|
await client.appendStreamEvent({
|
|
108
111
|
streamId: stream.streamId,
|
|
109
112
|
type: 'text.delta',
|
|
110
|
-
payload: { text: 'I found the issue.'
|
|
113
|
+
payload: { text: 'I found the issue.' },
|
|
111
114
|
})
|
|
112
115
|
|
|
113
116
|
await client.appendStreamEvent({
|
|
114
117
|
streamId: stream.streamId,
|
|
115
|
-
type: '
|
|
116
|
-
payload: { label: 'Tool completed: tests', status: 'completed'
|
|
118
|
+
type: 'tool_call',
|
|
119
|
+
payload: { toolCallId: 'tests', label: 'Tool completed: tests', status: 'completed' },
|
|
117
120
|
})
|
|
118
121
|
|
|
119
122
|
await client.closeStream({
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export { JmapPushClient } from './jmap-push.js';
|
|
|
12
12
|
export { SmtpSender, deriveMailboxServiceDefaults } from './smtp-sender.js';
|
|
13
13
|
export { renderThreadHistoryForAgent } from './thread.js';
|
|
14
14
|
export { DEFAULT_PAIRING_WEB_URL, buildPairingWebUrl, buildPairingUrl, consumePairingCode, createPairedSenderPolicy, createPairingCode, isPairingUrl, matchPairedSenderPolicy, normalizeDispatchContextRules, pairingUrlToWebUrl, parsePairingUrl, upsertPairedSenderPolicy, } from './pairing.js';
|
|
15
|
-
export type { AampIntent, TaskStatus, AampAttachment, ReceivedAttachment, StructuredResultField, TaskDispatch, TaskCancel, TaskResult, TaskHelp, TaskAck, TaskStreamOpened, PairRequest, PairRespond, CardQuery, CardResponse, HumanReply, AampStreamEventType, AampStreamEvent, AampStreamPayloadByType, AampTextDeltaStreamPayload,
|
|
15
|
+
export type { AampIntent, TaskStatus, AampAttachment, ReceivedAttachment, StructuredResultField, TaskDispatch, TaskCancel, TaskResult, TaskHelp, TaskAck, TaskStreamOpened, PairRequest, PairRespond, CardQuery, CardResponse, HumanReply, AampStreamEventType, AampStreamEvent, AampStreamPayloadByType, AampTextDeltaStreamPayload, AampToolCallStreamPayload, AampArtifactStreamPayload, AampTodoStreamPayload, AampTodoStreamItem, AampStreamProgressStatus, AampTodoItemStatus, AppendStreamEventOptions, CreateStreamOptions, CreateStreamResult, CloseStreamOptions, TaskStreamState, StreamSubscription, AgentDirectoryEntry, AgentDirectorySearchEntry, AgentDirectoryProfile, AampThreadEvent, AampMessage, AampClientConfig, AampMailboxIdentityConfig, AampDiscoveryDocument, GetThreadHistoryOptions, HydratedTaskDispatch, RegisterMailboxOptions, RegisteredMailboxIdentity, RegisteredCommandDispatchPayload, RegisteredCommandInputRef, RegisteredCommandStreamMode, AampClientEvents, SendRegisteredCommandOptions, SendTaskOptions, SendCancelOptions, SendResultOptions, SendHelpOptions, SendPairRequestOptions, SendPairRespondOptions, SendCardQueryOptions, SendCardResponseOptions, GetTaskStreamOptions, DirectoryListOptions, DirectorySearchOptions, TaskThreadHistory, UpdateDirectoryProfileOptions, } from './types.js';
|
|
16
16
|
export type { ConsumePairingCodeOptions, CreatePairingCodeOptions, DispatchContextRules, PairingCode, PairingUrlPayload, PairableSenderLike, PairedSenderPolicy, } from './pairing.js';
|
|
17
17
|
export { AAMP_HEADER, AAMP_PROTOCOL_VERSION } from './types.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;AA6ErB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -423,31 +423,20 @@ export interface CreateStreamResult {
|
|
|
423
423
|
openedAt?: string;
|
|
424
424
|
closedAt?: string;
|
|
425
425
|
}
|
|
426
|
-
export type AampStreamEventType = 'text.delta' | '
|
|
427
|
-
export type
|
|
428
|
-
export type
|
|
429
|
-
export type AampStreamDoneStatus = 'completed' | 'rejected' | 'cancelled' | (string & {});
|
|
430
|
-
export type AampTodoItemStatus = 'pending' | 'in_progress' | 'completed' | (string & {});
|
|
426
|
+
export type AampStreamEventType = 'text.delta' | 'todo' | 'tool_call' | 'artifact';
|
|
427
|
+
export type AampStreamProgressStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
428
|
+
export type AampTodoItemStatus = 'pending' | 'in_progress' | 'completed';
|
|
431
429
|
export interface AampTextDeltaStreamPayload {
|
|
432
430
|
text: string;
|
|
433
|
-
channel?: AampStreamTextChannel;
|
|
434
431
|
messageId?: string;
|
|
435
432
|
sourceEvent?: string;
|
|
436
433
|
}
|
|
437
|
-
export interface
|
|
434
|
+
export interface AampToolCallStreamPayload {
|
|
435
|
+
toolCallId: string;
|
|
438
436
|
label: string;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
export interface AampProgressStreamPayload {
|
|
443
|
-
label: string;
|
|
444
|
-
value?: number;
|
|
445
|
-
status?: AampStreamProgressStatus;
|
|
446
|
-
toolCallId?: string;
|
|
447
|
-
title?: string;
|
|
448
|
-
kind?: string;
|
|
449
|
-
chunk?: string;
|
|
450
|
-
locations?: unknown[];
|
|
437
|
+
status: AampStreamProgressStatus;
|
|
438
|
+
input?: string;
|
|
439
|
+
output?: string;
|
|
451
440
|
}
|
|
452
441
|
export interface AampArtifactStreamPayload {
|
|
453
442
|
label: string;
|
|
@@ -462,45 +451,16 @@ export interface AampTodoStreamItem {
|
|
|
462
451
|
id: string;
|
|
463
452
|
content: string;
|
|
464
453
|
status: AampTodoItemStatus;
|
|
465
|
-
createdAtMs?: number;
|
|
466
|
-
updatedAtMs?: number;
|
|
467
454
|
}
|
|
468
455
|
export interface AampTodoStreamPayload {
|
|
469
456
|
items: AampTodoStreamItem[];
|
|
470
|
-
kind?: 'added' | 'updated' | 'resumed' | 'completed' | 'in_progress' | (string & {});
|
|
471
|
-
lastChange?: {
|
|
472
|
-
id?: string;
|
|
473
|
-
previousStatus?: AampTodoItemStatus;
|
|
474
|
-
status?: AampTodoItemStatus;
|
|
475
|
-
};
|
|
476
|
-
counts?: {
|
|
477
|
-
total?: number;
|
|
478
|
-
pending?: number;
|
|
479
|
-
inProgress?: number;
|
|
480
|
-
completed?: number;
|
|
481
|
-
};
|
|
482
457
|
summary?: string;
|
|
483
458
|
}
|
|
484
|
-
export interface AampErrorStreamPayload {
|
|
485
|
-
message: string;
|
|
486
|
-
code?: string;
|
|
487
|
-
error?: string;
|
|
488
|
-
recoverable?: boolean;
|
|
489
|
-
}
|
|
490
|
-
export interface AampDoneStreamPayload {
|
|
491
|
-
status: AampStreamDoneStatus;
|
|
492
|
-
reason?: string;
|
|
493
|
-
error?: string;
|
|
494
|
-
output?: string;
|
|
495
|
-
}
|
|
496
459
|
export interface AampStreamPayloadByType {
|
|
497
460
|
'text.delta': AampTextDeltaStreamPayload;
|
|
498
|
-
progress: AampProgressStreamPayload;
|
|
499
|
-
status: AampStatusStreamPayload;
|
|
500
|
-
artifact: AampArtifactStreamPayload;
|
|
501
461
|
todo: AampTodoStreamPayload;
|
|
502
|
-
|
|
503
|
-
|
|
462
|
+
tool_call: AampToolCallStreamPayload;
|
|
463
|
+
artifact: AampArtifactStreamPayload;
|
|
504
464
|
}
|
|
505
465
|
export interface AampStreamEvent {
|
|
506
466
|
id?: string;
|