docs: add complete Archify architecture diagram set

Thirteen source-backed interactive diagrams in docs/architecture with an
index page (thothii-diagrams.html): runtime and deployment architecture,
module tree, F1-F8 workflow, session and catalog-sync lifecycles,
new-question, gate round-trip, resume and OIDC sequences, session runtime
classes, metadata dataflow and Metadata Catalog ERD. Replaces the old
thothii-core sequence diagram.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-18 12:24:07 +02:00
co-authored by Claude Opus 5.5
parent 31e6d3a162
commit 0adda6e8af
26 changed files with 172897 additions and 4079 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,247 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "ThothII — login OIDC e richieste autenticate",
"locale": "it",
"output": "docs/architecture/thothii-auth-oidc.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"participants": [
{
"id": "browser",
"type": "frontend",
"label": "Browser",
"sublabel": "frontend React",
"sources": [
{
"path": "frontend/src/api/auth.ts",
"line": 71,
"end_line": 105,
"label": "config e beginOidcLogin"
}
]
},
{
"id": "backend",
"type": "backend",
"label": "Backend",
"sublabel": "route /auth",
"sources": [
{
"path": "backend/src/auth/routes.ts",
"line": 247,
"end_line": 286,
"label": "GET /auth/oidc/login"
},
{
"path": "backend/src/auth/routes.ts",
"line": 288,
"end_line": 349,
"label": "GET /auth/oidc/callback"
},
{
"path": "backend/src/auth/auth.ts",
"line": 76,
"end_line": 110,
"label": "authenticateSession"
}
]
},
{
"id": "store",
"type": "database",
"label": "Auth state",
"sublabel": "file, volume auth-state",
"sources": [
{
"path": "backend/src/auth/session-store.ts",
"line": 389,
"end_line": 395,
"label": "createFileAuthSessionStore"
},
{
"path": "compose.yaml",
"line": 30,
"end_line": 30
}
]
},
{
"id": "idp",
"type": "security",
"label": "Identity provider",
"sublabel": "OIDC",
"sources": [
{
"path": "backend/src/auth/oidc-client.ts",
"line": 24,
"end_line": 27,
"label": "OidcProtocol"
}
]
}
],
"segments": [
{
"from": 160,
"to": 342,
"label": "Avvio login"
},
{
"from": 352,
"to": 444,
"label": "Provider"
},
{
"from": 454,
"to": 738,
"label": "Callback"
},
{
"from": 748,
"to": 870,
"label": "Richieste"
}
],
"messages": [
{
"from": "browser",
"to": "backend",
"y": 170,
"label": "GET /auth/config"
},
{
"from": "backend",
"to": "browser",
"y": 200,
"label": "mode: oidc",
"variant": "return"
},
{
"from": "browser",
"to": "backend",
"y": 230,
"label": "GET /auth/oidc/login",
"variant": "emphasis"
},
{
"from": "backend",
"to": "store",
"y": 260,
"label": "createOidcState",
"note": "nonce e code verifier PKCE"
},
{
"from": "backend",
"to": "browser",
"y": 326,
"label": "302 verso il provider",
"variant": "return"
},
{
"from": "browser",
"to": "idp",
"y": 362,
"label": "authorize + PKCE",
"variant": "security",
"note": "login sul provider"
},
{
"from": "idp",
"to": "browser",
"y": 428,
"label": "302 callback con code",
"variant": "return"
},
{
"from": "browser",
"to": "backend",
"y": 464,
"label": "GET /auth/oidc/callback",
"variant": "emphasis"
},
{
"from": "backend",
"to": "store",
"y": 494,
"label": "consumeOidcState",
"note": "verifica transazione, revisione e issuer"
},
{
"from": "backend",
"to": "idp",
"y": 560,
"label": "scambio code",
"variant": "security",
"note": "firma, audience, scadenza, nonce"
},
{
"from": "idp",
"to": "backend",
"y": 626,
"label": "identità + gruppi",
"variant": "return"
},
{
"from": "backend",
"to": "store",
"y": 656,
"label": "crea sessione",
"note": "ruoli dai gruppi, TTL limitato al token"
},
{
"from": "backend",
"to": "browser",
"y": 722,
"label": "cookie + redirect /",
"variant": "return"
},
{
"from": "browser",
"to": "backend",
"y": 758,
"label": "API con cookie",
"variant": "emphasis"
},
{
"from": "backend",
"to": "store",
"y": 788,
"label": "resolve + touch",
"note": "sessione revocata se cambia la config"
},
{
"from": "backend",
"to": "browser",
"y": 854,
"label": "risposta",
"variant": "return"
}
],
"cards": [
{
"dot": "cyan",
"title": "Tre modalità",
"items": [
"local: utenti con hash Argon2id in users.yaml",
"oidc: questo flusso (Authorization Code + PKCE)",
"upstream: il proxy del portale (Omics) passa l'identità negli header; niente login né cookie ThothII"
]
},
{
"dot": "rose",
"title": "Autorizzazione",
"items": [
"I gruppi OIDC sono mappati esattamente sui ruoli user e admin",
"I permessi si ricalcolano dai ruoli a ogni richiesta",
"Le richieste che modificano dati richiedono origine esatta e token CSRF"
]
}
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
{
"schema_version": 3,
"diagram_type": "lifecycle",
"meta": { "title": "ThothII — sincronizzazione schema del Metadata Catalog", "locale": "it", "output": "docs/architecture/thothii-catalog-sync.html", "quality_profile": "showcase", "repository": {"url": "https://git.tylconsulting.it/mptyl/ThothII.git", "link_mode": "local-only", "revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"} },
"mainPath": ["queued", "running", "applying", "succeeded"],
"states": [
{ "id": "queued", "type": "start", "label": "queued", "sublabel": "un run attivo per database", "step": "01",
"sources": [ { "path": "backend/src/catalog/migrations/003_catalog_schema_sync.ts", "line": 102, "end_line": 104, "label": "indice un solo attivo" } ] },
{ "id": "running", "type": "active", "label": "running", "sublabel": "scan DWH + piano delle modifiche", "step": "02",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 175, "end_line": 175, "label": "claimSyncRun" }, { "path": "backend/src/catalog/sync-worker.ts", "line": 210, "end_line": 220, "label": "scan + plan" } ] },
{ "id": "applying", "type": "active", "label": "applying", "sublabel": "modifiche in una transazione", "tag": "non cancellabile", "step": "03",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 243, "end_line": 250, "label": "applySchemaSync" } ] },
{ "id": "succeeded", "type": "success", "label": "succeeded", "sublabel": "catalogo aggiornato", "step": "04",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 300, "end_line": 300 } ] },
{ "id": "awaiting", "type": "waiting", "label": "awaiting_confirmation", "sublabel": "cancellazioni da confermare", "tag": "admin",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 222, "end_line": 240, "label": "diff distruttivo" }, { "path": "backend/src/catalog/sync-worker.ts", "line": 96, "end_line": 112, "label": "confirm" } ] },
{ "id": "cancelled", "type": "neutral", "label": "cancelled", "sublabel": "annullato dall'utente",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 114, "end_line": 136, "label": "cancel" } ] },
{ "id": "failed", "type": "failure", "label": "failed", "sublabel": "errore o timeout",
"sources": [ { "path": "backend/src/catalog/sync-worker.ts", "line": 260, "end_line": 272 } ] },
{ "id": "interrupted", "type": "failure", "label": "interrupted", "sublabel": "riavvio del servizio",
"sources": [ { "path": "backend/src/catalog/repository.ts", "line": 1896, "end_line": 1896, "label": "interruptActiveSyncRuns" } ] }
],
"transitions": [
{ "id": "q-r", "from": "queued", "to": "running", "label": "claim" },
{ "id": "r-a", "from": "running", "to": "applying", "label": "piano pronto" },
{ "id": "a-s", "from": "applying", "to": "succeeded", "label": "commit", "variant": "emphasis" },
{ "id": "r-w", "from": "running", "to": "awaiting", "label": "diff distruttivo", "variant": "security" },
{ "id": "w-q", "from": "awaiting", "to": "queued", "label": "confirm" },
{ "id": "w-c", "from": "awaiting", "to": "cancelled", "label": "cancel" },
{ "id": "q-c", "from": "queued", "to": "cancelled", "label": "cancel" },
{ "id": "r-f", "from": "running", "to": "failed", "label": "errore", "variant": "security" },
{ "id": "r-i", "from": "running", "to": "interrupted", "label": "restart", "variant": "dashed" }
],
"cards": [
{ "dot": "amber", "title": "Conferma", "items": [
"Se il piano rimuove tabelle, colonne o relazioni il run si ferma e chiede conferma",
"La conferma vale solo per lo stesso snapshot: se il DWH cambia, si richiede di nuovo"
] },
{ "dot": "cyan", "title": "Altri run", "items": [
"I run di generazione descrizioni seguono stati analoghi: queued, running, completed, completed_with_errors, cancelled, failed, interrupted",
"Un run terminato può essere rilanciato con retry"
] }
]
}
@@ -1,230 +0,0 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "Sequenza runtime del core ThothII",
"output": "thothii-core-sequence.html",
"quality_profile": "showcase",
"column_fit": "spread",
"viewBox": [1080, 540]
},
"participants": [
{
"id": "reviewer",
"type": "external",
"label": "Revisore",
"sublabel": "browser"
},
{
"id": "frontend",
"type": "frontend",
"label": "Frontend",
"sublabel": "React + SSE"
},
{
"id": "api",
"type": "backend",
"label": "Core API",
"sublabel": "Fastify + SseHub"
},
{
"id": "runtime",
"type": "backend",
"label": "Runtime",
"sublabel": "manager + bridge"
},
{
"id": "pi",
"type": "backend",
"label": "Pi + tht-gate",
"sublabel": "RPC per sessione"
},
{
"id": "model",
"type": "external",
"label": "Modello AI",
"sublabel": "provider configurato"
},
{
"id": "tht",
"type": "backend",
"label": "tht CLI",
"sublabel": "workflow persistito"
},
{
"id": "state",
"type": "database",
"label": "Stato e dati",
"sublabel": "workspace + dati"
}
],
"segments": [
{
"from": 150,
"to": 300,
"label": "Avvio o ripresa"
},
{
"from": 305,
"to": 395,
"label": "Turno Pi e workflow persistito"
},
{
"from": 400,
"to": 475,
"label": "Evento SSE e gate umano"
}
],
"messages": [
{
"id": "askQuestion",
"from": "reviewer",
"to": "frontend",
"y": 160,
"label": "domanda o decisione gate",
"variant": "emphasis"
},
{
"id": "createSession",
"from": "frontend",
"to": "api",
"y": 185,
"label": "POST /sessions o /response",
"variant": "emphasis"
},
{
"id": "newManifest",
"from": "api",
"to": "tht",
"y": 210,
"label": "sessionNew o sessionShow/reopen"
},
{
"id": "persistQuestion",
"from": "tht",
"to": "state",
"y": 235,
"label": "manifest, artifact e ledger"
},
{
"id": "createRuntime",
"from": "api",
"to": "runtime",
"y": 260,
"label": "createFor + bind; configure + searchPack",
"note": "configure(...) e searchPack(...) terminano in parallelo prima dell’avvio del modello."
},
{
"id": "startPi",
"from": "runtime",
"to": "pi",
"y": 285,
"label": "/nuova-domanda o /riprendi-sessione",
"variant": "emphasis",
"note": "In ripresa usa /riprendi-sessione <id> dopo aver riletto provider, modello e thinking dal manifest."
},
{
"id": "modelRequest",
"from": "pi",
"to": "model",
"y": 315,
"label": "turno modello; token e tool call"
},
{
"id": "phaseCommand",
"from": "pi",
"to": "tht",
"y": 345,
"label": "comandi phase / session / evidence",
"variant": "emphasis"
},
{
"id": "readWriteTruth",
"from": "tht",
"to": "state",
"y": 375,
"label": "legge/scrive artifact e ledger",
"note": "Il workspace persistito è la verità; DWH è read-only e Qdrant serve il retrieval."
},
{
"id": "rpcEvents",
"from": "pi",
"to": "runtime",
"y": 405,
"label": "text_delta / ui_request"
},
{
"id": "sseEvent",
"from": "runtime",
"to": "frontend",
"y": 430,
"label": "SSE via SseHub: text · info · widget",
"variant": "return"
},
{
"id": "showResult",
"from": "frontend",
"to": "reviewer",
"y": 455,
"label": "testo o widget di revisione",
"variant": "return"
}
],
"activations": [
{
"participant": "frontend",
"from": 155,
"to": 460,
"type": "frontend"
},
{
"participant": "api",
"from": 180,
"to": 290,
"type": "backend"
},
{
"participant": "runtime",
"from": 255,
"to": 440,
"type": "backend"
},
{
"participant": "pi",
"from": 280,
"to": 415,
"type": "backend"
},
{
"participant": "model",
"from": 310,
"to": 335,
"type": "external"
},
{
"participant": "tht",
"from": 205,
"to": 390,
"type": "backend"
},
{
"participant": "state",
"from": 230,
"to": 390,
"type": "database"
}
],
"cards": [
{
"dot": "cyan",
"title": "Bootstrap",
"items": [
"La sessione viene persistita prima dell’avvio di Pi; configurazione e retrieval terminano prima del primo prompt.",
"La ripresa rifiuta sessioni finalizzate o archiviate e usa sempre /riprendi-sessione <id>.",
"Il modello propone; il revisore decide tramite reviewer_select, reviewer_decide o reviewer_confirm.",
"La risposta percorre POST /sessions/:id/response → bridge.respond → extension_ui_response; stale/duplicate ricevono 409.",
"La fase avanza solo dopo append della decisione esplicita e fold del ledger persistito."
]
}
]
}
@@ -0,0 +1,529 @@
{
"schema_version": 1,
"diagram_type": "architecture",
"meta": {
"title": "ThothII — deployment Docker Compose",
"locale": "it",
"output": "docs/architecture/thothii-deployment.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"components": [
{
"id": "operator",
"type": "external",
"label": "Operatore",
"sublabel": "host",
"pos": [
40,
40
],
"size": [
150,
64
]
},
{
"id": "thtcli",
"type": "backend",
"label": "tht (host)",
"sublabel": "CLI Go: setup, start, stop",
"pos": [
290,
40
],
"size": [
170,
64
],
"sources": [
{
"path": "tools/tht/cmd/tht/main.go",
"line": 223,
"end_line": 237,
"label": "start / stop"
},
{
"path": "tools/tht/internal/config/installation.go",
"line": 548,
"end_line": 548,
"label": "docker compose"
}
]
},
{
"id": "browser",
"type": "external",
"label": "Browser",
"sublabel": "o proxy del portale",
"pos": [
40,
340
],
"size": [
150,
64
]
},
{
"id": "frontend",
"type": "frontend",
"label": "frontend",
"sublabel": "nginx :8080",
"tag": "unica porta pubblica",
"pos": [
290,
340
],
"size": [
160,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 190,
"end_line": 208
},
{
"path": "docker/nginx.conf.template",
"line": 13,
"end_line": 20,
"label": "/api → core"
},
{
"path": "deploy/compose.server.yaml",
"line": 32,
"end_line": 34,
"label": "porta server"
}
]
},
{
"id": "core",
"type": "backend",
"label": "core",
"sublabel": "backend + Pi + tht :8787",
"tag": "MAX_PI_PROCESSES",
"pos": [
540,
340
],
"size": [
190,
84
],
"sources": [
{
"path": "compose.yaml",
"line": 4,
"end_line": 72
},
{
"path": "docker/core.Dockerfile",
"line": 1,
"end_line": 5
}
]
},
{
"id": "catalogdb",
"type": "database",
"label": "catalog-db",
"sublabel": "PostgreSQL 17",
"tag": "volume catalog-data",
"pos": [
820,
340
],
"size": [
170,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 74,
"end_line": 98
}
]
},
{
"id": "migrate",
"type": "backend",
"label": "catalog-migrate",
"sublabel": "one-shot",
"pos": [
1080,
340
],
"size": [
160,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 100,
"end_line": 117
}
]
},
{
"id": "qdrant",
"type": "database",
"label": "qdrant",
"sublabel": "vector store :6333",
"tag": "volume qdrant-data",
"pos": [
820,
490
],
"size": [
170,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 210,
"end_line": 228
}
]
},
{
"id": "maint",
"type": "backend",
"label": "workspace-maintenance",
"sublabel": "one-shot, preprocessing",
"pos": [
1080,
490
],
"size": [
190,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 119,
"end_line": 188
},
{
"path": "backend/src/workspace-maintenance.ts",
"line": 22,
"end_line": 22,
"label": "comandi"
}
]
},
{
"id": "embedding",
"type": "backend",
"label": "embedding",
"sublabel": "Ollama :11434",
"tag": "volume embedding-models",
"pos": [
820,
640
],
"size": [
170,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 230,
"end_line": 249
}
]
},
{
"id": "modelinit",
"type": "backend",
"label": "embedding-model-init",
"sublabel": "one-shot, scarica il modello",
"pos": [
1080,
640
],
"size": [
190,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 251,
"end_line": 264
}
]
},
{
"id": "volumes",
"type": "database",
"label": "Volumi core",
"sublabel": "sessions, settings, pi-state, auth-state",
"tag": "+ workspace-registry/secrets",
"pos": [
500,
560
],
"size": [
270,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 42,
"end_line": 50
},
{
"path": "compose.yaml",
"line": 269,
"end_line": 278
}
]
},
{
"id": "secrets",
"type": "security",
"label": "Secret + config",
"sublabel": "thothii.secrets, installation.yaml",
"pos": [
230,
560
],
"size": [
230,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 51,
"end_line": 57
},
{
"path": "compose.yaml",
"line": 280,
"end_line": 290
}
]
},
{
"id": "git",
"type": "cloud",
"label": "Git remote workspace",
"sublabel": "THT_WORKSPACE_GIT_REMOTE",
"pos": [
290,
190
],
"size": [
200,
64
],
"sources": [
{
"path": "backend/src/workspaces/git-repository.ts",
"line": 185,
"end_line": 195,
"label": "clone / refresh"
}
]
},
{
"id": "dwh",
"type": "cloud",
"label": "DWH",
"sublabel": "Postgres o REST, sola lettura",
"pos": [
820,
190
],
"size": [
190,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 36,
"end_line": 37
}
]
},
{
"id": "llm",
"type": "cloud",
"label": "Provider LLM",
"sublabel": "THT_LLM_URL",
"pos": [
820,
40
],
"size": [
170,
64
],
"sources": [
{
"path": "compose.yaml",
"line": 38,
"end_line": 38
}
]
}
],
"boundaries": [
{
"kind": "region",
"label": "rete Compose thothii",
"wraps": [
"frontend",
"core",
"catalogdb",
"migrate",
"qdrant",
"maint",
"embedding",
"modelinit",
"volumes",
"secrets"
]
}
],
"connections": [
{
"id": "op-cli",
"from": "operator",
"to": "thtcli",
"label": "comandi"
},
{
"id": "cli-core",
"from": "thtcli",
"to": "core",
"label": "compose up",
"variant": "dashed"
},
{
"id": "br-fe",
"from": "browser",
"to": "frontend",
"label": "HTTPS",
"variant": "emphasis"
},
{
"id": "fe-core",
"from": "frontend",
"to": "core",
"label": "/api",
"variant": "emphasis"
},
{
"id": "core-db",
"from": "core",
"to": "catalogdb",
"label": "SQL",
"variant": "emphasis"
},
{
"id": "mig-db",
"from": "migrate",
"to": "catalogdb",
"label": "migra"
},
{
"id": "core-qd",
"from": "core",
"to": "qdrant",
"label": "HTTP"
},
{
"id": "core-emb",
"from": "core",
"to": "embedding",
"label": "embed"
},
{
"id": "maint-qd",
"from": "maint",
"to": "qdrant",
"label": "reindicizza"
},
{
"id": "init-emb",
"from": "modelinit",
"to": "embedding",
"label": "pull"
},
{
"id": "core-vol",
"from": "core",
"to": "volumes",
"label": "monta"
},
{
"id": "sec-core",
"from": "secrets",
"to": "core",
"label": "/run/secrets",
"variant": "security"
},
{
"id": "core-git",
"from": "core",
"to": "git",
"label": "clone"
},
{
"id": "core-dwh",
"from": "core",
"to": "dwh",
"label": "read-only"
},
{
"id": "core-llm",
"from": "core",
"to": "llm",
"label": "API modelli"
}
],
"cards": [
{
"dot": "cyan",
"title": "Avvio",
"items": [
"tht start sul host esegue docker compose con base + profilo (local o server)",
"catalog-migrate ed embedding-model-init girano una volta prima del core",
"Il core parte solo con catalog-db e qdrant sani e il modello di embedding scaricato"
]
},
{
"dot": "amber",
"title": "Profili",
"items": [
"local: porte solo su 127.0.0.1 (frontend 8080, core 8787, Qdrant 6333)",
"server: espone solo il frontend dietro il proxy autenticato",
"workspace-maintenance gira on demand: preprocessing ed Evidence"
]
},
{
"dot": "rose",
"title": "Confini",
"items": [
"DWH, provider LLM e Git remote sono esterni alla rete Compose",
"I secret arrivano come Docker secrets, mai in variabili o YAML"
]
}
]
}
File diff suppressed because one or more lines are too long
+88
View File
@@ -0,0 +1,88 @@
<!doctype html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Diagrammi ThothII</title>
<style>
:root {
--bg: #f6f7f9; --surface: #ffffff; --text: #18202b; --muted: #5b6676;
--border: #e1e5eb; --accent: #0e7490; --chip: #eef6f8;
}
@media (prefers-color-scheme: dark) {
:root { --bg: #11151b; --surface: #1a2028; --text: #e7ebf0; --muted: #9aa5b3;
--border: #2a323d; --accent: #5ec4d8; --chip: #1d2a31; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1080px; margin: 0 auto; padding: 40px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 6px; }
.intro { color: var(--muted); margin: 0 0 32px; max-width: 70ch; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
margin: 32px 0 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
a.card { display: block; text-decoration: none; color: inherit; background: var(--surface);
border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
a.card:hover { border-color: var(--accent); }
.title { font-weight: 600; }
.kind { display: inline-block; font-size: 11px; font-family: ui-monospace, monospace;
background: var(--chip); color: var(--accent); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.desc { color: var(--muted); font-size: 14px; margin-top: 4px; }
footer { margin-top: 40px; color: var(--muted); font-size: 13px; }
</style>
</head>
<body>
<main>
<h1>Diagrammi dell'architettura ThothII</h1>
<p class="intro">Diagrammi interattivi generati con Archify a partire dal codice. Ogni elemento
rimanda ai file e alle righe da cui deriva. Il sorgente JSON di ogni diagramma è nella stessa
cartella, con lo stesso nome.</p>
<h2>Panoramica</h2>
<div class="grid">
<a class="card" href="thothii-runtime.html"><span class="title">Architettura runtime</span><span class="kind">architecture</span>
<div class="desc">Frontend, backend, Pi, estensione gate, CLI tht e servizi collegati.</div></a>
<a class="card" href="thothii-deployment.html"><span class="title">Deployment Docker Compose</span><span class="kind">architecture</span>
<div class="desc">Servizi, one-shot, volumi, secret, endpoint esterni e CLI host.</div></a>
<a class="card" href="thothii-modules.html"><span class="title">Struttura dei moduli</span><span class="kind">tree</span>
<div class="desc">Cartelle principali del repository e loro ruolo.</div></a>
</div>
<h2>Workflow e sessioni</h2>
<div class="grid">
<a class="card" href="thothii-phases.html"><span class="title">Workflow in 8 fasi</span><span class="kind">workflow</span>
<div class="desc">F1–F8, gate del reviewer, salti automatici e ritorno indietro.</div></a>
<a class="card" href="thothii-session-lifecycle.html"><span class="title">Ciclo di vita della sessione</span><span class="kind">lifecycle</span>
<div class="desc">open, closed, failed, finalized, archiviazione e cancellazione.</div></a>
<a class="card" href="thothii-new-question.html"><span class="title">Avvio di una nuova domanda</span><span class="kind">sequence</span>
<div class="desc">Dalla domanda al primo turno F1 con streaming SSE.</div></a>
<a class="card" href="thothii-gate-roundtrip.html"><span class="title">Andata e ritorno di un gate</span><span class="kind">sequence</span>
<div class="desc">Widget, risposta del reviewer, decisione nel ledger.</div></a>
<a class="card" href="thothii-resume.html"><span class="title">Ripresa di una sessione</span><span class="kind">sequence</span>
<div class="desc">Riapertura e ricostruzione del contesto dallo stato su disco.</div></a>
</div>
<h2>Backend e sicurezza</h2>
<div class="grid">
<a class="card" href="thothii-session-runtime.html"><span class="title">Classi del runtime di sessione</span><span class="kind">class</span>
<div class="desc">PiProcessManager, SessionBridge, RpcClient, SseHub, ThtRunner.</div></a>
<a class="card" href="thothii-auth-oidc.html"><span class="title">Login OIDC e richieste autenticate</span><span class="kind">sequence</span>
<div class="desc">Authorization Code + PKCE, sessione browser e controlli per richiesta.</div></a>
</div>
<h2>Dati e Metadata Catalog</h2>
<div class="grid">
<a class="card" href="thothii-metadata-flow.html"><span class="title">Dai metadati al contesto di sessione</span><span class="kind">dataflow</span>
<div class="desc">DWH, catalogo, preprocessing, indici LSH e Qdrant, search pack, memoria.</div></a>
<a class="card" href="thothii-metadata-catalog.html"><span class="title">Schema del Metadata Catalog</span><span class="kind">erd</span>
<div class="desc">14 tabelle PostgreSQL ricostruite dalle migrazioni.</div></a>
<a class="card" href="thothii-catalog-sync.html"><span class="title">Sincronizzazione dello schema</span><span class="kind">lifecycle</span>
<div class="desc">Stati dei run di sync, conferma delle modifiche distruttive.</div></a>
</div>
<footer>Per rigenerare un diagramma: modificare il suo JSON e rieseguire
<code>archify finalize</code> con <code>--repo-root</code> sulla radice del repository.</footer>
</main>
</body>
</html>
File diff suppressed because one or more lines are too long
@@ -0,0 +1,332 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "ThothII — andata e ritorno di un gate reviewer",
"locale": "it",
"output": "docs/architecture/thothii-gate-roundtrip.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"participants": [
{
"id": "reviewer",
"type": "external",
"label": "Reviewer",
"sublabel": "browser"
},
{
"id": "frontend",
"type": "frontend",
"label": "Frontend",
"sublabel": "React",
"sources": [
{
"path": "frontend/src/store/sessionStore.ts",
"line": 76,
"end_line": 90,
"label": "pendingWidget"
},
{
"path": "frontend/src/widgets/registry.ts",
"line": 5,
"end_line": 13,
"label": "registry widget"
},
{
"path": "frontend/src/api/sessions.ts",
"line": 130,
"end_line": 134,
"label": "postResponse"
}
]
},
{
"id": "backend",
"type": "backend",
"label": "Backend",
"sublabel": "SessionBridge",
"sources": [
{
"path": "backend/src/bridge/session-bridge.ts",
"line": 63,
"end_line": 71,
"label": "ui_request"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 634,
"end_line": 662,
"label": "POST /response"
},
{
"path": "backend/src/bridge/session-bridge.ts",
"line": 178,
"end_line": 188,
"label": "respond"
}
]
},
{
"id": "pi",
"type": "backend",
"label": "Pi",
"sublabel": "--mode rpc"
},
{
"id": "gate",
"type": "backend",
"label": "tht-gate.js",
"sublabel": "reviewer_select",
"sources": [
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 924,
"end_line": 942,
"label": "execute"
},
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 597,
"end_line": 603,
"label": "emitAndWait"
},
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 465,
"end_line": 468,
"label": "advanceIfReady"
}
]
},
{
"id": "tht",
"type": "backend",
"label": "tht CLI",
"sublabel": "ledger",
"sources": [
{
"path": "harness/tht/decisions.py",
"line": 98,
"end_line": 120,
"label": "append_decision"
},
{
"path": "harness/tht/phase.py",
"line": 60,
"end_line": 79,
"label": "current_phase"
}
]
},
{
"id": "llm",
"type": "cloud",
"label": "Provider LLM",
"sublabel": "modello di sessione"
}
],
"segments": [
{
"from": 160,
"to": 420,
"label": "Proposta"
},
{
"from": 428,
"to": 600,
"label": "Decisione"
},
{
"from": 608,
"to": 790,
"label": "Persistenza"
}
],
"messages": [
{
"id": "call",
"from": "llm",
"to": "pi",
"y": 170,
"label": "tool call",
"variant": "return"
},
{
"id": "exec",
"from": "pi",
"to": "gate",
"y": 200,
"label": "reviewer_select"
},
{
"id": "input",
"from": "gate",
"to": "pi",
"y": 230,
"label": "ctx.ui.input",
"note": "descrittore widget come JSON"
},
{
"id": "uireq",
"from": "pi",
"to": "backend",
"y": 290,
"label": "extension_ui_request",
"variant": "dashed",
"note": "con l'id RPC di Pi"
},
{
"id": "sse",
"from": "backend",
"to": "frontend",
"y": 350,
"label": "SSE ui_request",
"variant": "dashed",
"note": "il bridge ricorda l'id di Pi"
},
{
"id": "widget",
"from": "frontend",
"to": "reviewer",
"y": 410,
"label": "widget",
"variant": "return"
},
{
"id": "pick",
"from": "reviewer",
"to": "frontend",
"y": 440,
"label": "scelta"
},
{
"id": "post",
"from": "frontend",
"to": "backend",
"y": 470,
"label": "POST /response",
"variant": "emphasis",
"note": "409 se il gate non è quello in attesa"
},
{
"id": "ok",
"from": "backend",
"to": "frontend",
"y": 530,
"label": "204",
"variant": "return"
},
{
"id": "uiresp",
"from": "backend",
"to": "pi",
"y": 560,
"label": "extension_ui_response",
"variant": "emphasis"
},
{
"id": "value",
"from": "pi",
"to": "gate",
"y": 620,
"label": "risposta",
"variant": "return"
},
{
"id": "add",
"from": "gate",
"to": "tht",
"y": 650,
"label": "decision add",
"variant": "emphasis",
"note": "accoda a review_decisions.jsonl"
},
{
"id": "advance",
"from": "gate",
"to": "tht",
"y": 720,
"label": "phase advance --auto",
"variant": "dashed"
},
{
"id": "result",
"from": "gate",
"to": "pi",
"y": 750,
"label": "risultato tool",
"variant": "return"
},
{
"id": "next",
"from": "pi",
"to": "llm",
"y": 780,
"label": "turno successivo",
"variant": "emphasis"
}
],
"activations": [
{
"participant": "pi",
"from": 165,
"to": 786,
"type": "backend"
},
{
"participant": "gate",
"from": 198,
"to": 756,
"type": "backend"
},
{
"participant": "backend",
"from": 288,
"to": 566,
"type": "backend"
},
{
"participant": "frontend",
"from": 348,
"to": 536,
"type": "frontend"
},
{
"participant": "tht",
"from": 648,
"to": 726,
"type": "backend"
}
],
"cards": [
{
"dot": "cyan",
"title": "Correlazione",
"items": [
"Pi correla la risposta sul proprio id RPC, non sull'id del descrittore",
"Il bridge rimanda l'id di Pi; il valore contiene l'id del descrittore per il controllo del gate"
]
},
{
"dot": "emerald",
"title": "Persistenza",
"items": [
"Un'opzione con payload decision è già la conferma: il gate la scrive con tht decision add",
"Un'opzione senza payload chiede soltanto e non scrive nulla",
"phase advance --auto avanza solo se la fase è completa"
]
},
{
"dot": "amber",
"title": "Altri widget",
"items": [
"reviewer_decide (scelta multipla) e reviewer_confirm (artefatto o fase) seguono lo stesso percorso"
]
}
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,388 @@
{
"schema_version": 1,
"diagram_type": "dataflow",
"meta": {
"title": "ThothII — dai metadati del DWH al contesto di sessione",
"locale": "it",
"output": "docs/architecture/thothii-metadata-flow.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"stages": [
{
"label": "Fonti"
},
{
"label": "Catalogo"
},
{
"label": "Preprocessing"
},
{
"label": "Indici"
},
{
"label": "Sessione"
}
],
"nodes": [
{
"id": "dwh",
"type": "database",
"label": "DWH",
"sublabel": "sola lettura",
"stage": 0,
"row": 0,
"sources": [
{
"path": "backend/src/catalog/sync-worker.ts",
"line": 210,
"end_line": 220,
"label": "scan schema"
},
{
"path": "backend/src/catalog/description-source-sampler.ts",
"line": 153,
"end_line": 160,
"label": "campionamento"
}
]
},
{
"id": "gitws",
"type": "cloud",
"label": "Workspace Git",
"sublabel": "fonti Evidence",
"stage": 0,
"row": 2,
"sources": [
{
"path": "backend/src/workspaces/git-repository.ts",
"line": 185,
"end_line": 195
}
]
},
{
"id": "catalog",
"type": "database",
"label": "Metadata Catalog",
"sublabel": "PostgreSQL",
"stage": 1,
"row": 0,
"sources": [
{
"path": "backend/src/catalog/repository.ts",
"line": 488,
"end_line": 488,
"label": "KyselyCatalogRepository"
}
]
},
{
"id": "descgen",
"type": "backend",
"label": "Descrizioni AI",
"sublabel": "helper LiteLLM",
"stage": 1,
"row": 1,
"sources": [
{
"path": "backend/src/catalog/model-completer.ts",
"line": 67,
"end_line": 74
},
{
"path": "backend/src/catalog/migrations/005_description_generation_runs.ts",
"line": 5,
"end_line": 5,
"label": "run"
}
]
},
{
"id": "memdb",
"type": "database",
"label": "Card memoria",
"sublabel": "schema thoth_memory",
"stage": 4,
"row": 0,
"sources": [
{
"path": "harness/tht/memory/repository.py",
"line": 15,
"end_line": 15,
"label": "MemoryRepository"
},
{
"path": "harness/tht/memory/migrate.py",
"line": 46,
"end_line": 50
}
]
},
{
"id": "snapshot",
"type": "backend",
"label": "Snapshot catalogo",
"sublabel": "JSON immutabile",
"stage": 2,
"row": 0,
"sources": [
{
"path": "backend/src/workspaces/preprocessing-service.ts",
"line": 289,
"end_line": 301
}
]
},
{
"id": "prep",
"type": "backend",
"label": "preprocess catalog",
"sublabel": "tht + embedding",
"stage": 2,
"row": 1,
"sources": [
{
"path": "backend/src/workspaces/preprocessing-service.ts",
"line": 321,
"end_line": 329
},
{
"path": "harness/tht/cli/preprocess_cmd.py",
"line": 523,
"end_line": 545
}
]
},
{
"id": "evprep",
"type": "backend",
"label": "preprocess Evidence",
"sublabel": "corpus + embedding",
"stage": 2,
"row": 2,
"sources": [
{
"path": "backend/src/workspaces/preprocessing-service.ts",
"line": 330,
"end_line": 339
}
]
},
{
"id": "lsh",
"type": "database",
"label": "Indice LSH",
"sublabel": "valori delle colonne",
"stage": 3,
"row": 1,
"sources": [
{
"path": "harness/tht/cli/preprocess_cmd.py",
"line": 167,
"end_line": 193
}
]
},
{
"id": "qref",
"type": "database",
"label": "Qdrant reference",
"sublabel": "schema + Evidence",
"stage": 3,
"row": 2,
"sources": [
{
"path": "harness/tht/adapters/vector/qdrant.py",
"line": 327,
"end_line": 327,
"label": "upsert"
}
]
},
{
"id": "qmem",
"type": "database",
"label": "Qdrant memory",
"sublabel": "dense + BM25",
"stage": 3,
"row": 0,
"sources": [
{
"path": "harness/tht/memory/repository.py",
"line": 225,
"end_line": 235,
"label": "proiezioni"
}
]
},
{
"id": "pack",
"type": "backend",
"label": "search pack",
"sublabel": "retrieval_pack.md",
"stage": 4,
"row": 2,
"sources": [
{
"path": "harness/tht/cli/search_cmd.py",
"line": 351,
"end_line": 420
}
]
},
{
"id": "session",
"type": "frontend",
"label": "Sessione F1–F8",
"sublabel": "search find in F4",
"stage": 4,
"row": 1,
"sources": [
{
"path": "harness/tht/cli/search_cmd.py",
"line": 129,
"end_line": 131,
"label": "search find"
},
{
"path": "harness/tht/cli/search_cmd.py",
"line": 219,
"end_line": 226,
"label": "usa LSH"
}
]
}
],
"flows": [
{
"id": "dwh-catalog",
"from": "dwh",
"to": "catalog",
"label": "sync schema",
"variant": "emphasis"
},
{
"id": "dwh-desc",
"from": "dwh",
"to": "descgen",
"label": "campioni",
"variant": "security"
},
{
"id": "desc-catalog",
"from": "descgen",
"to": "catalog",
"label": "descrizioni"
},
{
"id": "catalog-snap",
"from": "catalog",
"to": "snapshot",
"label": "metadati",
"variant": "emphasis"
},
{
"id": "snap-prep",
"from": "snapshot",
"to": "prep",
"label": "file snapshot"
},
{
"id": "prep-lsh",
"from": "prep",
"to": "lsh",
"label": "MinHash"
},
{
"id": "prep-qref",
"from": "prep",
"to": "qref",
"label": "vettori schema",
"variant": "emphasis"
},
{
"id": "git-ev",
"from": "gitws",
"to": "evprep",
"label": "fonti Evidence"
},
{
"id": "ev-qref",
"from": "evprep",
"to": "qref",
"label": "vettori Evidence"
},
{
"id": "mem-qmem",
"from": "memdb",
"to": "qmem",
"label": "proiezione",
"variant": "dashed"
},
{
"id": "qref-pack",
"from": "qref",
"to": "pack",
"label": "ricerca ibrida",
"variant": "emphasis"
},
{
"id": "qmem-pack",
"from": "qmem",
"to": "pack",
"label": "domande risolte"
},
{
"id": "pack-session",
"from": "pack",
"to": "session",
"label": "contesto F1",
"variant": "emphasis"
},
{
"id": "lsh-session",
"from": "lsh",
"to": "session",
"label": "valori"
},
{
"id": "session-mem",
"from": "session",
"to": "memdb",
"label": "promozione F8",
"variant": "dashed"
}
],
"cards": [
{
"dot": "cyan",
"title": "Autorità",
"items": [
"Il Metadata Catalog è l'unica fonte dei metadati di database per tutto il core",
"Il preprocessing lavora su uno snapshot immutabile del catalogo, non sul DWH"
]
},
{
"dot": "amber",
"title": "Collezioni separate",
"items": [
"reference (schema, relazioni, Evidence) può essere svuotata e ricostruita dal preprocessing",
"memory si ricostruisce dalle card PostgreSQL e non viene toccata dal preprocessing"
]
},
{
"dot": "rose",
"title": "Prerequisito",
"items": [
"Senza preprocessing completato il core non ammette nuove sessioni"
]
}
]
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+384
View File
@@ -0,0 +1,384 @@
{
"schema_version": 1,
"diagram_type": "tree",
"meta": {
"title": "ThothII — struttura dei moduli",
"locale": "it",
"output": "docs/architecture/thothii-modules.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"layout": {
"direction": "right"
},
"nodes": [
{
"id": "root",
"label": "ThothII",
"sublabel": "monorepo, tre layer + operatore",
"sources": [
{
"path": "AGENTS.md",
"line": 1
}
]
},
{
"id": "frontend",
"label": "frontend/",
"parent": "root",
"sublabel": "React 18 + Vite",
"sources": [
{
"path": "frontend/src/main.tsx",
"line": 1
}
]
},
{
"id": "fe_api",
"label": "src/api",
"parent": "frontend",
"sublabel": "client HTTP verso /api",
"sources": [
{
"path": "frontend/src/api/client.ts",
"line": 1
}
]
},
{
"id": "fe_shell",
"label": "src/shell",
"parent": "frontend",
"sublabel": "AppShell e pagine admin",
"sources": [
{
"path": "frontend/src/shell/AppShell.tsx",
"line": 1
}
]
},
{
"id": "fe_store",
"label": "src/store + stream",
"parent": "frontend",
"sublabel": "transcript live da SSE",
"sources": [
{
"path": "frontend/src/store/sessionStore.ts",
"line": 1
}
]
},
{
"id": "fe_widgets",
"label": "src/widgets",
"parent": "frontend",
"sublabel": "widget dei gate reviewer",
"sources": [
{
"path": "frontend/src/widgets/registry.ts",
"line": 1
}
]
},
{
"id": "fe_i18n",
"label": "src/i18n",
"parent": "frontend",
"sublabel": "cataloghi EN/IT"
},
{
"id": "backend",
"label": "backend/",
"parent": "root",
"sublabel": "Fastify + TypeScript",
"sources": [
{
"path": "backend/src/server.ts",
"line": 1
}
]
},
{
"id": "be_routes",
"label": "src/routes",
"parent": "backend",
"sublabel": "API REST e SSE",
"sources": [
{
"path": "backend/src/routes/sessions.ts",
"line": 1
}
]
},
{
"id": "be_bridge",
"label": "src/pi + rpc + bridge",
"parent": "backend",
"sublabel": "processi Pi e bridge RPC",
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 1
}
]
},
{
"id": "be_sse",
"label": "src/sse",
"parent": "backend",
"sublabel": "SseHub con replay",
"sources": [
{
"path": "backend/src/sse/sse-hub.ts",
"line": 1
}
]
},
{
"id": "be_tht",
"label": "src/tht",
"parent": "backend",
"sublabel": "ThtRunner: shell del CLI",
"sources": [
{
"path": "backend/src/tht/tht-runner.ts",
"line": 1
}
]
},
{
"id": "be_auth",
"label": "src/auth",
"parent": "backend",
"sublabel": "local, OIDC, upstream",
"sources": [
{
"path": "backend/src/auth/auth.ts",
"line": 1
}
]
},
{
"id": "be_catalog",
"label": "src/catalog",
"parent": "backend",
"sublabel": "Metadata Catalog, sync, descrizioni",
"sources": [
{
"path": "backend/src/catalog/service.ts",
"line": 1
}
]
},
{
"id": "be_ws",
"label": "src/workspaces",
"parent": "backend",
"sublabel": "registry Git e preprocessing",
"sources": [
{
"path": "backend/src/workspaces/preprocessing-service.ts",
"line": 1
}
]
},
{
"id": "harness",
"label": "harness/",
"parent": "root",
"sublabel": "workflow NL→SQL",
"sources": [
{
"path": "harness/README.md",
"line": 1
}
]
},
{
"id": "h_wf",
"label": "workflow.yaml",
"parent": "harness",
"sublabel": "fasi F1–F8",
"sources": [
{
"path": "harness/workflow.yaml",
"line": 1
}
]
},
{
"id": "h_pi",
"label": ".pi/",
"parent": "harness",
"sublabel": "estensione gate, skill, prompt",
"sources": [
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 1
}
]
},
{
"id": "h_cli",
"label": "tht/cli",
"parent": "harness",
"sublabel": "sottocomandi del CLI tht",
"sources": [
{
"path": "harness/tht/cli/__init__.py",
"line": 1
}
]
},
{
"id": "h_session",
"label": "tht/session + phase",
"parent": "harness",
"sublabel": "manifest, ledger, fase",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 1
}
]
},
{
"id": "h_adapters",
"label": "tht/adapters",
"parent": "harness",
"sublabel": "DWH e Qdrant",
"sources": [
{
"path": "harness/tht/adapters/factory.py",
"line": 1
}
]
},
{
"id": "h_search",
"label": "tht/search + vectorstore",
"parent": "harness",
"sublabel": "retrieval ibrido",
"sources": [
{
"path": "harness/tht/vectorstore/embeddings.py",
"line": 1
}
]
},
{
"id": "h_memory",
"label": "tht/memory",
"parent": "harness",
"sublabel": "card e domande risolte",
"sources": [
{
"path": "harness/tht/memory/repository.py",
"line": 1
}
]
},
{
"id": "h_evidence",
"label": "tht/evidence",
"parent": "harness",
"sublabel": "corpus Evidence",
"sources": [
{
"path": "harness/tht/evidence/preprocessing.py",
"line": 1
}
]
},
{
"id": "h_mschema",
"label": "tht/mschema",
"parent": "harness",
"sublabel": "snapshot e schema per il modello",
"sources": [
{
"path": "harness/tht/mschema/catalog_snapshot.py",
"line": 1
}
]
},
{
"id": "tools",
"label": "tools/tht",
"parent": "root",
"sublabel": "CLI host in Go",
"sources": [
{
"path": "tools/tht/README.md",
"line": 1
}
]
},
{
"id": "t_cmd",
"label": "cmd/tht",
"parent": "tools",
"sublabel": "comandi operatore",
"sources": [
{
"path": "tools/tht/cmd/tht/main.go",
"line": 1
}
]
},
{
"id": "t_internal",
"label": "internal/",
"parent": "tools",
"sublabel": "compose, setup, doctor, auth",
"sources": [
{
"path": "tools/tht/internal/compose/runner.go",
"line": 1
}
]
},
{
"id": "deploy",
"label": "docker/ + deploy/",
"parent": "root",
"sublabel": "immagini e profili Compose",
"sources": [
{
"path": "compose.yaml",
"line": 1
}
]
},
{
"id": "docs",
"label": "docs/",
"parent": "root",
"sublabel": "MkDocs, ADR, contratti",
"sources": [
{
"path": "mkdocs.yml",
"line": 1
}
]
}
],
"cards": [
{
"dot": "cyan",
"title": "Lettura",
"items": [
"Le linee indicano contenimento, non chiamate",
"Alcuni nodi raggruppano più cartelle sorelle con lo stesso ruolo",
"Test, script e cartelle generate sono omessi"
]
}
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,381 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "ThothII — avvio di una nuova domanda",
"locale": "it",
"output": "docs/architecture/thothii-new-question.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"participants": [
{
"id": "reviewer",
"type": "external",
"label": "Reviewer",
"sublabel": "browser"
},
{
"id": "frontend",
"type": "frontend",
"label": "Frontend",
"sublabel": "React",
"sources": [
{
"path": "frontend/src/api/sessions.ts",
"line": 96,
"end_line": 115,
"label": "createSession"
},
{
"path": "frontend/src/stream/useSessionStream.ts",
"line": 117,
"end_line": 121,
"label": "EventSource"
}
]
},
{
"id": "backend",
"type": "backend",
"label": "Backend",
"sublabel": "Fastify",
"sources": [
{
"path": "backend/src/routes/sessions.ts",
"line": 481,
"end_line": 487,
"label": "precheck DWH"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 513,
"end_line": 570,
"label": "POST /sessions"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 334,
"end_line": 350,
"label": "bootstrap"
}
]
},
{
"id": "tht",
"type": "backend",
"label": "tht CLI",
"sublabel": "harness",
"sources": [
{
"path": "backend/src/tht/tht-runner.ts",
"line": 484,
"end_line": 500,
"label": "session new"
},
{
"path": "backend/src/tht/tht-runner.ts",
"line": 514,
"end_line": 518,
"label": "search pack"
},
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 277,
"end_line": 280,
"label": "execFileSync"
}
]
},
{
"id": "pi",
"type": "backend",
"label": "Pi",
"sublabel": "--mode rpc",
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 143,
"end_line": 146,
"label": "spawn"
},
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 263,
"end_line": 280,
"label": "configure"
},
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 283,
"end_line": 290,
"label": "prompt iniziale"
}
]
},
{
"id": "gate",
"type": "backend",
"label": "tht-gate.js",
"sublabel": "estensione Pi",
"sources": [
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 780,
"end_line": 795,
"label": "hook input"
},
{
"path": "harness/.pi/prompts/nuova-domanda.md",
"line": 1,
"end_line": 10,
"label": "template prompt"
}
]
},
{
"id": "llm",
"type": "cloud",
"label": "Provider LLM",
"sublabel": "modello di sessione"
}
],
"segments": [
{
"from": 160,
"to": 470,
"label": "Creazione sessione"
},
{
"from": 476,
"to": 595,
"label": "Bootstrap"
},
{
"from": 605,
"to": 875,
"label": "Primo turno (F1)"
}
],
"messages": [
{
"id": "ask",
"from": "reviewer",
"to": "frontend",
"y": 170,
"label": "domanda"
},
{
"id": "post",
"from": "frontend",
"to": "backend",
"y": 200,
"label": "POST /sessions",
"variant": "emphasis"
},
{
"id": "new",
"from": "backend",
"to": "tht",
"y": 230,
"label": "session new",
"note": "scrive il manifest e fissa la lingua"
},
{
"id": "new-ok",
"from": "tht",
"to": "backend",
"y": 315,
"label": "id sessione",
"variant": "return"
},
{
"id": "spawn",
"from": "backend",
"to": "pi",
"y": 345,
"label": "spawn processo",
"note": "un processo Pi per sessione"
},
{
"id": "id",
"from": "backend",
"to": "frontend",
"y": 395,
"label": "{ id }",
"variant": "return"
},
{
"id": "sse",
"from": "frontend",
"to": "backend",
"y": 425,
"label": "GET /events (SSE)",
"note": "l'hub conserva gli eventi già emessi per la riconnessione"
},
{
"id": "model",
"from": "backend",
"to": "pi",
"y": 485,
"label": "set_model + thinking"
},
{
"id": "pack",
"from": "backend",
"to": "tht",
"y": 515,
"label": "search pack",
"note": "in parallelo al modello"
},
{
"id": "prompt",
"from": "backend",
"to": "pi",
"y": 585,
"label": "prompt /nuova-domanda",
"variant": "emphasis"
},
{
"id": "hook",
"from": "pi",
"to": "gate",
"y": 615,
"label": "hook input"
},
{
"id": "turn",
"from": "pi",
"to": "llm",
"y": 645,
"label": "turno modello",
"variant": "emphasis"
},
{
"id": "tokens",
"from": "llm",
"to": "pi",
"y": 675,
"label": "token + tool call",
"variant": "return"
},
{
"id": "tool",
"from": "pi",
"to": "gate",
"y": 705,
"label": "tool call"
},
{
"id": "cli",
"from": "gate",
"to": "tht",
"y": 735,
"label": "tht phase / session",
"note": "scrive artefatti e ledger"
},
{
"id": "event",
"from": "pi",
"to": "backend",
"y": 805,
"label": "eventi RPC",
"variant": "dashed"
},
{
"id": "push",
"from": "backend",
"to": "frontend",
"y": 835,
"label": "SSE text_delta",
"variant": "dashed"
},
{
"id": "render",
"from": "frontend",
"to": "reviewer",
"y": 865,
"label": "transcript live",
"variant": "return"
}
],
"activations": [
{
"participant": "frontend",
"from": 195,
"to": 871,
"type": "frontend"
},
{
"participant": "backend",
"from": 200,
"to": 841,
"type": "backend"
},
{
"participant": "tht",
"from": 228,
"to": 321,
"type": "backend"
},
{
"participant": "tht",
"from": 513,
"to": 545,
"type": "backend"
},
{
"participant": "tht",
"from": 733,
"to": 775,
"type": "backend"
},
{
"participant": "pi",
"from": 343,
"to": 811,
"type": "backend"
},
{
"participant": "gate",
"from": 613,
"to": 779,
"type": "backend"
},
{
"participant": "llm",
"from": 643,
"to": 681,
"type": "cloud"
}
],
"cards": [
{
"dot": "cyan",
"title": "Ordine di avvio",
"items": [
"La sessione esiste su disco prima che Pi parta: il manifest è la fonte di verità",
"Il primo prompt parte solo dopo configurazione del modello e search pack"
]
},
{
"dot": "amber",
"title": "Precheck DWH",
"items": [
"In installazione locale il backend verifica il DWH prima di creare la sessione e risponde 503 se non è raggiungibile"
]
},
{
"dot": "emerald",
"title": "Stream",
"items": [
"Il bridge traduce gli eventi Pi in text_delta, info e ui_request",
"Il transcript vive solo nel browser; non viene salvato"
]
}
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,104 @@
{
"schema_version": 2,
"diagram_type": "workflow",
"meta": {
"title": "ThothII — workflow NL→SQL in 8 fasi",
"locale": "it",
"output": "docs/architecture/thothii-phases.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"lanes": [
{ "id": "domanda", "label": "Domanda" },
{ "id": "schema", "label": "Schema e sintesi" },
{ "id": "sql", "label": "SQL" },
{ "id": "chiusura", "label": "Chiusura" },
{ "id": "eccezioni", "label": "Ritorno indietro", "variant": "exception" }
],
"mainPath": ["f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "finalizzata"],
"nodes": [
{ "id": "f1", "lane": "domanda", "col": 0, "type": "frontend", "label": "F1 chiarimento", "sublabel": "concetti e ambiguità", "tag": "gate fase",
"sources": [
{ "path": "harness/workflow.yaml", "line": 13, "end_line": 18 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 57, "end_line": 57 }
] },
{ "id": "f2", "lane": "domanda", "col": 1, "type": "database", "label": "F2 memoria", "sublabel": "memorie e esempi risolti", "tag": "auto se vuota",
"sources": [
{ "path": "harness/workflow.yaml", "line": 19, "end_line": 24 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 58, "end_line": 58 }
] },
{ "id": "f3", "lane": "domanda", "col": 2, "type": "frontend", "label": "F3 riscrittura", "sublabel": "question.md", "tag": "si chiude da sola",
"sources": [
{ "path": "harness/workflow.yaml", "line": 25, "end_line": 31 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 59, "end_line": 59 }
] },
{ "id": "f4", "lane": "schema", "col": 2, "type": "frontend", "label": "F4 schema linking", "sublabel": "schema_linking.json", "tag": "reviewer_decide",
"sources": [
{ "path": "harness/workflow.yaml", "line": 32, "end_line": 39 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 60, "end_line": 60 }
] },
{ "id": "f5", "lane": "schema", "col": 3, "type": "frontend", "label": "F5 sintesi", "sublabel": "valida SchemaLinking", "tag": "gate fase",
"sources": [
{ "path": "harness/workflow.yaml", "line": 40, "end_line": 46 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 61, "end_line": 61 }
] },
{ "id": "f6", "lane": "sql", "col": 3, "type": "backend", "label": "F6 CTE", "sublabel": "piano, CTE e test", "tag": "ultima CTE chiude",
"sources": [
{ "path": "harness/workflow.yaml", "line": 47, "end_line": 55 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 62, "end_line": 62 }
] },
{ "id": "f7", "lane": "sql", "col": 4, "type": "backend", "label": "F7 SQL finale", "sublabel": "sql_final.sql", "tag": "kind sql chiude",
"sources": [
{ "path": "harness/workflow.yaml", "line": 56, "end_line": 62 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 63, "end_line": 63 }
] },
{ "id": "f8", "lane": "chiusura", "col": 4, "type": "database", "label": "F8 datamart", "sublabel": "promozione memorie", "tag": "si chiude da sola",
"sources": [
{ "path": "harness/workflow.yaml", "line": 63, "end_line": 72 },
{ "path": "harness/.pi/skills/tht-sessione/SKILL.md", "line": 64, "end_line": 64 }
] },
{ "id": "finalizzata", "lane": "chiusura", "col": 5, "type": "external", "label": "Sessione finalizzata", "sublabel": "tht session finalize",
"sources": [
{ "path": "harness/.pi/extensions/tht-gate.js", "line": 1650, "end_line": 1666, "label": "advancePhaseAndFinalize" }
] },
{ "id": "riapertura", "lane": "eccezioni", "col": 1, "type": "security", "label": "Riapertura fase", "sublabel": "/torna → phase reopen", "tag": "phase_reopened",
"sources": [
{ "path": "harness/.pi/extensions/tht-gate.js", "line": 1775, "end_line": 1814, "label": "comando /torna" },
{ "path": "harness/tht/phase.py", "line": 60, "end_line": 79, "label": "fold con reopen" }
] }
],
"edges": [
{ "id": "f1-f2", "from": "f1", "to": "f2", "variant": "emphasis" },
{ "id": "f2-f3", "from": "f2", "to": "f3", "variant": "emphasis" },
{ "id": "f3-f4", "from": "f3", "to": "f4", "variant": "emphasis" },
{ "id": "f4-f5", "from": "f4", "to": "f5", "variant": "emphasis" },
{ "id": "f5-f6", "from": "f5", "to": "f6", "variant": "emphasis" },
{ "id": "f6-f7", "from": "f6", "to": "f7", "variant": "emphasis" },
{ "id": "f7-f8", "from": "f7", "to": "f8", "variant": "emphasis" },
{ "id": "f8-fin", "from": "f8", "to": "finalizzata", "label": "finalize", "variant": "emphasis" },
{ "id": "torna", "from": "f7", "to": "riapertura", "label": "/torna", "variant": "dashed", "role": "error" },
{ "id": "riapre", "from": "riapertura", "to": "f1", "label": "fase N < corrente", "variant": "dashed", "role": "return" }
],
"cards": [
{ "dot": "cyan", "title": "Chi decide", "items": [
"Il modello propone, il reviewer decide tramite widget, tht persiste",
"Gate fase (F1, F2 con memorie, F5): il reviewer conferma che la fase è completa",
"F3, F4, ultima CTE di F6, F7 e F8: l'approvazione sostanziale chiude la fase da sola"
] },
{ "dot": "emerald", "title": "Fase corrente", "items": [
"Non è salvata: si calcola ripercorrendo il ledger review_decisions.jsonl",
"phase_approved avanza solo la fase corrente; phase_reopened riporta indietro"
] },
{ "dot": "amber", "title": "Salti automatici", "items": [
"F2 avanza da sola se non ci sono memorie pertinenti",
"F6 può essere saltata (phase_skipped) o essere vuota"
] },
{ "dot": "rose", "title": "Ritorno indietro", "items": [
"/torna è disponibile da qualunque fase verso una fase precedente; qui è mostrato da F7 come esempio"
] }
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,256 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "ThothII — ripresa di una sessione",
"locale": "it",
"output": "docs/architecture/thothii-resume.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"participants": [
{
"id": "reviewer",
"type": "external",
"label": "Reviewer",
"sublabel": "browser"
},
{
"id": "frontend",
"type": "frontend",
"label": "Frontend",
"sublabel": "React"
},
{
"id": "backend",
"type": "backend",
"label": "Backend",
"sublabel": "Fastify",
"sources": [
{
"path": "backend/src/routes/sessions.ts",
"line": 685,
"end_line": 698,
"label": "409 se in sola lettura"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 774,
"end_line": 809,
"label": "reopen + nuovo runtime"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 820,
"end_line": 829,
"label": "bootstrap senza search pack"
}
]
},
{
"id": "tht",
"type": "backend",
"label": "tht CLI",
"sublabel": "sessione su disco",
"sources": [
{
"path": "backend/src/tht/tht-runner.ts",
"line": 569,
"end_line": 569,
"label": "session reopen"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 206,
"end_line": 216,
"label": "locateSession"
}
]
},
{
"id": "pi",
"type": "backend",
"label": "Pi",
"sublabel": "nuovo processo",
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 283,
"end_line": 290,
"label": "/riprendi-sessione"
},
{
"path": "harness/.pi/skills/tht-sessione/SKILL.md",
"line": 164,
"end_line": 185,
"label": "Phase 0 Resume"
}
]
},
{
"id": "llm",
"type": "cloud",
"label": "Provider LLM",
"sublabel": "modello salvato"
}
],
"segments": [
{
"from": 160,
"to": 438,
"label": "Richiesta"
},
{
"from": 448,
"to": 540,
"label": "Bootstrap"
},
{
"from": 550,
"to": 858,
"label": "Ricostruzione"
}
],
"messages": [
{
"from": "reviewer",
"to": "frontend",
"y": 170,
"label": "riprendi sessione"
},
{
"from": "frontend",
"to": "backend",
"y": 200,
"label": "POST /sessions/:id/resume",
"variant": "emphasis"
},
{
"from": "backend",
"to": "tht",
"y": 230,
"label": "session show",
"note": "409 se finalizzata o archiviata"
},
{
"from": "tht",
"to": "backend",
"y": 296,
"label": "manifest",
"variant": "return"
},
{
"from": "backend",
"to": "tht",
"y": 326,
"label": "session reopen"
},
{
"from": "backend",
"to": "pi",
"y": 356,
"label": "spawn",
"note": "sostituisce il runtime fermo"
},
{
"from": "backend",
"to": "frontend",
"y": 422,
"label": "200 { id }",
"variant": "return"
},
{
"from": "backend",
"to": "pi",
"y": 458,
"label": "set_model + thinking",
"note": "niente search pack: il contesto è su disco"
},
{
"from": "backend",
"to": "pi",
"y": 524,
"label": "prompt /riprendi-sessione",
"variant": "emphasis"
},
{
"from": "pi",
"to": "llm",
"y": 560,
"label": "turno modello",
"variant": "emphasis"
},
{
"from": "llm",
"to": "pi",
"y": 590,
"label": "tool call",
"variant": "return"
},
{
"from": "pi",
"to": "tht",
"y": 620,
"label": "tht session show",
"note": "fase corrente, stato e lingua"
},
{
"from": "pi",
"to": "tht",
"y": 686,
"label": "tht session documents",
"note": "artefatti già prodotti"
},
{
"from": "tht",
"to": "pi",
"y": 752,
"label": "artefatti + ledger",
"variant": "return"
},
{
"from": "pi",
"to": "backend",
"y": 782,
"label": "gate della fase N",
"variant": "dashed"
},
{
"from": "backend",
"to": "frontend",
"y": 812,
"label": "SSE ui_request",
"variant": "dashed"
},
{
"from": "frontend",
"to": "reviewer",
"y": 842,
"label": "riprende dalla fase N",
"variant": "return"
}
],
"cards": [
{
"dot": "cyan",
"title": "Stato su disco",
"items": [
"Pi riparte senza conversazione: manifest, artefatti e ledger sono l'unico contesto",
"La fase corrente si ricalcola dal ledger"
]
},
{
"dot": "amber",
"title": "Casi particolari",
"items": [
"Se il runtime è ancora attivo la risposta è alreadyActive e non si riavvia nulla",
"La lingua di interazione resta quella salvata; non si può cambiare alla ripresa",
"Il prompt sbagliato (/nuova-domanda) trasformerebbe la ripresa in una nuova domanda"
]
}
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,229 @@
{
"schema_version": 3,
"diagram_type": "lifecycle",
"meta": {
"title": "ThothII — ciclo di vita di una sessione",
"locale": "it",
"output": "docs/architecture/thothii-session-lifecycle.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"mainPath": [
"open",
"finalized",
"archived"
],
"states": [
{
"id": "open",
"type": "start",
"label": "open",
"sublabel": "fasi F1–F8 in corso",
"tag": "riprendibile",
"step": "01",
"sources": [
{
"path": "harness/tht/session/models.py",
"line": 107,
"end_line": 107,
"label": "status"
},
{
"path": "harness/tht/session/store.py",
"line": 524,
"end_line": 533,
"label": "reopen_session"
}
]
},
{
"id": "finalized",
"type": "success",
"label": "finalized",
"sublabel": "SQL verificato sul DWH",
"tag": "sola lettura",
"step": "02",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 570,
"end_line": 592,
"label": "persist_verified_finalization"
},
{
"path": "harness/.pi/extensions/tht-gate.js",
"line": 1650,
"end_line": 1666,
"label": "finalize automatico"
}
]
},
{
"id": "archived",
"type": "neutral",
"label": "archiviata",
"sublabel": "flag archived",
"tag": "nascosta",
"step": "03",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 556,
"end_line": 562,
"label": "set_archived"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 928,
"end_line": 937,
"label": "POST /archive"
}
]
},
{
"id": "closed",
"type": "waiting",
"label": "closed",
"sublabel": "processo Pi fermato",
"tag": "riprendibile",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 506,
"end_line": 512,
"label": "close_session"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 832,
"end_line": 850,
"label": "POST /close"
}
]
},
{
"id": "failed",
"type": "failure",
"label": "failed",
"sublabel": "bootstrap o Pi falliti",
"tag": "riprendibile",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 515,
"end_line": 521,
"label": "fail_session"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 355,
"end_line": 366,
"label": "bootstrap fallito"
}
]
},
{
"id": "deleted",
"type": "neutral",
"label": "cancellata",
"sublabel": "directory rimossa",
"sources": [
{
"path": "harness/tht/session/store.py",
"line": 564,
"end_line": 568,
"label": "delete_session"
},
{
"path": "backend/src/routes/sessions.ts",
"line": 948,
"end_line": 968,
"label": "DELETE /sessions/:id"
}
]
}
],
"transitions": [
{
"id": "open-finalized",
"from": "open",
"to": "finalized",
"label": "F8 chiusa",
"variant": "emphasis"
},
{
"id": "finalized-archived",
"from": "finalized",
"to": "archived",
"label": "archive"
},
{
"id": "open-closed",
"from": "open",
"to": "closed",
"label": "close"
},
{
"id": "closed-open",
"from": "closed",
"to": "open",
"label": "resume (reopen)"
},
{
"id": "open-failed",
"from": "open",
"to": "failed",
"label": "errore runtime",
"variant": "security"
},
{
"id": "failed-open",
"from": "failed",
"to": "open",
"label": "resume (reopen)"
},
{
"id": "closed-deleted",
"from": "closed",
"to": "deleted",
"label": "delete",
"variant": "dashed"
},
{
"id": "archived-finalized",
"from": "archived",
"to": "finalized",
"label": "unarchive"
}
],
"cards": [
{
"dot": "cyan",
"title": "Ripresa",
"items": [
"Si riprendono solo sessioni open, closed o failed: reopen le riporta a open",
"Il backend risponde 409 se la sessione è finalized o archiviata"
]
},
{
"dot": "amber",
"title": "Archiviazione",
"items": [
"archived è un flag separato dallo status: si può archiviare anche una sessione chiusa",
"Archiviare non cambia lo status; una sessione archiviata non si riprende finché non viene ripristinata",
"delete è possibile da qualunque stato e ferma il runtime; nel diagramma è mostrato solo da closed"
]
},
{
"dot": "emerald",
"title": "Fase e status",
"items": [
"Lo status descrive la sessione; la fase F1–F8 si ricalcola dal ledger delle decisioni"
]
}
]
}
@@ -0,0 +1,359 @@
{
"schema_version": 1,
"diagram_type": "class",
"meta": {
"title": "ThothII — classi del runtime di sessione (backend)",
"locale": "it",
"output": "docs/architecture/thothii-session-runtime.html",
"quality_profile": "showcase",
"repository": {
"url": "https://git.tylconsulting.it/mptyl/ThothII.git",
"link_mode": "local-only",
"revision": "31e6d3a162e9e5ac71fc2d8da4fe44b16c06aae3"
}
},
"layout": {
"mode": "grid"
},
"types": [
{
"id": "mgr",
"label": "PiProcessManager",
"kind": "class",
"sublabel": "un processo Pi per sessione",
"row": 0,
"col": 0,
"methods": [
{
"name": "createFor",
"returns": "SessionRuntime",
"visibility": "public",
"parameters": "sessionId, options"
},
{
"name": "configure",
"returns": "Promise<void>",
"visibility": "public",
"parameters": "rt, options"
},
{
"name": "start",
"returns": "void",
"visibility": "public",
"parameters": "sessionId, rt, options"
},
{
"name": "get",
"returns": "SessionRuntime?",
"visibility": "public",
"parameters": "id"
},
{
"name": "teardownIfCurrent",
"returns": "boolean",
"visibility": "public",
"parameters": "id, expected"
}
],
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 46,
"end_line": 46
},
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 178,
"end_line": 178,
"label": "createFor"
},
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 283,
"end_line": 290,
"label": "start"
}
]
},
{
"id": "rt",
"label": "SessionRuntime",
"kind": "interface",
"sublabel": "runtime vivo di una sessione",
"row": 0,
"col": 1,
"attributes": [
{
"name": "rpc",
"type": "RpcClient",
"visibility": "public"
},
{
"name": "bridge",
"type": "SessionBridge",
"visibility": "public"
},
{
"name": "child",
"type": "ChildProcess",
"visibility": "public"
}
],
"sources": [
{
"path": "backend/src/pi/pi-process-manager.ts",
"line": 19,
"end_line": 25
}
]
},
{
"id": "rpc",
"label": "RpcClient",
"kind": "class",
"sublabel": "JSON lines su stdin/stdout di Pi",
"row": 1,
"col": 1,
"methods": [
{
"name": "send",
"returns": "void",
"visibility": "public",
"parameters": "cmd"
},
{
"name": "request",
"returns": "Promise<any>",
"visibility": "public",
"parameters": "cmd"
},
{
"name": "on",
"returns": "void",
"visibility": "public",
"parameters": "\"event\", cb"
}
],
"sources": [
{
"path": "backend/src/rpc/rpc-client.ts",
"line": 6,
"end_line": 37
}
]
},
{
"id": "bridge",
"label": "SessionBridge",
"kind": "class",
"sublabel": "eventi Pi → eventi client",
"row": 1,
"col": 2,
"attributes": [
{
"name": "state",
"type": "TurnState",
"visibility": "private"
},
{
"name": "pendingPiId",
"type": "string?",
"visibility": "private"
}
],
"methods": [
{
"name": "onClientEvent",
"returns": "void",
"visibility": "public",
"parameters": "cb"
},
{
"name": "respond",
"returns": "boolean",
"visibility": "public",
"parameters": "uiResponse"
},
{
"name": "steer",
"returns": "void",
"visibility": "public",
"parameters": "text"
},
{
"name": "pendingWidget",
"returns": "object?",
"visibility": "public"
},
{
"name": "turnState",
"returns": "TurnState",
"visibility": "public"
}
],
"sources": [
{
"path": "backend/src/bridge/session-bridge.ts",
"line": 52,
"end_line": 71
},
{
"path": "backend/src/bridge/session-bridge.ts",
"line": 154,
"end_line": 195
}
]
},
{
"id": "hub",
"label": "SseHub",
"kind": "class",
"sublabel": "buffer e replay per sessione",
"row": 0,
"col": 2,
"methods": [
{
"name": "subscribe",
"returns": "void",
"visibility": "public",
"parameters": "sessionId, …"
},
{
"name": "publish",
"returns": "string",
"visibility": "public",
"parameters": "sessionId, event, data"
},
{
"name": "clear",
"returns": "void",
"visibility": "public",
"parameters": "sessionId"
},
{
"name": "forget",
"returns": "void",
"visibility": "public",
"parameters": "sessionId"
}
],
"sources": [
{
"path": "backend/src/sse/sse-hub.ts",
"line": 47,
"end_line": 47
},
{
"path": "backend/src/sse/sse-hub.ts",
"line": 78,
"end_line": 145
}
]
},
{
"id": "runner",
"label": "ThtRunner",
"kind": "class",
"sublabel": "esegue il CLI tht",
"row": 1,
"col": 0,
"methods": [
{
"name": "sessionNew",
"returns": "Promise",
"visibility": "public",
"parameters": "options"
},
{
"name": "sessionShow",
"returns": "Promise",
"visibility": "public",
"parameters": "id"
},
{
"name": "searchPack",
"returns": "Promise<void>",
"visibility": "public",
"parameters": "question, id"
},
{
"name": "reopenSession",
"returns": "Promise",
"visibility": "public",
"parameters": "id"
},
{
"name": "buildArgv",
"returns": "string[]",
"visibility": "public",
"parameters": "args, workspace"
}
],
"sources": [
{
"path": "backend/src/tht/tht-runner.ts",
"line": 111,
"end_line": 114
},
{
"path": "backend/src/tht/tht-runner.ts",
"line": 392,
"end_line": 394,
"label": "buildArgv"
},
{
"path": "backend/src/tht/tht-runner.ts",
"line": 484,
"end_line": 569
}
]
}
],
"relationships": [
{
"from": "mgr",
"to": "rt",
"kind": "composition",
"label": "runtimes"
},
{
"from": "rt",
"to": "rpc",
"kind": "composition"
},
{
"from": "rt",
"to": "bridge",
"kind": "composition"
},
{
"from": "bridge",
"to": "rpc",
"kind": "association",
"label": "ascolta"
},
{
"from": "mgr",
"to": "runner",
"kind": "dependency",
"label": "resume"
}
],
"cards": [
{
"dot": "cyan",
"title": "Collegamento",
"items": [
"Le route di sessione (sessionRoutes) collegano bridge e hub: ogni evento del bridge viene pubblicato con SseHub.publish",
"app.ts crea un solo ThtRunner, SseHub e PiProcessManager per processo"
]
},
{
"dot": "amber",
"title": "Selezione",
"items": [
"Sono mostrati solo i membri usati nei flussi di sessione"
]
}
]
}
File diff suppressed because one or more lines are too long