robot-md-gateway 0.3.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.
- robot_md_gateway-0.3.0a1/.github/workflows/ci.yml +58 -0
- robot_md_gateway-0.3.0a1/.github/workflows/release.yml +137 -0
- robot_md_gateway-0.3.0a1/.gitignore +16 -0
- robot_md_gateway-0.3.0a1/CHANGELOG.md +34 -0
- robot_md_gateway-0.3.0a1/LICENSE +202 -0
- robot_md_gateway-0.3.0a1/PKG-INFO +169 -0
- robot_md_gateway-0.3.0a1/README.md +135 -0
- robot_md_gateway-0.3.0a1/docs/hil/gw-001-procedure.md +34 -0
- robot_md_gateway-0.3.0a1/docs/superpowers/plans/2026-04-24-dispatcher-init-wizard.md +2222 -0
- robot_md_gateway-0.3.0a1/docs/superpowers/specs/2026-04-24-dispatcher-init-wizard-design.md +389 -0
- robot_md_gateway-0.3.0a1/pyproject.toml +72 -0
- robot_md_gateway-0.3.0a1/scripts/emit_gateway_authority_report.py +96 -0
- robot_md_gateway-0.3.0a1/src/robot_md_dispatcher/__init__.py +33 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/__init__.py +1 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/__main__.py +121 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/_legacy_cli.py +25 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/app.py +187 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/auth.py +134 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/cert/__init__.py +0 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/cert/report.py +80 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/gating.py +133 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/init_wizard.py +392 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/manifest_provenance.py +88 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/receiver.py +90 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/udev/99-robot-md-gateway.rules.in +12 -0
- robot_md_gateway-0.3.0a1/src/robot_md_gateway/udev_policy.py +39 -0
- robot_md_gateway-0.3.0a1/systemd/install.sh +90 -0
- robot_md_gateway-0.3.0a1/systemd/robot-md-dispatcher.service +55 -0
- robot_md_gateway-0.3.0a1/tests/__init__.py +0 -0
- robot_md_gateway-0.3.0a1/tests/cert/__init__.py +0 -0
- robot_md_gateway-0.3.0a1/tests/cert/test_gw_001_device_isolation.py +55 -0
- robot_md_gateway-0.3.0a1/tests/cert/test_mf_001_manifest_accept.py +77 -0
- robot_md_gateway-0.3.0a1/tests/cert/test_mf_002_manifest_reject.py +85 -0
- robot_md_gateway-0.3.0a1/tests/conftest.py +53 -0
- robot_md_gateway-0.3.0a1/tests/fixtures/manifests/signed-good.md +11 -0
- robot_md_gateway-0.3.0a1/tests/fixtures/manifests/signed-tampered.md +11 -0
- robot_md_gateway-0.3.0a1/tests/fixtures/manifests/signing-key.kid +1 -0
- robot_md_gateway-0.3.0a1/tests/fixtures/manifests/signing-key.pub +3 -0
- robot_md_gateway-0.3.0a1/tests/fixtures/valid_robot.md +82 -0
- robot_md_gateway-0.3.0a1/tests/test_backward_compat_shim.py +54 -0
- robot_md_gateway-0.3.0a1/tests/test_gating.py +257 -0
- robot_md_gateway-0.3.0a1/tests/test_init_wizard.py +468 -0
- robot_md_gateway-0.3.0a1/tests/test_legacy_byok_flag.py +42 -0
- robot_md_gateway-0.3.0a1/tests/test_legacy_cli.py +20 -0
- robot_md_gateway-0.3.0a1/tests/test_manifest_provenance.py +71 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
python -m pip install -e ".[dev]"
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: pytest -q
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: ruff check src tests
|
|
32
|
+
|
|
33
|
+
cert-report:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
needs: test
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
38
|
+
with:
|
|
39
|
+
fetch-depth: 0
|
|
40
|
+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.12"
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: |
|
|
45
|
+
python -m pip install --upgrade pip
|
|
46
|
+
python -m pip install -e ".[dev]"
|
|
47
|
+
- name: Run cert tests + emit gateway-authority report
|
|
48
|
+
run: |
|
|
49
|
+
pytest tests/cert/ --tb=short
|
|
50
|
+
python scripts/emit_gateway_authority_report.py \
|
|
51
|
+
--repo robot-md-gateway \
|
|
52
|
+
--sha ${{ github.sha }} \
|
|
53
|
+
--out-dir dist/cert-reports
|
|
54
|
+
- name: Upload cert report artifact
|
|
55
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
56
|
+
with:
|
|
57
|
+
name: gateway-authority-report
|
|
58
|
+
path: dist/cert-reports/*.json
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
tag:
|
|
10
|
+
description: "Tag to emit version-tuple for (backfill mode; leave empty for normal dispatch)"
|
|
11
|
+
required: false
|
|
12
|
+
default: ''
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- name: Install build tools
|
|
26
|
+
run: python -m pip install --upgrade pip build
|
|
27
|
+
- name: Build sdist + wheel
|
|
28
|
+
run: python -m build
|
|
29
|
+
- name: Upload dist
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
if-no-files-found: error
|
|
35
|
+
|
|
36
|
+
github-release:
|
|
37
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
needs: build
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
with:
|
|
45
|
+
fetch-depth: 0
|
|
46
|
+
- uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Extract tag message
|
|
51
|
+
id: tag
|
|
52
|
+
run: |
|
|
53
|
+
echo "message<<EOF" >> $GITHUB_OUTPUT
|
|
54
|
+
git tag -l --format='%(contents)' ${{ github.ref_name }} >> $GITHUB_OUTPUT
|
|
55
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
56
|
+
- name: Create GitHub Release
|
|
57
|
+
uses: softprops/action-gh-release@v2
|
|
58
|
+
with:
|
|
59
|
+
body: ${{ steps.tag.outputs.message }}
|
|
60
|
+
generate_release_notes: true
|
|
61
|
+
files: dist/*
|
|
62
|
+
|
|
63
|
+
- name: Strip leading v from tag
|
|
64
|
+
run: echo "VALUE=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
|
|
65
|
+
|
|
66
|
+
- uses: continuonai/rcan-spec/.github/actions/emit-version-tuple@v3.2.0
|
|
67
|
+
with:
|
|
68
|
+
project: robot-md-gateway
|
|
69
|
+
ran: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_RAN }}
|
|
70
|
+
field: gateway_version
|
|
71
|
+
value: ${{ env.VALUE }}
|
|
72
|
+
depends_on: '{"manifest_spec_version":">=1.5.0","protocol_version":">=3.2.0"}'
|
|
73
|
+
pq_signing_key: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_PQ_PRIV }}
|
|
74
|
+
pq_kid: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_KID }}
|
|
75
|
+
ed25519_signing_key: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_PRIV }}
|
|
76
|
+
ed25519_kid: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_KID }}
|
|
77
|
+
release_tag: ${{ github.ref_name }}
|
|
78
|
+
|
|
79
|
+
pypi-publish:
|
|
80
|
+
# Auto-fires on v*.*.* tag push. Uses PyPI Trusted Publishing (OIDC) —
|
|
81
|
+
# no token checked into the repo. PyPI looks up a pending/configured
|
|
82
|
+
# publisher matching owner/repo/workflow/environment and mints a
|
|
83
|
+
# short-lived credential for this run only.
|
|
84
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
needs: build
|
|
87
|
+
environment: pypi
|
|
88
|
+
permissions:
|
|
89
|
+
id-token: write
|
|
90
|
+
steps:
|
|
91
|
+
- uses: actions/download-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: dist
|
|
94
|
+
path: dist/
|
|
95
|
+
- name: Publish to PyPI
|
|
96
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
97
|
+
with:
|
|
98
|
+
packages-dir: dist/
|
|
99
|
+
|
|
100
|
+
backfill-emit:
|
|
101
|
+
name: Emit signed version-tuple envelope (backfill)
|
|
102
|
+
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
permissions:
|
|
105
|
+
contents: write
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v4
|
|
108
|
+
|
|
109
|
+
- name: Determine tag
|
|
110
|
+
id: tag
|
|
111
|
+
run: |
|
|
112
|
+
TAG="${{ inputs.tag }}"
|
|
113
|
+
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
114
|
+
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
|
|
115
|
+
|
|
116
|
+
- name: Ensure GitHub release exists
|
|
117
|
+
env:
|
|
118
|
+
GH_TOKEN: ${{ github.token }}
|
|
119
|
+
run: |
|
|
120
|
+
if ! gh release view "${{ steps.tag.outputs.tag }}" >/dev/null 2>&1; then
|
|
121
|
+
gh release create "${{ steps.tag.outputs.tag }}" \
|
|
122
|
+
--title "robot-md-gateway ${{ steps.tag.outputs.tag }}" \
|
|
123
|
+
--generate-notes
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
- uses: continuonai/rcan-spec/.github/actions/emit-version-tuple@v3.2.0
|
|
127
|
+
with:
|
|
128
|
+
project: robot-md-gateway
|
|
129
|
+
ran: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_RAN }}
|
|
130
|
+
field: gateway_version
|
|
131
|
+
value: ${{ steps.tag.outputs.version }}
|
|
132
|
+
depends_on: '{"manifest_spec_version":">=1.5.0","protocol_version":">=3.2.0"}'
|
|
133
|
+
pq_signing_key: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_PQ_PRIV }}
|
|
134
|
+
pq_kid: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_KID }}
|
|
135
|
+
ed25519_signing_key: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_PRIV }}
|
|
136
|
+
ed25519_kid: ${{ secrets.ROBOT_MD_DISPATCHER_RELEASE_KID }}
|
|
137
|
+
release_tag: ${{ steps.tag.outputs.tag }}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.3.0a1 — 2026-05-03
|
|
4
|
+
|
|
5
|
+
### Renamed
|
|
6
|
+
|
|
7
|
+
- **Package + GitHub repo: `robot-md-dispatcher` → `robot-md-gateway`.** Old PyPI name republished as a tombstone (v0.2.1) that depends on this package. Old GitHub URL redirects.
|
|
8
|
+
- **Module: `robot_md_dispatcher` → `robot_md_gateway`.** Backward-compat shim ships at the old import path with a `DeprecationWarning`. Shim removed in v0.5.0.
|
|
9
|
+
- **CLI: `robot-md-gateway`** is the new command. The old `robot-md-dispatcher` command keeps working with a deprecation banner; removed in v0.5.0.
|
|
10
|
+
|
|
11
|
+
### Scope-shifted
|
|
12
|
+
|
|
13
|
+
- **Default mode is now receive-only RCAN envelope enforcement.** The gateway accepts signed INVOKE envelopes, verifies them, and dispatches to drivers. The previous v0.2.x planner-launcher mode is preserved behind `--legacy-byok-launcher` for backward compat — deprecation-warned, removed in v0.4.0.
|
|
14
|
+
- **Manifest provenance verification added.** Every action's target ROBOT.md is checked for a valid signature against an RRF-registered key (cert property MF-001 / MF-002).
|
|
15
|
+
- **Direct device-node bypass denial added.** udev policy generator + service-account isolation enforce the gateway as the exclusive `/dev/tty*` owner (cert property GW-001).
|
|
16
|
+
|
|
17
|
+
### Forbidden-phrase lint
|
|
18
|
+
|
|
19
|
+
- The previous v0.2.x framing is now blocked by the ecosystem-wide forbidden-phrase lint (Plan 2). The new README ships into already-honest copy.
|
|
20
|
+
|
|
21
|
+
## 0.2.0 — 2026-04-24
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- New `robot-md-dispatcher init` subcommand that scaffolds `bearers.yaml`, `.env`, and a `dispatch-test.sh` smoke-test script for a robot whose `ROBOT.md` is already in place. Has a guided mode (explains each knob) and a `--yes` one-shot mode (all defaults).
|
|
25
|
+
- `--force` flag to regenerate files (invalidates old tokens).
|
|
26
|
+
- `--no-token-stdout` flag that suppresses the "print token once" step — used by the `/enable-dispatch` Claude Code slash command in `robot-md-mcp` so fresh secrets never enter agent context.
|
|
27
|
+
- Hard-fail preconditions: `ROBOT.md` must exist and pass `robot_md.validate`; `robot-md-mcp` must be on PATH.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- `robot-md>=1.1` is now a runtime dependency (used for ROBOT.md parse + validate via Python API instead of subprocessing the CLI). This pulls in `robot-md`'s transitive deps (numpy, jinja2, jsonschema, mcp, rich, ruamel-yaml, typer, websockets, rcan[pq,crypto]) — install footprint grows accordingly; users on minimal images should be aware.
|
|
31
|
+
|
|
32
|
+
## 0.1.0 — 2026-04-24
|
|
33
|
+
|
|
34
|
+
Initial scaffold. FastAPI `/dispatch` endpoint, tier-based gating, bearer auth, systemd install script, BYOK billing pattern.
|
|
@@ -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 [yyyy] [name of copyright owner]
|
|
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,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: robot-md-gateway
|
|
3
|
+
Version: 0.3.0a1
|
|
4
|
+
Summary: Enforcement gateway for the OpenCastor stack — receives signed RCAN action envelopes, verifies manifest provenance, applies tier policy + tool allowlist, dispatches to drivers. Mandatory exclusive path between agent intent and any actuator.
|
|
5
|
+
Project-URL: Homepage, https://robotmd.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/RobotRegistryFoundation/robot-md-gateway
|
|
7
|
+
Author-email: craigm26 <craigm26@gmail.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: enforcement,gateway,rcan,robot-md,robotics,safety
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: System :: Hardware
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: claude-agent-sdk>=0.1
|
|
23
|
+
Requires-Dist: fastapi>=0.110
|
|
24
|
+
Requires-Dist: pydantic>=2.6
|
|
25
|
+
Requires-Dist: python-frontmatter>=1.0
|
|
26
|
+
Requires-Dist: robot-md>=1.1
|
|
27
|
+
Requires-Dist: uvicorn[standard]>=0.27
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# robot-md-gateway
|
|
36
|
+
|
|
37
|
+
> **The mandatory enforcement gateway for the OpenCastor stack.**
|
|
38
|
+
> Receives signed RCAN action envelopes, verifies manifest provenance, applies tier policy + tool allowlist, dispatches to drivers. Exclusive path between agent intent and any actuator. Open, neutral, becomes OpenCastor's safety kernel via open-core extraction.
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/robot-md-gateway/)
|
|
41
|
+
[](LICENSE)
|
|
42
|
+
[](https://www.python.org)
|
|
43
|
+
[](https://rcan.dev/compatibility)
|
|
44
|
+
|
|
45
|
+
> **Renamed in 2026-05.** This package was previously published as `robot-md-dispatcher`. The old name is now a tombstone on PyPI; `pip install robot-md-dispatcher` continues to work and pulls this package as a dependency. Imports and the `robot-md-dispatcher` CLI keep working through v0.4.x via a backward-compat shim. See [CHANGELOG.md](CHANGELOG.md) for migration notes.
|
|
46
|
+
|
|
47
|
+
## Where this fits in the stack
|
|
48
|
+
|
|
49
|
+
`robot-md-gateway` is **Layer 3** of the OpenCastor stack — the
|
|
50
|
+
enforcement gateway. Every action that crosses from agent intent to
|
|
51
|
+
any actuator passes through this gateway. There is no second path.
|
|
52
|
+
|
|
53
|
+
| Layer | Piece | What it is |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| **1 — Declaration** | [robot-md](https://github.com/RobotRegistryFoundation/robot-md) | The ROBOT.md file + Python CLI. Declares identity, capabilities, safety gates. |
|
|
56
|
+
| **2 — Agent runtime** | (any MCP host) | Claude Code, Codex, Gemini — plans actions, calls tools, never reaches actuators directly. |
|
|
57
|
+
| **3 — Gateway / Enforcement** ← *this* | [robot-md-gateway](https://github.com/RobotRegistryFoundation/robot-md-gateway) | Mandatory exclusive path. Verifies signatures, applies policy, signs audit bundles. |
|
|
58
|
+
| **4 — Robot-facing runtime** | [OpenCastor](https://github.com/craigm26/OpenCastor) | Productized open-core runtime. Embeds the gateway as its safety kernel. |
|
|
59
|
+
| **5 — Protocol** | [rcan-spec](https://github.com/continuonai/rcan-spec) | Wire format, envelopes, conformance suite. |
|
|
60
|
+
| **6 — Registry** | [Robot Registry Foundation](https://robotregistryfoundation.org) | Identity (RRN/RCN/RMN/RHN), public keys, evidence. |
|
|
61
|
+
|
|
62
|
+
[See the live compatibility matrix →](https://rcan.dev/compatibility)
|
|
63
|
+
|
|
64
|
+
## What it does
|
|
65
|
+
|
|
66
|
+
The gateway accepts incoming **signed RCAN INVOKE envelopes** — never
|
|
67
|
+
plaintext goals, never SDK sessions. Every envelope is checked for:
|
|
68
|
+
|
|
69
|
+
1. **Manifest provenance** — the ROBOT.md being actuated against has a verified signature from a key registered to this robot's RRN at RRF.
|
|
70
|
+
2. **Tier + RBAC** — the caller's bearer token resolves to a tier authorized for this scope.
|
|
71
|
+
3. **Tool allowlist** — the requested tool is in the operator's policy (default-deny on unknown).
|
|
72
|
+
4. **Confidence + HiTL gates** *(Phase 4 — Plan 6)* — model-asserted confidence above threshold; human-in-the-loop approval if scope demands it.
|
|
73
|
+
5. **Replay protection** *(Plan 6)* — envelope's nonce + timestamp not previously seen.
|
|
74
|
+
6. **ESTOP precedence** *(Plan 6)* — physical or operator stop signal preempts any pending action.
|
|
75
|
+
|
|
76
|
+
If all checks pass, the gateway dispatches to a local actuation tool
|
|
77
|
+
(typically a robot-md-mcp tool call or a direct driver invocation) and
|
|
78
|
+
emits a **signed audit bundle** entry per action. If any check fails,
|
|
79
|
+
the action is denied and the failure is logged + signed.
|
|
80
|
+
|
|
81
|
+
## What it does not do
|
|
82
|
+
|
|
83
|
+
- ❌ **Spawn LLM planners.** That was the v0.2.x mode; it now ships as `--legacy-byok-launcher` for backward compat (deprecation-warned), removed in v0.4.0. Planners run in agent runtimes (Layer 2), separately, and produce signed envelopes that come *to* the gateway.
|
|
84
|
+
- ❌ **Be optional.** If you can move the robot without going through the gateway, you don't have an enforcement gateway — you have a hint.
|
|
85
|
+
- ❌ **Cover Layer 4.** Drivers, fleet UI, cloud bridge belong to OpenCastor (or any future Layer-4 runtime); not here.
|
|
86
|
+
|
|
87
|
+
<!-- BEGIN: ecosystem authority disclaimer (canonical, verbatim per spec §10) -->
|
|
88
|
+
> **Where safety is actually enforced.**
|
|
89
|
+
>
|
|
90
|
+
> Physical safety is enforced at Layer 3 (`robot-md-gateway`) or Layer 4 (a runtime that embeds it, e.g., OpenCastor). Declaration alone (Layer 1) does not enforce safety. Agent host alone (Layer 2) is not the safety boundary. If a deployment lacks Layer 3, no safety claim attaches to it.
|
|
91
|
+
<!-- END: ecosystem authority disclaimer -->
|
|
92
|
+
|
|
93
|
+
## Status (v0.3.0a1)
|
|
94
|
+
|
|
95
|
+
This release lands the rename + scope-shift skeleton. The receive-only
|
|
96
|
+
RCAN handler, manifest provenance verification (cert MF-001 / MF-002),
|
|
97
|
+
and direct-device-bypass denial (cert GW-001) ship in upcoming patch
|
|
98
|
+
releases under Plan 6. The legacy planner-launcher mode is preserved
|
|
99
|
+
behind `--legacy-byok-launcher` for one minor release.
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install robot-md-gateway
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Quick start (legacy mode, until receive-only ships)
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
python3 -m venv .venv
|
|
111
|
+
.venv/bin/pip install robot-md-gateway robot-md # robot-md-mcp ships with robot-md
|
|
112
|
+
.venv/bin/robot-md-gateway init --yes
|
|
113
|
+
.venv/bin/robot-md-gateway --legacy-byok-launcher serve \
|
|
114
|
+
--bearers ./bearers.yaml --robot-md ./ROBOT.md
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`init --yes` writes `bearers.yaml`, `.env`, and `dispatch-test.sh` next to your
|
|
118
|
+
ROBOT.md and prints a generated actuate-tier token once. Save the token — it's
|
|
119
|
+
not stored anywhere else. Run `robot-md-gateway init` (no `--yes`) for a
|
|
120
|
+
guided walk that explains each knob.
|
|
121
|
+
|
|
122
|
+
## Production install
|
|
123
|
+
|
|
124
|
+
`systemd/install.sh` handles the full setup: dedicated `robot` system user, `/opt/robot-md-gateway/.venv` with hardened unit, `DeviceAllow=/dev/ttyACM0 rw`, `MemoryMax=1G`, `CPUQuota=80%`, journal logging.
|
|
125
|
+
|
|
126
|
+
Run `robot-md-gateway init --yes` first (next to your `ROBOT.md`) to generate
|
|
127
|
+
`bearers.yaml`, `.env`, and `dispatch-test.sh`. Then:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
sudo ./systemd/install.sh
|
|
131
|
+
sudo cp ./bearers.yaml ./.env /etc/robot-md-gateway/
|
|
132
|
+
sudo cp ./ROBOT.md /etc/robot-md-gateway/ROBOT.md
|
|
133
|
+
sudo systemctl daemon-reload && sudo systemctl enable --now robot-md-gateway
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Ingress — do not port-forward
|
|
137
|
+
|
|
138
|
+
The gateway binds to `127.0.0.1` by design. Expose it via Tailscale Funnel (named, revocable, TLS-terminated):
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
tailscale serve --bg --https=443 http://127.0.0.1:8080
|
|
142
|
+
tailscale funnel 443 on
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
Environment variables (also settable via CLI flags — flags win):
|
|
148
|
+
|
|
149
|
+
| Variable | Purpose | Default |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| `ROBOT_MD_PATH` | Path to the `ROBOT.md` loaded as the manifest under verification | unset |
|
|
152
|
+
| `ROBOT_MD_BEARERS_FILE` | Path to `bearers.yaml` | **required** |
|
|
153
|
+
| `ROBOT_MD_MCP_COMMAND` | Stdio MCP command the gateway dispatches to | `robot-md-mcp` |
|
|
154
|
+
| `ROBOT_MD_MCP_ARGS` | Space-separated args for the MCP command | (none) |
|
|
155
|
+
| `ROBOT_MD_LOG_LEVEL` | Python log level | `INFO` |
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
161
|
+
.venv/bin/pytest -q
|
|
162
|
+
.venv/bin/ruff check src tests
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The test suite mocks external SDK boundaries via Protocol shims, so `pytest` runs offline. The tier gate, auth, and HTTP surface are exercised end-to-end with a `TestClient`. Real tool names from `robot-md-mcp`'s server are pinned in `tests/test_gating.py`; if the upstream tool surface shifts in a way that inverts a read/actuate classification, the test fails loudly.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
Apache-2.0. See [LICENSE](LICENSE).
|