Skip to content

Class: GatewaySessionsClient

@kortexya/reasoninglayer


@kortexya/reasoninglayer / GatewaySessionsClient

Defined in: src/resources/gateway-sessions.ts:40

Principal-scoped gateway session records, kept exclusively by the native engine.

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.

string

Opaque session key; cannot be empty, . or ...

GatewaySessionPrincipalQuery

Optional alternate principal, requiring tenant-admin authority.

RequestOptions

Per-call cancellation, timeout and request options.

Promise<GatewaySessionDeleteResult>

Number of native records deleted.

If the key cannot identify one URL path segment.

If principal authorization or deletion fails.

Sends DELETE to the principal-scoped native route; the SDK keeps no session store.

await client.gatewaySessions.delete(key);

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.

string

Opaque session key; cannot be empty, . or ...

GatewaySessionRenderQuery

Principal, token budget and rendering mode.

RequestOptions

Per-call cancellation, timeout and request options.

Promise<GatewaySessionRenderedState>

Verbatim text and the native state revision header, when present.

If the key cannot identify one URL path segment.

If authorization, the session or the token budget is refused.

Requests text/plain parsing. Block reads may schedule a native brief revision; the returned header identifies the revision actually rendered.

const rendered = await client.gatewaySessions.getRenderedState(key, { render: 'constraints' });

getState(key, query?, requestOptions?): Promise<GatewaySessionState>

Defined in: src/resources/gateway-sessions.ts:95

Read typed native session state.

string

Opaque session key; cannot be empty, . or ...

GatewaySessionStateQuery

Optional principal and native token budget.

RequestOptions

Per-call cancellation, timeout and request options.

Promise<GatewaySessionState>

Native brief, facts and inherited constraints.

If the key cannot identify one URL path segment.

If the session is absent or principal authorization fails.

If a native brief or fact cannot be decoded.

Explicitly requests render=json; the route’s default response is text.

const state = await client.gatewaySessions.getState(key);

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.

GatewaySessionPrincipalQuery

Optional principal selection; omission means the caller.

RequestOptions

Per-call cancellation, timeout and request options.

Promise<GatewaySessionList>

Sessions in latest-exchange order.

If authentication or principal authorization fails.

Principal selection is sent as a query; authority is decided by the engine.

const sessions = await client.gatewaySessions.list();

recordExchange(key, request, requestOptions?): Promise<GatewaySessionExchangeResult>

Defined in: src/resources/gateway-sessions.ts:71

Record an exchange under the caller’s principal.

string

Opaque session key, encoded as one route segment; cannot be empty, . or ...

GatewaySessionExchangeRequest

Exchange digest and first-exchange session attributes.

RequestOptions

Per-call cancellation, timeout and request options.

Promise<GatewaySessionExchangeResult>

Native replay status and session receipt.

If the key cannot identify one URL path segment.

If the exchange exceeds native bounds or reuses a call id with another digest.

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.

const receipt = await client.gatewaySessions.recordExchange(key, exchange);