Skip to content

Commit 681cf0d

Browse files
committed
Fix TaskStatusNotificationParamsSchema
1 parent 7c07f38 commit 681cf0d

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

src/shared/protocol.test.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,13 +2657,12 @@ describe('Progress notification support for tasks', () => {
26572657
jsonrpc: '2.0',
26582658
method: 'notifications/tasks/status',
26592659
params: {
2660-
task: {
2661-
taskId,
2662-
status: 'failed',
2663-
ttl: 60000,
2664-
createdAt: new Date().toISOString(),
2665-
statusMessage: 'Task failed'
2666-
}
2660+
taskId,
2661+
status: 'failed',
2662+
ttl: 60000,
2663+
createdAt: new Date().toISOString(),
2664+
lastUpdatedAt: new Date().toISOString(),
2665+
statusMessage: 'Task failed'
26672666
}
26682667
});
26692668
}
@@ -2753,13 +2752,12 @@ describe('Progress notification support for tasks', () => {
27532752
jsonrpc: '2.0',
27542753
method: 'notifications/tasks/status',
27552754
params: {
2756-
task: {
2757-
taskId,
2758-
status: 'cancelled',
2759-
ttl: 60000,
2760-
createdAt: new Date().toISOString(),
2761-
statusMessage: 'User cancelled'
2762-
}
2755+
taskId,
2756+
status: 'cancelled',
2757+
ttl: 60000,
2758+
createdAt: new Date().toISOString(),
2759+
lastUpdatedAt: new Date().toISOString(),
2760+
statusMessage: 'User cancelled'
27632761
}
27642762
});
27652763
}

src/shared/protocol.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,9 +1497,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
14971497
if (task) {
14981498
const notification: TaskStatusNotification = TaskStatusNotificationSchema.parse({
14991499
method: 'notifications/tasks/status',
1500-
params: {
1501-
task
1502-
}
1500+
params: task
15031501
});
15041502
await this.notification(notification as SendNotificationT);
15051503

@@ -1537,9 +1535,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
15371535
if (updatedTask) {
15381536
const notification: TaskStatusNotification = TaskStatusNotificationSchema.parse({
15391537
method: 'notifications/tasks/status',
1540-
params: {
1541-
task: updatedTask
1542-
}
1538+
params: updatedTask
15431539
});
15441540
await this.notification(notification as SendNotificationT);
15451541

src/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,7 @@ export const CreateTaskResultSchema = ResultSchema.extend({
673673
/**
674674
* Parameters for task status notification.
675675
*/
676-
export const TaskStatusNotificationParamsSchema = z.object({
677-
task: TaskSchema
678-
});
676+
export const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);
679677

680678
/**
681679
* A notification sent when a task's status changes.

0 commit comments

Comments
 (0)