chp-server 0.60.2__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.
Files changed (79) hide show
  1. chp_server-0.60.2/.github/workflows/release.yml +96 -0
  2. chp_server-0.60.2/.github/workflows/staging.yml +48 -0
  3. chp_server-0.60.2/.gitignore +13 -0
  4. chp_server-0.60.2/LICENSE +202 -0
  5. chp_server-0.60.2/NOTICE +18 -0
  6. chp_server-0.60.2/PKG-INFO +224 -0
  7. chp_server-0.60.2/README.md +200 -0
  8. chp_server-0.60.2/agent/install-chp-server.md +29 -0
  9. chp_server-0.60.2/agent/install-chp-server.profile.json +10 -0
  10. chp_server-0.60.2/agent/install-chp-server.skill.json +12 -0
  11. chp_server-0.60.2/capabilities.txt +21 -0
  12. chp_server-0.60.2/chp_server/__init__.py +53 -0
  13. chp_server-0.60.2/chp_server/_catalog.py +60 -0
  14. chp_server-0.60.2/chp_server/_example.py +45 -0
  15. chp_server-0.60.2/chp_server/_scaffold.py +69 -0
  16. chp_server-0.60.2/chp_server/app.py +132 -0
  17. chp_server-0.60.2/chp_server/cli.py +163 -0
  18. chp_server-0.60.2/chp_server/config.py +77 -0
  19. chp_server-0.60.2/chp_server/features.py +106 -0
  20. chp_server-0.60.2/chp_server/ha.py +156 -0
  21. chp_server-0.60.2/chp_server/http.py +234 -0
  22. chp_server-0.60.2/chp_server/introduction.py +492 -0
  23. chp_server-0.60.2/chp_server/local.py +138 -0
  24. chp_server-0.60.2/chp_server/ports.py +150 -0
  25. chp_server-0.60.2/chp_server/profiles.py +54 -0
  26. chp_server-0.60.2/chp_server/replay.py +85 -0
  27. chp_server-0.60.2/chp_server/resolver.py +194 -0
  28. chp_server-0.60.2/chp_server/server.py +235 -0
  29. chp_server-0.60.2/docs/agent-integration.md +164 -0
  30. chp_server-0.60.2/docs/public-exposure.md +81 -0
  31. chp_server-0.60.2/docs/serving-capabilities.md +367 -0
  32. chp_server-0.60.2/docs/the-network.md +107 -0
  33. chp_server-0.60.2/examples/README.md +74 -0
  34. chp_server-0.60.2/examples/compose.py +82 -0
  35. chp_server-0.60.2/examples/demo.py +179 -0
  36. chp_server-0.60.2/examples/import_mcp.py +132 -0
  37. chp_server-0.60.2/examples/quickstart.py +45 -0
  38. chp_server-0.60.2/llms-install.md +86 -0
  39. chp_server-0.60.2/llms.txt +29 -0
  40. chp_server-0.60.2/pyproject.toml +61 -0
  41. chp_server-0.60.2/tests/conformance/test_app.py +107 -0
  42. chp_server-0.60.2/tests/conformance/test_artifact_plane.py +108 -0
  43. chp_server-0.60.2/tests/conformance/test_async_streaming.py +96 -0
  44. chp_server-0.60.2/tests/conformance/test_attachment_lifecycle.py +147 -0
  45. chp_server-0.60.2/tests/conformance/test_canonical_operations.py +86 -0
  46. chp_server-0.60.2/tests/conformance/test_capacity_limits.py +75 -0
  47. chp_server-0.60.2/tests/conformance/test_capacity_observability.py +102 -0
  48. chp_server-0.60.2/tests/conformance/test_catalog.py +76 -0
  49. chp_server-0.60.2/tests/conformance/test_config_versioning.py +142 -0
  50. chp_server-0.60.2/tests/conformance/test_conformance_manifest.py +32 -0
  51. chp_server-0.60.2/tests/conformance/test_deadlines.py +98 -0
  52. chp_server-0.60.2/tests/conformance/test_discovery_surfaces.py +91 -0
  53. chp_server-0.60.2/tests/conformance/test_discovery_visibility.py +66 -0
  54. chp_server-0.60.2/tests/conformance/test_edge_profile.py +81 -0
  55. chp_server-0.60.2/tests/conformance/test_effect_safety.py +110 -0
  56. chp_server-0.60.2/tests/conformance/test_evidence_observability.py +103 -0
  57. chp_server-0.60.2/tests/conformance/test_evidence_tenancy.py +79 -0
  58. chp_server-0.60.2/tests/conformance/test_example.py +47 -0
  59. chp_server-0.60.2/tests/conformance/test_existing_host.py +92 -0
  60. chp_server-0.60.2/tests/conformance/test_generation_safety.py +98 -0
  61. chp_server-0.60.2/tests/conformance/test_ha_effect_safety.py +108 -0
  62. chp_server-0.60.2/tests/conformance/test_ha_identity.py +123 -0
  63. chp_server-0.60.2/tests/conformance/test_ha_role.py +100 -0
  64. chp_server-0.60.2/tests/conformance/test_ha_signing_identity.py +82 -0
  65. chp_server-0.60.2/tests/conformance/test_heterogeneity.py +127 -0
  66. chp_server-0.60.2/tests/conformance/test_identity_delegation.py +97 -0
  67. chp_server-0.60.2/tests/conformance/test_introduction.py +481 -0
  68. chp_server-0.60.2/tests/conformance/test_introduction_authority.py +91 -0
  69. chp_server-0.60.2/tests/conformance/test_lifecycle_evidence.py +85 -0
  70. chp_server-0.60.2/tests/conformance/test_local_profile.py +156 -0
  71. chp_server-0.60.2/tests/conformance/test_observability_metrics.py +64 -0
  72. chp_server-0.60.2/tests/conformance/test_pkg_minimal.py +99 -0
  73. chp_server-0.60.2/tests/conformance/test_resolver.py +272 -0
  74. chp_server-0.60.2/tests/conformance/test_scaffold.py +48 -0
  75. chp_server-0.60.2/tests/conformance/test_security_hard.py +101 -0
  76. chp_server-0.60.2/tests/conformance/test_standalone_profile.py +111 -0
  77. chp_server-0.60.2/tests/test_ha_ownership.py +100 -0
  78. chp_server-0.60.2/tests/test_import_purity.py +43 -0
  79. chp_server-0.60.2/tests/test_server.py +124 -0
