docs: regenerate runtime architecture diagram with Archify 3.1

Source-backed Italian map of the NL→SQL runtime (frontend, backend,
Pi, tht-gate, tht CLI and their stores), with file/line evidence
pinned to c77957af.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-18 11:01:04 +02:00
co-authored by Claude Opus 5.5
parent c77957af93
commit 31e6d3a162
2 changed files with 4331 additions and 4045 deletions
@@ -2,265 +2,550 @@
"schema_version": 1, "schema_version": 1,
"diagram_type": "architecture", "diagram_type": "architecture",
"meta": { "meta": {
"title": "ThothII Runtime Architecture", "title": "ThothII — architettura runtime NL→SQL",
"locale": "en", "locale": "it",
"output": "thothii-runtime.html", "output": "docs/architecture/thothii-runtime.html",
"quality_profile": "showcase", "quality_profile": "showcase",
"viewBox": [1360, 800] "repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "c77957af93ec77897e0c1f360091b156f3e2424b"
}
}, },
"components": [ "components": [
{ {
"id": "reviewer", "id": "reviewer",
"type": "external", "type": "external",
"label": "User / Reviewer", "label": "Reviewer",
"sublabel": "Browser", "sublabel": "browser",
"pos": [20, 300], "pos": [
"size": [145, 72] 40,
200
],
"size": [
120,
64
]
}, },
{ {
"id": "frontend", "id": "frontend",
"type": "frontend", "type": "frontend",
"label": "Frontend", "label": "Frontend",
"sublabel": "React 18 + Vite", "sublabel": "React 18 + nginx",
"tag": "in-memory transcript", "tag": "widget gate",
"pos": [205, 295], "pos": [
"size": [165, 82] 260,
200
],
"size": [
150,
64
],
"sources": [
{
"path": "docker/nginx.conf.template",
"line": 13,
"end_line": 20,
"label": "proxy /api → core"
},
{
"path": "frontend/src/stream/useSessionStream.ts",
"line": 121,
"end_line": 121,
"label": "EventSource SSE"
},
{
"path": "frontend/src/widgets/registry.ts",
"line": 5,
"end_line": 13,
"label": "registry widget"
}
]
}, },
{ {
"id": "backend", "id": "backend",
"type": "backend", "type": "backend",
"label": "Backend", "label": "Backend",
"sublabel": "Fastify + TypeScript", "sublabel": "Fastify :8787",
"tag": "session bridge", "tag": "SessionBridge + SseHub",
"pos": [410, 295], "pos": [
"size": [175, 82] 510,
200
],
"size": [
170,
64
],
"sources": [
{
"path": "backend/src/routes/sessions.ts",
"line": 634,
"end_line": 663,
"label": "POST risposta gate"
},
{
"path": "backend/src/bridge/session-bridge.ts",
"line": 63,
"end_line": 71,
"label": "RPC → ui_request"
},
{
"path": "backend/src/sse/sse-hub.ts",
"line": 107,
"end_line": 113,
"label": "publish SSE"
}
]
}, },
{ {
"id": "pi", "id": "pi",
"type": "backend", "type": "backend",
"label": "Pi", "label": "Pi",
"sublabel": "RPC process per session", "sublabel": "--mode rpc, 1 per sessione",
"tag": "inside core", "pos": [
"pos": [625, 295], 790,
"size": [170, 82] 200
],
"size": [
170,
64
],
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 143,
"end_line": 146,
"label": "spawn pi --mode rpc"
},
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 283,
"end_line": 290,
"label": "nuova-domanda / riprendi"
}
]
}, },
{ {
"id": "harness", "id": "gate",
"type": "backend", "type": "backend",
"label": "tht / Harness", "label": "tht-gate.js",
"sublabel": "8-phase NL→SQL workflow", "sublabel": "estensione Pi, fasi F1–F8",
"tag": "workflow owner", "tag": "reviewer tools",
"pos": [835, 295], "pos": [
"size": [190, 82] 1060,
200
],
"size": [
170,
64
],
"sources": [
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 597,
"end_line": 603,
"label": "ctx.ui.input"
},
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 889,
"end_line": 895,
"label": "reviewer_select"
},
{
"path": "harness/.pi/skills/tht-sessione/SKILL.md",
"line": 40,
"end_line": 66,
"label": "regole di fase"
}
]
}, },
{ {
"id": "workspace", "id": "tht",
"type": "database", "type": "backend",
"label": "Workspace Repository", "label": "tht CLI",
"sublabel": "sessions + phase artifacts", "sublabel": "harness Python",
"tag": "source of truth", "tag": "fase = fold ledger",
"pos": [1065, 295], "pos": [
"size": [205, 82] 1335,
200
],
"size": [
160,
64
],
"sources": [
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 277,
"end_line": 280,
"label": "execFileSync tht"
},
{
"path": "harness/tht/phase.py",
"line": 60,
"end_line": 79,
"label": "current_phase"
},
{
"path": "harness/workflow.yaml",
"line": 12,
"end_line": 72,
"label": "workflow F1–F8"
}
]
}, },
{ {
"id": "auth", "id": "llm",
"type": "cloud",
"label": "Provider LLM",
"sublabel": "catalogo modelli installazione",
"pos": [
790,
400
],
"size": [
170,
64
],
"sources": [
{
"path": "backend/src/pi/managed-config.ts",
"line": 120,
"end_line": 128,
"label": "models.json di Pi"
},
{
"path": "backend/src/catalog/model-completer.ts",
"line": 67,
"end_line": 74,
"label": "helper LiteLLM"
},
{
"path": "harness/tht/internal/litellm_completion.py",
"line": 186,
"end_line": 195
}
]
},
{
"id": "idp",
"type": "security", "type": "security",
"label": "Authentication", "label": "Identity provider",
"sublabel": "local registry or OIDC", "sublabel": "OIDC / upstream",
"pos": [410, 70], "pos": [
"size": [170, 76] 260,
30
],
"size": [
150,
64
],
"sources": [
{
"path": "backend/src/auth/oidc-client.ts",
"line": 24,
"end_line": 27,
"label": "OidcProtocol"
}
]
}, },
{ {
"id": "modelProvider", "id": "embedding",
"type": "external", "type": "backend",
"label": "AI Model Provider", "label": "Embedding",
"sublabel": "installation-selected APIs", "sublabel": "Ollama :11434",
"pos": [615, 70], "pos": [
"size": [190, 76] 1335,
30
],
"size": [
160,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 230,
"end_line": 249
},
{
"path": "harness/tht/vectorstore/embeddings.py",
"line": 65,
"end_line": 75,
"label": "embed()"
}
]
},
{
"id": "qdrant",
"type": "database",
"label": "Qdrant",
"sublabel": "vector store :6333",
"pos": [
1580,
200
],
"size": [
150,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 210,
"end_line": 228
},
{
"path": "harness/tht/adapters/vector/qdrant.py",
"line": 141,
"end_line": 141,
"label": "search"
},
{
"path": "harness/tht/adapters/vector/qdrant.py",
"line": 327,
"end_line": 327,
"label": "upsert"
}
]
},
{
"id": "sessions",
"type": "database",
"label": "Sessioni",
"sublabel": "manifest + artefatti + ledger",
"tag": "fonte di verità",
"pos": [
1335,
400
],
"size": [
160,
64
],
"sources": [
{
"path": "harness/tht/session/repository.py",
"line": 74,
"end_line": 92,
"label": "filesystem o Postgres"
},
{
"path": "harness/tht/session/filesystem_repository.py",
"line": 134,
"end_line": 142,
"label": "append decisioni"
},
{
"path": "harness/tht/decisions.py",
"line": 10,
"end_line": 10,
"label": "review_decisions.jsonl"
}
]
},
{
"id": "dwh",
"type": "database",
"label": "DWH",
"sublabel": "Postgres o REST",
"tag": "sola lettura",
"pos": [
1580,
400
],
"size": [
170,
64
],
"sources": [
{
"path": "harness/tht/adapters/dwh/postgres.py",
"line": 29,
"end_line": 33,
"label": "verifica read-only"
},
{
"path": "harness/tht/adapters/dwh/thoth_rest.py",
"line": 22,
"end_line": 29,
"label": "REST read_only"
},
{
"path": "backend/src/catalog/description-source-sampler.ts",
"line": 153,
"end_line": 160,
"label": "campionamento"
}
]
}, },
{ {
"id": "catalog", "id": "catalog",
"type": "database", "type": "database",
"label": "Metadata Catalog", "label": "Metadata Catalog",
"sublabel": "PostgreSQL + Kysely", "sublabel": "PostgreSQL 17",
"tag": "backend-owned", "pos": [
"pos": [410, 545], 510,
"size": [180, 82] 400
}, ],
{ "size": [
"id": "embedding", 170,
"type": "backend", 64
"label": "Embedding Service", ],
"sublabel": "Ollama", "sources": [
"pos": [800, 545], {
"size": [170, 76] "path": "compose.yaml",
}, "line": 74,
{ "end_line": 98
"id": "qdrant", },
"type": "database", {
"label": "Vector Store", "path": "backend/src/catalog/repository.ts",
"sublabel": "Qdrant", "line": 2054,
"pos": [1010, 545], "end_line": 2068,
"size": [160, 76] "label": "pool + repository"
}, }
{ ]
"id": "dwh",
"type": "external",
"label": "Data Warehouse",
"sublabel": "external, read-only",
"pos": [1070, 70],
"size": [180, 82]
} }
], ],
"boundaries": [ "boundaries": [
{ {
"kind": "region", "kind": "region",
"label": "Local Docker Compose runtime", "label": "container core",
"wraps": ["frontend", "backend", "pi", "harness", "catalog", "embedding", "qdrant"], "wraps": [
"pad": 26 "backend",
}, "pi",
{ "gate",
"kind": "security-group", "tht"
"label": "core container", ]
"wraps": ["pi", "harness"],
"pad": 18
},
{
"kind": "security-group",
"label": "operator-controlled persisted state",
"wraps": ["workspace"],
"pad": 18
} }
], ],
"connections": [ "connections": [
{ {
"id": "reviewerInput", "id": "rev-fe",
"from": "reviewer", "from": "reviewer",
"to": "frontend", "to": "frontend",
"label": "question / gate decision", "label": "HTTPS",
"variant": "emphasis",
"labelAt": [185, 391]
},
{
"id": "restRequests",
"from": "frontend",
"to": "backend",
"label": "REST",
"variant": "emphasis" "variant": "emphasis"
}, },
{ {
"id": "sseEvents", "id": "fe-be",
"from": "backend", "from": "frontend",
"to": "frontend", "to": "backend",
"label": "SSE: text · info · widget", "label": "/api + SSE",
"variant": "dashed", "variant": "emphasis"
"labelAt": [390, 415]
}, },
{ {
"id": "piRpc", "id": "be-pi",
"from": "backend", "from": "backend",
"to": "pi", "to": "pi",
"label": "JSON-RPC stdio", "label": "RPC stdio",
"variant": "emphasis", "variant": "emphasis"
"labelAt": [605, 391]
}, },
{ {
"id": "gateCommands", "id": "pi-gate",
"from": "pi", "from": "pi",
"to": "harness", "to": "gate",
"label": "phase / gate commands", "label": "tool call",
"variant": "emphasis", "variant": "emphasis"
"labelAt": [815, 391]
}, },
{ {
"id": "persistArtifacts", "id": "gate-tht",
"from": "harness", "from": "gate",
"to": "workspace", "to": "tht",
"label": "artifacts + decision ledger", "label": "execFileSync",
"variant": "emphasis", "variant": "emphasis"
"labelAt": [1045, 391]
}, },
{ {
"id": "authenticate", "id": "tht-sessions",
"from": "auth", "from": "tht",
"to": "backend", "to": "sessions",
"label": "local session / OIDC callback", "label": "scrive"
"variant": "security",
"fromSide": "bottom",
"toSide": "top"
}, },
{ {
"id": "sessionModel", "id": "tht-dwh",
"from": "tht",
"to": "dwh",
"label": "SQL read-only"
},
{
"id": "tht-qdrant",
"from": "tht",
"to": "qdrant",
"label": "ricerca"
},
{
"id": "tht-embedding",
"from": "tht",
"to": "embedding",
"label": "embed"
},
{
"id": "pi-llm",
"from": "pi", "from": "pi",
"to": "modelProvider", "to": "llm",
"label": "session model API", "label": "prompt"
"fromSide": "top",
"toSide": "bottom",
"labelAt": [755, 185]
}, },
{ {
"id": "catalogState", "id": "be-llm",
"from": "backend", "from": "backend",
"to": "catalog", "to": "llm",
"label": "catalog CRUD + runs", "label": "descrizioni",
"fromSide": "bottom",
"toSide": "top"
},
{
"id": "metadataModel",
"from": "backend",
"to": "modelProvider",
"label": "short-lived LiteLLM calls",
"variant": "dashed" "variant": "dashed"
}, },
{ {
"id": "readOnlySql", "id": "be-idp",
"from": "harness", "from": "backend",
"to": "dwh", "to": "idp",
"label": "introspection + read-only SQL" "label": "OIDC",
"variant": "security"
}, },
{ {
"id": "embedRequests", "id": "be-catalog",
"from": "harness", "from": "backend",
"to": "embedding", "to": "catalog",
"label": "embedding requests", "label": "SQL"
"fromSide": "bottom",
"toSide": "top",
"labelAt": [830, 490]
}, },
{ {
"id": "vectorAccess", "id": "be-tht",
"from": "harness", "from": "backend",
"to": "qdrant", "to": "tht",
"label": "index + vector retrieval", "label": "ThtRunner"
"fromSide": "bottom",
"toSide": "top",
"labelAt": [1165, 475]
} }
], ],
"cards": [ "cards": [
{ {
"dot": "cyan", "dot": "cyan",
"title": "Primary session path", "title": "Flusso di una sessione",
"items": [ "items": [
"The browser sends questions and reviewer decisions over REST; the backend returns text, information, and widget descriptors over SSE.", "Il backend avvia un processo Pi per sessione e invia /nuova-domanda o /riprendi-sessione",
"One Pi RPC process drives each active session and delegates deterministic phase operations to tht / Harness." "tht-gate.js guida le fasi F1–F8 e chiama il CLI tht per ogni passo deterministico",
"I gate reviewer arrivano al browser come ui_request via SSE; la risposta torna con POST /sessions/:id/response"
] ]
}, },
{ {
"dot": "emerald", "dot": "emerald",
"title": "State ownership", "title": "Persistenza",
"items": [ "items": [
"Harness owns the eight-phase workflow and persists session_manifest.yaml, phase artifacts, and review_decisions.jsonl.", "Lo stato è nei documenti di fase e nel ledger review_decisions.jsonl, non nella chat",
"Backend owns the separate installation-local metadata catalog; the live frontend transcript is not persisted." "La fase corrente si calcola ripiegando il ledger (phase.py), non viene salvata",
"Repository sessioni su filesystem oppure PostgreSQL, secondo la configurazione"
]
},
{
"dot": "amber",
"title": "Catalogo metadati",
"items": [
"Il backend gestisce il Metadata Catalog PostgreSQL",
"Le descrizioni AI campionano il DWH in sola lettura e usano un helper Python LiteLLM, senza Pi"
] ]
}, },
{ {
"dot": "rose", "dot": "rose",
"title": "Trust boundaries", "title": "Sicurezza",
"items": [ "items": [
"Catalog DB, Qdrant, and Ollama stay inside Compose; workspace state is operator controlled and mounted into core.", "Login OIDC o identità upstream dal portale (Omics embedded)",
"The DWH and AI provider remain external endpoints; DWH access is constrained to introspection, tests, bounded samples, and read-only SQL." "Qdrant ed Embedding sono servizi interni della rete Compose; DWH e LLM sono endpoint esterni"
] ]
} }
] ]
File diff suppressed because one or more lines are too long