54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Bond-Initialisierung fuer Natiris"""
|
|
|
|
import json
|
|
import os
|
|
from datetime import datetime
|
|
|
|
CORE_STATE_PATH = os.path.expanduser("~/natiris/core/core_state.json")
|
|
FULL_STATE_PATH = os.path.expanduser("~/natiris/core/natiris_full_state.json")
|
|
CONFIG_PATH = os.path.expanduser("~/natiris/config/character_genesis.json")
|
|
|
|
def load_json(path):
|
|
try:
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
return json.load(f)
|
|
except (FileNotFoundError, json.JSONDecodeError):
|
|
return {}
|
|
|
|
def save_json(path, data):
|
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
with open(path, "w", encoding="utf-8") as f:
|
|
json.dump(data, f, indent=2)
|
|
|
|
def main():
|
|
now = datetime.utcnow().isoformat() + "+00:00"
|
|
|
|
# Core state initialisieren
|
|
core_state = {
|
|
"bonded_to": "user_primary",
|
|
"bond_started_at": now,
|
|
"loneliness": 2,
|
|
"mood": 7.0,
|
|
"anxiety": 1,
|
|
"event_history": [{"event": "bond_init", "timestamp": now, "user": "user_primary"}]
|
|
}
|
|
save_json(CORE_STATE_PATH, core_state)
|
|
|
|
# Full state aktualisieren
|
|
full_state = load_json(FULL_STATE_PATH)
|
|
full_state["modules"]["core_state"] = core_state
|
|
full_state["modules"]["Bond"]["bonded_to"] = "user_primary"
|
|
full_state["modules"]["Bond"]["bond_started_at"] = now
|
|
full_state["modules"]["Bond"]["exclusivity_active"] = True
|
|
full_state["modules"]["InnerLife"]["bond_context"] = "exklusiv, user_primary"
|
|
full_state["modules"]["InnerLife"]["timestamp"] = now
|
|
save_json(FULL_STATE_PATH, full_state)
|
|
|
|
print("✅ Bond initialisiert:")
|
|
print(f" bonded_to: user_primary")
|
|
print(f" bond_started_at: {now}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|