@lobehub/lobehub 2.0.0-next.93 → 2.0.0-next.95
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.
- package/.github/workflows/issue-auto-comments.yml +0 -19
- package/CHANGELOG.md +50 -0
- package/changelog/v1.json +18 -0
- package/package.json +1 -1
- package/packages/agent-runtime/src/core/InterventionChecker.ts +85 -0
- package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +492 -22
- package/packages/agent-runtime/src/core/defaultSecurityBlacklist.ts +335 -0
- package/packages/agent-runtime/src/core/index.ts +1 -0
- package/packages/agent-runtime/src/types/state.ts +10 -1
- package/packages/model-bank/src/aiModels/xai.ts +85 -6
- package/packages/types/src/tool/intervention.ts +38 -0
- package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.test.ts +25 -0
- package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.ts +28 -0
- package/src/features/ModelSwitchPanel/index.tsx +15 -13
- package/src/store/chat/agents/GeneralChatAgent.ts +22 -8
|
@@ -20,15 +20,6 @@ jobs:
|
|
|
20
20
|
pull-requests: write # for actions-cool/issues-helper to update PRs
|
|
21
21
|
runs-on: ubuntu-latest
|
|
22
22
|
steps:
|
|
23
|
-
- name: Auto Comment on Issues Opened
|
|
24
|
-
uses: wow-actions/auto-comment@v1
|
|
25
|
-
with:
|
|
26
|
-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN}}
|
|
27
|
-
issuesOpened: |
|
|
28
|
-
👀 @{{ author }}
|
|
29
|
-
|
|
30
|
-
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
|
|
31
|
-
Please make sure you have given us as much context as possible.
|
|
32
23
|
- name: Auto Comment on Issues Closed
|
|
33
24
|
uses: wow-actions/auto-comment@v1
|
|
34
25
|
with:
|
|
@@ -37,16 +28,6 @@ jobs:
|
|
|
37
28
|
✅ @{{ author }}
|
|
38
29
|
|
|
39
30
|
This issue is closed, If you have any questions, you can comment and reply.
|
|
40
|
-
- name: Auto Comment on Pull Request Opened
|
|
41
|
-
uses: wow-actions/auto-comment@v1
|
|
42
|
-
with:
|
|
43
|
-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN}}
|
|
44
|
-
pullRequestOpened: |
|
|
45
|
-
👍 @{{ author }}
|
|
46
|
-
|
|
47
|
-
Thank you for raising your pull request and contributing to our Community
|
|
48
|
-
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
|
|
49
|
-
If you encounter any problems, please feel free to connect with us.
|
|
50
31
|
- name: Auto Comment on Pull Request Merged
|
|
51
32
|
uses: actions-cool/pr-welcome@main
|
|
52
33
|
if: github.event.pull_request.merged == true
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.95](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.94...v2.0.0-next.95)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-11-20**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Add Security Blacklist for agent runtime.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Add Security Blacklist for agent runtime, closes [#10325](https://github.com/lobehub/lobe-chat/issues/10325) ([deab4d0](https://github.com/lobehub/lobe-chat/commit/deab4d0))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 2.0.0-next.94](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.93...v2.0.0-next.94)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2025-11-20**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Provider settings button unable to redirect.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Provider settings button unable to redirect, closes [#10319](https://github.com/lobehub/lobe-chat/issues/10319) ([e025fec](https://github.com/lobehub/lobe-chat/commit/e025fec))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 2.0.0-next.93](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.92...v2.0.0-next.93)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2025-11-20**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"features": [
|
|
5
|
+
"Add Security Blacklist for agent runtime."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2025-11-20",
|
|
9
|
+
"version": "2.0.0-next.95"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"fixes": [
|
|
14
|
+
"Provider settings button unable to redirect."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"date": "2025-11-20",
|
|
18
|
+
"version": "2.0.0-next.94"
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"children": {
|
|
4
22
|
"improvements": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.95",
|
|
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",
|
|
@@ -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
|
*
|