Skip to main content

reuse_existing_pane

Function reuse_existing_pane 

Source
pub(super) async fn reuse_existing_pane(
    state: &AppState,
    agent: &AgentDefinition,
    provider: &ProviderConfig,
    cmd: &CommandAgentOpenData,
    tab_id: &str,
    headless: bool,
    into_block: Option<&str>,
) -> Result<Option<AgentOpenResult>, String>
Expand description

What agent.open (or a start, headless) does when the agent already has a block. The agent has one pane: super::agent_block::decide_agent_pane says which, and every path that would add one asks it, so no open makes a second (task #5419):

  • in tab_id: that pane, as before (a start leaves it as it is);
  • parked: attach it to tab_id and place its pane, no new block (a start leaves it parked);
  • shown in another tab, window or not running: that pane, focused and restarted in place, no second one.

A pane being filled in (into_block, a layout import) never takes another’s agent: the placeholder is left as a picker and the agent’s pane is returned, when a window shows it (or it is parked).

None: nothing to reuse, the caller makes the block.