Skip to content

feat: MetaHub distributed agent cluster + execution mode refactoring#62

Merged
yishuiliunian merged 10 commits intomainfrom
feat/meta-hub-distributed-cluster
Apr 2, 2026
Merged

feat: MetaHub distributed agent cluster + execution mode refactoring#62
yishuiliunian merged 10 commits intomainfrom
feat/meta-hub-distributed-cluster

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Introduces MetaHub — a coordination layer enabling multiple Loopal Hub instances to form a distributed agent cluster with cross-hub communication
  • Refactors execution modes into 3 orthogonal dimensions: frontend (--server), lifecycle (--ephemeral), and cluster (--join-hub)
  • Adds agent-visible tools (ListHubs, Agent with target_hub) for cluster-aware operations

Architecture

MetaHub (TCP coordinator)
  ├── Hub-A (uplink) ── Agent-1, Agent-2
  └── Hub-B (uplink) ── Agent-3, Agent-4
  • New crate: loopal-meta-hub (11 source files, ~1200 lines)
  • Hub uplink: bidirectional TCP connection to MetaHub
  • Shadow entries: local placeholders for remote agents (enables wait_agent)
  • 8 new meta/* IPC protocol methods

Changes

  • New crate: crates/loopal-meta-hub/ — HubRegistry, GlobalRouter, EventAggregator, server, dispatch
  • Hub layer: uplink.rs, finish.rs, shadow entry support, meta/* forwarding
  • Protocol: QualifiedAddress in loopal-protocol, meta/* methods in loopal-ipc
  • CLI: --meta-hub, --join-hub, --hub-name, --server, --ephemeral (replaces --headless)
  • Runtime: LifecycleMode::Persistent/Ephemeral (replaces Interactive/Task)
  • Agent tools: ListHubs tool, Agent tool with target_hub parameter

Test plan

  • 34 unit/integration tests (DuplexTransport)
  • 3 real-binary e2e cluster tests (TCP + real loopal processes)
  • bazel build //... --config=clippy — zero warnings
  • bazel build //... --config=rustfmt — clean
  • Manual cluster testing: MetaHub + 2 Hubs, cross-hub agent discovery and routing verified

Introduces MetaHub — a coordination layer enabling multiple Loopal Hub
instances to form a distributed agent cluster with cross-hub communication.

MetaHub architecture:
- New crate `loopal-meta-hub` with HubRegistry, GlobalRouter, EventAggregator
- Hub-to-MetaHub TCP uplink with bidirectional communication
- Cross-hub message routing (meta/route), agent spawning (meta/spawn),
  agent discovery (meta/resolve), and permission relay
- Shadow entries for tracking remote agents locally (wait_agent support)
- 8 new meta/* IPC protocol methods
- CLI: `--meta-hub <addr>` to start MetaHub, `--join-hub <addr>` to connect

Execution mode refactoring (3 orthogonal dimensions):
- Frontend: `--server` replaces `--headless` (UI form only)
- Lifecycle: `--ephemeral` for one-shot tasks (default: persistent)
- Cluster: `--join-hub` / `--meta-hub` (independent of above)
- LifecycleMode::Interactive→Persistent, ::Task→Ephemeral
- Lifecycle passed explicitly via IPC, not inferred from prompt presence

Agent tools for cluster awareness:
- `ListHubs` tool: discover other hubs in the cluster
- `Agent` tool: `target_hub` parameter for cross-hub spawn
- Hub dispatch forwards meta/* methods to MetaHub via uplink

Testing: 34 unit/integration tests + 3 real-binary e2e cluster tests
- Add Distributed Cluster section with setup instructions
- Update CLI reference: --server/--ephemeral replace --headless,
  add --meta-hub/--join-hub/--hub-name
- Add cluster architecture diagram
- Update tool list with ListHubs
- Add three-dimension execution model table
@yishuiliunian yishuiliunian force-pushed the feat/meta-hub-distributed-cluster branch from b2d580f to 2f5fa46 Compare April 2, 2026 08:57
@yishuiliunian yishuiliunian merged commit d74f767 into main Apr 2, 2026
3 checks passed
@yishuiliunian yishuiliunian deleted the feat/meta-hub-distributed-cluster branch April 2, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant