Add CLIAdapterModule with pretty JSONL formatting

New src/cli/format-event.ts handles formatting OpenCode JSONL events:
- step_start: skip in normal mode, show in debug
- text: display as-is
- tool_use: show errors, skip in normal mode
- step_finish: show message + tokens/cost in debug
- error: display error message

Exports cliAdapter.formatStdoutEvent for Paperclip UI to call.
Also fixes ui-parser.ts to re-export from format-event.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 09:52:01 -04:00
parent 1b3d4b6dfe
commit d54ffa3e27
4 changed files with 219 additions and 28 deletions
+13
View File
@@ -3,6 +3,19 @@ export const label = "OpenCode (Kubernetes)";
export const models: undefined = undefined;
import type { CLIAdapterModule } from "@paperclipai/adapter-utils";
import { formatEvent } from "./cli/format-event.js";
export const cliAdapter: CLIAdapterModule = {
type,
formatStdoutEvent: (line: string, debug: boolean) => {
const formatted = formatEvent(line, debug);
if (formatted) {
console.log(formatted);
}
},
};
export const agentConfigurationDoc = `# opencode_k8s agent configuration
Adapter: opencode_k8s