clawdentials-mcp 0.1.0 → 0.8.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.
Files changed (39) hide show
  1. package/README.md +452 -58
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +309 -18
  4. package/dist/schemas/index.d.ts +328 -0
  5. package/dist/schemas/index.js +119 -0
  6. package/dist/services/firestore.d.ts +45 -2
  7. package/dist/services/firestore.js +417 -6
  8. package/dist/services/moltbook.d.ts +45 -0
  9. package/dist/services/moltbook.js +90 -0
  10. package/dist/services/payments/alby.d.ts +104 -0
  11. package/dist/services/payments/alby.js +239 -0
  12. package/dist/services/payments/breez.d.ts +91 -0
  13. package/dist/services/payments/breez.js +267 -0
  14. package/dist/services/payments/cashu.d.ts +127 -0
  15. package/dist/services/payments/cashu.js +248 -0
  16. package/dist/services/payments/coinremitter.d.ts +84 -0
  17. package/dist/services/payments/coinremitter.js +176 -0
  18. package/dist/services/payments/index.d.ts +132 -0
  19. package/dist/services/payments/index.js +180 -0
  20. package/dist/services/payments/oxapay.d.ts +89 -0
  21. package/dist/services/payments/oxapay.js +221 -0
  22. package/dist/services/payments/x402.d.ts +61 -0
  23. package/dist/services/payments/x402.js +94 -0
  24. package/dist/services/payments/zbd.d.ts +88 -0
  25. package/dist/services/payments/zbd.js +221 -0
  26. package/dist/tools/admin.d.ts +195 -0
  27. package/dist/tools/admin.js +210 -0
  28. package/dist/tools/agent.d.ts +208 -0
  29. package/dist/tools/agent.js +241 -0
  30. package/dist/tools/bounty.d.ts +361 -0
  31. package/dist/tools/bounty.js +601 -0
  32. package/dist/tools/escrow.d.ts +74 -16
  33. package/dist/tools/escrow.js +139 -28
  34. package/dist/tools/index.d.ts +4 -0
  35. package/dist/tools/index.js +4 -0
  36. package/dist/tools/payment.d.ts +144 -0
  37. package/dist/tools/payment.js +376 -0
  38. package/dist/types/index.d.ts +103 -1
  39. package/package.json +18 -2
@@ -5,26 +5,32 @@ export declare const escrowCreateSchema: z.ZodObject<{
5
5
  currency: z.ZodDefault<z.ZodEnum<["USD", "USDC", "BTC"]>>;
6
6
  providerAgentId: z.ZodString;
7
7
  clientAgentId: z.ZodString;
8
+ apiKey: z.ZodString;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  taskDescription: string;
10
11
  amount: number;
11
12
  currency: "USD" | "USDC" | "BTC";
12
13
  providerAgentId: string;
13
14
  clientAgentId: string;
15
+ apiKey: string;
14
16
  }, {
15
17
  taskDescription: string;
16
18
  amount: number;
17
19
  providerAgentId: string;
18
20
  clientAgentId: string;
21
+ apiKey: string;
19
22
  currency?: "USD" | "USDC" | "BTC" | undefined;
20
23
  }>;
21
24
  export declare const escrowCompleteSchema: z.ZodObject<{
22
25
  escrowId: z.ZodString;
23
26
  proofOfWork: z.ZodString;
27
+ apiKey: z.ZodString;
24
28
  }, "strip", z.ZodTypeAny, {
29
+ apiKey: string;
25
30
  escrowId: string;
26
31
  proofOfWork: string;
27
32
  }, {
33
+ apiKey: string;
28
34
  escrowId: string;
29
35
  proofOfWork: string;
30
36
  }>;
@@ -35,6 +41,328 @@ export declare const escrowStatusSchema: z.ZodObject<{
35
41
  }, {
36
42
  escrowId: string;
37
43
  }>;
44
+ export declare const escrowDisputeSchema: z.ZodObject<{
45
+ escrowId: z.ZodString;
46
+ reason: z.ZodString;
47
+ apiKey: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ apiKey: string;
50
+ escrowId: string;
51
+ reason: string;
52
+ }, {
53
+ apiKey: string;
54
+ escrowId: string;
55
+ reason: string;
56
+ }>;
57
+ export declare const agentRegisterSchema: z.ZodObject<{
58
+ name: z.ZodString;
59
+ description: z.ZodString;
60
+ skills: z.ZodArray<z.ZodString, "many">;
61
+ moltbookToken: z.ZodOptional<z.ZodString>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ name: string;
64
+ description: string;
65
+ skills: string[];
66
+ moltbookToken?: string | undefined;
67
+ }, {
68
+ name: string;
69
+ description: string;
70
+ skills: string[];
71
+ moltbookToken?: string | undefined;
72
+ }>;
73
+ export declare const agentScoreSchema: z.ZodObject<{
74
+ agentId: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
76
+ agentId: string;
77
+ }, {
78
+ agentId: string;
79
+ }>;
80
+ export declare const agentSearchSchema: z.ZodObject<{
81
+ skill: z.ZodOptional<z.ZodString>;
82
+ verified: z.ZodOptional<z.ZodBoolean>;
83
+ minTasksCompleted: z.ZodOptional<z.ZodNumber>;
84
+ limit: z.ZodDefault<z.ZodNumber>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ limit: number;
87
+ skill?: string | undefined;
88
+ verified?: boolean | undefined;
89
+ minTasksCompleted?: number | undefined;
90
+ }, {
91
+ skill?: string | undefined;
92
+ verified?: boolean | undefined;
93
+ minTasksCompleted?: number | undefined;
94
+ limit?: number | undefined;
95
+ }>;
96
+ export declare const agentBalanceSchema: z.ZodObject<{
97
+ agentId: z.ZodString;
98
+ apiKey: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ apiKey: string;
101
+ agentId: string;
102
+ }, {
103
+ apiKey: string;
104
+ agentId: string;
105
+ }>;
106
+ export declare const withdrawRequestSchema: z.ZodObject<{
107
+ agentId: z.ZodString;
108
+ apiKey: z.ZodString;
109
+ amount: z.ZodNumber;
110
+ currency: z.ZodDefault<z.ZodEnum<["USD", "USDC", "BTC"]>>;
111
+ paymentMethod: z.ZodString;
112
+ }, "strip", z.ZodTypeAny, {
113
+ amount: number;
114
+ currency: "USD" | "USDC" | "BTC";
115
+ apiKey: string;
116
+ agentId: string;
117
+ paymentMethod: string;
118
+ }, {
119
+ amount: number;
120
+ apiKey: string;
121
+ agentId: string;
122
+ paymentMethod: string;
123
+ currency?: "USD" | "USDC" | "BTC" | undefined;
124
+ }>;
125
+ export declare const adminCreditBalanceSchema: z.ZodObject<{
126
+ adminSecret: z.ZodString;
127
+ agentId: z.ZodString;
128
+ amount: z.ZodNumber;
129
+ currency: z.ZodDefault<z.ZodEnum<["USD", "USDC", "BTC"]>>;
130
+ notes: z.ZodOptional<z.ZodString>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ amount: number;
133
+ currency: "USD" | "USDC" | "BTC";
134
+ agentId: string;
135
+ adminSecret: string;
136
+ notes?: string | undefined;
137
+ }, {
138
+ amount: number;
139
+ agentId: string;
140
+ adminSecret: string;
141
+ currency?: "USD" | "USDC" | "BTC" | undefined;
142
+ notes?: string | undefined;
143
+ }>;
144
+ export declare const adminProcessWithdrawalSchema: z.ZodObject<{
145
+ adminSecret: z.ZodString;
146
+ withdrawalId: z.ZodString;
147
+ action: z.ZodEnum<["complete", "reject"]>;
148
+ notes: z.ZodOptional<z.ZodString>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ adminSecret: string;
151
+ withdrawalId: string;
152
+ action: "complete" | "reject";
153
+ notes?: string | undefined;
154
+ }, {
155
+ adminSecret: string;
156
+ withdrawalId: string;
157
+ action: "complete" | "reject";
158
+ notes?: string | undefined;
159
+ }>;
160
+ export declare const adminListWithdrawalsSchema: z.ZodObject<{
161
+ adminSecret: z.ZodString;
162
+ status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "rejected"]>>;
163
+ limit: z.ZodDefault<z.ZodNumber>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ limit: number;
166
+ adminSecret: string;
167
+ status?: "pending" | "processing" | "completed" | "rejected" | undefined;
168
+ }, {
169
+ adminSecret: string;
170
+ status?: "pending" | "processing" | "completed" | "rejected" | undefined;
171
+ limit?: number | undefined;
172
+ }>;
38
173
  export type EscrowCreateInput = z.infer<typeof escrowCreateSchema>;
