@protobase/cli 0.53.0 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.1",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@better-auth/core": "^1.7.12",
|
|
44
44
|
"@hono/node-server": "^2.1.3",
|
|
45
|
-
"@protobase/config": "0.53.
|
|
46
|
-
"@protobase/layout": "0.53.
|
|
47
|
-
"@protobase/query": "0.53.
|
|
48
|
-
"@protobase/schema": "0.53.
|
|
49
|
-
"@protobase/server": "0.53.
|
|
50
|
-
"@protobase/ui": "0.53.
|
|
45
|
+
"@protobase/config": "0.53.1",
|
|
46
|
+
"@protobase/layout": "0.53.1",
|
|
47
|
+
"@protobase/query": "0.53.1",
|
|
48
|
+
"@protobase/schema": "0.53.1",
|
|
49
|
+
"@protobase/server": "0.53.1",
|
|
50
|
+
"@protobase/ui": "0.53.1",
|
|
51
51
|
"@react-email/render": "^2.1.0",
|
|
52
52
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
53
53
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -11,7 +11,6 @@ Fields and actions filled by a model, the assistant beside the admin, and MCP.
|
|
|
11
11
|
- [Assistant tools](../reference/assistant.md#the-apps-own-tools): Your own tools for the assistant, acting on records as the user.
|
|
12
12
|
- [MCP server](../reference/mcp.md#the-tools): AI clients connect to the app over MCP as the signed-in person: they list the resources in a small first call, describe one resource's fields when they need them, and find and read records within that person's access, soft-deleted ones too when asked.
|
|
13
13
|
- [MCP counts](../reference/mcp.md#the-tools): AI clients count the records a filter finds, in all or per value of a field such as a status, without reading the records.
|
|
14
|
-
- [MCP result size](../reference/mcp.md#result-size): Every tool result fits what AI clients take, as valid JSON: long values are cut and named, a page holds fewer records, and the client reads the rest in pieces.
|
|
15
14
|
- [MCP app icon](../reference/mcp.md#the-apps-icon): AI clients show the app's own icon beside its name when someone adds its MCP endpoint.
|
|
16
15
|
- [MCP writes](../reference/mcp.md#writes): When turned on, for every resource or only those you list, AI clients create, update and delete records after the person approves each write.
|
|
17
16
|
- [Small MCP write results](../reference/mcp.md#what-a-write-returns): A write over MCP returns the record's key, new ETag, the fields written and the read-only fields that changed, not the whole record; `fields` asks for more.
|
|
@@ -57,7 +57,7 @@ The model needs tool calling for the queries. A refused key, an exhausted accoun
|
|
|
57
57
|
|
|
58
58
|
It lives at `/api/assistant` on the app's own origin and answers with the user's token like the rest of the API. Its system prompt describes the resources, tables and fields the user can see in `/meta`. It has two tools of its own, and [the app's](#the-apps-own-tools):
|
|
59
59
|
|
|
60
|
-
- **`run_read_only_query`** runs one `SELECT` (or `VALUES`, or a `WITH` query) and shows its rows as a table in the chat. It runs in a `READ ONLY` transaction that is always rolled back, with a statement timeout of 5 seconds and at most 200 rows. Postgres refuses every write inside (`SET TRANSACTION READ WRITE`, writable CTEs, `nextval`, `DO` blocks, functions that write), and settings it changes go with the rollback. The statement runs through the function `query.run_read_only` as the role `<database>_query`, which [`protobase migration`](cli.md#migration) makes: that role may read every column of the resources' tables, `.sensitive()` fields and the [webhook subscriptions'](webhooks.md) signing secrets included, and nothing else: not the auth store, nor a table without a resource. The function opens the statement as a cursor, so only one statement runs, and Postgres refuses a change of role inside it. Numbers other than integers of up to 15 digits come back as their exact text, such as `"12.50"`.
|
|
60
|
+
- **`run_read_only_query`** runs one `SELECT` (or `VALUES`, or a `WITH` query) and shows its rows as a table in the chat. It runs in a `READ ONLY` transaction that is always rolled back, with a statement timeout of 5 seconds and at most 200 rows. Postgres refuses every write inside (`SET TRANSACTION READ WRITE`, writable CTEs, `nextval`, `DO` blocks, functions that write), and settings it changes go with the rollback. The statement runs through the function `query.run_read_only` as the role `<database>_query`, which [`protobase migration`](cli.md#migration) makes: that role may read every column of the resources' tables, `.sensitive()` fields and the [webhook subscriptions'](webhooks.md) signing secrets included, and nothing else: not the auth store, nor a table without a resource. The function opens the statement as a cursor, so only one statement runs, and Postgres refuses a change of role inside it. Numbers other than integers of up to 15 digits come back as their exact text, such as `"12.50"`.
|
|
61
61
|
- **`propose_write_query`** never runs on its own. It shows the statement and a summary on a card with **Approve** and **Reject**. Only Approve runs it, as one statement in a read-write transaction; Reject, or no answer within 10 minutes, runs nothing. The model gets the returned rows, or that nothing ran. Statements are `INSERT`, `UPDATE` or `DELETE` with a `RETURNING` clause.
|
|
62
62
|
|
|
63
63
|
Both run **outside Protobase's access rules and tenant scoping**: whoever has the `admin` or `ai` role can read every resource's table, and with approval change everything the app's database role can, since `propose_write_query` still runs as that role. Give the app a database role without superuser rights, and those roles only to people who may see all of the data.
|
|
@@ -45,16 +45,10 @@ Each tool reads as the signed-in person: their role's access rules, row filters,
|
|
|
45
45
|
| `describe_resource` | One resource the person may read, with its fields: each field's type, label, help, enum values, the resource a relation links to, and whether it is optional, read-only and taken by filters and sorts. |
|
|
46
46
|
| `list_records` | A page of a resource's records: `filter` in the API's [filter syntax](api.md#filters), `order_by`, `page_size` (20 by default, at most 100) and `page_token`, with `next_page_token` for the next page. `show_deleted: true` also returns soft-deleted records. |
|
|
47
47
|
| `count_records` | How many records a `filter` finds, without returning them: `{ count }` as the API's `count=exact` counts, or `{ more_than: 10000, estimate }` when more match. With `group_by`, a filterable field, the count per value instead, as [`:aggregate`](api.md#routes) gives it: `{ group_by, groups: [{ value, count }] }`, largest first, adding up to what the filter finds, the first `limit` (100 by default, at most 1,000), with `label` naming a relation's values by a field of the records they link to. A date or timestamp `group_by` counts per day over the last 30 days. `show_deleted: true` also counts soft-deleted records. |
|
|
48
|
-
| `get_record` | One record by its key, with its ETag. A composite key is passed as the values of its fields, in order. `show_deleted: true` also finds a soft-deleted record.
|
|
48
|
+
| `get_record` | One record by its key, with its ETag. A composite key is passed as the values of its fields, in order. `show_deleted: true` also finds a soft-deleted record. |
|
|
49
49
|
|
|
50
50
|
`show_deleted` works as the [REST API](api.md#routes)'s: it applies only to a resource with a soft delete, and is refused on any other. <gap>`count_records` cannot count soft-deleted records per value because `:aggregate` does not implement `show_deleted`.</gap> Soft-deleted records come under the same access rules, tenant and hidden fields as the rest, and carry the field their deletion set.
|
|
51
51
|
|
|
52
|
-
### Result size
|
|
53
|
-
|
|
54
|
-
The result of each tool that returns records, and of `run_read_only_query`, stays within 40,000 characters of JSON, below what clients take as one tool result, and stays valid JSON when it is cut. Over that, long text values are cut first, each named in `cut_fields` with its path and full length, such as `{ "field": "items[3].body", "length": 52341 }`. When that is not enough, `list_records` returns fewer records, with the `next_page_token` that goes on after the last one, and `run_read_only_query` fewer rows, marked `truncated`. A `note` then says how to read the rest: `get_record` with `field` and `offset` for a cut field, or `OFFSET` and `substring` in SQL.
|
|
55
|
-
|
|
56
|
-
<gap>`list_resources` and the app's own tools cannot cut a result to the size budget because a budget outside the record and SQL tools is not implemented.</gap> An app with very many resources, or a tool of its own, keeps its results small itself.
|
|
57
|
-
|
|
58
52
|
A refusal, such as a resource the person may not read or a bad filter, comes back to the client as text it can act on, `{ "error": ..., "message": ... }`.
|
|
59
53
|
|
|
60
54
|
### Comments
|