Repository navigation
v0.166.0
AI: DatabaseAgentStore, threads in the database (#1063)
New API (minor). Nothing to change in apps. See AI Thread Store.
DatabaseAgentStorefromgemi/aiimplementsAgentStoreover two tables of the app's database (gemi_agent_threads,gemi_agent_messages; Prisma models in the docs, orcreateTable()), on SQLite, Postgres and MySQL 8 / MariaDB 10.6+. It supports regenerate (removeMessages) and compaction summaries withlockSummary.- Extra methods for the app's own thread list:
listThreads({ userId, limit, offset }),getThread(id)anddeleteThread(id).createThread({ userId })stores the user id, and the first user message becomes the thread'stitle. - Opt in by setting
storeon the controller to one instance made at module scope.MemoryAgentStorestays the default.
ORM: describeSchema(), a prompt-ready schema summary, and /// @gemi.sensitive (#1065)
New API (minor). Nothing to change in apps. See ORM → Describing the schema for a prompt.
describeSchema(options?)fromgemi/ormwrites the registered models (or theschemasyou pass) as one line per model: table, columns (database names under@map), keys and relations.describeSchemaModels(options?)returns the same as data. Options:models,exclude(models orModel.field),sensitive(Model.field),sensitiveColumns: "mark" | "omit"./// @gemi.sensitiveon a Prisma field emitssensitive: truein the generated artifact. OnlydescribeSchemareads it; encrypted columns count as sensitive too. The artifact of a schema that doesn't use it is unchanged, and the artifact version is not bumped. Re-runprisma generateafter adding the annotation.
AI: a tool result's model-facing projection, toModel (#1061)
New optional API (minor). Nothing to change in apps. See AI Tool Output for the Model.
- New
toModel(output)onAgentTool.create(server tools): the model reads its value instead of the whole output, while the client,onMessageand the store still getoutput. The value is kept on theokresult as the newmodelOutputfield, computed once when the result is produced (and when a background job settles). - The provider request and compaction summaries send
modelOutputwhen a result has one, andoutputotherwise, as before.
AI: approval previews, who approved a call, and onToolResult (#1060, #1062)
New optional APIs (minor). Nothing to change in apps. See AI Tool Approvals → Showing a preview and → Who approved a call.
- New
approvalPreview(input, ctx)onAgentTool.create(needsrequiresApproval): computes a dry run to show before the user approves. Its value is the pending call's newpreviewfield, on theawaiting-inputframe, inuseChat'spendingand in the storedAgentMessage.pending. Display only: not signed, soexecutere-checks what it relies on. A preview that throws is logged and the call is asked without one. - New
ctx.approval(ToolApprovalRecord:{ approved, at, by, reason? }) on theToolContextof a call that runs because a person approved it.byis the run's subject (runOwner). - The
ToolResultPartof a call a person approved or refused now carries the same record asapproval. Stores that keep the whole message keep it; nothing else changes on results of calls that never asked. - New
onToolResult(result, ctx)hook onAgentControllerand indefineAgentHooks: once per tool result on the run's stream (top-level calls; a background job settling later is not one).
ORM: DB.readOnly, a read-only transaction with SET LOCAL timeouts and role (#1064)
New API (minor). Nothing to change in apps. See ORM → Read-only transactions.
DB.readOnly(options?, fn)andDB.connection(name).readOnly(options?, fn)runfnin a transaction that starts withSET TRANSACTION READ ONLYand theSET LOCALs forstatementTimeoutMs,lockTimeoutMs,idleInTransactionTimeoutMsandrole. It is always rolled back, and returns whatfnreturned. Postgres only; refused inside an open transaction.- New exported type
ReadOnlyOptions.