Runtime Manual
This manual follows a character through package loading, action selection, browser execution, animation, and session cleanup.
1. Runtime layers
| Layer | Owns |
|---|---|
| Character package / Stable schema | Authored identity, repertoire, behavior, asset references, and semantic bindings as data. |
| Public Content | Package validation and explicit typed projection for a selected schema/Content version. |
| Action and Scheduling policy facades | Effective WHAT and WHEN inputs derived from authored policy sources. |
| Autonomy / CharacterSession | Opportunity state, eligibility, selection ownership, bounded completion/history policy. |
| Host and Browser Runtime | Live semantic targets, geometry, motion, execution freshness, scheduling coordination. |
| Consumer renderer | Asset IO, visual placement, frame clock, and correlated terminal observations. |
The exact public construction path depends on the chosen projection. The current V6 Platform Browser helper is convenient but does not surface V11 repertoire. For V11 content, use the matching loader. A complete public V11 CharacterSession facade is not available.
2. Session lifecycle
stateDiagram-v2
[*] --> Created
Created --> Running: environment ready and start accepted
Running --> Stopped: stop / reset policy
Stopped --> Running: start accepted
Created --> Disposed: dispose
Running --> Disposed: stop and dispose owned resources
Stopped --> Disposed: dispose
A session holds temporary runtime state. A new CharacterSession starts with new action repetition and target history. Reset starts a new logical session epoch as specified by that facade. Dispose prevents later work and releases owned resources. The ordinary @charaweave/runtime facade owns a different command/snapshot lifecycle than autonomous Browser scheduling; don't assume the methods are interchangeable.
3. Opportunity lifecycle
- Scheduling determines whether an opportunity may occur.
- Capability filters WHAT kinds the Character can perform.
- Applicability resolves suitable current target/context candidates.
- Temporal/lifecycle gates enforce idle and cooldown rules.
- Policy composition produces effective action mass.
- Weighted selection picks WHAT; semantic target selection chooses TARGET when required.
- Accepting the attempt updates the session's action account atomically.
- Browser execution revalidates Host and geometry before business action.
- Execution reports its result. Accepted completions update the corresponding state.
“No opportunity” is earlier than WHAT selection. “No eligible WHAT” means an opportunity existed but no action could proceed. Neither is a failed execution or a completed action.
4. Action execution lifecycle
sequenceDiagram
participant Loop
participant Policy as WHAT/WHEN policy
participant Browser as Browser coordinator
participant Host
participant Renderer
Loop->>Policy: eligible opportunity
Policy-->>Loop: WHAT and TARGET selection
Loop->>Browser: execute accepted intent
Browser->>Host: resolve fresh target / measure geometry
Browser->>Renderer: finite visit/action Presentation
Renderer-->>Browser: motion and Presentation terminal
Browser->>Host: trusted activation if selected and current
Browser-->>Loop: completed / failed / cancelled / invalidated
Do not invoke the business callback before the coordinator reaches its current Host freshness checks. visit-host-surface does not execute activation; activate-host-surface delegates to a trusted Host action handler after current target validation.
5. Temporal and policy state
Scheduling uses a monotonic logical elapsed account. It does not infer elapsed time from wall-clock Date decay. Action Repetition is a bounded session contribution updated only by completed autonomous WHAT actions. Its factors are 1.00, 0.70, 0.45, and 0.30 for repeat streak 0, 1, 2, and 3+. Another completed action kind resets the streak. Target history is separate, bounded, and target-keyed. Habit has its own positive completion semantics.
6. Terminal lifecycle
| Observation | State effect |
|---|---|
| completed | Adopt completion and eligible history updates. |
| cancelled | Stop pending execution; do not count as completed. |
| invalidated | Reject stale context; only cause-bearing supported invalidation may request Recovery. |
| failed | Record execution failure; do not reinterpret as Recovery or completion. |
| rejected | Attempt did not acquire accepted execution ownership. |
| no-opportunity/no-eligible-what | No execution started; inspect scheduler/gates or policy inputs. |
See Terminal Reference.
7. Presentation and ActivityOwnership
Presentation maps semantic lifecycle to authored clips. ActivityOwnership protects one current visual owner. Touch and Recovery can supersede autonomous Presentation under the existing contracts. Ignore a completion from an activity that has already lost ownership. The renderer is responsible for finite clip advancement and reporting completion for the active generation.
8. Reset and disposal checklist
- Stop scheduling first.
- Cancel or finish active Browser execution according to the owner.
- Detach Host elements on unmount/replacement.
- Remove event subscriptions and timers.
- Dispose motion/geometry/action/registry services in ownership order.
- Dispose Autonomy/Character session and ordinary Runtime exactly once.
- Start fresh if a new session should have empty volatile repetition/target history.
See Activity Ownership, Targets, and Consumer Integration Manual.