From ea410469bc7a3fb51600dc4f7211e326568c5eb0 Mon Sep 17 00:00:00 2001 From: Pavel Soukup Date: Sat, 3 Jan 2026 12:22:31 +0100 Subject: [PATCH 1/2] Refactor orchestrator with modular service architecture Introduces a modular service structure in the orchestrator crate, moving phase logic (planning, implementation, review, fix) and related responsibilities into dedicated files under src/services/. Updates documentation to reflect the new architecture, increases orchestrator and server test counts, and applies minor formatting and clippy improvements across multiple crates. No functional changes to business logic; this is a structural and organizational refactor to improve maintainability and clarity. --- agents.md | 6 +- crates/AGENTS.md | 34 +- crates/cli/src/main.rs | 31 +- .../repositories/review_comment_repository.rs | 1 + .../session_activity_repository.rs | 24 +- crates/github/src/client.rs | 70 +- crates/mcp-findings/src/lib.rs | 58 +- .../opencode-client/src/apis/configuration.rs | 5 +- .../opencode-client/src/apis/default_api.rs | 1393 ++++++-- crates/opencode-client/src/apis/mod.rs | 18 +- .../opencode-client/src/apis/session_api.rs | 48 +- crates/opencode-client/src/lib.rs | 4 +- crates/opencode-client/src/models/agent.rs | 13 +- .../src/models/agent_config.rs | 5 +- .../src/models/agent_config_permission.rs | 11 +- .../models/agent_config_permission_bash.rs | 9 +- .../opencode-client/src/models/agent_part.rs | 13 +- .../src/models/agent_part_input.rs | 5 +- .../src/models/agent_part_source.rs | 9 +- .../src/models/agent_permission.rs | 15 +- crates/opencode-client/src/models/api_auth.rs | 10 +- .../opencode-client/src/models/api_error.rs | 5 +- .../src/models/api_error_data.rs | 3 +- .../src/models/app_log_request.rs | 3 +- .../src/models/assistant_message.rs | 20 +- .../src/models/assistant_message_error.rs | 5 +- .../src/models/assistant_message_path.rs | 8 +- .../src/models/assistant_message_time.rs | 3 +- .../src/models/assistant_message_tokens.rs | 10 +- .../models/assistant_message_tokens_cache.rs | 8 +- crates/opencode-client/src/models/auth.rs | 14 +- .../src/models/bad_request_error.rs | 11 +- crates/opencode-client/src/models/command.rs | 3 +- .../src/models/command_template.rs | 9 +- .../src/models/compaction_part.rs | 13 +- crates/opencode-client/src/models/config.rs | 3 +- .../src/models/config_agent.rs | 3 +- .../src/models/config_autoupdate.rs | 9 +- .../src/models/config_command_value.rs | 3 +- .../src/models/config_compaction.rs | 3 +- .../src/models/config_enterprise.rs | 7 +- .../src/models/config_experimental.rs | 13 +- .../src/models/config_experimental_hook.rs | 7 +- ...perimental_hook_file_edited_value_inner.rs | 3 +- .../src/models/config_formatter.rs | 9 +- .../models/config_formatter_any_of_value.rs | 3 +- .../opencode-client/src/models/config_lsp.rs | 9 +- .../src/models/config_lsp_any_of_value.rs | 3 +- .../models/config_lsp_any_of_value_any_of.rs | 9 +- .../config_lsp_any_of_value_any_of_1.rs | 3 +- .../opencode-client/src/models/config_mode.rs | 3 +- .../models/config_providers_200_response.rs | 13 +- .../opencode-client/src/models/config_tui.rs | 8 +- .../models/config_tui_scroll_acceleration.rs | 7 +- .../src/models/config_watcher.rs | 7 +- crates/opencode-client/src/models/event.rs | 10 +- .../src/models/event_command_executed.rs | 10 +- .../event_command_executed_properties.rs | 10 +- .../src/models/event_file_edited.rs | 5 +- .../models/event_file_edited_properties.rs | 7 +- .../src/models/event_file_watcher_updated.rs | 10 +- .../event_file_watcher_updated_properties.rs | 10 +- .../src/models/event_global_disposed.rs | 10 +- .../event_installation_update_available.rs | 10 +- .../src/models/event_installation_updated.rs | 10 +- .../event_installation_updated_properties.rs | 7 +- .../models/event_lsp_client_diagnostics.rs | 10 +- ...event_lsp_client_diagnostics_properties.rs | 8 +- .../src/models/event_lsp_updated.rs | 10 +- .../src/models/event_mcp_tools_changed.rs | 10 +- .../event_mcp_tools_changed_properties.rs | 7 +- .../src/models/event_message_part_removed.rs | 10 +- .../event_message_part_removed_properties.rs | 9 +- .../src/models/event_message_part_updated.rs | 10 +- .../event_message_part_updated_properties.rs | 3 +- .../src/models/event_message_removed.rs | 10 +- .../event_message_removed_properties.rs | 3 +- .../src/models/event_message_updated.rs | 10 +- .../event_message_updated_properties.rs | 3 +- .../src/models/event_permission_replied.rs | 10 +- .../event_permission_replied_properties.rs | 9 +- .../src/models/event_permission_updated.rs | 5 +- .../src/models/event_project_updated.rs | 5 +- .../src/models/event_pty_created.rs | 5 +- .../models/event_pty_created_properties.rs | 3 +- .../src/models/event_pty_deleted.rs | 5 +- .../models/event_pty_deleted_properties.rs | 7 +- .../src/models/event_pty_exited.rs | 5 +- .../src/models/event_pty_exited_properties.rs | 8 +- .../src/models/event_pty_updated.rs | 5 +- .../src/models/event_server_connected.rs | 10 +- .../models/event_server_instance_disposed.rs | 10 +- ...ent_server_instance_disposed_properties.rs | 7 +- .../src/models/event_session_compacted.rs | 10 +- .../src/models/event_session_created.rs | 10 +- .../event_session_created_properties.rs | 3 +- .../src/models/event_session_deleted.rs | 10 +- .../src/models/event_session_diff.rs | 5 +- .../models/event_session_diff_properties.rs | 8 +- .../src/models/event_session_error.rs | 5 +- .../models/event_session_error_properties.rs | 3 +- .../src/models/event_session_idle.rs | 5 +- .../models/event_session_idle_properties.rs | 7 +- .../src/models/event_session_status.rs | 10 +- .../models/event_session_status_properties.rs | 3 +- .../src/models/event_session_updated.rs | 10 +- .../src/models/event_todo_updated.rs | 5 +- .../models/event_todo_updated_properties.rs | 8 +- .../src/models/event_tui_command_execute.rs | 10 +- .../event_tui_command_execute_properties.rs | 7 +- ..._tui_command_execute_properties_command.rs | 9 +- .../src/models/event_tui_prompt_append.rs | 10 +- .../src/models/event_tui_toast_show.rs | 5 +- .../src/models/event_vcs_branch_updated.rs | 10 +- .../event_vcs_branch_updated_properties.rs | 7 +- crates/opencode-client/src/models/file.rs | 5 +- .../src/models/file_content.rs | 7 +- .../src/models/file_content_patch.rs | 9 +- .../models/file_content_patch_hunks_inner.rs | 11 +- .../opencode-client/src/models/file_diff.rs | 11 +- .../opencode-client/src/models/file_node.rs | 13 +- .../opencode-client/src/models/file_part.rs | 14 +- .../src/models/file_part_input.rs | 5 +- .../src/models/file_part_source.rs | 14 +- .../src/models/file_part_source_text.rs | 9 +- .../opencode-client/src/models/file_source.rs | 5 +- .../models/find_text_200_response_inner.rs | 11 +- .../find_text_200_response_inner_path.rs | 7 +- ...ext_200_response_inner_submatches_inner.rs | 9 +- .../src/models/formatter_status.rs | 3 +- .../src/models/global_event.rs | 3 +- .../src/models/global_health_200_response.rs | 10 +- .../src/models/keybinds_config.rs | 128 +- .../src/models/layout_config.rs | 4 +- .../opencode-client/src/models/log_level.rs | 4 +- .../opencode-client/src/models/lsp_status.rs | 5 +- .../src/models/mcp_add_request.rs | 3 +- .../src/models/mcp_add_request_config.rs | 3 +- .../src/models/mcp_auth_callback_request.rs | 7 +- .../models/mcp_auth_remove_200_response.rs | 9 +- .../src/models/mcp_auth_start_200_response.rs | 7 +- .../src/models/mcp_local_config.rs | 3 +- .../src/models/mcp_o_auth_config.rs | 3 +- .../src/models/mcp_remote_config.rs | 3 +- .../src/models/mcp_remote_config_oauth.rs | 3 +- .../opencode-client/src/models/mcp_status.rs | 3 +- .../src/models/mcp_status_connected.rs | 9 +- .../src/models/mcp_status_disabled.rs | 9 +- .../src/models/mcp_status_failed.rs | 10 +- .../src/models/mcp_status_needs_auth.rs | 9 +- .../mcp_status_needs_client_registration.rs | 10 +- crates/opencode-client/src/models/message.rs | 10 +- .../src/models/message_aborted_error.rs | 5 +- .../src/models/message_output_length_error.rs | 10 +- crates/opencode-client/src/models/model.rs | 23 +- .../opencode-client/src/models/model_api.rs | 9 +- .../src/models/model_capabilities.rs | 13 +- .../src/models/model_capabilities_input.rs | 11 +- .../models/model_capabilities_interleaved.rs | 9 +- .../model_capabilities_interleaved_any_of.rs | 9 +- .../opencode-client/src/models/model_cost.rs | 8 +- .../model_cost_experimental_over200_k.rs | 9 +- .../src/models/not_found_error.rs | 5 +- crates/opencode-client/src/models/o_auth.rs | 5 +- crates/opencode-client/src/models/part.rs | 6 +- .../opencode-client/src/models/part_any_of.rs | 15 +- .../opencode-client/src/models/patch_part.rs | 14 +- crates/opencode-client/src/models/path.rs | 11 +- .../opencode-client/src/models/permission.rs | 13 +- .../src/models/permission_pattern.rs | 9 +- .../src/models/permission_respond_request.rs | 9 +- crates/opencode-client/src/models/project.rs | 5 +- .../src/models/project_time.rs | 9 +- .../src/models/project_update_request.rs | 3 +- .../src/models/project_update_request_icon.rs | 3 +- crates/opencode-client/src/models/provider.rs | 14 +- .../src/models/provider_auth_authorization.rs | 5 +- .../src/models/provider_auth_error.rs | 5 +- .../src/models/provider_auth_error_data.rs | 3 +- .../src/models/provider_auth_method.rs | 10 +- .../src/models/provider_config.rs | 3 +- .../models/provider_config_models_value.rs | 8 +- ...rovider_config_models_value_interleaved.rs | 9 +- ..._config_models_value_interleaved_any_of.rs | 9 +- ...ider_config_models_value_variants_value.rs | 7 +- .../src/models/provider_config_options.rs | 3 +- .../models/provider_config_options_timeout.rs | 9 +- .../src/models/provider_list_200_response.rs | 9 +- .../provider_list_200_response_all_inner.rs | 16 +- ...ist_200_response_all_inner_models_value.rs | 21 +- ...00_response_all_inner_models_value_cost.rs | 6 +- ...ner_models_value_cost_context_over_200k.rs | 8 +- ...onse_all_inner_models_value_interleaved.rs | 9 +- ...l_inner_models_value_interleaved_any_of.rs | 9 +- ...0_response_all_inner_models_value_limit.rs | 8 +- ...ponse_all_inner_models_value_modalities.rs | 17 +- ...esponse_all_inner_models_value_provider.rs | 7 +- .../provider_oauth_authorize_request.rs | 7 +- .../models/provider_oauth_callback_request.rs | 8 +- crates/opencode-client/src/models/pty.rs | 15 +- .../src/models/pty_create_request.rs | 3 +- .../src/models/pty_update_request.rs | 3 +- .../src/models/pty_update_request_size.rs | 8 +- crates/opencode-client/src/models/range.rs | 3 +- .../opencode-client/src/models/range_start.rs | 8 +- .../src/models/reasoning_part.rs | 14 +- .../opencode-client/src/models/retry_part.rs | 15 +- .../src/models/server_config.rs | 3 +- crates/opencode-client/src/models/session.rs | 12 +- .../src/models/session_command_request.rs | 3 +- .../src/models/session_create_request.rs | 3 +- .../src/models/session_fork_request.rs | 7 +- .../src/models/session_init_request.rs | 3 +- .../session_messages_200_response_inner.rs | 3 +- .../src/models/session_prompt_200_response.rs | 8 +- .../src/models/session_prompt_request.rs | 3 +- .../models/session_prompt_request_model.rs | 3 +- .../session_prompt_request_parts_inner.rs | 16 +- .../src/models/session_revert.rs | 3 +- .../src/models/session_revert_request.rs | 3 +- .../src/models/session_share.rs | 7 +- .../src/models/session_shell_request.rs | 3 +- .../src/models/session_status.rs | 5 +- .../src/models/session_status_any_of.rs | 9 +- .../src/models/session_status_any_of_1.rs | 5 +- .../src/models/session_status_any_of_2.rs | 9 +- .../src/models/session_summarize_request.rs | 3 +- .../src/models/session_summary.rs | 3 +- .../src/models/session_time.rs | 9 +- .../src/models/session_update_request.rs | 3 +- .../src/models/session_update_request_time.rs | 7 +- .../src/models/snapshot_part.rs | 13 +- .../src/models/step_finish_part.rs | 15 +- .../src/models/step_start_part.rs | 5 +- .../src/models/subtask_part_input.rs | 12 +- crates/opencode-client/src/models/symbol.rs | 3 +- .../src/models/symbol_location.rs | 3 +- .../src/models/symbol_source.rs | 14 +- .../opencode-client/src/models/text_part.rs | 13 +- .../src/models/text_part_input.rs | 5 +- .../src/models/text_part_time.rs | 8 +- crates/opencode-client/src/models/todo.rs | 3 +- .../src/models/tool_list_item.rs | 9 +- .../opencode-client/src/models/tool_part.rs | 15 +- .../opencode-client/src/models/tool_state.rs | 10 +- .../src/models/tool_state_completed.rs | 14 +- .../src/models/tool_state_completed_time.rs | 3 +- .../src/models/tool_state_error.rs | 12 +- .../src/models/tool_state_error_time.rs | 8 +- .../src/models/tool_state_pending.rs | 17 +- .../src/models/tool_state_running.rs | 11 +- .../src/models/tool_state_running_time.rs | 7 +- .../models/tui_control_next_200_response.rs | 8 +- .../src/models/tui_execute_command_request.rs | 7 +- .../src/models/tui_publish_request.rs | 5 +- .../src/models/tui_show_toast_request.rs | 5 +- .../src/models/unknown_error.rs | 5 +- .../src/models/unknown_error_data.rs | 7 +- .../src/models/user_message.rs | 14 +- .../src/models/user_message_summary.rs | 3 +- .../src/models/user_message_time.rs | 7 +- crates/opencode-client/src/models/vcs_info.rs | 7 +- .../src/models/well_known_auth.rs | 11 +- crates/orchestrator/src/activity_store.rs | 96 +- crates/orchestrator/src/executor.rs | 2821 ++--------------- crates/orchestrator/src/files.rs | 39 +- crates/orchestrator/src/lib.rs | 2 + crates/orchestrator/src/mcp_config.rs | 15 +- crates/orchestrator/src/opencode_events.rs | 111 +- crates/orchestrator/src/plan_parser.rs | 30 +- .../src/services/executor_context.rs | 243 ++ crates/orchestrator/src/services/fix_phase.rs | 288 ++ .../src/services/implementation_phase.rs | 656 ++++ .../orchestrator/src/services/mcp_manager.rs | 108 + .../src/services/message_parser.rs | 327 ++ crates/orchestrator/src/services/mod.rs | 17 + .../src/services/opencode_client.rs | 214 ++ .../src/services/planning_phase.rs | 144 + .../orchestrator/src/services/review_phase.rs | 376 +++ crates/orchestrator/src/session_runner.rs | 33 +- crates/orchestrator/src/state_machine.rs | 4 +- crates/server/src/main.rs | 9 +- crates/server/src/project_manager.rs | 37 +- crates/server/src/routes/filesystem.rs | 6 +- crates/server/src/routes/projects.rs | 9 +- crates/server/src/routes/sessions.rs | 2 - crates/server/src/routes/sse.rs | 12 +- crates/server/src/routes/tasks.rs | 48 +- crates/server/src/state.rs | 12 +- crates/vcs/src/lib.rs | 4 +- 290 files changed, 5279 insertions(+), 4154 deletions(-) create mode 100644 crates/orchestrator/src/services/executor_context.rs create mode 100644 crates/orchestrator/src/services/fix_phase.rs create mode 100644 crates/orchestrator/src/services/implementation_phase.rs create mode 100644 crates/orchestrator/src/services/mcp_manager.rs create mode 100644 crates/orchestrator/src/services/message_parser.rs create mode 100644 crates/orchestrator/src/services/mod.rs create mode 100644 crates/orchestrator/src/services/opencode_client.rs create mode 100644 crates/orchestrator/src/services/planning_phase.rs create mode 100644 crates/orchestrator/src/services/review_phase.rs diff --git a/agents.md b/agents.md index dc36c01..07f8802 100644 --- a/agents.md +++ b/agents.md @@ -31,7 +31,8 @@ opencode-os/ |------|----------|-------| | Add API endpoint | `crates/server/src/routes/` | Add to lib.rs OpenAPI schema | | Task state logic | `crates/orchestrator/src/state_machine.rs` | TaskStateMachine | -| OpenCode integration | `crates/orchestrator/src/executor.rs` | Uses opencode-client SDK | +| OpenCode integration | `crates/orchestrator/src/executor.rs` | Thin orchestrator, delegates to services | +| Phase services | `crates/orchestrator/src/services/` | planning, implementation, review, fix phases | | VCS operations | `crates/vcs/src/` | jj.rs primary, git.rs fallback | | Frontend component | `frontend/src/components/` | Feature dirs: kanban/, sessions/, task-detail/ | | Generated types | `frontend/src/types/generated/` | ts-rs from Rust | @@ -113,8 +114,9 @@ DATABASE_URL=sqlite:./studio.db cargo run --package server # Frontend only cd frontend && pnpm dev -# Tests (109 unit tests across 9 crates) +# Tests cargo test --workspace +cargo test -p orchestrator # 55 tests cargo clippy --workspace --all-features -- -D warnings # Generate frontend SDK diff --git a/crates/AGENTS.md b/crates/AGENTS.md index 83aa9cd..24f027c 100644 --- a/crates/AGENTS.md +++ b/crates/AGENTS.md @@ -11,11 +11,11 @@ | `core` | Domain models (NO I/O) | `Task`, `Session`, `TaskStatus`, `SessionPhase` | 10 | | `db` | SQLite persistence (sqlx) | `TaskRepository`, `SessionRepository`, `create_pool` | 12 | | `opencode-client` | OpenAPI-generated SDK | `apis::DefaultApi`, `Configuration` | 0 | -| `orchestrator` | Task lifecycle engine | `TaskExecutor`, `TaskStateMachine`, `FileManager` | 36 | +| `orchestrator` | Task lifecycle engine | `TaskExecutor`, `TaskStateMachine`, `services::*` | 55 | | `vcs` | VCS abstraction | `VersionControl`, `WorkspaceManager`, `JujutsuVcs`, `GitVcs` | 20 | | `events` | Event bus | `EventBus`, `TaskEvent`, `SessionEvent` | 8 | | `github` | GitHub API (octocrab) | `GitHubClient`, `PullRequest`, `Issue` | 11 | -| `server` | Axum HTTP + SSE | `AppState`, `router`, `OpenApi` | 12 | +| `server` | Axum HTTP + SSE | `AppState`, `router`, `OpenApi` | 20 | | `cli` | Binary: `opencode-studio` | Commands: init, serve, status, update | 0 | ## DEPENDENCY GRAPH @@ -40,10 +40,33 @@ Foundational (no internal deps): core, events, opencode-client | Add API route | `server` | `src/routes/` + update `src/lib.rs` OpenAPI | | Task state transitions | `orchestrator` | `src/state_machine.rs` | | AI prompts | `orchestrator` | `src/prompts.rs` | +| Planning phase | `orchestrator` | `src/services/planning_phase.rs` | +| Implementation phase | `orchestrator` | `src/services/implementation_phase.rs` | +| Review phase | `orchestrator` | `src/services/review_phase.rs` | +| Fix phase | `orchestrator` | `src/services/fix_phase.rs` | +| OpenCode API calls | `orchestrator` | `src/services/opencode_client.rs` | +| Message parsing | `orchestrator` | `src/services/message_parser.rs` | | VCS operations | `vcs` | `src/jj.rs` (primary), `src/git.rs` (fallback) | | Event emission | `events` | `src/types.rs` for new event types | | GitHub integration | `github` | `src/client.rs` | +## ORCHESTRATOR SERVICES + +The `orchestrator` crate uses a modular service architecture in `src/services/`: + +| Service | Purpose | Lines | +|:--------|:--------|------:| +| `executor_context.rs` | Shared context, config, transitions, persistence | 243 | +| `planning_phase.rs` | Planning phase execution | 136 | +| `implementation_phase.rs` | Implementation + phased execution | 646 | +| `review_phase.rs` | AI review with JSON fallback | 353 | +| `fix_phase.rs` | Fix iteration handling | 269 | +| `opencode_client.rs` | OpenCode session/prompt API | 210 | +| `message_parser.rs` | SSE parsing, ReviewResult extraction | 327 | +| `mcp_manager.rs` | MCP server lifecycle | 108 | + +The main `executor.rs` (~530 lines) delegates to these services. + ## CONVENTIONS - `core` exports as `opencode_core` (reserved word collision) @@ -62,7 +85,8 @@ Foundational (no internal deps): core, events, opencode-client ## TEST COMMANDS ```bash -cargo test --workspace # All 109 tests -cargo test -p orchestrator # Single crate -cargo test -p server -- --nocapture # With output +cargo test --workspace # All tests +cargo test -p orchestrator # 55 tests +cargo test -p server -- --nocapture # 20 tests with output +cargo clippy --workspace -- -D warnings # Lint check ``` diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index d2bc908..77bac15 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -182,10 +182,7 @@ async fn download_frontend(app_dir: &PathBuf, show_progress: bool) -> Result<()> .context("Failed to download frontend")?; if !response.status().is_success() { - anyhow::bail!( - "Failed to download frontend: HTTP {}", - response.status() - ); + anyhow::bail!("Failed to download frontend: HTTP {}", response.status()); } let total_size = response.content_length().unwrap_or(0); @@ -436,7 +433,11 @@ fn print_init_success(project_name: &str) { println!(" ├── {}/", "plans".dimmed()); println!(" └── {}/", "reviews".dimmed()); println!(); - println!(" {} Database stored in {}", "ℹ".blue(), "~/.opencode-studio/data/".dimmed()); + println!( + " {} Database stored in {}", + "ℹ".blue(), + "~/.opencode-studio/data/".dimmed() + ); println!(); } @@ -620,10 +621,7 @@ async fn status(path: Option) -> Result<()> { if !studio_dir.exists() { println!(); println!(" {} Not an OpenCode Studio project.", "✗".red()); - println!( - " Run {} to initialize.", - "opencode-studio init".cyan() - ); + println!(" Run {} to initialize.", "opencode-studio init".cyan()); println!(); return Ok(()); } @@ -636,11 +634,7 @@ async fn status(path: Option) -> Result<()> { Ok(p) => p, Err(e) => { println!(); - println!( - " {} Failed to determine database path: {}", - "✗".red(), - e - ); + println!(" {} Failed to determine database path: {}", "✗".red(), e); return Ok(()); } }; @@ -664,11 +658,7 @@ async fn status(path: Option) -> Result<()> { let tasks = task_repo.find_all().await?; println!(); - println!( - " {} {}", - "◆".magenta(), - config.project.name.white().bold() - ); + println!(" {} {}", "◆".magenta(), config.project.name.white().bold()); println!(" {}", cwd.display().to_string().dimmed()); println!(); @@ -722,8 +712,7 @@ fn init_tracing() { tracing_subscriber::registry() .with(tracing_subscriber::fmt::layer().with_target(false)) .with( - tracing_subscriber::EnvFilter::try_from_default_env() - .unwrap_or_else(|_| "warn".into()), + tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "warn".into()), ) .init(); } diff --git a/crates/db/src/repositories/review_comment_repository.rs b/crates/db/src/repositories/review_comment_repository.rs index df920a2..fd8b401 100644 --- a/crates/db/src/repositories/review_comment_repository.rs +++ b/crates/db/src/repositories/review_comment_repository.rs @@ -59,6 +59,7 @@ impl ReviewCommentRepository { } /// Create a new comment + #[allow(clippy::too_many_arguments)] pub async fn create( &self, id: &str, diff --git a/crates/db/src/repositories/session_activity_repository.rs b/crates/db/src/repositories/session_activity_repository.rs index 776274d..7d0e6da 100644 --- a/crates/db/src/repositories/session_activity_repository.rs +++ b/crates/db/src/repositories/session_activity_repository.rs @@ -14,7 +14,8 @@ impl SessionActivityRepository { } pub async fn create(&self, activity: &CreateSessionActivity) -> Result { - let data_json = serde_json::to_string(&activity.data).unwrap_or_else(|_| "null".to_string()); + let data_json = + serde_json::to_string(&activity.data).unwrap_or_else(|_| "null".to_string()); let created_at = chrono::Utc::now().timestamp(); let result = sqlx::query( @@ -34,7 +35,10 @@ impl SessionActivityRepository { Ok(result.last_insert_rowid()) } - pub async fn find_by_session_id(&self, session_id: Uuid) -> Result, DbError> { + pub async fn find_by_session_id( + &self, + session_id: Uuid, + ) -> Result, DbError> { let rows: Vec = sqlx::query_as( r#" SELECT id, session_id, activity_type, activity_id, data, created_at @@ -72,12 +76,11 @@ impl SessionActivityRepository { } pub async fn count_by_session_id(&self, session_id: Uuid) -> Result { - let count: (i64,) = sqlx::query_as( - "SELECT COUNT(*) FROM session_activities WHERE session_id = ?", - ) - .bind(session_id.to_string()) - .fetch_one(&self.pool) - .await?; + let count: (i64,) = + sqlx::query_as("SELECT COUNT(*) FROM session_activities WHERE session_id = ?") + .bind(session_id.to_string()) + .fetch_one(&self.pool) + .await?; Ok(count.0) } @@ -177,7 +180,10 @@ mod tests { } // Get activities since id[2] - let activities = repo.find_by_session_id_since(session.id, ids[2]).await.unwrap(); + let activities = repo + .find_by_session_id_since(session.id, ids[2]) + .await + .unwrap(); assert_eq!(activities.len(), 2); assert_eq!(activities[0].id, ids[3]); assert_eq!(activities[1].id, ids[4]); diff --git a/crates/github/src/client.rs b/crates/github/src/client.rs index 43d1403..5077ab9 100644 --- a/crates/github/src/client.rs +++ b/crates/github/src/client.rs @@ -71,17 +71,35 @@ impl GitHubClient { let pulls_handler = self.octocrab.pulls(&self.repo.owner, &self.repo.repo); let prs = match state { - Some(PrState::Open) => pulls_handler.list().state(octocrab::params::State::Open).send().await?, + Some(PrState::Open) => { + pulls_handler + .list() + .state(octocrab::params::State::Open) + .send() + .await? + } Some(PrState::Closed) | Some(PrState::Merged) => { - pulls_handler.list().state(octocrab::params::State::Closed).send().await? + pulls_handler + .list() + .state(octocrab::params::State::Closed) + .send() + .await? } None => pulls_handler.list().send().await?, }; - Ok(prs.items.into_iter().map(|pr| self.convert_pr(pr)).collect()) + Ok(prs + .items + .into_iter() + .map(|pr| self.convert_pr(pr)) + .collect()) } - pub async fn merge_pull_request(&self, number: u64, commit_message: Option<&str>) -> Result<()> { + pub async fn merge_pull_request( + &self, + number: u64, + commit_message: Option<&str>, + ) -> Result<()> { info!("Merging PR #{}", number); let pulls_handler = self.octocrab.pulls(&self.repo.owner, &self.repo.repo); @@ -129,10 +147,7 @@ impl GitHubClient { state, head_branch: pr.head.ref_field, base_branch: pr.base.ref_field, - html_url: pr - .html_url - .map(|u| u.to_string()) - .unwrap_or_default(), + html_url: pr.html_url.map(|u| u.to_string()).unwrap_or_default(), created_at: pr.created_at.unwrap_or_default(), updated_at: pr.updated_at.unwrap_or_default(), merged_at: pr.merged_at, @@ -183,10 +198,7 @@ impl GitHubClient { poll_interval_secs: u64, max_wait_secs: u64, ) -> Result { - info!( - "Waiting for CI on {} (max {}s)", - ref_name, max_wait_secs - ); + info!("Waiting for CI on {} (max {}s)", ref_name, max_wait_secs); let start = std::time::Instant::now(); let poll_duration = std::time::Duration::from_secs(poll_interval_secs); @@ -225,7 +237,11 @@ impl GitHubClient { None => has_pending = true, Some(c) if c.contains("Success") => {} Some(c) if c.contains("Skipped") || c.contains("Neutral") => {} - Some(c) if c.contains("Failure") || c.contains("Cancelled") || c.contains("TimedOut") => { + Some(c) + if c.contains("Failure") + || c.contains("Cancelled") + || c.contains("TimedOut") => + { has_failure = true } Some(c) if c.contains("ActionRequired") => has_pending = true, @@ -262,8 +278,20 @@ impl GitHubClient { let issues_handler = self.octocrab.issues(&self.repo.owner, &self.repo.repo); let issues = match state { - Some(IssueState::Open) => issues_handler.list().state(octocrab::params::State::Open).send().await?, - Some(IssueState::Closed) => issues_handler.list().state(octocrab::params::State::Closed).send().await?, + Some(IssueState::Open) => { + issues_handler + .list() + .state(octocrab::params::State::Open) + .send() + .await? + } + Some(IssueState::Closed) => { + issues_handler + .list() + .state(octocrab::params::State::Closed) + .send() + .await? + } None => issues_handler.list().send().await?, }; @@ -278,10 +306,8 @@ impl GitHubClient { pub async fn import_issue(&self, number: u64) -> Result { let issue = self.get_issue(number).await?; - let task = opencode_core::Task::new( - issue.title.clone(), - issue.body.clone().unwrap_or_default(), - ); + let task = + opencode_core::Task::new(issue.title.clone(), issue.body.clone().unwrap_or_default()); info!("Imported issue #{} as task {}", number, task.id); Ok(task) @@ -443,7 +469,11 @@ mod tests { None => has_pending = true, Some(c) if c.contains("Success") => {} Some(c) if c.contains("Skipped") || c.contains("Neutral") => {} - Some(c) if c.contains("Failure") || c.contains("Cancelled") || c.contains("TimedOut") => { + Some(c) + if c.contains("Failure") + || c.contains("Cancelled") + || c.contains("TimedOut") => + { has_failure = true } Some(c) if c.contains("ActionRequired") => has_pending = true, diff --git a/crates/mcp-findings/src/lib.rs b/crates/mcp-findings/src/lib.rs index eeaab33..f766b53 100644 --- a/crates/mcp-findings/src/lib.rs +++ b/crates/mcp-findings/src/lib.rs @@ -48,7 +48,9 @@ pub struct CreateFindingRequest { pub description: String, /// Severity level: "error", "warning", or "info" - #[schemars(description = "Severity level: error (must fix), warning (should fix), info (suggestion)")] + #[schemars( + description = "Severity level: error (must fix), warning (should fix), info (suggestion)" + )] pub severity: String, } @@ -80,11 +82,11 @@ pub struct MarkFixedRequest { pub finding_id: String, } -/// MCP Findings Service for code review #[derive(Clone)] pub struct FindingsService { task_id: Uuid, session_id: Uuid, + #[allow(dead_code)] workspace_path: PathBuf, findings: Arc>>, summary: Arc>>, @@ -139,7 +141,9 @@ impl FindingsService { #[tool_router] impl FindingsService { - #[tool(description = "Create a new code review finding. Use this to report issues found during review.")] + #[tool( + description = "Create a new code review finding. Use this to report issues found during review." + )] async fn create_finding( &self, Parameters(request): Parameters, @@ -180,7 +184,9 @@ impl FindingsService { ))])) } - #[tool(description = "List all findings for this task. Returns both existing findings from file and any newly created in this session.")] + #[tool( + description = "List all findings for this task. Returns both existing findings from file and any newly created in this session." + )] async fn list_findings(&self) -> Result { // First try to load existing findings from file let file_findings = match self.file_manager.read_findings(self.task_id).await { @@ -255,14 +261,23 @@ impl FindingsService { }; return Ok(CallToolResult::success(vec![Content::text(format!( "Finding: {}\n\nTitle: {}\nSeverity: {}\nStatus: {:?}\n{}\n\nDescription:\n{}", - f.id, f.title, f.severity.as_str(), f.status, location, f.description + f.id, + f.title, + f.severity.as_str(), + f.status, + location, + f.description ))])); } drop(session_findings); // Then check file findings if let Ok(Some(existing)) = self.file_manager.read_findings(self.task_id).await { - if let Some(f) = existing.findings.iter().find(|f| f.id == request.finding_id) { + if let Some(f) = existing + .findings + .iter() + .find(|f| f.id == request.finding_id) + { let location = match (&f.file_path, f.line_start, f.line_end) { (Some(path), Some(start), Some(end)) if start != end => { format!("Location: {}:{}-{}", path, start, end) @@ -273,7 +288,12 @@ impl FindingsService { }; return Ok(CallToolResult::success(vec![Content::text(format!( "Finding: {}\n\nTitle: {}\nSeverity: {}\nStatus: {:?}\n{}\n\nDescription:\n{}", - f.id, f.title, f.severity.as_str(), f.status, location, f.description + f.id, + f.title, + f.severity.as_str(), + f.status, + location, + f.description ))])); } } @@ -284,7 +304,9 @@ impl FindingsService { ))])) } - #[tool(description = "Mark a finding as fixed after you've addressed the issue. This updates the findings file.")] + #[tool( + description = "Mark a finding as fixed after you've addressed the issue. This updates the findings file." + )] async fn mark_fixed( &self, Parameters(request): Parameters, @@ -348,7 +370,9 @@ impl FindingsService { ))])) } - #[tool(description = "Approve the review. Use this when the code has no issues or only info-level suggestions.")] + #[tool( + description = "Approve the review. Use this when the code has no issues or only info-level suggestions." + )] async fn approve_review( &self, Parameters(request): Parameters, @@ -376,7 +400,9 @@ impl FindingsService { )])) } - #[tool(description = "Complete the review with findings. Use this when there are issues that need to be fixed.")] + #[tool( + description = "Complete the review with findings. Use this when there are issues that need to be fixed." + )] async fn complete_review( &self, Parameters(request): Parameters, @@ -446,11 +472,8 @@ mod tests { #[tokio::test] async fn test_create_finding() { - let service = FindingsService::new( - Uuid::new_v4(), - Uuid::new_v4(), - PathBuf::from("/tmp/test"), - ); + let service = + FindingsService::new(Uuid::new_v4(), Uuid::new_v4(), PathBuf::from("/tmp/test")); // Create a finding let request = CreateFindingRequest { @@ -462,10 +485,7 @@ mod tests { severity: "error".to_string(), }; - let result = service - .create_finding(Parameters(request)) - .await - .unwrap(); + let result = service.create_finding(Parameters(request)).await.unwrap(); assert!(matches!(result, CallToolResult { .. })); diff --git a/crates/opencode-client/src/apis/configuration.rs b/crates/opencode-client/src/apis/configuration.rs index 9b7e71b..81fc957 100644 --- a/crates/opencode-client/src/apis/configuration.rs +++ b/crates/opencode-client/src/apis/configuration.rs @@ -4,12 +4,10 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ - - #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -29,7 +27,6 @@ pub struct ApiKey { pub key: String, } - impl Configuration { pub fn new() -> Configuration { Configuration::default() diff --git a/crates/opencode-client/src/apis/default_api.rs b/crates/opencode-client/src/apis/default_api.rs index a1b1297..8542cc2 100644 --- a/crates/opencode-client/src/apis/default_api.rs +++ b/crates/opencode-client/src/apis/default_api.rs @@ -4,16 +4,14 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ - -use reqwest; -use serde::{Deserialize, Serialize, de::Error as _}; +use super::{configuration, ContentType, Error}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration, ContentType}; - +use reqwest; +use serde::{de::Error as _, Deserialize, Serialize}; /// struct for typed errors of method [`app_agents`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -656,9 +654,11 @@ pub enum VcsGetError { UnknownValue(serde_json::Value), } - /// Get a list of all available AI agents in the OpenCode system. -pub async fn app_agents(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn app_agents( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -693,18 +693,28 @@ pub async fn app_agents(configuration: &configuration::Configuration, directory: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Write a log entry to the server logs with specified level and metadata. -pub async fn app_log(configuration: &configuration::Configuration, directory: Option<&str>, app_log_request: Option) -> Result> { +pub async fn app_log( + configuration: &configuration::Configuration, + directory: Option<&str>, + app_log_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_app_log_request = app_log_request; let uri_str = format!("{}/log", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -735,18 +745,31 @@ pub async fn app_log(configuration: &configuration::Configuration, directory: Op } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Set authentication credentials -pub async fn auth_set(configuration: &configuration::Configuration, provider_id: &str, directory: Option<&str>, auth: Option) -> Result> { +pub async fn auth_set( + configuration: &configuration::Configuration, + provider_id: &str, + directory: Option<&str>, + auth: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_provider_id = provider_id; let p_query_directory = directory; let p_body_auth = auth; - let uri_str = format!("{}/auth/{providerID}", configuration.base_path, providerID=crate::apis::urlencode(p_path_provider_id)); + let uri_str = format!( + "{}/auth/{providerID}", + configuration.base_path, + providerID = crate::apis::urlencode(p_path_provider_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -778,12 +801,19 @@ pub async fn auth_set(configuration: &configuration::Configuration, provider_id: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all available commands in the OpenCode system. -pub async fn command_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn command_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -818,12 +848,19 @@ pub async fn command_list(configuration: &configuration::Configuration, director } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the current OpenCode configuration settings and preferences. -pub async fn config_get(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn config_get( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -858,12 +895,19 @@ pub async fn config_get(configuration: &configuration::Configuration, directory: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all configured AI providers and their default models. -pub async fn config_providers(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn config_providers( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -898,18 +942,28 @@ pub async fn config_providers(configuration: &configuration::Configuration, dire } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Update OpenCode configuration settings and preferences. -pub async fn config_update(configuration: &configuration::Configuration, directory: Option<&str>, config: Option) -> Result> { +pub async fn config_update( + configuration: &configuration::Configuration, + directory: Option<&str>, + config: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_config = config; let uri_str = format!("{}/config", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::PATCH, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -940,12 +994,19 @@ pub async fn config_update(configuration: &configuration::Configuration, directo } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get events -pub async fn event_subscribe(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn event_subscribe( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -980,12 +1041,20 @@ pub async fn event_subscribe(configuration: &configuration::Configuration, direc } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// List files and directories in a specified path. -pub async fn file_list(configuration: &configuration::Configuration, path: &str, directory: Option<&str>) -> Result, Error> { +pub async fn file_list( + configuration: &configuration::Configuration, + path: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_path = path; let p_query_directory = directory; @@ -1022,12 +1091,20 @@ pub async fn file_list(configuration: &configuration::Configuration, path: &str, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Read the content of a specified file. -pub async fn file_read(configuration: &configuration::Configuration, path: &str, directory: Option<&str>) -> Result> { +pub async fn file_read( + configuration: &configuration::Configuration, + path: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_path = path; let p_query_directory = directory; @@ -1064,12 +1141,19 @@ pub async fn file_read(configuration: &configuration::Configuration, path: &str, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get the git status of all files in the project. -pub async fn file_status(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn file_status( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1104,12 +1188,23 @@ pub async fn file_status(configuration: &configuration::Configuration, directory } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Search for files or directories by name or pattern in the project directory. -pub async fn find_files(configuration: &configuration::Configuration, query: &str, directory: Option<&str>, dirs: Option<&str>, r#type: Option<&str>, limit: Option) -> Result, Error> { +pub async fn find_files( + configuration: &configuration::Configuration, + query: &str, + directory: Option<&str>, + dirs: Option<&str>, + r#type: Option<&str>, + limit: Option, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_query = query; let p_query_directory = directory; @@ -1158,12 +1253,20 @@ pub async fn find_files(configuration: &configuration::Configuration, query: &st } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Search for workspace symbols like functions, classes, and variables using LSP. -pub async fn find_symbols(configuration: &configuration::Configuration, query: &str, directory: Option<&str>) -> Result, Error> { +pub async fn find_symbols( + configuration: &configuration::Configuration, + query: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_query = query; let p_query_directory = directory; @@ -1200,12 +1303,20 @@ pub async fn find_symbols(configuration: &configuration::Configuration, query: & } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Search for text patterns across files in the project using ripgrep. -pub async fn find_text(configuration: &configuration::Configuration, pattern: &str, directory: Option<&str>) -> Result, Error> { +pub async fn find_text( + configuration: &configuration::Configuration, + pattern: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_pattern = pattern; let p_query_directory = directory; @@ -1242,12 +1353,19 @@ pub async fn find_text(configuration: &configuration::Configuration, pattern: &s } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get formatter status -pub async fn formatter_status(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn formatter_status( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1282,15 +1400,22 @@ pub async fn formatter_status(configuration: &configuration::Configuration, dire } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Clean up and dispose all OpenCode instances, releasing all resources. -pub async fn global_dispose(configuration: &configuration::Configuration, ) -> Result> { - +pub async fn global_dispose( + configuration: &configuration::Configuration, +) -> Result> { let uri_str = format!("{}/global/dispose", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -1317,13 +1442,18 @@ pub async fn global_dispose(configuration: &configuration::Configuration, ) -> R } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Subscribe to global events from the OpenCode system using server-sent events. -pub async fn global_event(configuration: &configuration::Configuration, ) -> Result> { - +pub async fn global_event( + configuration: &configuration::Configuration, +) -> Result> { let uri_str = format!("{}/global/event", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -1352,13 +1482,18 @@ pub async fn global_event(configuration: &configuration::Configuration, ) -> Res } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get health information about the OpenCode server. -pub async fn global_health(configuration: &configuration::Configuration, ) -> Result> { - +pub async fn global_health( + configuration: &configuration::Configuration, +) -> Result> { let uri_str = format!("{}/global/health", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -1387,17 +1522,26 @@ pub async fn global_health(configuration: &configuration::Configuration, ) -> Re } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Clean up and dispose the current OpenCode instance, releasing all resources. -pub async fn instance_dispose(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn instance_dispose( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/instance/dispose", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1427,12 +1571,19 @@ pub async fn instance_dispose(configuration: &configuration::Configuration, dire } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get LSP server status -pub async fn lsp_status(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn lsp_status( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1467,18 +1618,28 @@ pub async fn lsp_status(configuration: &configuration::Configuration, directory: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Dynamically add a new Model Context Protocol (MCP) server to the system. -pub async fn mcp_add(configuration: &configuration::Configuration, directory: Option<&str>, mcp_add_request: Option) -> Result, Error> { +pub async fn mcp_add( + configuration: &configuration::Configuration, + directory: Option<&str>, + mcp_add_request: Option, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_mcp_add_request = mcp_add_request; let uri_str = format!("{}/mcp", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1509,18 +1670,32 @@ pub async fn mcp_add(configuration: &configuration::Configuration, directory: Op } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Start OAuth flow and wait for callback (opens browser) -pub async fn mcp_auth_authenticate(configuration: &configuration::Configuration, name: &str, directory: Option<&str>) -> Result> { +pub async fn mcp_auth_authenticate( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; - let uri_str = format!("{}/mcp/{name}/auth/authenticate", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/auth/authenticate", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1550,19 +1725,34 @@ pub async fn mcp_auth_authenticate(configuration: &configuration::Configuration, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. -pub async fn mcp_auth_callback(configuration: &configuration::Configuration, name: &str, directory: Option<&str>, mcp_auth_callback_request: Option) -> Result> { +pub async fn mcp_auth_callback( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, + mcp_auth_callback_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; let p_body_mcp_auth_callback_request = mcp_auth_callback_request; - let uri_str = format!("{}/mcp/{name}/auth/callback", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/auth/callback", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1593,18 +1783,32 @@ pub async fn mcp_auth_callback(configuration: &configuration::Configuration, nam } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Remove OAuth credentials for an MCP server -pub async fn mcp_auth_remove(configuration: &configuration::Configuration, name: &str, directory: Option<&str>) -> Result> { +pub async fn mcp_auth_remove( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; - let uri_str = format!("{}/mcp/{name}/auth", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/auth", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::DELETE, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1634,18 +1838,32 @@ pub async fn mcp_auth_remove(configuration: &configuration::Configuration, name: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Start OAuth authentication flow for a Model Context Protocol (MCP) server. -pub async fn mcp_auth_start(configuration: &configuration::Configuration, name: &str, directory: Option<&str>) -> Result> { +pub async fn mcp_auth_start( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; - let uri_str = format!("{}/mcp/{name}/auth", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/auth", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1675,18 +1893,32 @@ pub async fn mcp_auth_start(configuration: &configuration::Configuration, name: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Connect an MCP server -pub async fn mcp_connect(configuration: &configuration::Configuration, name: &str, directory: Option<&str>) -> Result> { +pub async fn mcp_connect( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; - let uri_str = format!("{}/mcp/{name}/connect", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/connect", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1716,18 +1948,32 @@ pub async fn mcp_connect(configuration: &configuration::Configuration, name: &st } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Disconnect an MCP server -pub async fn mcp_disconnect(configuration: &configuration::Configuration, name: &str, directory: Option<&str>) -> Result> { +pub async fn mcp_disconnect( + configuration: &configuration::Configuration, + name: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_name = name; let p_query_directory = directory; - let uri_str = format!("{}/mcp/{name}/disconnect", configuration.base_path, name=crate::apis::urlencode(p_path_name)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/mcp/{name}/disconnect", + configuration.base_path, + name = crate::apis::urlencode(p_path_name) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1757,12 +2003,19 @@ pub async fn mcp_disconnect(configuration: &configuration::Configuration, name: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get the status of all Model Context Protocol (MCP) servers. -pub async fn mcp_status(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn mcp_status( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1797,20 +2050,38 @@ pub async fn mcp_status(configuration: &configuration::Configuration, directory: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Delete a part from a message -pub async fn part_delete(configuration: &configuration::Configuration, session_id: &str, message_id: &str, part_id: &str, directory: Option<&str>) -> Result> { +pub async fn part_delete( + configuration: &configuration::Configuration, + session_id: &str, + message_id: &str, + part_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_path_message_id = message_id; let p_path_part_id = part_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/message/{messageID}/part/{partID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id), messageID=crate::apis::urlencode(p_path_message_id), partID=crate::apis::urlencode(p_path_part_id)); - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/message/{messageID}/part/{partID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id), + messageID = crate::apis::urlencode(p_path_message_id), + partID = crate::apis::urlencode(p_path_part_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::DELETE, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1840,12 +2111,23 @@ pub async fn part_delete(configuration: &configuration::Configuration, session_i } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Update a part in a message -pub async fn part_update(configuration: &configuration::Configuration, session_id: &str, message_id: &str, part_id: &str, directory: Option<&str>, part: Option) -> Result> { +pub async fn part_update( + configuration: &configuration::Configuration, + session_id: &str, + message_id: &str, + part_id: &str, + directory: Option<&str>, + part: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_path_message_id = message_id; @@ -1853,8 +2135,16 @@ pub async fn part_update(configuration: &configuration::Configuration, session_i let p_query_directory = directory; let p_body_part = part; - let uri_str = format!("{}/session/{sessionID}/message/{messageID}/part/{partID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id), messageID=crate::apis::urlencode(p_path_message_id), partID=crate::apis::urlencode(p_path_part_id)); - let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/message/{messageID}/part/{partID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id), + messageID = crate::apis::urlencode(p_path_message_id), + partID = crate::apis::urlencode(p_path_part_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::PATCH, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -1885,12 +2175,19 @@ pub async fn part_update(configuration: &configuration::Configuration, session_i } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the current working directory and related path information for the OpenCode instance. -pub async fn path_get(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn path_get( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1925,12 +2222,19 @@ pub async fn path_get(configuration: &configuration::Configuration, directory: O } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get all pending permission requests across all sessions. -pub async fn permission_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn permission_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -1965,20 +2269,37 @@ pub async fn permission_list(configuration: &configuration::Configuration, direc } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Approve or deny a permission request from the AI assistant. -pub async fn permission_respond(configuration: &configuration::Configuration, session_id: &str, permission_id: &str, directory: Option<&str>, permission_respond_request: Option) -> Result> { +pub async fn permission_respond( + configuration: &configuration::Configuration, + session_id: &str, + permission_id: &str, + directory: Option<&str>, + permission_respond_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_path_permission_id = permission_id; let p_query_directory = directory; let p_body_permission_respond_request = permission_respond_request; - let uri_str = format!("{}/session/{sessionID}/permissions/{permissionID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id), permissionID=crate::apis::urlencode(p_path_permission_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/permissions/{permissionID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id), + permissionID = crate::apis::urlencode(p_path_permission_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2009,12 +2330,19 @@ pub async fn permission_respond(configuration: &configuration::Configuration, se } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the currently active project that OpenCode is working with. -pub async fn project_current(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn project_current( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2049,12 +2377,19 @@ pub async fn project_current(configuration: &configuration::Configuration, direc } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of projects that have been opened with OpenCode. -pub async fn project_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn project_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2089,19 +2424,34 @@ pub async fn project_list(configuration: &configuration::Configuration, director } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Update project properties such as name, icon and color. -pub async fn project_update(configuration: &configuration::Configuration, project_id: &str, directory: Option<&str>, project_update_request: Option) -> Result> { +pub async fn project_update( + configuration: &configuration::Configuration, + project_id: &str, + directory: Option<&str>, + project_update_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_project_id = project_id; let p_query_directory = directory; let p_body_project_update_request = project_update_request; - let uri_str = format!("{}/project/{projectID}", configuration.base_path, projectID=crate::apis::urlencode(p_path_project_id)); - let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + let uri_str = format!( + "{}/project/{projectID}", + configuration.base_path, + projectID = crate::apis::urlencode(p_path_project_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::PATCH, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2132,12 +2482,22 @@ pub async fn project_update(configuration: &configuration::Configuration, projec } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve available authentication methods for all AI providers. -pub async fn provider_auth(configuration: &configuration::Configuration, directory: Option<&str>) -> Result>, Error> { +pub async fn provider_auth( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result< + std::collections::HashMap>, + Error, +> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2172,12 +2532,19 @@ pub async fn provider_auth(configuration: &configuration::Configuration, directo } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all available AI providers, including both available and connected ones. -pub async fn provider_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn provider_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2212,19 +2579,34 @@ pub async fn provider_list(configuration: &configuration::Configuration, directo } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Initiate OAuth authorization for a specific AI provider to get an authorization URL. -pub async fn provider_oauth_authorize(configuration: &configuration::Configuration, provider_id: &str, directory: Option<&str>, provider_oauth_authorize_request: Option) -> Result> { +pub async fn provider_oauth_authorize( + configuration: &configuration::Configuration, + provider_id: &str, + directory: Option<&str>, + provider_oauth_authorize_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_provider_id = provider_id; let p_query_directory = directory; let p_body_provider_oauth_authorize_request = provider_oauth_authorize_request; - let uri_str = format!("{}/provider/{providerID}/oauth/authorize", configuration.base_path, providerID=crate::apis::urlencode(p_path_provider_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/provider/{providerID}/oauth/authorize", + configuration.base_path, + providerID = crate::apis::urlencode(p_path_provider_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2255,19 +2637,34 @@ pub async fn provider_oauth_authorize(configuration: &configuration::Configurati } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Handle the OAuth callback from a provider after user authorization. -pub async fn provider_oauth_callback(configuration: &configuration::Configuration, provider_id: &str, directory: Option<&str>, provider_oauth_callback_request: Option) -> Result> { +pub async fn provider_oauth_callback( + configuration: &configuration::Configuration, + provider_id: &str, + directory: Option<&str>, + provider_oauth_callback_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_provider_id = provider_id; let p_query_directory = directory; let p_body_provider_oauth_callback_request = provider_oauth_callback_request; - let uri_str = format!("{}/provider/{providerID}/oauth/callback", configuration.base_path, providerID=crate::apis::urlencode(p_path_provider_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/provider/{providerID}/oauth/callback", + configuration.base_path, + providerID = crate::apis::urlencode(p_path_provider_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2298,17 +2695,29 @@ pub async fn provider_oauth_callback(configuration: &configuration::Configuratio } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. -pub async fn pty_connect(configuration: &configuration::Configuration, pty_id: &str, directory: Option<&str>) -> Result> { +pub async fn pty_connect( + configuration: &configuration::Configuration, + pty_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_pty_id = pty_id; let p_query_directory = directory; - let uri_str = format!("{}/pty/{ptyID}/connect", configuration.base_path, ptyID=crate::apis::urlencode(p_path_pty_id)); + let uri_str = format!( + "{}/pty/{ptyID}/connect", + configuration.base_path, + ptyID = crate::apis::urlencode(p_path_pty_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2339,18 +2748,28 @@ pub async fn pty_connect(configuration: &configuration::Configuration, pty_id: & } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create a new pseudo-terminal (PTY) session for running shell commands and processes. -pub async fn pty_create(configuration: &configuration::Configuration, directory: Option<&str>, pty_create_request: Option) -> Result> { +pub async fn pty_create( + configuration: &configuration::Configuration, + directory: Option<&str>, + pty_create_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_pty_create_request = pty_create_request; let uri_str = format!("{}/pty", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2381,17 +2800,29 @@ pub async fn pty_create(configuration: &configuration::Configuration, directory: } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve detailed information about a specific pseudo-terminal (PTY) session. -pub async fn pty_get(configuration: &configuration::Configuration, pty_id: &str, directory: Option<&str>) -> Result> { +pub async fn pty_get( + configuration: &configuration::Configuration, + pty_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_pty_id = pty_id; let p_query_directory = directory; - let uri_str = format!("{}/pty/{ptyID}", configuration.base_path, ptyID=crate::apis::urlencode(p_path_pty_id)); + let uri_str = format!( + "{}/pty/{ptyID}", + configuration.base_path, + ptyID = crate::apis::urlencode(p_path_pty_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2422,12 +2853,19 @@ pub async fn pty_get(configuration: &configuration::Configuration, pty_id: &str, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. -pub async fn pty_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn pty_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2462,18 +2900,32 @@ pub async fn pty_list(configuration: &configuration::Configuration, directory: O } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Remove and terminate a specific pseudo-terminal (PTY) session. -pub async fn pty_remove(configuration: &configuration::Configuration, pty_id: &str, directory: Option<&str>) -> Result> { +pub async fn pty_remove( + configuration: &configuration::Configuration, + pty_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_pty_id = pty_id; let p_query_directory = directory; - let uri_str = format!("{}/pty/{ptyID}", configuration.base_path, ptyID=crate::apis::urlencode(p_path_pty_id)); - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + let uri_str = format!( + "{}/pty/{ptyID}", + configuration.base_path, + ptyID = crate::apis::urlencode(p_path_pty_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::DELETE, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2503,18 +2955,31 @@ pub async fn pty_remove(configuration: &configuration::Configuration, pty_id: &s } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Update properties of an existing pseudo-terminal (PTY) session. -pub async fn pty_update(configuration: &configuration::Configuration, pty_id: &str, directory: Option<&str>, pty_update_request: Option) -> Result> { +pub async fn pty_update( + configuration: &configuration::Configuration, + pty_id: &str, + directory: Option<&str>, + pty_update_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_pty_id = pty_id; let p_query_directory = directory; let p_body_pty_update_request = pty_update_request; - let uri_str = format!("{}/pty/{ptyID}", configuration.base_path, ptyID=crate::apis::urlencode(p_path_pty_id)); + let uri_str = format!( + "{}/pty/{ptyID}", + configuration.base_path, + ptyID = crate::apis::urlencode(p_path_pty_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2546,18 +3011,32 @@ pub async fn pty_update(configuration: &configuration::Configuration, pty_id: &s } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Abort an active session and stop any ongoing AI processing or command execution. -pub async fn session_abort(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_abort( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/abort", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/abort", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2587,19 +3066,34 @@ pub async fn session_abort(configuration: &configuration::Configuration, session } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Send a new command to a session for execution by the AI assistant. -pub async fn session_command(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_command_request: Option) -> Result> { +pub async fn session_command( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_command_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_command_request = session_command_request; - let uri_str = format!("{}/session/{sessionID}/command", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/command", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2630,18 +3124,28 @@ pub async fn session_command(configuration: &configuration::Configuration, sessi } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create a new OpenCode session for interacting with AI assistants and managing conversations. -pub async fn session_create(configuration: &configuration::Configuration, directory: Option<&str>, session_create_request: Option) -> Result> { +pub async fn session_create( + configuration: &configuration::Configuration, + directory: Option<&str>, + session_create_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_session_create_request = session_create_request; let uri_str = format!("{}/session", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2672,18 +3176,32 @@ pub async fn session_create(configuration: &configuration::Configuration, direct } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Delete a session and permanently remove all associated data, including messages and history. -pub async fn session_delete(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_delete( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::DELETE, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2713,18 +3231,31 @@ pub async fn session_delete(configuration: &configuration::Configuration, sessio } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get all file changes (diffs) made during this session. -pub async fn session_diff(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, message_id: Option<&str>) -> Result, Error> { +pub async fn session_diff( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + message_id: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_query_message_id = message_id; - let uri_str = format!("{}/session/{sessionID}/diff", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); + let uri_str = format!( + "{}/session/{sessionID}/diff", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2758,19 +3289,34 @@ pub async fn session_diff(configuration: &configuration::Configuration, session_ } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create a new session by forking an existing session at a specific message point. -pub async fn session_fork(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_fork_request: Option) -> Result> { +pub async fn session_fork( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_fork_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_fork_request = session_fork_request; - let uri_str = format!("{}/session/{sessionID}/fork", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/fork", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2801,19 +3347,34 @@ pub async fn session_fork(configuration: &configuration::Configuration, session_ } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Analyze the current application and create an AGENTS.md file with project-specific agent configurations. -pub async fn session_init(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_init_request: Option) -> Result> { +pub async fn session_init( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_init_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_init_request = session_init_request; - let uri_str = format!("{}/session/{sessionID}/init", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/init", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -2844,12 +3405,19 @@ pub async fn session_init(configuration: &configuration::Configuration, session_ } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all OpenCode sessions, sorted by most recently updated. -pub async fn session_list(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn session_list( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -2884,18 +3452,32 @@ pub async fn session_list(configuration: &configuration::Configuration, director } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve a specific message from a session by its message ID. -pub async fn session_message(configuration: &configuration::Configuration, session_id: &str, message_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_message( + configuration: &configuration::Configuration, + session_id: &str, + message_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_path_message_id = message_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/message/{messageID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id), messageID=crate::apis::urlencode(p_path_message_id)); + let uri_str = format!( + "{}/session/{sessionID}/message/{messageID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id), + messageID = crate::apis::urlencode(p_path_message_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2926,18 +3508,31 @@ pub async fn session_message(configuration: &configuration::Configuration, sessi } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve all messages in a session, including user prompts and AI responses. -pub async fn session_messages(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, limit: Option) -> Result, Error> { +pub async fn session_messages( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + limit: Option, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_query_limit = limit; - let uri_str = format!("{}/session/{sessionID}/message", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); + let uri_str = format!( + "{}/session/{sessionID}/message", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -2971,19 +3566,34 @@ pub async fn session_messages(configuration: &configuration::Configuration, sess } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create and send a new message to a session, streaming the AI response. -pub async fn session_prompt(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_prompt_request: Option) -> Result> { +pub async fn session_prompt( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_prompt_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_prompt_request = session_prompt_request; - let uri_str = format!("{}/session/{sessionID}/message", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/message", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3014,19 +3624,34 @@ pub async fn session_prompt(configuration: &configuration::Configuration, sessio } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. -pub async fn session_prompt_async(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_prompt_request: Option) -> Result<(), Error> { +pub async fn session_prompt_async( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_prompt_request: Option, +) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_prompt_request = session_prompt_request; - let uri_str = format!("{}/session/{sessionID}/prompt_async", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/prompt_async", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3046,19 +3671,34 @@ pub async fn session_prompt_async(configuration: &configuration::Configuration, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Revert a specific message in a session, undoing its effects and restoring the previous state. -pub async fn session_revert(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_revert_request: Option) -> Result> { +pub async fn session_revert( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_revert_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_revert_request = session_revert_request; - let uri_str = format!("{}/session/{sessionID}/revert", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/revert", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3089,18 +3729,32 @@ pub async fn session_revert(configuration: &configuration::Configuration, sessio } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Create a shareable link for a session, allowing others to view the conversation. -pub async fn session_share(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_share( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/share", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/share", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3130,19 +3784,34 @@ pub async fn session_share(configuration: &configuration::Configuration, session } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Execute a shell command within the session context and return the AI's response. -pub async fn session_shell(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_shell_request: Option) -> Result> { +pub async fn session_shell( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_shell_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_shell_request = session_shell_request; - let uri_str = format!("{}/session/{sessionID}/shell", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/shell", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3173,12 +3842,19 @@ pub async fn session_shell(configuration: &configuration::Configuration, session } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the current status of all sessions, including active, idle, and completed states. -pub async fn session_status(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn session_status( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -3213,19 +3889,34 @@ pub async fn session_status(configuration: &configuration::Configuration, direct } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Generate a concise summary of the session using AI compaction to preserve key information. -pub async fn session_summarize(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_summarize_request: Option) -> Result> { +pub async fn session_summarize( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_summarize_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_summarize_request = session_summarize_request; - let uri_str = format!("{}/session/{sessionID}/summarize", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/summarize", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3256,17 +3947,29 @@ pub async fn session_summarize(configuration: &configuration::Configuration, ses } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the todo list associated with a specific session, showing tasks and action items. -pub async fn session_todo(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result, Error> { +pub async fn session_todo( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/todo", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); + let uri_str = format!( + "{}/session/{sessionID}/todo", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -3297,18 +4000,32 @@ pub async fn session_todo(configuration: &configuration::Configuration, session_ } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Restore all previously reverted messages in a session. -pub async fn session_unrevert(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_unrevert( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/unrevert", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/unrevert", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3338,18 +4055,32 @@ pub async fn session_unrevert(configuration: &configuration::Configuration, sess } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Remove the shareable link for a session, making it private again. -pub async fn session_unshare(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_unshare( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/share", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}/share", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::DELETE, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3379,19 +4110,34 @@ pub async fn session_unshare(configuration: &configuration::Configuration, sessi } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Update properties of an existing session, such as title or other metadata. -pub async fn session_update(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>, session_update_request: Option) -> Result> { +pub async fn session_update( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, + session_update_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; let p_body_session_update_request = session_update_request; - let uri_str = format!("{}/session/{sessionID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); - let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + let uri_str = format!( + "{}/session/{sessionID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::PATCH, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3422,12 +4168,19 @@ pub async fn session_update(configuration: &configuration::Configuration, sessio } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. -pub async fn tool_ids(configuration: &configuration::Configuration, directory: Option<&str>) -> Result, Error> { +pub async fn tool_ids( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -3462,12 +4215,21 @@ pub async fn tool_ids(configuration: &configuration::Configuration, directory: O } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Get a list of available tools with their JSON schema parameters for a specific provider and model combination. -pub async fn tool_list(configuration: &configuration::Configuration, provider: &str, model: &str, directory: Option<&str>) -> Result, Error> { +pub async fn tool_list( + configuration: &configuration::Configuration, + provider: &str, + model: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_query_provider = provider; let p_query_model = model; @@ -3506,18 +4268,28 @@ pub async fn tool_list(configuration: &configuration::Configuration, provider: & } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Append prompt to the TUI -pub async fn tui_append_prompt(configuration: &configuration::Configuration, directory: Option<&str>, find_text200_response_inner_path: Option) -> Result> { +pub async fn tui_append_prompt( + configuration: &configuration::Configuration, + directory: Option<&str>, + find_text200_response_inner_path: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_find_text200_response_inner_path = find_text200_response_inner_path; let uri_str = format!("{}/tui/append-prompt", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3548,17 +4320,26 @@ pub async fn tui_append_prompt(configuration: &configuration::Configuration, dir } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Clear the prompt -pub async fn tui_clear_prompt(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_clear_prompt( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/clear-prompt", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3588,12 +4369,19 @@ pub async fn tui_clear_prompt(configuration: &configuration::Configuration, dire } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve the next TUI (Terminal User Interface) request from the queue for processing. -pub async fn tui_control_next(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_control_next( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -3628,18 +4416,28 @@ pub async fn tui_control_next(configuration: &configuration::Configuration, dire } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Submit a response to the TUI request queue to complete a pending request. -pub async fn tui_control_response(configuration: &configuration::Configuration, directory: Option<&str>, body: Option) -> Result> { +pub async fn tui_control_response( + configuration: &configuration::Configuration, + directory: Option<&str>, + body: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_body = body; let uri_str = format!("{}/tui/control/response", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3670,18 +4468,28 @@ pub async fn tui_control_response(configuration: &configuration::Configuration, } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Execute a TUI command (e.g. agent_cycle) -pub async fn tui_execute_command(configuration: &configuration::Configuration, directory: Option<&str>, tui_execute_command_request: Option) -> Result> { +pub async fn tui_execute_command( + configuration: &configuration::Configuration, + directory: Option<&str>, + tui_execute_command_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_tui_execute_command_request = tui_execute_command_request; let uri_str = format!("{}/tui/execute-command", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3712,17 +4520,26 @@ pub async fn tui_execute_command(configuration: &configuration::Configuration, d } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Open the help dialog in the TUI to display user assistance information. -pub async fn tui_open_help(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_open_help( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/open-help", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3752,17 +4569,26 @@ pub async fn tui_open_help(configuration: &configuration::Configuration, directo } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Open the model dialog -pub async fn tui_open_models(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_open_models( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/open-models", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3792,17 +4618,26 @@ pub async fn tui_open_models(configuration: &configuration::Configuration, direc } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Open the session dialog -pub async fn tui_open_sessions(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_open_sessions( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/open-sessions", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3832,17 +4667,26 @@ pub async fn tui_open_sessions(configuration: &configuration::Configuration, dir } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Open the theme dialog -pub async fn tui_open_themes(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_open_themes( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/open-themes", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3872,18 +4716,28 @@ pub async fn tui_open_themes(configuration: &configuration::Configuration, direc } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Publish a TUI event -pub async fn tui_publish(configuration: &configuration::Configuration, directory: Option<&str>, tui_publish_request: Option) -> Result> { +pub async fn tui_publish( + configuration: &configuration::Configuration, + directory: Option<&str>, + tui_publish_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_tui_publish_request = tui_publish_request; let uri_str = format!("{}/tui/publish", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3914,18 +4768,28 @@ pub async fn tui_publish(configuration: &configuration::Configuration, directory } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Show a toast notification in the TUI -pub async fn tui_show_toast(configuration: &configuration::Configuration, directory: Option<&str>, tui_show_toast_request: Option) -> Result> { +pub async fn tui_show_toast( + configuration: &configuration::Configuration, + directory: Option<&str>, + tui_show_toast_request: Option, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let p_body_tui_show_toast_request = tui_show_toast_request; let uri_str = format!("{}/tui/show-toast", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3956,17 +4820,26 @@ pub async fn tui_show_toast(configuration: &configuration::Configuration, direct } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Submit the prompt -pub async fn tui_submit_prompt(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn tui_submit_prompt( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; let uri_str = format!("{}/tui/submit-prompt", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref param_value) = p_query_directory { req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]); @@ -3996,12 +4869,19 @@ pub async fn tui_submit_prompt(configuration: &configuration::Configuration, dir } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve version control system (VCS) information for the current project, such as git branch. -pub async fn vcs_get(configuration: &configuration::Configuration, directory: Option<&str>) -> Result> { +pub async fn vcs_get( + configuration: &configuration::Configuration, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_directory = directory; @@ -4036,7 +4916,10 @@ pub async fn vcs_get(configuration: &configuration::Configuration, directory: Op } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/opencode-client/src/apis/mod.rs b/crates/opencode-client/src/apis/mod.rs index f213bf7..cad4e53 100644 --- a/crates/opencode-client/src/apis/mod.rs +++ b/crates/opencode-client/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -96,7 +98,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String enum ContentType { Json, Text, - Unsupported(String) + Unsupported(String), } impl From<&str> for ContentType { diff --git a/crates/opencode-client/src/apis/session_api.rs b/crates/opencode-client/src/apis/session_api.rs index 8e21b51..414a647 100644 --- a/crates/opencode-client/src/apis/session_api.rs +++ b/crates/opencode-client/src/apis/session_api.rs @@ -4,16 +4,14 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ - -use reqwest; -use serde::{Deserialize, Serialize, de::Error as _}; +use super::{configuration, ContentType, Error}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration, ContentType}; - +use reqwest; +use serde::{de::Error as _, Deserialize, Serialize}; /// struct for typed errors of method [`session_children`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,14 +31,21 @@ pub enum SessionGetError { UnknownValue(serde_json::Value), } - /// Retrieve all child sessions that were forked from the specified parent session. -pub async fn session_children(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result, Error> { +pub async fn session_children( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result, Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}/children", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); + let uri_str = format!( + "{}/session/{sessionID}/children", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -71,17 +76,29 @@ pub async fn session_children(configuration: &configuration::Configuration, sess } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// Retrieve detailed information about a specific OpenCode session. -pub async fn session_get(configuration: &configuration::Configuration, session_id: &str, directory: Option<&str>) -> Result> { +pub async fn session_get( + configuration: &configuration::Configuration, + session_id: &str, + directory: Option<&str>, +) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_session_id = session_id; let p_query_directory = directory; - let uri_str = format!("{}/session/{sessionID}", configuration.base_path, sessionID=crate::apis::urlencode(p_path_session_id)); + let uri_str = format!( + "{}/session/{sessionID}", + configuration.base_path, + sessionID = crate::apis::urlencode(p_path_session_id) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref param_value) = p_query_directory { @@ -112,7 +129,10 @@ pub async fn session_get(configuration: &configuration::Configuration, session_i } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/opencode-client/src/lib.rs b/crates/opencode-client/src/lib.rs index 668498c..952a76e 100644 --- a/crates/opencode-client/src/lib.rs +++ b/crates/opencode-client/src/lib.rs @@ -7,11 +7,11 @@ #![allow(clippy::empty_docs)] #![allow(clippy::len_zero)] -extern crate serde_repr; +extern crate reqwest; extern crate serde; extern crate serde_json; +extern crate serde_repr; extern crate url; -extern crate reqwest; pub mod apis; pub mod models; diff --git a/crates/opencode-client/src/models/agent.rs b/crates/opencode-client/src/models/agent.rs index e02c00e..5feb11a 100644 --- a/crates/opencode-client/src/models/agent.rs +++ b/crates/opencode-client/src/models/agent.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -46,7 +46,13 @@ pub struct Agent { } impl Agent { - pub fn new(name: String, mode: Mode, permission: models::AgentPermission, tools: std::collections::HashMap, options: std::collections::HashMap) -> Agent { + pub fn new( + name: String, + mode: Mode, + permission: models::AgentPermission, + tools: std::collections::HashMap, + options: std::collections::HashMap, + ) -> Agent { Agent { name, description: None, @@ -66,7 +72,7 @@ impl Agent { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Mode { #[serde(rename = "subagent")] @@ -82,4 +88,3 @@ impl Default for Mode { Self::Subagent } } - diff --git a/crates/opencode-client/src/models/agent_config.rs b/crates/opencode-client/src/models/agent_config.rs index 0423a38..1613c4e 100644 --- a/crates/opencode-client/src/models/agent_config.rs +++ b/crates/opencode-client/src/models/agent_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -57,7 +57,7 @@ impl AgentConfig { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Mode { #[serde(rename = "subagent")] @@ -73,4 +73,3 @@ impl Default for Mode { Self::Subagent } } - diff --git a/crates/opencode-client/src/models/agent_config_permission.rs b/crates/opencode-client/src/models/agent_config_permission.rs index 76e86d3..846bdb4 100644 --- a/crates/opencode-client/src/models/agent_config_permission.rs +++ b/crates/opencode-client/src/models/agent_config_permission.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,7 +39,7 @@ impl AgentConfigPermission { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Edit { #[serde(rename = "ask")] @@ -55,7 +55,7 @@ impl Default for Edit { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Webfetch { #[serde(rename = "ask")] @@ -71,7 +71,7 @@ impl Default for Webfetch { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DoomLoop { #[serde(rename = "ask")] @@ -87,7 +87,7 @@ impl Default for DoomLoop { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum ExternalDirectory { #[serde(rename = "ask")] @@ -103,4 +103,3 @@ impl Default for ExternalDirectory { Self::Ask } } - diff --git a/crates/opencode-client/src/models/agent_config_permission_bash.rs b/crates/opencode-client/src/models/agent_config_permission_bash.rs index bdcf3ec..0bb1d2d 100644 --- a/crates/opencode-client/src/models/agent_config_permission_bash.rs +++ b/crates/opencode-client/src/models/agent_config_permission_bash.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AgentConfigPermissionBash { -} +pub struct AgentConfigPermissionBash {} impl AgentConfigPermissionBash { pub fn new() -> AgentConfigPermissionBash { - AgentConfigPermissionBash { - } + AgentConfigPermissionBash {} } } - diff --git a/crates/opencode-client/src/models/agent_part.rs b/crates/opencode-client/src/models/agent_part.rs index e658c84..c023e35 100644 --- a/crates/opencode-client/src/models/agent_part.rs +++ b/crates/opencode-client/src/models/agent_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,13 @@ pub struct AgentPart { } impl AgentPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, name: String) -> AgentPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + name: String, + ) -> AgentPart { AgentPart { id, session_id, @@ -39,7 +45,7 @@ impl AgentPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "agent")] @@ -51,4 +57,3 @@ impl Default for Type { Self::Agent } } - diff --git a/crates/opencode-client/src/models/agent_part_input.rs b/crates/opencode-client/src/models/agent_part_input.rs index 1c48c38..06cf3a2 100644 --- a/crates/opencode-client/src/models/agent_part_input.rs +++ b/crates/opencode-client/src/models/agent_part_input.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,7 +33,7 @@ impl AgentPartInput { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "agent")] @@ -45,4 +45,3 @@ impl Default for Type { Self::Agent } } - diff --git a/crates/opencode-client/src/models/agent_part_source.rs b/crates/opencode-client/src/models/agent_part_source.rs index 20dbcc9..879d174 100644 --- a/crates/opencode-client/src/models/agent_part_source.rs +++ b/crates/opencode-client/src/models/agent_part_source.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,11 +23,6 @@ pub struct AgentPartSource { impl AgentPartSource { pub fn new(value: String, start: i32, end: i32) -> AgentPartSource { - AgentPartSource { - value, - start, - end, - } + AgentPartSource { value, start, end } } } - diff --git a/crates/opencode-client/src/models/agent_permission.rs b/crates/opencode-client/src/models/agent_permission.rs index 4a006d5..8d6d550 100644 --- a/crates/opencode-client/src/models/agent_permission.rs +++ b/crates/opencode-client/src/models/agent_permission.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,7 +39,7 @@ impl AgentPermission { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Edit { #[serde(rename = "ask")] @@ -55,7 +55,7 @@ impl Default for Edit { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Bash { #[serde(rename = "ask")] @@ -71,7 +71,7 @@ impl Default for Bash { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Skill { #[serde(rename = "ask")] @@ -87,7 +87,7 @@ impl Default for Skill { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Webfetch { #[serde(rename = "ask")] @@ -103,7 +103,7 @@ impl Default for Webfetch { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DoomLoop { #[serde(rename = "ask")] @@ -119,7 +119,7 @@ impl Default for DoomLoop { Self::Ask } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum ExternalDirectory { #[serde(rename = "ask")] @@ -135,4 +135,3 @@ impl Default for ExternalDirectory { Self::Ask } } - diff --git a/crates/opencode-client/src/models/api_auth.rs b/crates/opencode-client/src/models/api_auth.rs index ab03341..038cd4b 100644 --- a/crates/opencode-client/src/models/api_auth.rs +++ b/crates/opencode-client/src/models/api_auth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct ApiAuth { impl ApiAuth { pub fn new(r#type: Type, key: String) -> ApiAuth { - ApiAuth { - r#type, - key, - } + ApiAuth { r#type, key } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "api")] @@ -39,4 +36,3 @@ impl Default for Type { Self::Api } } - diff --git a/crates/opencode-client/src/models/api_error.rs b/crates/opencode-client/src/models/api_error.rs index fcbe3df..2c66717 100644 --- a/crates/opencode-client/src/models/api_error.rs +++ b/crates/opencode-client/src/models/api_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl ApiError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "APIError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::ApiError } } - diff --git a/crates/opencode-client/src/models/api_error_data.rs b/crates/opencode-client/src/models/api_error_data.rs index 45f796e..c2bb5ab 100644 --- a/crates/opencode-client/src/models/api_error_data.rs +++ b/crates/opencode-client/src/models/api_error_data.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,4 +39,3 @@ impl ApiErrorData { } } } - diff --git a/crates/opencode-client/src/models/app_log_request.rs b/crates/opencode-client/src/models/app_log_request.rs index 3ff249a..816ed25 100644 --- a/crates/opencode-client/src/models/app_log_request.rs +++ b/crates/opencode-client/src/models/app_log_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -55,4 +55,3 @@ impl Default for Level { Self::Debug } } - diff --git a/crates/opencode-client/src/models/assistant_message.rs b/crates/opencode-client/src/models/assistant_message.rs index 7b2c776..dfee8e9 100644 --- a/crates/opencode-client/src/models/assistant_message.rs +++ b/crates/opencode-client/src/models/assistant_message.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -46,7 +46,20 @@ pub struct AssistantMessage { } impl AssistantMessage { - pub fn new(id: String, session_id: String, role: Role, time: models::AssistantMessageTime, parent_id: String, model_id: String, provider_id: String, mode: String, agent: String, path: models::AssistantMessagePath, cost: f64, tokens: models::AssistantMessageTokens) -> AssistantMessage { + pub fn new( + id: String, + session_id: String, + role: Role, + time: models::AssistantMessageTime, + parent_id: String, + model_id: String, + provider_id: String, + mode: String, + agent: String, + path: models::AssistantMessagePath, + cost: f64, + tokens: models::AssistantMessageTokens, + ) -> AssistantMessage { AssistantMessage { id, session_id, @@ -66,7 +79,7 @@ impl AssistantMessage { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Role { #[serde(rename = "assistant")] @@ -78,4 +91,3 @@ impl Default for Role { Self::Assistant } } - diff --git a/crates/opencode-client/src/models/assistant_message_error.rs b/crates/opencode-client/src/models/assistant_message_error.rs index d924467..7096aea 100644 --- a/crates/opencode-client/src/models/assistant_message_error.rs +++ b/crates/opencode-client/src/models/assistant_message_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl AssistantMessageError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "APIError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::ApiError } } - diff --git a/crates/opencode-client/src/models/assistant_message_path.rs b/crates/opencode-client/src/models/assistant_message_path.rs index 250e2af..ab2d9f0 100644 --- a/crates/opencode-client/src/models/assistant_message_path.rs +++ b/crates/opencode-client/src/models/assistant_message_path.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct AssistantMessagePath { impl AssistantMessagePath { pub fn new(cwd: String, root: String) -> AssistantMessagePath { - AssistantMessagePath { - cwd, - root, - } + AssistantMessagePath { cwd, root } } } - diff --git a/crates/opencode-client/src/models/assistant_message_time.rs b/crates/opencode-client/src/models/assistant_message_time.rs index 32f8e0e..c0f49ae 100644 --- a/crates/opencode-client/src/models/assistant_message_time.rs +++ b/crates/opencode-client/src/models/assistant_message_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl AssistantMessageTime { } } } - diff --git a/crates/opencode-client/src/models/assistant_message_tokens.rs b/crates/opencode-client/src/models/assistant_message_tokens.rs index 4ff9185..f71e83e 100644 --- a/crates/opencode-client/src/models/assistant_message_tokens.rs +++ b/crates/opencode-client/src/models/assistant_message_tokens.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,7 +24,12 @@ pub struct AssistantMessageTokens { } impl AssistantMessageTokens { - pub fn new(input: f64, output: f64, reasoning: f64, cache: models::AssistantMessageTokensCache) -> AssistantMessageTokens { + pub fn new( + input: f64, + output: f64, + reasoning: f64, + cache: models::AssistantMessageTokensCache, + ) -> AssistantMessageTokens { AssistantMessageTokens { input, output, @@ -33,4 +38,3 @@ impl AssistantMessageTokens { } } } - diff --git a/crates/opencode-client/src/models/assistant_message_tokens_cache.rs b/crates/opencode-client/src/models/assistant_message_tokens_cache.rs index f470527..030fec1 100644 --- a/crates/opencode-client/src/models/assistant_message_tokens_cache.rs +++ b/crates/opencode-client/src/models/assistant_message_tokens_cache.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct AssistantMessageTokensCache { impl AssistantMessageTokensCache { pub fn new(read: f64, write: f64) -> AssistantMessageTokensCache { - AssistantMessageTokensCache { - read, - write, - } + AssistantMessageTokensCache { read, write } } } - diff --git a/crates/opencode-client/src/models/auth.rs b/crates/opencode-client/src/models/auth.rs index 3c94cd9..8c7bee0 100644 --- a/crates/opencode-client/src/models/auth.rs +++ b/crates/opencode-client/src/models/auth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,14 @@ pub struct Auth { } impl Auth { - pub fn new(r#type: Type, refresh: String, access: String, expires: f64, key: String, token: String) -> Auth { + pub fn new( + r#type: Type, + refresh: String, + access: String, + expires: f64, + key: String, + token: String, + ) -> Auth { Auth { r#type, refresh, @@ -42,7 +49,7 @@ impl Auth { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] @@ -58,4 +65,3 @@ impl Default for Type { Self::Oauth } } - diff --git a/crates/opencode-client/src/models/bad_request_error.rs b/crates/opencode-client/src/models/bad_request_error.rs index 7dfc848..963cce0 100644 --- a/crates/opencode-client/src/models/bad_request_error.rs +++ b/crates/opencode-client/src/models/bad_request_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct BadRequestError { } impl BadRequestError { - pub fn new(data: Option, errors: Vec>, success: Success) -> BadRequestError { + pub fn new( + data: Option, + errors: Vec>, + success: Success, + ) -> BadRequestError { BadRequestError { data, errors, @@ -30,7 +34,7 @@ impl BadRequestError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Success { #[serde(rename = "false")] @@ -42,4 +46,3 @@ impl Default for Success { Self::False } } - diff --git a/crates/opencode-client/src/models/command.rs b/crates/opencode-client/src/models/command.rs index c7ac19a..941fbba 100644 --- a/crates/opencode-client/src/models/command.rs +++ b/crates/opencode-client/src/models/command.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -42,4 +42,3 @@ impl Command { } } } - diff --git a/crates/opencode-client/src/models/command_template.rs b/crates/opencode-client/src/models/command_template.rs index 174ade6..033f999 100644 --- a/crates/opencode-client/src/models/command_template.rs +++ b/crates/opencode-client/src/models/command_template.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CommandTemplate { -} +pub struct CommandTemplate {} impl CommandTemplate { pub fn new() -> CommandTemplate { - CommandTemplate { - } + CommandTemplate {} } } - diff --git a/crates/opencode-client/src/models/compaction_part.rs b/crates/opencode-client/src/models/compaction_part.rs index 0bc3fb0..bd399b2 100644 --- a/crates/opencode-client/src/models/compaction_part.rs +++ b/crates/opencode-client/src/models/compaction_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct CompactionPart { } impl CompactionPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, auto: bool) -> CompactionPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + auto: bool, + ) -> CompactionPart { CompactionPart { id, session_id, @@ -36,7 +42,7 @@ impl CompactionPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "compaction")] @@ -48,4 +54,3 @@ impl Default for Type { Self::Compaction } } - diff --git a/crates/opencode-client/src/models/config.rs b/crates/opencode-client/src/models/config.rs index 876fbc9..9973a50 100644 --- a/crates/opencode-client/src/models/config.rs +++ b/crates/opencode-client/src/models/config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -147,4 +147,3 @@ impl Default for Share { Self::Manual } } - diff --git a/crates/opencode-client/src/models/config_agent.rs b/crates/opencode-client/src/models/config_agent.rs index 16321e2..8a77644 100644 --- a/crates/opencode-client/src/models/config_agent.rs +++ b/crates/opencode-client/src/models/config_agent.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -44,4 +44,3 @@ impl ConfigAgent { } } } - diff --git a/crates/opencode-client/src/models/config_autoupdate.rs b/crates/opencode-client/src/models/config_autoupdate.rs index 0024f1b..854cac5 100644 --- a/crates/opencode-client/src/models/config_autoupdate.rs +++ b/crates/opencode-client/src/models/config_autoupdate.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -13,14 +13,11 @@ use serde::{Deserialize, Serialize}; /// ConfigAutoupdate : Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ConfigAutoupdate { -} +pub struct ConfigAutoupdate {} impl ConfigAutoupdate { /// Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications pub fn new() -> ConfigAutoupdate { - ConfigAutoupdate { - } + ConfigAutoupdate {} } } - diff --git a/crates/opencode-client/src/models/config_command_value.rs b/crates/opencode-client/src/models/config_command_value.rs index 4d4a40f..f23b574 100644 --- a/crates/opencode-client/src/models/config_command_value.rs +++ b/crates/opencode-client/src/models/config_command_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,4 +36,3 @@ impl ConfigCommandValue { } } } - diff --git a/crates/opencode-client/src/models/config_compaction.rs b/crates/opencode-client/src/models/config_compaction.rs index 9051b03..fe30531 100644 --- a/crates/opencode-client/src/models/config_compaction.rs +++ b/crates/opencode-client/src/models/config_compaction.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -29,4 +29,3 @@ impl ConfigCompaction { } } } - diff --git a/crates/opencode-client/src/models/config_enterprise.rs b/crates/opencode-client/src/models/config_enterprise.rs index 192b3a6..d2b9fb7 100644 --- a/crates/opencode-client/src/models/config_enterprise.rs +++ b/crates/opencode-client/src/models/config_enterprise.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,9 +20,6 @@ pub struct ConfigEnterprise { impl ConfigEnterprise { pub fn new() -> ConfigEnterprise { - ConfigEnterprise { - url: None, - } + ConfigEnterprise { url: None } } } - diff --git a/crates/opencode-client/src/models/config_experimental.rs b/crates/opencode-client/src/models/config_experimental.rs index 2fb2baf..258e532 100644 --- a/crates/opencode-client/src/models/config_experimental.rs +++ b/crates/opencode-client/src/models/config_experimental.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,7 +18,10 @@ pub struct ConfigExperimental { /// Number of retries for chat completions on failure #[serde(rename = "chatMaxRetries", skip_serializing_if = "Option::is_none")] pub chat_max_retries: Option, - #[serde(rename = "disable_paste_summary", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "disable_paste_summary", + skip_serializing_if = "Option::is_none" + )] pub disable_paste_summary: Option, /// Enable the batch tool #[serde(rename = "batch_tool", skip_serializing_if = "Option::is_none")] @@ -30,7 +33,10 @@ pub struct ConfigExperimental { #[serde(rename = "primary_tools", skip_serializing_if = "Option::is_none")] pub primary_tools: Option>, /// Continue the agent loop when a tool call is denied - #[serde(rename = "continue_loop_on_deny", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "continue_loop_on_deny", + skip_serializing_if = "Option::is_none" + )] pub continue_loop_on_deny: Option, /// Timeout in milliseconds for model context protocol (MCP) requests #[serde(rename = "mcp_timeout", skip_serializing_if = "Option::is_none")] @@ -51,4 +57,3 @@ impl ConfigExperimental { } } } - diff --git a/crates/opencode-client/src/models/config_experimental_hook.rs b/crates/opencode-client/src/models/config_experimental_hook.rs index 69861fd..27ec62f 100644 --- a/crates/opencode-client/src/models/config_experimental_hook.rs +++ b/crates/opencode-client/src/models/config_experimental_hook.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -14,7 +14,9 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ConfigExperimentalHook { #[serde(rename = "file_edited", skip_serializing_if = "Option::is_none")] - pub file_edited: Option>>, + pub file_edited: Option< + std::collections::HashMap>, + >, #[serde(rename = "session_completed", skip_serializing_if = "Option::is_none")] pub session_completed: Option>, } @@ -27,4 +29,3 @@ impl ConfigExperimentalHook { } } } - diff --git a/crates/opencode-client/src/models/config_experimental_hook_file_edited_value_inner.rs b/crates/opencode-client/src/models/config_experimental_hook_file_edited_value_inner.rs index cf39444..979979c 100644 --- a/crates/opencode-client/src/models/config_experimental_hook_file_edited_value_inner.rs +++ b/crates/opencode-client/src/models/config_experimental_hook_file_edited_value_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl ConfigExperimentalHookFileEditedValueInner { } } } - diff --git a/crates/opencode-client/src/models/config_formatter.rs b/crates/opencode-client/src/models/config_formatter.rs index 5b4a031..f51ab4d 100644 --- a/crates/opencode-client/src/models/config_formatter.rs +++ b/crates/opencode-client/src/models/config_formatter.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ConfigFormatter { -} +pub struct ConfigFormatter {} impl ConfigFormatter { pub fn new() -> ConfigFormatter { - ConfigFormatter { - } + ConfigFormatter {} } } - diff --git a/crates/opencode-client/src/models/config_formatter_any_of_value.rs b/crates/opencode-client/src/models/config_formatter_any_of_value.rs index 267fc81..215ef1b 100644 --- a/crates/opencode-client/src/models/config_formatter_any_of_value.rs +++ b/crates/opencode-client/src/models/config_formatter_any_of_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,4 +33,3 @@ impl ConfigFormatterAnyOfValue { } } } - diff --git a/crates/opencode-client/src/models/config_lsp.rs b/crates/opencode-client/src/models/config_lsp.rs index 33fee06..06db476 100644 --- a/crates/opencode-client/src/models/config_lsp.rs +++ b/crates/opencode-client/src/models/config_lsp.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ConfigLsp { -} +pub struct ConfigLsp {} impl ConfigLsp { pub fn new() -> ConfigLsp { - ConfigLsp { - } + ConfigLsp {} } } - diff --git a/crates/opencode-client/src/models/config_lsp_any_of_value.rs b/crates/opencode-client/src/models/config_lsp_any_of_value.rs index d006a1b..3d4cca0 100644 --- a/crates/opencode-client/src/models/config_lsp_any_of_value.rs +++ b/crates/opencode-client/src/models/config_lsp_any_of_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,4 +36,3 @@ impl ConfigLspAnyOfValue { } } } - diff --git a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs index f822eca..0a64ba4 100644 --- a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs +++ b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ConfigLspAnyOfValueAnyOf { impl ConfigLspAnyOfValueAnyOf { pub fn new(disabled: Disabled) -> ConfigLspAnyOfValueAnyOf { - ConfigLspAnyOfValueAnyOf { - disabled, - } + ConfigLspAnyOfValueAnyOf { disabled } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Disabled { #[serde(rename = "true")] @@ -36,4 +34,3 @@ impl Default for Disabled { Self::True } } - diff --git a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of_1.rs b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of_1.rs index ef46d47..85a81d5 100644 --- a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of_1.rs +++ b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of_1.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,4 +36,3 @@ impl ConfigLspAnyOfValueAnyOf1 { } } } - diff --git a/crates/opencode-client/src/models/config_mode.rs b/crates/opencode-client/src/models/config_mode.rs index 603836f..4dc4d98 100644 --- a/crates/opencode-client/src/models/config_mode.rs +++ b/crates/opencode-client/src/models/config_mode.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -29,4 +29,3 @@ impl ConfigMode { } } } - diff --git a/crates/opencode-client/src/models/config_providers_200_response.rs b/crates/opencode-client/src/models/config_providers_200_response.rs index 9a1048e..238d20d 100644 --- a/crates/opencode-client/src/models/config_providers_200_response.rs +++ b/crates/opencode-client/src/models/config_providers_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,11 +20,10 @@ pub struct ConfigProviders200Response { } impl ConfigProviders200Response { - pub fn new(providers: Vec, default: std::collections::HashMap) -> ConfigProviders200Response { - ConfigProviders200Response { - providers, - default, - } + pub fn new( + providers: Vec, + default: std::collections::HashMap, + ) -> ConfigProviders200Response { + ConfigProviders200Response { providers, default } } } - diff --git a/crates/opencode-client/src/models/config_tui.rs b/crates/opencode-client/src/models/config_tui.rs index 607fd21..3dff4f5 100644 --- a/crates/opencode-client/src/models/config_tui.rs +++ b/crates/opencode-client/src/models/config_tui.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,7 +17,10 @@ pub struct ConfigTui { /// TUI scroll speed #[serde(rename = "scroll_speed", skip_serializing_if = "Option::is_none")] pub scroll_speed: Option, - #[serde(rename = "scroll_acceleration", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "scroll_acceleration", + skip_serializing_if = "Option::is_none" + )] pub scroll_acceleration: Option>, /// Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column #[serde(rename = "diff_style", skip_serializing_if = "Option::is_none")] @@ -48,4 +51,3 @@ impl Default for DiffStyle { Self::Auto } } - diff --git a/crates/opencode-client/src/models/config_tui_scroll_acceleration.rs b/crates/opencode-client/src/models/config_tui_scroll_acceleration.rs index 5a88bd0..087b009 100644 --- a/crates/opencode-client/src/models/config_tui_scroll_acceleration.rs +++ b/crates/opencode-client/src/models/config_tui_scroll_acceleration.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct ConfigTuiScrollAcceleration { impl ConfigTuiScrollAcceleration { /// Scroll acceleration settings pub fn new(enabled: bool) -> ConfigTuiScrollAcceleration { - ConfigTuiScrollAcceleration { - enabled, - } + ConfigTuiScrollAcceleration { enabled } } } - diff --git a/crates/opencode-client/src/models/config_watcher.rs b/crates/opencode-client/src/models/config_watcher.rs index 22f60c3..a5325de 100644 --- a/crates/opencode-client/src/models/config_watcher.rs +++ b/crates/opencode-client/src/models/config_watcher.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct ConfigWatcher { impl ConfigWatcher { pub fn new() -> ConfigWatcher { - ConfigWatcher { - ignore: None, - } + ConfigWatcher { ignore: None } } } - diff --git a/crates/opencode-client/src/models/event.rs b/crates/opencode-client/src/models/event.rs index 90ea08b..f58fbed 100644 --- a/crates/opencode-client/src/models/event.rs +++ b/crates/opencode-client/src/models/event.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct Event { impl Event { pub fn new(r#type: Type, properties: serde_json::Value) -> Event { - Event { - r#type, - properties, - } + Event { r#type, properties } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] @@ -107,4 +104,3 @@ impl Default for Type { Self::TuiPromptAppend } } - diff --git a/crates/opencode-client/src/models/event_command_executed.rs b/crates/opencode-client/src/models/event_command_executed.rs index 18f1b7f..9dbf084 100644 --- a/crates/opencode-client/src/models/event_command_executed.rs +++ b/crates/opencode-client/src/models/event_command_executed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventCommandExecuted { } impl EventCommandExecuted { - pub fn new(r#type: Type, properties: models::EventCommandExecutedProperties) -> EventCommandExecuted { + pub fn new( + r#type: Type, + properties: models::EventCommandExecutedProperties, + ) -> EventCommandExecuted { EventCommandExecuted { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "command.executed")] @@ -39,4 +42,3 @@ impl Default for Type { Self::CommandExecuted } } - diff --git a/crates/opencode-client/src/models/event_command_executed_properties.rs b/crates/opencode-client/src/models/event_command_executed_properties.rs index 72458f2..01bb1c3 100644 --- a/crates/opencode-client/src/models/event_command_executed_properties.rs +++ b/crates/opencode-client/src/models/event_command_executed_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,7 +24,12 @@ pub struct EventCommandExecutedProperties { } impl EventCommandExecutedProperties { - pub fn new(name: String, session_id: String, arguments: String, message_id: String) -> EventCommandExecutedProperties { + pub fn new( + name: String, + session_id: String, + arguments: String, + message_id: String, + ) -> EventCommandExecutedProperties { EventCommandExecutedProperties { name, session_id, @@ -33,4 +38,3 @@ impl EventCommandExecutedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_file_edited.rs b/crates/opencode-client/src/models/event_file_edited.rs index edbfecc..591c1d8 100644 --- a/crates/opencode-client/src/models/event_file_edited.rs +++ b/crates/opencode-client/src/models/event_file_edited.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventFileEdited { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file.edited")] @@ -39,4 +39,3 @@ impl Default for Type { Self::FileEdited } } - diff --git a/crates/opencode-client/src/models/event_file_edited_properties.rs b/crates/opencode-client/src/models/event_file_edited_properties.rs index 89c2910..47975d3 100644 --- a/crates/opencode-client/src/models/event_file_edited_properties.rs +++ b/crates/opencode-client/src/models/event_file_edited_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventFileEditedProperties { impl EventFileEditedProperties { pub fn new(file: String) -> EventFileEditedProperties { - EventFileEditedProperties { - file, - } + EventFileEditedProperties { file } } } - diff --git a/crates/opencode-client/src/models/event_file_watcher_updated.rs b/crates/opencode-client/src/models/event_file_watcher_updated.rs index 09768ac..76d1de8 100644 --- a/crates/opencode-client/src/models/event_file_watcher_updated.rs +++ b/crates/opencode-client/src/models/event_file_watcher_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventFileWatcherUpdated { } impl EventFileWatcherUpdated { - pub fn new(r#type: Type, properties: models::EventFileWatcherUpdatedProperties) -> EventFileWatcherUpdated { + pub fn new( + r#type: Type, + properties: models::EventFileWatcherUpdatedProperties, + ) -> EventFileWatcherUpdated { EventFileWatcherUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file.watcher.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::FileWatcherUpdated } } - diff --git a/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs b/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs index 9c9f6bb..0a264f7 100644 --- a/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs +++ b/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct EventFileWatcherUpdatedProperties { impl EventFileWatcherUpdatedProperties { pub fn new(file: String, event: Event) -> EventFileWatcherUpdatedProperties { - EventFileWatcherUpdatedProperties { - file, - event, - } + EventFileWatcherUpdatedProperties { file, event } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Event { #[serde(rename = "add")] @@ -43,4 +40,3 @@ impl Default for Event { Self::Add } } - diff --git a/crates/opencode-client/src/models/event_global_disposed.rs b/crates/opencode-client/src/models/event_global_disposed.rs index 9f3b711..4bdcd51 100644 --- a/crates/opencode-client/src/models/event_global_disposed.rs +++ b/crates/opencode-client/src/models/event_global_disposed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct EventGlobalDisposed { impl EventGlobalDisposed { pub fn new(r#type: Type, properties: serde_json::Value) -> EventGlobalDisposed { - EventGlobalDisposed { - r#type, - properties, - } + EventGlobalDisposed { r#type, properties } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "global.disposed")] @@ -39,4 +36,3 @@ impl Default for Type { Self::GlobalDisposed } } - diff --git a/crates/opencode-client/src/models/event_installation_update_available.rs b/crates/opencode-client/src/models/event_installation_update_available.rs index f017bbb..0fb21ae 100644 --- a/crates/opencode-client/src/models/event_installation_update_available.rs +++ b/crates/opencode-client/src/models/event_installation_update_available.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventInstallationUpdateAvailable { } impl EventInstallationUpdateAvailable { - pub fn new(r#type: Type, properties: models::EventInstallationUpdatedProperties) -> EventInstallationUpdateAvailable { + pub fn new( + r#type: Type, + properties: models::EventInstallationUpdatedProperties, + ) -> EventInstallationUpdateAvailable { EventInstallationUpdateAvailable { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "installation.update-available")] @@ -39,4 +42,3 @@ impl Default for Type { Self::InstallationUpdateAvailable } } - diff --git a/crates/opencode-client/src/models/event_installation_updated.rs b/crates/opencode-client/src/models/event_installation_updated.rs index ecce206..3603b58 100644 --- a/crates/opencode-client/src/models/event_installation_updated.rs +++ b/crates/opencode-client/src/models/event_installation_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventInstallationUpdated { } impl EventInstallationUpdated { - pub fn new(r#type: Type, properties: models::EventInstallationUpdatedProperties) -> EventInstallationUpdated { + pub fn new( + r#type: Type, + properties: models::EventInstallationUpdatedProperties, + ) -> EventInstallationUpdated { EventInstallationUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "installation.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::InstallationUpdated } } - diff --git a/crates/opencode-client/src/models/event_installation_updated_properties.rs b/crates/opencode-client/src/models/event_installation_updated_properties.rs index a02c0a3..4b24db1 100644 --- a/crates/opencode-client/src/models/event_installation_updated_properties.rs +++ b/crates/opencode-client/src/models/event_installation_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventInstallationUpdatedProperties { impl EventInstallationUpdatedProperties { pub fn new(version: String) -> EventInstallationUpdatedProperties { - EventInstallationUpdatedProperties { - version, - } + EventInstallationUpdatedProperties { version } } } - diff --git a/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs b/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs index 57ab0e1..2cb6eb6 100644 --- a/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs +++ b/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventLspClientDiagnostics { } impl EventLspClientDiagnostics { - pub fn new(r#type: Type, properties: models::EventLspClientDiagnosticsProperties) -> EventLspClientDiagnostics { + pub fn new( + r#type: Type, + properties: models::EventLspClientDiagnosticsProperties, + ) -> EventLspClientDiagnostics { EventLspClientDiagnostics { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "lsp.client.diagnostics")] @@ -39,4 +42,3 @@ impl Default for Type { Self::LspClientDiagnostics } } - diff --git a/crates/opencode-client/src/models/event_lsp_client_diagnostics_properties.rs b/crates/opencode-client/src/models/event_lsp_client_diagnostics_properties.rs index f11030d..3df6309 100644 --- a/crates/opencode-client/src/models/event_lsp_client_diagnostics_properties.rs +++ b/crates/opencode-client/src/models/event_lsp_client_diagnostics_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct EventLspClientDiagnosticsProperties { impl EventLspClientDiagnosticsProperties { pub fn new(server_id: String, path: String) -> EventLspClientDiagnosticsProperties { - EventLspClientDiagnosticsProperties { - server_id, - path, - } + EventLspClientDiagnosticsProperties { server_id, path } } } - diff --git a/crates/opencode-client/src/models/event_lsp_updated.rs b/crates/opencode-client/src/models/event_lsp_updated.rs index 3b0d123..42f569c 100644 --- a/crates/opencode-client/src/models/event_lsp_updated.rs +++ b/crates/opencode-client/src/models/event_lsp_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct EventLspUpdated { impl EventLspUpdated { pub fn new(r#type: Type, properties: serde_json::Value) -> EventLspUpdated { - EventLspUpdated { - r#type, - properties, - } + EventLspUpdated { r#type, properties } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "lsp.updated")] @@ -39,4 +36,3 @@ impl Default for Type { Self::LspUpdated } } - diff --git a/crates/opencode-client/src/models/event_mcp_tools_changed.rs b/crates/opencode-client/src/models/event_mcp_tools_changed.rs index 11d546c..91ac361 100644 --- a/crates/opencode-client/src/models/event_mcp_tools_changed.rs +++ b/crates/opencode-client/src/models/event_mcp_tools_changed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventMcpToolsChanged { } impl EventMcpToolsChanged { - pub fn new(r#type: Type, properties: models::EventMcpToolsChangedProperties) -> EventMcpToolsChanged { + pub fn new( + r#type: Type, + properties: models::EventMcpToolsChangedProperties, + ) -> EventMcpToolsChanged { EventMcpToolsChanged { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "mcp.tools.changed")] @@ -39,4 +42,3 @@ impl Default for Type { Self::McpToolsChanged } } - diff --git a/crates/opencode-client/src/models/event_mcp_tools_changed_properties.rs b/crates/opencode-client/src/models/event_mcp_tools_changed_properties.rs index 6215f32..2c41997 100644 --- a/crates/opencode-client/src/models/event_mcp_tools_changed_properties.rs +++ b/crates/opencode-client/src/models/event_mcp_tools_changed_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventMcpToolsChangedProperties { impl EventMcpToolsChangedProperties { pub fn new(server: String) -> EventMcpToolsChangedProperties { - EventMcpToolsChangedProperties { - server, - } + EventMcpToolsChangedProperties { server } } } - diff --git a/crates/opencode-client/src/models/event_message_part_removed.rs b/crates/opencode-client/src/models/event_message_part_removed.rs index 04013b2..7b783e7 100644 --- a/crates/opencode-client/src/models/event_message_part_removed.rs +++ b/crates/opencode-client/src/models/event_message_part_removed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventMessagePartRemoved { } impl EventMessagePartRemoved { - pub fn new(r#type: Type, properties: models::EventMessagePartRemovedProperties) -> EventMessagePartRemoved { + pub fn new( + r#type: Type, + properties: models::EventMessagePartRemovedProperties, + ) -> EventMessagePartRemoved { EventMessagePartRemoved { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.part.removed")] @@ -39,4 +42,3 @@ impl Default for Type { Self::MessagePartRemoved } } - diff --git a/crates/opencode-client/src/models/event_message_part_removed_properties.rs b/crates/opencode-client/src/models/event_message_part_removed_properties.rs index 4914b84..2f03562 100644 --- a/crates/opencode-client/src/models/event_message_part_removed_properties.rs +++ b/crates/opencode-client/src/models/event_message_part_removed_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct EventMessagePartRemovedProperties { } impl EventMessagePartRemovedProperties { - pub fn new(session_id: String, message_id: String, part_id: String) -> EventMessagePartRemovedProperties { + pub fn new( + session_id: String, + message_id: String, + part_id: String, + ) -> EventMessagePartRemovedProperties { EventMessagePartRemovedProperties { session_id, message_id, @@ -30,4 +34,3 @@ impl EventMessagePartRemovedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_message_part_updated.rs b/crates/opencode-client/src/models/event_message_part_updated.rs index e9d89c3..59ad886 100644 --- a/crates/opencode-client/src/models/event_message_part_updated.rs +++ b/crates/opencode-client/src/models/event_message_part_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventMessagePartUpdated { } impl EventMessagePartUpdated { - pub fn new(r#type: Type, properties: models::EventMessagePartUpdatedProperties) -> EventMessagePartUpdated { + pub fn new( + r#type: Type, + properties: models::EventMessagePartUpdatedProperties, + ) -> EventMessagePartUpdated { EventMessagePartUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.part.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::MessagePartUpdated } } - diff --git a/crates/opencode-client/src/models/event_message_part_updated_properties.rs b/crates/opencode-client/src/models/event_message_part_updated_properties.rs index a7ecdb9..a09c49c 100644 --- a/crates/opencode-client/src/models/event_message_part_updated_properties.rs +++ b/crates/opencode-client/src/models/event_message_part_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl EventMessagePartUpdatedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_message_removed.rs b/crates/opencode-client/src/models/event_message_removed.rs index b00ce5f..e724039 100644 --- a/crates/opencode-client/src/models/event_message_removed.rs +++ b/crates/opencode-client/src/models/event_message_removed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventMessageRemoved { } impl EventMessageRemoved { - pub fn new(r#type: Type, properties: models::EventMessageRemovedProperties) -> EventMessageRemoved { + pub fn new( + r#type: Type, + properties: models::EventMessageRemovedProperties, + ) -> EventMessageRemoved { EventMessageRemoved { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.removed")] @@ -39,4 +42,3 @@ impl Default for Type { Self::MessageRemoved } } - diff --git a/crates/opencode-client/src/models/event_message_removed_properties.rs b/crates/opencode-client/src/models/event_message_removed_properties.rs index c0e34ae..0793245 100644 --- a/crates/opencode-client/src/models/event_message_removed_properties.rs +++ b/crates/opencode-client/src/models/event_message_removed_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl EventMessageRemovedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_message_updated.rs b/crates/opencode-client/src/models/event_message_updated.rs index abdd3ca..a83e080 100644 --- a/crates/opencode-client/src/models/event_message_updated.rs +++ b/crates/opencode-client/src/models/event_message_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventMessageUpdated { } impl EventMessageUpdated { - pub fn new(r#type: Type, properties: models::EventMessageUpdatedProperties) -> EventMessageUpdated { + pub fn new( + r#type: Type, + properties: models::EventMessageUpdatedProperties, + ) -> EventMessageUpdated { EventMessageUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::MessageUpdated } } - diff --git a/crates/opencode-client/src/models/event_message_updated_properties.rs b/crates/opencode-client/src/models/event_message_updated_properties.rs index a216ff3..e18cc69 100644 --- a/crates/opencode-client/src/models/event_message_updated_properties.rs +++ b/crates/opencode-client/src/models/event_message_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,4 +24,3 @@ impl EventMessageUpdatedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_permission_replied.rs b/crates/opencode-client/src/models/event_permission_replied.rs index 2930219..d3f8cd0 100644 --- a/crates/opencode-client/src/models/event_permission_replied.rs +++ b/crates/opencode-client/src/models/event_permission_replied.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventPermissionReplied { } impl EventPermissionReplied { - pub fn new(r#type: Type, properties: models::EventPermissionRepliedProperties) -> EventPermissionReplied { + pub fn new( + r#type: Type, + properties: models::EventPermissionRepliedProperties, + ) -> EventPermissionReplied { EventPermissionReplied { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "permission.replied")] @@ -39,4 +42,3 @@ impl Default for Type { Self::PermissionReplied } } - diff --git a/crates/opencode-client/src/models/event_permission_replied_properties.rs b/crates/opencode-client/src/models/event_permission_replied_properties.rs index ee4e714..f175656 100644 --- a/crates/opencode-client/src/models/event_permission_replied_properties.rs +++ b/crates/opencode-client/src/models/event_permission_replied_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct EventPermissionRepliedProperties { } impl EventPermissionRepliedProperties { - pub fn new(session_id: String, permission_id: String, response: String) -> EventPermissionRepliedProperties { + pub fn new( + session_id: String, + permission_id: String, + response: String, + ) -> EventPermissionRepliedProperties { EventPermissionRepliedProperties { session_id, permission_id, @@ -30,4 +34,3 @@ impl EventPermissionRepliedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_permission_updated.rs b/crates/opencode-client/src/models/event_permission_updated.rs index c0d7f3b..f03f503 100644 --- a/crates/opencode-client/src/models/event_permission_updated.rs +++ b/crates/opencode-client/src/models/event_permission_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventPermissionUpdated { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "permission.updated")] @@ -39,4 +39,3 @@ impl Default for Type { Self::PermissionUpdated } } - diff --git a/crates/opencode-client/src/models/event_project_updated.rs b/crates/opencode-client/src/models/event_project_updated.rs index bcc8244..0770bac 100644 --- a/crates/opencode-client/src/models/event_project_updated.rs +++ b/crates/opencode-client/src/models/event_project_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventProjectUpdated { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "project.updated")] @@ -39,4 +39,3 @@ impl Default for Type { Self::ProjectUpdated } } - diff --git a/crates/opencode-client/src/models/event_pty_created.rs b/crates/opencode-client/src/models/event_pty_created.rs index 05dc8fe..7ab356e 100644 --- a/crates/opencode-client/src/models/event_pty_created.rs +++ b/crates/opencode-client/src/models/event_pty_created.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventPtyCreated { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.created")] @@ -39,4 +39,3 @@ impl Default for Type { Self::PtyCreated } } - diff --git a/crates/opencode-client/src/models/event_pty_created_properties.rs b/crates/opencode-client/src/models/event_pty_created_properties.rs index 5586d1d..2e7c818 100644 --- a/crates/opencode-client/src/models/event_pty_created_properties.rs +++ b/crates/opencode-client/src/models/event_pty_created_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,4 +24,3 @@ impl EventPtyCreatedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_pty_deleted.rs b/crates/opencode-client/src/models/event_pty_deleted.rs index 22e2c84..5c4a731 100644 --- a/crates/opencode-client/src/models/event_pty_deleted.rs +++ b/crates/opencode-client/src/models/event_pty_deleted.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventPtyDeleted { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.deleted")] @@ -39,4 +39,3 @@ impl Default for Type { Self::PtyDeleted } } - diff --git a/crates/opencode-client/src/models/event_pty_deleted_properties.rs b/crates/opencode-client/src/models/event_pty_deleted_properties.rs index c68d879..cc05d3c 100644 --- a/crates/opencode-client/src/models/event_pty_deleted_properties.rs +++ b/crates/opencode-client/src/models/event_pty_deleted_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventPtyDeletedProperties { impl EventPtyDeletedProperties { pub fn new(id: String) -> EventPtyDeletedProperties { - EventPtyDeletedProperties { - id, - } + EventPtyDeletedProperties { id } } } - diff --git a/crates/opencode-client/src/models/event_pty_exited.rs b/crates/opencode-client/src/models/event_pty_exited.rs index 5171c89..bd5c1a0 100644 --- a/crates/opencode-client/src/models/event_pty_exited.rs +++ b/crates/opencode-client/src/models/event_pty_exited.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventPtyExited { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.exited")] @@ -39,4 +39,3 @@ impl Default for Type { Self::PtyExited } } - diff --git a/crates/opencode-client/src/models/event_pty_exited_properties.rs b/crates/opencode-client/src/models/event_pty_exited_properties.rs index 2d80d3a..e989cec 100644 --- a/crates/opencode-client/src/models/event_pty_exited_properties.rs +++ b/crates/opencode-client/src/models/event_pty_exited_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct EventPtyExitedProperties { impl EventPtyExitedProperties { pub fn new(id: String, exit_code: f64) -> EventPtyExitedProperties { - EventPtyExitedProperties { - id, - exit_code, - } + EventPtyExitedProperties { id, exit_code } } } - diff --git a/crates/opencode-client/src/models/event_pty_updated.rs b/crates/opencode-client/src/models/event_pty_updated.rs index b0ebbef..8fd8291 100644 --- a/crates/opencode-client/src/models/event_pty_updated.rs +++ b/crates/opencode-client/src/models/event_pty_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventPtyUpdated { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.updated")] @@ -39,4 +39,3 @@ impl Default for Type { Self::PtyUpdated } } - diff --git a/crates/opencode-client/src/models/event_server_connected.rs b/crates/opencode-client/src/models/event_server_connected.rs index ea8f5ec..ac28f01 100644 --- a/crates/opencode-client/src/models/event_server_connected.rs +++ b/crates/opencode-client/src/models/event_server_connected.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct EventServerConnected { impl EventServerConnected { pub fn new(r#type: Type, properties: serde_json::Value) -> EventServerConnected { - EventServerConnected { - r#type, - properties, - } + EventServerConnected { r#type, properties } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "server.connected")] @@ -39,4 +36,3 @@ impl Default for Type { Self::ServerConnected } } - diff --git a/crates/opencode-client/src/models/event_server_instance_disposed.rs b/crates/opencode-client/src/models/event_server_instance_disposed.rs index b8dc74a..7956a8c 100644 --- a/crates/opencode-client/src/models/event_server_instance_disposed.rs +++ b/crates/opencode-client/src/models/event_server_instance_disposed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventServerInstanceDisposed { } impl EventServerInstanceDisposed { - pub fn new(r#type: Type, properties: models::EventServerInstanceDisposedProperties) -> EventServerInstanceDisposed { + pub fn new( + r#type: Type, + properties: models::EventServerInstanceDisposedProperties, + ) -> EventServerInstanceDisposed { EventServerInstanceDisposed { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "server.instance.disposed")] @@ -39,4 +42,3 @@ impl Default for Type { Self::ServerInstanceDisposed } } - diff --git a/crates/opencode-client/src/models/event_server_instance_disposed_properties.rs b/crates/opencode-client/src/models/event_server_instance_disposed_properties.rs index d298e41..10ed510 100644 --- a/crates/opencode-client/src/models/event_server_instance_disposed_properties.rs +++ b/crates/opencode-client/src/models/event_server_instance_disposed_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventServerInstanceDisposedProperties { impl EventServerInstanceDisposedProperties { pub fn new(directory: String) -> EventServerInstanceDisposedProperties { - EventServerInstanceDisposedProperties { - directory, - } + EventServerInstanceDisposedProperties { directory } } } - diff --git a/crates/opencode-client/src/models/event_session_compacted.rs b/crates/opencode-client/src/models/event_session_compacted.rs index 3ce59e4..b774b4b 100644 --- a/crates/opencode-client/src/models/event_session_compacted.rs +++ b/crates/opencode-client/src/models/event_session_compacted.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventSessionCompacted { } impl EventSessionCompacted { - pub fn new(r#type: Type, properties: models::EventSessionIdleProperties) -> EventSessionCompacted { + pub fn new( + r#type: Type, + properties: models::EventSessionIdleProperties, + ) -> EventSessionCompacted { EventSessionCompacted { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.compacted")] @@ -39,4 +42,3 @@ impl Default for Type { Self::SessionCompacted } } - diff --git a/crates/opencode-client/src/models/event_session_created.rs b/crates/opencode-client/src/models/event_session_created.rs index cef8242..e2c0ebb 100644 --- a/crates/opencode-client/src/models/event_session_created.rs +++ b/crates/opencode-client/src/models/event_session_created.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventSessionCreated { } impl EventSessionCreated { - pub fn new(r#type: Type, properties: models::EventSessionCreatedProperties) -> EventSessionCreated { + pub fn new( + r#type: Type, + properties: models::EventSessionCreatedProperties, + ) -> EventSessionCreated { EventSessionCreated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.created")] @@ -39,4 +42,3 @@ impl Default for Type { Self::SessionCreated } } - diff --git a/crates/opencode-client/src/models/event_session_created_properties.rs b/crates/opencode-client/src/models/event_session_created_properties.rs index 673d010..82e3e51 100644 --- a/crates/opencode-client/src/models/event_session_created_properties.rs +++ b/crates/opencode-client/src/models/event_session_created_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,4 +24,3 @@ impl EventSessionCreatedProperties { } } } - diff --git a/crates/opencode-client/src/models/event_session_deleted.rs b/crates/opencode-client/src/models/event_session_deleted.rs index 098dfaf..8c5322d 100644 --- a/crates/opencode-client/src/models/event_session_deleted.rs +++ b/crates/opencode-client/src/models/event_session_deleted.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventSessionDeleted { } impl EventSessionDeleted { - pub fn new(r#type: Type, properties: models::EventSessionCreatedProperties) -> EventSessionDeleted { + pub fn new( + r#type: Type, + properties: models::EventSessionCreatedProperties, + ) -> EventSessionDeleted { EventSessionDeleted { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.deleted")] @@ -39,4 +42,3 @@ impl Default for Type { Self::SessionDeleted } } - diff --git a/crates/opencode-client/src/models/event_session_diff.rs b/crates/opencode-client/src/models/event_session_diff.rs index 6895b1e..f77d493 100644 --- a/crates/opencode-client/src/models/event_session_diff.rs +++ b/crates/opencode-client/src/models/event_session_diff.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventSessionDiff { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.diff")] @@ -39,4 +39,3 @@ impl Default for Type { Self::SessionDiff } } - diff --git a/crates/opencode-client/src/models/event_session_diff_properties.rs b/crates/opencode-client/src/models/event_session_diff_properties.rs index b414c46..6683000 100644 --- a/crates/opencode-client/src/models/event_session_diff_properties.rs +++ b/crates/opencode-client/src/models/event_session_diff_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct EventSessionDiffProperties { impl EventSessionDiffProperties { pub fn new(session_id: String, diff: Vec) -> EventSessionDiffProperties { - EventSessionDiffProperties { - session_id, - diff, - } + EventSessionDiffProperties { session_id, diff } } } - diff --git a/crates/opencode-client/src/models/event_session_error.rs b/crates/opencode-client/src/models/event_session_error.rs index 17c8592..4ed7831 100644 --- a/crates/opencode-client/src/models/event_session_error.rs +++ b/crates/opencode-client/src/models/event_session_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventSessionError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.error")] @@ -39,4 +39,3 @@ impl Default for Type { Self::SessionError } } - diff --git a/crates/opencode-client/src/models/event_session_error_properties.rs b/crates/opencode-client/src/models/event_session_error_properties.rs index 1cf209a..8498ef5 100644 --- a/crates/opencode-client/src/models/event_session_error_properties.rs +++ b/crates/opencode-client/src/models/event_session_error_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl EventSessionErrorProperties { } } } - diff --git a/crates/opencode-client/src/models/event_session_idle.rs b/crates/opencode-client/src/models/event_session_idle.rs index bf87813..c5b4120 100644 --- a/crates/opencode-client/src/models/event_session_idle.rs +++ b/crates/opencode-client/src/models/event_session_idle.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventSessionIdle { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.idle")] @@ -39,4 +39,3 @@ impl Default for Type { Self::SessionIdle } } - diff --git a/crates/opencode-client/src/models/event_session_idle_properties.rs b/crates/opencode-client/src/models/event_session_idle_properties.rs index e3ea8c5..0e7af15 100644 --- a/crates/opencode-client/src/models/event_session_idle_properties.rs +++ b/crates/opencode-client/src/models/event_session_idle_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventSessionIdleProperties { impl EventSessionIdleProperties { pub fn new(session_id: String) -> EventSessionIdleProperties { - EventSessionIdleProperties { - session_id, - } + EventSessionIdleProperties { session_id } } } - diff --git a/crates/opencode-client/src/models/event_session_status.rs b/crates/opencode-client/src/models/event_session_status.rs index 5bc59f6..25ad80b 100644 --- a/crates/opencode-client/src/models/event_session_status.rs +++ b/crates/opencode-client/src/models/event_session_status.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventSessionStatus { } impl EventSessionStatus { - pub fn new(r#type: Type, properties: models::EventSessionStatusProperties) -> EventSessionStatus { + pub fn new( + r#type: Type, + properties: models::EventSessionStatusProperties, + ) -> EventSessionStatus { EventSessionStatus { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.status")] @@ -39,4 +42,3 @@ impl Default for Type { Self::SessionStatus } } - diff --git a/crates/opencode-client/src/models/event_session_status_properties.rs b/crates/opencode-client/src/models/event_session_status_properties.rs index de9eeef..7b1dd31 100644 --- a/crates/opencode-client/src/models/event_session_status_properties.rs +++ b/crates/opencode-client/src/models/event_session_status_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl EventSessionStatusProperties { } } } - diff --git a/crates/opencode-client/src/models/event_session_updated.rs b/crates/opencode-client/src/models/event_session_updated.rs index 95cadb7..43d0bfd 100644 --- a/crates/opencode-client/src/models/event_session_updated.rs +++ b/crates/opencode-client/src/models/event_session_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventSessionUpdated { } impl EventSessionUpdated { - pub fn new(r#type: Type, properties: models::EventSessionCreatedProperties) -> EventSessionUpdated { + pub fn new( + r#type: Type, + properties: models::EventSessionCreatedProperties, + ) -> EventSessionUpdated { EventSessionUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::SessionUpdated } } - diff --git a/crates/opencode-client/src/models/event_todo_updated.rs b/crates/opencode-client/src/models/event_todo_updated.rs index 8dc99f4..2f6c8f9 100644 --- a/crates/opencode-client/src/models/event_todo_updated.rs +++ b/crates/opencode-client/src/models/event_todo_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventTodoUpdated { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "todo.updated")] @@ -39,4 +39,3 @@ impl Default for Type { Self::TodoUpdated } } - diff --git a/crates/opencode-client/src/models/event_todo_updated_properties.rs b/crates/opencode-client/src/models/event_todo_updated_properties.rs index 41d4799..de47cad 100644 --- a/crates/opencode-client/src/models/event_todo_updated_properties.rs +++ b/crates/opencode-client/src/models/event_todo_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct EventTodoUpdatedProperties { impl EventTodoUpdatedProperties { pub fn new(session_id: String, todos: Vec) -> EventTodoUpdatedProperties { - EventTodoUpdatedProperties { - session_id, - todos, - } + EventTodoUpdatedProperties { session_id, todos } } } - diff --git a/crates/opencode-client/src/models/event_tui_command_execute.rs b/crates/opencode-client/src/models/event_tui_command_execute.rs index a904f11..37951aa 100644 --- a/crates/opencode-client/src/models/event_tui_command_execute.rs +++ b/crates/opencode-client/src/models/event_tui_command_execute.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventTuiCommandExecute { } impl EventTuiCommandExecute { - pub fn new(r#type: Type, properties: models::EventTuiCommandExecuteProperties) -> EventTuiCommandExecute { + pub fn new( + r#type: Type, + properties: models::EventTuiCommandExecuteProperties, + ) -> EventTuiCommandExecute { EventTuiCommandExecute { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.command.execute")] @@ -39,4 +42,3 @@ impl Default for Type { Self::TuiCommandExecute } } - diff --git a/crates/opencode-client/src/models/event_tui_command_execute_properties.rs b/crates/opencode-client/src/models/event_tui_command_execute_properties.rs index eea3d29..a079a24 100644 --- a/crates/opencode-client/src/models/event_tui_command_execute_properties.rs +++ b/crates/opencode-client/src/models/event_tui_command_execute_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,10 +18,11 @@ pub struct EventTuiCommandExecuteProperties { } impl EventTuiCommandExecuteProperties { - pub fn new(command: models::EventTuiCommandExecutePropertiesCommand) -> EventTuiCommandExecuteProperties { + pub fn new( + command: models::EventTuiCommandExecutePropertiesCommand, + ) -> EventTuiCommandExecuteProperties { EventTuiCommandExecuteProperties { command: Box::new(command), } } } - diff --git a/crates/opencode-client/src/models/event_tui_command_execute_properties_command.rs b/crates/opencode-client/src/models/event_tui_command_execute_properties_command.rs index 19e86be..a1294c7 100644 --- a/crates/opencode-client/src/models/event_tui_command_execute_properties_command.rs +++ b/crates/opencode-client/src/models/event_tui_command_execute_properties_command.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EventTuiCommandExecutePropertiesCommand { -} +pub struct EventTuiCommandExecutePropertiesCommand {} impl EventTuiCommandExecutePropertiesCommand { pub fn new() -> EventTuiCommandExecutePropertiesCommand { - EventTuiCommandExecutePropertiesCommand { - } + EventTuiCommandExecutePropertiesCommand {} } } - diff --git a/crates/opencode-client/src/models/event_tui_prompt_append.rs b/crates/opencode-client/src/models/event_tui_prompt_append.rs index a880b9e..6235ff1 100644 --- a/crates/opencode-client/src/models/event_tui_prompt_append.rs +++ b/crates/opencode-client/src/models/event_tui_prompt_append.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventTuiPromptAppend { } impl EventTuiPromptAppend { - pub fn new(r#type: Type, properties: models::FindText200ResponseInnerPath) -> EventTuiPromptAppend { + pub fn new( + r#type: Type, + properties: models::FindText200ResponseInnerPath, + ) -> EventTuiPromptAppend { EventTuiPromptAppend { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] @@ -39,4 +42,3 @@ impl Default for Type { Self::TuiPromptAppend } } - diff --git a/crates/opencode-client/src/models/event_tui_toast_show.rs b/crates/opencode-client/src/models/event_tui_toast_show.rs index 999ab7c..f121d0c 100644 --- a/crates/opencode-client/src/models/event_tui_toast_show.rs +++ b/crates/opencode-client/src/models/event_tui_toast_show.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl EventTuiToastShow { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.toast.show")] @@ -39,4 +39,3 @@ impl Default for Type { Self::TuiToastShow } } - diff --git a/crates/opencode-client/src/models/event_vcs_branch_updated.rs b/crates/opencode-client/src/models/event_vcs_branch_updated.rs index 4d1fcba..474ca60 100644 --- a/crates/opencode-client/src/models/event_vcs_branch_updated.rs +++ b/crates/opencode-client/src/models/event_vcs_branch_updated.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,17 @@ pub struct EventVcsBranchUpdated { } impl EventVcsBranchUpdated { - pub fn new(r#type: Type, properties: models::EventVcsBranchUpdatedProperties) -> EventVcsBranchUpdated { + pub fn new( + r#type: Type, + properties: models::EventVcsBranchUpdatedProperties, + ) -> EventVcsBranchUpdated { EventVcsBranchUpdated { r#type, properties: Box::new(properties), } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "vcs.branch.updated")] @@ -39,4 +42,3 @@ impl Default for Type { Self::VcsBranchUpdated } } - diff --git a/crates/opencode-client/src/models/event_vcs_branch_updated_properties.rs b/crates/opencode-client/src/models/event_vcs_branch_updated_properties.rs index e33ec4a..b8aa001 100644 --- a/crates/opencode-client/src/models/event_vcs_branch_updated_properties.rs +++ b/crates/opencode-client/src/models/event_vcs_branch_updated_properties.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct EventVcsBranchUpdatedProperties { impl EventVcsBranchUpdatedProperties { pub fn new() -> EventVcsBranchUpdatedProperties { - EventVcsBranchUpdatedProperties { - branch: None, - } + EventVcsBranchUpdatedProperties { branch: None } } } - diff --git a/crates/opencode-client/src/models/file.rs b/crates/opencode-client/src/models/file.rs index 06c002c..0ef5722 100644 --- a/crates/opencode-client/src/models/file.rs +++ b/crates/opencode-client/src/models/file.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,7 +33,7 @@ impl File { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "added")] @@ -49,4 +49,3 @@ impl Default for Status { Self::Added } } - diff --git a/crates/opencode-client/src/models/file_content.rs b/crates/opencode-client/src/models/file_content.rs index 7938f8c..180673b 100644 --- a/crates/opencode-client/src/models/file_content.rs +++ b/crates/opencode-client/src/models/file_content.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,7 +39,7 @@ impl FileContent { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] @@ -51,7 +51,7 @@ impl Default for Type { Self::Text } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Encoding { #[serde(rename = "base64")] @@ -63,4 +63,3 @@ impl Default for Encoding { Self::Base64 } } - diff --git a/crates/opencode-client/src/models/file_content_patch.rs b/crates/opencode-client/src/models/file_content_patch.rs index cfc5a1b..06fa89d 100644 --- a/crates/opencode-client/src/models/file_content_patch.rs +++ b/crates/opencode-client/src/models/file_content_patch.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,11 @@ pub struct FileContentPatch { } impl FileContentPatch { - pub fn new(old_file_name: String, new_file_name: String, hunks: Vec) -> FileContentPatch { + pub fn new( + old_file_name: String, + new_file_name: String, + hunks: Vec, + ) -> FileContentPatch { FileContentPatch { old_file_name, new_file_name, @@ -39,4 +43,3 @@ impl FileContentPatch { } } } - diff --git a/crates/opencode-client/src/models/file_content_patch_hunks_inner.rs b/crates/opencode-client/src/models/file_content_patch_hunks_inner.rs index 68dd648..3ebbd9f 100644 --- a/crates/opencode-client/src/models/file_content_patch_hunks_inner.rs +++ b/crates/opencode-client/src/models/file_content_patch_hunks_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct FileContentPatchHunksInner { } impl FileContentPatchHunksInner { - pub fn new(old_start: f64, old_lines: f64, new_start: f64, new_lines: f64, lines: Vec) -> FileContentPatchHunksInner { + pub fn new( + old_start: f64, + old_lines: f64, + new_start: f64, + new_lines: f64, + lines: Vec, + ) -> FileContentPatchHunksInner { FileContentPatchHunksInner { old_start, old_lines, @@ -36,4 +42,3 @@ impl FileContentPatchHunksInner { } } } - diff --git a/crates/opencode-client/src/models/file_diff.rs b/crates/opencode-client/src/models/file_diff.rs index 3d8fe13..79abbd4 100644 --- a/crates/opencode-client/src/models/file_diff.rs +++ b/crates/opencode-client/src/models/file_diff.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct FileDiff { } impl FileDiff { - pub fn new(file: String, before: String, after: String, additions: f64, deletions: f64) -> FileDiff { + pub fn new( + file: String, + before: String, + after: String, + additions: f64, + deletions: f64, + ) -> FileDiff { FileDiff { file, before, @@ -36,4 +42,3 @@ impl FileDiff { } } } - diff --git a/crates/opencode-client/src/models/file_node.rs b/crates/opencode-client/src/models/file_node.rs index 941f558..6eff903 100644 --- a/crates/opencode-client/src/models/file_node.rs +++ b/crates/opencode-client/src/models/file_node.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct FileNode { } impl FileNode { - pub fn new(name: String, path: String, absolute: String, r#type: Type, ignored: bool) -> FileNode { + pub fn new( + name: String, + path: String, + absolute: String, + r#type: Type, + ignored: bool, + ) -> FileNode { FileNode { name, path, @@ -36,7 +42,7 @@ impl FileNode { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] @@ -50,4 +56,3 @@ impl Default for Type { Self::File } } - diff --git a/crates/opencode-client/src/models/file_part.rs b/crates/opencode-client/src/models/file_part.rs index a290a15..5ff6f17 100644 --- a/crates/opencode-client/src/models/file_part.rs +++ b/crates/opencode-client/src/models/file_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -32,7 +32,14 @@ pub struct FilePart { } impl FilePart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, mime: String, url: String) -> FilePart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + mime: String, + url: String, + ) -> FilePart { FilePart { id, session_id, @@ -45,7 +52,7 @@ impl FilePart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] @@ -57,4 +64,3 @@ impl Default for Type { Self::File } } - diff --git a/crates/opencode-client/src/models/file_part_input.rs b/crates/opencode-client/src/models/file_part_input.rs index a9952ef..0ae3e7a 100644 --- a/crates/opencode-client/src/models/file_part_input.rs +++ b/crates/opencode-client/src/models/file_part_input.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,7 +39,7 @@ impl FilePartInput { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] @@ -51,4 +51,3 @@ impl Default for Type { Self::File } } - diff --git a/crates/opencode-client/src/models/file_part_source.rs b/crates/opencode-client/src/models/file_part_source.rs index fcfacbd..df69908 100644 --- a/crates/opencode-client/src/models/file_part_source.rs +++ b/crates/opencode-client/src/models/file_part_source.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,14 @@ pub struct FilePartSource { } impl FilePartSource { - pub fn new(text: models::FilePartSourceText, r#type: Type, path: String, range: models::Range, name: String, kind: i32) -> FilePartSource { + pub fn new( + text: models::FilePartSourceText, + r#type: Type, + path: String, + range: models::Range, + name: String, + kind: i32, + ) -> FilePartSource { FilePartSource { text: Box::new(text), r#type, @@ -39,7 +46,7 @@ impl FilePartSource { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] @@ -53,4 +60,3 @@ impl Default for Type { Self::File } } - diff --git a/crates/opencode-client/src/models/file_part_source_text.rs b/crates/opencode-client/src/models/file_part_source_text.rs index 1c1cc6e..b7f0ebc 100644 --- a/crates/opencode-client/src/models/file_part_source_text.rs +++ b/crates/opencode-client/src/models/file_part_source_text.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,11 +23,6 @@ pub struct FilePartSourceText { impl FilePartSourceText { pub fn new(value: String, start: i32, end: i32) -> FilePartSourceText { - FilePartSourceText { - value, - start, - end, - } + FilePartSourceText { value, start, end } } } - diff --git a/crates/opencode-client/src/models/file_source.rs b/crates/opencode-client/src/models/file_source.rs index 6eb96f7..aaf21b1 100644 --- a/crates/opencode-client/src/models/file_source.rs +++ b/crates/opencode-client/src/models/file_source.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,7 @@ impl FileSource { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] @@ -42,4 +42,3 @@ impl Default for Type { Self::File } } - diff --git a/crates/opencode-client/src/models/find_text_200_response_inner.rs b/crates/opencode-client/src/models/find_text_200_response_inner.rs index 6ad2586..a41967f 100644 --- a/crates/opencode-client/src/models/find_text_200_response_inner.rs +++ b/crates/opencode-client/src/models/find_text_200_response_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct FindText200ResponseInner { } impl FindText200ResponseInner { - pub fn new(path: models::FindText200ResponseInnerPath, lines: models::FindText200ResponseInnerPath, line_number: f64, absolute_offset: f64, submatches: Vec) -> FindText200ResponseInner { + pub fn new( + path: models::FindText200ResponseInnerPath, + lines: models::FindText200ResponseInnerPath, + line_number: f64, + absolute_offset: f64, + submatches: Vec, + ) -> FindText200ResponseInner { FindText200ResponseInner { path: Box::new(path), lines: Box::new(lines), @@ -36,4 +42,3 @@ impl FindText200ResponseInner { } } } - diff --git a/crates/opencode-client/src/models/find_text_200_response_inner_path.rs b/crates/opencode-client/src/models/find_text_200_response_inner_path.rs index df33e19..cd0c927 100644 --- a/crates/opencode-client/src/models/find_text_200_response_inner_path.rs +++ b/crates/opencode-client/src/models/find_text_200_response_inner_path.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct FindText200ResponseInnerPath { impl FindText200ResponseInnerPath { pub fn new(text: String) -> FindText200ResponseInnerPath { - FindText200ResponseInnerPath { - text, - } + FindText200ResponseInnerPath { text } } } - diff --git a/crates/opencode-client/src/models/find_text_200_response_inner_submatches_inner.rs b/crates/opencode-client/src/models/find_text_200_response_inner_submatches_inner.rs index f7a9680..baf41af 100644 --- a/crates/opencode-client/src/models/find_text_200_response_inner_submatches_inner.rs +++ b/crates/opencode-client/src/models/find_text_200_response_inner_submatches_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct FindText200ResponseInnerSubmatchesInner { } impl FindText200ResponseInnerSubmatchesInner { - pub fn new(r#match: models::FindText200ResponseInnerPath, start: f64, end: f64) -> FindText200ResponseInnerSubmatchesInner { + pub fn new( + r#match: models::FindText200ResponseInnerPath, + start: f64, + end: f64, + ) -> FindText200ResponseInnerSubmatchesInner { FindText200ResponseInnerSubmatchesInner { r#match: Box::new(r#match), start, @@ -30,4 +34,3 @@ impl FindText200ResponseInnerSubmatchesInner { } } } - diff --git a/crates/opencode-client/src/models/formatter_status.rs b/crates/opencode-client/src/models/formatter_status.rs index 59d0808..fd6df31 100644 --- a/crates/opencode-client/src/models/formatter_status.rs +++ b/crates/opencode-client/src/models/formatter_status.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl FormatterStatus { } } } - diff --git a/crates/opencode-client/src/models/global_event.rs b/crates/opencode-client/src/models/global_event.rs index aa9d564..730c3c1 100644 --- a/crates/opencode-client/src/models/global_event.rs +++ b/crates/opencode-client/src/models/global_event.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl GlobalEvent { } } } - diff --git a/crates/opencode-client/src/models/global_health_200_response.rs b/crates/opencode-client/src/models/global_health_200_response.rs index 85811f1..6b5f825 100644 --- a/crates/opencode-client/src/models/global_health_200_response.rs +++ b/crates/opencode-client/src/models/global_health_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct GlobalHealth200Response { impl GlobalHealth200Response { pub fn new(healthy: Healthy, version: String) -> GlobalHealth200Response { - GlobalHealth200Response { - healthy, - version, - } + GlobalHealth200Response { healthy, version } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Healthy { #[serde(rename = "true")] @@ -39,4 +36,3 @@ impl Default for Healthy { Self::True } } - diff --git a/crates/opencode-client/src/models/keybinds_config.rs b/crates/opencode-client/src/models/keybinds_config.rs index 711b45c..5f750ec 100644 --- a/crates/opencode-client/src/models/keybinds_config.rs +++ b/crates/opencode-client/src/models/keybinds_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -75,10 +75,16 @@ pub struct KeybindsConfig { #[serde(rename = "messages_page_down", skip_serializing_if = "Option::is_none")] pub messages_page_down: Option, /// Scroll messages up by half page - #[serde(rename = "messages_half_page_up", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "messages_half_page_up", + skip_serializing_if = "Option::is_none" + )] pub messages_half_page_up: Option, /// Scroll messages down by half page - #[serde(rename = "messages_half_page_down", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "messages_half_page_down", + skip_serializing_if = "Option::is_none" + )] pub messages_half_page_down: Option, /// Navigate to first message #[serde(rename = "messages_first", skip_serializing_if = "Option::is_none")] @@ -105,7 +111,10 @@ pub struct KeybindsConfig { #[serde(rename = "messages_redo", skip_serializing_if = "Option::is_none")] pub messages_redo: Option, /// Toggle code block concealment in messages - #[serde(rename = "messages_toggle_conceal", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "messages_toggle_conceal", + skip_serializing_if = "Option::is_none" + )] pub messages_toggle_conceal: Option, /// Toggle tool details visibility #[serde(rename = "tool_details", skip_serializing_if = "Option::is_none")] @@ -117,13 +126,22 @@ pub struct KeybindsConfig { #[serde(rename = "model_cycle_recent", skip_serializing_if = "Option::is_none")] pub model_cycle_recent: Option, /// Previous recently used model - #[serde(rename = "model_cycle_recent_reverse", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "model_cycle_recent_reverse", + skip_serializing_if = "Option::is_none" + )] pub model_cycle_recent_reverse: Option, /// Next favorite model - #[serde(rename = "model_cycle_favorite", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "model_cycle_favorite", + skip_serializing_if = "Option::is_none" + )] pub model_cycle_favorite: Option, /// Previous favorite model - #[serde(rename = "model_cycle_favorite_reverse", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "model_cycle_favorite_reverse", + skip_serializing_if = "Option::is_none" + )] pub model_cycle_favorite_reverse: Option, /// List available commands #[serde(rename = "command_list", skip_serializing_if = "Option::is_none")] @@ -135,7 +153,10 @@ pub struct KeybindsConfig { #[serde(rename = "agent_cycle", skip_serializing_if = "Option::is_none")] pub agent_cycle: Option, /// Previous agent - #[serde(rename = "agent_cycle_reverse", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "agent_cycle_reverse", + skip_serializing_if = "Option::is_none" + )] pub agent_cycle_reverse: Option, /// Cycle model variants #[serde(rename = "variant_cycle", skip_serializing_if = "Option::is_none")] @@ -183,22 +204,40 @@ pub struct KeybindsConfig { #[serde(rename = "input_line_end", skip_serializing_if = "Option::is_none")] pub input_line_end: Option, /// Select to start of line in input - #[serde(rename = "input_select_line_home", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_line_home", + skip_serializing_if = "Option::is_none" + )] pub input_select_line_home: Option, /// Select to end of line in input - #[serde(rename = "input_select_line_end", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_line_end", + skip_serializing_if = "Option::is_none" + )] pub input_select_line_end: Option, /// Move to start of visual line in input - #[serde(rename = "input_visual_line_home", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_visual_line_home", + skip_serializing_if = "Option::is_none" + )] pub input_visual_line_home: Option, /// Move to end of visual line in input - #[serde(rename = "input_visual_line_end", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_visual_line_end", + skip_serializing_if = "Option::is_none" + )] pub input_visual_line_end: Option, /// Select to start of visual line in input - #[serde(rename = "input_select_visual_line_home", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_visual_line_home", + skip_serializing_if = "Option::is_none" + )] pub input_select_visual_line_home: Option, /// Select to end of visual line in input - #[serde(rename = "input_select_visual_line_end", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_visual_line_end", + skip_serializing_if = "Option::is_none" + )] pub input_select_visual_line_end: Option, /// Move to start of buffer in input #[serde(rename = "input_buffer_home", skip_serializing_if = "Option::is_none")] @@ -207,19 +246,31 @@ pub struct KeybindsConfig { #[serde(rename = "input_buffer_end", skip_serializing_if = "Option::is_none")] pub input_buffer_end: Option, /// Select to start of buffer in input - #[serde(rename = "input_select_buffer_home", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_buffer_home", + skip_serializing_if = "Option::is_none" + )] pub input_select_buffer_home: Option, /// Select to end of buffer in input - #[serde(rename = "input_select_buffer_end", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_buffer_end", + skip_serializing_if = "Option::is_none" + )] pub input_select_buffer_end: Option, /// Delete line in input #[serde(rename = "input_delete_line", skip_serializing_if = "Option::is_none")] pub input_delete_line: Option, /// Delete to end of line in input - #[serde(rename = "input_delete_to_line_end", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_delete_to_line_end", + skip_serializing_if = "Option::is_none" + )] pub input_delete_to_line_end: Option, /// Delete to start of line in input - #[serde(rename = "input_delete_to_line_start", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_delete_to_line_start", + skip_serializing_if = "Option::is_none" + )] pub input_delete_to_line_start: Option, /// Backspace in input #[serde(rename = "input_backspace", skip_serializing_if = "Option::is_none")] @@ -237,19 +288,34 @@ pub struct KeybindsConfig { #[serde(rename = "input_word_forward", skip_serializing_if = "Option::is_none")] pub input_word_forward: Option, /// Move word backward in input - #[serde(rename = "input_word_backward", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_word_backward", + skip_serializing_if = "Option::is_none" + )] pub input_word_backward: Option, /// Select word forward in input - #[serde(rename = "input_select_word_forward", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_word_forward", + skip_serializing_if = "Option::is_none" + )] pub input_select_word_forward: Option, /// Select word backward in input - #[serde(rename = "input_select_word_backward", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_select_word_backward", + skip_serializing_if = "Option::is_none" + )] pub input_select_word_backward: Option, /// Delete word forward in input - #[serde(rename = "input_delete_word_forward", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_delete_word_forward", + skip_serializing_if = "Option::is_none" + )] pub input_delete_word_forward: Option, /// Delete word backward in input - #[serde(rename = "input_delete_word_backward", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "input_delete_word_backward", + skip_serializing_if = "Option::is_none" + )] pub input_delete_word_backward: Option, /// Previous history item #[serde(rename = "history_previous", skip_serializing_if = "Option::is_none")] @@ -258,10 +324,16 @@ pub struct KeybindsConfig { #[serde(rename = "history_next", skip_serializing_if = "Option::is_none")] pub history_next: Option, /// Next child session - #[serde(rename = "session_child_cycle", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "session_child_cycle", + skip_serializing_if = "Option::is_none" + )] pub session_child_cycle: Option, /// Previous child session - #[serde(rename = "session_child_cycle_reverse", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "session_child_cycle_reverse", + skip_serializing_if = "Option::is_none" + )] pub session_child_cycle_reverse: Option, /// Go to parent session #[serde(rename = "session_parent", skip_serializing_if = "Option::is_none")] @@ -270,7 +342,10 @@ pub struct KeybindsConfig { #[serde(rename = "terminal_suspend", skip_serializing_if = "Option::is_none")] pub terminal_suspend: Option, /// Toggle terminal title - #[serde(rename = "terminal_title_toggle", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "terminal_title_toggle", + skip_serializing_if = "Option::is_none" + )] pub terminal_title_toggle: Option, /// Toggle tips on home screen #[serde(rename = "tips_toggle", skip_serializing_if = "Option::is_none")] @@ -371,4 +446,3 @@ impl KeybindsConfig { } } } - diff --git a/crates/opencode-client/src/models/layout_config.rs b/crates/opencode-client/src/models/layout_config.rs index eb80109..f875aca 100644 --- a/crates/opencode-client/src/models/layout_config.rs +++ b/crates/opencode-client/src/models/layout_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,7 +19,6 @@ pub enum LayoutConfig { Auto, #[serde(rename = "stretch")] Stretch, - } impl std::fmt::Display for LayoutConfig { @@ -36,4 +35,3 @@ impl Default for LayoutConfig { Self::Auto } } - diff --git a/crates/opencode-client/src/models/log_level.rs b/crates/opencode-client/src/models/log_level.rs index 77d7129..859a1e1 100644 --- a/crates/opencode-client/src/models/log_level.rs +++ b/crates/opencode-client/src/models/log_level.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,7 +23,6 @@ pub enum LogLevel { Warn, #[serde(rename = "ERROR")] Error, - } impl std::fmt::Display for LogLevel { @@ -42,4 +41,3 @@ impl Default for LogLevel { Self::Debug } } - diff --git a/crates/opencode-client/src/models/lsp_status.rs b/crates/opencode-client/src/models/lsp_status.rs index e940227..3a75f53 100644 --- a/crates/opencode-client/src/models/lsp_status.rs +++ b/crates/opencode-client/src/models/lsp_status.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,7 +33,7 @@ impl LspStatus { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "connected")] @@ -47,4 +47,3 @@ impl Default for Status { Self::Connected } } - diff --git a/crates/opencode-client/src/models/mcp_add_request.rs b/crates/opencode-client/src/models/mcp_add_request.rs index 832c79a..f21d284 100644 --- a/crates/opencode-client/src/models/mcp_add_request.rs +++ b/crates/opencode-client/src/models/mcp_add_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl McpAddRequest { } } } - diff --git a/crates/opencode-client/src/models/mcp_add_request_config.rs b/crates/opencode-client/src/models/mcp_add_request_config.rs index fdd8ead..1a8e431 100644 --- a/crates/opencode-client/src/models/mcp_add_request_config.rs +++ b/crates/opencode-client/src/models/mcp_add_request_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -80,4 +80,3 @@ impl Default for Type { Self::Local } } - diff --git a/crates/opencode-client/src/models/mcp_auth_callback_request.rs b/crates/opencode-client/src/models/mcp_auth_callback_request.rs index 694cad1..bb68146 100644 --- a/crates/opencode-client/src/models/mcp_auth_callback_request.rs +++ b/crates/opencode-client/src/models/mcp_auth_callback_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,9 +20,6 @@ pub struct McpAuthCallbackRequest { impl McpAuthCallbackRequest { pub fn new(code: String) -> McpAuthCallbackRequest { - McpAuthCallbackRequest { - code, - } + McpAuthCallbackRequest { code } } } - diff --git a/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs b/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs index 6b902ce..9fe3158 100644 --- a/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs +++ b/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct McpAuthRemove200Response { impl McpAuthRemove200Response { pub fn new(success: Success) -> McpAuthRemove200Response { - McpAuthRemove200Response { - success, - } + McpAuthRemove200Response { success } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Success { #[serde(rename = "true")] @@ -36,4 +34,3 @@ impl Default for Success { Self::True } } - diff --git a/crates/opencode-client/src/models/mcp_auth_start_200_response.rs b/crates/opencode-client/src/models/mcp_auth_start_200_response.rs index d2360d2..a2c2afb 100644 --- a/crates/opencode-client/src/models/mcp_auth_start_200_response.rs +++ b/crates/opencode-client/src/models/mcp_auth_start_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,9 +20,6 @@ pub struct McpAuthStart200Response { impl McpAuthStart200Response { pub fn new(authorization_url: String) -> McpAuthStart200Response { - McpAuthStart200Response { - authorization_url, - } + McpAuthStart200Response { authorization_url } } } - diff --git a/crates/opencode-client/src/models/mcp_local_config.rs b/crates/opencode-client/src/models/mcp_local_config.rs index 2315283..a0d7b61 100644 --- a/crates/opencode-client/src/models/mcp_local_config.rs +++ b/crates/opencode-client/src/models/mcp_local_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -53,4 +53,3 @@ impl Default for Type { Self::Local } } - diff --git a/crates/opencode-client/src/models/mcp_o_auth_config.rs b/crates/opencode-client/src/models/mcp_o_auth_config.rs index fdb139a..e794671 100644 --- a/crates/opencode-client/src/models/mcp_o_auth_config.rs +++ b/crates/opencode-client/src/models/mcp_o_auth_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,4 +33,3 @@ impl McpOAuthConfig { } } } - diff --git a/crates/opencode-client/src/models/mcp_remote_config.rs b/crates/opencode-client/src/models/mcp_remote_config.rs index 8c01b8a..0dd6064 100644 --- a/crates/opencode-client/src/models/mcp_remote_config.rs +++ b/crates/opencode-client/src/models/mcp_remote_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -56,4 +56,3 @@ impl Default for Type { Self::Remote } } - diff --git a/crates/opencode-client/src/models/mcp_remote_config_oauth.rs b/crates/opencode-client/src/models/mcp_remote_config_oauth.rs index 46bcae2..8fdf1a9 100644 --- a/crates/opencode-client/src/models/mcp_remote_config_oauth.rs +++ b/crates/opencode-client/src/models/mcp_remote_config_oauth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -35,4 +35,3 @@ impl McpRemoteConfigOauth { } } } - diff --git a/crates/opencode-client/src/models/mcp_status.rs b/crates/opencode-client/src/models/mcp_status.rs index 5a1a72f..bd19252 100644 --- a/crates/opencode-client/src/models/mcp_status.rs +++ b/crates/opencode-client/src/models/mcp_status.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -48,4 +48,3 @@ impl Default for Status { Self::Connected } } - diff --git a/crates/opencode-client/src/models/mcp_status_connected.rs b/crates/opencode-client/src/models/mcp_status_connected.rs index 15b1003..b10be3c 100644 --- a/crates/opencode-client/src/models/mcp_status_connected.rs +++ b/crates/opencode-client/src/models/mcp_status_connected.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct McpStatusConnected { impl McpStatusConnected { pub fn new(status: Status) -> McpStatusConnected { - McpStatusConnected { - status, - } + McpStatusConnected { status } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "connected")] @@ -36,4 +34,3 @@ impl Default for Status { Self::Connected } } - diff --git a/crates/opencode-client/src/models/mcp_status_disabled.rs b/crates/opencode-client/src/models/mcp_status_disabled.rs index 404ca91..00438a5 100644 --- a/crates/opencode-client/src/models/mcp_status_disabled.rs +++ b/crates/opencode-client/src/models/mcp_status_disabled.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct McpStatusDisabled { impl McpStatusDisabled { pub fn new(status: Status) -> McpStatusDisabled { - McpStatusDisabled { - status, - } + McpStatusDisabled { status } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "disabled")] @@ -36,4 +34,3 @@ impl Default for Status { Self::Disabled } } - diff --git a/crates/opencode-client/src/models/mcp_status_failed.rs b/crates/opencode-client/src/models/mcp_status_failed.rs index b177d5f..6688ed4 100644 --- a/crates/opencode-client/src/models/mcp_status_failed.rs +++ b/crates/opencode-client/src/models/mcp_status_failed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct McpStatusFailed { impl McpStatusFailed { pub fn new(status: Status, error: String) -> McpStatusFailed { - McpStatusFailed { - status, - error, - } + McpStatusFailed { status, error } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "failed")] @@ -39,4 +36,3 @@ impl Default for Status { Self::Failed } } - diff --git a/crates/opencode-client/src/models/mcp_status_needs_auth.rs b/crates/opencode-client/src/models/mcp_status_needs_auth.rs index 422b91a..ef3c312 100644 --- a/crates/opencode-client/src/models/mcp_status_needs_auth.rs +++ b/crates/opencode-client/src/models/mcp_status_needs_auth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct McpStatusNeedsAuth { impl McpStatusNeedsAuth { pub fn new(status: Status) -> McpStatusNeedsAuth { - McpStatusNeedsAuth { - status, - } + McpStatusNeedsAuth { status } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "needs_auth")] @@ -36,4 +34,3 @@ impl Default for Status { Self::NeedsAuth } } - diff --git a/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs b/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs index 7de56b9..09b9a1e 100644 --- a/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs +++ b/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct McpStatusNeedsClientRegistration { impl McpStatusNeedsClientRegistration { pub fn new(status: Status, error: String) -> McpStatusNeedsClientRegistration { - McpStatusNeedsClientRegistration { - status, - error, - } + McpStatusNeedsClientRegistration { status, error } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "needs_client_registration")] @@ -39,4 +36,3 @@ impl Default for Status { Self::NeedsClientRegistration } } - diff --git a/crates/opencode-client/src/models/message.rs b/crates/opencode-client/src/models/message.rs index da8b7b7..bb28df7 100644 --- a/crates/opencode-client/src/models/message.rs +++ b/crates/opencode-client/src/models/message.rs @@ -41,7 +41,11 @@ pub struct Message { pub parent_id: Option, #[serde(rename = "modelID", default, skip_serializing_if = "Option::is_none")] pub model_id: Option, - #[serde(rename = "providerID", default, skip_serializing_if = "Option::is_none")] + #[serde( + rename = "providerID", + default, + skip_serializing_if = "Option::is_none" + )] pub provider_id: Option, #[serde(rename = "mode", default, skip_serializing_if = "Option::is_none")] pub mode: Option, @@ -81,7 +85,9 @@ impl Message { } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default)] +#[derive( + Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default, +)] pub enum Role { #[default] #[serde(rename = "user")] diff --git a/crates/opencode-client/src/models/message_aborted_error.rs b/crates/opencode-client/src/models/message_aborted_error.rs index 20d1b72..4bdc60e 100644 --- a/crates/opencode-client/src/models/message_aborted_error.rs +++ b/crates/opencode-client/src/models/message_aborted_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl MessageAbortedError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "MessageAbortedError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::MessageAbortedError } } - diff --git a/crates/opencode-client/src/models/message_output_length_error.rs b/crates/opencode-client/src/models/message_output_length_error.rs index 82ea07a..befb6d1 100644 --- a/crates/opencode-client/src/models/message_output_length_error.rs +++ b/crates/opencode-client/src/models/message_output_length_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct MessageOutputLengthError { impl MessageOutputLengthError { pub fn new(name: Name, data: serde_json::Value) -> MessageOutputLengthError { - MessageOutputLengthError { - name, - data, - } + MessageOutputLengthError { name, data } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "MessageOutputLengthError")] @@ -39,4 +36,3 @@ impl Default for Name { Self::MessageOutputLengthError } } - diff --git a/crates/opencode-client/src/models/model.rs b/crates/opencode-client/src/models/model.rs index 45f5b50..5e2c93d 100644 --- a/crates/opencode-client/src/models/model.rs +++ b/crates/opencode-client/src/models/model.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -38,11 +38,25 @@ pub struct Model { #[serde(rename = "release_date")] pub release_date: String, #[serde(rename = "variants", skip_serializing_if = "Option::is_none")] - pub variants: Option>>, + pub variants: Option< + std::collections::HashMap>, + >, } impl Model { - pub fn new(id: String, provider_id: String, api: models::ModelApi, name: String, capabilities: models::ModelCapabilities, cost: models::ModelCost, limit: models::ProviderList200ResponseAllInnerModelsValueLimit, status: Status, options: std::collections::HashMap, headers: std::collections::HashMap, release_date: String) -> Model { + pub fn new( + id: String, + provider_id: String, + api: models::ModelApi, + name: String, + capabilities: models::ModelCapabilities, + cost: models::ModelCost, + limit: models::ProviderList200ResponseAllInnerModelsValueLimit, + status: Status, + options: std::collections::HashMap, + headers: std::collections::HashMap, + release_date: String, + ) -> Model { Model { id, provider_id, @@ -60,7 +74,7 @@ impl Model { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] @@ -78,4 +92,3 @@ impl Default for Status { Self::Alpha } } - diff --git a/crates/opencode-client/src/models/model_api.rs b/crates/opencode-client/src/models/model_api.rs index cca01fa..1865f23 100644 --- a/crates/opencode-client/src/models/model_api.rs +++ b/crates/opencode-client/src/models/model_api.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,11 +23,6 @@ pub struct ModelApi { impl ModelApi { pub fn new(id: String, url: String, npm: String) -> ModelApi { - ModelApi { - id, - url, - npm, - } + ModelApi { id, url, npm } } } - diff --git a/crates/opencode-client/src/models/model_capabilities.rs b/crates/opencode-client/src/models/model_capabilities.rs index 9193cb2..bd74d12 100644 --- a/crates/opencode-client/src/models/model_capabilities.rs +++ b/crates/opencode-client/src/models/model_capabilities.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,15 @@ pub struct ModelCapabilities { } impl ModelCapabilities { - pub fn new(temperature: bool, reasoning: bool, attachment: bool, toolcall: bool, input: models::ModelCapabilitiesInput, output: models::ModelCapabilitiesInput, interleaved: models::ModelCapabilitiesInterleaved) -> ModelCapabilities { + pub fn new( + temperature: bool, + reasoning: bool, + attachment: bool, + toolcall: bool, + input: models::ModelCapabilitiesInput, + output: models::ModelCapabilitiesInput, + interleaved: models::ModelCapabilitiesInterleaved, + ) -> ModelCapabilities { ModelCapabilities { temperature, reasoning, @@ -42,4 +50,3 @@ impl ModelCapabilities { } } } - diff --git a/crates/opencode-client/src/models/model_capabilities_input.rs b/crates/opencode-client/src/models/model_capabilities_input.rs index 40f2800..697a992 100644 --- a/crates/opencode-client/src/models/model_capabilities_input.rs +++ b/crates/opencode-client/src/models/model_capabilities_input.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct ModelCapabilitiesInput { } impl ModelCapabilitiesInput { - pub fn new(text: bool, audio: bool, image: bool, video: bool, pdf: bool) -> ModelCapabilitiesInput { + pub fn new( + text: bool, + audio: bool, + image: bool, + video: bool, + pdf: bool, + ) -> ModelCapabilitiesInput { ModelCapabilitiesInput { text, audio, @@ -36,4 +42,3 @@ impl ModelCapabilitiesInput { } } } - diff --git a/crates/opencode-client/src/models/model_capabilities_interleaved.rs b/crates/opencode-client/src/models/model_capabilities_interleaved.rs index ddc8bd8..339eb73 100644 --- a/crates/opencode-client/src/models/model_capabilities_interleaved.rs +++ b/crates/opencode-client/src/models/model_capabilities_interleaved.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ModelCapabilitiesInterleaved { impl ModelCapabilitiesInterleaved { pub fn new(field: Field) -> ModelCapabilitiesInterleaved { - ModelCapabilitiesInterleaved { - field, - } + ModelCapabilitiesInterleaved { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs b/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs index a180e61..e3cc5d8 100644 --- a/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ModelCapabilitiesInterleavedAnyOf { impl ModelCapabilitiesInterleavedAnyOf { pub fn new(field: Field) -> ModelCapabilitiesInterleavedAnyOf { - ModelCapabilitiesInterleavedAnyOf { - field, - } + ModelCapabilitiesInterleavedAnyOf { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/model_cost.rs b/crates/opencode-client/src/models/model_cost.rs index dbeb9db..b36051c 100644 --- a/crates/opencode-client/src/models/model_cost.rs +++ b/crates/opencode-client/src/models/model_cost.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,7 +19,10 @@ pub struct ModelCost { pub output: f64, #[serde(rename = "cache")] pub cache: Box, - #[serde(rename = "experimentalOver200K", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "experimentalOver200K", + skip_serializing_if = "Option::is_none" + )] pub experimental_over200_k: Option>, } @@ -33,4 +36,3 @@ impl ModelCost { } } } - diff --git a/crates/opencode-client/src/models/model_cost_experimental_over200_k.rs b/crates/opencode-client/src/models/model_cost_experimental_over200_k.rs index 3215715..2a4f729 100644 --- a/crates/opencode-client/src/models/model_cost_experimental_over200_k.rs +++ b/crates/opencode-client/src/models/model_cost_experimental_over200_k.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct ModelCostExperimentalOver200K { } impl ModelCostExperimentalOver200K { - pub fn new(input: f64, output: f64, cache: models::AssistantMessageTokensCache) -> ModelCostExperimentalOver200K { + pub fn new( + input: f64, + output: f64, + cache: models::AssistantMessageTokensCache, + ) -> ModelCostExperimentalOver200K { ModelCostExperimentalOver200K { input, output, @@ -30,4 +34,3 @@ impl ModelCostExperimentalOver200K { } } } - diff --git a/crates/opencode-client/src/models/not_found_error.rs b/crates/opencode-client/src/models/not_found_error.rs index 3a3f4e5..33a48db 100644 --- a/crates/opencode-client/src/models/not_found_error.rs +++ b/crates/opencode-client/src/models/not_found_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl NotFoundError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "NotFoundError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::NotFoundError } } - diff --git a/crates/opencode-client/src/models/o_auth.rs b/crates/opencode-client/src/models/o_auth.rs index c1d4929..0c3fb74 100644 --- a/crates/opencode-client/src/models/o_auth.rs +++ b/crates/opencode-client/src/models/o_auth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,7 @@ impl OAuth { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] @@ -48,4 +48,3 @@ impl Default for Type { Self::Oauth } } - diff --git a/crates/opencode-client/src/models/part.rs b/crates/opencode-client/src/models/part.rs index 1537d68..eac6047 100644 --- a/crates/opencode-client/src/models/part.rs +++ b/crates/opencode-client/src/models/part.rs @@ -33,7 +33,11 @@ pub struct Part { pub metadata: Option>, #[serde(rename = "prompt", default, skip_serializing_if = "Option::is_none")] pub prompt: Option, - #[serde(rename = "description", default, skip_serializing_if = "Option::is_none")] + #[serde( + rename = "description", + default, + skip_serializing_if = "Option::is_none" + )] pub description: Option, #[serde(rename = "agent", default, skip_serializing_if = "Option::is_none")] pub agent: Option, diff --git a/crates/opencode-client/src/models/part_any_of.rs b/crates/opencode-client/src/models/part_any_of.rs index f1537fa..d30dfe6 100644 --- a/crates/opencode-client/src/models/part_any_of.rs +++ b/crates/opencode-client/src/models/part_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -32,7 +32,15 @@ pub struct PartAnyOf { } impl PartAnyOf { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, prompt: String, description: String, agent: String) -> PartAnyOf { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + prompt: String, + description: String, + agent: String, + ) -> PartAnyOf { PartAnyOf { id, session_id, @@ -45,7 +53,7 @@ impl PartAnyOf { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "subtask")] @@ -57,4 +65,3 @@ impl Default for Type { Self::Subtask } } - diff --git a/crates/opencode-client/src/models/patch_part.rs b/crates/opencode-client/src/models/patch_part.rs index 22db0a8..73ac52d 100644 --- a/crates/opencode-client/src/models/patch_part.rs +++ b/crates/opencode-client/src/models/patch_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,14 @@ pub struct PatchPart { } impl PatchPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, hash: String, files: Vec) -> PatchPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + hash: String, + files: Vec, + ) -> PatchPart { PatchPart { id, session_id, @@ -39,7 +46,7 @@ impl PatchPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "patch")] @@ -51,4 +58,3 @@ impl Default for Type { Self::Patch } } - diff --git a/crates/opencode-client/src/models/path.rs b/crates/opencode-client/src/models/path.rs index 6c67ebb..b80cd3e 100644 --- a/crates/opencode-client/src/models/path.rs +++ b/crates/opencode-client/src/models/path.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct Path { } impl Path { - pub fn new(home: String, state: String, config: String, worktree: String, directory: String) -> Path { + pub fn new( + home: String, + state: String, + config: String, + worktree: String, + directory: String, + ) -> Path { Path { home, state, @@ -36,4 +42,3 @@ impl Path { } } } - diff --git a/crates/opencode-client/src/models/permission.rs b/crates/opencode-client/src/models/permission.rs index 55523bc..cc9a1b7 100644 --- a/crates/opencode-client/src/models/permission.rs +++ b/crates/opencode-client/src/models/permission.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -34,7 +34,15 @@ pub struct Permission { } impl Permission { - pub fn new(id: String, r#type: String, session_id: String, message_id: String, title: String, metadata: std::collections::HashMap, time: models::UserMessageTime) -> Permission { + pub fn new( + id: String, + r#type: String, + session_id: String, + message_id: String, + title: String, + metadata: std::collections::HashMap, + time: models::UserMessageTime, + ) -> Permission { Permission { id, r#type, @@ -48,4 +56,3 @@ impl Permission { } } } - diff --git a/crates/opencode-client/src/models/permission_pattern.rs b/crates/opencode-client/src/models/permission_pattern.rs index e5adcdd..7c315ff 100644 --- a/crates/opencode-client/src/models/permission_pattern.rs +++ b/crates/opencode-client/src/models/permission_pattern.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -12,13 +12,10 @@ use crate::models; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PermissionPattern { -} +pub struct PermissionPattern {} impl PermissionPattern { pub fn new() -> PermissionPattern { - PermissionPattern { - } + PermissionPattern {} } } - diff --git a/crates/opencode-client/src/models/permission_respond_request.rs b/crates/opencode-client/src/models/permission_respond_request.rs index e2f9767..04b3958 100644 --- a/crates/opencode-client/src/models/permission_respond_request.rs +++ b/crates/opencode-client/src/models/permission_respond_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct PermissionRespondRequest { impl PermissionRespondRequest { pub fn new(response: Response) -> PermissionRespondRequest { - PermissionRespondRequest { - response, - } + PermissionRespondRequest { response } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Response { #[serde(rename = "once")] @@ -40,4 +38,3 @@ impl Default for Response { Self::Once } } - diff --git a/crates/opencode-client/src/models/project.rs b/crates/opencode-client/src/models/project.rs index 0566b61..5209f62 100644 --- a/crates/opencode-client/src/models/project.rs +++ b/crates/opencode-client/src/models/project.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,7 +39,7 @@ impl Project { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Vcs { #[serde(rename = "git")] @@ -51,4 +51,3 @@ impl Default for Vcs { Self::Git } } - diff --git a/crates/opencode-client/src/models/project_time.rs b/crates/opencode-client/src/models/project_time.rs index d7a9638..0054fd2 100644 --- a/crates/opencode-client/src/models/project_time.rs +++ b/crates/opencode-client/src/models/project_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,7 +17,11 @@ pub struct ProjectTime { pub created: f64, #[serde(rename = "updated", default)] pub updated: f64, - #[serde(rename = "initialized", default, skip_serializing_if = "Option::is_none")] + #[serde( + rename = "initialized", + default, + skip_serializing_if = "Option::is_none" + )] pub initialized: Option, } @@ -30,4 +34,3 @@ impl ProjectTime { } } } - diff --git a/crates/opencode-client/src/models/project_update_request.rs b/crates/opencode-client/src/models/project_update_request.rs index 745b335..4892dd4 100644 --- a/crates/opencode-client/src/models/project_update_request.rs +++ b/crates/opencode-client/src/models/project_update_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl ProjectUpdateRequest { } } } - diff --git a/crates/opencode-client/src/models/project_update_request_icon.rs b/crates/opencode-client/src/models/project_update_request_icon.rs index f87c6cb..9b27436 100644 --- a/crates/opencode-client/src/models/project_update_request_icon.rs +++ b/crates/opencode-client/src/models/project_update_request_icon.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl ProjectUpdateRequestIcon { } } } - diff --git a/crates/opencode-client/src/models/provider.rs b/crates/opencode-client/src/models/provider.rs index 1546013..5cddd48 100644 --- a/crates/opencode-client/src/models/provider.rs +++ b/crates/opencode-client/src/models/provider.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,14 @@ pub struct Provider { } impl Provider { - pub fn new(id: String, name: String, source: Source, env: Vec, options: std::collections::HashMap, models: std::collections::HashMap) -> Provider { + pub fn new( + id: String, + name: String, + source: Source, + env: Vec, + options: std::collections::HashMap, + models: std::collections::HashMap, + ) -> Provider { Provider { id, name, @@ -42,7 +49,7 @@ impl Provider { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Source { #[serde(rename = "env")] @@ -60,4 +67,3 @@ impl Default for Source { Self::Env } } - diff --git a/crates/opencode-client/src/models/provider_auth_authorization.rs b/crates/opencode-client/src/models/provider_auth_authorization.rs index 302a9f3..ed0ac62 100644 --- a/crates/opencode-client/src/models/provider_auth_authorization.rs +++ b/crates/opencode-client/src/models/provider_auth_authorization.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,7 @@ impl ProviderAuthAuthorization { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Method { #[serde(rename = "auto")] @@ -44,4 +44,3 @@ impl Default for Method { Self::Auto } } - diff --git a/crates/opencode-client/src/models/provider_auth_error.rs b/crates/opencode-client/src/models/provider_auth_error.rs index 41d7272..97ccc4c 100644 --- a/crates/opencode-client/src/models/provider_auth_error.rs +++ b/crates/opencode-client/src/models/provider_auth_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl ProviderAuthError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "ProviderAuthError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::ProviderAuthError } } - diff --git a/crates/opencode-client/src/models/provider_auth_error_data.rs b/crates/opencode-client/src/models/provider_auth_error_data.rs index b822752..438cbdb 100644 --- a/crates/opencode-client/src/models/provider_auth_error_data.rs +++ b/crates/opencode-client/src/models/provider_auth_error_data.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl ProviderAuthErrorData { } } } - diff --git a/crates/opencode-client/src/models/provider_auth_method.rs b/crates/opencode-client/src/models/provider_auth_method.rs index 90b333d..11dcc19 100644 --- a/crates/opencode-client/src/models/provider_auth_method.rs +++ b/crates/opencode-client/src/models/provider_auth_method.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,13 +21,10 @@ pub struct ProviderAuthMethod { impl ProviderAuthMethod { pub fn new(r#type: Type, label: String) -> ProviderAuthMethod { - ProviderAuthMethod { - r#type, - label, - } + ProviderAuthMethod { r#type, label } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] @@ -41,4 +38,3 @@ impl Default for Type { Self::Oauth } } - diff --git a/crates/opencode-client/src/models/provider_config.rs b/crates/opencode-client/src/models/provider_config.rs index c9801ef..7a877b3 100644 --- a/crates/opencode-client/src/models/provider_config.rs +++ b/crates/opencode-client/src/models/provider_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -48,4 +48,3 @@ impl ProviderConfig { } } } - diff --git a/crates/opencode-client/src/models/provider_config_models_value.rs b/crates/opencode-client/src/models/provider_config_models_value.rs index 3dda5d0..516dd4f 100644 --- a/crates/opencode-client/src/models/provider_config_models_value.rs +++ b/crates/opencode-client/src/models/provider_config_models_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -49,7 +49,8 @@ pub struct ProviderConfigModelsValue { pub provider: Option>, /// Variant-specific configuration #[serde(rename = "variants", skip_serializing_if = "Option::is_none")] - pub variants: Option>, + pub variants: + Option>, } impl ProviderConfigModelsValue { @@ -76,7 +77,7 @@ impl ProviderConfigModelsValue { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] @@ -92,4 +93,3 @@ impl Default for Status { Self::Alpha } } - diff --git a/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs b/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs index 05b36a0..0d878c1 100644 --- a/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs +++ b/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ProviderConfigModelsValueInterleaved { impl ProviderConfigModelsValueInterleaved { pub fn new(field: Field) -> ProviderConfigModelsValueInterleaved { - ProviderConfigModelsValueInterleaved { - field, - } + ProviderConfigModelsValueInterleaved { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs b/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs index f66916b..da69574 100644 --- a/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ProviderConfigModelsValueInterleavedAnyOf { impl ProviderConfigModelsValueInterleavedAnyOf { pub fn new(field: Field) -> ProviderConfigModelsValueInterleavedAnyOf { - ProviderConfigModelsValueInterleavedAnyOf { - field, - } + ProviderConfigModelsValueInterleavedAnyOf { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/provider_config_models_value_variants_value.rs b/crates/opencode-client/src/models/provider_config_models_value_variants_value.rs index 63949fa..a44642e 100644 --- a/crates/opencode-client/src/models/provider_config_models_value_variants_value.rs +++ b/crates/opencode-client/src/models/provider_config_models_value_variants_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,9 +20,6 @@ pub struct ProviderConfigModelsValueVariantsValue { impl ProviderConfigModelsValueVariantsValue { pub fn new() -> ProviderConfigModelsValueVariantsValue { - ProviderConfigModelsValueVariantsValue { - disabled: None, - } + ProviderConfigModelsValueVariantsValue { disabled: None } } } - diff --git a/crates/opencode-client/src/models/provider_config_options.rs b/crates/opencode-client/src/models/provider_config_options.rs index 69a9373..11cd86b 100644 --- a/crates/opencode-client/src/models/provider_config_options.rs +++ b/crates/opencode-client/src/models/provider_config_options.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -38,4 +38,3 @@ impl ProviderConfigOptions { } } } - diff --git a/crates/opencode-client/src/models/provider_config_options_timeout.rs b/crates/opencode-client/src/models/provider_config_options_timeout.rs index ff527d3..84c126e 100644 --- a/crates/opencode-client/src/models/provider_config_options_timeout.rs +++ b/crates/opencode-client/src/models/provider_config_options_timeout.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -13,14 +13,11 @@ use serde::{Deserialize, Serialize}; /// ProviderConfigOptionsTimeout : Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderConfigOptionsTimeout { -} +pub struct ProviderConfigOptionsTimeout {} impl ProviderConfigOptionsTimeout { /// Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. pub fn new() -> ProviderConfigOptionsTimeout { - ProviderConfigOptionsTimeout { - } + ProviderConfigOptionsTimeout {} } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response.rs b/crates/opencode-client/src/models/provider_list_200_response.rs index 85bea36..ea0ee6b 100644 --- a/crates/opencode-client/src/models/provider_list_200_response.rs +++ b/crates/opencode-client/src/models/provider_list_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct ProviderList200Response { } impl ProviderList200Response { - pub fn new(all: Vec, default: std::collections::HashMap, connected: Vec) -> ProviderList200Response { + pub fn new( + all: Vec, + default: std::collections::HashMap, + connected: Vec, + ) -> ProviderList200Response { ProviderList200Response { all, default, @@ -30,4 +34,3 @@ impl ProviderList200Response { } } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner.rs index fea04b3..b68312d 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,11 +24,20 @@ pub struct ProviderList200ResponseAllInner { #[serde(rename = "npm", skip_serializing_if = "Option::is_none")] pub npm: Option, #[serde(rename = "models")] - pub models: std::collections::HashMap, + pub models: + std::collections::HashMap, } impl ProviderList200ResponseAllInner { - pub fn new(name: String, env: Vec, id: String, models: std::collections::HashMap) -> ProviderList200ResponseAllInner { + pub fn new( + name: String, + env: Vec, + id: String, + models: std::collections::HashMap< + String, + models::ProviderList200ResponseAllInnerModelsValue, + >, + ) -> ProviderList200ResponseAllInner { ProviderList200ResponseAllInner { api: None, name, @@ -39,4 +48,3 @@ impl ProviderList200ResponseAllInner { } } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs index b19389f..9efa5ad 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -48,11 +48,23 @@ pub struct ProviderList200ResponseAllInnerModelsValue { #[serde(rename = "provider", skip_serializing_if = "Option::is_none")] pub provider: Option>, #[serde(rename = "variants", skip_serializing_if = "Option::is_none")] - pub variants: Option>>, + pub variants: Option< + std::collections::HashMap>, + >, } impl ProviderList200ResponseAllInnerModelsValue { - pub fn new(id: String, name: String, release_date: String, attachment: bool, reasoning: bool, temperature: bool, tool_call: bool, limit: models::ProviderList200ResponseAllInnerModelsValueLimit, options: std::collections::HashMap) -> ProviderList200ResponseAllInnerModelsValue { + pub fn new( + id: String, + name: String, + release_date: String, + attachment: bool, + reasoning: bool, + temperature: bool, + tool_call: bool, + limit: models::ProviderList200ResponseAllInnerModelsValueLimit, + options: std::collections::HashMap, + ) -> ProviderList200ResponseAllInnerModelsValue { ProviderList200ResponseAllInnerModelsValue { id, name, @@ -75,7 +87,7 @@ impl ProviderList200ResponseAllInnerModelsValue { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] @@ -91,4 +103,3 @@ impl Default for Status { Self::Alpha } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost.rs index 59f2d12..e879c1c 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,8 @@ pub struct ProviderList200ResponseAllInnerModelsValueCost { #[serde(rename = "cache_write", skip_serializing_if = "Option::is_none")] pub cache_write: Option, #[serde(rename = "context_over_200k", skip_serializing_if = "Option::is_none")] - pub context_over_200k: Option>, + pub context_over_200k: + Option>, } impl ProviderList200ResponseAllInnerModelsValueCost { @@ -36,4 +37,3 @@ impl ProviderList200ResponseAllInnerModelsValueCost { } } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost_context_over_200k.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost_context_over_200k.rs index 428d7af..d075dea 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost_context_over_200k.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_cost_context_over_200k.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -24,7 +24,10 @@ pub struct ProviderList200ResponseAllInnerModelsValueCostContextOver200k { } impl ProviderList200ResponseAllInnerModelsValueCostContextOver200k { - pub fn new(input: f64, output: f64) -> ProviderList200ResponseAllInnerModelsValueCostContextOver200k { + pub fn new( + input: f64, + output: f64, + ) -> ProviderList200ResponseAllInnerModelsValueCostContextOver200k { ProviderList200ResponseAllInnerModelsValueCostContextOver200k { input, output, @@ -33,4 +36,3 @@ impl ProviderList200ResponseAllInnerModelsValueCostContextOver200k { } } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs index a9cecfd..af12cf4 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ProviderList200ResponseAllInnerModelsValueInterleaved { impl ProviderList200ResponseAllInnerModelsValueInterleaved { pub fn new(field: Field) -> ProviderList200ResponseAllInnerModelsValueInterleaved { - ProviderList200ResponseAllInnerModelsValueInterleaved { - field, - } + ProviderList200ResponseAllInnerModelsValueInterleaved { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs index 4c51ef5..72fa82e 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { impl ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { pub fn new(field: Field) -> ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { - ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { - field, - } + ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { field } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] @@ -38,4 +36,3 @@ impl Default for Field { Self::ReasoningContent } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_limit.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_limit.rs index d45b35c..57b9357 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_limit.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_limit.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct ProviderList200ResponseAllInnerModelsValueLimit { impl ProviderList200ResponseAllInnerModelsValueLimit { pub fn new(context: f64, output: f64) -> ProviderList200ResponseAllInnerModelsValueLimit { - ProviderList200ResponseAllInnerModelsValueLimit { - context, - output, - } + ProviderList200ResponseAllInnerModelsValueLimit { context, output } } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs index 767ca84..924a575 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,14 +20,14 @@ pub struct ProviderList200ResponseAllInnerModelsValueModalities { } impl ProviderList200ResponseAllInnerModelsValueModalities { - pub fn new(input: Vec, output: Vec) -> ProviderList200ResponseAllInnerModelsValueModalities { - ProviderList200ResponseAllInnerModelsValueModalities { - input, - output, - } + pub fn new( + input: Vec, + output: Vec, + ) -> ProviderList200ResponseAllInnerModelsValueModalities { + ProviderList200ResponseAllInnerModelsValueModalities { input, output } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Input { #[serde(rename = "text")] @@ -47,7 +47,7 @@ impl Default for Input { Self::Text } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Output { #[serde(rename = "text")] @@ -67,4 +67,3 @@ impl Default for Output { Self::Text } } - diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_provider.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_provider.rs index 89f2768..aaa7eeb 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_provider.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_provider.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct ProviderList200ResponseAllInnerModelsValueProvider { impl ProviderList200ResponseAllInnerModelsValueProvider { pub fn new(npm: String) -> ProviderList200ResponseAllInnerModelsValueProvider { - ProviderList200ResponseAllInnerModelsValueProvider { - npm, - } + ProviderList200ResponseAllInnerModelsValueProvider { npm } } } - diff --git a/crates/opencode-client/src/models/provider_oauth_authorize_request.rs b/crates/opencode-client/src/models/provider_oauth_authorize_request.rs index d43cd3b..fbb3afd 100644 --- a/crates/opencode-client/src/models/provider_oauth_authorize_request.rs +++ b/crates/opencode-client/src/models/provider_oauth_authorize_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,9 +20,6 @@ pub struct ProviderOauthAuthorizeRequest { impl ProviderOauthAuthorizeRequest { pub fn new(method: f64) -> ProviderOauthAuthorizeRequest { - ProviderOauthAuthorizeRequest { - method, - } + ProviderOauthAuthorizeRequest { method } } } - diff --git a/crates/opencode-client/src/models/provider_oauth_callback_request.rs b/crates/opencode-client/src/models/provider_oauth_callback_request.rs index 87c491f..cebe61f 100644 --- a/crates/opencode-client/src/models/provider_oauth_callback_request.rs +++ b/crates/opencode-client/src/models/provider_oauth_callback_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,10 +23,6 @@ pub struct ProviderOauthCallbackRequest { impl ProviderOauthCallbackRequest { pub fn new(method: f64) -> ProviderOauthCallbackRequest { - ProviderOauthCallbackRequest { - method, - code: None, - } + ProviderOauthCallbackRequest { method, code: None } } } - diff --git a/crates/opencode-client/src/models/pty.rs b/crates/opencode-client/src/models/pty.rs index 537068d..e9b5bcf 100644 --- a/crates/opencode-client/src/models/pty.rs +++ b/crates/opencode-client/src/models/pty.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,15 @@ pub struct Pty { } impl Pty { - pub fn new(id: String, title: String, command: String, args: Vec, cwd: String, status: Status, pid: f64) -> Pty { + pub fn new( + id: String, + title: String, + command: String, + args: Vec, + cwd: String, + status: Status, + pid: f64, + ) -> Pty { Pty { id, title, @@ -42,7 +50,7 @@ impl Pty { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "running")] @@ -56,4 +64,3 @@ impl Default for Status { Self::Running } } - diff --git a/crates/opencode-client/src/models/pty_create_request.rs b/crates/opencode-client/src/models/pty_create_request.rs index 29b71c6..ebbfa96 100644 --- a/crates/opencode-client/src/models/pty_create_request.rs +++ b/crates/opencode-client/src/models/pty_create_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,4 +36,3 @@ impl PtyCreateRequest { } } } - diff --git a/crates/opencode-client/src/models/pty_update_request.rs b/crates/opencode-client/src/models/pty_update_request.rs index 081b6bd..6b6e693 100644 --- a/crates/opencode-client/src/models/pty_update_request.rs +++ b/crates/opencode-client/src/models/pty_update_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl PtyUpdateRequest { } } } - diff --git a/crates/opencode-client/src/models/pty_update_request_size.rs b/crates/opencode-client/src/models/pty_update_request_size.rs index 5ce3849..966a7c4 100644 --- a/crates/opencode-client/src/models/pty_update_request_size.rs +++ b/crates/opencode-client/src/models/pty_update_request_size.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct PtyUpdateRequestSize { impl PtyUpdateRequestSize { pub fn new(rows: f64, cols: f64) -> PtyUpdateRequestSize { - PtyUpdateRequestSize { - rows, - cols, - } + PtyUpdateRequestSize { rows, cols } } } - diff --git a/crates/opencode-client/src/models/range.rs b/crates/opencode-client/src/models/range.rs index d07b982..ff772c6 100644 --- a/crates/opencode-client/src/models/range.rs +++ b/crates/opencode-client/src/models/range.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl Range { } } } - diff --git a/crates/opencode-client/src/models/range_start.rs b/crates/opencode-client/src/models/range_start.rs index 3c22ccc..c5b1707 100644 --- a/crates/opencode-client/src/models/range_start.rs +++ b/crates/opencode-client/src/models/range_start.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct RangeStart { impl RangeStart { pub fn new(line: f64, character: f64) -> RangeStart { - RangeStart { - line, - character, - } + RangeStart { line, character } } } - diff --git a/crates/opencode-client/src/models/reasoning_part.rs b/crates/opencode-client/src/models/reasoning_part.rs index aff14d5..3264420 100644 --- a/crates/opencode-client/src/models/reasoning_part.rs +++ b/crates/opencode-client/src/models/reasoning_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,14 @@ pub struct ReasoningPart { } impl ReasoningPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, text: String, time: models::TextPartTime) -> ReasoningPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + text: String, + time: models::TextPartTime, + ) -> ReasoningPart { ReasoningPart { id, session_id, @@ -42,7 +49,7 @@ impl ReasoningPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "reasoning")] @@ -54,4 +61,3 @@ impl Default for Type { Self::Reasoning } } - diff --git a/crates/opencode-client/src/models/retry_part.rs b/crates/opencode-client/src/models/retry_part.rs index 37174d2..64f16f2 100644 --- a/crates/opencode-client/src/models/retry_part.rs +++ b/crates/opencode-client/src/models/retry_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,15 @@ pub struct RetryPart { } impl RetryPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, attempt: f64, error: models::ApiError, time: models::UserMessageTime) -> RetryPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + attempt: f64, + error: models::ApiError, + time: models::UserMessageTime, + ) -> RetryPart { RetryPart { id, session_id, @@ -42,7 +50,7 @@ impl RetryPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "retry")] @@ -54,4 +62,3 @@ impl Default for Type { Self::Retry } } - diff --git a/crates/opencode-client/src/models/server_config.rs b/crates/opencode-client/src/models/server_config.rs index 5bdba7b..39e2703 100644 --- a/crates/opencode-client/src/models/server_config.rs +++ b/crates/opencode-client/src/models/server_config.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,4 +39,3 @@ impl ServerConfig { } } } - diff --git a/crates/opencode-client/src/models/session.rs b/crates/opencode-client/src/models/session.rs index 9b80a66..5dff432 100644 --- a/crates/opencode-client/src/models/session.rs +++ b/crates/opencode-client/src/models/session.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,14 @@ pub struct Session { } impl Session { - pub fn new(id: String, project_id: String, directory: String, title: String, version: String, time: models::SessionTime) -> Session { + pub fn new( + id: String, + project_id: String, + directory: String, + title: String, + version: String, + time: models::SessionTime, + ) -> Session { Session { id, project_id, @@ -51,4 +58,3 @@ impl Session { } } } - diff --git a/crates/opencode-client/src/models/session_command_request.rs b/crates/opencode-client/src/models/session_command_request.rs index 20b987d..b016438 100644 --- a/crates/opencode-client/src/models/session_command_request.rs +++ b/crates/opencode-client/src/models/session_command_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -39,4 +39,3 @@ impl SessionCommandRequest { } } } - diff --git a/crates/opencode-client/src/models/session_create_request.rs b/crates/opencode-client/src/models/session_create_request.rs index e06581c..7535c42 100644 --- a/crates/opencode-client/src/models/session_create_request.rs +++ b/crates/opencode-client/src/models/session_create_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SessionCreateRequest { } } } - diff --git a/crates/opencode-client/src/models/session_fork_request.rs b/crates/opencode-client/src/models/session_fork_request.rs index ae4ba6e..a76d198 100644 --- a/crates/opencode-client/src/models/session_fork_request.rs +++ b/crates/opencode-client/src/models/session_fork_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct SessionForkRequest { impl SessionForkRequest { pub fn new() -> SessionForkRequest { - SessionForkRequest { - message_id: None, - } + SessionForkRequest { message_id: None } } } - diff --git a/crates/opencode-client/src/models/session_init_request.rs b/crates/opencode-client/src/models/session_init_request.rs index aef8990..14ddc1b 100644 --- a/crates/opencode-client/src/models/session_init_request.rs +++ b/crates/opencode-client/src/models/session_init_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl SessionInitRequest { } } } - diff --git a/crates/opencode-client/src/models/session_messages_200_response_inner.rs b/crates/opencode-client/src/models/session_messages_200_response_inner.rs index 8dc9dc8..f9ab308 100644 --- a/crates/opencode-client/src/models/session_messages_200_response_inner.rs +++ b/crates/opencode-client/src/models/session_messages_200_response_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SessionMessages200ResponseInner { } } } - diff --git a/crates/opencode-client/src/models/session_prompt_200_response.rs b/crates/opencode-client/src/models/session_prompt_200_response.rs index 29f7706..1a7c5ed 100644 --- a/crates/opencode-client/src/models/session_prompt_200_response.rs +++ b/crates/opencode-client/src/models/session_prompt_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,11 +20,13 @@ pub struct SessionPrompt200Response { } impl SessionPrompt200Response { - pub fn new(info: models::AssistantMessage, parts: Vec) -> SessionPrompt200Response { + pub fn new( + info: models::AssistantMessage, + parts: Vec, + ) -> SessionPrompt200Response { SessionPrompt200Response { info: Box::new(info), parts, } } } - diff --git a/crates/opencode-client/src/models/session_prompt_request.rs b/crates/opencode-client/src/models/session_prompt_request.rs index 23d0e36..a3ae630 100644 --- a/crates/opencode-client/src/models/session_prompt_request.rs +++ b/crates/opencode-client/src/models/session_prompt_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -45,4 +45,3 @@ impl SessionPromptRequest { } } } - diff --git a/crates/opencode-client/src/models/session_prompt_request_model.rs b/crates/opencode-client/src/models/session_prompt_request_model.rs index f7761fd..78abc2a 100644 --- a/crates/opencode-client/src/models/session_prompt_request_model.rs +++ b/crates/opencode-client/src/models/session_prompt_request_model.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SessionPromptRequestModel { } } } - diff --git a/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs b/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs index 71c7a8e..42a86dc 100644 --- a/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs +++ b/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -48,7 +48,16 @@ pub struct SessionPromptRequestPartsInner { } impl SessionPromptRequestPartsInner { - pub fn new(r#type: Type, text: String, mime: String, url: String, name: String, prompt: String, description: String, agent: String) -> SessionPromptRequestPartsInner { + pub fn new( + r#type: Type, + text: String, + mime: String, + url: String, + name: String, + prompt: String, + description: String, + agent: String, + ) -> SessionPromptRequestPartsInner { SessionPromptRequestPartsInner { id: None, r#type, @@ -69,7 +78,7 @@ impl SessionPromptRequestPartsInner { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] @@ -87,4 +96,3 @@ impl Default for Type { Self::Text } } - diff --git a/crates/opencode-client/src/models/session_revert.rs b/crates/opencode-client/src/models/session_revert.rs index 99639f9..352ff2a 100644 --- a/crates/opencode-client/src/models/session_revert.rs +++ b/crates/opencode-client/src/models/session_revert.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,4 +33,3 @@ impl SessionRevert { } } } - diff --git a/crates/opencode-client/src/models/session_revert_request.rs b/crates/opencode-client/src/models/session_revert_request.rs index 44144c1..6b6bd21 100644 --- a/crates/opencode-client/src/models/session_revert_request.rs +++ b/crates/opencode-client/src/models/session_revert_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SessionRevertRequest { } } } - diff --git a/crates/opencode-client/src/models/session_share.rs b/crates/opencode-client/src/models/session_share.rs index 9724e75..497a92b 100644 --- a/crates/opencode-client/src/models/session_share.rs +++ b/crates/opencode-client/src/models/session_share.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct SessionShare { impl SessionShare { pub fn new(url: String) -> SessionShare { - SessionShare { - url, - } + SessionShare { url } } } - diff --git a/crates/opencode-client/src/models/session_shell_request.rs b/crates/opencode-client/src/models/session_shell_request.rs index d2d2446..b09360e 100644 --- a/crates/opencode-client/src/models/session_shell_request.rs +++ b/crates/opencode-client/src/models/session_shell_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl SessionShellRequest { } } } - diff --git a/crates/opencode-client/src/models/session_status.rs b/crates/opencode-client/src/models/session_status.rs index 123fd73..e00fc4f 100644 --- a/crates/opencode-client/src/models/session_status.rs +++ b/crates/opencode-client/src/models/session_status.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,7 +33,7 @@ impl SessionStatus { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "idle")] @@ -49,4 +49,3 @@ impl Default for Type { Self::Idle } } - diff --git a/crates/opencode-client/src/models/session_status_any_of.rs b/crates/opencode-client/src/models/session_status_any_of.rs index e207e24..045fe42 100644 --- a/crates/opencode-client/src/models/session_status_any_of.rs +++ b/crates/opencode-client/src/models/session_status_any_of.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct SessionStatusAnyOf { impl SessionStatusAnyOf { pub fn new(r#type: Type) -> SessionStatusAnyOf { - SessionStatusAnyOf { - r#type, - } + SessionStatusAnyOf { r#type } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "idle")] @@ -36,4 +34,3 @@ impl Default for Type { Self::Idle } } - diff --git a/crates/opencode-client/src/models/session_status_any_of_1.rs b/crates/opencode-client/src/models/session_status_any_of_1.rs index 734f2bd..48c8910 100644 --- a/crates/opencode-client/src/models/session_status_any_of_1.rs +++ b/crates/opencode-client/src/models/session_status_any_of_1.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,7 +33,7 @@ impl SessionStatusAnyOf1 { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "retry")] @@ -45,4 +45,3 @@ impl Default for Type { Self::Retry } } - diff --git a/crates/opencode-client/src/models/session_status_any_of_2.rs b/crates/opencode-client/src/models/session_status_any_of_2.rs index 1b80b47..065417d 100644 --- a/crates/opencode-client/src/models/session_status_any_of_2.rs +++ b/crates/opencode-client/src/models/session_status_any_of_2.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,12 +19,10 @@ pub struct SessionStatusAnyOf2 { impl SessionStatusAnyOf2 { pub fn new(r#type: Type) -> SessionStatusAnyOf2 { - SessionStatusAnyOf2 { - r#type, - } + SessionStatusAnyOf2 { r#type } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "busy")] @@ -36,4 +34,3 @@ impl Default for Type { Self::Busy } } - diff --git a/crates/opencode-client/src/models/session_summarize_request.rs b/crates/opencode-client/src/models/session_summarize_request.rs index 2233ef8..0ad6fac 100644 --- a/crates/opencode-client/src/models/session_summarize_request.rs +++ b/crates/opencode-client/src/models/session_summarize_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl SessionSummarizeRequest { } } } - diff --git a/crates/opencode-client/src/models/session_summary.rs b/crates/opencode-client/src/models/session_summary.rs index 44a6bd6..55b6408 100644 --- a/crates/opencode-client/src/models/session_summary.rs +++ b/crates/opencode-client/src/models/session_summary.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -33,4 +33,3 @@ impl SessionSummary { } } } - diff --git a/crates/opencode-client/src/models/session_time.rs b/crates/opencode-client/src/models/session_time.rs index cacdb6d..f117bff 100644 --- a/crates/opencode-client/src/models/session_time.rs +++ b/crates/opencode-client/src/models/session_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,7 +17,11 @@ pub struct SessionTime { pub created: f64, #[serde(rename = "updated", default)] pub updated: f64, - #[serde(rename = "compacting", default, skip_serializing_if = "Option::is_none")] + #[serde( + rename = "compacting", + default, + skip_serializing_if = "Option::is_none" + )] pub compacting: Option, #[serde(rename = "archived", default, skip_serializing_if = "Option::is_none")] pub archived: Option, @@ -33,4 +37,3 @@ impl SessionTime { } } } - diff --git a/crates/opencode-client/src/models/session_update_request.rs b/crates/opencode-client/src/models/session_update_request.rs index 3396a60..955c2eb 100644 --- a/crates/opencode-client/src/models/session_update_request.rs +++ b/crates/opencode-client/src/models/session_update_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SessionUpdateRequest { } } } - diff --git a/crates/opencode-client/src/models/session_update_request_time.rs b/crates/opencode-client/src/models/session_update_request_time.rs index dde093e..0a9ccae 100644 --- a/crates/opencode-client/src/models/session_update_request_time.rs +++ b/crates/opencode-client/src/models/session_update_request_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct SessionUpdateRequestTime { impl SessionUpdateRequestTime { pub fn new() -> SessionUpdateRequestTime { - SessionUpdateRequestTime { - archived: None, - } + SessionUpdateRequestTime { archived: None } } } - diff --git a/crates/opencode-client/src/models/snapshot_part.rs b/crates/opencode-client/src/models/snapshot_part.rs index b52618d..3332ecb 100644 --- a/crates/opencode-client/src/models/snapshot_part.rs +++ b/crates/opencode-client/src/models/snapshot_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,13 @@ pub struct SnapshotPart { } impl SnapshotPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, snapshot: String) -> SnapshotPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + snapshot: String, + ) -> SnapshotPart { SnapshotPart { id, session_id, @@ -36,7 +42,7 @@ impl SnapshotPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "snapshot")] @@ -48,4 +54,3 @@ impl Default for Type { Self::Snapshot } } - diff --git a/crates/opencode-client/src/models/step_finish_part.rs b/crates/opencode-client/src/models/step_finish_part.rs index f6e1418..b856f51 100644 --- a/crates/opencode-client/src/models/step_finish_part.rs +++ b/crates/opencode-client/src/models/step_finish_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -32,7 +32,15 @@ pub struct StepFinishPart { } impl StepFinishPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, reason: String, cost: f64, tokens: models::AssistantMessageTokens) -> StepFinishPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + reason: String, + cost: f64, + tokens: models::AssistantMessageTokens, + ) -> StepFinishPart { StepFinishPart { id, session_id, @@ -45,7 +53,7 @@ impl StepFinishPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "step-finish")] @@ -57,4 +65,3 @@ impl Default for Type { Self::StepFinish } } - diff --git a/crates/opencode-client/src/models/step_start_part.rs b/crates/opencode-client/src/models/step_start_part.rs index d55e1c6..b9d1c9d 100644 --- a/crates/opencode-client/src/models/step_start_part.rs +++ b/crates/opencode-client/src/models/step_start_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,7 @@ impl StepStartPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "step-start")] @@ -48,4 +48,3 @@ impl Default for Type { Self::StepStart } } - diff --git a/crates/opencode-client/src/models/subtask_part_input.rs b/crates/opencode-client/src/models/subtask_part_input.rs index a7e7ba6..f4a4982 100644 --- a/crates/opencode-client/src/models/subtask_part_input.rs +++ b/crates/opencode-client/src/models/subtask_part_input.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,12 @@ pub struct SubtaskPartInput { } impl SubtaskPartInput { - pub fn new(r#type: Type, prompt: String, description: String, agent: String) -> SubtaskPartInput { + pub fn new( + r#type: Type, + prompt: String, + description: String, + agent: String, + ) -> SubtaskPartInput { SubtaskPartInput { id: None, r#type, @@ -39,7 +44,7 @@ impl SubtaskPartInput { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "subtask")] @@ -51,4 +56,3 @@ impl Default for Type { Self::Subtask } } - diff --git a/crates/opencode-client/src/models/symbol.rs b/crates/opencode-client/src/models/symbol.rs index b472623..9eec0fb 100644 --- a/crates/opencode-client/src/models/symbol.rs +++ b/crates/opencode-client/src/models/symbol.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl Symbol { } } } - diff --git a/crates/opencode-client/src/models/symbol_location.rs b/crates/opencode-client/src/models/symbol_location.rs index 29515c6..498ffda 100644 --- a/crates/opencode-client/src/models/symbol_location.rs +++ b/crates/opencode-client/src/models/symbol_location.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,4 +27,3 @@ impl SymbolLocation { } } } - diff --git a/crates/opencode-client/src/models/symbol_source.rs b/crates/opencode-client/src/models/symbol_source.rs index d0a7184..c187c5b 100644 --- a/crates/opencode-client/src/models/symbol_source.rs +++ b/crates/opencode-client/src/models/symbol_source.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -28,7 +28,14 @@ pub struct SymbolSource { } impl SymbolSource { - pub fn new(text: models::FilePartSourceText, r#type: Type, path: String, range: models::Range, name: String, kind: i32) -> SymbolSource { + pub fn new( + text: models::FilePartSourceText, + r#type: Type, + path: String, + range: models::Range, + name: String, + kind: i32, + ) -> SymbolSource { SymbolSource { text: Box::new(text), r#type, @@ -39,7 +46,7 @@ impl SymbolSource { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "symbol")] @@ -51,4 +58,3 @@ impl Default for Type { Self::Symbol } } - diff --git a/crates/opencode-client/src/models/text_part.rs b/crates/opencode-client/src/models/text_part.rs index 3e1076f..1f806bd 100644 --- a/crates/opencode-client/src/models/text_part.rs +++ b/crates/opencode-client/src/models/text_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -34,7 +34,13 @@ pub struct TextPart { } impl TextPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, text: String) -> TextPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + text: String, + ) -> TextPart { TextPart { id, session_id, @@ -48,7 +54,7 @@ impl TextPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] @@ -60,4 +66,3 @@ impl Default for Type { Self::Text } } - diff --git a/crates/opencode-client/src/models/text_part_input.rs b/crates/opencode-client/src/models/text_part_input.rs index 90dd80a..95ba125 100644 --- a/crates/opencode-client/src/models/text_part_input.rs +++ b/crates/opencode-client/src/models/text_part_input.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -42,7 +42,7 @@ impl TextPartInput { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] @@ -54,4 +54,3 @@ impl Default for Type { Self::Text } } - diff --git a/crates/opencode-client/src/models/text_part_time.rs b/crates/opencode-client/src/models/text_part_time.rs index 189fd28..3057654 100644 --- a/crates/opencode-client/src/models/text_part_time.rs +++ b/crates/opencode-client/src/models/text_part_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct TextPartTime { impl TextPartTime { pub fn new(start: f64) -> TextPartTime { - TextPartTime { - start, - end: None, - } + TextPartTime { start, end: None } } } - diff --git a/crates/opencode-client/src/models/todo.rs b/crates/opencode-client/src/models/todo.rs index 10f861d..d96ab27 100644 --- a/crates/opencode-client/src/models/todo.rs +++ b/crates/opencode-client/src/models/todo.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -37,4 +37,3 @@ impl Todo { } } } - diff --git a/crates/opencode-client/src/models/tool_list_item.rs b/crates/opencode-client/src/models/tool_list_item.rs index 6ae9131..472b844 100644 --- a/crates/opencode-client/src/models/tool_list_item.rs +++ b/crates/opencode-client/src/models/tool_list_item.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,7 +22,11 @@ pub struct ToolListItem { } impl ToolListItem { - pub fn new(id: String, description: String, parameters: Option) -> ToolListItem { + pub fn new( + id: String, + description: String, + parameters: Option, + ) -> ToolListItem { ToolListItem { id, description, @@ -30,4 +34,3 @@ impl ToolListItem { } } } - diff --git a/crates/opencode-client/src/models/tool_part.rs b/crates/opencode-client/src/models/tool_part.rs index 7bafa59..e0b8bf8 100644 --- a/crates/opencode-client/src/models/tool_part.rs +++ b/crates/opencode-client/src/models/tool_part.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -32,7 +32,15 @@ pub struct ToolPart { } impl ToolPart { - pub fn new(id: String, session_id: String, message_id: String, r#type: Type, call_id: String, tool: String, state: models::ToolState) -> ToolPart { + pub fn new( + id: String, + session_id: String, + message_id: String, + r#type: Type, + call_id: String, + tool: String, + state: models::ToolState, + ) -> ToolPart { ToolPart { id, session_id, @@ -45,7 +53,7 @@ impl ToolPart { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tool")] @@ -57,4 +65,3 @@ impl Default for Type { Self::Tool } } - diff --git a/crates/opencode-client/src/models/tool_state.rs b/crates/opencode-client/src/models/tool_state.rs index 7ae7140..c7688cd 100644 --- a/crates/opencode-client/src/models/tool_state.rs +++ b/crates/opencode-client/src/models/tool_state.rs @@ -27,7 +27,11 @@ pub struct ToolState { pub time: Option>, #[serde(rename = "output", default, skip_serializing_if = "Option::is_none")] pub output: Option, - #[serde(rename = "attachments", default, skip_serializing_if = "Option::is_none")] + #[serde( + rename = "attachments", + default, + skip_serializing_if = "Option::is_none" + )] pub attachments: Option>, #[serde(rename = "error", default, skip_serializing_if = "Option::is_none")] pub error: Option, @@ -49,7 +53,9 @@ impl ToolState { } } /// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default)] +#[derive( + Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default, +)] pub enum Status { #[default] #[serde(rename = "pending")] diff --git a/crates/opencode-client/src/models/tool_state_completed.rs b/crates/opencode-client/src/models/tool_state_completed.rs index 9573107..a698edb 100644 --- a/crates/opencode-client/src/models/tool_state_completed.rs +++ b/crates/opencode-client/src/models/tool_state_completed.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,14 @@ pub struct ToolStateCompleted { } impl ToolStateCompleted { - pub fn new(status: Status, input: std::collections::HashMap, output: String, title: String, metadata: std::collections::HashMap, time: models::ToolStateCompletedTime) -> ToolStateCompleted { + pub fn new( + status: Status, + input: std::collections::HashMap, + output: String, + title: String, + metadata: std::collections::HashMap, + time: models::ToolStateCompletedTime, + ) -> ToolStateCompleted { ToolStateCompleted { status, input, @@ -42,7 +49,7 @@ impl ToolStateCompleted { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "completed")] @@ -54,4 +61,3 @@ impl Default for Status { Self::Completed } } - diff --git a/crates/opencode-client/src/models/tool_state_completed_time.rs b/crates/opencode-client/src/models/tool_state_completed_time.rs index af009e9..2a2ba16 100644 --- a/crates/opencode-client/src/models/tool_state_completed_time.rs +++ b/crates/opencode-client/src/models/tool_state_completed_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl ToolStateCompletedTime { } } } - diff --git a/crates/opencode-client/src/models/tool_state_error.rs b/crates/opencode-client/src/models/tool_state_error.rs index 9fe286a..b4d2eaa 100644 --- a/crates/opencode-client/src/models/tool_state_error.rs +++ b/crates/opencode-client/src/models/tool_state_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,12 @@ pub struct ToolStateError { } impl ToolStateError { - pub fn new(status: Status, input: std::collections::HashMap, error: String, time: models::ToolStateErrorTime) -> ToolStateError { + pub fn new( + status: Status, + input: std::collections::HashMap, + error: String, + time: models::ToolStateErrorTime, + ) -> ToolStateError { ToolStateError { status, input, @@ -36,7 +41,7 @@ impl ToolStateError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "error")] @@ -48,4 +53,3 @@ impl Default for Status { Self::Error } } - diff --git a/crates/opencode-client/src/models/tool_state_error_time.rs b/crates/opencode-client/src/models/tool_state_error_time.rs index a32917b..628c94a 100644 --- a/crates/opencode-client/src/models/tool_state_error_time.rs +++ b/crates/opencode-client/src/models/tool_state_error_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct ToolStateErrorTime { impl ToolStateErrorTime { pub fn new(start: f64, end: f64) -> ToolStateErrorTime { - ToolStateErrorTime { - start, - end, - } + ToolStateErrorTime { start, end } } } - diff --git a/crates/opencode-client/src/models/tool_state_pending.rs b/crates/opencode-client/src/models/tool_state_pending.rs index 5b0383e..d250dbb 100644 --- a/crates/opencode-client/src/models/tool_state_pending.rs +++ b/crates/opencode-client/src/models/tool_state_pending.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,15 +22,15 @@ pub struct ToolStatePending { } impl ToolStatePending { - pub fn new(status: Status, input: std::collections::HashMap, raw: String) -> ToolStatePending { - ToolStatePending { - status, - input, - raw, - } + pub fn new( + status: Status, + input: std::collections::HashMap, + raw: String, + ) -> ToolStatePending { + ToolStatePending { status, input, raw } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "pending")] @@ -42,4 +42,3 @@ impl Default for Status { Self::Pending } } - diff --git a/crates/opencode-client/src/models/tool_state_running.rs b/crates/opencode-client/src/models/tool_state_running.rs index 7e7c5aa..f3eb14f 100644 --- a/crates/opencode-client/src/models/tool_state_running.rs +++ b/crates/opencode-client/src/models/tool_state_running.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,11 @@ pub struct ToolStateRunning { } impl ToolStateRunning { - pub fn new(status: Status, input: std::collections::HashMap, time: models::ToolStateRunningTime) -> ToolStateRunning { + pub fn new( + status: Status, + input: std::collections::HashMap, + time: models::ToolStateRunningTime, + ) -> ToolStateRunning { ToolStateRunning { status, input, @@ -36,7 +40,7 @@ impl ToolStateRunning { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "running")] @@ -48,4 +52,3 @@ impl Default for Status { Self::Running } } - diff --git a/crates/opencode-client/src/models/tool_state_running_time.rs b/crates/opencode-client/src/models/tool_state_running_time.rs index 470a39b..b92d0e2 100644 --- a/crates/opencode-client/src/models/tool_state_running_time.rs +++ b/crates/opencode-client/src/models/tool_state_running_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct ToolStateRunningTime { impl ToolStateRunningTime { pub fn new(start: f64) -> ToolStateRunningTime { - ToolStateRunningTime { - start, - } + ToolStateRunningTime { start } } } - diff --git a/crates/opencode-client/src/models/tui_control_next_200_response.rs b/crates/opencode-client/src/models/tui_control_next_200_response.rs index 48e08af..63458fc 100644 --- a/crates/opencode-client/src/models/tui_control_next_200_response.rs +++ b/crates/opencode-client/src/models/tui_control_next_200_response.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,10 +21,6 @@ pub struct TuiControlNext200Response { impl TuiControlNext200Response { pub fn new(path: String, body: Option) -> TuiControlNext200Response { - TuiControlNext200Response { - path, - body, - } + TuiControlNext200Response { path, body } } } - diff --git a/crates/opencode-client/src/models/tui_execute_command_request.rs b/crates/opencode-client/src/models/tui_execute_command_request.rs index b8e65e9..4846648 100644 --- a/crates/opencode-client/src/models/tui_execute_command_request.rs +++ b/crates/opencode-client/src/models/tui_execute_command_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct TuiExecuteCommandRequest { impl TuiExecuteCommandRequest { pub fn new(command: String) -> TuiExecuteCommandRequest { - TuiExecuteCommandRequest { - command, - } + TuiExecuteCommandRequest { command } } } - diff --git a/crates/opencode-client/src/models/tui_publish_request.rs b/crates/opencode-client/src/models/tui_publish_request.rs index b47ab01..64850cf 100644 --- a/crates/opencode-client/src/models/tui_publish_request.rs +++ b/crates/opencode-client/src/models/tui_publish_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl TuiPublishRequest { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] @@ -43,4 +43,3 @@ impl Default for Type { Self::TuiPromptAppend } } - diff --git a/crates/opencode-client/src/models/tui_show_toast_request.rs b/crates/opencode-client/src/models/tui_show_toast_request.rs index 7a9a180..289c515 100644 --- a/crates/opencode-client/src/models/tui_show_toast_request.rs +++ b/crates/opencode-client/src/models/tui_show_toast_request.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -34,7 +34,7 @@ impl TuiShowToastRequest { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Variant { #[serde(rename = "info")] @@ -52,4 +52,3 @@ impl Default for Variant { Self::Info } } - diff --git a/crates/opencode-client/src/models/unknown_error.rs b/crates/opencode-client/src/models/unknown_error.rs index 6169c93..6f47e85 100644 --- a/crates/opencode-client/src/models/unknown_error.rs +++ b/crates/opencode-client/src/models/unknown_error.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -27,7 +27,7 @@ impl UnknownError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "UnknownError")] @@ -39,4 +39,3 @@ impl Default for Name { Self::UnknownError } } - diff --git a/crates/opencode-client/src/models/unknown_error_data.rs b/crates/opencode-client/src/models/unknown_error_data.rs index a69924f..9780baa 100644 --- a/crates/opencode-client/src/models/unknown_error_data.rs +++ b/crates/opencode-client/src/models/unknown_error_data.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct UnknownErrorData { impl UnknownErrorData { pub fn new(message: String) -> UnknownErrorData { - UnknownErrorData { - message, - } + UnknownErrorData { message } } } - diff --git a/crates/opencode-client/src/models/user_message.rs b/crates/opencode-client/src/models/user_message.rs index 386a99e..f8f9bd9 100644 --- a/crates/opencode-client/src/models/user_message.rs +++ b/crates/opencode-client/src/models/user_message.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,14 @@ pub struct UserMessage { } impl UserMessage { - pub fn new(id: String, session_id: String, role: Role, time: models::UserMessageTime, agent: String, model: models::SessionPromptRequestModel) -> UserMessage { + pub fn new( + id: String, + session_id: String, + role: Role, + time: models::UserMessageTime, + agent: String, + model: models::SessionPromptRequestModel, + ) -> UserMessage { UserMessage { id, session_id, @@ -51,7 +58,7 @@ impl UserMessage { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Role { #[serde(rename = "user")] @@ -63,4 +70,3 @@ impl Default for Role { Self::User } } - diff --git a/crates/opencode-client/src/models/user_message_summary.rs b/crates/opencode-client/src/models/user_message_summary.rs index fb52632..1c6eb72 100644 --- a/crates/opencode-client/src/models/user_message_summary.rs +++ b/crates/opencode-client/src/models/user_message_summary.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,4 +30,3 @@ impl UserMessageSummary { } } } - diff --git a/crates/opencode-client/src/models/user_message_time.rs b/crates/opencode-client/src/models/user_message_time.rs index 3a2980d..562172e 100644 --- a/crates/opencode-client/src/models/user_message_time.rs +++ b/crates/opencode-client/src/models/user_message_time.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct UserMessageTime { impl UserMessageTime { pub fn new(created: f64) -> UserMessageTime { - UserMessageTime { - created, - } + UserMessageTime { created } } } - diff --git a/crates/opencode-client/src/models/vcs_info.rs b/crates/opencode-client/src/models/vcs_info.rs index ade0eaf..0ad87a3 100644 --- a/crates/opencode-client/src/models/vcs_info.rs +++ b/crates/opencode-client/src/models/vcs_info.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -19,9 +19,6 @@ pub struct VcsInfo { impl VcsInfo { pub fn new(branch: String) -> VcsInfo { - VcsInfo { - branch, - } + VcsInfo { branch } } } - diff --git a/crates/opencode-client/src/models/well_known_auth.rs b/crates/opencode-client/src/models/well_known_auth.rs index 278c7ec..e4e056d 100644 --- a/crates/opencode-client/src/models/well_known_auth.rs +++ b/crates/opencode-client/src/models/well_known_auth.rs @@ -4,7 +4,7 @@ * opencode api * * The version of the OpenAPI document: 0.0.3 - * + * * Generated by: https://openapi-generator.tech */ @@ -23,14 +23,10 @@ pub struct WellKnownAuth { impl WellKnownAuth { pub fn new(r#type: Type, key: String, token: String) -> WellKnownAuth { - WellKnownAuth { - r#type, - key, - token, - } + WellKnownAuth { r#type, key, token } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "wellknown")] @@ -42,4 +38,3 @@ impl Default for Type { Self::Wellknown } } - diff --git a/crates/orchestrator/src/activity_store.rs b/crates/orchestrator/src/activity_store.rs index 07f9373..f514d6a 100644 --- a/crates/orchestrator/src/activity_store.rs +++ b/crates/orchestrator/src/activity_store.rs @@ -78,10 +78,17 @@ impl SessionActivityMsg { pub fn approx_bytes(&self) -> usize { const OVERHEAD: usize = 64; match self { - Self::ToolCall { tool_name, args, .. } => { + Self::ToolCall { + tool_name, args, .. + } => { OVERHEAD + tool_name.len() + args.as_ref().map(|a| a.to_string().len()).unwrap_or(0) } - Self::ToolResult { tool_name, result, args, .. } => { + Self::ToolResult { + tool_name, + result, + args, + .. + } => { OVERHEAD + tool_name.len() + result.len() @@ -108,13 +115,18 @@ impl SessionActivityMsg { let json = match self { Self::Finished { .. } => serde_json::to_string(self) .unwrap_or_else(|_| r#"{"type":"finished","success":false}"#.to_string()), - _ => serde_json::to_string(self) - .unwrap_or_else(|_| r#"{"type":"error","message":"serialization_failed"}"#.to_string()), + _ => serde_json::to_string(self).unwrap_or_else(|_| { + r#"{"type":"error","message":"serialization_failed"}"#.to_string() + }), }; WsMessage::Text(json.into()) } - pub fn tool_call(id: impl Into, tool_name: impl Into, args: Option) -> Self { + pub fn tool_call( + id: impl Into, + tool_name: impl Into, + args: Option, + ) -> Self { Self::ToolCall { id: id.into(), tool_name: tool_name.into(), @@ -140,7 +152,11 @@ impl SessionActivityMsg { } } - pub fn agent_message(id: impl Into, content: impl Into, is_partial: bool) -> Self { + pub fn agent_message( + id: impl Into, + content: impl Into, + is_partial: bool, + ) -> Self { Self::AgentMessage { id: id.into(), content: content.into(), @@ -232,7 +248,10 @@ impl SessionActivityStore { Ok(count) } - fn activity_to_msg(&self, activity: &db::models::SessionActivity) -> Option { + fn activity_to_msg( + &self, + activity: &db::models::SessionActivity, + ) -> Option { // Reconstruct the message from the stored JSON data // The data field should contain the full serialized message serde_json::from_value(activity.data.clone()).ok() @@ -259,12 +278,8 @@ impl SessionActivityStore { let activity_id = msg_clone.id().map(|s| s.to_string()); let data = serde_json::to_value(&msg_clone).unwrap_or(serde_json::Value::Null); - let create = CreateSessionActivity::new( - session_id, - activity_type, - activity_id, - data, - ); + let create = + CreateSessionActivity::new(session_id, activity_type, activity_id, data); if let Err(e) = repo.create(&create).await { tracing::warn!("Failed to persist activity to DB: {:?}", e); @@ -287,7 +302,12 @@ impl SessionActivityStore { inner.total_bytes = inner.total_bytes.saturating_add(bytes); } - pub fn push_tool_call(&self, id: impl Into, tool_name: impl Into, args: Option) { + pub fn push_tool_call( + &self, + id: impl Into, + tool_name: impl Into, + args: Option, + ) { self.push(SessionActivityMsg::tool_call(id, tool_name, args)); } @@ -299,10 +319,17 @@ impl SessionActivityStore { result: impl Into, success: bool, ) { - self.push(SessionActivityMsg::tool_result(id, tool_name, args, result, success)); + self.push(SessionActivityMsg::tool_result( + id, tool_name, args, result, success, + )); } - pub fn push_agent_message(&self, id: impl Into, content: impl Into, is_partial: bool) { + pub fn push_agent_message( + &self, + id: impl Into, + content: impl Into, + is_partial: bool, + ) { self.push(SessionActivityMsg::agent_message(id, content, is_partial)); } @@ -338,9 +365,10 @@ impl SessionActivityStore { let rx = self.subscribe(); let hist_stream = futures::stream::iter(history.into_iter().map(Ok::<_, std::io::Error>)); - let live_stream = BroadcastStream::new(rx).filter_map( - |res: Result| async move { res.ok().map(Ok::<_, std::io::Error>) }, - ); + let live_stream = + BroadcastStream::new(rx).filter_map(|res: Result| async move { + res.ok().map(Ok::<_, std::io::Error>) + }); hist_stream.chain(live_stream) } @@ -422,7 +450,11 @@ impl SessionActivityRegistry { // Load from DB if repository is available (before acquiring write lock) if self.repository.is_some() { if let Err(e) = store.load_from_db().await { - tracing::warn!("Failed to load activities from DB for session {}: {:?}", session_id, e); + tracing::warn!( + "Failed to load activities from DB for session {}: {:?}", + session_id, + e + ); } } @@ -472,13 +504,8 @@ mod tests { assert!(matches!(tool_call, SessionActivityMsg::ToolCall { .. })); assert_eq!(tool_call.id(), Some("tc-1")); - let tool_result = SessionActivityMsg::tool_result( - "tc-1", - "read_file", - None, - "file contents", - true, - ); + let tool_result = + SessionActivityMsg::tool_result("tc-1", "read_file", None, "file contents", true); assert!(matches!(tool_result, SessionActivityMsg::ToolResult { .. })); let finished = SessionActivityMsg::finished(true, None); @@ -488,7 +515,11 @@ mod tests { #[test] fn test_activity_msg_serialization() { - let msg = SessionActivityMsg::tool_call("tc-1", "bash", Some(serde_json::json!({"command": "ls"}))); + let msg = SessionActivityMsg::tool_call( + "tc-1", + "bash", + Some(serde_json::json!({"command": "ls"})), + ); let json = serde_json::to_string(&msg).unwrap(); assert!(json.contains("tool_call")); assert!(json.contains("bash")); @@ -507,7 +538,10 @@ mod tests { assert_eq!(history.len(), 3); assert!(matches!(history[0], SessionActivityMsg::ToolCall { .. })); assert!(matches!(history[1], SessionActivityMsg::ToolResult { .. })); - assert!(matches!(history[2], SessionActivityMsg::AgentMessage { .. })); + assert!(matches!( + history[2], + SessionActivityMsg::AgentMessage { .. } + )); } #[tokio::test] @@ -519,7 +553,9 @@ mod tests { store.push_tool_call("tc-1", "test_tool", None); let msg = rx.recv().await.unwrap(); - assert!(matches!(msg, SessionActivityMsg::ToolCall { tool_name, .. } if tool_name == "test_tool")); + assert!( + matches!(msg, SessionActivityMsg::ToolCall { tool_name, .. } if tool_name == "test_tool") + ); } #[test] diff --git a/crates/orchestrator/src/executor.rs b/crates/orchestrator/src/executor.rs index e1767b7..b865665 100644 --- a/crates/orchestrator/src/executor.rs +++ b/crates/orchestrator/src/executor.rs @@ -1,584 +1,123 @@ -use db::{SessionRepository, TaskRepository}; -use events::{Event, EventBus, EventEnvelope}; use opencode_client::apis::configuration::Configuration; -use opencode_client::apis::default_api; -use opencode_client::models::{ - McpAddRequest, McpAddRequestConfig, Part, Session as OpenCodeSession, SessionCreateRequest, - SessionPromptRequest, SessionPromptRequestPartsInner, -}; -use opencode_core::{Session, SessionPhase, Task, TaskStatus, UpdateTaskRequest}; -use std::path::PathBuf; +use opencode_client::models::Part; +use opencode_core::{Session, SessionPhase, Task, TaskStatus}; use std::sync::Arc; -use tracing::{debug, error, info, instrument, warn}; +use tracing::{debug, info, warn}; use uuid::Uuid; -use vcs::{Workspace, WorkspaceManager}; -use crate::activity_store::{SessionActivityMsg, SessionActivityRegistry, SessionActivityStore}; +use crate::activity_store::SessionActivityMsg; use crate::error::{OrchestratorError, Result}; -use crate::files::{ - FileManager, FindingSeverity, FindingStatus, PhaseContext, PhaseSummary, ReviewFinding, - ReviewFindings, -}; -// Note: ExecutorEvent and OpenCodeEventSubscriber are now used internally by SessionRunner -use crate::plan_parser::{extract_phase_summary, parse_plan_phases}; use crate::prompts::PhasePrompts; -use crate::session_runner::{SessionConfig, SessionDependencies, SessionRunner}; -use crate::state_machine::TaskStateMachine; - -/// Raw JSON response from AI review -#[derive(Debug, serde::Deserialize)] -struct RawReviewResponse { - approved: bool, - summary: String, - #[serde(default)] - findings: Vec, -} - -#[derive(Debug, serde::Deserialize)] -struct RawFinding { - #[serde(default)] - file_path: Option, - #[serde(default)] - line_start: Option, - #[serde(default)] - line_end: Option, - title: String, - description: String, - #[serde(default = "default_severity")] - severity: String, -} - -fn default_severity() -> String { - "warning".to_string() -} +use crate::services::{ + ExecutorContext, FixPhase, ImplementationPhase, MessageParser, PlanningPhase, ReviewPhase, +}; -const DEFAULT_PROVIDER_ID: &str = "anthropic"; -const DEFAULT_MODEL_ID: &str = "claude-sonnet-4-20250514"; +pub use crate::services::executor_context::ExecutorConfig; +pub use crate::services::message_parser::ReviewResult; #[derive(Debug, Clone)] -pub struct ExecutorConfig { - pub require_plan_approval: bool, - pub require_human_review: bool, - pub max_review_iterations: u32, - pub repo_path: PathBuf, -} - -impl Default for ExecutorConfig { - fn default() -> Self { - Self { - require_plan_approval: true, - require_human_review: true, - max_review_iterations: 3, - repo_path: PathBuf::from("."), - } - } -} - -impl ExecutorConfig { - pub fn new(repo_path: impl Into) -> Self { - Self { - repo_path: repo_path.into(), - ..Default::default() - } - } - - pub fn with_plan_approval(mut self, require: bool) -> Self { - self.require_plan_approval = require; - self - } - - pub fn with_human_review(mut self, require: bool) -> Self { - self.require_human_review = require; - self - } - - pub fn with_max_iterations(mut self, max: u32) -> Self { - self.max_review_iterations = max; - self - } -} - -pub struct TaskExecutor { - opencode_config: Arc, - config: ExecutorConfig, - file_manager: FileManager, - workspace_manager: Option>, - session_repo: Option>, - task_repo: Option>, - event_bus: Option, - activity_registry: Option, - provider_id: String, - model_id: String, +pub enum PhaseResult { + SessionCreated { + session_id: String, + }, + PlanCreated { + session_id: String, + plan_path: String, + }, + AwaitingApproval { + phase: SessionPhase, + }, + ReviewPassed { + session_id: String, + }, + ReviewFailed { + session_id: String, + feedback: String, + iteration: u32, + }, + FixCompleted { + session_id: String, + }, + PhasedImplementationComplete { + total_phases: u32, + }, + MaxIterationsExceeded { + iterations: u32, + }, + Completed, } -/// Result returned immediately when starting async execution #[derive(Debug, Clone)] pub struct StartedExecution { - /// The Studio session ID (our internal ID) pub session_id: Uuid, - /// The OpenCode session ID (external) pub opencode_session_id: String, - /// The phase being executed pub phase: SessionPhase, } +pub struct TaskExecutor { + ctx: ExecutorContext, +} + impl TaskExecutor { pub fn new(opencode_config: Arc, config: ExecutorConfig) -> Self { - let file_manager = FileManager::new(&config.repo_path); Self { - opencode_config, - config, - file_manager, - workspace_manager: None, - session_repo: None, - task_repo: None, - event_bus: None, - activity_registry: None, - provider_id: DEFAULT_PROVIDER_ID.to_string(), - model_id: DEFAULT_MODEL_ID.to_string(), + ctx: ExecutorContext::new(opencode_config, config), } } pub fn with_model(mut self, provider_id: &str, model_id: &str) -> Self { - self.provider_id = provider_id.to_string(); - self.model_id = model_id.to_string(); + self.ctx = self.ctx.with_model(provider_id, model_id); self } - pub fn with_workspace_manager(mut self, manager: Arc) -> Self { - self.workspace_manager = Some(manager); + pub fn with_workspace_manager(mut self, manager: Arc) -> Self { + self.ctx = self.ctx.with_workspace_manager(manager); self } - pub fn with_session_repo(mut self, repo: Arc) -> Self { - self.session_repo = Some(repo); + pub fn with_session_repo(mut self, repo: Arc) -> Self { + self.ctx = self.ctx.with_session_repo(repo); self } - pub fn with_task_repo(mut self, repo: Arc) -> Self { - self.task_repo = Some(repo); + pub fn with_task_repo(mut self, repo: Arc) -> Self { + self.ctx = self.ctx.with_task_repo(repo); self } - pub fn with_event_bus(mut self, bus: EventBus) -> Self { - self.event_bus = Some(bus); + pub fn with_event_bus(mut self, bus: events::EventBus) -> Self { + self.ctx = self.ctx.with_event_bus(bus); self } - pub fn with_activity_registry(mut self, registry: SessionActivityRegistry) -> Self { - self.activity_registry = Some(registry); + pub fn with_activity_registry( + mut self, + registry: crate::activity_store::SessionActivityRegistry, + ) -> Self { + self.ctx = self.ctx.with_activity_registry(registry); self } - /// Get a reference to the file manager for reading plans/reviews - pub fn file_manager(&self) -> &FileManager { - &self.file_manager + pub fn file_manager(&self) -> &crate::files::FileManager { + self.ctx.file_manager() } - #[instrument(skip(self, task), fields(task_id = %task.id, task_title = %task.title))] pub fn transition(&self, task: &mut Task, to: TaskStatus) -> Result<()> { - let from = task.status; - info!( - from = %from.as_str(), - to = %to.as_str(), - "Task state transition" - ); - - TaskStateMachine::validate_transition(&task.status, &to)?; - task.status = to; - task.updated_at = chrono::Utc::now(); - - self.emit_event(Event::TaskStatusChanged { - task_id: task.id, - from_status: from.as_str().to_string(), - to_status: to.as_str().to_string(), - }); - - debug!( - task_id = %task.id, - new_status = %to.as_str(), - "State transition completed" - ); - - Ok(()) - } - - fn emit_event(&self, event: Event) { - if let Some(ref bus) = self.event_bus { - bus.publish(EventEnvelope::new(event)); - } - } - - async fn persist_session(&self, session: &Session) -> Result<()> { - if let Some(ref repo) = self.session_repo { - repo.create(session).await?; - } - Ok(()) - } - - async fn update_session(&self, session: &Session) -> Result<()> { - if let Some(ref repo) = self.session_repo { - repo.update(session).await?; - } - Ok(()) + self.ctx.transition(task, to) } pub fn extract_text_from_parts(parts: &[Part]) -> String { - parts - .iter() - .filter_map(|part| { - if part.r#type == opencode_client::models::part::Type::Text { - part.text.as_deref() - } else { - None - } - }) - .collect::>() - .join("\n") - } - - fn extract_text_from_messages_inner( - msg: &opencode_client::models::SessionMessages200ResponseInner, - ) -> String { - Self::extract_text_from_parts(&msg.parts) - } - - fn create_text_part(text: &str) -> SessionPromptRequestPartsInner { - SessionPromptRequestPartsInner { - r#type: opencode_client::models::session_prompt_request_parts_inner::Type::Text, - text: text.to_string(), - id: None, - synthetic: None, - ignored: None, - time: None, - metadata: None, - mime: String::new(), - filename: None, - url: String::new(), - source: None, - name: String::new(), - prompt: String::new(), - description: String::new(), - agent: String::new(), - command: None, - } + MessageParser::extract_text_from_parts(parts) } pub fn parse_message_parts(parts: &[Part]) -> Vec { - use opencode_client::models::part::Type; - - let mut activities = Vec::new(); - - for part in parts { - match part.r#type { - Type::Text => { - let id = format!("text-{}", uuid::Uuid::new_v4()); - let text = part.text.as_deref().unwrap_or(""); - activities.push(SessionActivityMsg::agent_message(&id, text, false)); - } - Type::Reasoning => { - let id = format!("reasoning-{}", uuid::Uuid::new_v4()); - activities.push(SessionActivityMsg::Reasoning { - id, - content: part.text.clone().unwrap_or_default(), - timestamp: chrono::Utc::now(), - }); - } - Type::Tool => { - let call_id = part.call_id.as_deref().unwrap_or(""); - let tool_name = part.tool.as_deref().unwrap_or("unknown"); - - if let Some(ref state) = part.state { - let output = state.output.as_deref().unwrap_or(""); - let error = state.error.as_deref().unwrap_or(""); - let is_completed = !output.is_empty() || !error.is_empty(); - - if is_completed { - let success = error.is_empty(); - let result = if success { output } else { error }; - activities.push(SessionActivityMsg::tool_result( - call_id, tool_name, None, result, success, - )); - } else { - activities - .push(SessionActivityMsg::tool_call(call_id, tool_name, None)); - } - } else { - // No state yet, treat as pending tool call - activities.push(SessionActivityMsg::tool_call(call_id, tool_name, None)); - } - } - Type::StepStart => { - let id = format!("step-{}", uuid::Uuid::new_v4()); - activities.push(SessionActivityMsg::StepStart { - id, - step_name: None, - timestamp: chrono::Utc::now(), - }); - } - _ => { - debug!("Skipping part type: {:?}", part.r#type); - } - } - } - - activities + MessageParser::parse_message_parts(parts) } - /// Parse SSE part format (different from HTTP response Part struct) - /// SSE parts have: id, messageID, sessionID, text, time.start/end, type - /// Tool parts have: callID, tool, state.status/input/output/error pub fn parse_sse_part(part: &serde_json::Value) -> Option { - let part_type = part.get("type")?.as_str()?; - let id = part.get("id").and_then(|v| v.as_str()).unwrap_or("unknown"); - - match part_type { - "text" => { - let text = part.get("text").and_then(|v| v.as_str()).unwrap_or(""); - // Check if this is a partial or complete message - let is_partial = part.get("time").and_then(|t| t.get("end")).is_none(); - Some(SessionActivityMsg::agent_message(id, text, is_partial)) - } - "reasoning" => { - let content = part.get("text").and_then(|v| v.as_str()).unwrap_or(""); - Some(SessionActivityMsg::Reasoning { - id: id.to_string(), - content: content.to_string(), - timestamp: chrono::Utc::now(), - }) - } - "tool" => { - let call_id = part.get("callID").and_then(|v| v.as_str()).unwrap_or(id); - let tool_name = part - .get("tool") - .and_then(|v| v.as_str()) - .unwrap_or("unknown"); - let state = part.get("state"); - - let status = state - .and_then(|s| s.get("status")) - .and_then(|v| v.as_str()) - .unwrap_or("pending"); - - // If status is "completed" or "error", it's a finished tool call - // OpenCode uses "completed" for success, not "success" - if status == "completed" || status == "error" { - let success = status == "completed"; - let output = state - .and_then(|s| s.get("output")) - .and_then(|v| v.as_str()) - .unwrap_or(""); - let error = state - .and_then(|s| s.get("error")) - .and_then(|v| v.as_str()) - .unwrap_or(""); - let result = if success { output } else { error }; - - Some(SessionActivityMsg::tool_result( - call_id, tool_name, None, result, success, - )) - } else { - // Pending or running - emit tool call - Some(SessionActivityMsg::tool_call(call_id, tool_name, None)) - } - } - "step-start" => Some(SessionActivityMsg::StepStart { - id: id.to_string(), - step_name: None, - timestamp: chrono::Utc::now(), - }), - _ => { - debug!(part_type = %part_type, "Skipping unknown SSE part type"); - None - } - } - } - - fn push_activities_to_store(&self, store: &SessionActivityStore, parts: &[Part]) { - for activity in Self::parse_message_parts(parts) { - store.push(activity); - } - } - - fn get_activity_store(&self, session_id: Uuid) -> Option> { - self.activity_registry - .as_ref() - .map(|reg| reg.get_or_create(session_id)) - } - - async fn create_opencode_session(&self) -> Result { - self.create_opencode_session_in_dir(&self.config.repo_path) - .await - } - - async fn create_opencode_session_in_dir( - &self, - working_dir: &std::path::Path, - ) -> Result { - let request = SessionCreateRequest { - title: None, - parent_id: None, - }; - - // Pass the working directory so OpenCode works in the correct context - let directory = working_dir.to_str(); - info!( - directory = ?directory, - "Creating OpenCode session in directory" - ); - - default_api::session_create(&self.opencode_config, directory, Some(request)) - .await - .map_err(|e| { - error!(error = %e, directory = ?directory, "Failed to create OpenCode session"); - OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e)) - }) - } - - /// Add the MCP findings server to OpenCode for a specific review session - async fn add_mcp_findings_server( - &self, - task_id: Uuid, - session_id: Uuid, - workspace_path: &std::path::Path, - ) -> Result<()> { - let mcp_binary = self.get_mcp_binary_path(); - - let mut environment = std::collections::HashMap::new(); - environment.insert("OPENCODE_TASK_ID".to_string(), task_id.to_string()); - environment.insert("OPENCODE_SESSION_ID".to_string(), session_id.to_string()); - environment.insert( - "OPENCODE_WORKSPACE_PATH".to_string(), - workspace_path.to_string_lossy().to_string(), - ); - - let mut config = McpAddRequestConfig::local(vec![mcp_binary]); - config.environment = Some(environment); - config.enabled = Some(true); - config.timeout = Some(10000); // 10 seconds - - let request = McpAddRequest::new("opencode-findings".to_string(), config); - let directory = workspace_path.to_str(); - - info!( - task_id = %task_id, - session_id = %session_id, - "Adding MCP findings server to OpenCode" - ); - - default_api::mcp_add(&self.opencode_config, directory, Some(request)) - .await - .map_err(|e| { - error!(error = %e, "Failed to add MCP findings server"); - OrchestratorError::OpenCodeError(format!("Failed to add MCP server: {}", e)) - })?; - - // Connect the MCP server - default_api::mcp_connect(&self.opencode_config, "opencode-findings", directory) - .await - .map_err(|e| { - error!(error = %e, "Failed to connect MCP findings server"); - OrchestratorError::OpenCodeError(format!("Failed to connect MCP server: {}", e)) - })?; - - info!("MCP findings server connected"); - Ok(()) - } - - /// Remove the MCP findings server from OpenCode - async fn remove_mcp_findings_server(&self, workspace_path: &std::path::Path) -> Result<()> { - let directory = workspace_path.to_str(); - - info!("Disconnecting MCP findings server"); - - // Disconnect the MCP server (ignore errors - server might already be disconnected) - if let Err(e) = - default_api::mcp_disconnect(&self.opencode_config, "opencode-findings", directory).await - { - warn!(error = %e, "Failed to disconnect MCP findings server (may already be disconnected)"); - } - - Ok(()) - } - - /// Get the path to the MCP findings binary - fn get_mcp_binary_path(&self) -> String { - // In development, use the debug build path - // In production, this would be installed alongside the main binary - if cfg!(debug_assertions) { - // Try to find the binary relative to the current executable - if let Ok(exe_path) = std::env::current_exe() { - if let Some(parent) = exe_path.parent() { - let mcp_path = parent.join("opencode-mcp-findings"); - if mcp_path.exists() { - return mcp_path.to_string_lossy().to_string(); - } - } - } - } - // Fall back to assuming it's in PATH - "opencode-mcp-findings".to_string() - } - - async fn send_opencode_message_with_activity( - &self, - session_id: &str, - prompt: &str, - activity_store: Option<&SessionActivityStore>, - ) -> Result { - self.send_opencode_message_in_dir( - session_id, - prompt, - activity_store, - &self.config.repo_path, - ) - .await - } - - async fn send_opencode_message_in_dir( - &self, - session_id: &str, - prompt: &str, - activity_store: Option<&SessionActivityStore>, - working_dir: &std::path::Path, - ) -> Result { - let model = opencode_client::models::SessionPromptRequestModel { - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - }; - - let request = SessionPromptRequest { - parts: vec![Self::create_text_part(prompt)], - model: Some(Box::new(model)), - message_id: None, - agent: None, - no_reply: None, - tools: None, - system: None, - variant: None, - }; - - let directory = working_dir.to_str(); - let response = default_api::session_prompt( - &self.opencode_config, - session_id, - directory, - Some(request), - ) - .await - .map_err(|e| { - error!(error = %e, directory = ?directory, "Failed to send message to OpenCode"); - OrchestratorError::OpenCodeError(format!("Failed to send message: {}", e)) - })?; - - if let Some(store) = activity_store { - self.push_activities_to_store(store, &response.parts); - } - - Ok(Self::extract_text_from_parts(&response.parts)) + MessageParser::parse_sse_part(part) } - #[instrument(skip(self, task), fields(task_id = %task.id, status = %task.status.as_str()))] pub async fn execute_phase(&self, task: &mut Task) -> Result { info!( task_id = %task.id, @@ -589,46 +128,46 @@ impl TaskExecutor { let result = match task.status { TaskStatus::Todo => { debug!("Task in TODO, transitioning to PLANNING"); - self.transition(task, TaskStatus::Planning)?; - self.run_planning_session(task).await + self.ctx.transition(task, TaskStatus::Planning)?; + PlanningPhase::run(&self.ctx, task).await } TaskStatus::Planning => { debug!("Task in PLANNING, running planning session"); - self.run_planning_session(task).await + PlanningPhase::run(&self.ctx, task).await } TaskStatus::PlanningReview => { - if self.config.require_plan_approval { + if self.ctx.config.require_plan_approval { info!("Plan requires approval, awaiting human review"); Ok(PhaseResult::AwaitingApproval { phase: SessionPhase::Planning, }) } else { debug!("Auto-approving plan, transitioning to IN_PROGRESS"); - self.transition(task, TaskStatus::InProgress)?; - self.run_implementation_session(task).await + self.ctx.transition(task, TaskStatus::InProgress)?; + ImplementationPhase::run(&self.ctx, task).await } } TaskStatus::InProgress => { debug!("Task IN_PROGRESS, running implementation session"); - self.run_implementation_session(task).await + ImplementationPhase::run(&self.ctx, task).await } TaskStatus::AiReview => { debug!("Task in AI_REVIEW, running AI review"); - self.run_ai_review(task, 0).await + ReviewPhase::run(&self.ctx, task, 0).await } TaskStatus::Fix => { debug!("Task in FIX, running fix session"); - self.run_fix_session(task).await + FixPhase::run(&self.ctx, task).await } TaskStatus::Review => { - if self.config.require_human_review { + if self.ctx.config.require_human_review { info!("Implementation requires human review, awaiting approval"); Ok(PhaseResult::AwaitingApproval { phase: SessionPhase::Review, }) } else { debug!("Auto-approving review, transitioning to DONE"); - self.transition(task, TaskStatus::Done)?; + self.ctx.transition(task, TaskStatus::Done)?; Ok(PhaseResult::Completed) } } @@ -644,7 +183,7 @@ impl TaskExecutor { result = ?phase_result, "Phase execution completed" ), - Err(e) => error!( + Err(e) => tracing::error!( task_id = %task.id, error = %e, "Phase execution failed" @@ -662,35 +201,37 @@ impl TaskExecutor { } if task.status == TaskStatus::Todo { - self.transition(task, TaskStatus::Planning)?; + self.ctx.transition(task, TaskStatus::Planning)?; } if task.status == TaskStatus::Planning { - let result = self.run_planning_session(task).await?; - if self.config.require_plan_approval { + let result = PlanningPhase::run(&self.ctx, task).await?; + if self.ctx.config.require_plan_approval { return Ok(result); } } if task.status == TaskStatus::PlanningReview { - self.transition(task, TaskStatus::InProgress)?; + self.ctx.transition(task, TaskStatus::InProgress)?; } if task.status == TaskStatus::InProgress { - self.run_implementation_session(task).await?; + ImplementationPhase::run(&self.ctx, task).await?; } let mut iteration = 0; - while task.status == TaskStatus::AiReview && iteration < self.config.max_review_iterations { - let result = self.run_ai_review(task, iteration).await?; + while task.status == TaskStatus::AiReview + && iteration < self.ctx.config.max_review_iterations + { + let result = ReviewPhase::run(&self.ctx, task, iteration).await?; match result { PhaseResult::ReviewPassed { .. } => { - if self.config.require_human_review { + if self.ctx.config.require_human_review { return Ok(PhaseResult::AwaitingApproval { phase: SessionPhase::Review, }); } else { - self.transition(task, TaskStatus::Done)?; + self.ctx.transition(task, TaskStatus::Done)?; return Ok(PhaseResult::Completed); } } @@ -699,17 +240,17 @@ impl TaskExecutor { "AI review failed (iteration {}), running fix iteration", iteration ); - self.run_fix_iteration(task, &feedback).await?; + FixPhase::run_iteration(&self.ctx, task, &feedback).await?; iteration += 1; } _ => return Ok(result), } } - if iteration >= self.config.max_review_iterations { + if iteration >= self.ctx.config.max_review_iterations { warn!( "Task {} exceeded max review iterations ({})", - task.id, self.config.max_review_iterations + task.id, self.ctx.config.max_review_iterations ); return Ok(PhaseResult::MaxIterationsExceeded { iterations: iteration, @@ -717,12 +258,12 @@ impl TaskExecutor { } if task.status == TaskStatus::Review { - if self.config.require_human_review { + if self.ctx.config.require_human_review { return Ok(PhaseResult::AwaitingApproval { phase: SessionPhase::Review, }); } - self.transition(task, TaskStatus::Done)?; + self.ctx.transition(task, TaskStatus::Done)?; } Ok(PhaseResult::Completed) @@ -735,2060 +276,130 @@ impl TaskExecutor { "Starting async phase execution" ); - let phase = match task.status { - TaskStatus::Todo | TaskStatus::Planning => SessionPhase::Planning, - TaskStatus::PlanningReview | TaskStatus::InProgress => SessionPhase::Implementation, - TaskStatus::AiReview => SessionPhase::Review, - TaskStatus::Fix => SessionPhase::Fix, - TaskStatus::Review => SessionPhase::Review, - TaskStatus::Done => { - return Err(OrchestratorError::ExecutionFailed( - "Task is already done".to_string(), - )); - } - }; - if task.status == TaskStatus::Todo { - self.transition(task, TaskStatus::Planning)?; - } - - // Route to phase-specific handlers using SessionRunner - match phase { - SessionPhase::Planning => self.start_planning_with_runner(task).await, - SessionPhase::Implementation => self.start_implementation_with_runner(task).await, - SessionPhase::Review => self.start_review_with_runner(task).await, - SessionPhase::Fix => self.start_fix_with_runner(task).await, + self.ctx.transition(task, TaskStatus::Planning)?; } - } - /// Start implementation phase using SessionRunner abstraction - async fn start_implementation_with_runner(&self, task: &mut Task) -> Result { - info!(task_id = %task.id, "Starting implementation with SessionRunner"); - - // Setup workspace if not already created - if task.workspace_path.is_none() { - if let Some(ref wm) = self.workspace_manager { - debug!("Setting up VCS workspace for async task execution"); - match wm.setup_workspace(&task.id.to_string()).await { - Ok(workspace) => { - task.workspace_path = Some(workspace.path.to_string_lossy().to_string()); - info!( - workspace_path = %workspace.path.display(), - branch = %workspace.branch_name, - "VCS workspace created for async execution" - ); - self.emit_event(Event::WorkspaceCreated { - task_id: task.id, - path: workspace.path.to_string_lossy().to_string(), - }); - } - Err(e) => { - error!(error = %e, "Failed to setup workspace for async execution"); - return Err(OrchestratorError::ExecutionFailed(format!( - "Failed to setup workspace: {}", - e - ))); - } - } - // Persist workspace_path to database - if let Some(ref repo) = self.task_repo { - let update = UpdateTaskRequest { - workspace_path: task.workspace_path.clone(), - ..Default::default() - }; - if let Err(e) = repo.update(task.id, &update).await { - error!(error = %e, "Failed to persist workspace_path to database"); - } - } - } else { - warn!("No workspace manager configured, implementation will run in root directory"); + match task.status { + TaskStatus::Todo | TaskStatus::Planning => { + PlanningPhase::start_async(&self.ctx, task).await } + TaskStatus::PlanningReview | TaskStatus::InProgress => { + ImplementationPhase::start_async(&self.ctx, task).await + } + TaskStatus::AiReview => ReviewPhase::start_async(&self.ctx, task).await, + TaskStatus::Fix => FixPhase::start_async(&self.ctx, task).await, + TaskStatus::Review => ReviewPhase::start_async(&self.ctx, task).await, + TaskStatus::Done => Err(OrchestratorError::ExecutionFailed( + "Task is already done".to_string(), + )), } + } - // Determine working directory - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); + pub async fn start_fix_with_comments( + &self, + task: &Task, + comments: &[crate::prompts::UserReviewComment], + ) -> Result { + FixPhase::start_with_comments(&self.ctx, task, comments).await + } - // Check for multi-phase plan - if self.file_manager.plan_exists(task.id).await { - let plan_content = self.file_manager.read_plan(task.id).await?; - let parsed = parse_plan_phases(&plan_content); + pub async fn approve_plan(&self, task: &mut Task) -> Result<()> { + info!(task_id = %task.id, "Plan APPROVED by human reviewer"); - info!( - task_id = %task.id, - phases_count = parsed.phases.len(), - is_single_phase = parsed.is_single_phase(), - "Checking plan for phased implementation" + if task.status != TaskStatus::PlanningReview { + warn!( + current_status = %task.status.as_str(), + "Cannot approve plan - task not in PlanningReview state" ); + return Err(OrchestratorError::InvalidTransition { + from: task.status.as_str().to_string(), + to: "InProgress (plan approval)".to_string(), + }); + } + self.ctx.transition(task, TaskStatus::InProgress)?; + info!(task_id = %task.id, "Task ready for implementation"); + Ok(()) + } - if !parsed.is_single_phase() { - info!( - task_id = %task.id, - total_phases = parsed.total_phases(), - "Using phased implementation for multi-phase plan" - ); - return self - .start_phased_implementation_async(task, parsed, working_dir) - .await; - } + pub async fn reject_plan(&self, task: &mut Task, feedback: &str) -> Result { + info!( + task_id = %task.id, + feedback_length = feedback.len(), + "Plan REJECTED by human reviewer, re-planning" + ); + + if task.status != TaskStatus::PlanningReview { + warn!( + current_status = %task.status.as_str(), + "Cannot reject plan - task not in PlanningReview state" + ); + return Err(OrchestratorError::InvalidTransition { + from: task.status.as_str().to_string(), + to: "Planning (plan rejection)".to_string(), + }); } + self.ctx.transition(task, TaskStatus::Planning)?; - // Single-phase implementation - let plan = if self.file_manager.plan_exists(task.id).await { - self.file_manager.read_plan(task.id).await.ok() - } else { - None - }; - let prompt = PhasePrompts::implementation_with_plan(task, plan.as_deref()); - - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Implementation, - prompt, - working_dir, - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - mcp_config: None, - implementation_phase: None, - skip_task_status_update: false, - }; + let mut session = Session::new(task.id, SessionPhase::Planning); + let opencode_session = self + .ctx + .opencode_client + .create_session(&self.ctx.config.repo_path) + .await?; + let session_id_str = opencode_session.id.to_string(); - let deps = SessionDependencies::new( - Arc::clone(&self.opencode_config), - self.session_repo.clone(), - self.task_repo.clone(), - self.event_bus.clone(), - self.activity_registry.clone(), - self.file_manager.clone(), + info!( + opencode_session_id = %session_id_str, + "OpenCode session created for re-planning" ); - let result = SessionRunner::start(config, deps).await?; + session.start(session_id_str.clone()); + self.ctx.persist_session(&session).await?; - Ok(StartedExecution { - session_id: result.session_id, - opencode_session_id: result.opencode_session_id, - phase: SessionPhase::Implementation, - }) - } + let activity_store = self.ctx.get_activity_store(session.id); - /// Start review phase using SessionRunner abstraction - async fn start_review_with_runner(&self, task: &Task) -> Result { - info!(task_id = %task.id, "Starting review with SessionRunner"); - - // Determine working directory - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // Setup MCP server for AI review - let mcp_config = if task.status == TaskStatus::AiReview { - // Create a temporary session ID for MCP setup - let temp_session_id = Uuid::new_v4(); - match self - .add_mcp_findings_server(task.id, temp_session_id, &working_dir) - .await - { - Ok(_) => { - info!(task_id = %task.id, "MCP findings server added for review"); - Some(crate::session_runner::McpConfig { - workspace_path: working_dir.clone(), - setup_success: true, - }) + let prompt = PhasePrompts::replan(task, feedback); + let response_content = self + .ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &self.ctx.config.repo_path, + activity_store.as_deref(), + ) + .await; + + let response_content = match response_content { + Ok(content) => { + if let Some(ref store) = activity_store { + store.push_finished(true, None); } - Err(e) => { - warn!(error = %e, "Failed to add MCP server, falling back to JSON parsing"); - None + content + } + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); } + return Err(e); } - } else { - None }; - // Get diff for review - let diff = self.get_workspace_diff(task).await.unwrap_or_default(); - let prompt = if mcp_config.is_some() { - PhasePrompts::review_with_mcp(task, &diff) - } else { - PhasePrompts::review(task, &diff) - }; + let plan_path = self + .ctx + .file_manager + .write_plan(task.id, &response_content) + .await?; - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Review, - prompt, - working_dir, - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - mcp_config, - implementation_phase: None, - skip_task_status_update: false, - }; + info!(plan_path = %plan_path.display(), "New plan saved"); - let deps = SessionDependencies::new( - Arc::clone(&self.opencode_config), - self.session_repo.clone(), - self.task_repo.clone(), - self.event_bus.clone(), - self.activity_registry.clone(), - self.file_manager.clone(), - ); + session.complete(); + self.ctx.update_session(&session).await?; - let result = SessionRunner::start(config, deps).await?; + self.ctx.transition(task, TaskStatus::PlanningReview)?; - Ok(StartedExecution { - session_id: result.session_id, - opencode_session_id: result.opencode_session_id, - phase: SessionPhase::Review, - }) - } - - /// Start fix phase using SessionRunner abstraction - async fn start_fix_with_runner(&self, task: &Task) -> Result { - info!(task_id = %task.id, "Starting fix with SessionRunner"); - - // Determine working directory - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // MCP should already be set up from review phase - let mcp_config = Some(crate::session_runner::McpConfig { - workspace_path: working_dir.clone(), - setup_success: true, - }); - - let prompt = PhasePrompts::fix_with_mcp(task); - - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Fix, - prompt, - working_dir, - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - mcp_config, - implementation_phase: None, - skip_task_status_update: false, - }; - - let deps = SessionDependencies::new( - Arc::clone(&self.opencode_config), - self.session_repo.clone(), - self.task_repo.clone(), - self.event_bus.clone(), - self.activity_registry.clone(), - self.file_manager.clone(), - ); - - let result = SessionRunner::start(config, deps).await?; - - Ok(StartedExecution { - session_id: result.session_id, - opencode_session_id: result.opencode_session_id, - phase: SessionPhase::Fix, - }) - } - - /// Start fix phase with user-provided review comments - pub async fn start_fix_with_comments( - &self, - task: &Task, - comments: &[crate::prompts::UserReviewComment], - ) -> Result { - info!( - task_id = %task.id, - comment_count = comments.len(), - "Starting fix with user comments" - ); - - // Determine working directory - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // MCP should already be set up from review phase - let mcp_config = Some(crate::session_runner::McpConfig { - workspace_path: working_dir.clone(), - setup_success: true, - }); - - let prompt = PhasePrompts::fix_user_comments(task, comments); - - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Fix, - prompt, - working_dir, - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - mcp_config, - implementation_phase: None, - skip_task_status_update: false, - }; - - let deps = SessionDependencies::new( - Arc::clone(&self.opencode_config), - self.session_repo.clone(), - self.task_repo.clone(), - self.event_bus.clone(), - self.activity_registry.clone(), - self.file_manager.clone(), - ); - - let result = SessionRunner::start(config, deps).await?; - - Ok(StartedExecution { - session_id: result.session_id, - opencode_session_id: result.opencode_session_id, - phase: SessionPhase::Fix, - }) - } - - /// Start planning phase using SessionRunner abstraction - async fn start_planning_with_runner(&self, task: &Task) -> Result { - info!(task_id = %task.id, "Starting planning with SessionRunner"); - - let prompt = PhasePrompts::planning(task); - - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Planning, - prompt, - working_dir: self.config.repo_path.clone(), - provider_id: self.provider_id.clone(), - model_id: self.model_id.clone(), - mcp_config: None, - implementation_phase: None, - skip_task_status_update: false, - }; - - let deps = SessionDependencies::new( - Arc::clone(&self.opencode_config), - self.session_repo.clone(), - self.task_repo.clone(), - self.event_bus.clone(), - self.activity_registry.clone(), - self.file_manager.clone(), - ); - - let result = SessionRunner::start(config, deps).await?; - - info!( - task_id = %task.id, - session_id = %result.session_id, - opencode_session_id = %result.opencode_session_id, - "Planning started via SessionRunner" - ); - - Ok(StartedExecution { - session_id: result.session_id, - opencode_session_id: result.opencode_session_id, - phase: SessionPhase::Planning, - }) - } - - #[instrument(skip(self, task), fields(task_id = %task.id))] - async fn run_planning_session(&self, task: &mut Task) -> Result { - info!( - task_id = %task.id, - task_title = %task.title, - "Starting PLANNING session" - ); - - let mut session = Session::new(task.id, SessionPhase::Planning); - - debug!("Creating OpenCode session for planning"); - let opencode_session = self.create_opencode_session().await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - "OpenCode session created" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - debug!("Generating planning prompt"); - let prompt = PhasePrompts::planning(task); - debug!( - prompt_length = prompt.len(), - "Sending planning prompt to OpenCode" - ); - - let response_content = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - let response_content = match response_content { - Ok(content) => { - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - content - } - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - }; - - info!( - response_length = response_content.len(), - "Received planning response" - ); - - let plan_path = self - .file_manager - .write_plan(task.id, &response_content) - .await?; - - info!(plan_path = %plan_path.display(), "Plan saved to file"); - - session.complete(); - self.update_session(&session).await?; - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success: true, - }); - - self.transition(task, TaskStatus::PlanningReview)?; - - info!( - task_id = %task.id, - "PLANNING session completed, awaiting review" - ); - - Ok(PhaseResult::PlanCreated { - session_id: session_id_str, - plan_path: plan_path.to_string_lossy().to_string(), - }) - } - - #[instrument(skip(self, task), fields(task_id = %task.id))] - async fn run_implementation_session(&self, task: &mut Task) -> Result { - info!( - task_id = %task.id, - task_title = %task.title, - "Starting IMPLEMENTATION session" - ); - - // Check if plan has multiple phases - if self.file_manager.plan_exists(task.id).await { - let plan_content = self.file_manager.read_plan(task.id).await?; - - debug!( - task_id = %task.id, - plan_length = plan_content.len(), - plan_preview = %plan_content.chars().take(500).collect::(), - "Read plan content for phase detection" - ); - - let parsed = parse_plan_phases(&plan_content); - - info!( - task_id = %task.id, - phases_count = parsed.phases.len(), - is_single_phase = parsed.is_single_phase(), - total_phases = parsed.total_phases(), - phase_titles = ?parsed.phases.iter().map(|p| &p.title).collect::>(), - "Plan parsed for implementation" - ); - - if !parsed.is_single_phase() { - info!( - task_id = %task.id, - total_phases = parsed.total_phases(), - "Plan has multiple phases, using phased implementation" - ); - return self.run_phased_implementation(task, parsed).await; - } else { - info!( - task_id = %task.id, - "Plan has single phase, using single implementation session" - ); - } - } else { - warn!( - task_id = %task.id, - "No plan file found for task" - ); - } - - // Single phase - use the original implementation - self.run_single_implementation_session(task).await - } - - /// Run a single (non-phased) implementation session - async fn run_single_implementation_session(&self, task: &mut Task) -> Result { - let mut session = Session::new(task.id, SessionPhase::Implementation); - - if let Some(ref wm) = self.workspace_manager { - debug!("Setting up VCS workspace for task"); - let workspace = wm - .setup_workspace(&task.id.to_string()) - .await - .map_err(|e| { - error!(error = %e, "Failed to setup workspace"); - OrchestratorError::ExecutionFailed(format!("Failed to setup workspace: {}", e)) - })?; - task.workspace_path = Some(workspace.path.to_string_lossy().to_string()); - - info!( - workspace_path = %workspace.path.display(), - branch = %workspace.branch_name, - "VCS workspace created" - ); - - self.emit_event(Event::WorkspaceCreated { - task_id: task.id, - path: workspace.path.to_string_lossy().to_string(), - }); - } else { - warn!("No workspace manager configured, skipping VCS workspace setup"); - } - - // Determine working directory - use workspace if available, otherwise root - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - debug!( - working_dir = %working_dir.display(), - has_workspace = task.workspace_path.is_some(), - "Creating OpenCode session for implementation" - ); - let opencode_session = self.create_opencode_session_in_dir(&working_dir).await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - working_dir = %working_dir.display(), - "OpenCode session created for implementation" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - let plan = if self.file_manager.plan_exists(task.id).await { - debug!("Loading existing plan for implementation"); - self.file_manager.read_plan(task.id).await.ok() - } else { - debug!("No existing plan found, proceeding without plan"); - None - }; - - debug!( - has_plan = plan.is_some(), - "Generating implementation prompt" - ); - let prompt = PhasePrompts::implementation_with_plan(task, plan.as_deref()); - debug!( - prompt_length = prompt.len(), - "Sending implementation prompt to OpenCode" - ); - - let response = self - .send_opencode_message_in_dir( - &session_id_str, - &prompt, - activity_store.as_deref(), - &working_dir, - ) - .await; - - match response { - Ok(_) => { - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - } - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - } - - info!("Implementation response received from OpenCode"); - - session.complete(); - self.update_session(&session).await?; - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success: true, - }); - - self.transition(task, TaskStatus::AiReview)?; - - info!( - task_id = %task.id, - "IMPLEMENTATION session completed, proceeding to AI review" - ); - - Ok(PhaseResult::SessionCreated { - session_id: session_id_str, - }) - } - - /// Run phased implementation - each phase in a separate session - async fn run_phased_implementation( - &self, - task: &mut Task, - parsed_plan: crate::files::ParsedPlan, - ) -> Result { - // Load or create phase context - let mut context = self - .file_manager - .read_phase_context(task.id) - .await? - .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); - - info!( - task_id = %task.id, - current_phase = context.phase_number, - total_phases = context.total_phases, - "Running phased implementation" - ); - - // Setup workspace if not already done - if task.workspace_path.is_none() { - if let Some(ref wm) = self.workspace_manager { - let workspace = wm - .setup_workspace(&task.id.to_string()) - .await - .map_err(|e| { - error!(error = %e, "Failed to setup workspace"); - OrchestratorError::ExecutionFailed(format!( - "Failed to setup workspace: {}", - e - )) - })?; - task.workspace_path = Some(workspace.path.to_string_lossy().to_string()); - - self.emit_event(Event::WorkspaceCreated { - task_id: task.id, - path: workspace.path.to_string_lossy().to_string(), - }); - } - } - - let working_dir = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // Run phases until all complete - while !context.is_complete() { - let phase_idx = (context.phase_number - 1) as usize; - if phase_idx >= parsed_plan.phases.len() { - break; - } - - let current_phase = &parsed_plan.phases[phase_idx]; - - info!( - task_id = %task.id, - phase = context.phase_number, - total = context.total_phases, - phase_title = %current_phase.title, - "Starting implementation phase" - ); - - // Create session for this phase - let mut session = Session::new_implementation_phase( - task.id, - context.phase_number, - ¤t_phase.title, - ); - - let opencode_session = self.create_opencode_session_in_dir(&working_dir).await?; - let session_id_str = opencode_session.id.to_string(); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - // Generate phase-specific prompt - let prompt = PhasePrompts::implementation_phase(task, current_phase, &context); - - // Send prompt and get response - let response = self - .send_opencode_message_in_dir( - &session_id_str, - &prompt, - activity_store.as_deref(), - &working_dir, - ) - .await; - - let response_text = match response { - Ok(text) => { - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - text - } - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - session.fail(); - self.update_session(&session).await?; - return Err(e); - } - }; - - // Extract summary from response - let summary = self.extract_or_create_phase_summary( - &response_text, - context.phase_number, - ¤t_phase.title, - ); - - // Save phase summary - self.file_manager - .write_phase_summary(task.id, &summary) - .await?; - - // Mark phase complete in plan - self.file_manager - .mark_phase_complete_in_plan(task.id, context.phase_number) - .await?; - - // Emit phase completed event - self.emit_event(Event::PhaseCompleted { - task_id: task.id, - session_id: session.id, - phase_number: context.phase_number, - total_phases: context.total_phases, - phase_title: current_phase.title.clone(), - }); - - session.complete(); - self.update_session(&session).await?; - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success: true, - }); - - // Advance to next phase - context.advance(summary); - self.file_manager - .write_phase_context(task.id, &context) - .await?; - - if !context.is_complete() { - self.emit_event(Event::PhaseContinuing { - task_id: task.id, - next_phase_number: context.phase_number, - total_phases: context.total_phases, - }); - } - } - - // All phases complete, transition to AI review - self.transition(task, TaskStatus::AiReview)?; - - info!( - task_id = %task.id, - total_phases = context.total_phases, - "All implementation phases completed, proceeding to AI review" - ); - - Ok(PhaseResult::PhasedImplementationComplete { - total_phases: context.total_phases, - }) - } - - /// Extract phase summary from AI response or create a basic one from git diff - fn extract_or_create_phase_summary( - &self, - response: &str, - phase_number: u32, - phase_title: &str, - ) -> PhaseSummary { - // Try to extract structured summary from response - if let Some(extracted) = extract_phase_summary(response) { - return PhaseSummary::new( - phase_number, - phase_title, - extracted.summary, - extracted.files_changed, - extracted.notes, - ); - } - - // Fallback: create basic summary - info!( - phase = phase_number, - "No structured summary found in response, creating basic summary" - ); - - // Get a truncated version of the response as summary - let summary = if response.len() > 500 { - format!("{}...", &response[..497]) - } else { - response.to_string() - }; - - PhaseSummary::new( - phase_number, - phase_title, - summary, - Vec::new(), // Empty files list - could be improved by parsing git status - None, - ) - } - - /// Start phased implementation asynchronously - /// This spawns a background task that runs all phases sequentially - async fn start_phased_implementation_async( - &self, - task: &mut Task, - parsed_plan: crate::files::ParsedPlan, - working_dir: PathBuf, - ) -> Result { - // Load or create phase context - let context = self - .file_manager - .read_phase_context(task.id) - .await? - .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); - - let phase_idx = (context.phase_number - 1) as usize; - let current_phase = parsed_plan.phases.get(phase_idx).ok_or_else(|| { - OrchestratorError::ExecutionFailed(format!( - "Phase {} not found in plan", - context.phase_number - )) - })?; - - // Create the first session for the current phase - let opencode_session = self.create_opencode_session_in_dir(&working_dir).await?; - let opencode_session_id = opencode_session.id.to_string(); - - let mut session = - Session::new_implementation_phase(task.id, context.phase_number, ¤t_phase.title); - session.start(opencode_session_id.clone()); - self.persist_session(&session).await?; - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - let first_session_id = session.id; - let first_opencode_session_id = opencode_session_id.clone(); - let return_opencode_session_id = first_opencode_session_id.clone(); - - // Capture all needed data for background task - let task_id = task.id; - let task_clone = task.clone(); - let file_manager = self.file_manager.clone(); - let session_repo = self.session_repo.clone(); - let task_repo = self.task_repo.clone(); - let event_bus = self.event_bus.clone(); - let activity_registry = self.activity_registry.clone(); - let opencode_config = Arc::clone(&self.opencode_config); - let provider_id = self.provider_id.clone(); - let model_id = self.model_id.clone(); - let base_url = self - .opencode_config - .base_path - .trim_end_matches("/api") - .to_string(); - - tokio::spawn(async move { - let mut task = task_clone; - match Self::run_phased_implementation_background_static( - &mut task, - parsed_plan, - working_dir, - first_session_id, - first_opencode_session_id, - file_manager, - session_repo, - task_repo, - event_bus, - activity_registry, - opencode_config, - provider_id, - model_id, - base_url, - ) - .await - { - Ok(_) => { - info!(task_id = %task_id, "Phased implementation completed successfully"); - } - Err(e) => { - error!(task_id = %task_id, error = %e, "Phased implementation failed"); - } - } - }); - - Ok(StartedExecution { - session_id: first_session_id, - opencode_session_id: return_opencode_session_id, - phase: SessionPhase::Implementation, - }) - } - - /// Run phased implementation in background using SessionRunner - async fn run_phased_implementation_background_static( - task: &mut Task, - parsed_plan: crate::files::ParsedPlan, - working_dir: PathBuf, - first_session_id: uuid::Uuid, - first_opencode_session_id: String, - file_manager: FileManager, - session_repo: Option>, - task_repo: Option>, - event_bus: Option, - activity_registry: Option, - opencode_config: Arc, - provider_id: String, - model_id: String, - _base_url: String, - ) -> Result<()> { - let mut context = file_manager - .read_phase_context(task.id) - .await? - .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); - - info!( - task_id = %task.id, - current_phase = context.phase_number, - total_phases = context.total_phases, - "Starting phased implementation" - ); - - let mut is_first_phase = true; - - while !context.is_complete() { - let phase_idx = (context.phase_number - 1) as usize; - if phase_idx >= parsed_plan.phases.len() { - break; - } - - let current_phase = &parsed_plan.phases[phase_idx]; - - info!( - task_id = %task.id, - phase = context.phase_number, - total = context.total_phases, - phase_title = %current_phase.title, - "Starting phase" - ); - - // Get or create session for this phase - let (session_id, opencode_session_id) = if is_first_phase { - is_first_phase = false; - (first_session_id, first_opencode_session_id.clone()) - } else { - // Create new session for subsequent phases - let opencode_session = - Self::create_opencode_session_static(&opencode_config, working_dir.to_str()) - .await?; - let new_opencode_session_id = opencode_session.id.to_string(); - - let mut session = Session::new_implementation_phase( - task.id, - context.phase_number, - ¤t_phase.title, - ); - session.start(new_opencode_session_id.clone()); - - if let Some(ref repo) = session_repo { - repo.create(&session).await.map_err(|e| { - OrchestratorError::ExecutionFailed(format!( - "Failed to persist session: {}", - e - )) - })?; - } - - if let Some(ref bus) = event_bus { - bus.publish(EventEnvelope::new(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - })); - } - - (session.id, new_opencode_session_id) - }; - - // Build config for this phase - skip task status update (we do it manually at the end) - let prompt = PhasePrompts::implementation_phase(task, current_phase, &context); - let config = SessionConfig { - task_id: task.id, - task_status: task.status, - phase: SessionPhase::Implementation, - prompt, - working_dir: working_dir.clone(), - provider_id: provider_id.clone(), - model_id: model_id.clone(), - mcp_config: None, - implementation_phase: Some((context.phase_number, current_phase.title.clone())), - skip_task_status_update: true, - }; - - let deps = SessionDependencies::new( - Arc::clone(&opencode_config), - session_repo.clone(), - task_repo.clone(), - event_bus.clone(), - activity_registry.clone(), - file_manager.clone(), - ); - - // Execute phase and wait for completion - let opencode_session_id_clone = opencode_session_id.clone(); - let (success, response_text) = SessionRunner::execute_and_complete( - config, - deps, - session_id, - opencode_session_id_clone, - ) - .await; - - if !success { - return Err(OrchestratorError::ExecutionFailed(format!( - "Phase {} failed", - context.phase_number - ))); - } - - // Extract phase summary - with retry if missing - let summary = Self::extract_or_request_phase_summary( - &response_text, - context.phase_number, - ¤t_phase.title, - &opencode_config, - &opencode_session_id, - working_dir.to_str(), - ) - .await; - - file_manager.write_phase_summary(task.id, &summary).await?; - file_manager - .mark_phase_complete_in_plan(task.id, context.phase_number) - .await?; - - // Emit phase completed event - if let Some(ref bus) = event_bus { - bus.publish(EventEnvelope::new(Event::PhaseCompleted { - task_id: task.id, - session_id, - phase_number: context.phase_number, - total_phases: context.total_phases, - phase_title: current_phase.title.clone(), - })); - } - - // Advance to next phase - context.advance(summary); - file_manager.write_phase_context(task.id, &context).await?; - - if !context.is_complete() { - if let Some(ref bus) = event_bus { - bus.publish(EventEnvelope::new(Event::PhaseContinuing { - task_id: task.id, - next_phase_number: context.phase_number, - total_phases: context.total_phases, - })); - } - } - } - - // All phases complete - now update task status to AiReview - task.status = TaskStatus::AiReview; - - if let Some(ref repo) = task_repo { - let update = UpdateTaskRequest { - status: Some(TaskStatus::AiReview), - ..Default::default() - }; - let _ = repo.update(task.id, &update).await; - } - - if let Some(ref bus) = event_bus { - bus.publish(EventEnvelope::new(Event::TaskStatusChanged { - task_id: task.id, - from_status: TaskStatus::InProgress.as_str().to_string(), - to_status: TaskStatus::AiReview.as_str().to_string(), - })); - } - - info!( - task_id = %task.id, - total_phases = context.total_phases, - "All phases completed, proceeding to AI review" - ); - - Ok(()) - } - - /// Extract phase summary from response, or request it via follow-up prompt if missing - async fn extract_or_request_phase_summary( - response: &str, - phase_number: u32, - phase_title: &str, - opencode_config: &Configuration, - opencode_session_id: &str, - directory: Option<&str>, - ) -> PhaseSummary { - // First try to extract from response - if let Some(extracted) = extract_phase_summary(response) { - info!(phase = phase_number, "Phase summary extracted successfully"); - return PhaseSummary::new( - phase_number, - phase_title, - extracted.summary, - extracted.files_changed, - extracted.notes, - ); - } - - // Summary not found - send follow-up prompt to request it - warn!( - phase = phase_number, - "No PHASE_SUMMARY found in response, sending follow-up request" - ); - - let follow_up_prompt = PhasePrompts::request_phase_summary(phase_number, phase_title); - - // Build and send the follow-up request - let request = SessionPromptRequest { - parts: vec![SessionPromptRequestPartsInner { - r#type: opencode_client::models::session_prompt_request_parts_inner::Type::Text, - text: follow_up_prompt, - id: None, - synthetic: None, - ignored: None, - time: None, - metadata: None, - mime: String::new(), - filename: None, - url: String::new(), - source: None, - name: String::new(), - prompt: String::new(), - description: String::new(), - agent: String::new(), - command: None, - }], - model: None, // Use same model as the session - message_id: None, - agent: None, - no_reply: None, - tools: None, - system: None, - variant: None, - }; - - // Send sync prompt and wait for response - match default_api::session_prompt( - opencode_config, - opencode_session_id, - directory, - Some(request), - ) - .await - { - Ok(response) => { - // Response is a single assistant message with parts - let response_text = Self::extract_text_from_parts(&response.parts); - - // Try to extract summary from follow-up response - if let Some(extracted) = extract_phase_summary(&response_text) { - info!( - phase = phase_number, - "Phase summary obtained via follow-up prompt" - ); - return PhaseSummary::new( - phase_number, - phase_title, - extracted.summary, - extracted.files_changed, - extracted.notes, - ); - } - } - Err(e) => { - error!(phase = phase_number, error = %e, "Failed to send follow-up prompt for summary"); - } - } - - // Fallback: create basic summary from original response - warn!( - phase = phase_number, - "Could not obtain structured summary, using fallback" - ); - - let summary = if response.len() > 500 { - format!("{}...", &response[..497]) - } else { - response.to_string() - }; - - PhaseSummary::new(phase_number, phase_title, summary, Vec::new(), None) - } - - /// Static version of extract_or_create_phase_summary (legacy - still used by non-phased implementation) - #[allow(dead_code)] - fn extract_or_create_phase_summary_static( - response: &str, - phase_number: u32, - phase_title: &str, - ) -> PhaseSummary { - // Try to extract structured summary from response - if let Some(extracted) = extract_phase_summary(response) { - return PhaseSummary::new( - phase_number, - phase_title, - extracted.summary, - extracted.files_changed, - extracted.notes, - ); - } - - // Fallback: create basic summary - info!( - phase = phase_number, - "No structured summary found in response, creating basic summary" - ); - - let summary = if response.len() > 500 { - format!("{}...", &response[..497]) - } else { - response.to_string() - }; - - PhaseSummary::new(phase_number, phase_title, summary, Vec::new(), None) - } - - /// Static version of create_opencode_session - async fn create_opencode_session_static( - config: &Configuration, - directory: Option<&str>, - ) -> Result { - use opencode_client::apis::default_api; - - let request = opencode_client::models::SessionCreateRequest { - title: None, - parent_id: None, - }; - - default_api::session_create(config, directory, Some(request)) - .await - .map_err(|e| { - OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e)) - }) - } - - #[instrument(skip(self, task), fields(task_id = %task.id, iteration = iteration))] - async fn run_ai_review(&self, task: &mut Task, iteration: u32) -> Result { - info!( - task_id = %task.id, - iteration = iteration, - max_iterations = self.config.max_review_iterations, - "Starting AI_REVIEW session with MCP" - ); - - let mut session = Session::new(task.id, SessionPhase::Review); - - debug!("Creating OpenCode session for AI review"); - let opencode_session = self.create_opencode_session().await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - "OpenCode session created for AI review" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - // Get workspace path for MCP server - let workspace_path = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // Add MCP findings server to OpenCode - if let Err(e) = self - .add_mcp_findings_server(task.id, session.id, &workspace_path) - .await - { - warn!(error = %e, "Failed to add MCP server, falling back to JSON parsing"); - // Fall back to non-MCP review if MCP server fails to start - return self - .run_ai_review_json_fallback( - task, - session, - session_id_str, - activity_store, - iteration, - ) - .await; - } - - debug!("Getting workspace diff for review"); - let diff = self.get_workspace_diff(task).await?; - debug!(diff_length = diff.len(), "Workspace diff retrieved"); - - // Use MCP-based prompt - let prompt = PhasePrompts::review_with_mcp(task, &diff); - debug!( - prompt_length = prompt.len(), - "Sending MCP review prompt to OpenCode" - ); - - let response_content = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - // Disconnect MCP server after review (ignore errors) - let _ = self.remove_mcp_findings_server(&workspace_path).await; - - let response_content = match response_content { - Ok(content) => content, - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - }; - - info!( - response_length = response_content.len(), - "Received AI review response" - ); - - // Save raw review for reference - let _review_path = self - .file_manager - .write_review(task.id, &response_content) - .await?; - - session.complete(); - self.update_session(&session).await?; - - // Read findings from file (written by MCP server) - let review_result = match self.file_manager.read_findings(task.id).await { - Ok(Some(findings)) => { - info!( - approved = findings.approved, - finding_count = findings.findings.len(), - "AI review findings read from MCP server" - ); - - if findings.approved || findings.findings.is_empty() { - ReviewResult::Approved - } else { - ReviewResult::FindingsDetected(findings.findings.len()) - } - } - Ok(None) => { - // No findings file - try to parse from response as fallback - warn!("No MCP findings file found, falling back to JSON parsing"); - match Self::parse_review_json(&response_content, task.id, session.id) { - Ok(findings) => { - self.file_manager.write_findings(task.id, &findings).await?; - if findings.approved || findings.findings.is_empty() { - ReviewResult::Approved - } else { - ReviewResult::FindingsDetected(findings.findings.len()) - } - } - Err(_) => Self::parse_review_response(&response_content), - } - } - Err(e) => { - warn!(error = %e, "Failed to read MCP findings, falling back to JSON parsing"); - match Self::parse_review_json(&response_content, task.id, session.id) { - Ok(findings) => { - self.file_manager.write_findings(task.id, &findings).await?; - if findings.approved || findings.findings.is_empty() { - ReviewResult::Approved - } else { - ReviewResult::FindingsDetected(findings.findings.len()) - } - } - Err(_) => Self::parse_review_response(&response_content), - } - } - }; - - let success = matches!(review_result, ReviewResult::Approved); - - if let Some(ref store) = activity_store { - store.push_finished(success, None); - } - - info!( - review_result = ?review_result, - "AI review result processed" - ); - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success, - }); - - match review_result { - ReviewResult::Approved => { - info!(task_id = %task.id, "AI review APPROVED, proceeding to human review"); - self.transition(task, TaskStatus::Review)?; - Ok(PhaseResult::ReviewPassed { - session_id: session_id_str, - }) - } - ReviewResult::FindingsDetected(count) => { - info!( - task_id = %task.id, - finding_count = count, - "AI review found issues, waiting for user action" - ); - // Stay in ai_review state - user must choose to fix or skip - Ok(PhaseResult::ReviewFailed { - session_id: session_id_str, - feedback: format!( - "{} issues found. Review findings and choose to fix or skip.", - count - ), - iteration, - }) - } - ReviewResult::ChangesRequested(feedback) => { - warn!( - task_id = %task.id, - iteration = iteration, - feedback_preview = %feedback.chars().take(200).collect::(), - "AI review REJECTED (legacy format), changes requested" - ); - // Legacy behavior - auto transition to InProgress - self.transition(task, TaskStatus::InProgress)?; - Ok(PhaseResult::ReviewFailed { - session_id: session_id_str, - feedback, - iteration, - }) - } - } - } - - /// Run a fix session to address findings from AI review - #[instrument(skip(self, task), fields(task_id = %task.id))] - async fn run_fix_session(&self, task: &mut Task) -> Result { - info!( - task_id = %task.id, - "Starting FIX session with MCP" - ); - - let mut session = Session::new(task.id, SessionPhase::Fix); - - debug!("Creating OpenCode session for fix"); - let opencode_session = self.create_opencode_session().await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - "OpenCode session created for fix" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - // Get workspace path for MCP server - let workspace_path = task - .workspace_path - .as_ref() - .map(PathBuf::from) - .unwrap_or_else(|| self.config.repo_path.clone()); - - // Add MCP findings server to OpenCode - if let Err(e) = self - .add_mcp_findings_server(task.id, session.id, &workspace_path) - .await - { - warn!(error = %e, "Failed to add MCP server for fix session"); - session.fail(); - self.update_session(&session).await?; - - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - - return Err(OrchestratorError::ExecutionFailed(format!( - "MCP server required for fix session: {}", - e - ))); - } - - // Use fix prompt with MCP - let prompt = PhasePrompts::fix_with_mcp(task); - debug!( - prompt_length = prompt.len(), - "Sending fix prompt to OpenCode" - ); - - let response_content = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - // Disconnect MCP server after fix (ignore errors) - let _ = self.remove_mcp_findings_server(&workspace_path).await; - - let response_content = match response_content { - Ok(content) => content, - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - }; - - info!( - response_length = response_content.len(), - "Received fix session response" - ); - - session.complete(); - self.update_session(&session).await?; - - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success: true, - }); - - // After fix, transition back to AI Review for re-evaluation - info!(task_id = %task.id, "Fix session completed, transitioning to AI Review"); - self.transition(task, TaskStatus::AiReview)?; - - Ok(PhaseResult::FixCompleted { - session_id: session_id_str, - }) - } - - /// Fallback method for AI review without MCP (uses JSON parsing) - async fn run_ai_review_json_fallback( - &self, - task: &mut Task, - mut session: Session, - session_id_str: String, - activity_store: Option>, - iteration: u32, - ) -> Result { - debug!("Getting workspace diff for review"); - let diff = self.get_workspace_diff(task).await?; - debug!(diff_length = diff.len(), "Workspace diff retrieved"); - - let prompt = PhasePrompts::review(task, &diff); - debug!( - prompt_length = prompt.len(), - "Sending review prompt to OpenCode" - ); - - let response_content = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - let response_content = match response_content { - Ok(content) => content, - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - }; - - info!( - response_length = response_content.len(), - "Received AI review response" - ); - - let _review_path = self - .file_manager - .write_review(task.id, &response_content) - .await?; - - session.complete(); - self.update_session(&session).await?; - - let review_result = match Self::parse_review_json(&response_content, task.id, session.id) { - Ok(findings) => { - self.file_manager.write_findings(task.id, &findings).await?; - if findings.approved || findings.findings.is_empty() { - ReviewResult::Approved - } else { - ReviewResult::FindingsDetected(findings.findings.len()) - } - } - Err(_) => { - warn!("Falling back to legacy text-based review parsing"); - Self::parse_review_response(&response_content) - } - }; - - let success = matches!(review_result, ReviewResult::Approved); - - if let Some(ref store) = activity_store { - store.push_finished(success, None); - } - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success, - }); - - match review_result { - ReviewResult::Approved => { - self.transition(task, TaskStatus::Review)?; - Ok(PhaseResult::ReviewPassed { - session_id: session_id_str, - }) - } - ReviewResult::FindingsDetected(count) => Ok(PhaseResult::ReviewFailed { - session_id: session_id_str, - feedback: format!( - "{} issues found. Review findings and choose to fix or skip.", - count - ), - iteration, - }), - ReviewResult::ChangesRequested(feedback) => { - self.transition(task, TaskStatus::InProgress)?; - Ok(PhaseResult::ReviewFailed { - session_id: session_id_str, - feedback, - iteration, - }) - } - } - } - - async fn get_workspace_diff(&self, task: &Task) -> Result { - if let Some(ref wm) = self.workspace_manager { - if let Some(ref workspace_path) = task.workspace_path { - let workspace = Workspace::new( - task.id.to_string(), - PathBuf::from(workspace_path), - format!("task-{}", task.id), - ); - return wm - .get_diff(&workspace) - .await - .map_err(|e| OrchestratorError::ExecutionFailed(format!("VCS error: {}", e))); - } - } - Ok("(no workspace configured - diff unavailable)".to_string()) - } - - /// Parse JSON review response and create ReviewFindings - fn parse_review_json(content: &str, task_id: Uuid, session_id: Uuid) -> Result { - // Try to extract JSON from markdown code blocks or raw content - let json_str = Self::extract_json_from_response(content); - - let raw: RawReviewResponse = serde_json::from_str(&json_str).map_err(|e| { - warn!( - error = %e, - content_preview = %content.chars().take(500).collect::(), - "Failed to parse review JSON, falling back to text parsing" - ); - OrchestratorError::ExecutionFailed(format!("Failed to parse review JSON: {}", e)) - })?; - - // Convert raw findings to ReviewFinding - let findings: Vec = raw - .findings - .into_iter() - .enumerate() - .map(|(i, f)| ReviewFinding { - id: format!("finding-{}", i + 1), - file_path: f.file_path, - line_start: f.line_start, - line_end: f.line_end, - title: f.title, - description: f.description, - severity: match f.severity.to_lowercase().as_str() { - "error" => FindingSeverity::Error, - "info" => FindingSeverity::Info, - _ => FindingSeverity::Warning, - }, - status: FindingStatus::Pending, - }) - .collect(); - - Ok(ReviewFindings::with_findings( - task_id, - session_id, - raw.summary, - findings, - )) - } - - /// Extract JSON from response that might be wrapped in markdown code blocks - fn extract_json_from_response(content: &str) -> String { - // Try to find JSON in ```json ... ``` blocks - if let Some(start) = content.find("```json") { - if let Some(end) = content[start..] - .find("```\n") - .or(content[start..].rfind("```")) - { - let json_start = start + 7; // length of "```json" - let json_content = &content[json_start..start + end]; - return json_content.trim().to_string(); - } - } - - // Try to find JSON in ``` ... ``` blocks - if let Some(start) = content.find("```\n{") { - if let Some(end) = content[start + 4..].find("\n```") { - return content[start + 4..start + 4 + end].trim().to_string(); - } - } - - // Try to find raw JSON (starts with { and ends with }) - if let Some(start) = content.find('{') { - if let Some(end) = content.rfind('}') { - return content[start..=end].to_string(); - } - } - - // Return as-is, let JSON parser handle the error - content.to_string() - } - - /// Legacy text-based review parsing (fallback) - fn parse_review_response(content: &str) -> ReviewResult { - let content_upper = content.to_uppercase(); - - if content_upper.contains("APPROVED") && !content_upper.contains("NOT APPROVED") { - ReviewResult::Approved - } else if content_upper.contains("CHANGES_REQUESTED") - || content_upper.contains("CHANGES REQUESTED") - || content_upper.contains("REJECTED") - { - let feedback = content - .lines() - .skip_while(|line| { - let upper = line.to_uppercase(); - !upper.contains("CHANGES_REQUESTED") - && !upper.contains("CHANGES REQUESTED") - && !upper.contains("REJECTED") - && !upper.contains("FEEDBACK") - && !upper.contains("ISSUES") - }) - .skip(1) - .collect::>() - .join("\n") - .trim() - .to_string(); - - if feedback.is_empty() { - ReviewResult::ChangesRequested(content.to_string()) - } else { - ReviewResult::ChangesRequested(feedback) - } - } else { - ReviewResult::ChangesRequested( - "Review response unclear. Manual review required.".to_string(), - ) - } - } - - #[instrument(skip(self, task, feedback), fields(task_id = %task.id))] - pub async fn run_fix_iteration(&self, task: &mut Task, feedback: &str) -> Result { - info!( - task_id = %task.id, - feedback_length = feedback.len(), - "Starting FIX iteration based on review feedback" - ); - - let mut session = Session::new(task.id, SessionPhase::Implementation); - - debug!("Creating OpenCode session for fix iteration"); - let opencode_session = self.create_opencode_session().await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - "OpenCode session created for fix iteration" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - self.emit_event(Event::SessionStarted { - session_id: session.id, - task_id: task.id, - phase: session.phase.as_str().to_string(), - status: session.status.as_str().to_string(), - opencode_session_id: session.opencode_session_id.clone(), - created_at: session.created_at, - }); - - let prompt = PhasePrompts::fix_issues(task, feedback); - debug!( - prompt_length = prompt.len(), - "Sending fix prompt to OpenCode" - ); - - let response = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - match response { - Ok(_) => { - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - } - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - } - - info!("Fix iteration response received from OpenCode"); - - session.complete(); - self.update_session(&session).await?; - - self.emit_event(Event::SessionEnded { - session_id: session.id, - task_id: task.id, - success: true, - }); - - self.transition(task, TaskStatus::AiReview)?; - - info!( - task_id = %task.id, - "FIX iteration completed, returning to AI review" - ); - - Ok(PhaseResult::SessionCreated { - session_id: session_id_str, - }) - } - - #[instrument(skip(self, task), fields(task_id = %task.id))] - pub async fn approve_plan(&self, task: &mut Task) -> Result<()> { - info!(task_id = %task.id, "Plan APPROVED by human reviewer"); - - if task.status != TaskStatus::PlanningReview { - warn!( - current_status = %task.status.as_str(), - "Cannot approve plan - task not in PlanningReview state" - ); - return Err(OrchestratorError::InvalidTransition { - from: task.status.as_str().to_string(), - to: "InProgress (plan approval)".to_string(), - }); - } - self.transition(task, TaskStatus::InProgress)?; - info!(task_id = %task.id, "Task ready for implementation"); - Ok(()) - } - - #[instrument(skip(self, task, feedback), fields(task_id = %task.id))] - pub async fn reject_plan(&self, task: &mut Task, feedback: &str) -> Result { - info!( - task_id = %task.id, - feedback_length = feedback.len(), - "Plan REJECTED by human reviewer, re-planning" - ); - - if task.status != TaskStatus::PlanningReview { - warn!( - current_status = %task.status.as_str(), - "Cannot reject plan - task not in PlanningReview state" - ); - return Err(OrchestratorError::InvalidTransition { - from: task.status.as_str().to_string(), - to: "Planning (plan rejection)".to_string(), - }); - } - self.transition(task, TaskStatus::Planning)?; - - let mut session = Session::new(task.id, SessionPhase::Planning); - let opencode_session = self.create_opencode_session().await?; - let session_id_str = opencode_session.id.to_string(); - - info!( - opencode_session_id = %session_id_str, - "OpenCode session created for re-planning" - ); - - session.start(session_id_str.clone()); - self.persist_session(&session).await?; - - let activity_store = self.get_activity_store(session.id); - - let prompt = PhasePrompts::replan(task, feedback); - let response_content = self - .send_opencode_message_with_activity( - &session_id_str, - &prompt, - activity_store.as_deref(), - ) - .await; - - let response_content = match response_content { - Ok(content) => { - if let Some(ref store) = activity_store { - store.push_finished(true, None); - } - content - } - Err(e) => { - if let Some(ref store) = activity_store { - store.push_finished(false, Some(e.to_string())); - } - return Err(e); - } - }; - - let plan_path = self - .file_manager - .write_plan(task.id, &response_content) - .await?; - - info!(plan_path = %plan_path.display(), "New plan saved"); - - session.complete(); - self.update_session(&session).await?; - - self.transition(task, TaskStatus::PlanningReview)?; - - info!(task_id = %task.id, "Re-planning completed, awaiting review"); + info!(task_id = %task.id, "Re-planning completed, awaiting review"); Ok(PhaseResult::PlanCreated { session_id: session_id_str, @@ -2796,7 +407,6 @@ impl TaskExecutor { }) } - #[instrument(skip(self, task), fields(task_id = %task.id))] pub async fn approve_review(&self, task: &mut Task) -> Result<()> { info!(task_id = %task.id, "Implementation APPROVED by human reviewer"); @@ -2810,12 +420,11 @@ impl TaskExecutor { to: "Done (review approval)".to_string(), }); } - self.transition(task, TaskStatus::Done)?; + self.ctx.transition(task, TaskStatus::Done)?; info!(task_id = %task.id, "Task COMPLETED successfully"); Ok(()) } - #[instrument(skip(self, task, feedback), fields(task_id = %task.id))] pub async fn reject_review(&self, task: &mut Task, feedback: &str) -> Result { info!( task_id = %task.id, @@ -2833,55 +442,23 @@ impl TaskExecutor { to: "InProgress (review rejection)".to_string(), }); } - self.run_fix_iteration(task, feedback).await + FixPhase::run_iteration(&self.ctx, task, feedback).await } -} -#[derive(Debug, Clone)] -pub enum PhaseResult { - SessionCreated { - session_id: String, - }, - PlanCreated { - session_id: String, - plan_path: String, - }, - AwaitingApproval { - phase: SessionPhase, - }, - ReviewPassed { - session_id: String, - }, - ReviewFailed { - session_id: String, - feedback: String, - iteration: u32, - }, - /// Fix session completed - will auto-transition back to AI Review - FixCompleted { - session_id: String, - }, - /// Multi-phase implementation completed - PhasedImplementationComplete { - total_phases: u32, - }, - MaxIterationsExceeded { - iterations: u32, - }, - Completed, -} + pub async fn run_fix_iteration(&self, task: &mut Task, feedback: &str) -> Result { + FixPhase::run_iteration(&self.ctx, task, feedback).await + } -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum ReviewResult { - Approved, - ChangesRequested(String), - /// Structured findings detected - task stays in ai_review waiting for user action - FindingsDetected(usize), + #[cfg(test)] + fn parse_review_response(content: &str) -> ReviewResult { + MessageParser::parse_review_response(content) + } } #[cfg(test)] mod tests { use super::*; + use std::path::PathBuf; #[test] fn test_parse_review_approved() { diff --git a/crates/orchestrator/src/files.rs b/crates/orchestrator/src/files.rs index 50e7d85..73515b8 100644 --- a/crates/orchestrator/src/files.rs +++ b/crates/orchestrator/src/files.rs @@ -350,7 +350,7 @@ impl FileManager { let temp_path = self.plans_dir().join(format!(".{}.tmp", task_id)); info!("Writing plan to {:?}", path); - + fs::write(&temp_path, content).await.map_err(|e| { OrchestratorError::ExecutionFailed(format!( "Failed to write temp plan file {:?}: {}", @@ -383,7 +383,9 @@ impl FileManager { /// Check if a plan exists for a task pub async fn plan_exists(&self, task_id: Uuid) -> bool { - fs::try_exists(self.plan_path(task_id)).await.unwrap_or(false) + fs::try_exists(self.plan_path(task_id)) + .await + .unwrap_or(false) } /// Write a review file for a task (atomic write via temp file + rename) @@ -426,7 +428,9 @@ impl FileManager { /// Check if a review exists for a task pub async fn review_exists(&self, task_id: Uuid) -> bool { - fs::try_exists(self.review_path(task_id)).await.unwrap_or(false) + fs::try_exists(self.review_path(task_id)) + .await + .unwrap_or(false) } /// Delete a plan file for a task @@ -462,7 +466,11 @@ impl FileManager { // ======================================================================== /// Write findings to a JSON file for a task (atomic write) - pub async fn write_findings(&self, task_id: Uuid, findings: &ReviewFindings) -> Result { + pub async fn write_findings( + &self, + task_id: Uuid, + findings: &ReviewFindings, + ) -> Result { self.ensure_directories().await?; let path = self.findings_path(task_id); let temp_path = self.findings_dir().join(format!(".{}.tmp", task_id)); @@ -578,10 +586,7 @@ impl FileManager { /// Get the relative path for a plan (used in prompts) pub fn plan_relative_path(&self, task_id: Uuid) -> String { - format!( - "{}/{}/{}/{}.md", - STUDIO_DIR, KANBAN_DIR, PLANS_DIR, task_id - ) + format!("{}/{}/{}/{}.md", STUDIO_DIR, KANBAN_DIR, PLANS_DIR, task_id) } /// Get the relative path for a review (used in prompts) @@ -629,7 +634,11 @@ impl FileManager { } /// Write phase context to file (atomic write) - pub async fn write_phase_context(&self, task_id: Uuid, context: &PhaseContext) -> Result { + pub async fn write_phase_context( + &self, + task_id: Uuid, + context: &PhaseContext, + ) -> Result { self.ensure_phases_dir(task_id).await?; let path = self.phase_context_path(task_id); let temp_path = self.phases_dir(task_id).join(".context.tmp"); @@ -689,7 +698,11 @@ impl FileManager { } /// Write a phase summary to file (atomic write) - pub async fn write_phase_summary(&self, task_id: Uuid, summary: &PhaseSummary) -> Result { + pub async fn write_phase_summary( + &self, + task_id: Uuid, + summary: &PhaseSummary, + ) -> Result { self.ensure_phases_dir(task_id).await?; let path = self.phase_summary_path(task_id, summary.phase_number); let temp_path = self @@ -773,7 +786,11 @@ impl FileManager { } /// Mark a phase as complete in the plan file by adding a checkmark - pub async fn mark_phase_complete_in_plan(&self, task_id: Uuid, phase_number: u32) -> Result<()> { + pub async fn mark_phase_complete_in_plan( + &self, + task_id: Uuid, + phase_number: u32, + ) -> Result<()> { let plan = self.read_plan(task_id).await?; // Pattern to match phase headers like "### Phase 1: Title" or "## Phase 1 - Title" diff --git a/crates/orchestrator/src/lib.rs b/crates/orchestrator/src/lib.rs index d2a743b..2bf842a 100644 --- a/crates/orchestrator/src/lib.rs +++ b/crates/orchestrator/src/lib.rs @@ -6,6 +6,7 @@ pub mod mcp_config; pub mod opencode_events; pub mod plan_parser; pub mod prompts; +pub mod services; pub mod session_runner; pub mod state_machine; @@ -22,6 +23,7 @@ pub use opencode_events::{ }; pub use plan_parser::{extract_phase_summary, parse_plan_phases, ExtractedSummary}; pub use prompts::UserReviewComment; +pub use services::{McpManager, MessageParser, OpenCodeClient}; pub use session_runner::{ McpConfig, SessionConfig, SessionDependencies, SessionResult, SessionRunner, }; diff --git a/crates/orchestrator/src/mcp_config.rs b/crates/orchestrator/src/mcp_config.rs index 888d721..d47bbc7 100644 --- a/crates/orchestrator/src/mcp_config.rs +++ b/crates/orchestrator/src/mcp_config.rs @@ -95,8 +95,14 @@ impl PhaseMcpConfig { binary: McpBinarySource::Builtin("builtin:findings".to_string()), env_vars: [ ("OPENCODE_TASK_ID".to_string(), "{task_id}".to_string()), - ("OPENCODE_SESSION_ID".to_string(), "{session_id}".to_string()), - ("OPENCODE_WORKSPACE_PATH".to_string(), "{workspace_path}".to_string()), + ( + "OPENCODE_SESSION_ID".to_string(), + "{session_id}".to_string(), + ), + ( + "OPENCODE_WORKSPACE_PATH".to_string(), + "{workspace_path}".to_string(), + ), ] .into_iter() .collect(), @@ -114,10 +120,7 @@ impl PhaseMcpConfig { /// Add an MCP server to a phase pub fn add_server(&mut self, phase: SessionPhase, server: McpServerSpec) { - self.phase_servers - .entry(phase) - .or_insert_with(Vec::new) - .push(server); + self.phase_servers.entry(phase).or_default().push(server); } /// Get MCP servers for a specific phase diff --git a/crates/orchestrator/src/opencode_events.rs b/crates/orchestrator/src/opencode_events.rs index 41946b0..cb813e4 100644 --- a/crates/orchestrator/src/opencode_events.rs +++ b/crates/orchestrator/src/opencode_events.rs @@ -14,25 +14,15 @@ use tracing::{debug, error, info, warn}; #[serde(tag = "type", rename_all = "snake_case")] pub enum OpenCodeEvent { #[serde(rename = "session.status")] - SessionStatus { - properties: SessionStatusProps, - }, + SessionStatus { properties: SessionStatusProps }, #[serde(rename = "session.idle")] - SessionIdle { - properties: SessionIdleProps, - }, + SessionIdle { properties: SessionIdleProps }, #[serde(rename = "session.updated")] - SessionUpdated { - properties: SessionUpdatedProps, - }, + SessionUpdated { properties: SessionUpdatedProps }, #[serde(rename = "message.part.updated")] - MessagePartUpdated { - properties: MessagePartUpdatedProps, - }, + MessagePartUpdated { properties: MessagePartUpdatedProps }, #[serde(rename = "message.updated")] - MessageUpdated { - properties: MessageUpdatedProps, - }, + MessageUpdated { properties: MessageUpdatedProps }, // Direct activity events (streamed during execution) #[serde(rename = "step_start")] StepStart { @@ -120,7 +110,10 @@ pub struct MessagePartUpdatedProps { impl MessagePartUpdatedProps { /// Extract session_id from the part object (OpenCode puts it inside part.sessionID) pub fn session_id(&self) -> Option { - self.part.get("sessionID").and_then(|v| v.as_str()).map(String::from) + self.part + .get("sessionID") + .and_then(|v| v.as_str()) + .map(String::from) } } @@ -166,11 +159,20 @@ pub enum ExecutorEvent { /// Session became idle (AI finished responding) SessionIdle { session_id: String }, /// Session status changed - StatusChanged { session_id: String, status: SessionStatus }, + StatusChanged { + session_id: String, + status: SessionStatus, + }, /// Message part updated (tool call, text, etc.) - MessagePartUpdated { session_id: String, part: serde_json::Value, delta: Option }, + MessagePartUpdated { + session_id: String, + part: serde_json::Value, + delta: Option, + }, /// Direct activity event (step_start, reasoning, agent_message, finished) - DirectActivity { activity: crate::activity_store::SessionActivityMsg }, + DirectActivity { + activity: crate::activity_store::SessionActivityMsg, + }, /// Connection error Error { message: String }, /// Stream ended @@ -208,7 +210,11 @@ impl OpenCodeEventSubscriber { tokio::spawn(async move { if let Err(e) = Self::run_subscription(client, config, tx.clone()).await { error!(error = %e, "OpenCode event subscription failed"); - let _ = tx.send(ExecutorEvent::Error { message: e.to_string() }).await; + let _ = tx + .send(ExecutorEvent::Error { + message: e.to_string(), + }) + .await; } let _ = tx.send(ExecutorEvent::Disconnected).await; }); @@ -257,7 +263,9 @@ impl OpenCodeEventSubscriber { "Received SSE event" ); - if let Some(executor_event) = Self::process_sse_event(&event, &config.session_id) { + if let Some(executor_event) = + Self::process_sse_event(&event, &config.session_id) + { let is_idle = matches!(executor_event, ExecutorEvent::SessionIdle { .. }); if is_idle { @@ -342,7 +350,8 @@ impl OpenCodeEventSubscriber { } OpenCodeEvent::MessagePartUpdated { properties } => { // Extract session_id from the part object, or use target session as fallback - let event_session_id = properties.session_id() + let event_session_id = properties + .session_id() .unwrap_or_else(|| target_session_id.to_string()); debug!( @@ -380,7 +389,11 @@ impl OpenCodeEventSubscriber { } OpenCodeEvent::MessageUpdated { .. } => None, // Direct activity events - convert to SessionActivityMsg and forward - OpenCodeEvent::StepStart { id, step_name, timestamp } => { + OpenCodeEvent::StepStart { + id, + step_name, + timestamp, + } => { info!(id = %id, "Received step_start event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -393,7 +406,11 @@ impl OpenCodeEventSubscriber { }, }) } - OpenCodeEvent::Reasoning { id, content, timestamp } => { + OpenCodeEvent::Reasoning { + id, + content, + timestamp, + } => { debug!(id = %id, content_len = content.len(), "Received reasoning event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -406,7 +423,12 @@ impl OpenCodeEventSubscriber { }, }) } - OpenCodeEvent::AgentMessage { id, content, is_partial, timestamp } => { + OpenCodeEvent::AgentMessage { + id, + content, + is_partial, + timestamp, + } => { info!(id = %id, is_partial = is_partial, "Received agent_message event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -420,7 +442,11 @@ impl OpenCodeEventSubscriber { }, }) } - OpenCodeEvent::Finished { success, error, timestamp } => { + OpenCodeEvent::Finished { + success, + error, + timestamp, + } => { info!(success = success, "Received finished event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -433,7 +459,12 @@ impl OpenCodeEventSubscriber { }, }) } - OpenCodeEvent::ToolCall { id, tool_name, args, timestamp } => { + OpenCodeEvent::ToolCall { + id, + tool_name, + args, + timestamp, + } => { info!(id = %id, tool_name = %tool_name, "Received tool_call event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -447,7 +478,14 @@ impl OpenCodeEventSubscriber { }, }) } - OpenCodeEvent::ToolResult { id, tool_name, args, result, success, timestamp } => { + OpenCodeEvent::ToolResult { + id, + tool_name, + args, + result, + success, + timestamp, + } => { info!(id = %id, tool_name = %tool_name, success = success, "Received tool_result event"); let ts = chrono::DateTime::parse_from_rfc3339(×tamp) .map(|dt| dt.with_timezone(&chrono::Utc)) @@ -482,8 +520,14 @@ pub async fn wait_for_session_completion( while let Some(event) = rx.recv().await { match event { ExecutorEvent::SessionIdle { .. } => return Ok(()), - ExecutorEvent::StatusChanged { status: SessionStatus::Completed, .. } => return Ok(()), - ExecutorEvent::StatusChanged { status: SessionStatus::Error, .. } => { + ExecutorEvent::StatusChanged { + status: SessionStatus::Completed, + .. + } => return Ok(()), + ExecutorEvent::StatusChanged { + status: SessionStatus::Error, + .. + } => { return Err("Session ended with error".to_string()); } ExecutorEvent::Error { message } => return Err(message), @@ -509,7 +553,7 @@ mod tests { fn test_parse_session_idle() { let json = r#"{"type":"session.idle","properties":{"sessionID":"ses_123"}}"#; let event: OpenCodeEvent = serde_json::from_str(json).unwrap(); - + match event { OpenCodeEvent::SessionIdle { properties } => { assert_eq!(properties.session_id, "ses_123"); @@ -544,6 +588,9 @@ mod tests { assert_eq!(SessionStatus::from("running"), SessionStatus::Running); assert_eq!(SessionStatus::from("idle"), SessionStatus::Idle); assert_eq!(SessionStatus::from("IDLE"), SessionStatus::Idle); - assert!(matches!(SessionStatus::from("custom"), SessionStatus::Unknown(_))); + assert!(matches!( + SessionStatus::from("custom"), + SessionStatus::Unknown(_) + )); } } diff --git a/crates/orchestrator/src/plan_parser.rs b/crates/orchestrator/src/plan_parser.rs index 059b558..2fbbf7e 100644 --- a/crates/orchestrator/src/plan_parser.rs +++ b/crates/orchestrator/src/plan_parser.rs @@ -20,9 +20,9 @@ use crate::files::{ParsedPlan, PlanPhase}; pub fn parse_plan_phases(plan_content: &str) -> ParsedPlan { // Pattern to match phase headers // Captures: full match, phase number, separator, title - let phase_pattern = Regex::new( - r"(?m)^(##?#?)\s*(?:Phase|Fáze|Step|Krok)\s+(\d+)\s*[:\-–]\s*(.+)$" - ).expect("Invalid phase regex pattern"); + let phase_pattern = + Regex::new(r"(?m)^(##?#?)\s*(?:Phase|Fáze|Step|Krok)\s+(\d+)\s*[:\-–]\s*(.+)$") + .expect("Invalid phase regex pattern"); let mut phases = Vec::new(); let mut preamble = String::new(); @@ -56,11 +56,13 @@ pub fn parse_plan_phases(plan_content: &str) -> ParsedPlan { // Process each phase for (i, caps) in matches.iter().enumerate() { - let phase_number: u32 = caps.get(2) + let phase_number: u32 = caps + .get(2) .and_then(|m| m.as_str().parse().ok()) .unwrap_or((i + 1) as u32); - let title = caps.get(3) + let title = caps + .get(3) .map(|m| m.as_str().trim().to_string()) .unwrap_or_else(|| format!("Phase {}", phase_number)); @@ -106,9 +108,8 @@ fn extract_phase_content(content: &str, start: usize, end: usize) -> String { /// /// Looks for the structured summary block between PHASE_SUMMARY markers pub fn extract_phase_summary(response: &str) -> Option { - let summary_pattern = Regex::new( - r"(?s)###\s*PHASE_SUMMARY\s*\n(.*?)###\s*END_PHASE_SUMMARY" - ).ok()?; + let summary_pattern = + Regex::new(r"(?s)###\s*PHASE_SUMMARY\s*\n(.*?)###\s*END_PHASE_SUMMARY").ok()?; let caps = summary_pattern.captures(response)?; let block = caps.get(1)?.as_str(); @@ -159,17 +160,16 @@ fn extract_file_list(block: &str) -> Vec { let mut files = Vec::new(); // Look for "Changed files:" or "Změněné soubory:" section - let list_pattern = Regex::new( - r"(?s)\*\*(?:Změněné soubory|Changed files):\*\*\s*\n((?:\s*-\s*.+\n?)+)" - ); + let list_pattern = + Regex::new(r"(?s)\*\*(?:Změněné soubory|Changed files):\*\*\s*\n((?:\s*-\s*.+\n?)+)"); if let Ok(re) = list_pattern { if let Some(caps) = re.captures(block) { if let Some(list) = caps.get(1) { for line in list.as_str().lines() { let line = line.trim(); - if line.starts_with('-') { - let file = line[1..].trim(); + if let Some(stripped) = line.strip_prefix('-') { + let file = stripped.trim(); if !file.is_empty() { files.push(file.to_string()); } @@ -236,7 +236,9 @@ Connect everything together. assert!(parsed.preamble.contains("preamble")); assert_eq!(parsed.phases[0].number, 1); assert_eq!(parsed.phases[0].title, "Setup"); - assert!(parsed.phases[0].content.contains("Create the basic structure")); + assert!(parsed.phases[0] + .content + .contains("Create the basic structure")); assert_eq!(parsed.phases[1].number, 2); assert_eq!(parsed.phases[1].title, "Implementation"); diff --git a/crates/orchestrator/src/services/executor_context.rs b/crates/orchestrator/src/services/executor_context.rs new file mode 100644 index 0000000..fffd52c --- /dev/null +++ b/crates/orchestrator/src/services/executor_context.rs @@ -0,0 +1,243 @@ +use db::{SessionRepository, TaskRepository}; +use events::{Event, EventBus, EventEnvelope}; +use opencode_client::apis::configuration::Configuration; +use opencode_core::{Session, Task, TaskStatus, UpdateTaskRequest}; +use std::path::PathBuf; +use std::sync::Arc; +use tracing::{debug, info}; +use uuid::Uuid; +use vcs::WorkspaceManager; + +use crate::activity_store::{SessionActivityRegistry, SessionActivityStore}; +use crate::error::{OrchestratorError, Result}; +use crate::files::FileManager; +use crate::services::{McpManager, OpenCodeClient}; +use crate::state_machine::TaskStateMachine; + +#[derive(Debug, Clone)] +pub struct ExecutorConfig { + pub require_plan_approval: bool, + pub require_human_review: bool, + pub max_review_iterations: u32, + pub repo_path: PathBuf, +} + +impl Default for ExecutorConfig { + fn default() -> Self { + Self { + require_plan_approval: true, + require_human_review: true, + max_review_iterations: 3, + repo_path: PathBuf::from("."), + } + } +} + +impl ExecutorConfig { + pub fn new(repo_path: impl Into) -> Self { + Self { + repo_path: repo_path.into(), + ..Default::default() + } + } + + pub fn with_plan_approval(mut self, require: bool) -> Self { + self.require_plan_approval = require; + self + } + + pub fn with_human_review(mut self, require: bool) -> Self { + self.require_human_review = require; + self + } + + pub fn with_max_iterations(mut self, max: u32) -> Self { + self.max_review_iterations = max; + self + } +} + +pub struct ExecutorContext { + pub opencode_config: Arc, + pub config: ExecutorConfig, + pub file_manager: FileManager, + pub workspace_manager: Option>, + pub session_repo: Option>, + pub task_repo: Option>, + pub event_bus: Option, + pub activity_registry: Option, + pub mcp_manager: McpManager, + pub opencode_client: OpenCodeClient, +} + +impl ExecutorContext { + pub fn new(opencode_config: Arc, config: ExecutorConfig) -> Self { + let file_manager = FileManager::new(&config.repo_path); + let mcp_manager = McpManager::new(Arc::clone(&opencode_config)); + let opencode_client = OpenCodeClient::new(Arc::clone(&opencode_config)); + Self { + opencode_config, + config, + file_manager, + workspace_manager: None, + session_repo: None, + task_repo: None, + event_bus: None, + activity_registry: None, + mcp_manager, + opencode_client, + } + } + + pub fn with_model(mut self, provider_id: &str, model_id: &str) -> Self { + self.opencode_client = self.opencode_client.with_model(provider_id, model_id); + self + } + + pub fn with_workspace_manager(mut self, manager: Arc) -> Self { + self.workspace_manager = Some(manager); + self + } + + pub fn with_session_repo(mut self, repo: Arc) -> Self { + self.session_repo = Some(repo); + self + } + + pub fn with_task_repo(mut self, repo: Arc) -> Self { + self.task_repo = Some(repo); + self + } + + pub fn with_event_bus(mut self, bus: EventBus) -> Self { + self.event_bus = Some(bus); + self + } + + pub fn with_activity_registry(mut self, registry: SessionActivityRegistry) -> Self { + self.activity_registry = Some(registry); + self + } + + pub fn file_manager(&self) -> &FileManager { + &self.file_manager + } + + pub fn transition(&self, task: &mut Task, to: TaskStatus) -> Result<()> { + let from = task.status; + info!( + from = %from.as_str(), + to = %to.as_str(), + "Task state transition" + ); + + TaskStateMachine::validate_transition(&task.status, &to)?; + task.status = to; + task.updated_at = chrono::Utc::now(); + + self.emit_event(Event::TaskStatusChanged { + task_id: task.id, + from_status: from.as_str().to_string(), + to_status: to.as_str().to_string(), + }); + + debug!( + task_id = %task.id, + new_status = %to.as_str(), + "State transition completed" + ); + + Ok(()) + } + + pub fn emit_event(&self, event: Event) { + if let Some(ref bus) = self.event_bus { + bus.publish(EventEnvelope::new(event)); + } + } + + pub async fn persist_session(&self, session: &Session) -> Result<()> { + if let Some(ref repo) = self.session_repo { + repo.create(session).await?; + } + Ok(()) + } + + pub async fn update_session(&self, session: &Session) -> Result<()> { + if let Some(ref repo) = self.session_repo { + repo.update(session).await?; + } + Ok(()) + } + + pub fn get_activity_store(&self, session_id: Uuid) -> Option> { + self.activity_registry + .as_ref() + .map(|reg| reg.get_or_create(session_id)) + } + + pub fn working_dir_for_task(&self, task: &Task) -> PathBuf { + task.workspace_path + .as_ref() + .map(PathBuf::from) + .unwrap_or_else(|| self.config.repo_path.clone()) + } + + pub async fn setup_workspace(&self, task: &mut Task) -> Result<()> { + if task.workspace_path.is_some() { + return Ok(()); + } + + if let Some(ref wm) = self.workspace_manager { + debug!("Setting up VCS workspace for task"); + let workspace = wm + .setup_workspace(&task.id.to_string()) + .await + .map_err(|e| { + OrchestratorError::ExecutionFailed(format!("Failed to setup workspace: {}", e)) + })?; + task.workspace_path = Some(workspace.path.to_string_lossy().to_string()); + + info!( + workspace_path = %workspace.path.display(), + branch = %workspace.branch_name, + "VCS workspace created" + ); + + self.emit_event(Event::WorkspaceCreated { + task_id: task.id, + path: workspace.path.to_string_lossy().to_string(), + }); + + if let Some(ref repo) = self.task_repo { + let update = UpdateTaskRequest { + workspace_path: task.workspace_path.clone(), + ..Default::default() + }; + if let Err(e) = repo.update(task.id, &update).await { + tracing::error!(error = %e, "Failed to persist workspace_path to database"); + } + } + } + Ok(()) + } + + pub fn emit_session_started(&self, session: &Session, task_id: Uuid) { + self.emit_event(Event::SessionStarted { + session_id: session.id, + task_id, + phase: session.phase.as_str().to_string(), + status: session.status.as_str().to_string(), + opencode_session_id: session.opencode_session_id.clone(), + created_at: session.created_at, + }); + } + + pub fn emit_session_ended(&self, session_id: Uuid, task_id: Uuid, success: bool) { + self.emit_event(Event::SessionEnded { + session_id, + task_id, + success, + }); + } +} diff --git a/crates/orchestrator/src/services/fix_phase.rs b/crates/orchestrator/src/services/fix_phase.rs new file mode 100644 index 0000000..a7013f8 --- /dev/null +++ b/crates/orchestrator/src/services/fix_phase.rs @@ -0,0 +1,288 @@ +use opencode_core::{Session, SessionPhase, Task, TaskStatus}; +use std::sync::Arc; +use tracing::{debug, info, warn}; + +use crate::error::{OrchestratorError, Result}; +use crate::executor::{PhaseResult, StartedExecution}; +use crate::prompts::{PhasePrompts, UserReviewComment}; +use crate::services::ExecutorContext; +use crate::session_runner::{McpConfig, SessionConfig, SessionDependencies, SessionRunner}; + +pub struct FixPhase; + +impl FixPhase { + pub async fn run(ctx: &ExecutorContext, task: &mut Task) -> Result { + info!( + task_id = %task.id, + "Starting FIX session with MCP" + ); + + let mut session = Session::new(task.id, SessionPhase::Fix); + + debug!("Creating OpenCode session for fix"); + let opencode_session = ctx + .opencode_client + .create_session(&ctx.config.repo_path) + .await?; + let session_id_str = opencode_session.id.to_string(); + + info!( + opencode_session_id = %session_id_str, + "OpenCode session created for fix" + ); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + let workspace_path = ctx.working_dir_for_task(task); + + if let Err(e) = ctx + .mcp_manager + .setup_findings_server(task.id, session.id, &workspace_path) + .await + { + warn!(error = %e, "Failed to add MCP server for fix session"); + session.fail(); + ctx.update_session(&session).await?; + + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + + return Err(OrchestratorError::ExecutionFailed(format!( + "MCP server required for fix session: {}", + e + ))); + } + + let prompt = PhasePrompts::fix_with_mcp(task); + debug!( + prompt_length = prompt.len(), + "Sending fix prompt to OpenCode" + ); + + let response_content = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &workspace_path, + activity_store.as_deref(), + ) + .await; + + let _ = ctx + .mcp_manager + .cleanup_findings_server(&workspace_path) + .await; + + let response_content = match response_content { + Ok(content) => content, + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + }; + + info!( + response_length = response_content.len(), + "Received fix session response" + ); + + session.complete(); + ctx.update_session(&session).await?; + + if let Some(ref store) = activity_store { + store.push_finished(true, None); + } + + ctx.emit_session_ended(session.id, task.id, true); + + info!(task_id = %task.id, "Fix session completed, transitioning to AI Review"); + ctx.transition(task, TaskStatus::AiReview)?; + + Ok(PhaseResult::FixCompleted { + session_id: session_id_str, + }) + } + + pub async fn run_iteration( + ctx: &ExecutorContext, + task: &mut Task, + feedback: &str, + ) -> Result { + info!( + task_id = %task.id, + feedback_length = feedback.len(), + "Starting FIX iteration based on review feedback" + ); + + let mut session = Session::new(task.id, SessionPhase::Implementation); + + debug!("Creating OpenCode session for fix iteration"); + let opencode_session = ctx + .opencode_client + .create_session(&ctx.config.repo_path) + .await?; + let session_id_str = opencode_session.id.to_string(); + + info!( + opencode_session_id = %session_id_str, + "OpenCode session created for fix iteration" + ); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + let prompt = PhasePrompts::fix_issues(task, feedback); + debug!( + prompt_length = prompt.len(), + "Sending fix prompt to OpenCode" + ); + + let workspace_path = ctx.working_dir_for_task(task); + let response = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &workspace_path, + activity_store.as_deref(), + ) + .await; + + match response { + Ok(_) => { + if let Some(ref store) = activity_store { + store.push_finished(true, None); + } + } + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + } + + info!("Fix iteration response received from OpenCode"); + + session.complete(); + ctx.update_session(&session).await?; + + ctx.emit_session_ended(session.id, task.id, true); + + ctx.transition(task, TaskStatus::AiReview)?; + + info!( + task_id = %task.id, + "FIX iteration completed, returning to AI review" + ); + + Ok(PhaseResult::SessionCreated { + session_id: session_id_str, + }) + } + + pub async fn start_async(ctx: &ExecutorContext, task: &Task) -> Result { + info!(task_id = %task.id, "Starting fix with SessionRunner"); + + let working_dir = ctx.working_dir_for_task(task); + + let mcp_config = Some(McpConfig { + workspace_path: working_dir.clone(), + setup_success: true, + }); + + let prompt = PhasePrompts::fix_with_mcp(task); + + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Fix, + prompt, + working_dir, + provider_id: ctx.opencode_client.provider_id().to_string(), + model_id: ctx.opencode_client.model_id().to_string(), + mcp_config, + implementation_phase: None, + skip_task_status_update: false, + }; + + let deps = SessionDependencies::new( + Arc::clone(&ctx.opencode_config), + ctx.session_repo.clone(), + ctx.task_repo.clone(), + ctx.event_bus.clone(), + ctx.activity_registry.clone(), + ctx.file_manager.clone(), + ); + + let result = SessionRunner::start(config, deps).await?; + + Ok(StartedExecution { + session_id: result.session_id, + opencode_session_id: result.opencode_session_id, + phase: SessionPhase::Fix, + }) + } + + pub async fn start_with_comments( + ctx: &ExecutorContext, + task: &Task, + comments: &[UserReviewComment], + ) -> Result { + info!( + task_id = %task.id, + comment_count = comments.len(), + "Starting fix with user comments" + ); + + let working_dir = ctx.working_dir_for_task(task); + + let mcp_config = Some(McpConfig { + workspace_path: working_dir.clone(), + setup_success: true, + }); + + let prompt = PhasePrompts::fix_user_comments(task, comments); + + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Fix, + prompt, + working_dir, + provider_id: ctx.opencode_client.provider_id().to_string(), + model_id: ctx.opencode_client.model_id().to_string(), + mcp_config, + implementation_phase: None, + skip_task_status_update: false, + }; + + let deps = SessionDependencies::new( + Arc::clone(&ctx.opencode_config), + ctx.session_repo.clone(), + ctx.task_repo.clone(), + ctx.event_bus.clone(), + ctx.activity_registry.clone(), + ctx.file_manager.clone(), + ); + + let result = SessionRunner::start(config, deps).await?; + + Ok(StartedExecution { + session_id: result.session_id, + opencode_session_id: result.opencode_session_id, + phase: SessionPhase::Fix, + }) + } +} diff --git a/crates/orchestrator/src/services/implementation_phase.rs b/crates/orchestrator/src/services/implementation_phase.rs new file mode 100644 index 0000000..253329c --- /dev/null +++ b/crates/orchestrator/src/services/implementation_phase.rs @@ -0,0 +1,656 @@ +use db::{SessionRepository, TaskRepository}; +use events::{Event, EventBus, EventEnvelope}; +use opencode_client::apis::configuration::Configuration; +use opencode_core::{Session, SessionPhase, Task, TaskStatus, UpdateTaskRequest}; +use std::path::PathBuf; +use std::sync::Arc; +use tracing::{debug, error, info, warn}; + +use crate::activity_store::SessionActivityRegistry; +use crate::error::{OrchestratorError, Result}; +use crate::executor::{PhaseResult, StartedExecution}; +use crate::files::{FileManager, ParsedPlan, PhaseContext, PhaseSummary}; +use crate::plan_parser::{extract_phase_summary, parse_plan_phases}; +use crate::prompts::PhasePrompts; +use crate::services::{ExecutorContext, OpenCodeClient}; +use crate::session_runner::{SessionConfig, SessionDependencies, SessionRunner}; + +pub struct ImplementationPhase; + +impl ImplementationPhase { + pub async fn run(ctx: &ExecutorContext, task: &mut Task) -> Result { + info!( + task_id = %task.id, + task_title = %task.title, + "Starting IMPLEMENTATION session" + ); + + if ctx.file_manager.plan_exists(task.id).await { + let plan_content = ctx.file_manager.read_plan(task.id).await?; + + debug!( + task_id = %task.id, + plan_length = plan_content.len(), + plan_preview = %plan_content.chars().take(500).collect::(), + "Read plan content for phase detection" + ); + + let parsed = parse_plan_phases(&plan_content); + + info!( + task_id = %task.id, + phases_count = parsed.phases.len(), + is_single_phase = parsed.is_single_phase(), + total_phases = parsed.total_phases(), + phase_titles = ?parsed.phases.iter().map(|p| &p.title).collect::>(), + "Plan parsed for implementation" + ); + + if !parsed.is_single_phase() { + info!( + task_id = %task.id, + total_phases = parsed.total_phases(), + "Plan has multiple phases, using phased implementation" + ); + return Self::run_phased(ctx, task, parsed).await; + } else { + info!( + task_id = %task.id, + "Plan has single phase, using single implementation session" + ); + } + } else { + warn!( + task_id = %task.id, + "No plan file found for task" + ); + } + + Self::run_single(ctx, task).await + } + + async fn run_single(ctx: &ExecutorContext, task: &mut Task) -> Result { + let mut session = Session::new(task.id, SessionPhase::Implementation); + + ctx.setup_workspace(task).await?; + + let working_dir = ctx.working_dir_for_task(task); + + debug!( + working_dir = %working_dir.display(), + has_workspace = task.workspace_path.is_some(), + "Creating OpenCode session for implementation" + ); + let opencode_session = ctx.opencode_client.create_session(&working_dir).await?; + let session_id_str = opencode_session.id.to_string(); + + info!( + opencode_session_id = %session_id_str, + working_dir = %working_dir.display(), + "OpenCode session created for implementation" + ); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + let plan = if ctx.file_manager.plan_exists(task.id).await { + debug!("Loading existing plan for implementation"); + ctx.file_manager.read_plan(task.id).await.ok() + } else { + debug!("No existing plan found, proceeding without plan"); + None + }; + + debug!( + has_plan = plan.is_some(), + "Generating implementation prompt" + ); + let prompt = PhasePrompts::implementation_with_plan(task, plan.as_deref()); + debug!( + prompt_length = prompt.len(), + "Sending implementation prompt to OpenCode" + ); + + let response = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &working_dir, + activity_store.as_deref(), + ) + .await; + + match response { + Ok(_) => { + if let Some(ref store) = activity_store { + store.push_finished(true, None); + } + } + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + } + + info!("Implementation response received from OpenCode"); + + session.complete(); + ctx.update_session(&session).await?; + + ctx.emit_session_ended(session.id, task.id, true); + + ctx.transition(task, TaskStatus::AiReview)?; + + info!( + task_id = %task.id, + "IMPLEMENTATION session completed, proceeding to AI review" + ); + + Ok(PhaseResult::SessionCreated { + session_id: session_id_str, + }) + } + + async fn run_phased( + ctx: &ExecutorContext, + task: &mut Task, + parsed_plan: ParsedPlan, + ) -> Result { + let mut context = ctx + .file_manager + .read_phase_context(task.id) + .await? + .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); + + info!( + task_id = %task.id, + current_phase = context.phase_number, + total_phases = context.total_phases, + "Running phased implementation" + ); + + ctx.setup_workspace(task).await?; + + let working_dir = ctx.working_dir_for_task(task); + + while !context.is_complete() { + let phase_idx = (context.phase_number - 1) as usize; + if phase_idx >= parsed_plan.phases.len() { + break; + } + + let current_phase = &parsed_plan.phases[phase_idx]; + + info!( + task_id = %task.id, + phase = context.phase_number, + total = context.total_phases, + phase_title = %current_phase.title, + "Starting implementation phase" + ); + + let mut session = Session::new_implementation_phase( + task.id, + context.phase_number, + ¤t_phase.title, + ); + + let opencode_session = ctx.opencode_client.create_session(&working_dir).await?; + let session_id_str = opencode_session.id.to_string(); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + let prompt = PhasePrompts::implementation_phase(task, current_phase, &context); + + let response = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &working_dir, + activity_store.as_deref(), + ) + .await; + + let response_text = match response { + Ok(text) => { + if let Some(ref store) = activity_store { + store.push_finished(true, None); + } + text + } + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + session.fail(); + ctx.update_session(&session).await?; + return Err(e); + } + }; + + let summary = Self::extract_or_create_summary( + &response_text, + context.phase_number, + ¤t_phase.title, + ); + + ctx.file_manager + .write_phase_summary(task.id, &summary) + .await?; + + ctx.file_manager + .mark_phase_complete_in_plan(task.id, context.phase_number) + .await?; + + ctx.emit_event(Event::PhaseCompleted { + task_id: task.id, + session_id: session.id, + phase_number: context.phase_number, + total_phases: context.total_phases, + phase_title: current_phase.title.clone(), + }); + + session.complete(); + ctx.update_session(&session).await?; + + ctx.emit_session_ended(session.id, task.id, true); + + context.advance(summary); + ctx.file_manager + .write_phase_context(task.id, &context) + .await?; + + if !context.is_complete() { + ctx.emit_event(Event::PhaseContinuing { + task_id: task.id, + next_phase_number: context.phase_number, + total_phases: context.total_phases, + }); + } + } + + ctx.transition(task, TaskStatus::AiReview)?; + + info!( + task_id = %task.id, + total_phases = context.total_phases, + "All implementation phases completed, proceeding to AI review" + ); + + Ok(PhaseResult::PhasedImplementationComplete { + total_phases: context.total_phases, + }) + } + + fn extract_or_create_summary( + response: &str, + phase_number: u32, + phase_title: &str, + ) -> PhaseSummary { + if let Some(extracted) = extract_phase_summary(response) { + return PhaseSummary::new( + phase_number, + phase_title, + extracted.summary, + extracted.files_changed, + extracted.notes, + ); + } + + info!( + phase = phase_number, + "No structured summary found in response, creating basic summary" + ); + + let summary = if response.len() > 500 { + format!("{}...", &response[..497]) + } else { + response.to_string() + }; + + PhaseSummary::new(phase_number, phase_title, summary, Vec::new(), None) + } + + pub async fn start_async(ctx: &ExecutorContext, task: &mut Task) -> Result { + info!(task_id = %task.id, "Starting implementation with SessionRunner"); + + ctx.setup_workspace(task).await?; + + let working_dir = ctx.working_dir_for_task(task); + + if ctx.file_manager.plan_exists(task.id).await { + let plan_content = ctx.file_manager.read_plan(task.id).await?; + let parsed = parse_plan_phases(&plan_content); + + info!( + task_id = %task.id, + phases_count = parsed.phases.len(), + is_single_phase = parsed.is_single_phase(), + "Checking plan for phased implementation" + ); + + if !parsed.is_single_phase() { + info!( + task_id = %task.id, + total_phases = parsed.total_phases(), + "Using phased implementation for multi-phase plan" + ); + return Self::start_phased_async(ctx, task, parsed, working_dir).await; + } + } + + let plan = if ctx.file_manager.plan_exists(task.id).await { + ctx.file_manager.read_plan(task.id).await.ok() + } else { + None + }; + let prompt = PhasePrompts::implementation_with_plan(task, plan.as_deref()); + + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Implementation, + prompt, + working_dir, + provider_id: ctx.opencode_client.provider_id().to_string(), + model_id: ctx.opencode_client.model_id().to_string(), + mcp_config: None, + implementation_phase: None, + skip_task_status_update: false, + }; + + let deps = SessionDependencies::new( + Arc::clone(&ctx.opencode_config), + ctx.session_repo.clone(), + ctx.task_repo.clone(), + ctx.event_bus.clone(), + ctx.activity_registry.clone(), + ctx.file_manager.clone(), + ); + + let result = SessionRunner::start(config, deps).await?; + + Ok(StartedExecution { + session_id: result.session_id, + opencode_session_id: result.opencode_session_id, + phase: SessionPhase::Implementation, + }) + } + + async fn start_phased_async( + ctx: &ExecutorContext, + task: &mut Task, + parsed_plan: ParsedPlan, + working_dir: PathBuf, + ) -> Result { + let context = ctx + .file_manager + .read_phase_context(task.id) + .await? + .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); + + let phase_idx = (context.phase_number - 1) as usize; + let current_phase = parsed_plan.phases.get(phase_idx).ok_or_else(|| { + OrchestratorError::ExecutionFailed(format!( + "Phase {} not found in plan", + context.phase_number + )) + })?; + + let opencode_session = ctx.opencode_client.create_session(&working_dir).await?; + let opencode_session_id = opencode_session.id.to_string(); + + let mut session = + Session::new_implementation_phase(task.id, context.phase_number, ¤t_phase.title); + session.start(opencode_session_id.clone()); + ctx.persist_session(&session).await?; + + ctx.emit_session_started(&session, task.id); + + let first_session_id = session.id; + let first_opencode_session_id = opencode_session_id.clone(); + let return_opencode_session_id = first_opencode_session_id.clone(); + + let task_id = task.id; + let task_clone = task.clone(); + let file_manager = ctx.file_manager.clone(); + let session_repo = ctx.session_repo.clone(); + let task_repo = ctx.task_repo.clone(); + let event_bus = ctx.event_bus.clone(); + let activity_registry = ctx.activity_registry.clone(); + let opencode_config = Arc::clone(&ctx.opencode_config); + let provider_id = ctx.opencode_client.provider_id().to_string(); + let model_id = ctx.opencode_client.model_id().to_string(); + + tokio::spawn(async move { + let mut task = task_clone; + match Self::run_phased_background( + &mut task, + parsed_plan, + working_dir, + first_session_id, + first_opencode_session_id, + file_manager, + session_repo, + task_repo, + event_bus, + activity_registry, + opencode_config, + provider_id, + model_id, + ) + .await + { + Ok(_) => { + info!(task_id = %task_id, "Phased implementation completed successfully"); + } + Err(e) => { + error!(task_id = %task_id, error = %e, "Phased implementation failed"); + } + } + }); + + Ok(StartedExecution { + session_id: first_session_id, + opencode_session_id: return_opencode_session_id, + phase: SessionPhase::Implementation, + }) + } + + #[allow(clippy::too_many_arguments)] + async fn run_phased_background( + task: &mut Task, + parsed_plan: ParsedPlan, + working_dir: PathBuf, + first_session_id: uuid::Uuid, + first_opencode_session_id: String, + file_manager: FileManager, + session_repo: Option>, + task_repo: Option>, + event_bus: Option, + activity_registry: Option, + opencode_config: Arc, + provider_id: String, + model_id: String, + ) -> Result<()> { + let mut context = file_manager + .read_phase_context(task.id) + .await? + .unwrap_or_else(|| PhaseContext::new(parsed_plan.total_phases())); + + info!( + task_id = %task.id, + current_phase = context.phase_number, + total_phases = context.total_phases, + "Starting phased implementation" + ); + + let mut is_first_phase = true; + + while !context.is_complete() { + let phase_idx = (context.phase_number - 1) as usize; + if phase_idx >= parsed_plan.phases.len() { + break; + } + + let current_phase = &parsed_plan.phases[phase_idx]; + + info!( + task_id = %task.id, + phase = context.phase_number, + total = context.total_phases, + phase_title = %current_phase.title, + "Starting phase" + ); + + let (session_id, opencode_session_id) = if is_first_phase { + is_first_phase = false; + (first_session_id, first_opencode_session_id.clone()) + } else { + let opencode_session = + OpenCodeClient::create_session_static(&opencode_config, working_dir.to_str()) + .await?; + let new_opencode_session_id = opencode_session.id.to_string(); + + let mut session = Session::new_implementation_phase( + task.id, + context.phase_number, + ¤t_phase.title, + ); + session.start(new_opencode_session_id.clone()); + + if let Some(ref repo) = session_repo { + repo.create(&session).await.map_err(|e| { + OrchestratorError::ExecutionFailed(format!( + "Failed to persist session: {}", + e + )) + })?; + } + + if let Some(ref bus) = event_bus { + bus.publish(EventEnvelope::new(Event::SessionStarted { + session_id: session.id, + task_id: task.id, + phase: session.phase.as_str().to_string(), + status: session.status.as_str().to_string(), + opencode_session_id: session.opencode_session_id.clone(), + created_at: session.created_at, + })); + } + + (session.id, new_opencode_session_id) + }; + + let prompt = PhasePrompts::implementation_phase(task, current_phase, &context); + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Implementation, + prompt, + working_dir: working_dir.clone(), + provider_id: provider_id.clone(), + model_id: model_id.clone(), + mcp_config: None, + implementation_phase: Some((context.phase_number, current_phase.title.clone())), + skip_task_status_update: true, + }; + + let deps = SessionDependencies::new( + Arc::clone(&opencode_config), + session_repo.clone(), + task_repo.clone(), + event_bus.clone(), + activity_registry.clone(), + file_manager.clone(), + ); + + let opencode_session_id_clone = opencode_session_id.clone(); + let (success, response_text) = SessionRunner::execute_and_complete( + config, + deps, + session_id, + opencode_session_id_clone, + ) + .await; + + if !success { + return Err(OrchestratorError::ExecutionFailed(format!( + "Phase {} failed", + context.phase_number + ))); + } + + let summary = Self::extract_or_create_summary( + &response_text, + context.phase_number, + ¤t_phase.title, + ); + + file_manager.write_phase_summary(task.id, &summary).await?; + file_manager + .mark_phase_complete_in_plan(task.id, context.phase_number) + .await?; + + if let Some(ref bus) = event_bus { + bus.publish(EventEnvelope::new(Event::PhaseCompleted { + task_id: task.id, + session_id, + phase_number: context.phase_number, + total_phases: context.total_phases, + phase_title: current_phase.title.clone(), + })); + } + + context.advance(summary); + file_manager.write_phase_context(task.id, &context).await?; + + if !context.is_complete() { + if let Some(ref bus) = event_bus { + bus.publish(EventEnvelope::new(Event::PhaseContinuing { + task_id: task.id, + next_phase_number: context.phase_number, + total_phases: context.total_phases, + })); + } + } + } + + task.status = TaskStatus::AiReview; + + if let Some(ref repo) = task_repo { + let update = UpdateTaskRequest { + status: Some(TaskStatus::AiReview), + ..Default::default() + }; + let _ = repo.update(task.id, &update).await; + } + + if let Some(ref bus) = event_bus { + bus.publish(EventEnvelope::new(Event::TaskStatusChanged { + task_id: task.id, + from_status: TaskStatus::InProgress.as_str().to_string(), + to_status: TaskStatus::AiReview.as_str().to_string(), + })); + } + + info!( + task_id = %task.id, + total_phases = context.total_phases, + "All phases completed, proceeding to AI review" + ); + + Ok(()) + } +} diff --git a/crates/orchestrator/src/services/mcp_manager.rs b/crates/orchestrator/src/services/mcp_manager.rs new file mode 100644 index 0000000..4d6bc54 --- /dev/null +++ b/crates/orchestrator/src/services/mcp_manager.rs @@ -0,0 +1,108 @@ +use opencode_client::apis::configuration::Configuration; +use opencode_client::apis::default_api; +use opencode_client::models::{McpAddRequest, McpAddRequestConfig}; +use std::collections::HashMap; +use std::path::Path; +use std::sync::Arc; +use tracing::{error, info, warn}; +use uuid::Uuid; + +use crate::error::{OrchestratorError, Result}; + +pub struct McpManager { + opencode_config: Arc, +} + +impl McpManager { + pub fn new(opencode_config: Arc) -> Self { + Self { opencode_config } + } + + pub async fn setup_findings_server( + &self, + task_id: Uuid, + session_id: Uuid, + workspace_path: &Path, + ) -> Result<()> { + let mcp_binary = self.get_binary_path(); + + let mut environment = HashMap::new(); + environment.insert("OPENCODE_TASK_ID".to_string(), task_id.to_string()); + environment.insert("OPENCODE_SESSION_ID".to_string(), session_id.to_string()); + environment.insert( + "OPENCODE_WORKSPACE_PATH".to_string(), + workspace_path.to_string_lossy().to_string(), + ); + + let mut config = McpAddRequestConfig::local(vec![mcp_binary]); + config.environment = Some(environment); + config.enabled = Some(true); + config.timeout = Some(10000); + + let request = McpAddRequest::new("opencode-findings".to_string(), config); + let directory = workspace_path.to_str(); + + info!( + task_id = %task_id, + session_id = %session_id, + "Adding MCP findings server to OpenCode" + ); + + default_api::mcp_add(&self.opencode_config, directory, Some(request)) + .await + .map_err(|e| { + error!(error = %e, "Failed to add MCP findings server"); + OrchestratorError::OpenCodeError(format!("Failed to add MCP server: {}", e)) + })?; + + default_api::mcp_connect(&self.opencode_config, "opencode-findings", directory) + .await + .map_err(|e| { + error!(error = %e, "Failed to connect MCP findings server"); + OrchestratorError::OpenCodeError(format!("Failed to connect MCP server: {}", e)) + })?; + + info!("MCP findings server connected"); + Ok(()) + } + + pub async fn cleanup_findings_server(&self, workspace_path: &Path) -> Result<()> { + let directory = workspace_path.to_str(); + + info!("Disconnecting MCP findings server"); + + if let Err(e) = + default_api::mcp_disconnect(&self.opencode_config, "opencode-findings", directory).await + { + warn!(error = %e, "Failed to disconnect MCP findings server (may already be disconnected)"); + } + + Ok(()) + } + + fn get_binary_path(&self) -> String { + if cfg!(debug_assertions) { + if let Ok(exe_path) = std::env::current_exe() { + if let Some(parent) = exe_path.parent() { + let mcp_path = parent.join("opencode-mcp-findings"); + if mcp_path.exists() { + return mcp_path.to_string_lossy().to_string(); + } + } + } + } + "opencode-mcp-findings".to_string() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_mcp_manager_creation() { + let config = Arc::new(Configuration::new()); + let manager = McpManager::new(config); + assert!(!manager.get_binary_path().is_empty()); + } +} diff --git a/crates/orchestrator/src/services/message_parser.rs b/crates/orchestrator/src/services/message_parser.rs new file mode 100644 index 0000000..3ba4a1f --- /dev/null +++ b/crates/orchestrator/src/services/message_parser.rs @@ -0,0 +1,327 @@ +use opencode_client::models::Part; +use tracing::debug; +use uuid::Uuid; + +use crate::activity_store::SessionActivityMsg; +use crate::error::{OrchestratorError, Result}; +use crate::files::{FindingSeverity, FindingStatus, ReviewFinding, ReviewFindings}; + +#[derive(Debug, serde::Deserialize)] +pub struct RawReviewResponse { + pub approved: bool, + pub summary: String, + #[serde(default)] + pub findings: Vec, +} + +#[derive(Debug, serde::Deserialize)] +pub struct RawFinding { + #[serde(default)] + pub file_path: Option, + #[serde(default)] + pub line_start: Option, + #[serde(default)] + pub line_end: Option, + pub title: String, + pub description: String, + #[serde(default = "default_severity")] + pub severity: String, +} + +fn default_severity() -> String { + "warning".to_string() +} + +pub struct MessageParser; + +impl MessageParser { + pub fn extract_text_from_parts(parts: &[Part]) -> String { + parts + .iter() + .filter_map(|part| { + if part.r#type == opencode_client::models::part::Type::Text { + part.text.as_deref() + } else { + None + } + }) + .collect::>() + .join("\n") + } + + pub fn parse_message_parts(parts: &[Part]) -> Vec { + use opencode_client::models::part::Type; + + let mut activities = Vec::new(); + + for part in parts { + match part.r#type { + Type::Text => { + let id = format!("text-{}", Uuid::new_v4()); + let text = part.text.as_deref().unwrap_or(""); + activities.push(SessionActivityMsg::agent_message(&id, text, false)); + } + Type::Reasoning => { + let id = format!("reasoning-{}", Uuid::new_v4()); + activities.push(SessionActivityMsg::Reasoning { + id, + content: part.text.clone().unwrap_or_default(), + timestamp: chrono::Utc::now(), + }); + } + Type::Tool => { + let call_id = part.call_id.as_deref().unwrap_or(""); + let tool_name = part.tool.as_deref().unwrap_or("unknown"); + + if let Some(ref state) = part.state { + let output = state.output.as_deref().unwrap_or(""); + let error = state.error.as_deref().unwrap_or(""); + let is_completed = !output.is_empty() || !error.is_empty(); + + if is_completed { + let success = error.is_empty(); + let result = if success { output } else { error }; + activities.push(SessionActivityMsg::tool_result( + call_id, tool_name, None, result, success, + )); + } else { + activities + .push(SessionActivityMsg::tool_call(call_id, tool_name, None)); + } + } else { + activities.push(SessionActivityMsg::tool_call(call_id, tool_name, None)); + } + } + Type::StepStart => { + let id = format!("step-{}", Uuid::new_v4()); + activities.push(SessionActivityMsg::StepStart { + id, + step_name: None, + timestamp: chrono::Utc::now(), + }); + } + _ => { + debug!("Skipping part type: {:?}", part.r#type); + } + } + } + + activities + } + + pub fn parse_sse_part(part: &serde_json::Value) -> Option { + let part_type = part.get("type")?.as_str()?; + let id = part.get("id").and_then(|v| v.as_str()).unwrap_or("unknown"); + + match part_type { + "text" => { + let text = part.get("text").and_then(|v| v.as_str()).unwrap_or(""); + let is_partial = part.get("time").and_then(|t| t.get("end")).is_none(); + Some(SessionActivityMsg::agent_message(id, text, is_partial)) + } + "reasoning" => { + let content = part.get("text").and_then(|v| v.as_str()).unwrap_or(""); + Some(SessionActivityMsg::Reasoning { + id: id.to_string(), + content: content.to_string(), + timestamp: chrono::Utc::now(), + }) + } + "tool" => { + let call_id = part.get("callID").and_then(|v| v.as_str()).unwrap_or(id); + let tool_name = part + .get("tool") + .and_then(|v| v.as_str()) + .unwrap_or("unknown"); + let state = part.get("state"); + + let status = state + .and_then(|s| s.get("status")) + .and_then(|v| v.as_str()) + .unwrap_or("pending"); + + if status == "completed" || status == "error" { + let success = status == "completed"; + let output = state + .and_then(|s| s.get("output")) + .and_then(|v| v.as_str()) + .unwrap_or(""); + let error = state + .and_then(|s| s.get("error")) + .and_then(|v| v.as_str()) + .unwrap_or(""); + let result = if success { output } else { error }; + + Some(SessionActivityMsg::tool_result( + call_id, tool_name, None, result, success, + )) + } else { + Some(SessionActivityMsg::tool_call(call_id, tool_name, None)) + } + } + "step-start" => Some(SessionActivityMsg::StepStart { + id: id.to_string(), + step_name: None, + timestamp: chrono::Utc::now(), + }), + _ => { + debug!(part_type = %part_type, "Skipping unknown SSE part type"); + None + } + } + } + + pub fn parse_review_json( + content: &str, + task_id: Uuid, + session_id: Uuid, + ) -> Result { + let json_str = Self::extract_json_from_response(content); + + let raw: RawReviewResponse = serde_json::from_str(&json_str).map_err(|e| { + tracing::warn!( + error = %e, + content_preview = %content.chars().take(500).collect::(), + "Failed to parse review JSON, falling back to text parsing" + ); + OrchestratorError::ExecutionFailed(format!("Failed to parse review JSON: {}", e)) + })?; + + let findings: Vec = raw + .findings + .into_iter() + .enumerate() + .map(|(i, f)| ReviewFinding { + id: format!("finding-{}", i + 1), + file_path: f.file_path, + line_start: f.line_start, + line_end: f.line_end, + title: f.title, + description: f.description, + severity: match f.severity.to_lowercase().as_str() { + "error" => FindingSeverity::Error, + "info" => FindingSeverity::Info, + _ => FindingSeverity::Warning, + }, + status: FindingStatus::Pending, + }) + .collect(); + + Ok(ReviewFindings::with_findings( + task_id, + session_id, + raw.summary, + findings, + )) + } + + pub fn extract_json_from_response(content: &str) -> String { + if let Some(start) = content.find("```json") { + if let Some(end) = content[start..] + .find("```\n") + .or(content[start..].rfind("```")) + { + let json_start = start + 7; + let json_content = &content[json_start..start + end]; + return json_content.trim().to_string(); + } + } + + if let Some(start) = content.find("```\n{") { + if let Some(end) = content[start + 4..].find("\n```") { + return content[start + 4..start + 4 + end].trim().to_string(); + } + } + + if let Some(start) = content.find('{') { + if let Some(end) = content.rfind('}') { + return content[start..=end].to_string(); + } + } + + content.to_string() + } + + pub fn parse_review_response(content: &str) -> ReviewResult { + let content_upper = content.to_uppercase(); + + if content_upper.contains("APPROVED") && !content_upper.contains("NOT APPROVED") { + ReviewResult::Approved + } else if content_upper.contains("CHANGES_REQUESTED") + || content_upper.contains("CHANGES REQUESTED") + || content_upper.contains("REJECTED") + { + let feedback = content + .lines() + .skip_while(|line| { + let upper = line.to_uppercase(); + !upper.contains("CHANGES_REQUESTED") + && !upper.contains("CHANGES REQUESTED") + && !upper.contains("REJECTED") + && !upper.contains("FEEDBACK") + && !upper.contains("ISSUES") + }) + .skip(1) + .collect::>() + .join("\n") + .trim() + .to_string(); + + if feedback.is_empty() { + ReviewResult::ChangesRequested(content.to_string()) + } else { + ReviewResult::ChangesRequested(feedback) + } + } else { + ReviewResult::ChangesRequested( + "Review response unclear. Manual review required.".to_string(), + ) + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ReviewResult { + Approved, + ChangesRequested(String), + FindingsDetected(usize), +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_review_approved() { + let content = "## Review\n\nThe code looks good.\n\nAPPROVED"; + let result = MessageParser::parse_review_response(content); + assert_eq!(result, ReviewResult::Approved); + } + + #[test] + fn test_parse_review_changes_requested() { + let content = "## Review\n\nCHANGES_REQUESTED\n\n- Fix the error handling\n- Add tests"; + let result = MessageParser::parse_review_response(content); + match result { + ReviewResult::ChangesRequested(feedback) => { + assert!(feedback.contains("Fix the error handling")); + } + _ => panic!("Expected ChangesRequested"), + } + } + + #[test] + fn test_extract_json_from_markdown() { + let content = "Some text\n```json\n{\"approved\": true}\n```\nMore text"; + let json = MessageParser::extract_json_from_response(content); + assert!(json.contains("approved")); + } + + #[test] + fn test_extract_json_raw() { + let content = "Response: {\"approved\": false, \"summary\": \"test\"}"; + let json = MessageParser::extract_json_from_response(content); + assert!(json.starts_with('{')); + assert!(json.ends_with('}')); + } +} diff --git a/crates/orchestrator/src/services/mod.rs b/crates/orchestrator/src/services/mod.rs new file mode 100644 index 0000000..3eeaa9e --- /dev/null +++ b/crates/orchestrator/src/services/mod.rs @@ -0,0 +1,17 @@ +pub mod executor_context; +pub mod fix_phase; +pub mod implementation_phase; +pub mod mcp_manager; +pub mod message_parser; +pub mod opencode_client; +pub mod planning_phase; +pub mod review_phase; + +pub use executor_context::{ExecutorConfig, ExecutorContext}; +pub use fix_phase::FixPhase; +pub use implementation_phase::ImplementationPhase; +pub use mcp_manager::McpManager; +pub use message_parser::MessageParser; +pub use opencode_client::OpenCodeClient; +pub use planning_phase::PlanningPhase; +pub use review_phase::ReviewPhase; diff --git a/crates/orchestrator/src/services/opencode_client.rs b/crates/orchestrator/src/services/opencode_client.rs new file mode 100644 index 0000000..2e45a25 --- /dev/null +++ b/crates/orchestrator/src/services/opencode_client.rs @@ -0,0 +1,214 @@ +use opencode_client::apis::configuration::Configuration; +use opencode_client::apis::default_api; +use opencode_client::models::{ + Part, Session as OpenCodeSession, SessionCreateRequest, SessionPromptRequest, + SessionPromptRequestPartsInner, +}; +use std::path::Path; +use std::sync::Arc; +use tracing::{error, info}; + +use crate::activity_store::SessionActivityStore; +use crate::error::{OrchestratorError, Result}; +use crate::services::MessageParser; + +const DEFAULT_PROVIDER_ID: &str = "anthropic"; +const DEFAULT_MODEL_ID: &str = "claude-sonnet-4-20250514"; + +pub struct OpenCodeClient { + config: Arc, + provider_id: String, + model_id: String, +} + +impl OpenCodeClient { + pub fn new(config: Arc) -> Self { + Self { + config, + provider_id: DEFAULT_PROVIDER_ID.to_string(), + model_id: DEFAULT_MODEL_ID.to_string(), + } + } + + pub fn with_model(mut self, provider_id: &str, model_id: &str) -> Self { + self.provider_id = provider_id.to_string(); + self.model_id = model_id.to_string(); + self + } + + pub fn provider_id(&self) -> &str { + &self.provider_id + } + + pub fn model_id(&self) -> &str { + &self.model_id + } + + pub fn config(&self) -> &Arc { + &self.config + } + + pub async fn create_session(&self, working_dir: &Path) -> Result { + let request = SessionCreateRequest { + title: None, + parent_id: None, + }; + + let directory = working_dir.to_str(); + info!( + directory = ?directory, + "Creating OpenCode session in directory" + ); + + default_api::session_create(&self.config, directory, Some(request)) + .await + .map_err(|e| { + error!(error = %e, directory = ?directory, "Failed to create OpenCode session"); + OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e)) + }) + } + + pub async fn send_prompt( + &self, + session_id: &str, + prompt: &str, + working_dir: &Path, + activity_store: Option<&SessionActivityStore>, + ) -> Result { + let model = opencode_client::models::SessionPromptRequestModel { + provider_id: self.provider_id.clone(), + model_id: self.model_id.clone(), + }; + + let request = SessionPromptRequest { + parts: vec![Self::create_text_part(prompt)], + model: Some(Box::new(model)), + message_id: None, + agent: None, + no_reply: None, + tools: None, + system: None, + variant: None, + }; + + let directory = working_dir.to_str(); + let response = default_api::session_prompt( + &self.config, + session_id, + directory, + Some(request), + ) + .await + .map_err(|e| { + error!(error = %e, directory = ?directory, "Failed to send message to OpenCode"); + OrchestratorError::OpenCodeError(format!("Failed to send message: {}", e)) + })?; + + if let Some(store) = activity_store { + Self::push_activities_to_store(store, &response.parts); + } + + Ok(MessageParser::extract_text_from_parts(&response.parts)) + } + + pub async fn send_prompt_sync( + config: &Configuration, + session_id: &str, + prompt: &str, + directory: Option<&str>, + ) -> Result { + let request = SessionPromptRequest { + parts: vec![Self::create_text_part(prompt)], + model: None, + message_id: None, + agent: None, + no_reply: None, + tools: None, + system: None, + variant: None, + }; + + let response = default_api::session_prompt(config, session_id, directory, Some(request)) + .await + .map_err(|e| { + error!(error = %e, directory = ?directory, "Failed to send message to OpenCode"); + OrchestratorError::OpenCodeError(format!("Failed to send message: {}", e)) + })?; + + Ok(MessageParser::extract_text_from_parts(&response.parts)) + } + + pub async fn create_session_static( + config: &Configuration, + directory: Option<&str>, + ) -> Result { + let request = SessionCreateRequest { + title: None, + parent_id: None, + }; + + default_api::session_create(config, directory, Some(request)) + .await + .map_err(|e| { + OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e)) + }) + } + + fn create_text_part(text: &str) -> SessionPromptRequestPartsInner { + SessionPromptRequestPartsInner { + r#type: opencode_client::models::session_prompt_request_parts_inner::Type::Text, + text: text.to_string(), + id: None, + synthetic: None, + ignored: None, + time: None, + metadata: None, + mime: String::new(), + filename: None, + url: String::new(), + source: None, + name: String::new(), + prompt: String::new(), + description: String::new(), + agent: String::new(), + command: None, + } + } + + fn push_activities_to_store(store: &SessionActivityStore, parts: &[Part]) { + for activity in MessageParser::parse_message_parts(parts) { + store.push(activity); + } + } +} + +impl Clone for OpenCodeClient { + fn clone(&self) -> Self { + Self { + config: Arc::clone(&self.config), + provider_id: self.provider_id.clone(), + model_id: self.model_id.clone(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_opencode_client_creation() { + let config = Arc::new(Configuration::new()); + let client = OpenCodeClient::new(config); + assert_eq!(client.provider_id(), DEFAULT_PROVIDER_ID); + assert_eq!(client.model_id(), DEFAULT_MODEL_ID); + } + + #[test] + fn test_opencode_client_with_model() { + let config = Arc::new(Configuration::new()); + let client = OpenCodeClient::new(config).with_model("openai", "gpt-4"); + assert_eq!(client.provider_id(), "openai"); + assert_eq!(client.model_id(), "gpt-4"); + } +} diff --git a/crates/orchestrator/src/services/planning_phase.rs b/crates/orchestrator/src/services/planning_phase.rs new file mode 100644 index 0000000..bfefe88 --- /dev/null +++ b/crates/orchestrator/src/services/planning_phase.rs @@ -0,0 +1,144 @@ +use opencode_core::{Session, SessionPhase, Task, TaskStatus}; +use std::sync::Arc; +use tracing::{debug, info}; + +use crate::error::Result; +use crate::executor::{PhaseResult, StartedExecution}; +use crate::prompts::PhasePrompts; +use crate::services::ExecutorContext; +use crate::session_runner::{SessionConfig, SessionDependencies, SessionRunner}; + +pub struct PlanningPhase; + +impl PlanningPhase { + pub async fn run(ctx: &ExecutorContext, task: &mut Task) -> Result { + info!( + task_id = %task.id, + task_title = %task.title, + "Starting PLANNING session" + ); + + let mut session = Session::new(task.id, SessionPhase::Planning); + + debug!("Creating OpenCode session for planning"); + let opencode_session = ctx + .opencode_client + .create_session(&ctx.config.repo_path) + .await?; + let session_id_str = opencode_session.id.to_string(); + + info!( + opencode_session_id = %session_id_str, + "OpenCode session created" + ); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + debug!("Generating planning prompt"); + let prompt = PhasePrompts::planning(task); + debug!( + prompt_length = prompt.len(), + "Sending planning prompt to OpenCode" + ); + + let response_content = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &ctx.config.repo_path, + activity_store.as_deref(), + ) + .await; + + let response_content = match response_content { + Ok(content) => { + if let Some(ref store) = activity_store { + store.push_finished(true, None); + } + content + } + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + }; + + info!( + response_length = response_content.len(), + "Received planning response" + ); + + let plan_path = ctx + .file_manager + .write_plan(task.id, &response_content) + .await?; + + info!(plan_path = %plan_path.display(), "Plan saved to file"); + + session.complete(); + ctx.update_session(&session).await?; + ctx.emit_session_ended(session.id, task.id, true); + + ctx.transition(task, TaskStatus::PlanningReview)?; + + info!( + task_id = %task.id, + "PLANNING session completed, awaiting review" + ); + + Ok(PhaseResult::PlanCreated { + session_id: session_id_str, + plan_path: plan_path.to_string_lossy().to_string(), + }) + } + + pub async fn start_async(ctx: &ExecutorContext, task: &Task) -> Result { + info!(task_id = %task.id, "Starting planning with SessionRunner"); + + let prompt = PhasePrompts::planning(task); + + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Planning, + prompt, + working_dir: ctx.config.repo_path.clone(), + provider_id: ctx.opencode_client.provider_id().to_string(), + model_id: ctx.opencode_client.model_id().to_string(), + mcp_config: None, + implementation_phase: None, + skip_task_status_update: false, + }; + + let deps = SessionDependencies::new( + Arc::clone(&ctx.opencode_config), + ctx.session_repo.clone(), + ctx.task_repo.clone(), + ctx.event_bus.clone(), + ctx.activity_registry.clone(), + ctx.file_manager.clone(), + ); + + let result = SessionRunner::start(config, deps).await?; + + info!( + task_id = %task.id, + session_id = %result.session_id, + opencode_session_id = %result.opencode_session_id, + "Planning started via SessionRunner" + ); + + Ok(StartedExecution { + session_id: result.session_id, + opencode_session_id: result.opencode_session_id, + phase: SessionPhase::Planning, + }) + } +} diff --git a/crates/orchestrator/src/services/review_phase.rs b/crates/orchestrator/src/services/review_phase.rs new file mode 100644 index 0000000..1399f27 --- /dev/null +++ b/crates/orchestrator/src/services/review_phase.rs @@ -0,0 +1,376 @@ +use opencode_core::{Session, SessionPhase, Task, TaskStatus}; +use std::path::PathBuf; +use std::sync::Arc; +use tracing::{debug, info, warn}; +use uuid::Uuid; +use vcs::Workspace; + +use crate::error::{OrchestratorError, Result}; +use crate::executor::{PhaseResult, StartedExecution}; +use crate::prompts::PhasePrompts; +use crate::services::message_parser::ReviewResult; +use crate::services::{ExecutorContext, MessageParser}; +use crate::session_runner::{McpConfig, SessionConfig, SessionDependencies, SessionRunner}; + +pub struct ReviewPhase; + +impl ReviewPhase { + pub async fn run( + ctx: &ExecutorContext, + task: &mut Task, + iteration: u32, + ) -> Result { + info!( + task_id = %task.id, + iteration = iteration, + max_iterations = ctx.config.max_review_iterations, + "Starting AI_REVIEW session with MCP" + ); + + let mut session = Session::new(task.id, SessionPhase::Review); + + debug!("Creating OpenCode session for AI review"); + let opencode_session = ctx + .opencode_client + .create_session(&ctx.config.repo_path) + .await?; + let session_id_str = opencode_session.id.to_string(); + + info!( + opencode_session_id = %session_id_str, + "OpenCode session created for AI review" + ); + + session.start(session_id_str.clone()); + ctx.persist_session(&session).await?; + + let activity_store = ctx.get_activity_store(session.id); + ctx.emit_session_started(&session, task.id); + + let workspace_path = ctx.working_dir_for_task(task); + + if let Err(e) = ctx + .mcp_manager + .setup_findings_server(task.id, session.id, &workspace_path) + .await + { + warn!(error = %e, "Failed to add MCP server, falling back to JSON parsing"); + return Self::run_json_fallback( + ctx, + task, + session, + session_id_str, + activity_store, + iteration, + ) + .await; + } + + debug!("Getting workspace diff for review"); + let diff = Self::get_workspace_diff(ctx, task).await?; + debug!(diff_length = diff.len(), "Workspace diff retrieved"); + + let prompt = PhasePrompts::review_with_mcp(task, &diff); + debug!( + prompt_length = prompt.len(), + "Sending MCP review prompt to OpenCode" + ); + + let response_content = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &workspace_path, + activity_store.as_deref(), + ) + .await; + + let _ = ctx + .mcp_manager + .cleanup_findings_server(&workspace_path) + .await; + + let response_content = match response_content { + Ok(content) => content, + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + }; + + info!( + response_length = response_content.len(), + "Received AI review response" + ); + + let _review_path = ctx + .file_manager + .write_review(task.id, &response_content) + .await?; + + session.complete(); + ctx.update_session(&session).await?; + + let review_result = match ctx.file_manager.read_findings(task.id).await { + Ok(Some(findings)) => { + info!( + approved = findings.approved, + finding_count = findings.findings.len(), + "AI review findings read from MCP server" + ); + + if findings.approved || findings.findings.is_empty() { + ReviewResult::Approved + } else { + ReviewResult::FindingsDetected(findings.findings.len()) + } + } + Ok(None) => { + warn!("No MCP findings file found, falling back to JSON parsing"); + Self::parse_and_save_findings(ctx, &response_content, task.id, session.id).await + } + Err(e) => { + warn!(error = %e, "Failed to read MCP findings, falling back to JSON parsing"); + Self::parse_and_save_findings(ctx, &response_content, task.id, session.id).await + } + }; + + let success = matches!(review_result, ReviewResult::Approved); + + if let Some(ref store) = activity_store { + store.push_finished(success, None); + } + + info!( + review_result = ?review_result, + "AI review result processed" + ); + + ctx.emit_session_ended(session.id, task.id, success); + + Self::handle_review_result(ctx, task, review_result, session_id_str, iteration).await + } + + async fn run_json_fallback( + ctx: &ExecutorContext, + task: &mut Task, + mut session: Session, + session_id_str: String, + activity_store: Option>, + iteration: u32, + ) -> Result { + debug!("Getting workspace diff for review"); + let diff = Self::get_workspace_diff(ctx, task).await?; + debug!(diff_length = diff.len(), "Workspace diff retrieved"); + + let prompt = PhasePrompts::review(task, &diff); + debug!( + prompt_length = prompt.len(), + "Sending review prompt to OpenCode" + ); + + let workspace_path = ctx.working_dir_for_task(task); + let response_content = ctx + .opencode_client + .send_prompt( + &session_id_str, + &prompt, + &workspace_path, + activity_store.as_deref(), + ) + .await; + + let response_content = match response_content { + Ok(content) => content, + Err(e) => { + if let Some(ref store) = activity_store { + store.push_finished(false, Some(e.to_string())); + } + return Err(e); + } + }; + + info!( + response_length = response_content.len(), + "Received AI review response" + ); + + let _review_path = ctx + .file_manager + .write_review(task.id, &response_content) + .await?; + + session.complete(); + ctx.update_session(&session).await?; + + let review_result = + Self::parse_and_save_findings(ctx, &response_content, task.id, session.id).await; + + let success = matches!(review_result, ReviewResult::Approved); + + if let Some(ref store) = activity_store { + store.push_finished(success, None); + } + + ctx.emit_session_ended(session.id, task.id, success); + + Self::handle_review_result(ctx, task, review_result, session_id_str, iteration).await + } + + async fn parse_and_save_findings( + ctx: &ExecutorContext, + response_content: &str, + task_id: Uuid, + session_id: Uuid, + ) -> ReviewResult { + match MessageParser::parse_review_json(response_content, task_id, session_id) { + Ok(findings) => { + let _ = ctx.file_manager.write_findings(task_id, &findings).await; + if findings.approved || findings.findings.is_empty() { + ReviewResult::Approved + } else { + ReviewResult::FindingsDetected(findings.findings.len()) + } + } + Err(_) => { + warn!("Falling back to legacy text-based review parsing"); + MessageParser::parse_review_response(response_content) + } + } + } + + async fn handle_review_result( + ctx: &ExecutorContext, + task: &mut Task, + review_result: ReviewResult, + session_id_str: String, + iteration: u32, + ) -> Result { + match review_result { + ReviewResult::Approved => { + info!(task_id = %task.id, "AI review APPROVED, proceeding to human review"); + ctx.transition(task, TaskStatus::Review)?; + Ok(PhaseResult::ReviewPassed { + session_id: session_id_str, + }) + } + ReviewResult::FindingsDetected(count) => { + info!( + task_id = %task.id, + finding_count = count, + "AI review found issues, waiting for user action" + ); + Ok(PhaseResult::ReviewFailed { + session_id: session_id_str, + feedback: format!( + "{} issues found. Review findings and choose to fix or skip.", + count + ), + iteration, + }) + } + ReviewResult::ChangesRequested(feedback) => { + warn!( + task_id = %task.id, + iteration = iteration, + feedback_preview = %feedback.chars().take(200).collect::(), + "AI review REJECTED (legacy format), changes requested" + ); + ctx.transition(task, TaskStatus::InProgress)?; + Ok(PhaseResult::ReviewFailed { + session_id: session_id_str, + feedback, + iteration, + }) + } + } + } + + async fn get_workspace_diff(ctx: &ExecutorContext, task: &Task) -> Result { + if let Some(ref wm) = ctx.workspace_manager { + if let Some(ref workspace_path) = task.workspace_path { + let workspace = Workspace::new( + task.id.to_string(), + PathBuf::from(workspace_path), + format!("task-{}", task.id), + ); + return wm + .get_diff(&workspace) + .await + .map_err(|e| OrchestratorError::ExecutionFailed(format!("VCS error: {}", e))); + } + } + Ok("(no workspace configured - diff unavailable)".to_string()) + } + + pub async fn start_async(ctx: &ExecutorContext, task: &Task) -> Result { + info!(task_id = %task.id, "Starting review with SessionRunner"); + + let working_dir = ctx.working_dir_for_task(task); + + let mcp_config = if task.status == TaskStatus::AiReview { + let temp_session_id = Uuid::new_v4(); + match ctx + .mcp_manager + .setup_findings_server(task.id, temp_session_id, &working_dir) + .await + { + Ok(_) => { + info!(task_id = %task.id, "MCP findings server added for review"); + Some(McpConfig { + workspace_path: working_dir.clone(), + setup_success: true, + }) + } + Err(e) => { + warn!(error = %e, "Failed to add MCP server, falling back to JSON parsing"); + None + } + } + } else { + None + }; + + let diff = Self::get_workspace_diff(ctx, task) + .await + .unwrap_or_default(); + let prompt = if mcp_config.is_some() { + PhasePrompts::review_with_mcp(task, &diff) + } else { + PhasePrompts::review(task, &diff) + }; + + let config = SessionConfig { + task_id: task.id, + task_status: task.status, + phase: SessionPhase::Review, + prompt, + working_dir, + provider_id: ctx.opencode_client.provider_id().to_string(), + model_id: ctx.opencode_client.model_id().to_string(), + mcp_config, + implementation_phase: None, + skip_task_status_update: false, + }; + + let deps = SessionDependencies::new( + Arc::clone(&ctx.opencode_config), + ctx.session_repo.clone(), + ctx.task_repo.clone(), + ctx.event_bus.clone(), + ctx.activity_registry.clone(), + ctx.file_manager.clone(), + ); + + let result = SessionRunner::start(config, deps).await?; + + Ok(StartedExecution { + session_id: result.session_id, + opencode_session_id: result.opencode_session_id, + phase: SessionPhase::Review, + }) + } +} diff --git a/crates/orchestrator/src/session_runner.rs b/crates/orchestrator/src/session_runner.rs index 3e611e1..7fed58e 100644 --- a/crates/orchestrator/src/session_runner.rs +++ b/crates/orchestrator/src/session_runner.rs @@ -115,16 +115,11 @@ impl SessionRunner { /// /// The session runs entirely in the background - we never block. /// Progress is streamed via SSE and stored in the activity registry. - pub async fn start( - config: SessionConfig, - deps: SessionDependencies, - ) -> Result { + pub async fn start(config: SessionConfig, deps: SessionDependencies) -> Result { // 1. Create OpenCode session - let opencode_session = Self::create_opencode_session( - &deps.opencode_config, - config.working_dir.to_str(), - ) - .await?; + let opencode_session = + Self::create_opencode_session(&deps.opencode_config, config.working_dir.to_str()) + .await?; let opencode_session_id = opencode_session.id.to_string(); // 2. Create our Session record @@ -325,7 +320,15 @@ impl SessionRunner { } // Handle completion (update DB, save artifacts, emit events) - Self::handle_completion(&config, &deps, session_id, &opencode_session_id, success, &response_text).await; + Self::handle_completion( + &config, + &deps, + session_id, + &opencode_session_id, + success, + &response_text, + ) + .await; info!( task_id = %config.task_id, @@ -371,7 +374,11 @@ impl SessionRunner { // Save artifacts based on phase if success { if config.phase == SessionPhase::Planning && !response_text.is_empty() { - if let Err(e) = deps.file_manager.write_plan(config.task_id, response_text).await { + if let Err(e) = deps + .file_manager + .write_plan(config.task_id, response_text) + .await + { error!(error = %e, "Failed to save plan"); } else { info!(task_id = %config.task_id, "Plan saved successfully"); @@ -462,7 +469,9 @@ impl SessionRunner { default_api::session_create(config, directory, Some(request)) .await - .map_err(|e| OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e))) + .map_err(|e| { + OrchestratorError::OpenCodeError(format!("Failed to create session: {}", e)) + }) } /// Extract response text from session messages diff --git a/crates/orchestrator/src/state_machine.rs b/crates/orchestrator/src/state_machine.rs index 01a71d2..7f7fee2 100644 --- a/crates/orchestrator/src/state_machine.rs +++ b/crates/orchestrator/src/state_machine.rs @@ -37,7 +37,9 @@ impl TaskStateMachine { TaskStatus::PlanningReview => vec![TaskStatus::InProgress, TaskStatus::Planning], TaskStatus::InProgress => vec![TaskStatus::AiReview, TaskStatus::PlanningReview], // AiReview can go to: Fix (fix findings), Review (skip/approved), InProgress (back to impl) - TaskStatus::AiReview => vec![TaskStatus::Fix, TaskStatus::Review, TaskStatus::InProgress], + TaskStatus::AiReview => { + vec![TaskStatus::Fix, TaskStatus::Review, TaskStatus::InProgress] + } // Fix goes back to AiReview for re-review after fixing TaskStatus::Fix => vec![TaskStatus::AiReview], TaskStatus::Review => vec![TaskStatus::Done, TaskStatus::InProgress], diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index b439eab..fdf92cf 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -24,16 +24,15 @@ async fn main() -> anyhow::Result<()> { state.open_project(&project_path).await?; } else if let Ok(database_url) = std::env::var("DATABASE_URL") { if database_url.starts_with("sqlite:") { - let db_path = database_url.strip_prefix("sqlite:").unwrap_or(&database_url); + let db_path = database_url + .strip_prefix("sqlite:") + .unwrap_or(&database_url); let db_path = PathBuf::from(db_path); if let Some(studio_dir) = db_path.parent() { if let Some(project_path) = studio_dir.parent() { if project_path.join(".git").exists() || project_path.join(".jj").exists() { - tracing::info!( - "Opening project from DATABASE_URL: {:?}", - project_path - ); + tracing::info!("Opening project from DATABASE_URL: {:?}", project_path); state.open_project(project_path).await?; } } diff --git a/crates/server/src/project_manager.rs b/crates/server/src/project_manager.rs index e3ff1e6..f4890bd 100644 --- a/crates/server/src/project_manager.rs +++ b/crates/server/src/project_manager.rs @@ -13,7 +13,7 @@ use std::sync::Arc; use tokio::sync::RwLock; use vcs::{GitVcs, JujutsuVcs, VersionControl, WorkspaceConfig, WorkspaceManager}; -use sha2::{Sha256, Digest}; +use sha2::{Digest, Sha256}; const STUDIO_DIR: &str = ".opencode-studio"; const GLOBAL_STUDIO_DIR: &str = ".opencode-studio"; @@ -79,8 +79,7 @@ pub async fn migrate_db_if_needed(project_path: &Path) -> Result<(), ProjectErro ); } - Ok(() - ) + Ok(()) } /// Errors that can occur during project operations. @@ -272,13 +271,12 @@ impl ProjectContext { let task_repository = TaskRepository::new(pool.clone()); let activity_repository = SessionActivityRepository::new(pool.clone()); - let activity_registry = SessionActivityRegistry::new() - .with_repository(activity_repository); + let activity_registry = SessionActivityRegistry::new().with_repository(activity_repository); let mut opencode_config = OpenCodeConfig::new(); opencode_config.base_path = opencode_url.to_string(); let opencode_config = Arc::new(opencode_config); - + let executor_config = ExecutorConfig::new(&path) .with_plan_approval(config.require_plan_approval) .with_human_review(config.require_human_review) @@ -374,22 +372,24 @@ impl ProjectManager { self.close().await?; - let ctx = - ProjectContext::new(path.to_path_buf(), &self.opencode_url, self.event_bus.clone()) - .await?; + let ctx = ProjectContext::new( + path.to_path_buf(), + &self.opencode_url, + self.event_bus.clone(), + ) + .await?; let project_info = ctx.info().await; let mut guard = self.context.write().await; *guard = Some(ctx); - self.event_bus.publish(events::EventEnvelope::new( - events::Event::ProjectOpened { + self.event_bus + .publish(events::EventEnvelope::new(events::Event::ProjectOpened { path: project_info.path.clone(), name: project_info.name.clone(), was_initialized, - }, - )); + })); Ok(OpenProjectResult { project: project_info, @@ -447,9 +447,10 @@ impl ProjectManager { if let Some(ctx) = guard.take() { let path = ctx.path.display().to_string(); ctx.pool.close().await; - self.event_bus.publish(events::EventEnvelope::new( - events::Event::ProjectClosed { path }, - )); + self.event_bus + .publish(events::EventEnvelope::new(events::Event::ProjectClosed { + path, + })); } Ok(()) } @@ -795,7 +796,9 @@ mod tests { let manager = GlobalConfigManager::with_config_dir(tmp.path().to_path_buf()); for i in 0..15 { - manager.add_recent(Path::new(&format!("/project/{}", i))).unwrap(); + manager + .add_recent(Path::new(&format!("/project/{}", i))) + .unwrap(); } let recent = manager.get_recent(); diff --git a/crates/server/src/routes/filesystem.rs b/crates/server/src/routes/filesystem.rs index b766280..6e340f9 100644 --- a/crates/server/src/routes/filesystem.rs +++ b/crates/server/src/routes/filesystem.rs @@ -91,7 +91,11 @@ fn browse_path(path: &PathBuf) -> BrowseResponse { path: path.display().to_string(), is_dir, is_vcs_root, - vcs: if is_vcs_root { Some(vcs.to_string()) } else { None }, + vcs: if is_vcs_root { + Some(vcs.to_string()) + } else { + None + }, }) }) .collect() diff --git a/crates/server/src/routes/projects.rs b/crates/server/src/routes/projects.rs index cbe03e7..f996696 100644 --- a/crates/server/src/routes/projects.rs +++ b/crates/server/src/routes/projects.rs @@ -240,7 +240,9 @@ pub async fn remove_recent_project( State(state): State, Json(payload): Json, ) -> Result, AppError> { - state.global_config.remove_recent(&PathBuf::from(&payload.path))?; + state + .global_config + .remove_recent(&PathBuf::from(&payload.path))?; Ok(Json(RemoveRecentResponse { success: true })) } @@ -318,10 +320,7 @@ pub async fn validate_project_path( let vcs = detect_vcs(&path); let is_vcs_repo = vcs != "none"; - let name = path - .file_name() - .and_then(|n| n.to_str()) - .map(String::from); + let name = path.file_name().and_then(|n| n.to_str()).map(String::from); Json(ValidatePathResponse { valid: is_vcs_repo, diff --git a/crates/server/src/routes/sessions.rs b/crates/server/src/routes/sessions.rs index 6eb396b..ec38a20 100644 --- a/crates/server/src/routes/sessions.rs +++ b/crates/server/src/routes/sessions.rs @@ -91,5 +91,3 @@ pub async fn delete_session( Err(AppError::NotFound(format!("Session not found: {}", id))) } } - - diff --git a/crates/server/src/routes/sse.rs b/crates/server/src/routes/sse.rs index 3e1ec6b..4ab744c 100644 --- a/crates/server/src/routes/sse.rs +++ b/crates/server/src/routes/sse.rs @@ -160,11 +160,8 @@ pub async fn events_stream( vec![] }; - let missed_stream = futures::stream::iter( - missed_events - .into_iter() - .map(|e| envelope_to_sse_event(&e)), - ); + let missed_stream = + futures::stream::iter(missed_events.into_iter().map(|e| envelope_to_sse_event(&e))); let live_stream = BroadcastStream::new(rx).filter_map(move |result| { let task_ids = task_ids.clone(); @@ -234,7 +231,10 @@ pub async fn session_activity_stream( } // Use async version that loads historical activities from DB - let store = project.activity_registry.get_or_create_with_history(id).await; + let store = project + .activity_registry + .get_or_create_with_history(id) + .await; let last_event_id: Option = headers .get("Last-Event-ID") diff --git a/crates/server/src/routes/tasks.rs b/crates/server/src/routes/tasks.rs index 3d7503f..15b7e4e 100644 --- a/crates/server/src/routes/tasks.rs +++ b/crates/server/src/routes/tasks.rs @@ -495,7 +495,9 @@ pub async fn fix_findings( })?; let Some(findings_data) = findings_data else { - return Err(AppError::NotFound("No findings found for this task".to_string())); + return Err(AppError::NotFound( + "No findings found for this task".to_string(), + )); }; // Determine which findings to fix @@ -518,7 +520,9 @@ pub async fn fix_findings( }; if findings_to_fix.is_empty() { - return Err(AppError::BadRequest("No pending findings to fix".to_string())); + return Err(AppError::BadRequest( + "No pending findings to fix".to_string(), + )); } info!( @@ -737,10 +741,15 @@ pub async fn get_task_phases( let parsed_plan = parse_plan_phases(&plan_content); // Read phase context if it exists - let phase_context: Option = file_manager.read_phase_context(id).await.ok().flatten(); + let phase_context: Option = + file_manager.read_phase_context(id).await.ok().flatten(); // Get sessions for this task to determine which phases have sessions - let sessions = project.session_repository.find_by_task_id(id).await.unwrap_or_default(); + let sessions = project + .session_repository + .find_by_task_id(id) + .await + .unwrap_or_default(); // Build session lookup by phase number let session_by_phase: std::collections::HashMap = sessions @@ -760,7 +769,9 @@ pub async fn get_task_phases( None } else { // Single-phase plan - check if there's a running session - let running_session = sessions.iter().find(|s| s.status == opencode_core::SessionStatus::Running); + let running_session = sessions + .iter() + .find(|s| s.status == opencode_core::SessionStatus::Running); if running_session.is_some() { Some(1) } else { @@ -781,7 +792,10 @@ pub async fn get_task_phases( PhaseStatus::Completed } else if phase.number == ctx.phase_number { // Check if there's a running session - if session.map(|s| s.status == opencode_core::SessionStatus::Running).unwrap_or(false) { + if session + .map(|s| s.status == opencode_core::SessionStatus::Running) + .unwrap_or(false) + { PhaseStatus::Running } else { PhaseStatus::Pending @@ -792,21 +806,23 @@ pub async fn get_task_phases( } else { // No phase context - check session status match session { - Some(s) if s.status == opencode_core::SessionStatus::Running => PhaseStatus::Running, - Some(s) if s.status == opencode_core::SessionStatus::Completed => PhaseStatus::Completed, + Some(s) if s.status == opencode_core::SessionStatus::Running => { + PhaseStatus::Running + } + Some(s) if s.status == opencode_core::SessionStatus::Completed => { + PhaseStatus::Completed + } _ => PhaseStatus::Pending, } }; // Get summary for completed phases - let summary = phase_context - .as_ref() - .and_then(|ctx| { - ctx.completed_phases - .iter() - .find(|s| s.phase_number == phase.number) - .cloned() - }); + let summary = phase_context.as_ref().and_then(|ctx| { + ctx.completed_phases + .iter() + .find(|s| s.phase_number == phase.number) + .cloned() + }); PhaseInfo { number: phase.number, diff --git a/crates/server/src/state.rs b/crates/server/src/state.rs index 34ed0ec..eb129c3 100644 --- a/crates/server/src/state.rs +++ b/crates/server/src/state.rs @@ -22,7 +22,10 @@ impl AppState { let event_bus = EventBus::new(); let event_buffer = Arc::new(RwLock::new(EventBuffer::new(DEFAULT_EVENT_BUFFER_SIZE))); let global_config = GlobalConfigManager::new(); - let project_manager = Arc::new(ProjectManager::new(opencode_url.to_string(), event_bus.clone())); + let project_manager = Arc::new(ProjectManager::new( + opencode_url.to_string(), + event_bus.clone(), + )); Self { project_manager, @@ -81,9 +84,10 @@ impl AppState { #[allow(dead_code)] pub async fn github_client(&self) -> Result<&GitHubClient, github::GitHubError> { - let project = self.project().await.map_err(|e| { - github::GitHubError::Config(format!("No project open: {}", e)) - })?; + let project = self + .project() + .await + .map_err(|e| github::GitHubError::Config(format!("No project open: {}", e)))?; self.github_client .get_or_try_init(|| async { diff --git a/crates/vcs/src/lib.rs b/crates/vcs/src/lib.rs index 190999e..c285617 100644 --- a/crates/vcs/src/lib.rs +++ b/crates/vcs/src/lib.rs @@ -7,5 +7,7 @@ pub mod workspace; pub use error::{Result, VcsError}; pub use git::GitVcs; pub use jj::JujutsuVcs; -pub use traits::{ConflictFile, ConflictType, MergeResult, VersionControl, Workspace, WorkspaceStatus}; +pub use traits::{ + ConflictFile, ConflictType, MergeResult, VersionControl, Workspace, WorkspaceStatus, +}; pub use workspace::{WorkspaceConfig, WorkspaceManager}; From 59c3e5f03d2318914a5044249d02475c3eb729f3 Mon Sep 17 00:00:00 2001 From: Pavel Soukup Date: Sat, 3 Jan 2026 13:03:59 +0100 Subject: [PATCH 2/2] Fix CodeRabbit review comments - Remove empty doc comments from opencode-client models (115 files) - Use then_some() for idiomatic vcs field assignment in filesystem.rs - Extract MCP binary name as constant in mcp_manager.rs - Add parse_timestamp helper with warning logging in opencode_events.rs - Log MCP cleanup failures in fix_phase.rs and review_phase.rs - Log diff retrieval errors in review_phase.rs --- crates/opencode-client/src/models/agent.rs | 1 - .../src/models/agent_config.rs | 1 - .../src/models/agent_config_permission.rs | 4 --- .../opencode-client/src/models/agent_part.rs | 1 - .../src/models/agent_part_input.rs | 1 - .../src/models/agent_permission.rs | 6 ---- crates/opencode-client/src/models/api_auth.rs | 1 - .../opencode-client/src/models/api_error.rs | 1 - .../src/models/assistant_message.rs | 1 - .../src/models/assistant_message_error.rs | 1 - crates/opencode-client/src/models/auth.rs | 1 - .../src/models/bad_request_error.rs | 1 - .../src/models/compaction_part.rs | 1 - .../models/config_lsp_any_of_value_any_of.rs | 1 - crates/opencode-client/src/models/event.rs | 1 - .../src/models/event_command_executed.rs | 1 - .../src/models/event_file_edited.rs | 1 - .../src/models/event_file_watcher_updated.rs | 1 - .../event_file_watcher_updated_properties.rs | 1 - .../src/models/event_global_disposed.rs | 1 - .../event_installation_update_available.rs | 1 - .../src/models/event_installation_updated.rs | 1 - .../models/event_lsp_client_diagnostics.rs | 1 - .../src/models/event_lsp_updated.rs | 1 - .../src/models/event_mcp_tools_changed.rs | 1 - .../src/models/event_message_part_removed.rs | 1 - .../src/models/event_message_part_updated.rs | 1 - .../src/models/event_message_removed.rs | 1 - .../src/models/event_message_updated.rs | 1 - .../src/models/event_permission_replied.rs | 1 - .../src/models/event_permission_updated.rs | 1 - .../src/models/event_project_updated.rs | 1 - .../src/models/event_pty_created.rs | 1 - .../src/models/event_pty_deleted.rs | 1 - .../src/models/event_pty_exited.rs | 1 - .../src/models/event_pty_updated.rs | 1 - .../src/models/event_server_connected.rs | 1 - .../models/event_server_instance_disposed.rs | 1 - .../src/models/event_session_compacted.rs | 1 - .../src/models/event_session_created.rs | 1 - .../src/models/event_session_deleted.rs | 1 - .../src/models/event_session_diff.rs | 1 - .../src/models/event_session_error.rs | 1 - .../src/models/event_session_idle.rs | 1 - .../src/models/event_session_status.rs | 1 - .../src/models/event_session_updated.rs | 1 - .../src/models/event_todo_updated.rs | 1 - .../src/models/event_tui_command_execute.rs | 1 - .../src/models/event_tui_prompt_append.rs | 1 - .../src/models/event_tui_toast_show.rs | 1 - .../src/models/event_vcs_branch_updated.rs | 1 - crates/opencode-client/src/models/file.rs | 1 - .../src/models/file_content.rs | 2 -- .../opencode-client/src/models/file_node.rs | 1 - .../opencode-client/src/models/file_part.rs | 1 - .../src/models/file_part_input.rs | 1 - .../src/models/file_part_source.rs | 1 - .../opencode-client/src/models/file_source.rs | 1 - .../src/models/global_health_200_response.rs | 1 - .../opencode-client/src/models/lsp_status.rs | 1 - .../models/mcp_auth_remove_200_response.rs | 1 - .../src/models/mcp_status_connected.rs | 1 - .../src/models/mcp_status_disabled.rs | 1 - .../src/models/mcp_status_failed.rs | 1 - .../src/models/mcp_status_needs_auth.rs | 1 - .../mcp_status_needs_client_registration.rs | 1 - crates/opencode-client/src/models/message.rs | 1 - .../src/models/message_aborted_error.rs | 1 - .../src/models/message_output_length_error.rs | 1 - crates/opencode-client/src/models/model.rs | 1 - .../models/model_capabilities_interleaved.rs | 1 - .../model_capabilities_interleaved_any_of.rs | 1 - .../src/models/not_found_error.rs | 1 - crates/opencode-client/src/models/o_auth.rs | 1 - crates/opencode-client/src/models/part.rs | 1 - .../opencode-client/src/models/part_any_of.rs | 1 - .../opencode-client/src/models/patch_part.rs | 1 - .../src/models/permission_respond_request.rs | 1 - crates/opencode-client/src/models/project.rs | 1 - crates/opencode-client/src/models/provider.rs | 1 - .../src/models/provider_auth_authorization.rs | 1 - .../src/models/provider_auth_error.rs | 1 - .../src/models/provider_auth_method.rs | 1 - .../models/provider_config_models_value.rs | 1 - ...rovider_config_models_value_interleaved.rs | 1 - ..._config_models_value_interleaved_any_of.rs | 1 - ...ist_200_response_all_inner_models_value.rs | 1 - ...onse_all_inner_models_value_interleaved.rs | 1 - ...l_inner_models_value_interleaved_any_of.rs | 1 - ...ponse_all_inner_models_value_modalities.rs | 2 -- crates/opencode-client/src/models/pty.rs | 1 - .../src/models/reasoning_part.rs | 1 - .../opencode-client/src/models/retry_part.rs | 1 - .../session_prompt_request_parts_inner.rs | 1 - .../src/models/session_status.rs | 1 - .../src/models/session_status_any_of.rs | 1 - .../src/models/session_status_any_of_1.rs | 1 - .../src/models/session_status_any_of_2.rs | 1 - .../src/models/snapshot_part.rs | 1 - .../src/models/step_finish_part.rs | 1 - .../src/models/step_start_part.rs | 1 - .../src/models/subtask_part_input.rs | 1 - .../src/models/symbol_source.rs | 1 - .../opencode-client/src/models/text_part.rs | 1 - .../src/models/text_part_input.rs | 1 - .../opencode-client/src/models/tool_part.rs | 1 - .../opencode-client/src/models/tool_state.rs | 1 - .../src/models/tool_state_completed.rs | 1 - .../src/models/tool_state_error.rs | 1 - .../src/models/tool_state_pending.rs | 1 - .../src/models/tool_state_running.rs | 1 - .../src/models/tui_publish_request.rs | 1 - .../src/models/tui_show_toast_request.rs | 1 - .../src/models/unknown_error.rs | 1 - .../src/models/user_message.rs | 1 - .../src/models/well_known_auth.rs | 1 - crates/orchestrator/src/opencode_events.rs | 34 +++++++++---------- crates/orchestrator/src/services/fix_phase.rs | 7 ++-- .../orchestrator/src/services/mcp_manager.rs | 13 ++++--- .../orchestrator/src/services/review_phase.rs | 14 +++++--- crates/server/src/routes/filesystem.rs | 12 ++----- 121 files changed, 40 insertions(+), 166 deletions(-) diff --git a/crates/opencode-client/src/models/agent.rs b/crates/opencode-client/src/models/agent.rs index 5feb11a..b0e9f96 100644 --- a/crates/opencode-client/src/models/agent.rs +++ b/crates/opencode-client/src/models/agent.rs @@ -72,7 +72,6 @@ impl Agent { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Mode { #[serde(rename = "subagent")] diff --git a/crates/opencode-client/src/models/agent_config.rs b/crates/opencode-client/src/models/agent_config.rs index 1613c4e..2e847e8 100644 --- a/crates/opencode-client/src/models/agent_config.rs +++ b/crates/opencode-client/src/models/agent_config.rs @@ -57,7 +57,6 @@ impl AgentConfig { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Mode { #[serde(rename = "subagent")] diff --git a/crates/opencode-client/src/models/agent_config_permission.rs b/crates/opencode-client/src/models/agent_config_permission.rs index 846bdb4..f4c22d1 100644 --- a/crates/opencode-client/src/models/agent_config_permission.rs +++ b/crates/opencode-client/src/models/agent_config_permission.rs @@ -39,7 +39,6 @@ impl AgentConfigPermission { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Edit { #[serde(rename = "ask")] @@ -55,7 +54,6 @@ impl Default for Edit { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Webfetch { #[serde(rename = "ask")] @@ -71,7 +69,6 @@ impl Default for Webfetch { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DoomLoop { #[serde(rename = "ask")] @@ -87,7 +84,6 @@ impl Default for DoomLoop { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum ExternalDirectory { #[serde(rename = "ask")] diff --git a/crates/opencode-client/src/models/agent_part.rs b/crates/opencode-client/src/models/agent_part.rs index c023e35..adc47a8 100644 --- a/crates/opencode-client/src/models/agent_part.rs +++ b/crates/opencode-client/src/models/agent_part.rs @@ -45,7 +45,6 @@ impl AgentPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "agent")] diff --git a/crates/opencode-client/src/models/agent_part_input.rs b/crates/opencode-client/src/models/agent_part_input.rs index 06cf3a2..69b7cf2 100644 --- a/crates/opencode-client/src/models/agent_part_input.rs +++ b/crates/opencode-client/src/models/agent_part_input.rs @@ -33,7 +33,6 @@ impl AgentPartInput { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "agent")] diff --git a/crates/opencode-client/src/models/agent_permission.rs b/crates/opencode-client/src/models/agent_permission.rs index 8d6d550..f43b0b2 100644 --- a/crates/opencode-client/src/models/agent_permission.rs +++ b/crates/opencode-client/src/models/agent_permission.rs @@ -39,7 +39,6 @@ impl AgentPermission { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Edit { #[serde(rename = "ask")] @@ -55,7 +54,6 @@ impl Default for Edit { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Bash { #[serde(rename = "ask")] @@ -71,7 +69,6 @@ impl Default for Bash { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Skill { #[serde(rename = "ask")] @@ -87,7 +84,6 @@ impl Default for Skill { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Webfetch { #[serde(rename = "ask")] @@ -103,7 +99,6 @@ impl Default for Webfetch { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DoomLoop { #[serde(rename = "ask")] @@ -119,7 +114,6 @@ impl Default for DoomLoop { Self::Ask } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum ExternalDirectory { #[serde(rename = "ask")] diff --git a/crates/opencode-client/src/models/api_auth.rs b/crates/opencode-client/src/models/api_auth.rs index 038cd4b..0231c19 100644 --- a/crates/opencode-client/src/models/api_auth.rs +++ b/crates/opencode-client/src/models/api_auth.rs @@ -24,7 +24,6 @@ impl ApiAuth { ApiAuth { r#type, key } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "api")] diff --git a/crates/opencode-client/src/models/api_error.rs b/crates/opencode-client/src/models/api_error.rs index 2c66717..c9f529f 100644 --- a/crates/opencode-client/src/models/api_error.rs +++ b/crates/opencode-client/src/models/api_error.rs @@ -27,7 +27,6 @@ impl ApiError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "APIError")] diff --git a/crates/opencode-client/src/models/assistant_message.rs b/crates/opencode-client/src/models/assistant_message.rs index dfee8e9..89d49b3 100644 --- a/crates/opencode-client/src/models/assistant_message.rs +++ b/crates/opencode-client/src/models/assistant_message.rs @@ -79,7 +79,6 @@ impl AssistantMessage { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Role { #[serde(rename = "assistant")] diff --git a/crates/opencode-client/src/models/assistant_message_error.rs b/crates/opencode-client/src/models/assistant_message_error.rs index 7096aea..55a6b63 100644 --- a/crates/opencode-client/src/models/assistant_message_error.rs +++ b/crates/opencode-client/src/models/assistant_message_error.rs @@ -27,7 +27,6 @@ impl AssistantMessageError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "APIError")] diff --git a/crates/opencode-client/src/models/auth.rs b/crates/opencode-client/src/models/auth.rs index 8c7bee0..033a022 100644 --- a/crates/opencode-client/src/models/auth.rs +++ b/crates/opencode-client/src/models/auth.rs @@ -49,7 +49,6 @@ impl Auth { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] diff --git a/crates/opencode-client/src/models/bad_request_error.rs b/crates/opencode-client/src/models/bad_request_error.rs index 963cce0..c1173c8 100644 --- a/crates/opencode-client/src/models/bad_request_error.rs +++ b/crates/opencode-client/src/models/bad_request_error.rs @@ -34,7 +34,6 @@ impl BadRequestError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Success { #[serde(rename = "false")] diff --git a/crates/opencode-client/src/models/compaction_part.rs b/crates/opencode-client/src/models/compaction_part.rs index bd399b2..7ed86e4 100644 --- a/crates/opencode-client/src/models/compaction_part.rs +++ b/crates/opencode-client/src/models/compaction_part.rs @@ -42,7 +42,6 @@ impl CompactionPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "compaction")] diff --git a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs index 0a64ba4..7bafb40 100644 --- a/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs +++ b/crates/opencode-client/src/models/config_lsp_any_of_value_any_of.rs @@ -22,7 +22,6 @@ impl ConfigLspAnyOfValueAnyOf { ConfigLspAnyOfValueAnyOf { disabled } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Disabled { #[serde(rename = "true")] diff --git a/crates/opencode-client/src/models/event.rs b/crates/opencode-client/src/models/event.rs index f58fbed..e6abf5b 100644 --- a/crates/opencode-client/src/models/event.rs +++ b/crates/opencode-client/src/models/event.rs @@ -24,7 +24,6 @@ impl Event { Event { r#type, properties } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] diff --git a/crates/opencode-client/src/models/event_command_executed.rs b/crates/opencode-client/src/models/event_command_executed.rs index 9dbf084..a8bec56 100644 --- a/crates/opencode-client/src/models/event_command_executed.rs +++ b/crates/opencode-client/src/models/event_command_executed.rs @@ -30,7 +30,6 @@ impl EventCommandExecuted { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "command.executed")] diff --git a/crates/opencode-client/src/models/event_file_edited.rs b/crates/opencode-client/src/models/event_file_edited.rs index 591c1d8..e97c101 100644 --- a/crates/opencode-client/src/models/event_file_edited.rs +++ b/crates/opencode-client/src/models/event_file_edited.rs @@ -27,7 +27,6 @@ impl EventFileEdited { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file.edited")] diff --git a/crates/opencode-client/src/models/event_file_watcher_updated.rs b/crates/opencode-client/src/models/event_file_watcher_updated.rs index 76d1de8..7e50c34 100644 --- a/crates/opencode-client/src/models/event_file_watcher_updated.rs +++ b/crates/opencode-client/src/models/event_file_watcher_updated.rs @@ -30,7 +30,6 @@ impl EventFileWatcherUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file.watcher.updated")] diff --git a/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs b/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs index 0a264f7..acddea0 100644 --- a/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs +++ b/crates/opencode-client/src/models/event_file_watcher_updated_properties.rs @@ -24,7 +24,6 @@ impl EventFileWatcherUpdatedProperties { EventFileWatcherUpdatedProperties { file, event } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Event { #[serde(rename = "add")] diff --git a/crates/opencode-client/src/models/event_global_disposed.rs b/crates/opencode-client/src/models/event_global_disposed.rs index 4bdcd51..31f5ec5 100644 --- a/crates/opencode-client/src/models/event_global_disposed.rs +++ b/crates/opencode-client/src/models/event_global_disposed.rs @@ -24,7 +24,6 @@ impl EventGlobalDisposed { EventGlobalDisposed { r#type, properties } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "global.disposed")] diff --git a/crates/opencode-client/src/models/event_installation_update_available.rs b/crates/opencode-client/src/models/event_installation_update_available.rs index 0fb21ae..9a02f25 100644 --- a/crates/opencode-client/src/models/event_installation_update_available.rs +++ b/crates/opencode-client/src/models/event_installation_update_available.rs @@ -30,7 +30,6 @@ impl EventInstallationUpdateAvailable { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "installation.update-available")] diff --git a/crates/opencode-client/src/models/event_installation_updated.rs b/crates/opencode-client/src/models/event_installation_updated.rs index 3603b58..48495da 100644 --- a/crates/opencode-client/src/models/event_installation_updated.rs +++ b/crates/opencode-client/src/models/event_installation_updated.rs @@ -30,7 +30,6 @@ impl EventInstallationUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "installation.updated")] diff --git a/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs b/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs index 2cb6eb6..bc3cbd0 100644 --- a/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs +++ b/crates/opencode-client/src/models/event_lsp_client_diagnostics.rs @@ -30,7 +30,6 @@ impl EventLspClientDiagnostics { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "lsp.client.diagnostics")] diff --git a/crates/opencode-client/src/models/event_lsp_updated.rs b/crates/opencode-client/src/models/event_lsp_updated.rs index 42f569c..50a7b4d 100644 --- a/crates/opencode-client/src/models/event_lsp_updated.rs +++ b/crates/opencode-client/src/models/event_lsp_updated.rs @@ -24,7 +24,6 @@ impl EventLspUpdated { EventLspUpdated { r#type, properties } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "lsp.updated")] diff --git a/crates/opencode-client/src/models/event_mcp_tools_changed.rs b/crates/opencode-client/src/models/event_mcp_tools_changed.rs index 91ac361..f38e665 100644 --- a/crates/opencode-client/src/models/event_mcp_tools_changed.rs +++ b/crates/opencode-client/src/models/event_mcp_tools_changed.rs @@ -30,7 +30,6 @@ impl EventMcpToolsChanged { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "mcp.tools.changed")] diff --git a/crates/opencode-client/src/models/event_message_part_removed.rs b/crates/opencode-client/src/models/event_message_part_removed.rs index 7b783e7..7740ceb 100644 --- a/crates/opencode-client/src/models/event_message_part_removed.rs +++ b/crates/opencode-client/src/models/event_message_part_removed.rs @@ -30,7 +30,6 @@ impl EventMessagePartRemoved { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.part.removed")] diff --git a/crates/opencode-client/src/models/event_message_part_updated.rs b/crates/opencode-client/src/models/event_message_part_updated.rs index 59ad886..730d021 100644 --- a/crates/opencode-client/src/models/event_message_part_updated.rs +++ b/crates/opencode-client/src/models/event_message_part_updated.rs @@ -30,7 +30,6 @@ impl EventMessagePartUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.part.updated")] diff --git a/crates/opencode-client/src/models/event_message_removed.rs b/crates/opencode-client/src/models/event_message_removed.rs index e724039..38fa1b6 100644 --- a/crates/opencode-client/src/models/event_message_removed.rs +++ b/crates/opencode-client/src/models/event_message_removed.rs @@ -30,7 +30,6 @@ impl EventMessageRemoved { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.removed")] diff --git a/crates/opencode-client/src/models/event_message_updated.rs b/crates/opencode-client/src/models/event_message_updated.rs index a83e080..9e07ed7 100644 --- a/crates/opencode-client/src/models/event_message_updated.rs +++ b/crates/opencode-client/src/models/event_message_updated.rs @@ -30,7 +30,6 @@ impl EventMessageUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "message.updated")] diff --git a/crates/opencode-client/src/models/event_permission_replied.rs b/crates/opencode-client/src/models/event_permission_replied.rs index d3f8cd0..2c2ee14 100644 --- a/crates/opencode-client/src/models/event_permission_replied.rs +++ b/crates/opencode-client/src/models/event_permission_replied.rs @@ -30,7 +30,6 @@ impl EventPermissionReplied { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "permission.replied")] diff --git a/crates/opencode-client/src/models/event_permission_updated.rs b/crates/opencode-client/src/models/event_permission_updated.rs index f03f503..61e15c7 100644 --- a/crates/opencode-client/src/models/event_permission_updated.rs +++ b/crates/opencode-client/src/models/event_permission_updated.rs @@ -27,7 +27,6 @@ impl EventPermissionUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "permission.updated")] diff --git a/crates/opencode-client/src/models/event_project_updated.rs b/crates/opencode-client/src/models/event_project_updated.rs index 0770bac..c52a5da 100644 --- a/crates/opencode-client/src/models/event_project_updated.rs +++ b/crates/opencode-client/src/models/event_project_updated.rs @@ -27,7 +27,6 @@ impl EventProjectUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "project.updated")] diff --git a/crates/opencode-client/src/models/event_pty_created.rs b/crates/opencode-client/src/models/event_pty_created.rs index 7ab356e..1795d75 100644 --- a/crates/opencode-client/src/models/event_pty_created.rs +++ b/crates/opencode-client/src/models/event_pty_created.rs @@ -27,7 +27,6 @@ impl EventPtyCreated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.created")] diff --git a/crates/opencode-client/src/models/event_pty_deleted.rs b/crates/opencode-client/src/models/event_pty_deleted.rs index 5c4a731..ac204fc 100644 --- a/crates/opencode-client/src/models/event_pty_deleted.rs +++ b/crates/opencode-client/src/models/event_pty_deleted.rs @@ -27,7 +27,6 @@ impl EventPtyDeleted { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.deleted")] diff --git a/crates/opencode-client/src/models/event_pty_exited.rs b/crates/opencode-client/src/models/event_pty_exited.rs index bd5c1a0..1d98043 100644 --- a/crates/opencode-client/src/models/event_pty_exited.rs +++ b/crates/opencode-client/src/models/event_pty_exited.rs @@ -27,7 +27,6 @@ impl EventPtyExited { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.exited")] diff --git a/crates/opencode-client/src/models/event_pty_updated.rs b/crates/opencode-client/src/models/event_pty_updated.rs index 8fd8291..2d4f847 100644 --- a/crates/opencode-client/src/models/event_pty_updated.rs +++ b/crates/opencode-client/src/models/event_pty_updated.rs @@ -27,7 +27,6 @@ impl EventPtyUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "pty.updated")] diff --git a/crates/opencode-client/src/models/event_server_connected.rs b/crates/opencode-client/src/models/event_server_connected.rs index ac28f01..a4cfe20 100644 --- a/crates/opencode-client/src/models/event_server_connected.rs +++ b/crates/opencode-client/src/models/event_server_connected.rs @@ -24,7 +24,6 @@ impl EventServerConnected { EventServerConnected { r#type, properties } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "server.connected")] diff --git a/crates/opencode-client/src/models/event_server_instance_disposed.rs b/crates/opencode-client/src/models/event_server_instance_disposed.rs index 7956a8c..a067e99 100644 --- a/crates/opencode-client/src/models/event_server_instance_disposed.rs +++ b/crates/opencode-client/src/models/event_server_instance_disposed.rs @@ -30,7 +30,6 @@ impl EventServerInstanceDisposed { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "server.instance.disposed")] diff --git a/crates/opencode-client/src/models/event_session_compacted.rs b/crates/opencode-client/src/models/event_session_compacted.rs index b774b4b..bba487e 100644 --- a/crates/opencode-client/src/models/event_session_compacted.rs +++ b/crates/opencode-client/src/models/event_session_compacted.rs @@ -30,7 +30,6 @@ impl EventSessionCompacted { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.compacted")] diff --git a/crates/opencode-client/src/models/event_session_created.rs b/crates/opencode-client/src/models/event_session_created.rs index e2c0ebb..823aea7 100644 --- a/crates/opencode-client/src/models/event_session_created.rs +++ b/crates/opencode-client/src/models/event_session_created.rs @@ -30,7 +30,6 @@ impl EventSessionCreated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.created")] diff --git a/crates/opencode-client/src/models/event_session_deleted.rs b/crates/opencode-client/src/models/event_session_deleted.rs index 8c5322d..be58aa9 100644 --- a/crates/opencode-client/src/models/event_session_deleted.rs +++ b/crates/opencode-client/src/models/event_session_deleted.rs @@ -30,7 +30,6 @@ impl EventSessionDeleted { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.deleted")] diff --git a/crates/opencode-client/src/models/event_session_diff.rs b/crates/opencode-client/src/models/event_session_diff.rs index f77d493..1043f7d 100644 --- a/crates/opencode-client/src/models/event_session_diff.rs +++ b/crates/opencode-client/src/models/event_session_diff.rs @@ -27,7 +27,6 @@ impl EventSessionDiff { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.diff")] diff --git a/crates/opencode-client/src/models/event_session_error.rs b/crates/opencode-client/src/models/event_session_error.rs index 4ed7831..020b6e6 100644 --- a/crates/opencode-client/src/models/event_session_error.rs +++ b/crates/opencode-client/src/models/event_session_error.rs @@ -27,7 +27,6 @@ impl EventSessionError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.error")] diff --git a/crates/opencode-client/src/models/event_session_idle.rs b/crates/opencode-client/src/models/event_session_idle.rs index c5b4120..49e18ab 100644 --- a/crates/opencode-client/src/models/event_session_idle.rs +++ b/crates/opencode-client/src/models/event_session_idle.rs @@ -27,7 +27,6 @@ impl EventSessionIdle { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.idle")] diff --git a/crates/opencode-client/src/models/event_session_status.rs b/crates/opencode-client/src/models/event_session_status.rs index 25ad80b..2537d73 100644 --- a/crates/opencode-client/src/models/event_session_status.rs +++ b/crates/opencode-client/src/models/event_session_status.rs @@ -30,7 +30,6 @@ impl EventSessionStatus { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.status")] diff --git a/crates/opencode-client/src/models/event_session_updated.rs b/crates/opencode-client/src/models/event_session_updated.rs index 43d0bfd..538e56a 100644 --- a/crates/opencode-client/src/models/event_session_updated.rs +++ b/crates/opencode-client/src/models/event_session_updated.rs @@ -30,7 +30,6 @@ impl EventSessionUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "session.updated")] diff --git a/crates/opencode-client/src/models/event_todo_updated.rs b/crates/opencode-client/src/models/event_todo_updated.rs index 2f6c8f9..ff64064 100644 --- a/crates/opencode-client/src/models/event_todo_updated.rs +++ b/crates/opencode-client/src/models/event_todo_updated.rs @@ -27,7 +27,6 @@ impl EventTodoUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "todo.updated")] diff --git a/crates/opencode-client/src/models/event_tui_command_execute.rs b/crates/opencode-client/src/models/event_tui_command_execute.rs index 37951aa..5ea3ea9 100644 --- a/crates/opencode-client/src/models/event_tui_command_execute.rs +++ b/crates/opencode-client/src/models/event_tui_command_execute.rs @@ -30,7 +30,6 @@ impl EventTuiCommandExecute { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.command.execute")] diff --git a/crates/opencode-client/src/models/event_tui_prompt_append.rs b/crates/opencode-client/src/models/event_tui_prompt_append.rs index 6235ff1..a5ea2ea 100644 --- a/crates/opencode-client/src/models/event_tui_prompt_append.rs +++ b/crates/opencode-client/src/models/event_tui_prompt_append.rs @@ -30,7 +30,6 @@ impl EventTuiPromptAppend { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] diff --git a/crates/opencode-client/src/models/event_tui_toast_show.rs b/crates/opencode-client/src/models/event_tui_toast_show.rs index f121d0c..fa0d291 100644 --- a/crates/opencode-client/src/models/event_tui_toast_show.rs +++ b/crates/opencode-client/src/models/event_tui_toast_show.rs @@ -27,7 +27,6 @@ impl EventTuiToastShow { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.toast.show")] diff --git a/crates/opencode-client/src/models/event_vcs_branch_updated.rs b/crates/opencode-client/src/models/event_vcs_branch_updated.rs index 474ca60..6e312dc 100644 --- a/crates/opencode-client/src/models/event_vcs_branch_updated.rs +++ b/crates/opencode-client/src/models/event_vcs_branch_updated.rs @@ -30,7 +30,6 @@ impl EventVcsBranchUpdated { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "vcs.branch.updated")] diff --git a/crates/opencode-client/src/models/file.rs b/crates/opencode-client/src/models/file.rs index 0ef5722..7c27e91 100644 --- a/crates/opencode-client/src/models/file.rs +++ b/crates/opencode-client/src/models/file.rs @@ -33,7 +33,6 @@ impl File { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "added")] diff --git a/crates/opencode-client/src/models/file_content.rs b/crates/opencode-client/src/models/file_content.rs index 180673b..8e2de4a 100644 --- a/crates/opencode-client/src/models/file_content.rs +++ b/crates/opencode-client/src/models/file_content.rs @@ -39,7 +39,6 @@ impl FileContent { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] @@ -51,7 +50,6 @@ impl Default for Type { Self::Text } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Encoding { #[serde(rename = "base64")] diff --git a/crates/opencode-client/src/models/file_node.rs b/crates/opencode-client/src/models/file_node.rs index 6eff903..8ed754e 100644 --- a/crates/opencode-client/src/models/file_node.rs +++ b/crates/opencode-client/src/models/file_node.rs @@ -42,7 +42,6 @@ impl FileNode { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] diff --git a/crates/opencode-client/src/models/file_part.rs b/crates/opencode-client/src/models/file_part.rs index 5ff6f17..5f2334f 100644 --- a/crates/opencode-client/src/models/file_part.rs +++ b/crates/opencode-client/src/models/file_part.rs @@ -52,7 +52,6 @@ impl FilePart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] diff --git a/crates/opencode-client/src/models/file_part_input.rs b/crates/opencode-client/src/models/file_part_input.rs index 0ae3e7a..708038b 100644 --- a/crates/opencode-client/src/models/file_part_input.rs +++ b/crates/opencode-client/src/models/file_part_input.rs @@ -39,7 +39,6 @@ impl FilePartInput { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] diff --git a/crates/opencode-client/src/models/file_part_source.rs b/crates/opencode-client/src/models/file_part_source.rs index df69908..1dbd425 100644 --- a/crates/opencode-client/src/models/file_part_source.rs +++ b/crates/opencode-client/src/models/file_part_source.rs @@ -46,7 +46,6 @@ impl FilePartSource { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] diff --git a/crates/opencode-client/src/models/file_source.rs b/crates/opencode-client/src/models/file_source.rs index aaf21b1..2288e1a 100644 --- a/crates/opencode-client/src/models/file_source.rs +++ b/crates/opencode-client/src/models/file_source.rs @@ -30,7 +30,6 @@ impl FileSource { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "file")] diff --git a/crates/opencode-client/src/models/global_health_200_response.rs b/crates/opencode-client/src/models/global_health_200_response.rs index 6b5f825..c567ff2 100644 --- a/crates/opencode-client/src/models/global_health_200_response.rs +++ b/crates/opencode-client/src/models/global_health_200_response.rs @@ -24,7 +24,6 @@ impl GlobalHealth200Response { GlobalHealth200Response { healthy, version } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Healthy { #[serde(rename = "true")] diff --git a/crates/opencode-client/src/models/lsp_status.rs b/crates/opencode-client/src/models/lsp_status.rs index 3a75f53..50dd3cc 100644 --- a/crates/opencode-client/src/models/lsp_status.rs +++ b/crates/opencode-client/src/models/lsp_status.rs @@ -33,7 +33,6 @@ impl LspStatus { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "connected")] diff --git a/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs b/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs index 9fe3158..8d8310a 100644 --- a/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs +++ b/crates/opencode-client/src/models/mcp_auth_remove_200_response.rs @@ -22,7 +22,6 @@ impl McpAuthRemove200Response { McpAuthRemove200Response { success } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Success { #[serde(rename = "true")] diff --git a/crates/opencode-client/src/models/mcp_status_connected.rs b/crates/opencode-client/src/models/mcp_status_connected.rs index b10be3c..c7b807b 100644 --- a/crates/opencode-client/src/models/mcp_status_connected.rs +++ b/crates/opencode-client/src/models/mcp_status_connected.rs @@ -22,7 +22,6 @@ impl McpStatusConnected { McpStatusConnected { status } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "connected")] diff --git a/crates/opencode-client/src/models/mcp_status_disabled.rs b/crates/opencode-client/src/models/mcp_status_disabled.rs index 00438a5..9f511cf 100644 --- a/crates/opencode-client/src/models/mcp_status_disabled.rs +++ b/crates/opencode-client/src/models/mcp_status_disabled.rs @@ -22,7 +22,6 @@ impl McpStatusDisabled { McpStatusDisabled { status } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "disabled")] diff --git a/crates/opencode-client/src/models/mcp_status_failed.rs b/crates/opencode-client/src/models/mcp_status_failed.rs index 6688ed4..1c98020 100644 --- a/crates/opencode-client/src/models/mcp_status_failed.rs +++ b/crates/opencode-client/src/models/mcp_status_failed.rs @@ -24,7 +24,6 @@ impl McpStatusFailed { McpStatusFailed { status, error } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "failed")] diff --git a/crates/opencode-client/src/models/mcp_status_needs_auth.rs b/crates/opencode-client/src/models/mcp_status_needs_auth.rs index ef3c312..b7ad9fc 100644 --- a/crates/opencode-client/src/models/mcp_status_needs_auth.rs +++ b/crates/opencode-client/src/models/mcp_status_needs_auth.rs @@ -22,7 +22,6 @@ impl McpStatusNeedsAuth { McpStatusNeedsAuth { status } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "needs_auth")] diff --git a/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs b/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs index 09b9a1e..8f70f07 100644 --- a/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs +++ b/crates/opencode-client/src/models/mcp_status_needs_client_registration.rs @@ -24,7 +24,6 @@ impl McpStatusNeedsClientRegistration { McpStatusNeedsClientRegistration { status, error } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "needs_client_registration")] diff --git a/crates/opencode-client/src/models/message.rs b/crates/opencode-client/src/models/message.rs index bb28df7..0b0c041 100644 --- a/crates/opencode-client/src/models/message.rs +++ b/crates/opencode-client/src/models/message.rs @@ -84,7 +84,6 @@ impl Message { } } } -/// #[derive( Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default, )] diff --git a/crates/opencode-client/src/models/message_aborted_error.rs b/crates/opencode-client/src/models/message_aborted_error.rs index 4bdc60e..66a1141 100644 --- a/crates/opencode-client/src/models/message_aborted_error.rs +++ b/crates/opencode-client/src/models/message_aborted_error.rs @@ -27,7 +27,6 @@ impl MessageAbortedError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "MessageAbortedError")] diff --git a/crates/opencode-client/src/models/message_output_length_error.rs b/crates/opencode-client/src/models/message_output_length_error.rs index befb6d1..92bac30 100644 --- a/crates/opencode-client/src/models/message_output_length_error.rs +++ b/crates/opencode-client/src/models/message_output_length_error.rs @@ -24,7 +24,6 @@ impl MessageOutputLengthError { MessageOutputLengthError { name, data } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "MessageOutputLengthError")] diff --git a/crates/opencode-client/src/models/model.rs b/crates/opencode-client/src/models/model.rs index 5e2c93d..184bad2 100644 --- a/crates/opencode-client/src/models/model.rs +++ b/crates/opencode-client/src/models/model.rs @@ -74,7 +74,6 @@ impl Model { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] diff --git a/crates/opencode-client/src/models/model_capabilities_interleaved.rs b/crates/opencode-client/src/models/model_capabilities_interleaved.rs index 339eb73..40131d7 100644 --- a/crates/opencode-client/src/models/model_capabilities_interleaved.rs +++ b/crates/opencode-client/src/models/model_capabilities_interleaved.rs @@ -22,7 +22,6 @@ impl ModelCapabilitiesInterleaved { ModelCapabilitiesInterleaved { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs b/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs index e3cc5d8..17fff07 100644 --- a/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/model_capabilities_interleaved_any_of.rs @@ -22,7 +22,6 @@ impl ModelCapabilitiesInterleavedAnyOf { ModelCapabilitiesInterleavedAnyOf { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/not_found_error.rs b/crates/opencode-client/src/models/not_found_error.rs index 33a48db..9f1932e 100644 --- a/crates/opencode-client/src/models/not_found_error.rs +++ b/crates/opencode-client/src/models/not_found_error.rs @@ -27,7 +27,6 @@ impl NotFoundError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "NotFoundError")] diff --git a/crates/opencode-client/src/models/o_auth.rs b/crates/opencode-client/src/models/o_auth.rs index 0c3fb74..4fe57df 100644 --- a/crates/opencode-client/src/models/o_auth.rs +++ b/crates/opencode-client/src/models/o_auth.rs @@ -36,7 +36,6 @@ impl OAuth { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] diff --git a/crates/opencode-client/src/models/part.rs b/crates/opencode-client/src/models/part.rs index eac6047..ffc7df0 100644 --- a/crates/opencode-client/src/models/part.rs +++ b/crates/opencode-client/src/models/part.rs @@ -115,7 +115,6 @@ impl Part { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] diff --git a/crates/opencode-client/src/models/part_any_of.rs b/crates/opencode-client/src/models/part_any_of.rs index d30dfe6..5c4ad3c 100644 --- a/crates/opencode-client/src/models/part_any_of.rs +++ b/crates/opencode-client/src/models/part_any_of.rs @@ -53,7 +53,6 @@ impl PartAnyOf { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "subtask")] diff --git a/crates/opencode-client/src/models/patch_part.rs b/crates/opencode-client/src/models/patch_part.rs index 73ac52d..865c50b 100644 --- a/crates/opencode-client/src/models/patch_part.rs +++ b/crates/opencode-client/src/models/patch_part.rs @@ -46,7 +46,6 @@ impl PatchPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "patch")] diff --git a/crates/opencode-client/src/models/permission_respond_request.rs b/crates/opencode-client/src/models/permission_respond_request.rs index 04b3958..1fffcb5 100644 --- a/crates/opencode-client/src/models/permission_respond_request.rs +++ b/crates/opencode-client/src/models/permission_respond_request.rs @@ -22,7 +22,6 @@ impl PermissionRespondRequest { PermissionRespondRequest { response } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Response { #[serde(rename = "once")] diff --git a/crates/opencode-client/src/models/project.rs b/crates/opencode-client/src/models/project.rs index 5209f62..6ccf036 100644 --- a/crates/opencode-client/src/models/project.rs +++ b/crates/opencode-client/src/models/project.rs @@ -39,7 +39,6 @@ impl Project { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Vcs { #[serde(rename = "git")] diff --git a/crates/opencode-client/src/models/provider.rs b/crates/opencode-client/src/models/provider.rs index 5cddd48..ca62a43 100644 --- a/crates/opencode-client/src/models/provider.rs +++ b/crates/opencode-client/src/models/provider.rs @@ -49,7 +49,6 @@ impl Provider { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Source { #[serde(rename = "env")] diff --git a/crates/opencode-client/src/models/provider_auth_authorization.rs b/crates/opencode-client/src/models/provider_auth_authorization.rs index ed0ac62..e1ba5cf 100644 --- a/crates/opencode-client/src/models/provider_auth_authorization.rs +++ b/crates/opencode-client/src/models/provider_auth_authorization.rs @@ -30,7 +30,6 @@ impl ProviderAuthAuthorization { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Method { #[serde(rename = "auto")] diff --git a/crates/opencode-client/src/models/provider_auth_error.rs b/crates/opencode-client/src/models/provider_auth_error.rs index 97ccc4c..7886afe 100644 --- a/crates/opencode-client/src/models/provider_auth_error.rs +++ b/crates/opencode-client/src/models/provider_auth_error.rs @@ -27,7 +27,6 @@ impl ProviderAuthError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "ProviderAuthError")] diff --git a/crates/opencode-client/src/models/provider_auth_method.rs b/crates/opencode-client/src/models/provider_auth_method.rs index 11dcc19..30de0c2 100644 --- a/crates/opencode-client/src/models/provider_auth_method.rs +++ b/crates/opencode-client/src/models/provider_auth_method.rs @@ -24,7 +24,6 @@ impl ProviderAuthMethod { ProviderAuthMethod { r#type, label } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "oauth")] diff --git a/crates/opencode-client/src/models/provider_config_models_value.rs b/crates/opencode-client/src/models/provider_config_models_value.rs index 516dd4f..53db005 100644 --- a/crates/opencode-client/src/models/provider_config_models_value.rs +++ b/crates/opencode-client/src/models/provider_config_models_value.rs @@ -77,7 +77,6 @@ impl ProviderConfigModelsValue { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] diff --git a/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs b/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs index 0d878c1..5920ed7 100644 --- a/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs +++ b/crates/opencode-client/src/models/provider_config_models_value_interleaved.rs @@ -22,7 +22,6 @@ impl ProviderConfigModelsValueInterleaved { ProviderConfigModelsValueInterleaved { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs b/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs index da69574..a6b07db 100644 --- a/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/provider_config_models_value_interleaved_any_of.rs @@ -22,7 +22,6 @@ impl ProviderConfigModelsValueInterleavedAnyOf { ProviderConfigModelsValueInterleavedAnyOf { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs index 9efa5ad..a6408a3 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value.rs @@ -87,7 +87,6 @@ impl ProviderList200ResponseAllInnerModelsValue { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "alpha")] diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs index af12cf4..3e8e865 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved.rs @@ -22,7 +22,6 @@ impl ProviderList200ResponseAllInnerModelsValueInterleaved { ProviderList200ResponseAllInnerModelsValueInterleaved { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs index 72fa82e..ca0b683 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_interleaved_any_of.rs @@ -22,7 +22,6 @@ impl ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf { field } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Field { #[serde(rename = "reasoning_content")] diff --git a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs index 924a575..d969600 100644 --- a/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs +++ b/crates/opencode-client/src/models/provider_list_200_response_all_inner_models_value_modalities.rs @@ -27,7 +27,6 @@ impl ProviderList200ResponseAllInnerModelsValueModalities { ProviderList200ResponseAllInnerModelsValueModalities { input, output } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Input { #[serde(rename = "text")] @@ -47,7 +46,6 @@ impl Default for Input { Self::Text } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Output { #[serde(rename = "text")] diff --git a/crates/opencode-client/src/models/pty.rs b/crates/opencode-client/src/models/pty.rs index e9b5bcf..44a470f 100644 --- a/crates/opencode-client/src/models/pty.rs +++ b/crates/opencode-client/src/models/pty.rs @@ -50,7 +50,6 @@ impl Pty { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "running")] diff --git a/crates/opencode-client/src/models/reasoning_part.rs b/crates/opencode-client/src/models/reasoning_part.rs index 3264420..9e5f623 100644 --- a/crates/opencode-client/src/models/reasoning_part.rs +++ b/crates/opencode-client/src/models/reasoning_part.rs @@ -49,7 +49,6 @@ impl ReasoningPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "reasoning")] diff --git a/crates/opencode-client/src/models/retry_part.rs b/crates/opencode-client/src/models/retry_part.rs index 64f16f2..10028ec 100644 --- a/crates/opencode-client/src/models/retry_part.rs +++ b/crates/opencode-client/src/models/retry_part.rs @@ -50,7 +50,6 @@ impl RetryPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "retry")] diff --git a/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs b/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs index 42a86dc..6b0025c 100644 --- a/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs +++ b/crates/opencode-client/src/models/session_prompt_request_parts_inner.rs @@ -78,7 +78,6 @@ impl SessionPromptRequestPartsInner { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] diff --git a/crates/opencode-client/src/models/session_status.rs b/crates/opencode-client/src/models/session_status.rs index e00fc4f..5e5eaed 100644 --- a/crates/opencode-client/src/models/session_status.rs +++ b/crates/opencode-client/src/models/session_status.rs @@ -33,7 +33,6 @@ impl SessionStatus { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "idle")] diff --git a/crates/opencode-client/src/models/session_status_any_of.rs b/crates/opencode-client/src/models/session_status_any_of.rs index 045fe42..7b3bc7a 100644 --- a/crates/opencode-client/src/models/session_status_any_of.rs +++ b/crates/opencode-client/src/models/session_status_any_of.rs @@ -22,7 +22,6 @@ impl SessionStatusAnyOf { SessionStatusAnyOf { r#type } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "idle")] diff --git a/crates/opencode-client/src/models/session_status_any_of_1.rs b/crates/opencode-client/src/models/session_status_any_of_1.rs index 48c8910..d960c56 100644 --- a/crates/opencode-client/src/models/session_status_any_of_1.rs +++ b/crates/opencode-client/src/models/session_status_any_of_1.rs @@ -33,7 +33,6 @@ impl SessionStatusAnyOf1 { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "retry")] diff --git a/crates/opencode-client/src/models/session_status_any_of_2.rs b/crates/opencode-client/src/models/session_status_any_of_2.rs index 065417d..41f365d 100644 --- a/crates/opencode-client/src/models/session_status_any_of_2.rs +++ b/crates/opencode-client/src/models/session_status_any_of_2.rs @@ -22,7 +22,6 @@ impl SessionStatusAnyOf2 { SessionStatusAnyOf2 { r#type } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "busy")] diff --git a/crates/opencode-client/src/models/snapshot_part.rs b/crates/opencode-client/src/models/snapshot_part.rs index 3332ecb..fbc73b8 100644 --- a/crates/opencode-client/src/models/snapshot_part.rs +++ b/crates/opencode-client/src/models/snapshot_part.rs @@ -42,7 +42,6 @@ impl SnapshotPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "snapshot")] diff --git a/crates/opencode-client/src/models/step_finish_part.rs b/crates/opencode-client/src/models/step_finish_part.rs index b856f51..0e408e4 100644 --- a/crates/opencode-client/src/models/step_finish_part.rs +++ b/crates/opencode-client/src/models/step_finish_part.rs @@ -53,7 +53,6 @@ impl StepFinishPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "step-finish")] diff --git a/crates/opencode-client/src/models/step_start_part.rs b/crates/opencode-client/src/models/step_start_part.rs index b9d1c9d..dfaca19 100644 --- a/crates/opencode-client/src/models/step_start_part.rs +++ b/crates/opencode-client/src/models/step_start_part.rs @@ -36,7 +36,6 @@ impl StepStartPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "step-start")] diff --git a/crates/opencode-client/src/models/subtask_part_input.rs b/crates/opencode-client/src/models/subtask_part_input.rs index f4a4982..8d1c044 100644 --- a/crates/opencode-client/src/models/subtask_part_input.rs +++ b/crates/opencode-client/src/models/subtask_part_input.rs @@ -44,7 +44,6 @@ impl SubtaskPartInput { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "subtask")] diff --git a/crates/opencode-client/src/models/symbol_source.rs b/crates/opencode-client/src/models/symbol_source.rs index c187c5b..4340981 100644 --- a/crates/opencode-client/src/models/symbol_source.rs +++ b/crates/opencode-client/src/models/symbol_source.rs @@ -46,7 +46,6 @@ impl SymbolSource { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "symbol")] diff --git a/crates/opencode-client/src/models/text_part.rs b/crates/opencode-client/src/models/text_part.rs index 1f806bd..4014f68 100644 --- a/crates/opencode-client/src/models/text_part.rs +++ b/crates/opencode-client/src/models/text_part.rs @@ -54,7 +54,6 @@ impl TextPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] diff --git a/crates/opencode-client/src/models/text_part_input.rs b/crates/opencode-client/src/models/text_part_input.rs index 95ba125..5188da1 100644 --- a/crates/opencode-client/src/models/text_part_input.rs +++ b/crates/opencode-client/src/models/text_part_input.rs @@ -42,7 +42,6 @@ impl TextPartInput { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "text")] diff --git a/crates/opencode-client/src/models/tool_part.rs b/crates/opencode-client/src/models/tool_part.rs index e0b8bf8..1b7b42e 100644 --- a/crates/opencode-client/src/models/tool_part.rs +++ b/crates/opencode-client/src/models/tool_part.rs @@ -53,7 +53,6 @@ impl ToolPart { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tool")] diff --git a/crates/opencode-client/src/models/tool_state.rs b/crates/opencode-client/src/models/tool_state.rs index c7688cd..3de9233 100644 --- a/crates/opencode-client/src/models/tool_state.rs +++ b/crates/opencode-client/src/models/tool_state.rs @@ -52,7 +52,6 @@ impl ToolState { } } } -/// #[derive( Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default, )] diff --git a/crates/opencode-client/src/models/tool_state_completed.rs b/crates/opencode-client/src/models/tool_state_completed.rs index a698edb..e3b6497 100644 --- a/crates/opencode-client/src/models/tool_state_completed.rs +++ b/crates/opencode-client/src/models/tool_state_completed.rs @@ -49,7 +49,6 @@ impl ToolStateCompleted { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "completed")] diff --git a/crates/opencode-client/src/models/tool_state_error.rs b/crates/opencode-client/src/models/tool_state_error.rs index b4d2eaa..0e32e00 100644 --- a/crates/opencode-client/src/models/tool_state_error.rs +++ b/crates/opencode-client/src/models/tool_state_error.rs @@ -41,7 +41,6 @@ impl ToolStateError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "error")] diff --git a/crates/opencode-client/src/models/tool_state_pending.rs b/crates/opencode-client/src/models/tool_state_pending.rs index d250dbb..0e694de 100644 --- a/crates/opencode-client/src/models/tool_state_pending.rs +++ b/crates/opencode-client/src/models/tool_state_pending.rs @@ -30,7 +30,6 @@ impl ToolStatePending { ToolStatePending { status, input, raw } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "pending")] diff --git a/crates/opencode-client/src/models/tool_state_running.rs b/crates/opencode-client/src/models/tool_state_running.rs index f3eb14f..62b9068 100644 --- a/crates/opencode-client/src/models/tool_state_running.rs +++ b/crates/opencode-client/src/models/tool_state_running.rs @@ -40,7 +40,6 @@ impl ToolStateRunning { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Status { #[serde(rename = "running")] diff --git a/crates/opencode-client/src/models/tui_publish_request.rs b/crates/opencode-client/src/models/tui_publish_request.rs index 64850cf..a55a8d6 100644 --- a/crates/opencode-client/src/models/tui_publish_request.rs +++ b/crates/opencode-client/src/models/tui_publish_request.rs @@ -27,7 +27,6 @@ impl TuiPublishRequest { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "tui.prompt.append")] diff --git a/crates/opencode-client/src/models/tui_show_toast_request.rs b/crates/opencode-client/src/models/tui_show_toast_request.rs index 289c515..8ea93ef 100644 --- a/crates/opencode-client/src/models/tui_show_toast_request.rs +++ b/crates/opencode-client/src/models/tui_show_toast_request.rs @@ -34,7 +34,6 @@ impl TuiShowToastRequest { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Variant { #[serde(rename = "info")] diff --git a/crates/opencode-client/src/models/unknown_error.rs b/crates/opencode-client/src/models/unknown_error.rs index 6f47e85..f793bfb 100644 --- a/crates/opencode-client/src/models/unknown_error.rs +++ b/crates/opencode-client/src/models/unknown_error.rs @@ -27,7 +27,6 @@ impl UnknownError { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Name { #[serde(rename = "UnknownError")] diff --git a/crates/opencode-client/src/models/user_message.rs b/crates/opencode-client/src/models/user_message.rs index f8f9bd9..5dcb4cb 100644 --- a/crates/opencode-client/src/models/user_message.rs +++ b/crates/opencode-client/src/models/user_message.rs @@ -58,7 +58,6 @@ impl UserMessage { } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Role { #[serde(rename = "user")] diff --git a/crates/opencode-client/src/models/well_known_auth.rs b/crates/opencode-client/src/models/well_known_auth.rs index e4e056d..8917628 100644 --- a/crates/opencode-client/src/models/well_known_auth.rs +++ b/crates/opencode-client/src/models/well_known_auth.rs @@ -26,7 +26,6 @@ impl WellKnownAuth { WellKnownAuth { r#type, key, token } } } -/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "wellknown")] diff --git a/crates/orchestrator/src/opencode_events.rs b/crates/orchestrator/src/opencode_events.rs index cb813e4..d549389 100644 --- a/crates/orchestrator/src/opencode_events.rs +++ b/crates/orchestrator/src/opencode_events.rs @@ -298,6 +298,16 @@ impl OpenCodeEventSubscriber { Ok(()) } + /// Parse RFC3339 timestamp, falling back to current time with a warning if parsing fails + fn parse_timestamp(timestamp: &str) -> chrono::DateTime { + chrono::DateTime::parse_from_rfc3339(timestamp) + .map(|dt| dt.with_timezone(&chrono::Utc)) + .unwrap_or_else(|e| { + warn!(error = %e, timestamp = %timestamp, "Failed to parse timestamp, using current time"); + chrono::Utc::now() + }) + } + fn process_sse_event(event: &SseEvent, target_session_id: &str) -> Option { // Skip empty events or comments if event.data.is_empty() { @@ -395,9 +405,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { info!(id = %id, "Received step_start event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::StepStart { id, @@ -412,9 +420,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { debug!(id = %id, content_len = content.len(), "Received reasoning event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::Reasoning { id, @@ -430,9 +436,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { info!(id = %id, is_partial = is_partial, "Received agent_message event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::AgentMessage { id, @@ -448,9 +452,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { info!(success = success, "Received finished event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::Finished { success, @@ -466,9 +468,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { info!(id = %id, tool_name = %tool_name, "Received tool_call event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::ToolCall { id, @@ -487,9 +487,7 @@ impl OpenCodeEventSubscriber { timestamp, } => { info!(id = %id, tool_name = %tool_name, success = success, "Received tool_result event"); - let ts = chrono::DateTime::parse_from_rfc3339(×tamp) - .map(|dt| dt.with_timezone(&chrono::Utc)) - .unwrap_or_else(|_| chrono::Utc::now()); + let ts = Self::parse_timestamp(×tamp); Some(ExecutorEvent::DirectActivity { activity: crate::activity_store::SessionActivityMsg::ToolResult { id, diff --git a/crates/orchestrator/src/services/fix_phase.rs b/crates/orchestrator/src/services/fix_phase.rs index a7013f8..871fe7b 100644 --- a/crates/orchestrator/src/services/fix_phase.rs +++ b/crates/orchestrator/src/services/fix_phase.rs @@ -74,10 +74,13 @@ impl FixPhase { ) .await; - let _ = ctx + if let Err(e) = ctx .mcp_manager .cleanup_findings_server(&workspace_path) - .await; + .await + { + debug!(error = %e, "MCP cleanup failed"); + } let response_content = match response_content { Ok(content) => content, diff --git a/crates/orchestrator/src/services/mcp_manager.rs b/crates/orchestrator/src/services/mcp_manager.rs index 4d6bc54..da04e78 100644 --- a/crates/orchestrator/src/services/mcp_manager.rs +++ b/crates/orchestrator/src/services/mcp_manager.rs @@ -9,6 +9,9 @@ use uuid::Uuid; use crate::error::{OrchestratorError, Result}; +const MCP_FINDINGS_NAME: &str = "opencode-findings"; +const MCP_FINDINGS_BINARY: &str = "opencode-mcp-findings"; + pub struct McpManager { opencode_config: Arc, } @@ -39,7 +42,7 @@ impl McpManager { config.enabled = Some(true); config.timeout = Some(10000); - let request = McpAddRequest::new("opencode-findings".to_string(), config); + let request = McpAddRequest::new(MCP_FINDINGS_NAME.to_string(), config); let directory = workspace_path.to_str(); info!( @@ -55,7 +58,7 @@ impl McpManager { OrchestratorError::OpenCodeError(format!("Failed to add MCP server: {}", e)) })?; - default_api::mcp_connect(&self.opencode_config, "opencode-findings", directory) + default_api::mcp_connect(&self.opencode_config, MCP_FINDINGS_NAME, directory) .await .map_err(|e| { error!(error = %e, "Failed to connect MCP findings server"); @@ -72,7 +75,7 @@ impl McpManager { info!("Disconnecting MCP findings server"); if let Err(e) = - default_api::mcp_disconnect(&self.opencode_config, "opencode-findings", directory).await + default_api::mcp_disconnect(&self.opencode_config, MCP_FINDINGS_NAME, directory).await { warn!(error = %e, "Failed to disconnect MCP findings server (may already be disconnected)"); } @@ -84,14 +87,14 @@ impl McpManager { if cfg!(debug_assertions) { if let Ok(exe_path) = std::env::current_exe() { if let Some(parent) = exe_path.parent() { - let mcp_path = parent.join("opencode-mcp-findings"); + let mcp_path = parent.join(MCP_FINDINGS_BINARY); if mcp_path.exists() { return mcp_path.to_string_lossy().to_string(); } } } } - "opencode-mcp-findings".to_string() + MCP_FINDINGS_BINARY.to_string() } } diff --git a/crates/orchestrator/src/services/review_phase.rs b/crates/orchestrator/src/services/review_phase.rs index 1399f27..f415fb2 100644 --- a/crates/orchestrator/src/services/review_phase.rs +++ b/crates/orchestrator/src/services/review_phase.rs @@ -86,10 +86,13 @@ impl ReviewPhase { ) .await; - let _ = ctx + if let Err(e) = ctx .mcp_manager .cleanup_findings_server(&workspace_path) - .await; + .await + { + debug!(error = %e, "MCP cleanup failed"); + } let response_content = match response_content { Ok(content) => content, @@ -334,9 +337,10 @@ impl ReviewPhase { None }; - let diff = Self::get_workspace_diff(ctx, task) - .await - .unwrap_or_default(); + let diff = Self::get_workspace_diff(ctx, task).await.unwrap_or_else(|e| { + warn!(error = %e, task_id = %task.id, "Failed to get workspace diff, proceeding without diff"); + String::new() + }); let prompt = if mcp_config.is_some() { PhasePrompts::review_with_mcp(task, &diff) } else { diff --git a/crates/server/src/routes/filesystem.rs b/crates/server/src/routes/filesystem.rs index 6e340f9..33dddcf 100644 --- a/crates/server/src/routes/filesystem.rs +++ b/crates/server/src/routes/filesystem.rs @@ -91,11 +91,7 @@ fn browse_path(path: &PathBuf) -> BrowseResponse { path: path.display().to_string(), is_dir, is_vcs_root, - vcs: if is_vcs_root { - Some(vcs.to_string()) - } else { - None - }, + vcs: is_vcs_root.then_some(vcs.to_string()), }) }) .collect() @@ -109,10 +105,6 @@ fn browse_path(path: &PathBuf) -> BrowseResponse { parent_path, entries, is_vcs_root, - vcs: if is_vcs_root { - Some(current_vcs.to_string()) - } else { - None - }, + vcs: is_vcs_root.then_some(current_vcs.to_string()), } }