@solongate/proxy 0.1.14 → 0.1.16
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/dist/create.js +1 -1
- package/dist/index.js +34 -28
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -283,7 +283,7 @@ async function main() {
|
|
|
283
283
|
bLine(`${c.yellow}Use with OpenClaw:${c.reset}`);
|
|
284
284
|
bEmpty();
|
|
285
285
|
bLine(` ${c.cyan}$${c.reset} solongate-proxy -- npx @openclaw/server`);
|
|
286
|
-
bLine(` ${c.dim}Wraps
|
|
286
|
+
bLine(` ${c.dim}Wraps OpenClaw servers with SolonGate protection${c.reset}`);
|
|
287
287
|
bEmpty();
|
|
288
288
|
log(` ${c.dim}\u251C${hr}\u2524${c.reset}`);
|
|
289
289
|
bEmpty();
|
package/dist/index.js
CHANGED
|
@@ -944,7 +944,7 @@ async function main3() {
|
|
|
944
944
|
bLine(`${c2.yellow}Use with OpenClaw:${c2.reset}`);
|
|
945
945
|
bEmpty();
|
|
946
946
|
bLine(` ${c2.cyan}$${c2.reset} solongate-proxy -- npx @openclaw/server`);
|
|
947
|
-
bLine(` ${c2.dim}Wraps
|
|
947
|
+
bLine(` ${c2.dim}Wraps OpenClaw servers with SolonGate protection${c2.reset}`);
|
|
948
948
|
bEmpty();
|
|
949
949
|
log3(` ${c2.dim}\u251C${hr}\u2524${c2.reset}`);
|
|
950
950
|
bEmpty();
|
|
@@ -3149,35 +3149,41 @@ var SolonGateProxy = class {
|
|
|
3149
3149
|
log("Starting SolonGate Proxy...");
|
|
3150
3150
|
const apiUrl = this.config.apiUrl ?? "https://api.solongate.com";
|
|
3151
3151
|
if (this.config.apiKey) {
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3152
|
+
if (this.config.apiKey.startsWith("sg_test_")) {
|
|
3153
|
+
log("Using test API key \u2014 skipping online validation.");
|
|
3154
|
+
} else {
|
|
3155
|
+
log(`Validating license with ${apiUrl}...`);
|
|
3156
|
+
try {
|
|
3157
|
+
const res = await fetch(`${apiUrl}/api/v1/auth/me`, {
|
|
3158
|
+
headers: {
|
|
3159
|
+
"X-API-Key": this.config.apiKey,
|
|
3160
|
+
"Authorization": `Bearer ${this.config.apiKey}`
|
|
3161
|
+
},
|
|
3162
|
+
signal: AbortSignal.timeout(1e4)
|
|
3163
|
+
});
|
|
3164
|
+
if (res.status === 401) {
|
|
3165
|
+
log("ERROR: Invalid or expired API key.");
|
|
3166
|
+
process.exit(1);
|
|
3167
|
+
}
|
|
3168
|
+
if (res.status === 403) {
|
|
3169
|
+
log("ERROR: Your subscription is inactive. Renew at https://solongate.com");
|
|
3170
|
+
process.exit(1);
|
|
3171
|
+
}
|
|
3172
|
+
log("License validated.");
|
|
3173
|
+
} catch (err) {
|
|
3174
|
+
log(`ERROR: Unable to reach SolonGate license server. Check your internet connection.`);
|
|
3175
|
+
log(`Details: ${err instanceof Error ? err.message : String(err)}`);
|
|
3167
3176
|
process.exit(1);
|
|
3168
3177
|
}
|
|
3169
|
-
log("License validated.");
|
|
3170
|
-
} catch (err) {
|
|
3171
|
-
log(`ERROR: Unable to reach SolonGate license server. Check your internet connection.`);
|
|
3172
|
-
log(`Details: ${err instanceof Error ? err.message : String(err)}`);
|
|
3173
|
-
process.exit(1);
|
|
3174
3178
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3179
|
+
if (!this.config.apiKey.startsWith("sg_test_")) {
|
|
3180
|
+
try {
|
|
3181
|
+
const cloudPolicy = await fetchCloudPolicy(this.config.apiKey, apiUrl);
|
|
3182
|
+
this.config.policy = cloudPolicy;
|
|
3183
|
+
log(`Loaded cloud policy: ${cloudPolicy.name} (${cloudPolicy.rules.length} rules)`);
|
|
3184
|
+
} catch (err) {
|
|
3185
|
+
log(`Cloud policy fetch failed, using local policy: ${err instanceof Error ? err.message : String(err)}`);
|
|
3186
|
+
}
|
|
3181
3187
|
}
|
|
3182
3188
|
}
|
|
3183
3189
|
log(`Policy: ${this.config.policy.name} (${this.config.policy.rules.length} rules)`);
|
|
@@ -3296,7 +3302,7 @@ var SolonGateProxy = class {
|
|
|
3296
3302
|
const decision = result.isError ? "DENY" : "ALLOW";
|
|
3297
3303
|
const evaluationTimeMs = Date.now() - startTime;
|
|
3298
3304
|
log(`Result: ${decision} (${evaluationTimeMs}ms)`);
|
|
3299
|
-
if (this.config.apiKey) {
|
|
3305
|
+
if (this.config.apiKey && !this.config.apiKey.startsWith("sg_test_")) {
|
|
3300
3306
|
const apiUrl = this.config.apiUrl ?? "https://api.solongate.com";
|
|
3301
3307
|
sendAuditLog(this.config.apiKey, apiUrl, {
|
|
3302
3308
|
tool: name,
|
package/package.json
CHANGED