27 Commits

Author SHA1 Message Date
4d2cffd2f1 cleanup: remove ONIModTutorial (unrelated), merge skills/oni_agent.md into SKILL.md, move event_daemon.py to tools/ 2026-05-30 16:08:07 +08:00
280879c4b0 fix: sync docs with source code — battery capacity (10kJ), material category (RawMineral), missing CLI commands, expanded skill reference 2026-05-30 15:53:38 +08:00
21423a6bb4 Update all docs: README, AI_KNOWLEDGE_BASE, MOD_DEV_GUIDE, batch_example, SKILL 2026-05-30 12:51:05 +08:00
3d70338087 v2.1.0 Complete rewrite: proper Mod API, Python toolchain, auto-camera, comprehensive SKILL 2026-05-30 11:58:45 +08:00
89c6707aa8 Merge remote, use our version 2026-05-30 11:01:08 +08:00
1f25d3d879 ONI Agent Bridge - initial mod implementation 2026-05-30 11:00:36 +08:00
9683b76e61 docs: annotate 67 uncertain API calls with verification markers
Added // 🔶 UNVERIFIED comments to all API calls that need in-game testing:
- SpeedControlScreen (Pause/Unpause/SetSpeed signatures)
- CircuitManager (GetCircuits, property names)
- ConduitFlow (GetContents, property names)
- PrintingPod (IsReady, GetCurrentOffers, SelectOffer)
- Door (Lock/Unlock)
- Operational (SetFlag)
- Storage (DropAll)
- CameraController (Instance, position, zoom)
- ScreenCapture (CaptureScreenshot)
- SaveLoader (Save/Load/GetActiveSaveFilePath)
- Research (QueueResearch, CancelResearch, GetActiveResearchTechnologies)
- OverlayManager (currentOverlay)
- Grid.Germs
- Sensor components (threshold property)
- BuildingDefs collection
- Nullable serialization

Build script + annotate_apis.py included for verification workflow.
2026-05-22 15:45:29 +08:00
bff8aea846 build: fix csproj (remove NuGet deps, add 0Harmony ref) + improved build script
csproj: removed Lib.Harmony and System.Text.Json NuGet packages (game bundles these),
added 0Harmony.dll reference from game directory, LangVersion=latest
build_mod.sh: auto-detect Managed/ subdirectory, support Linux/macOS/Windows paths,
better error messages, install instructions

C# code verification: 0 syntax errors, 8 missing-reference-only errors (expected)
2026-05-22 10:45:40 +08:00
64e57b2c44 build: C# 6 compatible port + build script + csproj
- Convert all C# 7/8 features to C# 6 for mono mcs compatibility:
  - Tuple switch → if-else chain
  - Switch expressions → if-else blocks
  - Expression-bodied switch → regular switch statement
- Verified compilation succeeds (only missing game DLL refs)
- Added mod/ONIAgentBridge.csproj for dotnet SDK builds
- Added scripts/build_mod.sh for mono-based builds
  - Auto-detects ONI installation path
  - References required game DLLs
  - Outputs to mod/bin/
2026-05-22 10:39:17 +08:00
6a71d42f78 docs: add AI skill guide with comprehensive API purpose documentation
- README.md: add summary paragraph covering 92 endpoints, screenshot/camera,
  event daemon, Mod+Python+AI architecture
- skills/oni_agent.md: complete rewrite from 42 to 480 lines:
  - Gameplay overview (survival priorities, world rules)
  - All 92 API endpoints organized in 12 categories
  - Each command annotated with: what player action it maps to,
    what AI uses it for, example output
  - Coordinate positioning methods (4 strategies)
  - Common scenario query paths (suffocating, power, research, pipes)
  - Quick reference for emergency operations
2026-05-22 10:02:25 +08:00
48dd1075ed feat: 11 more API endpoints for full UI coverage
New endpoints (total now 65+):
- clear: clear debris/POI (bottom toolbar button)
- rotate: rotate building during placement
- copy_settings: copy building config to another building
- overlay: switch overlay view (power/temp/gas/liquid/automation/rooms/decor/light/germs/materials/suits/crops/radiation/priority)
- dupe_personal_priority: set per-duplicate task priority sliders
- battery_charge: set smart battery high/low charge limits
- valve_flow: set liquid/gas valve flow rate
- vent_pressure: set vent overpressure limit
- incubator_setting: set incubator egg priority
- fridge_temp: set refrigerator temperature
- GET /api/state/overlay: current overlay + available overlays list

CLI: clear, rotate, copy_settings, overlay, dupe_personal_priority,
battery_charge, valve_flow, vent_pressure, incubator_setting, fridge_temp
2026-05-22 09:53:50 +08:00
aa0519c1ed feat: comprehensive API coverage — dupe move/cancel, critter wrangle, plant uproot, storage filter, door open, sensors, sweep, disinfect
New state endpoints:
- GET /api/state/sensors: list all automation sensors with thresholds

