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
//! Agent compose/deploy/manifest machinery, extracted from `trusty-mpm` (#2892).
//!
//! Why: `trusty-mpm` and `trusty-code` both need to resolve `extends:`
//! inheritance chains, track which deployed agent files a harness owns, and
//! write composed agents into a target directory without clobbering
//! user-owned files. This logic was originally trusty-mpm-only
//! (`crates/trusty-mpm/src/core/{agent_builder,agent_manifest,agent_deployer,
//! agent_metadata,frontmatter}.rs`); moving it here (mirroring the precedent
//! set by `ToolExecutor`/`AgentRunner`) lets both harnesses share one
//! implementation instead of forking it.
//! What: six submodules — [`frontmatter`] (the shared `key: value` line
//! parser, plus the `skills:` list-value grammar), [`builder`] (the
//! `extends:` inheritance-chain composer, filesystem-backed), [`builder_in_memory`]
//! (the disk-free counterpart — resolves `extends:` against an embedded
//! asset map instead of a `source_dir`, issue #2958 Slice E1), [`manifest`]
//! (the checksum + atomic-write ownership ledger), [`deployer`] (writes
//! composed agents into a target directory, consulting the manifest to avoid
//! clobbering user edits, and records each processed agent's declared
//! `skills:` for co-deployment), and [`metadata`] (a read-only projection of
//! a deployed agent's frontmatter for display/diagnostics, used by
//! `deployer` and by trusty-mpm's `tm doctor` / `tm agent` surfaces).
//! `trusty-mpm` re-exports every public item from
//! `crate::core::{agent_builder,agent_manifest,agent_deployer,agent_metadata,
//! frontmatter}` for source compatibility with its existing call sites.
//! Test: `cargo test -p trusty-agents-common agents::` exercises every
//! submodule in place; `cargo test -p trusty-mpm` exercises the re-exported
//! call sites end-to-end.
//!
//! [`frontmatter`]: crate::agents::frontmatter
//! [`builder`]: crate::agents::builder
//! [`builder_in_memory`]: crate::agents::builder_in_memory
//! [`manifest`]: crate::agents::manifest
//! [`deployer`]: crate::agents::deployer
//! [`metadata`]: crate::agents::metadata
// #9011: `builder`'s `metadata:` map, kept out of the at-cap `builder.rs`.
// #8199: `builder`'s verbatim `permissions:` block, kept out of `builder.rs`.
// #4698: `builder`'s YAML scalar encoding, split out when adding `provenance:`
// pushed `builder.rs` over the 500-SLOC production cap.
// #4442: the shared "is this file outside the canonical tier tm's?" classifier,
// consumed by `tm doctor`'s asset_tier probe and (#4448) its quarantine
// counterpart.
// #4448: the quarantine — the REPAIR half of the pair `tier_audit` reports on —
// plus the two gates that make moving a file safe, which `tier_audit` alone
// could not supply: `agent_schema` (is this trusty-mpm's artifact or another
// project's?) and `vcs_claim` (does the repository claim this file?).
// #4698: the `provenance:` frontmatter field — which of the three writers
// (framework deploy, tm-agent-manager, the operator's own editor) produced a
// given agent file. Additive: it records authorship, never a tier.
// #7727: the `{{TM_SKILLS}}` placeholder a deploy resolves to the install's
// absolute skills directory, so a no-`Skill` agent can `Read` a skill file.
// #7683: the deployed-roster `tools:` conformance pin — asserts every agent
// deploys with the allowlist `docs/specs/agent-context-minimization.md` §C
// specifies, so an absent key cannot silently restore the all-tools default.