@openclawcity/become 1.0.11 → 1.0.13
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/cli.cjs +18 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +18 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -770,16 +770,18 @@ function createProxyServer(config, analyzer) {
|
|
|
770
770
|
return cachedSkills;
|
|
771
771
|
}
|
|
772
772
|
const server = (0, import_node_http.createServer)(async (req, res) => {
|
|
773
|
+
console.log(`[become] ${req.method} ${req.url}`);
|
|
773
774
|
if (req.url === "/health" && req.method === "GET") {
|
|
774
775
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
775
776
|
res.end(JSON.stringify({ status: "ok", ...stats }));
|
|
776
777
|
return;
|
|
777
778
|
}
|
|
778
|
-
const
|
|
779
|
-
const
|
|
780
|
-
if (
|
|
779
|
+
const url = req.url ?? "";
|
|
780
|
+
const isLLMRequest = req.method === "POST" && (url.includes("/chat/completions") || url.includes("/messages") || url === "/" || url.startsWith("/v1"));
|
|
781
|
+
if (!isLLMRequest) {
|
|
782
|
+
console.log(`[become] rejected: ${req.method} ${url}`);
|
|
781
783
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
782
|
-
res.end(JSON.stringify({ error:
|
|
784
|
+
res.end(JSON.stringify({ error: `Not an LLM endpoint: ${req.method} ${url}` }));
|
|
783
785
|
return;
|
|
784
786
|
}
|
|
785
787
|
try {
|
|
@@ -1622,15 +1624,24 @@ Connected to: ${config.agent_type}${config.openclaw_agent_id ? ` (agent: ${confi
|
|
|
1622
1624
|
console.log(`[become] ${s.requests_forwarded} requests forwarded, ${s.skills_injected} skills injected, ${s.lessons_extracted} lessons extracted`);
|
|
1623
1625
|
}
|
|
1624
1626
|
}, 6e4);
|
|
1625
|
-
|
|
1627
|
+
let shuttingDown = false;
|
|
1628
|
+
const shutdown = () => {
|
|
1629
|
+
if (shuttingDown) {
|
|
1630
|
+
process.exit(0);
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
shuttingDown = true;
|
|
1626
1634
|
clearInterval(activityInterval);
|
|
1627
1635
|
console.log("\nShutting down...");
|
|
1628
1636
|
try {
|
|
1629
1637
|
turnOff();
|
|
1630
1638
|
} catch {
|
|
1631
1639
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1640
|
+
proxy.close().catch(() => {
|
|
1641
|
+
});
|
|
1642
|
+
dashboard.close().catch(() => {
|
|
1643
|
+
});
|
|
1644
|
+
setTimeout(() => process.exit(0), 500);
|
|
1634
1645
|
};
|
|
1635
1646
|
process.on("SIGINT", shutdown);
|
|
1636
1647
|
process.on("SIGTERM", shutdown);
|