Skip to main content

Crate sim_lib_server

Crate sim_lib_server 

Source
Expand description

SIM’s server library: a loadable lib that serves eval and agents over a transport. It exposes sites (local, coroutine, pipeline, loop, fabric), frame routing, REPL drivers, connections, and transports so callers can request evaluation, stream replies, and run agent loops across the runtime.

Transports are in-process by default: the default feature set enables no network surface. The network/HTTP transport is the non-default server-net-http feature and must be opted into explicitly; the various trigger-* features add their respective inbound triggers the same way.

Structs§

BufferedStreamSink
StreamSink that buffers received chunks into a StreamHandle.
Connection
Live client handle to a server endpoint, evaluating expressions over a transport EvalSite.
CookbookWebResponse
Minimal HTTP response model for cookbook route adapters.
CookbookWebState
Cookbook state exposed by the WebUI route and JSON API.
Coroutine
Live, resumable coroutine bound to a server address and handler value.
CoroutineEvalSite
An eval site that resumes a Coroutine with each request’s expression.
FabricEvalSite
An eval site that delegates requests to a distributed EvalFabric.
FrameEnvelope
Out-of-band metadata attached to a ServerFrame alongside its payload.
FrameRouter
Allocates message ids and queues inbound server frames for a connection.
IsolationPolicy
Per-axis ShareMode selection controlling how an evaluation is isolated from its caller.
LocalEvalSite
An eval site that evaluates requests directly in the local runtime.
LocalTransport
In-process transport that routes frames directly to a local eval site.
LoopEvalSite
An eval site that repeatedly runs its pipeline steps – up to max_iterations times – until the until predicate fires on a reply.
LoopbackTransportEndpoint
RAII guard for a registered loopback endpoint.
PipelineEvalSite
An eval site that threads each request through an ordered chain of connection steps, feeding each step’s reply into the next.
ReplOptions
Configuration for a single run_repl invocation.
ResolvedAddress
Outcome of resolving a ServerAddress to a concrete eval site and codec set.
Server
Live server handle: an address bound to an EvalSite, its codec and threading configuration, lifecycle status, triggers, and optional ServerRuntime.
ServerAddressDescriptor
Citizen descriptor for a server/Address, wrapping a validated address Expr.
ServerFrame
A wire frame carrying a codec-encoded payload plus protocol metadata.
ServerFrameDescriptor
Citizen descriptor for a server/Frame, capturing the wire metadata of one transport frame.
ServerLib
The server Lib implementation, registering the server functions and CLI surface when loaded into a runtime.
ServerRuntime
Server-side runtime: owns the transport, tracks live sessions and worker threads, and records connection and message counters.
Session
State of a single server connection session.
StreamHandle
Buffering, cancellable handle over a server stream’s chunk queue.
TcpServerTransport
TCP listener transport for server-frame connections.
TriggerHandle
Live handle to a running trigger that delivers source events into a server.

Enums§

CoroutineStatus
Lifecycle state of a Coroutine.
FrameKind
Discriminates the role a ServerFrame plays in the wire protocol.
LifecycleCommand
Command carried by a FrameKind::Lifecycle frame.
ReplDriverSpec
Declarative description of a REPL line driver, resolved into a concrete LineDriver by DriverSpec::create_driver.
ReplOutput
Where a REPL run sends its rendered result.
ServerAddress
Location of a SIM server endpoint, parsed from an address expression.
ServerStatus
Lifecycle status of a running server.
ShareMode
How one isolation axis (env, libs, factory, registry, capabilities) is derived for an evaluation.
SiteKind
Identifies the variety of an eval Site.
ThreadMode
Threading strategy a server uses to service connections.

Traits§

ConnectionTransport
One open connection over which server frames are sent and received.
EvalSite
A request-answering eval endpoint: it accepts server frames and produces reply frames, optionally streaming or exposing an EvalFabric.
LineDriver
Source of REPL input lines and sink for rendered output.
ServerTransport
Listening side of a transport: binds an address and accepts connections.
Site
An EvalSite that is also a stream endpoint and can realize placed dataflow fragments.
StreamSink
Receiver for streamed server frames produced by EvalSite::stream.

Functions§

connect_transport_site
Connects to address and returns the eval site plus negotiated codec.
connect_transport_site_with_loopback
Connects to address, returning the eval site plus negotiated codec.
decode_frame_payload
Decodes a frame payload back into an expression using codec.
decode_transport_frame
Decodes a length-prefixed transport frame from bytes.
encode_frame_payload
Encodes an expression with codec and returns the frame payload bytes.
encode_transport_frame
Encodes a frame into its length-prefixed transport byte form.
eval_reply_from_frame
Decodes a response ServerFrame back into an EvalReply.
eval_request_from_frame
Decodes a request ServerFrame back into an EvalRequest.
install_server_lib
Installs the server lib into cx exactly once, registering its functions and CLI exports.
parse_duration
Parses a Duration from a duration string or an integer millisecond count.
realize_site_fragment
Realizes a placed fragment on site, returning the resulting stream envelopes for its output edges.
realize_stream_events
Realizes fragment on site and returns its stream events; an alias for realize named for the streaming call site.
register_address_resolver
Registers an AddressResolver under an address kind in the global resolver registry.
register_line_driver
Registers a LineDriverFactory under name in the global line-driver registry.
register_loopback_transport_endpoint
Registers site as the loopback endpoint for address.
register_wasm_region
Registers a wasm guest module under region using the default runtime.
run_repl
Runs a REPL against options.connection: either evaluates a single supplied input and returns its rendered result, or loops over driver-supplied lines, decoding, evaluating, and writing each result until input is exhausted.
server_address_class_symbol
Returns the class symbol server/Address for the address descriptor citizen.
server_frame_class_symbol
Returns the class symbol server/Frame for the frame descriptor citizen.
server_frame_from_reply
Encodes an EvalReply into a response ServerFrame under codec.
server_frame_from_request
Encodes an EvalRequest into a request ServerFrame under codec.
stream_chunk_frame_from_expr
Builds the standard StreamChunk frame for one expression payload.
stream_end_frame
Builds the standard StreamEnd frame for a stream envelope.
stream_frame_from_expr
Builds a stream boundary or chunk frame from an expression payload.
stream_frame_to_expr
Converts a stream frame into the expression it carries, if any.
stream_frame_to_value
Converts a stream frame into the value it carries, if any.

Type Aliases§

AddressResolver
Function that resolves a ServerAddress (with offered codecs) to a ResolvedAddress.
LineDriverFactory
Function that builds a LineDriver from a configuration expression.