Files
agentik/docs/diagrams/03-multi-user-chat.svg
subochev 25771a0c33
ci / JVM build + tests (push) Failing after 1m57s
docs(diagrams): agent architecture overview with pre-rendered SVG
PlantUML diagrams for future agent architecture (Android, multi-user
chat, sub-agents, A2A):
- 01-module-layers.md — целевая модульная структура
- 02-agent-composition.md — AgentBuilder DSL + MemoryBackend.exposesTools()
- 03-multi-user-chat.md — mention-detection sequence
- 04-sub-agents.md — spawnChild + Flow<SubAgentEvent> + A2A
- 05-android-stack.md — что меняется на Android vs Standalone

Каждый .md включает пред-рендеренный SVG (показывается во всех markdown
viewers без PlantUML plugin) + PlantUML source в code block (для
редактирования). SVG нужен потому что PlantUML требует Graphviz dot
для рендеринга — без него IntelliJ/VSCode выдают ошибку.

Регенерация SVG после правки PlantUML-source:
  docker run --rm -v "$PWD:/work" plantuml/plantuml -tsvg /work/docs/diagrams/*.md
2026-09-18 20:02:41 +03:00

1 line
18 KiB
XML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" data-diagram-type="SEQUENCE" style="width:1214px;height:842px;background:#FFFFFF;" width="1214px" height="842px" viewBox="0 0 1214 842" zoomAndPan="magnify" preserveAspectRatio="none" contentStyleType="text/css"><?plantuml 1.2026.8?><defs/><g font-family="sans-serif" lengthAdjust="spacing"><g class="title" data-source-line="10"><text x="382.469" y="27.995" fill="#000" font-size="14" textLength="447.836" font-weight="700">Multi-user chat с mention-detection (точка 1 из планов)</text></g><rect x="8" y="45.297" width="1193.774" height="16.641" fill="#FFC" style="stroke:#FD8;stroke-width:3;" rx="2.5" ry="2.5"/><text x="15" y="55.938" fill="#000" font-size="10" textLength="361.23" font-family="monospace">Please use CSS style instead of skinparam ParticipantPadding</text><rect x="255.62" y="428.859" width="914.31" height="286.133" fill="none" style="stroke:#000;stroke-width:1.5;"/><g><title>User A</title><rect x="32.469" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="35.969" y1="161.531" x2="35.969" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>User B</title><rect x="94.42" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="97.92" y1="161.531" x2="97.92" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>User C</title><rect x="162.4" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="165.9" y1="161.531" x2="165.9" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>Telegram .</title><rect x="268.12" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="271.62" y1="161.531" x2="271.62" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>AgentRuntime</title><rect x="493.925" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="497.425" y1="161.531" x2="497.425" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>MentionDetector</title><rect x="779.34" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="782.84" y1="161.531" x2="782.84" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>SoulProvider</title><rect x="906.238" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="909.738" y1="161.531" x2="909.738" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>MemorySystem</title><rect x="1029.014" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="1032.514" y1="161.531" x2="1032.514" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><g><title>LlmBackend</title><rect x="1150.43" y="161.531" width="8" height="577.461" fill="#000" fill-opacity="0"/><line x1="1153.93" y1="161.531" x2="1153.93" y2="738.992" style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5,5;"/></g><text x="10" y="158.229" fill="#000" font-size="14" textLength="45.938">User A</text><ellipse cx="35.969" cy="93.734" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M35.969,101.734 L35.969,128.734 M22.969,109.734 L48.969,109.734 M35.969,128.734 L22.969,143.734 M35.969,128.734 L48.969,143.734" style="stroke:#181818;stroke-width:0.5;" fill="none"/><text x="71.938" y="158.229" fill="#000" font-size="14" textLength="45.965">User B</text><ellipse cx="97.92" cy="93.734" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M97.92,101.734 L97.92,128.734 M84.92,109.734 L110.92,109.734 M97.92,128.734 L84.92,143.734 M97.92,128.734 L110.92,143.734" style="stroke:#181818;stroke-width:0.5;" fill="none"/><text x="139.833" y="141.933" fill="#000" font-size="14" textLength="46.136">User C</text><text x="133.902" y="158.229" fill="#000" font-size="14" textLength="57.996">(админ)</text><ellipse cx="165.9" cy="77.438" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M165.9,85.438 L165.9,112.438 M152.9,93.438 L178.9,93.438 M165.9,112.438 L152.9,127.438 M165.9,112.438 L178.9,127.438" style="stroke:#181818;stroke-width:0.5;" fill="none"/><rect x="226.773" y="97.641" width="89.694" height="62.891" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="233.773" y="117.636" fill="#000" font-size="14" textLength="75.694">Telegram /</text><text x="248.457" y="133.933" fill="#000" font-size="14" textLength="46.327">Slack /</text><text x="249.581" y="150.229" fill="#000" font-size="14" textLength="44.078">Matrix</text><rect x="440.153" y="113.938" width="114.543" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="447.153" y="133.933" fill="#000" font-size="14" textLength="100.543">AgentRuntime</text><text x="454.198" y="150.229" fill="#000" font-size="14" textLength="86.454">(BaseAgent)</text><rect x="717.147" y="130.234" width="131.387" height="30.297" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="724.147" y="150.229" fill="#000" font-size="14" textLength="117.387">MentionDetector</text><rect x="858.534" y="130.234" width="102.409" height="30.297" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="865.534" y="150.229" fill="#000" font-size="14" textLength="88.409">SoulProvider</text><rect x="970.943" y="113.938" width="123.143" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="977.943" y="133.933" fill="#000" font-size="14" textLength="109.143">MemorySystem</text><text x="988.101" y="150.229" fill="#000" font-size="14" textLength="88.826">(MdMemory)</text><rect x="1104.085" y="113.938" width="99.688" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="1111.085" y="133.933" fill="#000" font-size="14" textLength="85.688">LlmBackend</text><text x="1122.908" y="150.229" fill="#000" font-size="14" textLength="62.043">(LiteLlm)</text><text x="10" y="751.987" fill="#000" font-size="14" textLength="45.938">User A</text><ellipse cx="35.969" cy="763.789" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M35.969,771.789 L35.969,798.789 M22.969,779.789 L48.969,779.789 M35.969,798.789 L22.969,813.789 M35.969,798.789 L48.969,813.789" style="stroke:#181818;stroke-width:0.5;" fill="none"/><text x="71.938" y="751.987" fill="#000" font-size="14" textLength="45.965">User B</text><ellipse cx="97.92" cy="763.789" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M97.92,771.789 L97.92,798.789 M84.92,779.789 L110.92,779.789 M97.92,798.789 L84.92,813.789 M97.92,798.789 L110.92,813.789" style="stroke:#181818;stroke-width:0.5;" fill="none"/><text x="139.833" y="751.987" fill="#000" font-size="14" textLength="46.136">User C</text><text x="133.902" y="768.284" fill="#000" font-size="14" textLength="57.996">(админ)</text><ellipse cx="165.9" cy="780.086" rx="8" ry="8" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;"/><path d="M165.9,788.086 L165.9,815.086 M152.9,796.086 L178.9,796.086 M165.9,815.086 L152.9,830.086 M165.9,815.086 L178.9,830.086" style="stroke:#181818;stroke-width:0.5;" fill="none"/><rect x="226.773" y="738.992" width="89.694" height="62.891" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="233.773" y="758.987" fill="#000" font-size="14" textLength="75.694">Telegram /</text><text x="248.457" y="775.284" fill="#000" font-size="14" textLength="46.327">Slack /</text><text x="249.581" y="791.581" fill="#000" font-size="14" textLength="44.078">Matrix</text><rect x="440.153" y="738.992" width="114.543" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="447.153" y="758.987" fill="#000" font-size="14" textLength="100.543">AgentRuntime</text><text x="454.198" y="775.284" fill="#000" font-size="14" textLength="86.454">(BaseAgent)</text><rect x="717.147" y="738.992" width="131.387" height="30.297" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="724.147" y="758.987" fill="#000" font-size="14" textLength="117.387">MentionDetector</text><rect x="858.534" y="738.992" width="102.409" height="30.297" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="865.534" y="758.987" fill="#000" font-size="14" textLength="88.409">SoulProvider</text><rect x="970.943" y="738.992" width="123.143" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="977.943" y="758.987" fill="#000" font-size="14" textLength="109.143">MemorySystem</text><text x="988.101" y="775.284" fill="#000" font-size="14" textLength="88.826">(MdMemory)</text><rect x="1104.085" y="738.992" width="99.688" height="46.594" fill="#E2E2F0" style="stroke:#181818;stroke-width:0.5;" rx="2.5" ry="2.5"/><text x="1111.085" y="758.987" fill="#000" font-size="14" textLength="85.688">LlmBackend</text><text x="1122.908" y="775.284" fill="#000" font-size="14" textLength="62.043">(LiteLlm)</text><polygon points="259.62,186.664,269.62,190.664,259.62,194.664,263.62,190.664" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="35.969" y1="190.664" x2="265.62" y2="190.664" style="stroke:#181818;stroke-width:1;"/><text x="42.969" y="185.598" fill="#000" font-size="13" textLength="135.618">"@bot, что нового?"</text><polygon points="259.62,215.797,269.62,219.797,259.62,223.797,263.62,219.797" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="97.92" y1="219.797" x2="265.62" y2="219.797" style="stroke:#181818;stroke-width:1;"/><text x="104.92" y="214.731" fill="#000" font-size="13" textLength="101.607">"люблю котов"</text><polygon points="259.62,244.93,269.62,248.93,259.62,252.93,263.62,248.93" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="165.9" y1="248.93" x2="265.62" y2="248.93" style="stroke:#181818;stroke-width:1;"/><text x="172.9" y="243.864" fill="#000" font-size="13" textLength="81.72">"/bot status"</text><polygon points="485.425,274.063,495.425,278.063,485.425,282.063,489.425,278.063" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="271.62" y1="278.063" x2="491.425" y2="278.063" style="stroke:#181818;stroke-width:1;"/><text x="278.62" y="272.997" fill="#000" font-size="13" textLength="92.72">событие чата</text><polygon points="770.84,303.195,780.84,307.195,770.84,311.195,774.84,307.195" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="497.425" y1="307.195" x2="776.84" y2="307.195" style="stroke:#181818;stroke-width:1;"/><text x="504.425" y="302.129" fill="#000" font-size="13" textLength="215.478">isMentioned(message, botName)</text><path d="M787.84,320.195 L787.84,390.195 L1065.84,390.195 L1065.84,330.195 L1055.84,320.195 L787.84,320.195" style="stroke:#181818;stroke-width:0.5;" fill="#FEFFDD"/><path d="M1055.84,320.195 L1055.84,330.195 L1065.84,330.195 L1055.84,320.195" style="stroke:#181818;stroke-width:0.5;" fill="#FEFFDD"/><text x="793.84" y="337.262" fill="#000" font-size="13" textLength="57.072">variants:</text><text x="793.84" y="352.395" fill="#000" font-size="13" textLength="256.591">- SimpleMentionDetector (regex: @bot)</text><text x="793.84" y="367.528" fill="#000" font-size="13" textLength="245.851">- LlmMentionDetector (mini-classifier)</text><text x="793.84" y="382.661" fill="#000" font-size="13" textLength="257.486">- AdminCommandDetector (/command)</text><polygon points="508.425,412.859,498.425,416.859,508.425,420.859,504.425,416.859" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="502.425" y1="416.859" x2="781.84" y2="416.859" style="stroke:#181818;stroke-width:1;stroke-dasharray:2,2;"/><text x="514.425" y="411.793" fill="#000" font-size="13" textLength="261.416">MatchResult{isMentioned, isCommand}</text><path d="M255.62,428.859 L320.063,428.859 L320.063,435.992 L310.063,445.992 L255.62,445.992 L255.62,428.859" style="stroke:#000;stroke-width:1.5;" fill="#EEE"/><rect x="255.62" y="428.859" width="914.31" height="286.133" fill="none" style="stroke:#000;stroke-width:1.5;"/><text x="270.62" y="441.926" fill="#000" font-size="13" textLength="19.443" font-weight="700">alt</text><text x="335.063" y="441.07" fill="#000" font-size="11" textLength="189.492" font-weight="700">[isMentioned или isCommand]</text><polygon points="897.738,473.125,907.738,477.125,897.738,481.125,901.738,477.125" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="497.425" y1="477.125" x2="903.738" y2="477.125" style="stroke:#181818;stroke-width:1;"/><text x="504.425" y="472.059" fill="#000" font-size="13" textLength="39.705">read()</text><polygon points="1020.514,502.258,1030.514,506.258,1020.514,510.258,1024.514,506.258" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="497.425" y1="506.258" x2="1026.514" y2="506.258" style="stroke:#181818;stroke-width:1;"/><text x="504.425" y="501.192" fill="#000" font-size="13" textLength="140.417">prefetch(query, topK)</text><polygon points="1141.93,531.391,1151.93,535.391,1141.93,539.391,1145.93,535.391" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="497.425" y1="535.391" x2="1147.93" y2="535.391" style="stroke:#181818;stroke-width:1;"/><text x="504.425" y="530.325" fill="#000" font-size="13" textLength="273.26">send(system + history + memory + user)</text><polygon points="508.425,560.523,498.425,564.523,508.425,568.523,504.425,564.523" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="502.425" y1="564.523" x2="1152.93" y2="564.523" style="stroke:#181818;stroke-width:1;stroke-dasharray:2,2;"/><text x="514.425" y="559.458" fill="#000" font-size="13" textLength="138.715">response + tool_calls</text><polygon points="1020.514,589.656,1030.514,593.656,1020.514,597.656,1024.514,593.656" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="497.425" y1="593.656" x2="1026.514" y2="593.656" style="stroke:#181818;stroke-width:1;"/><text x="504.425" y="588.59" fill="#000" font-size="13" textLength="94.161">save(decision)</text><polygon points="282.62,618.789,272.62,622.789,282.62,626.789,278.62,622.789" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><line x1="276.62" y1="622.789" x2="496.425" y2="622.789" style="stroke:#181818;stroke-width:1;stroke-dasharray:2,2;"/><text x="288.62" y="617.723" fill="#000" font-size="13" textLength="201.805">ответ в нужный канал/thread</text><line x1="255.62" y1="631.789" x2="1169.93" y2="631.789" style="stroke:#000;stroke-width:1;stroke-dasharray:2,2;"/><text x="260.62" y="644" fill="#000" font-size="11" textLength="211.836" font-weight="700">[NOT mentioned и NOT command]</text><line x1="497.425" y1="670.727" x2="539.425" y2="670.727" style="stroke:#181818;stroke-width:1;"/><line x1="539.425" y1="670.727" x2="539.425" y2="683.727" style="stroke:#181818;stroke-width:1;"/><line x1="498.425" y1="683.727" x2="539.425" y2="683.727" style="stroke:#181818;stroke-width:1;"/><polygon points="508.425,679.727,498.425,683.727,508.425,687.727,504.425,683.727" fill="#181818" style="stroke:#181818;stroke-width:1;stroke-linejoin:miter;stroke-miterlimit:10;"/><text x="504.425" y="665.661" fill="#000" font-size="13" textLength="144.454">drop (если не админ)</text><path d="M660.878,654.594 L660.878,709.594 L963.878,709.594 L963.878,664.594 L953.878,654.594 L660.878,654.594" style="stroke:#181818;stroke-width:0.5;" fill="#FEFFDD"/><path d="M953.878,654.594 L953.878,664.594 L963.878,664.594 L953.878,654.594" style="stroke:#181818;stroke-width:0.5;" fill="#FEFFDD"/><text x="666.878" y="671.661" fill="#000" font-size="13" textLength="188.227">Не отвечаем, но возможно:</text><text x="666.878" y="686.793" fill="#000" font-size="13" textLength="282.039">- запоминаем факт (memory-only update)</text><text x="666.878" y="701.926" fill="#000" font-size="13" textLength="211.104">- summary на long conversation</text><?plantuml-src TLJDRXD94BxFKvHysR7mACk1ImwmjhajOH4cDoJKp5Ji5ZFJtkvs50iXaUngEI3jWJi7n0kOB27PX9XNw7aZlkwn9nwpEzACQgg_-lkwgimBMKw55WMbgfYgaaixilESINDgHJdEEJ8D15yhKpaLfNqaiaoMOxfzP-FykJfgz3z7aPKMZlPckPN9pB2cT28iLSTK88fKPPAnHHH855SdRbczSPTkGRV9NRXpSj_SbLkuQxTqfzqe-ecI927t4Q15TGpuDL2NxiAh8v5QfQcpxuFqEoGCxVTRoa6j7BIKmwTbZ0YVtLUukkxMa66qKILrdd3EOr_RpjDob8lqXHVsXDNoAE274r6MdBUD-cCK-7Y68Wj6Z84m75HrYDL1ssIlfkH-O4Jf05p_j94ZDSiVQNKeCwvXNh7jh51wFfeRomNYxsMreWvVoss31tanG6rSPe0_a9QXgD4G6ku_L7-vC_2-g5w3i7y3y_jzIkwkMQ1TwlpoNDaULM_yXL9zUtZ_SSjxdMX_i0LsLzNVxfF_4kvowMtSAN33BTmEd9AnmivC9rhh0LbH2KXr3DDFrLkuk71d5Bhan2sQtD-vw-gFwiHdtbZv_1lvRaCtl4cpkW_EueAD4MFkeRljGr4mUh5K5WCYnnDBwk3ccWZFeT0Ib9hTy9VGI1RJdBTkbsBDOpxQ9KzMTuK4qp_02bdA9Cs5CV90ibv3-naEXgeeH9dTW7VIMjEDS8_aSuoYvZHfiOK6JYUFsM0qNsxKsaFXAxUleaZaTfC8FvLNOA-1X6Gs-FDz2D-QHHPtjm_hhiFnLFC18thy-uprl4TMJN_z0Gqk03Me8pQXY-aMJQIntiKjh8-Y5lnIgMszGRj4pGRhp31WLgdyMIhotFnlLaOSSfnnAWrgtKgdrOgXIK_TMNL2xfHyKxal-Bx5EFZbvQV3NUtOYMSXuXpn7_xsPBtm0eb1aVutXJVfPrfDAKQSuq0w_9xHnguAXZTj67xzuzvxt3f73046zcilp265GJo7WwLFsIrt6olCnpcWtt0ItDTcLFq9uHALnZNZYIhpESsccR3StJ0sCnG36hqXvGhRFrNb8MiZVD41s7GaXEWx?></g></svg>