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