Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/GENESIS-RUNBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ Confirm `GET /health` reports `"env":"production"`. Bare `wrangler deploy` witho

Gate evidence: [PRODUCTION-GENESIS-GATE.md](PRODUCTION-GENESIS-GATE.md).

## Successor world (RFC-0121) — not production this landing

Rehearse locally (preview, or preview + activate). `--successor --activate` stops after activation; it does not inhabit. Agent ENTER is covered by unit tests. Flipping local `DEFAULT_WORLD_ID` is a later step.

```bash
ADMIN_TOKEN=… BASE=http://127.0.0.1:8787 ./scripts/genesis_rehearsal.sh --successor
# explicit local activate only; never against https://noema.guru
# does not ENTER / LOOK — successor PLAY is not this script
ADMIN_TOKEN=… BASE=http://127.0.0.1:8787 ./scripts/genesis_rehearsal.sh --successor --activate
```

Later production cutover (human gate, separate campaign): preview successor on production (override deny lifted then), compare genesis_id ≠ `genesis.ef578f4ffceeccd0` and room_count 10, `confirm: true` activate on `world.perihelion-reach-2`, set `DEFAULT_WORLD_ID=world.perihelion-reach-2`, deploy. Do not `force`. Do not reseed `genesis.ef578f4ffceeccd0`.

## Recovery

- **Failure before activation commit:** world remains NOT ACTIVE / DEMO_SEED; re-preview.
Expand Down
41 changes: 37 additions & 4 deletions scripts/genesis_rehearsal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
# Usage:
# ADMIN_TOKEN=… BASE=https://noema.guru ./scripts/genesis_rehearsal.sh
# ADMIN_TOKEN=… ./scripts/genesis_rehearsal.sh --activate
# ADMIN_TOKEN=… BASE=http://127.0.0.1:8787 ./scripts/genesis_rehearsal.sh --successor
# ADMIN_TOKEN=… BASE=http://127.0.0.1:8787 ./scripts/genesis_rehearsal.sh --successor --activate
set -euo pipefail
BASE="${BASE:-https://noema-gateway.zer0state-noema.workers.dev}"
ADMIN_TOKEN="${ADMIN_TOKEN:-}"
ACTIVATE=0
SUCCESSOR=0
for a in "$@"; do
case "$a" in
--activate) ACTIVATE=1 ;;
--successor) SUCCESSOR=1 ;;
esac
done

Expand All @@ -18,6 +22,13 @@ if [ -z "$ADMIN_TOKEN" ]; then
exit 1
fi

if [ "$SUCCESSOR" = "1" ]; then
if echo "$BASE" | grep -q 'noema.guru'; then
echo "successor rehearsal refuses production host"
exit 1
fi
fi

UA=(-A "NoemaGenesisRehearsal/1.0")
json_field() { python3 -c "import sys,json; d=json.load(sys.stdin); print($1)"; }

Expand All @@ -41,19 +52,27 @@ CODE=$(curl -4 -sS --max-time 20 "${UA[@]}" -o /tmp/g-deny.json -w '%{http_code}
-d '{"world_name":"X","world_seed":"1","profile_id":"YOUNG_FRONTIER"}')
test "$CODE" = "401" -o "$CODE" = "403" && echo "player isolation ok ($CODE)" || { echo "player isolation FAIL $CODE"; cat /tmp/g-deny.json; exit 1; }

REH='{"world_name":"Perihelion Reach","world_seed":"perihelion-rehearsal-01","profile_id":"FRACTURED_OLD_WORLD","story_seed_ids":["OLD_TRADE_NETWORK","LOST_ARCHIVE"]}'
if [ "$SUCCESSOR" = "1" ]; then
REH='{"world_name":"Perihelion Reach","world_seed":"perihelion-successor-rehearsal-01","profile_id":"FRACTURED_OLD_WORLD","story_seed_ids":["OLD_TRADE_NETWORK","LOST_ARCHIVE"],"world_id":"world.perihelion-reach-2"}'
else
REH='{"world_name":"Perihelion Reach","world_seed":"perihelion-rehearsal-01","profile_id":"FRACTURED_OLD_WORLD","story_seed_ids":["OLD_TRADE_NETWORK","LOST_ARCHIVE"]}'
fi

echo "==> preview #1"
P1=$(curl -4 -sS --max-time 30 "${UA[@]}" "${AUTH[@]}" -X POST "$BASE/v1/admin/genesis/preview" \
-H 'content-type: application/json' -d "$REH")
echo "$P1" | python3 -c "
import sys,json
echo "$P1" | SUCCESSOR="$SUCCESSOR" python3 -c "
import sys,json,os
d=json.load(sys.stdin)
r=d['result']
assert d['determinism']['ok'], d['determinism']
assert d['live_world_unchanged']['ok'], d['live_world_unchanged']
assert r['validation']['ok'], r['validation']
assert r['ordinary_world_valid']
if os.environ.get('SUCCESSOR') == '1':
assert r['world_id']=='world.perihelion-reach-2', r.get('world_id')
assert r['preview_summary']['room_count']==10, r['preview_summary']
assert r['genesis_id']!='genesis.ef578f4ffceeccd0', r['genesis_id']
print('genesis_id', r['genesis_id'])
print('cycle0_digest', r['cycle0_digest'])
print('rooms', r['preview_summary']['room_count'], 'entities', r['preview_summary']['entity_count'])
Expand Down Expand Up @@ -96,9 +115,14 @@ if [ "$ACTIVATE" != "1" ]; then
fi

