{ "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" ] } ] }