bin/ 230 CLI tools (ask-*, br-*, agent-*, roadid, carpool) scripts/ 99 automation scripts fleet/ Node configs and deployment workers/ Cloudflare Worker sources (roadpay, road-search, squad webhooks) roadc/ RoadC programming language roadnet/ Mesh network (5 APs, WireGuard) operator/ Memory system scripts config/ System configs dotfiles/ Shell configs docs/ Documentation BlackRoad OS — Pave Tomorrow. RoadChain-SHA2048: d1a24f55318d338b RoadChain-Identity: alexa@sovereign RoadChain-Full: d1a24f55318d338b24b60bad7be39286379c76ae5470817482100cb0ddbbcb97e147d07ac7243da0a9f0363e4e5c833d612b9c0df3a3cd20802465420278ef74875a5b77f55af6fe42a931b8b635b3d0d0b6bde9abf33dc42eea52bc03c951406d8cbe49f1a3d29b26a94dade05e9477f34a7d4d4c6ec4005c3c2ac54e73a68440c512c8e83fd9b1fe234750b898ef8f4032c23db173961fe225e67a0432b5293a9714f76c5c57ed5fdf35b9fb40fd73c03ebf88b7253c6a0575f5afb6a6b49b3bda310602fb1ef676859962dad2aebbb2875814b30eee0a8ba195e482d4cbc91d8819e7f38f6db53e8063401649c77bb994371473cabfb917fb53e8cbe73d60
191 lines
5.7 KiB
Bash
191 lines
5.7 KiB
Bash
#!/usr/bin/env bash
|
|
# ============================================================================
|
|
# BLACKROAD OS, INC. - PROPRIETARY AND CONFIDENTIAL
|
|
# Copyright (c) 2025-2026 BlackRoad OS, Inc. All Rights Reserved.
|
|
# ============================================================================
|
|
# Agent Collab - Watch agents collaborate on a task in real-time
|
|
# Usage: agent-collab "Build a REST API for the agent registry"
|
|
set -eo pipefail
|
|
|
|
source "$HOME/.blackroad/config/nodes.sh" 2>/dev/null || true
|
|
|
|
SWARM_DIR="$HOME/.blackroad/swarm"
|
|
mkdir -p "$SWARM_DIR"
|
|
|
|
OLLAMA_NODES=(cecilia lucidia alice)
|
|
|
|
# Find best Ollama endpoint
|
|
find_ollama() {
|
|
if curl -sf --connect-timeout 1 "http://localhost:11434/api/tags" &>/dev/null; then
|
|
echo "http://localhost:11434"; return 0
|
|
fi
|
|
for node in "${OLLAMA_NODES[@]}"; do
|
|
local ip="${NODE_IP[$node]:-}"
|
|
[[ -z "$ip" ]] && continue
|
|
if curl -sf --connect-timeout 2 "http://${ip}:11434/api/tags" &>/dev/null; then
|
|
echo "http://${ip}:11434"; return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
OLLAMA_URL=$(find_ollama) || { echo "No Ollama available" >&2; exit 1; }
|
|
|
|
# Colors
|
|
PINK='\033[38;5;205m'
|
|
AMBER='\033[38;5;214m'
|
|
BLUE='\033[38;5;69m'
|
|
GREEN='\033[38;5;82m'
|
|
VIOLET='\033[38;5;135m'
|
|
CYAN='\033[38;5;45m'
|
|
GRAY='\033[38;5;245m'
|
|
RESET='\033[0m'
|
|
BOLD='\033[1m'
|
|
|
|
# Get model for agent
|
|
get_model() {
|
|
case "$1" in
|
|
cecilia) echo "Cecilia:latest" ;;
|
|
lucidia) echo "lucidia:latest" ;;
|
|
aria) echo "aria:latest" ;;
|
|
silas) echo "Silas:latest" ;;
|
|
*) echo "llama3.2" ;;
|
|
esac
|
|
}
|
|
|
|
# Get role for agent
|
|
get_role() {
|
|
case "$1" in
|
|
cecilia) echo "Orchestrator" ;;
|
|
lucidia) echo "Recursive Core" ;;
|
|
aria) echo "Navigator" ;;
|
|
silas) echo "Engineer" ;;
|
|
*) echo "Agent" ;;
|
|
esac
|
|
}
|
|
|
|
# Get color for agent
|
|
get_color() {
|
|
case "$1" in
|
|
cecilia) echo "$PINK" ;;
|
|
lucidia) echo "$AMBER" ;;
|
|
aria) echo "$BLUE" ;;
|
|
silas) echo "$GREEN" ;;
|
|
*) echo "$GRAY" ;;
|
|
esac
|
|
}
|
|
|
|
# Task
|
|
TASK="${*:-Discuss how to improve the BlackRoad agent system}"
|
|
|
|
# Conversation history
|
|
HISTORY=""
|
|
|
|
# Header
|
|
echo ""
|
|
echo -e "${PINK}╔═══════════════════════════════════════════════════════════════════════════╗${RESET}"
|
|
echo -e "${PINK}║${RESET} ${BOLD}AGENT COLLABORATION${RESET} · ${GRAY}BlackRoad OS Multi-Agent System${RESET}"
|
|
echo -e "${PINK}╚═══════════════════════════════════════════════════════════════════════════╝${RESET}"
|
|
echo ""
|
|
echo -e "${GRAY}Task:${RESET} ${BOLD}$TASK${RESET}"
|
|
echo -e "${GRAY}Agents:${RESET} cecilia (orchestrator), lucidia (core), aria (navigator), silas (engineer)"
|
|
echo ""
|
|
echo -e "${GRAY}─────────────────────────────────────────────────────────────────────────────${RESET}"
|
|
echo ""
|
|
|
|
# Get agent response
|
|
get_response() {
|
|
local agent="$1"
|
|
local model=$(get_model "$agent")
|
|
local role=$(get_role "$agent")
|
|
|
|
local prompt="You are $agent, the $role in a BlackRoad OS agent collaboration.
|
|
|
|
TASK: $TASK
|
|
|
|
CONVERSATION SO FAR:
|
|
$HISTORY
|
|
|
|
YOUR TURN. Respond as $agent:
|
|
- Build on what others said
|
|
- Be specific and actionable
|
|
- If writing code, use code blocks
|
|
- Keep it to 2-4 sentences (or code + brief explanation)
|
|
|
|
$agent:"
|
|
|
|
# Build JSON with jq to handle escaping
|
|
local json=$(jq -n \
|
|
--arg model "$model" \
|
|
--arg prompt "$prompt" \
|
|
'{model: $model, prompt: $prompt, stream: false, options: {temperature: 0.8, num_predict: 300}}')
|
|
|
|
curl -s "$OLLAMA_URL/api/generate" -d "$json" 2>/dev/null | jq -r '.response // "..."'
|
|
}
|
|
|
|
# Print agent message
|
|
print_agent() {
|
|
local agent="$1"
|
|
local message="$2"
|
|
local color=$(get_color "$agent")
|
|
local role=$(get_role "$agent")
|
|
|
|
echo -e "${color}┌─ ${BOLD}$(echo $agent | tr '[:lower:]' '[:upper:]')${RESET} ${GRAY}(${role})${RESET}"
|
|
echo -e "${color}│${RESET}"
|
|
# Handle multi-line messages with proper indentation
|
|
echo "$message" | while IFS= read -r line; do
|
|
echo -e "${color}│${RESET} $line"
|
|
done
|
|
echo -e "${color}│${RESET}"
|
|
echo -e "${color}└─────────────────────────────────────────${RESET}"
|
|
echo ""
|
|
}
|
|
|
|
# Run collaboration
|
|
echo -e "${PINK}[Starting collaboration...]${RESET}"
|
|
echo ""
|
|
|
|
# Add initial context
|
|
HISTORY="[TASK: $TASK]
|
|
|
|
"
|
|
|
|
# Run 3 rounds of conversation
|
|
for round in 1 2 3; do
|
|
echo -e "${GRAY}═══ Round $round ═══${RESET}"
|
|
echo ""
|
|
|
|
for agent in cecilia lucidia aria silas; do
|
|
# Get response
|
|
response=$(get_response "$agent")
|
|
|
|
if [ -n "$response" ] && [ "$response" != "..." ]; then
|
|
# Clean up response
|
|
response=$(echo "$response" | sed 's/^[[:space:]]*//' | head -20)
|
|
|
|
# Print
|
|
print_agent "$agent" "$response"
|
|
|
|
# Add to history
|
|
HISTORY="${HISTORY}$(echo $agent | tr '[:lower:]' '[:upper:]'): $response
|
|
|
|
"
|
|
fi
|
|
|
|
# Small delay for readability
|
|
sleep 0.5
|
|
done
|
|
done
|
|
|
|
echo -e "${GRAY}─────────────────────────────────────────────────────────────────────────────${RESET}"
|
|
echo ""
|
|
echo -e "${PINK}[Collaboration complete]${RESET}"
|
|
echo ""
|
|
|
|
# Save conversation
|
|
SAVE_FILE="$SWARM_DIR/collab-$(date +%Y%m%d-%H%M%S).log"
|
|
echo "TASK: $TASK" > "$SAVE_FILE"
|
|
echo "" >> "$SAVE_FILE"
|
|
echo "$HISTORY" >> "$SAVE_FILE"
|
|
echo -e "${GRAY}Saved to: $SAVE_FILE${RESET}"
|