/** * TaskState wire-format enum. SCREAMING_SNAKE_CASE per parent plan. * * Authoritative enum values match the A2A spec's TaskState proto enum * literal naming. The `toSeshOps()` Go-enum mirror is deferred to whichever * slice first carries a TaskState on the wire (Slice 3 or 4) so the * mapping doesn't drift before any caller validates it. */ export type TaskStateWire = | "TASK_STATE_SUBMITTED" | "TASK_STATE_WORKING" | "TASK_STATE_INPUT_REQUIRED" | "TASK_STATE_AUTH_REQUIRED" | "TASK_STATE_COMPLETED" | "TASK_STATE_CANCELED" | "TASK_STATE_FAILED" | "TASK_STATE_REJECTED" | "TASK_STATE_UNSPECIFIED"; const TERMINAL: ReadonlySet = new Set([ "TASK_STATE_COMPLETED", "TASK_STATE_CANCELED", "TASK_STATE_FAILED", "TASK_STATE_REJECTED", ]); /** Returns true if the state is terminal (no further transitions expected). */ export function isTerminal(state: TaskStateWire): boolean { return TERMINAL.has(state); }