worldant serve builds the current world, publishes a
snapshot, starts the data plane, serves the wire endpoint, and
runs Workflow workers when the snapshot contains Workflows.
Configuration belongs in worldant.ts, including
application and host identities plus the serve-time
platform.wire, platform.pgpaw, and
platform.runtime objects. The strict PgPaw union
contains either embedded settings (builtin: true,
dataDir, databaseName, and pool limits)
or remote settings (builtin: false, a DSN in
remoteAddress, and pool limits). The application node
owns the Worldant profile and callable namespace; the host node
owns public listeners. Wire settings require an IP-literal bind
address and explicit transport booleans and use one port for
WebSocket and WebTransport. At least one transport must be
enabled.
Serve loads final settings and middleware from the newly published
snapshot. Configuration changes do not affect a live process; stop
and rerun serve to publish and apply them. All enabled transports
bind atomically before workers start or readiness is reported. A
bind failure leaves the immutable snapshot published but releases
partial listeners and starts no workers. Port
0 selects one shared ephemeral port and readiness
reports the resolved endpoint.
With builtin PgPaw, serve opens the embedded primary and direct SQLx PostgreSQL pool, migrates and builds, constructs the Worldant node, binds an owner-only private Unix parent socket, then attaches the listenerless PgPaw child and waits for route synchronization. Only then does it bind public Worldant transports, start Workflow workers, and report readiness. The private socket is not an author setting and is not published through endpoint discovery.
SIGINT, SIGTERM, or a critical transport or worker failure cancels the complete node. Shutdown awaits transports, workers, the sweeper, execution host, configuration runtime, and data plane so bound sockets can be reused. Embedded shutdown closes the PgPaw child topology and direct pool before closing the primary.
The host uses evictable JavaScript runtime slots keyed by snapshot and entrypoint. Eviction never loses durable truth because Workflow progress and application data live in PostgreSQL.