@net-protocol/cli 0.1.37 → 0.1.39

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.
@@ -5705,6 +5705,21 @@ function commentToJson(comment, depth) {
5705
5705
  data: comment.data !== "0x" ? comment.data : void 0
5706
5706
  };
5707
5707
  }
5708
+ function formatAgent(agent, index) {
5709
+ const timestamp = formatTimestamp(agent.timestamp);
5710
+ const lines = [
5711
+ chalk4.cyan(`[${index}]`) + ` ${chalk4.white(agent.address)}`,
5712
+ ` ${chalk4.gray("Registered:")} ${timestamp}`
5713
+ ];
5714
+ return lines.join("\n");
5715
+ }
5716
+ function agentToJson(agent, index) {
5717
+ return {
5718
+ index,
5719
+ address: agent.address,
5720
+ timestamp: agent.timestamp
5721
+ };
5722
+ }
5708
5723
  function printJson(data) {
5709
5724
  console.log(JSON.stringify(data, null, 2));
5710
5725
  }
@@ -6926,6 +6941,58 @@ function registerAgentRegisterCommand(parent) {
6926
6941
  await executeRegisterAgent(options);
6927
6942
  });
6928
6943
  }
6944
+ async function executeListAgents(options) {
6945
+ const readOnlyOptions = parseReadOnlyOptionsWithDefault({
6946
+ chainId: options.chainId,
6947
+ rpcUrl: options.rpcUrl
6948
+ });
6949
+ const client = createAgentRegistryClient(readOnlyOptions);
6950
+ try {
6951
+ const limit = options.limit ?? 100;
6952
+ const [totalCount, agents] = await Promise.all([
6953
+ client.getRegisteredAgentCount(),
6954
+ client.getRegisteredAgents({ maxAgents: limit })
6955
+ ]);
6956
+ if (options.json) {
6957
+ printJson({
6958
+ totalCount,
6959
+ agents: agents.map((agent, i) => agentToJson(agent, i))
6960
+ });
6961
+ } else {
6962
+ if (agents.length === 0) {
6963
+ console.log(chalk4.yellow("No registered agents found"));
6964
+ return;
6965
+ }
6966
+ console.log(
6967
+ chalk4.white(`Registered agents: ${totalCount} total, showing last ${agents.length}:
6968
+ `)
6969
+ );
6970
+ agents.forEach((agent, i) => {
6971
+ console.log(formatAgent(agent, i));
6972
+ if (i < agents.length - 1) {
6973
+ console.log();
6974
+ }
6975
+ });
6976
+ }
6977
+ } catch (error) {
6978
+ exitWithError(
6979
+ `Failed to fetch agents: ${error instanceof Error ? error.message : String(error)}`
6980
+ );
6981
+ }
6982
+ }
6983
+ function registerListAgentsCommand(parent, commandName = "list-agents") {
6984
+ parent.command(commandName).description("List registered agents from the agent registry").option(
6985
+ "--limit <n>",
6986
+ "Maximum number of agents to display (default: 100)",
6987
+ (value) => parseInt(value, 10)
6988
+ ).option(
6989
+ "--chain-id <id>",
6990
+ "Chain ID (default: 8453 for Base)",
6991
+ (value) => parseInt(value, 10)
6992
+ ).option("--rpc-url <url>", "Custom RPC URL").option("--json", "Output in JSON format").action(async (options) => {
6993
+ await executeListAgents(options);
6994
+ });
6995
+ }
6929
6996
 
6930
6997
  // src/commands/feed/index.ts
6931
6998
  function registerFeedCommand(program2) {
@@ -6941,6 +7008,7 @@ function registerFeedCommand(program2) {
6941
7008
  registerFeedConfigCommand(feedCommand);
6942
7009
  registerFeedHistoryCommand(feedCommand);
6943
7010
  registerAgentRegisterCommand(feedCommand);
7011
+ registerListAgentsCommand(feedCommand);
6944
7012
  }
6945
7013
  async function executeUpvoteToken(options) {
6946
7014
  const count = parseInt(options.count, 10);