aethershell 12.0.1

The world's first multi-agent shell with typed functional pipelines and multi-modal AI
// AetherShell TUI NANDA Protocol Demo
// Launch with: ae tui
//
// This demo showcases NANDA (Negotiation And Distributed Agreement):
// - Consensus-based decision making
// - Voting mechanisms
// - Negotiation workflows
// - Task allocation with agreement
//
// Note on shape: a proposal is named and carries its own threshold, and votes
// are cast against the returned proposal id with a boolean. There is no
// separate coordinator object to create and pass to every call — an earlier
// version of this file assumed one, and every line failed.

// Propose a coordination strategy. `threshold` is the fraction of votes
// required for consensus.
let neg1 = nanda_propose("coordination-strategy", {
  type: "CoordinationStrategy",
  content: "Use round-robin policy for task distribution",
  proposed_by: "agent1",
  threshold: 0.75
})
print("Proposal 1: " + neg1)

// Agents vote on the proposal
nanda_vote(neg1.id, true)
nanda_vote(neg1.id, true)
nanda_vote(neg1.id, false)
nanda_vote(neg1.id, true)

print("Consensus on proposal 1: " + nanda_consensus(neg1.id))
print("Quorum on proposal 1: " + nanda_quorum(neg1.id))

// Propose a task allocation
let neg2 = nanda_propose("task-allocation", {
  type: "TaskAllocation",
  content: {
    task1: "agent1",
    task2: "agent2",
    task3: "agent3"
  },
  proposed_by: "coordinator",
  threshold: 0.75
})

nanda_vote(neg2.id, true)
nanda_vote(neg2.id, true)
nanda_vote(neg2.id, true)

print("Consensus on proposal 2: " + nanda_consensus(neg2.id))

// Overall negotiation state
print("NANDA status: " + nanda_status())

// The TUI provides:
// - Live proposal and vote tallies
// - Consensus threshold progress bars
// - Per-agent voting history
// - Negotiation timeline
//

print("TUI NANDA Protocol Demo Ready! Launch with: ae tui")