@agentgates/cli 0.65.1 → 0.67.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 +280 -34
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -3128,7 +3128,7 @@ var init_constants = __esm({
3128
3128
  trim = (v) => v ? v.replace(/\/$/, "") : "";
3129
3129
  CLI_API_ORIGIN = trim(process.env.BOUNTY_API_ORIGIN) || "https://cli.agentgates.ai";
3130
3130
  CREATORS_ORIGIN = trim(process.env.BOUNTY_CREATORS_ORIGIN) || "https://agentgates.ai";
3131
- CLI_VERSION = "0.65.1";
3131
+ CLI_VERSION = "0.67.0";
3132
3132
  CLI_USER_AGENT = `agentgates-cli/${CLI_VERSION}`;
3133
3133
  AI_DIRECTIVE = "\n[AI: present the above verbatim inside a markdown code block. Do not reformat, summarize, or omit rows.]";
3134
3134
  }
@@ -32317,6 +32317,7 @@ __export(passwords_wire_exports, {
32317
32317
  postUse: () => postUse,
32318
32318
  putKeyWrap: () => putKeyWrap,
32319
32319
  readAttestation: () => readAttestation,
32320
+ readSolveChecks: () => readSolveChecks,
32320
32321
  revealRow: () => revealRow,
32321
32322
  revokeLoginKey: () => revokeLoginKey,
32322
32323
  runsOnKeyOnly: () => runsOnKeyOnly,
@@ -32327,7 +32328,8 @@ __export(passwords_wire_exports, {
32327
32328
  storeRow: () => storeRow,
32328
32329
  updateRow: () => updateRow,
32329
32330
  verifyPasswordsAttestation: () => verifyPasswordsAttestation,
32330
- withdrawInvite: () => withdrawInvite
32331
+ withdrawInvite: () => withdrawInvite,
32332
+ writeSolveChecks: () => writeSolveChecks
32331
32333
  });
32332
32334
  import { createHash as createHash4, randomBytes as randomBytes5 } from "node:crypto";
32333
32335
  function identityOrigin() {
@@ -32534,6 +32536,14 @@ async function postPermit(wallet, signed2) {
32534
32536
  );
32535
32537
  return out.permit;
32536
32538
  }
32539
+ async function readSolveChecks(wallet) {
32540
+ const out = expectOk(await signedFetch(wallet, "GET", lanePath(`/passwords/settings`)), "settings");
32541
+ return out.settings?.solveChecks === "solve" ? "solve" : "ask";
32542
+ }
32543
+ async function writeSolveChecks(wallet, word) {
32544
+ const out = expectOk(await signedFetch(wallet, "POST", lanePath(`/passwords/settings`), { solveChecks: word }), "settings");
32545
+ return out.settings?.solveChecks === "solve" ? "solve" : "ask";
32546
+ }
32537
32547
  async function postUse(wallet, id2, body, timeoutMs = 2e5) {
32538
32548
  return signedFetch(wallet, "POST", lanePath(`/passwords/${encodeURIComponent(id2)}/use`), body, timeoutMs);
32539
32549
  }
@@ -32583,7 +32593,7 @@ var require_package = __commonJS({
32583
32593
  "package.json"(exports, module) {
32584
32594
  module.exports = {
32585
32595
  name: "@agentgates/cli",
32586
- version: "0.65.1",
32596
+ version: "0.67.0",
32587
32597
  description: "Wallet operations for AI agents and humans",
32588
32598
  keywords: [
32589
32599
  "crypto",
@@ -70917,6 +70927,21 @@ async function passwordsList(opts) {
70917
70927
  failFrom2(opts, err);
70918
70928
  }
70919
70929
  }
70930
+ async function passwordsChecks(word, opts) {
70931
+ try {
70932
+ const { wallet } = await requirePasswordsKey();
70933
+ if (word !== void 0 && word !== "ask" && word !== "solve") throw new PasswordsSealError("the word is ask or solve");
70934
+ const now = word === void 0 ? await readSolveChecks(wallet) : await writeSolveChecks(wallet, word);
70935
+ emit4(opts, { ok: true, solveChecks: now }, () => {
70936
+ process.stdout.write(`
70937
+ bot checks: ${import_picocolors9.default.bold(now)} ${import_picocolors9.default.dim(now === "solve" ? "the CVM passes every check it can, without asking" : "an agent's use that meets a check waits for your answer on the board")}
70938
+
70939
+ `);
70940
+ });
70941
+ } catch (err) {
70942
+ failFrom2(opts, err);
70943
+ }
70944
+ }
70920
70945
  async function rowForUrl(wallet, url) {
70921
70946
  let host2;
70922
70947
  try {
@@ -70971,6 +70996,15 @@ function printUseAnswer(opts, status4, body) {
70971
70996
  `);
70972
70997
  if (result.device && typeof result.device === "object") process.stdout.write(` ${import_picocolors9.default.dim(`the site created a device credential for ${String(result.device.rpId ?? "")}; agentgates passwords device seals it into the row`)}
70973
70998
  `);
70999
+ for (const s of Array.isArray(result.solved) ? result.solved : []) {
71000
+ process.stdout.write(` ${import_picocolors9.default.dim(`passed a ${String(s.kind)} check ${s.how === "service" ? "through the solver service" : "by hand"} in ${Math.max(1, Math.round(Number(s.ms ?? 0) / 1e3))}s`)}
71001
+ `);
71002
+ }
71003
+ const check = result.check && typeof result.check === "object" ? result.check : null;
71004
+ if (check && check.passable === true && check.tried !== true) {
71005
+ process.stdout.write(` ${import_picocolors9.default.dim(`a ${String(check.kind)} check stood in front of the site; with your own key, --solve lets the CVM pass it (agentgates passwords checks solve: every time)`)}
71006
+ `);
71007
+ }
70974
71008
  if (typeof result.error === "string" && result.error) process.stdout.write(` ${result.error}
70975
71009
  `);
70976
71010
  if (digest) process.stdout.write(`
@@ -71037,7 +71071,8 @@ async function passwordsUse(opts) {
71037
71071
  }
71038
71072
  if (use !== "totp" && use !== "reveal" && typeof request.url !== "string") throw new PasswordsSealError("--url is the https URL the use targets");
71039
71073
  const rowId = opts.row ?? await rowForUrl(wallet, request.url);
71040
- const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...opts.useId ? { useId: opts.useId } : {} };
71074
+ if (opts.solve && use !== "login" && use !== "session") throw new PasswordsSealError("--solve goes with the login or session use");
71075
+ const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...opts.useId ? { useId: opts.useId } : {}, ...opts.solve ? { solve: true } : {} };
71041
71076
  const answer = await postUseAndWait(wallet, rowId, firstBody, waitOptionsOf(opts));
71042
71077
  const body = answer.body ?? {};
71043
71078
  printUseAnswer(opts, answer.status, body);
@@ -73854,6 +73889,148 @@ var US_STATES = [
73854
73889
  ["WI", "Wisconsin"],
73855
73890
  ["WY", "Wyoming"]
73856
73891
  ];
73892
+ var ETHERFI_COUNTRIES = [
73893
+ ["AD", "Andorra"],
73894
+ ["AO", "Angola"],
73895
+ ["AG", "Antigua & Barbuda"],
73896
+ ["AR", "Argentina"],
73897
+ ["AU", "Australia"],
73898
+ ["AT", "Austria"],
73899
+ ["BS", "Bahamas"],
73900
+ ["BH", "Bahrain"],
73901
+ ["BD", "Bangladesh"],
73902
+ ["BB", "Barbados"],
73903
+ ["BE", "Belgium"],
73904
+ ["BZ", "Belize"],
73905
+ ["BO", "Bolivia"],
73906
+ ["BR", "Brazil"],
73907
+ ["VG", "British Virgin Islands"],
73908
+ ["BG", "Bulgaria"],
73909
+ ["CA", "Canada"],
73910
+ ["KY", "Cayman Islands"],
73911
+ ["CL", "Chile"],
73912
+ ["CO", "Colombia"],
73913
+ ["CR", "Costa Rica"],
73914
+ ["HR", "Croatia"],
73915
+ ["CY", "Cyprus"],
73916
+ ["CZ", "Czech Republic"],
73917
+ ["DK", "Denmark"],
73918
+ ["DM", "Dominica"],
73919
+ ["DO", "Dominican Republic"],
73920
+ ["EC", "Ecuador"],
73921
+ ["SV", "El Salvador"],
73922
+ ["FR", "France"],
73923
+ ["DE", "Germany"],
73924
+ ["GI", "Gibraltar"],
73925
+ ["GR", "Greece"],
73926
+ ["GT", "Guatemala"],
73927
+ ["GG", "Guernsey"],
73928
+ ["GY", "Guyana"],
73929
+ ["HN", "Honduras"],
73930
+ ["HK", "Hong Kong"],
73931
+ ["HU", "Hungary"],
73932
+ ["IS", "Iceland"],
73933
+ ["ID", "Indonesia"],
73934
+ ["IE", "Ireland"],
73935
+ ["IM", "Isle of Man"],
73936
+ ["IT", "Italy"],
73937
+ ["JP", "Japan"],
73938
+ ["JE", "Jersey"],
73939
+ ["LV", "Latvia"],
73940
+ ["LI", "Liechtenstein"],
73941
+ ["LT", "Lithuania"],
73942
+ ["LU", "Luxembourg"],
73943
+ ["MY", "Malaysia"],
73944
+ ["MV", "Maldives"],
73945
+ ["MT", "Malta"],
73946
+ ["MX", "Mexico"],
73947
+ ["MC", "Monaco"],
73948
+ ["NZ", "New Zealand"],
73949
+ ["NG", "Nigeria"],
73950
+ ["NO", "Norway"],
73951
+ ["OM", "Oman"],
73952
+ ["PW", "Palau"],
73953
+ ["PA", "Panama"],
73954
+ ["PY", "Paraguay"],
73955
+ ["PE", "Peru"],
73956
+ ["PH", "Philippines"],
73957
+ ["PL", "Poland"],
73958
+ ["PT", "Portugal"],
73959
+ ["PR", "Puerto Rico"],
73960
+ ["RO", "Romania"],
73961
+ ["SA", "Saudi Arabia"],
73962
+ ["SC", "Seychelles"],
73963
+ ["SG", "Singapore"],
73964
+ ["SK", "Slovakia"],
73965
+ ["SI", "Slovenia"],
73966
+ ["ZA", "South Africa"],
73967
+ ["KR", "South Korea"],
73968
+ ["ES", "Spain"],
73969
+ ["KN", "St. Kitts and Nevis"],
73970
+ ["LC", "St. Lucia"],
73971
+ ["VC", "St. Vincent and the Grenadines"],
73972
+ ["SR", "Suriname"],
73973
+ ["SE", "Sweden"],
73974
+ ["CH", "Switzerland"],
73975
+ ["TW", "Taiwan"],
73976
+ ["TH", "Thailand"],
73977
+ ["TT", "Trinidad & Tobago"],
73978
+ ["TC", "Turks & Caicos Islands"],
73979
+ ["AE", "United Arab Emirates"],
73980
+ ["GB", "United Kingdom"],
73981
+ ["US", "United States"],
73982
+ ["UY", "Uruguay"],
73983
+ ["VU", "Vanuatu"]
73984
+ ];
73985
+ var COUNTRY_ALIASES = {
73986
+ "usa": "US",
73987
+ "u s a": "US",
73988
+ "united states of america": "US",
73989
+ "america": "US",
73990
+ "uk": "GB",
73991
+ "great britain": "GB",
73992
+ "britain": "GB",
73993
+ "england": "GB",
73994
+ "scotland": "GB",
73995
+ "wales": "GB",
73996
+ "northern ireland": "GB",
73997
+ "uae": "AE",
73998
+ "emirates": "AE",
73999
+ "korea": "KR",
74000
+ "republic of korea": "KR",
74001
+ "czechia": "CZ",
74002
+ "bvi": "VG",
74003
+ "antigua and barbuda": "AG",
74004
+ "trinidad and tobago": "TT",
74005
+ "turks and caicos islands": "TC",
74006
+ "turks and caicos": "TC",
74007
+ "saint kitts and nevis": "KN",
74008
+ "saint lucia": "LC",
74009
+ "saint vincent and the grenadines": "VC",
74010
+ "brasil": "BR",
74011
+ "espana": "ES",
74012
+ "deutschland": "DE",
74013
+ "italia": "IT",
74014
+ "schweiz": "CH",
74015
+ "suisse": "CH",
74016
+ "osterreich": "AT",
74017
+ "sverige": "SE",
74018
+ "norge": "NO",
74019
+ "danmark": "DK",
74020
+ "polska": "PL",
74021
+ "republica dominicana": "DO",
74022
+ "the bahamas": "BS"
74023
+ };
74024
+ function fold(s) {
74025
+ return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[.,]/g, " ").replace(/\s+/g, " ").trim();
74026
+ }
74027
+ function countryOf(text) {
74028
+ const t = fold(text);
74029
+ if (!t) return null;
74030
+ const code = t.length === 2 ? t.toUpperCase() : null;
74031
+ const alias = COUNTRY_ALIASES[t] ?? null;
74032
+ return ETHERFI_COUNTRIES.find(([c, n2]) => c === code || c === alias || fold(n2) === t) ?? null;
74033
+ }
73857
74034
  var ETHERFI_UNAVAILABLE_STATES = [
73858
74035
  "AZ",
73859
74036
  "DE",
@@ -73861,6 +74038,8 @@ var ETHERFI_UNAVAILABLE_STATES = [
73861
74038
  "ID",
73862
74039
  "LA",
73863
74040
  "MD",
74041
+ "MS",
74042
+ "MO",
73864
74043
  "MT",
73865
74044
  "NV",
73866
74045
  "NM",
@@ -73869,6 +74048,7 @@ var ETHERFI_UNAVAILABLE_STATES = [
73869
74048
  "OR",
73870
74049
  "RI",
73871
74050
  "SD",
74051
+ "TN",
73872
74052
  "VT",
73873
74053
  "WA",
73874
74054
  "WI"
@@ -73885,27 +74065,37 @@ function stateName(code) {
73885
74065
  function addressLine(raw) {
73886
74066
  return raw.replace(/\s+/g, " ").trim();
73887
74067
  }
73888
- function checkAddressField(field, raw) {
74068
+ function checkAddressField(field, raw, country = "US") {
73889
74069
  const v = addressLine(raw);
73890
74070
  if (v.length > ADDRESS_LINE_MAX) return `Keep it under ${ADDRESS_LINE_MAX} characters.`;
74071
+ if (field === "country") return countryOf(v) ? null : v ? "ether.fi does not offer its card in that country yet." : "Pick the country.";
73891
74072
  if (field === "line1" && !v) return "Add the street address.";
73892
74073
  if (field === "city" && !v) return "Add the city.";
74074
+ const us = country.toUpperCase() === "US";
73893
74075
  if (field === "region") {
74076
+ if (!us) return v ? null : "Add the region.";
73894
74077
  const name = stateName(v);
73895
74078
  if (!name) return "Pick the state.";
73896
74079
  const unavailable = unavailableStateName(v.toUpperCase());
73897
74080
  if (unavailable) return `ether.fi does not offer its card in ${unavailable} yet.`;
73898
74081
  }
73899
- if (field === "zip" && !/^\d{5}(?:-\d{4})?$/.test(v)) return "The ZIP code is five digits.";
74082
+ if (field === "zip") {
74083
+ if (us) return /^\d{5}(?:-\d{4})?$/.test(v) ? null : "The ZIP code is five digits.";
74084
+ if (!v) return "Add the postal code.";
74085
+ if (!/^[A-Za-z0-9][A-Za-z0-9 -]{1,11}$/.test(v)) return "Check the postal code.";
74086
+ }
73900
74087
  return null;
73901
74088
  }
73902
- var FIELDS = ["line1", "line2", "city", "region", "zip"];
74089
+ var FIELDS = ["country", "line1", "line2", "city", "region", "zip"];
73903
74090
  function homeAddressFrom(input) {
74091
+ const place = countryOf(input.country ?? "US");
74092
+ const code = place ? place[0] : "US";
73904
74093
  for (const field of FIELDS) {
73905
- const why = checkAddressField(field, input[field] ?? "");
74094
+ const why = checkAddressField(field, field === "country" ? input.country ?? "US" : input[field] ?? "", code);
73906
74095
  if (why) return { ok: false, field, why };
73907
74096
  }
73908
- const region = addressLine(input.region).toUpperCase();
74097
+ const us = code === "US";
74098
+ const region = us ? addressLine(input.region).toUpperCase() : addressLine(input.region);
73909
74099
  return {
73910
74100
  ok: true,
73911
74101
  address: {
@@ -73915,10 +74105,10 @@ function homeAddressFrom(input) {
73915
74105
  line2: addressLine(input.line2 ?? ""),
73916
74106
  city: addressLine(input.city),
73917
74107
  region,
73918
- regionName: stateName(region) ?? region,
73919
- zip: addressLine(input.zip),
73920
- country: "US",
73921
- countryName: "United States"
74108
+ regionName: us ? stateName(region) ?? region : region,
74109
+ zip: us ? addressLine(input.zip) : addressLine(input.zip).toUpperCase(),
74110
+ country: code,
74111
+ countryName: place ? place[1] : "United States"
73922
74112
  }
73923
74113
  };
73924
74114
  }
@@ -73974,7 +74164,8 @@ function readHomeAddress(body) {
73974
74164
  };
73975
74165
  }
73976
74166
  function addressLines(a) {
73977
- return [a.line1, a.line2, `${a.city}, ${a.region} ${a.zip}`, a.countryName].filter((l) => l.length > 0);
74167
+ const place = a.country === "US" ? `${a.city}, ${a.region} ${a.zip}` : `${a.city}, ${a.regionName} ${a.zip}`;
74168
+ return [a.line1, a.line2, place.trim(), a.countryName].filter((l) => l.length > 0);
73978
74169
  }
73979
74170
  var STATES_LONGEST_FIRST = [...US_STATES].sort((a, b2) => b2[1].length - a[1].length);
73980
74171
  var STREET_WORDS = [
@@ -74038,9 +74229,45 @@ function takeState(rest) {
74038
74229
  if (m && US_STATES.some(([c]) => c === m[2].toUpperCase())) return { code: m[2].toUpperCase(), before: m[1] };
74039
74230
  return null;
74040
74231
  }
74041
- function parseHomeAddress(line2) {
74232
+ var UNIT_ABROAD = /^(?:d[a-z]{0,2}p[a-z]{0,10}|ap[a-z]{0,10}|unit|suite|ste|flat|fl|floor|piso|of[a-z]{0,6}|casa|torre|block|bloque|bl|edif[a-z]{0,6}|#|n[o°º])\.?\s*#?\s*[\w-]+/i;
74233
+ function parseAbroad(parts, country) {
74234
+ const shape = "Write it as street, city, region, postal code.";
74235
+ if (parts.length < 2) return { ok: false, why: shape };
74236
+ const line1 = parts[0];
74237
+ let line2 = "";
74238
+ let at = 1;
74239
+ if (parts.length >= 3 && UNIT_ABROAD.test(parts[1])) {
74240
+ line2 = parts[1];
74241
+ at = 2;
74242
+ }
74243
+ let zip = "";
74244
+ const tail = parts.slice(at).map((part) => {
74245
+ if (zip) return part;
74246
+ const m = /^(\d{4,8})\s+(.+)$/.exec(part) ?? /^(.+?)\s+(\d{4,8})$/.exec(part);
74247
+ if (m) {
74248
+ const digitsFirst = /^\d/.test(m[1]);
74249
+ zip = digitsFirst ? m[1] : m[2];
74250
+ return digitsFirst ? m[2] : m[1];
74251
+ }
74252
+ if (/^\d{4,8}$/.test(part)) {
74253
+ zip = part;
74254
+ return "";
74255
+ }
74256
+ return part;
74257
+ }).filter(Boolean);
74258
+ const city = tail[0] ?? "";
74259
+ if (!city) return { ok: false, why: shape };
74260
+ return { ok: true, input: { country, line1, line2, city, region: tail.length > 1 ? tail[tail.length - 1] : "", zip } };
74261
+ }
74262
+ function parseHomeAddress(line2, country) {
74042
74263
  const shape = "Write it as street, city, state ZIP.";
74043
74264
  let rest = line2.replace(/\s*\n+\s*/g, ", ").replace(/\s+/g, " ").trim();
74265
+ const pieces = rest.split(",").map((p) => p.trim()).filter(Boolean);
74266
+ const last = pieces[pieces.length - 1] ?? "";
74267
+ const named = pieces.length > 1 && fold(last).length > 2 ? countryOf(last) : null;
74268
+ const given = country ? countryOf(country) : null;
74269
+ const abroad = named ? named[0] !== "US" ? named[0] : null : given && given[0] !== "US" ? given[0] : null;
74270
+ if (abroad) return parseAbroad(named ? pieces.slice(0, -1) : pieces, abroad);
74044
74271
  rest = rest.replace(/[,\s]+(?:U\.?S\.?A?\.?|United States(?: of America)?)$/i, "").trim();
74045
74272
  const zip = /[,\s]*(\d{5}(?:-\d{4})?)$/.exec(rest);
74046
74273
  if (!zip) return { ok: false, why: `Add the ZIP code. ${shape}` };
@@ -74070,7 +74297,7 @@ function parseHomeAddress(line2) {
74070
74297
  line22 = unit[2];
74071
74298
  }
74072
74299
  }
74073
- return { ok: true, input: { line1, line2: line22, city, region: state.code, zip: zip[1] } };
74300
+ return { ok: true, input: { country: "US", line1, line2: line22, city, region: state.code, zip: zip[1] } };
74074
74301
  }
74075
74302
 
74076
74303
  // src/commands/card.ts
@@ -74099,15 +74326,16 @@ function fail5(opts, err) {
74099
74326
  var NOT_SEALED = "this account is not sealed yet: `agentgates email seal` first, then save the address";
74100
74327
  function addressInputOf(flags) {
74101
74328
  const line2 = (flags.line ?? "").trim();
74329
+ const country = (flags.country ?? "").trim() || void 0;
74102
74330
  if (line2) {
74103
- const read = parseHomeAddress(line2);
74331
+ const read = parseHomeAddress(line2, country);
74104
74332
  if (!read.ok) throw new MemoryError(read.why, "bad_address");
74105
74333
  return read.input;
74106
74334
  }
74107
- return { line1: flags.line1 ?? "", line2: flags.line2 ?? "", city: flags.city ?? "", region: flags.state ?? "", zip: flags.zip ?? "" };
74335
+ return { country: country ?? "US", line1: flags.line1 ?? "", line2: flags.line2 ?? "", city: flags.city ?? "", region: flags.state ?? "", zip: flags.zip ?? "" };
74108
74336
  }
74109
74337
  function givesAddress(flags) {
74110
- return [flags.line, flags.line1, flags.line2, flags.city, flags.state, flags.zip].some((v) => typeof v === "string" && v.trim() !== "");
74338
+ return [flags.line, flags.line1, flags.line2, flags.city, flags.state, flags.zip, flags.country].some((v) => typeof v === "string" && v.trim() !== "");
74111
74339
  }
74112
74340
  function checkedAddress(input) {
74113
74341
  const built = homeAddressFrom(input);
@@ -74137,30 +74365,42 @@ async function readHomeAddressHere(wallet) {
74137
74365
  return read.ok ? { ...base, address: read.address, note: null } : { ...base, address: null, note: `the saved address does not read: ${read.why}` };
74138
74366
  }
74139
74367
  var QUESTIONS = [
74368
+ { field: "country", ask: "Country (enter for the United States)" },
74140
74369
  { field: "line1", ask: "Street address" },
74141
74370
  { field: "line2", ask: "Apartment, suite or unit", optional: true },
74142
74371
  { field: "city", ask: "City" },
74143
- { field: "region", ask: "State (two letters)" },
74144
- { field: "zip", ask: "ZIP code" }
74372
+ { field: "region", ask: "State (two letters)", abroad: "Region" },
74373
+ { field: "zip", ask: "ZIP code", abroad: "Postal code" }
74145
74374
  ];
74146
74375
  async function askAddress() {
74147
74376
  const rl = createInterface3({ input: process.stdin, output: process.stdout });
74148
- const answers = { line1: "", line2: "", city: "", region: "", zip: "" };
74377
+ const answers = { country: "US", line1: "", line2: "", city: "", region: "", zip: "" };
74149
74378
  try {
74150
74379
  process.stdout.write(`
74151
74380
  ${import_picocolors15.default.bold("Your home address")} ${import_picocolors15.default.dim("\xB7 ether.fi asks it before the card; sealed on this machine")}
74152
74381
 
74153
74382
  `);
74154
74383
  for (const q of QUESTIONS) {
74384
+ const us = (countryOf(answers.country ?? "US")?.[0] ?? "US") === "US";
74155
74385
  for (; ; ) {
74156
74386
  let raw;
74157
74387
  try {
74158
- raw = await rl.question(` ${q.ask}${q.optional ? import_picocolors15.default.dim(" (enter to skip)") : ""}: `);
74388
+ raw = await rl.question(` ${!us && q.abroad ? q.abroad : q.ask}${q.optional ? import_picocolors15.default.dim(" (enter to skip)") : ""}: `);
74159
74389
  } catch {
74160
74390
  return null;
74161
74391
  }
74162
- const value = q.field === "region" ? raw.trim().toUpperCase() : raw;
74163
- const why = checkAddressField(q.field, value);
74392
+ if (q.field === "country") {
74393
+ const hit = countryOf(raw.trim() || "US");
74394
+ if (!hit) {
74395
+ process.stdout.write(` ${import_picocolors15.default.yellow(checkAddressField("country", raw))}
74396
+ `);
74397
+ continue;
74398
+ }
74399
+ answers.country = hit[0];
74400
+ break;
74401
+ }
74402
+ const value = q.field === "region" && us ? raw.trim().toUpperCase() : raw;
74403
+ const why = checkAddressField(q.field, value, answers.country ?? "US");
74164
74404
  if (why) {
74165
74405
  process.stdout.write(` ${import_picocolors15.default.yellow(why)}
74166
74406
  `);
@@ -74201,7 +74441,7 @@ async function cardAddressSet(opts) {
74201
74441
  return;
74202
74442
  }
74203
74443
  } else {
74204
- throw new MemoryError('give the address: --line "1 Main St Apt 4, San Francisco, CA 94110", or --line1 --city --state --zip (--line2 optional)', "no_address");
74444
+ throw new MemoryError('give the address: --line "1 Main St Apt 4, San Francisco, CA 94110", or --line1 --city --state --zip (--line2 optional); outside the United States add --country (Chile, CL) with --state for the region and --zip for the postal code', "no_address");
74205
74445
  }
74206
74446
  const address = checkedAddress(input);
74207
74447
  const { wallet } = await requirePasswordsKey();
@@ -74563,6 +74803,7 @@ function mcpTools() {
74563
74803
  steps: { type: "array", description: "steps at the site after the sign-in (the lane's steps shape), for the login use" },
74564
74804
  codeSteps: { type: "array", description: "steps to the page where the site's code is typed, for the login use" },
74565
74805
  mailbox: { type: "string", description: "the mailbox row the sign-in code is read from, when the account has several" },
74806
+ solve: { type: "boolean", description: "login and session, the owner's own key: the VM passes a bot check it meets (Cloudflare, Turnstile, reCAPTCHA, hCaptcha). Under another owner's permit the use parks as check_pending and the owner answers on their board" },
74566
74807
  useId: { type: "string", description: "continue a parked use" },
74567
74808
  waitSeconds: { type: "integer", minimum: 0, maximum: WAIT_MAX_S, description: `how long to wait on a parked use or a starting VM (default ${WAIT_DEFAULT_S}; 0 returns the first answer)` }
74568
74809
  },
@@ -74588,7 +74829,8 @@ function mcpTools() {
74588
74829
  if (use !== "totp" && use !== "reveal" && !url) throw new McpToolError("url is the https URL the use targets");
74589
74830
  const rowId = str(args, "row") ?? await rowForUrl(wallet, url);
74590
74831
  const useId = str(args, "useId");
74591
- const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...useId ? { useId } : {} };
74832
+ if (args.solve === true && use !== "login" && use !== "session") throw new McpToolError("solve goes with the login or session use");
74833
+ const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...useId ? { useId } : {}, ...args.solve === true ? { solve: true } : {} };
74592
74834
  const waitSeconds = int(args, "waitSeconds", WAIT_DEFAULT_S, 0, WAIT_MAX_S);
74593
74835
  const answer = await postUseAndWait(wallet, rowId, firstBody, { waitSeconds, noWait: waitSeconds === 0, note });
74594
74836
  const body = answer.body ?? {};
@@ -74835,23 +75077,24 @@ function mcpTools() {
74835
75077
  // instead of inside the CVM. The street never comes back through here.
74836
75078
  {
74837
75079
  name: "card_address_set",
74838
- description: "Save the person's home address for their Agentgates card (ether.fi asks it before the card). Only the address the person gave you, never one you guessed: it is checked against their ID. Pass it as one `line` (\"1 Main St Apt 4, San Francisco, CA 94110\") or as `line1`, `line2`, `city`, `state` (two letters) and `zip`. The United States only. It is sealed on this machine to the account's own data key and stored as ciphertext; a second save replaces the first. Free.",
75080
+ description: "Save the person's home address for their Agentgates card (ether.fi asks it before the card). Only the address the person gave you, never one you guessed: it is checked against their ID. Pass it as one `line` (\"1 Main St Apt 4, San Francisco, CA 94110\") or as `line1`, `line2`, `city`, `state` (two letters) and `zip`. Any country ether.fi issues the card in: give `country` (Chile, CL; the United States when left out), and abroad `state` is the region as written and `zip` the postal code. It is sealed on this machine to the account's own data key and stored as ciphertext; a second save replaces the first. Free.",
74839
75081
  inputSchema: {
74840
75082
  type: "object",
74841
75083
  properties: {
74842
- line: { type: "string", description: "The whole address on one line: street, city, state ZIP." },
75084
+ country: { type: "string", description: "The country, by name or two letters (the United States when left out)." },
75085
+ line: { type: "string", description: "The whole address on one line: street, city, state ZIP (abroad: street, city, region, postal code)." },
74843
75086
  line1: { type: "string", description: "Street address." },
74844
75087
  line2: { type: "string", description: "Apartment, suite or unit (optional)." },
74845
75088
  city: { type: "string", description: "City." },
74846
- state: { type: "string", description: "The state's two letters (CA)." },
74847
- zip: { type: "string", description: "ZIP code, five digits." }
75089
+ state: { type: "string", description: "The state's two letters (CA); abroad, the region as written." },
75090
+ zip: { type: "string", description: "ZIP code, five digits; abroad, the postal code." }
74848
75091
  },
74849
75092
  additionalProperties: false
74850
75093
  },
74851
75094
  handler: async (args) => {
74852
75095
  let address;
74853
75096
  try {
74854
- address = checkedAddress(addressInputOf({ line: str(args, "line"), line1: str(args, "line1"), line2: str(args, "line2"), city: str(args, "city"), state: str(args, "state"), zip: str(args, "zip") }));
75097
+ address = checkedAddress(addressInputOf({ country: str(args, "country"), line: str(args, "line"), line1: str(args, "line1"), line2: str(args, "line2"), city: str(args, "city"), state: str(args, "state"), zip: str(args, "zip") }));
74855
75098
  } catch (err) {
74856
75099
  throw new McpToolError(err instanceof Error ? err.message : String(err));
74857
75100
  }
@@ -81364,10 +81607,13 @@ passwords.command("add").alias("store").description("Store a login: sealed on th
81364
81607
  passwords.command("allow").description("Sign a permit: which agent may use which rows on which sites, how many times a day, until when. Default: yourself, every row, every use, 30 days.").option("--agent <address>", "the key that will sign uses (default: this key)").option("--rows <id,id|*>", "row ids, or * for every row this key holds (default *)").option("--hosts <a,b>", "narrow to these hostnames (default: the rows' own)").option("--uses <login,totp,header>", "which uses (default all three)").option("--gets <session|password>", "what the agent gets: session = the site's cookies after the CVM logs in (default); password = the secret itself; cvm = the acting uses alone, for an agent that works inside the CVM over the API").option("--per-day <n>", "hard daily cap; 0 = the plan allowance (default 0)").option("--days <n>", "how long, 1 to 366 (default 30)").option("--ask-me", "every use waits for the owner's signature on their board (the brake)").option("--factors <device,codes,mail,sms>", "the account's sign-in verification step the agent may complete: device = the stored device credential answers the site's device step; codes = one of the stored backup codes is spent; mail = a code the site emails is read from your mailbox row or an inbox this key holds (allow the mailbox row too); sms = a code the site texts is read from a number this key holds").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81365
81608
  await passwordsAllow(opts);
81366
81609
  });
81367
- passwords.command("use").description("Log in through the CVM with a stored login and get the page's digest back, never the password. Pass --row, or just --url and the matching row is picked. A parked use (the owner has to approve, or type a code) is waited on until it answers.").option("--row <id>", "the row to use (default: the one whose hosts cover --url)").option("--url <https://site/login>", "the page the use targets").option("--use <login|header|totp|session|reveal>", "which use (default login); session hands this key the site's cookies, reveal the secret, when the permit says so").option("--cookies-out <file>", "session only: write the cookies to this file (Playwright addCookies / Puppeteer setCookie shape)").option("--steps-json <json>", "login only: steps the CVM runs inside the session after the login lands (goto, fill, click, wait, read; a click may name the control's text instead of a selector)").option("--code-steps-json <json>", "login only: the clicks that reach a code field the site keeps behind a 'try another way' menu (at most 4, click and wait), run before the code is typed").option("--enroll-device", "login only, your own key: provision a device credential for the account on this sign-in (the steps reach the page where the account adds a device); agentgates passwords device does this and seals it into the row").option("--attend", "login only, your own key: the CVM fills the password and holds the page for you at the controls (finish it on your board's live view); prints the use id and the view token").option("--use-id <id>", "continue a parked use by its id (Done on an attended sign-in, or a use the owner answered)").option("--mailbox <row>", "login and session: the mailbox row the box reads an emailed sign-in code from (default: your one mailbox row, when the permit covers it and lists mail)").option("--request-json <json>", "the whole request object for header and totp uses (spec \xA75.1)").option("--wait <seconds>", "cap on how long to wait for the owner's answer (default: the owner's window)").option("--no-wait", "answer the parked use's id and return at once").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts, command) => {
81610
+ passwords.command("use").description("Log in through the CVM with a stored login and get the page's digest back, never the password. Pass --row, or just --url and the matching row is picked. A parked use (the owner has to approve, or type a code) is waited on until it answers.").option("--row <id>", "the row to use (default: the one whose hosts cover --url)").option("--url <https://site/login>", "the page the use targets").option("--use <login|header|totp|session|reveal>", "which use (default login); session hands this key the site's cookies, reveal the secret, when the permit says so").option("--cookies-out <file>", "session only: write the cookies to this file (Playwright addCookies / Puppeteer setCookie shape)").option("--steps-json <json>", "login only: steps the CVM runs inside the session after the login lands (goto, fill, click, wait, read; a click may name the control's text instead of a selector)").option("--code-steps-json <json>", "login only: the clicks that reach a code field the site keeps behind a 'try another way' menu (at most 4, click and wait), run before the code is typed").option("--enroll-device", "login only, your own key: provision a device credential for the account on this sign-in (the steps reach the page where the account adds a device); agentgates passwords device does this and seals it into the row").option("--attend", "login only, your own key: the CVM fills the password and holds the page for you at the controls (finish it on your board's live view); prints the use id and the view token").option("--use-id <id>", "continue a parked use by its id (Done on an attended sign-in, or a use the owner answered)").option("--mailbox <row>", "login and session: the mailbox row the box reads an emailed sign-in code from (default: your one mailbox row, when the permit covers it and lists mail)").option("--solve", "login and session, your own key: the CVM passes a bot check it meets (Cloudflare, Turnstile, reCAPTCHA, hCaptcha) by ticking it, then through its solver service").option("--request-json <json>", "the whole request object for header and totp uses (spec \xA75.1)").option("--wait <seconds>", "cap on how long to wait for the owner's answer (default: the owner's window)").option("--no-wait", "answer the parked use's id and return at once").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts, command) => {
81368
81611
  const waitSource = command.getOptionValueSource("wait");
81369
81612
  await passwordsUse({ ...opts, noWait: waitSource === "cli" && opts.wait === false, wait: typeof opts.wait === "string" ? opts.wait : void 0 });
81370
81613
  });
81614
+ passwords.command("checks [word]").description("Bot checks (Cloudflare, Turnstile, reCAPTCHA, hCaptcha): ask = an agent's use that meets one waits for your answer on the board (default); solve = the CVM passes every one it can without asking. No word prints the current one.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (word, opts) => {
81615
+ await passwordsChecks(word, opts);
81616
+ });
81371
81617
  passwords.command("code").description("Fetch a verification code one of the account's own contacts received, for an account the owner is registering or signing into elsewhere: the newest message from a site in your mailbox row (an app password, or a Gmail login you connected on your board; the permit lists mail), or the newest code that reached an inbox or a number this key holds, read through its own door (a sealed inbox is opened with your own key). One source: --mailbox, --inbox or --phone.").option("--from <domain>", "the site the code comes from, e.g. etsy.com (a mailbox row reads that sender)").option("--mailbox <row>", "the mailbox row (default: your one mailbox row, or your one Gmail login)").option("--inbox <id>", "an inbox this key holds (agentgates passwords inbox list): the newest code that reached it").option("--phone <id>", "a number this key holds (agentgates phone list): the newest code texted to it").option("--timeout <seconds>", "--inbox and --phone: how long the door waits for a code (default 60)").option("--since <minutes>", "how far back to look (default 10)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81372
81618
  await passwordsCode(opts);
81373
81619
  });
@@ -81550,7 +81796,7 @@ memory.command("about").description("About you: what you tell every agent up fro
81550
81796
  });
81551
81797
  var card = program2.command("card").description("Your Agentgates card: the home address ether.fi asks before it, sealed on this machine.");
81552
81798
  var cardAddress = card.command("address").description("The home address the card is made with. Sealed on this machine to the account's data key; the wire and the server carry ciphertext only.");
81553
- cardAddress.command("set").description("Save it, or replace it: one --line, or --line1 --line2 --city --state --zip; with neither, a few questions. The United States only. Only the person's real address: ether.fi checks it against their ID.").option("--line <address>", "the whole address on one line: street, city, state ZIP").option("--line1 <street>", "street address").option("--line2 <unit>", "apartment, suite or unit (optional)").option("--city <city>", "city").option("--state <XX>", "the state's two letters").option("--zip <zip>", "ZIP code").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81799
+ cardAddress.command("set").description("Save it, or replace it: one --line, or --line1 --line2 --city --state --zip; with neither, a few questions. Any country ether.fi issues the card in (--country, the United States when left out). Only the person's real address: ether.fi checks it against their ID.").option("--country <country>", "the country, by name or two letters (Chile, CL); the United States when left out").option("--line <address>", "the whole address on one line: street, city, state ZIP (abroad: street, city, region, postal code)").option("--line1 <street>", "street address").option("--line2 <unit>", "apartment, suite or unit (optional)").option("--city <city>", "city").option("--state <XX>", "the state's two letters (abroad: the region, as written)").option("--zip <zip>", "ZIP code (abroad: the postal code)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81554
81800
  await cardAddressSet(opts);
81555
81801
  });
81556
81802
  cardAddress.command("show").description("Print the saved address, opened on this machine with the account's data key (the words, or a key's own copy).").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.65.1",
3
+ "version": "0.67.0",
4
4
  "description": "Wallet operations for AI agents and humans",
5
5
  "keywords": [
6
6
  "crypto",