@moltos/sdk 0.7.2 → 0.10.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/README.md +48 -146
- package/dist/cli.d.ts +11 -14
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +504 -487
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +18 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -37
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +138 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +335 -0
- package/dist/react.js.map +1 -0
- package/dist/sdk.d.ts +217 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +325 -0
- package/dist/sdk.js.map +1 -0
- package/dist/types.d.ts +91 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +32 -53
- package/dist/adapters/langchain.d.ts +0 -84
- package/dist/adapters/langchain.d.ts.map +0 -1
- package/dist/adapters/langchain.js +0 -145
- package/dist/adapters/langchain.js.map +0 -1
- package/dist/adapters/openclaw.d.ts +0 -83
- package/dist/adapters/openclaw.d.ts.map +0 -1
- package/dist/adapters/openclaw.js +0 -207
- package/dist/adapters/openclaw.js.map +0 -1
- package/dist/clawfs.d.ts +0 -95
- package/dist/clawfs.d.ts.map +0 -1
- package/dist/clawfs.js +0 -546
- package/dist/clawfs.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -15
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -327
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/cloud.d.ts +0 -37
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -390
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/complete.d.ts +0 -11
- package/dist/commands/complete.d.ts.map +0 -1
- package/dist/commands/complete.js +0 -154
- package/dist/commands/complete.js.map +0 -1
- package/dist/commands/fs.d.ts +0 -5
- package/dist/commands/fs.d.ts.map +0 -1
- package/dist/commands/fs.js +0 -139
- package/dist/commands/fs.js.map +0 -1
- package/dist/commands/hire.d.ts +0 -29
- package/dist/commands/hire.d.ts.map +0 -1
- package/dist/commands/hire.js +0 -411
- package/dist/commands/hire.js.map +0 -1
- package/dist/commands/init.d.ts +0 -23
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -488
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/marketplace.d.ts +0 -14
- package/dist/commands/marketplace.d.ts.map +0 -1
- package/dist/commands/marketplace.js +0 -183
- package/dist/commands/marketplace.js.map +0 -1
- package/dist/commands/register.d.ts +0 -8
- package/dist/commands/register.d.ts.map +0 -1
- package/dist/commands/register.js +0 -152
- package/dist/commands/register.js.map +0 -1
- package/dist/commands/status.d.ts +0 -17
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -388
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/tap.d.ts +0 -5
- package/dist/commands/tap.d.ts.map +0 -1
- package/dist/commands/tap.js +0 -31
- package/dist/commands/tap.js.map +0 -1
- package/dist/lib/api.d.ts +0 -32
- package/dist/lib/api.d.ts.map +0 -1
- package/dist/lib/api.js +0 -80
- package/dist/lib/api.js.map +0 -1
- package/dist/lib/arbitra.d.ts +0 -302
- package/dist/lib/arbitra.d.ts.map +0 -1
- package/dist/lib/arbitra.js +0 -486
- package/dist/lib/arbitra.js.map +0 -1
- package/dist/lib/clawfs.d.ts +0 -277
- package/dist/lib/clawfs.d.ts.map +0 -1
- package/dist/lib/clawfs.js +0 -628
- package/dist/lib/clawfs.js.map +0 -1
- package/dist/lib/clawid.d.ts +0 -189
- package/dist/lib/clawid.d.ts.map +0 -1
- package/dist/lib/clawid.js +0 -455
- package/dist/lib/clawid.js.map +0 -1
- package/dist/lib/config.d.ts +0 -23
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -29
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/forge.d.ts +0 -139
- package/dist/lib/forge.d.ts.map +0 -1
- package/dist/lib/forge.js +0 -461
- package/dist/lib/forge.js.map +0 -1
- package/dist/lib/scheduler.d.ts +0 -138
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js +0 -597
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/supabase.d.ts +0 -41
- package/dist/lib/supabase.d.ts.map +0 -1
- package/dist/lib/supabase.js +0 -125
- package/dist/lib/supabase.js.map +0 -1
- package/dist/lib/tap.d.ts +0 -208
- package/dist/lib/tap.d.ts.map +0 -1
- package/dist/lib/tap.js +0 -549
- package/dist/lib/tap.js.map +0 -1
- package/dist/tap.d.ts +0 -66
- package/dist/tap.d.ts.map +0 -1
- package/dist/tap.js +0 -302
- package/dist/tap.js.map +0 -1
package/dist/lib/arbitra.js
DELETED
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Arbitra - Dispute Resolution Module for MoltOS SDK
|
|
4
|
-
*
|
|
5
|
-
* Architecture:
|
|
6
|
-
* - 5/7 committee voting
|
|
7
|
-
* - Evidence-only voting
|
|
8
|
-
* - 2× reputation slashing for violations
|
|
9
|
-
* - Resolution in <15 minutes
|
|
10
|
-
* - Auto-dispute on ClawLink hash mismatch
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ArbitraClient = exports.InvalidEvidenceError = exports.ResolutionTimeoutError = exports.ArbitraError = void 0;
|
|
14
|
-
const crypto_1 = require("crypto");
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// ERROR CLASSES
|
|
17
|
-
// ============================================================================
|
|
18
|
-
/** Arbitra-specific errors */
|
|
19
|
-
class ArbitraError extends Error {
|
|
20
|
-
code;
|
|
21
|
-
constructor(message, code) {
|
|
22
|
-
super(message);
|
|
23
|
-
this.code = code;
|
|
24
|
-
this.name = 'ArbitraError';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ArbitraError = ArbitraError;
|
|
28
|
-
/** Timeout error for resolution */
|
|
29
|
-
class ResolutionTimeoutError extends ArbitraError {
|
|
30
|
-
constructor(disputeId) {
|
|
31
|
-
super(`Dispute ${disputeId} resolution timeout exceeded`, 'RESOLUTION_TIMEOUT');
|
|
32
|
-
this.name = 'ResolutionTimeoutError';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.ResolutionTimeoutError = ResolutionTimeoutError;
|
|
36
|
-
/** Invalid evidence error */
|
|
37
|
-
class InvalidEvidenceError extends ArbitraError {
|
|
38
|
-
constructor(message) {
|
|
39
|
-
super(message, 'INVALID_EVIDENCE');
|
|
40
|
-
this.name = 'InvalidEvidenceError';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.InvalidEvidenceError = InvalidEvidenceError;
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// ARBITRA CLIENT
|
|
46
|
-
// ============================================================================
|
|
47
|
-
/**
|
|
48
|
-
* ArbitraClient - Dispute Resolution Client for MoltOS SDK
|
|
49
|
-
*
|
|
50
|
-
* Handles dispute filing, committee voting, resolution calculation,
|
|
51
|
-
* reputation slashing, and automatic disputes on ClawLink hash mismatches.
|
|
52
|
-
*/
|
|
53
|
-
class ArbitraClient {
|
|
54
|
-
config;
|
|
55
|
-
disputes = new Map();
|
|
56
|
-
reputations = new Map();
|
|
57
|
-
votes = new Map();
|
|
58
|
-
hashDisputes = new Map(); // clawLinkHash -> disputeId
|
|
59
|
-
disputeCounter = 0;
|
|
60
|
-
voteCounter = 0;
|
|
61
|
-
constructor(config) {
|
|
62
|
-
this.config = {
|
|
63
|
-
committeeSize: 7,
|
|
64
|
-
majorityThreshold: 5,
|
|
65
|
-
resolutionTimeoutMs: 15 * 60 * 1000, // 15 minutes
|
|
66
|
-
slashMultiplier: 2,
|
|
67
|
-
...config,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
// ==========================================================================
|
|
71
|
-
// PUBLIC METHODS
|
|
72
|
-
// ==========================================================================
|
|
73
|
-
/**
|
|
74
|
-
* File a new dispute with evidence
|
|
75
|
-
*
|
|
76
|
-
* @param params - Dispute parameters
|
|
77
|
-
* @returns Filed dispute result with assigned committee
|
|
78
|
-
*/
|
|
79
|
-
async fileDispute(params) {
|
|
80
|
-
// Validate evidence
|
|
81
|
-
if (params.evidence.length === 0) {
|
|
82
|
-
throw new InvalidEvidenceError('At least one evidence item is required');
|
|
83
|
-
}
|
|
84
|
-
// Check for existing dispute on same hash (auto-dispute mechanism)
|
|
85
|
-
const existingDisputeId = this.hashDisputes.get(params.clawLinkHash);
|
|
86
|
-
if (existingDisputeId) {
|
|
87
|
-
const existingDispute = this.disputes.get(existingDisputeId);
|
|
88
|
-
if (existingDispute && existingDispute.status !== 'resolved') {
|
|
89
|
-
throw new ArbitraError(`Auto-dispute triggered: ClawLink hash ${params.clawLinkHash} already under dispute (${existingDisputeId})`, 'HASH_ALREADY_DISPUTED');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Generate dispute ID
|
|
93
|
-
const disputeId = this.generateDisputeId();
|
|
94
|
-
// Process and hash evidence
|
|
95
|
-
const processedEvidence = params.evidence.map((ev, idx) => {
|
|
96
|
-
const dataHash = this.calculateHash(ev.data);
|
|
97
|
-
return {
|
|
98
|
-
id: `${disputeId}-ev-${idx}`,
|
|
99
|
-
data: ev.data,
|
|
100
|
-
hash: dataHash,
|
|
101
|
-
timestamp: Date.now(),
|
|
102
|
-
submitter: ev.submitter,
|
|
103
|
-
metadata: ev.metadata,
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
// Select committee (excluding plaintiff and defendant)
|
|
107
|
-
const committee = this.getCommittee(this.config.committeeSize, [params.plaintiff, params.defendant]);
|
|
108
|
-
// Create dispute
|
|
109
|
-
const dispute = {
|
|
110
|
-
id: disputeId,
|
|
111
|
-
description: params.description,
|
|
112
|
-
plaintiff: params.plaintiff,
|
|
113
|
-
defendant: params.defendant,
|
|
114
|
-
status: 'voting',
|
|
115
|
-
evidence: processedEvidence,
|
|
116
|
-
committee,
|
|
117
|
-
votes: [],
|
|
118
|
-
createdAt: Date.now(),
|
|
119
|
-
resolvedAt: null,
|
|
120
|
-
resolution: null,
|
|
121
|
-
clawLinkHash: params.clawLinkHash,
|
|
122
|
-
relatedId: params.relatedId,
|
|
123
|
-
};
|
|
124
|
-
// Store dispute
|
|
125
|
-
this.disputes.set(disputeId, dispute);
|
|
126
|
-
this.hashDisputes.set(params.clawLinkHash, disputeId);
|
|
127
|
-
// Set resolution timeout
|
|
128
|
-
this.scheduleResolutionTimeout(disputeId);
|
|
129
|
-
return {
|
|
130
|
-
dispute,
|
|
131
|
-
committee,
|
|
132
|
-
estimatedResolutionTime: this.config.resolutionTimeoutMs,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Cast a vote on a dispute (committee members only)
|
|
137
|
-
*
|
|
138
|
-
* Implements evidence-only voting - votes must reference specific evidence.
|
|
139
|
-
*
|
|
140
|
-
* @param params - Vote parameters
|
|
141
|
-
* @returns Vote result with current status
|
|
142
|
-
*/
|
|
143
|
-
async vote(params) {
|
|
144
|
-
const dispute = this.disputes.get(params.disputeId);
|
|
145
|
-
if (!dispute) {
|
|
146
|
-
throw new ArbitraError(`Dispute ${params.disputeId} not found`, 'DISPUTE_NOT_FOUND');
|
|
147
|
-
}
|
|
148
|
-
// Validate dispute status
|
|
149
|
-
if (dispute.status !== 'voting') {
|
|
150
|
-
throw new ArbitraError(`Dispute ${params.disputeId} is not open for voting (status: ${dispute.status})`, 'INVALID_DISPUTE_STATUS');
|
|
151
|
-
}
|
|
152
|
-
// Verify voter is on committee
|
|
153
|
-
if (!dispute.committee.includes(params.voter)) {
|
|
154
|
-
throw new ArbitraError(`Agent ${params.voter} is not a committee member for dispute ${params.disputeId}`, 'NOT_COMMITTEE_MEMBER');
|
|
155
|
-
}
|
|
156
|
-
// Check for duplicate vote
|
|
157
|
-
const existingVote = dispute.votes.find(v => v.voter === params.voter);
|
|
158
|
-
if (existingVote) {
|
|
159
|
-
throw new ArbitraError(`Agent ${params.voter} has already voted on dispute ${params.disputeId}`, 'DUPLICATE_VOTE');
|
|
160
|
-
}
|
|
161
|
-
// Evidence-only voting: verify evidence hash exists
|
|
162
|
-
const evidenceExists = dispute.evidence.some(ev => ev.hash === params.evidenceHash);
|
|
163
|
-
if (!evidenceExists) {
|
|
164
|
-
throw new InvalidEvidenceError(`Evidence with hash ${params.evidenceHash} not found in dispute ${params.disputeId}`);
|
|
165
|
-
}
|
|
166
|
-
// Create vote
|
|
167
|
-
const vote = {
|
|
168
|
-
id: this.generateVoteId(),
|
|
169
|
-
disputeId: params.disputeId,
|
|
170
|
-
voter: params.voter,
|
|
171
|
-
decision: params.decision,
|
|
172
|
-
evidenceHash: params.evidenceHash,
|
|
173
|
-
timestamp: Date.now(),
|
|
174
|
-
signature: params.signature,
|
|
175
|
-
};
|
|
176
|
-
// Store vote
|
|
177
|
-
this.votes.set(vote.id, vote);
|
|
178
|
-
dispute.votes.push(vote);
|
|
179
|
-
// Check if we can resolve
|
|
180
|
-
const isResolved = this.canResolve(dispute);
|
|
181
|
-
if (isResolved) {
|
|
182
|
-
await this.resolve(params.disputeId);
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
vote,
|
|
186
|
-
currentVotes: dispute.votes.length,
|
|
187
|
-
requiredVotes: this.config.majorityThreshold,
|
|
188
|
-
isResolved: true,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Resolve a dispute by calculating majority decision
|
|
193
|
-
*
|
|
194
|
-
* Requires 5/7 committee votes for resolution.
|
|
195
|
-
*
|
|
196
|
-
* @param disputeId - ID of dispute to resolve
|
|
197
|
-
* @returns Resolution outcome
|
|
198
|
-
*/
|
|
199
|
-
async resolve(disputeId) {
|
|
200
|
-
const dispute = this.disputes.get(disputeId);
|
|
201
|
-
if (!dispute) {
|
|
202
|
-
throw new ArbitraError(`Dispute ${disputeId} not found`, 'DISPUTE_NOT_FOUND');
|
|
203
|
-
}
|
|
204
|
-
if (dispute.status === 'resolved') {
|
|
205
|
-
if (!dispute.resolution) {
|
|
206
|
-
throw new ArbitraError(`Dispute ${disputeId} marked resolved but has no resolution`, 'INVALID_STATE');
|
|
207
|
-
}
|
|
208
|
-
return dispute.resolution;
|
|
209
|
-
}
|
|
210
|
-
// Count votes
|
|
211
|
-
const forVotes = dispute.votes.filter(v => v.decision).map(v => v.voter);
|
|
212
|
-
const againstVotes = dispute.votes.filter(v => !v.decision).map(v => v.voter);
|
|
213
|
-
// Check for majority (5/7)
|
|
214
|
-
const hasMajorityFor = forVotes.length >= this.config.majorityThreshold;
|
|
215
|
-
const hasMajorityAgainst = againstVotes.length >= this.config.majorityThreshold;
|
|
216
|
-
if (!hasMajorityFor && !hasMajorityAgainst) {
|
|
217
|
-
throw new ArbitraError(`Cannot resolve dispute ${disputeId}: insufficient votes (need ${this.config.majorityThreshold}/7)`, 'INSUFFICIENT_VOTES');
|
|
218
|
-
}
|
|
219
|
-
// Determine decision
|
|
220
|
-
const decision = hasMajorityFor;
|
|
221
|
-
// Apply reputation slashing
|
|
222
|
-
const penalties = [];
|
|
223
|
-
if (decision) {
|
|
224
|
-
// Plaintiff wins: defendant loses reputation (2× if violations exist)
|
|
225
|
-
const defendantSlash = this.calculateSlashAmount(dispute.defendant);
|
|
226
|
-
penalties.push(await this.slash(dispute.defendant, defendantSlash, 'Lost dispute as defendant'));
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
// Defendant wins: plaintiff loses reputation (2× if violations exist)
|
|
230
|
-
const plaintiffSlash = this.calculateSlashAmount(dispute.plaintiff);
|
|
231
|
-
penalties.push(await this.slash(dispute.plaintiff, plaintiffSlash, 'Lost dispute as plaintiff'));
|
|
232
|
-
}
|
|
233
|
-
// Slash committee members who didn't vote (inactivity penalty)
|
|
234
|
-
const nonVoters = dispute.committee.filter(member => !dispute.votes.some(v => v.voter === member));
|
|
235
|
-
for (const nonVoter of nonVoters) {
|
|
236
|
-
const inactivitySlash = Math.floor(this.calculateSlashAmount(nonVoter) / 2);
|
|
237
|
-
penalties.push(await this.slash(nonVoter, inactivitySlash, 'Failed to vote on assigned dispute'));
|
|
238
|
-
}
|
|
239
|
-
// Create resolution
|
|
240
|
-
const resolution = {
|
|
241
|
-
id: `${disputeId}-res`,
|
|
242
|
-
disputeId,
|
|
243
|
-
decision,
|
|
244
|
-
forVotes,
|
|
245
|
-
againstVotes,
|
|
246
|
-
requiredVotes: this.config.majorityThreshold,
|
|
247
|
-
resolvedAt: Date.now(),
|
|
248
|
-
penalties,
|
|
249
|
-
};
|
|
250
|
-
// Update dispute
|
|
251
|
-
dispute.resolution = resolution;
|
|
252
|
-
dispute.resolvedAt = resolution.resolvedAt;
|
|
253
|
-
dispute.status = 'resolved';
|
|
254
|
-
// Update reputation for winners
|
|
255
|
-
for (const voter of forVotes) {
|
|
256
|
-
this.updateReputation(voter, decision ? 10 : 0, true);
|
|
257
|
-
}
|
|
258
|
-
for (const voter of againstVotes) {
|
|
259
|
-
this.updateReputation(voter, !decision ? 10 : 0, true);
|
|
260
|
-
}
|
|
261
|
-
return resolution;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Apply reputation slashing to an agent
|
|
265
|
-
*
|
|
266
|
-
* 2× multiplier applies if agent has previous violations.
|
|
267
|
-
*
|
|
268
|
-
* @param agentId - Agent to slash
|
|
269
|
-
* @param amount - Base amount to slash
|
|
270
|
-
* @param reason - Reason for slashing
|
|
271
|
-
* @returns Applied penalty
|
|
272
|
-
*/
|
|
273
|
-
async slash(agentId, amount, reason) {
|
|
274
|
-
const reputation = this.getOrCreateReputation(agentId);
|
|
275
|
-
// Apply 2× multiplier if agent has violations
|
|
276
|
-
const multiplier = reputation.violations > 0 ? this.config.slashMultiplier : 1;
|
|
277
|
-
const finalAmount = amount * multiplier;
|
|
278
|
-
// Apply penalty
|
|
279
|
-
reputation.score = Math.max(0, reputation.score - finalAmount);
|
|
280
|
-
reputation.violations++;
|
|
281
|
-
reputation.lastActive = Date.now();
|
|
282
|
-
const penalty = {
|
|
283
|
-
agentId,
|
|
284
|
-
amount: finalAmount,
|
|
285
|
-
reason,
|
|
286
|
-
timestamp: Date.now(),
|
|
287
|
-
};
|
|
288
|
-
return penalty;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Get committee of randomly selected high-reputation agents
|
|
292
|
-
*
|
|
293
|
-
* Selects 7 agents with highest reputation, excluding specified agents.
|
|
294
|
-
*
|
|
295
|
-
* @param size - Committee size (default: 7)
|
|
296
|
-
* @param exclude - Agents to exclude (e.g., plaintiff/defendant)
|
|
297
|
-
* @returns Array of agent IDs
|
|
298
|
-
*/
|
|
299
|
-
getCommittee(size = this.config.committeeSize, exclude = []) {
|
|
300
|
-
// Get all agents sorted by reputation (highest first)
|
|
301
|
-
const allAgents = Array.from(this.reputations.entries())
|
|
302
|
-
.filter(([agentId]) => !exclude.includes(agentId))
|
|
303
|
-
.sort((a, b) => b[1].score - a[1].score);
|
|
304
|
-
// If we don't have enough agents, generate placeholder high-rep agents
|
|
305
|
-
const committee = [];
|
|
306
|
-
const needed = Math.min(size, allAgents.length + size);
|
|
307
|
-
// Add real high-rep agents first
|
|
308
|
-
for (let i = 0; i < Math.min(size, allAgents.length); i++) {
|
|
309
|
-
committee.push(allAgents[i][0]);
|
|
310
|
-
}
|
|
311
|
-
// Fill remaining slots with weighted random selection
|
|
312
|
-
// Higher rep = higher chance of selection
|
|
313
|
-
while (committee.length < size) {
|
|
314
|
-
const candidates = allAgents.filter(a => !committee.includes(a[0]));
|
|
315
|
-
if (candidates.length === 0) {
|
|
316
|
-
// Generate synthetic committee member
|
|
317
|
-
const syntheticId = `committee-synth-${Date.now()}-${committee.length}`;
|
|
318
|
-
this.reputations.set(syntheticId, {
|
|
319
|
-
agentId: syntheticId,
|
|
320
|
-
score: 8000,
|
|
321
|
-
totalDisputes: 0,
|
|
322
|
-
successfulDisputes: 0,
|
|
323
|
-
violations: 0,
|
|
324
|
-
lastActive: Date.now(),
|
|
325
|
-
});
|
|
326
|
-
committee.push(syntheticId);
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
// Weighted random selection based on reputation
|
|
330
|
-
const totalWeight = candidates.reduce((sum, [, rep]) => sum + rep.score, 0);
|
|
331
|
-
let random = Math.random() * totalWeight;
|
|
332
|
-
for (const [agentId, rep] of candidates) {
|
|
333
|
-
random -= rep.score;
|
|
334
|
-
if (random <= 0) {
|
|
335
|
-
committee.push(agentId);
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return committee.slice(0, size);
|
|
342
|
-
}
|
|
343
|
-
// ==========================================================================
|
|
344
|
-
// AUTO-DISPUTE METHODS
|
|
345
|
-
// ==========================================================================
|
|
346
|
-
/**
|
|
347
|
-
* Check for ClawLink hash mismatch and auto-file dispute
|
|
348
|
-
*
|
|
349
|
-
* @param clawLinkHash - Hash to verify
|
|
350
|
-
* @param expectedHash - Expected hash value
|
|
351
|
-
* @param context - Context for the dispute
|
|
352
|
-
* @returns Auto-filed dispute or null if no mismatch
|
|
353
|
-
*/
|
|
354
|
-
async checkAndAutoDispute(clawLinkHash, expectedHash, context) {
|
|
355
|
-
if (clawLinkHash === expectedHash) {
|
|
356
|
-
return null; // No mismatch, no dispute needed
|
|
357
|
-
}
|
|
358
|
-
// Hash mismatch detected - auto-file dispute
|
|
359
|
-
return this.fileDispute({
|
|
360
|
-
...context,
|
|
361
|
-
clawLinkHash,
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Register a ClawLink hash for monitoring
|
|
366
|
-
*
|
|
367
|
-
* @param hash - Hash to monitor
|
|
368
|
-
* @param disputeId - Associated dispute ID
|
|
369
|
-
*/
|
|
370
|
-
registerClawLinkHash(hash, disputeId) {
|
|
371
|
-
this.hashDisputes.set(hash, disputeId);
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Get dispute ID for a ClawLink hash
|
|
375
|
-
*
|
|
376
|
-
* @param hash - ClawLink hash
|
|
377
|
-
* @returns Dispute ID or undefined
|
|
378
|
-
*/
|
|
379
|
-
getDisputeByHash(hash) {
|
|
380
|
-
return this.hashDisputes.get(hash);
|
|
381
|
-
}
|
|
382
|
-
// ==========================================================================
|
|
383
|
-
// QUERY METHODS
|
|
384
|
-
// ==========================================================================
|
|
385
|
-
/**
|
|
386
|
-
* Get dispute by ID
|
|
387
|
-
*/
|
|
388
|
-
getDispute(disputeId) {
|
|
389
|
-
return this.disputes.get(disputeId);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Get all disputes
|
|
393
|
-
*/
|
|
394
|
-
getAllDisputes() {
|
|
395
|
-
return Array.from(this.disputes.values());
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Get disputes by status
|
|
399
|
-
*/
|
|
400
|
-
getDisputesByStatus(status) {
|
|
401
|
-
return this.getAllDisputes().filter(d => d.status === status);
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Get agent reputation
|
|
405
|
-
*/
|
|
406
|
-
getReputation(agentId) {
|
|
407
|
-
return this.reputations.get(agentId);
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Get vote by ID
|
|
411
|
-
*/
|
|
412
|
-
getVote(voteId) {
|
|
413
|
-
return this.votes.get(voteId);
|
|
414
|
-
}
|
|
415
|
-
// ==========================================================================
|
|
416
|
-
// PRIVATE METHODS
|
|
417
|
-
// ==========================================================================
|
|
418
|
-
generateDisputeId() {
|
|
419
|
-
this.disputeCounter++;
|
|
420
|
-
return `disp-${Date.now()}-${this.disputeCounter}`;
|
|
421
|
-
}
|
|
422
|
-
generateVoteId() {
|
|
423
|
-
this.voteCounter++;
|
|
424
|
-
return `vote-${Date.now()}-${this.voteCounter}`;
|
|
425
|
-
}
|
|
426
|
-
calculateHash(data) {
|
|
427
|
-
return (0, crypto_1.createHash)('sha256').update(data).digest('hex');
|
|
428
|
-
}
|
|
429
|
-
canResolve(dispute) {
|
|
430
|
-
const forCount = dispute.votes.filter(v => v.decision).length;
|
|
431
|
-
const againstCount = dispute.votes.filter(v => !v.decision).length;
|
|
432
|
-
return (forCount >= this.config.majorityThreshold ||
|
|
433
|
-
againstCount >= this.config.majorityThreshold);
|
|
434
|
-
}
|
|
435
|
-
scheduleResolutionTimeout(disputeId) {
|
|
436
|
-
setTimeout(() => {
|
|
437
|
-
const dispute = this.disputes.get(disputeId);
|
|
438
|
-
if (dispute && dispute.status === 'voting') {
|
|
439
|
-
// Force resolution with available votes
|
|
440
|
-
try {
|
|
441
|
-
this.resolve(disputeId);
|
|
442
|
-
}
|
|
443
|
-
catch {
|
|
444
|
-
// If can't resolve (insufficient votes), reject the dispute
|
|
445
|
-
dispute.status = 'rejected';
|
|
446
|
-
dispute.resolvedAt = Date.now();
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}, this.config.resolutionTimeoutMs);
|
|
450
|
-
}
|
|
451
|
-
getOrCreateReputation(agentId) {
|
|
452
|
-
let reputation = this.reputations.get(agentId);
|
|
453
|
-
if (!reputation) {
|
|
454
|
-
reputation = {
|
|
455
|
-
agentId,
|
|
456
|
-
score: 5000, // Starting reputation
|
|
457
|
-
totalDisputes: 0,
|
|
458
|
-
successfulDisputes: 0,
|
|
459
|
-
violations: 0,
|
|
460
|
-
lastActive: Date.now(),
|
|
461
|
-
};
|
|
462
|
-
this.reputations.set(agentId, reputation);
|
|
463
|
-
}
|
|
464
|
-
return reputation;
|
|
465
|
-
}
|
|
466
|
-
calculateSlashAmount(agentId) {
|
|
467
|
-
const reputation = this.getOrCreateReputation(agentId);
|
|
468
|
-
// Base slash is 10% of current score
|
|
469
|
-
return Math.floor(reputation.score * 0.1);
|
|
470
|
-
}
|
|
471
|
-
updateReputation(agentId, delta, successful) {
|
|
472
|
-
const reputation = this.getOrCreateReputation(agentId);
|
|
473
|
-
reputation.score = Math.min(10000, Math.max(0, reputation.score + delta));
|
|
474
|
-
reputation.totalDisputes++;
|
|
475
|
-
if (successful) {
|
|
476
|
-
reputation.successfulDisputes++;
|
|
477
|
-
}
|
|
478
|
-
reputation.lastActive = Date.now();
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
exports.ArbitraClient = ArbitraClient;
|
|
482
|
-
// ============================================================================
|
|
483
|
-
// EXPORT DEFAULT
|
|
484
|
-
// ============================================================================
|
|
485
|
-
exports.default = ArbitraClient;
|
|
486
|
-
//# sourceMappingURL=arbitra.js.map
|
package/dist/lib/arbitra.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arbitra.js","sourceRoot":"","sources":["../../src/lib/arbitra.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAAoC;AAiKpC,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,8BAA8B;AAC9B,MAAa,YAAa,SAAQ,KAAK;IACD;IAApC,YAAY,OAAe,EAAS,IAAY;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,SAAI,GAAJ,IAAI,CAAQ;QAE9C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,mCAAmC;AACnC,MAAa,sBAAuB,SAAQ,YAAY;IACtD,YAAY,SAAiB;QAC3B,KAAK,CACH,WAAW,SAAS,8BAA8B,EAClD,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AARD,wDAQC;AAED,6BAA6B;AAC7B,MAAa,oBAAqB,SAAQ,YAAY;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC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