Skip to main content

Crate subc_client_rs

Crate subc_client_rs 

Source

Re-exports§

pub use consumer::is_retryable_route_open_code;
pub use consumer::AppOpenError;
pub use consumer::CallError;
pub use consumer::CallOptions;
pub use consumer::CallReply;
pub use consumer::CancelHandle;
pub use consumer::CancelOutcome;
pub use consumer::CatalogList;
pub use consumer::CatalogSubscription;
pub use consumer::CloseRouteOptions;
pub use consumer::ConfigApplyResponse;
pub use consumer::ConfigModulesResponse;
pub use consumer::ConfigSchemaResponse;
pub use consumer::ConfigShowResponse;
pub use consumer::ConfigSubscription;
pub use consumer::ConnectionFacts;
pub use consumer::ConnectionState;
pub use consumer::ConsumerCapabilityError;
pub use consumer::ConsumerError;
pub use consumer::ConsumerOptions;
pub use consumer::ControlPush;
pub use consumer::CorrelationId;
pub use consumer::HealthProbeResponse;
pub use consumer::NotSentCause;
pub use consumer::OutcomeUnknownCause;
pub use consumer::PendingReply;
pub use consumer::PushEvent;
pub use consumer::RequestBody;
pub use consumer::RequestReservation;
pub use consumer::RetryBackoff;
pub use consumer::ReverseRequestContext;
pub use consumer::ReverseRequestError;
pub use consumer::ReverseRequestRegistrationError;
pub use consumer::ReverseRequestRegistry;
pub use consumer::RouteCloseDisposition;
pub use consumer::RouteCloseReason;
pub use consumer::RouteEndReason;
pub use consumer::RoutePollResult;
pub use consumer::ScopeBindProofRefusal;
pub use consumer::ServerDescription;
pub use consumer::SpawnStreamError;
pub use consumer::SpawnSubscription;
pub use consumer::StderrTailResponse;
pub use consumer::SubcConsumer;
pub use consumer::SubscribeOptions;
pub use consumer::Subscription;
pub use consumer::SubscriptionClosed;
pub use consumer::SubscriptionEnd;
pub use consumer::SupervisorAck;
pub use consumer::SupervisorHealthResponse;
pub use consumer::SupervisorListResponse;
pub use consumer::SupervisorProvenanceResponse;
pub use consumer::ACCEPTED_CLOSE_REASONS;
pub use consumer::DEFAULT_CALL_TIMEOUT;
pub use consumer::DEFAULT_LIVENESS_PROBE_WINDOW;
pub use consumer::DEFAULT_ROUTE_RETRY_DEADLINE;
pub use consumer::SPAWN_CURSOR_INCARNATION_MISMATCH;
pub use consumer::SPAWN_CURSOR_TOO_OLD;
pub use consumer::SPAWN_SUBSCRIBER_LAGGED;
pub use policy_cache::PolicyResolveError;
pub use policy_cache::PolicyResolver;
pub use policy_cache::PolicyResolverConfig;
pub use policy_cache::PolicyResolverFootprint;
pub use policy_cache::PolicyVerdict;
pub use policy_cache::ProjectRef;
pub use policy_cache::Subject;
pub use policy_cache::DEFAULT_POLICY_RESOLVER_MODULE_ID;
pub use registration::ClaimError;
pub use activity::*;

Modules§

activity
Activity ledger helpers and refusal classification.
config
Opt-in module configuration delivery. See ModuleHandler for lifecycle hooks.
consumer
launch_nonce
The one launch-nonce reader for a module process: launch_nonce() reads the inherited Unix descriptor, the Windows named pipe, or, when neither is named, the SUBC_LAUNCH_NONCE environment copy once and caches it. The SDK’s HELLO and route opens go through it too; a module’s own readers must as well. Read before spawning children so they cannot inherit an unread Unix pipe containing the module’s credential. The launch nonce: the secret the daemon gives each module it spawns, which the module presents to be admitted as itself.
policy_cache
Revision-aware policy resolution for modules that enforce fleet gates.
registration
One process owner for registration and claim minting. No synchronous mutex is held over I/O. The async pool lock serializes consumer creation, not minting or the registration reader, so a HELLO/claim reply can always make progress.

Structs§

