CODY-016, 017, 018: launch source cannot be missed; a failed idle exit is retried

CODY-016. The SDK pushes the launch source once, early. The Even adapter now
subscribes in its constructor, remembers the value and replays it to a
listener that subscribes later. appMenu still does not arm idle exit.

CODY-018. exitNow() returns whether the host confirmed. The adapter keeps at
most one shutdown call in flight (through the same queue as every other host
call), lets a repeat request wait on that call, and never calls the host
again after a confirmed exit, including one confirmed late. The controller
marks itself as gone only on confirmation or on a system_exit/abnormal_exit
event; otherwise it retries after 3 s, at most 4 attempts in a row, under the
same resting-screen and phone-grace guards, and starts again after activity.

CODY-017. README: one owner-reported locked-phone success; pocketed,
five-minute and ten-cycle runs unverified.

Tests: production-adapter tests with a stand-in host, including the default
30 s under a fake clock; a simulator scenario that performs the real exit
(development-only ?idleExit=fast). Not reviewed. 0.1.1 is not uploaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-21 14:38:29 -08:00
co-authored by Claude Fable 5.2
parent 1ae105ed18
commit bbde3c86a8
12 changed files with 679 additions and 42 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import { waitForEvenAppBridge } from '@evenrealities/even_hub_sdk';
import { measureTextWrap } from '@evenrealities/pretext';
import { Controller } from './core/controller.ts';
import { Controller, type IdleExitMs } from './core/controller.ts';
import { EvenDevice } from './device/evenAdapter.ts';
import { waitForEvenHost, watchForLateHost, type HostWindow } from './device/hostDetect.ts';
import { BrowserPreviewDevice } from './device/previewDevice.ts';
@@ -29,8 +29,8 @@ export interface BootOptions {
hostWaitMs?: number;
/** Development build: mirror diagnostics to the console. */
dev?: boolean;
/** `false` keeps the app on the glasses indefinitely (automated simulator runs). */
idleExit?: boolean;
/** `false` keeps the app on the glasses indefinitely; an object overrides the times. Both are for automated simulator runs. */
idleExit?: boolean | Partial<IdleExitMs>;
/** Reload hook, replaceable in tests. */
reload?: () => void;
}
@@ -92,7 +92,7 @@ export async function boot(doc: Document, win: Window, options: BootOptions = {}
measure: (text, width) => measureTextWrap(text, width).lineCount,
locale: win.navigator.language || 'en-US',
onChange: (snapshot) => update(snapshot),
...(options.idleExit === false ? { idleExit: null } : {}),
...(options.idleExit === false ? { idleExit: null } : typeof options.idleExit === 'object' ? { idleExit: options.idleExit } : {}),
// Development builds mirror diagnostics to the console (visible in the simulator and the
// Even dev console). Diagnostics never contain questions, answers or credentials.
onNote: options.dev ? (entry) => console.info(`[hermeven] ${entry.kind}: ${entry.detail}`) : undefined,