operator pronouns: configurable free-text, threaded into prompts
new NixOS module option services.hive-c0re.operatorPronouns
(free text, default 'she/her', example 'they/them'). hive-c0re
takes it as a CLI flag (--operator-pronouns, lib.escapeShellArg'd
in the systemd unit), stores it on Coordinator, threads it into
the meta flake's mkAgent so each agent's systemd service gets
HIVE_OPERATOR_PRONOUNS set. the harness reads the env at boot
and substitutes {operator_pronouns} into the agent / manager
system prompt alongside {label}. nix string is escaped against
backslash + double-quote so non-ascii / quoted values
round-trip safely. prompt addendum: both agent.md and
manager.md mention the operator's pronouns up front so claude
uses them naturally in third-person reference. propagates on
next ↻ R3BU1LD (meta lock bump, no per-agent approval).
This commit is contained in:
parent
5208b0112a
commit
50ef806266
12 changed files with 90 additions and 13 deletions
|
|
@ -53,12 +53,13 @@ pub fn meta_dir() -> PathBuf {
|
|||
pub async fn sync_agents(
|
||||
hyperhive_flake: &str,
|
||||
dashboard_port: u16,
|
||||
operator_pronouns: &str,
|
||||
agents: &[AgentSpec],
|
||||
) -> Result<()> {
|
||||
let dir = meta_dir();
|
||||
std::fs::create_dir_all(&dir).with_context(|| format!("create {}", dir.display()))?;
|
||||
|
||||
let new_flake = render_flake(hyperhive_flake, dashboard_port, agents);
|
||||
let new_flake = render_flake(hyperhive_flake, dashboard_port, operator_pronouns, agents);
|
||||
let flake_path = dir.join("flake.nix");
|
||||
let on_disk = std::fs::read_to_string(&flake_path).unwrap_or_default();
|
||||
let initial = !dir.join(".git").exists();
|
||||
|
|
@ -180,7 +181,12 @@ pub async fn lock_update_hyperhive() -> Result<()> {
|
|||
git_commit(&dir, "bump hyperhive").await
|
||||
}
|
||||
|
||||
fn render_flake(hyperhive_flake: &str, dashboard_port: u16, agents: &[AgentSpec]) -> String {
|
||||
fn render_flake(
|
||||
hyperhive_flake: &str,
|
||||
dashboard_port: u16,
|
||||
operator_pronouns: &str,
|
||||
agents: &[AgentSpec],
|
||||
) -> String {
|
||||
use std::fmt::Write as _;
|
||||
let mut out = String::new();
|
||||
out.push_str("{\n description = \"hyperhive deployed agents\";\n inputs = {\n");
|
||||
|
|
@ -193,9 +199,15 @@ fn render_flake(hyperhive_flake: &str, dashboard_port: u16, agents: &[AgentSpec]
|
|||
);
|
||||
}
|
||||
out.push_str(" };\n outputs =\n { self, hyperhive, ... }@inputs:\n let\n");
|
||||
// Free-text operator string — escape backslash + double-quote so a
|
||||
// pronouns value like `he/him \ "rare"` round-trips into a valid
|
||||
// nix string literal without breaking the flake.
|
||||
let pronouns_escaped = operator_pronouns
|
||||
.replace('\\', "\\\\")
|
||||
.replace('"', "\\\"");
|
||||
let _ = writeln!(
|
||||
out,
|
||||
" dashboardPort = {dashboard_port};\n mkAgent = {{ name, isManager, port }}:"
|
||||
" dashboardPort = {dashboard_port};\n operatorPronouns = \"{pronouns_escaped}\";\n mkAgent = {{ name, isManager, port }}:"
|
||||
);
|
||||
out.push_str(
|
||||
r#" let
|
||||
|
|
@ -217,6 +229,7 @@ fn render_flake(hyperhive_flake: &str, dashboard_port: u16, agents: &[AgentSpec]
|
|||
HIVE_PORT = toString port;
|
||||
HIVE_LABEL = name;
|
||||
HIVE_DASHBOARD_PORT = toString dashboardPort;
|
||||
HIVE_OPERATOR_PRONOUNS = operatorPronouns;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue