datanotes 2.0.0 → 3.0.0

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.
Files changed (181) hide show
  1. package/NOTICE +9 -0
  2. package/README.md +207 -28
  3. package/SECURITY.md +92 -45
  4. package/dist/THIRD-PARTY-NOTICES.txt +682 -0
  5. package/dist/api/catalog.d.cts +69 -0
  6. package/dist/api/catalog.d.ts +50 -2
  7. package/dist/api/cli-options.d.cts +39 -0
  8. package/dist/api/cli-options.d.ts +39 -0
  9. package/dist/api/client.d.cts +89 -0
  10. package/dist/api/client.d.ts +19 -30
  11. package/dist/api/docs.d.cts +211 -0
  12. package/dist/api/docs.d.ts +211 -0
  13. package/dist/api/guidance.d.cts +81 -0
  14. package/dist/api/guidance.d.ts +81 -0
  15. package/dist/api/index.cjs +6610 -2247
  16. package/dist/api/index.d.cts +13 -0
  17. package/dist/api/index.d.ts +10 -7
  18. package/dist/api/index.js +6610 -2247
  19. package/dist/api/local.cjs +118 -6
  20. package/dist/api/local.d.cts +95 -0
  21. package/dist/api/local.d.ts +70 -6
  22. package/dist/api/local.js +104 -6
  23. package/dist/api/mcp.cjs +17384 -0
  24. package/dist/api/mcp.d.cts +108 -0
  25. package/dist/api/mcp.d.ts +108 -0
  26. package/dist/api/mcp.js +17334 -0
  27. package/dist/api/otlp.d.cts +65 -0
  28. package/dist/api/redact.d.cts +17 -0
  29. package/dist/api/redact.d.ts +17 -0
  30. package/dist/api/requests.d.cts +26 -0
  31. package/dist/api/requests.d.ts +14 -16
  32. package/dist/api/results.d.cts +16 -0
  33. package/dist/api/results.d.ts +2 -1
  34. package/dist/api/tokens.d.cts +7 -0
  35. package/dist/datanotes.cjs +62911 -28409
  36. package/dist/docs/administration/configuration.md +59 -0
  37. package/dist/docs/administration/docker.md +80 -0
  38. package/dist/docs/administration/git-sync.md +71 -0
  39. package/dist/docs/administration/limits.md +69 -0
  40. package/dist/docs/administration/run-the-service.md +219 -0
  41. package/dist/docs/administration/status.md +61 -0
  42. package/dist/docs/administration/use-with-obsidian.md +75 -0
  43. package/dist/docs/api/operations/add_column.md +49 -0
  44. package/dist/docs/api/operations/add_constraint.md +55 -0
  45. package/dist/docs/api/operations/adopt_rows.md +50 -0
  46. package/dist/docs/api/operations/align_relations.md +41 -0
  47. package/dist/docs/api/operations/alter_column.md +46 -0
  48. package/dist/docs/api/operations/alter_table.md +67 -0
  49. package/dist/docs/api/operations/batch.md +48 -0
  50. package/dist/docs/api/operations/changes_stream.md +28 -0
  51. package/dist/docs/api/operations/check_table.md +29 -0
  52. package/dist/docs/api/operations/clone_table.md +48 -0
  53. package/dist/docs/api/operations/comment_on.md +42 -0
  54. package/dist/docs/api/operations/configure_database.md +52 -0
  55. package/dist/docs/api/operations/create_table.md +78 -0
  56. package/dist/docs/api/operations/create_view.md +54 -0
  57. package/dist/docs/api/operations/create_webhook.md +37 -0
  58. package/dist/docs/api/operations/define_base.md +52 -0
  59. package/dist/docs/api/operations/delete_rows.md +43 -0
  60. package/dist/docs/api/operations/delete_webhook.md +31 -0
  61. package/dist/docs/api/operations/describe_database.md +30 -0
  62. package/dist/docs/api/operations/describe_history.md +40 -0
  63. package/dist/docs/api/operations/describe_semantic_index.md +24 -0
  64. package/dist/docs/api/operations/describe_table.md +38 -0
  65. package/dist/docs/api/operations/docs.md +13 -0
  66. package/dist/docs/api/operations/drop_column.md +41 -0
  67. package/dist/docs/api/operations/drop_constraint.md +39 -0
  68. package/dist/docs/api/operations/drop_table.md +43 -0
  69. package/dist/docs/api/operations/drop_view.md +38 -0
  70. package/dist/docs/api/operations/engine_status.md +23 -0
  71. package/dist/docs/api/operations/graph_neighbors.md +32 -0
  72. package/dist/docs/api/operations/graph_path.md +32 -0
  73. package/dist/docs/api/operations/graph_traverse.md +43 -0
  74. package/dist/docs/api/operations/identify_session.md +24 -0
  75. package/dist/docs/api/operations/infer_table.md +43 -0
  76. package/dist/docs/api/operations/insert_row.md +48 -0
  77. package/dist/docs/api/operations/list_changes.md +35 -0
  78. package/dist/docs/api/operations/list_folder.md +28 -0
  79. package/dist/docs/api/operations/list_link_targets.md +44 -0
  80. package/dist/docs/api/operations/list_migrations.md +35 -0
  81. package/dist/docs/api/operations/list_tables.md +32 -0
  82. package/dist/docs/api/operations/list_webhooks.md +23 -0
  83. package/dist/docs/api/operations/manual_index.md +14 -0
  84. package/dist/docs/api/operations/manual_page.md +22 -0
  85. package/dist/docs/api/operations/merge_rows.md +44 -0
  86. package/dist/docs/api/operations/move_rows.md +52 -0
  87. package/dist/docs/api/operations/openapi.md +13 -0
  88. package/dist/docs/api/operations/openapi_post.md +20 -0
  89. package/dist/docs/api/operations/read_note.md +29 -0
  90. package/dist/docs/api/operations/recompute_columns.md +44 -0
  91. package/dist/docs/api/operations/record_tool_call.md +36 -0
  92. package/dist/docs/api/operations/rename_column.md +44 -0
  93. package/dist/docs/api/operations/rename_value.md +45 -0
  94. package/dist/docs/api/operations/restore_database.md +51 -0
  95. package/dist/docs/api/operations/restore_table.md +46 -0
  96. package/dist/docs/api/operations/search_notes.md +28 -0
  97. package/dist/docs/api/operations/select_rows.md +61 -0
  98. package/dist/docs/api/operations/semantic_search.md +34 -0
  99. package/dist/docs/api/operations/semantic_search_docs.md +26 -0
  100. package/dist/docs/api/operations/set_table_bases.md +44 -0
  101. package/dist/docs/api/operations/status.md +13 -0
  102. package/dist/docs/api/operations/stop_engine.md +23 -0
  103. package/dist/docs/api/operations/sync_semantic_index.md +33 -0
  104. package/dist/docs/api/operations/table_changes.md +31 -0
  105. package/dist/docs/api/operations/tags/auxiliary.md +14 -0
  106. package/dist/docs/api/operations/tags/change-feed.md +8 -0
  107. package/dist/docs/api/operations/tags/history.md +17 -0
  108. package/dist/docs/api/operations/tags/queries.md +15 -0
  109. package/dist/docs/api/operations/tags/rows-dml.md +16 -0
  110. package/dist/docs/api/operations/tags/schema-ddl.md +22 -0
  111. package/dist/docs/api/operations/tags/service.md +15 -0
  112. package/dist/docs/api/operations/tags/tokens.md +13 -0
  113. package/dist/docs/api/operations/tokens_create.md +34 -0
  114. package/dist/docs/api/operations/tokens_delete.md +29 -0
  115. package/dist/docs/api/operations/tokens_list.md +21 -0
  116. package/dist/docs/api/operations/tokens_me.md +20 -0
  117. package/dist/docs/api/operations/tokens_rotate.md +29 -0
  118. package/dist/docs/api/operations/tokens_update.md +34 -0
  119. package/dist/docs/api/operations/undo_migration.md +46 -0
  120. package/dist/docs/api/operations/update_row.md +60 -0
  121. package/dist/docs/api/operations/update_rows.md +46 -0
  122. package/dist/docs/api/operations/vacuum_table.md +37 -0
  123. package/dist/docs/api.md +135 -0
  124. package/dist/docs/develop/build-an-app.md +320 -0
  125. package/dist/docs/develop/build-on-datanotes.md +138 -0
  126. package/dist/docs/develop/change-feed-and-webhooks.md +70 -0
  127. package/dist/docs/develop/client.md +116 -0
  128. package/dist/docs/develop/concurrency.md +153 -0
  129. package/dist/docs/develop/http-api.md +79 -0
  130. package/dist/docs/develop/telemetry.md +86 -0
  131. package/dist/docs/guides/agents/docs-offline.md +99 -0
  132. package/dist/docs/guides/agents/how-agents-use-datanotes.md +124 -0
  133. package/dist/docs/guides/agents/prompts.md +495 -0
  134. package/dist/docs/guides/agents/reading-errors.md +112 -0
  135. package/dist/docs/guides/data-quality/check-constraints.md +379 -0
  136. package/dist/docs/guides/data-quality/check-table.md +63 -0
  137. package/dist/docs/guides/data-quality/hand-edits.md +507 -0
  138. package/dist/docs/guides/data-quality/sync-between-devices.md +51 -0
  139. package/dist/docs/guides/data-quality/validation.md +90 -0
  140. package/dist/docs/guides/database-objects/bases.md +480 -0
  141. package/dist/docs/guides/database-objects/catalogs-and-schemas.md +897 -0
  142. package/dist/docs/guides/database-objects/columns.md +1332 -0
  143. package/dist/docs/guides/database-objects/relations.md +1454 -0
  144. package/dist/docs/guides/database-objects/tables.md +1404 -0
  145. package/dist/docs/guides/database-objects/views.md +1003 -0
  146. package/dist/docs/guides/history/back-up.md +195 -0
  147. package/dist/docs/guides/history/change-data-feed.md +247 -0
  148. package/dist/docs/guides/history/journal-and-undo.md +262 -0
  149. package/dist/docs/guides/history/restore.md +341 -0
  150. package/dist/docs/guides/history/table-history.md +657 -0
  151. package/dist/docs/guides/history/vacuum.md +35 -0
  152. package/dist/docs/guides/read-and-write/automatic-links.md +768 -0
  153. package/dist/docs/guides/read-and-write/batch.md +139 -0
  154. package/dist/docs/guides/read-and-write/import-notes.md +896 -0
  155. package/dist/docs/guides/read-and-write/joins-and-aggregates.md +251 -0
  156. package/dist/docs/guides/read-and-write/read-and-filter.md +536 -0
  157. package/dist/docs/guides/read-and-write/write-rows.md +573 -0
  158. package/dist/docs/guides/search/link-graph.md +146 -0
  159. package/dist/docs/guides/search/semantic.md +133 -0
  160. package/dist/docs/guides/search/text.md +142 -0
  161. package/dist/docs/guides/security/security-model.md +110 -0
  162. package/dist/docs/guides/security/tokens.md +60 -0
  163. package/dist/docs/guides/security/who-did-what.md +42 -0
  164. package/dist/docs/index.md +113 -0
  165. package/dist/docs/llms.txt +33 -0
  166. package/dist/docs/reference/cli.md +136 -0
  167. package/dist/docs/reference/compatibility.md +63 -0
  168. package/dist/docs/reference/errors.md +72 -0
  169. package/dist/docs/reference/glossary.md +161 -0
  170. package/dist/docs/reference/operations/auxiliary.md +116 -0
  171. package/dist/docs/reference/operations/history.md +168 -0
  172. package/dist/docs/reference/operations/queries.md +169 -0
  173. package/dist/docs/reference/operations/rows.md +185 -0
  174. package/dist/docs/reference/operations/schema.md +316 -0
  175. package/dist/docs/reference/operations.md +96 -0
  176. package/dist/docs/reference/settings.md +31 -0
  177. package/dist/docs/release-notes.md +67 -0
  178. package/dist/docs/start/connect-agents.md +204 -0
  179. package/dist/docs/start/how-it-works.md +317 -0
  180. package/dist/docs/start/quick-start.md +126 -0
  181. package/package.json +59 -14
