Class: GatewaySessionsClient
@kortexya/reasoninglayer / GatewaySessionsClient
Class: GatewaySessionsClient
Section titled “Class: GatewaySessionsClient”Defined in: src/resources/gateway-sessions.ts:40
Principal-scoped gateway session records, kept exclusively by the native engine.
Methods
Section titled “Methods”delete()
Section titled “delete()”delete(
key,query?,requestOptions?):Promise<GatewaySessionDeleteResult>
Defined in: src/resources/gateway-sessions.ts:155
Delete a session and its native records under the caller’s authority.
Parameters
Section titled “Parameters”string
Opaque session key; cannot be empty, . or ...
query?
Section titled “query?”Optional alternate principal, requiring tenant-admin authority.
requestOptions?
Section titled “requestOptions?”Per-call cancellation, timeout and request options.
Returns
Section titled “Returns”Promise<GatewaySessionDeleteResult>
Number of native records deleted.
Throws
Section titled “Throws”If the key cannot identify one URL path segment.
Throws
Section titled “Throws”If principal authorization or deletion fails.
Remarks
Section titled “Remarks”Sends DELETE to the principal-scoped native route; the SDK keeps no session store.
Example
Section titled “Example”await client.gatewaySessions.delete(key);getRenderedState()
Section titled “getRenderedState()”getRenderedState(
key,query?,requestOptions?):Promise<GatewaySessionRenderedState>
Defined in: src/resources/gateway-sessions.ts:123
Read the engine-rendered session block or its constraints and open goals.
Parameters
Section titled “Parameters”string
Opaque session key; cannot be empty, . or ...
query?
Section titled “query?”Principal, token budget and rendering mode.
requestOptions?
Section titled “requestOptions?”Per-call cancellation, timeout and request options.
Returns
Section titled “Returns”Promise<GatewaySessionRenderedState>
Verbatim text and the native state revision header, when present.
Throws
Section titled “Throws”If the key cannot identify one URL path segment.
Throws
Section titled “Throws”If authorization, the session or the token budget is refused.
Remarks
Section titled “Remarks”Requests text/plain parsing. Block reads may schedule a native brief revision; the returned header identifies the revision actually rendered.
Example
Section titled “Example”const rendered = await client.gatewaySessions.getRenderedState(key, { render: 'constraints' });getState()
Section titled “getState()”getState(
key,query?,requestOptions?):Promise<GatewaySessionState>
Defined in: src/resources/gateway-sessions.ts:95
Read typed native session state.
Parameters
Section titled “Parameters”string
Opaque session key; cannot be empty, . or ...
query?
Section titled “query?”Optional principal and native token budget.
requestOptions?
Section titled “requestOptions?”Per-call cancellation, timeout and request options.
Returns
Section titled “Returns”Promise<GatewaySessionState>
Native brief, facts and inherited constraints.
Throws
Section titled “Throws”If the key cannot identify one URL path segment.
Throws
Section titled “Throws”If the session is absent or principal authorization fails.
Throws
Section titled “Throws”If a native brief or fact cannot be decoded.
Remarks
Section titled “Remarks”Explicitly requests render=json; the route’s default response is text.
Example
Section titled “Example”const state = await client.gatewaySessions.getState(key);list()
Section titled “list()”list(
query?,requestOptions?):Promise<GatewaySessionList>
Defined in: src/resources/gateway-sessions.ts:52
List the caller’s sessions, or another tenant principal’s sessions when authorized.
Parameters
Section titled “Parameters”query?
Section titled “query?”Optional principal selection; omission means the caller.
requestOptions?
Section titled “requestOptions?”Per-call cancellation, timeout and request options.
Returns
Section titled “Returns”Promise<GatewaySessionList>
Sessions in latest-exchange order.
Throws
Section titled “Throws”If authentication or principal authorization fails.
Remarks
Section titled “Remarks”Principal selection is sent as a query; authority is decided by the engine.
Example
Section titled “Example”const sessions = await client.gatewaySessions.list();recordExchange()
Section titled “recordExchange()”recordExchange(
key,request,requestOptions?):Promise<GatewaySessionExchangeResult>
Defined in: src/resources/gateway-sessions.ts:71
Record an exchange under the caller’s principal.
Parameters
Section titled “Parameters”string
Opaque session key, encoded as one route segment; cannot be empty, . or ...
request
Section titled “request”Exchange digest and first-exchange session attributes.
requestOptions?
Section titled “requestOptions?”Per-call cancellation, timeout and request options.
Returns
Section titled “Returns”Promise<GatewaySessionExchangeResult>
Native replay status and session receipt.
Throws
Section titled “Throws”If the key cannot identify one URL path segment.
Throws
Section titled “Throws”If the exchange exceeds native bounds or reuses a call id with another digest.
Remarks
Section titled “Remarks”Snake_case JSON is sent to the native route. The callId is the idempotency key; reuse it only for the same exchange. User text and tool digests remain verbatim.
Example
Section titled “Example”const receipt = await client.gatewaySessions.recordExchange(key, exchange);