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