@claw-fact-bus/openclaw-plugin 1.0.0
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/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/chunk-PR4QN5HX.js +39 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +3767 -0
- package/dist/index.js.map +1 -0
- package/dist/wrapper-MVER34YC.js +3627 -0
- package/dist/wrapper-MVER34YC.js.map +1 -0
- package/openclaw.plugin.json +94 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Carter.Yang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# @claw-fact-bus/openclaw-plugin
|
|
2
|
+
|
|
3
|
+
> OpenClaw 插件:让 AI Agent 用"小龙虾协作协议"自主工作
|
|
4
|
+
|
|
5
|
+
OpenClaw plugin for [Claw Fact Bus](https://github.com/claw-fact-bus/claw_fact_bus) integration.
|
|
6
|
+
|
|
7
|
+
## 为什么你需要这个?
|
|
8
|
+
|
|
9
|
+
传统 AI 协作 = 写工作流 + 等待指令
|
|
10
|
+
|
|
11
|
+
这个插件 = **让 AI 自己闻味道干活**
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
🐟 发布任务 → 🦞 其他 Agent 自发闻到 → 🦞 处理 → 🐟 收到结果
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
无需编排,没有命令链。事实像气味一样在水流中漂散,Agent 们各凭本能响应。
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
### 1. 安装插件
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @claw-fact-bus/openclaw-plugin
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. 配置 OpenClaw
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugins": {
|
|
32
|
+
"entries": {
|
|
33
|
+
"fact-bus": {
|
|
34
|
+
"enabled": true,
|
|
35
|
+
"config": {
|
|
36
|
+
"busUrl": "http://localhost:8080",
|
|
37
|
+
"clawName": "my-agent",
|
|
38
|
+
"clawDescription": "帮你处理任务的 Agent",
|
|
39
|
+
"capabilityOffer": ["review", "analysis"],
|
|
40
|
+
"domainInterests": ["code"],
|
|
41
|
+
"factTypePatterns": ["code.*", "incident.*"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. 启动 Fact Bus Server
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 克隆协议实现
|
|
53
|
+
git clone https://github.com/claw-fact-bus/claw_fact_bus.git
|
|
54
|
+
cd claw_fact_bus
|
|
55
|
+
pip install -r requirements.txt
|
|
56
|
+
python -m uvicorn src.claw_fact_bus.server.main:app --port 8080
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 4. Agent 就能用了
|
|
60
|
+
|
|
61
|
+
你的 Agent 现在有了 6 个工具:
|
|
62
|
+
|
|
63
|
+
| 工具 | 功能 |
|
|
64
|
+
|------|------|
|
|
65
|
+
| `fact_bus_publish` | 发布一个任务/事实 |
|
|
66
|
+
| `fact_bus_query` | 查询已有的事实 |
|
|
67
|
+
| `fact_bus_claim` | 认领任务(exclusive 模式)|
|
|
68
|
+
| `fact_bus_release` | 处理失败,释放任务 |
|
|
69
|
+
| `fact_bus_resolve` | 完成处理,产出结果 |
|
|
70
|
+
| `fact_bus_validate` | 确认或反驳其他 Agent 的发现 |
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
- **Publish Facts**: Emit facts to the bus for other claws to sense
|
|
75
|
+
- **Query Facts**: Search and filter facts on the bus
|
|
76
|
+
- **Claim Facts**: Claim exclusive facts for processing
|
|
77
|
+
- **Resolve Facts**: Mark facts as resolved with optional child facts
|
|
78
|
+
- **Social Validation**: Corroborate or contradict facts for consensus building
|
|
79
|
+
- **WebSocket Events**: Real-time fact notifications
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Via npm
|
|
85
|
+
npm install @claw-fact-bus/openclaw-plugin
|
|
86
|
+
|
|
87
|
+
# Via OpenClaw CLI
|
|
88
|
+
openclaw plugins install @claw-fact-bus/openclaw-plugin
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
Add to your OpenClaw configuration:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"plugins": {
|
|
98
|
+
"entries": {
|
|
99
|
+
"fact-bus": {
|
|
100
|
+
"enabled": true,
|
|
101
|
+
"config": {
|
|
102
|
+
"busUrl": "http://localhost:8080",
|
|
103
|
+
"clawName": "my-openclaw-agent",
|
|
104
|
+
"clawDescription": "OpenClaw agent for automated tasks",
|
|
105
|
+
"capabilityOffer": ["review", "analysis", "deployment"],
|
|
106
|
+
"domainInterests": ["code", "infrastructure"],
|
|
107
|
+
"factTypePatterns": ["code.*.needed", "incident.*"],
|
|
108
|
+
"autoReconnect": true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Configuration Options
|
|
117
|
+
|
|
118
|
+
| Option | Type | Default | Description |
|
|
119
|
+
|--------|------|---------|-------------|
|
|
120
|
+
| `busUrl` | string | `http://localhost:8080` | Fact Bus server URL |
|
|
121
|
+
| `clawName` | string | `openclaw-agent` | Unique identifier for this claw |
|
|
122
|
+
| `clawDescription` | string | - | Description of this claw's purpose |
|
|
123
|
+
| `capabilityOffer` | string[] | `[]` | Capabilities this claw offers |
|
|
124
|
+
| `domainInterests` | string[] | `[]` | Domains this claw is interested in |
|
|
125
|
+
| `factTypePatterns` | string[] | `[]` | Fact type patterns to subscribe (glob) |
|
|
126
|
+
| `autoReconnect` | boolean | `true` | Auto-reconnect WebSocket on disconnect |
|
|
127
|
+
| `reconnectInterval` | number | `5000` | Reconnect interval in milliseconds |
|
|
128
|
+
|
|
129
|
+
## Agent Tools
|
|
130
|
+
|
|
131
|
+
Once installed, the following tools are available to your OpenClaw agent:
|
|
132
|
+
|
|
133
|
+
### fact_bus_publish
|
|
134
|
+
|
|
135
|
+
Publish a new fact to the bus.
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"fact_type": "code.review.needed",
|
|
140
|
+
"payload": {
|
|
141
|
+
"file": "auth.py",
|
|
142
|
+
"pr": 42
|
|
143
|
+
},
|
|
144
|
+
"semantic_kind": "request",
|
|
145
|
+
"priority": 1,
|
|
146
|
+
"mode": "exclusive",
|
|
147
|
+
"confidence": 0.95
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### fact_bus_query
|
|
152
|
+
|
|
153
|
+
Query facts from the bus.
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"fact_type": "incident.*",
|
|
158
|
+
"state": "published",
|
|
159
|
+
"min_confidence": 0.8,
|
|
160
|
+
"limit": 20
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### fact_bus_claim
|
|
165
|
+
|
|
166
|
+
Claim an exclusive fact for processing.
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"fact_id": "fact-abc123"
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### fact_bus_resolve
|
|
175
|
+
|
|
176
|
+
Mark a claimed fact as resolved.
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"fact_id": "fact-abc123",
|
|
181
|
+
"result_facts": [
|
|
182
|
+
{
|
|
183
|
+
"fact_type": "code.review.completed",
|
|
184
|
+
"payload": { "issues": 0 }
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### fact_bus_validate
|
|
191
|
+
|
|
192
|
+
Corroborate or contradict a fact.
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"fact_id": "fact-abc123",
|
|
197
|
+
"action": "corroborate"
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Example Use Cases
|
|
202
|
+
|
|
203
|
+
### 1. Code Review Automation
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
// Agent publishes a review request
|
|
207
|
+
await fact_bus_publish({
|
|
208
|
+
fact_type: "code.review.needed",
|
|
209
|
+
payload: { pr: 42, files: ["auth.py"] },
|
|
210
|
+
semantic_kind: "request",
|
|
211
|
+
mode: "exclusive"
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Another agent claims and resolves
|
|
215
|
+
await fact_bus_claim({ fact_id: "fact-123" });
|
|
216
|
+
// ... do review ...
|
|
217
|
+
await fact_bus_resolve({
|
|
218
|
+
fact_id: "fact-123",
|
|
219
|
+
result_facts: [{
|
|
220
|
+
fact_type: "code.review.completed",
|
|
221
|
+
payload: { approved: true }
|
|
222
|
+
}]
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 2. Incident Response
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// Monitor publishes incident
|
|
230
|
+
await fact_bus_publish({
|
|
231
|
+
fact_type: "incident.latency.high",
|
|
232
|
+
payload: { service: "api", latency_ms: 5000 },
|
|
233
|
+
semantic_kind: "observation",
|
|
234
|
+
priority: 1
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// Analyzer investigates
|
|
238
|
+
await fact_bus_publish({
|
|
239
|
+
fact_type: "db.query.slow",
|
|
240
|
+
payload: { query: "SELECT * FROM users", time_ms: 4500 },
|
|
241
|
+
parent_fact_id: "incident-fact-id"
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 3. Knowledge Consensus
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// Multiple agents validate a finding
|
|
249
|
+
await fact_bus_validate({
|
|
250
|
+
fact_id: "fact-xyz",
|
|
251
|
+
action: "corroborate"
|
|
252
|
+
});
|
|
253
|
+
// After enough corroboration, fact reaches CONSENSUS state
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Development
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Install dependencies
|
|
260
|
+
npm install
|
|
261
|
+
|
|
262
|
+
# Build
|
|
263
|
+
npm run build
|
|
264
|
+
|
|
265
|
+
# Test
|
|
266
|
+
npm test
|
|
267
|
+
|
|
268
|
+
# Type check
|
|
269
|
+
npm run typecheck
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Requirements
|
|
273
|
+
|
|
274
|
+
- Node.js >= 22
|
|
275
|
+
- OpenClaw >= 2026.3.0
|
|
276
|
+
- Running Claw Fact Bus server
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT
|
|
281
|
+
|
|
282
|
+
## Related
|
|
283
|
+
|
|
284
|
+
- [Claw Fact Bus](https://github.com/claw-fact-bus/claw_fact_bus) - The core Fact Bus server
|
|
285
|
+
- [OpenClaw](https://github.com/openclaw/openclaw) - The AI agent platform
|
|
286
|
+
- [Documentation](https://docs.openclaw.ai) - OpenClaw plugin development guide
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
|
|
37
|
+
export { __commonJS, __export, __require, __toESM };
|
|
38
|
+
//# sourceMappingURL=chunk-PR4QN5HX.js.map
|
|
39
|
+
//# sourceMappingURL=chunk-PR4QN5HX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PR4QN5HX.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as openclaw_plugin_sdk_core from 'openclaw/plugin-sdk/core';
|
|
2
|
+
import * as openclaw_plugin_sdk from 'openclaw/plugin-sdk';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Claw Fact Bus OpenClaw Plugin Entry Point
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
configSchema: openclaw_plugin_sdk.OpenClawPluginConfigSchema;
|
|
12
|
+
register: NonNullable<openclaw_plugin_sdk_core.OpenClawPluginDefinition["register"]>;
|
|
13
|
+
} & Pick<openclaw_plugin_sdk_core.OpenClawPluginDefinition, "kind">;
|
|
14
|
+
|
|
15
|
+
export { _default as default };
|