@lobehub/lobehub 2.0.0-next.94 → 2.0.0-next.96

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 (63) hide show
  1. package/.github/workflows/issue-auto-comments.yml +0 -19
  2. package/CHANGELOG.md +50 -0
  3. package/changelog/v1.json +18 -0
  4. package/locales/ar/common.json +21 -0
  5. package/locales/ar/hotkey.json +4 -0
  6. package/locales/bg-BG/common.json +21 -0
  7. package/locales/bg-BG/hotkey.json +4 -0
  8. package/locales/de-DE/common.json +21 -0
  9. package/locales/de-DE/hotkey.json +4 -0
  10. package/locales/en-US/common.json +21 -0
  11. package/locales/en-US/hotkey.json +4 -0
  12. package/locales/es-ES/common.json +21 -0
  13. package/locales/es-ES/hotkey.json +4 -0
  14. package/locales/fa-IR/common.json +21 -0
  15. package/locales/fa-IR/hotkey.json +4 -0
  16. package/locales/fr-FR/common.json +21 -0
  17. package/locales/fr-FR/hotkey.json +4 -0
  18. package/locales/it-IT/common.json +21 -0
  19. package/locales/it-IT/hotkey.json +4 -0
  20. package/locales/ja-JP/common.json +21 -0
  21. package/locales/ja-JP/hotkey.json +4 -0
  22. package/locales/ko-KR/common.json +21 -0
  23. package/locales/ko-KR/hotkey.json +4 -0
  24. package/locales/nl-NL/common.json +21 -0
  25. package/locales/nl-NL/hotkey.json +4 -0
  26. package/locales/pl-PL/common.json +21 -0
  27. package/locales/pl-PL/hotkey.json +4 -0
  28. package/locales/pt-BR/common.json +21 -0
  29. package/locales/pt-BR/hotkey.json +4 -0
  30. package/locales/ru-RU/common.json +21 -0
  31. package/locales/ru-RU/hotkey.json +4 -0
  32. package/locales/tr-TR/common.json +21 -0
  33. package/locales/tr-TR/hotkey.json +4 -0
  34. package/locales/vi-VN/common.json +21 -0
  35. package/locales/vi-VN/hotkey.json +4 -0
  36. package/locales/zh-CN/common.json +21 -0
  37. package/locales/zh-CN/hotkey.json +4 -0
  38. package/locales/zh-TW/common.json +21 -0
  39. package/locales/zh-TW/hotkey.json +4 -0
  40. package/package.json +3 -1
  41. package/packages/agent-runtime/src/core/InterventionChecker.ts +85 -0
  42. package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +492 -22
  43. package/packages/agent-runtime/src/core/defaultSecurityBlacklist.ts +335 -0
  44. package/packages/agent-runtime/src/core/index.ts +1 -0
  45. package/packages/agent-runtime/src/types/state.ts +10 -1
  46. package/packages/const/src/hotkeys.ts +6 -0
  47. package/packages/conversation-flow/src/__tests__/indexing.test.ts +513 -0
  48. package/packages/conversation-flow/src/__tests__/structuring.test.ts +600 -0
  49. package/packages/types/src/hotkey.ts +1 -0
  50. package/packages/types/src/tool/intervention.ts +38 -0
  51. package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +41 -8
  52. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +6 -4
  53. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/index.tsx +16 -4
  54. package/src/app/[variants]/(main)/settings/provider/(list)/index.tsx +15 -3
  55. package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +23 -15
  56. package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.test.ts +25 -0
  57. package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.ts +28 -0
  58. package/src/layout/GlobalProvider/Cmdk.tsx +470 -0
  59. package/src/layout/GlobalProvider/CmdkLazy.tsx +17 -0
  60. package/src/layout/GlobalProvider/index.tsx +2 -0
  61. package/src/locales/default/common.ts +21 -0
  62. package/src/locales/default/hotkey.ts +4 -0
  63. package/src/store/chat/agents/GeneralChatAgent.ts +22 -8
@@ -135,6 +135,27 @@
135
135
  }
136
136
  },
137
137
  "close": "Закрыть",
