/** OMS v0.2 kernel types. Protocol version is fixed at 2. */ export declare const RUNTIME_PROTOCOL_VERSION: 2; export declare const RUNTIME_V2_DIR = "runtime-v2"; export declare const DEFAULT_CAMPAIGN_HOURS = 24; export declare const DEFAULT_GITHUB_POLL_SECONDS = 60; export declare const PANE_HEALTH_INTERVAL_MS = 5000; export declare const WATCHDOG_INTERVAL_MINUTES = 15; export declare const STOP_CRITICAL_SECTION_MS = 120000; export declare const MAX_ATTEMPTS = 3; export declare const MAX_JOURNAL_RECORD_BYTES: number; export declare const MAX_INGRESS_BYTES: number; export declare const QUEUE_EMPTY_SUCCESSFUL_POLLS = 2; export type WorkSource = "single_goal" | "github_queue"; export type CampaignStatus = "active" | "stopping" | "stopped" | "completed" | "blocked" | "deadline_expired"; export type TaskActivity = "idle" | "working" | "blocked" | "done"; export type TaskHealth = "healthy" | "parked" | "stalled" | "stopped"; export type JournalKind = "campaign_started" | "campaign_stopping" | "campaign_terminal" | "goal_accepted" | "task_claimed" | "task_snapshot" | "task_source_changed" | "task_activity" | "task_health" | "advice_bound" | "dispatch_advice" | "dispatch_launch" | "dispatch_launch_activation" | "worker_state" | "provider_session" | "result_commit" | "verification_intent" | "verification_result" | "grade_request" | "grade_result" | "reflection_request" | "reflection_result" | "result_lineage" | "worker_stop_intent" | "worker_stop_result" | "campaign_worker_stop_intent" | "campaign_worker_stop_result" | "secret_scan" | "delivery_authorization" | "push_intent" | "push_result" | "pr_intent" | "pr_result" | "pr_readback" | "monitor_generation" | "monitor_heartbeat" | "wake_claim" | "wake_sent" | "wake_consume" | "campaign_advance" | "github_sync" | "github_worker_cancel_request" | "hook_event" | "typed_event" | "needs_human" | "ingress_rejected" | "deadline_reached" | "quota_parked" | "quota_resumed"; /** Closed v2 observation event types for the monitor/events slice. */ export type V2EventSource = "provider" | "github" | "pane"; export type V2ProviderEventType = "session_started" | "session_stopped" | "activity_idle" | "activity_working" | "completion_observed" | "quota_limited" | "quota_available"; export type V2GithubEventType = "issue_changed" | "issue_removed" | "pull_request_changed" | "pull_request_removed" | "check_changed" | "check_removed"; export type V2PaneEventType = "pane_healthy" | "pane_stalled" | "pane_stopped"; export type V2EventType = V2ProviderEventType | V2GithubEventType | V2PaneEventType; /** * Strict typed event envelope. Payload is sanitized/bounded — never raw hook/tmux/command bodies. */ export interface V2TypedEvent { readonly schema_version: 2; readonly protocol_version: 2; readonly event_id: string; readonly source: V2EventSource; readonly type: V2EventType; readonly observed_at: string; readonly run_id: string; readonly session_id: string | null; readonly task_id: string | null; readonly repository: string | null; readonly payload: Readonly>; } /** * Conductor-visible typed event view (no paths, raw bodies, or command instructions). * journal_sequence supports durable read-only cursor paging; reading never consumes wakes. */ export interface TypedEventView { readonly event_id: string; readonly source: V2EventSource; readonly type: V2EventType; readonly observed_at: string; readonly task_id: string | null; readonly summary: string; readonly journal_sequence: number; } /** Read-only typed-events page metadata for status/MCP. */ export interface TypedEventsPage { readonly events: readonly TypedEventView[]; readonly next_cursor: string | null; readonly has_more: boolean; readonly truncated: boolean; readonly overflow: boolean; readonly page_size: number; } export interface ContentHash { readonly algorithm: "sha256"; readonly hex: string; } /** * Immutable journal record. Replay order is `sequence` only (not timestamps). * `content_hash` covers sequence, previous_hash, operation_id, kind, recorded_at, run_id, and payload. * `previous_hash` is null for sequence 1 and otherwise the prior record's content_hash.hex. */ export interface JournalRecord { readonly schema_version: 2; readonly protocol_version: 2; readonly record_id: string; readonly sequence: number; readonly previous_hash: string | null; readonly operation_id: string; readonly kind: JournalKind; readonly recorded_at: string; readonly run_id: string; readonly content_hash: ContentHash; readonly payload: Readonly>; } /** Per-run journal tip used to allocate the next monotonic sequence under the kernel lock. */ export interface JournalHead { readonly schema_version: 2; readonly run_id: string; readonly next_sequence: number; readonly tip_sequence: number; readonly tip_hash: string | null; } /** Durable O(1) idempotency index entry: ops/.json */ export interface JournalOpIndex { readonly schema_version: 2; readonly operation_id: string; readonly run_id: string; readonly sequence: number; readonly record_id: string; readonly content_hash: string; /** Effect identity: repeat is idempotent only when kind + payload_digest match. */ readonly kind: JournalKind; readonly payload_digest: string; } export interface RunRecord { readonly schema_version: 2; readonly protocol_version: 2; readonly run_id: string; readonly version: number; readonly status: CampaignStatus; readonly workspace_root: string; readonly work_source: WorkSource; readonly goal_version: number; readonly goal_text_digest: string; readonly ready_label: string; readonly started_at: string; readonly deadline_at: string; readonly stopped_at: string | null; readonly terminal_reason: string | null; readonly repository: string | null; readonly empty_poll_streak: number; readonly needs_human: boolean; readonly needs_human_reason: string | null; readonly conductor_session_id: string | null; readonly conductor_generation: number; readonly monitor_generation: number; readonly last_github_sync_at: string | null; } export interface TaskRecord { readonly schema_version: 2; readonly protocol_version: 2; readonly task_id: string; readonly run_id: string; readonly version: number; readonly activity: TaskActivity; readonly health: TaskHealth; readonly attempt: number; readonly max_attempts: number; readonly source_digest: string | null; readonly source_snapshot: Readonly> | null; readonly worktree_id: string | null; readonly worktree_path: string | null; readonly base_commit: string | null; readonly engine: "claude" | "codex" | null; readonly model: string | null; readonly advice_operation_id: string | null; /** Stable result_lineage journal operation id for the last failed attempt (null if none). */ readonly last_failure_operation_id: string | null; /** Recomputed lineage digest for the last failed attempt (null if none). */ readonly last_failure_digest: string | null; readonly draft_pr_url: string | null; /** Bound interactive worker pane (null until launch completion). */ readonly pane_id: string | null; /** Bound provider session id for the current attempt. */ readonly provider_session_id: string | null; /** Successful launch completion operation id (worker MCP binding). */ readonly launch_operation_id: string | null; /** * Exact launch identity digest written on successful bind. * Required whenever pane/session/launch_operation_id are set. */ readonly launch_identity_digest: string | null; /** * Worker finished work pending phase-5 verification. * Activity stays nonterminal (working); never blocked/done via this flag alone. */ readonly pending_verification: boolean; readonly policy_digest: string | null; readonly capability_evidence_digest: string | null; readonly created_at: string; readonly updated_at: string; } /** Immutable conductor recovery binding journaled at goal start. */ export interface ConductorRecoveryBinding { readonly workspace_root: string; readonly repository: string | null; readonly tmux_session: string; readonly tmux_pane: string; readonly conductor_generation: number; readonly claude_session_id: string; readonly policy_digest: string; readonly binary_path: string; readonly binary_version: string; readonly binary_hash: string; /** Canonical MCP config file path for resume (under workspace or verified path). */ readonly mcp_config_path: string; } export interface MonitorRecord { readonly schema_version: 2; readonly protocol_version: 2; readonly generation: number; readonly lease_owner: string | null; readonly lease_expires_at: string | null; readonly heartbeat_at: string | null; readonly wake_cursor: string | null; readonly github_poll_seconds: number; readonly next_github_poll_at: string | null; readonly next_pane_health_at: string | null; readonly pid: number | null; readonly process_instance_id: string | null; } export interface ActiveRuntimePointer { readonly schema_version: 2; readonly active_version: 1 | 2; readonly updated_at: string; readonly reason: string; } export interface StatusSummary { readonly runtime_version: 2; readonly run: RunRecord | null; readonly goal_preview: string | null; readonly tasks: readonly TaskSummary[]; readonly monitor: MonitorRecord | null; readonly watchdog: WatchdogStatus; readonly blocks: readonly string[]; readonly draft_prs: readonly string[]; /** * Bounded ordered typed-event page (cursor-based, non-mutating). * Not an acknowledgement and not wake-consumption status. */ readonly typed_events: readonly TypedEventView[]; readonly events_next_cursor: string | null; readonly events_has_more: boolean; readonly events_truncated: boolean; readonly events_overflow: boolean; readonly events_page_size: number; } export interface TaskSummary { readonly task_id: string; readonly activity: TaskActivity; readonly health: TaskHealth; readonly attempt: number; readonly version: number; readonly source_digest: string | null; readonly pending_verification: boolean; readonly result_summary: string | null; readonly draft_pr_url: string | null; } export interface WatchdogStatus { readonly supported: boolean; readonly installed: boolean; readonly unit_name: string | null; readonly interval_minutes: number; readonly drift: string | null; } export interface Clock { now(): Date; } export interface KernelPaths { readonly workspaceRoot: string; readonly omsRoot: string; readonly runtimeRoot: string; readonly journalRoot: string; readonly tasksRoot: string; readonly watermarksRoot: string; readonly logsRoot: string; readonly lockRoot: string; readonly worktreesRoot: string; readonly goalPath: string; readonly runPath: string; readonly monitorPath: string; readonly activeRuntimePath: string; }