luckytri 1.0.0 → 1.0.2

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 (139) 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 +202 -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 +202 -216
  12. package/docs/zh/npm-release.md +33 -33
  13. package/package.json +110 -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-BhlJHseG.js +3 -0
  19. package/public/app/assets/Empty-DP6WMGHi.js +2 -0
  20. package/public/app/assets/Field-CtbdqaiB.js +1 -0
  21. package/public/app/assets/HeartPage-32BeTPn2.js +1 -0
  22. package/public/app/assets/LifePage-CxSm0XKI.js +1 -0
  23. package/public/app/assets/MemoryPage-BeKBcPCY.js +1 -0
  24. package/public/app/assets/NaturePage-NEPYl2HS.js +3 -0
  25. package/public/app/assets/PeoplePage-DxtpekwM.js +1 -0
  26. package/public/app/assets/PluginsPage-CVVQwEBI.css +1 -0
  27. package/public/app/assets/PluginsPage-DksEZbUU.js +2 -0
  28. package/public/app/assets/{SystemPage-CAMPoYqM.css → SystemPage-BkRu0Rvx.css} +1 -1
  29. package/public/app/assets/SystemPage-BvzJlHuY.js +1 -0
  30. package/public/app/assets/TimePage-7-awH5XL.js +3 -0
  31. package/public/app/assets/index-4rItIkD-.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-C6_HvoyB.js} +1 -1
  34. package/public/app/assets/media-SMfTT-yc.js +1 -0
  35. package/public/app/index.html +3 -3
  36. package/public/guide.en.html +72 -99
  37. package/public/guide.html +44 -86
  38. package/public/tutorial.en.md +25 -39
  39. package/public/tutorial.md +25 -39
  40. package/scripts/backup.js +311 -311
  41. package/scripts/browser.js +41 -41
  42. package/scripts/import-data.js +128 -0
  43. package/scripts/launch.js +101 -94
  44. package/scripts/plugin.js +150 -150
  45. package/scripts/reset-password.js +22 -0
  46. package/scripts/runtime.js +25 -25
  47. package/scripts/service.js +56 -47
  48. package/scripts/setup.js +50 -50
  49. package/scripts/start-server.js +41 -41
  50. package/scripts/stop.js +36 -36
  51. package/server/app.js +112 -96
  52. package/server/auth.js +217 -0
  53. package/server/channels/contract.js +57 -57
  54. package/server/channels/hub.js +165 -165
  55. package/server/channels/index.js +28 -25
  56. package/server/channels/onebot/index.js +335 -336
  57. package/server/channels/onebot/token.js +22 -3
  58. package/server/core/capabilities.js +208 -208
  59. package/server/core/events.js +64 -60
  60. package/server/core/image-preprocessor.js +208 -208
  61. package/server/core/model-manager.js +1213 -1213
  62. package/server/core/net-guard.js +49 -49
  63. package/server/core/orchestrator.js +569 -569
  64. package/server/core/perceivers.js +91 -91
  65. package/server/core/persona-manager.js +243 -243
  66. package/server/core/repository.js +293 -293
  67. package/server/core/response-validator.js +508 -508
  68. package/server/core/turn-processor.js +630 -630
  69. package/server/core/turn.js +236 -236
  70. package/server/core/vision-manager.js +633 -633
  71. package/server/i18n/errors.js +548 -497
  72. package/server/i18n/labels.js +649 -653
  73. package/server/index.js +151 -102
  74. package/server/knowledge/manager.js +386 -386
  75. package/server/knowledge/schema.js +12 -8
  76. package/server/local-access.js +32 -0
  77. package/server/mind/anticipations.js +507 -507
  78. package/server/mind/api.js +703 -703
  79. package/server/mind/budget.js +152 -152
  80. package/server/mind/context-selection.js +61 -61
  81. package/server/mind/day-planner.js +324 -324
  82. package/server/mind/evidence.js +148 -148
  83. package/server/mind/index.js +445 -445
  84. package/server/mind/life/diary.js +786 -786
  85. package/server/mind/life/index.js +1049 -1049
  86. package/server/mind/observations.js +84 -84
  87. package/server/mind/own-day.js +324 -324
  88. package/server/mind/own-voice.js +318 -318
  89. package/server/mind/senses.js +53 -53
  90. package/server/mind/time/activity-clock.js +196 -196
  91. package/server/mind/time/availability.js +69 -69
  92. package/server/mind/time/commitment-review.js +198 -198
  93. package/server/mind/time/executor.js +512 -512
  94. package/server/mind/time/experiences.js +128 -128
  95. package/server/mind/time/games.js +562 -562
  96. package/server/mind/time/index.js +739 -739
  97. package/server/mind/time/intent.js +166 -166
  98. package/server/mind/time/kinds.js +171 -171
  99. package/server/mind/time/plugin-activity.js +207 -207
  100. package/server/mind/time/tasks.js +587 -587
  101. package/server/mind/util.js +110 -110
  102. package/server/mind/view.js +273 -273
  103. package/server/paths.js +102 -102
  104. package/server/plugins/api.js +204 -204
  105. package/server/plugins/host.js +967 -967
  106. package/server/plugins/install.js +295 -295
  107. package/server/plugins/manifest.js +201 -201
  108. package/server/plugins/permissions.js +42 -42
  109. package/server/plugins/runner/guard.mjs +36 -36
  110. package/server/plugins/runner/worker.mjs +250 -250
  111. package/server/plugins/schema.js +91 -91
  112. package/server/plugins/zip.js +112 -112
  113. package/server/startup-lock.js +118 -118
  114. package/server/storage/archive.js +242 -241
  115. package/server/storage/backup-cleanup-worker.js +8 -8
  116. package/server/storage/backup-cleanup.js +415 -414
  117. package/server/storage/backup-lock.js +76 -76
  118. package/server/storage/backup-scheduler.js +131 -131
  119. package/server/storage/data-package.js +298 -0
  120. package/server/storage/data-transfer-api.js +50 -0
  121. package/server/storage/data-transfer-worker.js +18 -0
  122. package/server/storage/data-transfer.js +415 -0
  123. package/server/storage/store.js +202 -199
  124. package/server/studio/readiness.js +181 -190
  125. package/server/studio/settings.js +236 -236
  126. package/public/app/assets/ChatsPage-C-FcRapR.js +0 -3
  127. package/public/app/assets/Empty-CpP5kQHH.js +0 -2
  128. package/public/app/assets/Field-D4gY-INU.js +0 -1
  129. package/public/app/assets/HeartPage-CPy_thQd.js +0 -1
  130. package/public/app/assets/LifePage-CxWvwmSf.js +0 -1
  131. package/public/app/assets/MemoryPage-DC4rhQ68.js +0 -1
  132. package/public/app/assets/NaturePage-IvYw04Zq.js +0 -3
  133. package/public/app/assets/PeoplePage-Cqefm9-q.js +0 -1
  134. package/public/app/assets/PluginsPage-DKSaKvXb.js +0 -2
  135. package/public/app/assets/PluginsPage-HyBe5D8w.css +0 -1
  136. package/public/app/assets/SystemPage-CJmtJkrK.js +0 -1
  137. package/public/app/assets/TimePage-Cw44inM4.js +0 -3
  138. package/public/app/assets/index-BheRW-1t.js +0 -4
  139. package/public/app/assets/media-BzPDBm7e.js +0 -1
