Skip to main content

ag_agent/
agent.rs

1//! Agent backend wiring split into provider-specific submodules.
2//!
3//! This module feeds the curated crate-root API while keeping provider
4//! command builders, parsers, and transport policy descriptors private.
5
6use std::path::Path;
7
8mod antigravity;
9pub(crate) mod app_server;
10mod availability;
11mod backend;
12mod claude;
13pub(crate) mod cli;
14mod codex;
15mod gemini;
16mod instruction;
17mod prompt;
18mod provider;
19mod response_parser;
20mod submission;
21
22pub use availability::{
23    AgentAvailabilityProbe, RealAgentAvailabilityProbe, StaticAgentAvailabilityProbe,
24    executable_name,
25};
26#[cfg(any(test, feature = "test-utils"))]
27pub use backend::MockAgentBackend;
28pub use backend::{AgentBackend, AgentBackendError, AgentTransport, BuildCommandRequest};
29pub use instruction::normalize_instruction_conversation_id;
30pub(crate) use instruction::{InstructionDeliveryMode, plan_app_server_instruction_delivery};
31pub use prompt::diff_fence;
32pub(crate) use prompt::{PromptPreparationRequest, prepare_prompt_text};
33pub(crate) use provider::{
34    build_command_stdin_payload, is_app_server_thought_chunk, parse_response,
35    parse_stream_output_line, parse_turn_response, protocol_schema_instruction_mode,
36};
37pub use provider::{create_app_server_client, create_backend, transport_mode};
38pub(crate) use response_parser::{
39    ParsedResponse, compact_codex_progress_message, is_codex_completion_status_message,
40};
41pub use submission::{
42    OneShotRequest, OneShotSubmission, submit_one_shot, submit_one_shot_with_app_server_client,
43    submit_one_shot_with_backend,
44};
45
46/// Removes provider-owned worktree artifacts derived from one session folder.
47///
48/// Current providers keep setup state inside the session worktree or git
49/// metadata, so there is no external provider artifact to remove.
50///
51/// # Errors
52/// This function currently never returns an error.
53pub fn cleanup_session_worktree_artifacts(_folder: &Path) -> Result<(), AgentBackendError> {
54    Ok(())
55}