> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ndi.nace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# je_testing

> Run journal-entry testing over a workspace's ledger package. Cost class: **job**.

The caller receives a ``202`` with a queued
:class:`~ndi_service.app.platform_api.results.Job` immediately and polls
``GET /jobs/{id}`` for the
:class:`~ndi_service.app.platform_api.results.JetResult`.

The agent orients itself in the tables the workspace holds, writes SQL over
them itself, and answers with ``sql_receipts``: every statement it ran, the
tables each one registered (path, tab, and the view name the SQL used), and
a bounded result. A figure in the answer is meant to be readable out of one
of those receipts, and a receipt carries everything needed to re-run it.

``paths`` scopes the run to exactly the files of the package under test;
``path_prefix`` scopes it to a folder, and the two compose as an
intersection. Omit ``paths`` to test the whole workspace: the agent orients
over every queryable file the caller can see and finds the ledger package
itself, the same way ``deep-search`` behaves when unscoped. A run keeps its
conversation: pass the result's ``session_id`` on a later request to ask a
follow-up in the same thread.

``reasoning_effort`` controls the thinking budget without changing the
engine. Omit it for the route's default; null keeps the catalogue prescription.

``exhausted: true`` means the step budget ran out before the procedure
finished — a successful, partial response, not a failure.



## OpenAPI

````yaml /openapi.json post /v1/workspaces/{workspace_id}/je-testing
openapi: 3.1.0
info:
  description: >-
    Document intelligence: parse, split, classify, extract, and ground files, or
    build a searchable workspace. Authenticate with ``X-API-Key``.
  title: NDI Platform API
  version: 0.1.0
servers:
  - url: https://ndi-api.nace.ai
security: []
tags: []
paths:
  /v1/workspaces/{workspace_id}/je-testing:
    post:
      tags:
        - je-testing
      summary: je_testing
      description: >-
        Run journal-entry testing over a workspace's ledger package. Cost class:
        **job**.


        The caller receives a ``202`` with a queued

        :class:`~ndi_service.app.platform_api.results.Job` immediately and polls

        ``GET /jobs/{id}`` for the

        :class:`~ndi_service.app.platform_api.results.JetResult`.


        The agent orients itself in the tables the workspace holds, writes SQL
        over

        them itself, and answers with ``sql_receipts``: every statement it ran,
        the

        tables each one registered (path, tab, and the view name the SQL used),
        and

        a bounded result. A figure in the answer is meant to be readable out of
        one

        of those receipts, and a receipt carries everything needed to re-run it.


        ``paths`` scopes the run to exactly the files of the package under test;

        ``path_prefix`` scopes it to a folder, and the two compose as an

        intersection. Omit ``paths`` to test the whole workspace: the agent
        orients

        over every queryable file the caller can see and finds the ledger
        package

        itself, the same way ``deep-search`` behaves when unscoped. A run keeps
        its

        conversation: pass the result's ``session_id`` on a later request to ask
        a

        follow-up in the same thread.


        ``reasoning_effort`` controls the thinking budget without changing the

        engine. Omit it for the route's default; null keeps the catalogue
        prescription.


        ``exhausted: true`` means the step budget ran out before the procedure

        finished — a successful, partial response, not a failure.
      operationId: je_testing_v1_workspaces__workspace_id__je_testing_post
      parameters:
        - description: Workspace identifier.
          in: path
          name: workspace_id
          required: true
          schema:
            description: Workspace identifier.
            format: uuid
            title: Workspace Id
            type: string
        - description: >-
            Bounded inline wait. 0 (the default) returns 202 immediately. Above
            0 the route returns 200 with a terminal job if the work finished in
            time, and 202 with the still-running job if it did not. Either way,
            read `status`.
          in: query
          name: wait_seconds
          required: false
          schema:
            default: 0
            description: >-
              Bounded inline wait. 0 (the default) returns 202 immediately.
              Above 0 the route returns 200 with a terminal job if the work
              finished in time, and 202 with the still-running job if it did
              not. Either way, read `status`.
            maximum: 300
            minimum: 0
            title: Wait Seconds
            type: integer
        - description: >-
            Replaying a request with the same key returns the original job with
            200, never a second job.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            anyOf:
              - maxLength: 200
                type: string
              - type: 'null'
            description: >-
              Replaying a request with the same key returns the original job
              with 200, never a second job.
            title: Idempotency-Key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JeTestingBody'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JeTestingJob'
          description: Successful Response
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Gateway Timeout
        default:
          content:
            application/json:
              example:
                error:
                  code: invalid_request
                  detail: null
                  message: >-
                    Request body has extra fields that this operation does not
                    accept.
                  request_id: req-01j9k2n3p4q5r6s7t8v9
                  retryable: false
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: >-
            Typed error envelope used by every 4xx and 5xx. ``error.code``
            distinguishes the failure; HTTP status is a consequence of the code.
      security:
        - APIKeyHeader: []
