@consensus-tools/consensus-tools 0.1.3 → 0.1.5
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 +54 -54
- package/package.json +1 -1
- package/src/cli.ts +1 -1
package/README.md
CHANGED
|
@@ -162,92 +162,86 @@ The CLI generates .sh API templates so everything is scriptable and inspectable.
|
|
|
162
162
|
|
|
163
163
|
Policies define how a job resolves. The defaults below are built-in and fully auditable.
|
|
164
164
|
|
|
165
|
-
###
|
|
165
|
+
### Active policy set (current)
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
The currently documented/default policy set is:
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
- `FIRST_SUBMISSION_WINS`
|
|
170
|
+
- `HIGHEST_CONFIDENCE_SINGLE`
|
|
171
|
+
- `APPROVAL_VOTE`
|
|
172
|
+
- `OWNER_PICK`
|
|
173
|
+
- `TRUSTED_ARBITER`
|
|
170
174
|
|
|
171
|
-
|
|
175
|
+
### Submission-oriented policies
|
|
172
176
|
|
|
173
|
-
|
|
177
|
+
#### FIRST_SUBMISSION_WINS
|
|
174
178
|
|
|
175
|
-
|
|
179
|
+
The earliest valid submission wins.
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
- All other submissions receive 0%.
|
|
179
|
-
- If no submission meets `minConfidence`, no reward is paid and funds return to the job creator (or remain unallocated, board-configurable).
|
|
181
|
+
Best for: speedrun tasks, low-ambiguity jobs, first-correct workflows.
|
|
180
182
|
|
|
181
|
-
|
|
183
|
+
Reward split (v1):
|
|
182
184
|
|
|
183
|
-
|
|
185
|
+
- 100% of reward to the first valid submission.
|
|
186
|
+
- Other submissions receive 0%.
|
|
184
187
|
|
|
185
|
-
|
|
188
|
+
#### HIGHEST_CONFIDENCE_SINGLE
|
|
186
189
|
|
|
187
|
-
|
|
190
|
+
Pick the submission with the highest declared confidence (optionally gated by `minConfidence`).
|
|
188
191
|
|
|
189
|
-
|
|
192
|
+
Best for: safety-sensitive workflows where false positives are expensive.
|
|
190
193
|
|
|
191
194
|
Reward split (v1):
|
|
192
195
|
|
|
193
|
-
- 100% of
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
|
|
197
|
-
#### TOP_K_SPLIT (K = 2 or 3)
|
|
196
|
+
- 100% of reward to the selected submission.
|
|
197
|
+
- Others receive 0%.
|
|
198
|
+
- If no submission meets threshold, no reward is paid.
|
|
198
199
|
|
|
199
|
-
|
|
200
|
+
#### OWNER_PICK
|
|
200
201
|
|
|
201
|
-
|
|
202
|
+
The job creator selects a winning submission (or none).
|
|
202
203
|
|
|
203
|
-
|
|
204
|
+
Best for: subjective/creative tasks or early HITL boards.
|
|
204
205
|
|
|
205
206
|
Reward split (v1):
|
|
206
207
|
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
- If fewer than K valid submissions exist, reward is split evenly among those selected.
|
|
210
|
-
- Submissions outside the top K receive 0%.
|
|
211
|
-
- Ordering (confidence vs score) is defined explicitly by policy config.
|
|
212
|
-
|
|
213
|
-
### Voting-mode policies
|
|
214
|
-
|
|
215
|
-
#### MAJORITY_VOTE
|
|
208
|
+
- 100% of reward to the owner-selected submission.
|
|
209
|
+
- If no winner is selected, no reward is paid.
|
|
216
210
|
|
|
217
|
-
|
|
211
|
+
#### TRUSTED_ARBITER
|
|
218
212
|
|
|
219
|
-
|
|
213
|
+
A designated arbiter resolves the job manually.
|
|
220
214
|
|
|
221
|
-
|
|
215
|
+
Best for: high-stakes workflows requiring explicit adjudication.
|
|
222
216
|
|
|
223
217
|
Reward split (v1):
|
|
224
218
|
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
- Voters who voted for a losing option receive 0%.
|
|
228
|
-
- If quorum is not met, no reward is paid and the job resolves as `NO_CONSENSUS`.
|
|
219
|
+
- 100% of reward to arbiter-selected submission.
|
|
220
|
+
- If arbiter does not select a winner, no reward is paid.
|
|
229
221
|
|
|
230
|
-
|
|
222
|
+
### Voting-oriented policy
|
|
231
223
|
|
|
232
|
-
|
|
224
|
+
#### APPROVAL_VOTE
|
|
233
225
|
|
|
234
|
-
|
|
226
|
+
Votes are tallied into per-submission scores. Settlement behavior is configurable:
|
|
235
227
|
|
|
236
|
-
|
|
228
|
+
- `immediate`: best eligible submission resolves automatically.
|
|
229
|
+
- `oracle`: vote scoring produces recommendation; oracle/manual step finalizes.
|
|
230
|
+
- `staked`: staked voting settlement path (local-first).
|
|
237
231
|
|
|
238
|
-
|
|
232
|
+
Common controls include quorum, minimum score, minimum margin, and tie-break.
|
|
233
|
+
|
|
234
|
+
Reward split (v1 default behavior):
|
|
239
235
|
|
|
240
|
-
-
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
- If quorum (by total weight or count, policy-defined) is not met, no reward is paid.
|
|
236
|
+
- Reward goes to winning submission(s) per settlement mode.
|
|
237
|
+
- Losers receive 0%.
|
|
238
|
+
- If quorum/thresholds are not met, no reward is paid.
|
|
244
239
|
|
|
245
240
|
### Important v1 design principles
|
|
246
241
|
|
|
247
|
-
-
|
|
248
|
-
- No
|
|
249
|
-
-
|
|
250
|
-
- Boards may choose to return unallocated rewards to the creator or treasury.
|
|
242
|
+
- Reward outcomes are deterministic and auditable from job + vote/submission records.
|
|
243
|
+
- No partial loser rewards by default.
|
|
244
|
+
- Boards can choose return/unallocated behavior by config.
|
|
251
245
|
|
|
252
246
|
### Editing policy defaults
|
|
253
247
|
|
|
@@ -258,7 +252,7 @@ Defaults live under:
|
|
|
258
252
|
- `local.consensusPolicies` (named policy presets)
|
|
259
253
|
- `local.jobDefaults.consensusPolicy` (fallback when no key is provided)
|
|
260
254
|
|
|
261
|
-
Use these fields to override
|
|
255
|
+
Use these fields to override defaults:
|
|
262
256
|
|
|
263
257
|
- `policyKey` to select a preset
|
|
264
258
|
- `policyConfigJson` to override fields on the preset
|
|
@@ -268,8 +262,14 @@ Example:
|
|
|
268
262
|
|
|
269
263
|
```json
|
|
270
264
|
{
|
|
271
|
-
"policyKey": "
|
|
272
|
-
"policyConfigJson": {
|
|
265
|
+
"policyKey": "APPROVAL_VOTE",
|
|
266
|
+
"policyConfigJson": {
|
|
267
|
+
"quorum": 3,
|
|
268
|
+
"minScore": 1,
|
|
269
|
+
"minMargin": 0,
|
|
270
|
+
"tieBreak": "earliest",
|
|
271
|
+
"approvalVote": { "weightMode": "equal", "settlement": "immediate" }
|
|
272
|
+
}
|
|
273
273
|
}
|
|
274
274
|
```
|
|
275
275
|
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1057,7 +1057,7 @@ function resolveSh(): string {
|
|
|
1057
1057
|
'const storage=new JsonStorage(stateFile); await storage.init();',
|
|
1058
1058
|
'const ledger=new LedgerEngine(storage, defaultConfig);',
|
|
1059
1059
|
'const engine=new JobEngine(storage, ledger, defaultConfig);',
|
|
1060
|
-
'const input
|
|
1060
|
+
'const input = {};',
|
|
1061
1061
|
'if (winner) input.manualWinners = [winner];',
|
|
1062
1062
|
'if (subId) input.manualSubmissionId = subId;',
|
|
1063
1063
|
"const actor = winner || 'cli@local';",
|