import { z } from "zod"; import type { RemediationItemStatus } from "./itemStatus.js"; import type { Finding, RemediationOutcome, MechanicalVerification } from "audit-tools/shared"; export type { Finding }; import type { Evidence } from "../../shared/types/remediationOutcome.js"; import type { PerFindingDisposition } from "./disposition.js"; export declare const RemediationBlockSchema: z.ZodObject<{ block_id: z.ZodString; items: z.ZodArray; /** * Whether this block may run concurrently with its peers. First-class on the * block contract (not derived host-side) so the scheduler reads one source. */ parallel_safe: z.ZodBoolean; /** * Block ids that must complete before this block runs. First-class (the * serialized schema-first chain head, CE-001): producers emit it, the * scheduler consumes it. Optional — absence means no upstream dependency. */ dependencies: z.ZodOptional>; /** * Commands to run as a post-merge verification gate after this block's * worktree branch is merged into the main tree. When present, these are * preferred over `RemediationPlan.test_command` for the gate check. */ targeted_commands: z.ZodOptional>; /** * Repo-relative paths that this block's implementation is expected to touch. * First-class and REQUIRED (an empty array is allowed, an omitted field is * rejected by `validateRemediationBlock` — which the state LOAD gate * delegates to, so the requirement holds on every path a block reaches a * consumer through): the file-ownership-disjoint scheduler and * `attributePostMergeFailure` both read it, so a block with no declared * surface is a producer bug, not an implicit empty. */ touched_files: z.ZodArray; /** * 0-based foundations→consumers phase ordinal (auto-phasing, T3). Derived * mechanically at promotion from the persisted phase cut (the module a block's * obligations belong to). The host handoff treats it as a hard barrier: a * block is never emitted until every lower-ordinal block is verified-complete, * giving a per-phase whole-repo green checkpoint. Optional — absent (or all * blocks sharing one ordinal) means a single phase, i.e. no barrier. */ phase_ordinal: z.ZodOptional; /** * Whether the blocks sharing a co-file (same touched path) may still run in * parallel because their edit regions are disjoint. Additive + optional: * absence is equivalent to `false` (co-file blocks serialize by default), and * a pre-existing block with no such key still validates. Deliberately a bare * boolean — no WriteRegion / WriteAnchor / anchor apparatus lives on the block. */ cofile_parallel_safe: z.ZodOptional; /** * Deterministic advisory size derived from this block's unique physical * files. It is metadata for the host, never a backend-fit claim. */ token_estimate: z.ZodOptional; }, "strict", z.ZodTypeAny, { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }, { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }>; export type RemediationBlock = z.infer; export declare const RemediationPlanSchema: z.ZodObject<{ plan_id: z.ZodString; goal_id: z.ZodOptional; source: z.ZodOptional; findings: z.ZodArray; confidence: z.ZodEnum<["high", "medium", "low"]>; lens: z.ZodString; summary: z.ZodString; affected_files: z.ZodArray; line_end: z.ZodOptional; symbol: z.ZodOptional; quoted_text: z.ZodOptional; hash_at_plan_time: z.ZodOptional; }, "strip", z.ZodTypeAny, { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }, { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }>, { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }, { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }>, "many">; impact: z.ZodOptional; likelihood: z.ZodOptional; evidence: z.ZodOptional>; reproduction: z.ZodOptional>; systemic: z.ZodOptional; related_findings: z.ZodOptional>; theme_id: z.ZodOptional; blast_radius: z.ZodOptional; evidence_grounded: z.ZodOptional; grounding: z.ZodOptional; reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; }, { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; }>>; executable_anchor: z.ZodOptional; confirm_if: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"exit_zero">; }, "strip", z.ZodTypeAny, { kind: "exit_zero"; }, { kind: "exit_zero"; }>, z.ZodObject<{ kind: z.ZodLiteral<"exit_nonzero">; }, "strip", z.ZodTypeAny, { kind: "exit_nonzero"; }, { kind: "exit_nonzero"; }>, z.ZodObject<{ kind: z.ZodLiteral<"output_includes">; text: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "output_includes"; text: string; }, { kind: "output_includes"; text: string; }>, z.ZodObject<{ kind: z.ZodLiteral<"output_excludes">; text: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "output_excludes"; text: string; }, { kind: "output_excludes"; text: string; }>]>; claim: z.ZodOptional; }, "strip", z.ZodTypeAny, { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; }, { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; }>>; contract_goal_id: z.ZodOptional; contract_obligation_ids: z.ZodOptional>; verification_obligation_ids: z.ZodOptional>; targeted_commands: z.ZodOptional>; analyzer_provenance: z.ZodOptional; path: z.ZodString; snippet_hash: z.ZodString; }, "strict", z.ZodTypeAny, { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; }, { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { id: string; confidence: "high" | "low" | "medium"; title: string; category: string; severity: "high" | "low" | "critical" | "medium" | "info"; lens: string; summary: string; affected_files: { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }[]; impact?: string | undefined; likelihood?: string | undefined; evidence?: string[] | undefined; reproduction?: string[] | undefined; systemic?: boolean | undefined; related_findings?: string[] | undefined; theme_id?: string | undefined; blast_radius?: number | undefined; evidence_grounded?: boolean | undefined; grounding?: { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; } | undefined; executable_anchor?: { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; } | undefined; contract_goal_id?: string | undefined; contract_obligation_ids?: string[] | undefined; verification_obligation_ids?: string[] | undefined; targeted_commands?: string[] | undefined; analyzer_provenance?: { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; } | undefined; }, { id: string; confidence: "high" | "low" | "medium"; title: string; category: string; severity: "high" | "low" | "critical" | "medium" | "info"; lens: string; summary: string; affected_files: { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }[]; impact?: string | undefined; likelihood?: string | undefined; evidence?: string[] | undefined; reproduction?: string[] | undefined; systemic?: boolean | undefined; related_findings?: string[] | undefined; theme_id?: string | undefined; blast_radius?: number | undefined; evidence_grounded?: boolean | undefined; grounding?: { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; } | undefined; executable_anchor?: { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; } | undefined; contract_goal_id?: string | undefined; contract_obligation_ids?: string[] | undefined; verification_obligation_ids?: string[] | undefined; targeted_commands?: string[] | undefined; analyzer_provenance?: { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; } | undefined; }>, "many">; blocks: z.ZodArray; /** * Whether this block may run concurrently with its peers. First-class on the * block contract (not derived host-side) so the scheduler reads one source. */ parallel_safe: z.ZodBoolean; /** * Block ids that must complete before this block runs. First-class (the * serialized schema-first chain head, CE-001): producers emit it, the * scheduler consumes it. Optional — absence means no upstream dependency. */ dependencies: z.ZodOptional>; /** * Commands to run as a post-merge verification gate after this block's * worktree branch is merged into the main tree. When present, these are * preferred over `RemediationPlan.test_command` for the gate check. */ targeted_commands: z.ZodOptional>; /** * Repo-relative paths that this block's implementation is expected to touch. * First-class and REQUIRED (an empty array is allowed, an omitted field is * rejected by `validateRemediationBlock` — which the state LOAD gate * delegates to, so the requirement holds on every path a block reaches a * consumer through): the file-ownership-disjoint scheduler and * `attributePostMergeFailure` both read it, so a block with no declared * surface is a producer bug, not an implicit empty. */ touched_files: z.ZodArray; /** * 0-based foundations→consumers phase ordinal (auto-phasing, T3). Derived * mechanically at promotion from the persisted phase cut (the module a block's * obligations belong to). The host handoff treats it as a hard barrier: a * block is never emitted until every lower-ordinal block is verified-complete, * giving a per-phase whole-repo green checkpoint. Optional — absent (or all * blocks sharing one ordinal) means a single phase, i.e. no barrier. */ phase_ordinal: z.ZodOptional; /** * Whether the blocks sharing a co-file (same touched path) may still run in * parallel because their edit regions are disjoint. Additive + optional: * absence is equivalent to `false` (co-file blocks serialize by default), and * a pre-existing block with no such key still validates. Deliberately a bare * boolean — no WriteRegion / WriteAnchor / anchor apparatus lives on the block. */ cofile_parallel_safe: z.ZodOptional; /** * Deterministic advisory size derived from this block's unique physical * files. It is metadata for the host, never a backend-fit claim. */ token_estimate: z.ZodOptional; }, "strict", z.ZodTypeAny, { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }, { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }>, "many">; project_type: z.ZodString; test_command: z.ZodOptional; e2e_command: z.ZodOptional; candidate_closing_actions: z.ZodArray, "many">; block_strategy: z.ZodOptional>; /** Synthesis themes carried from audit-findings.json (Phase 6/7 fix hints). */ themes: z.ZodOptional; suggested_fix_pattern: z.ZodString; }, "strip", z.ZodTypeAny, { title: string; theme_id: string; finding_ids: string[]; root_cause: string; suggested_fix_pattern: string; }, { title: string; theme_id: string; finding_ids: string[]; root_cause: string; suggested_fix_pattern: string; }>, "many">>; }, "strict", z.ZodTypeAny, { findings: { id: string; confidence: "high" | "low" | "medium"; title: string; category: string; severity: "high" | "low" | "critical" | "medium" | "info"; lens: string; summary: string; affected_files: { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }[]; impact?: string | undefined; likelihood?: string | undefined; evidence?: string[] | undefined; reproduction?: string[] | undefined; systemic?: boolean | undefined; related_findings?: string[] | undefined; theme_id?: string | undefined; blast_radius?: number | undefined; evidence_grounded?: boolean | undefined; grounding?: { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; } | undefined; executable_anchor?: { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; } | undefined; contract_goal_id?: string | undefined; contract_obligation_ids?: string[] | undefined; verification_obligation_ids?: string[] | undefined; targeted_commands?: string[] | undefined; analyzer_provenance?: { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; } | undefined; }[]; blocks: { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }[]; plan_id: string; project_type: string; candidate_closing_actions: ("push" | "custom" | "none" | "tag" | "commit" | "open-pr" | "publish")[]; themes?: { title: string; theme_id: string; finding_ids: string[]; root_cause: string; suggested_fix_pattern: string; }[] | undefined; source?: string | undefined; goal_id?: string | undefined; test_command?: string | undefined; e2e_command?: string | undefined; block_strategy?: "manual" | "test_graph" | "git_cocommit" | "file_overlap" | undefined; }, { findings: { id: string; confidence: "high" | "low" | "medium"; title: string; category: string; severity: "high" | "low" | "critical" | "medium" | "info"; lens: string; summary: string; affected_files: { path: string; symbol?: string | undefined; line_start?: number | undefined; line_end?: number | undefined; quoted_text?: string | undefined; hash_at_plan_time?: string | undefined; }[]; impact?: string | undefined; likelihood?: string | undefined; evidence?: string[] | undefined; reproduction?: string[] | undefined; systemic?: boolean | undefined; related_findings?: string[] | undefined; theme_id?: string | undefined; blast_radius?: number | undefined; evidence_grounded?: boolean | undefined; grounding?: { status: "grounded" | "ungrounded" | "refuted"; reason?: string | undefined; } | undefined; executable_anchor?: { command: string[]; confirm_if: { kind: "exit_zero"; } | { kind: "exit_nonzero"; } | { kind: "output_includes"; text: string; } | { kind: "output_excludes"; text: string; }; claim?: string | undefined; } | undefined; contract_goal_id?: string | undefined; contract_obligation_ids?: string[] | undefined; verification_obligation_ids?: string[] | undefined; targeted_commands?: string[] | undefined; analyzer_provenance?: { path: string; analyzer_id: string; snippet_hash: string; rule?: string | undefined; } | undefined; }[]; blocks: { items: string[]; block_id: string; parallel_safe: boolean; touched_files: string[]; targeted_commands?: string[] | undefined; token_estimate?: number | undefined; dependencies?: string[] | undefined; phase_ordinal?: number | undefined; cofile_parallel_safe?: boolean | undefined; }[]; plan_id: string; project_type: string; candidate_closing_actions: ("push" | "custom" | "none" | "tag" | "commit" | "open-pr" | "publish")[]; themes?: { title: string; theme_id: string; finding_ids: string[]; root_cause: string; suggested_fix_pattern: string; }[] | undefined; source?: string | undefined; goal_id?: string | undefined; test_command?: string | undefined; e2e_command?: string | undefined; block_strategy?: "manual" | "test_graph" | "git_cocommit" | "file_overlap" | undefined; }>; export type RemediationPlan = z.infer; /** * Tool-owned binding for one emitted host workload. The host may write result * files, but it must not be able to rewrite the workload and then make the * rewritten prompt/baseline self-consistent. Persisting this digest in the * normal remediation state gives ingestion an independent value to verify. */ export declare const RemediationHostHandoffRecordSchema: z.ZodObject<{ contract_version: z.ZodLiteral<"remediation-host-handoff-record/v1alpha1">; run_id: z.ZodString; baseline_commit: z.ZodString; workload_sha256: z.ZodString; work_item_ids: z.ZodArray; }, "strict", z.ZodTypeAny, { contract_version: "remediation-host-handoff-record/v1alpha1"; run_id: string; baseline_commit: string; workload_sha256: string; work_item_ids: string[]; }, { contract_version: "remediation-host-handoff-record/v1alpha1"; run_id: string; baseline_commit: string; workload_sha256: string; work_item_ids: string[]; }>; export type RemediationHostHandoffRecord = z.infer; /** * Canonical names of the bounded remediation steps. Defined as named constants * (rather than bare string literals scattered across the phases) so the * implement phase, the validator, and the item-spec contract share one source * of truth for these magic strings. */ export declare const REMEDIATION_STEP: { readonly WRITE_TESTS: "Write Tests"; readonly REFACTOR_CODE: "Refactor Code"; readonly VERIFY_AGAINST_TESTS: "Verify Code Against Tests"; readonly VERIFY_AGAINST_DOCUMENTATION: "Verify Code Against Documentation"; }; export declare const ItemSpecSchema: z.ZodObject<{ finding_id: z.ZodString; concrete_change: z.ZodString; no_change: z.ZodOptional; /** * Repo-relative paths the fix will create or modify, as declared by the * document worker. The document phase can correct or extend the finding's * pre-document affected_files (e.g. when the real fix lives elsewhere); block * access is recomputed from this union so the implementer may write them. */ touched_files: z.ZodOptional>; tests_to_write: z.ZodArray; }, "strict", z.ZodTypeAny, { name: string; assertions: string[]; }, { name: string; assertions: string[]; }>, "many">; not_applicable_steps: z.ZodArray; rationale: z.ZodString; }, "strict", z.ZodTypeAny, { rationale: string; step: "Write Tests" | "Refactor Code" | "Verify Code Against Tests" | "Verify Code Against Documentation"; }, { rationale: string; step: "Write Tests" | "Refactor Code" | "Verify Code Against Tests" | "Verify Code Against Documentation"; }>, "many">; }, "strict", z.ZodTypeAny, { finding_id: string; concrete_change: string; tests_to_write: { name: string; assertions: string[]; }[]; not_applicable_steps: { rationale: string; step: "Write Tests" | "Refactor Code" | "Verify Code Against Tests" | "Verify Code Against Documentation"; }[]; touched_files?: string[] | undefined; no_change?: boolean | undefined; }, { finding_id: string; concrete_change: string; tests_to_write: { name: string; assertions: string[]; }[]; not_applicable_steps: { rationale: string; step: "Write Tests" | "Refactor Code" | "Verify Code Against Tests" | "Verify Code Against Documentation"; }[]; touched_files?: string[] | undefined; no_change?: boolean | undefined; }>; export type ItemSpec = z.infer; export declare const ClarificationRequestSchema: z.ZodObject<{ finding_id: z.ZodString; category: z.ZodEnum<["public_contract", "behavioral_semantics", "scope_of_fix", "dependency_introduction", "compatibility_policy", "intent_vs_symptom", "issue_appropriateness"]>; description: z.ZodString; options: z.ZodOptional>; }, "strict", z.ZodTypeAny, { category: "public_contract" | "behavioral_semantics" | "scope_of_fix" | "dependency_introduction" | "compatibility_policy" | "intent_vs_symptom" | "issue_appropriateness"; finding_id: string; description: string; options?: string[] | undefined; }, { category: "public_contract" | "behavioral_semantics" | "scope_of_fix" | "dependency_introduction" | "compatibility_policy" | "intent_vs_symptom" | "issue_appropriateness"; finding_id: string; description: string; options?: string[] | undefined; }>; export type ClarificationRequest = z.infer; /** The canonical clarification categories (single-sourced from the schema). */ export declare const CLARIFICATION_CATEGORIES: ["public_contract", "behavioral_semantics", "scope_of_fix", "dependency_introduction", "compatibility_policy", "intent_vs_symptom", "issue_appropriateness"]; export type ClarificationCategory = ClarificationRequest["category"]; /** Narrow an arbitrary value to a canonical clarification category. */ export declare function isClarificationCategory(value: unknown): value is ClarificationCategory; export declare const ClosingActionPreviewSchema: z.ZodObject<{ /** Repo-relative paths that would be staged for the commit. */ files: z.ZodArray; /** Generated commit message derived from item summaries / finding titles. */ commit_message: z.ZodString; /** * Currently-dirty repo-relative paths that are NEITHER in the run's edit * surface manifest nor a tool deliverable — pre-existing/unrelated user * changes `collectStagingFiles` deliberately leaves untouched (never staged, * never committed). Surfaced so the host can tell the user what was left * alone. Absent/omitted when there is nothing to report. */ leftover_files: z.ZodOptional>; }, "strict", z.ZodTypeAny, { files: string[]; commit_message: string; leftover_files?: string[] | undefined; }, { files: string[]; commit_message: string; leftover_files?: string[] | undefined; }>; export declare const ClosingPlanSchema: z.ZodObject<{ action: z.ZodEnum<["commit", "push", "open-pr", "publish", "tag", "none", "custom"]>; custom_command: z.ZodOptional>; /** * When true, the host has explicitly confirmed the closing action preview and * the close phase may proceed to execute git/publish commands without an * additional confirmation prompt. */ pre_authorized: z.ZodOptional; /** * Set by the close phase before executing actions that require user * confirmation. Contains the staged file list and generated commit message so * the host can present them to the user. Cleared once the action executes. */ closing_action_preview: z.ZodOptional; /** Generated commit message derived from item summaries / finding titles. */ commit_message: z.ZodString; /** * Currently-dirty repo-relative paths that are NEITHER in the run's edit * surface manifest nor a tool deliverable — pre-existing/unrelated user * changes `collectStagingFiles` deliberately leaves untouched (never staged, * never committed). Surfaced so the host can tell the user what was left * alone. Absent/omitted when there is nothing to report. */ leftover_files: z.ZodOptional>; }, "strict", z.ZodTypeAny, { files: string[]; commit_message: string; leftover_files?: string[] | undefined; }, { files: string[]; commit_message: string; leftover_files?: string[] | undefined; }>>; }, "strict", z.ZodTypeAny, { action: "push" | "custom" | "none" | "tag" | "commit" | "open-pr" | "publish"; custom_command?: string[] | undefined; pre_authorized?: boolean | undefined; closing_action_preview?: { files: string[]; commit_message: string; leftover_files?: string[] | undefined; } | undefined; }, { action: "push" | "custom" | "none" | "tag" | "commit" | "open-pr" | "publish"; custom_command?: string[] | undefined; pre_authorized?: boolean | undefined; closing_action_preview?: { files: string[]; commit_message: string; leftover_files?: string[] | undefined; } | undefined; }>; export type ClosingPlan = z.infer; export interface CoverageLedgerEntry { finding_id: string; title?: string; disposition: "planned" | "folded_into" | "dropped_no_evidence" | "dropped_by_checkpoint" | "dropped_phantom_paths" | "declined_by_review"; block_id?: string; folded_into?: string; rationale?: string; /** Phantom (non-existent) cited paths the grounding pass stripped. */ phantom_paths_removed?: string[]; /** Whether the finding's evidence cites a real repo path (extracted findings only). */ evidence_grounded?: boolean; /** * Full original Finding payload (the shared `Finding` type, verbatim). Carried * for never-planned findings so the outcomes contract can record what was * dropped — without it the payload is lost once state.json is deleted at close. */ finding?: Finding; } export interface CoverageLedger { contract_version: "remediate-code-coverage/v1alpha1"; plan_id: string; source_finding_count: number; planned_count: number; folded_count: number; dropped_count: number; /** Findings excluded by the intent checkpoint (filters / excluded scope). */ checkpoint_dropped_count: number; /** Findings dropped because every cited path was phantom (after one repair attempt). */ phantom_dropped_count: number; /** * Findings the user disapproved at the review-approval gate (excluded from the * pipeline before planning). Optional + kept SEPARATE from the source-disposition * reconciliation (planned+folded+dropped+checkpoint+phantom === source_finding_count): * declined findings are never part of the planned source/node set, they are an * upstream exclusion, so they are counted here and appended as extra entries. */ declined_review_count?: number; entries: CoverageLedgerEntry[]; } /** * Retry-oriented final status of an outcomes item. Coarser than * `RemediationOutcomeStatus`: `fixed` covers resolved / verified-no-change, * `failed` covers blocked and force-closed non-terminal items, `skipped` * covers deemed-inappropriate items, `ignored` covers user-ignored items. */ export type RemediationOutcomeFinalStatus = "fixed" | "failed" | "ignored" | "skipped"; /** * Typed subset of `ItemSpec` carried on each outcomes item — the documented * fields a retry needs without re-running the document phase. */ export interface ItemSpecSummary extends Pick { /** Names of the tests the document phase specified (`ItemSpec.tests_to_write[].name`). */ tests_to_write: string[]; } /** * One fully self-describing entry per finding in `remediation-outcomes.json`. * Extends the shared per-finding outcome so the file is retryable on its own: * close deletes state.json, so every payload a retry needs must be here. * * Runtime invariants (enforced by the close phase, not expressible in TS): * - `reason` is always a non-empty string when `final_status` is `skipped` or * `ignored`. * - `original_state` is present exactly when the run was force-closed while * this item was still non-terminal; such items get `final_status: "failed"` * and a `reason` saying they were force-closed. */ export interface RemediationOutcomeItem extends RemediationOutcome { /** Full original Finding payload (the shared `Finding` type, verbatim). */ finding: Finding; /** Summary of the documented `ItemSpec`; absent when never documented. */ item_spec?: ItemSpecSummary; /** Owning block id (`RemediationBlock.block_id`). */ block_id: RemediationBlock["block_id"]; /** The owning block's dependency block ids (`RemediationBlock.dependencies`). */ block_dependencies: string[]; /** Retry-oriented final status (see `RemediationOutcomeFinalStatus`). */ final_status: RemediationOutcomeFinalStatus; /** * The non-terminal `RemediationItemState["status"]` this item was in when the * run was force-closed. Absent for items that reached a terminal status. */ original_state?: RemediationItemState["status"]; } /** Why a never-planned finding was dropped before remediation started. */ export type NeverPlannedDropReason = "cross_lens_dedup" | "intent_checkpoint" | "no_evidence" | "phantom_paths" | "review_gate"; /** * Coverage-ledger entry as written into `remediation-outcomes.json`: the plan's * `CoverageLedgerEntry` enriched with a `drop_reason` discriminator and (for * never-planned findings) the full `Finding` payload instead of a bare id. */ export interface OutcomeCoverageEntry extends CoverageLedgerEntry { /** Set on never-planned findings (folded / checkpoint- / evidence- / phantom-dropped). */ drop_reason?: NeverPlannedDropReason; } /** The outcomes file's coverage-ledger section (enriched entries). */ export interface OutcomeCoverageLedger extends Omit { entries: OutcomeCoverageEntry[]; } export type { PerFindingDisposition } from "./disposition.js"; export interface RemediationItemState { finding_id: string; status: RemediationItemStatus; block_id: string; item_spec?: ItemSpec; last_successful_step?: string; failure_reason?: string; /** Prompt-bound evidence supplied for a verified no-change host outcome. */ host_result_evidence?: string[]; /** * Item C — close-gate mechanical re-verify verdict for an analyzer-born * finding (set by `verifyAnalyzerLeads`; copied into the outcomes contract). */ mechanical_verification?: MechanicalVerification; /** Times this item was sent back for rework via triage (Phase 7B outcomes). */ rework_count?: number; /** ISO-8601 timestamp when this item first left pending. */ started_at?: string; /** ISO-8601 timestamp when this item most recently reached a terminal status. */ completed_at?: string; /** User's clarification answer, carried from applyClarificationResolution into the implement prompt. */ clarification_context?: string; /** * The failure context (failure_reason + last_successful_step) captured at * the time this item was queued for retry. Carried into re-dispatch prompts * so the worker knows what failed previously and avoids identical attempts. */ failure_context?: string; /** * Times a worker returned a block result that did NOT cover this still-pending * finding — i.e. silently omitted its `item_results` entry (E2). Bounds the * incomplete-coverage re-dispatch so the run converges (blocks the finding once * the cap is hit) instead of re-dispatching the same worker indefinitely. */ incomplete_coverage_attempts?: number; /** * CDC-25/CDC-26 — SOURCE-SIDE SHAPE. The per-finding verification-evidence * triple (file/line/mechanism) a producing module RECORDS onto this item at * its OWN phase (INV-COVERAGE's "evidence producer" half) before the single * run-terminal `runClosePhase` PERSISTS it (INV-ISC-EVIDENCE-EMITTED). A * runtime data flow through this already-existing state item, not a * build-phase dependency: no cross-phase artifact token is minted for it. * This field lives here — inside item-status-partition-and-close's own * file_scope — and is therefore owned BY SCOPE, not by a clause 1(c) * declaration (that channel is only for a file outside every module's * file_scope, as `src/shared/types/remediationOutcome.ts` needed one for the * matching widened record shape). No other module edits this file. */ evidence?: Evidence; /** * CDC-25 — which module recorded {@link evidence} (and, where set, * {@link disposition_override}) for this finding. Carried byte-exact into the * emitted outcome record's `recorded_by_module` (the ATTRIBUTION ROUND-TRIP) * so the 26 INV-COVERAGE joins' condition (3) can still tell which module * closed which id — the writer must never re-derive this or drop it. */ recorded_by_module?: string; /** * CDC-25 — a producing module's own-phase determination that this finding's * true disposition is `verified_already_fixed` or `refuted` rather than the * disposition ordinarily derived from {@link status} alone. * `RemediationItemStatus` stays a closed 12-member enum with no * `verified_already_fixed`/`refuted` values of its own; the two new * `PerFindingDisposition` members are reached ONLY through this explicit * override (see `resolveDisposition` in `itemStatus.ts`), and only honoured * by the writer when this item's {@link status} is terminal and its * {@link evidence} triple is complete (INV-ISC-EVIDENCE-EMITTED) — an * incomplete triple makes the writer refuse the override and fall back to a * non-terminal, force-closed outcome instead of a green close on assertion * alone. */ disposition_override?: PerFindingDisposition; } //# sourceMappingURL=types.d.ts.map