openclaw-safeclaw-plugin 0.9.1 → 0.9.2
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/cli.tsx +31 -1
- package/dist/cli.js +33 -1
- package/package.json +1 -1
package/cli.tsx
CHANGED
|
@@ -134,7 +134,37 @@ if (command === 'connect') {
|
|
|
134
134
|
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
135
135
|
chmodSync(configPath, 0o600);
|
|
136
136
|
|
|
137
|
-
console.log(`
|
|
137
|
+
console.log(`API key saved to ${configPath}`);
|
|
138
|
+
|
|
139
|
+
// Validate key via handshake
|
|
140
|
+
try {
|
|
141
|
+
const res = await fetch(`${serviceUrl}/handshake`, {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
headers: {
|
|
144
|
+
'Content-Type': 'application/json',
|
|
145
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
146
|
+
},
|
|
147
|
+
body: JSON.stringify({ pluginVersion: '0.1.3', configHash: '' }),
|
|
148
|
+
signal: AbortSignal.timeout(5000),
|
|
149
|
+
});
|
|
150
|
+
if (res.ok) {
|
|
151
|
+
const data = await res.json() as Record<string, unknown>;
|
|
152
|
+
console.log(`Connected! org=${data.orgId}, scope=${data.scope}`);
|
|
153
|
+
} else {
|
|
154
|
+
let detail = `HTTP ${res.status}`;
|
|
155
|
+
try {
|
|
156
|
+
const body = await res.json() as Record<string, unknown>;
|
|
157
|
+
detail = (body.error ?? body.detail ?? detail) as string;
|
|
158
|
+
} catch { /* ignore */ }
|
|
159
|
+
console.warn(`Warning: API key saved but handshake failed — ${detail}`);
|
|
160
|
+
if (res.status === 401) {
|
|
161
|
+
console.warn('The key may be invalid or revoked. Check https://safeclaw.eu/dashboard');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} catch {
|
|
165
|
+
console.warn(`Warning: API key saved but could not reach ${serviceUrl}`);
|
|
166
|
+
console.warn('Run "safeclaw status" later to verify the connection.');
|
|
167
|
+
}
|
|
138
168
|
|
|
139
169
|
// Register with OpenClaw
|
|
140
170
|
console.log('Registering SafeClaw plugin with OpenClaw...');
|
package/dist/cli.js
CHANGED
|
@@ -119,7 +119,39 @@ if (command === 'connect') {
|
|
|
119
119
|
mkdirSync(configDir, { recursive: true });
|
|
120
120
|
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
121
121
|
chmodSync(configPath, 0o600);
|
|
122
|
-
console.log(`
|
|
122
|
+
console.log(`API key saved to ${configPath}`);
|
|
123
|
+
// Validate key via handshake
|
|
124
|
+
try {
|
|
125
|
+
const res = await fetch(`${serviceUrl}/handshake`, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
130
|
+
},
|
|
131
|
+
body: JSON.stringify({ pluginVersion: '0.1.3', configHash: '' }),
|
|
132
|
+
signal: AbortSignal.timeout(5000),
|
|
133
|
+
});
|
|
134
|
+
if (res.ok) {
|
|
135
|
+
const data = await res.json();
|
|
136
|
+
console.log(`Connected! org=${data.orgId}, scope=${data.scope}`);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
let detail = `HTTP ${res.status}`;
|
|
140
|
+
try {
|
|
141
|
+
const body = await res.json();
|
|
142
|
+
detail = (body.error ?? body.detail ?? detail);
|
|
143
|
+
}
|
|
144
|
+
catch { /* ignore */ }
|
|
145
|
+
console.warn(`Warning: API key saved but handshake failed — ${detail}`);
|
|
146
|
+
if (res.status === 401) {
|
|
147
|
+
console.warn('The key may be invalid or revoked. Check https://safeclaw.eu/dashboard');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
console.warn(`Warning: API key saved but could not reach ${serviceUrl}`);
|
|
153
|
+
console.warn('Run "safeclaw status" later to verify the connection.');
|
|
154
|
+
}
|
|
123
155
|
// Register with OpenClaw
|
|
124
156
|
console.log('Registering SafeClaw plugin with OpenClaw...');
|
|
125
157
|
const registered = registerWithOpenClaw();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-safeclaw-plugin",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "SafeClaw Neurosymbolic Governance plugin for OpenClaw — validates AI agent actions against OWL ontologies and SHACL constraints",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|