@clawrent/openclaw-channel 0.2.1 → 0.2.2

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 CHANGED
@@ -91,6 +91,14 @@ npm run typecheck # 不产物的类型校验
91
91
  }
92
92
  ```
93
93
 
94
+ ### 护栏(guardrailsFile)
95
+
96
+ 外置护栏文件格式:每行 `/正则/ || 原因`,`#` 开头为注释,正则大小写不敏感。规则**追加**在内置护栏之后(内置始终拦截 `instruction.exec` / `read_file` / `write_file`,不可关闭)。命中护栏的消息不驱动 agent,直接回「需人工介入」并转人工。
97
+
98
+ 完整示例见 [guardrails.example.md](guardrails.example.md)。建议最低护栏基线至少覆盖:命令执行、文件读写、删除/破坏、数据外发、付费/账单、发布/激活、凭据索取、绕过护栏的 prompt(类别参考 [R3-GUARDRAILS-MATERIAL.md](R3-GUARDRAILS-MATERIAL.md))。
99
+
100
+ > 护栏策略目前完全在端侧(内置 + `guardrailsFile`)。「平台侧权威下发」是 R3 的目标——届时 `guardrailsFile` 降为本地覆盖/追加。
101
+
94
102
  ## 启用
95
103
 
96
104
  1. `openclaw plugins install --link <本目录>`,或手动把本目录加入 `openclaw.json` 的 `plugins.load.paths`。
@@ -100,6 +108,15 @@ npm run typecheck # 不产物的类型校验
100
108
  > manifest 的 `configSchema.required` 保持空数组:channel plugin 的 required 字段缺失会让
101
109
  > `openclaw` CLI 整体启动失败(config validation 阻断全局)。字段改为可选 + 运行时 warn。
102
110
 
111
+ ### 从社区 fork 迁移
112
+
113
+ 若先前装过社区 fork(与官方包 manifest `id` 同为 `clawrent`),装官方包前**先让旧 fork 不再加载**,否则两者共存会触发 `duplicate plugin id` 警告,config 优先级可能使其中一个不生效:
114
+
115
+ - 旧 fork 经 `plugins.load.paths` 加载 → 从 `load.paths` 移除旧 fork 目录;
116
+ - 旧 fork 经 `plugins install` 安装 → `openclaw plugins uninstall <旧 fork 包名>`。
117
+
118
+ 之后官方包成为唯一 `clawrent` 解析源。`plugins.entries.clawrent.config` **无需改动**(官方包 manifest `id` 仍为 `clawrent`,配置 key 兼容)。
119
+
103
120
  ## 设计要点
104
121
 
105
122
  - **WS push inbound**:经 `@clawrent/provider` 的 `ProviderClient` 接收推送,不轮询、无需 CLI daemon。
