nps-lib 1.0.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.
- nps_lib-1.0.0a1/.gitignore +210 -0
- nps_lib-1.0.0a1/CONTRIBUTING.md +33 -0
- nps_lib-1.0.0a1/LICENSE +170 -0
- nps_lib-1.0.0a1/NOTICE +7 -0
- nps_lib-1.0.0a1/PKG-INFO +188 -0
- nps_lib-1.0.0a1/README.md +159 -0
- nps_lib-1.0.0a1/nip-ca-server/Dockerfile +21 -0
- nps_lib-1.0.0a1/nip-ca-server/README.md +56 -0
- nps_lib-1.0.0a1/nip-ca-server/ca.py +129 -0
- nps_lib-1.0.0a1/nip-ca-server/db/001_init.sql +25 -0
- nps_lib-1.0.0a1/nip-ca-server/db.py +150 -0
- nps_lib-1.0.0a1/nip-ca-server/docker-compose.yml +30 -0
- nps_lib-1.0.0a1/nip-ca-server/main.py +205 -0
- nps_lib-1.0.0a1/nip-ca-server/requirements.txt +4 -0
- nps_lib-1.0.0a1/nps_sdk/__init__.py +13 -0
- nps_lib-1.0.0a1/nps_sdk/core/__init__.py +31 -0
- nps_lib-1.0.0a1/nps_sdk/core/cache.py +131 -0
- nps_lib-1.0.0a1/nps_sdk/core/codec.py +208 -0
- nps_lib-1.0.0a1/nps_sdk/core/exceptions.py +38 -0
- nps_lib-1.0.0a1/nps_sdk/core/frames.py +209 -0
- nps_lib-1.0.0a1/nps_sdk/core/registry.py +83 -0
- nps_lib-1.0.0a1/nps_sdk/ncp/__init__.py +26 -0
- nps_lib-1.0.0a1/nps_sdk/ncp/frames.py +315 -0
- nps_lib-1.0.0a1/nps_sdk/ndp/__init__.py +27 -0
- nps_lib-1.0.0a1/nps_sdk/ndp/frames.py +240 -0
- nps_lib-1.0.0a1/nps_sdk/ndp/registry.py +151 -0
- nps_lib-1.0.0a1/nps_sdk/ndp/validator.py +101 -0
- nps_lib-1.0.0a1/nps_sdk/nip/__init__.py +14 -0
- nps_lib-1.0.0a1/nps_sdk/nip/frames.py +167 -0
- nps_lib-1.0.0a1/nps_sdk/nip/identity.py +257 -0
- nps_lib-1.0.0a1/nps_sdk/nop/__init__.py +46 -0
- nps_lib-1.0.0a1/nps_sdk/nop/client.py +207 -0
- nps_lib-1.0.0a1/nps_sdk/nop/frames.py +284 -0
- nps_lib-1.0.0a1/nps_sdk/nop/models.py +226 -0
- nps_lib-1.0.0a1/nps_sdk/nwp/__init__.py +22 -0
- nps_lib-1.0.0a1/nps_sdk/nwp/client.py +162 -0
- nps_lib-1.0.0a1/nps_sdk/nwp/frames.py +195 -0
- nps_lib-1.0.0a1/pyproject.toml +52 -0
- nps_lib-1.0.0a1/tests/__init__.py +0 -0
- nps_lib-1.0.0a1/tests/test_cache.py +168 -0
- nps_lib-1.0.0a1/tests/test_codec.py +289 -0
- nps_lib-1.0.0a1/tests/test_core_frames.py +114 -0
- nps_lib-1.0.0a1/tests/test_ndp.py +420 -0
- nps_lib-1.0.0a1/tests/test_nip.py +236 -0
- nps_lib-1.0.0a1/tests/test_nop.py +543 -0
- nps_lib-1.0.0a1/tests/test_nwp.py +143 -0
- nps_lib-1.0.0a1/tests/test_nwp_client.py +260 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Release packages (built artifacts — attached to GitHub Release)
|
|
2
|
+
package/
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[codz]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# C extensions
|
|
10
|
+
*.so
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
share/python-wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
# Usually these files are written by a python script from a template
|
|
34
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
35
|
+
*.manifest
|
|
36
|
+
*.spec
|
|
37
|
+
|
|
38
|
+
# Installer logs
|
|
39
|
+
pip-log.txt
|
|
40
|
+
pip-delete-this-directory.txt
|
|
41
|
+
|
|
42
|
+
# Unit test / coverage reports
|
|
43
|
+
htmlcov/
|
|
44
|
+
.tox/
|
|
45
|
+
.nox/
|
|
46
|
+
.coverage
|
|
47
|
+
.coverage.*
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
*.py.cover
|
|
53
|
+
.hypothesis/
|
|
54
|
+
.pytest_cache/
|
|
55
|
+
cover/
|
|
56
|
+
|
|
57
|
+
# Translations
|
|
58
|
+
*.mo
|
|
59
|
+
*.pot
|
|
60
|
+
|
|
61
|
+
# Django stuff:
|
|
62
|
+
*.log
|
|
63
|
+
local_settings.py
|
|
64
|
+
db.sqlite3
|
|
65
|
+
db.sqlite3-journal
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# PyBuilder
|
|
78
|
+
.pybuilder/
|
|
79
|
+
target/
|
|
80
|
+
|
|
81
|
+
# Jupyter Notebook
|
|
82
|
+
.ipynb_checkpoints
|
|
83
|
+
|
|
84
|
+
# IPython
|
|
85
|
+
profile_default/
|
|
86
|
+
ipython_config.py
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
91
|
+
# .python-version
|
|
92
|
+
|
|
93
|
+
# pipenv
|
|
94
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
95
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
96
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
97
|
+
# install all needed dependencies.
|
|
98
|
+
#Pipfile.lock
|
|
99
|
+
|
|
100
|
+
# UV
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
#uv.lock
|
|
105
|
+
|
|
106
|
+
# poetry
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
108
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
109
|
+
# commonly ignored for libraries.
|
|
110
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
111
|
+
#poetry.lock
|
|
112
|
+
#poetry.toml
|
|
113
|
+
|
|
114
|
+
# pdm
|
|
115
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
116
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
117
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
118
|
+
#pdm.lock
|
|
119
|
+
#pdm.toml
|
|
120
|
+
.pdm-python
|
|
121
|
+
.pdm-build/
|
|
122
|
+
|
|
123
|
+
# pixi
|
|
124
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
125
|
+
#pixi.lock
|
|
126
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
127
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
128
|
+
.pixi
|
|
129
|
+
|
|
130
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
131
|
+
__pypackages__/
|
|
132
|
+
|
|
133
|
+
# Celery stuff
|
|
134
|
+
celerybeat-schedule
|
|
135
|
+
celerybeat.pid
|
|
136
|
+
|
|
137
|
+
# SageMath parsed files
|
|
138
|
+
*.sage.py
|
|
139
|
+
|
|
140
|
+
# Environments
|
|
141
|
+
.env
|
|
142
|
+
.envrc
|
|
143
|
+
.venv
|
|
144
|
+
env/
|
|
145
|
+
venv/
|
|
146
|
+
ENV/
|
|
147
|
+
env.bak/
|
|
148
|
+
venv.bak/
|
|
149
|
+
|
|
150
|
+
# Spyder project settings
|
|
151
|
+
.spyderproject
|
|
152
|
+
.spyproject
|
|
153
|
+
|
|
154
|
+
# Rope project settings
|
|
155
|
+
.ropeproject
|
|
156
|
+
|
|
157
|
+
# mkdocs documentation
|
|
158
|
+
/site
|
|
159
|
+
|
|
160
|
+
# mypy
|
|
161
|
+
.mypy_cache/
|
|
162
|
+
.dmypy.json
|
|
163
|
+
dmypy.json
|
|
164
|
+
|
|
165
|
+
# Pyre type checker
|
|
166
|
+
.pyre/
|
|
167
|
+
|
|
168
|
+
# pytype static type analyzer
|
|
169
|
+
.pytype/
|
|
170
|
+
|
|
171
|
+
# Cython debug symbols
|
|
172
|
+
cython_debug/
|
|
173
|
+
|
|
174
|
+
# PyCharm
|
|
175
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
176
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
177
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
178
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
179
|
+
#.idea/
|
|
180
|
+
|
|
181
|
+
# Abstra
|
|
182
|
+
# Abstra is an AI-powered process automation framework.
|
|
183
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
184
|
+
# Learn more at https://abstra.io/docs
|
|
185
|
+
.abstra/
|
|
186
|
+
|
|
187
|
+
# Visual Studio Code
|
|
188
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
189
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
190
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
191
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
192
|
+
# .vscode/
|
|
193
|
+
|
|
194
|
+
# Ruff stuff:
|
|
195
|
+
.ruff_cache/
|
|
196
|
+
|
|
197
|
+
# PyPI configuration file
|
|
198
|
+
.pypirc
|
|
199
|
+
|
|
200
|
+
# Cursor
|
|
201
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
202
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
203
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
204
|
+
.cursorignore
|
|
205
|
+
.cursorindexingignore
|
|
206
|
+
|
|
207
|
+
# Marimo
|
|
208
|
+
marimo/_static/
|
|
209
|
+
marimo/_lsp/
|
|
210
|
+
__marimo__/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Contributing to NPS
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the Neural Protocol Suite.
|
|
4
|
+
|
|
5
|
+
## Issue Prefixes
|
|
6
|
+
|
|
7
|
+
| Prefix | Usage |
|
|
8
|
+
|--------|-------|
|
|
9
|
+
| `spec:` | Specification questions and design discussions |
|
|
10
|
+
| `impl:` | Implementation bugs and fixes |
|
|
11
|
+
| `sdk:` | SDK (Python / TypeScript) related |
|
|
12
|
+
| `docs:` | Documentation improvements |
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Open an Issue first for any non-trivial change
|
|
17
|
+
2. Fork the repo and create a branch: `feature/your-feature` or `fix/your-fix`
|
|
18
|
+
3. Submit a Pull Request referencing the Issue
|
|
19
|
+
|
|
20
|
+
## Spec Changes
|
|
21
|
+
|
|
22
|
+
Changes to files under `spec/` require a discussion Issue before a PR is accepted.
|
|
23
|
+
Spec changes that affect wire format or frame structure require a version bump.
|
|
24
|
+
|
|
25
|
+
## Code Style
|
|
26
|
+
|
|
27
|
+
- **C# / .NET**: Follow standard Microsoft C# conventions, nullable enabled
|
|
28
|
+
- **Python**: PEP 8, type hints required
|
|
29
|
+
- **TypeScript**: Strict mode enabled
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
By contributing, you agree your contributions will be licensed under Apache 2.0.
|
nps_lib-1.0.0a1/LICENSE
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
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 made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
+
or written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of recording and
|
|
55
|
+
managing Contributions to the Work, but excluding communication that is
|
|
56
|
+
conspicularly marked or otherwise designated in writing by the copyright
|
|
57
|
+
owner as "Not a Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combination of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a cross-claim
|
|
80
|
+
or counterclaim in a lawsuit) alleging that the Work or any
|
|
81
|
+
Contributor's Work constitutes direct or contributory patent
|
|
82
|
+
infringement, then any patent licenses granted to You under this
|
|
83
|
+
License for that Work shall terminate as of the date such litigation
|
|
84
|
+
is filed.
|
|
85
|
+
|
|
86
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
+
modifications, and in Source or Object form, provided that You
|
|
89
|
+
meet the following conditions:
|
|
90
|
+
|
|
91
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
+
Works a copy of this License; and
|
|
93
|
+
|
|
94
|
+
(b) You must cause any modified files to carry prominent notices
|
|
95
|
+
stating that You changed the files; and
|
|
96
|
+
|
|
97
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work,
|
|
100
|
+
excluding those notices that do not pertain to any part of
|
|
101
|
+
the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
+
distribution, You must include a readable copy of the
|
|
105
|
+
attribution notices contained within such NOTICE file, in
|
|
106
|
+
at least one of the following places: within a NOTICE text
|
|
107
|
+
file distributed as part of the Derivative Works; within
|
|
108
|
+
the Source form or documentation, if provided along with the
|
|
109
|
+
Derivative Works; or, within a display generated by the
|
|
110
|
+
Derivative Works, if and wherever such third-party notices
|
|
111
|
+
normally appear. The contents of the NOTICE file are for
|
|
112
|
+
informational purposes only and do not modify the License.
|
|
113
|
+
You may add Your own attribution notices within Derivative
|
|
114
|
+
Works that You distribute, alongside or in addition to the
|
|
115
|
+
NOTICE text from the Work, provided that such additional
|
|
116
|
+
attribution notices cannot be construed as modifying the License.
|
|
117
|
+
|
|
118
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
119
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
120
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
121
|
+
this License, without any additional terms or conditions.
|
|
122
|
+
|
|
123
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
124
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
125
|
+
except as required for reasonable and customary use in describing the
|
|
126
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
127
|
+
|
|
128
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
129
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
130
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
131
|
+
OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
132
|
+
without limitation, any warranties or conditions of TITLE,
|
|
133
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
|
|
134
|
+
PURPOSE. You are solely responsible for determining the
|
|
135
|
+
appropriateness of using or reproducing the Work and assume any
|
|
136
|
+
risks associated with Your exercise of permissions under this License.
|
|
137
|
+
|
|
138
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
139
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
140
|
+
unless required by applicable law (such as deliberate and grossly
|
|
141
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
142
|
+
liable to You for damages, including any direct, indirect, special,
|
|
143
|
+
incidental, or exemplary damages of any character arising as a
|
|
144
|
+
result of this License or out of the use or inability to use the
|
|
145
|
+
Work (even if such Contributor has been advised of the possibility
|
|
146
|
+
of such damages).
|
|
147
|
+
|
|
148
|
+
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
149
|
+
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
150
|
+
for, acceptance of support, warranty, indemnity, or other liability
|
|
151
|
+
obligations and/or rights consistent with this License. However, in
|
|
152
|
+
accepting such obligations, You may offer only obligations consistent
|
|
153
|
+
with this License and for which You can fully compensate for any
|
|
154
|
+
resulting liability.
|
|
155
|
+
|
|
156
|
+
END OF TERMS AND CONDITIONS
|
|
157
|
+
|
|
158
|
+
Copyright 2026 INNO LOTUS PTY LTD
|
|
159
|
+
|
|
160
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
161
|
+
you may not use this file except in compliance with the License.
|
|
162
|
+
You may obtain a copy of the License at
|
|
163
|
+
|
|
164
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
165
|
+
|
|
166
|
+
Unless required by applicable law or agreed to in writing, software
|
|
167
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
168
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
169
|
+
implied. See the License for the specific language governing
|
|
170
|
+
permissions and limitations under the License.
|
nps_lib-1.0.0a1/NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Neural Protocol Suite (NPS)
|
|
2
|
+
Copyright 2026 INNO LOTUS PTY LTD
|
|
3
|
+
|
|
4
|
+
This product includes software developed under the LabAcacia open-source lab,
|
|
5
|
+
operated by INNO LOTUS PTY LTD (https://innolotus.com).
|
|
6
|
+
|
|
7
|
+
NCP (Neural Communication Protocol) v0.2 was developed by Ori Lynn / INNO LOTUS PTY LTD.
|
nps_lib-1.0.0a1/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nps-lib
|
|
3
|
+
Version: 1.0.0a1
|
|
4
|
+
Summary: Python SDK for the Neural Protocol Suite (NPS)
|
|
5
|
+
Author: LabAcacia / INNO LOTUS PTY LTD
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Keywords: agent,ai,neural-protocol-suite,nps,protocol
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: cryptography>=43.0.0
|
|
21
|
+
Requires-Dist: httpx>=0.27.0
|
|
22
|
+
Requires-Dist: msgpack>=1.0.8
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# NPS Python SDK (`nps-sdk`)
|
|
31
|
+
|
|
32
|
+
Python client library for the **Neural Protocol Suite (NPS)** — a complete internet protocol stack designed for AI agents and models.
|
|
33
|
+
|
|
34
|
+
PyPI package: `nps-sdk` | Python namespace: `nps_sdk`
|
|
35
|
+
|
|
36
|
+
## Status
|
|
37
|
+
|
|
38
|
+
**v0.1.0 — Phase 1 initial release (Alpha)**
|
|
39
|
+
|
|
40
|
+
Covers NCP + NWP frames and async client, NIP identity management.
|
|
41
|
+
|
|
42
|
+
## Requirements
|
|
43
|
+
|
|
44
|
+
- Python 3.11+
|
|
45
|
+
- Dependencies: `msgpack`, `httpx`, `cryptography`
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install nps-sdk
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For development:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install "nps-sdk[dev]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Modules
|
|
60
|
+
|
|
61
|
+
| Module | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `nps_sdk.core` | Frame header, codec (Tier-1 JSON / Tier-2 MsgPack), anchor cache, exceptions |
|
|
64
|
+
| `nps_sdk.ncp` | NCP frames: AnchorFrame, DiffFrame, StreamFrame, CapsFrame, ErrorFrame |
|
|
65
|
+
| `nps_sdk.nwp` | NWP frames: QueryFrame, ActionFrame; async `NwpClient` |
|
|
66
|
+
| `nps_sdk.nip` | NIP frames: IdentFrame, RevokeFrame; `NipIdentity` (Ed25519 key management) |
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
### Encoding / Decoding NCP Frames
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from nps_sdk.core.codec import NpsFrameCodec
|
|
74
|
+
from nps_sdk.core.registry import FrameRegistry
|
|
75
|
+
from nps_sdk.ncp.frames import AnchorFrame, FrameSchema, SchemaField
|
|
76
|
+
|
|
77
|
+
registry = FrameRegistry.create_default()
|
|
78
|
+
codec = NpsFrameCodec(registry)
|
|
79
|
+
|
|
80
|
+
schema = FrameSchema(fields=(
|
|
81
|
+
SchemaField(name="id", type="uint64"),
|
|
82
|
+
SchemaField(name="price", type="decimal", semantic="commerce.price.usd"),
|
|
83
|
+
))
|
|
84
|
+
frame = AnchorFrame(anchor_id="sha256:...", schema=schema)
|
|
85
|
+
|
|
86
|
+
wire = codec.encode(frame) # bytes — Tier-2 MsgPack by default
|
|
87
|
+
result = codec.decode(wire) # → AnchorFrame
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Anchor Cache (Schema Deduplication)
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from nps_sdk.core.cache import AnchorFrameCache
|
|
94
|
+
|
|
95
|
+
cache = AnchorFrameCache()
|
|
96
|
+
anchor_id = cache.set(frame) # stores; returns canonical sha256 anchor_id
|
|
97
|
+
frame = cache.get_required(anchor_id)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Querying a Memory Node (async)
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import asyncio
|
|
104
|
+
from nps_sdk.nwp import NwpClient, QueryFrame
|
|
105
|
+
|
|
106
|
+
async def main():
|
|
107
|
+
async with NwpClient("https://node.example.com") as client:
|
|
108
|
+
caps = await client.query(
|
|
109
|
+
QueryFrame(anchor_ref="sha256:...", limit=50)
|
|
110
|
+
)
|
|
111
|
+
print(caps.count, caps.data)
|
|
112
|
+
|
|
113
|
+
asyncio.run(main())
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Invoking an Action Node (async)
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from nps_sdk.nwp import NwpClient, ActionFrame
|
|
120
|
+
|
|
121
|
+
async with NwpClient("https://node.example.com") as client:
|
|
122
|
+
result = await client.invoke(
|
|
123
|
+
ActionFrame(action_id="orders.create", params={"sku": "X-101", "qty": 1})
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### NIP Identity Management
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from nps_sdk.nip.identity import NipIdentity
|
|
131
|
+
|
|
132
|
+
# Generate and save an encrypted Ed25519 keypair
|
|
133
|
+
identity = NipIdentity.generate("ca.key", passphrase="my-secret")
|
|
134
|
+
|
|
135
|
+
# Load from file
|
|
136
|
+
identity = NipIdentity()
|
|
137
|
+
identity.load("ca.key", passphrase="my-secret")
|
|
138
|
+
|
|
139
|
+
# Sign a NIP frame payload (canonical JSON, no 'signature' field)
|
|
140
|
+
sig = identity.sign(ident_frame.unsigned_dict())
|
|
141
|
+
|
|
142
|
+
# Verify
|
|
143
|
+
ok = NipIdentity.verify_signature(identity.pub_key_string, payload, sig)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Architecture
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
nps_sdk/
|
|
150
|
+
├── core/ # Wire primitives (FrameHeader, codec, cache, exceptions)
|
|
151
|
+
├── ncp/ # NCP frames (0x01–0x0F)
|
|
152
|
+
├── nwp/ # NWP frames (0x10–0x1F) + async HTTP client
|
|
153
|
+
└── nip/ # NIP frames (0x20–0x2F) + Ed25519 identity
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Frame Encoding Tiers
|
|
157
|
+
|
|
158
|
+
| Tier | Value | Description |
|
|
159
|
+
|------|-------|-------------|
|
|
160
|
+
| Tier-1 JSON | `0x00` | UTF-8 JSON. Development / compatibility. |
|
|
161
|
+
| Tier-2 MsgPack | `0x01` | MessagePack binary. ~60% smaller. **Production default.** |
|
|
162
|
+
|
|
163
|
+
### NWP HTTP Overlay Mode
|
|
164
|
+
|
|
165
|
+
`NwpClient` communicates via HTTP with `Content-Type: application/x-nps-frame`.
|
|
166
|
+
Sub-paths per operation:
|
|
167
|
+
|
|
168
|
+
| Operation | Path | Request Frame | Response Frame |
|
|
169
|
+
|-----------|------|---------------|----------------|
|
|
170
|
+
| Schema anchor | `POST /anchor` | AnchorFrame | 204 |
|
|
171
|
+
| Structured query | `POST /query` | QueryFrame | CapsFrame |
|
|
172
|
+
| Streaming query | `POST /stream` | QueryFrame | StreamFrame chunks |
|
|
173
|
+
| Action invocation | `POST /invoke` | ActionFrame | raw result or AsyncActionResponse |
|
|
174
|
+
|
|
175
|
+
## Running Tests
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pytest # all tests + coverage report
|
|
179
|
+
pytest -k test_nip # NIP tests only
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Coverage target: ≥ 90 %.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
Apache 2.0 — see [LICENSE](../../LICENSE).
|
|
187
|
+
|
|
188
|
+
Copyright 2026 INNO LOTUS PTY LTD
|