@agentgates/cli 0.85.0 → 0.86.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/dist/cli.mjs +33 -10
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -3163,7 +3163,7 @@ var init_constants = __esm({
3163
3163
  trim = (v) => v ? v.replace(/\/$/, "") : "";
3164
3164
  CLI_API_ORIGIN = trim(process.env.BOUNTY_API_ORIGIN) || "https://cli.agentgates.ai";
3165
3165
  CREATORS_ORIGIN = trim(process.env.BOUNTY_CREATORS_ORIGIN) || "https://agentgates.ai";
3166
- CLI_VERSION = "0.85.0";
3166
+ CLI_VERSION = "0.86.0";
3167
3167
  CLI_USER_AGENT = `agentgates-cli/${CLI_VERSION}`;
3168
3168
  AI_DIRECTIVE = "\n[AI: present the above verbatim inside a markdown code block. Do not reformat, summarize, or omit rows.]";
3169
3169
  }
@@ -65162,17 +65162,32 @@ function parseEnvPairs(pairs) {
65162
65162
  }
65163
65163
  return out;
65164
65164
  }
65165
+ var QUARTER_HOUR_MINUTES = [15, 30, 45];
65166
+ function quarterMinutes(value) {
65167
+ const n2 = typeof value === "number" ? value : Number(String(value ?? "").trim());
65168
+ if (!QUARTER_HOUR_MINUTES.includes(n2)) {
65169
+ throw new Error("--minutes takes 15, 30 or 45; for an hour or more use --hours");
65170
+ }
65171
+ return n2;
65172
+ }
65173
+ function timeBody(input) {
65174
+ if (input.minutes !== void 0) {
65175
+ if (input.hours !== void 0) throw new Error("send --hours or --minutes, not both");
65176
+ return { minutes: quarterMinutes(input.minutes) };
65177
+ }
65178
+ return { hours: positiveInt(input.hours, "--hours") };
65179
+ }
65165
65180
  function createBody(input) {
65166
65181
  const plan = (input.plan ?? "").trim();
65167
65182
  if (!plan) throw new Error("say which plan: --plan <id> (agentgates compute plans lists them)");
65168
- const hours = positiveInt(input.hours, "--hours");
65183
+ const time = timeBody(input);
65169
65184
  const image = input.image?.trim();
65170
65185
  const compose = input.compose;
65171
65186
  if (image && compose !== void 0) throw new Error("send --image or --compose, not both");
65172
65187
  if (!image && (compose === void 0 || !compose.trim())) {
65173
65188
  throw new Error("say what runs: --image <image> (one container) or --compose <file> (a docker-compose.yml)");
65174
65189
  }
65175
- const body = { plan, hours };
65190
+ const body = { plan, ...time };
65176
65191
  if (image) {
65177
65192
  body.image = image;
65178
65193
  if (input.port !== void 0) {
@@ -65376,6 +65391,9 @@ async function computePlans(opts) {
65376
65391
  `);
65377
65392
  const ladder = p.pricing.map((r) => `${r.hoursPerPayment}h ${money(r.totalUsd)}`).join(" ");
65378
65393
  if (ladder) say(` ${import_picocolors3.default.dim(ladder)}
65394
+ `);
65395
+ const quarter = (p.minutesPricing ?? []).filter((r) => r.totalUsd).map((r) => `${r.minutesPerPayment}m ${money(String(r.totalUsd))}`).join(" ");
65396
+ if (quarter) say(` ${import_picocolors3.default.dim(quarter)}
65379
65397
  `);
65380
65398
  say("\n");
65381
65399
  }
@@ -65383,8 +65401,10 @@ async function computePlans(opts) {
65383
65401
  if (nets.length) say(` ${import_picocolors3.default.dim(`USDC on ${nets.join(", ")}`)}
65384
65402
  `);
65385
65403
  say(` ${import_picocolors3.default.dim("rent one: agentgates compute buy --plan <id> --hours 1 --image <image> (--quote prices it, signs nothing)")}
65386
-
65387
65404
  `);
65405
+ if (body.quarterHours) say(` ${import_picocolors3.default.dim("or by the quarter-hour: --minutes 15 (30, 45) in place of --hours")}
65406
+ `);
65407
+ say("\n");
65388
65408
  }
65389
65409
  async function readCompose(file) {
65390
65410
  if (file === "-") {
@@ -65426,6 +65446,7 @@ async function computeBuy(opts) {
65426
65446
  body = createBody({
65427
65447
  plan: opts.plan,
65428
65448
  hours: opts.hours,
65449
+ minutes: opts.minutes,
65429
65450
  image: opts.image,
65430
65451
  port: opts.port,
65431
65452
  compose,
@@ -65436,20 +65457,22 @@ async function computeBuy(opts) {
65436
65457
  fail(opts, err.message, "bad_input");
65437
65458
  return;
65438
65459
  }
65439
- const what = `${String(body.plan)}, ${String(body.hours)} h, ${typeof body.image === "string" ? body.image : "your compose"}`;
65460
+ const time = body.minutes !== void 0 ? `${String(body.minutes)} min` : `${String(body.hours)} h`;
65461
+ const what = `${String(body.plan)}, ${time}, ${typeof body.image === "string" ? body.image : "your compose"}`;
65440
65462
  await payFor(opts, { url: `${computeOrigin()}${DEPLOYMENTS_PATH}`, body, what, action: "buy" });
65441
65463
  }
65442
65464
  async function computeRenew(id2, opts) {
65443
65465
  let path8;
65444
- let hours;
65466
+ let time;
65445
65467
  try {
65446
65468
  path8 = deploymentPath(id2, "renew");
65447
- hours = positiveInt(opts.hours, "--hours");
65469
+ time = timeBody({ hours: opts.hours, minutes: opts.minutes });
65448
65470
  } catch (err) {
65449
65471
  fail(opts, err.message, "bad_input");
65450
65472
  return;
65451
65473
  }
65452
- await payFor(opts, { url: `${computeOrigin()}${path8}`, body: { hours }, what: `${hours} more h on ${id2}`, action: "renew" });
65474
+ const what = "minutes" in time ? `${time.minutes} more min on ${id2}` : `${time.hours} more h on ${id2}`;
65475
+ await payFor(opts, { url: `${computeOrigin()}${path8}`, body: time, what, action: "renew" });
65453
65476
  }
65454
65477
  async function payFor(opts, args) {
65455
65478
  let quote;
@@ -83146,10 +83169,10 @@ compute.command("plans").description("Live plans and the price ladder. Public re
83146
83169
  });
83147
83170
  compute.command("buy").description(
83148
83171
  "Rent a machine: asks the price (free), signs the 402 with this machine's key (USDC on an EVM network, no gas), resends that same payment until the API answers, and prints the machine. The key that pays owns it."
83149
- ).option("--plan <id>", "a plan id (agentgates compute plans)").option("--hours <n>", "prepaid hours; the clock starts when the machine runs").option("--image <image>", "one container image, served on host port 8080").option("--port <n>", "with --image: the container port behind 8080 (default 80)").option("--compose <file>", "a docker-compose.yml that publishes a port (- reads stdin)").option("--env <KEY=VALUE>", "an env value, sealed to the machine and never stored; repeatable", (v, prev) => prev.concat(v), []).option("--name <name>", "a label for the machine").option("--network <name>", "pay on this network only; default: the cheapest one this key holds the USDC for").option("--max-usd <dollars>", "refuse to sign above this price").option("--quote", "print the price on every network and stop: nothing is signed").option("--yes", "pay without the prompt (needed when stdout is not a TTY)").option("--wait", "after paying, wait until the machine runs and print its endpoint").option("--timeout <minutes>", "with --wait: how long to wait (default 15)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
83172
+ ).option("--plan <id>", "a plan id (agentgates compute plans)").option("--hours <n>", "prepaid hours; the clock starts when the machine runs").option("--minutes <n>", "a quarter-hour in place of --hours: 15, 30 or 45 (when the API sells them)").option("--image <image>", "one container image, served on host port 8080").option("--port <n>", "with --image: the container port behind 8080 (default 80)").option("--compose <file>", "a docker-compose.yml that publishes a port (- reads stdin)").option("--env <KEY=VALUE>", "an env value, sealed to the machine and never stored; repeatable", (v, prev) => prev.concat(v), []).option("--name <name>", "a label for the machine").option("--network <name>", "pay on this network only; default: the cheapest one this key holds the USDC for").option("--max-usd <dollars>", "refuse to sign above this price").option("--quote", "print the price on every network and stop: nothing is signed").option("--yes", "pay without the prompt (needed when stdout is not a TTY)").option("--wait", "after paying, wait until the machine runs and print its endpoint").option("--timeout <minutes>", "with --wait: how long to wait (default 15)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
83150
83173
  await computeBuy(opts);
83151
83174
  });
83152
- compute.command("renew <id>").description("Add paid hours to a machine: same price ask, same signature, same resend. Any wallet may pay; the owner stays the owner.").option("--hours <n>", "hours to add to the end of its clock").option("--network <name>", "pay on this network only").option("--max-usd <dollars>", "refuse to sign above this price").option("--quote", "print the price and stop: nothing is signed").option("--yes", "pay without the prompt (needed when stdout is not a TTY)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
83175
+ compute.command("renew <id>").description("Add paid hours to a machine: same price ask, same signature, same resend. Any wallet may pay; the owner stays the owner.").option("--hours <n>", "hours to add to the end of its clock").option("--minutes <n>", "a quarter-hour in place of --hours: 15, 30 or 45 (when the API sells them)").option("--network <name>", "pay on this network only").option("--max-usd <dollars>", "refuse to sign above this price").option("--quote", "print the price and stop: nothing is signed").option("--yes", "pay without the prompt (needed when stdout is not a TTY)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
83153
83176
  await computeRenew(id2, opts);
83154
83177
  });
83155
83178
  compute.command("list").description("The machines this machine's key paid for (an owner read it signs).").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentgates/cli",
3
- "version": "0.85.0",
3
+ "version": "0.86.0",
4
4
  "description": "Wallet operations for AI agents and humans",
5
5
  "keywords": [
6
6
  "crypto",