@@ -1,33 +1,33 @@
1
- # npm 发布与维护
2
-
3
- 发布复用 LuckyTri 当前 Git 仓库和 `package.json`,包名为 `luckytri`,版本继续由 `server/version.js` 从根 `package.json` 读取。
4
-
5
- ## 结构与启动
6
-
7
- `server/` 是无需转译的 ESM 服务端,运行依赖为 Express、ws 和 sharp;SQLite 使用 Node.js 内置的 `node:sqlite`,最低 Node.js 24.5。`studio-web/` 使用 Vue 与 Vite,发布前构建到 `public/app/`。教程从中英文 `docs/*/guide.md` 生成到 `public/`。
8
-
9
- `bin/luckytri.js` 提供全局命令,分派到既有启动、停止、备份、恢复与插件脚本。`scripts/runtime.js` 复用 `scripts/setup.js` 的随机令牌初始化,并保留已有配置。`server/paths.js` 将包内资源与实例数据分开;源码默认继续使用仓库的 `.env` 和 `data/`,npm 安装默认使用独立用户目录。相对数据库和备份路径以实例目录为基准,后台进程和自动备份子进程继承相同的绝对路径。服务身份以实例目录确认,更新程序安装位置后仍能定位原实例。
10
-
11
- 数据库、心智、聊天、界面配置继续使用原 SQLite 存储与迁移;知识文件、插件安装与插件数据、日志和备份都在实例目录中。启动锁保留到服务退出,阻止重复打开同一实例。Windows、macOS、Linux 分别使用系统浏览器打开方式;无桌面环境可使用 `--no-browser`。
12
-
13
- ## 包内容边界
14
-
15
- `package.json.files` 白名单只包含 CLI、服务端、运行脚本、构建后的 WebUI、教程、插件桥接资源、内置天气插件、SDK 和公开文档。`.npmignore` 再排除敏感及本地文件。安装和卸载没有应用生命周期脚本,普通用户无需前端构建工具。
16
-
17
- `npm run pack:check` 使用 npm 实际生成的最终文件清单,先检查路径,再检查经过批准的源码内容,拒绝配置、秘密文件、数据库、聊天、日志、备份、开发文件和意外新增文件。它还校验 CLI shebang、关键资源、WebUI 资源引用及源代码中的常见秘密格式。不要使用 `--ignore-scripts` 从未经验证的源码直接发布。
18
-
19
- ## 发布流程
20
-
21
- 维护者需要开发依赖和 Playwright 浏览器。Windows 默认使用已安装的 Edge;Linux/macOS 可用 `npx playwright install chromium` 安装测试浏览器。
22
-
23
- ```bash
24
- npm ci
25
- npm run release:check
26
- npm publish
27
- ```
28
-
29
- `release:check` 构建完整资源、运行全部后端与 WebUI 测试、检查实际包并验证全局安装。`prepublishOnly` 自动执行构建、后端测试和实际包安装测试;`prepack` 自动构建并检查最终包内容。发新版本前同时更新 `package.json` 与 lockfile,并更新版本记录;已发布的版本不可覆盖。
30
-
31
- 包测试使用临时 npm 全局前缀和模拟数据,检查含空格、中文的任意调用目录、WebUI 浏览器加载、内置插件、数据库备份及恢复检查,再安装测试版本并卸载重装,确认配置、记忆、关系、聊天、知识文件、日志、备份和插件数据保留。测试版本只存在于本机临时压缩包,不发布。测试清单和经过验证的正式压缩包输出到被 Git 忽略的 `workspace/npm-release/`。完成检查后也可直接发布该目录中的正式 `.tgz`,保证上传的是已经检查和安装过的同一份包。
32
-
33
- 首次发布需要 npm 注册与登录。发布命令使用 npm 自己的登录流程,不读取或输出登录凭据文件;如果 npm 要求二次验证,由账号本人完成认证后继续发布。
1
+ # npm 发布与维护
2
+
3
+ 发布复用 LuckyTri 当前 Git 仓库和 `package.json`,包名为 `luckytri`,版本继续由 `server/version.js` 从根 `package.json` 读取。
4
+
5
+ ## 结构与启动
6
+
7
+ `server/` 是无需转译的 ESM 服务端,运行依赖为 Express、ws 和 sharp;SQLite 使用 Node.js 内置的 `node:sqlite`,最低 Node.js 24.5。`studio-web/` 使用 Vue 与 Vite,发布前构建到 `public/app/`。教程从中英文 `docs/*/guide.md` 生成到 `public/`。
8
+
9
+ `bin/luckytri.js` 提供全局命令,分派到既有启动、停止、备份、恢复与插件脚本。`scripts/runtime.js` 复用 `scripts/setup.js` 的本机环境初始化与管理台首次密码设置,并保留已有配置。`server/paths.js` 将包内资源与实例数据分开;源码默认继续使用仓库的 `.env` 和 `data/`,npm 安装默认使用独立用户目录。相对数据库和备份路径以实例目录为基准,后台进程和自动备份子进程继承相同的绝对路径。服务身份以实例目录确认,更新程序安装位置后仍能定位原实例。
10
+
11
+ 数据库、心智、聊天、界面配置继续使用原 SQLite 存储与迁移;知识文件、插件安装与插件数据、日志和备份都在实例目录中。启动锁保留到服务退出,阻止重复打开同一实例。Windows、macOS、Linux 分别使用系统浏览器打开方式;无桌面环境可使用 `--no-browser`。
12
+
13
+ ## 包内容边界
14
+
15
+ `package.json.files` 白名单只包含 CLI、服务端、运行脚本、构建后的 WebUI、教程、插件桥接资源、内置天气插件、SDK 和公开文档。`.npmignore` 再排除敏感及本地文件。安装和卸载没有应用生命周期脚本,普通用户无需前端构建工具。
16
+
17
+ `npm run pack:check` 使用 npm 实际生成的最终文件清单,先检查路径,再检查经过批准的源码内容,拒绝配置、秘密文件、数据库、聊天、日志、备份、开发文件和意外新增文件。它还校验 CLI shebang、关键资源、WebUI 资源引用及源代码中的常见秘密格式。不要使用 `--ignore-scripts` 从未经验证的源码直接发布。
18
+
19
+ ## 发布流程
20
+
21
+ 维护者需要开发依赖和 Playwright 浏览器。Windows 默认使用已安装的 Edge;Linux/macOS 可用 `npx playwright install chromium` 安装测试浏览器。
22
+
23
+ ```bash
24
+ npm ci
25
+ npm run release:check
26
+ npm publish
27
+ ```
28
+
29
+ `release:check` 构建完整资源、运行全部后端与 WebUI 测试、检查实际包并验证全局安装。`prepublishOnly` 自动执行构建、后端测试和实际包安装测试;`prepack` 自动构建并检查最终包内容。发新版本前同时更新 `package.json` 与 lockfile,并更新版本记录;已发布的版本不可覆盖。
30
+
31
+ 包测试使用临时 npm 全局前缀和模拟数据,检查含空格、中文的任意调用目录、WebUI 浏览器加载、内置插件、数据库备份及恢复检查,再安装测试版本并卸载重装,确认配置、记忆、关系、聊天、知识文件、日志、备份和插件数据保留。测试版本只存在于本机临时压缩包,不发布。测试清单和经过验证的正式压缩包输出到被 Git 忽略的 `workspace/npm-release/`。完成检查后也可直接发布该目录中的正式 `.tgz`,保证上传的是已经检查和安装过的同一份包。
32
+
33
+ 首次发布需要 npm 注册与登录。发布命令使用 npm 自己的登录流程,不读取或输出登录凭据文件;如果 npm 要求二次验证,由账号本人完成认证后继续发布。
package/package.json CHANGED
@@ -1,108 +1,110 @@
1
- {
2
- "name": "luckytri",
3
- "version": "1.0.0",
4
- "description": "让由技术诞生的她,在时间、记忆、相遇与选择中逐渐形成自己的方向",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/TodayYueC/LuckyTri.git"
9
- },
10
- "bugs": {
11
- "url": "https://github.com/TodayYueC/LuckyTri/issues"
12
- },
13
- "homepage": "https://github.com/TodayYueC/LuckyTri",
14
- "type": "module",
15
- "bin": {
16
- "luckytri": "bin/luckytri.js"
17
- },
18
- "files": [
19
- "bin/luckytri.js",
20
- "server/**/*.js",
21
- "server/plugins/runner/*.mjs",
22
- "scripts/launch.js",
23
- "scripts/start-server.js",
24
- "scripts/stop.js",
25
- "scripts/setup.js",
26
- "scripts/runtime.js",
27
- "scripts/service.js",
28
- "scripts/browser.js",
29
- "scripts/proxy-config.js",
30
- "scripts/backup.js",
31
- "scripts/recover.js",
32
- "scripts/plugin.js",
33
- "public/app/index.html",
34
- "public/app/assets/*.js",
35
- "public/app/assets/*.css",
36
- "public/app/assets/*.png",
37
- "public/plugin-kit/v1/bridge.js",
38
- "public/plugin-kit/v1/kit.css",
39
- "public/guide.html",
40
- "public/guide.en.html",
41
- "public/tutorial.md",
42
- "public/tutorial.en.md",
43
- "plugins/weather/index.js",
44
- "plugins/weather/luckytri-plugin.json",
45
- "plugins/sdk/index.d.ts",
46
- "plugins/sdk/testing.js",
47
- "docs/zh/*.md",
48
- "docs/en/*.md",
49
- "docs/brand/*.png",
50
- ".github/SECURITY.md",
51
- "README.en.md",
52
- "LICENSE"
53
- ],
54
- "publishConfig": {
55
- "access": "public",
56
- "registry": "https://registry.npmjs.org/"
57
- },
58
- "keywords": [
59
- "qq",
60
- "onebot",
61
- "chatbot",
62
- "ai",
63
- "memory",
64
- "webui"
65
- ],
66
- "engines": {
67
- "node": ">=24.5"
68
- },
69
- "scripts": {
70
- "launch": "node scripts/launch.js",
71
- "start": "node scripts/start-server.js",
72
- "dev:ui": "vite --config studio-web/vite.config.ts",
73
- "build:ui": "vite build --config studio-web/vite.config.ts",
74
- "build": "npm run build:ui && npm run docs:build",
75
- "test": "node --import ./tests/helpers/awake.mjs --test tests/*.test.js",
76
- "test:clock": "node scripts/dev/test-clock.js",
77
- "audit:sent": "node --env-file-if-exists=.env scripts/dev/audit-sent.js",
78
- "test:ui": "node tests/ui/smoke.js && node tests/ui/ta.mjs && node tests/ui/navigation.mjs && node tests/ui/time.mjs && node tests/ui/time-arrangement.mjs && node tests/ui/performance.mjs && node tests/ui/search.mjs && node tests/ui/storage.mjs && node tests/ui/i18n.mjs",
79
- "setup": "node scripts/setup.js",
80
- "stop": "node scripts/stop.js",
81
- "backup": "node scripts/backup.js",
82
- "recovery": "node scripts/recover.js",
83
- "docs:build": "node scripts/build-guide.js",
84
- "plugin": "node scripts/plugin.js",
85
- "pack:check": "node scripts/pack-check.js",
86
- "test:package": "node scripts/test-package.js",
87
- "test:registry": "node scripts/test-package.js --registry",
88
- "prepack": "npm run build && npm run pack:check",
89
- "prepublishOnly": "npm run build && npm test && npm run test:package",
90
- "release:check": "npm run build && npm test && npm run test:ui && npm run test:package",
91
- "format": "prettier --write bin server studio-web scripts tests plugins package.json",
92
- "format:check": "prettier --check bin server studio-web scripts tests plugins package.json"
93
- },
94
- "dependencies": {
95
- "express": "^5.1.0",
96
- "sharp": "^0.35.5",
97
- "ws": "^8.18.3"
98
- },
99
- "devDependencies": {
100
- "@playwright/test": "^1.55.0",
101
- "@vitejs/plugin-vue": "^6.0.9",
102
- "marked": "^18.0.13",
103
- "prettier": "^3.9.8",
104
- "typescript": "^7.0.2",
105
- "vite": "^8.3.0",
106
- "vue": "^3.5.43"
107
- }
108
- }
1
+ {
2
+ "name": "luckytri",
3
+ "version": "1.0.2",
4
+ "description": "让由技术诞生的她,在时间、记忆、相遇与选择中逐渐形成自己的方向",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/TodayYueC/LuckyTri.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/TodayYueC/LuckyTri/issues"
12
+ },
13
+ "homepage": "https://github.com/TodayYueC/LuckyTri",
14
+ "type": "module",
15
+ "bin": {
16
+ "luckytri": "bin/luckytri.js"
17
+ },
18
+ "files": [
19
+ "bin/luckytri.js",
20
+ "server/**/*.js",
21
+ "server/plugins/runner/*.mjs",
22
+ "scripts/launch.js",
23
+ "scripts/start-server.js",
24
+ "scripts/stop.js",
25
+ "scripts/reset-password.js",
26
+ "scripts/setup.js",
27
+ "scripts/runtime.js",
28
+ "scripts/service.js",
29
+ "scripts/browser.js",
30
+ "scripts/proxy-config.js",
31
+ "scripts/backup.js",
32
+ "scripts/recover.js",
33
+ "scripts/import-data.js",
34
+ "scripts/plugin.js",
35
+ "public/app/index.html",
36
+ "public/app/assets/*.js",
37
+ "public/app/assets/*.css",
38
+ "public/app/assets/*.png",
39
+ "public/plugin-kit/v1/bridge.js",
40
+ "public/plugin-kit/v1/kit.css",
41
+ "public/guide.html",
42
+ "public/guide.en.html",
43
+ "public/tutorial.md",
44
+ "public/tutorial.en.md",
45
+ "plugins/weather/index.js",
46
+ "plugins/weather/luckytri-plugin.json",
47
+ "plugins/sdk/index.d.ts",
48
+ "plugins/sdk/testing.js",
49
+ "docs/zh/*.md",
50
+ "docs/en/*.md",
51
+ "docs/brand/*.png",
52
+ ".github/SECURITY.md",
53
+ "README.en.md",
54
+ "LICENSE"
55
+ ],
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "keywords": [
61
+ "qq",
62
+ "onebot",
63
+ "chatbot",
64
+ "ai",
65
+ "memory",
66
+ "webui"
67
+ ],
68
+ "engines": {
69
+ "node": ">=24.5"
70
+ },
71
+ "scripts": {
72
+ "launch": "node scripts/launch.js",
73
+ "start": "node scripts/start-server.js",
74
+ "dev:ui": "vite --config studio-web/vite.config.ts",
75
+ "build:ui": "vite build --config studio-web/vite.config.ts",
76
+ "build": "npm run build:ui && npm run docs:build",
77
+ "test": "node --import ./tests/helpers/awake.mjs --test tests/*.test.js",
78
+ "test:clock": "node scripts/dev/test-clock.js",
79
+ "audit:sent": "node --env-file-if-exists=.env scripts/dev/audit-sent.js",
80
+ "test:ui": "node tests/ui/access.mjs && node tests/ui/smoke.js && node tests/ui/ta.mjs && node tests/ui/navigation.mjs && node tests/ui/time.mjs && node tests/ui/time-arrangement.mjs && node tests/ui/performance.mjs && node tests/ui/search.mjs && node tests/ui/storage.mjs && node tests/ui/data-transfer.mjs && node tests/ui/i18n.mjs",
81
+ "setup": "node scripts/setup.js",
82
+ "stop": "node scripts/stop.js",
83
+ "backup": "node scripts/backup.js",
84
+ "recovery": "node scripts/recover.js",
85
+ "docs:build": "node scripts/build-guide.js",
86
+ "plugin": "node scripts/plugin.js",
87
+ "pack:check": "node scripts/pack-check.js",
88
+ "test:package": "node scripts/test-package.js",
89
+ "test:registry": "node scripts/test-package.js --registry",
90
+ "prepack": "npm run build && npm run pack:check",
91
+ "prepublishOnly": "npm run build && npm test && npm run test:package",
92
+ "release:check": "npm run build && npm test && npm run test:ui && npm run test:package",
93
+ "format": "prettier --write bin server studio-web scripts tests plugins package.json",
94
+ "format:check": "prettier --check bin server studio-web scripts tests plugins package.json"
95
+ },
96
+ "dependencies": {
97
+ "express": "^5.1.0",
98
+ "sharp": "^0.35.5",
99
+ "ws": "^8.18.3"
100
+ },
101
+ "devDependencies": {
102
+ "@playwright/test": "^1.55.0",
103
+ "@vitejs/plugin-vue": "^6.0.9",
104
+ "marked": "^18.0.13",
105
+ "prettier": "^3.9.8",
106
+ "typescript": "^7.0.2",
107
+ "vite": "^8.3.0",
108
+ "vue": "^3.5.43"
109
+ }
110
+ }
@@ -1,155 +1,155 @@
1
- // LuckyTri Plugin API v1. A later API can be added beside this one;
2
- // v1 stays available through the 1.x line.
3
-
4
- export interface PluginManifest {
5
- id: string;
6
- name: string;
7
- version: string;
8
- pluginApi: "1.0";
9
- luckytri?: string;
10
- description?: string;
11
- author?: string;
12
- license?: string;
13
- entry?: string;
14
- permissions?: string[];
15
- network?: string[];
16
- settings?: PluginSetting[];
17
- contributes?: PluginContributes;
18
- }
19
-
20
- export interface PluginSetting {
21
- key: string;
22
- type:
23
- "text" | "secret" | "number" | "boolean" | "select" | "textarea" | "urls";
24
- label: string;
25
- required?: boolean;
26
- default?: unknown;
27
- allowNetwork?: boolean;
28
- }
29
-
30
- export interface PluginContributes {
31
- senses?: string[];
32
- channels?: {
33
- type: string;
34
- label?: string;
35
- capabilities?: Record<string, boolean>;
36
- }[];
37
- activities?: {
38
- kind: string;
39
- label?: string;
40
- describe?: string;
41
- keywords?: string;
42
- minutes?: number;
43
- energy?: boolean;
44
- }[];
45
- actions?: {
46
- name: string;
47
- label?: string;
48
- describe?: string;
49
- risk?: "low" | "high";
50
- confirm?: "none" | "owner";
51
- where?: "private" | "any";
52
- dailyLimit?: number;
53
- }[];
54
- perceive?: string[];
55
- ui?: { page?: boolean };
56
- }
57
-
58
- export interface PluginContext {
59
- plugin: { id: string; version: string; dataDir: string };
60
- api: { version: "1.0"; has(feature: string): boolean };
61
- now(): Promise<number>;
62
- log: {
63
- info(...parts: unknown[]): Promise<void>;
64
- warn(...parts: unknown[]): Promise<void>;
65
- error(...parts: unknown[]): Promise<void>;
66
- };
67
- settings: {
68
- get(): Promise<Record<string, unknown>>;
69
- onChange(fn: () => void): void;
70
- };
71
- storage: {
72
- get(key: string): Promise<unknown>;
73
- set(key: string, value: unknown): Promise<void>;
74
- delete(key: string): Promise<void>;
75
- list(prefix?: string): Promise<string[]>;
76
- };
77
- net: { fetch(url: string, init?: RequestInit): Promise<Response> };
78
- mind: {
79
- state(): Promise<Record<string, unknown>>;
80
- observe(input: {
81
- summary: string;
82
- detail?: string;
83
- discretion?: "open" | "private";
84
- }): Promise<{ ref?: string; rejected?: string }>;
85
- on(event: string, fn: (payload: unknown) => void): void;
86
- };
87
- senses: {
88
- set(
89
- key: string,
90
- sense: {
91
- text: string;
92
- discretion?: "open" | "private";
93
- ttlMinutes?: number;
94
- },
95
- ): Promise<void>;
96
- clear(key?: string): Promise<void>;
97
- };
98
- knowledge: {
99
- offer(doc: {
100
- title: string;
101
- text: string;
102
- url?: string;
103
- }): Promise<{ id: string }>;
104
- };
105
- activities: {
106
- handle(
107
- kind: string,
108
- prepare: (input: unknown) => Promise<unknown>,
109
- ): Promise<void>;
110
- setAvailable(kind: string, reason?: string): Promise<void>;
111
- };
112
- actions: {
113
- handle(
114
- name: string,
115
- run: (input: unknown) => Promise<unknown>,
116
- ): Promise<void>;
117
- };
118
- perceive: {
119
- handle(
120
- type: string,
121
- run: (input: unknown) => Promise<{ text?: string }>,
122
- ): Promise<void>;
123
- };
124
- channel: {
125
- provide(type: string, impl: Record<string, unknown>): Promise<void>;
126
- receive(type: string, message: Record<string, unknown>): Promise<void>;
127
- status(type: string, status: { online?: boolean }): Promise<void>;
128
- reachable(type: string, sessionKey: string, ok: boolean): Promise<void>;
129
- };
130
- models: { call(req: { system: string; input: unknown }): Promise<unknown> };
131
- http: {
132
- route(
133
- method: string,
134
- path: string,
135
- handler: (input: unknown) => Promise<unknown>,
136
- ): Promise<void>;
137
- hook(
138
- method: string,
139
- path: string,
140
- handler: (input: unknown) => Promise<unknown>,
141
- ): Promise<void>;
142
- };
143
- status: {
144
- set(status: {
145
- text: string;
146
- tone?: "ok" | "warn" | "error";
147
- }): Promise<void>;
148
- };
149
- notify(notice: { title: string; text: string }): Promise<void>;
150
- }
151
-
152
- export interface LuckyTriPlugin {
153
- activate(ctx: PluginContext): void | Promise<void>;
154
- deactivate?(): void | Promise<void>;
155
- }
1
+ // LuckyTri Plugin API v1. A later API can be added beside this one;
2
+ // v1 stays available through the 1.x line.
3
+
4
+ export interface PluginManifest {
5
+ id: string;
6
+ name: string;
7
+ version: string;
8
+ pluginApi: "1.0";
9
+ luckytri?: string;
10
+ description?: string;
11
+ author?: string;
12
+ license?: string;
13
+ entry?: string;
14
+ permissions?: string[];
15
+ network?: string[];
16
+ settings?: PluginSetting[];
17
+ contributes?: PluginContributes;
18
+ }
19
+
20
+ export interface PluginSetting {
21
+ key: string;
22
+ type:
23
+ "text" | "secret" | "number" | "boolean" | "select" | "textarea" | "urls";
24
+ label: string;
25
+ required?: boolean;
26
+ default?: unknown;
27
+ allowNetwork?: boolean;
28
+ }
29
+
30
+ export interface PluginContributes {
31
+ senses?: string[];
32
+ channels?: {
33
+ type: string;
34
+ label?: string;
35
+ capabilities?: Record<string, boolean>;
36
+ }[];
37
+ activities?: {
38
+ kind: string;
39
+ label?: string;
40
+ describe?: string;
41
+ keywords?: string;
42
+ minutes?: number;
43
+ energy?: boolean;
44
+ }[];
45
+ actions?: {
46
+ name: string;
47
+ label?: string;
48
+ describe?: string;
49
+ risk?: "low" | "high";
50
+ confirm?: "none" | "owner";
51
+ where?: "private" | "any";
52
+ dailyLimit?: number;
53
+ }[];
54
+ perceive?: string[];
55
+ ui?: { page?: boolean };
56
+ }
57
+
58
+ export interface PluginContext {
59
+ plugin: { id: string; version: string; dataDir: string };
60
+ api: { version: "1.0"; has(feature: string): boolean };
61
+ now(): Promise<number>;
62
+ log: {
63
+ info(...parts: unknown[]): Promise<void>;
64
+ warn(...parts: unknown[]): Promise<void>;
65
+ error(...parts: unknown[]): Promise<void>;
66
+ };
67
+ settings: {
68
+ get(): Promise<Record<string, unknown>>;
69
+ onChange(fn: () => void): void;
70
+ };
71
+ storage: {
72
+ get(key: string): Promise<unknown>;
73
+ set(key: string, value: unknown): Promise<void>;
74
+ delete(key: string): Promise<void>;
75
+ list(prefix?: string): Promise<string[]>;
76
+ };
77
+ net: { fetch(url: string, init?: RequestInit): Promise<Response> };
78
+ mind: {
79
+ state(): Promise<Record<string, unknown>>;
80
+ observe(input: {
81
+ summary: string;
82
+ detail?: string;
83
+ discretion?: "open" | "private";
84
+ }): Promise<{ ref?: string; rejected?: string }>;
85
+ on(event: string, fn: (payload: unknown) => void): void;
86
+ };
87
+ senses: {
88
+ set(
89
+ key: string,
90
+ sense: {
91
+ text: string;
92
+ discretion?: "open" | "private";
93
+ ttlMinutes?: number;
94
+ },
95
+ ): Promise<void>;
96
+ clear(key?: string): Promise<void>;
97
+ };
98
+ knowledge: {
99
+ offer(doc: {
100
+ title: string;
101
+ text: string;
102
+ url?: string;
103
+ }): Promise<{ id: string }>;
104
+ };
105
+ activities: {
106
+ handle(
107
+ kind: string,
108
+ prepare: (input: unknown) => Promise<unknown>,
109
+ ): Promise<void>;
110
+ setAvailable(kind: string, reason?: string): Promise<void>;
111
+ };
112
+ actions: {
113
+ handle(
114
+ name: string,
115
+ run: (input: unknown) => Promise<unknown>,
116
+ ): Promise<void>;
117
+ };
118
+ perceive: {
119
+ handle(
120
+ type: string,
121
+ run: (input: unknown) => Promise<{ text?: string }>,
122
+ ): Promise<void>;
123
+ };
124
+ channel: {
125
+ provide(type: string, impl: Record<string, unknown>): Promise<void>;
126
+ receive(type: string, message: Record<string, unknown>): Promise<void>;
127
+ status(type: string, status: { online?: boolean }): Promise<void>;
128
+ reachable(type: string, sessionKey: string, ok: boolean): Promise<void>;
129
+ };
130
+ models: { call(req: { system: string; input: unknown }): Promise<unknown> };
131
+ http: {
132
+ route(
133
+ method: string,
134
+ path: string,
135
+ handler: (input: unknown) => Promise<unknown>,
136
+ ): Promise<void>;
137
+ hook(
138
+ method: string,
139
+ path: string,
140
+ handler: (input: unknown) => Promise<unknown>,
141
+ ): Promise<void>;
142
+ };
143
+ status: {
144
+ set(status: {
145
+ text: string;
146
+ tone?: "ok" | "warn" | "error";
147
+ }): Promise<void>;
148
+ };
149
+ notify(notice: { title: string; text: string }): Promise<void>;
150
+ }
151
+
152
+ export interface LuckyTriPlugin {
153
+ activate(ctx: PluginContext): void | Promise<void>;
154
+ deactivate?(): void | Promise<void>;
155
+ }