@multi-agent-protocol/sdk 0.0.7 → 0.0.8
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/dist/{index-BQXp4_rd.d.cts → index-BVvyY2kb.d.cts} +794 -3
- package/dist/{index-BQXp4_rd.d.ts → index-BVvyY2kb.d.ts} +794 -3
- package/dist/index.cjs +500 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +499 -5
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +392 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +392 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -111,7 +111,16 @@ var EVENT_TYPES = {
|
|
|
111
111
|
SYSTEM_ERROR: "system_error",
|
|
112
112
|
// Federation events
|
|
113
113
|
FEDERATION_CONNECTED: "federation_connected",
|
|
114
|
-
FEDERATION_DISCONNECTED: "federation_disconnected"
|
|
114
|
+
FEDERATION_DISCONNECTED: "federation_disconnected",
|
|
115
|
+
// Mail events
|
|
116
|
+
MAIL_CREATED: "mail.created",
|
|
117
|
+
MAIL_CLOSED: "mail.closed",
|
|
118
|
+
MAIL_PARTICIPANT_JOINED: "mail.participant.joined",
|
|
119
|
+
MAIL_PARTICIPANT_LEFT: "mail.participant.left",
|
|
120
|
+
MAIL_TURN_ADDED: "mail.turn.added",
|
|
121
|
+
MAIL_TURN_UPDATED: "mail.turn.updated",
|
|
122
|
+
MAIL_THREAD_CREATED: "mail.thread.created",
|
|
123
|
+
MAIL_SUMMARY_GENERATED: "mail.summary.generated"
|
|
115
124
|
};
|
|
116
125
|
function createEvent(input) {
|
|
117
126
|
return {
|
|
@@ -177,6 +186,21 @@ var FEDERATION_METHODS = {
|
|
|
177
186
|
FEDERATION_CONNECT: "map/federation/connect",
|
|
178
187
|
FEDERATION_ROUTE: "map/federation/route"
|
|
179
188
|
};
|
|
189
|
+
var MAIL_METHODS = {
|
|
190
|
+
MAIL_CREATE: "mail/create",
|
|
191
|
+
MAIL_GET: "mail/get",
|
|
192
|
+
MAIL_LIST: "mail/list",
|
|
193
|
+
MAIL_CLOSE: "mail/close",
|
|
194
|
+
MAIL_JOIN: "mail/join",
|
|
195
|
+
MAIL_LEAVE: "mail/leave",
|
|
196
|
+
MAIL_INVITE: "mail/invite",
|
|
197
|
+
MAIL_TURN: "mail/turn",
|
|
198
|
+
MAIL_TURNS_LIST: "mail/turns/list",
|
|
199
|
+
MAIL_THREAD_CREATE: "mail/thread/create",
|
|
200
|
+
MAIL_THREAD_LIST: "mail/thread/list",
|
|
201
|
+
MAIL_SUMMARY: "mail/summary",
|
|
202
|
+
MAIL_REPLAY: "mail/replay"
|
|
203
|
+
};
|
|
180
204
|
var NOTIFICATION_METHODS = {
|
|
181
205
|
EVENT: "map/event",
|
|
182
206
|
MESSAGE: "map/message",
|
|
@@ -195,7 +219,8 @@ var MAP_METHODS = {
|
|
|
195
219
|
...SESSION_METHODS,
|
|
196
220
|
...AUTH_METHODS,
|
|
197
221
|
...PERMISSION_METHODS,
|
|
198
|
-
...FEDERATION_METHODS
|
|
222
|
+
...FEDERATION_METHODS,
|
|
223
|
+
...MAIL_METHODS
|
|
199
224
|
};
|
|
200
225
|
var STRUCTURE_METHODS = {
|
|
201
226
|
...LIFECYCLE_METHODS,
|
|
@@ -252,13 +277,27 @@ var FEDERATION_ERROR_CODES = {
|
|
|
252
277
|
/** Message exceeded maximum hop count */
|
|
253
278
|
FEDERATION_MAX_HOPS_EXCEEDED: 5011
|
|
254
279
|
};
|
|
280
|
+
var MAIL_ERROR_CODES = {
|
|
281
|
+
MAIL_CONVERSATION_NOT_FOUND: 1e4,
|
|
282
|
+
MAIL_CONVERSATION_CLOSED: 10001,
|
|
283
|
+
MAIL_NOT_A_PARTICIPANT: 10002,
|
|
284
|
+
MAIL_PERMISSION_DENIED: 10003,
|
|
285
|
+
MAIL_TURN_NOT_FOUND: 10004,
|
|
286
|
+
MAIL_THREAD_NOT_FOUND: 10005,
|
|
287
|
+
MAIL_INVALID_TURN_CONTENT: 10006,
|
|
288
|
+
MAIL_PARTICIPANT_ALREADY_JOINED: 10007,
|
|
289
|
+
MAIL_INVITATION_REQUIRED: 10008,
|
|
290
|
+
MAIL_HISTORY_ACCESS_DENIED: 10009,
|
|
291
|
+
MAIL_PARENT_CONVERSATION_NOT_FOUND: 10010
|
|
292
|
+
};
|
|
255
293
|
var ERROR_CODES = {
|
|
256
294
|
...PROTOCOL_ERROR_CODES,
|
|
257
295
|
...AUTH_ERROR_CODES,
|
|
258
296
|
...ROUTING_ERROR_CODES,
|
|
259
297
|
...AGENT_ERROR_CODES,
|
|
260
298
|
...RESOURCE_ERROR_CODES,
|
|
261
|
-
...FEDERATION_ERROR_CODES
|
|
299
|
+
...FEDERATION_ERROR_CODES,
|
|
300
|
+
...MAIL_ERROR_CODES
|
|
262
301
|
};
|
|
263
302
|
var PROTOCOL_VERSION = 1;
|
|
264
303
|
var CAPABILITY_REQUIREMENTS = {
|
|
@@ -302,7 +341,21 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
302
341
|
[PERMISSION_METHODS.PERMISSIONS_UPDATE]: [],
|
|
303
342
|
// Federation
|
|
304
343
|
[FEDERATION_METHODS.FEDERATION_CONNECT]: ["federation.canFederate"],
|
|
305
|
-
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"]
|
|
344
|
+
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"],
|
|
345
|
+
// Mail
|
|
346
|
+
[MAIL_METHODS.MAIL_CREATE]: ["mail.canCreate"],
|
|
347
|
+
[MAIL_METHODS.MAIL_GET]: ["mail.canJoin"],
|
|
348
|
+
[MAIL_METHODS.MAIL_LIST]: ["mail.canJoin"],
|
|
349
|
+
[MAIL_METHODS.MAIL_CLOSE]: ["mail.canCreate"],
|
|
350
|
+
[MAIL_METHODS.MAIL_JOIN]: ["mail.canJoin"],
|
|
351
|
+
[MAIL_METHODS.MAIL_LEAVE]: ["mail.canJoin"],
|
|
352
|
+
[MAIL_METHODS.MAIL_INVITE]: ["mail.canInvite"],
|
|
353
|
+
[MAIL_METHODS.MAIL_TURN]: ["mail.canJoin"],
|
|
354
|
+
[MAIL_METHODS.MAIL_TURNS_LIST]: ["mail.canViewHistory"],
|
|
355
|
+
[MAIL_METHODS.MAIL_THREAD_CREATE]: ["mail.canCreateThreads"],
|
|
356
|
+
[MAIL_METHODS.MAIL_THREAD_LIST]: ["mail.canJoin"],
|
|
357
|
+
[MAIL_METHODS.MAIL_SUMMARY]: ["mail.canViewHistory"],
|
|
358
|
+
[MAIL_METHODS.MAIL_REPLAY]: ["mail.canViewHistory"]
|
|
306
359
|
};
|
|
307
360
|
function isSuccessResponse(response) {
|
|
308
361
|
return "result" in response;
|
|
@@ -3260,6 +3313,187 @@ var ClientConnection = class _ClientConnection {
|
|
|
3260
3313
|
return this.#connection.sendRequest(STATE_METHODS.AGENTS_RESUME, { agentId });
|
|
3261
3314
|
}
|
|
3262
3315
|
// ===========================================================================
|
|
3316
|
+
// Mail
|
|
3317
|
+
// ===========================================================================
|
|
3318
|
+
/**
|
|
3319
|
+
* Create a new mail conversation.
|
|
3320
|
+
*
|
|
3321
|
+
* @param params - Conversation creation parameters
|
|
3322
|
+
* @returns Created conversation and participant info
|
|
3323
|
+
*/
|
|
3324
|
+
async createConversation(params) {
|
|
3325
|
+
return this.#connection.sendRequest(
|
|
3326
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
3327
|
+
params ?? {}
|
|
3328
|
+
);
|
|
3329
|
+
}
|
|
3330
|
+
/**
|
|
3331
|
+
* Get a conversation by ID with optional includes.
|
|
3332
|
+
*
|
|
3333
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
3334
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
3335
|
+
* @returns Conversation details with requested includes
|
|
3336
|
+
*/
|
|
3337
|
+
async getConversation(conversationId, include) {
|
|
3338
|
+
return this.#connection.sendRequest(
|
|
3339
|
+
MAIL_METHODS.MAIL_GET,
|
|
3340
|
+
{ conversationId, include }
|
|
3341
|
+
);
|
|
3342
|
+
}
|
|
3343
|
+
/**
|
|
3344
|
+
* List conversations with optional filters.
|
|
3345
|
+
*
|
|
3346
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
3347
|
+
* @returns Paginated list of conversations
|
|
3348
|
+
*/
|
|
3349
|
+
async listConversations(params) {
|
|
3350
|
+
return this.#connection.sendRequest(
|
|
3351
|
+
MAIL_METHODS.MAIL_LIST,
|
|
3352
|
+
params ?? {}
|
|
3353
|
+
);
|
|
3354
|
+
}
|
|
3355
|
+
/**
|
|
3356
|
+
* Close a conversation.
|
|
3357
|
+
*
|
|
3358
|
+
* @param conversationId - ID of the conversation to close
|
|
3359
|
+
* @param reason - Optional reason for closing
|
|
3360
|
+
* @returns The closed conversation
|
|
3361
|
+
*/
|
|
3362
|
+
async closeConversation(conversationId, reason) {
|
|
3363
|
+
return this.#connection.sendRequest(
|
|
3364
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
3365
|
+
{ conversationId, reason }
|
|
3366
|
+
);
|
|
3367
|
+
}
|
|
3368
|
+
/**
|
|
3369
|
+
* Join an existing conversation.
|
|
3370
|
+
*
|
|
3371
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
3372
|
+
* @returns Conversation, participant, and optional history
|
|
3373
|
+
*/
|
|
3374
|
+
async joinConversation(params) {
|
|
3375
|
+
return this.#connection.sendRequest(
|
|
3376
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
3377
|
+
params
|
|
3378
|
+
);
|
|
3379
|
+
}
|
|
3380
|
+
/**
|
|
3381
|
+
* Leave a conversation.
|
|
3382
|
+
*
|
|
3383
|
+
* @param conversationId - ID of the conversation to leave
|
|
3384
|
+
* @param reason - Optional reason for leaving
|
|
3385
|
+
* @returns Leave confirmation with timestamp
|
|
3386
|
+
*/
|
|
3387
|
+
async leaveConversation(conversationId, reason) {
|
|
3388
|
+
return this.#connection.sendRequest(
|
|
3389
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
3390
|
+
{ conversationId, reason }
|
|
3391
|
+
);
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* Invite a participant to a conversation.
|
|
3395
|
+
*
|
|
3396
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
3397
|
+
* @returns Invite result
|
|
3398
|
+
*/
|
|
3399
|
+
async inviteToConversation(params) {
|
|
3400
|
+
return this.#connection.sendRequest(
|
|
3401
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
3402
|
+
params
|
|
3403
|
+
);
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Record a turn (message) in a conversation.
|
|
3407
|
+
*
|
|
3408
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
3409
|
+
* @returns The created turn
|
|
3410
|
+
*/
|
|
3411
|
+
async recordTurn(params) {
|
|
3412
|
+
return this.#connection.sendRequest(
|
|
3413
|
+
MAIL_METHODS.MAIL_TURN,
|
|
3414
|
+
params
|
|
3415
|
+
);
|
|
3416
|
+
}
|
|
3417
|
+
/**
|
|
3418
|
+
* List turns in a conversation with optional filters.
|
|
3419
|
+
*
|
|
3420
|
+
* @param params - List parameters including conversationId and optional filters
|
|
3421
|
+
* @returns Paginated list of turns
|
|
3422
|
+
*/
|
|
3423
|
+
async listTurns(params) {
|
|
3424
|
+
return this.#connection.sendRequest(
|
|
3425
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
3426
|
+
params
|
|
3427
|
+
);
|
|
3428
|
+
}
|
|
3429
|
+
/**
|
|
3430
|
+
* Create a thread in a conversation.
|
|
3431
|
+
*
|
|
3432
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
3433
|
+
* @returns The created thread
|
|
3434
|
+
*/
|
|
3435
|
+
async createThread(params) {
|
|
3436
|
+
return this.#connection.sendRequest(
|
|
3437
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
3438
|
+
params
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3441
|
+
/**
|
|
3442
|
+
* List threads in a conversation.
|
|
3443
|
+
*
|
|
3444
|
+
* @param params - List parameters including conversationId
|
|
3445
|
+
* @returns Paginated list of threads
|
|
3446
|
+
*/
|
|
3447
|
+
async listThreads(params) {
|
|
3448
|
+
return this.#connection.sendRequest(
|
|
3449
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
3450
|
+
params
|
|
3451
|
+
);
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* Get a summary of a conversation.
|
|
3455
|
+
*
|
|
3456
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
3457
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
3458
|
+
*/
|
|
3459
|
+
async getConversationSummary(params) {
|
|
3460
|
+
return this.#connection.sendRequest(
|
|
3461
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
3462
|
+
params
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
/**
|
|
3466
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
3467
|
+
*
|
|
3468
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
3469
|
+
* @returns Replayed turns with pagination info
|
|
3470
|
+
*/
|
|
3471
|
+
async replayConversation(params) {
|
|
3472
|
+
return this.#connection.sendRequest(
|
|
3473
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
3474
|
+
params
|
|
3475
|
+
);
|
|
3476
|
+
}
|
|
3477
|
+
/**
|
|
3478
|
+
* Send a message to an address with mail context attached.
|
|
3479
|
+
*
|
|
3480
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
3481
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
3482
|
+
* in the conversation.
|
|
3483
|
+
*
|
|
3484
|
+
* @param to - Target address
|
|
3485
|
+
* @param payload - Message payload
|
|
3486
|
+
* @param conversationId - Conversation to associate with
|
|
3487
|
+
* @param options - Optional threadId and additional message meta
|
|
3488
|
+
* @returns Send result
|
|
3489
|
+
*/
|
|
3490
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
3491
|
+
return this.send(to, payload, {
|
|
3492
|
+
...options?.meta,
|
|
3493
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
// ===========================================================================
|
|
3263
3497
|
// Reconnection
|
|
3264
3498
|
// ===========================================================================
|
|
3265
3499
|
/**
|
|
@@ -4030,6 +4264,187 @@ var AgentConnection = class _AgentConnection {
|
|
|
4030
4264
|
return this.#connection.onStateChange(handler);
|
|
4031
4265
|
}
|
|
4032
4266
|
// ===========================================================================
|
|
4267
|
+
// Mail
|
|
4268
|
+
// ===========================================================================
|
|
4269
|
+
/**
|
|
4270
|
+
* Create a new mail conversation.
|
|
4271
|
+
*
|
|
4272
|
+
* @param params - Conversation creation parameters
|
|
4273
|
+
* @returns Created conversation and participant info
|
|
4274
|
+
*/
|
|
4275
|
+
async createConversation(params) {
|
|
4276
|
+
return this.#connection.sendRequest(
|
|
4277
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
4278
|
+
params ?? {}
|
|
4279
|
+
);
|
|
4280
|
+
}
|
|
4281
|
+
/**
|
|
4282
|
+
* Get a conversation by ID with optional includes.
|
|
4283
|
+
*
|
|
4284
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
4285
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
4286
|
+
* @returns Conversation details with requested includes
|
|
4287
|
+
*/
|
|
4288
|
+
async getConversation(conversationId, include) {
|
|
4289
|
+
return this.#connection.sendRequest(
|
|
4290
|
+
MAIL_METHODS.MAIL_GET,
|
|
4291
|
+
{ conversationId, include }
|
|
4292
|
+
);
|
|
4293
|
+
}
|
|
4294
|
+
/**
|
|
4295
|
+
* List conversations with optional filters.
|
|
4296
|
+
*
|
|
4297
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
4298
|
+
* @returns Paginated list of conversations
|
|
4299
|
+
*/
|
|
4300
|
+
async listConversations(params) {
|
|
4301
|
+
return this.#connection.sendRequest(
|
|
4302
|
+
MAIL_METHODS.MAIL_LIST,
|
|
4303
|
+
params ?? {}
|
|
4304
|
+
);
|
|
4305
|
+
}
|
|
4306
|
+
/**
|
|
4307
|
+
* Close a conversation.
|
|
4308
|
+
*
|
|
4309
|
+
* @param conversationId - ID of the conversation to close
|
|
4310
|
+
* @param reason - Optional reason for closing
|
|
4311
|
+
* @returns The closed conversation
|
|
4312
|
+
*/
|
|
4313
|
+
async closeConversation(conversationId, reason) {
|
|
4314
|
+
return this.#connection.sendRequest(
|
|
4315
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
4316
|
+
{ conversationId, reason }
|
|
4317
|
+
);
|
|
4318
|
+
}
|
|
4319
|
+
/**
|
|
4320
|
+
* Join an existing conversation.
|
|
4321
|
+
*
|
|
4322
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
4323
|
+
* @returns Conversation, participant, and optional history
|
|
4324
|
+
*/
|
|
4325
|
+
async joinConversation(params) {
|
|
4326
|
+
return this.#connection.sendRequest(
|
|
4327
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
4328
|
+
params
|
|
4329
|
+
);
|
|
4330
|
+
}
|
|
4331
|
+
/**
|
|
4332
|
+
* Leave a conversation.
|
|
4333
|
+
*
|
|
4334
|
+
* @param conversationId - ID of the conversation to leave
|
|
4335
|
+
* @param reason - Optional reason for leaving
|
|
4336
|
+
* @returns Leave confirmation with timestamp
|
|
4337
|
+
*/
|
|
4338
|
+
async leaveConversation(conversationId, reason) {
|
|
4339
|
+
return this.#connection.sendRequest(
|
|
4340
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
4341
|
+
{ conversationId, reason }
|
|
4342
|
+
);
|
|
4343
|
+
}
|
|
4344
|
+
/**
|
|
4345
|
+
* Invite a participant to a conversation.
|
|
4346
|
+
*
|
|
4347
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
4348
|
+
* @returns Invite result
|
|
4349
|
+
*/
|
|
4350
|
+
async inviteToConversation(params) {
|
|
4351
|
+
return this.#connection.sendRequest(
|
|
4352
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
4353
|
+
params
|
|
4354
|
+
);
|
|
4355
|
+
}
|
|
4356
|
+
/**
|
|
4357
|
+
* Record a turn (message) in a conversation.
|
|
4358
|
+
*
|
|
4359
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
4360
|
+
* @returns The created turn
|
|
4361
|
+
*/
|
|
4362
|
+
async recordTurn(params) {
|
|
4363
|
+
return this.#connection.sendRequest(
|
|
4364
|
+
MAIL_METHODS.MAIL_TURN,
|
|
4365
|
+
params
|
|
4366
|
+
);
|
|
4367
|
+
}
|
|
4368
|
+
/**
|
|
4369
|
+
* List turns in a conversation with optional filters.
|
|
4370
|
+
*
|
|
4371
|
+
* @param params - List parameters including conversationId and optional filters
|
|
4372
|
+
* @returns Paginated list of turns
|
|
4373
|
+
*/
|
|
4374
|
+
async listTurns(params) {
|
|
4375
|
+
return this.#connection.sendRequest(
|
|
4376
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
4377
|
+
params
|
|
4378
|
+
);
|
|
4379
|
+
}
|
|
4380
|
+
/**
|
|
4381
|
+
* Create a thread in a conversation.
|
|
4382
|
+
*
|
|
4383
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
4384
|
+
* @returns The created thread
|
|
4385
|
+
*/
|
|
4386
|
+
async createThread(params) {
|
|
4387
|
+
return this.#connection.sendRequest(
|
|
4388
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
4389
|
+
params
|
|
4390
|
+
);
|
|
4391
|
+
}
|
|
4392
|
+
/**
|
|
4393
|
+
* List threads in a conversation.
|
|
4394
|
+
*
|
|
4395
|
+
* @param params - List parameters including conversationId
|
|
4396
|
+
* @returns Paginated list of threads
|
|
4397
|
+
*/
|
|
4398
|
+
async listThreads(params) {
|
|
4399
|
+
return this.#connection.sendRequest(
|
|
4400
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
4401
|
+
params
|
|
4402
|
+
);
|
|
4403
|
+
}
|
|
4404
|
+
/**
|
|
4405
|
+
* Get a summary of a conversation.
|
|
4406
|
+
*
|
|
4407
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
4408
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
4409
|
+
*/
|
|
4410
|
+
async getConversationSummary(params) {
|
|
4411
|
+
return this.#connection.sendRequest(
|
|
4412
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
4413
|
+
params
|
|
4414
|
+
);
|
|
4415
|
+
}
|
|
4416
|
+
/**
|
|
4417
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
4418
|
+
*
|
|
4419
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
4420
|
+
* @returns Replayed turns with pagination info
|
|
4421
|
+
*/
|
|
4422
|
+
async replayConversation(params) {
|
|
4423
|
+
return this.#connection.sendRequest(
|
|
4424
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
4425
|
+
params
|
|
4426
|
+
);
|
|
4427
|
+
}
|
|
4428
|
+
/**
|
|
4429
|
+
* Send a message to an agent with mail context attached.
|
|
4430
|
+
*
|
|
4431
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
4432
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
4433
|
+
* in the conversation.
|
|
4434
|
+
*
|
|
4435
|
+
* @param to - Target address
|
|
4436
|
+
* @param payload - Message payload
|
|
4437
|
+
* @param conversationId - Conversation to associate with
|
|
4438
|
+
* @param options - Optional threadId and additional message meta
|
|
4439
|
+
* @returns Send result
|
|
4440
|
+
*/
|
|
4441
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
4442
|
+
return this.send(to, payload, {
|
|
4443
|
+
...options?.meta,
|
|
4444
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
4445
|
+
});
|
|
4446
|
+
}
|
|
4447
|
+
// ===========================================================================
|
|
4033
4448
|
// Internal
|
|
4034
4449
|
// ===========================================================================
|
|
4035
4450
|
/**
|
|
@@ -5226,6 +5641,85 @@ var METHOD_REGISTRY = {
|
|
|
5226
5641
|
capabilities: ["federation.canFederate"],
|
|
5227
5642
|
description: "Route message to federated system"
|
|
5228
5643
|
},
|
|
5644
|
+
// Mail methods
|
|
5645
|
+
"mail/create": {
|
|
5646
|
+
method: "mail/create",
|
|
5647
|
+
category: "mail",
|
|
5648
|
+
capabilities: ["mail.canCreate"],
|
|
5649
|
+
description: "Create a new conversation"
|
|
5650
|
+
},
|
|
5651
|
+
"mail/get": {
|
|
5652
|
+
method: "mail/get",
|
|
5653
|
+
category: "mail",
|
|
5654
|
+
capabilities: ["mail.canJoin"],
|
|
5655
|
+
description: "Get conversation details"
|
|
5656
|
+
},
|
|
5657
|
+
"mail/list": {
|
|
5658
|
+
method: "mail/list",
|
|
5659
|
+
category: "mail",
|
|
5660
|
+
capabilities: ["mail.canJoin"],
|
|
5661
|
+
description: "List conversations"
|
|
5662
|
+
},
|
|
5663
|
+
"mail/close": {
|
|
5664
|
+
method: "mail/close",
|
|
5665
|
+
category: "mail",
|
|
5666
|
+
capabilities: ["mail.canCreate"],
|
|
5667
|
+
description: "Close a conversation"
|
|
5668
|
+
},
|
|
5669
|
+
"mail/join": {
|
|
5670
|
+
method: "mail/join",
|
|
5671
|
+
category: "mail",
|
|
5672
|
+
capabilities: ["mail.canJoin"],
|
|
5673
|
+
description: "Join an existing conversation"
|
|
5674
|
+
},
|
|
5675
|
+
"mail/leave": {
|
|
5676
|
+
method: "mail/leave",
|
|
5677
|
+
category: "mail",
|
|
5678
|
+
capabilities: ["mail.canJoin"],
|
|
5679
|
+
description: "Leave a conversation"
|
|
5680
|
+
},
|
|
5681
|
+
"mail/invite": {
|
|
5682
|
+
method: "mail/invite",
|
|
5683
|
+
category: "mail",
|
|
5684
|
+
capabilities: ["mail.canInvite"],
|
|
5685
|
+
description: "Invite a participant to a conversation"
|
|
5686
|
+
},
|
|
5687
|
+
"mail/turn": {
|
|
5688
|
+
method: "mail/turn",
|
|
5689
|
+
category: "mail",
|
|
5690
|
+
capabilities: ["mail.canJoin"],
|
|
5691
|
+
description: "Record a turn in a conversation"
|
|
5692
|
+
},
|
|
5693
|
+
"mail/turns/list": {
|
|
5694
|
+
method: "mail/turns/list",
|
|
5695
|
+
category: "mail",
|
|
5696
|
+
capabilities: ["mail.canViewHistory"],
|
|
5697
|
+
description: "List turns in a conversation"
|
|
5698
|
+
},
|
|
5699
|
+
"mail/thread/create": {
|
|
5700
|
+
method: "mail/thread/create",
|
|
5701
|
+
category: "mail",
|
|
5702
|
+
capabilities: ["mail.canCreateThreads"],
|
|
5703
|
+
description: "Create a thread within a conversation"
|
|
5704
|
+
},
|
|
5705
|
+
"mail/thread/list": {
|
|
5706
|
+
method: "mail/thread/list",
|
|
5707
|
+
category: "mail",
|
|
5708
|
+
capabilities: ["mail.canJoin"],
|
|
5709
|
+
description: "List threads in a conversation"
|
|
5710
|
+
},
|
|
5711
|
+
"mail/summary": {
|
|
5712
|
+
method: "mail/summary",
|
|
5713
|
+
category: "mail",
|
|
5714
|
+
capabilities: ["mail.canViewHistory"],
|
|
5715
|
+
description: "Get or generate a conversation summary"
|
|
5716
|
+
},
|
|
5717
|
+
"mail/replay": {
|
|
5718
|
+
method: "mail/replay",
|
|
5719
|
+
category: "mail",
|
|
5720
|
+
capabilities: ["mail.canViewHistory"],
|
|
5721
|
+
description: "Replay turns from a specific point"
|
|
5722
|
+
},
|
|
5229
5723
|
// Notification methods (client → server)
|
|
5230
5724
|
"subscription/ack": {
|
|
5231
5725
|
method: "map/subscribe.ack",
|
|
@@ -6398,6 +6892,6 @@ var ACPAgentAdapter = class {
|
|
|
6398
6892
|
}
|
|
6399
6893
|
};
|
|
6400
6894
|
|
|
6401
|
-
export { ACPAgentAdapter, ACPError, ACPStreamConnection, ACP_ERROR_CODES, ACP_METHODS, ACP_PROTOCOL_VERSION, AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, InvalidAddressError, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPMeshPeer, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, agenticMeshStream, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createACPStream, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, extractId, extractType, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isACPEnvelope, isACPErrorResponse, isACPNotification, isACPRequest, isACPResponse, isACPSuccessResponse, isAddress, isAgentAddress, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, parseAddress, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, waitForOpen, websocketStream, withPayload, withRetry };
|
|
6895
|
+
export { ACPAgentAdapter, ACPError, ACPStreamConnection, ACP_ERROR_CODES, ACP_METHODS, ACP_PROTOCOL_VERSION, AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, InvalidAddressError, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAIL_ERROR_CODES, MAIL_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPMeshPeer, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, agenticMeshStream, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createACPStream, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, extractId, extractType, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isACPEnvelope, isACPErrorResponse, isACPNotification, isACPRequest, isACPResponse, isACPSuccessResponse, isAddress, isAgentAddress, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, parseAddress, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, waitForOpen, websocketStream, withPayload, withRetry };
|
|
6402
6896
|
//# sourceMappingURL=index.js.map
|
|
6403
6897
|
//# sourceMappingURL=index.js.map
|