Skip to content

rutis v0.19.0

Choose a tag to compare

@github-actions github-actions released this 29 Oct 20:29
· 988 commits to main since this release
11a3930

rutis 0.19.0

中文 · 0.18.0 release notes

0.19.0 is for host owners (#694): you can call a service in a running host from the command line, install plugins with rutis-host add, and let plugins add and remove rows through the service loader, written back to rutis.json. Remote runtimes, devices and nodes are all connection rows now (rutis-host/dial, rutis-host/listen), with one session plugin behind them (remote connections: one session plugin), and the platform drops interfaces nothing uses (platform cleanup). This release has breaking changes, and the host, every language runtime and every SDK must be upgraded together: 0.19 refuses 0.18 and earlier at the handshake. Read migrating to 0.19 before upgrading.

Upgrade in this order: move the host, the language runtimes and the SDKs to 0.19 together; rebuild Go and Swift binaries built with an older SDK against the 0.19 SDK; then run rutis-host check with 0.19, which lists the fields and plugin names it no longer knows.

Breaking changes

Each item says what to change; details and examples are in migrating to 0.19.

  • Session protocol 4: the host, runtimes and SDKs upgrade together (#695, #849; #814, #815, #817, #818, #824, #826). Sessions keep only the endpoint format; each end always reports its own id. 0.19 refuses hosts, runtimes, nodes and SDKs of 0.18 and earlier at the handshake and says which end to upgrade, for example incompatible session: the far end speaks protocol 2, this side 4: upgrade the far end and this endpoint speaks rutis.4, the dialer offered rutis.3: upgrade the dialer. A 0.18 host starting a 0.19 local runtime makes the runtime stop before the handshake: a local channel needs --id <endpoint>: fd:3; a host older than rutis 0.19 started this runtime: upgrade the host.

    • What to change: upgrade the host, Node, Bun, Python, Go, Swift and Kotlin to 0.19 together; rebuild Go and Swift binaries with the 0.19 SDK.
    • If you start runtime processes yourself: local channels (fd:3, a socket path, tcp:) also take --id <name>; the Node and Bun runtimes' --format is removed; rutisProtocol in package.json is 4; the WebSocket subprotocol is rutis.4; Go's advanced.ServeConn(conn, defs...) becomes advanced.ServeConn(conn, id, defs...).
  • Remote runtimes and devices are connection rows (#695, #870, #872). runtimes.remote is removed, with no conversion; a remote runtime is a rutis-host/dial row (rutis dials) or a rutis-host/listen row (the far end dials in), and a plugin running on the far side is a row <connection row>:<plugin>:

    { "id": "gpu", "name": "rutis-host/dial", "config": { "address": "wss://gpu.example.com:7443/rutis" } },
    { "id": "embedder", "name": "gpu:embedder" }
    • A rutis.json with runtimes.remote gets the 0.18 unknown-field error, with no dedicated hint: rutis-host: rutis.json: unknown field remote, expected one of ….
    • The row id names the connection: the runtime's --id, the token's name (RUTIS_TOKEN_<row id>) and the output prefix all use it. A runtime that used to dial in and let rutis decide its plugins now listens, and rutis dials it with rutis-host/dial.
    • Many devices (formerly listen + instances and an instanced group): one rutis-host/listen row; the Kotlin and Swift apps on the devices install their own plugins, with their config in RutisApp(configs: …), and once connected announce the services they provide, registered as <device id>:<plugin>. Rows the host ran once per device (such as py:coach) are no longer supported: move them onto the device, or have a plugin on the host add a row per device through loader on the rutis/service event (example in Swift apps).
    • On rutis-host/listen, a new connection with the same id replaces the old one: the old connection's remote plugins are all unloaded first, then the old connection is closed with code 4002.
    • A missing plugin fails only its row (#696, #768), checked again the next time the far end connects: embedder: unresolved: entry "embedder" rejected: runtime gpu: this connection does not contain plugin embedder. Rust embedders matching LoaderError::NotFound for this case use rutis_loader::report::Unavailable::is(&error).
  • Nodes are connection rows (#695, #883). rutis-bridge/peer rows and peer:<peer>/<plugin> rows are removed, with no conversion; one node writes rutis-host/dial, the other rutis-host/listen (connecting nodes). A row still naming rutis-bridge/peer fails as an unknown plugin: office (rutis-bridge/peer): no plugin named "rutis-bridge/peer".

    • export, import, host, rows, peer, require, declare, transport and identity are no longer written: services are visible on both sides, events are one bus, and the far end's id comes from the handshake. The same service name follows the kernel's rule, the later registration is refused: office:weather: weather is provided here by row weather: not registered from office. To keep a service from the far side, use isolate on the row providing it.
    • Running a plugin on another node: formerly host: true + rows: true + a row peer:office/scanner; now a row office:scanner, with nothing to open on the far side.
    • Giving out a token lets the far end run any plugin it can resolve on this node: connect only to nodes you trust. Services received over one connection reach a third node over another (formerly one hop only).
    • @arcships/rutis-runtime/bridge (a Cordis app as a node: Link, Export, Import, Host, Events) is removed: a Cordis app joins rutis by running its plugins in the Node runtime.
  • The host side reads only RUTIS_TOKEN_<name> (#822). It no longer falls back to the shared RUTIS_TOKEN; the runtime side's RUTIS_TOKEN is unchanged. <name> is the connection row's id, upper case, with - written as _.

    • What to change: a host that set only RUTIS_TOKEN sets one per connection row. Unchanged, a rutis-host/listen row fails with phone: set RUTIS_TOKEN_PHONE: the token the far ends present when they connect, and a rutis-host/dial row is refused by the far end and retries every 30 seconds: office: disconnected (auth-rejected: …); retrying in 30s.
  • Connection output changed. Connection status lines start with the connection row's id and use only connected and disconnected, with the reason in parentheses (formerly runtime <name>: link … and <row id>: link connected / link down and so on):

    gpu: connected
    gpu: disconnected (gpu.example.com:7443: Connection refused); retrying in 2.1s
    gpu: disconnected (incompatible: this endpoint speaks rutis.3, the dialer offered rutis.4: upgrade this endpoint (PyPI rutis)); stopped
    phone: connected phone-1
    phone: disconnected phone-1 (replaced by a new connection)
    

    rutis-host status has one line per connection row under connections:: a dial row says connected / disconnected, a listen row lists the ids connected (none connected when there are none). Scripts reading run's output follow the new format.

  • Go and Swift row names keep only the language prefix (#876). go-<binary>:<plugin> and swift-<binary>:<plugin> are removed; write go:<plugin> and swift:<plugin>. A rutis.json still using the old form fails when read, with the new form in the message. When two binaries have a plugin of the same name, that row fails, naming both files.

  • Every language's test tool runs plugins on a real host (#875, #878, #894, #895, #881, #882, #885, #899). @arcships/rutis/testing, rutis.testing, rutistest, RutisTest and the Kotlin test tool run the plugin under test as a row of rutis-host test: rutis-host must be on PATH, or its path given in RUTIS_HOST (projects made by rutis-host new already have it). What a test sees is what the host does: a service name already provided, a config that does not pass and the like fail in the test, as in a real host.

    • The test tools have no scopes any more: scope, scopes, strict, deadline, runtime and similar options are removed (Go's InScope, InChain, RuntimeName, Swift's RutisTest.scope and runtimeName:, Kotlin's load(scope:) and load(runtime:), and so on); the row id is id / row:, and isolation is the same isolate as in rutis.json. A load failure reads as the line the host writes for the row, such as weather: config: city is required; reported is a method you await, each item being the line the host printed.
    • TypeScript / Bun: add @arcships/rutis-runtime (@arcships/rutis-bun under Bun) and @arcships/rutis-host to the dev dependencies; the plugin under test must be its module's default export. Python: rutis.config is removed. Kotlin: the test tool is a separate artifact, io.github.arcships:rutis-testing.
    • Config is validated and filled with defaults only in the host; the SDKs only decode. Plugins an app installs itself (RutisApp) are not validated by the host: missing keys take the defaults written in the type, and a missing required key or a wrong type fails with a line such as config: <key> is required.
    • Every event goes through the host, even when all the listeners are in the same process: a plugin looking at its listeners' results after an emit waits for one round trip through the host; in Go, ctx.Emit after the session ended fails with the host disconnected; in Kotlin, a synchronous bail on the Android main thread is always refused. If you implement a runtime, drop your handling of events.elsewhere (the host no longer sends it, #908).
    • What to change in each language: the migration guide's TypeScript and Bun, Python, Go, Swift and Kotlin.
  • The Kotlin SDK is used from source (#893). It is not published to Maven: fetch this repository's tag v0.19.0, bring it in with includeBuild("../rutis/kotlin/rutis"), and write the dependencies without a version (implementation("io.github.arcships:rutis"), ksp("io.github.arcships:rutis-ksp")); see the Kotlin app guide.

  • Python 3.12 or later (#860). Python 3.10 and 3.11 are no longer supported.

  • SDK roots keep only the names plugin authors use (#692; #762, #763, #769, #775, #777, #778; old names removed in #819, #821, #835, #827, #829). The other names move to advanced: @arcships/rutis/advanced, rutis.advanced, github.com/arcships/rutis/go/rutis/advanced, Rutis.Advanced, arcships.rutis.advanced; what macro- and KSP-generated code uses is in Rutis._Generated and arcships.rutis.generated. The old locations are gone: using them is a not-found error at compile or import time.

    • What to change: imports only, by the table in the migration guide. definePlugin / define_plugin / Define / Rutis.define and the methods on ctx are unchanged; the plugin API version is unchanged.
    • Kotlin: rutis-ksp must be the SDK's version; precompiled Kotlin plugin libraries are recompiled against the 0.19 SDK.
    • Python: plugins and the runtime share the host environment's rutis, so they upgrade with the host.
  • Rust: the connection, session and local runtime API (#833, #843, #834, #849, #870, #872, #880, #883). A local language runtime is now, like a remote one, the far end of a session. The full table is in the migration guide under "Rust embedding"; the main changes:

    • Transport, Dial, transport_key and the *Plugin/*Transport types are removed; websocket::dial, websocket::listen, pipe::spawn and memory::pair give a Channel directly. A connection of your own is a connection plugin calling Session::new(channel) (or Session::handshake(&ctx, channel).await first).
    • LinkPlugin, PeerPlugin, ExportPlugin, ImportPlugin, HostPlugin, AccessPointPlugin, the Identity, Admission and Registration families, and rutis-loader's peer feature are removed.
    • LocalRuntime and RuntimePlugin are removed: a local runtime is rutis_host::connect::SpawnPlugin::new(name, launcher, anchor) (the plugin rutis-host/spawn), launcher being rutis_host::languages::node::launcher(&package) and so on; rutis-bridge carries no language any more, and its features node, python, go, bun, swift and kotlin are removed; the runtime's state is in RuntimeStates. RuntimeResolver becomes one rutis_loader::runtime::SessionResolver shared by all runtimes; Rust no longer resolves npm names, the Node runtime does.
    • Closer::replaced() / rejected(r) / close(&str) become close(Close::…); ChannelInfo is removed; Connection::open(channel, dispatch, endpoint); session::PROTOCOL, Format and LinkConfig are removed and ENDPOINT_PROTOCOL is 4; Embedding.transports and Embedding.identity are removed; an embedder mounting a Session itself provides rutis_bridge::LocalId(id) at the root.
    • rutis_host::control::serve takes one more argument after the Loader, a Report, obtained with Host::status_report().
  • Platform cleanup: Rust APIs without users are removed (#694; #832, #845, #848, #840, #837, #839, #836, #838, #841, #820, #880). No compatibility layer: what was removed is a compile error; the full table is in the migration guide under "Platform cleanup". The main ones:

    • Kernel: ctx.plugin_from → implement PluginFactory and use ctx.plugin_with; waterfall_sync → waterfall or a synchronous bail; service interceptors, the check() gate, FiberView::effects(), EventBus::observe_dispatch, take_cleanup_errors() and the anyhow feature are removed; config validation is rutis::config::check(schema, config).
    • Call limits and service lists (call_limit, kill_on_timeout, allowed_services, the error code timeout) are removed: callers set their own time limits, and the host decides which services a plugin can use.
    • Loader: set_overlay / overlays() removed; waiting_for → waits; locate → row; schema_of → resolve(name).await?.schema; ServiceCatalog::share_by_name() and share_registered_only() removed; status::RowState → report::EntryStatus, report::RowState renamed RowEventState; the Go and Swift Go*/Swift* types merge into runtime::binary::*<Go|Swift>; the loader no longer restarts crashed Go/Swift runtimes (backoff, RestartPolicy, supervise removed): the restart policy is rutis-host's runtimes.<key>.restart.
    • The generator moves from rutis-bridge to the new crate rutis-types (#844): rutis_bridge::build::Exports → rutis_types::Exports, and the build-dependency rutis-bridge = { features = ["exports"] } becomes rutis-types; usage is the same. Error types outside rutis named Error get generated types named after their module (IoErrorThrown, AnyhowErrorThrown, #862).
    • rutis_bridge::cordis::build::rutis_plugin and cordis::server are removed (a Cordis host mounting Rust plugins is no longer supported, #836).
    • Also: rutis_loader::internal folded away (#887), *_key replaced by Key and *_at (#898), language knowledge moved out of rutis-bridge (#906), the bridge no longer declaring old capabilities (#888), and events.elsewhere and Dispatch::arrived / replied removed (#908): the table is in the migration guide under "Platform cleanup".
  • The wire error name CordisError becomes Error (#825). A rutis::Error thrown to another language is named Error; the generated type CordisErrorThrown is ErrorThrown. Code that tests for the name CordisError changes.

  • Tools: rutis-dev is removed; use rutis-host dev (#820). rutis-migrate is no longer released; the 0.17 migration still works with cargo install rutis-migrate --version 0.18.0 (#816). rutis-host go add is removed; use rutis-host add <module>@<version> (#851).

  • The service name loader is taken (#185, #842). A host using LoaderPlugin (rutis-host included) provides a service named loader; a row providing its own loader fails with the same-name error (service loader is already provided by …: row <row> cannot provide it too): rename its service.

  • A runtime's rows are isolated by isolate in rutis too (#896). Rows of Node, Bun, Python, Go, Swift and Kotlin plugins behave like Rust rows: for a name in isolate they see only the providers inside the isolation, not those outside it, the host's services included; services they provide under those names stay inside the isolation. In 0.18 an isolated row could use a same-named service provided outside (the host's included); in 0.19 it waits for a provider inside. To use the service from outside, take the name out of the row's isolate.

  • Go plugins: binaries built before 0.18 are rebuilt with the 0.18 SDK or later (the required exception is removed).

New features

  • rutis-host call (#670, #772, #804): rutis-host call [--config <rutis.json | dir>] <service>.<method> [args…] calls a service in a running run or dev from another terminal and prints the result as JSON. Each argument is read as JSON. It uses the same user-only socket as status. Not available on Windows.
  • Installing plugins (#691, #805, #850): rutis-host add <reference> (npm:, pypi:, a Go module path, a local directory, .tgz, .whl or binary) installs the plugin and whatever its runtime lacks, and writes the rows and the installed field; it checks the new rows before writing, and exits with 1 leaving the file alone when they do not resolve. rutis-host remove and rutis-host upgrade remove and upgrade by the recorded source. You do not need to know the plugin's language.
  • Plugins add and remove rows through the service loader, and run writes them back to rutis.json (#185, #842, #852, #857): a plugin in any language that injects ["loader"] can call create, reload, remove and status, like Cordis's ctx.loader; failures throw an Error whose data is {row}. run writes the rows added and removed back to rutis.json, changing only rows and keeping the other fields and the key order; when the file cannot be written the row is added anyway and the error says <row>: added, but rutis.json could not be written: <reason>. dev writes no file: create and remove get this host keeps no editable configuration, so rows cannot be added or removed. See managing plugins with loader.
  • Connection plugins in any language (#870): the session plugin rutis-bridge/session provides the service sessions, whose open(far) turns a connection you built into a session; in Rust, Session::new(channel). rutis-host comes with rutis-host/spawn, rutis-host/dial and rutis-host/listen.
  • rutis-host test (#875, #878): rutis-host test <plugin> -- <runtime command…> <project> or rutis-host test <plugin> --channel <channel>, for the SDKs' test tools: it starts a host with no rows of its own, loads the plugin driving the test in a real runtime, and the service rutis-host/test (load, update, unload, reported) lets it load the plugins under test in that runtime. Plugin authors do not run it themselves. See running plugins under test.
  • Every subcommand takes --help / -h (#856): rutis-host <command> --help prints that command's usage and exits with 0, doing nothing else. run --help used to take --help as the configuration file, and add --help as a plugin name.
  • rutis-host dev prints the services (#794, #847, #871): once every row is running, waiting or failed, rutis-host dev: services: forecast (weather), llm (llm); again whenever the services change.
  • Test tools listen to events (#770): the TypeScript / Bun and Python test tools gain on(name, listener), receiving what the plugin emits and what the test emits itself, by the same rules as Go's loaded.On.
  • Python types from Rust services (#684, #798, #810): rutis-host types --python <file>, and .python(path) / .declared_python(path, python) on rutis_types::Exports. They generate typing.Protocol, TypedDict and friends from #[rutis::service], so pyright finds wrong calls to host services while you write a Python plugin.
  • Guides rewritten by layer (#671; #854, #858, #861, #863, #864, #866, #867, #868, #869): the plugin guides of the six languages follow the same eight-step short path, with the advanced material moved into "Plugin API"; the "rutis-host" guide opens for people assembling plugins; a new guide, "A host open to plugins". The published crates' doc comments are in English, and rutis-loader's public paths are tidied (#764).

Fixes

  • A row's rutis/row following uses one listener per Loader (#806, #808, thanks to @yyhhyyyyyy). Each row used to register a listener at the root, so with many rows every state change ran every row's callback, and queued deliveries held a lot of memory.
  • After a LoaderPlugin restart, rows load again with the enabled state they had (#812, #828). Every row used to come back disabled, and that was written into the editable layer.
  • rutis-host dev prints the services line again when a runtime provides its services after the row is ready (#847).
  • In one Go runtime, a row calling another row's service with a function in an argument of type any no longer fails to decode; it gets a *advanced.Function, as across processes (#884). In one Swift runtime, a @RutisService object passed to a parameter typed as a @RutisClient protocol becomes a client forwarding to the object, as across processes (#886).
  • When the filter of an emit a runtime sends through the host fails, it is reported as FilterFailed, like the kernel's own filter failures, so the host's error receiver can tell which row it was (#879). Rust code recognizing this failure by PluginFailed matches FilterFailed instead; the printed text is unchanged.

Compatibility

  • 0.19 cannot connect to 0.18 or earlier: the handshake refuses and says which end to upgrade (protocol 4 against 3). Cross-version meetings hold only between neighbouring releases without breaking changes.
  • rutis.json's format is still 1, and local runtimes (runtimes.node / py / go / swift / bun) are written as before. This release is the first exception to rutis.json being readable across versions: a file with runtimes.remote is no longer read by 0.19; a file with rutis-bridge/peer node rows is read, but those rows fail as unknown plugins. The 0.8–0.18 persisted samples drop these forms.
  • The plugin API version (PLUGIN_API) is unchanged: a plugin written with the 0.18 SDK runs on the 0.19 runtimes once its imports are fixed; Go and Swift binaries are rebuilt because of the protocol change.
  • dylib plugins are rebuilt with the 0.19 SDK, as for every release.
  • Swift: .package(url: "https://github.com/arcships/rutis", from: "0.18.0") resolves to 0.19; an app not ready to upgrade writes .upToNextMinor(from: "0.18.0").

Packages

All of these are version 0.19.0: on crates.io rutis, rutis-macros, rutis-bridge, rutis-loader, rutis-types (new), rutis-host, rutis-sdk, rutis-dylib, rutis-dylib-meta, rutis-dylib-launcher; on npm @arcships/rutis, @arcships/rutis-runtime, @arcships/rutis-bun, @arcships/rutis-host and the five platform packages; on PyPI rutis, rutis-host; the Go module github.com/arcships/rutis/go/rutis (tag go/rutis/v0.19.0); the Swift package (v0.19.0); the rutis-host binaries on the GitHub release page. rutis-migrate leaves the train and stays at 0.18.0. The Kotlin SDK is not published to Maven: fetch this repository's tag v0.19.0 and use it from source with includeBuild, writing the dependencies without a version (Kotlin app guide, #893).