Files
shd.build/tools/game-data-capture/contracts/evidence-archive-manifest-v1.schema.json
T

322 lines
18 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://shd.build/schemas/game-data-capture/evidence-archive-manifest-v1.json",
"title": "Game data capture evidence archive manifest v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version", "archive_id", "created_at", "generator", "artifacts", "captures",
"screens", "jobs", "extractions", "groups", "reviews", "exports", "errors",
"evidence_values", "observed_instances", "canonical_candidates"
],
"properties": {
"schema_version": {"const": 1},
"archive_id": {"$ref": "#/$defs/id"},
"created_at": {"$ref": "#/$defs/timestamp"},
"generator": {
"type": "object",
"additionalProperties": false,
"required": ["name", "version", "policy_version"],
"properties": {
"name": {"type": "string", "minLength": 1, "maxLength": 100},
"version": {"type": "string", "minLength": 1, "maxLength": 50},
"policy_version": {"type": "string", "minLength": 1, "maxLength": 50}
}
},
"artifacts": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/artifact"}},
"captures": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/capture"}},
"screens": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/screen"}},
"jobs": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/job"}},
"extractions": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/extraction"}},
"groups": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/group"}},
"reviews": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/review"}},
"exports": {"type": "array", "maxItems": 1000, "items": {"$ref": "#/$defs/export"}},
"errors": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/error"}},
"evidence_values": {"type": "array", "maxItems": 100000, "items": {"$ref": "#/$defs/evidenceValue"}},
"observed_instances": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/observedInstance"}},
"canonical_candidates": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/canonicalCandidate"}}
},
"$defs": {
"id": {"type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"},
"sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
"timestamp": {"type": "string", "format": "date-time", "maxLength": 40},
"family": {"enum": ["weapon", "gear", "skill_chip", "os_protocol", "specialization", "unknown"]},
"recordType": {"enum": [
"weapon", "weapon_talent", "weapon_augmentation_profile", "gear", "brand_set",
"gear_talent", "gear_augmentation_profile", "skill_chip_set", "skill_chip_set_bonus",
"skill_chip_roll_pool", "skill_chip_talent", "os_protocol", "os_protocol_secondary_profile",
"os_protocol_talent", "specialization", "specialization_focus", "specialization_ability",
"specialization_tree_node", "specialization_tree_rank"
]},
"missingReason": {"enum": [
"not_visible", "occluded", "unreadable", "not_present_on_screen", "unsupported",
"ambiguous", "extraction_failed", "not_applicable", "redacted"
]},
"jsonValue": {
"oneOf": [
{"type": "null"}, {"type": "boolean"}, {"type": "number"},
{"type": "string", "maxLength": 8192},
{"type": "array", "maxItems": 500, "items": {"$ref": "#/$defs/jsonValue"}},
{"type": "object", "maxProperties": 500, "additionalProperties": {"$ref": "#/$defs/jsonValue"}}
]
},
"sourceEngine": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "engine_id", "engine_version"],
"properties": {
"kind": {"enum": ["local_ocr", "openai_vision", "classifier", "manual", "video_decoder"]},
"engine_id": {"type": "string", "minLength": 1, "maxLength": 100},
"engine_version": {"type": "string", "minLength": 1, "maxLength": 100}
}
},
"region": {
"oneOf": [
{
"type": "object", "additionalProperties": false,
"required": ["coordinate_space", "x", "y", "width", "height"],
"properties": {
"coordinate_space": {"const": "normalized"},
"x": {"type": "number", "minimum": 0, "maximum": 1},
"y": {"type": "number", "minimum": 0, "maximum": 1},
"width": {"type": "number", "exclusiveMinimum": 0, "maximum": 1},
"height": {"type": "number", "exclusiveMinimum": 0, "maximum": 1}
}
},
{
"type": "object", "additionalProperties": false,
"required": ["coordinate_space", "x", "y", "width", "height"],
"properties": {
"coordinate_space": {"const": "pixels"},
"x": {"type": "integer", "minimum": 0, "maximum": 100000},
"y": {"type": "integer", "minimum": 0, "maximum": 100000},
"width": {"type": "integer", "minimum": 1, "maximum": 100000},
"height": {"type": "integer", "minimum": 1, "maximum": 100000}
}
}
]
},
"valueState": {
"type": "object",
"additionalProperties": false,
"required": ["raw_text", "normalized_value", "missing_reason"],
"properties": {
"raw_text": {"type": ["string", "null"], "maxLength": 8192},
"normalized_value": {"$ref": "#/$defs/jsonValue"},
"missing_reason": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/missingReason"}]}
},
"oneOf": [
{"properties": {"normalized_value": {"type": "null"}, "missing_reason": {"$ref": "#/$defs/missingReason"}}},
{"properties": {"normalized_value": {"not": {"type": "null"}}, "missing_reason": {"type": "null"}}}
]
},
"correction": {
"type": "object", "additionalProperties": false,
"required": ["correction_id", "corrected_at", "actor", "reason", "before", "after"],
"properties": {
"correction_id": {"$ref": "#/$defs/id"},
"corrected_at": {"$ref": "#/$defs/timestamp"},
"actor": {"enum": ["local_user", "system_reprocess"]},
"reason": {"type": "string", "minLength": 1, "maxLength": 1000},
"before": {"$ref": "#/$defs/valueState"},
"after": {"$ref": "#/$defs/valueState"}
}
},
"evidenceValue": {
"type": "object", "additionalProperties": false,
"required": [
"evidence_id", "field_path", "raw_text", "normalized_value", "missing_reason",
"confidence", "source_engine", "image_artifact_id", "image_sha256", "region", "correction_history"
],
"properties": {
"evidence_id": {"$ref": "#/$defs/id"},
"field_path": {"type": "string", "pattern": "^[A-Za-z0-9_.-]{1,256}$"},
"raw_text": {"type": ["string", "null"], "maxLength": 8192},
"normalized_value": {"$ref": "#/$defs/jsonValue"},
"missing_reason": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/missingReason"}]},
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
"source_engine": {"$ref": "#/$defs/sourceEngine"},
"image_artifact_id": {"$ref": "#/$defs/id"},
"image_sha256": {"$ref": "#/$defs/sha256"},
"region": {"$ref": "#/$defs/region"},
"correction_history": {"type": "array", "maxItems": 100, "items": {"$ref": "#/$defs/correction"}}
},
"oneOf": [
{"properties": {"normalized_value": {"type": "null"}, "missing_reason": {"$ref": "#/$defs/missingReason"}}},
{"properties": {"normalized_value": {"not": {"type": "null"}}, "missing_reason": {"type": "null"}}}
]
},
"fieldClaim": {
"type": "object", "additionalProperties": false,
"required": ["path", "value", "missing_reason", "evidence_refs", "uncertainty_note"],
"properties": {
"path": {"type": "string", "pattern": "^[A-Za-z0-9_.-]{1,256}$"},
"value": {"$ref": "#/$defs/jsonValue"},
"missing_reason": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/missingReason"}]},
"evidence_refs": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"uncertainty_note": {"type": ["string", "null"], "maxLength": 2000}
},
"oneOf": [
{"properties": {"value": {"type": "null"}, "missing_reason": {"$ref": "#/$defs/missingReason"}}},
{"properties": {"value": {"not": {"type": "null"}}, "missing_reason": {"type": "null"}}}
]
},
"classification": {
"type": "object", "additionalProperties": false,
"required": ["family", "view", "gear_slot", "record_types", "confidence", "abstention_reason"],
"properties": {
"family": {"$ref": "#/$defs/family"}, "view": {"type": "string"},
"gear_slot": {"type": ["string", "null"]},
"record_types": {"type": "array", "uniqueItems": true, "maxItems": 8, "items": {"$ref": "#/$defs/recordType"}},
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
"abstention_reason": {"type": ["string", "null"]}
},
"oneOf": [
{"properties": {"family": {"const": "weapon"}, "view": {"enum": ["detail", "blueprint", "crafting", "stat_range", "talent_grid", "augmentation"]}, "gear_slot": {"const": null}, "record_types": {"minItems": 1, "items": {"enum": ["weapon", "weapon_talent", "weapon_augmentation_profile"]}}, "abstention_reason": {"const": null}}},
{"properties": {"family": {"const": "gear"}, "view": {"enum": ["detail", "blueprint", "talent", "augmentation"]}, "gear_slot": {"enum": ["Mask", "Gloves", "Backpack", "Body Armor", "Holster", "Knee Pads"]}, "record_types": {"minItems": 1, "items": {"enum": ["gear", "brand_set", "gear_talent", "gear_augmentation_profile"]}}, "abstention_reason": {"const": null}}},
{"properties": {"family": {"const": "skill_chip"}, "view": {"enum": ["detail", "set_bonus", "talent"]}, "gear_slot": {"const": null}, "record_types": {"minItems": 1, "items": {"enum": ["skill_chip_set", "skill_chip_set_bonus", "skill_chip_roll_pool", "skill_chip_talent"]}}, "abstention_reason": {"const": null}}},
{"properties": {"family": {"const": "os_protocol"}, "view": {"enum": ["detail", "secondary_profile", "talent"]}, "gear_slot": {"const": null}, "record_types": {"minItems": 1, "items": {"enum": ["os_protocol", "os_protocol_secondary_profile", "os_protocol_talent"]}}, "abstention_reason": {"const": null}}},
{"properties": {"family": {"const": "specialization"}, "view": {"enum": ["overview", "details", "ability", "focus_details", "focus_tree", "rank_details"]}, "gear_slot": {"const": null}, "record_types": {"minItems": 1, "items": {"enum": ["specialization", "specialization_focus", "specialization_ability", "specialization_tree_node", "specialization_tree_rank"]}}, "abstention_reason": {"const": null}}},
{"properties": {"family": {"const": "unknown"}, "view": {"const": "unknown"}, "gear_slot": {"const": null}, "record_types": {"maxItems": 0}, "abstention_reason": {"enum": ["low_confidence", "ambiguous_family", "ambiguous_view", "unsupported_family", "unsupported_view", "insufficient_visual_evidence", "occluded", "corrupt_image", "resource_limit", "cancelled"]}}}
]
},
"artifact": {
"type": "object", "additionalProperties": false,
"required": ["artifact_id", "sha256", "media_type", "byte_size", "sensitivity", "parent_artifact_id", "video_timestamp_ms"],
"properties": {
"artifact_id": {"$ref": "#/$defs/id"}, "sha256": {"$ref": "#/$defs/sha256"},
"media_type": {"enum": ["image/png", "image/webp", "image/avif", "video/mp4", "video/webm", "video/x-matroska"]},
"byte_size": {"type": "integer", "minimum": 1},
"sensitivity": {"const": "private"},
"parent_artifact_id": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/id"}]},
"video_timestamp_ms": {"type": ["integer", "null"], "minimum": 0, "maximum": 86400000}
},
"oneOf": [
{
"properties": {
"media_type": {"enum": ["image/png", "image/webp", "image/avif"]},
"byte_size": {"maximum": 67108864}
}
},
{
"properties": {
"media_type": {"enum": ["video/mp4", "video/webm", "video/x-matroska"]},
"byte_size": {"maximum": 17179869184}
}
}
]
},
"capture": {
"type": "object", "additionalProperties": false,
"required": ["capture_id", "artifact_id", "state", "received_at", "failure_reason"],
"properties": {
"capture_id": {"$ref": "#/$defs/id"}, "artifact_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["received", "spooling", "stored", "deduplicated", "queued", "failed", "cancelled"]},
"received_at": {"$ref": "#/$defs/timestamp"},
"failure_reason": {"type": ["string", "null"], "maxLength": 2000}
}
},
"screen": {
"type": "object", "additionalProperties": false,
"required": ["screen_id", "artifact_id", "classified_at", "classification"],
"properties": {
"screen_id": {"$ref": "#/$defs/id"}, "artifact_id": {"$ref": "#/$defs/id"},
"classified_at": {"$ref": "#/$defs/timestamp"}, "classification": {"$ref": "#/$defs/classification"}
}
},
"job": {
"type": "object", "additionalProperties": false,
"required": ["job_id", "kind", "state", "attempt", "max_attempts", "last_error_id"],
"properties": {
"job_id": {"$ref": "#/$defs/id"},
"kind": {"enum": ["classify", "ocr", "vision_fallback", "frame_extract", "export"]},
"state": {"enum": ["queued", "running", "retry_wait", "succeeded", "failed", "cancelled"]},
"attempt": {"type": "integer", "minimum": 0, "maximum": 20},
"max_attempts": {"type": "integer", "minimum": 1, "maximum": 20},
"last_error_id": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/id"}]}
}
},
"extraction": {
"type": "object", "additionalProperties": false,
"required": ["extraction_id", "screen_id", "state", "evidence_refs", "abstention_reason"],
"properties": {
"extraction_id": {"$ref": "#/$defs/id"}, "screen_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["pending", "local_processing", "fallback_pending", "fallback_processing", "candidate_ready", "abstained", "failed", "cancelled"]},
"evidence_refs": {"type": "array", "maxItems": 1000, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"abstention_reason": {"type": ["string", "null"], "maxLength": 100}
}
},
"group": {
"type": "object", "additionalProperties": false,
"required": ["group_id", "state", "screen_ids", "supersedes_group_ids"],
"properties": {
"group_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["ungrouped", "proposed", "grouped", "split", "superseded", "rejected", "cancelled"]},
"screen_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"supersedes_group_ids": {"type": "array", "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}}
}
},
"review": {
"type": "object", "additionalProperties": false,
"required": ["review_id", "candidate_id", "state", "updated_at", "note"],
"properties": {
"review_id": {"$ref": "#/$defs/id"}, "candidate_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["pending", "in_review", "changes_requested", "approved", "rejected", "cancelled"]},
"updated_at": {"$ref": "#/$defs/timestamp"}, "note": {"type": ["string", "null"], "maxLength": 4000}
}
},
"export": {
"type": "object", "additionalProperties": false,
"required": ["export_id", "state", "artifact_id", "failure_reason"],
"properties": {
"export_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["not_requested", "queued", "building", "ready", "failed", "cancelled", "expired"]},
"artifact_id": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/id"}]},
"failure_reason": {"type": ["string", "null"], "maxLength": 2000}
}
},
"error": {
"type": "object", "additionalProperties": false,
"required": ["error_id", "state", "code", "message", "retry_after"],
"properties": {
"error_id": {"$ref": "#/$defs/id"},
"state": {"enum": ["open", "retryable", "retrying", "recovered", "terminal", "dismissed"]},
"code": {"enum": ["cancelled", "resource_limit", "timeout", "invalid_input", "engine_failure", "storage_failure", "network_failure", "schema_rejected", "unsupported", "ambiguous"]},
"message": {"type": "string", "minLength": 1, "maxLength": 2000},
"retry_after": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/timestamp"}]}
}
},
"observedContext": {
"type": "object", "additionalProperties": false,
"required": ["level", "quality", "tier", "upgrade_state"],
"properties": {
"level": {"$ref": "#/$defs/fieldClaim"}, "quality": {"$ref": "#/$defs/fieldClaim"},
"tier": {"$ref": "#/$defs/fieldClaim"}, "upgrade_state": {"$ref": "#/$defs/fieldClaim"}
}
},
"observedInstance": {
"type": "object", "additionalProperties": false,
"required": ["instance_id", "family", "source_screen_ids", "observed_context", "fields"],
"properties": {
"instance_id": {"$ref": "#/$defs/id"}, "family": {"$ref": "#/$defs/family"},
"source_screen_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"observed_context": {"$ref": "#/$defs/observedContext"},
"fields": {"type": "array", "maxItems": 1000, "items": {"$ref": "#/$defs/fieldClaim"}}
}
},
"canonicalCandidate": {
"type": "object", "additionalProperties": false,
"required": ["candidate_id", "record_type", "source_instance_ids", "evidence_refs", "fields", "completeness", "relationship_status", "mechanic_status"],
"properties": {
"candidate_id": {"$ref": "#/$defs/id"}, "record_type": {"$ref": "#/$defs/recordType"},
"source_instance_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"evidence_refs": {"type": "array", "minItems": 1, "maxItems": 1000, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
"fields": {"type": "array", "maxItems": 1000, "items": {"$ref": "#/$defs/fieldClaim"}},
"completeness": {"enum": ["complete", "incomplete", "unsupported"]},
"relationship_status": {"enum": ["evidenced", "unresolved", "unsupported", "not_applicable"]},
"mechanic_status": {"enum": ["evidenced", "unresolved", "unsupported", "not_applicable"]}
}
}
}
}