@opentrust/guards 7.3.10 → 7.3.12
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.
|
@@ -15,6 +15,8 @@ export function executeCommand(cmd: RemoteCommand, log: Logger): CommandResult {
|
|
|
15
15
|
switch (cmd.type) {
|
|
16
16
|
case "install_skill":
|
|
17
17
|
return executeSkillInstall(cmd.payload, log);
|
|
18
|
+
case "install_custom_skill":
|
|
19
|
+
return executeCustomSkillInstall(cmd.payload, log);
|
|
18
20
|
case "uninstall_skill":
|
|
19
21
|
return executeSkillUninstall(cmd.payload, log);
|
|
20
22
|
case "update_config":
|
|
@@ -30,7 +32,7 @@ function executeSkillInstall(payload: Record<string, unknown> | null, log: Logge
|
|
|
30
32
|
|
|
31
33
|
try {
|
|
32
34
|
log.info(`Command: installing skill "${skillName}"...`);
|
|
33
|
-
const output = execSync(`
|
|
35
|
+
const output = execSync(`clawhub install ${skillName}`, {
|
|
34
36
|
encoding: "utf-8",
|
|
35
37
|
timeout: 120_000,
|
|
36
38
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -44,13 +46,51 @@ function executeSkillInstall(payload: Record<string, unknown> | null, log: Logge
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
function executeCustomSkillInstall(payload: Record<string, unknown> | null, log: Logger): CommandResult {
|
|
50
|
+
const skillName = payload?.skillName as string;
|
|
51
|
+
const content = payload?.content as string;
|
|
52
|
+
if (!skillName || !content) {
|
|
53
|
+
return { success: false, error: "Missing skillName or content in payload" };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const skillsDir = path.join(
|
|
58
|
+
process.env.OPENCLAW_HOME || path.join(os.homedir(), ".openclaw"),
|
|
59
|
+
"skills",
|
|
60
|
+
);
|
|
61
|
+
const skillDir = path.join(skillsDir, skillName);
|
|
62
|
+
|
|
63
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
64
|
+
|
|
65
|
+
const fileName = "SKILL.md";
|
|
66
|
+
fs.writeFileSync(path.join(skillDir, fileName), content, "utf-8");
|
|
67
|
+
|
|
68
|
+
log.info(`Command: custom skill "${skillName}" written to ${skillDir}/${fileName}`);
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
const output = execSync(`clawhub install ${skillDir}`, {
|
|
72
|
+
encoding: "utf-8",
|
|
73
|
+
timeout: 120_000,
|
|
74
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
75
|
+
});
|
|
76
|
+
return { success: true, output: output.trim() };
|
|
77
|
+
} catch {
|
|
78
|
+
return { success: true, output: `Custom skill "${skillName}" saved to ${skillDir}/${fileName}` };
|
|
79
|
+
}
|
|
80
|
+
} catch (err: any) {
|
|
81
|
+
const msg = err.message || String(err);
|
|
82
|
+
log.warn(`Command: custom skill install failed — ${msg}`);
|
|
83
|
+
return { success: false, error: msg.slice(0, 500) };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
47
87
|
function executeSkillUninstall(payload: Record<string, unknown> | null, log: Logger): CommandResult {
|
|
48
88
|
const skillName = payload?.skillName as string;
|
|
49
89
|
if (!skillName) return { success: false, error: "Missing skillName in payload" };
|
|
50
90
|
|
|
51
91
|
try {
|
|
52
92
|
log.info(`Command: uninstalling skill "${skillName}"...`);
|
|
53
|
-
const output = execSync(`
|
|
93
|
+
const output = execSync(`clawhub uninstall ${skillName}`, {
|
|
54
94
|
encoding: "utf-8",
|
|
55
95
|
timeout: 60_000,
|
|
56
96
|
stdio: ["pipe", "pipe", "pipe"],
|
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
5
|
+
"version": "7.3.12",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
package/package.json
CHANGED
package/platform-client/types.ts
CHANGED
|
@@ -111,7 +111,7 @@ export type ToolCallObservationRequest = {
|
|
|
111
111
|
export type RemoteCommand = {
|
|
112
112
|
id: string;
|
|
113
113
|
agentId: string;
|
|
114
|
-
type: "install_skill" | "uninstall_skill" | "update_config";
|
|
114
|
+
type: "install_skill" | "install_custom_skill" | "uninstall_skill" | "update_config";
|
|
115
115
|
payload: Record<string, unknown> | null;
|
|
116
116
|
status: string;
|
|
117
117
|
createdAt: string;
|