greentic_types/
pack_spec.rs

1//! Serde-ready representations for Greentic `pack.yaml` manifests.
2
3use alloc::{string::String, vec::Vec};
4#[cfg(feature = "serde")]
5use serde::{Deserialize, Serialize};
6
7/// Canonical on-disk pack specification (`pack.yaml`).
8///
9/// Fields default to empty collections to keep additive evolution backwards compatible.
10#[derive(Debug, Clone, PartialEq, Default)]
11#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
12pub struct PackSpec {
13    /// Unique identifier for the pack.
14    pub id: String,
15    /// Semantic pack version.
16    pub version: String,
17    /// Relative flow file paths bundled with the pack.
18    #[cfg_attr(feature = "serde", serde(default))]
19    pub flow_files: Vec<String>,
20    /// Template directories that should be bundled with the pack.
21    #[cfg_attr(feature = "serde", serde(default))]
22    pub template_dirs: Vec<String>,
23    /// Optional set of required imports enforced by the host.
24    #[cfg_attr(feature = "serde", serde(default))]
25    pub imports_required: Vec<String>,
26    /// Optional legacy tool definitions. Prefer MCP-first designs.
27    #[cfg_attr(feature = "serde", serde(default))]
28    pub tools: Vec<ToolSpec>,
29}
30
31/// Tool metadata referenced by a [`PackSpec`].
32#[derive(Debug, Clone, PartialEq)]
33#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
34pub struct ToolSpec {
35    /// Tool identifier referenced by flows.
36    pub name: String,
37    /// Optional hint for the loader to determine the tool source (for example `mcp`).
38    #[cfg_attr(feature = "serde", serde(default))]
39    pub source: Option<String>,
40    /// Filesystem path hint for embedded tools.
41    #[cfg_attr(feature = "serde", serde(default))]
42    pub path: Option<String>,
43    /// Actions exposed by the tool.
44    #[cfg_attr(feature = "serde", serde(default))]
45    pub actions: Vec<String>,
46}