@lobehub/lobehub 2.0.0-next.175 → 2.0.0-next.176

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.
Files changed (30) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +25 -0
  3. package/changelog/v1.json +9 -0
  4. package/docs/development/database-schema.dbml +26 -0
  5. package/next.config.ts +27 -0
  6. package/package.json +3 -1
  7. package/packages/agent-runtime/package.json +4 -1
  8. package/packages/const/package.json +5 -0
  9. package/packages/database/migrations/0065_add_passkey.sql +22 -0
  10. package/packages/database/migrations/0066_add_document_fields.sql +8 -0
  11. package/packages/database/migrations/meta/0065_snapshot.json +9922 -0
  12. package/packages/database/migrations/meta/0066_snapshot.json +9962 -0
  13. package/packages/database/migrations/meta/_journal.json +14 -0
  14. package/packages/database/package.json +15 -0
  15. package/packages/database/src/core/migrations.json +54 -11
  16. package/packages/database/src/repositories/tableViewer/index.test.ts +1 -1
  17. package/packages/database/src/schemas/betterAuth.ts +40 -1
  18. package/packages/database/src/schemas/file.ts +9 -3
  19. package/packages/electron-client-ipc/package.json +3 -0
  20. package/packages/model-bank/package.json +3 -0
  21. package/packages/model-runtime/package.json +18 -1
  22. package/packages/types/package.json +11 -0
  23. package/packages/utils/package.json +24 -2
  24. package/packages/web-crawler/package.json +1 -1
  25. package/public/.well-known/apple-app-site-association +5 -0
  26. package/public/.well-known/assetlinks.json +18 -0
  27. package/src/auth.ts +69 -1
  28. package/src/libs/better-auth/email-templates/index.ts +1 -0
  29. package/src/libs/better-auth/email-templates/verification-otp.ts +106 -0
  30. package/src/libs/better-auth/utils/config.ts +20 -1
package/.eslintrc.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const config = require('@lobehub/lint').eslint;
2
2
 
3
+ config.root = true;
3
4
  config.extends.push('plugin:@next/next/recommended');
4
5
 
5
6
  config.rules['unicorn/no-negated-condition'] = 0;
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.176](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.175...v2.0.0-next.176)
6
+
7
+ <sup>Released on **2025-12-23**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Mobile native better auth support.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Mobile native better auth support, closes [#10871](https://github.com/lobehub/lobe-chat/issues/10871) ([8c42a93](https://github.com/lobehub/lobe-chat/commit/8c42a93))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 2.0.0-next.175](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.174...v2.0.0-next.175)
6
31
 
7
32
  <sup>Released on **2025-12-21**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Mobile native better auth support."
6
+ ]
7
+ },
8
+ "date": "2025-12-23",
9
+ "version": "2.0.0-next.176"
10
+ },
2
11
  {
3
12
  "children": {},
4
13
  "date": "2025-12-21",
@@ -22,6 +22,7 @@ table agents {
22
22
  pinned boolean
23
23
  opening_message text
24
24
  opening_questions text[] [default: `[]`]
25
+ session_group_id text
25
26
  accessed_at "timestamp with time zone" [not null, default: `now()`]
26
27
  created_at "timestamp with time zone" [not null, default: `now()`]
27
28
  updated_at "timestamp with time zone" [not null, default: `now()`]
@@ -32,6 +33,7 @@ table agents {
32
33
  user_id [name: 'agents_user_id_idx']
33
34
  title [name: 'agents_title_idx']
34
35
  description [name: 'agents_description_idx']
36
+ session_group_id [name: 'agents_session_group_id_idx']
35
37
  }
36
38
  }
37
39
 
@@ -170,6 +172,25 @@ table accounts {
170
172
  }
171
173
  }
172
174
 
