Metadata-Version: 2.4
Name: continuum-engine-client
Version: 1.0.4
Summary: Cut LLM runaway token costs by up to 82% at the edge. Zero-Trust FinOps routing middleware & BYOD state controller for Gemini / Vertex AI.
Author: individual-app-developers-cmck
Project-URL: Homepage, https://github.com/individual-app-developers-cmck/continuum-engine
Project-URL: Repository, https://github.com/individual-app-developers-cmck/continuum-engine
Project-URL: Bug Tracker, https://github.com/individual-app-developers-cmck/continuum-engine/issues
Keywords: finops,zero-trust,agentic-ai,rag,llm-gateway,token-optimization,bff
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Security
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.1

# Continuum Engine

**An Enterprise FinOps & Zero-Trust Routing Core for Agentic AI Infrastructure.**

When deploying Agentic AI or Dynamic Grounding (RAG) at scale, the underlying infrastructure often faces a critical threat: **unpredictable and invisible token runaway.** As autonomous models deeply traverse search networks and maintain massive context behind the scenes, a single user prompt can silently burn thousands of tokens, transforming your intelligent infrastructure into a deficit-generating liability.

**Continuum Engine** is an independent, client-side routing middleware (Core IP) that physically isolates and controls this token consumption at the edge layer.

By integrating this engine into your BFF (Backend For Frontend) or package environment, you can transparently visualize the "hidden labor" of Superintelligence (SI) on your terminal, strictly cap your infrastructure costs before they reach your billing account, and optionally sync inference history directly to your own private Google Drive via **Client-Side Zero-Trust MCP**—without ever exposing your OAuth tokens or conversation logs to our servers.

