@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.cjs
CHANGED
|
@@ -113,7 +113,16 @@ var EVENT_TYPES = {
|
|
|
113
113
|
SYSTEM_ERROR: "system_error",
|
|
114
114
|
// Federation events
|
|
115
115
|
FEDERATION_CONNECTED: "federation_connected",
|
|
116
|
-
FEDERATION_DISCONNECTED: "federation_disconnected"
|
|
116
|
+
FEDERATION_DISCONNECTED: "federation_disconnected",
|
|
117
|
+
// Mail events
|
|
118
|
+
MAIL_CREATED: "mail.created",
|
|
119
|
+
MAIL_CLOSED: "mail.closed",
|
|
120
|
+
MAIL_PARTICIPANT_JOINED: "mail.participant.joined",
|
|
121
|
+
MAIL_PARTICIPANT_LEFT: "mail.participant.left",
|
|
122
|
+
MAIL_TURN_ADDED: "mail.turn.added",
|
|
123
|
+
MAIL_TURN_UPDATED: "mail.turn.updated",
|
|
124
|
+
MAIL_THREAD_CREATED: "mail.thread.created",
|
|
125
|
+
MAIL_SUMMARY_GENERATED: "mail.summary.generated"
|
|
117
126
|
};
|
|
118
127
|
function createEvent(input) {
|
|
119
128
|
return {
|
|
@@ -179,6 +188,21 @@ var FEDERATION_METHODS = {
|
|
|
179
188
|
FEDERATION_CONNECT: "map/federation/connect",
|
|
180
189
|
FEDERATION_ROUTE: "map/federation/route"
|
|
181
190
|
};
|
|
191
|
+
var MAIL_METHODS = {
|
|
192
|
+
MAIL_CREATE: "mail/create",
|
|
193
|
+
MAIL_GET: "mail/get",
|
|
194
|
+
MAIL_LIST: "mail/list",
|
|
195
|
+
MAIL_CLOSE: "mail/close",
|
|
196
|
+
MAIL_JOIN: "mail/join",
|
|
197
|
+
MAIL_LEAVE: "mail/leave",
|
|
198
|
+
MAIL_INVITE: "mail/invite",
|
|
199
|
+
MAIL_TURN: "mail/turn",
|
|
200
|
+
MAIL_TURNS_LIST: "mail/turns/list",
|
|
201
|
+
MAIL_THREAD_CREATE: "mail/thread/create",
|
|
202
|
+
MAIL_THREAD_LIST: "mail/thread/list",
|
|
203
|
+
MAIL_SUMMARY: "mail/summary",
|
|
204
|
+
MAIL_REPLAY: "mail/replay"
|
|
205
|
+
};
|
|
182
206
|
var NOTIFICATION_METHODS = {
|
|
183
207
|
EVENT: "map/event",
|
|
184
208
|
MESSAGE: "map/message",
|
|
@@ -197,7 +221,8 @@ var MAP_METHODS = {
|
|
|
197
221
|
...SESSION_METHODS,
|
|
198
222
|
...AUTH_METHODS,
|
|
199
223
|
...PERMISSION_METHODS,
|
|
200
|
-
...FEDERATION_METHODS
|
|
224
|
+
...FEDERATION_METHODS,
|
|
225
|
+
...MAIL_METHODS
|
|
201
226
|
};
|
|
202
227
|
var STRUCTURE_METHODS = {
|
|
203
228
|
...LIFECYCLE_METHODS,
|
|
@@ -254,13 +279,27 @@ var FEDERATION_ERROR_CODES = {
|
|
|
254
279
|
/** Message exceeded maximum hop count */
|
|
255
280
|
FEDERATION_MAX_HOPS_EXCEEDED: 5011
|
|
256
281
|
};
|
|
282
|
+
var MAIL_ERROR_CODES = {
|
|
283
|
+
MAIL_CONVERSATION_NOT_FOUND: 1e4,
|
|
284
|
+
MAIL_CONVERSATION_CLOSED: 10001,
|
|
285
|
+
MAIL_NOT_A_PARTICIPANT: 10002,
|
|
286
|
+
MAIL_PERMISSION_DENIED: 10003,
|
|
287
|
+
MAIL_TURN_NOT_FOUND: 10004,
|
|
288
|
+
MAIL_THREAD_NOT_FOUND: 10005,
|
|
289
|
+
MAIL_INVALID_TURN_CONTENT: 10006,
|
|
290
|
+
MAIL_PARTICIPANT_ALREADY_JOINED: 10007,
|
|
291
|
+
MAIL_INVITATION_REQUIRED: 10008,
|
|
292
|
+
MAIL_HISTORY_ACCESS_DENIED: 10009,
|
|
293
|
+
MAIL_PARENT_CONVERSATION_NOT_FOUND: 10010
|
|
294
|
+
};
|
|
257
295
|
var ERROR_CODES = {
|
|
258
296
|
...PROTOCOL_ERROR_CODES,
|
|
259
297
|
...AUTH_ERROR_CODES,
|
|
260
298
|
...ROUTING_ERROR_CODES,
|
|
261
299
|
...AGENT_ERROR_CODES,
|
|
262
300
|
...RESOURCE_ERROR_CODES,
|
|
263
|
-
...FEDERATION_ERROR_CODES
|
|
301
|
+
...FEDERATION_ERROR_CODES,
|
|
302
|
+
...MAIL_ERROR_CODES
|
|
264
303
|
};
|
|
265
304
|
var PROTOCOL_VERSION = 1;
|
|
266
305
|
var CAPABILITY_REQUIREMENTS = {
|
|
@@ -304,7 +343,21 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
304
343
|
[PERMISSION_METHODS.PERMISSIONS_UPDATE]: [],
|
|
305
344
|
// Federation
|
|
306
345
|
[FEDERATION_METHODS.FEDERATION_CONNECT]: ["federation.canFederate"],
|
|
307
|
-
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"]
|
|
346
|
+
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"],
|
|
347
|
+
// Mail
|
|
348
|
+
[MAIL_METHODS.MAIL_CREATE]: ["mail.canCreate"],
|
|
349
|
+
[MAIL_METHODS.MAIL_GET]: ["mail.canJoin"],
|
|
350
|
+
[MAIL_METHODS.MAIL_LIST]: ["mail.canJoin"],
|
|
351
|
+
[MAIL_METHODS.MAIL_CLOSE]: ["mail.canCreate"],
|
|
352
|
+
[MAIL_METHODS.MAIL_JOIN]: ["mail.canJoin"],
|
|
353
|
+
[MAIL_METHODS.MAIL_LEAVE]: ["mail.canJoin"],
|
|
354
|
+
[MAIL_METHODS.MAIL_INVITE]: ["mail.canInvite"],
|
|
355
|
+
[MAIL_METHODS.MAIL_TURN]: ["mail.canJoin"],
|
|
356
|
+
[MAIL_METHODS.MAIL_TURNS_LIST]: ["mail.canViewHistory"],
|
|
357
|
+
[MAIL_METHODS.MAIL_THREAD_CREATE]: ["mail.canCreateThreads"],
|
|
358
|
+
[MAIL_METHODS.MAIL_THREAD_LIST]: ["mail.canJoin"],
|
|
359
|
+
[MAIL_METHODS.MAIL_SUMMARY]: ["mail.canViewHistory"],
|
|
360
|
+
[MAIL_METHODS.MAIL_REPLAY]: ["mail.canViewHistory"]
|
|
308
361
|
};
|
|
309
362
|
function isSuccessResponse(response) {
|
|
310
363
|
return "result" in response;
|
|
@@ -3262,6 +3315,187 @@ var ClientConnection = class _ClientConnection {
|
|
|
3262
3315
|
return this.#connection.sendRequest(STATE_METHODS.AGENTS_RESUME, { agentId });
|
|
3263
3316
|
}
|
|
3264
3317
|
// ===========================================================================
|
|
3318
|
+
// Mail
|
|
3319
|
+
// ===========================================================================
|
|
3320
|
+
/**
|
|
3321
|
+
* Create a new mail conversation.
|
|
3322
|
+
*
|
|
3323
|
+
* @param params - Conversation creation parameters
|
|
3324
|
+
* @returns Created conversation and participant info
|
|
3325
|
+
*/
|
|
3326
|
+
async createConversation(params) {
|
|
3327
|
+
return this.#connection.sendRequest(
|
|
3328
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
3329
|
+
params ?? {}
|
|
3330
|
+
);
|
|
3331
|
+
}
|
|
3332
|
+
/**
|
|
3333
|
+
* Get a conversation by ID with optional includes.
|
|
3334
|
+
*
|
|
3335
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
3336
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
3337
|
+
* @returns Conversation details with requested includes
|
|
3338
|
+
*/
|
|
3339
|
+
async getConversation(conversationId, include) {
|
|
3340
|
+
return this.#connection.sendRequest(
|
|
3341
|
+
MAIL_METHODS.MAIL_GET,
|
|
3342
|
+
{ conversationId, include }
|
|
3343
|
+
);
|
|
3344
|
+
}
|
|
3345
|
+
/**
|
|
3346
|
+
* List conversations with optional filters.
|
|
3347
|
+
*
|
|
3348
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
3349
|
+
* @returns Paginated list of conversations
|
|
3350
|
+
*/
|
|
3351
|
+
async listConversations(params) {
|
|
3352
|
+
return this.#connection.sendRequest(
|
|
3353
|
+
MAIL_METHODS.MAIL_LIST,
|
|
3354
|
+
params ?? {}
|
|
3355
|
+
);
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* Close a conversation.
|
|
3359
|
+
*
|
|
3360
|
+
* @param conversationId - ID of the conversation to close
|
|
3361
|
+
* @param reason - Optional reason for closing
|
|
3362
|
+
* @returns The closed conversation
|
|
3363
|
+
*/
|
|
3364
|
+
async closeConversation(conversationId, reason) {
|
|
3365
|
+
return this.#connection.sendRequest(
|
|
3366
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
3367
|
+
{ conversationId, reason }
|
|
3368
|
+
);
|
|
3369
|
+
}
|
|
3370
|
+
/**
|
|
3371
|
+
* Join an existing conversation.
|
|
3372
|
+
*
|
|
3373
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
3374
|
+
* @returns Conversation, participant, and optional history
|
|
3375
|
+
*/
|
|
3376
|
+
async joinConversation(params) {
|
|
3377
|
+
return this.#connection.sendRequest(
|
|
3378
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
3379
|
+
params
|
|
3380
|
+
);
|
|
3381
|
+
}
|
|
3382
|
+
/**
|
|
3383
|
+
* Leave a conversation.
|
|
3384
|
+
*
|
|
3385
|
+
* @param conversationId - ID of the conversation to leave
|
|
3386
|
+
* @param reason - Optional reason for leaving
|
|
3387
|
+
* @returns Leave confirmation with timestamp
|
|
3388
|
+
*/
|
|
3389
|
+
async leaveConversation(conversationId, reason) {
|
|
3390
|
+
return this.#connection.sendRequest(
|
|
3391
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
3392
|
+
{ conversationId, reason }
|
|
3393
|
+
);
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* Invite a participant to a conversation.
|
|
3397
|
+
*
|
|
3398
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
3399
|
+
* @returns Invite result
|
|
3400
|
+
*/
|
|
3401
|
+
async inviteToConversation(params) {
|
|
3402
|
+
return this.#connection.sendRequest(
|
|
3403
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
3404
|
+
params
|
|
3405
|
+
);
|
|
3406
|
+
}
|
|
3407
|
+
/**
|
|
3408
|
+
* Record a turn (message) in a conversation.
|
|
3409
|
+
*
|
|
3410
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
3411
|
+
* @returns The created turn
|
|
3412
|
+
*/
|
|
3413
|
+
async recordTurn(params) {
|
|
3414
|
+
return this.#connection.sendRequest(
|
|
3415
|
+
MAIL_METHODS.MAIL_TURN,
|
|
3416
|
+
params
|
|
3417
|
+
);
|
|
3418
|
+
}
|
|
3419
|
+
/**
|
|
3420
|
+
* List turns in a conversation with optional filters.
|
|
3421
|
+
*
|
|
3422
|
+
* @param params - List parameters including conversationId and optional filters
|
|
3423
|
+
* @returns Paginated list of turns
|
|
3424
|
+
*/
|
|
3425
|
+
async listTurns(params) {
|
|
3426
|
+
return this.#connection.sendRequest(
|
|
3427
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
3428
|
+
params
|
|
3429
|
+
);
|
|
3430
|
+
}
|
|
3431
|
+
/**
|
|
3432
|
+
* Create a thread in a conversation.
|
|
3433
|
+
*
|
|
3434
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
3435
|
+
* @returns The created thread
|
|
3436
|
+
*/
|
|
3437
|
+
async createThread(params) {
|
|
3438
|
+
return this.#connection.sendRequest(
|
|
3439
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
3440
|
+
params
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3443
|
+
/**
|
|
3444
|
+
* List threads in a conversation.
|
|
3445
|
+
*
|
|
3446
|
+
* @param params - List parameters including conversationId
|
|
3447
|
+
* @returns Paginated list of threads
|
|
3448
|
+
*/
|
|
3449
|
+
async listThreads(params) {
|
|
3450
|
+
return this.#connection.sendRequest(
|
|
3451
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
3452
|
+
params
|
|
3453
|
+
);
|
|
3454
|
+
}
|
|
3455
|
+
/**
|
|
3456
|
+
* Get a summary of a conversation.
|
|
3457
|
+
*
|
|
3458
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
3459
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
3460
|
+
*/
|
|
3461
|
+
async getConversationSummary(params) {
|
|
3462
|
+
return this.#connection.sendRequest(
|
|
3463
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
3464
|
+
params
|
|
3465
|
+
);
|
|
3466
|
+
}
|
|
3467
|
+
/**
|
|
3468
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
3469
|
+
*
|
|
3470
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
3471
|
+
* @returns Replayed turns with pagination info
|
|
3472
|
+
*/
|
|
3473
|
+
async replayConversation(params) {
|
|
3474
|
+
return this.#connection.sendRequest(
|
|
3475
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
3476
|
+
params
|
|
3477
|
+
);
|
|
3478
|
+
}
|
|
3479
|
+
/**
|
|
3480
|
+
* Send a message to an address with mail context attached.
|
|
3481
|
+
*
|
|
3482
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
3483
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
3484
|
+
* in the conversation.
|
|
3485
|
+
*
|
|
3486
|
+
* @param to - Target address
|
|
3487
|
+
* @param payload - Message payload
|
|
3488
|
+
* @param conversationId - Conversation to associate with
|
|
3489
|
+
* @param options - Optional threadId and additional message meta
|
|
3490
|
+
* @returns Send result
|
|
3491
|
+
*/
|
|
3492
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
3493
|
+
return this.send(to, payload, {
|
|
3494
|
+
...options?.meta,
|
|
3495
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
// ===========================================================================
|
|
3265
3499
|
// Reconnection
|
|
3266
3500
|
// ===========================================================================
|
|
3267
3501
|
/**
|
|
@@ -4032,6 +4266,187 @@ var AgentConnection = class _AgentConnection {
|
|
|
4032
4266
|
return this.#connection.onStateChange(handler);
|
|
4033
4267
|
}
|
|
4034
4268
|
// ===========================================================================
|
|
4269
|
+
// Mail
|
|
4270
|
+
// ===========================================================================
|
|
4271
|
+
/**
|
|
4272
|
+
* Create a new mail conversation.
|
|
4273
|
+
*
|
|
4274
|
+
* @param params - Conversation creation parameters
|
|
4275
|
+
* @returns Created conversation and participant info
|
|
4276
|
+
*/
|
|
4277
|
+
async createConversation(params) {
|
|
4278
|
+
return this.#connection.sendRequest(
|
|
4279
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
4280
|
+
params ?? {}
|
|
4281
|
+
);
|
|
4282
|
+
}
|
|
4283
|
+
/**
|
|
4284
|
+
* Get a conversation by ID with optional includes.
|
|
4285
|
+
*
|
|
4286
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
4287
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
4288
|
+
* @returns Conversation details with requested includes
|
|
4289
|
+
*/
|
|
4290
|
+
async getConversation(conversationId, include) {
|
|
4291
|
+
return this.#connection.sendRequest(
|
|
4292
|
+
MAIL_METHODS.MAIL_GET,
|
|
4293
|
+
{ conversationId, include }
|
|
4294
|
+
);
|
|
4295
|
+
}
|
|
4296
|
+
/**
|
|
4297
|
+
* List conversations with optional filters.
|
|
4298
|
+
*
|
|
4299
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
4300
|
+
* @returns Paginated list of conversations
|
|
4301
|
+
*/
|
|
4302
|
+
async listConversations(params) {
|
|
4303
|
+
return this.#connection.sendRequest(
|
|
4304
|
+
MAIL_METHODS.MAIL_LIST,
|
|
4305
|
+
params ?? {}
|
|
4306
|
+
);
|
|
4307
|
+
}
|
|
4308
|
+
/**
|
|
4309
|
+
* Close a conversation.
|
|
4310
|
+
*
|
|
4311
|
+
* @param conversationId - ID of the conversation to close
|
|
4312
|
+
* @param reason - Optional reason for closing
|
|
4313
|
+
* @returns The closed conversation
|
|
4314
|
+
*/
|
|
4315
|
+
async closeConversation(conversationId, reason) {
|
|
4316
|
+
return this.#connection.sendRequest(
|
|
4317
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
4318
|
+
{ conversationId, reason }
|
|
4319
|
+
);
|
|
4320
|
+
}
|
|
4321
|
+
/**
|
|
4322
|
+
* Join an existing conversation.
|
|
4323
|
+
*
|
|
4324
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
4325
|
+
* @returns Conversation, participant, and optional history
|
|
4326
|
+
*/
|
|
4327
|
+
async joinConversation(params) {
|
|
4328
|
+
return this.#connection.sendRequest(
|
|
4329
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
4330
|
+
params
|
|
4331
|
+
);
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* Leave a conversation.
|
|
4335
|
+
*
|
|
4336
|
+
* @param conversationId - ID of the conversation to leave
|
|
4337
|
+
* @param reason - Optional reason for leaving
|
|
4338
|
+
* @returns Leave confirmation with timestamp
|
|
4339
|
+
*/
|
|
4340
|
+
async leaveConversation(conversationId, reason) {
|
|
4341
|
+
return this.#connection.sendRequest(
|
|
4342
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
4343
|
+
{ conversationId, reason }
|
|
4344
|
+
);
|
|
4345
|
+
}
|
|
4346
|
+
/**
|
|
4347
|
+
* Invite a participant to a conversation.
|
|
4348
|
+
*
|
|
4349
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
4350
|
+
* @returns Invite result
|
|
4351
|
+
*/
|
|
4352
|
+
async inviteToConversation(params) {
|
|
4353
|
+
return this.#connection.sendRequest(
|
|
4354
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
4355
|
+
params
|
|
4356
|
+
);
|
|
4357
|
+
}
|
|
4358
|
+
/**
|
|
4359
|
+
* Record a turn (message) in a conversation.
|
|
4360
|
+
*
|
|
4361
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
4362
|
+
* @returns The created turn
|
|
4363
|
+
*/
|
|
4364
|
+
async recordTurn(params) {
|
|
4365
|
+
return this.#connection.sendRequest(
|
|
4366
|
+
MAIL_METHODS.MAIL_TURN,
|
|
4367
|
+
params
|
|
4368
|
+
);
|
|
4369
|
+
}
|
|
4370
|
+
/**
|
|
4371
|
+
* List turns in a conversation with optional filters.
|
|
4372
|
+
*
|
|
4373
|
+
* @param params - List parameters including conversationId and optional filters
|
|
4374
|
+
* @returns Paginated list of turns
|
|
4375
|
+
*/
|
|
4376
|
+
async listTurns(params) {
|
|
4377
|
+
return this.#connection.sendRequest(
|
|
4378
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
4379
|
+
params
|
|
4380
|
+
);
|
|
4381
|
+
}
|
|
4382
|
+
/**
|
|
4383
|
+
* Create a thread in a conversation.
|
|
4384
|
+
*
|
|
4385
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
4386
|
+
* @returns The created thread
|
|
4387
|
+
*/
|
|
4388
|
+
async createThread(params) {
|
|
4389
|
+
return this.#connection.sendRequest(
|
|
4390
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
4391
|
+
params
|
|
4392
|
+
);
|
|
4393
|
+
}
|
|
4394
|
+
/**
|
|
4395
|
+
* List threads in a conversation.
|
|
4396
|
+
*
|
|
4397
|
+
* @param params - List parameters including conversationId
|
|
4398
|
+
* @returns Paginated list of threads
|
|
4399
|
+
*/
|
|
4400
|
+
async listThreads(params) {
|
|
4401
|
+
return this.#connection.sendRequest(
|
|
4402
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
4403
|
+
params
|
|
4404
|
+
);
|
|
4405
|
+
}
|
|
4406
|
+
/**
|
|
4407
|
+
* Get a summary of a conversation.
|
|
4408
|
+
*
|
|
4409
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
4410
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
4411
|
+
*/
|
|
4412
|
+
async getConversationSummary(params) {
|
|
4413
|
+
return this.#connection.sendRequest(
|
|
4414
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
4415
|
+
params
|
|
4416
|
+
);
|
|
4417
|
+
}
|
|
4418
|
+
/**
|
|
4419
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
4420
|
+
*
|
|
4421
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
4422
|
+
* @returns Replayed turns with pagination info
|
|
4423
|
+
*/
|
|
4424
|
+
async replayConversation(params) {
|
|
4425
|
+
return this.#connection.sendRequest(
|
|
4426
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
4427
|
+
params
|
|
4428
|
+
);
|
|
4429
|
+
}
|
|
4430
|
+
/**
|
|
4431
|
+
* Send a message to an agent with mail context attached.
|
|
4432
|
+
*
|
|
4433
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
4434
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
4435
|
+
* in the conversation.
|
|
4436
|
+
*
|
|
4437
|
+
* @param to - Target address
|
|
4438
|
+
* @param payload - Message payload
|
|
4439
|
+
* @param conversationId - Conversation to associate with
|
|
4440
|
+
* @param options - Optional threadId and additional message meta
|
|
4441
|
+
* @returns Send result
|
|
4442
|
+
*/
|
|
4443
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
4444
|
+
return this.send(to, payload, {
|
|
4445
|
+
...options?.meta,
|
|
4446
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
4447
|
+
});
|
|
4448
|
+
}
|
|
4449
|
+
// ===========================================================================
|
|
4035
4450
|
// Internal
|
|
4036
4451
|
// ===========================================================================
|
|
4037
4452
|
/**
|
|
@@ -5228,6 +5643,85 @@ var METHOD_REGISTRY = {
|
|
|
5228
5643
|
capabilities: ["federation.canFederate"],
|
|
5229
5644
|
description: "Route message to federated system"
|
|
5230
5645
|
},
|
|
5646
|
+
// Mail methods
|
|
5647
|
+
"mail/create": {
|
|
5648
|
+
method: "mail/create",
|
|
5649
|
+
category: "mail",
|
|
5650
|
+
capabilities: ["mail.canCreate"],
|
|
5651
|
+
description: "Create a new conversation"
|
|
5652
|
+
},
|
|
5653
|
+
"mail/get": {
|
|
5654
|
+
method: "mail/get",
|
|
5655
|
+
category: "mail",
|
|
5656
|
+
capabilities: ["mail.canJoin"],
|
|
5657
|
+
description: "Get conversation details"
|
|
5658
|
+
},
|
|
5659
|
+
"mail/list": {
|
|
5660
|
+
method: "mail/list",
|
|
5661
|
+
category: "mail",
|
|
5662
|
+
capabilities: ["mail.canJoin"],
|
|
5663
|
+
description: "List conversations"
|
|
5664
|
+
},
|
|
5665
|
+
"mail/close": {
|
|
5666
|
+
method: "mail/close",
|
|
5667
|
+
category: "mail",
|
|
5668
|
+
capabilities: ["mail.canCreate"],
|
|
5669
|
+
description: "Close a conversation"
|
|
5670
|
+
},
|
|
5671
|
+
"mail/join": {
|
|
5672
|
+
method: "mail/join",
|
|
5673
|
+
category: "mail",
|
|
5674
|
+
capabilities: ["mail.canJoin"],
|
|
5675
|
+
description: "Join an existing conversation"
|
|
5676
|
+
},
|
|
5677
|
+
"mail/leave": {
|
|
5678
|
+
method: "mail/leave",
|
|
5679
|
+
category: "mail",
|
|
5680
|
+
capabilities: ["mail.canJoin"],
|
|
5681
|
+
description: "Leave a conversation"
|
|
5682
|
+
},
|
|
5683
|
+
"mail/invite": {
|
|
5684
|
+
method: "mail/invite",
|
|
5685
|
+
category: "mail",
|
|
5686
|
+
capabilities: ["mail.canInvite"],
|
|
5687
|
+
description: "Invite a participant to a conversation"
|
|
5688
|
+
},
|
|
5689
|
+
"mail/turn": {
|
|
5690
|
+
method: "mail/turn",
|
|
5691
|
+
category: "mail",
|
|
5692
|
+
capabilities: ["mail.canJoin"],
|
|
5693
|
+
description: "Record a turn in a conversation"
|
|
5694
|
+
},
|
|
5695
|
+
"mail/turns/list": {
|
|
5696
|
+
method: "mail/turns/list",
|
|
5697
|
+
category: "mail",
|
|
5698
|
+
capabilities: ["mail.canViewHistory"],
|
|
5699
|
+
description: "List turns in a conversation"
|
|
5700
|
+
},
|
|
5701
|
+
"mail/thread/create": {
|
|
5702
|
+
method: "mail/thread/create",
|
|
5703
|
+
category: "mail",
|
|
5704
|
+
capabilities: ["mail.canCreateThreads"],
|
|
5705
|
+
description: "Create a thread within a conversation"
|
|
5706
|
+
},
|
|
5707
|
+
"mail/thread/list": {
|
|
5708
|
+
method: "mail/thread/list",
|
|
5709
|
+
category: "mail",
|
|
5710
|
+
capabilities: ["mail.canJoin"],
|
|
5711
|
+
description: "List threads in a conversation"
|
|
5712
|
+
},
|
|
5713
|
+
"mail/summary": {
|
|
5714
|
+
method: "mail/summary",
|
|
5715
|
+
category: "mail",
|
|
5716
|
+
capabilities: ["mail.canViewHistory"],
|
|
5717
|
+
description: "Get or generate a conversation summary"
|
|
5718
|
+
},
|
|
5719
|
+
"mail/replay": {
|
|
5720
|
+
method: "mail/replay",
|
|
5721
|
+
category: "mail",
|
|
5722
|
+
capabilities: ["mail.canViewHistory"],
|
|
5723
|
+
description: "Replay turns from a specific point"
|
|
5724
|
+
},
|
|
5231
5725
|
// Notification methods (client → server)
|
|
5232
5726
|
"subscription/ack": {
|
|
5233
5727
|
method: "map/subscribe.ack",
|
|
@@ -6452,6 +6946,8 @@ exports.InvalidAddressError = InvalidAddressError;
|
|
|
6452
6946
|
exports.JSONRPC_VERSION = JSONRPC_VERSION;
|
|
6453
6947
|
exports.JsonRpcVersionSchema = JsonRpcVersionSchema;
|
|
6454
6948
|
exports.LIFECYCLE_METHODS = LIFECYCLE_METHODS;
|
|
6949
|
+
exports.MAIL_ERROR_CODES = MAIL_ERROR_CODES;
|
|
6950
|
+
exports.MAIL_METHODS = MAIL_METHODS;
|
|
6455
6951
|
exports.MAPConnectionError = MAPConnectionError;
|
|
6456
6952
|
exports.MAPErrorDataSchema = MAPErrorDataSchema;
|
|
6457
6953
|
exports.MAPErrorSchema = MAPErrorSchema;
|