@@ -0,0 +1,96 @@
1
+ name: Release
2
+
3
+ # Publishes chp-server to PyPI + a GitHub Release. Fires ONLY on bare version tags
4
+ # (v0.60.2, v1.0.0 — never rc tags, which go to staging.yml). Mirrors the chp-core
5
+ # release flow, adapted for this single-package repo (the package is at the repo root).
6
+ #
7
+ # PREREQUISITE — PyPI trusted publishing (one-time, operator-side):
8
+ # On https://pypi.org/manage/project/chp-server/settings/publishing/ (or, if the project
9
+ # does not exist yet, add a "pending publisher" at https://pypi.org/manage/account/publishing/)
10
+ # register: owner=capabilityhostprotocol repo=chp-server workflow=release.yml environment=release
11
+ # No API token is stored — publishing uses OIDC (id-token: write below).
12
+ #
13
+ # Flow: push v<version>-rc.N → staging.yml (green) → push v<version> → this workflow.
14
+
15
+ on:
16
+ push:
17
+ tags:
18
+ - 'v*.*.*'
19
+ - '!v*.*.*-rc.*' # RC tags → staging.yml only
20
+ branches-ignore:
21
+ - '**' # tags only — branch pushes never trigger a release
22
+
23
+ jobs:
24
+ verify-staged:
25
+ name: Verify a matching RC was staged
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - name: Check out repository (full history for tags)
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 0
32
+
33
+ - name: Confirm a matching RC tag exists
34
+ run: |
35
+ VERSION="${GITHUB_REF_NAME#v}"
36
+ MATCHES=$(git tag --list "v${VERSION}-rc.*")
37
+ if [ -z "$MATCHES" ]; then
38
+ echo "ERROR: no RC tag found for v${VERSION}." >&2
39
+ echo "Push v${VERSION}-rc.1 and let staging.yml pass before the production tag." >&2
40
+ exit 1
41
+ fi
42
+ echo "Found RC tags: $MATCHES"
43
+
44
+ publish:
45
+ name: Build + publish chp-server to PyPI
46
+ needs: [verify-staged]
47
+ runs-on: ubuntu-latest
48
+ environment: release
49
+ permissions:
50
+ id-token: write # PyPI trusted publishing (OIDC) — no stored token
51
+ steps:
52
+ - name: Check out repository
53
+ uses: actions/checkout@v4
54
+
55
+ - name: Set up Python
56
+ uses: actions/setup-python@v5
57
+ with:
58
+ python-version: "3.12"
59
+
60
+ - name: Install build tooling
61
+ run: python -m pip install build
62
+
63
+ - name: Build (single package at repo root)
64
+ run: python -m build .
65
+
66
+ # The exact bytes built here go to BOTH PyPI and the GitHub Release.
67
+ - name: Upload dist artifact
68
+ uses: actions/upload-artifact@v4
69
+ with:
70
+ name: dist-chp-server
71
+ path: dist/
72
+
73
+ - name: Publish to PyPI (trusted publishing)
74
+ uses: pypa/gh-action-pypi-publish@release/v1
75
+ with:
76
+ packages-dir: dist/
77
+ skip-existing: true
78
+
79
+ create-release:
80
+ name: GitHub Release
81
+ needs: [publish]
82
+ runs-on: ubuntu-latest
83
+ permissions:
84
+ contents: write
85
+ steps:
86
+ - name: Download the published dist
87
+ uses: actions/download-artifact@v4
88
+ with:
89
+ name: dist-chp-server
90
+ path: dist
91
+
92
+ - name: Create GitHub Release
93
+ uses: softprops/action-gh-release@v2
94
+ with:
95
+ files: dist/*
96
+ generate_release_notes: true
@@ -0,0 +1,48 @@
1
+ name: Staging
2
+
3
+ # Fires on release-candidate tags (v0.60.2-rc.1, v0.60.2-rc.2, …). All jobs must be green
4
+ # before the production tag (v0.60.2) is pushed — release.yml refuses to publish without a
5
+ # matching rc.* tag. Mirrors chp-core's RC→staging→prod discipline for this single-package repo.
6
+ #
7
+ # Flow: push v<version>-rc.N → this workflow → (green) → push v<version> → release.yml.
8
+
9
+ on:
10
+ push:
11
+ tags:
12
+ - 'v*.*.*-rc.*'
13
+ branches-ignore:
14
+ - '**'
15
+
16
+ jobs:
17
+ test-and-smoke:
18
+ name: Tests + clean-venv build smoke
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Check out repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ # chp-server's only mandatory dep is chp-core (pulled from PyPI by -e .). The suite
30
+ # also needs pytest + the schema/crypto libs the wire tests exercise.
31
+ - name: Install package + test deps
32
+ run: python -m pip install -e . pytest jsonschema cryptography
33
+
34
+ - name: Run test suite
35
+ run: python -m pytest tests/ -q
36
+
37
+ - name: Build the distribution (repo root)
38
+ run: |
39
+ python -m pip install build
40
+ python -m build .
41
+
42
+ # Prove the built wheel installs and imports with ONLY its declared deps — the
43
+ # one-dependency contract (chp-core alone) that a chp-server release must honor.
44
+ - name: Clean-venv install + import smoke
45
+ run: |
46
+ python -m venv /tmp/smoke
47
+ /tmp/smoke/bin/python -m pip install dist/*.whl
48
+ /tmp/smoke/bin/python -c "import chp_server; from chp_server import CapabilityServer, Server; print('chp-server import OK')"
@@ -0,0 +1,13 @@
1
+ # CHP evidence stores and session DBs must never be tracked or published.
2
+ .chp/
3
+ *.sqlite
4
+ *.sqlite-shm
5
+ *.sqlite-wal
6
+ *.db
7
+
8
+ # Build / cache
9
+ __pycache__/
10
+ *.egg-info/
11
+ .pytest_cache/
12
+ dist/
13
+ build/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Project Auxo, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ Capability Host Protocol (CHP)
2
+ Copyright 2026 Project Auxo, Inc.
3
+
4
+ This product includes software developed by the CHP project contributors.
5
+
6
+ Source code (packages/, conformance/, examples/, scripts/) is licensed under
7
+ the Apache License, Version 2.0. See LICENSE for the full text.
8
+
9
+ Specification, schemas, and documentation (spec/, docs/, schemas/) are
10
+ licensed under the Creative Commons Attribution 4.0 International License.
11
+ See LICENSE-DOCS for the full text.
12
+
13
+ Implementing the specification is additionally covered by a royalty-free
14
+ patent grant. See PATENTS for the full text.
15
+
16
+ "Capability Host Protocol", "CHP", "CHP-Certified", and the CHP logo are
17
+ trademarks of Project Auxo, Inc. Trademark use is governed by TRADEMARK.md
18
+ and is NOT granted by the code or documentation licenses above.
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.5
2
+ Name: chp-server
3
+ Version: 0.60.2
4
+ Summary: Independently installable reference CHP server: assembles chp-core plus optional attachments behind truthful feature negotiation
5
+ Project-URL: Homepage, https://github.com/capabilityhostprotocol/chp-server
6
+ Project-URL: Issues, https://github.com/capabilityhostprotocol/chp-server/issues
7
+ Author: Project Auxo, Inc.
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: capability-host-protocol,chp,evidence,governance,server
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: System :: Distributed Computing
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: chp-core[schema]>=0.60.2
23
+ Description-Content-Type: text/markdown
24
+
25
+ # chp-server
26
+
27
+ **Your node in CHP — a network of governed capabilities. One dependency. Runs anywhere.
28
+ Every call is admission-gated and recorded as signed, replayable evidence.**
29
+
30
+ [![PyPI](https://img.shields.io/pypi/v/chp-server.svg)](https://pypi.org/project/chp-server/)
31
+ [![Python](https://img.shields.io/pypi/pyversions/chp-server.svg)](https://pypi.org/project/chp-server/)
32
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
33
+
34
+ Run a **node** that serves capabilities (plain Python functions) over HTTP behind the full CHP
35
+ pipeline — identity, admission, execution, and an append-only evidence chain, plus truthful
36
+ feature negotiation, deadlines, and HA. A node is fully useful alone, and can point outward to
37
+ **discover, compose, and federate** with others — *governed federation* is what makes it a
38
+ network, not just a server ([what that unlocks](docs/the-network.md)).
39
+
40
+ ```bash
41
+ pip install chp-server
42
+ ```
43
+
44
+ One CHP dependency — `chp-core` (with its `schema` extra, so declared input schemas are
45
+ *enforced*, not just described: the whole point of a governed node).
46
+
47
+ ## Quickstart — run a node, serve a capability
48
+
49
+ ```python
50
+ from chp_server import CapabilityServer
51
+
52
+ app = CapabilityServer("my-host")
53
+
54
+ @app.capability("greet.hello")
55
+ def hello(name: str = "world") -> dict:
56
+ "Greet a name."
57
+ return {"greeting": f"hello, {name}"}
58
+
59
+ app.run(port=8800)
60
+ ```
61
+
62
+ The **docstring becomes the description**, the **type hints become the input schema** — and
63
+ the pipeline *enforces* it, denying a malformed call before your function runs — and payload
64
+ fields arrive as **keyword arguments**. No descriptor boilerplate, no request parsing, no schema
65
+ by hand.
66
+
67
+ ```console
68
+ $ curl -s localhost:8800/invoke \
69
+ -H 'Content-Type: application/json' \
70
+ -d '{"capability_id": "greet.hello", "payload": {"name": "CHP"}}'
71
+ {"outcome": "success",
72
+ "data": {"greeting": "hello, CHP"},
73
+ "correlation": {"correlation_id": "corr_b11dc07c…"},
74
+ "evidence_ids": ["evt_…", "evt_…"]} # a signed, append-only chain
75
+
76
+ $ curl -s localhost:8800/replay/corr_b11dc07c…
77
+ {"events": [{"event_type": "execution_started"}, {"event_type": "execution_completed"}]}
78
+ ```
79
+
80
+ That invocation was admission-gated, executed, and **recorded as a hash-chained evidence trail
81
+ you can replay** — without you writing a line of middleware. `CapabilityServer` is thin sugar over
82
+ the explicit host/attachment API you drop to when you need resolution, federation, or the
83
+ distribute path (see the [serving guide](docs/serving-capabilities.md)). Prefer no code?
84
+
85
+ ```bash
86
+ chp-server new mycaps # scaffold a runnable starter you own, then: python mycaps.py
87
+ chp-server serve --example # a live node with sample capabilities, curl-able at once
88
+ chp-server adapters # list installed chp-adapter-* capability sets you can compose()
89
+ chp serve # a truthful protocol-only node; attach capabilities when ready
90
+ ```
91
+
92
+ Every `/invoke` prints a `correlation_id`; pipe its evidence through a readable view:
93
+
94
+ ```bash
95
+ curl -s localhost:8800/replay/corr_… | chp-server replay
96
+ # correlation corr_… (2 events)
97
+ # [9] execution_started greet.hello
98
+ # [10] execution_completed greet.hello → success
99
+ ```
100
+
101
+ ## Join the network
102
+
103
+ Each rung stands alone — climb only as far as you need: **run your node** (above) → **serve** your
104
+ capabilities → **discover** what others serve (`chp-server adapters`, `GET /host`) → **compose**
105
+ them (`app.compose(...)`) → **resolve & federate** across nodes (`GET /resolve`) → **trust across
106
+ boundaries** with signed evidence. Rungs 1–2 are the whole of many deployments; the rest is the
107
+ outward axis — [the network](docs/the-network.md).
108
+
109
+ ## Set up with your AI agent
110
+
111
+ Hand the setup to a coding agent. **Claude Code, Cursor, and Cline** can install and verify a node
112
+ from [`llms-install.md`](llms-install.md) — paste this:
113
+
114
+ ```text
115
+ Install and set up chp-server by following its llms-install.md. Steps: pip install chp-server;
116
+ start a node with `chp-server serve --example --port 8800`; prove a governed call with a POST
117
+ /invoke of greet.hello; then replay its evidence chain. Verify each step (health 200, outcome
118
+ "success", execution_started + execution_completed) and report the correlation id. Add no
119
+ dependency beyond chp-server.
120
+ ```
121
+
122
+ Already running a CHP host? Provision the node **through** it so the install itself is evidenced —
123
+ see [`agent/`](agent/install-chp-server.md) for a governed Agentkit skill + profile.
124
+
125
+ ---
126
+
127
+ ## What your node gives you standalone
128
+
129
+ Everything below is real and exercised end-to-end by [`examples/demo.py`](examples/README.md) —
130
+ with only `chp-core` + `chp-server` installed. This is the solo value: a node earns its keep
131
+ before it ever talks to another one.
132
+
133
+ | You get | What it means |
134
+ |---|---|
135
+ | **Governed invocation + evidence** | Every `/invoke` runs the full CHP pipeline and emits a signed, replayable chain (`/replay/{correlation}`). Nothing executes un-recorded. |
136
+ | **Truthful feature negotiation** | `GET /server` (Server.Describe) reports each feature's *real* state (`ready` / `unsupported`), computed from live attachment health — never faked from package presence. |
137
+ | **Honest long-running work** | A capability that can't answer yet returns `indeterminate` — not a fabricated success — and stays queryable without holding a connection open. |
138
+ | **Absolute deadlines** | Send a `deadline`; a stale request is denied `deadline_exceeded` *before any effect runs*. |
139
+ | **Tenant-scoped evidence** | Callers can only replay their own correlations; someone else's is `404`, not disclosed. |
140
+ | **Restricted visibility** | A capability's `allowed_actors` policy hides it from discovery for callers outside it. |
141
+ | **Capability resolution** | `GET /resolve` answers *where* a capability is served (endpoints), honoring lease/freshness — the basis for "invocable anywhere." |
142
+ | **Active/standby HA** | Two instances of one logical host contend for an ownership lease; the active admits work, the standby fails closed with `server_not_active`. |
143
+ | **Three discovery surfaces** | `/.well-known/chp` (bootstrap), `/capabilities.txt` (public hint), and authorized live `/host` — each with a distinct, honest purpose. |
144
+
145
+ ### See it all at once
146
+
147
+ ```bash
148
+ python examples/demo.py
149
+ ```
150
+
151
+ One self-contained script stands up real nodes and walks every surface above with a narrated
152
+ trace — needing only `chp-core` + `chp-server`. See [`examples/README.md`](examples/README.md).
153
+
154
+ ---
155
+
156
+ ## The one-dependency principle
157
+
158
+ The install pulls in **one CHP package — `chp-core`** (with its `schema` extra for input-schema
159
+ enforcement; jsonschema is the only transitive). That is a deliberate contract, not an accident:
160
+ a CHP node must be installable and runnable where every other CHP package is absent. Richer
161
+ behavior — host exposure, local execution, resolution, MCP import/export, federation,
162
+ Platform services — attaches through optional packages that register in the `chp_server.ports`
163
+ entry-point group. **Feature truth is computed from attachment health, never from what happens
164
+ to be installed**, so `GET /server` never overstates what the node can actually do.
165
+
166
+ ```python
167
+ server.attach(ExistingHostPort(host)) # a pre-built governed host
168
+ server.attach(DirectoryResolutionPort([...])) # answer GET /resolve
169
+ # ...MCP, federation, Platform, artifacts — each behind its own port role
170
+ ```
171
+
172
+ ## Profiles — fail-closed by construction
173
+
174
+ A **profile** declares which port roles a node *requires*; boot fails closed if one is missing,
175
+ so a node never silently comes up under-provisioned.
176
+
177
+ | Profile | Requires | For |
178
+ |---|---|---|
179
+ | `protocol-only` (default) | — | the pure protocol surface; everything optional reports `unsupported` |
180
+ | `host` | a governed host | serving your own capabilities (the quickstart above) |
181
+ | `local` | host + execution | full local admission→execute→evidence |
182
+ | `standalone` | + catalog/resolution | a self-describing single node |
183
+ | `managed` / `edge` / `gateway` | Platform / federation roles | control-plane-backed and multi-node topologies |
184
+
185
+ ## Endpoints
186
+
187
+ `GET /health` · `GET /ready` (reports role) · `GET /server` (Describe) · `GET /host` (authorized
188
+ discovery) · `GET /capabilities` · `POST /invoke` · `GET /replay/{correlation}` · `GET /resolve` ·
189
+ `GET /.well-known/chp` · `GET /capabilities.txt`
190
+
191
+ ## Discovery — read layer + act layer
192
+
193
+ A node ships two well-known files, mirroring how agents already read the web:
194
+
195
+ | Layer | File | Answers |
196
+ |---|---|---|
197
+ | **Read** | [`llms.txt`](llms.txt) | what's *worth reading* about this node (the llms.txt convention) |
198
+ | **Act** | [`capabilities.txt`](capabilities.txt) | what a node can *do* — CHP's own [capabilities.txt](https://capabilitiestxt.org) convention |
199
+
200
+ CHP adopts `llms.txt` and **owns the action layer**: `robots.txt` (may access) · `sitemap.xml`
201
+ (exists) · `llms.txt` (worth reading) · **`capabilities.txt` (what a host can do)**. A live node
202
+ serves its own at `GET /capabilities.txt` (a public hint) and bootstraps at `GET /.well-known/chp`;
203
+ authoritative capability truth is the authenticated `GET /host`.
204
+
205
+ ---
206
+
207
+ ## Learn more
208
+
209
+ - **Why this is a network, not just a server:** [`docs/the-network.md`](docs/the-network.md) —
210
+ the two axes, what governed federation unlocks, and the honest limits.
211
+ - **Serve capabilities of your own:** [`docs/serving-capabilities.md`](docs/serving-capabilities.md)
212
+ — capability anatomy, the embed and distribute paths, evidence, policy, auth, deadlines.
213
+ - **For LLMs & agents:** [`docs/agent-integration.md`](docs/agent-integration.md) — a recipe to
214
+ CHP-enable a codebase (wrap existing functions as governed capabilities).
215
+ - **Expose it safely:** [`docs/public-exposure.md`](docs/public-exposure.md) — ingress auth/mTLS,
216
+ the governed ingress route, egress governance.
217
+ - **Full walkthrough:** [`examples/demo.py`](examples/demo.py) + [its guide](examples/README.md)
218
+ - **Protocol:** built on [`chp-core`](https://github.com/capabilityhostprotocol/chp-core), the
219
+ canonical CHP implementation (identity, evidence, signing, the 12-gate pipeline).
220
+ - **Public API:** `CapabilityServer`, `Server`, `ServerConfig`, `ExistingHostPort`,
221
+ `DirectoryResolutionPort`, `FeatureRegistry`, `PROFILES` — see `chp_server.__all__`.
222
+
223
+ Licensed Apache-2.0 (see `LICENSE`, `NOTICE`). This repository is a read-only public mirror;
224
+ development happens in the private CHP workspace and syncs here.