interlock-agentgov 0.3.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.
- interlock_agentgov-0.3.0/.github/workflows/ci.yml +162 -0
- interlock_agentgov-0.3.0/.gitignore +68 -0
- interlock_agentgov-0.3.0/.python-version +1 -0
- interlock_agentgov-0.3.0/ARCHITECTURE.md +504 -0
- interlock_agentgov-0.3.0/CHANGELOG.md +563 -0
- interlock_agentgov-0.3.0/CONTRIBUTING.md +128 -0
- interlock_agentgov-0.3.0/LICENSE +191 -0
- interlock_agentgov-0.3.0/PKG-INFO +1032 -0
- interlock_agentgov-0.3.0/README.md +1001 -0
- interlock_agentgov-0.3.0/SECURITY.md +146 -0
- interlock_agentgov-0.3.0/demo.tape +69 -0
- interlock_agentgov-0.3.0/docs/DEMO_RUNBOOK.md +191 -0
- interlock_agentgov-0.3.0/docs/RECEIPTS.md +532 -0
- interlock_agentgov-0.3.0/docs/V0_2_BLUEPRINT.md +711 -0
- interlock_agentgov-0.3.0/examples/denial_of_wallet_benchmark.py +581 -0
- interlock_agentgov-0.3.0/examples/live_demo.py +350 -0
- interlock_agentgov-0.3.0/examples/persistence_demo.py +98 -0
- interlock_agentgov-0.3.0/examples/streamlit_dashboard.py +399 -0
- interlock_agentgov-0.3.0/pyproject.toml +122 -0
- interlock_agentgov-0.3.0/scripts/calibrate_result_threshold.py +427 -0
- interlock_agentgov-0.3.0/scripts/generate_arc1_vectors.py +1035 -0
- interlock_agentgov-0.3.0/scripts/generate_real_usage.py +830 -0
- interlock_agentgov-0.3.0/src/agentgov/__init__.py +213 -0
- interlock_agentgov-0.3.0/src/agentgov/adapters/__init__.py +23 -0
- interlock_agentgov-0.3.0/src/agentgov/adapters/crewai.py +417 -0
- interlock_agentgov-0.3.0/src/agentgov/adapters/langchain.py +548 -0
- interlock_agentgov-0.3.0/src/agentgov/cli.py +510 -0
- interlock_agentgov-0.3.0/src/agentgov/cognitive.py +1385 -0
- interlock_agentgov-0.3.0/src/agentgov/core.py +3860 -0
- interlock_agentgov-0.3.0/src/agentgov/dummy.py +109 -0
- interlock_agentgov-0.3.0/src/agentgov/exceptions.py +545 -0
- interlock_agentgov-0.3.0/src/agentgov/interceptor.py +1092 -0
- interlock_agentgov-0.3.0/src/agentgov/postgres.py +1185 -0
- interlock_agentgov-0.3.0/src/agentgov/proxy.py +244 -0
- interlock_agentgov-0.3.0/src/agentgov/py.typed +0 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/__init__.py +115 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/_ed25519.py +109 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/_lines.py +54 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/canonical.py +167 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/log.py +422 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/merkle.py +228 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/rows.py +172 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/schema.py +1272 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/signing.py +281 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/verify.py +320 -0
- interlock_agentgov-0.3.0/src/agentgov/receipts/witness.py +285 -0
- interlock_agentgov-0.3.0/src/agentgov/reconciliation.py +959 -0
- interlock_agentgov-0.3.0/src/agentgov/storage.py +1033 -0
- interlock_agentgov-0.3.0/src/agentgov/streaming.py +646 -0
- interlock_agentgov-0.3.0/tests/__init__.py +0 -0
- interlock_agentgov-0.3.0/tests/conftest.py +50 -0
- interlock_agentgov-0.3.0/tests/receipt_scenarios.py +314 -0
- interlock_agentgov-0.3.0/tests/test_adapters.py +632 -0
- interlock_agentgov-0.3.0/tests/test_budget_manager.py +376 -0
- interlock_agentgov-0.3.0/tests/test_cognitive_breaker.py +1064 -0
- interlock_agentgov-0.3.0/tests/test_concurrency.py +431 -0
- interlock_agentgov-0.3.0/tests/test_core_guarantees.py +1484 -0
- interlock_agentgov-0.3.0/tests/test_dx.py +796 -0
- interlock_agentgov-0.3.0/tests/test_fleet_concurrency.py +432 -0
- interlock_agentgov-0.3.0/tests/test_hardening.py +572 -0
- interlock_agentgov-0.3.0/tests/test_interceptor.py +465 -0
- interlock_agentgov-0.3.0/tests/test_invariants.py +236 -0
- interlock_agentgov-0.3.0/tests/test_ledger.py +267 -0
- interlock_agentgov-0.3.0/tests/test_persistence.py +404 -0
- interlock_agentgov-0.3.0/tests/test_postgres_joined.py +476 -0
- interlock_agentgov-0.3.0/tests/test_postgres_store.py +715 -0
- interlock_agentgov-0.3.0/tests/test_readme_snippets.py +258 -0
- interlock_agentgov-0.3.0/tests/test_receipt_vectors.py +308 -0
- interlock_agentgov-0.3.0/tests/test_receipts_core.py +421 -0
- interlock_agentgov-0.3.0/tests/test_receipts_documents.py +506 -0
- interlock_agentgov-0.3.0/tests/test_receipts_log.py +785 -0
- interlock_agentgov-0.3.0/tests/test_receipts_verify.py +775 -0
- interlock_agentgov-0.3.0/tests/test_reconciliation.py +652 -0
- interlock_agentgov-0.3.0/tests/test_runaway.py +207 -0
- interlock_agentgov-0.3.0/tests/test_scaffold.py +30 -0
- interlock_agentgov-0.3.0/uv.lock +2340 -0
- interlock_agentgov-0.3.0/vectors/arc1/README.md +66 -0
- interlock_agentgov-0.3.0/vectors/arc1/canonical.json +86 -0
- interlock_agentgov-0.3.0/vectors/arc1/ed25519.json +40 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/alg-confusion.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/checkpoint-forged.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/duplicate-key.bundle.json +152 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/field-modified.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/float-amount.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/forged-signature.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/leaf-moved.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/reordered-log.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/row-modified.rows.json +55 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/row-moved.rows.json +55 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/split-view.bundle.json +145 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/unknown-field.bundle.json +152 -0
- interlock_agentgov-0.3.0/vectors/arc1/invalid/unwitnessed.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/keys/internal.hmac +1 -0
- interlock_agentgov-0.3.0/vectors/arc1/keys/issuer.pub +1 -0
- interlock_agentgov-0.3.0/vectors/arc1/keys/issuer.seed +1 -0
- interlock_agentgov-0.3.0/vectors/arc1/keys/witness.pub +1 -0
- interlock_agentgov-0.3.0/vectors/arc1/keys/witness.seed +1 -0
- interlock_agentgov-0.3.0/vectors/arc1/log/consistency.json +33 -0
- interlock_agentgov-0.3.0/vectors/arc1/log/receipts.jsonl +7 -0
- interlock_agentgov-0.3.0/vectors/arc1/log/receipts.jsonl.checkpoints +3 -0
- interlock_agentgov-0.3.0/vectors/arc1/manifest.json +243 -0
- interlock_agentgov-0.3.0/vectors/arc1/merkle.json +677 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/committed-refund.bundle.json +151 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/committed-refund.rows.json +55 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/halted-scope.bundle.json +145 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/internal-hmac.receipt.json +116 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/recovered-commit.bundle.json +149 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/refused-tenant-wipe.bundle.json +154 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/refused-tenant-wipe.rows.json +66 -0
- interlock_agentgov-0.3.0/vectors/arc1/valid/scoped-repair.bundle.json +146 -0
- interlock_agentgov-0.3.0/vectors/arc1/witness/cosignatures.jsonl +2 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
name: test (py${{ matrix.python-version }}, ${{ matrix.os }})
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.11", "3.12"]
|
|
24
|
+
os: [ubuntu-latest]
|
|
25
|
+
include:
|
|
26
|
+
# The advisory lock, the reaped worker thread, and the subprocess
|
|
27
|
+
# restart tests are all OS-dependent. Cover a second platform on the
|
|
28
|
+
# current Python so a macOS-only or Linux-only regression is caught.
|
|
29
|
+
- python-version: "3.12"
|
|
30
|
+
os: macos-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
|
|
34
|
+
- name: Install uv
|
|
35
|
+
uses: astral-sh/setup-uv@v5
|
|
36
|
+
with:
|
|
37
|
+
enable-cache: true
|
|
38
|
+
|
|
39
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
40
|
+
run: uv python install ${{ matrix.python-version }}
|
|
41
|
+
|
|
42
|
+
- name: Install the project
|
|
43
|
+
run: uv sync --frozen --python ${{ matrix.python-version }}
|
|
44
|
+
|
|
45
|
+
- name: Lint (ruff check)
|
|
46
|
+
run: uv run ruff check .
|
|
47
|
+
|
|
48
|
+
- name: Format (ruff format --check)
|
|
49
|
+
run: uv run ruff format --check .
|
|
50
|
+
|
|
51
|
+
- name: Type-check the package (mypy --strict)
|
|
52
|
+
run: uv run mypy src/
|
|
53
|
+
|
|
54
|
+
- name: Type-check tests and examples (mypy --strict)
|
|
55
|
+
run: uv run mypy --strict tests/ examples/
|
|
56
|
+
|
|
57
|
+
- name: Tests with coverage
|
|
58
|
+
run: uv run pytest -v --cov=agentgov --cov-report=term-missing --cov-report=xml
|
|
59
|
+
|
|
60
|
+
# postgres.py runs only against a server, so this job, which has none,
|
|
61
|
+
# leaves it out (97% measured without it); the postgres job below
|
|
62
|
+
# measures everything, it included.
|
|
63
|
+
- name: Enforce coverage floor
|
|
64
|
+
run: uv run coverage report --fail-under=95 --omit=src/agentgov/postgres.py
|
|
65
|
+
|
|
66
|
+
- name: Run the benchmarks end to end
|
|
67
|
+
run: |
|
|
68
|
+
uv run python examples/denial_of_wallet_benchmark.py --seconds 1
|
|
69
|
+
uv run python examples/persistence_demo.py
|
|
70
|
+
uv run python examples/live_demo.py --out /tmp/agentgov-demo --no-color
|
|
71
|
+
uv run agentgov verify /tmp/agentgov-demo/governor.db
|
|
72
|
+
|
|
73
|
+
- name: Verify the ARC1 reference vectors with the installed CLI
|
|
74
|
+
working-directory: vectors/arc1
|
|
75
|
+
run: |
|
|
76
|
+
uv run agentgov verify-receipt valid/committed-refund.bundle.json \
|
|
77
|
+
--pubkey keys/issuer.pub \
|
|
78
|
+
--witness witness/cosignatures.jsonl --witness-pubkey keys/witness.pub \
|
|
79
|
+
--rows valid/committed-refund.rows.json
|
|
80
|
+
# A forged signature must exit 4 (SIGNATURE), not merely non-zero.
|
|
81
|
+
code=0
|
|
82
|
+
uv run agentgov verify-receipt invalid/forged-signature.bundle.json \
|
|
83
|
+
--pubkey keys/issuer.pub || code=$?
|
|
84
|
+
test "$code" -eq 4
|
|
85
|
+
|
|
86
|
+
postgres:
|
|
87
|
+
name: test against PostgreSQL ${{ matrix.postgres }} (py3.12)
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
strategy:
|
|
90
|
+
fail-fast: false
|
|
91
|
+
matrix:
|
|
92
|
+
# 14 is the oldest the shared ledger is written for; 16 is current.
|
|
93
|
+
postgres: ["14", "16"]
|
|
94
|
+
services:
|
|
95
|
+
postgres:
|
|
96
|
+
image: postgres:${{ matrix.postgres }}
|
|
97
|
+
env:
|
|
98
|
+
POSTGRES_USER: agentgov_admin
|
|
99
|
+
POSTGRES_PASSWORD: agentgov
|
|
100
|
+
POSTGRES_DB: postgres
|
|
101
|
+
ports:
|
|
102
|
+
- 5432:5432
|
|
103
|
+
options: >-
|
|
104
|
+
--health-cmd "pg_isready -U agentgov_admin"
|
|
105
|
+
--health-interval 2s
|
|
106
|
+
--health-timeout 5s
|
|
107
|
+
--health-retries 30
|
|
108
|
+
# The same suite as the test job, with the PostgreSQL tests required
|
|
109
|
+
# rather than skippable: a service that failed to come up fails the job
|
|
110
|
+
# instead of passing it by skipping the fleet's concurrency proofs.
|
|
111
|
+
env:
|
|
112
|
+
AGENTGOV_TEST_POSTGRES_DSN: postgresql://agentgov_admin:agentgov@localhost:5432/postgres
|
|
113
|
+
AGENTGOV_REQUIRE_POSTGRES: "1"
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/checkout@v4
|
|
116
|
+
|
|
117
|
+
- name: Install uv
|
|
118
|
+
uses: astral-sh/setup-uv@v5
|
|
119
|
+
with:
|
|
120
|
+
enable-cache: true
|
|
121
|
+
|
|
122
|
+
- name: Set up Python 3.12
|
|
123
|
+
run: uv python install 3.12
|
|
124
|
+
|
|
125
|
+
- name: Install the project
|
|
126
|
+
run: uv sync --frozen --python 3.12
|
|
127
|
+
|
|
128
|
+
- name: Tests with coverage, PostgreSQL required
|
|
129
|
+
run: uv run pytest -v --cov=agentgov --cov-report=term-missing
|
|
130
|
+
|
|
131
|
+
# Every module, postgres.py included (97% measured).
|
|
132
|
+
- name: Enforce coverage floor
|
|
133
|
+
run: uv run coverage report --fail-under=95
|
|
134
|
+
|
|
135
|
+
build:
|
|
136
|
+
name: build (wheel + sdist)
|
|
137
|
+
runs-on: ubuntu-latest
|
|
138
|
+
steps:
|
|
139
|
+
- uses: actions/checkout@v4
|
|
140
|
+
|
|
141
|
+
- name: Install uv
|
|
142
|
+
uses: astral-sh/setup-uv@v5
|
|
143
|
+
with:
|
|
144
|
+
enable-cache: true
|
|
145
|
+
|
|
146
|
+
- name: Build, failing on packaging warnings
|
|
147
|
+
# `uv build` reports metadata problems (deprecated license fields,
|
|
148
|
+
# bad classifiers) as warnings but still exits 0, so a clean release
|
|
149
|
+
# has to assert on them. It writes all progress to stderr, so match
|
|
150
|
+
# the warnings themselves rather than treating any stderr as failure.
|
|
151
|
+
run: |
|
|
152
|
+
set -o pipefail
|
|
153
|
+
uv build 2>&1 | tee build.log
|
|
154
|
+
if grep -i '^warning' build.log; then
|
|
155
|
+
echo "::error::uv build emitted packaging warnings"
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
- uses: actions/upload-artifact@v4
|
|
160
|
+
with:
|
|
161
|
+
name: dist
|
|
162
|
+
path: dist/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Pitch, positioning and brainstorming material. This repository is public and
|
|
2
|
+
# its documentation is engineering mechanics only. Keep strategy notes out of it.
|
|
3
|
+
CONCEPT.md
|
|
4
|
+
CONCEPT*.md
|
|
5
|
+
PITCH*.md
|
|
6
|
+
*_pitch.md
|
|
7
|
+
NOTES.md
|
|
8
|
+
BRAINSTORM*.md
|
|
9
|
+
|
|
10
|
+
# Secrets. Never commit an API key.
|
|
11
|
+
.env
|
|
12
|
+
.env.*
|
|
13
|
+
!.env.example
|
|
14
|
+
*.pem
|
|
15
|
+
*.key
|
|
16
|
+
|
|
17
|
+
# Live-API benchmark receipts: raw response payloads, cost summaries, SQLite
|
|
18
|
+
# ledgers and metering journals. Regenerate with
|
|
19
|
+
# `uv run python scripts/generate_real_usage.py`.
|
|
20
|
+
benchmarks/live_data/
|
|
21
|
+
|
|
22
|
+
# Live-demo artifacts (`uv run python examples/live_demo.py`)
|
|
23
|
+
demo/
|
|
24
|
+
|
|
25
|
+
# SQLite ledgers and their sidecars, wherever they land
|
|
26
|
+
*.db
|
|
27
|
+
*.db-wal
|
|
28
|
+
*.db-shm
|
|
29
|
+
*.db.lock
|
|
30
|
+
*.sqlite
|
|
31
|
+
*.sqlite3
|
|
32
|
+
|
|
33
|
+
# Python build and bytecode
|
|
34
|
+
__pycache__/
|
|
35
|
+
*.pyc
|
|
36
|
+
*.pyo
|
|
37
|
+
*.py[oc]
|
|
38
|
+
build/
|
|
39
|
+
dist/
|
|
40
|
+
wheels/
|
|
41
|
+
*.egg-info
|
|
42
|
+
|
|
43
|
+
# Virtual environments
|
|
44
|
+
.venv
|
|
45
|
+
venv/
|
|
46
|
+
|
|
47
|
+
# Test and tooling caches
|
|
48
|
+
.coverage
|
|
49
|
+
coverage.xml
|
|
50
|
+
htmlcov/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
.ruff_cache/
|
|
53
|
+
.mypy_cache/
|
|
54
|
+
|
|
55
|
+
# VHS-rendered terminal recordings (regenerate with `vhs demo.tape`)
|
|
56
|
+
demo.gif
|
|
57
|
+
|
|
58
|
+
# Editors
|
|
59
|
+
.idea/
|
|
60
|
+
.vscode/
|
|
61
|
+
*.swp
|
|
62
|
+
|
|
63
|
+
# OS metadata
|
|
64
|
+
.DS_Store
|
|
65
|
+
Thumbs.db
|
|
66
|
+
|
|
67
|
+
# Logs
|
|
68
|
+
*.log
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|