---
name: xstate
description: "Full state machine resource via XState v5"
version: "0.1.0"
entry: ./adapter.ts
npm_deps:
  required:
    - xstate
  optional:
    - yaml
fields: []
health_check: null
keywords:
  - state-machine
  - xstate
  - fsm
  - workflow
---

A state machine connector using XState v5. Provides guarded transitions,
entry/exit actions, context, and serializable snapshots.

Machine definitions can be provided inline via `options.machine` or loaded
from a YAML/JSON file via `options.definitionPath`.

## Operations

| Operation | Access | Description |
|-----------|--------|-------------|
| `get_state` | read | Get current state, context, and available transitions |
| `get_definition` | read | Get the machine definition |
| `history` | read | Get the transition history log |
| `can` | read | Check if a transition is currently allowed |
| `send` | write | Send an event to trigger a transition |

## Configuration

```yaml
connectors:
  - id: approval
    adapter: xstate
    access: read-write
    options:
      machine:
        id: approval
        initial: draft
        states:
          draft:
            on:
              SUBMIT: review
          review:
            on:
              APPROVE: approved
              REJECT: draft
          approved:
            type: final
```
