Idle exit starts however the app was opened (0.1.2)

On a real G2 with build 0.1.1, a voice launch with nothing touched never
left the glasses: no glassesMenu launch source reached the app, so the
countdown was never armed. After one swipe it left as designed.

The countdown now runs however the session was opened. The launch source is
kept for Diagnostics only. Setting up on the phone stays protected: nothing
leaves while unpaired, and a touch on the phone page holds the app open for
the grace period. Dan approved the change after the trial.

Also records the 0.1.1 trial, Dan's keep/change decisions (contract
section F) and the 0.1.1 upload. Version 0.1.2. Not reviewed, not uploaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-21 15:34:20 -08:00
co-authored by Claude Fable 5.2
parent 3e0468802f
commit 344a2288b8
10 changed files with 133 additions and 42 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"package_id": "xylo.hermeven",
"edition": "202601",
"name": "Pepper",
"version": "0.1.1",
"version": "0.1.2",
"min_sdk_version": "0.0.16",
"entrypoint": "index.html",
"permissions": [
+9 -15
View File
@@ -142,12 +142,11 @@ export class Controller {
private readonly phoneGraceMs: number;
private readonly conversationGapMs: number;
private idleTimer: ReturnType<typeof setTimeout> | null = null;
/**
* Leaving by ourselves is only armed once the glasses are actually being used: a gesture has
* arrived, or the session was opened from the glasses. A page opened from the phone to set
* things up is never closed under the user's fingers.
*/
private idleArmed = false;
// Idle exit applies however the session was opened. It used to wait for a `glassesMenu`
// launch source or a first gesture; on a real G2 (2026-11-21, build 0.1.1) a voice launch
// delivered no such signal and the app stayed until the glasses were touched. Setting up on
// the phone is still protected: nothing leaves while unpaired, and a touch on the phone page
// holds the app open for the grace period.
private phoneBusyUntil = 0;
private launchSource: 'appMenu' | 'glassesMenu' | 'unknown' = 'unknown';
private readonly exitRetryMs: number;
@@ -214,9 +213,7 @@ export class Controller {
this.device.onLaunchSource?.((source) => {
this.launchSource = source;
this.note('lifecycle', `opened from ${source}`);
// Opened from the glasses (their menu, or by voice): the glasses are in use.
if (source === 'glassesMenu') this.idleArmed = true;
this.scheduleIdleExit();
// Shown in Diagnostics only. It does not decide anything: see the note on idle exit.
this.emit();
}) ?? (() => undefined),
this.device.onConnection((connected) => {
@@ -408,7 +405,7 @@ export class Controller {
this.exitFailures = 0;
this.activityEpoch += 1;
}
if (this.stopped || this.exited || !this.idleExitMs || !this.idleArmed || !this.hudReady) return;
if (this.stopped || this.exited || !this.idleExitMs || !this.hudReady) return;
const phase = this.state.phase;
const wait =
phase === 'answer'
@@ -813,11 +810,8 @@ export class Controller {
private onDeviceEvent(event: DeviceEvent): void {
if (event.type !== 'audio') {
// Any gesture from the glasses means they are in use, and restarts the idle countdown
// even when it changes no state (paging past the last page, for example).
if (event.type !== 'foreground_enter' && event.type !== 'foreground_exit' && event.type !== 'system_exit' && event.type !== 'abnormal_exit') {
this.idleArmed = true;
}
// Any gesture or lifecycle event from the glasses restarts the idle countdown, even when
// it changes no state (paging past the last page, for example).
this.scheduleIdleExit();
}
switch (event.type) {
+2 -1
View File
@@ -27,7 +27,8 @@ export interface DevicePort {
*/
exitNow(): Promise<boolean>;
/**
* Optional: how this session was opened (`glassesMenu` covers the menu and voice launch).
* Optional, for Diagnostics: how this session was opened, when the host says. On a real G2 a
* voice launch was not reported as `glassesMenu`, so nothing may depend on it.
* The host sends this once, early. An implementation must remember it and replay it to a
* listener that subscribes later.
*/