@semiont/api-client
v0.5.5
Published
Semiont API SDK - types, client, and utilities
Maintainers
Readme
@semiont/api-client
HTTP-specific transport adapters for the Semiont SDK. This is the wire-side
implementation of the ITransport and IContentTransport contracts defined
in @semiont/core, consumed by @semiont/sdk.
Most application code does not import this package directly. The sdk re-exports the HTTP adapters for convenience, so a typical consumer writes:
import { SemiontClient, HttpTransport, HttpContentTransport } from '@semiont/sdk';
import { baseUrl } from '@semiont/core';
const transport = new HttpTransport({ baseUrl: baseUrl('https://kb.example/') });
const client = new SemiontClient(transport, new HttpContentTransport(transport));Direct imports from @semiont/api-client are appropriate when constructing
the transport stack by hand — e.g. CLI factories, MCP entrypoints, or worker
pools that wire bespoke tokenRefresher / BehaviorSubject token sources.
Public surface
import {
HttpTransport,
HttpContentTransport,
type HttpTransportConfig,
type TokenRefresher,
APIError,
// SSE-actor machinery used by SDK adapters; not application code:
createActorStateUnit,
type ActorStateUnit,
type BusEvent,
type ActorStateUnitOptions,
DEGRADED_THRESHOLD_MS,
} from '@semiont/api-client';That's the entire surface. Everything else moved out:
ITransport,IContentTransport,BRIDGED_CHANNELS,ConnectionState, response/progress types live in@semiont/core.SemiontClient, namespaces,SemiontSession,SemiontBrowser, state units,bus-request,cachelive in@semiont/sdk.
Behavioral contract
The guarantees every ITransport implementation must honor — including
HttpTransport — are documented in
docs/protocol/TRANSPORT-CONTRACT.md.
HTTP-specific guarantees (the /bus/emit gateway, SSE reconnect, Last-Event-ID
replay, etc.) live in
docs/protocol/TRANSPORT-HTTP.md.
Writing a new transport
If you need to add a non-HTTP transport (gRPC, WebSocket, IPC, …), implement
ITransport + IContentTransport from @semiont/core and consume the
contract from there. There's no inheritance from HttpTransport. For an
in-process example, see LocalTransport in
@semiont/make-meaning.
License
Apache-2.0 — see LICENSE.
