{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://schemas.aftech.internal/article-consolidation/v1/manifest-output.schema.json", "x-contract-version": "1.0.0", "title": "ArticleConsolidationManifest", "type": "object", "required": [ "schema_version", "fingerprint", "source_url", "selected_extractor", "final_status", "generate_markdown", "markdown_path", "markdown_hash", "ecp_classification", "enrichment", "provider_versions", "model_versions", "prompt_versions", "config_version", "trace_id", "error_codes" ], "properties": { "schema_version": { "type": "string", "const": "1.0.0" }, "fingerprint": { "type": "string", "minLength": 64, "maxLength": 64 }, "source_url": { "type": "string" }, "selected_extractor": { "type": "string", "enum": ["trafilatura", "newspaper4k", "readability"] }, "final_status": { "type": "string", "enum": [ "completed_text", "rejected_ecp", "failed_validation", "failed_processing" ] }, "generate_markdown": { "type": "boolean" }, "markdown_path": { "type": ["string", "null"] }, "markdown_hash": { "type": ["string", "null"], "minLength": 64, "maxLength": 64 }, "ecp_classification": { "type": ["object", "null"], "required": ["category", "confidence", "rationale", "evidences"], "properties": { "category": { "type": "string", "enum": [ "DIRECT_INHERENT", "CONTEXTUAL_INHERENT", "TANGENTIAL", "NOT_RELATED" ] }, "confidence": { "type": "number", "minimum": 0.0, "maximum": 1.0 }, "rationale": { "type": "string" }, "evidences": { "type": "array", "items": { "type": "string" }, "description": "Grounded textual fragments from intermediate Markdown" } }, "additionalProperties": false }, "enrichment": { "type": ["object", "null"], "required": ["sentiment", "tags"], "properties": { "sentiment": { "type": "string", "enum": ["positive", "negative", "neutral"] }, "tags": { "type": "array", "items": { "type": "string", "minLength": 1 }, "minItems": 3, "maxItems": 8, "uniqueItems": true } }, "additionalProperties": false }, "provider_versions": { "type": ["object", "null"], "required": ["hygiene", "enrichment"], "properties": { "hygiene": { "type": ["object", "null"], "required": ["provider", "model", "role_config_version"], "properties": { "provider": { "type": "string" }, "model": { "type": "string" }, "role_config_version": { "type": "string" } }, "additionalProperties": false }, "enrichment": { "type": ["object", "null"], "required": ["provider", "model", "role_config_version"], "properties": { "provider": { "type": "string" }, "model": { "type": "string" }, "role_config_version": { "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false }, "model_versions": { "type": ["object", "null"], "required": ["runtime_primary", "runtime_fallback"], "properties": { "runtime_primary": { "type": "object", "required": ["provider", "model", "role_config_version"], "properties": { "provider": { "type": "string" }, "model": { "type": "string" }, "role_config_version": { "type": "string" } }, "additionalProperties": false }, "runtime_fallback": { "type": "object", "required": ["provider", "model", "role_config_version"], "properties": { "provider": { "type": "string" }, "model": { "type": "string" }, "role_config_version": { "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false }, "prompt_versions": { "type": ["object", "null"], "required": ["article_content_hygiene", "article_sentiment_tags"], "properties": { "article_content_hygiene": { "type": "object", "required": ["version", "hash"], "properties": { "version": { "type": "string" }, "hash": { "type": "string" } }, "additionalProperties": false }, "article_sentiment_tags": { "type": "object", "required": ["version", "hash"], "properties": { "version": { "type": "string" }, "hash": { "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false }, "config_version": { "type": "string", "minLength": 1 }, "trace_id": { "type": ["string", "null"] }, "error_codes": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "INVALID_ARTICLE_SCHEMA", "MISSING_SELECTED_EXTRACTOR", "INVALID_SELECTED_EXTRACTOR", "SELECTED_EXTRACTOR_UNAVAILABLE", "MISSING_SOURCE_URL", "MISSING_TITLE_CANDIDATE", "MISSING_CONTENT", "INVALID_ECP_SCHEMA", "HYGIENE_FAILED", "GROUNDING_VIOLATION", "INVALID_TEXT_REPAIR", "ECP_CLASSIFICATION_FAILED", "ECP_REJECTED", "ENRICHMENT_FAILED", "PERSISTENCE_FAILED", "TELEMETRY_PENDING" ] } } }, "allOf": [ { "if": { "properties": { "final_status": { "const": "completed_text" } } }, "then": { "properties": { "generate_markdown": { "const": true }, "markdown_path": { "type": "string", "minLength": 1 }, "markdown_hash": { "type": "string", "minLength": 64, "maxLength": 64 }, "ecp_classification": { "type": "object", "properties": { "category": { "enum": ["DIRECT_INHERENT", "CONTEXTUAL_INHERENT"] } } }, "enrichment": { "type": "object" }, "provider_versions": { "type": "object", "properties": { "hygiene": { "type": "object" }, "enrichment": { "type": "object" } } }, "model_versions": { "type": "object" }, "prompt_versions": { "type": "object" }, "error_codes": { "type": "array", "items": { "const": "TELEMETRY_PENDING" }, "maxItems": 1, "uniqueItems": true } } } }, { "if": { "properties": { "final_status": { "const": "rejected_ecp" } } }, "then": { "properties": { "generate_markdown": { "const": false }, "markdown_path": { "type": "null" }, "markdown_hash": { "type": "null" }, "ecp_classification": { "type": "object", "properties": { "category": { "enum": ["TANGENTIAL", "NOT_RELATED"] } } }, "enrichment": { "type": "null" }, "provider_versions": { "type": "object", "properties": { "hygiene": { "type": "object" }, "enrichment": { "type": "null" } } }, "model_versions": { "type": "object" }, "prompt_versions": { "type": "object" }, "error_codes": { "type": "array", "items": { "enum": ["ECP_REJECTED", "TELEMETRY_PENDING"] }, "contains": { "const": "ECP_REJECTED" }, "minContains": 1, "maxContains": 1, "minItems": 1, "maxItems": 2, "uniqueItems": true } } } }, { "if": { "properties": { "final_status": { "const": "failed_validation" } } }, "then": { "properties": { "generate_markdown": { "const": false }, "markdown_path": { "type": "null" }, "markdown_hash": { "type": "null" }, "provider_versions": { "type": "null" }, "error_codes": { "type": "array", "items": { "enum": [ "INVALID_ARTICLE_SCHEMA", "MISSING_SELECTED_EXTRACTOR", "INVALID_SELECTED_EXTRACTOR", "SELECTED_EXTRACTOR_UNAVAILABLE", "MISSING_SOURCE_URL", "MISSING_TITLE_CANDIDATE", "MISSING_CONTENT", "INVALID_ECP_SCHEMA", "TELEMETRY_PENDING" ] }, "contains": { "enum": [ "INVALID_ARTICLE_SCHEMA", "MISSING_SELECTED_EXTRACTOR", "INVALID_SELECTED_EXTRACTOR", "SELECTED_EXTRACTOR_UNAVAILABLE", "MISSING_SOURCE_URL", "MISSING_TITLE_CANDIDATE", "MISSING_CONTENT", "INVALID_ECP_SCHEMA" ] }, "minItems": 1, "uniqueItems": true } } } }, { "if": { "properties": { "final_status": { "const": "failed_processing" } } }, "then": { "properties": { "generate_markdown": { "const": false }, "markdown_path": { "type": "null" }, "markdown_hash": { "type": "null" }, "error_codes": { "type": "array", "items": { "enum": [ "HYGIENE_FAILED", "GROUNDING_VIOLATION", "INVALID_TEXT_REPAIR", "ECP_CLASSIFICATION_FAILED", "ENRICHMENT_FAILED", "PERSISTENCE_FAILED", "TELEMETRY_PENDING" ] }, "contains": { "enum": [ "HYGIENE_FAILED", "GROUNDING_VIOLATION", "INVALID_TEXT_REPAIR", "ECP_CLASSIFICATION_FAILED", "ENRICHMENT_FAILED", "PERSISTENCE_FAILED" ] }, "minItems": 1, "uniqueItems": true } } } } ], "additionalProperties": false }