nova-kiosk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nova_kiosk-0.1.0/LICENSE +21 -0
- nova_kiosk-0.1.0/PKG-INFO +105 -0
- nova_kiosk-0.1.0/README.md +70 -0
- nova_kiosk-0.1.0/pyproject.toml +62 -0
- nova_kiosk-0.1.0/setup.cfg +4 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/PKG-INFO +105 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/SOURCES.txt +31 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/dependency_links.txt +1 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/entry_points.txt +2 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/requires.txt +16 -0
- nova_kiosk-0.1.0/src/nova_kiosk.egg-info/top_level.txt +1 -0
- nova_kiosk-0.1.0/src/novaos/__init__.py +12 -0
- nova_kiosk-0.1.0/src/novaos/__main__.py +5 -0
- nova_kiosk-0.1.0/src/novaos/alarm.py +54 -0
- nova_kiosk-0.1.0/src/novaos/app.py +65 -0
- nova_kiosk-0.1.0/src/novaos/audit.py +94 -0
- nova_kiosk-0.1.0/src/novaos/bus.py +84 -0
- nova_kiosk-0.1.0/src/novaos/cli.py +167 -0
- nova_kiosk-0.1.0/src/novaos/config.py +46 -0
- nova_kiosk-0.1.0/src/novaos/constants.py +39 -0
- nova_kiosk-0.1.0/src/novaos/gateway.py +128 -0
- nova_kiosk-0.1.0/src/novaos/main.py +6 -0
- nova_kiosk-0.1.0/src/novaos/models.py +65 -0
- nova_kiosk-0.1.0/src/novaos/qml/main.qml +137 -0
- nova_kiosk-0.1.0/src/novaos/safety.py +73 -0
- nova_kiosk-0.1.0/tests/test_alarm.py +52 -0
- nova_kiosk-0.1.0/tests/test_audit.py +29 -0
- nova_kiosk-0.1.0/tests/test_bus.py +13 -0
- nova_kiosk-0.1.0/tests/test_cli.py +29 -0
- nova_kiosk-0.1.0/tests/test_config.py +35 -0
- nova_kiosk-0.1.0/tests/test_gateway.py +31 -0
- nova_kiosk-0.1.0/tests/test_safety.py +65 -0
- nova_kiosk-0.1.0/tests/test_static.py +36 -0
nova_kiosk-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 单保录
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nova-kiosk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nova OS: industrial Qt Quick Kiosk runtime and data-plane gateway (P0)
|
|
5
|
+
Author-email: eagleye-china <zdt168@sina.cn>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/eagleye-china/NovaOS
|
|
8
|
+
Project-URL: Repository, https://github.com/eagleye-china/NovaOS
|
|
9
|
+
Project-URL: Issues, https://github.com/eagleye-china/NovaOS/issues
|
|
10
|
+
Keywords: qt,pyside6,qml,kiosk,industrial-hmi,opcua,modbus
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Provides-Extra: kiosk
|
|
22
|
+
Requires-Dist: PySide6>=6.6; extra == "kiosk"
|
|
23
|
+
Requires-Dist: pyside-nova>=1.11; extra == "kiosk"
|
|
24
|
+
Provides-Extra: gateway
|
|
25
|
+
Requires-Dist: pyzmq>=25; extra == "gateway"
|
|
26
|
+
Requires-Dist: pymodbus>=3.6; extra == "gateway"
|
|
27
|
+
Requires-Dist: asyncua>=1.1; extra == "gateway"
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: PySide6>=6.6; extra == "all"
|
|
30
|
+
Requires-Dist: pyside-nova>=1.11; extra == "all"
|
|
31
|
+
Requires-Dist: pyzmq>=25; extra == "all"
|
|
32
|
+
Requires-Dist: pymodbus>=3.6; extra == "all"
|
|
33
|
+
Requires-Dist: asyncua>=1.1; extra == "all"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# Nova OS · Industrial Kiosk Runtime
|
|
37
|
+
|
|
38
|
+
> **P0 prototype** — a Qt Quick Kiosk runtime and data-plane gateway for industrial HMI.
|
|
39
|
+
> Not a full OS image, not a closed-loop controller. The lower machine (PLC / slot controller) is never modified.
|
|
40
|
+
|
|
41
|
+
**English** | [简体中文](README_zh.md)
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
44
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
|
|
47
|
+
## What this is
|
|
48
|
+
|
|
49
|
+
Nova OS replaces only the **upper machine** — the human-machine interface. It provides:
|
|
50
|
+
|
|
51
|
+
- **Single-window Kiosk UI** — one full-screen Qt Quick window, three role workbenches switched by in-page navigation (no second `Window`, per EGLFS hard constraint).
|
|
52
|
+
- **Data-plane gateway** — a separate collector process reading Modbus TCP / OPC UA / custom TCP, publishing normalized samples over ZeroMQ `ipc://`. The QML thread never parses a protocol.
|
|
53
|
+
- **Safety gate** — machine-checkable enforcement of the three safety rules below.
|
|
54
|
+
- **Audit trail** — SQLite WAL log of every instruction, including dual confirmation.
|
|
55
|
+
- **Offline simulation** — full P0 data flow without hardware or third-party protocol packages.
|
|
56
|
+
|
|
57
|
+
Distribution name is `nova-kiosk` (`novaos` on PyPI belongs to another project); the import name remains `novaos`.
|
|
58
|
+
|
|
59
|
+
## Three safety rules (non-negotiable)
|
|
60
|
+
|
|
61
|
+
1. **Autonomy** — if the upper machine dies, disconnects or reboots, the lower machine keeps running unchanged. This is test 0 of every acceptance run.
|
|
62
|
+
2. **Suggest, never execute** — an instruction is released only after operator confirmation **and** lower-machine interlock validation. There is no AI closed-loop control.
|
|
63
|
+
3. **Degrade safely** — a physical E-stop / hard manual panel stays independent of Nova OS.
|
|
64
|
+
|
|
65
|
+
Explicitly out of scope for phase one: AI direct control, real-time 3D temperature fields, voice interaction, multi-window desktops, and any change to the lower machine.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install nova-kiosk # core: zero mandatory dependencies
|
|
71
|
+
pip install "nova-kiosk[all]" # + Qt UI, pyside-nova, ZeroMQ, protocol adapters
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`pyside-nova` on PyPI is an older release; the frozen 1.14.0 API used by this repository's QML requires a source install. See `THIRD_PARTY_NOTICES.md`.
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
nova-kiosk --version
|
|
80
|
+
nova-kiosk --check # static gate: config + forbidden-component scan
|
|
81
|
+
nova-kiosk --simulate --slots 500 --ticks 5 # P0 data flow, no hardware needed
|
|
82
|
+
nova-kiosk --kiosk # launch the single-window UI (needs [kiosk] extra)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from novaos import __version__
|
|
87
|
+
from novaos.config import KioskConfig
|
|
88
|
+
from novaos.safety import assert_command_allowed
|
|
89
|
+
|
|
90
|
+
print(__version__, KioskConfig().slot_count)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`--simulate` writes nothing outside a temporary directory. `--kiosk` needs a Qt platform; on headless Linux use `QT_QPA_PLATFORM=offscreen`.
|
|
94
|
+
|
|
95
|
+
## Acceptance boundary
|
|
96
|
+
|
|
97
|
+
This package covers the **software-deliverable part of P0**: static gate, simulated data flow, safety enforcement, audit, and a Kiosk UI skeleton. Image reproducibility (P1), 30-day plant trials (P2) and volume production (P3) require hardware, plant sign-off and CSA release — they are not claimed here. Performance numbers come from reports, not adjectives.
|
|
98
|
+
|
|
99
|
+
## Qt compliance
|
|
100
|
+
|
|
101
|
+
PySide6 is LGPLv3. Phase-one pilots use the LGPL path with replacement means and notices supplied with each device. Commercial Qt licences are purchased only from Qt Company; this project never claims to include one. See `THIRD_PARTY_NOTICES.md`.
|
|
102
|
+
|
|
103
|
+
Releases (commit / push / tag / PyPI / image signing / customer delivery) are performed by the project author only.
|
|
104
|
+
|
|
105
|
+
<p align="center"><sub>If this project helps you, you can <a href="https://ifdian.net/a/eagleye168600">buy me a coffee</a> ☕ — entirely optional, no strings attached.</sub></p>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Nova OS · Industrial Kiosk Runtime
|
|
2
|
+
|
|
3
|
+
> **P0 prototype** — a Qt Quick Kiosk runtime and data-plane gateway for industrial HMI.
|
|
4
|
+
> Not a full OS image, not a closed-loop controller. The lower machine (PLC / slot controller) is never modified.
|
|
5
|
+
|
|
6
|
+
**English** | [简体中文](README_zh.md)
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
9
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
## What this is
|
|
13
|
+
|
|
14
|
+
Nova OS replaces only the **upper machine** — the human-machine interface. It provides:
|
|
15
|
+
|
|
16
|
+
- **Single-window Kiosk UI** — one full-screen Qt Quick window, three role workbenches switched by in-page navigation (no second `Window`, per EGLFS hard constraint).
|
|
17
|
+
- **Data-plane gateway** — a separate collector process reading Modbus TCP / OPC UA / custom TCP, publishing normalized samples over ZeroMQ `ipc://`. The QML thread never parses a protocol.
|
|
18
|
+
- **Safety gate** — machine-checkable enforcement of the three safety rules below.
|
|
19
|
+
- **Audit trail** — SQLite WAL log of every instruction, including dual confirmation.
|
|
20
|
+
- **Offline simulation** — full P0 data flow without hardware or third-party protocol packages.
|
|
21
|
+
|
|
22
|
+
Distribution name is `nova-kiosk` (`novaos` on PyPI belongs to another project); the import name remains `novaos`.
|
|
23
|
+
|
|
24
|
+
## Three safety rules (non-negotiable)
|
|
25
|
+
|
|
26
|
+
1. **Autonomy** — if the upper machine dies, disconnects or reboots, the lower machine keeps running unchanged. This is test 0 of every acceptance run.
|
|
27
|
+
2. **Suggest, never execute** — an instruction is released only after operator confirmation **and** lower-machine interlock validation. There is no AI closed-loop control.
|
|
28
|
+
3. **Degrade safely** — a physical E-stop / hard manual panel stays independent of Nova OS.
|
|
29
|
+
|
|
30
|
+
Explicitly out of scope for phase one: AI direct control, real-time 3D temperature fields, voice interaction, multi-window desktops, and any change to the lower machine.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install nova-kiosk # core: zero mandatory dependencies
|
|
36
|
+
pip install "nova-kiosk[all]" # + Qt UI, pyside-nova, ZeroMQ, protocol adapters
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`pyside-nova` on PyPI is an older release; the frozen 1.14.0 API used by this repository's QML requires a source install. See `THIRD_PARTY_NOTICES.md`.
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
nova-kiosk --version
|
|
45
|
+
nova-kiosk --check # static gate: config + forbidden-component scan
|
|
46
|
+
nova-kiosk --simulate --slots 500 --ticks 5 # P0 data flow, no hardware needed
|
|
47
|
+
nova-kiosk --kiosk # launch the single-window UI (needs [kiosk] extra)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from novaos import __version__
|
|
52
|
+
from novaos.config import KioskConfig
|
|
53
|
+
from novaos.safety import assert_command_allowed
|
|
54
|
+
|
|
55
|
+
print(__version__, KioskConfig().slot_count)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`--simulate` writes nothing outside a temporary directory. `--kiosk` needs a Qt platform; on headless Linux use `QT_QPA_PLATFORM=offscreen`.
|
|
59
|
+
|
|
60
|
+
## Acceptance boundary
|
|
61
|
+
|
|
62
|
+
This package covers the **software-deliverable part of P0**: static gate, simulated data flow, safety enforcement, audit, and a Kiosk UI skeleton. Image reproducibility (P1), 30-day plant trials (P2) and volume production (P3) require hardware, plant sign-off and CSA release — they are not claimed here. Performance numbers come from reports, not adjectives.
|
|
63
|
+
|
|
64
|
+
## Qt compliance
|
|
65
|
+
|
|
66
|
+
PySide6 is LGPLv3. Phase-one pilots use the LGPL path with replacement means and notices supplied with each device. Commercial Qt licences are purchased only from Qt Company; this project never claims to include one. See `THIRD_PARTY_NOTICES.md`.
|
|
67
|
+
|
|
68
|
+
Releases (commit / push / tag / PyPI / image signing / customer delivery) are performed by the project author only.
|
|
69
|
+
|
|
70
|
+
<p align="center"><sub>If this project helps you, you can <a href="https://ifdian.net/a/eagleye168600">buy me a coffee</a> ☕ — entirely optional, no strings attached.</sub></p>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ==========================================================
|
|
2
|
+
# Nova OS · 工业 Kiosk 运行时(P0 可发布形态)
|
|
3
|
+
# 分发名 nova-kiosk(PyPI "novaos" 已被他人占用)
|
|
4
|
+
# GitHub 仓库名仍为 NovaOS,import 包名仍为 novaos
|
|
5
|
+
# ==========================================================
|
|
6
|
+
[build-system]
|
|
7
|
+
requires = ["setuptools>=68", "wheel"]
|
|
8
|
+
build-backend = "setuptools.build_meta"
|
|
9
|
+
|
|
10
|
+
[project]
|
|
11
|
+
name = "nova-kiosk"
|
|
12
|
+
version = "0.1.0"
|
|
13
|
+
description = "Nova OS: industrial Qt Quick Kiosk runtime and data-plane gateway (P0)"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
license = {text = "MIT"}
|
|
17
|
+
authors = [{ name = "eagleye-china", email = "zdt168@sina.cn" }]
|
|
18
|
+
keywords = ["qt", "pyside6", "qml", "kiosk", "industrial-hmi", "opcua", "modbus"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
|
|
27
|
+
]
|
|
28
|
+
# 核心运行时零强制依赖:pip install 在任何环境均可成功。
|
|
29
|
+
# 图形栈 / 工业协议栈按场景以 extras 安装,避免把 Qt / ZeroMQ 强加给纯逻辑用户。
|
|
30
|
+
dependencies = []
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
kiosk = ["PySide6>=6.6", "pyside-nova>=1.11"]
|
|
34
|
+
gateway = ["pyzmq>=25", "pymodbus>=3.6", "asyncua>=1.1"]
|
|
35
|
+
all = ["PySide6>=6.6", "pyside-nova>=1.11", "pyzmq>=25", "pymodbus>=3.6", "asyncua>=1.1"]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
nova-kiosk = "novaos.cli:main"
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/eagleye-china/NovaOS"
|
|
42
|
+
Repository = "https://github.com/eagleye-china/NovaOS"
|
|
43
|
+
Issues = "https://github.com/eagleye-china/NovaOS/issues"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["src"]
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.package-data]
|
|
49
|
+
novaos = ["qml/*.qml"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 100
|
|
53
|
+
target-version = "py310"
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
select = ["E", "F", "I", "N", "W", "UP", "B", "C4", "SIM"]
|
|
57
|
+
ignore = ["N802", "E501"]
|
|
58
|
+
|
|
59
|
+
[tool.mypy]
|
|
60
|
+
python_version = "3.10"
|
|
61
|
+
strict = true
|
|
62
|
+
ignore_missing_imports = true
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nova-kiosk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nova OS: industrial Qt Quick Kiosk runtime and data-plane gateway (P0)
|
|
5
|
+
Author-email: eagleye-china <zdt168@sina.cn>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/eagleye-china/NovaOS
|
|
8
|
+
Project-URL: Repository, https://github.com/eagleye-china/NovaOS
|
|
9
|
+
Project-URL: Issues, https://github.com/eagleye-china/NovaOS/issues
|
|
10
|
+
Keywords: qt,pyside6,qml,kiosk,industrial-hmi,opcua,modbus
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Provides-Extra: kiosk
|
|
22
|
+
Requires-Dist: PySide6>=6.6; extra == "kiosk"
|
|
23
|
+
Requires-Dist: pyside-nova>=1.11; extra == "kiosk"
|
|
24
|
+
Provides-Extra: gateway
|
|
25
|
+
Requires-Dist: pyzmq>=25; extra == "gateway"
|
|
26
|
+
Requires-Dist: pymodbus>=3.6; extra == "gateway"
|
|
27
|
+
Requires-Dist: asyncua>=1.1; extra == "gateway"
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: PySide6>=6.6; extra == "all"
|
|
30
|
+
Requires-Dist: pyside-nova>=1.11; extra == "all"
|
|
31
|
+
Requires-Dist: pyzmq>=25; extra == "all"
|
|
32
|
+
Requires-Dist: pymodbus>=3.6; extra == "all"
|
|
33
|
+
Requires-Dist: asyncua>=1.1; extra == "all"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# Nova OS · Industrial Kiosk Runtime
|
|
37
|
+
|
|
38
|
+
> **P0 prototype** — a Qt Quick Kiosk runtime and data-plane gateway for industrial HMI.
|
|
39
|
+
> Not a full OS image, not a closed-loop controller. The lower machine (PLC / slot controller) is never modified.
|
|
40
|
+
|
|
41
|
+
**English** | [简体中文](README_zh.md)
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
44
|
+
[](https://pypi.org/project/nova-kiosk/)
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
|
|
47
|
+
## What this is
|
|
48
|
+
|
|
49
|
+
Nova OS replaces only the **upper machine** — the human-machine interface. It provides:
|
|
50
|
+
|
|
51
|
+
- **Single-window Kiosk UI** — one full-screen Qt Quick window, three role workbenches switched by in-page navigation (no second `Window`, per EGLFS hard constraint).
|
|
52
|
+
- **Data-plane gateway** — a separate collector process reading Modbus TCP / OPC UA / custom TCP, publishing normalized samples over ZeroMQ `ipc://`. The QML thread never parses a protocol.
|
|
53
|
+
- **Safety gate** — machine-checkable enforcement of the three safety rules below.
|
|
54
|
+
- **Audit trail** — SQLite WAL log of every instruction, including dual confirmation.
|
|
55
|
+
- **Offline simulation** — full P0 data flow without hardware or third-party protocol packages.
|
|
56
|
+
|
|
57
|
+
Distribution name is `nova-kiosk` (`novaos` on PyPI belongs to another project); the import name remains `novaos`.
|
|
58
|
+
|
|
59
|
+
## Three safety rules (non-negotiable)
|
|
60
|
+
|
|
61
|
+
1. **Autonomy** — if the upper machine dies, disconnects or reboots, the lower machine keeps running unchanged. This is test 0 of every acceptance run.
|
|
62
|
+
2. **Suggest, never execute** — an instruction is released only after operator confirmation **and** lower-machine interlock validation. There is no AI closed-loop control.
|
|
63
|
+
3. **Degrade safely** — a physical E-stop / hard manual panel stays independent of Nova OS.
|
|
64
|
+
|
|
65
|
+
Explicitly out of scope for phase one: AI direct control, real-time 3D temperature fields, voice interaction, multi-window desktops, and any change to the lower machine.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install nova-kiosk # core: zero mandatory dependencies
|
|
71
|
+
pip install "nova-kiosk[all]" # + Qt UI, pyside-nova, ZeroMQ, protocol adapters
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`pyside-nova` on PyPI is an older release; the frozen 1.14.0 API used by this repository's QML requires a source install. See `THIRD_PARTY_NOTICES.md`.
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
nova-kiosk --version
|
|
80
|
+
nova-kiosk --check # static gate: config + forbidden-component scan
|
|
81
|
+
nova-kiosk --simulate --slots 500 --ticks 5 # P0 data flow, no hardware needed
|
|
82
|
+
nova-kiosk --kiosk # launch the single-window UI (needs [kiosk] extra)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from novaos import __version__
|
|
87
|
+
from novaos.config import KioskConfig
|
|
88
|
+
from novaos.safety import assert_command_allowed
|
|
89
|
+
|
|
90
|
+
print(__version__, KioskConfig().slot_count)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`--simulate` writes nothing outside a temporary directory. `--kiosk` needs a Qt platform; on headless Linux use `QT_QPA_PLATFORM=offscreen`.
|
|
94
|
+
|
|
95
|
+
## Acceptance boundary
|
|
96
|
+
|
|
97
|
+
This package covers the **software-deliverable part of P0**: static gate, simulated data flow, safety enforcement, audit, and a Kiosk UI skeleton. Image reproducibility (P1), 30-day plant trials (P2) and volume production (P3) require hardware, plant sign-off and CSA release — they are not claimed here. Performance numbers come from reports, not adjectives.
|
|
98
|
+
|
|
99
|
+
## Qt compliance
|
|
100
|
+
|
|
101
|
+
PySide6 is LGPLv3. Phase-one pilots use the LGPL path with replacement means and notices supplied with each device. Commercial Qt licences are purchased only from Qt Company; this project never claims to include one. See `THIRD_PARTY_NOTICES.md`.
|
|
102
|
+
|
|
103
|
+
Releases (commit / push / tag / PyPI / image signing / customer delivery) are performed by the project author only.
|
|
104
|
+
|
|
105
|
+
<p align="center"><sub>If this project helps you, you can <a href="https://ifdian.net/a/eagleye168600">buy me a coffee</a> ☕ — entirely optional, no strings attached.</sub></p>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/nova_kiosk.egg-info/PKG-INFO
|
|
5
|
+
src/nova_kiosk.egg-info/SOURCES.txt
|
|
6
|
+
src/nova_kiosk.egg-info/dependency_links.txt
|
|
7
|
+
src/nova_kiosk.egg-info/entry_points.txt
|
|
8
|
+
src/nova_kiosk.egg-info/requires.txt
|
|
9
|
+
src/nova_kiosk.egg-info/top_level.txt
|
|
10
|
+
src/novaos/__init__.py
|
|
11
|
+
src/novaos/__main__.py
|
|
12
|
+
src/novaos/alarm.py
|
|
13
|
+
src/novaos/app.py
|
|
14
|
+
src/novaos/audit.py
|
|
15
|
+
src/novaos/bus.py
|
|
16
|
+
src/novaos/cli.py
|
|
17
|
+
src/novaos/config.py
|
|
18
|
+
src/novaos/constants.py
|
|
19
|
+
src/novaos/gateway.py
|
|
20
|
+
src/novaos/main.py
|
|
21
|
+
src/novaos/models.py
|
|
22
|
+
src/novaos/safety.py
|
|
23
|
+
src/novaos/qml/main.qml
|
|
24
|
+
tests/test_alarm.py
|
|
25
|
+
tests/test_audit.py
|
|
26
|
+
tests/test_bus.py
|
|
27
|
+
tests/test_cli.py
|
|
28
|
+
tests/test_config.py
|
|
29
|
+
tests/test_gateway.py
|
|
30
|
+
tests/test_safety.py
|
|
31
|
+
tests/test_static.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
novaos
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Nova OS 工业 Kiosk 运行时(分发名 nova-kiosk,import 名 novaos)。"""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from novaos.constants import DISTRIBUTION_NAME, FALLBACK_VERSION
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
__version__ = version(DISTRIBUTION_NAME)
|
|
9
|
+
except PackageNotFoundError:
|
|
10
|
+
__version__ = FALLBACK_VERSION
|
|
11
|
+
|
|
12
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""三级告警:防抖抑制、不可自动消失、人工 ack(§8.4 HMI 契约)。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
|
|
7
|
+
from novaos.constants import ALARM_LEVELS
|
|
8
|
+
from novaos.models import Alarm
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class AlarmModel:
|
|
13
|
+
"""同一点位同一 code 在防抖窗口内只入列一次,抑制告警风暴。"""
|
|
14
|
+
|
|
15
|
+
debounce_ms: int = 1000
|
|
16
|
+
_items: list[Alarm] = field(default_factory=list)
|
|
17
|
+
_last_seen: dict[tuple[int, str], float] = field(default_factory=dict)
|
|
18
|
+
_ack_by: dict[int, str] = field(default_factory=dict)
|
|
19
|
+
|
|
20
|
+
def add(self, alarm: Alarm) -> bool:
|
|
21
|
+
"""返回 True 表示新告警入列,False 表示被防抖抑制。"""
|
|
22
|
+
if alarm.level not in ALARM_LEVELS:
|
|
23
|
+
msg = f"未知告警级别:{alarm.level!r},允许值={ALARM_LEVELS}"
|
|
24
|
+
raise ValueError(msg)
|
|
25
|
+
key = (alarm.slot_id, alarm.code)
|
|
26
|
+
previous = self._last_seen.get(key)
|
|
27
|
+
if previous is not None and (alarm.timestamp - previous) * 1000 < self.debounce_ms:
|
|
28
|
+
return False
|
|
29
|
+
self._last_seen[key] = alarm.timestamp
|
|
30
|
+
self._items.append(alarm)
|
|
31
|
+
return True
|
|
32
|
+
|
|
33
|
+
def ack(self, index: int, operator: str) -> None:
|
|
34
|
+
"""人工确认;索引越界立即失败,避免静默吞掉确认动作。"""
|
|
35
|
+
if index < 0 or index >= len(self._items):
|
|
36
|
+
msg = f"告警索引越界:{index}"
|
|
37
|
+
raise IndexError(msg)
|
|
38
|
+
if not operator:
|
|
39
|
+
msg = "确认人不得为空"
|
|
40
|
+
raise ValueError(msg)
|
|
41
|
+
self._ack_by[index] = operator
|
|
42
|
+
|
|
43
|
+
def is_acknowledged(self, index: int) -> bool:
|
|
44
|
+
return index in self._ack_by
|
|
45
|
+
|
|
46
|
+
def acknowledged_by(self, index: int) -> str:
|
|
47
|
+
return self._ack_by.get(index, "")
|
|
48
|
+
|
|
49
|
+
def pending(self) -> list[Alarm]:
|
|
50
|
+
"""未确认告警;告警只能靠人工 ack 退场,无自动消失逻辑。"""
|
|
51
|
+
return [item for index, item in enumerate(self._items) if index not in self._ack_by]
|
|
52
|
+
|
|
53
|
+
def all(self) -> list[Alarm]:
|
|
54
|
+
return list(self._items)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Qt Kiosk 启动器:单窗口、QML 组件级隔离(D7 / §7)。
|
|
2
|
+
|
|
3
|
+
Qt 依赖惰性导入:未安装 ``kiosk`` extra 时给出明确提示,不影响核心包。
|
|
4
|
+
setContextProperty 的 Python 对象保留强引用至 ``app.exec()`` 返回(坑位 77)。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from novaos.config import KioskConfig
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run_kiosk(config: KioskConfig) -> int:
|
|
16
|
+
"""启动单窗口 Kiosk;返回进程退出码。"""
|
|
17
|
+
try:
|
|
18
|
+
from PySide6.QtCore import Property, QObject, Slot
|
|
19
|
+
from PySide6.QtGui import QGuiApplication
|
|
20
|
+
from PySide6.QtQml import QQmlApplicationEngine
|
|
21
|
+
except ImportError as exc:
|
|
22
|
+
print("缺少 Qt 图形栈:pip install 'nova-kiosk[kiosk]'", file=sys.stderr)
|
|
23
|
+
return 2
|
|
24
|
+
|
|
25
|
+
class KioskBridge(QObject):
|
|
26
|
+
"""QML 门面:只读配置 + 意图入口,不持有下位机连接。"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, cfg: KioskConfig) -> None:
|
|
29
|
+
super().__init__()
|
|
30
|
+
self._cfg = cfg
|
|
31
|
+
|
|
32
|
+
@Property(str, constant=True)
|
|
33
|
+
def role(self) -> str:
|
|
34
|
+
return self._cfg.role_token
|
|
35
|
+
|
|
36
|
+
@Property(str, constant=True)
|
|
37
|
+
def defaultPage(self) -> str:
|
|
38
|
+
return self._cfg.default_page
|
|
39
|
+
|
|
40
|
+
@Property(int, constant=True)
|
|
41
|
+
def slotCount(self) -> int:
|
|
42
|
+
return self._cfg.slot_count
|
|
43
|
+
|
|
44
|
+
@Slot(str, str, bool, result=bool)
|
|
45
|
+
def confirmCommand(self, command_id: str, action: str, interlock: bool) -> bool:
|
|
46
|
+
"""只登记意图,绝不直接下发;真实闸门在 safety.assert_command_allowed。"""
|
|
47
|
+
return bool(command_id) and bool(action) and interlock
|
|
48
|
+
|
|
49
|
+
app = QGuiApplication(sys.argv)
|
|
50
|
+
try:
|
|
51
|
+
from pyside_nova import init_nova
|
|
52
|
+
except ImportError:
|
|
53
|
+
init_nova = None # type: ignore[assignment]
|
|
54
|
+
if init_nova is not None:
|
|
55
|
+
init_nova()
|
|
56
|
+
|
|
57
|
+
bridge = KioskBridge(config) # 强引用,活到 exec() 结束
|
|
58
|
+
engine = QQmlApplicationEngine()
|
|
59
|
+
engine.rootContext().setContextProperty("kiosk", bridge)
|
|
60
|
+
qml_path = Path(__file__).parent / "qml" / "main.qml"
|
|
61
|
+
engine.load(str(qml_path))
|
|
62
|
+
if not engine.rootObjects():
|
|
63
|
+
print(f"QML 加载失败:{qml_path}", file=sys.stderr)
|
|
64
|
+
return 1
|
|
65
|
+
return app.exec()
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""SQLite WAL 审计留痕:谁在何时确认了哪条指令(§8.4 / §9.7)。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sqlite3
|
|
6
|
+
|
|
7
|
+
from novaos.models import CommandIntent, Confirmation
|
|
8
|
+
|
|
9
|
+
_SCHEMA = """
|
|
10
|
+
CREATE TABLE IF NOT EXISTS audit_log (
|
|
11
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12
|
+
ts REAL NOT NULL,
|
|
13
|
+
command_id TEXT NOT NULL,
|
|
14
|
+
slot_id INTEGER NOT NULL,
|
|
15
|
+
action TEXT NOT NULL,
|
|
16
|
+
operator TEXT NOT NULL,
|
|
17
|
+
second_operator TEXT NOT NULL,
|
|
18
|
+
plc_interlock_ok INTEGER NOT NULL,
|
|
19
|
+
note TEXT NOT NULL DEFAULT ''
|
|
20
|
+
)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AuditLog:
|
|
25
|
+
"""只追加日志;``:memory:`` 用于测试与模拟,不落盘。"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, db_path: str = ":memory:") -> None:
|
|
28
|
+
self._conn = sqlite3.connect(db_path)
|
|
29
|
+
self._conn.execute("PRAGMA journal_mode=WAL")
|
|
30
|
+
self._conn.execute(_SCHEMA)
|
|
31
|
+
self._conn.commit()
|
|
32
|
+
|
|
33
|
+
def record(
|
|
34
|
+
self,
|
|
35
|
+
intent: CommandIntent,
|
|
36
|
+
*,
|
|
37
|
+
timestamp: float,
|
|
38
|
+
note: str = "",
|
|
39
|
+
) -> int:
|
|
40
|
+
cursor = self._conn.execute(
|
|
41
|
+
"INSERT INTO audit_log "
|
|
42
|
+
"(ts, command_id, slot_id, action, operator, second_operator, "
|
|
43
|
+
" plc_interlock_ok, note) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
44
|
+
(
|
|
45
|
+
timestamp,
|
|
46
|
+
intent.command_id,
|
|
47
|
+
intent.slot_id,
|
|
48
|
+
intent.action,
|
|
49
|
+
intent.operator,
|
|
50
|
+
intent.second_operator,
|
|
51
|
+
int(intent.plc_interlock_ok),
|
|
52
|
+
note,
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
self._conn.commit()
|
|
56
|
+
return int(cursor.lastrowid)
|
|
57
|
+
|
|
58
|
+
def record_confirmation(self, confirmation: Confirmation) -> int:
|
|
59
|
+
"""双人确认独立留痕,便于厂方安全评审逐条回溯。"""
|
|
60
|
+
cursor = self._conn.execute(
|
|
61
|
+
"INSERT INTO audit_log "
|
|
62
|
+
"(ts, command_id, slot_id, action, operator, second_operator, "
|
|
63
|
+
" plc_interlock_ok, note) VALUES (?, ?, 0, 'dual_confirm', ?, ?, 0, '')",
|
|
64
|
+
(
|
|
65
|
+
confirmation.timestamp,
|
|
66
|
+
confirmation.intent_id,
|
|
67
|
+
confirmation.primary,
|
|
68
|
+
confirmation.secondary,
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
self._conn.commit()
|
|
72
|
+
return int(cursor.lastrowid)
|
|
73
|
+
|
|
74
|
+
def query(self, limit: int = 50) -> list[tuple]:
|
|
75
|
+
cursor = self._conn.execute(
|
|
76
|
+
"SELECT id, ts, command_id, slot_id, action, operator, "
|
|
77
|
+
"second_operator, plc_interlock_ok, note "
|
|
78
|
+
"FROM audit_log ORDER BY id DESC LIMIT ?",
|
|
79
|
+
(limit,),
|
|
80
|
+
)
|
|
81
|
+
return cursor.fetchall()
|
|
82
|
+
|
|
83
|
+
def count(self) -> int:
|
|
84
|
+
cursor = self._conn.execute("SELECT COUNT(*) FROM audit_log")
|
|
85
|
+
return int(cursor.fetchone()[0])
|
|
86
|
+
|
|
87
|
+
def close(self) -> None:
|
|
88
|
+
self._conn.close()
|
|
89
|
+
|
|
90
|
+
def __enter__(self) -> AuditLog:
|
|
91
|
+
return self
|
|
92
|
+
|
|
93
|
+
def __exit__(self, *_exc: object) -> None:
|
|
94
|
+
self.close()
|