@agentgates/cli 0.90.2 → 0.90.3

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 +103 -51
  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.90.2";
3166
+ CLI_VERSION = "0.90.3";
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
  }
@@ -66246,6 +66246,7 @@ async function sendPaid(args) {
66246
66246
  let last = null;
66247
66247
  let why = "";
66248
66248
  let tried = 0;
66249
+ const answers = [];
66249
66250
  for (let attempt = 1; attempt <= attempts; attempt += 1) {
66250
66251
  let answer = null;
66251
66252
  tried = attempt;
@@ -66263,6 +66264,7 @@ async function sendPaid(args) {
66263
66264
  } catch (err) {
66264
66265
  why = err?.message || String(err);
66265
66266
  }
66267
+ answers.push(answer);
66266
66268
  if (answer) {
66267
66269
  last = answer;
66268
66270
  if (answer.status >= 200 && answer.status < 300) return { kind: "served", answer, attempts: attempt };
@@ -66276,7 +66278,7 @@ async function sendPaid(args) {
66276
66278
  args.onRetry?.(why, attempt, waitMs);
66277
66279
  await sleep4(waitMs);
66278
66280
  }
66279
- return { kind: "no_answer", error: why, attempts: tried, last };
66281
+ return { kind: "no_answer", error: why, attempts: tried, last, answers };
66280
66282
  }
66281
66283
  async function ownerGet(wallet, path12, opts = {}) {
66282
66284
  const header2 = await ownerAuthHeader(wallet, "GET", path12);
@@ -74699,6 +74701,7 @@ function printNext(put) {
74699
74701
 
74700
74702
  // src/commands/sandbox.ts
74701
74703
  var import_picocolors13 = __toESM(require_picocolors(), 1);
74704
+ import { createInterface as createInterface6 } from "node:readline/promises";
74702
74705
  import { promises as fs11, createReadStream as createReadStream2, createWriteStream } from "node:fs";
74703
74706
  import * as path7 from "node:path";
74704
74707
  import { pipeline } from "node:stream/promises";
@@ -74831,8 +74834,10 @@ function mayHaveCharged(a) {
74831
74834
  if (a.status < 500) return false;
74832
74835
  const words7 = typeof a.json?.error === "string" ? a.json.error : "";
74833
74836
  if (/\bnothing was (charged|drawn)\b/i.test(words7)) return false;
74834
- return !["at_capacity", "quote_unread", "sol_price_unread", "screen_refused", "payments_unconfigured", "not_available"].includes(String(a.json?.code ?? ""));
74837
+ return !["at_capacity", "provider_capacity", "quote_unread", "sol_price_unread", "screen_refused", "payments_unconfigured", "not_available"].includes(String(a.json?.code ?? ""));
74835
74838
  }
74839
+ var MAY_STILL_LAND = /send the same payment again|not confirmed within|settlement failed/i;
74840
+ var SUPPORT_ADDRESS = "support@agentgates.ai";
74836
74841
  var COLD_START_WORDS = "it waits for a seat on a host and runs once one has room: about two minutes after its payment when a host must start for it (135 s measured on production), longer when many wait at once";
74837
74842
  var KEY_RE = /^agc_[0-9a-f]{64}$/;
74838
74843
  function computeKeyOf(given) {
@@ -74960,6 +74965,7 @@ async function payFor2(args) {
74960
74965
  headers = { "x-wallet-auth": await ownerAuthHeader(wallet2, "POST", args.path) };
74961
74966
  }
74962
74967
  let answer;
74968
+ args.onSent?.();
74963
74969
  try {
74964
74970
  answer = await computeCall({ method: "POST", url: args.url, body: { ...args.body, maxDrawMicro: atMost.toString() }, headers, timeoutMs: 15e4 });
74965
74971
  } catch (err) {
@@ -74967,11 +74973,11 @@ async function payFor2(args) {
74967
74973
  }
74968
74974
  if (answer.status === 402) {
74969
74975
  const short5 = answer.json?.code === "insufficient_balance" || answer.json?.accepts ? "the balance does not cover it" : apiWords2(answer);
74970
- throw new SandboxError(`${short5}: nothing was drawn. Pay over x402 instead (the same command without ${args.mode === "key" ? "--key" : "--from-balance"}), or top up the balance`, "insufficient_balance", { status: 402 });
74976
+ throw new SandboxError(`${short5}: nothing was drawn. Pay over x402 instead (the same command without ${args.mode === "key" ? "--key" : "--from-balance"}), or top up the balance`, "insufficient_balance", { status: 402, nothingDrawn: true });
74971
74977
  }
74972
74978
  if (answer.status === 409 && answer.json?.code === "price_above_max_draw") {
74973
74979
  const now = typeof answer.json?.priceMicro === "string" && /^\d+$/.test(answer.json.priceMicro) ? usd(BigInt(answer.json.priceMicro)) : null;
74974
- throw new SandboxError(`the price from ${from} is ${now ?? "higher"} now, over the ${usd(atMost)} it was priced at: nothing was drawn. Run it again to pay the price now`, "price_above_max_draw", { status: 409, atMostUsd: usd(atMost), ...now ? { priceUsd: now } : {} });
74980
+ throw new SandboxError(`the price from ${from} is ${now ?? "higher"} now, over the ${usd(atMost)} it was priced at: nothing was drawn. Run it again to pay the price now`, "price_above_max_draw", { status: 409, atMostUsd: usd(atMost), nothingDrawn: true, ...now ? { priceUsd: now } : {} });
74975
74981
  }
74976
74982
  if (answer.status < 200 || answer.status >= 300) throw new SandboxError(apiWords2(answer), apiCode2(answer), { status: answer.status, mayHaveCharged: mayHaveCharged(answer) });
74977
74983
  const charged = answer.json?.charged?.amountMicro;
@@ -75032,17 +75038,23 @@ async function payFor2(args) {
75032
75038
  const signed2 = await signLeg(leg, wallet.privateKey);
75033
75039
  const paid = { network: leg.network, amountUsd: usd(leg.amountMicro), amountAtomic: leg.amountMicro.toString(), from: signed2.from, nonce: signed2.nonce };
75034
75040
  args.onPaid?.(paid);
75041
+ args.onSent?.();
75035
75042
  const outcome = await sendPaid({ url: args.url, body: args.body, payment: signed2.header, onRetry: args.onRetry, ...args.budgetMs !== void 0 ? { budgetMs: args.budgetMs } : {} });
75043
+ const list = args.listWords ?? "agentgates sandbox ls";
75036
75044
  if (outcome.kind === "no_answer") {
75037
- const list = args.listWords ?? "agentgates sandbox ls";
75045
+ const before = outcome.answers.length > 0 && outcome.answers.every((a) => a !== null && a.status >= 500 && !mayHaveCharged(a));
75046
+ if (before && outcome.last) throw new SandboxError(apiWords2(outcome.last), apiCode2(outcome.last), { status: outcome.last.status, paid, mayHaveCharged: false });
75038
75047
  throw new SandboxError(`no clear answer after ${outcome.attempts} ${outcome.attempts === 1 ? "try" : "tries"} (${outcome.error}). The payment (nonce ${signed2.nonce}) may still settle: do not pay again; ${list} shows what it bought`, "no_answer", { paid, nonce: signed2.nonce, mayHaveCharged: true });
75039
75048
  }
75040
75049
  if (outcome.kind === "refused") {
75041
75050
  const a = outcome.answer;
75042
- const maybe = outcome.attempts > 1;
75043
- const charged = maybe ? "The first send may have settled: do not pay again; agentgates sandbox ls shows what it bought" : "Nothing was charged";
75044
- if (a.status === 402) throw new SandboxError(`the payment was refused: ${apiWords2(a)}. ${charged}`, apiCode2(a) === "http_402" ? "payment_refused" : apiCode2(a), { status: a.status, paid, mayHaveCharged: maybe });
75045
- throw new SandboxError(apiWords2(a), apiCode2(a), { status: a.status, paid, mayHaveCharged: maybe || mayHaveCharged(a) });
75051
+ if (a.status === 409 && a.json?.code === "payment_already_spent") {
75052
+ throw new SandboxError(`paid; no sandbox found for it yet: write to ${SUPPORT_ADDRESS} with its payment (nonce ${signed2.nonce}). Do not pay again; ${list} shows it once found`, "payment_already_spent", { status: 409, paid, nonce: signed2.nonce, mayHaveCharged: true, support: SUPPORT_ADDRESS });
75053
+ }
75054
+ const maybe = outcome.attempts > 1 || MAY_STILL_LAND.test(apiWords2(a));
75055
+ const then = maybe ? `. It may still settle: do not pay again; ${list} shows what it bought` : "";
75056
+ if (a.status === 402) throw new SandboxError(`the payment was refused: ${apiWords2(a)}${then}`, apiCode2(a) === "http_402" ? "payment_refused" : apiCode2(a), { status: a.status, paid, mayHaveCharged: maybe });
75057
+ throw new SandboxError(apiWords2(a), apiCode2(a), { status: a.status, paid, mayHaveCharged: outcome.attempts > 1 || mayHaveCharged(a) });
75046
75058
  }
75047
75059
  return { kind: "served", answer: outcome.answer, paid, mode: "x402", payer: wallet.address };
75048
75060
  }
@@ -75059,6 +75071,7 @@ async function createSandboxes(args) {
75059
75071
  const what = `${count > 1 ? `${count} x ` : ""}${String(body.plan)}, ${time}, ${typeof body.image === "string" ? body.image : "base"}`;
75060
75072
  const pendingId = access && !args.consent.quoteOnly ? pendingIdOf(access.hash) : null;
75061
75073
  if (pendingId && access) {
75074
+ const payer = args.mode === "key" ? `agc_...${String(args.key ?? "").slice(-4)}` : await payingWallet().then((w) => w.address, () => null);
75062
75075
  await writeRecord({
75063
75076
  v: 1,
75064
75077
  deploymentId: pendingId,
@@ -75070,16 +75083,21 @@ async function createSandboxes(args) {
75070
75083
  accessKey: access.secret,
75071
75084
  paidWith: args.mode,
75072
75085
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
75073
- pending: { accessKeyHash: access.hash, at: (/* @__PURE__ */ new Date()).toISOString(), count }
75086
+ pending: { accessKeyHash: access.hash, at: (/* @__PURE__ */ new Date()).toISOString(), count, payer }
75074
75087
  });
75075
75088
  }
75089
+ let sent = false;
75076
75090
  let out;
75077
75091
  try {
75078
- out = await payFor2({ url: `${computeOrigin()}${DEPLOYMENTS_PATH}`, path: DEPLOYMENTS_PATH, body, mode: args.mode, key: args.key, consent: args.consent, what, onPaid: args.onPaid, onRetry: args.onRetry, budgetMs: args.budgetMs, listWords: args.listWords });
75092
+ out = await payFor2({ url: `${computeOrigin()}${DEPLOYMENTS_PATH}`, path: DEPLOYMENTS_PATH, body, mode: args.mode, key: args.key, consent: args.consent, what, onPaid: args.onPaid, onRetry: args.onRetry, onSent: () => {
75093
+ sent = true;
75094
+ }, budgetMs: args.budgetMs, listWords: args.listWords });
75079
75095
  } catch (err) {
75080
75096
  if (pendingId) {
75081
- if (err instanceof SandboxError && err.detail.mayHaveCharged === true) {
75082
- throw new SandboxError(`${err.message}. Its access key is kept here: ${args.listWords ?? "agentgates sandbox ls"} binds it to the sandbox it bought`, err.code, { ...err.detail, pending: pendingId });
75097
+ const nothingDrawn = err instanceof SandboxError && err.detail.nothingDrawn === true;
75098
+ if (sent && !nothingDrawn) {
75099
+ const e = err instanceof SandboxError ? err : new SandboxError(err?.message ?? String(err), "error");
75100
+ throw new SandboxError(`${e.message}. Its access key is kept here: ${args.listWords ?? "agentgates sandbox ls"} binds it to the sandbox it bought (agentgates sandbox rm ${pendingId} --yes drops it)`, e.code, { ...e.detail, pending: pendingId });
75083
75101
  }
75084
75102
  await removeRecord(pendingId);
75085
75103
  }
@@ -75165,6 +75183,7 @@ async function findSandbox(id2, opts = {}) {
75165
75183
  const clean3 = String(id2 ?? "").trim();
75166
75184
  if (!/^[A-Za-z0-9_-]{1,64}$/.test(clean3)) throw new SandboxError(`"${id2}" is not a sandbox id (agentgates sandbox ls shows yours)`, "bad_input");
75167
75185
  const rec = await findRecord(clean3);
75186
+ if (rec?.pending) throw new SandboxError(`${rec.deploymentId} is ${PENDING_STATUS_WORDS}`, "pending", { status: "pending", paidBy: rec.pending.payer ?? null });
75168
75187
  const key = opts.key ?? null;
75169
75188
  let wallet;
75170
75189
  let walletError = null;
@@ -75181,7 +75200,7 @@ async function findSandbox(id2, opts = {}) {
75181
75200
  if (doorOnly) {
75182
75201
  } else if (readAuth && depId) {
75183
75202
  const a = await readMachine(depId, readAuth).catch(() => null);
75184
- if (a === null) unread = true;
75203
+ if (a === null || a.status !== 200 && a.status !== 404) unread = true;
75185
75204
  if (a && a.status === 200) machine = a.json;
75186
75205
  else if (a && a.status === 404 && !rec) throw new SandboxError(`${apiWords2(a)}${wallet ? ` (this key is ${wallet.address})` : ""}`, "not_found", { status: 404 });
75187
75206
  } else if (readAuth) {
@@ -75317,6 +75336,7 @@ async function renewSandbox(args) {
75317
75336
  }
75318
75337
  async function deleteSandbox(id2) {
75319
75338
  const rec = await findRecord(id2);
75339
+ if (rec?.pending) throw new SandboxError(PENDING_RM_WORDS, "pending_key", { pending: rec.deploymentId });
75320
75340
  if (rec?.paidWith === "attached") throw new SandboxError(ATTACHED_DELETE_WORDS, "needs_owner");
75321
75341
  let depId = rec?.deploymentId ?? id2;
75322
75342
  const wallet = await payingWallet();
@@ -75354,43 +75374,42 @@ async function listSandboxes(opts = {}) {
75354
75374
  errors.push(err.message);
75355
75375
  }
75356
75376
  }
75357
- const read = { wallet: Boolean(wallet) && !errors.length, key: Boolean(opts.key) && !errors.length };
75358
75377
  let current = recs;
75359
75378
  for (const p of recs.filter((r) => r.pending)) {
75360
75379
  const pending = p.pending;
75361
75380
  const mine = [...seen.values()].filter((m) => m.accessKeyHash === pending.accessKeyHash);
75362
- if (mine.length > 0) {
75363
- for (const m of mine) {
75364
- const sb = sandboxOf(m);
75365
- await writeRecord({
75366
- v: 1,
75367
- deploymentId: String(m.deploymentId),
75368
- plan: typeof m.plan === "string" ? m.plan : p.plan,
75369
- sandboxId: sb?.id ?? null,
75370
- api: sb?.api ?? null,
75371
- tlsPin: sb?.tlsPin ?? null,
75372
- owner: p.paidWith === "key" ? null : wallet?.address ?? null,
75373
- accessKey: p.accessKey,
75374
- paidWith: p.paidWith,
75375
- createdAt: p.createdAt
75376
- });
75377
- }
75378
- await removeRecord(p.deploymentId);
75379
- current = current.filter((r) => r.deploymentId !== p.deploymentId);
75380
- continue;
75381
- }
75382
- const listRead = p.paidWith === "key" ? read.key : read.wallet;
75383
- if (listRead && Date.now() - Date.parse(pending.at) > PENDING_CLEAR_MS) {
75384
- await removeRecord(p.deploymentId);
75385
- current = current.filter((r) => r.deploymentId !== p.deploymentId);
75381
+ if (mine.length === 0) continue;
75382
+ for (const m of mine) {
75383
+ const sb = sandboxOf(m);
75384
+ await writeRecord({
75385
+ v: 1,
75386
+ deploymentId: String(m.deploymentId),
75387
+ plan: typeof m.plan === "string" ? m.plan : p.plan,
75388
+ sandboxId: sb?.id ?? null,
75389
+ api: sb?.api ?? null,
75390
+ tlsPin: sb?.tlsPin ?? null,
75391
+ owner: p.paidWith === "key" ? null : pending.payer && /^0x[0-9a-fA-F]{40}$/.test(pending.payer) ? pending.payer : wallet?.address ?? null,
75392
+ accessKey: p.accessKey,
75393
+ paidWith: p.paidWith,
75394
+ createdAt: p.createdAt
75395
+ });
75386
75396
  }
75397
+ await removeRecord(p.deploymentId);
75398
+ current = current.filter((r) => r.deploymentId !== p.deploymentId);
75387
75399
  }
75388
75400
  const after = current === recs ? recs : await readRecords();
75389
75401
  const rows = [...seen.values()].map((m) => ({ machine: m, record: after.find((r) => r.deploymentId === m.deploymentId) ?? null }));
75390
75402
  const onlyHere = after.filter((r) => !seen.has(r.deploymentId)).map((r) => ({ machine: null, record: r }));
75391
75403
  return { owner: wallet?.address ?? null, rows: [...rows, ...onlyHere], errors };
75392
75404
  }
75393
- var PENDING_CLEAR_MS = 20 * 6e4;
75405
+ async function dropPendingKey(id2) {
75406
+ const rec = await findRecord(String(id2 ?? "").trim());
75407
+ if (!rec?.pending) throw new SandboxError(`no kept access key "${id2}" here (agentgates sandbox ls shows them as pending)`, "not_found");
75408
+ await removeRecord(rec.deploymentId);
75409
+ return rec;
75410
+ }
75411
+ var PENDING_STATUS_WORDS = "a purchase's kept access key with no sandbox found yet: agentgates sandbox ls binds it to the sandbox carrying its hash once that sandbox is listed (with --key <the compute key> when one paid)";
75412
+ var PENDING_RM_WORDS = "that is a purchase's kept access key with no sandbox found yet: agentgates sandbox ls binds it once its sandbox is listed; agentgates sandbox rm <its id> --yes drops the key, after which a sandbox it bought would not open from here";
75394
75413
 
75395
75414
  // src/commands/sandbox.ts
75396
75415
  init_sandbox_door();
@@ -76076,6 +76095,33 @@ function report(opts, r) {
76076
76095
  `);
76077
76096
  }
76078
76097
  async function sandboxRm(id2, opts) {
76098
+ const rec = await findRecord(String(id2 ?? "").trim()).catch(() => null);
76099
+ if (rec?.pending) {
76100
+ if (!opts.yes) {
76101
+ const interactive = !jsonMode7(opts) && Boolean(process.stdin.isTTY);
76102
+ let answer = "";
76103
+ if (interactive) {
76104
+ const rl = createInterface6({ input: process.stdin, output: process.stderr });
76105
+ try {
76106
+ answer = (await rl.question(` Drop the kept access key of ${rec.deploymentId}? A sandbox it bought would not open from here. [y/N] `)).trim().toLowerCase();
76107
+ } catch {
76108
+ answer = "";
76109
+ } finally {
76110
+ rl.close();
76111
+ }
76112
+ }
76113
+ if (answer !== "y" && answer !== "yes") return fail3(opts, interactive ? "kept: nothing dropped" : `${rec.deploymentId} is a purchase's kept access key: --yes drops it (a sandbox it bought would not open from here after)`, interactive ? "declined" : "yes_required");
76114
+ }
76115
+ try {
76116
+ const r = await dropPendingKey(rec.deploymentId);
76117
+ if (jsonMode7(opts)) say3(JSON.stringify({ ok: true, dropped: r.deploymentId }, null, 2) + "\n");
76118
+ else say3(` ${import_picocolors13.default.green("ok")} ${r.deploymentId}: its kept access key dropped
76119
+ `);
76120
+ } catch (err) {
76121
+ failWith(opts, err);
76122
+ }
76123
+ return;
76124
+ }
76079
76125
  try {
76080
76126
  const r = await deleteSandbox(id2);
76081
76127
  if (jsonMode7(opts)) say3(JSON.stringify({ ok: true, deploymentId: r.deploymentId, answer: r.answer }, null, 2) + "\n");
@@ -76150,7 +76196,8 @@ async function sandboxLs(opts) {
76150
76196
  plan: r.machine?.plan ?? r.record?.plan ?? null,
76151
76197
  expiresAt: r.machine?.expiresAt ?? null,
76152
76198
  sandbox: (r.machine && sandboxOf(r.machine)) ?? (r.record?.api ? { id: r.record.sandboxId, api: r.record.api, tlsPin: r.record.tlsPin } : null),
76153
- accessKeyHere: Boolean(r.record?.accessKey)
76199
+ accessKeyHere: Boolean(r.record?.accessKey),
76200
+ ...r.record?.pending && !r.machine ? { paidBy: r.record.pending.payer ?? null } : {}
76154
76201
  })),
76155
76202
  ...list.errors.length ? { errors: list.errors } : {}
76156
76203
  },
@@ -76170,7 +76217,9 @@ async function sandboxLs(opts) {
76170
76217
  for (const r of list.rows) {
76171
76218
  const m = r.machine;
76172
76219
  const sb = (m && sandboxOf(m)) ?? (r.record?.api && r.record.sandboxId ? { id: r.record.sandboxId, api: r.record.api } : null);
76173
- say3(`${sandboxLines({ deploymentId: m?.deploymentId ?? r.record?.deploymentId, status: m?.status ?? (r.record?.pending ? "pending" : "unread"), plan: m?.plan ?? r.record?.plan, expiresAt: m?.expiresAt, killReason: m?.killReason }, m?.status === "running" || !m ? sb : null)}
76220
+ const paidBy = !m && r.record?.pending ? `
76221
+ paid by ${r.record.pending.payer ?? "?"}` : "";
76222
+ say3(`${sandboxLines({ deploymentId: m?.deploymentId ?? r.record?.deploymentId, status: m?.status ?? (r.record?.pending ? "pending" : "unread"), plan: m?.plan ?? r.record?.plan, expiresAt: m?.expiresAt, killReason: m?.killReason }, m?.status === "running" || !m ? sb : null)}${paidBy}
76174
76223
 
76175
76224
  `);
76176
76225
  }
@@ -76239,7 +76288,7 @@ async function sandboxStatus(id2, opts) {
76239
76288
  try {
76240
76289
  found = await findSandbox(id2, { key: computeKeyOf(opts.key) });
76241
76290
  } catch (err) {
76242
- if (err instanceof SandboxError && (err.code === "not_running" || err.code === "not_ready") && typeof err.detail.status === "string") {
76291
+ if (err instanceof SandboxError && (err.code === "not_running" || err.code === "not_ready" || err.code === "pending") && typeof err.detail.status === "string") {
76243
76292
  if (jsonMode7(opts)) say3(JSON.stringify({ ok: true, status: err.detail.status, note: err.message }, null, 2) + "\n");
76244
76293
  else say3(` ${err.message}
76245
76294
  `);
@@ -76303,7 +76352,7 @@ init_passwords_wire();
76303
76352
  init_passwords_seal();
76304
76353
 
76305
76354
  // src/lib/mcp-stdio.ts
76306
- import { createInterface as createInterface6 } from "node:readline";
76355
+ import { createInterface as createInterface7 } from "node:readline";
76307
76356
  var MCP_PROTOCOL_VERSIONS = ["2025-06-18", "2025-03-26", "2024-11-05"];
76308
76357
  var McpToolError = class extends Error {
76309
76358
  constructor(message, detail = {}) {
@@ -76417,7 +76466,7 @@ async function serve(tools, info, { input = process.stdin, output: output2 = pro
76417
76466
  `);
76418
76467
  };
76419
76468
  const inFlight = /* @__PURE__ */ new Set();
76420
- const lines = createInterface6({ input, crlfDelay: Infinity });
76469
+ const lines = createInterface7({ input, crlfDelay: Infinity });
76421
76470
  for await (const line2 of lines) {
76422
76471
  const parsed = parseLine(line2);
76423
76472
  if (!parsed) continue;
@@ -77671,7 +77720,7 @@ async function filesRm(target, opts) {
77671
77720
 
77672
77721
  // src/commands/card.ts
77673
77722
  var import_picocolors16 = __toESM(require_picocolors(), 1);
77674
- import { createInterface as createInterface7 } from "node:readline/promises";
77723
+ import { createInterface as createInterface8 } from "node:readline/promises";
77675
77724
 
77676
77725
  // src/lib/memory-address.ts
77677
77726
  var ADDRESS_FOLDER = "profile";
@@ -78213,7 +78262,7 @@ var QUESTIONS = [
78213
78262
  { field: "zip", ask: "ZIP code", abroad: "Postal code" }
78214
78263
  ];
78215
78264
  async function askAddress() {
78216
- const rl = createInterface7({ input: process.stdin, output: process.stdout });
78265
+ const rl = createInterface8({ input: process.stdin, output: process.stdout });
78217
78266
  const answers = { country: "US", line1: "", line2: "", city: "", region: "", zip: "" };
78218
78267
  try {
78219
78268
  process.stdout.write(`
@@ -78676,10 +78725,13 @@ function sandboxTools(wait2 = readWait) {
78676
78725
  owner: list.owner,
78677
78726
  sandboxes: list.rows.map((r) => ({
78678
78727
  deploymentId: r.machine?.deploymentId ?? r.record?.deploymentId,
78679
- status: r.machine?.status ?? "unread",
78728
+ status: r.machine?.status ?? (r.record?.pending ? "pending" : "unread"),
78680
78729
  plan: r.machine?.plan ?? r.record?.plan ?? null,
78681
78730
  expiresAt: r.machine?.expiresAt ?? null,
78682
- sandbox: (r.machine && sandboxOf(r.machine)) ?? null
78731
+ sandbox: (r.machine && sandboxOf(r.machine)) ?? null,
78732
+ // A purchase's kept access key, no sandbox found yet: bound
78733
+ // here once its sandbox is listed; never dropped by a read.
78734
+ ...r.record?.pending && !r.machine ? { paidBy: r.record.pending.payer ?? null } : {}
78683
78735
  })),
78684
78736
  ...list.errors.length ? { errors: list.errors } : {}
78685
78737
  };
@@ -86432,7 +86484,7 @@ sandbox.command("renew <id>").description("Add paid minutes to its end. Any wall
86432
86484
  sandbox.command("attach <address>").description("Keep a sandbox bought on agentgates.ai here, from what its page showed once: its address, its pin and its access key. Its proof is checked and its door opened first; then exec, cp, verify, logs and status reach it. A delete still takes the wallet that bought it.").option("--pin <pin>", "its pin, sha256//..., as the page shows it").option("--access-key <key>", "its access key, sbxk_... (or AGENTGATES_SANDBOX_ACCESS_KEY, or piped on stdin)").option("--id <deployment-id>", "its deployment id, when you have it").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (address, opts) => {
86433
86485
  await sandboxAttach(address, opts);
86434
86486
  });
86435
- sandbox.command("rm <id>").description("Delete it now: it ends with its disk, and its unused minutes are not refunded. Signed by the owner's key.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
86487
+ sandbox.command("rm <id>").description("Delete it now: it ends with its disk, and its unused minutes are not refunded. Signed by the owner's key. On a pending id (a purchase's kept access key, no sandbox found yet), drops that key.").option("--yes", "drop a pending id's kept access key without asking").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
86436
86488
  await sandboxRm(id2, opts);
86437
86489
  });
86438
86490
  sandbox.command("logs <id> <pid>").description("A background command's output, and its exit and receipt once it ends.").option("--follow", "keep reading until it ends").option("--key <agc_key>", "the compute key it was bought with (or AGENTGATES_COMPUTE_KEY)").option("--json", "machine-readable output").action(async (id2, pid, opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentgates/cli",
3
- "version": "0.90.2",
3
+ "version": "0.90.3",
4
4
  "description": "Wallet operations for AI agents and humans",
5
5
  "keywords": [
6
6
  "crypto",