use-agently 0.22.0 → 0.24.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 (2) hide show
  1. package/build/bin.js +142 -14
  2. package/package.json +2 -2
package/build/bin.js CHANGED
@@ -61459,6 +61459,14 @@ function boxen(text, options) {
61459
61459
  function getOutputFormat(command) {
61460
61460
  return command.optsWithGlobals().output ?? "tui";
61461
61461
  }
61462
+ function resolveOutputFormat(command) {
61463
+ try {
61464
+ return getOutputFormat(command);
61465
+ } catch (err) {
61466
+ console.warn("Falling back to TUI output after failing to resolve --output option:", err instanceof Error ? err.message : String(err));
61467
+ return "tui";
61468
+ }
61469
+ }
61462
61470
  function getMaxWidth() {
61463
61471
  return Math.max(process.stdout.columns || 80, 120);
61464
61472
  }
@@ -91820,7 +91828,7 @@ function PayTransaction(wallet) {
91820
91828
  // ../use-agently-sdk/package.json
91821
91829
  var package_default = {
91822
91830
  name: "@use-agently/sdk",
91823
- version: "0.22.0",
91831
+ version: "0.24.0",
91824
91832
  description: "Core SDK for the Agently platform — wallet management, A2A, MCP, x402 payments",
91825
91833
  homepage: "https://github.com/AgentlyHQ/use-agently/tree/main/packages/use-agently-sdk",
91826
91834
  bugs: {
@@ -91864,7 +91872,7 @@ var package_default = {
91864
91872
 
91865
91873
  // ../use-agently-sdk/client.ts
91866
91874
  function createClient4(options) {
91867
- const fetch2 = createFetch({ userAgent: options.userAgent });
91875
+ const fetch2 = createFetch({ userAgent: options?.userAgent });
91868
91876
  return {
91869
91877
  fetch: fetch2
91870
91878
  };
@@ -96487,7 +96495,7 @@ var balanceCommand = new Command("balance").description("Check wallet balance on
96487
96495
  // package.json
96488
96496
  var package_default2 = {
96489
96497
  name: "use-agently",
96490
- version: "0.22.0",
96498
+ version: "0.24.0",
96491
96499
  description: "Use Agently CLI",
96492
96500
  homepage: "https://use-agently.com",
96493
96501
  bugs: "https://github.com/AgentlyHQ/use-agently/issues",
@@ -96511,7 +96519,7 @@ var package_default2 = {
96511
96519
  test: "bun test"
96512
96520
  },
96513
96521
  dependencies: {
96514
- "@use-agently/sdk": "0.22.0",
96522
+ "@use-agently/sdk": "0.24.0",
96515
96523
  boxen: "^8.0.1",
96516
96524
  "cli-table3": "^0.6.5",
96517
96525
  commander: "^14.0.3",
@@ -96633,15 +96641,15 @@ ${item.description}`, (item.protocols ?? []).join(", ")]);
96633
96641
  }
96634
96642
 
96635
96643
  // src/commands/search.ts
96636
- var searchCommand = new Command("search").description("Search the Agently marketplace for agents").argument("[query]", "Search query to filter agents by name or description").option("-p, --protocol <protocols>", "Filter by protocol(s), comma-separated (e.g. a2a,mcp)").showHelpAfterError(true).addHelpText("after", `
96644
+ var searchCommand = new Command("search").description("Search the Agently marketplace for agents").option("-q, --query <text>", "Search query to filter agents by name or description").option("-p, --protocol <protocols>", "Filter by protocol(s), comma-separated (e.g. a2a,mcp)").showHelpAfterError(true).addHelpText("after", `
96637
96645
  Examples:
96638
96646
  use-agently search
96639
- use-agently search "echo"
96647
+ use-agently search -q "echo"
96640
96648
  use-agently search --protocol a2a
96641
- use-agently search "assistant" --protocol "a2a,mcp"`).action(async (query, options, command) => {
96649
+ use-agently search -q "assistant" --protocol "a2a,mcp"`).action(async (options, command) => {
96642
96650
  const format = getOutputFormat(command);
96643
96651
  const protocol = options.protocol ? options.protocol.split(",").map((p) => p.trim().toLowerCase()) : undefined;
96644
- const result = await search(defaultClient, { q: query, protocol });
96652
+ const result = await search(defaultClient, { q: options.query, protocol });
96645
96653
  const items = result.hits.map(({ id, name, description, protocols }) => ({ id, name, description, protocols }));
96646
96654
  if (items.length === 0) {
96647
96655
  outputNoResults(format);
@@ -96681,12 +96689,12 @@ ${item.description}`, (item.protocols ?? []).join(", ")]);
96681
96689
  }
96682
96690
 
96683
96691
  // src/commands/view.ts
96684
- var viewCommand = new Command("view").description("View an agent by its ID (e.g. CAIP-19)").argument("<id>", "Agent ID (e.g. eip155:8453/erc8004:0x1234/1)").showHelpAfterError(true).addHelpText("after", `
96692
+ var viewCommand = new Command("view").description("View an agent by its ID (e.g. CAIP-19)").requiredOption("-u, --uri <value>", "Agent CAIP-19 ID (e.g. eip155:8453/erc8004:0x1234/1)").showHelpAfterError(true).addHelpText("after", `
96685
96693
  Examples:
96686
- use-agently view eip155:8453/erc8004:0x1234/1`).action(async (id, _options, command) => {
96687
- const agent = await getAgent(defaultClient, id);
96694
+ use-agently view --uri eip155:8453/erc8004:0x1234/1`).action(async (options, command) => {
96695
+ const agent = await getAgent(defaultClient, options.uri);
96688
96696
  if (!agent) {
96689
- throw new Error(`No agent found for ID: ${id}
96697
+ throw new Error(`No agent found for URI: ${options.uri}
96690
96698
  Run 'use-agently search' to find available agents.`);
96691
96699
  }
96692
96700
  output(command, agent);
@@ -97244,6 +97252,126 @@ function enableGlobalOptionsInHelp(cmd) {
97244
97252
  }
97245
97253
  enableGlobalOptionsInHelp(cli);
97246
97254
 
97255
+ // src/telemetry.ts
97256
+ var events = [];
97257
+ function getName(command) {
97258
+ const parts = [];
97259
+ let cmd = command;
97260
+ while (cmd) {
97261
+ if (cmd.parent) {
97262
+ parts.unshift(cmd.name());
97263
+ }
97264
+ cmd = cmd.parent;
97265
+ }
97266
+ return parts.join(" ");
97267
+ }
97268
+ function getArgs(command) {
97269
+ const opts = command.opts();
97270
+ const args = {};
97271
+ const name = getName(command);
97272
+ if (opts.uri) {
97273
+ args.uri = opts.uri;
97274
+ }
97275
+ if ("pay" in opts) {
97276
+ args.pay = !!opts.pay;
97277
+ }
97278
+ switch (name) {
97279
+ case "init":
97280
+ args.local = !!opts.local;
97281
+ args.regenerate = !!opts.regenerate;
97282
+ break;
97283
+ case "search":
97284
+ args.query = opts.query;
97285
+ args.protocol = opts.protocol;
97286
+ break;
97287
+ case "mcp call":
97288
+ args.tool = opts.tool;
97289
+ args.has_args = opts.args !== undefined;
97290
+ break;
97291
+ case "web get":
97292
+ case "web post":
97293
+ case "web put":
97294
+ case "web patch":
97295
+ case "web delete":
97296
+ args.has_headers = (opts.header?.length ?? 0) > 0;
97297
+ args.has_body = opts.data !== undefined || opts.dataRaw !== undefined;
97298
+ args.follow_redirects = !!opts.location;
97299
+ args.verbose = !!opts.verbose;
97300
+ break;
97301
+ }
97302
+ return args;
97303
+ }
97304
+ function getSession(command) {
97305
+ return {
97306
+ version: package_default2.version,
97307
+ os: process.platform,
97308
+ arch: process.arch,
97309
+ is_tty: !!process.stdout.isTTY,
97310
+ output: command.optsWithGlobals().output,
97311
+ wallet: null
97312
+ };
97313
+ }
97314
+ function installTelemetry(cli2) {
97315
+ if (process.env.USE_AGENTLY_TELEMETRY === "0")
97316
+ return;
97317
+ let startTime;
97318
+ cli2.hook("preAction", async () => {
97319
+ startTime = Date.now();
97320
+ });
97321
+ cli2.hook("postAction", (_thisCommand, actionCommand) => {
97322
+ events.push({
97323
+ name: getName(actionCommand),
97324
+ args: { ...getArgs(actionCommand), duration: Date.now() - startTime },
97325
+ session: getSession(actionCommand)
97326
+ });
97327
+ });
97328
+ }
97329
+ async function flushTelemetry() {
97330
+ if (events.length === 0)
97331
+ return;
97332
+ try {
97333
+ const body = JSON.stringify(events);
97334
+ events.length = 0;
97335
+ const controller = new AbortController;
97336
+ const timeout = setTimeout(() => controller.abort(), 3000);
97337
+ await fetch("https://api.use-agently.com/telemetry", {
97338
+ method: "POST",
97339
+ headers: { "Content-Type": "application/json" },
97340
+ body,
97341
+ signal: controller.signal
97342
+ });
97343
+ clearTimeout(timeout);
97344
+ } catch {}
97345
+ }
97346
+
97347
+ // src/errors.ts
97348
+ function isProcessExitError(err) {
97349
+ return err instanceof Error && err.message === "process.exit";
97350
+ }
97351
+ function handleCliError(err, format) {
97352
+ if (isProcessExitError(err))
97353
+ throw err;
97354
+ const message = err instanceof Error ? err.message : String(err);
97355
+ if (format === "json") {
97356
+ console.error(JSON.stringify({ error: { message } }));
97357
+ } else if (process.stderr.isTTY) {
97358
+ console.error(boxen(message, {
97359
+ title: "Error",
97360
+ titleAlignment: "center",
97361
+ borderColor: "red",
97362
+ padding: 1
97363
+ }));
97364
+ } else {
97365
+ console.error(`Error: ${message}`);
97366
+ }
97367
+ process.exit(1);
97368
+ }
97369
+
97247
97370
  // src/bin.ts
97248
- await cli.parseAsync();
97249
- await checkAutoUpdate();
97371
+ installTelemetry(cli);
97372
+ try {
97373
+ await cli.parseAsync();
97374
+ await Promise.all([checkAutoUpdate(), flushTelemetry()]);
97375
+ } catch (err) {
97376
+ handleCliError(err, resolveOutputFormat(cli));
97377
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-agently",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Use Agently CLI",
5
5
  "homepage": "https://use-agently.com",
6
6
  "bugs": "https://github.com/AgentlyHQ/use-agently/issues",
@@ -24,7 +24,7 @@
24
24
  "test": "bun test"
25
25
  },
26
26
  "dependencies": {
27
- "@use-agently/sdk": "0.22.0",
27
+ "@use-agently/sdk": "0.24.0",
28
28
  "boxen": "^8.0.1",
29
29
  "cli-table3": "^0.6.5",
30
30
  "commander": "^14.0.3",