Commit 24c258d
launcher broker: add CAPTURE_JSON: protocol; pipe + verbs use it
Foundation for the agent envelope's clean stdout/stderr split. The
prior CAPTURE: protocol concatenated subprocess stdout + stderr as
one byte stream over the socket, so the pipe couldn't tell which
part was the structured tool output and which part was English
narrative from a downstream tool (mios-find, mios-launch, mios-
windows, ...) writing diagnostics to stderr. The OpenAI tool_result
envelope wants stdout in tool_result.output and stderr in
tool_result.stderr -- separately -- so any English narrative
buckets into a clearly-labeled field instead of polluting the
operator-facing output.
usr/libexec/mios/mios-launcher-daemon
* New CAPTURE_JSON: <cmd> command. Runs the same subprocess.run
as CAPTURE:, returns a single JSON line:
{"stdout":"...", "stderr":"...", "exit_code":N}
Legacy CAPTURE: stays available for pre-update callers.
usr/share/mios/owui/pipes/mios_agent_pipe.py
* _dispatch_mios_verb's broker call now uses CAPTURE_JSON:
instead of CAPTURE:, parses the JSON response, and populates
the envelope with:
tool_result.output <- broker stdout
tool_result.stderr <- broker stderr
tool_result.success <- (exit_code == 0)
tool_result.exit_code <- raw exit code
* open_app dispatch loses its `2>/dev/null` hack -- stderr now
lands in its own field, so suppressing it at the bash level
is no longer needed and we keep the diagnostic info.
usr/share/mios/owui/tools/mios_verbs.py
* _broker_send (used by every Tools class method when Hermes
invokes a verb via OpenAI tool_calls) also switched to
CAPTURE_JSON:. Fallback path retained: if the broker reply
isn't valid JSON (older deployment), treat the whole thing
as stdout to preserve the prior CAPTURE: text contract.
Live-verified on podman-MiOS-DEV: CAPTURE_JSON: mios-find notepad
returns stdout = the canonical launch command, stderr = a tmpfs
permission warning (cleanly bucketed into its own field), exit
0. Tool row in webui.db: 31528 -> 32443 chars after re-install.
Operator directive 2026-05-18: "MAKE SURE NO HARDCODED VALUES!"
The pipe layer's envelope is now structured-shape-only -- the
universal status symbols (✓/⚠), the OpenAI protocol identifiers,
and the JSON keys. Any English in the envelope necessarily comes
from a downstream tool's stderr (clearly labeled) -- no English
narrative invented by the pipe.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 83dcfb4 commit 24c258d
3 files changed
Lines changed: 102 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
94 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
95 | 131 | | |
96 | 132 | | |
97 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1179 | 1179 | | |
1180 | 1180 | | |
1181 | 1181 | | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1187 | 1188 | | |
1188 | 1189 | | |
1189 | 1190 | | |
| |||
1322 | 1323 | | |
1323 | 1324 | | |
1324 | 1325 | | |
1325 | | - | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1326 | 1333 | | |
1327 | 1334 | | |
1328 | 1335 | | |
| |||
1334 | 1341 | | |
1335 | 1342 | | |
1336 | 1343 | | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1341 | 1350 | | |
1342 | | - | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1343 | 1361 | | |
1344 | | - | |
| 1362 | + | |
| 1363 | + | |
1345 | 1364 | | |
1346 | 1365 | | |
1347 | 1366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
| |||
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
112 | | - | |
| 120 | + | |
113 | 121 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
121 | 143 | | |
122 | | - | |
| 144 | + | |
123 | 145 | | |
124 | 146 | | |
125 | 147 | | |
126 | | - | |
| 148 | + | |
127 | 149 | | |
128 | 150 | | |
129 | 151 | | |
| |||
0 commit comments