feat: printing pod API + research completion events

Printing Pod:
- GET /api/state/printing_pod: check if ready, options available, cycles remaining
- POST /api/action/printing_pod_select {index}: select option 0/1/2

Research completion tracking:
- Automatic detection of newly completed techs on each state poll
- Events pushed to stream: 'research_complete' with unlocked buildings list
- Events pushed when Printing Pod becomes ready

Event daemon enhanced:
- Classifies 'research complete' events with actionable next steps
- Classifies 'printing pod' events with option viewing instructions

CLI: printing_pod, printing_pod_select <0|1|2>
This commit is contained in:
root
2026-05-22 09:41:00 +08:00
parent bf24e95240
commit 1608357040
3 changed files with 217 additions and 2 deletions

View File

@ -126,6 +126,10 @@ def classify_event(e):
return 'warning'
if any(w in combined for w in ['duplicant', 'stress', 'break']):
return 'warning'
if any(w in combined for w in ['research complete', 'research completed']):
return 'info_research'
if any(w in combined for w in ['printing pod']):
return 'info_printing_pod'
return 'info'
@ -198,6 +202,20 @@ def poll_loop(event_history):
elif cls == 'warning':
print(format_event_for_ai(e))
print()
elif cls == 'info_research':
# Research completed — show with unlocks
print("=" * 40)
print(format_event_for_ai(e))
print(" -> Check what's new: python3 tools/oni_api.py buildable")
print("=" * 40)
print()
elif cls == 'info_printing_pod':
# Printing pod ready
print("=" * 40)
print(format_event_for_ai(e))
print(" -> View options: python3 tools/oni_api.py printing_pod")
print("=" * 40)
print()
else:
# Only print non-info events or batch feedback
cat = e.get('category', '')