Skip to content

CallContext

Defined in: src/types.ts:104

Extended context with authentication info, available to handlers.

readonly auth: AuthContext;

Defined in: src/types.ts:107

Authenticated principal for this call; AuthContext.anonymous when the request was not authenticated.


readonly cookies: ReadonlyMap<string, string>;

Defined in: src/types.ts:132

Incoming request cookies. Empty for non-HTTP transports.


readonly optional externalizationEnabled?: boolean;

Defined in: src/types.ts:128

True iff the server has an externalisation backend wired up.


readonly optional kind?: TransportKind;

Defined in: src/types.ts:111

Coarse identifier of the bound transport, or undefined until the server begins serving (the value is committed by the lifecycle hook on the very first request).


readonly optional remainingExternalizedResponseBytes?: number;

Defined in: src/types.ts:126

External-channel bytes left this iteration. Always a hard cap — externalised uploads have no escape valve like producer continuation tokens. Undefined when no cap is configured or externalisation is disabled.


readonly optional remainingResponseBytes?: number;

Defined in: src/types.ts:119

Wire body bytes the framework will accept this iteration before triggering a continuation token (producer streams) or strict-fail with an EXCEPTION batch (unary / stream-exchange). Snapshot at collector construction; not live. undefined when no cap is configured or the transport doesn’t expose one (stdio).


readonly session: unknown;

Defined in: src/types.ts:148

Live sticky-session state object, or null when no session is bound to this request. HTTP-only — other transports always return null.


readonly sessionId: string | null;

Defined in: src/types.ts:155

Opaque 24-char-hex session ID, or null when no session is bound. Survives closeSession so post-close access-log records still carry the id.

clientLog(
level,
message,
extra?): void;

Defined in: src/types.ts:61

Emit a client-directed log message (sent as a zero-row log batch on the wire). level is a severity label such as "info", "warning", or "error"; extra carries optional structured string key/value pairs.

ParameterType
levelstring
messagestring
extra?Record<string, string>

void

LogContext.clientLog


closeSession(): void;

Defined in: src/types.ts:166

Invalidate the sticky session bound to this request. Idempotent.

void


deleteCookie(name, opts?): void;

Defined in: src/types.ts:142

Queue an unset-cookie directive on the HTTP response. Only valid inside a unary RPC method served over HTTP; throws otherwise.

ParameterType
namestring
opts?{ domain?: string; path?: string; }
opts.domain?string
opts.path?string

void


openSession(state, ttl?): void;

Defined in: src/types.ts:163

Register a sticky session holding state for subsequent requests on this transport. HTTP-only — throws on other transports, on calls without the VGI-Session-Accept: true opt-in header, or when a session is already bound to this request.

ParameterType
stateunknown
ttl?number

void


setCookie(
name,
value,
attrs?): void;

Defined in: src/types.ts:137

Queue a Set-Cookie header on the HTTP response. Only valid inside a unary RPC method served over HTTP; throws otherwise.

ParameterType
namestring
valuestring
attrs?CookieAttrs

void