nex-protocol 0.1.0a1__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.
- nex_protocol-0.1.0a1/LICENSE +21 -0
- nex_protocol-0.1.0a1/PKG-INFO +63 -0
- nex_protocol-0.1.0a1/README.md +39 -0
- nex_protocol-0.1.0a1/pyproject.toml +47 -0
- nex_protocol-0.1.0a1/schemas/__init__.py +1 -0
- nex_protocol-0.1.0a1/schemas/nex-error-1.1.schema.json +15 -0
- nex_protocol-0.1.0a1/schemas/nex-error-message-1.1.schema.json +16 -0
- nex_protocol-0.1.0a1/schemas/nex-message-1.1.schema.json +72 -0
- nex_protocol-0.1.0a1/schemas/payloads/__init__.py +1 -0
- nex_protocol-0.1.0a1/schemas/payloads/act.schema.json +14 -0
- nex_protocol-0.1.0a1/schemas/payloads/error.schema.json +15 -0
- nex_protocol-0.1.0a1/schemas/payloads/handshake.schema.json +37 -0
- nex_protocol-0.1.0a1/schemas/payloads/plan.schema.json +27 -0
- nex_protocol-0.1.0a1/schemas/payloads/report.schema.json +19 -0
- nex_protocol-0.1.0a1/schemas/payloads/request.schema.json +19 -0
- nex_protocol-0.1.0a1/schemas/payloads/sync.schema.json +23 -0
- nex_protocol-0.1.0a1/schemas/payloads/verify.schema.json +14 -0
- nex_protocol-0.1.0a1/schemas/registries/__init__.py +1 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-command-registry-1.1.json +46 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-error-registry-1.1.json +585 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-impact-registry-1.0.json +10 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-intent-registry-1.0.json +13 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-ontology-registry-1.1.json +237 -0
- nex_protocol-0.1.0a1/schemas/registries/nex-state-registry-1.1.json +83 -0
- nex_protocol-0.1.0a1/setup.cfg +4 -0
- nex_protocol-0.1.0a1/src/nex/__init__.py +2 -0
- nex_protocol-0.1.0a1/src/nex/__main__.py +3 -0
- nex_protocol-0.1.0a1/src/nex/_data.py +27 -0
- nex_protocol-0.1.0a1/src/nex/agent.py +66 -0
- nex_protocol-0.1.0a1/src/nex/canonical.py +131 -0
- nex_protocol-0.1.0a1/src/nex/cli.py +88 -0
- nex_protocol-0.1.0a1/src/nex/demo.py +21 -0
- nex_protocol-0.1.0a1/src/nex/errors.py +52 -0
- nex_protocol-0.1.0a1/src/nex/fastschema.py +193 -0
- nex_protocol-0.1.0a1/src/nex/glyphs.py +329 -0
- nex_protocol-0.1.0a1/src/nex/models.py +97 -0
- nex_protocol-0.1.0a1/src/nex/parser.py +194 -0
- nex_protocol-0.1.0a1/src/nex/protocol.py +38 -0
- nex_protocol-0.1.0a1/src/nex/runtime.py +296 -0
- nex_protocol-0.1.0a1/src/nex/security.py +150 -0
- nex_protocol-0.1.0a1/src/nex/session.py +70 -0
- nex_protocol-0.1.0a1/src/nex/state_model.py +68 -0
- nex_protocol-0.1.0a1/src/nex/stores/__init__.py +10 -0
- nex_protocol-0.1.0a1/src/nex/stores/base.py +61 -0
- nex_protocol-0.1.0a1/src/nex/stores/memory.py +111 -0
- nex_protocol-0.1.0a1/src/nex/stores/sqlite.py +189 -0
- nex_protocol-0.1.0a1/src/nex/ultrasonic.py +134 -0
- nex_protocol-0.1.0a1/src/nex/validator.py +216 -0
- nex_protocol-0.1.0a1/src/nex/worker.py +87 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/PKG-INFO +63 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/SOURCES.txt +69 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/dependency_links.txt +1 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/entry_points.txt +2 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/requires.txt +9 -0
- nex_protocol-0.1.0a1/src/nex_protocol.egg-info/top_level.txt +1 -0
- nex_protocol-0.1.0a1/tests/test_agent_ultrasonic_cli.py +130 -0
- nex_protocol-0.1.0a1/tests/test_canonical.py +75 -0
- nex_protocol-0.1.0a1/tests/test_error_registry.py +42 -0
- nex_protocol-0.1.0a1/tests/test_fast_schema.py +126 -0
- nex_protocol-0.1.0a1/tests/test_glyphs.py +124 -0
- nex_protocol-0.1.0a1/tests/test_handshake.py +86 -0
- nex_protocol-0.1.0a1/tests/test_hardening.py +58 -0
- nex_protocol-0.1.0a1/tests/test_parser.py +70 -0
- nex_protocol-0.1.0a1/tests/test_parser_errors.py +43 -0
- nex_protocol-0.1.0a1/tests/test_runtime.py +190 -0
- nex_protocol-0.1.0a1/tests/test_schema_validation.py +152 -0
- nex_protocol-0.1.0a1/tests/test_security.py +130 -0
- nex_protocol-0.1.0a1/tests/test_security_review.py +93 -0
- nex_protocol-0.1.0a1/tests/test_state_transitions.py +53 -0
- nex_protocol-0.1.0a1/tests/test_stores.py +129 -0
- nex_protocol-0.1.0a1/tests/test_worker.py +92 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kamyarghaderi
|
|
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,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nex-protocol
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Nex: a deterministic language and protocol for agent understanding and alignment.
|
|
5
|
+
Author: Nex Project contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: jsonschema>=4.18
|
|
16
|
+
Requires-Dist: cryptography>=42
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov>=4; extra == "dev"
|
|
20
|
+
Requires-Dist: hypothesis>=6; extra == "dev"
|
|
21
|
+
Requires-Dist: build; extra == "dev"
|
|
22
|
+
Requires-Dist: twine; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Nex
|
|
26
|
+
|
|
27
|
+
A deterministic language and protocol for agent understanding and alignment.
|
|
28
|
+
|
|
29
|
+
**Status: alpha (0.1.0a1).** This repository is the Nex Alpha 1.0 reference protocol and runtime.
|
|
30
|
+
It is a pre-release: not published to PyPI, and the quantum-related and network features are out of scope.
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
pytest
|
|
37
|
+
nex demo # signed two-agent handshake + request
|
|
38
|
+
nex glyph Kamyar --format svg # Nex-G glyph (also json | png | scene)
|
|
39
|
+
nex error E709 # describe an error code
|
|
40
|
+
python benchmarks/bench.py # simple benchmarks
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What is implemented
|
|
44
|
+
|
|
45
|
+
- **Nex-J / Nex-T** parsing, strict JSON-Schema validation (cached validators), RFC 8785-style canonical JSON.
|
|
46
|
+
- **Runtime**: handshake, sessions, Ed25519 signatures, nonce/replay protection, duplicate-id detection,
|
|
47
|
+
task state machine, error registry (E-codes) and ERROR responses, memory and SQLite stores, cleanup worker.
|
|
48
|
+
- **Nex-G**: deterministic integer-only glyph geometry, SVG, PNG, and a deterministic **3D scene description**.
|
|
49
|
+
- **Experimental (non-normative)**: ultrasonic symbol encoding, [NEP-0007](spec/NEP-0007-Ultrasonic-Symbols.md).
|
|
50
|
+
It never changes Nex-J, which stays canonical.
|
|
51
|
+
- **Crypto agility**: documented in [NEP-0002](spec/NEP-0002-Nex-Protocol-1.1.md), including a reserved slot for a
|
|
52
|
+
future post-quantum signature algorithm. No post-quantum or quantum features are implemented.
|
|
53
|
+
|
|
54
|
+
## Layout
|
|
55
|
+
|
|
56
|
+
- `src/nex/` - reference implementation
|
|
57
|
+
- `schemas/` - JSON schemas and registries (packaged with the wheel)
|
|
58
|
+
- `spec/` - Nex Enhancement Proposals (NEP-0001 .. NEP-0007)
|
|
59
|
+
- `docs/` - [Final specification](docs/NEX_FINAL_SPEC.md), [Master handoff](docs/MASTER_HANDOFF.md),
|
|
60
|
+
[Images note](docs/IMAGES_NOTE.txt), [Releasing](docs/RELEASING.md)
|
|
61
|
+
- `tests/`, `benchmarks/`, `examples/`
|
|
62
|
+
|
|
63
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md) and [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Nex
|
|
2
|
+
|
|
3
|
+
A deterministic language and protocol for agent understanding and alignment.
|
|
4
|
+
|
|
5
|
+
**Status: alpha (0.1.0a1).** This repository is the Nex Alpha 1.0 reference protocol and runtime.
|
|
6
|
+
It is a pre-release: not published to PyPI, and the quantum-related and network features are out of scope.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
pip install -e ".[dev]"
|
|
12
|
+
pytest
|
|
13
|
+
nex demo # signed two-agent handshake + request
|
|
14
|
+
nex glyph Kamyar --format svg # Nex-G glyph (also json | png | scene)
|
|
15
|
+
nex error E709 # describe an error code
|
|
16
|
+
python benchmarks/bench.py # simple benchmarks
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What is implemented
|
|
20
|
+
|
|
21
|
+
- **Nex-J / Nex-T** parsing, strict JSON-Schema validation (cached validators), RFC 8785-style canonical JSON.
|
|
22
|
+
- **Runtime**: handshake, sessions, Ed25519 signatures, nonce/replay protection, duplicate-id detection,
|
|
23
|
+
task state machine, error registry (E-codes) and ERROR responses, memory and SQLite stores, cleanup worker.
|
|
24
|
+
- **Nex-G**: deterministic integer-only glyph geometry, SVG, PNG, and a deterministic **3D scene description**.
|
|
25
|
+
- **Experimental (non-normative)**: ultrasonic symbol encoding, [NEP-0007](spec/NEP-0007-Ultrasonic-Symbols.md).
|
|
26
|
+
It never changes Nex-J, which stays canonical.
|
|
27
|
+
- **Crypto agility**: documented in [NEP-0002](spec/NEP-0002-Nex-Protocol-1.1.md), including a reserved slot for a
|
|
28
|
+
future post-quantum signature algorithm. No post-quantum or quantum features are implemented.
|
|
29
|
+
|
|
30
|
+
## Layout
|
|
31
|
+
|
|
32
|
+
- `src/nex/` - reference implementation
|
|
33
|
+
- `schemas/` - JSON schemas and registries (packaged with the wheel)
|
|
34
|
+
- `spec/` - Nex Enhancement Proposals (NEP-0001 .. NEP-0007)
|
|
35
|
+
- `docs/` - [Final specification](docs/NEX_FINAL_SPEC.md), [Master handoff](docs/MASTER_HANDOFF.md),
|
|
36
|
+
[Images note](docs/IMAGES_NOTE.txt), [Releasing](docs/RELEASING.md)
|
|
37
|
+
- `tests/`, `benchmarks/`, `examples/`
|
|
38
|
+
|
|
39
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md) and [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nex-protocol"
|
|
7
|
+
version = "0.1.0a1"
|
|
8
|
+
description = "Nex: a deterministic language and protocol for agent understanding and alignment."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Nex Project contributors" }]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["jsonschema>=4.18", "cryptography>=42"]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
dev = ["pytest>=7", "pytest-cov>=4", "hypothesis>=6", "build", "twine"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
nex = "nex.cli:main"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
packages = [
|
|
31
|
+
"nex",
|
|
32
|
+
"nex.stores",
|
|
33
|
+
"nex.schemas",
|
|
34
|
+
"nex.schemas.payloads",
|
|
35
|
+
"nex.schemas.registries",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.package-dir]
|
|
39
|
+
"" = "src"
|
|
40
|
+
"nex.schemas" = "schemas"
|
|
41
|
+
"nex.schemas.payloads" = "schemas/payloads"
|
|
42
|
+
"nex.schemas.registries" = "schemas/registries"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
"nex.schemas" = ["*.json"]
|
|
46
|
+
"nex.schemas.payloads" = ["*.json"]
|
|
47
|
+
"nex.schemas.registries" = ["*.json"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Nex JSON schemas (data package)."""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/nex-error-1.1.schema.json",
|
|
4
|
+
"title": "Nex Error Object 1.1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["code", "message", "severity", "recovery", "details"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"code": {"type": "string", "pattern": "^E[0-9]{3}$", "not": {"const": "E505"}},
|
|
10
|
+
"message": {"type": "string", "pattern": "^[A-Z][A-Z0-9_]*$"},
|
|
11
|
+
"severity": {"enum": ["INFO", "MINOR", "MAJOR", "CRITICAL"]},
|
|
12
|
+
"recovery": {"enum": ["NONE", "FIX_SYNTAX", "FIX_MESSAGE", "RETRY", "REHANDSHAKE", "REAUTHENTICATE", "RESYNC", "ESCALATE", "ABORT"]},
|
|
13
|
+
"details": {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/nex-error-message-1.1.schema.json",
|
|
4
|
+
"title": "Nex Error Message 1.1",
|
|
5
|
+
"description": "A Nex-J message whose command is ERROR.",
|
|
6
|
+
"allOf": [
|
|
7
|
+
{"$ref": "nex-message-1.1.schema.json"},
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"header": {"properties": {"message_type": {"const": "ERROR"}}},
|
|
12
|
+
"body": {"properties": {"command": {"const": "ERROR"}}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/nex-message-1.1.schema.json",
|
|
4
|
+
"title": "Nex Message 1.1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["header", "body", "signature"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"header": {"$ref": "#/$defs/header"},
|
|
10
|
+
"body": {"$ref": "#/$defs/body"},
|
|
11
|
+
"signature": {"$ref": "#/$defs/signature"}
|
|
12
|
+
},
|
|
13
|
+
"$defs": {
|
|
14
|
+
"agent_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$"},
|
|
15
|
+
"timestamp": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]{1,9})?Z$"
|
|
18
|
+
},
|
|
19
|
+
"header": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"required": ["message_id", "correlation_id", "session_id", "reply_to", "sender", "receiver", "timestamp", "expires_at", "protocol_version", "message_type", "nonce"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"message_id": {"type": "string", "pattern": "^MSG-[A-Za-z0-9_-]{1,96}$"},
|
|
25
|
+
"correlation_id": {"type": "string", "pattern": "^CORR-[A-Za-z0-9_-]{1,96}$"},
|
|
26
|
+
"session_id": {"type": ["string", "null"], "pattern": "^SES-[A-Za-z0-9_-]{1,96}$"},
|
|
27
|
+
"reply_to": {"type": ["string", "null"], "pattern": "^MSG-[A-Za-z0-9_-]{1,96}$"},
|
|
28
|
+
"sender": {"$ref": "#/$defs/agent_id"},
|
|
29
|
+
"receiver": {"$ref": "#/$defs/agent_id"},
|
|
30
|
+
"timestamp": {"$ref": "#/$defs/timestamp"},
|
|
31
|
+
"expires_at": {"$ref": "#/$defs/timestamp"},
|
|
32
|
+
"protocol_version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+$"},
|
|
33
|
+
"message_type": {"$ref": "#/$defs/command"},
|
|
34
|
+
"nonce": {"type": ["string", "null"], "pattern": "^[A-Za-z0-9_-]{8,128}$"}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"command": {"enum": ["HANDSHAKE", "REQUEST", "REPORT", "PLAN", "ACT", "VERIFY", "SYNC", "ERROR"]},
|
|
38
|
+
"body": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"required": ["command", "payload"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"command": {"$ref": "#/$defs/command"},
|
|
44
|
+
"payload": {"type": "object"}
|
|
45
|
+
},
|
|
46
|
+
"allOf": [
|
|
47
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "HANDSHAKE"}}}, "then": {"properties": {"payload": {"$ref": "payloads/handshake.schema.json"}}}},
|
|
48
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "REQUEST"}}}, "then": {"properties": {"payload": {"$ref": "payloads/request.schema.json"}}}},
|
|
49
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "REPORT"}}}, "then": {"properties": {"payload": {"$ref": "payloads/report.schema.json"}}}},
|
|
50
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "PLAN"}}}, "then": {"properties": {"payload": {"$ref": "payloads/plan.schema.json"}}}},
|
|
51
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "ACT"}}}, "then": {"properties": {"payload": {"$ref": "payloads/act.schema.json"}}}},
|
|
52
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "VERIFY"}}}, "then": {"properties": {"payload": {"$ref": "payloads/verify.schema.json"}}}},
|
|
53
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "SYNC"}}}, "then": {"properties": {"payload": {"$ref": "payloads/sync.schema.json"}}}},
|
|
54
|
+
{"if": {"required": ["command"], "properties": {"command": {"const": "ERROR"}}}, "then": {"properties": {"payload": {"$ref": "payloads/error.schema.json"}}}}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"signature": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"required": ["algorithm", "key_id", "value"],
|
|
61
|
+
"properties": {
|
|
62
|
+
"algorithm": {"enum": ["NONE", "ED25519"]},
|
|
63
|
+
"key_id": {"type": ["string", "null"], "pattern": "^KEY-[A-Za-z0-9_-]{1,96}$"},
|
|
64
|
+
"value": {"type": ["string", "null"], "pattern": "^[A-Za-z0-9_-]{86}$"}
|
|
65
|
+
},
|
|
66
|
+
"allOf": [
|
|
67
|
+
{"if": {"required": ["algorithm"], "properties": {"algorithm": {"const": "NONE"}}}, "then": {"properties": {"key_id": {"type": "null"}, "value": {"type": "null"}}}},
|
|
68
|
+
{"if": {"required": ["algorithm"], "properties": {"algorithm": {"const": "ED25519"}}}, "then": {"properties": {"key_id": {"type": "string"}, "value": {"type": "string"}}}}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Nex payload schemas (data package)."""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/act.schema.json",
|
|
4
|
+
"title": "ACT payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["action", "target", "authorization_id"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"action": {"type": "string", "minLength": 1},
|
|
10
|
+
"target": {"type": "string", "minLength": 1},
|
|
11
|
+
"destination": {"type": "string", "minLength": 1},
|
|
12
|
+
"authorization_id": {"type": "string", "pattern": "^AUTH-[A-Za-z0-9_-]{1,96}$"}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/error.schema.json",
|
|
4
|
+
"title": "ERROR payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["code", "message", "severity", "recovery"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"code": {"type": "string", "pattern": "^E[0-9]{3}$", "not": {"const": "E505"}},
|
|
10
|
+
"message": {"type": "string", "pattern": "^[A-Z][A-Z0-9_]*$"},
|
|
11
|
+
"severity": {"enum": ["INFO", "MINOR", "MAJOR", "CRITICAL"]},
|
|
12
|
+
"recovery": {"enum": ["NONE", "FIX_SYNTAX", "FIX_MESSAGE", "RETRY", "REHANDSHAKE", "REAUTHENTICATE", "RESYNC", "ESCALATE", "ABORT"]},
|
|
13
|
+
"details": {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/handshake.schema.json",
|
|
4
|
+
"title": "HANDSHAKE payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{
|
|
8
|
+
"title": "HANDSHAKE request",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"required": ["identity", "version", "capabilities", "ontology_modules", "security_algorithms", "intent"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"identity": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$"},
|
|
13
|
+
"version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+$"},
|
|
14
|
+
"capabilities": {"type": "array", "items": {"enum": ["HANDSHAKE", "REQUEST", "REPORT", "PLAN", "ACT", "VERIFY", "SYNC", "ERROR"]}, "uniqueItems": true},
|
|
15
|
+
"ontology_modules": {"type": "array", "items": {"type": "string", "minLength": 1}, "minItems": 1, "uniqueItems": true},
|
|
16
|
+
"security_algorithms": {"type": "array", "items": {"enum": ["NONE", "ED25519"]}, "minItems": 1, "uniqueItems": true},
|
|
17
|
+
"intent": {"enum": ["ASSIST", "INFORM", "COORDINATE", "VERIFY", "PROTECT", "DISCOVER", "NEGOTIATE"]}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"title": "HANDSHAKE response",
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"required": ["identity", "version", "accepted", "session_id", "capabilities"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"identity": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$"},
|
|
26
|
+
"version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+$"},
|
|
27
|
+
"accepted": {"type": "boolean"},
|
|
28
|
+
"session_id": {"type": ["string", "null"], "pattern": "^SES-[A-Za-z0-9_-]{1,96}$"},
|
|
29
|
+
"capabilities": {"type": "array", "items": {"enum": ["HANDSHAKE", "REQUEST", "REPORT", "PLAN", "ACT", "VERIFY", "SYNC", "ERROR"]}, "uniqueItems": true},
|
|
30
|
+
"reason": {"type": "string"}
|
|
31
|
+
},
|
|
32
|
+
"allOf": [
|
|
33
|
+
{"if": {"properties": {"accepted": {"const": true}}}, "then": {"properties": {"session_id": {"type": "string"}}}}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/plan.schema.json",
|
|
4
|
+
"title": "PLAN payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["goal", "steps"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"goal": {"type": "string", "minLength": 1},
|
|
10
|
+
"steps": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"minItems": 1,
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": ["step_id", "action"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"step_id": {"type": "string", "pattern": "^STEP-[A-Za-z0-9_-]{1,96}$"},
|
|
19
|
+
"action": {"type": "string", "minLength": 1},
|
|
20
|
+
"target": {"type": "string", "minLength": 1},
|
|
21
|
+
"destination": {"type": "string", "minLength": 1},
|
|
22
|
+
"depends_on": {"type": "array", "items": {"type": "string", "pattern": "^STEP-[A-Za-z0-9_-]{1,96}$"}, "uniqueItems": true}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/report.schema.json",
|
|
4
|
+
"title": "REPORT payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["state"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"state": {"enum": ["UNKNOWN", "OBSERVED", "INFERRED", "PLANNED", "ACTIVE", "COMPLETED", "VERIFIED", "FAILED", "INVALID"]},
|
|
10
|
+
"task_id": {"type": "string", "pattern": "^TASK-[A-Za-z0-9_-]{1,96}$"},
|
|
11
|
+
"details": {"type": ["string", "object", "null"]},
|
|
12
|
+
"evidence": {"type": "array", "items": {"type": "string", "minLength": 1}},
|
|
13
|
+
"failure_cause": {"type": "string"},
|
|
14
|
+
"understanding_status": {"enum": ["NOT_EVALUATED", "PARTIAL", "UNDERSTOOD", "MISUNDERSTOOD", "CLARIFICATION_REQUIRED"]},
|
|
15
|
+
"consent_status": {"enum": ["NOT_REQUIRED", "REQUESTED", "GRANTED", "DENIED", "REVOKED"]},
|
|
16
|
+
"alignment_status": {"enum": ["UNKNOWN", "ALIGNED", "PARTIALLY_ALIGNED", "CONFLICTING"]},
|
|
17
|
+
"uncertainty": {"type": "number", "minimum": 0, "maximum": 1}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/request.schema.json",
|
|
4
|
+
"title": "REQUEST payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["goal"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"goal": {"type": "string", "minLength": 1},
|
|
10
|
+
"target": {"type": "string", "minLength": 1},
|
|
11
|
+
"destination": {"type": "string", "minLength": 1},
|
|
12
|
+
"deadline": {"$ref": "../nex-message-1.1.schema.json#/$defs/timestamp"},
|
|
13
|
+
"priority": {"type": "integer", "minimum": 0, "maximum": 9},
|
|
14
|
+
"intent": {"enum": ["ASSIST", "INFORM", "COORDINATE", "VERIFY", "PROTECT", "DISCOVER", "NEGOTIATE"]},
|
|
15
|
+
"expected_impact": {"enum": ["POSITIVE", "NEUTRAL", "NEGATIVE", "UNKNOWN"]},
|
|
16
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
|
17
|
+
"constraints": {"type": "array", "items": {}}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/sync.schema.json",
|
|
4
|
+
"title": "SYNC payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["objects"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"objects": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"required": ["object_id", "state", "version"],
|
|
15
|
+
"properties": {
|
|
16
|
+
"object_id": {"type": "string", "minLength": 1},
|
|
17
|
+
"state": {"enum": ["UNKNOWN", "OBSERVED", "INFERRED", "PLANNED", "ACTIVE", "COMPLETED", "VERIFIED", "FAILED", "INVALID"]},
|
|
18
|
+
"version": {"type": "integer", "minimum": 0}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://nex.example/schemas/payloads/verify.schema.json",
|
|
4
|
+
"title": "VERIFY payload",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["target", "method"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"target": {"type": "string", "minLength": 1},
|
|
10
|
+
"expected_state": {"type": "object"},
|
|
11
|
+
"method": {"type": "string", "minLength": 1},
|
|
12
|
+
"evidence": {"type": "array", "items": {"type": "string", "minLength": 1}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Nex registries (data package)."""
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": [
|
|
3
|
+
{
|
|
4
|
+
"description": "compatibility, identity, capabilities, secure session",
|
|
5
|
+
"id": "NX-C-0001",
|
|
6
|
+
"name": "HANDSHAKE"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"description": "contribution or action toward a goal",
|
|
10
|
+
"id": "NX-C-0002",
|
|
11
|
+
"name": "REQUEST"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"description": "status, result, observation, or task state",
|
|
15
|
+
"id": "NX-C-0003",
|
|
16
|
+
"name": "REPORT"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "ordered or dependency-aware operations",
|
|
20
|
+
"id": "NX-C-0004",
|
|
21
|
+
"name": "PLAN"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"description": "requests or records authorized execution",
|
|
25
|
+
"id": "NX-C-0005",
|
|
26
|
+
"name": "ACT"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"description": "requests or reports verification",
|
|
30
|
+
"id": "NX-C-0006",
|
|
31
|
+
"name": "VERIFY"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"description": "aligns semantic and operational state",
|
|
35
|
+
"id": "NX-C-0007",
|
|
36
|
+
"name": "SYNC"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"description": "protocol, validation, execution, security, or runtime failure",
|
|
40
|
+
"id": "NX-C-0008",
|
|
41
|
+
"name": "ERROR"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"registry": "NEX-COMMANDS",
|
|
45
|
+
"version": "1.1"
|
|
46
|
+
}
|