Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/agent_config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ fn goose_runtime() -> &'static KnownAcpRuntime {

fn agent_record() -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: "agent".to_string(),
name: "Agent".to_string(),
Expand Down Expand Up @@ -131,6 +132,7 @@ fn agent_record() -> ManagedAgentRecord {

fn persona_with_model(model: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
description: None,
id: "persona-1".to_string(),
display_name: "Persona".to_string(),
Expand Down
7 changes: 0 additions & 7 deletions desktop/src-tauri/src/commands/agent_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ pub fn set_agent_managed_profiles(enabled: bool, state: State<'_, AppState>) {
.store(!enabled, Ordering::Release);
}

#[tauri::command]
pub fn set_thread_scoped_acp_sessions(enabled: bool, state: State<'_, AppState>) {
state
.thread_scoped_acp_sessions_enabled()
.store(enabled, Ordering::Release);
}

#[tauri::command]
pub async fn set_managed_agent_start_on_app_launch(
pubkey: String,
Expand Down
4 changes: 4 additions & 0 deletions desktop/src-tauri/src/commands/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ pub async fn create_managed_agent(
idle_timeout_seconds: input.idle_timeout_seconds.filter(|s| *s > 0),
max_turn_duration_seconds: input.max_turn_duration_seconds.filter(|s| *s > 0),
parallelism: minted.parallelism.unwrap_or(DEFAULT_AGENT_PARALLELISM),
session_policy: linked_persona
.as_ref()
.map(|persona| persona.session_policy)
.unwrap_or_default(),
system_prompt: snapshot_prompt.or_else(|| {
input
.system_prompt
Expand Down
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/commands/agents_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ pub(crate) fn build_deploy_payload<R: tauri::Runtime>(
effective.system_prompt.value.as_deref(),
effective.model.value.as_deref(),
&owner_pubkey,
crate::managed_agents::acp_session_policy(state),
crate::managed_agents::effective_acp_session_policy(record, &personas),
);

let effective_parallelism =
Expand Down
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/agents_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fn bare_agent_record(
use crate::managed_agents::{BackendKind, RespondTo};
use std::collections::BTreeMap;
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: "agent".to_string(),
name: "Agent".to_string(),
Expand Down Expand Up @@ -71,6 +72,7 @@ fn bare_agent_record(
fn persona_record(id: &str, model: Option<&str>, provider: Option<&str>) -> AgentDefinition {
use std::collections::BTreeMap;
AgentDefinition {
session_policy: Default::default(),
description: None,
id: id.to_string(),
display_name: "Test Persona".to_string(),
Expand Down
3 changes: 3 additions & 0 deletions desktop/src-tauri/src/commands/media_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ mod tests {
format: FORMAT_DISCRIMINATOR.to_string(),
version: FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "test".to_string(),
source_is_builtin: false,
system_prompt: None,
Expand Down Expand Up @@ -659,6 +660,7 @@ mod tests {
format: FORMAT_DISCRIMINATOR.to_string(),
version: FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "test".to_string(),
source_is_builtin: false,
system_prompt: None,
Expand Down Expand Up @@ -705,6 +707,7 @@ mod tests {
format: FORMAT_DISCRIMINATOR.to_string(),
version: FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "test".to_string(),
source_is_builtin: false,
system_prompt: None,
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/media_snapshot_png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ mod tests {
format: "buzz-agent-snapshot".to_string(),
version: 1,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "Tree Trunks".to_string(),
source_is_builtin: false,
system_prompt: Some("You are a helpful agent.".to_string()),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/personas/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub async fn create_persona(
respond_to: None,
respond_to_allowlist: Vec::new(),
parallelism: None,
session_policy: crate::managed_agents::AcpSessionPolicy::Channel,
created_at: now.clone(),
updated_at: now,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn make_agent(
runtime_pid: Option<u32>,
) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: pubkey.to_string(),
name: "Test Agent".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const TEAM_ID: &str = "team-seam";

fn member(id: &str, display_name: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
id: id.to_string(),
display_name: display_name.to_string(),
description: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const UUID: &str = "11111111-2222-3333-4444-555555555555"; // sadscan:disable sq
/// IS its UUID id. Carries env_vars + source_team that must survive a patch.
fn local_in_app() -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
description: None,
id: UUID.to_string(),
display_name: "Local".to_string(),
Expand Down Expand Up @@ -39,6 +40,7 @@ fn local_in_app() -> AgentDefinition {
/// slug = Some(d-tag), empty env_vars, source_team None.
fn inbound_for(d_tag: &str, display_name: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
description: None,
id: d_tag.to_string(),
display_name: display_name.to_string(),
Expand Down Expand Up @@ -163,6 +165,7 @@ const AGENT_PUBKEY: &str = "agentpubkeyhex00000000000000000000000000000000000000
/// event must NEVER be able to overwrite.
fn local_agent() -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: AGENT_PUBKEY.to_string(),
name: "Local Agent".to_string(),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/personas/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ mod tests {

fn persona() -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
description: None,
id: "catalog-reviewer".to_string(),
display_name: "Catalog Reviewer".to_string(),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/personas/sharing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ mod tests {

fn persona() -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
description: None,
id: "catalog-reviewer".to_string(),
display_name: "Catalog Reviewer".to_string(),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/personas/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ mod png_body_tests {
format: crate::managed_agents::agent_snapshot::FORMAT_DISCRIMINATOR.to_string(),
version: crate::managed_agents::agent_snapshot::FORMAT_VERSION,
definition: crate::managed_agents::agent_snapshot::AgentSnapshotDefinition {
session_policy: Default::default(),
name: "Agent".to_string(),
source_is_builtin: false,
system_prompt: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::collections::BTreeMap;

fn make_definition(slug: &str) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: String::new(),
slug: Some(slug.to_string()),
Expand Down Expand Up @@ -80,6 +81,7 @@ fn make_snapshot(
format: FORMAT_DISCRIMINATOR.to_string(),
version: FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "Test Agent".to_string(),
source_is_builtin: false,
system_prompt: Some("You are helpful.".to_string()),
Expand Down
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/personas/snapshot/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ pub async fn confirm_agent_snapshot_import(
respond_to: respond_to_wire.clone(),
respond_to_allowlist: minted.respond_to_allowlist.clone(),
parallelism: minted_parallelism,
session_policy: snapshot.definition.session_policy,
created_at: now.clone(),
updated_at: now.clone(),
};
Expand Down Expand Up @@ -622,6 +623,7 @@ pub async fn confirm_agent_snapshot_import(
max_turn_duration_seconds: snapshot.definition.max_turn_duration_seconds,
parallelism: minted_parallelism
.unwrap_or(crate::managed_agents::DEFAULT_AGENT_PARALLELISM),
session_policy: snapshot.definition.session_policy,
system_prompt: snapshot.definition.system_prompt.clone(),
model: snapshot.definition.model.clone(),
provider: snapshot.definition.provider.clone(),
Expand Down
3 changes: 3 additions & 0 deletions desktop/src-tauri/src/commands/personas/snapshot/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::collections::BTreeMap;
/// persona_id.
fn make_definition(slug: &str) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: String::new(),
slug: Some(slug.to_string()),
Expand Down Expand Up @@ -84,6 +85,7 @@ fn make_definition(slug: &str) -> ManagedAgentRecord {
/// have `slug: None` and link to their definition via `persona_id`.
fn make_instance(pubkey: &str, persona_id: &str) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
pubkey: pubkey.to_string(),
slug: None,
persona_id: Some(persona_id.to_string()),
Expand Down Expand Up @@ -111,6 +113,7 @@ fn make_snapshot(
format: FORMAT_DISCRIMINATOR.to_string(),
version: FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: "Test Agent".to_string(),
source_is_builtin: false,
system_prompt: Some("You are helpful.".to_string()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::managed_agents::agent_snapshot_envelope::{
/// agent-endpoint unlock path resolves exactly as production does.
fn record_for(agent: &nostr::Keys) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
pubkey: agent.public_key().to_hex(),
slug: None,
persona_id: Some("locked-test".to_string()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use super::*;

fn agent(persona_id: &str, name: &str, display_name: Option<&str>) -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: format!("pubkey-{name}"),
name: name.to_string(),
Expand Down
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/team_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn definition_from_snapshot(
respond_to,
respond_to_allowlist: behavior.respond_to_allowlist,
parallelism: behavior.parallelism,
session_policy: member.definition.session_policy,
created_at: now.to_string(),
updated_at: now.to_string(),
})
Expand Down Expand Up @@ -582,6 +583,7 @@ pub async fn confirm_team_snapshot_import(
max_turn_duration_seconds: member.definition.max_turn_duration_seconds,
parallelism: minted_parallelism
.unwrap_or(crate::managed_agents::DEFAULT_AGENT_PARALLELISM),
session_policy: member.definition.session_policy,
system_prompt: member.definition.system_prompt.clone(),
model: member.definition.model.clone(),
provider: member.definition.provider.clone(),
Expand Down
5 changes: 5 additions & 0 deletions desktop/src-tauri/src/commands/team_snapshot/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn member(name: &str) -> AgentSnapshot {
format: crate::managed_agents::agent_snapshot::FORMAT_DISCRIMINATOR.to_string(),
version: crate::managed_agents::agent_snapshot::FORMAT_VERSION,
definition: AgentSnapshotDefinition {
session_policy: Default::default(),
name: name.to_string(),
source_is_builtin: false,
system_prompt: Some(format!("{name} prompt")),
Expand Down Expand Up @@ -55,6 +56,7 @@ fn snapshot(members: Vec<AgentSnapshot>) -> TeamSnapshot {
fn team_export_round_trip_preserves_team_and_excludes_member_memory() {
let definitions = vec![
AgentDefinition {
session_policy: Default::default(),
description: Some("A careful reviewer.".to_string()),
id: "alice".to_string(),
display_name: "Alice".to_string(),
Expand All @@ -79,6 +81,7 @@ fn team_export_round_trip_preserves_team_and_excludes_member_memory() {
updated_at: "now".to_string(),
},
AgentDefinition {
session_policy: Default::default(),
description: None,
id: "bob".to_string(),
display_name: "Bob".to_string(),
Expand Down Expand Up @@ -151,6 +154,7 @@ fn team_export_round_trip_preserves_team_and_excludes_member_memory() {
#[test]
fn team_export_with_instance_and_memory_level_uses_supplied_entries() {
let definitions = vec![AgentDefinition {
session_policy: Default::default(),
description: None,
id: "alice".to_string(),
display_name: "Alice".to_string(),
Expand Down Expand Up @@ -193,6 +197,7 @@ fn team_export_with_instance_and_memory_level_uses_supplied_entries() {

// Build a fake instance record tied to this team+persona.
let instance = ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: "a".repeat(64),
name: "Alice".to_string(),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/teams/adopt/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ fn member_copy(
.flatten(),
respond_to_allowlist: Vec::new(),
parallelism: member.parallelism,
session_policy: member.session_policy,
created_at: now.to_string(),
updated_at: now.to_string(),
})
Expand Down
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/teams/adopt/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const TEAM_D_TAG: &str = "team-alpha";

fn persona(id: &str, prompt: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
id: id.to_string(),
display_name: id.to_string(),
description: None,
Expand Down Expand Up @@ -48,6 +49,7 @@ fn persona(id: &str, prompt: &str) -> AgentDefinition {

fn member(member_key: &str, prompt: &str) -> TeamCatalogMember {
TeamCatalogMember {
session_policy: Default::default(),
member_key: member_key.to_string(),
display_name: member_key.to_string(),
system_prompt: Some(prompt.to_string()),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/teams/pending/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const KIND_DELETE: u32 = 5;

fn member(id: &str, display_name: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
id: id.to_string(),
display_name: display_name.to_string(),
description: None,
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/commands/teams/sharing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::sync::{Arc, Mutex};

fn member(id: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
id: id.to_string(),
display_name: "One".to_string(),
description: None,
Expand Down
9 changes: 0 additions & 9 deletions desktop/src-tauri/src/commands/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ pub async fn apply_workspace(
nsec: Option<String>,
repos_dir: Option<String>,
agent_managed_profiles: Option<bool>,
thread_scoped_acp_sessions: Option<bool>,
app: AppHandle,
) -> Result<(), String> {
let state = app.state::<AppState>();
Expand Down Expand Up @@ -231,14 +230,6 @@ pub async fn apply_workspace(
state
.managed_agent_profile_reconcile_enabled()
.store(!agent_managed_profiles.unwrap_or(false), Ordering::Release);
// Persisted frontend experiment state must land before launch-time
// restore so every restored agent starts with the selected ACP policy.
// Missing preserves the stable channel-scoped behavior.
state.thread_scoped_acp_sessions_enabled().store(
thread_scoped_acp_sessions.unwrap_or(false),
Ordering::Release,
);

// ── Filesystem side-effect (non-fatal) ────────────────────────────────
// Persist the *effective* repos_dir (None when the candidate failed
// validation) for the backend to read at boot, then re-point REPOS to
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/event_sync_team_catalog_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TEAM_ID: &str = "team-alpha";

fn member(id: &str, prompt: &str) -> AgentDefinition {
AgentDefinition {
session_policy: Default::default(),
id: id.to_string(),
display_name: id.to_string(),
description: None,
Expand Down
1 change: 0 additions & 1 deletion desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,6 @@ pub fn run() {
start_managed_agent,
stop_managed_agent,
set_agent_managed_profiles,
set_thread_scoped_acp_sessions,
set_managed_agent_start_on_app_launch,
set_managed_agent_auto_restart,
delete_managed_agent,
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/managed_agents/agent_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ mod tests {

fn sample_agent() -> ManagedAgentRecord {
ManagedAgentRecord {
session_policy: Default::default(),
description: None,
pubkey: "agentpubkeyhex".to_string(),
name: "Test Agent".to_string(),
Expand Down
Loading
Loading