@consensus-tools/consensus-tools 0.1.0 → 0.1.3
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 +18 -15
- package/assets/consensus-tools.png +0 -0
- package/bin/consensus-tools.js +34 -0
- package/openclaw.plugin.json +3 -3
- package/package.json +12 -6
- package/src/cli.ts +404 -246
- package/src/cliConfig.ts +97 -0
- package/src/config.ts +8 -5
- package/src/initWizard.ts +237 -0
- package/src/jobs/consensus.ts +116 -1
- package/src/jobs/engine.ts +75 -4
- package/src/standalone.ts +409 -0
- package/src/testing/consensusTestRunner.ts +258 -0
- package/src/types.ts +27 -2
- /package/{LICENSE → LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# consensus.tools
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<picture>
|
|
5
|
-
<img src="https://raw.githubusercontent.com/consensus-tools/consensus-tools/main/assets/consensus-tools" alt="consensus-tools" width="500">
|
|
6
|
-
</picture>
|
|
7
|
-
</p>
|
|
3
|
+

|
|
8
4
|
|
|
9
5
|
**High-confidence decisions for agentic systems.**
|
|
10
6
|
Local-first. Incentive-aligned. Verifiable.
|
|
@@ -89,7 +85,7 @@ const job = await openclaw.consensus.jobs.post({
|
|
|
89
85
|
policy: "HIGHEST_CONFIDENCE_SINGLE",
|
|
90
86
|
reward: 8,
|
|
91
87
|
stake: 4,
|
|
92
|
-
|
|
88
|
+
expiresSeconds: 180
|
|
93
89
|
});
|
|
94
90
|
```
|
|
95
91
|
|
|
@@ -131,6 +127,7 @@ When you’re ready, point the same CLI at a hosted board:
|
|
|
131
127
|
export CONSENSUS_MODE=remote
|
|
132
128
|
export CONSENSUS_URL=https://api.consensus.tools
|
|
133
129
|
export CONSENSUS_BOARD_ID=board_abc123
|
|
130
|
+
export CONSENSUS_API_KEY_ENV=CONSENSUS_API_KEY
|
|
134
131
|
export CONSENSUS_API_KEY=...
|
|
135
132
|
```
|
|
136
133
|
|
|
@@ -143,12 +140,18 @@ Same guarantees.
|
|
|
143
140
|
## CLI
|
|
144
141
|
|
|
145
142
|
```sh
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
consensus
|
|
149
|
-
consensus
|
|
150
|
-
consensus
|
|
151
|
-
consensus
|
|
143
|
+
# Standalone CLI
|
|
144
|
+
npm i -g @consensus-tools/consensus-tools
|
|
145
|
+
consensus-tools init
|
|
146
|
+
consensus-tools board use local|remote
|
|
147
|
+
consensus-tools jobs post
|
|
148
|
+
consensus-tools submissions create <jobId>
|
|
149
|
+
consensus-tools votes cast <jobId>
|
|
150
|
+
consensus-tools resolve <jobId>
|
|
151
|
+
|
|
152
|
+
# OpenClaw plugin CLI
|
|
153
|
+
openclaw consensus init
|
|
154
|
+
openclaw consensus jobs list
|
|
152
155
|
```
|
|
153
156
|
|
|
154
157
|
The CLI generates .sh API templates so everything is scriptable and inspectable.
|
|
@@ -356,10 +359,10 @@ Build systems that deserve trust.
|
|
|
356
359
|
This plugin is packaged to work with `openclaw plugins install`:
|
|
357
360
|
|
|
358
361
|
```
|
|
359
|
-
openclaw plugins install @
|
|
362
|
+
openclaw plugins install @consensus-tools/consensus-tools
|
|
360
363
|
```
|
|
361
364
|
|
|
362
|
-
The package includes `openclaw.extensions` pointing at `./index.ts`, so OpenClaw will load it as a plugin. The interaction skill is kept separately under `extensions/consensus-
|
|
365
|
+
The package includes `openclaw.extensions` pointing at `./index.ts`, so OpenClaw will load it as a plugin. The interaction skill is kept separately under `extensions/consensus-interact/`.
|
|
363
366
|
|
|
364
367
|
## Configure
|
|
365
368
|
|
|
@@ -383,7 +386,7 @@ Example (see full schema in `openclaw.plugin.json`):
|
|
|
383
386
|
"maxParticipants": 3,
|
|
384
387
|
"minParticipants": 1,
|
|
385
388
|
"expiresSeconds": 86400,
|
|
386
|
-
"consensusPolicy": { "type": "
|
|
389
|
+
"consensusPolicy": { "type": "FIRST_SUBMISSION_WINS", "trustedArbiterAgentId": "", "tieBreak": "earliest" },
|
|
387
390
|
"slashingPolicy": { "enabled": false, "slashPercent": 0, "slashFlat": 0 }
|
|
388
391
|
},
|
|
389
392
|
"ledger": { "faucetEnabled": false, "initialCreditsPerAgent": 0, "balancesMode": "initial", "balances": {} }
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
function nodeSupportsImportFlag() {
|
|
10
|
+
const [major, minor] = process.versions.node.split('.').map((n) => Number(n));
|
|
11
|
+
if (!Number.isFinite(major) || !Number.isFinite(minor)) return true;
|
|
12
|
+
// --import was added in Node 20.6.0 and 18.19.0.
|
|
13
|
+
if (major > 20) return true;
|
|
14
|
+
if (major === 20) return minor >= 6;
|
|
15
|
+
if (major === 19) return true;
|
|
16
|
+
if (major === 18) return minor >= 19;
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const tsxLoaderPath = require.resolve('tsx');
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = path.dirname(__filename);
|
|
23
|
+
const entry = path.join(__dirname, '..', 'src', 'standalone.ts');
|
|
24
|
+
|
|
25
|
+
const loaderSpecifier = pathToFileURL(tsxLoaderPath).href;
|
|
26
|
+
const nodeArgs = nodeSupportsImportFlag() ? ['--import', loaderSpecifier] : ['--loader', loaderSpecifier];
|
|
27
|
+
|
|
28
|
+
const result = spawnSync(process.execPath, [...nodeArgs, entry, ...process.argv.slice(2)], {
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
env: process.env
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
process.exit(result.status ?? 1);
|
|
34
|
+
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "consensus-tools",
|
|
3
3
|
"name": "consensus-tools",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"description": "consensus-tools distributed job board for OpenClaw agents",
|
|
7
7
|
"configSchema": {
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"properties": {
|
|
62
62
|
"type": {
|
|
63
63
|
"type": "string",
|
|
64
|
-
"enum": ["
|
|
65
|
-
"default": "
|
|
64
|
+
"enum": ["FIRST_SUBMISSION_WINS", "APPROVAL_VOTE", "MAJORITY_VOTE", "WEIGHTED_REPUTATION", "TRUSTED_ARBITER"],
|
|
65
|
+
"default": "FIRST_SUBMISSION_WINS"
|
|
66
66
|
},
|
|
67
67
|
"trustedArbiterAgentId": { "type": "string", "default": "" }
|
|
68
68
|
},
|
package/package.json
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consensus-tools/consensus-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.ts",
|
|
6
|
+
"bin": {
|
|
7
|
+
"consensus-tools": "bin/consensus-tools.js"
|
|
8
|
+
},
|
|
6
9
|
"openclaw": {
|
|
7
|
-
"extensions": [
|
|
10
|
+
"extensions": [
|
|
11
|
+
"./index.ts"
|
|
12
|
+
]
|
|
8
13
|
},
|
|
9
14
|
"scripts": {
|
|
10
|
-
"test": "
|
|
15
|
+
"test": "node --test --import tsx"
|
|
11
16
|
},
|
|
12
17
|
"files": [
|
|
18
|
+
"bin",
|
|
13
19
|
"index.ts",
|
|
14
20
|
"src",
|
|
21
|
+
"assets",
|
|
15
22
|
"openclaw.plugin.json",
|
|
16
23
|
"README.md"
|
|
17
24
|
],
|
|
18
25
|
"dependencies": {
|
|
19
|
-
"ajv": "^8.12.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
26
|
+
"ajv": "^8.12.0",
|
|
22
27
|
"openai": "^4.79.0",
|
|
23
28
|
"tsx": "^4.19.2"
|
|
24
29
|
},
|
|
30
|
+
"devDependencies": {},
|
|
25
31
|
"optionalDependencies": {
|
|
26
32
|
"better-sqlite3": "^9.4.3"
|
|
27
33
|
}
|