1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Agent-facing facade over the packs + marketplace subsystems.
//!
//! This module is the AGI/agent integration surface for ggen's package system.
//! Where the CLI returns human-oriented strings and the underlying pipeline
//! returns engine-internal types, [`PackAgent`] returns a *small, stable,
//! `serde`-serializable* contract ([`types`]) designed for autonomous
//! consumption over MCP, A2A, or a direct library call.
//!
//! ## Design contract
//!
//! - **One authoritative path.** The facade wraps the same durable-state writers
//! the CLI uses (`domain::packs::install::install_pack`, the lockfile, the
//! receipt emitter). It does not fork a second install path, so it can only
//! *deepen* authority, never bypass it.
//! - **Evidence-bearing outcomes.** Every mutating result carries the artifacts
//! it produced (digest, lockfile path, signed receipt) so an agent can prove
//! the state transition happened instead of trusting a status string.
//! - **Fail-closed, typed errors.** Refusals (missing pack, empty digest,
//! absent lockfile, bad signature) are surfaced as [`types::AgentError`]
//! variants the agent can branch on — never swallowed into a fake success.
//! - **Discovery-first.** [`PackAgent::capabilities`] describes the available
//! operations and capability surfaces so an agent learns the contract without
//! out-of-band documentation.
//!
//! ## Example
//!
//! ```no_run
//! use ggen_core::agent::{PackAgent, InstallRequest};
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let agent = PackAgent::new()?;
//!
//! // Discover, then search, then install with provenance.
//! let _caps = agent.capabilities();
//! let hits = agent.search("rust", Some(5))?;
//! if let Some(top) = hits.first() {
//! let outcome = agent.install(InstallRequest::new(&top.pack.id)).await?;
//! assert!(!outcome.digest.is_empty());
//! assert!(outcome.receipt.is_some());
//! }
//! # Ok(())
//! # }
//! ```
pub use PackAgent;
pub use ;
pub use ;