Skip to main content

a3s_use_ocr/
lib.rs

1//! Provider-oriented optical character recognition for A3S.
2//!
3//! [`OcrClient`] owns bounded source validation and evidence while recognition
4//! is delegated to an injected [`OcrProvider`]. The optional PP-OCRv6 feature
5//! supplies the local default used by A3S Use without making that model the
6//! library's architectural boundary.
7
8#[cfg(feature = "ppocr-v6")]
9mod assets;
10#[cfg(feature = "cli")]
11pub mod cli;
12mod client;
13#[cfg(feature = "ppocr-v6")]
14mod config;
15#[cfg(feature = "ppocr-v6")]
16mod engine;
17#[cfg(feature = "ppocr-v6")]
18mod install;
19#[cfg(feature = "mcp")]
20pub mod mcp;
21mod models;
22#[cfg(feature = "ppocr-v6")]
23mod postprocess;
24#[cfg(feature = "ppocr-v6")]
25mod ppocr_v6;
26#[cfg(feature = "ppocr-v6")]
27mod preprocess;
28mod provider;
29
30#[cfg(feature = "ppocr-v6")]
31pub use assets::{ocr_status, OcrInstallSource, OcrRuntimeStatus};
32pub use client::OcrClient;
33#[cfg(feature = "ppocr-v6")]
34pub use install::{install_ppocr_v6, repair_ppocr_v6, uninstall_managed_ppocr_v6};
35#[cfg(feature = "mcp")]
36pub use mcp::OcrMcpServer;
37pub use models::{OcrBlock, OcrBoundingBox, OcrDiagnostic, OcrPoint, OcrRequest, OcrResult};
38#[cfg(feature = "ppocr-v6")]
39pub use ppocr_v6::{PpOcrV6Provider, PP_OCR_V6_PROVIDER_ID};
40pub use provider::{
41    OcrInput, OcrProvider, OcrProviderDescriptor, OcrProviderOutput, OcrProviderStatus,
42};
43
44pub use a3s_use_core::{Artifact, Readiness, UseError, UseResult};
45
46/// Source-tree Skill root used by development hosts.
47///
48/// Installed products should use their release-packaged Skill directory. This
49/// path is intentionally only a fallback for source builds and tests.
50pub fn source_skill_root() -> std::path::PathBuf {
51    std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("skills")
52}
53
54#[cfg(test)]
55mod tests {
56    #[test]
57    fn source_skill_is_owned_by_this_repository() {
58        assert!(super::source_skill_root()
59            .join("a3s-use-ocr/SKILL.md")
60            .is_file());
61    }
62}