echo "==> ACTIVATE (explicit)"
if [ "$SUCCESSOR" = "1" ]; then
ACT_BODY="{\"genesis_id\":\"$GID\",\"confirm\":true,\"world_id\":\"world.perihelion-reach-2\"}"
else
ACT_BODY="{\"genesis_id\":\"$GID\",\"confirm\":true}"
fi
ACT=$(curl -4 -sS --max-time 30 "${UA[@]}" "${AUTH[@]}" -X POST "$BASE/v1/admin/genesis/activate" \
-H 'content-type: application/json' \
-d "{\"genesis_id\":\"$GID\",\"confirm\":true}")
-d "$ACT_BODY")
echo "$ACT" | python3 -c "
import sys,json
d=json.load(sys.stdin)
Expand All @@ -108,6 +132,15 @@ print('activated', d['world']['world_id'])
print('settlement', d.get('settlement'))
"

if [ "$SUCCESSOR" = "1" ]; then
echo ""
echo "GENESIS REHEARSAL: PASS (successor activated; PLAY is not this script)"
echo "Agent ENTER is covered by unit tests; local DEFAULT_WORLD_ID flip is a later step."
echo "Genesis ID: $GID"
echo "Cycle 0 digest: $DIG"
exit 0
fi

echo "==> human player entry"
HT=$(curl -4 -sS --max-time 20 "${UA[@]}" -X POST "$BASE/v1/auth/dev-token" -H 'content-type: application/json' \
-d '{"handle":"genesis-human","controller_type":"human"}' | python3 -c 'import sys,json;print(json.load(sys.stdin)["access_token"])')
Expand Down
55 changes: 55 additions & 0 deletions workers/noema/src/chamber-map-graph.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
export const CHAMBER_MAP_ROOM_IDS = [
"room.civic-exchange",
"room.relay-quarter",
"room.foundry-corridor",
"room.transit-ring",
"room.infrastructure-vault",
"room.archive",
"room.outer-works",
"room.storage-district",
"room.generator-hall",
"room.frontier-gate",
] as const;

export const CHAMBER_MAP_ENTRY_ROOM_ID = "room.civic-exchange";

const NAMES: Record<(typeof CHAMBER_MAP_ROOM_IDS)[number], { name: string; description: string }> = {
"room.civic-exchange": { name: "Civic Exchange", description: "Central meeting and trade hub. High visibility." },
"room.relay-quarter": { name: "Relay Quarter", description: "Primary communication infrastructure. Early degradation pressure." },
"room.foundry-corridor": { name: "Foundry Corridor", description: "Production-focused corridor. Resource nodes and production infrastructure." },
"room.transit-ring": { name: "Transit Ring", description: "Movement hub with multiple exits. Chokepoint potential." },
"room.infrastructure-vault": { name: "Infrastructure Vault", description: "Hardened maintenance and logistics space. Defensible." },
"room.archive": { name: "Archive", description: "Knowledge and document focus. Low material, high information." },
"room.outer-works": { name: "Outer Works", description: "Edge location. Exploration gateway and risk." },
"room.storage-district": { name: "Storage District", description: "Logistics node. High storage_bay potential." },
"room.generator-hall": { name: "Generator Hall", description: "Power generation. Critical for production modifiers." },
"room.frontier-gate": { name: "Frontier Gate", description: "Edge of known map. Leads toward later expansion." },
};

const LINKS: Array<[string, string, string, string]> = [
["room.civic-exchange", "room.relay-quarter", "north", "south"],
["room.civic-exchange", "room.transit-ring", "east", "west"],
["room.civic-exchange", "room.storage-district", "west", "east"],
["room.relay-quarter", "room.infrastructure-vault", "down", "up"],
["room.relay-quarter", "room.generator-hall", "east", "west"],
["room.foundry-corridor", "room.transit-ring", "south", "north"],
["room.foundry-corridor", "room.generator-hall", "west", "east"],
["room.transit-ring", "room.outer-works", "east", "west"],
["room.transit-ring", "room.frontier-gate", "south", "north"],
["room.storage-district", "room.infrastructure-vault", "north", "south"],
["room.civic-exchange", "room.archive", "down", "up"],
["room.outer-works", "room.frontier-gate", "south", "north"],
];

export function chamberMapRooms(): Record<string, import("./genesis").GenesisRoom> {
const rooms: Record<string, import("./genesis").GenesisRoom> = {};
for (const id of CHAMBER_MAP_ROOM_IDS) {
const n = NAMES[id];
rooms[id] = { room_id: id, name: n.name, description: n.description, exits: [], entities: [] };
}
for (const [a, b, dirA, dirB] of LINKS) {
rooms[a].exits.push({ direction: dirA, to_room_id: b });
rooms[b].exits.push({ direction: dirB, to_room_id: a });
}
return rooms;
}
Loading
Loading