Add swactor-command crate that decouples command dispatch from the dashboard, enabling the same commands from REPL, REST, TUI, or any future frontend. - CommandRouter with dispatch(), CommandHandler trait, CommandMeta - CommandRequest/CommandResponse (serde-serializable JSON protocol) - CommandContext with Arc<Runtime> + optional StatsEnricher trait - 9 built-in commands extracted from investigate.rs: help, overview, workers, worker, actors, actor, hot, phases, diff, shutdown - REPL line parser (parse_line) with positional arg mapping - REST adapter (from_query_params) for HTTP query parameters - Dashboard integration: StatsEnricher impl for StatsCollector, investigate.rs refactored to thin CommandRouter wrapper, server.rs updated to share CommandRouter across handler threads - 18 behavioral tests in crates/command/tests/command_api.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Progress
Completed
Feature 1: Actor Watching (local only) — docs/os-design/01-actor-watching.md
- Added
ExitReasonenum (Stopped, Panicked, NodeDown) andActorExitedstruct tosrc/actor.rs - Extended
ContextInnertrait withwatch()/unwatch()methods - Added
Ctx::watch(target)andCtx::unwatch(target)typed API - Added
on_actor_exit()default method toActorInterfacetrait - Updated
AnyActor::handle_anywith system message fallback (triesActorExitedafterIncoming) - Implemented
WatchRegistryinsrc/worker.rs(bidirectional HashMap tracking) - Integrated death notification dispatch as phase 5b in
tick_once - Implemented
watch/unwatchonRuntime'sContextInnerimpl - Added
watch_registryfield toTickContextinsrc/delivery.rs - 10 behavioral tests in
tests/watch_api.rs— all passing
Feature 2: Command Interface — docs/os-design/04-command-interface.md
- Created
crates/command/crate (swactor-command) with core types:CommandRequest,CommandResponse(serde-serializable)CommandHandlertrait +CommandMetaCommandRouterwithdispatch()andwith_builtins()CommandContextwithArc<Runtime>+ optionalStatsEnricherStatsEnrichertrait (decouples command crate from dashboard)
- Built-in read commands: overview, workers, worker, actors, actor, hot, phases, diff
- Built-in write command: shutdown
- REPL line parser (
parse_line) with positional arg mapping and--flag valuesupport - REST adapter (
from_query_params) for HTTP query parameters - Refactored
investigate.rsto delegate to CommandRouter (thin wrapper) - Updated
server.rsto use CommandRouter for/api/investigateendpoint - Implemented
StatsEnricher for StatsCollectorin dashboard crate - 18 behavioral tests in
crates/command/tests/command_api.rs— all passing - All 53 swactor core tests pass, all 18 command tests pass
Next Steps
- Cluster Registry —
docs/os-design/02-cluster-registry.md- LWW-Register CRDT per name binding
- Propagation via SWIM piggyback
ClusterRegistrystruct incrates/distribution/src/registry.rs- API: register_name, unregister_name, resolve_name
- Node Capabilities —
docs/os-design/03-node-capabilities.md- New
crates/capabilities/crate with auto-detection
- New
- Remote Watching — extends actor watching with wire protocol
- Supervision —
docs/os-design/05-supervision.md
Open Questions
- Custom actor commands (via
Ctx::register_command()) deferred to a later PR - Distribution-aware commands (nodes, registry, resolve) deferred until cluster registry is implemented
- Write commands (spawn, stop, drain) deferred — need factory registry and actor stop mechanism
Blockers
- None