Skip to content

Commit 2382df4

Browse files
committed
Remove submitted and unknown statuses
1 parent 4d570d3 commit 2382df4

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

src/examples/shared/inMemoryTaskStore.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('InMemoryTaskStore', () => {
1313
});
1414

1515
describe('createTask', () => {
16-
it('should create a new task with submitted status', async () => {
16+
it('should create a new task with working status', async () => {
1717
const metadata: TaskMetadata = {
1818
taskId: 'task-1',
1919
keepAlive: 60000
@@ -28,7 +28,7 @@ describe('InMemoryTaskStore', () => {
2828
const task = await store.getTask('task-1');
2929
expect(task).toBeDefined();
3030
expect(task?.taskId).toBe('task-1');
31-
expect(task?.status).toBe('submitted');
31+
expect(task?.status).toBe('working');
3232
expect(task?.keepAlive).toBe(60000);
3333
expect(task?.pollInterval).toBe(500);
3434
});
@@ -99,9 +99,7 @@ describe('InMemoryTaskStore', () => {
9999
});
100100
});
101101

102-
it('should update task status from submitted to working', async () => {
103-
await store.updateTaskStatus('status-test', 'working');
104-
102+
it('should keep task status as working', async () => {
105103
const task = await store.getTask('status-test');
106104
expect(task?.status).toBe('working');
107105
});

src/examples/shared/inMemoryTaskStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class InMemoryTaskStore implements TaskStore {
3030

3131
const task: Task = {
3232
taskId,
33-
status: 'submitted',
33+
status: 'working',
3434
keepAlive: metadata.keepAlive ?? null,
3535
pollInterval: metadata.pollInterval ?? 500
3636
};

src/shared/protocol.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ function createMockTaskStore(options?: {
4040
createTask: jest.fn((taskMetadata: TaskMetadata, _1: RequestId, _2: Request) => {
4141
const task = (tasks[taskMetadata.taskId] = {
4242
taskId: taskMetadata.taskId,
43-
status: (taskMetadata.status as Task['status'] | undefined) ?? 'submitted',
43+
status: (taskMetadata.status as Task['status'] | undefined) ?? 'working',
4444
keepAlive: taskMetadata.keepAlive ?? null,
4545
pollInterval: (taskMetadata.pollInterval as Task['pollInterval'] | undefined) ?? 1000
4646
});
47-
options?.onStatus?.('submitted');
47+
options?.onStatus?.('working');
4848
return Promise.resolve(task);
4949
}),
5050
getTask: jest.fn((taskId: string) => {
@@ -1362,7 +1362,6 @@ describe('Task-based execution', () => {
13621362
await mockTaskStore.createTask(
13631363
{
13641364
taskId: 'task-3',
1365-
status: 'submitted',
13661365
pollInterval: 500
13671366
},
13681367
1,
@@ -1398,7 +1397,7 @@ describe('Task-based execution', () => {
13981397
const sentMessage = sendSpy.mock.calls[0][0];
13991398
expect(sentMessage.jsonrpc).toBe('2.0');
14001399
expect(sentMessage.id).toBe(2);
1401-
expect(sentMessage.result.tasks).toEqual([{ taskId: 'task-3', status: 'submitted', keepAlive: null, pollInterval: 500 }]);
1400+
expect(sentMessage.result.tasks).toEqual([{ taskId: 'task-3', status: 'working', keepAlive: null, pollInterval: 500 }]);
14021401
expect(sentMessage.result.nextCursor).toBeUndefined();
14031402
expect(sentMessage.result._meta).toEqual({});
14041403
});

src/shared/task.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export interface TaskStore {
7979
* Terminal states are those where the task has finished and will not change.
8080
*
8181
* @param status - The task status to check
82-
* @returns True if the status is terminal (completed, failed, cancelled, or unknown)
82+
* @returns True if the status is terminal (completed, failed, or cancelled)
8383
*/
8484
export function isTerminal(status: Task['status']): boolean {
85-
return status === 'completed' || status === 'failed' || status === 'cancelled' || status === 'unknown';
85+
return status === 'completed' || status === 'failed' || status === 'cancelled';
8686
}

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ export const PaginatedResultSchema = ResultSchema.extend({
604604
*/
605605
export const TaskSchema = z.object({
606606
taskId: z.string(),
607-
status: z.enum(['submitted', 'working', 'input_required', 'completed', 'failed', 'cancelled', 'unknown']),
607+
status: z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']),
608608
keepAlive: z.union([z.number(), z.null()]),
609609
pollInterval: z.optional(z.number()),
610610
error: z.optional(z.string())

0 commit comments

Comments
 (0)