components:
  schemas:
    JeTestingBody:
      additionalProperties: false
      description: Body for ``POST /workspaces/{workspace_id}/je-testing``.
      properties:
        context:
          anyOf:
            - maxLength: 20000
              type: string
            - type: 'null'
          description: >-
            Free-form background for the model — the engagement, the entity,
            what the caller already knows. It informs the answer; it does not
            widen or narrow which files the caller may see.
          title: Context
        path_prefix:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Narrow the run to one folder subtree, workspace-relative. Passed
            through to every tool call the run makes rather than evaluated once
            at the edge. Omit it for the whole workspace.
          title: Path Prefix
        paths:
          anyOf:
            - items:
                maxLength: 1024
                minLength: 1
                type: string
              maxItems: 64
              minItems: 1
              type: array
            - type: 'null'
          description: >-
            Scope the run to exactly these uploaded files — the ledger package
            to test. Every tool the agent runs (listings, reads, SQL) sees only
            these files and the content ingested from them. Each entry names an
            uploaded source file, never a folder; scope folders with
            path_prefix, which composes with this as an intersection. Unknown or
            inaccessible paths are refused up front. Omit to test the whole
            workspace: the agent then orients over every queryable file the
            caller can see and finds the ledger package itself, exactly as
            deep-search does when unscoped.
          title: Paths
        query:
          description: >-
            What to answer, in the caller's own words. Stripped before its
            length is checked; a blank query is refused rather than run.
          maxLength: 4096
          minLength: 1
          title: Query
          type: string
        reasoning_effort:
          anyOf:
            - enum:
                - none
                - minimal
                - low
                - medium
                - high
              type: string
            - type: 'null'
          default: low
          description: >-
            Thinking budget for the testing agent; changing it does not change
            the engine. Null keeps the catalogue's per-model prescription. The
            console's Effort pill sends 'low' (default) or 'medium'.
          title: Reasoning Effort
        selection_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Confirmed ledger source selection; mutually exclusive with path
            selectors.
          title: Selection Id
        session_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Continue a prior je-testing conversation: the id echoed on an
            earlier result's `session_id`. The agent resumes with that thread's
            full context — its orientation and its receipted statements — and
            treats this request as the follow-up. Omit to start a new thread.
            Only the API key that started the thread may continue it; a thread
            whose turn is still running returns 409 session_busy.
          title: Session Id
      required:
        - query
      title: JeTestingBody
      type: object
    JeTestingJob:
      additionalProperties: false
      description: >-
        The je-testing route's response shape.


        One kind, one result: the agent engine answers on ``je_testing``. The

        pipeline engine behind ``je-testing-v2`` answers on the same
        ``JetResult``

        under its own kind, but that route is unpublished, so this shape names
        only

        the kind a caller of the published route can receive.
      properties:
        created_at:
          description: When the job row was created.
          format: date-time
          title: Created At
          type: string
        deleted_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: >-
            When the caller hid this run from listings, via `delete_job`. A soft
            delete: the job still reads by id and still counts toward `GET
            /v1/usage` — what it stops doing is appearing in `GET /v1/jobs`.
          title: Deleted At
        effort:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            How hard this run worked, for the search kinds that carry it. A
            consolidated deep-search job (kind deep_search_v2, or a scoped
            intelligent_search run) echoes the requested level: 'low', 'medium',
            or 'high'. Historical intelligent_search rows carry the retired
            internal selector instead: 'fast' is fact-search (and still what new
            fact-search rows say), 'automatic' is automatic-search, 'deep' (or
            the legacy 'balanced') is the pre-consolidation deep-search and the
            console's QA chat — those two are not distinguishable by this field.
            Null for every other kind. Read from the stored request, so it rides
            the same retention path as `query` and `result`: null once
            `result_state` leaves `available`.
          title: Effort
        error:
          anyOf:
            - $ref: '#/components/schemas/Error'
            - type: 'null'
          description: >-
            Typed failure envelope when status is failed. Null on any other
            status.
        finished_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When the job reached a terminal status.
          title: Finished At
        force:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            The request's own `force` flag, echoed regardless of outcome.
            Present for kinds whose request carries one (e.g. kg_build, where a
            true value cleared the durable store before the job ran) so a caller
            can tell that apart from a build that failed leaving the prior store
            untouched — `result` alone cannot, since it is absent on failure
            either way.
          title: Force
        idempotency_key:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Key that was replayed to return this job. Absent when the create
            call had no Idempotency-Key.
          title: Idempotency Key
        job_id:
          description: >-
            Server-minted id. Poll GET /v1/jobs/{job_id} or pass wait_seconds on
            create.
          format: uuid
          title: Job Id
          type: string
        kind:
          const: je_testing
          default: je_testing
          title: Kind
          type: string
        name:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Display name (the console's 'project'). Public Parse, Split,
            Classify, Extract, and Ground runs supply a stable server default
            when blank; citation-generated Ground jobs are excluded. mutable via
            PATCH /v1/jobs/{job_id}.
          title: Name
        payload_expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: >-
            When input and result payloads are dropped. Null means they are kept
            indefinitely.
          title: Payload Expires At
        progress:
          anyOf:
            - $ref: '#/components/schemas/JobProgress'
            - type: 'null'
          description: >-
            Live progress while the job is running. Null while queued and after
            the job finishes.
        project_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Caller-minted grouping id shared by jobs submitted together.
            Filterable on GET /v1/jobs.
          title: Project Id
        query:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The question this job was asked, for the search kinds that carry one
            (intelligent_search, qa_file, qa_tables, filtered_search); null for
            every other kind. Read from the stored request, so it rides the same
            retention path as `result`: null once `result_state` leaves
            `available`. Narrow by design — the frozen access context never
            reaches the wire. File scope is summarised separately as
            `query_scope`.
          title: Query
        query_scope:
          anyOf:
            - discriminator:
                mapping:
                  file:
                    $ref: '#/components/schemas/FileQueryScope'
                  files:
                    $ref: '#/components/schemas/FilesQueryScope'
                  path_prefix:
                    $ref: '#/components/schemas/PathPrefixQueryScope'
                  workspace:
                    $ref: '#/components/schemas/WorkspaceQueryScope'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/WorkspaceQueryScope'
                - $ref: '#/components/schemas/FileQueryScope'
                - $ref: '#/components/schemas/PathPrefixQueryScope'
                - $ref: '#/components/schemas/FilesQueryScope'
            - type: 'null'
          description: >-
            Where this search ran, summarised for history UIs: the whole
            workspace, one file path, one folder prefix, or a count of files.
            Null for non-query jobs, filtered-search page continuations, and
            once `result_state` leaves `available`. Never lists multiple
            filenames, never the raw request, and never the frozen API-key id.
          title: Query Scope
        result:
          anyOf:
            - $ref: '#/components/schemas/JetResult'
            - type: 'null'
          description: Present only on succeeded, and only while retained.
        result_state:
          $ref: '#/components/schemas/ResultState'
          default: available
          description: >-
            Why result may be null. available with a null result means the job
            has not succeeded yet; expired and not_retained mean the payload was
            dropped by retention.
        source:
          anyOf:
            - discriminator:
                mapping:
                  parse_result:
                    $ref: '#/components/schemas/ParseResultSource'
                  upload:
                    $ref: '#/components/schemas/UploadSource'
                  url:
                    $ref: '#/components/schemas/UrlSource'
                  workspace_file:
                    $ref: '#/components/schemas/WorkspaceFileSource'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/UploadSource'
                - $ref: '#/components/schemas/UrlSource'
                - $ref: '#/components/schemas/WorkspaceFileSource'
                - $ref: '#/components/schemas/ParseResultSource'
            - type: 'null'
          description: >-
            What this job read, for the document operations that take a single
            `source` (parse, split, classify, extract, ground); null for every
            other kind. Together with `workspace_id` this is what lets a caller
            re-open the document a past run was about — a `workspace_file`
            source stays readable after the run, while an `upload` is single-use
            and its bytes are gone. Read from the stored request, so it rides
            the same retention path as `query` and `result`: null once
            `result_state` leaves `available`.
          title: Source
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When execution began. Null while still queued.
          title: Started At
        status:
          $ref: >-
            #/components/schemas/ndi_service__app__platform_api__contracts__JobStatus
          description: 'Lifecycle: queued, running, succeeded, failed, or cancelled.'
        surface:
          anyOf:
            - enum:
                - deep_search
                - qa
                - workbook
              type: string
            - type: 'null'
          description: >-
            Which console history this deep-search job belongs to. `deep_search`
            is the public route and the Deep Search page; `qa` and `workbook`
            are the console chat skins over the same agent. It does not pick the
            implementation. Null for fact-search and every non-deep-search kind.
            Jobs stored before this field existed echo `deep_search`. Read from
            the stored payload, so it rides the same retention path as `query`.
          title: Surface
        units:
          default: 0
          description: Billable units once the job finishes; 0 while queued or running.
          title: Units
          type: integer
        workspace_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            The workspace this job reads. Null for a document operation whose
            source is an upload, a URL, or a prior parse result.
          title: Workspace Id
      required:
        - job_id
        - status
        - created_at
      title: JeTestingJob
      type: object
    ErrorEnvelope:
      description: Every non-2xx body on ``/v1``.
      example:
        error:
          code: invalid_request
          detail: null
          message: Request body has extra fields that this operation does not accept.
          request_id: req-01j9k2n3p4q5r6s7t8v9
          retryable: false
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      title: ErrorEnvelope
      type: object
    Error:
      description: The error object, per spec 12 §1.8.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        detail:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Structured payload, when the code carries one.
          title: Detail
        message:
          description: Human- and model-readable; says what to do differently.
          title: Message
          type: string
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Per-request correlation id; matches the ``X-Request-Id`` header.
            Null only when the error was minted outside any HTTP request, e.g.
            by a worker.
          title: Request Id
        retryable:
          description: Whether retrying the identical request could succeed.
          title: Retryable
          type: boolean
      required:
        - code
        - message
        - retryable
      title: Error
      type: object
    JobProgress:
      additionalProperties: false
      description: Absent until the job is ``running``.
      properties:
        items_done:
          default: 0
          title: Items Done
          type: integer
        items_failed:
          default: 0
          description: >-
            Quarantined after exhausting retries, for batch kinds. Excluded from
            items_done.
          title: Items Failed
          type: integer
        items_total:
          anyOf:
            - type: integer
            - type: 'null'
          description: Files, for batch kinds.
          title: Items Total
        knowledge_graph:
          anyOf:
            - $ref: '#/components/schemas/KnowledgeGraphBuildProgress'
            - type: 'null'
          description: Detail only a kg_build reports; null for every other job kind.
        stage:
          anyOf:
            - type: string
            - type: 'null'
          description: Current pipeline stage, for display only.
          title: Stage
        units_done:
          default: 0
          title: Units Done
          type: integer
        units_total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Units Total
      title: JobProgress
      type: object
    FileQueryScope:
      additionalProperties: false
      description: The question ran against one workspace-relative file.
      properties:
        path:
          maxLength: 1024
          minLength: 1
          title: Path
          type: string
        type:
          const: file
          default: file
          title: Type
          type: string
      required:
        - path
      title: FileQueryScope
      type: object
    FilesQueryScope:
      additionalProperties: false
      description: The question ran against several files; only the count is public.
      properties:
        count:
          minimum: 2
          title: Count
          type: integer
        type:
          const: files
          default: files
          title: Type
          type: string
      required:
        - count
      title: FilesQueryScope
      type: object
    PathPrefixQueryScope:
      additionalProperties: false
      description: The question ran against one folder subtree.
      properties:
        prefix:
          maxLength: 1024
          minLength: 1
          title: Prefix
          type: string
        type:
          const: path_prefix
          default: path_prefix
          title: Type
          type: string
      required:
        - prefix
      title: PathPrefixQueryScope
      type: object
    WorkspaceQueryScope:
      additionalProperties: false
      description: The question ran against the whole workspace.
      properties:
        type:
          const: workspace
          default: workspace
          title: Type
          type: string
      title: WorkspaceQueryScope
      type: object
    JetResult:
      additionalProperties: false
      description: >-
        The result of one journal-entry-testing run (``JobKind.JE_TESTING``).


        Shape-compatible with :class:`IntelligentSearchResult` for the retrieval

        core — evidences, reasoning, answer, the tool-call trace, the session

        handle, usage and exhaustion all mean exactly what they mean there —
        plus

        ``sql_receipts``: the statements behind the answer.


        ``figures`` is the answer's checkable half: one entry per criterion,
        each

        naming the receipts its figures are readable out of. There is no
        ``coverage``

        block — v1 runs on tables the caller selected, and an honest coverage
        number

        needs an orientation pass that reports what was *not* selected.
      properties:
        agent_usage:
          anyOf:
            - $ref: '#/components/schemas/JetAgentUsage'
            - type: 'null'
          description: >-
            Root-agent model requests split into execution, compaction, and
            recovery finalization. Null on the fixed pipeline and on results
            stored before this telemetry existed; use `usage` for all nested LLM
            cost.
        answer:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The direct, grounded answer to the request. Null only on a run that
            exhausted its budget before authoring one.
          title: Answer
        binding:
          anyOf:
            - $ref: '#/components/schemas/LedgerBindingWire'
            - type: 'null'
          description: >-
            The definitional layer the run committed and computed under — which
            column is the period, which values mean posted, which clock a timing
            test was verbed on. Null on a run that answered without binding a
            ledger, which is only possible before any statement ran.
        confidence:
          anyOf:
            - $ref: '#/components/schemas/ConfidenceLevel'
            - type: 'null'
          description: >-
            The agent's self-graded confidence in the answer — how well the
            evidence and executed statements support it, on the shared six-level
            scale (certain / very_high / high / medium / low / speculative).
            Null on exhausted runs and on results stored before the field
            existed.
        criteria:
          description: >-
            Every requested test and its final disposition, including tests that
            never reached binding, measurement, or a published figure. Empty
            only on results stored before this checklist existed.
          items:
            $ref: '#/components/schemas/JetCriterionOutcome'
          title: Criteria
          type: array
        degraded:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why this result is degraded, when it is. The run broke before it
            could finalize an answer but had already computed real working, so
            what is published is that working — `sql_receipts` and `binding` —
            with `figures` empty and `answer` saying so. Null on every run that
            finished normally, exhausted ones included.
          title: Degraded
        discrepancies:
          description: >-
            Where the data contradicted the request's premise or a figure it
            stated. Empty when nothing did — the run is asked for this
            explicitly, so an empty list is an answer rather than an omission.
          items:
            type: string
          title: Discrepancies
          type: array
        evidences:
          description: >-
            The material the answer cites, each resolved to the caller's own
            uploaded file.
          items:
            $ref: '#/components/schemas/SearchEvidence'
          title: Evidences
          type: array
        execution_status:
          anyOf:
            - enum:
                - performed
                - partially_performed
                - not_performed
              type: string
            - type: 'null'
          description: >-
            Whether the run tested what it was asked to test: ``performed`` when
            every figure was computed, ``partially_performed`` when some
            criteria could not be, ``not_performed`` when none could. Read it
            alongside `quality`, which grades how well a performed test went.
            JE-testing always sets this on a finished run; other JetResult
            subclasses (deep search) leave it null, as do results stored before
            the field existed.
          title: Execution Status
        exhausted:
          default: false
          description: >-
            Step budget hit before the run was satisfied. A successful response,
            not a failure.
          title: Exhausted
          type: boolean
        figures:
          description: >-
            One entry per criterion tested, each linked to the receipts its
            figures are readable out of. Empty on a run that answered without
            testing anything, or that exhausted its budget first.
          items:
            $ref: '#/components/schemas/JetFigure'
          title: Figures
          type: array
        grounding_job_ids:
          anyOf:
            - items:
                format: uuid
                type: string
              type: array
            - type: 'null'
          description: >-
            Ground jobs planned for this search's evidences. Empty when
            postprocessing is disabled or no evidence is groundable. Absent on
            results stored before the field existed, so a client can still POST
            /v1/ground for those jobs.
          title: Grounding Job Ids
        population_statement:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The population every figure was computed over — file, period, layer,
            status, basis, grain — in the run's own words. Null only on a run
            that never authored an answer.
          title: Population Statement
        quality:
          anyOf:
            - $ref: '#/components/schemas/JetQuality'
            - type: 'null'
          description: >-
            Structured execution quality: clean vs recovered-with-warnings vs
            degraded, plus the fail-open checks, tool-failure counts, and
            missing audit artifacts that produced that status. JE-testing always
            sets this on a finished run. Other JetResult subclasses (deep
            search) leave it null. Null also on results stored before the field
            existed.
        reasoning:
          anyOf:
            - type: string
            - type: 'null'
          description: How the receipted statements chain together into the answer.
          title: Reasoning
        result_type:
          const: je_testing
          default: je_testing
          title: Result Type
          type: string
        session_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            The conversation this run belongs to. Send it back as the request's
            `session_id` to ask a follow-up in the same thread.
          title: Session Id
        spec_digest:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            A short fingerprint of what this run committed to TEST — the rows,
            grain, clock, encoding, thresholds and time window each criterion
            was pinned to — with the free-text justifications beside those
            choices excluded. Two runs of the same question carry the same value
            when they tested the same thing, so an unstable answer can be told
            apart from an answer to a quietly different question without
            re-reading either run. Null on a run that committed no test spec,
            and on other JetResult subclasses.
          title: Spec Digest
        sql_receipts:
          description: >-
            Every statement the run executed, in execution order — the answer's
            working.
          items:
            $ref: '#/components/schemas/SqlReceipt'
          title: Sql Receipts
          type: array
        steps_used:
          default: 0
          description: >-
            Legacy procedure-step count retained for compatibility. It is
            engine-specific and is not a model-request count; agent runs expose
            completed root-model requests in `agent_usage`. Read it with
            `exhausted`, which says whether the configured request budget ran
            out before the run was satisfied.
          title: Steps Used
          type: integer
        tool_calls:
          description: >-
            One entry per tool the run invoked, in execution order — the tool's
            name, a digest of its arguments, how many results came back, and how
            long it took. The run's shape, not its content.
          items:
            $ref: '#/components/schemas/ToolCallTrace'
          title: Tool Calls
          type: array
        usage:
          anyOf:
            - $ref: '#/components/schemas/SearchLlmUsage'
            - type: 'null'
          description: >-
            What this run spent on LLM calls. Present only when the request
            asked for it; null means nothing was measured, not that nothing was
            spent.
      title: JetResult
      type: object
    ResultState:
      description: >-
        Why ``Job.result`` is null.


        ``available`` with a null result means the job has not succeeded yet;

        ``expired`` means retention dropped it; ``not_retained`` means the
        client is

        provisioned ``zero_retention`` and already had its one chance to read
        it.

        A late poll returns the job with a state, never a 404 — "this expired"
        and

        "this never existed" are a scheduling problem and a bug respectively,
        and a

        404 makes them identical.
      enum:
        - available
        - expired
        - not_retained
      title: ResultState
      type: string
    ParseResultSource:
      additionalProperties: false
      description: >-
        A prior Parse job whose parsed artifact can be reused by downstream
        methods.
      properties:
        job_id:
          description: Succeeded parse job whose artifact should be reused.
          format: uuid
          title: Job Id
          type: string
        type:
          const: parse_result
          default: parse_result
          title: Type
          type: string
      required:
        - job_id
      title: ParseResultSource
      type: object
    UploadSource:
      additionalProperties: false
      description: Bytes staged through ``POST /v1/uploads``. Single-use, TTL-bound.
      properties:
        type:
          const: upload
          default: upload
          title: Type
          type: string
        upload_id:
          description: >-
            Id returned by POST /v1/uploads. Single-use; bytes are deleted after
            the job.
          format: uuid
          title: Upload Id
          type: string
      required:
        - upload_id
      title: UploadSource
      type: object
    UrlSource:
      additionalProperties: false
      description: A public or presigned HTTPS location we fetch server-side.
      properties:
        file_name:
          description: Filename to record for the fetched bytes.
          maxLength: 512
          title: File Name
          type: string
        type:
          const: url
          default: url
          title: Type
          type: string
        url:
          description: HTTPS URL the service fetches.
          maxLength: 2048
          pattern: ^https://
          title: Url
          type: string
      required:
        - url
        - file_name
      title: UrlSource
      type: object
    WorkspaceFileSource:
      additionalProperties: false
      description: >-
        A file already in a workspace.


        The single seam between the two contexts: a granular operation may read
        a

        workspace file and still write nothing back. The file need **not** be

        ingested — granular operations read source bytes, not representations.
      properties:
        file_id:
          description: File id from GET /v1/workspaces/{workspace_id}/files.
          format: uuid
          title: File Id
          type: string
        type:
          const: workspace_file
          default: workspace_file
          title: Type
          type: string
        workspace_id:
          description: Workspace that owns the file.
          format: uuid
          title: Workspace Id
          type: string
      required:
        - workspace_id
        - file_id
      title: WorkspaceFileSource
      type: object
    ndi_service__app__platform_api__contracts__JobStatus:
      description: >-
        ``cancelled`` is a first-class terminal status, not a ``failed``
        variant.


        Conflating them makes error-rate metrics lie and forces every client to

        string-match an error code.
      enum:
        - queued
        - running
        - succeeded
        - failed
        - cancelled
      title: JobStatus
      type: string
    ErrorCode:
      description: |-
        Every error the ``/v1`` surface can return.

        Clients must treat this as an **open** enum: a new member is an additive
        change (spec 12 §9), and a client that crashes on an unknown code makes
        every future error a breaking change.
      enum:
        - invalid_request
        - unsupported_file_type
        - file_too_large
        - invalid_schema
        - invalid_sql
        - invalid_path_prefix
        - command_not_permitted
        - batch_too_large
        - domain_validation_failed
        - default_label_required
        - wait_required_for_zero_retention
        - ledger_decision_invalid
        - workspace_not_found
        - file_not_found
        - job_not_found
        - upload_not_found
        - node_not_found
        - schema_not_found
        - domain_not_found
        - session_not_found
        - access_label_not_found
        - ledger_understanding_not_found
        - ledger_table_not_found
        - path_conflict
        - schema_version_conflict
        - access_label_name_taken
        - workspace_name_taken
        - access_label_in_use
        - upload_expired
        - file_not_ingested
        - workspace_deleting
        - workspace_not_deletable
        - ingestion_in_progress
        - job_not_cancellable
        - confirmation_required
        - domain_not_published
        - domain_in_use
        - reserved_domain_slug
        - kg_not_built
        - kg_build_in_progress
        - ledger_understanding_in_progress
        - session_busy
        - range_not_satisfiable
        - result_expired
        - access_denied
        - access_backstop_violation
        - access_mode_not_implemented
        - rate_limited
        - concurrency_limit_reached
        - quota_exceeded
        - corrupt_file
        - zero_byte_file
        - encrypted_file
        - csv_dialect_ambiguous
        - csv_parse_failed
        - parse_failed
        - ocr_failed
        - conversion_failed
        - sheetless_workbook
        - unplayable_media
        - unclassified_pages
        - job_cancelled
        - job_timeout
        - upstream_unavailable
        - internal_error
        - unauthorized
        - not_implemented
      title: ErrorCode
      type: string
    KnowledgeGraphBuildProgress:
      additionalProperties: false
      description: >-
        Where a ``kg_build`` is, beyond what ``stage`` alone can say.


        A graph build runs for minutes to hours through a fixed sequence of
        phases,

        and ``stage`` names only the current one. Turning that into "how far
        along"

        otherwise means hard-coding the build engine's phase order in every
        client —

        an order that lives in another package and is free to gain a phase. So
        the

        position is reported rather than inferred.


        The counters are deliberately not a percentage. The phases are wildly
        unequal

        (extraction is ~60% of a build, and its per-document cost varies 25x
        with how

        dense the documents are), so weighting them is a presentation decision,
        made

        against measurements, that belongs to whoever is drawing the bar.
      properties:
        countable:
          description: >-
            Whether items_total/items_done describe this phase. False for the
            phases that are a single step, which have no unit to count — draw
            those as indeterminate rather than as a bar stuck at zero.
          title: Countable
          type: boolean
        documents:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Documents registered from the corpus, once the registering phase has
            run.
          title: Documents
        mentions:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Mentions extracted across the corpus, once the validating phase has
            run.
          title: Mentions
        phase_count:
          description: >-
            How many phases a build passes through before it is done. Currently
            9.
          title: Phase Count
          type: integer
        phase_index:
          description: >-
            0-based position of the current phase in the build's fixed run
            order; equals phase_count when done.
          title: Phase Index
          type: integer
        step:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The span in flight inside a single-step phase, reported by the
            running step itself. Null when the phase counts its own units, or
            before the step has reported one.
          title: Step
        step_done:
          anyOf:
            - type: integer
            - type: 'null'
          description: Units of `step` finished, when it has countable units.
          title: Step Done
        step_total:
          anyOf:
            - type: integer
            - type: 'null'
          description: Units `step` has to get through, when that is known.
          title: Step Total
      required:
        - phase_index
        - phase_count
        - countable
      title: KnowledgeGraphBuildProgress
      type: object
    JetAgentUsage:
      additionalProperties: false
      description: >-
        Completed root-agent model requests by session phase.


        This is intentionally separate from :class:`SearchLlmUsage`: that ledger

        covers every nested LLM call and token, while this block explains the
        agent

        procedure itself. Provider transport attempts are not exposed by the
        model

        boundary reliably and are therefore not guessed here.
      properties:
        compaction_requests:
          description: Completed model requests used to summarize compacted history.
          minimum: 0
          title: Compaction Requests
          type: integer
        execution_requests:
          description: Completed model requests in normal execution cycles.
          minimum: 0
          title: Execution Requests
          type: integer
        finalization_requests:
          description: Completed requests in the tool-less recovery finalizer.
          minimum: 0
          title: Finalization Requests
          type: integer
        total_requests:
          description: Sum of execution, compaction, and finalization requests.
          minimum: 0
          title: Total Requests
          type: integer
      required:
        - execution_requests
        - compaction_requests
        - finalization_requests
        - total_requests
      title: JetAgentUsage
      type: object
    LedgerBindingWire:
      additionalProperties: false
      description: >-
        The definitional layer a run committed, echoed for the caller to read.


        This is the answer to "on what definitions does this figure rest" — the

        question the prose relay of the old playbook could not answer, and the
        reason

        the binding is a validated artifact rather than a paragraph. Every pin
        was

        checked against the tables' own profiles before the run was allowed to

        compute anything: the columns exist with compatible types, the period
        roles

        partition the observed domain, each clock's declared grain matches its

        column, and every encoding value occurs in its column.


        Published as flat slot listings rather than as a mirror of the internal

        model's tree. Two reasons, both practical: a reader wants "which column
        is

        the approval clock" answered in one place rather than by walking a
        nested

        object, and a slot the design adds later becomes another row here
        instead of

        a change to this contract.
      properties:
        columns:
          description: Every column pinned to a slot, in slot order.
          items:
            $ref: '#/components/schemas/BoundColumn'
          title: Columns
          type: array
        notes:
          description: Deviations the run observed while orienting.
          items:
            type: string
          title: Notes
          type: array
        periods:
          description: The period domain, in period order, with roles.
          items:
            $ref: '#/components/schemas/BoundPeriod'
          title: Periods
          type: array
        policy_sheets:
          description: >-
            Documents the run treated as settling parameters (a sequence policy,
            a topside register).
          items:
            type: string
          title: Policy Sheets
          type: array
        revised_because:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why the binding was replaced mid-run, when it was. Null on a run
            that bound once.
          title: Revised Because
        tables:
          items:
            $ref: '#/components/schemas/BoundTable'
          title: Tables
          type: array
        value_sets:
          description: >-
            Encoding candidates and layer memberships. More than one entry under
            'encodings.manual' means the run kept both readings and resolved
            them per test.
          items:
            $ref: '#/components/schemas/BoundValueSet'
          title: Value Sets
          type: array
      title: LedgerBindingWire
      type: object
    ConfidenceLevel:
      description: How well the retrieved evidence supports the answer, worst-case wins.
      enum:
        - certain
        - very_high
        - high
        - medium
        - low
        - speculative
      title: ConfidenceLevel
      type: string
    JetCriterionOutcome:
      additionalProperties: false
      description: The final disposition of one requested test.
      properties:
        criterion_id:
          description: >-
            Stable short id for this requested test. Its TestSpec and published
            figure use the same id.
          minLength: 1
          title: Criterion Id
          type: string
        description:
          description: >-
            The requested test in the caller's terms, without an invented
            conclusion.
          minLength: 1
          title: Description
          type: string
        incomplete_reason:
          anyOf:
            - enum:
                - binding_unresolved
                - measurement_failed
                - missing_finding
              type: string
            - type: 'null'
          description: >-
            Machine-readable blocker for an incomplete test. Null for performed
            and cannot-be-performed tests.
          title: Incomplete Reason
        spec_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The committed TestSpec id and matching `figures[].spec_id`. Null
            when setup never reached a spec.
          title: Spec Id
        status:
          description: >-
            Whether the test produced a finding, proved it could not be
            performed, or remained incomplete.
          enum:
            - performed
            - cannot_be_performed
            - incomplete
          title: Status
          type: string
      required:
        - criterion_id
        - description
        - status
      title: JetCriterionOutcome
      type: object
    SearchEvidence:
      additionalProperties: false
      description: >-
        One piece of evidence the search agent cited, named as the caller's own
        file.


        The agent retrieves from workspace-internal ingestion derivatives, but
        those

        are an implementation detail the caller never addresses: every citation
        is

        resolved server-side, through the caller's access gate, to the uploaded
        file

        it belongs to (``source_path`` + ``source_file_id``). A citation that
        cannot be

        resolved to a visible file — hallucinated, deleted mid-run, or
        access-refused —

        is dropped rather than published under a path the caller cannot use.


        No locator: pinning a quote to a region of the original document is a

        separate ``ground`` call the caller makes on the file at ``source_path``

        (``source_file_id``) with ``quote`` as the target text — and, for a
        quote

        taken from a spreadsheet, ``component`` as the target's ``sheet``.
      properties:
        component:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Public component of the file the quote came from — the tab name for
            a spreadsheet, the section for a split document; the same vocabulary
            file-metadata lists. Pass it as the ground target's sheet when
            grounding a spreadsheet quote. None for a single-component file or
            when attribution was unavailable.
          title: Component
        derivation:
          anyOf:
            - $ref: '#/components/schemas/DerivationTrace'
            - type: 'null'
          description: >-
            Computation DAG for derived answers; None when the evidence is a
            direct extraction or the run recorded no dependency edges.
        page:
          anyOf:
            - type: integer
            - type: 'null'
          description: 1-based page number, when the agent saw one.
          title: Page
        queries:
          description: >-
            The SQL the run executed over this evidence's table, with a bounded
            preview of each result — server-recorded from the run's tables
            engine, never model-authored. Attached whenever the run queried the
            cited table (or the row extraction of the same spreadsheet tab), so
            a verbatim quote from a queried sheet carries the computation trail
            alongside it; empty when the run never queried the cited file's
            tables.
          items:
            $ref: '#/components/schemas/TableQueryGrounding'
          title: Queries
          type: array
        quote:
          description: The key passage, as retrieved from the file.
          title: Quote
          type: string
        relevance:
          description: The agent's one-sentence account of how this supports the query.
          title: Relevance
          type: string
        source_file_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            The id of the file at source_path, resolved server-side. Always set
            on newly finalized results; null only on results stored before
            unresolvable citations were dropped.
          title: Source File Id
        source_path:
          description: >-
            The uploaded file the quote belongs to, e.g. 'reports/policy.pdf'.
            This is the file to ground the quote against.
          title: Source Path
          type: string
      required:
        - source_path
        - quote
        - relevance
      title: SearchEvidence
      type: object
    JetFigure:
      additionalProperties: false
      description: >-
        One criterion the run tested, and the statements its figures come from.


        The answer's structure on the wire. ``JetResult.answer`` is prose a
        person

        reads; this is the same content a reviewer can *check*: the definition
        the

        figure was computed under, the population it was computed over, the spec
        that

        pinned both, and the ``sql_receipts`` entries the figures are readable
        out of.


        Every ``result_id`` here names a receipt on the same result, so a reader

        follows a figure to its statement and its rows without leaving the
        payload.

        ``exception_listing_result_id`` is the one worth opening: an unfiltered
        count

        grounds correctly but points at every row, while an exception listing
        points

        at the rows that failed.
      properties:
        band_group:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Set when this figure is one band of a family that partitions a
            population — the same name on every band of the family, whose counts
            sum to that population.
          title: Band Group
        breakdown:
          anyOf:
            - $ref: '#/components/schemas/JetBreakdown'
            - type: 'null'
          description: >-
            The tabular result behind this figure, attached by the server from
            the receipt it cites — the exception listing where there is one,
            otherwise the single cited statement that returned more than one
            row. Null when no cited statement holds a table, and on a criterion
            that could not be performed.
        cannot_be_performed:
          default: false
          description: >-
            The workspace does not hold the material this criterion needs.
            `result_ids` then name the probes that establish the absence rather
            than the figures.
          title: Cannot Be Performed
          type: boolean
        count:
          description: Members of the population that met the criterion.
          minimum: 0
          title: Count
          type: integer
        criterion:
          description: What was tested, in the caller's terms.
          title: Criterion
          type: string
        definition:
          description: >-
            The definition it was tested under: which column and values encoded
            the term, which clock, which basis, which threshold and where it
            came from.
          title: Definition
          type: string
        exception_listing_result_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The receipt that lists the exceptions themselves, when one was
            produced.
          title: Exception Listing Result Id
        population:
          description: >-
            The denominator — rows at this test's grain that the criterion ran
            over.
          minimum: 0
          title: Population
          type: integer
        result_ids:
          description: >-
            `sql_receipts[].result_id` of every statement this figure is
            readable out of.
          items:
            type: string
          title: Result Ids
          type: array
        spec_id:
          description: The run's committed TestSpec this figure was computed under.
          title: Spec Id
          type: string
        value:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The exceptions' value as text, so a decimal survives the wire. Null
            for a count-only criterion.
          title: Value
      required:
        - criterion
        - definition
        - spec_id
        - population
        - count
      title: JetFigure
      type: object
    JetQuality:
      additionalProperties: false
      description: >-
        Structured execution-quality reporting for one JE-testing result.


        Distinguishes a clean, fully evidenced success from a recovered or
        partially

        validated one without changing ``ok`` or inventing figures. Contains
        only

        check names, tool names, outcome categories, and counts — never prompts,

        answers, evidence bodies, shell output, or client identifiers.
      properties:
        missing_artifacts:
          description: >-
            Required audit artifact classes absent from a quantitative result
            (``binding`` and/or ``sql_receipts``). Empty when every finding is
            ``cannot_be_performed`` or when both artifacts are present.
          items:
            enum:
              - binding
              - sql_receipts
            type: string
          title: Missing Artifacts
          type: array
        retried_checks:
          description: >-
            Output-contract check families that cost the answer a model
            re-emission, whether or not the re-emission repaired them.
            Attribution only — a retry the model then satisfied is a clean
            answer, so this does not move ``status``.
          items:
            enum:
              - specs
              - scope
              - cycle
              - grain
              - basis
              - absence
              - bands
              - pointer
              - delivery
              - figures
            type: string
          title: Retried Checks
          type: array
        status:
          description: >-
            ``clean`` when nothing was recovered; ``recovered_with_warnings``
            when a fail-open check, tool failure, or missing audit artifact was
            recorded; ``degraded`` when the run salvaged working after a hard
            failure (see ``JetResult.degraded``).
          enum:
            - clean
            - recovered_with_warnings
            - degraded
          title: Status
          type: string
        tool_failures:
          description: >-
            Non-success tool outcomes the agent recovered from, aggregated by
            tool and category.
          items:
            $ref: '#/components/schemas/JetToolFailure'
          title: Tool Failures
          type: array
        validation_warnings:
          description: >-
            Fail-open output checks that passed the answer through after their
            corrective retry.
          items:
            $ref: '#/components/schemas/JetValidationWarning'
          title: Validation Warnings
          type: array
        withheld_receipt_figures:
          default: 0
          description: >-
            How many performed figures were published with no readable receipt
            id — either the statements behind them are not visible to this
            caller, or the figure was computed without one. The figures
            themselves are still returned; this counts the ones whose working
            cannot be inspected.
          minimum: 0
          title: Withheld Receipt Figures
          type: integer
      required:
        - status
      title: JetQuality
      type: object
    SqlReceipt:
      additionalProperties: false
      description: >-
        One SQL statement a journal-entry-testing run executed, with its result.


        The audit trail of a JET answer: every headline figure is meant to be

        readable out of one of these. Unlike

        :class:`TableQueryGrounding` — whose SQL is written by a sub-agent and

        published as supporting detail — the statement here is the deliverable's

        own working, so it is published whole rather than digested.


        ``rows`` is bounded (``JET_RECEIPT_MAX_ROWS``) and ``truncated`` says

        whether the bound cut anything, so an "every exception is listed"
        reading

        is never made from a silently capped table. ``result_row_count`` is the

        figure that reading actually needs: the statement's whole result is
        stored,

        and this is its size, whatever the bound carried below.
      properties:
        columns:
          description: Result column names, in result order.
          items:
            type: string
          title: Columns
          type: array
        executor:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The named executor that generated this statement
            (`reconcile_movement`, `test_timing`, `find_duplicates`), when one
            did, or `custom_sql` for a statement the fixed-pipeline engine
            authored under its escape. Null when no named generator produced it
            — a population count, an absence probe, or SQL the agent wrote
            itself. Both engines use the same words here.
          title: Executor
        grounding_status:
          anyOf:
            - enum:
                - exact
                - unavailable
                - zero_result
              type: string
            - type: 'null'
          description: >-
            Whether this statement's stored result already carried proof of
            which source rows it read when the receipt was recorded. 'exact'
            means it did; 'unavailable' means the proof could not be read;
            'zero_result' means there were no rows to ground. Null when nothing
            had been captured yet — the ordinary case for a lane that captures
            at publication time, so this is a record of what execution happened
            to know and NOT a prediction of whether the receipt can be grounded.
            What was actually proven is published as `grounding_status` on the
            matching evidence query, beside the `regions` it earned.
          title: Grounding Status
        handle:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Content-addressed key of this statement's stored result, derived
            from the statement text. Server-side identity: it is what lets the
            run's own publication find the stored result and its capture-time
            provenance, and it is NOT an address an agent may query or chain
            from — `result_id` is the identity the caller and the row pager use.
            Null on a run that stored no result for the statement.
          title: Handle
        parameters:
          additionalProperties:
            type: string
          description: >-
            The executor's resolved call, flattened to text — the clock and its
            true grain, the window's day offsets, the signature, the tolerance,
            the population. Empty on a statement no executor generated. This is
            what makes a figure trace to a named, parameterized computation
            rather than to SQL alone.
          title: Parameters
          type: object
        replay:
          anyOf:
            - $ref: '#/components/schemas/SqlReplayReceipt'
            - type: 'null'
          description: >-
            Independent recomputation metadata for this statement; null on
            legacy results.
        result_id:
          description: >-
            Stable per-run identity of this statement, in execution order (e.g.
            'sql_3').
          title: Result Id
          type: string
        result_row_count:
          default: 0
          description: >-
            Rows in the statement's complete stored result. Equal to `row_count`
            when nothing was cut; the number a total or an exception count must
            be read from when `truncated` is set.
          title: Result Row Count
          type: integer
        row_count:
          default: 0
          description: Rows carried below — not the statement's unbounded result size.
          title: Row Count
          type: integer
        rows:
          description: >-
            Result rows, values rendered as text so a decimal, a date and a NULL
            all survive the wire.
          items:
            additionalProperties:
              type: string
            type: object
          title: Rows
          type: array
        saved_as:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The session view this statement was registered as, when it was.
            Every name in another receipt's ``views_used`` appears here on
            exactly one receipt, so the run's receipts define every view they
            cite.
          title: Saved As
        sql:
          description: The statement as executed, verbatim.
          title: Sql
          type: string
        table_bindings:
          description: >-
            The tables this statement registered, each with the view name it was
            referenced by.
          items:
            $ref: '#/components/schemas/SqlTableBinding'
          title: Table Bindings
          type: array
        truncated:
          default: false
          description: Whether rows past the stored cap were cut from this receipt.
          title: Truncated
          type: boolean
        view_sql:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The definition registered under `saved_as`, when it is not this
            statement itself. Null on an ordinary `save_as`, where `sql` IS the
            definition. Set by `build_journal_view`, which registers the
            per-journal frame and runs a bounded probe over it rather than
            materializing the whole frame — so the definition every later
            `views_used` refers to is still published by exactly one receipt.
          title: View Sql
        views_used:
          description: >-
            Session views registered when this statement ran, in definition
            order — the registry snapshot it executed under. A statement naming
            a view is replayable only against these, which is what makes named
            views admissible where chaining a previous call's result handle is
            not.
          items:
            type: string
          title: Views Used
          type: array
        warnings:
          description: >-
            Pre-execution lint notes attached to this statement — non-blocking,
            and published as part of its working.
          items:
            type: string
          title: Warnings
          type: array
      required:
        - result_id
        - sql
      title: SqlReceipt
      type: object
    ToolCallTrace:
      additionalProperties: false
      description: >-
        Carries an argument digest rather than raw arguments.


        Raw arguments would be a side channel around ``Coverage``: a caller
        could

        read back what the loop searched for on its behalf.
      properties:
        arguments_digest:
          title: Arguments Digest
          type: string
        duration_ms:
          title: Duration Ms
          type: integer
        hits:
          title: Hits
          type: integer
        tool:
          title: Tool
          type: string
      required:
        - tool
        - arguments_digest
        - hits
        - duration_ms
      title: ToolCallTrace
      type: object
    SearchLlmUsage:
      additionalProperties: false
      description: >-
        What answering one search query cost in LLM work.


        Present only when the run was asked to account for itself *and* spend
        reached its

        ledger; ``null`` otherwise, so a caller can tell "nothing was measured"
        from

        "nothing was spent". An empty ledger publishes ``null`` rather than a
        zeroed

        object for that reason: zeros would claim a measured run cost nothing,
        when what

        an empty ledger most likely records is accounting that never landed.


        The totals cover **every** LLM call the run made, at any depth: the
        agent's own

        turns, and the calls the retrieval tools made on its behalf — a document
        read by

        the recursive-LLM engine, a scan cracked by the vision engine, a tables
        question

        answered by the SQL agent. That is the number a per-query cost figure
        needs, and it

        is invariably several times the agent's own turn count.


        ``by_model`` is the same spend split by the model that served it,
        because a run

        legitimately spends on several at different prices — a total alone
        cannot be turned

        into money. The totals are the sum of ``by_model`` and are published
        anyway so the

        common case needs no arithmetic.


        Retried work is included: a provider timeout that cost tokens before
        failing was

        still paid for, and a cost figure that hid it would understate exactly
        the runs

        worth looking at.
      properties:
        by_model:
          description: The same spend per model that served it, highest first.
          items:
            $ref: '#/components/schemas/ModelLlmUsage'
          title: By Model
          type: array
        cached_input_tokens:
          default: 0
          description: >-
            The share of input_tokens served from a provider prompt cache —
            billed at a reduced rate, so it is reported separately rather than
            subtracted.
          title: Cached Input Tokens
          type: integer
        input_tokens:
          default: 0
          description: Prompt tokens across every request, cached ones included.
          title: Input Tokens
          type: integer
        output_tokens:
          default: 0
          description: Completion tokens across every request.
          title: Output Tokens
          type: integer
        requests:
          default: 0
          description: Completed LLM requests, tool-internal ones included.
          title: Requests
          type: integer
      title: SearchLlmUsage
      type: object
    BoundColumn:
      additionalProperties: false
      description: One column the run pinned to a definitional slot.
      properties:
        column:
          title: Column
          type: string
        component:
          anyOf:
            - type: string
            - type: 'null'
          title: Component
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            What the slot additionally states about this column — a clock's true
            grain, that a basis is the one the trial balance ties to, what a
            calendar date means.
          title: Detail
        path:
          title: Path
          type: string
        slot:
          description: >-
            The slot this column fills, dotted: 'journal_key', 'clocks.created',
            'amount_bases[reporting].debit', 'accounts.fsli'.
          title: Slot
          type: string
        table_name:
          title: Table Name
          type: string
      required:
        - slot
        - path
        - table_name
        - column
      title: BoundColumn
      type: object
    BoundPeriod:
      additionalProperties: false
      description: >-
        One value of the period axis and the role the run gave it, in period
        order.
      properties:
        role:
          description: '''opening'', ''month'', ''year_end_adj'' or ''total_row''.'
          title: Role
          type: string
        value:
          title: Value
          type: string
      required:
        - value
        - role
      title: BoundPeriod
      type: object
    BoundTable:
      additionalProperties: false
      description: One table of the package, and the role the run bound it to.
      properties:
        component:
          anyOf:
            - type: string
            - type: 'null'
          description: The tab, when the file contributed more than one table.
          title: Component
        path:
          description: The uploaded file, e.g. 'ledger/journal.xlsx'.
          title: Path
          type: string
        role:
          description: >-
            The slot it fills: 'journal_lines', 'journal_headers',
            'trial_balance', ….
          title: Role
          type: string
        table_name:
          description: The view name this run's SQL referenced it by.
          title: Table Name
          type: string
      required:
        - role
        - path
        - table_name
      title: BoundTable
      type: object
    BoundValueSet:
      additionalProperties: false
      description: >-
        One column-and-values pin: an encoding candidate, or a layer's
        membership.


        Named even when its slot carries only one, because the name is what a
        test

        cites when a slot carries two — which is a state this binding may
        legitimately

        be in. Two candidates of ``encodings.manual`` published here means the
        run

        kept both readings of "manual" alive and chose between them per test,
        which is

        what the answer's own working will say.
      properties:
        column:
          title: Column
          type: string
        component:
          anyOf:
            - type: string
            - type: 'null'
          title: Component
        name:
          description: The candidate's name, as a test spec cites it.
          title: Name
          type: string
        note:
          default: ''
          description: >-
            Where this reading came from — a policy sheet, a flag column, a
            profiled domain.
          title: Note
          type: string
        path:
          title: Path
          type: string
        slot:
          description: '''encodings.posted'', ''encodings.manual'', ''layers.book'', ….'
          title: Slot
          type: string
        table_name:
          title: Table Name
          type: string
        values:
          description: The values of that column which mean this.
          items:
            type: string
          title: Values
          type: array
      required:
        - slot
        - name
        - path
        - table_name
        - column
      title: BoundValueSet
      type: object
    DerivationTrace:
      additionalProperties: false
      description: >-
        The answer's computation DAG when evidence is derived rather than
        extracted.
      properties:
        steps:
          items:
            $ref: '#/components/schemas/DerivationStep'
          title: Steps
          type: array
      title: DerivationTrace
      type: object
    TableQueryGrounding:
      additionalProperties: false
      description: >-
        One SQL query executed against the caller's tables while answering.


        The grounding behind a computed evidence: when the agent answers a

        count/sum/join question it runs a SQL agent over the uploaded tables,
        and

        this is the receipt — the query text and a bounded preview of what it

        returned. Attached to the evidence it grounds rather than published

        globally, so a computed figure and its computation travel together.


        ``source_paths`` name uploaded files, resolved server-side through the

        caller's access gate exactly like ``source_path`` on the evidence
        itself.
      properties:
        columns:
          items:
            $ref: '#/components/schemas/TableQueryColumn'
          title: Columns
          type: array
        grounding_reason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Qualification on grounding_status, when present. Set for
            'unavailable' (explains why proof was not possible) and for 'exact'
            when capture succeeded but the source regions are broader than the
            minimal contributing set (e.g.
            'regions_broad:narrowing_specs_unavailable'). None when grounding is
            fully exact or absent.
          title: Grounding Reason
        grounding_status:
          anyOf:
            - enum:
                - exact
                - unavailable
                - zero_result
              type: string
            - type: 'null'
          description: >-
            Capture-time provenance status behind this query's regions. 'exact':
            the exact-provenance sidecar proved every row the query read, so its
            'provenance'-basis regions are trustworthy (source regions may be
            broader than the minimal contributing set when grounding_reason
            carries a 'regions_broad:…' qualifier). 'unavailable': no exact
            proof could be captured (a legacy result, or a statement shape the
            capturer cannot instrument) — no 'provenance'-basis regions are
            attached, never a guessed whole-table span. 'zero_result': the query
            matched no rows, so there is nothing to ground. None on legacy
            payloads and on a query with no unclaimed table left to ground.
          title: Grounding Status
        preview_truncated:
          default: false
          description: Whether the preview cut rows or columns.
          title: Preview Truncated
          type: boolean
        regions:
          description: >-
            Original-file coordinates for the verified claims whose source file
            has an addressable grid.
          items:
            discriminator:
              mapping:
                row_range:
                  $ref: '#/components/schemas/RowRangeQueryRegion'
                sheet:
                  $ref: '#/components/schemas/SheetQueryRegion'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/SheetQueryRegion'
              - $ref: '#/components/schemas/RowRangeQueryRegion'
          title: Regions
          type: array
        result_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Stable identity of the stored query result behind this receipt. Lets
            the grounding-rows endpoint replay this exact query for matched-row
            pages beyond the regions' inline runs.
          title: Result Id
        row_count:
          default: 0
          description: Rows in the query's full result, not in the preview below.
          title: Row Count
          type: integer
        rows:
          description: >-
            Leading result rows, values rendered as text — a bounded preview,
            never the full result.
          items:
            additionalProperties:
              type: string
            type: object
          title: Rows
          type: array
        source_paths:
          description: >-
            The uploaded table files this query read — directly, or through a
            prior result it built on — e.g. 'planning/FS GF Custom.xlsx'.
          items:
            type: string
          title: Source Paths
          type: array
        sql:
          title: Sql
          type: string
        supports_answer:
          default: true
          description: >-
            False for exploratory SQL the tables engine ran but did not mark as
            part of the answer's calculation trail.
          title: Supports Answer
          type: boolean
        verified:
          default: false
          description: >-
            True when at least one claim behind this query passed mechanical
            verification against the source data. Independent of 'regions': a
            source without an addressable grid verifies but cannot be pointed
            at, so an empty 'regions' never means unverified.
          title: Verified
          type: boolean
      required:
        - sql
      title: TableQueryGrounding
      type: object
    JetBreakdown:
      additionalProperties: false
      description: >-
        The tabular result behind one figure, attached by the server.


        What a caller asking "by FSLI and month" or "top 10 preparers" wanted,
        in the

        shape the question implies. The rows are NOT model-authored and never
        were:

        they are the cited receipt's own result, stringified and capped here,
        attached

        at finalize from :class:`SqlReceipt` rows the run already published.
        That is

        the whole design — a figure's table costs the model no output tokens and

        cannot carry a cell no statement returned — and it is why there is no

        reshaping either: the receipt's shape IS the breakdown, so a matrix the
        SQL

        never grouped by month is a wrong statement rather than a rendering
        problem.


        ``result_id`` names the receipt the rows came from, which is always one
        of the

        figure's own citations — either on ``result_ids`` or its
        ``exception_listing_result_id``,

        the two id sets the console makes openable — so the breakdown is a
        convenience

        over the payload's own working, never a second source of truth, and a
        reader who

        wants the statement, the whole bounded result or its row provenance
        follows that

        id. (When the model names a listing it did not also list in
        ``receipt_ids``, that

        id reaches the figure through ``exception_listing_result_id`` rather
        than

        ``result_ids``; both render as receipt buttons, so the table stays one
        click away

        either way.)
      properties:
        columns:
          description: Column names, in the statement's own result order.
          items:
            type: string
          title: Columns
          type: array
        result_id:
          description: '`sql_receipts[].result_id` of the statement these rows are.'
          title: Result Id
          type: string
        rows:
          description: >-
            Rows in receipt order, cells as text so a decimal, a date and a NULL
            all survive the wire. At most 200; a longer result sets `truncated`
            and stays whole on its receipt.
          items:
            items:
              type: string
            type: array
          title: Rows
          type: array
        truncated:
          default: false
          description: >-
            Whether rows were cut — either by this table's own cap or already on
            the receipt it came from. A capped breakdown is never read as the
            complete listing.
          title: Truncated
          type: boolean
      required:
        - result_id
      title: JetBreakdown
      type: object
    JetToolFailure:
      additionalProperties: false
      description: How many times one tool returned a non-success outcome this run.
      properties:
        count:
          description: How many times this tool×outcome pair occurred in the run.
          minimum: 1
          title: Count
          type: integer
        outcome:
          description: >-
            Category of the non-success: ``model_retry`` (policy / repairable
            retry), ``command_error`` (non-zero shell exit), ``timeout``, or
            ``tool_error`` (in-body refusal / SQL error).
          enum:
            - model_retry
            - command_error
            - timeout
            - tool_error
          title: Outcome
          type: string
        tool:
          description: >-
            Tool name that produced the non-success outcome (for example
            ``run_command``).
          title: Tool
          type: string
      required:
        - tool
        - outcome
        - count
      title: JetToolFailure
      type: object
    JetValidationWarning:
      additionalProperties: false
      description: One output-contract check that failed open after its corrective retry.
      properties:
        check:
          description: >-
            Stable machine-readable name of the fail-open check that was not
            satisfied.
          enum:
            - specs
            - scope
            - cycle
            - grain
            - basis
            - absence
            - bands
            - pointer
            - delivery
            - figures
          title: Check
          type: string
        status:
          const: failed_open
          default: failed_open
          description: >-
            Always ``failed_open``: the check rejected the answer once, then
            passed it through.
          title: Status
          type: string
      required:
        - check
      title: JetValidationWarning
      type: object
    SqlReplayReceipt:
      additionalProperties: false
      description: >-
        Immutable inputs and engine identity for independent result
        recomputation.
      properties:
        catalog_sha256:
          description: >-
            SHA-256 identity of the ordered source bindings used by this
            statement.
          pattern: ^[0-9a-f]{64}$
          title: Catalog Sha256
          type: string
        engine:
          const: duckdb
          description: The query engine that executed the statement.
          title: Engine
          type: string
        engine_threads:
          description: DuckDB thread count used for this execution.
          exclusiveMinimum: 0
          title: Engine Threads
          type: integer
        engine_version:
          description: The query-engine version that executed the statement.
          title: Engine Version
          type: string
        kind:
          description: The verification lane appropriate for this statement.
          enum:
            - aggregate
            - rowset
          title: Kind
          type: string
        logical_plan_sha256:
          description: >-
            SHA-256 identity of the parser tree after source-position fields are
            removed.
          pattern: ^[0-9a-f]{64}$
          title: Logical Plan Sha256
          type: string
        normalized_sql:
          description: >-
            The normalized single SELECT statement to execute during independent
            replay.
          title: Normalized Sql
          type: string
        result_artifact_sha256:
          description: >-
            SHA-256 identity of the complete retained result Parquet produced by
            the service.
          pattern: ^[0-9a-f]{64}$
          title: Result Artifact Sha256
          type: string
        result_data_sha256:
          description: SHA-256 identity of the complete typed result rows.
          pattern: ^[0-9a-f]{64}$
          title: Result Data Sha256
          type: string
        result_dependencies:
          description: >-
            Earlier retained result handles read by this statement, in
            deterministic order.
          items:
            type: string
          title: Result Dependencies
          type: array
        result_digest_version:
          description: >-
            Versioned Arrow serialization scheme used for the typed-result
            identity.
          title: Result Digest Version
          type: string
        schema_version:
          const: 1
          default: 1
          title: Schema Version
          type: integer
        sql_sha256:
          description: SHA-256 identity of the normalized statement.
          pattern: ^[0-9a-f]{64}$
          title: Sql Sha256
          type: string
      required:
        - kind
        - engine
        - engine_version
        - engine_threads
        - normalized_sql
        - sql_sha256
        - logical_plan_sha256
        - catalog_sha256
        - result_artifact_sha256
        - result_data_sha256
        - result_digest_version
      title: SqlReplayReceipt
      type: object
    SqlTableBinding:
      additionalProperties: false
      description: >-
        One table a receipted statement registered, in both namespaces at once.


        ``path`` (plus ``component`` for one tab of a workbook) is the caller's
        own

        uploaded file; ``table_name`` is the view name the statement referenced
        it

        by. Both halves are load-bearing: view names are settled per run, so SQL

        that hardcodes one is only replayable alongside the mapping that
        produced

        it — a statement published without its bindings cannot be re-run.
      properties:
        component:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The source worksheet, including when selected alone. Null for a
            direct upload or a historical unnamed tab.
          title: Component
        path:
          description: The uploaded table file this view read, e.g. 'ledger/journal.xlsx'.
          title: Path
          type: string
        source_sha256:
          anyOf:
            - pattern: ^[0-9a-f]{64}$
              type: string
            - type: 'null'
          description: >-
            SHA-256 identity of the ingested source generation behind this table
            binding.
          title: Source Sha256
        table_name:
          description: The view name the SQL referenced this table by, for THIS run.
          title: Table Name
          type: string
      required:
        - path
        - table_name
      title: SqlTableBinding
      type: object
    ModelLlmUsage:
      description: >-
        One model's share of a run's LLM spend.


        Per model rather than per run alone because a single run legitimately
        spends

        on several: a search agent's own turns, the vision engine that cracked a

        scan, the sub-model an RLM read used. They are priced differently, so a

        total without this breakdown cannot be turned into money.
      properties:
        cached_input_tokens:
          default: 0
          description: >-
            The share of input_tokens served from the provider's prompt cache —
            billed at a reduced rate, so pricing needs it separated out rather
            than subtracted.
          title: Cached Input Tokens
          type: integer
        input_tokens:
          default: 0
          description: Prompt tokens sent to this model, cached ones included.
          title: Input Tokens
          type: integer
        model:
          description: >-
            Model identifier as the provider reported it, or as the caller asked
            for it.
          title: Model
          type: string
        output_tokens:
          default: 0
          description: Completion tokens this model generated.
          title: Output Tokens
          type: integer
        requests:
          default: 0
          description: Completed LLM requests served by this model.
          title: Requests
          type: integer
      required:
        - model
      title: ModelLlmUsage
      type: object
    DerivationStep:
      additionalProperties: false
      description: One SQL step in a table-QA derivation DAG.
      properties:
        kind:
          enum:
            - extraction
            - transformation
          title: Kind
          type: string
        label:
          title: Label
          type: string
        preview_rows:
          items:
            additionalProperties:
              type: string
            type: object
          title: Preview Rows
          type: array
        reads:
          description: result_ids this step depends on.
          items:
            type: string
          title: Reads
          type: array
        result_id:
          title: Result Id
          type: string
        sql:
          title: Sql
          type: string
      required:
        - result_id
        - sql
        - kind
        - label
      title: DerivationStep
      type: object
    TableQueryColumn:
      additionalProperties: false
      description: One column of an executed SQL query's result preview.
      properties:
        data_type:
          title: Data Type
          type: string
        name:
          title: Name
          type: string
      required:
        - name
        - data_type
      title: TableQueryColumn
      type: object
    RowRangeQueryRegion:
      additionalProperties: false
      description: >-
        A verified region on a pageable tabular artifact, addressed by row
        number.


        A parquet upload stored as-is uses its own row order. A jsonl or parquet

        derivative uses the queried artifact's row order; ``derivative_path``
        names

        that artifact when it differs from the caller-facing ``source_path``.
      properties:
        basis:
          default: verified
          description: >-
            How this region was established. 'verified': a claim whose cited
            value was mechanically re-computed from exactly these rows.
            'inputs': one table's contribution to a derived (multi-table) figure
            — the rows were verified to match the claim's filters, but the
            figure itself is not re-computable from this table alone.
            'provenance': no claim covered this query, so the region records
            what the query's captured provenance proved it read — never a
            whole-table guess. Absent on legacy payloads, which are all
            'verified'.
          enum:
            - verified
            - inputs
            - provenance
          title: Basis
          type: string
        bounding:
          default: false
          description: >-
            True when this is a bounding range over a large match set rather
            than exact runs.
          title: Bounding
          type: boolean
        columns:
          description: Cited column names, in table order.
          items:
            type: string
          title: Columns
          type: array
        derivative_path:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Pageable derivative (parquet or jsonl) when it is not the uploaded
            source itself.
          title: Derivative Path
        end_row:
          description: Last row of the run, 0-based and inclusive.
          title: End Row
          type: integer
        filter_columns:
          description: >-
            Columns the verified claim filtered on to select these rows, minus
            any already in columns. Empty on legacy payloads.
          items:
            type: string
          title: Filter Columns
          type: array
        kind:
          const: row_range
          default: row_range
          title: Kind
          type: string
        matched_rows:
          default: 0
          description: How many source rows the region covers.
          title: Matched Rows
          type: integer
        read_columns:
          description: >-
            Columns the query read from this table (output lineage), minus any
            already in columns or filter_columns. Populated on a
            'provenance'-basis region only; empty otherwise and on legacy
            payloads.
          items:
            type: string
          title: Read Columns
          type: array
        region_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Opaque identity for paging this exact region when a receipt has
            several regions on one file.
          title: Region Id
        runs:
          description: >-
            Exact matched-row runs inside the span, so a bounding range stays
            pageable as matches only. May cover fewer than matched_rows when the
            verifier truncated its run list; empty on legacy payloads.
          items:
            $ref: '#/components/schemas/ArtifactRowRun'
          title: Runs
          type: array
        runs_replayable:
          default: false
          description: >-
            True only when grounding-rows can reconstruct this exact region
            predicate for pages beyond runs. Regions without a safe replay fail
            closed instead of returning broader rows.
          title: Runs Replayable
          type: boolean
        runs_truncated:
          default: false
          description: >-
            True when runs is an exact ordered prefix of matched islands and
            more matched rows exist. Later pages require guarded replay; false
            when the runs are complete or on legacy payloads.
          title: Runs Truncated
          type: boolean
        scan_index:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Which scan of the query read these rows, when the region records one
            scan rather than the whole table. A query can read one file more
            than once — a narrow CTE and a broad one, say — and each such scan
            grounds separately, so this identifies the scan to replay for
            further row pages. Absent on a whole-table span, on verified
            regions, and on legacy payloads.
          title: Scan Index
        scan_label:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The scan named the way the query spells it: 'main query', 'CTE
            <name>', or 'subquery <n>'. Present exactly when scan_index is.
          title: Scan Label
        source_path:
          description: Uploaded file path this region belongs to.
          title: Source Path
          type: string
        start_row:
          description: First row of the run, 0-based and inclusive.
          title: Start Row
          type: integer
      required:
        - source_path
        - start_row
        - end_row
      title: RowRangeQueryRegion
      type: object
    SheetQueryRegion:
      additionalProperties: false
      description: >-
        A verified region on a source file with an addressable grid.


        Coordinates are expressed in the caller's uploaded workbook or CSV,
        never

        in the internal parquet derivative.
      properties:
        a1_range:
          description: A1 range on the original sheet, e.g. 'B12:D15'.
          title: A1 Range
          type: string
        basis:
          default: verified
          description: >-
            How this region was established. 'verified': a claim whose cited
            value was mechanically re-computed from exactly these rows.
            'inputs': one table's contribution to a derived (multi-table) figure
            — the rows were verified to match the claim's filters, but the
            figure itself is not re-computable from this table alone.
            'provenance': no claim covered this query, so the region records
            what the query's captured provenance proved it read — never a
            whole-table guess. Absent on legacy payloads, which are all
            'verified'.
          enum:
            - verified
            - inputs
            - provenance
          title: Basis
          type: string
        bounding:
          default: false
          description: >-
            True when this is a bounding box over a large match set rather than
            exact runs.
          title: Bounding
          type: boolean
        kind:
          const: sheet
          default: sheet
          title: Kind
          type: string
        matched_rows:
          default: 0
          description: How many source rows the region covers.
          title: Matched Rows
          type: integer
        scan_index:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Which scan of the query read these rows, when the region records one
            scan rather than the whole table. A query can read one file more
            than once — a narrow CTE and a broad one, say — and each such scan
            grounds separately, so this identifies the scan to replay for
            further row pages. Absent on a whole-table span, on verified
            regions, and on legacy payloads.
          title: Scan Index
        scan_label:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The scan named the way the query spells it: 'main query', 'CTE
            <name>', or 'subquery <n>'. Present exactly when scan_index is.
          title: Scan Label
        sheet_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Workbook tab, when applicable.
          title: Sheet Name
        source_path:
          description: Uploaded file path this region points at.
          title: Source Path
          type: string
      required:
        - source_path
        - a1_range
      title: SheetQueryRegion
      type: object
    ArtifactRowRun:
      additionalProperties: false
      description: One inclusive 0-based run of matched rows in the pageable artifact.
      properties:
        end:
          description: Last matched row of the run, 0-based and inclusive.
          title: End
          type: integer
        start:
          description: First matched row of the run, 0-based and inclusive.
          title: Start
          type: integer
      required:
        - start
        - end
      title: ArtifactRowRun
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey

````