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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
use FromMeta;
use TokenStream;
/// Attribute macro for ACT component modules.
///
/// Transforms a module containing `#[act_tool]` functions into a complete
/// WIT component implementation with `wit_bindgen::generate!()`, `export!()`,
/// and a `Guest` trait implementation.
///
/// # Manifest
///
/// Reads `act.toml` from the crate root for component metadata and capabilities.
/// If `act.toml` is absent, all metadata comes from `Cargo.toml`.
///
/// Resolution order: **attribute > act.toml > Cargo.toml**.
///
/// # Attributes
///
/// - `manifest = "..."` — Path to manifest file (default: `"act.toml"`)
/// - `name = "..."` — Override component name
/// - `version = "..."` — Override component version
/// - `description = "..."` — Override component description
/// - `default_language = "..."` — Override BCP 47 language tag
///
/// # Examples
///
/// ```ignore
/// // Reads act.toml, falls back to Cargo.toml:
/// #[act_component]
/// mod component {
/// use super::*;
///
/// #[act_tool(description = "Say hello")]
/// fn greet(name: String) -> ActResult<String> {
/// Ok(format!("Hello, {name}!"))
/// }
/// }
///
/// // Feature-flag variant with attribute overrides:
/// #[cfg_attr(not(feature = "vec"), act_component)]
/// #[cfg_attr(feature = "vec", act_component(
/// name = "sqlite-vec",
/// description = "SQLite with vector search"
/// ))]
/// mod component { /* ... */ }
/// ```
/// Attribute macro for ACT tool functions.
///
/// When used inside an `#[act_component]` module, marks a function as a tool.
/// The `#[act_component]` macro processes these attributes during code generation.
///
/// When used standalone (outside `#[act_component]`), this is a no-op pass-through.
///
/// # Attributes
///
/// - `description = "..."` (required) — Tool description
/// - `read_only` — Mark tool as read-only
/// - `idempotent` — Mark tool as idempotent
/// - `destructive` — Mark tool as destructive
/// - `streaming` — Mark tool as streaming (auto-detected if ActContext param present)
/// - `timeout_ms = N` — Set timeout in milliseconds
/// Embed an Agent Skills directory as an `act:skill` WASM custom section.
///
/// Reads the directory at compile time, packs it as an uncompressed tar archive,
/// and emits a `#[link_section = "act:skill"]` static. The directory must contain
/// at least a `SKILL.md` file.
///
/// The path is relative to the crate's `CARGO_MANIFEST_DIR`.
///
/// # Example
///
/// ```ignore
/// act_sdk::embed_skill!("skill/");
/// ```
///
/// See `ACT-AGENTSKILLS.md` for the full specification.