Skip to main content

JavaScript SDK

Browser and Node.js SDK for Zeq OS. Provides ZeqondClock for local temporal synchronization and wraps the REST API for computation.

Installation

npm install @zeq-os/sdk

How it works

Free (no account needed):

  • Browse all operator equations — standard physics formulas, fully public
  • Use ZeqondClock locally for HulyaPulse synchronization
  • Read GET /api/zeq/phase for live temporal state

Requires an account:

  • Execute operators — computation runs on our servers
  • Run the 7-Step Wizard — server-side physics processing
  • All compute is billed; the framework knowledge is free

Authentication

const BASE = "http://localhost";  // your Zeq OS instance

// Register (first time)
const { token } = await fetch(`${BASE}/api/users/register`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ displayName: "Alice", equation: "x^2 + sin(y*pi) + phi" })
}).then(r => r.json());

// Login (same equation = same identity, every time)
const { token: jwt } = await fetch(`${BASE}/api/users/login`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ equation: "x^2 + sin(y*pi) + phi" })
}).then(r => r.json());

const authHeaders = { "Authorization": `Bearer ${jwt}`, "Content-Type": "application/json" };

Quick Start

const BASE = "http://localhost";
const authHeaders = { "Authorization": "Bearer your-jwt", "Content-Type": "application/json" };

// 1. Browse operators — public, no token needed
const { operators } = await fetch(`${BASE}/api/zeq/operators`).then(r => r.json());
operators.slice(0, 3).forEach(op =>
console.log(`${op.id.padEnd(6)} ${op.name.padEnd(30)} ${op.equation}`)
);
// QM1 Schrödinger Equation iℏ ∂ψ/∂t = −ℏ²/2m ∂²ψ/∂x² + Vψ
// NM18 Newton's Second Law F = ma
// GR31 Einstein Field Equations G_μν + Λg_μν = 8πT_μν

// 2. Live HulyaPulse state — public
const phase = await fetch(`${BASE}/api/zeq/phase`).then(r => r.json());
console.log(`Phase: ${phase.phase.toFixed(4)} KO42: ${phase.ko42.toFixed(6)} Zeqond: ${phase.zeqond}`);

// 3. Execute an operator — requires account
const result = await fetch(`${BASE}/api/zeq/operators/execute?operator=NM21`, {
method: "POST", headers: authHeaders,
body: JSON.stringify({ params: { G: 6.674e-11, m1: 5.97e24, m2: 7.35e22, r: 3.84e8 } })
}).then(r => r.json());
console.log(`F = ${result.value.toExponential(3)} N`);

// 4. 7-Step Wizard — requires account
const state = await fetch(`${BASE}/api/7step/run`, {
method: "POST", headers: authHeaders,
body: JSON.stringify({ query: "gravitational time dilation near Earth", operators: ["KO42", "GR37"], mode: "basic" })
}).then(r => r.json());
console.log(`Operators: ${state.selected_operators} Master sum: ${state.master_sum}`);

SDK Classes

ZeqSDK

Wraps POST /api/7step/run into a single call.

import { ZeqSDK } from '@zeq-os/sdk';

const sdk = new ZeqSDK({ token: 'your-jwt-token' });
const result = await sdk.execute("gravitational time dilation at r=10km");

console.log(result.value);
console.log(result.selectedOperators); // ["KO42", "GR37", ...]
console.log(result.precision);

ZeqondClock

Local temporal engine — runs in browser or Node.js, no server, no auth.

import { ZeqondClock } from '@zeq-os/sdk';

const clock = new ZeqondClock();

console.log(clock.currentZeqond()); // Zeqonds since Unix epoch
console.log(clock.phase()); // [0, 1) within current Zeqond
console.log(clock.unixToZeqond(Date.now() / 1000));

// Zeq Equation modulation: R(t) = S(t) × [1 + α·sin(2πft)]
// f = 1.287 Hz, α = 0.00129
console.log(clock.modulate(9.80665)); // phase-dependent result

// KO42 Metric Tensioner
console.log(clock.ko42Automatic()); // α · sin(2π × 1.287 × t)

// Subscribe to every Zeqond tick (0.777s)
clock.tick(() => {
console.log(`Tick — phase ${clock.phase().toFixed(3)}`);
});

OperatorRegistry

Browse operators; equations are fully public.

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

const registry = new OperatorRegistry();
const qm1 = registry.get("QM1");
console.log(qm1.name); // "Schrödinger Equation"
console.log(qm1.equation); // "iℏ ∂ψ/∂t = −ℏ²/2m ∂²ψ/∂x² + Vψ"
console.log(qm1.category); // "quantum_mechanics"

React Patterns

Real-Time HulyaPulse Display

import { useEffect, useState } from 'react';
import { ZeqondClock } from '@zeq-os/sdk';

function HulyaPulseMonitor() {
const [phase, setPhase] = useState(0);

useEffect(() => {
const clock = new ZeqondClock();
const id = setInterval(() => setPhase(clock.phase()), 50);
return () => clearInterval(id);
}, []);

return (
<div>
<p>Phase: {(phase * 100).toFixed(1)}%</p>
<div style={{ width: `${phase * 100}%`, height: 4, background: '#06b6d4' }} />
</div>
);
}

Physics Computation

function PhysicsCalculator({ token }) {
const [result, setResult] = useState(null);

const compute = async (query) => {
const res = await fetch(`${BASE}/api/7step/run`, {
method: "POST",
headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({ query, mode: "basic" })
}).then(r => r.json());
setResult(res);
};

return (
<div>
<button onClick={() => compute("orbital velocity ISS at 408km")}>Compute</button>
{result && <pre>{JSON.stringify(result, null, 2)}</pre>}
</div>
);
}

Framework Equations

Published foundation of Zeq OS (Zenodo):

Zeq Equation

R(t) = S(t) × [1 + α × sin(2π × 1.287 × t)]
f = 1.287 Hz T = 0.777 s α = 0.00129

KO42 Metric Tensioner

KO42.1 (Automatic): α × sin(2π × 1.287 × t)
KO42.2 (Manual): β × sin(2π × 1.287 × t)

HULYAS Master Equation

□(φ) − μ²(r)φ − λφ³ − exp(−φ/φ_c)
+ φ₄₂ × Σ(Cₖ(φ)) = T^μ_μ + βF·F + J_ext

REST API Reference

MethodEndpointAuthDescription
POST/api/users/registerRegister with equation
POST/api/users/loginLogin, receive JWT
GET/api/zeq/phaseLive HulyaPulse phase + KO42
GET/api/zeq/operatorsAll operators with equations (public)
GET/api/zeq/operators/:idSingle operator with equation
POST/api/zeq/operators/execute?operator=IDRequiredExecute (billed)
POST/api/7step/runRequired7-Step Wizard (billed)
POST/api/7step/parseRequiredParse query → operators
GET/api/zeq/stateRequiredFull live state
GET/api/healthHealth check

Testing

cd sdk/javascript && npm test