{
  "latency": {
    "max_ms": 100.0,
    "mean_ms": 69.7,
    "min_ms": 59.9,
    "p50_ms": 67.3,
    "p95_ms": 83.7,
    "path": "POST /mcp/messages",
    "samples": 100,
    "tool": "trust-plane-echo",
    "transport": "in-process ASGI client, local SQLite, no network"
  },
  "live_receipt_verification": {
    "bundle_sha256": "7b43ee98a3526293723c3383c02fce0e9d2f9f3634378d569d6cc2ff756a7edc",
    "command": "b2a-verify-receipt --bundle receipt.json --keys trust-keys.json \\\n  --expect-issuer https://api.thisisatest.tech",
    "exit_code": 0,
    "output": "VERIFIED  rcpt-9daf745e477d45ab\n  signed by   railway-prod-ed25519\n  permit      permit-c73a0b621c244831\n  tool        partner.echo\n  outcome     success\n  credits     1 charged of 1 authorized\n  at          2026-08-11T21:17:28.064620+00:00",
    "receipt_id": "rcpt-9daf745e477d45ab",
    "trust_document_sha256": "aa03192fb048e2c8fca5ba6feb7be0cf2ed6461f21f60a9a5673afe66398b92e"
  },
  "recorded_at": "2026-09-08T07:33:25+00:00",
  "recorded_by": "python scripts/record_site_transcript.py",
  "schema_version": "1.1",
  "source": {
    "gateway": "throwaway local SQLite gateway, real FastAPI routers",
    "label": "Recorded from a local gateway run, not the live API. Every line is a real request or a real response.",
    "proof": "make prove-trust-plane (scripts/demo_trust_plane.py)",
    "signing_key_id": "demo-ed25519"
  },
  "steps": [
    {
      "id": "discover",
      "loop": "01 \u00b7 Discover",
      "note": "Which tools exist and what each call costs. Discovery is public; nothing here can be invoked yet.",
      "request": "GET /mcp/tools.json\nX-API-Key: $AGENT_API_KEY",
      "response": [
        [
          "name",
          "trust-plane-echo"
        ],
        [
          "creditsPerCall",
          "2"
        ],
        [
          "unitName",
          "call"
        ],
        [
          "requirePermit",
          "true"
        ]
      ],
      "title": "The agent reads the manifest."
    },
    {
      "id": "authorize",
      "loop": "02 \u00b7 Authenticate \u2192 03 \u00b7 Authorize",
      "note": "One tool, one agent identity, a budget, an expiry, signed by the operator's key. The agent cannot mint this for itself.",
      "request": "POST /v1/permits\nX-API-Key: $OPERATOR_API_KEY\nIdempotency-Key: demo-permit-1",
      "response": [
        [
          "permit_id",
          "permit-74d8473ec86c4b42"
        ],
        [
          "allowed_tools",
          "[\"trust-plane-echo\"]"
        ],
        [
          "max_credits",
          "25"
        ],
        [
          "expires_at",
          "2026-09-08T08:03:18"
        ],
        [
          "key_id",
          "demo-ed25519"
        ]
      ],
      "title": "The operator issues one scoped permit."
    },
    {
      "id": "invoke",
      "loop": "04 \u00b7 Invoke \u2192 05 \u00b7 Meter \u2192 06 \u00b7 Receipt",
      "note": "The gateway dispatches, debits the scoped budget, and returns a signed receipt that names the permit and the ledger entry.",
      "request": "POST /mcp/messages\nX-API-Key: $AGENT_API_KEY",
      "response": [
        [
          "receipt_id",
          "rcpt-038c84a3d94d4a34"
        ],
        [
          "outcome",
          "success"
        ],
        [
          "credits_charged",
          "2"
        ],
        [
          "ledger_entry_id",
          "60055228-a465-4d11-84c2-16b72ea26e3c"
        ],
        [
          "permit_id",
          "permit-74d8473ec86c4b42"
        ]
      ],
      "title": "The call executes and is charged once."
    },
    {
      "id": "replay",
      "loop": "05 \u00b7 Meter, again",
      "note": "Same receipt id, no second dispatch, no second debit. A timed-out client can retry without fear.",
      "request": "POST /mcp/messages\nX-API-Key: $AGENT_API_KEY",
      "response": [
        [
          "receipt_id",
          "rcpt-038c84a3d94d4a34"
        ],
        [
          "outcome",
          "success"
        ],
        [
          "credits_charged",
          "2"
        ],
        [
          "ledger debits for this tool",
          "1"
        ]
      ],
      "title": "The same idempotency key comes back."
    },
    {
      "id": "verify",
      "loop": "06 \u00b7 Receipt, offline",
      "note": "The SDK verifier checks the Ed25519 signature against the published key set. It never imports the gateway.",
      "output": "VERIFIED  rcpt-038c84a3d94d4a34\n  signed by   demo-ed25519\n  permit      permit-74d8473ec86c4b42\n  tool        trust-plane-echo\n  outcome     success\n  credits     2 charged of 2 authorized\n  at          2026-09-08T07:33:18.252834+00:00",
      "request": "b2a-verify-receipt --bundle receipt.json --keys trust-keys.json",
      "title": "The receipt verifies with no credential and no callback."
    },
    {
      "id": "audit",
      "loop": "07 \u00b7 Audit",
      "note": "Every event is hash-chained to the one before it. Edit a stored row and the chain breaks, which the demo also proves.",
      "request": "POST /v1/audit/verify-chain\nX-API-Key: $AGENT_API_KEY",
      "response": [
        [
          "valid",
          "true"
        ],
        [
          "checked_events",
          "1"
        ]
      ],
      "title": "The ledger's event chain still verifies."
    },
    {
      "id": "deny",
      "loop": "08 \u00b7 Govern",
      "note": "The permit named one tool. Asking for another is denied before dispatch, receipted as a denial, and never charged.",
      "request": "POST /mcp/messages\nX-API-Key: $AGENT_API_KEY",
      "response": [
        [
          "error",
          "permit_tool_not_allowed"
        ],
        [
          "receipt_id",
          "rcpt-f9f49fdda0294493"
        ],
        [
          "outcome",
          "denied"
        ],
        [
          "ledger_entry_id",
          "null"
        ]
      ],
      "title": "An out-of-scope tool is refused at the boundary."
    }
  ],
  "summary": {
    "denial_reason": "permit_tool_not_allowed",
    "offline_verified": true,
    "permit_id": "permit-74d8473ec86c4b42",
    "receipt_id": "rcpt-038c84a3d94d4a34",
    "replay_receipt_id": "rcpt-038c84a3d94d4a34"
  }
}
