Skip to content

Commit 41e93eb

Browse files
committed
fixes for the slug and more
1 parent 5ff338c commit 41e93eb

23 files changed

Lines changed: 1429 additions & 104 deletions

File tree

packages/dali-memory/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- Profile settings section on /settings page — name/email update form with validation, email uniqueness check, DB update, and session cookie resign on email change
8+
59
### Changed
610

711
- Redesigned all 6 UI pages with glass morphism cards, gradient mesh background, amber/cyan/purple dark theme

packages/dali-memory/README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ dali-memory/
5454
│ │ ├── logout/ # Clears cookie, redirects to /login
5555
│ │ ├── memories/ # Workspace switcher + memory CRUD (create, list, delete)
5656
│ │ ├── workspaces/ # Workspace CRUD with glass cards
57-
│ │ ├── settings/ # Config display + API key management (generate/delete)
57+
│ │ ├── settings/ # Config display + API key management (generate/delete) + profile section (name/email update)
5858
│ │ └── api/mcp/+server.ts # MCP SSE endpoint (GET → SSE stream, POST → JSON-RPC)
5959
│ └── lib/utils/serialization.ts # toPlain() helper
6060
├── vite.config.ts # SvelteKit + Tailwind v4 + SSR external for @woss/dali-orm
@@ -100,7 +100,7 @@ All config via environment variables, validated by Zod.
100100
| models | TABLE | provider_id, model_id, variant (optional), dimensions, created_at. Unique index on (provider_id, model_id). |
101101
| tags | TABLE | name (unique) |
102102
| api_keys | TABLE | key_hash (unique), name, created_at, last_used_at (optional), user_id → users (optional) |
103-
| users | TABLE | email (unique), pass, created_at |
103+
| users | TABLE | email (unique), pass, name, created_at |
104104

105105
### Relations
106106

