@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/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ConsensusPolicyType =
|
|
2
|
-
| '
|
|
2
|
+
| 'FIRST_SUBMISSION_WINS'
|
|
3
3
|
| 'HIGHEST_CONFIDENCE_SINGLE'
|
|
4
|
+
| 'APPROVAL_VOTE'
|
|
4
5
|
| 'OWNER_PICK'
|
|
5
6
|
| 'TOP_K_SPLIT'
|
|
6
7
|
| 'MAJORITY_VOTE'
|
|
@@ -24,10 +25,27 @@ export type VoteTargetType = 'SUBMISSION' | 'CHOICE';
|
|
|
24
25
|
export interface ConsensusPolicyConfig {
|
|
25
26
|
type: ConsensusPolicyType;
|
|
26
27
|
trustedArbiterAgentId?: string;
|
|
28
|
+
|
|
29
|
+
// confidence-based policies
|
|
27
30
|
minConfidence?: number;
|
|
31
|
+
|
|
32
|
+
// top-k policies
|
|
28
33
|
topK?: number;
|
|
29
34
|
ordering?: 'confidence' | 'score';
|
|
35
|
+
|
|
36
|
+
// vote-based policies
|
|
30
37
|
quorum?: number;
|
|
38
|
+
minScore?: number;
|
|
39
|
+
minMargin?: number;
|
|
40
|
+
tieBreak?: 'earliest' | 'confidence' | 'arbiter';
|
|
41
|
+
|
|
42
|
+
// approval-vote specific
|
|
43
|
+
approvalVote?: {
|
|
44
|
+
weightMode?: 'equal' | 'explicit' | 'reputation';
|
|
45
|
+
settlement?: 'immediate' | 'staked' | 'oracle';
|
|
46
|
+
oracle?: 'trusted_arbiter';
|
|
47
|
+
voteSlashPercent?: number; // 0-1 (only for settlement=staked)
|
|
48
|
+
};
|
|
31
49
|
}
|
|
32
50
|
|
|
33
51
|
export interface SlashingPolicy {
|
|
@@ -162,7 +180,14 @@ export interface DiagnosticEntry {
|
|
|
162
180
|
context?: Record<string, unknown>;
|
|
163
181
|
}
|
|
164
182
|
|
|
165
|
-
export type LedgerEntryType =
|
|
183
|
+
export type LedgerEntryType =
|
|
184
|
+
| 'FAUCET'
|
|
185
|
+
| 'STAKE'
|
|
186
|
+
| 'UNSTAKE'
|
|
187
|
+
| 'PAYOUT'
|
|
188
|
+
| 'SLASH'
|
|
189
|
+
| 'ADJUST'
|
|
190
|
+
| 'ESCROW_MINT';
|
|
166
191
|
|
|
167
192
|
export interface LedgerEntry {
|
|
168
193
|
id: string;
|
/package/{LICENSE → LICENSE.txt}
RENAMED
|
File without changes
|