implements PLN-0138

This commit is contained in:
2026-07-03 23:06:35 +01:00
parent 57c9af939b
commit 29e002c5f3
7 changed files with 121 additions and 13 deletions
@@ -43,6 +43,13 @@ The VM does not own the machine lifecycle. Firmware does.
Game directory cartridges.
- **Library entry**: an internal catalog record retained by Hub/SystemOS for a
discovered cartridge.
- **Foreground visual owner**: the single machine owner whose visual output may
be presented at a given time.
- **Paused**: a Game-visible lifecycle event/state. The Game may observe it and
prepare for foreground loss.
- **Suspended**: an OS-owned scheduler/runtime state. A suspended Game remains
resident but does not receive normal gameplay ticks, normal Game input, or
frame pacing.
## 3 POS Responsibilities
@@ -154,7 +161,50 @@ Shell task loses its eligible focused window
-> FirmwareState::HubHome
```
## 7 Cartridge Load Flow
## 7 Foreground Stack and Game Pause
The v1 foreground contract is single-owner:
- exactly one foreground visual owner exists at a time;
- at most one Game may be resident;
- at most one Shell app may be foreground;
- Hub/Home is the root Shell owner and back-stack controller.
The minimal supported navigation cycle is:
```text
Game foreground
-> Home request
-> Game pause notification
-> Game suspended by SystemOS after a bounded budget
-> Hub/Home foreground
-> optional Shell foreground
-> Shell close returns to Hub/Home
-> same Game resume/foreground-restore notification
-> Game foreground after a valid current-epoch render submission
```
`Paused` is cooperative and visible to the Game. `Suspended` is imposed by
SystemOS. The Game may react to pause/resume, but it must not control whether
the OS suspends or resumes its VM.
When Home is requested during Game execution, SystemOS must notify the Game and
grant a short bounded pause budget. After the budget, SystemOS may suspend the
VM even if the Game did not cooperate. While suspended, the Game must not
receive normal gameplay ticks, normal Game input, or frame pacing.
When returning to the same Game, SystemOS must reactivate the VM and send a
resume or foreground-restore notification before visual foreground is restored.
The Game may remain internally paused while it synchronizes. Hub/Shell remains
visible until the resumed Game publishes a valid render submission for the
current ownership epoch.
Input pending for the Game must be cleared or barriered across pause/resume
boundaries. Game audio pauses with the Game VM in v1. Independent background
audio, real background execution, multiple resident Games, multiple foreground
Shells, and direct Game-to-Game switching are outside this contract.
## 8 Cartridge Load Flow
Current high-level flow:
@@ -179,7 +229,7 @@ If the selected cartridge cannot be loaded, firmware must leave or return the
machine in the Hub/Home flow and record the failure through diagnostics or
logging. A polished Home error surface is not required by v1.
## 8 Firmware States
## 9 Firmware States
The current firmware state model includes:
@@ -193,7 +243,7 @@ The current firmware state model includes:
These states express machine orchestration above the VM. They are not guest-visible bytecode states.
## 9 Execution Contract
## 10 Execution Contract
For game-mode execution, firmware/runtime coordination preserves:
@@ -204,7 +254,7 @@ For game-mode execution, firmware/runtime coordination preserves:
This keeps the machine model deterministic and observable.
## 10 Crash Handling
## 11 Crash Handling
Firmware owns terminal fault presentation.
@@ -216,7 +266,7 @@ When a terminal app fault occurs:
Crash handling is outside the guest VM execution model.
## 11 Relationship to Other Specs
## 12 Relationship to Other Specs
- [`02-vm-instruction-set.md`](02-vm-instruction-set.md) defines the VM subsystem run by firmware.
- [`09-events-and-concurrency.md`](09-events-and-concurrency.md) defines the frame-boundary model used by firmware.