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

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 (31) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.github/workflows/bundle-analyzer.yml +117 -0
  3. package/CHANGELOG.md +50 -0
  4. package/changelog/v1.json +14 -0
  5. package/docs/development/database-schema.dbml +26 -0
  6. package/next.config.ts +27 -0
  7. package/package.json +3 -1
  8. package/packages/agent-runtime/package.json +4 -1
  9. package/packages/const/package.json +5 -0
  10. package/packages/database/migrations/0065_add_passkey.sql +22 -0
  11. package/packages/database/migrations/0066_add_document_fields.sql +8 -0
  12. package/packages/database/migrations/meta/0065_snapshot.json +9922 -0
  13. package/packages/database/migrations/meta/0066_snapshot.json +9962 -0
  14. package/packages/database/migrations/meta/_journal.json +14 -0
  15. package/packages/database/package.json +15 -0
  16. package/packages/database/src/core/migrations.json +54 -11
  17. package/packages/database/src/repositories/tableViewer/index.test.ts +1 -1
  18. package/packages/database/src/schemas/betterAuth.ts +40 -1
  19. package/packages/database/src/schemas/file.ts +9 -3
  20. package/packages/electron-client-ipc/package.json +3 -0
  21. package/packages/model-bank/package.json +3 -0
  22. package/packages/model-runtime/package.json +18 -1
  23. package/packages/types/package.json +11 -0
  24. package/packages/utils/package.json +24 -2
  25. package/packages/web-crawler/package.json +1 -1
  26. package/public/.well-known/apple-app-site-association +5 -0
  27. package/public/.well-known/assetlinks.json +18 -0
  28. package/src/auth.ts +69 -1
  29. package/src/libs/better-auth/email-templates/index.ts +1 -0
  30. package/src/libs/better-auth/email-templates/verification-otp.ts +106 -0
  31. 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;
