OutputCollector
Defined in: src/types.ts:418
Accumulates output batches during a produce/exchange call. Enforces that exactly one data batch is emitted per call (plus any number of log batches).
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OutputCollector( outputSchema, producerMode?, serverId?, requestId?, authContext?, cookies?, kind?, budgets?): OutputCollector;Defined in: src/types.ts:442
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
outputSchema |
VgiSchema |
undefined |
- |
producerMode |
boolean |
true |
- |
serverId |
string |
"" |
- |
requestId |
string | null |
null |
- |
authContext? |
AuthContext |
undefined |
- |
cookies? |
ReadonlyMap<string, string> |
undefined |
- |
kind? |
TransportKind |
undefined |
- |
budgets? |
{ externalizationEnabled?: boolean; inputMetadata?: ReadonlyMap<string, string>; peerEvidence?: PeerEvidenceSet; preferredResponseBytes?: number; remainingExternalizedResponseBytes?: number; remainingResponseBytes?: number; responseLimitBytes?: number; } |
undefined |
Snapshot budget fields exposed to worker code via CallContext. Optional — non-HTTP transports omit them and existing call sites remain source-compatible. |
budgets.externalizationEnabled? |
boolean |
undefined |
- |
budgets.inputMetadata? |
ReadonlyMap<string, string> |
undefined |
- |
budgets.peerEvidence? |
PeerEvidenceSet |
undefined |
- |
budgets.preferredResponseBytes? |
number |
undefined |
- |
budgets.remainingExternalizedResponseBytes? |
number |
undefined |
- |
budgets.remainingResponseBytes? |
number |
undefined |
- |
budgets.responseLimitBytes? |
number |
undefined |
- |
Returns
Section titled “Returns”OutputCollector
Properties
Section titled “Properties”readonly auth: AuthContext;Defined in: src/types.ts:431
Authenticated principal for this call; AuthContext.anonymous when the request was not authenticated.
Implementation of
Section titled “Implementation of”cookies
Section titled “cookies”readonly cookies: ReadonlyMap<string, string>;Defined in: src/types.ts:434
Incoming request cookies. Empty for non-HTTP transports.
Implementation of
Section titled “Implementation of”externalizationEnabled?
Section titled “externalizationEnabled?”readonly optional externalizationEnabled?: boolean;Defined in: src/types.ts:440
True iff the server has an externalisation backend wired up.
Implementation of
Section titled “Implementation of”CallContext.externalizationEnabled
inputMetadata?
Section titled “inputMetadata?”readonly optional inputMetadata?: ReadonlyMap<string, string>;Defined in: src/types.ts:433
Application custom metadata carried by this stream turn’s input: the
exchange input batch (the same keys as input.metadata) or the producer
tick, its own on every turn and every transport. Over HTTP the transport’s
bookkeeping – the cursor, the call token and the cancel marker – is
removed, a producer’s first turn carries the /init request’s metadata,
and an externalized input carries the fetched payload’s metadata plus
vgi_rpc.location.source / vgi_rpc.location.fetch_ms, never the
pointer’s.
Implementation of
Section titled “Implementation of”readonly optional kind?: TransportKind;Defined in: src/types.ts:435
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).
Implementation of
Section titled “Implementation of”peerEvidence
Section titled “peerEvidence”readonly peerEvidence: PeerEvidenceSet;Defined in: src/types.ts:432
Immutable, off-wire transport peer identity evidence for this call.
Implementation of
Section titled “Implementation of”preferredResponseBytes?
Section titled “preferredResponseBytes?”readonly optional preferredResponseBytes?: number;Defined in: src/types.ts:438
Application sizing target clamped to responseLimitBytes.
Implementation of
Section titled “Implementation of”CallContext.preferredResponseBytes
remainingExternalizedResponseBytes?
Section titled “remainingExternalizedResponseBytes?”readonly optional remainingExternalizedResponseBytes?: number;Defined in: src/types.ts:439
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.
Implementation of
Section titled “Implementation of”CallContext.remainingExternalizedResponseBytes
remainingResponseBytes?
Section titled “remainingResponseBytes?”readonly optional remainingResponseBytes?: number;Defined in: src/types.ts:436
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).
Implementation of
Section titled “Implementation of”CallContext.remainingResponseBytes
responseLimitBytes?
Section titled “responseLimitBytes?”readonly optional responseLimitBytes?: number;Defined in: src/types.ts:437
Effective hard response limit after application, hosting, and client limits are combined. Preferred over the legacy remaining* alias.
Implementation of
Section titled “Implementation of”CallContext.responseLimitBytes
Accessors
Section titled “Accessors”batches
Section titled “batches”Get Signature
Section titled “Get Signature”get batches(): EmittedBatch[];Defined in: src/types.ts:574
Batches emitted so far this call — the single data batch plus any log batches, in emission order. Consumed by the dispatch layer.
Returns
Section titled “Returns”EmittedBatch[]
dataBatchIdx
Section titled “dataBatchIdx”Get Signature
Section titled “Get Signature”get dataBatchIdx(): number | null;Defined in: src/types.ts:580
Index of the data batch within batches, or null if none was emitted this call. Log batches never occupy this slot.
Returns
Section titled “Returns”number | null
finished
Section titled “finished”Get Signature
Section titled “Get Signature”get finished(): boolean;Defined in: src/types.ts:568
True once finish has been called (producer streams only).
Returns
Section titled “Returns”boolean
outputSchema
Section titled “outputSchema”Get Signature
Section titled “Get Signature”get outputSchema(): VgiSchema;Defined in: src/types.ts:563
Schema of the data batches this collector emits.
Returns
Section titled “Returns”VgiSchema
session
Section titled “session”Get Signature
Section titled “Get Signature”get session(): unknown;Defined in: src/types.ts:526
Live sticky-session state object, or null when no session is bound to
this request. HTTP-only — other transports always return null.
Returns
Section titled “Returns”unknown
Live sticky-session state object, or null when no session is bound to
this request. HTTP-only — other transports always return null.
Implementation of
Section titled “Implementation of”sessionId
Section titled “sessionId”Get Signature
Section titled “Get Signature”get sessionId(): string | null;Defined in: src/types.ts:530
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.
Returns
Section titled “Returns”string | null
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.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”clientLog()
Section titled “clientLog()”clientLog( level, message, extra?): void;Defined in: src/types.ts:630
Emit a zero-row client-directed log batch.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
level |
string |
message |
string |
extra? |
Record<string, string> |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”closeSession()
Section titled “closeSession()”closeSession(): void;Defined in: src/types.ts:553
Invalidate the sticky session bound to this request. Idempotent.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”deleteCookie()
Section titled “deleteCookie()”deleteCookie(name, opts?): void;Defined in: src/types.ts:509
Queue an unset-cookie directive on the HTTP response. Only valid inside a unary RPC method served over HTTP; throws otherwise.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
opts? |
{ domain?: string; path?: string; } |
opts.domain? |
string |
opts.path? |
string |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”emit()
Section titled “emit()”Call Signature
Section titled “Call Signature”emit(batch, metadata?): void;Defined in: src/types.ts:585
Emit a pre-built batch as the data batch for this call.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
batch |
VgiBatch |
metadata? |
Map<string, string> |
Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”emit(columns, metadata?): void;Defined in: src/types.ts:588
Emit a data batch from column arrays keyed by field name, optionally carrying per-emit custom metadata. Int64 Number values are coerced to BigInt.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
columns |
Record<string, any[]> |
metadata? |
Map<string, string> |
Returns
Section titled “Returns”void
emitRow()
Section titled “emitRow()”emitRow(values): void;Defined in: src/types.ts:611
Single-row convenience. Wraps each value in [value] then calls emit().
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values |
Record<string, any> |
Returns
Section titled “Returns”void
finish()
Section titled “finish()”finish(): void;Defined in: src/types.ts:620
Signal stream completion for producer streams. Throws if called on exchange streams.
Returns
Section titled “Returns”void
openSession()
Section titled “openSession()”openSession(state, ttl?): void;Defined in: src/types.ts:534
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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
state |
unknown |
ttl? |
number |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setCookie()
Section titled “setCookie()”setCookie( name, value, attrs?): void;Defined in: src/types.ts:499
Queue a Set-Cookie header on the HTTP response. Only valid inside a unary RPC method served over HTTP; throws otherwise.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
value |
string |
attrs? |
CookieAttrs |
Returns
Section titled “Returns”void
