feat: add persistent personal report document v2

This commit is contained in:
Jesse_Chen
2026-08-15 05:10:37 +08:00
parent 9d2d79801d
commit 5012ff7212
48 changed files with 9301 additions and 932 deletions
@@ -0,0 +1,827 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://jyotisha.chat/contracts/personal-report/report-document.v2.schema.json",
"title": "ReportDocument v2",
"description": "Canonical server-issued personal astrology report document v2. The JSON Schema, frontend Zod contract, and stdlib Python validator align on all structural rules. Runtime validators additionally enforce: exactly one complete D1; unique chart, section, theme, and evidence ids; every requested theme is covered exactly once by either a thematic section or blockedConflictDisclosure; written career/wealth/marriage/education themes require D10/D2+D11/D9/D24 chart data respectively; all evidenceRefs close over evidenceAppendix; blocked content is non-deterministic; date claims require evidenceRefs; medical diagnoses, deterministic financial promises, HTML/CSS/executable content, internal paths, secrets, and tool traces are rejected; UTF-8 serialization is capped at 1572864 bytes. The server and Python validator recompute provenance.evidenceHash over canonical techniqueAudit, conflicts, and calculationEvidence. JSON object key order is not validated.",
"type": "object",
"definitions": {
"claimStatus": {
"type": "string",
"enum": [
"multi_system_consensus",
"single_system_inference",
"parameter_sensitive",
"unclosed_divisional_chart",
"user_history_verification_required",
"blocked"
]
},
"evidenceId": {
"type": "string",
"pattern": "^ev-[a-z0-9_-]{1,63}$",
"minLength": 4,
"maxLength": 67
},
"sha256Hex": {
"type": "string",
"pattern": "^[0-9a-f]{64}$",
"minLength": 64,
"maxLength": 64
},
"iso8601": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2})$",
"minLength": 20,
"maxLength": 40
},
"house": {
"type": "object",
"additionalProperties": false,
"properties": {
"houseNumber": {
"type": "integer",
"minimum": 1,
"maximum": 12
},
"sign": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"occupants": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"maxItems": 12
}
},
"required": [
"houseNumber",
"sign",
"occupants"
]
},
"planet": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"sign": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"longitudeDegrees": {
"type": "number",
"minimum": 0,
"exclusiveMaximum": 360
},
"houseNumber": {
"type": "integer",
"minimum": 1,
"maximum": 12
},
"retrograde": {
"type": "boolean"
}
},
"required": [
"name",
"sign",
"longitudeDegrees",
"houseNumber",
"retrograde"
]
},
"chart": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"enum": [
"D1",
"D2",
"D9",
"D10",
"D11",
"D24"
]
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"houses": {
"type": "array",
"items": {
"$ref": "#/definitions/house"
},
"maxItems": 12
},
"planets": {
"type": "array",
"items": {
"$ref": "#/definitions/planet"
},
"maxItems": 12
},
"claimStatus": {
"$ref": "#/definitions/claimStatus"
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"id",
"title",
"houses",
"claimStatus",
"evidenceRefs"
]
},
"thematicSection": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]{0,95}$",
"minLength": 1,
"maxLength": 96
},
"theme": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.-]{0,95}$",
"minLength": 1,
"maxLength": 96
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"narrative": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"actions": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"caveats": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"claimStatus": {
"$ref": "#/definitions/claimStatus"
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"id",
"theme",
"title",
"narrative",
"actions",
"caveats",
"claimStatus",
"evidenceRefs"
]
},
"techniqueAuditRow": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "#/definitions/evidenceId"
},
"techniqueId": {
"type": "string",
"pattern": "^[a-z0-9_.-]{1,80}$",
"minLength": 1,
"maxLength": 80
},
"techniqueName": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"status": {
"type": "string",
"enum": [
"verified",
"partial",
"blocked"
]
},
"used": {
"type": "boolean"
},
"notes": {
"type": "string",
"maxLength": 500
}
},
"required": [
"id",
"techniqueId",
"techniqueName",
"status",
"used"
]
},
"conflictRow": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "#/definitions/evidenceId"
},
"description": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"impact": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"status": {
"type": "string",
"enum": [
"unresolved",
"partial",
"resolved"
]
}
},
"required": [
"id",
"description",
"impact",
"status"
]
},
"calculationEvidenceRow": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "#/definitions/evidenceId"
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"value": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"source": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": [
"id",
"label",
"value",
"source"
]
},
"actionNote": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]{0,95}$",
"minLength": 1,
"maxLength": 96
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"note": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"priority": {
"type": "string",
"enum": [
"now",
"next",
"watch"
]
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"id",
"title",
"note",
"priority",
"evidenceRefs"
]
},
"blockedConflictDisclosure": {
"type": "object",
"additionalProperties": false,
"properties": {
"theme": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.-]{0,95}$",
"minLength": 1,
"maxLength": 96
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"reason": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"missingEvidence": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 24,
"minItems": 1
},
"conflictNotes": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"maxItems": 24
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24
},
"claimStatus": {
"type": "string",
"const": "blocked"
}
},
"required": [
"theme",
"title",
"reason",
"missingEvidence",
"conflictNotes",
"evidenceRefs",
"claimStatus"
]
}
},
"additionalProperties": false,
"properties": {
"schemaVersion": {
"type": "string",
"const": "report_document.v2"
},
"reportId": {
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
},
"reportType": {
"type": "string",
"enum": [
"personal_full",
"personal_thematic"
]
},
"presentationMode": {
"type": "string",
"enum": [
"default",
"research"
]
},
"depth": {
"type": "string",
"enum": [
"concise",
"standard",
"deep",
"research"
]
},
"requestedThemes": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.-]{0,95}$",
"minLength": 1,
"maxLength": 96
},
"minItems": 1,
"maxItems": 12
},
"generatedAt": {
"$ref": "#/definitions/iso8601"
},
"subject": {
"type": "object",
"additionalProperties": false,
"properties": {
"displayName": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"birthTimeStatus": {
"type": "string",
"enum": [
"reported",
"candidate",
"accepted",
"confirmed"
]
},
"birthPlaceLabel": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": [
"displayName",
"birthTimeStatus",
"birthPlaceLabel"
]
},
"provenance": {
"type": "object",
"additionalProperties": false,
"properties": {
"skillName": {
"type": "string",
"pattern": "^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$",
"minLength": 1,
"maxLength": 120
},
"skillVersion": {
"type": "string",
"pattern": "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$",
"minLength": 5,
"maxLength": 80
},
"skillSourceCommit": {
"type": [
"string",
"null"
],
"pattern": "^[0-9a-f]{40}$",
"minLength": 40,
"maxLength": 40
},
"skillSnapshotSha256": {
"$ref": "#/definitions/sha256Hex"
},
"calculationHash": {
"$ref": "#/definitions/sha256Hex"
},
"evidenceHash": {
"$ref": "#/definitions/sha256Hex"
},
"reportContractVersion": {
"type": "string",
"const": "2"
}
},
"required": [
"skillName",
"skillVersion",
"skillSourceCommit",
"skillSnapshotSha256",
"calculationHash",
"evidenceHash",
"reportContractVersion"
]
},
"executiveSummary": {
"type": "object",
"additionalProperties": false,
"properties": {
"headline": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"summary": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"priorities": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"maxItems": 8
},
"overallClaimStatus": {
"$ref": "#/definitions/claimStatus"
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"headline",
"summary",
"priorities",
"overallClaimStatus",
"evidenceRefs"
]
},
"natalFoundation": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"narrative": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"keyFactors": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"caveats": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"claimStatus": {
"$ref": "#/definitions/claimStatus"
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"title",
"narrative",
"keyFactors",
"caveats",
"claimStatus",
"evidenceRefs"
]
},
"currentPhase": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"phaseLabel": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"narrative": {
"type": "string",
"minLength": 1,
"maxLength": 4000
},
"timingNotes": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"caveats": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 400
},
"maxItems": 12
},
"claimStatus": {
"$ref": "#/definitions/claimStatus"
},
"evidenceRefs": {
"type": "array",
"items": {
"$ref": "#/definitions/evidenceId"
},
"maxItems": 24,
"minItems": 1
}
},
"required": [
"title",
"phaseLabel",
"narrative",
"timingNotes",
"caveats",
"claimStatus",
"evidenceRefs"
]
},
{
"type": "null"
}
]
},
"actionNotes": {
"type": "array",
"minItems": 1,
"maxItems": 24,
"items": {
"$ref": "#/definitions/actionNote"
}
},
"charts": {
"type": "array",
"items": {
"$ref": "#/definitions/chart"
},
"minItems": 1,
"maxItems": 6
},
"thematicNarrative": {
"type": "array",
"items": {
"$ref": "#/definitions/thematicSection"
},
"maxItems": 12
},
"blockedConflictDisclosure": {
"type": "array",
"items": {
"$ref": "#/definitions/blockedConflictDisclosure"
},
"maxItems": 12
},
"evidenceAppendix": {
"type": "object",
"additionalProperties": false,
"properties": {
"expandedByDefault": {
"type": "boolean"
},
"techniqueAudit": {
"type": "array",
"items": {
"$ref": "#/definitions/techniqueAuditRow"
},
"maxItems": 100
},
"conflicts": {
"type": "array",
"items": {
"$ref": "#/definitions/conflictRow"
},
"maxItems": 50
},
"calculationEvidence": {
"type": "array",
"items": {
"$ref": "#/definitions/calculationEvidenceRow"
},
"maxItems": 100
},
"blockedTechniques": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"maxItems": 100
}
},
"required": [
"expandedByDefault",
"techniqueAudit",
"conflicts",
"calculationEvidence",
"blockedTechniques"
]
},
"disclaimer": {
"type": "string",
"minLength": 1,
"maxLength": 2000
}
},
"required": [
"schemaVersion",
"reportId",
"reportType",
"presentationMode",
"depth",
"requestedThemes",
"generatedAt",
"subject",
"provenance",
"executiveSummary",
"natalFoundation",
"currentPhase",
"actionNotes",
"charts",
"thematicNarrative",
"blockedConflictDisclosure",
"evidenceAppendix",
"disclaimer"
]
}