Skip to main content

devboy_executor/
lib.rs

1//! # devboy-executor
2//!
3//! Tool execution engine for devboy-tools.
4//!
5//! Separates tool execution logic from transport (MCP stdio, HTTP, NAPI).
6//! Provides:
7//! - `Executor` — dispatches tool calls to providers with enrichment pipeline
8//! - `AdditionalContext` / `ProviderConfig` — typed runtime context
9//! - `ToolOutput` — typed results from tool execution
10//! - `ToolEnricher` — plugin trait for dynamic schema modification
11//! - `factory` — creates providers from `ProviderConfig`
12//!
13//! ## Usage
14//!
15//! ```rust,no_run
16//! use devboy_executor::{Executor, AdditionalContext, ProviderConfig, GitLabScope};
17//! use devboy_executor::enricher::FormatPipelineEnricher;
18//! use std::collections::HashMap;
19//!
20//! # async fn example() -> devboy_core::Result<()> {
21//! let mut executor = Executor::new();
22//! executor.add_enricher(Box::new(FormatPipelineEnricher));
23//!
24//! let ctx = AdditionalContext {
25//!     provider: ProviderConfig::GitLab {
26//!         base_url: "https://gitlab.com".into(),
27//!         access_token: "glpat-xxx".into(),
28//!         scope: GitLabScope::Project { id: "12345".into() },
29//!         extra: HashMap::new(),
30//!     },
31//!     proxy: None,
32//!     metadata: None,
33//!     extra: HashMap::new(),
34//! };
35//!
36//! let args = serde_json::json!({ "state": "opened", "limit": 10 });
37//! let output = executor.execute("get_merge_requests", args, &ctx).await?;
38//! println!("Got {} items", output.item_count());
39//! # Ok(())
40//! # }
41//! ```
42
43#![deny(rustdoc::broken_intra_doc_links)]
44#![deny(rustdoc::private_intra_doc_links)]
45#![deny(rustdoc::invalid_html_tags)]
46/// Typed runtime context: provider configs, scopes, additional metadata.
47pub mod context;
48pub mod enricher;
49pub mod executor;
50/// Provider factory — builds concrete `Provider` instances from `ProviderConfig`.
51pub mod factory;
52pub mod format;
53/// Typed `ToolOutput` returned from tool execution.
54pub mod output;
55pub mod tool_docs;
56pub mod tools;
57
58// Re-export main types at crate root
59pub use context::{
60    AdditionalContext, ClickUpScope, ConfluenceAuthConfig, ConfluenceScope, GitHubScope,
61    GitLabScope, JiraScope, ProviderConfig, ProviderMetadata, ProxyConfig,
62};
63pub use devboy_core::{ToolEnricher, ToolSchema, sanitize_field_name};
64pub use enricher::PipelineFormatEnricher;
65pub use executor::{Executor, SUPPORTED_TOOLS};
66pub use factory::{
67    create_enricher, create_knowledge_base_enricher, create_knowledge_base_provider,
68};
69pub use format::{FormatMetadata, FormatResult, execute_and_format, format_output};
70pub use output::{ResultMeta, ToolOutput};
71pub use tools::{McpOnlyTool, ToolDefinition};