{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tickertrac-com/json-schema/tickertrac-com-research-job-out-schema.json",
  "title": "ResearchJobOut",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tickertrac-com-openapi.json#/components/schemas/ResearchJobOut",
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "research-jobs-v1",
      "title": "Schema Version",
      "default": "research-jobs-v1"
    },
    "job_id": {
      "type": "integer",
      "maximum": 9.223372036854776e+18,
      "exclusiveMinimum": 0.0,
      "title": "Job Id"
    },
    "subject": {
      "type": "string",
      "maxLength": 46,
      "pattern": "^(company:[1-9][0-9]{0,18}:(?:[A-Z0-9][A-Z0-9.-]{0,15}|[A-Z]{2,5}:[A-Z0-9][A-Z0-9.-]{0,11})|theme:[1-9][0-9]{0,18})$",
      "title": "Subject"
    },
    "subject_kind": {
      "type": "string",
      "enum": [
        "company",
        "theme"
      ],
      "title": "Subject Kind"
    },
    "version": {
      "type": "integer",
      "maximum": 9.223372036854776e+18,
      "exclusiveMinimum": 0.0,
      "title": "Version"
    },
    "version_id": {
      "type": "integer",
      "maximum": 9.223372036854776e+18,
      "exclusiveMinimum": 0.0,
      "title": "Version Id"
    },
    "tickers": {
      "items": {
        "type": "string",
        "maxLength": 16,
        "minLength": 1,
        "pattern": "^[A-Z0-9][A-Z0-9.:-]{0,15}$"
      },
      "type": "array",
      "maxItems": 3,
      "minItems": 1,
      "title": "Tickers"
    },
    "question": {
      "type": "string",
      "maxLength": 1500,
      "title": "Question"
    },
    "queries": {
      "items": {
        "type": "string",
        "maxLength": 300,
        "minLength": 1
      },
      "type": "array",
      "maxItems": 3,
      "minItems": 1,
      "title": "Queries"
    },
    "status": {
      "type": "string",
      "enum": [
        "prepared",
        "approved",
        "queued",
        "running",
        "completed",
        "partial",
        "cancelled",
        "interrupted",
        "failed",
        "denied",
        "expired"
      ],
      "title": "Status"
    },
    "status_note": {
      "type": "string",
      "title": "Status Note"
    },
    "error_code": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "disabled",
            "funding_unconfigured",
            "version_changed",
            "scope_changed",
            "job_active",
            "daily_limit",
            "packet_too_large",
            "no_permitted_sources",
            "stale_packet",
            "ledger_unavailable",
            "global_capacity",
            "capacity",
            "cancelled",
            "stale_lease",
            "deadline",
            "policy_denied",
            "subject_unavailable",
            "invalid_output",
            "unresolved_attempt",
            "response_saved",
            "unpriced_model",
            "not_replayed",
            "not_enrolled",
            "unexpected",
            "compaction_refused"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Code"
    },
    "error_detail": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 80,
          "minLength": 1,
          "pattern": "^[a-z0-9_:]{1,80}$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Detail"
    },
    "scope_hash": {
      "type": "string",
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[a-f0-9]{64}$",
      "title": "Scope Hash"
    },
    "scope": {
      "$ref": "#/$defs/ResearchScope"
    },
    "cost": {
      "$ref": "#/$defs/CostPreview"
    },
    "origin": {
      "anyOf": [
        {
          "$ref": "#/$defs/ResearchOrigin"
        },
        {
          "type": "null"
        }
      ]
    },
    "lineage": {
      "anyOf": [
        {
          "$ref": "#/$defs/Lineage"
        },
        {
          "type": "null"
        }
      ]
    },
    "reconciliation_mode": {
      "type": "string",
      "enum": [
        "worker_summary",
        "packet_verification"
      ],
      "title": "Reconciliation Mode",
      "default": "worker_summary"
    },
    "verification_policy": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Verification Policy"
    },
    "notify_email": {
      "type": "boolean",
      "title": "Notify Email",
      "default": false
    },
    "notify_phone": {
      "type": "boolean",
      "title": "Notify Phone",
      "default": false
    },
    "notification_requested_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Notification Requested At"
    },
    "delivery": {
      "items": {
        "$ref": "#/$defs/ResearchDeliveryReceipt"
      },
      "type": "array",
      "maxItems": 2,
      "title": "Delivery"
    },
    "requested_by": {
      "type": "string",
      "enum": [
        "session",
        "credential"
      ],
      "title": "Requested By"
    },
    "credential_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Credential Name"
    },
    "prepared_at": {
      "type": "string",
      "format": "date-time",
      "title": "Prepared At"
    },
    "approved_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Approved At"
    },
    "queued_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Queued At"
    },
    "claimed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Claimed At"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Finished At"
    },
    "cancel_requested_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cancel Requested At"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At"
    },
    "calls_attempted": {
      "type": "integer",
      "maximum": 8.0,
      "minimum": 0.0,
      "title": "Calls Attempted"
    },
    "calls_completed": {
      "type": "integer",
      "maximum": 8.0,
      "minimum": 0.0,
      "title": "Calls Completed"
    },
    "reserved_microusd": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Reserved Microusd"
    },
    "measured_microusd": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Measured Microusd"
    },
    "cost_incomplete": {
      "type": "boolean",
      "title": "Cost Incomplete"
    },
    "result_id": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 9.223372036854776e+18,
          "exclusiveMinimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Result Id"
    },
    "app_url": {
      "type": "string",
      "title": "App Url"
    },
    "review_url": {
      "type": "string",
      "title": "Review Url"
    },
    "provider_calls": {
      "type": "integer",
      "const": 0,
      "title": "Provider Calls",
      "default": 0
    },
    "research_started": {
      "type": "boolean",
      "title": "Research Started"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "job_id",
    "subject",
    "subject_kind",
    "version",
    "version_id",
    "tickers",
    "question",
    "queries",
    "status",
    "status_note",
    "scope_hash",
    "scope",
    "cost",
    "requested_by",
    "prepared_at",
    "calls_attempted",
    "calls_completed",
    "reserved_microusd",
    "measured_microusd",
    "cost_incomplete",
    "app_url",
    "review_url",
    "research_started"
  ],
  "$defs": {
    "BlockedStep": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 40,
          "title": "Key"
        },
        "status": {
          "type": "string",
          "enum": [
            "response_saved",
            "unresolved",
            "in_progress"
          ],
          "title": "Status"
        },
        "reason": {
          "type": "string",
          "const": "not_replayed",
          "title": "Reason"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "status",
        "reason"
      ],
      "title": "BlockedStep"
    },
    "CompanyScope": {
      "properties": {
        "ticker": {
          "type": "string",
          "maxLength": 16,
          "minLength": 1,
          "pattern": "^[A-Z0-9][A-Z0-9.:-]{0,15}$",
          "title": "Ticker"
        },
        "passages": {
          "type": "integer",
          "maximum": 15.0,
          "minimum": 0.0,
          "title": "Passages"
        },
        "by_source_type": {
          "additionalProperties": {
            "type": "integer"
          },
          "propertyNames": {
            "enum": [
              "filing",
              "earnings_call",
              "disclosure",
              "news"
            ]
          },
          "type": "object",
          "title": "By Source Type"
        },
        "qa_passages": {
          "type": "integer",
          "maximum": 15.0,
          "minimum": 0.0,
          "title": "Qa Passages"
        },
        "news_passages": {
          "type": "integer",
          "maximum": 5.0,
          "minimum": 0.0,
          "title": "News Passages",
          "default": 0
        },
        "news_unavailable": {
          "type": "integer",
          "minimum": 0.0,
          "title": "News Unavailable",
          "default": 0
        },
        "events": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Events"
        },
        "projection_calls": {
          "type": "integer",
          "maximum": 9.0,
          "minimum": 0.0,
          "title": "Projection Calls"
        },
        "scan_truncated": {
          "type": "boolean",
          "title": "Scan Truncated"
        },
        "selection_truncated": {
          "type": "boolean",
          "title": "Selection Truncated"
        },
        "coverage_state": {
          "type": "string",
          "enum": [
            "partial",
            "unavailable"
          ],
          "title": "Coverage State"
        },
        "coverage_note": {
          "type": "string",
          "title": "Coverage Note"
        },
        "financials_freshness": {
          "type": "string",
          "enum": [
            "fresh",
            "stale",
            "missing",
            "unknown"
          ],
          "title": "Financials Freshness"
        },
        "financials_unavailable_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Financials Unavailable Reason"
        },
        "metric_period_end": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metric Period End"
        },
        "prior_period_end": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Prior Period End"
        },
        "prior_period_available": {
          "type": "boolean",
          "title": "Prior Period Available",
          "default": false
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "ticker",
        "passages",
        "qa_passages",
        "events",
        "projection_calls",
        "scan_truncated",
        "selection_truncated",
        "coverage_state",
        "coverage_note",
        "financials_freshness"
      ],
      "title": "CompanyScope"
    },
    "CostPreview": {
      "properties": {
        "max_cost_microusd": {
          "type": "integer",
          "maximum": 5000000.0,
          "exclusiveMinimum": 0.0,
          "title": "Max Cost Microusd"
        },
        "max_model_calls": {
          "type": "integer",
          "const": 8,
          "title": "Max Model Calls",
          "default": 8
        },
        "model": {
          "type": "string",
          "title": "Model"
        },
        "plan_call_estimate_microusd": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Plan Call Estimate Microusd"
        },
        "worst_case_worker_estimate_microusd": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Worst Case Worker Estimate Microusd"
        },
        "followup_plan_estimate_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Followup Plan Estimate Microusd"
        },
        "reconcile_estimate_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Reconcile Estimate Microusd"
        },
        "worst_case_total_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Worst Case Total Microusd"
        },
        "ceiling_covers_worst_case": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ceiling Covers Worst Case"
        },
        "reconciliation_mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "worker_summary",
                "packet_verification"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Reconciliation Mode"
        },
        "verify_turn_estimate_microusd": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Verify Turn Estimate Microusd"
        },
        "verifier_turns_max": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 4.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Verifier Turns Max"
        },
        "calls_range": {
          "prefixItems": [
            {
              "type": "integer"
            },
            {
              "type": "integer"
            }
          ],
          "type": "array",
          "maxItems": 2,
          "minItems": 2,
          "title": "Calls Range",
          "default": [
            1,
            8
          ]
        },
        "funding_state": {
          "type": "string",
          "enum": [
            "configured",
            "unconfigured"
          ],
          "title": "Funding State"
        },
        "note": {
          "type": "string",
          "title": "Note"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "max_cost_microusd",
        "model",
        "plan_call_estimate_microusd",
        "worst_case_worker_estimate_microusd",
        "funding_state",
        "note"
      ],
      "title": "CostPreview"
    },
    "Lineage": {
      "properties": {
        "parent_job_id": {
          "type": "integer",
          "maximum": 9.223372036854776e+18,
          "exclusiveMinimum": 0.0,
          "title": "Parent Job Id"
        },
        "parent_result_id": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 9.223372036854776e+18,
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Parent Result Id"
        },
        "reused_steps": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 8,
          "title": "Reused Steps"
        },
        "blocked_steps": {
          "items": {
            "$ref": "#/$defs/BlockedStep"
          },
          "type": "array",
          "maxItems": 8,
          "title": "Blocked Steps"
        },
        "planned_steps": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 8,
          "title": "Planned Steps"
        },
        "undetermined_steps": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 4,
          "title": "Undetermined Steps"
        },
        "parent_measured_microusd": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Parent Measured Microusd"
        },
        "parent_reserved_microusd": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Parent Reserved Microusd"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "parent_job_id",
        "parent_measured_microusd",
        "parent_reserved_microusd"
      ],
      "title": "Lineage",
      "description": "How a continuation relates to its parent; cumulative figures include every ancestor."
    },
    "ResearchDeliveryReceipt": {
      "properties": {
        "channel": {
          "type": "string",
          "enum": [
            "email",
            "phone"
          ],
          "title": "Channel"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "accepted",
            "delivered",
            "suppressed",
            "failed",
            "unknown"
          ],
          "title": "Status"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "reference": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reference"
        },
        "decided_at": {
          "type": "string",
          "format": "date-time",
          "title": "Decided At"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "channel",
        "status",
        "decided_at"
      ],
      "title": "ResearchDeliveryReceipt"
    },
    "ResearchOrigin": {
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "earnings_review",
            "call_drift",
            "evidence",
            "none"
          ],
          "title": "Kind",
          "default": "none"
        },
        "report_id": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 9.223372036854776e+18,
              "exclusiveMinimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Report Id"
        },
        "item_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 60,
              "pattern": "^[a-z_.]+:[0-9]{1,9}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Item Id"
        },
        "evidence_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 33,
              "pattern": "^(alert|theme_finding):[1-9][0-9]{0,18}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Evidence Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "ResearchOrigin",
      "description": "Content-free pointer to the retained item a question came from, kept with the job."
    },
    "ResearchScope": {
      "properties": {
        "protocol": {
          "type": "string",
          "const": "workbench-v2",
          "title": "Protocol",
          "default": "workbench-v2"
        },
        "packet_sha256": {
          "type": "string",
          "maxLength": 64,
          "minLength": 64,
          "pattern": "^[a-f0-9]{64}$",
          "title": "Packet Sha256"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Captured At"
        },
        "fresh_until": {
          "type": "string",
          "format": "date-time",
          "title": "Fresh Until"
        },
        "start": {
          "type": "string",
          "format": "date-time",
          "title": "Start"
        },
        "end": {
          "type": "string",
          "format": "date-time",
          "title": "End"
        },
        "queries": {
          "items": {
            "type": "string",
            "maxLength": 300,
            "minLength": 1
          },
          "type": "array",
          "maxItems": 3,
          "minItems": 1,
          "title": "Queries"
        },
        "passages_total": {
          "type": "integer",
          "maximum": 45.0,
          "minimum": 0.0,
          "title": "Passages Total"
        },
        "projection_calls_total": {
          "type": "integer",
          "maximum": 27.0,
          "minimum": 0.0,
          "title": "Projection Calls Total"
        },
        "companies": {
          "items": {
            "$ref": "#/$defs/CompanyScope"
          },
          "type": "array",
          "maxItems": 3,
          "minItems": 1,
          "title": "Companies"
        },
        "note": {
          "type": "string",
          "title": "Note"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "packet_sha256",
        "captured_at",
        "fresh_until",
        "start",
        "end",
        "queries",
        "passages_total",
        "projection_calls_total",
        "companies",
        "note"
      ],
      "title": "ResearchScope"
    }
  }
}