No description
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-05 09:40:53 +01:00
index.js initial commit 2026-11-05 09:40:53 +01:00
index.test.js initial commit 2026-11-05 09:40:53 +01:00
normalize.js initial commit 2026-11-05 09:40:53 +01:00
normalize.test.js initial commit 2026-11-05 09:40:53 +01:00
package.json initial commit 2026-11-05 09:40:53 +01:00
README.md initial commit 2026-11-05 09:40:53 +01:00

OpenCode Responses output normalizer

This local OpenCode 2.2.5 plugin merges multiple text content parts from a completed tool result into one text part before the result is returned to the model. For the configured chat-brodda-it provider only, non-text result parts are replaced by an explicit notice because that LibreChat Agents Responses endpoint currently rejects content arrays. The model is told that it cannot inspect the omitted attachment; image/file understanding is therefore not preserved by this workaround. Other providers continue to receive non-text parts unchanged. Other plugins and their files are not modified.

The final http.request hook additionally converts Responses function_call_output.output arrays into strings for chat-brodda-it only. This catches text parts appended by output truncation after execute.after, and results replayed from existing chats. Call IDs and user attachments are preserved; stored chat history is not changed. Other providers are untouched by this HTTP fallback. This covers HTTP transport, not WebSocket frames.

OpenCode watches local plugin files and reloads them after changes. Use /reload if necessary; a service restart is not required.

The plugin is registered in the user OpenCode configuration alongside the existing Usage plugin. To disable this workaround, remove only the C:\dev\projects\opencode-workspace\responses-output-plugin entry from the plugins array in C:\Users\BroddaJa\.config\opencode\opencode.json and use /reload if the change has not already been picked up automatically.

Run npm test in this directory for isolated tests. The live test used a harmless PowerShell command producing separate stdout and stderr text parts; the plugin collapsed those parts and the Responses call completed successfully.

Regression verification (2026-11-04): all 12 tests passed. A transient session.generate request against the previously failing session returned NORMALIZER_OK, with tools disabled by that API. The problematic historical webfetch result had two text parts (51,151 and 136 characters), the latter being the output-truncation notice.