| window.openai → React Component | The component reads data (like tool input/output, theme, layout) from window.openai using hooks such as useWidgetProps or useOpenAiGlobal. |
| React Component → useWidgetState | User interactions (clicks, filters, toggles) are handled in React and synchronized with the host through useWidgetState. |
| useWidgetState → window.openai.setWidgetState | When state changes, it’s sent to the host via window.openai.setWidgetState() for persistence. |
| window.openai → ChatGPT Host Context | ChatGPT stores the widget state persistently, so it’s available across sessions and visible to the model for reasoning. |