Repository navigation
rutis v0.13.0
rutis 0.13.0
The main change in 0.13.0 is unified events (#464): every listener on a host — of Rust plugins, of Node / Bun / Python / Go leaf plugins, of Cordis plugins, of remote runtimes and linked nodes — is on one logical bus; the five modes emit, parallel, serial, waterfall and synchronous bail mean the same everywhere, and wherever an event is emitted and wherever its listeners are, the result is the same as if every listener were in one process. This version keeps none of the old event behaviour and does not mix with runtimes or nodes of 0.12 and earlier; see "Compatibility" below and migrating to 0.13.
Packages
These packages are all at version 0.13.0:
| Registry | Packages |
|---|---|
| crates.io | rutis (the kernel), rutis-bridge, rutis-loader, rutis-host; the dylib toolchain rutis-sdk, rutis-dylib, rutis-dylib-meta, rutis-dylib-launcher |
| npm | @arcships/rutis, @arcships/rutis-runtime, @arcships/rutis-bun, @arcships/rutis-host, and the five platform host packages |
| PyPI | rutis, rutis-host |
| Go | github.com/arcships/rutis/go/rutis (tag go/rutis/v0.13.0) |
| GitHub | rutis-host binaries for Linux / macOS (x64 / arm64) and Windows (x64), with SHA-256 checksums |
rutis-cli is still released separately.
New
- Unified events: one logical bus (#464, design, protocol spec, plugin API): a plugin writes
ctx.on(name, listener)as before; the listener registers itself with the host and nothing is declared. Events emitted in any language, process or linked node reach it by the same rules. When every listener of a name is in the emitter's process, the dispatch runs there without the host, with the same results. Supersedes the drafts #340, #358, #359 and the event boundary rules 2–5 ofrequirements-protocol-plugins§5. - Five modes, in every language:
emit(returns at once; a failing listener is reported in one line where it runs and reaches neither the emitter nor the other listeners),parallel(waits for all; failures are anAggregateErrorin registration order),serial(the first result),waterfall(middleware: each listener getsnextlast, andnextmay be a function in another process) and the synchronousbail(listeners elsewhere run as synchronous calls, under wait-cycle detection; an asynchronous listener fails it withAsyncListener). Rust also haswaterfall_sync. Each language writes them its own way: Node / Bun leaf pluginsctx.emit/await ctx.parallel/await ctx.serial/ctx.waterfall/ctx.bail, Cordis plugins Cordis's own API, Pythonctx.emit/await ctx.parallel/await ctx.serial/await ctx.waterfall/ctx.bail, Goctx.Emit/Parallel/Serial/Waterfall/Bail, Rust the methods of the same names onctx.events(). - Scopes: an event's scope is the loader instance the emitter is in; a listener receives the events emitted in its scope and inside it, never a sibling instance's (events no longer leak between instances). Rust adds
Ctx::scope(),Ctx::mark_scope,Ctx::mark_row; Go addsctx.Scope(). (Amended in a later release: events are one flat bus, and a scope is a filter descriptor; see migration-0.13.) - Filters:
filter(keep)(Rustctx.events().filter, Node / Bun / Pythonctx.filter, Goctx.Filter) is evaluated in the emitter's process, before any listener starts, once for each candidate's descriptor (plugin, row, runtime, node, scope chain); Cordis'sContext.filteruses the same mechanism, and every Context has a new read-onlyctx.rutis. The listener optionsprependandglobal(exempt from filters) exist in every language. - One lifecycle: on unload a row's listeners leave the bus first, and the running ones get a cancellation signal (Go context, Python task cancellation, JavaScript
ctx.signal, Rustctx.cancelled()) and are waited for, at mostRUTIS_SHUTDOWN_TIMEOUT. When a runtime process or node goes away, its listeners leave the bus and calls in progress fail once (BindingError). - Framework events
rutis/*: the host publishesrutis/service(a service appears, is replaced or withdrawn),rutis/row(a row's state) andrutis/runtime(a runtime running or down), which plugins in every language can listen to; a plugin emittingrutis/*fails withReservedEvent. Rust types:rutis_loader::RowEvent,rutis_bridge::events::{ServiceEvent, RuntimeEvent}. - Events between nodes work as on one machine (connecting nodes):
export/importof the node row select events too, and an item may be a prefix ending in*; the far listeners are entries on this node's bus, with the five modes, scopes, filters and every value type (before: alwaysparallel, JSON only). Events travel one hop. - Values: event arguments and results cross by the rules of calls: the ten values, references to functions and objects, 64 levels. A Rust typed event is named across languages by
Event::NAMEand its arguments are serde-encoded (one argument per field of a tuple struct);rutis_bridge::events::Argscarries any arguments by name. - Test tools:
@arcships/rutis/testing(load, andhost()for several plugins on one bus),rutis.testing(load(..., bus=, scope=),Bus) and Go'srutistest(loaded.On,rutistest.InScope) offer the same five modes, filters, scopes, unload waiting and cancelling; the real runtimes and the test tools are checked against one events expectations file (events.expected.json). - Plugin API 3: adds
parallel,serial,waterfall,bailandfilter.
Tests and quality
- Cross-version meetings now check refusals (
events/old-peer-refused): the gate's cross-version tests (tests/e2e/tests/cross_version.rs) meet 0.12.1; the old Node, Bun and Python runtimes and binaries built with the old Go SDK under the current host, the old Python remote runtime the current host dials, the current runtimes under the old host, and old and current nodes with either one dialing are all refused right after the handshake, before anything loads, saying which end to upgrade, without retrying or hanging. From 0.13.1 the previous release declaresevents-v2too, and the meetings are expected to work again (bridge/cross-version-meetings). - The checks after publishing wait for every npm package (#457): while waiting for the registries to serve the version, every npm package
node scripts/train.mjs --npmlists is waited for,@arcships/rutis-bun,@arcships/rutisand@arcships/rutis-runtimeincluded (0.12.0's checks after publishing failed once because@arcships/rutis-buncould not be fetched yet).
Compatibility
No old behaviour is kept and there is no backward-compatible path. Each rewrite is in migrating to 0.13.
- Mixing with 0.12 and earlier is refused: every 0.13 end declares the required capability
events-v2in its handshake; runtimes, remote runtimes, connected runtimes and nodes of 0.12 and earlier are refused before anything loads:incompatible session: the far end (<name> <version>) does not declare events-v2 (the event protocol of rutis 0.13): upgrade it to rutis 0.13 or later. A node link stops asincompatibleand does not retry. A 0.13 runtime meeting an older host exits with status 1:rutis: refused: incompatible (this host does not declare events-v2 (the event protocol of rutis 0.13): upgrade rutis-host to 0.13 or later); stopping. Upgrade rutis-host, the runtime packages and every linked node together. The session protocol versions are unchanged (compat 2, endpoint 3,rutis.3). - Plugin API 3: 0.13 runtimes still load API 2 plugins; an older runtime refuses an API 3 plugin with the existing message.
- Removed configuration and APIs (writing them is an error that names the replacement):
- Rust (
rutis-bridge):RuntimePlugin::emits,LocalRuntime::emits,Mount.emits,Mount.events(EventSink),Process::emit,runtime::events::{Events, EmitToCordis}, the nodeEventsPlugin,NodeEvent,node_event,Features { outbound, inbound };.event/.emitofcordis::build;runtime::testing::weather_emits. Changed signatures:Mountgainsctx(without it a runtime's events stay in its process) andruntime,Process::load_row/load_row_exportinggain a lastscope,runtime::testing::runtimegains a firstctx. - The Rust kernel (
rutis):on_waterfall*,on_waterfall_sync*,WaterfallListener,SyncWaterfallListener,PatternWaterfallListener,SyncPatternWaterfallListener,Next,SyncNext,SyncEvent,EventKey::instance, every*_instanceand*_keyedmethod,EventPattern::any_prefix,EventPattern::prefixes,EventKey::instance_id,ListenerKind::{AsyncWaterfall, SyncWaterfall},CordisError::ReentrantEvent(a synchronous dispatch of a name may re-enter it). Thecallof the listener traits takes a lastCall/SyncCall; the fields ofEventSubscriptiongo by name (see the migration guide).EventrequiresSerialize + DeserializeOwned; listeners are one kind,on(ctx, key, |ctx, e, call| ..)/on_sync;serialtakes anArc<E>;waterfallandTerminalreturn anOption. eventsandemitsof Cordis mount manifests and the generator:the config field <events|emits> was removed in rutis 0.13: listeners register themselves; emit with ctx.emit / parallel / serial / waterfall / bail (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md).events: { out, in }of node rows:the peer config field events was removed in rutis 0.13: list events: { out } in export and events: { in } in import (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md). An oldrutis.jsonstill writing it is refused byrutis-host checkand at start with that message;formatstays 1 and old files without it read as before (the persisted samplerejected/peer-events/records the refusal). In a Cordis application acting as a node,out/inofEventsgivethe Events options out / in were removed in rutis 0.13: use export / import (https://github.com/arcships/rutis/blob/main/docs/migration-0.13.md).- The test tools'
emitsdeclared at load (Node / Bunload(plugin, { emits }), Pythonload(plugin, emits=…), the trailing event names of Go'srutistest.Load). - Protocol: the
mountargumentsevents/emits, themountfeatureevents, runtime → hostevent, host → runtimeemit, the nodes'events.forward.
- Rust (
- Behaviour changes:
- A failing
emitlistener no longer ends the process, stops the other listeners or reaches the emitter; it is reported in one line where it runs,rutis: listener of <name> in row <row> failed: <ErrorName>: <message>. - Go's
Emitno longer waits for listeners, and its error is only a refusal; a listener isfunc(ctx, args ...any) (any, error). parallelfailures are always anAggregateError, children in registration order, even a single one (Rust used to return a single error as is and several in completion order).falseis no result, Rust'sSome(false)too.- A synchronous
bailmeeting an asynchronous listener fails withAsyncListener, in every language (Cordis took the Promise as the result). - A Rust listener is called with the
ctxthat registered it, not the emitter's; every Rust listener is filtered by liveness and waited for on unload. - Unloading waits for running listeners, in every language.
rutis/*names are reserved.
- A failing
- Event boundary rules: rules 2–5 of
requirements-protocol-plugins§5 are removed, replaced by section 3 of unified events.
Getting started
npx @arcships/rutis-host@0.13.0 new greeter --lang nodeHow to write events: plugin API, and the "Events" section of each language guide: TypeScript, Bun, Python, Go, Cordis, Rust.