awp-sim 0.1.0a4__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.
- awp_sim-0.1.0a4/.gitignore +15 -0
- awp_sim-0.1.0a4/.gitmodules +3 -0
- awp_sim-0.1.0a4/.python-version +1 -0
- awp_sim-0.1.0a4/CHANGELOG.md +9 -0
- awp_sim-0.1.0a4/LICENSE +201 -0
- awp_sim-0.1.0a4/PKG-INFO +113 -0
- awp_sim-0.1.0a4/README.md +91 -0
- awp_sim-0.1.0a4/conformance/README.md +96 -0
- awp_sim-0.1.0a4/conformance/core-world-lockstep.json +1669 -0
- awp_sim-0.1.0a4/conformance/core-world-streaming.json +1671 -0
- awp_sim-0.1.0a4/conformance/features-lockstep.json +1671 -0
- awp_sim-0.1.0a4/conformance/features-streaming.json +1671 -0
- awp_sim-0.1.0a4/pyproject.toml +82 -0
- awp_sim-0.1.0a4/scripts/check_traces.py +57 -0
- awp_sim-0.1.0a4/src/awp_sim/__init__.py +8 -0
- awp_sim-0.1.0a4/src/awp_sim/__main__.py +5 -0
- awp_sim-0.1.0a4/src/awp_sim/arm.py +177 -0
- awp_sim-0.1.0a4/src/awp_sim/audit.py +138 -0
- awp_sim-0.1.0a4/src/awp_sim/cli.py +221 -0
- awp_sim-0.1.0a4/src/awp_sim/config.py +226 -0
- awp_sim-0.1.0a4/src/awp_sim/loopback.py +222 -0
- awp_sim-0.1.0a4/src/awp_sim/py.typed +0 -0
- awp_sim-0.1.0a4/src/awp_sim/recorder.py +72 -0
- awp_sim-0.1.0a4/src/awp_sim/replay.py +134 -0
- awp_sim-0.1.0a4/src/awp_sim/scenarios.py +427 -0
- awp_sim-0.1.0a4/src/awp_sim/server.py +335 -0
- awp_sim-0.1.0a4/src/awp_sim/session.py +172 -0
- awp_sim-0.1.0a4/src/awp_sim/world.py +1678 -0
- awp_sim-0.1.0a4/tests/__init__.py +0 -0
- awp_sim-0.1.0a4/tests/conftest.py +21 -0
- awp_sim-0.1.0a4/tests/helpers.py +63 -0
- awp_sim-0.1.0a4/tests/test_audit.py +62 -0
- awp_sim-0.1.0a4/tests/test_cli.py +27 -0
- awp_sim-0.1.0a4/tests/test_e2e.py +118 -0
- awp_sim-0.1.0a4/tests/test_evidence.py +181 -0
- awp_sim-0.1.0a4/tests/test_features.py +371 -0
- awp_sim-0.1.0a4/tests/test_regressions.py +211 -0
- awp_sim-0.1.0a4/tests/test_scenarios.py +47 -0
- awp_sim-0.1.0a4/tests/test_streams.py +139 -0
- awp_sim-0.1.0a4/tests/test_world.py +514 -0
- awp_sim-0.1.0a4/uv.lock +946 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0a4
|
|
4
|
+
|
|
5
|
+
Targets specification revision `0.1-draft.9`.
|
|
6
|
+
|
|
7
|
+
- This is the first release as a separate package. Through 0.1.0a3, `awp_sim` shipped inside awp-python, whose [changelog](https://github.com/Hyperduality/awp-python/blob/main/CHANGELOG.md) covers it. awp-sim now depends on awp-python for the protocol layer.
|
|
8
|
+
- The demo agent moves to awp-python as `awp-demo`. The `awp-sim demo` subcommand is gone.
|
|
9
|
+
- CI runs awp-conformance against each configuration the reports claim.
|
awp_sim-0.1.0a4/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to those parts of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to those parts of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Hyperduality and Agent World Protocol contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
awp_sim-0.1.0a4/PKG-INFO
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: awp-sim
|
|
3
|
+
Version: 0.1.0a4
|
|
4
|
+
Summary: Agent World Protocol reference world: a simulated arm in lockstep and streaming.
|
|
5
|
+
Project-URL: Specification, https://www.agentworldprotocol.com
|
|
6
|
+
Project-URL: Source, https://github.com/Hyperduality/awp-sim
|
|
7
|
+
Author: Hyperduality
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: awp-python>=0.1.0a4
|
|
19
|
+
Requires-Dist: jsonschema>=4.23
|
|
20
|
+
Requires-Dist: websockets>=13.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# awp-sim
|
|
24
|
+
|
|
25
|
+
The reference world for the [Agent World Protocol](https://www.agentworldprotocol.com). It has one simulated arm and runs in either time model. It exists to exercise the protocol, not to model physics.
|
|
26
|
+
|
|
27
|
+
It is built from these parts:
|
|
28
|
+
|
|
29
|
+
- a sans-IO world engine;
|
|
30
|
+
- a WebSocket server;
|
|
31
|
+
- an audit log;
|
|
32
|
+
- a scenario suite that records wire traces.
|
|
33
|
+
|
|
34
|
+
It speaks AWP through the protocol layer of [awp-python](https://github.com/Hyperduality/awp-python): its message codec, frame codec, schemas, and lifecycle table.
|
|
35
|
+
|
|
36
|
+
It targets specification revision **`0.1-draft.9`**, pinned as the `spec/` submodule. This is an alpha, so it will change along with the draft.
|
|
37
|
+
|
|
38
|
+
## Status
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
The world is **Core World: AWP-conformant against 0.1-draft.9** in both time models, and so is every feature it offers. [awp-conformance](https://github.com/Hyperduality/awp-conformance) reports no failure and nothing untested. [`conformance/`](conformance/README.md) holds the reports and the evidence for their manual rows, and CI runs the suite on every change. Every recorded trace also passes the spec's own checker, which verifies:
|
|
43
|
+
|
|
44
|
+
- schemas;
|
|
45
|
+
- the action lifecycle table;
|
|
46
|
+
- idempotency;
|
|
47
|
+
- replay;
|
|
48
|
+
- frame sequencing.
|
|
49
|
+
|
|
50
|
+
| Implemented | Not implemented |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Lockstep (`on_tick`, `any_session`) and streaming | `barrier` tick authority |
|
|
53
|
+
| Inline and `ws` stream bindings | Other stream bindings (`webrtc`, `webtransport`, `shm`, `grpc`) |
|
|
54
|
+
| Full action lifecycle; preemption (`replace`, `queue`, `reject`, `blend`); idempotency | Grant expiry |
|
|
55
|
+
| Watchdog and safe state, heartbeats, resumption with replay and acknowledgement | Multi-bind and shared control (one embodiment) |
|
|
56
|
+
| Spatial, velocity, and rate envelopes (`command_check`), monitored during execution | Robotics profile (a simulated arm proves nothing physical) |
|
|
57
|
+
| Audit log with redaction and hash chain; e-stop; `world.reset` | |
|
|
58
|
+
| Beyond Core (`--features`): task, approval and standing approvals, transfer, seeding, snapshots, replay bundles, a servo command channel | |
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install --pre awp-sim
|
|
64
|
+
awp-sim serve # streaming world on ws://127.0.0.1:8710
|
|
65
|
+
awp-demo # in another terminal: awp-python's demo agent
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Other ways to run it:
|
|
69
|
+
|
|
70
|
+
- **Lockstep:** `awp-sim serve --mode lockstep` runs the lockstep world.
|
|
71
|
+
- **Remote access:** any non-loopback bind requires a token (`--token`, or `$AWP_SIM_TOKEN`) and TLS (`--tls-cert`, `--tls-key`). Pass the same token to the agent with `awp-demo --token`.
|
|
72
|
+
- **Logs:** audit logs go to `./awp-audit`, and `--record-dir` also writes each session's wire trace.
|
|
73
|
+
- **E-stop:** `kill -USR1` engages the e-stop and `kill -USR2` releases it.
|
|
74
|
+
|
|
75
|
+
Run the failure scenarios:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
awp-sim scenarios --out traces
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Layout
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
src/awp_sim/ world engine, arm, server, audit log, loopback, scenarios, replay, CLI
|
|
85
|
+
tests/ engine, server, feature, scenario, and evidence tests
|
|
86
|
+
conformance/ conformance reports and evidence
|
|
87
|
+
spec/ agent-world-protocol, pinned at spec-v0.1-draft.9
|
|
88
|
+
scripts/ trace checking against the spec's checker
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/). Node 20+ is needed only for the trace checker.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone --recurse-submodules https://github.com/Hyperduality/awp-sim
|
|
97
|
+
cd awp-sim
|
|
98
|
+
uv sync
|
|
99
|
+
uv run ruff check && uv run ruff format --check
|
|
100
|
+
uv run mypy
|
|
101
|
+
uv run pytest --cov
|
|
102
|
+
uv run awp-sim scenarios --out traces && uv run python scripts/check_traces.py traces/*.jsonl
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The world tracks the draft revision of awp-python. To move to a new one:
|
|
106
|
+
|
|
107
|
+
1. Check out its tag in `spec/`.
|
|
108
|
+
2. Update the `awp-python` requirement.
|
|
109
|
+
3. Fix whatever the tests report.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# awp-sim
|
|
2
|
+
|
|
3
|
+
The reference world for the [Agent World Protocol](https://www.agentworldprotocol.com). It has one simulated arm and runs in either time model. It exists to exercise the protocol, not to model physics.
|
|
4
|
+
|
|
5
|
+
It is built from these parts:
|
|
6
|
+
|
|
7
|
+
- a sans-IO world engine;
|
|
8
|
+
- a WebSocket server;
|
|
9
|
+
- an audit log;
|
|
10
|
+
- a scenario suite that records wire traces.
|
|
11
|
+
|
|
12
|
+
It speaks AWP through the protocol layer of [awp-python](https://github.com/Hyperduality/awp-python): its message codec, frame codec, schemas, and lifecycle table.
|
|
13
|
+
|
|
14
|
+
It targets specification revision **`0.1-draft.9`**, pinned as the `spec/` submodule. This is an alpha, so it will change along with the draft.
|
|
15
|
+
|
|
16
|
+
## Status
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
The world is **Core World: AWP-conformant against 0.1-draft.9** in both time models, and so is every feature it offers. [awp-conformance](https://github.com/Hyperduality/awp-conformance) reports no failure and nothing untested. [`conformance/`](conformance/README.md) holds the reports and the evidence for their manual rows, and CI runs the suite on every change. Every recorded trace also passes the spec's own checker, which verifies:
|
|
21
|
+
|
|
22
|
+
- schemas;
|
|
23
|
+
- the action lifecycle table;
|
|
24
|
+
- idempotency;
|
|
25
|
+
- replay;
|
|
26
|
+
- frame sequencing.
|
|
27
|
+
|
|
28
|
+
| Implemented | Not implemented |
|
|
29
|
+
|---|---|
|
|
30
|
+
| Lockstep (`on_tick`, `any_session`) and streaming | `barrier` tick authority |
|
|
31
|
+
| Inline and `ws` stream bindings | Other stream bindings (`webrtc`, `webtransport`, `shm`, `grpc`) |
|
|
32
|
+
| Full action lifecycle; preemption (`replace`, `queue`, `reject`, `blend`); idempotency | Grant expiry |
|
|
33
|
+
| Watchdog and safe state, heartbeats, resumption with replay and acknowledgement | Multi-bind and shared control (one embodiment) |
|
|
34
|
+
| Spatial, velocity, and rate envelopes (`command_check`), monitored during execution | Robotics profile (a simulated arm proves nothing physical) |
|
|
35
|
+
| Audit log with redaction and hash chain; e-stop; `world.reset` | |
|
|
36
|
+
| Beyond Core (`--features`): task, approval and standing approvals, transfer, seeding, snapshots, replay bundles, a servo command channel | |
|
|
37
|
+
|
|
38
|
+
## Quickstart
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install --pre awp-sim
|
|
42
|
+
awp-sim serve # streaming world on ws://127.0.0.1:8710
|
|
43
|
+
awp-demo # in another terminal: awp-python's demo agent
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Other ways to run it:
|
|
47
|
+
|
|
48
|
+
- **Lockstep:** `awp-sim serve --mode lockstep` runs the lockstep world.
|
|
49
|
+
- **Remote access:** any non-loopback bind requires a token (`--token`, or `$AWP_SIM_TOKEN`) and TLS (`--tls-cert`, `--tls-key`). Pass the same token to the agent with `awp-demo --token`.
|
|
50
|
+
- **Logs:** audit logs go to `./awp-audit`, and `--record-dir` also writes each session's wire trace.
|
|
51
|
+
- **E-stop:** `kill -USR1` engages the e-stop and `kill -USR2` releases it.
|
|
52
|
+
|
|
53
|
+
Run the failure scenarios:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
awp-sim scenarios --out traces
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Layout
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
src/awp_sim/ world engine, arm, server, audit log, loopback, scenarios, replay, CLI
|
|
63
|
+
tests/ engine, server, feature, scenario, and evidence tests
|
|
64
|
+
conformance/ conformance reports and evidence
|
|
65
|
+
spec/ agent-world-protocol, pinned at spec-v0.1-draft.9
|
|
66
|
+
scripts/ trace checking against the spec's checker
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/). Node 20+ is needed only for the trace checker.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone --recurse-submodules https://github.com/Hyperduality/awp-sim
|
|
75
|
+
cd awp-sim
|
|
76
|
+
uv sync
|
|
77
|
+
uv run ruff check && uv run ruff format --check
|
|
78
|
+
uv run mypy
|
|
79
|
+
uv run pytest --cov
|
|
80
|
+
uv run awp-sim scenarios --out traces && uv run python scripts/check_traces.py traces/*.jsonl
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The world tracks the draft revision of awp-python. To move to a new one:
|
|
84
|
+
|
|
85
|
+
1. Check out its tag in `spec/`.
|
|
86
|
+
2. Update the `awp-python` requirement.
|
|
87
|
+
3. Fix whatever the tests report.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Conformance
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
| Class | Configuration | Claim | Report |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| Core World | `awp-sim serve --mode lockstep` | Core World (lockstep): AWP-conformant against 0.1-draft.9 (awp-conformance 0.1.0a3) | [`core-world-lockstep.json`](core-world-lockstep.json) |
|
|
8
|
+
| Core World | `awp-sim serve` | Core World (streaming): AWP-conformant against 0.1-draft.9 (awp-conformance 0.1.0a3) | [`core-world-streaming.json`](core-world-streaming.json) |
|
|
9
|
+
| Core World + sim | `awp-sim serve --mode lockstep --features task,approval,blend,transfer,sim --approver-token awp-sim-approver` | Core World + sim (lockstep): AWP-conformant against 0.1-draft.9 (awp-conformance 0.1.0a3) | [`features-lockstep.json`](features-lockstep.json) |
|
|
10
|
+
| Core World | `awp-sim serve --features task,approval,blend,transfer,servo --stream-binding ws --approver-token awp-sim-approver --approval-timeout-ms 5000` | Core World (streaming): AWP-conformant against 0.1-draft.9 (awp-conformance 0.1.0a3) | [`features-streaming.json`](features-streaming.json) |
|
|
11
|
+
|
|
12
|
+
The reports come from awp-conformance 0.1.0a3 run against awp-sim 0.1.0a4. None has a failure or anything untested. The evidence for their `manual` rows follows (AWP-CNF-005).
|
|
13
|
+
|
|
14
|
+
Between them, the two feature configurations cover every feature awp-sim offers. They are separate runs because `sim` is lockstep-only and `servo` is streaming-only. The streaming one shortens `approval_timeout_ms` so the suite can wait out a timeout (AWP-APR-003).
|
|
15
|
+
|
|
16
|
+
## Reproduce
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install --pre awp-sim awp-conformance
|
|
20
|
+
curl -LO https://raw.githubusercontent.com/Hyperduality/awp-conformance/v0.1.0a3/fixtures/awp-sim.json
|
|
21
|
+
awp-sim serve --mode lockstep & # or `awp-sim serve` for streaming
|
|
22
|
+
export AWP_SIM_PID=$!
|
|
23
|
+
awp-conformance world ws://127.0.0.1:8710 --fixture awp-sim.json --out report/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For the feature configurations:
|
|
27
|
+
|
|
28
|
+
- serve with the flags in the table;
|
|
29
|
+
- use `fixtures/awp-sim-features.json` as the fixture;
|
|
30
|
+
- in lockstep, also pass `--profile sim`.
|
|
31
|
+
|
|
32
|
+
The fixture's e-stop hooks signal `$AWP_SIM_PID`. Without it, the e-stop test is skipped and AWP-EVT-002 is reported untested. CI runs all four configurations on every change, with shorter timers. The tests cited below run in CI too:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv run pytest tests/test_evidence.py tests/test_features.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Manual evidence
|
|
39
|
+
|
|
40
|
+
### AWP-DAT-002, AWP-TRN-009: latest-wins delivery (streaming)
|
|
41
|
+
|
|
42
|
+
- **Drop policy.** Each connection has a send queue (`_Outbox`, [`src/awp_sim/server.py`](../src/awp_sim/server.py)):
|
|
43
|
+
- For each latest-wins channel, it holds at most one unsent frame and replaces it when a newer one is produced.
|
|
44
|
+
- Control messages and reliable frames queue in order, so a stalled latest-wins channel delays them by at most its one pending frame.
|
|
45
|
+
- A peer that stops reading is disconnected at 10,000 pending items rather than buffered without limit.
|
|
46
|
+
- **Stalled-receiver test.** In `test_a_stalled_receiver_holds_one_frame_per_latest_wins_channel`, 1,000 `proprio` frames and 10 `arm_state` frames are produced while nothing drains the queue. What remains is the newest `proprio` frame alone and all 10 `arm_state` frames, in order.
|
|
47
|
+
|
|
48
|
+
### AWP-AUD-005: replay bundles (Core World + sim)
|
|
49
|
+
|
|
50
|
+
`test_a_replay_bundle_reproduces_its_session` (`tests/test_features.py`) records a seeded lockstep session, with a cancel and a second move, as a replay bundle.
|
|
51
|
+
|
|
52
|
+
- Replaying it with the engine behind `awp-sim replay` reproduces every transition and more than 80 frame hashes.
|
|
53
|
+
- A bundle with one tampered frame hash does not reproduce.
|
|
54
|
+
|
|
55
|
+
`awp-sim serve --replay-dir DIR --mode lockstep --features sim` writes bundles, and `awp-sim replay BUNDLE` checks one.
|
|
56
|
+
|
|
57
|
+
### AWP-DAT-008: frame test vectors
|
|
58
|
+
|
|
59
|
+
awp-sim encodes and decodes frames with awp-python's `awp.frames`. That decoder's evidence is `test_vectors` in awp-python's [`tests/test_frames.py`](https://github.com/Hyperduality/awp-python/blob/main/tests/test_frames.py), which runs it over every vector in `schemas/test-vectors/frames.json` at `spec-v0.1-draft.9`:
|
|
60
|
+
|
|
61
|
+
- the 10 valid vectors decode to their listed fields;
|
|
62
|
+
- the 7 marked `expect_error` are rejected with their listed error.
|
|
63
|
+
|
|
64
|
+
### AWP-ENV-003: envelope violations during execution
|
|
65
|
+
|
|
66
|
+
After every simulation step, the world checks that the arm's position is within `aabb_m` and its speed within `max_velocity_mps`. On leaving the envelope, the world:
|
|
67
|
+
|
|
68
|
+
1. stops the arm;
|
|
69
|
+
2. emits `world.event: envelope_violation` to every session;
|
|
70
|
+
3. fails the executing action with reason `envelope` once its safe abort completes.
|
|
71
|
+
|
|
72
|
+
`World.disturb(offset_m)` (or `Server.disturb`) injects an external disturbance. The tests, all in `tests/test_evidence.py`:
|
|
73
|
+
|
|
74
|
+
- `test_a_disturbance_during_execution_fails_the_action`: in each time model, the arm is pushed out of the envelope while a move is executing. The world emits `envelope_violation`, and the move ends `failed` with reason `envelope`.
|
|
75
|
+
- `test_commanded_motion_never_leaves_the_envelope`: 400 seeded random submissions, replacements, queued moves, stops, and cancels in each time model, checked after every advance. No violation is reported.
|
|
76
|
+
- `test_servo_motion_never_leaves_the_envelope`: servo setpoints toward the walls, and stops during them.
|
|
77
|
+
|
|
78
|
+
### AWP-UNI-001: SI units and unit suffixes
|
|
79
|
+
|
|
80
|
+
The fields awp-sim defines, reviewed:
|
|
81
|
+
|
|
82
|
+
| Field | Where | Unit |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `p_m` | `proprio` payload | m |
|
|
85
|
+
| `v_mps` | `proprio` payload; `servo_arm` setpoints | m/s |
|
|
86
|
+
| `target_m` | `arm_state` payload | m |
|
|
87
|
+
| `max_velocity_mps` | `move_to_pose` params | m/s |
|
|
88
|
+
| `phase`, `action_id` | `arm_state` payload | not physical |
|
|
89
|
+
|
|
90
|
+
The specification's schemas define every other field. `test_world_defined_fields_carry_si_suffixes` collects every action parameter, channel schema field, and payload field across every feature. It fails on any field that lacks a unit suffix and has not been reviewed as non-physical.
|
|
91
|
+
|
|
92
|
+
### AWP-VER-009: the draft revision is named
|
|
93
|
+
|
|
94
|
+
- The [README](../README.md) and the [awp-sim page](https://www.agentworldprotocol.com/adapters/awp-sim) name `0.1-draft.9`.
|
|
95
|
+
- The `spec/` submodule is pinned at the tag `spec-v0.1-draft.9`.
|
|
96
|
+
- Each report records `"specification": "0.1-draft.9"`, and its claim names the revision.
|