@virtuals-protocol/acp-node 0.1.0-beta.6 → 0.1.0-beta.8
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/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +11 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8376,7 +8376,7 @@ declare class AcpJob {
|
|
|
8376
8376
|
get clientAgent(): Promise<AcpAgent | undefined>;
|
|
8377
8377
|
get evaluatorAgent(): Promise<AcpAgent | undefined>;
|
|
8378
8378
|
pay(amount: number, reason?: string): Promise<`0x${string}`>;
|
|
8379
|
-
respond(accept: boolean, reason?: string): Promise<`0x${string}
|
|
8379
|
+
respond(accept: boolean, reason?: string): Promise<`0x${string}` | undefined>;
|
|
8380
8380
|
deliver(deliverable: string): Promise<`0x${string}`>;
|
|
8381
8381
|
evaluate(accept: boolean, reason?: string): Promise<`0x${string}`>;
|
|
8382
8382
|
}
|
|
@@ -8434,6 +8434,13 @@ declare class AcpJobOffering {
|
|
|
8434
8434
|
initiateJob(serviceRequirement: Object | string, evaluatorAddress?: Address$1, expiredAt?: Date): Promise<number>;
|
|
8435
8435
|
}
|
|
8436
8436
|
|
|
8437
|
+
interface IAcpBrowseAgentsOptions {
|
|
8438
|
+
cluster?: string;
|
|
8439
|
+
sort_by?: AcpAgentSort[];
|
|
8440
|
+
rerank?: boolean;
|
|
8441
|
+
top_k?: number;
|
|
8442
|
+
graduated?: boolean;
|
|
8443
|
+
}
|
|
8437
8444
|
declare class AcpClient {
|
|
8438
8445
|
private acpUrl;
|
|
8439
8446
|
acpContractClient: AcpContractClient;
|
|
@@ -8442,7 +8449,7 @@ declare class AcpClient {
|
|
|
8442
8449
|
constructor(options: IAcpClientOptions);
|
|
8443
8450
|
private defaultOnEvaluate;
|
|
8444
8451
|
init(): Promise<void>;
|
|
8445
|
-
browseAgents(keyword: string,
|
|
8452
|
+
browseAgents(keyword: string, options: IAcpBrowseAgentsOptions): Promise<{
|
|
8446
8453
|
id: number;
|
|
8447
8454
|
name: string;
|
|
8448
8455
|
description: string;
|
|
@@ -8458,7 +8465,7 @@ declare class AcpClient {
|
|
|
8458
8465
|
} | undefined;
|
|
8459
8466
|
}[]>;
|
|
8460
8467
|
initiateJob(providerAddress: Address$1, serviceRequirement: Object | string, amount: number, evaluatorAddress?: Address$1, expiredAt?: Date): Promise<number>;
|
|
8461
|
-
respondJob(jobId: number, memoId: number, accept: boolean, reason?: string): Promise<`0x${string}
|
|
8468
|
+
respondJob(jobId: number, memoId: number, accept: boolean, reason?: string): Promise<`0x${string}` | undefined>;
|
|
8462
8469
|
payJob(jobId: number, amount: number, memoId: number, reason?: string): Promise<`0x${string}`>;
|
|
8463
8470
|
deliverJob(jobId: number, deliverable: string): Promise<`0x${string}`>;
|
|
8464
8471
|
getActiveJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -8376,7 +8376,7 @@ declare class AcpJob {
|
|
|
8376
8376
|
get clientAgent(): Promise<AcpAgent | undefined>;
|
|
8377
8377
|
get evaluatorAgent(): Promise<AcpAgent | undefined>;
|
|
8378
8378
|
pay(amount: number, reason?: string): Promise<`0x${string}`>;
|
|
8379
|
-
respond(accept: boolean, reason?: string): Promise<`0x${string}
|
|
8379
|
+
respond(accept: boolean, reason?: string): Promise<`0x${string}` | undefined>;
|
|
8380
8380
|
deliver(deliverable: string): Promise<`0x${string}`>;
|
|
8381
8381
|
evaluate(accept: boolean, reason?: string): Promise<`0x${string}`>;
|
|
8382
8382
|
}
|
|
@@ -8434,6 +8434,13 @@ declare class AcpJobOffering {
|
|
|
8434
8434
|
initiateJob(serviceRequirement: Object | string, evaluatorAddress?: Address$1, expiredAt?: Date): Promise<number>;
|
|
8435
8435
|
}
|
|
8436
8436
|
|
|
8437
|
+
interface IAcpBrowseAgentsOptions {
|
|
8438
|
+
cluster?: string;
|
|
8439
|
+
sort_by?: AcpAgentSort[];
|
|
8440
|
+
rerank?: boolean;
|
|
8441
|
+
top_k?: number;
|
|
8442
|
+
graduated?: boolean;
|
|
8443
|
+
}
|
|
8437
8444
|
declare class AcpClient {
|
|
8438
8445
|
private acpUrl;
|
|
8439
8446
|
acpContractClient: AcpContractClient;
|
|
@@ -8442,7 +8449,7 @@ declare class AcpClient {
|
|
|
8442
8449
|
constructor(options: IAcpClientOptions);
|
|
8443
8450
|
private defaultOnEvaluate;
|
|
8444
8451
|
init(): Promise<void>;
|
|
8445
|
-
browseAgents(keyword: string,
|
|
8452
|
+
browseAgents(keyword: string, options: IAcpBrowseAgentsOptions): Promise<{
|
|
8446
8453
|
id: number;
|
|
8447
8454
|
name: string;
|
|
8448
8455
|
description: string;
|
|
@@ -8458,7 +8465,7 @@ declare class AcpClient {
|
|
|
8458
8465
|
} | undefined;
|
|
8459
8466
|
}[]>;
|
|
8460
8467
|
initiateJob(providerAddress: Address$1, serviceRequirement: Object | string, amount: number, evaluatorAddress?: Address$1, expiredAt?: Date): Promise<number>;
|
|
8461
|
-
respondJob(jobId: number, memoId: number, accept: boolean, reason?: string): Promise<`0x${string}
|
|
8468
|
+
respondJob(jobId: number, memoId: number, accept: boolean, reason?: string): Promise<`0x${string}` | undefined>;
|
|
8462
8469
|
payJob(jobId: number, amount: number, memoId: number, reason?: string): Promise<`0x${string}`>;
|
|
8463
8470
|
deliverJob(jobId: number, deliverable: string): Promise<`0x${string}`>;
|
|
8464
8471
|
getActiveJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
|
package/dist/index.js
CHANGED
|
@@ -1237,8 +1237,12 @@ var AcpClient = class {
|
|
|
1237
1237
|
process.on("SIGTERM", cleanup);
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
|
-
browseAgents(keyword,
|
|
1240
|
+
browseAgents(keyword, options) {
|
|
1241
1241
|
return __async(this, null, function* () {
|
|
1242
|
+
let { cluster, sort_by, rerank, top_k, graduated } = options;
|
|
1243
|
+
rerank = rerank != null ? rerank : false;
|
|
1244
|
+
top_k = top_k != null ? top_k : 5;
|
|
1245
|
+
graduated = graduated != null ? graduated : false;
|
|
1242
1246
|
let url = `${this.acpUrl}/api/agents?search=${keyword}`;
|
|
1243
1247
|
if (sort_by && sort_by.length > 0) {
|
|
1244
1248
|
url += `&sort=${sort_by.map((s) => s).join(",")}`;
|
|
@@ -1255,6 +1259,9 @@ var AcpClient = class {
|
|
|
1255
1259
|
if (cluster) {
|
|
1256
1260
|
url += `&filters[cluster]=${cluster}`;
|
|
1257
1261
|
}
|
|
1262
|
+
if (graduated) {
|
|
1263
|
+
url += `&filters[hasGraduated]=true`;
|
|
1264
|
+
}
|
|
1258
1265
|
const response = yield fetch(url);
|
|
1259
1266
|
const data = yield response.json();
|
|
1260
1267
|
return data.data.map((agent) => {
|
|
@@ -1302,6 +1309,9 @@ var AcpClient = class {
|
|
|
1302
1309
|
respondJob(jobId, memoId, accept, reason) {
|
|
1303
1310
|
return __async(this, null, function* () {
|
|
1304
1311
|
yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
1312
|
+
if (!accept) {
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1305
1315
|
return yield this.acpContractClient.createMemo(
|
|
1306
1316
|
jobId,
|
|
1307
1317
|
`Job ${jobId} accepted. ${reason != null ? reason : ""}`,
|
package/dist/index.mjs
CHANGED
|
@@ -1197,8 +1197,12 @@ var AcpClient = class {
|
|
|
1197
1197
|
process.on("SIGTERM", cleanup);
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
|
-
browseAgents(keyword,
|
|
1200
|
+
browseAgents(keyword, options) {
|
|
1201
1201
|
return __async(this, null, function* () {
|
|
1202
|
+
let { cluster, sort_by, rerank, top_k, graduated } = options;
|
|
1203
|
+
rerank = rerank != null ? rerank : false;
|
|
1204
|
+
top_k = top_k != null ? top_k : 5;
|
|
1205
|
+
graduated = graduated != null ? graduated : false;
|
|
1202
1206
|
let url = `${this.acpUrl}/api/agents?search=${keyword}`;
|
|
1203
1207
|
if (sort_by && sort_by.length > 0) {
|
|
1204
1208
|
url += `&sort=${sort_by.map((s) => s).join(",")}`;
|
|
@@ -1215,6 +1219,9 @@ var AcpClient = class {
|
|
|
1215
1219
|
if (cluster) {
|
|
1216
1220
|
url += `&filters[cluster]=${cluster}`;
|
|
1217
1221
|
}
|
|
1222
|
+
if (graduated) {
|
|
1223
|
+
url += `&filters[hasGraduated]=true`;
|
|
1224
|
+
}
|
|
1218
1225
|
const response = yield fetch(url);
|
|
1219
1226
|
const data = yield response.json();
|
|
1220
1227
|
return data.data.map((agent) => {
|
|
@@ -1262,6 +1269,9 @@ var AcpClient = class {
|
|
|
1262
1269
|
respondJob(jobId, memoId, accept, reason) {
|
|
1263
1270
|
return __async(this, null, function* () {
|
|
1264
1271
|
yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
1272
|
+
if (!accept) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1265
1275
|
return yield this.acpContractClient.createMemo(
|
|
1266
1276
|
jobId,
|
|
1267
1277
|
`Job ${jobId} accepted. ${reason != null ? reason : ""}`,
|