Summary
Add a state_machine block to the app manifest schema. The Traverse runtime reads this at app registration time and owns the application state machine for that app. Clients never manage their own state machines — they subscribe to runtime state events and send commands.
This is the primitive that makes multi-platform clients architecture-clean: every platform (web, iOS, Android, macOS, Windows, Linux, CLI) becomes a pure rendering layer.
Motivation
Without a runtime-owned state machine:
- Every client duplicates the same
idle → loading → polling → succeeded/failed logic
- State divergence bugs appear between platforms
- Business rules about when to retry, when to fail, and what to invoke are spread across every client codebase
With a runtime-owned state machine:
- State logic lives once, in the manifest
- All clients receive the same state events
- Adding a new client is pure UI work — zero business logic to port
Proposed manifest schema addition
{
"kind": "app_manifest",
"app_id": "traverse-starter",
"state_machine": {
"initial_state": "idle",
"states": [
{
"id": "idle",
"transitions": [
{ "on": "submit", "to": "processing" }
]
},
{
"id": "processing",
"invoke": {
"capability_id": "traverse-starter.process",
"input_from": "command.payload"
},
"transitions": [
{ "on": "capability_succeeded", "to": "results" },
{ "on": "capability_failed", "to": "error" }
]
},
{
"id": "results",
"transitions": [
{ "on": "reset", "to": "idle" }
]
},
{
"id": "error",
"transitions": [
{ "on": "retry", "to": "processing", "with_last_payload": true },
{ "on": "reset", "to": "idle" }
]
}
]
}
}
Runtime behavior
- On
traverse-cli app register, the runtime parses and validates the state_machine block
- The runtime instantiates one state machine per app session (or per workspace — TBD)
- When a client sends a command, the runtime evaluates the transition, updates state, and broadcasts an event
- If a state has an
invoke block, the runtime calls the named WASM capability and auto-transitions on result
- State events are broadcast to all subscribed clients
Definition of Done
New spec number
Suggest: 047-app-state-machine
Downstream unblocked
- traverse-framework/App-References: all platform clients (web, iOS, macOS, Android, Windows, Linux)
- traverse-framework/App-References #AR3: refactor web-react to use runtime state subscription
Summary
Add a
state_machineblock to the app manifest schema. The Traverse runtime reads this at app registration time and owns the application state machine for that app. Clients never manage their own state machines — they subscribe to runtime state events and send commands.This is the primitive that makes multi-platform clients architecture-clean: every platform (web, iOS, Android, macOS, Windows, Linux, CLI) becomes a pure rendering layer.
Motivation
Without a runtime-owned state machine:
idle → loading → polling → succeeded/failedlogicWith a runtime-owned state machine:
Proposed manifest schema addition
{ "kind": "app_manifest", "app_id": "traverse-starter", "state_machine": { "initial_state": "idle", "states": [ { "id": "idle", "transitions": [ { "on": "submit", "to": "processing" } ] }, { "id": "processing", "invoke": { "capability_id": "traverse-starter.process", "input_from": "command.payload" }, "transitions": [ { "on": "capability_succeeded", "to": "results" }, { "on": "capability_failed", "to": "error" } ] }, { "id": "results", "transitions": [ { "on": "reset", "to": "idle" } ] }, { "id": "error", "transitions": [ { "on": "retry", "to": "processing", "with_last_payload": true }, { "on": "reset", "to": "idle" } ] } ] } }Runtime behavior
traverse-cli app register, the runtime parses and validates thestate_machineblockinvokeblock, the runtime calls the named WASM capability and auto-transitions on resultDefinition of Done
047-app-state-machine— defines the manifest schema, state/transition semantics,invokeblock, and event payload shapetraverse-cli app validate) accepts and validatesstate_machineblockstraverse-cli app validaterejects invalid state machines: unreachable states, missinginitial_state, undefined capability refssubmitcommand, observeprocessing → resultstransition in state event streamNew spec number
Suggest:
047-app-state-machineDownstream unblocked