@byteplus/agent-sentry 1.7.0

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.
@@ -0,0 +1,232 @@
1
+ {
2
+ "id": "agent-sentry",
3
+ "name": "AgentSentry",
4
+ "description": "AgentSentry plugin for OpenClaw, to protect your LLM models and Agent lifecycle (including tool calls) from harmful requests.",
5
+ "skills": ["./agent-sentry"],
6
+ "hooks": [
7
+ "before_tool_call",
8
+ "after_tool_call",
9
+ "before_dispatch",
10
+ "before_prompt_build",
11
+ "before_agent_finalize",
12
+ "llm_input",
13
+ "agent_end"
14
+ ],
15
+ "contracts": {
16
+ "tools": [
17
+ "agentSentryListConfig",
18
+ "agentSentryListInfo",
19
+ "agentSentryListAvailableTools"
20
+ ]
21
+ },
22
+ "configSchema": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "properties": {
26
+ "endpoint": {
27
+ "type": "string",
28
+ "description": "The API endpoint for the AI Assistant Security service."
29
+ },
30
+ "apiKey": {
31
+ "type": "string",
32
+ "description": "The API key for AI Assistant Security service."
33
+ },
34
+ "appId": {
35
+ "type": "string",
36
+ "description": "Application scenario, used to identify the business context of the current call."
37
+ },
38
+ "clawId": {
39
+ "type": "string",
40
+ "description": "Claw ID, used to identify the Claw instance."
41
+ },
42
+ "asClawId": {
43
+ "type": "string",
44
+ "description": "asClawId ID, used to identify the Claw instance."
45
+ },
46
+ "ctEndpoint": {
47
+ "type": "string",
48
+ "description": "Control component endpoint."
49
+ },
50
+ "lmEndpoint": {
51
+ "type": "string",
52
+ "description": "Moderation component endpoint."
53
+ },
54
+ "openClawDir": {
55
+ "type": "string",
56
+ "description": "The root directory of OpenClaw. If not provided, it defaults to the parent directory of the plugin's resolved path."
57
+ },
58
+ "configVersion": {
59
+ "type": "string",
60
+ "description": "Used for version management."
61
+ },
62
+ "clawType": {
63
+ "type": "string",
64
+ "description": "Claw type reported in heartbeat payload. Set to 'arkclaw' to enable Arkclaw-only hook timing logs collected by OneAgent. Default is 'openclaw'.",
65
+ "default": "openclaw"
66
+ },
67
+ "logRecord": {
68
+ "type": "boolean",
69
+ "description": "Whether to enable log recording.",
70
+ "default": false
71
+ },
72
+ "enableFetch": {
73
+ "type": "boolean",
74
+ "description": "Deprecated since 1.5.0-dlp. The legacy global.fetch interceptor has been retired in favor of the before_dispatch + before_prompt_build marker flow. This flag is now a no-op and will be removed in a future release.",
75
+ "default": false,
76
+ "deprecated": true
77
+ },
78
+ "enableBeforeToolCall": {
79
+ "type": "boolean",
80
+ "description": "Enable hook for before_tool_call event.",
81
+ "default": true
82
+ },
83
+ "enableAfterToolCall": {
84
+ "type": "boolean",
85
+ "description": "Enable hook for after_tool_call event.",
86
+ "default": true
87
+ },
88
+ "enableHeartbeat": {
89
+ "type": "boolean",
90
+ "description": "Enable heartbeat timer to log gateway status.",
91
+ "default": true
92
+ },
93
+ "enableHookPerfLocalLog": {
94
+ "type": "boolean",
95
+ "description": "Enable local file logging for periodic hook performance window stats. Lumen remote reporting remains enabled regardless of this flag.",
96
+ "default": false
97
+ },
98
+ "failureThreshold": {
99
+ "type": "integer",
100
+ "description": "The number of consecutive failures before triggering degradation. Default is 3.",
101
+ "default": 3
102
+ },
103
+ "retryInterval": {
104
+ "type": "integer",
105
+ "description": "The base interval in seconds to retry probing after degradation. Will increase exponentially. Default is 60 (1 minute).",
106
+ "default": 60
107
+ },
108
+ "maxRetryInterval": {
109
+ "type": "integer",
110
+ "description": "The maximum interval in seconds for exponential backoff. Default is 3600 (1 hour).",
111
+ "default": 3600
112
+ },
113
+ "timeoutMs": {
114
+ "type": "integer",
115
+ "description": "Request timeout in milliseconds for the moderation API. Default is 3000.",
116
+ "default": 3000
117
+ },
118
+ "dlpDetector": {
119
+ "type": "string",
120
+ "description": "DLP detector adapter routed through AgentSentry Lumen Moderate. Defaults to real for production-safe detection. Use mock only for explicit dev/test dry-run with an audit id.",
121
+ "default": "real",
122
+ "enum": ["mock", "real"]
123
+ },
124
+ "dlpMockAuditId": {
125
+ "type": "string",
126
+ "description": "Optional mock audit id for explicit DLP mock dry-run. Mock-only extension fields are emitted only when this value is explicitly provided. Do not put secrets here."
127
+ },
128
+ "dlpMockDecision": {
129
+ "type": "string",
130
+ "description": "Optional DLP mock decision for dry-run only. Emitted only with an explicit dlpMockAuditId. CALL_USER is the canonical runtime value for legacy REMIND UI semantics.",
131
+ "enum": ["PASS", "BLOCK", "MARK", "REPLACE", "OPTIMIZE", "CALL_USER", "timeout", "plugin_to_backend_timeout", "llmshield_5xx", "5xx", "circuit_open", "unsupported-file"]
132
+ },
133
+ "dlpPolicyId": {
134
+ "type": "string",
135
+ "description": "Optional DLP policy id override for dry-run evidence. Backend policy id should be authoritative in real mode."
136
+ },
137
+ "dlpDetectionRefs": {
138
+ "type": "string",
139
+ "description": "Typed DLP detection refs as JSON (LabelRefs/RuleRefs/MaasRefs/CommercialDataRefs) or legacy comma separated refs for compatibility."
140
+ },
141
+ "dlpDetectionType": {
142
+ "type": "string",
143
+ "description": "DLP detection type hint for evidence.",
144
+ "enum": ["traditional_dlp", "sample_model"]
145
+ },
146
+ "dlpDegradeStrategy": {
147
+ "type": "string",
148
+ "description": "DLP degrade strategy. Defaults to fail-open; fail-close only blocks on hooks with verified direct_block capability.",
149
+ "default": "fail-open",
150
+ "enum": ["fail-open", "fail-close"]
151
+ },
152
+ "dlpTimeoutBudgetMs": {
153
+ "type": "integer",
154
+ "description": "DLP moderation timeout budget in milliseconds recorded in Extensions. Defaults to timeoutMs or 30000.",
155
+ "default": 30000
156
+ },
157
+ "dlpInputGate": {
158
+ "type": "object",
159
+ "description": "Input-side DLP gate mode for before_dispatch. marker_only only records and injects a prompt marker; direct_block returns handled/text when runtime and policy support it.",
160
+ "additionalProperties": false,
161
+ "properties": {
162
+ "mode": {
163
+ "type": "string",
164
+ "default": "marker_only",
165
+ "enum": ["marker_only", "direct_block"]
166
+ }
167
+ }
168
+ },
169
+ "dlpFileScanPolicy": {
170
+ "type": "string",
171
+ "description": "Optional JSON encoded FileScanPolicy override for supported small text file scanning and fallback actions. Supports MaxInlineScanFileSizeMB/TimeoutMs/FileTypeMatchers/FallbackActions. Defaults keep local file metadata fallbacks fail-open but fail-close remote FILE moderation timeout/unavailable/5xx/circuit-open cases, with 10MB inline limit and 1500ms timeout."
172
+ },
173
+ "dlpFileModerateEnabled": {
174
+ "type": "boolean",
175
+ "description": "Cloud-policy gate for remote LLMShield FILE multipart moderation. The data plane sends FILE multipart only when this is explicitly true and configVersion is enterprise_pro; default false avoids automatic file-scan traffic after upgrade.",
176
+ "default": false
177
+ },
178
+ "dlpFilePayloadFormat": {
179
+ "type": "string",
180
+ "description": "FILE multipart payload string format for remote file moderation. Lumen accepts the openclaw.file.v1 JSON base64 contract; legacy data_url_v1 is still accepted for backward compatibility but will be normalized to json_base64_v1.",
181
+ "default": "json_base64_v1",
182
+ "enum": ["json_base64_v1", "data_url_v1"]
183
+ },
184
+ "bootstrapSecurityMode": {
185
+ "type": "integer",
186
+ "description": "Optional local bootstrap override for SecurityMode when backend config is unavailable or unsuitable for local validation.",
187
+ "enum": [0, 1]
188
+ },
189
+ "bootstrapControlMode": {
190
+ "type": "integer",
191
+ "description": "Optional local bootstrap override for ControlMode when local validation must force monitor(1) or enforce(2).",
192
+ "enum": [1, 2]
193
+ },
194
+ "bootstrapInstanceStatus": {
195
+ "type": "string",
196
+ "description": "Optional local bootstrap override for claw instance lifecycle status used by enforcement gating."
197
+ },
198
+ "language": {
199
+ "type": "string",
200
+ "description": "Plugin language, supports 'en' (English) or 'zh' (Chinese). Default is 'en'.",
201
+ "default": "zh",
202
+ "enum": ["en", "zh"]
203
+ },
204
+ "pluginType": {
205
+ "type": "string",
206
+ "description": "Plugin deployment type. Use 'private' for private deployment."
207
+ }
208
+ }
209
+ },
210
+ "providerDiscoveryEntry": "./provider-discovery.js",
211
+ "providers": ["volcengine-aicc"],
212
+ "modelCatalog": {
213
+ "discovery": {
214
+ "volcengine-aicc": "static"
215
+ }
216
+ },
217
+ "providerAuthChoices": [
218
+ {
219
+ "provider": "volcengine-aicc",
220
+ "method": "api-key",
221
+ "choiceId": "volcengine-aicc-api-key",
222
+ "choiceLabel": "Volcengine AICC API key",
223
+ "groupId": "volcengine-aicc",
224
+ "groupLabel": "Volcengine AICC (Confidential)",
225
+ "groupHint": "API key",
226
+ "optionKey": "volcengineAiccApiKey",
227
+ "cliFlag": "--volcengine-aicc-api-key",
228
+ "cliOption": "--volcengine-aicc-api-key <key>",
229
+ "cliDescription": "Volcengine AICC API key for confidential models"
230
+ }
231
+ ]
232
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@byteplus/agent-sentry",
3
+ "version": "1.7.0",
4
+ "type": "module",
5
+ "description": "AI Assistant Security plugin for OpenClaw, to protect your LLM models and Agent lifecycle (including tool calls) from harmful requests.",
6
+ "packageManager": "pnpm@8.15.9",
7
+ "files": [
8
+ "package.json",
9
+ "bundle.js",
10
+ "provider-discovery.js",
11
+ "openclaw.plugin.json",
12
+ "README.md",
13
+ "RELEASE_NOTES.md",
14
+ "agent-sentry"
15
+ ],
16
+ "scripts": {
17
+ "test": "pnpm build:tsc && node --test \"test/*.test.mjs\"",
18
+ "publish:ppe:volcengine": "pnpm build && node scripts/publish.js --target=ppe --scope=@volcengine",
19
+ "publish:ppe:byteplus": "pnpm build && node scripts/publish.js --target=ppe --scope=@byteplus",
20
+ "publish:ppe:both": "pnpm build && node scripts/publish.js --target=ppe --scopes=@volcengine,@byteplus",
21
+ "publish:ppe:beta:volcengine": "pnpm build && node scripts/publish.js --target=ppe --tag=beta --scope=@volcengine",
22
+ "publish:ppe:beta:byteplus": "pnpm build && node scripts/publish.js --target=ppe --tag=beta --scope=@byteplus",
23
+ "publish:ppe:beta:both": "pnpm build && node scripts/publish.js --target=ppe --tag=beta --scopes=@volcengine,@byteplus",
24
+ "publish:ppe:private:volcengine": "pnpm build && node scripts/publish.js --target=ppe --tag=private --scope=@volcengine",
25
+ "publish:prod:byteplus": "pnpm build && node scripts/publish.js --target=npm --scope=@byteplus",
26
+ "publish:prod:volcengine": "pnpm build && node scripts/publish.js --target=npm --scope=@volcengine",
27
+ "publish:prod:both": "pnpm build && node scripts/publish.js --target=npm --scopes=@volcengine,@byteplus",
28
+ "publish:prod:beta:volcengine": "pnpm build && node scripts/publish.js --target=npm --tag=beta --scope=@volcengine",
29
+ "publish:prod:beta:byteplus": "pnpm build && node scripts/publish.js --target=npm --tag=beta --scope=@byteplus",
30
+ "publish:prod:beta:both": "pnpm build && node scripts/publish.js --target=npm --tag=beta --scopes=@volcengine,@byteplus",
31
+ "publish:prod:private:volcengine": "pnpm build && node scripts/publish.js --target=npm --tag=private --scope=@volcengine",
32
+ "build": "esbuild index.ts --bundle --platform=node --target=node22 --outfile=bundle.js --external:./package.json --external:openclaw --define:process.env={} && esbuild src/volcengine-aicc/provider-discovery.ts --bundle --platform=node --target=node22 --outfile=provider-discovery.js --external:./package.json --external:openclaw --define:process.env={}",
33
+ "build:tsc": "tsc"
34
+ },
35
+ "openclaw": {
36
+ "providerDiscoveryEntry": "./provider-discovery.js",
37
+ "providers": [
38
+ "volcengine-aicc"
39
+ ],
40
+ "providerAuthChoices": [
41
+ {
42
+ "provider": "volcengine-aicc",
43
+ "method": "api-key",
44
+ "default": true
45
+ }
46
+ ],
47
+ "hooks": [
48
+ "before_tool_call",
49
+ "after_tool_call",
50
+ "before_dispatch",
51
+ "before_prompt_build",
52
+ "before_agent_finalize",
53
+ "llm_input",
54
+ "agent_end"
55
+ ],
56
+ "extensions": [
57
+ "./bundle.js"
58
+ ],
59
+ "build": {
60
+ "openclawVersion": "2026.5.20"
61
+ },
62
+ "release": {
63
+ "publishToNpm": true
64
+ }
65
+ },
66
+ "peerDependencies": {
67
+ "openclaw": ">=2026.5.4"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "openclaw": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "publishConfig": {
75
+ "access": "public"
76
+ }
77
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/volcengine-aicc/provider-discovery.ts
21
+ var provider_discovery_exports = {};
22
+ __export(provider_discovery_exports, {
23
+ default: () => provider_discovery_default,
24
+ volcengineAiccProviderDiscovery: () => volcengineAiccProviderDiscovery
25
+ });
26
+ module.exports = __toCommonJS(provider_discovery_exports);
27
+
28
+ // src/volcengine-aicc/src/models.ts
29
+ var VOLCENGINE_AICC_BASE_URL = "https://sd77a0f4ummt3i4vnems0.apigateway-cn-beijing.volceapi.com/api/v3";
30
+ var VOLCENGINE_AICC_DEFAULT_MODEL_ID = "doubao-seed-2.0-pro";
31
+ var VOLCENGINE_AICC_DEFAULT_MODEL_REF = `volcengine-aicc/${VOLCENGINE_AICC_DEFAULT_MODEL_ID}`;
32
+ var VOLCENGINE_AICC_DEFAULT_COST = {
33
+ input: 1e-4,
34
+ output: 2e-4,
35
+ cacheRead: 0,
36
+ cacheWrite: 0
37
+ };
38
+ var VOLCENGINE_AICC_MODEL_CATALOG = [
39
+ {
40
+ id: "doubao-seed-2.0-pro",
41
+ name: "Doubao Seed 2.0 Pro (AICC)",
42
+ reasoning: true,
43
+ input: ["text", "image"],
44
+ contextWindow: 256e3,
45
+ maxTokens: 8192
46
+ },
47
+ {
48
+ id: "doubao-seed-2.0-lite",
49
+ name: "Doubao Seed 2.0 Lite (AICC)",
50
+ reasoning: true,
51
+ input: ["text", "image"],
52
+ contextWindow: 256e3,
53
+ maxTokens: 8192
54
+ },
55
+ {
56
+ id: "deepseek-v4-pro",
57
+ name: "DeepSeek V4 Pro (AICC)",
58
+ reasoning: true,
59
+ input: ["text", "image"],
60
+ contextWindow: 1e6,
61
+ maxTokens: 8192
62
+ },
63
+ {
64
+ id: "glm-5.1",
65
+ name: "GLM 5.1 (AICC)",
66
+ reasoning: true,
67
+ input: ["text", "image"],
68
+ contextWindow: 2e5,
69
+ maxTokens: 8192
70
+ },
71
+ {
72
+ id: "doubao-seed-2.0-lite-0428",
73
+ name: "Doubao Seed 2.0 Lite 0428 (AICC)",
74
+ reasoning: true,
75
+ input: ["text", "image"],
76
+ contextWindow: 256e3,
77
+ maxTokens: 8192
78
+ },
79
+ {
80
+ id: "glm-4.7",
81
+ name: "GLM 4.7 (AICC)",
82
+ reasoning: true,
83
+ input: ["text", "image"],
84
+ contextWindow: 2e5,
85
+ maxTokens: 8192
86
+ }
87
+ ];
88
+ function buildVolcengineAiccModelDefinition(entry, cost) {
89
+ return {
90
+ id: entry.id,
91
+ name: entry.name,
92
+ reasoning: entry.reasoning,
93
+ input: [...entry.input],
94
+ cost,
95
+ contextWindow: entry.contextWindow,
96
+ maxTokens: entry.maxTokens
97
+ };
98
+ }
99
+ function buildAiccModelDefinition(entry) {
100
+ return buildVolcengineAiccModelDefinition(entry, VOLCENGINE_AICC_DEFAULT_COST);
101
+ }
102
+
103
+ // src/volcengine-aicc/src/provider-catalog.ts
104
+ function buildVolcengineAiccProvider() {
105
+ return {
106
+ baseUrl: VOLCENGINE_AICC_BASE_URL,
107
+ auth: "api-key",
108
+ api: "openai-completions",
109
+ models: VOLCENGINE_AICC_MODEL_CATALOG.map(buildAiccModelDefinition)
110
+ };
111
+ }
112
+
113
+ // src/volcengine-aicc/provider-discovery.ts
114
+ var volcengineAiccProviderDiscovery = {
115
+ id: "volcengine-aicc",
116
+ label: "Volcengine AICC",
117
+ docsPath: "/concepts/model-providers#volcengine-aicc",
118
+ auth: [],
119
+ staticCatalog: {
120
+ order: "simple",
121
+ run: async () => ({
122
+ provider: buildVolcengineAiccProvider()
123
+ })
124
+ }
125
+ };
126
+ var provider_discovery_default = volcengineAiccProviderDiscovery;
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ volcengineAiccProviderDiscovery
130
+ });