138
+ "cmdk": {
139
+ "about": "О нас",
140
+ "communitySupport": "Поддержка сообщества",
141
+ "discover": "Обзор",
142
+ "knowledgeBase": "База знаний",
143
+ "navigate": "Навигация",
144
+ "newAgent": "Создать помощника",
145
+ "noResults": "Ничего не найдено",
146
+ "openSettings": "Открыть настройки",
147
+ "painting": "AI-рисование",
148
+ "searchPlaceholder": "Введите команду или выполните поиск...",
149
+ "settings": "Настройки",
150
+ "starOnGitHub": "Поставьте звезду на GitHub",
151
+ "submitIssue": "Сообщить о проблеме",
152
+ "theme": "Тема",
153
+ "themeAuto": "Системная тема",
154
+ "themeDark": "Тёмная тема",
155
+ "themeLight": "Светлая тема",
156
+ "toOpen": "Открыть",
157
+ "toSelect": "Выбрать"
158
+ },
138
159
  "confirm": "Подтвердить",
139
160
  "contact": "Свяжитесь с нами",
140
161
  "copy": "Копировать",
@@ -7,6 +7,10 @@
7
7
  "desc": "Очистить сообщения текущего сеанса и загруженные файлы",
8
8
  "title": "Очистить сообщения сеанса"
9
9
  },
10
+ "commandPalette": {
11
+ "desc": "Откройте глобальную панель команд для быстрого доступа к функциям",
12
+ "title": "Панель команд"
13
+ },
10
14
  "deleteAndRegenerateMessage": {
11
15
  "desc": "Удалить последнее сообщение и сгенерировать заново",
12
16
  "title": "Удалить и сгенерировать заново"
@@ -135,6 +135,27 @@
135
135
  }
136
136
  },
137
137
  "close": "Kapat",
138
+ "cmdk": {
139
+ "about": "Hakkında",
140
+ "communitySupport": "Topluluk Desteği",
141
+ "discover": "Keşfet",
142
+ "knowledgeBase": "Bilgi Tabanı",
143
+ "navigate": "Gezin",
144
+ "newAgent": "Yeni Asistan Oluştur",
145
+ "noResults": "Sonuç bulunamadı",
146
+ "openSettings": "Ayarları Aç",
147
+ "painting": "Yapay Zeka Resmi",
148
+ "searchPlaceholder": "Komut girin veya arayın...",
149
+ "settings": "Ayarlar",
150
+ "starOnGitHub": "GitHub'da Bize Yıldız Verin",
151
+ "submitIssue": "Sorun Bildir",
152
+ "theme": "Tema",
153
+ "themeAuto": "Sistemle Eşle",
154
+ "themeDark": "Karanlık Mod",
155
+ "themeLight": "Aydınlık Mod",
156
+ "toOpen": "Aç",
157
+ "toSelect": "Seç"
158
+ },
138
159
  "confirm": "Onayla",
139
160
  "contact": "Bize Ulaşın",
140
161
  "copy": "Kopyala",
@@ -7,6 +7,10 @@
7
7
  "desc": "Geçerli oturumun mesajlarını ve yüklenen dosyaları temizle",
8
8
  "title": "Oturum mesajlarını temizle"
9
9
  },
10
+ "commandPalette": {
11
+ "desc": "Genel komut panelini açarak işlevlere hızlı erişim sağlayın",
12
+ "title": "Komut Paneli"
13
+ },
10
14
  "deleteAndRegenerateMessage": {
11
15
  "desc": "Son mesajı sil ve yeniden oluştur",
12
16
  "title": "Sil ve Yeniden Oluştur"
@@ -135,6 +135,27 @@
135
135
  }
136
136
  },
137
137
  "close": "Đóng",
138
+ "cmdk": {
139
+ "about": "Giới thiệu",
140
+ "communitySupport": "Hỗ trợ cộng đồng",
141
+ "discover": "Khám phá",
142
+ "knowledgeBase": "Cơ sở kiến thức",
143
+ "navigate": "Điều hướng",
144
+ "newAgent": "Tạo trợ lý mới",
145
+ "noResults": "Không tìm thấy kết quả phù hợp",
146
+ "openSettings": "Mở cài đặt",
147
+ "painting": "Vẽ bằng AI",
148
+ "searchPlaceholder": "Nhập lệnh hoặc tìm kiếm...",
149
+ "settings": "Cài đặt",
150
+ "starOnGitHub": "Đánh giá sao trên GitHub",
151
+ "submitIssue": "Gửi vấn đề",
152
+ "theme": "Giao diện",
153
+ "themeAuto": "Theo hệ thống",
154
+ "themeDark": "Chế độ tối",
155
+ "themeLight": "Chế độ sáng",
156
+ "toOpen": "Mở",
157
+ "toSelect": "Chọn"
158
+ },
138
159
  "confirm": "Xác nhận",
