Skip to main content

turul_a2a_patterns/
lib.rs

1//! `turul-a2a-patterns` defines reusable abstractions for A2A skill
2//! authoring — the `SkillHandler` trait, `SkillRegistry`, `SkillCard`
3//! (SKILL.md) helpers, and the `SkillProgressSink` trait. It depends only
4//! on `turul-a2a-proto` and `turul-a2a-types`, never on the server
5//! runtime. It does NOT change the A2A wire contract; profile/extension
6//! machinery lives elsewhere.
7//!
8//! Public surface (all re-exported from the crate root):
9//!
10//! - Errors: [`SkillError`], [`SinkError`], [`ManifestError`],
11//!   [`RenderError`], [`ValidationError`].
12//! - Skill handler trait: [`SkillHandler`] taking a
13//!   [`SkillProgressSink`] for non-terminal status / artifact emits.
14//! - Progress sink: [`SkillProgressSink`] + [`ProgressState`]
15//!   (non-terminal states only; terminals come from the handler's
16//!   return value).
17//! - Pre-terminal gates: [`PreTerminalGate`] + [`GateContext`], run on a
18//!   handler's output by [`GatedHandler`]; a gate error replaces it.
19//! - Terminal hook: [`TerminalHook`] + [`SkillOutcome`].
20//! - SKILL.md projection: [`SkillCard`] (`from_embedded`, `from_skill`, `TryFrom<&Skill>`,
21//!   validate_input, validate_output, render_prompt, to_agent_skill) +
22//!   [`ExecutionHints`]. `turul-agent-skills` loads and validates the
23//!   `SKILL.md`; this crate reads its `a2a-*` metadata and asset files.
24//! - Registry: [`SkillRegistry`] trait + [`InMemorySkillRegistry`] +
25//!   [`SkillDescriptor`].
26//! - Schema validation: [`validate_json`] (JSON Schema 2020-12
27//!   strict-keyword check).
28//!
29//! Internal modules (`error`, `sink`, `handler`, `gate`, `hook`, `manifest`,
30//! `template`, `schema`, `registry`) are implementation detail; use
31//! the flat re-exports above.
32
33mod error;
34mod gate;
35mod handler;
36mod hook;
37mod manifest;
38mod registry;
39mod schema;
40mod sink;
41mod template;
42
43pub use error::{ManifestError, RenderError, SinkError, SkillError, ValidationError};
44pub use gate::{GateContext, GatedHandler, PreTerminalGate};
45pub use handler::SkillHandler;
46pub use hook::{SkillOutcome, TerminalHook};
47pub use manifest::{ExecutionHints, SkillCard};
48pub use registry::{InMemorySkillRegistry, SkillDescriptor, SkillRegistry};
49pub use schema::validate_json;
50pub use sink::{ProgressState, SkillProgressSink};