Skip to main content

describe_agent_state_at

Function describe_agent_state_at 

Source
pub fn describe_agent_state_at(source: &str, offset: usize) -> Option<String>
Expand description

v0.137.0 (ADR 0161): hover for the key/store contextual keywords and the agent state fields they introduce. Both are lexed as Idents (not reserved KEYWORDS), and the fields they declare are neither let/param locals nor top-level declarations — so neither the keyword fallback nor the describe_symbol/locals paths in the hover handler reach them. This closes that gap: for the cursor on the key/store keyword or on the field name it declares, render the field’s signature (type, and a store field’s @indexed/@bounded/… annotations) followed by the contextual-keyword doc.

#611 (gap A): a reference to a state field inside the agent’s body — a bare read (lastSeq + 1), a := write target, an invariant subject, a store op’s receiver (items.put(…)) — renders the same hover as its declaration. State fields are absent from the project index and are not let/param locals, so a reference resolved nowhere before this. The hover handler tries the locals path first, so a local shadowing a field name still hovers as the local — matching the checker, which dispatches a store op only on a bare ident that is not in the value scope.

None when the cursor is not on an agent’s key/store keyword, its state-field name, or a reference to one within the agent.