@tinyactors/node 0.4.0, 19 November 2026
Summary
This release gives both packages,
@tinyactors/nodeand@tinyactors/wasm, an application API, and it breaks every program written for 0.3.0 (6a5e1d4). AHostis now made from its charts and a system name. An I/O processor is an object withreceive. Handlers no longer take the host: views and records carryhost.spawntakes a chart's name and returns anActorthat you can send to, ask and wait on. Astoreand aresidentbound on the host hibernate the surplus after each turn and load an actor back when it is wanted again (an event, a due delayed send, a migration). ASpawnerprocessor spawns actors by name.compileDircompiles a directory.onDoneandonErrorreport how an actor ended, andonHandlerErrorgets what a handler threw. Errors of the commonest statuses have their own classes (StaleError,StateError,InvalidError,UnsupportedError); any other status stays aTinyactorsError.decodeTracesreads OTLP spans without a host, andversiongives the installed version.The native "ecmascript" datamodel now runs every session in the host's one shared context (2081069). Before, a chart whose scripts declared top-level names got a context of its own per session, which cost about 143 KB a session on node and 60 KB on bun. A chart-level script's functions become helpers that all of the chart's sessions share. A top-level
varstays a session variable. A top-levellet,constorclassis refused, and the compile call warns about each top-level declaration,varincluded (an error with the warnings-as-errors option).The README and the guides are grouped as the application API, operating a host and the wire format. A new guide covers sends to an actor that is not there, and the chat-rooms example is rebuilt on the new API.
Upgrading
Host(6a5e1d4):new Host(config, options)becomesnew Host(charts, options), wherecharts(Charts) is a compile result, image bytes or an array of them, added when the host is made.Host.restore(snapshot, charts, options)likewise.host.addChartsis removed: usecompileChartsand pass the result tonew Host(or to the host's addImage method).host.spawnChartis removed:host.spawntakes a chart's name or aChartRefand returns anActor(the actor's id is the session).host.actorByName(name)is removed: usehost.actor(name), which throwsStaleErrorwhen no actor has that name, orawait host.actors({chart}).send,fail,terminate,hibernateandwakealso accept anActor.HostConfigandHostOptions(6a5e1d4):systemIDandioProcessorsmove out of the config. Passsystemin the options, and the rest of the config asconfig. A config that holds either of them is aTypeError. The system name "tinyactors-ask" is reserved forask's replies: a host with that system is refused.IOProcessorConfigis removed, andEffectiveHostConfig.ioProcessorsis now a list of{type, location}.- I/O processors (6a5e1d4): a handler function becomes an
IOProcessorobject withreceive(send)and an optionallocation. A plain function is aTypeError.- Handlers take no host (6a5e1d4): drop the first parameter of
transport,log,telemetry,migrated,migrationDone, a service's handler,Service'sreceiveandstop, and a typed method'sOnResultandOnError. Readsend.hostinstead.Send,LogEntry,MigratedandInvocationgainhost, andSendgainssender, anActor.- The
wakeoption is removed (6a5e1d4): give the host astore(MemoryStore,SQLiteStore, or your ownStore) and aresidentbound.compileChartsandcompileSystem(6a5e1d4): the resolver moves into the options, socompileCharts(sources, resolver)becomescompileCharts(sources, {resolver})(CompileOptionsgainsresolver).directoryResolverandAddChartsOptionsare removed: usecompileDir.MigrateOptions,SessionParamsandSendMessage(6a5e1d4): their session or target may also be anActor. Nothing to change.- Native "ecmascript" charts (2081069): turn a top-level
let,constorclassinto a<data id="...">that the script assigns. A chart-level function that read session variables by name must take them as arguments. A top-levelvarkeeps working. A function a script of executable content declares is now that run's own, no longer a variable of the session. The compile call now warns about every top-levellet,const,classandvar, in any chart, quickjs's included, since it cannot know the datamodel: a build that compiles with the warnings-as-errors option fails on them, so move such names into<data>or drop that option. A native-datamodel snapshot taken with 0.3.0 that holds sessions is refused byHost.restore, because a session row now has 7 parts instead of 8.- The
Spawner(655fe3c) spawns the chart's current version under the requested name and answersspawnedwith{name, address}. It does not look the name up. This change affects no released version.