@multi-agent-protocol/sdk 0.0.8 → 0.0.10
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-BVvyY2kb.d.cts → index-C7Jyk_qT.d.cts} +433 -99
- package/dist/{index-BVvyY2kb.d.ts → index-C7Jyk_qT.d.ts} +433 -99
- package/dist/index.cjs +73 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -9
- package/dist/index.d.ts +17 -9
- package/dist/index.js +73 -7
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +31 -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 +31 -1
- 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",
|
|
@@ -203,6 +204,11 @@ var MAIL_METHODS = {
|
|
|
203
204
|
MAIL_SUMMARY: "mail/summary",
|
|
204
205
|
MAIL_REPLAY: "mail/replay"
|
|
205
206
|
};
|
|
207
|
+
var WORKSPACE_METHODS = {
|
|
208
|
+
WORKSPACE_SEARCH: "workspace/search",
|
|
209
|
+
WORKSPACE_LIST: "workspace/list",
|
|
210
|
+
WORKSPACE_READ: "workspace/read"
|
|
211
|
+
};
|
|
206
212
|
var NOTIFICATION_METHODS = {
|
|
207
213
|
EVENT: "map/event",
|
|
208
214
|
MESSAGE: "map/message",
|
|
@@ -222,7 +228,8 @@ var MAP_METHODS = {
|
|
|
222
228
|
...AUTH_METHODS,
|
|
223
229
|
...PERMISSION_METHODS,
|
|
224
230
|
...FEDERATION_METHODS,
|
|
225
|
-
...MAIL_METHODS
|
|
231
|
+
...MAIL_METHODS,
|
|
232
|
+
...WORKSPACE_METHODS
|
|
226
233
|
};
|
|
227
234
|
var STRUCTURE_METHODS = {
|
|
228
235
|
...LIFECYCLE_METHODS,
|
|
@@ -277,7 +284,11 @@ var FEDERATION_ERROR_CODES = {
|
|
|
277
284
|
/** Message has already visited this system (loop detected) */
|
|
278
285
|
FEDERATION_LOOP_DETECTED: 5010,
|
|
279
286
|
/** Message exceeded maximum hop count */
|
|
280
|
-
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
|
|
281
292
|
};
|
|
282
293
|
var MAIL_ERROR_CODES = {
|
|
283
294
|
MAIL_CONVERSATION_NOT_FOUND: 1e4,
|
|
@@ -357,7 +368,11 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
357
368
|
[MAIL_METHODS.MAIL_THREAD_CREATE]: ["mail.canCreateThreads"],
|
|
358
369
|
[MAIL_METHODS.MAIL_THREAD_LIST]: ["mail.canJoin"],
|
|
359
370
|
[MAIL_METHODS.MAIL_SUMMARY]: ["mail.canViewHistory"],
|
|
360
|
-
[MAIL_METHODS.MAIL_REPLAY]: ["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"]
|
|
361
376
|
};
|
|
362
377
|
function isSuccessResponse(response) {
|
|
363
378
|
return "result" in response;
|
|
@@ -3315,6 +3330,32 @@ var ClientConnection = class _ClientConnection {
|
|
|
3315
3330
|
return this.#connection.sendRequest(STATE_METHODS.AGENTS_RESUME, { agentId });
|
|
3316
3331
|
}
|
|
3317
3332
|
// ===========================================================================
|
|
3333
|
+
// Extensions
|
|
3334
|
+
// ===========================================================================
|
|
3335
|
+
/**
|
|
3336
|
+
* Call a server extension method directly via JSON-RPC.
|
|
3337
|
+
*
|
|
3338
|
+
* Extension methods (prefixed with `_macro/` or similar) are registered on the
|
|
3339
|
+
* server's RPC handler and callable as standard JSON-RPC methods. This bypasses
|
|
3340
|
+
* ACP-over-MAP messaging — use this for simple request/response operations that
|
|
3341
|
+
* don't need ACP session semantics.
|
|
3342
|
+
*
|
|
3343
|
+
* @param method - The extension method name (e.g., "_macro/workspace/files/search")
|
|
3344
|
+
* @param params - Parameters to pass to the extension method
|
|
3345
|
+
* @returns The result from the extension method
|
|
3346
|
+
*
|
|
3347
|
+
* @example
|
|
3348
|
+
* ```typescript
|
|
3349
|
+
* const result = await client.callExtension('_macro/workspace/files/search', {
|
|
3350
|
+
* agentId: 'agent-1',
|
|
3351
|
+
* query: 'app.tsx',
|
|
3352
|
+
* });
|
|
3353
|
+
* ```
|
|
3354
|
+
*/
|
|
3355
|
+
async callExtension(method, params) {
|
|
3356
|
+
return this.#connection.sendRequest(method, params);
|
|
3357
|
+
}
|
|
3358
|
+
// ===========================================================================
|
|
3318
3359
|
// Mail
|
|
3319
3360
|
// ===========================================================================
|
|
3320
3361
|
/**
|
|
@@ -4957,13 +4998,19 @@ var GatewayConnection = class {
|
|
|
4957
4998
|
// Federation
|
|
4958
4999
|
// ===========================================================================
|
|
4959
5000
|
/**
|
|
4960
|
-
* Connect to a remote MAP system
|
|
5001
|
+
* Connect to a remote MAP system.
|
|
5002
|
+
*
|
|
5003
|
+
* Supports single-request authentication: if `auth` is provided,
|
|
5004
|
+
* credentials are sent in the initial connect request for 1-RTT auth.
|
|
5005
|
+
* If the server responds with `authRequired`, the client can retry
|
|
5006
|
+
* with appropriate credentials.
|
|
4961
5007
|
*/
|
|
4962
|
-
async connectToSystem(systemId, endpoint,
|
|
5008
|
+
async connectToSystem(systemId, endpoint, options) {
|
|
4963
5009
|
const params = {
|
|
4964
5010
|
systemId,
|
|
4965
5011
|
endpoint,
|
|
4966
|
-
auth
|
|
5012
|
+
auth: options?.auth,
|
|
5013
|
+
authContext: options?.authContext
|
|
4967
5014
|
};
|
|
4968
5015
|
const result = await this.#connection.sendRequest(FEDERATION_METHODS.FEDERATION_CONNECT, params);
|
|
4969
5016
|
if (result.connected && result.systemInfo) {
|
|
@@ -5722,6 +5769,25 @@ var METHOD_REGISTRY = {
|
|
|
5722
5769
|
capabilities: ["mail.canViewHistory"],
|
|
5723
5770
|
description: "Replay turns from a specific point"
|
|
5724
5771
|
},
|
|
5772
|
+
// Workspace methods
|
|
5773
|
+
"workspace/search": {
|
|
5774
|
+
method: "workspace/search",
|
|
5775
|
+
category: "workspace",
|
|
5776
|
+
capabilities: ["workspace.canSearch"],
|
|
5777
|
+
description: "Search for files matching a query"
|
|
5778
|
+
},
|
|
5779
|
+
"workspace/list": {
|
|
5780
|
+
method: "workspace/list",
|
|
5781
|
+
category: "workspace",
|
|
5782
|
+
capabilities: ["workspace.canList"],
|
|
5783
|
+
description: "List files in a directory"
|
|
5784
|
+
},
|
|
5785
|
+
"workspace/read": {
|
|
5786
|
+
method: "workspace/read",
|
|
5787
|
+
category: "workspace",
|
|
5788
|
+
capabilities: ["workspace.canRead"],
|
|
5789
|
+
description: "Read file contents"
|
|
5790
|
+
},
|
|
5725
5791
|
// Notification methods (client → server)
|
|
5726
5792
|
"subscription/ack": {
|
|
5727
5793
|
method: "map/subscribe.ack",
|
|
@@ -7001,6 +7067,7 @@ exports.SubscriptionIdSchema = SubscriptionIdSchema;
|
|
|
7001
7067
|
exports.SystemAddressSchema = SystemAddressSchema;
|
|
7002
7068
|
exports.TimestampSchema = TimestampSchema;
|
|
7003
7069
|
exports.TransportTypeSchema = TransportTypeSchema;
|
|
7070
|
+
exports.WORKSPACE_METHODS = WORKSPACE_METHODS;
|
|
7004
7071
|
exports.agenticMeshStream = agenticMeshStream;
|
|
7005
7072
|
exports.buildAgentsGetResponse = buildAgentsGetResponse;
|
|
7006
7073
|
exports.buildAgentsListResponse = buildAgentsListResponse;
|