Run it
Put this in the document and reload the preview.
const response = await Orbi.exec(`async ({ orbi }) => {
return orbi.project.name
}`)
document.body.textContent = response.resultThe page shows the workspace name. response.result is the value your function returns.
When to use an action instead
Use a server action when the page calls the same function more than once. Use Orbi.exec when you want to try a function without saving it. Both receive orbi, browser, ai, leads, and the rest of the runtime.
If this fails: Orbi.exec does not return the workspace name
Read response.result, not the whole response. The function must be an async function expression. A syntax error comes back as the execution error. no paying sponsor means the workspace cannot run code until the sponsor can pay.