Changeset 0.29.2 (#197)

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
2026-03-17 22:31:34 +00:00
committed by xcaliber
parent d4de84f3f1
commit 115004a3ab
35 changed files with 2285 additions and 48 deletions

View File

@@ -1,5 +1,114 @@
# Changelog
## [0.29.2] — 2026-03-17
### Summary
DB extensions and server-side tool execution. Starlark packages declare
namespaced database tables via `db_tables` in the manifest — created on
install, dropped on uninstall. A structured Starlark `db` module
(`query/insert/update/delete/view/list_tables`) provides namespaced
access to extension-owned tables and column-allowlisted platform views.
Server-side tool execution wires the `on_tool_call` entry point into the
completion tool loop: extensions declare `tools` in their manifest, the
tool loop dispatches matched calls to the sandbox. Three changesets
(CS0CS3) plus docs (CS4).
### New
- **`db` Starlark module** — structured API for extension-owned tables.
Requires `db.read` permission (query/view/list_tables) or `db.write`
(insert/update/delete). Tables namespaced as `ext_{pkg_slug}_{name}`.
- `db.query(table, filters=None, order=None, limit=100)` → list of dicts
- `db.insert(table, row_dict)` → inserted row dict (auto-generates `id`)
- `db.update(table, id, partial_dict)` → True
- `db.delete(table, id)` → True
- `db.list_tables()` → list of logical table names for this package
- `db.view(view_name, filters=None, limit=100)` → list of dicts
(allowed views: `"users"`, `"channels"`)
- **`db_tables` manifest key** — declare extension-owned tables with
typed columns and indexes. Tables created on install, dropped on
uninstall.
```json
{
"db_tables": {
"logs": {
"columns": {"message": "text", "user_id": "text", "count": "int"},
"indexes": [["user_id"]]
}
}
}
```
Supported column types: `text`, `int`/`integer`, `real`/`float`,
`bool`/`boolean`, `timestamp`. Auto-columns: `id TEXT PRIMARY KEY`,
`created_at` (dialect-correct default). Dialect-correct DDL for both
PG (`TIMESTAMPTZ`, `BOOLEAN`) and SQLite (`TEXT`, `INTEGER`).
- **Platform views** — column-allowlisted read-only views over platform
tables accessible via `db.view(...)`:
- `ext_view_users`: `id`, `display_name`, `email`
- `ext_view_channels`: `id`, `name`, `type`, `team_id`
- **`ext_data_tables` catalog** — tracks logical→physical table mappings
per package. Powers `db.list_tables()` and uninstall cleanup.
- **Server-side tool execution** — starlark extensions declare `tools`
in the manifest. `BuildToolDefs` includes starlark-tier active package
tools alongside server tools. `CoreToolLoop` dispatches matched calls
to `executeExtensionTool` which calls the `on_tool_call` entry point.
```json
{
"tools": [{
"name": "search_logs",
"description": "Search extension log entries",
"parameters": {
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"]
}
}]
}
```
Entry point:
```python
def on_tool_call(call):
# call = {"tool_name": "...", "tool_call_id": "...", "arguments": {...}}
if call["tool_name"] == "search_logs":
rows = db.query("logs", filters={"user_id": call["arguments"]["user_id"]})
return {"results": rows}
return {"error": "unknown tool"}
```
- **`BuildExtToolMap`** — pre-loads `map[toolName]*PackageRegistration`
per request to avoid DB lookup on each tool dispatch.
- **`ExtDataStore`** interface + implementations (`postgres`, `sqlite`) —
`RegisterTable`, `ListTables`, `DeletePackageTables`.
- **`db.read` and `db.write` permissions** — active in this release
(previously listed as "future").
### Changed
- `LoopConfig` gains `Runner *sandbox.Runner` and
`ExtTools map[string]*store.PackageRegistration` for extension tool
dispatch. All callers updated: `streamCompletion`, `syncCompletion`,
multi-model path, `messages.go` regen, scheduler executor.
- `BuildToolDefs` (resolve.go) now includes starlark-tier active package
tools in addition to browser-tier tools.
- `streamWithToolLoop` and `streamModelResponse` accept runner and
extTools parameters.
- `CompletionHandler` gains `SetRunner(r *sandbox.Runner)` and
`buildExtToolMap` helpers.
- `AdminInstallExtension` and `AdminUninstallExtension` call
`CreateExtTables`/`DropExtTables` for schema lifecycle.
- `InstallPackage` and `DeletePackage` (packages.go) call the same
schema lifecycle hooks.
- Migration `016_packages.sql` extended with `ext_data_tables` catalog
table, `idx_ext_data_tables_pkg` index, and `ext_view_users`/
`ext_view_channels` platform views.
- `Runner.SetDB(db, isPostgres)` wires the DB handle for `buildModules`.
`main.go` calls `starlarkRunner.SetDB` at startup.
- Extension permissions table in docs updated: `db.read` and `db.write`
now listed as `v0.29.2` (previously "future").
- Extension tiers in enums.md updated: `starlark` now implemented.
---
## [0.29.1] — 2026-03-17
### Summary