@@ -0,0 +1,117 @@
1
+ name: Bundle Analyzer
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+ actions: write
9
+
10
+ env:
11
+ NODE_VERSION: 24.11.1
12
+ BUN_VERSION: 1.2.23
13
+
14
+ jobs:
15
+ bundle-analyzer:
16
+ name: Analyze Bundle Size
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v5
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v6
25
+ with:
26
+ node-version: ${{ env.NODE_VERSION }}
27
+
28
+ - name: Setup Bun
29
+ uses: oven-sh/setup-bun@v2
30
+ with:
31
+ bun-version: ${{ env.BUN_VERSION }}
32
+
33
+ - name: Setup pnpm
34
+ uses: pnpm/action-setup@v4
35
+
36
+ - name: Install dependencies
37
+ run: pnpm i
38
+
39
+ - name: Ensure lockfile exists
40
+ run: |
41
+ # Temporarily override .npmrc lockfile=false setting
42
+ # to generate pnpm-lock.yaml for reproducible builds
43
+ if [ ! -f "pnpm-lock.yaml" ]; then
44
+ echo "Generating pnpm-lock.yaml..."
45
+ # Create temporary .npmrc override
46
+ mv .npmrc .npmrc.bak
47
+ echo "lockfile=true" > .npmrc
48
+ cat .npmrc.bak >> .npmrc
49
+ pnpm i
50
+ mv .npmrc.bak .npmrc
51
+ fi
52
+
53
+ - name: Generate build secrets
54
+ id: generate-secret
55
+ run: echo "secret=$(openssl rand -base64 32)" >> $GITHUB_OUTPUT
56
+
57
+ - name: Build with bundle analyzer
58
+ run: bun run build:analyze
59
+ env:
60
+ NODE_OPTIONS: --max-old-space-size=6144
61
+ KEY_VAULTS_SECRET: ${{ steps.generate-secret.outputs.secret }}
62
+ S3_PUBLIC_DOMAIN: https://example.com
63
+ APP_URL: https://example.com
64
+
65
+ - name: Prepare analyzer reports
66
+ run: |
67
+ mkdir -p bundle-report
68
+ # Copy analyzer HTML reports if they exist
69
+ if [ -d ".next/analyze" ]; then
70
+ cp -r .next/analyze/* bundle-report/ || true
71
+ fi
72
+ # Also check if reports are in .vercel/output
73
+ if [ -d ".vercel/output/.next/analyze" ]; then
74
+ cp -r .vercel/output/.next/analyze/* bundle-report/ || true
75
+ fi
76
+ # Include pnpm lockfile for reproducible builds
77
+ if [ -f "pnpm-lock.yaml" ]; then
78
+ cp pnpm-lock.yaml bundle-report/pnpm-lock.yaml
79
+ echo "Copied pnpm-lock.yaml to bundle-report"
80
+ else
81
+ echo "Warning: pnpm-lock.yaml not found"
82
+ fi
83
+ # Create a summary with build metadata
84
+ echo "# Bundle Analysis Report" > bundle-report/README.md
85
+ echo "" >> bundle-report/README.md
86
+ echo "**Build Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> bundle-report/README.md
87
+ echo "**Commit:** ${{ github.sha }}" >> bundle-report/README.md
88
+ echo "**Branch:** ${{ github.ref_name }}" >> bundle-report/README.md
89
+ echo "" >> bundle-report/README.md
90
+ echo "## How to view" >> bundle-report/README.md
91
+ echo "" >> bundle-report/README.md
92
+ echo "1. Download the \`bundle-report\` artifact from this workflow run" >> bundle-report/README.md
93
+ echo "2. Extract the archive" >> bundle-report/README.md
94
+ echo "3. Open \`client.html\` and \`server.html\` in your browser" >> bundle-report/README.md
95
+ echo "" >> bundle-report/README.md
96
+ echo "## Files in this report" >> bundle-report/README.md
97
+ echo "" >> bundle-report/README.md
98
+ echo "- \`client.html\` - Client-side bundle analysis" >> bundle-report/README.md
99
+ echo "- \`server.html\` - Server-side bundle analysis" >> bundle-report/README.md
100
+ echo "- \`pnpm-lock.yaml\` - pnpm lockfile (for reproducible builds)" >> bundle-report/README.md
101
+
102
+ - name: Upload bundle analyzer reports
103
+ uses: actions/upload-artifact@v4
104
+ with:
105
+ name: bundle-report-${{ github.run_id }}
106
+ path: bundle-report/
107
+ retention-days: 30
108
+ if-no-files-found: warn
109
+
110
+ - name: Create summary comment
111
+ run: |
112
+ echo "## Bundle Analysis Complete :chart_with_upwards_trend:" >> $GITHUB_STEP_SUMMARY
113
+ echo "" >> $GITHUB_STEP_SUMMARY
114
+ echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
115
+ echo "- **Artifact:** \`bundle-report-${{ github.run_id }}\`" >> $GITHUB_STEP_SUMMARY
116
+ echo "" >> $GITHUB_STEP_SUMMARY
117
+ echo "Download the artifact to view the detailed bundle analysis reports." >> $GITHUB_STEP_SUMMARY
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.177](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.176...v2.0.0-next.177)
6
+
7
+ <sup>Released on **2025-12-24**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **ci**: Add bundle analyzer workflow.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **ci**: Add bundle analyzer workflow, closes [#10932](https://github.com/lobehub/lobe-chat/issues/10932) ([c470cfb](https://github.com/lobehub/lobe-chat/commit/c470cfb))
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
+
30
+ ## [Version 2.0.0-next.176](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.175...v2.0.0-next.176)
31
+
32
+ <sup>Released on **2025-12-23**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Mobile native better auth support.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **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))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ## [Version 2.0.0-next.175](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.174...v2.0.0-next.175)
6
56
 
7
57
  <sup>Released on **2025-12-21**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "children": {},
4
+ "date": "2025-12-24",
5
+ "version": "2.0.0-next.177"
6
+ },
7
+ {
8
+ "children": {
9
+ "features": [
10
+ "Mobile native better auth support."
11
+ ]
12
+ },
13
+ "date": "2025-12-23",
14
+ "version": "2.0.0-next.176"
15
+ },
2
16
  {
3
17
  "children": {},
4
18
  "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.177",
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");