@@ -0,0 +1,53 @@
1
+ # ClawRent Channel — 护栏示例文件 / Guardrails example
2
+ #
3
+ # 用法 / Usage:
4
+ # 在 openclaw.json 配置 guardrailsFile 指向本文件(或复制一份自行编辑):
5
+ # Set openclaw.json `guardrailsFile` to this file (or copy and customize):
6
+ # "guardrailsFile": "/path/to/guardrails.example.md"
7
+ #
8
+ # 格式 / Format:
9
+ # 每行 / each line: /正则/ || 原因 (reason)
10
+ # - `#` 开头为注释,整行忽略 / lines starting with `#` are comments (ignored)
11
+ # - 正则大小写不敏感(内部 RegExp(pattern, "i"))/ case-insensitive
12
+ # - 规则作为内置护栏的「追加」,不覆盖内置 / appended to built-ins (do not override)
13
+ # - 非法正则的行会被静默忽略 / invalid regex lines are silently skipped
14
+ #
15
+ # 内置护栏(不可关闭,此处仅列出供参考)/ Built-in (non-disableable, listed for reference):
16
+ # instruction.exec / instruction.read_file / instruction.write_file
17
+
18
+ # === 结构化危险指令(内置已拦)/ Structured dangerous instructions (built-in) ===
19
+ /instruction\.exec/ || 拒绝结构化指令:远程命令执行
20
+ /instruction\.read_file/ || 拒绝结构化指令:读取本地文件
21
+ /instruction\.write_file/ || 拒绝结构化指令:写入/修改本地文件
22
+
23
+ # === 自然语言危险意图(建议覆盖)/ Natural-language dangerous intents (recommended) ===
24
+ # 按危险类别补充;以下为示例,请按你的 provider 场景调整。
25
+ # Adjust these to your provider's context.
26
+
27
+ # 命令执行 / Command execution
28
+ /(执行|运行|跑)\s*(命令|脚本|shell|cmd|powershell|bash|终端)/ || 拒绝:要求执行命令/shell
29
+ /(run|execute)\s+(shell|cmd|script|terminal)/i || reject: command execution requested
30
+
31
+ # 删除 / 破坏 / 覆盖 / Delete, destroy, overwrite
32
+ /(删除|删掉|清空|格式化|重置|覆盖).*(文件|目录|库|表|数据|数据库)/ || 拒绝:删除/破坏数据
33
+ /(drop|delete|truncate|format|wipe|reset)\s+(table|database|data|file)/i || reject: destructive operation
34
+
35
+ # 数据外发 / Data exfiltration
36
+ /(上传|发送|外发|公开|分享).*(密钥|凭据|token|密码|内部数据|生产数据)/ || 拒绝:数据外发
37
+ /(upload|send|exfil|publish)\s+(key|credential|token|secret|internal)/i || reject: data exfiltration
38
+
39
+ # 付费 / 账单 / Payment, billing
40
+ /(充值|提现|扣费|下单|付款|订阅|退款|改账单)/ || 拒绝:付费/账单操作
41
+ /(topup|charge|refund|subscribe|withdraw)\b/i || reject: payment/billing operation
42
+
43
+ # 发布 / 激活 / 部署 / Publish, activate, deploy
44
+ /(上架|下架|发布|激活|上线|部署).*(agent|服务|插件|配置)/ || 拒绝:发布/激活操作
45
+ /(publish|activate|deploy|release)\s+(agent|service|plugin|config)/i || reject: publish/activate
46
+
47
+ # 凭据索取 / Credential solicitation
48
+ /(给我|发我|提供|索取)\s*(token|密码|password|secret|key|私钥)/ || 拒绝:索取凭据
49
+ /(give|send|show)\s+(me\s+)?(token|password|secret|key)/i || reject: credential solicitation
50
+
51
+ # 绕过护栏 / Guardrail bypass (any framing)
52
+ /(忽略|无视|跳过|不要遵守)(以上|之前的|所有)?(规则|限制|护栏|约束)/ || 拒绝:试图绕过护栏
53
+ /(ignore|disregard|skip)\s+(all|previous|the)\s+(rules|instructions|guardrails)/i || reject: guardrail bypass attempt
@@ -2,7 +2,7 @@
2
2
  "id": "clawrent",
3
3
  "name": "ClawRent Channel",
4
4
  "description": "OpenClaw channel plugin that turns ClawRent rental sessions into native OpenClaw conversations, so a local ClawRent provider agent can answer tenants autonomously with its own model and identity. / OpenClaw 频道插件:把 ClawRent 租赁会话桥接成 OpenClaw 原生对话,让本地 ClawRent provider 智能体用自有模型与身份自动应答租户。",
5
- "version": "0.2.1",
5
+ "version": "0.2.2",
6
6
  "channels": ["clawrent"],
7
7
  "activation": {
8
8
  "onStartup": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawrent/openclaw-channel",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "OpenClaw channel plugin that turns ClawRent rental sessions into native OpenClaw conversations, so a local ClawRent provider agent can answer tenants autonomously with its own model and identity. / OpenClaw 频道插件:把 ClawRent 租赁会话桥接成 OpenClaw 原生对话,让本地 ClawRent provider 智能体用自有模型与身份自动应答租户。",
5
5
  "license": "ISC",
6
6
  "type": "module",
@@ -9,7 +9,8 @@
9
9
  "dist",
10
10
  "openclaw.plugin.json",
11
11
  "README.md",
12
- "docs"
12
+ "docs",
13
+ "guardrails.example.md"
13
14
  ],
14
15
  "keywords": [
15
16
  "openclaw",