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
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Subagent management: spawning, grants, transcripts, and lifecycle hooks.
//!
//! `zeph-subagent` provides the full lifecycle of sub-agent tasks within the Zeph agent
//! framework. It covers:
//!
//! - **Definitions** ([`SubAgentDef`]) — parse YAML/TOML frontmatter from `.md` files,
//! validate names and permissions, and load from priority-ordered directories.
//! - **Manager** ([`SubAgentManager`]) — spawn, cancel, collect, and resume sub-agent tasks
//! against a configurable concurrency limit.
//! - **Grants** ([`PermissionGrants`]) — zero-trust TTL-bounded permission tracking for
//! vault secrets and runtime tool grants.
//! - **Hooks** ([`fire_hooks`]) — run shell commands at `PreToolUse`, `PostToolUse`,
//! `SubagentStart`, and `SubagentStop` lifecycle events.
//! - **Filter** ([`FilteredToolExecutor`]) — enforce per-agent [`ToolPolicy`] and denylist
//! on every tool call before it reaches the real executor.
//! - **Transcripts** ([`TranscriptWriter`], [`TranscriptReader`]) — persist conversation
//! history to JSONL files for session resume and auditing.
//! - **Memory** ([`ensure_memory_dir`], [`load_memory_content`]) — resolve and inject
//! persistent `MEMORY.md` content into the sub-agent system prompt.
//! - **Commands** ([`AgentCommand`], [`AgentsCommand`]) — typed parsers for `/agent` and
//! `/agents` slash commands.
//!
//! # Quick start
//!
//! ```rust,no_run
//! use std::sync::Arc;
//! use zeph_subagent::{SubAgentDef, SubAgentManager};
//!
//! // Parse a definition from markdown frontmatter.
//! let content = "---\nname: helper\ndescription: A helpful sub-agent\n---\nYou are a helper.\n";
//! let def = SubAgentDef::parse(content).expect("valid definition");
//! assert_eq!(def.name, "helper");
//!
//! // Create a manager with a concurrency limit of 4.
//! let _manager = SubAgentManager::new(4);
//! ```
pub use ;
pub use ;
pub use SubAgentError;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use resolve_agent_paths;
pub use SubAgentState;
pub use ;