import type { LaunchLane } from "./launch.js"; import type { TaskRecord } from "./types.js"; export declare function requireNonEmptyString(payload: Readonly>, key: string, label: string): string; export declare function requireHex64(payload: Readonly>, key: string, label: string): string; export declare function requireHex40(payload: Readonly>, key: string, label: string): string; export declare function requireExactNumber(payload: Readonly>, key: string, expected: number, label: string): number; export declare function requirePhase(payload: Readonly>, phases: readonly string[], label: string): string; export interface LaunchIdentityFields { readonly runId: string; readonly taskId: string; readonly targetAttempt: number; readonly sourceDigest: string; readonly goalVersion: number; readonly adviceOperationId: string; readonly worktreeId: string; readonly worktreePath: string; readonly baseCommit: string; readonly engine: string; readonly model: string; readonly policyDigest: string; readonly capabilityEvidenceDigest: string; readonly sessionId: string; /** Random 256-bit identity for the physical placeholder/window. */ readonly physicalNonce: string; readonly planDigest: string; readonly lane: LaunchLane; /** Explicit campaign repository; key must be present on durable rows (null allowed). */ readonly repository: string | null; /** * Exact prior failure/grade/reflection lineage when retrying after a failed attempt. * Both operation id and digest are required together; omitted when null so * first-attempt identities stay stable. */ readonly priorResultLineageDigest?: string | null; readonly priorResultLineageOperationId?: string | null; } export declare function computeLaunchIdentityDigest(fields: LaunchIdentityFields): string; /** * Extract full launch identity from a journal intent/effect row (top-level only). * No next_task fallback — completion rows use exact success/failure parsers (7A.3B.3 §3). */ export declare function extractLaunchIdentityFromPayload(payload: Readonly>, runId: string): LaunchIdentityFields; /** Canonical launch failure reason — sole writer/parser policy (7A.3B.4 §5). */ export declare function canonicalLaunchFailureReason(raw: string): string; /** Parse and validate a launch intent/effect journal row against expected identity. */ export declare function parseAndMatchLaunchRow(payload: Readonly>, expected: LaunchIdentityFields, options: { readonly phases: readonly ("intent" | "effect")[]; }): { readonly outcome: "intent" | "effect"; readonly pane_id: string | null; readonly session_id: string | null; readonly identity_digest: string; }; export interface WorktreeIdentityFields { readonly runId: string; readonly taskId: string; readonly targetAttempt: number; readonly sourceDigest: string | null; readonly goalVersion: number; readonly policyDigest: string; readonly adviceOperationId: string; readonly baseCommit: string; readonly worktreePath: string; readonly repository: string | null; /** Factory-bound attempt branch (oms//a). */ readonly branch: string; readonly priorResultLineageDigest?: string | null; readonly priorResultLineageOperationId?: string | null; } export declare function computeWorktreeIdentityDigest(fields: WorktreeIdentityFields): string; export declare function parseAndMatchWorktreeRow(payload: Readonly>, expected: WorktreeIdentityFields, options: { readonly phases: readonly ("worktree_intent" | "worktree_effect")[]; }): { readonly worktree_id: string; readonly worktree_path: string; readonly base_commit: string; readonly git_dir: string; readonly common_git_dir: string; readonly repository: string | null; readonly branch: string; readonly clean: true; readonly identity_digest: string; }; export interface AdviceIdentityFields { readonly runId: string; readonly taskId: string; readonly targetAttempt: number; readonly sourceDigest: string | null; readonly goalVersion: number; readonly policyDigest: string; readonly advisorEngine: "codex"; readonly advisorModel: string; /** Exact prior failure/grade/reflection lineage when required for retry. */ readonly priorResultLineageDigest?: string | null; readonly priorResultLineageOperationId?: string | null; } export declare function computeAdviceIdentityKey(fields: AdviceIdentityFields): string; /** * True when digest is a result-path lineage digest (not source lifecycle markers). * Operation id must be validated separately via resolveResultLineage. */ export declare function isResultLineageDigest(value: string | null | undefined): value is string; /** Pair check: both lineage op id and digest present and not lifecycle markers. */ export declare function isResultLineagePair(operationId: string | null | undefined, digest: string | null | undefined): boolean; export declare function parseAdviceCompletionStrict(payload: Readonly>, expected: AdviceIdentityFields): { readonly ok: true; readonly recommendation: "short" | "long"; readonly advice_digest: string; } | { readonly ok: false; readonly reason: string; }; export declare function assertSuccessfulAdviceRecord(payload: Readonly>, expected: AdviceIdentityFields): { readonly recommendation: "short" | "long"; readonly advice_digest: string; }; export declare function deriveLaunchSessionId(completeOpId: string): string; /** Exact success-completion outer keys (lineage pair conditional). */ export declare const LAUNCH_SUCCESS_COMPLETION_BASE_KEYS: readonly ["next_task", "task_id", "phase", "outcome", "target_attempt", "next_attempt", "attempt", "engine", "model", "lane", "worktree_id", "worktree_path", "base_commit", "advice_operation_id", "policy_digest", "capability_evidence_digest", "source_digest", "goal_version", "session_id", "physical_nonce", "plan_digest", "identity_digest", "repository", "pane_id", "launch_operation_id", "completed_at"]; /** Exact failure-completion outer keys (lineage pair conditional; no next_task). */ export declare const LAUNCH_FAILURE_COMPLETION_BASE_KEYS: readonly ["task_id", "phase", "outcome", "target_attempt", "next_attempt", "engine", "model", "lane", "worktree_id", "worktree_path", "base_commit", "advice_operation_id", "policy_digest", "capability_evidence_digest", "source_digest", "goal_version", "session_id", "physical_nonce", "plan_digest", "identity_digest", "repository", "reason", "launch_operation_id", "ambiguous", "needs_human"]; export declare const WORKTREE_COMPLETION_BASE_KEYS: readonly ["phase", "outcome", "task_id", "attempt", "target_attempt", "worktree_id", "worktree_path", "base_commit", "git_dir", "common_git_dir", "repository", "branch", "clean", "identity_digest", "advice_operation_id", "policy_digest", "source_digest", "goal_version", "completed_at"]; /** Canonical authority for launch success — all fields from run/task/worktree/plan, never the row. */ export interface LaunchSuccessAuthority { readonly runId: string; readonly taskId: string; readonly attempt: number; readonly goalVersion: number; readonly repository: string | null; readonly sessionId: string; readonly launchIdentityDigest: string; readonly engine: "claude" | "codex"; readonly model: string; readonly policyDigest: string; readonly capabilityEvidenceDigest: string; readonly sourceDigest: string; readonly adviceOperationId: string; readonly worktreeId: string; readonly worktreePath: string; readonly baseCommit: string; readonly priorResultLineageDigest: string | null; readonly priorResultLineageOperationId: string | null; readonly maxAttempts: number; readonly sourceSnapshot: Readonly> | null; readonly draftPrUrl: string | null; /** Required nonempty — from exact predecessor/live task, never the launch row (7A.3B.4 §1). */ readonly createdAt: string; } /** * Canonical exact launch success completion (7A.3B.3 §3). * Independently formula-checks operation_id; returns physical pane/session from the row. */ export declare function parseExactLaunchSuccessCompletion(record: { readonly operation_id: string; readonly kind: string; readonly payload: Readonly>; }, expected: LaunchSuccessAuthority): { readonly identity_digest: string; readonly pane_id: string; readonly session_id: string; readonly physical_nonce: string; readonly launch_operation_id: string; readonly next_task: TaskRecord; }; /** Canonical authority for launch failure. */ export interface LaunchFailureAuthority { readonly runId: string; readonly taskId: string; readonly attempt: number; readonly goalVersion: number; readonly repository: string | null; readonly sessionId: string; readonly launchIdentityDigest: string; readonly engine: "claude" | "codex"; readonly model: string; readonly policyDigest: string; readonly capabilityEvidenceDigest: string; readonly sourceDigest: string; readonly adviceOperationId: string; readonly worktreeId: string; readonly worktreePath: string; readonly baseCommit: string; readonly priorResultLineageDigest: string | null; readonly priorResultLineageOperationId: string | null; } /** * Exact launch-failure parser for the distinct failure schema (7A.3B.3 §3). * No next_task, no provider inspection. */ export declare function parseExactLaunchFailureCompletion(record: { readonly operation_id: string; readonly kind: string; readonly payload: Readonly>; }, expected: LaunchFailureAuthority): { readonly identity_digest: string; readonly reason: string; readonly ambiguous: boolean; readonly needs_human: boolean; readonly launch_operation_id: string; }; /** * Canonical exact worktree completion (7A.3B.3 §4). * Phase is only worktree_completion. git_dir and common_git_dir must be nonempty and differ. * When worktreeId is not independently known, omit it and compare returned ID to live evidence. */ export declare function parseExactWorktreeCompletion(record: { readonly operation_id: string; readonly kind: string; readonly payload: Readonly>; }, expected: WorktreeIdentityFields & { readonly worktreeOperationId: string; /** Independently bound ID when known; never self-supplied from the same payload. */ readonly worktreeId?: string | null; }): { readonly identity_digest: string; readonly worktree_id: string; readonly worktree_path: string; readonly base_commit: string; readonly git_dir: string; readonly common_git_dir: string; readonly branch: string; readonly clean: true; readonly repository: string | null; };