@@ -200,19 +200,19 @@ SvelteKit with Tailwind v4 + daisyUI, hard-coded dark theme (`data-theme="dark"`
200200

201201
### Pages
202202

203-
| Route | Description |
204-
| ----------- | ---------------------------------------------------------------------------------------------------- |
205-
| / | Home hero with gradient heading glow + 3 stat cards (memories, workspaces, tags) |
206-
| /login | Glass card with email/password form → HMAC-signed cookie, 30-day expiry |
207-
| /register | Glass card with email/password/confirm → CREATE users with crypto::argon2 |
208-
| /logout | Clears dali_session cookie, redirects to /login |
209-
| /memories | Workspace dropdown selector + inline create form + staggered memory glass cards, content dedup |
210-
| /workspaces | Create form + staggered workspace glass cards, link to memories per workspace |
211-
| /settings | Read-only config display + API key management (generate / delete), user_id linkage via session email |
203+
| Route | Description |
204+
| ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
205+
| / | Home hero with gradient heading glow + 3 stat cards (memories, workspaces, tags) |
206+
| /login | Glass card with email/password form → HMAC-signed cookie, 30-day expiry |
207+
| /register | Glass card with name/email/password/confirm → CREATE users with crypto::argon2 + name, auto sign-in on success |
208+
| /logout | Clears dali_session cookie, redirects to /login |
209+
| /memories | Workspace dropdown selector + inline create form + staggered memory glass cards, content dedup |
210+
| /workspaces | Create form + staggered workspace glass cards, link to memories per workspace |
211+
| /settings | Read-only config display + API key management (generate / delete) + profile section (name/email update), user_id linkage via session email |
212212

213213
### Navbar
214214

215-
Fixed-top glass navbar with "dali-memory" brand link, center nav links (Memories, Workspaces, Settings), and mobile hamburger dropdown.
215+
Fixed-top glass navbar with "dali-memory" brand link, center nav links (Memories, Workspaces, Settings), user name (or email fallback) when authenticated, Sign In/Register when not, and mobile hamburger dropdown.
216216

217217
### Auth Flow
218218

@@ -221,8 +221,12 @@ Fixed-top glass navbar with "dali-memory" brand link, center nav links (Memories
221221
3. Reads `dali_session` cookie → HMAC-SHA256 verify → extracts email
222222
4. Constant-time comparison prevents timing attacks
223223
5. On failure: 303 redirect to `/login`
224-
6. Login route validates email+password against `users` table via `crypto::argon2::compare()`
225-
7. Sets signed session cookie (`HMAC(email, secret)`)
224+
6. `+layout.server.ts` loads user name from DB (via `SELECT name FROM users WHERE email = $email`) and passes it to all pages as `data.name`
225+
7. Navbar displays `data.name ?? data.userEmail` — graceful fallback if DB unavailable
226+
8. Login route validates email+password against `users` table via `crypto::argon2::compare()`
227+
9. Sets signed session cookie (`HMAC(email, secret)`)
228+
10. Registration creates user with `name`, `email`, and `pass` fields, then auto-signs in
229+
11. Settings page provides a **Profile** section (auth-gated) to update name/email — validates format, checks email uniqueness, updates DB, and resigns the session cookie on email change
226230

227231
## API Key Auth (MCP)
228232

@@ -241,7 +245,7 @@ Located co-located with their source modules (`.test.ts` suffix or `__tests__/`
241245
| src/hooks.server.test.ts | Auth handle flow — cookie verification, protected routes, public paths, constant-time comparison, tamper detection |
242246
| src/routes/login/**tests**/page.server.test.ts | Login form validation, auth logic |
243247
| src/routes/register/**tests**/page.server.test.ts | Registration validation |
244-
| src/routes/settings/**tests**/page.server.test.ts | API key management |
248+
| src/routes/settings/**tests**/page.server.test.ts | API key management + profile update (name/email validation, uniqueness, cookie resign) |
245249
| src/lib/server/db/**tests**/connection.test.ts | DB connection lifecycle, connect/disconnect, migration |
246250

247251
Run: `pnpm test` (vitest), `pnpm test:integration` (no parallelism, all integration tests)

packages/dali-memory/meta/_journal.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"version": 1,
33
"dialect": "surrealdb",
4-
"id": "a7e81b47ae00",
4+
"id": "98505d2f0f62",
55
"entries": [
66
{
77
"idx": 1,
88
"tag": "init",
9-
"when": "2026-06-28T16:31:50.945874463Z",
9+
"when": "2026-06-29T07:19:17.121340626Z",
1010
"breakpoints": [
1111
true,
1212
true,
@@ -60,6 +60,15 @@
6060
true
6161
],
6262
"hash": "7c6477e807f09ddca461de33570ac108d579a998208af0f1e6d2169432985533"
63+
},
64+
{
65+
"idx": 2,
66+
"tag": "add_user_name",
67+
"when": "2026-06-29T07:39:20.731180336Z",
68+
"breakpoints": [
69+
true
70+
],
71+
"hash": "50fff0150d340a19d336b675993227cc0e0e82133250facae16ff6bf21d2baf9"
6372
}
6473
]
6574
}

packages/dali-memory/migrations/20260628174502_init/migration.surql renamed to packages/dali-memory/migrations/20260629091619_init/migration.surql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Migration: init
2-
-- Version: 20260628174502
2+
-- Version: 20260629091619
33

44
-- UP
55
-- ---- Analyzers ----

packages/dali-memory/migrations/20260628174502_init/snapshot.json renamed to packages/dali-memory/migrations/20260629091619_init/snapshot.json

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "20260628174502",
2+
"version": "20260629091619",
33
"name": "init",
4-
"createdAt": "2026-06-28T15:45:02.092Z",
4+
"createdAt": "2026-06-29T07:16:19.280Z",
55
"tables": [
66
{
77
"name": "workspaces",
@@ -44,7 +44,9 @@
4444
"indexes": [
4545
{
4646
"name": "idx_workspaces_name",
47-
"fields": ["name"],
47+
"fields": [
48+
"name"
49+
],
4850
"type": "unique"
4951
}
5052
]
@@ -53,6 +55,13 @@
5355
{
5456
"name": "memories",
5557
"columns": [
58+
{
59+
"name": "id",
60+
"tableName": "memories",
61+
"config": {
62+
"type": "string"
63+
}
64+
},
5665
{
5766
"name": "name",
5867
"tableName": "memories",
@@ -105,17 +114,25 @@
105114
"indexes": [
106115
{
107116
"name": "idx_memories_name_ws",
108-
"fields": ["name", "workspace_id"],
117+
"fields": [
118+
"name",
119+
"workspace_id"
120+
],
109121
"type": "unique"
110122
},
111123
{
112124
"name": "idx_memories_content_ws",
113-
"fields": ["content", "workspace_id"],
125+
"fields": [
126+
"content",
127+
"workspace_id"
128+
],
114129
"type": "unique"
115130
},
116131
{
117132
"name": "idx_memories_content_ft",
118-
"fields": ["content"],
133+
"fields": [
134+
"content"
135+
],
119136
"type": "fulltext",
120137
"analyzer": "fts_ascii"
121138
}
@@ -207,7 +224,10 @@
207224
"indexes": [
208225
{
209226
"name": "idx_models_provider_model",
210-
"fields": ["provider_id", "model_id"],
227+
"fields": [
228+
"provider_id",
229+
"model_id"
230+
],
211231
"type": "unique"
212232
}
213233
]
@@ -240,7 +260,9 @@
240260
"indexes": [
241261
{
242262
"name": "idx_tags_name",
243-
"fields": ["name"],
263+
"fields": [
264+
"name"
265+
],
244266
"type": "unique"
245267
}
246268
]
@@ -272,7 +294,10 @@
272294
"indexes": [
273295
{
274296
"name": "idx_memory_tags_pair",
275-
"fields": ["in", "out"],
297+
"fields": [
298+
"in",
299+
"out"
300+
],
276301
"type": "unique"
277302
}
278303
]
@@ -326,7 +351,9 @@
326351
"indexes": [
327352
{
328353
"name": "idx_api_keys_hash",
329-
"fields": ["key_hash"],
354+
"fields": [
355+
"key_hash"
356+
],
330357
"type": "unique"
331358
}
332359
]
@@ -364,7 +391,9 @@
364391
"indexes": [
365392
{
366393
"name": "idx_users_email",
367-
"fields": ["email"],
394+
"fields": [
395+
"email"
396+
],
368397
"type": "unique"
369398
}
370399
]
@@ -386,4 +415,4 @@
386415
"filters": "ascii, lowercase"
387416
}
388417
]
389-
}
418+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Migration: add_user_name
2+
-- Version: 20260629092647
3+
4+
-- UP
5+
-- ---- Tables ----
6+
DEFINE FIELD IF NOT EXISTS name ON TABLE users TYPE option<string>;
7+
8+
-- DOWN
9+

0 commit comments

Comments
 (0)