AgentCommandFinished
A completed declared root. CPU includes reaped descendants where available.
AgentCommandRoot
A command’s PID and kernel start time in milliseconds since the Unix epoch. Obtain the time through subc_os::process_start_time_ms, not a wall clock.
AppOpenReply
A successful app.open reply.
BindDecision
Decision returned by ModuleHandler::on_bind.
CapabilityDeclarations
Static, versioned capabilities declared by a module.
CapabilityRequirement
One capability a module consumes and whether its absence is tolerated.
CatalogEntry
A registered module’s catalog projection.
CatalogWatchResponse
One channel-0 subscription response on the request’s correlation id, with RESPONSE and MORE set, like activity.subscribe. There is no separate ACK: the first push carries the current generation, then advances may coalesce.
ConfigEdit
One approved-layer patch. Workspace and project edits currently produce layer_not_served; daemon settings cannot be edited through this operation.
ConfigFileError
A settings-file observation failure, separate from the approved settings status.
ConfigModule
Status strings are open: clients display an unfamiliar status as raw text.
ConfigPlanRefusal
A diagnostic displayed verbatim for a blocking refusal or a skipped input.
ConfigPlanView
The trusted surface renders the entire plan, not just the digest.
ConfigSettingsLayer
Parsed layer documents, never file paths, raw bytes, or proposal values.
ConfigStatus
Diagnostic strings are extensible; they never grant approval authority.
ConsumerIdentity
Daemon-spawned consumer identity presented on route.open.
Digest
A full SHA-256, encoded as sha256: followed by 64 lowercase hex characters.
Discovered
A connection file selected by reader-side discovery.
DiscoveryError
Every connection-file candidate reader-side discovery tried.
HealthReport
LiveRootsSnapshot
A single read-lock snapshot of bound and pending project routes.
MachineId
This machine’s name, minted once by the daemon and served to every module that registers with it (on HELLO_ACK and server.describe).
ManifestProvenance
Build facts a module DECLARES about its own binary at HELLO. The daemon overlays process-identity evidence it alone can attest; the two halves are served together via supervisor.provenance and never merged.
ModuleHandle
Cloneable handle for module-originated control RPCs on channel 0.
ModuleStopHandle
A cooperative stop signal that can be created before connecting to the daemon. Clones share the same, irreversible stop request. Await the serving future after calling stop; dropping it does not perform teardown.
OperatorAppPathError
The installed daemon’s path could not be resolved without environment input.
ProvenanceFormError
A declared build fact did not use its canonical form.
RequestClass
A classifier’s answer about one data request: the pool it waits in, and an optional label naming the operation, used only in the SDK’s logs.
RequestCtx
Per-request context. Retains the full route handle and correlation id, provides interim stream emission, and exposes a cancellation signal.
RequestPoolSnapshot
Figures for one handler-slot pool at one moment, from ModuleHandle::request_pool_snapshots.
RequestPools
How a module’s data requests share handler slots, returned from ModuleHandler::request_pools.
RouteAuthorizeExpected
Claim derivation inputs. Missing fields must also be absent on the scope; they are not wildcards. Like a stamp, omitted delegates means false.
RouteAuthorizeResponse
RouteAuthorizeScope
A stored scope identity, never a bind proof or an unpinned selector.
RouteBindRequest
Route-bind request delivered on channel 0.
RouteHandle
Immutable identity of one route binding on one live connection.
RouteOpenTarget
Daemon-attested target facts. Spawn-only keys are ignored for all other kinds, which are always unmarked. Incomplete targets decode as absent in the reply.
ScopeApplyReply
The daemon’s answer to an accepted ModuleHandle::scope_apply.
ScopeDescribeReply
The daemon’s answer to ModuleHandle::scope_describe about one (owner, ref).
ScopeRef
An owner-qualified scope reference, without selecting an epoch.
ScopeSelector
The scope a route is opened under, re-exported so a caller of SubcConsumer::open_route_scoped can name the type from this crate. The scope a route.open asks to be admitted under.
ScopeServedByReply
Volatile bind history in one daemon incarnation; unknown never means served.
ScopeSubscription
A scope lifecycle feed on the module’s registered connection. Initial states are available before any push; queued pushes precede terminal errors.
ScopeSyncReply
The daemon’s answer to an accepted ModuleHandle::scope_sync.
ScopeWatchPush
A terminal event delivered at most once per selector within one watch.
ScopeWatchResponse
Initial nonterminal RESPONSE, followed by lifecycle STREAM_DATA pushes.
ScopeWatchSelector
One epoch whose lifetime the caller wants to observe.
ScopeWatchState
One entry in the initial snapshot, in request order.
ServeOptions
Configuration for a module’s connection lifecycle. Existing serve* functions use the defaults; use these builder methods to customize serving.
SupervisorEntry
A supervised module’s current state and process observations.
Tool
Tool-plane capability exposed by a tool_provider.

Enums§

AdmissionClass
Admission behavior carried in flags bits 4-5.
AgentCommandsError
A refused or incomplete agent-command declaration never closes the module’s connection.
AppOpenStatus
What an app.open call did.
CallMode
The mode the daemon derives from a route’s scope, never from its request body.
CapabilityNeed
Closed capability requirement strength vocabulary.
CatalogOrigin
Evidence-backed program origin. Unknown strings establish no recognized origin.
CatalogUpdateError
Errors returned by ModuleHandle::catalog_update, ModuleHandle::set_ready and ModuleHandle::update_role_declarations.
ConfigEditAction
ConfigFileErrorLayer
Which settings layer a refused file belongs to: the project’s own file or its workspace’s.
ConfigThrough
An inclusive upper bound on the layers merged by config.show.
ConfigWatchEvent
A watch always begins with a full resync, including after reconnecting. A resync may arrive at any time and replaces the reader’s entire state.
ConnectionEnd
How a registered module’s daemon connection ended. After the handshake, EOF and socket disconnects are orderly ends on every platform: serving calls on_connection_end and returns Ok(()). Handshake, handler, protocol and other transport failures return errors.
ExecutionMode
How a tool’s side effects are fenced for durable at-most-once handling.
HandlerOutcome
The terminal result of a module request handler.
HealthStatus
LaunchNonceSource
Where a module read its launch nonce from, as reported in ManifestProvenance::launch_nonce_source.
OperatorConfirmError
Failure to authorise a write through ModuleHandle::confirm_operator, ModuleHandle::confirm_operation or ModuleHandle::confirm_enrollment. Every variant requires the module to refuse the write, with one exception described on OperatorConfirmError::PresenceUnsupportedPlatform.
ProviderRole
Provider capabilities exposed by a module.
RequestPool
The handler-slot pool a data request waits in.
RouteAuthorizeOutcome
RouteOpenTargetKind
A target kind unknown to this reader never establishes a supervised spawn.
ScopeCallError
Errors returned by ModuleHandle::scope_sync, ModuleHandle::scope_apply and ModuleHandle::scope_describe.
ScopeServedByAnswer
Only Served establishes that the target acknowledged a scoped bind.
ScopeWatchEvent
Terminal lifecycle transition for the watched epoch.
ScopeWatchStatus
Current state of a requested epoch; unknown never establishes liveness.
SubcModuleError

Constants§

CALL_MODES_CAPABILITY
Declaring this in capabilities.provides promises that a module reads the call mode on every bind and handles classic, codemode and flow calls.
PROVENANCE_SENTINELS
Sentinel strings that build tooling emits where it means “no value”: shell fallbacks and Makefile defaults produce unknown, wire vocabulary uses unavailable, and git describe failures surface as none. Publishing any of them as a fact is the well-formed-lie shape the provenance contract warns against — a present, well-formed field stops the reader asking — so the helper maps them all to field omission. Matched case-insensitively because UNKNOWN/Unknown are equally common from shell fallbacks.
SUBC_PROTOCOL_CRATE_VERSION
The version of THIS crate (subc-protocol) as compiled into the linking binary — the fleet’s shared wire-vocabulary version, and the value ManifestProvenance.wire_crate_version declares. Not the version of a module’s own envelope or payload crates: those are different numbering spaces, and declaring one here produces a confident wrong answer at any version gate (insula shipped exactly that before the referent was written down). env! makes it a property of the compiled binary, not of whatever source tree sits beside it at run time.

Traits§

ModuleHandler
Trait implemented by a module for its business logic. The serve functions in this crate own all wire-protocol plumbing.
ModuleStream
Owned byte transport for a module connection, before or after authentication.

Functions§

build_provenance
Build ManifestProvenance from legacy raw build facts.
discover
Read the reader-side environment and return the first usable connection file. Unlike writer-side subc_daemon::bootstrap::connection_file_path(), this searches every location where an already-running daemon may have written its file.
discovery_candidates
The paths a reader consults, most specific first. explicit is the caller’s own override (a --subc flag); env_named is the value of SUBC_CONNECTION_FILE read by the caller. Either, when present, is the ONLY candidate.
launch_nonce
The one launch-nonce reader for a module process: launch_nonce() reads the inherited Unix descriptor, the Windows named pipe, or, when neither is named, the SUBC_LAUNCH_NONCE environment copy once and caches it. The SDK’s HELLO and route opens go through it too; a module’s own readers must as well. Read before spawning children so they cannot inherit an unread Unix pipe containing the module’s credential. This process’s launch nonce and where it came from.
launch_nonce_source
The cached launch-nonce source (fd, pipe or env), or None when no nonce is available. The SDK records this in the registration message’s manifest.provenance.launch_nonce_source; the daemon stores that declaration for ck provenance to display. A module constructing that record can use: .with_launch_nonce_source(subc_client_rs::launch_nonce_source()).
operator_app_candidates
Resolve the installed daemon’s connection-file candidates using OS facts only.
operator_app_path
Resolve the first existing installed-daemon connection-file candidate, or the first candidate if none exists, without reading environment variables.
retain_launch_nonce_for_hello
Retain a reserved module’s launch nonce for its HELLO after the module has scrubbed the nonce from the process environment.
serve
Run a module to completion. Reads --subc <connection-file> from args, uses SUBC_MODULE_ID when set by the process that launched the module, connects, authenticates, sends HELLO, waits for HELLO_ACK, then serves frames until GOODBYE, clean EOF or a socket disconnect. How it ended is passed to ModuleHandler::on_connection_end. A validated inherited registration channel replaces TCP when available. It is never reconnected; its end exits the process after the lifecycle hook and teardown, so the supervisor can restart the module with a new channel.
serve_from_env_with_handle
Connect and register using the same launch inputs as serve, returning a cloneable handle and the future that keeps the module serving.
serve_with
Run a module with an explicit connection-file path. The manifest is sent as provided; callers that need a nonstandard module id should set it before calling.
serve_with_handle
Connect, register the module, and return a cloneable handle plus the future that must be awaited or spawned to keep serving the connection.

Type Aliases§

ModuleServeFuture
Future returned by serve_with_handle that runs the module until GOODBYE or EOF.

Attribute Macros§

async_trait