Replaces LICENSE (GPLv3 -> AGPLv3) and prepends `SPDX-License-Identifier: AGPL-3.0-or-later` to every source file across decnet/, decnet_web/, tests/, scripts/, and tools/. Rationale: closes the GPLv3 ASP loophole so any party operating a modified DECNET as a network service must offer their modified source. Personal copyright (Samuel Paschuan) + inbound=outbound contributions make a future unilateral relicense infeasible. - LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt) - COPYRIGHT: project copyright notice - tools/add_spdx_headers.py: idempotent header injector (shebang- and PEP 263-aware) Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh). No behavior change; comments only.
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||
"""Workers panel DTOs (bus-backed health + control)."""
|
||
from typing import Any, Dict, List, Literal, Optional
|
||
|
||
from pydantic import BaseModel, Field as PydanticField
|
||
|
||
|
||
# --- Workers panel (Config → Workers) ---
|
||
# Bus-backed health + control: workers heartbeat on ``system.<name>.health``
|
||
# and listen on ``system.<name>.control``. The API aggregates last-seen
|
||
# heartbeats via the worker registry; these are the HTTP-facing shapes.
|
||
|
||
class WorkerStatus(BaseModel):
|
||
name: str
|
||
# ``ok`` — heartbeat within 90s (3× 30s heartbeat interval)
|
||
# ``stale`` — worker was seen before but hasn't pulsed in 90s+
|
||
# ``unknown`` — we've never received a heartbeat from this name
|
||
status: Literal["ok", "stale", "unknown"]
|
||
last_heartbeat_ts: Optional[float] = None
|
||
seconds_since: Optional[float] = None
|
||
# Whatever the worker's ``extra()`` callback put in the heartbeat;
|
||
# opaque to the panel, displayed only if the UI knows the key.
|
||
extra: Dict[str, Any] = PydanticField(default_factory=dict)
|
||
# True iff a ``decnet-<name>.service`` unit file is present on the
|
||
# host. False flips the UI START button to disabled with a
|
||
# "Unit not installed" tooltip. Default True for backwards compat
|
||
# on clients that pre-date the field.
|
||
installed: bool = True
|
||
|
||
|
||
class WorkersResponse(BaseModel):
|
||
workers: List[WorkerStatus]
|
||
generated_at: float
|
||
bus_connected: bool
|
||
|
||
|
||
class WorkerControlResponse(BaseModel):
|
||
accepted: bool
|
||
worker: str
|
||
action: str
|
||
|
||
|
||
class StartFailure(BaseModel):
|
||
name: str
|
||
reason: str
|
||
|
||
|
||
class StartAllResponse(BaseModel):
|
||
started: List[str]
|
||
already_running: List[str]
|
||
failed: List[StartFailure]
|