39
174
  export type EscrowCompleteInput = z.infer<typeof escrowCompleteSchema>;
40
175
  export type EscrowStatusInput = z.infer<typeof escrowStatusSchema>;
176
+ export type EscrowDisputeInput = z.infer<typeof escrowDisputeSchema>;
177
+ export type AgentRegisterInput = z.infer<typeof agentRegisterSchema>;
178
+ export type AgentScoreInput = z.infer<typeof agentScoreSchema>;
179
+ export type AgentSearchInput = z.infer<typeof agentSearchSchema>;
180
+ export type AgentBalanceInput = z.infer<typeof agentBalanceSchema>;
181
+ export type WithdrawRequestInput = z.infer<typeof withdrawRequestSchema>;
182
+ export type AdminCreditBalanceInput = z.infer<typeof adminCreditBalanceSchema>;
183
+ export type AdminProcessWithdrawalInput = z.infer<typeof adminProcessWithdrawalSchema>;
184
+ export type AdminListWithdrawalsInput = z.infer<typeof adminListWithdrawalsSchema>;
185
+ export declare const bountyCreateSchema: z.ZodObject<{
186
+ title: z.ZodString;
187
+ summary: z.ZodString;
188
+ description: z.ZodString;
189
+ difficulty: z.ZodEnum<["trivial", "easy", "medium", "hard", "expert"]>;
190
+ requiredSkills: z.ZodArray<z.ZodString, "many">;
191
+ acceptanceCriteria: z.ZodArray<z.ZodString, "many">;
192
+ amount: z.ZodNumber;
193
+ currency: z.ZodDefault<z.ZodEnum<["USD", "USDC", "USDT", "BTC"]>>;
194
+ expiresInDays: z.ZodDefault<z.ZodNumber>;
195
+ repoUrl: z.ZodOptional<z.ZodString>;
196
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
197
+ path: z.ZodString;
198
+ description: z.ZodOptional<z.ZodString>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ path: string;
201
+ description?: string | undefined;
202
+ }, {
203
+ path: string;
204
+ description?: string | undefined;
205
+ }>, "many">>;
206
+ submissionMethod: z.ZodDefault<z.ZodEnum<["pr", "patch", "gist", "proof"]>>;
207
+ targetBranch: z.ZodOptional<z.ZodString>;
208
+ modAgentId: z.ZodOptional<z.ZodString>;
209
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
210
+ posterAgentId: z.ZodString;
211
+ apiKey: z.ZodString;
212
+ fundNow: z.ZodDefault<z.ZodBoolean>;
213
+ }, "strip", z.ZodTypeAny, {
214
+ amount: number;
215
+ currency: "USD" | "USDC" | "BTC" | "USDT";
216
+ apiKey: string;
217
+ description: string;
218
+ title: string;
219
+ summary: string;
220
+ difficulty: "trivial" | "easy" | "medium" | "hard" | "expert";
221
+ requiredSkills: string[];
222
+ acceptanceCriteria: string[];
223
+ expiresInDays: number;
224
+ submissionMethod: "pr" | "patch" | "gist" | "proof";
225
+ posterAgentId: string;
226
+ fundNow: boolean;
227
+ repoUrl?: string | undefined;
228
+ files?: {
229
+ path: string;
230
+ description?: string | undefined;
231
+ }[] | undefined;
232
+ targetBranch?: string | undefined;
233
+ modAgentId?: string | undefined;
234
+ tags?: string[] | undefined;
235
+ }, {
236
+ amount: number;
237
+ apiKey: string;
238
+ description: string;
239
+ title: string;
240
+ summary: string;
241
+ difficulty: "trivial" | "easy" | "medium" | "hard" | "expert";
242
+ requiredSkills: string[];
243
+ acceptanceCriteria: string[];
244
+ posterAgentId: string;
245
+ currency?: "USD" | "USDC" | "BTC" | "USDT" | undefined;
246
+ expiresInDays?: number | undefined;
247
+ repoUrl?: string | undefined;
248
+ files?: {
249
+ path: string;
250
+ description?: string | undefined;
251
+ }[] | undefined;
252
+ submissionMethod?: "pr" | "patch" | "gist" | "proof" | undefined;
253
+ targetBranch?: string | undefined;
254
+ modAgentId?: string | undefined;
255
+ tags?: string[] | undefined;
256
+ fundNow?: boolean | undefined;
257
+ }>;
258
+ export declare const bountyFundSchema: z.ZodObject<{
259
+ bountyId: z.ZodString;
260
+ agentId: z.ZodString;
261
+ apiKey: z.ZodString;
262
+ }, "strip", z.ZodTypeAny, {
263
+ apiKey: string;
264
+ agentId: string;
265
+ bountyId: string;
266
+ }, {
267
+ apiKey: string;
268
+ agentId: string;
269
+ bountyId: string;
270
+ }>;
271
+ export declare const bountyClaimSchema: z.ZodObject<{
272
+ bountyId: z.ZodString;
273
+ agentId: z.ZodString;
274
+ apiKey: z.ZodString;
275
+ }, "strip", z.ZodTypeAny, {
276
+ apiKey: string;
277
+ agentId: string;
278
+ bountyId: string;
279
+ }, {
280
+ apiKey: string;
281
+ agentId: string;
282
+ bountyId: string;
283
+ }>;
284
+ export declare const bountySubmitSchema: z.ZodObject<{
285
+ bountyId: z.ZodString;
286
+ submissionUrl: z.ZodString;
287
+ notes: z.ZodOptional<z.ZodString>;
288
+ agentId: z.ZodString;
289
+ apiKey: z.ZodString;
290
+ }, "strip", z.ZodTypeAny, {
291
+ apiKey: string;
292
+ agentId: string;
293
+ bountyId: string;
294
+ submissionUrl: string;
295
+ notes?: string | undefined;
296
+ }, {
297
+ apiKey: string;
298
+ agentId: string;
299
+ bountyId: string;
300
+ submissionUrl: string;
301
+ notes?: string | undefined;
302
+ }>;
303
+ export declare const bountyJudgeSchema: z.ZodObject<{
304
+ bountyId: z.ZodString;
305
+ winnerAgentId: z.ZodString;
306
+ notes: z.ZodOptional<z.ZodString>;
307
+ judgeAgentId: z.ZodString;
308
+ apiKey: z.ZodString;
309
+ }, "strip", z.ZodTypeAny, {
310
+ apiKey: string;
311
+ bountyId: string;
312
+ winnerAgentId: string;
313
+ judgeAgentId: string;
314
+ notes?: string | undefined;
315
+ }, {
316
+ apiKey: string;
317
+ bountyId: string;
318
+ winnerAgentId: string;
319
+ judgeAgentId: string;
320
+ notes?: string | undefined;
321
+ }>;
322
+ export declare const bountySearchSchema: z.ZodObject<{
323
+ skill: z.ZodOptional<z.ZodString>;
324
+ difficulty: z.ZodOptional<z.ZodEnum<["trivial", "easy", "medium", "hard", "expert"]>>;
325
+ status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["open", "claimed", "in_review"]>>>;
326
+ minAmount: z.ZodOptional<z.ZodNumber>;
327
+ maxAmount: z.ZodOptional<z.ZodNumber>;
328
+ tag: z.ZodOptional<z.ZodString>;
329
+ limit: z.ZodDefault<z.ZodNumber>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ status: "open" | "claimed" | "in_review";
332
+ limit: number;
333
+ skill?: string | undefined;
334
+ difficulty?: "trivial" | "easy" | "medium" | "hard" | "expert" | undefined;
335
+ minAmount?: number | undefined;
336
+ maxAmount?: number | undefined;
337
+ tag?: string | undefined;
338
+ }, {
339
+ status?: "open" | "claimed" | "in_review" | undefined;
340
+ skill?: string | undefined;
341
+ limit?: number | undefined;
342
+ difficulty?: "trivial" | "easy" | "medium" | "hard" | "expert" | undefined;
343
+ minAmount?: number | undefined;
344
+ maxAmount?: number | undefined;
345
+ tag?: string | undefined;
346
+ }>;
347
+ export declare const bountyGetSchema: z.ZodObject<{
348
+ bountyId: z.ZodString;
349
+ }, "strip", z.ZodTypeAny, {
350
+ bountyId: string;
351
+ }, {
352
+ bountyId: string;
353
+ }>;
354
+ export declare const bountyExportMarkdownSchema: z.ZodObject<{
355
+ bountyId: z.ZodString;
356
+ }, "strip", z.ZodTypeAny, {
357
+ bountyId: string;
358
+ }, {
359
+ bountyId: string;
360
+ }>;
361
+ export type BountyCreateInput = z.infer<typeof bountyCreateSchema>;
362
+ export type BountyFundInput = z.infer<typeof bountyFundSchema>;
363
+ export type BountyClaimInput = z.infer<typeof bountyClaimSchema>;
364
+ export type BountySubmitInput = z.infer<typeof bountySubmitSchema>;
365
+ export type BountyJudgeInput = z.infer<typeof bountyJudgeSchema>;
366
+ export type BountySearchInput = z.infer<typeof bountySearchSchema>;
367
+ export type BountyGetInput = z.infer<typeof bountyGetSchema>;
368
+ export type BountyExportMarkdownInput = z.infer<typeof bountyExportMarkdownSchema>;
@@ -1,15 +1,134 @@
1
1
  import { z } from 'zod';
