egress
The egress namespace — 12 functions.
globals/egress/credentialNames
egress.credentialNames() -> { string }
List the names of configured credentials. Names only — secret values are never exposed to Luau.
Returns { string } — Array of configured credential names.
for _, n in ipairs(egress.credentialNames()) do print(n) end
globals/egress/fetch
egress.fetch(name: string, method: string, url: string, headers: Headers?, body: JsonBody?, response: EgressResponseType?) -> string?
Perform an HTTP request with a named credential injected
server-side (in Rust). Returns a promise handle for
task.await(), or nil when the credential is unknown or url
is outside the credential's allowed base_url. The secret is
never exposed to Luau. This is the seam that production points
at the ZeroMind egress endpoint.
Parameters
namestring— Credential name registered by the trusted VM.methodstring— HTTP method, e.g. "GET" or "POST".urlstring— Request URL (must start with the credential'sbase_url).headersHeaders(optional) — Extra header key-value pairs.bodyJsonBody(optional) — JSON body (encoded automatically).responseEgressResponseType(optional) —"json"(default) or"bytes".
Returns string? — Promise handle for task.await(), or nil if refused.
local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })
globals/egress/hasCredential
egress.hasCredential(name: string) -> boolean
Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.
Parameters
namestring— Credential name.
Returns boolean — True if configured.
if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end
modules/egress/README
require("@builtin/modules/api/engine/egress") -- egress (also available as global 'egress')
Credential-injecting HTTP for BYO-key world egress (Mechanism B). Public Luau surface over the __egress Internal FFI namespace.
Usage: local egress = require("@builtin/modules/api/engine/egress") Also available as global: egress
modules/egress/clearCredential
clearCredential(name: string): boolean
TRUSTED ONLY. Remove a named credential.
Parameters
namestring— Credential name.
egress.clearCredential("meshy")
modules/egress/credentialNames
credentialNames(): { string }
List the names of configured credentials. Names only — secret values are never exposed to Luau.
for _, n in ipairs(egress.credentialNames()) do print(n) end
modules/egress/fetch
fetch(name: string, method: string, url: string,
Perform an HTTP request with a named credential injected
server-side (in Rust). Returns a promise handle for
task.await(), or nil when the credential is unknown or url
is outside the credential's allowed base_url. The secret is
never exposed to Luau. This is the seam that production points
at the ZeroMind egress endpoint.
local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })
modules/egress/hasCredential
hasCredential(name: string): boolean
Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.
Parameters
namestring— Credential name.
if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end
modules/egress/setCredential
setCredential(name: string, base_url: string,
TRUSTED ONLY. Register a named credential whose header is
injected into matching egress.fetch calls. The value is held
in Rust and never returned to Luau.
egress.setCredential("meshy", "https://api.meshy.ai/", "Authorization", "Bearer " .. key)
typed/builtin//modules/api/engine/egress/egress/credentialNames
egress.credentialNames() -> { string }
List the names of configured credentials. Names only — secret values are never exposed to Luau.
Returns { string } — Array of configured credential names.
for _, n in ipairs(egress.credentialNames()) do print(n) end
typed/builtin//modules/api/engine/egress/egress/fetch
egress.fetch(name: string, method: string, url: string, headers: Headers?, body: JsonBody?, response: EgressResponseType?) -> string?
Perform an HTTP request with a named credential injected
server-side (in Rust). Returns a promise handle for
task.await(), or nil when the credential is unknown or url
is outside the credential's allowed base_url. The secret is
never exposed to Luau. This is the seam that production points
at the ZeroMind egress endpoint.
Parameters
namestring— Credential name registered by the trusted VM.methodstring— HTTP method, e.g. "GET" or "POST".urlstring— Request URL (must start with the credential'sbase_url).headersHeaders(optional) — Extra header key-value pairs.bodyJsonBody(optional) — JSON body (encoded automatically).responseEgressResponseType(optional) —"json"(default) or"bytes".
Returns string? — Promise handle for task.await(), or nil if refused.
local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })
typed/builtin//modules/api/engine/egress/egress/hasCredential
egress.hasCredential(name: string) -> boolean
Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.
Parameters
namestring— Credential name.
Returns boolean — True if configured.
if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end