{
  "openapi": "3.0.1",
  "info": {
    "title": "Delta-Sync Sentinel",
    "description": "RAG Pipeline, Agentic Infrastructure, Idempotent Ingestion — transactional-outbox delta sync engine with deterministic chunk IDs and lease/fencing tokens. Safe to re-run; manifest-commit is the source of truth.",
    "version": "0.1",
    "x-build-id": "nOASlJACAQKheIugl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automationnation~delta-sync-sentinel/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automationnation-delta-sync-sentinel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/automationnation~delta-sync-sentinel/runs": {
      "post": {
        "operationId": "runs-sync-automationnation-delta-sync-sentinel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/automationnation~delta-sync-sentinel/run-sync": {
      "post": {
        "operationId": "run-sync-automationnation-delta-sync-sentinel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "maxCostUsd"
        ],
        "properties": {
          "op": {
            "title": "Operation",
            "enum": [
              "sync",
              "reconcile",
              "health"
            ],
            "type": "string",
            "description": "Selects the state-machine verb. 'sync': fetch sources, stage content-addressed chunks, and commit one new manifest at cursor+1. 'reconcile': re-emit every already-committed manifest with cursor >= fromCursor, reconstructing chunks from durable storage with their original deterministic ids — use this to recover a downstream consumer that fell behind or dropped data, never to 'redo' work. 'health': return the {status, staleness_s, last_cursor} snapshot and exit without writing anything.",
            "default": "sync"
          },
          "sources": {
            "title": "Source URLs",
            "type": "array",
            "description": "http(s) URLs to fetch and split into deterministic chunks. Required when op = 'sync', ignored otherwise. Each source is sectioned on markdown headings when present, or packed into ~chunkSizeChars windows on paragraph boundaries when not — either way, the same source content always produces the same section boundaries, which is what makes chunk_id stable across re-runs.",
            "items": {
              "type": "string"
            }
          },
          "fromCursor": {
            "title": "From Cursor",
            "minimum": 0,
            "type": "integer",
            "description": "Used only when op = 'reconcile'. Re-emits every committed manifest whose cursor is >= this value, in cursor order, using the original deterministic chunk_ids. Set to your last known-good cursor + 1 to backfill exactly the gap a consumer missed — replay is safe because consumers upsert on chunk_id rather than append.",
            "default": 0
          },
          "maxCostUsd": {
            "title": "Max Cost (USD)",
            "type": "string",
            "description": "Hard spending ceiling. Checked before every chunk is staged — if internal execution cost projects to exceed this value, the actor self-terminates immediately (CostCeilingError) rather than staging the chunk, so a triggered ceiling never leaves a committed manifest. Prevents runaway billing on unexpectedly large sources. Accepts a decimal string, e.g. '5.00' — string rather than number because the Apify input form has no float type; the actor coerces it internally."
          },
          "costPerChunkUsd": {
            "title": "Cost Per Chunk (USD, optional)",
            "type": "string",
            "description": "Override for the assumed marginal cost of staging one chunk, used only to project against maxCostUsd. Defaults to 0.0005 if omitted. Same string-for-float reasoning as maxCostUsd."
          },
          "baseCostUsd": {
            "title": "Base Cost (USD, optional)",
            "type": "string",
            "description": "Override for the assumed fixed cost of a run (container start, initial fetch) before any chunk is staged, used only to project against maxCostUsd. Defaults to 0.01 if omitted. If this alone exceeds maxCostUsd, the run is rejected at validation before any network call is made."
          },
          "chunkSizeChars": {
            "title": "Chunk Size (chars)",
            "minimum": 200,
            "type": "integer",
            "description": "Target chunk size in characters, used only as a fallback when a source has no markdown headings to section on. Does not affect chunk_id derivation directly — the resulting section content does, so changing this value after a source has already been synced will produce new chunk_ids for that source on the next sync.",
            "default": 1200
          },
          "heartbeatIntervalSecs": {
            "title": "Heartbeat Interval (s)",
            "minimum": 5,
            "type": "integer",
            "description": "How often the lease heartbeat is refreshed in the KV store while this run holds it. Must stay well under the 90-second zombie-detection threshold (see README) or a live run risks having its own lease stolen out from under it.",
            "default": 20
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}