Files
ThothII/docs/architecture/thothii-runtime.architecture.json
T
CodexandClaude Opus 5.5 31e6d3a162 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>
2026-10-18 11:01:04 +02:00

553 lines
12 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"schema_version": 1,
"diagram_type": "architecture",
"meta": {
"title": "ThothII — architettura runtime NL→SQL",
"locale": "it",
"output": "docs/architecture/thothii-runtime.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "c77957af93ec77897e0c1f360091b156f3e2424b"
}
},
"components": [
{
"id": "reviewer",
"type": "external",
"label": "Reviewer",
"sublabel": "browser",
"pos": [
40,
200
],
"size": [
120,
64
]
},
{
"id": "frontend",
"type": "frontend",
"label": "Frontend",
"sublabel": "React 18 + nginx",
"tag": "widget gate",
"pos": [
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",
"type": "backend",
"label": "Backend",
"sublabel": "Fastify :8787",
"tag": "SessionBridge + SseHub",
"pos": [
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",
"type": "backend",
"label": "Pi",
"sublabel": "--mode rpc, 1 per sessione",
"pos": [
790,
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": "gate",
"type": "backend",
"label": "tht-gate.js",
"sublabel": "estensione Pi, fasi F1–F8",
"tag": "reviewer tools",
"pos": [
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": "tht",
"type": "backend",
"label": "tht CLI",
"sublabel": "harness Python",
"tag": "fase = fold ledger",
"pos": [
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": "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",
"label": "Identity provider",
"sublabel": "OIDC / upstream",
"pos": [
260,
30
],
"size": [
150,
64
],
"sources": [
{
"path": "backend/src/auth/oidc-client.ts",
"line": 24,
"end_line": 27,
"label": "OidcProtocol"
}
]
},
{
"id": "embedding",
"type": "backend",
"label": "Embedding",
"sublabel": "Ollama :11434",
"pos": [
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",
"type": "database",
"label": "Metadata Catalog",
"sublabel": "PostgreSQL 17",
"pos": [
510,
400
],
"size": [
170,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 74,
"end_line": 98
},
{
"path": "backend/src/catalog/repository.ts",
"line": 2054,
"end_line": 2068,
"label": "pool + repository"
}
]
}
],
"boundaries": [
{
"kind": "region",
"label": "container core",
"wraps": [
"backend",
"pi",
"gate",
"tht"
]
}
],
"connections": [
{
"id": "rev-fe",
"from": "reviewer",
"to": "frontend",
"label": "HTTPS",
"variant": "emphasis"
},
{
"id": "fe-be",
"from": "frontend",
"to": "backend",
"label": "/api + SSE",
"variant": "emphasis"
},
{
"id": "be-pi",
"from": "backend",
"to": "pi",
"label": "RPC stdio",
"variant": "emphasis"
},
{
"id": "pi-gate",
"from": "pi",
"to": "gate",
"label": "tool call",
"variant": "emphasis"
},
{
"id": "gate-tht",
"from": "gate",
"to": "tht",
"label": "execFileSync",
"variant": "emphasis"
},
{
"id": "tht-sessions",
"from": "tht",
"to": "sessions",
"label": "scrive"
},
{
"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",
"to": "llm",
"label": "prompt"
},
{
"id": "be-llm",
"from": "backend",
"to": "llm",
"label": "descrizioni",
"variant": "dashed"
},
{
"id": "be-idp",
"from": "backend",
"to": "idp",
"label": "OIDC",
"variant": "security"
},
{
"id": "be-catalog",
"from": "backend",
"to": "catalog",
"label": "SQL"
},
{
"id": "be-tht",
"from": "backend",
"to": "tht",
"label": "ThtRunner"
}
],
"cards": [
{
"dot": "cyan",
"title": "Flusso di una sessione",
"items": [
"Il backend avvia un processo Pi per sessione e invia /nuova-domanda o /riprendi-sessione",
"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",
"title": "Persistenza",
"items": [
"Lo stato è nei documenti di fase e nel ledger review_decisions.jsonl, non nella chat",
"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",
"title": "Sicurezza",
"items": [
"Login OIDC o identità upstream dal portale (Omics embedded)",
"Qdrant ed Embedding sono servizi interni della rete Compose; DWH e LLM sono endpoint esterni"
]
}
]
}