@multi-agent-protocol/sdk 0.0.7 → 0.0.9
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-J32EeqzO.d.cts} +1177 -73
- package/dist/{index-BQXp4_rd.d.ts → index-J32EeqzO.d.ts} +1177 -73
- package/dist/index.cjs +545 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -13
- package/dist/index.d.ts +21 -13
- package/dist/index.js +543 -9
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +397 -2
- 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 +397 -2
- package/dist/testing.js.map +1 -1
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ var EVENT_TYPES = {
|
|
|
93
93
|
AGENT_REGISTERED: "agent_registered",
|
|
94
94
|
AGENT_UNREGISTERED: "agent_unregistered",
|
|
95
95
|
AGENT_STATE_CHANGED: "agent_state_changed",
|
|
96
|
+
AGENT_ENVIRONMENT_CHANGED: "agent_environment_changed",
|
|
96
97
|
AGENT_ORPHANED: "agent_orphaned",
|
|
97
98
|
// Participant lifecycle events
|
|
98
99
|
PARTICIPANT_CONNECTED: "participant_connected",
|
|
@@ -113,7 +114,16 @@ var EVENT_TYPES = {
|
|
|
113
114
|
SYSTEM_ERROR: "system_error",
|
|
114
115
|
// Federation events
|
|
115
116
|
FEDERATION_CONNECTED: "federation_connected",
|
|
116
|
-
FEDERATION_DISCONNECTED: "federation_disconnected"
|
|
117
|
+
FEDERATION_DISCONNECTED: "federation_disconnected",
|
|
118
|
+
// Mail events
|
|
119
|
+
MAIL_CREATED: "mail.created",
|
|
120
|
+
MAIL_CLOSED: "mail.closed",
|
|
121
|
+
MAIL_PARTICIPANT_JOINED: "mail.participant.joined",
|
|
122
|
+
MAIL_PARTICIPANT_LEFT: "mail.participant.left",
|
|
123
|
+
MAIL_TURN_ADDED: "mail.turn.added",
|
|
124
|
+
MAIL_TURN_UPDATED: "mail.turn.updated",
|
|
125
|
+
MAIL_THREAD_CREATED: "mail.thread.created",
|
|
126
|
+
MAIL_SUMMARY_GENERATED: "mail.summary.generated"
|
|
117
127
|
};
|
|
118
128
|
function createEvent(input) {
|
|
119
129
|
return {
|
|
@@ -179,6 +189,26 @@ var FEDERATION_METHODS = {
|
|
|
179
189
|
FEDERATION_CONNECT: "map/federation/connect",
|
|
180
190
|
FEDERATION_ROUTE: "map/federation/route"
|
|
181
191
|
};
|
|
192
|
+
var MAIL_METHODS = {
|
|
193
|
+
MAIL_CREATE: "mail/create",
|
|
194
|
+
MAIL_GET: "mail/get",
|
|
195
|
+
MAIL_LIST: "mail/list",
|
|
196
|
+
MAIL_CLOSE: "mail/close",
|
|
197
|
+
MAIL_JOIN: "mail/join",
|
|
198
|
+
MAIL_LEAVE: "mail/leave",
|
|
199
|
+
MAIL_INVITE: "mail/invite",
|
|
200
|
+
MAIL_TURN: "mail/turn",
|
|
201
|
+
MAIL_TURNS_LIST: "mail/turns/list",
|
|
202
|
+
MAIL_THREAD_CREATE: "mail/thread/create",
|
|
203
|
+
MAIL_THREAD_LIST: "mail/thread/list",
|
|
204
|
+
MAIL_SUMMARY: "mail/summary",
|
|
205
|
+
MAIL_REPLAY: "mail/replay"
|
|
206
|
+
};
|
|
207
|
+
var WORKSPACE_METHODS = {
|
|
208
|
+
WORKSPACE_SEARCH: "workspace/search",
|
|
209
|
+
WORKSPACE_LIST: "workspace/list",
|
|
210
|
+
WORKSPACE_READ: "workspace/read"
|
|
211
|
+
};
|
|
182
212
|
var NOTIFICATION_METHODS = {
|
|
183
213
|
EVENT: "map/event",
|
|
184
214
|
MESSAGE: "map/message",
|
|
@@ -197,7 +227,9 @@ var MAP_METHODS = {
|
|
|
197
227
|
...SESSION_METHODS,
|
|
198
228
|
...AUTH_METHODS,
|
|
199
229
|
...PERMISSION_METHODS,
|
|
200
|
-
...FEDERATION_METHODS
|
|
230
|
+
...FEDERATION_METHODS,
|
|
231
|
+
...MAIL_METHODS,
|
|
232
|
+
...WORKSPACE_METHODS
|
|
201
233
|
};
|
|
202
234
|
var STRUCTURE_METHODS = {
|
|
203
235
|
...LIFECYCLE_METHODS,
|
|
@@ -252,7 +284,24 @@ var FEDERATION_ERROR_CODES = {
|
|
|
252
284
|
/** Message has already visited this system (loop detected) */
|
|
253
285
|
FEDERATION_LOOP_DETECTED: 5010,
|
|
254
286
|
/** Message exceeded maximum hop count */
|
|
255
|
-
FEDERATION_MAX_HOPS_EXCEEDED: 5011
|
|
287
|
+
FEDERATION_MAX_HOPS_EXCEEDED: 5011,
|
|
288
|
+
/** DID document resolution failed (network error, invalid document, etc.) */
|
|
289
|
+
FEDERATION_DID_RESOLUTION_FAILED: 5004,
|
|
290
|
+
/** DID proof verification failed (bad signature, expired, wrong challenge, etc.) */
|
|
291
|
+
FEDERATION_DID_PROOF_INVALID: 5005
|
|
292
|
+
};
|
|
293
|
+
var MAIL_ERROR_CODES = {
|
|
294
|
+
MAIL_CONVERSATION_NOT_FOUND: 1e4,
|
|
295
|
+
MAIL_CONVERSATION_CLOSED: 10001,
|
|
296
|
+
MAIL_NOT_A_PARTICIPANT: 10002,
|
|
297
|
+
MAIL_PERMISSION_DENIED: 10003,
|
|
298
|
+
MAIL_TURN_NOT_FOUND: 10004,
|
|
299
|
+
MAIL_THREAD_NOT_FOUND: 10005,
|
|
300
|
+
MAIL_INVALID_TURN_CONTENT: 10006,
|
|
301
|
+
MAIL_PARTICIPANT_ALREADY_JOINED: 10007,
|
|
302
|
+
MAIL_INVITATION_REQUIRED: 10008,
|
|
303
|
+
MAIL_HISTORY_ACCESS_DENIED: 10009,
|
|
304
|
+
MAIL_PARENT_CONVERSATION_NOT_FOUND: 10010
|
|
256
305
|
};
|
|
257
306
|
var ERROR_CODES = {
|
|
258
307
|
...PROTOCOL_ERROR_CODES,
|
|
@@ -260,7 +309,8 @@ var ERROR_CODES = {
|
|
|
260
309
|
...ROUTING_ERROR_CODES,
|
|
261
310
|
...AGENT_ERROR_CODES,
|
|
262
311
|
...RESOURCE_ERROR_CODES,
|
|
263
|
-
...FEDERATION_ERROR_CODES
|
|
312
|
+
...FEDERATION_ERROR_CODES,
|
|
313
|
+
...MAIL_ERROR_CODES
|
|
264
314
|
};
|
|
265
315
|
var PROTOCOL_VERSION = 1;
|
|
266
316
|
var CAPABILITY_REQUIREMENTS = {
|
|
@@ -304,7 +354,25 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
304
354
|
[PERMISSION_METHODS.PERMISSIONS_UPDATE]: [],
|
|
305
355
|
// Federation
|
|
306
356
|
[FEDERATION_METHODS.FEDERATION_CONNECT]: ["federation.canFederate"],
|
|
307
|
-
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"]
|
|
357
|
+
[FEDERATION_METHODS.FEDERATION_ROUTE]: ["federation.canFederate"],
|
|
358
|
+
// Mail
|
|
359
|
+
[MAIL_METHODS.MAIL_CREATE]: ["mail.canCreate"],
|
|
360
|
+
[MAIL_METHODS.MAIL_GET]: ["mail.canJoin"],
|
|
361
|
+
[MAIL_METHODS.MAIL_LIST]: ["mail.canJoin"],
|
|
362
|
+
[MAIL_METHODS.MAIL_CLOSE]: ["mail.canCreate"],
|
|
363
|
+
[MAIL_METHODS.MAIL_JOIN]: ["mail.canJoin"],
|
|
364
|
+
[MAIL_METHODS.MAIL_LEAVE]: ["mail.canJoin"],
|
|
365
|
+
[MAIL_METHODS.MAIL_INVITE]: ["mail.canInvite"],
|
|
366
|
+
[MAIL_METHODS.MAIL_TURN]: ["mail.canJoin"],
|
|
367
|
+
[MAIL_METHODS.MAIL_TURNS_LIST]: ["mail.canViewHistory"],
|
|
368
|
+
[MAIL_METHODS.MAIL_THREAD_CREATE]: ["mail.canCreateThreads"],
|
|
369
|
+
[MAIL_METHODS.MAIL_THREAD_LIST]: ["mail.canJoin"],
|
|
370
|
+
[MAIL_METHODS.MAIL_SUMMARY]: ["mail.canViewHistory"],
|
|
371
|
+
[MAIL_METHODS.MAIL_REPLAY]: ["mail.canViewHistory"],
|
|
372
|
+
// Workspace
|
|
373
|
+
[WORKSPACE_METHODS.WORKSPACE_SEARCH]: ["workspace.canSearch"],
|
|
374
|
+
[WORKSPACE_METHODS.WORKSPACE_LIST]: ["workspace.canList"],
|
|
375
|
+
[WORKSPACE_METHODS.WORKSPACE_READ]: ["workspace.canRead"]
|
|
308
376
|
};
|
|
309
377
|
function isSuccessResponse(response) {
|
|
310
378
|
return "result" in response;
|
|
@@ -3262,6 +3330,187 @@ var ClientConnection = class _ClientConnection {
|
|
|
3262
3330
|
return this.#connection.sendRequest(STATE_METHODS.AGENTS_RESUME, { agentId });
|
|
3263
3331
|
}
|
|
3264
3332
|
// ===========================================================================
|
|
3333
|
+
// Mail
|
|
3334
|
+
// ===========================================================================
|
|
3335
|
+
/**
|
|
3336
|
+
* Create a new mail conversation.
|
|
3337
|
+
*
|
|
3338
|
+
* @param params - Conversation creation parameters
|
|
3339
|
+
* @returns Created conversation and participant info
|
|
3340
|
+
*/
|
|
3341
|
+
async createConversation(params) {
|
|
3342
|
+
return this.#connection.sendRequest(
|
|
3343
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
3344
|
+
params ?? {}
|
|
3345
|
+
);
|
|
3346
|
+
}
|
|
3347
|
+
/**
|
|
3348
|
+
* Get a conversation by ID with optional includes.
|
|
3349
|
+
*
|
|
3350
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
3351
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
3352
|
+
* @returns Conversation details with requested includes
|
|
3353
|
+
*/
|
|
3354
|
+
async getConversation(conversationId, include) {
|
|
3355
|
+
return this.#connection.sendRequest(
|
|
3356
|
+
MAIL_METHODS.MAIL_GET,
|
|
3357
|
+
{ conversationId, include }
|
|
3358
|
+
);
|
|
3359
|
+
}
|
|
3360
|
+
/**
|
|
3361
|
+
* List conversations with optional filters.
|
|
3362
|
+
*
|
|
3363
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
3364
|
+
* @returns Paginated list of conversations
|
|
3365
|
+
*/
|
|
3366
|
+
async listConversations(params) {
|
|
3367
|
+
return this.#connection.sendRequest(
|
|
3368
|
+
MAIL_METHODS.MAIL_LIST,
|
|
3369
|
+
params ?? {}
|
|
3370
|
+
);
|
|
3371
|
+
}
|
|
3372
|
+
/**
|
|
3373
|
+
* Close a conversation.
|
|
3374
|
+
*
|
|
3375
|
+
* @param conversationId - ID of the conversation to close
|
|
3376
|
+
* @param reason - Optional reason for closing
|
|
3377
|
+
* @returns The closed conversation
|
|
3378
|
+
*/
|
|
3379
|
+
async closeConversation(conversationId, reason) {
|
|
3380
|
+
return this.#connection.sendRequest(
|
|
3381
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
3382
|
+
{ conversationId, reason }
|
|
3383
|
+
);
|
|
3384
|
+
}
|
|
3385
|
+
/**
|
|
3386
|
+
* Join an existing conversation.
|
|
3387
|
+
*
|
|
3388
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
3389
|
+
* @returns Conversation, participant, and optional history
|
|
3390
|
+
*/
|
|
3391
|
+
async joinConversation(params) {
|
|
3392
|
+
return this.#connection.sendRequest(
|
|
3393
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
3394
|
+
params
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
/**
|
|
3398
|
+
* Leave a conversation.
|
|
3399
|
+
*
|
|
3400
|
+
* @param conversationId - ID of the conversation to leave
|
|
3401
|
+
* @param reason - Optional reason for leaving
|
|
3402
|
+
* @returns Leave confirmation with timestamp
|
|
3403
|
+
*/
|
|
3404
|
+
async leaveConversation(conversationId, reason) {
|
|
3405
|
+
return this.#connection.sendRequest(
|
|
3406
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
3407
|
+
{ conversationId, reason }
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* Invite a participant to a conversation.
|
|
3412
|
+
*
|
|
3413
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
3414
|
+
* @returns Invite result
|
|
3415
|
+
*/
|
|
3416
|
+
async inviteToConversation(params) {
|
|
3417
|
+
return this.#connection.sendRequest(
|
|
3418
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
3419
|
+
params
|
|
3420
|
+
);
|
|
3421
|
+
}
|
|
3422
|
+
/**
|
|
3423
|
+
* Record a turn (message) in a conversation.
|
|
3424
|
+
*
|
|
3425
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
3426
|
+
* @returns The created turn
|
|
3427
|
+
*/
|
|
3428
|
+
async recordTurn(params) {
|
|
3429
|
+
return this.#connection.sendRequest(
|
|
3430
|
+
MAIL_METHODS.MAIL_TURN,
|
|
3431
|
+
params
|
|
3432
|
+
);
|
|
3433
|
+
}
|
|
3434
|
+
/**
|
|
3435
|
+
* List turns in a conversation with optional filters.
|
|
3436
|
+
*
|
|
3437
|
+
* @param params - List parameters including conversationId and optional filters
|
|
3438
|
+
* @returns Paginated list of turns
|
|
3439
|
+
*/
|
|
3440
|
+
async listTurns(params) {
|
|
3441
|
+
return this.#connection.sendRequest(
|
|
3442
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
3443
|
+
params
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3446
|
+
/**
|
|
3447
|
+
* Create a thread in a conversation.
|
|
3448
|
+
*
|
|
3449
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
3450
|
+
* @returns The created thread
|
|
3451
|
+
*/
|
|
3452
|
+
async createThread(params) {
|
|
3453
|
+
return this.#connection.sendRequest(
|
|
3454
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
3455
|
+
params
|
|
3456
|
+
);
|
|
3457
|
+
}
|
|
3458
|
+
/**
|
|
3459
|
+
* List threads in a conversation.
|
|
3460
|
+
*
|
|
3461
|
+
* @param params - List parameters including conversationId
|
|
3462
|
+
* @returns Paginated list of threads
|
|
3463
|
+
*/
|
|
3464
|
+
async listThreads(params) {
|
|
3465
|
+
return this.#connection.sendRequest(
|
|
3466
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
3467
|
+
params
|
|
3468
|
+
);
|
|
3469
|
+
}
|
|
3470
|
+
/**
|
|
3471
|
+
* Get a summary of a conversation.
|
|
3472
|
+
*
|
|
3473
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
3474
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
3475
|
+
*/
|
|
3476
|
+
async getConversationSummary(params) {
|
|
3477
|
+
return this.#connection.sendRequest(
|
|
3478
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
3479
|
+
params
|
|
3480
|
+
);
|
|
3481
|
+
}
|
|
3482
|
+
/**
|
|
3483
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
3484
|
+
*
|
|
3485
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
3486
|
+
* @returns Replayed turns with pagination info
|
|
3487
|
+
*/
|
|
3488
|
+
async replayConversation(params) {
|
|
3489
|
+
return this.#connection.sendRequest(
|
|
3490
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
3491
|
+
params
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
/**
|
|
3495
|
+
* Send a message to an address with mail context attached.
|
|
3496
|
+
*
|
|
3497
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
3498
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
3499
|
+
* in the conversation.
|
|
3500
|
+
*
|
|
3501
|
+
* @param to - Target address
|
|
3502
|
+
* @param payload - Message payload
|
|
3503
|
+
* @param conversationId - Conversation to associate with
|
|
3504
|
+
* @param options - Optional threadId and additional message meta
|
|
3505
|
+
* @returns Send result
|
|
3506
|
+
*/
|
|
3507
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
3508
|
+
return this.send(to, payload, {
|
|
3509
|
+
...options?.meta,
|
|
3510
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
// ===========================================================================
|
|
3265
3514
|
// Reconnection
|
|
3266
3515
|
// ===========================================================================
|
|
3267
3516
|
/**
|
|
@@ -4032,6 +4281,187 @@ var AgentConnection = class _AgentConnection {
|
|
|
4032
4281
|
return this.#connection.onStateChange(handler);
|
|
4033
4282
|
}
|
|
4034
4283
|
// ===========================================================================
|
|
4284
|
+
// Mail
|
|
4285
|
+
// ===========================================================================
|
|
4286
|
+
/**
|
|
4287
|
+
* Create a new mail conversation.
|
|
4288
|
+
*
|
|
4289
|
+
* @param params - Conversation creation parameters
|
|
4290
|
+
* @returns Created conversation and participant info
|
|
4291
|
+
*/
|
|
4292
|
+
async createConversation(params) {
|
|
4293
|
+
return this.#connection.sendRequest(
|
|
4294
|
+
MAIL_METHODS.MAIL_CREATE,
|
|
4295
|
+
params ?? {}
|
|
4296
|
+
);
|
|
4297
|
+
}
|
|
4298
|
+
/**
|
|
4299
|
+
* Get a conversation by ID with optional includes.
|
|
4300
|
+
*
|
|
4301
|
+
* @param conversationId - ID of the conversation to retrieve
|
|
4302
|
+
* @param include - Optional fields to include (participants, threads, recentTurns, stats)
|
|
4303
|
+
* @returns Conversation details with requested includes
|
|
4304
|
+
*/
|
|
4305
|
+
async getConversation(conversationId, include) {
|
|
4306
|
+
return this.#connection.sendRequest(
|
|
4307
|
+
MAIL_METHODS.MAIL_GET,
|
|
4308
|
+
{ conversationId, include }
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4311
|
+
/**
|
|
4312
|
+
* List conversations with optional filters.
|
|
4313
|
+
*
|
|
4314
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
4315
|
+
* @returns Paginated list of conversations
|
|
4316
|
+
*/
|
|
4317
|
+
async listConversations(params) {
|
|
4318
|
+
return this.#connection.sendRequest(
|
|
4319
|
+
MAIL_METHODS.MAIL_LIST,
|
|
4320
|
+
params ?? {}
|
|
4321
|
+
);
|
|
4322
|
+
}
|
|
4323
|
+
/**
|
|
4324
|
+
* Close a conversation.
|
|
4325
|
+
*
|
|
4326
|
+
* @param conversationId - ID of the conversation to close
|
|
4327
|
+
* @param reason - Optional reason for closing
|
|
4328
|
+
* @returns The closed conversation
|
|
4329
|
+
*/
|
|
4330
|
+
async closeConversation(conversationId, reason) {
|
|
4331
|
+
return this.#connection.sendRequest(
|
|
4332
|
+
MAIL_METHODS.MAIL_CLOSE,
|
|
4333
|
+
{ conversationId, reason }
|
|
4334
|
+
);
|
|
4335
|
+
}
|
|
4336
|
+
/**
|
|
4337
|
+
* Join an existing conversation.
|
|
4338
|
+
*
|
|
4339
|
+
* @param params - Join parameters including conversationId and optional catch-up config
|
|
4340
|
+
* @returns Conversation, participant, and optional history
|
|
4341
|
+
*/
|
|
4342
|
+
async joinConversation(params) {
|
|
4343
|
+
return this.#connection.sendRequest(
|
|
4344
|
+
MAIL_METHODS.MAIL_JOIN,
|
|
4345
|
+
params
|
|
4346
|
+
);
|
|
4347
|
+
}
|
|
4348
|
+
/**
|
|
4349
|
+
* Leave a conversation.
|
|
4350
|
+
*
|
|
4351
|
+
* @param conversationId - ID of the conversation to leave
|
|
4352
|
+
* @param reason - Optional reason for leaving
|
|
4353
|
+
* @returns Leave confirmation with timestamp
|
|
4354
|
+
*/
|
|
4355
|
+
async leaveConversation(conversationId, reason) {
|
|
4356
|
+
return this.#connection.sendRequest(
|
|
4357
|
+
MAIL_METHODS.MAIL_LEAVE,
|
|
4358
|
+
{ conversationId, reason }
|
|
4359
|
+
);
|
|
4360
|
+
}
|
|
4361
|
+
/**
|
|
4362
|
+
* Invite a participant to a conversation.
|
|
4363
|
+
*
|
|
4364
|
+
* @param params - Invite parameters including conversationId and participant info
|
|
4365
|
+
* @returns Invite result
|
|
4366
|
+
*/
|
|
4367
|
+
async inviteToConversation(params) {
|
|
4368
|
+
return this.#connection.sendRequest(
|
|
4369
|
+
MAIL_METHODS.MAIL_INVITE,
|
|
4370
|
+
params
|
|
4371
|
+
);
|
|
4372
|
+
}
|
|
4373
|
+
/**
|
|
4374
|
+
* Record a turn (message) in a conversation.
|
|
4375
|
+
*
|
|
4376
|
+
* @param params - Turn parameters including conversationId, contentType, and content
|
|
4377
|
+
* @returns The created turn
|
|
4378
|
+
*/
|
|
4379
|
+
async recordTurn(params) {
|
|
4380
|
+
return this.#connection.sendRequest(
|
|
4381
|
+
MAIL_METHODS.MAIL_TURN,
|
|
4382
|
+
params
|
|
4383
|
+
);
|
|
4384
|
+
}
|
|
4385
|
+
/**
|
|
4386
|
+
* List turns in a conversation with optional filters.
|
|
4387
|
+
*
|
|
4388
|
+
* @param params - List parameters including conversationId and optional filters
|
|
4389
|
+
* @returns Paginated list of turns
|
|
4390
|
+
*/
|
|
4391
|
+
async listTurns(params) {
|
|
4392
|
+
return this.#connection.sendRequest(
|
|
4393
|
+
MAIL_METHODS.MAIL_TURNS_LIST,
|
|
4394
|
+
params
|
|
4395
|
+
);
|
|
4396
|
+
}
|
|
4397
|
+
/**
|
|
4398
|
+
* Create a thread in a conversation.
|
|
4399
|
+
*
|
|
4400
|
+
* @param params - Thread creation parameters including conversationId and rootTurnId
|
|
4401
|
+
* @returns The created thread
|
|
4402
|
+
*/
|
|
4403
|
+
async createThread(params) {
|
|
4404
|
+
return this.#connection.sendRequest(
|
|
4405
|
+
MAIL_METHODS.MAIL_THREAD_CREATE,
|
|
4406
|
+
params
|
|
4407
|
+
);
|
|
4408
|
+
}
|
|
4409
|
+
/**
|
|
4410
|
+
* List threads in a conversation.
|
|
4411
|
+
*
|
|
4412
|
+
* @param params - List parameters including conversationId
|
|
4413
|
+
* @returns Paginated list of threads
|
|
4414
|
+
*/
|
|
4415
|
+
async listThreads(params) {
|
|
4416
|
+
return this.#connection.sendRequest(
|
|
4417
|
+
MAIL_METHODS.MAIL_THREAD_LIST,
|
|
4418
|
+
params
|
|
4419
|
+
);
|
|
4420
|
+
}
|
|
4421
|
+
/**
|
|
4422
|
+
* Get a summary of a conversation.
|
|
4423
|
+
*
|
|
4424
|
+
* @param params - Summary parameters including conversationId and optional scope/includes
|
|
4425
|
+
* @returns Generated summary with optional key points, decisions, and questions
|
|
4426
|
+
*/
|
|
4427
|
+
async getConversationSummary(params) {
|
|
4428
|
+
return this.#connection.sendRequest(
|
|
4429
|
+
MAIL_METHODS.MAIL_SUMMARY,
|
|
4430
|
+
params
|
|
4431
|
+
);
|
|
4432
|
+
}
|
|
4433
|
+
/**
|
|
4434
|
+
* Replay turns from a conversation, optionally from a specific point.
|
|
4435
|
+
*
|
|
4436
|
+
* @param params - Replay parameters including conversationId and optional starting point
|
|
4437
|
+
* @returns Replayed turns with pagination info
|
|
4438
|
+
*/
|
|
4439
|
+
async replayConversation(params) {
|
|
4440
|
+
return this.#connection.sendRequest(
|
|
4441
|
+
MAIL_METHODS.MAIL_REPLAY,
|
|
4442
|
+
params
|
|
4443
|
+
);
|
|
4444
|
+
}
|
|
4445
|
+
/**
|
|
4446
|
+
* Send a message to an agent with mail context attached.
|
|
4447
|
+
*
|
|
4448
|
+
* Wraps the standard `send()` method, automatically attaching `meta.mail`
|
|
4449
|
+
* with the specified conversationId so the message is recorded as a turn
|
|
4450
|
+
* in the conversation.
|
|
4451
|
+
*
|
|
4452
|
+
* @param to - Target address
|
|
4453
|
+
* @param payload - Message payload
|
|
4454
|
+
* @param conversationId - Conversation to associate with
|
|
4455
|
+
* @param options - Optional threadId and additional message meta
|
|
4456
|
+
* @returns Send result
|
|
4457
|
+
*/
|
|
4458
|
+
async sendWithMail(to, payload, conversationId, options) {
|
|
4459
|
+
return this.send(to, payload, {
|
|
4460
|
+
...options?.meta,
|
|
4461
|
+
mail: { conversationId, threadId: options?.threadId }
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
// ===========================================================================
|
|
4035
4465
|
// Internal
|
|
4036
4466
|
// ===========================================================================
|
|
4037
4467
|
/**
|
|
@@ -4542,13 +4972,19 @@ var GatewayConnection = class {
|
|
|
4542
4972
|
// Federation
|
|
4543
4973
|
// ===========================================================================
|
|
4544
4974
|
/**
|
|
4545
|
-
* Connect to a remote MAP system
|
|
4975
|
+
* Connect to a remote MAP system.
|
|
4976
|
+
*
|
|
4977
|
+
* Supports single-request authentication: if `auth` is provided,
|
|
4978
|
+
* credentials are sent in the initial connect request for 1-RTT auth.
|
|
4979
|
+
* If the server responds with `authRequired`, the client can retry
|
|
4980
|
+
* with appropriate credentials.
|
|
4546
4981
|
*/
|
|
4547
|
-
async connectToSystem(systemId, endpoint,
|
|
4982
|
+
async connectToSystem(systemId, endpoint, options) {
|
|
4548
4983
|
const params = {
|
|
4549
4984
|
systemId,
|
|
4550
4985
|
endpoint,
|
|
4551
|
-
auth
|
|
4986
|
+
auth: options?.auth,
|
|
4987
|
+
authContext: options?.authContext
|
|
4552
4988
|
};
|
|
4553
4989
|
const result = await this.#connection.sendRequest(FEDERATION_METHODS.FEDERATION_CONNECT, params);
|
|
4554
4990
|
if (result.connected && result.systemInfo) {
|
|
@@ -5228,6 +5664,104 @@ var METHOD_REGISTRY = {
|
|
|
5228
5664
|
capabilities: ["federation.canFederate"],
|
|
5229
5665
|
description: "Route message to federated system"
|
|
5230
5666
|
},
|
|
5667
|
+
// Mail methods
|
|
5668
|
+
"mail/create": {
|
|
5669
|
+
method: "mail/create",
|
|
5670
|
+
category: "mail",
|
|
5671
|
+
capabilities: ["mail.canCreate"],
|
|
5672
|
+
description: "Create a new conversation"
|
|
5673
|
+
},
|
|
5674
|
+
"mail/get": {
|
|
5675
|
+
method: "mail/get",
|
|
5676
|
+
category: "mail",
|
|
5677
|
+
capabilities: ["mail.canJoin"],
|
|
5678
|
+
description: "Get conversation details"
|
|
5679
|
+
},
|
|
5680
|
+
"mail/list": {
|
|
5681
|
+
method: "mail/list",
|
|
5682
|
+
category: "mail",
|
|
5683
|
+
capabilities: ["mail.canJoin"],
|
|
5684
|
+
description: "List conversations"
|
|
5685
|
+
},
|
|
5686
|
+
"mail/close": {
|
|
5687
|
+
method: "mail/close",
|
|
5688
|
+
category: "mail",
|
|
5689
|
+
capabilities: ["mail.canCreate"],
|
|
5690
|
+
description: "Close a conversation"
|
|
5691
|
+
},
|
|
5692
|
+
"mail/join": {
|
|
5693
|
+
method: "mail/join",
|
|
5694
|
+
category: "mail",
|
|
5695
|
+
capabilities: ["mail.canJoin"],
|
|
5696
|
+
description: "Join an existing conversation"
|
|
5697
|
+
},
|
|
5698
|
+
"mail/leave": {
|
|
5699
|
+
method: "mail/leave",
|
|
5700
|
+
category: "mail",
|
|
5701
|
+
capabilities: ["mail.canJoin"],
|
|
5702
|
+
description: "Leave a conversation"
|
|
5703
|
+
},
|
|
5704
|
+
"mail/invite": {
|
|
5705
|
+
method: "mail/invite",
|
|
5706
|
+
category: "mail",
|
|
5707
|
+
capabilities: ["mail.canInvite"],
|
|
5708
|
+
description: "Invite a participant to a conversation"
|
|
5709
|
+
},
|
|
5710
|
+
"mail/turn": {
|
|
5711
|
+
method: "mail/turn",
|
|
5712
|
+
category: "mail",
|
|
5713
|
+
capabilities: ["mail.canJoin"],
|
|
5714
|
+
description: "Record a turn in a conversation"
|
|
5715
|
+
},
|
|
5716
|
+
"mail/turns/list": {
|
|
5717
|
+
method: "mail/turns/list",
|
|
5718
|
+
category: "mail",
|
|
5719
|
+
capabilities: ["mail.canViewHistory"],
|
|
5720
|
+
description: "List turns in a conversation"
|
|
5721
|
+
},
|
|
5722
|
+
"mail/thread/create": {
|
|
5723
|
+
method: "mail/thread/create",
|
|
5724
|
+
category: "mail",
|
|
5725
|
+
capabilities: ["mail.canCreateThreads"],
|
|
5726
|
+
description: "Create a thread within a conversation"
|
|
5727
|
+
},
|
|
5728
|
+
"mail/thread/list": {
|
|
5729
|
+
method: "mail/thread/list",
|
|
5730
|
+
category: "mail",
|
|
5731
|
+
capabilities: ["mail.canJoin"],
|
|
5732
|
+
description: "List threads in a conversation"
|
|
5733
|
+
},
|
|
5734
|
+
"mail/summary": {
|
|
5735
|
+
method: "mail/summary",
|
|
5736
|
+
category: "mail",
|
|
5737
|
+
capabilities: ["mail.canViewHistory"],
|
|
5738
|
+
description: "Get or generate a conversation summary"
|
|
5739
|
+
},
|
|
5740
|
+
"mail/replay": {
|
|
5741
|
+
method: "mail/replay",
|
|
5742
|
+
category: "mail",
|
|
5743
|
+
capabilities: ["mail.canViewHistory"],
|
|
5744
|
+
description: "Replay turns from a specific point"
|
|
5745
|
+
},
|
|
5746
|
+
// Workspace methods
|
|
5747
|
+
"workspace/search": {
|
|
5748
|
+
method: "workspace/search",
|
|
5749
|
+
category: "workspace",
|
|
5750
|
+
capabilities: ["workspace.canSearch"],
|
|
5751
|
+
description: "Search for files matching a query"
|
|
5752
|
+
},
|
|
5753
|
+
"workspace/list": {
|
|
5754
|
+
method: "workspace/list",
|
|
5755
|
+
category: "workspace",
|
|
5756
|
+
capabilities: ["workspace.canList"],
|
|
5757
|
+
description: "List files in a directory"
|
|
5758
|
+
},
|
|
5759
|
+
"workspace/read": {
|
|
5760
|
+
method: "workspace/read",
|
|
5761
|
+
category: "workspace",
|
|
5762
|
+
capabilities: ["workspace.canRead"],
|
|
5763
|
+
description: "Read file contents"
|
|
5764
|
+
},
|
|
5231
5765
|
// Notification methods (client → server)
|
|
5232
5766
|
"subscription/ack": {
|
|
5233
5767
|
method: "map/subscribe.ack",
|
|
@@ -6452,6 +6986,8 @@ exports.InvalidAddressError = InvalidAddressError;
|
|
|
6452
6986
|
exports.JSONRPC_VERSION = JSONRPC_VERSION;
|
|
6453
6987
|
exports.JsonRpcVersionSchema = JsonRpcVersionSchema;
|
|
6454
6988
|
exports.LIFECYCLE_METHODS = LIFECYCLE_METHODS;
|
|
6989
|
+
exports.MAIL_ERROR_CODES = MAIL_ERROR_CODES;
|
|
6990
|
+
exports.MAIL_METHODS = MAIL_METHODS;
|
|
6455
6991
|
exports.MAPConnectionError = MAPConnectionError;
|
|
6456
6992
|
exports.MAPErrorDataSchema = MAPErrorDataSchema;
|
|
6457
6993
|
exports.MAPErrorSchema = MAPErrorSchema;
|
|
@@ -6505,6 +7041,7 @@ exports.SubscriptionIdSchema = SubscriptionIdSchema;
|
|
|
6505
7041
|
exports.SystemAddressSchema = SystemAddressSchema;
|
|
6506
7042
|
exports.TimestampSchema = TimestampSchema;
|
|
6507
7043
|
exports.TransportTypeSchema = TransportTypeSchema;
|
|
7044
|
+
exports.WORKSPACE_METHODS = WORKSPACE_METHODS;
|
|
6508
7045
|
exports.agenticMeshStream = agenticMeshStream;
|
|
6509
7046
|
exports.buildAgentsGetResponse = buildAgentsGetResponse;
|
|
6510
7047
|
exports.buildAgentsListResponse = buildAgentsListResponse;
|