@multi-agent-protocol/sdk 0.1.1 → 0.1.3
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-DHxPjZ_2.d.cts → index-B5adJHGI.d.cts} +197 -1
- package/dist/{index-DHxPjZ_2.d.ts → index-B5adJHGI.d.ts} +197 -1
- package/dist/index.cjs +149 -2
- 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 +149 -3
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +223 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +5 -1
- package/dist/testing.d.ts +5 -1
- package/dist/testing.js +223 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,11 @@ var EVENT_TYPES = {
|
|
|
118
118
|
// Trajectory events
|
|
119
119
|
TRAJECTORY_CHECKPOINT: "trajectory.checkpoint",
|
|
120
120
|
TRAJECTORY_CONTENT_AVAILABLE: "trajectory.content.available",
|
|
121
|
+
// Task events
|
|
122
|
+
TASK_CREATED: "task.created",
|
|
123
|
+
TASK_ASSIGNED: "task.assigned",
|
|
124
|
+
TASK_STATUS: "task.status",
|
|
125
|
+
TASK_COMPLETED: "task.completed",
|
|
121
126
|
// Mail events
|
|
122
127
|
MAIL_CREATED: "mail.created",
|
|
123
128
|
MAIL_CLOSED: "mail.closed",
|
|
@@ -218,6 +223,12 @@ var TRAJECTORY_METHODS = {
|
|
|
218
223
|
TRAJECTORY_GET: "trajectory/get",
|
|
219
224
|
TRAJECTORY_CONTENT: "trajectory/content"
|
|
220
225
|
};
|
|
226
|
+
var TASK_METHODS = {
|
|
227
|
+
TASKS_CREATE: "map/tasks/create",
|
|
228
|
+
TASKS_ASSIGN: "map/tasks/assign",
|
|
229
|
+
TASKS_UPDATE: "map/tasks/update",
|
|
230
|
+
TASKS_LIST: "map/tasks/list"
|
|
231
|
+
};
|
|
221
232
|
var NOTIFICATION_METHODS = {
|
|
222
233
|
EVENT: "map/event",
|
|
223
234
|
MESSAGE: "map/message",
|
|
@@ -241,7 +252,8 @@ var MAP_METHODS = {
|
|
|
241
252
|
...FEDERATION_METHODS,
|
|
242
253
|
...MAIL_METHODS,
|
|
243
254
|
...WORKSPACE_METHODS,
|
|
244
|
-
...TRAJECTORY_METHODS
|
|
255
|
+
...TRAJECTORY_METHODS,
|
|
256
|
+
...TASK_METHODS
|
|
245
257
|
};
|
|
246
258
|
var STRUCTURE_METHODS = {
|
|
247
259
|
...LIFECYCLE_METHODS,
|
|
@@ -397,7 +409,12 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
397
409
|
[TRAJECTORY_METHODS.TRAJECTORY_CHECKPOINT]: ["trajectory.canReport"],
|
|
398
410
|
[TRAJECTORY_METHODS.TRAJECTORY_LIST]: ["trajectory.canQuery"],
|
|
399
411
|
[TRAJECTORY_METHODS.TRAJECTORY_GET]: ["trajectory.canQuery"],
|
|
400
|
-
[TRAJECTORY_METHODS.TRAJECTORY_CONTENT]: ["trajectory.canRequestContent"]
|
|
412
|
+
[TRAJECTORY_METHODS.TRAJECTORY_CONTENT]: ["trajectory.canRequestContent"],
|
|
413
|
+
// Tasks
|
|
414
|
+
[TASK_METHODS.TASKS_CREATE]: ["tasks.canCreate"],
|
|
415
|
+
[TASK_METHODS.TASKS_ASSIGN]: ["tasks.canAssign"],
|
|
416
|
+
[TASK_METHODS.TASKS_UPDATE]: ["tasks.canUpdate"],
|
|
417
|
+
[TASK_METHODS.TASKS_LIST]: ["tasks.canList"]
|
|
401
418
|
};
|
|
402
419
|
function isSuccessResponse(response) {
|
|
403
420
|
return "result" in response;
|
|
@@ -3580,6 +3597,58 @@ var ClientConnection = class _ClientConnection {
|
|
|
3580
3597
|
});
|
|
3581
3598
|
}
|
|
3582
3599
|
// ===========================================================================
|
|
3600
|
+
// Tasks
|
|
3601
|
+
// ===========================================================================
|
|
3602
|
+
/**
|
|
3603
|
+
* Create a new task.
|
|
3604
|
+
*
|
|
3605
|
+
* @param params - Task creation parameters
|
|
3606
|
+
* @returns The created task
|
|
3607
|
+
*/
|
|
3608
|
+
async createTask(params) {
|
|
3609
|
+
return this.#connection.sendRequest(
|
|
3610
|
+
TASK_METHODS.TASKS_CREATE,
|
|
3611
|
+
params
|
|
3612
|
+
);
|
|
3613
|
+
}
|
|
3614
|
+
/**
|
|
3615
|
+
* Assign a task to an agent.
|
|
3616
|
+
*
|
|
3617
|
+
* @param taskId - ID of the task to assign
|
|
3618
|
+
* @param agentId - ID of the agent to assign to
|
|
3619
|
+
* @returns The updated task
|
|
3620
|
+
*/
|
|
3621
|
+
async assignTask(taskId, agentId) {
|
|
3622
|
+
return this.#connection.sendRequest(
|
|
3623
|
+
TASK_METHODS.TASKS_ASSIGN,
|
|
3624
|
+
{ taskId, agentId }
|
|
3625
|
+
);
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* Update a task's status or fields.
|
|
3629
|
+
*
|
|
3630
|
+
* @param params - Update parameters including taskId and fields to change
|
|
3631
|
+
* @returns The updated task
|
|
3632
|
+
*/
|
|
3633
|
+
async updateTask(params) {
|
|
3634
|
+
return this.#connection.sendRequest(
|
|
3635
|
+
TASK_METHODS.TASKS_UPDATE,
|
|
3636
|
+
params
|
|
3637
|
+
);
|
|
3638
|
+
}
|
|
3639
|
+
/**
|
|
3640
|
+
* List tasks with optional filters.
|
|
3641
|
+
*
|
|
3642
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
3643
|
+
* @returns Paginated list of tasks
|
|
3644
|
+
*/
|
|
3645
|
+
async listTasks(params) {
|
|
3646
|
+
return this.#connection.sendRequest(
|
|
3647
|
+
TASK_METHODS.TASKS_LIST,
|
|
3648
|
+
params ?? {}
|
|
3649
|
+
);
|
|
3650
|
+
}
|
|
3651
|
+
// ===========================================================================
|
|
3583
3652
|
// Reconnection
|
|
3584
3653
|
// ===========================================================================
|
|
3585
3654
|
/**
|
|
@@ -4547,6 +4616,58 @@ var AgentConnection = class _AgentConnection {
|
|
|
4547
4616
|
return await this.#connection.sendRequest(method, params);
|
|
4548
4617
|
}
|
|
4549
4618
|
// ===========================================================================
|
|
4619
|
+
// Tasks
|
|
4620
|
+
// ===========================================================================
|
|
4621
|
+
/**
|
|
4622
|
+
* Create a new task.
|
|
4623
|
+
*
|
|
4624
|
+
* @param params - Task creation parameters
|
|
4625
|
+
* @returns The created task
|
|
4626
|
+
*/
|
|
4627
|
+
async createTask(params) {
|
|
4628
|
+
return this.#connection.sendRequest(
|
|
4629
|
+
TASK_METHODS.TASKS_CREATE,
|
|
4630
|
+
params
|
|
4631
|
+
);
|
|
4632
|
+
}
|
|
4633
|
+
/**
|
|
4634
|
+
* Assign a task to an agent.
|
|
4635
|
+
*
|
|
4636
|
+
* @param taskId - ID of the task to assign
|
|
4637
|
+
* @param agentId - ID of the agent to assign to
|
|
4638
|
+
* @returns The updated task
|
|
4639
|
+
*/
|
|
4640
|
+
async assignTask(taskId, agentId) {
|
|
4641
|
+
return this.#connection.sendRequest(
|
|
4642
|
+
TASK_METHODS.TASKS_ASSIGN,
|
|
4643
|
+
{ taskId, agentId }
|
|
4644
|
+
);
|
|
4645
|
+
}
|
|
4646
|
+
/**
|
|
4647
|
+
* Update a task's status or fields.
|
|
4648
|
+
*
|
|
4649
|
+
* @param params - Update parameters including taskId and fields to change
|
|
4650
|
+
* @returns The updated task
|
|
4651
|
+
*/
|
|
4652
|
+
async updateTask(params) {
|
|
4653
|
+
return this.#connection.sendRequest(
|
|
4654
|
+
TASK_METHODS.TASKS_UPDATE,
|
|
4655
|
+
params
|
|
4656
|
+
);
|
|
4657
|
+
}
|
|
4658
|
+
/**
|
|
4659
|
+
* List tasks with optional filters.
|
|
4660
|
+
*
|
|
4661
|
+
* @param params - Optional filter, limit, and cursor parameters
|
|
4662
|
+
* @returns Paginated list of tasks
|
|
4663
|
+
*/
|
|
4664
|
+
async listTasks(params) {
|
|
4665
|
+
return this.#connection.sendRequest(
|
|
4666
|
+
TASK_METHODS.TASKS_LIST,
|
|
4667
|
+
params ?? {}
|
|
4668
|
+
);
|
|
4669
|
+
}
|
|
4670
|
+
// ===========================================================================
|
|
4550
4671
|
// Internal
|
|
4551
4672
|
// ===========================================================================
|
|
4552
4673
|
/**
|
|
@@ -5872,6 +5993,31 @@ var METHOD_REGISTRY = {
|
|
|
5872
5993
|
capabilities: ["trajectory.canRequestContent"],
|
|
5873
5994
|
description: "Request full content for a checkpoint"
|
|
5874
5995
|
},
|
|
5996
|
+
// Task methods
|
|
5997
|
+
"tasks/create": {
|
|
5998
|
+
method: "map/tasks/create",
|
|
5999
|
+
category: "task",
|
|
6000
|
+
capabilities: ["tasks.canCreate"],
|
|
6001
|
+
description: "Create a new task"
|
|
6002
|
+
},
|
|
6003
|
+
"tasks/assign": {
|
|
6004
|
+
method: "map/tasks/assign",
|
|
6005
|
+
category: "task",
|
|
6006
|
+
capabilities: ["tasks.canAssign"],
|
|
6007
|
+
description: "Assign a task to an agent"
|
|
6008
|
+
},
|
|
6009
|
+
"tasks/update": {
|
|
6010
|
+
method: "map/tasks/update",
|
|
6011
|
+
category: "task",
|
|
6012
|
+
capabilities: ["tasks.canUpdate"],
|
|
6013
|
+
description: "Update task status or fields"
|
|
6014
|
+
},
|
|
6015
|
+
"tasks/list": {
|
|
6016
|
+
method: "map/tasks/list",
|
|
6017
|
+
category: "task",
|
|
6018
|
+
capabilities: ["tasks.canList"],
|
|
6019
|
+
description: "List tasks with optional filters"
|
|
6020
|
+
},
|
|
5875
6021
|
// Notification methods (client → server)
|
|
5876
6022
|
"subscription/ack": {
|
|
5877
6023
|
method: "map/subscribe.ack",
|
|
@@ -7149,6 +7295,7 @@ exports.Subscription = Subscription;
|
|
|
7149
7295
|
exports.SubscriptionFilterSchema = SubscriptionFilterSchema;
|
|
7150
7296
|
exports.SubscriptionIdSchema = SubscriptionIdSchema;
|
|
7151
7297
|
exports.SystemAddressSchema = SystemAddressSchema;
|
|
7298
|
+
exports.TASK_METHODS = TASK_METHODS;
|
|
7152
7299
|
exports.TRAJECTORY_ERROR_CODES = TRAJECTORY_ERROR_CODES;
|
|
7153
7300
|
exports.TRAJECTORY_METHODS = TRAJECTORY_METHODS;
|
|
7154
7301
|
exports.TimestampSchema = TimestampSchema;
|