Skip to content

A structured, event‑driven alternative to PTYs for building intelligent, multi‑agent command‑line systems.

Notifications You must be signed in to change notification settings

SkybuckFlying/Universal-Agent-IO-Bus

Repository files navigation


UNIVERSAL AGENT I/O BUS (UAIOB)

A deterministic, event-driven alternative to PTYs for building intelligent, multi-agent CLIs.


OVERVIEW

The Universal Agent I/O Bus (UAIOB) is a new execution model designed to replace the brittle, legacy PTY (pseudo-terminal) abstraction with a structured, event-driven communication system.

Instead of streaming raw bytes through a terminal emulator, UAIOB treats every interaction as a typed event flowing through a shared bus. This enables:

  • deterministic process execution
  • clean separation between agents and renderers
  • structured stdout/stderr streaming
  • multi-agent orchestration
  • AI-friendly output
  • zero reliance on ANSI escape codes or terminal state

UAIOB is implemented in Delphi as a single self-contained unit.
It runs on Windows and uses standard pipes (not PTYs) to execute commands.


WHY THIS EXISTS

Traditional CLIs rely on PTYs, which introduce:

  • hidden terminal state
  • ANSI escape code hacks
  • inconsistent behavior across OSes
  • difficulty parsing output
  • no structured semantics
  • no multi-agent support

UAIOB replaces all of this with:

  • structured events
  • typed payloads
  • clean process boundaries
  • deterministic behavior
  • AI-ready output
  • extensible agent architecture

This is the foundation for next-generation CLIs, including AI-augmented tools such as a future Gemini CLI.


ARCHITECTURE

UAIOB consists of three core components:

1. Event Bus

A thread-safe, in-memory publish/subscribe system.

Agents publish events such as:

  • CommandRequest
  • CommandStarted
  • CommandOutput
  • CommandError
  • CommandFinished

Renderers and other agents subscribe to events using simple filters.

2. Shell Agent

A process executor that:

  • receives CommandRequest events
  • launches commands using "cmd.exe /C ..."
  • streams stdout and stderr as structured events
  • supports infinite timeouts
  • decodes console output using the correct OEM codepage
  • never uses a PTY

This agent is stateless by design, making it deterministic and safe.

3. Console Renderer

A simple renderer that:

  • sends command requests
  • prints output events
  • decodes OEM bytes correctly
  • supports large outputs (tree, git, npm, etc.)

It demonstrates how any UI (CLI, GUI, web, AI agent) can subscribe to the bus.


FEATURES

Structured event model

Every interaction is a typed event with:

  • ID
  • correlation ID
  • timestamp
  • source
  • target
  • payload type
  • payload bytes

Deterministic process execution

Each command runs in a fresh process.
No hidden shell state.
No PTY.
No ANSI.
No terminal modes.

Infinite timeout

Long-running commands such as:

  • tree c:\
  • npm install
  • git clone

run to completion without interruption.

Correct console decoding

Windows console tools output OEM codepage bytes.
UAIOB decodes them correctly, avoiding Unicode errors.

Multi-agent ready

You can add:

  • GitAgent
  • FSAgent
  • PromptAgent
  • AIHelperAgent
  • BuildAgent
  • TestAgent

All communicating over the same bus.

AI-friendly

Because output is structured, AI systems can:

  • summarize
  • detect errors
  • extract paths
  • understand progress
  • orchestrate workflows

No scraping terminal text.


EXAMPLE USAGE

Start the demo:

Universal Agent I/O Bus Demo
Type a command to run (or blank line to exit).

dir

Run anything:

ipconfig
git status
tree /A
python script.py
node --version

All output streams through the bus as structured events.


WHY THIS MATTERS

UAIOB is not just a shell wrapper.
It is the foundation for a new class of CLIs:

  • multi-agent
  • event-driven
  • AI-augmented
  • deterministic
  • cross-platform
  • extensible

It enables a future where:

  • CLIs are orchestrated by agents
  • output is structured, not scraped
  • workflows are intelligent
  • terminals are optional
  • AI can reason about command execution in real time

This is the architecture a modern Gemini CLI deserves.


OPTIONAL EXTENSIONS

You can extend UAIOB with:

  • virtual working directory ("cd" support)
  • environment variable agent
  • GitAgent with structured JSON output
  • AIHelperAgent for suggestions and automation
  • remote execution over TCP or WebSockets
  • GUI renderer
  • session manager

Each extension is just another agent on the bus.


PHILOSOPHY

UAIOB is built on three principles:

  1. Everything is an event
    No streams. No terminals. No hidden state.

  2. Agents, not shells
    Each domain has its own agent. The shell is just one of them.

  3. Structure over text
    Machines should not parse ANSI.
    Humans should not fight terminals.
    AI should not guess semantics.


About

A structured, event‑driven alternative to PTYs for building intelligent, multi‑agent command‑line systems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages