133133- encode Windows PowerShell script as UTF-16LE Base64 for `-EncodedCommand`- encode Windows PowerShell script as UTF-16LE Base64 for `-EncodedCommand`
134134- pass macOS title/body through `osascript` argv to avoid shell interpolation- pass macOS title/body through `osascript` argv to avoid shell interpolation
136-- add minimal active/pending eligibility bookkeeping driven by `input`, `agent_start`, and `agent_settled`; steering, retries, and follow-ups stay within the active lifecycle
136+- add minimal candidate/prepared/active eligibility bookkeeping driven by `input`, `before_agent_start`, `agent_start`, and `agent_settled`; handled input cannot leak, while steering, retries, and follow-ups stay within the active lifecycle
3333The extension records input origin in extension-instance memory because `agent_end` does not expose it.The extension records input origin in extension-instance memory because `agent_end` does not expose it.
34-It tracks pending pre-start input separately from the active agent lifecycle.
35-Pi drains steering and queued follow-ups inside that active lifecycle, so direct interactive input received while active makes that lifecycle eligible without leaking into the next run.
34+It records idle `input` as a candidate, then confirms it at `before_agent_start` only when Pi accepts the prompt.
35+This prevents handled input from leaking eligibility into extension-triggered runs that start without an `input` event.
36+Pi drains steering and queued follow-ups inside the active agent lifecycle, so direct interactive input received while active makes that lifecycle eligible without leaking into the next run.
3637Pi dispatches extension events serially, so this is event-order bookkeeping rather than cross-thread synchronization.Pi dispatches extension events serially, so this is event-order bookkeeping rather than cross-thread synchronization.
3738State is cleared on completion and session shutdown.State is cleared on completion and session shutdown.
3839Nothing is written to disk or session history.Nothing is written to disk or session history.
133134- native backend choice and Kitty/generic OSC fallback choice- native backend choice and Kitty/generic OSC fallback choice
134135- direct interactive TUI eligibility- direct interactive TUI eligibility
135136- suppression for RPC, JSON, print, SDK-style, and extension input- suppression for RPC, JSON, print, SDK-style, and extension input
136-- pending versus active-lifecycle input-origin bookkeeping
137+- candidate, accepted, and active-lifecycle input-origin bookkeeping
137138- focused-terminal suppression and no notification before `agent_settled`- focused-terminal suppression and no notification before `agent_settled`
138139- native success and native failure through a controlled fake executable on the current platform- native success and native failure through a controlled fake executable on the current platform
139140- loading through the real Pi extension harness- loading through the real Pi extension harness
108111it("attributes queued follow-up input to the active lifecycle without leaking", () => {it("attributes queued follow-up input to the active lifecycle without leaking", () => {
109112const state =newTurnEligibility();const state =newTurnEligibility();
128134it("preserves eligibility across low-level retries until settlement", () => {it("preserves eligibility across low-level retries until settlement", () => {
129135const state =newTurnEligibility();const state =newTurnEligibility();