Documentation
¶
Overview ¶
Package cloud is the unified Hanzo Cloud binary per HIP-0106.
One Go binary mounts every Hanzo-native subsystem (iam, base, kms, commerce, ai, gateway, o11y, vfs, mq, dns, amqp, mcp, ...) via the canonical Mount(app *zip.App, deps cloud.Deps) error contract. Brand, enabled subsystems, and tenant scope are deployment configuration; the binary is the same artifact across every white-label deployment.
Per HIP-0106 — github.com/hanzoai/HIPs/blob/main/HIPs/hip-0106-unified-hanzo-cloud-binary.md.
Index ¶
- Variables
- func MountAll(app any, cfg *Config, deps Deps) error
- func Register(name string, order int, mount MountFunc)
- func Serve(enable []string) error
- type AIClient
- type BaseClient
- type ChatRequest
- type ChatResponse
- type Claims
- type CommerceClient
- type Config
- type Counter
- type DBHandle
- type Deps
- type IAMClient
- type IntentRequest
- type IntentResponse
- type IntentStatus
- type KMSClient
- type LicenseEntitlement
- type MQClient
- type MountFunc
- type MountSpec
- type O11yClient
- type Org
- type PaymentsClient
- type Span
- type TenantConfig
- type Timing
- type User
- type VFSClient
- type VaultChargeRequest
- type VaultChargeResponse
- type VaultClient
Constants ¶
This section is empty.
Variables ¶
var Registry []MountSpec
Registry is the in-process subsystem registry. Subsystems register via init() functions in their respective packages OR cmd/cloud/main.go can explicitly enumerate them. Either pattern works.
Functions ¶
func MountAll ¶
MountAll iterates the registry in order and calls Mount() on each enabled subsystem.
func Serve ¶
Serve boots the canonical compose root and mounts the selected subsystems.
This is the ONE place the cloud-server body lives. cmd/cloud (the full fused surface) and every `hanzo <svc>` subcommand share it; no boot logic is duplicated per entrypoint.
enable==nil ⇒ honor cfg.Enable from flags/env (cloud mode; empty = all). enable!=nil ⇒ force exactly that set (single-service mode), overriding --enable so `hanzo kms` is unambiguous.
Serve registers the HIP-0106 liveness contract (GET /v1/<name>/health for every enabled subsystem) before MountAll, runs the canonical middleware pipeline (Recover → RequestID → Logger), and shuts down gracefully on SIGINT/SIGTERM.
Types ¶
type BaseClient ¶
type BaseClient = types.BaseClient
type ChatRequest ¶
type ChatRequest = types.ChatRequest
type ChatResponse ¶
type ChatResponse = types.ChatResponse
type CommerceClient ¶
type CommerceClient = types.CommerceClient
type Config ¶
type Config struct {
// Enable lists subsystems to mount this run. Empty = all enabled.
// Example: --enable=iam,base,kms,commerce,ai,gateway,o11y
Enable []string
// Brand is the white-label brand identifier.
Brand string
// Domain is the deployment's primary public domain.
Domain string
// IAMIssuer is the JWKS issuer for JWT validation (usually iam.hanzo.ai).
IAMIssuer string
// KMSMasterKeyRef points at the KMS master key for per-tenant DEK derivation.
KMSMasterKeyRef string
// DataDir is the on-disk data root.
DataDir string
// ListenAddr is the public HTTP listener (default :8080).
ListenAddr string
// ZAPListenAddr is the ZAP-RPC listener (default :9653).
ZAPListenAddr string
// HealthListenAddr is the health/metrics listener (default :9090).
HealthListenAddr string
// AdminListenAddr is the admin endpoint (default :8081, gated by IAM admin).
AdminListenAddr string
// Endpoints for out-of-process subsystems (payments, vault). Empty
// means the subsystem is disabled OR the deployment expects a default
// service-discovery resolution.
PaymentsZAPAddr string
VaultZAPAddr string
// ZAP RPC endpoints for subsystems that are NOT enabled in this
// process but are still needed by an enabled subsystem. Empty
// means "no remote endpoint" — the client falls back to the
// disabled stub which fails closed with a clear error.
//
// Convention: <subsystem>.<env>.<deployment>.svc:9653 — the same
// inter-subsystem listener port the unified binary exposes. The
// transport is hanzoai/zap, never JSON.
IAMZAPAddr string
KMSZAPAddr string
BaseZAPAddr string
CommerceZAPAddr string
AIZAPAddr string
O11yZAPAddr string
VFSZAPAddr string
MQZAPAddr string
}
Config is the cloud binary's startup configuration. Drives which subsystems mount, what brand surface to serve, and where data lives.
func LoadConfig ¶
func LoadConfig() *Config
LoadConfig reads flags + env into a Config. Flags override env.
type Deps ¶
type Deps struct {
// Logger is the canonical Hanzo logger (luxfi/log). Subsystems derive
// scoped child loggers from this.
Logger luxlog.Logger
// Brand is the white-label brand identifier for this deployment.
// Values: "hanzo", "lux", "zoo", "osage", "pars", or any customer brand.
Brand string
// Domain is the deployment's primary domain (e.g. "api.hanzo.ai",
// "api.osage.cloud"). Subsystems use this to scope URLs in responses.
Domain string
// DataDir is the per-deployment data root. Per-tenant SQLite files
// land at {DataDir}/orgs/{orgSlug}/{service}.db per HIP-0302.
DataDir string
// Subsystem clients — populated by BuildDeps based on enabled subsystems.
// Each is an interface with both in-process and ZAP-RPC implementations.
IAM IAMClient
KMS KMSClient
Base BaseClient
Commerce CommerceClient
AI AIClient
O11y O11yClient
VFS VFSClient
MQ MQClient
// Payments + Vault stay out-of-process (PCI scope isolation per
// HIP-0106). These clients always resolve to ZAP-RPC implementations,
// never in-process.
Payments PaymentsClient
Vault VaultClient
}
Deps is the shared dependency surface passed to every subsystem's Mount(app, deps) function. Subsystems consume only what they need.
In-process: each Client below resolves to a direct Go method-call implementation. Out-of-process (legacy split deploys): the same Client resolves to a ZAP-RPC implementation. Subsystem code does not branch on which mode; the interface is the contract.
func BuildDeps ¶
BuildDeps constructs the Deps used by every subsystem's Mount(app, deps).
Wiring rules per HIP-0106 inter-subsystem contract:
If the subsystem is enabled in this process, the Client field is left nil here. The subsystem's own Mount() will install a typed in-process Client into Deps via the SetClient helpers exposed by this package. (Subsystem Mounts run after BuildDeps; they have full access to construct their concrete implementation, and the resulting object goes back into Deps for everyone else to call.)
If the subsystem is disabled but cfg has a non-empty ZAP RPC endpoint for it, the Client field gets a ZAP-RPC stub targeting that endpoint. Subsystem code calls deps.X.Foo(...) without knowing the call goes over the wire.
If the subsystem is disabled AND there is no endpoint, the Client field gets a "disabled" stub that fails closed with a clear error. Mount-time consumers detect this with clients.IsDisabled(err) and log a friendly "dep X needed by Y not configured" message.
JSON does not appear in any of these paths. Inter-subsystem calls are ZAP-typed Go values either via direct method dispatch (mode 1) or via ZAP RPC over the wire (mode 2). JSON happens only at the gateway/ingress edge, through the hanzoai/zip jsonenc helper.
Payments and Vault are special: they are NEVER in-process per HIP-0106 solo-vault CDE. Their clients always resolve via clients.PaymentsRPCAt / clients.VaultRPCAt; the disabled stub fires when no endpoint is configured.
type IntentRequest ¶
type IntentRequest = types.IntentRequest
type IntentResponse ¶
type IntentResponse = types.IntentResponse
type IntentStatus ¶
type IntentStatus = types.IntentStatus
type LicenseEntitlement ¶
type LicenseEntitlement = types.LicenseEntitlement
type MountFunc ¶
type MountFunc func(app any, deps Deps) error // app is *zip.App; using any here to avoid an import cycle in pkg/cloud
MountFunc is the canonical signature every subsystem exposes per HIP-0106. Each Hanzo Go service ships a top-level `Mount` symbol matching this signature; cmd/cloud/main.go imports the package and calls it.
type MountSpec ¶
MountSpec describes one subsystem registered for mounting. The Order is used when ordering matters for inter-subsystem deps (e.g. iam before authz before commerce).
type O11yClient ¶
type O11yClient = types.O11yClient
type PaymentsClient ¶
type PaymentsClient = types.PaymentsClient
type TenantConfig ¶
type TenantConfig = types.TenantConfig
type VaultChargeRequest ¶
type VaultChargeRequest = types.VaultChargeRequest
type VaultChargeResponse ¶
type VaultChargeResponse = types.VaultChargeResponse
type VaultClient ¶
type VaultClient = types.VaultClient
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clients holds the canonical ZAP-typed inter-subsystem clients used by cloud.Deps.
|
Package clients holds the canonical ZAP-typed inter-subsystem clients used by cloud.Deps. |
|
gojahost
Package gojahost runs a Hanzo Node service's goja bundle (a self-contained, ESM-free JS file exposing globalThis.handle(req)) inside the unified cloud binary, per HIP-0106.
|
Package gojahost runs a Hanzo Node service's goja bundle (a self-contained, ESM-free JS file exposing globalThis.handle(req)) inside the unified cloud binary, per HIP-0106. |
|
plansvc
Package plansvc mounts the @hanzo/plans catalog into the unified cloud binary under /v1/plans/*, per HIP-0106.
|
Package plansvc mounts the @hanzo/plans catalog into the unified cloud binary under /v1/plans/*, per HIP-0106. |
|
pricingsvc
Package pricingsvc mounts the @hanzo/pricing service into the unified cloud binary under /v1/pricing/* (+ the /v1/models, /v1/gpu, /v1/tools aliases), per HIP-0106.
|
Package pricingsvc mounts the @hanzo/pricing service into the unified cloud binary under /v1/pricing/* (+ the /v1/models, /v1/gpu, /v1/tools aliases), per HIP-0106. |
|
cmd
|
|
|
cloud
command
cloud is the unified Hanzo Cloud binary per HIP-0106.
|
cloud is the unified Hanzo Cloud binary per HIP-0106. |
|
hanzo
command
Command hanzo is the unified Hanzo Go binary, dispatched by subcommand.
|
Command hanzo is the unified Hanzo Go binary, dispatched by subcommand. |
|
Package subsystems is the single source of truth for which Hanzo cloud subsystems are linked into a binary.
|
Package subsystems is the single source of truth for which Hanzo cloud subsystems are linked into a binary. |
|
Package types holds the placeholder transport types AND the inter-subsystem client interfaces shared between cloud (the orchestrator) and cloud/clients (the in-process and RPC client implementations).
|
Package types holds the placeholder transport types AND the inter-subsystem client interfaces shared between cloud (the orchestrator) and cloud/clients (the in-process and RPC client implementations). |