swiftapi-python 1.2.1__tar.gz → 1.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.
Files changed (73) hide show
  1. swiftapi_python-1.3.0/CHANGELOG.md +21 -0
  2. swiftapi_python-1.3.0/MANIFEST.in +6 -0
  3. swiftapi_python-1.3.0/MIGRATION_1_2_2.md +37 -0
  4. swiftapi_python-1.3.0/PKG-INFO +147 -0
  5. swiftapi_python-1.3.0/PRODUCT_TRUTH_MAP.md +50 -0
  6. swiftapi_python-1.3.0/README.md +111 -0
  7. swiftapi_python-1.3.0/benchmarks/corpora.lock.json +59 -0
  8. swiftapi_python-1.3.0/benchmarks/sources.lock.json +17 -0
  9. swiftapi_python-1.3.0/docs/ACTION_ENVELOPES.md +15 -0
  10. swiftapi_python-1.3.0/docs/BENCHMARKING.md +25 -0
  11. swiftapi_python-1.3.0/docs/BYOK.md +16 -0
  12. swiftapi_python-1.3.0/docs/CLAUDE_CODE.md +18 -0
  13. swiftapi_python-1.3.0/docs/CODEX.md +28 -0
  14. swiftapi_python-1.3.0/docs/CONCEPTS.md +17 -0
  15. swiftapi_python-1.3.0/docs/CONDITIONS.md +15 -0
  16. swiftapi_python-1.3.0/docs/LOCAL_BRAKE.md +17 -0
  17. swiftapi_python-1.3.0/docs/NATIVE_NONCONTINUATION.md +17 -0
  18. swiftapi_python-1.3.0/docs/PYTHON_SDK.md +19 -0
  19. swiftapi_python-1.3.0/docs/QUICKSTART.md +20 -0
  20. swiftapi_python-1.3.0/docs/RECEIPTS.md +17 -0
  21. swiftapi_python-1.3.0/docs/REMOTE_SWIFTAPI.md +16 -0
  22. swiftapi_python-1.3.0/docs/RESEARCH_PROVENANCE.md +23 -0
  23. swiftapi_python-1.3.0/docs/SECURITY_MODEL.md +19 -0
  24. swiftapi_python-1.3.0/docs/THREAT_MODEL.md +19 -0
  25. swiftapi_python-1.3.0/docs/VERIFICATION.md +17 -0
  26. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/pyproject.toml +87 -71
  27. swiftapi_python-1.3.0/scripts/fetch_benchmarks.py +48 -0
  28. swiftapi_python-1.3.0/scripts/fetch_corpora.py +28 -0
  29. swiftapi_python-1.3.0/scripts/qualify_artifacts.py +108 -0
  30. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/__init__.py +75 -96
  31. swiftapi_python-1.3.0/swiftapi/__main__.py +2 -0
  32. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/anthropic.py +236 -222
  33. swiftapi_python-1.3.0/swiftapi/brake/__init__.py +45 -0
  34. swiftapi_python-1.3.0/swiftapi/brake/benchmarks.py +111 -0
  35. swiftapi_python-1.3.0/swiftapi/brake/broker.py +274 -0
  36. swiftapi_python-1.3.0/swiftapi/brake/core.py +420 -0
  37. swiftapi_python-1.3.0/swiftapi/brake/install.py +268 -0
  38. swiftapi_python-1.3.0/swiftapi/brake/mcp.py +160 -0
  39. swiftapi_python-1.3.0/swiftapi/brake/observations.py +61 -0
  40. swiftapi_python-1.3.0/swiftapi/brake/qualification.py +116 -0
  41. swiftapi_python-1.3.0/swiftapi/brake/remote.py +90 -0
  42. swiftapi_python-1.3.0/swiftapi/cli.py +150 -0
  43. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/client.py +328 -307
  44. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/enforcement.py +281 -280
  45. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/openai.py +243 -225
  46. swiftapi_python-1.3.0/swiftapi/py.typed +0 -0
  47. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/verifier.py +182 -130
  48. swiftapi_python-1.3.0/swiftapi_python.egg-info/PKG-INFO +147 -0
  49. swiftapi_python-1.3.0/swiftapi_python.egg-info/SOURCES.txt +67 -0
  50. swiftapi_python-1.3.0/swiftapi_python.egg-info/entry_points.txt +2 -0
  51. swiftapi_python-1.3.0/swiftapi_python.egg-info/requires.txt +14 -0
  52. swiftapi_python-1.3.0/tests/conftest.py +30 -0
  53. swiftapi_python-1.3.0/tests/test_brake.py +399 -0
  54. swiftapi_python-1.3.0/tests/test_brake_benchmarks_remote.py +88 -0
  55. swiftapi_python-1.3.0/tests/test_legacy_security.py +324 -0
  56. swiftapi_python-1.3.0/tests/test_release_contract.py +92 -0
  57. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_responses.py +79 -77
  58. swiftapi_python-1.2.1/PKG-INFO +0 -255
  59. swiftapi_python-1.2.1/README.md +0 -222
  60. swiftapi_python-1.2.1/swiftapi_python.egg-info/PKG-INFO +0 -255
  61. swiftapi_python-1.2.1/swiftapi_python.egg-info/SOURCES.txt +0 -22
  62. swiftapi_python-1.2.1/swiftapi_python.egg-info/requires.txt +0 -10
  63. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/LICENSE +0 -0
  64. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/setup.cfg +0 -0
  65. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/exceptions.py +0 -0
  66. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi/utils.py +0 -0
  67. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi_python.egg-info/dependency_links.txt +0 -0
  68. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/swiftapi_python.egg-info/top_level.txt +0 -0
  69. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_anthropic.py +0 -0
  70. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_client.py +0 -0
  71. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_exceptions.py +0 -0
  72. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_openai.py +0 -0
  73. {swiftapi_python-1.2.1 → swiftapi_python-1.3.0}/tests/test_verifier.py +0 -0
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## 1.3.0 — 2026-09-22
4
+
5
+ Add local prerequisite evaluation, canonical action envelopes, Ed25519 decisions
6
+ and execution receipts, durable replay protection, an exact sandbox marker broker,
7
+ Codex/Claude MCP installation with dry-run/backups/uninstall, and local qualification.
8
+ Add an optional pinned-key remote decision client with sync and async authorization.
9
+ Add pinned defensive-framework fetches and denominator-preserving evaluation import.
10
+
11
+ Harden inherited authority and provider paths: verify signed exact-action approval,
12
+ consume attestations before consequences, refuse redirects, fail closed on unknown
13
+ revocation, and preserve provider termination metadata without synthetic Void labels.
14
+
15
+ Research artifacts, native-EOS model claims, and unpublished local 2.0 work are
16
+ preserved separately. This release does not claim to reproduce or ship those models.
17
+
18
+ ## 1.2.2 — 2026-02-25
19
+
20
+ Historical PyPI ancestor. Its wheel and sdist are immutable; the release audit
21
+ records their published and independently recomputed hashes and exact public API.
@@ -0,0 +1,6 @@
1
+ include LICENSE README.md MIGRATION_1_2_2.md CHANGELOG.md PRODUCT_TRUTH_MAP.md
2
+ recursive-include docs *.md
3
+ recursive-include tests *.py
4
+ recursive-include scripts *.py
5
+ recursive-include benchmarks *.json
6
+ recursive-include swiftapi py.typed
@@ -0,0 +1,37 @@
1
+ # Migration from 1.2.2 to 1.3.0
2
+
3
+ 1.2.2 remains immutable provenance. This is an additive minor release with
4
+ explicit security corrections. The public imports, constructor call forms,
5
+ remote endpoints, and callback/decorator/context-manager usage are preserved.
6
+ No unpublished 2.0.0 native-runtime code or research model is shipped here.
7
+
8
+ | Historical 1.2.2 | 1.3.0 |
9
+ | --- | --- |
10
+ | `SwiftAPI`, `Enforcement`, `enforce`, provider wrappers and verifier exports | Preserved; new local API and CLI added |
11
+ | `check_revocation` returned false after authority/network failure | Failure raises; paranoid execution stops |
12
+ | Guard checked a signature without comparing the exact requested action | Signed approval, action type and fingerprint must match |
13
+ | No local one-use attestation ledger | SQLite issuer/JTI claim before guarded callbacks or attested provider calls |
14
+ | Provider wrappers accepted unsigned approval and bound incomplete kwargs | Verify signatures and bind the complete outbound payload |
15
+ | Wrapper-generated empty denial called `void` | Empty denial retained for compatibility; `classification=GATE_BLOCK`, stop metadata absent |
16
+ | Synthetic `stop`/`end_turn` generated by response constructors | Provider stop metadata is retained only when supplied by the provider |
17
+ | Authority redirects could forward headers | Redirects refused; HTTPS authority URLs required |
18
+ | No CLI/local authority | `swiftapi doctor`, `brake`, MCP installation, qualification and receipt verification |
19
+
20
+ If you tested `finish_reason == "void"` or `stop_reason == "void"`, switch to
21
+ `response.classification == "GATE_BLOCK"`. A locally blocked call never reached
22
+ the provider. Do not interpret it as model-native noncontinuation.
23
+
24
+ Replay state defaults to `~/.local/share/swiftapi/replay.sqlite3`; set
25
+ `SWIFTAPI_HOME` to a private dedicated directory for each trusted deployment.
26
+ Keep this state durable and shared across workers that share an authority.
27
+ Deleting/resetting it resets replay protection. Do not share an unsafe directory.
28
+
29
+ Callbacks and decorators retain the historical descriptive-action API. They do
30
+ not inspect arbitrary Python code or dynamically bind decorator arguments.
31
+ Use broker operations for exact parameter construction and execution. Legacy
32
+ `paranoid=False` still skips online revocation; choose `paranoid=True` for live
33
+ revocation checks. Provider compatibility wrappers authenticate authorization
34
+ but do not claim online revocation checks or the full upstream SDK surface.
35
+
36
+ The new remote decision protocol is separate from the legacy `/verify` protocol.
37
+ There is no assertion that swiftapi.ai already implements it.
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: swiftapi-python
3
+ Version: 1.3.0
4
+ Summary: SwiftAPI Python SDK - AI Action Verification Gateway
5
+ Author-email: Rayan Pal <rayan@swiftapi.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://swiftapi.ai
8
+ Project-URL: Documentation, https://getswiftapi.com/docs
9
+ Keywords: swiftapi,ai,verification,attestation,security,governance,enforcement
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Security
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: requests<3,>=2.32.3
25
+ Requires-Dist: pynacl<2,>=1.5.0
26
+ Requires-Dist: colorama<1,>=0.4.6
27
+ Requires-Dist: tomli<3,>=2; python_version < "3.11"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
30
+ Requires-Dist: hypothesis<7,>=6; extra == "dev"
31
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
32
+ Requires-Dist: black>=23.0.0; extra == "dev"
33
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
34
+ Requires-Dist: types-requests<3,>=2.32.3; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # SwiftAPI Python SDK
38
+
39
+ A prerequisite before a protected action. Local Swift Brake verifies explicit
40
+ permission, executes its registered capability once, and creates signed receipts.
41
+ Codex or Claude Code remains the coding agent. No second model is involved.
42
+
43
+ ```bash
44
+ pip install swiftapi-python
45
+ swiftapi doctor
46
+ swiftapi brake test
47
+ swiftapi brake install --dry-run
48
+ swiftapi brake install
49
+ ```
50
+
51
+ Python 3.9+, macOS and Linux. The local test needs no account, API key, model,
52
+ or cloud service. Restart the coding agent after installing the MCP integration.
53
+
54
+ ## Try the brake
55
+
56
+ ```bash
57
+ swiftapi brake propose hello.txt "Hello from Swift Brake"
58
+ # Copy the returned request_id into the following commands.
59
+ swiftapi brake execute REQUEST_ID
60
+ # GATE_BLOCK: no marker is written.
61
+ swiftapi brake authorize REQUEST_ID
62
+ swiftapi brake execute REQUEST_ID
63
+ # AUTHORIZED_EXECUTION: exact marker bytes are written once.
64
+ swiftapi brake execute REQUEST_ID
65
+ # GATE_BLOCK: the authorization cannot execute again.
66
+ swiftapi status
67
+ swiftapi receipts
68
+ swiftapi verify RECEIPT_PATH --public-key PUBLIC_KEY_PATH
69
+ ```
70
+
71
+ `status` prints the sandbox and public-key path. `execute` returns the receipt
72
+ path. The operator authorizes in a separate terminal; authorization is deliberately
73
+ absent from the MCP tool surface. A signature requires an independently trusted
74
+ verification key, never a key blindly accepted from the receipt itself.
75
+
76
+ `swiftapi brake` presents `swiftapi>` and delegates ordinary input to the existing
77
+ Codex CLI. `swiftapi brake --agent claude` uses Claude Code. These host calls use
78
+ your existing account; the local test itself makes no model calls.
79
+
80
+ ## Python
81
+
82
+ The old imports remain available: `from swiftapi import SwiftAPI, Enforcement`.
83
+ The new local API does not require a remote account:
84
+
85
+ ```python
86
+ from pathlib import Path
87
+ from tempfile import mkdtemp
88
+ from swiftapi import ActionEnvelope, BindingCondition, LocalAuthority, LocalGuard
89
+
90
+ action = ActionEnvelope("example.append", {"value": "verified"}, "Append one value")
91
+ state = {"operator_approved": True} # Supplied by trusted application code.
92
+ condition = BindingCondition(action.action_hash, state)
93
+ guard = LocalGuard(LocalAuthority(), Path(mkdtemp()) / "ledger")
94
+ values = []
95
+ guard.run(
96
+ lambda: values.append("verified"),
97
+ action=action.capability, params=action.params, intent=action.intent,
98
+ condition=condition, state=state,
99
+ )
100
+ assert values == ["verified"]
101
+ ```
102
+
103
+ A callback's code must actually implement its supplied action description.
104
+ For an untrusted agent, use a registered broker operation that constructs and
105
+ executes the same canonical parameters. The bundled MCP operation creates a new
106
+ small UTF-8 marker in its own sandbox; it cannot run a shell or overwrite files.
107
+
108
+ ## What is enforced
109
+
110
+ An authorization binds an action hash, capability, condition hash, state hash,
111
+ nonce, issue time, and expiry. Ed25519 verification and a durable SQLite replay
112
+ claim happen before execution. Execution is never retried. Missing, malformed,
113
+ forged, expired, replayed, or mismatched authorization fails closed.
114
+
115
+ This guarantee applies to mediated capabilities. Arbitrary host tools are outside
116
+ the broker. Local same-user key storage supports development and CI; a malicious
117
+ process able to read the signer, change the gate, or mutate the ledger can bypass
118
+ that trust boundary. Production credentials and signing authority require process
119
+ or account isolation from untrusted agent code. Instructions and hooks are not a
120
+ universal security boundary.
121
+
122
+ ## Research is measured separately
123
+
124
+ `GATE_BLOCK` is deterministic enforcement, not native EOS. Successful empty
125
+ provider output is classified as a black-box `PROVIDER_VOID` with V0/V1/V2/VU
126
+ subtypes. Only exposed native token evidence can qualify as `NATIVE_VOID`.
127
+ The package does not download or retrain research models. The frozen
128
+ [PCCG-2 release](https://getswiftapi.com/pccg-2) and
129
+ [research library](https://getswiftapi.com/research) preserve the empirical,
130
+ causal, theoretical, and protocol boundaries.
131
+
132
+ ## Documentation
133
+
134
+ Start with [Quickstart](docs/QUICKSTART.md). See [concepts](docs/CONCEPTS.md),
135
+ [local brake](docs/LOCAL_BRAKE.md), [Codex](docs/CODEX.md),
136
+ [Claude Code](docs/CLAUDE_CODE.md), [Python SDK](docs/PYTHON_SDK.md),
137
+ [conditions](docs/CONDITIONS.md), [action envelopes](docs/ACTION_ENVELOPES.md),
138
+ [receipts](docs/RECEIPTS.md), [verification](docs/VERIFICATION.md),
139
+ [remote authority](docs/REMOTE_SWIFTAPI.md), [BYOK](docs/BYOK.md),
140
+ [security](docs/SECURITY_MODEL.md), [threat model](docs/THREAT_MODEL.md),
141
+ [native noncontinuation](docs/NATIVE_NONCONTINUATION.md),
142
+ [benchmarking](docs/BENCHMARKING.md), and [provenance](docs/RESEARCH_PROVENANCE.md).
143
+
144
+ [Migration from 1.2.2](MIGRATION_1_2_2.md) documents security corrections and
145
+ termination-metadata changes. Historical 1.2.2 bytes remain immutable on PyPI.
146
+
147
+ MIT license. Research and software by Rayan Pal / SwiftAPI Labs.
@@ -0,0 +1,50 @@
1
+ # Product truth map — 2026-09-22
2
+
3
+ Source record: live getswiftapi.com pages fetched before code mutation, linked
4
+ DOIs/repositories followed, exact PyPI 1.2.2 wheel/sdist verified. Audit snapshots
5
+ and source reconciliation are retained in the enclosing consolidation/audit tree.
6
+ Status distinguishes implementation from research and protocol claims; a source
7
+ inspection is not a fresh replay of frozen research or a production service audit.
8
+
9
+ | Claim / category | Website location | Implementation | Test / evidence / immutable identity | Current status |
10
+ | --- | --- | --- | --- | --- |
11
+ | Native EOS-only content/permission separation, 101 parameters | /, /pccg-2, /research | Frozen research model, not this SDK | HF PCCG-2 revision a3b952458a46b5547ba3cec7d03a37b395bed03a; DOI 22730710; 2048 FINAL, 40+40 causal, frozen non-EOS hash 5f42fcb08c73af4914a711b524ae7130d671ec9504ecdfa699e8f478094713ec | RESEARCH_ONLY |
12
+ | Full accepted six-digit domain certificate | /pccg-2 | Published finite-precision proof/checker, not 810 billion new trials | DOI 22730710 manuscript supplement; specific recorded-content and arithmetic assumptions | RESEARCH_ONLY |
13
+ | PCCG-1 reasoning-prefix-preserving GO/EOS intervention | /pccg, /research | Separate trained Qwen3-4B release | GitHub d08b157ac9273974b75d7ada2a894a1afe86e3f2; HF 5f3b70d51f068a7a8a108b99f66b2fdfd15e25ce; DOI 22681787 | RESEARCH_ONLY |
14
+ | 31,430-trial matrix, 11,658 Void outcomes, 0/4290 matched control Voids | /, /research | Frozen provider records, not a universal security guarantee | DOI 21696066; void-matrix-complete-analysis v1.0.0-evidence-analysis; published definition retained | RESEARCH_ONLY |
15
+ | 12,160 cross-script trials, 7253 exact artifacts | /, /research | Frozen GPT-5.4 records | DOI 21799525; gpt-5.4-shrt-cross-script-evidence | RESEARCH_ONLY |
16
+ | Earlier 180/180 null trials with non-null controls | /research | Frozen two-model protocol | DOI 18976656; void-convergence repository | RESEARCH_ONLY |
17
+ | Kimi native/provider receipt terminology | /kimi-receipts | Public case evidence and receipt verifier | Linked captured provider records; no inference of internal EOS from stop | RESEARCH_ONLY |
18
+ | Binding condition / proposed AGI criterion | /research, /public-agi-criterion | Conceptual criterion, not a software security proof | DOI 19211116 | DOCUMENTED_ONLY |
19
+ | Textual emergence, earlier frameworks and chronology | /research | Published research history | DOIs 17856031, 18395519, 18750330, 18796600; links preserved | RESEARCH_ONLY |
20
+ | Attestation protocol, offline Ed25519 verification | /docs, /verify, /research | legacy verifier.py; brake/core.py | test_verifier.py; test_brake.py; DOI 18012025; pinned historical key | IMPLEMENTED |
21
+ | Revocation and replay defense advertised for SDK | /, /docs | client.check_revocation; Enforcement; verifier.claim_attestation | test_legacy_security.py; test_release_contract.py; historical revocation failed open and lacked local replay, corrected here | IMPLEMENTED |
22
+ | No action executes without verification | historical PyPI README; /docs | Enforcement callbacks and registered broker only | Forged/mismatched/replay tests; wording narrowed to mediated capabilities, no arbitrary-root guarantee | PARTIAL |
23
+ | Scoped keys, policies, grants, audit endpoints | /, /docs | existing backend main.py routes and legacy SDK client | Backend source inspected; no authenticated production write was performed | PARTIAL |
24
+ | API/proxy/admission/runtime integrations | /docs | existing backend, CLI/MCP and admission-controller trees | Existing code present; not all runtime deployments qualified in this release | PARTIAL |
25
+ | Public self-service cloud key issuance unavailable | /docs | Existing scoped authority provisioning flow | Live documentation explicitly states scoped evaluation/partnership access; local package requires no account | DOCUMENTED_ONLY |
26
+ | BYOK/provider credentials remain with provider | /docs | existing compatibility wrappers; new MCP path has no provider request | test_openai.py, test_anthropic.py, HTTPS/no-redirect regressions; no live provider call required | IMPLEMENTED |
27
+ | Optional attested-provider service mode | new BYOK documentation | Existing legacy attestation wrappers; no forced provider proxy | Service-specific new mode not deployed by this release | DOCUMENTED_ONLY |
28
+ | Local prerequisite-conditioned brake | new /brake, README | brake/core.py, broker.py, cli.py | 11-case local qualification plus adversarial/property tests | IMPLEMENTED |
29
+ | Canonical action/state/condition binding | new product docs | ActionEnvelope, BindingCondition, verify_decision | Hash substitution, type sensitivity, mutation and serialization property tests | IMPLEMENTED |
30
+ | Signed short-lived one-use authorization | new product docs | LocalAuthority, ReplayLedger | Forgery, wrong trust key, expiry, concurrency and fresh-process replay tests | IMPLEMENTED |
31
+ | Durable receipts independently verified | new /brake | decision/execution schemas and CLI verify | Signed-envelope verification in isolated process; no assertion that signature proves real-world effect | IMPLEMENTED |
32
+ | Codex/Claude normal prompts with local tools | new /brake | stdio MCP, managed config and instruction installers | Installer preservation/reversal tests; live host qualification reported separately in release manifest | IMPLEMENTED |
33
+ | Hooks form universal security boundary | not a valid supported claim | No mandatory-hook claim in this release | Official host docs identify coverage/trust limits; arbitrary tools remain outside broker | STALE |
34
+ | Native model runtime as installable 2.0.0 product | local unpublished /void draft; live /void returns 404 | Unpublished home SDK work preserved separately | Missing public release manifest; isolated website safely returns 404 until a qualified release exists | MISSING |
35
+ | Defensive benchmark adapter | new benchmark docs | brake/benchmarks.py and pinned upstream fetch script | Case-denominator and failure-retention tests; frameworks fetched at exact locked commits; model evaluations not run | IMPLEMENTED |
36
+ | Zero unauthorized escape in production | requested invariant, no universal public result | Enforced for broker requests under documented trust assumptions | Local fixture escape count only; production adapters/credential isolation require qualification | PARTIAL |
37
+ | Patent filing record | /patent | Public record and document links only | No legal scope, validity, or enforcement inference made by SDK release | DOCUMENTED_ONLY |
38
+
39
+ All bare DOI numbers above are under `10.5281/zenodo.`. The full URLs and page
40
+ responses are in the audit index. The archived matrix ZIP fetch is explicitly
41
+ marked as a retained prefix, not a complete evidence re-verification.
42
+
43
+ ## Source reconciliation
44
+
45
+ The historical import/API tree was compared byte-for-byte with both local SDKs.
46
+ The isolated release starts from the verified 1.2.2 sdist, retains an ancestor
47
+ commit, imports inspected compatible security fixes from the home SDK, and adds
48
+ the deterministic local brake. The unpublished native 2.0.0 tree, Swift Brake
49
+ prototype, backend, research assets and dirty website source remain untouched.
50
+ Website changes are isolated and reviewable in a separate checkout and patch.
@@ -0,0 +1,111 @@
1
+ # SwiftAPI Python SDK
2
+
3
+ A prerequisite before a protected action. Local Swift Brake verifies explicit
4
+ permission, executes its registered capability once, and creates signed receipts.
5
+ Codex or Claude Code remains the coding agent. No second model is involved.
6
+
7
+ ```bash
8
+ pip install swiftapi-python
9
+ swiftapi doctor
10
+ swiftapi brake test
11
+ swiftapi brake install --dry-run
12
+ swiftapi brake install
13
+ ```
14
+
15
+ Python 3.9+, macOS and Linux. The local test needs no account, API key, model,
16
+ or cloud service. Restart the coding agent after installing the MCP integration.
17
+
18
+ ## Try the brake
19
+
20
+ ```bash
21
+ swiftapi brake propose hello.txt "Hello from Swift Brake"
22
+ # Copy the returned request_id into the following commands.
23
+ swiftapi brake execute REQUEST_ID
24
+ # GATE_BLOCK: no marker is written.
25
+ swiftapi brake authorize REQUEST_ID
26
+ swiftapi brake execute REQUEST_ID
27
+ # AUTHORIZED_EXECUTION: exact marker bytes are written once.
28
+ swiftapi brake execute REQUEST_ID
29
+ # GATE_BLOCK: the authorization cannot execute again.
30
+ swiftapi status
31
+ swiftapi receipts
32
+ swiftapi verify RECEIPT_PATH --public-key PUBLIC_KEY_PATH
33
+ ```
34
+
35
+ `status` prints the sandbox and public-key path. `execute` returns the receipt
36
+ path. The operator authorizes in a separate terminal; authorization is deliberately
37
+ absent from the MCP tool surface. A signature requires an independently trusted
38
+ verification key, never a key blindly accepted from the receipt itself.
39
+
40
+ `swiftapi brake` presents `swiftapi>` and delegates ordinary input to the existing
41
+ Codex CLI. `swiftapi brake --agent claude` uses Claude Code. These host calls use
42
+ your existing account; the local test itself makes no model calls.
43
+
44
+ ## Python
45
+
46
+ The old imports remain available: `from swiftapi import SwiftAPI, Enforcement`.
47
+ The new local API does not require a remote account:
48
+
49
+ ```python
50
+ from pathlib import Path
51
+ from tempfile import mkdtemp
52
+ from swiftapi import ActionEnvelope, BindingCondition, LocalAuthority, LocalGuard
53
+
54
+ action = ActionEnvelope("example.append", {"value": "verified"}, "Append one value")
55
+ state = {"operator_approved": True} # Supplied by trusted application code.
56
+ condition = BindingCondition(action.action_hash, state)
57
+ guard = LocalGuard(LocalAuthority(), Path(mkdtemp()) / "ledger")
58
+ values = []
59
+ guard.run(
60
+ lambda: values.append("verified"),
61
+ action=action.capability, params=action.params, intent=action.intent,
62
+ condition=condition, state=state,
63
+ )
64
+ assert values == ["verified"]
65
+ ```
66
+
67
+ A callback's code must actually implement its supplied action description.
68
+ For an untrusted agent, use a registered broker operation that constructs and
69
+ executes the same canonical parameters. The bundled MCP operation creates a new
70
+ small UTF-8 marker in its own sandbox; it cannot run a shell or overwrite files.
71
+
72
+ ## What is enforced
73
+
74
+ An authorization binds an action hash, capability, condition hash, state hash,
75
+ nonce, issue time, and expiry. Ed25519 verification and a durable SQLite replay
76
+ claim happen before execution. Execution is never retried. Missing, malformed,
77
+ forged, expired, replayed, or mismatched authorization fails closed.
78
+
79
+ This guarantee applies to mediated capabilities. Arbitrary host tools are outside
80
+ the broker. Local same-user key storage supports development and CI; a malicious
81
+ process able to read the signer, change the gate, or mutate the ledger can bypass
82
+ that trust boundary. Production credentials and signing authority require process
83
+ or account isolation from untrusted agent code. Instructions and hooks are not a
84
+ universal security boundary.
85
+
86
+ ## Research is measured separately
87
+
88
+ `GATE_BLOCK` is deterministic enforcement, not native EOS. Successful empty
89
+ provider output is classified as a black-box `PROVIDER_VOID` with V0/V1/V2/VU
90
+ subtypes. Only exposed native token evidence can qualify as `NATIVE_VOID`.
91
+ The package does not download or retrain research models. The frozen
92
+ [PCCG-2 release](https://getswiftapi.com/pccg-2) and
93
+ [research library](https://getswiftapi.com/research) preserve the empirical,
94
+ causal, theoretical, and protocol boundaries.
95
+
96
+ ## Documentation
97
+
98
+ Start with [Quickstart](docs/QUICKSTART.md). See [concepts](docs/CONCEPTS.md),
99
+ [local brake](docs/LOCAL_BRAKE.md), [Codex](docs/CODEX.md),
100
+ [Claude Code](docs/CLAUDE_CODE.md), [Python SDK](docs/PYTHON_SDK.md),
101
+ [conditions](docs/CONDITIONS.md), [action envelopes](docs/ACTION_ENVELOPES.md),
102
+ [receipts](docs/RECEIPTS.md), [verification](docs/VERIFICATION.md),
103
+ [remote authority](docs/REMOTE_SWIFTAPI.md), [BYOK](docs/BYOK.md),
104
+ [security](docs/SECURITY_MODEL.md), [threat model](docs/THREAT_MODEL.md),
105
+ [native noncontinuation](docs/NATIVE_NONCONTINUATION.md),
106
+ [benchmarking](docs/BENCHMARKING.md), and [provenance](docs/RESEARCH_PROVENANCE.md).
107
+
108
+ [Migration from 1.2.2](MIGRATION_1_2_2.md) documents security corrections and
109
+ termination-metadata changes. Historical 1.2.2 bytes remain immutable on PyPI.
110
+
111
+ MIT license. Research and software by Rayan Pal / SwiftAPI Labs.
@@ -0,0 +1,59 @@
1
+ {
2
+ "HarmBench": {
3
+ "revision": "8e1604d1171fe8a48d8febecd22f600e462bdcdd",
4
+ "url": "https://raw.githubusercontent.com/centerforaisafety/HarmBench/8e1604d1171fe8a48d8febecd22f600e462bdcdd/data/behavior_datasets/harmbench_behaviors_text_all.csv",
5
+ "sha256": "8d81accedd38eaaf8b760618622bb888417d1fd0c86eba65c427a16f1cbb4afc",
6
+ "bytes": 198850,
7
+ "rows": 400,
8
+ "columns": [
9
+ "Behavior",
10
+ "FunctionalCategory",
11
+ "SemanticCategory",
12
+ "Tags",
13
+ "ContextString",
14
+ "BehaviorID"
15
+ ]
16
+ },
17
+ "StrongREJECT": {
18
+ "revision": "f7cad6c17e624e21d8df2278e918ae1dddb4cb56",
19
+ "url": "https://raw.githubusercontent.com/alexandrasouly/strongreject/f7cad6c17e624e21d8df2278e918ae1dddb4cb56/strongreject_dataset/strongreject_dataset.csv",
20
+ "sha256": "4dd70357e4ff8b5d0ba5ebafecab5d6dd5633ce8046e3dd1c8bd93e64de44381",
21
+ "bytes": 56359,
22
+ "rows": 313,
23
+ "columns": [
24
+ "category",
25
+ "source",
26
+ "forbidden_prompt"
27
+ ]
28
+ },
29
+ "JailbreakBench-benign-behaviors": {
30
+ "revision": "886acc352a31533ffbcf4ef22c744658688086fc",
31
+ "url": "https://huggingface.co/datasets/dedeswim/JBB-Behaviors/resolve/886acc352a31533ffbcf4ef22c744658688086fc/data/benign-behaviors.csv",
32
+ "sha256": "3cda234d21a991fa309bbfea4b6d9dae31ccdf8e9d452424b6a983e4fdc33468",
33
+ "bytes": 20570,
34
+ "rows": 100,
35
+ "columns": [
36
+ "Index",
37
+ "Goal",
38
+ "Target",
39
+ "Behavior",
40
+ "Category",
41
+ "Source"
42
+ ]
43
+ },
44
+ "JailbreakBench-harmful-behaviors": {
45
+ "revision": "886acc352a31533ffbcf4ef22c744658688086fc",
46
+ "url": "https://huggingface.co/datasets/dedeswim/JBB-Behaviors/resolve/886acc352a31533ffbcf4ef22c744658688086fc/data/harmful-behaviors.csv",
47
+ "sha256": "4a8ec6832056b631eb092dccc60d37a61c3d441268268888b3d006288afeffa1",
48
+ "bytes": 23116,
49
+ "rows": 100,
50
+ "columns": [
51
+ "Index",
52
+ "Goal",
53
+ "Target",
54
+ "Behavior",
55
+ "Category",
56
+ "Source"
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "JailbreakBench": {
3
+ "repository": "https://github.com/JailbreakBench/jailbreakbench",
4
+ "revision": "23dbdf6b19650521604456229bc1d9c4156c85c1",
5
+ "commit_url": "https://github.com/JailbreakBench/jailbreakbench/commit/23dbdf6b19650521604456229bc1d9c4156c85c1"
6
+ },
7
+ "HarmBench": {
8
+ "repository": "https://github.com/centerforaisafety/HarmBench",
9
+ "revision": "8e1604d1171fe8a48d8febecd22f600e462bdcdd",
10
+ "commit_url": "https://github.com/centerforaisafety/HarmBench/commit/8e1604d1171fe8a48d8febecd22f600e462bdcdd"
11
+ },
12
+ "StrongREJECT": {
13
+ "repository": "https://github.com/dsbowen/strong_reject",
14
+ "revision": "7a551d5b440ec7b75d4f6f5bb7c1719965b76b47",
15
+ "commit_url": "https://github.com/dsbowen/strong_reject/commit/7a551d5b440ec7b75d4f6f5bb7c1719965b76b47"
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ # Action envelopes
2
+
3
+ ActionEnvelope contains capability, params, intent, and actor. Its SHA-256 digest
4
+ covers all four fields. The v1 encoding is UTF-8 JSON with sorted string keys,
5
+ compact separators, exact Unicode, booleans/null, lists, and integers within
6
+ ±(2^53−1). Floats, tuples, NaN/infinity, duplicate parsed keys, surrogate strings,
7
+ nonstring object keys, excessive nesting, and envelopes over 2 MiB are rejected.
8
+ This is an explicit JSON subset, not a general RFC 8785 implementation.
9
+
10
+ A Decision binds action_hash, capability, state_hash, condition_hash, nonce,
11
+ issued_at and expires_at. State is separately hashed. The trusted broker constructs
12
+ both the action and the actual operation from the same detached snapshot. A
13
+ changed target, content, actor, intent, capability, or state invalidates the grant.
14
+ The legacy cloud fingerprint format remains unchanged for interoperability and
15
+ is documented separately in MIGRATION_1_2_2.md.
@@ -0,0 +1,25 @@
1
+ # Benchmarking
2
+
3
+ `benchmarks/sources.lock.json` pins JailbreakBench, HarmBench, and StrongREJECT to
4
+ exact upstream commits. `python scripts/fetch_benchmarks.py NEW_DIRECTORY` fetches
5
+ those source trees without executing their code or copying corpora into the SDK.
6
+ Framework licenses and dataset terms remain upstream. Before model evaluation,
7
+ record the separately fetched corpus bytes and SHA-256, framework revision, provider
8
+ configuration, raw responses, and independent executor observations.
9
+
10
+ The adapter `swiftapi.brake.benchmarks.import_results` imports JSONL rows against an
11
+ explicit complete case-ID list. Each row requires framework, revision, corpus hash,
12
+ evidence hash, classification, authorized (boolean), and consequence_observed
13
+ (boolean). Duplicate, omitted, or unexpected cases fail validation. All rows and
14
+ failures remain in the report. Errors prevent PASS. Any observed consequence without
15
+ authorization is an unauthorized consequential escape and makes the report FAIL.
16
+
17
+ This is an evaluation integration surface, not a claim of benchmark performance.
18
+ The release's local qualification uses inert fixtures; no paid model benchmark is
19
+ silently substituted or run. A failed imported row can become a regression fixture.
20
+
21
+ `benchmarks/corpora.lock.json` also pins the original upstream CSV bytes: 100 benign
22
+ and 100 harmful JailbreakBench rows, 400 HarmBench text rows, and 313 StrongREJECT
23
+ rows. `python scripts/fetch_corpora.py NEW_DIRECTORY` verifies all hashes before
24
+ retaining bytes. `load_cases(framework, path, expected_sha256)` adapts those files
25
+ without changing them. No model or judge was run as part of this corpus check.
@@ -0,0 +1,16 @@
1
+ # Bring your own provider keys
2
+
3
+ The default local brake performs no provider request and needs no provider keys.
4
+ Codex or Claude Code retains its normal configuration and environment, including
5
+ OPENAI_API_KEY or ANTHROPIC_API_KEY when those are used. The installer never copies
6
+ keys into agent instructions, receipt payloads, or its MCP registration.
7
+
8
+ LOCAL/BYOK: the agent connects directly to its provider; proposed consequences
9
+ flow through the capability broker and local or explicitly configured authority.
10
+ Existing OpenAI/Anthropic compatibility wrappers are optional: they send prompts
11
+ and action metadata to the legacy authority, and provider credentials only to the
12
+ provider. They are not the complete upstream SDK and do not support streaming.
13
+
14
+ A future attested-provider route is a distinct opt-in deployment mode. This release
15
+ does not force proxying or advertise that future service as deployed. Do not put
16
+ secrets in action descriptions or arbitrary receipt metadata.
@@ -0,0 +1,18 @@
1
+ # Claude Code integration
2
+
3
+ Run `swiftapi brake install claude --dry-run` then `swiftapi brake install claude`.
4
+ The user-level `mcpServers.swiftapi_brake` entry is merged into `~/.claude.json`.
5
+ A delimited guidance block is appended to `~/.claude/CLAUDE.md`. Other servers and
6
+ settings are preserved. Restart Claude Code and use ordinary prompts with the
7
+ registered sandbox tools. Operator approval remains outside the MCP surface.
8
+
9
+ `swiftapi brake --agent claude` offers a small input loop that passes the user's
10
+ input to the existing Claude CLI. It does not add a second model or proxy provider
11
+ keys. Existing host authentication and cost rules apply.
12
+
13
+ Official [MCP](https://code.claude.com/docs/en/mcp),
14
+ [hooks](https://code.claude.com/docs/en/hooks),
15
+ [permissions](https://code.claude.com/docs/en/permissions), and
16
+ [plugins](https://code.claude.com/docs/en/plugins) were inspected. This package uses
17
+ the documented stdio MCP configuration and persistent instructions. It does not
18
+ promise to intercept arbitrary Bash, computer-use, or third-party tool calls.
@@ -0,0 +1,28 @@
1
+ # Codex integration
2
+
3
+ Run `swiftapi brake install codex --dry-run`, inspect the proposed changes, then
4
+ `swiftapi brake install codex`. The installer adds `mcp_servers.swiftapi_brake` to
5
+ the user config and a delimited instruction block to `~/.codex/AGENTS.md`.
6
+ It points at the installing interpreter (keep that environment installed), backs
7
+ up changed files privately, and preserves unrelated configuration. A global
8
+ AGENTS.override.md is reported because it would supersede the added guidance.
9
+
10
+ Restart Codex. Ask normally to use Swift Brake's sandbox; it discovers status,
11
+ propose_marker, execute, and read_marker. Approve a request in an operator terminal.
12
+ `swiftapi doctor` reports static registration, not proof of a live model/tool call.
13
+ `swiftapi brake uninstall codex` removes only unchanged owned entries.
14
+
15
+ Official mechanisms checked for this release:
16
+ [MCP](https://developers.openai.com/codex/mcp/),
17
+ [AGENTS.md](https://developers.openai.com/codex/guides/agents-md/),
18
+ [skills](https://developers.openai.com/codex/skills/),
19
+ [hooks](https://developers.openai.com/codex/hooks/),
20
+ [security](https://developers.openai.com/codex/security/).
21
+ Hooks exist but require host trust and have incomplete tool coverage. This adapter
22
+ uses MCP plus instructions and does not change hooks, permissions, or sandbox settings.
23
+
24
+ An older separately installed Swift Brake prototype may gate even this server's
25
+ read-only MCP calls. This installer preserves that gate. Coordinate exact test-call
26
+ authorization with the operator rather than disabling it. `SWIFTAPI_CONFIG_HOME`
27
+ selects an isolated configuration home for installer tests; ordinary installation
28
+ uses the user's real home. Configuration presence is not runtime qualification.
@@ -0,0 +1,17 @@
1
+ # Concepts
2
+
3
+ A binding condition is the prerequisite that must hold for valid continuation.
4
+ Capability is what can be done; permission determines whether the particular
5
+ consequence may occur. The software contract is prerequisite → verify → authorize
6
+ → consequence. A condition that cannot be verified permits no mediated consequence.
7
+
8
+ `ActionEnvelope` freezes the exact capability, parameters, intent, and actor.
9
+ `BindingCondition` binds its action hash and required state. `LocalAuthority`
10
+ evaluates equality and signs a short-lived `Decision`. `LocalGuard` or a broker
11
+ independently checks the signature and every binding before claiming the nonce.
12
+ `DecisionReceipt` is the signed-envelope type; execution receipts use a separate
13
+ schema to distinguish authorization from the subsequent effect.
14
+
15
+ State and conditions originate in trusted application code. An agent writing
16
+ "approved" in its prompt does not establish a real prerequisite. Model-native
17
+ termination is an independent behavioral observation, never the authorization root.
@@ -0,0 +1,15 @@
1
+ # Conditions
2
+
3
+ BindingCondition binds one action hash and a nonempty required-state JSON object.
4
+ The implemented predicate is exact, type-sensitive canonical equality. For example,
5
+ boolean true differs from integer 1. Extra, absent, or changed state fields deny.
6
+ The condition name is also hashed; changing it invalidates previous authorization.
7
+
8
+ The caller supplies trusted current state and the expected prerequisite. The local
9
+ broker independently constructs state from its sandbox identity and target absence.
10
+ Operator authorization is an explicit, separate method, never an MCP tool. This
11
+ library is not a natural-language permission oracle and makes no extra LLM calls.
12
+
13
+ The object takes a detached snapshot when created. Use `to_dict()` to inspect the
14
+ canonical snapshot; modifying a supplied dictionary cannot change signed bytes.
15
+ A valid condition does not obligate execution; it permits a specific decision.
@@ -0,0 +1,17 @@
1
+ # Local Brake
2
+
3
+ The default home is `~/.local/share/swiftapi`. Override it with `SWIFTAPI_HOME`.
4
+ It contains an owner-only Ed25519 key, published verification key, pending requests,
5
+ one-use grants, SQLite replay ledger, execution receipts, and an owner-only sandbox.
6
+ These are local files. Protect them from untrusted processes and preserve the ledger.
7
+
8
+ The bundled `write_marker` capability creates an absent basename with exact UTF-8
9
+ content (at most 4096 bytes). It does not overwrite, accept paths, run commands,
10
+ or hold external service credentials. Sandbox device/inode and target absence
11
+ are bound into state. Execution opens the directory and target with no-follow
12
+ and exclusive creation flags. A race to create a target cannot overwrite it.
13
+
14
+ The ledger consumes authorization before the first side effect. A crash can consume
15
+ a grant without executing; an I/O failure may leave a partial file. There is no retry
16
+ and no exactly-once-completion promise. Inspect ERROR outcomes before further action.
17
+ `swiftapi brake uninstall` retains all authorization state and receipts.
@@ -0,0 +1,17 @@
1
+ # Native noncontinuation
2
+
3
+ Keep model behavior separate from deterministic consequence enforcement.
4
+ NATIVE_VOID requires exposed native token IDs with the actual EOS identity.
5
+ PROVIDER_VOID denotes successful black-box zero-visible-byte output and preserves
6
+ the published V0 (text container, normal stop), V1 (budget stop), V2 (absent text,
7
+ normal stop), and VU (unmapped stop) distinctions. Provider stop is not native EOS.
8
+
9
+ REFUSAL, VISIBLE_SAFE, GATE_BLOCK, AUTHORIZED_EXECUTION, and ERROR are distinct.
10
+ Visible output requires an independent safety judgment before VISIBLE_SAFE is used.
11
+ Transport failures, safety blocks, and tool-mediated events are not Void outcomes.
12
+ Whitespace has bytes. Explicit refusals are not Void even if another field is empty.
13
+
14
+ The observation helper accepts normalized evidence; callers must preserve and
15
+ validate the original provider envelope and cannot infer absent fields as success.
16
+ This release does not run native models or claim the generalization of PCCG-2.
17
+ The frozen native causal evidence remains at getswiftapi.com/pccg-2.