Bead Status Type Definitions (beads/types.ts)

LoopTroop · server/phases/beads/types.ts · typescript · MIT
ai, dev-tools, automation, lang:typescript

Defines canonical statuses for task processing and provides utility functions for status validation and legacy alias resolution. Use this to standardize state management in task-based workflows.

// Source: https://github.com/looptroop-ai/LoopTroop | License: MIT | Copyright 2026 LoopTroop AI
// Provided via justclaw.it.com; keep this notice with the code.
import type { CommandSpec } from '@shared/commandSpec'

/** Field 4. The scheduler only runs `pending` and only finishes on `done`. */
export const BEAD_STATUSES = ['pending', 'in_progress', 'done', 'error'] as const

export type BeadStatus = (typeof BEAD_STATUSES)[number]

export function isBeadStatus(value: unknown): value is BeadStatus {
  return typeof value === 'string' && (BEAD_STATUSES as readonly string[]).includes(value)
}

/** Status spellings earlier releases and some models still emit. */
export const BEAD_STATUS_LEGACY_ALIASES: Readonly<Record<string, BeadStatus>> = Object.freeze({
  completed: 'done',
  failed: 'err

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key