{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aidemos-com/json-schema/aidemos-com-app-api-research-capture-run-in-schema.json",
  "title": "RunIn",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aidemos-com-openapi.json#/components/schemas/app__api__research_capture__RunIn",
  "properties": {
    "idempotency_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Idempotency Key"
    },
    "subject_id": {
      "type": "string",
      "title": "Subject Id"
    },
    "subject_version": {
      "type": "string",
      "title": "Subject Version",
      "description": "a fact of the RUN, never of the subject (§5)"
    },
    "executed_by_actor_id": {
      "type": "string",
      "title": "Executed By Actor Id"
    },
    "executed_at": {
      "type": "string",
      "title": "Executed At"
    },
    "source": {
      "type": "string",
      "title": "Source",
      "description": "captured | extracted"
    },
    "artifacts": {
      "items": {
        "$ref": "#/$defs/RunArtifactIn"
      },
      "type": "array",
      "title": "Artifacts",
      "description": "the bytes in and out. A run must record its stimulus, and a stimulus is composite (C15) — so this may be empty ONLY when stimulus_prompt or stimulus_script carries it"
    },
    "config": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Config",
      "description": "premium vs fast is a DIFFERENT run, not a footnote (eligibility rule 8)"
    },
    "stimulus_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stimulus Prompt",
      "description": "the instruction actually sent. Compared for EQUALITY against the test case version's when a link is offered"
    },
    "stimulus_script": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stimulus Script"
    },
    "cost_usd": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cost Usd"
    },
    "latency_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Latency Ms"
    },
    "completeness": {
      "type": "string",
      "title": "Completeness",
      "default": "incomplete"
    },
    "outcome": {
      "type": "string",
      "title": "Outcome",
      "description": "C17 — what the execution DID: ok | refused | errored | timed_out. An availability failure is a finding, not a capture defect",
      "default": "ok"
    },
    "outcome_detail": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Outcome Detail",
      "description": "{status_code, error, phase} — required whenever outcome is not ok"
    },
    "retest_of": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Retest Of"
    },
    "capture_session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Capture Session Id"
    }
  },
  "type": "object",
  "required": [
    "subject_id",
    "subject_version",
    "executed_by_actor_id",
    "executed_at",
    "source"
  ],
  "$defs": {
    "RunArtifactIn": {
      "properties": {
        "artifact_id": {
          "type": "string",
          "title": "Artifact Id"
        },
        "role": {
          "type": "string",
          "title": "Role",
          "description": "input | output | capture | trace | log"
        },
        "ord": {
          "type": "integer",
          "title": "Ord",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "artifact_id",
        "role"
      ],
      "title": "RunArtifactIn"
    }
  }
}