luckytri 1.0.0 → 1.0.1

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 (133) hide show
  1. package/.github/SECURITY.md +4 -4
  2. package/README.en.md +252 -250
  3. package/README.md +252 -250
  4. package/bin/luckytri.js +5 -1
  5. package/docs/en/CHANGELOG.md +8 -0
  6. package/docs/en/connect.md +18 -18
  7. package/docs/en/guide.md +192 -216
  8. package/docs/en/npm-release.md +25 -25
  9. package/docs/zh/CHANGELOG.md +8 -0
  10. package/docs/zh/connect.md +17 -17
  11. package/docs/zh/guide.md +192 -216
  12. package/docs/zh/npm-release.md +33 -33
  13. package/package.json +109 -108
  14. package/plugins/sdk/index.d.ts +155 -155
  15. package/plugins/sdk/testing.js +58 -58
  16. package/plugins/weather/index.js +82 -82
  17. package/plugins/weather/luckytri-plugin.json +29 -29
  18. package/public/app/assets/ChatsPage-B9Odvzfz.js +3 -0
  19. package/public/app/assets/Empty-SkA8PyMo.js +2 -0
  20. package/public/app/assets/Field-BjLhi8pL.js +1 -0
  21. package/public/app/assets/HeartPage-CscKqMsr.js +1 -0
  22. package/public/app/assets/LifePage-BHCmBHlH.js +1 -0
  23. package/public/app/assets/MemoryPage-Bhs2xa1k.js +1 -0
  24. package/public/app/assets/NaturePage-CaPIar_5.js +3 -0
  25. package/public/app/assets/PeoplePage-CuwSSVeX.js +1 -0
  26. package/public/app/assets/PluginsPage-BhVm1SUi.js +2 -0
  27. package/public/app/assets/PluginsPage-CVVQwEBI.css +1 -0
  28. package/public/app/assets/{SystemPage-CAMPoYqM.css → SystemPage-5yYqyUgR.css} +1 -1
  29. package/public/app/assets/SystemPage-Chm5fiGP.js +1 -0
  30. package/public/app/assets/TimePage-BUm4eUzB.js +3 -0
  31. package/public/app/assets/index-BIAdfObg.js +4 -0
  32. package/public/app/assets/{index-YDz1ree1.css → index-DY4e15Kh.css} +1 -1
  33. package/public/app/assets/{knowledge-DG0e0uKw.js → knowledge-DNDLyN9m.js} +1 -1
  34. package/public/app/assets/media-CKVAvML2.js +1 -0
  35. package/public/app/index.html +3 -3
  36. package/public/guide.en.html +32 -99
  37. package/public/guide.html +21 -86
  38. package/public/tutorial.en.md +15 -39
  39. package/public/tutorial.md +15 -39
  40. package/scripts/backup.js +311 -311
  41. package/scripts/browser.js +41 -41
  42. package/scripts/launch.js +101 -94
  43. package/scripts/plugin.js +150 -150
  44. package/scripts/reset-password.js +22 -0
  45. package/scripts/runtime.js +25 -25
  46. package/scripts/service.js +56 -47
  47. package/scripts/setup.js +50 -50
  48. package/scripts/start-server.js +41 -41
  49. package/scripts/stop.js +36 -36
  50. package/server/app.js +110 -96
  51. package/server/auth.js +217 -0
  52. package/server/channels/contract.js +57 -57
  53. package/server/channels/hub.js +165 -165
  54. package/server/channels/index.js +28 -25
  55. package/server/channels/onebot/index.js +335 -336
  56. package/server/channels/onebot/token.js +22 -3
  57. package/server/core/capabilities.js +208 -208
  58. package/server/core/events.js +64 -60
  59. package/server/core/image-preprocessor.js +208 -208
  60. package/server/core/model-manager.js +1213 -1213
  61. package/server/core/net-guard.js +49 -49
  62. package/server/core/orchestrator.js +569 -569
  63. package/server/core/perceivers.js +91 -91
  64. package/server/core/persona-manager.js +243 -243
  65. package/server/core/repository.js +293 -293
  66. package/server/core/response-validator.js +508 -508
  67. package/server/core/turn-processor.js +630 -630
  68. package/server/core/turn.js +236 -236
  69. package/server/core/vision-manager.js +633 -633
  70. package/server/i18n/errors.js +512 -497
  71. package/server/i18n/labels.js +649 -653
  72. package/server/index.js +107 -102
  73. package/server/knowledge/manager.js +386 -386
  74. package/server/local-access.js +32 -0
  75. package/server/mind/anticipations.js +507 -507
  76. package/server/mind/api.js +703 -703
  77. package/server/mind/budget.js +152 -152
  78. package/server/mind/context-selection.js +61 -61
  79. package/server/mind/day-planner.js +324 -324
  80. package/server/mind/evidence.js +148 -148
  81. package/server/mind/index.js +445 -445
  82. package/server/mind/life/diary.js +786 -786
  83. package/server/mind/life/index.js +1049 -1049
  84. package/server/mind/observations.js +84 -84
  85. package/server/mind/own-day.js +324 -324
  86. package/server/mind/own-voice.js +318 -318
  87. package/server/mind/senses.js +53 -53
  88. package/server/mind/time/activity-clock.js +196 -196
  89. package/server/mind/time/availability.js +69 -69
  90. package/server/mind/time/commitment-review.js +198 -198
  91. package/server/mind/time/executor.js +512 -512
  92. package/server/mind/time/experiences.js +128 -128
  93. package/server/mind/time/games.js +562 -562
  94. package/server/mind/time/index.js +739 -739
  95. package/server/mind/time/intent.js +166 -166
  96. package/server/mind/time/kinds.js +171 -171
  97. package/server/mind/time/plugin-activity.js +207 -207
  98. package/server/mind/time/tasks.js +587 -587
  99. package/server/mind/util.js +110 -110
  100. package/server/mind/view.js +273 -273
  101. package/server/paths.js +102 -102
  102. package/server/plugins/api.js +204 -204
  103. package/server/plugins/host.js +967 -967
  104. package/server/plugins/install.js +295 -295
  105. package/server/plugins/manifest.js +201 -201
  106. package/server/plugins/permissions.js +42 -42
  107. package/server/plugins/runner/guard.mjs +36 -36
  108. package/server/plugins/runner/worker.mjs +250 -250
  109. package/server/plugins/schema.js +91 -91
  110. package/server/plugins/zip.js +112 -112
  111. package/server/startup-lock.js +118 -118
  112. package/server/storage/archive.js +241 -241
  113. package/server/storage/backup-cleanup-worker.js +8 -8
  114. package/server/storage/backup-cleanup.js +414 -414
  115. package/server/storage/backup-lock.js +76 -76
  116. package/server/storage/backup-scheduler.js +131 -131
  117. package/server/storage/store.js +199 -199
  118. package/server/studio/readiness.js +181 -190
  119. package/server/studio/settings.js +236 -236
  120. package/public/app/assets/ChatsPage-C-FcRapR.js +0 -3
  121. package/public/app/assets/Empty-CpP5kQHH.js +0 -2
  122. package/public/app/assets/Field-D4gY-INU.js +0 -1
  123. package/public/app/assets/HeartPage-CPy_thQd.js +0 -1
  124. package/public/app/assets/LifePage-CxWvwmSf.js +0 -1
  125. package/public/app/assets/MemoryPage-DC4rhQ68.js +0 -1
  126. package/public/app/assets/NaturePage-IvYw04Zq.js +0 -3
  127. package/public/app/assets/PeoplePage-Cqefm9-q.js +0 -1
  128. package/public/app/assets/PluginsPage-DKSaKvXb.js +0 -2
  129. package/public/app/assets/PluginsPage-HyBe5D8w.css +0 -1
  130. package/public/app/assets/SystemPage-CJmtJkrK.js +0 -1
  131. package/public/app/assets/TimePage-Cw44inM4.js +0 -3
  132. package/public/app/assets/index-BheRW-1t.js +0 -4
  133. package/public/app/assets/media-BzPDBm7e.js +0 -1
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1" />
6
- <title>LuckyTri v1.0.0 · Getting Started</title>
6
+ <title>LuckyTri v1.0.1 · Getting Started</title>
7
7
  <style>
