Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ARCANGEL0 EVA open install terminal

From Leeroopedia
Knowledge Sources
Domains Tool_Installation, UI_Architecture
Last Updated 2026-10-29 14:00 GMT

Overview

Concrete tool for opening a terminal emulator window with a generated install script running visibly, so the operator can see and approve package operations, provided by the Mitsu armory service module.

Description

The open_install_terminal function:

  1. Generates the script via `build_install_script`.
  2. Detects a terminal emulator using `_find_terminal`, which checks (in order): the `TERM_PROGRAM` env var, the `TERMINAL` env var, `KITTY_WINDOW_ID` (for kitty), then probes for ghostty, kitty, wezterm, alacritty, foot, xfce4-terminal, gnome-terminal, konsole, xterm.
  3. Constructs the terminal command per the detected terminal's syntax (e.g., `gnome-terminal --wait -- sh -c "script"`, `kitty --single-instance --wait-for-single-instance-window-close sh -c "script"`).
  4. Launches the process via `subprocess.Popen` with `start_new_session=True` so the terminal is independent of the Mitsu process.
  5. Returns the Popen process and method_id for tracking.

Usage

  • Armory TUI: Called when the operator selects "Install" from the armory catalog browser.
  • Agent-managed install: Called by the agent tool host when the agent installs a tool via `armory_run`.

Code Reference

Source Location

  • Repository: Mitsu
  • File: services/redteam_armory.py

Signature

def open_install_terminal(
    tool: ToolSpec,
    environment: HostEnvironment,
    operation: str,
) -> tuple[subprocess.Popen, str]: ...

Import

from mitsu.services.redteam_armory import open_install_terminal

I/O Contract

Inputs

Name Type Required Description
tool ToolSpec Yes Catalog tool entry
environment HostEnvironment Yes Host OS and package manager
operation str Yes "install" or "uninstall"

Outputs

Name Type Description
returns[0] subprocess.Popen Terminal process running the install script
returns[1] str Method ID for registry tracking

Usage Examples

Open Install Terminal

from mitsu.services.redteam_armory import open_install_terminal
from mitsu.armory import TOOL_BY_ID
from mitsu.services.host_environment import detect_host_environment

env = detect_host_environment()
tool = TOOL_BY_ID["nmap"]

process, method_id = open_install_terminal(tool, env, "install")
print(f"Install terminal opened (method: {method_id})")
# Wait for the terminal to close
process.wait()
print(f"Exit code: {process.returncode}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment