{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cueframe-ai/json-schema/cueframe-ai-compose-job-detail-response-schema.json",
  "title": "ComposeJobDetailResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cueframe-ai-compose-api-openapi.yml#/components/schemas/ComposeJobDetailResponse",
  "type": "object",
  "properties": {
    "composeJobId": {
      "type": "string"
    },
    "projectId": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "awaiting_input",
        "complete",
        "failed",
        "cancelled"
      ]
    },
    "reconciliationRequired": {
      "type": "boolean"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "request": {
      "type": "object",
      "properties": {
        "suggestionId": {
          "type": "string"
        },
        "fromComposition": {
          "type": "boolean"
        },
        "scope": {},
        "critique": {
          "type": "string"
        },
        "parentJobId": {
          "type": "string"
        },
        "maxCandidates": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "budgetUsd": {
          "type": "number"
        },
        "qualityThreshold": {
          "type": "number"
        }
      },
      "additionalProperties": false
    },
    "candidates": {
      "type": "array",
      "items": {}
    },
    "winner": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "candidateIndex": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "compositionRunId": {
              "type": "string"
            }
          },
          "required": [
            "candidateIndex",
            "compositionRunId"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "listUsd": {
      "type": "number"
    },
    "startedAt": {
      "type": "number"
    },
    "completedAt": {
      "type": [
        "number",
        "null"
      ]
    },
    "advisoryResult": {
      "$ref": "#/$defs/ConsultResult"
    },
    "checkpoint": {
      "type": "object",
      "properties": {
        "checkpointId": {
          "type": "string"
        },
        "stage": {
          "type": "string",
          "enum": [
            "content",
            "layout",
            "motion"
          ]
        },
        "version": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "checkpointId",
        "stage",
        "version"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "composeJobId",
    "projectId",
    "status",
    "error",
    "request",
    "candidates",
    "winner",
    "startedAt",
    "completedAt"
  ],
  "additionalProperties": false,
  "$defs": {
    "ConsultResult": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "advise",
            "amend",
            "explore"
          ]
        },
        "assessment": {
          "description": "Grounded critique of the CURRENT composition. Omitted for mode=advise.",
          "type": "object",
          "properties": {
            "editorial": {
              "type": "object",
              "properties": {
                "score": {
                  "type": "number"
                },
                "grounding": {
                  "type": "string",
                  "enum": [
                    "measured",
                    "judged"
                  ]
                },
                "abstained": {
                  "type": "boolean"
                },
                "reliability": {
                  "type": "number"
                }
              },
              "required": [
                "score",
                "grounding",
                "abstained"
              ],
              "additionalProperties": false
            },
            "spatial": {
              "type": "object",
              "properties": {
                "score": {
                  "type": "number"
                },
                "grounding": {
                  "type": "string",
                  "enum": [
                    "measured",
                    "judged"
                  ]
                },
                "abstained": {
                  "type": "boolean"
                },
                "reliability": {
                  "type": "number"
                }
              },
              "required": [
                "score",
                "grounding",
                "abstained"
              ],
              "additionalProperties": false
            },
            "brand": {
              "type": "object",
              "properties": {
                "score": {
                  "type": "number"
                },
                "grounding": {
                  "type": "string",
                  "enum": [
                    "measured",
                    "judged"
                  ]
                },
                "abstained": {
                  "type": "boolean"
                },
                "reliability": {
                  "type": "number"
                }
              },
              "required": [
                "score",
                "grounding",
                "abstained"
              ],
              "additionalProperties": false
            },
            "caption": {
              "type": "object",
              "properties": {
                "score": {
                  "type": "number"
                },
                "grounding": {
                  "type": "string",
                  "enum": [
                    "measured",
                    "judged"
                  ]
                },
                "abstained": {
                  "type": "boolean"
                },
                "reliability": {
                  "type": "number"
                }
              },
              "required": [
                "score",
                "grounding",
                "abstained"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "editorial",
            "spatial",
            "brand",
            "caption"
          ],
          "additionalProperties": false
        },
        "proposals": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "candidateIndex": {
                "description": "Present for amend/explore — adopt via POST /compose/jobs/:jobId/select with this candidateIndex. Absent for advise.",
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "changeSummary": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Human-legible edit-pattern labels."
              },
              "boundToEtag": {
                "description": "The composition etag this proposal was computed against.",
                "type": "string"
              },
              "expectedDelta": {
                "description": "Advisory per-criterion score lift; NOT authoritative pre-recalibration.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "label",
              "changeSummary"
            ],
            "additionalProperties": false
          }
        },
        "principles": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Reusable, grounded lessons for the client's next authoring."
        },
        "plan": {
          "description": "Present for mode=advise — the planner agent's ComposePlan (framing/cuts/captions/graphics intents) as GUIDANCE. The client agent reads it and re-authors; it is NOT converted to ops."
        },
        "checkpointId": {
          "description": "The durable kind:'score' Checkpoint minted from this advisory (evidence convergence — get_checkpoint re-reads the envelope later). Stamped at the consult success terminal.",
          "type": "string"
        }
      },
      "required": [
        "mode",
        "proposals",
        "principles"
      ],
      "additionalProperties": false,
      "description": "The advisory envelope returned by a completed consult job (on ComposeJobDetailResponse.advisoryResult)."
    }
  }
}