Skip to content

Commit 515c08e

Browse files
committed
feat(v2): port Wave 1 full accountability surface — 2.4.0a1
Ports the remaining Wave 1 surface from TypeScript SDK 2.6.0-alpha.0 to Python SDK. Three modules, ~2,700 lines TS source ported with cross-implementation byte-parity: v2/accountability (full surface, replaces 2.4.0a0 minimal stub): - ActionReceipt + verify_action_receipt - AuthorityBoundaryReceipt + verify_authority_boundary_receipt - CustodyReceipt + verify_custody_receipt (8 event types, 7 purposes) - ContestabilityReceipt + verify_contestability_receipt (full, with attach_controller_response) - APSBundle + verify_aps_bundle (balanced Merkle commitment) v2/cognitive_attestation (Paper 4): - build_attestation, sign_attestation, canonicalize_attestation - cognitive_attestation_digest, validate_attestation_shape - verify_signature, verify_required_signer_roles - verify_against_registry (sync, RegistryResolver), verify_by_replay (stub) - Typed dispute primitives: ThresholdDispute, ExclusionDispute, DecompositionAdequacyDispute, FacetedReinterpretationDispute v2/instruction_provenance (Paper 8 candidate, v0.2): - canonicalize_path (NFC, percent-encoding rejection, traversal, case-mode, OS-separator handling) - compute_context_root, sort_instruction_files, canonicalize_envelope - create_instruction_provenance_receipt (tier-locked to self-asserted) - verify_instruction_provenance_receipt (full §6 pipeline) - verify_action_time_context_root, matches_any_pattern (POSIX globs) Cross-impl byte-parity verified against: - 5 TS-supplied fixtures in v2/accountability/fixtures/ - 4 generated fixtures for cognitive-attestation - 3 generated fixtures for instruction-provenance All fixtures pinned to agent-passport-system@2.6.0-alpha.0; the generator script lives at tests/v2/fixtures/wave1/_generate.mjs and resolves the SDK via the APS_SDK_PATH env var (default ../agent-passport-system) per the 5214ff6 convention. The minimal ContestabilityReceipt that 2.4.0a0 shipped inline in v2/downstream_taint.py is removed. The cascade primitive imports the full receipt + response shapes from v2/accountability; downstream-taint contract is unchanged. The 6 cascade tests still pass against the full ContestabilityReceipt via a helper that fills in the fields the cascade does not read with deterministic stub values. Naming wrinkle: create_action_receipt and verify_action_receipt collide with legacy delegation-flavored functions of the same names. The Wave 1 versions re-export at the top level under create_accountability_action_receipt / verify_accountability_action_receipt; the unaliased forms remain available via `from agent_passport.v2.accountability import ...`. This mirrors the AccountabilityActionReceipt aliasing the TS SDK applied for the same reason. Cognitive Attestation registry resolver is sync rather than async (TS uses Promise). The rest of the Python SDK has no asyncio dependency, so a sync resolver matches the existing surface shape. Integrators wrap async resolvers as needed. Test count: 398 -> 518 passed (+120 tests). 1 skipped, 6 xfailed (unchanged). Version bump 2.4.0a0 -> 2.4.0a1. PyPI publish deferred to Tima Touch ID.
1 parent 3cb2563 commit 515c08e

46 files changed

