Add project licensing and a full README, plus a minimal WebAssembly ping-pong example that exercises the actor runtime. - `LICENSE`: add the full GNU AGPL-3.0 text and set `license = "AGPL-3.0-only"` on every package (`swactor`, each crate, `apps/myelin`, `tools/vastai`, `xtask`) - `README.md`: rewrite from a stub into a full project overview, covering features (actor_id routing, WASM, iroh QUIC/SWIM, OTP-style std, process manager, zero-copy objects, datastream metrics, dashboard), architecture, examples, developing, status, and license - `examples/ping-pong`: new standalone workspace (`pingpong` cdylib) where two actors volley on a single-threaded `wasm` runtime driven by a Node host via `tick()`, demonstrating spawning, message passing, and death monitoring (`watching`) - `examples/ping-pong`: add a host/run harness -- `run.sh` (wasm-pack build + `run.mjs`), `serve.sh` (dashboard + static demo), `index.html`, and a pinned `Cargo.lock` - `.gitignore`: stop ignoring `.loop/`, `.deployment-notes/`, and `.omp/` Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
28 lines
822 B
JavaScript
28 lines
822 B
JavaScript
// swactor ping-pong -- host driver.
|
|
//
|
|
// Spawns a Ping and a Pong actor on the wasm actor runtime, then drives it
|
|
// tick-by-tick, printing each volley as it happens. Pass an optional volley cap:
|
|
//
|
|
// node run.mjs [volleys] (default 10)
|
|
|
|
import { App } from "./pkg/pingpong.js";
|
|
|
|
const max = Math.max(2, Number(process.argv[2] ?? 10));
|
|
|
|
const app = new App();
|
|
const log = app.new_log();
|
|
const pong = app.spawn_pong(log.addr(), max);
|
|
app.spawn_ping(pong, log.addr(), max);
|
|
|
|
console.log(`\n== swactor ping-pong == target ${max} volleys\n`);
|
|
|
|
for (let t = 0; t < 1000; t++) {
|
|
app.tick();
|
|
let line;
|
|
while ((line = log.try_recv())) console.log(" " + line);
|
|
if (app.actor_count() === 0) break;
|
|
}
|
|
|
|
console.log(
|
|
`\nactors remaining: ${app.actor_count()}, messages processed: ${app.total_messages()}\n`,
|
|
);
|