@@ -0,0 +1,14 @@
1
+ # Auxiliary
2
+
3
+ Operations that describe and check the database, configure it and maintain its indexes.
4
+
5
+ ## Operations
6
+
7
+ - [List every table: `name`, `catalog`, `schema`, `qualified` (`personal.metrics.mood` — use it](https://datanotes.dev/api/operations/list_tables/): `POST /datanotes/operations/list_tables/`
8
+ - [Describe a table (`catalog.schema.table` or a shorter unambiguous name): `qualified`, `name`,](https://datanotes.dev/api/operations/describe_table/): `POST /datanotes/operations/describe_table/`
9
+ - [Describe the database: its folder (`root`), `metastore` (`metastore.yaml`: read it freely,](https://datanotes.dev/api/operations/describe_database/): `POST /datanotes/operations/describe_database/`
10
+ - [Configure the database (persisted in metastore.yaml `config:`): `root` (rename the database](https://datanotes.dev/api/operations/configure_database/): `POST /datanotes/operations/configure_database/`
11
+ - [Validate every row against the table (required, types, ranges, enums, links, unknown](https://datanotes.dev/api/operations/check_table/): `POST /datanotes/operations/check_table/`
12
+ - [Read-only schema inference from notes' front matter.](https://datanotes.dev/api/operations/infer_table/): `POST /datanotes/operations/infer_table/`
13
+ - [The semantic search index: `enabled`, `provider`, `model`, `files`, `passages`, `pending`,](https://datanotes.dev/api/operations/describe_semantic_index/): `POST /datanotes/operations/describe_semantic_index/`
14
+ - [Bring the semantic search index up to date: embed the notes changed since the last run (the](https://datanotes.dev/api/operations/sync_semantic_index/): `POST /datanotes/operations/sync_semantic_index/`
@@ -0,0 +1,8 @@
1
+ # change feed
2
+
3
+ The change feed as Server-Sent Events, and the tool calls MCP servers report.
4
+
5
+ ## Operations
6
+
7
+ - [Record an agent's tool call in the change feed (`tool_call` events): what an MCP server reports after each call, its own tools included (`served_by`). Any token may call it.](https://datanotes.dev/api/operations/record_tool_call/): `POST /datanotes/tool-calls/record/`
8
+ - [The change feed as Server-Sent Events (id = sequence number). Resumes from Last-Event-ID or `since`.](https://datanotes.dev/api/operations/changes_stream/): `GET /datanotes/changes/stream`
@@ -0,0 +1,17 @@
1
+ # History
2
+
3
+ Operations on the journal, a table's versions, the change feed and webhooks: undo, time travel, restore and vacuum.
4
+
5
+ ## Operations
6
+
7
+ - [Revert a journaled table operation by its `migration_id`. Refused (nothing written) when any](https://datanotes.dev/api/operations/undo_migration/): `POST /datanotes/operations/undo_migration/`
8
+ - [The operation journal, newest first: `total` (the matching operations) and `migrations`, each with](https://datanotes.dev/api/operations/list_migrations/): `POST /datanotes/operations/list_migrations/`
9
+ - [DESCRIBE HISTORY: the table's versions, newest first — `version`, `timestamp`, `operation`](https://datanotes.dev/api/operations/describe_history/): `POST /datanotes/operations/describe_history/`
10
+ - [Change data feed between two versions (both included, end defaults to latest): one entry](https://datanotes.dev/api/operations/table_changes/): `POST /datanotes/operations/table_changes/`
11
+ - [Change feed across all tables: numbered row changes (`seq`), oldest first, from engine writes](https://datanotes.dev/api/operations/list_changes/): `POST /datanotes/operations/list_changes/`
12
+ - [Webhooks of the change feed: id, url, filter (tables, ops, columns, exclude_actor), `cursor` (last change delivered), `status` (ok, failing, disabled), `last_delivery`, `last_error`. Secrets are not shown.](https://datanotes.dev/api/operations/list_webhooks/): `POST /datanotes/operations/list_webhooks/`
13
+ - [Push row changes to a URL (a service that would rather be called than poll `list_changes`): batches of up to 100 events POSTed as `{webhook, events, last}`, signed with `X-Datanotes-Signature: sha256=<HMAC of the body>`, retried with backoff until a 2xx. Events are those of `list_changes` (hand edits with their `violations`; the hand edits the service has seen are recorded before it stops). Starts from now unless `since`. Returns the webhook with its `secret` — shown only here: give it to the receiver. Only on the user's explicit request: a webhook sends the database's changes (and, with `since`, its past ones) to that address.](https://datanotes.dev/api/operations/create_webhook/): `POST /datanotes/operations/create_webhook/`
14
+ - [Stop and remove a webhook (by `id` from list_webhooks).](https://datanotes.dev/api/operations/delete_webhook/): `POST /datanotes/operations/delete_webhook/`
15
+ - [RESTORE TABLE to a `version` or `timestamp`: rows and definition return to that state —](https://datanotes.dev/api/operations/restore_table/): `POST /datanotes/operations/restore_table/`
16
+ - [RESTORE DATABASE to a `timestamp` (each table as of its last version committed at or before it) or](https://datanotes.dev/api/operations/restore_database/): `POST /datanotes/operations/restore_database/`
17
+ - [Delete transaction-log history older than `retain_from_version` (default: keep only the](https://datanotes.dev/api/operations/vacuum_table/): `POST /datanotes/operations/vacuum_table/`
@@ -0,0 +1,15 @@
1
+ # Queries
2
+
3
+ Operations that read rows and notes: select_rows, link targets, text and semantic search, the link graph.
4
+
5
+ ## Operations
6
+
7
+ - [Read a note or another file of the vault: `{path, content, front_matter, tags, modified_at,](https://datanotes.dev/api/operations/read_note/): `POST /datanotes/operations/read_note/`
8
+ - [The direct children of a vault folder: `{folder, folders, files}`, each a vault path, sorted;](https://datanotes.dev/api/operations/list_folder/): `POST /datanotes/operations/list_folder/`
9
+ - [Plain-text search: every word of `query` must occur, case- and accent-insensitive, in the](https://datanotes.dev/api/operations/search_notes/): `POST /datanotes/operations/search_notes/`
10
+ - [Query rows: `{table, total, rows: [{path, ...}]}`. `table` may be a view,](https://datanotes.dev/api/operations/select_rows/): `POST /datanotes/operations/select_rows/`
11
+ - [The rows a link column may point to, for one row: what an agent or a picker offers before writing](https://datanotes.dev/api/operations/list_link_targets/): `POST /datanotes/operations/list_link_targets/`
12
+ - [Find notes by meaning, not exact words: `{query, results: [{path, score, heading, snippet,](https://datanotes.dev/api/operations/semantic_search/): `POST /datanotes/operations/semantic_search/`
13
+ - [Direct neighbours of notes: what they link to (`out`) and what links to them (`in`,](https://datanotes.dev/api/operations/graph_neighbors/): `POST /datanotes/operations/graph_neighbors/`
14
+ - [Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).](https://datanotes.dev/api/operations/graph_traverse/): `POST /datanotes/operations/graph_traverse/`
15
+ - [Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or](https://datanotes.dev/api/operations/graph_path/): `POST /datanotes/operations/graph_path/`
@@ -0,0 +1,16 @@
1
+ # Rows (DML)
2
+
3
+ Operations that write rows: insert, update, merge, delete, move, adopt and batch.
4
+
5
+ ## Operations
6
+
7
+ - [Insert a row (new note). Values are validated against the columns; the note path comes from](https://datanotes.dev/api/operations/insert_row/): `POST /datanotes/operations/insert_row/`
8
+ - [Update every row matching `where` (required: `{}` is every row). `where`: keys AND-ed; values are equality or operators](https://datanotes.dev/api/operations/update_rows/): `POST /datanotes/operations/update_rows/`
9
+ - [Update exactly ONE row, addressed by its `id` (the system UUID) or its `path`; refused when](https://datanotes.dev/api/operations/update_row/): `POST /datanotes/operations/update_row/`
10
+ - [Delete rows matching `where`. `mode`: "archive" (default, move to the table's archive](https://datanotes.dev/api/operations/delete_rows/): `POST /datanotes/operations/delete_rows/`
11
+ - [Move rows matching `where` (required: `{}` is every row) to another table (e.g. split a domain out of `log` into its own](https://datanotes.dev/api/operations/move_rows/): `POST /datanotes/operations/move_rows/`
12
+ - [Turn existing notes (not rows of any table yet) into rows of `table`, keeping their body and](https://datanotes.dev/api/operations/adopt_rows/): `POST /datanotes/operations/adopt_rows/`
13
+ - [Several writes that succeed or fail together. `operations`: `[{"op": ..., ...arguments}]` where](https://datanotes.dev/api/operations/batch/): `POST /datanotes/operations/batch/`
14
+ - [Add the reciprocal links missing on a table's `inverse` link columns (e.g. Alice lists Carol](https://datanotes.dev/api/operations/align_relations/): `POST /datanotes/operations/align_relations/`
15
+ - [MERGE (upsert) `rows` into `table` by the key columns `on` (e.g. `["occurred_at"]` or](https://datanotes.dev/api/operations/merge_rows/): `POST /datanotes/operations/merge_rows/`
16
+ - [Bring generated and identity columns up to date (all rows, or only `paths`), e.g. after](https://datanotes.dev/api/operations/recompute_columns/): `POST /datanotes/operations/recompute_columns/`
@@ -0,0 +1,22 @@
1
+ # Schema (DDL)
2
+
3
+ Operations that define the database: tables, columns, constraints, bases and views.
4
+
5
+ ## Operations
6
+
7
+ - [Create a table: `name`, in `catalog` and `schema` (default: the database's defaults); the definition](https://datanotes.dev/api/operations/create_table/): `POST /datanotes/operations/create_table/`
8
+ - [Drop a table. Refused while it has rows unless `mode: "archive"`, which removes the](https://datanotes.dev/api/operations/drop_table/): `POST /datanotes/operations/drop_table/`
9
+ - [Add a typed column. Sparse by default (written only on rows that have a value — use for](https://datanotes.dev/api/operations/add_column/): `POST /datanotes/operations/add_column/`
10
+ - [Rename a column in metastore.yaml and on every row. Refused if `to_column` is already a column](https://datanotes.dev/api/operations/rename_column/): `POST /datanotes/operations/rename_column/`
11
+ - [Remove a column from the schema and every row. Previous values are journaled; revert with](https://datanotes.dev/api/operations/drop_column/): `POST /datanotes/operations/drop_column/`
12
+ - [Change a column's attributes (type, min/max/step, values, required, default, label,](https://datanotes.dev/api/operations/alter_column/): `POST /datanotes/operations/alter_column/`
13
+ - [Alter a table: move it (`catalog`, `schema`), rename it (`name`), change](https://datanotes.dev/api/operations/alter_table/): `POST /datanotes/operations/alter_table/`
14
+ - [Create or replace a base: a named set of columns (same spec as `create_table`) that tables](https://datanotes.dev/api/operations/define_base/): `POST /datanotes/operations/define_base/`
15
+ - [Set the bases a table inherits from (`bases`, in order; `[]` removes them). Inherited](https://datanotes.dev/api/operations/set_table_bases/): `POST /datanotes/operations/set_table_bases/`
16
+ - [COMMENT ON CATALOG / SCHEMA: set the `description` of a catalog (`catalog` alone) or of one of its](https://datanotes.dev/api/operations/comment_on/): `POST /datanotes/operations/comment_on/`
17
+ - [Rename one value of an enum column (e.g. `high` → `very high`) in metastore.yaml and every](https://datanotes.dev/api/operations/rename_value/): `POST /datanotes/operations/rename_value/`
18
+ - [ALTER TABLE ADD CONSTRAINT `name` CHECK: `check` is a where filter every row must match,](https://datanotes.dev/api/operations/add_constraint/): `POST /datanotes/operations/add_constraint/`
19
+ - [Remove the CHECK constraint `name` from `table`.](https://datanotes.dev/api/operations/drop_constraint/): `POST /datanotes/operations/drop_constraint/`
20
+ - [Create (or `replace`) a view: a named select stored in metastore.yaml. Name it with the prefix](https://datanotes.dev/api/operations/create_view/): `POST /datanotes/operations/create_view/`
21
+ - [Remove a view from `metastore.yaml` (undo with `undo_migration`).](https://datanotes.dev/api/operations/drop_view/): `POST /datanotes/operations/drop_view/`
22
+ - [CREATE TABLE `target` CLONE `source`: same definition plus independent copies of its rows](https://datanotes.dev/api/operations/clone_table/): `POST /datanotes/operations/clone_table/`
@@ -0,0 +1,15 @@
1
+ # service
2
+
3
+ Status, stop, this document, the interactive console, the docs.
4
+
5
+ ## Operations
6
+
7
+ - [The sections of the docs of this version closest in meaning to a query: what `search_docs` fuses with its ranking by words (hybrid search).](https://datanotes.dev/api/operations/semantic_search_docs/): `POST /datanotes/manual/search/`
8
+ - [The engine's health at a glance (owner only; `datanotes status` prints it): engine, database, journal, git sync, change feed, webhooks, named tokens, hand edits breaking the rules in the last 24 h, logs.](https://datanotes.dev/api/operations/engine_status/): `POST /datanotes/status/`
9
+ - [Stop the engine gracefully (owner only; `datanotes stop` calls it): it answers at once, then finishes the requests under way, makes the last git sync and store backup commit and push, releases its lock and exits.](https://datanotes.dev/api/operations/stop_engine/): `POST /datanotes/stop/`
10
+ - [This document (as `GET /datanotes/openapi.json`, with a token).](https://datanotes.dev/api/operations/openapi_post/): `POST /datanotes/openapi/`
11
+ - [Status and version (no token needed; `authenticated` tells whether the token sent is accepted, `auth` whose it is).](https://datanotes.dev/api/operations/status/): `GET /`
12
+ - [This document (public: it describes the API, it holds no data).](https://datanotes.dev/api/operations/openapi/): `GET /datanotes/openapi.json`
13
+ - [This document in an interactive console (Swagger UI, served by the engine; public). Authorize with a token to try the routes.](https://datanotes.dev/api/operations/docs/): `GET /datanotes/docs`
14
+ - [The index of the docs of this version (every page of datanotes.dev as Markdown, shipped with the package): each page with its description and route.](https://datanotes.dev/api/operations/manual_index/): `GET /datanotes/manual/`
15
+ - [A page of the docs of this version as Markdown, or one of its sections with `section`, the anchor of its heading. The same text as the page with `.md` on datanotes.dev, offline.](https://datanotes.dev/api/operations/manual_page/): `GET /datanotes/manual/{page}.md`
@@ -0,0 +1,13 @@
1
+ # tokens
2
+
3
+ Named tokens and their permissions; what MCP servers report about their agents' sessions.
4
+
5
+ ## Operations
6
+
7
+ - [Tell the engine the model and harness behind an agent session (what an MCP server reports): later requests carrying that session in `X-Datanotes-Actor` are journaled with it. Any token may call it.](https://datanotes.dev/api/operations/identify_session/): `POST /datanotes/sessions/identify/`
8
+ - [List the named tokens (owner only).](https://datanotes.dev/api/operations/tokens_list/): `POST /datanotes/tokens/`
9
+ - [The calling token's own entry (a named token; 400 for the owner).](https://datanotes.dev/api/operations/tokens_me/): `POST /datanotes/tokens/me/`
10
+ - [Create a named token (owner only). Returns the token once.](https://datanotes.dev/api/operations/tokens_create/): `POST /datanotes/tokens/create/`
11
+ - [Change a named token. A token may change its own description and autolink default; permissions are the owner's.](https://datanotes.dev/api/operations/tokens_update/): `POST /datanotes/tokens/update/`
12
+ - [Revoke a named token (owner only): it stops working at once.](https://datanotes.dev/api/operations/tokens_delete/): `POST /datanotes/tokens/delete/`
13
+ - [Give a named token a new value (owner only): the old one stops working.](https://datanotes.dev/api/operations/tokens_rotate/): `POST /datanotes/tokens/rotate/`
@@ -0,0 +1,34 @@
1
+ # Create a named token (owner only). Returns the token once.
2
+
3
+ `POST /datanotes/tokens/create/` (operation `tokens_create`)
4
+
5
+ ## Parameters
6
+
7
+ | Name | In | Type | Required | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
10
+
11
+ ## Request body
12
+
13
+ `application/json`
14
+
15
+ | Property | Type | Required | Default | Description |
16
+ | --- | --- | --- | --- | --- |
17
+ | `name` | `string` | yes | | Kebab-case; the journal records it as `auth`. `owner` is reserved. |
18
+ | `description` | `string` | no | | |
19
+ | `write` | `string[]` | no | | Tables the token may write: catalog.schema.table, catalog.schema.*, catalog.* or *. |
20
+ | `ddl` | `boolean` | no | | May the token change the schema? |
21
+ | `maintain` | `boolean` | no | | May the token also undo, restore, vacuum, configure and rebuild the semantic index? (For an agent's own token.) |
22
+ | `autolink` | `boolean` | no | | Automatic links of the token's writes that pass no `autolink`: false for a sync program's token. Absent: the database's `autolink` setting. |
23
+
24
+ ## Responses
25
+
26
+ | Status | Description | Body |
27
+ | --- | --- | --- |
28
+ | 200 | Done. | `object` (application/json) |
29
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
30
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
31
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
32
+ | 500 | Unexpected error. | `Error` (application/json) |
33
+
34
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,29 @@
1
+ # Revoke a named token (owner only): it stops working at once.
2
+
3
+ `POST /datanotes/tokens/delete/` (operation `tokens_delete`)
4
+
5
+ ## Parameters
6
+
7
+ | Name | In | Type | Required | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
10
+
11
+ ## Request body
12
+
13
+ `application/json`
14
+
15
+ | Property | Type | Required | Default | Description |
16
+ | --- | --- | --- | --- | --- |
17
+ | `name` | `string` | yes | | |
18
+
19
+ ## Responses
20
+
21
+ | Status | Description | Body |
22
+ | --- | --- | --- |
23
+ | 200 | Done. | `object` (application/json) |
24
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
25
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
26
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
27
+ | 500 | Unexpected error. | `Error` (application/json) |
28
+
29
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,21 @@
1
+ # List the named tokens (owner only).
2
+
3
+ `POST /datanotes/tokens/` (operation `tokens_list`)
4
+
5
+ ## Request body
6
+
7
+ `application/json`
8
+
9
+ Type: `object`
10
+
11
+ ## Responses
12
+
13
+ | Status | Description | Body |
14
+ | --- | --- | --- |
15
+ | 200 | Done. | `object` (application/json) |
16
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
17
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
18
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
19
+ | 500 | Unexpected error. | `Error` (application/json) |
20
+
21
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,20 @@
1
+ # The calling token's own entry (a named token; 400 for the owner).
2
+
3
+ `POST /datanotes/tokens/me/` (operation `tokens_me`)
4
+
5
+ ## Request body
6
+
7
+ `application/json`
8
+
9
+ Type: `object`
10
+
11
+ ## Responses
12
+
13
+ | Status | Description | Body |
14
+ | --- | --- | --- |
15
+ | 200 | Done. | `object` (application/json) |
16
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
17
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
18
+ | 500 | Unexpected error. | `Error` (application/json) |
19
+
20
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,29 @@
1
+ # Give a named token a new value (owner only): the old one stops working.
2
+
3
+ `POST /datanotes/tokens/rotate/` (operation `tokens_rotate`)
4
+
5
+ ## Parameters
6
+
7
+ | Name | In | Type | Required | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
10
+
11
+ ## Request body
12
+
13
+ `application/json`
14
+
15
+ | Property | Type | Required | Default | Description |
16
+ | --- | --- | --- | --- | --- |
17
+ | `name` | `string` | yes | | |
18
+
19
+ ## Responses
20
+
21
+ | Status | Description | Body |
22
+ | --- | --- | --- |
23
+ | 200 | Done. | `object` (application/json) |
24
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
25
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
26
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
27
+ | 500 | Unexpected error. | `Error` (application/json) |
28
+
29
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,34 @@
1
+ # Change a named token. A token may change its own description and autolink default; permissions are the owner's.
2
+
3
+ `POST /datanotes/tokens/update/` (operation `tokens_update`)
4
+
5
+ ## Parameters
6
+
7
+ | Name | In | Type | Required | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
10
+
11
+ ## Request body
12
+
13
+ `application/json`
14
+
15
+ | Property | Type | Required | Default | Description |
16
+ | --- | --- | --- | --- | --- |
17
+ | `name` | `string` | no | | Owner only (a named token updates itself). |
18
+ | `description` | `string` | no | | An empty string removes it. |
19
+ | `write` | `string[]` | no | | |
20
+ | `ddl` | `boolean` | no | | |
21
+ | `maintain` | `boolean` | no | | |
22
+ | `autolink` | `boolean \| null` | no | | The default of the token's writes for automatic links; null follows the database's setting again. |
23
+
24
+ ## Responses
25
+
26
+ | Status | Description | Body |
27
+ | --- | --- | --- |
28
+ | 200 | Done. | `object` (application/json) |
29
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
30
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
31
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
32
+ | 500 | Unexpected error. | `Error` (application/json) |
33
+
34
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,46 @@
1
+ # Revert a journaled table operation by its `migration_id`. Refused (nothing written) when any
2
+
3
+ `POST /datanotes/operations/undo_migration/` (operation `undo_migration`)
4
+
5
+ Revert a journaled table operation by its `migration_id`. Refused (nothing written) when any
6
+ touched note changed since; the conflicts are listed. Also refused when the revert would leave rows
7
+ breaking a CHECK that follows links or a `ref_where` / `ref_by` (rows it writes, or rows that link to
8
+ them), listed like the refusals of other writes with the way out (fix the row, or drop the rule).
9
+ The rules are those of the schema the revert puts back: undoing a rename_value / rename_column
10
+ puts the old names back with the rows, and a rule the revert puts back must hold on every row.
11
+ A `batch` is checked as a whole first (nothing written when refused), then reverted operation by
12
+ operation, from the last; when one finds a note changed since, those after it stay reverted
13
+ and a retry skips them. An undo is journaled like any operation: undoing it (the
14
+ `migration_id` of its answer; `undoes` names the operation undone) is a redo, whatever the operation (a batch included). The
15
+ revert is a new version (`UNDO`) in the transaction log; undoing a table's rename or move takes
16
+ its whole log back to the old name, the versions made under the new one included.
17
+
18
+ The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
19
+
20
+ ## Parameters
21
+
22
+ | Name | In | Type | Required | Description |
23
+ | --- | --- | --- | --- | --- |
24
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
25
+
26
+ ## Request body
27
+
28
+ `application/json`, required
29
+
30
+ | Property | Type | Required | Default | Description |
31
+ | --- | --- | --- | --- | --- |
32
+ | `migration_id` | `string` | yes | | |
33
+
34
+ ## Responses
35
+
36
+ | Status | Description | Body |
37
+ | --- | --- | --- |
38
+ | 200 | Done. | `object` (application/json) |
39
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
40
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
41
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
42
+ | 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
43
+ | 409 | Undo refused (later changes depend on it, or it was undone already): nothing written (a batch is checked as a whole first; when one of its operations then finds a note changed since, the operations after it stay reverted: `touched`, and a retry skips them). Same body as 200, with `ok: false`. | `object \| AmbiguousName` (application/json) |
44
+ | 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `object \| Error` (application/json) |
45
+
46
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,60 @@
1
+ # Update exactly ONE row, addressed by its `id` (the system UUID) or its `path`; refused when
2
+
3
+ `POST /datanotes/operations/update_row/` (operation `update_row`)
4
+
5
+ Update exactly ONE row, addressed by its `id` (the system UUID) or its `path`; refused when
6
+ the row does not exist (or id and path disagree). Same validation, journal and history as
7
+ `update_rows`.
8
+
9
+ - `set` / `unset`: columns to set or remove.
10
+ - `body`: replace the whole note body; or edit it keeping the rest:
11
+ `body_sections` `{"History": "…"}` replaces the text under that heading (any level, up to the
12
+ next heading of the same level; added as `## History` when missing), `body_prepend` /
13
+ `body_append` add text before / after.
14
+ - `expect`: compare-and-set — `{"status": "open"}` writes only if the row still has those
15
+ values (a person may have changed it since you read it); otherwise refused, nothing written.
16
+ - `autolink`: the text written links the notes it mentions by name, at their first mention
17
+ (off with `autolink: false` or the database's setting). `links_added` lists the links made;
18
+ `ambiguous_mentions` the mentions left as text with the notes they may name: read those, then
19
+ link the right one with update_row and `autolink: false`, or leave the text.
20
+
21
+ ## Parameters
22
+
23
+ | Name | In | Type | Required | Description |
24
+ | --- | --- | --- | --- | --- |
25
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
26
+
27
+ ## Request body
28
+
29
+ `application/json`, required
30
+
31
+ | Property | Type | Required | Default | Description |
32
+ | --- | --- | --- | --- | --- |
33
+ | `table` | `string` | yes | | |
34
+ | `id` | `string \| null` | no | `null` | |
35
+ | `path` | `string \| null` | no | `null` | |
36
+ | `set` | `object \| null` | no | `null` | |
37
+ | `unset` | `string[] \| null` | no | `null` | |
38
+ | `body` | `string \| null` | no | `null` | |
39
+ | `body_sections` | `object \| null` | no | `null` | |
40
+ | `body_prepend` | `string \| null` | no | `null` | |
41
+ | `expect` | `object \| null` | no | `null` | |
42
+ | `body_append` | `string \| null` | no | `null` | |
43
+ | `dry_run` | `boolean` | no | `false` | |
44
+ | `autolink` | `boolean \| null` | no | `null` | Automatic links for this write: true links the notes the text written (`body`, `body_sections`, `body_prepend`, `body_append`) mentions by name, false writes it as given. Default: the calling token's `autolink` default, else the database's `autolink` setting (on unless configure_database turned it off). |
45
+
46
+ ## Responses
47
+
48
+ | Status | Description | Body |
49
+ | --- | --- | --- |
50
+ | 200 | Done. | `OpResult` (application/json) |
51
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
52
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
53
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
54
+ | 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
55
+ | 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
56
+ | 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
57
+ | 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
58
+ | 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
59
+
60
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,46 @@
1
+ # Update every row matching `where` (required: `{}` is every row). `where`: keys AND-ed; values are equality or operators
2
+
3
+ `POST /datanotes/operations/update_rows/` (operation `update_rows`)
4
+
5
+ Update every row matching `where` (required: `{}` is every row). `where`: keys AND-ed; values are equality or operators
6
+ eq, ne, gt, gte, lt, lte, in, contains, icontains (case/accent-insensitive, also inside lists —
7
+ use it for names and aliases), exists, within (a hierarchy link: that row and everything below);
8
+ combine with `or` / `and` / `not` (nestable); `path` is a pseudo-column. A dotted key follows a
9
+ link column: `{"project.area": "[[Work]]"}` matches rows whose `project` links a row with that `area`. `set` sets, `unset`
10
+ removes; all rows are validated first.
11
+ `expect_count`: refuse unless exactly that many match. One row, or its text: update_row.
12
+
13
+ ## Parameters
14
+
15
+ | Name | In | Type | Required | Description |
16
+ | --- | --- | --- | --- | --- |
17
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
18
+
19
+ ## Request body
20
+
21
+ `application/json`, required
22
+
23
+ | Property | Type | Required | Default | Description |
24
+ | --- | --- | --- | --- | --- |
25
+ | `table` | `string` | yes | | |
26
+ | `where` | `object` | yes | | The rows to change; {} is every row of the table. |
27
+ | `set` | `object \| null` | no | `null` | |
28
+ | `unset` | `string[] \| null` | no | `null` | |
29
+ | `dry_run` | `boolean` | no | `false` | |
30
+ | `expect_count` | `integer \| null` | no | `null` | Refuse (nothing written) unless `where` matches exactly this many rows. |
31
+
32
+ ## Responses
33
+
34
+ | Status | Description | Body |
35
+ | --- | --- | --- |
36
+ | 200 | Done. | `OpResult` (application/json) |
37
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
38
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
39
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
40
+ | 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
41
+ | 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
42
+ | 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
43
+ | 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
44
+ | 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
45
+
46
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
@@ -0,0 +1,37 @@
1
+ # Delete transaction-log history older than `retain_from_version` (default: keep only the
2
+
3
+ `POST /datanotes/operations/vacuum_table/` (operation `vacuum_table`)
4
+
5
+ Delete transaction-log history older than `retain_from_version` (default: keep only the
6
+ latest version); time travel before it becomes impossible. Rows are not touched. `dry_run`
7
+ defaults to true: it lists the log files that would go. Only on the user's explicit request.
8
+
9
+ ## Parameters
10
+
11
+ | Name | In | Type | Required | Description |
12
+ | --- | --- | --- | --- | --- |
13
+ | `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
14
+
15
+ ## Request body
16
+
17
+ `application/json`, required
18
+
19
+ | Property | Type | Required | Default | Description |
20
+ | --- | --- | --- | --- | --- |
21
+ | `table` | `string` | yes | | |
22
+ | `retain_from_version` | `integer \| null` | no | `null` | |
23
+ | `dry_run` | `boolean` | no | `true` | |
24
+
25
+ ## Responses
26
+
27
+ | Status | Description | Body |
28
+ | --- | --- | --- |
29
+ | 200 | Done. | `object` (application/json) |
30
+ | 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
31
+ | 401 | Missing or wrong bearer token. | `Error` (application/json) |
32
+ | 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
33
+ | 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
34
+ | 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
35
+ | 500 | Unexpected error. | `Error` (application/json) |
36
+
37
+ The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).