@agentgates/cli 0.44.0 → 0.46.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 +577 -493
  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.44.0";
3131
+ CLI_VERSION = "0.46.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
  }
@@ -31634,6 +31634,7 @@ __export(passwords_wire_exports, {
31634
31634
  PASSWORDS_USE_PINNED_BY_BOX: () => PASSWORDS_USE_PINNED_BY_BOX,
31635
31635
  WireError: () => WireError,
31636
31636
  createLoginKey: () => createLoginKey,
31637
+ currentKeyParts: () => currentKeyParts,
31637
31638
  currentLoginKey: () => currentLoginKey,
31638
31639
  deleteRow: () => deleteRow,
31639
31640
  expectOk: () => expectOk,
@@ -31648,6 +31649,7 @@ __export(passwords_wire_exports, {
31648
31649
  ownerAuthHeader: () => ownerAuthHeader,
31649
31650
  postPermit: () => postPermit,
31650
31651
  postUse: () => postUse,
31652
+ putKeyWrap: () => putKeyWrap,
31651
31653
  readAttestation: () => readAttestation,
31652
31654
  revealRow: () => revealRow,
31653
31655
  revokeLoginKey: () => revokeLoginKey,
@@ -31687,11 +31689,15 @@ ${timestamp}`);
31687
31689
  }
31688
31690
  function setLoginKey(key, opts = {}) {
31689
31691
  loginKey = key;
31692
+ loginReading = key ? opts.reading ?? null : null;
31690
31693
  keyOnly = !!key && opts.keyOnly === true;
31691
31694
  }
31692
31695
  function currentLoginKey() {
31693
31696
  return loginKey;
31694
31697
  }
31698
+ function currentKeyParts() {
31699
+ return loginKey ? { wire: loginKey, reading: loginReading } : null;
31700
+ }
31695
31701
  function runsOnKeyOnly() {
31696
31702
  return keyOnly;
31697
31703
  }
@@ -31748,6 +31754,7 @@ async function signedFetch(wallet, method, path8, body, timeoutMs = 13e4) {
31748
31754
  const signed2 = await once(false);
31749
31755
  if (signed2.status < 400) {
31750
31756
  loginKey = null;
31757
+ loginReading = null;
31751
31758
  revokedNoticed = true;
31752
31759
  if (revokedHook) await revokedHook().catch(() => void 0);
31753
31760
  process.stderr.write("\n ! your login key was revoked: this call was signed with the words and the key was dropped. agentgates keys create --keep \xB7 mints a new one\n\n");
@@ -31764,6 +31771,10 @@ async function createLoginKey(wallet, name) {
31764
31771
  const answer = await signedFetch(wallet, "POST", lanePath(`/keys`), { name });
31765
31772
  return expectOk(answer, "login key mint");
31766
31773
  }
31774
+ async function putKeyWrap(wallet, keyId, body) {
31775
+ const answer = await signedFetch(wallet, "POST", lanePath(`/keys/${encodeURIComponent(keyId)}/wrap`), body);
31776
+ expectOk(answer, "the key's copy of the data key");
31777
+ }
31767
31778
  async function revokeLoginKey(wallet, id2) {
31768
31779
  const answer = await signedFetch(wallet, "POST", lanePath(`/keys`), { revoke: id2 });
31769
31780
  return expectOk(answer, "login key revoke");
@@ -31832,7 +31843,7 @@ async function withdrawInvite(wallet, envelope, signature) {
31832
31843
  "withdraw"
31833
31844
  );
31834
31845
  }
31835
- var trim2, ACCOUNT_HEADS, SERVICE_HEADS, PASSWORDS_USE_PINNED_BY_BOX, WireError, loginKey, revokedHook, lastVia, revokedNoticed, keyOnly, SIGNED_DOORS;
31846
+ var trim2, ACCOUNT_HEADS, SERVICE_HEADS, PASSWORDS_USE_PINNED_BY_BOX, WireError, loginKey, revokedHook, lastVia, revokedNoticed, keyOnly, loginReading, SIGNED_DOORS;
31836
31847
  var init_passwords_wire = __esm({
31837
31848
  "src/lib/passwords-wire.ts"() {
31838
31849
  "use strict";
@@ -31858,6 +31869,7 @@ var init_passwords_wire = __esm({
31858
31869
  lastVia = null;
31859
31870
  revokedNoticed = false;
31860
31871
  keyOnly = false;
31872
+ loginReading = null;
31861
31873
  SIGNED_DOORS = /\/keys(\/(?!me\/)|$)|\/passwords\/[A-Za-z0-9_-]{1,64}\/use$|\/seal-key$/;
31862
31874
  }
31863
31875
  });
@@ -31867,7 +31879,7 @@ var require_package = __commonJS({
31867
31879
  "package.json"(exports, module) {
31868
31880
  module.exports = {
31869
31881
  name: "@agentgates/cli",
31870
- version: "0.44.0",
31882
+ version: "0.46.0",
31871
31883
  description: "Wallet operations for AI agents and humans",
31872
31884
  keywords: [
31873
31885
  "crypto",
@@ -63843,7 +63855,7 @@ function shortAddress(addr) {
63843
63855
  }
63844
63856
 
63845
63857
  // src/commands/onboard.ts
63846
- var import_picocolors11 = __toESM(require_picocolors(), 1);
63858
+ var import_picocolors12 = __toESM(require_picocolors(), 1);
63847
63859
  import { createInterface } from "node:readline/promises";
63848
63860
  init_constants();
63849
63861
 
@@ -64046,7 +64058,7 @@ function passwordsKeyPath() {
64046
64058
  }
64047
64059
  function keysOf(state) {
64048
64060
  if (state.keyOnly) {
64049
- if (typeof state.apiKey !== "string") throw new Error(`${passwordsKeyPath()} is a key-only file with no key; run agentgates keys use <agk_\u2026> again.`);
64061
+ if (typeof state.apiKey !== "string") throw new Error(`${passwordsKeyPath()} is a key-only file with no key; run agentgates login <key> again.`);
64050
64062
  return { state, wallet: standInWallet() };
64051
64063
  }
64052
64064
  if (typeof state.privateKey !== "string") throw new Error(`${passwordsKeyPath()} is corrupt: no secret in it.`);
@@ -64075,7 +64087,10 @@ async function loadPasswordsKey() {
64075
64087
  if (state.family !== "evm" || typeof state.privateKey !== "string" && !(state.keyOnly && typeof state.apiKey === "string")) {
64076
64088
  throw new Error(`${passwordsKeyPath()} is not a passwords key file; move it aside and run init again.`);
64077
64089
  }
64078
- setLoginKey(typeof state.apiKey === "string" ? state.apiKey : null, { keyOnly: state.keyOnly === true });
64090
+ setLoginKey(typeof state.apiKey === "string" ? state.apiKey : null, {
64091
+ keyOnly: state.keyOnly === true,
64092
+ reading: typeof state.apiKeyReading === "string" ? state.apiKeyReading : null
64093
+ });
64079
64094
  onLoginKeyRevoked(async () => {
64080
64095
  await forgetLoginKey(state);
64081
64096
  });
@@ -64085,8 +64100,10 @@ async function saveLoginKey(state, key) {
64085
64100
  state.apiKey = key.secret;
64086
64101
  state.apiKeyPrefix = key.prefix;
64087
64102
  state.apiKeyName = key.name;
64103
+ if (key.reading) state.apiKeyReading = key.reading;
64104
+ else delete state.apiKeyReading;
64088
64105
  await writeKey(state);
64089
- setLoginKey(key.secret);
64106
+ setLoginKey(key.secret, { reading: key.reading ?? null });
64090
64107
  }
64091
64108
  async function useLoginKey(key) {
64092
64109
  const existing = await loadPasswordsKey();
@@ -64100,21 +64117,23 @@ async function useLoginKey(key) {
64100
64117
  return { state: existing.state, mode: "beside-the-words" };
64101
64118
  }
64102
64119
  const state = {
64103
- version: 4,
64120
+ version: 5,
64104
64121
  family: "evm",
64105
64122
  keyOnly: true,
64106
64123
  address: key.ownerWallet,
64107
64124
  apiKey: key.secret,
64125
+ ...key.reading ? { apiKeyReading: key.reading } : {},
64108
64126
  apiKeyPrefix: key.prefix,
64109
64127
  apiKeyName: key.name,
64110
64128
  createdAt: existing?.state.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
64111
64129
  };
64112
64130
  await writeKey(state);
64113
- setLoginKey(key.secret, { keyOnly: true });
64131
+ setLoginKey(key.secret, { keyOnly: true, reading: key.reading ?? null });
64114
64132
  return { state, mode: "key-only" };
64115
64133
  }
64116
64134
  async function forgetLoginKey(state) {
64117
64135
  delete state.apiKey;
64136
+ delete state.apiKeyReading;
64118
64137
  delete state.apiKeyPrefix;
64119
64138
  delete state.apiKeyName;
64120
64139
  await writeKey(state);
@@ -64200,7 +64219,7 @@ async function requirePasswordsKey() {
64200
64219
  const fromEnv = (process.env.AGENTGATES_PASSWORDS_SEED || "").trim();
64201
64220
  if (fromEnv) return keysOf(stateOf(normaliseSeed(fromEnv, "AGENTGATES_PASSWORDS_SEED")));
64202
64221
  const existing = await loadPasswordsKey();
64203
- if (!existing) throw new Error("no account on this machine yet: run `agentgates init` first, set AGENTGATES_PASSWORDS_SEED to twelve words, or run on a key with `agentgates keys use <agk_\u2026>`.");
64222
+ if (!existing) throw new Error("no account on this machine yet: run `agentgates init` first, set AGENTGATES_PASSWORDS_SEED to twelve words, or run on a key with `agentgates login <key>`.");
64204
64223
  return existing;
64205
64224
  }
64206
64225
 
@@ -68047,8 +68066,12 @@ init_passwords_wire();
68047
68066
  // src/lib/key-seal.ts
68048
68067
  var KEY_SEAL_SUITE = "AGENTGATES-KEY-SEAL-X25519-HKDF-SHA256-v1";
68049
68068
  var INFO_KEY_SEALING = `${KEY_SEAL_SUITE}/sealing-key`;
68069
+ var INFO_KEY_SEALING_V2 = `${KEY_SEAL_SUITE}/sealing-key/v2`;
68050
68070
  var KEY_SEAL_BYTES = 32;
68051
- var KEY_SECRET_SHAPE = /^ag[kv]_[0-9a-f]{64}$/;
68071
+ var KEY_PART_SEPARATOR = ".";
68072
+ var KEY_WIRE_SHAPE = /^ag[kv]_[0-9a-f]{64}$/;
68073
+ var KEY_READING_SHAPE = /^[0-9a-f]{64}$/;
68074
+ var KEY_SECRET_SHAPE = /^ag[kv]_[0-9a-f]{64}(\.[0-9a-f]{64})?$/;
68052
68075
  var KeySealError = class extends Error {
68053
68076
  code;
68054
68077
  constructor(code, message) {
@@ -68063,12 +68086,37 @@ function toB64u2(bytes2) {
68063
68086
  for (let i = 0; i < bytes2.length; i++) binary += String.fromCharCode(bytes2[i]);
68064
68087
  return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
68065
68088
  }
68066
- function keySealingKeyFromSecret(apiKey) {
68089
+ function splitApiKey(apiKey) {
68067
68090
  const secret = (apiKey || "").trim();
68068
68091
  if (!KEY_SECRET_SHAPE.test(secret)) {
68092
+ throw new KeySealError("bad_key", "That is not a key of this lane (agk_ or agv_, 64 hex characters, then a dot and 64 more on a key minted since 2026-09-19).");
68093
+ }
68094
+ const cut = secret.indexOf(KEY_PART_SEPARATOR);
68095
+ if (cut < 0) return { wire: secret, reading: null };
68096
+ return { wire: secret.slice(0, cut), reading: secret.slice(cut + 1) };
68097
+ }
68098
+ function joinApiKey(wire, reading) {
68099
+ return reading ? `${wire}${KEY_PART_SEPARATOR}${reading}` : wire;
68100
+ }
68101
+ function newReadingPart() {
68102
+ const bytes2 = new Uint8Array(32);
68103
+ globalThis.crypto.getRandomValues(bytes2);
68104
+ let hex2 = "";
68105
+ for (let i = 0; i < bytes2.length; i++) hex2 += bytes2[i].toString(16).padStart(2, "0");
68106
+ return hex2;
68107
+ }
68108
+ function keySealingKeyFromParts(parts) {
68109
+ const wire = (parts.wire || "").trim();
68110
+ const reading = parts.reading === null || parts.reading === void 0 ? null : parts.reading.trim();
68111
+ if (!KEY_WIRE_SHAPE.test(wire)) {
68069
68112
  throw new KeySealError("bad_key", "That is not a key of this lane (agk_ or agv_ followed by 64 hex characters).");
68070
68113
  }
68071
- const seed = hkdf(sha2564, enc2.encode(secret), enc2.encode(KEY_SEAL_SUITE), enc2.encode(INFO_KEY_SEALING), KEY_SEAL_BYTES);
68114
+ if (reading !== null && !KEY_READING_SHAPE.test(reading)) {
68115
+ throw new KeySealError("bad_key", "That key's reading part is not 64 hex characters.");
68116
+ }
68117
+ const ikm = reading === null ? wire : reading;
68118
+ const info = reading === null ? INFO_KEY_SEALING : INFO_KEY_SEALING_V2;
68119
+ const seed = hkdf(sha2564, enc2.encode(ikm), enc2.encode(KEY_SEAL_SUITE), enc2.encode(info), KEY_SEAL_BYTES);
68072
68120
  return { secret: seed, publicKey: toB64u2(x25519.getPublicKey(seed)) };
68073
68121
  }
68074
68122
  function keyWrapAad(ownerWallet, keyId) {
@@ -68091,8 +68139,8 @@ async function registerSealKey(wallet) {
68091
68139
  return out.seal;
68092
68140
  }
68093
68141
  async function mailKeyFromLoginKey() {
68094
- const secret = currentLoginKey();
68095
- if (!secret) return null;
68142
+ const parts = currentKeyParts();
68143
+ if (!parts) return null;
68096
68144
  const hit = held.get("key");
68097
68145
  if (hit) return hit;
68098
68146
  const answer = await signedFetch(
@@ -68103,7 +68151,7 @@ async function mailKeyFromLoginKey() {
68103
68151
  if (answer.status === 404) return null;
68104
68152
  const out = expectOk(answer, "the key's copy of the data key");
68105
68153
  if (!out.keyId || !out.ownerWallet || !out.wrap || !out.dataPublicKey) throw new Error("the key's wrap door answered an unexpected shape");
68106
- const pair = keySealingKeyFromSecret(secret);
68154
+ const pair = keySealingKeyFromParts(parts);
68107
68155
  const dataKey = openSealed(pair.secret, out.wrap, keyWrapAad(out.ownerWallet, out.keyId));
68108
68156
  if (publicKeyOf(dataKey) !== out.dataPublicKey) {
68109
68157
  throw new Error("the copy this key holds does not match the key the account's mail was sealed to; nothing was opened");
@@ -69211,12 +69259,167 @@ ${m.text}
69211
69259
  }
69212
69260
 
69213
69261
  // src/commands/passwords.ts
69214
- var import_picocolors8 = __toESM(require_picocolors(), 1);
69262
+ var import_picocolors9 = __toESM(require_picocolors(), 1);
69215
69263
  import { readFileSync, writeFileSync as writeFileSync2 } from "node:fs";
69216
69264
  import { randomBytes as randomBytes8 } from "node:crypto";
69217
69265
 
69218
69266
  // src/commands/session.ts
69267
+ var import_picocolors8 = __toESM(require_picocolors(), 1);
69268
+ import { hostname as hostname2 } from "node:os";
69269
+
69270
+ // src/commands/keys.ts
69219
69271
  var import_picocolors7 = __toESM(require_picocolors(), 1);
69272
+ import { hostname } from "node:os";
69273
+ init_passwords_wire();
69274
+ function emit3(opts, data4, human) {
69275
+ if (opts.json || !process.stdout.isTTY) {
69276
+ process.stdout.write(`${JSON.stringify(data4)}
69277
+ `);
69278
+ return;
69279
+ }
69280
+ human();
69281
+ }
69282
+ function fail(opts, err) {
69283
+ const message = err instanceof Error ? err.message : String(err);
69284
+ const code = err?.code;
69285
+ if (opts.json || !process.stdout.isTTY) {
69286
+ process.stdout.write(`${JSON.stringify({ ok: false, error: message, ...typeof code === "string" ? { code } : {} })}
69287
+ `);
69288
+ } else {
69289
+ process.stderr.write(`
69290
+ ${import_picocolors7.default.red("\u2717")} ${message}
69291
+
69292
+ `);
69293
+ }
69294
+ process.exit(1);
69295
+ }
69296
+ function whenLabel(iso) {
69297
+ if (!iso) return "never";
69298
+ const d = new Date(iso);
69299
+ return Number.isNaN(d.getTime()) ? "" : d.toISOString().slice(0, 16).replace("T", " ");
69300
+ }
69301
+ function printRows(rows, mine) {
69302
+ if (rows.length === 0) {
69303
+ process.stdout.write(`
69304
+ ${import_picocolors7.default.dim("no login keys on this account yet")}
69305
+ ${import_picocolors7.default.dim("agentgates keys create --keep \xB7 mints one for this machine")}
69306
+
69307
+ `);
69308
+ return;
69309
+ }
69310
+ process.stdout.write("\n");
69311
+ for (const r of rows) {
69312
+ const here = mine && r.prefix === mine ? import_picocolors7.default.green(" this machine") : "";
69313
+ process.stdout.write(` ${import_picocolors7.default.bold(r.prefix)} ${r.name} ${import_picocolors7.default.dim(`used ${whenLabel(r.lastUsedAt)}`)} ${import_picocolors7.default.dim(r.id)}${here}
69314
+ `);
69315
+ }
69316
+ process.stdout.write("\n");
69317
+ }
69318
+ async function keysList(opts) {
69319
+ try {
69320
+ const keys2 = await requirePasswordsKey();
69321
+ const rows = await listLoginKeys(keys2.wallet);
69322
+ emit3(opts, { ok: true, address: keys2.state.address, keys: rows, thisMachine: keys2.state.apiKeyPrefix ?? null }, () => printRows(rows, keys2.state.apiKeyPrefix ?? null));
69323
+ } catch (err) {
69324
+ fail(opts, err);
69325
+ }
69326
+ }
69327
+ async function keysCreate(opts) {
69328
+ try {
69329
+ const keys2 = await requirePasswordsKey();
69330
+ const name = (opts.name?.trim() || `cli ${hostname()}`).slice(0, 64);
69331
+ const made = await createLoginKey(keys2.wallet, name);
69332
+ const reading = newReadingPart();
69333
+ const full = joinApiKey(made.key, reading);
69334
+ let sealed = false;
69335
+ let why = null;
69336
+ try {
69337
+ const account = await mailKeyFor(keys2.wallet);
69338
+ if (account) {
69339
+ const pair = keySealingKeyFromParts({ wire: made.key, reading });
69340
+ await putKeyWrap(keys2.wallet, made.created.id, {
69341
+ sealingPublicKey: pair.publicKey,
69342
+ wrap: sealTo(pair.publicKey, account.dataKey, keyWrapAad(keys2.state.address, made.created.id))
69343
+ });
69344
+ sealed = true;
69345
+ } else {
69346
+ why = "this account seals nothing yet";
69347
+ }
69348
+ } catch (err) {
69349
+ why = err instanceof Error ? err.message : "the copy could not be made";
69350
+ }
69351
+ if (opts.keep) await saveLoginKey(keys2.state, { secret: made.key, prefix: made.created.prefix, name: made.created.name, reading });
69352
+ emit3(opts, { ok: true, key: full, wire: made.key, created: made.created, kept: opts.keep === true, sealed, why }, () => {
69353
+ process.stdout.write(
69354
+ `
69355
+ ${import_picocolors7.default.green("\u2713")} login key minted: ${import_picocolors7.default.bold(made.created.name)}
69356
+
69357
+ ${full}
69358
+
69359
+ ${import_picocolors7.default.dim("Shown once. On a header send the part BEFORE the dot: Authorization: Bearer <that part>.")}
69360
+ ${import_picocolors7.default.dim("The part after it opens this account's sealed calls and mail and never goes on the wire; agentgates login <key> takes the whole string.")}
69361
+ ` + (sealed ? "" : ` ${import_picocolors7.default.dim(`It holds no copy of the data key${why ? `: ${why}` : ""}; sealed calls and mail read as shut on it.`)}
69362
+ `) + (opts.keep ? ` ${import_picocolors7.default.dim("Kept in the key file: this machine sends it from now on.")}
69363
+
69364
+ ` : ` ${import_picocolors7.default.dim("agentgates keys create --keep \xB7 would have made it this machine's")}
69365
+
69366
+ `)
69367
+ );
69368
+ });
69369
+ } catch (err) {
69370
+ fail(opts, err);
69371
+ }
69372
+ }
69373
+ async function keysRevoke(id2, opts) {
69374
+ try {
69375
+ const keys2 = await requirePasswordsKey();
69376
+ const before = await listLoginKeys(keys2.wallet);
69377
+ const target = before.find((r) => r.id === id2);
69378
+ const out = await revokeLoginKey(keys2.wallet, id2);
69379
+ const wasMine = !!target && !!keys2.state.apiKeyPrefix && target.prefix === keys2.state.apiKeyPrefix;
69380
+ if (wasMine) await forgetLoginKey(keys2.state);
69381
+ emit3(opts, { ok: true, revoked: id2, keys: out.keys, thisMachineDropped: wasMine }, () => {
69382
+ process.stdout.write(`
69383
+ ${import_picocolors7.default.green("\u2713")} revoked ${target ? import_picocolors7.default.bold(target.prefix) : id2}${wasMine ? import_picocolors7.default.dim(" (this machine signs with the words until keys create --keep)") : ""}
69384
+ `);
69385
+ printRows(out.keys, wasMine ? null : keys2.state.apiKeyPrefix ?? null);
69386
+ });
69387
+ } catch (err) {
69388
+ fail(opts, err);
69389
+ }
69390
+ }
69391
+ async function adoptKey(secret, name) {
69392
+ const parts = splitApiKey(secret);
69393
+ const key = parts.wire;
69394
+ setLoginKey(key, { keyOnly: true, reading: parts.reading });
69395
+ const copy4 = await mailKeyFromLoginKey();
69396
+ let ownerWallet = copy4?.address ?? null;
69397
+ if (!ownerWallet) {
69398
+ const bal = expectOk(await signedFetch(standInWallet(), "GET", lanePath("/credits")), "the key");
69399
+ ownerWallet = bal.ownerWallet ?? bal.owner ?? bal.address ?? null;
69400
+ if (!ownerWallet) throw new Error("the key is live but the balance door named no account; try again");
69401
+ }
69402
+ const prefix = `${key.slice(0, 12)}\u2026`;
69403
+ const { mode } = await useLoginKey({ secret: key, prefix, name, ownerWallet, reading: parts.reading });
69404
+ return { address: ownerWallet, prefix, sealed: !!copy4, mode };
69405
+ }
69406
+ async function keysUse(secret, opts) {
69407
+ try {
69408
+ const { address: ownerWallet, prefix, sealed: copy4, mode } = await adoptKey(secret, opts.name?.trim() || `use ${hostname()}`);
69409
+ emit3(opts, { ok: true, address: ownerWallet, prefix, sealed: !!copy4, mode, file: passwordsKeyPath() }, () => {
69410
+ process.stdout.write(
69411
+ `
69412
+ ${import_picocolors7.default.green("\u2713")} this machine runs on ${import_picocolors7.default.bold(prefix)} for ${ownerWallet}${mode === "beside-the-words" ? import_picocolors7.default.dim(" (beside the words already here)") : ""}
69413
+ ${import_picocolors7.default.dim(copy4 ? "It holds a copy of the account's data key: sealed calls and mail open here." : "No copy of the data key on this key: sealed calls and mail read as shut; a key minted with Read on Phone or Mail carries one.")}
69414
+ ${import_picocolors7.default.dim("The keys door and the seal doors take the words; everything else takes this key.")}
69415
+
69416
+ `
69417
+ );
69418
+ });
69419
+ } catch (err) {
69420
+ fail(opts, err);
69421
+ }
69422
+ }
69220
69423
 
69221
69424
  // src/lib/session-bridge.ts
69222
69425
  init_passwords_wire();
@@ -69300,15 +69503,20 @@ function openPage(args) {
69300
69503
  }
69301
69504
  function receivePage(args) {
69302
69505
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agentgates \xB7 receiving</title><style>${PAGE_STYLE}</style></head><body><main>
69303
- <h1>Receiving your session</h1>
69304
- <p id="line">Waiting for agentgates.ai to hand the words over\u2026</p>
69506
+ <h1>Receiving your account</h1>
69507
+ <p id="line">Waiting for agentgates.ai to hand the key over\u2026</p>
69305
69508
  <script>
69306
69509
  (function(){
69307
69510
  var ORIGIN=${JSON.stringify(args.origin)}, line=document.getElementById('line'), done=false;
69308
69511
  window.addEventListener('message',function(e){
69309
- if(done||e.origin!==ORIGIN||!e.data||e.data.type!=='agentgates-receive-words')return;
69512
+ if(done||e.origin!==ORIGIN||!e.data)return;
69513
+ if(e.data.type==='agentgates-receive-words'){
69514
+ if(e.source)e.source.postMessage({type:'agentgates-receive-done',ok:false,error:'this agentgates takes a key, not the words'},ORIGIN);
69515
+ return;
69516
+ }
69517
+ if(e.data.type!=='agentgates-receive-key')return;
69310
69518
  done=true;
69311
- fetch('/receive',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({code:e.data.code,words:e.data.words})})
69519
+ fetch('/receive',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({code:e.data.code,key:e.data.key})})
69312
69520
  .then(function(r){return r.json().then(function(b){return {ok:r.ok&&b.ok===true,error:b.error};});})
69313
69521
  .catch(function(){return {ok:false,error:'the agent did not take it'};})
69314
69522
  .then(function(out){
@@ -69317,8 +69525,8 @@ function receivePage(args) {
69317
69525
  if(out.ok)setTimeout(function(){window.close();},1200); else done=false;
69318
69526
  });
69319
69527
  });
69320
- if(window.opener)window.opener.postMessage({type:'agentgates-receive-ready'},ORIGIN);
69321
- else line.textContent='Open this from agentgates.ai: Top up \u2192 Hand this session to my agent.';
69528
+ if(window.opener)window.opener.postMessage({type:'agentgates-receive-ready',accepts:['key']},ORIGIN);
69529
+ else line.textContent='Open this from agentgates.ai: your account \u2192 Connect an agent on this computer.';
69322
69530
  })();
69323
69531
  </script></main></body></html>`;
69324
69532
  }
@@ -69377,7 +69585,7 @@ async function serveWordsOnce(args) {
69377
69585
  clearTimeout(timer);
69378
69586
  }
69379
69587
  }
69380
- async function receiveWordsOnce(args) {
69588
+ async function receiveKeyOnce(args) {
69381
69589
  const code = mintCode();
69382
69590
  let taken = false;
69383
69591
  let done = () => {
@@ -69391,7 +69599,7 @@ async function receiveWordsOnce(args) {
69391
69599
  const server = createServer(async (req, res) => {
69392
69600
  const url = new URL(req.url ?? "/", "http://127.0.0.1");
69393
69601
  if (req.method === "GET" && url.pathname === "/receive") return html(res, 200, receivePage({ origin: siteOrigin() }));
69394
- if (req.method === "GET" && url.pathname === "/hello") return json(res, 200, { ok: true, receive: true });
69602
+ if (req.method === "GET" && url.pathname === "/hello") return json(res, 200, { ok: true, receive: true, accepts: ["key"] });
69395
69603
  if (req.method !== "POST" || url.pathname !== "/receive") return json(res, 404, { error: "not found" });
69396
69604
  const origin = req.headers.origin;
69397
69605
  if (origin && origin !== `http://127.0.0.1:${server.address().port}`) return json(res, 403, { error: "origin not allowed" });
@@ -69402,13 +69610,13 @@ async function receiveWordsOnce(args) {
69402
69610
  return json(res, 400, { error: "body must be JSON" });
69403
69611
  }
69404
69612
  if (taken || typeof body.code !== "string" || body.code.trim().toUpperCase() !== code) return json(res, 403, { error: "code spent or wrong" });
69405
- const words7 = typeof body.words === "string" ? body.words.trim().toLowerCase().split(/\s+/).join(" ") : "";
69406
- if (words7.split(" ").length !== 12) return json(res, 400, { error: "twelve words expected" });
69613
+ const key = typeof body.key === "string" ? body.key.trim() : "";
69614
+ if (!KEY_SECRET_SHAPE.test(key)) return json(res, 400, { error: "an API key was expected" });
69407
69615
  taken = true;
69408
69616
  json(res, 200, { ok: true });
69409
69617
  setTimeout(() => {
69410
69618
  server.close();
69411
- done({ words: words7 });
69619
+ done({ key });
69412
69620
  }, 1500);
69413
69621
  });
69414
69622
  const port = await listen(server);
@@ -69434,15 +69642,15 @@ init_passwords_wire();
69434
69642
  var jsonMode2 = (opts) => opts.json === true || !process.stdout.isTTY;
69435
69643
  function refuse2(opts, error, code = null) {
69436
69644
  if (jsonMode2(opts)) process.stdout.write(JSON.stringify({ ok: false, code, error }, null, 2) + "\n");
69437
- else process.stderr.write(` ${error}${code ? import_picocolors7.default.dim(` (${code})`) : ""}
69645
+ else process.stderr.write(` ${error}${code ? import_picocolors8.default.dim(` (${code})`) : ""}
69438
69646
  `);
69439
69647
  process.exit(1);
69440
69648
  }
69441
69649
  function humanHandoffLines(address) {
69442
69650
  const site = siteOrigin();
69443
- return ` ${import_picocolors7.default.bold("For your human")}
69444
- ${import_picocolors7.default.dim(`Log in as this account at ${site}: Log in \u2192 I have a seed \u2192 paste the twelve words.`)}
69445
- ${import_picocolors7.default.dim(`Or hand it over live on this machine: agentgates open (opens the browser already logged in as ${address.slice(0, 6)}\u2026${address.slice(-4)})`)}
69651
+ return ` ${import_picocolors8.default.bold("For your human")}
69652
+ ${import_picocolors8.default.dim(`Log in as this account at ${site}: Log in \u2192 I have a seed \u2192 paste the twelve words.`)}
69653
+ ${import_picocolors8.default.dim(`Or hand it over live on this machine: agentgates open (opens the browser already logged in as ${address.slice(0, 6)}\u2026${address.slice(-4)})`)}
69446
69654
  `;
69447
69655
  }
69448
69656
  async function sessionOpen(opts) {
@@ -69466,11 +69674,11 @@ async function sessionOpen(opts) {
69466
69674
  process.stdout.write(JSON.stringify({ ok: true, status: "waiting", url, port, address, waitSeconds: waitMs / 1e3 }) + "\n");
69467
69675
  } else {
69468
69676
  process.stdout.write(`
69469
- ${import_picocolors7.default.bold("OPEN")} ${import_picocolors7.default.dim(`a page from this machine; press Continue there and the browser is ${address}`)}
69677
+ ${import_picocolors8.default.bold("OPEN")} ${import_picocolors8.default.dim(`a page from this machine; press Continue there and the browser is ${address}`)}
69470
69678
  `);
69471
- if (opts.printUrl || opts.browser === false) process.stdout.write(` ${import_picocolors7.default.cyan(url)}
69679
+ if (opts.printUrl || opts.browser === false) process.stdout.write(` ${import_picocolors8.default.cyan(url)}
69472
69680
  `);
69473
- process.stdout.write(` ${import_picocolors7.default.dim(`waiting ${Math.round(waitMs / 1e3)}s; the page is served once and the link dies with it`)}
69681
+ process.stdout.write(` ${import_picocolors8.default.dim(`waiting ${Math.round(waitMs / 1e3)}s; the page is served once and the link dies with it`)}
69474
69682
  `);
69475
69683
  }
69476
69684
  if (opts.browser !== false && !process.env.CI) void open_default(url).catch(() => {
@@ -69478,7 +69686,7 @@ async function sessionOpen(opts) {
69478
69686
  }
69479
69687
  });
69480
69688
  if (jsonMode2(opts)) process.stdout.write(JSON.stringify({ ok: true, status: "handed", address }) + "\n");
69481
- else process.stdout.write(` ${import_picocolors7.default.green("\u2713")} handed over; the browser is this account now.
69689
+ else process.stdout.write(` ${import_picocolors8.default.green("\u2713")} handed over; the browser is this account now.
69482
69690
 
69483
69691
  `);
69484
69692
  } catch (err) {
@@ -69488,7 +69696,7 @@ async function sessionOpen(opts) {
69488
69696
  async function sessionReceive(opts) {
69489
69697
  const waitMs = Math.max(10, Number(opts.wait) || 300) * 1e3;
69490
69698
  try {
69491
- const { words: words7 } = await receiveWordsOnce({
69699
+ const { key } = await receiveKeyOnce({
69492
69700
  waitMs,
69493
69701
  onCode: (code, port) => {
69494
69702
  const typed = handoffCode(code, port);
@@ -69496,21 +69704,26 @@ async function sessionReceive(opts) {
69496
69704
  process.stdout.write(JSON.stringify({ ok: true, status: "waiting", code: typed, port, waitSeconds: waitMs / 1e3 }) + "\n");
69497
69705
  } else {
69498
69706
  process.stdout.write(`
69499
- ${import_picocolors7.default.bold("RECEIVE")} ${import_picocolors7.default.dim(`on ${siteOrigin()}: Top up \u2192 Hand this session to my agent, then type`)}
69707
+ ${import_picocolors8.default.bold("RECEIVE")} ${import_picocolors8.default.dim(`on ${siteOrigin()}: your account \u2192 Connect an agent on this computer, then type`)}
69500
69708
  `);
69501
- process.stdout.write(` ${import_picocolors7.default.cyan(typed)}
69709
+ process.stdout.write(` ${import_picocolors8.default.cyan(typed)}
69502
69710
  `);
69503
- process.stdout.write(` ${import_picocolors7.default.dim(`waiting ${Math.round(waitMs / 1e3)}s; the code dies on first use`)}
69711
+ process.stdout.write(` ${import_picocolors8.default.dim(`waiting ${Math.round(waitMs / 1e3)}s; the code dies on first use`)}
69504
69712
  `);
69505
69713
  }
69506
69714
  }
69507
69715
  });
69508
- const { state } = await importPasswordsSeed({ seed: words7, replace: opts.replace === true });
69509
- if (jsonMode2(opts)) process.stdout.write(JSON.stringify({ ok: true, status: "received", address: state.address, path: passwordsKeyPath() }) + "\n");
69510
- else process.stdout.write(` ${import_picocolors7.default.green("\u2713")} this CLI is ${import_picocolors7.default.bold(state.address)} now
69511
- ${import_picocolors7.default.dim(passwordsKeyPath())}
69716
+ const { address, prefix, sealed, mode } = await adoptKey(key, `computer ${hostname2()}`);
69717
+ if (jsonMode2(opts)) process.stdout.write(JSON.stringify({ ok: true, status: "received", address, prefix, sealed, mode, path: passwordsKeyPath() }) + "\n");
69718
+ else {
69719
+ process.stdout.write(` ${import_picocolors8.default.green("\u2713")} this CLI runs on ${import_picocolors8.default.bold(prefix)} for ${address}
69720
+ `);
69721
+ process.stdout.write(` ${import_picocolors8.default.dim(sealed ? "It opens the account's sealed calls and mail." : "It holds no copy of the data key: sealed calls and mail read as shut.")}
69722
+ `);
69723
+ process.stdout.write(` ${import_picocolors8.default.dim(passwordsKeyPath())}
69512
69724
 
69513
69725
  `);
69726
+ }
69514
69727
  } catch (err) {
69515
69728
  const message = err.message;
69516
69729
  return refuse2(opts, message, /already exists/.test(message) ? "key_exists" : "not_received");
@@ -69519,7 +69732,7 @@ async function sessionReceive(opts) {
69519
69732
 
69520
69733
  // src/commands/passwords.ts
69521
69734
  init_lib2();
69522
- import { hostname } from "node:os";
69735
+ import { hostname as hostname3 } from "node:os";
69523
69736
  init_passwords_wire();
69524
69737
 
69525
69738
  // src/lib/passwords-seal.ts
@@ -69923,7 +70136,7 @@ init_passwords_wire();
69923
70136
  async function mintLoginKeyIfMissing(keys2) {
69924
70137
  if (keys2.state.apiKey) return { prefix: keys2.state.apiKeyPrefix ?? "", name: keys2.state.apiKeyName ?? "", minted: false };
69925
70138
  try {
69926
- const name = `cli ${hostname()}`.slice(0, 64);
70139
+ const name = `cli ${hostname3()}`.slice(0, 64);
69927
70140
  const out = await createLoginKey(keys2.wallet, name);
69928
70141
  await saveLoginKey(keys2.state, { secret: out.key, prefix: out.created.prefix, name: out.created.name });
69929
70142
  return { prefix: out.created.prefix, name: out.created.name, minted: true };
@@ -69935,15 +70148,15 @@ function loginKeyFields(login2) {
69935
70148
  return "error" in login2 ? { loginKeyError: login2.error } : { loginKey: { prefix: login2.prefix, name: login2.name, minted: login2.minted } };
69936
70149
  }
69937
70150
  function loginKeyLines(login2) {
69938
- if ("error" in login2) return ` ${import_picocolors8.default.dim(`no login key yet (${login2.error}); the words sign every call until agentgates keys create --keep`)}
70151
+ if ("error" in login2) return ` ${import_picocolors9.default.dim(`no login key yet (${login2.error}); the words sign every call until agentgates keys create --keep`)}
69939
70152
  `;
69940
- return login2.minted ? ` ${import_picocolors8.default.green("\u2713")} login key minted: ${import_picocolors8.default.bold(login2.prefix)} ${import_picocolors8.default.dim("kept in the key file; every call sends it and the words stay home. agentgates keys \xB7 lists, mints, revokes")}
69941
- ` : ` ${import_picocolors8.default.dim(`login key here: ${login2.prefix}; every call sends it`)}
70153
+ return login2.minted ? ` ${import_picocolors9.default.green("\u2713")} login key minted: ${import_picocolors9.default.bold(login2.prefix)} ${import_picocolors9.default.dim("kept in the key file; every call sends it and the words stay home. agentgates keys \xB7 lists, mints, revokes")}
70154
+ ` : ` ${import_picocolors9.default.dim(`login key here: ${login2.prefix}; every call sends it`)}
69942
70155
  `;
69943
70156
  }
69944
70157
  var SITE5 = (process.env.AGENTGATES_ORIGIN || "https://agentgates.ai").replace(/\/$/, "");
69945
70158
  var jsonMode3 = (opts) => opts.json === true || !process.stdout.isTTY;
69946
- function emit3(opts, data4, human) {
70159
+ function emit4(opts, data4, human) {
69947
70160
  if (jsonMode3(opts)) {
69948
70161
  process.stdout.write(JSON.stringify(data4, null, 2) + "\n");
69949
70162
  return;
@@ -69954,7 +70167,7 @@ function refuse3(opts, error, code, extra = {}) {
69954
70167
  if (jsonMode3(opts)) {
69955
70168
  process.stdout.write(JSON.stringify({ ok: false, code, error, ...extra }, null, 2) + "\n");
69956
70169
  } else {
69957
- process.stderr.write(` ${error}${code ? import_picocolors8.default.dim(` (${code})`) : ""}
70170
+ process.stderr.write(` ${error}${code ? import_picocolors9.default.dim(` (${code})`) : ""}
69958
70171
  `);
69959
70172
  }
69960
70173
  process.exit(1);
@@ -70039,20 +70252,20 @@ async function passwordsPricing(opts) {
70039
70252
  return;
70040
70253
  }
70041
70254
  if (!product || product.available === false) {
70042
- process.stdout.write(` ${import_picocolors8.default.dim(product?.note || product?.brief || "Passwords are not on sale right now.")}
70255
+ process.stdout.write(` ${import_picocolors9.default.dim(product?.note || product?.brief || "Passwords are not on sale right now.")}
70043
70256
  `);
70044
70257
  process.exitCode = 1;
70045
70258
  return;
70046
70259
  }
70047
70260
  process.stdout.write(`
70048
- ${import_picocolors8.default.bold("PASSWORDS")} ${import_picocolors8.default.dim(product.brief || "logins your agent uses and never sees")}
70261
+ ${import_picocolors9.default.bold("PASSWORDS")} ${import_picocolors9.default.dim(product.brief || "logins your agent uses and never sees")}
70049
70262
 
70050
70263
  `);
70051
70264
  const freeRows = slice.payg?.passwords;
70052
70265
  const freeUses = slice.payg?.passwordsUsesPerDay ?? 0;
70053
70266
  if (freeRows) {
70054
70267
  process.stdout.write(
70055
- ` ${import_picocolors8.default.bold("free".padEnd(11))} ${import_picocolors8.default.cyan("$0".padStart(4))}${"".padEnd(11)} ${import_picocolors8.default.dim(`${freeRows} password${freeRows === 1 ? "" : "s"}, ${freeUses > 0 ? `${freeUses} uses a day` : "every use metered"}; try it first`)}
70268
+ ` ${import_picocolors9.default.bold("free".padEnd(11))} ${import_picocolors9.default.cyan("$0".padStart(4))}${"".padEnd(11)} ${import_picocolors9.default.dim(`${freeRows} password${freeRows === 1 ? "" : "s"}, ${freeUses > 0 ? `${freeUses} uses a day` : "every use metered"}; try it first`)}
70056
70269
  `
70057
70270
  );
70058
70271
  }
@@ -70069,16 +70282,16 @@ async function passwordsPricing(opts) {
70069
70282
  }
70070
70283
  for (const f2 of families) {
70071
70284
  const rows = byFamily.get(f2).sort((a, b2) => a.units - b2.units);
70072
- const cells = rows.map((p) => `${import_picocolors8.default.cyan(usd5(p.priceUsd).padStart(4))}${import_picocolors8.default.dim(`/${p.units} days`.padEnd(10))}`).join(" ");
70285
+ const cells = rows.map((p) => `${import_picocolors9.default.cyan(usd5(p.priceUsd).padStart(4))}${import_picocolors9.default.dim(`/${p.units} days`.padEnd(10))}`).join(" ");
70073
70286
  const lead = rows[0];
70074
70287
  const cap = [
70075
70288
  lead.passwords ? `${lead.passwords.toLocaleString()} passwords` : "",
70076
70289
  lead.usesPerDay ? `${lead.usesPerDay.toLocaleString()} uses/day` : ""
70077
70290
  ].filter(Boolean).join(" \xB7 ");
70078
- process.stdout.write(` ${import_picocolors8.default.bold(f2.padEnd(11))} ${cells} ${import_picocolors8.default.dim(cap)}
70291
+ process.stdout.write(` ${import_picocolors9.default.bold(f2.padEnd(11))} ${cells} ${import_picocolors9.default.dim(cap)}
70079
70292
  `);
70080
70293
  }
70081
- if (plans.length === 0) process.stdout.write(` ${import_picocolors8.default.dim("no plan rungs are priced right now")}
70294
+ if (plans.length === 0) process.stdout.write(` ${import_picocolors9.default.dim("no plan rungs are priced right now")}
70082
70295
  `);
70083
70296
  const use = slice.passwordsUsage?.useUsd;
70084
70297
  const login2 = slice.passwordsUsage?.loginUsd;
@@ -70087,16 +70300,16 @@ async function passwordsPricing(opts) {
70087
70300
  login2 ? `a login ${usd5(login2)}` : ""
70088
70301
  ].filter(Boolean).join(" \xB7 ");
70089
70302
  if (meter) process.stdout.write(`
70090
- ${import_picocolors8.default.dim(`past the daily uses, from the agent's prepaid balance: ${meter}`)}
70303
+ ${import_picocolors9.default.dim(`past the daily uses, from the agent's prepaid balance: ${meter}`)}
70091
70304
  `);
70092
- process.stdout.write(` ${import_picocolors8.default.dim("storing is free on every plan; we store ciphertext we cannot read")}
70305
+ process.stdout.write(` ${import_picocolors9.default.dim("storing is free on every plan; we store ciphertext we cannot read")}
70093
70306
  `);
70094
70307
  const bal = slice.balance;
70095
- if (bal?.note) process.stdout.write(` ${import_picocolors8.default.dim(bal.note)}
70308
+ if (bal?.note) process.stdout.write(` ${import_picocolors9.default.dim(bal.note)}
70096
70309
  `);
70097
70310
  const nets = [...new Set((plans[0]?.byNetwork ?? []).map((n2) => n2.network))];
70098
70311
  if (nets.length) process.stdout.write(`
70099
- ${import_picocolors8.default.dim(`USDC on ${nets.join(", ")}`)}
70312
+ ${import_picocolors9.default.dim(`USDC on ${nets.join(", ")}`)}
70100
70313
 
70101
70314
  `);
70102
70315
  else process.stdout.write("\n");
@@ -70105,10 +70318,10 @@ async function passwordsInit(opts) {
70105
70318
  try {
70106
70319
  if (opts.import) {
70107
70320
  const { state: state2 } = await importPasswordsKey(opts.import, opts.replace === true);
70108
- emit3(opts, { ok: true, address: state2.address, created: false, imported: true, path: passwordsKeyPath() }, () => {
70321
+ emit4(opts, { ok: true, address: state2.address, created: false, imported: true, path: passwordsKeyPath() }, () => {
70109
70322
  process.stdout.write(`
70110
- ${import_picocolors8.default.green("\u2713")} key imported: ${import_picocolors8.default.bold(state2.address)}
70111
- ${import_picocolors8.default.dim(passwordsKeyPath())}
70323
+ ${import_picocolors9.default.green("\u2713")} key imported: ${import_picocolors9.default.bold(state2.address)}
70324
+ ${import_picocolors9.default.dim(passwordsKeyPath())}
70112
70325
 
70113
70326
  `);
70114
70327
  });
@@ -70117,10 +70330,10 @@ async function passwordsInit(opts) {
70117
70330
  if (opts.seed) {
70118
70331
  const brought = await importPasswordsSeed({ seed: opts.seed, replace: opts.replace === true });
70119
70332
  const login3 = await mintLoginKeyIfMissing(brought);
70120
- emit3(opts, { ok: true, address: brought.state.address, created: false, imported: true, words: SEED_WORDS, path: passwordsKeyPath(), ...loginKeyFields(login3) }, () => {
70333
+ emit4(opts, { ok: true, address: brought.state.address, created: false, imported: true, words: SEED_WORDS, path: passwordsKeyPath(), ...loginKeyFields(login3) }, () => {
70121
70334
  process.stdout.write(`
70122
- ${import_picocolors8.default.green("\u2713")} twelve words taken: ${import_picocolors8.default.bold(brought.state.address)}
70123
- ${import_picocolors8.default.dim(passwordsKeyPath())}
70335
+ ${import_picocolors9.default.green("\u2713")} twelve words taken: ${import_picocolors9.default.bold(brought.state.address)}
70336
+ ${import_picocolors9.default.dim(passwordsKeyPath())}
70124
70337
  ` + loginKeyLines(login3) + "\n");
70125
70338
  });
70126
70339
  return;
@@ -70128,11 +70341,11 @@ async function passwordsInit(opts) {
70128
70341
  if (opts.revealSeed) {
70129
70342
  const { state: state2 } = await requirePasswordsKey();
70130
70343
  if (!state2.mnemonic) throw new Error("this key was made without words (a bare key); mint a new one with init --replace, or bring words with init --seed.");
70131
- emit3(opts, { ok: true, address: state2.address, seed: state2.mnemonic }, () => {
70344
+ emit4(opts, { ok: true, address: state2.address, seed: state2.mnemonic }, () => {
70132
70345
  process.stdout.write(`
70133
70346
  ${state2.mnemonic}
70134
70347
 
70135
- ${import_picocolors8.default.dim(`the words behind ${state2.address}. Whoever holds them is this account: they sign every call, hold its balance and open what it stores.`)}
70348
+ ${import_picocolors9.default.dim(`the words behind ${state2.address}. Whoever holds them is this account: they sign every call, hold its balance and open what it stores.`)}
70136
70349
 
70137
70350
  ` + humanHandoffLines(state2.address) + "\n");
70138
70351
  });
@@ -70141,21 +70354,21 @@ async function passwordsInit(opts) {
70141
70354
  const made = await loadOrCreatePasswordsKey();
70142
70355
  const { state, created, minted } = made;
70143
70356
  const login2 = await mintLoginKeyIfMissing(made);
70144
- emit3(opts, { ok: true, address: state.address, created, path: passwordsKeyPath(), ...minted ? { seed: minted.seed } : {}, ...loginKeyFields(login2) }, () => {
70357
+ emit4(opts, { ok: true, address: state.address, created, path: passwordsKeyPath(), ...minted ? { seed: minted.seed } : {}, ...loginKeyFields(login2) }, () => {
70145
70358
  process.stdout.write(
70146
70359
  `
70147
- ${import_picocolors8.default.green("\u2713")} ${created ? "key minted" : "key already here"}: ${import_picocolors8.default.bold(state.address)}
70148
- ${import_picocolors8.default.dim(passwordsKeyPath())}
70360
+ ${import_picocolors9.default.green("\u2713")} ${created ? "key minted" : "key already here"}: ${import_picocolors9.default.bold(state.address)}
70361
+ ${import_picocolors9.default.dim(passwordsKeyPath())}
70149
70362
  ` + loginKeyLines(login2) + (minted ? `
70150
- ${import_picocolors8.default.bold(minted.seed)}
70363
+ ${import_picocolors9.default.bold(minted.seed)}
70151
70364
 
70152
- ${import_picocolors8.default.dim("Shown once. These twelve words are this account on agentgates.ai: they sign every call, hold its balance and open what it stores. Write them down, or hand them to the person you work for.")}
70153
- ${import_picocolors8.default.dim("agentgates init --reveal-seed \xB7 prints them again")}
70365
+ ${import_picocolors9.default.dim("Shown once. These twelve words are this account on agentgates.ai: they sign every call, hold its balance and open what it stores. Write them down, or hand them to the person you work for.")}
70366
+ ${import_picocolors9.default.dim("agentgates init --reveal-seed \xB7 prints them again")}
70154
70367
 
70155
- ` + humanHandoffLines(state.address) + "\n" : ` ${import_picocolors8.default.dim("It signs every call, holds this account's balance and locks its vault. It never leaves this machine.")}
70368
+ ` + humanHandoffLines(state.address) + "\n" : ` ${import_picocolors9.default.dim("It signs every call, holds this account's balance and locks its vault. It never leaves this machine.")}
70156
70369
 
70157
- `) + ` ${import_picocolors8.default.dim("agentgates browser balance \xB7 the balance and the address that tops it up")}
70158
- ${import_picocolors8.default.dim("agentgates passwords add --label <name> --host <site> --username <u> --password <p>")}
70370
+ `) + ` ${import_picocolors9.default.dim("agentgates browser balance \xB7 the balance and the address that tops it up")}
70371
+ ${import_picocolors9.default.dim("agentgates passwords add --label <name> --host <site> --username <u> --password <p>")}
70159
70372
 
70160
70373
  `
70161
70374
  );
@@ -70238,15 +70451,15 @@ async function passwordsAdd(opts) {
70238
70451
  cvmBlob,
70239
70452
  cvmKeyId: att.keyId
70240
70453
  });
70241
- emit3(opts, { ok: true, id: row.id, label: row.label, kind: row.kind, hosts: row.hosts, username: row.username ?? null, owner: wallet.address, backupCodes: payload.backupCodes ? payload.backupCodes.codes.length : 0, device: payload.device ? payload.device.rpId : null }, () => {
70454
+ emit4(opts, { ok: true, id: row.id, label: row.label, kind: row.kind, hosts: row.hosts, username: row.username ?? null, owner: wallet.address, backupCodes: payload.backupCodes ? payload.backupCodes.codes.length : 0, device: payload.device ? payload.device.rpId : null }, () => {
70242
70455
  process.stdout.write(
70243
70456
  `
70244
- ${import_picocolors8.default.green("\u2713")} stored ${import_picocolors8.default.bold(row.label)} for ${row.hosts.join(", ")}${payload.backupCodes ? import_picocolors8.default.dim(` \xB7 ${payload.backupCodes.codes.length} backup codes`) : ""}${payload.device ? import_picocolors8.default.dim(` \xB7 a device credential for ${payload.device.rpId}`) : ""}
70245
- ${import_picocolors8.default.dim("row")} ${row.id}
70246
- ${import_picocolors8.default.dim("sealed on this machine; the server holds ciphertext it cannot open")}
70457
+ ${import_picocolors9.default.green("\u2713")} stored ${import_picocolors9.default.bold(row.label)} for ${row.hosts.join(", ")}${payload.backupCodes ? import_picocolors9.default.dim(` \xB7 ${payload.backupCodes.codes.length} backup codes`) : ""}${payload.device ? import_picocolors9.default.dim(` \xB7 a device credential for ${payload.device.rpId}`) : ""}
70458
+ ${import_picocolors9.default.dim("row")} ${row.id}
70459
+ ${import_picocolors9.default.dim("sealed on this machine; the server holds ciphertext it cannot open")}
70247
70460
 
70248
- ${import_picocolors8.default.dim(`agentgates passwords allow \xB7 permit yourself to use it`)}
70249
- ${import_picocolors8.default.dim(`agentgates passwords use --row ${row.id} --url https://${row.hosts[0]}/login`)}
70461
+ ${import_picocolors9.default.dim(`agentgates passwords allow \xB7 permit yourself to use it`)}
70462
+ ${import_picocolors9.default.dim(`agentgates passwords use --row ${row.id} --url https://${row.hosts[0]}/login`)}
70250
70463
 
70251
70464
  `
70252
70465
  );
@@ -70283,15 +70496,15 @@ async function passwordsAllow(opts) {
70283
70496
  grant = { ok: false, reason: err instanceof Error ? err.message : String(err) };
70284
70497
  }
70285
70498
  }
70286
- emit3(opts, { ok: true, permitId: permit.id, agent: permit.agent, self: self2, secretIds: permit.secretIds, hosts: permit.hosts, uses: permit.uses, usesPerDay: permit.usesPerDay, approveEachUse: permit.approveEachUse, expiresAt: permit.expiresAt, ...grant ? { grant } : {} }, () => {
70499
+ emit4(opts, { ok: true, permitId: permit.id, agent: permit.agent, self: self2, secretIds: permit.secretIds, hosts: permit.hosts, uses: permit.uses, usesPerDay: permit.usesPerDay, approveEachUse: permit.approveEachUse, expiresAt: permit.expiresAt, ...grant ? { grant } : {} }, () => {
70287
70500
  process.stdout.write(
70288
70501
  `
70289
- ${import_picocolors8.default.green("\u2713")} ${self2 ? "you may use" : `${short(permit.agent)} may use`} ${permit.secretIds[0] === "*" ? "every login this key holds" : `${permit.secretIds.length} login${permit.secretIds.length === 1 ? "" : "s"}`} for ${permit.uses.join(", ")} until ${permit.expiresAt.slice(0, 10)}
70290
- ${import_picocolors8.default.dim("permit")} ${permit.id}
70291
- ` + (permit.approveEachUse ? ` ${import_picocolors8.default.dim(self2 ? "ask-me is on for a permit to yourself, which parks every use behind your own board; nobody is there to press approve" : "every use waits for the owner's signature")}
70292
- ` : "") + (grant && grant.ok ? ` ${import_picocolors8.default.dim(`sealed calls and mail: ${short(permit.agent)} opens yours with its own key (grant ${grant.id}); agentgates calls --owner ${wallet.address}`)}
70293
- ` : "") + (grant && !grant.ok && grant.reason === "agent_not_sealed" ? ` ${import_picocolors8.default.dim(`sealed calls and mail: not granted, ${short(permit.agent)} has not sealed (it runs agentgates email seal, then you run this again)`)}
70294
- ` : "") + (grant && !grant.ok && grant.reason !== "agent_not_sealed" && grant.reason !== "owner_not_sealed" ? ` ${import_picocolors8.default.dim(`sealed calls and mail: not granted (${grant.reason})`)}
70502
+ ${import_picocolors9.default.green("\u2713")} ${self2 ? "you may use" : `${short(permit.agent)} may use`} ${permit.secretIds[0] === "*" ? "every login this key holds" : `${permit.secretIds.length} login${permit.secretIds.length === 1 ? "" : "s"}`} for ${permit.uses.join(", ")} until ${permit.expiresAt.slice(0, 10)}
70503
+ ${import_picocolors9.default.dim("permit")} ${permit.id}
70504
+ ` + (permit.approveEachUse ? ` ${import_picocolors9.default.dim(self2 ? "ask-me is on for a permit to yourself, which parks every use behind your own board; nobody is there to press approve" : "every use waits for the owner's signature")}
70505
+ ` : "") + (grant && grant.ok ? ` ${import_picocolors9.default.dim(`sealed calls and mail: ${short(permit.agent)} opens yours with its own key (grant ${grant.id}); agentgates calls --owner ${wallet.address}`)}
70506
+ ` : "") + (grant && !grant.ok && grant.reason === "agent_not_sealed" ? ` ${import_picocolors9.default.dim(`sealed calls and mail: not granted, ${short(permit.agent)} has not sealed (it runs agentgates email seal, then you run this again)`)}
70507
+ ` : "") + (grant && !grant.ok && grant.reason !== "agent_not_sealed" && grant.reason !== "owner_not_sealed" ? ` ${import_picocolors9.default.dim(`sealed calls and mail: not granted (${grant.reason})`)}
70295
70508
  ` : "") + "\n"
70296
70509
  );
70297
70510
  });
@@ -70304,9 +70517,9 @@ async function passwordsRemove(opts) {
70304
70517
  const { wallet } = await requirePasswordsKey();
70305
70518
  if (!opts.row || !/^[A-Za-z0-9_-]{1,64}$/.test(opts.row)) throw new PasswordsSealError("--row names the row to remove (agentgates passwords list)");
70306
70519
  const out = await deleteRow(wallet, opts.row);
70307
- emit3(opts, { ok: out.deleted, row: opts.row, browser: out.browser }, () => {
70520
+ emit4(opts, { ok: out.deleted, row: opts.row, browser: out.browser }, () => {
70308
70521
  process.stdout.write(`
70309
- ${import_picocolors8.default.green("\u2713")} removed ${opts.row} ${import_picocolors8.default.dim("the sealed copies are gone and the CVM forgets its browser; the account on the site stays as it is")}
70522
+ ${import_picocolors9.default.green("\u2713")} removed ${opts.row} ${import_picocolors9.default.dim("the sealed copies are gone and the CVM forgets its browser; the account on the site stays as it is")}
70310
70523
 
70311
70524
  `);
70312
70525
  });
@@ -70319,27 +70532,27 @@ async function passwordsList(opts) {
70319
70532
  try {
70320
70533
  const { wallet } = await requirePasswordsKey();
70321
70534
  const { passwords: passwords2, permitted } = await listRows(wallet);
70322
- emit3(opts, { ok: true, address: wallet.address, passwords: passwords2, permitted }, () => {
70535
+ emit4(opts, { ok: true, address: wallet.address, passwords: passwords2, permitted }, () => {
70323
70536
  process.stdout.write(`
70324
- ${import_picocolors8.default.bold(short(wallet.address))}
70537
+ ${import_picocolors9.default.bold(short(wallet.address))}
70325
70538
 
70326
70539
  `);
70327
70540
  if (passwords2.length === 0 && permitted.length === 0) {
70328
- process.stdout.write(` ${import_picocolors8.default.dim("nothing stored and nothing permitted yet")}
70541
+ process.stdout.write(` ${import_picocolors9.default.dim("nothing stored and nothing permitted yet")}
70329
70542
 
70330
70543
  `);
70331
70544
  return;
70332
70545
  }
70333
70546
  if (passwords2.length) {
70334
- process.stdout.write(` ${import_picocolors8.default.dim("yours")}
70547
+ process.stdout.write(` ${import_picocolors9.default.dim("yours")}
70335
70548
  `);
70336
- for (const r of passwords2) process.stdout.write(` ${import_picocolors8.default.cyan(r.id.padEnd(40))} ${r.label.padEnd(24)} ${import_picocolors8.default.dim(r.hosts.join(", "))}${r.stale ? import_picocolors8.default.dim(" (stale: re-seal on the board)") : ""}
70549
+ for (const r of passwords2) process.stdout.write(` ${import_picocolors9.default.cyan(r.id.padEnd(40))} ${r.label.padEnd(24)} ${import_picocolors9.default.dim(r.hosts.join(", "))}${r.stale ? import_picocolors9.default.dim(" (stale: re-seal on the board)") : ""}
70337
70550
  `);
70338
70551
  }
70339
70552
  if (permitted.length) {
70340
- process.stdout.write(` ${import_picocolors8.default.dim("permitted to you")}
70553
+ process.stdout.write(` ${import_picocolors9.default.dim("permitted to you")}
70341
70554
  `);
70342
- for (const r of permitted) process.stdout.write(` ${import_picocolors8.default.cyan(r.id.padEnd(40))} ${r.label.padEnd(24)} ${import_picocolors8.default.dim(`${r.hosts.join(", ")} \xB7 ${r.uses.join(", ")}`)}
70555
+ for (const r of permitted) process.stdout.write(` ${import_picocolors9.default.cyan(r.id.padEnd(40))} ${r.label.padEnd(24)} ${import_picocolors9.default.dim(`${r.hosts.join(", ")} \xB7 ${r.uses.join(", ")}`)}
70343
70556
  `);
70344
70557
  }
70345
70558
  process.stdout.write("\n");
@@ -70370,37 +70583,37 @@ function printUseAnswer(opts, status4, body) {
70370
70583
  writeFileSync2(opts.cookiesOut, JSON.stringify(cookies, null, 2), { mode: 384 });
70371
70584
  data4.cookiesOut = opts.cookiesOut;
70372
70585
  }
70373
- emit3(opts, data4, () => {
70586
+ emit4(opts, data4, () => {
70374
70587
  if (status4 === 200) {
70375
70588
  const result = body.result ?? {};
70376
70589
  const code = typeof result.code === "string" ? result.code : "ok";
70377
70590
  const digest = typeof result.digest === "string" ? result.digest : "";
70378
70591
  process.stdout.write(`
70379
- ${import_picocolors8.default.green("\u2713")} ${code}${body.seconds ? import_picocolors8.default.dim(` ${body.seconds}s`) : ""}${body.chargedUsd && body.chargedUsd !== "0.00" ? import_picocolors8.default.dim(` $${body.chargedUsd}`) : ""}
70592
+ ${import_picocolors9.default.green("\u2713")} ${code}${body.seconds ? import_picocolors9.default.dim(` ${body.seconds}s`) : ""}${body.chargedUsd && body.chargedUsd !== "0.00" ? import_picocolors9.default.dim(` $${body.chargedUsd}`) : ""}
70380
70593
  `);
70381
70594
  if (cookies) {
70382
- process.stdout.write(` ${cookies.length} cookie${cookies.length === 1 ? "" : "s"} for ${import_picocolors8.default.bold(String(result.url ?? ""))}${opts.cookiesOut ? import_picocolors8.default.dim(` \u2192 ${opts.cookiesOut}`) : import_picocolors8.default.dim(" (--cookies-out <file> writes them; --json prints them)")}
70595
+ process.stdout.write(` ${cookies.length} cookie${cookies.length === 1 ? "" : "s"} for ${import_picocolors9.default.bold(String(result.url ?? ""))}${opts.cookiesOut ? import_picocolors9.default.dim(` \u2192 ${opts.cookiesOut}`) : import_picocolors9.default.dim(" (--cookies-out <file> writes them; --json prints them)")}
70383
70596
 
70384
70597
  `);
70385
70598
  return;
70386
70599
  }
70387
70600
  if (result.secret && typeof result.secret === "object") {
70388
- process.stdout.write(` ${import_picocolors8.default.dim("the permit hands this key the secret itself; it is on your screen now")}
70601
+ process.stdout.write(` ${import_picocolors9.default.dim("the permit hands this key the secret itself; it is on your screen now")}
70389
70602
  `);
70390
- for (const [k, v] of Object.entries(result.secret)) process.stdout.write(` ${import_picocolors8.default.dim(k.padEnd(10))} ${v}
70603
+ for (const [k, v] of Object.entries(result.secret)) process.stdout.write(` ${import_picocolors9.default.dim(k.padEnd(10))} ${v}
70391
70604
  `);
70392
- if (typeof result.username === "string" && result.username) process.stdout.write(` ${import_picocolors8.default.dim("username".padEnd(10))} ${result.username}
70605
+ if (typeof result.username === "string" && result.username) process.stdout.write(` ${import_picocolors9.default.dim("username".padEnd(10))} ${result.username}
70393
70606
  `);
70394
70607
  process.stdout.write("\n");
70395
70608
  return;
70396
70609
  }
70397
- if (result.mfa === "device") process.stdout.write(` ${import_picocolors8.default.dim("the CVM completed the account's device step with the stored device credential")}
70610
+ if (result.mfa === "device") process.stdout.write(` ${import_picocolors9.default.dim("the CVM completed the account's device step with the stored device credential")}
70398
70611
  `);
70399
- if (result.mfa === "codes") process.stdout.write(` ${import_picocolors8.default.dim("the CVM spent one of the account's backup codes")}
70612
+ if (result.mfa === "codes") process.stdout.write(` ${import_picocolors9.default.dim("the CVM spent one of the account's backup codes")}
70400
70613
  `);
70401
- if (typeof result.codesLeft === "number") process.stdout.write(` ${import_picocolors8.default.dim(`${result.codesLeft} backup code${result.codesLeft === 1 ? "" : "s"} left`)}
70614
+ if (typeof result.codesLeft === "number") process.stdout.write(` ${import_picocolors9.default.dim(`${result.codesLeft} backup code${result.codesLeft === 1 ? "" : "s"} left`)}
70402
70615
  `);
70403
- if (result.device && typeof result.device === "object") process.stdout.write(` ${import_picocolors8.default.dim(`the site created a device credential for ${String(result.device.rpId ?? "")}; agentgates passwords device seals it into the row`)}
70616
+ 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`)}
70404
70617
  `);
70405
70618
  if (typeof result.error === "string" && result.error) process.stdout.write(` ${result.error}
70406
70619
  `);
@@ -70408,7 +70621,7 @@ function printUseAnswer(opts, status4, body) {
70408
70621
  ${digest.split("\n").map((l) => ` ${l}`).join("\n")}
70409
70622
  `);
70410
70623
  const steps = Array.isArray(result.steps) ? result.steps : [];
70411
- for (const s of steps) process.stdout.write(` ${import_picocolors8.default.dim(JSON.stringify(s).slice(0, 200))}
70624
+ for (const s of steps) process.stdout.write(` ${import_picocolors9.default.dim(JSON.stringify(s).slice(0, 200))}
70412
70625
  `);
70413
70626
  process.stdout.write("\n");
70414
70627
  return;
@@ -70416,11 +70629,11 @@ ${digest.split("\n").map((l) => ` ${l}`).join("\n")}
70416
70629
  const prompt = typeof body.prompt === "string" ? body.prompt : "";
70417
70630
  const view = body.view;
70418
70631
  process.stdout.write(`
70419
- ${body.error ?? `HTTP ${status4}`}${body.code ? import_picocolors8.default.dim(` (${body.code})`) : ""}
70420
- ${prompt ? ` ${import_picocolors8.default.dim(`the site says: ${prompt}`)}
70421
- ` : ""}${body.useId ? ` ${import_picocolors8.default.dim("use")} ${body.useId}
70422
- ` : ""}${view?.token ? ` ${import_picocolors8.default.dim("view token")} ${view.token}
70423
- ${import_picocolors8.default.dim("finish it on your board, or: agentgates passwords use --row <id> --url <url> --attend --use-id " + String(body.useId))}
70632
+ ${body.error ?? `HTTP ${status4}`}${body.code ? import_picocolors9.default.dim(` (${body.code})`) : ""}
70633
+ ${prompt ? ` ${import_picocolors9.default.dim(`the site says: ${prompt}`)}
70634
+ ` : ""}${body.useId ? ` ${import_picocolors9.default.dim("use")} ${body.useId}
70635
+ ` : ""}${view?.token ? ` ${import_picocolors9.default.dim("view token")} ${view.token}
70636
+ ${import_picocolors9.default.dim("finish it on your board, or: agentgates passwords use --row <id> --url <url> --attend --use-id " + String(body.useId))}
70424
70637
  ` : ""}
70425
70638
  `);
70426
70639
  });
@@ -70481,7 +70694,7 @@ function waitOptionsOf(opts) {
70481
70694
  return {
70482
70695
  waitSeconds: opts.wait !== void 0 ? parseInt10(opts.wait, "--wait", 0, 0, 3600) : null,
70483
70696
  noWait: opts.noWait,
70484
- note: jsonMode3(opts) ? void 0 : (line2) => process.stderr.write(` ${import_picocolors8.default.dim(line2)}
70697
+ note: jsonMode3(opts) ? void 0 : (line2) => process.stderr.write(` ${import_picocolors9.default.dim(line2)}
70485
70698
  `)
70486
70699
  };
70487
70700
  }
@@ -70558,9 +70771,9 @@ async function passwordsCode(opts) {
70558
70771
  if (source && source.kind !== "mailbox") {
70559
70772
  const timeoutSeconds = parseInt10(opts.timeout, "--timeout", 60, 5, 300);
70560
70773
  const read = source.kind === "inbox" ? await waitInboxCode(wallet, source.id, { timeoutSeconds }) : await waitPhoneCode(wallet, source.id, { timeoutSeconds });
70561
- emit3(opts, { ok: true, status: 200, from: from || null, source, code: read.code, link: null, looked: 1, error: null, refusal: null, sender: read.from, receivedAt: read.receivedAt }, () => {
70774
+ emit4(opts, { ok: true, status: 200, from: from || null, source, code: read.code, link: null, looked: 1, error: null, refusal: null, sender: read.from, receivedAt: read.receivedAt }, () => {
70562
70775
  process.stdout.write(`
70563
- ${import_picocolors8.default.green("\u2713")} ${read.from || (source.kind === "inbox" ? "the inbox" : "the number")} sent ${import_picocolors8.default.bold(read.code)}${import_picocolors8.default.dim(` ${read.receivedAt}`)}
70776
+ ${import_picocolors9.default.green("\u2713")} ${read.from || (source.kind === "inbox" ? "the inbox" : "the number")} sent ${import_picocolors9.default.bold(read.code)}${import_picocolors9.default.dim(` ${read.receivedAt}`)}
70564
70777
 
70565
70778
  `);
70566
70779
  });
@@ -70572,15 +70785,15 @@ async function passwordsCode(opts) {
70572
70785
  const answer = await postUse(wallet, rowId, { use: "code", request: { from, since: Date.now() - minutes * 6e4 } });
70573
70786
  const body = answer.body ?? {};
70574
70787
  const r = body.result ?? {};
70575
- emit3(opts, { ok: answer.status === 200 && r.ok === true, status: answer.status, from, code: r.value ?? null, link: r.link ?? null, looked: r.looked ?? 0, error: r.error ?? body.error ?? null, refusal: r.ok ? null : r.code ?? body.code ?? null }, () => {
70788
+ emit4(opts, { ok: answer.status === 200 && r.ok === true, status: answer.status, from, code: r.value ?? null, link: r.link ?? null, looked: r.looked ?? 0, error: r.error ?? body.error ?? null, refusal: r.ok ? null : r.code ?? body.code ?? null }, () => {
70576
70789
  if (answer.status === 200 && r.ok) {
70577
70790
  process.stdout.write(`
70578
- ${import_picocolors8.default.green("\u2713")} ${from} sent ${r.value ? import_picocolors8.default.bold(r.value) : "a sign-in link"}${r.link ? import_picocolors8.default.dim(` ${r.link}`) : ""}
70791
+ ${import_picocolors9.default.green("\u2713")} ${from} sent ${r.value ? import_picocolors9.default.bold(r.value) : "a sign-in link"}${r.link ? import_picocolors9.default.dim(` ${r.link}`) : ""}
70579
70792
 
70580
70793
  `);
70581
70794
  } else {
70582
70795
  process.stdout.write(`
70583
- ${r.error ?? body.error ?? `HTTP ${answer.status}`}${import_picocolors8.default.dim(` (${r.code ?? body.code ?? answer.status})`)}
70796
+ ${r.error ?? body.error ?? `HTTP ${answer.status}`}${import_picocolors9.default.dim(` (${r.code ?? body.code ?? answer.status})`)}
70584
70797
 
70585
70798
  `);
70586
70799
  }
@@ -70594,11 +70807,11 @@ async function passwordsInboxLease(opts) {
70594
70807
  try {
70595
70808
  const { wallet } = await requirePasswordsKey();
70596
70809
  const inbox = await leaseInbox(wallet, opts.name ? { name: opts.name } : {});
70597
- emit3(opts, { ok: true, inbox }, () => {
70810
+ emit4(opts, { ok: true, inbox }, () => {
70598
70811
  process.stdout.write(`
70599
- ${import_picocolors8.default.green("\u2713")} ${import_picocolors8.default.bold(inbox.address)} ${import_picocolors8.default.dim(inbox.id)}
70812
+ ${import_picocolors9.default.green("\u2713")} ${import_picocolors9.default.bold(inbox.address)} ${import_picocolors9.default.dim(inbox.id)}
70600
70813
  `);
70601
- process.stdout.write(` ${import_picocolors8.default.dim(`store it as a mailbox row: agentgates passwords add --label "Inbox" --kind mailbox --username ${inbox.address} --password -`)}
70814
+ process.stdout.write(` ${import_picocolors9.default.dim(`store it as a mailbox row: agentgates passwords add --label "Inbox" --kind mailbox --username ${inbox.address} --password -`)}
70602
70815
 
70603
70816
  `);
70604
70817
  });
@@ -70610,16 +70823,16 @@ async function passwordsInboxList(opts) {
70610
70823
  try {
70611
70824
  const { wallet } = await requirePasswordsKey();
70612
70825
  const inboxes = await listInboxes(wallet);
70613
- emit3(opts, { ok: true, inboxes }, () => {
70826
+ emit4(opts, { ok: true, inboxes }, () => {
70614
70827
  if (inboxes.length === 0) {
70615
70828
  process.stdout.write(`
70616
- no addresses yet ${import_picocolors8.default.dim("agentgates passwords inbox lease")}
70829
+ no addresses yet ${import_picocolors9.default.dim("agentgates passwords inbox lease")}
70617
70830
 
70618
70831
  `);
70619
70832
  return;
70620
70833
  }
70621
70834
  process.stdout.write("\n");
70622
- for (const i of inboxes) process.stdout.write(` ${import_picocolors8.default.bold(i.address)} ${import_picocolors8.default.dim(i.id)}
70835
+ for (const i of inboxes) process.stdout.write(` ${import_picocolors9.default.bold(i.address)} ${import_picocolors9.default.dim(i.id)}
70623
70836
  `);
70624
70837
  process.stdout.write("\n");
70625
70838
  });
@@ -70767,13 +70980,13 @@ async function passwordsSignup(opts) {
70767
70980
  { url: opts.url, email: opts.email, name: opts.name, username: opts.username, password: opts.password, mailbox: opts.mailbox, inbox: opts.inbox, phone: opts.phone, label: opts.label, store: opts.store !== false, steps, drive: opts.drive === true, birthday: birthdayOf(opts.birthday), attend: opts.attend === true, useId: opts.useId },
70768
70981
  waitOptionsOf(opts)
70769
70982
  );
70770
- emit3(opts, answer, () => {
70983
+ emit4(opts, answer, () => {
70771
70984
  if (answer.code === "attend_pending" && answer.useId) {
70772
70985
  process.stdout.write(
70773
70986
  `
70774
- ${import_picocolors8.default.yellow("!")} the page needs you at ${import_picocolors8.default.bold(answer.site)}: ${answer.wall ?? "a step only you can complete"}
70775
- ${import_picocolors8.default.dim("use")} ${answer.useId}
70776
- ${answer.then === "signin" ? import_picocolors8.default.dim("the CVM cannot go where this is finished: do it on your phone, then: agentgates passwords signup --url " + answer.url + " --use-id " + answer.useId + (opts.password ? " --password <the same one>" : "") + " (it signs in to the account you made and stores the row)") : import_picocolors8.default.dim("finish it on your board's live view, then: agentgates passwords signup --url " + answer.url + " --use-id " + answer.useId + (opts.password ? " --password <the same one>" : ""))}
70987
+ ${import_picocolors9.default.yellow("!")} the page needs you at ${import_picocolors9.default.bold(answer.site)}: ${answer.wall ?? "a step only you can complete"}
70988
+ ${import_picocolors9.default.dim("use")} ${answer.useId}
70989
+ ${answer.then === "signin" ? import_picocolors9.default.dim("the CVM cannot go where this is finished: do it on your phone, then: agentgates passwords signup --url " + answer.url + " --use-id " + answer.useId + (opts.password ? " --password <the same one>" : "") + " (it signs in to the account you made and stores the row)") : import_picocolors9.default.dim("finish it on your board's live view, then: agentgates passwords signup --url " + answer.url + " --use-id " + answer.useId + (opts.password ? " --password <the same one>" : ""))}
70777
70990
 
70778
70991
  `
70779
70992
  );
@@ -70782,27 +70995,27 @@ async function passwordsSignup(opts) {
70782
70995
  if (answer.ok) {
70783
70996
  const codeRead = answer.codeRead;
70784
70997
  process.stdout.write(`
70785
- ${import_picocolors8.default.green("\u2713")} account made at ${import_picocolors8.default.bold(answer.site)} as ${answer.email ?? answer.phone ?? "?"}${answer.verified && answer.verified !== "none" ? import_picocolors8.default.dim(` (verified by ${answer.verified})`) : import_picocolors8.default.dim(" (the site asked for no verification)")}${answer.seconds ? import_picocolors8.default.dim(` ${answer.seconds}s`) : ""}${answer.chargedUsd && answer.chargedUsd !== "0.00" ? import_picocolors8.default.dim(` $${answer.chargedUsd}`) : ""}${codeRead?.source?.address ? import_picocolors8.default.dim(` code read from ${codeRead.source.address}${codeRead.chargedUsd && codeRead.chargedUsd !== "0.00" ? ` ($${codeRead.chargedUsd})` : ""}`) : ""}
70998
+ ${import_picocolors9.default.green("\u2713")} account made at ${import_picocolors9.default.bold(answer.site)} as ${answer.email ?? answer.phone ?? "?"}${answer.verified && answer.verified !== "none" ? import_picocolors9.default.dim(` (verified by ${answer.verified})`) : import_picocolors9.default.dim(" (the site asked for no verification)")}${answer.seconds ? import_picocolors9.default.dim(` ${answer.seconds}s`) : ""}${answer.chargedUsd && answer.chargedUsd !== "0.00" ? import_picocolors9.default.dim(` $${answer.chargedUsd}`) : ""}${codeRead?.source?.address ? import_picocolors9.default.dim(` code read from ${codeRead.source.address}${codeRead.chargedUsd && codeRead.chargedUsd !== "0.00" ? ` ($${codeRead.chargedUsd})` : ""}`) : ""}
70786
70999
  `);
70787
71000
  if (answer.stored) {
70788
- process.stdout.write(` ${import_picocolors8.default.dim("stored as row")} ${answer.stored.id} ${import_picocolors8.default.dim(`(${answer.stored.label}, ${answer.stored.hosts.join(", ")}, signs in as ${answer.stored.username ?? "?"})`)}
70789
- ${import_picocolors8.default.dim(`agentgates passwords use --row ${answer.stored.id} --url ${answer.url}`)}
71001
+ process.stdout.write(` ${import_picocolors9.default.dim("stored as row")} ${answer.stored.id} ${import_picocolors9.default.dim(`(${answer.stored.label}, ${answer.stored.hosts.join(", ")}, signs in as ${answer.stored.username ?? "?"})`)}
71002
+ ${import_picocolors9.default.dim(`agentgates passwords use --row ${answer.stored.id} --url ${answer.url}`)}
70790
71003
  `);
70791
71004
  } else if (answer.storeError) {
70792
71005
  process.stdout.write(
70793
- ` ${import_picocolors8.default.yellow("!")} ${import_picocolors8.default.dim("the account was made and the row could NOT be stored:")} ${answer.storeError}
70794
- ${import_picocolors8.default.dim("the password, once, on your screen now - the site knows it and nothing else here does:")}
71006
+ ` ${import_picocolors9.default.yellow("!")} ${import_picocolors9.default.dim("the account was made and the row could NOT be stored:")} ${answer.storeError}
71007
+ ${import_picocolors9.default.dim("the password, once, on your screen now - the site knows it and nothing else here does:")}
70795
71008
  ${answer.password}
70796
71009
  `
70797
71010
  );
70798
71011
  } else if (!answer.passwordSet) {
70799
71012
  process.stdout.write(
70800
- ` ${import_picocolors8.default.dim("this site keeps no password: the account signs in with a code it emails")} ${import_picocolors8.default.bold(answer.email ?? "the mailbox")}${import_picocolors8.default.dim(", so nothing was stored")}
70801
- ${import_picocolors8.default.dim(`agentgates passwords code --from ${answer.site} --mailbox ${answer.mailbox}`)}
71013
+ ` ${import_picocolors9.default.dim("this site keeps no password: the account signs in with a code it emails")} ${import_picocolors9.default.bold(answer.email ?? "the mailbox")}${import_picocolors9.default.dim(", so nothing was stored")}
71014
+ ${import_picocolors9.default.dim(`agentgates passwords code --from ${answer.site} --mailbox ${answer.mailbox}`)}
70802
71015
  `
70803
71016
  );
70804
71017
  } else if (answer.password) {
70805
- process.stdout.write(` ${import_picocolors8.default.dim("not stored (--no-store); the password, once, on your screen now:")}
71018
+ process.stdout.write(` ${import_picocolors9.default.dim("not stored (--no-store); the password, once, on your screen now:")}
70806
71019
  ${answer.password}
70807
71020
  `);
70808
71021
  }
@@ -70813,8 +71026,8 @@ ${answer.digest.split("\n").slice(0, 12).map((l) => ` ${l}`).join("\n")}
70813
71026
  return;
70814
71027
  }
70815
71028
  process.stdout.write(`
70816
- ${answer.error ?? `HTTP ${answer.status}`}${answer.code ? import_picocolors8.default.dim(` (${answer.code})`) : ""}
70817
- ${answer.useId ? ` ${import_picocolors8.default.dim("use")} ${answer.useId}
71029
+ ${answer.error ?? `HTTP ${answer.status}`}${answer.code ? import_picocolors9.default.dim(` (${answer.code})`) : ""}
71030
+ ${answer.useId ? ` ${import_picocolors9.default.dim("use")} ${answer.useId}
70818
71031
  ` : ""}${answer.digest ? `
70819
71032
  ${answer.digest.split("\n").slice(0, 12).map((l) => ` ${l}`).join("\n")}
70820
71033
  ` : ""}
@@ -70874,12 +71087,12 @@ async function passwordsDevice(opts) {
70874
71087
  credentialId: `wallet:${me}`,
70875
71088
  passkeyBlob: sealDurable(Buffer.from(payloadJson, "utf8"), signature, wallet.address)
70876
71089
  });
70877
- emit3(opts, { ok: true, id: updated.id, label: updated.label, rpId: payload.device?.rpId ?? null, credentialId: payload.device?.credentialId ?? null, signCount: payload.device?.signCount ?? null, url: result.url ?? null }, () => {
71090
+ emit4(opts, { ok: true, id: updated.id, label: updated.label, rpId: payload.device?.rpId ?? null, credentialId: payload.device?.credentialId ?? null, signCount: payload.device?.signCount ?? null, url: result.url ?? null }, () => {
70878
71091
  process.stdout.write(
70879
71092
  `
70880
- ${import_picocolors8.default.green("\u2713")} a device credential for ${import_picocolors8.default.bold(String(payload.device?.rpId ?? ""))} is sealed into ${import_picocolors8.default.bold(updated.label)}
70881
- ${import_picocolors8.default.dim("the CVM completes the account's device step with it under a permit that lists device")}
70882
- ${import_picocolors8.default.dim(`agentgates passwords allow --factors device \xB7 then agentgates passwords use --row ${updated.id} --url ${opts.url}`)}
71093
+ ${import_picocolors9.default.green("\u2713")} a device credential for ${import_picocolors9.default.bold(String(payload.device?.rpId ?? ""))} is sealed into ${import_picocolors9.default.bold(updated.label)}
71094
+ ${import_picocolors9.default.dim("the CVM completes the account's device step with it under a permit that lists device")}
71095
+ ${import_picocolors9.default.dim(`agentgates passwords allow --factors device \xB7 then agentgates passwords use --row ${updated.id} --url ${opts.url}`)}
70883
71096
 
70884
71097
  `
70885
71098
  );
@@ -70899,9 +71112,9 @@ async function passwordsInvite(opts) {
70899
71112
  const { envelope: envelope2, signature } = decodeInviteFragment(hash2);
70900
71113
  if (inviteSigner(envelope2, signature) !== wallet.address.toLowerCase()) throw new PasswordsSealError("that invitation was not signed by this key");
70901
71114
  const out = await withdrawInvite(wallet, envelope2, signature);
70902
- emit3(opts, { ok: true, withdrawn: true, nonce: out.nonce }, () => {
71115
+ emit4(opts, { ok: true, withdrawn: true, nonce: out.nonce }, () => {
70903
71116
  process.stdout.write(`
70904
- ${import_picocolors8.default.green("\u2713")} withdrawn; that link opens nothing now
71117
+ ${import_picocolors9.default.green("\u2713")} withdrawn; that link opens nothing now
70905
71118
 
70906
71119
  `);
70907
71120
  });
@@ -70955,16 +71168,16 @@ async function passwordsInvite(opts) {
70955
71168
  };
70956
71169
  const inviteSignature = await signInvite(wallet, envelope);
70957
71170
  const link = `${siteOrigin()}${joinPath()}#${encodeInviteFragment(envelope, inviteSignature, secret)}`;
70958
- emit3(opts, { ok: true, link, agent: envelope.agent, rows: rows.map((r) => ({ id: r.id, label: r.label })), expiresAt: new Date(envelope.expiresAt * 1e3).toISOString(), minutes }, () => {
71171
+ emit4(opts, { ok: true, link, agent: envelope.agent, rows: rows.map((r) => ({ id: r.id, label: r.label })), expiresAt: new Date(envelope.expiresAt * 1e3).toISOString(), minutes }, () => {
70959
71172
  process.stdout.write(
70960
71173
  `
70961
- ${import_picocolors8.default.green("\u2713")} an invitation over ${rows.length} login${rows.length === 1 ? "" : "s"}, good for ${minutes} minutes
71174
+ ${import_picocolors9.default.green("\u2713")} an invitation over ${rows.length} login${rows.length === 1 ? "" : "s"}, good for ${minutes} minutes
70962
71175
 
70963
71176
  ${link}
70964
71177
 
70965
- ${import_picocolors8.default.dim("Whoever opens it takes these logins under their own wallet and sets the guardrails.")}
70966
- ${import_picocolors8.default.dim("The link is the key to them until it is used. Send it to one person, once.")}
70967
- ${import_picocolors8.default.dim("agentgates passwords invite --withdraw '<link>' \xB7 if it went to the wrong place")}
71178
+ ${import_picocolors9.default.dim("Whoever opens it takes these logins under their own wallet and sets the guardrails.")}
71179
+ ${import_picocolors9.default.dim("The link is the key to them until it is used. Send it to one person, once.")}
71180
+ ${import_picocolors9.default.dim("agentgates passwords invite --withdraw '<link>' \xB7 if it went to the wrong place")}
70968
71181
 
70969
71182
  `
70970
71183
  );
@@ -70975,7 +71188,7 @@ async function passwordsInvite(opts) {
70975
71188
  }
70976
71189
 
70977
71190
  // src/commands/browser.ts
70978
- var import_picocolors9 = __toESM(require_picocolors(), 1);
71191
+ var import_picocolors10 = __toESM(require_picocolors(), 1);
70979
71192
  init_passwords_wire();
70980
71193
  init_passwords_wire();
70981
71194
 
@@ -71075,7 +71288,7 @@ async function waitForTask(wallet, id2, { maxSeconds = 900, everyMs = 5e3, onTic
71075
71288
 
71076
71289
  // src/commands/browser.ts
71077
71290
  var jsonMode4 = (opts) => opts.json === true || !process.stdout.isTTY;
71078
- function emit4(opts, data4, human) {
71291
+ function emit5(opts, data4, human) {
71079
71292
  if (jsonMode4(opts)) {
71080
71293
  process.stdout.write(JSON.stringify(data4, null, 2) + "\n");
71081
71294
  return;
@@ -71086,7 +71299,7 @@ function refuse4(opts, error, code, extra = {}) {
71086
71299
  if (jsonMode4(opts)) {
71087
71300
  process.stdout.write(JSON.stringify({ ok: false, code, error, ...extra }, null, 2) + "\n");
71088
71301
  } else {
71089
- process.stderr.write(` ${error}${code ? import_picocolors9.default.dim(` (${code})`) : ""}
71302
+ process.stderr.write(` ${error}${code ? import_picocolors10.default.dim(` (${code})`) : ""}
71090
71303
  `);
71091
71304
  }
71092
71305
  process.exit(1);
@@ -71110,52 +71323,52 @@ var host = (url) => {
71110
71323
  };
71111
71324
  var when2 = (iso) => iso ? iso.replace("T", " ").slice(0, 16) : "";
71112
71325
  var STATUS_COLOR2 = {
71113
- queued: import_picocolors9.default.dim,
71114
- running: import_picocolors9.default.cyan,
71115
- done: import_picocolors9.default.green,
71116
- failed: import_picocolors9.default.red,
71117
- cancelled: import_picocolors9.default.dim
71326
+ queued: import_picocolors10.default.dim,
71327
+ running: import_picocolors10.default.cyan,
71328
+ done: import_picocolors10.default.green,
71329
+ failed: import_picocolors10.default.red,
71330
+ cancelled: import_picocolors10.default.dim
71118
71331
  };
71119
- var status2 = (s) => (STATUS_COLOR2[s] ?? import_picocolors9.default.dim)(s.padEnd(9));
71332
+ var status2 = (s) => (STATUS_COLOR2[s] ?? import_picocolors10.default.dim)(s.padEnd(9));
71120
71333
  function siteUrl(raw) {
71121
71334
  const t = raw.trim();
71122
71335
  return /^[a-z][a-z0-9+.-]*:\/\//i.test(t) ? t : `https://${t}`;
71123
71336
  }
71124
71337
  function printTask(t, full) {
71125
71338
  process.stdout.write(`
71126
- ${status2(t.status)} ${import_picocolors9.default.bold(t.id)} ${import_picocolors9.default.dim(host(t.url))} ${import_picocolors9.default.dim(`${t.stepsRun}/${t.maxSteps} steps`)}
71339
+ ${status2(t.status)} ${import_picocolors10.default.bold(t.id)} ${import_picocolors10.default.dim(host(t.url))} ${import_picocolors10.default.dim(`${t.stepsRun}/${t.maxSteps} steps`)}
71127
71340
  `);
71128
71341
  process.stdout.write(` ${t.goal}
71129
71342
  `);
71130
- if (t.status === "done") process.stdout.write(` ${import_picocolors9.default.dim(`charged ${usd6(t.chargedUsd)}`)}
71343
+ if (t.status === "done") process.stdout.write(` ${import_picocolors10.default.dim(`charged ${usd6(t.chargedUsd)}`)}
71131
71344
  `);
71132
- else if (t.status === "queued" || t.status === "running") process.stdout.write(` ${import_picocolors9.default.dim(`reserved ${usd6(t.reservedUsd)}`)}
71345
+ else if (t.status === "queued" || t.status === "running") process.stdout.write(` ${import_picocolors10.default.dim(`reserved ${usd6(t.reservedUsd)}`)}
71133
71346
  `);
71134
71347
  if (t.answer) process.stdout.write(`
71135
- ${import_picocolors9.default.bold("Answer")}
71348
+ ${import_picocolors10.default.bold("Answer")}
71136
71349
  ${t.answer.replace(/\n/g, "\n ")}
71137
71350
  `);
71138
71351
  if (t.status === "failed" && t.error) process.stdout.write(`
71139
- ${import_picocolors9.default.red(t.error)}${t.code ? import_picocolors9.default.dim(` (${t.code})`) : ""}
71352
+ ${import_picocolors10.default.red(t.error)}${t.code ? import_picocolors10.default.dim(` (${t.code})`) : ""}
71140
71353
  `);
71141
- if (t.reached) process.stdout.write(` ${import_picocolors9.default.dim("reached:")} ${t.reached}
71354
+ if (t.reached) process.stdout.write(` ${import_picocolors10.default.dim("reached:")} ${t.reached}
71142
71355
  `);
71143
- if (t.wall) process.stdout.write(` ${import_picocolors9.default.dim("stopped by:")} ${t.wall}
71356
+ if (t.wall) process.stdout.write(` ${import_picocolors10.default.dim("stopped by:")} ${t.wall}
71144
71357
  `);
71145
- if (t.finalUrl) process.stdout.write(` ${import_picocolors9.default.dim("ended on:")} ${t.finalUrl}
71358
+ if (t.finalUrl) process.stdout.write(` ${import_picocolors10.default.dim("ended on:")} ${t.finalUrl}
71146
71359
  `);
71147
71360
  if (full && t.findings?.length) {
71148
71361
  process.stdout.write(`
71149
- ${import_picocolors9.default.bold("Notes")}
71362
+ ${import_picocolors10.default.bold("Notes")}
71150
71363
  `);
71151
71364
  for (const f2 of t.findings) process.stdout.write(` - ${String(f2)}
71152
71365
  `);
71153
71366
  }
71154
71367
  if (full && t.transcript?.length) {
71155
71368
  process.stdout.write(`
71156
- ${import_picocolors9.default.bold("What it did")}
71369
+ ${import_picocolors10.default.bold("What it did")}
71157
71370
  `);
71158
- for (const s of t.transcript) process.stdout.write(` ${import_picocolors9.default.dim(s.line)}
71371
+ for (const s of t.transcript) process.stdout.write(` ${import_picocolors10.default.dim(s.line)}
71159
71372
  `);
71160
71373
  }
71161
71374
  process.stdout.write("\n");
@@ -71163,27 +71376,27 @@ function printTask(t, full) {
71163
71376
  async function browserPricing(opts) {
71164
71377
  try {
71165
71378
  const { product, usage, networks } = await readBrowserCatalog();
71166
- emit4(opts, { ok: true, product, usage, networks }, () => {
71379
+ emit5(opts, { ok: true, product, usage, networks }, () => {
71167
71380
  process.stdout.write(`
71168
- ${import_picocolors9.default.bold("BROWSER")} ${import_picocolors9.default.dim(product?.brief ?? "a site and a task in words; it browses, then answers")}
71381
+ ${import_picocolors10.default.bold("BROWSER")} ${import_picocolors10.default.dim(product?.brief ?? "a site and a task in words; it browses, then answers")}
71169
71382
 
71170
71383
  `);
71171
71384
  if (!product || product.available === false) {
71172
- process.stdout.write(` ${import_picocolors9.default.dim(product?.note ?? "the browser is not on sale right now")}
71385
+ process.stdout.write(` ${import_picocolors10.default.dim(product?.note ?? "the browser is not on sale right now")}
71173
71386
 
71174
71387
  `);
71175
71388
  return;
71176
71389
  }
71177
- if (usage?.stepUsd) process.stdout.write(` ${import_picocolors9.default.cyan(usd6(usage.stepUsd))} ${import_picocolors9.default.dim("a step, from the prepaid balance")}
71390
+ if (usage?.stepUsd) process.stdout.write(` ${import_picocolors10.default.cyan(usd6(usage.stepUsd))} ${import_picocolors10.default.dim("a step, from the prepaid balance")}
71178
71391
  `);
71179
71392
  if (usage) {
71180
- process.stdout.write(` ${import_picocolors9.default.dim(`steps 1 to ${usage.maxSteps} (default ${usage.defaultSteps}) \xB7 ${usage.minSeconds} to ${usage.maxSeconds} seconds \xB7 up to ${usage.maxHosts} extra hosts`)}
71393
+ process.stdout.write(` ${import_picocolors10.default.dim(`steps 1 to ${usage.maxSteps} (default ${usage.defaultSteps}) \xB7 ${usage.minSeconds} to ${usage.maxSeconds} seconds \xB7 up to ${usage.maxHosts} extra hosts`)}
71181
71394
  `);
71182
- process.stdout.write(` ${import_picocolors9.default.dim(usage.note)}
71395
+ process.stdout.write(` ${import_picocolors10.default.dim(usage.note)}
71183
71396
  `);
71184
71397
  }
71185
71398
  if (networks.length) process.stdout.write(`
71186
- ${import_picocolors9.default.dim(`balance top-ups in USDC on ${networks.join(", ")}`)}
71399
+ ${import_picocolors10.default.dim(`balance top-ups in USDC on ${networks.join(", ")}`)}
71187
71400
  `);
71188
71401
  process.stdout.write("\n");
71189
71402
  });
@@ -71202,34 +71415,34 @@ async function browserBalance(opts) {
71202
71415
  scan = { scanned: out.scanned, credited: out.credited };
71203
71416
  if (out.credited > 0) balance2 = await readIdentityBalance(keys2.wallet);
71204
71417
  }
71205
- emit4(opts, { ok: true, wallet: keys2.wallet.address, via: lastAuthVia(), loginKeyRevoked: loginKeyWasRevoked(), balance: balance2.balance, rungsUsd: balance2.rungsUsd, deposit, ...dark ? { depositDark: dark } : {}, ...scan ? { scan } : {} }, () => {
71418
+ emit5(opts, { ok: true, wallet: keys2.wallet.address, via: lastAuthVia(), loginKeyRevoked: loginKeyWasRevoked(), balance: balance2.balance, rungsUsd: balance2.rungsUsd, deposit, ...dark ? { depositDark: dark } : {}, ...scan ? { scan } : {} }, () => {
71206
71419
  process.stdout.write(`
71207
- ${import_picocolors9.default.bold("BALANCE")} ${import_picocolors9.default.dim(keys2.wallet.address)}
71420
+ ${import_picocolors10.default.bold("BALANCE")} ${import_picocolors10.default.dim(keys2.wallet.address)}
71208
71421
 
71209
71422
  `);
71210
71423
  if (balance2.balance) {
71211
- process.stdout.write(` ${import_picocolors9.default.cyan(usd6(balance2.balance.availableUsd))} ${import_picocolors9.default.dim("available")}`);
71212
- if (Number(balance2.balance.reservedUsd) > 0) process.stdout.write(import_picocolors9.default.dim(` \xB7 ${usd6(balance2.balance.reservedUsd)} reserved by tasks in flight`));
71424
+ process.stdout.write(` ${import_picocolors10.default.cyan(usd6(balance2.balance.availableUsd))} ${import_picocolors10.default.dim("available")}`);
71425
+ if (Number(balance2.balance.reservedUsd) > 0) process.stdout.write(import_picocolors10.default.dim(` \xB7 ${usd6(balance2.balance.reservedUsd)} reserved by tasks in flight`));
71213
71426
  process.stdout.write("\n");
71214
71427
  } else {
71215
- process.stdout.write(` ${import_picocolors9.default.dim("no balance under this key yet; a top-up opens it")}
71428
+ process.stdout.write(` ${import_picocolors10.default.dim("no balance under this key yet; a top-up opens it")}
71216
71429
  `);
71217
71430
  }
71218
- if (scan) process.stdout.write(` ${import_picocolors9.default.dim(scan.scanned ? `scanned now: ${scan.credited} arrival${scan.credited === 1 ? "" : "s"} credited` : "scanned moments ago; ask again in a few seconds")}
71431
+ if (scan) process.stdout.write(` ${import_picocolors10.default.dim(scan.scanned ? `scanned now: ${scan.credited} arrival${scan.credited === 1 ? "" : "s"} credited` : "scanned moments ago; ask again in a few seconds")}
71219
71432
  `);
71220
71433
  process.stdout.write("\n");
71221
71434
  if (deposit) {
71222
71435
  const names2 = deposit.chains.map((c) => c.network).join(" or ");
71223
- process.stdout.write(` ${import_picocolors9.default.bold("TOP UP")} ${import_picocolors9.default.dim(`send USDC on ${names2} to your own address`)}
71436
+ process.stdout.write(` ${import_picocolors10.default.bold("TOP UP")} ${import_picocolors10.default.dim(`send USDC on ${names2} to your own address`)}
71224
71437
  `);
71225
- process.stdout.write(` ${import_picocolors9.default.cyan(deposit.address)}
71438
+ process.stdout.write(` ${import_picocolors10.default.cyan(deposit.address)}
71226
71439
  `);
71227
- process.stdout.write(` ${import_picocolors9.default.dim(`credited after ${deposit.minConfirmations} confirmations; agentgates browser balance --scan credits a fresh arrival now`)}
71440
+ process.stdout.write(` ${import_picocolors10.default.dim(`credited after ${deposit.minConfirmations} confirmations; agentgates browser balance --scan credits a fresh arrival now`)}
71228
71441
  `);
71229
71442
  } else {
71230
- process.stdout.write(` ${import_picocolors9.default.dim(dark ?? "deposit addresses are not open yet")}
71443
+ process.stdout.write(` ${import_picocolors10.default.dim(dark ?? "deposit addresses are not open yet")}
71231
71444
  `);
71232
- if (balance2.rungsUsd.length) process.stdout.write(` ${import_picocolors9.default.dim(`top up over x402: POST /api/account/balance with {"amountUsd": ${balance2.rungsUsd[0]}} from a wallet that holds USDC`)}
71445
+ if (balance2.rungsUsd.length) process.stdout.write(` ${import_picocolors10.default.dim(`top up over x402: POST /api/account/balance with {"amountUsd": ${balance2.rungsUsd[0]}} from a wallet that holds USDC`)}
71233
71446
  `);
71234
71447
  }
71235
71448
  process.stdout.write("\n");
@@ -71332,13 +71545,13 @@ async function browserRun(url, opts) {
71332
71545
  maxSteps,
71333
71546
  maxSeconds,
71334
71547
  loginRow: opts.login,
71335
- note: jsonMode4(opts) ? void 0 : (line2) => process.stderr.write(` ${import_picocolors9.default.dim(line2)}
71548
+ note: jsonMode4(opts) ? void 0 : (line2) => process.stderr.write(` ${import_picocolors10.default.dim(line2)}
71336
71549
  `)
71337
71550
  });
71338
71551
  if (!opts.wait) {
71339
- emit4(opts, { ok: true, task }, () => {
71552
+ emit5(opts, { ok: true, task }, () => {
71340
71553
  printTask(task, false);
71341
- process.stdout.write(` ${import_picocolors9.default.dim(`read it back: agentgates browser task ${task.id} --wait`)}
71554
+ process.stdout.write(` ${import_picocolors10.default.dim(`read it back: agentgates browser task ${task.id} --wait`)}
71342
71555
 
71343
71556
  `);
71344
71557
  });
@@ -71351,13 +71564,13 @@ async function browserRun(url, opts) {
71351
71564
  onTick: (t) => {
71352
71565
  if (jsonMode4(opts) || t.status === lastStatus) return;
71353
71566
  lastStatus = t.status;
71354
- process.stderr.write(` ${import_picocolors9.default.dim(`${t.status}${t.status === "running" ? ` \xB7 ${t.stepsRun} steps` : ""}`)}
71567
+ process.stderr.write(` ${import_picocolors10.default.dim(`${t.status}${t.status === "running" ? ` \xB7 ${t.stepsRun} steps` : ""}`)}
71355
71568
  `);
71356
71569
  }
71357
71570
  });
71358
- emit4(opts, { ok: SETTLED.has(settled.status), task: settled }, () => {
71571
+ emit5(opts, { ok: SETTLED.has(settled.status), task: settled }, () => {
71359
71572
  printTask(settled, true);
71360
- if (!SETTLED.has(settled.status)) process.stdout.write(` ${import_picocolors9.default.dim(`still ${settled.status}; read it later: agentgates browser task ${settled.id} --wait`)}
71573
+ if (!SETTLED.has(settled.status)) process.stdout.write(` ${import_picocolors10.default.dim(`still ${settled.status}; read it later: agentgates browser task ${settled.id} --wait`)}
71361
71574
 
71362
71575
  `);
71363
71576
  });
@@ -71370,20 +71583,20 @@ async function browserTasks(opts) {
71370
71583
  try {
71371
71584
  const keys2 = await requirePasswordsKey();
71372
71585
  const tasks = await listTasks(keys2.wallet);
71373
- emit4(opts, { ok: true, wallet: keys2.wallet.address, tasks }, () => {
71586
+ emit5(opts, { ok: true, wallet: keys2.wallet.address, tasks }, () => {
71374
71587
  process.stdout.write(`
71375
- ${import_picocolors9.default.bold("YOUR TASKS")} ${import_picocolors9.default.dim(keys2.wallet.address)}
71588
+ ${import_picocolors10.default.bold("YOUR TASKS")} ${import_picocolors10.default.dim(keys2.wallet.address)}
71376
71589
 
71377
71590
  `);
71378
71591
  if (tasks.length === 0) {
71379
- process.stdout.write(` ${import_picocolors9.default.dim('none yet: agentgates browser run <url> --task "\u2026"')}
71592
+ process.stdout.write(` ${import_picocolors10.default.dim('none yet: agentgates browser run <url> --task "\u2026"')}
71380
71593
 
71381
71594
  `);
71382
71595
  return;
71383
71596
  }
71384
71597
  for (const t of tasks) {
71385
71598
  const money = t.status === "done" ? usd6(t.chargedUsd) : t.status === "queued" || t.status === "running" ? `${usd6(t.reservedUsd)} reserved` : "";
71386
- process.stdout.write(` ${status2(t.status)} ${t.id} ${import_picocolors9.default.dim(host(t.url).padEnd(24))} ${import_picocolors9.default.dim(`${t.stepsRun}/${t.maxSteps}`.padStart(6))} ${import_picocolors9.default.dim(money.padEnd(16))} ${import_picocolors9.default.dim(when2(t.createdAt))}
71599
+ process.stdout.write(` ${status2(t.status)} ${t.id} ${import_picocolors10.default.dim(host(t.url).padEnd(24))} ${import_picocolors10.default.dim(`${t.stepsRun}/${t.maxSteps}`.padStart(6))} ${import_picocolors10.default.dim(money.padEnd(16))} ${import_picocolors10.default.dim(when2(t.createdAt))}
71387
71600
  `);
71388
71601
  process.stdout.write(` ${t.goal.length > 90 ? `${t.goal.slice(0, 89)}\u2026` : t.goal}
71389
71602
  `);
@@ -71399,17 +71612,17 @@ async function browserTask(id2, opts) {
71399
71612
  const keys2 = await requirePasswordsKey();
71400
71613
  if (opts.cancel) {
71401
71614
  const task2 = await cancelTask(keys2.wallet, id2);
71402
- emit4(opts, { ok: true, task: task2 }, () => printTask(task2, false));
71615
+ emit5(opts, { ok: true, task: task2 }, () => printTask(task2, false));
71403
71616
  return;
71404
71617
  }
71405
71618
  const task = opts.wait ? await waitForTask(keys2.wallet, id2, {
71406
71619
  maxSeconds: typeof opts.wait === "string" ? Math.max(5, Number(opts.wait) || 0) : 900,
71407
71620
  onTick: (t) => {
71408
- if (!jsonMode4(opts) && !SETTLED.has(t.status)) process.stderr.write(` ${import_picocolors9.default.dim(`${t.status} \xB7 ${t.stepsRun} steps`)}
71621
+ if (!jsonMode4(opts) && !SETTLED.has(t.status)) process.stderr.write(` ${import_picocolors10.default.dim(`${t.status} \xB7 ${t.stepsRun} steps`)}
71409
71622
  `);
71410
71623
  }
71411
71624
  }) : await readTask(keys2.wallet, id2);
71412
- emit4(opts, { ok: true, task }, () => printTask(task, true));
71625
+ emit5(opts, { ok: true, task }, () => printTask(task, true));
71413
71626
  } catch (err) {
71414
71627
  failFrom3(opts, err);
71415
71628
  }
@@ -71475,7 +71688,7 @@ function installedVersionAt(place) {
71475
71688
  }
71476
71689
 
71477
71690
  // src/commands/update.ts
71478
- var import_picocolors10 = __toESM(require_picocolors(), 1);
71691
+ var import_picocolors11 = __toESM(require_picocolors(), 1);
71479
71692
  var jsonMode5 = (opts) => opts.json === true || !process.stdout.isTTY;
71480
71693
  async function update(opts = {}) {
71481
71694
  const latest = await fetchLatest();
@@ -71484,18 +71697,18 @@ async function update(opts = {}) {
71484
71697
  const base = { ok: true, package: PKG, current: LOCAL_VERSION, latest, stale, runsFrom: place.kind, ...place.kind === "home" ? { home: place.home } : place.kind === "checkout" ? { dir: place.dir } : {} };
71485
71698
  if (!latest) {
71486
71699
  if (jsonMode5(opts)) process.stdout.write(JSON.stringify({ ...base, ok: false, code: "registry_unreachable", error: "npm's registry did not answer; try again in a moment" }, null, 2) + "\n");
71487
- else process.stderr.write(` ${import_picocolors10.default.red("\u2715")} npm's registry did not answer; try again in a moment
71700
+ else process.stderr.write(` ${import_picocolors11.default.red("\u2715")} npm's registry did not answer; try again in a moment
71488
71701
  `);
71489
71702
  process.exit(1);
71490
71703
  }
71491
71704
  if (opts.check || !stale) {
71492
71705
  if (jsonMode5(opts)) process.stdout.write(JSON.stringify(base, null, 2) + "\n");
71493
71706
  else if (stale) process.stdout.write(`
71494
- ${import_picocolors10.default.yellow("\u2191")} ${latest} is out; this copy is ${LOCAL_VERSION}. ${import_picocolors10.default.dim("agentgates update \xB7 installs it")}
71707
+ ${import_picocolors11.default.yellow("\u2191")} ${latest} is out; this copy is ${LOCAL_VERSION}. ${import_picocolors11.default.dim("agentgates update \xB7 installs it")}
71495
71708
 
71496
71709
  `);
71497
71710
  else process.stdout.write(`
71498
- ${import_picocolors10.default.green("\u2713")} ${LOCAL_VERSION} is the latest
71711
+ ${import_picocolors11.default.green("\u2713")} ${LOCAL_VERSION} is the latest
71499
71712
 
71500
71713
  `);
71501
71714
  return;
@@ -71504,15 +71717,15 @@ async function update(opts = {}) {
71504
71717
  const line2 = `cd ${place.dir} && git pull --ff-only && npm run build`;
71505
71718
  if (jsonMode5(opts)) process.stdout.write(JSON.stringify({ ...base, ok: false, code: "checkout", line: line2, error: "this copy runs from a repository checkout; pull it" }, null, 2) + "\n");
71506
71719
  else process.stdout.write(`
71507
- this copy runs from a checkout at ${import_picocolors10.default.bold(place.dir)}; update it with
71508
- ${import_picocolors10.default.cyan(line2)}
71720
+ this copy runs from a checkout at ${import_picocolors11.default.bold(place.dir)}; update it with
71721
+ ${import_picocolors11.default.cyan(line2)}
71509
71722
 
71510
71723
  `);
71511
71724
  return;
71512
71725
  }
71513
71726
  if (!jsonMode5(opts)) process.stdout.write(`
71514
- ${import_picocolors10.default.bold("UPDATE")} ${LOCAL_VERSION} \u2192 ${latest} ${import_picocolors10.default.dim(place.kind === "home" ? `into ${place.home}` : "the global npm install")}
71515
- ${import_picocolors10.default.dim(`npm ${place.command.join(" ")}`)}
71727
+ ${import_picocolors11.default.bold("UPDATE")} ${LOCAL_VERSION} \u2192 ${latest} ${import_picocolors11.default.dim(place.kind === "home" ? `into ${place.home}` : "the global npm install")}
71728
+ ${import_picocolors11.default.dim(`npm ${place.command.join(" ")}`)}
71516
71729
 
71517
71730
  `);
71518
71731
  const code = await runNpm(place.command);
@@ -71522,12 +71735,12 @@ async function update(opts = {}) {
71522
71735
  process.stdout.write(JSON.stringify({ ...base, ok: done, code: done ? void 0 : "npm_failed", installed: now ?? void 0, exit: code }, null, 2) + "\n");
71523
71736
  } else if (done) {
71524
71737
  process.stdout.write(`
71525
- ${import_picocolors10.default.green("\u2713")} ${PKG} ${now ?? latest} is in. New terminals run it; this one already did.
71738
+ ${import_picocolors11.default.green("\u2713")} ${PKG} ${now ?? latest} is in. New terminals run it; this one already did.
71526
71739
 
71527
71740
  `);
71528
71741
  } else {
71529
71742
  process.stderr.write(`
71530
- ${import_picocolors10.default.red("\u2715")} npm exited ${code}. Run it by hand to see why:
71743
+ ${import_picocolors11.default.red("\u2715")} npm exited ${code}. Run it by hand to see why:
71531
71744
  npm ${place.command.join(" ")}
71532
71745
 
71533
71746
  `);
@@ -71549,7 +71762,7 @@ async function staleLine() {
71549
71762
  const latest = await fetchLatest(900);
71550
71763
  if (!latest || !olderThan(LOCAL_VERSION, latest)) return null;
71551
71764
  latestSeen = latest;
71552
- return ` ${import_picocolors11.default.yellow("\u2191")} ${latest} is out, this copy is ${LOCAL_VERSION} \xB7 ${import_picocolors11.default.bold("agentgates update")} installs it
71765
+ return ` ${import_picocolors12.default.yellow("\u2191")} ${latest} is out, this copy is ${LOCAL_VERSION} \xB7 ${import_picocolors12.default.bold("agentgates update")} installs it
71553
71766
 
71554
71767
  `;
71555
71768
  }
@@ -71561,9 +71774,9 @@ function makePut(w) {
71561
71774
  }
71562
71775
  function banner() {
71563
71776
  const w = water();
71564
- if (!w) process.stdout.write("\n" + import_picocolors11.default.cyan(WORDMARK) + "\n\n");
71777
+ if (!w) process.stdout.write("\n" + import_picocolors12.default.cyan(WORDMARK) + "\n\n");
71565
71778
  const put = makePut(w);
71566
- put(` ${import_picocolors11.default.dim(TAGLINE)}
71779
+ put(` ${import_picocolors12.default.dim(TAGLINE)}
71567
71780
 
71568
71781
  `);
71569
71782
  return { w, put };
@@ -71603,11 +71816,11 @@ function menuOrder(lane, hasAccount, stale) {
71603
71816
  return [...stale ? ["update"] : [], ...account, ...browse, "docs", "poke", "wallet"];
71604
71817
  }
71605
71818
  function printMenu(put, order, first) {
71606
- put(` ${import_picocolors11.default.bold(first ? "choose how to start:" : "what next:")}
71819
+ put(` ${import_picocolors12.default.bold(first ? "choose how to start:" : "what next:")}
71607
71820
  `);
71608
71821
  order.forEach((k, i) => {
71609
71822
  const item = MENU[k];
71610
- put(` ${import_picocolors11.default.cyan(`${i + 1}.`)} ${item.label}${item.hint ? ` ${import_picocolors11.default.dim(item.hint)}` : ""}
71823
+ put(` ${import_picocolors12.default.cyan(`${i + 1}.`)} ${item.label}${item.hint ? ` ${import_picocolors12.default.dim(item.hint)}` : ""}
71611
71824
  `);
71612
71825
  });
71613
71826
  }
@@ -71619,17 +71832,17 @@ async function printDocs(put, lane) {
71619
71832
  if (!res.ok) throw new Error(String(res.status));
71620
71833
  const md = (await res.text()).replace(/\s+$/, "");
71621
71834
  put(`
71622
- ${import_picocolors11.default.bold(`THE ${LANES[lead].name.toUpperCase()} CONTRACT`)} ${import_picocolors11.default.dim(url(lead))}
71835
+ ${import_picocolors12.default.bold(`THE ${LANES[lead].name.toUpperCase()} CONTRACT`)} ${import_picocolors12.default.dim(url(lead))}
71623
71836
 
71624
71837
  `);
71625
71838
  put(md + "\n\n");
71626
- for (const other of others) put(` ${import_picocolors11.default.dim(`the ${LANES[other].name} contract:`)} ${url(other)}
71839
+ for (const other of others) put(` ${import_picocolors12.default.dim(`the ${LANES[other].name} contract:`)} ${url(other)}
71627
71840
  `);
71628
71841
  put("\n");
71629
71842
  } catch {
71630
- put(` ${import_picocolors11.default.red("\u2715")} could not fetch the contract; the URLs:
71843
+ put(` ${import_picocolors12.default.red("\u2715")} could not fetch the contract; the URLs:
71631
71844
  `);
71632
- for (const l of LANE_ORDER) put(` ${import_picocolors11.default.cyan(LANES[l].name.padEnd(16))} ${url(l)}
71845
+ for (const l of LANE_ORDER) put(` ${import_picocolors12.default.cyan(LANES[l].name.padEnd(16))} ${url(l)}
71633
71846
  `);
71634
71847
  put("\n");
71635
71848
  }
@@ -71639,16 +71852,16 @@ async function onboard(opts = {}) {
71639
71852
  const { w, put } = banner();
71640
71853
  const existing = await loadProfile(profileName).catch(() => null);
71641
71854
  if (existing) {
71642
- put(` ${import_picocolors11.default.green("\u2713")} already paired as ${import_picocolors11.default.bold(existing.walletAddress ?? existing.userId)}
71855
+ put(` ${import_picocolors12.default.green("\u2713")} already paired as ${import_picocolors12.default.bold(existing.walletAddress ?? existing.userId)}
71643
71856
  `);
71644
71857
  }
71645
71858
  const account = await loadPasswordsKey().catch(() => null);
71646
71859
  if (account) {
71647
- put(` ${import_picocolors11.default.green("\u2713")} logged in as ${import_picocolors11.default.bold(account.state.address)} ${import_picocolors11.default.dim(account.state.mnemonic ? "(twelve words on this machine)" : "(a bare key)")}
71860
+ put(` ${import_picocolors12.default.green("\u2713")} logged in as ${import_picocolors12.default.bold(account.state.address)} ${import_picocolors12.default.dim(account.state.mnemonic ? "(twelve words on this machine)" : "(a bare key)")}
71648
71861
 
71649
71862
  `);
71650
71863
  } else {
71651
- put(` ${import_picocolors11.default.dim("no account on this machine yet: option 1 mints your twelve words")}
71864
+ put(` ${import_picocolors12.default.dim("no account on this machine yet: option 1 mints your twelve words")}
71652
71865
 
71653
71866
  `);
71654
71867
  }
@@ -71656,39 +71869,39 @@ async function onboard(opts = {}) {
71656
71869
  put(` No terminal attached, so no menu. The machine door:
71657
71870
 
71658
71871
  `);
71659
- put(` agentgates compute plans --json ${import_picocolors11.default.dim("\xB7 virtual machine pricing, JSON")}
71872
+ put(` agentgates compute plans --json ${import_picocolors12.default.dim("\xB7 virtual machine pricing, JSON")}
71660
71873
  `);
71661
- put(` agentgates inference models --json ${import_picocolors11.default.dim("\xB7 model pricing, JSON; --tier --tag --org --search filter it")}
71874
+ put(` agentgates inference models --json ${import_picocolors12.default.dim("\xB7 model pricing, JSON; --tier --tag --org --search filter it")}
71662
71875
  `);
71663
- put(` agentgates phone pricing --json ${import_picocolors11.default.dim("\xB7 number plans, usage and payphone windows, JSON")}
71876
+ put(` agentgates phone pricing --json ${import_picocolors12.default.dim("\xB7 number plans, usage and payphone windows, JSON")}
71664
71877
  `);
71665
- put(` agentgates email pricing --json ${import_picocolors11.default.dim("\xB7 the free inbox, plans and per-send price, JSON")}
71878
+ put(` agentgates email pricing --json ${import_picocolors12.default.dim("\xB7 the free inbox, plans and per-send price, JSON")}
71666
71879
  `);
71667
- put(` agentgates passwords pricing --json ${import_picocolors11.default.dim("\xB7 plans and per-use meter")}
71880
+ put(` agentgates passwords pricing --json ${import_picocolors12.default.dim("\xB7 plans and per-use meter")}
71668
71881
  `);
71669
- put(` agentgates init ${import_picocolors11.default.dim("\xB7 mint your twelve words: your account, printed once with what to tell your human")}
71882
+ put(` agentgates init ${import_picocolors12.default.dim("\xB7 mint your twelve words: your account, printed once with what to tell your human")}
71670
71883
  `);
71671
- put(` agentgates init --reveal-seed ${import_picocolors11.default.dim("\xB7 print them again")}
71884
+ put(` agentgates init --reveal-seed ${import_picocolors12.default.dim("\xB7 print them again")}
71672
71885
  `);
71673
- put(` agentgates browser balance --json ${import_picocolors11.default.dim("\xB7 your balance and the address that tops it up (USDC on Base or Polygon)")}
71886
+ put(` agentgates browser balance --json ${import_picocolors12.default.dim("\xB7 your balance and the address that tops it up (USDC on Base or Polygon)")}
71674
71887
  `);
71675
- put(` agentgates open ${import_picocolors11.default.dim("\xB7 hand this session to a human's browser on this machine")}
71888
+ put(` agentgates open ${import_picocolors12.default.dim("\xB7 hand this session to a human's browser on this machine")}
71676
71889
  `);
71677
- put(` ${CREATORS_ORIGIN}/api/compute/docs ${import_picocolors11.default.dim("\xB7 the buy/read/renew/destroy contract")}
71890
+ put(` ${CREATORS_ORIGIN}/api/compute/docs ${import_picocolors12.default.dim("\xB7 the buy/read/renew/destroy contract")}
71678
71891
  `);
71679
- put(` ${CREATORS_ORIGIN}/api/inference/docs ${import_picocolors11.default.dim("\xB7 the chat contract, x402 or Bearer")}
71892
+ put(` ${CREATORS_ORIGIN}/api/inference/docs ${import_picocolors12.default.dim("\xB7 the chat contract, x402 or Bearer")}
71680
71893
  `);
71681
- put(` ${CREATORS_ORIGIN}/api/account/docs/phone ${import_picocolors11.default.dim("\xB7 the phone contract: numbers, texts, calls, the payphone")}
71894
+ put(` ${CREATORS_ORIGIN}/api/account/docs/phone ${import_picocolors12.default.dim("\xB7 the phone contract: numbers, texts, calls, the payphone")}
71682
71895
  `);
71683
- put(` ${CREATORS_ORIGIN}/api/account/docs/email ${import_picocolors11.default.dim("\xB7 the email contract: inboxes, plans, sends, wait-code")}
71896
+ put(` ${CREATORS_ORIGIN}/api/account/docs/email ${import_picocolors12.default.dim("\xB7 the email contract: inboxes, plans, sends, wait-code")}
71684
71897
  `);
71685
- put(` ${CREATORS_ORIGIN}/api/account/docs/passwords ${import_picocolors11.default.dim("\xB7 the passwords contract: store, permits, uses")}
71898
+ put(` ${CREATORS_ORIGIN}/api/account/docs/passwords ${import_picocolors12.default.dim("\xB7 the passwords contract: store, permits, uses")}
71686
71899
  `);
71687
- put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors11.default.dim("\xB7 the whole surface")}
71900
+ put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors12.default.dim("\xB7 the whole surface")}
71688
71901
 
71689
71902
  `);
71690
71903
  if (!existing) {
71691
- put(` Pairing a wallet needs a human at a browser: ${import_picocolors11.default.bold("agentgates onboard")} in a real terminal.
71904
+ put(` Pairing a wallet needs a human at a browser: ${import_picocolors12.default.bold("agentgates onboard")} in a real terminal.
71692
71905
 
71693
71906
  `);
71694
71907
  }
@@ -71709,7 +71922,7 @@ async function onboard(opts = {}) {
71709
71922
  const fallback = first ? "1" : exitDefault;
71710
71923
  let choice;
71711
71924
  try {
71712
- choice = (await rl.question(` ${import_picocolors11.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
71925
+ choice = (await rl.question(` ${import_picocolors12.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
71713
71926
  } catch {
71714
71927
  if (first) w?.stop();
71715
71928
  process.stdout.write("\n");
@@ -71733,7 +71946,7 @@ async function onboard(opts = {}) {
71733
71946
  await runLoginFlow({ profile: profileName, jsonMode: false, ttyHeader: "Pairing this terminal with your wallet\u2026" });
71734
71947
  process.stdout.write("\n");
71735
71948
  } catch {
71736
- plain(` ${import_picocolors11.default.red("\u2715")} pairing didn't complete
71949
+ plain(` ${import_picocolors12.default.red("\u2715")} pairing didn't complete
71737
71950
 
71738
71951
  `);
71739
71952
  }
@@ -71742,7 +71955,7 @@ async function onboard(opts = {}) {
71742
71955
  try {
71743
71956
  await update({});
71744
71957
  } catch {
71745
- plain(` ${import_picocolors11.default.red("\u2715")} the update did not run; try: agentgates update
71958
+ plain(` ${import_picocolors12.default.red("\u2715")} the update did not run; try: agentgates update
71746
71959
 
71747
71960
  `);
71748
71961
  }
@@ -71751,7 +71964,7 @@ async function onboard(opts = {}) {
71751
71964
  try {
71752
71965
  await passwordsInit({});
71753
71966
  } catch {
71754
- plain(` ${import_picocolors11.default.red("\u2715")} the account could not be read or minted
71967
+ plain(` ${import_picocolors12.default.red("\u2715")} the account could not be read or minted
71755
71968
 
71756
71969
  `);
71757
71970
  }
@@ -71760,7 +71973,7 @@ async function onboard(opts = {}) {
71760
71973
  try {
71761
71974
  await passwordsInit({ revealSeed: true });
71762
71975
  } catch {
71763
- plain(` ${import_picocolors11.default.red("\u2715")} the words could not be read
71976
+ plain(` ${import_picocolors12.default.red("\u2715")} the words could not be read
71764
71977
 
71765
71978
  `);
71766
71979
  }
@@ -71769,7 +71982,7 @@ async function onboard(opts = {}) {
71769
71982
  try {
71770
71983
  await browserBalance({});
71771
71984
  } catch {
71772
- plain(` ${import_picocolors11.default.red("\u2715")} the balance could not be read
71985
+ plain(` ${import_picocolors12.default.red("\u2715")} the balance could not be read
71773
71986
 
71774
71987
  `);
71775
71988
  }
@@ -71778,7 +71991,7 @@ async function onboard(opts = {}) {
71778
71991
  try {
71779
71992
  await computePlans({});
71780
71993
  } catch {
71781
- plain(` ${import_picocolors11.default.red("\u2715")} could not read the compute catalog
71994
+ plain(` ${import_picocolors12.default.red("\u2715")} could not read the compute catalog
71782
71995
 
71783
71996
  `);
71784
71997
  }
@@ -71787,7 +72000,7 @@ async function onboard(opts = {}) {
71787
72000
  try {
71788
72001
  await inferenceModels({});
71789
72002
  } catch {
71790
- plain(` ${import_picocolors11.default.red("\u2715")} could not read the model catalog
72003
+ plain(` ${import_picocolors12.default.red("\u2715")} could not read the model catalog
71791
72004
 
71792
72005
  `);
71793
72006
  }
@@ -71796,7 +72009,7 @@ async function onboard(opts = {}) {
71796
72009
  try {
71797
72010
  await phonePricing({});
71798
72011
  } catch {
71799
- plain(` ${import_picocolors11.default.red("\u2715")} could not read the phone catalog
72012
+ plain(` ${import_picocolors12.default.red("\u2715")} could not read the phone catalog
71800
72013
 
71801
72014
  `);
71802
72015
  }
@@ -71805,7 +72018,7 @@ async function onboard(opts = {}) {
71805
72018
  try {
71806
72019
  await emailPricing({});
71807
72020
  } catch {
71808
- plain(` ${import_picocolors11.default.red("\u2715")} could not read the email catalog
72021
+ plain(` ${import_picocolors12.default.red("\u2715")} could not read the email catalog
71809
72022
 
71810
72023
  `);
71811
72024
  }
@@ -71814,7 +72027,7 @@ async function onboard(opts = {}) {
71814
72027
  try {
71815
72028
  await passwordsPricing({});
71816
72029
  } catch {
71817
- plain(` ${import_picocolors11.default.red("\u2715")} could not read the passwords catalog
72030
+ plain(` ${import_picocolors12.default.red("\u2715")} could not read the passwords catalog
71818
72031
 
71819
72032
  `);
71820
72033
  }
@@ -71830,27 +72043,27 @@ async function onboard(opts = {}) {
71830
72043
  }
71831
72044
  }
71832
72045
  function printNext(put) {
71833
- put(` ${import_picocolors11.default.dim("agentgates init")} ${import_picocolors11.default.dim("\xB7 your account: mint the twelve words, or show it; --reveal-seed prints the words")}
72046
+ put(` ${import_picocolors12.default.dim("agentgates init")} ${import_picocolors12.default.dim("\xB7 your account: mint the twelve words, or show it; --reveal-seed prints the words")}
71834
72047
  `);
71835
- put(` ${import_picocolors11.default.dim("agentgates browser balance")} ${import_picocolors11.default.dim("\xB7 your balance and the address that tops it up")}
72048
+ put(` ${import_picocolors12.default.dim("agentgates browser balance")} ${import_picocolors12.default.dim("\xB7 your balance and the address that tops it up")}
71836
72049
  `);
71837
- put(` ${import_picocolors11.default.dim("agentgates compute plans")} ${import_picocolors11.default.dim("\xB7 virtual machines by the hour")}
72050
+ put(` ${import_picocolors12.default.dim("agentgates compute plans")} ${import_picocolors12.default.dim("\xB7 virtual machines by the hour")}
71838
72051
  `);
71839
- put(` ${import_picocolors11.default.dim("agentgates inference models")} ${import_picocolors11.default.dim("\xB7 models by the token")}
72052
+ put(` ${import_picocolors12.default.dim("agentgates inference models")} ${import_picocolors12.default.dim("\xB7 models by the token")}
71840
72053
  `);
71841
- put(` ${import_picocolors11.default.dim("agentgates phone pricing")} ${import_picocolors11.default.dim("\xB7 numbers by the month, calls by the minute")}
72054
+ put(` ${import_picocolors12.default.dim("agentgates phone pricing")} ${import_picocolors12.default.dim("\xB7 numbers by the month, calls by the minute")}
71842
72055
  `);
71843
- put(` ${import_picocolors11.default.dim("agentgates email pricing")} ${import_picocolors11.default.dim("\xB7 inboxes free on a balance, sends per message")}
72056
+ put(` ${import_picocolors12.default.dim("agentgates email pricing")} ${import_picocolors12.default.dim("\xB7 inboxes free on a balance, sends per message")}
71844
72057
  `);
71845
- put(` ${import_picocolors11.default.dim("agentgates passwords pricing")} ${import_picocolors11.default.dim("\xB7 logins an agent uses and never sees")}
72058
+ put(` ${import_picocolors12.default.dim("agentgates passwords pricing")} ${import_picocolors12.default.dim("\xB7 logins an agent uses and never sees")}
71846
72059
  `);
71847
- put(` ${import_picocolors11.default.dim("agentgates --help")} ${import_picocolors11.default.dim("\xB7 everything else")}
72060
+ put(` ${import_picocolors12.default.dim("agentgates --help")} ${import_picocolors12.default.dim("\xB7 everything else")}
71848
72061
 
71849
72062
  `);
71850
72063
  }
71851
72064
 
71852
72065
  // src/commands/mcp.ts
71853
- var import_picocolors12 = __toESM(require_picocolors(), 1);
72066
+ var import_picocolors13 = __toESM(require_picocolors(), 1);
71854
72067
  init_constants();
71855
72068
  init_passwords_wire();
71856
72069
 
@@ -71872,7 +72085,7 @@ var INVALID_PARAMS = -32602;
71872
72085
  function reply(id2, result) {
71873
72086
  return { jsonrpc: "2.0", id: id2, result };
71874
72087
  }
71875
- function fail(id2, code, message, data4) {
72088
+ function fail2(id2, code, message, data4) {
71876
72089
  return { jsonrpc: "2.0", id: id2, error: data4 === void 0 ? { code, message } : { code, message, data: data4 } };
71877
72090
  }
71878
72091
  function parseLine(line2) {
@@ -71880,10 +72093,10 @@ function parseLine(line2) {
71880
72093
  if (!trimmed) return null;
71881
72094
  try {
71882
72095
  const parsed = JSON.parse(trimmed);
71883
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { response: fail(null, INVALID_REQUEST, "a JSON-RPC message is an object") };
72096
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { response: fail2(null, INVALID_REQUEST, "a JSON-RPC message is an object") };
71884
72097
  return { message: parsed };
71885
72098
  } catch {
71886
- return { response: fail(null, PARSE_ERROR, "the line is not JSON") };
72099
+ return { response: fail2(null, PARSE_ERROR, "the line is not JSON") };
71887
72100
  }
71888
72101
  }
71889
72102
  function toolResult(value) {
@@ -71907,7 +72120,7 @@ async function dispatch(message, tools, info) {
71907
72120
  const id2 = message.id === void 0 ? null : message.id;
71908
72121
  const isNotification = message.id === void 0;
71909
72122
  if (typeof message.method !== "string") {
71910
- return isNotification ? null : fail(id2, INVALID_REQUEST, "a request names a method");
72123
+ return isNotification ? null : fail2(id2, INVALID_REQUEST, "a request names a method");
71911
72124
  }
71912
72125
  const params = message.params && typeof message.params === "object" ? message.params : {};
71913
72126
  switch (message.method) {
@@ -71933,7 +72146,7 @@ async function dispatch(message, tools, info) {
71933
72146
  case "tools/call": {
71934
72147
  const name = typeof params.name === "string" ? params.name : "";
71935
72148
  const tool = tools.find((t) => t.name === name);
71936
- if (!tool) return fail(id2, INVALID_PARAMS, `no tool named "${name}"`);
72149
+ if (!tool) return fail2(id2, INVALID_PARAMS, `no tool named "${name}"`);
71937
72150
  const args = params.arguments && typeof params.arguments === "object" && !Array.isArray(params.arguments) ? params.arguments : {};
71938
72151
  try {
71939
72152
  return reply(id2, toolResult(await tool.handler(args)));
@@ -71948,7 +72161,7 @@ async function dispatch(message, tools, info) {
71948
72161
  case "prompts/list":
71949
72162
  return reply(id2, { prompts: [] });
71950
72163
  default:
71951
- return isNotification ? null : fail(id2, METHOD_NOT_FOUND, `no method "${message.method}"`);
72164
+ return isNotification ? null : fail2(id2, METHOD_NOT_FOUND, `no method "${message.method}"`);
71952
72165
  }
71953
72166
  }
71954
72167
  async function serve(tools, info, { input = process.stdin, output: output2 = process.stdout } = {}) {
@@ -71969,7 +72182,7 @@ async function serve(tools, info, { input = process.stdin, output: output2 = pro
71969
72182
  if (response) send2(response);
71970
72183
  }).catch((err) => {
71971
72184
  const id2 = parsed.message.id === void 0 ? null : parsed.message.id;
71972
- if (id2 !== null) send2(fail(id2, -32603, err instanceof Error ? err.message : String(err)));
72185
+ if (id2 !== null) send2(fail2(id2, -32603, err instanceof Error ? err.message : String(err)));
71973
72186
  }).finally(() => {
71974
72187
  inFlight.delete(job);
71975
72188
  });
@@ -72018,12 +72231,12 @@ function mcpTools() {
72018
72231
  description: "This machine's Agentgates key: the address a person allows on their Passwords board (agentgates passwords allow --agent <address>), and where the key lives. No network, no cost.",
72019
72232
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
72020
72233
  handler: async () => {
72021
- const { wallet } = await requirePasswordsKey();
72234
+ const { state } = await requirePasswordsKey();
72022
72235
  return {
72023
72236
  ok: true,
72024
- address: wallet.address,
72237
+ address: state.address,
72025
72238
  key: process.env.AGENTGATES_PASSWORDS_SEED ? "AGENTGATES_PASSWORDS_SEED" : passwordsKeyPath(),
72026
- allow: `agentgates passwords allow --agent ${wallet.address}`
72239
+ allow: `agentgates passwords allow --agent ${state.address}`
72027
72240
  };
72028
72241
  }
72029
72242
  },
@@ -72032,9 +72245,9 @@ function mcpTools() {
72032
72245
  description: "The saved logins this key holds and the ones it may use under a permit: id, label, kind, hosts, username. Clear fields only; no secret ever rides. Free.",
72033
72246
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
72034
72247
  handler: async () => {
72035
- const { wallet } = await requirePasswordsKey();
72248
+ const { wallet, state } = await requirePasswordsKey();
72036
72249
  const rows = await listRows(wallet);
72037
- return { ok: true, address: wallet.address, ...rows };
72250
+ return { ok: true, address: state.address, ...rows };
72038
72251
  }
72039
72252
  },
72040
72253
  {
@@ -72337,20 +72550,20 @@ function mcpInstall() {
72337
72550
  const config = JSON.stringify({ mcpServers: { agentgates: { command: "agentgates", args: ["mcp"] } } }, null, 2);
72338
72551
  process.stdout.write(
72339
72552
  `
72340
- ${import_picocolors12.default.bold("Claude Code")}
72553
+ ${import_picocolors13.default.bold("Claude Code")}
72341
72554
  claude mcp add agentgates -- agentgates mcp
72342
72555
 
72343
- ${import_picocolors12.default.bold("Cursor, Windsurf, any MCP client")} ${import_picocolors12.default.dim("(its mcp config file)")}
72556
+ ${import_picocolors13.default.bold("Cursor, Windsurf, any MCP client")} ${import_picocolors13.default.dim("(its mcp config file)")}
72344
72557
  ${config.split("\n").map((l) => ` ${l}`).join("\n")}
72345
72558
 
72346
- ${import_picocolors12.default.dim("The server signs with this machine's key (agentgates init). Tools: " + mcpTools().map((t) => t.name).join(", ") + ".")}
72559
+ ${import_picocolors13.default.dim("The server signs with this machine's key (agentgates init). Tools: " + mcpTools().map((t) => t.name).join(", ") + ".")}
72347
72560
 
72348
72561
  `
72349
72562
  );
72350
72563
  }
72351
72564
 
72352
72565
  // src/commands/intents.ts
72353
- var import_picocolors13 = __toESM(require_picocolors(), 1);
72566
+ var import_picocolors14 = __toESM(require_picocolors(), 1);
72354
72567
  init_passwords_wire();
72355
72568
 
72356
72569
  // src/lib/intents-wire.ts
@@ -72578,7 +72791,7 @@ function firstSentence(words7) {
72578
72791
 
72579
72792
  // src/commands/intents.ts
72580
72793
  var jsonMode6 = (opts) => opts.json === true || !process.stdout.isTTY;
72581
- function emit5(opts, data4, human) {
72794
+ function emit6(opts, data4, human) {
72582
72795
  if (jsonMode6(opts)) {
72583
72796
  process.stdout.write(JSON.stringify(data4, null, 2) + "\n");
72584
72797
  return;
@@ -72589,7 +72802,7 @@ function refuse5(opts, error, code, extra = {}) {
72589
72802
  if (jsonMode6(opts)) {
72590
72803
  process.stdout.write(JSON.stringify({ ok: false, code, error, ...extra }, null, 2) + "\n");
72591
72804
  } else {
72592
- process.stderr.write(` ${error}${code ? import_picocolors13.default.dim(` (${code})`) : ""}
72805
+ process.stderr.write(` ${error}${code ? import_picocolors14.default.dim(` (${code})`) : ""}
72593
72806
  `);
72594
72807
  if (typeof extra.hint === "string") process.stderr.write(` ${extra.hint}
72595
72808
  `);
@@ -72600,7 +72813,7 @@ function failFrom4(opts, err) {
72600
72813
  if (err instanceof WireError) return refuse5(opts, err.message, err.code, { status: err.status });
72601
72814
  return refuse5(opts, err.message ?? String(err), null);
72602
72815
  }
72603
- var line = (label, value) => void process.stdout.write(` ${import_picocolors13.default.dim(label.padEnd(11))}${value}
72816
+ var line = (label, value) => void process.stdout.write(` ${import_picocolors14.default.dim(label.padEnd(11))}${value}
72604
72817
  `);
72605
72818
  function whenOf(value, what) {
72606
72819
  const raw = value.trim();
@@ -72608,19 +72821,19 @@ function whenOf(value, what) {
72608
72821
  if (!Number.isFinite(ms)) throw new Error(`${what}: a time like "2026-09-11 20:00" (got ${value})`);
72609
72822
  return new Date(ms).toISOString();
72610
72823
  }
72611
- var shortAsk = (a) => `${import_picocolors13.default.dim(a.id)} ${a.state.padEnd(9)} ${a.city.padEnd(16)} ${new Date(a.windowFrom).toLocaleString()} ${import_picocolors13.default.dim(`$${usdOf(a.capMicro)}`)}
72824
+ var shortAsk = (a) => `${import_picocolors14.default.dim(a.id)} ${a.state.padEnd(9)} ${a.city.padEnd(16)} ${new Date(a.windowFrom).toLocaleString()} ${import_picocolors14.default.dim(`$${usdOf(a.capMicro)}`)}
72612
72825
  ${a.derived?.publicText ?? a.text}`;
72613
72826
  var shortOffer = (o) => {
72614
72827
  const price = o.kind === "mutual" ? "mutual" : o.house === true ? "at the venue" : `$${usdOf(o.priceMicro)}`;
72615
- const by = o.house === true ? "Agentgates books it" : import_picocolors13.default.dim(o.offerer);
72616
- return `${import_picocolors13.default.dim(o.id)} ${o.state.padEnd(10)} ${o.role.padEnd(12)} ${price.padEnd(12)} ${new Date(o.startsAt).toLocaleString()}
72828
+ const by = o.house === true ? "Agentgates books it" : import_picocolors14.default.dim(o.offerer);
72829
+ return `${import_picocolors14.default.dim(o.id)} ${o.state.padEnd(10)} ${o.role.padEnd(12)} ${price.padEnd(12)} ${new Date(o.startsAt).toLocaleString()}
72617
72830
  ${o.text}
72618
72831
  ${by}`;
72619
72832
  };
72620
72833
  var shortStep = (s) => {
72621
72834
  const { who, what, when: when3 } = stepWords(s);
72622
72835
  const tail = [when3 ? new Date(when3).toLocaleString() : "", s.costUsd ? `$${s.costUsd}` : ""].filter(Boolean).join(" ");
72623
- return `${s.state.padEnd(8)} ${who.padEnd(18)} ${what}${tail ? ` ${import_picocolors13.default.dim(tail)}` : ""}`;
72836
+ return `${s.state.padEnd(8)} ${who.padEnd(18)} ${what}${tail ? ` ${import_picocolors14.default.dim(tail)}` : ""}`;
72624
72837
  };
72625
72838
  async function intentsPost(text, opts) {
72626
72839
  try {
@@ -72639,9 +72852,9 @@ async function intentsPost(text, opts) {
72639
72852
  ...opts.publicText ? { publicText: opts.publicText } : {},
72640
72853
  ...bookingName ? { bookingName } : {}
72641
72854
  });
72642
- emit5(opts, { ok: true, ask }, () => {
72855
+ emit6(opts, { ok: true, ask }, () => {
72643
72856
  process.stdout.write(`
72644
- ${import_picocolors13.default.bold("Posted.")} Offers come in until your agent decides.
72857
+ ${import_picocolors14.default.bold("Posted.")} Offers come in until your agent decides.
72645
72858
 
72646
72859
  `);
72647
72860
  line("ask", ask.id);
@@ -72651,7 +72864,7 @@ async function intentsPost(text, opts) {
72651
72864
  line("decides", new Date(ask.decideAt).toLocaleString());
72652
72865
  if (ask.derived?.publicText) line("public", ask.derived.publicText);
72653
72866
  process.stdout.write(`
72654
- ${import_picocolors13.default.dim(`agentgates intents show ${ask.id}`)}
72867
+ ${import_picocolors14.default.dim(`agentgates intents show ${ask.id}`)}
72655
72868
 
72656
72869
  `);
72657
72870
  });
@@ -72663,10 +72876,10 @@ async function intentsList(opts) {
72663
72876
  try {
72664
72877
  const { wallet } = await requirePasswordsKey();
72665
72878
  const asks = await listAsks(wallet);
72666
- emit5(opts, { ok: true, asks }, () => {
72879
+ emit6(opts, { ok: true, asks }, () => {
72667
72880
  if (asks.length === 0) {
72668
72881
  process.stdout.write(`
72669
- Nothing posted yet. ${import_picocolors13.default.dim('agentgates intents post "\u2026"')}
72882
+ Nothing posted yet. ${import_picocolors14.default.dim('agentgates intents post "\u2026"')}
72670
72883
 
72671
72884
  `);
72672
72885
  return;
@@ -72684,9 +72897,9 @@ async function intentsShow(id2, opts) {
72684
72897
  try {
72685
72898
  const { wallet } = await requirePasswordsKey();
72686
72899
  const d = await readAsk(wallet, id2);
72687
- emit5(opts, { ok: true, ...d }, () => {
72900
+ emit6(opts, { ok: true, ...d }, () => {
72688
72901
  process.stdout.write(`
72689
- ${import_picocolors13.default.bold(d.ask.text)}
72902
+ ${import_picocolors14.default.bold(d.ask.text)}
72690
72903
 
72691
72904
  `);
72692
72905
  line("ask", d.ask.id);
@@ -72695,17 +72908,17 @@ async function intentsShow(id2, opts) {
72695
72908
  line("budget", `$${usdOf(d.ask.capMicro)}`);
72696
72909
  if (d.plan) {
72697
72910
  process.stdout.write(`
72698
- ${import_picocolors13.default.bold("The plan")} ${import_picocolors13.default.dim(`(${d.plan.state}, decided by ${d.plan.decidedBy})`)}
72911
+ ${import_picocolors14.default.bold("The plan")} ${import_picocolors14.default.dim(`(${d.plan.state}, decided by ${d.plan.decidedBy})`)}
72699
72912
  `);
72700
72913
  if (d.plan.rationale) process.stdout.write(` ${d.plan.rationale}
72701
72914
  `);
72702
72915
  line("total", `$${usdOf(d.plan.totalMicro)}`);
72703
- for (const q of d.plan.questions) process.stdout.write(` ${import_picocolors13.default.dim("asks you")} ${q.why}
72916
+ for (const q of d.plan.questions) process.stdout.write(` ${import_picocolors14.default.dim("asks you")} ${q.why}
72704
72917
  `);
72705
72918
  }
72706
72919
  if (d.offers.length) {
72707
72920
  process.stdout.write(`
72708
- ${import_picocolors13.default.bold("Offers")}
72921
+ ${import_picocolors14.default.bold("Offers")}
72709
72922
  `);
72710
72923
  for (const o of d.offers) process.stdout.write(` ${shortOffer(o)}
72711
72924
 
@@ -72713,18 +72926,18 @@ async function intentsShow(id2, opts) {
72713
72926
  }
72714
72927
  const steps = d.steps ?? [];
72715
72928
  if (steps.length) {
72716
- process.stdout.write(` ${import_picocolors13.default.bold("What your agent did")}
72929
+ process.stdout.write(` ${import_picocolors14.default.bold("What your agent did")}
72717
72930
  `);
72718
72931
  for (const s of steps) process.stdout.write(` ${shortStep(s)}
72719
72932
  `);
72720
72933
  process.stdout.write("\n");
72721
72934
  }
72722
72935
  if (d.settlements.length) {
72723
- process.stdout.write(` ${import_picocolors13.default.bold("Money")}
72936
+ process.stdout.write(` ${import_picocolors14.default.bold("Money")}
72724
72937
  `);
72725
72938
  for (const s of d.settlements) {
72726
- const tx = s.settledTx ? import_picocolors13.default.dim(` ${s.settledTx}`) : "";
72727
- process.stdout.write(` ${import_picocolors13.default.dim(s.offerId)} ${s.state.padEnd(10)} $${usdOf(s.valueMicro)} \u2192 ${s.toAddr}${tx}
72939
+ const tx = s.settledTx ? import_picocolors14.default.dim(` ${s.settledTx}`) : "";
72940
+ process.stdout.write(` ${import_picocolors14.default.dim(s.offerId)} ${s.state.padEnd(10)} $${usdOf(s.valueMicro)} \u2192 ${s.toAddr}${tx}
72728
72941
  `);
72729
72942
  }
72730
72943
  process.stdout.write("\n");
@@ -72738,9 +72951,9 @@ async function intentsDecide(id2, opts) {
72738
72951
  try {
72739
72952
  const { wallet } = await requirePasswordsKey();
72740
72953
  const out = await decideAsk(wallet, id2);
72741
- emit5(opts, { ok: true, ...out }, () => {
72954
+ emit6(opts, { ok: true, ...out }, () => {
72742
72955
  process.stdout.write(`
72743
- ${import_picocolors13.default.bold("Your agent decided.")} ${import_picocolors13.default.dim(`(${out.plan.decidedBy})`)}
72956
+ ${import_picocolors14.default.bold("Your agent decided.")} ${import_picocolors14.default.dim(`(${out.plan.decidedBy})`)}
72744
72957
 
72745
72958
  `);
72746
72959
  if (out.plan.rationale) process.stdout.write(` ${out.plan.rationale}
@@ -72748,10 +72961,10 @@ async function intentsDecide(id2, opts) {
72748
72961
  `);
72749
72962
  line("picks", out.plan.offerIds.join(", ") || "none");
72750
72963
  line("total", `$${usdOf(out.plan.totalMicro)}`);
72751
- for (const q of out.plan.questions) process.stdout.write(` ${import_picocolors13.default.dim("asks you")} ${q.why}
72964
+ for (const q of out.plan.questions) process.stdout.write(` ${import_picocolors14.default.dim("asks you")} ${q.why}
72752
72965
  `);
72753
72966
  process.stdout.write(`
72754
- ${import_picocolors13.default.dim(`agentgates intents pay ${id2} --pick <offerId>`)}
72967
+ ${import_picocolors14.default.dim(`agentgates intents pay ${id2} --pick <offerId>`)}
72755
72968
 
72756
72969
  `);
72757
72970
  });
@@ -72778,20 +72991,20 @@ async function intentsPay(id2, opts) {
72778
72991
  const group = escrowGroupToSign(answered.escrow ?? [], opts.network);
72779
72992
  if (group) escrowPayments.push(await signEscrow(wallet, group));
72780
72993
  const committed = await commitAsk(wallet, id2, payments, escrowPayments, bookingName);
72781
- emit5(opts, { ok: true, ...committed, signed: payments.length, bound: escrowPayments.length, ...bookingName ? { bookingName } : {} }, () => {
72994
+ emit6(opts, { ok: true, ...committed, signed: payments.length, bound: escrowPayments.length, ...bookingName ? { bookingName } : {} }, () => {
72782
72995
  process.stdout.write(`
72783
- ${import_picocolors13.default.bold("Committed.")} ${committed.picked.length} picked, ${committed.passed} passed.
72996
+ ${import_picocolors14.default.bold("Committed.")} ${committed.picked.length} picked, ${committed.passed} passed.
72784
72997
 
72785
72998
  `);
72786
72999
  for (const s of committed.settlements) {
72787
73000
  const how = s.state === "escrowed" ? `bound in ${s.escrowAddress}` : "signed, settles when it happens";
72788
- process.stdout.write(` ${import_picocolors13.default.dim(s.offerId)} $${usdOf(s.valueMicro)} \u2192 ${s.toAddr} ${import_picocolors13.default.dim(how)}
73001
+ process.stdout.write(` ${import_picocolors14.default.dim(s.offerId)} $${usdOf(s.valueMicro)} \u2192 ${s.toAddr} ${import_picocolors14.default.dim(how)}
72789
73002
  `);
72790
73003
  }
72791
- if (bookingName) process.stdout.write(` ${import_picocolors13.default.dim(`Agentgates books under ${bookingName}.`)}
73004
+ if (bookingName) process.stdout.write(` ${import_picocolors14.default.dim(`Agentgates books under ${bookingName}.`)}
72792
73005
  `);
72793
73006
  process.stdout.write(`
72794
- ${import_picocolors13.default.dim("Nothing left your wallet yet. Each provider settles its own when it delivers.")}
73007
+ ${import_picocolors14.default.dim("Nothing left your wallet yet. Each provider settles its own when it delivers.")}
72795
73008
 
72796
73009
  `);
72797
73010
  });
@@ -72816,11 +73029,11 @@ async function intentsWord(id2, opts) {
72816
73029
  return refuse5(opts, "This leg is on Solana: its word is signed by a Solana wallet, which this key is not.", "svm_word");
72817
73030
  }
72818
73031
  const settlement = await wordOnLeg(wallet, id2, opts.offer, happened, said?.word);
72819
- emit5(opts, { ok: true, settlement }, () => {
73032
+ emit6(opts, { ok: true, settlement }, () => {
72820
73033
  process.stdout.write(`
72821
- ${happened ? "It happened." : "It did not happen."} ${import_picocolors13.default.dim(settlement.state)}
73034
+ ${happened ? "It happened." : "It did not happen."} ${import_picocolors14.default.dim(settlement.state)}
72822
73035
  `);
72823
- if (settlement.settledTx) process.stdout.write(` ${import_picocolors13.default.dim(settlement.settledTx)}
73036
+ if (settlement.settledTx) process.stdout.write(` ${import_picocolors14.default.dim(settlement.settledTx)}
72824
73037
  `);
72825
73038
  process.stdout.write("\n");
72826
73039
  });
@@ -72832,8 +73045,8 @@ async function intentsClose(id2, opts) {
72832
73045
  try {
72833
73046
  const { wallet } = await requirePasswordsKey();
72834
73047
  const ask = await closeAsk(wallet, id2);
72835
- emit5(opts, { ok: true, ask }, () => process.stdout.write(`
72836
- Closed. ${import_picocolors13.default.dim(ask.state)}
73048
+ emit6(opts, { ok: true, ask }, () => process.stdout.write(`
73049
+ Closed. ${import_picocolors14.default.dim(ask.state)}
72837
73050
 
72838
73051
  `));
72839
73052
  } catch (err) {
@@ -72846,14 +73059,14 @@ async function intentsContext(opts) {
72846
73059
  const writing = opts.note !== void 0 || opts.learned !== void 0;
72847
73060
  const current = await readContext(wallet);
72848
73061
  const context = writing ? await putContext(wallet, opts.note ?? current.note, opts.learned ?? current.learned) : current;
72849
- emit5(opts, { ok: true, context }, () => {
73062
+ emit6(opts, { ok: true, context }, () => {
72850
73063
  process.stdout.write(`
72851
- ${import_picocolors13.default.bold("What your agent knows")} ${import_picocolors13.default.dim("(read by your agent only)")}
73064
+ ${import_picocolors14.default.bold("What your agent knows")} ${import_picocolors14.default.dim("(read by your agent only)")}
72852
73065
 
72853
73066
  `);
72854
- process.stdout.write(` ${context.note || import_picocolors13.default.dim("nothing written yet")}
73067
+ process.stdout.write(` ${context.note || import_picocolors14.default.dim("nothing written yet")}
72855
73068
  `);
72856
- for (const l of context.learned) process.stdout.write(` ${import_picocolors13.default.dim("learned")} ${l}
73069
+ for (const l of context.learned) process.stdout.write(` ${import_picocolors14.default.dim("learned")} ${l}
72857
73070
  `);
72858
73071
  process.stdout.write("\n");
72859
73072
  });
@@ -72866,7 +73079,7 @@ async function intentsOpen(opts) {
72866
73079
  const { wallet } = await requirePasswordsKey();
72867
73080
  if (!opts.city) return refuse5(opts, "--city: where you can serve", "no_city");
72868
73081
  const asks = await openAsks(wallet, opts.city);
72869
- emit5(opts, { ok: true, asks }, () => {
73082
+ emit6(opts, { ok: true, asks }, () => {
72870
73083
  if (asks.length === 0) {
72871
73084
  process.stdout.write(`
72872
73085
  Nothing open in ${opts.city} right now.
@@ -72877,7 +73090,7 @@ async function intentsOpen(opts) {
72877
73090
  process.stdout.write("\n");
72878
73091
  for (const a of asks) {
72879
73092
  process.stdout.write(
72880
- ` ${import_picocolors13.default.dim(a.id)} ${new Date(a.windowFrom).toLocaleString()} ${import_picocolors13.default.dim(`up to $${usdOf(a.capMicro)}`)}
73093
+ ` ${import_picocolors14.default.dim(a.id)} ${new Date(a.windowFrom).toLocaleString()} ${import_picocolors14.default.dim(`up to $${usdOf(a.capMicro)}`)}
72881
73094
  ${a.text}
72882
73095
 
72883
73096
  `
@@ -72917,9 +73130,9 @@ async function intentsOffer(askId, opts) {
72917
73130
  ...charge === "at_service" ? {} : { charge: { mode: charge } },
72918
73131
  ...opts.place || opts.address ? { place: { ...opts.place ? { name: opts.place } : {}, ...opts.address ? { address: opts.address } : {} } } : {}
72919
73132
  });
72920
- emit5(opts, { ok: true, offer }, () => {
73133
+ emit6(opts, { ok: true, offer }, () => {
72921
73134
  process.stdout.write(`
72922
- ${import_picocolors13.default.bold("Offered.")}
73135
+ ${import_picocolors14.default.bold("Offered.")}
72923
73136
 
72924
73137
  `);
72925
73138
  line("offer", offer.id);
@@ -72938,10 +73151,10 @@ async function intentsOffers(opts) {
72938
73151
  try {
72939
73152
  const { wallet } = await requirePasswordsKey();
72940
73153
  const offers = await listMyOffers(wallet);
72941
- emit5(opts, { ok: true, offers }, () => {
73154
+ emit6(opts, { ok: true, offers }, () => {
72942
73155
  if (offers.length === 0) {
72943
73156
  process.stdout.write(`
72944
- You have made no offers. ${import_picocolors13.default.dim("agentgates intents open --city \u2026")}
73157
+ You have made no offers. ${import_picocolors14.default.dim("agentgates intents open --city \u2026")}
72945
73158
 
72946
73159
  `);
72947
73160
  return;
@@ -72960,8 +73173,8 @@ async function intentsConfirm(askId, opts) {
72960
73173
  const { wallet } = await requirePasswordsKey();
72961
73174
  if (!opts.offer) return refuse5(opts, "--offer <offerId>: the offer of yours that was picked", "no_offer");
72962
73175
  const offer = await confirmOffer(wallet, askId, opts.offer);
72963
- emit5(opts, { ok: true, offer }, () => process.stdout.write(`
72964
- Confirmed. ${import_picocolors13.default.dim(offer.state)}
73176
+ emit6(opts, { ok: true, offer }, () => process.stdout.write(`
73177
+ Confirmed. ${import_picocolors14.default.dim(offer.state)}
72965
73178
 
72966
73179
  `));
72967
73180
  } catch (err) {
@@ -72973,11 +73186,11 @@ async function intentsSettle(askId, opts) {
72973
73186
  const { wallet } = await requirePasswordsKey();
72974
73187
  if (!opts.offer) return refuse5(opts, "--offer <offerId>: the leg you delivered", "no_offer");
72975
73188
  const out = await settleOffer(wallet, askId, opts.offer);
72976
- emit5(opts, { ok: true, ...out }, () => {
73189
+ emit6(opts, { ok: true, ...out }, () => {
72977
73190
  process.stdout.write(`
72978
- ${import_picocolors13.default.bold("Settled.")} $${usdOf(out.settlement.valueMicro)} to ${out.settlement.toAddr}
73191
+ ${import_picocolors14.default.bold("Settled.")} $${usdOf(out.settlement.valueMicro)} to ${out.settlement.toAddr}
72979
73192
  `);
72980
- process.stdout.write(` ${import_picocolors13.default.dim(out.txHash)}
73193
+ process.stdout.write(` ${import_picocolors14.default.dim(out.txHash)}
72981
73194
 
72982
73195
  `);
72983
73196
  });
@@ -72996,7 +73209,7 @@ function claimLines(c) {
72996
73209
  }
72997
73210
  function rulesLines(r) {
72998
73211
  line("agent", r.mode === "auto" ? "offers on its own" : "asks you first");
72999
- for (const l of r.lines) line(l.label.toLowerCase(), `${l.words}${l.fixed ? import_picocolors13.default.dim(" (fixed)") : ""}`);
73212
+ for (const l of r.lines) line(l.label.toLowerCase(), `${l.words}${l.fixed ? import_picocolors14.default.dim(" (fixed)") : ""}`);
73000
73213
  }
73001
73214
  async function intentsListing(id2, opts) {
73002
73215
  try {
@@ -73008,9 +73221,9 @@ async function intentsListing(id2, opts) {
73008
73221
  }
73009
73222
  if (!listingId) return refuse5(opts, "a listing id, or --phone <number> to find one", "no_listing");
73010
73223
  const { listing, near } = await readListingPublic(listingId);
73011
- emit5(opts, { ok: true, listing, near }, () => {
73224
+ emit6(opts, { ok: true, listing, near }, () => {
73012
73225
  process.stdout.write(`
73013
- ${import_picocolors13.default.bold(listing.name)} ${import_picocolors13.default.dim(listing.id)}
73226
+ ${import_picocolors14.default.bold(listing.name)} ${import_picocolors14.default.dim(listing.id)}
73014
73227
 
73015
73228
  `);
73016
73229
  line("address", [listing.address, listing.city].filter(Boolean).join(", "));
@@ -73021,14 +73234,14 @@ async function intentsListing(id2, opts) {
73021
73234
  line("rating", listing.ratingWords ?? ratingWordsOf(listing.rating));
73022
73235
  if (near.length) {
73023
73236
  process.stdout.write(`
73024
- ${import_picocolors13.default.dim(`open asks in ${listing.city}`)}
73237
+ ${import_picocolors14.default.dim(`open asks in ${listing.city}`)}
73025
73238
  `);
73026
- for (const a of near) process.stdout.write(` ${import_picocolors13.default.dim(a.id)} ${new Date(a.windowFrom).toLocaleString()} up to $${usdOf(a.capMicro)}
73239
+ for (const a of near) process.stdout.write(` ${import_picocolors14.default.dim(a.id)} ${new Date(a.windowFrom).toLocaleString()} up to $${usdOf(a.capMicro)}
73027
73240
  ${a.text}
73028
73241
  `);
73029
73242
  }
73030
73243
  process.stdout.write(`
73031
- ${import_picocolors13.default.dim(`agentgates intents claim ${listing.id} --by phone`)}
73244
+ ${import_picocolors14.default.dim(`agentgates intents claim ${listing.id} --by phone`)}
73032
73245
 
73033
73246
  `);
73034
73247
  });
@@ -73043,14 +73256,14 @@ async function intentsClaim(listingId, opts) {
73043
73256
  if (by !== "phone" && by !== "domain" && by !== "dns") return refuse5(opts, "--by phone, domain or dns", "bad_method");
73044
73257
  if (by === "domain" && !opts.mailbox) return refuse5(opts, "--mailbox <name>: the name before the @ at the listed domain", "no_mailbox");
73045
73258
  const out = await startClaim(wallet, listingId, by, opts.mailbox);
73046
- emit5(opts, { ok: true, ...out }, () => {
73259
+ emit6(opts, { ok: true, ...out }, () => {
73047
73260
  process.stdout.write(`
73048
- ${import_picocolors13.default.bold(out.listing.name)}
73261
+ ${import_picocolors14.default.bold(out.listing.name)}
73049
73262
 
73050
73263
  `);
73051
73264
  claimLines(out.claim);
73052
73265
  process.stdout.write(`
73053
- ${import_picocolors13.default.dim(by === "dns" ? `set the record, then: agentgates intents verify ${listingId}` : `agentgates intents verify ${listingId} --code <six digits>`)}
73266
+ ${import_picocolors14.default.dim(by === "dns" ? `set the record, then: agentgates intents verify ${listingId}` : `agentgates intents verify ${listingId} --code <six digits>`)}
73054
73267
 
73055
73268
  `);
73056
73269
  });
@@ -73062,11 +73275,11 @@ async function intentsVerify(listingId, opts) {
73062
73275
  try {
73063
73276
  const { wallet } = await requirePasswordsKey();
73064
73277
  const out = await verifyClaim(wallet, listingId, opts.code);
73065
- emit5(opts, { ok: true, ...out }, () => {
73278
+ emit6(opts, { ok: true, ...out }, () => {
73066
73279
  process.stdout.write(`
73067
- ${import_picocolors13.default.bold("Yours.")} ${out.listing.name} \xB7 ${verifiedWords(out.listing.verified)}${out.unbound ? " \xB7 the key that held it before was unbound and told" : ""}
73280
+ ${import_picocolors14.default.bold("Yours.")} ${out.listing.name} \xB7 ${verifiedWords(out.listing.verified)}${out.unbound ? " \xB7 the key that held it before was unbound and told" : ""}
73068
73281
  `);
73069
- process.stdout.write(` ${import_picocolors13.default.dim(`agentgates intents rules ${listingId} "<what you offer, when, the price, for how many, how you are paid, cancellation>"`)}
73282
+ process.stdout.write(` ${import_picocolors14.default.dim(`agentgates intents rules ${listingId} "<what you offer, when, the price, for how many, how you are paid, cancellation>"`)}
73070
73283
 
73071
73284
  `);
73072
73285
  });
@@ -73097,11 +73310,11 @@ async function intentsRules(listingId, words7, opts) {
73097
73310
  rules = board.rules;
73098
73311
  }
73099
73312
  if (!rules) return refuse5(opts, "no rules yet: say them in your words", "no_rules");
73100
- emit5(opts, { ok: true, rules }, () => {
73313
+ emit6(opts, { ok: true, rules }, () => {
73101
73314
  process.stdout.write("\n");
73102
73315
  rulesLines(rules);
73103
73316
  process.stdout.write(`
73104
- ${import_picocolors13.default.dim(`fix a line: agentgates intents rules ${listingId} --fix "price=$95 per person"`)}
73317
+ ${import_picocolors14.default.dim(`fix a line: agentgates intents rules ${listingId} --fix "price=$95 per person"`)}
73105
73318
 
73106
73319
  `);
73107
73320
  });
@@ -73114,10 +73327,10 @@ async function intentsBoard(listingId, opts) {
73114
73327
  const { wallet } = await requirePasswordsKey();
73115
73328
  const board = await readBoard(wallet, listingId);
73116
73329
  const claim = await readMyClaim(wallet, listingId, "payout").catch(() => null);
73117
- emit5(opts, { ok: true, board, payoutClaim: claim }, () => {
73330
+ emit6(opts, { ok: true, board, payoutClaim: claim }, () => {
73118
73331
  const l = board.listing;
73119
73332
  process.stdout.write(`
73120
- ${import_picocolors13.default.bold(l.name)} ${import_picocolors13.default.dim(l.id)}
73333
+ ${import_picocolors14.default.bold(l.name)} ${import_picocolors14.default.dim(l.id)}
73121
73334
 
73122
73335
  `);
73123
73336
  line("status", `${verifiedWords(l.verified)}${l.contested ? " \xB7 a claim is being decided" : ""}`);
@@ -73125,30 +73338,30 @@ async function intentsBoard(listingId, opts) {
73125
73338
  line("paid to", board.payout.kind === "venue" ? "at the venue" : board.payout.kind === "address" ? `an address on ${Object.keys(board.payout.payTo).join(", ")}` : "this account");
73126
73339
  if (board.rules) rulesLines(board.rules);
73127
73340
  process.stdout.write(`
73128
- ${import_picocolors13.default.dim("picks")}
73341
+ ${import_picocolors14.default.dim("picks")}
73129
73342
  `);
73130
73343
  if (board.picks.length === 0) process.stdout.write(" none yet\n");
73131
- for (const p of board.picks) process.stdout.write(` ${import_picocolors13.default.dim(p.offer.id)} ${p.offer.role.padEnd(10)} ${new Date(p.offer.startsAt).toLocaleString()} ${p.offer.priceMicro === "0" ? "at the venue" : `$${usdOf(p.offer.priceMicro)}`} ${p.settlement?.state ?? p.offer.state}
73344
+ for (const p of board.picks) process.stdout.write(` ${import_picocolors14.default.dim(p.offer.id)} ${p.offer.role.padEnd(10)} ${new Date(p.offer.startsAt).toLocaleString()} ${p.offer.priceMicro === "0" ? "at the venue" : `$${usdOf(p.offer.priceMicro)}`} ${p.settlement?.state ?? p.offer.state}
73132
73345
  ${p.ask?.text ?? ""}
73133
73346
  `);
73134
73347
  if (board.open.length) {
73135
73348
  process.stdout.write(`
73136
- ${import_picocolors13.default.dim("offers out")}
73349
+ ${import_picocolors14.default.dim("offers out")}
73137
73350
  `);
73138
- for (const o of board.open) process.stdout.write(` ${import_picocolors13.default.dim(o.offer.id)} ${o.offer.role.padEnd(10)} ${new Date(o.offer.startsAt).toLocaleString()} $${usdOf(o.offer.priceMicro)}
73351
+ for (const o of board.open) process.stdout.write(` ${import_picocolors14.default.dim(o.offer.id)} ${o.offer.role.padEnd(10)} ${new Date(o.offer.startsAt).toLocaleString()} $${usdOf(o.offer.priceMicro)}
73139
73352
  ${o.ask?.text ?? ""}
73140
73353
  `);
73141
73354
  }
73142
73355
  if (board.rating.rows.length) {
73143
73356
  process.stdout.write(`
73144
- ${import_picocolors13.default.dim("ratings")}
73357
+ ${import_picocolors14.default.dim("ratings")}
73145
73358
  `);
73146
- for (const r of board.rating.rows) process.stdout.write(` ${"\u2605".repeat(r.stars)} ${r.words} ${import_picocolors13.default.dim(new Date(r.at).toLocaleDateString())}
73359
+ for (const r of board.rating.rows) process.stdout.write(` ${"\u2605".repeat(r.stars)} ${r.words} ${import_picocolors14.default.dim(new Date(r.at).toLocaleDateString())}
73147
73360
  `);
73148
73361
  }
73149
73362
  if (board.texts.length) {
73150
73363
  process.stdout.write(`
73151
- ${import_picocolors13.default.dim(`texts to ${l.phone ?? "the listed phone"}`)}
73364
+ ${import_picocolors14.default.dim(`texts to ${l.phone ?? "the listed phone"}`)}
73152
73365
  `);
73153
73366
  for (const t of board.texts) process.stdout.write(` ${t.what} ${new Date(t.at).toLocaleString()} ${t.ok ? "sent" : `did not go: ${t.reason ?? "refused"}`}
73154
73367
  `);
@@ -73165,14 +73378,14 @@ async function intentsPayout(listingId, opts) {
73165
73378
  const wantsSet = opts.venue === true || Boolean(opts.to);
73166
73379
  if (!wantsSet) {
73167
73380
  const out2 = await setPayout(wallet, listingId, {});
73168
- emit5(opts, { ok: true, ...out2 }, () => {
73381
+ emit6(opts, { ok: true, ...out2 }, () => {
73169
73382
  process.stdout.write(`
73170
73383
  A code is on its way to the listed phone.
73171
73384
 
73172
73385
  `);
73173
73386
  if (out2.claim) claimLines(out2.claim);
73174
73387
  process.stdout.write(`
73175
- ${import_picocolors13.default.dim(`agentgates intents payout ${listingId} --code <six digits> --to <USDC address> (or --venue)`)}
73388
+ ${import_picocolors14.default.dim(`agentgates intents payout ${listingId} --code <six digits> --to <USDC address> (or --venue)`)}
73176
73389
 
73177
73390
  `);
73178
73391
  });
@@ -73183,9 +73396,9 @@ async function intentsPayout(listingId, opts) {
73183
73396
  const payTo = {};
73184
73397
  if (opts.to) for (const c of chains) payTo[c] = opts.to;
73185
73398
  const out = await setPayout(wallet, listingId, { code: opts.code, ...opts.venue ? { venue: true } : { payTo } });
73186
- emit5(opts, { ok: true, ...out }, () => {
73399
+ emit6(opts, { ok: true, ...out }, () => {
73187
73400
  process.stdout.write(`
73188
- ${import_picocolors13.default.bold("Set.")} Paid ${out.payout.kind === "venue" ? "at the venue" : `to your address on ${Object.keys(out.payout.payTo).join(", ")}`}.
73401
+ ${import_picocolors14.default.bold("Set.")} Paid ${out.payout.kind === "venue" ? "at the venue" : `to your address on ${Object.keys(out.payout.payTo).join(", ")}`}.
73189
73402
 
73190
73403
  `);
73191
73404
  });
@@ -73200,11 +73413,11 @@ async function intentsRate(askId, opts) {
73200
73413
  const stars = Number(opts.stars);
73201
73414
  if (!Number.isInteger(stars) || stars < 1 || stars > 5) return refuse5(opts, "--stars 1 to 5", "bad_stars");
73202
73415
  const out = await rateLeg(wallet, askId, { offerId: opts.offer, stars, words: opts.words ?? "", ...opts.edit ? { edit: true } : {} });
73203
- emit5(opts, { ok: true, ...out }, () => {
73416
+ emit6(opts, { ok: true, ...out }, () => {
73204
73417
  process.stdout.write(`
73205
- ${import_picocolors13.default.bold(out.rating.edited ? "Changed." : "Rated.")} ${out.listing.name}: ${out.listing.ratingWords}
73418
+ ${import_picocolors14.default.bold(out.rating.edited ? "Changed." : "Rated.")} ${out.listing.name}: ${out.listing.ratingWords}
73206
73419
  `);
73207
- if (out.rating.words) process.stdout.write(` ${import_picocolors13.default.dim(`"${out.rating.words}"`)}
73420
+ if (out.rating.words) process.stdout.write(` ${import_picocolors14.default.dim(`"${out.rating.words}"`)}
73208
73421
  `);
73209
73422
  process.stdout.write("\n");
73210
73423
  });
@@ -73217,9 +73430,9 @@ async function intentsNoShow(askId, opts) {
73217
73430
  const { wallet } = await requirePasswordsKey();
73218
73431
  if (!opts.offer) return refuse5(opts, "--offer <offerId>: your committed leg the poster did not show for", "no_offer");
73219
73432
  const out = await markNoShow(wallet, askId, opts.offer);
73220
- emit5(opts, { ok: true, ...out }, () => {
73433
+ emit6(opts, { ok: true, ...out }, () => {
73221
73434
  process.stdout.write(`
73222
- ${import_picocolors13.default.bold("Marked.")} This poster: ${out.poster.settled} settled, ${out.poster.confirmed} confirmed, ${out.poster.noShows} no-show${out.poster.noShows === 1 ? "" : "s"}. Sellers see it; posters never do.
73435
+ ${import_picocolors14.default.bold("Marked.")} This poster: ${out.poster.settled} settled, ${out.poster.confirmed} confirmed, ${out.poster.noShows} no-show${out.poster.noShows === 1 ? "" : "s"}. Sellers see it; posters never do.
73223
73436
 
73224
73437
  `);
73225
73438
  });
@@ -73228,135 +73441,6 @@ async function intentsNoShow(askId, opts) {
73228
73441
  }
73229
73442
  }
73230
73443
 
73231
- // src/commands/keys.ts
73232
- var import_picocolors14 = __toESM(require_picocolors(), 1);
73233
- import { hostname as hostname2 } from "node:os";
73234
- init_passwords_wire();
73235
- function emit6(opts, data4, human) {
73236
- if (opts.json || !process.stdout.isTTY) {
73237
- process.stdout.write(`${JSON.stringify(data4)}
73238
- `);
73239
- return;
73240
- }
73241
- human();
73242
- }
73243
- function fail2(opts, err) {
73244
- const message = err instanceof Error ? err.message : String(err);
73245
- const code = err?.code;
73246
- if (opts.json || !process.stdout.isTTY) {
73247
- process.stdout.write(`${JSON.stringify({ ok: false, error: message, ...typeof code === "string" ? { code } : {} })}
73248
- `);
73249
- } else {
73250
- process.stderr.write(`
73251
- ${import_picocolors14.default.red("\u2717")} ${message}
73252
-
73253
- `);
73254
- }
73255
- process.exit(1);
73256
- }
73257
- function whenLabel(iso) {
73258
- if (!iso) return "never";
73259
- const d = new Date(iso);
73260
- return Number.isNaN(d.getTime()) ? "" : d.toISOString().slice(0, 16).replace("T", " ");
73261
- }
73262
- function printRows(rows, mine) {
73263
- if (rows.length === 0) {
73264
- process.stdout.write(`
73265
- ${import_picocolors14.default.dim("no login keys on this account yet")}
73266
- ${import_picocolors14.default.dim("agentgates keys create --keep \xB7 mints one for this machine")}
73267
-
73268
- `);
73269
- return;
73270
- }
73271
- process.stdout.write("\n");
73272
- for (const r of rows) {
73273
- const here = mine && r.prefix === mine ? import_picocolors14.default.green(" this machine") : "";
73274
- process.stdout.write(` ${import_picocolors14.default.bold(r.prefix)} ${r.name} ${import_picocolors14.default.dim(`used ${whenLabel(r.lastUsedAt)}`)} ${import_picocolors14.default.dim(r.id)}${here}
73275
- `);
73276
- }
73277
- process.stdout.write("\n");
73278
- }
73279
- async function keysList(opts) {
73280
- try {
73281
- const keys2 = await requirePasswordsKey();
73282
- const rows = await listLoginKeys(keys2.wallet);
73283
- emit6(opts, { ok: true, address: keys2.state.address, keys: rows, thisMachine: keys2.state.apiKeyPrefix ?? null }, () => printRows(rows, keys2.state.apiKeyPrefix ?? null));
73284
- } catch (err) {
73285
- fail2(opts, err);
73286
- }
73287
- }
73288
- async function keysCreate(opts) {
73289
- try {
73290
- const keys2 = await requirePasswordsKey();
73291
- const name = (opts.name?.trim() || `cli ${hostname2()}`).slice(0, 64);
73292
- const made = await createLoginKey(keys2.wallet, name);
73293
- if (opts.keep) await saveLoginKey(keys2.state, { secret: made.key, prefix: made.created.prefix, name: made.created.name });
73294
- emit6(opts, { ok: true, key: made.key, created: made.created, kept: opts.keep === true }, () => {
73295
- process.stdout.write(
73296
- `
73297
- ${import_picocolors14.default.green("\u2713")} login key minted: ${import_picocolors14.default.bold(made.created.name)}
73298
-
73299
- ${made.key}
73300
-
73301
- ${import_picocolors14.default.dim("Shown once. Send it as Authorization: Bearer <key> on every /api/account door; the words stay home.")}
73302
- ` + (opts.keep ? ` ${import_picocolors14.default.dim("Kept in the key file: this machine sends it from now on.")}
73303
-
73304
- ` : ` ${import_picocolors14.default.dim("agentgates keys create --keep \xB7 would have made it this machine's")}
73305
-
73306
- `)
73307
- );
73308
- });
73309
- } catch (err) {
73310
- fail2(opts, err);
73311
- }
73312
- }
73313
- async function keysRevoke(id2, opts) {
73314
- try {
73315
- const keys2 = await requirePasswordsKey();
73316
- const before = await listLoginKeys(keys2.wallet);
73317
- const target = before.find((r) => r.id === id2);
73318
- const out = await revokeLoginKey(keys2.wallet, id2);
73319
- const wasMine = !!target && !!keys2.state.apiKeyPrefix && target.prefix === keys2.state.apiKeyPrefix;
73320
- if (wasMine) await forgetLoginKey(keys2.state);
73321
- emit6(opts, { ok: true, revoked: id2, keys: out.keys, thisMachineDropped: wasMine }, () => {
73322
- process.stdout.write(`
73323
- ${import_picocolors14.default.green("\u2713")} revoked ${target ? import_picocolors14.default.bold(target.prefix) : id2}${wasMine ? import_picocolors14.default.dim(" (this machine signs with the words until keys create --keep)") : ""}
73324
- `);
73325
- printRows(out.keys, wasMine ? null : keys2.state.apiKeyPrefix ?? null);
73326
- });
73327
- } catch (err) {
73328
- fail2(opts, err);
73329
- }
73330
- }
73331
- async function keysUse(secret, opts) {
73332
- try {
73333
- const key = (secret || "").trim();
73334
- if (!KEY_SECRET_SHAPE.test(key)) throw new Error("that is not a key of this lane: agk_ or agv_ followed by 64 hex characters, as shown once on Agent APIs");
73335
- setLoginKey(key, { keyOnly: true });
73336
- const copy4 = await mailKeyFromLoginKey();
73337
- let ownerWallet = copy4?.address ?? null;
73338
- if (!ownerWallet) {
73339
- const bal = expectOk(await signedFetch(standInWallet(), "GET", lanePath("/credits")), "the key");
73340
- ownerWallet = bal.ownerWallet ?? bal.owner ?? bal.address ?? null;
73341
- if (!ownerWallet) throw new Error("the key is live but the balance door named no account; try again");
73342
- }
73343
- const prefix = `${key.slice(0, 12)}\u2026`;
73344
- const { mode } = await useLoginKey({ secret: key, prefix, name: opts.name?.trim() || `use ${hostname2()}`, ownerWallet });
73345
- emit6(opts, { ok: true, address: ownerWallet, prefix, sealed: !!copy4, mode, file: passwordsKeyPath() }, () => {
73346
- process.stdout.write(
73347
- `
73348
- ${import_picocolors14.default.green("\u2713")} this machine runs on ${import_picocolors14.default.bold(prefix)} for ${ownerWallet}${mode === "beside-the-words" ? import_picocolors14.default.dim(" (beside the words already here)") : ""}
73349
- ${import_picocolors14.default.dim(copy4 ? "It holds a copy of the account's data key: sealed calls and mail open here." : "No copy of the data key on this key: sealed calls and mail read as shut; a key minted with Read on Phone or Mail carries one.")}
73350
- ${import_picocolors14.default.dim("The keys door and the seal doors take the words; everything else takes this key.")}
73351
-
73352
- `
73353
- );
73354
- });
73355
- } catch (err) {
73356
- fail2(opts, err);
73357
- }
73358
- }
73359
-
73360
73444
  // src/commands/logout.ts
73361
73445
  var import_picocolors15 = __toESM(require_picocolors(), 1);
73362
73446
  async function logout(opts) {
@@ -77894,7 +77978,7 @@ var program2 = new Command();
77894
77978
  program2.name("agentgates").description(
77895
77979
  "Drive your non-custodial Agentgates wallet from the terminal.\nPair once with biometric; every send still requires biometric in your browser."
77896
77980
  ).version(VERSION);
77897
- program2.command("login").description("Log in. With an API key from Agent APIs (agk_\u2026): run this machine on that account, no browser, what the key's grid allows. With nothing: pair this terminal with your Agentgates wallet (one-time)").argument("[key]", "an API key minted on agentgates.ai Agent APIs (agk_\u2026): the same as agentgates keys use").option("--profile <name>", "named profile (default: 'default')").option("--no-browser", "don't auto-open the approval URL \u2014 print it only").option("--json", "machine-readable output (with a key)").action(async (key, opts) => {
77981
+ program2.command("login").description("Log in. With an API key from Agent APIs (agk_\u2026): run this machine on that account, no browser, what the key's grid allows. With nothing: pair this terminal with your Agentgates wallet (one-time)").argument("[key]", "an API key minted on agentgates.ai, the whole string (agk_\u2026.<reading part>): the same as agentgates keys use. The part after the dot stays on this machine").option("--profile <name>", "named profile (default: 'default')").option("--no-browser", "don't auto-open the approval URL \u2014 print it only").option("--json", "machine-readable output (with a key)").action(async (key, opts) => {
77898
77982
  if (key) {
77899
77983
  await keysUse(key, { json: opts.json });
77900
77984
  return;
@@ -78526,7 +78610,7 @@ keys.command("create").description("Mint a login key by name, shown once. --keep
78526
78610
  keys.command("revoke <id>").description("End a login key. Revoking this machine's own key makes it sign with the words until keys create --keep.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
78527
78611
  await keysRevoke(id2, opts);
78528
78612
  });
78529
- keys.command("use <key>").description("Run this machine on a key alone (no words here): every identity command sends it as Bearer; a key minted with Read on Phone or Mail opens sealed calls and mail with its own copy of the account's data key. The keys and seal doors still take the words.").option("--name <name>", "what to call it in the key file (defaults to use <hostname>)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (key, opts) => {
78613
+ keys.command("use <key>").description("Run this machine on a key alone (no words here): the key is split, its wire part goes on every call as Bearer, its reading part stays in the key file and opens sealed calls and mail with the key's own copy of the account's data key. The keys and seal doors still take the words.").option("--name <name>", "what to call it in the key file (defaults to use <hostname>)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (key, opts) => {
78530
78614
  await keysUse(key, opts);
78531
78615
  });
78532
78616
  program2.command("update").description("Bring this copy to the version npm serves as latest, in the place it runs from (the installer's ~/.agentgates, or a global npm install).").option("--check", "say whether a newer version is out; install nothing").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
@@ -78538,8 +78622,8 @@ program2.command("open").description(
78538
78622
  await sessionOpen(opts);
78539
78623
  });
78540
78624
  program2.command("receive").description(
78541
- "Take a session from a human: prints a code; on agentgates.ai the human presses Top up \u2192 Hand this session to my agent and types it. The words arrive once over 127.0.0.1 and this CLI becomes that account."
78542
- ).option("--wait <seconds>", "how long the code stays alive (300)").option("--replace", "overwrite the key already here (the old key is the only thing that opens the rows it sealed)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
78625
+ "Take an account from a human: prints a code; on agentgates.ai the human presses Connect an agent on this computer and types it. A full-access API key arrives once over 127.0.0.1 and this CLI runs on that account; the human's words never leave their browser."
78626
+ ).option("--wait <seconds>", "how long the code stays alive (300)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
78543
78627
  await sessionReceive(opts);
78544
78628
  });
78545
78629
  browser.command("balance").description("The prepaid balance every step draws from, and this key's own deposit address to top it up (USDC on Base or Polygon).").option("--scan", "ask the lane to credit a fresh arrival now instead of within five minutes").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {