Skip to content

SakuttoWorks/agent-commerce-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏴‍☠️ Agent-Commerce-Gateway (Layer A: Edge Gateway)

Status Platform License Compliance

High-performance HTTP Proxy and Defense-in-Depth Edge Layer for Project GHOST SHIP.

Boundary Declaration: proxy (Layer A) and core (Layer B) are strictly pure infrastructure and engine layers. This gateway does not process data directly; it acts exclusively as the perimeter defense, authentication, and billing interceptor before routing traffic to the internal normalization engine.


🛡️ Role in Infrastructure (Defense in Depth)

We employ a Zero-Trust Hybrid Architecture to ensure speed, security, and scalability. All traffic lacking the injected X-Internal-Secret and X-Tenant-Id is dropped at the edge.

graph TD
    A[🤖 AI Agent / Client] -->|HTTP POST| B(Layer A: Edge Gateway)
    B -->|1. Auth Validate| Cache[(CF Cache)]
    B -->|2. Prompt Injection Guard| Shield{Block/Pass}
    Shield -->|Pass| C[3. Inject X-Internal-Secret]
    C -->|Proxy Request| D(Layer B: Core Engine)
    C -.->|4. executionCtx.waitUntil| P[Polar.sh Metered Billing]
Loading

💸 Asynchronous Metered Billing Flow

Billing is handled natively at the edge without adding latency to the AI agent's request.

  • Validation: Extracts the API key from the Authorization: Bearer header and checks validity via Polar.sh (or internal Edge Cache).
  • Proxy: Forwards the validated request to Layer B.
  • Event Ingestion: Uses Cloudflare's executionCtx.waitUntil() to asynchronously send an api_request event ($0.10/call) to the Polar.sh API.
  • Resilience: If the billing request fails, the agent still receives the normalized data, ensuring 100% uptime for the user experience.

🧪 E2E Verification & Proof Records

The infrastructure has passed complete penetration and functional testing.

✅ Normal Traffic (200 OK)

Successfully validated Polar.sh key, appended Zero-Trust headers, and proxied to Layer B.

{
  "timestamp": "2026-03-XXT10:00:00Z",
  "level": "INFO",
  "event": "proxy_success",
  "tenant_id": "8f3a...291b",
  "status": 200,
  "billing_event": "queued"
}

🚫 Prompt Injection Guard (403 Forbidden)

Successfully intercepted and dropped a payload containing "ignore previous instructions" at the edge, costing $0 in compute and 0 load on Layer B.

JSON

{
  "timestamp": "2026-03-XXT10:05:12Z",
  "level": "WARN",
  "event": "security_violation",
  "reason": "Prompt Injection Attempt Blocked",
  "tenant_id": "anonymous_tenant",
  "status": 403
}

🛠️ Tech Stack (Edge Specifications)

  • Runtime: Cloudflare Workers (TypeScript)
  • Framework: Hono
  • Protocol: HTTP Proxy (MCP Compatible)
  • Security: Prompt Injection Shield, R2 Privacy-Safe Audit Logging, Strict CORS.

⚡ Quick Start

Install dependencies

npm install

Local development

npm run dev

Deploy to production

npx wrangler deploy --env production

🤖 Discovery for Agents


⚖️ Legal & Compliance

This service is a pure data processing infrastructure, NOT an advisory service.
Please read our LEGAL.md carefully.

  • We do NOT provide analytical predictions, automated decision-making, or specialized advisory.
  • We do NOT maintain proprietary databases or closed-source intelligence feeds.
  • The "Commerce" in our name refers strictly to our API Metered Billing Infrastructure for developers.

🔗 Ecosystem & Architecture Links


💖 Support the Project

If this infrastructure helped you save time or scale your AI agents, consider supporting the development! Your support helps keep this project highly maintained and secure.

Support via Polar.sh Sponsor on GitHub

© 2026 Sakutto Works - Standardizing the Semantic Web for Agents.

About

Secure Edge Gateway and Governance Layer for Project GHOST SHIP. Handles request sanitization, HTTP Proxy routing (MCP Compatible), and API quota management.

Topics

Resources

License

Stars

Watchers

Forks

Contributors