{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getoneprofile-ai/json-schema/getoneprofile-ai-ai-context-read-schema-schema.json",
  "title": "AiContextReadSchema",
  "description": "The org's business context, plus its latest generation job for resume.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getoneprofile-ai-ai-context-api-openapi.yml#/components/schemas/AiContextReadSchema",
  "properties": {
    "company_description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company Description"
    },
    "company_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/CompanyType"
        },
        {
          "type": "null"
        }
      ],
      "description": "How the company makes money. Descriptive context shown to the AI Assistant and MCP clients; no writer reads it yet."
    },
    "company_type_choices": {
      "description": "Every `company_type` value, in the order a picker lists them.",
      "items": {
        "$ref": "#/$defs/AiContextChoiceSchema"
      },
      "title": "Company Type Choices",
      "type": "array"
    },
    "company_type_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "`company_type` as a page shows it.",
      "title": "Company Type Label"
    },
    "created_at": {
      "format": "date-time",
      "title": "Created At",
      "type": "string"
    },
    "first_run_available": {
      "description": "Whether `POST /ai-context/runs/` with no domain would start a first run now: the signed-in user created the workspace with a company email address, no field has text, and no run has been made. Ask for that run only when this is true; otherwise it is refused (422, `domain_required`). Always false for an API key.",
      "title": "First Run Available",
      "type": "boolean"
    },
    "id": {
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "ideal_buyer_personas": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ideal Buyer Personas"
    },
    "ideal_customer_profile": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ideal Customer Profile"
    },
    "interest_signals": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Interest Signals"
    },
    "last_generated_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Generated At"
    },
    "latest_generation_job": {
      "anyOf": [
        {
          "$ref": "#/$defs/AiContextGenerationJobReadSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "The org's most recent generation job, if any. Lets a reloaded page resume polling a job that is still running."
    },
    "max_context_chars": {
      "description": "How many characters of included reference document summaries one prompt reads, oldest document first. Documents past that line report `in_prompt_budget: false`.",
      "title": "Max Context Chars",
      "type": "integer"
    },
    "max_documents": {
      "description": "How many reference documents this workspace may keep.",
      "title": "Max Documents",
      "type": "integer"
    },
    "max_qa_answer_chars": {
      "description": "The longest a Q&A answer may be.",
      "title": "Max Qa Answer Chars",
      "type": "integer"
    },
    "max_qa_context_chars": {
      "description": "How many characters of the Q&A one reply's prompt reads, the newest answers first. Answers past that line report `in_prompt: false` on GET /ai-context/qa/.",
      "title": "Max Qa Context Chars",
      "type": "integer"
    },
    "max_qa_entries": {
      "description": "How many questions this workspace's Q&A may hold.",
      "title": "Max Qa Entries",
      "type": "integer"
    },
    "max_qa_question_chars": {
      "description": "The longest a Q&A question may be.",
      "title": "Max Qa Question Chars",
      "type": "integer"
    },
    "sells_to": {
      "anyOf": [
        {
          "$ref": "#/$defs/SellsTo"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who buys from the company. Descriptive context shown to the AI Assistant and MCP clients; no writer reads it yet."
    },
    "sells_to_choices": {
      "description": "Every `sells_to` value, in the order a picker lists them.",
      "items": {
        "$ref": "#/$defs/AiContextChoiceSchema"
      },
      "title": "Sells To Choices",
      "type": "array"
    },
    "sells_to_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "`sells_to` as a page shows it.",
      "title": "Sells To Label"
    },
    "social_proof": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Social Proof"
    },
    "source_domain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The domain last used to generate these fields; null until a generation succeeds.",
      "title": "Source Domain"
    },
    "source_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The page the last generation's company description came from, one of the pages it read; null when it named none. Read-only.",
      "title": "Source Url"
    },
    "updated_at": {
      "format": "date-time",
      "title": "Updated At",
      "type": "string"
    },
    "voice": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "How the company words things: spelling, formality, what it calls its product and its buyers, jargon it avoids. The outbound agent matches it in every message.",
      "title": "Voice"
    }
  },
  "required": [
    "id",
    "company_description",
    "ideal_customer_profile",
    "ideal_buyer_personas",
    "interest_signals",
    "social_proof",
    "voice",
    "company_type",
    "company_type_label",
    "sells_to",
    "sells_to_label",
    "company_type_choices",
    "sells_to_choices",
    "source_url",
    "source_domain",
    "last_generated_at",
    "latest_generation_job",
    "first_run_available",
    "max_documents",
    "max_context_chars",
    "max_qa_entries",
    "max_qa_context_chars",
    "max_qa_question_chars",
    "max_qa_answer_chars",
    "created_at",
    "updated_at"
  ],
  "type": "object",
  "$defs": {
    "AiContextChoiceSchema": {
      "description": "One option of a business-context choice field: the stored value and how it reads.",
      "properties": {
        "label": {
          "title": "Label",
          "type": "string"
        },
        "value": {
          "title": "Value",
          "type": "string"
        }
      },
      "required": [
        "value",
        "label"
      ],
      "title": "AiContextChoiceSchema",
      "type": "object"
    },
    "AiContextGenerationJobReadSchema": {
      "description": "A generation job's current state. Poll this until `status` is terminal.",
      "properties": {
        "created_at": {
          "format": "date-time",
          "title": "Created At",
          "type": "string"
        },
        "domain": {
          "description": "The domain this job is researching.",
          "title": "Domain",
          "type": "string"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Why generation failed: infra trouble, or too little public content.",
          "title": "Error"
        },
        "id": {
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/AiContextGenerationStatus"
        },
        "steps": {
          "description": "What the research did, one step per piece of work once it is done: the documents and pages it read, the sections it wrote. Grows while the job runs; kept once it finishes.",
          "items": {
            "$ref": "#/$defs/AiStep"
          },
          "maxItems": 40,
          "title": "Steps",
          "type": "array"
        },
        "updated_at": {
          "format": "date-time",
          "title": "Updated At",
          "type": "string"
        }
      },
      "required": [
        "id",
        "domain",
        "status",
        "error",
        "created_at",
        "updated_at"
      ],
      "title": "AiContextGenerationJobReadSchema",
      "type": "object"
    },
    "AiContextGenerationStatus": {
      "description": "Where a context-generation job has got to.\n\nJobs are stored ``PENDING``: committed, with the workflow that will work on\nthem not yet started, which a crash between the two can leave for ever. The\nresearch's first step claims the job (``RUNNING``), and the deadline sweep\nfails one nothing ever claimed. A reader never sees ``PENDING``: to everyone\noutside the repository a job waiting for its workflow is already running.\nThe two terminal states are absorbing: a job never leaves them.",
      "enum": [
        "pending",
        "running",
        "succeeded",
        "failed"
      ],
      "title": "AiContextGenerationStatus",
      "type": "string"
    },
    "AiStep": {
      "additionalProperties": false,
      "description": "One thing an AI turn did, as the wire spells it.\n\nField-for-field identical to ``table_live_updates.TableCellActivityStepSchema``\nON PURPOSE, and the duplication is the design. That schema sits in the table\nstratum's kernel, which the lead search, inbox and sequence surfaces have no\nbusiness importing; this one sits under every surface equally. Because the\ntwo agree exactly, the frontend's ``TimelineStep`` renders both with no\nconversion and no second component, which is the property worth protecting.\n``test_ai_step_mirrors_the_cell_activity_step`` pins them together.\n\nPlain strings rather than enums, for the same reason the cell schema uses\nthem: the vocabulary is open, clients must tolerate tokens they have not\nlearned yet, and a new action should never be able to break a running\ndashboard.",
      "properties": {
        "action": {
          "description": "What kind of move this was, e.g. `read_table`, `plan`, `write_column`.",
          "title": "Action",
          "type": "string"
        },
        "detail": {
          "default": "",
          "description": "The step's input: the instruction, the column it read, the query it ran.",
          "title": "Detail",
          "type": "string"
        },
        "duration_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "Wall clock for the work this step describes, never an estimate.",
          "title": "Duration Ms"
        },
        "observation": {
          "default": "",
          "description": "One line on what came back. The half that makes a step worth reading.",
          "maxLength": 500,
          "title": "Observation",
          "type": "string"
        },
        "outcome": {
          "default": "completed",
          "description": "`completed`, `failed`, `refused` or `stopped`. Clients must tolerate new tokens.",
          "title": "Outcome",
          "type": "string"
        },
        "thought": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The model's stated reasoning for choosing this step. Set by the agent loop; the assistant surfaces leave it null, and the renderer simply omits the rung.",
          "title": "Thought"
        }
      },
      "required": [
        "action"
      ],
      "title": "AiStep",
      "type": "object"
    },
    "CompanyType": {
      "description": "How a company makes money: the catalog's ``company_type`` choices, one for one.",
      "enum": [
        "b2b_saas",
        "b2c_saas",
        "agency_services",
        "ecommerce_dtc",
        "marketplace",
        "manufacturing",
        "financial_services",
        "healthcare",
        "education",
        "nonprofit",
        "government",
        "media_publishing",
        "real_estate",
        "hospitality",
        "logistics",
        "other"
      ],
      "title": "CompanyType",
      "type": "string"
    },
    "SellsTo": {
      "description": "Who a company's buyer is: the catalog's ``sells_to`` choices, one for one.",
      "enum": [
        "businesses",
        "consumers",
        "both"
      ],
      "title": "SellsTo",
      "type": "string"
    }
  }
}