@openbmb/clawxrouter 1.0.4 → 2026.3.9

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/index.ts CHANGED
@@ -75,8 +75,8 @@ function resolveProxyApi(originalApi: string): string {
75
75
  }
76
76
 
77
77
  export default definePluginEntry({
78
- id: "ClawXRouter",
79
- name: "ClawXRouter",
78
+ id: "clawxrouter",
79
+ name: "ClawXrouter",
80
80
  description: "Privacy-aware plugin with extensible router pipeline, guard agent, and built-in privacy proxy",
81
81
  configSchema: clawXrouterConfigSchema,
82
82
 
@@ -1,7 +1,7 @@
1
1
  {
2
- "id": "ClawXRouter",
3
- "name": "ClawXRouter",
4
- "description": "Edge-cloud collaborative routing plugin that keeps sensitive data local and routes tasks to cost-effective models — protects user privacy by classifying requests into three safety levels and redacting PII before any cloud forwarding",
2
+ "id": "clawxrouter",
3
+ "name": "ClawXrouter",
4
+ "description": "Privacy-aware plugin with sensitivity detection, guard agent support, and built-in privacy proxy",
5
5
  "configSchema": {
6
6
  "type": "object",
7
7
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openbmb/clawxrouter",
3
- "version": "1.0.4",
4
- "description": "Edge-cloud collaborative routing plugin that keeps sensitive data local and routes tasks to cost-effective models — protects user privacy by classifying requests into three safety levels and redacting PII before any cloud forwarding",
3
+ "version": "2026.3.9",
4
+ "description": "Privacy-aware plugin with sensitivity detection, guard agent support, and built-in privacy proxy",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
7
7
  "exports": {
@@ -24,7 +24,7 @@
24
24
  "license": "MIT",
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "https://github.com/OpenBMB/ClawXRouter"
27
+ "url": "https://github.com/openclaw/clawxrouter"
28
28
  },
29
29
  "dependencies": {
30
30
  "@sinclair/typebox": "0.34.48",
@@ -34,13 +34,7 @@
34
34
  "openclaw": {
35
35
  "extensions": [
36
36
  "./index.ts"
37
- ],
38
- "compat": {
39
- "pluginApi": ">=2026.3.22"
40
- },
41
- "build": {
42
- "openclawVersion": "2026.3.28"
43
- }
37
+ ]
44
38
  },
45
39
  "devDependencies": {
46
40
  "vitest": "^4.1.0"
@@ -1,4 +1,6 @@
1
1
  import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
3
+ import { join } from "node:path";
2
4
  import { getGlobalCollector, onTokenUpdate } from "./token-stats.js";
3
5
  import { getLiveConfig, updateLiveConfig } from "./live-config.js";
4
6
  import { getAllSessionStates, getSessionState, getLastInputEstimate, onDetection, getLoopMeta, clearAllSessionStates } from "./session-state.js";
@@ -7,7 +9,27 @@ import { DEFAULT_JUDGE_PROMPT } from "./routers/token-saver.js";
7
9
  import { DEFAULT_DETECTION_SYSTEM_PROMPT, DEFAULT_PII_EXTRACTION_PROMPT } from "./local-model.js";
8
10
  import type { RouterPipeline } from "./router-pipeline.js";
9
11
  import { createConfigurableRouter } from "./routers/configurable.js";
10
- import { saveClawXrouterConfig } from "./dashboard-config-io.js";
12
+
13
+ const CLAWXROUTER_CONFIG_PATH = join(
14
+ process.env.HOME ?? "/tmp",
15
+ ".openclaw",
16
+ "clawxrouter.json",
17
+ );
18
+
19
+ function saveClawXrouterConfig(privacy: Record<string, unknown>): void {
20
+ try {
21
+ const dir = join(process.env.HOME ?? "/tmp", ".openclaw");
22
+ mkdirSync(dir, { recursive: true });
23
+ let existing: Record<string, unknown> = {};
24
+ try {
25
+ existing = JSON.parse(readFileSync(CLAWXROUTER_CONFIG_PATH, "utf-8")) as Record<string, unknown>;
26
+ } catch { /* file may not exist yet */ }
27
+ const updated = { ...existing, privacy };
28
+ writeFileSync(CLAWXROUTER_CONFIG_PATH, JSON.stringify(updated, null, 2), "utf-8");
29
+ } catch {
30
+ // best-effort persistence
31
+ }
32
+ }
11
33
 
12
34
  export type DashboardDeps = {
13
35
  pluginId: string;
@@ -1,25 +0,0 @@
1
- import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
2
- import { join } from "node:path";
3
-
4
- const HOME_DIR = process.env.HOME ?? "/tmp";
5
-
6
- export const CLAWXROUTER_CONFIG_PATH = join(
7
- HOME_DIR,
8
- ".openclaw",
9
- "clawxrouter.json",
10
- );
11
-
12
- export function saveClawXrouterConfig(privacy: Record<string, unknown>): void {
13
- try {
14
- const dir = join(HOME_DIR, ".openclaw");
15
- mkdirSync(dir, { recursive: true });
16
- let existing: Record<string, unknown> = {};
17
- try {
18
- existing = JSON.parse(readFileSync(CLAWXROUTER_CONFIG_PATH, "utf-8")) as Record<string, unknown>;
19
- } catch { /* file may not exist yet */ }
20
- const updated = { ...existing, privacy };
21
- writeFileSync(CLAWXROUTER_CONFIG_PATH, JSON.stringify(updated, null, 2), "utf-8");
22
- } catch {
23
- // best-effort persistence
24
- }
25
- }