openapi: 3.0.3
info:
  title: Gordics Orchestration Engine API
  description: The machine-to-machine interface to compile intent into blueprints and dispatch deterministic Work Orders.
  version: 1.0.0
servers:
  - url: https://api.gordics.com/v1
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /directives:
    post:
      summary: Initiate a Directive
      description: Ingests raw unstructured human intent to declare a new top-down strategic macro-objective.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - organization_id
                - fleet_id
                - objective
              properties:
                organization_id:
                  type: string
                  format: uuid
                  description: UUID of the corporate tenant Organization.
                fleet_id:
                  type: string
                  description: Identifier of the target code Fleet (e.g. core-api-v2).
                objective:
                  type: string
                  description: Raw human objective description.
      responses:
        '201':
          description: Directive successfully registered.
          content:
            application/json:
              schema:
                type: object
                properties:
                  directive_id:
                    type: string
                    format: uuid
                  status:
                    type: string
                    example: "INTERROGATION"

  /blueprints/{directive_id}:
    get:
      summary: Retrieve Compiled System Blueprint
      description: Fetches the compiled, mathematically validated architectural map.
      parameters:
        - name: directive_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Compiled blueprint.
          content:
            application/json:
              schema:
                type: object
                properties:
                  blueprint_hash:
                    type: string
                    example: "sha256:d57b1657d02012b1897d268a8a4f9d2a6a8b7c7d8e9f0a1b2c3d4e5f6g7h8i9j"
                  strict_typed_payload:
                    type: object
                  compilation_status:
                    type: string
                    example: "DISPATCHED"

  /work-orders:
    post:
      summary: Dispatch an Atomic Work Order
      description: Routes a deterministic execution payload to a Fleet's Ephemeral Worker sandbox.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - work_order_id
                - fleet_id
                - blueprint_hash
                - payload
              properties:
                work_order_id:
                  type: string
                  format: uuid
                  description: UUID of the Work Order.
                fleet_id:
                  type: string
                  description: The target code Fleet.
                blueprint_hash:
                  type: string
                  description: SHA256 hash of the governing blueprint.
                payload:
                  type: object
                  required:
                    - command
                    - target_files
                    - constraints
                  properties:
                    command:
                      type: string
                      description: Precise bash command or script invocation payload.
                    target_files:
                      type: array
                      items:
                        type: string
                      description: Files to be created or edited by the worker node.
                    constraints:
                      type: array
                      items:
                        type: string
                      description: Strict architectural parameters that must not be violated.
      responses:
        '202':
          description: Work Order queued for isolated worker execution.
          content:
            application/json:
              schema:
                type: object
                properties:
                  execution_state:
                    type: string
                    example: "QUEUED"

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Gordics-Signature
      description: HMAC-SHA256 signature calculated over the request body using your organization API secret key.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Standard JWT authorization token generated via login credentials.
