{
  "openapi": "3.0.3",
  "info": {
    "title": "I La Galigo Reader — agent manifest",
    "version": "1.0.0",
    "description": "OpenAPI-lite manifest for the public I La Galigo manuscript reader at ilagaligo.com. Humans and agents can read pipeline state, pick open tasks, and submit contribution JSON bundles (OCR / Transkribus PAGE XML, word splits, translations, reviews, lexicon entries) as a GitHub pull request.",
    "contact": {
      "name": "I La Galigo Reader",
      "url": "https://ilagaligo.com/",
      "email": "info@ilagaligo.com"
    },
    "license": {
      "name": "Public Domain Mark 1.0 (Leiden scans)",
      "url": "https://creativecommons.org/publicdomain/mark/1.0/"
    }
  },
  "servers": [
    {
      "url": "https://ilagaligo.com",
      "description": "Canonical host"
    },
    {
      "url": "https://book-ilagaligo.pages.dev",
      "description": "Cloudflare Pages"
    }
  ],
  "tags": [
    {
      "name": "data",
      "description": "Public JSON the reader already serves"
    },
    {
      "name": "contribute",
      "description": "How to send work back"
    }
  ],
  "paths": {
    "/data/status.json": {
      "get": {
        "tags": [
          "data"
        ],
        "summary": "Pipeline status for all 12 Leiden volumes (2,993 pages)",
        "description": "Machine-readable counts and per-volume state. Pipeline: raw_scan → ocr_draft → transkribus_uploaded → segmented → translated → reviewed.",
        "responses": {
          "200": {
            "description": "Status document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          }
        }
      }
    },
    "/data/tasks.json": {
      "get": {
        "tags": [
          "data"
        ],
        "summary": "Open work items agents and humans can pick up",
        "responses": {
          "200": {
            "description": "Task list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskList"
                }
              }
            }
          }
        }
      }
    },
    "/data/pages.json": {
      "get": {
        "tags": [
          "data"
        ],
        "summary": "Live interactive pages (lines, bbox, draft Latin and translations)",
        "responses": {
          "200": {
            "description": "Page corpus"
          }
        }
      }
    },
    "/data/lexicon.json": {
      "get": {
        "tags": [
          "data"
        ],
        "summary": "Bugis lexicon (lemma, ID/EN gloss, grammatical note)",
        "responses": {
          "200": {
            "description": "Lexicon"
          }
        }
      }
    },
    "/agents.json": {
      "get": {
        "tags": [
          "contribute"
        ],
        "summary": "This manifest",
        "responses": {
          "200": {
            "description": "Agent manifest"
          }
        }
      }
    },
    "/contribute.md": {
      "get": {
        "tags": [
          "contribute"
        ],
        "summary": "Human-readable contribution guide (Indonesian and English)",
        "responses": {
          "200": {
            "description": "Markdown guide"
          }
        }
      }
    },
    "/tools/ilagaligo_byok_worker.py": {
      "get": {
        "tags": [
          "contribute"
        ],
        "summary": "Stage 1 BYOK CLI worker (zero-dependency Python 3)",
        "description": "Run with your own GEMINI_API_KEY, OPENROUTER_API_KEY, or OPENAI_API_KEY. The key stays on your machine and goes directly to the provider. Fetches /data/tasks.json and writes a contribution JSON bundle.",
        "responses": {
          "200": {
            "description": "Python script"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Status": {
        "type": "object",
        "description": "See /data/status.json"
      },
      "TaskList": {
        "type": "object",
        "description": "See /data/tasks.json"
      },
      "Contribution": {
        "type": "object",
        "required": [
          "type",
          "version",
          "kind",
          "createdAt",
          "target"
        ],
        "properties": {
          "type": {
            "const": "ilagaligo-contribution"
          },
          "version": {
            "type": "integer",
            "const": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "ocr",
              "transkribus",
              "word-split",
              "translation",
              "review",
              "lexicon"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "target": {
            "type": "object",
            "properties": {
              "volume": {
                "type": "integer",
                "minimum": 1,
                "maximum": 12
              },
              "scan": {
                "type": "integer",
                "minimum": 1
              },
              "pageId": {
                "type": "string",
                "example": "vol01-scan0013"
              }
            }
          },
          "source": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string"
              },
              "format": {
                "type": "string",
                "enum": [
                  "page-xml",
                  "txt"
                ]
              },
              "imageFilename": {
                "type": "string"
              }
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "n": {
                  "type": "integer"
                },
                "lontara": {
                  "type": "string"
                },
                "latin": {
                  "type": "string"
                },
                "translation_id": {
                  "type": "string"
                },
                "translation_en": {
                  "type": "string"
                },
                "bbox": {
                  "type": "array",
                  "minItems": 4,
                  "maxItems": 4,
                  "items": {
                    "type": "number"
                  },
                  "description": "Line box as percentages [x, y, w, h] of the scan (0–100)."
                }
              }
            }
          },
          "entries": {
            "type": "array",
            "description": "For kind=lexicon",
            "items": {
              "type": "object"
            }
          },
          "notes": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-how-to-help": {
    "id": "Jalankan Worker BYOK di panel Status / Kontribusi (kunci Anda, langsung ke penyedia) atau skrip /tools/ilagaligo_byok_worker.py. Baca /data/status.json dan /data/tasks.json, lalu kerjakan satu tugas. Cara membantu: (1) daftar ke Transkribus — akun gratis atau berbayar — jalankan batch HTR, ekspor PAGE XML atau .txt, dan unggah di panel Status / Kontribusi; (2) jalankan model Kraken HTR kustom kami; (3) periksa OCR terhadap pindaian; (4) pisahkan kata Bugis; (5) tambah entri kamus; (6) draf atau tinjau terjemahan ID/EN; (7) unduh bundel JSON dan buka pull request di https://github.com/jwendyr/book-ilagaligo (atau lampirkan di isu). Tulis terjemahan dari pindaian Leiden. Karya Muhammad Salim, Fachruddin, dan Kern 1939 dilindungi hak cipta sampai 1 Januari 2029.",
    "en": "Run the BYOK worker in the Status / Contribute panel (your key, sent only to the provider) or the /tools/ilagaligo_byok_worker.py script. Read /data/status.json and /data/tasks.json, then pick up one task. Ways to help: (1) sign up for Transkribus — free or paid — run HTR batches, export PAGE XML or .txt, and upload them in the Status / Contribute panel; (2) run our custom Kraken HTR model; (3) check OCR against the scans; (4) segment Bugis words; (5) add lexicon entries; (6) draft or review ID/EN translations; (7) download a JSON bundle and open a pull request at https://github.com/jwendyr/book-ilagaligo (or attach it to an issue). Write translations from the Leiden scans. The works of Muhammad Salim, Fachruddin, and Kern 1939 remain in copyright until 1 January 2029."
  },
  "x-repo": "https://github.com/jwendyr/book-ilagaligo",
  "x-contribute": "https://ilagaligo.com/contribute.md",
  "x-byok": {
    "id": "Worker BYOK (Tahap 1) ada di panel Status / Kontribusi dan di /tools/ilagaligo_byok_worker.py. Tempel kunci Gemini, OpenRouter, atau OpenAI-compatible di peramban (memori / sessionStorage tab ini) atau di lingkungan CLI. Kunci tetap di perangkat Anda dan dikirim langsung ke penyedia.",
    "en": "The Stage 1 BYOK worker lives in the Status / Contribute panel and at /tools/ilagaligo_byok_worker.py. Paste a Gemini, OpenRouter, or OpenAI-compatible key in the browser (memory / tab sessionStorage) or in the CLI environment. The key stays on your device and goes directly to the provider."
  }
}
