197 lines
10 KiB
JSON
197 lines
10 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://shd.build/schemas/game-data-capture/isac-handoff-v1.json",
|
|
"title": "Authenticated ISAC draft handoff v1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"schema_version", "handoff_id", "created_at", "source_archive", "trust_boundary",
|
|
"source_artifacts", "evidence_values", "records"
|
|
],
|
|
"properties": {
|
|
"schema_version": {"const": 1},
|
|
"handoff_id": {"$ref": "#/$defs/id"},
|
|
"created_at": {"$ref": "#/$defs/timestamp"},
|
|
"source_archive": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["archive_id", "manifest_sha256", "schema_version"],
|
|
"properties": {
|
|
"archive_id": {"$ref": "#/$defs/id"}, "manifest_sha256": {"$ref": "#/$defs/sha256"},
|
|
"schema_version": {"const": 1}
|
|
}
|
|
},
|
|
"trust_boundary": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["intended_destination", "mutation_authority", "requires_authenticated_action", "preserves_moderation", "creates_audit_events"],
|
|
"properties": {
|
|
"intended_destination": {"const": "authenticated_isac_intake"},
|
|
"mutation_authority": {"const": "none"},
|
|
"requires_authenticated_action": {"const": true},
|
|
"preserves_moderation": {"const": true},
|
|
"creates_audit_events": {"const": false}
|
|
}
|
|
},
|
|
"source_artifacts": {"type": "array", "maxItems": 10000, "items": {"$ref": "#/$defs/sourceArtifact"}},
|
|
"evidence_values": {"type": "array", "maxItems": 100000, "items": {"$ref": "#/$defs/evidenceValue"}},
|
|
"records": {"type": "array", "maxItems": 20000, "items": {"$ref": "#/$defs/handoffRecord"}}
|
|
},
|
|
"$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},
|
|
"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"}}}
|
|
]
|
|
},
|
|
"sourceArtifact": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["artifact_id", "sha256", "media_type", "byte_size"],
|
|
"properties": {
|
|
"artifact_id": {"$ref": "#/$defs/id"}, "sha256": {"$ref": "#/$defs/sha256"},
|
|
"media_type": {"enum": ["image/png", "image/webp", "image/avif"]},
|
|
"byte_size": {"type": "integer", "minimum": 1, "maximum": 67108864}
|
|
}
|
|
},
|
|
"evidenceSection": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["status", "evidence_refs", "note"],
|
|
"properties": {
|
|
"status": {"enum": ["evidenced", "unresolved", "unsupported", "not_applicable"]},
|
|
"evidence_refs": {"type": "array", "maxItems": 1000, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
|
|
"note": {"type": ["string", "null"], "maxLength": 4000}
|
|
}
|
|
},
|
|
"handoffRecord": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": [
|
|
"handoff_record_id", "record_type", "intent", "target_id", "review_state",
|
|
"source_candidate_ids", "observed_instance_ids", "fields", "relationships", "mechanics"
|
|
],
|
|
"properties": {
|
|
"handoff_record_id": {"$ref": "#/$defs/id"}, "record_type": {"$ref": "#/$defs/recordType"},
|
|
"intent": {"enum": ["create_draft", "update_draft", "abstain"]},
|
|
"target_id": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/id"}]},
|
|
"review_state": {"enum": ["approved", "abstained"]},
|
|
"source_candidate_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
|
|
"observed_instance_ids": {"type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
|
|
"fields": {"type": "array", "maxItems": 1000, "items": {"$ref": "#/$defs/fieldClaim"}},
|
|
"relationships": {"$ref": "#/$defs/evidenceSection"},
|
|
"mechanics": {"$ref": "#/$defs/evidenceSection"}
|
|
},
|
|
"oneOf": [
|
|
{"properties": {"intent": {"const": "create_draft"}, "target_id": {"const": null}, "review_state": {"const": "approved"}}},
|
|
{"properties": {"intent": {"const": "update_draft"}, "target_id": {"$ref": "#/$defs/id"}, "review_state": {"const": "approved"}}},
|
|
{"properties": {"intent": {"const": "abstain"}, "target_id": {"const": null}, "review_state": {"const": "abstained"}, "fields": {"maxItems": 0}}}
|
|
]
|
|
}
|
|
}
|
|
}
|