Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
docs: remove orphaned PR-scratch diagrams from docs/diagrams
Jose Ramirez0de71f10d18e
diff --git a/docs/diagrams/desktop-first-sdk-notifications-architecture.png b/docs/diagrams/desktop-first-sdk-notifications-architecture.pngdeleted file mode 100644index 80a96e543..000000000Binary files a/docs/diagrams/desktop-first-sdk-notifications-architecture.png and /dev/null differdiff --git a/docs/diagrams/desktop-first-sdk-notifications-architecture.svg b/docs/diagrams/desktop-first-sdk-notifications-architecture.svgdeleted file mode 100644index 1d8a243c4..000000000--- a/docs/diagrams/desktop-first-sdk-notifications-architecture.svg+++ /dev/null@@ -1,209 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 868">- <defs>- <style>- text { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; fill: #111827; }- .title { font-size: 17px; font-weight: 600; }- .label { font-size: 12px; font-weight: 600; }- .sub { font-size: 10px; fill: #6b7280; }- .jwt { font-size: 10px; fill: #1d4ed8; font-weight: 600; }- .jwt-muted { font-size: 10px; fill: #9ca3af; }- .layer { fill: #fafafa; stroke: #e5e7eb; stroke-width: 1.2; stroke-dasharray: 5 4; }- .node { fill: #ffffff; stroke: #d1d5db; stroke-width: 1.2; }- .accent { fill: #eff6ff; stroke: #bfdbfe; stroke-width: 1.2; }- .green { fill: #f0fdf4; stroke: #86efac; stroke-width: 1.2; }- .purple { fill: #faf5ff; stroke: #d8b4fe; stroke-width: 1.2; }- .orange { fill: #fff7ed; stroke: #fdba74; stroke-width: 1.2; }- .callout { fill: #ffffff; stroke: #e5e7eb; stroke-width: 1; }- .callout-blue { fill: #ffffff; stroke: #bfdbfe; stroke-width: 1; }- </style>- <marker id="arrow-blue" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#2563eb"/></marker>- <marker id="arrow-green" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#059669"/></marker>- <marker id="arrow-orange" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#ea580c"/></marker>- <marker id="arrow-gray" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#9ca3af"/></marker>- </defs>-- <rect width="1200" height="868" fill="#ffffff"/>-- <!-- Header card -->- <rect x="24" y="16" width="1152" height="48" rx="6" fill="#f9fafb" stroke="#e5e7eb" stroke-width="1"/>- <text x="40" y="36" class="title">Desktop-first SDK clientNotifications</text>- <text x="40" y="52" class="sub">PR #518 · sandbox-recipes → control-api outbox → Desktop SSE/ACK → channel fallback</text>-- <!-- L1 -->- <rect x="24" y="68" width="1152" height="208" rx="8" class="layer"/>- <rect x="36" y="74" width="148" height="18" rx="4" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>- <text x="44" y="87" class="label">① sandbox-recipes</text>-- <rect x="40" y="100" width="132" height="58" rx="6" class="accent"/>- <text x="52" y="118" class="label">WorkflowRecipe</text>- <text x="52" y="132" class="sub">pluginWorkloadSdk</text>- <text x="52" y="146" class="sub">allowedCallers</text>-- <rect x="188" y="100" width="152" height="58" rx="6" class="node"/>- <text x="200" y="118" class="label">WRC reconciler</text>- <text x="200" y="132" class="sub">Secrets + NP</text>- <text x="200" y="146" class="sub">deploying until /configure</text>-- <rect x="356" y="100" width="136" height="66" rx="6" class="green"/>- <text x="368" y="118" class="label">Plugin workload</text>- <text x="368" y="132" class="sub">sdk-caller pod</text>- <text x="368" y="146" class="sub">Bearer caller secret</text>- <text x="368" y="158" class="jwt">HTTP + caller secret →</text>-- <rect x="508" y="100" width="168" height="58" rx="6" class="purple"/>- <text x="516" y="118" class="label">Recipe mcp-host</text>- <text x="516" y="132" class="sub">SDK server :8099</text>- <text x="516" y="146" class="sub">client-notifications · prompt-bridge</text>-- <rect x="688" y="100" width="468" height="58" rx="6" fill="#f3f4f6" stroke="#e5e7eb" stroke-width="1"/>- <text x="700" y="118" class="label">SDK gate (fail-closed)</text>- <text x="700" y="132" class="sub">PLUGIN_WORKLOAD_SDK_ENABLED · recipeNamespace=sandbox-recipes</text>- <text x="700" y="146" class="sub">caller Secret registry · separate from Host JWT</text>-- <!-- Trust-hop callouts aligned under WRC and recipe mcp-host -->- <rect x="154" y="172" width="220" height="76" rx="6" class="callout"/>- <text x="166" y="190" class="label">Provisioning WRC</text>- <text x="166" y="206" class="jwt">InternalControl JWT</text>- <text x="166" y="220" class="sub">POST /auth/mcp-host/…/tokens</text>- <text x="166" y="234" class="sub">Host JWT Secret → mcp-host pod</text>-- <rect x="482" y="172" width="220" height="76" rx="6" class="callout-blue"/>- <text x="490" y="190" class="label">Runtime SDK</text>- <text x="490" y="206" class="jwt">Host JWT runtime token</text>- <text x="490" y="220" class="sub">POST /mcp-host/plugin-workload-sdk/*</text>- <text x="490" y="234" class="sub">:8099 → nginx → authorizer → outbox</text>-- <path d="M 172 129 L 188 129" stroke="#2563eb" stroke-width="1.6" fill="none" marker-end="url(#arrow-blue)"/>- <path d="M 340 129 L 356 129" stroke="#2563eb" stroke-width="1.6" fill="none" marker-end="url(#arrow-blue)"/>-- <!-- L2 -->- <rect x="24" y="296" width="1152" height="128" rx="8" class="layer"/>- <rect x="36" y="302" width="132" height="18" rx="4" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>- <text x="44" y="315" class="label">② control-plane</text>-- <rect x="40" y="328" width="148" height="76" rx="6" class="node"/>- <text x="52" y="348" class="label">nginx /mcp-host</text>- <text x="52" y="362" class="jwt">Host JWT AuthN/Z</text>- <text x="52" y="376" class="sub">plugin-workload-sdk</text>- <text x="52" y="390" class="sub">routes</text>-- <rect x="204" y="328" width="168" height="76" rx="6" class="accent"/>- <text x="216" y="348" class="label">control-api</text>- <text x="216" y="362" class="sub">authorizer · grants</text>- <text x="216" y="376" class="sub">quota · audit</text>- <text x="216" y="390" class="jwt">/auth/mcp-host issuance</text>-- <rect x="388" y="328" width="168" height="76" rx="6" class="green"/>- <text x="400" y="348" class="label">notification_deliveries</text>- <text x="400" y="362" class="sub">plugin_workload_sdk</text>- <text x="400" y="376" class="sub">.notification event</text>- <text x="400" y="390" class="sub">grace on next_attempt_at</text>-- <path d="M 188 366 L 204 366" stroke="#2563eb" stroke-width="1.6" fill="none" marker-end="url(#arrow-blue)"/>- <path d="M 372 366 L 388 366" stroke="#059669" stroke-width="1.6" fill="none" marker-end="url(#arrow-green)"/>- <rect x="308" y="352" width="52" height="18" rx="3" class="callout"/>- <text x="316" y="364" class="sub">enqueue</text>-- <!-- L3 -->- <rect x="24" y="438" width="1152" height="128" rx="8" class="layer"/>- <rect x="36" y="444" width="168" height="18" rx="4" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>- <text x="44" y="457" class="label">③ Desktop-first delivery</text>-- <rect x="40" y="472" width="152" height="76" rx="6" class="accent"/>- <text x="52" y="492" class="label">Desktop App</text>- <text x="52" y="506" class="sub">SSE sdk.notification</text>- <text x="52" y="520" class="sub">POST …/ack</text>- <text x="52" y="534" class="jwt">Session JWT</text>-- <rect x="208" y="472" width="152" height="76" rx="6" class="green"/>- <text x="220" y="492" class="label">external-rest-api</text>- <text x="220" y="506" class="sub">stream proxy + ACK</text>- <text x="220" y="520" class="sub">notification prefs</text>- <text x="220" y="534" class="jwt">Session JWT</text>-- <rect x="376" y="472" width="152" height="76" rx="6" class="purple"/>- <text x="388" y="492" class="label">ACK service</text>- <text x="388" y="506" class="sub">status=sent</text>- <text x="388" y="520" class="sub">delivered_medium</text>- <text x="388" y="534" class="sub">=desktop</text>-- <rect x="544" y="472" width="152" height="76" rx="6" class="orange"/>- <text x="556" y="492" class="label">Settings UI</text>- <text x="556" y="506" class="sub">strict PUT prefs</text>- <text x="556" y="520" class="sub">preferredMedium</text>- <text x="556" y="534" class="sub">channelFallback</text>-- <path d="M 192 510 L 208 510" stroke="#2563eb" stroke-width="1.6" fill="none" marker-end="url(#arrow-blue)"/>- <path d="M 360 510 L 376 510" stroke="#2563eb" stroke-width="1.6" fill="none" marker-end="url(#arrow-blue)"/>-- <!-- L4 -->- <rect x="24" y="580" width="1152" height="88" rx="8" class="layer"/>- <rect x="36" y="586" width="348" height="18" rx="4" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>- <text x="44" y="599" class="label">④ Channel fallback (no desktop ACK before grace)</text>-- <rect x="388" y="612" width="168" height="44" rx="6" class="green"/>- <text x="400" y="630" class="label">notification_deliveries</text>- <text x="400" y="644" class="sub">queued · claimable</text>-- <rect x="572" y="612" width="168" height="44" rx="6" class="orange"/>- <text x="584" y="630" class="label">channel-reader</text>- <text x="584" y="644" class="sub">GET …/deliveries</text>-- <rect x="756" y="612" width="148" height="44" rx="6" class="green"/>- <text x="768" y="630" class="label">Telegram / Slack</text>- <text x="768" y="644" class="sub">verified medium</text>-- <path d="M 556 634 L 572 634" stroke="#ea580c" stroke-width="1.6" fill="none" marker-end="url(#arrow-orange)"/>- <path d="M 740 634 L 756 634" stroke="#ea580c" stroke-width="1.6" fill="none" marker-end="url(#arrow-orange)"/>-- <!-- Cross-layer connectors (drawn last so layer fills do not clip paths) -->- <g id="connectors" fill="none">- <!-- Plugin workload → recipe mcp-host (opaque caller secret over HTTP) -->- <path d="M 492 133 L 508 129" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arrow-blue)"/>-- <!-- WRC / mcp-host → trust-hop callouts -->- <path d="M 264 158 L 264 172" stroke="#9ca3af" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arrow-gray)"/>- <path d="M 592 158 L 592 172" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arrow-blue)"/>-- <!-- trust-hop callouts → control-plane (bus y=290 in gap between layers) -->- <path d="M 264 248 L 264 290 L 288 290 L 288 328" stroke="#9ca3af" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arrow-gray)"/>- <path d="M 592 248 L 592 290 L 114 290 L 114 328" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arrow-blue)"/>-- <!-- outbox → external-rest-api SSE -->- <path d="M 472 404 L 472 420 L 284 420 L 284 472" stroke="#059669" stroke-width="1.6" marker-end="url(#arrow-green)"/>- <rect x="320" y="426" width="108" height="18" rx="3" class="callout"/>- <text x="328" y="438" class="sub">SSE stream by userId</text>-- <!-- outbox → channel fallback queue -->- <path d="M 472 404 L 472 612" stroke="#ea580c" stroke-width="1.4" stroke-dasharray="4 3" marker-end="url(#arrow-orange)"/>- <rect x="476" y="548" width="76" height="18" rx="3" class="callout"/>- <text x="484" y="560" class="sub">after grace</text>- </g>-- <!-- Legend card -->- <rect x="24" y="684" width="1152" height="122" rx="8" fill="#f9fafb" stroke="#e5e7eb" stroke-width="1"/>- <rect x="36" y="690" width="64" height="18" rx="4" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>- <text x="44" y="703" class="label">Legend</text>-- <rect x="40" y="714" width="1112" height="22" rx="4" fill="#ffffff" stroke="#eef2f7" stroke-width="1"/>- <line x1="52" y1="725" x2="78" y2="725" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arrow-blue)"/>- <text x="84" y="729" class="sub">SDK / Session</text>- <line x1="180" y1="725" x2="206" y2="725" stroke="#059669" stroke-width="1.6" marker-end="url(#arrow-green)"/>- <text x="212" y="729" class="sub">enqueue / SSE</text>- <line x1="310" y1="725" x2="336" y2="725" stroke="#ea580c" stroke-width="1.4" stroke-dasharray="4 3" marker-end="url(#arrow-orange)"/>- <text x="342" y="729" class="sub">fallback after grace</text>- <line x1="490" y1="725" x2="516" y2="725" stroke="#9ca3af" stroke-width="1.4" stroke-dasharray="4 3" marker-end="url(#arrow-gray)"/>- <text x="522" y="729" class="sub">Host JWT provisioning</text>-- <rect x="40" y="742" width="1112" height="36" rx="4" fill="#ffffff" stroke="#eef2f7" stroke-width="1"/>- <text x="52" y="756" class="sub">JWT planes — Admin /admin · Session /external · Host /mcp-host</text>- <text x="52" y="770" class="sub">InternalControl /auth/mcp-host (WRC provisioning only)</text>-- <rect x="40" y="784" width="1112" height="22" rx="4" fill="#ffffff" stroke="#eef2f7" stroke-width="1"/>- <text x="52" y="798" class="sub">Not used here — RPC JWT (/rpc) · workload uses opaque caller Secret only</text>-- <!-- E2E footnote card -->- <rect x="24" y="818" width="1152" height="36" rx="6" fill="#f3f4f6" stroke="#e5e7eb" stroke-width="1"/>- <text x="40" y="834" class="sub">E2E: workload → desktop ACK → delivered_medium=desktop</text>- <text x="40" y="848" class="sub">else channel-reader after grace · strict PUT preferredMedium + channelFallbackEnabled</text>-</svg>diff --git a/docs/diagrams/plugin-workload-sdk-mind-map.png b/docs/diagrams/plugin-workload-sdk-mind-map.pngdeleted file mode 100644index 0fe307b2d..000000000Binary files a/docs/diagrams/plugin-workload-sdk-mind-map.png and /dev/null differdiff --git a/docs/diagrams/plugin-workload-sdk-mind-map.svg b/docs/diagrams/plugin-workload-sdk-mind-map.svgdeleted file mode 100644index c70f3d23d..000000000--- a/docs/diagrams/plugin-workload-sdk-mind-map.svg+++ /dev/null@@ -1,65 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 840">- <defs>- <style>- text { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; fill: #111827; }- .title { font-size: 18px; font-weight: 600; }- .label { font-size: 13px; font-weight: 600; }- .sub { font-size: 11px; fill: #6b7280; }- .center { fill: #eff6ff; stroke: #2563eb; stroke-width: 2; }- .branch { fill: #ffffff; stroke: #d1d5db; stroke-width: 1.5; }- .b1 { fill: #f0fdf4; stroke: #86efac; }- .b2 { fill: #eff6ff; stroke: #bfdbfe; }- .b3 { fill: #faf5ff; stroke: #d8b4fe; }- .b4 { fill: #fff7ed; stroke: #fdba74; }- .b5 { fill: #f0fdfa; stroke: #5eead4; }- .b6 { fill: #fef2f2; stroke: #fca5a5; }- </style>- <marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#9ca3af"/></marker>- </defs>- <rect width="960" height="840" fill="#ffffff"/>- <text x="40" y="36" class="title">Plugin Workload SDK — mind map (PR #518, desktop-first)</text>- <text x="40" y="56" class="sub">Radial concept map: declaración → runtime → auth → notifications → promptBridge → UI</text>- <rect x="370" y="378" width="220" height="84" rx="12" class="center"/>- <text x="480" y="412" text-anchor="middle" class="label">Plugin Workload SDK</text>- <text x="480" y="430" text-anchor="middle" class="sub">promptBridge + clientNotifications</text>- <text x="480" y="446" text-anchor="middle" class="sub">mcp-host sidecar :8099</text>- <path d="M 480.0,378.0 C 480.0,374.1 480.0,159.9 350.0,114.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="330" y="70" width="300" height="88" rx="8" class="branch b2"/>- <text x="346" y="98" class="label">Declaración</text>- <text x="346" y="118" class="sub">WorkflowRecipe CRD</text>- <text x="346" y="134" class="sub">spec.pluginWorkloadSdk</text>- <text x="346" y="150" class="sub">allowedCallers (no wildcards in grants)</text>- <path d="M 562.3,399.0 C 578.0,382.2 690.0,205.8 640.0,168.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="620" y="120" width="280" height="96" rx="8" class="branch b1"/>- <text x="636" y="148" class="label">Runtime K8s</text>- <text x="636" y="168" class="sub">WRC reconciler + NetworkPolicies</text>- <text x="636" y="184" class="sub">Recipe mcp-host eager pod</text>- <text x="636" y="200" class="sub">H1: deploying until /configure OK</text>- <path d="M 562.3,441.0 C 578.0,442.2 690.0,545.8 640.0,568.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="620" y="520" width="280" height="96" rx="8" class="branch b3"/>- <text x="636" y="548" class="label">Auth and policy</text>- <text x="636" y="568" class="sub">Control UI explicit grants</text>- <text x="636" y="584" class="sub">Host JWT via InternalControl</text>- <text x="636" y="600" class="sub">quota + audit invocations</text>- <path d="M 480.0,462.0 C 480.0,457.8 480.0,634.2 350.0,672.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="330" y="620" width="300" height="104" rx="8" class="branch b4"/>- <text x="346" y="648" class="label">clientNotifications</text>- <text x="346" y="668" class="sub">Workload → SDK :8099 → control-api</text>- <text x="346" y="684" class="sub">notification_deliveries outbox</text>- <text x="346" y="700" class="sub">Desktop SSE first · channel fallback after grace</text>- <path d="M 397.7,441.0 C 382.0,442.2 270.0,545.8 80.0,568.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="60" y="520" width="280" height="96" rx="8" class="branch b5"/>- <text x="76" y="548" class="label">promptBridge</text>- <text x="76" y="568" class="sub">POST /sdk/v1/prompt-bridge</text>- <text x="76" y="584" class="sub">Provider key brokered via /configure</text>- <text x="76" y="600" class="sub">Skipped when recipe is notifications-only</text>- <path d="M 397.7,399.0 C 382.0,382.2 270.0,205.8 80.0,168.0" stroke="#9ca3af" stroke-width="1.5" fill="none" marker-end="url(#arrow)"/>- <rect x="60" y="120" width="280" height="96" rx="8" class="branch b6"/>- <text x="76" y="148" class="label">UI surfaces</text>- <text x="76" y="168" class="sub">Desktop: bell + ACK (Session JWT)</text>- <text x="76" y="184" class="sub">Settings: strict PUT prefs (H2)</text>- <text x="76" y="200" class="sub">Control UI: grants + invocations audit</text>- <rect x="40" y="760" width="880" height="56" rx="8" fill="#f9fafb" stroke="#e5e7eb"/>- <text x="56" y="784" class="label">Delivery priority (clientNotifications v1)</text>- <text x="56" y="802" class="sub">1) Desktop stream + POST ack (stops fallback) → 2) channel-reader after grace → Telegram/Slack via user_notification_preferences</text>-</svg>diff --git a/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.png b/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.pngdeleted file mode 100644index 1d9d0430d..000000000Binary files a/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.png and /dev/null differdiff --git a/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.svg b/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.svgdeleted file mode 100644index 797a86ce8..000000000--- a/docs/diagrams/pr-535-figure-d-telegram-group-approval-architecture.svg+++ /dev/null@@ -1,202 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1660 900" width="1660" height="900">- <style>text { font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Microsoft YaHei', 'Microsoft JhengHei', 'SimHei', sans-serif; }</style>- <defs>- <marker id="arrow-blue" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#2563eb"/></marker>- <marker id="arrow-rose" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#dc2626"/></marker>- <marker id="arrow-green" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#16a34a"/></marker>- <marker id="arrow-purple" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#9333ea"/></marker>- </defs>- <rect width="1660" height="900" fill="#ffffff"/>- <text x="50" y="46" font-size="24" font-weight="700" fill="#111827">PR #535 Figure D Telegram group approval architecture</text>- <text x="50" y="72" font-size="13" fill="#6b7280">Branch codex/figure-d-sync-origin-dev-7c44 · head 1b90d04d9861 · T2 clerum-codex-figure-d-sync-origin-dev-7c44-a16d1edd</text>- <rect x="40" y="112" width="1580" height="260" rx="14" fill="#f9fafb" stroke="#e5e7eb"/><text x="58" y="140" font-size="13" font-weight="700" fill="#374151">User journey</text>-<rect x="40" y="405" width="1580" height="255" rx="14" fill="#f9fafb" stroke="#e5e7eb"/><text x="58" y="433" font-size="13" font-weight="700" fill="#374151">Trust boundaries and runtime</text>-<rect x="40" y="690" width="1580" height="118" rx="14" fill="#f9fafb" stroke="#e5e7eb"/><text x="58" y="718" font-size="13" font-weight="700" fill="#374151">Validation and E2E hardening</text>-- <path d="M 300 211 L 340 211" fill="none" stroke="#2563eb" stroke-width="2" marker-end="url(#arrow-blue)"/>- <rect x="284" y="190" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="320" y="203" text-anchor="middle" font-size="11" fill="#374151">update</text>-- <path d="M 600 211 L 640 211" fill="none" stroke="#2563eb" stroke-width="2" marker-end="url(#arrow-blue)"/>- <rect x="584" y="190" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="620" y="203" text-anchor="middle" font-size="11" fill="#374151">intent</text>-- <path d="M 890 211 L 930 211" fill="none" stroke="#9333ea" stroke-width="2" marker-end="url(#arrow-purple)"/>- <rect x="872" y="190" width="76" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="910" y="203" text-anchor="middle" font-size="11" fill="#374151">private DM</text>-- <path d="M 1180 211 L 1220 211" fill="none" stroke="#9333ea" stroke-width="2" marker-end="url(#arrow-purple)"/>- <rect x="1164" y="190" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="1200" y="203" text-anchor="middle" font-size="11" fill="#374151">callback</text>-- <path d="M 1355 250 L 1445 428" fill="none" stroke="#2563eb" stroke-width="2" marker-end="url(#arrow-blue)"/>- <rect x="1364" y="318" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="1400" y="331" text-anchor="middle" font-size="11" fill="#374151">decision</text>-- <path d="M 355 501 L 395 501" fill="none" stroke="#dc2626" stroke-width="2" marker-end="url(#arrow-rose)"/>- <rect x="339" y="480" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="375" y="493" text-anchor="middle" font-size="11" fill="#374151">login</text>-- <path d="M 680 501 L 720 574" fill="none" stroke="#dc2626" stroke-width="2" marker-end="url(#arrow-rose)"/>- <rect x="664" y="517" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="700" y="530" text-anchor="middle" font-size="11" fill="#374151">Bearer</text>-- <path d="M 1020 574 L 1060 574" fill="none" stroke="#16a34a" stroke-width="2" marker-end="url(#arrow-green)"/>- <rect x="1004" y="553" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="1040" y="566" text-anchor="middle" font-size="11" fill="#374151">verified</text>-- <path d="M 1320 574 L 1320 649" fill="none" stroke="#16a34a" stroke-width="2" marker-end="url(#arrow-green)"/>- <rect x="1282" y="591" width="76" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="1320" y="604" text-anchor="middle" font-size="11" fill="#374151">run result</text>-- <path d="M 1445 506 L 1470 610" fill="none" stroke="#2563eb" stroke-width="2" marker-end="url(#arrow-blue)"/>- <rect x="1422" y="537" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="1458" y="550" text-anchor="middle" font-size="11" fill="#374151">decision</text>-- <path d="M 420 751 L 470 751" fill="none" stroke="#dc2626" stroke-width="2" marker-end="url(#arrow-rose)"/>- <rect x="409" y="730" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="445" y="743" text-anchor="middle" font-size="11" fill="#374151">hardens</text>-- <path d="M 860 751 L 910 751" fill="none" stroke="#16a34a" stroke-width="2" marker-end="url(#arrow-green)"/>- <rect x="849" y="730" width="72" height="18" rx="9" fill="#ffffff" opacity="0.96" stroke="#e5e7eb"/>- <text x="885" y="743" text-anchor="middle" font-size="11" fill="#374151">validated</text>-- <g id="node-group">- <rect x="70" y="172" width="230" height="78" rx="10" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.6"/>- <circle cx="98" cy="200" r="16" fill="#ffffff" stroke="#0284c7" stroke-width="1.3"/>- <text x="98" y="205" text-anchor="middle" font-size="13" font-weight="700" fill="#0284c7">tg</text>- <text x="124" y="200" font-size="15" font-weight="700" fill="#111827">Telegram group trigger</text>- <text x="124" y="221" font-size="12" fill="#4b5563">requester sends workflow command</text>- <circle cx="274" cy="196" r="15" fill="#0284c7" stroke="#0284c7" stroke-width="1.3"/>- <text x="274" y="201" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">1</text>- </g>-- <g id="node-gateway">- <rect x="340" y="172" width="260" height="78" rx="10" fill="#f0fdfa" stroke="#0f766e" stroke-width="1.6"/>- <circle cx="368" cy="200" r="16" fill="#ffffff" stroke="#0f766e" stroke-width="1.3"/>- <text x="368" y="205" text-anchor="middle" font-size="13" font-weight="700" fill="#0f766e">gw</text>- <text x="394" y="200" font-size="15" font-weight="700" fill="#111827">Channel gateway</text>- <text x="394" y="221" font-size="12" fill="#4b5563">CommunicationChannel + channel-reader</text>- <circle cx="574" cy="196" r="15" fill="#0f766e" stroke="#0f766e" stroke-width="1.3"/>- <text x="574" y="201" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">2</text>- </g>-- <g id="node-control">- <rect x="640" y="172" width="250" height="78" rx="10" fill="#fff7ed" stroke="#ea580c" stroke-width="1.6"/>- <circle cx="668" cy="200" r="16" fill="#ffffff" stroke="#ea580c" stroke-width="1.3"/>- <text x="668" y="205" text-anchor="middle" font-size="13" font-weight="700" fill="#ea580c">api</text>- <text x="694" y="200" font-size="15" font-weight="700" fill="#111827">control-api gate</text>- <text x="694" y="221" font-size="12" fill="#4b5563">approval intent + notification queue</text>- <circle cx="864" cy="196" r="15" fill="#ea580c" stroke="#ea580c" stroke-width="1.3"/>- <text x="864" y="201" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">3</text>- </g>-- <g id="node-dm">- <rect x="930" y="172" width="250" height="78" rx="10" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.6"/>- <circle cx="958" cy="200" r="16" fill="#ffffff" stroke="#0284c7" stroke-width="1.3"/>- <text x="958" y="205" text-anchor="middle" font-size="13" font-weight="700" fill="#0284c7">dm</text>- <text x="984" y="200" font-size="15" font-weight="700" fill="#111827">Private approver DM</text>- <text x="984" y="221" font-size="12" fill="#4b5563">compact approve/deny callback</text>- <circle cx="1154" cy="196" r="15" fill="#0284c7" stroke="#0284c7" stroke-width="1.3"/>- <text x="1154" y="201" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">4</text>- </g>-- <g id="node-reader">- <rect x="1220" y="172" width="270" height="78" rx="10" fill="#f0fdfa" stroke="#0f766e" stroke-width="1.6"/>- <circle cx="1248" cy="200" r="16" fill="#ffffff" stroke="#0f766e" stroke-width="1.3"/>- <text x="1248" y="205" text-anchor="middle" font-size="13" font-weight="700" fill="#0f766e">ar</text>- <text x="1274" y="200" font-size="15" font-weight="700" fill="#111827">approval-request-reader</text>- <text x="1274" y="221" font-size="12" fill="#4b5563">resolves a/d:id:~hash</text>- <circle cx="1464" cy="196" r="15" fill="#0f766e" stroke="#0f766e" stroke-width="1.3"/>- <text x="1464" y="201" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">5</text>- </g>-- <g id="node-runtime">- <rect x="1320" y="428" width="250" height="78" rx="10" fill="#fff7ed" stroke="#ea580c" stroke-width="1.6"/>- <circle cx="1348" cy="456" r="16" fill="#ffffff" stroke="#ea580c" stroke-width="1.3"/>- <text x="1348" y="461" text-anchor="middle" font-size="13" font-weight="700" fill="#ea580c">mh</text>- <text x="1374" y="456" font-size="15" font-weight="700" fill="#111827">Runtime mcp-host</text>- <text x="1374" y="477" font-size="12" fill="#4b5563">posts decision to control-api</text>- <circle cx="1544" cy="452" r="15" fill="#ea580c" stroke="#ea580c" stroke-width="1.3"/>- <text x="1544" y="457" text-anchor="middle" font-size="13" font-weight="700" fill="#ffffff">6</text>- </g>-- <g id="node-profile">- <rect x="70" y="462" width="285" height="78" rx="10" fill="#eff6ff" stroke="#2563eb" stroke-width="1.6"/>- <circle cx="98" cy="490" r="16" fill="#ffffff" stroke="#2563eb" stroke-width="1.3"/>- <text x="98" y="495" text-anchor="middle" font-size="13" font-weight="700" fill="#2563eb">ui</text>- <text x="124" y="490" font-size="15" font-weight="700" fill="#111827">Profile UI access</text>- <text x="124" y="511" font-size="12" fill="#4b5563">Email + Password + Bearer token</text>-- </g>-- <g id="node-auth">- <rect x="395" y="462" width="285" height="78" rx="10" fill="#fef2f2" stroke="#dc2626" stroke-width="1.6"/>- <circle cx="423" cy="490" r="16" fill="#ffffff" stroke="#dc2626" stroke-width="1.3"/>- <text x="423" y="495" text-anchor="middle" font-size="13" font-weight="700" fill="#dc2626">jwt</text>- <text x="449" y="490" font-size="15" font-weight="700" fill="#111827">Session JWT boundary</text>- <text x="449" y="511" font-size="12" fill="#4b5563">401 clears session; fail-closed</text>-- </g>-- <g id="node-mediums">- <rect x="720" y="535" width="300" height="78" rx="10" fill="#faf5ff" stroke="#7c3aed" stroke-width="1.6"/>- <circle cx="748" cy="563" r="16" fill="#ffffff" stroke="#7c3aed" stroke-width="1.3"/>- <text x="748" y="568" text-anchor="middle" font-size="13" font-weight="700" fill="#7c3aed">db</text>- <text x="774" y="563" font-size="15" font-weight="700" fill="#111827">Workflow approval mediums</text>- <text x="774" y="584" font-size="12" fill="#4b5563">verify, bind, prefer, disconnect row</text>-- </g>-- <g id="node-recipe">- <rect x="1060" y="535" width="260" height="78" rx="10" fill="#f0fdf4" stroke="#16a34a" stroke-width="1.6"/>- <circle cx="1088" cy="563" r="16" fill="#ffffff" stroke="#16a34a" stroke-width="1.3"/>- <text x="1088" y="568" text-anchor="middle" font-size="13" font-weight="700" fill="#16a34a">wr</text>- <text x="1114" y="563" font-size="15" font-weight="700" fill="#111827">WorkflowRecipe</text>- <text x="1114" y="584" font-size="12" fill="#4b5563">sandbox-recipes namespace invariant</text>-- </g>-- <g id="node-outcome">- <rect x="1320" y="610" width="300" height="78" rx="10" fill="#f0fdf4" stroke="#16a34a" stroke-width="1.6"/>- <circle cx="1348" cy="638" r="16" fill="#ffffff" stroke="#16a34a" stroke-width="1.3"/>- <text x="1348" y="643" text-anchor="middle" font-size="13" font-weight="700" fill="#16a34a">end</text>- <text x="1374" y="638" font-size="15" font-weight="700" fill="#111827">Approve / deny outcomes</text>- <text x="1374" y="659" font-size="12" fill="#4b5563">approve succeeds; deny blocks final step</text>-- </g>-- <g id="node-rules">- <rect x="70" y="722" width="350" height="58" rx="10" fill="#fef2f2" stroke="#dc2626" stroke-width="1.6"/>- <circle cx="98" cy="750" r="16" fill="#ffffff" stroke="#dc2626" stroke-width="1.3"/>- <text x="98" y="755" text-anchor="middle" font-size="13" font-weight="700" fill="#dc2626">qa</text>- <text x="124" y="750" font-size="15" font-weight="700" fill="#111827">E2E fixture rules</text>- <text x="124" y="771" font-size="12" fill="#4b5563">same seed/env, real login, bounded waits</text>-- </g>-- <g id="node-specs">- <rect x="470" y="722" width="390" height="58" rx="10" fill="#fef2f2" stroke="#dc2626" stroke-width="1.6"/>- <circle cx="498" cy="750" r="16" fill="#ffffff" stroke="#dc2626" stroke-width="1.3"/>- <text x="498" y="755" text-anchor="middle" font-size="13" font-weight="700" fill="#dc2626">test</text>- <text x="524" y="750" font-size="15" font-weight="700" fill="#111827">PR #535 specs</text>- <text x="524" y="771" font-size="12" fill="#4b5563">group Figure D + Profile UI Telegram verification</text>-- </g>-- <g id="node-proof">- <rect x="910" y="722" width="390" height="58" rx="10" fill="#f8fafc" stroke="#475569" stroke-width="1.6"/>- <circle cx="938" cy="750" r="16" fill="#ffffff" stroke="#475569" stroke-width="1.3"/>- <text x="938" y="755" text-anchor="middle" font-size="13" font-weight="700" fill="#475569">ok</text>- <text x="964" y="750" font-size="15" font-weight="700" fill="#111827">Local proof</text>- <text x="964" y="771" font-size="12" fill="#4b5563">desktop build, auth tests, T2 E2E passed</text>-- </g>- <g transform="translate(50 850)">- <text x="0" y="-18" font-size="12" font-weight="700" fill="#374151">Legend</text>- <line x1="0" y1="0" x2="34" y2="0" stroke="#2563eb" stroke-width="2" marker-end="url(#arrow-blue)"/><text x="44" y="4" font-size="12" fill="#6b7280">User/workflow flow</text>- <line x1="190" y1="0" x2="224" y2="0" stroke="#dc2626" stroke-width="2" marker-end="url(#arrow-rose)"/><text x="234" y="4" font-size="12" fill="#6b7280">Auth/fail-closed gate</text>- <line x1="420" y1="0" x2="454" y2="0" stroke="#16a34a" stroke-width="2" marker-end="url(#arrow-green)"/><text x="464" y="4" font-size="12" fill="#6b7280">Verified business signal</text>- <line x1="690" y1="0" x2="724" y2="0" stroke="#9333ea" stroke-width="2" marker-end="url(#arrow-purple)"/><text x="734" y="4" font-size="12" fill="#6b7280">Async notification/callback</text>- </g>-</svg>\ No newline at end of filediff --git a/docs/diagrams/sdk-client-notifications-delivery-sequence.png b/docs/diagrams/sdk-client-notifications-delivery-sequence.pngdeleted file mode 100644index b98bf98b1..000000000Binary files a/docs/diagrams/sdk-client-notifications-delivery-sequence.png and /dev/null differdiff --git a/docs/diagrams/sdk-client-notifications-delivery-sequence.svg b/docs/diagrams/sdk-client-notifications-delivery-sequence.svgdeleted file mode 100644index b07e0eea7..000000000--- a/docs/diagrams/sdk-client-notifications-delivery-sequence.svg+++ /dev/null@@ -1,67 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 620">- <defs>- <style>- text { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; fill: #111827; }- .title { font-size: 18px; font-weight: 600; }- .label { font-size: 12px; font-weight: 600; }- .sub { font-size: 11px; fill: #6b7280; }- .msg { font-size: 11px; fill: #374151; }- .frame { fill: #f9fafb; stroke: #d1d5db; stroke-width: 1.2; stroke-dasharray: 4 3; }- </style>- <marker id="arr" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#2563eb"/></marker>- <marker id="arr-g" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#059669"/></marker>- <marker id="arr-o" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#ea580c"/></marker>- <marker id="arr-r" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#dc2626"/></marker>- </defs>- <rect width="1100" height="620" fill="#ffffff"/>- <text x="40" y="32" class="title">SDK clientNotifications — desktop ACK vs channel fallback</text>- <text x="40" y="50" class="sub">Sequence after authorize + enqueue (grace default 90s on next_attempt_at)</text>- <text x="70" y="78" text-anchor="middle" class="label">Workload</text>- <line x1="70" y1="88" x2="70" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="190" y="78" text-anchor="middle" class="label">mcp-host SDK</text>- <line x1="190" y1="88" x2="190" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="330" y="78" text-anchor="middle" class="label">control-api</text>- <line x1="330" y1="88" x2="330" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="490" y="78" text-anchor="middle" class="label">external-rest-api</text>- <line x1="490" y1="88" x2="490" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="650" y="78" text-anchor="middle" class="label">Desktop App</text>- <line x1="650" y1="88" x2="650" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="810" y="78" text-anchor="middle" class="label">channel-reader</text>- <line x1="810" y1="88" x2="810" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <text x="970" y="78" text-anchor="middle" class="label">Telegram/Slack</text>- <line x1="970" y1="88" x2="970" y2="580" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 4"/>- <rect x="20" y="310" width="1060" height="250" rx="6" class="frame"/>- <text x="32" y="328" class="label">alt: no desktop ACK before grace expires</text>- <line x1="70" y1="100" x2="190" y2="100" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arr)"/>- <rect x="35.0" y="86" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="130.0" y="100" text-anchor="middle" class="msg">POST /sdk/v1/client-notifications</text>- <line x1="190" y1="120" x2="330" y2="120" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arr)"/>- <rect x="165.0" y="106" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="260.0" y="120" text-anchor="middle" class="msg">Host JWT → authorizer → INSERT outbox</text>- <rect x="240" y="133" width="180" height="22" fill="#ffffff" opacity="0.95"/>- <text x="330" y="149" text-anchor="middle" class="msg">next_attempt_at = NOW + grace (desktop-first)</text>- <line x1="330" y1="170" x2="490" y2="170" stroke="#059669" stroke-width="1.6" marker-end="url(#arr-g)"/>- <rect x="315.0" y="156" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="410.0" y="170" text-anchor="middle" class="msg">SSE filter: sdk.notification event</text>- <line x1="490" y1="195" x2="650" y2="195" stroke="#059669" stroke-width="1.6" marker-end="url(#arr-g)"/>- <rect x="475.0" y="181" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="570.0" y="195" text-anchor="middle" class="msg">NDJSON stream → bell + toast</text>- <line x1="650" y1="230" x2="490" y2="230" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arr)"/>- <rect x="475.0" y="216" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="570.0" y="230" text-anchor="middle" class="msg">POST /external/notifications/:id/ack</text>- <line x1="490" y1="255" x2="330" y2="255" stroke="#2563eb" stroke-width="1.6" marker-end="url(#arr)"/>- <rect x="315.0" y="241" width="190" height="20" fill="#ffffff" opacity="0.95"/>- <text x="410.0" y="255" text-anchor="middle" class="msg">Session JWT → ACK service</text>- <rect x="240" y="268" width="180" height="22" fill="#ffffff" opacity="0.95"/>- <text x="330" y="284" text-anchor="middle" class="msg">UPDATE status=sent, delivered_medium=desktop</text>- <text x="32" y="548" class="sub">else: desktop ACK terminal row — channel-reader claim skipped for that delivery</text>- <line x1="330" y1="350" x2="810" y2="350" stroke="#ea580c" stroke-width="1.6" marker-end="url(#arr-o)"/>- <rect x="465.0" y="336" width="210" height="20" fill="#ffffff" opacity="0.95"/>- <text x="570.0" y="350" text-anchor="middle" class="msg">claim queued SDK row (next_attempt_at <= NOW)</text>- <line x1="810" y1="385" x2="970" y2="385" stroke="#ea580c" stroke-width="1.6" marker-end="url(#arr-o)"/>- <rect x="785.0" y="371" width="210" height="20" fill="#ffffff" opacity="0.95"/>- <text x="890.0" y="385" text-anchor="middle" class="msg">deliver via preferred medium</text>- <line x1="970" y1="420" x2="810" y2="420" stroke="#ea580c" stroke-width="1.6" marker-end="url(#arr-o)" stroke-dasharray="4 2"/>- <rect x="785.0" y="406" width="210" height="20" fill="#ffffff" opacity="0.95"/>- <text x="890.0" y="420" text-anchor="middle" class="msg">ACK delivery success/fail</text>-</svg>diff --git a/docs/diagrams/telegram-group-figure-d-mind-map.png b/docs/diagrams/telegram-group-figure-d-mind-map.pngdeleted file mode 100644index bcb2c0515..000000000Binary files a/docs/diagrams/telegram-group-figure-d-mind-map.png and /dev/null differdiff --git a/docs/diagrams/telegram-group-figure-d-mind-map.svg b/docs/diagrams/telegram-group-figure-d-mind-map.svgdeleted file mode 100644index 58869519d..000000000--- a/docs/diagrams/telegram-group-figure-d-mind-map.svg+++ /dev/null@@ -1,112 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 940" width="1400" height="940">- <style>text { font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Microsoft YaHei', 'Microsoft JhengHei', 'SimHei', sans-serif; }</style>- <defs>- <marker id="arrow-blue" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#2563eb"/></marker>- </defs>- <rect width="1400" height="940" fill="#ffffff"/>- <text x="50" y="46" font-size="24" font-weight="700" fill="#111827">Evenfire PR #535 Figure D solution mind map</text>- <text x="50" y="72" font-size="13" fill="#6b7280">Code-validated Figure D map · head 1b90d04d9861 · Profile UI password auth included</text>- <path d="M 700 455 C 695 455, 695 160, 690 160" fill="none" stroke="#111827" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 865 455, 865 250, 1030 250" fill="none" stroke="#2563eb" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 905 455, 905 540, 1110 540" fill="none" stroke="#0284c7" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 810 455, 810 780, 920 780" fill="none" stroke="#0f766e" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 630 455, 630 805, 560 805" fill="none" stroke="#7c3aed" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 462.5 455, 462.5 690, 225 690" fill="none" stroke="#ea580c" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 430 455, 430 365, 160 365" fill="none" stroke="#dc2626" stroke-width="2" opacity="0.8"/>-<path d="M 700 455 C 545 455, 545 170, 390 170" fill="none" stroke="#16a34a" stroke-width="2" opacity="0.8"/>- <g id="center">- <circle cx="700" cy="455" r="116" fill="#f8fafc" stroke="#475569" stroke-width="2"/>- <text x="700" y="425" text-anchor="middle" font-size="18" font-weight="700" fill="#111827">PR #535 Figure D</text>- <text x="700" y="449" text-anchor="middle" font-size="13" fill="#374151">Telegram group + approval DM</text>- <text x="700" y="471" text-anchor="middle" font-size="13" fill="#374151">Profile UI verified medium</text>- <text x="700" y="493" text-anchor="middle" font-size="13" fill="#374151">fail-closed / fail-fast proof</text>- </g>-- <g id="branch-figureD">- <rect x="575" y="122" width="300" height="154" rx="14" fill="#f9fafb" stroke="#111827" stroke-width="1.6"/>- <circle cx="608" cy="155" r="18" fill="#ffffff" stroke="#111827" stroke-width="1.3"/>- <text x="608" y="160" text-anchor="middle" font-size="12" font-weight="700" fill="#111827">D</text>- <text x="638" y="160" font-size="15" font-weight="700" fill="#111827">Figure D journey</text>- <text x="710" y="216" font-size="12" fill="#4b5563">• 3rd-party MCP host requests approval</text>-<text x="710" y="234" font-size="12" fill="#4b5563">• Control API records gated intent</text>-<text x="710" y="252" font-size="12" fill="#4b5563">• Telegram approver decides in private DM</text>-<text x="710" y="270" font-size="12" fill="#4b5563">• Workflow resumes or protected step fails</text>- </g>-- <g id="branch-profile">- <rect x="915" y="212" width="300" height="154" rx="14" fill="#eff6ff" stroke="#2563eb" stroke-width="1.6"/>- <circle cx="948" cy="245" r="18" fill="#ffffff" stroke="#2563eb" stroke-width="1.3"/>- <text x="948" y="250" text-anchor="middle" font-size="12" font-weight="700" fill="#2563eb">UI</text>- <text x="978" y="250" font-size="15" font-weight="700" fill="#111827">Profile UI access</text>- <text x="1050" y="306" font-size="12" fill="#4b5563">• real password login</text>-<text x="1050" y="324" font-size="12" fill="#4b5563">• external_session_token in localStorage + cookie</text>-<text x="1050" y="342" font-size="12" fill="#4b5563">• Bearer token on protected calls</text>-<text x="1050" y="360" font-size="12" fill="#4b5563">• 401 clears session fail-closed</text>- </g>-- <g id="branch-telegram">- <rect x="995" y="502" width="300" height="154" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.6"/>- <circle cx="1028" cy="535" r="18" fill="#ffffff" stroke="#0284c7" stroke-width="1.3"/>- <text x="1028" y="540" text-anchor="middle" font-size="12" font-weight="700" fill="#0284c7">TG</text>- <text x="1058" y="540" font-size="15" font-weight="700" fill="#111827">Telegram path</text>- <text x="1130" y="596" font-size="12" fill="#4b5563">• request starts from group</text>-<text x="1130" y="614" font-size="12" fill="#4b5563">• approval goes to private DM</text>-<text x="1130" y="632" font-size="12" fill="#4b5563">• compact callback a/d:id:~hash</text>-<text x="1130" y="650" font-size="12" fill="#4b5563">• fake Telegram only in T2 tests</text>- </g>-- <g id="branch-gateway">- <rect x="805" y="742" width="300" height="154" rx="14" fill="#f0fdfa" stroke="#0f766e" stroke-width="1.6"/>- <circle cx="838" cy="775" r="18" fill="#ffffff" stroke="#0f766e" stroke-width="1.3"/>- <text x="838" y="780" text-anchor="middle" font-size="12" font-weight="700" fill="#0f766e">GW</text>- <text x="868" y="780" font-size="15" font-weight="700" fill="#111827">Channel gateway</text>- <text x="940" y="836" font-size="12" fill="#4b5563">• CommunicationChannel CRD</text>-<text x="940" y="854" font-size="12" fill="#4b5563">• channel-reader polls provider</text>-<text x="940" y="872" font-size="12" fill="#4b5563">• approval-request-reader resolves callback</text>-<text x="940" y="890" font-size="12" fill="#4b5563">• no provider HTTP ingress</text>- </g>-- <g id="branch-control">- <rect x="445" y="767" width="300" height="154" rx="14" fill="#faf5ff" stroke="#7c3aed" stroke-width="1.6"/>- <circle cx="478" cy="800" r="18" fill="#ffffff" stroke="#7c3aed" stroke-width="1.3"/>- <text x="478" y="805" text-anchor="middle" font-size="12" font-weight="700" fill="#7c3aed">API</text>- <text x="508" y="805" font-size="15" font-weight="700" fill="#111827">Control plane</text>- <text x="580" y="861" font-size="12" fill="#4b5563">• approval intent + notification queue</text>-<text x="580" y="879" font-size="12" fill="#4b5563">• workflow medium verification</text>-<text x="580" y="897" font-size="12" fill="#4b5563">• decision API</text>-<text x="580" y="915" font-size="12" fill="#4b5563">• x-user-session-token forwarding</text>- </g>-- <g id="branch-runtime">- <rect x="110" y="652" width="300" height="154" rx="14" fill="#fff7ed" stroke="#ea580c" stroke-width="1.6"/>- <circle cx="143" cy="685" r="18" fill="#ffffff" stroke="#ea580c" stroke-width="1.3"/>- <text x="143" y="690" text-anchor="middle" font-size="12" font-weight="700" fill="#ea580c">RUN</text>- <text x="173" y="690" font-size="15" font-weight="700" fill="#111827">Sandbox runtime</text>- <text x="245" y="746" font-size="12" fill="#4b5563">• WorkflowRecipe in sandbox-recipes</text>-<text x="245" y="764" font-size="12" fill="#4b5563">• runtime mcp-host posts decision</text>-<text x="245" y="782" font-size="12" fill="#4b5563">• approve reaches Succeeded</text>-<text x="245" y="800" font-size="12" fill="#4b5563">• deny blocks protected final step</text>- </g>-- <g id="branch-quality">- <rect x="45" y="327" width="300" height="154" rx="14" fill="#fef2f2" stroke="#dc2626" stroke-width="1.6"/>- <circle cx="78" cy="360" r="18" fill="#ffffff" stroke="#dc2626" stroke-width="1.3"/>- <text x="78" y="365" text-anchor="middle" font-size="12" font-weight="700" fill="#dc2626">QA</text>- <text x="108" y="365" font-size="15" font-weight="700" fill="#111827">E2E quality rules</text>- <text x="180" y="421" font-size="12" fill="#4b5563">• seed env matches Playwright env</text>-<text x="180" y="439" font-size="12" fill="#4b5563">• bounded waits before locator actions</text>-<text x="180" y="457" font-size="12" fill="#4b5563">• selectors match real roles</text>-<text x="180" y="475" font-size="12" fill="#4b5563">• row-specific assertions for existing accounts</text>- </g>-- <g id="branch-proof">- <rect x="275" y="132" width="300" height="154" rx="14" fill="#f0fdf4" stroke="#16a34a" stroke-width="1.6"/>- <circle cx="308" cy="165" r="18" fill="#ffffff" stroke="#16a34a" stroke-width="1.3"/>- <text x="308" y="170" text-anchor="middle" font-size="12" font-weight="700" fill="#16a34a">OK</text>- <text x="338" y="170" font-size="15" font-weight="700" fill="#111827">Local proof</text>- <text x="410" y="226" font-size="12" fill="#4b5563">• desktop-app build passed</text>-<text x="410" y="244" font-size="12" fill="#4b5563">• external-rest-api auth tests passed</text>-<text x="410" y="262" font-size="12" fill="#4b5563">• Profile UI Telegram E2E passed</text>-<text x="410" y="280" font-size="12" fill="#4b5563">• Figure D group approval E2E passed earlier</text>- </g>-</svg>diff --git a/docs/diagrams/user-approval-architecture.html b/docs/diagrams/user-approval-architecture.htmldeleted file mode 100644index 42c3c6841..000000000--- a/docs/diagrams/user-approval-architecture.html+++ /dev/null@@ -1,287 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Clerum — User Approval Requests v0.1 Architecture</title>- <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">- <style>- * { margin: 0; padding: 0; box-sizing: border-box; }- body { font-family: 'JetBrains Mono', monospace; background: #020617; min-height: 100vh; padding: 2rem; color: white; }- .container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }- .header-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }- .pulse-dot { width: 12px; height: 12px; background: #22d3ee; border-radius: 50%; animation: pulse 2s infinite; }- @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }- h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }- .subtitle { color: #94a3b8; font-size: 0.875rem; margin-left: 1.75rem; }- .diagram-container { background: rgba(15, 23, 42, 0.5); border-radius: 1rem; border: 1px solid #1e293b; padding: 1.5rem; overflow-x: auto; }- svg { width: 100%; min-width: 900px; display: block; }- .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 2rem; }- .card { background: rgba(15, 23, 42, 0.5); border-radius: 0.75rem; border: 1px solid #1e293b; padding: 1.25rem; }- .card-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }- .card-dot { width: 8px; height: 8px; border-radius: 50%; }- .card-dot.cyan { background: #22d3ee; } .card-dot.emerald { background: #34d399; } .card-dot.violet { background: #a78bfa; } .card-dot.amber { background: #fbbf24; } .card-dot.rose { background: #fb7185; }- .card h3 { font-size: 0.875rem; font-weight: 600; }- .card ul { list-style: none; color: #94a3b8; font-size: 0.75rem; }- .card li { margin-bottom: 0.375rem; }- .footer { text-align: center; margin-top: 1.5rem; color: #475569; font-size: 0.75rem; }- </style>-</head>-<body>- <div class="container">- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>User Approval Requests v0.1 — Architecture</h1>- </div>- <p class="subtitle">Step-level gating in coordinator Pod, LLM-isolated tokens, dedicated gateway :8092</p>- </div>-- <div class="diagram-container">- <svg viewBox="0 0 1200 820">- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#64748b" />- </marker>- <marker id="arrow-rose" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#fb7185" />- </marker>- <marker id="arrow-cyan" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#22d3ee" />- </marker>- <marker id="arrow-emerald" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#34d399" />- </marker>- <marker id="arrow-amber" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#fbbf24" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1e293b" stroke-width="0.5"/>- </pattern>- </defs>-- <!-- Background Grid -->- <rect width="100%" height="100%" fill="url(#grid)" />-- <!-- ===== ARROWS (drawn first, behind boxes) ===== -->-- <!-- coordinator → mcp-host (existing: POST /execute) -->- <line x1="210" y1="240" x2="210" y2="340" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>- <text x="225" y="295" fill="#34d399" font-size="8">POST /execute</text>- <text x="225" y="306" fill="#34d399" font-size="7">Bearer mcp-host-token</text>-- <!-- coordinator → nginx gateway (NEW: approval request) -->- <line x1="330" y1="200" x2="568" y2="200" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-rose)"/>- <text x="440" y="193" fill="#fb7185" font-size="8">POST /workflow-approvals/request</text>- <text x="440" y="204" fill="#fb7185" font-size="7">Bearer mcpHostJwt access token</text>-- <!-- nginx gateway → control-api -->- <line x1="680" y1="230" x2="680" y2="320" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>- <text x="690" y="278" fill="#94a3b8" font-size="8">proxy_pass</text>- <text x="690" y="289" fill="#94a3b8" font-size="7">:8092 → :8090</text>-- <!-- control-api → Postgres -->- <line x1="680" y1="430" x2="680" y2="510" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <text x="690" y="475" fill="#94a3b8" font-size="8">SQL</text>-- <!-- WRC → control-api (runtime token issuance) -->- <line x1="490" y1="590" x2="590" y2="430" stroke="#fbbf24" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-amber)"/>- <text x="490" y="530" fill="#fbbf24" font-size="7">POST /auth/mcp-host/:ns/:name/tokens</text>- <text x="490" y="541" fill="#fbbf24" font-size="7">InternalControl iss=wrc</text>-- <!-- WRC → coordinator (spawn Secret) -->- <line x1="370" y1="580" x2="210" y2="260" stroke="#fbbf24" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-amber)"/>- <text x="245" y="420" fill="#fbbf24" font-size="7" transform="rotate(-55, 245, 420)">spawn + inject tokens</text>-- <!-- external-rest-api → control-api (decision path) -->- <line x1="930" y1="380" x2="790" y2="380" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrow-cyan)"/>- <text x="840" y="373" fill="#22d3ee" font-size="8">POST /external/decisions/:id</text>-- <!-- User → external-rest-api -->- <line x1="1040" y1="500" x2="1040" y2="420" stroke="#94a3b8" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <text x="1052" y="465" fill="#94a3b8" font-size="8">1st-party OAuth</text>-- <!-- control-api → notification_deliveries (pg_notify) -->- <line x1="790" y1="350" x2="910" y2="310" stroke="#fb923c" stroke-width="1.2" stroke-dasharray="3,3" marker-end="url(#arrowhead)"/>- <text x="830" y="318" fill="#fb923c" font-size="7">pg_notify</text>-- <!-- ===== NAMESPACE: sandbox-recipes ===== -->- <rect x="50" y="70" width="360" height="510" rx="12" fill="rgba(6, 78, 59, 0.05)" stroke="#34d399" stroke-width="1" stroke-dasharray="8,4"/>- <text x="62" y="88" fill="#34d399" font-size="10" font-weight="600">namespace: sandbox-recipes</text>-- <!-- coordinator Pod -->- <rect x="80" y="130" width="250" height="130" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="80" y="130" width="250" height="130" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="205" y="155" fill="white" font-size="11" font-weight="600" text-anchor="middle">${recipe}-coordinator</text>- <text x="205" y="173" fill="#94a3b8" font-size="9" text-anchor="middle">Pod [EXISTING, EXTEND]</text>- <text x="205" y="191" fill="#34d399" font-size="8" text-anchor="middle">Secret env (NEW): MCP_HOST_RUNTIME_ACCESS_TOKEN</text>- <text x="205" y="203" fill="#34d399" font-size="8" text-anchor="middle">MCP_HOST_RUNTIME_REFRESH_TOKEN, MCP_HOST_GATEWAY_URL</text>- <text x="205" y="220" fill="#94a3b8" font-size="8" text-anchor="middle">coordinator.ts: step.requiresApproval → gate()</text>- <text x="205" y="232" fill="#94a3b8" font-size="8" text-anchor="middle">approvalRequester.ts [NEW]</text>- <text x="205" y="249" fill="#22d3ee" font-size="7" text-anchor="middle">Health :8090 | phase: awaiting-approval</text>-- <!-- mcp-host Pod -->- <rect x="80" y="340" width="250" height="100" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="80" y="340" width="250" height="100" rx="6" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="205" y="365" fill="white" font-size="11" font-weight="600" text-anchor="middle">${recipe}-mcp-host</text>- <text x="205" y="383" fill="#94a3b8" font-size="9" text-anchor="middle">Pod [EXISTING, UNCHANGED]</text>- <text x="205" y="401" fill="#fb7185" font-size="8" text-anchor="middle">NO approval tokens. NO calls to control-api.</text>- <text x="205" y="413" fill="#fb7185" font-size="8" text-anchor="middle">LLM is agnostic to approvals.</text>- <text x="205" y="430" fill="#22d3ee" font-size="7" text-anchor="middle">Service wf-${recipe}-mcp-host:8080</text>-- <!-- NP #8 -->- <rect x="80" y="460" width="250" height="30" rx="4" fill="rgba(136, 19, 55, 0.2)" stroke="#fb7185" stroke-width="1" stroke-dasharray="3,3"/>- <text x="205" y="479" fill="#fb7185" font-size="8" text-anchor="middle">NP #8: coord → approval-gateway:8092 [NEW]</text>-- <!-- ===== NAMESPACE: control-plane ===== -->- <rect x="440" y="70" width="470" height="510" rx="12" fill="rgba(120, 53, 15, 0.03)" stroke="#fbbf24" stroke-width="1" stroke-dasharray="8,4"/>- <text x="452" y="88" fill="#fbbf24" font-size="10" font-weight="600">namespace: control-plane</text>-- <!-- nginx-workflow-approval-gateway -->- <rect x="570" y="130" width="220" height="70" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="570" y="130" width="220" height="70" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="680" y="155" fill="white" font-size="11" font-weight="600" text-anchor="middle">nginx-workflow-approval-gateway</text>- <text x="680" y="173" fill="#94a3b8" font-size="9" text-anchor="middle">[NEW] Service ClusterIP :8092</text>- <text x="680" y="188" fill="#22d3ee" font-size="7" text-anchor="middle">2 replicas + PDB | proxy_pass → control-api:8090</text>-- <!-- control-api -->- <rect x="570" y="320" width="220" height="110" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="570" y="320" width="220" height="110" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="680" y="345" fill="white" font-size="11" font-weight="600" text-anchor="middle">control-api :8090</text>- <text x="680" y="363" fill="#94a3b8" font-size="9" text-anchor="middle">[EXISTING, EXTEND]</text>- <text x="680" y="380" fill="#34d399" font-size="8" text-anchor="middle">routes/mcp-host/* [NEW]</text>- <text x="680" y="392" fill="#34d399" font-size="8" text-anchor="middle">routes/auth/mcp-host/* [NEW]</text>- <text x="680" y="404" fill="#34d399" font-size="8" text-anchor="middle">middleware/internalControlJwt [NEW]</text>- <text x="680" y="416" fill="#34d399" font-size="8" text-anchor="middle">services/userApprovalRequestService [NEW]</text>-- <!-- Postgres -->- <rect x="590" y="510" width="180" height="55" rx="6" fill="rgba(76, 29, 149, 0.4)" stroke="#a78bfa" stroke-width="1.5"/>- <text x="680" y="533" fill="white" font-size="11" font-weight="600" text-anchor="middle">Postgres</text>- <text x="680" y="551" fill="#94a3b8" font-size="9" text-anchor="middle">+4 tables [NEW] in db.ts:initDb()</text>-- <!-- WRC -->- <rect x="460" y="570" width="180" height="60" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="460" y="570" width="180" height="60" rx="6" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="550" y="593" fill="white" font-size="11" font-weight="600" text-anchor="middle">WRC (workflow-recipes)</text>- <text x="550" y="611" fill="#94a3b8" font-size="9" text-anchor="middle">[EXISTING, EXTEND]</text>- <text x="550" y="623" fill="#34d399" font-size="7" text-anchor="middle">+mcpHostRuntimeTokenIssuerClient [NEW]</text>-- <!-- notification_deliveries (event bus) -->- <rect x="820" y="280" width="160" height="55" rx="4" fill="rgba(251, 146, 60, 0.2)" stroke="#fb923c" stroke-width="1"/>- <text x="900" y="302" fill="#fb923c" font-size="9" font-weight="600" text-anchor="middle">notification_deliveries</text>- <text x="900" y="318" fill="#94a3b8" font-size="7" text-anchor="middle">[NEW] Event table + pg_notify</text>- <text x="900" y="329" fill="#94a3b8" font-size="7" text-anchor="middle">Consumer: notification-service (futuro)</text>-- <!-- ===== EXTERNAL ZONE ===== -->- <rect x="930" y="300" width="240" height="260" rx="12" fill="rgba(8, 51, 68, 0.05)" stroke="#22d3ee" stroke-width="1" stroke-dasharray="8,4"/>- <text x="942" y="318" fill="#22d3ee" font-size="10" font-weight="600">External UX Plane</text>-- <!-- external-rest-api -->- <rect x="950" y="340" width="200" height="60" rx="6" fill="rgba(8, 51, 68, 0.4)" stroke="#22d3ee" stroke-width="1.5"/>- <text x="1050" y="363" fill="white" font-size="11" font-weight="600" text-anchor="middle">external-rest-api</text>- <text x="1050" y="381" fill="#94a3b8" font-size="9" text-anchor="middle">[EXISTING, UNCHANGED]</text>- <text x="1050" y="393" fill="#94a3b8" font-size="7" text-anchor="middle">service gate + session JWT</text>-- <!-- User -->- <rect x="950" y="500" width="200" height="50" rx="6" fill="rgba(30, 41, 59, 0.5)" stroke="#94a3b8" stroke-width="1.5"/>- <text x="1050" y="522" fill="white" font-size="11" font-weight="600" text-anchor="middle">User</text>- <text x="1050" y="539" fill="#94a3b8" font-size="9" text-anchor="middle">Browser / Desktop App</text>-- <!-- ===== LEGEND ===== -->- <text x="60" y="610" fill="white" font-size="10" font-weight="600">Legend</text>-- <line x1="60" y1="625" x2="80" y2="625" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>- <text x="85" y="628" fill="#94a3b8" font-size="8">Existing flow</text>-- <line x1="60" y1="645" x2="80" y2="645" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-rose)"/>- <text x="85" y="648" fill="#94a3b8" font-size="8">NEW approval flow</text>-- <line x1="60" y1="665" x2="80" y2="665" stroke="#fbbf24" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-amber)"/>- <text x="85" y="668" fill="#94a3b8" font-size="8">Spawn / token injection</text>-- <line x1="60" y1="685" x2="80" y2="685" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrow-cyan)"/>- <text x="85" y="688" fill="#94a3b8" font-size="8">User decision path</text>-- <rect x="250" y="615" width="16" height="10" rx="2" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1"/>- <text x="272" y="623" fill="#94a3b8" font-size="8">Backend (EXISTING)</text>-- <rect x="250" y="635" width="16" height="10" rx="2" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1"/>- <text x="272" y="643" fill="#94a3b8" font-size="8">Backend (UNCHANGED)</text>-- <rect x="250" y="655" width="16" height="10" rx="2" fill="rgba(76, 29, 149, 0.4)" stroke="#a78bfa" stroke-width="1"/>- <text x="272" y="663" fill="#94a3b8" font-size="8">Database</text>-- <rect x="250" y="675" width="16" height="10" rx="2" fill="rgba(8, 51, 68, 0.4)" stroke="#22d3ee" stroke-width="1"/>- <text x="272" y="683" fill="#94a3b8" font-size="8">Frontend / External</text>-- <rect x="250" y="695" width="16" height="10" rx="2" fill="rgba(251, 146, 60, 0.2)" stroke="#fb923c" stroke-width="1"/>- <text x="272" y="703" fill="#94a3b8" font-size="8">Event Bus / Notification</text>-- <rect x="250" y="715" width="16" height="10" rx="2" fill="rgba(136, 19, 55, 0.2)" stroke="#fb7185" stroke-width="1" stroke-dasharray="3,3"/>- <text x="272" y="723" fill="#94a3b8" font-size="8">NetworkPolicy</text>-- <!-- Invariants box -->- <rect x="500" y="610" width="380" height="120" rx="6" fill="rgba(136, 19, 55, 0.1)" stroke="#fb7185" stroke-width="1"/>- <text x="510" y="630" fill="#fb7185" font-size="9" font-weight="600">Security Invariants S1-S7</text>- <text x="510" y="646" fill="#94a3b8" font-size="7">S1: admin private key stays in control-api only</text>- <text x="510" y="658" fill="#94a3b8" font-size="7">S2: Recipe-bound mcpHostJwt with hostRefs</text>- <text x="510" y="670" fill="#94a3b8" font-size="7">S3: Runtime capabilities: request, refresh, trigger</text>- <text x="510" y="682" fill="#94a3b8" font-size="7">S4: User identity via session/OAuth only</text>- <text x="510" y="694" fill="#94a3b8" font-size="7">S5: Operator allowlist enforced at request time</text>- <text x="510" y="706" fill="#94a3b8" font-size="7">S6: Access TTL 10min, refresh rotated one-time</text>- <text x="510" y="718" fill="#94a3b8" font-size="7">S7: No direct internet → sandbox-recipes</text>- </svg>- </div>-- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot rose"></div>- <h3>Approval Request Flow (A)</h3>- </div>- <ul>- <li>1. Coordinator detects step.requiresApproval</li>- <li>2. POST /workflow-approvals/request via gateway :8092</li>- <li>3. control-api validates JWT + allowlist + persists</li>- <li>4. Emits event to notification_deliveries</li>- <li>5. Coordinator polls GET /:id/status every 5s</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot cyan"></div>- <h3>User Decision Flow (B)</h3>- </div>- <ul>- <li>1. User → external-rest-api (session/OAuth)</li>- <li>2. external-rest-api → control-api decision route</li>- <li>3. control-api validates user eligibility</li>- <li>4. Updates status: pending → approved/denied</li>- <li>5. Coordinator observes polling result → resumes step</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot amber"></div>- <h3>Token Auth Chain</h3>- </div>- <ul>- <li>WRC/HCC → control-api: InternalControl JWT with issuer-specific HS256 secret</li>- <li>control-api → mcp-host runtime: mcpHostJwt access, refresh, and control tokens</li>- <li>hostRefs bind each token to namespace/name</li>- <li>Refresh token rotated one-time on every use</li>- <li>mcp-host pods never mount InternalControl JWT</li>- </ul>- </div>- </div>-- <p class="footer">- Clerum — User Approval Requests v0.1 • Runtime Architecture- </p>- </div>-</body>-</html>diff --git a/docs/diagrams/user-approval-flow-decision.html b/docs/diagrams/user-approval-flow-decision.htmldeleted file mode 100644index f89cc34b8..000000000--- a/docs/diagrams/user-approval-flow-decision.html+++ /dev/null@@ -1,268 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Clerum — User Decision Flow (Flow B) + JWT Chain</title>- <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">- <style>- * { margin: 0; padding: 0; box-sizing: border-box; }- body { font-family: 'JetBrains Mono', monospace; background: #020617; min-height: 100vh; padding: 2rem; color: white; }- .container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }- .header-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }- .pulse-dot { width: 12px; height: 12px; background: #22d3ee; border-radius: 50%; animation: pulse 2s infinite; }- @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }- h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }- .subtitle { color: #94a3b8; font-size: 0.875rem; margin-left: 1.75rem; }- .diagram-container { background: rgba(15, 23, 42, 0.5); border-radius: 1rem; border: 1px solid #1e293b; padding: 1.5rem; overflow-x: auto; }- svg { width: 100%; min-width: 900px; display: block; }- .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 2rem; }- .card { background: rgba(15, 23, 42, 0.5); border-radius: 0.75rem; border: 1px solid #1e293b; padding: 1.25rem; }- .card-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }- .card-dot { width: 8px; height: 8px; border-radius: 50%; }- .card-dot.cyan { background: #22d3ee; } .card-dot.emerald { background: #34d399; } .card-dot.violet { background: #a78bfa; } .card-dot.amber { background: #fbbf24; } .card-dot.rose { background: #fb7185; }- .card h3 { font-size: 0.875rem; font-weight: 600; }- .card ul { list-style: none; color: #94a3b8; font-size: 0.75rem; }- .card li { margin-bottom: 0.375rem; }- .footer { text-align: center; margin-top: 1.5rem; color: #475569; font-size: 0.75rem; }- </style>-</head>-<body>- <div class="container">- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>Flow B — User Decision + JWT Auth Chain</h1>- </div>- <p class="subtitle">User responds via external-rest-api → control-api updates status → coordinator resumes</p>- </div>-- <div class="diagram-container">- <svg viewBox="0 0 1100 750">- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#64748b" />- </marker>- <marker id="arrow-cyan" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#22d3ee" />- </marker>- <marker id="arrow-rose" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#fb7185" />- </marker>- <marker id="arrow-emerald" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#34d399" />- </marker>- <marker id="arrow-amber" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#fbbf24" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1e293b" stroke-width="0.5"/>- </pattern>- </defs>-- <rect width="100%" height="100%" fill="url(#grid)" />-- <!-- ===== FLOW B: User Decision ===== -->-- <!-- Step 1: User clicks approve/deny -->- <circle cx="50" cy="80" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="50" y="84" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">1</text>-- <rect x="80" y="55" width="170" height="50" rx="6" fill="rgba(30, 41, 59, 0.5)" stroke="#94a3b8" stroke-width="1.5"/>- <text x="165" y="78" fill="white" font-size="11" font-weight="600" text-anchor="middle">User (Browser/App)</text>- <text x="165" y="93" fill="#94a3b8" font-size="8" text-anchor="middle">1st-party session / OAuth</text>-- <!-- Step 2: external-rest-api -->- <circle cx="50" cy="180" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="50" y="184" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">2</text>-- <rect x="80" y="155" width="170" height="50" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="80" y="155" width="170" height="50" rx="6" fill="rgba(8, 51, 68, 0.4)" stroke="#22d3ee" stroke-width="1.5"/>- <text x="165" y="178" fill="white" font-size="11" font-weight="600" text-anchor="middle">external-rest-api</text>- <text x="165" y="193" fill="#94a3b8" font-size="8" text-anchor="middle">POST /external/decisions/:id</text>- <text x="165" y="201" fill="#22d3ee" font-size="7" text-anchor="middle">service gate + session JWT</text>-- <line x1="165" y1="105" x2="165" y2="153" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrow-cyan)"/>- <text x="178" y="135" fill="#22d3ee" font-size="7">{decision, note?}</text>-- <!-- Step 3: control-api validates -->- <circle cx="340" cy="180" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="340" y="184" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">3</text>-- <rect x="370" y="130" width="230" height="100" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="370" y="130" width="230" height="100" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="485" y="153" fill="white" font-size="11" font-weight="600" text-anchor="middle">control-api</text>- <text x="485" y="171" fill="#fb7185" font-size="8" text-anchor="middle">1. Validate user session (NO JWT)</text>- <text x="485" y="183" fill="#fb7185" font-size="8" text-anchor="middle">2. Eligibility: target_user_id match</text>- <text x="485" y="195" fill="#fb7185" font-size="8" text-anchor="middle"> OR target_team_id membership</text>- <text x="485" y="207" fill="#fb7185" font-size="8" text-anchor="middle">3. Verify status='pending'</text>- <text x="485" y="222" fill="#34d399" font-size="7" text-anchor="middle">UPDATE status → approved | denied</text>-- <line x1="250" y1="180" x2="368" y2="180" stroke="#22d3ee" stroke-width="1.5" marker-end="url(#arrow-cyan)"/>-- <!-- Step 4: Postgres -->- <circle cx="680" cy="180" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="680" y="184" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">4</text>-- <rect x="710" y="155" width="160" height="50" rx="6" fill="rgba(76, 29, 149, 0.4)" stroke="#a78bfa" stroke-width="1.5"/>- <text x="790" y="178" fill="white" font-size="11" font-weight="600" text-anchor="middle">Postgres</text>- <text x="790" y="196" fill="#94a3b8" font-size="8" text-anchor="middle">decision_maker = {user, note}</text>-- <line x1="600" y1="180" x2="708" y2="180" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrowhead)"/>-- <!-- Step 5: coordinator polls -->- <circle cx="340" cy="310" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="340" y="314" fill="#fb7185" font-size="12" font-weight="700" text-anchor="middle">5</text>-- <rect x="370" y="280" width="230" height="60" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="370" y="280" width="230" height="60" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="485" y="303" fill="white" font-size="11" font-weight="600" text-anchor="middle">coordinator (polling)</text>- <text x="485" y="321" fill="#94a3b8" font-size="8" text-anchor="middle">GET /workflow-approvals/:id/status</text>- <text x="485" y="333" fill="#34d399" font-size="7" text-anchor="middle">status=approved → resumes step execution</text>-- <!-- Arrow Postgres→coordinator (polled) -->- <path d="M 710 195 L 660 195 L 660 310 L 600 310" fill="none" stroke="#34d399" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-emerald)"/>- <text x="670" y="255" fill="#34d399" font-size="7" transform="rotate(90, 670, 255)">poll result</text>-- <!-- Step 6: coordinator dispatches step -->- <circle cx="340" cy="400" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="340" y="404" fill="#34d399" font-size="12" font-weight="700" text-anchor="middle">6</text>-- <rect x="370" y="370" width="230" height="55" rx="6" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="485" y="393" fill="white" font-size="11" font-weight="600" text-anchor="middle">coordinator → mcp-host</text>- <text x="485" y="411" fill="#94a3b8" font-size="9" text-anchor="middle">POST /execute (resumes step)</text>- <text x="485" y="420" fill="#94a3b8" font-size="7" text-anchor="middle">approval result injected in context</text>-- <line x1="485" y1="340" x2="485" y2="368" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>--- <!-- ===== JWT AUTH CHAIN (bottom section) ===== -->- <rect x="60" y="460" width="980" height="260" rx="8" fill="rgba(136, 19, 55, 0.05)" stroke="#fb7185" stroke-width="1" stroke-dasharray="8,4"/>- <text x="80" y="482" fill="#fb7185" font-size="11" font-weight="600">JWT Auth Chain — Two Token Issuance Paths</text>-- <!-- Path 1: WRC → control-api -->- <text x="100" y="510" fill="#fbbf24" font-size="9" font-weight="600">Path 1: Token Issuance (WRC → control-api)</text>-- <!-- WRC -->- <rect x="100" y="525" width="140" height="45" rx="4" fill="#0f172a" stroke-width="0"/>- <rect x="100" y="525" width="140" height="45" rx="4" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="170" y="545" fill="white" font-size="9" font-weight="600" text-anchor="middle">WRC</text>- <text x="170" y="560" fill="#94a3b8" font-size="7" text-anchor="middle">JwtTokenFactory</text>-- <!-- JWT box 1 -->- <rect x="290" y="520" width="200" height="55" rx="4" fill="rgba(136, 19, 55, 0.15)" stroke="#fb7185" stroke-width="1"/>- <text x="390" y="538" fill="#fb7185" font-size="8" font-weight="600" text-anchor="middle">InternalControl JWT (HS256)</text>- <text x="390" y="552" fill="#94a3b8" font-size="7" text-anchor="middle">iss=wrc | aud=control-api</text>- <text x="390" y="563" fill="#94a3b8" font-size="7" text-anchor="middle">sub=wrc | issuer-specific secret</text>-- <line x1="240" y1="548" x2="288" y2="548" stroke="#fbbf24" stroke-width="1.5" marker-end="url(#arrow-amber)"/>-- <!-- control-api issue -->- <rect x="540" y="525" width="140" height="45" rx="4" fill="#0f172a" stroke-width="0"/>- <rect x="540" y="525" width="140" height="45" rx="4" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="610" y="545" fill="white" font-size="9" font-weight="600" text-anchor="middle">control-api</text>- <text x="610" y="560" fill="#94a3b8" font-size="7" text-anchor="middle">POST /auth/mcp-host/:ns/:name/tokens</text>-- <line x1="490" y1="548" x2="538" y2="548" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="3,3" marker-end="url(#arrow-rose)"/>- <text x="514" y="541" fill="#94a3b8" font-size="7">verify</text>-- <!-- Tokens returned -->- <rect x="730" y="520" width="240" height="55" rx="4" fill="rgba(6, 78, 59, 0.15)" stroke="#34d399" stroke-width="1"/>- <text x="850" y="538" fill="#34d399" font-size="8" font-weight="600" text-anchor="middle">mcpHostJwt tokens issued</text>- <text x="850" y="552" fill="#94a3b8" font-size="7" text-anchor="middle">access + refresh + control</text>- <text x="850" y="563" fill="#94a3b8" font-size="7" text-anchor="middle">hostRefs bind namespace/name</text>-- <line x1="680" y1="548" x2="728" y2="548" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>-- <!-- Path 2: coordinator → control-api -->- <text x="100" y="610" fill="#fbbf24" font-size="9" font-weight="600">Path 2: Approval Request (coordinator → control-api)</text>-- <!-- coordinator -->- <rect x="100" y="625" width="140" height="45" rx="4" fill="#0f172a" stroke-width="0"/>- <rect x="100" y="625" width="140" height="45" rx="4" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="170" y="645" fill="white" font-size="9" font-weight="600" text-anchor="middle">coordinator</text>- <text x="170" y="660" fill="#94a3b8" font-size="7" text-anchor="middle">approvalRequester.ts</text>-- <!-- Access token -->- <rect x="290" y="625" width="200" height="50" rx="4" fill="rgba(136, 19, 55, 0.15)" stroke="#fb7185" stroke-width="1"/>- <text x="390" y="645" fill="#fb7185" font-size="8" font-weight="600" text-anchor="middle">Access Token (env: MCP_HOST_RUNTIME_ACCESS_TOKEN)</text>- <text x="390" y="660" fill="#94a3b8" font-size="7" text-anchor="middle">Bearer header | recipe-binding enforced</text>-- <line x1="240" y1="648" x2="288" y2="650" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="3,3" marker-end="url(#arrow-rose)"/>-- <!-- gateway -->- <rect x="540" y="625" width="140" height="45" rx="4" fill="#0f172a" stroke-width="0"/>- <rect x="540" y="625" width="140" height="45" rx="4" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="610" y="645" fill="white" font-size="9" font-weight="600" text-anchor="middle">nginx gateway</text>- <text x="610" y="660" fill="#94a3b8" font-size="7" text-anchor="middle">:8092 pass-through</text>-- <line x1="490" y1="650" x2="538" y2="650" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="3,3" marker-end="url(#arrow-rose)"/>-- <!-- control-api verify -->- <rect x="730" y="620" width="240" height="55" rx="4" fill="rgba(6, 78, 59, 0.15)" stroke="#34d399" stroke-width="1"/>- <text x="850" y="638" fill="#34d399" font-size="8" font-weight="600" text-anchor="middle">control-api middleware</text>- <text x="850" y="652" fill="#94a3b8" font-size="7" text-anchor="middle">verify mcpHostJwt access/control claims</text>- <text x="850" y="663" fill="#94a3b8" font-size="7" text-anchor="middle">check aud=workflow-approvals + recipe-binding</text>- <text x="850" y="674" fill="#94a3b8" font-size="7" text-anchor="middle">check scope=workflow:approval:request</text>-- <line x1="680" y1="648" x2="728" y2="648" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>-- <!-- S4 callout -->- <rect x="730" y="690" width="240" height="22" rx="4" fill="rgba(8, 51, 68, 0.3)" stroke="#22d3ee" stroke-width="1" stroke-dasharray="3,3"/>- <text x="850" y="705" fill="#22d3ee" font-size="7" text-anchor="middle">S4: User identity via session/OAuth only (NO service JWT)</text>-- <!-- Key invariant callout -->- <rect x="100" y="690" width="580" height="22" rx="4" fill="rgba(136, 19, 55, 0.1)" stroke="#fb7185" stroke-width="1" stroke-dasharray="3,3"/>- <text x="390" y="705" fill="#fb7185" font-size="7" text-anchor="middle">INVARIANT: mcp-host pod receives only mcpHostJwt runtime tokens; InternalControl JWT stays in WRC/HCC</text>- </svg>- </div>-- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot rose"></div>- <h3>S4: User Identity Separation</h3>- </div>- <ul>- <li>External decisions use the external-rest-api service gate plus Session JWT</li>- <li>Does not accept mcpHostJwt or InternalControl JWT</li>- <li>control-api validates user eligibility</li>- <li>target_user_id must match session OR team membership</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot amber"></div>- <h3>Runtime Auth Chain</h3>- </div>- <ul>- <li>WRC signs InternalControl JWT with its issuer-specific HS256 secret</li>- <li>control-api issues mcpHostJwt access, refresh, and control tokens</li>- <li>mcp-host pods receive only runtime mcpHostJwt material</li>- <li>control-api keeps issuance and trigger authorization separate</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>S3: Minimal Capabilities</h3>- </div>- <ul>- <li>Access token: scope=workflow:approval:request</li>- <li>Refresh token: scope=workflow:approval:refresh</li>- <li>Middleware rejects any other scope</li>- <li>Recipe-binding: claims vs body params (401 on mismatch)</li>- </ul>- </div>- </div>-- <p class="footer">- Clerum — Flow B: User Decision + JWT Chain • Security Invariants- </p>- </div>-</body>-</html>diff --git a/docs/diagrams/user-approval-flow-request.html b/docs/diagrams/user-approval-flow-request.htmldeleted file mode 100644index 0a8bf3643..000000000--- a/docs/diagrams/user-approval-flow-request.html+++ /dev/null@@ -1,295 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Clerum — Approval Request Flow (Flow A)</title>- <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">- <style>- * { margin: 0; padding: 0; box-sizing: border-box; }- body { font-family: 'JetBrains Mono', monospace; background: #020617; min-height: 100vh; padding: 2rem; color: white; }- .container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }- .header-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }- .pulse-dot { width: 12px; height: 12px; background: #fb7185; border-radius: 50%; animation: pulse 2s infinite; }- @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }- h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }- .subtitle { color: #94a3b8; font-size: 0.875rem; margin-left: 1.75rem; }- .diagram-container { background: rgba(15, 23, 42, 0.5); border-radius: 1rem; border: 1px solid #1e293b; padding: 1.5rem; overflow-x: auto; }- svg { width: 100%; min-width: 900px; display: block; }- .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 2rem; }- .card { background: rgba(15, 23, 42, 0.5); border-radius: 0.75rem; border: 1px solid #1e293b; padding: 1.25rem; }- .card-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }- .card-dot { width: 8px; height: 8px; border-radius: 50%; }- .card-dot.cyan { background: #22d3ee; } .card-dot.emerald { background: #34d399; } .card-dot.violet { background: #a78bfa; } .card-dot.amber { background: #fbbf24; } .card-dot.rose { background: #fb7185; }- .card h3 { font-size: 0.875rem; font-weight: 600; }- .card ul { list-style: none; color: #94a3b8; font-size: 0.75rem; }- .card li { margin-bottom: 0.375rem; }- .footer { text-align: center; margin-top: 1.5rem; color: #475569; font-size: 0.75rem; }- </style>-</head>-<body>- <div class="container">- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>Flow A — Approval Request Lifecycle</h1>- </div>- <p class="subtitle">coordinator Pod requests approval → control-api validates → poll until terminal state</p>- </div>-- <div class="diagram-container">- <svg viewBox="0 0 1100 700">- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#64748b" />- </marker>- <marker id="arrow-rose" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#fb7185" />- </marker>- <marker id="arrow-emerald" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#34d399" />- </marker>- <marker id="arrow-violet" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" fill="#a78bfa" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1e293b" stroke-width="0.5"/>- </pattern>- </defs>-- <rect width="100%" height="100%" fill="url(#grid)" />-- <!-- ===== STEP 1: Coordinator detects requiresApproval ===== -->- <!-- Step number badge -->- <circle cx="50" cy="80" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="50" y="84" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">1</text>-- <!-- coordinator box -->- <rect x="80" y="50" width="220" height="60" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="80" y="50" width="220" height="60" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="190" y="73" fill="white" font-size="11" font-weight="600" text-anchor="middle">coordinator.ts</text>- <text x="190" y="91" fill="#94a3b8" font-size="9" text-anchor="middle">step.requiresApproval detected</text>- <text x="190" y="102" fill="#34d399" font-size="7" text-anchor="middle">→ approvalRequester.gateStep()</text>-- <!-- Step 2 badge -->- <circle cx="50" cy="190" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="50" y="194" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">2</text>-- <!-- approvalRequester -->- <rect x="80" y="160" width="220" height="60" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="80" y="160" width="220" height="60" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="190" y="183" fill="white" font-size="11" font-weight="600" text-anchor="middle">approvalRequester.ts [NEW]</text>- <text x="190" y="201" fill="#94a3b8" font-size="9" text-anchor="middle">POST /workflow-approvals/request</text>- <text x="190" y="212" fill="#fb7185" font-size="7" text-anchor="middle">Idempotency-Key: sha256(recipe:stepId:runId)</text>-- <!-- Arrow 1→2 -->- <line x1="190" y1="110" x2="190" y2="158" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>-- <!-- ===== GATEWAY ===== -->- <rect x="400" y="160" width="180" height="60" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="400" y="160" width="180" height="60" rx="6" fill="rgba(6, 78, 59, 0.3)" stroke="#34d399" stroke-width="1.5"/>- <text x="490" y="183" fill="white" font-size="11" font-weight="600" text-anchor="middle">nginx gateway :8092</text>- <text x="490" y="201" fill="#94a3b8" font-size="9" text-anchor="middle">proxy_pass → :8090</text>- <text x="490" y="212" fill="#94a3b8" font-size="7" text-anchor="middle">Authorization pass-through</text>-- <!-- Arrow 2→gateway -->- <line x1="300" y1="190" x2="398" y2="190" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-rose)"/>- <text x="348" y="183" fill="#fb7185" font-size="7">Bearer access-token</text>-- <!-- Step 3 badge -->- <circle cx="640" cy="80" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="640" y="84" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">3</text>-- <!-- control-api validation -->- <rect x="670" y="50" width="200" height="100" rx="6" fill="#0f172a" stroke-width="0"/>- <rect x="670" y="50" width="200" height="100" rx="6" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="770" y="73" fill="white" font-size="11" font-weight="600" text-anchor="middle">control-api</text>- <text x="770" y="91" fill="#fb7185" font-size="8" text-anchor="middle">1. Verify JWT (aud=workflow-approvals)</text>- <text x="770" y="103" fill="#fb7185" font-size="8" text-anchor="middle">2. Recipe-binding: claims vs body</text>- <text x="770" y="115" fill="#fb7185" font-size="8" text-anchor="middle">3. Allowlist check (user/team)</text>- <text x="770" y="127" fill="#fb7185" font-size="8" text-anchor="middle">4. Zod strict() payload schema</text>- <text x="770" y="142" fill="#34d399" font-size="7" text-anchor="middle">→ persist as status='pending'</text>-- <!-- Arrow gateway→control-api -->- <line x1="580" y1="190" x2="668" y2="120" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>-- <!-- Step 4 badge -->- <circle cx="640" cy="220" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="640" y="224" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">4</text>-- <!-- Postgres -->- <rect x="670" y="200" width="200" height="70" rx="6" fill="rgba(76, 29, 149, 0.4)" stroke="#a78bfa" stroke-width="1.5"/>- <text x="770" y="225" fill="white" font-size="11" font-weight="600" text-anchor="middle">Postgres</text>- <text x="770" y="243" fill="#94a3b8" font-size="8" text-anchor="middle">INSERT workflow_approval_requests</text>- <text x="770" y="255" fill="#94a3b8" font-size="8" text-anchor="middle">INSERT notification_deliveries</text>- <text x="770" y="265" fill="#a78bfa" font-size="7" text-anchor="middle">NOTIFY notification_queued</text>-- <!-- Arrow control-api→Postgres -->- <line x1="770" y1="150" x2="770" y2="198" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrow-violet)"/>-- <!-- Step 5 badge -->- <circle cx="370" cy="330" r="16" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="370" y="334" fill="#fb923c" font-size="12" font-weight="700" text-anchor="middle">5</text>-- <!-- Polling loop -->- <rect x="80" y="300" width="520" height="70" rx="6" fill="rgba(136, 19, 55, 0.15)" stroke="#fb7185" stroke-width="1" stroke-dasharray="4,4"/>- <text x="340" y="323" fill="#fb7185" font-size="10" font-weight="600" text-anchor="middle">Polling Loop (every 5s)</text>- <text x="340" y="341" fill="#94a3b8" font-size="8" text-anchor="middle">GET /api/v1/workflow-approvals/:id/status</text>- <text x="340" y="355" fill="#94a3b8" font-size="8" text-anchor="middle">If access-token expires → POST /workflow-auth/refresh → rotate token</text>- <text x="340" y="365" fill="#94a3b8" font-size="7" text-anchor="middle">Continues until: approved | denied | expired | cancelled</text>-- <!-- Arrow from approvalRequester to polling -->- <line x1="190" y1="220" x2="190" y2="298" stroke="#fb7185" stroke-width="1.5" marker-end="url(#arrow-rose)"/>-- <!-- Arrow polling→gateway -->- <path d="M 490 300 L 490 240 L 490 222" fill="none" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="3,3" marker-end="url(#arrow-rose)"/>- <text x="500" y="260" fill="#94a3b8" font-size="7">poll</text>-- <!-- ===== STATE MACHINE ===== -->- <rect x="80" y="410" width="620" height="140" rx="8" fill="rgba(15, 23, 42, 0.5)" stroke="#1e293b" stroke-width="1"/>- <text x="100" y="432" fill="white" font-size="10" font-weight="600">State Machine: workflow_approval_requests.status</text>-- <!-- pending -->- <rect x="100" y="450" width="90" height="35" rx="4" fill="rgba(251, 191, 36, 0.3)" stroke="#fbbf24" stroke-width="1.5"/>- <text x="145" y="472" fill="#fbbf24" font-size="10" font-weight="600" text-anchor="middle">pending</text>-- <!-- approved -->- <rect x="240" y="450" width="90" height="35" rx="4" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1.5"/>- <text x="285" y="472" fill="#34d399" font-size="10" font-weight="600" text-anchor="middle">approved</text>-- <!-- denied -->- <rect x="380" y="450" width="90" height="35" rx="4" fill="rgba(136, 19, 55, 0.4)" stroke="#fb7185" stroke-width="1.5"/>- <text x="425" y="472" fill="#fb7185" font-size="10" font-weight="600" text-anchor="middle">denied</text>-- <!-- expired -->- <rect x="240" y="510" width="90" height="35" rx="4" fill="rgba(30, 41, 59, 0.5)" stroke="#94a3b8" stroke-width="1"/>- <text x="285" y="532" fill="#94a3b8" font-size="10" font-weight="600" text-anchor="middle">expired</text>-- <!-- cancelled -->- <rect x="380" y="510" width="90" height="35" rx="4" fill="rgba(30, 41, 59, 0.5)" stroke="#94a3b8" stroke-width="1"/>- <text x="425" y="532" fill="#94a3b8" font-size="10" font-weight="600" text-anchor="middle">cancelled</text>-- <!-- consumed (future) -->- <rect x="520" y="450" width="90" height="35" rx="4" fill="rgba(30, 41, 59, 0.3)" stroke="#94a3b8" stroke-width="1" stroke-dasharray="3,3"/>- <text x="565" y="472" fill="#94a3b8" font-size="10" font-weight="600" text-anchor="middle">consumed</text>- <text x="565" y="498" fill="#64748b" font-size="7" text-anchor="middle">(hook for workflow-triggers)</text>-- <!-- Arrows between states -->- <line x1="190" y1="467" x2="238" y2="467" stroke="#34d399" stroke-width="1.2" marker-end="url(#arrow-emerald)"/>- <text x="214" y="462" fill="#34d399" font-size="7">user decide</text>-- <line x1="190" y1="472" x2="378" y2="472" stroke="#fb7185" stroke-width="1.2" marker-end="url(#arrow-rose)"/>- <text x="280" y="487" fill="#fb7185" font-size="7">user deny</text>-- <line x1="145" y1="485" x2="260" y2="508" stroke="#94a3b8" stroke-width="1" marker-end="url(#arrowhead)"/>- <text x="170" y="504" fill="#94a3b8" font-size="7">cron 60s</text>-- <line x1="145" y1="480" x2="238" y2="525" stroke="#94a3b8" stroke-width="1" stroke-dasharray="3,3" marker-end="url(#arrowhead)"/>- <text x="155" y="525" fill="#94a3b8" font-size="7">recipe cancel</text>-- <line x1="330" y1="467" x2="518" y2="467" stroke="#94a3b8" stroke-width="1" stroke-dasharray="3,3" marker-end="url(#arrowhead)"/>- <text x="420" y="462" fill="#64748b" font-size="7">trigger consume (futuro)</text>-- <!-- ===== TOKEN ROTATION ===== -->- <rect x="730" y="330" width="320" height="200" rx="8" fill="rgba(136, 19, 55, 0.1)" stroke="#fb7185" stroke-width="1"/>- <text x="750" y="352" fill="#fb7185" font-size="10" font-weight="600">Token Rotation</text>-- <!-- Access Token -->- <rect x="750" y="365" width="140" height="45" rx="4" fill="rgba(136, 19, 55, 0.2)" stroke="#fb7185" stroke-width="1"/>- <text x="820" y="385" fill="#fb7185" font-size="9" font-weight="600" text-anchor="middle">Access Token</text>- <text x="820" y="400" fill="#94a3b8" font-size="7" text-anchor="middle">TTL: 10min | scope: request</text>-- <!-- Refresh Token -->- <rect x="750" y="430" width="140" height="45" rx="4" fill="rgba(136, 19, 55, 0.15)" stroke="#fb7185" stroke-width="1"/>- <text x="820" y="450" fill="#fb7185" font-size="9" font-weight="600" text-anchor="middle">Refresh Token</text>- <text x="820" y="465" fill="#94a3b8" font-size="7" text-anchor="middle">TTL: 1h | scope: refresh</text>-- <!-- Rotation arrow -->- <path d="M 890 390 L 920 390 L 920 455 L 890 455" fill="none" stroke="#fb7185" stroke-width="1" stroke-dasharray="3,3" marker-end="url(#arrow-rose)"/>- <text x="930" y="420" fill="#94a3b8" font-size="7">rotate</text>- <text x="930" y="430" fill="#94a3b8" font-size="7">one-time</text>-- <!-- JWT claims box -->- <rect x="750" y="490" width="280" height="30" rx="4" fill="rgba(15, 23, 42, 0.5)" stroke="#1e293b" stroke-width="1"/>- <text x="890" y="509" fill="#94a3b8" font-size="7" text-anchor="middle">iss=control-api aud=workflow-approvals sub=mcp-host</text>-- <!-- ===== Legend ===== -->- <text x="80" y="580" fill="white" font-size="10" font-weight="600">Flow Labels</text>-- <line x1="80" y1="595" x2="100" y2="595" stroke="#34d399" stroke-width="1.5" marker-end="url(#arrow-emerald)"/>- <text x="108" y="598" fill="#94a3b8" font-size="8">Internal call (existing)</text>-- <line x1="80" y1="615" x2="100" y2="615" stroke="#fb7185" stroke-width="1.5" stroke-dasharray="5,5" marker-end="url(#arrow-rose)"/>- <text x="108" y="618" fill="#94a3b8" font-size="8">Approval-specific flow (NEW)</text>-- <line x1="80" y1="635" x2="100" y2="635" stroke="#a78bfa" stroke-width="1.5" marker-end="url(#arrow-violet)"/>- <text x="108" y="638" fill="#94a3b8" font-size="8">Database persistence</text>-- <circle cx="310" cy="590" r="10" fill="rgba(251, 146, 60, 0.3)" stroke="#fb923c" stroke-width="1.5"/>- <text x="310" y="594" fill="#fb923c" font-size="9" font-weight="700" text-anchor="middle">N</text>- <text x="330" y="594" fill="#94a3b8" font-size="8">Step number (execution order)</text>-- <rect x="280" y="608" width="16" height="10" rx="2" fill="rgba(251, 191, 36, 0.3)" stroke="#fbbf24" stroke-width="1"/>- <text x="304" y="617" fill="#94a3b8" font-size="8">Pending state</text>-- <rect x="280" y="628" width="16" height="10" rx="2" fill="rgba(6, 78, 59, 0.4)" stroke="#34d399" stroke-width="1"/>- <text x="304" y="637" fill="#94a3b8" font-size="8">Terminal success</text>-- <rect x="280" y="648" width="16" height="10" rx="2" fill="rgba(136, 19, 55, 0.4)" stroke="#fb7185" stroke-width="1"/>- <text x="304" y="657" fill="#94a3b8" font-size="8">Terminal failure</text>-- <rect x="280" y="668" width="16" height="10" rx="2" fill="rgba(30, 41, 59, 0.3)" stroke="#94a3b8" stroke-width="1" stroke-dasharray="3,3"/>- <text x="304" y="677" fill="#94a3b8" font-size="8">Future / out-of-scope</text>- </svg>- </div>-- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot rose"></div>- <h3>Step Gating</h3>- </div>- <ul>- <li>coordinator.ts detects requiresApproval in the ConfigMap</li>- <li>Pauses before dispatch to mcp-host</li>- <li>approvalRequester.gateStep() blocks until terminal</li>- <li>denied/expired → marks step failed + reports to WRC</li>- <li>approved → resumes and executes the step normally</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot amber"></div>- <h3>Idempotency</h3>- </div>- <ul>- <li>Idempotency-Key: sha256(recipe:stepId:runId)</li>- <li>Unique index on (recipeNs, recipeName, idempotency_key)</li>- <li>409 when key already exists → returns existing approvalRequestId</li>- <li>Protects against coordinator Pod restarts</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot violet"></div>- <h3>Expiry Cron</h3>- </div>- <ul>- <li>setInterval(60_000) inside control-api</li>- <li>UPDATE status='expired' WHERE pending AND expires_at < now()</li>- <li>Idempotent: reruns do not change terminal rows</li>- <li>Max delay: 60s between expiration and detection</li>- </ul>- </div>- </div>-- <p class="footer">- Clerum — Flow A: Approval Request- </p>- </div>-</body>-</html>