<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="eli.ai" agent="eli.ai diagram exporter" version="1">
  <diagram id="conversation-turn-lifecycle-c57679e9" name="Conversation turn lifecycle">
    <mxGraphModel dx="1600" dy="1200" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1200" math="0" shadow="0">
      <root>
        <mxCell id="0"/>
        <object id="1" label="Conversation turn lifecycle" schemaVersion="1" diagramId="conversation-turn-lifecycle-c57679e9" canonicalAppearanceKey="tsx:src/app/(docs)/docs/concepts/conversations/page.tsx:threadChart#1" sourceSha256="c57679e943c8e800a5c1b8e86420a24eee51f840e2ba2e10fc7d2a69d8e8ce84" metadataPayloadSha256="69ed5fc7c0b08b958bc60d696247e6c2529f5867eb2d43515081b7c1e1d4c91a" generationKey="f3674c233a6721148b1693334fe24f7bf43b2fe290a571bcdbbb6ebde95dd1ad" concepts="[&quot;Conversations&quot;,&quot;Thread&quot;]" keywords="[&quot;load prior turns (RLS-scoped)&quot;,&quot;chat route&quot;,&quot;chat model&quot;,&quot;judgeAssertions (async)&quot;,&quot;retrieve for this turn&quot;,&quot;fused [Sn] sources&quot;,&quot;verified \&quot; badge&quot;,&quot;conversations / messages&quot;,&quot;turn N (conversationId?)&quot;,&quot;history + sources + question&quot;,&quot;streamed answer with [Sn]&quot;,&quot;persist message + source map&quot;,&quot;enqueue groundedness check&quot;,&quot;n/m&quot;,&quot;retrieve()&quot;]" application="{&quot;name&quot;:&quot;eli-ai&quot;,&quot;version&quot;:&quot;0.1.0&quot;}" packages="{&quot;mermaid&quot;:&quot;11.16.0&quot;,&quot;mermaidCli&quot;:&quot;11.16.0&quot;,&quot;playwright&quot;:&quot;1.62.1&quot;,&quot;playwrightCore&quot;:&quot;1.62.1&quot;,&quot;puppeteer&quot;:&quot;25.6.0&quot;,&quot;puppeteerCore&quot;:&quot;25.6.0&quot;}" environment="{&quot;architecture&quot;:&quot;x64&quot;,&quot;containerImage&quot;:&quot;playwright:v1.62.1-noble@sha256:c091b21d9fae78c76e85cd4356431e9b018402f172a214fc7d7a5e9a7e29d8ac+node:26.3.1-bookworm-slim@sha256:209558c3e5e40e8adff68959d3c2ba7cd73723e716d89196878a0c362fa1e109&quot;,&quot;node&quot;:&quot;v26.3.1&quot;,&quot;platform&quot;:&quot;linux&quot;,&quot;yarn&quot;:&quot;4.17.1&quot;}" renderer="{&quot;browser&quot;:{&quot;executableSha256&quot;:&quot;0b20b130e7edd9dd51873be867761295fe0cfad490c2b9a64f95bd3cfc08fa71&quot;,&quot;name&quot;:&quot;chromium&quot;,&quot;revision&quot;:&quot;1234&quot;,&quot;version&quot;:&quot;151.0.7922.34&quot;},&quot;font&quot;:{&quot;family&quot;:&quot;Eli Diagram Inter Variable&quot;,&quot;fileSha256&quot;:&quot;3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62&quot;,&quot;licenseSha256&quot;:&quot;3b0a5fca3d17942cde889069889dedbbbd075e9b599968c82a95f4d944e9b345&quot;},&quot;mermaidConfigSha256&quot;:&quot;68c10966fe84406ee626034d58bfabd555df9f65f691204b7c46db24038da101&quot;,&quot;themeCssSha256&quot;:&quot;c80287a78d80ad63d27bd5ca348b2ef9a7e2f44da289e436be6484ea28a1b033&quot;}" adapterVersions="{&quot;diagramGenerator&quot;:&quot;2&quot;,&quot;drawioFlowchart&quot;:&quot;1&quot;,&quot;drawioGantt&quot;:&quot;1&quot;,&quot;drawioSequence&quot;:&quot;1&quot;,&quot;drawioState&quot;:&quot;1&quot;}" mermaidType="sequence" generatedAt="2026-08-12T23:37:38.699Z" mermaidSource="sequenceDiagram&#10;  participant U as User&#10;  participant API as chat route&#10;  participant DB as conversations / messages&#10;  participant R as retrieve()&#10;  participant M as chat model&#10;  participant J as judgeAssertions (async)&#10;  U-&gt;&gt;API: turn N (conversationId?)&#10;  API-&gt;&gt;DB: load prior turns (RLS-scoped)&#10;  API-&gt;&gt;R: retrieve for this turn&#10;  R--&gt;&gt;API: fused [Sn] sources&#10;  API-&gt;&gt;M: history + sources + question&#10;  M--&gt;&gt;U: streamed answer with [Sn]&#10;  API-&gt;&gt;DB: persist message + source map&#10;  API--&gt;&gt;J: enqueue groundedness check&#10;  J--&gt;&gt;U: &quot;verified n/m&quot; badge">
          <mxCell parent="0"/>
        </object>
        <object id="n:J" label="judgeAssertions (async)" mermaidId="J" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="1242" y="0" width="204" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:M" label="chat model" mermaidId="M" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="1042" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:R" label="retrieve()" mermaidId="R" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="842" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:DB" label="conversations / messages" mermaidId="DB" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="574" y="0" width="218" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:API" label="chat route" mermaidId="API" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="253" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:U" label="User" mermaidId="U" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="0" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="e:lifeline:J" label="" mermaidId="lifeline:J" mermaidKind="lifeline">
          <mxCell parent="1" source="n:J" target="n:J" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1344" y="65" as="sourcePoint"/>
              <mxPoint x="1344" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:M" label="" mermaidId="lifeline:M" mermaidKind="lifeline">
          <mxCell parent="1" source="n:M" target="n:M" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1117" y="65" as="sourcePoint"/>
              <mxPoint x="1117" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:R" label="" mermaidId="lifeline:R" mermaidKind="lifeline">
          <mxCell parent="1" source="n:R" target="n:R" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="917" y="65" as="sourcePoint"/>
              <mxPoint x="917" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:DB" label="" mermaidId="lifeline:DB" mermaidKind="lifeline">
          <mxCell parent="1" source="n:DB" target="n:DB" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="683" y="65" as="sourcePoint"/>
              <mxPoint x="683" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:API" label="" mermaidId="lifeline:API" mermaidKind="lifeline">
          <mxCell parent="1" source="n:API" target="n:API" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="328" y="65" as="sourcePoint"/>
              <mxPoint x="328" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:U" label="" mermaidId="lifeline:U" mermaidKind="lifeline">
          <mxCell parent="1" source="n:U" target="n:U" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="75" y="65" as="sourcePoint"/>
              <mxPoint x="75" y="535" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i0" label="turn N (conversationId?)" mermaidId="i0" mermaidKind="message">
          <mxCell parent="1" source="n:U" target="n:API" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="76" y="115" as="sourcePoint"/>
              <mxPoint x="324" y="115" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i1" label="load prior turns (RLS-scoped)" mermaidId="i1" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:DB" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="329" y="165" as="sourcePoint"/>
              <mxPoint x="679" y="165" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i2" label="retrieve for this turn" mermaidId="i2" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:R" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="329" y="215" as="sourcePoint"/>
              <mxPoint x="913" y="215" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i3" label="fused [Sn] sources" mermaidId="i3" mermaidKind="message">
          <mxCell parent="1" source="n:R" target="n:API" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="916" y="265" as="sourcePoint"/>
              <mxPoint x="332" y="265" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i4" label="history + sources + question" mermaidId="i4" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:M" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="329" y="315" as="sourcePoint"/>
              <mxPoint x="1113" y="315" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i5" label="streamed answer with [Sn]" mermaidId="i5" mermaidKind="message">
          <mxCell parent="1" source="n:M" target="n:U" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1116" y="365" as="sourcePoint"/>
              <mxPoint x="79" y="365" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i6" label="persist message + source map" mermaidId="i6" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:DB" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="329" y="415" as="sourcePoint"/>
              <mxPoint x="679" y="415" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i7" label="enqueue groundedness check" mermaidId="i7" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:J" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="329" y="465" as="sourcePoint"/>
              <mxPoint x="1340" y="465" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i8" label="&quot;verified n/m&quot; badge" mermaidId="i8" mermaidKind="message">
          <mxCell parent="1" source="n:J" target="n:U" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1343" y="515" as="sourcePoint"/>
              <mxPoint x="79" y="515" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
