limits-openclaw 0.0.8 → 0.0.11
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/README.md +30 -30
- package/dist/config.js +1 -1
- package/dist/configure-wizard.js +6 -6
- package/dist/index.js +2 -2
- package/dist/logger.js +2 -2
- package/openclaw.plugin.json +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# limits-openclaw
|
|
1
|
+
# limits-openclaw
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/limits-openclaw)
|
|
3
|
+
[](https://www.npmjs.com/package/limits-openclaw )
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
|
-
[](https://github.com/limitsdev/limits-openclaw)
|
|
7
|
+
[](https://github.com/limitsdev/limits-openclaw )
|
|
8
8
|
|
|
9
9
|
**Official** OpenClaw plugin for the [Limits](https://limits.dev) platform. Delegates policy enforcement via HTTP. Every decision is made by calling `POST {baseUrl}/openclaw/enforce` before and after each tool call. Optional policy-generator tools let the agent create and update policies from natural language.
|
|
10
10
|
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install limits-openclaw
|
|
34
|
+
npm install limits-openclaw
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
yarn add limits-openclaw
|
|
38
|
+
yarn add limits-openclaw
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
pnpm add limits-openclaw
|
|
42
|
+
pnpm add limits-openclaw
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Then register the plugin with OpenClaw:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
openclaw plugins install ./node_modules/limits-openclaw
|
|
49
|
-
openclaw plugins enable "limits-openclaw"
|
|
48
|
+
openclaw plugins install ./node_modules/limits-openclaw
|
|
50
49
|
openclaw gateway restart
|
|
50
|
+
openclaw plugins enable "limits-openclaw "
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
---
|
|
@@ -64,7 +64,7 @@ openclaw limits configure
|
|
|
64
64
|
If you see **`error: unknown command 'limits'`**, the OpenClaw CLI may not load plugin commands in your environment. Run the configure script directly (from a directory where the package is installed):
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
node node_modules/limits-openclaw/scripts/configure.js
|
|
67
|
+
node node_modules/limits-openclaw /scripts/configure.js
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Or set config manually:
|
|
@@ -73,7 +73,7 @@ Or set config manually:
|
|
|
73
73
|
{
|
|
74
74
|
"plugins": {
|
|
75
75
|
"entries": {
|
|
76
|
-
"limits-openclaw": {
|
|
76
|
+
"limits-openclaw ": {
|
|
77
77
|
"enabled": true,
|
|
78
78
|
"config": {
|
|
79
79
|
"apiToken": "sk_your_organization_api_key"
|
|
@@ -92,7 +92,7 @@ Or set config manually:
|
|
|
92
92
|
"list": [
|
|
93
93
|
{
|
|
94
94
|
"id": "main",
|
|
95
|
-
"tools": { "allow": ["limits-openclaw"] }
|
|
95
|
+
"tools": { "allow": ["limits-openclaw "] }
|
|
96
96
|
}
|
|
97
97
|
]
|
|
98
98
|
}
|
|
@@ -127,7 +127,7 @@ flowchart LR
|
|
|
127
127
|
1. **Before each tool call** (`before_tool_call`): the plugin POSTs `phase: "pre"` with tool name and args. Limits returns `ALLOW`, `BLOCK`, or `REWRITE` (with `rewriteArgs`). The plugin blocks the call, allows it, or replaces the tool arguments accordingly.
|
|
128
128
|
2. **After each tool call** (`after_tool_call`): the plugin POSTs `phase: "post"` with tool name, args, and result. Limits returns `ALLOW`, `BLOCK`, `REDACT`, or `REWRITE` (with `redactedResult` or `rewrittenResult`). The plugin leaves the result unchanged, replaces it with a safe blocked response, or replaces it with the redacted/rewritten value.
|
|
129
129
|
|
|
130
|
-
**Compatibility:** This plugin requires an OpenClaw build where tool hooks are wired into the execution path. If you see **`[limits-openclaw] before_tool_call observed`** in logs once after a tool runs, hooks are working. See [OpenClaw #6535](https://github.com/openclaw/openclaw/issues/6535) if hooks never fire.
|
|
130
|
+
**Compatibility:** This plugin requires an OpenClaw build where tool hooks are wired into the execution path. If you see **`[limits-openclaw ] before_tool_call observed`** in logs once after a tool runs, hooks are working. See [OpenClaw #6535](https://github.com/openclaw/openclaw/issues/6535) if hooks never fire.
|
|
131
131
|
|
|
132
132
|
---
|
|
133
133
|
|
|
@@ -150,16 +150,16 @@ Optionally, you can copy it manually. The example below is for Unix; on Windows
|
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
mkdir -p ~/.openclaw/workspace/skills/limits-policy-generator
|
|
153
|
-
cp -r ./node_modules/limits-openclaw/skills/limits-policy-generator/. ~/.openclaw/workspace/skills/limits-policy-generator/
|
|
153
|
+
cp -r ./node_modules/limits-openclaw /skills/limits-policy-generator/. ~/.openclaw/workspace/skills/limits-policy-generator/
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
### Expose tools to the agent
|
|
157
157
|
|
|
158
|
-
The plugin registers these tools as **optional**. Add the plugin to the agent's tool allowlist (see [Quick Start](#quick-start)) so the agent can call them. Use `"limits-openclaw"` to allow all tools from this plugin, or allow by name: `["limits_generate_create_policy", "limits_generate_update_policy"]`.
|
|
158
|
+
The plugin registers these tools as **optional**. Add the plugin to the agent's tool allowlist (see [Quick Start](#quick-start)) so the agent can call them. Use `"limits-openclaw "` to allow all tools from this plugin, or allow by name: `["limits_generate_create_policy", "limits_generate_update_policy"]`.
|
|
159
159
|
|
|
160
160
|
### Sandboxed agents
|
|
161
161
|
|
|
162
|
-
If the agent runs in a **sandbox**, add `"limits-openclaw"` (or the tool names) to `tools.sandbox.tools.allow` as well so the sandboxed agent can call the policy tools. Otherwise the agent can have the skill but cannot invoke the tools from inside the sandbox.
|
|
162
|
+
If the agent runs in a **sandbox**, add `"limits-openclaw "` (or the tool names) to `tools.sandbox.tools.allow` as well so the sandboxed agent can call the policy tools. Otherwise the agent can have the skill but cannot invoke the tools from inside the sandbox.
|
|
163
163
|
|
|
164
164
|
---
|
|
165
165
|
|
|
@@ -190,7 +190,7 @@ If the agent runs in a **sandbox**, add `"limits-openclaw"` (or the tool names)
|
|
|
190
190
|
{
|
|
191
191
|
"plugins": {
|
|
192
192
|
"entries": {
|
|
193
|
-
"limits-openclaw": {
|
|
193
|
+
"limits-openclaw ": {
|
|
194
194
|
"enabled": true,
|
|
195
195
|
"config": {
|
|
196
196
|
"apiToken": "sk_your_organization_api_key",
|
|
@@ -253,12 +253,12 @@ Policies are scoped to OpenClaw tool calls using **tags** in the Limits dashboar
|
|
|
253
253
|
|---------|-------------|
|
|
254
254
|
| `openclaw plugins install <path>` | Install plugin from path. |
|
|
255
255
|
| `openclaw plugins install -l <path>` | Link plugin (no copy, for development). |
|
|
256
|
-
| `openclaw plugins enable "limits-openclaw"` | Enable the plugin. |
|
|
256
|
+
| `openclaw plugins enable "limits-openclaw "` | Enable the plugin. |
|
|
257
257
|
| `openclaw plugins list` | List installed plugins. |
|
|
258
258
|
| `openclaw plugins doctor` | Check plugin health. |
|
|
259
259
|
| `openclaw limits configure` | Interactive wizard to set API token and sandbox allowlist. |
|
|
260
|
-
| `openclaw config get 'plugins.entries["limits-openclaw"]'` | Show plugin config. |
|
|
261
|
-
| `openclaw config set 'plugins.entries["limits-openclaw"].config.apiToken' "sk_..."` | Set apiToken manually. |
|
|
260
|
+
| `openclaw config get 'plugins.entries["limits-openclaw "]'` | Show plugin config. |
|
|
261
|
+
| `openclaw config set 'plugins.entries["limits-openclaw "].config.apiToken' "sk_..."` | Set apiToken manually. |
|
|
262
262
|
|
|
263
263
|
---
|
|
264
264
|
|
|
@@ -283,29 +283,29 @@ If you were using the plugin under the old name **limits-enforcer**, update your
|
|
|
283
283
|
|
|
284
284
|
| Before | After |
|
|
285
285
|
|--------|-------|
|
|
286
|
-
| Plugin ID / allowlist: `"limits-enforcer"` | `"limits-openclaw"` |
|
|
287
|
-
| Config path: `plugins.entries.limits-enforcer` | `plugins.entries["limits-openclaw"]` |
|
|
286
|
+
| Plugin ID / allowlist: `"limits-enforcer"` | `"limits-openclaw "` |
|
|
287
|
+
| Config path: `plugins.entries.limits-enforcer` | `plugins.entries["limits-openclaw "]` |
|
|
288
288
|
| CLI command: `openclaw limits-enforcer configure` | `openclaw limits configure` |
|
|
289
|
-
| Log prefix: `[limits-enforcer]` | `[limits-openclaw]` |
|
|
289
|
+
| Log prefix: `[limits-enforcer]` | `[limits-openclaw ]` |
|
|
290
290
|
|
|
291
|
-
After renaming, reinstall the plugin and enable `"limits-openclaw"`.
|
|
291
|
+
After renaming, reinstall the plugin and enable `"limits-openclaw "`.
|
|
292
292
|
|
|
293
293
|
---
|
|
294
294
|
|
|
295
295
|
## Troubleshooting
|
|
296
296
|
|
|
297
|
-
- **Config warning "plugin id mismatch (manifest uses 'limits-openclaw', entry hints 'openclaw')"**
|
|
298
|
-
Some OpenClaw gateways install scoped packages under `extensions/openclaw` instead of `extensions/limits-openclaw`. The gateway then infers the plugin id from the folder name (`openclaw`), which does not match the manifest id `limits-openclaw`, so the plugin may not load and `openclaw limits configure` shows **unknown command 'limits'**.
|
|
297
|
+
- **Config warning "plugin id mismatch (manifest uses 'limits-openclaw ', entry hints 'openclaw')"**
|
|
298
|
+
Some OpenClaw gateways install scoped packages under `extensions/openclaw` instead of `extensions/limits-openclaw `. The gateway then infers the plugin id from the folder name (`openclaw`), which does not match the manifest id `limits-openclaw `, so the plugin may not load and `openclaw limits configure` shows **unknown command 'limits'**.
|
|
299
299
|
|
|
300
300
|
**Workaround — install under the scoped path so the gateway matches the config entry:**
|
|
301
301
|
```bash
|
|
302
302
|
# Create the scope directory and install the package there (adjust if you use npm -g or another path)
|
|
303
303
|
mkdir -p ~/.openclaw/extensions/@limits
|
|
304
|
-
cp -r ./node_modules/limits-openclaw
|
|
304
|
+
cp -r ./node_modules/limits-openclaw ~/.openclaw/extensions/@limits/
|
|
305
305
|
|
|
306
306
|
# Tell OpenClaw to load the plugin from that path
|
|
307
|
-
openclaw plugins install ~/.openclaw/extensions/limits-openclaw
|
|
308
|
-
openclaw plugins enable "limits-openclaw"
|
|
307
|
+
openclaw plugins install ~/.openclaw/extensions/limits-openclaw
|
|
308
|
+
openclaw plugins enable "limits-openclaw "
|
|
309
309
|
openclaw gateway restart
|
|
310
310
|
```
|
|
311
311
|
Then run `openclaw limits configure`.
|
|
@@ -313,7 +313,7 @@ After renaming, reinstall the plugin and enable `"limits-openclaw"`.
|
|
|
313
313
|
- **`error: unknown command 'limits'`**
|
|
314
314
|
The plugin did not load (often due to the id mismatch above). Use the workaround above, or run the configure wizard without the OpenClaw CLI:
|
|
315
315
|
```bash
|
|
316
|
-
node node_modules/limits-openclaw/scripts/configure.js
|
|
316
|
+
node node_modules/limits-openclaw /scripts/configure.js
|
|
317
317
|
```
|
|
318
318
|
Or from the plugin repo: `npm run configure`.
|
|
319
319
|
|
|
@@ -322,4 +322,4 @@ After renaming, reinstall the plugin and enable `"limits-openclaw"`.
|
|
|
322
322
|
|
|
323
323
|
## License
|
|
324
324
|
|
|
325
|
-
MIT — [Limits](https://limits.dev) — [GitHub](https://github.com/limitsdev/limits-openclaw)
|
|
325
|
+
MIT — [Limits](https://limits.dev) — [GitHub](https://github.com/limitsdev/limits-openclaw )
|
package/dist/config.js
CHANGED
|
@@ -10,7 +10,7 @@ const DEFAULTS = {
|
|
|
10
10
|
redactLogs: true,
|
|
11
11
|
};
|
|
12
12
|
export function loadConfig(api) {
|
|
13
|
-
const raw = api.config?.plugins?.entries?.["limits-openclaw"]?.config ?? {};
|
|
13
|
+
const raw = api.config?.plugins?.entries?.["limits-openclaw "]?.config ?? {};
|
|
14
14
|
// baseUrl defaults to static; not in wizard or schema so users don't edit it (config override only for tests/advanced)
|
|
15
15
|
const baseUrl = raw.baseUrl ?? DEFAULTS.baseUrl;
|
|
16
16
|
const timeoutMs = typeof process.env.LIMITS_ENFORCER_TIMEOUT_MS === "string"
|
package/dist/configure-wizard.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import os from "node:os";
|
|
7
|
-
const CONFIG_PREFIX = 'plugins.entries["limits-openclaw"].config';
|
|
7
|
+
const CONFIG_PREFIX = 'plugins.entries["limits-openclaw "].config';
|
|
8
8
|
const SKILL_NAME = "limits-policy-generator";
|
|
9
9
|
function getPluginRoot() {
|
|
10
10
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -100,18 +100,18 @@ export async function runConfigureWizard() {
|
|
|
100
100
|
allow = [];
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
if (allow.includes("limits-openclaw")) {
|
|
104
|
-
console.log("\nlimits-openclaw
|
|
103
|
+
if (allow.includes("limits-openclaw ")) {
|
|
104
|
+
console.log("\nlimits-openclaw is already in tools.sandbox.tools.allow, skipping.");
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
allow.push("limits-openclaw");
|
|
107
|
+
allow.push("limits-openclaw ");
|
|
108
108
|
await runConfigSetFull(SANDBOX_ALLOW_KEY, JSON.stringify(allow));
|
|
109
|
-
console.log("\nAdded limits-openclaw
|
|
109
|
+
console.log("\nAdded limits-openclaw to tools.sandbox.tools.allow.");
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
const addSkillYes = /^y(es)?$/i.test(addSkillAnswer.trim());
|
|
113
113
|
if (addSkillYes)
|
|
114
114
|
copySkillToWorkspace();
|
|
115
115
|
console.log("\nDone. Restart the gateway if it is running.");
|
|
116
|
-
console.log('Verify: openclaw config get plugins.entries["limits-openclaw"]\n');
|
|
116
|
+
console.log('Verify: openclaw config get plugins.entries["limits-openclaw "]\n');
|
|
117
117
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* limits-openclaw: register(api) entrypoint — wires before_tool_call and after_tool_call.
|
|
2
|
+
* limits-openclaw : register(api) entrypoint — wires before_tool_call and after_tool_call.
|
|
3
3
|
*/
|
|
4
4
|
import { loadConfig } from "./config.js";
|
|
5
5
|
import { callEnforce } from "./enforcer.js";
|
|
@@ -182,7 +182,7 @@ function registerPolicyTools(api) {
|
|
|
182
182
|
log("policy-generator tools registered (limits_generate_create_policy, limits_generate_update_policy)");
|
|
183
183
|
}
|
|
184
184
|
export function register(api) {
|
|
185
|
-
log("limits-openclaw
|
|
185
|
+
log("limits-openclaw loaded");
|
|
186
186
|
if (typeof api.on !== "function") {
|
|
187
187
|
log("api.on not available, hooks not registered");
|
|
188
188
|
return;
|
package/dist/logger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Safe logger for limits-openclaw. Never logs apiToken, request body, or tool args.
|
|
2
|
+
* Safe logger for limits-openclaw . Never logs apiToken, request body, or tool args.
|
|
3
3
|
*/
|
|
4
|
-
const PREFIX = "[limits-openclaw]";
|
|
4
|
+
const PREFIX = "[limits-openclaw ]";
|
|
5
5
|
export function log(message, ...safeArgs) {
|
|
6
6
|
const safe = safeArgs.map((a) => typeof a === "string" || typeof a === "number" || typeof a === "boolean"
|
|
7
7
|
? a
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "limits-openclaw",
|
|
3
|
-
"name": "limits
|
|
3
|
+
"name": "@limits/openclaw ",
|
|
4
4
|
"description": "Delegates policy enforcement to the Limits platform before and after every tool call. Optional policy-generator tools for creating/updating policies from natural language.",
|
|
5
5
|
"version": "0.0.8",
|
|
6
|
-
"main": "./dist/
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"additionalProperties": true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "limits-openclaw",
|
|
3
|
-
"version": "0.0.
|
|
2
|
+
"name": "limits-openclaw ",
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Delegates policy enforcement to the Limits platform before and after every tool call.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openclaw",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"author": "Limits",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"type": "module",
|
|
15
|
-
"main": "./dist/
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
|
-
".": "./dist/
|
|
17
|
+
".": "./dist/index.js"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|