New action endpoints (10 total):
- dupe_move: move duplicant to coordinates
- dupe_cancel_task: cancel a dupe's current chore
- critter_wrangle: catch and relocate a critter
- plant_uproot: dig up a plant
- storage_filter: set what a storage bin accepts
- door_open: manually open/close a door
- sensor_threshold: set automation sensor value
- sweep: mark resources for sweeping pickup
- disinfect: disinfect a cell/building

CLI: dupe_move, dupe_cancel_task, critter_wrangle, plant_uproot,
storage_filter, door_open, sensors, sensor_threshold, sweep, disinfect

Total API endpoints: 50+ covering all ONI player interactions
2026-05-22 09:50:23 +08:00
bbde9acadd feat: atmo suits, door lock/one-way, critter attack APIs
Atmo Suits:
- GET /api/state/atmo_suits: check suit docks, suit presence, O2 levels

Door Control:
- POST /api/action/door_lock {x, y, locked}: lock/unlock doors
- POST /api/action/door_one_way {x, y, direction}: set one-way passage

Critter Control:
- POST /api/action/critter_attack {x, y}: toggle attack on critter

CLI: atmo_suits, door_lock, door_one_way, critter_attack
2026-05-22 09:43:02 +08:00
1608357040 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>
2026-05-22 09:41:00 +08:00
bf24e95240 feat: comprehensive research + building detail APIs
Research system:
- GET /api/state/research/detail: station status, active tech, research points
- POST /api/action/research_cancel [techId]: cancel specific or all active research
- Improved research queueing with proper prerequisite checks

Building detail/interaction:
- GET /api/state/building_detail?x=&y=: full single-building detail
  (health, automation, storage contents, materials, power, recipes)
- POST /api/action/set_building_priority: set priority 1-9 per building
- POST /api/action/set_automation: enable/disable automation input
- Enhanced building list with health/damage info

CLI: research_detail, research_cancel, building_detail,
set_building_priority, set_automation
2026-05-22 09:36:51 +08:00
7a946aa555 feat: buildable list, building interaction API (toggle/set_recipe/empty/cancel)
New endpoints:
- GET /api/state/buildable: buildings filtered by completed research (unlocked/locked)
- POST /api/action/toggle: toggle building on/off (save power, control workflow)
- POST /api/action/set_recipe: set building recipe (e.g. Rock Crusher mode)
- POST /api/action/empty: empty building storage (drop all contents)
- POST /api/action/cancel_errand: cancel all errands at a building

Improved research: proper prerequisite validation, tech queueing, research station check

CLI: buildable [filter], toggle, set_recipe, empty, cancel_errand
Updated SKILL.md with new endpoint docs
2026-05-22 09:32:49 +08:00
80485d2a5a feat: auto-pause on data fetch + iron rules update
- All api_get/api_post calls now auto-pause game before executing
- AUTO_PAUSE_ENABLED flag to disable for event daemon polling
- Event daemon explicitly disables auto-pause (frequent light polling)
- Iron rules updated:
  Rule 1: AI must pause BEFORE any reasoning/decision
  Rule 2: Tools auto-pause on state data fetch
  Rule 3: AI must pause before asking user questions
  Rule 4: AI must ensure paused when exiting response state
  Rule 5: Save before major operations
2026-05-22 09:28:06 +08:00
f8a89a375b docs: add 4 iron rules for AI game safety protocol
- Rule 1: Pause before asking user questions
- Rule 2: Pause when exiting response state (game must not run unattended)
- Rule 3: Pause before every write operation
- Rule 4: Save before major operations, load for rollback
2026-05-22 09:25:54 +08:00
e07280db4e docs: unified AI operating protocol with complete playbook
Complete rewrite of SKILL.md with a comprehensive AI operating protocol:
- Core Operating Loop: 5-step cycle (context → plan → protect → execute → verify)
- Standard Operating Procedure (SOP): 0-6 step-by-step for every operation
- Decision Framework: how to analyze, locate, choose, and execute
- 7 Standard Playbooks:
  A: Initial base setup (Cycle 1-20)
  B: CO2 crisis handling
  C: Power overload recovery
  D: Oxygen crisis emergency
  E: SPOM construction
  F: Pipe/wire crossing (with bridge detection)
  G: Electrical wiring (connect building to grid)
- Error Recovery Table: every error code with specific recovery steps
- Coordinate Location Methods: 4 strategies for finding build positions
- Event Auto-Response Rules: what to do for each event type
- Consolidated pause/speed reference
2026-05-22 09:22:59 +08:00
f91ac2eb95 feat: screenshot API, camera control, pipe/wire crossing detection
New endpoints:
- POST /api/action/screenshot: capture screenshot to file
- GET /api/screenshot/latest: serve PNG binary
- POST /api/action/camera: move camera to (x,y) + set zoom
- GET /api/state/camera: get current camera position/zoom

Pipe/Wire crossing intelligence:
- build_pipe/build_wire now detect existing pipes/wires at each cell
- mode='line' (default): new pipe merges with existing
- mode='cross': auto-places bridges at intersections to avoid connection
- mode='single': one segment

CLI: snapshot [file.png], camera <x> <y> [zoom], camera_status
All high-level commands: auto pause, execute, resume
2026-05-22 09:17:12 +08:00
205ff7668a feat: pipe/wire path building API + oni_commander.py high-level commands
New Mod endpoints:
- POST /api/action/build_pipe: build gas/liquid pipe path (x1,y1)->(x2,y2) with bridge option
- POST /api/action/build_wire: build wire path with types: regular, heavy, conductive, heavy_conductive

New Python tool: tools/oni_commander.py
High-level commands that combine multiple low-level API calls:
- diagnose: full diagnostic (power, CO2, temp, diseases, pipes)
- fix_co2: auto-detect CO2 pockets and dig vent shafts
- fix_overload: detect overloaded circuits with fix suggestions
- emergency_o2: auto-check O2 and build OxygenDiffuser/Electrolyzer
- expand_base: dig + build walls/floors in one command (one-click room expansion)
- build_pipe_line: simplified CLI for pipe path building
- build_wire_line: simplified CLI for wire path building
All high-level commands auto-pause/resume the game.

CLI: build_pipe_line, build_wire_line added to oni_api.py
2026-05-22 09:11:04 +08:00
f2bdddd305 feat: power grid, pipes, CO2, temp zones, save/load, skills, diseases, storage APIs
New endpoints:
- Save/Load: /api/action/save, /api/action/save_as, /api/action/load, /api/state/saves
- Power grid: /api/state/power (circuits, load, overload detection)
- Pipe contents: /api/state/pipes?type=gas|liquid (debug plumbing)
- CO2 tracking: /api/state/co2 (find CO2 pockets)
- Temp zones: /api/state/temperature/zones (hot/cold spots)
- Morale: /api/state/morale
- Diseases: /api/state/diseases (dupe infection + environmental germs)
- Storage: /api/state/storage (building contents)
- Skills: /api/state/duplicants/skills (attributes + skill trees)
- Assign job: /api/action/assign_job

New CLI commands: save, save_as, load, saves, power, pipes, co2,
temp_zones, morale, diseases, storage, skills, assign_job

CLI help reorganized with clear categories: Save/Load, Grid Analysis, Colony Management
2026-05-22 09:07:46 +08:00
48a70e4928 feat: game pause/speed control API with AI pause protocol
- POST /api/action/pause - pause game (AI must call before operations)
- POST /api/action/unpause - resume game at desired speed
- POST /api/action/speed - set game speed (1x/2x/3x)
- Game state now includes isPaused and gameSpeed
- AI pause protocol documented in SKILL.md: pause before every operation
- Introduces cell.isDiggable flag that filters neutronium properly
- pause/unpause/speed CLI commands added to oni_api.py
2026-05-22 09:04:04 +08:00
a4f2062c1a feat: priority system, batch tasks, action feedback, event daemon
- Priority system: GET /api/state/priorities, POST /api/action/priority_global, POST /api/action/priority_type
- Batch system: POST /api/action/batch with per-action result tracking
- Enhanced action feedback with error codes and AI suggestions:
  cell_occupied, cell_solid, cell_occupied_by_dupe, material_shortage, etc.
- Event stream: GET /api/state/events?since=&limit= for incremental polling
- Event daemon: scripts/event_daemon.py continuously polls events,
  classifies by severity, auto-triggers analysis on critical events
- Games state now reports suffocating/starving/stressed counts
- Cell data includes isDiggable and isSafeForDupe flags
- Added 'events', 'queue', 'batch', 'priority_global', 'priority_type' CLI commands
- Added sample batch plan file
2026-05-22 09:01:12 +08:00
4c6a9b882f docs: add comprehensive README introducing the full toolset 2026-05-22 08:54:58 +08:00
6a7ac87c1b feat: comprehensive AI-oriented data model with cell-level map API and knowledge base
- Add cell/tile map APIs: /api/state/cell, /api/state/cells, /api/state/cells/slice, /api/state/gas
- Add entity registry APIs: /api/registry/buildings, /api/registry/elements, /api/registry/techs
- Add plants, rooms, mop, harvest endpoints
- Rich semantic metadata: element state/category, building category/power, duplicant chore/cell
- AI-friendly coordinate system with (x,y) + cell index in all responses
- Build AI_KNOWLEDGE_BASE.md with building IDs, element IDs, tech trees, game mechanics
- Rewrite SKILL.md with data model explanation, coordinate guide, operation patterns
- Update Python tools: explore, cell, cells, slice, gas, registry subcommands
- Update MOD_DEV_GUIDE.md with AI data design principles
2026-05-22 08:54:03 +08:00
0e17e8a6ac feat: complete ONI Agent project with full Mod API, Python toolchain, and development guide
- Implement all Mod API endpoints (buildings, research, geysers, alerts, critters, deconstruct, prioritize, research, schedule, wardrobe)
- Enhance Python tools with comprehensive CLI, analysis (O2/food/power/temp/water), and 7 blueprints (SPOM, toilet, ranch, farm, cooling, bedroom)
- Add utility scripts: auto_repair, auto_analyze, watch mode, setup
- Write Agent-Mod integration constraints and development guide
- Create skills directory with ONI agent skill definition
2026-05-22 08:44:56 +08:00