OpenThink Cloud

Build realtime HTML pages

Keep an HTML page current when tables change, and sync view state across a person's tabs.

React to table changes

When a table the page has read with think.executeSql changes, whoever changed it, the page receives a think:data event. Query again to stay current; the page itself is not reloaded.

js
async function load() {
  const { rows } = await think.executeSql('SELECT * FROM "Tasks" WHERE "Status" != ?', ["Done"])
  render(rows)
}
addEventListener("think:data", load)
load()

Events that arrive close together are gathered into one event per table.

Live state

think.state is a JSON object per page and per person, kept by the room and synced across that person's open tabs. Use it for filters, selections and other view state that should follow the person.

js
think.setState({ filter: "mine", selected: "62e757cc63f9" }) // shallow merge; null removes a key
render(think.state)
addEventListener("think:state", (e) => render(e.detail.state)) // e.detail.by is "web" or "mcp"
  • setState does a shallow merge and does not fire think:state in the page that called it.
  • Right after the page opens, think.state can be empty for a moment before the saved state arrives in think:state. Draw from both, and call setState only when the person acts, so a default does not overwrite saved state.
  • Up to 16,000 characters per page and person.
  • State is not stored in the database and is not part of page versions.
  • State belongs to one person. Data shared between people belongs in a table.
  • Guests who are not signed in, and fixed shared versions, keep state only inside the open tab.

Reading state from an agent

Over MCP, get_page_state and set_page_state read and write the caller's own state for a page. With since and wait, a read waits up to 25 seconds for the state to change.

Last updated 2026-12-03 UTC. Something wrong or missing? Send feedback.