# State Model ## Goal Define the agent-neutral state model for reply-end controls. This state should be reusable across multiple agents, while Telegram remains the first delivery channel. ## Core state Suggested canonical structure: ```json { "replyEndControls": { "lastChoice": "continue | stop", "lastChoiceAt": "ISO timestamp", "sourceMessageId": "string", "sourceCallbackId": "string", "active": true } } ``` ## Field meanings - `lastChoice` - the latest explicit user choice - `lastChoiceAt` - when the choice was made - `sourceMessageId` - the assistant message whose buttons were clicked - `sourceCallbackId` - the callback event id from the channel - `active` - whether the latest state should still affect later assistant behavior ## Semantics - `continue` - the conversation should remain open to follow-up handling - `stop` - the conversation should be treated as closed unless the user explicitly types a new instruction ## Reset rules - A new typed user message overrides prior button state. - A later `continue` click overrides an earlier `stop` click. - The system may optionally expire stale button state in a later version, but V1 does not require timeout expiry.