{
  "schemaVersion": 1,
  "generatedAt": "2026-08-17T18:34:26.094Z",
  "generationKey": "d7588147df9be2bde1818a756482eab1b4822067d5ef499bb67ed60264db8a50",
  "metadataPayloadSha256": "1a00847df07b591596c12d491477705ce29f32fd025249fd23091efcae1d0e4a",
  "diagram": {
    "id": "intake-primary-runtime-flow-c82b4a34",
    "title": "Intake — primary runtime flow",
    "description": "syncConnector returns 202 immediately; the worker acquires the source lock, decrypts the credential, crawls page by page with a checkpoint after each, and finishes by stamping the source and the run row. getConnector is how a caller observes progress.",
    "status": "current",
    "canonicalAppearanceKey": "tsx:src/app/(docs)/docs/modules/intake/page.tsx:intakeRuntimeFlowChart#1"
  },
  "aliases": [],
  "concepts": [
    "Intake runtime flow",
    "Modules",
    "Intake"
  ],
  "keywords": [
    "routes (API)",
    "API consumer (SDK or curl)",
    "pg-boss job queue (store)",
    "sync_runs (store)",
    "connector_sources (store)",
    "persist the page checkpoint into sync_state",
    "upsert on (source_id, external_id), skip unchanged sourceVersion",
    "runConnectorSync (service)",
    "Remote source (external)",
    "documents + chunks (store)",
    "syncConnector with kind full or incremental",
    "triggerSync validates the source and enqueues",
    "worker dispatches the sync job",
    "acquire the per-source advisory lock",
    "startSyncRun appends an in-flight run row",
    "fullLoad or poll fetches one page",
    "normalized documents plus checkpoint",
    "mark status active and stamp lastSyncedAt",
    "finishSyncRun writes final stats",
    "getConnector reads the source and its syncRuns",
    "loadSourceForSync decrypts the stored credential",
    "/api/v1/connectors"
  ],
  "mermaid": {
    "type": "sequence",
    "sourceSha256": "c82b4a3473a2610cc04b9ba32436ae16062c524bbb1fbb1d01daf347b3711083"
  },
  "provenance": [
    {
      "appearanceKey": "tsx:src/app/(docs)/docs/modules/intake/page.tsx:intakeRuntimeFlowChart#1",
      "surface": "route",
      "sourcePath": "src/app/(docs)/docs/modules/intake/page.tsx",
      "line": 123,
      "route": "/docs/modules/intake",
      "symbol": "intakeRuntimeFlowChart",
      "caption": "syncConnector returns 202 immediately; the worker acquires the source lock, decrypts the credential, crawls page by page with a checkpoint after each, and finishes by stamping the source and the run row. getConnector is how a caller observes progress."
    }
  ],
  "embeddedMetadata": [
    {
      "sourcePath": "src/app/(docs)/docs/modules/intake/page.tsx",
      "caption": "syncConnector returns 202 immediately; the worker acquires the source lock, decrypts the credential, crawls page by page with a checkpoint after each, and finishes by stamping the source and the run row. getConnector is how a caller observes progress."
    }
  ],
  "generation": {
    "application": {
      "name": "eli-ai",
      "version": "0.1.0"
    },
    "environment": {
      "node": "v26.3.1",
      "yarn": "4.17.1",
      "platform": "linux",
      "architecture": "x64",
      "containerImage": "playwright:v1.62.1-noble@sha256:c091b21d9fae78c76e85cd4356431e9b018402f172a214fc7d7a5e9a7e29d8ac+node:26.3.1-bookworm-slim@sha256:209558c3e5e40e8adff68959d3c2ba7cd73723e716d89196878a0c362fa1e109"
    },
    "packages": {
      "mermaid": "11.16.0",
      "mermaidCli": "11.16.0",
      "playwright": "1.62.1",
      "playwrightCore": "1.62.1",
      "puppeteer": "25.6.0",
      "puppeteerCore": "25.6.0"
    },
    "renderer": {
      "mermaidConfigSha256": "68c10966fe84406ee626034d58bfabd555df9f65f691204b7c46db24038da101",
      "themeCssSha256": "c80287a78d80ad63d27bd5ca348b2ef9a7e2f44da289e436be6484ea28a1b033",
      "browser": {
        "name": "chromium",
        "revision": "1234",
        "version": "151.0.7922.34",
        "executableSha256": "0b20b130e7edd9dd51873be867761295fe0cfad490c2b9a64f95bd3cfc08fa71"
      },
      "font": {
        "family": "Eli Diagram Inter Variable",
        "fileSha256": "3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62",
        "licenseSha256": "3b0a5fca3d17942cde889069889dedbbbd075e9b599968c82a95f4d944e9b345"
      }
    },
    "adapterVersions": {
      "diagramGenerator": "2",
      "drawioFlowchart": "1",
      "drawioSequence": "1",
      "drawioState": "1",
      "drawioGantt": "1"
    }
  },
  "artifacts": {
    "mmd": "/diagrams/intake-primary-runtime-flow-c82b4a34/intake-primary-runtime-flow-c82b4a34.mmd",
    "svg": "/diagrams/intake-primary-runtime-flow-c82b4a34/intake-primary-runtime-flow-c82b4a34.svg",
    "png": "/diagrams/intake-primary-runtime-flow-c82b4a34/intake-primary-runtime-flow-c82b4a34.png",
    "drawio": "/diagrams/intake-primary-runtime-flow-c82b4a34/intake-primary-runtime-flow-c82b4a34.drawio",
    "json": "/diagrams/intake-primary-runtime-flow-c82b4a34/intake-primary-runtime-flow-c82b4a34.json"
  },
  "artifactSha256": {
    "mmd": "cd011dba5286bd1b1b0848ff45f47bcbd89cbbf2a84384d159495009d6de4854",
    "svg": "72a15379ac9b7f63ce738dd2314cee87a51f59d51a39b9b5226912e9b936e287",
    "png": "4f2b1a8fd0cc90b99a35c0621c34c27cfb250353ec40af3e9b0f1afebc874cd0",
    "drawio": "8b16be58539a81cfa48f657a80456b27ff36f283bb272883fe6b1ffef1e8ce78"
  }
}
