Commit 8339885
mios-agent-pipe + OWUI shim: SSE phase markers (step 3 of 5)
Two coordinated changes:
usr/lib/mios/agent-pipe/server.py
Adds a `mios_status` field on otherwise-empty SSE chunks. The field
carries pipe-phase markers (π‘ prompt -> π§ route -> π οΈ {tool} or
π§ β hermes -> β
done) that any translator gateway can lift into
its native status surface (OWUI status pill, Hermes Discord
reaction, future Slack icon, ...). Stock OpenAI streaming clients
see an unknown field on a content-empty chunk and ignore it
cleanly -- graceful degradation.
Three chain paths emit markers:
DISPATCH fast-path -> π‘ prompt -> π§ route -> π οΈ {tool} ->
<content delta with tool_calls envelope>
-> β
done
CHAT fast-path -> π‘ prompt -> π§ route ->
<content delta with reply text> ->
β
done
AGENT / fallback -> π‘ prompt -> π§ route -> π§ β hermes ->
<backend stream passes through verbatim>
The non-streaming response path returns JSON exactly as before
(no markers; OpenAI non-streaming has no per-chunk extension point).
usr/share/mios/owui/pipes/mios_agent_pipe.py
Surgical slim: deletes the now-redundant router/dispatch code path
(agent-pipe owns it) and adds the `mios_status` translator.
Specifically:
* BACKEND_URL default flips from :8642/v1 (hermes direct) to
:8640/v1 (agent-pipe). Every chat request the OWUI pipe makes
now goes through the agent-pipe service, which runs router /
dispatch / SurrealDB writes and forwards leftover work to
hermes itself.
* The if-verdict-elif-chat-elif-agent dispatch branch (~60
lines) is removed -- agent-pipe handles those three branches
now. The OWUI pipe just gets back either a tool_calls envelope
content delta, a chat reply, or a streaming hermes response,
and yields each to OWUI without re-routing.
* SSE loop gains an early-branch on chunk["mios_status"]:
lifts {emoji, label, done} into a self._emit() call so OWUI's
status pill mirrors the standalone service's phase markers.
Anything else (delta.content, finish_reason) handled exactly
as before.
* Retained intact: task-gen bypass, tail_watcher (Hermes-
internal tool emits sideband), CPU refine / polish / critic,
narration collapse, output cleanup, Qwen XML stripping. Those
are OWUI-specific quality features; can be ported to
agent-pipe in Step 2b if Discord wants them too.
Live-verified on podman-MiOS-DEV:
Chat-path stream from agent-pipe shows the full marker sequence
(π‘ prompt -> π§ route -> content -> β
chat) in the SSE body
alongside the normal delta chunks. OWUI shim re-installed in
webui.db; the chat status pill now reflects which agent-pipe
phase the request is in instead of saying "thinking..." opaquely.
Step 4 (next commit) re-points the Hermes Discord gateway's backend
URL at :8640 so Discord chats ride the same chain. The
hermes-discord-reactions-patch.py shipped in Step 1 will then
animate the per-phase reactions from the `mios_status` markers
the agent-pipe emits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a65b4cf commit 8339885
2 files changed
Lines changed: 97 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
509 | 516 | | |
510 | 517 | | |
511 | 518 | | |
| |||
522 | 529 | | |
523 | 530 | | |
524 | 531 | | |
| 532 | + | |
| 533 | + | |
525 | 534 | | |
526 | 535 | | |
527 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
528 | 550 | | |
529 | 551 | | |
530 | 552 | | |
| |||
711 | 733 | | |
712 | 734 | | |
713 | 735 | | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
714 | 746 | | |
715 | 747 | | |
716 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
717 | 752 | | |
718 | 753 | | |
719 | 754 | | |
| |||
738 | 773 | | |
739 | 774 | | |
740 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
741 | 780 | | |
742 | 781 | | |
743 | 782 | | |
| 783 | + | |
| 784 | + | |
744 | 785 | | |
745 | 786 | | |
746 | 787 | | |
| |||
766 | 807 | | |
767 | 808 | | |
768 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
769 | 822 | | |
770 | 823 | | |
771 | 824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
199 | | - | |
| 198 | + | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
2064 | 2064 | | |
2065 | 2065 | | |
2066 | 2066 | | |
2067 | | - | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
2072 | | - | |
2073 | | - | |
2074 | | - | |
2075 | | - | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | | - | |
2085 | | - | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
2106 | | - | |
2107 | | - | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
2122 | | - | |
2123 | | - | |
2124 | | - | |
2125 | | - | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
2129 | | - | |
2130 | | - | |
2131 | | - | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2132 | 2089 | | |
2133 | 2090 | | |
2134 | 2091 | | |
| |||
2229 | 2186 | | |
2230 | 2187 | | |
2231 | 2188 | | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
2232 | 2208 | | |
2233 | 2209 | | |
2234 | 2210 | | |
| |||
0 commit comments