const client = naive.forUser(alice.id);
// Drive a session step by step
const s = await client.browser.createSession({ allowed_domains: ["example.com"], allow_writes: true });
const nav = await client.browser.navigate(s.session_id, "https://example.com"); // { url, title, ... }
const act = await client.browser.act(s.session_id, "click the first result"); // { success, action_taken, url }
const data = await client.browser.extract(s.session_id, "the product names and prices");
// Read real link targets + the current URL (what `extract` can't see — see note below)
const { url, links } = await client.browser.links(s.session_id, { contains: "linkedin.com" });
// → url: "https://example.com/…", links: [{ text: "LinkedIn", href: "https://linkedin.com/in/…" }]
await client.browser.closeSession(s.session_id);
// Autonomous signup / login — the password is generated + vaulted server-side
const res = await client.browser.signup({ service: "figma.com", url: "https://www.figma.com/signup" });
if (isPendingApproval(res)) {
// gated by the AccountKit — a human must approve before it runs
}
await client.browser.login({ service: "figma.com", url: "https://www.figma.com/login" });
// List a user's sessions
const { sessions } = await client.browser.listSessions();