# Lifecycle & job states

Core object: `presence` (`presence.d.ts`). Durations are honest where known; model latency is host-owned.

## Mind states (`presence.state`)

| State | User sees | Typical duration | Partial / fail |
|---|---|---|---|
| `idle` | Soft presence; occasional stir via `react(0.5)` every ~5–12s | Until host moves it | Never “broken” — quiet is valid |
| `listening` | Higher attention / lean when proximity wired | While user inputs | If input cancelled → `idle` |
| `thinking` | Working energy (violet on signal theme) | Host request time — **not** fixed by Glim | On error: host should leave thinking or set idle + error copy elsewhere |
| `talking` | Caption types ~30 chars/s; held if `say()` | Typeout + hold; auto-rotate demo lines ~1.7s if not held | Empty `say("")` still enters talking — host should avoid |

Transitions are host-driven via `setState` / `say` / `cycle`. Invalid state strings are ignored (`glim.js`).

## Companion micro-lifecycle

1. **Mount** — `Glim.mount(el, type, opts)` creates presence; random phase `t`.
2. **Attention** — `setAttention(0..1)` from pointer proximity (site demo).
3. **Acknowledge** — `react(power)` spikes energy/hover; decays ~1.7/s.
4. **Speak** — `say(text)` → `talking` → caret typeout → `settle` event once.
5. **Destroy** — `destroy()` drops RAF registry entry, loses WebGL context, removes node.

## Site demo ask flow (`index.html`)

| Step | State | Notes |
|---|---|---|
| User focuses / types | listening (site sets) | |
| Send | thinking | |
| Reply | talking + `say(reply)` | Live model **or** local personality |
| Status line | — | Must say local vs live *(trust)* |
| After | idle / listening | Host choice |

Total time: **depends on model or local generator** — never market a fixed “answers in N seconds.”

## Activation (builder)

| Step | What happens | Success signal |
|---|---|---|
| Configure | Pick free creature, theme, size, line | Preview updates |
| Copy snippet | Clipboard | `copy_code` event |
| Download starter / lib | File on disk | `download_starter` / `download_lib` — **north star** |
| Open offline | Works without getglim.dev | Activation complete |

## Commerce (today)

| Step | State | Notes |
|---|---|---|
| Intent open | Waitlist dialog | Pro / Team / Studio |
| Submit email | Stored as local signal + mailto path | Checkout **not** live |
| Paid unlock | — | Deferred until checkout exists |

## Queue / human dependence

None in the library runtime. Studio commissions and support are human — do not promise Studio SLAs in marketing without an ops promise.
