agentx-cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentx-bundle.cjs +38 -17
- package/package.json +1 -1
package/dist/agentx-bundle.cjs
CHANGED
|
@@ -87319,6 +87319,9 @@ function printInfo(message) {
|
|
|
87319
87319
|
console.log(`[INFO] ${message}`);
|
|
87320
87320
|
}
|
|
87321
87321
|
function formatTimestamp(ts) {
|
|
87322
|
+
if (typeof ts === "string") {
|
|
87323
|
+
return new Date(ts).toLocaleString();
|
|
87324
|
+
}
|
|
87322
87325
|
return new Date(ts * 1e3).toLocaleString();
|
|
87323
87326
|
}
|
|
87324
87327
|
function formatNara(lamports) {
|
|
@@ -87536,8 +87539,9 @@ async function fetchPostsFromIndexer(options, limit) {
|
|
|
87536
87539
|
if (!response.ok) {
|
|
87537
87540
|
throw new Error(`Indexer returned ${response.status}`);
|
|
87538
87541
|
}
|
|
87539
|
-
const
|
|
87540
|
-
|
|
87542
|
+
const json = await response.json();
|
|
87543
|
+
const items = json.data || json.posts || json;
|
|
87544
|
+
return items.map((item) => ({ ...item, postId: item.postId ?? item.id }));
|
|
87541
87545
|
}
|
|
87542
87546
|
async function fetchPostsFromRpc(options, limit, rpcUrl) {
|
|
87543
87547
|
const connection = getConnection(rpcUrl);
|
|
@@ -87759,7 +87763,7 @@ async function fetchCommentsFromIndexer(postId, limit) {
|
|
|
87759
87763
|
const response = await fetch(`${indexerUrl}/comments?${params}`);
|
|
87760
87764
|
if (!response.ok) throw new Error(`Indexer returned ${response.status}`);
|
|
87761
87765
|
const data = await response.json();
|
|
87762
|
-
return data.comments || data;
|
|
87766
|
+
return data.data || data.comments || data;
|
|
87763
87767
|
}
|
|
87764
87768
|
async function fetchCommentsFromRpc(postId, limit, rpcUrl) {
|
|
87765
87769
|
const connection = getConnection(rpcUrl);
|
|
@@ -89208,7 +89212,8 @@ async function fetchReputationFromIndexer(agentId) {
|
|
|
89208
89212
|
`${indexerUrl}/agents/${agentId}/reputation`
|
|
89209
89213
|
);
|
|
89210
89214
|
if (!response.ok) throw new Error(`Indexer returned ${response.status}`);
|
|
89211
|
-
|
|
89215
|
+
const data = await response.json();
|
|
89216
|
+
return data.data || data;
|
|
89212
89217
|
}
|
|
89213
89218
|
async function fetchReputationFromRpc(walletPubkey, agentId, rpcUrl) {
|
|
89214
89219
|
const connection = getConnection(rpcUrl);
|
|
@@ -89776,7 +89781,7 @@ function registerServiceCommand(program3) {
|
|
|
89776
89781
|
throw new Error(`Indexer returned HTTP ${response.status}`);
|
|
89777
89782
|
}
|
|
89778
89783
|
const data = await response.json();
|
|
89779
|
-
const services = data.services || data;
|
|
89784
|
+
const services = data.data || data.services || data;
|
|
89780
89785
|
if (opts.json) {
|
|
89781
89786
|
output(services, true);
|
|
89782
89787
|
} else if (services.length === 0) {
|
|
@@ -89805,7 +89810,8 @@ function registerServiceCommand(program3) {
|
|
|
89805
89810
|
const indexerUrl = await getIndexerUrl();
|
|
89806
89811
|
const response = await fetch(`${indexerUrl}/services/${serviceId}`);
|
|
89807
89812
|
if (response.ok) {
|
|
89808
|
-
|
|
89813
|
+
const json = await response.json();
|
|
89814
|
+
serviceData = json.data || json;
|
|
89809
89815
|
}
|
|
89810
89816
|
} catch {
|
|
89811
89817
|
}
|
|
@@ -89824,9 +89830,13 @@ function registerServiceCommand(program3) {
|
|
|
89824
89830
|
if (opts.json) {
|
|
89825
89831
|
output(serviceData, true);
|
|
89826
89832
|
} else {
|
|
89827
|
-
|
|
89833
|
+
const sid = serviceData.serviceId ?? serviceData.id;
|
|
89834
|
+
const provider = serviceData.provider?.agentId || serviceData.providerPubkey || serviceData.provider;
|
|
89835
|
+
const avgRating = serviceData.stats?.avgRating ?? serviceData.avgRating ?? "N/A";
|
|
89836
|
+
const ratingCount = serviceData.stats?.ratingCount ?? serviceData.ratingCount ?? 0;
|
|
89837
|
+
console.log(`Service #${sid}`);
|
|
89828
89838
|
console.log(` Name: ${serviceData.name}`);
|
|
89829
|
-
console.log(` Provider: ${
|
|
89839
|
+
console.log(` Provider: ${provider}`);
|
|
89830
89840
|
console.log(` Agent: ${serviceData.agentId}`);
|
|
89831
89841
|
console.log(` Description: ${serviceData.description}`);
|
|
89832
89842
|
if (serviceData.skillName) {
|
|
@@ -89836,12 +89846,17 @@ function registerServiceCommand(program3) {
|
|
|
89836
89846
|
console.log(` Display Price: ${formatNara(serviceData.displayPrice)}`);
|
|
89837
89847
|
console.log(` Calls: ${serviceData.callCount}`);
|
|
89838
89848
|
console.log(` Revenue: ${formatNara(serviceData.revenue)}`);
|
|
89839
|
-
console.log(
|
|
89840
|
-
` Rating: ${serviceData.avgRating} (${serviceData.ratingCount} reviews)`
|
|
89841
|
-
);
|
|
89849
|
+
console.log(` Rating: ${avgRating} (${ratingCount} reviews)`);
|
|
89842
89850
|
console.log(` Status: ${serviceData.status}`);
|
|
89843
89851
|
console.log(` Created: ${formatTimestamp(serviceData.createdAt)}`);
|
|
89844
89852
|
console.log(` Updated: ${formatTimestamp(serviceData.updatedAt)}`);
|
|
89853
|
+
if (serviceData.escrow) {
|
|
89854
|
+
const e2 = serviceData.escrow;
|
|
89855
|
+
console.log(` Escrow:`);
|
|
89856
|
+
console.log(` Locked: ${formatNara(e2.locked?.amount || "0")} (${e2.locked?.count || 0} calls)`);
|
|
89857
|
+
console.log(` Released: ${formatNara(e2.released?.amount || "0")} (${e2.released?.count || 0} calls)`);
|
|
89858
|
+
console.log(` Slashed: ${formatNara(e2.slashed?.amount || "0")} (${e2.slashed?.count || 0} calls)`);
|
|
89859
|
+
}
|
|
89845
89860
|
}
|
|
89846
89861
|
} catch (error) {
|
|
89847
89862
|
if (opts.json) {
|
|
@@ -89951,7 +89966,7 @@ function registerServiceCommand(program3) {
|
|
|
89951
89966
|
throw new Error(`Indexer returned HTTP ${response.status}`);
|
|
89952
89967
|
}
|
|
89953
89968
|
const data = await response.json();
|
|
89954
|
-
const services = data.services || data;
|
|
89969
|
+
const services = data.data || data.services || data;
|
|
89955
89970
|
if (opts.json) {
|
|
89956
89971
|
output(services, true);
|
|
89957
89972
|
} else if (services.length === 0) {
|
|
@@ -90131,8 +90146,9 @@ function registerServiceCommand(program3) {
|
|
|
90131
90146
|
const indexerUrl = await getIndexerUrl();
|
|
90132
90147
|
const response = await fetch(`${indexerUrl}/services/${serviceId}`);
|
|
90133
90148
|
if (response.ok) {
|
|
90134
|
-
const
|
|
90135
|
-
|
|
90149
|
+
const json = await response.json();
|
|
90150
|
+
const svc = json.data || json;
|
|
90151
|
+
skillName = svc.skillName || parseSkillTag(svc.description || "");
|
|
90136
90152
|
}
|
|
90137
90153
|
} catch {
|
|
90138
90154
|
}
|
|
@@ -90262,8 +90278,12 @@ async function fetchFeedFromIndexer(limit, before) {
|
|
|
90262
90278
|
if (before) params.set("before", before);
|
|
90263
90279
|
const response = await fetch(`${indexerUrl}/feed?${params}`);
|
|
90264
90280
|
if (!response.ok) throw new Error(`Indexer returned ${response.status}`);
|
|
90265
|
-
const
|
|
90266
|
-
|
|
90281
|
+
const json = await response.json();
|
|
90282
|
+
const items = json.data || json.posts || json;
|
|
90283
|
+
return items.map((item) => {
|
|
90284
|
+
const post = item.data || item;
|
|
90285
|
+
return { ...post, postId: post.postId ?? post.id };
|
|
90286
|
+
});
|
|
90267
90287
|
}
|
|
90268
90288
|
async function fetchFeedFromRpc(limit, before, rpcUrl) {
|
|
90269
90289
|
const connection = getConnection(rpcUrl);
|
|
@@ -90419,7 +90439,8 @@ async function fetchProfileFromIndexer(agentId) {
|
|
|
90419
90439
|
const indexerUrl = await getIndexerUrl();
|
|
90420
90440
|
const response = await fetch(`${indexerUrl}/agents/${agentId}`);
|
|
90421
90441
|
if (!response.ok) throw new Error(`Indexer returned ${response.status}`);
|
|
90422
|
-
|
|
90442
|
+
const data = await response.json();
|
|
90443
|
+
return data.data || data;
|
|
90423
90444
|
}
|
|
90424
90445
|
async function fetchProfileFromRpc(agentId, connection) {
|
|
90425
90446
|
const [agentPda] = import_web3117.PublicKey.findProgramAddressSync(
|