Skip to content

Capture Proxy, PII Masking, and Language SDKs

Wire Rung 2 edge capture and Rung 3 Laravel PHP and Rust Axum bridges with deterministic PII masking.

Adaptive Factory compares a Champion and a Challenger across languages and databases using one language-neutral HTTP/JSON wire contract. Both stacks emit identical ExecutionRecord, IntentRecord, and ProjectionSnapshot payloads.

Edge Capture Proxy (Rung 2)

@adaptive-factory/tap sits in front of your Champion origin as a Hono Worker or HTTP middleware:

  • Injects X-AF-Correlation-Id, W3C traceparent, and X-AF-Surface-Id on every forwarded request.
  • Masks declared PII fields before any payload leaves the host.
  • Writes masked Capture records (CAP-*) to POST /api/capture/ingress off the request path (waitUntil()), failing open with a 250 ms timeout so production traffic never blocks.

Deterministic PII masking (STD-CORE-002)

Every stack (TypeScript Edge Tap, Laravel PHP, and Rust Axum) masks PII identically before egress:

  • Algorithm: HMAC-SHA256(key = tenantMaskKey, message = utf8(trim(lowercase(value))))
  • Output format: af_pii_v1_ + first 12 lowercase hex characters
  • Default masked fields: email, customer_email, recipient, to, phone, phone_number, mobile, address, street, postal_code, zip, card_number, pan, cvv, cvc, ssn

All three runtimes verify byte-identical output against one shared golden test vector (packages/core/fixtures/capture-bridge-golden.json).

Laravel PHP Champion SDK (sdks/laravel)

Target: Laravel 10/11/12, PHP 8.2+. Requires zero Eloquent schema changes.

  • Terminable HTTP middleware (AfCaptureMiddleware): flushes the HTTP response to the user before posting ExecutionRecord to POST /api/capture/execution.
  • Rung 3a Outbound Intents: hooks MessageSending (mail), Http::globalMiddleware (http), JobQueued (queue), and payment wrappers with performed: true.
  • Rung 3b Canonical Projections: implement AfProjector on watched models to emit canonical JSON snapshots in integer minor units.

Rust Challenger SDK (sdks/rust)

Target: Rust 1.80+, Axum, Tokio, Tower, Serde.

  • Boot-time Shadow isolation (STD-CORE-004): af_shadow::verify_boot_isolation requires AF_SHADOW_MODE=1, refuses live outbound credentials, and verifies network-none or egress-proxy isolation before binding the listener.
  • Tower layer (AfShadowLayer): extracts correlation headers, clones bounded response bodies, masks PII, and drains execution records asynchronously over a bounded channel (fail-open).
  • Intent recorder traits: records mail, payment, HTTP, and queue intents with performed: false and zero outbound network calls.

Multi-project CLI (af projects)

When operating multiple systems or repositories from one machine, register named projects and switch cleanly with --project:

af init --tenant my-app --repo org/my-app --url http://localhost:8789
af projects
af status --project my-app
af captures --project my-app

Type to search…

↑↓ navigate↵ selectEsc close