New syscalls for schema-self describing

This commit is contained in:
Zef Hemel
2026-06-30 10:51:17 +02:00
parent 8c8edab517
commit 9d3642bc72
13 changed files with 721 additions and 225 deletions
+7
View File
@@ -97,6 +97,13 @@ Returns all [[Object/tag]] objects as a query collection.
Example:
${query[[from index.tags() limit 3]]}
# Schema introspection APIs
## index.describeSchema()
Returns a map of tag name → raw JSON Schema for every defined object type / [[Tag]] that declares a schema. Tags without a schema are omitted. Use it to discover what attributes a tag's objects carry before querying them.
## index.tagSchema(tag)
Returns the raw JSON Schema for a single tag, or `nil` if the tag is not defined or has no schema.
# Indexing APIs
## index.markdown(text, pageMeta?)
Ad-hoc indexes `text` (represented as a markdown string) in memory, and returns all objects found there for further query. When no `pageMeta` is supplied dummy (empty) values will be used.
+6
View File
@@ -90,6 +90,12 @@ system.reloadPlugs()
print("All plugs reloaded")
```
### system.reboot()
Makes edited-on-disk state live and resolves only once the client is ready again. Useful for scripts, the `sb` CLI, and external tooling that change space files on disk and need a single "reboot to ready" call.
It mirrors the **System: Reload** command: it saves the currently-open editor buffer first, then flushes any latent on-disk changes into the index queue (via snapshot detection — not a full reindex), waits for indexing to finish, and finally re-applies configuration, scripts, and styles. Because the buffer is saved first, a raw on-disk edit to the *currently-open* page can be overwritten by the in-memory buffer; edit the open page through the editor (or navigate away) rather than on disk if that matters.
### system.wipeClient(logout?)
Completely wipes the client state, including cached files, service worker and databases.