@swarmdock/shared 0.1.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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/dist/constants.d.ts +57 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +62 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +275 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +103 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +132 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +23 -0
- package/src/constants.ts +71 -0
- package/src/index.ts +3 -0
- package/src/schemas.ts +121 -0
- package/src/types.ts +141 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const PLATFORM_FEE_PERCENT = 7;
|
|
2
|
+
export declare const USDC_DECIMALS = 6;
|
|
3
|
+
export declare const AAT_EXPIRY_HOURS = 24;
|
|
4
|
+
export declare const CHALLENGE_TTL_SECONDS = 300;
|
|
5
|
+
export declare const AGENT_STATUS: {
|
|
6
|
+
readonly PENDING: "pending";
|
|
7
|
+
readonly ACTIVE: "active";
|
|
8
|
+
readonly SUSPENDED: "suspended";
|
|
9
|
+
readonly DEREGISTERED: "deregistered";
|
|
10
|
+
};
|
|
11
|
+
export declare const TASK_STATUS: {
|
|
12
|
+
readonly OPEN: "open";
|
|
13
|
+
readonly BIDDING: "bidding";
|
|
14
|
+
readonly ASSIGNED: "assigned";
|
|
15
|
+
readonly IN_PROGRESS: "in_progress";
|
|
16
|
+
readonly REVIEW: "review";
|
|
17
|
+
readonly COMPLETED: "completed";
|
|
18
|
+
readonly DISPUTED: "disputed";
|
|
19
|
+
readonly CANCELLED: "cancelled";
|
|
20
|
+
readonly EXPIRED: "expired";
|
|
21
|
+
readonly FAILED: "failed";
|
|
22
|
+
};
|
|
23
|
+
export declare const BID_STATUS: {
|
|
24
|
+
readonly PENDING: "pending";
|
|
25
|
+
readonly ACCEPTED: "accepted";
|
|
26
|
+
readonly REJECTED: "rejected";
|
|
27
|
+
readonly WITHDRAWN: "withdrawn";
|
|
28
|
+
};
|
|
29
|
+
export declare const ESCROW_STATUS: {
|
|
30
|
+
readonly PENDING: "pending";
|
|
31
|
+
readonly FUNDED: "funded";
|
|
32
|
+
readonly RELEASED: "released";
|
|
33
|
+
readonly REFUNDED: "refunded";
|
|
34
|
+
readonly FAILED: "failed";
|
|
35
|
+
};
|
|
36
|
+
export declare const TRUST_LEVELS: {
|
|
37
|
+
readonly L0: 0;
|
|
38
|
+
readonly L1: 1;
|
|
39
|
+
readonly L2: 2;
|
|
40
|
+
readonly L3: 3;
|
|
41
|
+
readonly L4: 4;
|
|
42
|
+
};
|
|
43
|
+
export declare const MATCHING_MODE: {
|
|
44
|
+
readonly DIRECT: "direct";
|
|
45
|
+
readonly OPEN: "open";
|
|
46
|
+
readonly AUTO: "auto";
|
|
47
|
+
};
|
|
48
|
+
export declare const PRICING_MODEL: {
|
|
49
|
+
readonly PER_TASK: "per-task";
|
|
50
|
+
readonly PER_HOUR: "per-hour";
|
|
51
|
+
readonly PER_TOKEN: "per-token";
|
|
52
|
+
readonly PER_REQUEST: "per-request";
|
|
53
|
+
readonly CUSTOM: "custom";
|
|
54
|
+
};
|
|
55
|
+
export declare const SCOPES: readonly ["tasks.read", "tasks.write", "bids.write", "profile.write", "ratings.write"];
|
|
56
|
+
export type Scope = (typeof SCOPES)[number];
|
|
57
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;CAWd,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,eAAO,MAAM,MAAM,wFAMT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const PLATFORM_FEE_PERCENT = 7;
|
|
2
|
+
export const USDC_DECIMALS = 6;
|
|
3
|
+
export const AAT_EXPIRY_HOURS = 24;
|
|
4
|
+
export const CHALLENGE_TTL_SECONDS = 300;
|
|
5
|
+
export const AGENT_STATUS = {
|
|
6
|
+
PENDING: 'pending',
|
|
7
|
+
ACTIVE: 'active',
|
|
8
|
+
SUSPENDED: 'suspended',
|
|
9
|
+
DEREGISTERED: 'deregistered',
|
|
10
|
+
};
|
|
11
|
+
export const TASK_STATUS = {
|
|
12
|
+
OPEN: 'open',
|
|
13
|
+
BIDDING: 'bidding',
|
|
14
|
+
ASSIGNED: 'assigned',
|
|
15
|
+
IN_PROGRESS: 'in_progress',
|
|
16
|
+
REVIEW: 'review',
|
|
17
|
+
COMPLETED: 'completed',
|
|
18
|
+
DISPUTED: 'disputed',
|
|
19
|
+
CANCELLED: 'cancelled',
|
|
20
|
+
EXPIRED: 'expired',
|
|
21
|
+
FAILED: 'failed',
|
|
22
|
+
};
|
|
23
|
+
export const BID_STATUS = {
|
|
24
|
+
PENDING: 'pending',
|
|
25
|
+
ACCEPTED: 'accepted',
|
|
26
|
+
REJECTED: 'rejected',
|
|
27
|
+
WITHDRAWN: 'withdrawn',
|
|
28
|
+
};
|
|
29
|
+
export const ESCROW_STATUS = {
|
|
30
|
+
PENDING: 'pending',
|
|
31
|
+
FUNDED: 'funded',
|
|
32
|
+
RELEASED: 'released',
|
|
33
|
+
REFUNDED: 'refunded',
|
|
34
|
+
FAILED: 'failed',
|
|
35
|
+
};
|
|
36
|
+
export const TRUST_LEVELS = {
|
|
37
|
+
L0: 0, // Unverified
|
|
38
|
+
L1: 1, // Email verified
|
|
39
|
+
L2: 2, // Challenge completed
|
|
40
|
+
L3: 3, // Portfolio verified
|
|
41
|
+
L4: 4, // Community endorsed
|
|
42
|
+
};
|
|
43
|
+
export const MATCHING_MODE = {
|
|
44
|
+
DIRECT: 'direct',
|
|
45
|
+
OPEN: 'open',
|
|
46
|
+
AUTO: 'auto',
|
|
47
|
+
};
|
|
48
|
+
export const PRICING_MODEL = {
|
|
49
|
+
PER_TASK: 'per-task',
|
|
50
|
+
PER_HOUR: 'per-hour',
|
|
51
|
+
PER_TOKEN: 'per-token',
|
|
52
|
+
PER_REQUEST: 'per-request',
|
|
53
|
+
CUSTOM: 'custom',
|
|
54
|
+
};
|
|
55
|
+
export const SCOPES = [
|
|
56
|
+
'tasks.read',
|
|
57
|
+
'tasks.write',
|
|
58
|
+
'bids.write',
|
|
59
|
+
'profile.write',
|
|
60
|
+
'ratings.write',
|
|
61
|
+
];
|
|
62
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC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,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,eAAe;IACf,eAAe;CACP,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AgentRegisterSchema: z.ZodObject<{
|
|
3
|
+
publicKey: z.ZodString;
|
|
4
|
+
displayName: z.ZodString;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
7
|
+
frameworkVersion: z.ZodOptional<z.ZodString>;
|
|
8
|
+
modelProvider: z.ZodOptional<z.ZodString>;
|
|
9
|
+
modelName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
walletAddress: z.ZodString;
|
|
11
|
+
agentCardUrl: z.ZodOptional<z.ZodString>;
|
|
12
|
+
skills: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
13
|
+
skillId: z.ZodString;
|
|
14
|
+
skillName: z.ZodString;
|
|
15
|
+
description: z.ZodString;
|
|
16
|
+
category: z.ZodString;
|
|
17
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
18
|
+
pricingModel: z.ZodDefault<z.ZodEnum<["per-task", "per-hour", "per-token", "per-request", "custom"]>>;
|
|
19
|
+
basePrice: z.ZodString;
|
|
20
|
+
examplePrompts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
description: string;
|
|
23
|
+
skillId: string;
|
|
24
|
+
skillName: string;
|
|
25
|
+
category: string;
|
|
26
|
+
tags: string[];
|
|
27
|
+
pricingModel: "per-task" | "per-hour" | "per-token" | "per-request" | "custom";
|
|
28
|
+
basePrice: string;
|
|
29
|
+
examplePrompts: string[];
|
|
30
|
+
}, {
|
|
31
|
+
description: string;
|
|
32
|
+
skillId: string;
|
|
33
|
+
skillName: string;
|
|
34
|
+
category: string;
|
|
35
|
+
basePrice: string;
|
|
36
|
+
tags?: string[] | undefined;
|
|
37
|
+
pricingModel?: "per-task" | "per-hour" | "per-token" | "per-request" | "custom" | undefined;
|
|
38
|
+
examplePrompts?: string[] | undefined;
|
|
39
|
+
}>, "many">>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
publicKey: string;
|
|
42
|
+
displayName: string;
|
|
43
|
+
walletAddress: string;
|
|
44
|
+
skills: {
|
|
45
|
+
description: string;
|
|
46
|
+
skillId: string;
|
|
47
|
+
skillName: string;
|
|
48
|
+
category: string;
|
|
49
|
+
tags: string[];
|
|
50
|
+
pricingModel: "per-task" | "per-hour" | "per-token" | "per-request" | "custom";
|
|
51
|
+
basePrice: string;
|
|
52
|
+
examplePrompts: string[];
|
|
53
|
+
}[];
|
|
54
|
+
description?: string | undefined;
|
|
55
|
+
framework?: string | undefined;
|
|
56
|
+
frameworkVersion?: string | undefined;
|
|
57
|
+
modelProvider?: string | undefined;
|
|
58
|
+
modelName?: string | undefined;
|
|
59
|
+
agentCardUrl?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
publicKey: string;
|
|
62
|
+
displayName: string;
|
|
63
|
+
walletAddress: string;
|
|
64
|
+
description?: string | undefined;
|
|
65
|
+
framework?: string | undefined;
|
|
66
|
+
frameworkVersion?: string | undefined;
|
|
67
|
+
modelProvider?: string | undefined;
|
|
68
|
+
modelName?: string | undefined;
|
|
69
|
+
agentCardUrl?: string | undefined;
|
|
70
|
+
skills?: {
|
|
71
|
+
description: string;
|
|
72
|
+
skillId: string;
|
|
73
|
+
skillName: string;
|
|
74
|
+
category: string;
|
|
75
|
+
basePrice: string;
|
|
76
|
+
tags?: string[] | undefined;
|
|
77
|
+
pricingModel?: "per-task" | "per-hour" | "per-token" | "per-request" | "custom" | undefined;
|
|
78
|
+
examplePrompts?: string[] | undefined;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const AgentVerifySchema: z.ZodObject<{
|
|
82
|
+
publicKey: z.ZodString;
|
|
83
|
+
challenge: z.ZodString;
|
|
84
|
+
signature: z.ZodString;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
publicKey: string;
|
|
87
|
+
challenge: string;
|
|
88
|
+
signature: string;
|
|
89
|
+
}, {
|
|
90
|
+
publicKey: string;
|
|
91
|
+
challenge: string;
|
|
92
|
+
signature: string;
|
|
93
|
+
}>;
|
|
94
|
+
export declare const AgentUpdateSchema: z.ZodObject<{
|
|
95
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
96
|
+
description: z.ZodOptional<z.ZodString>;
|
|
97
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
98
|
+
frameworkVersion: z.ZodOptional<z.ZodString>;
|
|
99
|
+
modelProvider: z.ZodOptional<z.ZodString>;
|
|
100
|
+
modelName: z.ZodOptional<z.ZodString>;
|
|
101
|
+
agentCardUrl: z.ZodOptional<z.ZodString>;
|
|
102
|
+
dailySpendingLimit: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
displayName?: string | undefined;
|
|
105
|
+
description?: string | undefined;
|
|
106
|
+
framework?: string | undefined;
|
|
107
|
+
frameworkVersion?: string | undefined;
|
|
108
|
+
modelProvider?: string | undefined;
|
|
109
|
+
modelName?: string | undefined;
|
|
110
|
+
agentCardUrl?: string | undefined;
|
|
111
|
+
dailySpendingLimit?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
displayName?: string | undefined;
|
|
114
|
+
description?: string | undefined;
|
|
115
|
+
framework?: string | undefined;
|
|
116
|
+
frameworkVersion?: string | undefined;
|
|
117
|
+
modelProvider?: string | undefined;
|
|
118
|
+
modelName?: string | undefined;
|
|
119
|
+
agentCardUrl?: string | undefined;
|
|
120
|
+
dailySpendingLimit?: string | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
export declare const TaskCreateSchema: z.ZodObject<{
|
|
123
|
+
title: z.ZodString;
|
|
124
|
+
description: z.ZodString;
|
|
125
|
+
skillRequirements: z.ZodArray<z.ZodString, "many">;
|
|
126
|
+
inputData: z.ZodOptional<z.ZodUnknown>;
|
|
127
|
+
matchingMode: z.ZodDefault<z.ZodEnum<["direct", "open", "auto"]>>;
|
|
128
|
+
budgetMin: z.ZodOptional<z.ZodString>;
|
|
129
|
+
budgetMax: z.ZodString;
|
|
130
|
+
deadline: z.ZodOptional<z.ZodString>;
|
|
131
|
+
directAssigneeId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
description: string;
|
|
134
|
+
title: string;
|
|
135
|
+
skillRequirements: string[];
|
|
136
|
+
matchingMode: "open" | "direct" | "auto";
|
|
137
|
+
budgetMax: string;
|
|
138
|
+
inputData?: unknown;
|
|
139
|
+
budgetMin?: string | undefined;
|
|
140
|
+
deadline?: string | undefined;
|
|
141
|
+
directAssigneeId?: string | undefined;
|
|
142
|
+
}, {
|
|
143
|
+
description: string;
|
|
144
|
+
title: string;
|
|
145
|
+
skillRequirements: string[];
|
|
146
|
+
budgetMax: string;
|
|
147
|
+
inputData?: unknown;
|
|
148
|
+
matchingMode?: "open" | "direct" | "auto" | undefined;
|
|
149
|
+
budgetMin?: string | undefined;
|
|
150
|
+
deadline?: string | undefined;
|
|
151
|
+
directAssigneeId?: string | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
export declare const TaskUpdateSchema: z.ZodObject<{
|
|
154
|
+
title: z.ZodOptional<z.ZodString>;
|
|
155
|
+
description: z.ZodOptional<z.ZodString>;
|
|
156
|
+
deadline: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
description?: string | undefined;
|
|
159
|
+
title?: string | undefined;
|
|
160
|
+
deadline?: string | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
description?: string | undefined;
|
|
163
|
+
title?: string | undefined;
|
|
164
|
+
deadline?: string | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
export declare const TaskSubmitSchema: z.ZodObject<{
|
|
167
|
+
artifacts: z.ZodArray<z.ZodObject<{
|
|
168
|
+
type: z.ZodString;
|
|
169
|
+
content: z.ZodUnknown;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
type: string;
|
|
172
|
+
content?: unknown;
|
|
173
|
+
}, {
|
|
174
|
+
type: string;
|
|
175
|
+
content?: unknown;
|
|
176
|
+
}>, "many">;
|
|
177
|
+
files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
178
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
artifacts: {
|
|
181
|
+
type: string;
|
|
182
|
+
content?: unknown;
|
|
183
|
+
}[];
|
|
184
|
+
files: string[];
|
|
185
|
+
notes?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
artifacts: {
|
|
188
|
+
type: string;
|
|
189
|
+
content?: unknown;
|
|
190
|
+
}[];
|
|
191
|
+
files?: string[] | undefined;
|
|
192
|
+
notes?: string | undefined;
|
|
193
|
+
}>;
|
|
194
|
+
export declare const TaskListQuerySchema: z.ZodObject<{
|
|
195
|
+
status: z.ZodOptional<z.ZodString>;
|
|
196
|
+
skills: z.ZodOptional<z.ZodString>;
|
|
197
|
+
budgetMin: z.ZodOptional<z.ZodString>;
|
|
198
|
+
budgetMax: z.ZodOptional<z.ZodString>;
|
|
199
|
+
requesterId: z.ZodOptional<z.ZodString>;
|
|
200
|
+
assigneeId: z.ZodOptional<z.ZodString>;
|
|
201
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
202
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
limit: number;
|
|
205
|
+
offset: number;
|
|
206
|
+
status?: string | undefined;
|
|
207
|
+
skills?: string | undefined;
|
|
208
|
+
budgetMin?: string | undefined;
|
|
209
|
+
budgetMax?: string | undefined;
|
|
210
|
+
requesterId?: string | undefined;
|
|
211
|
+
assigneeId?: string | undefined;
|
|
212
|
+
}, {
|
|
213
|
+
status?: string | undefined;
|
|
214
|
+
skills?: string | undefined;
|
|
215
|
+
budgetMin?: string | undefined;
|
|
216
|
+
budgetMax?: string | undefined;
|
|
217
|
+
requesterId?: string | undefined;
|
|
218
|
+
assigneeId?: string | undefined;
|
|
219
|
+
limit?: number | undefined;
|
|
220
|
+
offset?: number | undefined;
|
|
221
|
+
}>;
|
|
222
|
+
export declare const BidCreateSchema: z.ZodObject<{
|
|
223
|
+
proposedPrice: z.ZodString;
|
|
224
|
+
confidenceScore: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
estimatedDuration: z.ZodOptional<z.ZodString>;
|
|
226
|
+
proposal: z.ZodOptional<z.ZodString>;
|
|
227
|
+
portfolioRefs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
proposedPrice: string;
|
|
230
|
+
portfolioRefs: string[];
|
|
231
|
+
confidenceScore?: number | undefined;
|
|
232
|
+
estimatedDuration?: string | undefined;
|
|
233
|
+
proposal?: string | undefined;
|
|
234
|
+
}, {
|
|
235
|
+
proposedPrice: string;
|
|
236
|
+
confidenceScore?: number | undefined;
|
|
237
|
+
estimatedDuration?: string | undefined;
|
|
238
|
+
proposal?: string | undefined;
|
|
239
|
+
portfolioRefs?: string[] | undefined;
|
|
240
|
+
}>;
|
|
241
|
+
export declare const RatingCreateSchema: z.ZodObject<{
|
|
242
|
+
taskId: z.ZodString;
|
|
243
|
+
rateeId: z.ZodString;
|
|
244
|
+
qualityScore: z.ZodNumber;
|
|
245
|
+
speedScore: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
communicationScore: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
reliabilityScore: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
taskId: string;
|
|
251
|
+
rateeId: string;
|
|
252
|
+
qualityScore: number;
|
|
253
|
+
speedScore?: number | undefined;
|
|
254
|
+
communicationScore?: number | undefined;
|
|
255
|
+
reliabilityScore?: number | undefined;
|
|
256
|
+
comment?: string | undefined;
|
|
257
|
+
}, {
|
|
258
|
+
taskId: string;
|
|
259
|
+
rateeId: string;
|
|
260
|
+
qualityScore: number;
|
|
261
|
+
speedScore?: number | undefined;
|
|
262
|
+
communicationScore?: number | undefined;
|
|
263
|
+
reliabilityScore?: number | undefined;
|
|
264
|
+
comment?: string | undefined;
|
|
265
|
+
}>;
|
|
266
|
+
export type AgentRegisterInput = z.infer<typeof AgentRegisterSchema>;
|
|
267
|
+
export type AgentVerifyInput = z.infer<typeof AgentVerifySchema>;
|
|
268
|
+
export type AgentUpdateInput = z.infer<typeof AgentUpdateSchema>;
|
|
269
|
+
export type TaskCreateInput = z.infer<typeof TaskCreateSchema>;
|
|
270
|
+
export type TaskUpdateInput = z.infer<typeof TaskUpdateSchema>;
|
|
271
|
+
export type TaskSubmitInput = z.infer<typeof TaskSubmitSchema>;
|
|
272
|
+
export type TaskListQuery = z.infer<typeof TaskListQuerySchema>;
|
|
273
|
+
export type BidCreateInput = z.infer<typeof BidCreateSchema>;
|
|
274
|
+
export type RatingCreateInput = z.infer<typeof RatingCreateSchema>;
|
|
275
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAGH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS9B,CAAC;AAGH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MATCHING_MODE, PRICING_MODEL } from './constants.js';
|
|
3
|
+
// Agent registration
|
|
4
|
+
export const AgentRegisterSchema = z.object({
|
|
5
|
+
publicKey: z.string().min(1, 'Public key is required'),
|
|
6
|
+
displayName: z.string().min(1).max(200),
|
|
7
|
+
description: z.string().max(2000).optional(),
|
|
8
|
+
framework: z.string().optional(),
|
|
9
|
+
frameworkVersion: z.string().optional(),
|
|
10
|
+
modelProvider: z.string().optional(),
|
|
11
|
+
modelName: z.string().optional(),
|
|
12
|
+
walletAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'Invalid Ethereum address'),
|
|
13
|
+
agentCardUrl: z.string().url().optional(),
|
|
14
|
+
skills: z.array(z.object({
|
|
15
|
+
skillId: z.string().min(1),
|
|
16
|
+
skillName: z.string().min(1),
|
|
17
|
+
description: z.string().min(1),
|
|
18
|
+
category: z.string().min(1),
|
|
19
|
+
tags: z.array(z.string()).default([]),
|
|
20
|
+
pricingModel: z.enum([
|
|
21
|
+
PRICING_MODEL.PER_TASK,
|
|
22
|
+
PRICING_MODEL.PER_HOUR,
|
|
23
|
+
PRICING_MODEL.PER_TOKEN,
|
|
24
|
+
PRICING_MODEL.PER_REQUEST,
|
|
25
|
+
PRICING_MODEL.CUSTOM,
|
|
26
|
+
]).default(PRICING_MODEL.PER_TASK),
|
|
27
|
+
basePrice: z.string().min(1), // USDC amount as string (6 decimals)
|
|
28
|
+
examplePrompts: z.array(z.string()).default([]),
|
|
29
|
+
})).default([]),
|
|
30
|
+
});
|
|
31
|
+
export const AgentVerifySchema = z.object({
|
|
32
|
+
publicKey: z.string().min(1),
|
|
33
|
+
challenge: z.string().min(1),
|
|
34
|
+
signature: z.string().min(1),
|
|
35
|
+
});
|
|
36
|
+
export const AgentUpdateSchema = z.object({
|
|
37
|
+
displayName: z.string().min(1).max(200).optional(),
|
|
38
|
+
description: z.string().max(2000).optional(),
|
|
39
|
+
framework: z.string().optional(),
|
|
40
|
+
frameworkVersion: z.string().optional(),
|
|
41
|
+
modelProvider: z.string().optional(),
|
|
42
|
+
modelName: z.string().optional(),
|
|
43
|
+
agentCardUrl: z.string().url().optional(),
|
|
44
|
+
dailySpendingLimit: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
// Tasks
|
|
47
|
+
export const TaskCreateSchema = z.object({
|
|
48
|
+
title: z.string().min(1).max(500),
|
|
49
|
+
description: z.string().min(1).max(10000),
|
|
50
|
+
skillRequirements: z.array(z.string().min(1)).min(1),
|
|
51
|
+
inputData: z.unknown().optional(),
|
|
52
|
+
matchingMode: z.enum([
|
|
53
|
+
MATCHING_MODE.DIRECT,
|
|
54
|
+
MATCHING_MODE.OPEN,
|
|
55
|
+
MATCHING_MODE.AUTO,
|
|
56
|
+
]).default(MATCHING_MODE.OPEN),
|
|
57
|
+
budgetMin: z.string().optional(),
|
|
58
|
+
budgetMax: z.string().min(1),
|
|
59
|
+
deadline: z.string().datetime().optional(),
|
|
60
|
+
directAssigneeId: z.string().uuid().optional(), // for direct matching
|
|
61
|
+
});
|
|
62
|
+
export const TaskUpdateSchema = z.object({
|
|
63
|
+
title: z.string().min(1).max(500).optional(),
|
|
64
|
+
description: z.string().min(1).max(10000).optional(),
|
|
65
|
+
deadline: z.string().datetime().optional(),
|
|
66
|
+
});
|
|
67
|
+
export const TaskSubmitSchema = z.object({
|
|
68
|
+
artifacts: z.array(z.object({
|
|
69
|
+
type: z.string(),
|
|
70
|
+
content: z.unknown(),
|
|
71
|
+
})).min(1),
|
|
72
|
+
files: z.array(z.string().url()).default([]),
|
|
73
|
+
notes: z.string().max(5000).optional(),
|
|
74
|
+
});
|
|
75
|
+
export const TaskListQuerySchema = z.object({
|
|
76
|
+
status: z.string().optional(),
|
|
77
|
+
skills: z.string().optional(), // comma-separated
|
|
78
|
+
budgetMin: z.string().optional(),
|
|
79
|
+
budgetMax: z.string().optional(),
|
|
80
|
+
requesterId: z.string().uuid().optional(),
|
|
81
|
+
assigneeId: z.string().uuid().optional(),
|
|
82
|
+
limit: z.coerce.number().min(1).max(100).default(20),
|
|
83
|
+
offset: z.coerce.number().min(0).default(0),
|
|
84
|
+
});
|
|
85
|
+
// Bids
|
|
86
|
+
export const BidCreateSchema = z.object({
|
|
87
|
+
proposedPrice: z.string().min(1),
|
|
88
|
+
confidenceScore: z.number().min(0).max(1).optional(),
|
|
89
|
+
estimatedDuration: z.string().optional(), // ISO 8601 duration
|
|
90
|
+
proposal: z.string().max(5000).optional(),
|
|
91
|
+
portfolioRefs: z.array(z.string().url()).default([]),
|
|
92
|
+
});
|
|
93
|
+
// Ratings
|
|
94
|
+
export const RatingCreateSchema = z.object({
|
|
95
|
+
taskId: z.string().uuid(),
|
|
96
|
+
rateeId: z.string().uuid(),
|
|
97
|
+
qualityScore: z.number().int().min(1).max(5),
|
|
98
|
+
speedScore: z.number().int().min(1).max(5).optional(),
|
|
99
|
+
communicationScore: z.number().int().min(1).max(5).optional(),
|
|
100
|
+
reliabilityScore: z.number().int().min(1).max(5).optional(),
|
|
101
|
+
comment: z.string().max(2000).optional(),
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
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,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrD,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7D,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Scope } from './constants.js';
|
|
2
|
+
export interface Agent {
|
|
3
|
+
id: string;
|
|
4
|
+
did: string;
|
|
5
|
+
publicKey: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
framework: string | null;
|
|
9
|
+
frameworkVersion: string | null;
|
|
10
|
+
modelProvider: string | null;
|
|
11
|
+
modelName: string | null;
|
|
12
|
+
walletAddress: string;
|
|
13
|
+
trustLevel: number;
|
|
14
|
+
dailySpendingLimit: string | null;
|
|
15
|
+
agentCardUrl: string | null;
|
|
16
|
+
status: string;
|
|
17
|
+
lastHeartbeat: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentSkill {
|
|
22
|
+
id: string;
|
|
23
|
+
agentId: string;
|
|
24
|
+
skillId: string;
|
|
25
|
+
skillName: string;
|
|
26
|
+
description: string;
|
|
27
|
+
category: string;
|
|
28
|
+
tags: string[];
|
|
29
|
+
pricingModel: string;
|
|
30
|
+
basePrice: string;
|
|
31
|
+
currency: string;
|
|
32
|
+
examplePrompts: string[];
|
|
33
|
+
tasksCompleted: number;
|
|
34
|
+
avgQualityScore: number | null;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Task {
|
|
38
|
+
id: string;
|
|
39
|
+
requesterId: string;
|
|
40
|
+
assigneeId: string | null;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
skillRequirements: string[];
|
|
44
|
+
inputData: unknown;
|
|
45
|
+
matchingMode: string;
|
|
46
|
+
budgetMin: string | null;
|
|
47
|
+
budgetMax: string;
|
|
48
|
+
currency: string;
|
|
49
|
+
finalPrice: string | null;
|
|
50
|
+
status: string;
|
|
51
|
+
deadline: string | null;
|
|
52
|
+
startedAt: string | null;
|
|
53
|
+
submittedAt: string | null;
|
|
54
|
+
completedAt: string | null;
|
|
55
|
+
resultArtifacts: unknown;
|
|
56
|
+
resultFiles: string[] | null;
|
|
57
|
+
qualityScore: number | null;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
}
|
|
61
|
+
export interface TaskBid {
|
|
62
|
+
id: string;
|
|
63
|
+
taskId: string;
|
|
64
|
+
bidderId: string;
|
|
65
|
+
proposedPrice: string;
|
|
66
|
+
confidenceScore: number | null;
|
|
67
|
+
estimatedDuration: string | null;
|
|
68
|
+
proposal: string | null;
|
|
69
|
+
portfolioRefs: string[] | null;
|
|
70
|
+
status: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
}
|
|
73
|
+
export interface EscrowTransaction {
|
|
74
|
+
id: string;
|
|
75
|
+
taskId: string;
|
|
76
|
+
payerId: string;
|
|
77
|
+
payeeId: string | null;
|
|
78
|
+
amount: string;
|
|
79
|
+
platformFee: string | null;
|
|
80
|
+
status: string;
|
|
81
|
+
escrowTxHash: string | null;
|
|
82
|
+
releaseTxHash: string | null;
|
|
83
|
+
network: string;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
}
|
|
87
|
+
export interface AgentRating {
|
|
88
|
+
id: string;
|
|
89
|
+
taskId: string;
|
|
90
|
+
raterId: string;
|
|
91
|
+
rateeId: string;
|
|
92
|
+
qualityScore: number;
|
|
93
|
+
speedScore: number | null;
|
|
94
|
+
communicationScore: number | null;
|
|
95
|
+
reliabilityScore: number | null;
|
|
96
|
+
comment: string | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
}
|
|
99
|
+
export interface AATPayload {
|
|
100
|
+
sub: string;
|
|
101
|
+
agent_id: string;
|
|
102
|
+
trust_level: number;
|
|
103
|
+
scopes: Scope[];
|
|
104
|
+
iat: number;
|
|
105
|
+
exp: number;
|
|
106
|
+
}
|
|
107
|
+
export interface AgentCard {
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
url: string;
|
|
111
|
+
version: string;
|
|
112
|
+
skills: AgentCardSkill[];
|
|
113
|
+
authentication?: {
|
|
114
|
+
schemes: string[];
|
|
115
|
+
credentials?: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export interface AgentCardSkill {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
tags?: string[];
|
|
123
|
+
examples?: string[];
|
|
124
|
+
inputModes?: string[];
|
|
125
|
+
outputModes?: string[];
|
|
126
|
+
}
|
|
127
|
+
export interface SSEEvent {
|
|
128
|
+
type: string;
|
|
129
|
+
data: unknown;
|
|
130
|
+
timestamp: string;
|
|
131
|
+
}
|
|
132
|
+
//#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AAE,cAAc,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swarmdock/shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"type-check": "tsc --noEmit",
|
|
15
|
+
"build": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"zod": "^3.24.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.8.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const PLATFORM_FEE_PERCENT = 7;
|
|
2
|
+
export const USDC_DECIMALS = 6;
|
|
3
|
+
export const AAT_EXPIRY_HOURS = 24;
|
|
4
|
+
export const CHALLENGE_TTL_SECONDS = 300;
|
|
5
|
+
|
|
6
|
+
export const AGENT_STATUS = {
|
|
7
|
+
PENDING: 'pending',
|
|
8
|
+
ACTIVE: 'active',
|
|
9
|
+
SUSPENDED: 'suspended',
|
|
10
|
+
DEREGISTERED: 'deregistered',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const TASK_STATUS = {
|
|
14
|
+
OPEN: 'open',
|
|
15
|
+
BIDDING: 'bidding',
|
|
16
|
+
ASSIGNED: 'assigned',
|
|
17
|
+
IN_PROGRESS: 'in_progress',
|
|
18
|
+
REVIEW: 'review',
|
|
19
|
+
COMPLETED: 'completed',
|
|
20
|
+
DISPUTED: 'disputed',
|
|
21
|
+
CANCELLED: 'cancelled',
|
|
22
|
+
EXPIRED: 'expired',
|
|
23
|
+
FAILED: 'failed',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export const BID_STATUS = {
|
|
27
|
+
PENDING: 'pending',
|
|
28
|
+
ACCEPTED: 'accepted',
|
|
29
|
+
REJECTED: 'rejected',
|
|
30
|
+
WITHDRAWN: 'withdrawn',
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
export const ESCROW_STATUS = {
|
|
34
|
+
PENDING: 'pending',
|
|
35
|
+
FUNDED: 'funded',
|
|
36
|
+
RELEASED: 'released',
|
|
37
|
+
REFUNDED: 'refunded',
|
|
38
|
+
FAILED: 'failed',
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
export const TRUST_LEVELS = {
|
|
42
|
+
L0: 0, // Unverified
|
|
43
|
+
L1: 1, // Email verified
|
|
44
|
+
L2: 2, // Challenge completed
|
|
45
|
+
L3: 3, // Portfolio verified
|
|
46
|
+
L4: 4, // Community endorsed
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
export const MATCHING_MODE = {
|
|
50
|
+
DIRECT: 'direct',
|
|
51
|
+
OPEN: 'open',
|
|
52
|
+
AUTO: 'auto',
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
export const PRICING_MODEL = {
|
|
56
|
+
PER_TASK: 'per-task',
|
|
57
|
+
PER_HOUR: 'per-hour',
|
|
58
|
+
PER_TOKEN: 'per-token',
|
|
59
|
+
PER_REQUEST: 'per-request',
|
|
60
|
+
CUSTOM: 'custom',
|
|
61
|
+
} as const;
|
|
62
|
+
|
|
63
|
+
export const SCOPES = [
|
|
64
|
+
'tasks.read',
|
|
65
|
+
'tasks.write',
|
|
66
|
+
'bids.write',
|
|
67
|
+
'profile.write',
|
|
68
|
+
'ratings.write',
|
|
69
|
+
] as const;
|
|
70
|
+
|
|
71
|
+
export type Scope = (typeof SCOPES)[number];
|
package/src/index.ts
ADDED
package/src/schemas.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TASK_STATUS, MATCHING_MODE, PRICING_MODEL, BID_STATUS, SCOPES } from './constants.js';
|
|
3
|
+
|
|
4
|
+
// Agent registration
|
|
5
|
+
export const AgentRegisterSchema = z.object({
|
|
6
|
+
publicKey: z.string().min(1, 'Public key is required'),
|
|
7
|
+
displayName: z.string().min(1).max(200),
|
|
8
|
+
description: z.string().max(2000).optional(),
|
|
9
|
+
framework: z.string().optional(),
|
|
10
|
+
frameworkVersion: z.string().optional(),
|
|
11
|
+
modelProvider: z.string().optional(),
|
|
12
|
+
modelName: z.string().optional(),
|
|
13
|
+
walletAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'Invalid Ethereum address'),
|
|
14
|
+
agentCardUrl: z.string().url().optional(),
|
|
15
|
+
skills: z.array(z.object({
|
|
16
|
+
skillId: z.string().min(1),
|
|
17
|
+
skillName: z.string().min(1),
|
|
18
|
+
description: z.string().min(1),
|
|
19
|
+
category: z.string().min(1),
|
|
20
|
+
tags: z.array(z.string()).default([]),
|
|
21
|
+
pricingModel: z.enum([
|
|
22
|
+
PRICING_MODEL.PER_TASK,
|
|
23
|
+
PRICING_MODEL.PER_HOUR,
|
|
24
|
+
PRICING_MODEL.PER_TOKEN,
|
|
25
|
+
PRICING_MODEL.PER_REQUEST,
|
|
26
|
+
PRICING_MODEL.CUSTOM,
|
|
27
|
+
]).default(PRICING_MODEL.PER_TASK),
|
|
28
|
+
basePrice: z.string().min(1), // USDC amount as string (6 decimals)
|
|
29
|
+
examplePrompts: z.array(z.string()).default([]),
|
|
30
|
+
})).default([]),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const AgentVerifySchema = z.object({
|
|
34
|
+
publicKey: z.string().min(1),
|
|
35
|
+
challenge: z.string().min(1),
|
|
36
|
+
signature: z.string().min(1),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const AgentUpdateSchema = z.object({
|
|
40
|
+
displayName: z.string().min(1).max(200).optional(),
|
|
41
|
+
description: z.string().max(2000).optional(),
|
|
42
|
+
framework: z.string().optional(),
|
|
43
|
+
frameworkVersion: z.string().optional(),
|
|
44
|
+
modelProvider: z.string().optional(),
|
|
45
|
+
modelName: z.string().optional(),
|
|
46
|
+
agentCardUrl: z.string().url().optional(),
|
|
47
|
+
dailySpendingLimit: z.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Tasks
|
|
51
|
+
export const TaskCreateSchema = z.object({
|
|
52
|
+
title: z.string().min(1).max(500),
|
|
53
|
+
description: z.string().min(1).max(10000),
|
|
54
|
+
skillRequirements: z.array(z.string().min(1)).min(1),
|
|
55
|
+
inputData: z.unknown().optional(),
|
|
56
|
+
matchingMode: z.enum([
|
|
57
|
+
MATCHING_MODE.DIRECT,
|
|
58
|
+
MATCHING_MODE.OPEN,
|
|
59
|
+
MATCHING_MODE.AUTO,
|
|
60
|
+
]).default(MATCHING_MODE.OPEN),
|
|
61
|
+
budgetMin: z.string().optional(),
|
|
62
|
+
budgetMax: z.string().min(1),
|
|
63
|
+
deadline: z.string().datetime().optional(),
|
|
64
|
+
directAssigneeId: z.string().uuid().optional(), // for direct matching
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const TaskUpdateSchema = z.object({
|
|
68
|
+
title: z.string().min(1).max(500).optional(),
|
|
69
|
+
description: z.string().min(1).max(10000).optional(),
|
|
70
|
+
deadline: z.string().datetime().optional(),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const TaskSubmitSchema = z.object({
|
|
74
|
+
artifacts: z.array(z.object({
|
|
75
|
+
type: z.string(),
|
|
76
|
+
content: z.unknown(),
|
|
77
|
+
})).min(1),
|
|
78
|
+
files: z.array(z.string().url()).default([]),
|
|
79
|
+
notes: z.string().max(5000).optional(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const TaskListQuerySchema = z.object({
|
|
83
|
+
status: z.string().optional(),
|
|
84
|
+
skills: z.string().optional(), // comma-separated
|
|
85
|
+
budgetMin: z.string().optional(),
|
|
86
|
+
budgetMax: z.string().optional(),
|
|
87
|
+
requesterId: z.string().uuid().optional(),
|
|
88
|
+
assigneeId: z.string().uuid().optional(),
|
|
89
|
+
limit: z.coerce.number().min(1).max(100).default(20),
|
|
90
|
+
offset: z.coerce.number().min(0).default(0),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Bids
|
|
94
|
+
export const BidCreateSchema = z.object({
|
|
95
|
+
proposedPrice: z.string().min(1),
|
|
96
|
+
confidenceScore: z.number().min(0).max(1).optional(),
|
|
97
|
+
estimatedDuration: z.string().optional(), // ISO 8601 duration
|
|
98
|
+
proposal: z.string().max(5000).optional(),
|
|
99
|
+
portfolioRefs: z.array(z.string().url()).default([]),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Ratings
|
|
103
|
+
export const RatingCreateSchema = z.object({
|
|
104
|
+
taskId: z.string().uuid(),
|
|
105
|
+
rateeId: z.string().uuid(),
|
|
106
|
+
qualityScore: z.number().int().min(1).max(5),
|
|
107
|
+
speedScore: z.number().int().min(1).max(5).optional(),
|
|
108
|
+
communicationScore: z.number().int().min(1).max(5).optional(),
|
|
109
|
+
reliabilityScore: z.number().int().min(1).max(5).optional(),
|
|
110
|
+
comment: z.string().max(2000).optional(),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export type AgentRegisterInput = z.infer<typeof AgentRegisterSchema>;
|
|
114
|
+
export type AgentVerifyInput = z.infer<typeof AgentVerifySchema>;
|
|
115
|
+
export type AgentUpdateInput = z.infer<typeof AgentUpdateSchema>;
|
|
116
|
+
export type TaskCreateInput = z.infer<typeof TaskCreateSchema>;
|
|
117
|
+
export type TaskUpdateInput = z.infer<typeof TaskUpdateSchema>;
|
|
118
|
+
export type TaskSubmitInput = z.infer<typeof TaskSubmitSchema>;
|
|
119
|
+
export type TaskListQuery = z.infer<typeof TaskListQuerySchema>;
|
|
120
|
+
export type BidCreateInput = z.infer<typeof BidCreateSchema>;
|
|
121
|
+
export type RatingCreateInput = z.infer<typeof RatingCreateSchema>;
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { Scope } from './constants.js';
|
|
2
|
+
|
|
3
|
+
export interface Agent {
|
|
4
|
+
id: string;
|
|
5
|
+
did: string;
|
|
6
|
+
publicKey: string; // base64 encoded
|
|
7
|
+
displayName: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
framework: string | null;
|
|
10
|
+
frameworkVersion: string | null;
|
|
11
|
+
modelProvider: string | null;
|
|
12
|
+
modelName: string | null;
|
|
13
|
+
walletAddress: string;
|
|
14
|
+
trustLevel: number;
|
|
15
|
+
dailySpendingLimit: string | null;
|
|
16
|
+
agentCardUrl: string | null;
|
|
17
|
+
status: string;
|
|
18
|
+
lastHeartbeat: string | null;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AgentSkill {
|
|
24
|
+
id: string;
|
|
25
|
+
agentId: string;
|
|
26
|
+
skillId: string;
|
|
27
|
+
skillName: string;
|
|
28
|
+
description: string;
|
|
29
|
+
category: string;
|
|
30
|
+
tags: string[];
|
|
31
|
+
pricingModel: string;
|
|
32
|
+
basePrice: string;
|
|
33
|
+
currency: string;
|
|
34
|
+
examplePrompts: string[];
|
|
35
|
+
tasksCompleted: number;
|
|
36
|
+
avgQualityScore: number | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Task {
|
|
41
|
+
id: string;
|
|
42
|
+
requesterId: string;
|
|
43
|
+
assigneeId: string | null;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
skillRequirements: string[];
|
|
47
|
+
inputData: unknown;
|
|
48
|
+
matchingMode: string;
|
|
49
|
+
budgetMin: string | null;
|
|
50
|
+
budgetMax: string;
|
|
51
|
+
currency: string;
|
|
52
|
+
finalPrice: string | null;
|
|
53
|
+
status: string;
|
|
54
|
+
deadline: string | null;
|
|
55
|
+
startedAt: string | null;
|
|
56
|
+
submittedAt: string | null;
|
|
57
|
+
completedAt: string | null;
|
|
58
|
+
resultArtifacts: unknown;
|
|
59
|
+
resultFiles: string[] | null;
|
|
60
|
+
qualityScore: number | null;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface TaskBid {
|
|
66
|
+
id: string;
|
|
67
|
+
taskId: string;
|
|
68
|
+
bidderId: string;
|
|
69
|
+
proposedPrice: string;
|
|
70
|
+
confidenceScore: number | null;
|
|
71
|
+
estimatedDuration: string | null;
|
|
72
|
+
proposal: string | null;
|
|
73
|
+
portfolioRefs: string[] | null;
|
|
74
|
+
status: string;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface EscrowTransaction {
|
|
79
|
+
id: string;
|
|
80
|
+
taskId: string;
|
|
81
|
+
payerId: string;
|
|
82
|
+
payeeId: string | null;
|
|
83
|
+
amount: string;
|
|
84
|
+
platformFee: string | null;
|
|
85
|
+
status: string;
|
|
86
|
+
escrowTxHash: string | null;
|
|
87
|
+
releaseTxHash: string | null;
|
|
88
|
+
network: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface AgentRating {
|
|
94
|
+
id: string;
|
|
95
|
+
taskId: string;
|
|
96
|
+
raterId: string;
|
|
97
|
+
rateeId: string;
|
|
98
|
+
qualityScore: number;
|
|
99
|
+
speedScore: number | null;
|
|
100
|
+
communicationScore: number | null;
|
|
101
|
+
reliabilityScore: number | null;
|
|
102
|
+
comment: string | null;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface AATPayload {
|
|
107
|
+
sub: string; // DID
|
|
108
|
+
agent_id: string;
|
|
109
|
+
trust_level: number;
|
|
110
|
+
scopes: Scope[];
|
|
111
|
+
iat: number;
|
|
112
|
+
exp: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface AgentCard {
|
|
116
|
+
name: string;
|
|
117
|
+
description: string;
|
|
118
|
+
url: string;
|
|
119
|
+
version: string;
|
|
120
|
+
skills: AgentCardSkill[];
|
|
121
|
+
authentication?: {
|
|
122
|
+
schemes: string[];
|
|
123
|
+
credentials?: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface AgentCardSkill {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
description: string;
|
|
131
|
+
tags?: string[];
|
|
132
|
+
examples?: string[];
|
|
133
|
+
inputModes?: string[];
|
|
134
|
+
outputModes?: string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface SSEEvent {
|
|
138
|
+
type: string;
|
|
139
|
+
data: unknown;
|
|
140
|
+
timestamp: string;
|
|
141
|
+
}
|