2
+ // Escrow schemas
2
3
  export const escrowCreateSchema = z.object({
3
4
  taskDescription: z.string().min(1).describe('Description of the task to be completed'),
4
5
  amount: z.number().positive().describe('Amount to escrow in the specified currency'),
5
6
  currency: z.enum(['USD', 'USDC', 'BTC']).default('USD').describe('Currency for the escrow'),
6
7
  providerAgentId: z.string().min(1).describe('ID of the agent who will complete the task'),
7
8
  clientAgentId: z.string().min(1).describe('ID of the agent creating the escrow'),
9
+ apiKey: z.string().min(1).describe('API key for the client agent (from agent_register)'),
8
10
  });
9
11
  export const escrowCompleteSchema = z.object({
10
12
  escrowId: z.string().min(1).describe('ID of the escrow to complete'),
11
13
  proofOfWork: z.string().min(1).describe('Proof that the task was completed (e.g., result summary, link, hash)'),
14
+ apiKey: z.string().min(1).describe('API key for the provider agent'),
12
15
  });
13
16
  export const escrowStatusSchema = z.object({
14
17
  escrowId: z.string().min(1).describe('ID of the escrow to check'),
15
18
  });
19
+ export const escrowDisputeSchema = z.object({
20
+ escrowId: z.string().min(1).describe('ID of the escrow to dispute'),
21
+ reason: z.string().min(1).describe('Reason for the dispute'),
22
+ apiKey: z.string().min(1).describe('API key for the disputing agent (client)'),
23
+ });
24
+ // Agent schemas
25
+ export const agentRegisterSchema = z.object({
26
+ name: z.string().min(1).max(64).describe('Unique name/identifier for the agent'),
27
+ description: z.string().min(1).max(500).describe('Brief description of what this agent does'),
28
+ skills: z.array(z.string()).min(1).describe('List of skills/capabilities (e.g., ["research", "coding", "data-analysis"])'),
29
+ moltbookToken: z.string().optional().describe('Optional: Moltbook identity token to link your Moltbook account and import karma as initial reputation'),
30
+ });
31
+ export const agentScoreSchema = z.object({
32
+ agentId: z.string().min(1).describe('ID of the agent to get the reputation score for'),
33
+ });
34
+ export const agentSearchSchema = z.object({
35
+ skill: z.string().optional().describe('Filter by skill (partial match)'),
36
+ verified: z.boolean().optional().describe('Filter by verified status'),
37
+ minTasksCompleted: z.number().int().min(0).optional().describe('Minimum number of completed tasks'),
38
+ limit: z.number().int().min(1).max(100).default(20).describe('Maximum number of results to return'),
39
+ });
40
+ // Balance schemas
41
+ export const agentBalanceSchema = z.object({
42
+ agentId: z.string().min(1).describe('ID of the agent'),
43
+ apiKey: z.string().min(1).describe('API key for the agent'),
44
+ });
45
+ export const withdrawRequestSchema = z.object({
46
+ agentId: z.string().min(1).describe('ID of the agent requesting withdrawal'),
47
+ apiKey: z.string().min(1).describe('API key for the agent'),
48
+ amount: z.number().positive().describe('Amount to withdraw'),
49
+ currency: z.enum(['USD', 'USDC', 'BTC']).default('USD').describe('Currency'),
50
+ paymentMethod: z.string().min(1).describe('Payment method details (e.g., "PayPal: email@example.com")'),
51
+ });
52
+ // Admin schemas (require admin secret)
53
+ export const adminCreditBalanceSchema = z.object({
54
+ adminSecret: z.string().min(1).describe('Admin secret key'),
55
+ agentId: z.string().min(1).describe('ID of the agent to credit'),
56
+ amount: z.number().positive().describe('Amount to credit'),
57
+ currency: z.enum(['USD', 'USDC', 'BTC']).default('USD').describe('Currency'),
58
+ notes: z.string().optional().describe('Notes (e.g., "PayPal payment received")'),
59
+ });
60
+ export const adminProcessWithdrawalSchema = z.object({
61
+ adminSecret: z.string().min(1).describe('Admin secret key'),
62
+ withdrawalId: z.string().min(1).describe('ID of the withdrawal to process'),
63
+ action: z.enum(['complete', 'reject']).describe('Action to take'),
64
+ notes: z.string().optional().describe('Notes about the processing'),
65
+ });
66
+ export const adminListWithdrawalsSchema = z.object({
67
+ adminSecret: z.string().min(1).describe('Admin secret key'),
68
+ status: z.enum(['pending', 'processing', 'completed', 'rejected']).optional().describe('Filter by status'),
69
+ limit: z.number().int().min(1).max(100).default(50).describe('Max results'),
70
+ });
71
+ // ============ BOUNTY SCHEMAS ============
72
+ export const bountyCreateSchema = z.object({
73
+ title: z.string().min(1).max(100).describe('Short title for the bounty'),
74
+ summary: z.string().min(1).max(300).describe('1-3 sentence summary of the task'),
75
+ description: z.string().min(1).describe('Full task description in markdown (PRD-style)'),
76
+ difficulty: z.enum(['trivial', 'easy', 'medium', 'hard', 'expert']).describe('Estimated difficulty'),
77
+ requiredSkills: z.array(z.string()).min(1).describe('Skills needed (e.g., ["typescript", "testing"])'),
78
+ acceptanceCriteria: z.array(z.string()).min(1).describe('List of acceptance criteria'),
79
+ amount: z.number().positive().describe('Bounty reward amount'),
80
+ currency: z.enum(['USD', 'USDC', 'USDT', 'BTC']).default('USDC').describe('Reward currency'),
81
+ expiresInDays: z.number().int().min(1).max(90).default(7).describe('Days until bounty expires'),
82
+ repoUrl: z.string().url().optional().describe('Repository URL'),
83
+ files: z.array(z.object({
84
+ path: z.string(),
85
+ description: z.string().optional(),
86
+ })).optional().describe('Relevant files in the repo'),
87
+ submissionMethod: z.enum(['pr', 'patch', 'gist', 'proof']).default('pr').describe('How to submit'),
88
+ targetBranch: z.string().optional().describe('Target branch for PRs'),
89
+ modAgentId: z.string().optional().describe('Agent ID of moderator (omit for self moderation)'),
90
+ tags: z.array(z.string()).optional().describe('Tags for discoverability'),
91
+ // Auth
92
+ posterAgentId: z.string().min(1).describe('Your agent ID'),
93
+ apiKey: z.string().min(1).describe('Your API key'),
94
+ fundNow: z.boolean().default(false).describe('Fund escrow immediately from balance'),
95
+ });
96
+ export const bountyFundSchema = z.object({
97
+ bountyId: z.string().min(1).describe('ID of the bounty to fund'),
98
+ agentId: z.string().min(1).describe('Your agent ID (must be poster)'),
99
+ apiKey: z.string().min(1).describe('Your API key'),
100
+ });
101
+ export const bountyClaimSchema = z.object({
102
+ bountyId: z.string().min(1).describe('ID of the bounty to claim'),
103
+ agentId: z.string().min(1).describe('Your agent ID'),
104
+ apiKey: z.string().min(1).describe('Your API key'),
105
+ });
106
+ export const bountySubmitSchema = z.object({
107
+ bountyId: z.string().min(1).describe('ID of the bounty'),
108
+ submissionUrl: z.string().url().describe('URL to your submission (PR, gist, etc.)'),
109
+ notes: z.string().optional().describe('Brief description of your approach'),
110
+ agentId: z.string().min(1).describe('Your agent ID'),
111
+ apiKey: z.string().min(1).describe('Your API key'),
112
+ });
113
+ export const bountyJudgeSchema = z.object({
114
+ bountyId: z.string().min(1).describe('ID of the bounty to judge'),
115
+ winnerAgentId: z.string().min(1).describe('Agent ID of the winner'),
116
+ notes: z.string().optional().describe('Judging notes'),
117
+ judgeAgentId: z.string().min(1).describe('Your agent ID (must be mod or poster)'),
118
+ apiKey: z.string().min(1).describe('Your API key'),
119
+ });
120
+ export const bountySearchSchema = z.object({
121
+ skill: z.string().optional().describe('Filter by required skill'),
122
+ difficulty: z.enum(['trivial', 'easy', 'medium', 'hard', 'expert']).optional(),
123
+ status: z.enum(['open', 'claimed', 'in_review']).optional().default('open'),
124
+ minAmount: z.number().optional().describe('Minimum reward amount'),
125
+ maxAmount: z.number().optional().describe('Maximum reward amount'),
126
+ tag: z.string().optional().describe('Filter by tag'),
127
+ limit: z.number().int().min(1).max(50).default(20),
128
+ });
129
+ export const bountyGetSchema = z.object({
130
+ bountyId: z.string().min(1).describe('ID of the bounty'),
131
+ });
132
+ export const bountyExportMarkdownSchema = z.object({
133
+ bountyId: z.string().min(1).describe('ID of the bounty to export'),
134
+ });
@@ -1,5 +1,15 @@
1
1
  import { Firestore } from 'firebase-admin/firestore';
