@opentrust/guards 7.3.20 → 7.3.22

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/agent/types.ts CHANGED
@@ -17,7 +17,7 @@ export type OpenClawGuardConfig = {
17
17
  enabled?: boolean;
18
18
  /** 检测到风险时是否阻断执行 */
19
19
  blockOnRisk?: boolean;
20
- /** Core 平台 API Keysk-og-xxx 格式),为空时自动注册 */
20
+ /** API Key: sk-ot-xxx (System API Key) or sk-og-xxx (Core key). Empty = auto-register via Core */
21
21
  apiKey?: string;
22
22
  /** 请求超时时间(毫秒) */
23
23
  timeoutMs?: number;
@@ -2,7 +2,7 @@
2
2
  "id": "opentrust-guard",
3
3
  "name": "OpenTrust Guard",
4
4
  "description": "AI security guard for OpenClaw agents: prompt injection detection, credential scanning, and behavioral monitoring.",
5
- "version": "7.3.20",
5
+ "version": "7.3.22",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentrust/guards",
3
- "version": "7.3.20",
3
+ "version": "7.3.22",
4
4
  "description": "AI agent security plugin for OpenClaw: prompt injection detection, PII sanitization, and monitoring",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -172,11 +172,16 @@ export function register(
172
172
 
173
173
  // ── 凭证加载/注册 ───────────────────────────────────
174
174
  if (!state.coreCredentials) {
175
- if (config.apiKey) {
176
- // 使用用户配置的 API Key
175
+ if (config.apiKey?.startsWith("sk-ot-")) {
176
+ // System API Key from Dashboard — skip Core registration entirely
177
+ state.coreCredentials = { apiKey: config.apiKey, agentId: "configured", claimUrl: "", verificationCode: "", email: "system@opentrust" };
178
+ state.behaviorDetector.setCredentials(state.coreCredentials);
179
+ log.info("Platform: using System API Key (sk-ot-*)");
180
+ } else if (config.apiKey) {
181
+ // Core API Key (sk-og-*)
177
182
  state.coreCredentials = { apiKey: config.apiKey, agentId: "configured", claimUrl: "", verificationCode: "" };
178
183
  state.behaviorDetector.setCredentials(state.coreCredentials);
179
- log.info("Platform: using configured API key");
184
+ log.info("Platform: using configured Core API key");
180
185
  } else {
181
186
  // 尝试从本地文件加载已保存的凭证
182
187
  state.coreCredentials = loadCoreCredentials();