ilink-hub 0.3.0

iLink-compatible multiplexer hub for WeChat ClawBot — route one WeChat account to multiple AI agent backends
Documentation
//! Built-in profile handlers for `ilink-hub-bridge profile <type>`.
//!
//! Each handler reads the P0 env vars injected by the bridge and writes to stdout:
//!   - Optional first line: `AGENT_SESSION:<uuid>`
//!   - Remaining lines: reply text for the WeChat user
//!
//! All built-ins follow the same P0 exec protocol as external scripts/SDKs.
//!
//! ## Supported built-in types
//!
//! | `type:` value      | CLI tool      | Session resume | Notes                                     |
//! |--------------------|---------------|----------------|-------------------------------------------|
//! | `claude-code`      | `claude`      | ✓ (`--resume`) | Anthropic Claude Code CLI                 |
//! | `codebuddy-code`   | `codebuddy`   | ✓ (`--resume`) | CodeBuddy Code CLI (stream-json compat)   |
//! | `codex`            | `codex`       | ✗              | OpenAI Codex CLI (`@openai/codex`)        |
//! | `cursor`           | `cursor`      | ✓ (optional)   | Cursor background agent CLI               |
//! | `agy`              | `agy`         | ✓ (`--conversation`) | Google Antigravity CLI             |
//! | `recursive`        | `recursive`   | ✓ (`-r`)       | Recursive agent CLI (session UUID from stderr) |

mod agy;
mod claude_code;
mod codebuddy_code;
mod codex;
mod common;
mod cursor;
mod recursive;

/// Dispatch to a built-in profile handler by type name.
///
/// Called from `ilink-hub-bridge profile <type>`.
pub async fn run_builtin_profile(profile_type: &str) -> anyhow::Result<()> {
    match profile_type {
        "claude-code" => claude_code::run().await,
        "codebuddy-code" => codebuddy_code::run().await,
        "codex" => codex::run().await,
        "cursor" => cursor::run().await,
        "agy" => agy::run().await,
        "recursive" => recursive::run().await,
        other => anyhow::bail!(
            "unknown built-in profile type `{other}`; \
             supported: claude-code, codebuddy-code, codex, cursor, agy, recursive"
        ),
    }
}