139
160
  "contact": "Liên hệ chúng tôi",
140
161
  "copy": "Sao chép",
@@ -7,6 +7,10 @@
7
7
  "desc": "Xóa tất cả tin nhắn và tệp đã tải lên trong cuộc trò chuyện hiện tại",
8
8
  "title": "Xóa tin nhắn cuộc trò chuyện"
9
9
  },
10
+ "commandPalette": {
11
+ "desc": "Mở bảng lệnh toàn cục để truy cập nhanh các chức năng",
12
+ "title": "Bảng lệnh"
13
+ },
10
14
  "deleteAndRegenerateMessage": {
11
15
  "desc": "Xoá tin nhắn cuối cùng và tạo lại",
12
16
  "title": "Xoá và tạo lại"
@@ -135,6 +135,27 @@
135
135
  }
136
136
  },
137
137
  "close": "关闭",
138
+ "cmdk": {
139
+ "about": "关于",
140
+ "communitySupport": "社区支持",
141
+ "discover": "发现",
142
+ "knowledgeBase": "知识库",
143
+ "navigate": "导航",
144
+ "newAgent": "新建助手",
145
+ "noResults": "未找到相关结果",
146
+ "openSettings": "打开设置",
147
+ "painting": "AI 绘画",
148
+ "searchPlaceholder": "输入命令或搜索...",
149
+ "settings": "设置",
150
+ "starOnGitHub": "在 GitHub 上给我们 Star",
151
+ "submitIssue": "提交问题",
152
+ "theme": "主题",
153
+ "themeAuto": "跟随系统",
154
+ "themeDark": "深色模式",
155
+ "themeLight": "浅色模式",
156
+ "toOpen": "打开",
157
+ "toSelect": "选择"
158
+ },
138
159
  "confirm": "确认",
139
160
  "contact": "联系我们",
140
161
  "copy": "复制",
@@ -7,6 +7,10 @@
7
7
  "desc": "清空当前会话的消息和上传的文件",
8
8
  "title": "清空会话消息"
9
9
  },
10
+ "commandPalette": {
11
+ "desc": "打开全局命令面板快速访问功能",
12
+ "title": "命令面板"
13
+ },
10
14
  "deleteAndRegenerateMessage": {
11
15
  "desc": "删除最后一条消息并重新生成",
12
16
  "title": "删除并重新生成"
@@ -135,6 +135,27 @@
135
135
  }
136
136
  },
137
137
  "close": "關閉",
138
+ "cmdk": {
139
+ "about": "關於",
140
+ "communitySupport": "社群支援",
141
+ "discover": "探索",
142
+ "knowledgeBase": "知識庫",
143
+ "navigate": "導覽",
144
+ "newAgent": "新增助手",
145
+ "noResults": "未找到相關結果",
146
+ "openSettings": "開啟設定",
147
+ "painting": "AI 繪圖",
148
+ "searchPlaceholder": "輸入指令或搜尋...",
149
+ "settings": "設定",
150
+ "starOnGitHub": "在 GitHub 上給我們星標",
151
+ "submitIssue": "提交問題",
152
+ "theme": "主題",
153
+ "themeAuto": "依系統設定",
154
+ "themeDark": "深色模式",
155
+ "themeLight": "淺色模式",
156
+ "toOpen": "開啟",
157
+ "toSelect": "選取"
158
+ },
138
159
  "confirm": "確認",
139
160
  "contact": "聯繫我們",
140
161
  "copy": "複製",
@@ -7,6 +7,10 @@
7
7
  "desc": "清空當前會話的消息和上傳的檔案",
8
8
  "title": "清空會話消息"
9
9
  },
