cclawd 2026.3.34 → 2026.3.35
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/.buildstamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1778822986200,"head":"31444ae6c3e331562a346b9be6388cdc2ec1189a"}
|
package/dist/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as openclawHome } from "../../env-CcGPS0ln.js";
|
|
2
|
-
import { c as loadJsonSync, i as setDashboardPort } from "../../gateway-manager-
|
|
2
|
+
import { c as loadJsonSync, i as setDashboardPort } from "../../gateway-manager-CF7sxwxC.js";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as openclawHome, n as envApiKey, t as defaultCoreUrl } from "../../env-CcGPS0ln.js";
|
|
2
|
-
import { a as startGateway, c as loadJsonSync, i as setDashboardPort, l as loadTextSafe, n as enableGateway, o as stopGateway, r as getGatewayStatus, s as loadJsonSafe, t as disableGateway, u as loadTextSync } from "../../gateway-manager-
|
|
2
|
+
import { a as startGateway, c as loadJsonSync, i as setDashboardPort, l as loadTextSafe, n as enableGateway, o as stopGateway, r as getGatewayStatus, s as loadJsonSafe, t as disableGateway, u as loadTextSync } from "../../gateway-manager-CF7sxwxC.js";
|
|
3
3
|
import fs, { existsSync, mkdirSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import os, { networkInterfaces } from "node:os";
|
|
@@ -1644,6 +1644,7 @@ let profileDebounceTimer = null;
|
|
|
1644
1644
|
let personalDashboardStarted = false;
|
|
1645
1645
|
const llmInputTimestamps = /* @__PURE__ */ new Map();
|
|
1646
1646
|
let autoScanEnabled = false;
|
|
1647
|
+
let gatewayBootstrapPromise = null;
|
|
1647
1648
|
/**
|
|
1648
1649
|
* Previously wrote default config to openclaw.json on first load.
|
|
1649
1650
|
* Now a no-op — we don't modify openclaw.json automatically.
|
|
@@ -1692,14 +1693,20 @@ const openClawGuardPlugin = {
|
|
|
1692
1693
|
},
|
|
1693
1694
|
register(api) {
|
|
1694
1695
|
const log = createLogger(api.logger);
|
|
1695
|
-
|
|
1696
|
+
if (!gatewayBootstrapPromise) gatewayBootstrapPromise = (async () => {
|
|
1697
|
+
await startGateway();
|
|
1696
1698
|
log.debug?.("AI Security Gateway started");
|
|
1697
|
-
|
|
1699
|
+
try {
|
|
1700
|
+
const res = await enableGateway();
|
|
1698
1701
|
log.info(`AI Security Gateway auto-enabled for: ${res.providers.join(", ")}`);
|
|
1699
|
-
}
|
|
1702
|
+
} catch (err) {
|
|
1700
1703
|
log.debug?.(`Gateway auto-enable skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
1701
|
-
}
|
|
1702
|
-
}).catch((err) =>
|
|
1704
|
+
}
|
|
1705
|
+
})().catch((err) => {
|
|
1706
|
+
gatewayBootstrapPromise = null;
|
|
1707
|
+
throw err;
|
|
1708
|
+
});
|
|
1709
|
+
gatewayBootstrapPromise.catch((err) => log.error(`Failed to start AI Security Gateway: ${err}`));
|
|
1703
1710
|
const DASHBOARD_PORT = 53667;
|
|
1704
1711
|
setDashboardPort(DASHBOARD_PORT);
|
|
1705
1712
|
log.debug?.(`Gateway activity reporting enabled on port ${DASHBOARD_PORT}`);
|
|
@@ -1567,6 +1567,7 @@ function isGatewayUrl(baseUrl) {
|
|
|
1567
1567
|
return baseUrl.startsWith(GATEWAY_SERVER_URL);
|
|
1568
1568
|
}
|
|
1569
1569
|
let gatewayRunning = false;
|
|
1570
|
+
let gatewayStartPromise = null;
|
|
1570
1571
|
let dashboardPort = null;
|
|
1571
1572
|
let dashboardToken = null;
|
|
1572
1573
|
/**
|
|
@@ -1639,37 +1640,46 @@ async function waitForPortAvailable(port, timeoutMs = 1e4) {
|
|
|
1639
1640
|
* Start the gateway server (in-process, embedded mode)
|
|
1640
1641
|
*/
|
|
1641
1642
|
async function startGateway() {
|
|
1642
|
-
|
|
1643
|
-
if (
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1643
|
+
if (isGatewayServerRunning() || gatewayRunning) return;
|
|
1644
|
+
if (gatewayStartPromise) return gatewayStartPromise;
|
|
1645
|
+
gatewayStartPromise = (async () => {
|
|
1646
|
+
mkdirSync(CCLAWD_GUARD_DATA_DIR, { recursive: true });
|
|
1647
|
+
if (!existsSync(GATEWAY_CONFIG)) {
|
|
1648
|
+
const defaultConfig = {
|
|
1649
|
+
port: DEFAULT_GATEWAY_PORT,
|
|
1650
|
+
backends: {}
|
|
1651
|
+
};
|
|
1652
|
+
writeFileSync(GATEWAY_CONFIG, JSON.stringify(defaultConfig, null, 2) + "\n", "utf-8");
|
|
1653
|
+
}
|
|
1654
|
+
tryRepairGatewayConfigFromBackup();
|
|
1655
|
+
if (!activityListenerRegistered) {
|
|
1656
|
+
addActivityListener((event) => {
|
|
1657
|
+
reportActivity(event).catch((err) => {
|
|
1658
|
+
console.error("[cclawd-guard] Failed to report activity:", err);
|
|
1659
|
+
});
|
|
1660
|
+
if (event.type === "sanitize" && event.redactionCount > 0 && gatewayActivityCallback);
|
|
1655
1661
|
});
|
|
1656
|
-
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1662
|
+
activityListenerRegistered = true;
|
|
1663
|
+
}
|
|
1664
|
+
if (await isPortInUse(DEFAULT_GATEWAY_PORT)) {
|
|
1665
|
+
if (!await waitForPortAvailable(DEFAULT_GATEWAY_PORT, 1e4)) {
|
|
1666
|
+
console.error(`[cclawd-guard] Gateway port ${DEFAULT_GATEWAY_PORT} is still in use after waiting`);
|
|
1667
|
+
gatewayRunning = false;
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
try {
|
|
1672
|
+
startGateway$1(GATEWAY_CONFIG, true);
|
|
1673
|
+
gatewayRunning = true;
|
|
1674
|
+
} catch (err) {
|
|
1675
|
+
console.error("[cclawd-guard] Failed to start gateway:", err);
|
|
1663
1676
|
gatewayRunning = false;
|
|
1664
|
-
return;
|
|
1665
1677
|
}
|
|
1666
|
-
}
|
|
1678
|
+
})();
|
|
1667
1679
|
try {
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
console.error("[cclawd-guard] Failed to start gateway:", err);
|
|
1672
|
-
gatewayRunning = false;
|
|
1680
|
+
await gatewayStartPromise;
|
|
1681
|
+
} finally {
|
|
1682
|
+
gatewayStartPromise = null;
|
|
1673
1683
|
}
|
|
1674
1684
|
}
|
|
1675
1685
|
/**
|
|
@@ -1678,7 +1688,7 @@ async function startGateway() {
|
|
|
1678
1688
|
async function restartGateway() {
|
|
1679
1689
|
await stopGateway$1();
|
|
1680
1690
|
gatewayRunning = false;
|
|
1681
|
-
startGateway();
|
|
1691
|
+
await startGateway();
|
|
1682
1692
|
}
|
|
1683
1693
|
/**
|
|
1684
1694
|
* Stop the gateway server completely
|