engine/request_context/build_g

Build store.$g (app meta, request/response helpers, schedule context). Called only from modules/gingee.js. Engine-internal. Behavior must match the pre-extract gingee() middleware exactly.
Description:
  • Build store.$g (app meta, request/response helpers, schedule context). Called only from modules/gingee.js. Engine-internal. Behavior must match the pre-extract gingee() middleware exactly.

Methods

(inner) endStream()

Description:
  • Finish a streamed response.

(inner) initializeGContext(store) → {Object}

Description:
  • Populate store.$g with log, app, limits, and either schedule or HTTP request/response. Does not parse HTTP body — that remains in body.js / gingee().
Parameters:
Name Type Description
store object ALS store
Returns:
Type
Object

(inner) startStream()

Description:
  • Begin a streamed HTTP response (e.g. SSE for AI chat). After startStream, use write() / writeSSE() and endStream().

(inner) write()

Description:
  • Write a raw chunk to an open stream.

(inner) writeSSE()

Description:
  • Write one Server-Sent Event data line (JSON-serialized if object).