10
+ "commandPalette": {
11
+ "desc": "開啟全域指令面板以快速存取功能",
12
+ "title": "指令面板"
13
+ },
10
14
  "deleteAndRegenerateMessage": {
11
15
  "desc": "刪除最後一則訊息並重新產生",
12
16
  "title": "刪除並重新產生"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.94",
3
+ "version": "2.0.0-next.96",
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",
@@ -197,6 +197,7 @@
197
197
  "antd-style": "^3.7.1",
198
198
  "brotli-wasm": "^3.0.1",
199
199
  "chroma-js": "^3.1.2",
200
+ "cmdk": "^1.1.1",
200
201
  "cookie": "^1.0.2",
201
202
  "countries-and-timezones": "^3.8.0",
202
203
  "dayjs": "^1.11.19",
@@ -256,6 +257,7 @@
256
257
  "pwa-install-handler": "^2.6.3",
257
258
  "query-string": "^9.3.1",
258
259
  "random-words": "^2.0.1",
260
+ "rc-util": "^5.44.4",
259
261
  "react": "19.2.0",
260
262
  "react-confetti": "^6.4.0",
261
263
  "react-diff-view": "^3.3.2",
@@ -2,14 +2,56 @@ import type {
2
2
  ArgumentMatcher,
3
3
  HumanInterventionPolicy,
4
4
  HumanInterventionRule,
5
+ SecurityBlacklistRule,
5
6
  ShouldInterveneParams,
6
7
  } from '@lobechat/types';
7
8
 
9
+ import { DEFAULT_SECURITY_BLACKLIST } from './defaultSecurityBlacklist';
10
+
11
+ /**
12
+ * Result of security blacklist check
13
+ */
14
+ export interface SecurityCheckResult {
15
+ /**
16
+ * Whether the operation is blocked by security rules
17
+ */
18
+ blocked: boolean;
19
+
20
+ /**
21
+ * Reason for blocking (if blocked)
22
+ */
23
+ reason?: string;
24
+ }
25
+
8
26
  /**
9
27
  * Intervention Checker
10
28
  * Determines whether a tool call requires human intervention
11
29
  */
12
30
  export class InterventionChecker {
31
+ /**
32
+ * Check if tool call is blocked by security blacklist
33
+ * This check runs BEFORE all other intervention checks
34
+ *
35
+ * @param securityBlacklist - Security blacklist rules
36
+ * @param toolArgs - Tool call arguments
37
+ * @returns Security check result
38
+ */
39
+ static checkSecurityBlacklist(
40
+ securityBlacklist: SecurityBlacklistRule[] = [],
41
+ toolArgs: Record<string, any> = {},
42
+ ): SecurityCheckResult {
43
+ for (const rule of securityBlacklist) {
44
+ if (this.matchesSecurityRule(rule, toolArgs)) {
45
+ return {
46
+ blocked: true,
47
+ reason: rule.description,
48
+ };
49
+ }
50
+ }
51
+
52
+ return { blocked: false };
53
+ }
54
+
13
55
  /**
14
56
  * Check if a tool call requires intervention
15
57
  *
@@ -19,6 +61,19 @@ export class InterventionChecker {
19
61
  static shouldIntervene(params: ShouldInterveneParams): HumanInterventionPolicy {
20
62
  const { config, toolArgs = {} } = params;
21
63
 
64
+ // Use default blacklist if not provided
65
+ const securityBlacklist =
66
+ params.securityBlacklist !== undefined
67
+ ? params.securityBlacklist
68
+ : DEFAULT_SECURITY_BLACKLIST;
69
+
70
+ // CRITICAL: Check security blacklist first - this overrides ALL other settings
71
+ const securityCheck = this.checkSecurityBlacklist(securityBlacklist, toolArgs);
72
+ if (securityCheck.blocked) {
73
+ // Security blacklist always requires intervention, even in auto-run mode
74
+ return 'required';
75
+ }
76
+
22
77
  // No config means never intervene (auto-execute)
23
78
  if (!config) return 'never';
24
79
 
@@ -38,6 +93,36 @@ export class InterventionChecker {
38
93
  return 'required';
39
94
  }
40
95
 
96
+ /**
97
+ * Check if tool arguments match a security blacklist rule
98
+ *
99
+ * @param rule - Security rule to check
100
+ * @param toolArgs - Tool call arguments
101
+ * @returns true if matches (should be blocked)
102
+ */
103
+ private static matchesSecurityRule(
104
+ rule: SecurityBlacklistRule,
105
+ toolArgs: Record<string, any>,
106
+ ): boolean {
107
+ // Security rules must have match criteria
108
+ if (!rule.match) return false;
109
+
110
+ // All matchers must match (AND logic)
111
+ for (const [paramName, matcher] of Object.entries(rule.match)) {
112
+ const paramValue = toolArgs[paramName];
113
+
114
+ // Parameter not present in args - rule doesn't match
115
+ if (paramValue === undefined) return false;
116
+
117
+ // Check if value matches
118
+ if (!this.matchesArgument(matcher, paramValue)) {
119
+ return false;
120
+ }
121
+ }
122
+
123
+ return true;
124
+ }
125
+
41
126
  /**
42
127
  * Check if tool arguments match a rule
43
128
  *