Lines changed: 5699 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pip install agent-passport-system
1111
```
1212

13-
> **Current stable**: `2.3.0` (default `pip install`). **Pre-release**: `2.4.0a0` (`pip install --pre agent-passport-system==2.4.0a0`). The 2.4.0a0 alpha adds the evidentiary type safety primitives (claim/evidence registry, claim verifier with forbidden-substitution detection, contestation cascade) in symmetry with TypeScript SDK npm 2.6.0-alpha.0. Cross-impl byte-parity verified against TS-generated canonical JSON fixtures. Paper review window may shape-shift these primitives; alpha versioning avoids forcing major-version ceremony for every adjustment. Wave 1 accountability primitives are still TypeScript-only this iteration.
13+
> **Current stable**: `2.3.0` (default `pip install`). **Pre-release**: `2.4.0a1` (`pip install --pre agent-passport-system==2.4.0a1`). The 2.4.0a1 alpha adds Wave 1 accountability primitives (ActionReceipt, AuthorityBoundaryReceipt, CustodyReceipt, ContestabilityReceipt, APSBundle), Cognitive Attestation (Paper 4), and Instruction Provenance Receipts (v0.2). 2.4.0a0 already added evidentiary type safety (claim/evidence registry, claim verifier, contestation cascade). All primitives are byte-parity-verified against TypeScript SDK npm 2.6.0-alpha.0 fixtures. Paper review window may shape-shift these primitives; alpha versioning avoids forcing major-version ceremony for every adjustment.
1414
1515

1616
## Quick Start
@@ -110,7 +110,7 @@ This Python SDK implements all 8 Agent Passport Protocol layers:
110110
7. **Integration Wiring** — Cross-layer bridges (commerce+intent, coordination+agora)
111111
8. **Agentic Commerce** — 4-gate checkout, human approval, spend limits
112112

113-
Strict subset of the [TypeScript SDK](https://www.npmjs.com/package/agent-passport-system) at npm v2.6.0-alpha.0. The four evidentiary type safety primitives (claim/evidence registry, claim verifier with forbidden-substitution detection, contestation cascade, GroundsClass extension) ship in `agent_passport.v2` from Python SDK 2.4.0a0 (alpha pre-release) onward, with cross-impl byte-parity verified against TS-generated fixtures. Wave 1 accountability primitives (ActionReceipt, AuthorityBoundaryReceipt, CustodyReceipt, ContestabilityReceipt, APSBundle) ship in the TypeScript SDK only this iteration; full Python port deferred. The cascade primitive uses a minimal Python ContestabilityReceipt that widens when Wave 1 ports. Cross-language signature verification continues to work for the primitives Python does ship. Also available via the [MCP server](https://mcp.aeoess.com/sse).
113+
Cross-language parity with the [TypeScript SDK](https://www.npmjs.com/package/agent-passport-system) at npm v2.6.0-alpha.0. Python SDK 2.4.0a1 ships the full Wave 1 surface: ActionReceipt, AuthorityBoundaryReceipt, CustodyReceipt, ContestabilityReceipt, APSBundle (with balanced Merkle commitment), Cognitive Attestation (Paper 4 — three-stage verification, typed dispute primitives), and Instruction Provenance Receipts v0.2 (path canonicalization, context-root binding, action-time recompute). The four evidentiary type safety primitives shipped in 2.4.0a0. All surfaces verified against TS-issued fixtures for byte-identical canonical JSON. Cross-language signature verification covers every signed primitive in the SDK. Also available via the [MCP server](https://mcp.aeoess.com/sse).
114114

115115
## Links
116116

@@ -135,10 +135,10 @@ Strict subset of the [TypeScript SDK](https://www.npmjs.com/package/agent-passpo
135135
```bash
136136
pip install pynacl pytest
137137
PYTHONPATH=src pytest tests/ -v
138-
# 398 passed, 1 skipped, 6 xfailed across 30 test files. Coverage tracks the
139-
# protocol layers the Python port has actually shipped (see "Strict subset" note above).
140-
# The new test_claim_*, test_downstream_taint files include 15 cross-impl byte-parity
141-
# checks against TS-generated canonical JSON fixtures.
138+
# 2.4.0a1: 518 passed, 1 skipped, 6 xfailed. Coverage covers all 8 protocol layers
139+
# plus the v2 evidentiary type safety, Wave 1 accountability, Cognitive Attestation,
140+
# and Instruction Provenance Receipt surfaces. Cross-impl byte-parity tests assert
141+
# byte-identical canonical JSON against TS-issued fixtures.
142142
```
143143

144144
## License

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "agent-passport-system"
7-
version = "2.4.0a0"
8-
description = "Python SDK for the Agent Passport System. Identity, delegation, governance, data source registration, training attribution, per-period attribution settlement, mutual authentication, evidentiary type safety (claim/evidence registry, claim verifier with forbidden-substitution detection, contestation cascade). Cross-language parity with agent-passport-system npm v2.6.0-alpha.0 verified by byte-identical canonical JSON fixtures."
7+
version = "2.4.0a1"
8+
description = "Python SDK for the Agent Passport System. Identity, delegation, governance, data source registration, training attribution, per-period attribution settlement, mutual authentication, evidentiary type safety, Wave 1 accountability primitives (action, authority-boundary, custody, contestability, bundle), Cognitive Attestation, Instruction Provenance Receipts. Cross-language parity with agent-passport-system npm v2.6.0-alpha.0 verified by byte-identical canonical JSON fixtures."
99
readme = "README.md"
1010
license = "Apache-2.0"
1111
requires-python = ">=3.9"

src/agent_passport/__init__.py

Lines changed: 122 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Docs: https://aeoess.com/llms-full.txt
2929
"""
3030

31-
__version__ = "2.4.0a0"
31+
__version__ = "2.4.0a1"
3232

3333
# Crypto
3434
from .crypto import generate_key_pair, sign, verify, public_key_from_private
@@ -285,11 +285,11 @@
285285
from .canonical import canonicalize_jcs
286286

287287

288-
# Evidentiary Type Safety primitives (SDK v2.4.0a0 alpha pre-release)
289-
# Ports of the four TypeScript SDK 2.6.0-alpha.0 primitives:
290-
# claim-evidence-types, claim-verifier, downstream-taint, GroundsClass.
291-
# ContestabilityReceipt fully ports when Wave 1 accountability ports;
292-
# the cascade-consumed shape ships now as a minimal dataclass.
288+
# Evidentiary Type Safety primitives (SDK v2.4.0a1 alpha pre-release)
289+
# Ports of TypeScript SDK 2.6.0-alpha.0:
290+
# 2.4.0a0: claim-evidence-types, claim-verifier, downstream-taint
291+
# 2.4.0a1: full Wave 1 accountability surface, cognitive-attestation,
292+
# instruction-provenance.
293293
from .v2 import (
294294
# claim_evidence_types
295295
ClaimType,
@@ -306,13 +306,125 @@
306306
OpenContestationResolver,
307307
verify_evidence_claim,
308308
# downstream_taint
309-
ContestStatus,
310-
ContestabilityControllerResponse,
311-
ContestabilityReceipt,
312-
GroundsClass,
313309
TaintCandidate,
314310
TaintedRecord,
315311
TaintedSet,
316312
compute_downstream_taint,
317313
is_contestation_tainting,
318314
)
315+
316+
# Wave 1 accountability — full surface (v2.4.0a1)
317+
# create_action_receipt / verify_action_receipt collide with legacy
318+
# delegation-flavored functions of the same names; the Wave 1 versions
319+
# are re-exported under accountability_* prefixes here. The unaliased
320+
# forms remain available via `from agent_passport.v2.accountability
321+
# import ...`.
322+
from .v2.accountability import (
323+
# base
324+
CaptureMode,
325+
Completeness,
326+
ScopeOfClaim,
327+
# action
328+
ActionPayload,
329+
ActionReceipt as AccountabilityActionReceipt,
330+
SideEffectClass,
331+
TransparencyLogInclusion,
332+
# authority-boundary
333+
AuthorityBoundaryReceipt,
334+
BoundaryResult,
335+
# custody
336+
CustodyEventType,
337+
CustodyPurpose,
338+
CustodyReceipt,
339+
SubjectReceiptBatch,
340+
# contestability
341+
ContestabilityContestant,
342+
ContestabilityControllerResponse,
343+
ContestabilityReceipt,
344+
ContestStatus,
345+
GroundsClass,
346+
GroundsClassValue,
347+
RequestedRemedy,
348+
StandingBasis,
349+
# bundle
350+
APSBundle,
351+
BundledReceiptRef,
352+
# construct (aliased to avoid legacy delegation collision)
353+
attach_controller_response,
354+
create_action_receipt as create_accountability_action_receipt,
355+
create_aps_bundle,
356+
create_authority_boundary_receipt,
357+
create_contestability_receipt,
358+
create_custody_receipt,
359+
# bundle helpers
360+
compute_merkle_root,
361+
# verify (aliased)
362+
verify_action_receipt as verify_accountability_action_receipt,
363+
verify_aps_bundle,
364+
verify_authority_boundary_receipt,
365+
verify_contestability_receipt,
366+
verify_custody_receipt,
367+
)
368+
369+
# Cognitive Attestation (Paper 4)
370+
from .v2.cognitive_attestation import (
371+
ActivationStatistic,
372+
AggregationPolicy,
373+
AttachmentPoint,
374+
CognitiveAttestation,
375+
CompletenessClaim,
376+
DictionaryRef,
377+
ExecutionEnvironment,
378+
FeatureActivation,
379+
ModelRef,
380+
Precision,
381+
SAEType,
382+
Signature as CognitiveSignature,
383+
SignerRole as CognitiveSignerRole,
384+
TiebreakerRule,
385+
TokenRange,
386+
BuildAttestationInput,
387+
build_attestation,
388+
canonicalize_attestation,
389+
cognitive_attestation_digest,
390+
sign_attestation as sign_cognitive_attestation,
391+
sort_feature_activations,
392+
validate_attestation_shape,
393+
RegistryResolver,
394+
RegistryVerificationResult,
395+
ReplayBackend,
396+
ReplayVerificationResult,
397+
RequiredRoleCoverage,
398+
verify_against_registry,
399+
verify_by_replay,
400+
verify_required_signer_roles,
401+
verify_signature as verify_cognitive_signature,
402+
ComputationalDispute,
403+
DecompositionAdequacyDispute,
404+
Dispute,
405+
ExclusionDispute,
406+
FacetedReinterpretationDispute,
407+
InterpretiveDispute,
408+
ThresholdDispute,
409+
)
410+
411+
# Instruction Provenance Receipt (Paper 8 candidate, v0.2)
412+
from .v2.instruction_provenance import (
413+
AttestationTier,
414+
FilesystemMode,
415+
InstructionFile,
416+
InstructionProvenanceReceipt,
417+
InstructionProvenanceReceiptBoundTo,
418+
InstructionRole,
419+
IPRConstructionError,
420+
IPRPathError,
421+
canonicalize_envelope as canonicalize_instruction_envelope,
422+
canonicalize_path,
423+
compute_context_root,
424+
create_instruction_provenance_receipt,
425+
matches_any_pattern,
426+
sign_ed25519 as sign_ed25519_ipr,
427+
sort_instruction_files,
428+
verify_action_time_context_root,
429+
verify_instruction_provenance_receipt,
430+
)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
2+
"""Wave 1 accountability — public surface.
3+
4+
Mirrors src/v2/accountability/index.ts in agent-passport-system 2.6.0-alpha.0.
5+
6+
Five primitives: ActionReceipt, AuthorityBoundaryReceipt, CustodyReceipt,
7+
ContestabilityReceipt, APSBundle. Cross-impl byte-parity with the TS SDK
8+
verified against TS-supplied fixtures in tests/v2/wave1/.
9+
10+
This module replaces the minimal ContestabilityReceipt that shipped in
11+
v2/downstream_taint.py at 2.4.0a0. The downstream-taint cascade now
12+
imports its receipt and response shapes from here directly; the cascade
13+
contract is unchanged.
14+
"""
15+
16+
from .types import (
17+
# base
18+
CaptureMode,
19+
Completeness,
20+
ScopeOfClaim,
21+
# action
22+
ActionPayload,
23+
ActionReceipt,
24+
SideEffectClass,
25+
TransparencyLogInclusion,
26+
# authority-boundary
27+
AuthorityBoundaryReceipt,
28+
BoundaryResult,
29+
# custody
30+
CustodyEventType,
31+
CustodyPurpose,
32+
CustodyReceipt,
33+
SubjectReceiptBatch,
34+
# contestability
35+
ContestabilityContestant,
36+
ContestabilityControllerResponse,
37+
ContestabilityReceipt,
38+
ContestStatus,
39+
GroundsClass,
40+
GroundsClassValue,
41+
RequestedRemedy,
42+
StandingBasis,
43+
# bundle
44+
APSBundle,
45+
BundledReceiptRef,
46+
)
47+
48+
from .construct import (
49+
attach_controller_response,
50+
create_action_receipt,
51+
create_authority_boundary_receipt,
52+
create_contestability_receipt,
53+
create_custody_receipt,
54+
)
55+
56+
from .bundle import (
57+
compute_merkle_root,
58+
create_aps_bundle,
59+
verify_aps_bundle,
60+
)
61+
62+
from .verify import (
63+
verify_action_receipt,
64+
verify_authority_boundary_receipt,
65+
verify_contestability_receipt,
66+
verify_custody_receipt,
67+
)
68+
69+
__all__ = [
70+
# types
71+
"APSBundle",
72+
"ActionPayload",
73+
"ActionReceipt",
74+
"AuthorityBoundaryReceipt",
75+
"BoundaryResult",
76+
"BundledReceiptRef",
77+
"CaptureMode",
78+
"Completeness",
79+
"ContestStatus",
80+
"ContestabilityContestant",
81+
"ContestabilityControllerResponse",
82+
"ContestabilityReceipt",
83+
"CustodyEventType",
84+
"CustodyPurpose",
85+
"CustodyReceipt",
86+
"GroundsClass",
87+
"GroundsClassValue",
88+
"RequestedRemedy",
89+
"ScopeOfClaim",
90+
"SideEffectClass",
91+
"StandingBasis",
92+
"SubjectReceiptBatch",
93+
"TransparencyLogInclusion",
94+
# construct
95+
"attach_controller_response",
96+
"create_action_receipt",
97+
"create_aps_bundle",
98+
"create_authority_boundary_receipt",
99+
"create_contestability_receipt",
100+
"create_custody_receipt",
101+
# bundle helpers
102+
"compute_merkle_root",
103+
# verify
104+
"verify_action_receipt",
105+
"verify_aps_bundle",
106+
"verify_authority_boundary_receipt",
107+
"verify_contestability_receipt",
108+
"verify_custody_receipt",
109+
]

0 commit comments

Comments
 (0)