relayvault 0.2.0__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.
- relayvault-0.2.0/.github/dependabot.yml +10 -0
- relayvault-0.2.0/.github/workflows/ci.yml +72 -0
- relayvault-0.2.0/.github/workflows/publish.yml +76 -0
- relayvault-0.2.0/.gitignore +31 -0
- relayvault-0.2.0/Dockerfile +24 -0
- relayvault-0.2.0/LICENSE +21 -0
- relayvault-0.2.0/PKG-INFO +326 -0
- relayvault-0.2.0/README.md +297 -0
- relayvault-0.2.0/demo_multi_model.py +137 -0
- relayvault-0.2.0/docs/RELEASE.md +26 -0
- relayvault-0.2.0/docs/SECURITY.md +67 -0
- relayvault-0.2.0/pyproject.toml +48 -0
- relayvault-0.2.0/relayvault/__init__.py +3 -0
- relayvault-0.2.0/relayvault/access.py +85 -0
- relayvault-0.2.0/relayvault/cli.py +139 -0
- relayvault-0.2.0/relayvault/crypto.py +74 -0
- relayvault-0.2.0/relayvault/engine.py +648 -0
- relayvault-0.2.0/relayvault/files.py +30 -0
- relayvault-0.2.0/relayvault/maintenance.py +177 -0
- relayvault-0.2.0/relayvault/mcp_server.py +202 -0
- relayvault-0.2.0/relayvault/providers.py +147 -0
- relayvault-0.2.0/relayvault/redaction.py +150 -0
- relayvault-0.2.0/relayvault/rest_api.py +238 -0
- relayvault-0.2.0/requirements-dev.lock +1174 -0
- relayvault-0.2.0/requirements.lock +597 -0
- relayvault-0.2.0/requirements.txt +2 -0
- relayvault-0.2.0/scripts/docker_smoke.py +70 -0
- relayvault-0.2.0/scripts/redaction_report.py +40 -0
- relayvault-0.2.0/scripts/wheel_smoke.py +49 -0
- relayvault-0.2.0/server.json +9 -0
- relayvault-0.2.0/tests/conftest.py +22 -0
- relayvault-0.2.0/tests/redaction_corpus.py +75 -0
- relayvault-0.2.0/tests/test_hardening.py +666 -0
- relayvault-0.2.0/tests/test_providers.py +159 -0
- relayvault-0.2.0/tests/test_relayvault.py +581 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '23 7 * * 1'
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
timeout-minutes: 20
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, macos-latest]
|
|
20
|
+
python-version: ['3.11', '3.12']
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
23
|
+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
cache: pip
|
|
27
|
+
cache-dependency-path: requirements-dev.lock
|
|
28
|
+
- name: Install pinned dependencies and project
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --require-hashes -r requirements-dev.lock
|
|
31
|
+
python -m pip install --no-deps --no-build-isolation -e .
|
|
32
|
+
python -m pip check
|
|
33
|
+
- name: Lint and format
|
|
34
|
+
run: |
|
|
35
|
+
ruff check .
|
|
36
|
+
ruff format --check .
|
|
37
|
+
- name: Run integration and security tests
|
|
38
|
+
run: pytest -v
|
|
39
|
+
- name: Measure synthetic detector corpus
|
|
40
|
+
run: python scripts/redaction_report.py
|
|
41
|
+
- name: Run MCP to REST handoff demo
|
|
42
|
+
run: python demo_multi_model.py
|
|
43
|
+
- name: Build and verify installed wheel
|
|
44
|
+
run: |
|
|
45
|
+
python -m build --no-isolation
|
|
46
|
+
python -m pip install --force-reinstall --no-deps dist/*.whl
|
|
47
|
+
python -I scripts/wheel_smoke.py
|
|
48
|
+
|
|
49
|
+
audit:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
timeout-minutes: 15
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
54
|
+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: '3.12'
|
|
57
|
+
- name: Install pinned audit tooling
|
|
58
|
+
run: python -m pip install --require-hashes -r requirements-dev.lock
|
|
59
|
+
- name: Audit runtime and development dependencies
|
|
60
|
+
run: |
|
|
61
|
+
pip-audit --require-hashes -r requirements.lock
|
|
62
|
+
pip-audit --require-hashes -r requirements-dev.lock
|
|
63
|
+
|
|
64
|
+
container:
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
timeout-minutes: 20
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
69
|
+
- name: Build non-root image
|
|
70
|
+
run: docker build -t relayvault-ci .
|
|
71
|
+
- name: Verify container authentication and storage
|
|
72
|
+
run: python scripts/docker_smoke.py
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Verify and build distributions
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 20
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
18
|
+
with:
|
|
19
|
+
persist-credentials: false
|
|
20
|
+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.12'
|
|
23
|
+
cache: pip
|
|
24
|
+
cache-dependency-path: requirements-dev.lock
|
|
25
|
+
- name: Install hash-pinned dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --require-hashes -r requirements-dev.lock
|
|
28
|
+
python -m pip install --no-deps --no-build-isolation -e .
|
|
29
|
+
python -m pip check
|
|
30
|
+
- name: Lint, test, and audit
|
|
31
|
+
run: |
|
|
32
|
+
ruff check .
|
|
33
|
+
ruff format --check .
|
|
34
|
+
pytest -v
|
|
35
|
+
pip-audit --require-hashes -r requirements.lock
|
|
36
|
+
pip-audit --require-hashes -r requirements-dev.lock
|
|
37
|
+
- name: Build sdist and wheel
|
|
38
|
+
run: |
|
|
39
|
+
rm -rf dist/
|
|
40
|
+
python -m build --no-isolation
|
|
41
|
+
sha256sum dist/*
|
|
42
|
+
- name: Smoke-test installed wheel
|
|
43
|
+
run: |
|
|
44
|
+
python -m pip install --force-reinstall --no-deps dist/*.whl
|
|
45
|
+
python -I scripts/wheel_smoke.py
|
|
46
|
+
- name: Upload distribution artifacts
|
|
47
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
|
|
48
|
+
with:
|
|
49
|
+
name: python-package-distributions
|
|
50
|
+
path: dist/
|
|
51
|
+
if-no-files-found: error
|
|
52
|
+
retention-days: 5
|
|
53
|
+
|
|
54
|
+
publish:
|
|
55
|
+
name: Publish distributions to PyPI
|
|
56
|
+
needs: [build]
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
timeout-minutes: 10
|
|
59
|
+
environment:
|
|
60
|
+
name: pypi
|
|
61
|
+
url: https://pypi.org/p/relayvault
|
|
62
|
+
permissions:
|
|
63
|
+
id-token: write
|
|
64
|
+
steps:
|
|
65
|
+
- name: Download distribution artifacts
|
|
66
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
|
|
67
|
+
with:
|
|
68
|
+
name: python-package-distributions
|
|
69
|
+
path: dist/
|
|
70
|
+
- name: Publish package to PyPI via Trusted Publishing
|
|
71
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
|
|
72
|
+
with:
|
|
73
|
+
packages-dir: dist/
|
|
74
|
+
verify-metadata: true
|
|
75
|
+
print-hash: true
|
|
76
|
+
attestations: true
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python environments, caches and build outputs
|
|
2
|
+
.codex/
|
|
3
|
+
.venv/
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
|
|
11
|
+
# Local vaults and credentials
|
|
12
|
+
*.db
|
|
13
|
+
*.db-wal
|
|
14
|
+
*.db-shm
|
|
15
|
+
*.sqlite
|
|
16
|
+
*.sqlite-wal
|
|
17
|
+
*.sqlite-shm
|
|
18
|
+
*.sqlite3
|
|
19
|
+
*.sqlite3-wal
|
|
20
|
+
*.sqlite3-shm
|
|
21
|
+
*.key
|
|
22
|
+
master.key
|
|
23
|
+
.env
|
|
24
|
+
.env.*
|
|
25
|
+
!.env.example
|
|
26
|
+
|
|
27
|
+
# Local OS/editor files
|
|
28
|
+
.DS_Store
|
|
29
|
+
.ruff_cache/
|
|
30
|
+
.coverage
|
|
31
|
+
htmlcov/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
FROM python:3.12-slim AS builder
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
COPY requirements.lock requirements-dev.lock ./
|
|
5
|
+
# Build tooling is locked too. Runtime image below contains only runtime dependencies.
|
|
6
|
+
RUN pip install --no-cache-dir --require-hashes -r requirements-dev.lock
|
|
7
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
8
|
+
COPY relayvault ./relayvault
|
|
9
|
+
RUN pip wheel --no-deps --no-build-isolation --wheel-dir /wheels .
|
|
10
|
+
|
|
11
|
+
FROM python:3.12-slim
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY requirements.lock ./
|
|
14
|
+
RUN pip install --no-cache-dir --require-hashes -r requirements.lock \
|
|
15
|
+
&& groupadd --gid 10001 relayvault \
|
|
16
|
+
&& useradd --uid 10001 --gid 10001 --create-home relayvault \
|
|
17
|
+
&& install -d -m 0700 -o relayvault -g relayvault /data
|
|
18
|
+
COPY --from=builder /wheels /wheels
|
|
19
|
+
RUN pip install --no-cache-dir --no-deps /wheels/*.whl
|
|
20
|
+
USER relayvault
|
|
21
|
+
ENV RELAYVAULT_HOME=/data
|
|
22
|
+
VOLUME ["/data"]
|
|
23
|
+
EXPOSE 8000
|
|
24
|
+
CMD ["relayvault", "serve-api", "--host", "0.0.0.0", "--port", "8000"]
|
relayvault-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ranjit (@ranjitmani61)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: relayvault
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Local task checkpoints and reversible pattern redaction (MCP + REST)
|
|
5
|
+
Project-URL: Homepage, https://github.com/ranjitmani61/relayvault
|
|
6
|
+
Project-URL: Repository, https://github.com/ranjitmani61/relayvault
|
|
7
|
+
Project-URL: Issues, https://github.com/ranjitmani61/relayvault/issues
|
|
8
|
+
Author: RelayVault Contributors
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: claude,deepseek,gemini,kimi,mcp,model-context-protocol,openai,pii-redaction
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: cryptography<51,>=50.0.2
|
|
14
|
+
Requires-Dist: fastapi<1,>=0.163.0
|
|
15
|
+
Requires-Dist: httpx<1,>=0.28.1
|
|
16
|
+
Requires-Dist: mcp<2,>=1.30.0
|
|
17
|
+
Requires-Dist: pydantic<3,>=2.14.3
|
|
18
|
+
Requires-Dist: uvicorn<1,>=0.54.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build<2,>=1.6.1; extra == 'dev'
|
|
21
|
+
Requires-Dist: editables==0.5; extra == 'dev'
|
|
22
|
+
Requires-Dist: hatchling==1.30.1; extra == 'dev'
|
|
23
|
+
Requires-Dist: pip-audit<3,>=2.10.1; extra == 'dev'
|
|
24
|
+
Requires-Dist: pip-tools<8,>=7.6.2; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-asyncio<2,>=1.5; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest<10,>=9.2; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff<0.18,>=0.17.5; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# RelayVault
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: io.github.ranjitmani61/relayvault -->
|
|
33
|
+
|
|
34
|
+
[](https://github.com/ranjitmani61/relayvault/actions/workflows/ci.yml)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
RelayVault stores redacted task checkpoints in a local SQLite WAL database and provides MCP, REST, and CLI interfaces for handing work between models. Detected secrets are replaced with stable workspace-specific tokens; their original values are encrypted in the local vault.
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
[Model A: Claude / GPT]
|
|
41
|
+
|
|
|
42
|
+
(commit)
|
|
43
|
+
v
|
|
44
|
+
[RelayVault Redaction Engine] ----(Fernet AES ciphertext)----> [Local SQLite secret_vault]
|
|
45
|
+
| [master.key (0600)]
|
|
46
|
+
| Scrubbed <RV_VAULT:...> DAG state
|
|
47
|
+
v
|
|
48
|
+
[Model B: DeepSeek / Kimi / Gemini / Grok]
|
|
49
|
+
|
|
|
50
|
+
| Code with <RV_VAULT:...> intact
|
|
51
|
+
v
|
|
52
|
+
[Local CLI: relayvault rehydrate-file]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The boundary protects the **outgoing redacted handoff** to Model B, not plaintext already sent to Model A before a commit. To avoid sending secrets to either model, run `dehydrate-file` locally before supplying text to a model, and review the resulting text. Detection is heuristic and cannot guarantee that all sensitive data is removed.
|
|
56
|
+
|
|
57
|
+
## Install and quickstart
|
|
58
|
+
|
|
59
|
+
Python 3.11 or later is required. Installation is currently from source; no PyPI publication is claimed. Existing vaults require the explicit [v2 migration](docs/SECURITY.md#legacy-migration). From the repository root:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python3 -m venv .venv
|
|
63
|
+
. .venv/bin/activate
|
|
64
|
+
pip install --require-hashes -r requirements-dev.lock
|
|
65
|
+
pip install --no-deps --no-build-isolation -e .
|
|
66
|
+
|
|
67
|
+
# Choose a long random value; keep it outside source control.
|
|
68
|
+
export RELAYVAULT_API_KEY="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
|
|
69
|
+
export RELAYVAULT_WORKSPACES='{"example":["read","write"]}'
|
|
70
|
+
relayvault serve-api --host 127.0.0.1 --port 8000
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
In another terminal, with the same environment and `RELAYVAULT_HOME`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
curl -sS -X POST http://127.0.0.1:8000/v1/checkpoints/commit \
|
|
77
|
+
-H "Authorization: Bearer $RELAYVAULT_API_KEY" -H 'Content-Type: application/json' \
|
|
78
|
+
-d '{"workspace_id":"example", "source_model":"model-a", "objective":"Implement a retry handler"}'
|
|
79
|
+
|
|
80
|
+
curl -sS -X POST http://127.0.0.1:8000/v1/checkpoints/checkout \
|
|
81
|
+
-H "Authorization: Bearer $RELAYVAULT_API_KEY" -H 'Content-Type: application/json' \
|
|
82
|
+
-d '{"workspace_id":"example", "target_model":"model-b"}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The server also exposes `/openapi.json`, `/docs`, and `/v1/schemas/tools`. `RELAYVAULT_HOME` selects the data directory; the default is `~/.relayvault`. All clients that need to share a vault must use the same home and salt.
|
|
86
|
+
|
|
87
|
+
## Connect MCP clients
|
|
88
|
+
|
|
89
|
+
These examples run the server locally over stdio. By default the available tools are `relayvault_commit_checkpoint`, `relayvault_checkout_handoff`, and `relayvault_list_history`; agent rehydration is disabled. The CLI and REST examples below do not require an MCP client.
|
|
90
|
+
|
|
91
|
+
### Claude Code
|
|
92
|
+
|
|
93
|
+
From the repository root, use an absolute executable path so the server does not depend on the client's PATH. Set a shared vault home explicitly:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
claude mcp add --transport stdio \
|
|
97
|
+
--env "RELAYVAULT_HOME=$HOME/.relayvault" \
|
|
98
|
+
relayvault -- "$PWD/.venv/bin/relayvault-mcp"
|
|
99
|
+
claude mcp get relayvault
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
See the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp) for scopes and troubleshooting.
|
|
103
|
+
|
|
104
|
+
### Claude Desktop
|
|
105
|
+
|
|
106
|
+
Add this entry to `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows, or `~/.config/Claude/claude_desktop_config.json` on Linux. Replace both example paths with **absolute paths** on your machine; on Windows use the virtual environment's `Scripts\\relayvault-mcp.exe` and escaped JSON backslashes. Merge the entry with any existing `mcpServers`, then fully restart Claude Desktop.
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"mcpServers": {
|
|
111
|
+
"relayvault": {
|
|
112
|
+
"command": "/absolute/path/to/relayvault/.venv/bin/relayvault-mcp",
|
|
113
|
+
"args": [],
|
|
114
|
+
"env": {"RELAYVAULT_HOME": "/absolute/path/to/.relayvault"}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
See [MCP's local server configuration guide](https://modelcontextprotocol.io/docs/develop/connect-local-servers).
|
|
121
|
+
|
|
122
|
+
### Cursor
|
|
123
|
+
|
|
124
|
+
Add this entry to `.cursor/mcp.json` in a project or `~/.cursor/mcp.json` for the current user. Replace the example paths with absolute paths, and restart or reload Cursor.
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"relayvault": {
|
|
130
|
+
"type": "stdio",
|
|
131
|
+
"command": "/absolute/path/to/relayvault/.venv/bin/relayvault-mcp",
|
|
132
|
+
"args": [],
|
|
133
|
+
"env": {"RELAYVAULT_HOME": "/absolute/path/to/.relayvault"}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
See [Cursor's MCP configuration](https://cursor.com/docs/mcp). Do not set `RELAYVAULT_ALLOW_AGENT_REHYDRATE` in model-facing client configurations unless the client is trusted to receive plaintext secrets.
|
|
140
|
+
|
|
141
|
+
## REST and provider function calling
|
|
142
|
+
|
|
143
|
+
Run RelayVault locally as shown in Quickstart. The `/v1/schemas/tools` response contains two model-facing function definitions for `openai_deepseek_kimi_grok`, `anthropic_claude`, and `google_gemini`; it never contains a rehydration function. The following examples send a **new request to an external provider**, may incur charges, and require that provider's credentials and access to a compatible model. Use only reviewed, redacted content.
|
|
144
|
+
|
|
145
|
+
### OpenAI, DeepSeek, and Kimi: Chat Completions
|
|
146
|
+
|
|
147
|
+
Choose one configuration and a model available to your account. These examples target the Chat Completions tool format; some OpenAI models require the Responses API instead.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# OpenAI:
|
|
151
|
+
export PROVIDER_URL='https://api.openai.com/v1/chat/completions'
|
|
152
|
+
export PROVIDER_API_KEY="$OPENAI_API_KEY"
|
|
153
|
+
|
|
154
|
+
# DeepSeek (use instead of the two lines above):
|
|
155
|
+
# export PROVIDER_URL='https://api.deepseek.com/chat/completions'
|
|
156
|
+
# export PROVIDER_API_KEY="$DEEPSEEK_API_KEY"
|
|
157
|
+
|
|
158
|
+
# Kimi / Moonshot international (use instead):
|
|
159
|
+
# export PROVIDER_URL='https://api.moonshot.ai/v1/chat/completions'
|
|
160
|
+
# export PROVIDER_API_KEY="$KIMI_API_KEY"
|
|
161
|
+
|
|
162
|
+
export MODEL='replace-with-a-chat-completions-model-available-to-your-account'
|
|
163
|
+
python - <<'PY'
|
|
164
|
+
import os
|
|
165
|
+
import httpx
|
|
166
|
+
|
|
167
|
+
schemas = httpx.get('http://127.0.0.1:8000/v1/schemas/tools').raise_for_status().json()
|
|
168
|
+
response = httpx.post(
|
|
169
|
+
os.environ['PROVIDER_URL'],
|
|
170
|
+
headers={'Authorization': 'Bearer ' + os.environ['PROVIDER_API_KEY']},
|
|
171
|
+
json={
|
|
172
|
+
'model': os.environ['MODEL'],
|
|
173
|
+
'messages': [{'role': 'user', 'content': 'Check out the latest handoff for workspace example.'}],
|
|
174
|
+
'tools': schemas['openai_deepseek_kimi_grok'],
|
|
175
|
+
},
|
|
176
|
+
timeout=60,
|
|
177
|
+
)
|
|
178
|
+
response.raise_for_status()
|
|
179
|
+
print(response.json())
|
|
180
|
+
PY
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This prints the provider response, including any proposed tool calls. The application must validate the function name and arguments, execute only the intended local endpoint (`/v1/checkpoints/commit` or `/v1/checkpoints/checkout`) with `RELAYVAULT_API_KEY`, and return the tool result to the provider in its required format. Sending schemas alone does **not** execute the functions. Never pass either RelayVault credential to the provider. See [OpenAI Chat Completions tools](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create), [DeepSeek Chat Completions](https://api-docs.deepseek.com/api/create-chat-completion/), and [Kimi provider configuration](https://moonshotai.github.io/kimi-code/en/configuration/providers.html).
|
|
184
|
+
|
|
185
|
+
### Gemini: generateContent
|
|
186
|
+
|
|
187
|
+
Set `GEMINI_API_KEY` and choose an available model in `MODEL`. This example converts the exported function parameters to Gemini's `parametersJsonSchema` field and prints any proposed function call; the application must validate, execute, and return results as described above.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
export MODEL='replace-with-a-gemini-model-available-to-your-account'
|
|
191
|
+
python - <<'PY'
|
|
192
|
+
import os
|
|
193
|
+
import httpx
|
|
194
|
+
|
|
195
|
+
schemas = httpx.get('http://127.0.0.1:8000/v1/schemas/tools').raise_for_status().json()
|
|
196
|
+
declarations = []
|
|
197
|
+
for group in schemas['google_gemini']:
|
|
198
|
+
for function in group['function_declarations']:
|
|
199
|
+
declarations.append({
|
|
200
|
+
'name': function['name'],
|
|
201
|
+
'description': function['description'],
|
|
202
|
+
'parametersJsonSchema': function['parameters'],
|
|
203
|
+
})
|
|
204
|
+
response = httpx.post(
|
|
205
|
+
'https://generativelanguage.googleapis.com/v1beta/models/' + os.environ['MODEL'] + ':generateContent',
|
|
206
|
+
headers={'x-goog-api-key': os.environ['GEMINI_API_KEY']},
|
|
207
|
+
json={
|
|
208
|
+
'contents': [{'parts': [{'text': 'Check out the latest handoff for workspace example.'}]}],
|
|
209
|
+
'tools': [{'functionDeclarations': declarations}],
|
|
210
|
+
},
|
|
211
|
+
timeout=60,
|
|
212
|
+
)
|
|
213
|
+
response.raise_for_status()
|
|
214
|
+
print(response.json())
|
|
215
|
+
PY
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
See the [Gemini function declaration reference](https://ai.google.dev/api/generate-content) for provider schema and response details. Provider model availability and supported schemas can change; test the integration against your selected model before deployment.
|
|
219
|
+
|
|
220
|
+
## HTTP authentication and workspace permissions
|
|
221
|
+
|
|
222
|
+
Stdio trusts the OS user running the server. Both HTTP MCP transports and REST require explicit workspace grants. For a single client use the Quickstart environment above; for multiple clients set `RELAYVAULT_AUTH_FILE` to a private 0600 JSON file:
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"coding-agent": {
|
|
227
|
+
"key": "replace-with-a-unique-random-agent-key",
|
|
228
|
+
"workspaces": {"example": ["read", "write"]}
|
|
229
|
+
},
|
|
230
|
+
"reviewer": {
|
|
231
|
+
"key": "replace-with-another-random-key",
|
|
232
|
+
"workspaces": {"example": ["read"]}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
This file takes precedence over `RELAYVAULT_API_KEY` / `RELAYVAULT_WORKSPACES`. Wildcard workspaces are not accepted. Send the selected client's key as `Authorization: Bearer ...`. For HTTP MCP, use `relayvault serve-mcp --transport streamable-http --port 8090` (`/mcp`), or legacy `--transport sse` (`/sse`). These listeners bind to localhost; expose them through an authenticated TLS deployment only after configuring network controls. Clients must support explicitly supplied bearer headers; RelayVault is not an OAuth authorization server.
|
|
238
|
+
|
|
239
|
+
REST rehydration is disabled until a **different** `RELAYVAULT_REHYDRATE_KEY` is configured. It requires the ordinary credential, workspace read permission and both additional headers, even on loopback:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Set on the trusted server and rehydration host; do not give it to the agent.
|
|
243
|
+
export RELAYVAULT_REHYDRATE_KEY="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
|
|
244
|
+
# Restart the server with this environment, then send a local restoration request:
|
|
245
|
+
curl -sS http://127.0.0.1:8000/v1/vault/rehydrate \
|
|
246
|
+
-H "Authorization: Bearer $RELAYVAULT_API_KEY" \
|
|
247
|
+
-H 'X-RelayVault-Local-Intent: rehydrate' \
|
|
248
|
+
-H "X-RelayVault-Rehydrate-Key: $RELAYVAULT_REHYDRATE_KEY" \
|
|
249
|
+
-H 'Content-Type: application/json' \
|
|
250
|
+
-d '{"workspace_id":"example","text_with_vault_tokens":"paste the exact vaulted output here"}'
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The endpoint is absent from OpenAPI/tool schemas. **Proxy deployments require the separate rehydration key**, just like local deployments; client addresses and forwarding headers never grant decryption privileges.
|
|
254
|
+
|
|
255
|
+
## Detection preview and local review
|
|
256
|
+
|
|
257
|
+
The default `block-uncertain` policy rejects unclassified high-entropy credential-like strings. Review mode also withholds checkpoint exports until a trusted local review:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
export RELAYVAULT_REDACTION_POLICY=review
|
|
261
|
+
relayvault preview-file --workspace example --file config.py
|
|
262
|
+
relayvault dehydrate-file --workspace example --file config.py --in-place --reviewed
|
|
263
|
+
# After an MCP/REST commit, use the returned commit hash:
|
|
264
|
+
relayvault inspect-checkpoint --workspace example --commit COMMIT_HASH
|
|
265
|
+
relayvault approve-checkpoint --workspace example --commit COMMIT_HASH --reviewed
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Review the actual output for unstructured PII and unexpected credentials before approving. There is no model-facing approval tool. Optional `RELAYVAULT_DETECTORS_FILE` points to trusted JSON such as `[{"name":"EMPLOYEE_ID","pattern":"EMP-[0-9]{6}"}]`; add bounded patterns and regression cases for your domain.
|
|
269
|
+
|
|
270
|
+
## CLI reference
|
|
271
|
+
|
|
272
|
+
| Command | Purpose and options |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `serve-mcp [--transport stdio\|sse\|streamable-http] [--port 8090] [--allow-agent-rehydrate]` | MCP; stdio default. HTTP requires bearer keys and workspace grants. Plaintext opt-in is stdio-only. |
|
|
275
|
+
| `serve-api [--host 127.0.0.1] [--port 8000]` | REST; requires bearer keys and workspace grants. |
|
|
276
|
+
| `preview-file --workspace ID --file PATH` | Display detected spans as preview markers and an uncertainty count without vaulting the file. |
|
|
277
|
+
| `dehydrate-file --workspace ID --file PATH [--in-place] [--reviewed]` | Vault detected values; review policy requires explicit local review. |
|
|
278
|
+
| `rehydrate-file --workspace ID --file PATH [--in-place] [--allow-partial]` | Restore tokens; unresolved/malformed tokens fail by default. |
|
|
279
|
+
| `log --workspace ID [--branch BRANCH]` | Integrity-checked, redacted history. |
|
|
280
|
+
| `inspect-checkpoint --workspace ID --commit HASH` | Trusted local preview of a pending checkpoint. |
|
|
281
|
+
| `approve-checkpoint --workspace ID --commit HASH --reviewed` | Approve that exact reviewed checkpoint for export. |
|
|
282
|
+
| `verify-vault` | Verify every record, checkpoint, head and lineage. |
|
|
283
|
+
| `backup --destination NEW_DIR` | Consistent SQLite snapshot with key and salt configuration. |
|
|
284
|
+
| `restore --source BACKUP_DIR --destination NEW_DIR` | Verify and restore into a new home. |
|
|
285
|
+
| `rotate-key --destination NEW_DIR` | Reencrypt into a new home; preserve tokens and checkpoint IDs. |
|
|
286
|
+
| `migrate-vault --destination NEW_DIR` | Explicit legacy migration; preserve old token recovery and require local checkpoint reviews. |
|
|
287
|
+
|
|
288
|
+
Prefix commands with `relayvault`. File commands support UTF-8 and preserve original bytes/line endings on successful round trips. Atomic in-place rehydration writes a 0600 plaintext file. `relayvault-mcp` is the stdio entry point. Stop clients before maintenance/cutover and update their `RELAYVAULT_HOME` together; maintenance commands never overwrite the source or an existing destination.
|
|
289
|
+
|
|
290
|
+
## Security model & limitations
|
|
291
|
+
|
|
292
|
+
- **Caught patterns:** structured API keys, contextual bearer/basic credentials, quoted/unquoted secret assignments, JWTs, PEM private keys, emails, validated private IPv4s and Luhn-valid card candidates. Nested dictionary keys and values are scanned; sensitive identifier fields are rejected. Detection remains heuristic.
|
|
293
|
+
- **Not comprehensively caught:** prose PII such as human names and street addresses without additional NER, encoded or fragmented credentials, unknown secret formats and arbitrary low-entropy values. Zero detections do not establish safety. A curated corpus is not a real-world accuracy score.
|
|
294
|
+
- **Local secrets:** v2 tokens use a secret HMAC key with 128-bit identifiers. Fernet authenticates values together with their record identity. Checkpoint/head HMACs detect modifications; whole-database rollback and deletion require external protections.
|
|
295
|
+
- **Keys and backups:** keep `master.key`, `relayvault.db` and `vault-config.json` (including any custom salt) together. Use `backup` for a consistent WAL snapshot, restrict access and protect backups separately. Existing ownership and permissions are checked. Lost keys cannot be recovered.
|
|
296
|
+
- **Prompt injection:** handoffs are untrusted task data with self-reported provenance. Review and host-enforced tool permissions remain necessary. Prompt wording cannot establish a security boundary.
|
|
297
|
+
- **OS boundary:** an agent with the vault owner's shell/filesystem access can decrypt secrets. Use a separate account/host and scoped HTTP credentials to isolate such an agent; do not give it the master or rehydration key.
|
|
298
|
+
|
|
299
|
+
Read the full [security model, migration and recovery guide](docs/SECURITY.md) before deployment. `server.json` is source metadata only; no unverified package is advertised. See [release verification](docs/RELEASE.md).
|
|
300
|
+
|
|
301
|
+
## Verify and measure
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
pytest -v
|
|
305
|
+
python demo_multi_model.py
|
|
306
|
+
python scripts/redaction_report.py
|
|
307
|
+
ruff check .
|
|
308
|
+
ruff format --check .
|
|
309
|
+
pip-audit --require-hashes -r requirements.lock
|
|
310
|
+
python -m build
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The default demo runs an actual MCP stdio producer, REST consumer and separate-key restoration with synthetic data in a temporary vault. It calls no external model. CI checks Python 3.11/3.12 on Ubuntu/macOS, lint, corpus, demo, wheel installation and dependency vulnerabilities. Hash-pinned runtime/development lockfiles support reproducible installation; see the release guide to regenerate them.
|
|
314
|
+
|
|
315
|
+
To test an actual provider, choose `openai`, `deepseek`, `kimi`, `anthropic` or `gemini`, supply a model available to your account and explicitly enable the live contract:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
export RELAYVAULT_LIVE_PROVIDER=deepseek
|
|
319
|
+
export RELAYVAULT_LIVE_MODEL='your-supported-tool-calling-model'
|
|
320
|
+
export RELAYVAULT_LIVE_API_KEY="$DEEPSEEK_API_KEY"
|
|
321
|
+
RELAYVAULT_DEMO_LIVE=1 python demo_multi_model.py
|
|
322
|
+
# Or run the opt-in pytest contract:
|
|
323
|
+
RELAYVAULT_LIVE_TESTS=1 pytest -v -m live
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
This sends synthetic scrubbed data to the chosen provider and may incur charges. The runner sends real tool definitions, requires a checkout call, validates its workspace/name/arguments, dispatches through REST, returns the tool result and checks all expected tokens before local restoration. It fails if tokens are missing, changed or invented. The normal test suite uses a local simulated provider for wire-format tests and explicitly skips the live contract. Passing local tests is not proof of live provider interoperability or user adoption.
|