Skip to main content

tracevault_cli/hooks/
opencode.rs

1use std::path::Path;
2use tracevault_protocol::streaming::StreamEventRequest;
3
4use super::HookAdapter;
5
6/// Detection-only stub for the (currently dormant) `HookAdapter` trait.
7///
8/// OpenCode capture does NOT go through this trait — the live path stamps
9/// the agent via the bundled plugin + `commands::stream::stamp_agent`. This
10/// type exists so `DetectedTool::OpenCode::adapter()` reports the correct
11/// `tool_name` ("opencode"), mirroring the `CodexAdapter`/`GsdAdapter`
12/// stubs. The parse methods are intentionally unimplemented here.
13pub struct OpenCodeAdapter;
14
15impl HookAdapter for OpenCodeAdapter {
16    fn tool_name(&self) -> &str {
17        "opencode"
18    }
19
20    fn parse_event(&self, _raw: &str) -> Result<StreamEventRequest, String> {
21        Err("OpenCode capture uses the bundled plugin + stamp_agent".to_string())
22    }
23
24    fn parse_transcript(&self, _path: &Path) -> Result<Vec<serde_json::Value>, String> {
25        Err("OpenCode capture uses the bundled plugin + stamp_agent".to_string())
26    }
27}