Skip to main content

Integrating Zeq OS Into Your Application

Zeq OS is middleware. It sits between your application and the physics, handling operator selection, temporal synchronization, and precision verification. This guide shows how to integrate it into different types of applications.

Architecture Pattern

Your Application


Zeq OS SDK (any language)

├── HulyaSync (temporal layer)
├── ZeqProcessor (computation engine)
├── OperatorRegistry (1,576 operators)
└── ZeqState (result snapshots)

Web Application (JavaScript)

Add physics computation to a web app:

import { ZeqProcessor, HulyaSync, OperatorRegistry } from '@zeq-os/sdk';

// Initialize once
const processor = new ZeqProcessor();
const sync = new HulyaSync();
const registry = await OperatorRegistry.default();

// Handle a physics query from the user
async function handlePhysicsQuery(query) {
const state = processor.processQuery(query);

return {
answer: {
domains: state.domains,
operators: state.selectedOperators,
masterSum: state.masterSum,
coherence: state.phaseCoherence,
},
timing: {
zeqond: sync.getZeqond(),
phase: sync.currentPhase(),
},
precision: state.phaseCoherence <= 0.1 ? 'verified' : 'warning',
};
}

REST API (Python + FastAPI)

Expose Zeq OS as an API endpoint:

from fastapi import FastAPI
from zeq_os import ZeqProcessor, HulyaSync, OperatorRegistry

app = FastAPI(title="My Physics API")
processor = ZeqProcessor()
sync = HulyaSync()
registry = OperatorRegistry.default()

@app.get("/compute")
def compute(query: str, domain: str = None):
hints = [domain] if domain else None
state = processor.process(query, domain_hints=hints)
return {
"query": query,
"domains": state.domains,
"operators": state.selected_operators,
"master_sum": state.master_sum,
"phase_coherence": state.phase_coherence,
"zeqond": state.zeqond,
"precision_met": state.precision_check(state.master_sum, 1.0)["within_target"],
}

@app.get("/operators")
def list_operators(category: str = None):
if category:
ops = registry.find_by_category(category)
else:
ops = registry.all()
return {"count": len(ops), "operators": [{"id": o.id, "category": o.category, "description": o.description} for o in ops]}

@app.get("/pulse")
def pulse():
return {
"zeqond": sync.get_zeqond(),
"phase": sync.current_phase(),
"tick": sync.daemon_tick(),
}

High-Performance Service (Rust)

Build a concurrent physics service:

use zeq_os::{ZeqProcessor, HulyaSync};
use std::sync::Arc;

fn main() {
let processor = Arc::new(ZeqProcessor::new());
let sync = HulyaSync::new();

// Process multiple queries concurrently
let queries = vec![
"gravitational time dilation at r=10km",
"quantum tunneling through 5eV barrier",
"relativistic mass at 0.9c",
];

for query in queries {
let p = Arc::clone(&processor);
let result = p.process_query(query, None);
println!("{}: master_sum={:.6}", query, result.master_sum);
}

println!("{}", sync.daemon_tick());
}

WebAssembly (Browser)

Run physics computations client-side with zero server dependency:

<!DOCTYPE html>
<html>
<body>
<input id="query" placeholder="Enter physics query..." />
<button onclick="compute()">Compute</button>
<pre id="result"></pre>

<script type="module">
import init, { process } from './pkg/zeq_os.js';
await init();

window.compute = function() {
const query = document.getElementById('query').value;
const result = process(query);
document.getElementById('result').textContent = JSON.stringify(result, null, 2);
};
</script>
</body>
</html>

Microservice (Go)

Use Zeq OS in a Go microservice:

package main

import (
"encoding/json"
"net/http"
zeq "github.com/hulyasmath/zeq-os/sdk/go/pkg/core"
)

func main() {
sync := zeq.NewHulyaSync()

http.HandleFunc("/pulse", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]interface{}{
"zeqond": sync.GetZeqond(),
"phase": sync.CurrentPhase(),
"ko42": sync.KO42Automatic(),
"tick": sync.DaemonTick(),
})
})

http.ListenAndServe(":8080", nil)
}

Real-Time System (C++)

Embed Zeq OS in a real-time simulation:

#include <zeqos/core/sync.hpp>

class PhysicsSimulation {
zeqos::HulyaSync sync;

public:
void tick() {
double phase = sync.current_phase();
double ko42 = sync.ko42_automatic();

// Use phase to synchronize simulation state
// Use ko42 as metric tensioner for computations
update_state(phase, ko42);
}
};

Using the Self-Hosted API

If you're running the Zeq OS Hub, you can use the REST API instead of embedding an SDK:

# Get all operators
curl -H "X-API-Key: $ZEQ_API_KEY" http://your-domain/api/v1/operators/all

# Search operators by category
curl -H "X-API-Key: $ZEQ_API_KEY" http://your-domain/api/v1/operators/category/quantum

# Check pulse
curl http://your-domain/api/v1/status

# WebSocket for real-time sync
wscat -c ws://your-domain/ws

Key Principles

  1. KO42 is always mandatory — Every computation starts with the metric tensioner
  2. Max 4 operators — KO42 plus up to 3 additional operators per computation
  3. 0.1% precision target — All results verified against this threshold
  4. Temporal synchronization — Use HulyaSync to keep computations in phase
  5. Language-agnostic — Same physics, same operators, same protocol — any language