Skip to main content

DBL Gateway

Project description

DBL Gateway

Authoritative DBL and KL gateway. This service is the single writer for append-only trails, applies policy via dbl-policy, and executes via kl-kernel-logic. UI and boundary services consume its snapshots and emit INTENT only.

This release stabilizes the 0.3.x stackline and does not introduce new wire contracts.

Compatible stack versions:

  • dbl-core==0.3.2
  • dbl-policy==0.2.2
  • dbl-main==0.3.1
  • kl-kernel-logic==0.5.0

Quickstart (PowerShell)

py -3.11 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"

Run the gateway:

dbl-gateway serve --db .\data\trail.sqlite --host 127.0.0.1 --port 8010

Run with uvicorn:

$env:DBL_GATEWAY_DB=".\data\trail.sqlite"
py -3.11 -m uvicorn dbl_gateway.app:app --host 127.0.0.1 --port 8010

Quick start with OpenAI (development)

To execute chat intents via OpenAI, set an API key in the environment.

PowerShell (Windows):

$env:OPENAI_API_KEY="sk-..."
dbl-gateway serve --db .\data\trail.sqlite --host 127.0.0.1 --port 8010

Bash (macOS / Linux):

export OPENAI_API_KEY="sk-..."
dbl-gateway serve --db ./data/trail.sqlite --host 127.0.0.1 --port 8010

Notes:

  • The key is used for execution only.
  • INTENT admission, DECISION generation, and canonicalization are provider-independent.
  • The key is not persisted and is not written to the trail.
  • Execution failures (missing or invalid key) are recorded as observational EXECUTION events.
  • DECISION events remain authoritative regardless of execution outcome.

Local API docs (OpenAPI)

When the gateway is running, the interactive API docs are available at:

  • Swagger UI: http://127.0.0.1:8010/docs
  • OpenAPI JSON: http://127.0.0.1:8010/openapi.json

Quick verification:

  • Health: http://127.0.0.1:8010/healthz
  • Capabilities: http://127.0.0.1:8010/capabilities
  • Snapshot (first page): http://127.0.0.1:8010/snapshot?offset=0&limit=50&stream_id=default

Quick probes (PowerShell)

Health:

curl -s "http://127.0.0.1:8010/healthz"

Capabilities:

curl -s "http://127.0.0.1:8010/capabilities"

Snapshot (page through the trail):

curl -s "http://127.0.0.1:8010/snapshot?offset=0&limit=50&stream_id=default"
curl -s "http://127.0.0.1:8010/snapshot?offset=50&limit=50&stream_id=default"

Tail (SSE stream):

curl -N "http://127.0.0.1:8010/tail?since=0&stream_id=default"

Emit an INTENT (example):

$body = @{
  interface_version = 1
  correlation_id = [guid]::NewGuid().ToString()
  payload = @{
    stream_id = "default"
    lane = "ui"
    actor = "dev"
    intent_type = "ui.ping"
    payload = @{ text = "hello" }
  }
} | ConvertTo-Json -Depth 8

curl -s -X POST "http://127.0.0.1:8010/ingress/intent" `
  -H "content-type: application/json" `
  -d $body

Endpoints

Write:

  • POST /ingress/intent

Read:

  • GET /snapshot
  • GET /capabilities
  • GET /healthz

Git Hooks (Windows 11)The repository includes an enhanced pre-commit hook that enforces DBL boundaries and invariants.Quick usage (PowerShell):powershell# Normal commitgit commit -m "your message"# Explain mode (detailed violations)$env:DBL_HOOK_EXPLAIN = "1"; git commit -m "msg"# List validation rules$env:DBL_HOOK_LIST_RULES = "1"; git commit -m "test"See docs/GIT_HOOKS.md for full documentation.Key rules enforced:- BOUNDARY-001: No canonicalization logic in gateway- EVENT-001: Only INTENT, DECISION, EXECUTION, PROOF event kinds- POLICY-001: No observational data in PolicyContext

Environment contract

See docs/env_contract.md.

Validation against dbl-reference

See docs/validation_workflow.md.

Notes

  • The gateway is the only component that performs governance and execution.
  • All stabilization is expressed explicitly via DECISION events.
  • Boundary and UI clients do not import dbl-core or dbl-policy.
  • The gateway uses dbl-core for canonicalization and digest computation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbl_gateway-0.3.6.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbl_gateway-0.3.6-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file dbl_gateway-0.3.6.tar.gz.

File metadata

  • Download URL: dbl_gateway-0.3.6.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for dbl_gateway-0.3.6.tar.gz
Algorithm Hash digest
SHA256 abdb9bec2fbcfacaf91c4d6da2d38274dabceb6b8187997d76246fa8e5f8ec14
MD5 024f82bdf1d37ff650b489a3c5324eb5
BLAKE2b-256 6ead7d9bd40c8a4f4f390c0133026f852554d7d9845b8379d9a38a0abab7e013

See more details on using hashes here.

File details

Details for the file dbl_gateway-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: dbl_gateway-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for dbl_gateway-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b396279fa2a75c3ac9d736a220626d8cd364e560bddd1bb2a12bdbb0cee8a35d
MD5 f7e8baab33f31bb7a49d037b94f768f2
BLAKE2b-256 e5422cc21c822647eca90cc57c20e10dcb6987645b1a44080061ef0f16c2cedb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page