diff --git a/docs/config.md b/docs/config.md index 15b45af..da5aeed 100644 --- a/docs/config.md +++ b/docs/config.md @@ -117,7 +117,7 @@ | `HIVE_URL` | str | `""` | Hive registry address (e.g. `http://192.168.1.168:8087`). Empty = standalone navi, no announcements. | | `ANNOUNCE_INTERVAL_SEC` | int | `120` | How often this navi re-announces itself to the hive. | | `SWARM_KEY_FILE` | str | `.swarm-key` | Shared PSK file (gitignored, 0600, generated by `deploy/install.sh`). | -| `INSTANCE_FILE` | str | `instance.json` | This navi's identity for the swarm: generated name (two female names from Japanese/American/Spanish pools) + instance id. Rename = edit the file, restart. | +| `INSTANCE_FILE` | str | `instance.json` | This navi's identity for the swarm: generated name (single female name from Japanese/American/Spanish pools) + instance id. Rename = edit the file, restart. | | `PEER_ASK_PROFILE` | str | `server_admin` | Which profile answers incoming `/peer/ask` questions (one-shot agent run). | | `PEER_ASK_TIMEOUT_SEC` | int | `120` | Hard ceiling for a single peer ask — the LLM turn inside `/peer/ask`. | diff --git a/navi/identity.py b/navi/identity.py index bc38b48..cb72ee5 100644 --- a/navi/identity.py +++ b/navi/identity.py @@ -1,11 +1,11 @@ """Instance identity — a stable, human-friendly name for this Navi install. Every deployed Navi carries ``instance.json`` in its working directory -(gitignored): ``{"name": "yuki-grace", "instance_id": "", "created_at": "..."}``. -The name is generated once (two female names from different cultures — -Japanese, American, Spanish; readable, speakable, collision-free at swarm -scale: 50×50×3 picks) and is meant to be renamed by hand if the owner wants. -The instance_id is the technical identity for audit and peer pinning. +(gitignored): ``{"name": "yuki", "instance_id": "", "created_at": "..."}``. +The name is generated once — a single female name from the Japanese, +American or Spanish pool (~150 in total; collisions across a swarm are +possible, rename by hand when they happen). The instance_id is the technical +identity for audit and peer pinning. Rename = edit the file, restart the server. Nothing else reads the name as long-lived state, so this is safe. @@ -50,7 +50,7 @@ "vanesa", ] -_NAME_POOLS = [_JAPANESE, _AMERICAN, _SPANISH] +_NAME_POOLS = [_JAPANESE, _AMERICAN, _SPANISH] # union = the name pool IDENTITY_FILE = "instance.json" @@ -63,16 +63,14 @@ def generate_name() -> str: - """Two female names from different cultures, e.g. ``yuki-grace``. + """A single female name from any culture pool, e.g. ``yuki`` or ``sofia``. - Single names would collide across a swarm (the peer channel addresses - machines by name); a mixed pair gives 7500×2 ordered combinations while - still reading as a pretty hyphenated female name. + Collisions across a swarm are possible (~150 names) — the owner renames + by hand (edit instance.json) when two machines draw the same name. """ import secrets - pools = secrets.SystemRandom().sample(_NAME_POOLS, 2) - return f"{secrets.choice(pools[0])}-{secrets.choice(pools[1])}" + return secrets.choice(_JAPANESE + _AMERICAN + _SPANISH) def load_identity(path: str | Path = IDENTITY_FILE) -> InstanceIdentity: diff --git a/navi/tools/peer.py b/navi/tools/peer.py index 5b1c7df..0d838d0 100644 --- a/navi/tools/peer.py +++ b/navi/tools/peer.py @@ -60,7 +60,7 @@ "· ask — ask a peer a question; its agent investigates " "on ITS machine and returns a text answer. Use for anything this peer " "can check better than you: its services, files, hardware, local state.\n\n" - "Address the peer by its swarm name (e.g. 'yuki-grace'). " + "Address the peer by its swarm name (e.g. 'yuki'). " "Answers can take up to a couple of minutes - the peer runs a real agent " "turn. Do not ask peers about this machine's state; check it locally." ) @@ -74,7 +74,7 @@ }, "peer": { "type": "string", - "description": "Peer's swarm name (for ask/status), e.g. 'amber-falcon'", + "description": "Peer's swarm name (for ask/status), e.g. 'sofia'", }, "question": { "type": "string", diff --git a/tests/unit/test_identity.py b/tests/unit/test_identity.py index 9072c7f..d3e64e9 100644 --- a/tests/unit/test_identity.py +++ b/tests/unit/test_identity.py @@ -35,13 +35,11 @@ } -def test_generated_name_is_two_female_names(): +def test_generated_name_is_a_single_female_name(): for _ in range(50): name = generate_name() - first, second = name.split("-") - assert first in _ALL_NAMES - assert second in _ALL_NAMES - assert first != second + assert name in _ALL_NAMES + assert "-" not in name def test_generated_names_vary():