rho-coding-agent 3.13.0

A fast Rust agent harness with a small footprint and opinionated defaults
Documentation
//! The children a session's agent starts on its own, recorded as child
//! jobs of the session's job (see `app::runtime_child_host`).

use std::sync::Arc;

use super::AcpTurns;
use crate::{
    acp_runtime::runtime_children::RuntimeChildren,
    app::runtime_child_host::{Announce, RecordedChildren},
    permission::PermissionMode,
    subagent::RunPlacement,
};

/// What records the children the agent of `turns`'s session starts on its
/// own in a turn in permission mode `mode`, as the session's subagents are;
/// `None` where nothing hears of them. Built per turn: a turn runs in the
/// mode and as the agent the session has as it starts.
pub(super) fn for_turn(turns: &AcpTurns, mode: PermissionMode) -> Option<Arc<dyn RuntimeChildren>> {
    let children = RecordedChildren {
        works_for: turns.id.clone(),
        placement: RunPlacement::for_parent_session(
            turns.id.to_string(),
            turns.file.subagents_dir(),
        ),
        workspace: turns.workspace.clone(),
        indexed_under: turns.workspace.clone(),
        announce: Announce::Observer(turns.children.clone()?),
    };
    Some(children.host(&turns.agent.agent().artifact_identity(), mode))
}