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

@ -931,6 +931,42 @@ def cmd_set_automation(args):
})
_print_feedback(result)
# ---------------------------------------------------------------------------
# Printing Pod
# ---------------------------------------------------------------------------
def cmd_printing_pod(args):
"""Check Printing Pod status. Usage: printing_pod"""
data = api_get('/api/state/printing_pod')
if 'error' in data:
print(f"Error: {data['error']}")
return
if data.get('isReady'):
print("=== Printing Pod: READY ===")
print(f" Options available:")
for opt in data.get('options', []):
print(f" [{opt.get('index')}] {opt.get('description', '?')} ({opt.get('type', '?')})")
print()
print(" Select with: python3 tools/oni_api.py printing_pod_select <0|1|2>")
else:
cycles = data.get('cyclesUntilNext', 0)
if cycles > 0:
print(f"Printing Pod: not ready ({cycles:.1f} cycles remaining)")
else:
print("Printing Pod: checking...")
def cmd_printing_pod_select(args):
"""Select a Printing Pod option. Usage: printing_pod_select <0|1|2>"""
if not args:
print("Usage: printing_pod_select <0|1|2>")
return
index = int(args[0])
if index < 0 or index > 2:
print("Index must be 0, 1, or 2")
return
result = api_post('/api/action/printing_pod_select', {"index": index})
_print_feedback(result)
# ---------------------------------------------------------------------------
# Screenshot / Camera
# ---------------------------------------------------------------------------
@ -1105,6 +1141,8 @@ COMMANDS = {
'building_detail': cmd_building_detail,
'set_building_priority': cmd_set_building_priority,
'set_automation': cmd_set_automation,
'printing_pod': cmd_printing_pod,
'printing_pod_select': cmd_printing_pod_select,
}
if __name__ == '__main__':
@ -1133,9 +1171,10 @@ if __name__ == '__main__':
print(" gas <x> <y> [r] Gas analysis in radius r")
print(" explore <x> <y> <w> <h> AI-friendly region summary")
print("")
print("=== Event / Queue ===")
print("=== Events / Printing Pod ===")
print(" events [since] [limit] Poll new game events")
print(" queue [batch_id] View pending task queue")
print(" printing_pod Check Printing Pod status (ready/options)")
print(" printing_pod_select <0|1|2> Select Printing Pod option")
print("")
print("=== Registries (AI Reference) ===")
print(" registry buildings [f] List all building IDs with metadata")