DCS-SE Codebase Reference
dcs_simulation_engine
DCS Simulation Engine package.
api
FastAPI server surface for programmatic DCS access.
create_app(*, provider=None, mongo_uri=None, shutdown_dump_dir=None, run_config=None, run_config_path=None, remote_management_enabled=False, bootstrap_token=None, session_ttl_seconds=DEFAULT_SESSION_TTL_SECONDS, sweep_interval_seconds=DEFAULT_SWEEP_INTERVAL_SECONDS, cors_origins=None)
Create and configure the FastAPI server application.
Source code in dcs_simulation_engine/api/app.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
app
FastAPI application factory for the DCS server.
create_app(*, provider=None, mongo_uri=None, shutdown_dump_dir=None, run_config=None, run_config_path=None, remote_management_enabled=False, bootstrap_token=None, session_ttl_seconds=DEFAULT_SESSION_TTL_SECONDS, sweep_interval_seconds=DEFAULT_SWEEP_INTERVAL_SECONDS, cors_origins=None)
Create and configure the FastAPI server application.
Source code in dcs_simulation_engine/api/app.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
auth
Authentication and app-state access helpers for the FastAPI API layer.
api_key_from_request(request)
Extract api_key from Authorization: Bearer header.
Source code in dcs_simulation_engine/api/auth.py
86 87 88 | |
api_key_from_websocket(websocket)
Extract api_key from Authorization: Bearer header on a WebSocket.
Source code in dcs_simulation_engine/api/auth.py
91 92 93 | |
authenticate_player(*, provider, api_key)
Return the player for a raw API key, or None if invalid.
Source code in dcs_simulation_engine/api/auth.py
96 97 98 99 100 101 102 103 104 105 106 107 108 | |
authenticate_player_async(*, provider, api_key)
async
Async variant of authenticate_player that supports sync/async providers.
Source code in dcs_simulation_engine/api/auth.py
119 120 121 122 123 124 125 126 127 128 129 130 131 | |
build_server_config(*, run_name, registration_required=True)
Translate server settings into frontend-readable capability flags.
Source code in dcs_simulation_engine/api/auth.py
44 45 46 47 48 49 50 51 52 53 54 | |
get_provider_from_request(request)
Fetch the data provider stored on app state for an HTTP request.
Source code in dcs_simulation_engine/api/auth.py
14 15 16 | |
get_provider_from_websocket(websocket)
Fetch the data provider stored on app state for a WebSocket connection.
Source code in dcs_simulation_engine/api/auth.py
24 25 26 | |
get_registry_from_request(request)
Fetch the session registry stored on app state for an HTTP request.
Source code in dcs_simulation_engine/api/auth.py
19 20 21 | |
get_registry_from_websocket(websocket)
Fetch the session registry stored on app state for a WebSocket connection.
Source code in dcs_simulation_engine/api/auth.py
29 30 31 | |
has_remote_admin_async(*, provider)
async
Return True when any player currently holds the remote admin role.
Source code in dcs_simulation_engine/api/auth.py
68 69 70 71 72 73 | |
is_remote_admin(player)
Return True when the player carries the remote admin role.
Source code in dcs_simulation_engine/api/auth.py
63 64 65 | |
is_remote_management_enabled_from_request(request)
Return whether remote management is enabled for this request.
Source code in dcs_simulation_engine/api/auth.py
34 35 36 | |
is_remote_management_enabled_from_websocket(websocket)
Return whether remote management is enabled for this websocket.
Source code in dcs_simulation_engine/api/auth.py
39 40 41 | |
require_player(*, provider, api_key)
Return authenticated player or raise a 401 HTTPException.
Source code in dcs_simulation_engine/api/auth.py
111 112 113 114 115 116 | |
require_player_async(*, provider, api_key)
async
Return authenticated player or raise 401 for sync/async providers.
Source code in dcs_simulation_engine/api/auth.py
134 135 136 137 138 139 | |
require_remote_admin_async(*, provider, api_key)
async
Return the authenticated remote admin player or raise 403.
Source code in dcs_simulation_engine/api/auth.py
142 143 144 145 146 147 | |
require_remote_management_from_request(request, *, detail)
Raise a 409 when remote-management-only endpoints are used outside remote mode.
Source code in dcs_simulation_engine/api/auth.py
57 58 59 60 | |
client
Python client wrapper for the DCS FastAPI server.
Provides APIClient and SimulationRun for ergonomic use in research scripts.
APIClient
Client for the DCS FastAPI server.
Source code in dcs_simulation_engine/api/client.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
__enter__()
Enter the context manager.
Source code in dcs_simulation_engine/api/client.py
175 176 177 | |
__exit__(exc_type, exc_val, exc_tb)
Exit the context manager, closing the HTTP client.
Source code in dcs_simulation_engine/api/client.py
179 180 181 | |
__init__(url='http://localhost:8080', api_key='', timeout=30.0)
Initialize the API client with a base URL, default API key, and request timeout.
Source code in dcs_simulation_engine/api/client.py
165 166 167 168 169 | |
anonymous_player()
Create an anonymous player for runs that do not require registration.
Source code in dcs_simulation_engine/api/client.py
187 188 189 | |
auth(*, api_key=None)
Validate an API key and return player_id + authenticated.
Source code in dcs_simulation_engine/api/client.py
191 192 193 194 195 | |
branch_session(session_id, *, api_key=None)
Create a paused child branch session and return a resumed-style SimulationRun.
Source code in dcs_simulation_engine/api/client.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
close()
Close the underlying HTTP client transport.
Source code in dcs_simulation_engine/api/client.py
171 172 173 | |
create_character(body)
Create a new character. Returns character_id.
Source code in dcs_simulation_engine/api/client.py
221 222 223 | |
delete_character(character_id)
Delete a character by id. Returns character_id.
Source code in dcs_simulation_engine/api/client.py
229 230 231 | |
health()
Check server liveness.
Source code in dcs_simulation_engine/api/client.py
274 275 276 277 278 | |
list_characters()
List available characters.
Source code in dcs_simulation_engine/api/client.py
217 218 219 | |
list_games()
List available games.
Source code in dcs_simulation_engine/api/client.py
213 214 215 | |
list_sessions(*, api_key=None)
List active in-memory sessions for the authenticated player.
Source code in dcs_simulation_engine/api/client.py
201 202 203 204 205 206 207 208 209 210 211 | |
register_player(body)
Register a new player and return player_id + api_key.
Source code in dcs_simulation_engine/api/client.py
183 184 185 | |
server_config()
Fetch server capability flags for the active runtime mode.
Source code in dcs_simulation_engine/api/client.py
197 198 199 | |
setup_options(*, game_name, api_key=None)
Fetch setup authorization and valid character choices for a game.
Source code in dcs_simulation_engine/api/client.py
260 261 262 263 264 265 266 267 268 269 270 271 272 | |
start_game(body)
Create a new simulation session and return a SimulationRun.
Source code in dcs_simulation_engine/api/client.py
233 234 235 236 237 | |
update_character(character_id, body)
Update an existing character by id. Returns character_id.
Source code in dcs_simulation_engine/api/client.py
225 226 227 | |
SimulationRun
Lightweight wrapper around an active server-side simulation session.
Source code in dcs_simulation_engine/api/client.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
history
property
All WSEventFrames received so far, in order.
is_complete
property
True if the simulation has reached an exit condition.
session_meta
property
Most recent session metadata frame received from the server.
simulator_output
property
Content of the latest AI event, if any.
turns
property
Number of completed turns, or 0 if no turn has ended yet.
__enter__()
Enter the context manager.
Source code in dcs_simulation_engine/api/client.py
67 68 69 | |
__exit__(exc_type, exc_val, exc_tb)
Exit the context manager, closing the session silently on error.
Source code in dcs_simulation_engine/api/client.py
71 72 73 74 75 76 | |
__init__(client, session_id, game_name, api_key, *, resume_on_first_connect=False)
Initialize a SimulationRun bound to an existing server-side session.
Source code in dcs_simulation_engine/api/client.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
close()
Close the server-side session.
Source code in dcs_simulation_engine/api/client.py
123 124 125 126 127 128 129 130 131 | |
get_state()
Fetch current session status without advancing a turn.
Source code in dcs_simulation_engine/api/client.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
step(user_input='')
Advance the simulation by one step.
Source code in dcs_simulation_engine/api/client.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
models
Pydantic models and payload parsers for the API layer.
AssignmentSessionRequest
Bases: BaseModel
Payload for creating a session from the current assignment.
Source code in dcs_simulation_engine/api/models.py
270 271 272 273 274 | |
AssignmentSummary
Bases: BaseModel
Assignment summary returned by run endpoints.
Source code in dcs_simulation_engine/api/models.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
AuthRequest
Bases: BaseModel
Payload for API-key authentication checks.
Source code in dcs_simulation_engine/api/models.py
44 45 46 47 | |
AuthResponse
Bases: BaseModel
Response payload for successful API-key auth.
Source code in dcs_simulation_engine/api/models.py
50 51 52 53 54 55 | |
BranchSessionResponse
Bases: BaseModel
Response payload for a branched paused child session.
Source code in dcs_simulation_engine/api/models.py
111 112 113 114 115 116 117 118 | |
CharacterChoice
Bases: BaseModel
A selectable character option for setup screens.
Source code in dcs_simulation_engine/api/models.py
121 122 123 124 125 | |
CharacterSummary
Bases: BaseModel
A single character entry.
Source code in dcs_simulation_engine/api/models.py
471 472 473 474 475 | |
CharactersListResponse
Bases: BaseModel
Response payload for characters list endpoint.
Source code in dcs_simulation_engine/api/models.py
478 479 480 481 | |
ClearSessionEventFeedbackResponse
Bases: BaseModel
Response payload after feedback is removed from a session event.
Source code in dcs_simulation_engine/api/models.py
324 325 326 327 328 329 | |
CreateGameRequest
Bases: BaseModel
Payload for creating a new gameplay session.
Source code in dcs_simulation_engine/api/models.py
93 94 95 96 97 98 99 100 | |
CreateGameResponse
Bases: BaseModel
Response payload for newly created sessions.
Source code in dcs_simulation_engine/api/models.py
103 104 105 106 107 108 | |
DeleteCharacterResponse
Bases: BaseModel
Response payload after deletion.
Source code in dcs_simulation_engine/api/models.py
497 498 499 500 | |
EligibleAssignmentOption
Bases: BaseModel
One eligible game+PC+NPC option returned when assignment choice is allowed.
Source code in dcs_simulation_engine/api/models.py
228 229 230 231 232 233 234 235 236 237 238 | |
EligibleAssignmentOptionsResponse
Bases: BaseModel
List of eligible assignment options for a player.
Source code in dcs_simulation_engine/api/models.py
241 242 243 244 | |
FormSubmitRequest
Bases: BaseModel
Payload for submitting one pending run form group.
Source code in dcs_simulation_engine/api/models.py
255 256 257 258 259 | |
FormSubmitResponse
Bases: BaseModel
Response after storing one pending run form group.
Source code in dcs_simulation_engine/api/models.py
262 263 264 265 266 267 | |
FormTriggerResponse
Bases: BaseModel
Canonical form trigger returned by setup APIs.
Source code in dcs_simulation_engine/api/models.py
191 192 193 194 195 | |
GameSetupOptionsResponse
Bases: BaseModel
Preflight setup data for a specific game + authenticated player.
Source code in dcs_simulation_engine/api/models.py
128 129 130 131 132 133 134 135 136 137 | |
GameStatusResponse
Bases: BaseModel
Per-game status counts for a run.
Source code in dcs_simulation_engine/api/models.py
165 166 167 168 169 170 | |
GameSummary
Bases: BaseModel
A single game entry.
Source code in dcs_simulation_engine/api/models.py
457 458 459 460 461 462 | |
GamesListResponse
Bases: BaseModel
Response payload for games list endpoint.
Source code in dcs_simulation_engine/api/models.py
465 466 467 468 | |
NextAssignmentState
Bases: BaseModel
Backend-derived state for the next participant action.
Source code in dcs_simulation_engine/api/models.py
182 183 184 185 186 187 188 | |
PendingFormGroupResponse
Bases: BaseModel
Actionable group of forms the participant must submit.
Source code in dcs_simulation_engine/api/models.py
198 199 200 201 202 203 204 | |
ProgressResponse
Bases: BaseModel
Finite progress payload for the usability run.
Source code in dcs_simulation_engine/api/models.py
157 158 159 160 161 162 | |
RegistrationRequest
Bases: BaseModel
Payload for creating a new player and issuing an API key.
Source code in dcs_simulation_engine/api/models.py
29 30 31 32 33 34 | |
RegistrationResponse
Bases: BaseModel
Response payload for registration.
Source code in dcs_simulation_engine/api/models.py
37 38 39 40 41 | |
RemoteBootstrapResponse
Bases: BaseModel
Bootstrap response containing the newly issued remote admin key.
Source code in dcs_simulation_engine/api/models.py
74 75 76 77 78 79 | |
RemoteStatusResponse
Bases: BaseModel
Public status payload for remote-managed deployments.
Source code in dcs_simulation_engine/api/models.py
82 83 84 85 86 87 88 89 90 | |
RunStatusResponse
Bases: BaseModel
Aggregate status payload for a run.
Source code in dcs_simulation_engine/api/models.py
173 174 175 176 177 178 179 | |
SelectAssignmentRequest
Bases: BaseModel
Payload for player-directed assignment selection.
Source code in dcs_simulation_engine/api/models.py
247 248 249 250 251 252 | |
ServerConfigResponse
Bases: BaseModel
Response payload describing server capabilities.
Source code in dcs_simulation_engine/api/models.py
58 59 60 61 62 63 | |
SessionEventFeedback
Bases: BaseModel
Stored reaction, comment, and issue flags attached to one assistant message.
Source code in dcs_simulation_engine/api/models.py
295 296 297 298 299 300 301 302 303 | |
SessionSummary
Bases: BaseModel
A single in-memory session summary for list responses.
Source code in dcs_simulation_engine/api/models.py
277 278 279 280 281 282 283 284 285 286 | |
SessionsListResponse
Bases: BaseModel
Response payload for session list endpoint.
Source code in dcs_simulation_engine/api/models.py
289 290 291 292 | |
SetupResponse
Bases: BaseModel
Setup payload for the run landing page.
Source code in dcs_simulation_engine/api/models.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
StatusResponse
Bases: BaseModel
Response payload describing process liveness and uptime.
Source code in dcs_simulation_engine/api/models.py
66 67 68 69 70 71 | |
SubmitSessionEventFeedbackRequest
Bases: BaseModel
Payload for storing feedback on a single assistant session event.
Source code in dcs_simulation_engine/api/models.py
306 307 308 309 310 311 312 313 | |
SubmitSessionEventFeedbackResponse
Bases: BaseModel
Response payload after feedback is stored on a session event.
Source code in dcs_simulation_engine/api/models.py
316 317 318 319 320 321 | |
UpsertCharacterRequest
Bases: BaseModel
Payload for creating or updating a character.
Source code in dcs_simulation_engine/api/models.py
484 485 486 487 488 | |
UpsertCharacterResponse
Bases: BaseModel
Response payload after upsert.
Source code in dcs_simulation_engine/api/models.py
491 492 493 494 | |
WSAdvanceRequest
Bases: BaseModel
WebSocket frame for advancing the game.
Source code in dcs_simulation_engine/api/models.py
339 340 341 342 343 | |
WSAuthRequest
Bases: BaseModel
WebSocket first-message auth frame (browser clients only).
Source code in dcs_simulation_engine/api/models.py
332 333 334 335 336 | |
WSCloseRequest
Bases: BaseModel
WebSocket frame for closing a session.
Source code in dcs_simulation_engine/api/models.py
352 353 354 355 | |
WSClosedFrame
Bases: BaseModel
WebSocket frame indicating session closure.
Source code in dcs_simulation_engine/api/models.py
408 409 410 411 412 | |
WSErrorFrame
Bases: BaseModel
WebSocket frame describing a protocol or auth error.
Source code in dcs_simulation_engine/api/models.py
415 416 417 418 419 420 421 422 423 | |
WSEventFrame
Bases: BaseModel
WebSocket frame representing a single game event.
Source code in dcs_simulation_engine/api/models.py
371 372 373 374 375 376 377 378 379 380 381 382 383 | |
WSReplayEndFrame
Bases: BaseModel
WebSocket frame signaling the end of a historical event replay burst.
Source code in dcs_simulation_engine/api/models.py
449 450 451 452 453 454 | |
WSReplayEventFrame
Bases: BaseModel
WebSocket frame carrying one historical event during replay.
Source code in dcs_simulation_engine/api/models.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
WSReplayStartFrame
Bases: BaseModel
WebSocket frame signaling the start of a historical event replay burst.
Source code in dcs_simulation_engine/api/models.py
426 427 428 429 430 | |
WSSessionMetaFrame
Bases: BaseModel
WebSocket frame sent once after auth, carrying session metadata.
Source code in dcs_simulation_engine/api/models.py
361 362 363 364 365 366 367 368 | |
WSStatusFrame
Bases: BaseModel
WebSocket frame reporting current session status.
Source code in dcs_simulation_engine/api/models.py
397 398 399 400 401 402 403 404 405 | |
WSStatusRequest
Bases: BaseModel
WebSocket frame for requesting session status.
Source code in dcs_simulation_engine/api/models.py
346 347 348 349 | |
WSTurnEndFrame
Bases: BaseModel
WebSocket frame emitted at the end of each completed turn.
Source code in dcs_simulation_engine/api/models.py
386 387 388 389 390 391 392 393 394 | |
parse_ws_auth(raw)
Parse a first-message auth frame. Returns None if not an auth message.
Source code in dcs_simulation_engine/api/models.py
503 504 505 506 507 508 509 510 511 512 513 514 | |
parse_ws_request(raw)
Parse and validate a raw JSON websocket request payload.
Source code in dcs_simulation_engine/api/models.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
registry
In-memory session registry with TTL cleanup for FastAPI server sessions.
SessionEntry
dataclass
Represents one in-memory API session record.
Source code in dcs_simulation_engine/api/registry.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
touch()
Refresh the last-activity timestamp.
Source code in dcs_simulation_engine/api/registry.py
32 33 34 | |
SessionRegistry
Thread-safe in-memory session store with async TTL sweeping.
Source code in dcs_simulation_engine/api/registry.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
size
property
Current number of live session entries.
__init__(*, ttl_seconds=3600, sweep_interval_seconds=60)
Initialize registry settings and empty storage.
Source code in dcs_simulation_engine/api/registry.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
add(*, player_id, game_name, manager, assignment_id=None)
Create and store a new session entry.
Source code in dcs_simulation_engine/api/registry.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
claim_hydration(session_id)
Mark session_id as being hydrated.
Returns True if this caller won the race; False if another coroutine is already hydrating it.
Source code in dcs_simulation_engine/api/registry.py
97 98 99 100 101 102 103 104 105 106 107 | |
close(session_id)
Mark a session as closed but keep it until explicit removal/TTL expiry.
Source code in dcs_simulation_engine/api/registry.py
159 160 161 162 163 164 165 166 | |
get(session_id)
Get a session entry by id, or None if it does not exist.
Source code in dcs_simulation_engine/api/registry.py
92 93 94 95 | |
list_for_player(player_id)
List sessions owned by a specific player, newest first.
Source code in dcs_simulation_engine/api/registry.py
114 115 116 117 118 | |
mark_opening_sent(session_id)
Mark that the opening turn has already been sent.
Source code in dcs_simulation_engine/api/registry.py
127 128 129 130 131 132 | |
pause(session_id)
Mark a session as paused; keep it and its manager alive for resume.
Source code in dcs_simulation_engine/api/registry.py
134 135 136 137 138 139 140 141 | |
reinsert(session_id, entry)
Re-add a hydrated session under its original session_id.
Used after a process restart to restore a paused session that was
evicted from the in-memory registry. Raises ValueError if a live
entry already exists for this id (prevents a hydration race from
overwriting an already-connected session).
Source code in dcs_simulation_engine/api/registry.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
release_hydration(session_id)
Remove the pending-hydration marker (called on success or failure).
Source code in dcs_simulation_engine/api/registry.py
109 110 111 112 | |
remove(session_id)
Remove and return a session entry if it exists.
Source code in dcs_simulation_engine/api/registry.py
168 169 170 171 172 173 174 | |
set_active(session_id)
Mark a paused session as active again after a successful reconnect.
Source code in dcs_simulation_engine/api/registry.py
143 144 145 146 147 148 149 150 | |
set_provider(provider)
Attach a data provider so the TTL sweep can mark assignments interrupted.
Source code in dcs_simulation_engine/api/registry.py
227 228 229 | |
set_ws_connected(session_id, connected)
Update the WebSocket connection flag for a session.
Source code in dcs_simulation_engine/api/registry.py
152 153 154 155 156 157 | |
start()
async
Start background TTL sweeping if it is not already running.
Source code in dcs_simulation_engine/api/registry.py
231 232 233 234 235 | |
stop()
async
Stop the background TTL sweeper task.
Source code in dcs_simulation_engine/api/registry.py
237 238 239 240 241 242 243 244 | |
sweep_async(provider=None)
async
Async sweep variant that awaits async session finalization when available.
When provider is given, expired sessions that belong to an
run assignment are marked interrupted so the player can
start that assignment again.
Source code in dcs_simulation_engine/api/registry.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
touch(session_id)
Refresh a session's idle timer if present.
Source code in dcs_simulation_engine/api/registry.py
120 121 122 123 124 125 | |
hydrate_session_async(*, session_id, player_id, provider, registry)
async
Reconstruct a dormant paused session from DB and insert it into the registry.
Returns the hydrated SessionEntry on success, or None if:
- the session is not found / not paused in the DB,
- another coroutine won the hydration race,
- the snapshot schema is unsupported (logs a warning).
The returned entry has opening_sent=True and status="paused" so the
WS handler sends replay events instead of regenerating the opening turn.
Source code in dcs_simulation_engine/api/registry.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
routers
API router exports.
catalog
HTTP endpoints for listing, creating, updating, and deleting games and characters.
create_character(body, request)
async
Create a new character.
Source code in dcs_simulation_engine/api/routers/catalog.py
35 36 37 38 39 40 | |
delete_character(character_id, request)
async
Delete a character by id.
Source code in dcs_simulation_engine/api/routers/catalog.py
55 56 57 58 59 60 61 62 63 | |
list_characters_endpoint(request)
async
List available characters.
Source code in dcs_simulation_engine/api/routers/catalog.py
26 27 28 29 30 31 32 | |
list_games_endpoint()
List available games.
Source code in dcs_simulation_engine/api/routers/catalog.py
19 20 21 22 23 | |
update_character(character_id, body, request)
async
Update an existing character.
Source code in dcs_simulation_engine/api/routers/catalog.py
43 44 45 46 47 48 49 50 51 52 | |
play
Gameplay session creation and WebSocket interaction endpoints.
create_game(body, request)
async
Create a session-owned game instance and return websocket connect info.
Source code in dcs_simulation_engine/api/routers/play.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
play_ws(websocket, session_id)
async
WebSocket endpoint for game play requests and streamed turn events.
Source code in dcs_simulation_engine/api/routers/play.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | |
setup_options(game_name, request)
async
Return setup-ready authorization and valid character choices for a game.
Source code in dcs_simulation_engine/api/routers/play.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
remote
Remote deployment bootstrap, status, and export endpoints.
bootstrap_remote_deployment(request)
async
Seed the uploaded database snapshot and provision the remote admin access key.
Source code in dcs_simulation_engine/api/routers/remote.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
export_remote_database(request, format='tar.gz')
async
Stream an archive of the current database state to the remote admin.
Source code in dcs_simulation_engine/api/routers/remote.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
remote_status(request)
async
Return a public status summary for remote-managed run deployments.
Source code in dcs_simulation_engine/api/routers/remote.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
runs
Run-scoped endpoints for assignment-driven study flows.
create_run_session(body, request)
async
Create or resume a session for one run assignment.
Source code in dcs_simulation_engine/api/routers/runs.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
get_eligible_options(request)
async
Return eligible game/PC/NPC triplets for the authenticated player.
Source code in dcs_simulation_engine/api/routers/runs.py
287 288 289 290 291 292 293 294 295 296 297 | |
run_progress(request)
async
Return the current finite progress for the run.
Source code in dcs_simulation_engine/api/routers/runs.py
276 277 278 279 280 281 282 283 284 | |
run_setup(request)
async
Return run metadata, form schemas, and current player assignment state.
Source code in dcs_simulation_engine/api/routers/runs.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
run_status(request)
async
Return the current aggregate status for the run.
Source code in dcs_simulation_engine/api/routers/runs.py
322 323 324 325 326 327 328 329 330 | |
select_assignment(body, request)
async
Create an assignment for the authenticated player based on their explicit triplet selection.
Source code in dcs_simulation_engine/api/routers/runs.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
submit_run_form_group(body, request)
async
Store responses for one pending run form group.
Source code in dcs_simulation_engine/api/routers/runs.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
sessions
HTTP endpoints for listing in-memory API sessions.
branch_session(session_id, request)
async
Clone a persisted paused child session from an existing root session.
Source code in dcs_simulation_engine/api/routers/sessions.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
clear_session_event_feedback(session_id, event_id, request)
async
Remove feedback from one persisted NPC-message event.
Source code in dcs_simulation_engine/api/routers/sessions.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
get_session_reconstruction(session_id, request)
async
Return complete persisted metadata + event stream for transcript replay.
Source code in dcs_simulation_engine/api/routers/sessions.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
get_session_status(session_id, request)
async
Return the current status of a live session.
Used by the frontend to verify a stored session_id is still paused and resumable.
Source code in dcs_simulation_engine/api/routers/sessions.py
80 81 82 83 84 85 86 87 88 89 90 91 | |
list_sessions(request)
async
List active in-memory sessions for the player tied to the provided API key.
Source code in dcs_simulation_engine/api/routers/sessions.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
submit_session_event_feedback(session_id, event_id, body, request)
async
Store or overwrite feedback on one persisted NPC-message event.
Source code in dcs_simulation_engine/api/routers/sessions.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
users
Player registration, auth, and management endpoints.
anonymous_user(request)
async
Create an ephemeral anonymous player for runs that do not require registration.
Source code in dcs_simulation_engine/api/routers/users.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
auth_user(body, request)
async
Authenticate a user API key and return the associated player id.
Source code in dcs_simulation_engine/api/routers/users.py
110 111 112 113 114 115 116 | |
register_user(body, request)
async
Register a new player record and return a newly issued API key.
Source code in dcs_simulation_engine/api/routers/users.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
cli
CLI package.
app
Root cli app wiring.
main(ctx, quiet=typer.Option(False, '--quiet', '-q', help='Suppress non-error output.'), verbose=typer.Option(0, '-v', '--verbose', count=True, help='Increase verbosity: -v for INFO, -vv for DEBUG.'), yes=typer.Option(False, '--yes', '-y', help='Assume "yes" for all prompts (non-interactive mode).'), config=typer.Option(None, '--config', help='Optional global config file.', exists=False, dir_okay=False, file_okay=True, readable=True), mongo_uri=typer.Option(None, '--mongo-uri', envvar='MONGO_URI', help='MongoDB connection URI. Overrides MONGO_URI environment value.'), server_url=typer.Option('http://localhost:8000', '--server-url', envvar='DCS_SERVER_URL', help='DCS API server URL.'))
Initialize global CLI options and context.
Source code in dcs_simulation_engine/cli/app.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
bootstrap
CLI bootstrap: single entrypoint for backend wiring and lifecycle.
create_async_provider(*, mongo_uri=None)
async
Return an AsyncMongoProvider wired to a resolved MongoDB URI.
Source code in dcs_simulation_engine/cli/bootstrap.py
38 39 40 41 | |
create_provider_admin(*, mongo_uri=None)
Return a MongoAdmin wired to a resolved MongoDB URI.
Source code in dcs_simulation_engine/cli/bootstrap.py
50 51 52 53 | |
create_sync_db(*, mongo_uri=None)
Return a sync MongoDB database handle wired to a resolved MongoDB URI.
Source code in dcs_simulation_engine/cli/bootstrap.py
44 45 46 47 | |
commands
Command groups for the CLI.
database
CLI database administration commands.
backup(ctx, outdir=typer.Argument(help='Directory to write the backup to. A timestamped subdirectory is created inside.'))
Backup the entire database to a directory.
Source code in dcs_simulation_engine/cli/commands/database.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
dump(ctx, outdir=typer.Argument(..., help='Directory to write the dump to. A timestamped subdirectory is created inside.', file_okay=False, dir_okay=True, writable=True, readable=True, resolve_path=False))
Dump all Mongo collections to JSON files.
Source code in dcs_simulation_engine/cli/commands/database.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
keygen(ctx)
Generate a deployment-ready admin key without storing it anywhere.
Source code in dcs_simulation_engine/cli/commands/database.py
68 69 70 71 72 73 74 | |
seed(ctx, seeds_dir=typer.Argument(help='Directory of JSON/NDJSON seed files. Defaults to database_seeds/dev.'))
Seed the database from JSON files.
Source code in dcs_simulation_engine/cli/commands/database.py
14 15 16 17 18 19 20 21 22 | |
engine
CLI commands for managing the local Docker Compose engine stack.
start(ctx, config=typer.Option(DEFAULT_RUN_CONFIG_PATH, '--config', envvar='DCS_RUN_CONFIG', help='Run config YAML to use for this engine run.'), headless=typer.Option(False, '--headless', help='Start only the database and API services.'), api_port=typer.Option(8000, '--api-port', envvar='DCS_API_PORT', help='Host port for the API service.'), ui_port=typer.Option(5173, '--ui-port', envvar='DCS_UI_PORT', help='Host port for the UI service.'), db_port=typer.Option(27017, '--db-port', envvar='DCS_DB_PORT', help='Host port for the database service.'), no_build=typer.Option(False, '--no-build', help='Start existing images without rebuilding them.'), follow_logs=typer.Option(False, '--follow-logs', help='Follow service logs after startup succeeds. Ctrl-C stops following logs, not the services.'), timeout_seconds=typer.Option(120, '--timeout', envvar='DCS_ENGINE_TIMEOUT_SECONDS', help='Seconds to wait for services to become ready.'))
Start the engine.
Source code in dcs_simulation_engine/cli/commands/engine.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
status(ctx, api_port=typer.Option(8000, '--api-port', envvar='DCS_API_PORT', help='Host port for the API service.'), ui_port=typer.Option(5173, '--ui-port', envvar='DCS_UI_PORT', help='Host port for the UI service.'), json_output=typer.Option(False, '--json', help='Print the status payload as JSON.'))
Check local engine status (service health and run progress).
Source code in dcs_simulation_engine/cli/commands/engine.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
stop(ctx, clean=typer.Option(False, '--clean', help='Also remove Docker volumes, including local database state. Does not delete ./runs.'))
Stop the engine.
Source code in dcs_simulation_engine/cli/commands/engine.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
remote
Remote Fly deployment and lifecycle commands.
deploy(ctx, config=typer.Option(Path('examples/run_configs/demo.yml'), '--config', dir_okay=False, file_okay=True, help='Run config YAML to deploy. Pass a local path, or a packaged example like demo.yml.'), openrouter_key=typer.Option(..., '--openrouter-key', envvar='OPENROUTER_API_KEY', help='OpenRouter API key forwarded to the remote API deployment.'), fly_io_key=typer.Option(None, '--fly-io-key', envvar='FLY_API_TOKEN', help='Fly API token used for deploy and destroy operations.'), mongo_seed_path=typer.Option(..., '--mongo-seed-path', dir_okay=True, file_okay=True, help='Mongo bootstrap seed source: a local .zip/.tar.gz archive, .json/.ndjson dump, directory, or packaged seed name like prod.'), admin_key=typer.Option(None, '--admin-key', envvar='DCS_ADMIN_KEY', help='Optional explicit remote admin key to install during bootstrap. Must match the dcs-ak- key format.'), region=typer.Option(None, '--regions', '--region', help='Fly region(s) to try in order. Example: --regions lax sjc dfw'), only_app=typer.Option(None, '--only-app', help='Redeploy only the selected app(s): api, ui, or db. Repeat the flag to deploy multiple apps.'), api_app=typer.Option(None, '--api-app', help='Optional explicit Fly app name for the API.'), ui_app=typer.Option(None, '--ui-app', help='Optional explicit Fly app name for the UI.'), db_app=typer.Option(None, '--db-app', help='Optional explicit Fly app name for MongoDB.'), json_output=typer.Option(False, '--json', help='Print the deployment result as JSON.'))
Deploy one remote-managed stack to Fly as API, UI, and Mongo apps.
Source code in dcs_simulation_engine/cli/commands/remote.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
save(ctx, uri=typer.Option(..., '--uri', help='Remote API base URL.'), admin_key=typer.Option(..., '--admin-key', envvar='DCS_ADMIN_KEY', help='Admin access key returned by remote deploy.'), save_db_path=typer.Option(..., '--save-db-path', dir_okay=False, file_okay=True, writable=True, resolve_path=True, help='Local path for the downloaded database export archive (.tar.gz or .zip).'))
Download the remote database export archive to a local file.
Source code in dcs_simulation_engine/cli/commands/remote.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
status(ctx, uri=typer.Option(..., '--uri', help='Remote API base URL.'), admin_key=typer.Option(..., '--admin-key', envvar='DCS_ADMIN_KEY', help='Saved remote admin access key.'), json_output=typer.Option(False, '--json', help='Print the status result as JSON.'))
Return the authenticated status payload for one remote deployment.
Source code in dcs_simulation_engine/cli/commands/remote.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
stop(ctx, uri=typer.Option(..., '--uri', help='Remote API base URL.'), admin_key=typer.Option(..., '--admin-key', envvar='DCS_ADMIN_KEY', help='Admin access key returned by remote deploy.'), save_db_path=typer.Option(..., '--save-db-path', dir_okay=False, file_okay=True, writable=True, resolve_path=True, help='Local path for the downloaded database export archive (.tar.gz or .zip).'), api_app=typer.Option(..., '--api-app', help='Fly API app name.'), ui_app=typer.Option(..., '--ui-app', help='Fly UI app name.'), db_app=typer.Option(..., '--db-app', help='Fly Mongo app name.'), fly_io_key=typer.Option(None, '--fly-io-key', envvar='FLY_API_TOKEN', help='Fly API token used to destroy the remote apps.'))
Save the remote DB archive, then destroy all Fly apps for the run.
Source code in dcs_simulation_engine/cli/commands/remote.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
server
CLI server command.
server(ctx, host=typer.Option(DEFAULT_HOST, '--host', envvar='DCS_SERVER_HOST', help='Host to bind the server to.'), port=typer.Option(DEFAULT_PORT, '--port', envvar='DCS_SERVER_PORT', help='Port to bind the server to.'), ttl_seconds=typer.Option(DEFAULT_SESSION_TTL_SECONDS, '--session-ttl', envvar='DCS_SESSION_TTL_SECONDS', help='Session TTL in seconds.'), sweep_interval_seconds=typer.Option(DEFAULT_SWEEP_INTERVAL_SECONDS, '--sweep-interval', envvar='DCS_SESSION_SWEEP_INTERVAL_SECONDS', help='Session sweep interval in seconds.'), mongo_seed_dir=typer.Option(None, '--mongo-seed-dir', envvar='DCS_MONGO_SEED_DIR', help='Seed MongoDB from this directory of JSON/NDJSON files on startup.'), dump_dir=typer.Option(None, '--dump', envvar='DCS_DUMP_DIR', help='Dump all Mongo collections to this directory when the server shuts down.'), fake_ai_response=typer.Option(None, '--fake-ai-response', help='Return this string for all AI responses instead of calling OpenRouter.'), config=typer.Option(DEFAULT_RUN_CONFIG_PATH, '--config', envvar='DCS_RUN_CONFIG', help='Run config YAML to use for this engine run.'), remote_managed=typer.Option(False, '--remote-managed', envvar='DCS_REMOTE_MANAGED', help='Run the server as a remote-managed deployment with bootstrap/export endpoints enabled.'), bootstrap_token=typer.Option(None, '--bootstrap-token', envvar='DCS_REMOTE_BOOTSTRAP_TOKEN', help='One-time bootstrap token used to seed a remote-managed deployment.'), cors_origin=typer.Option(None, '--cors-origin', help='Additional allowed CORS origin. Repeat the flag to allow multiple origins.'))
Run the DCS API server.
Source code in dcs_simulation_engine/cli/commands/server.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
workflow
Workflow CLI subcommands for reports, HITL, and publishing.
common
Shared cli utilities.
GlobalOptions
dataclass
Global options for the CLI.
Source code in dcs_simulation_engine/cli/common.py
26 27 28 29 30 31 32 33 34 | |
echo(ctx, message, style='white')
Respect global quiet flag; print only if not quiet.
Source code in dcs_simulation_engine/cli/common.py
45 46 47 48 49 50 51 52 53 54 | |
get_client(ctx)
Return an APIClient configured from the CLI context.
Source code in dcs_simulation_engine/cli/common.py
37 38 39 40 41 42 | |
seed_database(ctx, seed_dir)
Seed the database from JSON/NDJSON files.
Source code in dcs_simulation_engine/cli/common.py
72 73 74 75 76 77 78 79 80 81 | |
step(msg)
Context manager for displaying a step with a spinner.
Source code in dcs_simulation_engine/cli/common.py
57 58 59 60 61 62 63 64 65 66 67 68 69 | |
core
Di Simulation Engine core components.
assignment_strategies
Assignment strategy registry.
get_assignment_strategy(strategy_name)
Resolve one registered assignment strategy by name.
Source code in dcs_simulation_engine/core/assignment_strategies/__init__.py
43 44 45 46 47 48 49 | |
base
Assignment strategy protocol for run workflows.
AssignmentCandidate
Bases: NamedTuple
One candidate assignment returned by a strategy.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
10 11 12 13 14 15 16 | |
AssignmentStrategy
Bases: Protocol
Behavior contract for run assignment strategies.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
compute_progress_async(*, provider, config)
async
Return run progress payload for the public API.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
30 31 | |
compute_status_async(*, provider, config)
async
Return run status payload for the public API.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
33 34 | |
get_or_create_assignment_async(*, provider, config, player)
async
Return the current assignment for a player or create one.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
45 46 47 48 49 50 51 52 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return candidate assignments for the player under the current strategy.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
36 37 38 39 40 41 42 43 | |
max_assignments_per_player(*, config)
Return the maximum number of assignments one player may complete.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
27 28 | |
validate_config(*, config)
Validate strategy-specific config constraints.
Source code in dcs_simulation_engine/core/assignment_strategies/base.py
24 25 | |
common
Shared helpers for candidate-based assignment strategies.
CandidateAssignmentStrategy
Shared implementation for strategies that emit candidate assignments.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
compute_progress_async(*, provider, config)
async
Compute quota-based run progress for the configured games.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
compute_status_async(*, provider, config)
async
Compute per-game status counts and overall run openness.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
get_eligible_options_async(*, provider, config, player)
async
Return serialized candidate assignment options.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
132 133 134 135 136 137 138 139 140 141 | |
get_or_create_assignment_async(*, provider, config, player)
async
Return an existing assignment or create one from this strategy's candidates.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return ordered candidate assignments for the player.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
122 123 124 125 126 127 128 129 130 | |
max_assignments_per_player(*, config)
Return the configured per-player assignment cap for this strategy.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
51 52 53 54 55 56 | |
validate_config(*, config)
Validate strategy config shared across candidate-based strategies.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
40 41 42 43 44 45 46 47 48 49 | |
candidate_to_dict(candidate)
Serialize one candidate for API responses.
Source code in dcs_simulation_engine/core/assignment_strategies/common.py
26 27 28 29 30 31 32 | |
expertise_matched_character_batch
Expertise-matched batch assignment strategy.
ExpertiseMatchedCharacterBatchAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include triplets for the current NPC batch until its games are completed.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_batch.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return triplets for the current NPC batch until its configured games are completed.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_batch.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
expertise_matched_character_choice
Expertise-matched choice assignment strategy.
ExpertiseMatchedCharacterChoiceAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include allowed triplets ordered with expertise-matching NPCs first.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_choice.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return allowed triplets ordered with expertise-matching NPCs first.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_choice.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
expertise_matched_character_next
Expertise-matched next assignment strategy.
ExpertiseMatchedCharacterNextAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include allowed triplets ordered with expertise-matching NPCs first.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_next.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return allowed triplets ordered with expertise-matching NPCs first.
Source code in dcs_simulation_engine/core/assignment_strategies/expertise_matched_character_next.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
full_character_access
Full-character-access assignment strategy.
FullCharacterAccessAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include every allowed game + pc + npc triplet.
Source code in dcs_simulation_engine/core/assignment_strategies/full_character_access.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return every allowed game + pc + npc triplet.
Source code in dcs_simulation_engine/core/assignment_strategies/full_character_access.py
14 15 16 17 18 19 20 21 22 | |
least_played_combination_next
Least-played-combination assignment strategy.
LeastPlayedCombinationNextAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include triplets for the globally least-played game + npc group.
Source code in dcs_simulation_engine/core/assignment_strategies/least_played_combination_next.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return triplets for the globally least-played game + npc group.
Source code in dcs_simulation_engine/core/assignment_strategies/least_played_combination_next.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
max_contrast_pairing
Max-contrast pairing assignment strategy.
MaxContrastPairingAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include allowed triplets ordered by descending pc-to-npc divergence.
Source code in dcs_simulation_engine/core/assignment_strategies/max_contrast_pairing.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return allowed triplets ordered by descending pc-to-npc divergence.
Source code in dcs_simulation_engine/core/assignment_strategies/max_contrast_pairing.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
next_incomplete_combination
Next-incomplete-combination assignment strategy.
NextIncompleteCombinationAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include triplets for the first incomplete game + npc group in config order.
Source code in dcs_simulation_engine/core/assignment_strategies/next_incomplete_combination.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return triplets for the first incomplete game + npc group in config order.
Source code in dcs_simulation_engine/core/assignment_strategies/next_incomplete_combination.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
progressive_divergence_assignment
Progressive-divergence assignment strategy.
ProgressiveDivergenceAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include triplets ordered by descending divergence from the last completed NPC.
Source code in dcs_simulation_engine/core/assignment_strategies/progressive_divergence_assignment.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return triplets ordered by descending divergence from the player's last completed NPC.
Source code in dcs_simulation_engine/core/assignment_strategies/progressive_divergence_assignment.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
random_unique_game
Random unique game assignment strategy module.
RandomUniqueGameAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include allowed triplets from games the player has not already been assigned.
Source code in dcs_simulation_engine/core/assignment_strategies/random_unique_game.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
generate_remaining_assignments_async(*, provider, config, player)
async
Pre-generate remaining unique-game assignments for legacy tests.
Source code in dcs_simulation_engine/core/assignment_strategies/random_unique_game.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return allowed triplets from unassigned games in deterministic random game order.
Source code in dcs_simulation_engine/core/assignment_strategies/random_unique_game.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
validate_config(*, config)
Validate the legacy unique-game constraint for this strategy.
Source code in dcs_simulation_engine/core/assignment_strategies/random_unique_game.py
16 17 18 19 20 21 22 23 24 25 | |
unplayed_combination_choice
Unplayed-combination assignment strategy.
UnplayedCombinationChoiceAssignmentStrategy
Bases: CandidateAssignmentStrategy
Candidate assignments include allowed triplets ordered with never-played triplets first.
Source code in dcs_simulation_engine/core/assignment_strategies/unplayed_combination_choice.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
list_candidate_assignments_async(*, provider, config, player)
async
Return allowed triplets ordered by ascending player completion count for the exact triplet.
Source code in dcs_simulation_engine/core/assignment_strategies/unplayed_combination_choice.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
constants
Constants for core module.
engine_run_manager
Engine-run orchestration for assignment-driven flows.
EngineRunManager
Resolves assignment workflows for the single configured engine run.
Source code in dcs_simulation_engine/core/engine_run_manager.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | |
__init__(run_config, provider=None)
Initialize the manager with the active run config and optional provider.
Source code in dcs_simulation_engine/core/engine_run_manager.py
32 33 34 35 36 | |
assignment_display_metadata_async(*, provider, game_name, pc_hid, npc_hid)
async
classmethod
Return display metadata for an assignment triplet.
Source code in dcs_simulation_engine/core/engine_run_manager.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
compute_progress_async(*, provider)
async
classmethod
Compute finite usability progress from assignment state.
Source code in dcs_simulation_engine/core/engine_run_manager.py
63 64 65 66 67 68 | |
compute_status_async(*, provider)
async
classmethod
Compute quota-centric status counts for a run.
Source code in dcs_simulation_engine/core/engine_run_manager.py
70 71 72 73 74 75 | |
create_player_choice_assignment_async(*, provider, player, game_name, pc_hid, npc_hid)
async
classmethod
Create a specific assignment for a player who selected one explicit candidate.
Source code in dcs_simulation_engine/core/engine_run_manager.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | |
enrich_assignment_option_async(*, provider, option)
async
classmethod
Attach display metadata to an assignment option.
Source code in dcs_simulation_engine/core/engine_run_manager.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
ensure_run_async(*, provider)
async
classmethod
Persist the run config snapshot if it is not already stored.
Source code in dcs_simulation_engine/core/engine_run_manager.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
get_assignment_for_player_async(*, provider, player_id, assignment_id)
async
classmethod
Return one assignment if it belongs to the requested player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
get_eligible_options_async(*, provider, player)
async
classmethod
Return selectable {game_name, pc_hid, npc_hid} options for the player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
735 736 737 738 739 740 741 742 743 744 | |
get_latest_assignment_for_player_async(*, provider, player_id)
async
classmethod
Return the latest assignment for a player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
621 622 623 624 625 626 627 | |
get_or_create_assignment_async(*, provider, player)
async
classmethod
Return the active assignment for a player or create one on demand.
Source code in dcs_simulation_engine/core/engine_run_manager.py
450 451 452 453 454 455 456 457 458 459 460 461 462 | |
get_player_state_async(*, provider, player_id)
async
classmethod
Return the assignment state visible to one authenticated player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
get_run_config()
classmethod
Return the active run config.
Source code in dcs_simulation_engine/core/engine_run_manager.py
38 39 40 41 42 43 | |
handle_session_terminal_state_async(*, provider, assignment_id, exit_reason)
async
classmethod
Map a gameplay terminal reason onto an assignment lifecycle status.
Source code in dcs_simulation_engine/core/engine_run_manager.py
568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
normalize_form_submissions(*, forms, responses)
classmethod
Validate and normalize submitted answers for one or more named forms.
Source code in dcs_simulation_engine/core/engine_run_manager.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
pending_form_groups_async(*, provider, config, player_id, assignments=None, active_assignment=None, has_finished_run=None)
async
classmethod
Return actionable form groups still required for a player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
resolve_assignment_state_async(*, provider, player, player_assignments=None, active_assignment=None)
async
classmethod
Return the current assignment or selectable next options for a player.
Source code in dcs_simulation_engine/core/engine_run_manager.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
start_assignment_session_async(*, provider, registry, player, source='run', assignment_id=None)
async
classmethod
Start or resume gameplay for the requested assignment.
Source code in dcs_simulation_engine/core/engine_run_manager.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |
store_form_payloads_async(*, provider, assignment_id, forms_payload)
async
classmethod
Store one or more named form payloads on an assignment row.
Source code in dcs_simulation_engine/core/engine_run_manager.py
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | |
store_player_form_payloads_async(*, provider, player_id, forms_payload)
async
classmethod
Store one or more named player-scoped form payloads on the forms record.
Source code in dcs_simulation_engine/core/engine_run_manager.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
submit_form_group_async(*, provider, player_id, group_id, responses)
async
classmethod
Store responses for one currently pending form group.
Source code in dcs_simulation_engine/core/engine_run_manager.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
forms
Shared form models for run workflows.
Form
Bases: BaseModel
Named run form shown at a registered run trigger.
Source code in dcs_simulation_engine/core/forms.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
assign_question_keys()
Ensure every question has a stable key.
Source code in dcs_simulation_engine/core/forms.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
name_format(value)
classmethod
Normalize and validate form names.
Source code in dcs_simulation_engine/core/forms.py
96 97 98 99 100 101 102 103 | |
FormQuestion
Bases: BaseModel
Question model used by run forms.
Source code in dcs_simulation_engine/core/forms.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
validate_question()
Validate options vs answer type.
Source code in dcs_simulation_engine/core/forms.py
59 60 61 62 63 64 65 66 | |
FormTrigger
Bases: BaseModel
Canonical trigger for run forms.
Source code in dcs_simulation_engine/core/forms.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
validate_registered_trigger()
Validate event registration and v1 match support.
Source code in dcs_simulation_engine/core/forms.py
77 78 79 80 81 82 83 84 | |
game
Base classes for new-style game implementations.
BaseGameOverrides
Bases: BaseModel
Common overridable parameters shared across all games.
Run configs may supply any of these fields in a game's overrides block.
Subclass this in each game to add game-specific overridable fields.
Source code in dcs_simulation_engine/core/game.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
Game
Bases: ABC
Abstract base class.
Provides a concrete step() that handles the full turn lifecycle:
setup on first call, finish-flow routing, command dispatch, input
validation, and scene advancement. Subclasses only need to implement
the game-specific pieces.
Each concrete subclass must also declare an inner Overrides model
(subclass of BaseGameOverrides) listing every kwarg a run config
may supply.
Each concrete subclass must also define GAME_NAME and GAME_DESCRIPTION class attributes with non-empty string values.
Source code in dcs_simulation_engine/core/game.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | |
exit_reason
property
Reason the game ended, or empty string.
exited
property
True if the game has ended.
Overrides
Bases: BaseGameOverrides
Base overrides — no additional fields.
Concrete games replace this with their own typed model.
Source code in dcs_simulation_engine/core/game.py
151 152 153 154 155 | |
__init__(*, pc, npc, engine, player_retry_budget=None, simulator_recovery_budget=None, max_input_length=None, pcs_allowed=None, npcs_allowed=None)
Initialise shared game state. Call via super().init() in subclasses.
Source code in dcs_simulation_engine/core/game.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
__init_subclass__(**kwargs)
Enforce that concrete game subclasses define GAME_NAME and GAME_DESCRIPTION.
Source code in dcs_simulation_engine/core/game.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
build_base_init_kwargs(overrides)
classmethod
Build common constructor kwargs from validated overrides.
Subclasses can use this in create_from_context and only add
game-specific constructor arguments.
Source code in dcs_simulation_engine/core/game.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
create_from_context(pc, npc, **kwargs)
abstractmethod
classmethod
Factory method called by SessionManager.
Receives character records and any run-config kwargs (validated against
cls.Overrides). Returns a fully initialised Game instance.
Source code in dcs_simulation_engine/core/game.py
846 847 848 849 850 851 852 853 | |
exit(reason)
Mark the game as ended.
Source code in dcs_simulation_engine/core/game.py
488 489 490 491 492 493 494 | |
export_state()
Return a JSON-serialisable snapshot of this game's mutable state.
Must include every field needed to restore behaviour exactly — lifecycle
flags, retry budgets, state-machine booleans, collected player inputs,
and evaluation payloads. The returned dict is stored under the
game_state key of the session runtime_state document.
Source code in dcs_simulation_engine/core/game.py
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
get_abilities_content()
abstractmethod
Content for the /abilities command response.
Source code in dcs_simulation_engine/core/game.py
728 729 730 | |
get_command_handler(cmd)
Return a zero-argument async-generator handler for extra commands.
Override to support commands beyond /help, /abilities, and
the /finish. Return None for unrecognised commands so
SessionManager can handle them.
Source code in dcs_simulation_engine/core/game.py
753 754 755 756 757 758 759 760 | |
get_help_content()
abstractmethod
Content for the /help command response.
Source code in dcs_simulation_engine/core/game.py
724 725 726 | |
get_setup_content()
Content for the initial enter message. Defaults to get_help_content().
Source code in dcs_simulation_engine/core/game.py
720 721 722 | |
get_transcript()
Return the filtered game transcript (opening + successful turns only).
Source code in dcs_simulation_engine/core/game.py
506 507 508 | |
import_state(state)
Restore mutable state from a snapshot produced by export_state.
Called by SessionManager.create_from_snapshot immediately after the
game instance is constructed via create_from_context.
Source code in dcs_simulation_engine/core/game.py
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | |
on_finish()
abstractmethod
async
Called when /finish is issued.
Simple games call self.exit() and yield a closing message.
Multi-step games set self._in_finish_flow = True and yield a
question; subsequent inputs are routed to on_finish_input().
Source code in dcs_simulation_engine/core/game.py
732 733 734 735 736 737 738 739 740 741 | |
on_finish_input(user_input)
async
Handle user input during a multi-step finish flow.
Override when the finish phase requires one or more follow-up inputs (e.g. a confidence-rating question after a prediction). The default implementation is a no-op.
Source code in dcs_simulation_engine/core/game.py
743 744 745 746 747 748 749 750 751 | |
parse_overrides(raw)
classmethod
Validate and coerce a raw overrides dict from the run config.
Source code in dcs_simulation_engine/core/game.py
176 177 178 179 180 181 | |
step(user_input=None)
async
Advance the game one turn, yielding one or more GameEvents.
Routing order:
1. Exited → no-op.
2. First call → setup phase (welcome message + opening scene).
3. In finish flow → delegate to on_finish_input().
4. Command (starts with /) → dispatch to command handler.
5. Normal input → length check, then engine step (validate + update).
Source code in dcs_simulation_engine/core/game.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
GameEvent
Bases: NamedTuple
A single event yielded by a game step.
Source code in dcs_simulation_engine/core/game.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
now(*, type, content, command_response=False, failure_type=None, retries_remaining=None, exit_reason=None, provider=None, provider_status_code=None, provider_code=None)
classmethod
Build an event stamped with the current wall-clock time.
Source code in dcs_simulation_engine/core/game.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
game_config
Base game config module.
GameConfig
Bases: SerdeMixin, BaseModel
Top-level configuration for the game.
Source code in dcs_simulation_engine/core/game_config.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
from_game_class(game_cls, *, overrides=None)
classmethod
Build a GameConfig from a concrete Game class and optional run overrides.
Source code in dcs_simulation_engine/core/game_config.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
get_game_class()
Dynamically import and return the configured game class.
Source code in dcs_simulation_engine/core/game_config.py
43 44 45 46 47 | |
get_game_class_instance()
Dynamically import and instantiate the game engine class.
Source code in dcs_simulation_engine/core/game_config.py
49 50 51 | |
get_valid_characters(*, player_id=None, provider, pc_eligible_only=False)
Return (valid_pcs, valid_npcs) as (display_string, hid) tuples.
Source code in dcs_simulation_engine/core/game_config.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
get_valid_characters_async(*, player_id=None, provider, pc_eligible_only=False)
async
Async-safe variant of get_valid_characters for async providers.
Source code in dcs_simulation_engine/core/game_config.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
load(path)
classmethod
Load a GameConfig from a YAML file.
Source code in dcs_simulation_engine/core/game_config.py
75 76 77 78 | |
run_config
Run configuration models and static validation helpers.
RunConfig
Bases: SerdeMixin, BaseModel
Top-level run configuration.
Source code in dcs_simulation_engine/core/run_config.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
assignment_strategy
property
Expose the existing assignment-strategy view for run configs.
game_names
property
Return configured game names in declaration order.
registration_required
property
Return whether human players must register before playing.
form_groups_for_trigger(*, event)
Return configured form groups for one trigger event.
Source code in dcs_simulation_engine/core/run_config.py
88 89 90 91 92 93 94 95 96 97 98 | |
forms_for_trigger(trigger=None, *, event=None)
Return forms matching one trigger event string.
Source code in dcs_simulation_engine/core/run_config.py
83 84 85 86 | |
load(path)
classmethod
Load a run config from YAML.
Source code in dcs_simulation_engine/core/run_config.py
78 79 80 81 | |
normalize_forms(value)
classmethod
Accept null forms and mapping-style form declarations.
Source code in dcs_simulation_engine/core/run_config.py
58 59 60 61 62 63 64 65 66 67 68 | |
validate_forms()
Fail loudly when form names collide after normalization.
Source code in dcs_simulation_engine/core/run_config.py
70 71 72 73 74 75 76 | |
RunConfigGame
Bases: BaseModel
One game included in a run, plus game-owned overrides.
Source code in dcs_simulation_engine/core/run_config.py
20 21 22 23 24 25 26 | |
RunConfigNextGameStrategy
Bases: BaseModel
Next-game assignment strategy configuration.
Source code in dcs_simulation_engine/core/run_config.py
37 38 39 40 41 42 | |
RunConfigStrategy
Bases: BaseModel
Assignment strategy selector plus strategy-specific parameters.
Source code in dcs_simulation_engine/core/run_config.py
29 30 31 32 33 34 | |
RunConfigUI
Bases: BaseModel
User-interface options for a run.
Source code in dcs_simulation_engine/core/run_config.py
12 13 14 15 16 17 | |
validate_run_config_references(config)
Validate static references in a run config without runtime side effects.
Source code in dcs_simulation_engine/core/run_config.py
128 129 130 131 132 133 134 135 136 137 138 | |
session_event_recorder
Session event persistence for deterministic transcript reconstruction.
RecordedSessionEvent
Bases: NamedTuple
Metadata for an event that has been queued for persistence.
Source code in dcs_simulation_engine/core/session_event_recorder.py
256 257 258 259 260 | |
SessionEventRecorder
Session-scoped persistence helper for sessions + session_events.
Source code in dcs_simulation_engine/core/session_event_recorder.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
flush_pending()
async
Force currently buffered event docs to Mongo.
Source code in dcs_simulation_engine/core/session_event_recorder.py
92 93 94 | |
ValidationEventRecorder
Bases: SessionEventRecorder
Sidecar recorder for validation violations that shares event sequencing.
Source code in dcs_simulation_engine/core/session_event_recorder.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
session_manager
SessionManager: drives new-style Game classes.
SessionManager
Manages a single session of a Game.
Source code in dcs_simulation_engine/core/session_manager.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | |
exit_reason
property
Return the terminal reason string, if available.
exited
property
Return True when the session or game lifecycle is finished.
runtime_seconds
property
Return elapsed runtime in seconds.
turns
property
Return completed AI turns.
__init__(name, game, game_config, provider, source='unknown', player_id=None, stopping_conditions=None)
Initialize session state, runtime counters, and persistence hooks.
Source code in dcs_simulation_engine/core/session_manager.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
configure_run_config(run_config)
classmethod
Install the active run config used by this single engine run.
Source code in dcs_simulation_engine/core/session_manager.py
57 58 59 60 61 | |
create_async(game, provider, source='unknown', pc_choice=None, npc_choice=None, player_id=None)
async
classmethod
Create a session for async runtime paths.
Source code in dcs_simulation_engine/core/session_manager.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
create_from_snapshot(*, snapshot, session_record, provider)
async
classmethod
Reconstruct a SessionManager from a persisted runtime snapshot.
session_record is a SessionRecord from the DB. The game
instance is built fresh via create_from_context and then hydrated
from the snapshot so its state machine, retry budget, and LLM history
are fully restored.
Raises ValueError if the snapshot schema_version is unknown;
the caller should catch this and fall back to starting a new session.
Source code in dcs_simulation_engine/core/session_manager.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
exit_async(reason)
async
Mark session ended, finalize persistence, and close recorder.
Source code in dcs_simulation_engine/core/session_manager.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
export_snapshot()
Return a JSON-serialisable runtime snapshot for durable resume.
The snapshot captures everything needed to reconstruct this session after a process restart: turn count, session lifecycle flags, and the full game state including UpdaterClient conversation history.
Source code in dcs_simulation_engine/core/session_manager.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
flush_persistence_async()
async
Flush any queued transcript events so follow-on writes can target them safely.
Source code in dcs_simulation_engine/core/session_manager.py
383 384 385 386 387 388 | |
get_game_config_cached(game)
classmethod
Return a defensive copy of a cached game config, loading it on first use.
Source code in dcs_simulation_engine/core/session_manager.py
109 110 111 112 113 | |
persist_runtime_snapshot_async()
async
Persist the current runtime snapshot for resume/branch consumers.
Source code in dcs_simulation_engine/core/session_manager.py
390 391 392 | |
preload_game_configs()
classmethod
Load all built-in game configs into the in-memory cache.
Source code in dcs_simulation_engine/core/session_manager.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
save()
Compatibility no-op; session transcript writes now use session_events.
Source code in dcs_simulation_engine/core/session_manager.py
394 395 396 397 | |
start_persistence(*, session_id)
async
Initialize session + event persistence once session_id is assigned.
Source code in dcs_simulation_engine/core/session_manager.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
step_async(user_input=None)
async
Advance one turn asynchronously and return normalized event dicts.
Source code in dcs_simulation_engine/core/session_manager.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
dal
Data abstraction layer.
base
DAL base: record types and DataProvider interface.
AssignmentRecord
Bases: NamedTuple
A persisted assignment row.
Source code in dcs_simulation_engine/dal/base.py
67 68 69 70 71 72 73 74 75 76 77 | |
CharacterRecord
Bases: NamedTuple
A character loaded from the data store.
Source code in dcs_simulation_engine/dal/base.py
6 7 8 9 10 11 12 | |
DataProvider
Abstract data provider interface.
Subclasses implement storage-specific logic. All methods raise NotImplementedError by default.
Source code in dcs_simulation_engine/dal/base.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
append_session_event(*, session_id, player_id, direction, event_type, event_source, content, content_format, turn_index, visible_to_user)
Append one owned session event to an existing persisted session.
Source code in dcs_simulation_engine/dal/base.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
branch_session(*, session_id, player_id, branched_at)
Clone a persisted session into a new paused child session.
Source code in dcs_simulation_engine/dal/base.py
146 147 148 149 150 151 152 153 154 | |
clear_session_event_feedback(*, session_id, player_id, event_id)
Remove feedback from a persisted NPC-message event.
Source code in dcs_simulation_engine/dal/base.py
198 199 200 201 202 203 204 205 206 | |
create_assignment(*, assignment_doc, allow_concurrent=False)
Persist a new run assignment row.
Source code in dcs_simulation_engine/dal/base.py
231 232 233 | |
create_player(*, player_data, player_id=None, issue_access_key=False, access_key=None)
Create or upsert a player.
Returns:
| Type | Description |
|---|---|
tuple[PlayerRecord, str | None]
|
(record, raw_key) where raw_key is None unless an access key was issued or explicitly provided. |
Source code in dcs_simulation_engine/dal/base.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
delete_character(character_id)
Delete a character by id.
Source code in dcs_simulation_engine/dal/base.py
130 131 132 | |
delete_player(player_id)
Delete a player by id.
Source code in dcs_simulation_engine/dal/base.py
134 135 136 | |
get_active_assignment(*, player_id)
Return the current active assignment for one player.
Source code in dcs_simulation_engine/dal/base.py
239 240 241 | |
get_assignment(*, assignment_id)
Return one assignment row by assignment id.
Source code in dcs_simulation_engine/dal/base.py
235 236 237 | |
get_character(*, hid)
Return the character with the given HID.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no character with that HID exists. |
Source code in dcs_simulation_engine/dal/base.py
87 88 89 90 91 92 93 | |
get_characters(*, hid=None)
Return all characters, or a single character if hid is given.
Source code in dcs_simulation_engine/dal/base.py
95 96 97 | |
get_latest_assignment_for_player(*, player_id)
Return the newest assignment for one player.
Source code in dcs_simulation_engine/dal/base.py
243 244 245 | |
get_player(*, player_id)
Return a single player by id, or None if not found.
Source code in dcs_simulation_engine/dal/base.py
103 104 105 | |
get_player_forms(*, player_id)
Return player-scoped form responses for a player.
Source code in dcs_simulation_engine/dal/base.py
287 288 289 290 291 292 293 | |
get_players(*, access_key=None)
Return all players, or a single player by access key.
Source code in dcs_simulation_engine/dal/base.py
122 123 124 | |
get_resumable_session(*, player_id, game_name, pc_hid, npc_hid)
Return the most recent paused session for this player/game/character combo, or None.
Source code in dcs_simulation_engine/dal/base.py
156 157 158 159 160 161 162 163 164 165 | |
get_run()
Return the singleton persisted run record.
Source code in dcs_simulation_engine/dal/base.py
208 209 210 | |
get_session(*, session_id, player_id)
Return one persisted session header for a player.
Source code in dcs_simulation_engine/dal/base.py
138 139 140 | |
list_assignments(*, player_id=None, statuses=None, game_name=None)
List run assignments matching the provided filters.
Source code in dcs_simulation_engine/dal/base.py
247 248 249 250 251 252 253 254 255 | |
list_characters()
Return all characters.
Source code in dcs_simulation_engine/dal/base.py
99 100 101 | |
list_session_events(*, session_id)
Return ordered persisted events for a session.
Source code in dcs_simulation_engine/dal/base.py
167 168 169 | |
save_runtime_state(*, session_id, runtime_state)
Upsert the resumable runtime snapshot on a session document.
Source code in dcs_simulation_engine/dal/base.py
142 143 144 | |
set_assignment_form_response(*, assignment_id, form_key, response)
Store one run form response payload on an assignment row.
Source code in dcs_simulation_engine/dal/base.py
267 268 269 270 271 272 273 274 275 | |
set_player_form_response(*, player_id, form_key, response)
Store one player-scoped form response in the forms collection.
Source code in dcs_simulation_engine/dal/base.py
277 278 279 280 281 282 283 284 285 | |
set_run_progress(*, progress)
Persist the latest run progress snapshot.
Source code in dcs_simulation_engine/dal/base.py
223 224 225 226 227 228 229 | |
set_session_event_feedback(*, session_id, player_id, event_id, feedback)
Store feedback on a persisted NPC-message event.
Source code in dcs_simulation_engine/dal/base.py
187 188 189 190 191 192 193 194 195 196 | |
update_assignment_status(*, assignment_id, status, active_session_id=None)
Update assignment status and lifecycle timestamps.
Source code in dcs_simulation_engine/dal/base.py
257 258 259 260 261 262 263 264 265 | |
upsert_character(data, *, character_id=None)
Create or update a character. Returns the character's id string.
Source code in dcs_simulation_engine/dal/base.py
126 127 128 | |
upsert_run(*, name, description, config_snapshot, progress)
Create or update a persisted run metadata record.
Source code in dcs_simulation_engine/dal/base.py
212 213 214 215 216 217 218 219 220 221 | |
PlayerFormsRecord
Bases: NamedTuple
Before-play form responses for a player.
Source code in dcs_simulation_engine/dal/base.py
58 59 60 61 62 63 64 | |
PlayerRecord
Bases: NamedTuple
A player record (non-PII fields only).
Source code in dcs_simulation_engine/dal/base.py
15 16 17 18 19 20 21 | |
RunRecord
Bases: NamedTuple
A persisted run metadata record.
Source code in dcs_simulation_engine/dal/base.py
49 50 51 52 53 54 55 | |
SessionEventRecord
Bases: NamedTuple
A persisted event row for a session transcript.
Source code in dcs_simulation_engine/dal/base.py
35 36 37 38 39 40 41 42 43 44 45 46 | |
SessionRecord
Bases: NamedTuple
A persisted chat session header record.
Source code in dcs_simulation_engine/dal/base.py
24 25 26 27 28 29 30 31 32 | |
character_filters
Character filter registry.
get_character_filter(name)
Resolve a registered character filter by name.
Source code in dcs_simulation_engine/dal/character_filters/__init__.py
34 35 36 37 38 39 | |
list_character_filter_names()
Return all registered character filter names in a stable order.
Source code in dcs_simulation_engine/dal/character_filters/__init__.py
42 43 44 | |
all
Character filter: all characters.
AllCharactersFilter
Returns every character from the database with no filtering.
Source code in dcs_simulation_engine/dal/character_filters/all.py
8 9 10 11 12 13 14 15 | |
get_characters(*, provider)
Return all characters from the provider without filtering.
Source code in dcs_simulation_engine/dal/character_filters/all.py
13 14 15 | |
base
Character filter protocol.
CharacterFilter
Bases: Protocol
Contract for character filter implementations.
Source code in dcs_simulation_engine/dal/character_filters/base.py
9 10 11 12 13 14 15 | |
get_characters(*, provider)
Return all characters from provider that match this filter.
Source code in dcs_simulation_engine/dal/character_filters/base.py
14 15 | |
divergent
Character filter: characters with any non-normative HSN divergence.
DivergentFilter
Returns characters with at least one non-normative HSN divergence value.
Source code in dcs_simulation_engine/dal/character_filters/divergent.py
9 10 11 12 13 14 15 16 | |
get_characters(*, provider)
Return characters with any non-normative HSN divergence.
Source code in dcs_simulation_engine/dal/character_filters/divergent.py
14 15 16 | |
human
Character filter: human characters.
HumanFilter
Returns only human characters.
Source code in dcs_simulation_engine/dal/character_filters/human.py
8 9 10 11 12 13 14 15 | |
get_characters(*, provider)
Return characters whose is_human flag is truthy.
Source code in dcs_simulation_engine/dal/character_filters/human.py
13 14 15 | |
human_normative
Character filter: human-normative characters.
HumanNormativeFilter
Returns human characters with a neurotypical/normative profile.
Matches characters where is_human=True and 'neurotypical' appears in common_labels (e.g. NA, NB).
Source code in dcs_simulation_engine/dal/character_filters/human_normative.py
8 9 10 11 12 13 14 15 16 17 18 19 | |
get_characters(*, provider)
Return human characters labelled as neurotypical.
Source code in dcs_simulation_engine/dal/character_filters/human_normative.py
17 18 19 | |
hypersensitive
Character filter: hypersensitive characters.
HypersensitiveFilter
Returns characters with sensory hypersensitivity profiles.
Matches any character whose common_labels overlap with the hypersensitive label set (e.g. DS, JW, JAB, WS).
Source code in dcs_simulation_engine/dal/character_filters/hypersensitive.py
18 19 20 21 22 23 24 25 26 27 28 29 | |
get_characters(*, provider)
Return characters whose labels match the hypersensitive set.
Source code in dcs_simulation_engine/dal/character_filters/hypersensitive.py
27 28 29 | |
hyposensitive
Character filter: hyposensitive characters.
HyposensitiveFilter
Returns characters with sensory hyposensitivity profiles.
Matches any character whose common_labels overlap with the hyposensitive label set (e.g. KAT).
Source code in dcs_simulation_engine/dal/character_filters/hyposensitive.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
get_characters(*, provider)
Return characters whose labels match the hyposensitive set.
Source code in dcs_simulation_engine/dal/character_filters/hyposensitive.py
24 25 26 | |
neurodivergent
Character filter: characters with neuro-style HSN divergence.
NeurodivergentFilter
Returns characters with non-normative cognitive or communication HSN divergence.
Source code in dcs_simulation_engine/dal/character_filters/neurodivergent.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
get_characters(*, provider)
Return characters with non-normative cognitive/perceptual or neurotypical-communication divergence.
Source code in dcs_simulation_engine/dal/character_filters/neurodivergent.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
neurotypical
Character filter: neurotypical characters.
NeurotypicalFilter
Returns characters labelled neurotypical (human or non-human).
Matches any character where 'neurotypical' appears in common_labels (e.g. NA, NB).
Source code in dcs_simulation_engine/dal/character_filters/neurotypical.py
8 9 10 11 12 13 14 15 16 17 18 19 | |
get_characters(*, provider)
Return characters labelled as neurotypical.
Source code in dcs_simulation_engine/dal/character_filters/neurotypical.py
17 18 19 | |
non_human
Character filter: non-human characters.
NonHumanFilter
Returns only non-human characters.
Source code in dcs_simulation_engine/dal/character_filters/non_human.py
8 9 10 11 12 13 14 15 | |
get_characters(*, provider)
Return characters whose is_human flag is falsy.
Source code in dcs_simulation_engine/dal/character_filters/non_human.py
13 14 15 | |
pc_eligible
Character filter: PC-eligible characters.
PcEligibleFilter
Returns characters that are eligible to be used as PCs.
Source code in dcs_simulation_engine/dal/character_filters/pc_eligible.py
8 9 10 11 12 13 14 15 | |
get_characters(*, provider)
Return characters whose pc_eligible flag is truthy.
Source code in dcs_simulation_engine/dal/character_filters/pc_eligible.py
13 14 15 | |
physical_divergence
Character filter: characters with physical-ability HSN divergence.
PhysicalDivergenceFilter
Returns characters with non-normative physical-ability HSN divergence.
Source code in dcs_simulation_engine/dal/character_filters/physical_divergence.py
9 10 11 12 13 14 15 16 17 18 19 20 21 | |
get_characters(*, provider)
Return characters with non-normative physical-ability divergence.
Source code in dcs_simulation_engine/dal/character_filters/physical_divergence.py
14 15 16 17 18 19 20 21 | |
mongo
MongoDB DAL: provider and admin classes.
AsyncMongoProvider
Async provider backed by PyMongo AsyncMongoClient.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
append_session_event(*, session_id, player_id, direction, event_type, event_source, content, content_format, turn_index, visible_to_user)
async
Append one owned session event and advance the parent session sequence counter.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
branch_session(*, session_id, player_id, branched_at)
async
Clone a persisted session into a new paused child session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
clear_session_event_feedback(*, session_id, player_id, event_id)
async
Remove feedback from one persisted NPC message event owned by the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
create_assignment(*, assignment_doc, allow_concurrent=False)
async
Persist a new assignment row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
create_player(*, player_data, player_id=None, issue_access_key=False, access_key=None)
async
Create or update a player, optionally issuing them a new access key.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
create_session(session_doc)
async
Log the start of a new game/app session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
318 319 320 | |
delete_character(character_id)
async
Remove a character by ID.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
307 308 309 | |
delete_player(player_id)
async
Remove a player by ID, checking all variant ID types.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
311 312 313 314 315 316 | |
finalize_session(*, session_id, termination_reason, status, session_ended_at, turns_completed, last_seq)
async
Update a session record with final metrics when it ends.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
get_active_assignment(*, player_id)
async
Return the current active assignment for one player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | |
get_assignment(*, assignment_id)
async
Return one assignment row by assignment_id.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
750 751 752 753 754 755 | |
get_assignment_for_session_id(*, session_id)
async
Return the assignment that has this session as its active session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
773 774 775 776 777 778 | |
get_character(*, hid)
async
Strict version of get_characters that guarantees a single record is returned.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
158 159 160 161 162 163 | |
get_characters(*, hid=None)
async
Fetch a specific character by ID, or list all of them if no ID is provided.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
145 146 147 148 149 150 151 152 153 154 155 156 | |
get_latest_assignment_for_player(*, player_id)
async
Return the newest assignment for one player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
780 781 782 783 784 785 786 787 788 789 | |
get_player(*, player_id)
async
Look up a player by their ID.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
get_player_forms(*, player_id)
async
Return player-scoped form responses for a player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 | |
get_players(*, access_key=None)
async
Fetch all players, or specifically authenticate and fetch one by access_key.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
get_resumable_session(*, player_id, game_name, pc_hid, npc_hid)
async
Return the most recent paused session for this player/game/character combo.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
get_run()
async
Return the singleton persisted run metadata record.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
668 669 670 671 672 673 | |
get_session(*, session_id, player_id)
async
Return a single persisted session record for the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
380 381 382 383 384 385 386 387 388 389 390 391 392 | |
get_session_reconstruction(*, session_id, player_id)
async
Return session metadata and ordered event stream for replay.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
list_assignments(*, player_id=None, statuses=None, game_name=None)
async
List assignment rows matching the requested filters.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
list_characters()
async
Fetch all character records from the database.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
165 166 167 168 169 170 | |
list_session_events(*, session_id)
async
Return all persisted session events in sequence order.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
496 497 498 499 500 501 502 503 | |
pause_session(*, session_id, paused_at)
async
Update a session record to reflect it is paused and awaiting resume.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
resume_session(*, session_id, resumed_at)
async
Update a session record to reflect it has been resumed.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
save_runtime_state(*, session_id, runtime_state)
async
Upsert the resumable runtime snapshot on a session document.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
394 395 396 397 398 399 400 401 402 403 404 405 406 | |
set_assignment_form_response(*, assignment_id, form_key, response)
async
Store one form response payload on an assignment row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | |
set_player_form_response(*, player_id, form_key, response)
async
Upsert one player-scoped form response into the forms collection.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | |
set_run_progress(*, progress)
async
Persist the latest run progress snapshot.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
set_session_event_feedback(*, session_id, player_id, event_id, feedback)
async
Store feedback on one persisted NPC message event owned by the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
update_assignment_status(*, assignment_id, status, active_session_id=None)
async
Update assignment status and lifecycle timestamps.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | |
upsert_character(data, *, character_id=None)
async
Create a new character or update an existing one.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
upsert_run(*, name, description, config_snapshot, progress)
async
Create or update the singleton run metadata row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
MongoAdmin
Administrative operations over a specific Mongo DB handle.
Source code in dcs_simulation_engine/dal/mongo/admin.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
__init__(db)
Bind admin operations to the given database handle.
Source code in dcs_simulation_engine/dal/mongo/admin.py
26 27 28 | |
backup_collection(db, coll_name, root)
Dump a single collection to ndjson and write its index metadata.
Source code in dcs_simulation_engine/dal/mongo/admin.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
backup_db(outdir, *, append_ts=True)
Backup entire DB to a directory. Returns the path written.
Source code in dcs_simulation_engine/dal/mongo/admin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
backup_root_dir(db_name)
Return a timestamped backup root path and create the directory.
Source code in dcs_simulation_engine/dal/mongo/admin.py
92 93 94 95 96 97 | |
create_indices(coll)
Create any configured indexes for the given collection.
Source code in dcs_simulation_engine/dal/mongo/admin.py
131 132 133 134 135 136 137 138 139 140 | |
load_seed_documents(path)
Parse a seed file (.json or .ndjson) and return a list of documents.
Source code in dcs_simulation_engine/dal/mongo/admin.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
seed_collection(coll, docs)
Drop and repopulate a collection with docs. Returns inserted count.
Source code in dcs_simulation_engine/dal/mongo/admin.py
117 118 119 120 121 122 123 124 125 126 127 128 129 | |
seed_database(seed_dir)
Seed all collections from seed_dir. Existing collections are dropped and replaced.
Source code in dcs_simulation_engine/dal/mongo/admin.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
admin
MongoDB administrative operations for CLI bootstrap and teardown.
MongoAdmin
Administrative operations over a specific Mongo DB handle.
Source code in dcs_simulation_engine/dal/mongo/admin.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
__init__(db)
Bind admin operations to the given database handle.
Source code in dcs_simulation_engine/dal/mongo/admin.py
26 27 28 | |
backup_collection(db, coll_name, root)
Dump a single collection to ndjson and write its index metadata.
Source code in dcs_simulation_engine/dal/mongo/admin.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
backup_db(outdir, *, append_ts=True)
Backup entire DB to a directory. Returns the path written.
Source code in dcs_simulation_engine/dal/mongo/admin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
backup_root_dir(db_name)
Return a timestamped backup root path and create the directory.
Source code in dcs_simulation_engine/dal/mongo/admin.py
92 93 94 95 96 97 | |
create_indices(coll)
Create any configured indexes for the given collection.
Source code in dcs_simulation_engine/dal/mongo/admin.py
131 132 133 134 135 136 137 138 139 140 | |
load_seed_documents(path)
Parse a seed file (.json or .ndjson) and return a list of documents.
Source code in dcs_simulation_engine/dal/mongo/admin.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
seed_collection(coll, docs)
Drop and repopulate a collection with docs. Returns inserted count.
Source code in dcs_simulation_engine/dal/mongo/admin.py
117 118 119 120 121 122 123 124 125 126 127 128 129 | |
seed_database(seed_dir)
Seed all collections from seed_dir. Existing collections are dropped and replaced.
Source code in dcs_simulation_engine/dal/mongo/admin.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
async_provider
Async MongoDB implementation for runtime server paths.
AsyncMongoProvider
Async provider backed by PyMongo AsyncMongoClient.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
append_session_event(*, session_id, player_id, direction, event_type, event_source, content, content_format, turn_index, visible_to_user)
async
Append one owned session event and advance the parent session sequence counter.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
branch_session(*, session_id, player_id, branched_at)
async
Clone a persisted session into a new paused child session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
clear_session_event_feedback(*, session_id, player_id, event_id)
async
Remove feedback from one persisted NPC message event owned by the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
create_assignment(*, assignment_doc, allow_concurrent=False)
async
Persist a new assignment row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
create_player(*, player_data, player_id=None, issue_access_key=False, access_key=None)
async
Create or update a player, optionally issuing them a new access key.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
create_session(session_doc)
async
Log the start of a new game/app session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
318 319 320 | |
delete_character(character_id)
async
Remove a character by ID.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
307 308 309 | |
delete_player(player_id)
async
Remove a player by ID, checking all variant ID types.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
311 312 313 314 315 316 | |
finalize_session(*, session_id, termination_reason, status, session_ended_at, turns_completed, last_seq)
async
Update a session record with final metrics when it ends.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
get_active_assignment(*, player_id)
async
Return the current active assignment for one player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | |
get_assignment(*, assignment_id)
async
Return one assignment row by assignment_id.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
750 751 752 753 754 755 | |
get_assignment_for_session_id(*, session_id)
async
Return the assignment that has this session as its active session.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
773 774 775 776 777 778 | |
get_character(*, hid)
async
Strict version of get_characters that guarantees a single record is returned.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
158 159 160 161 162 163 | |
get_characters(*, hid=None)
async
Fetch a specific character by ID, or list all of them if no ID is provided.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
145 146 147 148 149 150 151 152 153 154 155 156 | |
get_latest_assignment_for_player(*, player_id)
async
Return the newest assignment for one player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
780 781 782 783 784 785 786 787 788 789 | |
get_player(*, player_id)
async
Look up a player by their ID.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
get_player_forms(*, player_id)
async
Return player-scoped form responses for a player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 | |
get_players(*, access_key=None)
async
Fetch all players, or specifically authenticate and fetch one by access_key.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
get_resumable_session(*, player_id, game_name, pc_hid, npc_hid)
async
Return the most recent paused session for this player/game/character combo.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
get_run()
async
Return the singleton persisted run metadata record.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
668 669 670 671 672 673 | |
get_session(*, session_id, player_id)
async
Return a single persisted session record for the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
380 381 382 383 384 385 386 387 388 389 390 391 392 | |
get_session_reconstruction(*, session_id, player_id)
async
Return session metadata and ordered event stream for replay.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
list_assignments(*, player_id=None, statuses=None, game_name=None)
async
List assignment rows matching the requested filters.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
list_characters()
async
Fetch all character records from the database.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
165 166 167 168 169 170 | |
list_session_events(*, session_id)
async
Return all persisted session events in sequence order.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
496 497 498 499 500 501 502 503 | |
pause_session(*, session_id, paused_at)
async
Update a session record to reflect it is paused and awaiting resume.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
resume_session(*, session_id, resumed_at)
async
Update a session record to reflect it has been resumed.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
save_runtime_state(*, session_id, runtime_state)
async
Upsert the resumable runtime snapshot on a session document.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
394 395 396 397 398 399 400 401 402 403 404 405 406 | |
set_assignment_form_response(*, assignment_id, form_key, response)
async
Store one form response payload on an assignment row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | |
set_player_form_response(*, player_id, form_key, response)
async
Upsert one player-scoped form response into the forms collection.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | |
set_run_progress(*, progress)
async
Persist the latest run progress snapshot.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
set_session_event_feedback(*, session_id, player_id, event_id, feedback)
async
Store feedback on one persisted NPC message event owned by the player.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
update_assignment_status(*, assignment_id, status, active_session_id=None)
async
Update assignment status and lifecycle timestamps.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | |
upsert_character(data, *, character_id=None)
async
Create a new character or update an existing one.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
upsert_run(*, name, description, config_snapshot, progress)
async
Create or update the singleton run metadata row.
Source code in dcs_simulation_engine/dal/mongo/async_provider.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
async_writer
Generic async buffered writer for Mongo collections.
AsyncMongoWriter
Bases: Generic[TDoc]
Buffer writes and periodically flush batched inserts to Mongo.
Source code in dcs_simulation_engine/dal/mongo/async_writer.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
close()
async
Flush pending docs and stop background flushing.
Source code in dcs_simulation_engine/dal/mongo/async_writer.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
enqueue(doc)
async
Queue one document. Backpressure applies when queue is full.
This method never performs inline DB writes.
Source code in dcs_simulation_engine/dal/mongo/async_writer.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
flush()
async
Flush all currently buffered writes.
Source code in dcs_simulation_engine/dal/mongo/async_writer.py
121 122 123 124 125 126 127 128 129 130 131 | |
start()
async
Start periodic background flushing.
Source code in dcs_simulation_engine/dal/mongo/async_writer.py
82 83 84 85 86 87 88 89 90 91 | |
const
MongoDB constants: collection names, column names, and index definitions.
MongoColumns
Namespace for MongoDB collection and field name constants.
Source code in dcs_simulation_engine/dal/mongo/const.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
log_events
Mongo-backed writer for persisted engine log events.
MongoLogEventWriter
Buffer persisted log events and write them to Mongo in small batches.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
__init__(*, db, batch_size=20, flush_interval_ms=200, max_queue_size=1000)
Bind the writer to Mongo and configure batching limits.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
close()
async
Flush and stop the background writer.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
66 67 68 69 70 71 72 73 74 | |
enqueue_nowait(doc)
Queue a log event without blocking application logging.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
47 48 49 50 51 52 53 54 55 56 57 | |
flush()
async
Flush all queued log events.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
59 60 61 62 63 64 | |
start()
async
Start the background batch writer.
Source code in dcs_simulation_engine/dal/mongo/log_events.py
40 41 42 43 44 45 | |
util
Mongo DAL utility helpers.
This module is intentionally stateless. Connection ownership is handled by bootstrap/runtime wiring and passed into DAL objects explicitly.
connect_db(*, uri, db_name=DEFAULT_DB_NAME, client_factory=None)
Create a MongoDB DB handle from an explicit URI.
Source code in dcs_simulation_engine/dal/mongo/util.py
143 144 145 146 147 148 149 150 151 152 153 154 155 | |
connect_db_async(*, uri, db_name=DEFAULT_DB_NAME, client_factory=None)
async
Create an async MongoDB DB handle from an explicit URI.
Source code in dcs_simulation_engine/dal/mongo/util.py
158 159 160 161 162 163 164 165 166 167 168 169 170 | |
dump_all_collections_to_json(db, path)
Dump every collection to JSON plus backup metadata files.
Source code in dcs_simulation_engine/dal/mongo/util.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
dump_all_collections_to_json_async(db, path)
async
Dump every collection to JSON plus backup metadata files.
Source code in dcs_simulation_engine/dal/mongo/util.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
ensure_default_indexes(db)
Create baseline indexes used by runtime and tests.
Source code in dcs_simulation_engine/dal/mongo/util.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
ensure_default_indexes_async(db)
async
Create baseline indexes used by async runtime paths.
Source code in dcs_simulation_engine/dal/mongo/util.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
player_doc_to_record(doc)
Convert a raw MongoDB player document to a PlayerRecord.
Source code in dcs_simulation_engine/dal/mongo/util.py
322 323 324 325 326 327 328 329 330 | |
player_id_variants(player_id)
Return equivalent player id values (string and ObjectId variants).
Source code in dcs_simulation_engine/dal/mongo/util.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
sanitize_player_data(player_data)
Remove access-key fields from player_data and set a default created_at.
Source code in dcs_simulation_engine/dal/mongo/util.py
273 274 275 276 277 278 279 280 281 282 283 284 | |
split_pii(player_data)
Split player_data into (non_pii, pii) dicts based on PII field definitions.
Source code in dcs_simulation_engine/dal/mongo/util.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
deployments
Deployment assets used by the DCS CLI.
templates
Jinja templates for generated deployment configuration files.
errors
Errors for DCS Simulation Engine.
APIRequestError
Bases: RuntimeError
Base class for all domain errors.
Source code in dcs_simulation_engine/errors.py
6 7 | |
GameValidationError
Bases: APIRequestError
Raised when a game config fails validation.
Source code in dcs_simulation_engine/errors.py
10 11 | |
ModelOutputContractError
dataclass
Bases: APIRequestError
Raised when a model response does not match the expected payload contract.
Source code in dcs_simulation_engine/errors.py
65 66 67 68 69 70 71 72 73 74 75 76 | |
__post_init__()
Generate a user-friendly message.
Source code in dcs_simulation_engine/errors.py
74 75 76 | |
ModelProviderError
dataclass
Bases: APIRequestError
Raised when an upstream model provider rejects or cannot serve a request.
Source code in dcs_simulation_engine/errors.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
__post_init__()
Generate a user-friendly message if one isn't provided.
Source code in dcs_simulation_engine/errors.py
26 27 28 29 30 31 32 33 34 35 | |
metadata()
Return public structured fields safe to send to API clients.
Source code in dcs_simulation_engine/errors.py
37 38 39 40 41 42 43 | |
games
Built-in game class definitions.
ai_client
Async AI client.
ParsedSimulatorResponse
Bases: NamedTuple
Normalized model response with primary content plus optional metadata.
Source code in dcs_simulation_engine/games/ai_client.py
498 499 500 501 502 503 504 | |
ScorerClient
One-shot stateless client that executes a rendered scoring prompt.
Source code in dcs_simulation_engine/games/ai_client.py
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | |
__init__(model=DEFAULT_MODEL)
Initialise with model identifier only.
Source code in dcs_simulation_engine/games/ai_client.py
1138 1139 1140 | |
score(*, prompt, transcript)
async
Execute a rendered scoring prompt and return parsed + raw JSON results.
Source code in dcs_simulation_engine/games/ai_client.py
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | |
ScorerResult
Bases: NamedTuple
Parsed evaluation payload plus the raw JSON text returned by the scorer.
Source code in dcs_simulation_engine/games/ai_client.py
1128 1129 1130 1131 1132 | |
SimulatorClient
Thin orchestrator around configurable validation and simulator advancement.
Source code in dcs_simulation_engine/games/ai_client.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | |
player_turn_validators
property
Configured player-turn validators for this simulator instance.
scene_opener_model
property
Return the scene-opener model identifier for metadata recording.
simulator_turn_validators
property
Configured simulator-turn validators for this simulator instance.
updater_model
property
Return the updater model identifier for metadata recording.
validator_model
property
Return the validator model identifier for metadata recording.
__init__(*, pc, npc, player_turn_validators=None, simulator_turn_validators=None, opener_template=None, updater_template=None, opener_model=DEFAULT_MODEL, updater_model=DEFAULT_MODEL, validator_model=DEFAULT_MODEL)
Initialize a simulator client with characters, prompts, validators, and models.
Source code in dcs_simulation_engine/games/ai_client.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | |
attach_recorder(recorder, turn_index_provider)
Attach a validation recorder and turn-index provider.
Source code in dcs_simulation_engine/games/ai_client.py
622 623 624 625 | |
chat(user_input)
async
Generate the opening scene without player-input validation.
Source code in dcs_simulation_engine/games/ai_client.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
export_history()
Return a JSON-serialisable copy of the conversation history.
Source code in dcs_simulation_engine/games/ai_client.py
564 565 566 | |
export_state()
Return all mutable simulator state needed for pause/resume.
Source code in dcs_simulation_engine/games/ai_client.py
574 575 576 577 578 579 580 581 | |
import_history(history)
Restore conversation history from a snapshot.
Source code in dcs_simulation_engine/games/ai_client.py
568 569 570 571 572 | |
import_state(state)
Restore mutable simulator state from a snapshot.
Source code in dcs_simulation_engine/games/ai_client.py
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
step(user_input)
async
Validate player input, then generate and validate one simulator response.
Source code in dcs_simulation_engine/games/ai_client.py
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | |
SimulatorComponentResult
dataclass
Generation and validation metadata for one simulator output component.
Source code in dcs_simulation_engine/games/ai_client.py
473 474 475 476 477 478 479 480 481 482 483 | |
SimulatorTurnResult
dataclass
Structured result for one attempted simulator turn.
Source code in dcs_simulation_engine/games/ai_client.py
486 487 488 489 490 491 492 493 494 495 | |
SimulatorValidationFailure
dataclass
Normalized validation failure detail for a specific stage and validator.
Source code in dcs_simulation_engine/games/ai_client.py
463 464 465 466 467 468 469 470 | |
set_fake_ai_response(value)
Set a process-local override returned by _call_openrouter when configured.
Source code in dcs_simulation_engine/games/ai_client.py
47 48 49 50 | |
validate_openrouter_configuration()
Validate runtime configuration needed for live OpenRouter requests.
Source code in dcs_simulation_engine/games/ai_client.py
53 54 55 56 57 58 59 60 61 62 | |
const
Constants for the games module.
Explore
String constants for the Explore game.
Source code in dcs_simulation_engine/games/const.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
Foresight
String constants for the Foresight game.
Source code in dcs_simulation_engine/games/const.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
GoalHorizon
String constants for the Goal Horizon game.
Source code in dcs_simulation_engine/games/const.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
InferIntent
String constants for the Infer Intent game.
Source code in dcs_simulation_engine/games/const.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
Teamwork
String constants for the Teamwork game.
Source code in dcs_simulation_engine/games/const.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
explore
Explore game.
ExploreGame
Bases: Game
Free-form exploration game: player describes actions, NPC reacts, no predefined goals.
Source code in dcs_simulation_engine/games/explore.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
Overrides
Bases: Overrides
Run-config-overridable parameters for ExploreGame.
Source code in dcs_simulation_engine/games/explore.py
18 19 20 21 | |
create_from_context(pc, npc, **kwargs)
classmethod
Factory called by SessionManager.
Source code in dcs_simulation_engine/games/explore.py
23 24 25 26 27 28 29 30 31 32 33 | |
get_abilities_content()
Return the /abilities message content.
Source code in dcs_simulation_engine/games/explore.py
44 45 46 47 48 49 50 51 52 53 | |
get_help_content()
Return the /help message content.
Source code in dcs_simulation_engine/games/explore.py
35 36 37 38 39 40 41 42 | |
on_finish()
async
Exit immediately and emit a closing message.
Source code in dcs_simulation_engine/games/explore.py
55 56 57 58 59 60 61 62 | |
foresight
Foresight game.
ForesightGame
Bases: Game
Foresight game: player interacts with NPC and makes predictions embedded in their actions.
Source code in dcs_simulation_engine/games/foresight.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
predictions
property
Return the current predictions.
score
property
Return the current score.
Overrides
Bases: BaseGameOverrides
Run-config-overridable parameters for ForesightGame.
Source code in dcs_simulation_engine/games/foresight.py
30 31 32 33 34 | |
__init__(*, show_npc_details, show_final_score, scorer=None, **kwargs)
Initialise with game-specific prediction state.
Source code in dcs_simulation_engine/games/foresight.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
create_from_context(pc, npc, **kwargs)
classmethod
Factory called by SessionManager.
Source code in dcs_simulation_engine/games/foresight.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
get_abilities_content()
Return the /abilities message content.
Source code in dcs_simulation_engine/games/foresight.py
105 106 107 108 109 110 111 112 113 114 115 | |
get_help_content()
Return the /help message content.
Source code in dcs_simulation_engine/games/foresight.py
96 97 98 99 100 101 102 103 | |
on_finish()
async
Score the final prediction, then exit.
Source code in dcs_simulation_engine/games/foresight.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
goal_horizon
Goal Horizon game.
GoalHorizonGame
Bases: Game
Goal Horizon game: player interacts with NPC across scenes to understand their limits.
Source code in dcs_simulation_engine/games/goal_horizon.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
capability_prediction
property
Player's inferred capability limits, or empty string.
capability_prediction_confidence
property
Player's confidence in their capability prediction, or empty string.
score
property
Scorer result, or empty dict.
Overrides
Bases: Overrides
Run-config-overridable parameters for GoalHorizonGame.
Source code in dcs_simulation_engine/games/goal_horizon.py
23 24 25 26 27 | |
__init__(*, show_npc_details, show_final_score, scorer=None, **kwargs)
Initialise with game-specific prediction state.
Source code in dcs_simulation_engine/games/goal_horizon.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
create_from_context(pc, npc, **kwargs)
classmethod
Factory called by SessionManager.
Source code in dcs_simulation_engine/games/goal_horizon.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_abilities_content()
Return the /abilities message content.
Source code in dcs_simulation_engine/games/goal_horizon.py
126 127 128 129 130 131 132 133 134 135 136 | |
get_command_handler(cmd)
Return a handler for the given command, or None if not recognized.
Source code in dcs_simulation_engine/games/goal_horizon.py
105 106 107 108 109 | |
get_help_content()
Return the /help message content.
Source code in dcs_simulation_engine/games/goal_horizon.py
117 118 119 120 121 122 123 124 | |
on_finish()
async
Start the capability prediction collection flow.
Source code in dcs_simulation_engine/games/goal_horizon.py
138 139 140 141 142 143 144 145 146 | |
on_finish_input(user_input)
async
Collect prediction then confidence, then exit.
Source code in dcs_simulation_engine/games/goal_horizon.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
infer_intent
Infer Intent game.
InferIntentGame
Bases: Game
Infer Intent game: player interacts with NPC and infers their hidden goal.
Source code in dcs_simulation_engine/games/infer_intent.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
goal_inference
property
Player's inferred goal, or empty string.
goal_inference_confidence
property
Player's confidence in their goal inference, or empty string.
score
property
Scorer result, or empty dict.
Overrides
Bases: Overrides
Run-config-overridable parameters for InferIntentGame.
Source code in dcs_simulation_engine/games/infer_intent.py
23 24 25 26 27 | |
__init__(*, show_npc_details, show_final_score, scorer=None, **kwargs)
Initialise with game-specific inference state.
Source code in dcs_simulation_engine/games/infer_intent.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
create_from_context(pc, npc, **kwargs)
classmethod
Factory called by SessionManager.
Source code in dcs_simulation_engine/games/infer_intent.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
get_abilities_content()
Return the /abilities message content.
Source code in dcs_simulation_engine/games/infer_intent.py
111 112 113 114 115 116 117 118 119 120 121 | |
get_help_content()
Return the /help message content.
Source code in dcs_simulation_engine/games/infer_intent.py
102 103 104 105 106 107 108 109 | |
on_finish()
async
Start the inference collection flow.
Source code in dcs_simulation_engine/games/infer_intent.py
123 124 125 126 127 | |
on_finish_input(user_input)
async
Collect inference then confidence, score, then exit.
Source code in dcs_simulation_engine/games/infer_intent.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
markdown_helpers
Helpers for rendering game content as markdown.
format_abilities_markdown(abilities, *, section_heading_level=3)
Render a character's ability payload as readable markdown.
Source code in dcs_simulation_engine/games/markdown_helpers.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
format_score_markdown(score, *, title='Final Score')
Render a scorer payload as readable markdown.
Source code in dcs_simulation_engine/games/markdown_helpers.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
prompts
Shared system prompt templates and builders for games.
build_opener_prompt(pc, npc, *, template=OPENER, excluded_scenes=None)
Render the opening-scene prompt.
Source code in dcs_simulation_engine/games/prompts.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
build_player_validator_prompt(pc, npc, *, player_action, transcript, validator_template)
Render a named player-input validator prompt.
Source code in dcs_simulation_engine/games/prompts.py
897 898 899 900 901 902 903 904 905 906 907 908 909 | |
build_scorer_prompt(*, scoring_template, npc, transcript, pc=None, **template_kwargs)
Render a scoring prompt from an explicit template and game-specific kwargs.
Source code in dcs_simulation_engine/games/prompts.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | |
build_simulator_validator_prompt(pc, npc, *, simulator_response, transcript, game_objective, validator_template)
Render a named simulator response validator prompt.
Source code in dcs_simulation_engine/games/prompts.py
912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
build_updater_prompt(pc, npc, *, game_objective, transcript, player_action, template=UPDATER)
Render the simulation updater prompt.
Source code in dcs_simulation_engine/games/prompts.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | |
teamwork
Teamwork game.
TeamworkGame
Bases: Game
Teamwork game: player collaborates with NPC toward a shared goal.
Source code in dcs_simulation_engine/games/teamwork.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
challenges
property
Player's reflection on challenges, or empty string.
score
property
Scorer result, or empty dict.
shared_goal
property
The shared goal for this game instance.
Overrides
Bases: BaseGameOverrides
Run-config-overridable parameters for TeamworkGame.
Source code in dcs_simulation_engine/games/teamwork.py
25 26 27 28 29 | |
__init__(*, show_npc_details, show_final_score, scorer=None, **kwargs)
Initialise with game-specific prediction state.
Source code in dcs_simulation_engine/games/teamwork.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
create_from_context(pc, npc, **kwargs)
classmethod
Factory called by SessionManager.
Source code in dcs_simulation_engine/games/teamwork.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
get_abilities_content()
Return the /abilities message content.
Source code in dcs_simulation_engine/games/teamwork.py
124 125 126 127 128 129 130 131 132 133 134 | |
get_help_content()
Return the /help message content.
Source code in dcs_simulation_engine/games/teamwork.py
114 115 116 117 118 119 120 121 122 | |
get_setup_content()
Return custom setup with goal.
Source code in dcs_simulation_engine/games/teamwork.py
110 111 112 | |
on_finish()
async
Ask the challenges reflection question before exiting.
Source code in dcs_simulation_engine/games/teamwork.py
136 137 138 139 | |
on_finish_input(user_input)
async
Store challenges answer, score, then exit.
Source code in dcs_simulation_engine/games/teamwork.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
helpers
Helpers: domain-aware convenience.
Contents should: - Know about the app's domain or feature - Wraps multiple steps into a higher-level action - Is opinionated about data shape, formatting, or behavior - Might change if the business logic changes
game_helpers
Helpers for games.
create_game_from_template(name, template=None)
Copy a game into ./games from a template game file.
Source code in dcs_simulation_engine/helpers/game_helpers.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
get_game_config(game, version='latest')
Return a YAML path for explicit custom configs; built-ins are class-backed.
Source code in dcs_simulation_engine/helpers/game_helpers.py
77 78 79 80 81 82 83 84 | |
list_characters()
Return available characters from seed data.
Useful for checking available characters when db is not live.
Source code in dcs_simulation_engine/helpers/game_helpers.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
list_games(directory=None)
Return available games.
Source code in dcs_simulation_engine/helpers/game_helpers.py
41 42 43 44 45 46 47 48 49 50 51 52 | |
logging_helpers
Logging helpers for DI Simulation Engine.
configure_logger(source, quiet=False, verbose=0)
Configure Loguru logging.
Source code in dcs_simulation_engine/helpers/logging_helpers.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
hitl
Data models for the human-in-the-loop (HITL) scenario testing pipeline.
Attempt
Bases: BaseModel
A single player message, the simulator's response, and evaluator feedback.
Source code in dcs_simulation_engine/hitl/__init__.py
25 26 27 28 29 30 31 32 | |
EvaluatorFeedback
Bases: BaseModel
Evaluator rating for one simulator response.
Field names and semantics match the feedback object in session_events so the export pipeline can map these directly to report-compatible data.
Source code in dcs_simulation_engine/hitl/__init__.py
10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Scenario
Bases: BaseModel
One test scenario: a starting context and one or more player attempts.
Source code in dcs_simulation_engine/hitl/__init__.py
35 36 37 38 39 40 41 42 43 44 45 46 47 | |
ScenarioFile
Bases: BaseModel
Top-level container for a character's scenario test suite.
Source code in dcs_simulation_engine/hitl/__init__.py
60 61 62 63 64 65 | |
ScenarioGroup
Bases: BaseModel
Scenarios grouped by the expected failure mode they probe.
Source code in dcs_simulation_engine/hitl/__init__.py
50 51 52 53 54 55 56 57 | |
export
Export a completed test cases file to a results directory.
The output directory has the same structure that dcs generate report
expects: sessions.json, session_events.json, characters.json, players.json,
assignments.json, runs.json, and manifest.json.
Each Scenario becomes one session; each Attempt within a scenario becomes an inbound player message plus one or more outbound simulator/system events. The EvaluatorFeedback fields map 1-to-1 onto the session_events feedback object so the existing analysis pipeline can process them without any changes.
export_results(scenarios_path, *, evaluator_id='evaluator', output_dir=None)
Convert a completed test cases file to a results directory.
The results directory is placed next to the test cases file by default
(<hid>-scenario-results/), or at output_dir if specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scenarios_path
|
Path
|
Path to the |
required |
evaluator_id
|
str
|
Name/ID recorded as the synthetic player. |
'evaluator'
|
output_dir
|
Path | None
|
Override the output directory path. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path to the created results directory. |
Source code in dcs_simulation_engine/hitl/export.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
feedback
Interactive evaluator feedback collection for HITL scenarios.
Walks through every attempt that has a simulator_response but lacks evaluator_feedback, displays the scenario context and NPC output, then prompts the evaluator for a thumbs rating, flags, and an optional comment.
Saving is atomic after each entry so the session is interrupt-safe; re-running the command resumes from the first attempt without feedback.
collect_feedback(path, *, evaluator_id='', only=None, include_ids=None, exclude=None, console)
Walk through pending attempts and collect evaluator feedback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the |
required |
evaluator_id
|
str
|
Optional string recorded in each feedback entry. |
''
|
only
|
list[str] | None
|
If set, process ONLY scenarios with these IDs. |
None
|
include_ids
|
list[str] | None
|
Force-include these scenario IDs even when |
None
|
exclude
|
list[str] | None
|
Skip scenarios with these IDs. |
None
|
console
|
Console
|
Rich Console for output. |
required |
Source code in dcs_simulation_engine/hitl/feedback.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
generate
Scaffold a
Generates one scenario group per pressure category (using the category's
example prompts as starter attempts) plus one scenario per entry in the
character's scenarios[] array. All conversation_history fields start
empty; the engine populates them when dcs hitl update runs.
build_scaffold(character, game)
Build a scaffold ScenarioFile for the given character.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character
|
dict
|
The character dict loaded from a seed file. |
required |
game
|
str
|
The game name to use for all scenarios. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
ScenarioFile
|
class: |
Source code in dcs_simulation_engine/hitl/generate.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
load_character(hid, db)
Load a character record by HID from the specified seed database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hid
|
str
|
The character's human-readable ID. |
required |
db
|
str
|
Which database to load from — |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The character dict. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the character is not found. |
FileNotFoundError
|
If the seed file does not exist. |
Source code in dcs_simulation_engine/hitl/generate.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
load_pressure_categories()
Load the evaluation category definitions.
Source code in dcs_simulation_engine/hitl/generate.py
73 74 75 76 | |
load_scenario_file(path)
Load and parse a scenarios JSON file.
Source code in dcs_simulation_engine/hitl/generate.py
174 175 176 177 | |
save_scaffold(scenario_file, path)
Serialise a ScenarioFile to JSON at the given path.
Source code in dcs_simulation_engine/hitl/generate.py
165 166 167 168 169 170 171 | |
save_scenario_file(path, scenario_file)
Write a ScenarioFile back to disk (atomic via temp file).
Source code in dcs_simulation_engine/hitl/generate.py
180 181 182 183 184 185 186 187 | |
scenarios_path_for(hid)
Return the expected output path for a character's test cases file.
Source code in dcs_simulation_engine/hitl/generate.py
79 80 81 | |
responses
Async shared-history sync and simulator response generation for HITL scenarios.
ParentSessionMissingError
Bases: RuntimeError
Raised when a saved parent session can no longer be resumed.
Source code in dcs_simulation_engine/hitl/responses.py
14 15 | |
compute_status_counts(path, *, only=None, include_ids=None, exclude=None)
Return post-update counts for the selected scenarios.
Source code in dcs_simulation_engine/hitl/responses.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
compute_status_summary(path, *, only=None, include_ids=None, exclude=None)
Return totals plus incomplete-work counts for the selected scenarios.
Source code in dcs_simulation_engine/hitl/responses.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
generate_responses(path, *, server_url='http://localhost:8080', api_key='', only=None, include_ids=None, exclude=None, concurrency=4, run_attempts=True, regenerate_parent_session=False, console)
async
Sync shared history and optionally generate simulator responses for attempts.
Source code in dcs_simulation_engine/hitl/responses.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
render_status_summary(summary, *, title='Scenario File Summary')
Render a stable human-readable summary block.
Source code in dcs_simulation_engine/hitl/responses.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
infra
Operational / infrastructure helpers (Fly, Docker, etc.).
deploy
Deployment management.
deploy_app(*, game, deployment, version='latest', fly_toml=Path('fly.toml'), env_file=Path('.env'), region=None)
Deploy a game.
Source code in dcs_simulation_engine/infra/deploy.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
destroy_deployment(app_name)
Destroy a deployment.
Source code in dcs_simulation_engine/infra/deploy.py
35 36 37 | |
list_deployments()
List deployments.
Source code in dcs_simulation_engine/infra/deploy.py
9 10 11 12 | |
stop_deployment(*, deployment, logs_out=None, logs_no_tail=True, db_remote=None, db_out=None)
Stop a deployment and optionally download logs + DB.
Source code in dcs_simulation_engine/infra/deploy.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
fly
Fly.io management.
DeployResult
dataclass
Result of a deployment.
Source code in dcs_simulation_engine/infra/fly.py
20 21 22 23 24 25 26 | |
FlyError
Bases: RuntimeError
Raised for Fly-related operational failures.
Source code in dcs_simulation_engine/infra/fly.py
16 17 | |
LoadedEnv
dataclass
Merged env + captured dotenv key/values (for forwarding to flyctl --env).
Source code in dcs_simulation_engine/infra/fly.py
29 30 31 32 33 | |
build_deploy_cmd(config_path, app_name, dotenv_vars)
Build the flyctl deploy command, injecting env vars from .env.
Source code in dcs_simulation_engine/infra/fly.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
build_process_command(interface, *, game, version, tag)
Build the command string that becomes the Fly [processes].web command.
Source code in dcs_simulation_engine/infra/fly.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
check_flyctl()
Verify that flyctl is installed and accessible on PATH.
Source code in dcs_simulation_engine/infra/fly.py
136 137 138 139 | |
deploy_app(*, game, app_name, version='latest', fly_toml=Path('fly.toml'), env_file=Path('.env'), region=None)
Deploy the widget process for a game to Fly.
Source code in dcs_simulation_engine/infra/fly.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
destroy_app(app_name)
Destroy a Fly app.
Source code in dcs_simulation_engine/infra/fly.py
117 118 119 120 121 122 | |
download_db(*, app_name, remote_path, local_path)
Download a file from the Fly app via SFTP.
Source code in dcs_simulation_engine/infra/fly.py
359 360 361 362 363 364 365 366 | |
download_logs_jsonl(*, app_name, out_path, no_tail=True)
Download Fly logs in JSONL format and write to out_path.
Source code in dcs_simulation_engine/infra/fly.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
ensure_app_exists(app_name)
Ensure the Fly app exists. If not, create it.
Source code in dcs_simulation_engine/infra/fly.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
ensure_fly_auth()
Verify flyctl is authenticated (i.e. fly auth whoami works and returns an email).
Source code in dcs_simulation_engine/infra/fly.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
ensure_fly_available()
Verify flyctl is installed and usable.
Source code in dcs_simulation_engine/infra/fly.py
142 143 144 145 146 147 | |
flyctl_json(args)
Run flyctl with --json and return parsed JSON.
Source code in dcs_simulation_engine/infra/fly.py
125 126 127 128 129 130 131 132 133 | |
list_apps()
List Fly apps in the current account.
Source code in dcs_simulation_engine/infra/fly.py
319 320 321 322 323 324 325 326 | |
list_machines(app_name)
List machines for a Fly app.
Source code in dcs_simulation_engine/infra/fly.py
329 330 331 332 333 334 335 336 | |
load_env(env_file=Path('.env'))
Load env vars from .env and ensure FLY_API_TOKEN exists in environment.
Source code in dcs_simulation_engine/infra/fly.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
sftp_get(*, app_name, remote_path, local_path)
Get a file from the Fly app via SFTP.
Source code in dcs_simulation_engine/infra/fly.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
stop_all_machines(app_name)
Stop all machines for a Fly app.
Source code in dcs_simulation_engine/infra/fly.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
update_fly_toml(*, original_toml, app_name, process_cmd, region=None)
Update app/process settings in fly.toml using TOML parsing and serialization.
Source code in dcs_simulation_engine/infra/fly.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
remote
High-level remote Fly deployment lifecycle helpers.
ApiFlyTemplateContext
dataclass
Bases: BaseFlyTemplateContext
Template context for the API Fly config.
Source code in dcs_simulation_engine/infra/remote.py
91 92 93 94 95 96 | |
BaseFlyTemplateContext
dataclass
Shared context fields for generated Fly config templates.
Source code in dcs_simulation_engine/infra/remote.py
82 83 84 85 86 87 88 | |
DbFlyTemplateContext
dataclass
Bases: BaseFlyTemplateContext
Template context for the DB Fly config.
Source code in dcs_simulation_engine/infra/remote.py
106 107 108 109 110 | |
RemoteAppNames
dataclass
Concrete Fly app names for one remote run deployment.
Source code in dcs_simulation_engine/infra/remote.py
52 53 54 55 56 57 58 | |
RemoteDeployContext
dataclass
Build context and artifact directory used for one remote deploy.
Source code in dcs_simulation_engine/infra/remote.py
131 132 133 134 135 136 | |
RemoteDeploymentResult
dataclass
Structured output returned after a successful remote deployment.
Source code in dcs_simulation_engine/infra/remote.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
model_dump()
Return a JSON-serializable dict payload.
Source code in dcs_simulation_engine/infra/remote.py
77 78 79 | |
RemoteFlyConfigPaths
dataclass
Concrete file paths for generated Fly TOML configs.
Source code in dcs_simulation_engine/infra/remote.py
122 123 124 125 126 127 128 | |
RemoteLifecycleError
Bases: RuntimeError
Raised when a remote Fly lifecycle operation fails.
Source code in dcs_simulation_engine/infra/remote.py
48 49 | |
RemoteRenderedFlyConfigs
dataclass
Rendered Fly TOML contents for one remote run deployment.
Source code in dcs_simulation_engine/infra/remote.py
113 114 115 116 117 118 119 | |
RemoteStatusResult
dataclass
Authenticated run status returned for CLI presentation.
Source code in dcs_simulation_engine/infra/remote.py
139 140 141 142 143 144 145 146 147 148 149 | |
model_dump()
Return a JSON-serializable dict payload.
Source code in dcs_simulation_engine/infra/remote.py
147 148 149 | |
UiFlyTemplateContext
dataclass
Bases: BaseFlyTemplateContext
Template context for the UI Fly config.
Source code in dcs_simulation_engine/infra/remote.py
99 100 101 102 103 | |
app_url(app_name)
Return the public Fly URL for an app.
Source code in dcs_simulation_engine/infra/remote.py
193 194 195 | |
deploy_remote_run(*, config=None, openrouter_key, mongo_seed_path, admin_key=None, fly_api_token=None, region=None, api_app=None, ui_app=None, db_app=None, deploy_apps=None)
Deploy one remote-managed stack and bootstrap its remote admin key.
Source code in dcs_simulation_engine/infra/remote.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | |
derive_remote_app_names(*, run_name, api_app=None, ui_app=None, db_app=None)
Return explicit or derived app names for a remote run deployment.
Source code in dcs_simulation_engine/infra/remote.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
fetch_remote_status(*, uri, admin_key)
Return the authenticated status payload for one remote deployment.
Source code in dcs_simulation_engine/infra/remote.py
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | |
load_run_config(config, *, assets=None)
Resolve and load the run config selected for remote deployment.
Source code in dcs_simulation_engine/infra/remote.py
728 729 730 731 732 | |
save_remote_database(*, uri, admin_key, save_db_path)
Download the remote database export archive to the requested local path.
Source code in dcs_simulation_engine/infra/remote.py
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | |
slugify_run_name(value)
Normalize a run name into a Fly-app-safe slug.
Source code in dcs_simulation_engine/infra/remote.py
155 156 157 158 159 160 161 | |
stop_remote_run(*, uri, admin_key, save_db_path, api_app, ui_app, db_app, fly_api_token=None)
Save the remote DB archive, then destroy all Fly apps for the run.
Source code in dcs_simulation_engine/infra/remote.py
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | |
observability
Runtime observability helpers.
PersistentLogCapture
Capture selected Loguru records with a non-blocking persistence writer.
Source code in dcs_simulation_engine/observability/log_capture.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
__call__(message)
Loguru sink entrypoint.
Source code in dcs_simulation_engine/observability/log_capture.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
__init__(*, writer, source, run_name=None, min_level_no=30, throttle_seconds=60, max_throttle_keys=2000)
Store capture policy and the injected persistence writer.
Source code in dcs_simulation_engine/observability/log_capture.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
close()
async
Remove the Loguru sink and flush queued/suppressed log events.
Source code in dcs_simulation_engine/observability/log_capture.py
96 97 98 99 100 101 102 103 104 105 | |
flush_suppressed()
Emit summary rows for throttled events that never got a later write.
Source code in dcs_simulation_engine/observability/log_capture.py
120 121 122 123 124 125 126 127 128 129 130 131 132 | |
install()
Attach this capture sink to Loguru.
Source code in dcs_simulation_engine/observability/log_capture.py
89 90 91 92 93 94 | |
start()
async
Start the backing writer.
Source code in dcs_simulation_engine/observability/log_capture.py
82 83 84 85 86 87 | |
log_capture
Loguru sink that captures important engine logs with an injected writer.
PersistentLogCapture
Capture selected Loguru records with a non-blocking persistence writer.
Source code in dcs_simulation_engine/observability/log_capture.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
__call__(message)
Loguru sink entrypoint.
Source code in dcs_simulation_engine/observability/log_capture.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
__init__(*, writer, source, run_name=None, min_level_no=30, throttle_seconds=60, max_throttle_keys=2000)
Store capture policy and the injected persistence writer.
Source code in dcs_simulation_engine/observability/log_capture.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
close()
async
Remove the Loguru sink and flush queued/suppressed log events.
Source code in dcs_simulation_engine/observability/log_capture.py
96 97 98 99 100 101 102 103 104 105 | |
flush_suppressed()
Emit summary rows for throttled events that never got a later write.
Source code in dcs_simulation_engine/observability/log_capture.py
120 121 122 123 124 125 126 127 128 129 130 131 132 | |
install()
Attach this capture sink to Loguru.
Source code in dcs_simulation_engine/observability/log_capture.py
89 90 91 92 93 94 | |
start()
async
Start the backing writer.
Source code in dcs_simulation_engine/observability/log_capture.py
82 83 84 85 86 87 | |
reporting
Reporting helpers for DCS simulation results.
AnalysisData
dataclass
All analysis-ready DataFrames loaded from a single results directory.
Source code in dcs_simulation_engine/reporting/loader.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
runs_enriched_df
property
runs_df left-joined with non-PII player columns.
load_all(results_dir)
Load all result files from results_dir into an :class:AnalysisData.
Source code in dcs_simulation_engine/reporting/loader.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
auto
Auto-analysis pipeline.
Entry point:
from dcs_simulation_engine.reporting.auto import run_analysis
html = run_analysis(data, title="My Study")
Or via CLI:
python -m analysis.auto <results_dir> [--title "..."] [--open]
resolve_sections(only, include, exclude)
Return an ordered section list derived from the flag arguments.
Exactly one of only, include, exclude may be non-None. Raises ValueError for invalid slug names or mutual-exclusion violations.
Source code in dcs_simulation_engine/reporting/auto/__init__.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
run_analysis(data, title='Results Report', with_todos=False, sections=None)
Render all registered sections and return the complete HTML string.
Source code in dcs_simulation_engine/reporting/auto/__init__.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
run_coverage_report(repo_root=None, hids_filter=None, db='prod')
Render the character coverage report and return the complete HTML string.
Loads character data directly from database_seeds/; does not use AnalysisData.
Source code in dcs_simulation_engine/reporting/auto/__init__.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
constants
Centralised text descriptions for auto-analysis report sections and charts.
Edit the strings here to update what appears in the generated HTML report without touching any rendering or section code.
chart_caption(section, chart)
Return an HTML caption for a chart or table, or '' if absent.
Source code in dcs_simulation_engine/reporting/auto/constants.py
327 328 329 330 331 332 | |
section_intro(key)
Return an HTML lead paragraph for the given section key, or '' if absent.
Source code in dcs_simulation_engine/reporting/auto/constants.py
319 320 321 322 323 324 | |
publish
Publish utilities for dcs.
Provides pure functions for: - Parsing the per-NPC simulation quality table from a report HTML - Building CharacterRecord from a characters.json document - Loading / saving JSON seed files
build_char_record_from_doc(doc)
Build a :class:CharacterRecord from a characters.json document.
Source code in dcs_simulation_engine/reporting/auto/publish.py
181 182 183 184 185 186 187 188 | |
load_json_file(path)
Read and return parsed JSON from path.
Source code in dcs_simulation_engine/reporting/auto/publish.py
196 197 198 | |
parse_sim_quality_table(html)
Parse the per-NPC simulation quality table from a report HTML string.
Returns a list of dicts, one per NPC character::
[{"npc_hid": "NA", "turns": 25, "icf": 0.96, "dms": 0.01}, ...]
Raises:
ValueError
If the table sim-quality-per-npc-table is not found in the HTML.
This means the report was generated before the simulation_quality section
was added. Regenerate with::
dcs generate report ... --template simulation_quality
Source code in dcs_simulation_engine/reporting/auto/publish.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
save_json_file(path, data)
Write data as formatted JSON to path (2-space indent, trailing newline).
Source code in dcs_simulation_engine/reporting/auto/publish.py
201 202 203 | |
rendering
HTML rendering utilities for the auto-analysis pipeline.
chart_utils
Chart rendering helpers.
plotly_to_html — Plotly Figure → embeddable
add_short_player_id_column(df, *, source='player_id', target='player_label')
Return a copy of df with a shortened player-ID display column.
Source code in dcs_simulation_engine/reporting/auto/rendering/chart_utils.py
36 37 38 39 40 41 42 43 | |
matplotlib_to_base64(fig)
Return an tag with the figure embedded as a base64 PNG.
Source code in dcs_simulation_engine/reporting/auto/rendering/chart_utils.py
72 73 74 75 76 77 78 79 80 81 | |
plotly_to_html(fig, div_id=None)
Return an embeddable HTML div for fig.
Requires Plotly to be loaded from CDN in the page
.Source code in dcs_simulation_engine/reporting/auto/rendering/chart_utils.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
short_player_id(value, *, suffix_chars=8)
Display long player IDs by keeping the distinguishing suffix.
Source code in dcs_simulation_engine/reporting/auto/rendering/chart_utils.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
use_integer_ticks(fig, *, x=False, y=False)
Force whole-number tick labels on numeric Plotly axes.
Source code in dcs_simulation_engine/reporting/auto/rendering/chart_utils.py
46 47 48 49 50 51 52 53 | |
html_builder
Assemble the final HTML document from rendered section fragments.
build_html(sections, title='Results Report', artifacts=None, download_items=None)
Render the Jinja2 base template with all section fragments.
Parameters
sections: List of (anchor_slug, section_title, html_fragment, is_sub) tuples in display order. is_sub=True renders the sidebar entry as an indented child of the preceding top-level item. title: Report title shown in
and .
artifacts:
Mapping of artifact key → {b64, filename, mime} for downloadable files.
download_items:
List of (label, key) pairs rendered as dropdown menu items. Each key
must match an entry in artifacts. Defaults to the standard
raw_results / run_config pair.
Returns:
str
Complete, self-contained HTML document as a string.
Source code in dcs_simulation_engine/reporting/auto/rendering/html_builder.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def build_html(
sections: list[tuple[str, str, str, bool]],
title: str = "Results Report",
artifacts: dict[str, Any] | None = None,
download_items: list[tuple[str, str]] | None = None,
) -> str:
"""Render the Jinja2 base template with all section fragments.
Parameters
----------
sections:
List of (anchor_slug, section_title, html_fragment, is_sub) tuples in
display order. is_sub=True renders the sidebar entry as an indented
child of the preceding top-level item.
title:
Report title shown in <h1> and <title>.
artifacts:
Mapping of artifact key → {b64, filename, mime} for downloadable files.
download_items:
List of (label, key) pairs rendered as dropdown menu items. Each key
must match an entry in *artifacts*. Defaults to the standard
raw_results / run_config pair.
Returns:
-------
str
Complete, self-contained HTML document as a string.
"""
env = Environment(
loader=FileSystemLoader(str(_TEMPLATES_DIR)),
autoescape=False, # sections contain trusted HTML we generated
)
env.filters["tojson"] = json.dumps
template = env.get_template("base.html")
generated_at = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
_download_items = (
download_items
if download_items is not None
else [
("Raw Results (.zip)", "raw_results"),
("Run Config (.yml)", "run_config"),
]
)
return template.render(
title=title,
sections=sections,
generated_at=generated_at,
artifacts_json=json.dumps(artifacts or {}),
download_items=_download_items,
)
Returns:
str Complete, self-contained HTML document as a string.
Source code in dcs_simulation_engine/reporting/auto/rendering/html_builder.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
table_utils
DataFrame → DataTables HTML rendering.
df_to_datatable(df, table_id, ...) returns a self-contained HTML string containing a