From fb5525fc2234a246dfdfc9e0d7ed73c824cbd8a6 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 11 Sep 2026 16:36:18 -0400 Subject: fix: opencode v2 lifecycle reporting (#3757) * fix: support opencode v2 lifecycle reporting * fix: repair Japanese docs * fix: ignore payload-less OpenCode events * fix: harden opencode v2 integration install and reporting Follow-ups on top of the V2 lifecycle support: - create `cli.json` when OpenCode has no V1 TUI preferences (`tui.json` or `kv.json`) to migrate, instead of only registering into an existing file - settle stalled socket attempts with a plain connect timer, and resend the latest lifecycle state after a failed delivery so the pane cannot get stuck - resolve the OpenCode state directory from `XDG_STATE_HOME` - remove the managed `herdr-opencode` directory on uninstall - document failed executions reporting `blocked`, keep the integration test environment independent of an inherited `XDG_STATE_HOME`, and simplify `reconcileBlockers` to reassign its map --------- Co-authored-by: Jonathan Liebig --- src/integration/targets.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/integration/targets.rs') diff --git a/src/integration/targets.rs b/src/integration/targets.rs index 0690fc90..d204c552 100644 --- a/src/integration/targets.rs +++ b/src/integration/targets.rs @@ -22,13 +22,14 @@ use super::config_edit::{ use super::env::{ antigravity_cli_dir, claude_dir, codex_dir, copilot_dir, cursor_dir, devin_dir, droid_dir, grok_dir, hermes_dir, hermes_plugin_dir, kilo_dir, kimi_dir, mastracode_dir, omp_extension_dir, - opencode_dir, pi_extension_dir, qodercli_dir, qwen_dir, + opencode_dir, opencode_state_dir, pi_extension_dir, qodercli_dir, qwen_dir, }; use super::file_ops::{ make_executable, remove_dir_all_if_exists, remove_file_if_exists, remove_legacy_bash_hook_file, }; use super::opencode_config::{ - add_tui_plugin, remove_tui_plugin, tui_config_path, validate_tui_plugin_config, + add_cli_plugin, add_tui_plugin, remove_cli_plugin, remove_tui_plugin, tui_config_path, + validate_tui_plugin_config, }; use super::types::{ AntigravityCliInstallPaths, AntigravityCliUninstallResult, ClaudeInstallPaths, @@ -468,11 +469,20 @@ pub(crate) fn install_opencode() -> io::Result { let tui_plugin_path = dir.join(OPENCODE_TUI_PLUGIN_INSTALL_NAME); fs::write(&tui_plugin_path, OPENCODE_TUI_PLUGIN_ASSET)?; let tui_config_path = add_tui_plugin(&dir, OPENCODE_TUI_PLUGIN_SPEC)?; + let v2_dir = dir.join(super::OPENCODE_V2_TUI_PLUGIN_DIR); + fs::create_dir_all(&v2_dir)?; + fs::write(v2_dir.join("tui.js"), super::OPENCODE_V2_TUI_PLUGIN_ASSET)?; + let cli_config_path = add_cli_plugin( + &dir, + &opencode_state_dir()?, + super::OPENCODE_V2_TUI_PLUGIN_SPEC, + )?; Ok(OpenCodeInstallPaths { plugin_path, tui_plugin_path, tui_config_path, + cli_config_path, }) } @@ -821,6 +831,15 @@ pub(crate) fn uninstall_opencode() -> io::Result { let plugin_path = dir.join("plugins").join(OPENCODE_PLUGIN_INSTALL_NAME); let tui_plugin_path = dir.join(OPENCODE_TUI_PLUGIN_INSTALL_NAME); let mut errors = Vec::new(); + remove_cli_plugin(&dir, super::OPENCODE_V2_TUI_PLUGIN_SPEC).unwrap_or_else(|err| { + errors.push(err.to_string()); + false + }); + let v2_dir = dir.join(super::OPENCODE_V2_TUI_PLUGIN_DIR); + remove_dir_all_if_exists(&v2_dir).unwrap_or_else(|err| { + errors.push(format!("failed to remove {}: {err}", v2_dir.display())); + false + }); let updated_tui_config = remove_tui_plugin(&dir, OPENCODE_TUI_PLUGIN_SPEC).unwrap_or_else(|err| { errors.push(err.to_string()); -- cgit v1.2.3