aassrv2-core 1.0.1__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.
- aassrv2_core-1.0.1/LICENSE +21 -0
- aassrv2_core-1.0.1/PKG-INFO +117 -0
- aassrv2_core-1.0.1/README.md +96 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/PKG-INFO +117 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/SOURCES.txt +34 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/dependency_links.txt +1 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/entry_points.txt +2 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/requires.txt +3 -0
- aassrv2_core-1.0.1/aassrv2_core.egg-info/top_level.txt +2 -0
- aassrv2_core-1.0.1/aassrv2_gui/__init__.py +9 -0
- aassrv2_core-1.0.1/aassrv2_gui/__main__.py +4 -0
- aassrv2_core-1.0.1/aassrv2_gui/app.py +24 -0
- aassrv2_core-1.0.1/aassrv2_gui/launcher.py +11 -0
- aassrv2_core-1.0.1/aassrv2_gui/model.py +77 -0
- aassrv2_core-1.0.1/aassrv2_gui/window.py +418 -0
- aassrv2_core-1.0.1/core/__init__.py +40 -0
- aassrv2_core-1.0.1/core/actions.py +8 -0
- aassrv2_core-1.0.1/core/contracts.py +51 -0
- aassrv2_core-1.0.1/core/datas.py +52 -0
- aassrv2_core-1.0.1/core/imagination.py +319 -0
- aassrv2_core-1.0.1/core/knowledge_storage.py +114 -0
- aassrv2_core-1.0.1/core/main.py +46 -0
- aassrv2_core-1.0.1/core/policy.py +327 -0
- aassrv2_core-1.0.1/core/prophecy.py +62 -0
- aassrv2_core-1.0.1/core/py.typed +0 -0
- aassrv2_core-1.0.1/core/trajectory_scoring.py +514 -0
- aassrv2_core-1.0.1/pyproject.toml +39 -0
- aassrv2_core-1.0.1/setup.cfg +4 -0
- aassrv2_core-1.0.1/tests/test_code_style.py +24 -0
- aassrv2_core-1.0.1/tests/test_core_contract.py +131 -0
- aassrv2_core-1.0.1/tests/test_gui_model.py +51 -0
- aassrv2_core-1.0.1/tests/test_gui_window.py +45 -0
- aassrv2_core-1.0.1/tests/test_policy.py +148 -0
- aassrv2_core-1.0.1/tests/test_release_surface.py +37 -0
- aassrv2_core-1.0.1/tests/test_trajectory_scoring.py +238 -0
- aassrv2_core-1.0.1/tests/test_version_contract.py +14 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aether0xff-afk
|
|
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,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aassrv2-core
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Environment-independent cognitive core for AASSRv2
|
|
5
|
+
Author: aether0xff-afk
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/aether0xff-afk/AASSRv2
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: gui
|
|
19
|
+
Requires-Dist: PyQt6<7,>=6.7; extra == "gui"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# AASSRv2 Core
|
|
23
|
+
|
|
24
|
+
> **Current core release:** `v1.0.1`
|
|
25
|
+
|
|
26
|
+
AASSRv2 Core는 환경 구현, 플러그인 구현, 학습 실험과 자산을 포함하지 않는 순수
|
|
27
|
+
Python 인지 코어 패키지다. 상태와 행동, 지식 저장, 예측·상상, 정책, 궤적 평가,
|
|
28
|
+
환경 독립 실행 계약과 선택 설치형 PyQt Core Workbench를 제공한다.
|
|
29
|
+
|
|
30
|
+
## Release scope
|
|
31
|
+
|
|
32
|
+
이 브랜치가 배포하는 범위는 다음뿐이다.
|
|
33
|
+
|
|
34
|
+
- `core/`: AASSRv2 Core 런타임과 환경 독립 계약
|
|
35
|
+
- `aassrv2_gui/`: 플러그인을 포함하지 않는 PyQt Core Workbench
|
|
36
|
+
- `tests/`: Core 단위·계약 테스트
|
|
37
|
+
- `pyproject.toml`: `aassrv2-core` 빌드 메타데이터
|
|
38
|
+
- `LICENSE`, `VERSION`: 라이선스와 릴리즈 버전
|
|
39
|
+
|
|
40
|
+
GridWorld를 포함한 구체 환경, 플러그인, training pipeline, 연구 runner, notebook,
|
|
41
|
+
checkpoint와 실행 결과는 이 릴리즈에 포함하지 않는다.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
Python 3.10 이상이 필요하다. 런타임 외부 의존성은 없다.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python -m pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
설치 후:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from core import Action, AASSRCore, Plugin, State
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class CounterSession(Plugin):
|
|
58
|
+
def __init__(self) -> None:
|
|
59
|
+
self.value = 0
|
|
60
|
+
self.increment = Action("increment")
|
|
61
|
+
|
|
62
|
+
def observe(self) -> State:
|
|
63
|
+
return State({"value": self.value})
|
|
64
|
+
|
|
65
|
+
def available_actions(self) -> list[Action]:
|
|
66
|
+
return [self.increment]
|
|
67
|
+
|
|
68
|
+
def execute(self, action: Action) -> None:
|
|
69
|
+
if action != self.increment:
|
|
70
|
+
raise ValueError(action.key)
|
|
71
|
+
self.value += 1
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
core = AASSRCore(CounterSession())
|
|
75
|
+
transition = core.act(core.available_actions()[0])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## PyQt Core Workbench
|
|
79
|
+
|
|
80
|
+
GUI를 함께 설치한다.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python -m pip install ".[gui]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
다음 중 하나로 실행한다.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
aassrv2-gui
|
|
90
|
+
python -m aassrv2_gui
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Workbench는 특정 환경이나 플러그인을 내장하지 않는다. 사용자가 현재 상태와 다음
|
|
94
|
+
상태를 JSON 객체로 입력하고 행동을 선택하면 실제 `AASSRCore.act()`를 실행해 다음을
|
|
95
|
+
확인할 수 있다.
|
|
96
|
+
|
|
97
|
+
- 현재 semantic state와 사용 가능한 action
|
|
98
|
+
- 실행된 `(State, Action, Next State)` ASEQ
|
|
99
|
+
- transition history와 memory revision
|
|
100
|
+
- Core가 허용하는 flat scalar JSON 상태 계약
|
|
101
|
+
|
|
102
|
+
## Verify and build
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python -m pip install -r requirements-dev.txt
|
|
106
|
+
python -m pytest -q
|
|
107
|
+
python -m build
|
|
108
|
+
python -m twine check dist/*
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
빌드 결과의 wheel과 source distribution에는 `core`와 환경 독립
|
|
112
|
+
`aassrv2_gui` 패키지만 포함된다. PyQt6는 `gui` extra를 선택했을 때만 설치되므로
|
|
113
|
+
Core 자체의 런타임 의존성은 계속 0개다.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT. 자세한 내용은 `LICENSE`를 참고한다.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# AASSRv2 Core
|
|
2
|
+
|
|
3
|
+
> **Current core release:** `v1.0.1`
|
|
4
|
+
|
|
5
|
+
AASSRv2 Core는 환경 구현, 플러그인 구현, 학습 실험과 자산을 포함하지 않는 순수
|
|
6
|
+
Python 인지 코어 패키지다. 상태와 행동, 지식 저장, 예측·상상, 정책, 궤적 평가,
|
|
7
|
+
환경 독립 실행 계약과 선택 설치형 PyQt Core Workbench를 제공한다.
|
|
8
|
+
|
|
9
|
+
## Release scope
|
|
10
|
+
|
|
11
|
+
이 브랜치가 배포하는 범위는 다음뿐이다.
|
|
12
|
+
|
|
13
|
+
- `core/`: AASSRv2 Core 런타임과 환경 독립 계약
|
|
14
|
+
- `aassrv2_gui/`: 플러그인을 포함하지 않는 PyQt Core Workbench
|
|
15
|
+
- `tests/`: Core 단위·계약 테스트
|
|
16
|
+
- `pyproject.toml`: `aassrv2-core` 빌드 메타데이터
|
|
17
|
+
- `LICENSE`, `VERSION`: 라이선스와 릴리즈 버전
|
|
18
|
+
|
|
19
|
+
GridWorld를 포함한 구체 환경, 플러그인, training pipeline, 연구 runner, notebook,
|
|
20
|
+
checkpoint와 실행 결과는 이 릴리즈에 포함하지 않는다.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
Python 3.10 이상이 필요하다. 런타임 외부 의존성은 없다.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m pip install .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
설치 후:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from core import Action, AASSRCore, Plugin, State
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class CounterSession(Plugin):
|
|
37
|
+
def __init__(self) -> None:
|
|
38
|
+
self.value = 0
|
|
39
|
+
self.increment = Action("increment")
|
|
40
|
+
|
|
41
|
+
def observe(self) -> State:
|
|
42
|
+
return State({"value": self.value})
|
|
43
|
+
|
|
44
|
+
def available_actions(self) -> list[Action]:
|
|
45
|
+
return [self.increment]
|
|
46
|
+
|
|
47
|
+
def execute(self, action: Action) -> None:
|
|
48
|
+
if action != self.increment:
|
|
49
|
+
raise ValueError(action.key)
|
|
50
|
+
self.value += 1
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
core = AASSRCore(CounterSession())
|
|
54
|
+
transition = core.act(core.available_actions()[0])
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## PyQt Core Workbench
|
|
58
|
+
|
|
59
|
+
GUI를 함께 설치한다.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python -m pip install ".[gui]"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
다음 중 하나로 실행한다.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
aassrv2-gui
|
|
69
|
+
python -m aassrv2_gui
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Workbench는 특정 환경이나 플러그인을 내장하지 않는다. 사용자가 현재 상태와 다음
|
|
73
|
+
상태를 JSON 객체로 입력하고 행동을 선택하면 실제 `AASSRCore.act()`를 실행해 다음을
|
|
74
|
+
확인할 수 있다.
|
|
75
|
+
|
|
76
|
+
- 현재 semantic state와 사용 가능한 action
|
|
77
|
+
- 실행된 `(State, Action, Next State)` ASEQ
|
|
78
|
+
- transition history와 memory revision
|
|
79
|
+
- Core가 허용하는 flat scalar JSON 상태 계약
|
|
80
|
+
|
|
81
|
+
## Verify and build
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m pip install -r requirements-dev.txt
|
|
85
|
+
python -m pytest -q
|
|
86
|
+
python -m build
|
|
87
|
+
python -m twine check dist/*
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
빌드 결과의 wheel과 source distribution에는 `core`와 환경 독립
|
|
91
|
+
`aassrv2_gui` 패키지만 포함된다. PyQt6는 `gui` extra를 선택했을 때만 설치되므로
|
|
92
|
+
Core 자체의 런타임 의존성은 계속 0개다.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT. 자세한 내용은 `LICENSE`를 참고한다.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aassrv2-core
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Environment-independent cognitive core for AASSRv2
|
|
5
|
+
Author: aether0xff-afk
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/aether0xff-afk/AASSRv2
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Provides-Extra: gui
|
|
19
|
+
Requires-Dist: PyQt6<7,>=6.7; extra == "gui"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# AASSRv2 Core
|
|
23
|
+
|
|
24
|
+
> **Current core release:** `v1.0.1`
|
|
25
|
+
|
|
26
|
+
AASSRv2 Core는 환경 구현, 플러그인 구현, 학습 실험과 자산을 포함하지 않는 순수
|
|
27
|
+
Python 인지 코어 패키지다. 상태와 행동, 지식 저장, 예측·상상, 정책, 궤적 평가,
|
|
28
|
+
환경 독립 실행 계약과 선택 설치형 PyQt Core Workbench를 제공한다.
|
|
29
|
+
|
|
30
|
+
## Release scope
|
|
31
|
+
|
|
32
|
+
이 브랜치가 배포하는 범위는 다음뿐이다.
|
|
33
|
+
|
|
34
|
+
- `core/`: AASSRv2 Core 런타임과 환경 독립 계약
|
|
35
|
+
- `aassrv2_gui/`: 플러그인을 포함하지 않는 PyQt Core Workbench
|
|
36
|
+
- `tests/`: Core 단위·계약 테스트
|
|
37
|
+
- `pyproject.toml`: `aassrv2-core` 빌드 메타데이터
|
|
38
|
+
- `LICENSE`, `VERSION`: 라이선스와 릴리즈 버전
|
|
39
|
+
|
|
40
|
+
GridWorld를 포함한 구체 환경, 플러그인, training pipeline, 연구 runner, notebook,
|
|
41
|
+
checkpoint와 실행 결과는 이 릴리즈에 포함하지 않는다.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
Python 3.10 이상이 필요하다. 런타임 외부 의존성은 없다.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python -m pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
설치 후:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from core import Action, AASSRCore, Plugin, State
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class CounterSession(Plugin):
|
|
58
|
+
def __init__(self) -> None:
|
|
59
|
+
self.value = 0
|
|
60
|
+
self.increment = Action("increment")
|
|
61
|
+
|
|
62
|
+
def observe(self) -> State:
|
|
63
|
+
return State({"value": self.value})
|
|
64
|
+
|
|
65
|
+
def available_actions(self) -> list[Action]:
|
|
66
|
+
return [self.increment]
|
|
67
|
+
|
|
68
|
+
def execute(self, action: Action) -> None:
|
|
69
|
+
if action != self.increment:
|
|
70
|
+
raise ValueError(action.key)
|
|
71
|
+
self.value += 1
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
core = AASSRCore(CounterSession())
|
|
75
|
+
transition = core.act(core.available_actions()[0])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## PyQt Core Workbench
|
|
79
|
+
|
|
80
|
+
GUI를 함께 설치한다.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python -m pip install ".[gui]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
다음 중 하나로 실행한다.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
aassrv2-gui
|
|
90
|
+
python -m aassrv2_gui
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Workbench는 특정 환경이나 플러그인을 내장하지 않는다. 사용자가 현재 상태와 다음
|
|
94
|
+
상태를 JSON 객체로 입력하고 행동을 선택하면 실제 `AASSRCore.act()`를 실행해 다음을
|
|
95
|
+
확인할 수 있다.
|
|
96
|
+
|
|
97
|
+
- 현재 semantic state와 사용 가능한 action
|
|
98
|
+
- 실행된 `(State, Action, Next State)` ASEQ
|
|
99
|
+
- transition history와 memory revision
|
|
100
|
+
- Core가 허용하는 flat scalar JSON 상태 계약
|
|
101
|
+
|
|
102
|
+
## Verify and build
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python -m pip install -r requirements-dev.txt
|
|
106
|
+
python -m pytest -q
|
|
107
|
+
python -m build
|
|
108
|
+
python -m twine check dist/*
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
빌드 결과의 wheel과 source distribution에는 `core`와 환경 독립
|
|
112
|
+
`aassrv2_gui` 패키지만 포함된다. PyQt6는 `gui` extra를 선택했을 때만 설치되므로
|
|
113
|
+
Core 자체의 런타임 의존성은 계속 0개다.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT. 자세한 내용은 `LICENSE`를 참고한다.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
aassrv2_core.egg-info/PKG-INFO
|
|
5
|
+
aassrv2_core.egg-info/SOURCES.txt
|
|
6
|
+
aassrv2_core.egg-info/dependency_links.txt
|
|
7
|
+
aassrv2_core.egg-info/entry_points.txt
|
|
8
|
+
aassrv2_core.egg-info/requires.txt
|
|
9
|
+
aassrv2_core.egg-info/top_level.txt
|
|
10
|
+
aassrv2_gui/__init__.py
|
|
11
|
+
aassrv2_gui/__main__.py
|
|
12
|
+
aassrv2_gui/app.py
|
|
13
|
+
aassrv2_gui/launcher.py
|
|
14
|
+
aassrv2_gui/model.py
|
|
15
|
+
aassrv2_gui/window.py
|
|
16
|
+
core/__init__.py
|
|
17
|
+
core/actions.py
|
|
18
|
+
core/contracts.py
|
|
19
|
+
core/datas.py
|
|
20
|
+
core/imagination.py
|
|
21
|
+
core/knowledge_storage.py
|
|
22
|
+
core/main.py
|
|
23
|
+
core/policy.py
|
|
24
|
+
core/prophecy.py
|
|
25
|
+
core/py.typed
|
|
26
|
+
core/trajectory_scoring.py
|
|
27
|
+
tests/test_code_style.py
|
|
28
|
+
tests/test_core_contract.py
|
|
29
|
+
tests/test_gui_model.py
|
|
30
|
+
tests/test_gui_window.py
|
|
31
|
+
tests/test_policy.py
|
|
32
|
+
tests/test_release_surface.py
|
|
33
|
+
tests/test_trajectory_scoring.py
|
|
34
|
+
tests/test_version_contract.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from PyQt6.QtWidgets import QApplication
|
|
4
|
+
|
|
5
|
+
from .window import WorkbenchWindow
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def create_application(
|
|
9
|
+
arguments: list[str] | None = None,
|
|
10
|
+
) -> tuple[QApplication, WorkbenchWindow]:
|
|
11
|
+
application = QApplication.instance()
|
|
12
|
+
if application is None:
|
|
13
|
+
application = QApplication(arguments if arguments is not None else sys.argv)
|
|
14
|
+
|
|
15
|
+
application.setApplicationName("AASSRv2 Core Workbench")
|
|
16
|
+
application.setOrganizationName("AASSRv2")
|
|
17
|
+
window = WorkbenchWindow()
|
|
18
|
+
return application, window
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def run(arguments: list[str] | None = None) -> int:
|
|
22
|
+
application, window = create_application(arguments)
|
|
23
|
+
window.show()
|
|
24
|
+
return application.exec()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
def main() -> int:
|
|
2
|
+
try:
|
|
3
|
+
from .app import run
|
|
4
|
+
except ModuleNotFoundError as error:
|
|
5
|
+
if error.name == "PyQt6" or str(error.name).startswith("PyQt6."):
|
|
6
|
+
raise SystemExit(
|
|
7
|
+
'PyQt6가 필요합니다. pip install "aassrv2-core[gui]"로 설치하세요.'
|
|
8
|
+
) from error
|
|
9
|
+
raise
|
|
10
|
+
|
|
11
|
+
return run()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
from core import Action, Plugin, State
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def parse_state_json(text: str) -> State:
|
|
8
|
+
"""Parse the flat semantic-state format accepted by AASSRv2 Core."""
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
data = json.loads(text)
|
|
12
|
+
except json.JSONDecodeError as error:
|
|
13
|
+
raise ValueError(f"상태 JSON을 해석할 수 없습니다: {error.msg}") from error
|
|
14
|
+
|
|
15
|
+
if not isinstance(data, dict):
|
|
16
|
+
raise ValueError("상태는 JSON 객체여야 합니다")
|
|
17
|
+
|
|
18
|
+
allowed_values = (bool, int, float, str, type(None))
|
|
19
|
+
facts: dict[str, bool | int | float | str | None] = {}
|
|
20
|
+
|
|
21
|
+
for key, value in data.items():
|
|
22
|
+
if not isinstance(key, str):
|
|
23
|
+
raise ValueError("상태 키는 문자열이어야 합니다")
|
|
24
|
+
if not isinstance(value, allowed_values):
|
|
25
|
+
raise ValueError(
|
|
26
|
+
f"{key!r} 값은 bool, number, string, null 중 하나여야 합니다"
|
|
27
|
+
)
|
|
28
|
+
facts[key] = value
|
|
29
|
+
|
|
30
|
+
return State(facts)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def parse_action_keys(text: str) -> list[str]:
|
|
34
|
+
"""Parse comma or newline separated action identifiers."""
|
|
35
|
+
|
|
36
|
+
keys = [item.strip() for item in re.split(r"[,\n]", text)]
|
|
37
|
+
keys = [key for key in keys if key]
|
|
38
|
+
|
|
39
|
+
if len(keys) == 0:
|
|
40
|
+
raise ValueError("행동을 하나 이상 입력해야 합니다")
|
|
41
|
+
if len(set(keys)) != len(keys):
|
|
42
|
+
raise ValueError("행동 ID는 중복될 수 없습니다")
|
|
43
|
+
|
|
44
|
+
return keys
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ManualSession(Plugin):
|
|
48
|
+
"""GUI adapter that lets a user drive Core without bundling a domain plugin."""
|
|
49
|
+
|
|
50
|
+
def __init__(self, state: State, action_keys: list[str]) -> None:
|
|
51
|
+
self._state = State(state.as_dict())
|
|
52
|
+
self._actions = [Action(key) for key in action_keys]
|
|
53
|
+
self._next_state: State | None = None
|
|
54
|
+
|
|
55
|
+
def observe(self) -> State:
|
|
56
|
+
return State(self._state.as_dict())
|
|
57
|
+
|
|
58
|
+
def available_actions(self) -> list[Action]:
|
|
59
|
+
return list(self._actions)
|
|
60
|
+
|
|
61
|
+
def stage_next_state(self, state: State) -> None:
|
|
62
|
+
self._next_state = State(state.as_dict())
|
|
63
|
+
|
|
64
|
+
def action_for_key(self, key: str) -> Action:
|
|
65
|
+
for action in self._actions:
|
|
66
|
+
if action.key == key:
|
|
67
|
+
return action
|
|
68
|
+
raise ValueError(f"등록되지 않은 행동입니다: {key}")
|
|
69
|
+
|
|
70
|
+
def execute(self, action: Action) -> None:
|
|
71
|
+
if action not in self._actions:
|
|
72
|
+
raise ValueError(f"등록되지 않은 행동입니다: {action.key}")
|
|
73
|
+
if self._next_state is None:
|
|
74
|
+
raise RuntimeError("다음 상태를 먼저 준비해야 합니다")
|
|
75
|
+
|
|
76
|
+
self._state = self._next_state
|
|
77
|
+
self._next_state = None
|