@mindstudio-ai/remy 0.1.333 → 0.1.335

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.
@@ -19,7 +19,7 @@ The dev session gets its own database — a snapshot of the live database at ses
19
19
  - **Truncate** — keep the schema, delete all row data (used by scenarios for a clean canvas)
20
20
  - **Schema sync** — add a field to a table interface and it's immediately available in dev
21
21
 
22
- The dev database is disposable. Experiment freely — there's no risk of breaking anything. Just be considerate that the user may have created their own data (user rows or other data) while testing, and it might be frustrating for them to have it wiped.
22
+ The dev database's data is disposable — reset or truncate it whenever that helps. Just be considerate that the user may have created their own data (user rows or other data) while testing, and it might be frustrating for them to have it wiped. If a schema sync fails, the error names the table and what is out of step between the platform's schema record and the table itself; fix exactly that.
23
23
 
24
24
  ### Debugging
25
25
 
@@ -389,20 +389,14 @@ const [_, newOrder, pending] = await db.batch(
389
389
 
390
390
  ## Migrations
391
391
 
392
- No migration files. Migrations are automatic:
393
- - **New tables** — `CREATE TABLE` applied automatically
394
- - **New columns** — `ALTER TABLE ADD COLUMN` applied automatically
395
- - **Dropped columns** — `ALTER TABLE DROP COLUMN` applied automatically when a column is removed from the interface
396
- - **Dropped tables** — `DROP TABLE` applied automatically when a table file is removed from the manifest
397
- - **Type changes and renames** — not supported in the automatic migration path
398
-
399
- On deploy, the platform:
400
- 1. Parses your table definition files (TypeScript AST — the interface IS the schema)
401
- 2. Diffs against the current live database schema
402
- 3. Generates DDL (`CREATE TABLE`, `ALTER TABLE ADD COLUMN`, `ALTER TABLE DROP COLUMN`, `DROP TABLE`)
403
- 4. Applies to a staging copy of the database
404
- 5. Promotes the staging copy to live
405
-
406
- The TypeScript interface is the single source of truth for the schema. Add a field to the interface, push, and the column exists. No migration files, no CLI commands.
407
-
408
- **In development**, schema changes are synced automatically to the dev database. The dev database is a disposable snapshot — it can be reset to a fresh copy of production data or truncated to empty tables at any time. There's no risk of breaking anything by experimenting with schema changes in dev.
392
+ No migration files. The table's TypeScript interface is the schema, and the platform brings the database to match it:
393
+ - **New tables** — created
394
+ - **New, dropped, or retyped columns, and changed `unique` constraints** — the table is rebuilt: a table with the declared shape is created, every row is copied across, and it replaces the old one in one transaction. New columns arrive empty; dropped columns and their data are gone; a retyped column's values are carried across, converted where SQLite can.
395
+ - **Dropped tables** — dropped when the table file is removed from the manifest
396
+ - **Renames** — not detected; a renamed column or table is a drop plus an add, and its data does not carry over
397
+
398
+ On deploy, the platform parses the table files, diffs against the live schema, applies the changes to a clone of the live database, and promotes the clone. If any change fails, the release fails and the live database is untouched.
399
+
400
+ Add a field to the interface, push, and the column exists. No migration files, no CLI commands.
401
+
402
+ **In development**, schema changes are applied to the dev database automatically, by the same rules. Its data is disposable — it can be reset to a fresh copy of production or truncated to empty tables at any time. If a schema sync fails, the error names the table and what is out of step between the platform's schema record and the table itself; fix exactly that.
@@ -100,6 +100,7 @@ export const Users = db.defineTable<{
100
100
 
101
101
  ### Platform-Managed Column Behavior
102
102
 
103
+ - **`id`** — the platform-assigned managed-user UUID. Omit it on every insert (`Users.push({ email, ... })`) and let it default; never hand-write one (`id: 'analyst-test'`, etc.). A non-UUID id can't map to the platform user record — it silently never syncs and orphans the row. Reference a user by the id returned from `Users.push(...)`, never a made-up string. (This is the trap scenario seeds fall into — see the `scenarios` skill.)
103
104
  - **`email` / `phone` / `apiKey`** — read-only from code. Writing via `update()` or `push()` throws a `MindStudioError`. Use the auth API to change a user's email or phone, and `auth.createApiKey()` / `auth.revokeApiKey()` for API keys.
104
105
  - **`roles`** — read/write from both code and the dashboard. `Users.update(userId, { roles: ['admin'] })` works and syncs to the platform. Dashboard role changes sync back to the table.
105
106
  - All other columns are fully the developer's. When auth creates a user row, only the managed columns (email/phone, roles) are populated. All user-defined columns start as null until the user completes onboarding — type them as optional and guard against null.
@@ -52,11 +52,20 @@ Scenarios live at `dist/methods/.scenarios/` — inside the methods package scop
52
52
  // dist/methods/.scenarios/apOverdueInvoices.ts
53
53
 
54
54
  import { db } from '@mindstudio-ai/agent';
55
+ import { Users } from '../src/tables/users';
55
56
  import { Vendors } from '../src/tables/vendors';
56
57
  import { PurchaseOrders } from '../src/tables/purchase-orders';
57
58
  import { Invoices } from '../src/tables/invoices';
58
59
 
59
60
  export async function apOverdueInvoices() {
61
+ // Seed an app user through the auth-mapped table. Never set `id` — omit it so
62
+ // the platform assigns the UUID that maps this row to its managed user. A
63
+ // hand-written id ('user-requester-1', etc.) can't sync and orphans the row.
64
+ const requester = await Users.push({
65
+ email: 'jordan@example.com',
66
+ roles: ['requester'],
67
+ });
68
+
60
69
  const vendor = await Vendors.push({
61
70
  name: 'Acme Corp',
62
71
  contactEmail: 'billing@acme.com',
@@ -65,7 +74,7 @@ export async function apOverdueInvoices() {
65
74
 
66
75
  const po = await PurchaseOrders.push({
67
76
  vendorId: vendor.id,
68
- requestedBy: 'user-requester-1',
77
+ requestedBy: requester.id,
69
78
  totalAmountCents: 500000,
70
79
  status: 'active',
71
80
  });
@@ -93,7 +102,8 @@ An empty scenario is valid — it exists so you can switch to "clean slate" stat
93
102
 
94
103
  ```typescript
95
104
  export async function emptyRequester() {
96
- // No data — the truncate clears everything.
105
+ // No data — the truncate clears every table (the auth users table aside,
106
+ // whose real accounts are preserved).
97
107
  }
98
108
  ```
99
109
 
@@ -102,7 +112,7 @@ Shared setup code can go in `dist/methods/.scenarios/_helpers/`.
102
112
  ## How Scenarios Run
103
113
 
104
114
  When a scenario runs, the platform:
105
- 1. **Truncates** all tables (deletes all rows, preserves schema - unless skipTruncate is true)
115
+ 1. **Truncates** all tables (deletes all rows, preserves schema - unless skipTruncate is true). The auth-mapped users table is the exception — it's preserved, because its rows are real app accounts mirrored to the platform, so a reseed must never delete them. Seed users additively with `Users.push(...)` (id omitted); they persist across reseeds.
106
116
  2. **Executes** the seed function (your `db.push()` calls populate the clean database)
107
117
  3. **Assigns** the roles from the scenario's `roles` field to the dev test user — a real write to that user's row, so it requires app auth to be enabled
108
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/remy",
3
- "version": "0.1.333",
3
+ "version": "0.1.335",
4
4
  "description": "Remy coding agent",
5
5
  "repository": {
6
6
  "type": "git",