Documentation
¶
Overview ¶
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). Both packages reference this leaf package to avoid an import cycle.
As subsystems ship their .zap schemas and zapc generates typed bindings, the placeholders here are replaced by aliases to the generated structs in <subsystem>/zap/gen/*.go. Until then the stable shape lives here so subsystem code can pin signatures without re-importing through cloud.
Index ¶
- Variables
- type AIClient
- type BaseClient
- type ChatRequest
- type ChatResponse
- type Claims
- type CommerceClient
- type Counter
- type DBHandle
- type IAMClient
- type IntentRequest
- type IntentResponse
- type IntentStatus
- type KMSClient
- type LicenseEntitlement
- type MQClient
- type ModelLister
- 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 ErrBlobNotFound = errors.New("vfs: blob not found")
ErrBlobNotFound is the sentinel a WORKING VFS backend returns from Get/Delete when the blob does not exist. It lets a consumer (clients/team files) tell a genuine miss (→ 404 / idempotent delete) apart from a backend that is unavailable/disabled (any OTHER error → fail closed 502) — so a missing blob never masquerades as an outage and a real outage never masquerades as 404.
Functions ¶
This section is empty.
Types ¶
type AIClient ¶
type AIClient interface {
ChatCompletion(ctx context.Context, req *ChatRequest) (*ChatResponse, error)
}
AIClient is the inter-subsystem interface to AI.
type BaseClient ¶
type BaseClient interface {
Open(ctx context.Context, orgID, serviceName string) (DBHandle, error)
}
BaseClient is the inter-subsystem interface to Base.
type ChatRequest ¶
ChatRequest mirrors the AI subsystem's chat-completion request.
type ChatResponse ¶
type ChatResponse struct{ Content string }
ChatResponse mirrors the AI subsystem's chat-completion response.
type Claims ¶
Claims is the JWT-validated identity surface gateway hands to downstream subsystems per HIP-0026. Sub = JWT `sub`, Org = JWT `owner`, Email = JWT `email`, IsAdmin = JWT `isAdmin`.
type CommerceClient ¶
type CommerceClient interface {
GetTenantConfig(ctx context.Context, orgID string) (*TenantConfig, error)
// CheckEntitlement reports whether org `orgID` holds an active
// entitlement for licensed product `productID`, and returns the plan's
// flat license-features per the toLicenseFeatures vocab contract. Used
// by the licensing subsystem to gate + scope token issuance. orgID is
// the tenant the buyer acts as (X-Org-Id); when callers only have a
// user subject they pass it through here and commerce resolves the
// owning org.
CheckEntitlement(ctx context.Context, orgID, productID string) (*LicenseEntitlement, error)
}
CommerceClient is the inter-subsystem interface to Commerce.
type Counter ¶
type Counter interface{ Inc(n int64) }
Counter / Timing / Span are the canonical o11y handles.
type DBHandle ¶
type DBHandle interface{ Close() error }
DBHandle is the per-tenant database handle Base hands out.
type IAMClient ¶
type IAMClient interface {
VerifyJWT(ctx context.Context, bearer string) (Claims, error)
GetUser(ctx context.Context, userID string) (*User, error)
GetOrg(ctx context.Context, orgID string) (*Org, error)
}
IAMClient is the inter-subsystem interface to IAM. Co-resident: direct Go call. Split: ZAP-RPC.
type IntentRequest ¶
IntentRequest creates a payments intent. Commerce never sees PAN; it only ever passes the vault token + amount + currency.
type IntentResponse ¶
IntentResponse acknowledges intent creation / state.
type IntentStatus ¶
type IntentStatus struct{ Status string }
IntentStatus is the status-poll response.
type KMSClient ¶
type KMSClient interface {
GetSecret(ctx context.Context, ref string) ([]byte, error)
PutSecret(ctx context.Context, ref string, value []byte) error
Sign(ctx context.Context, keyRef string, payload []byte) ([]byte, error)
}
KMSClient is the inter-subsystem interface to KMS.
type LicenseEntitlement ¶
type LicenseEntitlement struct {
// ProductID is the licensed product the entitlement was checked for
// (e.g. "engine", "engine-rocm", a plugin id).
ProductID string
// Active reports whether the entitlement is currently valid (paid,
// not lapsed/cancelled). Licensing refuses to mint when false.
Active bool
// Plan is the resolved plan/tier id (e.g. "developer", "pro", "max",
// "enterprise"). Surfaced for logging/audit; not load-bearing for the
// release gate.
Plan string
// Features is the flat license-feature list per the toLicenseFeatures
// vocab contract — copied verbatim into License.Features at issue.
Features []string
// ExpiresUnix bounds the entitlement (unix seconds, 0 = no bound). The
// issued token's exp is clamped to it so a token never outlives the
// entitlement.
ExpiresUnix int64
}
LicenseEntitlement is commerce's answer to "does this org/user hold an active entitlement for licensed product X, and what does its plan grant?".
It is the inter-subsystem transport for the entitlement-flow that gates licensing token issuance (commerce → licensing → engine). The licensing subsystem copies Features verbatim into the signed token's `features` list so the proprietary engine's offline release gate (hasFeatures) enforces exactly the plan the buyer paid for.
Features is the FLAT capability list produced from the canonical entitlement vocabulary by the data plane's toLicenseFeatures contract (@hanzo/plans entitlements.mjs): licensing.engine_features verbatim, plus derived capability tokens (e.g. "ai.premium", "training", "tools.<name>"), plus scoping tokens ("licensing.app:<id>", "licensing.product:<id>"). Numeric quotas (tokens_per_min, seats, max_vms, …) ride out of band and are NOT encoded here.
type MQClient ¶
type MQClient interface {
Publish(ctx context.Context, subject string, payload []byte) error
Subscribe(ctx context.Context, subject string, handler func([]byte) error) error
}
MQClient is the inter-subsystem interface to mq.
type ModelLister ¶ added in v1.786.92
ModelLister is an OPTIONAL capability an AIClient may ALSO implement: it enumerates the model ids the gateway currently serves (its OpenAI-compatible /v1/models catalog). The agents subsystem uses it to reject a non-catalog model at agent create/update time with a clean 400, instead of letting the run surface a confusing gateway 502 for a model this gateway never served. An AIClient that cannot enumerate models (the disabled stub, the ZAP-RPC client) simply does not implement it, and callers fall back to skipping the check — so model validation is a best-effort UX guard, never a hard dependency.
type O11yClient ¶
type O11yClient interface {
Counter(name string, tags ...string) Counter
Timing(name string, tags ...string) Timing
Span(ctx context.Context, name string) (context.Context, Span)
}
O11yClient is the inter-subsystem interface to o11y.
type PaymentsClient ¶
type PaymentsClient interface {
CreateIntent(ctx context.Context, req *IntentRequest) (*IntentResponse, error)
ConfirmIntent(ctx context.Context, intentID string) (*IntentResponse, error)
GetIntentStatus(ctx context.Context, intentID string) (*IntentStatus, error)
}
PaymentsClient is the inter-subsystem interface to payments. Always ZAP-RPC; never co-resident (PCI scope isolation).
type TenantConfig ¶
TenantConfig is the commerce-served tenant settings struct.
type VFSClient ¶
type VFSClient interface {
Put(ctx context.Context, key string, payload []byte) error
Get(ctx context.Context, key string) ([]byte, error)
Delete(ctx context.Context, key string) error
}
VFSClient is the inter-subsystem interface to vfs. Delete removes the blob at key (idempotent — a missing key is not an error at the seam; the underlying hanzoai/vfs forwards to backend.Delete(ctx,key)).
type VaultChargeRequest ¶
type VaultChargeRequest struct {
Token string
ProcessorID string
Currency string
AmountCents int64
}
VaultChargeRequest is the payments→vault charge request. Vault is the only system that sees PAN — it dereferences the token and makes the processor call.
type VaultChargeResponse ¶
VaultChargeResponse is the vault→payments charge response.
type VaultClient ¶
type VaultClient interface {
Charge(ctx context.Context, req *VaultChargeRequest) (*VaultChargeResponse, error)
}
VaultClient is the inter-subsystem interface to vault. The ONLY system that touches PAN. Always ZAP-RPC; never co-resident.