@happyvertical/smrt-chat 0.53.4 → 0.53.6

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/AGENTS.md CHANGED
@@ -149,15 +149,16 @@ Actions: `normalizeDataSurfaceActionRequest` → `AssistantActionClient`
149
149
  `data-surface-bridge.ts` channel). Generated `ChatThread`/`ChatMessage`
150
150
  `list`/`get` are tenant- not member-scoped; the dock never calls them.
151
151
 
152
- **Server routes (#3368).** `./sveltekit` `mountAssistantRoutes({ ai, ... })`
153
- serves the dock from one `[...path]` route; `createAssistantHttpTransport`
154
- and `createAssistantHttpActionClient` (`./svelte`) are its browser half.
155
- Principal from `event.locals` (`user.id`, `user.profileId`, `tenantId`) or
156
- `resolvePrincipal`; threads are served only from the actor's keyed assistant
157
- session room in that tenant (else 404); `allowedTools` is fail-closed;
158
- `ai` is injected, never read from env. `sendMessage`'s `clientRequestId`
159
- makes the row id a UUIDv5 (`clientRequestMessageId`): the PK is the retry
160
- reservation. Details: [`docs/assistant-dock.md`](../../docs/assistant-dock.md).
152
+ **Server routes (#3368).** `./sveltekit` `mountAssistantRoutes()` serves the
153
+ dock from one `[...path]` route; `createAssistantHttp{Transport,ActionClient}`
154
+ (`./svelte`) are its browser half. Principal from `event.locals` or
155
+ `resolvePrincipal`; threads only from the actor's keyed session room in that
156
+ tenant (else 404). `allowedTools` is fail-closed; without `tools` it offers
157
+ those manifest ops (an unprovided name is an error, #3414). `ai` defaults to
158
+ the config `ai` block. Pass `runtime`: a turn never keeps the RLS request tx
159
+ (own `runAsPrincipal` tx). `clientRequestId` makes the row id a UUIDv5
160
+ (`clientRequestMessageId`): the PK is the retry reservation. See
161
+ [docs](../../docs/assistant-dock.md).
161
162
 
162
163
  ## Gotchas
163
164
 
package/README.md CHANGED
@@ -263,12 +263,21 @@ waiting | done | failed | cancelled`), with `pauseRun` / `continueRun`,
263
263
  The server side mounts in one route file. The principal comes from
264
264
  `event.locals` (`@happyvertical/smrt-users/sveltekit`); threads are scoped to
265
265
  the caller's own assistant session in the active tenant; tools are
266
- fail-closed (`allowedTools`, absent means none):
266
+ fail-closed (`allowedTools`, absent means none) and, without `tools`, are the
267
+ manifest operations `allowedTools` names. `ai` defaults to the `smrt.config`
268
+ `ai` block. Pass the application `runtime`: each request then uses its own
269
+ database (`runtime.databaseConfig()`), and under `database-rls` a streamed
270
+ turn, which outlives the request's transaction, runs in a transaction of its
271
+ own for the same principal (`runtime.runAsPrincipal`):
267
272
 
268
273
  ```ts
269
274
  // src/routes/api/assistant/[...path]/+server.ts
270
275
  import { mountAssistantRoutes } from '@happyvertical/smrt-chat/sveltekit';
271
- export const { GET, POST } = mountAssistantRoutes({ ai: assistantAI });
276
+ import { runtime } from '$lib/server/smrt';
277
+ export const { GET, POST } = mountAssistantRoutes({
278
+ allowedTools: ['notes.read', 'notes.create'],
279
+ runtime,
280
+ });
272
281
  ```
273
282
 
274
283
  In the page, `createAssistantHttpTransport({ endpoint: '/api/assistant' })`