Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(conversations): update todo item types for wire compatibility

Steven Enamakelf472e739c794
diff --git a/app/src/features/conversations/aui/TodoListPart.tsx b/app/src/features/conversations/aui/TodoListPart.tsx
index c87a6227c9..96c5c9b54f 100644
--- a/app/src/features/conversations/aui/TodoListPart.tsx
+++ b/app/src/features/conversations/aui/TodoListPart.tsx
@@ -8,6 +8,7 @@ import {
} from '../../../components/assistant-ui/elements/todo-list';
import { useDisclosure } from '../../../components/assistant-ui/lib/useDisclosure';
import { useT } from '../../../lib/i18n/I18nContext';
+import type { TodoItem as CoreTodoItemWire } from '../../../types/threadWire.generated';
import type { CoreTodoStatus } from '../../../store/threadTodosSlice';
/**
@@ -33,13 +34,7 @@ export function mapCoreTodoStatus(status: unknown): TodoStatus {
}
}
-interface CoreTodoItem {
- content?: unknown;
- status?: unknown;
- reason?: unknown;
-}
-
-function isCoreTodoItem(value: unknown): value is CoreTodoItem {
+function isCoreTodoItem(value: unknown): value is Record<string, unknown> {
return Boolean(value) && typeof value === 'object';
}
@@ -65,7 +60,7 @@ export function toAuiTodoItems(raw: unknown): TodoItem[] {
/** Args/result shape the core sends for the `todo` tool call. */
interface TodoToolArgs {
- todos?: Array<{ content: string; status: CoreTodoStatus }>;
+ todos?: Array<Pick<CoreTodoItemWire, 'content' | 'status'>>;
}
/**
diff --git a/app/src/store/threadTodosSlice.ts b/app/src/store/threadTodosSlice.ts
index 283b49573f..1650625cba 100644
--- a/app/src/store/threadTodosSlice.ts
+++ b/app/src/store/threadTodosSlice.ts
@@ -10,17 +10,16 @@
* event/RPC pair, not tool-call bookkeeping.
*/
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
+import type { TodoItem as TodoItemWire } from '../types/threadWire.generated';
/** Core wire status for one todo item (`DomainEvent::ThreadTodosChanged`). */
-export type CoreTodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
+export type CoreTodoStatus = TodoItemWire['status'];
/** One todo item as the core sends it — wire shape, not the element's shape. */
-export interface ThreadTodoItemView {
- content: string;
- status: CoreTodoStatus;
+export type ThreadTodoItemView = Omit<TodoItemWire, 'reason'> & {
/** Why the step was cancelled; only on a `cancelled` item. */
- reason?: string;
-}
+ reason?: NonNullable<TodoItemWire['reason']>;
+};
export interface ThreadTodosState {
byThread: Record<string, ThreadTodoItemView[]>;