![Continuum Engine Architecture](https://raw.githubusercontent.com/individual-app-developers-cmck/continuum-engine/main/architecture.jpg)

## 1. FinOps Telemetry & Zero-Trust MCP Verification

### 🎥 Live FinOps Telemetry (Edge Purge in Action)

https://github.com/user-attachments/assets/551ab40e-1da2-49c9-9ac0-b2095859d98c

Engineers trust terminal logs, not marketing copy. When you route requests through the Continuum Engine, the client kernel dismantles the black box of inference costs.

It explicitly reveals the physical compute breakdown behind the model's output, proves client-side Zero-Trust Google Drive synchronization, and exposes the exact amount of CapEx saved per query.

```text
==================================================
🤖 [AI RESPONSE]
==================================================
(Verified authoritative engineering response...)
--------------------------------------------------
🔗 [VERIFIED PRIMARY SOURCES]
  1. Official Cloud Architecture Documentation
     https://[Authorized-Enterprise-Domain]/...
--------------------------------------------------
🛡️ [ZERO-TRUST MCP SYNC] Saved directly to your Google Drive (updated: <YOUR_PRIVATE_FILE_ID>)
   👉 https://drive.google.com/file/d/<YOUR_PRIVATE_FILE_ID>/view?usp=drivesdk
--------------------------------------------------
🔍 [FINOPS TELEMETRY BREAKDOWN]
  ├─ T_input (Optimized Prompt)     : 210 tokens
  ├─ T_grounding (Dynamic Search)   : 4,820 tokens  <-- The hidden labor
  └─ T_output (Generated Result)    : 640 tokens

  🛡️ Edge Purge (Tokens Prevented) : 1,200 tokens
  📉 Net Billed Consumption        : 5,670 tokens
==================================================
💳 Quota Balance: 799 requests remaining
==================================================
```

## 2. Try the Experience (Zero-Cost Local Simulator)

If you wish to experience the "feel" of Continuum Engine's FinOps telemetry before acquiring a production license, you can run our offline simulator.

> **Note:** This demo is a completely offline simulation. It makes zero network requests to the live backend, ensuring it consumes absolutely zero infrastructure CapEx.

Clone the repository and run the simulator directly in your terminal:

```bash
git clone https://github.com/individual-app-developers-cmck/continuum-engine.git
cd continuum-engine
```

**For Node.js users:**
```bash
node run_simulator.js "What is Zero-Trust?"
# Or directly after `npm install continuum-engine-client`:
node node_modules/continuum-engine-client/run_simulator.js "What is Zero-Trust?"
```

**For Python users:**
```bash
python run_simulator.py "What is Zero-Trust?"
# Or directly after `pip install continuum-engine-client`:
python -m continuum_engine_client.run_simulator "What is Zero-Trust?"
```

## 3. Acquire & Integrate (From Checkout to System in 3 Minutes)

- **$60 One-Time Acquisition**: Comes with a mathematically guaranteed 800-inference-rally hard cap.
- **No Subscriptions**: Secure your cloud infrastructure today, permanently.
- **Seamless Cross-Platform Integration**: Native SDKs for **Node.js (npm — 0 external dependencies)** and **Python (PyPI)** with shared Zero-Trust MCP token cache compatibility.

_Protected by Stripe Checkout & Zero-Trust Origin Verification_

[![Stripe Checkout](https://img.shields.io/badge/Stripe%20Checkout-Activate%20Private%20Engine%20%28%2460%29-635BFF?style=for-the-badge&logo=stripe&logoColor=white)](https://buy.stripe.com/eVq28t2qB4mneGfc336sw00)

We respect your time. Once you acquire the license, securing your infrastructure takes only three steps:

1. **Checkout & Provisioning**: Complete the $60 transaction above. You will be immediately redirected to a secure `setup.html` console where your private API key and dedicated endpoint are instantly provisioned.

   *(Note: The `setup.html` console, along with the simulator and integration examples, is hosted in our [GitHub Repository](https://github.com/individual-app-developers-cmck/continuum-engine). If you are building a production BFF, clone the repository to access the core integration files.)*

2. **Install the Client Kernel**:

   ```bash
   npm install continuum-engine-client
   # or
   pip install continuum-engine-client
   ```

3. **Drop it into your system (Pure Stateless or Zero-Trust Google Drive MCP)**:
   Replace the variables with your provisioned credentials.

   **Node.js:**
   ```javascript
   const ContinuumClient = require("continuum-engine-client");

   const client = new ContinuumClient(
     process.env.CONTINUUM_ENDPOINT,
     "<HEADER_REVEALED_POST_PURCHASE>",
     process.env.CONTINUUM_API_KEY,
     {
       // Optional: Client-Side Zero-Trust Google Drive MCP (OAuth 2.0 + PKCE)
       // Omit this 4th argument for Pure Stateless Mode.
       clientId: process.env.GOOGLE_OAUTH_CLIENT_ID,
       clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET,
       fileName: "Continuum_Engine_History.txt",
     }
   );

   // Terminal validation (.ask) or programmatic BFF integration (.query)
   const result = await client.query("Summarize the latest Zero-Trust architecture.");
   ```

   **Python:**
   ```python
   import os
   from continuum_engine_client import ContinuumClient

   client = ContinuumClient(
       os.environ["CONTINUUM_ENDPOINT"],
       "<HEADER_REVEALED_POST_PURCHASE>",
       os.environ["CONTINUUM_API_KEY"],
       mcp_config={
           # Optional: Client-Side Zero-Trust Google Drive MCP (OAuth 2.0 + PKCE)
           # Omit mcp_config for Pure Stateless Mode.
           "client_id": os.environ["GOOGLE_OAUTH_CLIENT_ID"],
           "client_secret": os.environ["GOOGLE_OAUTH_CLIENT_SECRET"],
           "file_name": "Continuum_Engine_History.txt",
       },
   )

   # Terminal validation (.ask) or programmatic BFF integration (.query)
   result = client.query("Summarize the latest Zero-Trust architecture.")
   ```

## 4. Core Capabilities & Architecture

The repository distributes the open-source client kernels (`client-kernel.js` + `mcp-drive.js` for Node.js, `client_kernel.py` + `mcp_drive.py` for Python). These lightweight kernels connect to the Continuum Engine Core API, a closed intellectual property designed to enforce hardware-level quotas and data sovereignty.

### A. Data Sovereignty (The Power of Choice)

Based on strict Zero-Trust principles, **you retain absolute control over your data footprint.** The engine supports three distinct memory architectures:

- **Zero-Trust Client-Side Google Drive MCP (Recommended):** The Continuum backend executes in pure Stateless mode (`docId: null`). Your local client kernel authenticates directly with Google using **OAuth 2.0 + PKCE (`S256`) + CSRF `state` verification** over a strictly bound RFC 8252 loopback (`127.0.0.1:53682`, with 120s auto-timeout and remote/SSH URL-paste fallback) and syncs inference logs directly to your private Google Drive using the minimal `drive.file` scope. Neither your OAuth tokens nor your conversation logs ever touch Continuum servers. Local token caches (`.continuum_mcp_token.json`, `0600` permissions) are seamlessly interoperable between the Node.js and Python SDKs.
- **Pure Stateless Mode (Amnesia):** By omitting the MCP configuration and Doc ID, inference runs entirely ephemerally with zero conversation log retention.
- **Legacy Stateful Mode (BYOD - Bring Your Own Document):** By providing an existing Google Doc ID string, inferences are synced via legacy document cooling for backward compatibility.

### B. Automated Perimeter Defenses (Gate 0 & 0.5)

- **Zero-Tolerance Exploit Defense:** The engine operates a Gate 0 interceptor. Malicious payloads, prompt injections, or protocol guessing are blocked before they consume downstream resources.
- **180s Circuit Breaker:** To prevent infinite search loops during dynamic grounding, a strict 180-second hard execution limit is enforced.

_(Note: Automated vulnerability scans or prompt injection payloads will trigger immediate token revocation without refund.)_

## 5. Operational Policies (Read Before Use)

To guarantee microsecond-level edge response and enforce strict FinOps predictability, the gateway applies non-negotiable operational controls:

- **Service Availability (Geographic Scope):** This middleware and associated API keys are exclusively intended for global enterprise environments and are **strictly not available for use or purchase within Japan**. Access from restricted jurisdictions is filtered at the gateway level.
- **Strict Quota Cap:** The 800-request quota is a mathematically enforced hard cap designed to safeguard against autonomous loop runaways. Once depleted, a new license acquisition is required.
- **Zero-Support Policy:** Engineered exclusively for experienced systems engineers building BFFs and AI infrastructures. We provide no interactive debugging, manual onboarding, or post-revocation appeals.

> 💬 **Action-Oriented Builders' Guild:** [Read the Charter & Join the Discussion here](https://github.com/individual-app-developers-cmck/continuum-engine/discussions/1)
