Skip to main content

Go SDK

The Go SDK provides HulyaSync for temporal synchronization at 1.287 Hz. Ideal for microservices, daemons, and backends that need HulyaPulse alignment. For operator execution, call the REST API.

Installation

go get github.com/hulyasmath/zeq-os/sdk/go

Or from the hub:

import "zeq-os-hub/sdk/go/pkg/core"

Authentication

package main

import (
"bytes"
"encoding/json"
"net/http"
)

const BASE = "http://localhost"

func login(equation string) (string, error) {
body, _ := json.Marshal(map[string]string{"equation": equation})
resp, err := http.Post(BASE+"/api/users/login", "application/json", bytes.NewBuffer(body))
if err != nil { return "", err }
defer resp.Body.Close()
var result map[string]string
json.NewDecoder(resp.Body).Decode(&result)
return result["token"], nil
}

Quick Start

package main

import (
"encoding/json"
"fmt"
"net/http"
"strings"
zeq "zeq-os-hub/sdk/go/pkg/core"
)

func main() {
// ── Local temporal sync (no server, no auth) ───────────────────────────
sync := zeq.NewHulyaSync()

fmt.Printf("Zeqond: %d\n", sync.GetZeqond())
fmt.Printf("Phase: %.4f\n", sync.CurrentPhase())
fmt.Printf("KO42: %.6f\n", sync.KO42Automatic())

// Zeq Equation modulation: R(t) = S(t) × [1 + α·sin(2πft)]
fmt.Printf("g modulated: %.6f\n", sync.Modulate(9.80665))
fmt.Println(sync.DaemonTick())

// ── Browse operators (no auth — equations are public) ──────────────────
resp, _ := http.Get(BASE + "/api/zeq/operators")
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
for i, op := range data["operators"].([]interface{}) {
m := op.(map[string]interface{})
fmt.Printf("%-6s %-30s %s\n", m["id"], m["name"], m["equation"])
if i == 2 { break }
}

// ── Execute operator (requires account) ───────────────────────────────
token := "your-jwt-token"
body := `{"params":{"G":6.674e-11,"m1":5.97e24,"m2":7.35e22,"r":3.84e8}}`
req, _ := http.NewRequest("POST", BASE+"/api/zeq/operators/execute?operator=NM21",
strings.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
result, _ := http.DefaultClient.Do(req)
defer result.Body.Close()
var execResult map[string]interface{}
json.NewDecoder(result.Body).Decode(&execResult)
fmt.Printf("F = %v N\n", execResult["value"])

// ── 7-Step Wizard (requires account) ──────────────────────────────────
wizBody := `{"query":"gravitational time dilation near Earth","operators":["KO42","GR37"],"mode":"basic"}`
req2, _ := http.NewRequest("POST", BASE+"/api/7step/run", strings.NewReader(wizBody))
req2.Header.Set("Authorization", "Bearer "+token)
req2.Header.Set("Content-Type", "application/json")
state, _ := http.DefaultClient.Do(req2)
defer state.Body.Close()
var stateResult map[string]interface{}
json.NewDecoder(state.Body).Decode(&stateResult)
fmt.Printf("Operators: %v\n", stateResult["selected_operators"])
fmt.Printf("Master sum: %v\n", stateResult["master_sum"])
}

HulyaSync API

const (
PulseFrequency = 1.287 // Hz
ZeqondS = 0.777 // seconds
AlphaModulation = 0.00129 // modulation depth
)

type HulyaSync struct {
Frequency float64
Period float64
Alpha float64
}

func NewHulyaSync() *HulyaSync
func (s *HulyaSync) CurrentPhase() float64 // [0, 1)
func (s *HulyaSync) CurrentPhaseRadians() float64 // [0, 2π)
func (s *HulyaSync) Modulate(value float64) float64 // R(t) = S(t)[1 + α·sin(2πft)]
func (s *HulyaSync) KO42Automatic() float64 // α · sin(2π × 1.287 × t)
func (s *HulyaSync) GetZeqond() int64 // Zeqond count since epoch
func (s *HulyaSync) DaemonTick() string // Daemon announcement

Use Cases

  • Microservices needing HulyaPulse temporal alignment on every request
  • Daemon processes that tick at exactly 1.287 Hz
  • API gateways stamping Zeqond timestamps on physics requests
  • Backend services calling the Zeq OS compute API and relaying results

Architecture

sdk/go/
├── go.mod
└── pkg/
└── core/
└── sync.go # HulyaSync — 1.287 Hz engine + KO42