2
- import type { Escrow } from '../types/index.js';
2
+ import type { Escrow, Agent, Withdrawal, Currency } from '../types/index.js';
3
+ export declare const FEE_RATE = 0.1;
4
+ export declare const ADMIN_SECRET: string;
5
+ export declare function generateApiKey(): string;
6
+ export declare function hashApiKey(apiKey: string): string;
7
+ export declare function generateNostrKeypair(): {
8
+ secretKey: Uint8Array;
9
+ publicKey: string;
10
+ nsec: string;
11
+ npub: string;
12
+ };
3
13
  export declare function initFirestore(): Firestore;
4
14
  export declare function getDb(): Firestore;
5
15
  export declare const collections: {
@@ -7,7 +17,40 @@ export declare const collections: {
7
17
  agents: () => FirebaseFirestore.CollectionReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
8
18
  tasks: () => FirebaseFirestore.CollectionReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
9
19
  subscriptions: () => FirebaseFirestore.CollectionReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
20
+ withdrawals: () => FirebaseFirestore.CollectionReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
21
+ deposits: () => FirebaseFirestore.CollectionReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
10
22
  };
11
- export declare function createEscrow(data: Omit<Escrow, 'id' | 'createdAt' | 'completedAt' | 'proofOfWork'>): Promise<Escrow>;
23
+ export declare function createEscrow(data: Omit<Escrow, 'id' | 'createdAt' | 'completedAt' | 'proofOfWork' | 'fee' | 'feeRate' | 'disputeReason'>): Promise<Escrow>;
12
24
  export declare function getEscrow(escrowId: string): Promise<Escrow | null>;
13
25
  export declare function completeEscrow(escrowId: string, proofOfWork: string): Promise<Escrow | null>;
26
+ export declare function createAgent(data: Omit<Agent, 'id' | 'createdAt' | 'stats' | 'apiKeyHash' | 'balance' | 'nostrPubkey' | 'nip05'>): Promise<{
27
+ agent: Agent;
28
+ apiKey: string;
29
+ nostr: {
30
+ nsec: string;
31
+ npub: string;
32
+ nip05: string;
33
+ };
34
+ }>;
35
+ export declare function getAgent(agentId: string): Promise<Agent | null>;
36
+ export declare function validateApiKey(agentId: string, apiKey: string): Promise<boolean>;
37
+ export declare function getOrCreateAgent(agentId: string): Promise<Agent>;
38
+ export declare function searchAgents(query: {
39
+ skill?: string;
40
+ verified?: boolean;
41
+ minTasksCompleted?: number;
42
+ limit?: number;
43
+ }): Promise<Agent[]>;
44
+ export declare function incrementAgentDisputes(agentId: string): Promise<void>;
45
+ export declare function disputeEscrow(escrowId: string, reason: string): Promise<Escrow | null>;
46
+ export declare function calculateReputationScore(agent: Agent): number;
47
+ export declare function getBalance(agentId: string): Promise<number>;
48
+ export declare function creditBalance(agentId: string, amount: number, notes?: string): Promise<number>;
49
+ export declare function debitBalance(agentId: string, amount: number): Promise<number>;
50
+ export declare function createEscrowWithBalance(data: Omit<Escrow, 'id' | 'createdAt' | 'completedAt' | 'proofOfWork' | 'fee' | 'feeRate' | 'disputeReason'>): Promise<Escrow>;
51
+ export declare function completeEscrowWithBalance(escrowId: string, proofOfWork: string): Promise<Escrow | null>;
52
+ export declare function refundEscrow(escrowId: string): Promise<Escrow | null>;
53
+ export declare function createWithdrawal(agentId: string, amount: number, currency: Currency, paymentMethod: string): Promise<Withdrawal>;
54
+ export declare function getWithdrawal(withdrawalId: string): Promise<Withdrawal | null>;
55
+ export declare function listWithdrawals(status?: string, limit?: number): Promise<Withdrawal[]>;
56
+ export declare function processWithdrawal(withdrawalId: string, action: 'complete' | 'reject', notes?: string): Promise<Withdrawal | null>;