/** * Canonical task and run status types for PD Runtime v2. * * Source: PD Runtime Protocol SPEC v1, Section 12 * Source: Diagnostician v2 Detailed Design, Section 7 * * MIGRATION NOTE: * - openclaw-plugin's QueueStatus ('in_progress', 'completed', 'canceled') * is the LEGACY status model. New code uses PDTaskStatus. * - principles-core's EvolutionTaskRecord.status (free-form string) * will be migrated to PDTaskStatus in M2. * - The new status model introduces 'leased' and 'retry_wait' which * do not exist in the legacy model. */ import { type Static } from '@sinclair/typebox'; /** * The canonical task status model for PD Runtime v2 (PRI-612 authority). * * State transitions: * pending → leased → succeeded * → retry_wait → pending (via lease expiry recovery) * → failed * → needs_human_review (owner-attention terminal until recovered) */ export declare const PD_TASK_STATUSES: readonly ['pending', 'leased', 'succeeded', 'retry_wait', 'failed', 'needs_human_review']; export type PDTaskStatus = (typeof PD_TASK_STATUSES)[number]; export declare const PDTaskStatusSchema: import("@sinclair/typebox").TUnion[]>; /** Runtime guard for untrusted status strings (DB rows, API payloads). */ export declare function isPDTaskStatus(value: unknown): value is PDTaskStatus; export declare const TaskRecordSchema: import("@sinclair/typebox").TObject<{ /** Unique task identifier. */ taskId: import("@sinclair/typebox").TString; /** Kind of task (e.g., "diagnostician", "principle_candidate_intake"). */ taskKind: import("@sinclair/typebox").TString; /** Current task status. */ status: import("@sinclair/typebox").TUnion[]>; /** ISO timestamp of task creation. */ createdAt: import("@sinclair/typebox").TString; /** ISO timestamp of last status update. */ updatedAt: import("@sinclair/typebox").TString; /** Current lease owner identifier. */ leaseOwner: import("@sinclair/typebox").TOptional; /** ISO timestamp when the current lease expires. */ leaseExpiresAt: import("@sinclair/typebox").TOptional; /** Number of execution attempts made so far. */ attemptCount: import("@sinclair/typebox").TInteger; /** Maximum number of attempts before forced failure. */ maxAttempts: import("@sinclair/typebox").TInteger; /** Last error category, if the task is in a failure-related state. null when cleared (e.g. after successful retry). */ lastError: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"capability_missing">, import("@sinclair/typebox").TLiteral<"input_invalid">, import("@sinclair/typebox").TLiteral<"lease_conflict">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"execution_failed">, import("@sinclair/typebox").TLiteral<"rate_limit">, import("@sinclair/typebox").TLiteral<"timeout">, import("@sinclair/typebox").TLiteral<"cancelled">, import("@sinclair/typebox").TLiteral<"output_invalid">, import("@sinclair/typebox").TLiteral<"artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"max_attempts_exceeded">, import("@sinclair/typebox").TLiteral<"context_assembly_failed">, import("@sinclair/typebox").TLiteral<"history_not_found">, import("@sinclair/typebox").TLiteral<"trajectory_ambiguous">, import("@sinclair/typebox").TLiteral<"storage_unavailable">, import("@sinclair/typebox").TLiteral<"workspace_invalid">, import("@sinclair/typebox").TLiteral<"workspace_dirty">, import("@sinclair/typebox").TLiteral<"query_invalid">]>, import("@sinclair/typebox").TNull]>>; /** Reference to the task's input data. */ inputRef: import("@sinclair/typebox").TOptional; /** Reference to the task's result data. */ resultRef: import("@sinclair/typebox").TOptional; /** Diagnostic JSON payload (PI metadata, session hints, etc.). */ diagnosticJson: import("@sinclair/typebox").TOptional; }>; export type TaskRecord = Static; export declare const DiagnosticianTaskRecordSchema: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{ /** Unique task identifier. */ taskId: import("@sinclair/typebox").TString; /** Kind of task (e.g., "diagnostician", "principle_candidate_intake"). */ taskKind: import("@sinclair/typebox").TString; /** Current task status. */ status: import("@sinclair/typebox").TUnion[]>; /** ISO timestamp of task creation. */ createdAt: import("@sinclair/typebox").TString; /** ISO timestamp of last status update. */ updatedAt: import("@sinclair/typebox").TString; /** Current lease owner identifier. */ leaseOwner: import("@sinclair/typebox").TOptional; /** ISO timestamp when the current lease expires. */ leaseExpiresAt: import("@sinclair/typebox").TOptional; /** Number of execution attempts made so far. */ attemptCount: import("@sinclair/typebox").TInteger; /** Maximum number of attempts before forced failure. */ maxAttempts: import("@sinclair/typebox").TInteger; /** Last error category, if the task is in a failure-related state. null when cleared (e.g. after successful retry). */ lastError: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"capability_missing">, import("@sinclair/typebox").TLiteral<"input_invalid">, import("@sinclair/typebox").TLiteral<"lease_conflict">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"execution_failed">, import("@sinclair/typebox").TLiteral<"rate_limit">, import("@sinclair/typebox").TLiteral<"timeout">, import("@sinclair/typebox").TLiteral<"cancelled">, import("@sinclair/typebox").TLiteral<"output_invalid">, import("@sinclair/typebox").TLiteral<"artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"max_attempts_exceeded">, import("@sinclair/typebox").TLiteral<"context_assembly_failed">, import("@sinclair/typebox").TLiteral<"history_not_found">, import("@sinclair/typebox").TLiteral<"trajectory_ambiguous">, import("@sinclair/typebox").TLiteral<"storage_unavailable">, import("@sinclair/typebox").TLiteral<"workspace_invalid">, import("@sinclair/typebox").TLiteral<"workspace_dirty">, import("@sinclair/typebox").TLiteral<"query_invalid">]>, import("@sinclair/typebox").TNull]>>; /** Reference to the task's input data. */ inputRef: import("@sinclair/typebox").TOptional; /** Reference to the task's result data. */ resultRef: import("@sinclair/typebox").TOptional; /** Diagnostic JSON payload (PI metadata, session hints, etc.). */ diagnosticJson: import("@sinclair/typebox").TOptional; }>, import("@sinclair/typebox").TObject<{ taskKind: import("@sinclair/typebox").TLiteral<"diagnostician">; sourcePainId: import("@sinclair/typebox").TOptional; workspaceDir: import("@sinclair/typebox").TString; severity: import("@sinclair/typebox").TOptional; source: import("@sinclair/typebox").TOptional; sessionIdHint: import("@sinclair/typebox").TOptional; agentIdHint: import("@sinclair/typebox").TOptional; reasonSummary: import("@sinclair/typebox").TString; provenance: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"owner_reported_no_host_trace">, import("@sinclair/typebox").TLiteral<"automatic_hook">, import("@sinclair/typebox").TLiteral<"openclaw_context_bound">]>>; hostKind: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"codex">]>>; provenanceReason: import("@sinclair/typebox").TOptional; evidence: import("@sinclair/typebox").TOptional>>; correctionEvidence: import("@sinclair/typebox").TOptional; turnIndex: import("@sinclair/typebox").TOptional; referencesAssistantTurnId: import("@sinclair/typebox").TOptional; occurredAt: import("@sinclair/typebox").TOptional; }>>; }>]>; export type DiagnosticianTaskRecord = Static; //# sourceMappingURL=task-status.d.ts.map