aa-intelpulse 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_intelpulse-0.5.0/.gitignore +46 -0
- aa_intelpulse-0.5.0/LICENSE +21 -0
- aa_intelpulse-0.5.0/PKG-INFO +232 -0
- aa_intelpulse-0.5.0/README.md +184 -0
- aa_intelpulse-0.5.0/aa_intelpulse/__init__.py +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/admin.py +226 -0
- aa_intelpulse-0.5.0/aa_intelpulse/apps.py +7 -0
- aa_intelpulse-0.5.0/aa_intelpulse/auth_hooks.py +44 -0
- aa_intelpulse-0.5.0/aa_intelpulse/discord_i18n.py +54 -0
- aa_intelpulse-0.5.0/aa_intelpulse/eve_data.py +42 -0
- aa_intelpulse-0.5.0/aa_intelpulse/locale/nl/LC_MESSAGES/django.mo +0 -0
- aa_intelpulse-0.5.0/aa_intelpulse/locale/nl/LC_MESSAGES/django.po +36 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0001_initial.py +96 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0002_alter_general_options_watchedarea.py +32 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0003_intelpulseconfig_last_ingest_at.py +28 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0004_incidentevent_hostile_corporation_and_more.py +43 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0005_alertgroup_incidentevent_alert_group_and_more.py +47 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0006_intelpulseconfig_sitrep_retention_hours.py +18 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/0007_discord_language.py +26 -0
- aa_intelpulse-0.5.0/aa_intelpulse/migrations/__init__.py +0 -0
- aa_intelpulse-0.5.0/aa_intelpulse/models.py +340 -0
- aa_intelpulse-0.5.0/aa_intelpulse/services.py +169 -0
- aa_intelpulse-0.5.0/aa_intelpulse/spa_api.py +491 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/.gitkeep +0 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/data/eve_alliances.json +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/data/eve_npc_factions.json +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/data/eve_regions.json +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/data/eve_solar_systems.json +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/spa/assets/index.css +1 -0
- aa_intelpulse-0.5.0/aa_intelpulse/static/aa_intelpulse/spa/assets/index.js +209 -0
- aa_intelpulse-0.5.0/aa_intelpulse/status.py +64 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tasks.py +121 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/_alert_groups_content.html +208 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/_archived_sitreps_content.html +127 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/_friendly_entities_content.html +184 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/_pipeline_status_content.html +156 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/_watched_areas_content.html +146 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/alert_group_activity.html +69 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/base.html +9 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/blue_fleet.html +76 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/dashboard.html +220 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/settings.html +107 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templates/aa_intelpulse/spa.html +27 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templatetags/__init__.py +0 -0
- aa_intelpulse-0.5.0/aa_intelpulse/templatetags/intelpulse_tags.py +11 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/__init__.py +0 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_api.py +173 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_auth_hooks.py +23 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_discord_language.py +55 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_models.py +168 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_spa_api.py +324 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_tasks.py +278 -0
- aa_intelpulse-0.5.0/aa_intelpulse/tests/test_views.py +838 -0
- aa_intelpulse-0.5.0/aa_intelpulse/urls.py +67 -0
- aa_intelpulse-0.5.0/aa_intelpulse/utils.py +52 -0
- aa_intelpulse-0.5.0/aa_intelpulse/views.py +469 -0
- aa_intelpulse-0.5.0/pyproject.toml +82 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
|
|
7
|
+
# Build & Distribution
|
|
8
|
+
/build/
|
|
9
|
+
/dist/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
*.egg
|
|
12
|
+
|
|
13
|
+
# Virtual environments
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
env/
|
|
17
|
+
|
|
18
|
+
# IDEs and OS
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
.DS_Store
|
|
23
|
+
|
|
24
|
+
# Tests, Tox & Coverage
|
|
25
|
+
.tox/
|
|
26
|
+
htmlcov/
|
|
27
|
+
.coverage
|
|
28
|
+
/coverage.xml
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
.mypy_cache/
|
|
31
|
+
.ruff_cache/
|
|
32
|
+
|
|
33
|
+
# Databases
|
|
34
|
+
*.sqlite3
|
|
35
|
+
db.sqlite3
|
|
36
|
+
alliance_auth.sqlite3
|
|
37
|
+
|
|
38
|
+
# Node / JS
|
|
39
|
+
node_modules/
|
|
40
|
+
|
|
41
|
+
# Logs and temps
|
|
42
|
+
*.log
|
|
43
|
+
*.tmp
|
|
44
|
+
*.bak
|
|
45
|
+
*.old
|
|
46
|
+
.env
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maddog Broekman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aa-intelpulse
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: IntelPulse AI - Autonomous Intelligence & Fleet Briefing Service for Alliance Auth
|
|
5
|
+
Author-email: Maddog Broekman <maddogbroekman@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Maddog Broekman
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Keywords: aa_intelpulse,allianceauth
|
|
29
|
+
Classifier: Environment :: Web Environment
|
|
30
|
+
Classifier: Framework :: Django
|
|
31
|
+
Classifier: Framework :: Django :: 5.2
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
36
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
41
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
42
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
43
|
+
Requires-Python: <3.14,>=3.10
|
|
44
|
+
Requires-Dist: allianceauth>=5
|
|
45
|
+
Requires-Dist: python-dotenv>=1.0
|
|
46
|
+
Requires-Dist: requests>=2.31
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
# AA IntelPulse
|
|
50
|
+
|
|
51
|
+
[](https://pypi.org/project/aa-intelpulse/)
|
|
52
|
+
[](https://pypi.org/project/aa-intelpulse/)
|
|
53
|
+
[](https://github.com/mbroekman/aa-intelpulse/actions/workflows/automated-checks.yml)
|
|
54
|
+
|
|
55
|
+
Alliance Auth plugin for autonomous EVE Online fleet intelligence: ingests zKillboard/ESI
|
|
56
|
+
activity, generates AI-written tactical SITREPs and threat badges, and distributes them to
|
|
57
|
+
a dashboard widget and Discord.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Dashboard**: every active SITREP gets its own collapsed row (title, threat badge,
|
|
62
|
+
system, relative time) that expands on click, newest first. Filter pills
|
|
63
|
+
(All/Critical/High/Medium/Low) narrow the list to a specific threat level on demand.
|
|
64
|
+
- **Ingest API**: a token-authenticated endpoint receives hostile-activity events from an
|
|
65
|
+
external n8n pipeline (`intelpulse-ingest-zkillboard.json`), which polls zKillboard's R2Z2
|
|
66
|
+
killmail feed and enriches each kill via ESI (system/region/alliance/ship-type names)
|
|
67
|
+
before forwarding it. (The original PRD's Ollama noise-pre-filter and stateful "3+ kills in
|
|
68
|
+
15 min" rolling-window alert are not implemented in this first build - the current threat
|
|
69
|
+
heuristic is per-kill only, based on kill value and attacker count.)
|
|
70
|
+
- **Watched Areas**: events are only processed if their solar system or region is on a
|
|
71
|
+
configurable watch list — ingesting unfiltered activity from all of EVE is mostly noise.
|
|
72
|
+
An empty list watches everything (safe default for a fresh install).
|
|
73
|
+
- **Settings**: Watched Areas, Friendly Entities, Alert Groups, Pipeline Status and
|
|
74
|
+
Archived Reports are all officer-only configuration/ops pages, consolidated as tabs
|
|
75
|
+
of one page (`/intelpulse/settings/`, requires `aa_intelpulse.manage_watched_areas`)
|
|
76
|
+
instead of five separate sidebar menu items - these are settings, not primary
|
|
77
|
+
navigation destinations. Each tab keeps its own URL hash (e.g. `#alert-groups`) so
|
|
78
|
+
links and bookmarks still land on the right tab.
|
|
79
|
+
- **Pipeline Status**: shows whether the external n8n ingest pipeline is actually
|
|
80
|
+
reaching IntelPulse (a heartbeat updated on every authenticated ingest call,
|
|
81
|
+
independent of Watched Areas), plus event throughput, processing errors, and active
|
|
82
|
+
SITREP counts - the Pipeline Status tab of Settings.
|
|
83
|
+
- **SITREP Auto-Archive Retention**: active SITREPs older than a configurable number
|
|
84
|
+
of hours (default 24) are automatically archived by a periodic task - same effect as
|
|
85
|
+
an officer clicking Archive. Editable on the Archived Reports tab of Settings
|
|
86
|
+
(`IntelPulseConfig.sitrep_retention_hours`).
|
|
87
|
+
- **Friendly Entities / Blue Fleet**: events whose `hostile_alliance` (or optional
|
|
88
|
+
`hostile_corporation`) matches a configured Friendly Entity are recognized as our own
|
|
89
|
+
activity, not a hostile threat. By default (`report_friendly_activity` off) these are
|
|
90
|
+
dropped entirely at ingest - no stored row, no AI/Discord spend. Toggling it on instead
|
|
91
|
+
stores them and shows them on a separate `/intelpulse/blue-fleet/` page as an expandable
|
|
92
|
+
accordion matching the dashboard's style (no tactical recommendation section - no AI
|
|
93
|
+
SITREP is ever generated for friendly activity) so members can see where friendly fleets
|
|
94
|
+
are active without it being mixed into the hostile-threat dashboard. Managed from the
|
|
95
|
+
Friendly Entities tab of Settings (requires `aa_intelpulse.manage_watched_areas`). Alliances are
|
|
96
|
+
picked from a searchable multi-select (bundled list of all ~3,600 EVE alliances, same
|
|
97
|
+
static-JSON approach as the Watched Areas picker) so several can be added in one submit;
|
|
98
|
+
corporations stay free-text since ESI has no bulk "list all corporations" endpoint to
|
|
99
|
+
bundle.
|
|
100
|
+
- **Archive & Delete SITREPs**: officers can archive (reversible) or permanently delete
|
|
101
|
+
a SITREP from the dashboard - see the Archived Reports tab of Settings.
|
|
102
|
+
- **Alert Groups**: route a subset of hostile-threat Discord notifications to a separate
|
|
103
|
+
webhook - e.g. keep NPC faction activity (Guristas Pirates, Drifters, Sansha's Nation,
|
|
104
|
+
...) out of the main channel instead of mixing it with real player fleet threats. Create
|
|
105
|
+
a named group with its own optional webhook on the Alert Groups tab of Settings and assign it
|
|
106
|
+
alliance/faction names from a combined searchable picker (the ~3,600 player alliances used
|
|
107
|
+
elsewhere, plus the ~27 NPC factions ESI exposes separately). A name can only belong to one
|
|
108
|
+
group. `IncidentEvent.alert_group` is set at ingest time on an exact (case-insensitive)
|
|
109
|
+
`hostile_alliance` match; matched SITREPs show a small group badge on the dashboard, and
|
|
110
|
+
`send_discord_notification` routes to the group's webhook when set, otherwise falling back
|
|
111
|
+
to the default IntelPulse webhook unchanged. Groups are editable in place, and each has its
|
|
112
|
+
own "Blue Fleet"-style activity page listing recent matched events - reached from a single
|
|
113
|
+
"Group Activity" dropdown on the dashboard (one button regardless of how many groups exist,
|
|
114
|
+
not one per group) or a "View Activity" link on the Alert Groups management page.
|
|
115
|
+
- **AI-generated SITREPs**: high/critical-threat events are summarized into a tactical
|
|
116
|
+
Situation Report via Google Gemini, including a recommended counter-doctrine.
|
|
117
|
+
- **Tactical Threat Badges**: a Flux-rendered visual badge is attached to high/critical
|
|
118
|
+
SITREPs.
|
|
119
|
+
- **Daily Strategic SITREP**: a scheduled 08:00 UTC task aggregates the previous day's
|
|
120
|
+
activity into a summary report.
|
|
121
|
+
- **Discord Distribution**: high/critical SITREPs are pushed as a color-coded Discord
|
|
122
|
+
embed via a configurable webhook.
|
|
123
|
+
|
|
124
|
+
## User interface (React SPA)
|
|
125
|
+
|
|
126
|
+
The IntelPulse pages (Dashboard, Blue Fleet, Alert Group activity, Settings) are a React 19 + TypeScript + Tailwind v4 + shadcn/ui single-page app mounted in `allianceauth/base-bs5.html`, following the Alliance Auth light/dark theme. Every table can be sorted per column and searched. Append `?classic=1` to any of these URLs (or use the "Classic view" link at the bottom of the page) for the classic Django templates.
|
|
127
|
+
|
|
128
|
+
The SPA talks to a JSON API under `/intelpulse/api/v1/spa/` that applies the same permissions as the classic views (login for reading, `aa_intelpulse.manage_watched_areas` for Settings and every change). The ingest token and Discord webhook URLs are never sent to the browser.
|
|
129
|
+
|
|
130
|
+
Rebuilding the frontend (Windows; builds in `%LOCALAPPDATA%` because `npm install` fails on Google Drive) and committing the output:
|
|
131
|
+
|
|
132
|
+
```powershell
|
|
133
|
+
powershell -File frontend\build.ps1
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Installation
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install aa-intelpulse
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Add the app to your `local.py`:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
INSTALLED_APPS += [
|
|
146
|
+
"aa_intelpulse",
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For a comprehensive guide covering the full production setup — the `APPS_WITH_PUBLIC_VIEWS` /
|
|
151
|
+
`ALLOWED_HOSTS` requirements, the supporting `ai` client dependency and its API keys,
|
|
152
|
+
`IntelPulseConfig` and Watched Areas configuration, Celery Beat registration, and deploying
|
|
153
|
+
the external n8n ingest pipeline — please see the
|
|
154
|
+
[Installation & Operations Guide](docs/installation.md).
|
|
155
|
+
|
|
156
|
+
## Configuration
|
|
157
|
+
|
|
158
|
+
The ingest token and Discord webhook URL are technical credentials (ADR-006), managed via
|
|
159
|
+
**Admin > IntelPulse Configuration**; **Watched Areas** and **Friendly Entities** (including
|
|
160
|
+
the `report_friendly_activity` toggle) are functional config, managed from the frontend
|
|
161
|
+
instead (requires the `aa_intelpulse.manage_watched_areas` permission). See the
|
|
162
|
+
[Installation & Operations Guide](docs/installation.md) for full setup details on both, plus
|
|
163
|
+
the `ai` client dependency and its required environment variables.
|
|
164
|
+
|
|
165
|
+
## Language of SITREPs and Discord messages
|
|
166
|
+
|
|
167
|
+
New SITREPs are written by the AI in the language chosen on the Settings page (**Pipeline Status** tab), and the Discord embeds use it too. When none is chosen, the installation default applies. Set the default in `myauth/settings/local.py` (it falls back to `LANGUAGE_CODE`):
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
DISCORD_MESSAGE_LANGUAGE = "en" # or e.g. "nl-nl"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Ingest API
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
POST /intelpulse/api/ingest/
|
|
177
|
+
Header: X-IntelPulse-Token: <ingest_token>
|
|
178
|
+
Body (JSON): {
|
|
179
|
+
"event_id": "evt-20261007-001",
|
|
180
|
+
"timestamp": "2026-10-07T14:00:00Z",
|
|
181
|
+
"solar_system": "Jita",
|
|
182
|
+
"region": "The Forge",
|
|
183
|
+
"threat_level": "CRITICAL",
|
|
184
|
+
"hostile_alliance": "Band of Brothers",
|
|
185
|
+
"hostile_corporation": "",
|
|
186
|
+
"estimated_fleet_size": 28,
|
|
187
|
+
"dominant_doctrine": "HAC Fleet (Cerberus / Basilisk)",
|
|
188
|
+
"summary": "Large hostile HAC fleet spotted en route to the staging gate.",
|
|
189
|
+
"recommended_counter": "Long range Battleship fleet or Stealth Bomber drop."
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`hostile_corporation` is optional (omit it or send `""`). The n8n pipeline resolves and
|
|
194
|
+
sends it independently of `hostile_alliance` - the attacker's corporation name, for both
|
|
195
|
+
player kills and NPC corp-level attackers (e.g. `"Serpentis Corporation"`). `hostile_alliance`
|
|
196
|
+
itself falls back to the attacker's NPC faction name (e.g. `"Serpentis"`) when no alliance is
|
|
197
|
+
present, which also covers NPC spawns that carry only a `faction_id` and no corporation at
|
|
198
|
+
all (Dreadnought-class and similar rare rat spawns) - `"Unknown"` is only sent when neither
|
|
199
|
+
resolves. Both alliance- and corp-level Friendly Entity matching work against live data
|
|
200
|
+
today.
|
|
201
|
+
|
|
202
|
+
Returns `202 Accepted` with the stored `event_id` (idempotent on retries), `202 Accepted`
|
|
203
|
+
with `{"status": "ignored", "reason": "outside watched areas"}` and no stored row if the
|
|
204
|
+
system/region isn't on the Watched Areas list, `202 Accepted` with
|
|
205
|
+
`{"status": "ignored", "reason": "friendly activity"}` and no stored row if the event
|
|
206
|
+
matches a Friendly Entity and `report_friendly_activity` is off, `401` for an invalid/missing
|
|
207
|
+
token, or `400` for malformed/incomplete
|
|
208
|
+
payloads.
|
|
209
|
+
|
|
210
|
+
## Periodic Tasks (Celery Beat)
|
|
211
|
+
|
|
212
|
+
To enable the daily 08:00 UTC strategic SITREP and the hourly SITREP auto-archive
|
|
213
|
+
check, add the following tasks to your `local.py`:
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
CELERYBEAT_SCHEDULE["aa_intelpulse_daily_sitrep"] = {
|
|
217
|
+
"task": "aa_intelpulse.tasks.generate_daily_sitrep",
|
|
218
|
+
"schedule": crontab(minute="0", hour="8"),
|
|
219
|
+
}
|
|
220
|
+
CELERYBEAT_SCHEDULE["aa_intelpulse_archive_stale_sitreps"] = {
|
|
221
|
+
"task": "aa_intelpulse.tasks.archive_stale_sitreps",
|
|
222
|
+
"schedule": crontab(minute="0"),
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`archive_stale_sitreps` archives any active SITREP older than
|
|
227
|
+
`IntelPulseConfig.sitrep_retention_hours` (default 24, editable on the Archived Reports
|
|
228
|
+
tab of Settings) - hourly is frequent enough granularity for a setting measured in hours.
|
|
229
|
+
|
|
230
|
+
`aa_intelpulse.tasks.process_incident_event` and `aa_intelpulse.tasks.send_discord_notification`
|
|
231
|
+
both require a positional argument and are triggered directly by the ingest endpoint — they
|
|
232
|
+
are not scheduled and must not be added to `CELERYBEAT_SCHEDULE`.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# AA IntelPulse
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/aa-intelpulse/)
|
|
4
|
+
[](https://pypi.org/project/aa-intelpulse/)
|
|
5
|
+
[](https://github.com/mbroekman/aa-intelpulse/actions/workflows/automated-checks.yml)
|
|
6
|
+
|
|
7
|
+
Alliance Auth plugin for autonomous EVE Online fleet intelligence: ingests zKillboard/ESI
|
|
8
|
+
activity, generates AI-written tactical SITREPs and threat badges, and distributes them to
|
|
9
|
+
a dashboard widget and Discord.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Dashboard**: every active SITREP gets its own collapsed row (title, threat badge,
|
|
14
|
+
system, relative time) that expands on click, newest first. Filter pills
|
|
15
|
+
(All/Critical/High/Medium/Low) narrow the list to a specific threat level on demand.
|
|
16
|
+
- **Ingest API**: a token-authenticated endpoint receives hostile-activity events from an
|
|
17
|
+
external n8n pipeline (`intelpulse-ingest-zkillboard.json`), which polls zKillboard's R2Z2
|
|
18
|
+
killmail feed and enriches each kill via ESI (system/region/alliance/ship-type names)
|
|
19
|
+
before forwarding it. (The original PRD's Ollama noise-pre-filter and stateful "3+ kills in
|
|
20
|
+
15 min" rolling-window alert are not implemented in this first build - the current threat
|
|
21
|
+
heuristic is per-kill only, based on kill value and attacker count.)
|
|
22
|
+
- **Watched Areas**: events are only processed if their solar system or region is on a
|
|
23
|
+
configurable watch list — ingesting unfiltered activity from all of EVE is mostly noise.
|
|
24
|
+
An empty list watches everything (safe default for a fresh install).
|
|
25
|
+
- **Settings**: Watched Areas, Friendly Entities, Alert Groups, Pipeline Status and
|
|
26
|
+
Archived Reports are all officer-only configuration/ops pages, consolidated as tabs
|
|
27
|
+
of one page (`/intelpulse/settings/`, requires `aa_intelpulse.manage_watched_areas`)
|
|
28
|
+
instead of five separate sidebar menu items - these are settings, not primary
|
|
29
|
+
navigation destinations. Each tab keeps its own URL hash (e.g. `#alert-groups`) so
|
|
30
|
+
links and bookmarks still land on the right tab.
|
|
31
|
+
- **Pipeline Status**: shows whether the external n8n ingest pipeline is actually
|
|
32
|
+
reaching IntelPulse (a heartbeat updated on every authenticated ingest call,
|
|
33
|
+
independent of Watched Areas), plus event throughput, processing errors, and active
|
|
34
|
+
SITREP counts - the Pipeline Status tab of Settings.
|
|
35
|
+
- **SITREP Auto-Archive Retention**: active SITREPs older than a configurable number
|
|
36
|
+
of hours (default 24) are automatically archived by a periodic task - same effect as
|
|
37
|
+
an officer clicking Archive. Editable on the Archived Reports tab of Settings
|
|
38
|
+
(`IntelPulseConfig.sitrep_retention_hours`).
|
|
39
|
+
- **Friendly Entities / Blue Fleet**: events whose `hostile_alliance` (or optional
|
|
40
|
+
`hostile_corporation`) matches a configured Friendly Entity are recognized as our own
|
|
41
|
+
activity, not a hostile threat. By default (`report_friendly_activity` off) these are
|
|
42
|
+
dropped entirely at ingest - no stored row, no AI/Discord spend. Toggling it on instead
|
|
43
|
+
stores them and shows them on a separate `/intelpulse/blue-fleet/` page as an expandable
|
|
44
|
+
accordion matching the dashboard's style (no tactical recommendation section - no AI
|
|
45
|
+
SITREP is ever generated for friendly activity) so members can see where friendly fleets
|
|
46
|
+
are active without it being mixed into the hostile-threat dashboard. Managed from the
|
|
47
|
+
Friendly Entities tab of Settings (requires `aa_intelpulse.manage_watched_areas`). Alliances are
|
|
48
|
+
picked from a searchable multi-select (bundled list of all ~3,600 EVE alliances, same
|
|
49
|
+
static-JSON approach as the Watched Areas picker) so several can be added in one submit;
|
|
50
|
+
corporations stay free-text since ESI has no bulk "list all corporations" endpoint to
|
|
51
|
+
bundle.
|
|
52
|
+
- **Archive & Delete SITREPs**: officers can archive (reversible) or permanently delete
|
|
53
|
+
a SITREP from the dashboard - see the Archived Reports tab of Settings.
|
|
54
|
+
- **Alert Groups**: route a subset of hostile-threat Discord notifications to a separate
|
|
55
|
+
webhook - e.g. keep NPC faction activity (Guristas Pirates, Drifters, Sansha's Nation,
|
|
56
|
+
...) out of the main channel instead of mixing it with real player fleet threats. Create
|
|
57
|
+
a named group with its own optional webhook on the Alert Groups tab of Settings and assign it
|
|
58
|
+
alliance/faction names from a combined searchable picker (the ~3,600 player alliances used
|
|
59
|
+
elsewhere, plus the ~27 NPC factions ESI exposes separately). A name can only belong to one
|
|
60
|
+
group. `IncidentEvent.alert_group` is set at ingest time on an exact (case-insensitive)
|
|
61
|
+
`hostile_alliance` match; matched SITREPs show a small group badge on the dashboard, and
|
|
62
|
+
`send_discord_notification` routes to the group's webhook when set, otherwise falling back
|
|
63
|
+
to the default IntelPulse webhook unchanged. Groups are editable in place, and each has its
|
|
64
|
+
own "Blue Fleet"-style activity page listing recent matched events - reached from a single
|
|
65
|
+
"Group Activity" dropdown on the dashboard (one button regardless of how many groups exist,
|
|
66
|
+
not one per group) or a "View Activity" link on the Alert Groups management page.
|
|
67
|
+
- **AI-generated SITREPs**: high/critical-threat events are summarized into a tactical
|
|
68
|
+
Situation Report via Google Gemini, including a recommended counter-doctrine.
|
|
69
|
+
- **Tactical Threat Badges**: a Flux-rendered visual badge is attached to high/critical
|
|
70
|
+
SITREPs.
|
|
71
|
+
- **Daily Strategic SITREP**: a scheduled 08:00 UTC task aggregates the previous day's
|
|
72
|
+
activity into a summary report.
|
|
73
|
+
- **Discord Distribution**: high/critical SITREPs are pushed as a color-coded Discord
|
|
74
|
+
embed via a configurable webhook.
|
|
75
|
+
|
|
76
|
+
## User interface (React SPA)
|
|
77
|
+
|
|
78
|
+
The IntelPulse pages (Dashboard, Blue Fleet, Alert Group activity, Settings) are a React 19 + TypeScript + Tailwind v4 + shadcn/ui single-page app mounted in `allianceauth/base-bs5.html`, following the Alliance Auth light/dark theme. Every table can be sorted per column and searched. Append `?classic=1` to any of these URLs (or use the "Classic view" link at the bottom of the page) for the classic Django templates.
|
|
79
|
+
|
|
80
|
+
The SPA talks to a JSON API under `/intelpulse/api/v1/spa/` that applies the same permissions as the classic views (login for reading, `aa_intelpulse.manage_watched_areas` for Settings and every change). The ingest token and Discord webhook URLs are never sent to the browser.
|
|
81
|
+
|
|
82
|
+
Rebuilding the frontend (Windows; builds in `%LOCALAPPDATA%` because `npm install` fails on Google Drive) and committing the output:
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
powershell -File frontend\build.ps1
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install aa-intelpulse
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Add the app to your `local.py`:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
INSTALLED_APPS += [
|
|
98
|
+
"aa_intelpulse",
|
|
99
|
+
]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For a comprehensive guide covering the full production setup — the `APPS_WITH_PUBLIC_VIEWS` /
|
|
103
|
+
`ALLOWED_HOSTS` requirements, the supporting `ai` client dependency and its API keys,
|
|
104
|
+
`IntelPulseConfig` and Watched Areas configuration, Celery Beat registration, and deploying
|
|
105
|
+
the external n8n ingest pipeline — please see the
|
|
106
|
+
[Installation & Operations Guide](docs/installation.md).
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
The ingest token and Discord webhook URL are technical credentials (ADR-006), managed via
|
|
111
|
+
**Admin > IntelPulse Configuration**; **Watched Areas** and **Friendly Entities** (including
|
|
112
|
+
the `report_friendly_activity` toggle) are functional config, managed from the frontend
|
|
113
|
+
instead (requires the `aa_intelpulse.manage_watched_areas` permission). See the
|
|
114
|
+
[Installation & Operations Guide](docs/installation.md) for full setup details on both, plus
|
|
115
|
+
the `ai` client dependency and its required environment variables.
|
|
116
|
+
|
|
117
|
+
## Language of SITREPs and Discord messages
|
|
118
|
+
|
|
119
|
+
New SITREPs are written by the AI in the language chosen on the Settings page (**Pipeline Status** tab), and the Discord embeds use it too. When none is chosen, the installation default applies. Set the default in `myauth/settings/local.py` (it falls back to `LANGUAGE_CODE`):
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
DISCORD_MESSAGE_LANGUAGE = "en" # or e.g. "nl-nl"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Ingest API
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
POST /intelpulse/api/ingest/
|
|
129
|
+
Header: X-IntelPulse-Token: <ingest_token>
|
|
130
|
+
Body (JSON): {
|
|
131
|
+
"event_id": "evt-20261007-001",
|
|
132
|
+
"timestamp": "2026-10-07T14:00:00Z",
|
|
133
|
+
"solar_system": "Jita",
|
|
134
|
+
"region": "The Forge",
|
|
135
|
+
"threat_level": "CRITICAL",
|
|
136
|
+
"hostile_alliance": "Band of Brothers",
|
|
137
|
+
"hostile_corporation": "",
|
|
138
|
+
"estimated_fleet_size": 28,
|
|
139
|
+
"dominant_doctrine": "HAC Fleet (Cerberus / Basilisk)",
|
|
140
|
+
"summary": "Large hostile HAC fleet spotted en route to the staging gate.",
|
|
141
|
+
"recommended_counter": "Long range Battleship fleet or Stealth Bomber drop."
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`hostile_corporation` is optional (omit it or send `""`). The n8n pipeline resolves and
|
|
146
|
+
sends it independently of `hostile_alliance` - the attacker's corporation name, for both
|
|
147
|
+
player kills and NPC corp-level attackers (e.g. `"Serpentis Corporation"`). `hostile_alliance`
|
|
148
|
+
itself falls back to the attacker's NPC faction name (e.g. `"Serpentis"`) when no alliance is
|
|
149
|
+
present, which also covers NPC spawns that carry only a `faction_id` and no corporation at
|
|
150
|
+
all (Dreadnought-class and similar rare rat spawns) - `"Unknown"` is only sent when neither
|
|
151
|
+
resolves. Both alliance- and corp-level Friendly Entity matching work against live data
|
|
152
|
+
today.
|
|
153
|
+
|
|
154
|
+
Returns `202 Accepted` with the stored `event_id` (idempotent on retries), `202 Accepted`
|
|
155
|
+
with `{"status": "ignored", "reason": "outside watched areas"}` and no stored row if the
|
|
156
|
+
system/region isn't on the Watched Areas list, `202 Accepted` with
|
|
157
|
+
`{"status": "ignored", "reason": "friendly activity"}` and no stored row if the event
|
|
158
|
+
matches a Friendly Entity and `report_friendly_activity` is off, `401` for an invalid/missing
|
|
159
|
+
token, or `400` for malformed/incomplete
|
|
160
|
+
payloads.
|
|
161
|
+
|
|
162
|
+
## Periodic Tasks (Celery Beat)
|
|
163
|
+
|
|
164
|
+
To enable the daily 08:00 UTC strategic SITREP and the hourly SITREP auto-archive
|
|
165
|
+
check, add the following tasks to your `local.py`:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
CELERYBEAT_SCHEDULE["aa_intelpulse_daily_sitrep"] = {
|
|
169
|
+
"task": "aa_intelpulse.tasks.generate_daily_sitrep",
|
|
170
|
+
"schedule": crontab(minute="0", hour="8"),
|
|
171
|
+
}
|
|
172
|
+
CELERYBEAT_SCHEDULE["aa_intelpulse_archive_stale_sitreps"] = {
|
|
173
|
+
"task": "aa_intelpulse.tasks.archive_stale_sitreps",
|
|
174
|
+
"schedule": crontab(minute="0"),
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`archive_stale_sitreps` archives any active SITREP older than
|
|
179
|
+
`IntelPulseConfig.sitrep_retention_hours` (default 24, editable on the Archived Reports
|
|
180
|
+
tab of Settings) - hourly is frequent enough granularity for a setting measured in hours.
|
|
181
|
+
|
|
182
|
+
`aa_intelpulse.tasks.process_incident_event` and `aa_intelpulse.tasks.send_discord_notification`
|
|
183
|
+
both require a positional argument and are triggered directly by the ingest endpoint — they
|
|
184
|
+
are not scheduled and must not be added to `CELERYBEAT_SCHEDULE`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.0"
|