Skip to content

Feat/implement alerts endpoint#72

Open
IlyaChichkov wants to merge 2 commits intorefactor/ddd-architecture-and-toolingfrom
feat/implement-alerts-endpoint
Open

Feat/implement alerts endpoint#72
IlyaChichkov wants to merge 2 commits intorefactor/ddd-architecture-and-toolingfrom
feat/implement-alerts-endpoint

Conversation

@IlyaChichkov
Copy link
Copy Markdown
Owner

Feat: Implement In-Game Alerts Retrieval

Description

This PR introduces a new endpoint to the API that allows clients to retrieve a list of all currently active in-game alerts and notifications (e.g., "Colonist needs rescue", "Major break risk", "Raid").

This feature fully utilizes the new Domain-Driven Design architecture established in the previous refactor.

Key Changes

  • New Endpoint: Implemented the REST endpoint to extract active game alerts from the RimWorld engine.
  • Data Models: Created the corresponding DTOs to cleanly serialize the alert data (labels, descriptions, priorities) for the API response.
  • Service Integration: Wired the data retrieval logic through the dedicated Client/UI domain service.
  • Testing Setup: Added Bruno (.yml) test configurations to easily validate and interact with the new endpoint.

Testing Instructions

  1. Build the mod and launch a RimWorld colony.
  2. Ensure there is at least one active alert on the right side of the screen (e.g., draft a colonist and let them get hungry).
  3. Open the Bruno API client.
  4. Run the new Alerts request from the collection.
  5. Verify the JSON response accurately reflects the text and severity of the on-screen alerts.

@IlyaChichkov
Copy link
Copy Markdown
Owner Author

@jkbennitt could you check out this feature, this should partly close the: AppSprout-dev/RLE#12

- Added new REST endpoint and DTO models to extract active game alerts and notifications.
- Wired alerts data retrieval through the Client/UI domain service.
- Created Bruno .yml test configurations to validate and interact with the newly created in-game alerts endpoint.
@IlyaChichkov IlyaChichkov force-pushed the feat/implement-alerts-endpoint branch from efbea5a to d257af8 Compare April 4, 2026 17:03
Copy link
Copy Markdown
Contributor

@jkbennitt jkbennitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great — this is exactly what we requested in AppSprout-dev/RLE#12. The alerts endpoint gives our agents direct access to RimWorld's pre-prioritized problem list instead of having to infer colony issues from raw data.

We've been running live tests where agents score 0.4 on mood because they don't prioritize beds/cooking fast enough — feeding them the alert list ("Major break risk", "Need colonist beds", "Starvation") will help them react to the most urgent problems first.

A few questions on the response shape so we can wire it into our client:

  1. What does the severity field look like? Is it an enum (critical/major/minor) or a numeric priority?
  2. Does the response include colonist IDs for alerts that target specific pawns (e.g. "Mental break: Bob")?
  3. Is the endpoint available while the game is paused, or does it need the game to be unpaused like other endpoints?

This partly closes AppSprout-dev/RLE#12 — the remaining piece is GET /api/v1/learning-helper (lower priority, can be a separate PR).

@CalebisGross FYI — once this merges we can wire it into the agent pipeline.

@IlyaChichkov
Copy link
Copy Markdown
Owner Author

Here is example response data:

{
  "success": true,
  "data": [
    {
      "label": "Colonist needs rescue",
      "explanation": "These colonists are incapacitated on the ground:\n  - Strick\r\n\nSend another colonist to rescue them and carry them back to bed.\n\n(To rescue, select another colonist, then right click on the victim and select Rescue.)",
      "priority": "Critical",
      "targets": [
        289
      ],
      "cells": []
    },
    {
      "label": "Starvation",
      "explanation": "These colonists are starving:\n  - Strick\r\n  - Jennifer\n\nGet them some food.",
      "priority": "High",
      "targets": [
        289,
        292
      ],
      "cells": []
    },
    {
      "label": "Medical emergency",
      "explanation": "People are at risk of death because of severe illness:\n  - Strick\n\nMake sure that they get the best medical care possible.",
      "priority": "Critical",
      "targets": [
        289
      ],
      "cells": []
    },
    {
      "label": "Need meal source",
      "explanation": "You have no way of preparing proper meals from raw food.\n\nBuild a stove, campfire, or nutrient dispenser.\n\n(It cannot be in a prison cell, otherwise colonists cannot use it.)",
      "priority": "Medium",
      "targets": [],
      "cells": []
    },
    {
      "label": "Need defenses",
      "explanation": "You've been here some time and have probably been seen. Pirate raids will start soon.\n\nYou should prepare defenses, like sandbags or traps.",
      "priority": "High",
      "targets": [],
      "cells": []
    },
    {
      "label": "Low food",
      "explanation": "You are dangerously low on food.\n\n    Full bars worth of food in storage: 0\n    Colonists and prisoners getting food: 10\n    Days worth of food in storage: 0\n\nGrow, buy, find, or kill some food.",
      "priority": "High",
      "targets": [],
      "cells": []
    },
    {
      "label": "Low medicine",
      "explanation": "You have no medicine left in storage.\n\nBuy more medicine from traders.",
      "priority": "High",
      "targets": [],
      "cells": []
    },
    {
      "label": "Need colonist beds",
      "explanation": "You have more colonists than you have colonist beds. Someone will lack a place to sleep.\n\nEither make more beds, or change a prisoner bed to a colonist bed.\n\nIf you have no resources, sleeping spots are free and can be placed instantly.",
      "priority": "High",
      "targets": [],
      "cells": []
    },
    {
      "label": "Colonist left unburied",
      "explanation": "A colonist is left unburied.\n\nThis may negatively affect your colonists' mood.",
      "priority": "High",
      "targets": [
        49001
      ],
      "cells": []
    },
    {
      "label": "Need recreation variety",
      "explanation": "There are only 2 different recreation types available in Colony, but at the current expectations level (very low), colonists need 3 different kinds of recreation to remain satisfied. Provide recreation variety supplying a new, different kind of recreation.\n\nAvailable recreation types:\n  - Solitary relaxation\r\n  - Social interaction\n\nMissing recreation types:\n  - Dexterity play\n  - Cerebral play\n  - Television watching\n  - Telescope study\n  - Music\n  - Chemical consumption\n  - Food consumption\n  - Reading\n\nNote: You can check the recreation type of any item in its stats page, accessible with the 'i' button.",
      "priority": "Medium",
      "targets": [],
      "cells": []
    }
  ],
  "errors": [],
  "warnings": [],
  "timestamp": "2026-04-04T18:45:36.0433309Z"
}

@jkbennitt
Copy link
Copy Markdown
Contributor

This is perfect. The response shape has exactly what we need:

  • priority as Critical/High/Medium gives us pre-prioritized signals
  • targets with pawn IDs lets us route alerts to the right agent (e.g. MedicalOfficer gets "Colonist needs rescue" with pawn 289)
  • explanation text is gold — we can inject it directly into agent prompts so the LLM knows what to do

We'll wire this into the RLE agent pipeline once it merges. @CalebisGross will handle the integration on our side. Thanks Ilya!

@IlyaChichkov
Copy link
Copy Markdown
Owner Author

I also started working on LearningReadout, but it will take some time and you are right its probably better to make in different PR. I'll try to merge those recent PRs into develop soon in the first place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants