/** * FORGE State Access API * Interface between CLI-ENGINE and STATE-ENGINE * * This provides the API contract specified in state/STATE_API_SPEC.md */ export interface Task { id: string; title: string; ownerRole: string; status: string; deps: string[]; allowedPaths: string[]; acceptance: string[]; verify: string[]; commit: string | null; requests: string[]; priority: number; blockedBy: string[]; blocks: string[]; assignedTo: string | null; createdAt?: string; startedAt?: string | null; completedAt?: string | null; } export interface Contract { id: string; path: string; version: string; publishedBy: string; consumers: string[]; publishedAt?: string; status: 'draft' | 'published' | 'deprecated'; } export interface ProjectMetadata { name: string; status: string; currentMilestone: string; currentPhase: number; createdAt?: string; updatedAt?: string; } export interface StateMetadata { schemaVersion: string; lastEventId: string; eventCount: number; } export interface State { project: ProjectMetadata; tasks: Task[]; contracts: Contract[]; eventsPointer: string; metadata?: StateMetadata; } export interface EventPayload { commitHash?: string; filesChanged?: string[]; testsRun?: number; testsPassed?: number; blockingTasks?: string[]; reason?: string; contractId?: string; contractPath?: string; requestedBy?: string; requestedFor?: string; version?: string; severity?: 'P0' | 'P1' | 'P2'; finding?: string; requirementRef?: string; resolvedBy?: string; resolution?: string; publishedBy?: string; consumers?: string[]; [key: string]: unknown; } export type EventType = 'TASK_STARTED' | 'TASK_COMPLETED' | 'TASK_BLOCKED' | 'TASK_FAILED' | 'TASK_CANCELLED' | 'REQUEST_CONTRACT' | 'CONTRACT_PUBLISHED' | 'REVIEW_FINDING' | 'REVIEW_RESOLVED'; export interface Event { eventId: string; timestamp: string; taskId: string | null; actor: string; type: EventType; payload: EventPayload; } export interface MergeResult { eventCount: number; errors: string[]; } /** * Load canonical STATE.json */ export declare function getState(projectRoot?: string): State | null; /** * Get a specific task by ID */ export declare function getTask(taskId: string, projectRoot?: string): Task | undefined; /** * Get all tasks owned by a specific role */ export declare function getTasksByOwner(ownerRole: string, projectRoot?: string): Task[]; /** * Get all contracts, optionally filtered by consumer */ export declare function getContracts(consumerRole?: string | undefined, projectRoot?: string): Contract[]; /** * Generate a unique event ID * Format: evt-{ISO8601_timestamp}-{agent_name}-{sequence_number} */ export declare function generateEventId(actor: string): string; /** * Submit an event to the event log * This is append-only and concurrency-safe */ export declare function submitEvent(event: Event, projectRoot?: string): Promise; /** * Trigger State Steward to merge events into STATE.json * This runs state/merge.ts */ export declare function mergeState(projectRoot?: string): Promise; /** * Check if we're in a FORGE project */ export declare function isForgeProject(projectRoot?: string): boolean; /** * Initialize a new FORGE project state */ export declare function initializeState(projectName: string, projectRoot?: string): State; //# sourceMappingURL=state-api.d.ts.map