@usine/gateway
The usine gateway: a credential-injecting proxy for GitHub and LLM providers, and an egress allowlist, in front of Worker VMs.
Modules
Section titled “Modules”Classes
Section titled “Classes”AnonymousCredential
Section titled “AnonymousCredential”No credential: requests go upstream as they are, so only what GitHub serves anonymously works, which is reading a public repository.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AnonymousCredential(…
args):AnonymousCredential
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props?: object, options?: MakeOptions] |
Returns
Section titled “Returns”AnthropicApiKey
Section titled “AnthropicApiKey”An Anthropic API key, sent upstream as x-api-key.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AnthropicApiKey(…
args):AnthropicApiKey
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlykey:Redacted<string>
AnthropicProvider
Section titled “AnthropicProvider”Claude Code’s upstream: ANTHROPIC_BASE_URL on the Worker points at http://llm.<domain>/anthropic.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AnthropicProvider(…
args):AnthropicProvider
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”credential
Section titled “credential”
readonlycredential:AnthropicApiKey|AnthropicSubscriptionToken
upstream
Section titled “upstream”
readonlyupstream:string&Brand<"UpstreamBase">
AnthropicSubscriptionToken
Section titled “AnthropicSubscriptionToken”A Claude subscription token from claude setup-token, sent upstream as a
bearer token with the OAuth beta flag. Anthropic does not document a proxy
that swaps a placeholder for one; test/placeholder-swap checks whether it
works before anyone relies on it.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AnthropicSubscriptionToken(…
args):AnthropicSubscriptionToken
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlytoken:Redacted<string>
Attachment
Section titled “Attachment”The executor’s grant to one Worker VM for one repository: until
expiresAt, the gateway adds credential to that VM’s requests for that
repository and honors the caller token issued for this attachment. The
executor sets expiresAt to the token’s own expiry, so an attachment never
outlives its token. Several attachments may be in force for the same
Worker and repository, one per Attempt.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Attachment(…
args):Attachment
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”credential
Section titled “credential”
readonlycredential:InstallationCredential|AnonymousCredential
expiresAt
Section titled “expiresAt”
readonlyexpiresAt:Utc
readonlyid:string&Brand<"AttachmentId">
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
Methods
Section titled “Methods”isLiveAt()
Section titled “isLiveAt()”isLiveAt(
now):boolean
Whether the attachment still grants access at now.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
now |
Utc |
Returns
Section titled “Returns”boolean
AttachmentAlreadyExpired
Section titled “AttachmentAlreadyExpired”The executor tried to attach a token that had already expired.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttachmentAlreadyExpired(…
args):AttachmentAlreadyExpired
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”expiresAt
Section titled “expiresAt”
readonlyexpiresAt:Utc
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
AttachmentConflict
Section titled “AttachmentConflict”A renewal named an attachment id that belongs to another Worker or repository.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttachmentConflict(…
args):AttachmentConflict
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyid:string&Brand<"AttachmentId">
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
Attachments
Section titled “Attachments”The attachments the executor has made, keyed by attachment id and kept in memory only. A gateway restart forgets them, and the executor attaches again, with the same ids, when it renews or restarts.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* Attachments returns.
attach
Section titled “attach”
readonlyattach: (attachment) =>Effect.Effect<void,AttachmentAlreadyExpired|AttachmentConflict>
Stores an attachment, or renews the one with the same id: the new credential and expiry replace the old ones. An id already used for another Worker or repository is refused.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attachment |
Attachment |
Returns
Section titled “Returns”Effect.Effect<void, AttachmentAlreadyExpired | AttachmentConflict>
detach
Section titled “detach”
readonlydetach: (id) =>Effect.Effect<boolean>
Removes the attachment; false when there was none.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
AttachmentId |
Returns
Section titled “Returns”Effect.Effect<boolean>
readonlyfind: (id) =>Effect.Effect<AttachmentLookup>
Whether the attachment is in force, and if not, why.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
AttachmentId |
Returns
Section titled “Returns”Effect.Effect<AttachmentLookup>
readonlylist: () =>Effect.Effect<ReadonlyArray<Attachment>>
Every attachment still in force, oldest expiry first.
Returns
Section titled “Returns”Effect.Effect<ReadonlyArray<Attachment>>
readonlysweep: () =>Effect.Effect<number>
Forgets expired attachments and returns how many it removed.
Returns
Section titled “Returns”Effect.Effect<number>
readonlystaticlayer:Layer<Attachments,never,never>
An empty store that sweeps expired attachments every minute while the layer is in scope.
CallerClaims
Section titled “CallerClaims”What a caller token proves: the attachment it was issued with, and that attachment’s Worker and repository. Binding the attachment id means a token from an earlier attachment is refused once a new one is made for the same Worker and repository.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CallerClaims(…
args):CallerClaims
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”attachment
Section titled “attachment”
readonlyattachment:string&Brand<"AttachmentId">
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
CallerTokenRejected
Section titled “CallerTokenRejected”A presented caller token that the gateway did not issue: malformed is not in its format, bad-signature was not signed with its key.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CallerTokenRejected(…
args):CallerTokenRejected
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”reason
Section titled “reason”
readonlyreason:"malformed"|"bad-signature"
CallerTokens
Section titled “CallerTokens”Issues and checks caller tokens. A token is ugw1.<claims>.<HMAC-SHA256>
under the gateway’s caller key, so the same attachment yields the same
token after a gateway restart or a renewal, and the gateway keeps no token
table.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* CallerTokens returns.
readonlyissue: (claims) =>Effect.Effect<CallerToken>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
claims |
CallerClaims |
Returns
Section titled “Returns”Effect.Effect<CallerToken>
verify
Section titled “verify”
readonlyverify: (token) =>Effect.Effect<CallerClaims,CallerTokenRejected>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
token |
CallerToken |
Returns
Section titled “Returns”Effect.Effect<CallerClaims, CallerTokenRejected>
withoutCallerTokens
Section titled “withoutCallerTokens”
readonlywithoutCallerTokens: (headers) =>Effect.Effect<Headers.Headers>
Removes caller tokens from headers bound for a host outside the
gateway: the gateway header always, and an Authorization or
x-api-key value only when it verifies as a caller token, so a
Worker’s own credential for a registry still goes through.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
headers |
Headers.Headers |
Returns
Section titled “Returns”Effect.Effect<Headers.Headers>
readonlystaticlayer:Layer<CallerTokens,never,GatewaySettings>
EgressAllowlist
Section titled “EgressAllowlist”The hosts Workers may reach through the gateway’s forward proxy. Everything not listed is refused; IP addresses are always refused, since a rule names hosts and an address would bypass it.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EgressAllowlist(…
args):EgressAllowlist
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyrules: readonlyEgressRule[]
Methods
Section titled “Methods”decide()
Section titled “decide()”decide(
host,port):EgressDecision
Decides whether a client may open a connection to host on port.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
host |
string |
port |
number |
Returns
Section titled “Returns”EgressAllowlistError
Section titled “EgressAllowlistError”Why the allowlist file could not be read: the line and what is wrong with it.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EgressAllowlistError(…
args):EgressAllowlistError
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyline:number
message
Section titled “message”
readonlymessage:string
EgressPermitted
Section titled “EgressPermitted”A destination the allowlist permits, with the rule that permits it.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EgressPermitted(…
args):EgressPermitted
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyhost:string&Brand<"HostName">
readonlyport:number&Brand<"Port">
readonlyrule:EgressRule
EgressRefused
Section titled “EgressRefused”A destination the allowlist refuses. host is the raw host the client asked for.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EgressRefused(…
args):EgressRefused
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyhost:string
readonlyport:number
reason
Section titled “reason”
readonlyreason:"host-not-allowed"|"port-not-allowed"|"address-literal"|"private-address"|"not-tls"|"server-name-missing"|"server-name-mismatch"
EgressRule
Section titled “EgressRule”One allowlist line. exact permits that host only; subdomains permits
every name below the domain (*.pythonhosted.org), not the domain itself.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EgressRule(…
args):EgressRule
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyhost:string&Brand<"HostName">
readonlymatch:"exact"|"subdomains"
readonlyports: readonly [number&Brand<"Port">,number&Brand<"Port">]
Methods
Section titled “Methods”covers()
Section titled “covers()”covers(
host):boolean
Whether this rule covers host, whatever the port.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
host |
string & Brand<"HostName"> |
Returns
Section titled “Returns”boolean
ExpiredAttachment
Section titled “ExpiredAttachment”The attachment existed but its token has expired; the executor did not renew it.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ExpiredAttachment(…
args):ExpiredAttachment
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”expiredAt
Section titled “expiredAt”
readonlyexpiredAt:Utc
GatewayProxy
Section titled “GatewayProxy”The reverse proxy Worker VMs reach on the private network. git.<domain>
serves GitHub with the attached installation token and llm.<domain>
serves the LLM providers with the gateway’s API keys; every request
presents a caller token whose attachment is in force. Any other host is
refused: the forward proxy serves the allowlisted ones.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* GatewayProxy returns.
handle
Section titled “handle”
readonlyhandle:Effect.Effect<HttpServerResponse.HttpServerResponse,never,HttpServerRequest.HttpServerRequest>
Forwards one Worker request with the attached credential, or refuses it and logs why.
readonlystaticlayer:Layer<GatewayProxy,never,HttpClient|Attachments|CallerTokens|GatewaySettings>
GatewaySettings
Section titled “GatewaySettings”The gateway’s configuration, read once at startup by the platform entry
point. Secrets stay Redacted and are only unwrapped where they are sent
or used to sign.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* GatewaySettings returns.
adminToken
Section titled “adminToken”
readonlyadminToken:AdminToken
callerKey
Section titled “callerKey”
readonlycallerKey:CallerKey
domain
Section titled “domain”
readonlydomain:GatewayDomain
egress
Section titled “egress”
readonlyegress:EgressAllowlist
github
Section titled “github”
readonlygithub:GitHubOrigins
providers
Section titled “providers”
readonlyproviders:LlmProviders
InstallationCredential
Section titled “InstallationCredential”A GitHub App installation token the gateway adds to the Worker’s requests for the repository.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InstallationCredential(…
args):InstallationCredential
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlytoken:Redacted<string>
LiveAttachment
Section titled “LiveAttachment”The attachment is in force.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LiveAttachment(…
args):LiveAttachment
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”attachment
Section titled “attachment”
readonlyattachment:Attachment
MissingAttachment
Section titled “MissingAttachment”No attachment with the id is in the store: it was detached, or never attached on this gateway.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MissingAttachment(…
args):MissingAttachment
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props?: object, options?: MakeOptions] |
Returns
Section titled “Returns”OpenAiProvider
Section titled “OpenAiProvider”An OpenAI-compatible upstream for Codex: its model_provider base_url on
the Worker is http://llm.<domain>/openai/v1. The key is sent as a bearer token.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OpenAiProvider(…
args):OpenAiProvider
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlykey:Redacted<string>
upstream
Section titled “upstream”
readonlyupstream:string&Brand<"UpstreamBase">
Interfaces
Section titled “Interfaces”GitHubOrigins
Section titled “GitHubOrigins”Where the gateway forwards GitHub requests: web serves git smart HTTP, api REST and GraphQL, uploads release asset uploads.
Properties
Section titled “Properties”
readonlyapi:string&Brand<"UpstreamBase">
uploads
Section titled “uploads”
readonlyuploads:string&Brand<"UpstreamBase">
readonlyweb:string&Brand<"UpstreamBase">
LlmProviders
Section titled “LlmProviders”The LLM upstreams the gateway forwards to. A provider without a credential is refused.
Properties
Section titled “Properties”anthropic
Section titled “anthropic”
readonlyanthropic:Option<AnthropicProvider>
openai
Section titled “openai”
readonlyopenai:Option<OpenAiProvider>
Type Aliases
Section titled “Type Aliases”AdminToken
Section titled “AdminToken”AdminToken = typeof
AdminToken.Type
The bearer token the executor sends to the admin API, decoded from its raw value: at least 32 characters.
AnthropicCredential
Section titled “AnthropicCredential”AnthropicCredential = typeof
AnthropicCredential.Type
The credential the gateway adds to Anthropic requests.
AttachmentCredential
Section titled “AttachmentCredential”AttachmentCredential = typeof
AttachmentCredential.Type
What the gateway adds to a Worker’s GitHub requests for an attached repository.
AttachmentId
Section titled “AttachmentId”AttachmentId = typeof
AttachmentId.Type
Identifies one attachment from its first attach to its detach. Renewals keep it; a fresh attach for the same Worker and repository gets a new one, so a caller token from an earlier attachment is never honored again.
AttachmentLookup
Section titled “AttachmentLookup”AttachmentLookup =
LiveAttachment|ExpiredAttachment|MissingAttachment
The outcome of looking up an attachment by its id.
CallerKey
Section titled “CallerKey”CallerKey = typeof
CallerKey.Type
The HMAC key caller tokens are signed with, decoded from its raw value: at least 32 characters, held only by the gateway.
CallerToken
Section titled “CallerToken”CallerToken = typeof
CallerToken.Type
The credential a Worker VM sends in place of a real one. The gateway issues it with each attachment and honors it only while that attachment is in force, so it grants nothing the executor did not attach.
EgressDecision
Section titled “EgressDecision”EgressDecision =
EgressPermitted|EgressRefused
EgressRefusalReason
Section titled “EgressRefusalReason”EgressRefusalReason = typeof
EgressRefusalReason.Type
Why a destination is refused: its host is not listed, its port is not, it is an IP address, or its name resolves to a private, loopback, or link-local address (checked by a proxy that resolves names itself). For a tunnel, also when the client’s first bytes are not a TLS ClientHello, when the ClientHello names no server or hides it with ECH, or when it names another server than the CONNECT host.
HostName
Section titled “HostName”HostName = typeof
HostName.Type
A lowercase DNS host name without a trailing dot.
Port = typeof
Port.Type
A TCP port.
RefusalReason
Section titled “RefusalReason”RefusalReason = typeof
RefusalReason.Type
Why the gateway refused a request. Every refusal is logged at warning
level with this reason, the host, and the Worker when the caller token
names one, and the response carries it in x-usine-gateway-refusal.
UpstreamBase
Section titled “UpstreamBase”UpstreamBase = typeof
UpstreamBase.Type
The base URL of an upstream API: scheme, host, and an optional path prefix, without a query, a fragment, or a trailing slash.
Variables
Section titled “Variables”adminRoutes
Section titled “adminRoutes”
constadminRoutes:Layer.Layer<never,never,FileSystem|GatewaySettings|Generator|HttpPlatform|HttpRouter|Path|Request|Request>
The admin API’s routes, for an HttpRouter the platform serves. Bind it
to a loopback or otherwise private address: the executor reaches it
through its SSH connection to the gateway.
AdminToken
Section titled “AdminToken”
constAdminToken:Schema.RedactedFromValue<Schema.String>
The bearer token the executor sends to the admin API, decoded from its raw value: at least 32 characters.
AnthropicCredential
Section titled “AnthropicCredential”
constAnthropicCredential:Schema.Union<readonly [typeofAnthropicApiKey, typeofAnthropicSubscriptionToken]>
The credential the gateway adds to Anthropic requests.
AttachmentCredential
Section titled “AttachmentCredential”
constAttachmentCredential:Schema.Union<readonly [typeofInstallationCredential, typeofAnonymousCredential]>
What the gateway adds to a Worker’s GitHub requests for an attached repository.
AttachmentId
Section titled “AttachmentId”
constAttachmentId:Schema.brand<Schema.String,"AttachmentId">
Identifies one attachment from its first attach to its detach. Renewals keep it; a fresh attach for the same Worker and repository gets a new one, so a caller token from an earlier attachment is never honored again.
CallerKey
Section titled “CallerKey”
constCallerKey:Schema.RedactedFromValue<Schema.String>
The HMAC key caller tokens are signed with, decoded from its raw value: at least 32 characters, held only by the gateway.
CallerToken
Section titled “CallerToken”
constCallerToken:Schema.Redacted<Schema.NonEmptyString>
The credential a Worker VM sends in place of a real one. The gateway issues it with each attachment and honors it only while that attachment is in force, so it grants nothing the executor did not attach.
EgressRefusalReason
Section titled “EgressRefusalReason”
constEgressRefusalReason:Schema.Literals<readonly ["host-not-allowed","port-not-allowed","address-literal","private-address","not-tls","server-name-missing","server-name-mismatch"]>
Why a destination is refused: its host is not listed, its port is not, it is an IP address, or its name resolves to a private, loopback, or link-local address (checked by a proxy that resolves names itself). For a tunnel, also when the client’s first bytes are not a TLS ClientHello, when the ClientHello names no server or hides it with ECH, or when it names another server than the CONNECT host.
endToEndHeaders
Section titled “endToEndHeaders”
constendToEndHeaders: (headers) =>Headers.Headers
Removes hop-by-hop headers, including any the Connection header names.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
headers |
Headers.Headers |
Returns
Section titled “Returns”Headers.Headers
GATEWAY_TOKEN_HEADER
Section titled “GATEWAY_TOKEN_HEADER”
constGATEWAY_TOKEN_HEADER:"x-usine-gateway-token"="x-usine-gateway-token"
The header a caller sets when its tool can add one, such as git with http.extraHeader.
gatewayHosts
Section titled “gatewayHosts”
constgatewayHosts: (domain) =>object
The host names the gateway serves under its domain.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
domain |
GatewayDomain |
Returns
Section titled “Returns”object
readonlygit:`git.${string & Brand}`
readonlyllm:`llm.${string & Brand}`
gatewayServices
Section titled “gatewayServices”
constgatewayServices:Layer.Layer<Attachments|CallerTokens,never,GatewaySettings>
The gateway’s shared state for one process: the attachment store and the caller token signer. The reverse proxy and the admin API must use the same instance, so provide this layer once to both.
GITHUB_ORIGINS
Section titled “GITHUB_ORIGINS”
constGITHUB_ORIGINS:GitHubOrigins
github.com itself.
HostName
Section titled “HostName”
constHostName:Schema.brand<Schema.String,"HostName">
A lowercase DNS host name without a trailing dot.
parseEgressAllowlist
Section titled “parseEgressAllowlist”
constparseEgressAllowlist: (text) =>Result.Result<EgressAllowlist,EgressAllowlistError>
Parses an allowlist file: one rule per line, # starts a comment, blank
lines are skipped. A line is host, *.domain, or either with :port;
without a port the rule permits 443 and 80.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
Returns
Section titled “Returns”Result.Result<EgressAllowlist, EgressAllowlistError>
constPort:Schema.brand<Schema.Int,"Port">
A TCP port.
REFUSAL_HEADER
Section titled “REFUSAL_HEADER”
constREFUSAL_HEADER:"x-usine-gateway-refusal"="x-usine-gateway-refusal"
The header a refused response names its reason in.
RefusalReason
Section titled “RefusalReason”
constRefusalReason:Schema.Literals<readonly ["unknown-host","unsupported-path","missing-caller-token","invalid-caller-token","stale-caller-token","attachment-expired","repository-mismatch","provider-not-configured"]>
Why the gateway refused a request. Every refusal is logged at warning
level with this reason, the host, and the Worker when the caller token
names one, and the response carries it in x-usine-gateway-refusal.
tokenFromAuthorization
Section titled “tokenFromAuthorization”
consttokenFromAuthorization: (value) =>Option.Option<CallerToken>
The credential in an Authorization or Proxy-Authorization value: the
parameter of Bearer and token, or the password of Basic (the user
name when the password is empty).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”Option.Option<CallerToken>
UpstreamBase
Section titled “UpstreamBase”
constUpstreamBase:Schema.brand<Schema.String,"UpstreamBase">
The base URL of an upstream API: scheme, host, and an optional path prefix, without a query, a fragment, or a trailing slash.
References
Section titled “References”GatewayDomain
Section titled “GatewayDomain”Re-exports GatewayDomain