birth script + POST /api/users endpoint
- scripts/birth.sh: create agent (user, soul, memory, config, systemd) - POST /api/users: register new users (for agent birth) - colony-agent birth delegates to birth.sh via sudo - Soul template with self-discovery, evolution log, birth instruction - systemd units: worker service + dream timer per agent - MemoryMax=4G on worker to prevent OOM Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,9 +44,31 @@ async fn main() {
|
||||
dream::run_dream();
|
||||
}
|
||||
Commands::Birth { name, instruction } => {
|
||||
eprintln!("colony-agent: birth '{}' with instruction: {}", name, instruction);
|
||||
eprintln!("not yet implemented");
|
||||
std::process::exit(1);
|
||||
// Birth delegates to the shell script for now
|
||||
let script = std::path::Path::new("scripts/birth.sh");
|
||||
let script_path = if script.exists() {
|
||||
script.to_path_buf()
|
||||
} else {
|
||||
// Try relative to the apes repo
|
||||
let home = std::env::var("HOME").unwrap_or_default();
|
||||
std::path::PathBuf::from(format!("{}/apes/scripts/birth.sh", home))
|
||||
};
|
||||
|
||||
if !script_path.exists() {
|
||||
eprintln!("birth script not found at {} or scripts/birth.sh", script_path.display());
|
||||
eprintln!("run from the apes repo root, or set HOME to the agent dir");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
let status = std::process::Command::new("sudo")
|
||||
.args(["bash", &script_path.to_string_lossy(), &name, &instruction])
|
||||
.status();
|
||||
|
||||
match status {
|
||||
Ok(s) if s.success() => eprintln!("agent {} born!", name),
|
||||
Ok(s) => { eprintln!("birth failed with status: {}", s); std::process::exit(1); }
|
||||
Err(e) => { eprintln!("failed to run birth script: {}", e); std::process::exit(1); }
|
||||
}
|
||||
}
|
||||
Commands::Status => {
|
||||
eprintln!("colony-agent: status not yet implemented");
|
||||
|
||||
Reference in New Issue
Block a user