8
8
  * {
9
9
  box-sizing: border-box;
@@ -269,7 +269,7 @@
269
269
  <body>
270
270
  <header>
271
271
  <div>
272
- <b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.0</small>
272
+ <b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.1</small>
273
273
  </div>
274
274
  <nav>
275
275
  <a href="/#setup">Back to the studio</a
@@ -281,7 +281,8 @@
281
281
  <div class="layout">
282
282
  <nav class="toc" aria-label="Guide contents">
283
283
  <p>CONTENTS</p>
284
- <a href="#step-1">1. Start</a><a href="#step-2">2. Local tokens</a
284
+ <a href="#step-1">1. Start</a
285
+ ><a href="#step-2">2. Set your management password</a
285
286
  ><a href="#step-3">3. Try it in simulation mode first</a
286
287
  ><a href="#step-4">4. Connect a model</a
287
288
  ><a href="#step-5">5. Connect QQ</a
@@ -320,17 +321,11 @@ luckytri
320
321
  WebUI. The experimental-SQLite notice does not mean the start failed.
321
322
  </p>
322
323
  <p>
323
- Use <code>luckytri paths</code> to find <code>.env</code>, open it in
324
- a local editor and enter <code>ADMIN_TOKEN</code> in the studio.
325
- <code>luckytri --no-browser</code> launches without opening a browser,
326
- <code>luckytri start</code> runs in the foreground, and
327
- <code>luckytri stop</code> stops the service. Update with
328
- <code>luckytri stop</code>,
329
- <code>npm install -g luckytri@latest</code>, then
330
- <code>luckytri</code>. Your configuration and data stay intact.
331
- Default directories are listed in the
332
- <a href="../../README.en.md#configuration-data-and-privacy">README</a
333
- >.
324
+ Set a password in the studio on your first visit. Use
325
+ <code>luckytri --no-browser</code>, <code>luckytri start</code> and
326
+ <code>luckytri stop</code> for background, foreground and stop. Update
327
+ with stop, <code>npm install -g luckytri@latest</code>, then launch;
328
+ password, configuration and data stay intact.
334
329
  </p>
335
330
  <p>
336
331
  For source development, run <code>npm install</code>,
@@ -451,80 +446,17 @@ luckytri
451
446
  mind. On a phone the navigation sits at the bottom and the other
452
447
  entries are under &quot;More&quot;.
453
448
  </p>
454
- <h2 id="step-2">2. Local tokens</h2>
449
+ <h2 id="step-2">2. Set your management password</h2>
455
450
  <p>
456
- Configuration is created on first launch. You can also initialize in
457
- advance:
451
+ On the first visit, choose and confirm a password of at least 8
452
+ characters. Use it to sign in later; no environment-file token is
453
+ needed. Browser sessions are remembered, and updates or reinstalls
454
+ preserve the password.
458
455
  </p>
459
- <pre><code class="language-powershell">luckytri setup
460
- luckytri paths
461
- </code></pre>
462
- <p>
463
- When there is no <code>.env</code>, setup writes an admin token and an
464
- OneBot connection token. An existing <code>.env</code> is kept as it
465
- is.
466
- </p>
467
- <pre><code class="language-dotenv">HOST=127.0.0.1
468
- PORT=3210
469
- ADMIN_TOKEN=
470
- ONEBOT_TOKEN=
471
- LLM_API_KEY=
472
- </code></pre>
473
- <table>
474
- <thead>
475
- <tr>
476
- <th>Field</th>
477
- <th>Purpose</th>
478
- </tr>
479
- </thead>
480
- <tbody>
481
- <tr>
482
- <td><code>ADMIN_TOKEN</code></td>
483
- <td>
484
- Opens LuckyTri and calls the HTTP API; the stop command uses it
485
- too
486
- </td>
487
- </tr>
488
- <tr>
489
- <td><code>ONEBOT_TOKEN</code></td>
490
- <td>
491
- The OneBot 11 connector uses it for
492
- <code>/onebot/v11/ws</code> (only needed for OneBot)
493
- </td>
494
- </tr>
495
- <tr>
496
- <td><code>LLM_API_KEY</code></td>
497
- <td>
498
- Optional; when set it takes precedence over the model key saved
499
- in LuckyTri
500
- </td>
501
- </tr>
502
- <tr>
503
- <td><code>LUCKYTRI_CHANNEL</code></td>
504
- <td>
505
- Optional; <code>onebot</code> or <code>qqbot</code>. When set,
506
- the connection method cannot be changed in the interface
507
- </td>
508
- </tr>
509
- <tr>
510
- <td><code>QQBOT_APP_ID</code> / <code>QQBOT_APP_SECRET</code></td>
511
- <td>
512
- Optional; credentials of the QQ official bot, they take
513
- precedence over what is saved in the interface
514
- </td>
515
- </tr>
516
- <tr>
517
- <td><code>HOST</code> / <code>PORT</code></td>
518
- <td>Listen address and port; keep the defaults for local use</td>
519
- </tr>
520
- </tbody>
521
- </table>
522
456
  <p>
523
- The first time the page loads data it asks for
524
- <code>ADMIN_TOKEN</code>. The token stays in the current tab only.
525
- Restart after changing <code>.env</code>. Never give
526
- <code>ADMIN_TOKEN</code> to the QQ connector, and do not treat
527
- <code>ONEBOT_TOKEN</code> as the studio password.
457
+ Change the password or sign out under System → Run switches. Only a
458
+ salted verification digest is stored. Existing environment
459
+ configuration and model keys remain intact.
528
460
  </p>
529
461
  <h2 id="step-3">3. Try it in simulation mode first</h2>
530
462
  <p>Simulation mode is on by default, so nothing is sent to QQ.</p>
@@ -632,8 +564,8 @@ LLM_API_KEY=
632
564
  </p>
633
565
  <ol>
634
566
  <li>
635
- Set <code>ONEBOT_TOKEN</code> in the local <code>.env</code> and
636
- restart LuckyTri.
567
+ Local clients need no separate token. Keep an existing client
568
+ address and QQ sign-in.
637
569
  </li>
638
570
  <li>
639
571
  In the connector&#39;s own network settings add an OneBot 11 reverse
@@ -658,7 +590,10 @@ LLM_API_KEY=
658
590
  </tr>
659
591
  <tr>
660
592
  <td>Token</td>
661
- <td><code>ONEBOT_TOKEN</code> from <code>.env</code></td>
593
+ <td>
594
+ Not needed locally; remote clients can use the management
595
+ password or an existing token
596
+ </td>
662
597
  </tr>
663
598
  <tr>
664
599
  <td>Message format</td>
@@ -677,11 +612,9 @@ LLM_API_KEY=
677
612
  </li>
678
613
  </ol>
679
614
  <p>
680
- <code>3210</code> is LuckyTri&#39;s port. When the connector and
681
- LuckyTri are on different machines or in containers,
682
- <code>127.0.0.1</code> points at each own environment: replace it with
683
- LuckyTri&#39;s real address and configure
684
- <code>ADMIN_TOKEN</code> first.
615
+ In a container or another computer, localhost refers to that
616
+ environment. Use the reachable LuckyTri address for remote access, set
617
+ the password locally first, and use HTTPS for remote studio access.
685
618
  </p>
686
619
  <h3>Option two: QQ official bot</h3>
687
620
  <p>
@@ -949,17 +882,17 @@ npm start
949
882
  </td>
950
883
  </tr>
951
884
  <tr>
952
- <td>Wrong token</td>
885
+ <td>Incorrect password</td>
953
886
  <td>
954
- Use <code>ADMIN_TOKEN</code>; restart after editing
955
- <code>.env</code>
887
+ Sign in with your management password; change it under System →
888
+ Run switches
956
889
  </td>
957
890
  </tr>
958
891
  <tr>
959
892
  <td>OneBot not connected</td>
960
893
  <td>
961
- Is the connector logged in; do the URL, port, path and
962
- <code>ONEBOT_TOKEN</code> all match
894
+ Check sign-in, enabled reverse client, address, port and path;
895
+ local clients need no token
963
896
  </td>
964
897
  </tr>
965
898
  <tr>
@@ -1047,7 +980,7 @@ npm start
1047
980
  </div>
1048
981
  <footer>
1049
982
  LuckyTri · so that experience and choice stay coherent. This guide matches
1050
- the v1.0.0 interface.
983
+ the v1.0.1 interface.
1051
984
  </footer>
1052
985
  </body>
1053
986
  </html>
package/public/guide.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1" />
6
- <title>LuckyTri v1.0.0 · 使用教程</title>
6
+ <title>LuckyTri v1.0.1 · 使用教程</title>
7
7
  <style>
8
8
  * {
9
9
  box-sizing: border-box;
@@ -269,7 +269,7 @@
269
269
  <body>
270
270
  <header>
271
271
  <div>
272
- <b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.0</small>
272
+ <b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.1</small>
273
273
  </div>
274
274
  <nav>
275
275
  <a href="/#setup">返回管理台</a
@@ -283,7 +283,7 @@
283
283
  <div class="layout">
284
284
  <nav class="toc" aria-label="教程目录">
285
285
  <p>CONTENTS</p>
286
- <a href="#step-1">1. 启动</a><a href="#step-2">2. 本机令牌</a
286
+ <a href="#step-1">1. 启动</a><a href="#step-2">2. 设置管理密码</a
287
287
  ><a href="#step-3">3. 先在模拟模式试聊</a
288
288
  ><a href="#step-4">4. 连接模型</a><a href="#step-5">5. 连接 QQ</a
289
289
  ><a href="#step-6">6. 让 TA 参与会话</a
@@ -315,21 +315,13 @@ luckytri
315
315
  实验性提示不表示启动失败,以能否打开 LuckyTri 为准。
316
316
  </p>
317
317
  <p>
318
- 运行 <code>luckytri paths</code> 查看本机
319
- <code>.env</code>,在本机编辑器中取得
320
- <code>ADMIN_TOKEN</code> 并填入管理台。<code
321
- >luckytri --no-browser</code
322
- >
318
+ 首次进入管理台时设置一个密码即可。<code>luckytri --no-browser</code>
323
319
  只后台启动,<code>luckytri start</code> 前台运行,<code
324
320
  >luckytri stop</code
325
321
  >
326
322
  停止服务。更新使用 <code>luckytri stop</code> →
327
323
  <code>npm install -g luckytri@latest</code> →
328
- <code>luckytri</code>,配置与数据会保留;默认目录见
329
- <a
330
- href="../../README.md#%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E4%B8%8E%E9%9A%90%E7%A7%81"
331
- >README</a
332
- >。
324
+ <code>luckytri</code>,密码、配置与数据会保留。
333
325
  </p>
334
326
  <p>
335
327
  从源码开发时,在仓库中执行 <code>npm install</code>、<code
@@ -430,66 +422,16 @@ luckytri
430
422
  戳一下会回应一句,按住是摸摸头,双击或点「聊聊」打开试聊;这些只是界面动画,不会改变
431
423
  TA 的心智。手机上导航在底部,其余入口在「更多」里。
432
424
  </p>
433
- <h2 id="step-2">2. 本机令牌</h2>
434
- <p>首次启动已生成配置;也可以提前初始化:</p>
435
- <pre><code class="language-powershell">luckytri setup
436
- luckytri paths
437
- </code></pre>
425
+ <h2 id="step-2">2. 设置管理密码</h2>
438
426
  <p>
439
- 没有 <code>.env</code> 时,setup 会写入管理令牌和 OneBot
440
- 连接令牌。已有 <code>.env</code> 会原样保留。
427
+ 首次打开管理台时设置一个至少 8
428
+ 个字符的密码,确认后进入。以后用同一个密码登录,不需要打开
429
+ <code>.env</code>
430
+ 查找管理令牌。浏览器登录状态会保留;更新和重装不会重置密码。
441
431
  </p>
442
- <pre><code class="language-dotenv">HOST=127.0.0.1
443
- PORT=3210
444
- ADMIN_TOKEN=
445
- ONEBOT_TOKEN=
446
- LLM_API_KEY=
447
- </code></pre>
448
- <table>
449
- <thead>
450
- <tr>
451
- <th>字段</th>
452
- <th>用途</th>
453
- </tr>
454
- </thead>
455
- <tbody>
456
- <tr>
457
- <td><code>ADMIN_TOKEN</code></td>
458
- <td>打开 LuckyTri 和调用 HTTP API;停止命令也会使用</td>
459
- </tr>
460
- <tr>
461
- <td><code>ONEBOT_TOKEN</code></td>
462
- <td>
463
- OneBot 11 接入端连接 <code>/onebot/v11/ws</code>(只用 OneBot
464
- 方式时需要)
465
- </td>
466
- </tr>
467
- <tr>
468
- <td><code>LLM_API_KEY</code></td>
469
- <td>可选;非空时优先于 LuckyTri 里保存的模型密钥</td>
470
- </tr>
471
- <tr>
472
- <td><code>LUCKYTRI_CHANNEL</code></td>
473
- <td>
474
- 可选;<code>onebot</code> 或
475
- <code>qqbot</code>。设置后在界面里不能更改连接方式
476
- </td>
477
- </tr>
478
- <tr>
479
- <td><code>QQBOT_APP_ID</code> / <code>QQBOT_APP_SECRET</code></td>
480
- <td>可选;QQ 官方机器人的凭据,优先于界面里保存的</td>
481
- </tr>
482
- <tr>
483
- <td><code>HOST</code> / <code>PORT</code></td>
484
- <td>监听地址和端口;本机使用保持默认</td>
485
- </tr>
486
- </tbody>
487
- </table>
488
432
  <p>
489
- 页面第一次取数据时会弹出窗口要求输入
490
- <code>ADMIN_TOKEN</code>。令牌只留在当前标签页。修改
491
- <code>.env</code> 后必须重启。不要把 <code>ADMIN_TOKEN</code> 填给 QQ
492
- 接入端,也不要把 <code>ONEBOT_TOKEN</code> 当成管理台密码。
433
+ 在「系统 →
434
+ 运行开关」可以修改密码或退出登录。密码只以加盐校验摘要保存,现有环境配置和模型密钥保留。
493
435
  </p>
494
436
  <h2 id="step-3">3. 先在模拟模式试聊</h2>
495
437
  <p>默认开启模拟模式,消息不会发到 QQ。</p>
@@ -571,10 +513,7 @@ LLM_API_KEY=
571
513
  接口,接入端需要你自行准备和管理。
572
514
  </p>
573
515
  <ol>
574
- <li>
575
- 在本机 <code>.env</code> 中设置
576
- <code>ONEBOT_TOKEN</code>,修改后重启 LuckyTri。
577
- </li>
516
+ <li>本机连接无需单独令牌,保留已有的接入地址和 QQ 登录。</li>
578
517
  <li>
579
518
  在接入端自己的网络设置里添加 OneBot 11 反向 WebSocket 客户端:
580
519
  </li>
@@ -597,7 +536,7 @@ LLM_API_KEY=
597
536
  </tr>
598
537
  <tr>
599
538
  <td>Token</td>
600
- <td><code>.env</code> 里的 <code>ONEBOT_TOKEN</code></td>
539
+ <td>本机无需填写;远程可使用管理密码,旧远程令牌仍兼容</td>
601
540
  </tr>
602
541
  <tr>
603
542
  <td>消息格式</td>
@@ -616,10 +555,9 @@ LLM_API_KEY=
616
555
  </li>
617
556
  </ol>
618
557
  <p>
619
- 这里的 <code>3210</code> 是 LuckyTri 的端口。接入端和 LuckyTri
620
- 不在同一台机器或放在容器里时,<code>127.0.0.1</code>
621
- 指向各自环境,需要改成 LuckyTri 的实际地址,并先配置
622
- <code>ADMIN_TOKEN</code>。
558
+ 容器或另一台电脑中的 <code>127.0.0.1</code> 指向自身。远程接入使用
559
+ LuckyTri 的可达地址,并先在本机设置管理密码;对外提供管理台时使用
560
+ HTTPS。
623
561
  </p>
624
562
  <h3>方式二:QQ 官方机器人</h3>
625
563
  <p>
@@ -811,16 +749,13 @@ npm start
811
749
  <td>先 <code>npm run stop</code>,不要结束所有 node 进程</td>
812
750
  </tr>
813
751
  <tr>
814
- <td>令牌错误</td>
815
- <td>
816
- 使用 <code>ADMIN_TOKEN</code>;改 <code>.env</code> 后重启
817
- </td>
752
+ <td>密码错误</td>
753
+ <td>使用首次设置的管理密码;可在系统运行开关中修改</td>
818
754
  </tr>
819
755
  <tr>
820
756
  <td>OneBot 未连接</td>
821
757
  <td>
822
- 接入端是否登录,URL、端口、路径和
823
- <code>ONEBOT_TOKEN</code> 是否一致
758
+ 确认接入端已登录、反向客户端启用、地址端口路径一致;本机无需额外令牌
824
759
  </td>
825
760
  </tr>
826
761
  <tr>
@@ -888,6 +823,6 @@ npm start
888
823
  <p>不要把 API 密钥、<code>.env</code> 或私聊原文发到公开位置。</p>
889
824
  </article>
890
825
  </div>
891
- <footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.0 界面同步。</footer>
826
+ <footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.1 界面同步。</footer>
892
827
  </body>
893
828
  </html>
@@ -16,7 +16,7 @@ luckytri
16
16
 
17
17
  LuckyTri starts in the background and opens <http://127.0.0.1:3210>, creating local configuration on the first run. The package includes the built WebUI. The experimental-SQLite notice does not mean the start failed.
18
18
 
19
- Use `luckytri paths` to find `.env`, open it in a local editor and enter `ADMIN_TOKEN` in the studio. `luckytri --no-browser` launches without opening a browser, `luckytri start` runs in the foreground, and `luckytri stop` stops the service. Update with `luckytri stop`, `npm install -g luckytri@latest`, then `luckytri`. Your configuration and data stay intact. Default directories are listed in the [README](../../README.en.md#configuration-data-and-privacy).
19
+ Set a password in the studio on your first visit. Use `luckytri --no-browser`, `luckytri start` and `luckytri stop` for background, foreground and stop. Update with stop, `npm install -g luckytri@latest`, then launch; password, configuration and data stay intact.
20
20
 
21
21
  For source development, run `npm install`, `npm run setup`, `npm run build` and `npm start` in the checkout. Later examples using `npm run setup/stop/backup/recovery/plugin` apply to source checkouts; global users use the corresponding `luckytri setup/stop/backup/recovery/plugin` commands.
22
22
 
@@ -39,35 +39,11 @@ LuckyTri is "TA's little world". The left navigation has three groups and ten en
39
39
 
40
40
  The colors, sky and motion follow TA's mood and rhythm: warm when she is happy, grey-blue when she is low, night once she is asleep. At the bottom left you can pin one theme or turn on "Reduce motion". The small TA at the bottom right answers a poke, a long press is a head-pat, and a double click or "Chat" opens the trial chat. These are interface animations only and never change her mind. On a phone the navigation sits at the bottom and the other entries are under "More".
41
41
 
42
- ## 2. Local tokens
42
+ ## 2. Set your management password
43
43
 
44
- Configuration is created on first launch. You can also initialize in advance:
44
+ On the first visit, choose and confirm a password of at least 8 characters. Use it to sign in later; no environment-file token is needed. Browser sessions are remembered, and updates or reinstalls preserve the password.
45
45
 
46
- ```powershell
47
- luckytri setup
48
- luckytri paths
49
- ```
50
-
51
- When there is no `.env`, setup writes an admin token and an OneBot connection token. An existing `.env` is kept as it is.
52
-
53
- ```dotenv
54
- HOST=127.0.0.1
55
- PORT=3210
56
- ADMIN_TOKEN=
57
- ONEBOT_TOKEN=
58
- LLM_API_KEY=
59
- ```
60
-
61
- | Field | Purpose |
62
- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
63
- | `ADMIN_TOKEN` | Opens LuckyTri and calls the HTTP API; the stop command uses it too |
64
- | `ONEBOT_TOKEN` | The OneBot 11 connector uses it for `/onebot/v11/ws` (only needed for OneBot) |
65
- | `LLM_API_KEY` | Optional; when set it takes precedence over the model key saved in LuckyTri |
66
- | `LUCKYTRI_CHANNEL` | Optional; `onebot` or `qqbot`. When set, the connection method cannot be changed in the interface |
67
- | `QQBOT_APP_ID` / `QQBOT_APP_SECRET` | Optional; credentials of the QQ official bot, they take precedence over what is saved in the interface |
68
- | `HOST` / `PORT` | Listen address and port; keep the defaults for local use |
69
-
70
- The first time the page loads data it asks for `ADMIN_TOKEN`. The token stays in the current tab only. Restart after changing `.env`. Never give `ADMIN_TOKEN` to the QQ connector, and do not treat `ONEBOT_TOKEN` as the studio password.
46
+ Change the password or sign out under System → Run switches. Only a salted verification digest is stored. Existing environment configuration and model keys remain intact.
71
47
 
72
48
  ## 3. Try it in simulation mode first
73
49
 
@@ -111,20 +87,20 @@ Open "System → Connect QQ". There are two options at the top: **OneBot 11** an
111
87
 
112
88
  LuckyTri only implements the reverse-WebSocket side of OneBot 11. You prepare and manage the connector yourself.
113
89
 
114
- 1. Set `ONEBOT_TOKEN` in the local `.env` and restart LuckyTri.
90
+ 1. Local clients need no separate token. Keep an existing client address and QQ sign-in.
115
91
  2. In the connector's own network settings add an OneBot 11 reverse WebSocket client:
116
92
 
117
- | Item | Value on this machine |
118
- | -------------- | ----------------------------------- |
119
- | Protocol | OneBot 11 |
120
- | WebSocket URL | `ws://127.0.0.1:3210/onebot/v11/ws` |
121
- | Token | `ONEBOT_TOKEN` from `.env` |
122
- | Message format | array |
123
- | Enabled | on, then save |
93
+ | Item | Value on this machine |
94
+ | -------------- | --------------------------------------------------------------------------------------- |
95
+ | Protocol | OneBot 11 |
96
+ | WebSocket URL | `ws://127.0.0.1:3210/onebot/v11/ws` |
97
+ | Token | Not needed locally; remote clients can use the management password or an existing token |
98
+ | Message format | array |
99
+ | Enabled | on, then save |
124
100
 
125
101
  3. Log in to QQ in the connector. The account must already be in the target group; LuckyTri does not store QQ passwords.
126
102
 
127
- `3210` is LuckyTri's port. When the connector and LuckyTri are on different machines or in containers, `127.0.0.1` points at each own environment: replace it with LuckyTri's real address and configure `ADMIN_TOKEN` first.
103
+ In a container or another computer, localhost refers to that environment. Use the reachable LuckyTri address for remote access, set the password locally first, and use HTTPS for remote studio access.
128
104
 
129
105
  ### Option two: QQ official bot
130
106
 
@@ -198,8 +174,8 @@ To restore, stop the service, move the current `data/friend.db` and its `-wal` a
198
174
  | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
199
175
  | The page does not open | Is Node running, and is the address `127.0.0.1:3210` |
200
176
  | Port already in use | Run `npm run stop` first; do not kill every node process |
201
- | Wrong token | Use `ADMIN_TOKEN`; restart after editing `.env` |
202
- | OneBot not connected | Is the connector logged in; do the URL, port, path and `ONEBOT_TOKEN` all match |
177
+ | Incorrect password | Sign in with your management password; change it under System → Run switches |
178
+ | OneBot not connected | Check sign-in, enabled reverse client, address, port and path; local clients need no token |
203
179
  | Official bot not connected | Are the AppID and AppSecret right, are group and one-to-one messages enabled for the bot, can the network reach the QQ Open Platform |
204
180
  | Official bot only gets @ messages | Enable "receive all messages" on the Open Platform; this is a platform permission, not a LuckyTri limit |
205
181
  | Connected but no sessions | Send one more new message in QQ; with OneBot also check the message format is array |
@@ -16,7 +16,7 @@ luckytri
16
16
 
17
17
  LuckyTri 在后台启动并打开 <http://127.0.0.1:3210>,首次运行自动生成配置。无需下载仓库或构建 WebUI。终端里的 SQLite 实验性提示不表示启动失败,以能否打开 LuckyTri 为准。
18
18
 
19
- 运行 `luckytri paths` 查看本机 `.env`,在本机编辑器中取得 `ADMIN_TOKEN` 并填入管理台。`luckytri --no-browser` 只后台启动,`luckytri start` 前台运行,`luckytri stop` 停止服务。更新使用 `luckytri stop` → `npm install -g luckytri@latest` → `luckytri`,配置与数据会保留;默认目录见 [README](../../README.md#配置数据与隐私)。
19
+ 首次进入管理台时设置一个密码即可。`luckytri --no-browser` 只后台启动,`luckytri start` 前台运行,`luckytri stop` 停止服务。更新使用 `luckytri stop` → `npm install -g luckytri@latest` → `luckytri`,密码、配置与数据会保留。
20
20
 
21
21
  从源码开发时,在仓库中执行 `npm install`、`npm run setup`、`npm run build`、`npm start`。下文的 `npm run setup/stop/backup/recovery/plugin` 面向源码用户;全局用户使用对应的 `luckytri setup/stop/backup/recovery/plugin`。
22
22
 
@@ -39,35 +39,11 @@ LuckyTri 是「TA 的小世界」,左侧导航分三组、十个入口:
39
39
 
40
40
  界面的颜色、天空和动效跟着 TA 的心情与作息变化:开心时暖、低落时灰蓝、睡着后变成夜晚。左下角可以把主题固定成某一种,也可以「减少动画」。右下角的小 TA 戳一下会回应一句,按住是摸摸头,双击或点「聊聊」打开试聊;这些只是界面动画,不会改变 TA 的心智。手机上导航在底部,其余入口在「更多」里。
41
41
 
42
- ## 2. 本机令牌
42
+ ## 2. 设置管理密码
43
43
 
44
- 首次启动已生成配置;也可以提前初始化:
44
+ 首次打开管理台时设置一个至少 8 个字符的密码,确认后进入。以后用同一个密码登录,不需要打开 `.env` 查找管理令牌。浏览器登录状态会保留;更新和重装不会重置密码。
45
45
 
46
- ```powershell
47
- luckytri setup
48
- luckytri paths
49
- ```
50
-
51
- 没有 `.env` 时,setup 会写入管理令牌和 OneBot 连接令牌。已有 `.env` 会原样保留。
52
-
53
- ```dotenv
54
- HOST=127.0.0.1
55
- PORT=3210
56
- ADMIN_TOKEN=
57
- ONEBOT_TOKEN=
58
- LLM_API_KEY=
59
- ```
60
-
61
- | 字段 | 用途 |
62
- | ----------------------------------- | --------------------------------------------------------------- |
63
- | `ADMIN_TOKEN` | 打开 LuckyTri 和调用 HTTP API;停止命令也会使用 |
64
- | `ONEBOT_TOKEN` | OneBot 11 接入端连接 `/onebot/v11/ws`(只用 OneBot 方式时需要) |
65
- | `LLM_API_KEY` | 可选;非空时优先于 LuckyTri 里保存的模型密钥 |
66
- | `LUCKYTRI_CHANNEL` | 可选;`onebot` 或 `qqbot`。设置后在界面里不能更改连接方式 |
67
- | `QQBOT_APP_ID` / `QQBOT_APP_SECRET` | 可选;QQ 官方机器人的凭据,优先于界面里保存的 |
68
- | `HOST` / `PORT` | 监听地址和端口;本机使用保持默认 |
69
-
70
- 页面第一次取数据时会弹出窗口要求输入 `ADMIN_TOKEN`。令牌只留在当前标签页。修改 `.env` 后必须重启。不要把 `ADMIN_TOKEN` 填给 QQ 接入端,也不要把 `ONEBOT_TOKEN` 当成管理台密码。
46
+ 在「系统 → 运行开关」可以修改密码或退出登录。密码只以加盐校验摘要保存,现有环境配置和模型密钥保留。
71
47
 
72
48
  ## 3. 先在模拟模式试聊
73
49
 
@@ -111,20 +87,20 @@ LLM_API_KEY=
111
87
 
112
88
  LuckyTri 只实现 OneBot 11 的反向 WebSocket 接口,接入端需要你自行准备和管理。
113
89
 
114
- 1. 在本机 `.env` 中设置 `ONEBOT_TOKEN`,修改后重启 LuckyTri。
90
+ 1. 本机连接无需单独令牌,保留已有的接入地址和 QQ 登录。
115
91
  2. 在接入端自己的网络设置里添加 OneBot 11 反向 WebSocket 客户端:
116
92
 
117
- | 项目 | 本机填写 |
118
- | ------------- | ----------------------------------- |
119
- | 协议 | OneBot 11 |
120
- | WebSocket URL | `ws://127.0.0.1:3210/onebot/v11/ws` |
121
- | Token | `.env` 里的 `ONEBOT_TOKEN` |
122
- | 消息格式 | 数组 |
123
- | 启用 | 开启并保存 |
93
+ | 项目 | 本机填写 |
94
+ | ------------- | -------------------------------------------------- |
95
+ | 协议 | OneBot 11 |
96
+ | WebSocket URL | `ws://127.0.0.1:3210/onebot/v11/ws` |
97
+ | Token | 本机无需填写;远程可使用管理密码,旧远程令牌仍兼容 |
98
+ | 消息格式 | 数组 |
99
+ | 启用 | 开启并保存 |
124
100
 
125
101
  3. 在接入端完成 QQ 登录。小号需要已加入目标群;LuckyTri 不保存 QQ 密码。
126
102
 
127
- 这里的 `3210` 是 LuckyTri 的端口。接入端和 LuckyTri 不在同一台机器或放在容器里时,`127.0.0.1` 指向各自环境,需要改成 LuckyTri 的实际地址,并先配置 `ADMIN_TOKEN`。
103
+ 容器或另一台电脑中的 `127.0.0.1` 指向自身。远程接入使用 LuckyTri 的可达地址,并先在本机设置管理密码;对外提供管理台时使用 HTTPS。
128
104
 
129
105
  ### 方式二:QQ 官方机器人
130
106
 
@@ -198,8 +174,8 @@ TA 的一切都存在这一个数据库里,所以服务运行时会自动备
198
174
  | ------------------------- | -------------------------------------------------------------------------------------------------- |
199
175
  | 页面打不开 | Node 是否在运行,地址是否为 `127.0.0.1:3210` |
200
176
  | 端口已被占用 | 先 `npm run stop`,不要结束所有 node 进程 |
201
- | 令牌错误 | 使用 `ADMIN_TOKEN`;改 `.env` 后重启 |
202
- | OneBot 未连接 | 接入端是否登录,URL、端口、路径和 `ONEBOT_TOKEN` 是否一致 |
177
+ | 密码错误 | 使用首次设置的管理密码;可在系统运行开关中修改 |
178
+ | OneBot 未连接 | 确认接入端已登录、反向客户端启用、地址端口路径一致;本机无需额外令牌 |
203
179
  | 官方机器人未连接 | AppID 与 AppSecret 是否正确,机器人是否已开通群聊与单聊消息,网络能否访问 QQ 开放平台 |
204
180
  | 官方机器人只收到 @ 的消息 | 在开放平台开启「接收所有消息」;这是平台权限,不是 LuckyTri 的限制 |
205
181
  | 连接成功但没有会话 | 在 QQ 再发一条新消息;OneBot 方式下检查消息格式是否为数组 |