Skip to content

Commit 0d1a28d

Browse files
committed
Package the remote-agent fixes and features as a stack
In upstream order of likely merge: remote-observer-frames (block#7086, carries block#5578), redeploy-after-shutdown (block#7724, carries block#7485), pulse-agent-presence (block#4537), remote-agent-logs and agent-files (NIP-AF). pulse-agent-presence is packaged from stack/pulse-agent-presence, its branch rebuilt on redeploy-after-shutdown, since both add a test at the end of agent-availability.spec.ts.
1 parent 54c2738 commit 0d1a28d

107 files changed

Lines changed: 13831 additions & 169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/buzz-acp/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ toml = "1.0"
7777
# Filter expressions
7878
evalexpr = { workspace = true }
7979

80+
# Shared-file walking (NIP-AF)
81+
ignore = "0.4.25"
82+
8083
# Process-group kill (safe wrapper around killpg) — Unix-only; kill_process_group
8184
# has a #[cfg(not(unix))] fallback in acp.rs.
8285
[target.'cfg(unix)'.dependencies]

‎crates/buzz-acp/src/config.rs‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,13 @@ pub struct CliArgs {
530530
/// ignored (the watermark stays at startup time).
531531
#[arg(long, env = "BUZZ_ACP_REPLAY_FLOOR")]
532532
pub replay_floor: Option<u64>,
533+
534+
/// File or directory to share with the agent's owner as NIP-AF agent
535+
/// files, relative to the working directory. Repeatable; directories are
536+
/// shared recursively, skipping hidden and git-ignored entries. Requires
537+
/// an agent owner.
538+
#[arg(long, env = "BUZZ_ACP_SHARE", value_delimiter = ',')]
539+
pub share: Vec<PathBuf>,
533540
}
534541

535542
/// Merged NIP-01 subscription filter for a single channel.
@@ -634,6 +641,10 @@ pub struct Config {
634641
/// `from_cli()`. `None` when using the compiled-in default or when
635642
/// `--no-base-prompt` is set.
636643
pub base_prompt_content: Option<String>,
644+
/// Absolute paths shared with the owner as NIP-AF agent files
645+
/// (`--share` / `BUZZ_ACP_SHARE`), validated in `from_args()` to stay
646+
/// inside the working directory.
647+
pub share: Vec<PathBuf>,
637648
}
638649

639650
/// Maximum length, in characters, of a session title sent to the adapter.
@@ -1155,6 +1166,14 @@ impl Config {
11551166

11561167
validate_multiple_event_handling(args.multiple_event_handling, args.dedup)?;
11571168

1169+
let share = if args.share.is_empty() {
1170+
Vec::new()
1171+
} else {
1172+
let cwd = std::env::current_dir()?;
1173+
crate::file_share::resolve_shared_paths(&cwd, &args.share)
1174+
.map_err(ConfigError::ConfigFile)?
1175+
};
1176+
11581177
let config = Config {
11591178
keys,
11601179
relay_url: args.relay_url,
@@ -1209,6 +1228,7 @@ impl Config {
12091228
agent_owner: args.agent_owner.map(|s| s.trim().to_ascii_lowercase()),
12101229
no_base_prompt: args.no_base_prompt,
12111230
base_prompt_content,
1231+
share,
12121232
};
12131233

12141234
Ok(config)
@@ -1587,6 +1607,7 @@ mod tests {
15871607
agent_owner: None,
15881608
no_base_prompt: false,
15891609
base_prompt_content: None,
1610+
share: Vec::new(),
15901611
}
15911612
}
15921613

@@ -2972,6 +2993,45 @@ channels = "ALL"
29722993
const TEST_PRIVATE_KEY: &str =
29732994
"0000000000000000000000000000000000000000000000000000000000000001";
29742995

2996+
#[test]
2997+
fn share_is_repeatable_and_comma_delimited() {
2998+
let args = CliArgs::try_parse_from([
2999+
"buzz-acp",
3000+
"--private-key",
3001+
TEST_PRIVATE_KEY,
3002+
"--share",
3003+
"PLANS,notes.md",
3004+
"--share",
3005+
"AGENTS.md",
3006+
])
3007+
.expect("clap should parse args");
3008+
assert_eq!(
3009+
args.share,
3010+
[
3011+
PathBuf::from("PLANS"),
3012+
PathBuf::from("notes.md"),
3013+
PathBuf::from("AGENTS.md")
3014+
]
3015+
);
3016+
let config = Config::from_args(args).expect("shares inside the working directory");
3017+
let cwd = std::env::current_dir().unwrap();
3018+
assert_eq!(config.share[0], cwd.join("PLANS"));
3019+
}
3020+
3021+
#[test]
3022+
fn share_outside_the_working_directory_is_a_config_error() {
3023+
let args = CliArgs::try_parse_from([
3024+
"buzz-acp",
3025+
"--private-key",
3026+
TEST_PRIVATE_KEY,
3027+
"--share",
3028+
"../elsewhere",
3029+
])
3030+
.expect("clap should parse args");
3031+
let msg = Config::from_args(args).unwrap_err().to_string();
3032+
assert!(msg.contains("outside the working directory"), "{msg}");
3033+
}
3034+
29753035
#[test]
29763036
fn allowed_respond_to_full_path_rejects_disallowed_mode() {
29773037
// --allowed-respond-to=owner-only,allowlist + --respond-to=anyone → ConfigError

0 commit comments

Comments
 (0)