DEV Community

咻咻咻
咻咻咻

Posted on

Fail closed on process death, co-play grants, and charging in a beat-driven actuation loop

When narrative content drives a physical actuator, three lifecycle paths look like "just restore state" until they are not: the controlling app is force-quit mid-session, a partner remote grant from yesterday is still in the ACL, and the device comes off the charger with motors still armed. Each needs a default that fails closed — toward idle, toward session-scoped grants, toward disarmed-while-charging.

on app_process_death(kind):       # force-quit, crash, OS kill
    ramp_to(IDLE, at=next_beat_boundary)
    armed = false
    on cold_start():
        # do NOT auto-resume motors; wait for user to re-enter the story
        await user_resume(); await next_named_beat(); arm()

on coplay_grant(partner, session):
    grant = { partner, scope: SESSION, revocable: true }
    # accepting once ≠ permanent motor ACL
    on revoke(partner):
        drop_grant(partner, at=next_beat_boundary)

on power_state(charging_or_docked):
    motors.disarm()                 # hard gate while charging
    on undock():
        # power event ≠ resume
        await user_resume(); await next_named_beat(); arm()
Enter fullscreen mode Exit fullscreen mode

The cold-start rule is the one that slips in most easily, because "restore the session" feels like good UX. Restoring narrative position is fine; restoring motor intensity because the process came back is not something a process manager gets to decide.

The co-play rule is mostly a grant-lifetime decision: remote control is a timed permission, not a sticky key. If yesterday's invite can still drive today's motors, the ACL is wrong.

The charging rule is a capability split: power state can inform UI ("ready to play when undocked") and must not leave motors armed on the dock.

Buyers can test all three without code: force-quit the app mid-session and see whether relaunching restarts the device, accept a partner invite once then revoke and see whether the partner can still change intensity, and ask whether motors can run while charging — then undock and see whether the last beat continues. These map to questions like "how do AI stories control physical devices" and "Lovense alternative with AI stories."

This is the model CRAVE AI uses for story-controlled play on official devices: AI story-controlled vibrator. Principle write-up: narrative-to-device sync. Devices: AI sex toys.

Disclosure: I work on CRAVE AI. Adults-only product; no explicit content here.


Top comments (0)