Bases need
ravi.bot@next (3.261009.2 or later): bun add -g ravi.bot@next, or ravi update --next on an existing install. @latest has no ravi bases command, and its pages ship has no --uses.Concepts
Who can use a data page
A data page reads the base live, as the person viewing it. It works only for signed-in members of your organization who can read the project, on aprivate (the default) or protected_link route. Both make the visitor sign in to the Console first.
- Organization
owner,adminanddevelopercan open it.viewercannot unless they are a member of the project, andbillingnever gets live data, so add teammates asdeveloperoradmin. Adevelopercan read every row through the CLI: “each person sees their own” holds on the page, not between developers. - Someone in several organizations must switch to yours in the Console before opening the link, or sign-in fails with
workspace_selection_required. - Anonymous visitors, people who only have a route password, and people outside the organization never get live data (
connector_session_required).
ravi pages ship refuses a public route that uses live data. It exits with code 2, uploads nothing, and --json reports error.code: "LIVE_DATA_PUBLIC_ROUTE":
--members-best-effort overrides it, only for pages whose readers are all members already signed in.
People outside your organization reach the agent through a channel (Slack, WhatsApp): the agent writes the row and answers in the conversation. For a public view of the numbers, publish a static snapshot (data inside the HTML, no ravi.bases.* in --uses) on a public route or from a separate project.
Before you start
- Ravi installed and the daemon running, with an agent you can talk to (
mainhere). See Install Ravi and Make yourself the owner. - Logged in to the Console with a default project and an
owner,adminordeveloperrole. Ifravi whoamidoes not list theconsole.bases.*andconsole.inbox.*scopes, log in again. - Run every command on the machine, and as the OS user, that runs the daemon. Row events go to the installation that subscribed.
bases and pages skills.
Build it
1
Get the site id
The view must name the project’s Pages host (its site). Check whether the host exists:If it exists, take the If it does not, ship a placeholder. The first ship creates the host, and The placeholder needs no
id of the site with "isDefault": true:site.id in its JSON is your site id:--uses. Shipping it never removes the actions other routes on this host declared.2
Create the base
Save Dates and
requests.json:$today use UTC unless you pass --timezone <IANA zone> to bases create. Keep keys stable: views, filters and pages refer to them.3
Create the view
Save
view.json and replace both <SITE_ID>:- The filter keeps each viewer to the rows they created. The Console applies it on every call; the page cannot widen it.
page_vieweradmits anyone who can open any route of this host, not one person. Per-person access is the filter’s job, so project only columns every member may see.- The page can write only
request. Every new row starts asNew(write.set), andreplyandstatusstay with the agent. - To give the site access to a view that already exists, without editing its JSON:
ravi bases views share requests <VIEW_ID> --site <host> [--write a,b] [--create] [--archive] [--write-only] --execute. It adds thepage_viewerprincipal, saves at the version it read and prints what the host can now read and write. Without--executeit only prints the plan (the view, the site, the access it would gain and the disclosure) and exits 3, because it widens who can reach the view; when the site already has that access, nothing is written. The write settings are shared by every write principal of the view.
4
Write the page
Copy the client. It is the only helper: there is no Save
window.ravi and no browser SDK.requests/index.html and replace <VIEW_ID>:- Status values arrive as option ids; the page maps them to names with
describe. - Every value reaches the DOM through
textContent(theelhelper). Members type this text: never useinnerHTML. - The messages in
client.jsare in Portuguese. Translate theMESSAGEStable and the strings inshowErrorin your copy if you need to.
5
Ship it
url, site, slug, route: "/requests", visibility: "private", artifactId and uses.- Leave
--visibilityout: the route staysprivate. --useslists every action this page calls. Other data pages on the host keep the actions their own ships declared: the host allows the union over its active routes. An action no route declares fails on the page withconnector_not_allowlisted.- Ship data pages with
ship.ravi pages publishandartifacts publishdeclare no actions, so a data route republished with them loses its own. - A
CONFLICTerror on a re-ship usually means an unread comment from someone else on this route. See the operator bar and comments.
6
Open it as a member
Open the
url. The Console asks you to sign in and brings you back to /requests/, with the form and an empty list. Members also see the operator bar at the top of the page.Send a request. It appears with status New.The page session lasts one hour. After that the banner shows a sign-in link, and reloading signs you in again.7
Subscribe to row events
ravi inbox status must show required scopes ok : yes; if it says no, run ravi login again. Polling is on by default; ravi inbox enable turns it back on if it was disabled.The event your trigger receives carries the row’s ids and its values, in payload.row.To receive only some events, filter the subscription: --events row.created,row.updated (also row.archived, row.restored, approval.requested, approval.decided, agent.requested, agent.backfill), --props a,b (changes to those properties) and --view <VIEW_ID> (rows that pass that view’s filter, evaluated for you). The same filter again returns the same subscription; a different filter is a second subscription, and its items carry payload.subscriptionId.8
Create the trigger
- The filter is the only loop protection. It matches rows created from the page. The agent’s own write arrives as
bases.row.updatedfrom the CLI and does not match. - The prompt drains the queue. The cooldown drops events that arrive while it runs instead of queueing them, and the inbox delivers events in batches. Handling every
Newrow means a dropped event is picked up by the next run. The cooldown starts only when an event passes the filter. - The idempotency key comes from the row and its version, so a repeated event cannot write twice.
@@SILENT@@keeps the agent quiet when the queue is empty. - The trigger runs as you, because you created it from your terminal:
ravi triggers show <id>printsRuns as: operator, so the agent’s turns read and write the base as you. See Who the agent acts as. --session isolatedgives the trigger its own session, and Bases requires it. Only this trigger’s fires run there: no other trigger, no message sent to the session, no chat. In the agent’s main session, in a chat’s session or in a session with a name you choose, the turn still sees the event, but it cannot read or write the base, because other conversations share what a turn reads there.ravi triggers show <id>prints the session’s name next toSession, or says when the session is not the trigger’s own.- The answer lives in the row: the trigger’s own session has no chat, so nothing is posted. If someone must also be told, say so in the message, for example
Then report with: ravi sessions inform <your-session> "<summary>"(the agent needs access to that session). ravi bases subscribe requests --events row.created --trigger --agent main --session isolated --message "$MSG"subscribes and creates an equivalent trigger in one command (without thesurfacecondition: add it withravi triggers set <id> filter '...'if only the page counts). Run from your terminal, the trigger is enabled. Run by an agent in a conversation, it is created disabled, as a draft: the output gives the command to turn it on (ravi triggers enable <id>). Keep--session isolated: without--sessionthe trigger runs in the current session (or the agent’s main one), where it cannot use Bases, and the command says so.
9
Test end to end
Send a request from the page, then:Within about a minute (the 15 s inbox poll, the agent’s turn, the page’s 30 s refresh) the page shows the reply and status
Done. If not, see Debugging.Who the agent acts as
The CLI talks to the Console with the operator’s login. Inside a conversation turn, Ravi tells the Console who wrote the message:- A person who linked their account (
ravi link) and is an active member: the agent’s Bases reads and writes in that turn act as that person, with the smaller of their role and the operator’s. A view filtered by$viewershows that person’s rows. - A person who did not link: Bases reads and writes are both refused with
ACTOR_NOT_LINKED(exit 3), and Ravi starts the link: relay the error’schatLinePt(on WhatsApp, “me chama na DM”). The agent never reads as the operator for them. - A turn Ravi cannot attribute (another agent’s turn, a speaker it cannot identify): refused before any Console call with
ACTOR_UNKNOWN(exit 3), reads included. - Your own turns (your terminal, your DM, a cron job or a trigger you own): the operator.
- A cron job or a trigger someone else owns: that person, through their own
ravi link, never you. Nobody is asking in such a turn, so an unlinked owner getsACTOR_NOT_LINKEDwithout a message from Ravi. - A cron job or a trigger nobody owns: refused with
ACTOR_UNKNOWN. A trigger created before Ravi recorded owners is one of them (Runs as: unknowninravi triggers show <id>): create it again from your terminal to own it.
--session isolated), where nothing but its own fires runs and its answer is posted to no chat. See Who the job runs as and Who the trigger runs as.
Every row write is recorded for the accountable person, as cli, with the agent next to it in rows history. The anti-loop filter data.actor.type == "user" keeps working.
By default an agent can read Bases through views and charts: ravi bases list|show, ravi bases views list|show|query, ravi bases charts list|show|data. Direct rows query, aggregate and every write are granted explicitly (see Permissions).
Approvals
Anapproval property holds one decision per row. Only the listed approvers can decide it, on any surface, and the Console records who asked and who decided.
--approverstakesrole:<viewer|developer|project_admin>(that project role or above) oruser:<id>, 1 to 20.--reset-onlists properties whose change sends a decision back topending.- The value reads as
{state, requestedBy, requestedAt, decidedBy, decidedAt, note}, withstatepending,approvedorrejected. request-approvalneeds write access to the column.approveandrejectare dry runs without--execute(exit 3), and someone who is not an approver getsPROJECT_ACCESS_DENIEDwithapproval_forbidden. No default grant lets an agent decide.- All three take
--viewand--expected-version. Without a version the write applies to the current row (last write wins), so a retry with the same--idempotency-keyreplays instead of conflicting. Keys last 24 hours: use a new one for each request and repeat it only on retries of that request. The dry run ofapproveandrejectreads the row first, so an unknown row fails with exit 1. - Events:
bases.approval.requestedandbases.approval.decided, withpayload.propertyIdandpayload.state, in addition tobases.row.updated. The Console payload carries no note; the local runner adds the row read at delivery, so the note is inpayload.row.values.<key>.note. - On a page,
describereturnscapabilities.approve, the approval columns the viewer can decide; the<ravi-view>tag shows the buttons only for those.
Agent columns
Anagent property is a value an agent fills for each row from other columns: a summary, a category, a score.
- When a row is created, or one of its inputs changes, the Console marks the cell
pendingwith a newinputsHashand emitsbases.agent.requested. Adding the column to a base that has rows emits onebases.agent.backfillwith the row count. - The cell reads as
{state, value, error, inputsHash, updatedAt}. Nobody writes it withrows add,rows updateor a view. rows fillstores the value (--value, JSON when it parses, otherwise text) or an error (--error) for theinputsHashthe agent read. If the inputs changed since, it fails withCONFLICT(agent_stale) and the current hash: re-read the row, compute the value again from its current inputs, then fill with the hash you read. Never store the old result under the new hash.- A fill emits only
bases.row.updated, so the filling agent does not wake itself onagent.requested.
How the page talks to the base
Nothing is injected into your page except the operator bar. The page calls its own host withfetch:
POST /_ravi/connectors/execwith{"id": "<action>", "input": {...}}, same origin, using the session cookie set at sign-in. Success is HTTP 200 with{ok: true, id, revision, output}. Errors carry an HTTP status and{error}, plusfieldErrorsonvalidation_failedandcurrentonversion_conflict, and anx-request-idheader.GET /_ravi/connectors/catalog?executable=truelists the actions the host allows and whether the viewer has a session.
A page cannot list views, read row history, restore rows, aggregate outside a chart, write in batches, receive pushes, upload files, call an agent or send a message. The agent does those through the CLI and writes results to rows the page reads.
Each viewer gets 120 calls per minute on a site (600 per site, 1,200 per organization). Above that the page gets
connector_rate_limited, and client.js waits and retries.
Limits worth knowing
- No push. The page re-reads on a timer, and
pollnever goes below 30 s. Withravi.bases.views.versionin--usesit can check the fingerprint every few seconds and re-read only when it changes. - The cooldown drops events. When the last change matters, add a sweep with the same prompt:
ravi cron add "Requests sweep" --every 1h --agent main --isolated --message "$MSG". - Option ids, not names.
selectandstatusvalues arrive as option ids in row events and on the page, sodata.payload.row.values.status == "New"never matches. Read the ids withravi bases show requests --json. Filters compare text only (==,!=,startsWith,endsWith,includes), and a missing path is false, even with!=. - Bulk changes. A request that changes more than 50 rows sends one
bases.rows.bulk_changedevent, with norowIdand no values. A filtered subscription receives it without checking its view or properties. - Comments do not wake the agent. For feedback that must reach it, use a base with a form.
- Thumbnails of data pages show an error: the capture session cannot call actions.
- Idempotency keys are 8 to 128 characters from
A-Za-z0-9._:-, start with a letter or digit, and last 24 hours. Reuse a key only to resend the same input; a changed input, including a newexpectedVersionafter a conflict, needs a new key.rows.archivetakes none. An agent write without--idempotency-keysucceeds with a warning, and a retry would write twice. - The CLI does not see what a viewer sees.
ravi bases views queryon a$viewerview returns only your own rows. Check by opening the page. - Only
shipchecks visibility.ravi pages visibilityand the operator bar can still make a data routepublic. Keep data routesprivate.
Debugging
On the page,
client.js adds the x-request-id to the error banner when the response has one; keep it when you ask for support. More in Triggers and Publish pages.