175
+ table passkey {
176
+ aaguid text
177
+ backedUp boolean
178
+ counter integer
179
+ createdAt timestamp [default: `now()`]
180
+ credentialID text [not null]
181
+ deviceType text
182
+ id text [pk, not null]
183
+ name text
184
+ publicKey text [not null]
185
+ transports text
186
+ userId text [not null]
187
+
188
+ indexes {
189
+ credentialID [name: 'passkey_credential_id_unique', unique]
190
+ userId [name: 'passkey_user_id_idx']
191
+ }
192
+ }
193
+
173
194
  table auth_sessions {
174
195
  created_at timestamp [not null, default: `now()`]
175
196
  expires_at timestamp [not null]
@@ -249,6 +270,7 @@ table chat_groups_agents {
249
270
  table documents {
250
271
  id varchar(255) [pk, not null]
251
272
  title text
273
+ description text
252
274
  content text
253
275
  file_type varchar(255) [not null]
254
276
  filename text
@@ -259,6 +281,7 @@ table documents {
259
281
  source_type text [not null]
260
282
  source text [not null]
261
283
  file_id text
284
+ knowledge_base_id text
262
285
  parent_id varchar(255)
263
286
  user_id text [not null]
264
287
  client_id text
@@ -275,6 +298,7 @@ table documents {
275
298
  user_id [name: 'documents_user_id_idx']
276
299
  file_id [name: 'documents_file_id_idx']
277
300
  parent_id [name: 'documents_parent_id_idx']
301
+ knowledge_base_id [name: 'documents_knowledge_base_id_idx']
278
302
  (client_id, user_id) [name: 'documents_client_id_user_id_unique', unique]
279
303
  (slug, user_id) [name: 'documents_slug_user_id_unique', unique]
280
304
  }
@@ -1266,6 +1290,8 @@ table user_memories_preferences {
1266
1290
 
1267
1291
  ref: accounts.user_id > users.id
1268
1292
 
1293
+ ref: passkey.userId > users.id
1294
+
1269
1295
  ref: auth_sessions.user_id > users.id
1270
1296
 
1271
1297
  ref: two_factor.user_id > users.id
package/next.config.ts CHANGED
@@ -192,6 +192,33 @@ const nextConfig: NextConfig = {
192
192
  ],
193
193
  source: '/apple-touch-icon.png',
194
194
  },
195
+ // Passkey configuration files for iOS and Android
196
+ {
197
+ headers: [
198
+ {
199
+ key: 'Content-Type',
200
+ value: 'application/json',
201
+ },
202
+ {
203
+ key: 'Cache-Control',
204
+ value: 'public, max-age=3600',
205
+ },
206
+ ],
207
+ source: '/.well-known/apple-app-site-association',
208
+ },
209
+ {
210
+ headers: [
211
+ {
212
+ key: 'Content-Type',
213
+ value: 'application/json',
214
+ },
215
+ {
216
+ key: 'Cache-Control',
217
+ value: 'public, max-age=3600',
218
+ },
219
+ ],
220
+ source: '/.well-known/assetlinks.json',
221
+ },
195
222
  ];
196
223
  },
197
224
  logging: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.175",
3
+ "version": "2.0.0-next.176",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -136,6 +136,8 @@
136
136
  "@aws-sdk/s3-request-presigner": "~3.932.0",
137
137
  "@azure-rest/ai-inference": "1.0.0-beta.5",
138
138
  "@azure/core-auth": "^1.10.1",
139
+ "@better-auth/expo": "^1.4.6",
140
+ "@better-auth/passkey": "^1.4.6",
139
141
  "@cfworker/json-schema": "^4.1.1",
140
142
  "@clerk/localizations": "^3.30.1",
141
143
  "@clerk/nextjs": "^6.36.2",
@@ -8,7 +8,10 @@
8
8
  "test": "vitest",
9
9
  "test:coverage": "vitest --coverage --silent='passed-only'"
10
10
  },
11
- "dependencies": {},
11
+ "dependencies": {
12
+ "@lobechat/types": "workspace:*",
13
+ "p-map": "^7.0.4"
14
+ },
12
15
  "devDependencies": {
13
16
  "openai": "^4.104.0"
14
17
  }
@@ -8,6 +8,11 @@
8
8
  },
9
9
  "main": "./src/index.ts",
10
10
  "dependencies": {
11
+ "@icons-pack/react-simple-icons": "^13.8.0",
12
+ "@lobechat/types": "workspace:*",
13
+ "@lobehub/ui": "^2.13.8",
14
+ "klavis": "^2.15.0",
15
+ "lodash-es": "^4.17.21",
11
16
  "model-bank": "workspace:*",
12
17
  "query-string": "^9.3.1",
13
18
  "url-join": "^5.0.0"
@@ -0,0 +1,22 @@
1
+ CREATE TABLE IF NOT EXISTS "passkey" (
2
+ "aaguid" text,
3
+ "backedUp" boolean,
4
+ "counter" integer,
5
+ "createdAt" timestamp DEFAULT now(),
6
+ "credentialID" text NOT NULL,
7
+ "deviceType" text,
8
+ "id" text PRIMARY KEY NOT NULL,
9
+ "name" text,
10
+ "publicKey" text NOT NULL,
11
+ "transports" text,
12
+ "userId" text NOT NULL
13
+ );
14
+ --> statement-breakpoint
15
+ DO $$ BEGIN
16
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'passkey_userId_users_id_fk') THEN
17
+ ALTER TABLE "passkey" ADD CONSTRAINT "passkey_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
18
+ END IF;
19
+ END $$;
20
+ --> statement-breakpoint
21
+ CREATE UNIQUE INDEX IF NOT EXISTS "passkey_credential_id_unique" ON "passkey" USING btree ("credentialID");--> statement-breakpoint
22
+ CREATE INDEX IF NOT EXISTS "passkey_user_id_idx" ON "passkey" USING btree ("userId");
@@ -0,0 +1,8 @@
1
+ ALTER TABLE "documents" ADD COLUMN IF NOT EXISTS "description" text;--> statement-breakpoint
2
+ ALTER TABLE "documents" ADD COLUMN IF NOT EXISTS "knowledge_base_id" text;--> statement-breakpoint
3
+ DO $$ BEGIN
4
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'documents_knowledge_base_id_knowledge_bases_id_fk') THEN
5
+ ALTER TABLE "documents" ADD CONSTRAINT "documents_knowledge_base_id_knowledge_bases_id_fk" FOREIGN KEY ("knowledge_base_id") REFERENCES "public"."knowledge_bases"("id") ON DELETE set null ON UPDATE no action;
6
+ END IF;
7
+ END $$;--> statement-breakpoint
8
+ CREATE INDEX IF NOT EXISTS "documents_knowledge_base_id_idx" ON "documents" USING btree ("knowledge_base_id");